From 55244c8fd50dfda9c7c434cd05fc6280204447dd Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 11 Jun 2007 07:58:18 +0000 Subject: Wow that was a stupid bug. OK, decompression is working really well, and it corrects the underlying stream's position if it can seek, otherwise you just lose data (for now). --- src/bzip2.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/bzip2.cpp b/src/bzip2.cpp index 6bb1429..d3f237a 100644 --- a/src/bzip2.cpp +++ b/src/bzip2.cpp @@ -64,13 +64,9 @@ void Bu::BZip2::bzError( int code ) switch( code ) { case BZ_OK: - printf("\n"); return; case BZ_RUN_OK: - printf("\n"); return; case BZ_FLUSH_OK: - printf("\n"); return; case BZ_FINISH_OK: - printf("\n"); return; return; case BZ_CONFIG_ERROR: @@ -120,19 +116,16 @@ size_t Bu::BZip2::read( void *pData, size_t nBytes ) int nRead = 0; int nReadTotal = bzState.total_out_lo32; + bzState.next_out = (char *)pData; + bzState.avail_out = nBytes; for(;;) { - bzState.next_out = (char *)pData; - bzState.avail_out = nBytes; - printf(" (pre) in: %db, out: %db\n", bzState.avail_in, bzState.avail_out ); int ret = BZ2_bzDecompress( &bzState ); - printf("(post) in: %db, out: %db\n", bzState.avail_in, bzState.avail_out ); nReadTotal += nRead-bzState.avail_out; if( ret == BZ_STREAM_END ) { - printf("\n"); if( bzState.avail_in > 0 ) { if( rNext.canSeek() ) @@ -146,8 +139,6 @@ size_t Bu::BZip2::read( void *pData, size_t nBytes ) if( bzState.avail_out ) { - printf("Still more to fill, in: %db, out: %db\n", bzState.avail_in, bzState.avail_out ); - if( bzState.avail_in == 0 ) { nRead = rNext.read( pBuf, nBufSize ); -- cgit v1.2.3