From 95f5c4fb555407461fc1ab41aedbb9043105b9d6 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sat, 31 Jul 2021 10:40:00 +0200 Subject: getArray->getConstArray in package so we can avoid the const of making the Sequence singular Change-Id: I939d573c0f1e7a5d3b09a8589c0fda1e9ea38208 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119739 Tested-by: Jenkins Reviewed-by: Noel Grandin --- package/source/zipapi/Deflater.cxx | 2 +- package/source/zipapi/Inflater.cxx | 2 +- package/source/zipapi/XUnbufferedStream.cxx | 2 +- package/source/zipapi/ZipFile.cxx | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'package') diff --git a/package/source/zipapi/Deflater.cxx b/package/source/zipapi/Deflater.cxx index eacbbc9a67ac..ac0ae57cc6a1 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 = reinterpret_cast(sInBuffer.getArray()) + nOffset; + pStream->next_in = const_cast(reinterpret_cast( sInBuffer.getConstArray() + nOffset )); pStream->next_out = reinterpret_cast(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 408467ce59a1..7f8319038512 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 = reinterpret_cast( sInBuffer.getArray() + nOffset ); + pStream->next_in = const_cast(reinterpret_cast( sInBuffer.getConstArray() + nOffset )); pStream->avail_in = nLength; pStream->next_out = reinterpret_cast < unsigned char* > ( rBuffer.getArray() + nNewOffset ); pStream->avail_out = nNewLength; diff --git a/package/source/zipapi/XUnbufferedStream.cxx b/package/source/zipapi/XUnbufferedStream.cxx index c4bebeeb83da..6fe09c1162c1 100644 --- a/package/source/zipapi/XUnbufferedStream.cxx +++ b/package/source/zipapi/XUnbufferedStream.cxx @@ -198,7 +198,7 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa aData.realloc( nHeadRead + nRead ); - sal_Int8* pPureBuffer = aPureData.getArray(); + const sal_Int8* pPureBuffer = aPureData.getConstArray(); sal_Int8* pBuffer = aData.getArray(); for ( sal_Int32 nInd = 0; nInd < nRead; nInd++ ) pBuffer[ nHeadRead + nInd ] = pPureBuffer[ nInd ]; diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 02c2253182b0..0869d58931c9 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -470,7 +470,7 @@ bool ZipFile::StaticHasValidPassword( const uno::Reference< uno::XComponentConte { sal_Int32 nOldLen = aDecryptBuffer.getLength(); aDecryptBuffer.realloc( nOldLen + aDecryptBuffer2.getLength() ); - memcpy( aDecryptBuffer.getArray() + nOldLen, aDecryptBuffer2.getArray(), aDecryptBuffer2.getLength() ); + memcpy( aDecryptBuffer.getArray() + nOldLen, aDecryptBuffer2.getConstArray(), aDecryptBuffer2.getLength() ); } if ( aDecryptBuffer.getLength() > n_ConstDigestLength ) @@ -552,7 +552,7 @@ public: auto readAndCopy = [&]( sal_Int32 nReadSize ) -> sal_Int32 { sal_Int32 nBytes = xSrcStream->readBytes(aBuf, nReadSize); - const sal_Int8* p = aBuf.getArray(); + const sal_Int8* p = aBuf.getConstArray(); const sal_Int8* pEnd = p + nBytes; maBytes.insert( maBytes.end(), p, pEnd ); return nBytes; @@ -805,7 +805,7 @@ void ZipFile::readLOC( ZipEntry &rEntry ) if (nRead < aNameBuffer.getLength()) aNameBuffer.realloc(nRead); - OUString sLOCPath( reinterpret_cast(aNameBuffer.getArray()), + OUString sLOCPath( reinterpret_cast(aNameBuffer.getConstArray()), aNameBuffer.getLength(), RTL_TEXTENCODING_UTF8 ); @@ -1066,7 +1066,7 @@ void ZipFile::recover() Sequence < sal_Int8 > aFileName; aGrabber.seek( nGenPos + nPos + 30 ); aGrabber.readBytes( aFileName, aEntry.nPathLen ); - aEntry.sPath = OUString ( reinterpret_cast(aFileName.getArray()), + aEntry.sPath = OUString ( reinterpret_cast(aFileName.getConstArray()), aFileName.getLength(), RTL_TEXTENCODING_UTF8 ); aEntry.nPathLen = static_cast< sal_Int16 >(aFileName.getLength()); -- cgit