X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fio%2Fzlibcompressed.h;h=7a7973425bdcc573f48b65b838b062adf416b6d5;hp=e4ae6e08f852f9b6228f7ff0f4b415d80a08de81;hb=41363aed34382386f915f17c1a961750b4fdcb14;hpb=c8bf2d6c15893ccc9dbc4e04611b7229029f4808 diff --git a/source/io/zlibcompressed.h b/source/io/zlibcompressed.h index e4ae6e0..7a79734 100644 --- a/source/io/zlibcompressed.h +++ b/source/io/zlibcompressed.h @@ -12,13 +12,13 @@ namespace IO { class zlib_error: public std::runtime_error { private: - int code_; + int m_code; public: zlib_error(const std::string &, int); - ~zlib_error() throw() { } + virtual ~zlib_error() throw() = default; - int code() const throw() { return code_; } + int code() const throw() { return m_code; } }; /** @@ -34,26 +34,22 @@ private: struct Private; Base &below; - std::size_t buffer_size; - unsigned char *in_buffer; - unsigned char *out_buffer; - bool stream_end; - Private *priv; + std::size_t buffer_size = 1024; + unsigned char *in_buffer = nullptr; + unsigned char *out_buffer = nullptr; + bool stream_end = false; + Private *priv = nullptr; public: /** Creates a zlib de/compression object. The underlying object must be open for reading or writing, not both. The level parameter determines compression quality, ranging from 1 (fastest) to 9 (best compression). */ - ZlibCompressed(Base &, unsigned level = 9); + ZlibCompressed(Base &b, unsigned level = 9): ZlibCompressed(b, b.get_mode()&M_RDWR, level) { } /** Creates a zlib de/compression object. Mode must be either read or write, and compatible with the underlying object. */ ZlibCompressed(Base &, Mode, unsigned level = 9); -private: - void init(unsigned); - -public: virtual ~ZlibCompressed(); virtual void set_block(bool);