Subject: [Boost-bugs] [Boost C++ Libraries] #5624: base64 encode/decode
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-06-21 13:29:47
#5624: base64 encode/decode
-------------------------------+--------------------------------------------
Reporter: nen777w@⦠| Owner: dave
Type: Bugs | Status: new
Milestone: To Be Determined | Component: iterator
Version: Boost 1.45.0 | Severity: Problem
Keywords: |
-------------------------------+--------------------------------------------
{{{
//typedefs
typedef boost::archive::iterators::istream_iterator<char>
boost_istream_iterator;
typedef boost::archive::iterators::ostream_iterator<char>
boost_ostream_iterator;
typedef boost::archive::iterators::insert_linebreaks<
boost::archive::iterators::base64_from_binary<
boost::archive::iterators::transform_width<boost_istream_iterator, 6, 8>
>, 76
> bin_to_base64;
typedef boost::archive::iterators::transform_width<
boost::archive::iterators::binary_from_base64<
boost::archive::iterators::remove_whitespace<boost_istream_iterator>
>, 8, 6
> base64_to_bin;
void test()
{
{
std::ifstream ifs("test.a",
std::ios_base::in|std::ios_base::binary);
std::ofstream ofs("test.b",
std::ios_base::out|std::ios_base::binary);
std::copy(
bin_to_base64(boost_istream_iterator(ifs >>
std::noskipws)),
bin_to_base64(boost_istream_iterator()),
boost_ostream_iterator(ofs)
);
}
{
std::ifstream ifs("test.b",
std::ios_base::in|std::ios_base::binary);
std::ofstream ofs("test.c",
std::ios_base::out|std::ios_base::binary);
std::copy(
base64_to_bin(boost_istream_iterator(ifs >>
std::noskipws)),
base64_to_bin(boost_istream_iterator()),
boost_ostream_iterator(ofs)
);
}
}
}}}
File test.a contain only one byte 0x50 'P'.
Exception happen during decoding, the same behaviour repeat for a any ZIP
file.
For example. Instead file test.a use any valid zip file.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/5624> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:06 UTC