- m_lastread = size;
- return *this;
-}
-
-off_t wxZlibInputStream::SeekI(off_t WXUNUSED(pos), wxSeekMode WXUNUSED(mode))
-{
- return 0;
-}
-
-off_t wxZlibInputStream::TellI() const
-{
- return 0;
-}
+ if (err == 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;
+ }
+ m_lasterror = wxSTREAM_EOF;
+ } else if (err != Z_OK) {
+ wxString msg(m_inflate->msg, *wxConvCurrent);
+ if (!msg)
+ msg.Format(_("zlib error %d"), err);
+ wxLogError(_("Can't read from inflate stream: %s\n"), msg.c_str());
+ m_lasterror = wxSTREAM_READ_ERROR;
+ }