X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fio%2Fzlibcompressed.cpp;h=99ae7f81f8845016e73e92d60f13083e7e672ee6;hp=90b54a214bed69ce272952e3ebad8ca05e6ff1d4;hb=481b844ed7d180ffbf70223075f2fc1ffdb5b444;hpb=a386a9ff068071aab19e6dcb0452e72784d84267 diff --git a/source/io/zlibcompressed.cpp b/source/io/zlibcompressed.cpp index 90b54a2..99ae7f8 100644 --- a/source/io/zlibcompressed.cpp +++ b/source/io/zlibcompressed.cpp @@ -38,18 +38,32 @@ ZlibCompressed::Private::Private() ZlibCompressed::ZlibCompressed(Base &b, unsigned level): - below(b), - buffer_size(1024), - in_buffer(0), - out_buffer(0), - stream_end(false), - priv(0) + below(b) { -#ifdef WITH_ZLIB mode = below.get_mode()&M_RDWR; if(mode!=M_READ && mode!=M_WRITE) throw invalid_access(mode); + init(level); +} + +ZlibCompressed::ZlibCompressed(Base &b, Mode m, unsigned level): + below(b) +{ + mode = m&below.get_mode()&M_RDWR; + if(mode!=M_READ && mode!=M_WRITE) + throw invalid_access(m); + + init(level); +} + +void ZlibCompressed::init(unsigned level) +{ +#ifdef WITH_ZLIB + buffer_size = 1024; + in_buffer = 0; + out_buffer = 0; + stream_end = false; priv = new Private; if(mode==M_WRITE) @@ -75,6 +89,8 @@ ZlibCompressed::ZlibCompressed(Base &b, unsigned level): below.signal_flush_required.connect(sigc::mem_fun(this, &ZlibCompressed::flush)); #else + (void)buffer_size; + (void)stream_end; (void)level; throw zlib_error("unsupported", -1); #endif @@ -97,6 +113,11 @@ ZlibCompressed::~ZlibCompressed() delete priv; } +void ZlibCompressed::set_block(bool) +{ + throw logic_error("ZlibCompressed::set_block"); +} + void ZlibCompressed::flush() { #ifdef WITH_ZLIB @@ -252,5 +273,10 @@ unsigned ZlibCompressed::do_read(char *data, unsigned size) return processed; } +const Handle &ZlibCompressed::get_handle(Mode) +{ + throw logic_error("ZlibCompressed::get_handle"); +} + } // namespace IO } // namespace Msp