summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorVaibhavMalik4187 <vaibhavmalik2018@gmail.com>2022-02-04 17:36:52 +0530
committerHossein <hossein@libreoffice.org>2022-02-06 21:38:32 +0100
commit8b327cd86d71d71d2f5f883321e5d53e3b42ed4e (patch)
tree1385e7eb779abd43508048850b688ef8e4650c9b /basic
parent6bbc2eba29389bf7937ab5fd08b62821cbd56a97 (diff)
tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macro
Change-Id: I4f5258ca5b37e9b1b4237c5d29e4a9e5362fa855 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129116 Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'basic')
-rw-r--r--basic/qa/cppunit/test_vba.cxx4
-rw-r--r--basic/source/runtime/methods.cxx2
-rw-r--r--basic/source/runtime/methods1.cxx14
3 files changed, 10 insertions, 10 deletions
diff --git a/basic/qa/cppunit/test_vba.cxx b/basic/qa/cppunit/test_vba.cxx
index 818ba1c5f4c0..868dc15891e3 100644
--- a/basic/qa/cppunit/test_vba.cxx
+++ b/basic/qa/cppunit/test_vba.cxx
@@ -157,7 +157,7 @@ void VBATest::testMiscVBAFunctions()
SvtSysLocaleOptions aLocalOptions;
aLocalOptions.SetLocaleConfigString( aLocale.getBcp47() );
- for ( size_t i=0; i<SAL_N_ELEMENTS( macroSource ); ++i )
+ for ( size_t i=0; i<std::size( macroSource ); ++i )
{
OUString sMacroURL = sMacroPathURL
+ OUString::createFromAscii( macroSource[ i ] );
@@ -238,7 +238,7 @@ void VBATest::testMiscOLEStuff()
uno::makeAny(OUString(o3tl::toU(pODBCDriverName)))
};
- for ( sal_uInt32 i=0; i<SAL_N_ELEMENTS( macroSource ); ++i )
+ for ( sal_uInt32 i=0; i<std::size( macroSource ); ++i )
{
OUString sMacroURL = sMacroPathURL
+ OUString::createFromAscii( macroSource[ i ] );
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 7113e6e34f4c..3839d84852ea 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -3734,7 +3734,7 @@ OUString getBasicTypeName( SbxDataType eType )
};
size_t nPos = static_cast<size_t>(eType) & 0x0FFF;
- const size_t nTypeNameCount = SAL_N_ELEMENTS( pTypeNames );
+ const size_t nTypeNameCount = std::size( pTypeNames );
if ( nPos >= nTypeNameCount )
{
nPos = nTypeNameCount - 1;
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index 16104540ba96..31943cde2b80 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -1807,13 +1807,13 @@ static IntervalInfo const * getIntervalInfo( const OUString& rStringCode )
{ INTERVAL_N, "n", 1.0 / 1440.0, true }, // Minute
{ INTERVAL_S, "s", 1.0 / 86400.0, true } // Second
};
- for( std::size_t i = 0; i != SAL_N_ELEMENTS(aIntervalTable); ++i )
- {
- if( rStringCode.equalsIgnoreAsciiCaseAscii(
- aIntervalTable[i].mStringCode ) )
- {
- return &aIntervalTable[i];
- }
+ auto const pred = [&rStringCode](const IntervalInfo &aInterval) {
+ return rStringCode.equalsIgnoreAsciiCaseAscii(aInterval.mStringCode);
+ };
+
+ auto intervalIter = std::find_if(std::begin(aIntervalTable), std::end(aIntervalTable), pred);
+ if(intervalIter != std::end(aIntervalTable)) {
+ return intervalIter;
}
return nullptr;
}