diff options
author | Edwin Mons <edwin.mons@isode.com> | 2019-05-13 12:34:28 (GMT) |
---|---|---|
committer | Edwin Mons <edwin.mons@isode.com> | 2019-05-13 12:56:27 (GMT) |
commit | 09d8ac653493a0bd16cb69664ca28fbfe3c61bbb (patch) | |
tree | ba3c073d809949187622d1b26abf958f7299b2e3 /Swiften/Parser/LibXMLParser.cpp | |
parent | 16f15b8d80f648b61e991b04800c23368dcd38a5 (diff) | |
download | swift-09d8ac653493a0bd16cb69664ca28fbfe3c61bbb.zip swift-09d8ac653493a0bd16cb69664ca28fbfe3c61bbb.tar.bz2 |
Add flag to signal final XML data
XML parse now takes an optional boolean that will signal that with the
data that is fed into the parser, the document should now be complete.
This will allow the parser to reject partial documents.
Test-Information:
Updated unit tests pass.
Checked that default behaviour wasn't changed.
Tested with various partial and complete documents.
Change-Id: Ide7c2e47c49d5667f1febcb23da366e96d0dbc21
Diffstat (limited to 'Swiften/Parser/LibXMLParser.cpp')
-rw-r--r-- | Swiften/Parser/LibXMLParser.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Swiften/Parser/LibXMLParser.cpp b/Swiften/Parser/LibXMLParser.cpp index 5bd3737..c9f3a07 100644 --- a/Swiften/Parser/LibXMLParser.cpp +++ b/Swiften/Parser/LibXMLParser.cpp @@ -1,3 +1,3 @@ /* - * Copyright (c) 2010-2018 Isode Limited. + * Copyright (c) 2010-2019 Isode Limited. * All rights reserved. @@ -96,3 +96,3 @@ LibXMLParser::~LibXMLParser() { -bool LibXMLParser::parse(const std::string& data) { +bool LibXMLParser::parse(const std::string& data, bool finalData) { if (data.size() > std::numeric_limits<int>::max()) { @@ -100,3 +100,3 @@ bool LibXMLParser::parse(const std::string& data) { } - if (xmlParseChunk(p->context_, data.c_str(), static_cast<int>(data.size()), false) == XML_ERR_OK) { + if (xmlParseChunk(p->context_, data.c_str(), static_cast<int>(data.size()), finalData) == XML_ERR_OK) { return true; |