Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
yaml-cpp
Commits
db0bda70
Commit
db0bda70
authored
Sep 14, 2019
by
Andy Maloney
Committed by
Jesse Beder
Sep 14, 2019
Browse files
Static analysis fix: replace 0 and NULL with nullptr (#738)
parent
6cdf3636
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
14 additions
and
14 deletions
+14
-14
include/yaml-cpp/binary.h
include/yaml-cpp/binary.h
+1
-1
include/yaml-cpp/exceptions.h
include/yaml-cpp/exceptions.h
+2
-2
include/yaml-cpp/node/detail/impl.h
include/yaml-cpp/node/detail/impl.h
+7
-7
include/yaml-cpp/node/detail/node_iterator.h
include/yaml-cpp/node/detail/node_iterator.h
+2
-2
include/yaml-cpp/node/impl.h
include/yaml-cpp/node/impl.h
+1
-1
include/yaml-cpp/ostream_wrapper.h
include/yaml-cpp/ostream_wrapper.h
+1
-1
No files found.
include/yaml-cpp/binary.h
View file @
db0bda70
...
@@ -39,7 +39,7 @@ class YAML_CPP_API Binary {
...
@@ -39,7 +39,7 @@ class YAML_CPP_API Binary {
rhs
.
clear
();
rhs
.
clear
();
rhs
.
resize
(
m_unownedSize
);
rhs
.
resize
(
m_unownedSize
);
std
::
copy
(
m_unownedData
,
m_unownedData
+
m_unownedSize
,
rhs
.
begin
());
std
::
copy
(
m_unownedData
,
m_unownedData
+
m_unownedSize
,
rhs
.
begin
());
m_unownedData
=
0
;
m_unownedData
=
nullptr
;
m_unownedSize
=
0
;
m_unownedSize
=
0
;
}
else
{
}
else
{
m_data
.
swap
(
rhs
);
m_data
.
swap
(
rhs
);
...
...
include/yaml-cpp/exceptions.h
View file @
db0bda70
...
@@ -117,7 +117,7 @@ inline const std::string KEY_NOT_FOUND_WITH_KEY(
...
@@ -117,7 +117,7 @@ inline const std::string KEY_NOT_FOUND_WITH_KEY(
template
<
typename
T
>
template
<
typename
T
>
inline
const
std
::
string
BAD_SUBSCRIPT_WITH_KEY
(
inline
const
std
::
string
BAD_SUBSCRIPT_WITH_KEY
(
const
T
&
,
typename
disable_if
<
is_numeric
<
T
>>::
type
*
=
0
)
{
const
T
&
,
typename
disable_if
<
is_numeric
<
T
>>::
type
*
=
nullptr
)
{
return
BAD_SUBSCRIPT
;
return
BAD_SUBSCRIPT
;
}
}
...
@@ -129,7 +129,7 @@ inline const std::string BAD_SUBSCRIPT_WITH_KEY(const std::string& key) {
...
@@ -129,7 +129,7 @@ inline const std::string BAD_SUBSCRIPT_WITH_KEY(const std::string& key) {
template
<
typename
T
>
template
<
typename
T
>
inline
const
std
::
string
BAD_SUBSCRIPT_WITH_KEY
(
inline
const
std
::
string
BAD_SUBSCRIPT_WITH_KEY
(
const
T
&
key
,
typename
enable_if
<
is_numeric
<
T
>>::
type
*
=
0
)
{
const
T
&
key
,
typename
enable_if
<
is_numeric
<
T
>>::
type
*
=
nullptr
)
{
std
::
stringstream
stream
;
std
::
stringstream
stream
;
stream
<<
BAD_SUBSCRIPT
<<
" (key:
\"
"
<<
key
<<
"
\"
)"
;
stream
<<
BAD_SUBSCRIPT
<<
" (key:
\"
"
<<
key
<<
"
\"
)"
;
return
stream
.
str
();
return
stream
.
str
();
...
...
include/yaml-cpp/node/detail/impl.h
View file @
db0bda70
...
@@ -17,7 +17,7 @@ template <typename Key, typename Enable = void>
...
@@ -17,7 +17,7 @@ template <typename Key, typename Enable = void>
struct
get_idx
{
struct
get_idx
{
static
node
*
get
(
const
std
::
vector
<
node
*>&
/* sequence */
,
static
node
*
get
(
const
std
::
vector
<
node
*>&
/* sequence */
,
const
Key
&
/* key */
,
shared_memory_holder
/* pMemory */
)
{
const
Key
&
/* key */
,
shared_memory_holder
/* pMemory */
)
{
return
0
;
return
nullptr
;
}
}
};
};
...
@@ -27,7 +27,7 @@ struct get_idx<Key,
...
@@ -27,7 +27,7 @@ struct get_idx<Key,
!
std
::
is_same
<
Key
,
bool
>::
value
>::
type
>
{
!
std
::
is_same
<
Key
,
bool
>::
value
>::
type
>
{
static
node
*
get
(
const
std
::
vector
<
node
*>&
sequence
,
const
Key
&
key
,
static
node
*
get
(
const
std
::
vector
<
node
*>&
sequence
,
const
Key
&
key
,
shared_memory_holder
/* pMemory */
)
{
shared_memory_holder
/* pMemory */
)
{
return
key
<
sequence
.
size
()
?
sequence
[
key
]
:
0
;
return
key
<
sequence
.
size
()
?
sequence
[
key
]
:
nullptr
;
}
}
static
node
*
get
(
std
::
vector
<
node
*>&
sequence
,
const
Key
&
key
,
static
node
*
get
(
std
::
vector
<
node
*>&
sequence
,
const
Key
&
key
,
...
@@ -46,13 +46,13 @@ struct get_idx<Key, typename std::enable_if<std::is_signed<Key>::value>::type> {
...
@@ -46,13 +46,13 @@ struct get_idx<Key, typename std::enable_if<std::is_signed<Key>::value>::type> {
shared_memory_holder
pMemory
)
{
shared_memory_holder
pMemory
)
{
return
key
>=
0
?
get_idx
<
std
::
size_t
>::
get
(
return
key
>=
0
?
get_idx
<
std
::
size_t
>::
get
(
sequence
,
static_cast
<
std
::
size_t
>
(
key
),
pMemory
)
sequence
,
static_cast
<
std
::
size_t
>
(
key
),
pMemory
)
:
0
;
:
nullptr
;
}
}
static
node
*
get
(
std
::
vector
<
node
*>&
sequence
,
const
Key
&
key
,
static
node
*
get
(
std
::
vector
<
node
*>&
sequence
,
const
Key
&
key
,
shared_memory_holder
pMemory
)
{
shared_memory_holder
pMemory
)
{
return
key
>=
0
?
get_idx
<
std
::
size_t
>::
get
(
return
key
>=
0
?
get_idx
<
std
::
size_t
>::
get
(
sequence
,
static_cast
<
std
::
size_t
>
(
key
),
pMemory
)
sequence
,
static_cast
<
std
::
size_t
>
(
key
),
pMemory
)
:
0
;
:
nullptr
;
}
}
};
};
...
@@ -109,11 +109,11 @@ inline node* node_data::get(const Key& key,
...
@@ -109,11 +109,11 @@ inline node* node_data::get(const Key& key,
break
;
break
;
case
NodeType
::
Undefined
:
case
NodeType
::
Undefined
:
case
NodeType
::
Null
:
case
NodeType
::
Null
:
return
NULL
;
return
nullptr
;
case
NodeType
::
Sequence
:
case
NodeType
::
Sequence
:
if
(
node
*
pNode
=
get_idx
<
Key
>::
get
(
m_sequence
,
key
,
pMemory
))
if
(
node
*
pNode
=
get_idx
<
Key
>::
get
(
m_sequence
,
key
,
pMemory
))
return
pNode
;
return
pNode
;
return
NULL
;
return
nullptr
;
case
NodeType
::
Scalar
:
case
NodeType
::
Scalar
:
throw
BadSubscript
(
key
);
throw
BadSubscript
(
key
);
}
}
...
@@ -124,7 +124,7 @@ inline node* node_data::get(const Key& key,
...
@@ -124,7 +124,7 @@ inline node* node_data::get(const Key& key,
}
}
}
}
return
NULL
;
return
nullptr
;
}
}
template
<
typename
Key
>
template
<
typename
Key
>
...
...
include/yaml-cpp/node/detail/node_iterator.h
View file @
db0bda70
...
@@ -26,9 +26,9 @@ template <typename V>
...
@@ -26,9 +26,9 @@ template <typename V>
struct
node_iterator_value
:
public
std
::
pair
<
V
*
,
V
*>
{
struct
node_iterator_value
:
public
std
::
pair
<
V
*
,
V
*>
{
typedef
std
::
pair
<
V
*
,
V
*>
kv
;
typedef
std
::
pair
<
V
*
,
V
*>
kv
;
node_iterator_value
()
:
kv
(),
pNode
(
0
)
{}
node_iterator_value
()
:
kv
(),
pNode
(
nullptr
)
{}
explicit
node_iterator_value
(
V
&
rhs
)
:
kv
(),
pNode
(
&
rhs
)
{}
explicit
node_iterator_value
(
V
&
rhs
)
:
kv
(),
pNode
(
&
rhs
)
{}
explicit
node_iterator_value
(
V
&
key
,
V
&
value
)
:
kv
(
&
key
,
&
value
),
pNode
(
0
)
{}
explicit
node_iterator_value
(
V
&
key
,
V
&
value
)
:
kv
(
&
key
,
&
value
),
pNode
(
nullptr
)
{}
V
&
operator
*
()
const
{
return
*
pNode
;
}
V
&
operator
*
()
const
{
return
*
pNode
;
}
V
&
operator
->
()
const
{
return
*
pNode
;
}
V
&
operator
->
()
const
{
return
*
pNode
;
}
...
...
include/yaml-cpp/node/impl.h
View file @
db0bda70
...
@@ -52,7 +52,7 @@ inline Node::Node(Zombie)
...
@@ -52,7 +52,7 @@ inline Node::Node(Zombie)
:
m_isValid
(
false
),
m_invalidKey
{},
m_pMemory
{},
m_pNode
(
nullptr
)
{}
:
m_isValid
(
false
),
m_invalidKey
{},
m_pMemory
{},
m_pNode
(
nullptr
)
{}
inline
Node
::
Node
(
Zombie
,
const
std
::
string
&
key
)
inline
Node
::
Node
(
Zombie
,
const
std
::
string
&
key
)
:
m_isValid
(
false
),
m_invalidKey
(
key
),
m_pMemory
{},
m_pNode
(
NULL
)
{}
:
m_isValid
(
false
),
m_invalidKey
(
key
),
m_pMemory
{},
m_pNode
(
nullptr
)
{}
inline
Node
::
Node
(
detail
::
node
&
node
,
detail
::
shared_memory_holder
pMemory
)
inline
Node
::
Node
(
detail
::
node
&
node
,
detail
::
shared_memory_holder
pMemory
)
:
m_isValid
(
true
),
m_invalidKey
{},
m_pMemory
(
pMemory
),
m_pNode
(
&
node
)
{}
:
m_isValid
(
true
),
m_invalidKey
{},
m_pMemory
(
pMemory
),
m_pNode
(
&
node
)
{}
...
...
include/yaml-cpp/ostream_wrapper.h
View file @
db0bda70
...
@@ -30,7 +30,7 @@ class YAML_CPP_API ostream_wrapper {
...
@@ -30,7 +30,7 @@ class YAML_CPP_API ostream_wrapper {
const
char
*
str
()
const
{
const
char
*
str
()
const
{
if
(
m_pStream
)
{
if
(
m_pStream
)
{
return
0
;
return
nullptr
;
}
else
{
}
else
{
m_buffer
[
m_pos
]
=
'\0'
;
m_buffer
[
m_pos
]
=
'\0'
;
return
&
m_buffer
[
0
];
return
&
m_buffer
[
0
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment