summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Parser/PayloadParsers/BytestreamsParser.cpp')
-rw-r--r--Swiften/Parser/PayloadParsers/BytestreamsParser.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/Swiften/Parser/PayloadParsers/BytestreamsParser.cpp b/Swiften/Parser/PayloadParsers/BytestreamsParser.cpp
index 405c593..71bce54 100644
--- a/Swiften/Parser/PayloadParsers/BytestreamsParser.cpp
+++ b/Swiften/Parser/PayloadParsers/BytestreamsParser.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2016 Isode Limited. 2 * Copyright (c) 2010-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 */
@@ -7,6 +7,7 @@
7#include <Swiften/Parser/PayloadParsers/BytestreamsParser.h> 7#include <Swiften/Parser/PayloadParsers/BytestreamsParser.h>
8 8
9#include <boost/lexical_cast.hpp> 9#include <boost/lexical_cast.hpp>
10#include <boost/numeric/conversion/cast.hpp>
10 11
11namespace Swift { 12namespace Swift {
12 13
@@ -23,7 +24,9 @@ void BytestreamsParser::handleStartElement(const std::string& element, const std
23 else if (level == PayloadLevel) { 24 else if (level == PayloadLevel) {
24 if (element == "streamhost") { 25 if (element == "streamhost") {
25 try { 26 try {
26 getPayloadInternal()->addStreamHost(Bytestreams::StreamHost(attributes.getAttribute("host"), JID(attributes.getAttribute("jid")), boost::lexical_cast<int>(attributes.getAttribute("port")))); 27 getPayloadInternal()->addStreamHost(Bytestreams::StreamHost(attributes.getAttribute("host"), JID(attributes.getAttribute("jid")), boost::numeric_cast<unsigned short>(boost::lexical_cast<int>(attributes.getAttribute("port")))));
28 }
29 catch (boost::numeric::bad_numeric_cast&) {
27 } 30 }
28 catch (boost::bad_lexical_cast&) { 31 catch (boost::bad_lexical_cast&) {
29 } 32 }