|
Boost Users : |
Subject: [Boost-users] Boost 1.60: boost::archive::iterators bug?
From: Ernest Zaslavsky (ernest.zaslavsky_at_[hidden])
Date: 2016-02-02 06:13:14
Hi,
Recently I've noticed that Base64 encoded data produced by implementation I use and implementation used by chromium project sometimes are not the same. It happened only once but it was enough for me to start worrying.
The implementation is quite simple, and I guess borrowed it from somewhere, like SO or something.
The code as following:
using it_base64_t = bai::base64_from_binary<bai::transform_width<std::string::const_iterator, 6, 8>>;
namespace bai = boost::archive::iterators;
auto writePaddChars = (3 - input.length() % 3) % 3;
std::string base64(it_base64_t(input.begin()), it_base64_t(input.end()));
base64.append(writePaddChars, '=');
simple and elegant.
However, today I wrote a short test which takes a chapter from 'Alice's Adventures in Wonderland' and encodes it. As well, I used two different online encoder to encode the same text, both online encoders produce the same data. However above code produced the same code until character 1029 and then it is different from what it should be. Then later, it gets back to the same output as produced by online encoders.
So my question is, any chance it is a bug in archive::iterators or it is something in the above code?
Coliru is down, so, full code is here http://pastebin.com/JxMsMeV2
[Read More]<http://feeds.feedburner.com/~r/sizmek-blog/~6/1>
[http://www.sizmek.com/Sizmek.png]<http://www.sizmek.com/>
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net