summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-05-18 13:45:41 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-05-18 14:24:28 (GMT)
commit23fa0f462ddd0c686c677bfe5d4d743621432b7e (patch)
treeb8f0ea1860640f89eafba2460cc5d45bf28fc77c /QA/Checker
parent2456a8b12163b3249b6b9164b601c36772eb05a1 (diff)
downloadswift-23fa0f462ddd0c686c677bfe5d4d743621432b7e.zip
swift-23fa0f462ddd0c686c677bfe5d4d743621432b7e.tar.bz2
Introduce safe containers for storing passwords.
Diffstat (limited to 'QA/Checker')
-rw-r--r--QA/Checker/IO.cpp14
-rw-r--r--QA/Checker/IO.h2
2 files changed, 16 insertions, 0 deletions
diff --git a/QA/Checker/IO.cpp b/QA/Checker/IO.cpp
index 4945791..2e14589 100644
--- a/QA/Checker/IO.cpp
+++ b/QA/Checker/IO.cpp
@@ -21,3 +21,17 @@ std::ostream& operator<<(std::ostream& os, const Swift::ByteArray& s) {
os.flags(oldFlags);
return os;
}
+
+std::ostream& operator<<(std::ostream& os, const Swift::SafeByteArray& s) {
+ std::ios::fmtflags oldFlags = os.flags();
+ os << std::hex;
+ for (Swift::SafeByteArray::const_iterator i = s.begin(); i != s.end(); ++i) {
+ os << "0x" << static_cast<unsigned int>(static_cast<unsigned char>(*i));
+ if (i + 1 < s.end()) {
+ os << " ";
+ }
+ }
+ os << std::endl;
+ os.flags(oldFlags);
+ return os;
+}
diff --git a/QA/Checker/IO.h b/QA/Checker/IO.h
index 5eb61d8..a369b56 100644
--- a/QA/Checker/IO.h
+++ b/QA/Checker/IO.h
@@ -7,5 +7,7 @@
#pragma once
#include <Swiften/Base/ByteArray.h>
+#include <Swiften/Base/SafeByteArray.h>
std::ostream& operator<<(std::ostream& os, const Swift::ByteArray& s);
+std::ostream& operator<<(std::ostream& os, const Swift::SafeByteArray& s);