diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-07-31 10:40:00 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-31 18:21:42 +0200 |
commit | 95f5c4fb555407461fc1ab41aedbb9043105b9d6 (patch) | |
tree | 8527e8c2deb1e57568887e28b5515a1128fa8785 /package | |
parent | b1d9de5a91a21060d151f68ae8ee1d79cf04aa8f (diff) |
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'package')
-rw-r--r-- | package/source/zipapi/Deflater.cxx | 2 | ||||
-rw-r--r-- | package/source/zipapi/Inflater.cxx | 2 | ||||
-rw-r--r-- | package/source/zipapi/XUnbufferedStream.cxx | 2 | ||||
-rw-r--r-- | package/source/zipapi/ZipFile.cxx | 8 |
4 files changed, 7 insertions, 7 deletions
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<unsigned char*>(sInBuffer.getArray()) + nOffset; + pStream->next_in = const_cast<unsigned char*>(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 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<unsigned char*>( sInBuffer.getArray() + nOffset ); + pStream->next_in = const_cast<unsigned char*>(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; 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<char *>(aNameBuffer.getArray()), + OUString sLOCPath( reinterpret_cast<const char *>(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<char *>(aFileName.getArray()), + aEntry.sPath = OUString ( reinterpret_cast<const char *>(aFileName.getConstArray()), aFileName.getLength(), RTL_TEXTENCODING_UTF8 ); aEntry.nPathLen = static_cast< sal_Int16 >(aFileName.getLength()); |