From 83fb5ae3da2e5e690a3eafae99f6cd0cb59a2496 Mon Sep 17 00:00:00 2001 From: Kevin Smith Date: Tue, 20 Jun 2017 21:15:25 +0100 Subject: Fix compiler warnings Both catching polymorphic base classes by value and explicitly moving things preventing return value optimization. Test-Information: Compiles on macOS with latest xcode with allow_warnings=False and unit tests pass Change-Id: Ibdc67f4f2019f85f14635df2a3ff06bddbb8e2b6 diff --git a/Sluift/ElementConvertors/DOMElementConvertor.cpp b/Sluift/ElementConvertors/DOMElementConvertor.cpp index 72474bb..b957686 100644 --- a/Sluift/ElementConvertors/DOMElementConvertor.cpp +++ b/Sluift/ElementConvertors/DOMElementConvertor.cpp @@ -185,7 +185,7 @@ boost::optional DOMElementConvertor::convertToLua( // Parse the payload again ParserClient parserClient(L); - std::shared_ptr parser(std::move(parsers.createXMLParser(&parserClient))); + std::shared_ptr parser(parsers.createXMLParser(&parserClient)); bool result = parser->parse(serializedPayload); assert(result); diff --git a/Swift/Controllers/Chat/ChatMessageParser.cpp b/Swift/Controllers/Chat/ChatMessageParser.cpp index 1a822a1..31be451 100644 --- a/Swift/Controllers/Chat/ChatMessageParser.cpp +++ b/Swift/Controllers/Chat/ChatMessageParser.cpp @@ -132,7 +132,7 @@ namespace Swift { } } - catch (std::runtime_error) { + catch (const std::runtime_error&) { /* Basically too expensive to compute the regex results and it gave up, so pass through as text */ newMessage.append(part); } @@ -185,7 +185,7 @@ namespace Swift { resultMessage.append(std::make_shared(std::string(start, text.end()))); } } - catch (std::runtime_error) { + catch (const std::runtime_error&) { /* Basically too expensive to compute the regex results and it gave up, so pass through as text */ resultMessage.append(part); } diff --git a/Swiften/Parser/BOSHBodyExtractor.cpp b/Swiften/Parser/BOSHBodyExtractor.cpp index 803f16a..c45d338 100644 --- a/Swiften/Parser/BOSHBodyExtractor.cpp +++ b/Swiften/Parser/BOSHBodyExtractor.cpp @@ -126,7 +126,7 @@ BOSHBodyExtractor::BOSHBodyExtractor(XMLParserFactory* parserFactory, const Byte // Parse the body element BOSHBodyParserClient parserClient(this); - std::shared_ptr parser(std::move(parserFactory->createXMLParser(&parserClient))); + std::shared_ptr parser(parserFactory->createXMLParser(&parserClient)); if (!parser->parse(std::string( reinterpret_cast(vecptr(data)), boost::numeric_cast(std::distance(data.begin(), i))))) { -- cgit v0.10.2-6-g49f6