Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 163601 - dev-libs/boost-1.33.1-r1 - boost::iostreams::bzip2_compressor() does not work
Summary: dev-libs/boost-1.33.1-r1 - boost::iostreams::bzip2_compressor() does not work
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Tiziano Müller (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-24 14:27 UTC by Jeffrey Graham
Modified: 2007-01-24 22:11 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeffrey Graham 2007-01-24 14:27:05 UTC
using boost::iostreams::bzip2_compressor() fails. the bzip2_decompressor() works.
All other compressors and decompressors work (gzip and zlib).

The bzip2_compressor() fails silenty, resulting in no/empty output.


Reproducible: Always

Steps to Reproduce:
1.run sample code below (closely following example from boost website)


Actual Results:  
empty file

Expected Results:  
non-empty file that bunzip2 can decompress

#include <string>

#include <fstream>
#include <iostream>
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/filter/bzip2.hpp>

int     main(int argc, char* argv[])
        {
        std::string inFileName("hello.in");
        if ( argc > 1 )
                inFileName=argv[1];

        std::string outFileName("hello.bz2");
        if ( argc > 2 )
                outFileName=argv[2];

        int rc=0;
        try
                {
                std::cerr<<"Will compress file "<<inFileName<<" into file "<<outFileName<<std::endl;
                std::ifstream ifs(inFileName.c_str(), std::ios_base::in | std::ios_base::binary);
                boost::iostreams::filtering_streambuf<boost::iostreams::input> in;
                in.push(boost::iostreams::bzip2_compressor());
                in.push(ifs);

                std::ofstream ofs(outFileName.c_str());
                boost::iostreams::copy(in, ofs);
                std::cerr<<"Done compressing file "<<inFileName<<" into "<<outFileName<<std::endl;
                }
        catch(...)
                {
                std::cerr<<"Caught some exception"<<std::endl;
                rc=1;
                }
        return rc;
        }
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2007-01-24 19:33:50 UTC
Which ebuild and version is this about???
Comment 2 Jeffrey Graham 2007-01-24 20:29:42 UTC
this is dev-libs/boost version 1.33.1-r1
Comment 3 Tiziano Müller (RETIRED) gentoo-dev 2007-01-24 22:11:13 UTC
#include <fstream>
#include <iostream>

#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/compose.hpp>

#include <boost/iostreams/filter/bzip2.hpp>
#include <boost/iostreams/device/file.hpp>
#include <boost/iostreams/filtering_stream.hpp>

using namespace boost;

int main(void)
{
        std::ofstream file_stream;
        iostreams::filtering_stream<iostreams::output> stream;

        file_stream.open("hello.bz2", std::ios_base::out | std::ios_base::binary);
        stream.push(iostreams::bzip2_compressor());
        stream.push(file_stream);

        std::ifstream input;
        input.open("hello.in", std::ios_base::in | std::ios_base::binary);

        copy(input,stream);

        stream.pop();

    return 0;

}