diff options
author | George Hazan <george.hazan@gmail.com> | 2014-11-30 18:51:36 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-11-30 18:51:36 +0000 |
commit | 688f55ba998c19304a29727c910504903f4cc49a (patch) | |
tree | 69121ebb6d02bcf9e670428b11813087fc7f1640 /plugins/SpellChecker | |
parent | 4f0e30cdf56fbafdf955bbe8b93930bab9e39bd0 (diff) |
lstr* replacements
git-svn-id: http://svn.miranda-ng.org/main/trunk@11176 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SpellChecker')
-rw-r--r-- | plugins/SpellChecker/src/RichEdit.cpp | 6 | ||||
-rw-r--r-- | plugins/SpellChecker/src/ardialog.cpp | 2 | ||||
-rw-r--r-- | plugins/SpellChecker/src/autoreplace.cpp | 6 | ||||
-rw-r--r-- | plugins/SpellChecker/src/dictionary.cpp | 36 | ||||
-rw-r--r-- | plugins/SpellChecker/src/options.cpp | 12 | ||||
-rw-r--r-- | plugins/SpellChecker/src/utils.cpp | 36 |
6 files changed, 49 insertions, 49 deletions
diff --git a/plugins/SpellChecker/src/RichEdit.cpp b/plugins/SpellChecker/src/RichEdit.cpp index 7971b607fd..1dca488f08 100644 --- a/plugins/SpellChecker/src/RichEdit.cpp +++ b/plugins/SpellChecker/src/RichEdit.cpp @@ -238,7 +238,7 @@ void RichEdit::ReplaceSel(const TCHAR *new_text) SuspendUndo();
- FixSel(&old_sel, sel, lstrlen(new_text));
+ FixSel(&old_sel, sel, mir_tstrlen(new_text));
SendMessage(WM_SETREDRAW, FALSE, 0);
SendMessage(EM_SETEVENTMASK, 0, old_mask & ~ENM_CHANGE);
@@ -254,7 +254,7 @@ int RichEdit::Replace(int start, int end, const TCHAR *new_text) ReplaceSel(new_text);
- int dif = FixSel(&sel, replace_sel, lstrlen(new_text));
+ int dif = FixSel(&sel, replace_sel, mir_tstrlen(new_text));
SetSel(sel);
return dif;
}
@@ -267,7 +267,7 @@ int RichEdit::Insert(int pos, const TCHAR *text) ReplaceSel(text);
- int dif = FixSel(&sel, replace_sel, lstrlen(text));
+ int dif = FixSel(&sel, replace_sel, mir_tstrlen(text));
SetSel(sel);
return dif;
}
diff --git a/plugins/SpellChecker/src/ardialog.cpp b/plugins/SpellChecker/src/ardialog.cpp index 22634c8858..1bf94a01f6 100644 --- a/plugins/SpellChecker/src/ardialog.cpp +++ b/plugins/SpellChecker/src/ardialog.cpp @@ -217,7 +217,7 @@ static INT_PTR CALLBACK AddReplacementDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa TCHAR find[256];
if (data->findReadOnly)
- lstrcpyn(find, data->find.c_str(), SIZEOF(find));
+ mir_tstrncpy(find, data->find.c_str(), SIZEOF(find));
else {
GetDlgItemText(hwndDlg, IDC_OLD, find, SIZEOF(find));
lstrtrim(find);
diff --git a/plugins/SpellChecker/src/autoreplace.cpp b/plugins/SpellChecker/src/autoreplace.cpp index aa38708d8a..a3a8425844 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;
- lstrcpyn(filename, aFilename, SIZEOF(filename));
+ mir_tstrncpy(filename, aFilename, SIZEOF(filename));
loadAutoReplaceMap();
}
@@ -145,7 +145,7 @@ TCHAR* AutoReplaceMap::autoReplace(const TCHAR * word) to = _tcsdup(ar.replace.c_str());
// Wich case to use?
- size_t len = lstrlen(word);
+ size_t len = mir_tstrlen(word);
size_t i;
for (i = 0; i < len; i++)
if (IsCharLower(word[i]))
@@ -169,7 +169,7 @@ TCHAR* AutoReplaceMap::autoReplace(const TCHAR * word) TCHAR* AutoReplaceMap::filterText(const TCHAR *find)
{
TCHAR *ret = _tcsdup(find);
- int len = lstrlen(ret);
+ int len = mir_tstrlen(ret);
int pos = 0;
for (int i = 0; i < len; i++)
if (isWordChar(find[i]))
diff --git a/plugins/SpellChecker/src/dictionary.cpp b/plugins/SpellChecker/src/dictionary.cpp index 0926273837..c794aca5f8 100644 --- a/plugins/SpellChecker/src/dictionary.cpp +++ b/plugins/SpellChecker/src/dictionary.cpp @@ -443,13 +443,13 @@ protected: public: HunspellDictionary(TCHAR *aLanguage, TCHAR *aFileWithoutExtension, TCHAR *anUserPath, TCHAR *aSource) { - lstrcpyn(language, aLanguage, SIZEOF(language)); - lstrcpyn(fileWithoutExtension, aFileWithoutExtension, SIZEOF(fileWithoutExtension)); - lstrcpyn(userPath, anUserPath, SIZEOF(userPath)); + mir_tstrncpy(language, aLanguage, SIZEOF(language)); + mir_tstrncpy(fileWithoutExtension, aFileWithoutExtension, SIZEOF(fileWithoutExtension)); + mir_tstrncpy(userPath, anUserPath, SIZEOF(userPath)); if (aSource == NULL) source[0] = _T('\0'); else - lstrcpyn(source, aSource, SIZEOF(source)); + mir_tstrncpy(source, aSource, SIZEOF(source)); loaded = LANGUAGE_NOT_LOADED; localized_name[0] = _T('\0'); @@ -471,14 +471,14 @@ public: TCHAR * merge(TCHAR * s1, TCHAR *s2) { - int len1 = (s1 == NULL ? 0 : lstrlen(s1)); - int len2 = (s2 == NULL ? 0 : lstrlen(s2)); + int len1 = (s1 == NULL ? 0 : mir_tstrlen(s1)); + int len2 = (s2 == NULL ? 0 : mir_tstrlen(s2)); TCHAR *ret; if (len1 > 0 && len2 > 0) { ret = (TCHAR *)malloc(sizeof(TCHAR) * (len1 + len2 + 1)); - lstrcpyn(ret, s1, len1 + 1); - lstrcpyn(&ret[len1], s2, len2 + 1); + mir_tstrncpy(ret, s1, len1 + 1); + mir_tstrncpy(&ret[len1], s2, len2 + 1); FREE(s1); FREE(s2); @@ -500,7 +500,7 @@ public: } // Remove duplicated chars - int last = lstrlen(ret) - 1; + int last = mir_tstrlen(ret) - 1; for (int i = 0; i <= last; i++) { TCHAR c = ret[i]; for (int j = last; j > i; j--) { @@ -757,9 +757,9 @@ BOOL CALLBACK EnumLocalesProc(LPTSTR lpLocaleString) if (country[0] != 0) mir_sntprintf(name, SIZEOF(name), _T("%s (%s)"), dict->english_name, country); else - lstrcpyn(name, dict->english_name, SIZEOF(name)); + mir_tstrncpy(name, dict->english_name, SIZEOF(name)); - lstrcpyn(dict->localized_name, TranslateTS(name), SIZEOF(dict->localized_name)); + mir_tstrncpy(dict->localized_name, TranslateTS(name), SIZEOF(dict->localized_name)); } if (dict->localized_name[0] != 0) { @@ -787,14 +787,14 @@ 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)) { - lstrcpyn(dict->localized_name, dbv.ptszVal, SIZEOF(dict->localized_name)); + mir_tstrncpy(dict->localized_name, dbv.ptszVal, SIZEOF(dict->localized_name)); db_free(&dbv); } if (dict->localized_name[0] == _T('\0')) { for (size_t j = 0; j < SIZEOF(aditionalLanguages); j++) { if (!lstrcmp(aditionalLanguages[j].language, dict->language)) { - lstrcpyn(dict->localized_name, TranslateTS(aditionalLanguages[j].localized_name), SIZEOF(dict->localized_name)); + mir_tstrncpy(dict->localized_name, TranslateTS(aditionalLanguages[j].localized_name), SIZEOF(dict->localized_name)); break; } } @@ -804,7 +804,7 @@ void GetDictsInfo(LIST<Dictionary> &dicts) mir_sntprintf(dict->full_name, SIZEOF(dict->full_name), _T("%s [%s]"), dict->localized_name, dict->language); } else { - lstrcpyn(dict->full_name, dict->language, SIZEOF(dict->full_name)); + mir_tstrncpy(dict->full_name, dict->language, SIZEOF(dict->full_name)); } } } @@ -831,17 +831,17 @@ void GetHunspellDictionariesFromFolder(LIST<Dictionary> &dicts, TCHAR *path, TCH continue; // See if .aff exists too - lstrcpy(&file[lstrlen(file) - 4], _T(".aff")); + mir_tstrcpy(&file[mir_tstrlen(file) - 4], _T(".aff")); attrib = GetFileAttributes(file); if (attrib == 0xFFFFFFFF || (attrib & FILE_ATTRIBUTE_DIRECTORY)) continue; - ffd.cFileName[lstrlen(ffd.cFileName) - 4] = _T('\0'); + ffd.cFileName[mir_tstrlen(ffd.cFileName) - 4] = _T('\0'); TCHAR *lang = ffd.cFileName; // Replace - for _ - for (int i = 0; i < lstrlen(lang); i++) + for (int i = 0; i < mir_tstrlen(lang); i++) if (lang[i] == _T('-')) lang[i] = _T('_'); @@ -853,7 +853,7 @@ void GetHunspellDictionariesFromFolder(LIST<Dictionary> &dicts, TCHAR *path, TCH if (!exists) { found = TRUE; - file[lstrlen(file) - 4] = _T('\0'); + file[mir_tstrlen(file) - 4] = _T('\0'); dicts.insert(new HunspellDictionary(lang, file, user_path, source)); } } diff --git a/plugins/SpellChecker/src/options.cpp b/plugins/SpellChecker/src/options.cpp index cba883cb3a..99f9348962 100644 --- a/plugins/SpellChecker/src/options.cpp +++ b/plugins/SpellChecker/src/options.cpp @@ -95,7 +95,7 @@ void LoadOptions() DBVARIANT dbv;
if (!db_get_ts(NULL, MODULE_NAME, "DefaultLanguage", &dbv)) {
- lstrcpyn(opts.default_language, dbv.ptszVal, SIZEOF(opts.default_language));
+ mir_tstrncpy(opts.default_language, dbv.ptszVal, SIZEOF(opts.default_language));
db_free(&dbv);
}
@@ -105,7 +105,7 @@ void LoadOptions() break;
if (i >= languages.getCount())
- lstrcpy(opts.default_language, languages[0]->language);
+ mir_tstrcpy(opts.default_language, languages[0]->language);
}
static void DrawItem(HWND hwndDlg, LPDRAWITEMSTRUCT lpdis, Dictionary *dict)
@@ -152,7 +152,7 @@ static void DrawItem(HWND hwndDlg, LPDRAWITEMSTRUCT lpdis, Dictionary *dict) rc.right = lpdis->rcItem.right - 2;
rc.top = (lpdis->rcItem.bottom + lpdis->rcItem.top - tm.tmHeight) / 2;
rc.bottom = rc.top + tm.tmHeight;
- DrawText(lpdis->hDC, dict->full_name, lstrlen(dict->full_name), &rc, DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE);
+ DrawText(lpdis->hDC, dict->full_name, mir_tstrlen(dict->full_name), &rc, DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE);
// Restore old colors
SetTextColor(lpdis->hDC, clrfore);
@@ -215,7 +215,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP sel = 0;
db_set_ts(NULL, MODULE_NAME, "DefaultLanguage",
(TCHAR *) languages[sel]->language);
- lstrcpy(opts.default_language, languages[sel]->language);
+ mir_tstrcpy(opts.default_language, languages[sel]->language);
}
}
break;
@@ -329,7 +329,7 @@ static void SaveNewReplacements(BOOL canceled, Dictionary *dict, AutoreplaceData *data = (AutoreplaceData *) param;
- if (lstrlen(original_find) > 0)
+ if (mir_tstrlen(original_find) > 0)
data->RemoveWord(original_find);
data->AddWord(find, replace, useVariables);
@@ -352,7 +352,7 @@ static void ShowAddReplacement(HWND hwndDlg, int item = -1) else
ListView_GetItemText(GetDlgItem(hwndDlg, IDC_REPLACEMENTS), item, 0, find, SIZEOF(find));
- if (lstrlen(find) > 0) {
+ if (mir_tstrlen(find) > 0) {
AutoReplacement &ar = data->autoReplaceMap[find];
replace = ar.replace.c_str();
useVariables = ar.useVariables;
diff --git a/plugins/SpellChecker/src/utils.cpp b/plugins/SpellChecker/src/utils.cpp index d4b3fa7138..6b29b3335e 100644 --- a/plugins/SpellChecker/src/utils.cpp +++ b/plugins/SpellChecker/src/utils.cpp @@ -279,7 +279,7 @@ int CheckTextLine(Dialog *dlg, int line, TextParser *parser, int errors = 0;
TCHAR text[1024];
dlg->re->GetLine(line, text, SIZEOF(text));
- int len = lstrlen(text);
+ int len = mir_tstrlen(text);
int first_char = dlg->re->GetFirstCharOfLine(line);
// Now lets get the words
@@ -368,7 +368,7 @@ int CheckTextLine(Dialog *dlg, int line, TextParser *parser, if (dif != 0) {
// Read line again
dlg->re->GetLine(line, text, SIZEOF(text));
- len = lstrlen(text);
+ len = mir_tstrlen(text);
int old_first_char = first_char;
first_char = dlg->re->GetFirstCharOfLine(line);
@@ -689,7 +689,7 @@ int GetClosestLanguage(TCHAR *lang_name) // Try searching by the prefix only
TCHAR lang[128];
- lstrcpyn(lang, lang_name, SIZEOF(lang));
+ mir_tstrncpy(lang, lang_name, SIZEOF(lang));
TCHAR *p = _tcschr(lang, _T('_'));
if (p != NULL)
@@ -701,7 +701,7 @@ int GetClosestLanguage(TCHAR *lang_name) return i;
// Now try any suffix
- size_t len = lstrlen(lang);
+ size_t len = mir_tstrlen(lang);
for (i = 0; i < languages.getCount(); i++) {
TCHAR *p = _tcschr(languages[i]->language, _T('_'));
if (p == NULL)
@@ -747,7 +747,7 @@ void GetUserProtoLanguageSetting(Dialog *dlg, MCONTACT hContact, char *group, ch if (lstrcmpi(dict->localized_name, lang) == 0
|| lstrcmpi(dict->english_name, lang) == 0
|| lstrcmpi(dict->language, lang) == 0) {
- lstrcpyn(dlg->lang_name, dict->language, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, dict->language, SIZEOF(dlg->lang_name));
break;
}
}
@@ -790,18 +790,18 @@ void GetContactLanguage(Dialog *dlg) if (dlg->hContact == NULL) {
if (!db_get_ts(NULL, MODULE_NAME, dlg->name, &dbv)) {
- lstrcpyn(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
db_free(&dbv);
}
}
else {
if (!db_get_ts(dlg->hContact, MODULE_NAME, "TalkLanguage", &dbv)) {
- lstrcpyn(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
db_free(&dbv);
}
if (dlg->lang_name[0] == _T('\0') && !db_get_ts(dlg->hContact, "eSpeak", "TalkLanguage", &dbv)) {
- lstrcpyn(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
db_free(&dbv);
}
@@ -810,12 +810,12 @@ void GetContactLanguage(Dialog *dlg) MCONTACT hMetaContact = db_mc_getMeta(dlg->hContact);
if (hMetaContact != NULL) {
if (!db_get_ts(hMetaContact, MODULE_NAME, "TalkLanguage", &dbv)) {
- lstrcpyn(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
db_free(&dbv);
}
if (dlg->lang_name[0] == _T('\0') && !db_get_ts(hMetaContact, "eSpeak", "TalkLanguage", &dbv)) {
- lstrcpyn(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
db_free(&dbv);
}
}
@@ -833,13 +833,13 @@ void GetContactLanguage(Dialog *dlg) // Use default lang
if (dlg->lang_name[0] == _T('\0'))
- lstrcpyn(dlg->lang_name, opts.default_language, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, opts.default_language, SIZEOF(dlg->lang_name));
}
int i = GetClosestLanguage(dlg->lang_name);
if (i < 0) {
// Lost a dict?
- lstrcpyn(dlg->lang_name, opts.default_language, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, opts.default_language, SIZEOF(dlg->lang_name));
i = GetClosestLanguage(dlg->lang_name);
}
@@ -1040,7 +1040,7 @@ void AppendSubmenu(HMENU hMenu, HMENU hSubMenu, TCHAR *name) mii.fType = MFT_STRING;
mii.hSubMenu = hSubMenu;
mii.dwTypeData = name;
- mii.cch = lstrlen(name);
+ mii.cch = mir_tstrlen(name);
InsertMenuItem(hMenu, 0, TRUE, &mii);
}
@@ -1057,7 +1057,7 @@ void AppendMenuItem(HMENU hMenu, int id, TCHAR *name, HICON hIcon, BOOL checked) mii.hbmpChecked = iconInfo.hbmColor;
mii.hbmpUnchecked = iconInfo.hbmColor;
mii.dwTypeData = name;
- mii.cch = lstrlen(name);
+ mii.cch = mir_tstrlen(name);
InsertMenuItem(hMenu, 0, TRUE, &mii);
}
@@ -1513,12 +1513,12 @@ LRESULT CALLBACK MenuWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) // Draw text
RECT rc_text = { 0, 0, 0xFFFF, 0xFFFF };
- DrawText(lpdis->hDC, dict->full_name, lstrlen(dict->full_name), &rc_text, DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE | DT_LEFT | DT_TOP | DT_CALCRECT);
+ DrawText(lpdis->hDC, dict->full_name, mir_tstrlen(dict->full_name), &rc_text, DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE | DT_LEFT | DT_TOP | DT_CALCRECT);
rc.right = lpdis->rcItem.right - 2;
rc.top = (lpdis->rcItem.bottom + lpdis->rcItem.top - (rc_text.bottom - rc_text.top)) / 2;
rc.bottom = rc.top + rc_text.bottom - rc_text.top;
- DrawText(lpdis->hDC, dict->full_name, lstrlen(dict->full_name), &rc, DT_END_ELLIPSIS | DT_NOPREFIX | DT_LEFT | DT_TOP | DT_SINGLELINE);
+ DrawText(lpdis->hDC, dict->full_name, mir_tstrlen(dict->full_name), &rc, DT_END_ELLIPSIS | DT_NOPREFIX | DT_LEFT | DT_TOP | DT_SINGLELINE);
// Restore old colors
SetTextColor(lpdis->hDC, clrfore);
@@ -1546,7 +1546,7 @@ LRESULT CALLBACK MenuWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) RECT rc = { 0, 0, 0xFFFF, 0xFFFF };
- DrawText(hdc, dict->full_name, lstrlen(dict->full_name), &rc, DT_NOPREFIX | DT_SINGLELINE | DT_LEFT | DT_TOP | DT_CALCRECT);
+ DrawText(hdc, dict->full_name, mir_tstrlen(dict->full_name), &rc, DT_NOPREFIX | DT_SINGLELINE | DT_LEFT | DT_TOP | DT_CALCRECT);
lpmis->itemHeight = max(ICON_SIZE, max(bmpChecked.bmHeight, rc.bottom));
lpmis->itemWidth = 2 + bmpChecked.bmWidth + 2 + ICON_SIZE + 4 + rc.right + 2;
@@ -1563,7 +1563,7 @@ LRESULT CALLBACK MenuWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) TCHAR* lstrtrim(TCHAR *str)
{
- int len = lstrlen(str);
+ int len = mir_tstrlen(str);
int i;
for (i = len - 1; i >= 0 && (str[i] == ' ' || str[i] == '\t'); --i);
|