tdf#147021 Replace SAL_N_ELEMENTS() macro with std::size()
Change-Id: I40bdf727a41ec17e7b78aca6505ac468aaf73dd0 Signed-off-by: Alexandru Ogrezeanu <alexogrezeanu2004@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204894 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
This commit is contained in:
committed by
Hossein
parent
7e1b368025
commit
531fa71b48
@@ -28,6 +28,8 @@
|
||||
|
||||
#include <unicode/uchar.h>
|
||||
|
||||
#include <iterator>
|
||||
|
||||
using namespace com::sun::star::lang;
|
||||
using namespace com::sun::star::uno;
|
||||
|
||||
@@ -106,7 +108,7 @@ Mapping casefolding::getValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 l
|
||||
c = str[pos];
|
||||
|
||||
sal_Int16 address = -1;
|
||||
if (c < SAL_N_ELEMENTS(CaseMappingIndex) * 256)
|
||||
if (c < std::size(CaseMappingIndex) * 256)
|
||||
address = CaseMappingIndex[c >> 8];
|
||||
|
||||
if (address >= 0) {
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#include <com/sun/star/i18n/WordType.hpp>
|
||||
#include <com/sun/star/uno/XComponentContext.hpp>
|
||||
|
||||
#include <iterator>
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
using namespace ::com::sun::star::uno;
|
||||
using namespace ::com::sun::star::i18n;
|
||||
@@ -77,8 +79,6 @@ const UBlock2Script scriptList[] = {
|
||||
{ UBLOCK_LATIN_EXTENDED_C, UBLOCK_LATIN_EXTENDED_D, ScriptType::LATIN }
|
||||
};
|
||||
|
||||
#define scriptListCount SAL_N_ELEMENTS(scriptList)
|
||||
|
||||
//always sets rScriptType
|
||||
|
||||
//returns true for characters historically explicitly assigned to
|
||||
@@ -109,13 +109,13 @@ bool getCompatibilityScriptClassByBlock(sal_uInt32 currentChar, sal_Int16& rScri
|
||||
{
|
||||
UBlockCode block = ublock_getCode(currentChar);
|
||||
size_t i = 0;
|
||||
while (i < scriptListCount)
|
||||
while (i < std::size(scriptList))
|
||||
{
|
||||
if (block <= scriptList[i].to)
|
||||
break;
|
||||
++i;
|
||||
}
|
||||
if (i < scriptListCount && block >= scriptList[i].from)
|
||||
if (i < std::size(scriptList) && block >= scriptList[i].from)
|
||||
rScriptType = scriptList[i].script;
|
||||
else
|
||||
{
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <sal/macros.h>
|
||||
#include <systools/win32/uwinapi.h>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
||||
#include <spellchecker_selection.hxx>
|
||||
|
||||
@@ -163,11 +164,11 @@ langid_to_string( LANGID langid )
|
||||
* MAX_LANGUAGES is certainly enough for that
|
||||
*/
|
||||
static const char *ui_langs[MAX_LANGUAGES];
|
||||
static int num_ui_langs = 0;
|
||||
static size_t num_ui_langs = 0;
|
||||
|
||||
static void add_ui_lang(char const * lang)
|
||||
{
|
||||
if (lang != nullptr && num_ui_langs != SAL_N_ELEMENTS(ui_langs)) {
|
||||
if (lang != nullptr && num_ui_langs != std::size(ui_langs)) {
|
||||
ui_langs[num_ui_langs++] = lang;
|
||||
}
|
||||
}
|
||||
@@ -179,7 +180,7 @@ enum_ui_lang_proc (LPTSTR language, LONG_PTR /* unused_lParam */)
|
||||
if (langid > 0xFFFF)
|
||||
return TRUE;
|
||||
add_ui_lang(langid_to_string(static_cast<LANGID>(langid)));
|
||||
if (num_ui_langs == SAL_N_ELEMENTS(ui_langs) )
|
||||
if (num_ui_langs == std::size(ui_langs) )
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
@@ -212,13 +213,10 @@ struct InstallLocalized {
|
||||
void addMatchingDictionaries(
|
||||
char const * lang, InstallLocalized * dicts, int ndicts)
|
||||
{
|
||||
for (int i = 0; i != SAL_N_ELEMENTS(setup_native::languageDictionaries);
|
||||
++i)
|
||||
for (auto const &dictionary : setup_native::languageDictionaries)
|
||||
{
|
||||
if (strcmp(lang, setup_native::languageDictionaries[i].language) == 0) {
|
||||
for (char const * const * p = setup_native::languageDictionaries[i].
|
||||
dictionaries;
|
||||
*p != nullptr; ++p)
|
||||
if (strcmp(lang, dictionary.language) == 0) {
|
||||
for (char const * const * p = dictionary.dictionaries; *p != nullptr; ++p)
|
||||
{
|
||||
for (int j = 0; j != ndicts; ++j) {
|
||||
if (_stricmp(*p, dicts[j].lang) == 0) {
|
||||
|
||||
Reference in New Issue
Block a user