summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar tihmstar2019-06-26 18:27:20 +0200
committerGravatar GitHub2019-06-26 18:27:20 +0200
commitec957fb8253ffbced690fb5bcb1743f015ab0815 (patch)
tree8ca873ad0efe38394711b53c30007e4785e5a5fc
parent17546f53ac1377b0d4f45a800aaec7366ba5b6a0 (diff)
downloadlibplist-ec957fb8253ffbced690fb5bcb1743f015ab0815.tar.gz
libplist-ec957fb8253ffbced690fb5bcb1743f015ab0815.tar.bz2
Fixed bug in dictionary_fill
Bug: when creating a new Dictionary object (for example through PList::Node::FromPlist(plist_t node) ), the dictionary_fill function is called from Dictionary() constructor in line 50. It seems that the intended way of calling dictionary_fill() is to pass the _map object by reference, however it is actually passed by value. Thus the changes to the map object made by dictionary_fill() are discarded when the function returns. Fix: pass _map by reference to keep the changes
-rw-r--r--src/Dictionary.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Dictionary.cpp b/src/Dictionary.cpp
index 44198cd..5e2e1c0 100644
--- a/src/Dictionary.cpp
+++ b/src/Dictionary.cpp
@@ -28,7 +28,7 @@ Dictionary::Dictionary(Node* parent) : Structure(PLIST_DICT, parent)
{
}
-static void dictionary_fill(Dictionary *_this, std::map<std::string,Node*> map, plist_t node)
+static void dictionary_fill(Dictionary *_this, std::map<std::string,Node*> &map, plist_t node)
{
plist_dict_iter it = NULL;
plist_dict_new_iter(node, &it);