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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Sep 18 14:30:22 UTC 2019


 filter/source/svg/svgfilter.cxx             |    5 ----
 include/tools/zcodec.hxx                    |    7 -----
 svx/source/xml/xmlgrhlp.cxx                 |    2 -
 tools/source/zcodec/zcodec.cxx              |   35 ++--------------------------
 vcl/source/filter/GraphicFormatDetector.cxx |    2 -
 vcl/source/filter/graphicfilter.cxx         |    4 +--
 vcl/unx/generic/printer/ppdparser.cxx       |    2 -
 7 files changed, 10 insertions(+), 47 deletions(-)

New commits:
commit 9c78b8a72895831b33731e17ca7f8c825c19827a
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Sep 18 15:41:16 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Sep 18 16:29:08 2019 +0200

    remove unused crc functionality from ZCodec
    
    Change-Id: I3e57e815b538ad5749b4bab3d4ef8e295cbe116b
    Reviewed-on: https://gerrit.libreoffice.org/79098
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx
index 7fccc61ecb55..5677d63fcc6c 100644
--- a/filter/source/svg/svgfilter.cxx
+++ b/filter/source/svg/svgfilter.cxx
@@ -696,10 +696,7 @@ private:
         {
             ZCodec aCodec;
 
-            aCodec.BeginCompression(
-                ZCODEC_DEFAULT_COMPRESSION,
-                false,
-                true);
+            aCodec.BeginCompression(ZCODEC_DEFAULT_COMPRESSION, /*gzLib*/true);
             mnFirstRead = aCodec.Read(
                 *aStream,
                 reinterpret_cast< sal_uInt8* >(mnFirstBytes.getArray()),
diff --git a/include/tools/zcodec.hxx b/include/tools/zcodec.hxx
index 9f26d263adba..ecffc67d87bf 100644
--- a/include/tools/zcodec.hxx
+++ b/include/tools/zcodec.hxx
@@ -46,22 +46,19 @@ class SAL_WARN_UNUSED TOOLS_DLLPUBLIC ZCodec
     sal_uInt8*      mpOutBuf;
     size_t const    mnOutBufSize;
 
-    sal_uInt32      mnCRC;
     int             mnCompressLevel;
-    bool            mbUpdateCrc;
     bool            mbGzLib;
     void*           mpsC_Stream;
 
     void            InitCompress();
     void            InitDecompress(SvStream & inStream);
     void            ImplWriteBack();
-    void            UpdateCRC( sal_uInt8 const * pSource, long nDatSize );
 
 public:
                     ZCodec( size_t nInBufSize = 32768, size_t nOutBufSize = 32768 );
                     ~ZCodec();
 
-    void            BeginCompression( int nCompressLevel = ZCODEC_DEFAULT_COMPRESSION, bool updateCrc = false, bool gzLib = false );
+    void            BeginCompression( int nCompressLevel = ZCODEC_DEFAULT_COMPRESSION, bool gzLib = false );
     long            EndCompression();
 
     void            Compress( SvStream& rIStm, SvStream& rOStm );
@@ -74,8 +71,6 @@ public:
 
     void            SetBreak( size_t );
     size_t          GetBreak() const;
-    void            SetCRC( sal_uInt32 nCurrentCRC );
-    sal_uInt32      GetCRC() const { return mnCRC;}
 };
 
 #endif
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
index cf16f49be84c..82f48337df01 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -326,7 +326,7 @@ Graphic SvXMLGraphicOutputStream::GetGraphic()
                 {
                     std::unique_ptr<SvMemoryStream> pDest(new SvMemoryStream);
                     ZCodec aZCodec( 0x8000, 0x8000 );
-                    aZCodec.BeginCompression(ZCODEC_DEFAULT_COMPRESSION, false, true);
+                    aZCodec.BeginCompression(ZCODEC_DEFAULT_COMPRESSION, /*gzLib*/true);
                     mpOStm->Seek( 0 );
                     aZCodec.Decompress( *mpOStm, *pDest );
 
diff --git a/tools/source/zcodec/zcodec.cxx b/tools/source/zcodec/zcodec.cxx
index ae1bc812c626..98be0dc08fcd 100644
--- a/tools/source/zcodec/zcodec.cxx
+++ b/tools/source/zcodec/zcodec.cxx
@@ -26,7 +26,6 @@
 #include <zlib.h>
 
 #include <tools/zcodec.hxx>
-#include <rtl/crc.h>
 
 #define PZSTREAM static_cast<z_stream*>(mpsC_Stream)
 
@@ -50,9 +49,7 @@ ZCodec::ZCodec( size_t nInBufSize, size_t nOutBufSize )
     , mpOStm(nullptr)
     , mpOutBuf(nullptr)
     , mnOutBufSize(nOutBufSize)
-    , mnCRC(0)
     , mnCompressLevel(0)
-    , mbUpdateCrc(false)
     , mbGzLib(false)
 {
     mpsC_Stream = new z_stream;
@@ -63,7 +60,7 @@ ZCodec::~ZCodec()
     delete static_cast<z_stream*>(mpsC_Stream);
 }
 
-void ZCodec::BeginCompression( int nCompressLevel, bool updateCrc, bool gzLib )
+void ZCodec::BeginCompression( int nCompressLevel, bool gzLib )
 {
     assert(meState == STATE_INIT);
     mbStatus = true;
@@ -73,7 +70,6 @@ void ZCodec::BeginCompression( int nCompressLevel, bool updateCrc, bool gzLib )
     mpInBuf = mpOutBuf = nullptr;
     PZSTREAM->total_out = PZSTREAM->total_in = 0;
     mnCompressLevel = nCompressLevel;
-    mbUpdateCrc = updateCrc;
     mbGzLib = gzLib;
     PZSTREAM->zalloc = nullptr;
     PZSTREAM->zfree = nullptr;
@@ -153,10 +149,6 @@ long ZCodec::Decompress( SvStream& rIStm, SvStream& rOStm )
             PZSTREAM->next_in = mpInBuf;
             PZSTREAM->avail_in = rIStm.ReadBytes(mpInBuf, nInToRead);
             mnInToRead -= nInToRead;
-
-            if ( mbUpdateCrc )
-                UpdateCRC( mpInBuf, nInToRead );
-
         }
         err = mbStatus ? inflate(PZSTREAM, Z_NO_FLUSH) : Z_ERRNO;
         if ( err < 0 )
@@ -219,10 +211,6 @@ long ZCodec::Read( SvStream& rIStm, sal_uInt8* pData, sal_uInt32 nSize )
             PZSTREAM->next_in = mpInBuf;
             PZSTREAM->avail_in = rIStm.ReadBytes(mpInBuf, nInToRead);
             mnInToRead -= nInToRead;
-
-            if ( mbUpdateCrc )
-                UpdateCRC( mpInBuf, nInToRead );
-
         }
         err = mbStatus ? inflate(PZSTREAM, Z_NO_FLUSH) : Z_ERRNO;
         if (err < 0 || err == Z_NEED_DICT)
@@ -272,10 +260,6 @@ long ZCodec::ReadAsynchron( SvStream& rIStm, sal_uInt8* pData, sal_uInt32 nSize
             PZSTREAM->next_in = mpInBuf;
             PZSTREAM->avail_in = rIStm.ReadBytes(mpInBuf, nInToRead);
             mnInToRead -= nInToRead;
-
-            if ( mbUpdateCrc )
-                UpdateCRC( mpInBuf, nInToRead );
-
         }
         err = mbStatus ? inflate(PZSTREAM, Z_NO_FLUSH) : Z_ERRNO;
         if ( err < 0 )
@@ -300,8 +284,6 @@ void ZCodec::ImplWriteBack()
 
     if ( nAvail )
     {
-        if (meState == STATE_COMPRESS && mbUpdateCrc)
-            UpdateCRC( mpOutBuf, nAvail );
         PZSTREAM->next_out = mpOutBuf;
         mpOStm->WriteBytes( mpOutBuf, nAvail );
         PZSTREAM->avail_out = mnOutBufSize;
@@ -318,12 +300,6 @@ size_t ZCodec::GetBreak() const
     return ( mnInToRead + PZSTREAM->avail_in );
 }
 
-void ZCodec::SetCRC( sal_uInt32 nCRC )
-{
-    mnCRC = nCRC;
-}
-
-
 void ZCodec::InitCompress()
 {
     assert(meState == STATE_INIT);
@@ -395,16 +371,11 @@ void ZCodec::InitDecompress(SvStream & inStream)
     mpInBuf = new sal_uInt8[ mnInBufSize ];
 }
 
-void ZCodec::UpdateCRC ( sal_uInt8 const * pSource, long nDatSize)
-{
-    mnCRC = rtl_crc32( mnCRC, pSource, nDatSize );
-}
-
 bool ZCodec::AttemptDecompression(SvStream& rIStm, SvStream& rOStm)
 {
     assert(meState == STATE_INIT);
     sal_uInt64 nStreamPos = rIStm.Tell();
-    BeginCompression(ZCODEC_DEFAULT_COMPRESSION, false/*updateCrc*/, true/*gzLib*/);
+    BeginCompression(ZCODEC_DEFAULT_COMPRESSION, true/*gzLib*/);
     InitDecompress(rIStm);
     EndCompression();
     if ( !mbStatus || rIStm.GetError() )
@@ -413,7 +384,7 @@ bool ZCodec::AttemptDecompression(SvStream& rIStm, SvStream& rOStm)
         return false;
     }
     rIStm.Seek(nStreamPos);
-    BeginCompression(ZCODEC_DEFAULT_COMPRESSION, false/*updateCrc*/, true/*gzLib*/);
+    BeginCompression(ZCODEC_DEFAULT_COMPRESSION, true/*gzLib*/);
     Decompress(rIStm, rOStm);
     EndCompression();
     if( !mbStatus || rIStm.GetError() || rOStm.GetError() )
diff --git a/vcl/source/filter/GraphicFormatDetector.cxx b/vcl/source/filter/GraphicFormatDetector.cxx
index 0281df1edfbc..1ad825ee47c7 100644
--- a/vcl/source/filter/GraphicFormatDetector.cxx
+++ b/vcl/source/filter/GraphicFormatDetector.cxx
@@ -462,7 +462,7 @@ bool GraphicFormatDetector::checkSVG()
     {
         ZCodec aCodec;
         mrStream.Seek(mnStreamPosition);
-        aCodec.BeginCompression(ZCODEC_DEFAULT_COMPRESSION, false, true);
+        aCodec.BeginCompression(ZCODEC_DEFAULT_COMPRESSION, /*gzLib*/ true);
         nDecompressedSize = aCodec.Read(mrStream, sExtendedOrDecompressedFirstBytes, 2048);
         nCheckSize = std::min<sal_uInt64>(nDecompressedSize, 256);
         aCodec.EndCompression();
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index b3ae04cc2eda..4aeee289f689 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -1260,7 +1260,7 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 size
                     ZCodec aCodec;
                     long nMemoryLength;
 
-                    aCodec.BeginCompression(ZCODEC_DEFAULT_COMPRESSION, false, true);
+                    aCodec.BeginCompression(ZCODEC_DEFAULT_COMPRESSION, /*gzLib*/true);
                     nMemoryLength = aCodec.Decompress(rIStream, aMemStream);
                     aCodec.EndCompression();
 
@@ -1628,7 +1628,7 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
                     ZCodec aCodec;
                     long nMemoryLength;
 
-                    aCodec.BeginCompression(ZCODEC_DEFAULT_COMPRESSION, false, true);
+                    aCodec.BeginCompression(ZCODEC_DEFAULT_COMPRESSION, /*gzLib*/true);
                     nMemoryLength = aCodec.Decompress(rIStream, aMemStream);
                     aCodec.EndCompression();
 
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index 68cf1ca9e12d..0d520e09d219 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -309,7 +309,7 @@ void PPDDecompressStream::Open( const OUString& i_rFile )
         // so let's try to decompress the stream
         mpMemStream.reset( new SvMemoryStream( 4096, 4096 ) );
         ZCodec aCodec;
-        aCodec.BeginCompression( ZCODEC_DEFAULT_COMPRESSION, false, true );
+        aCodec.BeginCompression( ZCODEC_DEFAULT_COMPRESSION, /*gzLib*/true );
         long nComp = aCodec.Decompress( *mpFileStream, *mpMemStream );
         aCodec.EndCompression();
         if( nComp < 0 )


More information about the Libreoffice-commits mailing list