summaryrefslogtreecommitdiff
path: root/plugins/SpellChecker/src/utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/SpellChecker/src/utils.cpp')
-rw-r--r--plugins/SpellChecker/src/utils.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/plugins/SpellChecker/src/utils.cpp b/plugins/SpellChecker/src/utils.cpp
index ab777aa39c..f712daa96d 100644
--- a/plugins/SpellChecker/src/utils.cpp
+++ b/plugins/SpellChecker/src/utils.cpp
@@ -292,7 +292,7 @@ int CheckTextLine(Dialog *dlg, int line, TextParser *parser,
{
int errors = 0;
TCHAR text[1024];
- dlg->re->GetLine(line, text, SIZEOF(text));
+ dlg->re->GetLine(line, text, _countof(text));
int len = mir_tstrlen(text);
int first_char = dlg->re->GetFirstCharOfLine(line);
@@ -381,7 +381,7 @@ int CheckTextLine(Dialog *dlg, int line, TextParser *parser,
int dif = dlg->re->Replace(sel.cpMin, sel.cpMax, replacement);
if (dif != 0) {
// Read line again
- dlg->re->GetLine(line, text, SIZEOF(text));
+ dlg->re->GetLine(line, text, _countof(text));
len = mir_tstrlen(text);
int old_first_char = first_char;
@@ -454,8 +454,8 @@ void ToLocaleID(TCHAR *szKLName, size_t size)
USHORT langID = (USHORT)_tcstol(szKLName, &stopped, 16);
TCHAR ini[32], end[32];
- GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SISO639LANGNAME, ini, SIZEOF(ini));
- GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SISO3166CTRYNAME, end, SIZEOF(end));
+ GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SISO639LANGNAME, ini, _countof(ini));
+ GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SISO3166CTRYNAME, end, _countof(end));
mir_sntprintf(szKLName, size, _T("%s_%s"), ini, end);
}
@@ -466,8 +466,8 @@ void LoadDictFromKbdl(Dialog *dlg)
// Use default input language
HKL hkl = GetKeyboardLayout(0);
- mir_sntprintf(szKLName, SIZEOF(szKLName), _T("%x"), (int)LOWORD(hkl));
- ToLocaleID(szKLName, SIZEOF(szKLName));
+ mir_sntprintf(szKLName, _countof(szKLName), _T("%x"), (int)LOWORD(hkl));
+ ToLocaleID(szKLName, _countof(szKLName));
int d = GetClosestLanguage(szKLName);
if (d >= 0) {
@@ -635,7 +635,7 @@ LRESULT CALLBACK EditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
TCHAR text[1024];
int first_char;
- GetWordCharRange(dlg, sel, text, SIZEOF(text), first_char);
+ GetWordCharRange(dlg, sel, text, _countof(text), first_char);
SetNoUnderline(dlg->re, sel.cpMin, sel.cpMax);
@@ -702,7 +702,7 @@ int GetClosestLanguage(TCHAR *lang_name)
// Try searching by the prefix only
TCHAR lang[128];
- mir_tstrncpy(lang, lang_name, SIZEOF(lang));
+ mir_tstrncpy(lang, lang_name, _countof(lang));
TCHAR *p = _tcschr(lang, _T('_'));
if (p != NULL)
@@ -760,7 +760,7 @@ void GetUserProtoLanguageSetting(Dialog *dlg, MCONTACT hContact, char *group, ch
if (mir_tstrcmpi(dict->localized_name, lang) == 0
|| mir_tstrcmpi(dict->english_name, lang) == 0
|| mir_tstrcmpi(dict->language, lang) == 0) {
- mir_tstrncpy(dlg->lang_name, dict->language, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, dict->language, _countof(dlg->lang_name));
break;
}
}
@@ -803,18 +803,18 @@ void GetContactLanguage(Dialog *dlg)
if (dlg->hContact == NULL) {
if (!db_get_ts(NULL, MODULE_NAME, dlg->name, &dbv)) {
- mir_tstrncpy(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name));
db_free(&dbv);
}
}
else {
if (!db_get_ts(dlg->hContact, MODULE_NAME, "TalkLanguage", &dbv)) {
- mir_tstrncpy(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name));
db_free(&dbv);
}
if (dlg->lang_name[0] == _T('\0') && !db_get_ts(dlg->hContact, "eSpeak", "TalkLanguage", &dbv)) {
- mir_tstrncpy(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name));
db_free(&dbv);
}
@@ -823,12 +823,12 @@ void GetContactLanguage(Dialog *dlg)
MCONTACT hMetaContact = db_mc_getMeta(dlg->hContact);
if (hMetaContact != NULL) {
if (!db_get_ts(hMetaContact, MODULE_NAME, "TalkLanguage", &dbv)) {
- mir_tstrncpy(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name));
db_free(&dbv);
}
if (dlg->lang_name[0] == _T('\0') && !db_get_ts(hMetaContact, "eSpeak", "TalkLanguage", &dbv)) {
- mir_tstrncpy(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name));
db_free(&dbv);
}
}
@@ -846,13 +846,13 @@ void GetContactLanguage(Dialog *dlg)
// Use default lang
if (dlg->lang_name[0] == _T('\0'))
- mir_tstrncpy(dlg->lang_name, opts.default_language, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, opts.default_language, _countof(dlg->lang_name));
}
int i = GetClosestLanguage(dlg->lang_name);
if (i < 0) {
// Lost a dict?
- mir_tstrncpy(dlg->lang_name, opts.default_language, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, opts.default_language, _countof(dlg->lang_name));
i = GetClosestLanguage(dlg->lang_name);
}
@@ -1036,7 +1036,7 @@ TCHAR *GetWordUnderPoint(Dialog *dlg, POINT pt, CHARRANGE &sel)
TCHAR text[1024];
int first_char;
- if (!GetWordCharRange(dlg, sel, text, SIZEOF(text), first_char))
+ if (!GetWordCharRange(dlg, sel, text, _countof(text), first_char))
return NULL;
// copy the word