basic/source/basmgr/basmgr.cxx | 7 basic/source/classes/eventatt.cxx | 21 -- basic/source/classes/sbunoobj.cxx | 106 +++--------- basic/source/classes/sbxmod.cxx | 3 basic/source/runtime/methods.cxx | 3 basic/source/runtime/methods1.cxx | 6 basic/source/uno/dlgcont.cxx | 7 basic/source/uno/scriptcont.cxx | 30 --- canvas/source/opengl/ogl_canvashelper.cxx | 7 connectivity/source/drivers/mysql_jdbc/YCatalog.cxx | 8 connectivity/source/drivers/mysql_jdbc/YDriver.cxx | 8 connectivity/source/drivers/mysqlc/mysqlc_connection.cxx | 28 +-- connectivity/source/drivers/odbc/OConnection.cxx | 48 ++--- connectivity/source/drivers/odbc/OResultSet.cxx | 36 +--- desktop/source/migration/services/basicmigration.cxx | 6 desktop/source/migration/services/jvmfwk.cxx | 16 - desktop/source/migration/services/oo3extensionmigration.cxx | 16 - desktop/source/migration/services/wordbookmigration.cxx | 6 extensions/source/ole/oleobjw.cxx | 13 - extensions/source/ole/unoconversionutilities.hxx | 7 extensions/source/ole/unoobjw.cxx | 28 +-- extensions/source/propctrlr/formcomponenthandler.cxx | 3 extensions/source/propctrlr/formlinkdialog.cxx | 6 extensions/source/propctrlr/propcontroller.cxx | 15 - extensions/source/propctrlr/stringrepresentation.cxx | 19 -- extensions/source/propctrlr/xsddatatypes.cxx | 9 - filter/source/msfilter/escherex.cxx | 75 ++------ filter/source/pdf/pdfinteract.cxx | 5 include/vbahelper/vbahelperinterface.hxx | 7 oox/source/docprop/docprophandler.cxx | 7 oox/source/export/chartexport.cxx | 21 -- package/source/zipapi/ByteGrabber.cxx | 31 +-- package/source/zipapi/XUnbufferedStream.cxx | 5 package/source/zippackage/ZipPackageStream.cxx | 9 - reportdesign/source/filter/xml/xmlfilter.cxx | 6 reportdesign/source/ui/inc/GeometryHandler.hxx | 4 reportdesign/source/ui/inspection/GeometryHandler.cxx | 18 -- reportdesign/source/ui/report/ReportController.cxx | 6 sax/source/expatwrap/xml2utf.cxx | 11 - sdext/source/pdfimport/filterdet.cxx | 21 +- sdext/source/pdfimport/pdfiadaptor.cxx | 18 -- sdext/source/pdfimport/tree/imagecontainer.cxx | 12 - 42 files changed, 245 insertions(+), 473 deletions(-)
New commits: commit 7b04ef05cd8c35263543dc79e48b6d41cede1f12 Author: Mike Kaganski <[email protected]> AuthorDate: Sun Dec 7 23:50:15 2025 +0500 Commit: Mike Kaganski <[email protected]> CommitDate: Mon Dec 8 10:00:21 2025 +0100 Drop some uses Sequence::getConstArray Similar to commit b280efcb9b006efefeca3a189cf789f06ab3dc96 (Drop some uses Sequence::getConstArray, 2025-12-07). Change-Id: Ieac325a660fe64e8172c5ed139380caa3d26a73c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195200 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index aa73c94a286f..f14da3658e01 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -164,18 +164,13 @@ void BasMgrContainerListenerImpl::insertLibraryImpl( const uno::Reference< scrip void BasMgrContainerListenerImpl::addLibraryModulesImpl( BasicManager const * pMgr, const uno::Reference< container::XNameAccess >& xLibNameAccess, std::u16string_view aLibName ) { - uno::Sequence< OUString > aModuleNames = xLibNameAccess->getElementNames(); - sal_Int32 nModuleCount = aModuleNames.getLength(); - StarBASIC* pLib = pMgr->GetLib( aLibName ); DBG_ASSERT( pLib, "BasMgrContainerListenerImpl::addLibraryModulesImpl: Unknown lib!"); if( !pLib ) return; - const OUString* pNames = aModuleNames.getConstArray(); - for( sal_Int32 j = 0 ; j < nModuleCount ; j++ ) + for (const OUString& aModuleName : xLibNameAccess->getElementNames()) { - OUString aModuleName = pNames[ j ]; uno::Any aElement = xLibNameAccess->getByName( aModuleName ); OUString aMod; aElement >>= aMod; diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx index be9d2ae2683c..2014be367600 100644 --- a/basic/source/classes/eventatt.cxx +++ b/basic/source/classes/eventatt.cxx @@ -284,11 +284,10 @@ void BasicScriptListener_Impl::firing_impl( const ScriptEvent& aScriptEvent, Any if( nCnt ) { xArray = new SbxArray; - const Any *pArgs = aScriptEvent.Arguments.getConstArray(); for( sal_Int32 i = 0; i < nCnt; i++ ) { SbxVariableRef xVar = new SbxVariable( SbxVARIANT ); - unoToSbxValue( xVar.get(), pArgs[i] ); + unoToSbxValue(xVar.get(), aScriptEvent.Arguments[i]); xArray->Put(xVar.get(), sal::static_int_cast<sal_uInt32>(i + 1)); } } @@ -326,29 +325,21 @@ css::uno::Reference< css::container::XNameContainer > implFindDialogLibForDialog OSL_ENSURE( xDlgLibContNameAccess.is(), "implFindDialogLibForDialog: no lib container for the given dialog!" ); if( xDlgLibContNameAccess.is() ) { - Sequence< OUString > aLibNames = xDlgLibContNameAccess->getElementNames(); - const OUString* pLibNames = aLibNames.getConstArray(); - sal_Int32 nLibNameCount = aLibNames.getLength(); - - for( sal_Int32 iLib = 0 ; iLib < nLibNameCount ; iLib++ ) + for (const OUString& rLibName : xDlgLibContNameAccess->getElementNames()) { - if ( !xDlgLibContNameAccess->isLibraryLoaded( pLibNames[ iLib ] ) ) + if (!xDlgLibContNameAccess->isLibraryLoaded(rLibName)) // if the library isn't loaded, then the dialog cannot originate from this lib continue; - Any aDlgLibAny = xDlgLibContNameAccess->getByName( pLibNames[ iLib ] ); + Any aDlgLibAny = xDlgLibContNameAccess->getByName(rLibName); Reference< XNameContainer > xDlgLibNameCont( aDlgLibAny, UNO_QUERY ); OSL_ENSURE( xDlgLibNameCont.is(), "implFindDialogLibForDialog: invalid dialog lib!" ); if( xDlgLibNameCont.is() ) { - Sequence< OUString > aDlgNames = xDlgLibNameCont->getElementNames(); - const OUString* pDlgNames = aDlgNames.getConstArray(); - sal_Int32 nDlgNameCount = aDlgNames.getLength(); - - for( sal_Int32 iDlg = 0 ; iDlg < nDlgNameCount ; iDlg++ ) + for (const OUString& rDlgName : xDlgLibNameCont->getElementNames()) { - Any aDlgAny = xDlgLibNameCont->getByName( pDlgNames[ iDlg ] ); + Any aDlgAny = xDlgLibNameCont->getByName(rDlgName); if( aDlgAny == rDlgAny ) { aRetDlgLib = xDlgLibNameCont; diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 92d691fce4ad..eaf88c60c8ce 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -1535,17 +1535,15 @@ static Any invokeAutomationMethod( const OUString& Name, Sequence< Any > const & assert(false); break; } - const sal_Int16* pIndices = OutParamIndex.getConstArray(); sal_uInt32 nLen = OutParamIndex.getLength(); if( nLen ) { - const Any* pNewValues = OutParam.getConstArray(); for( sal_uInt32 j = 0 ; j < nLen ; j++ ) { - sal_Int16 iTarget = pIndices[ j ]; + sal_Int16 iTarget = OutParamIndex[j]; if( o3tl::make_unsigned(iTarget) >= nParamCount ) break; - unoToSbxValue(pParams->Get(j + 1), pNewValues[j]); + unoToSbxValue(pParams->Get(j + 1), OutParam[j]); } } return aRetAny; @@ -1575,12 +1573,8 @@ static OUString Impl_GetInterfaceInfo( const Reference< XInterface >& x, const R aRetStr.append( " " ); // get the super interfaces - Sequence< Reference< XIdlClass > > aSuperClassSeq = xClass->getSuperclasses(); - const Reference< XIdlClass >* pClasses = aSuperClassSeq.getConstArray(); - sal_uInt32 nSuperIfaceCount = aSuperClassSeq.getLength(); - for( sal_uInt32 j = 0 ; j < nSuperIfaceCount ; j++ ) + for (const Reference<XIdlClass>& rxIfaceClass : xClass->getSuperclasses()) { - const Reference< XIdlClass >& rxIfaceClass = pClasses[j]; if( !rxIfaceClass->equals( xIfaceClass ) ) aRetStr.append( Impl_GetInterfaceInfo( x, rxIfaceClass, nRekLevel + 1 ) ); } @@ -1692,13 +1686,8 @@ bool checkUnoObjectType(SbUnoObject& rUnoObj, const OUString& rClass) // otherwise. aClassName = rClass; - Sequence< Type > aTypeSeq = xTypeProvider->getTypes(); - const Type* pTypeArray = aTypeSeq.getConstArray(); - sal_uInt32 nIfaceCount = aTypeSeq.getLength(); - for( sal_uInt32 j = 0 ; j < nIfaceCount ; j++ ) + for (const Type& rType : xTypeProvider->getTypes()) { - const Type& rType = pTypeArray[j]; - Reference<XIdlClass> xClass = TypeToIdlClass( rType ); if( !xClass.is() ) { @@ -1762,13 +1751,8 @@ static OUString Impl_GetSupportedInterfaces(SbUnoObject& rUnoObj) if( xTypeProvider.is() ) { // get the interfaces of the implementation - Sequence< Type > aTypeSeq = xTypeProvider->getTypes(); - const Type* pTypeArray = aTypeSeq.getConstArray(); - sal_uInt32 nIfaceCount = aTypeSeq.getLength(); - for( sal_uInt32 j = 0 ; j < nIfaceCount ; j++ ) + for (const Type& rType : xTypeProvider->getTypes()) { - const Type& rType = pTypeArray[j]; - Reference<XIdlClass> xClass = TypeToIdlClass( rType ); if( xClass.is() ) { @@ -1855,7 +1839,6 @@ static OUString Impl_DumpProperties(SbUnoObject& rUnoObj) Sequence<Property> props = xAccess->getProperties( PropertyConcept::ALL - PropertyConcept::DANGEROUS ); sal_uInt32 nUnoPropCount = props.getLength(); - const Property* pUnoProps = props.getConstArray(); SbxArray* pProps = rUnoObj.GetProperties(); sal_uInt32 nPropCount = pProps->Count(); @@ -1876,7 +1859,7 @@ static OUString Impl_DumpProperties(SbUnoObject& rUnoObj) bool bMaybeVoid = false; if( i < nUnoPropCount ) { - const Property& rProp = pUnoProps[ i ]; + const Property& rProp = props[i]; // For MAYBEVOID freshly convert the type from Uno, // so not just SbxEMPTY is returned. @@ -1928,7 +1911,6 @@ static OUString Impl_DumpMethods(SbUnoObject& rUnoObj) } Sequence< Reference< XIdlMethod > > methods = xAccess->getMethods ( MethodConcept::ALL - MethodConcept::DANGEROUS ); - const Reference< XIdlMethod >* pUnoMethods = methods.getConstArray(); SbxArray* pMethods = rUnoObj.GetMethods(); sal_uInt32 nMethodCount = pMethods->Count(); @@ -1947,7 +1929,7 @@ static OUString Impl_DumpMethods(SbUnoObject& rUnoObj) aRet.append( " " ); // address the method - const Reference< XIdlMethod >& rxMethod = pUnoMethods[i]; + const Reference<XIdlMethod>& rxMethod = methods[i]; // Is it in Uno a sequence? SbxDataType eType = pVar->GetFullType(); @@ -1964,13 +1946,12 @@ static OUString Impl_DumpMethods(SbUnoObject& rUnoObj) // the get-method mustn't have a parameter Sequence< Reference< XIdlClass > > aParamsSeq = rxMethod->getParameterTypes(); sal_uInt32 nParamCount = aParamsSeq.getLength(); - const Reference< XIdlClass >* pParams = aParamsSeq.getConstArray(); if( nParamCount > 0 ) { for( sal_uInt32 j = 0; j < nParamCount; j++ ) { - aRet.append ( Dbg_SbxDataType2String( unoToSbxType( pParams[ j ] ) ) ); + aRet.append(Dbg_SbxDataType2String(unoToSbxType(aParamsSeq[j]))); if( j < nParamCount - 1 ) aRet.append( ", " ); } @@ -2176,7 +2157,6 @@ void SbUnoObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { // get info const Sequence<ParamInfo>& rInfoSeq = pMeth->getParamInfos(); - const ParamInfo* pParamInfos = rInfoSeq.getConstArray(); sal_uInt32 nUnoParamCount = rInfoSeq.getLength(); sal_uInt32 nAllocParamCount = nParamCount; @@ -2195,7 +2175,7 @@ void SbUnoObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) bool bError = false; for( sal_uInt32 i = nParamCount ; i < nUnoParamCount ; i++ ) { - const ParamInfo& rInfo = pParamInfos[i]; + const ParamInfo& rInfo = rInfoSeq[i]; const Reference< XIdlClass >& rxClass = rInfo.aType; if( rxClass->getTypeClass() != TypeClass_ANY ) { @@ -2214,7 +2194,7 @@ void SbUnoObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) Any* pAnyArgs = args.getArray(); for( sal_uInt32 i = 0 ; i < nParamCount ; i++ ) { - const ParamInfo& rInfo = pParamInfos[i]; + const ParamInfo& rInfo = rInfoSeq[i]; const Reference< XIdlClass >& rxClass = rInfo.aType; css::uno::Type aType( rxClass->getTypeClass(), rxClass->getName() ); @@ -2251,19 +2231,15 @@ void SbUnoObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) // Did we to copy back the Out-Parameter? if( bOutParams ) { - const Any* pAnyArgs = args.getConstArray(); - // get info const Sequence<ParamInfo>& rInfoSeq = pMeth->getParamInfos(); - const ParamInfo* pParamInfos = rInfoSeq.getConstArray(); - sal_uInt32 j; - for( j = 0 ; j < nParamCount ; j++ ) + for (sal_uInt32 j = 0; j < nParamCount; j++) { - const ParamInfo& rInfo = pParamInfos[j]; + const ParamInfo& rInfo = rInfoSeq[j]; ParamMode aParamMode = rInfo.aMode; if( aParamMode != ParamMode_IN ) - unoToSbxValue(pParams->Get(j + 1), pAnyArgs[j]); + unoToSbxValue(pParams->Get(j + 1), args[j]); } } } @@ -2529,16 +2505,9 @@ SbxInfo* SbUnoMethod::GetInfo() { pInfo = new SbxInfo(); - const Sequence<ParamInfo>& rInfoSeq = getParamInfos(); - const ParamInfo* pParamInfos = rInfoSeq.getConstArray(); - sal_uInt32 nParamCount = rInfoSeq.getLength(); - - for( sal_uInt32 i = 0 ; i < nParamCount ; i++ ) + for (const ParamInfo& rInfo : getParamInfos()) { - const ParamInfo& rInfo = pParamInfos[i]; - OUString aParamName = rInfo.aName; - - pInfo->AddParam( aParamName, SbxVARIANT, SbxFlagBits::Read ); + pInfo->AddParam(rInfo.aName, SbxVARIANT, SbxFlagBits::Read); } } } @@ -2808,12 +2777,10 @@ void SbUnoObject::implCreateAll() // Establish properties Sequence<Property> props = xAccess->getProperties( PropertyConcept::ALL - PropertyConcept::DANGEROUS ); sal_uInt32 nPropCount = props.getLength(); - const Property* pProps_ = props.getConstArray(); - sal_uInt32 i; - for( i = 0 ; i < nPropCount ; i++ ) + for (sal_uInt32 i = 0; i < nPropCount; i++) { - const Property& rProp = pProps_[ i ]; + const Property& rProp = props[i]; // If the property could be void the type had to be set to Variant SbxDataType eSbxType; @@ -2834,13 +2801,8 @@ void SbUnoObject::implCreateAll() // Create methods Sequence< Reference< XIdlMethod > > aMethodSeq = xAccess->getMethods ( MethodConcept::ALL - MethodConcept::DANGEROUS ); - sal_uInt32 nMethCount = aMethodSeq.getLength(); - const Reference< XIdlMethod >* pMethods_ = aMethodSeq.getConstArray(); - for( i = 0 ; i < nMethCount ; i++ ) + for (const Reference<XIdlMethod>& rxMethod : aMethodSeq) { - // address method - const Reference< XIdlMethod >& rxMethod = pMethods_[i]; - // Create SbUnoMethod and superimpose it auto xMethRef = tools::make_ref<SbUnoMethod> ( rxMethod->getName(), unoToSbxType( rxMethod->getReturnType() ), rxMethod, false ); @@ -3524,13 +3486,8 @@ SbxVariable* SbUnoService::Find( const OUString& rName, SbxClassType ) { m_bNeedsInit = false; - Sequence< Reference< XServiceConstructorDescription > > aSCDSeq = m_xServiceTypeDesc->getConstructors(); - const Reference< XServiceConstructorDescription >* pCtorSeq = aSCDSeq.getConstArray(); - int nCtorCount = aSCDSeq.getLength(); - for( int i = 0 ; i < nCtorCount ; ++i ) + for (const Reference<XServiceConstructorDescription>& xCtor : m_xServiceTypeDesc->getConstructors()) { - Reference< XServiceConstructorDescription > xCtor = pCtorSeq[i]; - OUString aName( xCtor->getName() ); if( aName.isEmpty() ) { @@ -3571,7 +3528,6 @@ void SbUnoService::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) Reference< XServiceConstructorDescription > xCtor = pUnoCtor->getServiceCtorDesc(); Sequence< Reference< XParameter > > aParameterSeq = xCtor->getParameters(); - const Reference< XParameter >* pParameterSeq = aParameterSeq.getConstArray(); sal_uInt32 nUnoParamCount = aParameterSeq.getLength(); // Default: Ignore not needed parameters @@ -3581,7 +3537,7 @@ void SbUnoService::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) bool bRestParameterMode = false; if( nUnoParamCount > 0 ) { - Reference< XParameter > xLastParam = pParameterSeq[ nUnoParamCount - 1 ]; + Reference<XParameter> xLastParam = aParameterSeq[nUnoParamCount - 1]; if( xLastParam.is() ) { if( xLastParam->isRestParameter() ) @@ -3639,7 +3595,7 @@ void SbUnoService::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) Reference< XParameter > xParam; if( i < nUnoParamCount ) { - xParam = pParameterSeq[i]; + xParam = aParameterSeq[i]; if( !xParam.is() ) continue; @@ -3686,16 +3642,14 @@ void SbUnoService::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) // Copy back out parameters? if( bOutParams ) { - const Any* pAnyArgs = args.getConstArray(); - for( sal_uInt32 j = 0 ; j < nUnoParamCount ; j++ ) { - Reference< XParameter > xParam = pParameterSeq[j]; + Reference<XParameter> xParam = aParameterSeq[j]; if( !xParam.is() ) continue; if( xParam->isOut() ) - unoToSbxValue(pParams->Get(j + 1), pAnyArgs[j]); + unoToSbxValue(pParams->Get(j + 1), args[j]); } } } @@ -3849,13 +3803,12 @@ void BasicAllListener_Impl::firing_impl( const AllEventObject& Event, Any* pRet { // Create in a Basic Array SbxArrayRef xSbxArray = new SbxArray( SbxVARIANT ); - const Any * pArgs = Event.Arguments.getConstArray(); sal_Int32 nCount = Event.Arguments.getLength(); for( sal_Int32 i = 0; i < nCount; i++ ) { // Convert elements SbxVariableRef xVar = new SbxVariable( SbxVARIANT ); - unoToSbxValue( xVar.get(), pArgs[i] ); + unoToSbxValue(xVar.get(), Event.Arguments[i]); xSbxArray->Put(xVar.get(), i + 1); } @@ -3987,13 +3940,11 @@ Any SAL_CALL InvocationToAllListenerMapper::invoke(const OUString& FunctionName, else { Sequence< ParamInfo > aParamSeq = xMethod->getParameterInfos(); - sal_uInt32 nParamCount = aParamSeq.getLength(); - if( nParamCount > 1 ) + if (aParamSeq.getLength() > 1) { - const ParamInfo* pInfo = aParamSeq.getConstArray(); - for( sal_uInt32 i = 0 ; i < nParamCount ; i++ ) + for (const ParamInfo& rInfo : aParamSeq) { - if( pInfo[ i ].aMode != ParamMode_IN ) + if (rInfo.aMode != ParamMode_IN) { bApproveFiring = true; break; @@ -4352,11 +4303,10 @@ Any SAL_CALL ModuleInvocationProxy::invoke( const OUString& rFunction, if( nParamCount ) { xArray = new SbxArray; - const Any *pArgs = rParams.getConstArray(); for( sal_Int32 i = 0 ; i < nParamCount ; i++ ) { SbxVariableRef xVar = new SbxVariable( SbxVARIANT ); - unoToSbxValue( xVar.get(), pArgs[i] ); + unoToSbxValue(xVar.get(), rParams[i]); xArray->Put(xVar.get(), sal::static_int_cast<sal_uInt16>(i + 1)); } } diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 722b9210db29..eb805132e111 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -226,11 +226,10 @@ DocObjectWrapper::invoke( const OUString& aFunctionName, const Sequence< Any >& if ( nParamsCount > 0 ) { xSbxParams = new SbxArray; - const Any* pParams = aParams.getConstArray(); for ( sal_Int32 i = 0; i < nParamsCount; ++i ) { SbxVariableRef xSbxVar = new SbxVariable( SbxVARIANT ); - unoToSbxValue( xSbxVar.get(), pParams[i] ); + unoToSbxValue(xSbxVar.get(), aParams[i]); xSbxParams->Put(xSbxVar.get(), static_cast<sal_uInt32>(i) + 1); // Enable passing by ref diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index e88ad755a886..bc4692a7a747 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -2517,8 +2517,7 @@ void SbRtl_Dir(StarBASIC *, SbxArray & rPar, bool) } else { - OUString aFile - = rRTLData.aDirSeq.getConstArray()[rRTLData.nCurDirPos++]; + OUString aFile = rRTLData.aDirSeq[rRTLData.nCurDirPos++]; if( bCompatibility ) { diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx index 7e2b8cf28ec8..37e3c18953fd 100644 --- a/basic/source/runtime/methods1.cxx +++ b/basic/source/runtime/methods1.cxx @@ -1567,8 +1567,7 @@ void SbRtl_MonthName(StarBASIC *, SbxArray & rPar, bool) if( nParCount == 3 ) bAbbreviate = rPar.Get(2)->GetBool(); - const CalendarItem2* pCalendarItems = aMonthSeq.getConstArray(); - const CalendarItem2& rItem = pCalendarItems[nVal - 1]; + const CalendarItem2& rItem = aMonthSeq[nVal - 1]; OUString aRetStr = ( bAbbreviate ? rItem.AbbrevName : rItem.FullName ); rPar.Get(0)->PutString(aRetStr); @@ -1625,8 +1624,7 @@ void SbRtl_WeekdayName(StarBASIC *, SbxArray & rPar, bool) } } - const CalendarItem2* pCalendarItems = aDaySeq.getConstArray(); - const CalendarItem2& rItem = pCalendarItems[nDay - 1]; + const CalendarItem2& rItem = aDaySeq[nDay - 1]; OUString aRetStr = ( bAbbreviate ? rItem.AbbrevName : rItem.FullName ); rPar.Get(0)->PutString(aRetStr); diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx index 0402e9188ed0..a17f8b0949eb 100644 --- a/basic/source/uno/dlgcont.cxx +++ b/basic/source/uno/dlgcont.cxx @@ -422,13 +422,8 @@ Reference< css::resource::XStringResourcePersistence > void SfxDialogLibraryContainer::onNewRootStorage() { // the library container is not modified, go through the libraries and check whether they are modified - Sequence< OUString > aNames = maNameContainer.getElementNames(); - const OUString* pNames = aNames.getConstArray(); - sal_Int32 nNameCount = aNames.getLength(); - - for( sal_Int32 i = 0 ; i < nNameCount ; i++ ) + for (const OUString& aName : maNameContainer.getElementNames()) { - OUString aName = pNames[ i ]; SfxDialogLibrary* pDialogLibrary = static_cast<SfxDialogLibrary*>( getImplLib( aName ) ); Reference< resource::XStringResourcePersistence > xStringResourcePersistence = diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx index bf44665f222d..a12476a255e1 100644 --- a/basic/source/uno/scriptcont.cxx +++ b/basic/source/uno/scriptcont.cxx @@ -502,16 +502,11 @@ void SAL_CALL SfxScriptLibraryContainer::changeLibraryPassword( const OUString& if( !(bKillCryptedFiles || bKillUnencryptedFiles) ) return; - Sequence< OUString > aElementNames = pImplLib->getElementNames(); - sal_Int32 nNameCount = aElementNames.getLength(); - const OUString* pNames = aElementNames.getConstArray(); OUString aLibDirPath = createAppLibraryFolder( pImplLib, Name ); try { - for( sal_Int32 i = 0 ; i < nNameCount ; i++ ) + for (const OUString& aElementName : pImplLib->getElementNames()) { - OUString aElementName = pNames[ i ]; - INetURLObject aElementInetObj( aLibDirPath ); aElementInetObj.insertName( aElementName, false, INetURLObject::LAST_SEGMENT, @@ -592,18 +587,13 @@ bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, cons { return false; } - Sequence< OUString > aElementNames = pLib->getElementNames(); - sal_Int32 nNameCount = aElementNames.getLength(); - const OUString* pNames = aElementNames.getConstArray(); bool bLink = pLib->mbLink; bool bStorage = xStorage.is() && !bLink; if( bStorage ) { - for( sal_Int32 i = 0 ; i < nNameCount ; i++ ) + for (const OUString& aElementName : pLib->getElementNames()) { - OUString aElementName = pNames[ i ]; - // Write binary image stream SbModule* pMod = pBasicLib->FindModule( aElementName ); if( pMod ) @@ -709,10 +699,8 @@ bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, cons aLibDirPath = createAppLibraryFolder( pLib, aName ); } - for( sal_Int32 i = 0 ; i < nNameCount ; i++ ) + for (const OUString& aElementName : pLib->getElementNames()) { - OUString aElementName = pNames[ i ]; - INetURLObject aElementInetObj( aLibDirPath ); aElementInetObj.insertName( aElementName, false, INetURLObject::LAST_SEGMENT, @@ -853,10 +841,6 @@ bool SfxScriptLibraryContainer::implLoadPasswordLibrary pScriptLib->mbLoadedSource = true; } - Sequence< OUString > aElementNames = pLib->getElementNames(); - sal_Int32 nNameCount = aElementNames.getLength(); - const OUString* pNames = aElementNames.getConstArray(); - if( bStorage ) { uno::Reference< embed::XStorage > xLibrariesStor; @@ -879,10 +863,8 @@ bool SfxScriptLibraryContainer::implLoadPasswordLibrary return false; } - for( sal_Int32 i = 0 ; i < nNameCount ; i++ ) + for (const OUString& aElementName : pLib->getElementNames()) { - OUString aElementName = pNames[ i ]; - // Load binary if( bLoadBinary ) { @@ -976,10 +958,8 @@ bool SfxScriptLibraryContainer::implLoadPasswordLibrary { OUString aLibDirPath = createAppLibraryFolder( pLib, Name ); - for( sal_Int32 i = 0 ; i < nNameCount ; i++ ) + for (const OUString& aElementName : pLib->getElementNames()) { - OUString aElementName = pNames[ i ]; - INetURLObject aElementInetObj( aLibDirPath ); aElementInetObj.insertName( aElementName, false, INetURLObject::LAST_SEGMENT, INetURLObject::EncodeMechanism::All ); diff --git a/canvas/source/opengl/ogl_canvashelper.cxx b/canvas/source/opengl/ogl_canvashelper.cxx index d1cfa304d861..0b6f0f1c147e 100644 --- a/canvas/source/opengl/ogl_canvashelper.cxx +++ b/canvas/source/opengl/ogl_canvashelper.cxx @@ -761,10 +761,7 @@ namespace oglcanvas uno::Sequence<double> aLogicalAdvancements=xLayoutetText->queryLogicalAdvancements(); if( aLogicalAdvancements.hasElements() ) { - KernArraySpan aDXArray(aLogicalAdvancements.getConstArray(), aLogicalAdvancements.getLength()); - uno::Sequence<sal_Bool> aKashidaPositions=xLayoutetText->queryKashidaPositions(); - std::span<const sal_Bool> aKashidaArray(aKashidaPositions.getConstArray(), aKashidaPositions.getLength()); // get the glyphs pVDev->GetTextOutlines(rAct.maPolyPolys, @@ -773,8 +770,8 @@ namespace oglcanvas aTxt.StartPosition, aTxt.Length, 0, - aDXArray, - aKashidaArray); + aLogicalAdvancements, + aKashidaPositions); } else { diff --git a/connectivity/source/drivers/mysql_jdbc/YCatalog.cxx b/connectivity/source/drivers/mysql_jdbc/YCatalog.cxx index 7f4b0232e0c8..a33db498fc27 100644 --- a/connectivity/source/drivers/mysql_jdbc/YCatalog.cxx +++ b/connectivity/source/drivers/mysql_jdbc/YCatalog.cxx @@ -115,13 +115,11 @@ Sequence<Type> SAL_CALL OMySQLCatalog::getTypes() Sequence<Type> aTypes = OCatalog::getTypes(); std::vector<Type> aOwnTypes; aOwnTypes.reserve(aTypes.getLength()); - const Type* pBegin = aTypes.getConstArray(); - const Type* pEnd = pBegin + aTypes.getLength(); - for (; pBegin != pEnd; ++pBegin) + for (const Type& rType : aTypes) { - if (*pBegin != cppu::UnoType<XGroupsSupplier>::get()) + if (rType != cppu::UnoType<XGroupsSupplier>::get()) { - aOwnTypes.push_back(*pBegin); + aOwnTypes.push_back(rType); } } return Sequence<Type>(aOwnTypes.data(), aOwnTypes.size()); diff --git a/connectivity/source/drivers/mysql_jdbc/YDriver.cxx b/connectivity/source/drivers/mysql_jdbc/YDriver.cxx index 2707ddf7f8e8..64be20c68a9a 100644 --- a/connectivity/source/drivers/mysql_jdbc/YDriver.cxx +++ b/connectivity/source/drivers/mysql_jdbc/YDriver.cxx @@ -141,15 +141,13 @@ Sequence<PropertyValue> lcl_convertProperties(T_DRIVERTYPE _eType, const OUString& _sUrl) { std::vector<PropertyValue> aProps; - const PropertyValue* pSupported = info.getConstArray(); - const PropertyValue* pEnd = pSupported + info.getLength(); aProps.reserve(info.getLength() + 5); bool jdc = false; - for (; pSupported != pEnd; ++pSupported) + for (const PropertyValue& rSupported : info) { - aProps.push_back(*pSupported); - if (pSupported->Name == "JavaDriverClass") + aProps.push_back(rSupported); + if (rSupported.Name == "JavaDriverClass") { jdc = true; } diff --git a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx index 631208f70293..7d748f3ebf5a 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx @@ -119,40 +119,38 @@ void OConnection::construct(const OUString& url, const Sequence<PropertyValue>& } // get user and password for mysql connection - const PropertyValue* pIter = info.getConstArray(); - const PropertyValue* pEnd = pIter + info.getLength(); OUString aUser, aPass, sUnixSocket, sNamedPipe; bool unixSocketPassed = false; bool namedPipePassed = false; m_settings.connectionURL = url; - for (; pIter != pEnd; ++pIter) + for (const PropertyValue& rPropertyValue : info) { - if (pIter->Name == "user") + if (rPropertyValue.Name == "user") { - OSL_VERIFY(pIter->Value >>= aUser); + OSL_VERIFY(rPropertyValue.Value >>= aUser); } - else if (pIter->Name == "password") + else if (rPropertyValue.Name == "password") { - OSL_VERIFY(pIter->Value >>= aPass); + OSL_VERIFY(rPropertyValue.Value >>= aPass); } - else if (pIter->Name == "LocalSocket") + else if (rPropertyValue.Name == "LocalSocket") { - OSL_VERIFY(pIter->Value >>= sUnixSocket); + OSL_VERIFY(rPropertyValue.Value >>= sUnixSocket); unixSocketPassed = !sUnixSocket.isEmpty(); } - else if (pIter->Name == "NamedPipe") + else if (rPropertyValue.Name == "NamedPipe") { - OSL_VERIFY(pIter->Value >>= sNamedPipe); + OSL_VERIFY(rPropertyValue.Value >>= sNamedPipe); namedPipePassed = !sNamedPipe.isEmpty(); } - else if (pIter->Name == "PublicConnectionURL") + else if (rPropertyValue.Name == "PublicConnectionURL") { - OSL_VERIFY(pIter->Value >>= m_settings.connectionURL); + OSL_VERIFY(rPropertyValue.Value >>= m_settings.connectionURL); } - else if (pIter->Name == "NewURL") + else if (rPropertyValue.Name == "NewURL") { // legacy name for "PublicConnectionURL" - OSL_VERIFY(pIter->Value >>= m_settings.connectionURL); + OSL_VERIFY(rPropertyValue.Value >>= m_settings.connectionURL); } } diff --git a/connectivity/source/drivers/odbc/OConnection.cxx b/connectivity/source/drivers/odbc/OConnection.cxx index ea42757cdac9..89b806564cfc 100644 --- a/connectivity/source/drivers/odbc/OConnection.cxx +++ b/connectivity/source/drivers/odbc/OConnection.cxx @@ -183,71 +183,69 @@ SQLRETURN OConnection::Construct(const OUString& url,const Sequence< PropertyVal sal_Int32 nTimeout = 20; bool bSilent = true; - const PropertyValue *pBegin = info.getConstArray(); - const PropertyValue *pEnd = pBegin + info.getLength(); - for(;pBegin != pEnd;++pBegin) + for (const PropertyValue& rPropertyValue : info) { - if( pBegin->Name == "Timeout") + if (rPropertyValue.Name == "Timeout") { - if( ! (pBegin->Value >>= nTimeout) ) + if (!(rPropertyValue.Value >>= nTimeout)) SAL_WARN("connectivity.odbc", "Construct: unable to get property Timeout"); } - else if( pBegin->Name == "Silent") + else if (rPropertyValue.Name == "Silent") { - if( ! (pBegin->Value >>= bSilent) ) + if (!(rPropertyValue.Value >>= bSilent)) SAL_WARN("connectivity.odbc", "Construct: unable to get property Silent"); } - else if( pBegin->Name == "IgnoreDriverPrivileges") + else if (rPropertyValue.Name == "IgnoreDriverPrivileges") { - if( ! (pBegin->Value >>= m_bIgnoreDriverPrivileges) ) + if (!(rPropertyValue.Value >>= m_bIgnoreDriverPrivileges)) SAL_WARN("connectivity.odbc", "Construct: unable to get property IgnoreDriverPrivileges"); } - else if( pBegin->Name == "PreventGetVersionColumns") + else if (rPropertyValue.Name == "PreventGetVersionColumns") { - if( ! (pBegin->Value >>= m_bPreventGetVersionColumns) ) + if (!(rPropertyValue.Value >>= m_bPreventGetVersionColumns)) SAL_WARN("connectivity.odbc", "Construct: unable to get property PreventGetVersionColumns"); } - else if( pBegin->Name == "IsAutoRetrievingEnabled") + else if (rPropertyValue.Name == "IsAutoRetrievingEnabled") { bool bAutoRetrievingEnabled = false; - if( ! (pBegin->Value >>= bAutoRetrievingEnabled) ) + if (!(rPropertyValue.Value >>= bAutoRetrievingEnabled)) SAL_WARN("connectivity.odbc", "Construct: unable to get property IsAutoRetrievingEnabled"); enableAutoRetrievingEnabled(bAutoRetrievingEnabled); } - else if( pBegin->Name == "AutoRetrievingStatement") + else if (rPropertyValue.Name == "AutoRetrievingStatement") { OUString sGeneratedValueStatement; - if( ! (pBegin->Value >>= sGeneratedValueStatement) ) + if (!(rPropertyValue.Value >>= sGeneratedValueStatement)) SAL_WARN("connectivity.odbc", "Construct: unable to get property AutoRetrievingStatement"); setAutoRetrievingStatement(sGeneratedValueStatement); } - else if( pBegin->Name == "user") + else if (rPropertyValue.Name == "user") { - if( ! (pBegin->Value >>= aUID) ) + if (!(rPropertyValue.Value >>= aUID)) SAL_WARN("connectivity.odbc", "Construct: unable to get property user"); aDSN += ";UID=" + aUID; } - else if( pBegin->Name == "password") + else if (rPropertyValue.Name == "password") { - if( ! (pBegin->Value >>= aPWD) ) + if (!(rPropertyValue.Value >>= aPWD)) SAL_WARN("connectivity.odbc", "Construct: unable to get property password"); aDSN += ";PWD=" + aPWD; } - else if( pBegin->Name == "UseCatalog") + else if (rPropertyValue.Name == "UseCatalog") { - if( !( pBegin->Value >>= m_bUseCatalog) ) + if (!(rPropertyValue.Value >>= m_bUseCatalog)) SAL_WARN("connectivity.odbc", "Construct: unable to get property UseCatalog"); } - else if( pBegin->Name == "SystemDriverSettings") + else if (rPropertyValue.Name == "SystemDriverSettings") { - if( ! (pBegin->Value >>= aSysDrvSettings) ) + if (!(rPropertyValue.Value >>= aSysDrvSettings)) SAL_WARN("connectivity.odbc", "Construct: unable to get property SystemDriverSettings"); aDSN += ";" + aSysDrvSettings; } - else if( pBegin->Name == "CharSet") + else if (rPropertyValue.Name == "CharSet") { OUString sIanaName; - if( ! (pBegin->Value >>= sIanaName) ) + if (!(rPropertyValue.Value >>= sIanaName)) SAL_WARN("connectivity.odbc", "Construct: unable to get property CharSet"); ::dbtools::OCharsetMap aLookupIanaName; diff --git a/connectivity/source/drivers/odbc/OResultSet.cxx b/connectivity/source/drivers/odbc/OResultSet.cxx index a0e25e9b583f..7f13ce54625f 100644 --- a/connectivity/source/drivers/odbc/OResultSet.cxx +++ b/connectivity/source/drivers/odbc/OResultSet.cxx @@ -1269,26 +1269,22 @@ sal_Int32 SAL_CALL OResultSet::hashBookmark( const Any& /*bookmark*/ ) Sequence< sal_Int32 > SAL_CALL OResultSet::deleteRows( const Sequence< Any >& rows ) { Sequence< sal_Int32 > aRet(rows.getLength()); - sal_Int32 *pRet = aRet.getArray(); - - const Any *pBegin = rows.getConstArray(); - const Any *pEnd = pBegin + rows.getLength(); - - for(;pBegin != pEnd;++pBegin,++pRet) - { - try - { - if(moveToBookmark(*pBegin)) - { - deleteRow(); - *pRet = 1; - } - } - catch(const SQLException&) - { - *pRet = 0; - } - } + std::transform(rows.begin(), rows.end(), aRet.getArray(), + [this](const Any& row) + { + try + { + if (moveToBookmark(row)) + { + deleteRow(); + return 1; + } + } + catch (const SQLException&) + { + } + return 0; + }); return aRet; } diff --git a/desktop/source/migration/services/basicmigration.cxx b/desktop/source/migration/services/basicmigration.cxx index 252e1453ba04..8ee4c6258132 100644 --- a/desktop/source/migration/services/basicmigration.cxx +++ b/desktop/source/migration/services/basicmigration.cxx @@ -157,12 +157,10 @@ namespace migration { ::osl::MutexGuard aGuard( m_aMutex ); - const Any* pIter = aArguments.getConstArray(); - const Any* pEnd = pIter + aArguments.getLength(); - for ( ; pIter != pEnd ; ++pIter ) + for (const Any& rArg : aArguments) { beans::NamedValue aValue; - *pIter >>= aValue; + rArg >>= aValue; if ( aValue.Name == "UserData" ) { if ( !(aValue.Value >>= m_sSourceDir) ) diff --git a/desktop/source/migration/services/jvmfwk.cxx b/desktop/source/migration/services/jvmfwk.cxx index eb1d6bd19c05..76edafcee621 100644 --- a/desktop/source/migration/services/jvmfwk.cxx +++ b/desktop/source/migration/services/jvmfwk.cxx @@ -173,13 +173,11 @@ css::uno::Sequence< OUString > SAL_CALL JavaMigration::getSupportedServiceNames( //XInitialization ---------------------------------------------------------------------- void SAL_CALL JavaMigration::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) { - const css::uno::Any* pIter = aArguments.getConstArray(); - const css::uno::Any* pEnd = pIter + aArguments.getLength(); css::uno::Sequence<css::beans::NamedValue> aOldConfigValues; - css::beans::NamedValue aValue; - for(;pIter != pEnd;++pIter) + for (const css::uno::Any& rArg : aArguments) { - *pIter >>= aValue; + css::beans::NamedValue aValue; + rArg >>= aValue; if ( aValue.Name == "OldConfiguration" ) { bool bSuccess = aValue.Value >>= aOldConfigValues; @@ -187,13 +185,11 @@ void SAL_CALL JavaMigration::initialize( const css::uno::Sequence< css::uno::Any "] XInitialization::initialize: Argument OldConfiguration has wrong type."); if (bSuccess) { - const css::beans::NamedValue* pIter2 = aOldConfigValues.getConstArray(); - const css::beans::NamedValue* pEnd2 = pIter2 + aOldConfigValues.getLength(); - for(;pIter2 != pEnd2;++pIter2) + for (const css::beans::NamedValue& rNamedValue : aOldConfigValues) { - if ( pIter2->Name == "org.openoffice.Office.Java" ) + if (rNamedValue.Name == "org.openoffice.Office.Java") { - pIter2->Value >>= m_xLayer; + rNamedValue.Value >>= m_xLayer; break; } } diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx index 70835a3cf187..0c98e001e819 100644 --- a/desktop/source/migration/services/oo3extensionmigration.cxx +++ b/desktop/source/migration/services/oo3extensionmigration.cxx @@ -281,12 +281,10 @@ void OO3ExtensionMigration::initialize( const Sequence< Any >& aArguments ) { ::osl::MutexGuard aGuard( m_aMutex ); - const Any* pIter = aArguments.getConstArray(); - const Any* pEnd = pIter + aArguments.getLength(); - for ( ; pIter != pEnd ; ++pIter ) + for (const Any& rArg : aArguments) { beans::NamedValue aValue; - *pIter >>= aValue; + rArg >>= aValue; if ( aValue.Name == "UserData" ) { if ( !(aValue.Value >>= m_sSourceDir) ) @@ -360,16 +358,10 @@ void TmpRepositoryCommandEnv::handle( bool approve = true; // select: - uno::Sequence< Reference< task::XInteractionContinuation > > conts( - xRequest->getContinuations() ); - Reference< task::XInteractionContinuation > const * pConts = - conts.getConstArray(); - sal_Int32 len = conts.getLength(); - for ( sal_Int32 pos = 0; pos < len; ++pos ) + for (const Reference<task::XInteractionContinuation>& rCont : xRequest->getContinuations()) { if (approve) { - uno::Reference< task::XInteractionApprove > xInteractionApprove( - pConts[ pos ], uno::UNO_QUERY ); + uno::Reference<task::XInteractionApprove> xInteractionApprove(rCont, uno::UNO_QUERY); if (xInteractionApprove.is()) { xInteractionApprove->select(); // don't query again for ongoing continuations: diff --git a/desktop/source/migration/services/wordbookmigration.cxx b/desktop/source/migration/services/wordbookmigration.cxx index 7938610a01ae..debab6982c6b 100644 --- a/desktop/source/migration/services/wordbookmigration.cxx +++ b/desktop/source/migration/services/wordbookmigration.cxx @@ -188,12 +188,10 @@ static bool IsUserWordbook( const OUString& rFile ) { ::osl::MutexGuard aGuard( m_aMutex ); - const Any* pIter = aArguments.getConstArray(); - const Any* pEnd = pIter + aArguments.getLength(); - for ( ; pIter != pEnd ; ++pIter ) + for (const Any& rArg : aArguments) { beans::NamedValue aValue; - *pIter >>= aValue; + rArg >>= aValue; if ( aValue.Name == "UserData" ) { if ( !(aValue.Value >>= m_sSourceDir) ) diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx index e3e5c23357f5..2a3467b4bcdc 100644 --- a/extensions/source/ole/oleobjw.cxx +++ b/extensions/source/ole/oleobjw.cxx @@ -784,7 +784,7 @@ Any IUnknownWrapper::invokeWithDispIdUnoTlb(const OUString& sFunctionName, // In parameter if( pMethod->pParams[i].bIn && ! pMethod->pParams[i].bOut) { - anyToVariant( &pVarParams[parameterCount - i -1], Params.getConstArray()[i]); + anyToVariant( &pVarParams[parameterCount - i -1], Params[i]); } // Out parameter + in/out parameter else if( pMethod->pParams[i].bOut ) @@ -937,7 +937,7 @@ Any IUnknownWrapper::invokeWithDispIdUnoTlb(const OUString& sFunctionName, // In parameter if( pMethod->pParams[i].bIn && ! pMethod->pParams[i].bOut) { - anyToVariant( &pVarParams[parameterCount - i -1], Params.getConstArray()[i]); + anyToVariant( &pVarParams[parameterCount - i -1], Params[i]); } // Out parameter + in/out parameter else if( pMethod->pParams[i].bOut ) @@ -962,7 +962,7 @@ Any IUnknownWrapper::invokeWithDispIdUnoTlb(const OUString& sFunctionName, if( pMethod->pParams[i].bIn ) // in / out { CComVariant varParam; - anyToVariant( &varParam, Params.getConstArray()[i]); + anyToVariant( &varParam, Params[i]); CComDispatchDriver dispDriver( pDisp); if(FAILED( dispDriver.PutPropertyByName( L"0", &varParam))) throw BridgeRuntimeError( @@ -1359,7 +1359,7 @@ uno::Any SAL_CALL IUnknownWrapper::directInvoke( const OUString& aName, const un arRefArgs[revIndex].byref = nullptr; Any anyArg; if ( nInd < aParams.getLength() ) - anyArg = aParams.getConstArray()[nInd]; + anyArg = aParams[nInd]; // Property Put arguments if ( anyArg.getValueType() == cppu::UnoType<PropertyPutArgument>::get() ) @@ -1805,7 +1805,7 @@ Any IUnknownWrapper::invokeWithDispIdComTlb(FuncDesc& aFuncDesc, arRefArgs[revIndex].byref=nullptr; Any anyArg; if ( i < nUnoArgs) - anyArg= Params.getConstArray()[i]; + anyArg= Params[i]; unsigned short paramFlags = PARAMFLAG_FOPT | PARAMFLAG_FIN; VARTYPE varType = VT_VARIANT; @@ -2115,7 +2115,6 @@ void IUnknownWrapper::getFuncDescForInvoke(const OUString & sFuncName, FUNCDESC** pFuncDesc) { int nUnoArgs = seqArgs.getLength(); - const Any * arArgs = seqArgs.getConstArray(); ITypeInfo* pInfo = getTypeInfo(); //If the last of the positional arguments is a PropertyPutArgument @@ -2125,7 +2124,7 @@ void IUnknownWrapper::getFuncDescForInvoke(const OUString & sFuncName, //or in a list of named arguments. A PropertyPutArgument is actually a named argument //hence it must not be put in an extra NamedArgument structure if (nUnoArgs > 0 && - arArgs[nUnoArgs - 1].getValueType() == cppu::UnoType<PropertyPutArgument>::get()) + seqArgs[nUnoArgs - 1].getValueType() == cppu::UnoType<PropertyPutArgument>::get()) { // DISPATCH_PROPERTYPUT FuncDesc aDescGet(pInfo); diff --git a/extensions/source/ole/unoconversionutilities.hxx b/extensions/source/ole/unoconversionutilities.hxx index e14cf455ac82..746957525478 100644 --- a/extensions/source/ole/unoconversionutilities.hxx +++ b/extensions/source/ole/unoconversionutilities.hxx @@ -1089,7 +1089,6 @@ SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq, void* pSAData; if( SUCCEEDED( SafeArrayAccessData( pArray, &pSAData))) { - const sal_Int32* parElementCount= seqElementCounts.getConstArray(); uno_Sequence * pMultiSeq= *static_cast<uno_Sequence* const*>(rSeq.getValue()); sal_Int32 dimsSeq= dims - 1; @@ -1139,13 +1138,13 @@ SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq, // Calculate the current position within the datablock of the SAFEARRAY // for the next Sequence. sal_Int32 memOffset= 0; - sal_Int32 dimWeight= parElementCount[ dims - 1]; // size of the rightmost dimension + sal_Int32 dimWeight = seqElementCounts[dims - 1]; // size of the rightmost dimension for(sal_Int32 idims=0; idims < dimsSeq; idims++ ) { memOffset+= arDimsSeqIndices[dimsSeq - 1 - idims] * dimWeight; // now determine the weight of the dimension to the left of the current. if( dims - 2 - idims >=0) - dimWeight*= parElementCount[dims - 2 - idims]; + dimWeight *= seqElementCounts[dims - 2 - idims]; } psaCurrentData= static_cast<char*>(pSAData) + memOffset * oleElementSize; // convert the Sequence and put the elements into the Safearray @@ -1174,7 +1173,7 @@ SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq, psaCurrentData+= oleElementSize; } } - while( incrementMultidimensionalIndex( dimsSeq, parElementCount, arDimsSeqIndices)); + while( incrementMultidimensionalIndex( dimsSeq, seqElementCounts.getConstArray(), arDimsSeqIndices)); SafeArrayUnaccessData( pArray); } diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx index 6e3cca6446cb..12b6fec263f8 100644 --- a/extensions/source/ole/unoobjw.cxx +++ b/extensions/source/ole/unoobjw.cxx @@ -1996,23 +1996,17 @@ HRESULT InterfaceOleWrapper::doInvoke( DISPPARAMS * pdispparams, VARIANT * pvarR outParams); // try to write back out parameter - if (outIndex.getLength() > 0) + for (sal_Int32 i = 0; i < outIndex.getLength(); i++) { - const sal_Int16* pOutIndex = outIndex.getConstArray(); - const Any* pOutParams = outParams.getConstArray(); - - for (sal_Int32 i = 0; i < outIndex.getLength(); i++) - { - CComVariant variant; - // Currently a Sequence is converted to an SafeArray of VARIANTs. - anyToVariant( &variant, pOutParams[i]); - - // out parameter need special handling if they are VT_DISPATCH - // and used in JScript - int outindex= pOutIndex[i]; - writeBackOutParameter2(&(pdispparams->rgvarg[pdispparams->cArgs - 1 - outindex]), - &variant ); - } + CComVariant variant; + // Currently a Sequence is converted to an SafeArray of VARIANTs. + anyToVariant(&variant, outParams[i]); + + // out parameter need special handling if they are VT_DISPATCH + // and used in JScript + int outindex = outIndex[i]; + writeBackOutParameter2(&(pdispparams->rgvarg[pdispparams->cArgs - 1 - outindex]), + &variant ); } // write back return value @@ -2107,7 +2101,7 @@ HRESULT InterfaceOleWrapper::doSetProperty( DISPPARAMS * /*pdispparams*/, VARIAN try { - m_xInvocation->setValue( name, params.getConstArray()[0]); + m_xInvocation->setValue( name, params[0]); } catch(const UnknownPropertyException &) { diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index d44350bd475f..32560c7a9844 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -399,14 +399,13 @@ namespace pcr aPropertyValue >>= aOldIdStrings; try { - const OUString* pOldIdStrings = aOldIdStrings.getConstArray(); sal_Int32 nOldIdCount = aOldIdStrings.getLength(); for ( i = 0; i < nNewCount; ++i ) { OUString aOldPureIdStr; if( i < nOldIdCount ) { - OUString aOldIdStr = pOldIdStrings[i]; + OUString aOldIdStr = aOldIdStrings[i]; aOldPureIdStr = aOldIdStr.copy( 1 ); } const OUString& aNewPureIdStr = pNewPureIds[i]; diff --git a/extensions/source/propctrlr/formlinkdialog.cxx b/extensions/source/propctrlr/formlinkdialog.cxx index 440b47b93310..fc379c3acd3a 100644 --- a/extensions/source/propctrlr/formlinkdialog.cxx +++ b/extensions/source/propctrlr/formlinkdialog.cxx @@ -107,10 +107,8 @@ namespace pcr { weld::ComboBox* pBox = ( _eWhich == eDetailField ) ? m_xDetailColumn.get() : m_xMasterColumn.get(); - const OUString* pFieldName = _rFieldNames.getConstArray(); - const OUString* pFieldNameEnd = pFieldName + _rFieldNames.getLength(); - for ( ; pFieldName != pFieldNameEnd; ++pFieldName ) - pBox->append_text( *pFieldName ); + for (const OUString& rFieldName : _rFieldNames) + pBox->append_text(rFieldName); } bool FieldLinkRow::GetFieldName( LinkParticipant _eWhich, OUString& /* [out] */ _rName ) const diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx index 14dc23a75206..2862f47e2a0e 100644 --- a/extensions/source/propctrlr/propcontroller.cxx +++ b/extensions/source/propctrlr/propcontroller.cxx @@ -258,17 +258,10 @@ namespace pcr Sequence< Reference< XDispatch > > SAL_CALL OPropertyBrowserController::queryDispatches( const Sequence< DispatchDescriptor >& Requests ) { - Sequence< Reference< XDispatch > > aReturn; - sal_Int32 nLen = Requests.getLength(); - aReturn.realloc( nLen ); - - Reference< XDispatch >* pReturn = aReturn.getArray(); - const Reference< XDispatch >* pReturnEnd = aReturn.getArray() + nLen; - const DispatchDescriptor* pDescripts = Requests.getConstArray(); - - for ( ; pReturn != pReturnEnd; ++ pReturn, ++pDescripts ) - *pReturn = queryDispatch( pDescripts->FeatureURL, pDescripts->FrameName, pDescripts->SearchFlags ); - + Sequence<Reference<XDispatch>> aReturn(Requests.getLength()); + std::transform(Requests.begin(), Requests.end(), aReturn.getArray(), + [this](const DispatchDescriptor& d) + { return queryDispatch(d.FeatureURL, d.FrameName, d.SearchFlags); }); return aReturn; } diff --git a/extensions/source/propctrlr/stringrepresentation.cxx b/extensions/source/propctrlr/stringrepresentation.cxx index 673ddd5dca27..52e5b705cff3 100644 --- a/extensions/source/propctrlr/stringrepresentation.cxx +++ b/extensions/source/propctrlr/stringrepresentation.cxx @@ -237,14 +237,13 @@ void SAL_CALL StringRepresentation::initialize(const uno::Sequence< uno::Any > & if ( !nLength ) return; - const uno::Any* pIter = aArguments.getConstArray(); - m_xTypeConverter.set(*pIter++,uno::UNO_QUERY); + m_xTypeConverter.set(aArguments[0], uno::UNO_QUERY); if ( nLength != 3 ) return; OUString sConstantName; - *pIter++ >>= sConstantName; - *pIter >>= m_aValues; + aArguments[1] >>= sConstantName; + aArguments[2] >>= m_aValues; if ( !m_xContext.is() ) return; @@ -274,11 +273,9 @@ OUString StringRepresentation::convertSimpleToString( const uno::Any& _rValue ) sal_Int16 nConstantValue = 0; if ( _rValue >>= nConstantValue ) { - const uno::Reference< reflection::XConstantTypeDescription>* pIter = m_aConstants.getConstArray(); - const uno::Reference< reflection::XConstantTypeDescription>* pEnd = pIter + m_aConstants.getLength(); - for(sal_Int32 i = 0;pIter != pEnd;++pIter,++i) + for (sal_Int32 i = 0; i < m_aConstants.getLength(); ++i) { - if ( (*pIter)->getConstantValue() == _rValue ) + if (m_aConstants[i]->getConstantValue() == _rValue) { OSL_ENSURE(i < m_aValues.getLength() ,"StringRepresentation::convertSimpleToString: Index is not in range of m_aValues"); sReturn = m_aValues[i]; @@ -465,11 +462,9 @@ uno::Any StringRepresentation::convertStringToSimple( const OUString& _rValue,co { if ( m_aConstants.hasElements() && m_aValues.hasElements() ) { - const OUString* pIter = m_aValues.getConstArray(); - const OUString* pEnd = pIter + m_aValues.getLength(); - for(sal_Int32 i = 0;pIter != pEnd;++pIter,++i) + for (sal_Int32 i = 0; i < m_aValues.getLength(); ++i) { - if ( *pIter == _rValue ) + if (m_aValues[i] == _rValue) { OSL_ENSURE(i < m_aConstants.getLength() ,"StringRepresentation::convertSimpleToString: Index is not in range of m_aValues"); aReturn = m_aConstants[i]->getConstantValue(); diff --git a/extensions/source/propctrlr/xsddatatypes.cxx b/extensions/source/propctrlr/xsddatatypes.cxx index 25af46895adb..d99f87da77ee 100644 --- a/extensions/source/propctrlr/xsddatatypes.cxx +++ b/extensions/source/propctrlr/xsddatatypes.cxx @@ -148,13 +148,10 @@ namespace pcr if ( !xSourceInfo.is() || !xDestInfo.is() ) return; - Sequence< Property > aProperties( xSourceInfo->getProperties() ); - const Property* pProperties = aProperties.getConstArray(); - const Property* pPropertiesEnd = pProperties + aProperties.getLength(); - for ( ; pProperties != pPropertiesEnd; ++pProperties ) + for (const Property& rProp : xSourceInfo->getProperties()) { - if ( xDestInfo->hasPropertyByName( pProperties->Name ) ) - _rxDest->setPropertyValue( pProperties->Name, _rxSource->getPropertyValue( pProperties->Name ) ); + if (xDestInfo->hasPropertyByName(rProp.Name)) + _rxDest->setPropertyValue(rProp.Name, _rxSource->getPropertyValue(rProp.Name)); } } } diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index e10a45158b40..73bc255bd647 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -4442,32 +4442,19 @@ sal_Int32 EscherConnectorListEntry::GetConnectorRule( bool bFirst ) { auto pSourcePolyPolygon = o3tl::doAccess<drawing::PointSequenceSequence>(aAny); - sal_Int32 nOuterSequenceCount = pSourcePolyPolygon->getLength(); - drawing::PointSequence const * pOuterSequence = pSourcePolyPolygon->getConstArray(); - - if ( pOuterSequence ) + sal_Int32 nIndex = 0; + sal_uInt32 nDistance = 0xffffffff; + for (drawing::PointSequence const& rInnerSequence : *pSourcePolyPolygon) { - sal_Int32 a, b, nIndex = 0; - sal_uInt32 nDistance = 0xffffffff; - for( a = 0; a < nOuterSequenceCount; a++ ) + for (awt::Point const& rPoint : rInnerSequence) { - drawing::PointSequence const * pInnerSequence = pOuterSequence++; - if ( pInnerSequence ) + sal_uInt32 nDist = static_cast<sal_uInt32>(hypot( aRefPoint.X - rPoint.X, aRefPoint.Y - rPoint.Y )); + if ( nDist < nDistance ) { - awt::Point const * pArray = pInnerSequence->getConstArray(); - if ( pArray ) - { - for ( b = 0; b < pInnerSequence->getLength(); b++, nIndex++, pArray++ ) - { - sal_uInt32 nDist = static_cast<sal_uInt32>(hypot( aRefPoint.X - pArray->X, aRefPoint.Y - pArray->Y )); - if ( nDist < nDistance ) - { - nRule = nIndex; - nDistance = nDist; - } - } - } + nRule = nIndex; + nDistance = nDist; } + nIndex++; } } } @@ -4486,42 +4473,24 @@ sal_Int32 EscherConnectorListEntry::GetConnectorRule( bool bFirst ) o3tl::doAccess<drawing::PolyPolygonBezierCoords>(aAny); sal_Int32 nOuterSequenceCount = pSourcePolyPolygon->Coordinates.getLength(); - // get pointer of inner sequences - drawing::PointSequence const * pOuterSequence = - pSourcePolyPolygon->Coordinates.getConstArray(); - drawing::FlagSequence const * pOuterFlags = - pSourcePolyPolygon->Flags.getConstArray(); + sal_Int32 nIndex = 0; + sal_uInt32 nDistance = 0xffffffff; - if ( pOuterSequence && pOuterFlags ) + for (sal_Int32 a = 0; a < nOuterSequenceCount; a++) { - sal_Int32 a, b, nIndex = 0; - sal_uInt32 nDistance = 0xffffffff; - - for ( a = 0; a < nOuterSequenceCount; a++ ) + drawing::PointSequence const& rInnerSequence = pSourcePolyPolygon->Coordinates[a]; + drawing::FlagSequence const& rInnerFlags = pSourcePolyPolygon->Flags[a]; + for (sal_Int32 b = 0; b < rInnerSequence.getLength(); b++) { - drawing::PointSequence const * pInnerSequence = pOuterSequence++; - drawing::FlagSequence const * pInnerFlags = pOuterFlags++; - if ( pInnerSequence && pInnerFlags ) + if (rInnerFlags[b] == drawing::PolygonFlags_CONTROL) + continue; + sal_uInt32 nDist = static_cast<sal_uInt32>(hypot( aRefPoint.X - rInnerSequence[b].X, aRefPoint.Y - rInnerSequence[b].Y )); + if ( nDist < nDistance ) { - awt::Point const * pArray = pInnerSequence->getConstArray(); - drawing::PolygonFlags const * pFlags = pInnerFlags->getConstArray(); - if ( pArray && pFlags ) - { - for ( b = 0; b < pInnerSequence->getLength(); b++, pArray++ ) - { - drawing::PolygonFlags ePolyFlags = *pFlags++; - if ( ePolyFlags == drawing::PolygonFlags_CONTROL ) - continue; - sal_uInt32 nDist = static_cast<sal_uInt32>(hypot( aRefPoint.X - pArray->X, aRefPoint.Y - pArray->Y )); - if ( nDist < nDistance ) - { - nRule = nIndex; - nDistance = nDist; - } - nIndex++; - } - } + nRule = nIndex; + nDistance = nDist; } + nIndex++; } } } diff --git a/filter/source/pdf/pdfinteract.cxx b/filter/source/pdf/pdfinteract.cxx index 26eaaa40da6b..10977eb3689f 100644 --- a/filter/source/pdf/pdfinteract.cxx +++ b/filter/source/pdf/pdfinteract.cxx @@ -56,9 +56,8 @@ sal_Bool SAL_CALL PDFInteractionHandler::handleInteractionRequest( const Referen if( aRequest >>= aExc ) { std::set< vcl::pdf::PDFWriter::ErrorCode > aCodes; - sal_Int32 nCodes = aExc.ErrorCodes.getLength(); - for( sal_Int32 i = 0; i < nCodes; i++ ) - aCodes.insert( static_cast<vcl::pdf::PDFWriter::ErrorCode>(aExc.ErrorCodes.getConstArray()[i]) ); + for (const sal_Int32 nErrorCode : aExc.ErrorCodes) + aCodes.insert(static_cast<vcl::pdf::PDFWriter::ErrorCode>(nErrorCode)); ImplErrorDialog aDlg(Application::GetFrameWeld(m_xParent), aCodes); aDlg.run(); diff --git a/include/vbahelper/vbahelperinterface.hxx b/include/vbahelper/vbahelperinterface.hxx index 601fbd918b6f..9c9deeef9408 100644 --- a/include/vbahelper/vbahelperinterface.hxx +++ b/include/vbahelper/vbahelperinterface.hxx @@ -89,12 +89,7 @@ public: virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override { css::uno::Sequence< OUString > sServices = getSupportedServiceNames(); - const OUString* pStart = sServices.getConstArray(); - const OUString* pEnd = pStart + sServices.getLength(); - for ( ; pStart != pEnd ; ++pStart ) - if ( *pStart == ServiceName ) - return true; - return false; + return std::find(sServices.begin(), sServices.end(), ServiceName) != sServices.end(); } virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override { diff --git a/oox/source/docprop/docprophandler.cxx b/oox/source/docprop/docprophandler.cxx index f53484e3a06b..f4240ae72516 100644 --- a/oox/source/docprop/docprophandler.cxx +++ b/oox/source/docprop/docprophandler.cxx @@ -249,10 +249,9 @@ void OOXMLDocPropHandler::UpdateDocStatistic( std::u16string_view aChars ) if ( aName.isEmpty() ) return; - sal_Int32 nInd = 0; - for ( auto pProp = aSet.getConstArray(); nInd < aSet.getLength(); ++nInd ) - if ( pProp[nInd].Name == aName ) - break; + sal_Int32 nInd = std::distance(aSet.begin(), std::find_if(aSet.begin(), aSet.end(), + [&aName](const beans::NamedValue& v) + { return v.Name == aName; })); if (nInd == aSet.getLength()) aSet.realloc( nInd + 1 ); diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index cdf758ce928d..e01233507485 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -276,17 +276,11 @@ static Reference< chart2::data::XLabeledDataSequence > const Sequence< Reference< chart2::data::XLabeledDataSequence > > & aLabeledSeq, const OUString & rRole ) { - Reference< chart2::data::XLabeledDataSequence > aNoResult; - - const Reference< chart2::data::XLabeledDataSequence > * pBegin = aLabeledSeq.getConstArray(); - const Reference< chart2::data::XLabeledDataSequence > * pEnd = pBegin + aLabeledSeq.getLength(); - const Reference< chart2::data::XLabeledDataSequence > * pMatch = - ::std::find_if( pBegin, pEnd, lcl_MatchesRole( rRole )); - - if( pMatch != pEnd ) + auto* pMatch = std::find_if(aLabeledSeq.begin(), aLabeledSeq.end(), lcl_MatchesRole(rRole)); + if (pMatch != aLabeledSeq.end()) return *pMatch; - return aNoResult; + return {}; } static bool lcl_hasCategoryLabels( const Reference< chart2::XChartDocument >& xChartDoc ) @@ -5298,7 +5292,6 @@ void ChartExport::exportDataPoints( xSeriesProperties->getPropertyValue( u"VaryColorsByPoint"_ustr ) >>= bVaryColorsByPoint; } - const sal_Int32 * pPoints = aDataPointSeq.getConstArray(); sal_Int32 nElement; Reference< chart2::XColorScheme > xColorScheme; if( mxNewDiagram.is()) @@ -5308,8 +5301,8 @@ void ChartExport::exportDataPoints( { o3tl::sorted_vector< sal_Int32 > aAttrPointSet; aAttrPointSet.reserve(aDataPointSeq.getLength()); - for (auto p = pPoints; p < pPoints + aDataPointSeq.getLength(); ++p) - aAttrPointSet.insert(*p); + for (sal_Int32 point : aDataPointSeq) + aAttrPointSet.insert(point); const auto aEndIt = aAttrPointSet.end(); for( nElement = 0; nElement < nSeriesLength; ++nElement ) { @@ -5369,8 +5362,8 @@ void ChartExport::exportDataPoints( o3tl::sorted_vector< sal_Int32 > aAttrPointSet; aAttrPointSet.reserve(aDataPointSeq.getLength()); - for (auto p = pPoints; p < pPoints + aDataPointSeq.getLength(); ++p) - aAttrPointSet.insert(*p); + for (sal_Int32 point : aDataPointSeq) + aAttrPointSet.insert(point); const auto aEndIt = aAttrPointSet.end(); for( nElement = 0; nElement < nSeriesLength; ++nElement ) { diff --git a/package/source/zipapi/ByteGrabber.cxx b/package/source/zipapi/ByteGrabber.cxx index 23b157423df8..f9a2f3c87885 100644 --- a/package/source/zipapi/ByteGrabber.cxx +++ b/package/source/zipapi/ByteGrabber.cxx @@ -111,10 +111,7 @@ sal_uInt16 ByteGrabber::ReadUInt16() if (xStream->readBytes(aSequence, 2) != 2) return 0; - const sal_Int8 *pSequence = aSequence.getConstArray(); - return static_cast <sal_uInt16> - ( (pSequence[0] & 0xFF) - | (pSequence[1] & 0xFF) << 8); + return static_cast<sal_uInt16>((aSequence[0] & 0xFF) | (aSequence[1] & 0xFF) << 8); } } @@ -136,12 +133,11 @@ sal_uInt32 ByteGrabber::ReadUInt32() if (xStream->readBytes(aSequence, 4) != 4) return 0; - const sal_Int8 *pSequence = aSequence.getConstArray(); return static_cast < sal_uInt32 > - ( (pSequence[0] & 0xFF) - | ( pSequence[1] & 0xFF ) << 8 - | ( pSequence[2] & 0xFF ) << 16 - | ( pSequence[3] & 0xFF ) << 24 ); + ( (aSequence[0] & 0xFF) + | ( aSequence[1] & 0xFF ) << 8 + | ( aSequence[2] & 0xFF ) << 16 + | ( aSequence[3] & 0xFF ) << 24 ); } } @@ -166,15 +162,14 @@ sal_uInt64 ByteGrabber::ReadUInt64() if (xStream->readBytes(aSequence, 8) != 8) return 0; - const sal_Int8 *pSequence = aSequence.getConstArray(); - return static_cast<sal_uInt64>(pSequence[0] & 0xFF) - | static_cast<sal_uInt64>(pSequence[1] & 0xFF) << 8 - | static_cast<sal_uInt64>(pSequence[2] & 0xFF) << 16 - | static_cast<sal_uInt64>(pSequence[3] & 0xFF) << 24 - | static_cast<sal_uInt64>(pSequence[4] & 0xFF) << 32 - | static_cast<sal_uInt64>(pSequence[5] & 0xFF) << 40 - | static_cast<sal_uInt64>(pSequence[6] & 0xFF) << 48 - | static_cast<sal_uInt64>(pSequence[7] & 0xFF) << 56; + return static_cast<sal_uInt64>(aSequence[0] & 0xFF) + | static_cast<sal_uInt64>(aSequence[1] & 0xFF) << 8 + | static_cast<sal_uInt64>(aSequence[2] & 0xFF) << 16 + | static_cast<sal_uInt64>(aSequence[3] & 0xFF) << 24 + | static_cast<sal_uInt64>(aSequence[4] & 0xFF) << 32 + | static_cast<sal_uInt64>(aSequence[5] & 0xFF) << 40 + | static_cast<sal_uInt64>(aSequence[6] & 0xFF) << 48 + | static_cast<sal_uInt64>(aSequence[7] & 0xFF) << 56; } } diff --git a/package/source/zipapi/XUnbufferedStream.cxx b/package/source/zipapi/XUnbufferedStream.cxx index a10e063dfd67..73c89ae9ebf2 100644 --- a/package/source/zipapi/XUnbufferedStream.cxx +++ b/package/source/zipapi/XUnbufferedStream.cxx @@ -205,10 +205,7 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa aData.realloc( nHeadRead + nRead ); - const sal_Int8* pPureBuffer = aPureData.getConstArray(); - sal_Int8* pBuffer = aData.getArray(); - for ( sal_Int32 nInd = 0; nInd < nRead; nInd++ ) - pBuffer[ nHeadRead + nInd ] = pPureBuffer[ nInd ]; + std::copy_n(aPureData.begin(), nRead, aData.getArray() + nHeadRead); } nRead += nHeadRead; diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index 78366a82a6fa..c8865eaae753 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -371,11 +371,10 @@ bool ZipPackageStream::ParsePackageRawStream() { if ( GetOwnSeekStream()->readBytes ( aHeader, 4 ) == 4 ) { - const sal_Int8 *pHeader = aHeader.getConstArray(); - sal_uInt32 nHeader = ( pHeader [0] & 0xFF ) | - ( pHeader [1] & 0xFF ) << 8 | - ( pHeader [2] & 0xFF ) << 16 | - ( pHeader [3] & 0xFF ) << 24; + sal_uInt32 nHeader = ( aHeader [0] & 0xFF ) | + ( aHeader [1] & 0xFF ) << 8 | + ( aHeader [2] & 0xFF ) << 16 | + ( aHeader [3] & 0xFF ) << 24; if ( nHeader == n_ConstHeader ) { // this is one of our god-awful, but extremely devious hacks, everyone cheer diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx b/reportdesign/source/filter/xml/xmlfilter.cxx index 90839b48de8e..79319b9e65b8 100644 --- a/reportdesign/source/filter/xml/xmlfilter.cxx +++ b/reportdesign/source/filter/xml/xmlfilter.cxx @@ -356,11 +356,9 @@ bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) { Sequence< PropertyValue > aComponent; rProp.Value >>= aComponent; - const PropertyValue* pComponentIter = aComponent.getConstArray(); - const PropertyValue* pComponentEnd = pComponentIter + aComponent.getLength(); - pComponentIter = std::find_if(pComponentIter, pComponentEnd, + auto pComponentIter = std::find_if(aComponent.begin(), aComponent.end(), [](const PropertyValue& rComponent) { return rComponent.Name == "ActiveConnection"; }); - if (pComponentIter != pComponentEnd) + if (pComponentIter != aComponent.end()) { uno::Reference<sdbc::XConnection> xCon(pComponentIter->Value, uno::UNO_QUERY); xNumberFormatsSupplier = ::dbtools::getNumberFormats(xCon); diff --git a/reportdesign/source/ui/inc/GeometryHandler.hxx b/reportdesign/source/ui/inc/GeometryHandler.hxx index 8892ea3fda3a..6fa1989cf2a5 100644 --- a/reportdesign/source/ui/inc/GeometryHandler.hxx +++ b/reportdesign/source/ui/inc/GeometryHandler.hxx @@ -90,8 +90,8 @@ namespace rptui */ sal_uInt32 impl_getDataFieldType_throw(const OUString& _sDataField = OUString()) const; - css::uno::Any getConstantValue(bool bToControlValue,const TranslateId* pResId,const css::uno::Any& _aValue,const OUString& _sConstantName,const OUString & PropertyName ); - css::beans::Property getProperty(const OUString & PropertyName); + css::uno::Any getConstantValue(bool bToControlValue,const TranslateId* pResId,const css::uno::Any& _aValue,const OUString& _sConstantName,std::u16string_view PropertyName ); + css::beans::Property getProperty(std::u16string_view PropertyName); static void implCreateListLikeControl( const css::uno::Reference< css::inspection::XPropertyControlFactory >& _rxControlFactory ,css::inspection::LineDescriptor & out_Descriptor diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx index 85bff9cdebc3..45cf8bb9feb4 100644 --- a/reportdesign/source/ui/inspection/GeometryHandler.cxx +++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx @@ -875,20 +875,14 @@ inspection::LineDescriptor SAL_CALL GeometryHandler::describePropertyLine(const return aOut; } -beans::Property GeometryHandler::getProperty(const OUString & PropertyName) +beans::Property GeometryHandler::getProperty(std::u16string_view PropertyName) { - uno::Sequence< beans::Property > aProps = getSupportedProperties(); - const beans::Property* pIter = aProps.getConstArray(); - const beans::Property* pEnd = pIter + aProps.getLength(); - const beans::Property* pFind = ::std::find_if(pIter, pEnd, - [&PropertyName] (const beans::Property& x) -> bool { - return x.Name == PropertyName; - }); - if ( pFind == pEnd ) - return beans::Property(); - return *pFind; + for (const beans::Property& rProperty : getSupportedProperties()) + if (rProperty.Name == PropertyName) + return rProperty; + return {}; } -uno::Any GeometryHandler::getConstantValue(bool _bToControlValue,const TranslateId* pResId,const uno::Any& _aValue,const OUString& _sConstantName,const OUString & PropertyName ) +uno::Any GeometryHandler::getConstantValue(bool _bToControlValue,const TranslateId* pResId,const uno::Any& _aValue,const OUString& _sConstantName,std::u16string_view PropertyName ) { std::vector<OUString> aList; for (const TranslateId* pItem = pResId; *pItem; ++pItem) diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index ac17a3d81c40..f757d07c74dc 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -3971,14 +3971,12 @@ void OReportController::createDefaultControl(const uno::Sequence< beans::Propert if ( !xSection.is() ) return; - const beans::PropertyValue* pIter = _aArgs.getConstArray(); - const beans::PropertyValue* pEnd = pIter + _aArgs.getLength(); - const beans::PropertyValue* pKeyModifier = ::std::find_if(pIter, pEnd, + const beans::PropertyValue* pKeyModifier = ::std::find_if(_aArgs.begin(), _aArgs.end(), [] (const beans::PropertyValue& x) -> bool { return x.Name == "KeyModifier"; }); sal_Int16 nKeyModifier = 0; - if ( pKeyModifier == pEnd || ((pKeyModifier->Value >>= nKeyModifier) && nKeyModifier == KEY_MOD1) ) + if ( pKeyModifier == _aArgs.end() || ((pKeyModifier->Value >>= nKeyModifier) && nKeyModifier == KEY_MOD1) ) { Sequence< PropertyValue > aCreateArgs; getDesignView()->unmarkAllObjects(); diff --git a/sax/source/expatwrap/xml2utf.cxx b/sax/source/expatwrap/xml2utf.cxx index 5b3e4b9e1c86..27c207f7e3db 100644 --- a/sax/source/expatwrap/xml2utf.cxx +++ b/sax/source/expatwrap/xml2utf.cxx @@ -22,6 +22,7 @@ #include <sal/types.h> +#include <comphelper/sequence.hxx> #include <rtl/textenc.h> #include <rtl/tencinfo.h> #include <com/sun/star/io/NotConnectedException.hpp> @@ -62,15 +63,7 @@ sal_Int32 XMLFile2UTFConverter::readAndConvert( Sequence<sal_Int8> &seq , sal_In if( seqStart.hasElements() ) { // prefix with what we had so far. - sal_Int32 nLength = seq.getLength(); - seq.realloc( seqStart.getLength() + nLength ); - - memmove (seq.getArray() + seqStart.getLength(), - seq.getConstArray(), - nLength); - memcpy (seq.getArray(), - seqStart.getConstArray(), - seqStart.getLength()); + seq = comphelper::concatSequences(seqStart, seq); } // autodetection with the first bytes diff --git a/sdext/source/pdfimport/filterdet.cxx b/sdext/source/pdfimport/filterdet.cxx index a1b521933fe0..b05295347df3 100644 --- a/sdext/source/pdfimport/filterdet.cxx +++ b/sdext/source/pdfimport/filterdet.cxx @@ -194,24 +194,23 @@ namespace sal_Int32 fillAttributes(uno::Sequence<beans::PropertyValue> const& rFilterData, uno::Reference<io::XInputStream>& xInput, OUString& aURL, sal_Int32& nFilterNamePos, sal_Int32& nPasswordPos, OUString& aPassword) { - const beans::PropertyValue* pAttribs = rFilterData.getConstArray(); sal_Int32 nAttribs = rFilterData.getLength(); for (sal_Int32 i = 0; i < nAttribs; i++) { OUString aVal( u"<no string>"_ustr ); - pAttribs[i].Value >>= aVal; - SAL_INFO("sdext.pdfimport", "doDetection: Attrib: " + pAttribs[i].Name + " = " + aVal); - - if (pAttribs[i].Name == "InputStream") - pAttribs[i].Value >>= xInput; - else if (pAttribs[i].Name == "URL") - pAttribs[i].Value >>= aURL; - else if (pAttribs[i].Name == "FilterName") + rFilterData[i].Value >>= aVal; + SAL_INFO("sdext.pdfimport", "doDetection: Attrib: " + rFilterData[i].Name + " = " + aVal); + + if (rFilterData[i].Name == "InputStream") + rFilterData[i].Value >>= xInput; + else if (rFilterData[i].Name == "URL") + rFilterData[i].Value >>= aURL; + else if (rFilterData[i].Name == "FilterName") nFilterNamePos = i; - else if (pAttribs[i].Name == "Password") + else if (rFilterData[i].Name == "Password") { nPasswordPos = i; - pAttribs[i].Value >>= aPassword; + rFilterData[i].Value >>= aPassword; } } return nAttribs; diff --git a/sdext/source/pdfimport/pdfiadaptor.cxx b/sdext/source/pdfimport/pdfiadaptor.cxx index 45250a911884..8131a1681ca2 100644 --- a/sdext/source/pdfimport/pdfiadaptor.cxx +++ b/sdext/source/pdfimport/pdfiadaptor.cxx @@ -56,22 +56,20 @@ sal_Bool SAL_CALL PDFIHybridAdaptor::filter( const uno::Sequence< beans::Propert { uno::Reference< io::XStream > xSubStream; OUString aPwd; - const beans::PropertyValue* pAttribs = rFilterData.getConstArray(); - sal_Int32 nAttribs = rFilterData.getLength(); sal_Int32 nPwPos = -1; - for( sal_Int32 i = 0; i < nAttribs; i++ ) + for( sal_Int32 i = 0; i < rFilterData.getLength(); i++ ) { - SAL_INFO("sdext.pdfimport", "filter: Attrib: " << pAttribs[i].Name - << " = " << (pAttribs[i].Value.has<OUString>() - ? pAttribs[i].Value.get<OUString>() + SAL_INFO("sdext.pdfimport", "filter: Attrib: " << rFilterData[i].Name + << " = " << (rFilterData[i].Value.has<OUString>() + ? rFilterData[i].Value.get<OUString>() : u"<no string>"_ustr) << " "); - if ( pAttribs[i].Name == "EmbeddedSubstream" ) - pAttribs[i].Value >>= xSubStream; - else if ( pAttribs[i].Name == "Password" ) + if (rFilterData[i].Name == "EmbeddedSubstream") + rFilterData[i].Value >>= xSubStream; + else if (rFilterData[i].Name == "Password") { nPwPos = i; - pAttribs[i].Value >>= aPwd; + rFilterData[i].Value >>= aPwd; } } bool bAddPwdProp = false; diff --git a/sdext/source/pdfimport/tree/imagecontainer.cxx b/sdext/source/pdfimport/tree/imagecontainer.cxx index 1445d13b20af..439889c58527 100644 --- a/sdext/source/pdfimport/tree/imagecontainer.cxx +++ b/sdext/source/pdfimport/tree/imagecontainer.cxx @@ -117,15 +117,13 @@ void ImageContainer::writeBase64EncodedStream( ImageId nId, EmitContext& rContex const uno::Sequence<beans::PropertyValue>& rEntry( m_aImages[nId] ); // find "InputSequence" property - const beans::PropertyValue* pAry(rEntry.getConstArray()); - const sal_Int32 nLen(rEntry.getLength()); const beans::PropertyValue* pValue( - std::find_if(pAry, pAry+nLen, + std::find_if(rEntry.begin(), rEntry.end(), [] (beans::PropertyValue const& v) -> bool { return v.Name == "InputSequence"; })); - if (pValue == pAry + nLen ) + if (pValue == rEntry.end()) { SAL_WARN("sdext.pdfimport", "InputSequence not found"); return; @@ -148,15 +146,13 @@ OUString ImageContainer::asBase64EncodedString( ImageId nId ) const const uno::Sequence<beans::PropertyValue>& rEntry( m_aImages[nId] ); // find "InputSequence" property - const beans::PropertyValue* pAry(rEntry.getConstArray()); - const sal_Int32 nLen(rEntry.getLength()); const beans::PropertyValue* pValue( - std::find_if(pAry, pAry+nLen, + std::find_if(rEntry.begin(), rEntry.end(), [] (beans::PropertyValue const& v) -> bool { return v.Name == "InputSequence"; })); - if (pValue == pAry + nLen ) + if (pValue == rEntry.end()) { SAL_WARN("sdext.pdfimport", "InputSequence not found"); return u""_ustr;
