From ec957fb8253ffbced690fb5bcb1743f015ab0815 Mon Sep 17 00:00:00 2001 From: tihmstar Date: Wed, 26 Jun 2019 18:27:20 +0200 Subject: 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--- src/Dictionary.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 map, plist_t node) +static void dictionary_fill(Dictionary *_this, std::map &map, plist_t node) { plist_dict_iter it = NULL; plist_dict_new_iter(node, &it); -- cgit v1.1-32-gdbae