[Libreoffice-commits] core.git: 18 commits - filter/source include/tools sfx2/source svx/source tools/source vcl/source vcl/unx

Stephan Bergmann sbergman at redhat.com
Wed May 21 06:30:53 PDT 2014


 filter/source/svg/svgfilter.cxx       |    4 +-
 filter/source/svg/svgimport.cxx       |    4 +-
 include/tools/zcodec.hxx              |   61 +++++++---------------------------
 sfx2/source/doc/docmacromode.cxx      |    2 -
 svx/source/xml/xmlgrhlp.cxx           |    2 -
 tools/source/zcodec/zcodec.cxx        |   59 ++++++++++++--------------------
 vcl/source/filter/graphicfilter.cxx   |    8 ++--
 vcl/source/gdi/pdfwriter_impl.cxx     |   19 +++++-----
 vcl/source/gdi/pngread.cxx            |   16 +++-----
 vcl/source/gdi/pngwrite.cxx           |   33 +++++++-----------
 vcl/unx/generic/printer/ppdparser.cxx |   12 +-----
 11 files changed, 77 insertions(+), 143 deletions(-)

New commits:
commit 1b0402f87c9b17fef2141130bfaa1798ece6ba0d
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue May 20 14:55:40 2014 +0200

    Use varying aElement name
    
    Change-Id: Idc135ef5031a01961cc18d897a734b598bc833f4

diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx
index 2108d19..4d4ae52 100644
--- a/sfx2/source/doc/docmacromode.cxx
+++ b/sfx2/source/doc/docmacromode.cxx
@@ -342,7 +342,7 @@ namespace sfx2
                             if( aElement == aStdLibName || aElement == aVBAProject )
                             {
                                 Reference < XNameAccess > xLib;
-                                Any aAny = xContainer->getByName( aStdLibName );
+                                Any aAny = xContainer->getByName( aElement );
                                 aAny >>= xLib;
                                 if ( xLib.is() && xLib->hasElements() )
                                     return true;
commit 4d2113250fa7ed62fe2c53ed0f76e3de5875cb81
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed May 21 14:33:20 2014 +0200

    ZCodec::UpdateCRC is private
    
    Change-Id: I2103f8a323d0454bdd1c779aadb99889ae1cf6e5

diff --git a/include/tools/zcodec.hxx b/include/tools/zcodec.hxx
index 97f3ad0..5dc6723 100644
--- a/include/tools/zcodec.hxx
+++ b/include/tools/zcodec.hxx
@@ -50,6 +50,8 @@ private:
     void            ImplInitBuf( bool nIOFlag );
     void            ImplWriteBack();
 
+    void            UpdateCRC( sal_uInt8* pSource, long nDatSize );
+
 public:
                     ZCodec( sal_uIntPtr nInBuf = 0x8000UL, sal_uIntPtr nOutBuf = 0x8000UL );
                     ~ZCodec();
@@ -67,7 +69,6 @@ public:
     void            SetBreak( sal_uIntPtr );
     sal_uIntPtr     GetBreak();
     void            SetCRC( sal_uIntPtr nCurrentCRC );
-    sal_uIntPtr     UpdateCRC( sal_uIntPtr nLatestCRC, sal_uInt8* pSource, long nDatSize );
     sal_uIntPtr     GetCRC();
 };
 
diff --git a/tools/source/zcodec/zcodec.cxx b/tools/source/zcodec/zcodec.cxx
index a672e76..23abb0b 100644
--- a/tools/source/zcodec/zcodec.cxx
+++ b/tools/source/zcodec/zcodec.cxx
@@ -159,7 +159,7 @@ long ZCodec::Decompress( SvStream& rIStm, SvStream& rOStm )
             mnInToRead -= nInToRead;
 
             if ( mbUpdateCrc )
-                mnCRC = UpdateCRC( mnCRC, mpInBuf, nInToRead );
+                UpdateCRC( mpInBuf, nInToRead );
 
         }
         err = inflate( PZSTREAM, Z_NO_FLUSH );
@@ -228,7 +228,7 @@ long ZCodec::Read( SvStream& rIStm, sal_uInt8* pData, sal_uIntPtr nSize )
             mnInToRead -= nInToRead;
 
             if ( mbUpdateCrc )
-                mnCRC = UpdateCRC( mnCRC, mpInBuf, nInToRead );
+                UpdateCRC( mpInBuf, nInToRead );
 
         }
         err = inflate( PZSTREAM, Z_NO_FLUSH );
@@ -282,7 +282,7 @@ long ZCodec::ReadAsynchron( SvStream& rIStm, sal_uInt8* pData, sal_uIntPtr nSize
             mnInToRead -= nInToRead;
 
             if ( mbUpdateCrc )
-                mnCRC = UpdateCRC( mnCRC, mpInBuf, nInToRead );
+                UpdateCRC( mpInBuf, nInToRead );
 
         }
         err = inflate( PZSTREAM, Z_NO_FLUSH );
@@ -309,7 +309,7 @@ void ZCodec::ImplWriteBack()
     if ( nAvail )
     {
         if ( mbInit & 2 && mbUpdateCrc )
-            mnCRC = UpdateCRC( mnCRC, mpOutBuf, nAvail );
+            UpdateCRC( mpOutBuf, nAvail );
         mpOStm->Write( PZSTREAM->next_out = mpOutBuf, nAvail );
         PZSTREAM->avail_out = mnOutBufSize;
     }
@@ -408,9 +408,9 @@ void ZCodec::ImplInitBuf ( bool nIOFlag )
     }
 }
 
