diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-06-09 19:00:55 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-06-09 19:19:59 (GMT) |
commit | 644051bad4ce7b088ea8af07c9b82a5920c96f4b (patch) | |
tree | 5c18f3cee950a7e9a683e6cbb666ec0ea128ee0e | |
parent | b3b77f1d4a85a9a933b1a913a90b57a0e2db42a3 (diff) | |
download | swift-contrib-644051bad4ce7b088ea8af07c9b82a5920c96f4b.zip swift-contrib-644051bad4ce7b088ea8af07c9b82a5920c96f4b.tar.bz2 |
Enabled & fixed some more C++ warnings.
-rw-r--r-- | 3rdParty/Boost/SConscript | 11 | ||||
-rw-r--r-- | BuildTools/SCons/SConstruct | 3 | ||||
-rw-r--r-- | Slimber/Cocoa/CocoaMenulet.mm | 2 | ||||
-rw-r--r-- | SwifTools/Idle/MacOSXIdleQuerier.cpp | 2 | ||||
-rw-r--r-- | Swift/QtUI/ChatList/QtChatListWindowFactory.cpp | 2 | ||||
-rw-r--r-- | Swift/QtUI/EventViewer/QtEventWindowFactory.cpp | 2 | ||||
-rw-r--r-- | Swift/QtUI/QtStatusWidget.cpp | 2 | ||||
-rw-r--r-- | Swift/QtUI/Roster/RosterModel.cpp | 2 | ||||
-rw-r--r-- | Swift/QtUI/SConscript | 2 | ||||
-rw-r--r-- | Swiften/Compress/ZLibCompressor.cpp | 19 | ||||
-rw-r--r-- | Swiften/Compress/ZLibCompressor.h | 11 | ||||
-rw-r--r-- | Swiften/Compress/ZLibDecompressor.cpp | 19 | ||||
-rw-r--r-- | Swiften/Compress/ZLibDecompressor.h | 11 | ||||
-rw-r--r-- | Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveHostnameQuery.h | 2 | ||||
-rw-r--r-- | Swiften/Network/PlatformDomainNameServiceQuery.cpp | 2 | ||||
-rw-r--r-- | Swiften/SConscript | 2 | ||||
-rw-r--r-- | Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp | 2 | ||||
-rw-r--r-- | Swiften/StringCodecs/MD5.cpp | 2 |
18 files changed, 69 insertions, 29 deletions
diff --git a/3rdParty/Boost/SConscript b/3rdParty/Boost/SConscript index 49e66e5..9181425 100644 --- a/3rdParty/Boost/SConscript +++ b/3rdParty/Boost/SConscript @@ -16,6 +16,11 @@ elif env.get("BOOST_BUNDLED", False) : ################################################################################ cppdefines = ["BOOST_ALL_NO_LIB"] + if env["PLATFORM"] == "win32" : + cppflags = ["/I" + Dir("src").abspath] + else : + cppflags = [("-isystem", Dir("src").abspath)] + ################################################################################ # Flags @@ -23,7 +28,7 @@ elif env.get("BOOST_BUNDLED", False) : if env["SCONS_STAGE"] == "flags" : env["BOOST_FLAGS"] = { - "CPPFLAGS": ["-I" + Dir("src").abspath], + "CPPFLAGS": cppflags, "CPPDEFINES": cppdefines, "LIBPATH": [Dir(".")], "LIBS": ["Boost"] @@ -41,7 +46,7 @@ elif env.get("BOOST_BUNDLED", False) : if env["SCONS_STAGE"] == "build" : myenv = env.Clone() - myenv.Replace(CCFLAGS = [flag for flag in env["CCFLAGS"] if flag not in ["-W", "-Wall"]]) + myenv.Replace(CXXFLAGS = [flag for flag in env["CXXFLAGS"] if not flag.startswith("-W")]) sources = [ "src/libs/date_time/src/gregorian/date_generators.cpp", @@ -100,7 +105,7 @@ elif env.get("BOOST_BUNDLED", False) : "src/libs/thread/src/win32/tss_dll.cpp", "src/libs/thread/src/win32/tss_pe.cpp"] - myenv.StaticLibrary("Boost", sources, CPPFLAGS = "-I" + Dir("src").abspath, CPPDEFINES = cppdefines) + myenv.StaticLibrary("Boost", sources, CPPFLAGS = cppflags, CPPDEFINES = cppdefines) if ARGUMENTS.get("BOOST_BUILD_BCP") or env.GetOption("clean") : bcp_env = myenv.Clone() diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct index a8c8529..3a41be4 100644 --- a/BuildTools/SCons/SConstruct +++ b/BuildTools/SCons/SConstruct @@ -110,8 +110,7 @@ if env["warnings"] : if env["PLATFORM"] == "win32" : env.Append(CCFLAGS = ["/Wall"]) else : - env.Append(CXXFLAGS = ["-W", "-Wall", "-Wnon-virtual-dtor"]) - #env.Append(CCFLAGS = ["-W", "-Wall", "-Wredundant-decls", "-pedantic", "-Wno-long-long", "-Woverloaded-virtual", "-Wundef", "-Wfloat-equal", "-Wold-style-cast"]) + env.Append(CXXFLAGS = ["-Wextra", "-Wall", "-Wnon-virtual-dtor", "-Wundef", "-Wold-style-cast", "-Wno-long-long", "-Woverloaded-virtual", "-Wfloat-equal", "-Wredundant-decls"]) gccVersion = env["CCVERSION"].split(".") if gccVersion >= ["4", "5", "0"] : env.Append(CCFLAGS = ["-Wlogical-op"]) diff --git a/Slimber/Cocoa/CocoaMenulet.mm b/Slimber/Cocoa/CocoaMenulet.mm index 72ab000..90e699f 100644 --- a/Slimber/Cocoa/CocoaMenulet.mm +++ b/Slimber/Cocoa/CocoaMenulet.mm @@ -1,5 +1,7 @@ #include "Slimber/Cocoa/CocoaMenulet.h" +#pragma GCC diagnostic ignored "-Wold-style-cast" + #include <boost/function.hpp> using namespace Swift; diff --git a/SwifTools/Idle/MacOSXIdleQuerier.cpp b/SwifTools/Idle/MacOSXIdleQuerier.cpp index 2d0f654..4760285 100644 --- a/SwifTools/Idle/MacOSXIdleQuerier.cpp +++ b/SwifTools/Idle/MacOSXIdleQuerier.cpp @@ -6,6 +6,8 @@ #include "SwifTools/Idle/MacOSXIdleQuerier.h" +#pragma GCC diagnostic ignored "-Wold-style-cast" + #include <cassert> #include <iostream> #include <CoreFoundation/CoreFoundation.h> diff --git a/Swift/QtUI/ChatList/QtChatListWindowFactory.cpp b/Swift/QtUI/ChatList/QtChatListWindowFactory.cpp index 2705058..0e9d324 100644 --- a/Swift/QtUI/ChatList/QtChatListWindowFactory.cpp +++ b/Swift/QtUI/ChatList/QtChatListWindowFactory.cpp @@ -16,7 +16,7 @@ QtChatListWindowFactory::QtChatListWindowFactory(QtMainWindowFactory* mainWindow } ChatListWindow* QtChatListWindowFactory::createWindow(UIEventStream* /*uiEventStream*/) { - return ((QtMainWindow*)mainWindowFactory_->getLastCreatedWindow())->getChatListWindow(); + return static_cast<QtMainWindow*>(mainWindowFactory_->getLastCreatedWindow())->getChatListWindow(); } } diff --git a/Swift/QtUI/EventViewer/QtEventWindowFactory.cpp b/Swift/QtUI/EventViewer/QtEventWindowFactory.cpp index ac8ae06..45f6da0 100644 --- a/Swift/QtUI/EventViewer/QtEventWindowFactory.cpp +++ b/Swift/QtUI/EventViewer/QtEventWindowFactory.cpp @@ -16,7 +16,7 @@ QtEventWindowFactory::QtEventWindowFactory(QtMainWindowFactory* mainWindowFactor } EventWindow* QtEventWindowFactory::createEventWindow() { - return ((QtMainWindow*)mainWindowFactory_->getLastCreatedWindow())->getEventWindow(); + return static_cast<QtMainWindow*>(mainWindowFactory_->getLastCreatedWindow())->getEventWindow(); } } diff --git a/Swift/QtUI/QtStatusWidget.cpp b/Swift/QtUI/QtStatusWidget.cpp index d7c0e63..459b283 100644 --- a/Swift/QtUI/QtStatusWidget.cpp +++ b/Swift/QtUI/QtStatusWidget.cpp @@ -205,7 +205,7 @@ StatusShow::Type QtStatusWidget::getSelectedStatusShow() { void QtStatusWidget::handleItemClicked(QListWidgetItem* item) { editing_ = false; - selectedStatusType_ = (StatusShow::Type)(item->data(Qt::UserRole).toInt()); + selectedStatusType_ = static_cast<StatusShow::Type>(item->data(Qt::UserRole).toInt()); newStatusText_ = item->data(Qt::DisplayRole).toString(); statusEdit_->setText(newStatusText_); handleEditComplete(); diff --git a/Swift/QtUI/Roster/RosterModel.cpp b/Swift/QtUI/Roster/RosterModel.cpp index fa9becd..d705d34 100644 --- a/Swift/QtUI/Roster/RosterModel.cpp +++ b/Swift/QtUI/Roster/RosterModel.cpp @@ -169,7 +169,7 @@ QModelIndex RosterModel::index(int row, int column, const QModelIndex& parent) c parentItem = dynamic_cast<GroupRosterItem*>(getItem(parent)); if (!parentItem) return QModelIndex(); } - return (size_t)row < parentItem->getDisplayedChildren().size() ? createIndex(row, column, parentItem->getDisplayedChildren()[row]) : QModelIndex(); + return static_cast<size_t>(row) < parentItem->getDisplayedChildren().size() ? createIndex(row, column, parentItem->getDisplayedChildren()[row]) : QModelIndex(); } QModelIndex RosterModel::index(RosterItem* item) const { diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript index 80e3d56..ddc0b31 100644 --- a/Swift/QtUI/SConscript +++ b/Swift/QtUI/SConscript @@ -20,7 +20,7 @@ def generateDefaultTheme(dir) : Import("env") myenv = env.Clone() - +myenv["CXXFLAGS"] = filter(lambda x : x != "-Wfloat-equal", myenv["CXXFLAGS"]) myenv.MergeFlags(env["SWIFT_CONTROLLERS_FLAGS"]) myenv.MergeFlags(env["SWIFTOOLS_FLAGS"]) if myenv["HAVE_XSS"] : diff --git a/Swiften/Compress/ZLibCompressor.cpp b/Swiften/Compress/ZLibCompressor.cpp new file mode 100644 index 0000000..7e3116e --- /dev/null +++ b/Swiften/Compress/ZLibCompressor.cpp @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2010 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include "Swiften/Compress/ZLibCompressor.h" + +#pragma GCC diagnostic ignored "-Wold-style-cast" + +namespace Swift { + +ZLibCompressor::ZLibCompressor() { + int result = deflateInit(&stream_, COMPRESSION_LEVEL); + assert(result == Z_OK); + (void) result; +} + +} diff --git a/Swiften/Compress/ZLibCompressor.h b/Swiften/Compress/ZLibCompressor.h index d1d835b..7fe5387 100644 --- a/Swiften/Compress/ZLibCompressor.h +++ b/Swiften/Compress/ZLibCompressor.h @@ -4,8 +4,7 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#ifndef SWIFTEN_ZLibCompressor_H -#define SWIFTEN_ZLibCompressor_H +#pragma once #include <cassert> @@ -15,11 +14,7 @@ namespace Swift { class ZLibCompressor : public ZLibCodecompressor { public: - ZLibCompressor() { - int result = deflateInit(&stream_, COMPRESSION_LEVEL); - assert(result == Z_OK); - (void) result; - } + ZLibCompressor(); ~ZLibCompressor() { deflateEnd(&stream_); @@ -33,5 +28,3 @@ namespace Swift { static const int COMPRESSION_LEVEL = 9; }; } - -#endif diff --git a/Swiften/Compress/ZLibDecompressor.cpp b/Swiften/Compress/ZLibDecompressor.cpp new file mode 100644 index 0000000..af7349b --- /dev/null +++ b/Swiften/Compress/ZLibDecompressor.cpp @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2010 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include "Swiften/Compress/ZLibDecompressor.h" + +#pragma GCC diagnostic ignored "-Wold-style-cast" + +namespace Swift { + +ZLibDecompressor::ZLibDecompressor() { + int result = inflateInit(&stream_); + assert(result == Z_OK); + (void) result; +} + +} diff --git a/Swiften/Compress/ZLibDecompressor.h b/Swiften/Compress/ZLibDecompressor.h index ce8573e..ec08a4f 100644 --- a/Swiften/Compress/ZLibDecompressor.h +++ b/Swiften/Compress/ZLibDecompressor.h @@ -4,8 +4,7 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#ifndef SWIFTEN_ZLibDecompressor_H -#define SWIFTEN_ZLibDecompressor_H +#pragma once #include <cassert> @@ -15,11 +14,7 @@ namespace Swift { class ZLibDecompressor : public ZLibCodecompressor { public: - ZLibDecompressor() { - int result = inflateInit(&stream_); - assert(result == Z_OK); - (void) result; - } + ZLibDecompressor(); ~ZLibDecompressor() { inflateEnd(&stream_); @@ -30,5 +25,3 @@ namespace Swift { } }; } - -#endif diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveHostnameQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveHostnameQuery.h index cea22d4..de52321 100644 --- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveHostnameQuery.h +++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveHostnameQuery.h @@ -6,6 +6,8 @@ #pragma once +#pragma GCC diagnostic ignored "-Wold-style-cast" + #include "Swiften/Base/String.h" #include "Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.h" #include "Swiften/LinkLocal/DNSSD/DNSSDResolveHostnameQuery.h" diff --git a/Swiften/Network/PlatformDomainNameServiceQuery.cpp b/Swiften/Network/PlatformDomainNameServiceQuery.cpp index 3ee0b18..aa0be4e 100644 --- a/Swiften/Network/PlatformDomainNameServiceQuery.cpp +++ b/Swiften/Network/PlatformDomainNameServiceQuery.cpp @@ -6,6 +6,8 @@ #include "Swiften/Network/PlatformDomainNameServiceQuery.h" +#pragma GCC diagnostic ignored "-Wold-style-cast" + #include "Swiften/Base/Platform.h" #include <stdlib.h> #ifdef SWIFTEN_PLATFORM_WINDOWS diff --git a/Swiften/SConscript b/Swiften/SConscript index 2d5490c..33a1a7e 100644 --- a/Swiften/SConscript +++ b/Swiften/SConscript @@ -33,6 +33,8 @@ if env["SCONS_STAGE"] == "build" : "Client/Client.cpp", "Client/ClientSession.cpp", "Compress/ZLibCodecompressor.cpp", + "Compress/ZLibDecompressor.cpp", + "Compress/ZLibCompressor.cpp", "Disco/CapsInfoGenerator.cpp", "Elements/DiscoInfo.cpp", "Elements/Element.cpp", diff --git a/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp index 36aa47f..4586a74 100644 --- a/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp @@ -13,7 +13,7 @@ namespace Swift { MUCPayloadSerializer::MUCPayloadSerializer() : GenericPayloadSerializer<MUCPayload>() { } -String MUCPayloadSerializer::serializePayload(boost::shared_ptr<MUCPayload> payload) const { +String MUCPayloadSerializer::serializePayload(boost::shared_ptr<MUCPayload>) const { XMLElement mucElement("x", "http://jabber.org/protocol/muc"); return mucElement.serialize(); } diff --git a/Swiften/StringCodecs/MD5.cpp b/Swiften/StringCodecs/MD5.cpp index 09c3a42..718f52e 100644 --- a/Swiften/StringCodecs/MD5.cpp +++ b/Swiften/StringCodecs/MD5.cpp @@ -31,6 +31,8 @@ ghost@aladdin.com */ +#pragma GCC diagnostic ignored "-Wold-style-cast" + #include "Swiften/StringCodecs/MD5.h" #include <cassert> |