diff options
author | Kevin Smith <git@kismith.co.uk> | 2014-08-21 08:38:11 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2014-08-21 08:40:10 (GMT) |
commit | 381b22fc365c27b9cd585f4b78f53ebc698d9f54 (patch) | |
tree | 0ffd89a8be13293c75c7ddfea524c74e0bf87b72 | |
parent | 8ec22a9c5591584fd1725ed028d714c51b7509d3 (diff) | |
download | swift-contrib-381b22fc365c27b9cd585f4b78f53ebc698d9f54.zip swift-contrib-381b22fc365c27b9cd585f4b78f53ebc698d9f54.tar.bz2 |
Clean up compilation errors in Swiften due to boost 1.56
Can no longer implicitly convert boost::optional to bool temporaries. Also fixed assorted uses of cerr where logging was appropriate.
Test-Information:
Swiften compiles against boost 1.56 (link fails for me so far)
Change-Id: Iec058af933a82a987da64291435a475f8b40ef96
-rw-r--r-- | Swiften/Client/ClientSession.cpp | 5 | ||||
-rw-r--r-- | Swiften/FileTransfer/IBBReceiveSession.cpp | 16 | ||||
-rw-r--r-- | Swiften/FileTransfer/IncomingFileTransferManager.cpp | 5 | ||||
-rw-r--r-- | Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp | 2 | ||||
-rw-r--r-- | Swiften/Jingle/JingleResponder.cpp | 4 | ||||
-rw-r--r-- | Swiften/Network/BOSHConnection.cpp | 2 | ||||
-rw-r--r-- | Swiften/Network/FakeConnection.cpp | 4 | ||||
-rw-r--r-- | Swiften/Network/NATPMPInterface.cpp | 8 | ||||
-rw-r--r-- | Swiften/Parser/PayloadParsers/JingleS5BTransportMethodPayloadParser.cpp | 10 | ||||
-rw-r--r-- | Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.cpp | 9 |
10 files changed, 42 insertions, 23 deletions
diff --git a/Swiften/Client/ClientSession.cpp b/Swiften/Client/ClientSession.cpp index 441189e..500299a 100644 --- a/Swiften/Client/ClientSession.cpp +++ b/Swiften/Client/ClientSession.cpp @@ -38,19 +38,18 @@ #include <Swiften/Elements/ResourceBind.h> #include <Swiften/SASL/PLAINClientAuthenticator.h> #include <Swiften/SASL/EXTERNALClientAuthenticator.h> #include <Swiften/SASL/SCRAMSHA1ClientAuthenticator.h> #include <Swiften/SASL/DIGESTMD5ClientAuthenticator.h> #include <Swiften/Crypto/CryptoProvider.h> #include <Swiften/Session/SessionStream.h> #include <Swiften/TLS/CertificateTrustChecker.h> #include <Swiften/TLS/ServerIdentityVerifier.h> -#include <Swiften/Base/Log.h> #ifdef SWIFTEN_PLATFORM_WIN32 #include <Swiften/Base/WindowsRegistry.h> #endif #define CHECK_STATE_OR_RETURN(a) \ if (!checkState(a)) { return; } namespace Swift { @@ -165,23 +164,23 @@ void ClientSession::handleElement(boost::shared_ptr<ToplevelElement> element) { stanzaAckResponder_->handleAckRequestReceived(); } } else if (boost::shared_ptr<StanzaAck> ack = boost::dynamic_pointer_cast<StanzaAck>(element)) { if (stanzaAckRequester_) { if (ack->isValid()) { stanzaAckRequester_->handleAckReceived(ack->getHandledStanzasCount()); } else { - std::cerr << "Warning: Got invalid ack from server" << std::endl; + SWIFT_LOG(warning) << "Got invalid ack from server"; } } else { - std::cerr << "Warning: Ignoring ack" << std::endl; + SWIFT_LOG(warning) << "Ignoring ack"; } } else if (StreamError::ref streamError = boost::dynamic_pointer_cast<StreamError>(element)) { finishSession(Error::StreamError); } else if (getState() == Initialized) { boost::shared_ptr<Stanza> stanza = boost::dynamic_pointer_cast<Stanza>(element); if (stanza) { if (stanzaAckResponder_) { diff --git a/Swiften/FileTransfer/IBBReceiveSession.cpp b/Swiften/FileTransfer/IBBReceiveSession.cpp index 3aa6fdc..8cfd95d 100644 --- a/Swiften/FileTransfer/IBBReceiveSession.cpp +++ b/Swiften/FileTransfer/IBBReceiveSession.cpp @@ -27,41 +27,41 @@ class IBBReceiveSession::IBBResponder : public SetResponder<IBB> { if (from == session->from && ibb->getStreamID() == session->id) { if (ibb->getAction() == IBB::Data) { if (sequenceNumber == ibb->getSequenceNumber()) { session->bytestream->write(ibb->getData()); receivedSize += ibb->getData().size(); sequenceNumber++; sendResponse(from, id, IBB::ref()); if (receivedSize >= session->size) { if (receivedSize > session->size) { - std::cerr << "Warning: Received more data than expected" << std::endl; + SWIFT_LOG(warning) << "Received more data than expected"; } session->finish(boost::optional<FileTransferError>()); } } else { - SWIFT_LOG(warning) << "Received data out of order" << std::endl; + SWIFT_LOG(warning) << "Received data out of order"; sendError(from, id, ErrorPayload::NotAcceptable, ErrorPayload::Cancel); session->finish(FileTransferError(FileTransferError::ClosedError)); } } else if (ibb->getAction() == IBB::Open) { - SWIFT_LOG(debug) << "IBB open received" << std::endl; + SWIFT_LOG(debug) << "IBB open received"; sendResponse(from, id, IBB::ref()); } else if (ibb->getAction() == IBB::Close) { - SWIFT_LOG(debug) << "IBB close received" << std::endl; + SWIFT_LOG(debug) << "IBB close received"; sendResponse(from, id, IBB::ref()); session->finish(FileTransferError(FileTransferError::ClosedError)); } return true; } - SWIFT_LOG(debug) << "wrong from/sessionID: " << from << " == " << session->from << " / " <<ibb->getStreamID() << " == " << session->id << std::endl; + SWIFT_LOG(debug) << "wrong from/sessionID: " << from << " == " << session->from << " / " <<ibb->getStreamID() << " == " << session->id; return false; } private: IBBReceiveSession* session; int sequenceNumber; unsigned long long receivedSize; }; @@ -81,31 +81,31 @@ IBBReceiveSession::IBBReceiveSession( router(router), active(false) { assert(!id.empty()); assert(from.isValid()); responder = new IBBResponder(this, router); } IBBReceiveSession::~IBBReceiveSession() { if (active) { - SWIFT_LOG(warning) << "Session still active" << std::endl; + SWIFT_LOG(warning) << "Session still active"; } delete responder; } void IBBReceiveSession::start() { - SWIFT_LOG(debug) << "receive session started" << std::endl; + SWIFT_LOG(debug) << "receive session started"; active = true; responder->start(); } void IBBReceiveSession::stop() { - SWIFT_LOG(debug) << "receive session stopped" << std::endl; + SWIFT_LOG(debug) << "receive session stopped"; responder->stop(); if (active) { if (router->isAvailable()) { IBBRequest::create(to, from, IBB::createIBBClose(id), router)->send(); } finish(boost::optional<FileTransferError>()); } } diff --git a/Swiften/FileTransfer/IncomingFileTransferManager.cpp b/Swiften/FileTransfer/IncomingFileTransferManager.cpp index d40c5de..d8c4f89 100644 --- a/Swiften/FileTransfer/IncomingFileTransferManager.cpp +++ b/Swiften/FileTransfer/IncomingFileTransferManager.cpp @@ -1,19 +1,20 @@ /* - * Copyright (c) 2010-2013 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ #include <Swiften/FileTransfer/IncomingFileTransferManager.h> #include <boost/smart_ptr/make_shared.hpp> +#include <Swiften/Base/Log.h> #include <Swiften/Elements/JingleDescription.h> #include <Swiften/Elements/JingleFileTransferDescription.h> #include <Swiften/Elements/JingleIBBTransportPayload.h> #include <Swiften/Elements/JingleS5BTransportPayload.h> #include <Swiften/Jingle/JingleSessionManager.h> #include <Swiften/Jingle/Jingle.h> #include <Swiften/FileTransfer/IncomingJingleFileTransfer.h> namespace Swift { @@ -43,19 +44,19 @@ bool IncomingFileTransferManager::handleIncomingJingleSession( if (JingleContentPayload::ref content = Jingle::getContentWithDescription<JingleFileTransferDescription>(contents)) { if (content->getTransport<JingleS5BTransportPayload>()) { JingleFileTransferDescription::ref description = content->getDescription<JingleFileTransferDescription>(); if (description && description->getOffers().size() == 1) { IncomingJingleFileTransfer::ref transfer = boost::make_shared<IncomingJingleFileTransfer>( recipient, session, content, transporterFactory, timerFactory, crypto); onIncomingFileTransfer(transfer); } else { - std::cerr << "Received a file-transfer request with no description or more than one file!" << std::endl; + SWIFT_LOG(warning) << "Received a file-transfer request with no description or more than one file."; session->sendTerminate(JinglePayload::Reason::FailedApplication); } } else { session->sendTerminate(JinglePayload::Reason::UnsupportedTransports); } return true; } else { diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp index f393c8d..cb34c58 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp +++ b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp @@ -88,19 +88,19 @@ void SOCKS5BytestreamServerSession::handleDataRead(boost::shared_ptr<SafeByteArr void SOCKS5BytestreamServerSession::handleDataAvailable() { if (waitingForData) { sendData(); } } void SOCKS5BytestreamServerSession::handleDisconnected(const boost::optional<Connection::Error>& error) { SWIFT_LOG(debug) << (error ? (error == Connection::ReadError ? "Read Error" : "Write Error") : "No Error") << std::endl; - finish(error); + finish(error ? true : false); } void SOCKS5BytestreamServerSession::process() { if (state == WaitingForAuthentication) { if (unprocessedData.size() >= 2) { size_t authCount = unprocessedData[1]; size_t i = 2; while (i < 2 + authCount && i < unprocessedData.size()) { // Skip authentication mechanism diff --git a/Swiften/Jingle/JingleResponder.cpp b/Swiften/Jingle/JingleResponder.cpp index 4c82f51..e963ef6 100644 --- a/Swiften/Jingle/JingleResponder.cpp +++ b/Swiften/Jingle/JingleResponder.cpp @@ -1,11 +1,11 @@ /* - * Copyright (c) 2011 Remko Tronçon + * Copyright (c) 2011-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ #include <Swiften/Jingle/JingleResponder.h> #include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Jingle/JingleSessionManager.h> @@ -45,18 +45,18 @@ bool JingleResponder::handleSetRequest(const JID& from, const JID& to, const std } else { SWIFT_LOG(debug) << "Lookup session by from attribute." << std::endl; session = sessionManager->getSession(from, payload->getSessionID()); } if (session) { session->handleIncomingAction(payload); sendResponse(from, id, boost::shared_ptr<JinglePayload>()); } else { - std::cerr << "WARN: Didn't find jingle session!" << std::endl; + SWIFT_LOG(warning) << "Didn't find jingle session!"; // TODO: Add jingle-specific error sendError(from, id, ErrorPayload::ItemNotFound, ErrorPayload::Cancel); } } return true; } } diff --git a/Swiften/Network/BOSHConnection.cpp b/Swiften/Network/BOSHConnection.cpp index bde689e..28e27d5 100644 --- a/Swiften/Network/BOSHConnection.cpp +++ b/Swiften/Network/BOSHConnection.cpp @@ -279,19 +279,19 @@ void BOSHConnection::setRID(unsigned long long rid) { rid_ = rid; } void BOSHConnection::setSID(const std::string& sid) { sid_ = sid; } void BOSHConnection::handleDisconnected(const boost::optional<Connection::Error>& error) { cancelConnector(); - onDisconnected(error); + onDisconnected(error ? true : false); sid_ = ""; connectionReady_ = false; } bool BOSHConnection::isReadyToSend() { /* Without pipelining you need to not send more without first receiving the response */ /* With pipelining you can. Assuming we can't, here */ return connectionReady_ && !pending_ && !waitingForStartResponse_ && !sid_.empty(); diff --git a/Swiften/Network/FakeConnection.cpp b/Swiften/Network/FakeConnection.cpp index be5555c..a84c92e 100644 --- a/Swiften/Network/FakeConnection.cpp +++ b/Swiften/Network/FakeConnection.cpp @@ -1,11 +1,11 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ #include <Swiften/Network/FakeConnection.h> #include <boost/bind.hpp> namespace Swift { @@ -37,19 +37,19 @@ void FakeConnection::connect(const HostAddressPort& address) { else { if (!error) { connectedTo = address; state = Connected; } else { state = DisconnectedWithError; } eventLoop->postEvent( - boost::bind(boost::ref(onConnectFinished), error), + boost::bind(boost::ref(onConnectFinished), error ? true : false), shared_from_this()); } } void FakeConnection::disconnect() { if (!error) { state = Disconnected; } else { diff --git a/Swiften/Network/NATPMPInterface.cpp b/Swiften/Network/NATPMPInterface.cpp index c7a41ff..dcae641 100644 --- a/Swiften/Network/NATPMPInterface.cpp +++ b/Swiften/Network/NATPMPInterface.cpp @@ -1,15 +1,21 @@ /* * Copyright (c) 2011 Tobias Markmann * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* +* Copyright (c) 2014 Kevin Smith +* Licensed under the GNU General Public License v3. +* See Documentation/Licenses/GPLv3.txt for more information. +*/ + #include <Swiften/Network/NATPMPInterface.h> #include <boost/smart_ptr/make_shared.hpp> #include <boost/numeric/conversion/cast.hpp> #include <Swiften/Base/Log.h> // This has to be included after the previous headers, because of WIN32 macro // being defined somewhere. @@ -26,19 +32,19 @@ struct NATPMPInterface::Private { NATPMPInterface::NATPMPInterface() : p(boost::make_shared<Private>()) { initnatpmp(&p->natpmp, 0, 0); } NATPMPInterface::~NATPMPInterface() { closenatpmp(&p->natpmp); } bool NATPMPInterface::isAvailable() { - return getPublicIP(); + return getPublicIP() ? true : false; } boost::optional<HostAddress> NATPMPInterface::getPublicIP() { if (sendpublicaddressrequest(&p->natpmp) < 0) { SWIFT_LOG(debug) << "Failed to send NAT-PMP public address request!" << std::endl; return boost::optional<HostAddress>(); } int r = 0; diff --git a/Swiften/Parser/PayloadParsers/JingleS5BTransportMethodPayloadParser.cpp b/Swiften/Parser/PayloadParsers/JingleS5BTransportMethodPayloadParser.cpp index 14a80e6..7be4c26 100644 --- a/Swiften/Parser/PayloadParsers/JingleS5BTransportMethodPayloadParser.cpp +++ b/Swiften/Parser/PayloadParsers/JingleS5BTransportMethodPayloadParser.cpp @@ -1,15 +1,21 @@ /* * Copyright (c) 2011 Tobias Markmann * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* +* Copyright (c) 2014 Kevin Smith +* Licensed under the GNU General Public License v3. +* See Documentation/Licenses/GPLv3.txt for more information. +*/ + #include <boost/lexical_cast.hpp> #include <boost/optional.hpp> #include "JingleS5BTransportMethodPayloadParser.h" #include <Swiften/Base/Log.h> namespace Swift { JingleS5BTransportMethodPayloadParser::JingleS5BTransportMethodPayloadParser() : level(0) { @@ -19,19 +25,19 @@ namespace Swift { void JingleS5BTransportMethodPayloadParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) { if (level == 0) { getPayloadInternal()->setSessionID(attributes.getAttributeValue("sid").get_value_or("")); std::string mode = attributes.getAttributeValue("mode").get_value_or("tcp"); if (mode == "tcp") { getPayloadInternal()->setMode(JingleS5BTransportPayload::TCPMode); } else if(mode == "udp") { getPayloadInternal()->setMode(JingleS5BTransportPayload::UDPMode); } else { - std::cerr << "Unknown S5B mode; falling back to defaul!" << std::endl; + SWIFT_LOG(warning) << "Unknown S5B mode; falling back to defaul!"; getPayloadInternal()->setMode(JingleS5BTransportPayload::TCPMode); } } else if (level == 1) { if (element == "candidate") { JingleS5BTransportPayload::Candidate candidate; candidate.cid = attributes.getAttributeValue("cid").get_value_or(""); int port = -1; try { @@ -75,14 +81,14 @@ namespace Swift { if (str == "direct") { return JingleS5BTransportPayload::Candidate::DirectType; } else if (str == "assisted") { return JingleS5BTransportPayload::Candidate::AssistedType; } else if (str == "tunnel") { return JingleS5BTransportPayload::Candidate::TunnelType; } else if (str == "proxy") { return JingleS5BTransportPayload::Candidate::ProxyType; } else { - std::cerr << "Unknown candidate type; falling back to default!" << std::endl; + SWIFT_LOG(warning) << "Unknown candidate type; falling back to default!"; return JingleS5BTransportPayload::Candidate::DirectType; } } } diff --git a/Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.cpp index 0e21812..6ba264a 100644 --- a/Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.cpp @@ -1,21 +1,28 @@ /* * Copyright (c) 2011 Tobias Markmann * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* +* Copyright (c) 2014 Kevin Smith +* Licensed under the GNU General Public License v3. +* See Documentation/Licenses/GPLv3.txt for more information. +*/ + #include <Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.h> #include <boost/shared_ptr.hpp> #include <boost/smart_ptr/make_shared.hpp> #include <boost/smart_ptr/intrusive_ptr.hpp> +#include <Swiften/Base/Log.h> #include <Swiften/Base/foreach.h> #include <Swiften/Serializer/XML/XMLNode.h> #include <Swiften/Serializer/XML/XMLElement.h> #include <Swiften/Serializer/XML/XMLRawTextNode.h> #include <Swiften/Serializer/PayloadSerializers/JingleFileTransferDescriptionSerializer.h> #include <Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.h> #include <Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.h> @@ -63,16 +70,16 @@ std::string JingleContentPayloadSerializer::serializePayload(boost::shared_ptr<J } std::string JingleContentPayloadSerializer::creatorToString(JingleContentPayload::Creator creator) const { switch(creator) { case JingleContentPayload::InitiatorCreator: return "initiator"; case JingleContentPayload::ResponderCreator: return "responder"; case JingleContentPayload::UnknownCreator: - std::cerr << "Serializing unknown creator value." << std::endl; + SWIFT_LOG(error) << "Serializing unknown creator value."; return "ERROR ERROR ERROR"; } assert(false); return ""; } } |