summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Sluift/Lua/Exception.cpp2
-rw-r--r--Sluift/Lua/Exception.h6
-rw-r--r--Sluift/Response.h2
-rw-r--r--Swift/Controllers/Chat/ChatsManager.cpp2
-rw-r--r--Swiften/Base/API.h19
-rw-r--r--Swiften/Base/Error.h4
-rw-r--r--Swiften/Base/SafeAllocator.h14
-rw-r--r--Swiften/Client/XMLBeautifier.cpp20
-rw-r--r--Swiften/Elements/Element.h4
-rw-r--r--Swiften/Elements/JinglePayload.h4
-rw-r--r--Swiften/Elements/Payload.h6
-rw-r--r--Swiften/Elements/Presence.h4
-rw-r--r--Swiften/Elements/Stanza.h1
-rw-r--r--Swiften/Elements/Whiteboard/WhiteboardDeleteOperation.h3
-rw-r--r--Swiften/Elements/Whiteboard/WhiteboardInsertOperation.h3
-rw-r--r--Swiften/Elements/Whiteboard/WhiteboardOperation.h3
-rw-r--r--Swiften/Elements/Whiteboard/WhiteboardUpdateOperation.h3
-rw-r--r--Swiften/FileTransfer/FileTransferOptions.h4
18 files changed, 70 insertions, 34 deletions
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 <stdexcept>
+#include <Swiften/Base/API.h>
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 <Swiften/Elements/Payload.h>
#include <Swiften/Elements/ErrorPayload.h>
+#include <Swiften/Base/API.h>
struct lua_State;
@@ -15,6 +16,7 @@ namespace Swift {
namespace Sluift {
struct Response {
Response(boost::shared_ptr<Payload> result, boost::shared_ptr<ErrorPayload> error) : result(result), error(error) {}
+ SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(Response)
~Response();
static Response withResult(boost::shared_ptr<Payload> 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<ChatListWindow::Chat> recentChats;
- std::stringstream deserializeStream(std::string((const char*)debase64.data(), debase64.size()));
+ std::stringstream deserializeStream(std::string(reinterpret_cast<const char*>(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 <Swiften/Base/Platform.h>
+#include <boost/config.hpp>
#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 <vector>
#include <algorithm>
+#include <Swiften/Base/API.h>
+
namespace Swift {
void secureZeroMemory(char* memory, size_t numberOfBytes);
@@ -19,16 +21,16 @@ namespace Swift {
typedef SafeAllocator<U> other;
};
- SafeAllocator() throw() {}
- SafeAllocator(const SafeAllocator&) throw() : std::allocator<T>() {}
- template <class U> SafeAllocator(const SafeAllocator<U>&) throw() {}
- ~SafeAllocator() throw() {}
+ SafeAllocator() SWIFTEN_NOEXCEPT {}
+ SafeAllocator(const SafeAllocator&) SWIFTEN_NOEXCEPT : std::allocator<T>() {}
+ template <class U> SafeAllocator(const SafeAllocator<U>&) SWIFTEN_NOEXCEPT {}
+ ~SafeAllocator() SWIFTEN_NOEXCEPT {}
void deallocate (T* p, size_t num) {
secureZeroMemory(reinterpret_cast<char*>(p), num);
std::allocator<T>::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 <sstream>
#include <stack>
@@ -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 <boost/optional.hpp>
#include <string>
+#include <Swiften/Base/API.h>
#include <Swiften/JID/JID.h>
#include <Swiften/Elements/Payload.h>
#include <Swiften/Elements/JingleContentPayload.h>
@@ -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<Payload> 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 <Swiften/Elements/Stanza.h>
#include <Swiften/Elements/StatusShow.h>
+
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<typename T>
boost::shared_ptr<T> 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<WhiteboardDeleteOperation> 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<WhiteboardInsertOperation> 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 <Swiften/Base/API.h>
#include <boost/smart_ptr/shared_ptr.hpp>
#include <string>
@@ -14,6 +15,8 @@ namespace Swift {
public:
typedef boost::shared_ptr<WhiteboardOperation> 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<WhiteboardUpdateOperation> 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;
};