cui/source/dialogs/toolbarmodedlg.cxx   |    4 ++--
 reportdesign/source/ui/dlg/AddField.cxx |    8 ++++----
 sax/qa/cppunit/xmlimport.cxx            |   10 +++++-----
 sc/qa/unit/helper/shared_test_impl.hxx  |    8 ++++----
 4 files changed, 15 insertions(+), 15 deletions(-)

New commits:
commit 51fb84829afbc1c0957fd1a489085613ad199f1a
Author:     Gautham Krishnan <gauthamkrishnanpr...@gmail.com>
AuthorDate: Tue Mar 1 12:04:38 2022 +0530
Commit:     Hossein <hoss...@libreoffice.org>
CommitDate: Thu Mar 10 00:40:02 2022 +0100

    tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macro
    
    Change-Id: If35c679839b39a01e474f7b0b0abee570e85bdd7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130798
    Tested-by: Jenkins
    Reviewed-by: Hossein <hoss...@libreoffice.org>

diff --git a/cui/source/dialogs/toolbarmodedlg.cxx 
b/cui/source/dialogs/toolbarmodedlg.cxx
index c4c4d347b58a..3d3594e8cde9 100644
--- a/cui/source/dialogs/toolbarmodedlg.cxx
+++ b/cui/source/dialogs/toolbarmodedlg.cxx
@@ -101,7 +101,7 @@ ToolbarmodeDialog::ToolbarmodeDialog(weld::Window* pParent)
     Link<weld::Toggleable&, void> aLink = LINK(this, ToolbarmodeDialog, 
SelectToolbarmode);
 
     const OUString sCurrentMode = GetCurrentMode();
