tdf#147021 Replace SAL_N_ELEMENTS with std::size
As part of the efforts in #145538 to replace the SAL_N_ELEMENTS()
macro with std::size() and std::ssize(), this commit performs the
necessary changes for a few files in the i18npool module.
Change-Id: Ic64be31b74cd74faf17497a47d6a15158b85184c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166013
Tested-by: Jenkins
Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx
index 4463f46..0f2629f 100644
--- a/i18npool/qa/cppunit/test_breakiterator.cxx
+++ b/i18npool/qa/cppunit/test_breakiterator.cxx
@@ -368,7 +368,7 @@ void TestBreakIterator::testWordBoundaries()
}
const sal_Int32 aSinglePositions[] = {0, 1, 3, 4, 6, 7, 9, 10};
for (size_t j = 1; j < SAL_N_ELEMENTS(aTests); ++j)
for (size_t j = 1; j < std::size(aTests); ++j)
{
OUString aTest = aBase.replaceAll("xx", OUStringChar(aTests[j]));
sal_Int32 nPos = -1;
diff --git a/i18npool/source/nativenumber/nativenumbersupplier.cxx b/i18npool/source/nativenumber/nativenumbersupplier.cxx
index f57cc20..57e2355 100644
--- a/i18npool/source/nativenumber/nativenumbersupplier.cxx
+++ b/i18npool/source/nativenumber/nativenumbersupplier.cxx
@@ -668,7 +668,7 @@ OUString NativeNumberSupplierService::getNativeNumberString(const OUString& aNum
std::size_t nStripCase = 0;
size_t nCasing;
for (nCasing = 0; nCasing < SAL_N_ELEMENTS(Casings); ++nCasing)
for (nCasing = 0; nCasing < std::size(Casings); ++nCasing)
{
if (o3tl::starts_with(rNativeNumberParams, Casings[nCasing].aLiteral))
{
@@ -1064,7 +1064,7 @@ static void makeHebrewNumber(sal_Int64 value, OUStringBuffer& output, bool isLas
output.append(value == 1000 ? thousand : isLast ? thousands_last : thousands);
} else {
sal_Int16 nbOfChar = 0;
for (sal_Int32 j = 0; num > 0 && j < sal_Int32(SAL_N_ELEMENTS(HebrewNumberCharArray)); j++) {
for (sal_Int32 j = 0; num > 0 && j < sal_Int32(std::size(HebrewNumberCharArray)); j++) {
if (num - HebrewNumberCharArray[j].value >= 0) {
nbOfChar++;
// https://en.wikipedia.org/wiki/Hebrew_numerals#Key_exceptions
@@ -1177,7 +1177,7 @@ static void makeCyrillicNumber(sal_Int64 value, OUStringBuffer& output, bool add
addTitlo = false;
}
for (sal_Int32 j = 0; num > 0 && j < sal_Int32(SAL_N_ELEMENTS(CyrillicNumberCharArray)); j++) {
for (sal_Int32 j = 0; num > 0 && j < sal_Int32(std::size(CyrillicNumberCharArray)); j++) {
if (num < 20 && num > 10) {
num -= 10;
makeCyrillicNumber(num, output, false);