- }
- err = inflate(m_inflate, Z_FINISH);
- if (err == Z_STREAM_END)
- return (size - m_inflate->avail_out);
+ break;
+
+ case Z_BUF_ERROR:
+ // Indicates that zlib was expecting more data, but the parent stream
+ // has none. Other than Eof the error will have been already reported
+ // by the parent strean,
+ m_lasterror = wxSTREAM_READ_ERROR;
+ if (m_parent_i_stream->Eof())
+#if WXWIN_COMPATIBILITY_2_4
+ if (m_24compatibilty)
+ m_lasterror = wxSTREAM_EOF;
+ else
+#endif
+ wxLogError(_("Can't read inflate stream: unexpected EOF in underlying stream."));
+ break;
+
+ default:
+ wxString msg(m_inflate->msg, *wxConvCurrent);
+ if (!msg)
+ msg = wxString::Format(_("zlib error %d"), err);
+ wxLogError(_("Can't read from inflate stream: %s"), msg.c_str());
+ m_lasterror = wxSTREAM_READ_ERROR;