X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5824f314a3ac14fb4f4c8c2db7823076fedbbee8..236a9de39afa090fdee3cf91cb5364ceca69e3f8:/src/common/zstream.cpp diff --git a/src/common/zstream.cpp b/src/common/zstream.cpp index 24f763bf28..7ca4e3bac4 100644 --- a/src/common/zstream.cpp +++ b/src/common/zstream.cpp @@ -89,15 +89,19 @@ size_t wxZlibInputStream::OnSysRead(void *buffer, size_t size) m_inflate->next_in = m_z_buffer; m_inflate->avail_in = m_parent_i_stream->LastRead(); - if (m_parent_i_stream->LastError() != wxStream_NOERROR) - return (size - m_inflate->avail_in); + if (m_parent_i_stream->LastError() != wxStream_NOERROR && + m_parent_i_stream->LastError() != wxStream_EOF) + { + m_lasterror = m_parent_i_stream->LastError(); + return 0; // failed to read anything + } } err = inflate(m_inflate, Z_FINISH); if (err == Z_STREAM_END) - return (size - m_inflate->avail_in); + return (size - m_inflate->avail_out); } - return size-m_inflate->avail_in; + return size-m_inflate->avail_out; } //////////////////////