summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/Client/ClientXMLTracer.cpp14
-rw-r--r--Swiften/Compress/ZLibCodecompressor.cpp2
-rw-r--r--Swiften/Config/swiften-config.cpp2
-rw-r--r--Swiften/Elements/StatusShow.h2
-rw-r--r--Swiften/Elements/StreamInitiationFileInfo.h4
-rw-r--r--Swiften/EventLoop/SimpleEventLoop.cpp2
-rw-r--r--Swiften/Examples/BenchTool/BenchTool.cpp2
-rw-r--r--Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp6
-rw-r--r--Swiften/Examples/NetworkTool/main.cpp6
-rw-r--r--Swiften/Examples/SendMessage/SendMessage.cpp4
-rw-r--r--Swiften/FileTransfer/FileTransfer.h2
-rw-r--r--Swiften/FileTransfer/IBBSendSession.h2
-rw-r--r--Swiften/FileTransfer/IncomingJingleFileTransfer.cpp3
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp3
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamClientSession.h4
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp1
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServerSession.h4
-rw-r--r--Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp12
-rw-r--r--Swiften/FileTransfer/UnitTest/SOCKS5BytestreamServerSessionTest.cpp8
-rw-r--r--Swiften/History/SQLiteHistoryStorage.cpp41
-rw-r--r--Swiften/History/SQLiteHistoryStorage.h8
-rw-r--r--Swiften/IDN/StringPrep.cpp16
-rw-r--r--Swiften/Jingle/JingleSessionImpl.cpp2
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h7
-rw-r--r--Swiften/LinkLocal/LinkLocalServiceInfo.cpp3
-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
-rw-r--r--Swiften/Parser/LibXMLParser.cpp3
-rw-r--r--Swiften/Parser/PayloadParsers/FormParser.h2
-rw-r--r--Swiften/Parser/PayloadParsers/StreamInitiationFileInfoParser.cpp2
-rw-r--r--Swiften/Parser/PayloadParsers/WhiteboardParser.cpp8
-rw-r--r--Swiften/QA/ClientTest/ClientTest.cpp6
-rw-r--r--Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/ChatStateSerializer.cpp1
-rw-r--r--Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp4
-rw-r--r--Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/MUCItemSerializer.h2
-rw-r--r--Swiften/Session/BOSHSessionStream.cpp2
-rw-r--r--Swiften/StringCodecs/Base64.cpp1
-rw-r--r--Swiften/StringCodecs/Hexify.cpp2
-rw-r--r--Swiften/StringCodecs/MD5.cpp3
-rw-r--r--Swiften/StringCodecs/SHA1.cpp4
-rw-r--r--Swiften/StringCodecs/SHA256.cpp3
-rw-r--r--Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp3
-rw-r--r--Swiften/TLS/OpenSSL/OpenSSLContext.cpp4
-rw-r--r--Swiften/TLS/ServerIdentityVerifier.cpp4
51 files changed, 133 insertions, 110 deletions
diff --git a/Swiften/Client/ClientXMLTracer.cpp b/Swiften/Client/ClientXMLTracer.cpp
index 405e3d1..d2b5446 100644
--- a/Swiften/Client/ClientXMLTracer.cpp
+++ b/Swiften/Client/ClientXMLTracer.cpp
@@ -25,14 +25,14 @@ void ClientXMLTracer::printData(char direction, const SafeByteArray& data) {
printLine(direction);
if (bosh) {
std::string line = byteArrayToString(ByteArray(data.begin(), data.end()));
- size_t endOfHTTP = line.find("\r\n\r\n");
- if (false && endOfHTTP != std::string::npos) {
- /* Disabled because it swallows bits of XML (namespaces, if I recall) */
- std::cerr << line.substr(0, endOfHTTP) << std::endl << beautifier->beautify(line.substr(endOfHTTP)) << std::endl;
- }
- else {
+// Disabled because it swallows bits of XML (namespaces, if I recall)
+// size_t endOfHTTP = line.find("\r\n\r\n");
+// if (false && endOfHTTP != std::string::npos) {
+// std::cerr << line.substr(0, endOfHTTP) << std::endl << beautifier->beautify(line.substr(endOfHTTP)) << std::endl;
+// }
+// else {
std::cerr << line << std::endl;
- }
+// }
}
else {
std::cerr << beautifier->beautify(byteArrayToString(ByteArray(data.begin(), data.end()))) << std::endl;
diff --git a/Swiften/Compress/ZLibCodecompressor.cpp b/Swiften/Compress/ZLibCodecompressor.cpp
index 125492a..01f1451 100644
--- a/Swiften/Compress/ZLibCodecompressor.cpp
+++ b/Swiften/Compress/ZLibCodecompressor.cpp
@@ -30,7 +30,7 @@ ZLibCodecompressor::~ZLibCodecompressor() {
SafeByteArray ZLibCodecompressor::process(const SafeByteArray& input) {
SafeByteArray output;
- p->stream.avail_in = input.size();
+ p->stream.avail_in = static_cast<unsigned int>(input.size());
p->stream.next_in = reinterpret_cast<Bytef*>(const_cast<unsigned char*>(vecptr(input)));
int outputPosition = 0;
do {
diff --git a/Swiften/Config/swiften-config.cpp b/Swiften/Config/swiften-config.cpp
index 81a8357..de07d74 100644
--- a/Swiften/Config/swiften-config.cpp
+++ b/Swiften/Config/swiften-config.cpp
@@ -22,7 +22,7 @@
using namespace Swift;
-void printFlags(const std::vector<std::string>& flags) {
+static void printFlags(const std::vector<std::string>& flags) {
for (size_t i = 0; i < flags.size(); ++i) {
if (i > 0) {
std::cout << " ";
diff --git a/Swiften/Elements/StatusShow.h b/Swiften/Elements/StatusShow.h
index 3eeb44e..afa30de 100644
--- a/Swiften/Elements/StatusShow.h
+++ b/Swiften/Elements/StatusShow.h
@@ -8,6 +8,7 @@
#include <Swiften/Base/API.h>
#include <Swiften/Elements/Payload.h>
+#include <cassert>
namespace Swift {
class SWIFTEN_API StatusShow : public Payload {
@@ -37,6 +38,7 @@ namespace Swift {
case DND: return 3;
case None: return 0;
}
+ assert(false);
return 0;
}
diff --git a/Swiften/Elements/StreamInitiationFileInfo.h b/Swiften/Elements/StreamInitiationFileInfo.h
index 6569c3d..4265a19 100644
--- a/Swiften/Elements/StreamInitiationFileInfo.h
+++ b/Swiften/Elements/StreamInitiationFileInfo.h
@@ -79,8 +79,8 @@ public:
return supportsRangeRequests;
}
- void setRangeOffset(const int offset) {
- supportsRangeRequests = offset >= 0 ? true : false;
+ void setRangeOffset(boost::uintmax_t offset) {
+ supportsRangeRequests = true;
rangeOffset = offset;
}
diff --git a/Swiften/EventLoop/SimpleEventLoop.cpp b/Swiften/EventLoop/SimpleEventLoop.cpp
index 63b8ba5..42a5481 100644
--- a/Swiften/EventLoop/SimpleEventLoop.cpp
+++ b/Swiften/EventLoop/SimpleEventLoop.cpp
@@ -14,8 +14,6 @@
namespace Swift {
-void nop() {}
-
SimpleEventLoop::SimpleEventLoop() : isRunning_(true) {
}
diff --git a/Swiften/Examples/BenchTool/BenchTool.cpp b/Swiften/Examples/BenchTool/BenchTool.cpp
index ba6cf84..57edbac 100644
--- a/Swiften/Examples/BenchTool/BenchTool.cpp
+++ b/Swiften/Examples/BenchTool/BenchTool.cpp
@@ -26,7 +26,7 @@ int numberOfConnectedClients = 0;
int numberOfInstances = 100;
-void handleConnected() {
+static void handleConnected() {
numberOfConnectedClients++;
std::cout << "Connected " << numberOfConnectedClients << std::endl;
}
diff --git a/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp b/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp
index 636a52a..1f49fea 100644
--- a/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp
+++ b/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp
@@ -29,7 +29,7 @@ JID recipient;
int exitCode = CANNOT_CONNECT;
boost::bsignals::connection errorConnection;
-void handleServerDiscoInfoResponse(boost::shared_ptr<DiscoInfo> /*info*/, ErrorPayload::ref error) {
+static void handleServerDiscoInfoResponse(boost::shared_ptr<DiscoInfo> /*info*/, ErrorPayload::ref error) {
if (!error) {
errorConnection.disconnect();
client->disconnect();
@@ -41,14 +41,14 @@ void handleServerDiscoInfoResponse(boost::shared_ptr<DiscoInfo> /*info*/, ErrorP
}
}
-void handleConnected() {
+static void handleConnected() {
exitCode = NO_RESPONSE;
GetDiscoInfoRequest::ref discoInfoRequest = GetDiscoInfoRequest::create(JID(), client->getIQRouter());
discoInfoRequest->onResponse.connect(&handleServerDiscoInfoResponse);
discoInfoRequest->send();
}
-void handleDisconnected(const boost::optional<ClientError>&) {
+static void handleDisconnected(const boost::optional<ClientError>&) {
exitCode = CANNOT_AUTH;
eventLoop.stop();
}
diff --git a/Swiften/Examples/NetworkTool/main.cpp b/Swiften/Examples/NetworkTool/main.cpp
index 00c12d2..698ef4c 100644
--- a/Swiften/Examples/NetworkTool/main.cpp
+++ b/Swiften/Examples/NetworkTool/main.cpp
@@ -18,7 +18,7 @@ using namespace Swift;
SimpleEventLoop eventLoop;
-void handleGetPublicIPRequestResponse(const boost::optional<HostAddress>& result) {
+static void handleGetPublicIPRequestResponse(const boost::optional<HostAddress>& result) {
if (result) {
std::cerr << "Result: " << result->toString() << std::endl;;
}
@@ -28,7 +28,7 @@ void handleGetPublicIPRequestResponse(const boost::optional<HostAddress>& result
eventLoop.stop();
}
-void handleGetForwardPortRequestResponse(const boost::optional<NATPortMapping>& result) {
+static void handleGetForwardPortRequestResponse(const boost::optional<NATPortMapping>& result) {
if (result) {
std::cerr << "Result: " << result->getPublicPort() << " -> " << result->getLocalPort() << std::endl;;
}
@@ -38,7 +38,7 @@ void handleGetForwardPortRequestResponse(const boost::optional<NATPortMapping>&
eventLoop.stop();
}
-void handleRemovePortForwardingRequestResponse(bool result) {
+static void handleRemovePortForwardingRequestResponse(bool result) {
if (result) {
std::cerr << "Result: OK" << std::endl;
}
diff --git a/Swiften/Examples/SendMessage/SendMessage.cpp b/Swiften/Examples/SendMessage/SendMessage.cpp
index 07e289e..7f7a00d 100644
--- a/Swiften/Examples/SendMessage/SendMessage.cpp
+++ b/Swiften/Examples/SendMessage/SendMessage.cpp
@@ -28,7 +28,7 @@ int exitCode = 2;
boost::bsignals::connection errorConnection;
-void handleConnected() {
+static void handleConnected() {
boost::shared_ptr<Message> message(new Message());
message->setBody(messageBody);
message->setTo(recipient);
@@ -39,7 +39,7 @@ void handleConnected() {
eventLoop.stop();
}
-void handleDisconnected(const boost::optional<ClientError>&) {
+static void handleDisconnected(const boost::optional<ClientError>&) {
std::cerr << "Error!" << std::endl;
exitCode = 1;
eventLoop.stop();
diff --git a/Swiften/FileTransfer/FileTransfer.h b/Swiften/FileTransfer/FileTransfer.h
index 336c51c..01c9449 100644
--- a/Swiften/FileTransfer/FileTransfer.h
+++ b/Swiften/FileTransfer/FileTransfer.h
@@ -48,7 +48,7 @@ public:
virtual void cancel() = 0;
public:
- boost::signal<void (int /* proccessedBytes */)> onProcessedBytes;
+ boost::signal<void (size_t /* proccessedBytes */)> onProcessedBytes;
boost::signal<void (State)> onStateChange;
boost::signal<void (boost::optional<FileTransferError>)> onFinished;
diff --git a/Swiften/FileTransfer/IBBSendSession.h b/Swiften/FileTransfer/IBBSendSession.h
index a535382..8584d38 100644
--- a/Swiften/FileTransfer/IBBSendSession.h
+++ b/Swiften/FileTransfer/IBBSendSession.h
@@ -41,7 +41,7 @@ namespace Swift {
}
boost::signal<void (boost::optional<FileTransferError>)> onFinished;
- boost::signal<void (int)> onBytesSent;
+ boost::signal<void (unsigned long long)> onBytesSent;
private:
void handleIBBResponse(IBB::ref, ErrorPayload::ref);
diff --git a/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp b/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp
index 808ff58..dbf6ace 100644
--- a/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp
+++ b/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp
@@ -173,8 +173,9 @@ void IncomingJingleFileTransfer::handleRemoteTransportCandidateSelectFinished(Ji
}
}
+// TODO: Why was assert(false) there? Is this method no longer used perhaps? Delete it if not
void IncomingJingleFileTransfer::checkCandidateSelected() {
- assert(false);
+ //assert(false);
if (localTransportCandidateSelectFinished && remoteTransportCandidateSelectFinished) {
if (candidateGenerator->isActualCandidate(selectedLocalTransportCandidate) && candidateSelector->isActualCandidate(selectedRemoteTransportCandidate)) {
if (candidateGenerator->getPriority(selectedLocalTransportCandidate) > candidateSelector->getPriority(selectedRemoteTransportCandidate)) {
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp b/Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp
index cd555e5..b167663 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp
+++ b/Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp
@@ -7,6 +7,7 @@
#include "SOCKS5BytestreamClientSession.h"
#include <boost/bind.hpp>
+#include <boost/numeric/conversion/cast.hpp>
#include <Swiften/Base/Algorithm.h>
#include <Swiften/Base/SafeByteArray.h>
@@ -127,7 +128,7 @@ void SOCKS5BytestreamClientSession::authenticate() {
SWIFT_LOG(debug) << std::endl;
SafeByteArray header = createSafeByteArray("\x05\x01\x00\x03", 4);
SafeByteArray message = header;
- append(message, createSafeByteArray(destination.size()));
+ append(message, createSafeByteArray(boost::numeric_cast<char>(destination.size())));
authenticateAddress = createByteArray(destination);
append(message, authenticateAddress);
append(message, createSafeByteArray("\x00\x00", 2)); // 2 byte for port
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamClientSession.h b/Swiften/FileTransfer/SOCKS5BytestreamClientSession.h
index 0b9790d..a832796 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamClientSession.h
+++ b/Swiften/FileTransfer/SOCKS5BytestreamClientSession.h
@@ -58,8 +58,8 @@ public:
boost::signal<void (bool /*error*/)> onSessionReady;
boost::signal<void (boost::optional<FileTransferError>)> onFinished;
- boost::signal<void (int)> onBytesSent;
- boost::signal<void (int)> onBytesReceived;
+ boost::signal<void (size_t)> onBytesSent;
+ boost::signal<void (size_t)> onBytesReceived;
private:
void process();
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp
index 4412d0b..e0e6044 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp
+++ b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp
@@ -7,6 +7,7 @@
#include <Swiften/FileTransfer/SOCKS5BytestreamServerSession.h>
#include <boost/bind.hpp>
+#include <boost/numeric/conversion/cast.hpp>
#include <iostream>
#include <Swiften/Base/ByteArray.h>
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.h b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.h
index 4cbda7c..60a404b 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.h
+++ b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.h
@@ -47,8 +47,8 @@ namespace Swift {
HostAddressPort getAddressPort() const;
boost::signal<void (boost::optional<FileTransferError>)> onFinished;
- boost::signal<void (int)> onBytesSent;
- boost::signal<void (int)> onBytesReceived;
+ boost::signal<void (unsigned long long)> onBytesSent;
+ boost::signal<void (unsigned long long)> onBytesReceived;
private:
void finish(bool error);
diff --git a/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp b/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp
index 5fe096a..fce76bc 100644
--- a/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp
+++ b/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp
@@ -52,7 +52,7 @@ public:
destination(SOCKS5BytestreamRegistry::getHostname("foo", JID("requester@example.com/test"), JID("target@example.com/test"))), eventLoop(NULL), timerFactory(NULL) { }
void setUp() {
- randomGen.seed(time(NULL));
+ randomGen.seed(static_cast<unsigned int>(time(NULL)));
eventLoop = new DummyEventLoop();
timerFactory = new DummyTimerFactory();
connection = boost::make_shared<MockeryConnection>(failingPorts, true, eventLoop);
@@ -82,7 +82,7 @@ public:
serverRespondHelloOK();
eventLoop->processEvents();
CPPUNIT_ASSERT_EQUAL(createByteArray("\x05\x01\x00\x03", 4), createByteArray(&helper.unprocessedInput[0], 4));
- CPPUNIT_ASSERT_EQUAL(createByteArray(destination.size()), createByteArray(helper.unprocessedInput[4]));
+ CPPUNIT_ASSERT_EQUAL(createByteArray(static_cast<char>(destination.size())), createByteArray(static_cast<char>(helper.unprocessedInput[4])));
CPPUNIT_ASSERT_EQUAL(createByteArray(destination), createByteArray(&helper.unprocessedInput[5], destination.size()));
CPPUNIT_ASSERT_EQUAL(createByteArray("\x00", 1), createByteArray(&helper.unprocessedInput[5 + destination.size()], 1));
@@ -128,7 +128,7 @@ public:
serverRespondHelloOK();
eventLoop->processEvents();
CPPUNIT_ASSERT_EQUAL(createByteArray("\x05\x01\x00\x03", 4), createByteArray(&helper.unprocessedInput[0], 4));
- CPPUNIT_ASSERT_EQUAL(createByteArray(destination.size()), createByteArray(helper.unprocessedInput[4]));
+ CPPUNIT_ASSERT_EQUAL(createByteArray(static_cast<char>(destination.size())), createByteArray(static_cast<char>(helper.unprocessedInput[4])));
CPPUNIT_ASSERT_EQUAL(createByteArray(destination), createByteArray(&helper.unprocessedInput[5], destination.size()));
CPPUNIT_ASSERT_EQUAL(createByteArray("\x00", 1), createByteArray(&helper.unprocessedInput[5 + destination.size()], 1));
@@ -205,7 +205,7 @@ private:
boost::variate_generator<boost::mt19937&, boost::uniform_int<> > randomByte(randomGen, dist);
ByteArray result(len);
for (size_t i=0; i < len; ++i ) {
- result[i] = randomByte();
+ result[i] = static_cast<char>(randomByte());
}
return result;
}
@@ -221,7 +221,7 @@ private:
void serverRespondRequestOK() {
boost::shared_ptr<SafeByteArray> dataToSend = createSafeByteArrayRef("\x05\x00\x00\x03", 4);
- append(*dataToSend, createSafeByteArray(destination.size()));
+ append(*dataToSend, createSafeByteArray(static_cast<char>(destination.size())));
append(*dataToSend, createSafeByteArray(destination));
append(*dataToSend, createSafeByteArray("\x00", 1));
connection->onDataRead(dataToSend);
@@ -229,7 +229,7 @@ private:
void serverRespondRequestFail() {
boost::shared_ptr<SafeByteArray> correctData = createSafeByteArrayRef("\x05\x00\x00\x03", 4);
- append(*correctData, createSafeByteArray(destination.size()));
+ append(*correctData, createSafeByteArray(static_cast<char>(destination.size())));
append(*correctData, createSafeByteArray(destination));
append(*correctData, createSafeByteArray("\x00", 1));
diff --git a/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamServerSessionTest.cpp b/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamServerSessionTest.cpp
index 6dec37f..4e97399 100644
--- a/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamServerSessionTest.cpp
+++ b/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamServerSessionTest.cpp
@@ -76,7 +76,7 @@ class SOCKS5BytestreamServerSessionTest : public CppUnit::TestFixture {
authenticate();
ByteArray hostname(createByteArray("abcdef"));
- receive(concat(createSafeByteArray("\x05\x01\x00\x03", 4), createSafeByteArray(hostname.size()), createSafeByteArray(hostname), createSafeByteArray("\x00\x00", 2)));
+ receive(concat(createSafeByteArray("\x05\x01\x00\x03", 4), createSafeByteArray(static_cast<char>(hostname.size())), createSafeByteArray(hostname), createSafeByteArray("\x00\x00", 2)));
CPPUNIT_ASSERT(createByteArray("\x05\x00\x00\x03\x06\x61\x62\x63\x64\x65\x66\x00\x00", 13) == createByteArray(&receivedData[0], 13));
}
@@ -86,7 +86,7 @@ class SOCKS5BytestreamServerSessionTest : public CppUnit::TestFixture {
authenticate();
ByteArray hostname(createByteArray("abcdef"));
- receive(concat(createSafeByteArray("\x05\x01\x00\x03", 4), createSafeByteArray(hostname.size()), createSafeByteArray(hostname), createSafeByteArray("\x00\x00", 2)));
+ receive(concat(createSafeByteArray("\x05\x01\x00\x03", 4), createSafeByteArray(static_cast<char>(hostname.size())), createSafeByteArray(hostname), createSafeByteArray("\x00\x00", 2)));
CPPUNIT_ASSERT(createByteArray("\x05\x04\x00\x03\x06\x61\x62\x63\x64\x65\x66\x00\x00", 13) == receivedData);
}
@@ -173,11 +173,11 @@ class SOCKS5BytestreamServerSessionTest : public CppUnit::TestFixture {
}
void request(const std::string& hostname) {
- receive(concat(createSafeByteArray("\x05\x01\x00\x03", 4), createSafeByteArray(hostname.size()), createSafeByteArray(hostname), createSafeByteArray("\x00\x00", 2)));
+ receive(concat(createSafeByteArray("\x05\x01\x00\x03", 4), createSafeByteArray(static_cast<char>(hostname.size())), createSafeByteArray(hostname), createSafeByteArray("\x00\x00", 2)));
}
void skipHeader(const std::string& hostname) {
- int headerSize = 7 + hostname.size();
+ size_t headerSize = 7 + hostname.size();
receivedData = createByteArray(&receivedData[headerSize], receivedData.size() - headerSize);
}
diff --git a/Swiften/History/SQLiteHistoryStorage.cpp b/Swiften/History/SQLiteHistoryStorage.cpp
index 04bd00f..d7e7477 100644
--- a/Swiften/History/SQLiteHistoryStorage.cpp
+++ b/Swiften/History/SQLiteHistoryStorage.cpp
@@ -6,6 +6,7 @@
#include <iostream>
#include <boost/lexical_cast.hpp>
+#include <boost/numeric/conversion/cast.hpp>
#include <sqlite3.h>
#include <3rdParty/SQLiteAsync/sqlite3async.h>
@@ -78,8 +79,8 @@ void SQLiteHistoryStorage::addMessage(const HistoryMessage& message) {
std::vector<HistoryMessage> SQLiteHistoryStorage::getMessagesFromDate(const JID& selfJID, const JID& contactJID, HistoryMessage::Type type, const boost::gregorian::date& date) const {
sqlite3_stmt* selectStatement;
- boost::optional<int> selfID = getIDFromJID(selfJID.toBare());
- boost::optional<int> contactID = getIDFromJID(contactJID.toBare());
+ boost::optional<long long> selfID = getIDFromJID(selfJID.toBare());
+ boost::optional<long long> contactID = getIDFromJID(contactJID.toBare());
if (!selfID || !contactID) {
// JIDs missing from the database
@@ -111,7 +112,7 @@ std::vector<HistoryMessage> SQLiteHistoryStorage::getMessagesFromDate(const JID&
" AND time<" + boost::lexical_cast<std::string>(upperBound) + ")";
}
- int r = sqlite3_prepare(db_, selectQuery.c_str(), selectQuery.size(), &selectStatement, NULL);
+ int r = sqlite3_prepare(db_, selectQuery.c_str(), boost::numeric_cast<int>(selectQuery.size()), &selectStatement, NULL);
if (r != SQLITE_OK) {
std::cout << "Error: " << sqlite3_errmsg(db_) << std::endl;
}
@@ -157,8 +158,8 @@ std::vector<HistoryMessage> SQLiteHistoryStorage::getMessagesFromDate(const JID&
return result;
}
-int SQLiteHistoryStorage::getIDForJID(const JID& jid) {
- boost::optional<int> id = getIDFromJID(jid);
+long long SQLiteHistoryStorage::getIDForJID(const JID& jid) {
+ boost::optional<long long> id = getIDFromJID(jid);
if (id) {
return *id;
}
@@ -167,7 +168,7 @@ int SQLiteHistoryStorage::getIDForJID(const JID& jid) {
}
}
-int SQLiteHistoryStorage::addJID(const JID& jid) {
+long long SQLiteHistoryStorage::addJID(const JID& jid) {
std::string statement = std::string("INSERT INTO jids('jid') VALUES('") + getEscapedString(jid.toString()) + "')";
char* errorMessage;
int result = sqlite3_exec(db_, statement.c_str(), 0, 0, &errorMessage);
@@ -178,11 +179,11 @@ int SQLiteHistoryStorage::addJID(const JID& jid) {
return sqlite3_last_insert_rowid(db_);
}
-boost::optional<JID> SQLiteHistoryStorage::getJIDFromID(int id) const {
+boost::optional<JID> SQLiteHistoryStorage::getJIDFromID(long long id) const {
boost::optional<JID> result;
sqlite3_stmt* selectStatement;
std::string selectQuery("SELECT jid FROM jids WHERE id=" + boost::lexical_cast<std::string>(id));
- int r = sqlite3_prepare(db_, selectQuery.c_str(), selectQuery.size(), &selectStatement, NULL);
+ int r = sqlite3_prepare(db_, selectQuery.c_str(), boost::numeric_cast<int>(selectQuery.size()), &selectStatement, NULL);
if (r != SQLITE_OK) {
std::cout << "Error: " << sqlite3_errmsg(db_) << std::endl;
}
@@ -194,17 +195,17 @@ boost::optional<JID> SQLiteHistoryStorage::getJIDFromID(int id) const {
return result;
}
-boost::optional<int> SQLiteHistoryStorage::getIDFromJID(const JID& jid) const {
- boost::optional<int> result;
+boost::optional<long long> SQLiteHistoryStorage::getIDFromJID(const JID& jid) const {
+ boost::optional<long long> result;
sqlite3_stmt* selectStatement;
std::string selectQuery("SELECT id FROM jids WHERE jid='" + jid.toString() + "'");
- int r = sqlite3_prepare(db_, selectQuery.c_str(), selectQuery.size(), &selectStatement, NULL);
+ long long r = sqlite3_prepare(db_, selectQuery.c_str(), boost::numeric_cast<int>(selectQuery.size()), &selectStatement, NULL);
if (r != SQLITE_OK) {
std::cout << "Error: " << sqlite3_errmsg(db_) << std::endl;
}
r = sqlite3_step(selectStatement);
if (r == SQLITE_ROW) {
- result = boost::optional<int>(sqlite3_column_int(selectStatement, 0));
+ result = boost::optional<long long>(sqlite3_column_int(selectStatement, 0));
}
sqlite3_finalize(selectStatement);
return result;
@@ -215,7 +216,7 @@ ContactsMap SQLiteHistoryStorage::getContacts(const JID& selfJID, HistoryMessage
sqlite3_stmt* selectStatement;
// get id
- boost::optional<int> id = getIDFromJID(selfJID);
+ boost::optional<long long> id = getIDFromJID(selfJID);
if (!id) {
return result;
}
@@ -231,7 +232,7 @@ ContactsMap SQLiteHistoryStorage::getContacts(const JID& selfJID, HistoryMessage
query += " AND message LIKE '%" + getEscapedString(keyword) + "%'";
}
- int r = sqlite3_prepare(db_, query.c_str(), query.size(), &selectStatement, NULL);
+ int r = sqlite3_prepare(db_, query.c_str(), boost::numeric_cast<int>(query.size()), &selectStatement, NULL);
if (r != SQLITE_OK) {
std::cout << "Error: " << sqlite3_errmsg(db_) << std::endl;
}
@@ -280,8 +281,8 @@ ContactsMap SQLiteHistoryStorage::getContacts(const JID& selfJID, HistoryMessage
boost::gregorian::date SQLiteHistoryStorage::getNextDateWithLogs(const JID& selfJID, const JID& contactJID, HistoryMessage::Type type, const boost::gregorian::date& date, bool reverseOrder) const {
sqlite3_stmt* selectStatement;
- boost::optional<int> selfID = getIDFromJID(selfJID.toBare());
- boost::optional<int> contactID = getIDFromJID(contactJID.toBare());
+ boost::optional<long long> selfID = getIDFromJID(selfJID.toBare());
+ boost::optional<long long> contactID = getIDFromJID(contactJID.toBare());
if (!selfID || !contactID) {
// JIDs missing from the database
@@ -310,7 +311,7 @@ boost::gregorian::date SQLiteHistoryStorage::getNextDateWithLogs(const JID& self
selectQuery += " AND time" + (reverseOrder ? std::string("<") : std::string(">")) + boost::lexical_cast<std::string>(timeStamp);
selectQuery += " ORDER BY time " + (reverseOrder ? std::string("DESC") : std::string("ASC")) + " LIMIT 1";
- int r = sqlite3_prepare(db_, selectQuery.c_str(), selectQuery.size(), &selectStatement, NULL);
+ int r = sqlite3_prepare(db_, selectQuery.c_str(), boost::numeric_cast<int>(selectQuery.size()), &selectStatement, NULL);
if (r != SQLITE_OK) {
std::cout << "Error: " << sqlite3_errmsg(db_) << std::endl;
}
@@ -347,8 +348,8 @@ std::vector<HistoryMessage> SQLiteHistoryStorage::getMessagesFromPreviousDate(co
}
boost::posix_time::ptime SQLiteHistoryStorage::getLastTimeStampFromMUC(const JID& selfJID, const JID& mucJID) const {
- boost::optional<int> selfID = getIDFromJID(selfJID.toBare());
- boost::optional<int> mucID = getIDFromJID(mucJID.toBare());
+ boost::optional<long long> selfID = getIDFromJID(selfJID.toBare());
+ boost::optional<long long> mucID = getIDFromJID(mucJID.toBare());
if (!selfID || !mucID) {
// JIDs missing from the database
@@ -361,7 +362,7 @@ boost::posix_time::ptime SQLiteHistoryStorage::getLastTimeStampFromMUC(const JID
boost::lexical_cast<std::string>(*selfID) + " AND fromBare=" +
boost::lexical_cast<std::string>(*mucID) + ") ORDER BY time DESC LIMIT 1";
- int r = sqlite3_prepare(db_, selectQuery.c_str(), selectQuery.size(), &selectStatement, NULL);
+ int r = sqlite3_prepare(db_, selectQuery.c_str(), boost::numeric_cast<int>(selectQuery.size()), &selectStatement, NULL);
if (r != SQLITE_OK) {
std::cout << "Error: " << sqlite3_errmsg(db_) << std::endl;
}
diff --git a/Swiften/History/SQLiteHistoryStorage.h b/Swiften/History/SQLiteHistoryStorage.h
index 782334a..dd526b1 100644
--- a/Swiften/History/SQLiteHistoryStorage.h
+++ b/Swiften/History/SQLiteHistoryStorage.h
@@ -29,11 +29,11 @@ namespace Swift {
private:
void run();
boost::gregorian::date getNextDateWithLogs(const JID& selfJID, const JID& contactJID, HistoryMessage::Type type, const boost::gregorian::date& date, bool reverseOrder) const;
- int getIDForJID(const JID&);
- int addJID(const JID&);
+ long long getIDForJID(const JID&);
+ long long addJID(const JID&);
- boost::optional<JID> getJIDFromID(int id) const;
- boost::optional<int> getIDFromJID(const JID& jid) const;
+ boost::optional<JID> getJIDFromID(long long id) const;
+ boost::optional<long long> getIDFromJID(const JID& jid) const;
sqlite3* db_;
boost::thread* thread_;
diff --git a/Swiften/IDN/StringPrep.cpp b/Swiften/IDN/StringPrep.cpp
index dfaba06..3ab7088 100644
--- a/Swiften/IDN/StringPrep.cpp
+++ b/Swiften/IDN/StringPrep.cpp
@@ -29,10 +29,10 @@ using namespace Swift;
namespace {
static UStringPrepProfileType getICUProfileType(StringPrep::Profile profile) {
switch(profile) {
- case StringPrep::NamePrep: return USPREP_RFC3491_NAMEPREP; break;
- case StringPrep::XMPPNodePrep: return USPREP_RFC3920_NODEPREP; break;
- case StringPrep::XMPPResourcePrep: return USPREP_RFC3920_RESOURCEPREP; break;
- case StringPrep::SASLPrep: return USPREP_RFC4013_SASLPREP; break;
+ case StringPrep::NamePrep: return USPREP_RFC3491_NAMEPREP;
+ case StringPrep::XMPPNodePrep: return USPREP_RFC3920_NODEPREP;
+ case StringPrep::XMPPResourcePrep: return USPREP_RFC3920_RESOURCEPREP;
+ case StringPrep::SASLPrep: return USPREP_RFC4013_SASLPREP;
}
assert(false);
return USPREP_RFC3491_NAMEPREP;
@@ -100,10 +100,10 @@ namespace {
const Stringprep_profile* getLibIDNProfile(StringPrep::Profile profile) {
switch(profile) {
- case StringPrep::NamePrep: return stringprep_nameprep; break;
- case StringPrep::XMPPNodePrep: return stringprep_xmpp_nodeprep; break;
- case StringPrep::XMPPResourcePrep: return stringprep_xmpp_resourceprep; break;
- case StringPrep::SASLPrep: return stringprep_saslprep; break;
+ case StringPrep::NamePrep: return stringprep_nameprep;
+ case StringPrep::XMPPNodePrep: return stringprep_xmpp_nodeprep;
+ case StringPrep::XMPPResourcePrep: return stringprep_xmpp_resourceprep;
+ case StringPrep::SASLPrep: return stringprep_saslprep;
}
assert(false);
return 0;
diff --git a/Swiften/Jingle/JingleSessionImpl.cpp b/Swiften/Jingle/JingleSessionImpl.cpp
index 98c5196..53092fc 100644
--- a/Swiften/Jingle/JingleSessionImpl.cpp
+++ b/Swiften/Jingle/JingleSessionImpl.cpp
@@ -76,7 +76,7 @@ void JingleSessionImpl::handleIncomingAction(JinglePayload::ref action) {
case JinglePayload::UnknownAction:
return;
}
- std::cerr << "Unhandled Jingle action!!! ACTION: " << action->getAction() << std::endl;
+ assert(false);
}
void JingleSessionImpl::sendInitiate(const JingleContentID& id, JingleDescription::ref description, JingleTransportPayload::ref transport) {
diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h
index d3c9488..1bec5f7 100644
--- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h
+++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h
@@ -10,6 +10,7 @@
#include <Swiften/LinkLocal/DNSSD/DNSSDRegisterQuery.h>
#include <Swiften/Base/ByteArray.h>
#include <Swiften/EventLoop/EventLoop.h>
+#include <boost/numeric/conversion/cast.hpp>
namespace Swift {
class BonjourQuerier;
@@ -18,8 +19,8 @@ namespace Swift {
public:
BonjourRegisterQuery(const std::string& name, int port, const ByteArray& txtRecord, boost::shared_ptr<BonjourQuerier> querier, EventLoop* eventLoop) : BonjourQuery(querier, eventLoop) {
DNSServiceErrorType result = DNSServiceRegister(
- &sdRef, 0, 0, name.c_str(), "_presence._tcp", NULL, NULL, port,
- txtRecord.size(), vecptr(txtRecord),
+ &sdRef, 0, 0, name.c_str(), "_presence._tcp", NULL, NULL, boost::numeric_cast<unsigned short>(port),
+ boost::numeric_cast<unsigned short>(txtRecord.size()), vecptr(txtRecord),
&BonjourRegisterQuery::handleServiceRegisteredStatic, this);
if (result != kDNSServiceErr_NoError) {
sdRef = NULL;
@@ -41,7 +42,7 @@ namespace Swift {
void updateServiceInfo(const ByteArray& txtRecord) {
boost::lock_guard<boost::mutex> lock(sdRefMutex);
- DNSServiceUpdateRecord(sdRef, NULL, 0, txtRecord.size(), vecptr(txtRecord), 0);
+ DNSServiceUpdateRecord(sdRef, NULL, 0, boost::numeric_cast<unsigned short>(txtRecord.size()), vecptr(txtRecord), 0);
}
private:
diff --git a/Swiften/LinkLocal/LinkLocalServiceInfo.cpp b/Swiften/LinkLocal/LinkLocalServiceInfo.cpp
index 516d303..19e0249 100644
--- a/Swiften/LinkLocal/LinkLocalServiceInfo.cpp
+++ b/Swiften/LinkLocal/LinkLocalServiceInfo.cpp
@@ -7,6 +7,7 @@
#include <Swiften/LinkLocal/LinkLocalServiceInfo.h>
#include <boost/lexical_cast.hpp>
+#include <boost/numeric/conversion/cast.hpp>
#include <Swiften/Base/Algorithm.h>
#include <Swiften/Base/Concat.h>
@@ -49,7 +50,7 @@ ByteArray LinkLocalServiceInfo::toTXTRecord() const {
ByteArray LinkLocalServiceInfo::getEncoded(const std::string& s) {
ByteArray sizeByte;
sizeByte.resize(1);
- sizeByte[0] = s.size();
+ sizeByte[0] = boost::numeric_cast<unsigned char>(s.size());
return concat(sizeByte, createByteArray(s));
}
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>();
}
diff --git a/Swiften/Parser/LibXMLParser.cpp b/Swiften/Parser/LibXMLParser.cpp
index caba716..74ee051 100644
--- a/Swiften/Parser/LibXMLParser.cpp
+++ b/Swiften/Parser/LibXMLParser.cpp
@@ -7,6 +7,7 @@
#include <Swiften/Parser/LibXMLParser.h>
#include <iostream>
+#include <boost/numeric/conversion/cast.hpp>
#include <cassert>
#include <cstring>
#include <libxml/parser.h>
@@ -86,7 +87,7 @@ LibXMLParser::~LibXMLParser() {
}
bool LibXMLParser::parse(const std::string& data) {
- if (xmlParseChunk(p->context_, data.c_str(), data.size(), false) == XML_ERR_OK) {
+ if (xmlParseChunk(p->context_, data.c_str(), boost::numeric_cast<unsigned int>(data.size()), false) == XML_ERR_OK) {
return true;
}
xmlError* error = xmlCtxtGetLastError(p->context_);
diff --git a/Swiften/Parser/PayloadParsers/FormParser.h b/Swiften/Parser/PayloadParsers/FormParser.h
index a3e2524..ec480a5 100644
--- a/Swiften/Parser/PayloadParsers/FormParser.h
+++ b/Swiften/Parser/PayloadParsers/FormParser.h
@@ -85,7 +85,7 @@ namespace Swift {
name##FormFieldParseHelper() : baseParser##FieldParseHelper() { \
field = name##FormField::create(); \
} \
- };
+ }
SWIFTEN_DECLARE_FORM_FIELD_PARSE_HELPER(Boolean, Bool);
SWIFTEN_DECLARE_FORM_FIELD_PARSE_HELPER(Fixed, String);
diff --git a/Swiften/Parser/PayloadParsers/StreamInitiationFileInfoParser.cpp b/Swiften/Parser/PayloadParsers/StreamInitiationFileInfoParser.cpp
index 0a13844..cc69348 100644
--- a/Swiften/Parser/PayloadParsers/StreamInitiationFileInfoParser.cpp
+++ b/Swiften/Parser/PayloadParsers/StreamInitiationFileInfoParser.cpp
@@ -35,7 +35,7 @@ void StreamInitiationFileInfoParser::handleStartElement(const std::string& eleme
} else {
parseDescription = false;
if (element == "range") {
- int offset = 0;
+ boost::uintmax_t offset = 0;
try {
offset = boost::lexical_cast<boost::uintmax_t>(attributes.getAttributeValue("offset").get_value_or("0"));
} catch (boost::bad_lexical_cast &) {
diff --git a/Swiften/Parser/PayloadParsers/WhiteboardParser.cpp b/Swiften/Parser/PayloadParsers/WhiteboardParser.cpp
index 09d8de9..a480813 100644
--- a/Swiften/Parser/PayloadParsers/WhiteboardParser.cpp
+++ b/Swiften/Parser/PayloadParsers/WhiteboardParser.cpp
@@ -83,8 +83,8 @@ namespace Swift {
std::string pathData = attributes.getAttributeValue("d").get_value_or("");
std::vector<std::pair<int, int> > points;
if (pathData[0] == 'M') {
- unsigned int pos = 1;
- unsigned int npos;
+ size_t pos = 1;
+ size_t npos;
int x, y;
if (pathData[pos] == ' ') {
pos++;
@@ -163,8 +163,8 @@ namespace Swift {
std::string pointsData = attributes.getAttributeValue("points").get_value_or("");
std::vector<std::pair<int, int> > points;
- unsigned int pos = 0;
- unsigned int npos;
+ size_t pos = 0;
+ size_t npos;
int x, y;
try {
while (pos < pointsData.size()) {
diff --git a/Swiften/QA/ClientTest/ClientTest.cpp b/Swiften/QA/ClientTest/ClientTest.cpp
index 397921a..dd7e7ed 100644
--- a/Swiften/QA/ClientTest/ClientTest.cpp
+++ b/Swiften/QA/ClientTest/ClientTest.cpp
@@ -30,7 +30,7 @@ enum TestStage {
TestStage stage;
ClientOptions options;
-void handleDisconnected(boost::optional<ClientError> e) {
+static void handleDisconnected(boost::optional<ClientError> e) {
std::cout << "Disconnected: " << e << std::endl;
if (stage == FirstConnect) {
stage = Reconnect;
@@ -41,13 +41,13 @@ void handleDisconnected(boost::optional<ClientError> e) {
}
}
-void handleRosterReceived(boost::shared_ptr<Payload>) {
+static void handleRosterReceived(boost::shared_ptr<Payload>) {
rosterReceived = true;
std::cout << "Disconnecting" << std::endl;
client->disconnect();
}
-void handleConnected() {
+static void handleConnected() {
std::cout << "Connected" << std::endl;
rosterReceived = false;
GetRosterRequest::ref rosterRequest = GetRosterRequest::create(client->getIQRouter());
diff --git a/Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp b/Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp
index 98460b1..09e202e 100644
--- a/Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp
+++ b/Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp
@@ -131,7 +131,7 @@ std::map<char, std::string> SCRAMSHA1ClientAuthenticator::parseMap(const std::st
i++;
}
else if (s[i] == ',') {
- result[static_cast<size_t>(key)] = value;
+ result[key] = value;
value = "";
expectKey = true;
}
diff --git a/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.cpp b/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.cpp
index ee468bb..d23cad7 100644
--- a/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.cpp
@@ -19,7 +19,6 @@ std::string ChatStateSerializer::serializePayload(boost::shared_ptr<ChatState> c
case ChatState::Paused: result += "paused"; break;
case ChatState::Inactive: result += "inactive"; break;
case ChatState::Gone: result += "gone"; break;
- default: result += "gone"; break;
}
result += " xmlns=\"http://jabber.org/protocol/chatstates\"/>";
return result;
diff --git a/Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp b/Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp
index fa6a566..954b885 100644
--- a/Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp
@@ -20,7 +20,7 @@ std::string ErrorSerializer::serializePayload(boost::shared_ptr<ErrorPayload> er
case ErrorPayload::Modify: result += "modify"; break;
case ErrorPayload::Auth: result += "auth"; break;
case ErrorPayload::Wait: result += "wait"; break;
- default: result += "cancel"; break;
+ case ErrorPayload::Cancel: result += "cancel"; break;
}
result += "\">";
@@ -47,7 +47,7 @@ std::string ErrorSerializer::serializePayload(boost::shared_ptr<ErrorPayload> er
case ErrorPayload::ServiceUnavailable: conditionElement = "service-unavailable"; break;
case ErrorPayload::SubscriptionRequired: conditionElement = "subscription-required"; break;
case ErrorPayload::UnexpectedRequest: conditionElement = "unexpected-request"; break;
- default: conditionElement = "undefined-condition"; break;
+ case ErrorPayload::UndefinedCondition: conditionElement = "undefined-condition"; break;
}
result += "<" + conditionElement + " xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"/>";
diff --git a/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp b/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp
index e78cdb4..c83b293 100644
--- a/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp
@@ -8,6 +8,7 @@
#include <boost/shared_ptr.hpp>
#include <boost/smart_ptr/make_shared.hpp>
+#include <cassert>
#include <boost/lexical_cast.hpp>
#include <Swiften/Base/foreach.h>
@@ -48,6 +49,7 @@ std::string IBBSerializer::serializePayload(boost::shared_ptr<IBB> ibb) const {
return ibbElement.serialize();
}
}
+ assert(false);
return "";
}
diff --git a/Swiften/Serializer/PayloadSerializers/MUCItemSerializer.h b/Swiften/Serializer/PayloadSerializers/MUCItemSerializer.h
index 2b5ffcc..2f2623f 100644
--- a/Swiften/Serializer/PayloadSerializers/MUCItemSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/MUCItemSerializer.h
@@ -23,7 +23,6 @@ namespace Swift {
case MUCOccupant::Member: result = "member"; break;
case MUCOccupant::Outcast: result = "outcast"; break;
case MUCOccupant::NoAffiliation: result = "none"; break;
- default: assert(false);
}
return result;
}
@@ -35,7 +34,6 @@ namespace Swift {
case MUCOccupant::NoRole: result = "none"; break;
case MUCOccupant::Participant: result = "participant"; break;
case MUCOccupant::Visitor: result = "visitor"; break;
- default: assert(false);
}
return result;
diff --git a/Swiften/Session/BOSHSessionStream.cpp b/Swiften/Session/BOSHSessionStream.cpp
index 479e415..5dfff3c 100644
--- a/Swiften/Session/BOSHSessionStream.cpp
+++ b/Swiften/Session/BOSHSessionStream.cpp
@@ -46,7 +46,7 @@ BOSHSessionStream::BOSHSessionStream(
boost::mt19937 random;
boost::uniform_int<unsigned long long> dist(0, (1LL<<53) - 1);
- random.seed(time(NULL));
+ random.seed(static_cast<unsigned int>(time(NULL)));
unsigned long long initialRID = boost::variate_generator<boost::mt19937&, boost::uniform_int<unsigned long long> >(random, dist)();
connectionPool = new BOSHConnectionPool(boshURL, resolver, connectionFactory, xmlParserFactory, tlsContextFactory, timerFactory, eventLoop, to, initialRID, boshHTTPConnectProxyURL, boshHTTPConnectProxyAuthID, boshHTTPConnectProxyAuthPassword);
diff --git a/Swiften/StringCodecs/Base64.cpp b/Swiften/StringCodecs/Base64.cpp
index e4eaa4e..195987e 100644
--- a/Swiften/StringCodecs/Base64.cpp
+++ b/Swiften/StringCodecs/Base64.cpp
@@ -14,6 +14,7 @@
namespace Swift {
#pragma GCC diagnostic ignored "-Wold-style-cast"
+#pragma clang diagnostic ignored "-Wconversion"
namespace {
template<typename TargetType, typename SourceType>
diff --git a/Swiften/StringCodecs/Hexify.cpp b/Swiften/StringCodecs/Hexify.cpp
index 668079b..0e6dc4e 100644
--- a/Swiften/StringCodecs/Hexify.cpp
+++ b/Swiften/StringCodecs/Hexify.cpp
@@ -13,6 +13,8 @@
#include <string>
#include <Swiften/Base/ByteArray.h>
+#pragma clang diagnostic ignored "-Wconversion"
+
namespace Swift {
std::string Hexify::hexify(unsigned char byte) {
diff --git a/Swiften/StringCodecs/MD5.cpp b/Swiften/StringCodecs/MD5.cpp
index bd03314..ffed37b 100644
--- a/Swiften/StringCodecs/MD5.cpp
+++ b/Swiften/StringCodecs/MD5.cpp
@@ -32,6 +32,9 @@
*/
#pragma GCC diagnostic ignored "-Wold-style-cast"
+#pragma clang diagnostic ignored "-Wconversion"
+#pragma clang diagnostic ignored "-Wcast-align"
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
#include <Swiften/StringCodecs/MD5.h>
diff --git a/Swiften/StringCodecs/SHA1.cpp b/Swiften/StringCodecs/SHA1.cpp
index e4081f4..8b03989 100644
--- a/Swiften/StringCodecs/SHA1.cpp
+++ b/Swiften/StringCodecs/SHA1.cpp
@@ -185,7 +185,7 @@ SHA1::SHA1() {
SHA1& SHA1::update(const std::vector<unsigned char>& input) {
std::vector<unsigned char> inputCopy(input);
- Update(&context, (boost::uint8_t*) vecptr(inputCopy), inputCopy.size());
+ Update(&context, (boost::uint8_t*) vecptr(inputCopy), static_cast<unsigned int>(inputCopy.size()));
return *this;
}
@@ -203,7 +203,7 @@ ByteArray SHA1::getHashInternal(const Container& input) {
Init(&context);
Container inputCopy(input);
- Update(&context, (boost::uint8_t*) vecptr(inputCopy), inputCopy.size());
+ Update(&context, (boost::uint8_t*) vecptr(inputCopy), static_cast<unsigned int>(inputCopy.size()));
ByteArray digest;
digest.resize(20);
diff --git a/Swiften/StringCodecs/SHA256.cpp b/Swiften/StringCodecs/SHA256.cpp
index f92e7af..6e3c4ec 100644
--- a/Swiften/StringCodecs/SHA256.cpp
+++ b/Swiften/StringCodecs/SHA256.cpp
@@ -11,6 +11,9 @@
#include <string.h>
#pragma GCC diagnostic ignored "-Wold-style-cast"
+#pragma clang diagnostic ignored "-Wconversion"
+#pragma clang diagnostic ignored "-Wunused-macros"
+#pragma clang diagnostic ignored "-Wdisabled-macro-expansion"
using namespace Swift;
diff --git a/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp b/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp
index 6295c6f..e52436a 100644
--- a/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp
+++ b/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp
@@ -14,6 +14,7 @@
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#pragma clang diagnostic ignored "-Wcast-align"
namespace Swift {
@@ -56,7 +57,7 @@ void OpenSSLCertificate::parse() {
// Subject name
ByteArray subjectNameData;
subjectNameData.resize(256);
- X509_NAME_oneline(X509_get_subject_name(cert.get()), reinterpret_cast<char*>(vecptr(subjectNameData)), subjectNameData.size());
+ X509_NAME_oneline(X509_get_subject_name(cert.get()), reinterpret_cast<char*>(vecptr(subjectNameData)), static_cast<unsigned int>(subjectNameData.size()));
this->subjectName = byteArrayToString(subjectNameData);
// Common name
diff --git a/Swiften/TLS/OpenSSL/OpenSSLContext.cpp b/Swiften/TLS/OpenSSL/OpenSSLContext.cpp
index 73575ff..3cb4827 100644
--- a/Swiften/TLS/OpenSSL/OpenSSLContext.cpp
+++ b/Swiften/TLS/OpenSSL/OpenSSLContext.cpp
@@ -26,13 +26,15 @@
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#pragma clang diagnostic ignored "-Wshorten-64-to-32"
+#pragma clang diagnostic ignored "-Wcast-align"
namespace Swift {
static const int MAX_FINISHED_SIZE = 4096;
static const int SSL_READ_BUFFERSIZE = 8192;
-void freeX509Stack(STACK_OF(X509)* stack) {
+static void freeX509Stack(STACK_OF(X509)* stack) {
sk_X509_free(stack);
}
diff --git a/Swiften/TLS/ServerIdentityVerifier.cpp b/Swiften/TLS/ServerIdentityVerifier.cpp
index a908ad0..59c0614 100644
--- a/Swiften/TLS/ServerIdentityVerifier.cpp
+++ b/Swiften/TLS/ServerIdentityVerifier.cpp
@@ -67,8 +67,8 @@ bool ServerIdentityVerifier::matchesDomain(const std::string& s) const {
if (boost::starts_with(s, "*.")) {
std::string matchString(s.substr(2, s.npos));
std::string matchDomain = encodedDomain;
- int dotIndex = matchDomain.find('.');
- if (dotIndex >= 0) {
+ size_t dotIndex = matchDomain.find('.');
+ if (dotIndex != matchDomain.npos) {
matchDomain = matchDomain.substr(dotIndex + 1, matchDomain.npos);
}
return matchString == matchDomain;