From ec8c98f59869bee0e327d32f39480a0e4b1330bc Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 14 Jun 2017 11:31:15 +0200 Subject: use more SAL_N_ELEMENTS part 3 Change-Id: I82e366fefd2e31928b99840fe76649cc3521e623 Reviewed-on: https://gerrit.libreoffice.org/38789 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- jvmfwk/plugins/sunmajor/pluginlib/gnujre.cxx | 4 ++-- jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx | 6 +++--- jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx | 12 ++++++------ jvmfwk/plugins/sunmajor/pluginlib/util.cxx | 6 +++--- jvmfwk/plugins/sunmajor/pluginlib/vendorlist.cxx | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) (limited to 'jvmfwk') diff --git a/jvmfwk/plugins/sunmajor/pluginlib/gnujre.cxx b/jvmfwk/plugins/sunmajor/pluginlib/gnujre.cxx index 1750696ab018..d7bf982e4fc1 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/gnujre.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/gnujre.cxx @@ -47,7 +47,7 @@ char const* const* GnuInfo::getJavaExePaths(int * size) "gij-4.1", "bin/gij-4.1" }; - *size = sizeof (ar) / sizeof (char*); + *size = SAL_N_ELEMENTS (ar); return ar; } @@ -82,7 +82,7 @@ char const* const* GnuInfo::getRuntimePaths(int * size) "/libgcj.so.7", "/libgcj.so.6" }; - *size = sizeof(ar) / sizeof (char*); + *size = SAL_N_ELEMENTS(ar); return ar; } diff --git a/jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx b/jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx index 1de6afd210b6..8407e3be53e7 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx @@ -44,7 +44,7 @@ char const* const* OtherInfo::getJavaExePaths(int * size) "jre/bin/java" #endif }; - *size = sizeof (ar) / sizeof (char*); + *size = SAL_N_ELEMENTS (ar); return ar; } @@ -72,7 +72,7 @@ char const* const* OtherInfo::getRuntimePaths(int * size) #endif }; - *size = sizeof(ar) / sizeof (char*); + *size = SAL_N_ELEMENTS(ar); return ar; } @@ -94,7 +94,7 @@ char const* const* OtherInfo::getLibraryPaths(int* size) "/lib/" JFW_PLUGIN_ARCH }; - *size = sizeof(ar) / sizeof (char*); + *size = SAL_N_ELEMENTS(ar); return ar; #else *size = 0; diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx index 85f31a383fc6..9646ba3a6f87 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx @@ -322,24 +322,24 @@ SelfTest::SelfTest() { bool bRet = true; - char const * versions[] = {"1.4.0", "1.4.1", "1.0.0", "10.0.0", "10.10.0", + static char const * versions[] = {"1.4.0", "1.4.1", "1.0.0", "10.0.0", "10.10.0", "10.2.2", "10.10.0", "10.10.10", "111.0.999", "1.4.1_01", "9.90.99_09", "1.4.1_99", "1.4.1_00a", "1.4.1-ea", "1.4.1-beta", "1.4.1-rc1", "1.5.0_01-ea", "1.5.0_01-rc2"}; - char const * badVersions[] = {".4.0", "..1", "", "10.0", "10.10.0.", "10.10.0-", "10.10.0.", + static char const * badVersions[] = {".4.0", "..1", "", "10.0", "10.10.0.", "10.10.0-", "10.10.0.", "10.2-2", "10_10.0", "10..10","10.10", "a.0.999", "1.4b.1_01", "9.90.-99_09", "1.4.1_99-", "1.4.1_00a2", "1.4.0_z01z", "1.4.1__99A", "1.4.1-1ea", "1.5.0_010", "1.5.0._01-", "1.5.0_01-eac"}; - char const * orderedVer[] = { "1.3.1-ea", "1.3.1-beta", "1.3.1-rc1", + static char const * orderedVer[] = { "1.3.1-ea", "1.3.1-beta", "1.3.1-rc1", "1.3.1", "1.3.1_00a", "1.3.1_01", "1.3.1_01a", "1.3.2", "1.4.0", "1.5.0_01-ea", "2.0.0"}; - int num = sizeof (versions) / sizeof(char*); - int numBad = sizeof (badVersions) / sizeof(char*); - int numOrdered = sizeof (orderedVer) / sizeof(char*); + int num = SAL_N_ELEMENTS (versions); + int numBad = SAL_N_ELEMENTS (badVersions); + int numOrdered = SAL_N_ELEMENTS (orderedVer); //parsing test (positive) for (int i = 0; i < num; i++) { diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx index 281af044c6e1..5e3c8f58494a 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx @@ -1217,21 +1217,21 @@ void addJavaInfosDirScan( #else // MACOSX OUString excMessage = "[Java framework] sunjavaplugin: " "Error in function addJavaInfosDirScan in util.cxx."; - int cJavaNames= sizeof(g_arJavaNames) / sizeof(char*); + int cJavaNames= SAL_N_ELEMENTS(g_arJavaNames); std::unique_ptr sarJavaNames(new OUString[cJavaNames]); OUString *arNames = sarJavaNames.get(); for(int i= 0; i < cJavaNames; i++) arNames[i] = OUString(g_arJavaNames[i], strlen(g_arJavaNames[i]), RTL_TEXTENCODING_UTF8); - int cSearchPaths= sizeof(g_arSearchPaths) / sizeof(char*); + int cSearchPaths= SAL_N_ELEMENTS(g_arSearchPaths); std::unique_ptr sarPathNames(new OUString[cSearchPaths]); OUString *arPaths = sarPathNames.get(); for(int c = 0; c < cSearchPaths; c++) arPaths[c] = OUString(g_arSearchPaths[c], strlen(g_arSearchPaths[c]), RTL_TEXTENCODING_UTF8); - int cCollectDirs = sizeof(g_arCollectDirs) / sizeof(char*); + int cCollectDirs = SAL_N_ELEMENTS(g_arCollectDirs); std::unique_ptr sarCollectDirs(new OUString[cCollectDirs]); OUString *arCollectDirs = sarCollectDirs.get(); for(int d = 0; d < cCollectDirs; d++) diff --git a/jvmfwk/plugins/sunmajor/pluginlib/vendorlist.cxx b/jvmfwk/plugins/sunmajor/pluginlib/vendorlist.cxx index a08b237b62cd..104b69508209 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/vendorlist.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/vendorlist.cxx @@ -54,7 +54,7 @@ END_VENDOR_MAP() bool isVendorSupported(const OUString& sVendor) { - const size_t count = sizeof(gVendorMap) / sizeof (VendorSupportMapEntry) - 1; + const size_t count = SAL_N_ELEMENTS(gVendorMap) - 1; for ( size_t pos = 0; pos < count; ++pos ) { if (sVendor.equalsAscii(gVendorMap[pos].sVendorName)) -- cgit v1.2.3