summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Network')
-rw-r--r--Swiften/Network/BOSHConnection.cpp2
-rw-r--r--Swiften/Network/BOSHConnectionPool.cpp8
-rw-r--r--Swiften/Network/BoostConnection.cpp3
-rw-r--r--Swiften/Network/BoostConnectionServer.cpp5
-rw-r--r--Swiften/Network/DomainNameServiceQuery.cpp2
-rw-r--r--Swiften/Network/MacOSXProxyProvider.cpp2
-rw-r--r--Swiften/Network/NATPMPInterface.cpp3
7 files changed, 15 insertions, 10 deletions
diff --git a/Swiften/Network/BOSHConnection.cpp b/Swiften/Network/BOSHConnection.cpp
index 377373d..be4360e 100644
--- a/Swiften/Network/BOSHConnection.cpp
+++ b/Swiften/Network/BOSHConnection.cpp
@@ -208,7 +208,7 @@ void BOSHConnection::handleDataRead(boost::shared_ptr<SafeByteArray> data) {
waitingForStartResponse_ = false;
sid_ = parser.getBody()->attributes.getAttribute("sid");
std::string requestsString = parser.getBody()->attributes.getAttribute("requests");
- int requests = 2;
+ size_t requests = 2;
if (!requestsString.empty()) {
try {
requests = boost::lexical_cast<size_t>(requestsString);
diff --git a/Swiften/Network/BOSHConnectionPool.cpp b/Swiften/Network/BOSHConnectionPool.cpp
index e535deb..4517ffb 100644
--- a/Swiften/Network/BOSHConnectionPool.cpp
+++ b/Swiften/Network/BOSHConnectionPool.cpp
@@ -210,14 +210,14 @@ void BOSHConnectionPool::handleHTTPError(const std::string& /*errorCode*/) {
handleSessionTerminated(boost::make_shared<BOSHError>(BOSHError::UndefinedCondition));
}
-void BOSHConnectionPool::handleConnectionDisconnected(bool error, BOSHConnection::ref connection) {
+void BOSHConnectionPool::handleConnectionDisconnected(bool/* error*/, BOSHConnection::ref connection) {
destroyConnection(connection);
if (pendingTerminate && sid.empty() && connections.empty()) {
handleSessionTerminated(BOSHError::ref());
}
- else if (false && error) {
- handleSessionTerminated(boost::make_shared<BOSHError>(BOSHError::UndefinedCondition));
- }
+ //else if (error) {
+ // handleSessionTerminated(boost::make_shared<BOSHError>(BOSHError::UndefinedCondition));
+ //}
else {
/* We might have just freed up a connection slot to send with */
tryToSendQueuedData();
diff --git a/Swiften/Network/BoostConnection.cpp b/Swiften/Network/BoostConnection.cpp
index 1d4bd32..5137c3c 100644
--- a/Swiften/Network/BoostConnection.cpp
+++ b/Swiften/Network/BoostConnection.cpp
@@ -14,6 +14,7 @@
#include <boost/asio/placeholders.hpp>
#include <boost/asio/write.hpp>
#include <boost/smart_ptr/make_shared.hpp>
+#include <boost/numeric/conversion/cast.hpp>
#include <Swiften/Base/Log.h>
#include <Swiften/Base/Algorithm.h>
@@ -63,7 +64,7 @@ void BoostConnection::listen() {
void BoostConnection::connect(const HostAddressPort& addressPort) {
boost::asio::ip::tcp::endpoint endpoint(
- boost::asio::ip::address::from_string(addressPort.getAddress().toString()), addressPort.getPort());
+ boost::asio::ip::address::from_string(addressPort.getAddress().toString()), boost::numeric_cast<unsigned short>(addressPort.getPort()));
socket_.async_connect(
endpoint,
boost::bind(&BoostConnection::handleConnectFinished, shared_from_this(), boost::asio::placeholders::error));
diff --git a/Swiften/Network/BoostConnectionServer.cpp b/Swiften/Network/BoostConnectionServer.cpp
index eccffc6..e015eaa 100644
--- a/Swiften/Network/BoostConnectionServer.cpp
+++ b/Swiften/Network/BoostConnectionServer.cpp
@@ -9,6 +9,7 @@
#include <boost/bind.hpp>
#include <boost/system/system_error.hpp>
#include <boost/asio/placeholders.hpp>
+#include <boost/numeric/conversion/cast.hpp>
#include <Swiften/EventLoop/EventLoop.h>
@@ -26,12 +27,12 @@ void BoostConnectionServer::start() {
if (address_.isValid()) {
acceptor_ = new boost::asio::ip::tcp::acceptor(
*ioService_,
- boost::asio::ip::tcp::endpoint(address_.getRawAddress(), port_));
+ boost::asio::ip::tcp::endpoint(address_.getRawAddress(), boost::numeric_cast<unsigned short>(port_)));
}
else {
acceptor_ = new boost::asio::ip::tcp::acceptor(
*ioService_,
- boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port_));
+ boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), boost::numeric_cast<unsigned short>(port_)));
}
acceptNextConnection();
}
diff --git a/Swiften/Network/DomainNameServiceQuery.cpp b/Swiften/Network/DomainNameServiceQuery.cpp
index 5b761c2..cc75440 100644
--- a/Swiften/Network/DomainNameServiceQuery.cpp
+++ b/Swiften/Network/DomainNameServiceQuery.cpp
@@ -48,7 +48,7 @@ void DomainNameServiceQuery::sortResults(std::vector<DomainNameServiceQuery::Res
std::vector<int> cumulativeWeights;
std::partial_sum(weights.begin() + j, weights.end(), std::back_inserter(cumulativeWeights));
int randomNumber = generator.generateRandomInteger(cumulativeWeights.back());
- int selectedIndex = std::lower_bound(cumulativeWeights.begin(), cumulativeWeights.end(), randomNumber) - cumulativeWeights.begin();
+ size_t selectedIndex = std::lower_bound(cumulativeWeights.begin(), cumulativeWeights.end(), randomNumber) - cumulativeWeights.begin();
std::swap(i[j], i[j + selectedIndex]);
std::swap(weights.begin()[j], weights.begin()[j + selectedIndex]);
}
diff --git a/Swiften/Network/MacOSXProxyProvider.cpp b/Swiften/Network/MacOSXProxyProvider.cpp
index eaadd28..f5925c3 100644
--- a/Swiften/Network/MacOSXProxyProvider.cpp
+++ b/Swiften/Network/MacOSXProxyProvider.cpp
@@ -16,6 +16,8 @@
#include <SystemConfiguration/SystemConfiguration.h>
#endif
+#pragma clang diagnostic ignored "-Wdisabled-macro-expansion"
+
using namespace Swift;
#ifndef SWIFTEN_PLATFORM_IPHONE
diff --git a/Swiften/Network/NATPMPInterface.cpp b/Swiften/Network/NATPMPInterface.cpp
index 220e3e9..e178ab4 100644
--- a/Swiften/Network/NATPMPInterface.cpp
+++ b/Swiften/Network/NATPMPInterface.cpp
@@ -7,6 +7,7 @@
#include <Swiften/Network/NATPMPInterface.h>
#include <boost/smart_ptr/make_shared.hpp>
+#include <boost/numeric/conversion/cast.hpp>
#include <Swiften/Base/Log.h>
@@ -63,7 +64,7 @@ boost::optional<HostAddress> NATPMPInterface::getPublicIP() {
boost::optional<NATPortMapping> NATPMPInterface::addPortForward(int localPort, int publicPort) {
NATPortMapping mapping(localPort, publicPort, NATPortMapping::TCP);
- if (sendnewportmappingrequest(&p->natpmp, mapping.getProtocol() == NATPortMapping::TCP ? NATPMP_PROTOCOL_TCP : NATPMP_PROTOCOL_UDP, mapping.getLeaseInSeconds(), mapping.getPublicPort(), mapping.getLocalPort()) < 0) {
+ if (sendnewportmappingrequest(&p->natpmp, mapping.getProtocol() == NATPortMapping::TCP ? NATPMP_PROTOCOL_TCP : NATPMP_PROTOCOL_UDP, boost::numeric_cast<uint16_t>(mapping.getLeaseInSeconds()), boost::numeric_cast<uint16_t>(mapping.getPublicPort()), mapping.getLocalPort()) < 0) {
SWIFT_LOG(debug) << "Failed to send NAT-PMP port forwarding request!" << std::endl;
return boost::optional<NATPortMapping>();
}