diff options
author | Radhey Parekh <radhey.parekh@gmail.com> | 2022-08-22 18:13:15 +0530 |
---|---|---|
committer | Hossein <hossein@libreoffice.org> | 2022-09-06 02:26:36 +0200 |
commit | feb8d07333544ff2206489b786b7af30744d014a (patch) | |
tree | 390a8598ac73faf539a90c9b912b6c7d1c31a635 | |
parent | 540a312af2f02108ea90f5d2a9f3bf573db622e5 (diff) |
tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macro
Change-Id: Ic9009eda963f922fc4d2e75a5002026eda63a7aa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138686
Tested-by: Jenkins
Reviewed-by: Hossein <hossein@libreoffice.org>
-rw-r--r-- | libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx | 12 | ||||
-rw-r--r-- | oox/source/drawingml/textbodypropertiescontext.cxx | 2 | ||||
-rw-r--r-- | oox/source/ole/olehelper.cxx | 2 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_sort.cxx | 8 |
4 files changed, 12 insertions, 12 deletions
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx index bb0e7edd390d..973e2095275a 100644 --- a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx @@ -377,11 +377,11 @@ void changeZoom( GtkWidget* pButton, gpointer /* pItem */ ) if ( strcmp(sName, "zoom-in-symbolic") == 0) { - for ( size_t i = 0; i < SAL_N_ELEMENTS( fZooms ); i++ ) + for ( const auto& i : fZooms ) { - if ( fCurrentZoom < fZooms[i] ) + if ( fCurrentZoom < i ) { - fZoom = fZooms[i]; + fZoom = i; break; } } @@ -392,11 +392,11 @@ void changeZoom( GtkWidget* pButton, gpointer /* pItem */ ) } else if ( strcmp(sName, "zoom-out-symbolic") == 0) { - for ( size_t i = 0; i < SAL_N_ELEMENTS( fZooms ); i++ ) + for ( const auto& i : fZooms ) { - if ( fCurrentZoom > fZooms[i] ) + if ( fCurrentZoom > i ) { - fZoom = fZooms[i]; + fZoom = i; } } } diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx index bf2feb132e0a..8b1c6db6a791 100644 --- a/oox/source/drawingml/textbodypropertiescontext.cxx +++ b/oox/source/drawingml/textbodypropertiescontext.cxx @@ -66,7 +66,7 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler2Helper cons // ST_Coordinate OUString sValue; sal_Int32 aIns[] = { XML_lIns, XML_tIns, XML_rIns, XML_bIns }; - for( sal_Int32 i = 0; i < sal_Int32(SAL_N_ELEMENTS( aIns )); i++) + for( sal_Int32 i = 0; i < sal_Int32(std::size( aIns )); i++) { sValue = rAttribs.getStringDefaulted( aIns[i] ); if( !sValue.isEmpty() ) diff --git a/oox/source/ole/olehelper.cxx b/oox/source/ole/olehelper.cxx index f3f73b52f5ed..d953cf17f9da 100644 --- a/oox/source/ole/olehelper.cxx +++ b/oox/source/ole/olehelper.cxx @@ -172,7 +172,7 @@ classIdToGUIDCNamePairMap::classIdToGUIDCNamePairMap() { AX_GUID_SCROLLBAR, "ScrollBar"}, } }; - int const length = SAL_N_ELEMENTS( initialCntrlData ); + int const length = std::size( initialCntrlData ); IdCntrlData const * pData = initialCntrlData; for ( int index = 0; index < length; ++index, ++pData ) mnIdToGUIDCNamePairMap[ pData->nId ] = pData->aData; diff --git a/sc/qa/unit/ucalc_sort.cxx b/sc/qa/unit/ucalc_sort.cxx index 0f0218753403..21b734d1d37c 100644 --- a/sc/qa/unit/ucalc_sort.cxx +++ b/sc/qa/unit/ucalc_sort.cxx @@ -487,7 +487,7 @@ void TestSort::testSortWithFormulaRefs() m_pDoc->SetString( 0, i, 0, OUString::createFromAscii(aTextData[i-1]) ); // Insert formulas in A1:A6 on the 2nd sheet. - for (size_t i = 0; i < SAL_N_ELEMENTS(aFormulaData); ++i) + for (size_t i = 0; i < std::size(aFormulaData); ++i) m_pDoc->SetString( 0, i, 1, OUString::createFromAscii(aFormulaData[i]) ); // Sort data in A2:A8 on the 1st sheet. No column header. @@ -501,7 +501,7 @@ void TestSort::testSortWithFormulaRefs() m_pDoc->Sort(0, aSortData, false, true, nullptr, nullptr); - for (size_t i = 0; i < SAL_N_ELEMENTS(aResults); ++i) + for (size_t i = 0; i < std::size(aResults); ++i) { OUString sResult = m_pDoc->GetString(0, i + 1, 0); CPPUNIT_ASSERT_EQUAL( OUString::createFromAscii( aResults[i] ), sResult ); @@ -602,7 +602,7 @@ void TestSort::testSortInFormulaGroup() 104.0, 104.0 }; - for ( SCROW i = 0; i < SCROW(SAL_N_ELEMENTS( aEntries )); ++i ) + for ( SCROW i = 0; i < SCROW(std::size( aEntries )); ++i ) { double val = m_pDoc->GetValue( aEntries[i].nCol, aEntries[i].nRow, 0 ); CPPUNIT_ASSERT_MESSAGE("Mis-matching value after sort.", @@ -790,7 +790,7 @@ void TestSort::testSortRefUpdate() m_pDoc->SetString(ScAddress(0,0,0), "Header"); double aValues[] = { 4.0, 36.0, 14.0, 29.0, 98.0, 78.0, 0.0, 99.0, 1.0 }; - size_t nCount = SAL_N_ELEMENTS(aValues); + size_t nCount = std::size(aValues); for (size_t i = 0; i < nCount; ++i) m_pDoc->SetValue(ScAddress(0,i+1,0), aValues[i]); |