From ba0a79a6fa68f2757795e96a22ff310ebe41a715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Sat, 18 Jan 2014 19:33:52 +0100 Subject: Fix clang warnings Change-Id: I7cd26f00f626b64da934e9f5594db393d6184b9c diff --git a/Sluift/Lua/Exception.cpp b/Sluift/Lua/Exception.cpp index d80b9fb..889c931 100644 --- a/Sluift/Lua/Exception.cpp +++ b/Sluift/Lua/Exception.cpp @@ -11,5 +11,5 @@ using namespace Swift::Lua; Exception::Exception(const std::string& what) : std::runtime_error(what) { } -Exception::~Exception() throw() { +Exception::~Exception() SWIFTEN_NOEXCEPT { } diff --git a/Sluift/Lua/Exception.h b/Sluift/Lua/Exception.h index 6d00d01..a68b925 100644 --- a/Sluift/Lua/Exception.h +++ b/Sluift/Lua/Exception.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Remko Tronçon + * Copyright (c) 2013-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -7,13 +7,15 @@ #pragma once #include +#include namespace Swift { namespace Lua { class Exception : public std::runtime_error { public: Exception(const std::string& what); - virtual ~Exception() throw(); + SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(Exception) + virtual ~Exception() SWIFTEN_NOEXCEPT; }; } } diff --git a/Sluift/Response.h b/Sluift/Response.h index 1cd059a..b007897 100644 --- a/Sluift/Response.h +++ b/Sluift/Response.h @@ -8,6 +8,7 @@ #include #include +#include struct lua_State; @@ -15,6 +16,7 @@ namespace Swift { namespace Sluift { struct Response { Response(boost::shared_ptr result, boost::shared_ptr error) : result(result), error(error) {} + SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(Response) ~Response(); static Response withResult(boost::shared_ptr response) { diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp index a7e8b73..fef9039 100644 --- a/Swift/Controllers/Chat/ChatsManager.cpp +++ b/Swift/Controllers/Chat/ChatsManager.cpp @@ -313,7 +313,7 @@ void ChatsManager::loadRecents() { // boost searilaize based format ByteArray debase64 = Base64::decode(recentsString); std::vector recentChats; - std::stringstream deserializeStream(std::string((const char*)debase64.data(), debase64.size())); + std::stringstream deserializeStream(std::string(reinterpret_cast(vecptr(debase64)), debase64.size())); try { boost::archive::text_iarchive ia(deserializeStream); ia >> recentChats; diff --git a/Swiften/Base/API.h b/Swiften/Base/API.h index 388ad0a..0913181 100644 --- a/Swiften/Base/API.h +++ b/Swiften/Base/API.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2013 Remko Tronçon + * Copyright (c) 2012-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -7,6 +7,7 @@ #pragma once #include +#include #ifdef SWIFTEN_STATIC # define SWIFTEN_API @@ -23,3 +24,19 @@ # define SWIFTEN_API # endif #endif + +#ifdef BOOST_NO_DEFAULTED_FUNCTIONS +# define SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(cls) +# define SWIFTEN_DEFAULT_COPY_ASSIGMNENT_OPERATOR(cls) +#else +# define SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(cls) \ + cls(const cls&) = default; +# define SWIFTEN_DEFAULT_COPY_ASSIGMNENT_OPERATOR(cls) \ + cls& operator=(const cls&) = default; +#endif + +#ifdef BOOST_NO_NOEXCEPT +#define SWIFTEN_NOEXCEPT throw() +#else +#define SWIFTEN_NOEXCEPT noexcept +#endif diff --git a/Swiften/Base/Error.h b/Swiften/Base/Error.h index d9f3b91..00287fc 100644 --- a/Swiften/Base/Error.h +++ b/Swiften/Base/Error.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -11,6 +11,8 @@ namespace Swift { class SWIFTEN_API Error { public: + Error() {} + SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(Error) virtual ~Error(); }; } diff --git a/Swiften/Base/SafeAllocator.h b/Swiften/Base/SafeAllocator.h index b01d77d..8a8b25e 100644 --- a/Swiften/Base/SafeAllocator.h +++ b/Swiften/Base/SafeAllocator.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2013 Remko Tronçon + * Copyright (c) 2011-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -9,6 +9,8 @@ #include #include +#include + namespace Swift { void secureZeroMemory(char* memory, size_t numberOfBytes); @@ -19,16 +21,16 @@ namespace Swift { typedef SafeAllocator other; }; - SafeAllocator() throw() {} - SafeAllocator(const SafeAllocator&) throw() : std::allocator() {} - template SafeAllocator(const SafeAllocator&) throw() {} - ~SafeAllocator() throw() {} + SafeAllocator() SWIFTEN_NOEXCEPT {} + SafeAllocator(const SafeAllocator&) SWIFTEN_NOEXCEPT : std::allocator() {} + template SafeAllocator(const SafeAllocator&) SWIFTEN_NOEXCEPT {} + ~SafeAllocator() SWIFTEN_NOEXCEPT {} void deallocate (T* p, size_t num) { secureZeroMemory(reinterpret_cast(p), num); std::allocator::deallocate(p, num); } - private: + SWIFTEN_DEFAULT_COPY_ASSIGMNENT_OPERATOR(SafeAllocator) }; } diff --git a/Swiften/Client/XMLBeautifier.cpp b/Swiften/Client/XMLBeautifier.cpp index b70fc48..5d083ff 100644 --- a/Swiften/Client/XMLBeautifier.cpp +++ b/Swiften/Client/XMLBeautifier.cpp @@ -4,6 +4,12 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2014 Remko Tronçon + * Licensed under the GNU General Public License. + * See the COPYING file for more information. + */ + #include #include @@ -38,13 +44,13 @@ void XMLBeautifier::indent() { } // all bold but reset -const char colorBlue[] = "\x1b[01;34m"; -const char colorCyan[] = "\x1b[01;36m"; -const char colorGreen[] = "\x1b[01;32m"; -const char colorMagenta[] = "\x1b[01;35m"; -const char colorRed[] = "\x1b[01;31m"; -const char colorReset[] = "\x1b[0m"; -const char colorYellow[] = "\x1b[01;33m"; +// static const char colorBlue[] = "\x1b[01;34m"; +static const char colorCyan[] = "\x1b[01;36m"; +static const char colorGreen[] = "\x1b[01;32m"; +// static const char colorMagenta[] = "\x1b[01;35m"; +static const char colorRed[] = "\x1b[01;31m"; +static const char colorReset[] = "\x1b[0m"; +static const char colorYellow[] = "\x1b[01;33m"; diff --git a/Swiften/Elements/Element.h b/Swiften/Elements/Element.h index 638418d..14539c1 100644 --- a/Swiften/Elements/Element.h +++ b/Swiften/Elements/Element.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -11,6 +11,8 @@ namespace Swift { class SWIFTEN_API Element { public: + Element() {} + SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(Element) virtual ~Element(); }; } diff --git a/Swiften/Elements/JinglePayload.h b/Swiften/Elements/JinglePayload.h index 5f12e90..7d7160b 100644 --- a/Swiften/Elements/JinglePayload.h +++ b/Swiften/Elements/JinglePayload.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Remko Tronçon + * Copyright (c) 2011-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -42,7 +43,6 @@ namespace Swift { }; Reason() : type(UnknownType), text("") {} Reason(Type type, const std::string& text = "") : type(type), text(text) {} - ~Reason() {} Type type; std::string text; }; diff --git a/Swiften/Elements/Payload.h b/Swiften/Elements/Payload.h index 15a72d5..1459837 100644 --- a/Swiften/Elements/Payload.h +++ b/Swiften/Elements/Payload.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -15,6 +15,10 @@ namespace Swift { public: typedef boost::shared_ptr ref; public: + Payload() {} + SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(Payload) virtual ~Payload(); + + SWIFTEN_DEFAULT_COPY_ASSIGMNENT_OPERATOR(Payload) }; } diff --git a/Swiften/Elements/Presence.h b/Swiften/Elements/Presence.h index 2e9e224..d16be2a 100644 --- a/Swiften/Elements/Presence.h +++ b/Swiften/Elements/Presence.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -12,6 +12,7 @@ #include #include + namespace Swift { class SWIFTEN_API Presence : public Stanza { public: @@ -21,6 +22,7 @@ namespace Swift { Presence(); Presence(const std::string& status); + SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(Presence) virtual ~Presence(); static ref create() { diff --git a/Swiften/Elements/Stanza.h b/Swiften/Elements/Stanza.h index bd0d7e9..f1c9e00 100644 --- a/Swiften/Elements/Stanza.h +++ b/Swiften/Elements/Stanza.h @@ -25,6 +25,7 @@ namespace Swift { Stanza(); virtual ~Stanza(); + SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(Stanza) template boost::shared_ptr getPayload() const { diff --git a/Swiften/Elements/Whiteboard/WhiteboardDeleteOperation.h b/Swiften/Elements/Whiteboard/WhiteboardDeleteOperation.h index 091ee30..95015c9 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardDeleteOperation.h +++ b/Swiften/Elements/Whiteboard/WhiteboardDeleteOperation.h @@ -15,9 +15,6 @@ namespace Swift { public: typedef boost::shared_ptr ref; public: - ~WhiteboardDeleteOperation() { - } - std::string getElementID() const { return elementID_; } diff --git a/Swiften/Elements/Whiteboard/WhiteboardInsertOperation.h b/Swiften/Elements/Whiteboard/WhiteboardInsertOperation.h index 8c20044..fd52405 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardInsertOperation.h +++ b/Swiften/Elements/Whiteboard/WhiteboardInsertOperation.h @@ -15,9 +15,6 @@ namespace Swift { public: typedef boost::shared_ptr ref; public: - ~WhiteboardInsertOperation() { - } - WhiteboardElement::ref getElement() const { return element_; } diff --git a/Swiften/Elements/Whiteboard/WhiteboardOperation.h b/Swiften/Elements/Whiteboard/WhiteboardOperation.h index 75f6e6a..497d551 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardOperation.h +++ b/Swiften/Elements/Whiteboard/WhiteboardOperation.h @@ -6,6 +6,7 @@ #pragma once +#include #include #include @@ -14,6 +15,8 @@ namespace Swift { public: typedef boost::shared_ptr ref; public: + WhiteboardOperation() {} + SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(WhiteboardOperation) virtual ~WhiteboardOperation(){} std::string getID() const { diff --git a/Swiften/Elements/Whiteboard/WhiteboardUpdateOperation.h b/Swiften/Elements/Whiteboard/WhiteboardUpdateOperation.h index a52a341..a68cc7d 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardUpdateOperation.h +++ b/Swiften/Elements/Whiteboard/WhiteboardUpdateOperation.h @@ -15,9 +15,6 @@ namespace Swift { public: typedef boost::shared_ptr ref; public: - ~WhiteboardUpdateOperation() { - } - WhiteboardElement::ref getElement() const { return element_; } diff --git a/Swiften/FileTransfer/FileTransferOptions.h b/Swiften/FileTransfer/FileTransferOptions.h index 304ced8..993b14b 100644 --- a/Swiften/FileTransfer/FileTransferOptions.h +++ b/Swiften/FileTransfer/FileTransferOptions.h @@ -14,7 +14,7 @@ namespace Swift { public: FileTransferOptions() : allowInBand(false) { } - + SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(FileTransferOptions) ~FileTransferOptions(); FileTransferOptions& withInBandAllowed(bool b) { @@ -26,6 +26,8 @@ namespace Swift { return allowInBand; } + SWIFTEN_DEFAULT_COPY_ASSIGMNENT_OPERATOR(FileTransferOptions) + private: bool allowInBand; }; -- cgit v0.10.2-6-g49f6