Kaydet (Commit) 5271e5b0 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

nMemUsage is always MAX_MEM_USAGE

...so just use zlib.h's MAX_MEM_LEVEL directly.

Change-Id: I76d73f665df242bfb180b76aa7054cf8ddbe9e67
üst f5e44ac7
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
#define DEFAULT_IN_BUFSIZE (0x00008000UL) #define DEFAULT_IN_BUFSIZE (0x00008000UL)
#define DEFAULT_OUT_BUFSIZE (0x00008000UL) #define DEFAULT_OUT_BUFSIZE (0x00008000UL)
#define MAX_MEM_USAGE 8
// memory requirement using compress: // memory requirement using compress:
// [ INBUFFER ] + [ OUTBUFFER ] + 128KB + 1 << (MEM_USAGE+9) // [ INBUFFER ] + [ OUTBUFFER ] + 128KB + 1 << (MEM_USAGE+9)
// memory requirement using decompress: // memory requirement using decompress:
...@@ -57,7 +55,6 @@ private: ...@@ -57,7 +55,6 @@ private:
sal_uIntPtr mbInit; sal_uIntPtr mbInit;
bool mbStatus; bool mbStatus;
bool mbFinish; bool mbFinish;
sal_uIntPtr mnMemUsage;
SvStream* mpIStm; SvStream* mpIStm;
sal_uInt8* mpInBuf; sal_uInt8* mpInBuf;
sal_uIntPtr mnInBufSize; sal_uIntPtr mnInBufSize;
...@@ -74,7 +71,7 @@ private: ...@@ -74,7 +71,7 @@ private:
void ImplWriteBack(); void ImplWriteBack();
public: public:
ZCodec( sal_uIntPtr nInBuf = DEFAULT_IN_BUFSIZE, sal_uIntPtr nOutBuf = DEFAULT_OUT_BUFSIZE, sal_uIntPtr nMemUsage = MAX_MEM_USAGE ); ZCodec( sal_uIntPtr nInBuf = DEFAULT_IN_BUFSIZE, sal_uIntPtr nOutBuf = DEFAULT_OUT_BUFSIZE );
virtual ~ZCodec(); virtual ~ZCodec();
virtual void BeginCompression( sal_uIntPtr nCompressMethod = ZCODEC_DEFAULT ); virtual void BeginCompression( sal_uIntPtr nCompressMethod = ZCODEC_DEFAULT );
......
...@@ -37,11 +37,10 @@ ...@@ -37,11 +37,10 @@
static const int gz_magic[2] = { 0x1f, 0x8b }; /* gzip magic header */ static const int gz_magic[2] = { 0x1f, 0x8b }; /* gzip magic header */
ZCodec::ZCodec( sal_uIntPtr nInBufSize, sal_uIntPtr nOutBufSize, sal_uIntPtr nMemUsage ) ZCodec::ZCodec( sal_uIntPtr nInBufSize, sal_uIntPtr nOutBufSize )
: mbInit(0) : mbInit(0)
, mbStatus(false) , mbStatus(false)
, mbFinish(false) , mbFinish(false)
, mnMemUsage(nMemUsage)
, mpIStm(NULL) , mpIStm(NULL)
, mpInBuf(NULL) , mpInBuf(NULL)
, mnInBufSize(nInBufSize) , mnInBufSize(nInBufSize)
...@@ -397,7 +396,7 @@ void ZCodec::ImplInitBuf ( bool nIOFlag ) ...@@ -397,7 +396,7 @@ void ZCodec::ImplInitBuf ( bool nIOFlag )
mbInit = 3; mbInit = 3;
mbStatus = ( deflateInit2_( PZSTREAM, mnCompressMethod & 0xff, Z_DEFLATED, mbStatus = ( deflateInit2_( PZSTREAM, mnCompressMethod & 0xff, Z_DEFLATED,
MAX_WBITS, mnMemUsage, ( mnCompressMethod >> 8 ) & 0xff, MAX_WBITS, MAX_MEM_LEVEL, ( mnCompressMethod >> 8 ) & 0xff,
ZLIB_VERSION, sizeof( z_stream ) ) >= 0 ); ZLIB_VERSION, sizeof( z_stream ) ) >= 0 );
PZSTREAM->next_out = mpOutBuf = new sal_uInt8[ PZSTREAM->avail_out = mnOutBufSize ]; PZSTREAM->next_out = mpOutBuf = new sal_uInt8[ PZSTREAM->avail_out = mnOutBufSize ];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment