[Libreoffice-commits] core.git: package/Library_package2.mk package/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Sat Jul 31 21:28:01 UTC 2021


 package/Library_package2.mk        |    1 +
 package/source/zipapi/Deflater.cxx |    2 +-
 package/source/zipapi/Inflater.cxx |    2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 93e90309b36faa384eeebfaa6d685073c26a1975
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sat Jul 31 20:22:08 2021 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sat Jul 31 23:27:25 2021 +0200

    Use ZLIB_CONST to avoid const_cast
    
    It is available since 2011 [1]. CentOS 7, which is the baseline,
    included zlib 1.2.7, which was released in 2012, and included [1].
    
    [1] https://github.com/madler/zlib/commit/5ab9f47745fe9353291b217f705086b6070575d5,
    
    Change-Id: Ie6cf2e934579620787426d95380f8ff6d6423b7d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119627
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/package/Library_package2.mk b/package/Library_package2.mk
index 9bb7e3194b98..0c6dc4419355 100644
--- a/package/Library_package2.mk
+++ b/package/Library_package2.mk
@@ -20,6 +20,7 @@ $(eval $(call gb_Library_use_sdk_api,package2))
 
 $(eval $(call gb_Library_add_defs,package2,\
 	-DDLLIMPLEMENTATION_PACKAGE \
+	-DZLIB_CONST \
 ))
 
 $(eval $(call gb_Library_set_precompiled_header,package2,package/inc/pch/precompiled_package2))
diff --git a/package/source/zipapi/Deflater.cxx b/package/source/zipapi/Deflater.cxx
index ac0ae57cc6a1..5c0fd70121fe 100644
--- a/package/source/zipapi/Deflater.cxx
+++ b/package/source/zipapi/Deflater.cxx
@@ -69,7 +69,7 @@ Deflater::Deflater(sal_Int32 nSetLevel, bool bNowrap)
 sal_Int32 Deflater::doDeflateBytes (uno::Sequence < sal_Int8 > &rBuffer, sal_Int32 nNewOffset, sal_Int32 nNewLength)
 {
     sal_Int32 nResult;
-    pStream->next_in   = const_cast<unsigned char*>(reinterpret_cast<const unsigned char*>( sInBuffer.getConstArray() + nOffset ));
+    pStream->next_in   = reinterpret_cast<const unsigned char*>( sInBuffer.getConstArray() + nOffset );
     pStream->next_out  = reinterpret_cast<unsigned char*>(rBuffer.getArray())+nNewOffset;
     pStream->avail_in  = nLength;
     pStream->avail_out = nNewLength;
diff --git a/package/source/zipapi/Inflater.cxx b/package/source/zipapi/Inflater.cxx
index 7f8319038512..d03fed8c0968 100644
--- a/package/source/zipapi/Inflater.cxx
+++ b/package/source/zipapi/Inflater.cxx
@@ -98,7 +98,7 @@ sal_Int32 Inflater::doInflateBytes (Sequence < sal_Int8 >  &rBuffer, sal_Int32 n
 
     nLastInflateError = 0;
 
-    pStream->next_in   = const_cast<unsigned char*>(reinterpret_cast<const unsigned char*>( sInBuffer.getConstArray() + nOffset ));
+    pStream->next_in   = reinterpret_cast<const unsigned char*>( sInBuffer.getConstArray() + nOffset );
     pStream->avail_in  = nLength;
     pStream->next_out  = reinterpret_cast < unsigned char* > ( rBuffer.getArray() + nNewOffset );
     pStream->avail_out = nNewLength;


More information about the Libreoffice-commits mailing list