diff --git a/extensions/source/update/check/onlinecheck.cxx b/extensions/source/update/check/onlinecheck.cxx index af6ade879f40..ccfacc1b5932 100644 --- a/extensions/source/update/check/onlinecheck.cxx +++ b/extensions/source/update/check/onlinecheck.cxx @@ -18,7 +18,7 @@ */ #include -#include +#include #include "onlinecheck.hxx" @@ -36,7 +36,7 @@ extern "C" bool WNT_hasInternetConnection() bool fIsConnected = InternetGetConnectedStateExW( &dwFlags, szConnectionName, - SAL_N_ELEMENTS(szConnectionName), + std::size(szConnectionName), 0 ); return fIsConnected; diff --git a/extensions/source/update/check/updatecheckconfig.cxx b/extensions/source/update/check/updatecheckconfig.cxx index 718a33539523..52410d4b8242 100644 --- a/extensions/source/update/check/updatecheckconfig.cxx +++ b/extensions/source/update/check/updatecheckconfig.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -74,7 +75,7 @@ const char * const aUpdateEntryProperties[] = { OLD_VERSION }; -const sal_uInt32 nUpdateEntryProperties = SAL_N_ELEMENTS(aUpdateEntryProperties); +const sal_uInt32 nUpdateEntryProperties = static_cast(std::size(aUpdateEntryProperties)); css::uno::Any NamedValueByNameAccess::getValue(const char * pName) { diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx index 5cb2dd63eb91..5f91bbaa8a7c 100644 --- a/filter/source/config/cache/filtercache.cxx +++ b/filter/source/config/cache/filtercache.cxx @@ -82,7 +82,7 @@ FilterCache::FilterCache() css::uno::Sequence< OUString >(sStandardProps, 3); m_aStandardProps[E_READ_ALL] = css::uno::Sequence< OUString >(sStandardProps, - SAL_N_ELEMENTS(sStandardProps)); + std::size(sStandardProps)); i = 0; OUString sTypeProps[7]; @@ -103,7 +103,7 @@ FilterCache::FilterCache() css::uno::Sequence< OUString >(sTypeProps, 1); m_aTypeProps[E_READ_ALL] = css::uno::Sequence< OUString >(sTypeProps, - SAL_N_ELEMENTS(sTypeProps)); + std::size(sTypeProps)); } diff --git a/forms/source/solar/control/navtoolbar.cxx b/forms/source/solar/control/navtoolbar.cxx index f637ca3154d5..bb04c5aa36b7 100644 --- a/forms/source/solar/control/navtoolbar.cxx +++ b/forms/source/solar/control/navtoolbar.cxx @@ -29,11 +29,10 @@ #include +#include #include #include #include - -#include #include #include @@ -271,7 +270,7 @@ namespace frm }; FeatureDescription const * pSupportedFeatures = aSupportedFeatures; - FeatureDescription const * pSupportedFeaturesEnd = aSupportedFeatures + SAL_N_ELEMENTS( aSupportedFeatures ); + FeatureDescription const * pSupportedFeaturesEnd = aSupportedFeatures + std::size( aSupportedFeatures ); for ( ; pSupportedFeatures < pSupportedFeaturesEnd; ++pSupportedFeatures ) { if ( pSupportedFeatures->nId ) diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx index 8031d426b6e8..3d1bb161b595 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -577,7 +578,7 @@ static void do_msvcr_magic(OUString const &jvm_dll) }; char const* importName = reinterpret_cast(dos_hdr) + imports->Name + VAtoPhys; sal_Int32 importNameLen = rtl_str_getLength(importName); - for (size_t i = 0; i < SAL_N_ELEMENTS(msvcrts); ++i) + for (size_t i = 0; i < std::size(msvcrts); ++i) { if (0 == rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths( msvcrts[i].data(), msvcrts[i].size(), diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx index 995bda5084bf..6807f3574fc6 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -1162,21 +1163,21 @@ void addJavaInfosDirScan( #else // MACOSX OUString excMessage = u"[Java framework] sunjavaplugin: " "Error in function addJavaInfosDirScan in util.cxx."_ustr; - int cJavaNames= SAL_N_ELEMENTS(g_arJavaNames); + int cJavaNames = static_cast(std::size(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= SAL_N_ELEMENTS(g_arSearchPaths); + int cSearchPaths = static_cast(std::size(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 = SAL_N_ELEMENTS(g_arCollectDirs); + int cCollectDirs = static_cast(std::size(g_arCollectDirs)); std::unique_ptr sarCollectDirs(new OUString[cCollectDirs]); OUString *arCollectDirs = sarCollectDirs.get(); for(int d = 0; d < cCollectDirs; d++) diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx index 2a1c2e732f7f..73856747d71e 100644 --- a/scripting/source/vbaevents/eventhelper.cxx +++ b/scripting/source/vbaevents/eventhelper.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include #include @@ -255,7 +256,7 @@ static EventInfoHash& getEventTransInfo() EventInfoHash tmp; OUString sEventInfo; const TranslatePropMap* pTransProp = aTranslatePropMap_Impl; - int nCount = SAL_N_ELEMENTS(aTranslatePropMap_Impl); + int nCount = static_cast(std::size(aTranslatePropMap_Impl)); int i = 0; while (i < nCount) diff --git a/stoc/source/javaloader/javaloader.cxx b/stoc/source/javaloader/javaloader.cxx index ff64ca45a330..fb09a9417562 100644 --- a/stoc/source/javaloader/javaloader.cxx +++ b/stoc/source/javaloader/javaloader.cxx @@ -67,6 +67,7 @@ // this one is header-only #include +#include #include #include #include @@ -92,7 +93,7 @@ OUString generateRandomPipeId() // compute some good pipe id: sal_uInt8 bytes[ 32 ]; if (rtl_random_getBytes( - nullptr, bytes, SAL_N_ELEMENTS(bytes) ) != rtl_Random_E_None) { + nullptr, bytes, std::size(bytes) ) != rtl_Random_E_None) { throw RuntimeException( u"random pool error!?"_ustr, nullptr ); } OUStringBuffer buf;