|
Boost Users : |
Subject: Re: [Boost-users] [iostream] gzip filter buggy on windows
From: Bo Jensen (jensen.bo_at_[hidden])
Date: 2011-04-28 09:01:18
On Thu, Apr 28, 2011 at 12:45 PM, Bo Jensen <jensen.bo_at_[hidden]> wrote:
> On Thu, Apr 28, 2011 at 12:41 PM, Bo Jensen <jensen.bo_at_[hidden]> wrote:
>> On Thu, Apr 28, 2011 at 12:29 PM, Anders Knudby <knudby_at_[hidden]> wrote:
>>> On Thu, Apr 28, 2011 at 8:06 AM, Bo Jensen <jensen.bo_at_[hidden]> wrote:
>>>>
>>>> In my quest of making gzip work for my application on windows, I found
>>>> the following bug :
>>>>
>>>> int main(int argc, char *argv[])
>>>> {
>>>> std::ofstream strm("test.gz");
>>>>
>>>> boost::iostreams::filtering_ostream sink;
>>>>
>>>> /* Push gzip compressor */
>>>> sink.push(boost::iostreams::gzip_compressor());
>>>>
>>>> /* Push file writer */
>>>> sink.push(strm);
>>>>
>>>> #if 0
>>>> /* This does not work */
>>>> sink <<" OBJ N"<< std::endl;
>>>> #else
>>>> /* This works */
>>>> sink <<" OBJ N"<< std::endl;
>>>> #endif
>>>> }
>>>>
>>>>
>>>> The first string results in a invalid gzip file i.e invalid compressed
>>>> data--length error. I am aware this might be a bug in zib lib. It
>>>> works on without any problems on linux.
>>>>
>>>> Does anyone use gzip on windows on a regular basis ?
>>>> _______________________________________________
>>>> Boost-users mailing list
>>>> Boost-users_at_[hidden]
>>>> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>>>
>>> Hi Bo, I have recently tried getting boost/gzip to work on Windows (x86) and
>>> also run into some weird behaviour. It is chronicled in two recent posts,
>>> "Read/write with gzip" and "Writing large binary files with boost gzip". I
>>> can't say for sure that all my problems have been Windows issues, but others
>>> have successfully run some of my code on Linux when I couldn't get it to
>>> behave.
>>>
>>> Anders
>>
>> Yes, after some tweaks with flushing it works absolutely fine for me
>> on linux. Windows on the other hand show some strange stuff like the
>> one I mention. I tried to upgrade from zlib 1.2.4 to zlib 1.2.5, but
>> can not make it compile with msvc-10. What version of zlib do you use
>> ? Compiler ?
>>
>>>
>>> _______________________________________________
>>> Boost-users mailing list
>>> Boost-users_at_[hidden]
>>> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>>>
>>
>
> In regard to flushing issues, I can see from the zlib change list some
> new features were added in 1.2.4 :
>
> Added flush options Z_BLOCK to deflate() and Z_TREES to inflate() for
> finer control
>
> which was not possible when iostream library gzip stuff was implemented.
>
Sorry please disregard, I forgot to make the write binary i.e with :
std::ofstream strm("test.gz", std::ios_base::out | std::ios_base::binary);
then it works as expected.
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