summaryrefslogtreecommitdiff
path: root/plugins/SpellChecker
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/SpellChecker')
-rw-r--r--plugins/SpellChecker/src/ardialog.cpp8
-rw-r--r--plugins/SpellChecker/src/autoreplace.cpp4
-rw-r--r--plugins/SpellChecker/src/dictionary.cpp80
-rw-r--r--plugins/SpellChecker/src/options.cpp16
-rw-r--r--plugins/SpellChecker/src/spellchecker.cpp12
-rw-r--r--plugins/SpellChecker/src/utils.cpp34
6 files changed, 77 insertions, 77 deletions
diff --git a/plugins/SpellChecker/src/ardialog.cpp b/plugins/SpellChecker/src/ardialog.cpp
index 72fc6548c0..61aa390af8 100644
--- a/plugins/SpellChecker/src/ardialog.cpp
+++ b/plugins/SpellChecker/src/ardialog.cpp
@@ -97,7 +97,7 @@ static LRESULT CALLBACK OnlyCharsEditProc(HWND hwnd, UINT msg, WPARAM wParam, LP
case EM_PASTESPECIAL:
case WM_PASTE:
TCHAR text[256];
- GetWindowText(hwnd, text, SIZEOF(text));
+ GetWindowText(hwnd, text, _countof(text));
scoped_free<TCHAR> dest = data->dict->autoReplace->filterText(text);
SetWindowText(hwnd, dest);
@@ -217,14 +217,14 @@ static INT_PTR CALLBACK AddReplacementDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
TCHAR find[256];
if (data->findReadOnly)
- mir_tstrncpy(find, data->find.c_str(), SIZEOF(find));
+ mir_tstrncpy(find, data->find.c_str(), _countof(find));
else {
- GetDlgItemText(hwndDlg, IDC_OLD, find, SIZEOF(find));
+ GetDlgItemText(hwndDlg, IDC_OLD, find, _countof(find));
lstrtrim(find);
}
TCHAR replace[256];
- GetDlgItemText(hwndDlg, IDC_NEW, replace, SIZEOF(replace));
+ GetDlgItemText(hwndDlg, IDC_NEW, replace, _countof(replace));
lstrtrim(replace);
if (!data->findReadOnly && find[0] == 0)
diff --git a/plugins/SpellChecker/src/autoreplace.cpp b/plugins/SpellChecker/src/autoreplace.cpp
index c22a1fe5aa..283a1ea6db 100644
--- a/plugins/SpellChecker/src/autoreplace.cpp
+++ b/plugins/SpellChecker/src/autoreplace.cpp
@@ -33,7 +33,7 @@ AutoReplacement::AutoReplacement(const TCHAR *replace, BOOL useVariables)
AutoReplaceMap::AutoReplaceMap(TCHAR *aFilename, Dictionary *dict)
{
this->dict = dict;
- mir_tstrncpy(filename, aFilename, SIZEOF(filename));
+ mir_tstrncpy(filename, aFilename, _countof(filename));
loadAutoReplaceMap();
}
@@ -47,7 +47,7 @@ void AutoReplaceMap::loadAutoReplaceMap()
char c;
int pos = 0;
while ((c = fgetc(file)) != EOF) {
- if (c == '\n' || c == '\r' || pos >= SIZEOF(tmp) - 1) {
+ if (c == '\n' || c == '\r' || pos >= _countof(tmp) - 1) {
if (pos > 0) {
tmp[pos] = '\0';
diff --git a/plugins/SpellChecker/src/dictionary.cpp b/plugins/SpellChecker/src/dictionary.cpp
index 18689e9756..9a7ae1775c 100644
--- a/plugins/SpellChecker/src/dictionary.cpp
+++ b/plugins/SpellChecker/src/dictionary.cpp
@@ -365,7 +365,7 @@ protected:
void loadCustomDict()
{
TCHAR filename[1024];
- mir_sntprintf(filename, SIZEOF(filename), _T("%s\\%s.cdic"), userPath, language);
+ mir_sntprintf(filename, _countof(filename), _T("%s\\%s.cdic"), userPath, language);
FILE *file = _tfopen(filename, _T("rb"));
if (file != NULL) {
@@ -373,7 +373,7 @@ protected:
char c;
int pos = 0;
while ((c = fgetc(file)) != EOF) {
- if (c == '\n' || c == '\r' || pos >= SIZEOF(tmp) - 1) {
+ if (c == '\n' || c == '\r' || pos >= _countof(tmp) - 1) {
if (pos > 0) {
tmp[pos] = '\0';
hunspell->add(tmp);
@@ -395,12 +395,12 @@ protected:
CreateDirectoryTreeT(userPath);
TCHAR filename[1024];
- mir_sntprintf(filename, SIZEOF(filename), _T("%s\\%s.cdic"), userPath, language);
+ mir_sntprintf(filename, _countof(filename), _T("%s\\%s.cdic"), userPath, language);
FILE *file = _tfopen(filename, _T("ab"));
if (file != NULL) {
char tmp[1024];
- toHunspell(tmp, word, SIZEOF(tmp));
+ toHunspell(tmp, word, _countof(tmp));
fprintf(file, "%s\n", tmp);
fclose(file);
}
@@ -412,7 +412,7 @@ protected:
return;
char hunspell_word[1024];
- toHunspell(hunspell_word, word, SIZEOF(hunspell_word));
+ toHunspell(hunspell_word, word, _countof(hunspell_word));
hunspell->add(hunspell_word);
}
@@ -443,13 +443,13 @@ protected:
public:
HunspellDictionary(TCHAR *aLanguage, TCHAR *aFileWithoutExtension, TCHAR *anUserPath, TCHAR *aSource)
{
- mir_tstrncpy(language, aLanguage, SIZEOF(language));
- mir_tstrncpy(fileWithoutExtension, aFileWithoutExtension, SIZEOF(fileWithoutExtension));
- mir_tstrncpy(userPath, anUserPath, SIZEOF(userPath));
+ mir_tstrncpy(language, aLanguage, _countof(language));
+ mir_tstrncpy(fileWithoutExtension, aFileWithoutExtension, _countof(fileWithoutExtension));
+ mir_tstrncpy(userPath, anUserPath, _countof(userPath));
if (aSource == NULL)
source[0] = _T('\0');
else
- mir_tstrncpy(source, aSource, SIZEOF(source));
+ mir_tstrncpy(source, aSource, _countof(source));
loaded = LANGUAGE_NOT_LOADED;
localized_name[0] = _T('\0');
@@ -523,8 +523,8 @@ public:
char aff[1024];
- mir_snprintf(dic, SIZEOF(dic), "%S.dic", fileWithoutExtension);
- mir_snprintf(aff, SIZEOF(aff), "%S.aff", fileWithoutExtension);
+ mir_snprintf(dic, _countof(dic), "%S.dic", fileWithoutExtension);
+ mir_snprintf(aff, _countof(aff), "%S.aff", fileWithoutExtension);
hunspell = new Hunspell(aff, dic);
@@ -542,7 +542,7 @@ public:
}
else {
- for (int i = 0; i < SIZEOF(codepages); i++) {
+ for (int i = 0; i < _countof(codepages); i++) {
if (_strcmpi(codepages[i].name, dic_enc) == 0) {
if (IsValidCodePage(codepages[i].codepage))
codePage = codepages[i].codepage;
@@ -581,7 +581,7 @@ public:
// TODO Check if it was generated by auto-replacement
char hunspell_word[1024];
- toHunspell(hunspell_word, word, SIZEOF(hunspell_word));
+ toHunspell(hunspell_word, word, _countof(hunspell_word));
return hunspell->spell(hunspell_word);
}
@@ -596,7 +596,7 @@ public:
return ret;
char hunspell_word[1024];
- toHunspell(hunspell_word, word, SIZEOF(hunspell_word));
+ toHunspell(hunspell_word, word, _countof(hunspell_word));
char ** words = NULL;
ret.count = hunspell->suggest(&words, hunspell_word);
@@ -625,7 +625,7 @@ public:
return ret;
char hunspell_word[1024];
- toHunspell(hunspell_word, word, SIZEOF(hunspell_word));
+ toHunspell(hunspell_word, word, _countof(hunspell_word));
char ** words;
int count = hunspell->suggest_auto(&words, hunspell_word);
@@ -654,7 +654,7 @@ public:
return NULL;
char hunspell_word[1024];
- toHunspell(hunspell_word, word, SIZEOF(hunspell_word));
+ toHunspell(hunspell_word, word, _countof(hunspell_word));
char ** words;
int count = hunspell->suggest_auto(&words, hunspell_word);
@@ -733,37 +733,37 @@ BOOL CALLBACK EnumLocalesProc(LPTSTR lpLocaleString)
TCHAR ini[32];
TCHAR 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));
TCHAR name[64];
- mir_sntprintf(name, SIZEOF(name), _T("%s_%s"), ini, end);
+ mir_sntprintf(name, _countof(name), _T("%s_%s"), ini, end);
for (int i = 0; i < tmp_dicts->getCount(); i++) {
Dictionary *dict = (*tmp_dicts)[i];
if (mir_tstrcmpi(dict->language, name) == 0) {
- GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SENGLANGUAGE, dict->english_name, SIZEOF(dict->english_name));
+ GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SENGLANGUAGE, dict->english_name, _countof(dict->english_name));
- GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SLANGUAGE, dict->localized_name, SIZEOF(dict->localized_name));
+ GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SLANGUAGE, dict->localized_name, _countof(dict->localized_name));
if (dict->localized_name[0] == 0)
- GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SLOCALIZEDLANGUAGENAME, dict->localized_name, SIZEOF(dict->localized_name));
+ GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SLOCALIZEDLANGUAGENAME, dict->localized_name, _countof(dict->localized_name));
if (dict->localized_name[0] == 0)
- GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SNATIVEDISPLAYNAME, dict->localized_name, SIZEOF(dict->localized_name));
+ GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SNATIVEDISPLAYNAME, dict->localized_name, _countof(dict->localized_name));
if (dict->localized_name[0] == 0 && dict->english_name[0] != 0) {
TCHAR country[1024];
- GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SENGCOUNTRY, country, SIZEOF(country));
+ GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SENGCOUNTRY, country, _countof(country));
TCHAR name[1024];
if (country[0] != 0)
- mir_sntprintf(name, SIZEOF(name), _T("%s (%s)"), dict->english_name, country);
+ mir_sntprintf(name, _countof(name), _T("%s (%s)"), dict->english_name, country);
else
- mir_tstrncpy(name, dict->english_name, SIZEOF(name));
+ mir_tstrncpy(name, dict->english_name, _countof(name));
- mir_tstrncpy(dict->localized_name, TranslateTS(name), SIZEOF(dict->localized_name));
+ mir_tstrncpy(dict->localized_name, TranslateTS(name), _countof(dict->localized_name));
}
if (dict->localized_name[0] != 0) {
- mir_sntprintf(dict->full_name, SIZEOF(dict->full_name), _T("%s [%s]"), dict->localized_name, dict->language);
+ mir_sntprintf(dict->full_name, _countof(dict->full_name), _T("%s [%s]"), dict->localized_name, dict->language);
}
break;
}
@@ -787,24 +787,24 @@ void GetDictsInfo(LIST<Dictionary> &dicts)
char lang[128];
WideCharToMultiByte(CP_ACP, 0, dict->language, -1, lang, sizeof(lang), NULL, NULL);
if (!db_get_ts(NULL, MODULE_NAME, lang, &dbv)) {
- mir_tstrncpy(dict->localized_name, dbv.ptszVal, SIZEOF(dict->localized_name));
+ mir_tstrncpy(dict->localized_name, dbv.ptszVal, _countof(dict->localized_name));
db_free(&dbv);
}
if (dict->localized_name[0] == _T('\0')) {
- for (size_t j = 0; j < SIZEOF(aditionalLanguages); j++) {
+ for (size_t j = 0; j < _countof(aditionalLanguages); j++) {
if (!mir_tstrcmp(aditionalLanguages[j].language, dict->language)) {
- mir_tstrncpy(dict->localized_name, TranslateTS(aditionalLanguages[j].localized_name), SIZEOF(dict->localized_name));
+ mir_tstrncpy(dict->localized_name, TranslateTS(aditionalLanguages[j].localized_name), _countof(dict->localized_name));
break;
}
}
}
if (dict->localized_name[0] != _T('\0')) {
- mir_sntprintf(dict->full_name, SIZEOF(dict->full_name), _T("%s [%s]"), dict->localized_name, dict->language);
+ mir_sntprintf(dict->full_name, _countof(dict->full_name), _T("%s [%s]"), dict->localized_name, dict->language);
}
else {
- mir_tstrncpy(dict->full_name, dict->language, SIZEOF(dict->full_name));
+ mir_tstrncpy(dict->full_name, dict->language, _countof(dict->full_name));
}
}
}
@@ -815,7 +815,7 @@ void GetHunspellDictionariesFromFolder(LIST<Dictionary> &dicts, TCHAR *path, TCH
{
// Load the language files and create an array with then
TCHAR file[1024];
- mir_sntprintf(file, SIZEOF(file), _T("%s\\*.dic"), path);
+ mir_sntprintf(file, _countof(file), _T("%s\\*.dic"), path);
BOOL found = FALSE;
@@ -823,7 +823,7 @@ void GetHunspellDictionariesFromFolder(LIST<Dictionary> &dicts, TCHAR *path, TCH
HANDLE hFFD = FindFirstFile(file, &ffd);
if (hFFD != INVALID_HANDLE_VALUE) {
do {
- mir_sntprintf(file, SIZEOF(file), _T("%s\\%s"), path, ffd.cFileName);
+ mir_sntprintf(file, _countof(file), _T("%s\\%s"), path, ffd.cFileName);
// Check .dic
DWORD attrib = GetFileAttributes(file);
@@ -871,14 +871,14 @@ void GetAvaibleDictionaries(LIST<Dictionary> &dicts, TCHAR *path, TCHAR *user_pa
if (opts.use_other_apps_dicts) {
// Get other apps dicts
- for (int i = 0; i < SIZEOF(otherHunspellApps); i++) {
+ for (int i = 0; i < _countof(otherHunspellApps); i++) {
TCHAR key[1024];
- mir_sntprintf(key, SIZEOF(key), APPPATH, otherHunspellApps[i].key);
+ mir_sntprintf(key, _countof(key), APPPATH, otherHunspellApps[i].key);
HKEY hKey = 0;
LONG lResult = 0;
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, key, 0, KEY_QUERY_VALUE, &hKey)) {
- DWORD size = SIZEOF(key);
+ DWORD size = _countof(key);
lResult = RegQueryValueEx(hKey, _T("Path"), NULL, NULL, (LPBYTE)key, &size);
RegCloseKey(hKey);
}
@@ -892,7 +892,7 @@ void GetAvaibleDictionaries(LIST<Dictionary> &dicts, TCHAR *path, TCHAR *user_pa
lResult = ERROR_NO_MORE_ITEMS;
for (DWORD local = 0; local < numValues; local++) {
- DWORD cchValue = SIZEOF(key);
+ DWORD cchValue = _countof(key);
if (ERROR_SUCCESS != RegEnumValue(hKey, local, key, &cchValue, NULL, NULL, NULL, NULL))
break;
key[cchValue] = 0;
@@ -911,7 +911,7 @@ void GetAvaibleDictionaries(LIST<Dictionary> &dicts, TCHAR *path, TCHAR *user_pa
if (ERROR_SUCCESS == lResult) {
TCHAR folder[1024];
- mir_sntprintf(folder, SIZEOF(folder), _T("%s\\Dictionaries"), key);
+ mir_sntprintf(folder, _countof(folder), _T("%s\\Dictionaries"), key);
GetHunspellDictionariesFromFolder(languages, folder, user_path, otherHunspellApps[i].name);
}
diff --git a/plugins/SpellChecker/src/options.cpp b/plugins/SpellChecker/src/options.cpp
index e36ac30ce2..bd8a929a04 100644
--- a/plugins/SpellChecker/src/options.cpp
+++ b/plugins/SpellChecker/src/options.cpp
@@ -84,8 +84,8 @@ void InitOptions()
void LoadOptions()
{
- LoadOpts(optionsControls, SIZEOF(optionsControls), MODULE_NAME);
- LoadOpts(autoReplaceControls, SIZEOF(autoReplaceControls), MODULE_NAME);
+ LoadOpts(optionsControls, _countof(optionsControls), MODULE_NAME);
+ LoadOpts(autoReplaceControls, _countof(autoReplaceControls), MODULE_NAME);
if (languages.getCount() <= 0) {
opts.default_language[0] = _T('\0');
@@ -94,7 +94,7 @@ void LoadOptions()
DBVARIANT dbv;
if (!db_get_ts(NULL, MODULE_NAME, "DefaultLanguage", &dbv)) {
- mir_tstrncpy(opts.default_language, dbv.ptszVal, SIZEOF(opts.default_language));
+ mir_tstrncpy(opts.default_language, dbv.ptszVal, _countof(opts.default_language));
db_free(&dbv);
}
@@ -241,7 +241,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
return TRUE;
}
- return SaveOptsDlgProc(optionsControls, SIZEOF(optionsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
+ return SaveOptsDlgProc(optionsControls, _countof(optionsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
}
struct AutoreplaceData
@@ -349,7 +349,7 @@ static void ShowAddReplacement(HWND hwndDlg, int item = -1)
if (item < 0)
find[0] = 0;
else
- ListView_GetItemText(GetDlgItem(hwndDlg, IDC_REPLACEMENTS), item, 0, find, SIZEOF(find));
+ ListView_GetItemText(GetDlgItem(hwndDlg, IDC_REPLACEMENTS), item, 0, find, _countof(find));
if (mir_tstrlen(find) > 0) {
AutoReplacement &ar = data->autoReplaceMap[find];
@@ -370,7 +370,7 @@ static INT_PTR CALLBACK AutoreplaceDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam
switch (msg) {
case WM_INITDIALOG:
{
- BOOL ret = SaveOptsDlgProc(autoReplaceControls, SIZEOF(autoReplaceControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
+ BOOL ret = SaveOptsDlgProc(autoReplaceControls, _countof(autoReplaceControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
int sel = -1;
for (int i = 0; i < languages.getCount(); i++) {
@@ -431,7 +431,7 @@ static INT_PTR CALLBACK AutoreplaceDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam
sel = SendMessage(hList, LVM_GETNEXTITEM, -1, LVNI_SELECTED);
while (sel >= 0) {
TCHAR tmp[256];
- ListView_GetItemText(hList, sel, 0, tmp, SIZEOF(tmp));
+ ListView_GetItemText(hList, sel, 0, tmp, _countof(tmp));
data->RemoveWord(tmp);
changed = TRUE;
@@ -499,5 +499,5 @@ static INT_PTR CALLBACK AutoreplaceDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam
return TRUE;
}
- return SaveOptsDlgProc(autoReplaceControls, SIZEOF(autoReplaceControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
+ return SaveOptsDlgProc(autoReplaceControls, _countof(autoReplaceControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
}
diff --git a/plugins/SpellChecker/src/spellchecker.cpp b/plugins/SpellChecker/src/spellchecker.cpp
index 6f02a86c14..80d2a599ad 100644
--- a/plugins/SpellChecker/src/spellchecker.cpp
+++ b/plugins/SpellChecker/src/spellchecker.cpp
@@ -80,7 +80,7 @@ static int IconsChanged(WPARAM, LPARAM)
sid.dwId = i;
TCHAR tmp[128];
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%s - %s"),
+ mir_sntprintf(tmp, _countof(tmp), _T("%s - %s"),
TranslateT("Spell Checker"), languages[i]->full_name);
sid.tszTooltip = tmp;
@@ -135,7 +135,7 @@ static int ModulesLoaded(WPARAM, LPARAM)
if (opts.use_flags) {
// Load flags dll
TCHAR flag_file[MAX_PATH];
- mir_sntprintf(flag_file, SIZEOF(flag_file), _T("%s\\flags_icons.dll"), flagsDllFolder);
+ mir_sntprintf(flag_file, _countof(flag_file), _T("%s\\flags_icons.dll"), flagsDllFolder);
HMODULE hFlagsDll = LoadLibraryEx(flag_file, NULL, LOAD_LIBRARY_AS_DATAFILE);
TCHAR path[MAX_PATH];
@@ -151,7 +151,7 @@ static int ModulesLoaded(WPARAM, LPARAM)
sid.description.t = p->full_name;
char lang[32];
- mir_snprintf(lang, SIZEOF(lang), "spell_lang_%d", i);
+ mir_snprintf(lang, _countof(lang), "spell_lang_%d", i);
sid.pszName = lang;
HICON hFlag = NULL, hFlagIcoLib = NULL;
@@ -185,7 +185,7 @@ static int ModulesLoaded(WPARAM, LPARAM)
Dictionary *dict = languages[j];
TCHAR filename[MAX_PATH];
- mir_sntprintf(filename, SIZEOF(filename), _T("%s\\%s.ar"), customDictionariesFolder, dict->language);
+ mir_sntprintf(filename, _countof(filename), _T("%s\\%s.ar"), customDictionariesFolder, dict->language);
dict->autoReplace = new AutoReplaceMap(filename, dict);
if (mir_tstrcmp(dict->language, opts.default_language) == 0)
@@ -206,7 +206,7 @@ static int ModulesLoaded(WPARAM, LPARAM)
sid.dwId = i;
TCHAR tmp[128];
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%s - %s"),
+ mir_sntprintf(tmp, _countof(tmp), _T("%s - %s"),
TranslateT("Spell Checker"), languages[i]->full_name);
sid.tszTooltip = tmp;
sid.hIcon = (opts.use_flags) ? IcoLib_GetIconByHandle(languages[i]->hIcolib) : IcoLib_GetIcon("spellchecker_enabled");
@@ -240,7 +240,7 @@ extern "C" int __declspec(dllexport) Load(void)
mir_getLP(&pluginInfo);
// icons
- Icon_Register(hInst, LPGEN("Spell Checker"), iconList, SIZEOF(iconList));
+ Icon_Register(hInst, LPGEN("Spell Checker"), iconList, _countof(iconList));
// hooks
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
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