diff options
author | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-08-29 19:29:35 +0000 |
---|---|---|
committer | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-08-29 19:29:35 +0000 |
commit | 9266af0664f41b50b7ec189f5b2d387a70429098 (patch) | |
tree | c53b7526df7be709b841aea2130213a5630acef7 | |
parent | 529762d46b03e5d62e30f5a903402df1488b9b00 (diff) |
Fixed longjmp clobber warning in xml_parser::parse
git-svn-id: http://pugixml.googlecode.com/svn/trunk@706 99668b35-9821-0410-8761-19e4c4f06640
-rw-r--r-- | src/pugixml.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 8ac5627..5158a02 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -2293,18 +2293,18 @@ namespace if (cursor != xmldoc) THROW_ERROR(status_end_element_mismatch, s); } - static xml_parse_result parse(char_t* buffer, size_t length, xml_node_struct* xmldoc, unsigned int optmsk) + static xml_parse_result parse(char_t* buffer, size_t length, xml_node_struct* root, unsigned int optmsk) { + xml_document_struct* xmldoc = static_cast<xml_document_struct*>(root); + // store buffer for offset_debug - static_cast<xml_document_struct*>(xmldoc)->buffer = buffer; + xmldoc->buffer = buffer; // early-out for empty documents if (length == 0) return make_parse_result(status_ok); // create parser on stack - xml_allocator& alloc = *static_cast<xml_document_struct*>(xmldoc); - - xml_parser parser(alloc); + xml_parser parser(*xmldoc); // save last character and make buffer zero-terminated (speeds up parsing) char_t endch = buffer[length - 1]; @@ -2321,7 +2321,7 @@ namespace xml_parse_result result = make_parse_result(static_cast<xml_parse_status>(error), parser.error_offset ? parser.error_offset - buffer : 0); // update allocator state - alloc = parser.alloc; + *static_cast<xml_allocator*>(xmldoc) = parser.alloc; // since we removed last character, we have to handle the only possible false positive if (result && endch == '<') |