Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62984 - in trunk: boost/iostreams/filter libs/iostreams/src
From: steven_at_[hidden]
Date: 2010-06-15 13:07:55


Author: steven_watanabe
Date: 2010-06-15 13:07:54 EDT (Tue, 15 Jun 2010)
New Revision: 62984
URL: http://svn.boost.org/trac/boost/changeset/62984

Log:
Make sure that the crc for zlib is reset when we reuse a filter. This should fix the gzip errors that I'm seeing in the trunk tests.
Text files modified:
   trunk/boost/iostreams/filter/zlib.hpp | 1 +
   trunk/libs/iostreams/src/zlib.cpp | 5 +++--
   2 files changed, 4 insertions(+), 2 deletions(-)

Modified: trunk/boost/iostreams/filter/zlib.hpp
==============================================================================
--- trunk/boost/iostreams/filter/zlib.hpp (original)
+++ trunk/boost/iostreams/filter/zlib.hpp 2010-06-15 13:07:54 EDT (Tue, 15 Jun 2010)
@@ -210,6 +210,7 @@
     void* stream_; // Actual type: z_stream*.
     bool calculate_crc_;
     zlib::ulong crc_;
+ zlib::ulong crc_imp_;
     int total_in_;
     int total_out_;
 };

Modified: trunk/libs/iostreams/src/zlib.cpp
==============================================================================
--- trunk/libs/iostreams/src/zlib.cpp (original)
+++ trunk/libs/iostreams/src/zlib.cpp 2010-06-15 13:07:54 EDT (Tue, 15 Jun 2010)
@@ -91,7 +91,7 @@
 namespace detail {
 
 zlib_base::zlib_base()
- : stream_(new z_stream), calculate_crc_(false), crc_(0)
+ : stream_(new z_stream), calculate_crc_(false), crc_(0), crc_imp_(0)
     { }
 
 zlib_base::~zlib_base() { delete static_cast<z_stream*>(stream_); }
@@ -121,7 +121,7 @@
             static_cast<zlib::uint>(next_in - src_begin) :
             static_cast<zlib::uint>(next_out - dest_begin);
         if (length > 0)
- crc_ = crc32(crc_, buf, length);
+ crc_ = crc_imp_ = crc32(crc_imp_, buf, length);
     }
     total_in_ = s->total_in;
     total_out_ = s->total_out;
@@ -150,6 +150,7 @@
             (compress ? deflateEnd(s) : inflateEnd(s))
                 ;
     //);
+ crc_imp_ = 0;
 }
 
 void zlib_base::do_init


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk