diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2003-12-17 17:02:28 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2003-12-17 17:02:28 +0000 |
commit | 2408ca20d0c14bf1ccd4e1a27749f51774a7ece5 (patch) | |
tree | d9d355370493510bf2cae97b19b2fc7736328105 | |
parent | 44425aa1b387683310256b5fd9a849a19fad9e55 (diff) |
INTEGRATION: CWS geordi2q11 (1.10.94); FILE MERGED
2003/12/16 13:57:12 hr 1.10.94.1: #111934#: join CWS ooo111fix1
-rw-r--r-- | package/source/zipapi/Deflater.cxx | 32 | ||||
-rw-r--r-- | package/source/zipapi/Inflater.cxx | 30 |
2 files changed, 58 insertions, 4 deletions
diff --git a/package/source/zipapi/Deflater.cxx b/package/source/zipapi/Deflater.cxx index 20728a2a38b5..c26255f368fe 100644 --- a/package/source/zipapi/Deflater.cxx +++ b/package/source/zipapi/Deflater.cxx @@ -2,9 +2,9 @@ * * $RCSfile: Deflater.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: mtg $ $Date: 2001-11-15 20:16:11 $ + * last change: $Author: vg $ $Date: 2003-12-17 18:02:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,8 +62,12 @@ #include <Deflater.hxx> #endif #ifndef _ZLIB_H +#ifdef SYSTEM_ZLIB +#include <zlib.h> +#else #include <external/zlib/zlib.h> #endif +#endif #ifndef _VOS_DIAGNOSE_H_ #include <vos/diagnose.hxx> #endif @@ -150,7 +154,11 @@ sal_Int32 Deflater::doDeflateBytes (uno::Sequence < sal_Int8 > &rBuffer, sal_Int pStream->avail_in = nLength; pStream->avail_out = nNewLength; +#ifdef SYSTEM_ZLIB + nResult = deflateParams(pStream, nLevel, nStrategy); +#else nResult = z_deflateParams(pStream, nLevel, nStrategy); +#endif switch (nResult) { case Z_OK: @@ -174,7 +182,11 @@ sal_Int32 Deflater::doDeflateBytes (uno::Sequence < sal_Int8 > &rBuffer, sal_Int pStream->avail_in = nLength; pStream->avail_out = nNewLength; +#ifdef SYSTEM_ZLIB + nResult = deflate(pStream, bFinish ? Z_FINISH : Z_NO_FLUSH); +#else nResult = z_deflate(pStream, bFinish ? Z_FINISH : Z_NO_FLUSH); +#endif switch (nResult) { case Z_STREAM_END: @@ -220,7 +232,11 @@ void SAL_CALL Deflater::setDictionarySegment( const uno::Sequence< sal_Int8 >& r { // do error handling } +#ifdef SYSTEM_ZLIB + sal_Int32 nResult = deflateSetDictionary(pStream, (const unsigned char*)rBuffer.getConstArray()+nOffset, nLength); +#else sal_Int32 nResult = z_deflateSetDictionary(pStream, (const unsigned char*)rBuffer.getConstArray()+nOffset, nLength); +#endif } void SAL_CALL Deflater::setDictionary( const uno::Sequence< sal_Int8 >& rBuffer ) { @@ -230,7 +246,11 @@ void SAL_CALL Deflater::setDictionary( const uno::Sequence< sal_Int8 >& rBuffer VOS_DEBUG_ONLY("No stream!"); } +#ifdef SYSTEM_ZLIB + sal_Int32 nResult = deflateSetDictionary(pStream, (const unsigned char*)rBuffer.getConstArray(), rBuffer.getLength()); +#else sal_Int32 nResult = z_deflateSetDictionary(pStream, (const unsigned char*)rBuffer.getConstArray(), rBuffer.getLength()); +#endif } void SAL_CALL Deflater::setStrategy( sal_Int32 nNewStrategy ) { @@ -295,7 +315,11 @@ sal_Int32 SAL_CALL Deflater::getTotalOut( ) } void SAL_CALL Deflater::reset( ) { +#ifdef SYSTEM_ZLIB + deflateReset(pStream); +#else z_deflateReset(pStream); +#endif bFinish = sal_False; bFinished = sal_False; nOffset = nLength = 0; @@ -304,7 +328,11 @@ void SAL_CALL Deflater::end( ) { if (pStream != NULL) { +#ifdef SYSTEM_ZLIB + deflateEnd(pStream); +#else z_deflateEnd(pStream); +#endif delete pStream; } pStream = NULL; diff --git a/package/source/zipapi/Inflater.cxx b/package/source/zipapi/Inflater.cxx index de35612bf94c..457865ba3ee9 100644 --- a/package/source/zipapi/Inflater.cxx +++ b/package/source/zipapi/Inflater.cxx @@ -2,9 +2,9 @@ * * $RCSfile: Inflater.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: mtg $ $Date: 2001-11-15 20:17:02 $ + * last change: $Author: vg $ $Date: 2003-12-17 18:02:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,8 +62,12 @@ #include <Inflater.hxx> #endif #ifndef _ZLIB_H +#ifdef SYSTEM_ZLIB +#include <zlib.h> +#else #include <external/zlib/zlib.h> #endif +#endif #ifndef _VOS_DIAGNOSE_H_ #include <vos/diagnose.hxx> #endif @@ -133,8 +137,13 @@ void SAL_CALL Inflater::setDictionarySegment( const Sequence< sal_Int8 >& rBuffe { // do error handling } +#ifdef SYSTEM_ZLIB + inflateSetDictionary(pStream, (const unsigned char*)rBuffer.getConstArray() + nNewOffset, + nNewLength); +#else z_inflateSetDictionary(pStream, (const unsigned char*)rBuffer.getConstArray() + nNewOffset, nNewLength); +#endif } void SAL_CALL Inflater::setDictionary( const Sequence< sal_Int8 >& rBuffer ) @@ -143,8 +152,13 @@ void SAL_CALL Inflater::setDictionary( const Sequence< sal_Int8 >& rBuffer ) { // do error handling } +#ifdef SYSTEM_ZLIB + inflateSetDictionary(pStream, (const unsigned char*)rBuffer.getConstArray(), + rBuffer.getLength()); +#else z_inflateSetDictionary(pStream, (const unsigned char*)rBuffer.getConstArray(), rBuffer.getLength()); +#endif } sal_Int32 SAL_CALL Inflater::getRemaining( ) @@ -202,7 +216,11 @@ sal_Int32 SAL_CALL Inflater::getTotalOut( ) void SAL_CALL Inflater::reset( ) { +#ifdef SYSTEM_ZLIB + inflateReset(pStream); +#else z_inflateReset(pStream); +#endif bFinish = bNeedDict = bFinished = sal_False; nOffset = nLength = 0; } @@ -211,7 +229,11 @@ void SAL_CALL Inflater::end( ) { if (pStream != NULL) { +#ifdef SYSTEM_ZLIB + inflateEnd(pStream); +#else z_inflateEnd(pStream); +#endif delete pStream; } pStream = NULL; @@ -225,7 +247,11 @@ sal_Int32 Inflater::doInflateBytes (Sequence < sal_Int8 > &rBuffer, sal_Int32 n pStream->next_out = reinterpret_cast < unsigned char* > ( rBuffer.getArray() + nNewOffset ); pStream->avail_out = nNewLength; +#ifdef SYSTEM_ZLIB + nResult = ::inflate(pStream, bFinish ? Z_SYNC_FLUSH : Z_PARTIAL_FLUSH); +#else nResult = ::z_inflate(pStream, bFinish ? Z_SYNC_FLUSH : Z_PARTIAL_FLUSH); +#endif switch (nResult) { |