aboutsummaryrefslogtreecommitdiff
path: root/src/bzip2.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2008-09-24 19:31:37 +0000
committerMike Buland <eichlan@xagasoft.com>2008-09-24 19:31:37 +0000
commit1ca201c4151ce6e4ac4921c641fec7d21d64752c (patch)
treec8e6a63ec39a979fa8706284b43efd5b2d69e17f /src/bzip2.cpp
parentdea750e9470f1be61f8afd3eb0ee45a57ed4976a (diff)
downloadlibbu++-1ca201c4151ce6e4ac4921c641fec7d21d64752c.tar.gz
libbu++-1ca201c4151ce6e4ac4921c641fec7d21d64752c.tar.bz2
libbu++-1ca201c4151ce6e4ac4921c641fec7d21d64752c.tar.xz
libbu++-1ca201c4151ce6e4ac4921c641fec7d21d64752c.zip
Something may be wrong.
Diffstat (limited to '')
-rw-r--r--src/bzip2.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/bzip2.cpp b/src/bzip2.cpp
index 9108bcf..c367cff 100644
--- a/src/bzip2.cpp
+++ b/src/bzip2.cpp
@@ -7,6 +7,8 @@
7 7
8#include "bu/bzip2.h" 8#include "bu/bzip2.h"
9#include "bu/exceptions.h" 9#include "bu/exceptions.h"
10#define BU_TRACE
11#include "bu/trace.h"
10 12
11using namespace Bu; 13using namespace Bu;
12 14
@@ -14,16 +16,19 @@ Bu::BZip2::BZip2( Bu::Stream &rNext, int nCompression ) :
14 Bu::Filter( rNext ), 16 Bu::Filter( rNext ),
15 nCompression( nCompression ) 17 nCompression( nCompression )
16{ 18{
19 TRACE( nCompression );
17 start(); 20 start();
18} 21}
19 22
20Bu::BZip2::~BZip2() 23Bu::BZip2::~BZip2()
21{ 24{
25 TRACE();
22 stop(); 26 stop();
23} 27}
24 28
25void Bu::BZip2::start() 29void Bu::BZip2::start()
26{ 30{
31 TRACE();
27 bzState.state = NULL; 32 bzState.state = NULL;
28 bzState.bzalloc = NULL; 33 bzState.bzalloc = NULL;
29 bzState.bzfree = NULL; 34 bzState.bzfree = NULL;
@@ -35,6 +40,7 @@ void Bu::BZip2::start()
35 40
36size_t Bu::BZip2::stop() 41size_t Bu::BZip2::stop()
37{ 42{
43 TRACE();
38 if( bzState.state ) 44 if( bzState.state )
39 { 45 {
40 if( bReading ) 46 if( bReading )
@@ -72,6 +78,7 @@ size_t Bu::BZip2::stop()
72 78
73void Bu::BZip2::bzError( int code ) 79void Bu::BZip2::bzError( int code )
74{ 80{
81 TRACE( code );
75 switch( code ) 82 switch( code )
76 { 83 {
77 case BZ_OK: 84 case BZ_OK:
@@ -115,10 +122,12 @@ void Bu::BZip2::bzError( int code )
115 122
116size_t Bu::BZip2::read( void *pData, size_t nBytes ) 123size_t Bu::BZip2::read( void *pData, size_t nBytes )
117{ 124{
125 TRACE( pData, nBytes );
126 printf("READ!!!\n");
118 if( !bzState.state ) 127 if( !bzState.state )
119 { 128 {
120 bReading = true; 129 bReading = true;
121 BZ2_bzDecompressInit( &bzState, 0, 0 ); 130 BZ2_bzDecompressInit( &bzState, 7, 0 );
122 bzState.next_in = pBuf; 131 bzState.next_in = pBuf;
123 bzState.avail_in = 0; 132 bzState.avail_in = 0;
124 } 133 }
@@ -167,6 +176,7 @@ size_t Bu::BZip2::read( void *pData, size_t nBytes )
167 176
168size_t Bu::BZip2::write( const void *pData, size_t nBytes ) 177size_t Bu::BZip2::write( const void *pData, size_t nBytes )
169{ 178{
179 TRACE( pData, nBytes );
170 if( !bzState.state ) 180 if( !bzState.state )
171 { 181 {
172 bReading = false; 182 bReading = false;
@@ -198,6 +208,7 @@ size_t Bu::BZip2::write( const void *pData, size_t nBytes )
198 208
199bool Bu::BZip2::isOpen() 209bool Bu::BZip2::isOpen()
200{ 210{
211 TRACE();
201 return (bzState.state != NULL); 212 return (bzState.state != NULL);
202} 213}
203 214