tdf#147021 - Use std::size() instead of SAL_N_ELEMENTS() macro

Change-Id: I2495fa1ad081ad75bd8e79a22bdeaa97217aa398
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177581
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Tested-by: Jenkins
This commit is contained in:
Rosh 2024-11-29 22:03:49 -08:00 committed by Ilmari Lauhakangas
parent 5a42e163cd
commit 71ec40df42

View file

@ -46,7 +46,7 @@ namespace
{
char foo[] = "foo";
std::istringstream iss(foo, std::istringstream::in);
SvMemoryStream aMemStream(foo, SAL_N_ELEMENTS(foo)-1, StreamMode::READ);
SvMemoryStream aMemStream(foo, std::size(foo)-1, StreamMode::READ);
char std_a(78);
iss >> std_a;
@ -137,7 +137,7 @@ namespace
void Test::test_fastostring()
{
char foo[] = "foobar";
SvMemoryStream aMemStream(foo, SAL_N_ELEMENTS(foo)-1, StreamMode::READ);
SvMemoryStream aMemStream(foo, std::size(foo)-1, StreamMode::READ);
OString aOne = read_uInt8s_ToOString(aMemStream, 3);
CPPUNIT_ASSERT_EQUAL("foo"_ostr, aOne);
@ -157,7 +157,7 @@ namespace
void Test::test_read_cstring()
{
char foo[] = "foobar";
SvMemoryStream aMemStream(foo, SAL_N_ELEMENTS(foo)-1, StreamMode::READ);
SvMemoryStream aMemStream(foo, std::size(foo)-1, StreamMode::READ);
OString aOne = read_zeroTerminated_uInt8s_ToOString(aMemStream);
CPPUNIT_ASSERT_EQUAL("foobar"_ostr, aOne);
@ -175,7 +175,7 @@ namespace
void Test::test_read_pstring()
{
char foo[] = "\3foobar";
SvMemoryStream aMemStream(foo, SAL_N_ELEMENTS(foo)-1, StreamMode::READ);
SvMemoryStream aMemStream(foo, std::size(foo)-1, StreamMode::READ);
OString aFoo = read_uInt8_lenPrefixed_uInt8s_ToOString(aMemStream);
CPPUNIT_ASSERT_EQUAL("foo"_ostr, aFoo);
@ -205,7 +205,7 @@ namespace
void Test::test_readline()
{
char foo[] = "foo\nbar\n\n";
SvMemoryStream aMemStream(foo, SAL_N_ELEMENTS(foo)-1, StreamMode::READ);
SvMemoryStream aMemStream(foo, std::size(foo)-1, StreamMode::READ);
OString aFoo;
bool bRet;
@ -268,7 +268,7 @@ namespace
CPPUNIT_ASSERT(!iss.bad());
char bar[] = "foo";
SvMemoryStream aMemStreamB(bar, SAL_N_ELEMENTS(bar)-1, StreamMode::READ);
SvMemoryStream aMemStreamB(bar, std::size(bar)-1, StreamMode::READ);
bRet = aMemStreamB.ReadLine(aFoo);
CPPUNIT_ASSERT(bRet);
CPPUNIT_ASSERT_EQUAL("foo"_ostr, aFoo);