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/ChangeKeyboardLayout/src/hook_events.cpp | 6 +- plugins/ChangeKeyboardLayout/src/options.cpp | 8 +-- .../ChangeKeyboardLayout/src/text_operations.cpp | 66 +++++++++++----------- 3 files changed, 40 insertions(+), 40 deletions(-) (limited to 'plugins/ChangeKeyboardLayout/src') diff --git a/plugins/ChangeKeyboardLayout/src/hook_events.cpp b/plugins/ChangeKeyboardLayout/src/hook_events.cpp index c0d2b34140..be5c8f100d 100644 --- a/plugins/ChangeKeyboardLayout/src/hook_events.cpp +++ b/plugins/ChangeKeyboardLayout/src/hook_events.cpp @@ -101,14 +101,14 @@ int ModulesLoaded(WPARAM, LPARAM) for (int i = 0; i < bLayNum; i++) { LPTSTR ptszCurrLayout = GenerateLayoutString(hklLayouts[i]); LPSTR ptszTemp = GetNameOfLayout(hklLayouts[i]); - ptrT tszValue(db_get_tsa(NULL, ModuleName, ptszTemp)); + ptrW tszValue(db_get_tsa(NULL, ModuleName, ptszTemp)); if (tszValue == 0) ptszLayStrings[i] = ptszCurrLayout; - else if (!mir_tstrcmp(tszValue, ptszEmptySting)) + else if (!mir_wstrcmp(tszValue, ptszEmptySting)) ptszLayStrings[i] = ptszCurrLayout; else { ptszLayStrings[i] = tszValue.detach(); - if (!mir_tstrcmp(ptszCurrLayout, ptszLayStrings[i])) + if (!mir_wstrcmp(ptszCurrLayout, ptszLayStrings[i])) db_unset(NULL, ModuleName, ptszTemp); mir_free(ptszCurrLayout); } diff --git a/plugins/ChangeKeyboardLayout/src/options.cpp b/plugins/ChangeKeyboardLayout/src/options.cpp index 1f1a5af025..a610cef0fe 100644 --- a/plugins/ChangeKeyboardLayout/src/options.cpp +++ b/plugins/ChangeKeyboardLayout/src/options.cpp @@ -205,12 +205,12 @@ INT_PTR CALLBACK DlgMainProcOptions(HWND hWnd, UINT uiMessage, WPARAM wParam, LP GetDlgItemText(hWnd, IDC_EDIT_SET, ptszFormLay, MaxTextSize); i = SendDlgItemMessage(hWnd, IDC_COMBO_LANG, CB_GETCURSEL, 0, 0); ptszMemLay = ptszLayStrings[i]; - if (mir_tstrcmp(ptszMemLay, ptszFormLay) != 0) { - mir_tstrcpy(ptszMemLay, ptszFormLay); + if (mir_wstrcmp(ptszMemLay, ptszFormLay) != 0) { + mir_wstrcpy(ptszMemLay, ptszFormLay); ptszGenLay = GenerateLayoutString(hklLayouts[i]); pszNameLay = GetNameOfLayout(hklLayouts[i]); - if (mir_tstrcmp(ptszMemLay, ptszGenLay) != 0) + if (mir_wstrcmp(ptszMemLay, ptszGenLay) != 0) db_set_ts(NULL, ModuleName, pszNameLay, ptszMemLay); else db_unset(NULL, ModuleName, pszNameLay); @@ -382,7 +382,7 @@ INT_PTR CALLBACK DlgPopupsProcOptions(HWND hWnd, UINT uiMessage, WPARAM wParam, pdtData.iSeconds = poOptionsTemp.bTimeout; break; } - mir_tstrcpy(ptszPopupPreviewText, pdtData.lptzText); + mir_wstrcpy(ptszPopupPreviewText, pdtData.lptzText); pdtData.PluginData = ptszPopupPreviewText; pdtData.lchIcon = hPopupIcon; poOptions.paActions[0].lchIcon = hCopyIcon; diff --git a/plugins/ChangeKeyboardLayout/src/text_operations.cpp b/plugins/ChangeKeyboardLayout/src/text_operations.cpp index ed1cdf4460..c8c44b1042 100644 --- a/plugins/ChangeKeyboardLayout/src/text_operations.cpp +++ b/plugins/ChangeKeyboardLayout/src/text_operations.cpp @@ -31,7 +31,7 @@ LPTSTR GeTStringFromStreamData(EditStreamData *esd) LPTSTR ptszOutText = (LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t)); LPTSTR ptszTemp = (wchar_t*)esd->pbBuff; - for (i = k = 0; i < mir_tstrlen(ptszTemp); i++) { + for (i = k = 0; i < mir_wstrlen(ptszTemp); i++) { if ((ptszTemp[i] == 0x0A) || (ptszTemp[i] == 0x2028)) ptszOutText[k++] = 0x0D; else if (ptszTemp[i] == 0x0D) { @@ -52,8 +52,8 @@ BOOL CopyTextToClipboard(LPTSTR ptszText) return FALSE; EmptyClipboard(); - HGLOBAL hCopy = GlobalAlloc(GMEM_MOVEABLE, (mir_tstrlen(ptszText) + 1)*sizeof(wchar_t)); - mir_tstrcpy((wchar_t*)GlobalLock(hCopy), ptszText); + HGLOBAL hCopy = GlobalAlloc(GMEM_MOVEABLE, (mir_wstrlen(ptszText) + 1)*sizeof(wchar_t)); + mir_wstrcpy((wchar_t*)GlobalLock(hCopy), ptszText); GlobalUnlock(hCopy); SetClipboardData(CF_UNICODETEXT, hCopy); CloseClipboard(); @@ -97,7 +97,7 @@ LPTSTR GenerateLayoutString(HKL hklLayout) ptszTemp[0] = 0; DWORD i; - for (i = 0; i < mir_tstrlen(ptszKeybEng); i++) { + for (i = 0; i < mir_wstrlen(ptszKeybEng); i++) { SHORT shVirtualKey = VkKeyScanEx(ptszKeybEng[i], hklEng); UINT iScanCode = MapVirtualKeyEx(shVirtualKey & 0x00FF, 0, hklEng); @@ -139,9 +139,9 @@ LPTSTR GetLayoutString(HKL hklLayout) LPTSTR ChangeTextCase(LPCTSTR ptszInText) { LPTSTR ptszOutText = (LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t)); - mir_tstrcpy(ptszOutText, ptszInText); + mir_wstrcpy(ptszOutText, ptszInText); - for (DWORD i = 0; i < mir_tstrlen(ptszInText); i++) { + for (DWORD i = 0; i < mir_wstrlen(ptszInText); i++) { CharUpperBuff(&ptszOutText[i], 1); if (ptszOutText[i] == ptszInText[i]) CharLowerBuff(&ptszOutText[i], 1); @@ -152,7 +152,7 @@ LPTSTR ChangeTextCase(LPCTSTR ptszInText) LPTSTR ChangeTextLayout(LPCTSTR ptszInText, HKL hklCurLay, HKL hklToLay, BOOL TwoWay) { LPTSTR ptszOutText = (LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t)); - mir_tstrcpy(ptszOutText, ptszInText); + mir_wstrcpy(ptszOutText, ptszInText); if (hklCurLay == NULL || hklToLay == NULL) return ptszOutText; @@ -162,20 +162,20 @@ LPTSTR ChangeTextLayout(LPCTSTR ptszInText, HKL hklCurLay, HKL hklToLay, BOOL Tw if (ptszKeybCur == 0 || ptszKeybNext == 0) return ptszOutText; - for (DWORD i = 0; i < mir_tstrlen(ptszInText); i++) { + for (DWORD i = 0; i < mir_wstrlen(ptszInText); i++) { BOOL Found = FALSE; - for (DWORD j = 0; j < mir_tstrlen(ptszKeybCur) && !Found; j++) + for (DWORD j = 0; j < mir_wstrlen(ptszKeybCur) && !Found; j++) if (ptszKeybCur[j] == ptszInText[i]) { Found = TRUE; - if (mir_tstrlen(ptszKeybNext) >= j) + if (mir_wstrlen(ptszKeybNext) >= j) ptszOutText[i] = ptszKeybNext[j]; } if (TwoWay && !Found) - for (DWORD j = 0; j < mir_tstrlen(ptszKeybNext) && !Found; j++) + for (DWORD j = 0; j < mir_wstrlen(ptszKeybNext) && !Found; j++) if (ptszKeybNext[j] == ptszInText[i]) { Found = TRUE; - if (mir_tstrlen(ptszKeybCur) >= j) + if (mir_wstrlen(ptszKeybCur) >= j) ptszOutText[i] = ptszKeybCur[j]; } } @@ -188,7 +188,7 @@ HKL GetLayoutOfText(LPCTSTR ptszInText) LPTSTR ptszKeybBuff = ptszLayStrings[0]; DWORD dwMaxSymbols = 0, dwTemp = 0; - for (DWORD j = 0; j < mir_tstrlen(ptszInText); j++) + for (DWORD j = 0; j < mir_wstrlen(ptszInText); j++) if (wcschr(ptszKeybBuff, ptszInText[j]) != NULL) ++dwMaxSymbols; @@ -196,7 +196,7 @@ HKL GetLayoutOfText(LPCTSTR ptszInText) ptszKeybBuff = ptszLayStrings[i]; DWORD dwCountSymbols = 0; - for (DWORD j = 0; j 0)) { @@ -339,7 +339,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) if (!IsBadStringPtr(ptszInText, MaxTextSize) && (iRes > 0)) { crTemp.cpMin = 0; - crTemp.cpMax = (int)mir_tstrlen(ptszInText); + crTemp.cpMax = (int)mir_wstrlen(ptszInText); } else { SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection); @@ -351,7 +351,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) // Получаем текущее слово if (CurrentWord) { for (dwStartWord = crSelection.cpMin; (dwStartWord > 0) && (wcschr(ptszSeparators, ptszInText[dwStartWord - 1]) == NULL); dwStartWord--); - for (dwEndWord = crSelection.cpMin; (dwEndWord < (mir_tstrlen(ptszInText))) && (wcschr(ptszSeparators, ptszInText[dwEndWord]) == NULL); dwEndWord++); + for (dwEndWord = crSelection.cpMin; (dwEndWord < (mir_wstrlen(ptszInText))) && (wcschr(ptszSeparators, ptszInText[dwEndWord]) == NULL); dwEndWord++); crTemp.cpMin = dwStartWord; crTemp.cpMax = dwEndWord; @@ -374,12 +374,12 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) } if (WindowType == WTYPE_Edit) { - ptrT ptszTemp((LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t))); + ptrW ptszTemp((LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t))); wcsncpy(ptszTemp, &ptszInText[crTemp.cpMin], crTemp.cpMax - crTemp.cpMin); ptszTemp[crTemp.cpMax - crTemp.cpMin] = 0; - mir_tstrcpy(ptszInText, ptszTemp); + mir_wstrcpy(ptszInText, ptszTemp); - if (mir_tstrlen(ptszInText) == 0) { + if (mir_wstrlen(ptszInText) == 0) { SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection); SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0); InvalidateRect(hTextWnd, NULL, FALSE); @@ -403,7 +403,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) // Лог Иевью и ХисториПП в режиме эмуляции Иевью и поля только для чтения. if (WindowType != WTYPE_Unknown && !IsBadStringPtr(ptszInText, MaxTextSize)) if (WindowIsReadOnly) { - ptrT ptszMBox((LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t))); + ptrW ptszMBox((LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t))); ptszMBox[0] = 0; if (TextOperation == TOT_Layout) { @@ -416,13 +416,13 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) else { for (i = 0; i < bLayNum; i++) if (hklLayouts[i] != hklCurLay) { - if (mir_tstrlen(ptszMBox) != 0) - mir_tstrcat(ptszMBox, L"\n\n"); - ptrT ptszTemp(GetShortNameOfLayout(hklLayouts[i])); - mir_tstrcat(ptszMBox, ptszTemp); - mir_tstrcat(ptszMBox, L":\n"); - ptrT ptszOutText(ChangeTextLayout(ptszInText, hklCurLay, hklLayouts[i], FALSE)); - mir_tstrcat(ptszMBox, ptszOutText); + if (mir_wstrlen(ptszMBox) != 0) + mir_wstrcat(ptszMBox, L"\n\n"); + ptrW ptszTemp(GetShortNameOfLayout(hklLayouts[i])); + mir_wstrcat(ptszMBox, ptszTemp); + mir_wstrcat(ptszMBox, L":\n"); + ptrW ptszOutText(ChangeTextLayout(ptszInText, hklCurLay, hklLayouts[i], FALSE)); + mir_wstrcat(ptszMBox, ptszOutText); } } } @@ -446,7 +446,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) //-------------------------------Покажем попапы------------------------------------------ if (moOptions.ShowPopup) { LPTSTR ptszPopupText = (LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t)); - mir_tstrcpy(ptszPopupText, ptszMBox); + mir_wstrcpy(ptszPopupText, ptszMBox); POPUPDATAT_V2 pdtData = { 0 }; pdtData.cbSize = sizeof(pdtData); @@ -494,7 +494,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) } //------------------Редактируемые поля ---------------------------- else { - ptrT ptszOutText; + ptrW ptszOutText; if (TextOperation == TOT_Layout) { hklCurLay = GetLayoutOfText(ptszInText); hklToLay = GetNextLayout(hklCurLay); @@ -510,7 +510,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection); } else { - ptrT ptszTemp((LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t))); + ptrW ptszTemp((LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t))); GetWindowText(hTextWnd, ptszTemp, MaxTextSize); for (i = crTemp.cpMin; i < crTemp.cpMax; i++) ptszTemp[i] = ptszOutText[i - crTemp.cpMin]; -- cgit v1.2.3