Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yaml-cpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
yaml-cpp
Commits
147d909f
Commit
147d909f
authored
Dec 06, 2016
by
butataatawa
Committed by
Jesse Beder
Dec 06, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix inconsistent Node::size when removing a key with unassigned node (#327) (#449)
parent
e3492bb3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
include/yaml-cpp/node/detail/impl.h
+8
-0
test/node/node_test.cpp
+7
-0
No files found.
include/yaml-cpp/node/detail/impl.h
View file @
147d909f
...
...
@@ -132,6 +132,14 @@ inline bool node_data::remove(const Key& key, shared_memory_holder pMemory) {
if
(
m_type
!=
NodeType
::
Map
)
return
false
;
kv_pairs
::
iterator
it
=
m_undefinedPairs
.
begin
();
while
(
it
!=
m_undefinedPairs
.
end
())
{
kv_pairs
::
iterator
jt
=
std
::
next
(
it
);
if
(
it
->
first
->
equals
(
key
,
pMemory
))
m_undefinedPairs
.
erase
(
it
);
it
=
jt
;
}
for
(
node_map
::
iterator
it
=
m_map
.
begin
();
it
!=
m_map
.
end
();
++
it
)
{
if
(
it
->
first
->
equals
(
key
,
pMemory
))
{
m_map
.
erase
(
it
);
...
...
test/node/node_test.cpp
View file @
147d909f
...
...
@@ -88,6 +88,13 @@ TEST(NodeTest, MapWithUndefinedValues) {
EXPECT_EQ
(
2
,
node
.
size
());
}
TEST
(
NodeTest
,
RemoveUnassignedNode
)
{
Node
node
(
NodeType
::
Map
);
node
[
"key"
];
node
.
remove
(
"key"
);
EXPECT_EQ
(
node
.
size
(),
0
);
}
TEST
(
NodeTest
,
MapForceInsert
)
{
Node
node
;
Node
k1
(
"k1"
);
...
...
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