accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx | 2 basctl/source/basicide/IDEComboBox.cxx | 16 basctl/source/basicide/basides1.cxx | 3 basctl/source/basicide/basidesh.cxx | 22 basctl/source/basicide/basobj3.cxx | 8 basctl/source/basicide/bastype2.cxx | 51 - basctl/source/basicide/localizationmgr.cxx | 121 --- basctl/source/basicide/moduldl2.cxx | 26 basctl/source/dlged/dlged.cxx | 59 - basctl/source/dlged/dlgedobj.cxx | 36 - basctl/source/dlged/managelang.cxx | 18 basegfx/source/polygon/b2dpolygontools.cxx | 41 - basegfx/source/polygon/b2dpolypolygontools.cxx | 21 basegfx/source/polygon/b3dpolypolygontools.cxx | 25 canvas/source/factory/cf_service.cxx | 16 canvas/source/tools/canvastools.cxx | 329 +++------- cli_ure/source/climaker/climaker_emit.cxx | 74 -- connectivity/source/commontools/DriversConfig.cxx | 27 connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx | 26 connectivity/source/commontools/FValue.cxx | 7 connectivity/source/commontools/TDatabaseMetaDataBase.cxx | 6 connectivity/source/commontools/dbtools.cxx | 9 connectivity/source/commontools/dbtools2.cxx | 17 connectivity/source/commontools/parameters.cxx | 7 connectivity/source/cpool/ZPoolCollection.cxx | 9 connectivity/source/drivers/ado/AConnection.cxx | 16 connectivity/source/drivers/ado/AResultSet.cxx | 6 connectivity/source/drivers/ado/Aolevariant.cxx | 6 connectivity/source/drivers/ado/Awrapado.cxx | 6 connectivity/source/drivers/calc/CConnection.cxx | 11 connectivity/source/drivers/calc/CDatabaseMetaData.cxx | 18 connectivity/source/drivers/calc/CTable.cxx | 9 connectivity/source/drivers/dbase/DDatabaseMetaData.cxx | 47 - connectivity/source/drivers/dbase/DTable.cxx | 10 connectivity/source/parse/sqliterator.cxx | 14 35 files changed, 385 insertions(+), 734 deletions(-)
New commits: commit 8755c80018bec656e1b102da25edc450da4eee52 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Mon Apr 29 01:31:19 2024 +0500 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Mon Apr 29 23:15:33 2024 +0200 Drop uses of css::uno::Sequence::getConstArray in canvas .. connectivity where it was obsoleted by commits 2484de6728bd11bb7949003d112f1ece2223c7a1 (Remove non-const Sequence::begin()/end() in internal code, 2021-10-15) and fb3c04bd1930eedacd406874e1a285d62bbf27d9 (Drop non-const Sequence::operator[] in internal code 2021-11-05). Change-Id: I9467028fd1a7eeafad7f0dd776a91a9a40770b48 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166816 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/canvas/source/factory/cf_service.cxx b/canvas/source/factory/cf_service.cxx index 94f7069e267a..10d05379e8e9 100644 --- a/canvas/source/factory/cf_service.cxx +++ b/canvas/source/factory/cf_service.cxx @@ -142,13 +142,10 @@ CanvasFactory::CanvasFactory( Reference<XComponentContext> const & xContext ) : Reference<container::XHierarchicalNameAccess> xHierarchicalNameAccess( xNameAccess, UNO_QUERY_THROW); - Sequence<OUString> serviceNames = xNameAccess->getElementNames(); - const OUString* pCurr = serviceNames.getConstArray(); - const OUString* const pEnd = pCurr + serviceNames.getLength(); - while( pCurr != pEnd ) + for (auto& serviceName : xNameAccess->getElementNames()) { Reference<container::XNameAccess> xEntryNameAccess( - xHierarchicalNameAccess->getByHierarchicalName(*pCurr), + xHierarchicalNameAccess->getByHierarchicalName(serviceName), UNO_QUERY ); if( xEntryNameAccess.is() ) @@ -156,20 +153,17 @@ CanvasFactory::CanvasFactory( Reference<XComponentContext> const & xContext ) : Sequence<OUString> implementationList; if( xEntryNameAccess->getByName("PreferredImplementations") >>= implementationList ) { - m_aAvailableImplementations.emplace_back(*pCurr,implementationList ); + m_aAvailableImplementations.emplace_back(serviceName, implementationList); } if( xEntryNameAccess->getByName("AcceleratedImplementations") >>= implementationList ) { - m_aAcceleratedImplementations.emplace_back(*pCurr,implementationList ); + m_aAcceleratedImplementations.emplace_back(serviceName, implementationList); } if( xEntryNameAccess->getByName("AntialiasingImplementations") >>= implementationList ) { - m_aAAImplementations.emplace_back(*pCurr,implementationList ); + m_aAAImplementations.emplace_back(serviceName, implementationList); } - } - - ++pCurr; } } catch (const RuntimeException &) diff --git a/canvas/source/tools/canvastools.cxx b/canvas/source/tools/canvastools.cxx index 1ff393005758..51d84d849fcb 100644 --- a/canvas/source/tools/canvastools.cxx +++ b/canvas/source/tools/canvastools.cxx @@ -209,104 +209,89 @@ namespace canvas::tools } virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertToRGB( const uno::Sequence< double >& deviceColor ) override { - const double* pIn( deviceColor.getConstArray() ); - const std::size_t nLen( deviceColor.getLength() ); + const sal_Int32 nLen(deviceColor.getLength()); ENSURE_ARG_OR_THROW2(nLen%4==0, "number of channels no multiple of 4", static_cast<rendering::XColorSpace*>(this), 0); uno::Sequence< rendering::RGBColor > aRes(nLen/4); rendering::RGBColor* pOut( aRes.getArray() ); - for( std::size_t i=0; i<nLen; i+=4 ) + for (sal_Int32 i = 0; i < nLen; i += 4) { - *pOut++ = rendering::RGBColor(pIn[0],pIn[1],pIn[2]); - pIn += 4; + *pOut++ = rendering::RGBColor(deviceColor[i], deviceColor[i+1], deviceColor[i+2]); } return aRes; } virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToARGB( const uno::Sequence< double >& deviceColor ) override { SAL_WARN_IF(!deviceColor.hasElements(), "canvas", "empty deviceColor argument"); - const double* pIn( deviceColor.getConstArray() ); - const std::size_t nLen( deviceColor.getLength() ); + const sal_Int32 nLen(deviceColor.getLength()); ENSURE_ARG_OR_THROW2(nLen%4==0, "number of channels no multiple of 4", static_cast<rendering::XColorSpace*>(this), 0); uno::Sequence< rendering::ARGBColor > aRes(nLen/4); rendering::ARGBColor* pOut( aRes.getArray() ); - for( std::size_t i=0; i<nLen; i+=4 ) + for (sal_Int32 i = 0; i < nLen; i += 4) { - *pOut++ = rendering::ARGBColor(pIn[3],pIn[0],pIn[1],pIn[2]); - pIn += 4; + *pOut++ = rendering::ARGBColor(deviceColor[i+3], deviceColor[i], deviceColor[i+1], deviceColor[i+2]); } return aRes; } virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToPARGB( const uno::Sequence< double >& deviceColor ) override { - const double* pIn( deviceColor.getConstArray() ); - const std::size_t nLen( deviceColor.getLength() ); + const sal_Int32 nLen(deviceColor.getLength()); ENSURE_ARG_OR_THROW2(nLen%4==0, "number of channels no multiple of 4", static_cast<rendering::XColorSpace*>(this), 0); uno::Sequence< rendering::ARGBColor > aRes(nLen/4); rendering::ARGBColor* pOut( aRes.getArray() ); - for( std::size_t i=0; i<nLen; i+=4 ) + for (sal_Int32 i = 0; i < nLen; i += 4) { - *pOut++ = rendering::ARGBColor(pIn[3],pIn[3]*pIn[0],pIn[3]*pIn[1],pIn[3]*pIn[2]); - pIn += 4; + *pOut++ = rendering::ARGBColor(deviceColor[i+3], + deviceColor[i+3] * deviceColor[i], + deviceColor[i+3] * deviceColor[i+1], + deviceColor[i+3] * deviceColor[i+2]); } return aRes; } virtual uno::Sequence< double > SAL_CALL convertFromRGB( const uno::Sequence< rendering::RGBColor >& rgbColor ) override { - const rendering::RGBColor* pIn( rgbColor.getConstArray() ); - const std::size_t nLen( rgbColor.getLength() ); - - uno::Sequence< double > aRes(nLen*4); + uno::Sequence<double> aRes(rgbColor.getLength() * 4); double* pColors=aRes.getArray(); - for( std::size_t i=0; i<nLen; ++i ) + for (auto& color : rgbColor) { - *pColors++ = pIn->Red; - *pColors++ = pIn->Green; - *pColors++ = pIn->Blue; + *pColors++ = color.Red; + *pColors++ = color.Green; + *pColors++ = color.Blue; *pColors++ = 1.0; - ++pIn; } return aRes; } virtual uno::Sequence< double > SAL_CALL convertFromARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override { - const rendering::ARGBColor* pIn( rgbColor.getConstArray() ); - const std::size_t nLen( rgbColor.getLength() ); - - uno::Sequence< double > aRes(nLen*4); + uno::Sequence<double> aRes(rgbColor.getLength() * 4); double* pColors=aRes.getArray(); - for( std::size_t i=0; i<nLen; ++i ) + for (auto& color : rgbColor) { - *pColors++ = pIn->Red; - *pColors++ = pIn->Green; - *pColors++ = pIn->Blue; - *pColors++ = pIn->Alpha; - ++pIn; + *pColors++ = color.Red; + *pColors++ = color.Green; + *pColors++ = color.Blue; + *pColors++ = color.Alpha; } return aRes; } virtual uno::Sequence< double > SAL_CALL convertFromPARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override { - const rendering::ARGBColor* pIn( rgbColor.getConstArray() ); - const std::size_t nLen( rgbColor.getLength() ); - - uno::Sequence< double > aRes(nLen*4); + uno::Sequence<double> aRes(rgbColor.getLength() * 4); double* pColors=aRes.getArray(); - for( std::size_t i=0; i<nLen; ++i ) + for (auto& color : rgbColor) { - *pColors++ = pIn->Red/pIn->Alpha; - *pColors++ = pIn->Green/pIn->Alpha; - *pColors++ = pIn->Blue/pIn->Alpha; - *pColors++ = pIn->Alpha; - ++pIn; + *pColors++ = color.Red / color.Alpha; + *pColors++ = color.Green / color.Alpha; + *pColors++ = color.Blue / color.Alpha; + *pColors++ = color.Alpha; } return aRes; } @@ -329,21 +314,14 @@ namespace canvas::tools { if( dynamic_cast<StandardColorSpace*>(targetColorSpace.get()) ) { - const sal_Int8* pIn( deviceColor.getConstArray() ); - const std::size_t nLen( deviceColor.getLength() ); + const sal_Int32 nLen(deviceColor.getLength()); ENSURE_ARG_OR_THROW2(nLen%4==0, "number of channels no multiple of 4", static_cast<rendering::XColorSpace*>(this), 0); uno::Sequence<double> aRes(nLen); - double* pOut( aRes.getArray() ); - for( std::size_t i=0; i<nLen; i+=4 ) - { - *pOut++ = vcl::unotools::toDoubleColor(*pIn++); - *pOut++ = vcl::unotools::toDoubleColor(*pIn++); - *pOut++ = vcl::unotools::toDoubleColor(*pIn++); - *pOut++ = vcl::unotools::toDoubleColor(*pIn++); - } + std::transform(deviceColor.begin(), deviceColor.end(), aRes.getArray(), + [](auto c) { return vcl::unotools::toDoubleColor(c); }); return aRes; } else @@ -374,120 +352,102 @@ namespace canvas::tools } virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertIntegerToRGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) override { - const sal_Int8* pIn( deviceColor.getConstArray() ); - const std::size_t nLen( deviceColor.getLength() ); + const sal_Int32 nLen(deviceColor.getLength()); ENSURE_ARG_OR_THROW2(nLen%4==0, "number of channels no multiple of 4", static_cast<rendering::XColorSpace*>(this), 0); uno::Sequence< rendering::RGBColor > aRes(nLen/4); rendering::RGBColor* pOut( aRes.getArray() ); - for( std::size_t i=0; i<nLen; i+=4 ) + for (sal_Int32 i = 0; i < nLen; i += 4) { *pOut++ = rendering::RGBColor( - vcl::unotools::toDoubleColor(pIn[0]), - vcl::unotools::toDoubleColor(pIn[1]), - vcl::unotools::toDoubleColor(pIn[2])); - pIn += 4; + vcl::unotools::toDoubleColor(deviceColor[i]), + vcl::unotools::toDoubleColor(deviceColor[i+1]), + vcl::unotools::toDoubleColor(deviceColor[i+2])); } return aRes; } virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToARGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) override { - const sal_Int8* pIn( deviceColor.getConstArray() ); - const std::size_t nLen( deviceColor.getLength() ); + const sal_Int32 nLen(deviceColor.getLength()); ENSURE_ARG_OR_THROW2(nLen%4==0, "number of channels no multiple of 4", static_cast<rendering::XColorSpace*>(this), 0); uno::Sequence< rendering::ARGBColor > aRes(nLen/4); rendering::ARGBColor* pOut( aRes.getArray() ); - for( std::size_t i=0; i<nLen; i+=4 ) + for (sal_Int32 i = 0; i < nLen; i += 4) { *pOut++ = rendering::ARGBColor( - vcl::unotools::toDoubleColor(pIn[3]), - vcl::unotools::toDoubleColor(pIn[0]), - vcl::unotools::toDoubleColor(pIn[1]), - vcl::unotools::toDoubleColor(pIn[2])); - pIn += 4; + vcl::unotools::toDoubleColor(deviceColor[i+3]), + vcl::unotools::toDoubleColor(deviceColor[i]), + vcl::unotools::toDoubleColor(deviceColor[i+1]), + vcl::unotools::toDoubleColor(deviceColor[i+2])); } return aRes; } virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToPARGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) override { - const sal_Int8* pIn( deviceColor.getConstArray() ); - const std::size_t nLen( deviceColor.getLength() ); + const sal_Int32 nLen(deviceColor.getLength()); ENSURE_ARG_OR_THROW2(nLen%4==0, "number of channels no multiple of 4", static_cast<rendering::XColorSpace*>(this), 0); uno::Sequence< rendering::ARGBColor > aRes(nLen/4); rendering::ARGBColor* pOut( aRes.getArray() ); - for( std::size_t i=0; i<nLen; i+=4 ) + for (sal_Int32 i = 0; i < nLen; i += 4) { - const sal_Int8 nAlpha( pIn[3] ); + const sal_Int8 nAlpha(deviceColor[i+3]); *pOut++ = rendering::ARGBColor( vcl::unotools::toDoubleColor(nAlpha), - vcl::unotools::toDoubleColor(nAlpha*pIn[0]), - vcl::unotools::toDoubleColor(nAlpha*pIn[1]), - vcl::unotools::toDoubleColor(nAlpha*pIn[2])); - pIn += 4; + vcl::unotools::toDoubleColor(nAlpha * deviceColor[i]), + vcl::unotools::toDoubleColor(nAlpha * deviceColor[i+1]), + vcl::unotools::toDoubleColor(nAlpha * deviceColor[i+2])); } return aRes; } virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromRGB( const uno::Sequence< rendering::RGBColor >& rgbColor ) override { - const rendering::RGBColor* pIn( rgbColor.getConstArray() ); - const std::size_t nLen( rgbColor.getLength() ); - - uno::Sequence< sal_Int8 > aRes(nLen*4); + uno::Sequence<sal_Int8> aRes(rgbColor.getLength() * 4); sal_Int8* pColors=aRes.getArray(); - for( std::size_t i=0; i<nLen; ++i ) + for (auto& color : rgbColor) { - *pColors++ = vcl::unotools::toByteColor(pIn->Red); - *pColors++ = vcl::unotools::toByteColor(pIn->Green); - *pColors++ = vcl::unotools::toByteColor(pIn->Blue); + *pColors++ = vcl::unotools::toByteColor(color.Red); + *pColors++ = vcl::unotools::toByteColor(color.Green); + *pColors++ = vcl::unotools::toByteColor(color.Blue); *pColors++ = 0; - ++pIn; } return aRes; } virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override { - const rendering::ARGBColor* pIn( rgbColor.getConstArray() ); - const std::size_t nLen( rgbColor.getLength() ); - - uno::Sequence< sal_Int8 > aRes(nLen*4); + uno::Sequence<sal_Int8> aRes(rgbColor.getLength() * 4); sal_Int8* pColors=aRes.getArray(); - for( std::size_t i=0; i<nLen; ++i ) + for (auto& color : rgbColor) { - *pColors++ = vcl::unotools::toByteColor(pIn->Red); - *pColors++ = vcl::unotools::toByteColor(pIn->Green); - *pColors++ = vcl::unotools::toByteColor(pIn->Blue); - *pColors++ = vcl::unotools::toByteColor(pIn->Alpha); - ++pIn; + *pColors++ = vcl::unotools::toByteColor(color.Red); + *pColors++ = vcl::unotools::toByteColor(color.Green); + *pColors++ = vcl::unotools::toByteColor(color.Blue); + *pColors++ = vcl::unotools::toByteColor(color.Alpha); } return aRes; } virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromPARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override { - const rendering::ARGBColor* pIn( rgbColor.getConstArray() ); - const std::size_t nLen( rgbColor.getLength() ); - - uno::Sequence< sal_Int8 > aRes(nLen*4); + uno::Sequence<sal_Int8> aRes(rgbColor.getLength() * 4); sal_Int8* pColors=aRes.getArray(); - for( std::size_t i=0; i<nLen; ++i ) + for (auto& color : rgbColor) { - *pColors++ = vcl::unotools::toByteColor(pIn->Red/pIn->Alpha); - *pColors++ = vcl::unotools::toByteColor(pIn->Green/pIn->Alpha); - *pColors++ = vcl::unotools::toByteColor(pIn->Blue/pIn->Alpha); - *pColors++ = vcl::unotools::toByteColor(pIn->Alpha); - ++pIn; + *pColors++ = vcl::unotools::toByteColor(color.Red / color.Alpha); + *pColors++ = vcl::unotools::toByteColor(color.Green / color.Alpha); + *pColors++ = vcl::unotools::toByteColor(color.Blue / color.Alpha); + *pColors++ = vcl::unotools::toByteColor(color.Alpha); } return aRes; } @@ -544,103 +504,85 @@ namespace canvas::tools } virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertToRGB( const uno::Sequence< double >& deviceColor ) override { - const double* pIn( deviceColor.getConstArray() ); - const std::size_t nLen( deviceColor.getLength() ); + const sal_Int32 nLen(deviceColor.getLength()); ENSURE_ARG_OR_THROW2(nLen%4==0, "number of channels no multiple of 4", static_cast<rendering::XColorSpace*>(this), 0); uno::Sequence< rendering::RGBColor > aRes(nLen/4); rendering::RGBColor* pOut( aRes.getArray() ); - for( std::size_t i=0; i<nLen; i+=4 ) + for (sal_Int32 i = 0; i < nLen; i += 4) { - *pOut++ = rendering::RGBColor(pIn[0],pIn[1],pIn[2]); - pIn += 4; + *pOut++ = rendering::RGBColor(deviceColor[i], deviceColor[i+1], deviceColor[i+2]); } return aRes; } virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToARGB( const uno::Sequence< double >& deviceColor ) override { - const double* pIn( deviceColor.getConstArray() ); - const std::size_t nLen( deviceColor.getLength() ); + const sal_Int32 nLen(deviceColor.getLength()); ENSURE_ARG_OR_THROW2(nLen%4==0, "number of channels no multiple of 4", static_cast<rendering::XColorSpace*>(this), 0); uno::Sequence< rendering::ARGBColor > aRes(nLen/4); rendering::ARGBColor* pOut( aRes.getArray() ); - for( std::size_t i=0; i<nLen; i+=4 ) + for (sal_Int32 i = 0; i < nLen; i += 4) { - *pOut++ = rendering::ARGBColor(1.0,pIn[0],pIn[1],pIn[2]); - pIn += 4; + *pOut++ = rendering::ARGBColor(1.0, deviceColor[i], deviceColor[i+1], deviceColor[i+2]); } return aRes; } virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToPARGB( const uno::Sequence< double >& deviceColor ) override { - const double* pIn( deviceColor.getConstArray() ); - const std::size_t nLen( deviceColor.getLength() ); + const sal_Int32 nLen(deviceColor.getLength()); ENSURE_ARG_OR_THROW2(nLen%4==0, "number of channels no multiple of 4", static_cast<rendering::XColorSpace*>(this), 0); uno::Sequence< rendering::ARGBColor > aRes(nLen/4); rendering::ARGBColor* pOut( aRes.getArray() ); - for( std::size_t i=0; i<nLen; i+=4 ) + for (sal_Int32 i = 0; i < nLen; i += 4) { - *pOut++ = rendering::ARGBColor(1.0,pIn[0],pIn[1],pIn[2]); - pIn += 4; + *pOut++ = rendering::ARGBColor(1.0, deviceColor[i], deviceColor[i+1], deviceColor[i+2]); } return aRes; } virtual uno::Sequence< double > SAL_CALL convertFromRGB( const uno::Sequence< rendering::RGBColor >& rgbColor ) override { - const rendering::RGBColor* pIn( rgbColor.getConstArray() ); - const std::size_t nLen( rgbColor.getLength() ); - - uno::Sequence< double > aRes(nLen*4); + uno::Sequence<double> aRes(rgbColor.getLength() * 4); double* pColors=aRes.getArray(); - for( std::size_t i=0; i<nLen; ++i ) + for (auto& color : rgbColor) { - *pColors++ = pIn->Red; - *pColors++ = pIn->Green; - *pColors++ = pIn->Blue; + *pColors++ = color.Red; + *pColors++ = color.Green; + *pColors++ = color.Blue; *pColors++ = 1.0; // the value does not matter - ++pIn; } return aRes; } virtual uno::Sequence< double > SAL_CALL convertFromARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override { - const rendering::ARGBColor* pIn( rgbColor.getConstArray() ); - const std::size_t nLen( rgbColor.getLength() ); - - uno::Sequence< double > aRes(nLen*4); + uno::Sequence<double> aRes(rgbColor.getLength() * 4); double* pColors=aRes.getArray(); - for( std::size_t i=0; i<nLen; ++i ) + for (auto& color : rgbColor) { - *pColors++ = pIn->Red; - *pColors++ = pIn->Green; - *pColors++ = pIn->Blue; + *pColors++ = color.Red; + *pColors++ = color.Green; + *pColors++ = color.Blue; *pColors++ = 1.0; // the value does not matter - ++pIn; } return aRes; } virtual uno::Sequence< double > SAL_CALL convertFromPARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override { - const rendering::ARGBColor* pIn( rgbColor.getConstArray() ); - const std::size_t nLen( rgbColor.getLength() ); - - uno::Sequence< double > aRes(nLen*4); + uno::Sequence<double> aRes(rgbColor.getLength() * 4); double* pColors=aRes.getArray(); - for( std::size_t i=0; i<nLen; ++i ) + for (auto& color : rgbColor) { - *pColors++ = pIn->Red/pIn->Alpha; - *pColors++ = pIn->Green/pIn->Alpha; - *pColors++ = pIn->Blue/pIn->Alpha; + *pColors++ = color.Red / color.Alpha; + *pColors++ = color.Green / color.Alpha; + *pColors++ = color.Blue / color.Alpha; *pColors++ = 1.0; // the value does not matter - ++pIn; } return aRes; } @@ -663,20 +605,19 @@ namespace canvas::tools { if( dynamic_cast<StandardNoAlphaColorSpace*>(targetColorSpace.get()) ) { - const sal_Int8* pIn( deviceColor.getConstArray() ); - const std::size_t nLen( deviceColor.getLength() ); + const sal_Int32 nLen(deviceColor.getLength()); ENSURE_ARG_OR_THROW2(nLen%4==0, "number of channels no multiple of 4", static_cast<rendering::XColorSpace*>(this), 0); uno::Sequence<double> aRes(nLen); double* pOut( aRes.getArray() ); - for( std::size_t i=0; i<nLen; i+=4 ) + for (sal_Int32 i = 0; i < nLen; i += 4) { - *pOut++ = vcl::unotools::toDoubleColor(*pIn++); - *pOut++ = vcl::unotools::toDoubleColor(*pIn++); - *pOut++ = vcl::unotools::toDoubleColor(*pIn++); - *pOut++ = 1.0; pIn++; + *pOut++ = vcl::unotools::toDoubleColor(deviceColor[i]); + *pOut++ = vcl::unotools::toDoubleColor(deviceColor[i+1]); + *pOut++ = vcl::unotools::toDoubleColor(deviceColor[i+2]); + *pOut++ = 1.0; } return aRes; } @@ -708,119 +649,101 @@ namespace canvas::tools } virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertIntegerToRGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) override { - const sal_Int8* pIn( deviceColor.getConstArray() ); - const std::size_t nLen( deviceColor.getLength() ); + const sal_Int32 nLen(deviceColor.getLength()); ENSURE_ARG_OR_THROW2(nLen%4==0, "number of channels no multiple of 4", static_cast<rendering::XColorSpace*>(this), 0); uno::Sequence< rendering::RGBColor > aRes(nLen/4); rendering::RGBColor* pOut( aRes.getArray() ); - for( std::size_t i=0; i<nLen; i+=4 ) + for (sal_Int32 i = 0; i < nLen; i += 4) { *pOut++ = rendering::RGBColor( - vcl::unotools::toDoubleColor(pIn[0]), - vcl::unotools::toDoubleColor(pIn[1]), - vcl::unotools::toDoubleColor(pIn[2])); - pIn += 4; + vcl::unotools::toDoubleColor(deviceColor[i]), + vcl::unotools::toDoubleColor(deviceColor[i+1]), + vcl::unotools::toDoubleColor(deviceColor[i+2])); } return aRes; } virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToARGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) override { - const sal_Int8* pIn( deviceColor.getConstArray() ); - const std::size_t nLen( deviceColor.getLength() ); + const sal_Int32 nLen(deviceColor.getLength()); ENSURE_ARG_OR_THROW2(nLen%4==0, "number of channels no multiple of 4", static_cast<rendering::XColorSpace*>(this), 0); uno::Sequence< rendering::ARGBColor > aRes(nLen/4); rendering::ARGBColor* pOut( aRes.getArray() ); - for( std::size_t i=0; i<nLen; i+=4 ) + for (sal_Int32 i = 0; i < nLen; i += 4) { *pOut++ = rendering::ARGBColor( 1.0, - vcl::unotools::toDoubleColor(pIn[0]), - vcl::unotools::toDoubleColor(pIn[1]), - vcl::unotools::toDoubleColor(pIn[2])); - pIn += 4; + vcl::unotools::toDoubleColor(deviceColor[i]), + vcl::unotools::toDoubleColor(deviceColor[i+1]), + vcl::unotools::toDoubleColor(deviceColor[i+2])); } return aRes; } virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToPARGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) override { - const sal_Int8* pIn( deviceColor.getConstArray() ); - const std::size_t nLen( deviceColor.getLength() ); + const sal_Int32 nLen(deviceColor.getLength()); ENSURE_ARG_OR_THROW2(nLen%4==0, "number of channels no multiple of 4", static_cast<rendering::XColorSpace*>(this), 0); uno::Sequence< rendering::ARGBColor > aRes(nLen/4); rendering::ARGBColor* pOut( aRes.getArray() ); - for( std::size_t i=0; i<nLen; i+=4 ) + for (sal_Int32 i = 0; i < nLen; i += 4) { *pOut++ = rendering::ARGBColor( 1.0, - vcl::unotools::toDoubleColor(pIn[0]), - vcl::unotools::toDoubleColor(pIn[1]), - vcl::unotools::toDoubleColor(pIn[2])); - pIn += 4; + vcl::unotools::toDoubleColor(deviceColor[i]), + vcl::unotools::toDoubleColor(deviceColor[i+1]), + vcl::unotools::toDoubleColor(deviceColor[i+2])); } return aRes; } virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromRGB( const uno::Sequence< rendering::RGBColor >& rgbColor ) override { - const rendering::RGBColor* pIn( rgbColor.getConstArray() ); - const std::size_t nLen( rgbColor.getLength() ); - - uno::Sequence< sal_Int8 > aRes(nLen*4); + uno::Sequence<sal_Int8> aRes(rgbColor.getLength() * 4); sal_Int8* pColors=aRes.getArray(); - for( std::size_t i=0; i<nLen; ++i ) + for (auto& color : rgbColor) { - *pColors++ = vcl::unotools::toByteColor(pIn->Red); - *pColors++ = vcl::unotools::toByteColor(pIn->Green); - *pColors++ = vcl::unotools::toByteColor(pIn->Blue); + *pColors++ = vcl::unotools::toByteColor(color.Red); + *pColors++ = vcl::unotools::toByteColor(color.Green); + *pColors++ = vcl::unotools::toByteColor(color.Blue); *pColors++ = 1.0; - ++pIn; } return aRes; } virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override { - const rendering::ARGBColor* pIn( rgbColor.getConstArray() ); - const std::size_t nLen( rgbColor.getLength() ); - - uno::Sequence< sal_Int8 > aRes(nLen*4); + uno::Sequence<sal_Int8> aRes(rgbColor.getLength() * 4); sal_Int8* pColors=aRes.getArray(); - for( std::size_t i=0; i<nLen; ++i ) + for (auto& color : rgbColor) { - *pColors++ = vcl::unotools::toByteColor(pIn->Red); - *pColors++ = vcl::unotools::toByteColor(pIn->Green); - *pColors++ = vcl::unotools::toByteColor(pIn->Blue); + *pColors++ = vcl::unotools::toByteColor(color.Red); + *pColors++ = vcl::unotools::toByteColor(color.Green); + *pColors++ = vcl::unotools::toByteColor(color.Blue); *pColors++ = -1; - ++pIn; } return aRes; } virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromPARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override { - const rendering::ARGBColor* pIn( rgbColor.getConstArray() ); - const std::size_t nLen( rgbColor.getLength() ); - - uno::Sequence< sal_Int8 > aRes(nLen*4); + uno::Sequence<sal_Int8> aRes(rgbColor.getLength() * 4); sal_Int8* pColors=aRes.getArray(); - for( std::size_t i=0; i<nLen; ++i ) + for (auto& color : rgbColor) { - *pColors++ = vcl::unotools::toByteColor(pIn->Red/pIn->Alpha); - *pColors++ = vcl::unotools::toByteColor(pIn->Green/pIn->Alpha); - *pColors++ = vcl::unotools::toByteColor(pIn->Blue/pIn->Alpha); + *pColors++ = vcl::unotools::toByteColor(color.Red / color.Alpha); + *pColors++ = vcl::unotools::toByteColor(color.Green / color.Alpha); + *pColors++ = vcl::unotools::toByteColor(color.Blue / color.Alpha); *pColors++ = -1; - ++pIn; } return aRes; } diff --git a/cli_ure/source/climaker/climaker_emit.cxx b/cli_ure/source/climaker/climaker_emit.cxx index c67fa0c20fd4..d5f1a56d7e9f 100644 --- a/cli_ure/source/climaker/climaker_emit.cxx +++ b/cli_ure/source/climaker/climaker_emit.cxx @@ -520,18 +520,16 @@ Assembly ^ TypeEmitter::type_resolve( TypeAttributes::BeforeFieldInit | TypeAttributes::AnsiClass) ); - Sequence< Reference< + const Sequence< Reference< reflection::XConstantTypeDescription > > seq_constants( xType->getConstants() ); - Reference< reflection::XConstantTypeDescription > const * constants = - seq_constants.getConstArray(); sal_Int32 constants_length = seq_constants.getLength(); for ( sal_Int32 constants_pos = 0; constants_pos < constants_length; ++constants_pos ) { Reference< reflection::XConstantTypeDescription > const & xConstant = - constants[ constants_pos ]; + seq_constants[ constants_pos ]; ::System::Object ^ constant = to_cli_constant( xConstant->getConstantValue() ); ::System::String ^ uno_name = @@ -575,12 +573,10 @@ Assembly ^ TypeEmitter::type_resolve( (FieldAttributes) (FieldAttributes::Private | FieldAttributes::SpecialName | FieldAttributes::RTSpecialName) ); - Sequence< OUString > seq_enum_names( xType->getEnumNames() ); - Sequence< sal_Int32 > seq_enum_values( xType->getEnumValues() ); + const Sequence< OUString > seq_enum_names( xType->getEnumNames() ); + const Sequence< sal_Int32 > seq_enum_values( xType->getEnumValues() ); sal_Int32 enum_length = seq_enum_names.getLength(); OSL_ASSERT( enum_length == seq_enum_values.getLength() ); - OUString const * enum_names = seq_enum_names.getConstArray(); - sal_Int32 const * enum_values = seq_enum_values.getConstArray(); for ( sal_Int32 enum_pos = 0; enum_pos < enum_length; ++enum_pos ) { // enum_builder->DefineLiteral( @@ -588,13 +584,13 @@ Assembly ^ TypeEmitter::type_resolve( // __box ((::System::Int32) enum_values[ enum_pos ]) ); Emit::FieldBuilder ^ field_builder = enum_builder->DefineField( - ustring_to_String( enum_names[ enum_pos ] ), + ustring_to_String( seq_enum_names[ enum_pos ] ), enum_builder, (FieldAttributes) (FieldAttributes::Public | FieldAttributes::Static | FieldAttributes::Literal) ); field_builder->SetConstant( - ((::System::Int32) enum_values[ enum_pos ]) ); + ((::System::Int32) seq_enum_values[ enum_pos ]) ); } if (g_bVerbose) @@ -844,18 +840,16 @@ Assembly ^ TypeEmitter::type_resolve( } } - Sequence< + const Sequence< Reference< reflection::XInterfaceMemberTypeDescription > > seq_members( xType->getMembers() ); - Reference< reflection::XInterfaceMemberTypeDescription > const * members = - seq_members.getConstArray(); sal_Int32 members_length = seq_members.getLength(); for ( sal_Int32 members_pos = 0; members_pos < members_length; ++members_pos ) { Reference< reflection::XInterfaceMemberTypeDescription > const & xMember = - members[ members_pos ]; + seq_members[ members_pos ]; Sequence< Reference< reflection::XTypeDescription > > seq_exceptions; MethodAttributes c_method_attr = (MethodAttributes) @@ -870,21 +864,19 @@ Assembly ^ TypeEmitter::type_resolve( Reference< reflection::XInterfaceMethodTypeDescription > xMethod( xMember, UNO_QUERY_THROW ); - Sequence< + const Sequence< Reference< reflection::XMethodParameter > > seq_parameters( xMethod->getParameters() ); sal_Int32 params_length = seq_parameters.getLength(); array< ::System::Type^>^ param_types = gcnew array< ::System::Type^>( params_length ); - Reference< reflection::XMethodParameter > const * parameters = - seq_parameters.getConstArray(); // first determine all types //Make the first param type as return type sal_Int32 params_pos = 0; for ( ; params_pos < params_length; ++params_pos ) { Reference< reflection::XMethodParameter > const & xParam = - parameters[ params_pos ]; + seq_parameters[ params_pos ]; ::System::Type ^ param_type = get_type( xParam->getType() ); ::System::String ^ param_type_name = param_type->FullName; if (xParam->isOut()) @@ -913,7 +905,7 @@ Assembly ^ TypeEmitter::type_resolve( for ( ; params_pos < params_length; ++params_pos ) { Reference< reflection::XMethodParameter > const & xParam = - parameters[ params_pos ]; + seq_parameters[ params_pos ]; long param_flags = 0; if (xParam->isIn()) param_flags |= (long)ParameterAttributes::In; @@ -932,19 +924,17 @@ Assembly ^ TypeEmitter::type_resolve( if (xReturnStruct.is()) { - Sequence<Reference<reflection::XTypeDescription> > seq_type_args = + const Sequence<Reference<reflection::XTypeDescription> > seq_type_args = xReturnStruct->getTypeArguments(); if (seq_type_args.getLength() != 0) { //get th ctor of the attribute array< ::System::Type^>^ arCtor = {::System::Type::GetType("System.Type[]")}; //Get the arguments for the attribute's ctor - Reference<reflection::XTypeDescription> const * arXTypeArgs = - seq_type_args.getConstArray(); int numTypes = seq_type_args.getLength(); array< ::System::Type^>^ arCtsTypes = gcnew array< ::System::Type^>(numTypes); for (int i = 0; i < numTypes; i++) - arCtsTypes[i] = get_type(arXTypeArgs[i]); + arCtsTypes[i] = get_type(seq_type_args[i]); array< ::System::Object^>^ arArgs = {arCtsTypes}; Emit::CustomAttributeBuilder ^ attrBuilder = @@ -1080,7 +1070,7 @@ Assembly ^ TypeEmitter::type_resolve( { array< ::System::Object^>^ aArg = gcnew array< ::System::Object^>(numTypes); for (int i = 0; i < numTypes; i++) - aArg[i] = ustring_to_String(seq_type_parameters.getConstArray()[i]); + aArg[i] = ustring_to_String(seq_type_parameters[i]); array< ::System::Object^>^ args = {aArg}; array< ::System::Type^>^ arTypesCtor = @@ -1105,22 +1095,18 @@ Assembly ^ TypeEmitter::type_resolve( } // members - Sequence< Reference< reflection::XTypeDescription > > seq_members( + const Sequence< Reference< reflection::XTypeDescription > > seq_members( entry->m_xType->getMemberTypes() ); - Sequence< OUString > seq_member_names( entry->m_xType->getMemberNames() ); + const Sequence< OUString > seq_member_names( entry->m_xType->getMemberNames() ); sal_Int32 members_length = seq_members.getLength(); OSL_ASSERT( seq_member_names.getLength() == members_length ); //check if we have a XTypeDescription for every member. If not then the user may //have forgotten to specify additional rdbs with the --extra option. - Reference< reflection::XTypeDescription > const * pseq_members = - seq_members.getConstArray(); - OUString const * pseq_member_names = - seq_member_names.getConstArray(); for (int i = 0; i < members_length; i++) { const OUString sType(entry->m_xType->getName()); - const OUString sMemberName(pseq_member_names[i]); - if ( ! pseq_members[i].is()) + const OUString sMemberName(seq_member_names[i]); + if ( ! seq_members[i].is()) throw RuntimeException("Missing type description . Check if you need to " "specify additional RDBs with the --extra option. Type missing for: " + sType + "::" + sMemberName,0); @@ -1231,11 +1217,11 @@ Assembly ^ TypeEmitter::type_resolve( for ( member_pos = 0; member_pos < members_length; ++member_pos ) { ::System::String ^ field_name = - ustring_to_String( pseq_member_names[ member_pos ] ); + ustring_to_String( seq_member_names[ member_pos ] ); ::System::Type ^ field_type; //Special handling of struct parameter types bool bParameterizedType = false; - if (pseq_members[ member_pos ]->getTypeClass() == TypeClass_UNKNOWN) + if (seq_members[ member_pos ]->getTypeClass() == TypeClass_UNKNOWN) { bParameterizedType = true; if (type_param_pos < seq_type_parameters.getLength()) @@ -1251,7 +1237,7 @@ Assembly ^ TypeEmitter::type_resolve( } else { - field_type = get_type( pseq_members[ member_pos ] ); + field_type = get_type( seq_members[ member_pos ] ); if (field_type->IsArray && m_incomplete_structs[cts_name] @@ -1262,7 +1248,7 @@ Assembly ^ TypeEmitter::type_resolve( while ((value = value->GetElementType())->IsArray); //If the value type is a struct then make sure it is fully created. get_complete_struct(value->FullName); - field_type = get_type(pseq_members[member_pos]); + field_type = get_type(seq_members[member_pos]); } } members[ member_pos ] = @@ -1275,7 +1261,7 @@ Assembly ^ TypeEmitter::type_resolve( //get the name OSL_ASSERT(seq_type_parameters.getLength() > curParamIndex); ::System::String^ sTypeName = ustring_to_String( - seq_type_parameters.getConstArray()[curParamIndex++]); + seq_type_parameters[curParamIndex++]); array< ::System::Object^>^ args = {sTypeName}; //set ParameterizedTypeAttribute array< ::System::Type^>^ arCtorTypes = {::System::String::typeid}; @@ -1511,18 +1497,17 @@ Assembly ^ TypeEmitter::type_resolve( const Reference<reflection::XServiceConstructorDescription> & ctorDes = seqCtors[j]; //obtain the parameter types - Sequence<Reference<reflection::XParameter> > seqParams = + const Sequence<Reference<reflection::XParameter> > seqParams = ctorDes->getParameters(); - Reference<reflection::XParameter> const * arXParams = seqParams.getConstArray(); sal_Int32 cParams = seqParams.getLength(); array< ::System::Type^>^ arTypeParameters = gcnew array< ::System::Type^> (cParams + 1); arTypeParameters[0] = get_type("unoidl.com.sun.star.uno.XComponentContext", true); for (int iparam = 0; iparam != cParams; iparam++) { - if (arXParams[iparam]->isRestParameter()) + if (seqParams[iparam]->isRestParameter()) arTypeParameters[iparam + 1] = array< ::uno::Any>::typeid; else - arTypeParameters[iparam + 1] = get_type(arXParams[iparam]->getType()); + arTypeParameters[iparam + 1] = get_type(seqParams[iparam]->getType()); } //The array arTypeParameters can contain: //System.Type and uno.PolymorphicType. @@ -1572,7 +1557,7 @@ Assembly ^ TypeEmitter::type_resolve( gcnew array<Emit::ParameterBuilder^> (cParams); for (int iparam = 0; iparam != cParams; iparam++) { - Reference<reflection::XParameter> const & aParam = arXParams[iparam]; + Reference<reflection::XParameter> const & aParam = seqParams[iparam]; ::System::String ^ sParamName = ustring_to_String(aParam->getName()); arParameterBuilder[iparam] = method_builder->DefineParameter( @@ -1909,9 +1894,6 @@ Emit::CustomAttributeBuilder^ TypeEmitter::get_exception_attribute( { Emit::CustomAttributeBuilder ^ attr_builder = nullptr; - Reference< reflection::XCompoundTypeDescription > const * exceptions = - seq_exceptionsTd.getConstArray(); - array< ::System::Type^>^ arTypesCtor = {::System::Type::GetType("System.Type[]")}; ConstructorInfo ^ ctor_ExceptionAttribute = ::uno::ExceptionAttribute::typeid->GetConstructor(arTypesCtor); @@ -1924,7 +1906,7 @@ Emit::CustomAttributeBuilder^ TypeEmitter::get_exception_attribute( for ( sal_Int32 exc_pos = 0; exc_pos < exc_length; ++exc_pos ) { Reference< reflection::XCompoundTypeDescription > const & xExc = - exceptions[ exc_pos ]; + seq_exceptionsTd[ exc_pos ]; exception_types[ exc_pos ] = get_type( xExc ); } array< ::System::Object^>^ args = {exception_types}; diff --git a/connectivity/source/commontools/DriversConfig.cxx b/connectivity/source/commontools/DriversConfig.cxx index 26a241e3f829..90e361a8e0a8 100644 --- a/connectivity/source/commontools/DriversConfig.cxx +++ b/connectivity/source/commontools/DriversConfig.cxx @@ -33,13 +33,8 @@ namespace void lcl_convert(const uno::Sequence< OUString >& _aSource,uno::Any& _rDest) { uno::Sequence<uno::Any> aRet(_aSource.getLength()); - uno::Any* pAny = aRet.getArray(); - const OUString* pIter = _aSource.getConstArray(); - const OUString* pEnd = pIter + _aSource.getLength(); - for (;pIter != pEnd ; ++pIter,++pAny) - { - *pAny <<= *pIter; - } + std::transform(_aSource.begin(), _aSource.end(), aRet.getArray(), + [](auto& str) { return uno::Any(str); }); _rDest <<= aRet; } void lcl_fillValues(const ::utl::OConfigurationNode& _aURLPatternNode,const OUString& _sNode,::comphelper::NamedValueCollection& _rValues) @@ -49,17 +44,14 @@ namespace return; uno::Sequence< OUString > aStringSeq; - const uno::Sequence< OUString > aProperties = aPropertiesNode.getNodeNames(); - const OUString* pPropertiesIter = aProperties.getConstArray(); - const OUString* pPropertiesEnd = pPropertiesIter + aProperties.getLength(); - for (;pPropertiesIter != pPropertiesEnd ; ++pPropertiesIter) + for (auto& prop : aPropertiesNode.getNodeNames()) { - uno::Any aValue = aPropertiesNode.getNodeValue(*pPropertiesIter + "/Value"); + uno::Any aValue = aPropertiesNode.getNodeValue(prop + "/Value"); if ( aValue >>= aStringSeq ) { lcl_convert(aStringSeq,aValue); } - _rValues.put(*pPropertiesIter,aValue); + _rValues.put(prop, aValue); } // for (;pPropertiesIter != pPropertiesEnd ; ++pPropertiesIter,++pNamedIter) } void lcl_readURLPatternNode(const ::utl::OConfigurationTreeRoot& _aInstalled,const OUString& _sEntry,TInstalledDriver& _rInstalledDriver) @@ -106,15 +98,12 @@ const TInstalledDrivers& DriversConfigImpl::getInstalledDrivers(const uno::Refer if ( m_aInstalled.isValid() ) { - const uno::Sequence< OUString > aURLPatterns = m_aInstalled.getNodeNames(); - const OUString* pPatternIter = aURLPatterns.getConstArray(); - const OUString* pPatternEnd = pPatternIter + aURLPatterns.getLength(); - for (;pPatternIter != pPatternEnd ; ++pPatternIter) + for (auto& pattern : m_aInstalled.getNodeNames()) { TInstalledDriver aInstalledDriver; - lcl_readURLPatternNode(m_aInstalled,*pPatternIter,aInstalledDriver); + lcl_readURLPatternNode(m_aInstalled, pattern, aInstalledDriver); if ( !aInstalledDriver.sDriverFactory.isEmpty() ) - m_aDrivers.emplace(*pPatternIter,aInstalledDriver); + m_aDrivers.emplace(pattern, aInstalledDriver); } } // if ( m_aInstalled.isValid() ) } diff --git a/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx b/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx index 3f59f4646bc1..6b80f9495fe4 100644 --- a/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx +++ b/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx @@ -741,29 +741,25 @@ void SAL_CALL ODatabaseMetaDataResultSet::initialize( const Sequence< Any >& _aA return; ORows aRowsToSet; - const Sequence<Any>* pRowsIter = aRows.getConstArray(); - const Sequence<Any>* pRowsEnd = pRowsIter + aRows.getLength(); - for (; pRowsIter != pRowsEnd;++pRowsIter) + for (auto& row : aRows) { ORow aRowToSet; - const Any* pRowIter = pRowsIter->getConstArray(); - const Any* pRowEnd = pRowIter + pRowsIter->getLength(); - for (; pRowIter != pRowEnd;++pRowIter) + for (auto& field : row) { ORowSetValueDecoratorRef aValue; - switch( pRowIter->getValueTypeClass() ) + switch (field.getValueTypeClass()) { case TypeClass_BOOLEAN: { bool bValue = false; - *pRowIter >>= bValue; + field >>= bValue; aValue = new ORowSetValueDecorator(ORowSetValue(bValue)); } break; case TypeClass_BYTE: { sal_Int8 nValue(0); - *pRowIter >>= nValue; + field >>= nValue; aValue = new ORowSetValueDecorator(ORowSetValue(nValue)); } break; @@ -771,7 +767,7 @@ void SAL_CALL ODatabaseMetaDataResultSet::initialize( const Sequence< Any >& _aA case TypeClass_UNSIGNED_SHORT: { sal_Int16 nValue(0); - *pRowIter >>= nValue; + field >>= nValue; aValue = new ORowSetValueDecorator(ORowSetValue(nValue)); } break; @@ -779,7 +775,7 @@ void SAL_CALL ODatabaseMetaDataResultSet::initialize( const Sequence< Any >& _aA case TypeClass_UNSIGNED_LONG: { sal_Int32 nValue(0); - *pRowIter >>= nValue; + field >>= nValue; aValue = new ORowSetValueDecorator(ORowSetValue(nValue)); } break; @@ -787,28 +783,28 @@ void SAL_CALL ODatabaseMetaDataResultSet::initialize( const Sequence< Any >& _aA case TypeClass_UNSIGNED_HYPER: { sal_Int64 nValue(0); - *pRowIter >>= nValue; + field >>= nValue; aValue = new ORowSetValueDecorator(ORowSetValue(nValue)); } break; case TypeClass_FLOAT: { float nValue(0.0); - *pRowIter >>= nValue; + field >>= nValue; aValue = new ORowSetValueDecorator(ORowSetValue(nValue)); } break; case TypeClass_DOUBLE: { double nValue(0.0); - *pRowIter >>= nValue; + field >>= nValue; aValue = new ORowSetValueDecorator(ORowSetValue(nValue)); } break; case TypeClass_STRING: { OUString sValue; - *pRowIter >>= sValue; + field >>= sValue; aValue = new ORowSetValueDecorator(ORowSetValue(sValue)); } break; diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx index 4ac0235ac4e4..a21cdb336413 100644 --- a/connectivity/source/commontools/FValue.cxx +++ b/connectivity/source/commontools/FValue.cxx @@ -965,11 +965,8 @@ OUString ORowSetValue::getString( ) const case DataType::LONGVARBINARY: { OUStringBuffer sVal("0x"); - Sequence<sal_Int8> aSeq(getSequence()); - const sal_Int8* pBegin = aSeq.getConstArray(); - const sal_Int8* pEnd = pBegin + aSeq.getLength(); - for(;pBegin != pEnd;++pBegin) - sVal.append(static_cast<sal_Int32>(*pBegin),16); + for (sal_Int32 byte : getSequence()) + sVal.append(byte, 16); aRet = sVal.makeStringAndClear(); } break; diff --git a/connectivity/source/commontools/TDatabaseMetaDataBase.cxx b/connectivity/source/commontools/TDatabaseMetaDataBase.cxx index bd2b7a467142..73fb335b5382 100644 --- a/connectivity/source/commontools/TDatabaseMetaDataBase.cxx +++ b/connectivity/source/commontools/TDatabaseMetaDataBase.cxx @@ -122,12 +122,10 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaDataBase::getTypeInfo( ) std::vector<std::shared_ptr<ExpressionNode>> aConditions; if ( aTypeInfoSettings.getLength() > 1 && ((aTypeInfoSettings.getLength() % 2) == 0) ) { - const Any* pIter = aTypeInfoSettings.getConstArray(); - const Any* pEnd = pIter + aTypeInfoSettings.getLength(); try { - for(;pIter != pEnd;++pIter) - aConditions.push_back(FunctionParser::parseFunction(::comphelper::getString(*pIter))); + for (auto& any : aTypeInfoSettings) + aConditions.push_back(FunctionParser::parseFunction(::comphelper::getString(any))); } catch(ParseError&) { diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx index 885e28c751f5..82f981014f3c 100644 --- a/connectivity/source/commontools/dbtools.cxx +++ b/connectivity/source/commontools/dbtools.cxx @@ -1732,15 +1732,14 @@ void askForParameters(const Reference< XSingleSelectQueryComposer >& _xComposer, // now transfer the values from the continuation object to the parameter columns Sequence< PropertyValue > aFinalValues = pParams->getValues(); - const PropertyValue* pFinalValues = aFinalValues.getConstArray(); - for (sal_Int32 i=0; i<aFinalValues.getLength(); ++i, ++pFinalValues) + for (sal_Int32 i = 0; i < aFinalValues.getLength(); ++i) { Reference< XPropertySet > xParamColumn(xWrappedParameters->getByIndex(i),UNO_QUERY); if (xParamColumn.is()) { OUString sName; xParamColumn->getPropertyValue(PROPERTY_NAME) >>= sName; - OSL_ENSURE(sName == pFinalValues->Name, "::dbaui::askForParameters: inconsistent parameter names!"); + OSL_ENSURE(sName == aFinalValues[i].Name, "::dbaui::askForParameters: inconsistent parameter names!"); // determine the field type and ... sal_Int32 nParamType = 0; @@ -1750,12 +1749,12 @@ void askForParameters(const Reference< XSingleSelectQueryComposer >& _xComposer, if (hasProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE), xParamColumn)) xParamColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)) >>= nScale; // (the index of the parameters is one-based) - TParameterPositions::const_iterator aFind = aParameterNames.find(pFinalValues->Name); + TParameterPositions::const_iterator aFind = aParameterNames.find(aFinalValues[i].Name); for(const auto& rItem : aFind->second) { if ( _aParametersSet.empty() || !_aParametersSet[rItem-1] ) { - _xParameters->setObjectWithInfo(rItem, pFinalValues->Value, nParamType, nScale); + _xParameters->setObjectWithInfo(rItem, aFinalValues[i].Value, nParamType, nScale); } } } diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx index 8148b25ddca3..5b486bed168e 100644 --- a/connectivity/source/commontools/dbtools2.cxx +++ b/connectivity/source/commontools/dbtools2.cxx @@ -843,22 +843,15 @@ bool isEmbeddedInDatabase( const Reference< XInterface >& _rxComponent, Referenc if ( xModel.is() ) { - Sequence< PropertyValue > aArgs = xModel->getArgs(); - const PropertyValue* pIter = aArgs.getConstArray(); - const PropertyValue* pEnd = pIter + aArgs.getLength(); - for(;pIter != pEnd;++pIter) + for (auto& arg : xModel->getArgs()) { - if ( pIter->Name == "ComponentData" ) + if (arg.Name == "ComponentData") { Sequence<PropertyValue> aDocumentContext; - pIter->Value >>= aDocumentContext; - const PropertyValue* pContextIter = aDocumentContext.getConstArray(); - const PropertyValue* pContextEnd = pContextIter + aDocumentContext.getLength(); - for(;pContextIter != pContextEnd;++pContextIter) + arg.Value >>= aDocumentContext; + for (auto& item : aDocumentContext) { - if ( pContextIter->Name == "ActiveConnection" - && ( pContextIter->Value >>= _rxActualConnection ) - ) + if (item.Name == "ActiveConnection" && (item.Value >>= _rxActualConnection)) { bIsEmbedded = true; break; diff --git a/connectivity/source/commontools/parameters.cxx b/connectivity/source/commontools/parameters.cxx index 6c55b9884789..0e577704de7f 100644 --- a/connectivity/source/commontools/parameters.cxx +++ b/connectivity/source/commontools/parameters.cxx @@ -669,8 +669,7 @@ namespace dbtools { // transfer the values from the continuation object to the parameter columns const Sequence< PropertyValue >& aFinalValues = pParams->getValues(); - const PropertyValue* pFinalValues = aFinalValues.getConstArray(); - for ( sal_Int32 i = 0; i < aFinalValues.getLength(); ++i, ++pFinalValues ) + for (sal_Int32 i = 0; i < aFinalValues.getLength(); ++i) { Reference< XPropertySet > xParamColumn(aRequest.Parameters->getByIndex( i ),UNO_QUERY); if ( xParamColumn.is() ) @@ -678,9 +677,9 @@ namespace dbtools #ifdef DBG_UTIL OUString sName; xParamColumn->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME) ) >>= sName; - OSL_ENSURE( sName == pFinalValues->Name, "ParameterManager::completeParameters: inconsistent parameter names!" ); + OSL_ENSURE( sName == aFinalValues[i].Name, "ParameterManager::completeParameters: inconsistent parameter names!" ); #endif - xParamColumn->setPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_VALUE), pFinalValues->Value ); + xParamColumn->setPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_VALUE), aFinalValues[i].Value ); // the property sets are wrapper classes, translating the Value property into a call to // the appropriate XParameters interface } diff --git a/connectivity/source/cpool/ZPoolCollection.cxx b/connectivity/source/cpool/ZPoolCollection.cxx index adc15a3b2a50..6044175480b8 100644 --- a/connectivity/source/cpool/ZPoolCollection.cxx +++ b/connectivity/source/cpool/ZPoolCollection.cxx @@ -178,15 +178,12 @@ bool OPoolCollection::isDriverPoolingEnabled(std::u16string_view _sDriverImplNam if(xDirectAccess.is()) { - Sequence< OUString > aDriverKeys = xDirectAccess->getElementNames(); - const OUString* pDriverKeys = aDriverKeys.getConstArray(); - const OUString* pDriverKeysEnd = pDriverKeys + aDriverKeys.getLength(); - for (;pDriverKeys != pDriverKeysEnd; ++pDriverKeys) + for (auto& driverKey : xDirectAccess->getElementNames()) { // the name of the driver in this round - if(_sDriverImplName == *pDriverKeys) + if (_sDriverImplName == driverKey) { - _rxDriverNode = openNode(*pDriverKeys,xDirectAccess); + _rxDriverNode = openNode(driverKey, xDirectAccess); if(_rxDriverNode.is()) getNodeValue(ENABLE,_rxDriverNode) >>= bEnabled; break; diff --git a/connectivity/source/drivers/ado/AConnection.cxx b/connectivity/source/drivers/ado/AConnection.cxx index b879e1b11801..600604e5eafb 100644 --- a/connectivity/source/drivers/ado/AConnection.cxx +++ b/connectivity/source/drivers/ado/AConnection.cxx @@ -96,16 +96,14 @@ void OConnection::construct(std::u16string_view url,const Sequence< PropertyValu o3tl::starts_with(aDSN, u"access:", &aDSN); sal_Int32 nTimeout = 20; - const PropertyValue *pIter = info.getConstArray(); - const PropertyValue *pEnd = pIter + info.getLength(); - for(;pIter != pEnd;++pIter) + for (const auto& propval : info) { - if(pIter->Name == "Timeout") - pIter->Value >>= nTimeout; - else if(pIter->Name == "user") - pIter->Value >>= aUID; - else if(pIter->Name == "password") - pIter->Value >>= aPWD; + if (propval.Name == "Timeout") + propval.Value >>= nTimeout; + else if (propval.Name == "user") + propval.Value >>= aUID; + else if (propval.Name == "password") + propval.Value >>= aPWD; } try { diff --git a/connectivity/source/drivers/ado/AResultSet.cxx b/connectivity/source/drivers/ado/AResultSet.cxx index 85ca2b081a07..7e633130d95e 100644 --- a/connectivity/source/drivers/ado/AResultSet.cxx +++ b/connectivity/source/drivers/ado/AResultSet.cxx @@ -927,11 +927,9 @@ Sequence< sal_Int32 > SAL_CALL OResultSet::deleteRows( const Sequence< Any >& ro rgsabound[0].cElements = rows.getLength(); SAFEARRAY *psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound ); - const Any* pBegin = rows.getConstArray(); - const Any* pEnd = pBegin + rows.getLength(); - for(sal_Int32 i=0;pBegin != pEnd ;++pBegin,++i) + for (sal_Int32 i = 0; i < rows.getLength(); ++i) { - *pBegin >>= nPos; + rows[i] >>= nPos; SafeArrayPutElement(psa,&i,&m_aBookmarks[nPos]); } diff --git a/connectivity/source/drivers/ado/Aolevariant.cxx b/connectivity/source/drivers/ado/Aolevariant.cxx index c082c1987ff0..75591468be36 100644 --- a/connectivity/source/drivers/ado/Aolevariant.cxx +++ b/connectivity/source/drivers/ado/Aolevariant.cxx @@ -117,12 +117,10 @@ OLEVariant::OLEVariant(const css::uno::Sequence< sal_Int8 >& x) vt = VT_ARRAY|VT_UI1; parray = SafeArrayCreateVector(VT_UI1, 0, x.getLength()); - const sal_Int8* pBegin = x.getConstArray(); - const sal_Int8* pEnd = pBegin + x.getLength(); - for(sal_Int32 i=0;pBegin != pEnd;++i,++pBegin) + for (sal_Int32 i = 0; i < x.getLength(); ++i) { - sal_Int32 nData = *pBegin; + sal_Int32 nData = x[i]; HRESULT rs = SafeArrayPutElement(parray,&i,&nData); OSL_ENSURE(S_OK == rs,"Error while copy byte data"); } diff --git a/connectivity/source/drivers/ado/Awrapado.cxx b/connectivity/source/drivers/ado/Awrapado.cxx index eebdc5d8c5a7..fe2e7e344857 100644 --- a/connectivity/source/drivers/ado/Awrapado.cxx +++ b/connectivity/source/drivers/ado/Awrapado.cxx @@ -1821,13 +1821,11 @@ ADORecordset* WpADOConnection::getTables( const css::uno::Any& catalog, ++nPos; OUStringBuffer aTypes; - const OUString* pIter = types.getConstArray(); - const OUString* pEnd = pIter + types.getLength(); - for( ; pIter != pEnd ; ++pIter) + for (auto& type : types) { if ( aTypes.getLength() ) aTypes.append(","); - aTypes.append(*pIter); + aTypes.append(type); } OUString sTypeNames = aTypes.makeStringAndClear(); diff --git a/connectivity/source/drivers/calc/CConnection.cxx b/connectivity/source/drivers/calc/CConnection.cxx index 5dc725e70ed9..5c746414ed96 100644 --- a/connectivity/source/drivers/calc/CConnection.cxx +++ b/connectivity/source/drivers/calc/CConnection.cxx @@ -80,18 +80,15 @@ void OCalcConnection::construct(const OUString& url,const Sequence< PropertyValu m_aFileName = aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE); m_sPassword.clear(); - const char pPwd[] = "password"; - const PropertyValue *pIter = info.getConstArray(); - const PropertyValue *pEnd = pIter + info.getLength(); - for(;pIter != pEnd;++pIter) + for (auto& propval : info) { - if(pIter->Name == pPwd) + if (propval.Name == "password") { - pIter->Value >>= m_sPassword; + propval.Value >>= m_sPassword; break; } - } // for(;pIter != pEnd;++pIter) + } ODocHolder aDocHolder(this); // just to test that the doc can be loaded acquireDoc(); } diff --git a/connectivity/source/drivers/calc/CDatabaseMetaData.cxx b/connectivity/source/drivers/calc/CDatabaseMetaData.cxx index aad5b4e50193..1b88ab05ff55 100644 --- a/connectivity/source/drivers/calc/CDatabaseMetaData.cxx +++ b/connectivity/source/drivers/calc/CDatabaseMetaData.cxx @@ -134,27 +134,23 @@ Reference< XResultSet > SAL_CALL OCalcDatabaseMetaData::getTables( // check if ORowSetValue type is given // when no types are given then we have to return all tables e.g. TABLE - OUString aTable("TABLE"); + static constexpr OUString aTable(u"TABLE"_ustr); - bool bTableFound = true; - sal_Int32 nLength = types.getLength(); - if(nLength) + if (types.hasElements()) { - bTableFound = false; + bool bTableFound = false; - const OUString* pIter = types.getConstArray(); - const OUString* pEnd = pIter + nLength; - for(;pIter != pEnd;++pIter) + for (auto& type : types) { - if(*pIter == aTable) + if (type == aTable) { bTableFound = true; break; } } + if (!bTableFound) + return pResult; } - if(!bTableFound) - return pResult; // get the sheet names from the document diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx index 879a2902d00c..b480ee740f01 100644 --- a/connectivity/source/drivers/calc/CTable.cxx +++ b/connectivity/source/drivers/calc/CTable.cxx @@ -69,14 +69,11 @@ static void lcl_UpdateArea( const Reference<XCellRange>& xUsedRange, sal_Int32& CellFlags::STRING | CellFlags::VALUE | CellFlags::DATETIME | CellFlags::FORMULA | CellFlags::ANNOTATION; const Reference<XSheetCellRanges> xUsedRanges = xUsedQuery->queryContentCells( nContentFlags ); - const Sequence<CellRangeAddress> aAddresses = xUsedRanges->getRangeAddresses(); - const sal_Int32 nCount = aAddresses.getLength(); - const CellRangeAddress* pData = aAddresses.getConstArray(); - for ( sal_Int32 i=0; i<nCount; i++ ) + for (auto& address : xUsedRanges->getRangeAddresses()) { - rEndCol = std::max(pData[i].EndColumn, rEndCol); - rEndRow = std::max(pData[i].EndRow, rEndRow); + rEndCol = std::max(address.EndColumn, rEndCol); + rEndRow = std::max(address.EndRow, rEndRow); } } diff --git a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx index b3791f7d85d1..5192b308d19d 100644 --- a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx +++ b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx @@ -166,35 +166,28 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getColumns( try { aRow[10] = new ORowSetValueDecorator(sal_Int32(10)); - Sequence< OUString> aTabNames(xNames->getElementNames()); - const OUString* pTabBegin = aTabNames.getConstArray(); - const OUString* pTabEnd = pTabBegin + aTabNames.getLength(); - for(;pTabBegin != pTabEnd;++pTabBegin) + for (auto& tabName : xNames->getElementNames()) { - if(match(tableNamePattern,*pTabBegin,' + if (match(tableNamePattern, tabName, ' { - Reference< XColumnsSupplier> xTable( - xNames->getByName(*pTabBegin), css::uno::UNO_QUERY); + Reference<XColumnsSupplier> xTable(xNames->getByName(tabName), css::uno::UNO_QUERY); OSL_ENSURE(xTable.is(),"Table not found! Normally an exception had to be thrown here!"); - aRow[3] = new ORowSetValueDecorator(*pTabBegin); + aRow[3] = new ORowSetValueDecorator(tabName); Reference< XNameAccess> xColumns = xTable->getColumns(); if(!xColumns.is()) throw SQLException(); - Sequence< OUString> aColNames(xColumns->getElementNames()); - - const OUString* pBegin = aColNames.getConstArray(); - const OUString* pEnd = pBegin + aColNames.getLength(); Reference< XPropertySet> xColumn; - for(sal_Int32 i=1;pBegin != pEnd;++pBegin,++i) + sal_Int32 i = 0; + for (auto& colName : xColumns->getElementNames()) { - if(match(columnNamePattern,*pBegin,' + ++i; + if (match(columnNamePattern, colName, ' { - aRow[4] = new ORowSetValueDecorator(*pBegin); + aRow[4] = new ORowSetValueDecorator(colName); - xColumn.set( - xColumns->getByName(*pBegin), css::uno::UNO_QUERY); + xColumn.set(xColumns->getByName(colName), css::uno::UNO_QUERY); OSL_ENSURE(xColumn.is(),"Columns contains a column who isn't a fastpropertyset!"); aRow[5] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))); aRow[6] = new ORowSetValueDecorator(getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)))); @@ -274,20 +267,16 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getIndexInfo( if(!xIndexes.is()) throw SQLException(); - Sequence< OUString> aIdxNames(xIndexes->getElementNames()); - - const OUString* pBegin = aIdxNames.getConstArray(); - const OUString* pEnd = pBegin + aIdxNames.getLength(); Reference< XPropertySet> xIndex; - for(;pBegin != pEnd;++pBegin) + for (auto& idxName : xIndexes->getElementNames()) { - xIndex.set(xIndexes->getByName(*pBegin), css::uno::UNO_QUERY); + xIndex.set(xIndexes->getByName(idxName), css::uno::UNO_QUERY); OSL_ENSURE(xIndex.is(),"Indexes contains a column who isn't a fastpropertyset!"); if(unique && !getBOOL(xIndex->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISUNIQUE)))) continue; aRow[4] = new ORowSetValueDecorator(ORowSetValue(getBOOL(xIndex->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISUNIQUE))))); - aRow[6] = new ORowSetValueDecorator(*pBegin); + aRow[6] = new ORowSetValueDecorator(idxName); auto pIndex = dynamic_cast<ODbaseIndex*>(xIndex.get()); if(pIndex) @@ -298,14 +287,12 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getIndexInfo( Reference<XColumnsSupplier> xColumnsSup(xIndex,UNO_QUERY); Reference< XNameAccess> xColumns = xColumnsSup->getColumns(); - Sequence< OUString> aColNames(xColumns->getElementNames()); - const OUString* pColBegin = aColNames.getConstArray(); - const OUString* pColEnd = pColBegin + aColNames.getLength(); - for(sal_Int32 j=1;pColBegin != pColEnd;++pColBegin,++j) + sal_Int32 j = 0; + for (auto& colName : xColumns->getElementNames()) { - aRow[8] = new ORowSetValueDecorator(j); - aRow[9] = new ORowSetValueDecorator(*pColBegin); + aRow[8] = new ORowSetValueDecorator(++j); + aRow[9] = new ORowSetValueDecorator(colName); aRows.push_back(aRow); } } diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 98d598d0478f..0caeb5be7c3f 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -739,14 +739,12 @@ Sequence< Type > SAL_CALL ODbaseTable::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 (auto& type : aTypes) { - if(*pBegin != cppu::UnoType<XKeysSupplier>::get() && - *pBegin != cppu::UnoType<XDataDescriptorFactory>::get()) + if(type != cppu::UnoType<XKeysSupplier>::get() && + type != cppu::UnoType<XDataDescriptorFactory>::get()) { - aOwnTypes.push_back(*pBegin); + aOwnTypes.push_back(type); } } aOwnTypes.push_back(cppu::UnoType<css::lang::XUnoTunnel>::get()); diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx index 8ca4d6271fc4..f190d5dbfc97 100644 --- a/connectivity/source/parse/sqliterator.cxx +++ b/connectivity/source/parse/sqliterator.cxx @@ -1533,18 +1533,14 @@ void OSQLParseTreeIterator::appendColumns(const OUString& _rTableAlias, const OS if ( !xColumns.is() ) return; - Sequence< OUString > aColNames = xColumns->getElementNames(); - const OUString* pBegin = aColNames.getConstArray(); - const OUString* pEnd = pBegin + aColNames.getLength(); - ::comphelper::UStringMixLess aCompare(isCaseSensitive()); std::vector<OUString> aSelectColumnNames = getSelectColumnNames(); - for(;pBegin != pEnd;++pBegin) + for (auto& colName : xColumns->getElementNames()) { - OUString aName(getUniqueColumnName(aSelectColumnNames, *pBegin)); + OUString aName(getUniqueColumnName(aSelectColumnNames, colName)); Reference< XPropertySet > xColumn; - if(xColumns->hasByName(*pBegin) && (xColumns->getByName(*pBegin) >>= xColumn) && xColumn.is()) + if(xColumns->hasByName(colName) && (xColumns->getByName(colName) >>= xColumn) && xColumn.is()) { rtl::Reference<OParseColumn> pColumn = new OParseColumn(aName , getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))) @@ -1562,13 +1558,13 @@ void OSQLParseTreeIterator::appendColumns(const OUString& _rTableAlias, const OS , getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TABLENAME)))); pColumn->setTableName(_rTableAlias); - pColumn->setRealName(*pBegin); + pColumn->setRealName(colName); m_aSelectColumns->push_back(pColumn); // update aSelectColumnNames with newly insert aName aSelectColumnNames.insert(std::upper_bound(aSelectColumnNames.begin(), aSelectColumnNames.end(), aName, aCompare), aName); } else - impl_appendError( IParseContext::ErrorCode::InvalidColumn, pBegin, &_rTableAlias ); + impl_appendError(IParseContext::ErrorCode::InvalidColumn, &colName, &_rTableAlias); } } commit 20070d12c85ae6db8d5b1374a49f92b34137c8b1 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Mon Apr 29 01:31:19 2024 +0500 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Mon Apr 29 23:15:24 2024 +0200 Drop uses of css::uno::Sequence::getConstArray in accessibility .. basegfx where it was obsoleted by commits 2484de6728bd11bb7949003d112f1ece2223c7a1 (Remove non-const Sequence::begin()/end() in internal code, 2021-10-15) and fb3c04bd1930eedacd406874e1a285d62bbf27d9 (Drop non-const Sequence::operator[] in internal code 2021-11-05). Change-Id: I14e3634d8e8dd294b673dcda4dde13f01c3e5112 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166813 Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Tested-by: Jenkins diff --git a/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx b/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx index 024e95d588cc..69370f9e4a4c 100644 --- a/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx +++ b/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx @@ -345,7 +345,7 @@ sal_Int64 AccessibleBrowseBoxHeaderBar::implGetChildIndexFromSelectedIndex( if( (nSelectedChildIndex < 0) || (nSelectedChildIndex >= aSelSeq.getLength()) ) throw lang::IndexOutOfBoundsException(); - return aSelSeq.getConstArray()[ nSelectedChildIndex ]; + return aSelSeq[ nSelectedChildIndex ]; } void AccessibleBrowseBoxHeaderBar::ensureIsValidHeaderIndex( sal_Int32 nIndex ) diff --git a/basctl/source/basicide/IDEComboBox.cxx b/basctl/source/basicide/IDEComboBox.cxx index d25e143d62fa..a4ad6c8ada95 100644 --- a/basctl/source/basicide/IDEComboBox.cxx +++ b/basctl/source/basicide/IDEComboBox.cxx @@ -250,13 +250,8 @@ void LibBox::FillBox() void LibBox::InsertEntries(const ScriptDocument& rDocument, LibraryLocation eLocation) { // get a sorted list of library names - Sequence<OUString> aLibNames = rDocument.getLibraryNames(); - sal_Int32 nLibCount = aLibNames.getLength(); - const OUString* pLibNames = aLibNames.getConstArray(); - - for (sal_Int32 i = 0; i < nLibCount; ++i) + for (auto& aLibName : rDocument.getLibraryNames()) { - OUString aLibName = pLibNames[i]; if (eLocation == rDocument.getLibraryLocation(aLibName)) { OUString aName(rDocument.getTitle(eLocation)); @@ -428,19 +423,18 @@ void LanguageBox::FillBox() Locale aDefaultLocale = pCurMgr->getStringResourceManager()->getDefaultLocale(); Locale aCurrentLocale = pCurMgr->getStringResourceManager()->getCurrentLocale(); Sequence<Locale> aLocaleSeq = pCurMgr->getStringResourceManager()->getLocales(); - const Locale* pLocale = aLocaleSeq.getConstArray(); sal_Int32 i, nCount = aLocaleSeq.getLength(); for (i = 0; i < nCount; ++i) { - bool bIsDefault = localesAreEqual(aDefaultLocale, pLocale[i]); - bool bIsCurrent = localesAreEqual(aCurrentLocale, pLocale[i]); - LanguageType eLangType = LanguageTag::convertToLanguageType(pLocale[i]); + bool bIsDefault = localesAreEqual(aDefaultLocale, aLocaleSeq[i]); + bool bIsCurrent = localesAreEqual(aCurrentLocale, aLocaleSeq[i]); + LanguageType eLangType = LanguageTag::convertToLanguageType(aLocaleSeq[i]); OUString sLanguage = SvtLanguageTable::GetLanguageString(eLangType); if (bIsDefault) { sLanguage += " " + msDefaultLanguageStr; } - LanguageEntry* pEntry = new LanguageEntry(pLocale[i], bIsDefault); + LanguageEntry* pEntry = new LanguageEntry(aLocaleSeq[i], bIsDefault); OUString sId(weld::toId(pEntry)); m_xWidget->append(sId, sLanguage); diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index 6fe3b9a562f6..b5ac6852986f 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -1207,7 +1207,6 @@ void Shell::GetState(SfxItemSet &rSet) if ( pCurMgr->isLibraryLocalized() ) { Sequence< lang::Locale > aLocaleSeq = pCurMgr->getStringResourceManager()->getLocales(); - const lang::Locale* pLocale = aLocaleSeq.getConstArray(); sal_Int32 i, nCount = aLocaleSeq.getLength(); // Force different results for any combination of locales and default locale @@ -1216,7 +1215,7 @@ void Shell::GetState(SfxItemSet &rSet) { lang::Locale aLocale; if( i < nCount ) - aLocale = pLocale[i]; + aLocale = aLocaleSeq[i]; else aLocale = pCurMgr->getStringResourceManager()->getDefaultLocale(); diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx index c478d80fdf81..bdf68e11a7dc 100644 --- a/basctl/source/basicide/basidesh.cxx +++ b/basctl/source/basicide/basidesh.cxx @@ -678,14 +678,8 @@ void Shell::UpdateWindows() StartListening(*doc.getBasicManager(), DuplicateHandling::Prevent /* log on only once */); // libraries - Sequence< OUString > aLibNames( doc.getLibraryNames() ); - sal_Int32 nLibCount = aLibNames.getLength(); - const OUString* pLibNames = aLibNames.getConstArray(); - - for ( sal_Int32 i = 0 ; i < nLibCount ; i++ ) + for (auto& aLibName : doc.getLibraryNames()) { - OUString aLibName = pLibNames[ i ]; - if ( m_aCurLibName.isEmpty() || ( doc == m_aCurDocument && aLibName == m_aCurLibName ) ) { // check, if library is password protected and not verified @@ -716,13 +710,10 @@ void Shell::UpdateWindows() try { Sequence< OUString > aModNames( doc.getObjectNames( E_SCRIPTS, aLibName ) ); - sal_Int32 nModCount = aModNames.getLength(); - const OUString* pModNames = aModNames.getConstArray(); - nTotalTabs += nModCount; + nTotalTabs += aModNames.getLength(); - for ( sal_Int32 j = 0 ; j < nModCount ; j++ ) + for (auto& aModName : aModNames) { - OUString aModName = pModNames[ j ]; VclPtr<ModulWindow> pWin = FindBasWin( doc, aLibName, aModName ); if ( !pWin ) pWin = CreateBasWin( doc, aLibName, aModName ); @@ -746,13 +737,10 @@ void Shell::UpdateWindows() try { Sequence< OUString > aDlgNames = doc.getObjectNames( E_DIALOGS, aLibName ); - sal_Int32 nDlgCount = aDlgNames.getLength(); - const OUString* pDlgNames = aDlgNames.getConstArray(); - nTotalTabs += nDlgCount; + nTotalTabs += aDlgNames.getLength(); - for ( sal_Int32 j = 0 ; j < nDlgCount ; j++ ) + for (auto& aDlgName : aDlgNames) { - OUString aDlgName = pDlgNames[ j ]; // this find only looks for non-suspended windows; // suspended windows are handled in CreateDlgWin VclPtr<DialogWindow> pWin = FindDlgWin( doc, aLibName, aDlgName ); diff --git a/basctl/source/basicide/basobj3.cxx b/basctl/source/basicide/basobj3.cxx index 5d5bacf0e88d..1e51cbbb2ed8 100644 --- a/basctl/source/basicide/basobj3.cxx +++ b/basctl/source/basicide/basobj3.cxx @@ -231,13 +231,9 @@ BasicManager* FindBasicManager( StarBASIC const * pLib ) if ( !pBasicMgr ) continue; - Sequence< OUString > aLibNames( doc.getLibraryNames() ); - sal_Int32 nLibCount = aLibNames.getLength(); - const OUString* pLibNames = aLibNames.getConstArray(); - - for ( sal_Int32 i = 0 ; i < nLibCount ; i++ ) + for (auto& rLibName : doc.getLibraryNames()) { - StarBASIC* pL = pBasicMgr->GetLib( pLibNames[ i ] ); + StarBASIC* pL = pBasicMgr->GetLib(rLibName); if ( pL == pLib ) return pBasicMgr; } diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx index 18ca75e01bfe..352742be8a4e 100644 --- a/basctl/source/basicide/bastype2.cxx +++ b/basctl/source/basicide/bastype2.cxx @@ -208,14 +208,8 @@ void SbTreeListBox::ScanEntry( const ScriptDocument& rDocument, LibraryLocation void SbTreeListBox::ImpCreateLibEntries(const weld::TreeIter& rIter, const ScriptDocument& rDocument, LibraryLocation eLocation) { // get a sorted list of library names - Sequence< OUString > aLibNames( rDocument.getLibraryNames() ); - sal_Int32 nLibCount = aLibNames.getLength(); - const OUString* pLibNames = aLibNames.getConstArray(); - - for ( sal_Int32 i = 0 ; i < nLibCount ; i++ ) + for (auto& aLibName : rDocument.getLibraryNames()) { - OUString aLibName = pLibNames[ i ]; - if ( eLocation == rDocument.getLibraryLocation( aLibName ) ) { // check, if the module library is loaded @@ -284,15 +278,10 @@ void SbTreeListBox::ImpCreateLibSubEntries(const weld::TreeIter& rLibRootEntry, else { // get a sorted list of module names - Sequence< OUString > aModNames = rDocument.getObjectNames( E_SCRIPTS, rLibName ); - sal_Int32 nModCount = aModNames.getLength(); - const OUString* pModNames = aModNames.getConstArray(); - auto xTreeIter = m_xControl->make_iterator(); - for ( sal_Int32 i = 0 ; i < nModCount ; i++ ) + for (auto& aModName : rDocument.getObjectNames(E_SCRIPTS, rLibName)) { - OUString aModName = pModNames[ i ]; m_xControl->copy_iterator(rLibRootEntry, *xTreeIter); bool bModuleEntry = FindEntry(aModName, OBJ_TYPE_MODULE, *xTreeIter); if (!bModuleEntry) @@ -303,15 +292,10 @@ void SbTreeListBox::ImpCreateLibSubEntries(const weld::TreeIter& rLibRootEntry, // methods if ( nMode & BrowseMode::Subs ) { - Sequence< OUString > aNames = GetMethodNames( rDocument, rLibName, aModName ); - sal_Int32 nCount = aNames.getLength(); - const OUString* pNames = aNames.getConstArray(); - auto xSubTreeIter = m_xControl->make_iterator(); - for ( sal_Int32 j = 0 ; j < nCount ; j++ ) + for (auto& aName : GetMethodNames(rDocument, rLibName, aModName)) { - OUString aName = pNames[ j ]; m_xControl->copy_iterator(*xTreeIter, *xSubTreeIter); bool bEntry = FindEntry(aName, OBJ_TYPE_METHOD, *xSubTreeIter); if (!bEntry) @@ -342,15 +326,10 @@ void SbTreeListBox::ImpCreateLibSubEntries(const weld::TreeIter& rLibRootEntry, try { // get a sorted list of dialog names - Sequence< OUString > aDlgNames( rDocument.getObjectNames( E_DIALOGS, rLibName ) ); - sal_Int32 nDlgCount = aDlgNames.getLength(); - const OUString* pDlgNames = aDlgNames.getConstArray(); - auto xTreeIter = m_xControl->make_iterator(); - for ( sal_Int32 i = 0 ; i < nDlgCount ; i++ ) + for (auto& aDlgName : rDocument.getObjectNames(E_DIALOGS, rLibName)) { - OUString aDlgName = pDlgNames[ i ]; m_xControl->copy_iterator(rLibRootEntry, *xTreeIter); bool bDialogEntry = FindEntry(aDlgName, OBJ_TYPE_DIALOG, *xTreeIter); if (!bDialogEntry) @@ -401,16 +380,11 @@ void SbTreeListBox::ImpCreateLibSubSubEntriesInVBAMode(const weld::TreeIter& rLi try { // get a sorted list of module names - Sequence< OUString > aModNames = rDocument.getObjectNames( E_SCRIPTS, rLibName ); - sal_Int32 nModCount = aModNames.getLength(); - const OUString* pModNames = aModNames.getConstArray(); - EntryDescriptor aDesc(GetEntryDescriptor(&rLibSubRootEntry)); EntryType eCurrentType(aDesc.GetType()); - for ( sal_Int32 i = 0 ; i < nModCount ; i++ ) + for (auto& aModName : rDocument.getObjectNames(E_SCRIPTS, rLibName)) { - OUString aModName = pModNames[ i ]; EntryType eType = OBJ_TYPE_UNKNOWN; switch( ModuleInfoHelper::getModuleType( xLib, aModName ) ) { @@ -454,13 +428,8 @@ void SbTreeListBox::ImpCreateLibSubSubEntriesInVBAMode(const weld::TreeIter& rLi // methods if ( nMode & BrowseMode::Subs ) { - Sequence< OUString > aNames = GetMethodNames( rDocument, rLibName, aModName ); - sal_Int32 nCount = aNames.getLength(); - const OUString* pNames = aNames.getConstArray(); - - for ( sal_Int32 j = 0 ; j < nCount ; j++ ) + for (auto& aName : GetMethodNames(rDocument, rLibName, aModName)) { - OUString aName = pNames[ j ]; std::unique_ptr<weld::TreeIter> xEntry(m_xControl->make_iterator(xModuleEntry.get())); bool bEntry = FindEntry(aName, OBJ_TYPE_METHOD, *xEntry); if (!bEntry) @@ -697,13 +666,11 @@ OUString SbTreeListBox::GetRootEntryBitmaps(const ScriptDocument& rDocument) OUString sModule( xModuleManager->identify( rDocument.getDocument() ) ); Sequence< beans::PropertyValue > aModuleDescr; xModuleManager->getByName( sModule ) >>= aModuleDescr; - sal_Int32 nCount = aModuleDescr.getLength(); - const beans::PropertyValue* pModuleDescr = aModuleDescr.getConstArray(); - for ( sal_Int32 i = 0; i < nCount; ++i ) + for (auto& rModuleDescr : aModuleDescr) { - if ( pModuleDescr[ i ].Name == "ooSetupFactoryEmptyDocumentURL" ) + if (rModuleDescr.Name == "ooSetupFactoryEmptyDocumentURL") { - pModuleDescr[ i ].Value >>= sFactoryURL; + rModuleDescr.Value >>= sFactoryURL; break; } } diff --git a/basctl/source/basicide/localizationmgr.cxx b/basctl/source/basicide/localizationmgr.cxx index 4d311741b4bb..e978e1ca130f 100644 --- a/basctl/source/basicide/localizationmgr.cxx +++ b/basctl/source/basicide/localizationmgr.cxx @@ -135,14 +135,9 @@ static bool isLanguageDependentProperty( std::u16string_view aName ) void LocalizationMgr::implEnableDisableResourceForAllLibraryDialogs( HandleResourceMode eMode ) { - Sequence< OUString > aDlgNames = m_aDocument.getObjectNames( E_DIALOGS, m_aLibName ); - sal_Int32 nDlgCount = aDlgNames.getLength(); - const OUString* pDlgNames = aDlgNames.getConstArray(); - Reference< XStringResourceResolver > xDummyStringResolver; - for( sal_Int32 i = 0 ; i < nDlgCount ; i++ ) + for (auto& aDlgName : m_aDocument.getObjectNames(E_DIALOGS, m_aLibName)) -e ... etc. - the rest is truncated