+ m_pos = 0;
+
+ if (m_z_buffer) {
+ m_inflate = new z_stream_s;
+
+ if (m_inflate) {
+ m_inflate->zalloc = (alloc_func)0;
+ m_inflate->zfree = (free_func)0;
+ m_inflate->opaque = (voidpf)0;
+ m_inflate->avail_in = 0;
+ m_inflate->next_in = NULL;
+ m_inflate->next_out = NULL;
+
+ wxASSERT((flags & ~(wxZLIB_ZLIB | wxZLIB_GZIP)) == 0);
+
+ // when autodetecting between gzip & zlib, silently drop gzip flag
+ // if the version of zlib doesn't support it
+ if (flags == (wxZLIB_ZLIB | wxZLIB_GZIP)
+ && strcmp(zlib_version, "1.2.") < 0)
+ flags &= ~wxZLIB_GZIP;
+
+ int bits = flags ? MAX_WBITS : -MAX_WBITS;
+ if (flags & wxZLIB_GZIP)
+ bits |= (flags & wxZLIB_ZLIB) ? 0x20 : 0x10;
+
+ if (inflateInit2(m_inflate, bits) == Z_OK)
+ return;
+ }
+ }