# HG changeset patch # User ca # Date 1249303850 -7200 # Node ID db70507b21ba8045ea16907f3d4676fe138f2452 # Parent aa40ad91e77af4315769062fc3ad11a2f34cee7b suppress header & checksum configurable diff -r aa40ad91e77a -r db70507b21ba ZipStream.st --- a/ZipStream.st Fri Jul 31 14:15:06 2009 +0200 +++ b/ZipStream.st Mon Aug 03 14:50:50 2009 +0200 @@ -443,10 +443,12 @@ zdeflateInit "low level - deflateInit" - |errorNo level| + |errorNo level windowBits| errorNo := nil. level := BlockSize. + windowBits := self zget_windowBits. + %{ OBJ _zstreamObj = __INST( zstream ); @@ -460,7 +462,7 @@ _errorNo = deflateInit2( & _zstream->stream , __intVal( level ) , Z_DEFLATED - , MAX_WBITS + , __intVal( windowBits ) , DEF_MEM_LEVEL , Z_DEFAULT_STRATEGY ); @@ -497,6 +499,22 @@ self errorNotOpen. ! +zget_windowBits + "answer the bits used for inflateInit2 or deflateInit2... + a negative WindowBits value suppresses the zlib header and the checksum..." + + |windowBits| +%{ + windowBits = __MKSMALLINT( MAX_WBITS ); +%}. + + self isHeaderAndChecksumSuppressed ifTrue:[ + "/ undocumented feature..... + ^ windowBits negated + ]. + ^ windowBits +! + zinflate "low level - inflate " @@ -599,9 +617,10 @@ zinflateInit "low level - inflateInit " - |errorNo| + |errorNo windowBits| errorNo := nil. + windowBits := self zget_windowBits. %{ OBJ _zstreamObj = __INST( zstream ); @@ -612,7 +631,9 @@ zstream_s * _zstream = (zstream_s *) __externalBytesAddress( _zstreamObj ); _zstream->op_mode = e_opmode_inflate; - _errorNo = inflateInit2( & _zstream->stream, MAX_WBITS ); + _errorNo = inflateInit2 ( & _zstream->stream + , __intVal( windowBits ) + ); if( _errorNo == Z_OK ) RETURN( self ); @@ -774,7 +795,7 @@ !ZipStream class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic2/ZipStream.st,v 1.34 2009-07-31 11:16:42 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic2/ZipStream.st,v 1.35 2009-08-03 12:50:50 ca Exp $' ! ! ZipStream initialize!