diff options
Diffstat (limited to 'src/bzip2.cpp')
-rw-r--r-- | src/bzip2.cpp | 13 |
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 | ||
11 | using namespace Bu; | 13 | using 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 | ||
20 | Bu::BZip2::~BZip2() | 23 | Bu::BZip2::~BZip2() |
21 | { | 24 | { |
25 | TRACE(); | ||
22 | stop(); | 26 | stop(); |
23 | } | 27 | } |
24 | 28 | ||
25 | void Bu::BZip2::start() | 29 | void 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 | ||
36 | size_t Bu::BZip2::stop() | 41 | size_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 | ||
73 | void Bu::BZip2::bzError( int code ) | 79 | void 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 | ||
116 | size_t Bu::BZip2::read( void *pData, size_t nBytes ) | 123 | size_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 | ||
168 | size_t Bu::BZip2::write( const void *pData, size_t nBytes ) | 177 | size_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 | ||
199 | bool Bu::BZip2::isOpen() | 209 | bool Bu::BZip2::isOpen() |
200 | { | 210 | { |
211 | TRACE(); | ||
201 | return (bzState.state != NULL); | 212 | return (bzState.state != NULL); |
202 | } | 213 | } |
203 | 214 | ||