--- a/BZip2Stream.st Tue Jul 26 10:51:00 2005 +0200
+++ b/BZip2Stream.st Mon Aug 01 14:37:49 2005 +0200
@@ -90,70 +90,68 @@
!
zdeflate
- "low level - deflate
- "
+ "low level - deflate"
+
|errorNo|
-
errorNo := nil.
-
%{
OBJ _zstreamObj = __INST( zstream );
if( _zstreamObj != nil )
{
- int _errorNo, _action;
- unsigned int _bfsize;
- zstream_s * _zstream = (zstream_s *) __externalBytesAddress( _zstreamObj );
+ int _errorNo, _action;
+ unsigned int _bfsize;
+ zstream_s * _zstream = (zstream_s *) __externalBytesAddress( _zstreamObj );
- if( _zstream->op_mode != e_opmode_deflate )
- RETURN( nil );
+ if( _zstream->op_mode != e_opmode_deflate )
+ RETURN( nil );
- _bfsize = _zstream->out_total;
+ _bfsize = _zstream->out_total;
- if( _zstream->stream.state == NULL )
- {
- _zstream->op_mode = e_opmode_unspecified;
- RETURN( nil );
- }
- _action = (__INST(hitEOF) == true) ? BZ_FINISH : BZ_RUN;
+ if( _zstream->stream.state == NULL )
+ {
+ _zstream->op_mode = e_opmode_unspecified;
+ RETURN( nil );
+ }
+ _action = (__INST(hitEOF) == true) ? BZ_FINISH : BZ_RUN;
- _zstream->stream.avail_out = _bfsize;
- _zstream->stream.next_out = _zstream->out_ref;
+ _zstream->stream.avail_out = _bfsize;
+ _zstream->stream.next_out = _zstream->out_ref;
- _errorNo = BZ2_bzCompress( & _zstream->stream, _action );
+ _errorNo = BZ2_bzCompress( & _zstream->stream, _action );
- if( _errorNo == BZ_STREAM_END )
- {
- _zstream->stream.avail_in = 0;
- _zstream->stream.next_in = NULL;
- _errorNo = BZ2_bzCompressEnd( & _zstream->stream );
- }
+ if( _errorNo == BZ_STREAM_END )
+ {
+ _zstream->stream.avail_in = 0;
+ _zstream->stream.next_in = NULL;
+ _errorNo = BZ2_bzCompressEnd( & _zstream->stream );
+ }
- if( (_errorNo == BZ_OK)
- || (_errorNo == BZ_RUN_OK)
- || (_errorNo == BZ_FINISH_OK)
- )
- {
- if( (_zstream->stream.avail_out != _bfsize)
- || (_zstream->stream.avail_in != 0)
- )
- RETURN( true );
+ if( (_errorNo == BZ_OK)
+ || (_errorNo == BZ_RUN_OK)
+ || (_errorNo == BZ_FINISH_OK)
+ )
+ {
+ if( (_zstream->stream.avail_out != _bfsize)
+ || (_zstream->stream.avail_in != 0)
+ )
+ RETURN( true );
- RETURN( false );
- }
- errorNo = __MKSMALLINT( _errorNo );
+ RETURN( false );
+ }
+ errorNo = __MKSMALLINT( _errorNo );
}
%}.
errorNo ifNil:[
- zstream ifNil:[self errorNotOpen].
- self invalidArguments.
+ zstream ifNil:[self errorNotOpen].
+ self invalidArgument.
].
self zerror:errorNo.
!
zdeflateInit
- "low level - open for reading
- "
+ "low level - open for reading"
+
|errorNo blockSize100k workFactor|
errorNo := nil.
@@ -164,23 +162,23 @@
if( (_zstreamObj != nil) && __bothSmallInteger(blockSize100k, workFactor) )
{
- int _errorNo;
- zstream_s * _zstream = (zstream_s *) __externalBytesAddress( _zstreamObj );
+ int _errorNo;
+ zstream_s * _zstream = (zstream_s *) __externalBytesAddress( _zstreamObj );
- _zstream->op_mode = e_opmode_deflate;
+ _zstream->op_mode = e_opmode_deflate;
- _errorNo = BZ2_bzCompressInit( & _zstream->stream
- , __intVal( blockSize100k ), 0, __intVal( workFactor ) );
+ _errorNo = BZ2_bzCompressInit( & _zstream->stream
+ , __intVal( blockSize100k ), 0, __intVal( workFactor ) );
- if( _errorNo == BZ_OK )
- RETURN( self );
+ if( _errorNo == BZ_OK )
+ RETURN( self );
- errorNo = __MKSMALLINT( _errorNo );
+ errorNo = __MKSMALLINT( _errorNo );
}
%}.
errorNo ifNil:[
- zstream ifNil:[ self errorNotOpen ].
- self invalidArguments .
+ zstream ifNil:[ self errorNotOpen ].
+ self invalidArgument.
].
self zerror:errorNo.
!
@@ -325,35 +323,34 @@
!
zset_avail_in:count
- "set the 'avail_in'
- "
+ "set the 'avail_in'"
%{
OBJ _zstreamObj = __INST( zstream );
if( (_zstreamObj != nil) && __isSmallInteger(count) )
{
- int _count;
- zstream_s * _zstream = (zstream_s *) __externalBytesAddress( _zstreamObj );
+ int _count;
+ zstream_s * _zstream = (zstream_s *) __externalBytesAddress( _zstreamObj );
- if( (_count = __intVal( count )) > 0 )
- {
- char * _in_ref = _zstream->in_ref;
+ if( (_count = __intVal( count )) > 0 )
+ {
+ char * _in_ref = _zstream->in_ref;
- _zstream->stream.avail_in = _count;
- _zstream->stream.next_in = _in_ref;
- } else {
- _zstream->stream.avail_in = 0;
- _zstream->stream.next_in = NULL;
- }
- RETURN( self );
+ _zstream->stream.avail_in = _count;
+ _zstream->stream.next_in = _in_ref;
+ } else {
+ _zstream->stream.avail_in = 0;
+ _zstream->stream.next_in = NULL;
+ }
+ RETURN( self );
}
%}.
zstream ifNil:[ self errorNotOpen ].
- self invalidArguments.
+ self invalidArgument.
! !
!BZip2Stream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/BZip2Stream.st,v 1.8 2005-07-08 17:30:34 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/BZip2Stream.st,v 1.9 2005-08-01 12:37:43 stefan Exp $'
! !