Boost logo

Boost Users :

From: Marc Viala Perso (marc.viala_at_[hidden])
Date: 2008-01-17 17:13:54


Hello,

 

During the implementation of a TARFILE module based on Boost.Iostream, I've
faced a problem during reading operation of a
boost::iostream::filtering_stream<> with a GZip codec. To illustrate it, you
will find hereafter a small code snippet that reproduces my problem:

 

 

  namespace io = boost::iostreams ;

  namespace fs = boost::filesystem ;

 

  const fs::path test_file("test.txt.gz") ;

  const std::string s("Test..................") ;

 

  {

    io::filtering_stream<io::output> ofilter ;

    

    ofilter.push(io::gzip_compressor()) ;

    ofilter.push(io::file_descriptor_sink(

        test_file.external_file_string()

      , std::ios::binary)) ;

 

    ofilter << s ;

  }

 

  {

    io::filtering_stream<io::input> ifilter ;

 

    ifilter.push(io::gzip_decompressor()) ;

    ifilter.push(io::file_descriptor_source(

        test_file.external_file_string()

      , std::ios::binary)) ;

 

    std::string rs ;

    ifilter >> rs ; // <- Here process is blocked in file_description.cpp @
line 145

    //boost::scoped_array<char> buffer(new char[512]) ;

    //const std::streamsize count = io::read(ifilter, buffer.get(), 512) ;

  }

 

 

The problem occurs during the reading operation @ line: "ifilter >> rs": the
process is blocked in boost/iostreams/src/file_description.cpp @ line 145
("if (!::ReadFile(pimpl_->handle_, s, n, &result, NULL))") when this line is
executed.

I've tried to use boost::iostream::read() template function without more
success.

 

I've checked the file after the writing operation w/ 7z and everything is
fine at this point.

 

I've tried the same code snippet w/ ZLib and BZip2 codecs without trouble.

 

My environment is:

         Visual C++ 7.1

         Boost 1.34.1

         Windows XP SP2

 

Is there any bug in GZip decompressor with the file_descriptor_source? Or
I've missed something?

 

Any help will be appreciated.

 

Best regards,

 

Marc VIALA

 



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