summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--3rdParty/HippoMocks/hippomocks.h2
-rw-r--r--BuildTools/SCons/SConscript.boot17
-rw-r--r--Sluift/Lua/Value.cpp7
-rw-r--r--Sluift/sluift.cpp21
-rw-r--r--SwifTools/Idle/IdleQuerierTest/IdleQuerierTest.cpp3
-rw-r--r--SwifTools/Idle/MacOSXIdleQuerier.cpp3
-rw-r--r--SwifTools/URIHandler/UnitTest/XMPPURITest.cpp8
-rw-r--r--Swift/Controllers/Chat/ChatControllerBase.cpp10
-rw-r--r--Swift/Controllers/Chat/MUCController.cpp11
-rw-r--r--Swift/Controllers/FileTransfer/FileTransferController.cpp2
-rw-r--r--Swift/Controllers/MainController.cpp2
-rw-r--r--Swift/Controllers/Roster/ContactRosterItem.cpp12
-rw-r--r--Swift/Controllers/Roster/Roster.cpp4
-rw-r--r--Swift/Controllers/Roster/UnitTest/TableRosterTest.cpp2
-rw-r--r--Swift/Controllers/StatusUtil.cpp2
-rw-r--r--Swift/Controllers/UnitTest/MockMainWindow.h20
-rw-r--r--Swift/Controllers/XMPPEvents/EventController.cpp5
-rw-r--r--Swift/QtUI/EventViewer/EventDelegate.cpp2
-rw-r--r--Swift/QtUI/QtAffiliationEditor.cpp2
-rw-r--r--Swift/QtUI/QtAffiliationEditor.h2
-rw-r--r--Swift/QtUI/QtChatTabs.cpp2
-rw-r--r--Swift/QtUI/QtChatView.cpp2
-rw-r--r--Swift/QtUI/QtChatWindow.cpp5
-rw-r--r--Swift/QtUI/QtChatWindow.h3
-rw-r--r--Swift/QtUI/QtFileTransferListItemModel.cpp4
-rw-r--r--Swift/QtUI/QtHistoryWindow.cpp9
-rw-r--r--Swift/QtUI/QtSwift.cpp4
-rw-r--r--Swift/QtUI/QtWebView.cpp3
-rw-r--r--Swift/QtUI/SConscript5
-rw-r--r--Swift/QtUI/Whiteboard/ColorWidget.h2
-rw-r--r--Swift/QtUI/Whiteboard/FreehandLineItem.h2
-rw-r--r--Swift/QtUI/Whiteboard/GView.h2
-rw-r--r--Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp17
-rw-r--r--Swift/QtUI/Whiteboard/QtWhiteboardWindow.h2
-rw-r--r--Swift/QtUI/Whiteboard/TextDialog.h4
-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
-rw-r--r--Swiftob/MUCs.cpp2
-rw-r--r--Swiftob/MUCs.h20
-rw-r--r--Swiftob/SConscript2
-rw-r--r--Swiftob/Users.cpp2
-rw-r--r--Swiftob/Users.h10
91 files changed, 270 insertions, 212 deletions
diff --git a/3rdParty/HippoMocks/hippomocks.h b/3rdParty/HippoMocks/hippomocks.h
index 273f7d2..802d719 100644
--- a/3rdParty/HippoMocks/hippomocks.h
+++ b/3rdParty/HippoMocks/hippomocks.h
@@ -3,6 +3,8 @@
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
+#pragma clang diagnostic ignored "-Wshorten-64-to-32"
+#pragma clang diagnostic ignored "-Wunreachable-code"
#ifndef EXCEPTION_BUFFER_SIZE
#define EXCEPTION_BUFFER_SIZE 65536
diff --git a/BuildTools/SCons/SConscript.boot b/BuildTools/SCons/SConscript.boot
index 0289e92..e4071be 100644
--- a/BuildTools/SCons/SConscript.boot
+++ b/BuildTools/SCons/SConscript.boot
@@ -222,13 +222,16 @@ else :
if gccVersion >= ["4", "5", "0"] and not "clang" in env["CC"] :
env.Append(CXXFLAGS = ["-Wlogical-op"])
if "clang" in env["CC"] :
- env.Append(CXXFLAGS = ["-W#warnings", "-Wc++0x-compat", "-Waddress-of-temporary", "-Wambiguous-member-template", "-Warray-bounds", "-Watomic-properties", "-Wbind-to-temporary-copy", "-Wbuiltin-macro-redefined", "-Wc++-compat", "-Wc++0x-extensions", "-Wcomments", "-Wconditional-uninitialized", "-Wconstant-logical-operand", "-Wdeclaration-after-statement", "-Wdeprecated", "-Wdeprecated-implementations", "-Wdeprecated-writable-strings", "-Wduplicate-method-arg", "-Wempty-body", "-Wendif-labels", "-Wenum-compare", "-Wformat=2", "-Wfour-char-constants", "-Wgnu", "-Wincomplete-implementation", "-Winvalid-noreturn", "-Winvalid-offsetof", "-Winvalid-token-paste", "-Wlocal-type-template-args", "-Wmethod-signatures", "-Wmicrosoft", "-Wmissing-declarations", "-Wnon-pod-varargs", "-Wnull-dereference", "-Wout-of-line-declaration", "-Woverlength-strings", "-Wpacked", "-Wpointer-arith", "-Wpointer-sign", "-Wprotocol", "-Wreadonly-setter-attrs", "-Wselector", "-Wshift-overflow", "-Wshift-sign-overflow", "-Wstrict-selector-match", "-Wsuper-class-method-mismatch", "-Wtautological-compare", "-Wtypedef-redefinition", "-Wundeclared-selector", "-Wunknown-warning-option", "-Wunnamed-type-template-args", "-Wunused-exception-parameter", "-Wunused-member-function", "-Wused-but-marked-unused", "-Wvariadic-macros", "-Wno-c++11-extensions"])
-# To enable:
-# "-Wnonfragile-abi2" -> deprecated, is now -Warc-abi i think
-# "-Wheader-hygiene"
-# "-Wnon-gcc",
-# "-Wweak-vtables",
-# "-Wlarge-by-value-copy",
+ env.Append(CXXFLAGS = [
+ "-Weverything",
+ "-Wno-sign-conversion", # We have this a lot. Not sure if we should allow this or not.
+ "-Wno-weak-vtables", # Virtually none of our elements have outlined methods
+ "-Wno-shadow", # Also warns for shadowing on constructor arguments, which we do a lot
+ "-Wno-exit-time-destructors", # Used a lot in e.g. CPPUnit
+ "-Wno-c++98-compat-pedantic", # We do different things that violate this, but they could be fixed
+ "-Wno-global-constructors",
+ "-Wno-padded",
+ ])
if env.get("coverage", 0) :
assert(env["PLATFORM"] != "win32")
diff --git a/Sluift/Lua/Value.cpp b/Sluift/Lua/Value.cpp
index 3164ec6..817cbf3 100644
--- a/Sluift/Lua/Value.cpp
+++ b/Sluift/Lua/Value.cpp
@@ -8,6 +8,7 @@
#include <lualib.h>
#include <boost/variant/apply_visitor.hpp>
+#include <boost/numeric/conversion/cast.hpp>
#include <Swiften/Base/foreach.h>
using namespace Swift;
@@ -35,15 +36,15 @@ namespace {
}
void operator()(const std::vector<Value>& values) const {
- lua_createtable(state, values.size(), 0);
+ lua_createtable(state, boost::numeric_cast<int>(values.size()), 0);
for(size_t i = 0; i < values.size(); ++i) {
boost::apply_visitor(PushVisitor(state), values[i]);
- lua_rawseti(state, -2, i + 1);
+ lua_rawseti(state, -2, boost::numeric_cast<int>(i + 1));
}
}
void operator()(const std::map<std::string, boost::shared_ptr<Value> >& table) const {
- lua_createtable(state, 0, table.size());
+ lua_createtable(state, 0, boost::numeric_cast<int>(table.size()));
for(std::map<std::string, boost::shared_ptr<Value> >::const_iterator i = table.begin(); i != table.end(); ++i) {
boost::apply_visitor(PushVisitor(state), *i->second);
lua_setfield(state, -2, i->first.c_str());
diff --git a/Sluift/sluift.cpp b/Sluift/sluift.cpp
index 8076f5a..d799d16 100644
--- a/Sluift/sluift.cpp
+++ b/Sluift/sluift.cpp
@@ -11,6 +11,7 @@
#include <string>
#include <deque>
#include <boost/assign/list_of.hpp>
+#include <boost/numeric/conversion/cast.hpp>
#include <Swiften/Base/foreach.h>
#include <Swiften/Swiften.h>
@@ -317,7 +318,7 @@ static int sluift_client_get_version(lua_State *L) {
SluiftClient* client = getClient(L);
int timeout = -1;
if (lua_type(L, 3) != LUA_TNONE) {
- timeout = luaL_checknumber(L, 3);
+ timeout = boost::numeric_cast<int>(luaL_checknumber(L, 3));
}
ResponseSink<SoftwareVersion> sink;
@@ -398,13 +399,13 @@ static int sluift_client_get(lua_State *L) {
jid = JID(std::string(luaL_checkstring(L, 2)));
data = std::string(luaL_checkstring(L, 3));
if (lua_type(L, 4) != LUA_TNONE) {
- timeout = luaL_checknumber(L, 4);
+ timeout = boost::numeric_cast<int>(luaL_checknumber(L, 4));
}
}
else {
data = std::string(luaL_checkstring(L, 2));
if (lua_type(L, 3) != LUA_TNONE) {
- timeout = luaL_checknumber(L, 3);
+ timeout = boost::numeric_cast<int>(luaL_checknumber(L, 3));
}
}
boost::optional<std::string> result = client->sendQuery(jid, IQ::Get, data, timeout);
@@ -431,13 +432,13 @@ static int sluift_client_set(lua_State *L) {
jid = JID(std::string(luaL_checkstring(L, 2)));
data = std::string(luaL_checkstring(L, 3));
if (lua_type(L, 4) != LUA_TNONE) {
- timeout = luaL_checknumber(L, 4);
+ timeout = boost::numeric_cast<int>(luaL_checknumber(L, 4));
}
}
else {
data = std::string(luaL_checkstring(L, 2));
if (lua_type(L, 3) != LUA_TNONE) {
- timeout = luaL_checknumber(L, 3);
+ timeout = boost::numeric_cast<int>(luaL_checknumber(L, 3));
}
}
boost::optional<std::string> result = client->sendQuery(jid, IQ::Set, data, timeout);
@@ -515,7 +516,7 @@ static int sluift_client_for_event(lua_State *L) {
luaL_checktype(L, 2, LUA_TFUNCTION);
int timeout = -1;
if (lua_type(L, 3) != LUA_TNONE) {
- timeout = lua_tonumber(L, 3);
+ timeout = boost::numeric_cast<int>(lua_tonumber(L, 3));
}
while (true) {
@@ -551,7 +552,7 @@ static int sluift_client_get_next_event(lua_State *L) {
SluiftClient* client = getClient(L);
int timeout = -1;
if (lua_type(L, 2) != LUA_TNONE) {
- timeout = lua_tonumber(L, 2);
+ timeout = boost::numeric_cast<int>(lua_tonumber(L, 2));
}
pushEvent(L, client->getNextEvent(timeout));
return 1;
@@ -582,7 +583,7 @@ static int sluift_client_add_contact(lua_State* L) {
if (!lua_isnil(L, -1)) {
if (lua_type(L, -1) == LUA_TTABLE) {
for (size_t i = 1; i <= lua_objlen(L, -1); ++i) {
- lua_rawgeti(L, -1, i);
+ lua_rawgeti(L, -1, boost::numeric_cast<int>(i));
const char* rawGroup = lua_tostring(L, -1);
if (rawGroup) {
item.addGroup(rawGroup);
@@ -754,7 +755,7 @@ static int sluift_sleep(lua_State *L) {
try {
eventLoop.runOnce();
- int timeout = luaL_checknumber(L, 1);
+ int timeout = boost::numeric_cast<int>(luaL_checknumber(L, 1));
Watchdog watchdog(timeout, networkFactories.getTimerFactory());
while (!watchdog.getTimedOut()) {
Swift::sleep(std::min(100, timeout));
@@ -789,7 +790,7 @@ static int sluift_newindex(lua_State *L) {
return 0;
}
else if (key == "timeout") {
- globalTimeout = luaL_checknumber(L, 3);
+ globalTimeout = boost::numeric_cast<int>(luaL_checknumber(L, 3));
return 0;
}
else {
diff --git a/SwifTools/Idle/IdleQuerierTest/IdleQuerierTest.cpp b/SwifTools/Idle/IdleQuerierTest/IdleQuerierTest.cpp
index df233a2..41238a0 100644
--- a/SwifTools/Idle/IdleQuerierTest/IdleQuerierTest.cpp
+++ b/SwifTools/Idle/IdleQuerierTest/IdleQuerierTest.cpp
@@ -5,6 +5,7 @@
*/
#include <iostream>
+#include <cassert>
#include <SwifTools/Idle/PlatformIdleQuerier.h>
#include <Swiften/Base/sleep.h>
@@ -17,6 +18,6 @@ int main() {
std::cout << "Idle time: " << querier.getIdleTimeSeconds() << std::endl;
Swift::sleep(1000);
}
-
+ assert(false);
return 0;
}
diff --git a/SwifTools/Idle/MacOSXIdleQuerier.cpp b/SwifTools/Idle/MacOSXIdleQuerier.cpp
index 233d7c6..8eaece6 100644
--- a/SwifTools/Idle/MacOSXIdleQuerier.cpp
+++ b/SwifTools/Idle/MacOSXIdleQuerier.cpp
@@ -10,6 +10,7 @@
#include <cassert>
#include <iostream>
+#include <boost/numeric/conversion/cast.hpp>
#include <CoreFoundation/CoreFoundation.h>
namespace Swift {
@@ -28,7 +29,7 @@ int MacOSXIdleQuerier::getIdleTimeSeconds() {
assert(result);
(void) result;
CFRelease(property);
- return idle / 1000000000;
+ return boost::numeric_cast<int>(idle / 1000000000);
}
}
diff --git a/SwifTools/URIHandler/UnitTest/XMPPURITest.cpp b/SwifTools/URIHandler/UnitTest/XMPPURITest.cpp
index 8d03b60..35020da 100644
--- a/SwifTools/URIHandler/UnitTest/XMPPURITest.cpp
+++ b/SwifTools/URIHandler/UnitTest/XMPPURITest.cpp
@@ -65,9 +65,9 @@ class XMPPURITest : public CppUnit::TestFixture {
}
void testFromString_AuthorityWithIntlChars() {
- XMPPURI testling = XMPPURI::fromString("xmpp://nasty!%23$%25()*+,-.;=\%3F\%5B\%5C\%5D\%5E_\%60\%7B\%7C\%7D~node@example.com");
+ XMPPURI testling = XMPPURI::fromString("xmpp://nasty!%23$%25()*+,-.;=%3F%5B%5C%5D%5E_%60%7B%7C%7D~node@example.com");
- CPPUNIT_ASSERT_EQUAL(JID("nasty!#$\%()*+,-.;=?[\\]^_`{|}~node@example.com"), testling.getAuthority());
+ CPPUNIT_ASSERT_EQUAL(JID("nasty!#$%()*+,-.;=?[\\]^_`{|}~node@example.com"), testling.getAuthority());
}
void testFromString_AuthorityWithQueryWithoutParameters() {
@@ -118,9 +118,9 @@ class XMPPURITest : public CppUnit::TestFixture {
}
void testFromString_PathWithIntlChars() {
- XMPPURI testling = XMPPURI::fromString("xmpp:nasty!%23$%25()*+,-.;=\%3F\%5B\%5C\%5D\%5E_\%60\%7B\%7C\%7D~node@example.com");
+ XMPPURI testling = XMPPURI::fromString("xmpp:nasty!%23$%25()*+,-.;=%3F%5B%5C%5D%5E_%60%7B%7C%7D~node@example.com");
- CPPUNIT_ASSERT_EQUAL(JID("nasty!#$\%()*+,-.;=?[\\]^_`{|}~node@example.com"), testling.getPath());
+ CPPUNIT_ASSERT_EQUAL(JID("nasty!#$%()*+,-.;=?[\\]^_`{|}~node@example.com"), testling.getPath());
}
void testFromString_PathWithInvalidEscapedChar() {
diff --git a/Swift/Controllers/Chat/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp
index 50709f7..d380cd5 100644
--- a/Swift/Controllers/Chat/ChatControllerBase.cpp
+++ b/Swift/Controllers/Chat/ChatControllerBase.cpp
@@ -13,6 +13,7 @@
#include <boost/shared_ptr.hpp>
#include <boost/smart_ptr/make_shared.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/numeric/conversion/cast.hpp>
#include <boost/algorithm/string.hpp>
#include <Swift/Controllers/Intl.h>
@@ -62,7 +63,7 @@ void ChatControllerBase::createDayChangeTimer() {
boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
boost::posix_time::ptime midnight(now.date() + boost::gregorian::days(1));
long millisecondsUntilMidnight = (midnight - now).total_milliseconds();
- dateChangeTimer_ = boost::shared_ptr<Timer>(timerFactory_->createTimer(millisecondsUntilMidnight));
+ dateChangeTimer_ = boost::shared_ptr<Timer>(timerFactory_->createTimer(boost::numeric_cast<int>(millisecondsUntilMidnight)));
dateChangeTimer_->onTick.connect(boost::bind(&ChatControllerBase::handleDayChangeTick, this));
dateChangeTimer_->start();
}
@@ -112,7 +113,7 @@ void ChatControllerBase::handleAllMessagesRead() {
}
int ChatControllerBase::getUnreadCount() {
- return targetedUnreadMessages_.size();
+ return boost::numeric_cast<int>(targetedUnreadMessages_.size());
}
void ChatControllerBase::handleSendMessageRequest(const std::string &body, bool isCorrectionMessage) {
@@ -260,7 +261,7 @@ void ChatControllerBase::handleIncomingMessage(boost::shared_ptr<MessageEvent> m
logMessage(body, from, selfJID_, timeStamp, true);
}
chatWindow_->show();
- chatWindow_->setUnreadMessageCount(unreadMessages_.size());
+ chatWindow_->setUnreadMessageCount(boost::numeric_cast<int>(unreadMessages_.size()));
onUnreadCountChanged();
postHandleIncomingMessage(messageEvent);
}
@@ -296,13 +297,14 @@ std::string ChatControllerBase::getErrorMessage(boost::shared_ptr<ErrorPayload>
case ErrorPayload::UnexpectedRequest: return QT_TRANSLATE_NOOP("", "Unexpected request");
}
}
+ assert(false);
return defaultMessage;
}
void ChatControllerBase::handleGeneralMUCInvitation(MUCInviteEvent::ref event) {
unreadMessages_.push_back(event);
chatWindow_->show();
- chatWindow_->setUnreadMessageCount(unreadMessages_.size());
+ chatWindow_->setUnreadMessageCount(boost::numeric_cast<int>(unreadMessages_.size()));
onUnreadCountChanged();
chatWindow_->addMUCInvitation(senderDisplayNameFromMessage(event->getInviter()), event->getRoomJID(), event->getReason(), event->getPassword(), event->getDirect());
eventController_->handleIncomingEvent(event);
diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp
index 50eee68..d966d3f 100644
--- a/Swift/Controllers/Chat/MUCController.cpp
+++ b/Swift/Controllers/Chat/MUCController.cpp
@@ -228,6 +228,9 @@ void MUCController::receivedActivity() {
}
}
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wswitch-enum"
+
void MUCController::handleJoinFailed(boost::shared_ptr<ErrorPayload> error) {
receivedActivity();
std::string errorMessage = QT_TRANSLATE_NOOP("", "Unable to enter this room");
@@ -275,6 +278,8 @@ void MUCController::handleJoinFailed(boost::shared_ptr<ErrorPayload> error) {
}
}
+#pragma clang diagnostic pop
+
void MUCController::handleJoinComplete(const std::string& nick) {
receivedActivity();
joined_ = true;
@@ -386,6 +391,7 @@ std::string MUCController::roleToFriendlyName(MUCOccupant::Role role) {
case MUCOccupant::Visitor: return QT_TRANSLATE_NOOP("", "visitor");
case MUCOccupant::NoRole: return "";
}
+ assert(false);
return "";
}
@@ -396,6 +402,7 @@ std::string MUCController::roleToSortName(MUCOccupant::Role role) {
case MUCOccupant::Visitor: return "3";
case MUCOccupant::NoRole: return "4";
}
+ assert(false);
return "5";
}
@@ -487,7 +494,6 @@ std::string MUCController::roleToGroupName(MUCOccupant::Role role) {
case MUCOccupant::Participant: result = QT_TRANSLATE_NOOP("", "Participants"); break;
case MUCOccupant::Visitor: result = QT_TRANSLATE_NOOP("", "Visitors"); break;
case MUCOccupant::NoRole: result = QT_TRANSLATE_NOOP("", "Occupants"); break;
- default: assert(false);
}
return result;
}
@@ -611,7 +617,8 @@ void MUCController::appendToJoinParts(std::vector<NickJoinPart>& joinParts, cons
switch (newEvent.type) {
case Join: type = (type == Part) ? PartThenJoin : Join; break;
case Part: type = (type == Join) ? JoinThenPart : Part; break;
- default: /*Nothing to see here */;break;
+ case PartThenJoin: break;
+ case JoinThenPart: break;
}
(*it).type = type;
break;
diff --git a/Swift/Controllers/FileTransfer/FileTransferController.cpp b/Swift/Controllers/FileTransfer/FileTransferController.cpp
index 3feaf49..d4a082a 100644
--- a/Swift/Controllers/FileTransfer/FileTransferController.cpp
+++ b/Swift/Controllers/FileTransfer/FileTransferController.cpp
@@ -138,7 +138,7 @@ void FileTransferController::handleFileTransferStateChange(FileTransfer::State s
case FileTransfer::State::WaitingForStart:
return;
}
- std::cerr << "Unhandled FileTransfer::State!" << std::endl;
+ assert(false);
}
void FileTransferController::handleProgressPercentageChange(int percentage) {
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index 28d890d..c5bfcb8 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -297,7 +297,7 @@ void MainController::handleConnected() {
myStatusLooksOnline_ = true;
if (freshLogin) {
profileController_ = new ProfileController(client_->getVCardManager(), uiFactory_, uiEventStream_);
- srand(time(NULL));
+ srand(static_cast<unsigned int>(time(NULL)));
int randomPort = 10000 + rand() % 10000;
client_->getFileTransferManager()->startListeningOnPort(randomPort);
ftOverview_ = new FileTransferOverview(client_->getFileTransferManager());
diff --git a/Swift/Controllers/Roster/ContactRosterItem.cpp b/Swift/Controllers/Roster/ContactRosterItem.cpp
index 8c388bf..5b1b6e0 100644
--- a/Swift/Controllers/Roster/ContactRosterItem.cpp
+++ b/Swift/Controllers/Roster/ContactRosterItem.cpp
@@ -24,12 +24,12 @@ StatusShow::Type ContactRosterItem::getStatusShow() const {
StatusShow::Type ContactRosterItem::getSimplifiedStatusShow() const {
switch (shownPresence_ ? shownPresence_->getShow() : StatusShow::None) {
- case StatusShow::Online: return StatusShow::Online; break;
- case StatusShow::Away: return StatusShow::Away; break;
- case StatusShow::XA: return StatusShow::Away; break;
- case StatusShow::FFC: return StatusShow::Online; break;
- case StatusShow::DND: return StatusShow::DND; break;
- case StatusShow::None: return StatusShow::None; break;
+ case StatusShow::Online: return StatusShow::Online;
+ case StatusShow::Away: return StatusShow::Away;
+ case StatusShow::XA: return StatusShow::Away;
+ case StatusShow::FFC: return StatusShow::Online;
+ case StatusShow::DND: return StatusShow::DND;
+ case StatusShow::None: return StatusShow::None;
}
assert(false);
return StatusShow::None;
diff --git a/Swift/Controllers/Roster/Roster.cpp b/Swift/Controllers/Roster/Roster.cpp
index 65cf4d2..b5c5998 100644
--- a/Swift/Controllers/Roster/Roster.cpp
+++ b/Swift/Controllers/Roster/Roster.cpp
@@ -198,13 +198,13 @@ void Roster::removeFilter(RosterFilter *filter) {
}
void Roster::filterContact(ContactRosterItem* contact, GroupRosterItem* group) {
- int oldDisplayedSize = group->getDisplayedChildren().size();
+ size_t oldDisplayedSize = group->getDisplayedChildren().size();
bool hide = true;
foreach (RosterFilter *filter, filters_) {
hide &= (*filter)(contact);
}
group->setDisplayed(contact, filters_.empty() || !hide);
- int newDisplayedSize = group->getDisplayedChildren().size();
+ size_t newDisplayedSize = group->getDisplayedChildren().size();
if (oldDisplayedSize == 0 && newDisplayedSize > 0) {
onGroupAdded(group);
}
diff --git a/Swift/Controllers/Roster/UnitTest/TableRosterTest.cpp b/Swift/Controllers/Roster/UnitTest/TableRosterTest.cpp
index e433b50..db8a2fd 100644
--- a/Swift/Controllers/Roster/UnitTest/TableRosterTest.cpp
+++ b/Swift/Controllers/Roster/UnitTest/TableRosterTest.cpp
@@ -6,6 +6,8 @@
#include <Swift/Controllers/Roster/TableRoster.h>
+std::ostream& operator<<(std::ostream& os, const Swift::TableRoster::Index& i);
+
std::ostream& operator<<(std::ostream& os, const Swift::TableRoster::Index& i) {
os << "(" << i.section << ", " << i.row << ")";
return os;
diff --git a/Swift/Controllers/StatusUtil.cpp b/Swift/Controllers/StatusUtil.cpp
index fd1fea3..a72f340 100644
--- a/Swift/Controllers/StatusUtil.cpp
+++ b/Swift/Controllers/StatusUtil.cpp
@@ -6,6 +6,7 @@
#include <Swift/Controllers/StatusUtil.h>
+#include <cassert>
#include <Swift/Controllers/Intl.h>
namespace Swift {
@@ -19,6 +20,7 @@ std::string statusShowTypeToFriendlyName(StatusShow::Type type) {
case StatusShow::DND: return QT_TRANSLATE_NOOP("", "Busy");
case StatusShow::None: return QT_TRANSLATE_NOOP("", "Offline");
}
+ assert(false);
return "";
}
diff --git a/Swift/Controllers/UnitTest/MockMainWindow.h b/Swift/Controllers/UnitTest/MockMainWindow.h
index be1a932..19ab522 100644
--- a/Swift/Controllers/UnitTest/MockMainWindow.h
+++ b/Swift/Controllers/UnitTest/MockMainWindow.h
@@ -12,16 +12,16 @@ namespace Swift {
class Roster;
class MockMainWindow : public MainWindow {
public:
- MockMainWindow() : roster(NULL) {};
- virtual ~MockMainWindow() {};
- virtual void setRosterModel(Roster* roster) {this->roster = roster;};
- virtual void setMyNick(const std::string& /*name*/) {};;
- virtual void setMyJID(const JID& /*jid*/) {};;
- virtual void setMyAvatarPath(const std::string& /*path*/) {};
- virtual void setMyStatusText(const std::string& /*status*/) {};
- virtual void setMyStatusType(StatusShow::Type /*type*/) {};
- virtual void setAvailableAdHocCommands(const std::vector<DiscoItems::Item>& /*commands*/) {};
- virtual void setConnecting() {};
+ MockMainWindow() : roster(NULL) {}
+ virtual ~MockMainWindow() {}
+ virtual void setRosterModel(Roster* roster) {this->roster = roster;}
+ virtual void setMyNick(const std::string& /*name*/) {}
+ virtual void setMyJID(const JID& /*jid*/) {}
+ virtual void setMyAvatarPath(const std::string& /*path*/) {}
+ virtual void setMyStatusText(const std::string& /*status*/) {}
+ virtual void setMyStatusType(StatusShow::Type /*type*/) {}
+ virtual void setAvailableAdHocCommands(const std::vector<DiscoItems::Item>& /*commands*/) {}
+ virtual void setConnecting() {}
virtual void setStreamEncryptionStatus(bool /*tlsInPlaceAndValid*/) {}
virtual void openCertificateDialog(const std::vector<Certificate::ref>& /*chain*/) {}
Roster* roster;
diff --git a/Swift/Controllers/XMPPEvents/EventController.cpp b/Swift/Controllers/XMPPEvents/EventController.cpp
index d84dfe3..8cb259b 100644
--- a/Swift/Controllers/XMPPEvents/EventController.cpp
+++ b/Swift/Controllers/XMPPEvents/EventController.cpp
@@ -7,6 +7,7 @@
#include <Swift/Controllers/XMPPEvents/EventController.h>
#include <boost/bind.hpp>
+#include <boost/numeric/conversion/cast.hpp>
#include <algorithm>
#include <Swiften/Base/foreach.h>
@@ -48,7 +49,7 @@ void EventController::handleIncomingEvent(boost::shared_ptr<StanzaEvent> sourceE
if ((messageEvent && messageEvent->isReadable()) || subscriptionEvent || errorEvent || mucInviteEvent) {
events_.push_back(sourceEvent);
sourceEvent->onConclusion.connect(boost::bind(&EventController::handleEventConcluded, this, sourceEvent));
- onEventQueueLengthChange(events_.size());
+ onEventQueueLengthChange(boost::numeric_cast<int>(events_.size()));
onEventQueueEventAdded(sourceEvent);
if (sourceEvent->getConcluded()) {
handleEventConcluded(sourceEvent);
@@ -59,7 +60,7 @@ void EventController::handleIncomingEvent(boost::shared_ptr<StanzaEvent> sourceE
void EventController::handleEventConcluded(boost::shared_ptr<StanzaEvent> event) {
event->onConclusion.disconnect(boost::bind(&EventController::handleEventConcluded, this, event));
events_.erase(std::remove(events_.begin(), events_.end(), event), events_.end());
- onEventQueueLengthChange(events_.size());
+ onEventQueueLengthChange(boost::numeric_cast<int>(events_.size()));
}
void EventController::disconnectAll() {
diff --git a/Swift/QtUI/EventViewer/EventDelegate.cpp b/Swift/QtUI/EventViewer/EventDelegate.cpp
index 9ecdd34..fdb1866 100644
--- a/Swift/QtUI/EventViewer/EventDelegate.cpp
+++ b/Swift/QtUI/EventViewer/EventDelegate.cpp
@@ -29,7 +29,6 @@ QSize EventDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIn
case SubscriptionEventType: return subscriptionDelegate_.sizeHint(option, item);
case ErrorEventType: return errorDelegate_.sizeHint(option, item);
case MUCInviteEventType: return mucInviteDelegate_.sizeHint(option, item);
- default: return QStyledItemDelegate::sizeHint(option, index);
}
}
@@ -44,7 +43,6 @@ void EventDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option,
case SubscriptionEventType: subscriptionDelegate_.paint(painter, option, item);break;
case ErrorEventType: errorDelegate_.paint(painter, option, item);break;
case MUCInviteEventType: mucInviteDelegate_.paint(painter, option, item);break;
- default: QStyledItemDelegate::paint(painter, option, index);
}
}
diff --git a/Swift/QtUI/QtAffiliationEditor.cpp b/Swift/QtUI/QtAffiliationEditor.cpp
index ed03c23..0896b92 100644
--- a/Swift/QtUI/QtAffiliationEditor.cpp
+++ b/Swift/QtUI/QtAffiliationEditor.cpp
@@ -76,4 +76,4 @@ MUCOccupant::Affiliation QtAffiliationEditor::affiliationFromIndex(int affiliati
}
}
-} \ No newline at end of file
+}
diff --git a/Swift/QtUI/QtAffiliationEditor.h b/Swift/QtUI/QtAffiliationEditor.h
index 913b2cc..96536eb 100644
--- a/Swift/QtUI/QtAffiliationEditor.h
+++ b/Swift/QtUI/QtAffiliationEditor.h
@@ -34,4 +34,4 @@ namespace Swift {
std::map<MUCOccupant::Affiliation, std::vector<JID> > affiliations_;
std::vector<ChangePair> changes_;
};
-} \ No newline at end of file
+}
diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp
index d3a5676..7d8f16e 100644
--- a/Swift/QtUI/QtChatTabs.cpp
+++ b/Swift/QtUI/QtChatTabs.cpp
@@ -237,7 +237,7 @@ void QtChatTabs::handleTabTitleUpdated(QWidget* widget) {
switch (tabbable->getWidgetAlertState()) {
case QtTabbable::WaitingActivity : tabTextColor = QColor(217, 20, 43); break;
case QtTabbable::ImpendingActivity : tabTextColor = QColor(27, 171, 32); break;
- default : tabTextColor = QColor();
+ case QtTabbable::NoActivity : tabTextColor = QColor(); break;
}
tabs_->tabBar()->setTabTextColor(index, tabTextColor);
diff --git a/Swift/QtUI/QtChatView.cpp b/Swift/QtUI/QtChatView.cpp
index 81820a3..967ebec 100644
--- a/Swift/QtUI/QtChatView.cpp
+++ b/Swift/QtUI/QtChatView.cpp
@@ -365,7 +365,7 @@ void QtChatView::resetView() {
connect(webPage_->mainFrame(), SIGNAL(contentsSizeChanged(const QSize&)), this, SLOT(handleFrameSizeChanged()), Qt::UniqueConnection);
}
-QWebElement findElementWithID(QWebElement document, QString elementName, QString id) {
+static QWebElement findElementWithID(QWebElement document, QString elementName, QString id) {
QWebElementCollection elements = document.findAll(elementName);
foreach(QWebElement element, elements) {
if (element.attribute("id") == id) {
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp
index 28549f8..5d57184 100644
--- a/Swift/QtUI/QtChatWindow.cpp
+++ b/Swift/QtUI/QtChatWindow.cpp
@@ -576,6 +576,7 @@ std::string QtChatWindow::addAction(const std::string &message, const std::strin
return addMessage(" *" + linkimoticonify(P2QSTRING(message)) + "*", senderName, senderIsSelf, label, avatarPath, "font-style:italic ", time);
}
+// FIXME: Move this to a different file
std::string formatSize(const boost::uintmax_t bytes) {
static const char *siPrefix[] = {"k", "M", "G", "T", "P", "E", "Z", "Y", NULL};
int power = 0;
@@ -587,11 +588,11 @@ std::string formatSize(const boost::uintmax_t bytes) {
return str( boost::format("%.1lf %sB") % engBytes % (power > 0 ? siPrefix[power-1] : "") );
}
-QString encodeButtonArgument(const QString& str) {
+static QString encodeButtonArgument(const QString& str) {
return Qt::escape(P2QSTRING(Base64::encode(createByteArray(Q2PSTRING(str)))));
}
-QString decodeButtonArgument(const QString& str) {
+static QString decodeButtonArgument(const QString& str) {
return P2QSTRING(byteArrayToString(Base64::decode(Q2PSTRING(str))));
}
diff --git a/Swift/QtUI/QtChatWindow.h b/Swift/QtUI/QtChatWindow.h
index 3416b42..c32ae83 100644
--- a/Swift/QtUI/QtChatWindow.h
+++ b/Swift/QtUI/QtChatWindow.h
@@ -37,6 +37,9 @@ namespace Swift {
class QtChatWindowJSBridge;
class SettingsProvider;
+ // FIXME: Move this to a different file
+ std::string formatSize(const boost::uintmax_t bytes);
+
class LabelModel : public QAbstractListModel {
Q_OBJECT
public:
diff --git a/Swift/QtUI/QtFileTransferListItemModel.cpp b/Swift/QtUI/QtFileTransferListItemModel.cpp
index cf1de07..71961c2 100644
--- a/Swift/QtUI/QtFileTransferListItemModel.cpp
+++ b/Swift/QtUI/QtFileTransferListItemModel.cpp
@@ -9,14 +9,14 @@
#include <boost/bind.hpp>
#include <boost/cstdint.hpp>
+#include "QtChatWindow.h" // for formatSize
+
#include <Swiften/Base/boost_bsignals.h>
#include <Swift/Controllers/FileTransfer/FileTransferController.h>
#include <Swift/Controllers/FileTransfer/FileTransferOverview.h>
namespace Swift {
-extern std::string formatSize(const boost::uintmax_t bytes);
-
QtFileTransferListItemModel::QtFileTransferListItemModel(QObject *parent) : QAbstractItemModel(parent), fileTransferOverview(0) {
}
diff --git a/Swift/QtUI/QtHistoryWindow.cpp b/Swift/QtUI/QtHistoryWindow.cpp
index e54bd51..875235d 100644
--- a/Swift/QtUI/QtHistoryWindow.cpp
+++ b/Swift/QtUI/QtHistoryWindow.cpp
@@ -23,6 +23,7 @@
#include <QLineEdit>
#include <boost/smart_ptr/make_shared.hpp>
+#include <boost/numeric/conversion/cast.hpp>
#include <boost/date_time/gregorian/gregorian.hpp>
namespace Swift {
@@ -183,7 +184,7 @@ void QtHistoryWindow::handleScrollReachedTop() {
int year, month, day;
QDate firstDate = *dates_.begin();
firstDate.getDate(&year, &month, &day);
- onScrollReachedTop(boost::gregorian::date(year, month, day));
+ onScrollReachedTop(boost::gregorian::date(boost::numeric_cast<unsigned short>(year), boost::numeric_cast<unsigned short>(month), boost::numeric_cast<unsigned short>(day)));
}
void QtHistoryWindow::handleScrollReachedBottom() {
@@ -194,7 +195,7 @@ void QtHistoryWindow::handleScrollReachedBottom() {
int year, month, day;
QDate lastDate = *dates_.rbegin();
lastDate.getDate(&year, &month, &day);
- onScrollReachedBottom(boost::gregorian::date(year, month, day));
+ onScrollReachedBottom(boost::gregorian::date(boost::numeric_cast<unsigned short>(year), boost::numeric_cast<unsigned short>(month), boost::numeric_cast<unsigned short>(day)));
}
void QtHistoryWindow::handleReturnPressed() {
@@ -205,7 +206,7 @@ void QtHistoryWindow::handleCalendarClicked(const QDate& date) {
int year, month, day;
QDate tempDate = date; // getDate discards const qualifier
tempDate.getDate(&year, &month, &day);
- onCalendarClicked(boost::gregorian::date(year, month, day));
+ onCalendarClicked(boost::gregorian::date(boost::numeric_cast<unsigned short>(year), boost::numeric_cast<unsigned short>(month), boost::numeric_cast<unsigned short>(day)));
}
void QtHistoryWindow::setDate(const boost::gregorian::date& date) {
@@ -242,7 +243,7 @@ boost::gregorian::date QtHistoryWindow::getLastVisibleDate() {
int year, month, day;
lastDate.getDate(&year, &month, &day);
- return boost::gregorian::date(year, month, day);
+ return boost::gregorian::date(boost::numeric_cast<unsigned short>(year), boost::numeric_cast<unsigned short>(month), boost::numeric_cast<unsigned short>(day));
}
return boost::gregorian::date(boost::gregorian::not_a_date_time);
}
diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp
index 96e08a3..4d10956 100644
--- a/Swift/QtUI/QtSwift.cpp
+++ b/Swift/QtUI/QtSwift.cpp
@@ -67,9 +67,9 @@
namespace Swift{
#if defined(SWIFTEN_PLATFORM_MACOSX)
-#define SWIFT_APPCAST_URL "http://swift.im/appcast/swift-mac-dev.xml"
+//#define SWIFT_APPCAST_URL "http://swift.im/appcast/swift-mac-dev.xml"
#else
-#define SWIFT_APPCAST_URL ""
+//#define SWIFT_APPCAST_URL ""
#endif
po::options_description QtSwift::getOptionsDescription() {
diff --git a/Swift/QtUI/QtWebView.cpp b/Swift/QtUI/QtWebView.cpp
index 388f06a..1222ee2 100644
--- a/Swift/QtUI/QtWebView.cpp
+++ b/Swift/QtUI/QtWebView.cpp
@@ -9,6 +9,7 @@
#include <QKeyEvent>
#include <QFocusEvent>
+#include <boost/numeric/conversion/cast.hpp>
#include <QMenu>
namespace Swift {
@@ -30,7 +31,7 @@ void QtWebView::keyPressEvent(QKeyEvent* event) {
modifiers,
event->text(),
event->isAutoRepeat(),
- event->count());
+ boost::numeric_cast<unsigned short>(event->count()));
QWebView::keyPressEvent(translatedEvent);
delete translatedEvent;
}
diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript
index 54304d4..df7cc87 100644
--- a/Swift/QtUI/SConscript
+++ b/Swift/QtUI/SConscript
@@ -20,7 +20,12 @@ def generateDefaultTheme(dir) :
Import("env")
myenv = env.Clone()
+
+# Disable warnings that affect Qt
myenv["CXXFLAGS"] = filter(lambda x : x != "-Wfloat-equal", myenv["CXXFLAGS"])
+if "clang" in env["CC"] :
+ myenv.Append(CXXFLAGS = ["-Wno-float-equal", "-Wno-shorten-64-to-32", "-Wno-missing-prototypes", "-Wno-unreachable-code", "-Wno-disabled-macro-expansion"])
+
myenv.UseFlags(env["SWIFT_CONTROLLERS_FLAGS"])
myenv.UseFlags(env["SWIFTOOLS_FLAGS"])
if myenv["HAVE_XSS"] :
diff --git a/Swift/QtUI/Whiteboard/ColorWidget.h b/Swift/QtUI/Whiteboard/ColorWidget.h
index 6abdf00..ae1af0f 100644
--- a/Swift/QtUI/Whiteboard/ColorWidget.h
+++ b/Swift/QtUI/Whiteboard/ColorWidget.h
@@ -10,7 +10,7 @@
namespace Swift {
class ColorWidget : public QWidget {
- Q_OBJECT;
+ Q_OBJECT
public:
ColorWidget(QWidget* parent = 0);
QSize sizeHint() const;
diff --git a/Swift/QtUI/Whiteboard/FreehandLineItem.h b/Swift/QtUI/Whiteboard/FreehandLineItem.h
index f3c6607..b1af3d1 100644
--- a/Swift/QtUI/Whiteboard/FreehandLineItem.h
+++ b/Swift/QtUI/Whiteboard/FreehandLineItem.h
@@ -10,8 +10,6 @@
#include <QPainter>
#include <iostream>
-using namespace std;
-
namespace Swift {
class FreehandLineItem : public QGraphicsItem {
public:
diff --git a/Swift/QtUI/Whiteboard/GView.h b/Swift/QtUI/Whiteboard/GView.h
index 88ea326..6a4fd2f 100644
--- a/Swift/QtUI/Whiteboard/GView.h
+++ b/Swift/QtUI/Whiteboard/GView.h
@@ -18,7 +18,7 @@
namespace Swift {
class GView : public QGraphicsView {
- Q_OBJECT;
+ Q_OBJECT
public:
enum Mode { Rubber, Line, Rect, Circle, HandLine, Text, Polygon, Select };
enum Type { New, Update, MoveUp, MoveDown };
diff --git a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp
index 50d7f54..414e590 100644
--- a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp
+++ b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp
@@ -10,6 +10,7 @@
#include <boost/bind.hpp>
#include <boost/smart_ptr/make_shared.hpp>
+#include <boost/numeric/conversion/cast.hpp>
#include <Swiften/Whiteboard/WhiteboardSession.h>
#include <Swiften/Elements/WhiteboardPayload.h>
@@ -264,7 +265,9 @@ namespace Swift {
std::vector<std::pair<int, int> > points;
QVector<QPointF>::const_iterator it = freehandLineItem->points().constBegin();
for ( ; it != freehandLineItem->points().constEnd(); ++it) {
- points.push_back(std::pair<int, int>(it->x()+item->pos().x(), it->y()+item->pos().y()));
+ points.push_back(std::pair<int, int>(
+ boost::numeric_cast<int>(it->x()+item->pos().x()),
+ boost::numeric_cast<int>(it->y()+item->pos().y())));
}
element->setColor(WhiteboardColor(color.red(), color.green(), color.blue(), color.alpha()));
@@ -310,7 +313,9 @@ namespace Swift {
std::vector<std::pair<int, int> > points;
QVector<QPointF>::const_iterator it = polygon.begin();
for (; it != polygon.end(); ++it) {
- points.push_back(std::pair<int, int>(it->x()+item->pos().x(), it->y()+item->pos().y()));
+ points.push_back(std::pair<int, int>(
+ boost::numeric_cast<int>(it->x()+item->pos().x()),
+ boost::numeric_cast<int>(it->y()+item->pos().y())));
}
element->setPoints(points);
@@ -328,10 +333,10 @@ namespace Swift {
QGraphicsEllipseItem* ellipseItem = qgraphicsitem_cast<QGraphicsEllipseItem*>(item);
if (ellipseItem) {
QRectF rect = ellipseItem->rect();
- int cx = rect.x()+rect.width()/2 + item->pos().x();
- int cy = rect.y()+rect.height()/2 + item->pos().y();
- int rx = rect.width()/2;
- int ry = rect.height()/2;
+ int cx = boost::numeric_cast<int>(rect.x()+rect.width()/2 + item->pos().x());
+ int cy = boost::numeric_cast<int>(rect.y()+rect.height()/2 + item->pos().y());
+ int rx = boost::numeric_cast<int>(rect.width()/2);
+ int ry = boost::numeric_cast<int>(rect.height()/2);
WhiteboardEllipseElement::ref element = boost::make_shared<WhiteboardEllipseElement>(cx, cy, rx, ry);
QColor penColor = ellipseItem->pen().color();
diff --git a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.h b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.h
index 4665ef0..3957bb7 100644
--- a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.h
+++ b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.h
@@ -30,7 +30,7 @@
namespace Swift {
class QtWhiteboardWindow : public QWidget, public WhiteboardWindow
{
- Q_OBJECT;
+ Q_OBJECT
public:
QtWhiteboardWindow(WhiteboardSession::ref whiteboardSession);
void show();
diff --git a/Swift/QtUI/Whiteboard/TextDialog.h b/Swift/QtUI/Whiteboard/TextDialog.h
index f4d9a13..64a0fe2 100644
--- a/Swift/QtUI/Whiteboard/TextDialog.h
+++ b/Swift/QtUI/Whiteboard/TextDialog.h
@@ -16,12 +16,10 @@
#include <iostream>
-using namespace std;
-
namespace Swift {
class TextDialog : public QDialog
{
- Q_OBJECT;
+ Q_OBJECT
public:
TextDialog(QGraphicsTextItem* item, QWidget* parent = 0);
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;
diff --git a/Swiftob/MUCs.cpp b/Swiftob/MUCs.cpp
index 5bad3a1..aec821a 100644
--- a/Swiftob/MUCs.cpp
+++ b/Swiftob/MUCs.cpp
@@ -17,6 +17,8 @@
#include <Swiftob/Storage.h>
+using namespace Swift;
+
#define MUC_LIST_SETTING "muc_list"
#define NICK "default_nick"
diff --git a/Swiftob/MUCs.h b/Swiftob/MUCs.h
index 8f56182..ecbb7a6 100644
--- a/Swiftob/MUCs.h
+++ b/Swiftob/MUCs.h
@@ -21,27 +21,25 @@ class MUC;
class Storage;
-using namespace Swift;
-
class MUCs {
public:
- MUCs(Client* client, Storage* storage);
- void join(const JID& room, boost::signal<void (const std::string&)>::slot_type successCallback, boost::function<void(const std::string& /*reason*/)> failureCallback);
- void part(const JID& room);
- bool contains(const JID& room);
- MUC::ref getMUC(const JID& room);
+ MUCs(Swift::Client* client, Storage* storage);
+ void join(const Swift::JID& room, boost::signal<void (const std::string&)>::slot_type successCallback, boost::function<void(const std::string& /*reason*/)> failureCallback);
+ void part(const Swift::JID& room);
+ bool contains(const Swift::JID& room);
+ Swift::MUC::ref getMUC(const Swift::JID& room);
const std::string& getDefaultNick() const {return defaultNick_;}
bool setDefaultNick(const std::string& nick);
private:
void handleConnected();
- void handleJoinFailed(const JID& room, ErrorPayload::ref error, boost::function<void(const std::string& /*reason*/)> failureCallback);
+ void handleJoinFailed(const Swift::JID& room, Swift::ErrorPayload::ref error, boost::function<void(const std::string& /*reason*/)> failureCallback);
void handleInitialJoinSuccess();
void handleInitialJoinFailure(const std::string&);
void save();
private:
- MUCRegistry registry_;
- std::map<JID, MUC::ref> mucs_;
- Client* client_;
+ Swift::MUCRegistry registry_;
+ std::map<Swift::JID, Swift::MUC::ref> mucs_;
+ Swift::Client* client_;
Storage* storage_;
std::string defaultNick_;
};
diff --git a/Swiftob/SConscript b/Swiftob/SConscript
index b53057c..4f6464a 100644
--- a/Swiftob/SConscript
+++ b/Swiftob/SConscript
@@ -3,6 +3,8 @@ Import("env")
if env["SCONS_STAGE"] == "build":
myenv = env.Clone()
+ # Too many compile warnings here at the moment
+ myenv.Replace(CXXFLAGS = [flag for flag in env["CXXFLAGS"] if flag != "-Weverything"])
myenv.UseFlags(myenv.get("LUA_FLAGS", {}))
myenv.UseFlags(myenv["SWIFTEN_FLAGS"])
myenv.UseFlags(myenv["SWIFTEN_DEP_FLAGS"])
diff --git a/Swiftob/Users.cpp b/Swiftob/Users.cpp
index 09173cc..868efb0 100644
--- a/Swiftob/Users.cpp
+++ b/Swiftob/Users.cpp
@@ -13,6 +13,8 @@
#include <Swiftob/MUCs.h>
+using namespace Swift;
+
Users::Users(Client* client, MUCs* mucs) {
client_ = client;
mucs_ = mucs;
diff --git a/Swiftob/Users.h b/Swiftob/Users.h
index 0acc330..a78beed 100644
--- a/Swiftob/Users.h
+++ b/Swiftob/Users.h
@@ -18,15 +18,13 @@ class Client;
class MUCs;
-using namespace Swift;
-
class Users {
public:
class User {
public:
/* If you add a role here, edit the role lists in Commands.cpp*/
enum Role {Unknown, Owner};
- User(const JID& jid, Role role) : jid_(jid), role_(role) {}
+ User(const Swift::JID& jid, Role role) : jid_(jid), role_(role) {}
Role getRole() {return role_;}
Swift::JID getJID() {return jid_;}
private:
@@ -35,14 +33,14 @@ class Users {
};
public:
- Users(Client* client, MUCs* mucs);
+ Users(Swift::Client* client, MUCs* mucs);
void clearAll();
void addUser(const User& user);
- User::Role getRoleForSender(Message::ref message);
+ User::Role getRoleForSender(Swift::Message::ref message);
private:
std::vector<User> users_;
- Client* client_;
+ Swift::Client* client_;
MUCs* mucs_;
};