Ticket #3723: gzip.patch
File gzip.patch, 2.0 KB (added by , 13 years ago) |
---|
-
boost/iostreams/filter/gzip.hpp
32 32 #include <boost/iostreams/detail/adapter/range_adapter.hpp> 33 33 #include <boost/iostreams/detail/char_traits.hpp> 34 34 #include <boost/iostreams/detail/ios.hpp> // failure. 35 #include <boost/iostreams/detail/error.hpp> 35 36 #include <boost/iostreams/operations.hpp> 36 37 #include <boost/iostreams/device/back_inserter.hpp> 37 38 #include <boost/iostreams/filter/zlib.hpp> … … 531 532 { 532 533 if (offset_) { 533 534 putback_[--offset_] = c; 534 return true;535 535 } else { 536 return boost::iostreams::putback(src_, c); 536 boost::throw_exception( 537 boost::iostreams::detail::bad_putback()); 537 538 } 539 return true; 538 540 } 539 541 void putback(const string_type& s) 540 542 { -
libs/iostreams/test/gzip_test.cpp
83 83 BOOST_CHECK(std::equal(data.begin(), data.end(), dest.begin() + dest.size() / 2)); 84 84 } 85 85 86 void array_source_test() 87 { 88 std::string data = "simple test string."; 89 std::string encoded; 90 91 filtering_ostream out; 92 out.push(gzip_compressor()); 93 out.push(io::back_inserter(encoded)); 94 io::copy(make_iterator_range(data), out); 95 96 std::string res; 97 io::array_source src(encoded.data(),encoded.length()); 98 io::copy(io::compose(io::gzip_decompressor(), src), io::back_inserter(res)); 99 100 BOOST_CHECK_EQUAL(data, res); 101 } 102 86 103 test_suite* init_unit_test_suite(int, char* []) 87 104 { 88 105 test_suite* test = BOOST_TEST_SUITE("gzip test"); 89 106 test->add(BOOST_TEST_CASE(&compression_test)); 90 107 test->add(BOOST_TEST_CASE(&multiple_member_test)); 108 test->add(BOOST_TEST_CASE(&array_source_test)); 91 109 return test; 92 110 }