-sal_uIntPtr ZCodec::UpdateCRC ( sal_uIntPtr nLatestCRC, sal_uInt8* pSource, long nDatSize)
+void ZCodec::UpdateCRC ( sal_uInt8* pSource, long nDatSize)
 {
-    return rtl_crc32( nLatestCRC, pSource, nDatSize );
+    mnCRC = rtl_crc32( mnCRC, pSource, nDatSize );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit b928cfb512800e6bf947490a42af2e4ce6d6d6f2
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed May 21 14:30:59 2014 +0200

    Remove unused ZCodec::IsFinished
    
    Change-Id: I9741daf288c11dc8e0f0ad2f64e934e814c3ef8a

diff --git a/include/tools/zcodec.hxx b/include/tools/zcodec.hxx
index 4644433..97f3ad0 100644
--- a/include/tools/zcodec.hxx
+++ b/include/tools/zcodec.hxx
@@ -56,7 +56,6 @@ public:
 
     void            BeginCompression( int nCompressLevel = ZCODEC_DEFAULT_COMPRESSION, bool updateCrc = false, bool gzLib = false );
     long            EndCompression();
-    bool            IsFinished () const { return mbFinish; }
 
     long            Compress( SvStream& rIStm, SvStream& rOStm );
     long            Decompress( SvStream& rIStm, SvStream& rOStm );
commit 46d442860a1252f7260c97b1f629ce8e77f72a3a
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed May 21 14:30:40 2014 +0200

    ZCodec instances can be allocated on the stack just fine
    
    Change-Id: I4b185f9a0ecaa74ca3f1e93b3bfe504e9778a8ca

diff --git a/vcl/source/gdi/pngwrite.cxx b/vcl/source/gdi/pngwrite.cxx
index 9057a4822..9f35f02 100644
--- a/vcl/source/gdi/pngwrite.cxx
+++ b/vcl/source/gdi/pngwrite.cxx
@@ -49,7 +49,6 @@ public:
 
                 PNGWriterImpl( const BitmapEx& BmpEx,
                     const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData = NULL );
-                ~PNGWriterImpl();
 
     bool    Write( SvStream& rOStm );
 
@@ -66,7 +65,7 @@ private:
 
     BitmapReadAccess*   mpAccess;
     BitmapReadAccess*   mpMaskAccess;
-    ZCodec*             mpZCodec;
+    ZCodec              mpZCodec;
 
     sal_uInt8*              mpDeflateInBuf;         // as big as the size of a scanline + alphachannel + 1
     sal_uInt8*              mpPreviousScan;         // as big as mpDeflateInBuf
@@ -102,7 +101,6 @@ PNGWriterImpl::PNGWriterImpl( const BitmapEx& rBmpEx,
     , mbStatus(true)
     , mpAccess(NULL)
     , mpMaskAccess(NULL)
-    , mpZCodec(new ZCodec)
     , mpDeflateInBuf(NULL)
     , mpPreviousScan(NULL)
     , mpCurrentScan(NULL)
@@ -240,11 +238,6 @@ PNGWriterImpl::PNGWriterImpl( const BitmapEx& rBmpEx,
     }
 }
 
-PNGWriterImpl::~PNGWriterImpl()
-{
-    delete mpZCodec;
-}
-
 bool PNGWriterImpl::Write( SvStream& rOStm )
 {
    /* png signature is always an array of 8 bytes */
@@ -386,56 +379,56 @@ void PNGWriterImpl::ImplWriteIDAT ()
         mpCurrentScan = new sal_uInt8[ mnDeflateInSize ];
         ImplClearFirstScanline();
     }
-    mpZCodec->BeginCompression( mnCompLevel, true );
-    mpZCodec->SetCRC( mnCRC );
+    mpZCodec.BeginCompression( mnCompLevel, true );
+    mpZCodec.SetCRC( mnCRC );
     SvMemoryStream aOStm;
     if ( mnInterlaced == 0 )
     {
         for ( sal_uLong nY = 0; nY < mnHeight; nY++ )
-            mpZCodec->Write( aOStm, mpDeflateInBuf, ImplGetFilter( nY ) );
+            mpZCodec.Write( aOStm, mpDeflateInBuf, ImplGetFilter( nY ) );
     }
     else
     {
         // interlace mode
         sal_uLong nY;
         for ( nY = 0; nY < mnHeight; nY+=8 )                                                // pass 1
-            mpZCodec->Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 0, 8 ) );
+            mpZCodec.Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 0, 8 ) );
         ImplClearFirstScanline();
 
         for ( nY = 0; nY < mnHeight; nY+=8 )                                                // pass 2
-            mpZCodec->Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 4, 8 ) );
+            mpZCodec.Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 4, 8 ) );
         ImplClearFirstScanline();
 
         if ( mnHeight >= 5 )                                                                // pass 3
         {
             for ( nY = 4; nY < mnHeight; nY+=8 )
-                mpZCodec->Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 0, 4 ) );
+                mpZCodec.Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 0, 4 ) );
             ImplClearFirstScanline();
         }
 
         for ( nY = 0; nY < mnHeight; nY+=4 )                                                // pass 4
-            mpZCodec->Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 2, 4 ) );
+            mpZCodec.Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 2, 4 ) );
         ImplClearFirstScanline();
 
         if ( mnHeight >= 3 )                                                                // pass 5
         {
             for ( nY = 2; nY < mnHeight; nY+=4 )
-                mpZCodec->Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 0, 2 ) );
+                mpZCodec.Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 0, 2 ) );
             ImplClearFirstScanline();
         }
 
         for ( nY = 0; nY < mnHeight; nY+=2 )                                                // pass 6
-            mpZCodec->Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 1, 2 ) );
+            mpZCodec.Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 1, 2 ) );
         ImplClearFirstScanline();
 
         if ( mnHeight >= 2 )                                                                // pass 7
         {
             for ( nY = 1; nY < mnHeight; nY+=2 )
-                mpZCodec->Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 0, 1 ) );
+                mpZCodec.Write( aOStm, mpDeflateInBuf, ImplGetFilter ( nY, 0, 1 ) );
         }
     }
