Commit 15a49f1b by Maarten L. Hekkelman

Fix uncompressing concatenated gzip files

parent db1dff16
...@@ -246,10 +246,13 @@ class basic_igzip_streambuf : public basic_streambuf<CharT, Traits> ...@@ -246,10 +246,13 @@ class basic_igzip_streambuf : public basic_streambuf<CharT, Traits>
zstream.avail_in = static_cast<uInt>(this->m_upstream->sgetn(m_in_buffer.data(), m_in_buffer.size())); zstream.avail_in = static_cast<uInt>(this->m_upstream->sgetn(m_in_buffer.data(), m_in_buffer.size()));
} }
if (zstream.avail_in == 0)
break;
int err = ::inflate(&zstream, Z_SYNC_FLUSH); int err = ::inflate(&zstream, Z_SYNC_FLUSH);
std::streamsize n = kBufferByteSize - zstream.avail_out; std::streamsize n = kBufferByteSize - zstream.avail_out;
if (err == Z_STREAM_END or (err == Z_OK and n > 0)) if (n > 0)
{ {
this->setg( this->setg(
m_out_buffer.data(), m_out_buffer.data(),
...@@ -258,6 +261,9 @@ class basic_igzip_streambuf : public basic_streambuf<CharT, Traits> ...@@ -258,6 +261,9 @@ class basic_igzip_streambuf : public basic_streambuf<CharT, Traits>
break; break;
} }
if (err == Z_STREAM_END and zstream.avail_in > 0)
err = ::inflateReset2(&zstream, 47);
if (err < Z_OK) if (err < Z_OK)
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment