Boost logo

Boost Users :

Subject: [Boost-users] Another decompression issue?
From: Bryan (bschmer_at_[hidden])
Date: 2010-10-19 08:29:03


I'm using Boost 1.43 and I've run across a situation where I'm getting
unexpected results when reading the uncompressed stream. I originally
thought that it was an issue with my data format interpretation, but it
turns out that something seems to be consuming a character from the
input stream. Here's a sample of reading the stream a character at a time:
cur = 80, next = 80
cur = 80, next = 38
cur = 38, next = 8c
cur = 8c, next = c
cur = b4, next = db <--- Cur != previous next
cur = db, next = 1
cur = 1, next = 1
cur = 1, next = dd

This debugging output shows the discontinuity in the stream. The code
is pretty simple:

     boost::iostreams::filtering_istream instream;
     std::fstream infile;
     uint8_t d;
     instream.push(boost::iostreams::bzip2_decompressor());
     infile.open("file.bz2", std::ios::binary|std::ios::in);
     instream.push(infile);

     while (true){
         instream >> d;
         fprintf(stderr, "cur = %x, next = %x\n", d, instream.peek());
     }

Reading a large chunk of data from the stream via read() does not have
the same issue.

I see that there are a few changes for compression in 1.44 [Fix several
issues with compression and decompression (#2318, #4091, #3348, #2783,
#1579, #3853). ] but it's unclear if this is one of them.

Thanks in advance for any help.
B


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