]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/zstream.cpp
moved wxDash typedef to gdicmn.h
[wxWidgets.git] / src / common / zstream.cpp
index 24f763bf289b6de153680790016a4dcb21c82d84..7ca4e3bac4bdb934b807f177fb14dbea0f959a93 100644 (file)
@@ -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;
 }
 
 //////////////////////