diff options
author | vng <viktor.govako@gmail.com> | 2011-03-20 22:59:32 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:14:03 +0300 |
commit | b12cc6394c8f93c30d2bc6a85504ad5f8d01ae57 (patch) | |
tree | afe0579b5435d18ace9918ffbd6b97c8171a3fb9 /coding/base64.cpp | |
parent | 72d0e254e8d6667328b9e14a12833bc31456e5a8 (diff) |
Fix crash in Win32, when using boost::base64.
Diffstat (limited to 'coding/base64.cpp')
-rw-r--r-- | coding/base64.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/coding/base64.cpp b/coding/base64.cpp index 86b2346c93..d5d886c909 100644 --- a/coding/base64.cpp +++ b/coding/base64.cpp @@ -10,8 +10,18 @@ typedef transform_width<binary_from_base64<string::const_iterator>, 8, 6 > binar namespace base64 { - string encode(string const & rawBytes) + string encode(string rawBytes) { + // http://boost.2283326.n4.nabble.com/boost-archive-iterators-base64-from-binary-td2589980.html + switch (rawBytes.size() % 3) + { + case 1: + rawBytes.push_back('0'); + case 2: + rawBytes.push_back('0'); + break; + } + return string(base64_t(rawBytes.begin()), base64_t(rawBytes.end())); } |