diff options
Diffstat (limited to 'Swiften/Base')
-rw-r--r-- | Swiften/Base/SConscript | 1 | ||||
-rw-r--r-- | Swiften/Base/SafeByteArray.cpp | 5 | ||||
-rw-r--r-- | Swiften/Base/SafeByteArray.h | 4 | ||||
-rw-r--r-- | Swiften/Base/SafeString.cpp | 17 | ||||
-rw-r--r-- | Swiften/Base/SafeString.h | 75 |
5 files changed, 0 insertions, 102 deletions
diff --git a/Swiften/Base/SConscript b/Swiften/Base/SConscript index ab78639..3279c22 100644 --- a/Swiften/Base/SConscript +++ b/Swiften/Base/SConscript @@ -7,7 +7,6 @@ objects = swiften_env.SwiftenObject([ "Log.cpp", "Paths.cpp", "String.cpp", - "SafeString.cpp", "IDGenerator.cpp", "sleep.cpp", ]) diff --git a/Swiften/Base/SafeByteArray.cpp b/Swiften/Base/SafeByteArray.cpp index e09a285..848b6d8 100644 --- a/Swiften/Base/SafeByteArray.cpp +++ b/Swiften/Base/SafeByteArray.cpp @@ -5,7 +5,6 @@ */ #include <Swiften/Base/SafeByteArray.h> -#include <Swiften/Base/SafeString.h> using namespace Swift; @@ -20,8 +19,4 @@ SafeByteArray createSafeByteArray(const char* c) { return data; } -SafeByteArray createSafeByteArray(const SafeString& s) { - return SafeByteArray(s.begin(), s.end()); -} - } diff --git a/Swiften/Base/SafeByteArray.h b/Swiften/Base/SafeByteArray.h index 2f3fbfa..032a6d5 100644 --- a/Swiften/Base/SafeByteArray.h +++ b/Swiften/Base/SafeByteArray.h @@ -12,8 +12,6 @@ #include <Swiften/Base/ByteArray.h> namespace Swift { - class SafeString; - typedef std::vector<unsigned char, SafeAllocator<unsigned char> > SafeByteArray; inline SafeByteArray createSafeByteArray(const ByteArray& a) { @@ -38,8 +36,6 @@ namespace Swift { return SafeByteArray(c, c + n); } - SafeByteArray createSafeByteArray(const SafeString& s); - /* WARNING! This breaks the safety of the data in the safe byte array. * Do not use in modes that require data safety. */ inline std::string safeByteArrayToString(const SafeByteArray& b) { diff --git a/Swiften/Base/SafeString.cpp b/Swiften/Base/SafeString.cpp deleted file mode 100644 index 2abcdb0..0000000 --- a/Swiften/Base/SafeString.cpp +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2011 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#include <Swiften/Base/SafeString.h> - -#include <algorithm> - -using namespace Swift; - -SafeString::SafeString(const char* rawData) { - for (const char* c = rawData; *c; ++c) { - data.push_back(*c); - } -} diff --git a/Swiften/Base/SafeString.h b/Swiften/Base/SafeString.h deleted file mode 100644 index d549bd1..0000000 --- a/Swiften/Base/SafeString.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2011 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#pragma once - -#include <vector> -#include <string> - -#include <Swiften/Base/SafeAllocator.h> - -namespace Swift { - class SafeString { - public: - typedef std::vector<char, SafeAllocator<char> > Data; - typedef Data::iterator Iterator; - typedef Data::const_iterator ConstIterator; - - SafeString() { - } - - SafeString(const std::string& s) : data(s.begin(), s.end()) { - } - - SafeString(const char*); - - SafeString(const char* begin, const char* end) : data(begin, end) { - } - - std::string toString() const { - return data.empty() ? std::string() : std::string(&data[0], data.size()); - } - - void resize(size_t n) { - data.resize(n); - } - - char& operator[](size_t n) { - return data[n]; - } - - Iterator begin() { - return data.begin(); - } - - Iterator end() { - return data.end(); - } - - ConstIterator begin() const { - return data.begin(); - } - - ConstIterator end() const { - return data.end(); - } - - size_t size() const { - return data.size(); - } - - void clear() { - data.clear(); - } - - bool operator==(const SafeString& o) const { - return data == o.data; - } - - private: - std::vector<char, SafeAllocator<char> > data; - }; -}; |