summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-09-18 15:41:16 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-09-18 16:29:08 +0200
commit9c78b8a72895831b33731e17ca7f8c825c19827a (patch)
tree23f4934f9d86ce5c5cf0bc492e0ec32e67070609
parent76650583fa8f9689de0d338a51587b97fda0426b (diff)
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@collabora.co.uk>
-rw-r--r--filter/source/svg/svgfilter.cxx5
-rw-r--r--include/tools/zcodec.hxx7
-rw-r--r--svx/source/xml/xmlgrhlp.cxx2
-rw-r--r--tools/source/zcodec/zcodec.cxx35
-rw-r--r--vcl/source/filter/GraphicFormatDetector.cxx2
-rw-r--r--vcl/source/filter/graphicfilter.cxx4
-rw-r--r--vcl/unx/generic/printer/ppdparser.cxx2
7 files changed, 10 insertions, 47 deletions
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 )