From 2f261839b60692e33d0e160344d0d636d49c90ba Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 27 Jul 2016 14:23:31 +0000 Subject: less TCHARs git-svn-id: http://svn.miranda-ng.org/main/trunk@17138 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SpellChecker/src/RichEdit.cpp | 12 +++--- plugins/SpellChecker/src/ardialog.cpp | 4 +- plugins/SpellChecker/src/autoreplace.cpp | 6 +-- plugins/SpellChecker/src/dictionary.cpp | 66 +++++++++++++++---------------- plugins/SpellChecker/src/options.cpp | 16 ++++---- plugins/SpellChecker/src/spellchecker.cpp | 10 ++--- plugins/SpellChecker/src/utils.cpp | 50 +++++++++++------------ 7 files changed, 82 insertions(+), 82 deletions(-) (limited to 'plugins/SpellChecker/src') diff --git a/plugins/SpellChecker/src/RichEdit.cpp b/plugins/SpellChecker/src/RichEdit.cpp index 1317f767cd..e81e679606 100644 --- a/plugins/SpellChecker/src/RichEdit.cpp +++ b/plugins/SpellChecker/src/RichEdit.cpp @@ -201,17 +201,17 @@ wchar_t* RichEdit::GetText(int start, int end) const if (m_textDocument != NULL) { ITextRange *range; if (m_textDocument->Range(start, end, &range) != S_OK) - return mir_tstrdup(L""); + return mir_wstrdup(L""); BSTR text = NULL; if (FAILED(range->GetText(&text))) { if (text) ::SysFreeString(text); range->Release(); - return mir_tstrdup(L""); + return mir_wstrdup(L""); } - wchar_t *res = mir_u2t(text); + wchar_t *res = mir_wstrdup(text); range->Release(); ::SysFreeString(text); return res; @@ -241,7 +241,7 @@ void RichEdit::ReplaceSel(const wchar_t *new_text) SuspendUndo(); - FixSel(&m_old_sel, sel, mir_tstrlen(new_text)); + FixSel(&m_old_sel, sel, mir_wstrlen(new_text)); SendMessage(WM_SETREDRAW, FALSE, 0); SendMessage(EM_SETEVENTMASK, 0, m_old_mask & ~ENM_CHANGE); @@ -257,7 +257,7 @@ int RichEdit::Replace(int start, int end, const wchar_t *new_text) ReplaceSel(new_text); - int dif = FixSel(&sel, replace_sel, mir_tstrlen(new_text)); + int dif = FixSel(&sel, replace_sel, mir_wstrlen(new_text)); SetSel(sel); return dif; } @@ -270,7 +270,7 @@ int RichEdit::Insert(int pos, const wchar_t *text) ReplaceSel(text); - int dif = FixSel(&sel, replace_sel, mir_tstrlen(text)); + int dif = FixSel(&sel, replace_sel, mir_wstrlen(text)); SetSel(sel); return dif; } diff --git a/plugins/SpellChecker/src/ardialog.cpp b/plugins/SpellChecker/src/ardialog.cpp index 0b1a14fa56..f74058bcab 100644 --- a/plugins/SpellChecker/src/ardialog.cpp +++ b/plugins/SpellChecker/src/ardialog.cpp @@ -215,7 +215,7 @@ static INT_PTR CALLBACK AddReplacementDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa wchar_t find[256]; if (data->findReadOnly) - mir_tstrncpy(find, data->find.c_str(), _countof(find)); + mir_wstrncpy(find, data->find.c_str(), _countof(find)); else { GetDlgItemText(hwndDlg, IDC_OLD, find, _countof(find)); lstrtrim(find); @@ -231,7 +231,7 @@ static INT_PTR CALLBACK AddReplacementDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa else if (replace[0] == 0) MessageBox(hwndDlg, TranslateT("The correction can't be empty!"), TranslateT("Wrong Correction"), MB_OK | MB_ICONERROR); - else if (mir_tstrcmp(find, replace) == 0) + else if (mir_wstrcmp(find, replace) == 0) MessageBox(hwndDlg, TranslateT("The correction can't be equal to the wrong word!"), TranslateT("Wrong Correction"), MB_OK | MB_ICONERROR); else { diff --git a/plugins/SpellChecker/src/autoreplace.cpp b/plugins/SpellChecker/src/autoreplace.cpp index a3ad88e928..de4350eed3 100644 --- a/plugins/SpellChecker/src/autoreplace.cpp +++ b/plugins/SpellChecker/src/autoreplace.cpp @@ -33,7 +33,7 @@ AutoReplacement::AutoReplacement(const wchar_t *replace, BOOL useVariables) AutoReplaceMap::AutoReplaceMap(wchar_t *aFilename, Dictionary *dict) { m_dict = dict; - mir_tstrncpy(m_filename, aFilename, _countof(m_filename)); + mir_wstrncpy(m_filename, aFilename, _countof(m_filename)); loadAutoReplaceMap(); } @@ -143,7 +143,7 @@ wchar_t* AutoReplaceMap::autoReplace(const wchar_t * word) to = wcsdup(ar.replace.c_str()); // Wich case to use? - size_t len = mir_tstrlen(word); + size_t len = mir_wstrlen(word); size_t i; for (i = 0; i < len; i++) if (IsCharLower(word[i])) @@ -167,7 +167,7 @@ wchar_t* AutoReplaceMap::autoReplace(const wchar_t * word) wchar_t* AutoReplaceMap::filterText(const wchar_t *find) { wchar_t *ret = wcsdup(find); - int len = mir_tstrlen(ret); + int len = mir_wstrlen(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 ee491e541c..10f03b5c92 100644 --- a/plugins/SpellChecker/src/dictionary.cpp +++ b/plugins/SpellChecker/src/dictionary.cpp @@ -365,7 +365,7 @@ protected: void loadCustomDict() { wchar_t filename[1024]; - mir_sntprintf(filename, L"%s\\%s.cdic", userPath, language); + mir_snwprintf(filename, L"%s\\%s.cdic", userPath, language); FILE *file = _wfopen(filename, L"rb"); if (file != NULL) { @@ -393,7 +393,7 @@ protected: CreateDirectoryTreeT(userPath); wchar_t filename[1024]; - mir_sntprintf(filename, L"%s\\%s.cdic", userPath, language); + mir_snwprintf(filename, L"%s\\%s.cdic", userPath, language); FILE *file = _wfopen(filename, L"ab"); if (file != NULL) { @@ -441,13 +441,13 @@ protected: public: HunspellDictionary(wchar_t *aLanguage, wchar_t *aFileWithoutExtension, wchar_t *anUserPath, wchar_t *aSource) { - mir_tstrncpy(language, aLanguage, _countof(language)); - mir_tstrncpy(fileWithoutExtension, aFileWithoutExtension, _countof(fileWithoutExtension)); - mir_tstrncpy(userPath, anUserPath, _countof(userPath)); + mir_wstrncpy(language, aLanguage, _countof(language)); + mir_wstrncpy(fileWithoutExtension, aFileWithoutExtension, _countof(fileWithoutExtension)); + mir_wstrncpy(userPath, anUserPath, _countof(userPath)); if (aSource == NULL) source[0] = '\0'; else - mir_tstrncpy(source, aSource, _countof(source)); + mir_wstrncpy(source, aSource, _countof(source)); loaded = LANGUAGE_NOT_LOADED; localized_name[0] = '\0'; @@ -469,14 +469,14 @@ public: wchar_t * merge(wchar_t * s1, wchar_t *s2) { - int len1 = (s1 == NULL ? 0 : mir_tstrlen(s1)); - int len2 = (s2 == NULL ? 0 : mir_tstrlen(s2)); + int len1 = (s1 == NULL ? 0 : mir_wstrlen(s1)); + int len2 = (s2 == NULL ? 0 : mir_wstrlen(s2)); wchar_t *ret; if (len1 > 0 && len2 > 0) { ret = (wchar_t *)malloc(sizeof(wchar_t) * (len1 + len2 + 1)); - mir_tstrncpy(ret, s1, len1 + 1); - mir_tstrncpy(&ret[len1], s2, len2 + 1); + mir_wstrncpy(ret, s1, len1 + 1); + mir_wstrncpy(&ret[len1], s2, len2 + 1); FREE(s1); FREE(s2); @@ -498,7 +498,7 @@ public: } // Remove duplicated chars - int last = mir_tstrlen(ret) - 1; + int last = mir_wstrlen(ret) - 1; for (int i = 0; i <= last; i++) { wchar_t c = ret[i]; for (int j = last; j > i; j--) { @@ -734,11 +734,11 @@ BOOL CALLBACK EnumLocalesProc(LPTSTR lpLocaleString) GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SISO3166CTRYNAME, end, _countof(end)); wchar_t name[64]; - mir_sntprintf(name, L"%s_%s", ini, end); + mir_snwprintf(name, L"%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) { + if (mir_wstrcmpi(dict->language, name) == 0) { GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SENGLANGUAGE, dict->english_name, _countof(dict->english_name)); GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SLANGUAGE, dict->localized_name, _countof(dict->localized_name)); @@ -752,15 +752,15 @@ BOOL CALLBACK EnumLocalesProc(LPTSTR lpLocaleString) wchar_t localName[1024]; if (country[0] != 0) - mir_sntprintf(localName, L"%s (%s)", dict->english_name, country); + mir_snwprintf(localName, L"%s (%s)", dict->english_name, country); else - mir_tstrncpy(localName, dict->english_name, _countof(localName)); + mir_wstrncpy(localName, dict->english_name, _countof(localName)); - mir_tstrncpy(dict->localized_name, TranslateTS(localName), _countof(dict->localized_name)); + mir_wstrncpy(dict->localized_name, TranslateTS(localName), _countof(dict->localized_name)); } if (dict->localized_name[0] != 0) { - mir_sntprintf(dict->full_name, L"%s [%s]", dict->localized_name, dict->language); + mir_snwprintf(dict->full_name, L"%s [%s]", dict->localized_name, dict->language); } break; } @@ -784,24 +784,24 @@ void GetDictsInfo(LIST &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, _countof(dict->localized_name)); + mir_wstrncpy(dict->localized_name, dbv.ptszVal, _countof(dict->localized_name)); db_free(&dbv); } if (dict->localized_name[0] == '\0') { 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), _countof(dict->localized_name)); + if (!mir_wstrcmp(aditionalLanguages[j].language, dict->language)) { + mir_wstrncpy(dict->localized_name, TranslateTS(aditionalLanguages[j].localized_name), _countof(dict->localized_name)); break; } } } if (dict->localized_name[0] != '\0') { - mir_sntprintf(dict->full_name, L"%s [%s]", dict->localized_name, dict->language); + mir_snwprintf(dict->full_name, L"%s [%s]", dict->localized_name, dict->language); } else { - mir_tstrncpy(dict->full_name, dict->language, _countof(dict->full_name)); + mir_wstrncpy(dict->full_name, dict->language, _countof(dict->full_name)); } } } @@ -812,7 +812,7 @@ void GetHunspellDictionariesFromFolder(LIST &dicts, wchar_t *path, w { // Load the language files and create an array with then wchar_t file[1024] = { 0 }; - mir_sntprintf(file, L"%s\\*.dic", path); + mir_snwprintf(file, L"%s\\*.dic", path); BOOL found = FALSE; @@ -820,7 +820,7 @@ void GetHunspellDictionariesFromFolder(LIST &dicts, wchar_t *path, w HANDLE hFFD = FindFirstFile(file, &ffd); if (hFFD != INVALID_HANDLE_VALUE) { do { - mir_sntprintf(file, L"%s\\%s", path, ffd.cFileName); + mir_snwprintf(file, L"%s\\%s", path, ffd.cFileName); // Check .dic DWORD attrib = GetFileAttributes(file); @@ -828,29 +828,29 @@ void GetHunspellDictionariesFromFolder(LIST &dicts, wchar_t *path, w continue; // See if .aff exists too - mir_tstrcpy(&file[mir_tstrlen(file) - 4], L".aff"); + mir_wstrcpy(&file[mir_wstrlen(file) - 4], L".aff"); attrib = GetFileAttributes(file); if (attrib == 0xFFFFFFFF || (attrib & FILE_ATTRIBUTE_DIRECTORY)) continue; - ffd.cFileName[mir_tstrlen(ffd.cFileName) - 4] = '\0'; + ffd.cFileName[mir_wstrlen(ffd.cFileName) - 4] = '\0'; wchar_t *lang = ffd.cFileName; // Replace - for _ - for (size_t i = 0; i < mir_tstrlen(lang); i++) + for (size_t i = 0; i < mir_wstrlen(lang); i++) if (lang[i] == '-') lang[i] = '_'; // Check if dict is new bool exists = false; for (int i = 0; i < dicts.getCount() && !exists; i++) - if (mir_tstrcmp(dicts[i]->language, lang) == 0) + if (mir_wstrcmp(dicts[i]->language, lang) == 0) exists = true; if (!exists) { found = TRUE; - file[mir_tstrlen(file) - 4] = '\0'; + file[mir_wstrlen(file) - 4] = '\0'; dicts.insert(new HunspellDictionary(lang, file, user_path, source)); } } while (FindNextFile(hFFD, &ffd)); @@ -870,7 +870,7 @@ void GetAvaibleDictionaries(LIST &dicts, wchar_t *path, wchar_t *use // Get other apps dicts for (int i = 0; i < _countof(otherHunspellApps); i++) { wchar_t key[1024]; - mir_sntprintf(key, APPPATH, otherHunspellApps[i].key); + mir_snwprintf(key, APPPATH, otherHunspellApps[i].key); HKEY hKey = 0; LONG lResult = 0; @@ -895,7 +895,7 @@ void GetAvaibleDictionaries(LIST &dicts, wchar_t *path, wchar_t *use key[cchValue] = 0; wchar_t *pos; if (pos = wcsrchr(key, '\\')) { - if (!mir_tstrcmpi(&pos[1], otherHunspellApps[i].key)) { + if (!mir_wstrcmpi(&pos[1], otherHunspellApps[i].key)) { pos[0] = 0; lResult = ERROR_SUCCESS; break; @@ -908,7 +908,7 @@ void GetAvaibleDictionaries(LIST &dicts, wchar_t *path, wchar_t *use if (ERROR_SUCCESS == lResult) { wchar_t folder[1024]; - mir_sntprintf(folder, L"%s\\Dictionaries", key); + mir_snwprintf(folder, L"%s\\Dictionaries", key); GetHunspellDictionariesFromFolder(languages, folder, user_path, otherHunspellApps[i].name); } @@ -923,7 +923,7 @@ void GetAvaibleDictionaries(LIST &dicts, wchar_t *path, wchar_t *use // Sort dicts for (int i = 0; i < dicts.getCount(); i++) { for (int j = i + 1; j < dicts.getCount(); j++) { - if (mir_tstrcmp(dicts[i]->full_name, dicts[j]->full_name) > 0) { + if (mir_wstrcmp(dicts[i]->full_name, dicts[j]->full_name) > 0) { Dictionary *dict = dicts[i]; sl->items[i] = dicts[j]; sl->items[j] = dict; diff --git a/plugins/SpellChecker/src/options.cpp b/plugins/SpellChecker/src/options.cpp index c0bc78ab5a..21309b391a 100644 --- a/plugins/SpellChecker/src/options.cpp +++ b/plugins/SpellChecker/src/options.cpp @@ -94,17 +94,17 @@ void LoadOptions() DBVARIANT dbv; if (!db_get_ts(NULL, MODULE_NAME, "DefaultLanguage", &dbv)) { - mir_tstrncpy(opts.default_language, dbv.ptszVal, _countof(opts.default_language)); + mir_wstrncpy(opts.default_language, dbv.ptszVal, _countof(opts.default_language)); db_free(&dbv); } int i; for (i = 0; i < languages.getCount(); i++) - if (mir_tstrcmp(languages[i]->language, opts.default_language) == 0) + if (mir_wstrcmp(languages[i]->language, opts.default_language) == 0) break; if (i >= languages.getCount()) - mir_tstrcpy(opts.default_language, languages[0]->language); + mir_wstrcpy(opts.default_language, languages[0]->language); } static void DrawItem(LPDRAWITEMSTRUCT lpdis, Dictionary *dict) @@ -179,7 +179,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage(hwndDlg, IDC_DEF_LANG, CB_ADDSTRING, 0, (LPARAM)languages[i]->full_name); SendDlgItemMessage(hwndDlg, IDC_DEF_LANG, CB_SETITEMDATA, i, (LPARAM)languages[i]); - if (!mir_tstrcmp(opts.default_language, languages[i]->language)) + if (!mir_wstrcmp(opts.default_language, languages[i]->language)) sel = i; } SendDlgItemMessage(hwndDlg, IDC_DEF_LANG, CB_SETCURSEL, sel, 0); @@ -214,7 +214,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP sel = 0; db_set_ts(NULL, MODULE_NAME, "DefaultLanguage", (wchar_t *)languages[sel]->language); - mir_tstrcpy(opts.default_language, languages[sel]->language); + mir_wstrcpy(opts.default_language, languages[sel]->language); } } break; @@ -328,7 +328,7 @@ static void SaveNewReplacements(BOOL canceled, Dictionary*, AutoreplaceData *data = (AutoreplaceData *)param; - if (mir_tstrlen(original_find) > 0) + if (mir_wstrlen(original_find) > 0) data->RemoveWord(original_find); data->AddWord(find, replace, useVariables); @@ -351,7 +351,7 @@ static void ShowAddReplacement(HWND hwndDlg, int item = -1) else ListView_GetItemText(GetDlgItem(hwndDlg, IDC_REPLACEMENTS), item, 0, find, _countof(find)); - if (mir_tstrlen(find) > 0) { + if (mir_wstrlen(find) > 0) { AutoReplacement &ar = data->autoReplaceMap[find]; replace = ar.replace.c_str(); useVariables = ar.useVariables; @@ -378,7 +378,7 @@ static INT_PTR CALLBACK AutoreplaceDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam SendDlgItemMessage(hwndDlg, IDC_LANGUAGE, CB_ADDSTRING, 0, (LPARAM)p->full_name); SendDlgItemMessage(hwndDlg, IDC_LANGUAGE, CB_SETITEMDATA, i, (LPARAM)new AutoreplaceData(p)); - if (!mir_tstrcmp(opts.default_language, p->language)) + if (!mir_wstrcmp(opts.default_language, p->language)) sel = i; } SendDlgItemMessage(hwndDlg, IDC_LANGUAGE, CB_SETCURSEL, sel, 0); diff --git a/plugins/SpellChecker/src/spellchecker.cpp b/plugins/SpellChecker/src/spellchecker.cpp index e6217118c4..f40a0a6ee3 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; wchar_t tmp[128]; - mir_sntprintf(tmp, L"%s - %s", TranslateT("Spell Checker"), languages[i]->full_name); + mir_snwprintf(tmp, L"%s - %s", TranslateT("Spell Checker"), languages[i]->full_name); sid.tszTooltip = tmp; HICON hIcon = (opts.use_flags) ? IcoLib_GetIconByHandle(languages[i]->hIcolib) : IcoLib_GetIcon("spellchecker_enabled"); @@ -134,7 +134,7 @@ static int ModulesLoaded(WPARAM, LPARAM) if (opts.use_flags) { // Load flags dll wchar_t flag_file[MAX_PATH]; - mir_sntprintf(flag_file, L"%s\\flags_icons.dll", flagsDllFolder); + mir_snwprintf(flag_file, L"%s\\flags_icons.dll", flagsDllFolder); HMODULE hFlagsDll = LoadLibraryEx(flag_file, NULL, LOAD_LIBRARY_AS_DATAFILE); wchar_t path[MAX_PATH]; @@ -184,10 +184,10 @@ static int ModulesLoaded(WPARAM, LPARAM) Dictionary *dict = languages[j]; wchar_t filename[MAX_PATH]; - mir_sntprintf(filename, L"%s\\%s.ar", customDictionariesFolder, dict->language); + mir_snwprintf(filename, L"%s\\%s.ar", customDictionariesFolder, dict->language); dict->autoReplace = new AutoReplaceMap(filename, dict); - if (mir_tstrcmp(dict->language, opts.default_language) == 0) + if (mir_wstrcmp(dict->language, opts.default_language) == 0) dict->load(); } @@ -205,7 +205,7 @@ static int ModulesLoaded(WPARAM, LPARAM) sid.dwId = i; wchar_t tmp[128]; - mir_sntprintf(tmp, L"%s - %s", TranslateT("Spell Checker"), languages[i]->full_name); + mir_snwprintf(tmp, L"%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"); Srmm_AddIcon(&sid); diff --git a/plugins/SpellChecker/src/utils.cpp b/plugins/SpellChecker/src/utils.cpp index 7df9b00d14..a3cab0e333 100644 --- a/plugins/SpellChecker/src/utils.cpp +++ b/plugins/SpellChecker/src/utils.cpp @@ -276,7 +276,7 @@ int CheckTextLine(Dialog *dlg, int line, TextParser *parser, int errors = 0; wchar_t text[1024]; dlg->re->GetLine(line, text, _countof(text)); - int len = mir_tstrlen(text); + int len = mir_wstrlen(text); int first_char = dlg->re->GetFirstCharOfLine(line); // Now lets get the words @@ -365,7 +365,7 @@ int CheckTextLine(Dialog *dlg, int line, TextParser *parser, if (dif != 0) { // Read line again dlg->re->GetLine(line, text, _countof(text)); - len = mir_tstrlen(text); + len = mir_wstrlen(text); int old_first_char = first_char; first_char = dlg->re->GetFirstCharOfLine(line); @@ -440,7 +440,7 @@ void ToLocaleID(wchar_t *szKLName, size_t size) GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SISO639LANGNAME, ini, _countof(ini)); GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SISO3166CTRYNAME, end, _countof(end)); - mir_sntprintf(szKLName, size, L"%s_%s", ini, end); + mir_snwprintf(szKLName, size, L"%s_%s", ini, end); } void LoadDictFromKbdl(Dialog *dlg) @@ -449,7 +449,7 @@ void LoadDictFromKbdl(Dialog *dlg) // Use default input language HKL hkl = GetKeyboardLayout(0); - mir_sntprintf(szKLName, L"%x", (int)LOWORD(hkl)); + mir_snwprintf(szKLName, L"%x", (int)LOWORD(hkl)); ToLocaleID(szKLName, _countof(szKLName)); int d = GetClosestLanguage(szKLName); @@ -501,7 +501,7 @@ LRESULT CALLBACK OwnerProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) int errors = TimerCheck(dlg, TRUE); if (errors > 0) { wchar_t text[500]; - mir_sntprintf(text, TranslateT("There are %d spelling errors. Are you sure you want to send this message?"), errors); + mir_snwprintf(text, TranslateT("There are %d spelling errors. Are you sure you want to send this message?"), errors); if (MessageBox(hwnd, text, TranslateT("Spell Checker"), MB_ICONQUESTION | MB_YESNO) == IDNO) return TRUE; } @@ -680,12 +680,12 @@ int GetClosestLanguage(wchar_t *lang_name) // Search the language by name for (i = 0; i < languages.getCount(); i++) - if (mir_tstrcmpi(languages[i]->language, lang_name) == 0) + if (mir_wstrcmpi(languages[i]->language, lang_name) == 0) return i; // Try searching by the prefix only wchar_t lang[128]; - mir_tstrncpy(lang, lang_name, _countof(lang)); + mir_wstrncpy(lang, lang_name, _countof(lang)); { wchar_t *p = wcschr(lang, '_'); if (p != NULL) *p = '\0'; @@ -693,11 +693,11 @@ int GetClosestLanguage(wchar_t *lang_name) // First check if there is a language that is only the prefix for (i = 0; i < languages.getCount(); i++) - if (mir_tstrcmpi(languages[i]->language, lang) == 0) + if (mir_wstrcmpi(languages[i]->language, lang) == 0) return i; // Now try any suffix - size_t len = mir_tstrlen(lang); + size_t len = mir_wstrlen(lang); for (i = 0; i < languages.getCount(); i++) { wchar_t *p = wcschr(languages[i]->language, '_'); if (p == NULL) @@ -738,10 +738,10 @@ void GetUserProtoLanguageSetting(Dialog *dlg, MCONTACT hContact, char *group, ch for (int i = 0; i < languages.getCount(); i++) { Dictionary *dict = languages[i]; - 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, _countof(dlg->lang_name)); + if (mir_wstrcmpi(dict->localized_name, lang) == 0 + || mir_wstrcmpi(dict->english_name, lang) == 0 + || mir_wstrcmpi(dict->language, lang) == 0) { + mir_wstrncpy(dlg->lang_name, dict->language, _countof(dlg->lang_name)); break; } } @@ -782,18 +782,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, _countof(dlg->lang_name)); + mir_wstrncpy(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, _countof(dlg->lang_name)); + mir_wstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name)); db_free(&dbv); } if (dlg->lang_name[0] == '\0' && !db_get_ts(dlg->hContact, "eSpeak", "TalkLanguage", &dbv)) { - mir_tstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name)); + mir_wstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name)); db_free(&dbv); } @@ -802,12 +802,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, _countof(dlg->lang_name)); + mir_wstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name)); db_free(&dbv); } if (dlg->lang_name[0] == '\0' && !db_get_ts(hMetaContact, "eSpeak", "TalkLanguage", &dbv)) { - mir_tstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name)); + mir_wstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name)); db_free(&dbv); } } @@ -825,13 +825,13 @@ void GetContactLanguage(Dialog *dlg) // Use default lang if (dlg->lang_name[0] == '\0') - mir_tstrncpy(dlg->lang_name, opts.default_language, _countof(dlg->lang_name)); + mir_wstrncpy(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, _countof(dlg->lang_name)); + mir_wstrncpy(dlg->lang_name, opts.default_language, _countof(dlg->lang_name)); i = GetClosestLanguage(dlg->lang_name); } @@ -1035,7 +1035,7 @@ void AppendSubmenu(HMENU hMenu, HMENU hSubMenu, wchar_t *name) mii.fType = MFT_STRING; mii.hSubMenu = hSubMenu; mii.dwTypeData = name; - mii.cch = mir_tstrlen(name); + mii.cch = mir_wstrlen(name); InsertMenuItem(hMenu, 0, TRUE, &mii); } @@ -1053,7 +1053,7 @@ void AppendMenuItem(HMENU hMenu, int id, wchar_t *name, HICON hIcon, BOOL checke mii.hbmpChecked = iconInfo.hbmColor; mii.hbmpUnchecked = iconInfo.hbmColor; mii.dwTypeData = name; - mii.cch = mir_tstrlen(name); + mii.cch = mir_wstrlen(name); InsertMenuItem(hMenu, 0, TRUE, &mii); } @@ -1117,7 +1117,7 @@ void AddMenuForWord(Dialog *dlg, wchar_t *word, CHARRANGE &pos, HMENU hMenu, BOO InsertMenu(hMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, 0); wchar_t text[128]; - mir_sntprintf(text, TranslateT("Wrong word: %s"), word); + mir_snwprintf(text, TranslateT("Wrong word: %s"), word); InsertMenu(hMenu, 0, MF_BYPOSITION, 0, text); } } @@ -1551,7 +1551,7 @@ LRESULT CALLBACK MenuWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) wchar_t* lstrtrim(wchar_t *str) { - int len = mir_tstrlen(str); + int len = mir_wstrlen(str); int i; for (i = len - 1; i >= 0 && (str[i] == ' ' || str[i] == '\t'); --i); @@ -1572,7 +1572,7 @@ BOOL lstreq(wchar_t *a, wchar_t *b, size_t len) { a = CharLower(wcsdup(a)); b = CharLower(wcsdup(b)); - BOOL ret = len ? !wcsncmp(a, b, len) : !mir_tstrcmp(a, b); + BOOL ret = len ? !wcsncmp(a, b, len) : !mir_wstrcmp(a, b); free(a); free(b); return ret; -- cgit v1.2.3