summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2014-09-16 13:23:24 (GMT)
committerKevin Smith <git@kismith.co.uk>2014-09-16 13:23:37 (GMT)
commitdc48cc3f34e3e229172202717520e77233c37ed7 (patch)
treedd4b6562a806aa9b11f800e91ed93546fce23f35
parent381b22fc365c27b9cd585f4b78f53ebc698d9f54 (diff)
downloadswift-dc48cc3f34e3e229172202717520e77233c37ed7.zip
swift-dc48cc3f34e3e229172202717520e77233c37ed7.tar.bz2
Fix boost::optional abuses that stop compilation with latest boost
Test-Information: Compiles and unit tests pass with boost 1.56 Change-Id: I6525399babc5f6c88fb499af80e9f07c1c4d0cdb
-rw-r--r--Swift/QtUI/UserSearch/QtUserSearchWindow.cpp2
-rw-r--r--Swiften/Avatars/CombinedAvatarProvider.cpp4
-rw-r--r--Swiften/Examples/NetworkTool/main.cpp4
-rw-r--r--Swiften/QA/ClientTest/ClientTest.cpp2
-rw-r--r--Swiften/Serializer/StreamResumeSerializer.cpp2
-rw-r--r--Swiften/Serializer/StreamResumedSerializer.cpp2
6 files changed, 8 insertions, 8 deletions
diff --git a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
index e309265..17214e4 100644
--- a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
+++ b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
@@ -308,7 +308,7 @@ void QtUserSearchWindow::setSearchFields(boost::shared_ptr<SearchPayload> fields
fieldsPage_->setFormWidget(new QtFormWidget(fields->getForm(), fieldsPage_));
} else {
fieldsPage_->setFormWidget(NULL);
- bool enabled[8] = {fields->getNick(), fields->getNick(), fields->getFirst(), fields->getFirst(), fields->getLast(), fields->getLast(), fields->getEMail(), fields->getEMail()};
+ bool enabled[8] = {!!fields->getNick(), !!fields->getNick(), !!fields->getFirst(), !!fields->getFirst(), !!fields->getLast(), !!fields->getLast(), !!fields->getEMail(), !!fields->getEMail()};
QWidget* legacySearchWidgets[8] = {fieldsPage_->nickInputLabel_, fieldsPage_->nickInput_, fieldsPage_->firstInputLabel_, fieldsPage_->firstInput_, fieldsPage_->lastInputLabel_, fieldsPage_->lastInput_, fieldsPage_->emailInputLabel_, fieldsPage_->emailInput_};
for (int i = 0; i < 8; i++) {
legacySearchWidgets[i]->setVisible(enabled[i]);
diff --git a/Swiften/Avatars/CombinedAvatarProvider.cpp b/Swiften/Avatars/CombinedAvatarProvider.cpp
index 1bd74dd..30f9f52 100644
--- a/Swiften/Avatars/CombinedAvatarProvider.cpp
+++ b/Swiften/Avatars/CombinedAvatarProvider.cpp
@@ -38,7 +38,7 @@ void CombinedAvatarProvider::handleAvatarChanged(const JID& jid) {
}
boost::optional<std::string> newHash = getCombinedAvatarAndCache(jid);
if (newHash != oldHash) {
- SWIFT_LOG(debug) << "Avatar changed: " << jid << ": " << oldHash << " -> " << newHash << std::endl;
+ SWIFT_LOG(debug) << "Avatar changed: " << jid << ": " << oldHash << " -> " << (newHash ? newHash.get() : "NULL") << std::endl;
onAvatarChanged(jid);
}
}
@@ -48,7 +48,7 @@ boost::optional<std::string> CombinedAvatarProvider::getCombinedAvatarAndCache(c
boost::optional<std::string> hash;
for (size_t i = 0; i < providers.size() && !hash; ++i) {
hash = providers[i]->getAvatarHash(jid);
- SWIFT_LOG(debug) << "Provider " << providers[i] << ": " << hash << std::endl;
+ SWIFT_LOG(debug) << "Provider " << providers[i] << ": " << (hash ? hash.get() : "NULL") << std::endl;
}
if (hash) {
avatars[jid] = *hash;
diff --git a/Swiften/Examples/NetworkTool/main.cpp b/Swiften/Examples/NetworkTool/main.cpp
index 10a0aa6..77ba3f6 100644
--- a/Swiften/Examples/NetworkTool/main.cpp
+++ b/Swiften/Examples/NetworkTool/main.cpp
@@ -38,8 +38,8 @@ static void handleGetForwardPortRequestResponse(const boost::optional<NATPortMap
eventLoop.stop();
}
-static void handleRemovePortForwardingRequestResponse(bool result) {
- if (result) {
+static void handleRemovePortForwardingRequestResponse(const boost::optional<bool> result) {
+ if (result && result.get()) {
std::cerr << "Result: OK" << std::endl;
}
else {
diff --git a/Swiften/QA/ClientTest/ClientTest.cpp b/Swiften/QA/ClientTest/ClientTest.cpp
index e88e5ac..38f70db 100644
--- a/Swiften/QA/ClientTest/ClientTest.cpp
+++ b/Swiften/QA/ClientTest/ClientTest.cpp
@@ -31,7 +31,7 @@ static TestStage stage;
static ClientOptions options;
static void handleDisconnected(boost::optional<ClientError> e) {
- std::cout << "Disconnected: " << e << std::endl;
+ std::cout << "Disconnected: " << (e ? e.get().getType() : ClientError::UnknownError) << std::endl;
if (stage == FirstConnect) {
stage = Reconnect;
client->connect(options);
diff --git a/Swiften/Serializer/StreamResumeSerializer.cpp b/Swiften/Serializer/StreamResumeSerializer.cpp
index 902ab21..229b826 100644
--- a/Swiften/Serializer/StreamResumeSerializer.cpp
+++ b/Swiften/Serializer/StreamResumeSerializer.cpp
@@ -22,7 +22,7 @@ SafeByteArray StreamResumeSerializer::serialize(boost::shared_ptr<ToplevelElemen
XMLElement element("resume", "urn:xmpp:sm:2");
element.setAttribute("previd", e->getResumeID());
if (e->getHandledStanzasCount()) {
- element.setAttribute("h", boost::lexical_cast<std::string>(e->getHandledStanzasCount()));
+ element.setAttribute("h", boost::lexical_cast<std::string>(e->getHandledStanzasCount().get()));
}
return createSafeByteArray(element.serialize());
}
diff --git a/Swiften/Serializer/StreamResumedSerializer.cpp b/Swiften/Serializer/StreamResumedSerializer.cpp
index 6477af9..48dbe8f 100644
--- a/Swiften/Serializer/StreamResumedSerializer.cpp
+++ b/Swiften/Serializer/StreamResumedSerializer.cpp
@@ -22,7 +22,7 @@ SafeByteArray StreamResumedSerializer::serialize(boost::shared_ptr<ToplevelEleme
XMLElement element("resumed", "urn:xmpp:sm:2");
element.setAttribute("previd", e->getResumeID());
if (e->getHandledStanzasCount()) {
- element.setAttribute("h", boost::lexical_cast<std::string>(e->getHandledStanzasCount()));
+ element.setAttribute("h", boost::lexical_cast<std::string>(e->getHandledStanzasCount().get()));
}
return createSafeByteArray(element.serialize());
}