ctelroy / rapidjson

Automatically exported from code.google.com/p/rapidjson
MIT License
0 stars 0 forks source link

GenericDocument::ParseStream doesn't use specified allocator when creating GenericReader #72

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
GenericDocument::ParseStream uses the default allocator instead of what might 
have been specified when the document was constructed.

Possible fix:

--- rapidjson-0.11/include/rapidjson/document.h     2013-02-11 
09:53:43.000000000 -0700
+++ rapidjson/document.h        2013-04-11 15:30:34.000000000 -0600
@@ -708,7 +708,7 @@
        template <unsigned parseFlags, typename Stream>
        GenericDocument& ParseStream(Stream& stream) {
                ValueType::SetNull(); // Remove existing root if exist
-               GenericReader<Encoding, Allocator> reader;
+               GenericReader<Encoding, Allocator> reader(&GetAllocator());
                if (reader.template Parse<parseFlags>(stream, *this)) {
                        RAPIDJSON_ASSERT(stack_.GetSize() == sizeof(ValueType)); // Got one and only one root object
                        this->RawAssign(*stack_.template Pop<ValueType>(1));    // Add this-> to prevent issue 13.

Original issue reported on code.google.com by j...@aliso-pacific.com on 6 May 2013 at 4:05

GoogleCodeExporter commented 8 years ago

Original comment by milo...@gmail.com on 18 Jun 2013 at 1:52

GoogleCodeExporter commented 8 years ago
https://github.com/miloyip/rapidjson/pull/12

Original comment by milo...@gmail.com on 25 Jun 2014 at 4:14