#include <LZBuffer.hpp>
Inheritance diagram for LZBuffer::
Protected Methods | |
LZBuffer () | |
~LZBuffer () | |
void | _toBuf (BYTE) |
void | _toBuf (const BYTE *, size_t sz) |
void | _bufCpy (BYTE *dst, int pos, size_t sz) |
int | _nMatch (int pos, const BYTE *p, int nLimit) |
Static Protected Methods | |
int | _wrap (LZPOS pos) |
int | _distance (int diff) |
Protected Attributes | |
BYTE * | buf |
LZPOS | bufPos |
|
Definition at line 4 of file LZBuffer.cpp. 00005 { 00006 buf = new BYTE[ LZBUFSIZE ]; 00007 bufPos = 0; 00008 } |
|
Definition at line 10 of file LZBuffer.cpp. 00011 { 00012 delete [] buf; 00013 } |
|
Definition at line 50 of file LZBuffer.cpp. Referenced by LZHLDecompressor::decompress().
00051 { 00052 assert( sz < LZBUFSIZE ); 00053 int begin = _wrap( pos ); 00054 int end = begin + sz; 00055 00056 if ( end > LZBUFSIZE ) 00057 { 00058 size_t left = LZBUFSIZE - begin; 00059 memcpy( dst, buf + begin, left ); 00060 memcpy( dst + left, buf, sz - left ); 00061 } 00062 else 00063 { 00064 memcpy( dst, buf + begin, sz ); 00065 } 00066 } |
|
Definition at line 20 of file LZBuffer.cpp. Referenced by LZHLCompressor::compress().
00021 { 00022 return ( diff & LZBUFMASK ); 00023 } |
|
Definition at line 68 of file LZBuffer.cpp. Referenced by LZHLCompressor::compress().
00069 { 00070 assert( nLimit < LZBUFSIZE ); 00071 int begin = pos; 00072 if ( LZBUFSIZE - begin >= nLimit ) 00073 { 00074 for ( int i = 0; i < nLimit ; i++ ) 00075 if ( buf[ begin + i ] != p[ i ] ) 00076 return i; 00077 00078 return nLimit; 00079 00080 } 00081 else 00082 { 00083 for ( int i = begin; i < LZBUFSIZE ; i++ ) 00084 if ( buf[ i ] != p[ i - begin ] ) 00085 return i - begin; 00086 00087 int shift = LZBUFSIZE - begin; 00088 int n = nLimit - shift; 00089 00090 for( i = 0; i < n ; i++ ) 00091 if( buf[ i ] != p[ shift + i ] ) 00092 return shift + i; 00093 00094 return nLimit; 00095 } 00096 } |
|
Definition at line 30 of file LZBuffer.cpp. 00031 { 00032 assert( sz < LZBUFSIZE ); 00033 int begin = _wrap( bufPos ); 00034 int end = begin + sz; 00035 00036 if ( end > LZBUFSIZE ) 00037 { 00038 size_t left = LZBUFSIZE - begin; 00039 memcpy( buf + begin, src, left ); 00040 memcpy( buf, src + left, sz - left ); 00041 } 00042 else 00043 { 00044 memcpy( buf + begin, src, sz ); 00045 } 00046 00047 bufPos += sz; 00048 } |
|
Definition at line 25 of file LZBuffer.cpp. Referenced by LZHLCompressor::compress(), and LZHLDecompressor::decompress().
00026 { 00027 buf[ _wrap( bufPos++ ) ] = c; 00028 } |
|
Definition at line 15 of file LZBuffer.cpp. Referenced by _bufCpy(), _toBuf(), LZHLCompressor::_updateTable(), and LZHLCompressor::compress().
00016 { 00017 return ( pos & LZBUFMASK ); 00018 } |
|
Definition at line 19 of file LZBuffer.hpp. |
|
Definition at line 20 of file LZBuffer.hpp. |