diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-14 10:46:05 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-14 15:14:27 +0200 |
commit | 546c35519125a769755330c961c7b8fc61e24d89 (patch) | |
tree | 0b73735081bd279b89b93dabc5c35dee6ec08b94 /sal/qa | |
parent | Avoid use of FormulaTokenArray::First() and Next() in another place (diff) | |
download | core-546c35519125a769755330c961c7b8fc61e24d89.tar.gz core-546c35519125a769755330c961c7b8fc61e24d89.zip |
use more SAL_N_ELEMENTS part 2
Change-Id: If00e371c3cd3ae616309a172c875faed016e391b
Reviewed-on: https://gerrit.libreoffice.org/38773
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sal/qa')
-rw-r--r-- | sal/qa/rtl/digest/rtl_digest.cxx | 19 | ||||
-rw-r--r-- | sal/qa/rtl/oustring/rtl_OUString2.cxx | 4 | ||||
-rw-r--r-- | sal/qa/rtl/textenc/rtl_textcvt.cxx | 2 | ||||
-rw-r--r-- | sal/qa/rtl/uri/rtl_testuri.cxx | 3 |
4 files changed, 10 insertions, 18 deletions
diff --git a/sal/qa/rtl/digest/rtl_digest.cxx b/sal/qa/rtl/digest/rtl_digest.cxx index b61ce9be3fcd..f5c088b6c3ad 100644 --- a/sal/qa/rtl/digest/rtl_digest.cxx +++ b/sal/qa/rtl/digest/rtl_digest.cxx @@ -109,9 +109,7 @@ class DigestTest : public CppUnit::TestFixture public: void testCreate() { - int aAlgorithmSize = sizeof(constDigestAlgorithms) / sizeof(constDigestAlgorithms[0]); - - for (int i = 0; i < aAlgorithmSize; i++) + for (size_t i = 0; i < SAL_N_ELEMENTS(constDigestAlgorithms); i++) { rtlDigest handle = rtl_digest_create( constDigestAlgorithms[i] ); CPPUNIT_ASSERT_MESSAGE("create digest", handle != nullptr); @@ -125,9 +123,7 @@ public: void testQuery() { - int aAlgorithmSize = sizeof(constDigestAlgorithms) / sizeof(constDigestAlgorithms[0]); - - for (int i = 0; i < aAlgorithmSize; i++) + for (size_t i = 0; i < SAL_N_ELEMENTS(constDigestAlgorithms); i++) { rtlDigest handle = rtl_digest_create(constDigestAlgorithms[i]); rtlDigestAlgorithm aAlgo = rtl_digest_queryAlgorithm(handle); @@ -139,11 +135,10 @@ public: void testQueryLength() { - int aAlgorithmSize = sizeof(constDigestAlgorithms) / sizeof(constDigestAlgorithms[0]); rtlDigest handle; sal_uInt32 nAlgoLength; - for (int i = 0; i < aAlgorithmSize; i++) + for (size_t i = 0; i < SAL_N_ELEMENTS(constDigestAlgorithms); i++) { handle = rtl_digest_create(constDigestAlgorithms[i]); nAlgoLength = rtl_digest_queryLength(handle); @@ -171,9 +166,7 @@ public: CPPUNIT_ASSERT_EQUAL_MESSAGE("init(handle, 0, 0)", rtl_Digest_E_None, aError); rtl_digest_destroy( handle ); - int aAlgorithmSize = sizeof(constDigestAlgorithms) / sizeof(constDigestAlgorithms[0]); - - for (int i = 0; i < aAlgorithmSize; i++) + for (size_t i = 0; i < SAL_N_ELEMENTS(constDigestAlgorithms); i++) { handle = rtl_digest_create(constDigestAlgorithms[i]); @@ -223,9 +216,7 @@ public: void testCheckSum() { - int aAlgorithmSize = sizeof(constDigestAlgorithms) / sizeof(constDigestAlgorithms[0]); - - for (int i = 0; i < aAlgorithmSize; i++) + for (size_t i = 0; i < SAL_N_ELEMENTS(constDigestAlgorithms); i++) { OString aSum = getDigest(sSampleString, constDigestAlgorithms[i]); CPPUNIT_ASSERT_EQUAL_MESSAGE("Checksum of sample string is wrong.", constSampleStringSums[i], aSum); diff --git a/sal/qa/rtl/oustring/rtl_OUString2.cxx b/sal/qa/rtl/oustring/rtl_OUString2.cxx index 15748fcf8d2f..c345bc31b8bb 100644 --- a/sal/qa/rtl/oustring/rtl_OUString2.cxx +++ b/sal/qa/rtl/oustring/rtl_OUString2.cxx @@ -987,7 +987,7 @@ void createFromCodePoints::test() { sal_Int32(0), rtl::OUString(static_cast< sal_uInt32 const * >(nullptr), 0).getLength()); static sal_uInt32 const cp[] = { 0, 0xD800, 0xFFFF, 0x10000, 0x10FFFF }; - rtl::OUString s(cp, sizeof cp / sizeof (sal_uInt32)); + rtl::OUString s(cp, SAL_N_ELEMENTS(cp)); CPPUNIT_ASSERT_EQUAL(sal_Int32(7), s.getLength()); CPPUNIT_ASSERT_EQUAL(u'\0', s[0]); CPPUNIT_ASSERT_EQUAL(u'\xD800', s[1]); @@ -1010,7 +1010,7 @@ public: void iterateCodePoints::testNotWellFormed() { static sal_Unicode const utf16[] = { 0xD800, 0xDC00, 0x0041, 0xDBFF, 0xDFFF, 0xDDEF, 0xD9AB }; - rtl::OUString s(utf16, sizeof utf16 / sizeof (sal_Unicode)); + rtl::OUString s(utf16, SAL_N_ELEMENTS(utf16)); sal_Int32 i = 0; CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x10000), s.iterateCodePoints(&i)); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), i); diff --git a/sal/qa/rtl/textenc/rtl_textcvt.cxx b/sal/qa/rtl/textenc/rtl_textcvt.cxx index c9d7e5f08117..34e5208ae890 100644 --- a/sal/qa/rtl/textenc/rtl_textcvt.cxx +++ b/sal/qa/rtl/textenc/rtl_textcvt.cxx @@ -2678,7 +2678,7 @@ void Test::testSRCBUFFERTOSMALL() { CPPUNIT_ASSERT_EQUAL( sal_Size(0), rtl_convertTextToUnicode( - cv, cx, &src, 1, dst, sizeof dst / sizeof (sal_Unicode), + cv, cx, &src, 1, dst, SAL_N_ELEMENTS(dst), (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR | RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR), diff --git a/sal/qa/rtl/uri/rtl_testuri.cxx b/sal/qa/rtl/uri/rtl_testuri.cxx index e60797731d2f..ac0728413b1d 100644 --- a/sal/qa/rtl/uri/rtl_testuri.cxx +++ b/sal/qa/rtl/uri/rtl_testuri.cxx @@ -335,7 +335,8 @@ void Test::test_Uri() { { "http://a/b/c", "d", "http://a/b/d" }, { "http://a/b/c/", "d", "http://a/b/c/d" }, { "http://a/b/c//", "d", "http://a/b/c//d" } }; - for (std::size_t i = 0; i < sizeof aRelToAbsTest / sizeof (RelToAbsTest); ++i) + + for (std::size_t i = 0; i < SAL_N_ELEMENTS(aRelToAbsTest); ++i) { rtl::OUString aAbs; bool bMalformed = false; |