+ if (m_z_buffer) {
+ m_deflate = new z_stream_s;
+
+ if (m_deflate) {
+ memset(m_deflate, 0, sizeof(z_stream_s));
+ m_deflate->next_out = m_z_buffer;
+ m_deflate->avail_out = m_z_size;
+
+ // see zlib.h for documentation on windowBits
+ int windowBits = MAX_WBITS;
+ switch (flags) {
+ case wxZLIB_NO_HEADER: windowBits = -MAX_WBITS; break;
+ case wxZLIB_ZLIB: windowBits = MAX_WBITS; break;
+ case wxZLIB_GZIP: windowBits = MAX_WBITS | ZSTREAM_GZIP; break;
+ default: wxFAIL_MSG(wxT("Invalid zlib flag"));
+ }
+
+ if (deflateInit2(m_deflate, level, Z_DEFLATED, windowBits,
+ 8, Z_DEFAULT_STRATEGY) == Z_OK)
+ return;
+ }
+ }