Boost logo

Boost Users :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-10-30 19:34:55


> Hello.
>
> I've been experiencing the following problem with the gzip_compressor
> filter: It always writes data down the stream, regardless if any data
> has been written to the filtering_stream.
>
> Consider the following program:

<snip>

> If compiled as "test", the following behavior is observed:

<snip>

> That is, it always adds 8 bytes to the file, despite the fact that
> nothing was written to the stream. To top things off, the data inside
> the file isn't even recognizable by gzip:

gzip_compressor works as follows: The first time you write data to it, it writes
the gzip header information to the downstream Sink, and then writes the
beginning of the compressed data. When the filter is closed, it writes any
compressed data that has been buffered, plus the gzip footer, which consists of
a checksum and the length of the uncompressed data.

In the above example, the filter is automatically closed at the end of main;
this causes the gzip footer to be written. But since no data was ever
compressed, the gzip header has never been written.

I guess this is a bug of some sort. What behavior would you expect in this
case? It seems to me it would make the most sense to output data in the gzip
format representing a 0-length file.

-- 
Jonathan Turkanis
www.kangaroologic.com

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