summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar liujianfengv2021-06-26 11:43:42 +0800
committerGravatar Nikias Bassen2021-07-13 12:46:38 +0200
commitfeb0bcd102ff0abc34ffa04e8cabf26706ffdb38 (patch)
tree5a25275b1f3ffd9b5a0190257a7f2a2d9ab39d76 /src
parent48f7d8439f2bf7a9df19b8cda19e224efd3a56b1 (diff)
downloadlibplist-feb0bcd102ff0abc34ffa04e8cabf26706ffdb38.tar.gz
libplist-feb0bcd102ff0abc34ffa04e8cabf26706ffdb38.tar.bz2
cpp: Array: Make sure the array passed to array_fill ist passed by reference
When creating a new Array object, for example through PList::Node::FromPlist(plist_t node), the array_fill function is called from Array() constructor in line 51. It seems that the intended way of calling array_fill() is to pass the _array object by reference, however it is actually passed by value. Thus the changes to the array object made by array_fill() are discarded when the function returns. This commit passes the _array by reference so we keep the changes.
Diffstat (limited to 'src')
-rw-r--r--src/Array.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Array.cpp b/src/Array.cpp
index 65ffaa7..23f9922 100644
--- a/src/Array.cpp
+++ b/src/Array.cpp
@@ -32,7 +32,7 @@ Array::Array(Node* parent) : Structure(PLIST_ARRAY, parent)
_array.clear();
}
-static void array_fill(Array *_this, std::vector<Node*> array, plist_t node)
+static void array_fill(Array *_this, std::vector<Node*> &array, plist_t node)
{
plist_array_iter iter = NULL;
plist_array_new_iter(node, &iter);