summaryrefslogtreecommitdiffstats
path: root/mtester.h
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 11:52:38 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 11:52:38 +0000
commitd296515f4777d1e4b7d78e6aa8ea698162bfbc2b (patch)
tree3a4ce9f245a9eb30538daa0b9b62c16146d9ad0e /mtester.h
parentAdding debian version 1.17-1. (diff)
downloadlziprecover-d296515f4777d1e4b7d78e6aa8ea698162bfbc2b.tar.xz
lziprecover-d296515f4777d1e4b7d78e6aa8ea698162bfbc2b.zip
Merging upstream version 1.18~pre1.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'mtester.h')
-rw-r--r--mtester.h39
1 files changed, 20 insertions, 19 deletions
diff --git a/mtester.h b/mtester.h
index f4da88f..795d8e4 100644
--- a/mtester.h
+++ b/mtester.h
@@ -37,16 +37,16 @@ public:
at_stream_end( false )
{}
- void load()
- {
- for( int i = 0; i < 5; ++i ) code = (code << 8) | get_byte();
- code &= range; // make sure that first byte is discarded
- }
-
bool code_is_zero() const { return ( code == 0 ); }
bool finished() { return pos >= buffer_size; }
long member_position() const { return pos; }
+ uint8_t get_byte()
+ {
+ if( finished() ) return 0xAA; // make code != 0
+ return buffer[pos++];
+ }
+
const File_trailer * get_trailer()
{
if( buffer_size - pos < File_trailer::size ) return 0;
@@ -55,10 +55,10 @@ public:
return p;
}
- uint8_t get_byte()
+ void load()
{
- if( finished() ) return 0xAA; // make code != 0
- return buffer[pos++];
+ for( int i = 0; i < 5; ++i ) code = (code << 8) | get_byte();
+ code &= range; // make sure that first byte is discarded
}
void normalize()
@@ -195,13 +195,13 @@ class LZ_mtester
Range_mtester rdec;
const unsigned dictionary_size;
const int buffer_size;
- uint8_t * buffer; // output buffer
- int pos; // current pos in buffer
- int stream_pos; // first byte not yet written to file
+ uint8_t * buffer; /* output buffer */
+ int pos; /* current pos in buffer */
+ int stream_pos; /* first byte not yet written to file */
uint32_t crc_;
- unsigned rep0; // rep[0-3] latest four distances
- unsigned rep1; // used for efficient coding of
- unsigned rep2; // repeated distances
+ unsigned rep0; /* rep[0-3] latest four distances */
+ unsigned rep1; /* used for efficient coding of */
+ unsigned rep2; /* repeated distances */
unsigned rep3;
State state;
@@ -219,18 +219,17 @@ class LZ_mtester
Len_model match_len_model;
Len_model rep_len_model;
- unsigned long long stream_position() const
- { return partial_data_pos + stream_pos; }
void flush_data();
bool verify_trailer();
+ void print_block( const int len );
- uint8_t get_prev_byte() const
+ uint8_t peek_prev() const
{
const int i = ( ( pos > 0 ) ? pos : buffer_size ) - 1;
return buffer[i];
}
- uint8_t get_byte( const int distance ) const
+ uint8_t peek( const int distance ) const
{
int i = pos - distance - 1;
if( i < 0 ) i += buffer_size;
@@ -289,6 +288,8 @@ public:
void duplicate_buffer();
int test_member( const long pos_limit = LONG_MAX );
+ int debug_decode_member( const long long dpos, const long long mpos,
+ const bool show_packets );
};