-    mpZCodec->EndCompression();
-    mnCRC = mpZCodec->GetCRC();
+    mpZCodec.EndCompression();
+    mnCRC = mpZCodec.GetCRC();
 
     if ( mnFilterType )         // using filter type 4 we need memory for the scanline 3 times
     {
commit 2993c7c0000d32933bc7ca7fabe975a91b672edf
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed May 21 14:26:27 2014 +0200

    ZCodec instances can be allocated on the stack just fine
    
    Change-Id: Id115af34011fbedc93a1fea1734ea6b1e7cfafd0

diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx
index cae7b38..6198c48 100644
--- a/vcl/source/gdi/pngread.cxx
+++ b/vcl/source/gdi/pngread.cxx
@@ -78,7 +78,7 @@ private:
     Bitmap*             mpMaskBmp;
     AlphaMask*          mpAlphaMask;
     BitmapWriteAccess*  mpMaskAcc;
-    ZCodec*             mpZCodec;
+    ZCodec              mpZCodec;
     sal_uInt8*              mpInflateInBuf; // as big as the size of a scanline + alphachannel + 1
     sal_uInt8*              mpScanPrior;    // pointer to the latest scanline
     sal_uInt8*              mpTransTab;     // for transparency in images with palette colortype
@@ -169,7 +169,6 @@ PNGReaderImpl::PNGReaderImpl( SvStream& rPNGStream )
     mpMaskBmp       ( NULL ),
     mpAlphaMask     ( NULL ),
     mpMaskAcc       ( NULL ),
-    mpZCodec        ( new ZCodec ),
     mpInflateInBuf  ( NULL ),
     mpScanPrior     ( NULL ),
     mpTransTab      ( NULL ),
@@ -241,7 +240,7 @@ PNGReaderImpl::~PNGReaderImpl()
     mrPNGStream.SetNumberFormatInt( mnOrigStreamMode );
 
     if ( mbzCodecInUse )
-        mpZCodec->EndCompression();
+        mpZCodec.EndCompression();
 
     if( mpColorTable != mpDefaultColorTable )
         delete[] mpColorTable;
@@ -252,7 +251,6 @@ PNGReaderImpl::~PNGReaderImpl()
     delete[] mpTransTab;
     delete[] mpInflateInBuf;
     delete[] mpScanPrior;
-    delete mpZCodec;
 
     delete[] mpScanline;
     delete[] mpScanlineAlpha;
@@ -900,16 +898,16 @@ void PNGReaderImpl::ImplReadIDAT()
         if ( !mbzCodecInUse )
         {
             mbzCodecInUse = true;
-            mpZCodec->BeginCompression( ZCODEC_NO_COMPRESSION, true );
+            mpZCodec.BeginCompression( ZCODEC_NO_COMPRESSION, true );
         }
-        mpZCodec->SetBreak( mnChunkLen );
+        mpZCodec.SetBreak( mnChunkLen );
         SvMemoryStream aIStrm( &(*maDataIter), mnChunkLen, STREAM_READ );
 
-        while ( ( mpZCodec->GetBreak() ) )
+        while ( ( mpZCodec.GetBreak() ) )
         {
             // get bytes needed to fill the current scanline
             sal_Int32 nToRead = mnScansize - (mpScanCurrent - mpInflateInBuf);
-            sal_Int32 nRead = mpZCodec->ReadAsynchron( aIStrm, mpScanCurrent, nToRead );
+            sal_Int32 nRead = mpZCodec.ReadAsynchron( aIStrm, mpScanCurrent, nToRead );
             if ( nRead < 0 )
             {
                 mbStatus = false;
@@ -942,7 +940,7 @@ void PNGReaderImpl::ImplReadIDAT()
 
     if( mbIDAT )
     {
-        mpZCodec->EndCompression();
+        mpZCodec.EndCompression();
         mbzCodecInUse = false;
     }
 }
commit 0696dd9a3d3f3aead4c8cc350eb48cb955173adb
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed May 21 14:24:11 2014 +0200

    ZCodec instances can be allocated on the stack just fine
    
    Change-Id: I523fba14c721815f8416f6e0224e42052d13429a

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 2906bb2..4e7687c 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2086,12 +2086,12 @@ bool PDFWriterImpl::compressStream( SvMemoryStream* pStream )
     pStream->Seek( STREAM_SEEK_TO_END );
     sal_uLong nEndPos = pStream->Tell();
     pStream->Seek( STREAM_SEEK_TO_BEGIN );
-    ZCodec* pCodec = new ZCodec( 0x4000, 0x4000 );
+    ZCodec pCodec( 0x4000, 0x4000 );
     SvMemoryStream aStream;
-    pCodec->BeginCompression();
-    pCodec->Write( aStream, (const sal_uInt8*)pStream->GetData(), nEndPos );
-    pCodec->EndCompression();
-    delete pCodec;
+    pCodec.BeginCompression();
+    pCodec.Write( aStream, (const sal_uInt8*)pStream->GetData(), nEndPos );
+    pCodec.EndCompression();
+    assert(false);
     nEndPos = aStream.Tell();
     pStream->Seek( STREAM_SEEK_TO_BEGIN );
     aStream.Seek( STREAM_SEEK_TO_BEGIN );
@@ -3701,12 +3701,11 @@ sal_Int32 PDFWriterImpl::createToUnicodeCMap( sal_uInt8* pEncoding,
                       "end\n"
                       "end\n" );
 #ifndef DEBUG_DISABLE_PDFCOMPRESSION
-    ZCodec* pCodec = new ZCodec( 0x4000, 0x4000 );
+    ZCodec pCodec( 0x4000, 0x4000 );
     SvMemoryStream aStream;
-    pCodec->BeginCompression();
-    pCodec->Write( aStream, (const sal_uInt8*)aContents.getStr(), aContents.getLength() );
-    pCodec->EndCompression();
-    delete pCodec;
+    pCodec.BeginCompression();
+    pCodec.Write( aStream, (const sal_uInt8*)aContents.getStr(), aContents.getLength() );
+    pCodec.EndCompression();
 #endif
 
     #if OSL_DEBUG_LEVEL > 1
commit 47169087c176a419cf4382e3bdb23b39df1575cd
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed May 21 12:44:53 2014 +0200

    Remove unnecessary GZCodec derivation
    
    Change-Id: Id710a1fe4a3c1593add69bb2a7014d26f9499e87

diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx
index 734b01a..2ca7de7 100644
--- a/filter/source/svg/svgfilter.cxx
+++ b/filter/source/svg/svgfilter.cxx
@@ -370,8 +370,8 @@ OUString SAL_CALL SVGFilter::detect(Sequence<PropertyValue>& rDescriptor) throw
             return OUString();
         xSeek->seek(0);
 
-        GZCodec aCodec;
-        aCodec.BeginCompression();
+        ZCodec aCodec;
+        aCodec.BeginCompression(ZCODEC_DEFAULT_COMPRESSION, false, true);
         aCodec.Decompress(*aStream.get(), *pMemoryStream);
         aCodec.EndCompression();
         pMemoryStream->Seek(STREAM_SEEK_TO_BEGIN);
diff --git a/filter/source/svg/svgimport.cxx b/filter/source/svg/svgimport.cxx
index 45ab0b8..fc32d0f 100644
--- a/filter/source/svg/svgimport.cxx
+++ b/filter/source/svg/svgimport.cxx
@@ -67,8 +67,8 @@ bool SVGFilter::implImport( const Sequence< PropertyValue >& rDescriptor )
             return false;
 
         SvStream* pMemoryStream = new SvMemoryStream;
-        GZCodec aCodec;
-        aCodec.BeginCompression();
+        ZCodec aCodec;
+        aCodec.BeginCompression(ZCODEC_DEFAULT_COMPRESSION, false, true);
         aCodec.Decompress(*aStream.get(), *pMemoryStream);
         aCodec.EndCompression();
         pMemoryStream->Seek(STREAM_SEEK_TO_BEGIN);
diff --git a/include/tools/zcodec.hxx b/include/tools/zcodec.hxx
index f2444af..4644433 100644
--- a/include/tools/zcodec.hxx
+++ b/include/tools/zcodec.hxx
@@ -52,10 +52,10 @@ private:
 
 public:
                     ZCodec( sal_uIntPtr nInBuf = 0x8000UL, sal_uIntPtr nOutBuf = 0x8000UL );
-    virtual         ~ZCodec();
+                    ~ZCodec();
 
-    virtual void    BeginCompression( int nCompressLevel = ZCODEC_DEFAULT_COMPRESSION, bool updateCrc = false, bool gzLib = false );
-    virtual long    EndCompression();
+    void            BeginCompression( int nCompressLevel = ZCODEC_DEFAULT_COMPRESSION, bool updateCrc = false, bool gzLib = false );
+    long            EndCompression();
     bool            IsFinished () const { return mbFinish; }
 
     long            Compress( SvStream& rIStm, SvStream& rOStm );
@@ -72,17 +72,6 @@ public:
     sal_uIntPtr     GetCRC();
 };
 
-class GZCodec : public ZCodec
-{
-public:
-                    GZCodec(){};
-                    virtual ~GZCodec(){};
-    virtual void    BeginCompression( int nCompressLevel = ZCODEC_DEFAULT_COMPRESSION, bool updateCrc = false, bool gzLib = true ) SAL_OVERRIDE
-    {
-        ZCodec::BeginCompression( nCompressLevel, updateCrc, gzLib );
-    };
-};
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 2144a58..2485d44 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -655,9 +655,9 @@ static bool ImpPeekGraphicFormat( SvStream& rStream, OUString& rFormatExtension,
         // check if it is gzipped -> svgz
         if(sFirstBytes[0] == 0x1F && sFirstBytes[1] == 0x8B)
         {
-            GZCodec aCodec;
+            ZCodec aCodec;
             rStream.Seek(nStreamPos);
-            aCodec.BeginCompression();
+            aCodec.BeginCompression(ZCODEC_DEFAULT_COMPRESSION, false, true);
             nDecompressedSize = aCodec.Read(rStream, sExtendedOrDecompressedFirstBytes, 2048);
             nCheckSize = nDecompressedSize < 256 ? nDecompressedSize : 256;
             aCodec.EndCompression();
@@ -1517,10 +1517,10 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
                 if(aTwoBytes[0] == 0x1F && aTwoBytes[1] == 0x8B)
                 {
                     SvMemoryStream aMemStream;
-                    GZCodec aCodec;
+                    ZCodec aCodec;
                     long nMemoryLength;
 
-                    aCodec.BeginCompression();
+                    aCodec.BeginCompression(ZCODEC_DEFAULT_COMPRESSION, false, true);
                     nMemoryLength = aCodec.Decompress(rIStream, aMemStream);
                     aCodec.EndCompression();
 
commit a1ec916df8b5b65c342c8a796150e5f29e5f2ae3
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed May 21 12:24:28 2014 +0200

    Remove unused ZCODEC_BEST_SPEED, ZCODEC_BEST_COMPRESSION macros
    
    Change-Id: Ibdf211b858c25a4b301cbde3dcab3a51765e4050

diff --git a/include/tools/zcodec.hxx b/include/tools/zcodec.hxx
index 93da1869..f2444af 100644
--- a/include/tools/zcodec.hxx
+++ b/include/tools/zcodec.hxx
@@ -23,9 +23,7 @@
 #include <tools/toolsdllapi.h>
 
 #define ZCODEC_NO_COMPRESSION       0
-#define ZCODEC_BEST_SPEED           1
 #define ZCODEC_DEFAULT_COMPRESSION  6
-#define ZCODEC_BEST_COMPRESSION     9
 
 class SvStream;
 
commit 200d530f473566d7d7aa30f848bc28a72247d674
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed May 21 12:20:59 2014 +0200

    Split ZCodec::BeginCompression param into its 3 independent components
    
    Change-Id: I275abafe81c8bb617c70646244b14f6cecc33854

diff --git a/include/tools/zcodec.hxx b/include/tools/zcodec.hxx
index 456cdd7..93da1869 100644
--- a/include/tools/zcodec.hxx
+++ b/include/tools/zcodec.hxx
@@ -22,15 +22,10 @@
 
 #include <tools/toolsdllapi.h>
 
-#define ZCODEC_NO_COMPRESSION       (0x00000000UL)
-#define ZCODEC_BEST_SPEED           (0x00000001UL)
-#define ZCODEC_DEFAULT_COMPRESSION  (0x00000006UL)
-#define ZCODEC_BEST_COMPRESSION     (0x00000009UL)
-
-#define ZCODEC_UPDATE_CRC           (0x00010000UL)
-#define ZCODEC_GZ_LIB               (0x00020000UL)
-
-#define ZCODEC_PNG_DEFAULT ( ZCODEC_NO_COMPRESSION | ZCODEC_UPDATE_CRC )
+#define ZCODEC_NO_COMPRESSION       0
+#define ZCODEC_BEST_SPEED           1
+#define ZCODEC_DEFAULT_COMPRESSION  6
+#define ZCODEC_BEST_COMPRESSION     9
 
 class SvStream;
 
@@ -49,7 +44,9 @@ private:
     sal_uIntPtr     mnOutBufSize;
 
     sal_uIntPtr     mnCRC;
-    sal_uIntPtr     mnCompressMethod;
+    int             mnCompressLevel;
+    bool            mbUpdateCrc;
+    bool            mbGzLib;
     void*           mpsC_Stream;
 
     void            ImplInitBuf( bool nIOFlag );
@@ -59,7 +56,7 @@ public:
                     ZCodec( sal_uIntPtr nInBuf = 0x8000UL, sal_uIntPtr nOutBuf = 0x8000UL );
     virtual         ~ZCodec();
 
-    virtual void    BeginCompression( sal_uIntPtr nCompressMethod = ZCODEC_DEFAULT_COMPRESSION );
+    virtual void    BeginCompression( int nCompressLevel = ZCODEC_DEFAULT_COMPRESSION, bool updateCrc = false, bool gzLib = false );
     virtual long    EndCompression();
     bool            IsFinished () const { return mbFinish; }
 
@@ -82,9 +79,9 @@ class GZCodec : public ZCodec
 public:
                     GZCodec(){};
                     virtual ~GZCodec(){};
-    virtual void    BeginCompression( sal_uIntPtr nCompressMethod = ZCODEC_DEFAULT_COMPRESSION ) SAL_OVERRIDE
+    virtual void    BeginCompression( int nCompressLevel = ZCODEC_DEFAULT_COMPRESSION, bool updateCrc = false, bool gzLib = true ) SAL_OVERRIDE
     {
-        ZCodec::BeginCompression( nCompressMethod | ZCODEC_GZ_LIB );
+        ZCodec::BeginCompression( nCompressLevel, updateCrc, gzLib );
     };
 };
 
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
index 8d73719..27cc02f 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -314,7 +314,7 @@ const GraphicObject& SvXMLGraphicOutputStream::GetGraphicObject()
                 {
                     SvMemoryStream* pDest = new SvMemoryStream;
                     ZCodec aZCodec( 0x8000, 0x8000 );
-                    aZCodec.BeginCompression(ZCODEC_GZ_LIB);
+                    aZCodec.BeginCompression(ZCODEC_DEFAULT_COMPRESSION, false, true);
                     mpOStm->Seek( 0 );
                     aZCodec.Decompress( *mpOStm, *pDest );
 
diff --git a/tools/source/zcodec/zcodec.cxx b/tools/source/zcodec/zcodec.cxx
index 49d4f12..a672e76 100644
--- a/tools/source/zcodec/zcodec.cxx
+++ b/tools/source/zcodec/zcodec.cxx
@@ -49,7 +49,9 @@ ZCodec::ZCodec( sal_uIntPtr nInBufSize, sal_uIntPtr nOutBufSize )
     , mpOutBuf(NULL)
     , mnOutBufSize(nOutBufSize)
     , mnCRC(0)
-    , mnCompressMethod(0)
+    , mnCompressLevel(0)
+    , mbUpdateCrc(false)
+    , mbGzLib(false)
 {
     mpsC_Stream = new z_stream;
 }
@@ -59,7 +61,7 @@ ZCodec::~ZCodec()
     delete (z_stream*) mpsC_Stream;
 }
 
-void ZCodec::BeginCompression( sal_uIntPtr nCompressMethod )
+void ZCodec::BeginCompression( int nCompressLevel, bool updateCrc, bool gzLib )
 {
     mbInit = 0;
     mbStatus = true;
@@ -68,7 +70,9 @@ void ZCodec::BeginCompression( sal_uIntPtr nCompressMethod )
     mnInToRead = 0xffffffff;
     mpInBuf = mpOutBuf = NULL;
     PZSTREAM->total_out = PZSTREAM->total_in = 0;
-    mnCompressMethod = nCompressMethod;
+    mnCompressLevel = nCompressLevel;
+    mbUpdateCrc = updateCrc;
+    mbGzLib = gzLib;
     PZSTREAM->zalloc = ( alloc_func )0;
     PZSTREAM->zfree = ( free_func )0;
     PZSTREAM->opaque = ( voidpf )0;
@@ -154,7 +158,7 @@ long ZCodec::Decompress( SvStream& rIStm, SvStream& rOStm )
             PZSTREAM->avail_in = mpIStm->Read( PZSTREAM->next_in = mpInBuf, nInToRead );
             mnInToRead -= nInToRead;
 
-            if ( mnCompressMethod & ZCODEC_UPDATE_CRC )
+            if ( mbUpdateCrc )
                 mnCRC = UpdateCRC( mnCRC, mpInBuf, nInToRead );
 
         }
@@ -223,7 +227,7 @@ long ZCodec::Read( SvStream& rIStm, sal_uInt8* pData, sal_uIntPtr nSize )
                 PZSTREAM->next_in = mpInBuf, nInToRead);
             mnInToRead -= nInToRead;
 
-            if ( mnCompressMethod & ZCODEC_UPDATE_CRC )
+            if ( mbUpdateCrc )
                 mnCRC = UpdateCRC( mnCRC, mpInBuf, nInToRead );
 
         }
@@ -277,7 +281,7 @@ long ZCodec::ReadAsynchron( SvStream& rIStm, sal_uInt8* pData, sal_uIntPtr nSize
                 PZSTREAM->next_in = mpInBuf, nInToRead);
             mnInToRead -= nInToRead;
 
-            if ( mnCompressMethod & ZCODEC_UPDATE_CRC )
+            if ( mbUpdateCrc )
                 mnCRC = UpdateCRC( mnCRC, mpInBuf, nInToRead );
 
         }
