summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Parser/BOSHBodyExtractor.cpp')
-rw-r--r--Swiften/Parser/BOSHBodyExtractor.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Swiften/Parser/BOSHBodyExtractor.cpp b/Swiften/Parser/BOSHBodyExtractor.cpp
index c45d338..ff56792 100644
--- a/Swiften/Parser/BOSHBodyExtractor.cpp
+++ b/Swiften/Parser/BOSHBodyExtractor.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2011-2016 Isode Limited. 2 * Copyright (c) 2011-2018 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -8,8 +8,6 @@
8 8
9#include <memory> 9#include <memory>
10 10
11#include <boost/numeric/conversion/cast.hpp>
12
13#include <Swiften/Parser/XMLParser.h> 11#include <Swiften/Parser/XMLParser.h>
14#include <Swiften/Parser/XMLParserClient.h> 12#include <Swiften/Parser/XMLParserClient.h>
15#include <Swiften/Parser/XMLParserFactory.h> 13#include <Swiften/Parser/XMLParserFactory.h>
@@ -119,17 +117,19 @@ BOSHBodyExtractor::BOSHBodyExtractor(XMLParserFactory* parserFactory, const Byte
119 117
120 body = BOSHBody(); 118 body = BOSHBody();
121 if (!endElementSeen) { 119 if (!endElementSeen) {
120 assert(i <= j.base());
122 body->content = std::string( 121 body->content = std::string(
123 reinterpret_cast<const char*>(vecptr(data) + std::distance(data.begin(), i)), 122 reinterpret_cast<const char*>(vecptr(data) + std::distance(data.begin(), i)),
124 boost::numeric_cast<size_t>(std::distance(i, j.base()))); 123 static_cast<size_t>(std::distance(i, j.base())));
125 } 124 }
126 125
127 // Parse the body element 126 // Parse the body element
128 BOSHBodyParserClient parserClient(this); 127 BOSHBodyParserClient parserClient(this);
129 std::shared_ptr<XMLParser> parser(parserFactory->createXMLParser(&parserClient)); 128 std::shared_ptr<XMLParser> parser(parserFactory->createXMLParser(&parserClient));
129 assert(data.begin() <= i);
130 if (!parser->parse(std::string( 130 if (!parser->parse(std::string(
131 reinterpret_cast<const char*>(vecptr(data)), 131 reinterpret_cast<const char*>(vecptr(data)),
132 boost::numeric_cast<size_t>(std::distance(data.begin(), i))))) { 132 static_cast<size_t>(std::distance(data.begin(), i))))) {
133 /* TODO: This needs to be only validating the BOSH <body> element, so that XMPP parsing errors are caught at 133 /* TODO: This needs to be only validating the BOSH <body> element, so that XMPP parsing errors are caught at
134 the correct higher layer */ 134 the correct higher layer */
135 body = boost::optional<BOSHBody>(); 135 body = boost::optional<BOSHBody>();