Skip to content

Commit 342a616

Browse files
authored
Merge pull request Tencent#969 from pah/fixes/962-copy-const-strings
Fixup Tencent#964 by forwarding copyConstStrings recursively
2 parents 33443e6 + 68c96e9 commit 342a616

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/rapidjson/document.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -626,8 +626,8 @@ class GenericValue {
626626
Member* lm = reinterpret_cast<Member*>(allocator.Malloc(count * sizeof(Member)));
627627
const typename GenericValue<Encoding,SourceAllocator>::Member* rm = rhs.GetMembersPointer();
628628
for (SizeType i = 0; i < count; i++) {
629-
new (&lm[i].name) GenericValue(rm[i].name, allocator);
630-
new (&lm[i].value) GenericValue(rm[i].value, allocator);
629+
new (&lm[i].name) GenericValue(rm[i].name, allocator, copyConstStrings);
630+
new (&lm[i].value) GenericValue(rm[i].value, allocator, copyConstStrings);
631631
}
632632
data_.f.flags = kObjectFlag;
633633
data_.o.size = data_.o.capacity = count;
@@ -639,7 +639,7 @@ class GenericValue {
639639
GenericValue* le = reinterpret_cast<GenericValue*>(allocator.Malloc(count * sizeof(GenericValue)));
640640
const GenericValue<Encoding,SourceAllocator>* re = rhs.GetElementsPointer();
641641
for (SizeType i = 0; i < count; i++)
642-
new (&le[i]) GenericValue(re[i], allocator);
642+
new (&le[i]) GenericValue(re[i], allocator, copyConstStrings);
643643
data_.f.flags = kArrayFlag;
644644
data_.a.size = data_.a.capacity = count;
645645
SetElementsPointer(le);

0 commit comments

Comments
 (0)