summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2013-08-31 00:06:29 (GMT)
committerSwift Review <review@swift.im>2013-08-31 07:09:01 (GMT)
commit2f8ef07f7ac166ee073510fa7fca3c2b353cb9c2 (patch)
tree90a457f3867b3eaead5d5aa63e7c3ae26a27fb0f /Swiften/StringCodecs/Base64.cpp
parent36de32c1a64fb814db18cafc7646feff144b5dbe (diff)
downloadswift-2f8ef07f7ac166ee073510fa7fca3c2b353cb9c2.zip
swift-2f8ef07f7ac166ee073510fa7fca3c2b353cb9c2.tar.bz2
Fix Qt warnings in avatar loading and add multi-line support to Base64 decoder.
Change-Id: I451cd5e8a0258e2b6c87fffd1996cdd7319847a4 License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Diffstat (limited to 'Swiften/StringCodecs/Base64.cpp')
-rw-r--r--Swiften/StringCodecs/Base64.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/Swiften/StringCodecs/Base64.cpp b/Swiften/StringCodecs/Base64.cpp
index 1b039ac..ec6f960 100644
--- a/Swiften/StringCodecs/Base64.cpp
+++ b/Swiften/StringCodecs/Base64.cpp
@@ -70,8 +70,12 @@ SafeByteArray Base64::encode(const SafeByteArray& s) {
return encodeDetail<SafeByteArray>(s);
}
-ByteArray Base64::decode(const std::string& input) {
+ByteArray Base64::decode(const std::string& input1) {
ByteArray result;
+ std::string input(input1);
+ input.erase(std::remove(input.begin(), input.end(), '\n'), input.end());
+ input.erase(std::remove(input.begin(), input.end(), '\r'), input.end());
+
if (input.size() % 4) {
return ByteArray();
}