diff options
author | liujianfengv | 2021-06-26 11:43:42 +0800 |
---|---|---|
committer | Nikias Bassen | 2021-07-13 12:46:38 +0200 |
commit | feb0bcd102ff0abc34ffa04e8cabf26706ffdb38 (patch) | |
tree | 5a25275b1f3ffd9b5a0190257a7f2a2d9ab39d76 /src/Array.cpp | |
parent | 48f7d8439f2bf7a9df19b8cda19e224efd3a56b1 (diff) | |
download | libplist-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/Array.cpp')
-rw-r--r-- | src/Array.cpp | 2 |
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); |