From 9ae4f8b5bf70a693ffb60ceac4f9625cf15b1181 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sat, 31 Jul 2021 14:31:49 +0200 Subject: getArray->getConstArray Change-Id: I951dd4a02c9ead98e7eb13ae2995ba2e1e57b38a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119740 Tested-by: Jenkins Reviewed-by: Noel Grandin --- basegfx/source/polygon/b2dpolygontools.cxx | 2 +- chart2/source/view/main/ChartView.cxx | 2 +- connectivity/source/drivers/firebird/Clob.cxx | 6 +++--- desktop/source/lib/init.cxx | 2 +- editeng/source/editeng/editeng.cxx | 4 ++-- sc/source/filter/excel/excel.cxx | 2 +- sd/source/filter/sdpptwrp.cxx | 2 +- sfx2/source/doc/doctemplates.cxx | 2 +- sot/source/sdstor/ucbstorage.cxx | 6 +++--- sot/source/unoolestorage/xolesimplestorage.cxx | 2 +- svx/source/unodraw/unoshap3.cxx | 12 ++++++------ 11 files changed, 21 insertions(+), 21 deletions(-) diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index 12401ac9756a..6e78aed363e1 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -3305,7 +3305,7 @@ namespace basegfx::utils // copy first point if closed if(bIsClosed) { - *pSequence = *rPointSequenceRetval.getArray(); + *pSequence = *rPointSequenceRetval.getConstArray(); } } else diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 85caad7560e2..4d393fde9725 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -2714,7 +2714,7 @@ void SAL_CALL ChartView::setPropertyValue( const OUString& rPropertyName throw lang::IllegalArgumentException( "Property 'ZoomFactors' requires value of type Sequence< PropertyValue >", nullptr, 0 ); sal_Int32 nFilterArgs = aZoomFactors.getLength(); - beans::PropertyValue* pDataValues = aZoomFactors.getArray(); + const beans::PropertyValue* pDataValues = aZoomFactors.getConstArray(); while( nFilterArgs-- ) { if ( pDataValues->Name == "ScaleXNumerator" ) diff --git a/connectivity/source/drivers/firebird/Clob.cxx b/connectivity/source/drivers/firebird/Clob.cxx index 358451738003..3ed83a9b19d2 100644 --- a/connectivity/source/drivers/firebird/Clob.cxx +++ b/connectivity/source/drivers/firebird/Clob.cxx @@ -58,7 +58,7 @@ sal_Int64 SAL_CALL Clob::length() { uno::Sequence < sal_Int8 > aSegmentBytes; bLastSegmRead = m_aBlob->readOneSegment( aSegmentBytes ); - OUString sSegment ( reinterpret_cast< char *>( aSegmentBytes.getArray() ), + OUString sSegment ( reinterpret_cast< const char *>( aSegmentBytes.getConstArray() ), aSegmentBytes.getLength(), RTL_TEXTENCODING_UTF8 ); @@ -90,7 +90,7 @@ OUString SAL_CALL Clob::getSubString(sal_Int64 nPosition, if( bLastRead ) throw lang::IllegalArgumentException("nPosition out of range", *this, 0); - OUString sSegment ( reinterpret_cast< char *>( aSegmentBytes.getArray() ), + OUString sSegment ( reinterpret_cast< const char *>( aSegmentBytes.getConstArray() ), aSegmentBytes.getLength(), RTL_TEXTENCODING_UTF8 ); sal_Int32 nStrLen = sSegment.getLength(); @@ -112,7 +112,7 @@ OUString SAL_CALL Clob::getSubString(sal_Int64 nPosition, uno::Sequence < sal_Int8 > aSegmentBytes; bool bLastRead = m_aBlob->readOneSegment( aSegmentBytes ); - OUString sSegment ( reinterpret_cast< char *>( aSegmentBytes.getArray() ), + OUString sSegment ( reinterpret_cast< const char *>( aSegmentBytes.getConstArray() ), aSegmentBytes.getLength(), RTL_TEXTENCODING_UTF8 ); sal_Int32 nStrLen = sSegment.getLength(); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 434b2bda81fa..54edeaa831f1 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -4315,7 +4315,7 @@ static bool getFromTransferrable( { uno::Sequence aSequence; aAny >>= aSequence; - aRet = OString(reinterpret_cast(aSequence.getArray()), aSequence.getLength()); + aRet = OString(reinterpret_cast(aSequence.getConstArray()), aSequence.getLength()); } return true; diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 9159f9b7169c..abc9f64a9b04 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -1344,7 +1344,7 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, v const ::utl::TransliterationWrapper* pTransliteration = pImpEditEngine->xTransliterationWrapper.get(); Sequence< i18n::CalendarItem2 > xItem = pImpEditEngine->xLocaleDataWrapper->getDefaultCalendarDays(); sal_Int32 nCount = xItem.getLength(); - const i18n::CalendarItem2* pArr = xItem.getArray(); + const i18n::CalendarItem2* pArr = xItem.getConstArray(); for( sal_Int32 n = 0; n <= nCount; ++n ) { const OUString& rDay = pArr[n].FullName; @@ -1359,7 +1359,7 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, v { xItem = pImpEditEngine->xLocaleDataWrapper->getDefaultCalendarMonths(); sal_Int32 nMonthCount = xItem.getLength(); - const i18n::CalendarItem2* pMonthArr = xItem.getArray(); + const i18n::CalendarItem2* pMonthArr = xItem.getConstArray(); for( sal_Int32 n = 0; n <= nMonthCount; ++n ) { const OUString& rMon = pMonthArr[n].FullName; diff --git a/sc/source/filter/excel/excel.cxx b/sc/source/filter/excel/excel.cxx index 2a42a7df2819..33842ace8270 100644 --- a/sc/source/filter/excel/excel.cxx +++ b/sc/source/filter/excel/excel.cxx @@ -379,7 +379,7 @@ static ErrCode lcl_ExportExcelBiff( SfxMedium& rMedium, ScDocument *pDocument, } uno::Sequence aStreamContent; aStreamData.Value >>= aStreamContent; - size_t nBytesWritten = pStream->WriteBytes(aStreamContent.getArray(), aStreamContent.getLength()); + size_t nBytesWritten = pStream->WriteBytes(aStreamContent.getConstArray(), aStreamContent.getLength()); if (nBytesWritten != static_cast(aStreamContent.getLength())) { eRet = ERRCODE_IO_CANTWRITE; diff --git a/sd/source/filter/sdpptwrp.cxx b/sd/source/filter/sdpptwrp.cxx index 90f851e69fa4..d44b2fab2580 100644 --- a/sd/source/filter/sdpptwrp.cxx +++ b/sd/source/filter/sdpptwrp.cxx @@ -339,7 +339,7 @@ bool SdPPTFilter::Export() } Sequence aStreamContent; aStreamData.Value >>= aStreamContent; - size_t nBytesWritten = pStream->WriteBytes(aStreamContent.getArray(), aStreamContent.getLength()); + size_t nBytesWritten = pStream->WriteBytes(aStreamContent.getConstArray(), aStreamContent.getLength()); if (nBytesWritten != static_cast(aStreamContent.getLength())) { bRet = false; diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index b1273c0b53c6..9670f7d4c2f6 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -1111,7 +1111,7 @@ void SfxDocTplService_Impl::doUpdate() // get the entries from the template directories sal_Int32 nCountDir = maTemplateDirs.getLength(); - OUString* pDirs = maTemplateDirs.getArray(); + const OUString* pDirs = maTemplateDirs.getConstArray(); Content aDirContent; // the last directory in the list must be writable diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx index 683ceada14b8..31db79361f5c 100644 --- a/sot/source/sdstor/ucbstorage.cxx +++ b/sot/source/sdstor/ucbstorage.cxx @@ -759,7 +759,7 @@ void UCBStorageStream_Impl::ReadSourceWriteTemporary() do { aReaded = m_rSource->readBytes( aData, 32000 ); - m_pStream->WriteBytes(aData.getArray(), aReaded); + m_pStream->WriteBytes(aData.getConstArray(), aReaded); } while( aReaded == 32000 ); } catch (const Exception &) @@ -791,7 +791,7 @@ sal_uInt64 UCBStorageStream_Impl::ReadSourceWriteTemporary(sal_uInt64 aLength) { sal_Int32 aToCopy = std::min( aLength - nInd, 32000 ); aReaded = m_rSource->readBytes( aData, aToCopy ); - aResult += m_pStream->WriteBytes(aData.getArray(), aReaded); + aResult += m_pStream->WriteBytes(aData.getConstArray(), aReaded); } if( aResult < aLength ) @@ -842,7 +842,7 @@ std::size_t UCBStorageStream_Impl::GetData(void* pData, std::size_t const nSize) { Sequence aData( aToRead ); std::size_t aReaded = m_rSource->readBytes( aData, aToRead ); - aResult += m_pStream->WriteBytes(static_cast(aData.getArray()), aReaded); + aResult += m_pStream->WriteBytes(static_cast(aData.getConstArray()), aReaded); memcpy( pData, aData.getArray(), aReaded ); } catch (const Exception &) diff --git a/sot/source/unoolestorage/xolesimplestorage.cxx b/sot/source/unoolestorage/xolesimplestorage.cxx index 5a7f561b0a22..6f2147c6415f 100644 --- a/sot/source/unoolestorage/xolesimplestorage.cxx +++ b/sot/source/unoolestorage/xolesimplestorage.cxx @@ -203,7 +203,7 @@ void OLESimpleStorage::InsertInputStreamToStorage_Impl( BaseStorage* pStorage, c { nRead = xInputStream->readBytes( aData, nBytesCount ); - sal_Int32 nWritten = pNewStream->Write( aData.getArray(), nRead ); + sal_Int32 nWritten = pNewStream->Write( aData.getConstArray(), nRead ); if ( nWritten < nRead ) throw io::IOException(); } while( nRead == nBytesCount ); diff --git a/svx/source/unodraw/unoshap3.cxx b/svx/source/unodraw/unoshap3.cxx index ad8286f1e97a..6750f3370ef5 100644 --- a/svx/source/unodraw/unoshap3.cxx +++ b/svx/source/unodraw/unoshap3.cxx @@ -651,9 +651,9 @@ static bool PolyPolygonShape3D_to_B3dPolyPolygon( if(nOuterSequenceCount != aSourcePolyPolygon.SequenceY.getLength() || nOuterSequenceCount != aSourcePolyPolygon.SequenceZ.getLength()) return false; - drawing::DoubleSequence* pInnerSequenceX = aSourcePolyPolygon.SequenceX.getArray(); - drawing::DoubleSequence* pInnerSequenceY = aSourcePolyPolygon.SequenceY.getArray(); - drawing::DoubleSequence* pInnerSequenceZ = aSourcePolyPolygon.SequenceZ.getArray(); + const drawing::DoubleSequence* pInnerSequenceX = aSourcePolyPolygon.SequenceX.getConstArray(); + const drawing::DoubleSequence* pInnerSequenceY = aSourcePolyPolygon.SequenceY.getConstArray(); + const drawing::DoubleSequence* pInnerSequenceZ = aSourcePolyPolygon.SequenceZ.getConstArray(); for(sal_Int32 a(0);agetLength(); @@ -662,9 +662,9 @@ static bool PolyPolygonShape3D_to_B3dPolyPolygon( return false; } basegfx::B3DPolygon aNewPolygon; - double* pArrayX = pInnerSequenceX->getArray(); - double* pArrayY = pInnerSequenceY->getArray(); - double* pArrayZ = pInnerSequenceZ->getArray(); + const double* pArrayX = pInnerSequenceX->getConstArray(); + const double* pArrayY = pInnerSequenceY->getConstArray(); + const double* pArrayZ = pInnerSequenceZ->getConstArray(); for(sal_Int32 b(0);b