]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/zstream.cpp
fixed handling of dst offset in wxAlphaBlend()
[wxWidgets.git] / src / common / zstream.cpp
index bea30dce41d3214724b8c2e1209beafa9c611f0f..083ac372fbad895ecd1f120cb4e7a8b1607ed1a6 100644 (file)
@@ -131,14 +131,16 @@ size_t wxZlibInputStream::OnSysRead(void *buffer, size_t size)
         break;
 
     case Z_STREAM_END:
-      // Unread any data taken from past the end of the deflate stream, so that
-      // any additional data can be read from the underlying stream (the crc
-      // in a gzip for example)
-      if (m_inflate->avail_in) {
-        m_parent_i_stream->Ungetch(m_inflate->next_in, m_inflate->avail_in);
-        m_inflate->avail_in = 0;
+      if (m_inflate->avail_out) {
+        // Unread any data taken from past the end of the deflate stream, so that
+        // any additional data can be read from the underlying stream (the crc
+        // in a gzip for example)
+        if (m_inflate->avail_in) {
+          m_parent_i_stream->Ungetch(m_inflate->next_in, m_inflate->avail_in);
+          m_inflate->avail_in = 0;
+        }
+        m_lasterror = wxSTREAM_EOF;
       }
-      m_lasterror = wxSTREAM_EOF;
       break;
 
     case Z_BUF_ERROR: