diff options
author | Max Kellermann <max@musicpd.org> | 2020-09-04 17:50:39 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2020-09-04 17:51:41 +0200 |
commit | 15939fd87c2c2195b82d880613f29bd4dcf44374 (patch) | |
tree | 68163a8e2a176d73e712c6170cc4f70ed25f57cc /src | |
parent | f63c343f6887e91cf449f8a8fc7f74ec79f96bc2 (diff) |
archive/bzip2: fold Open() into constructor
Diffstat (limited to 'src')
-rw-r--r-- | src/archive/plugins/Bzip2ArchivePlugin.cxx | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/src/archive/plugins/Bzip2ArchivePlugin.cxx b/src/archive/plugins/Bzip2ArchivePlugin.cxx index c3e63c91c..a9dbbd9a6 100644 --- a/src/archive/plugins/Bzip2ArchivePlugin.cxx +++ b/src/archive/plugins/Bzip2ArchivePlugin.cxx @@ -79,25 +79,6 @@ private: bool FillBuffer(); }; -/* single archive handling allocation helpers */ - -inline void -Bzip2InputStream::Open() -{ - bzstream.bzalloc = nullptr; - bzstream.bzfree = nullptr; - bzstream.opaque = nullptr; - - bzstream.next_in = (char *)buffer; - bzstream.avail_in = 0; - - int ret = BZ2_bzDecompressInit(&bzstream, 0, 0); - if (ret != BZ_OK) - throw std::runtime_error("BZ2_bzDecompressInit() has failed"); - - SetReady(); -} - /* archive open && listing routine */ static std::unique_ptr<ArchiveFile> @@ -116,7 +97,18 @@ Bzip2InputStream::Bzip2InputStream(const std::shared_ptr<InputStream> &_input, :InputStream(_uri, _mutex), input(_input) { - Open(); + bzstream.bzalloc = nullptr; + bzstream.bzfree = nullptr; + bzstream.opaque = nullptr; + + bzstream.next_in = (char *)buffer; + bzstream.avail_in = 0; + + int ret = BZ2_bzDecompressInit(&bzstream, 0, 0); + if (ret != BZ_OK) + throw std::runtime_error("BZ2_bzDecompressInit() has failed"); + + SetReady(); } Bzip2InputStream::~Bzip2InputStream() noexcept |