diff options
Diffstat (limited to 'Swiften/Parser/PayloadParsers')
4 files changed, 14 insertions, 4 deletions
diff --git a/Swiften/Parser/PayloadParsers/CommandParser.cpp b/Swiften/Parser/PayloadParsers/CommandParser.cpp index 9422170..3ebab39 100644 --- a/Swiften/Parser/PayloadParsers/CommandParser.cpp +++ b/Swiften/Parser/PayloadParsers/CommandParser.cpp @@ -5,6 +5,9 @@ */ #include "Swiften/Parser/PayloadParsers/CommandParser.h" + +#include <boost/cast.hpp> + #include "Swiften/Parser/PayloadParsers/FormParserFactory.h" #include "Swiften/Parser/PayloadParsers/FormParser.h" @@ -43,7 +46,7 @@ void CommandParser::handleStartElement(const std::string& element, const std::st else if (level_ == FormOrNoteOrActionsLevel) { assert(!formParser_); if (formParserFactory_->canParse(element, ns, attributes)) { - formParser_ = dynamic_cast<FormParser*>(formParserFactory_->createPayloadParser()); + formParser_ = boost::polymorphic_downcast<FormParser*>(formParserFactory_->createPayloadParser()); assert(formParser_); } else if (element == "note") { diff --git a/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp b/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp index 2ec1916..56995d8 100644 --- a/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp +++ b/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp @@ -5,6 +5,9 @@ */ #include "Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.h" + +#include <boost/cast.hpp> + #include "Swiften/Parser/PayloadParsers/FormParserFactory.h" #include "Swiften/Parser/PayloadParsers/FormParser.h" @@ -24,7 +27,7 @@ void InBandRegistrationPayloadParser::handleStartElement(const std::string& elem else if (level == PayloadLevel) { if (element == "x" && ns == "jabber:x:data") { assert(!formParser); - formParser = dynamic_cast<FormParser*>(formParserFactory->createPayloadParser()); + formParser = boost::polymorphic_downcast<FormParser*>(formParserFactory->createPayloadParser()); } else { currentText.clear(); diff --git a/Swiften/Parser/PayloadParsers/SearchPayloadParser.cpp b/Swiften/Parser/PayloadParsers/SearchPayloadParser.cpp index 7c8752c..9daf842 100644 --- a/Swiften/Parser/PayloadParsers/SearchPayloadParser.cpp +++ b/Swiften/Parser/PayloadParsers/SearchPayloadParser.cpp @@ -5,6 +5,9 @@ */ #include "Swiften/Parser/PayloadParsers/SearchPayloadParser.h" + +#include <boost/cast.hpp> + #include "Swiften/Parser/PayloadParsers/FormParserFactory.h" #include "Swiften/Parser/PayloadParsers/FormParser.h" @@ -24,7 +27,7 @@ void SearchPayloadParser::handleStartElement(const std::string& element, const s else if (level == PayloadLevel) { if (element == "x" && ns == "jabber:x:data") { assert(!formParser); - formParser = dynamic_cast<FormParser*>(formParserFactory->createPayloadParser()); + formParser = boost::polymorphic_downcast<FormParser*>(formParserFactory->createPayloadParser()); } else if (element == "item") { assert(!currentItem); diff --git a/Swiften/Parser/PayloadParsers/StreamInitiationParser.cpp b/Swiften/Parser/PayloadParsers/StreamInitiationParser.cpp index 28c5cf5..1cf7fcf 100644 --- a/Swiften/Parser/PayloadParsers/StreamInitiationParser.cpp +++ b/Swiften/Parser/PayloadParsers/StreamInitiationParser.cpp @@ -7,6 +7,7 @@ #include "Swiften/Parser/PayloadParsers/StreamInitiationParser.h" #include <boost/lexical_cast.hpp> +#include <boost/cast.hpp> #include "Swiften/Parser/PayloadParsers/FormParserFactory.h" #include "Swiften/Parser/PayloadParsers/FormParser.h" @@ -54,7 +55,7 @@ void StreamInitiationParser::handleStartElement(const std::string& element, cons } else if (inFeature && formParserFactory->canParse(element, ns, attributes)) { assert(!formParser); - formParser = dynamic_cast<FormParser*>(formParserFactory->createPayloadParser()); + formParser = boost::polymorphic_downcast<FormParser*>(formParserFactory->createPayloadParser()); } } |