summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-06-03 12:25:57 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-06-03 12:46:12 (GMT)
commit21fda3308975201eeebeacd98e2b587ef4448862 (patch)
treee8aebe473a636cf5a312814d4054d8af0d9ad6a6 /Swiften/Base
parent10334c139670861d4860da59ad837fc3fe6fd41e (diff)
downloadswift-21fda3308975201eeebeacd98e2b587ef4448862.zip
swift-21fda3308975201eeebeacd98e2b587ef4448862.tar.bz2
Limit the use of the SafeString type.
Diffstat (limited to 'Swiften/Base')
-rw-r--r--Swiften/Base/SConscript1
-rw-r--r--Swiften/Base/SafeByteArray.cpp5
-rw-r--r--Swiften/Base/SafeByteArray.h4
-rw-r--r--Swiften/Base/SafeString.cpp17
-rw-r--r--Swiften/Base/SafeString.h75
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;
- };
-};