Opened 11 years ago
Closed 9 years ago
#5624 closed Bugs (fixed)
base64 encode/decode
Reported by: | Owned by: | Robert Ramey | |
---|---|---|---|
Milestone: | To Be Determined | Component: | serialization |
Version: | Boost 1.45.0 | Severity: | Problem |
Keywords: | Cc: |
Description
//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.
Change History (8)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
If it may help. The workaround code and example how to use you can find here: http://rsdn.ru/forum/cpp.applied/4317966.1.aspx
comment:3 by , 10 years ago
Owner: | changed from | to
---|
comment:4 by , 10 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:5 by , 10 years ago
Owner: | changed from | to
---|---|
Status: | assigned → new |
comment:6 by , 10 years ago
Component: | iterator → serialization |
---|---|
Owner: | changed from | to
comment:7 by , 9 years ago
Is this still an issue. I think I addressed this. Note that the test_iterators_base64 explicitly tests the situation where the number of characters to be rendered is only 1. Please double check and let me know. If I don't get any response for a while, I'll close this ticket.
Robert Ramey
comment:8 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
File test.a contain only one byte 0x50 'P'. Exception happen during decoding, the same behaviour repeated for a any ZIP file. For example. Use instead file test.a any valid zip file.