@@ -304,7 +308,7 @@ void ZCodec::ImplWriteBack()
 
     if ( nAvail )
     {
-        if ( mbInit & 2 && ( mnCompressMethod & ZCODEC_UPDATE_CRC ) )
+        if ( mbInit & 2 && mbUpdateCrc )
             mnCRC = UpdateCRC( mnCRC, mpOutBuf, nAvail );
         mpOStm->Write( PZSTREAM->next_out = mpOutBuf, nAvail );
         PZSTREAM->avail_out = mnOutBufSize;
@@ -338,7 +342,7 @@ void ZCodec::ImplInitBuf ( bool nIOFlag )
         if ( nIOFlag )
         {
             mbInit = 1;
-            if ( mbStatus && ( mnCompressMethod & ZCODEC_GZ_LIB ) )
+            if ( mbStatus &&  mbGzLib )
             {
                 sal_uInt8 n1, n2, j, nMethod, nFlags;
                 for ( int i = 0; i < 2; i++ )   // gz - magic number
@@ -395,7 +399,7 @@ void ZCodec::ImplInitBuf ( bool nIOFlag )
         {
             mbInit = 3;
 
-            mbStatus = ( deflateInit2_( PZSTREAM, mnCompressMethod & 0xff, Z_DEFLATED,
+            mbStatus = ( deflateInit2_( PZSTREAM, mnCompressLevel, Z_DEFLATED,
                 MAX_WBITS, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY,
                     ZLIB_VERSION, sizeof( z_stream ) ) >= 0 );
 
diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx
index 8a05013..cae7b38 100644
--- a/vcl/source/gdi/pngread.cxx
+++ b/vcl/source/gdi/pngread.cxx
@@ -900,7 +900,7 @@ void PNGReaderImpl::ImplReadIDAT()
         if ( !mbzCodecInUse )
         {
             mbzCodecInUse = true;
-            mpZCodec->BeginCompression( ZCODEC_PNG_DEFAULT );
+            mpZCodec->BeginCompression( ZCODEC_NO_COMPRESSION, true );
         }
         mpZCodec->SetBreak( mnChunkLen );
         SvMemoryStream aIStrm( &(*maDataIter), mnChunkLen, STREAM_READ );
diff --git a/vcl/source/gdi/pngwrite.cxx b/vcl/source/gdi/pngwrite.cxx
index c4e9509..9057a4822 100644
--- a/vcl/source/gdi/pngwrite.cxx
+++ b/vcl/source/gdi/pngwrite.cxx
@@ -386,7 +386,7 @@ void PNGWriterImpl::ImplWriteIDAT ()
         mpCurrentScan = new sal_uInt8[ mnDeflateInSize ];
         ImplClearFirstScanline();
     }
-    mpZCodec->BeginCompression( ZCODEC_PNG_DEFAULT + mnCompLevel );
+    mpZCodec->BeginCompression( mnCompLevel, true );
     mpZCodec->SetCRC( mnCRC );
     SvMemoryStream aOStm;
     if ( mnInterlaced == 0 )
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index fd1d0dc..606fd55 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -322,7 +322,7 @@ void PPDDecompressStream::Open( const OUString& i_rFile )
         // so let's try to decompress the stream
         mpMemStream = new SvMemoryStream( 4096, 4096 );
         ZCodec aCodec;
-        aCodec.BeginCompression( ZCODEC_DEFAULT_COMPRESSION | ZCODEC_GZ_LIB );
+        aCodec.BeginCompression( ZCODEC_DEFAULT_COMPRESSION, false, true );
         long nComp = aCodec.Decompress( *mpFileStream, *mpMemStream );
         aCodec.EndCompression();
         if( nComp < 0 )
commit 5e82dc511ea266776a06c9da62c41e873b2cbafc
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed May 21 11:59:48 2014 +0200

    Simplify logic
    
    Change-Id: I2350c1a4d57a0e25753756e99d2b93ab3f2f6997

diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index 3c09f8b..fd1d0dc 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -316,19 +316,13 @@ void PPDDecompressStream::Open( const OUString& i_rFile )
     mpFileStream->Seek( 0 );
 
     // check for compress'ed or gzip'ed file
-    sal_uLong nCompressMethod = 0;
-    if( aLine.getLength() > 1 && static_cast<unsigned char>(aLine[0]) == 0x1f )
-    {
-        if( static_cast<unsigned char>(aLine[1]) == 0x8b ) // check for gzip
-            nCompressMethod = ZCODEC_DEFAULT_COMPRESSION | ZCODEC_GZ_LIB;
-    }
-
-    if( nCompressMethod != 0 )
+    if( aLine.getLength() > 1 && static_cast<unsigned char>(aLine[0]) == 0x1f
+        && static_cast<unsigned char>(aLine[1]) == 0x8b /* check for gzip */ )
     {
         // so let's try to decompress the stream
         mpMemStream = new SvMemoryStream( 4096, 4096 );
         ZCodec aCodec;
-        aCodec.BeginCompression( nCompressMethod );
+        aCodec.BeginCompression( ZCODEC_DEFAULT_COMPRESSION | ZCODEC_GZ_LIB );
         long nComp = aCodec.Decompress( *mpFileStream, *mpMemStream );
         aCodec.EndCompression();
         if( nComp < 0 )
commit e05a20024989a4a1a51f7d2278d5bc55f06e5570
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed May 21 11:08:46 2014 +0200

    Remove unnecessary ZCODEC_DEFAULT macro
    
    Change-Id: I57a5a14a51c0441e0fed006457ac95057f188462

diff --git a/include/tools/zcodec.hxx b/include/tools/zcodec.hxx
index 540f2aa..456cdd7 100644
--- a/include/tools/zcodec.hxx
+++ b/include/tools/zcodec.hxx
@@ -31,7 +31,6 @@
 #define ZCODEC_GZ_LIB               (0x00020000UL)
 
 #define ZCODEC_PNG_DEFAULT ( ZCODEC_NO_COMPRESSION | ZCODEC_UPDATE_CRC )
-#define ZCODEC_DEFAULT  ( ZCODEC_DEFAULT_COMPRESSION )
 
 class SvStream;
 
@@ -60,7 +59,7 @@ public:
                     ZCodec( sal_uIntPtr nInBuf = 0x8000UL, sal_uIntPtr nOutBuf = 0x8000UL );
     virtual         ~ZCodec();
 
-    virtual void    BeginCompression( sal_uIntPtr nCompressMethod = ZCODEC_DEFAULT );
+    virtual void    BeginCompression( sal_uIntPtr nCompressMethod = ZCODEC_DEFAULT_COMPRESSION );
     virtual long    EndCompression();
     bool            IsFinished () const { return mbFinish; }
 
@@ -83,7 +82,7 @@ class GZCodec : public ZCodec
 public:
                     GZCodec(){};
                     virtual ~GZCodec(){};
-    virtual void    BeginCompression( sal_uIntPtr nCompressMethod = ZCODEC_DEFAULT ) SAL_OVERRIDE
+    virtual void    BeginCompression( sal_uIntPtr nCompressMethod = ZCODEC_DEFAULT_COMPRESSION ) SAL_OVERRIDE
     {
         ZCodec::BeginCompression( nCompressMethod | ZCODEC_GZ_LIB );
     };
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index 3a818d2..3c09f8b 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -320,7 +320,7 @@ void PPDDecompressStream::Open( const OUString& i_rFile )
     if( aLine.getLength() > 1 && static_cast<unsigned char>(aLine[0]) == 0x1f )
     {
         if( static_cast<unsigned char>(aLine[1]) == 0x8b ) // check for gzip
-            nCompressMethod = ZCODEC_DEFAULT | ZCODEC_GZ_LIB;
+            nCompressMethod = ZCODEC_DEFAULT_COMPRESSION | ZCODEC_GZ_LIB;
     }
 
     if( nCompressMethod != 0 )
commit 201d429ad0e8f212c8546ae2133af384f9076a3e
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed May 21 11:06:59 2014 +0200

    Remove unnecessary ZCODEC_DEFAULT_STRATEGY macro
    
    ...and directly use zlib.h's Z_DEFAULT_STRATEGY
    
    Change-Id: Ibf528cbc32afec4d442656aa2963f50c0875d6a5

diff --git a/include/tools/zcodec.hxx b/include/tools/zcodec.hxx
index 20aadac..540f2aa 100644
--- a/include/tools/zcodec.hxx
+++ b/include/tools/zcodec.hxx
@@ -27,13 +27,11 @@
 #define ZCODEC_DEFAULT_COMPRESSION  (0x00000006UL)
 #define ZCODEC_BEST_COMPRESSION     (0x00000009UL)
 
-#define ZCODEC_DEFAULT_STRATEGY     (0x00000000UL)
-
 #define ZCODEC_UPDATE_CRC           (0x00010000UL)
 #define ZCODEC_GZ_LIB               (0x00020000UL)
 
-#define ZCODEC_PNG_DEFAULT ( ZCODEC_NO_COMPRESSION | ZCODEC_DEFAULT_STRATEGY | ZCODEC_UPDATE_CRC )
-#define ZCODEC_DEFAULT  ( ZCODEC_DEFAULT_COMPRESSION | ZCODEC_DEFAULT_STRATEGY )
+#define ZCODEC_PNG_DEFAULT ( ZCODEC_NO_COMPRESSION | ZCODEC_UPDATE_CRC )
+#define ZCODEC_DEFAULT  ( ZCODEC_DEFAULT_COMPRESSION )
 
 class SvStream;
 
diff --git a/tools/source/zcodec/zcodec.cxx b/tools/source/zcodec/zcodec.cxx
index abed9d5..49d4f12 100644
--- a/tools/source/zcodec/zcodec.cxx
+++ b/tools/source/zcodec/zcodec.cxx
@@ -396,7 +396,7 @@ void ZCodec::ImplInitBuf ( bool nIOFlag )
             mbInit = 3;
 
             mbStatus = ( deflateInit2_( PZSTREAM, mnCompressMethod & 0xff, Z_DEFLATED,
-                MAX_WBITS, MAX_MEM_LEVEL, ( mnCompressMethod >> 8 ) & 0xff,
+                MAX_WBITS, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY,
                     ZLIB_VERSION, sizeof( z_stream ) ) >= 0 );
 
             PZSTREAM->next_out = mpOutBuf = new sal_uInt8[ PZSTREAM->avail_out = mnOutBufSize ];
commit a34d0fb56fb14f834de76ce3d911f82ece26e17c
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed May 21 11:05:55 2014 +0200

    Remove unused ZCODEC_ZFILTERED, ZCODEC_ZHUFFMAN_ONLY macros
    
    Change-Id: Ie02fb495beebd02d8331e547cbe6648dc70f241f

diff --git a/include/tools/zcodec.hxx b/include/tools/zcodec.hxx
index 9efdba0..20aadac 100644
--- a/include/tools/zcodec.hxx
+++ b/include/tools/zcodec.hxx
@@ -28,8 +28,6 @@
 #define ZCODEC_BEST_COMPRESSION     (0x00000009UL)
 
 #define ZCODEC_DEFAULT_STRATEGY     (0x00000000UL)
-#define ZCODEC_ZFILTERED            (0x00000100UL)
-#define ZCODEC_ZHUFFMAN_ONLY        (0x00000200UL)
 
 #define ZCODEC_UPDATE_CRC           (0x00010000UL)
 #define ZCODEC_GZ_LIB               (0x00020000UL)
commit b2e5b0ec142a554da3bcf75b478f93ddb61caeaa
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed May 21 11:02:36 2014 +0200

    Remove unnecessary DEFAULT_IN/OUT_BUFSIZE macros
    
    Change-Id: Icd509f55b3f91c4ce3b21bfa3a501d99532539d9

diff --git a/include/tools/zcodec.hxx b/include/tools/zcodec.hxx
index f96b6ce..9efdba0 100644
--- a/include/tools/zcodec.hxx
+++ b/include/tools/zcodec.hxx
@@ -22,16 +22,6 @@
 
 #include <tools/toolsdllapi.h>
 
-// Defines
-
-#define DEFAULT_IN_BUFSIZE          (0x00008000UL)
-#define DEFAULT_OUT_BUFSIZE         (0x00008000UL)
-
-// memory requirement using compress:
-//  [ INBUFFER ] + [ OUTBUFFER ] + 128KB + 1 << (MEM_USAGE+9)
-// memory requirement using decompress:
-//  [ INBUFFER ] + [ OUTBUFFER ] + 32KB
-
 #define ZCODEC_NO_COMPRESSION       (0x00000000UL)
 #define ZCODEC_BEST_SPEED           (0x00000001UL)
 #define ZCODEC_DEFAULT_COMPRESSION  (0x00000006UL)
@@ -71,7 +61,7 @@ private:
     void            ImplWriteBack();
 
 public:
-                    ZCodec( sal_uIntPtr nInBuf = DEFAULT_IN_BUFSIZE, sal_uIntPtr nOutBuf = DEFAULT_OUT_BUFSIZE );
+                    ZCodec( sal_uIntPtr nInBuf = 0x8000UL, sal_uIntPtr nOutBuf = 0x8000UL );
     virtual         ~ZCodec();
 
     virtual void    BeginCompression( sal_uIntPtr nCompressMethod = ZCODEC_DEFAULT );
commit 5271e5b01be208a60a295fb06b867eb438387272
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed May 21 10:59:18 2014 +0200

    nMemUsage is always MAX_MEM_USAGE
    
    ...so just use zlib.h's MAX_MEM_LEVEL directly.
    
    Change-Id: I76d73f665df242bfb180b76aa7054cf8ddbe9e67

diff --git a/include/tools/zcodec.hxx b/include/tools/zcodec.hxx
index 867e27a..f96b6ce 100644
--- a/include/tools/zcodec.hxx
+++ b/include/tools/zcodec.hxx
@@ -27,8 +27,6 @@
 #define DEFAULT_IN_BUFSIZE          (0x00008000UL)
 #define DEFAULT_OUT_BUFSIZE         (0x00008000UL)
 
-#define MAX_MEM_USAGE 8
-
 // memory requirement using compress:
 //  [ INBUFFER ] + [ OUTBUFFER ] + 128KB + 1 << (MEM_USAGE+9)
 // memory requirement using decompress:
@@ -57,7 +55,6 @@ private:
     sal_uIntPtr     mbInit;
     bool            mbStatus;
     bool            mbFinish;
-    sal_uIntPtr     mnMemUsage;
     SvStream*       mpIStm;
     sal_uInt8*      mpInBuf;
     sal_uIntPtr     mnInBufSize;
@@ -74,7 +71,7 @@ private:
     void            ImplWriteBack();
 
 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 void    BeginCompression( sal_uIntPtr nCompressMethod = ZCODEC_DEFAULT );
diff --git a/tools/source/zcodec/zcodec.cxx b/tools/source/zcodec/zcodec.cxx
index 4eeac99..abed9d5 100644
--- a/tools/source/zcodec/zcodec.cxx
+++ b/tools/source/zcodec/zcodec.cxx
@@ -37,11 +37,10 @@
 
 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)
     , mbStatus(false)
     , mbFinish(false)
-    , mnMemUsage(nMemUsage)
     , mpIStm(NULL)
     , mpInBuf(NULL)
     , mnInBufSize(nInBufSize)
@@ -397,7 +396,7 @@ void ZCodec::ImplInitBuf ( bool nIOFlag )
             mbInit = 3;
 
             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 );
 
             PZSTREAM->next_out = mpOutBuf = new sal_uInt8[ PZSTREAM->avail_out = mnOutBufSize ];
commit f5e44ac7e681ef50e333e102ce2aebba0f8b8ecb
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed May 21 10:15:00 2014 +0200

    Use default argument values
    
    Change-Id: I69273648155f5071b297c9c77edda58a8f25436d

diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx
index 04b46a6..8a05013 100644
--- a/vcl/source/gdi/pngread.cxx
+++ b/vcl/source/gdi/pngread.cxx
@@ -169,7 +169,7 @@ PNGReaderImpl::PNGReaderImpl( SvStream& rPNGStream )
     mpMaskBmp       ( NULL ),
     mpAlphaMask     ( NULL ),
     mpMaskAcc       ( NULL ),
-    mpZCodec        ( new ZCodec( DEFAULT_IN_BUFSIZE, DEFAULT_OUT_BUFSIZE, MAX_MEM_USAGE ) ),
+    mpZCodec        ( new ZCodec ),
     mpInflateInBuf  ( NULL ),
     mpScanPrior     ( NULL ),
     mpTransTab      ( NULL ),
diff --git a/vcl/source/gdi/pngwrite.cxx b/vcl/source/gdi/pngwrite.cxx
index 4b29431..c4e9509 100644
--- a/vcl/source/gdi/pngwrite.cxx
+++ b/vcl/source/gdi/pngwrite.cxx
@@ -102,7 +102,7 @@ PNGWriterImpl::PNGWriterImpl( const BitmapEx& rBmpEx,
     , mbStatus(true)
     , mpAccess(NULL)
     , mpMaskAccess(NULL)
-    , mpZCodec(new ZCodec(DEFAULT_IN_BUFSIZE, DEFAULT_OUT_BUFSIZE, MAX_MEM_USAGE))
+    , mpZCodec(new ZCodec)
     , mpDeflateInBuf(NULL)
     , mpPreviousScan(NULL)
     , mpCurrentScan(NULL)
commit fe1e1d1292973211f0edfa64c05279ca59634652
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed May 21 10:03:17 2014 +0200

    A single ZCodec ctor suffices
    
    Change-Id: Ib831b80afcdde98928a2759616810923348f65e8

diff --git a/include/tools/zcodec.hxx b/include/tools/zcodec.hxx
index 8bbbcd6..867e27a 100644
--- a/include/tools/zcodec.hxx
+++ b/include/tools/zcodec.hxx
@@ -74,8 +74,7 @@ private:
     void            ImplWriteBack();
 
 public:
-                    ZCodec( sal_uIntPtr nInBuf, sal_uIntPtr nOutBuf, sal_uIntPtr nMemUsage = MAX_MEM_USAGE );
-                    ZCodec();
+                    ZCodec( sal_uIntPtr nInBuf = DEFAULT_IN_BUFSIZE, sal_uIntPtr nOutBuf = DEFAULT_OUT_BUFSIZE, sal_uIntPtr nMemUsage = MAX_MEM_USAGE );
     virtual         ~ZCodec();
 
     virtual void    BeginCompression( sal_uIntPtr nCompressMethod = ZCODEC_DEFAULT );
diff --git a/tools/source/zcodec/zcodec.cxx b/tools/source/zcodec/zcodec.cxx
index 3fce309..4eeac99 100644
--- a/tools/source/zcodec/zcodec.cxx
+++ b/tools/source/zcodec/zcodec.cxx
@@ -55,24 +55,6 @@ ZCodec::ZCodec( sal_uIntPtr nInBufSize, sal_uIntPtr nOutBufSize, sal_uIntPtr nMe
     mpsC_Stream = new z_stream;
 }
 
-ZCodec::ZCodec()
-    : mbInit(0)
-    , mbStatus(false)
-    , mbFinish(false)
-    , mnMemUsage(MAX_MEM_USAGE)
-    , mpIStm(NULL)
-    , mpInBuf(NULL)
-    , mnInBufSize(DEFAULT_IN_BUFSIZE)
-    , mnInToRead(0)
-    , mpOStm(NULL)
-    , mpOutBuf(NULL)
-    , mnOutBufSize(DEFAULT_OUT_BUFSIZE)
-    , mnCRC(0)
-    , mnCompressMethod(0)
-{
-    mpsC_Stream = new z_stream;
-}
-
 ZCodec::~ZCodec()
 {
     delete (z_stream*) mpsC_Stream;
commit faac2327e95b5ed735ddb3f5f76a583bbe504b52
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed May 21 09:48:06 2014 +0200

    Clean-up C-style (void) parameter lists
    
    Change-Id: I41da8920e33dfdd0f1483ea2d7cf67111224b441

diff --git a/include/tools/zcodec.hxx b/include/tools/zcodec.hxx
index 361277c..8bbbcd6 100644
--- a/include/tools/zcodec.hxx
+++ b/include/tools/zcodec.hxx
@@ -71,11 +71,11 @@ private:
     void*           mpsC_Stream;
 
     void            ImplInitBuf( bool nIOFlag );
-    void            ImplWriteBack( void );
+    void            ImplWriteBack();
 
 public:
                     ZCodec( sal_uIntPtr nInBuf, sal_uIntPtr nOutBuf, sal_uIntPtr nMemUsage = MAX_MEM_USAGE );
-                    ZCodec( void );
+                    ZCodec();
     virtual         ~ZCodec();
 
     virtual void    BeginCompression( sal_uIntPtr nCompressMethod = ZCODEC_DEFAULT );
@@ -90,7 +90,7 @@ public:
     long            ReadAsynchron( SvStream& rIStm, sal_uInt8* pData, sal_uIntPtr nSize );
 
     void            SetBreak( sal_uIntPtr );
-    sal_uIntPtr     GetBreak( void );
+    sal_uIntPtr     GetBreak();
     void            SetCRC( sal_uIntPtr nCurrentCRC );
     sal_uIntPtr     UpdateCRC( sal_uIntPtr nLatestCRC, sal_uInt8* pSource, long nDatSize );
     sal_uIntPtr     GetCRC();
diff --git a/tools/source/zcodec/zcodec.cxx b/tools/source/zcodec/zcodec.cxx
index ed6d8e4..3fce309 100644
--- a/tools/source/zcodec/zcodec.cxx
+++ b/tools/source/zcodec/zcodec.cxx
@@ -335,7 +335,7 @@ void ZCodec::SetBreak( sal_uIntPtr nInToRead )
     mnInToRead = nInToRead;
 }
 
-sal_uIntPtr ZCodec::GetBreak( void )
+sal_uIntPtr ZCodec::GetBreak()
 {
     return ( mnInToRead + PZSTREAM->avail_in );
 }


More information about the Libreoffice-commits mailing list