-    for (tools::ULong i = 0; i < SAL_N_ELEMENTS(m_pRadioButtons); i++)
+    for (tools::ULong i = 0; i < std::size(m_pRadioButtons); i++)
     {
         m_pRadioButtons[i]->connect_toggled(aLink);
         if (sCurrentMode == std::get<1>(TOOLBARMODES_ARRAY[i]))
@@ -133,7 +133,7 @@ static bool file_exists(const OUString& fileName)
 
 int ToolbarmodeDialog::GetActiveRadioButton()
 {
-    for (tools::ULong i = 0; i < SAL_N_ELEMENTS(m_pRadioButtons); i++)
+    for (tools::ULong i = 0; i < std::size(m_pRadioButtons); i++)
     {
         if (m_pRadioButtons[i]->get_active())
             return i;
diff --git a/reportdesign/source/ui/dlg/AddField.cxx 
b/reportdesign/source/ui/dlg/AddField.cxx
index e3e1fb3a71ea..6bf3cd1f0759 100644
--- a/reportdesign/source/ui/dlg/AddField.cxx
+++ b/reportdesign/source/ui/dlg/AddField.cxx
@@ -189,7 +189,7 @@ void OAddFieldWindow::Update()
         m_xListBox->clear();
         m_aListBoxData.clear();
         const OString aIds[] = { "up", "down" };
-        for (size_t j = 0; j< SAL_N_ELEMENTS(aIds); ++j)
+        for (size_t j = 0; j< std::size(aIds); ++j)
             m_xActions->set_item_sensitive(aIds[j], false);
 
         OUString aTitle(RptResId(RID_STR_FIELDSELECTION));
@@ -233,7 +233,7 @@ void OAddFieldWindow::Update()
             m_xDialog->set_title(aTitle);
             if ( !m_aCommandName.isEmpty() )
             {
-                for (size_t i = 0; i < SAL_N_ELEMENTS(aIds); ++i)
+                for (size_t i = 0; i < std::size(aIds); ++i)
                     m_xActions->set_item_sensitive(aIds[i], true);
             }
             OnSelectHdl(*m_xListBox);
@@ -331,7 +331,7 @@ IMPL_LINK(OAddFieldWindow, OnSortAction, const OString&, 
rCurItem, void)
 
     if (rCurItem == "delete")
     {
-        for (size_t j = 0; j< SAL_N_ELEMENTS(aIds); ++j)
+        for (size_t j = 0; j< std::size(aIds); ++j)
             m_xActions->set_item_active(aIds[j], false);
 
         m_xListBox->make_unsorted();
@@ -339,7 +339,7 @@ IMPL_LINK(OAddFieldWindow, OnSortAction, const OString&, 
rCurItem, void)
         return;
     }
 
-    for (size_t j = 0; j< SAL_N_ELEMENTS(aIds); ++j)
+    for (size_t j = 0; j< std::size(aIds); ++j)
         m_xActions->set_item_active(aIds[j], rCurItem == aIds[j]);
 
     m_xListBox->make_sorted();
diff --git a/sax/qa/cppunit/xmlimport.cxx b/sax/qa/cppunit/xmlimport.cxx
index fcf839609cac..1eb872d50585 100644
--- a/sax/qa/cppunit/xmlimport.cxx
+++ b/sax/qa/cppunit/xmlimport.cxx
@@ -288,13 +288,13 @@ Sequence< sal_Int8 > 
DummyTokenHandler::getUTF8Identifier( sal_Int32 nToken )
     if ( ( nToken & 0xffff0000 ) != 0 ) //namespace
     {
         sal_uInt32 nNamespaceToken = ( nToken >> 16 ) - 1;
-        if ( nNamespaceToken < SAL_N_ELEMENTS(namespacePrefixes) )
+        if ( nNamespaceToken < std::size(namespacePrefixes) )
             aUtf8Token = namespacePrefixes[ nNamespaceToken ];
     }
     else //element or attribute
     {
         size_t nElementToken = nToken & 0xffff;
-        if ( nElementToken < SAL_N_ELEMENTS(tokens) )
+        if ( nElementToken < std::size(tokens) )
             aUtf8Token = tokens[ nElementToken ];
     }
     Sequence< sal_Int8 > aSeq( reinterpret_cast< const sal_Int8* >(
@@ -311,7 +311,7 @@ sal_Int32 DummyTokenHandler::getTokenFromUTF8( const 
uno::Sequence< sal_Int8 >&
 sal_Int32 DummyTokenHandler::getTokenDirect( const char* pToken, sal_Int32 
nLength ) const
 {
     std::string_view sToken( pToken, nLength );
-    for( size_t  i = 0; i < SAL_N_ELEMENTS(tokens); i++ )
+    for( size_t  i = 0; i < std::size(tokens); i++ )
     {
         if ( tokens[i] == sToken )
             return static_cast<sal_Int32>(i);
@@ -380,7 +380,7 @@ void XMLImportTest::parse()
                             "multiplens.xml", "multiplepfx.xml",
                             "nstoattributes.xml", "nestedns.xml", 
"testthreading.xml"};
 
-    for (size_t i = 0; i < SAL_N_ELEMENTS( fileNames ); i++)
+    for (size_t i = 0; i < std::size( fileNames ); i++)
     {
         InputSource source;
         source.sSystemId    = "internal";
@@ -407,7 +407,7 @@ void XMLImportTest::testMissingNamespaceDeclaration()
                             uno::UNO_QUERY_THROW);
     xInit->initialize({ uno::Any(OUString("IgnoreMissingNSDecl")) });
 
-    for (sal_uInt16 i = 0; i < SAL_N_ELEMENTS( fileNames ); i++)
+    for (sal_uInt16 i = 0; i < std::size( fileNames ); i++)
     {
         try
         {
diff --git a/sc/qa/unit/helper/shared_test_impl.hxx 
b/sc/qa/unit/helper/shared_test_impl.hxx
index 617d63931870..60aa4ae41571 100644
--- a/sc/qa/unit/helper/shared_test_impl.hxx
+++ b/sc/qa/unit/helper/shared_test_impl.hxx
@@ -55,7 +55,7 @@ void testDataBar_Impl(const ScDocument& rDoc)
     ScConditionalFormatList* pList = rDoc.GetCondFormList(0);
     CPPUNIT_ASSERT(pList);
 
-    for(size_t i = 0; i < SAL_N_ELEMENTS(aData); ++i)
+    for(size_t i = 0; i < std::size(aData); ++i)
     {
         ScConditionalFormatList::const_iterator itr = 
std::find_if(pList->begin(),
                 pList->end(), FindCondFormatByEnclosingRange(aData[i].aRange));
@@ -92,7 +92,7 @@ void testColorScale2Entry_Impl(const ScDocument& rDoc)
     const ScConditionalFormatList* pList = rDoc.GetCondFormList(0);
     CPPUNIT_ASSERT(pList);
 
-    for(size_t i = 0; i < SAL_N_ELEMENTS(aData2Entry); ++i)
+    for(size_t i = 0; i < std::size(aData2Entry); ++i)
     {
         ScConditionalFormatList::const_iterator itr = 
std::find_if(pList->begin(),
                             pList->end(), 
FindCondFormatByEnclosingRange(aData2Entry[i].aRange));
@@ -131,7 +131,7 @@ void testColorScale3Entry_Impl(const ScDocument& rDoc)
     ScConditionalFormatList* pList = rDoc.GetCondFormList(1);
     CPPUNIT_ASSERT(pList);
 
-    for(size_t i = 0; i < SAL_N_ELEMENTS(aData3Entry); ++i)
+    for(size_t i = 0; i < std::size(aData3Entry); ++i)
     {
         ScConditionalFormatList::const_iterator itr = 
std::find_if(pList->begin(),
                             pList->end(), 
FindCondFormatByEnclosingRange(aData3Entry[i].aRange));
@@ -244,7 +244,7 @@ void testFunctionsExcel2010_Impl( ScDocument& rDoc )
         { 80, true  }
     };
 
-    for (size_t i=0; i < SAL_N_ELEMENTS(aTests); ++i)
+    for (size_t i=0; i < std::size(aTests); ++i)
     {
         if (aTests[i].bEvaluate)
         {

Reply via email to