From 6e53dfca72b932c4bdcd7aa02ca62bf8b2630eac Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 26 Jul 2016 09:20:25 +0000 Subject: less TCHARs: - TCHAR is replaced with wchar_t everywhere; - LPGENT replaced with either LPGENW or LPGEN; - fixes for ANSI plugins that improperly used _t functions; - TCHAR *t removed from MAllStrings; - ptszGroup, ptszTitle & ptszTab in OPTIONSDIALOGPAGE replaced with pwsz* git-svn-id: http://svn.miranda-ng.org/main/trunk@17133 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/BossKeyPlus/src/BossKey.cpp | 42 ++++++++++++++++++------------------- plugins/BossKeyPlus/src/Options.cpp | 20 +++++++++--------- plugins/BossKeyPlus/src/stdafx.h | 4 ++-- 3 files changed, 33 insertions(+), 33 deletions(-) (limited to 'plugins/BossKeyPlus/src') diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp index 6a8600b4d1..bd725b6e8b 100644 --- a/plugins/BossKeyPlus/src/BossKey.cpp +++ b/plugins/BossKeyPlus/src/BossKey.cpp @@ -35,7 +35,7 @@ HKL oldLangID, oldLayout; int protoCount, hLangpack; PROTOACCOUNT **proto; unsigned *oldStatus; -TCHAR **oldStatusMsg; +wchar_t **oldStatusMsg; BYTE g_bOldSetting; PFNDwmIsCompositionEnabled dwmIsCompositionEnabled; @@ -171,7 +171,7 @@ BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM) if ((g_dwMirandaPID == dwWndPID) && hWnd != g_hDlgPass && IsWindowVisible(hWnd)) { - TCHAR szTemp[32]; + wchar_t szTemp[32]; GetClassName(hWnd, szTemp, 32); if (mir_tstrcmp(szTemp, L"MirandaThumbsWnd") == 0) // hide floating contacts @@ -194,12 +194,12 @@ BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM) return true; } -TCHAR* GetDefStatusMsg(unsigned uStatus, const char* szProto) +wchar_t* GetDefStatusMsg(unsigned uStatus, const char* szProto) { - return (TCHAR*)CallService(MS_AWAYMSG_GETSTATUSMSGT, uStatus, (LPARAM)szProto); + return (wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGT, uStatus, (LPARAM)szProto); } -void SetStatus(const char* szProto, unsigned status, TCHAR *tszAwayMsg) +void SetStatus(const char* szProto, unsigned status, wchar_t *tszAwayMsg) { if (tszAwayMsg && CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) CallProtoService(szProto, PS_SETAWAYMSG, status, (LPARAM)tszAwayMsg); @@ -207,7 +207,7 @@ void SetStatus(const char* szProto, unsigned status, TCHAR *tszAwayMsg) CallProtoService(szProto, PS_SETSTATUS, status, 0); } -static int ChangeAllProtoStatuses(unsigned statusMode, TCHAR *msg) +static int ChangeAllProtoStatuses(unsigned statusMode, wchar_t *msg) { for (int i = 0; i < protoCount; i++) { @@ -221,7 +221,7 @@ static int ChangeAllProtoStatuses(unsigned statusMode, TCHAR *msg) if (g_wMask & OPT_SETONLINEBACK){ // need to save old statuses & status messages oldStatus[i] = status; if (ProtoServiceExists(proto[i]->szModuleName, PS_GETMYAWAYMSG)) - oldStatusMsg[i] = (TCHAR*)CallProtoService(proto[i]->szModuleName, PS_GETMYAWAYMSG, 0, SGMA_TCHAR); + oldStatusMsg[i] = (wchar_t*)CallProtoService(proto[i]->szModuleName, PS_GETMYAWAYMSG, 0, SGMA_TCHAR); else oldStatusMsg[i] = GetDefStatusMsg(status, proto[i]->szModuleName); } @@ -254,11 +254,11 @@ static void CreateTrayIcon(bool create) NOTIFYICONDATA nim; DBVARIANT dbVar; if (!db_get_ts(NULL, MOD_NAME, "ToolTipText", &dbVar)) { - _tcsncpy_s(nim.szTip, dbVar.ptszVal, _TRUNCATE); + wcsncpy_s(nim.szTip, dbVar.ptszVal, _TRUNCATE); db_free(&dbVar); } else - _tcsncpy_s(nim.szTip, L"Miranda NG", _TRUNCATE); + wcsncpy_s(nim.szTip, L"Miranda NG", _TRUNCATE); nim.cbSize = sizeof(nim); nim.hWnd = g_hListenWindow; @@ -321,7 +321,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara DBVARIANT dbVar; if (g_wMask & OPT_USEDEFMSG || db_get_ts(NULL, MOD_NAME, "statmsg", &dbVar)) { - TCHAR *ptszDefMsg = GetDefStatusMsg(uMode, 0); + wchar_t *ptszDefMsg = GetDefStatusMsg(uMode, 0); ChangeAllProtoStatuses(uMode, ptszDefMsg); mir_free(ptszDefMsg); } @@ -329,7 +329,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara { if (ServiceExists(MS_VARS_FORMATSTRING)) { - TCHAR *ptszParsed = variables_parse(dbVar.ptszVal, 0, 0); + wchar_t *ptszParsed = variables_parse(dbVar.ptszVal, 0, 0); ChangeAllProtoStatuses(uMode, ptszParsed); mir_free(ptszParsed); } @@ -395,7 +395,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara while (pCurWnd != NULL) { HWND_ITEM *pNextWnd = pCurWnd->next; - TCHAR szTemp[32]; + wchar_t szTemp[32]; GetClassName(pCurWnd->hWnd, szTemp, 32); if (IsWindow(pCurWnd->hWnd) && mir_tstrcmp(szTemp, L"SysShadow") != 0) // precaution @@ -458,9 +458,9 @@ INT_PTR BossKeyHideMiranda(WPARAM, LPARAM) // for service :) return 0; } -static TCHAR *HokeyVkToName(WORD vkKey) +static wchar_t *HokeyVkToName(WORD vkKey) { - static TCHAR buf[32] = { 0 }; + static wchar_t buf[32] = { 0 }; DWORD code = MapVirtualKey(vkKey, 0) << 16; switch (vkKey) @@ -495,13 +495,13 @@ static TCHAR *HokeyVkToName(WORD vkKey) return buf; } -static TCHAR *GetBossKeyText(void) +static wchar_t *GetBossKeyText(void) { WORD wHotKey = db_get_w(NULL, "SkinHotKeys", "Hide/Show Miranda", HOTKEYCODE(HOTKEYF_CONTROL, VK_F12)); BYTE key = LOBYTE(wHotKey); BYTE shift = HIBYTE(wHotKey); - static TCHAR buf[128] = { 0 }; + static wchar_t buf[128] = { 0 }; mir_sntprintf(buf, L"%s%s%s%s%s", (shift & HOTKEYF_CONTROL) ? L"Ctrl + " : L"", @@ -521,7 +521,7 @@ static IconItem iconList[] = static int GenMenuInit(WPARAM, LPARAM) // Modify menu item text before to show the main menu { if (g_hMenuItem) { - TCHAR buf[128]; + wchar_t buf[128]; mir_sntprintf(buf, L"%s [%s]", TranslateT("Hide"), GetBossKeyText()); Menu_ModifyItem(g_hMenuItem, buf); } @@ -535,7 +535,7 @@ void BossKeyMenuItemInit(void) // Add menu item mi.flags = CMIF_TCHAR; mi.position = 2000100000; mi.hIcolibItem = IcoLib_GetIcon("hidemim"); - mi.name.t = LPGENT("Hide"); + mi.name.w = LPGENW("Hide"); mi.pszService = MS_BOSSKEY_HIDE; g_hMenuItem = Menu_AddMainMenuItem(&mi); @@ -590,7 +590,7 @@ static int TabsrmmButtonsInit(WPARAM, LPARAM) bbd.cbSize = sizeof(BBButton); bbd.pszModuleName = MOD_NAME; bbd.dwDefPos = 5000; - bbd.ptszTooltip = LPGENT("Hide Miranda NG"); + bbd.ptszTooltip = LPGENW("Hide Miranda NG"); bbd.bbbFlags = BBBF_ISRSIDEBUTTON | BBBF_CANBEHIDDEN; bbd.hIcon = iconList[0].hIcolib; CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd); @@ -598,7 +598,7 @@ static int TabsrmmButtonsInit(WPARAM, LPARAM) return 0; } -static TCHAR *VariablesBossKey(ARGUMENTSINFO *ai) { +static wchar_t *VariablesBossKey(ARGUMENTSINFO *ai) { if (ai->cbSize < sizeof(ARGUMENTSINFO)) return NULL; if (ai->argc != 1) return NULL; @@ -615,7 +615,7 @@ static int EnumProtos(WPARAM, LPARAM) delete[] oldStatusMsg; oldStatus = new unsigned[protoCount]; - oldStatusMsg = new TCHAR*[protoCount]; + oldStatusMsg = new wchar_t*[protoCount]; for (int i = 0; i < protoCount; i++) { oldStatus[i] = 0; diff --git a/plugins/BossKeyPlus/src/Options.cpp b/plugins/BossKeyPlus/src/Options.cpp index fc37629d20..fab96b3e27 100644 --- a/plugins/BossKeyPlus/src/Options.cpp +++ b/plugins/BossKeyPlus/src/Options.cpp @@ -79,7 +79,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam // status msg, if needed if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_MAINOPT_STATMSG))) { // meaning we should save it - TCHAR tszMsg[1025]; + wchar_t tszMsg[1025]; GetDlgItemText(hwndDlg, IDC_MAINOPT_STATMSG, tszMsg, _countof(tszMsg)); if (tszMsg[0] != 0) db_set_ts(NULL, MOD_NAME, "statmsg", tszMsg); @@ -115,7 +115,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam BYTE bSelection = (BYTE)SendDlgItemMessage(hwndDlg, IDC_MAINOPT_CHGSTS, CB_GETCURSEL, 0, 0); WORD wMode = STATUS_ARR_TO_ID[bSelection]; if (IsDlgButtonChecked(hwndDlg, IDC_MAINOPT_USEDEFMSG) == BST_CHECKED) { - TCHAR *ptszDefMsg = GetDefStatusMsg(wMode, 0); + wchar_t *ptszDefMsg = GetDefStatusMsg(wMode, 0); SetDlgItemText(hwndDlg, IDC_MAINOPT_STATMSG, ptszDefMsg); if (ptszDefMsg) mir_free(ptszDefMsg); @@ -221,8 +221,8 @@ INT_PTR CALLBACK AdvOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) g_fOptionsOpen = true; minutes = db_get_b(NULL, MOD_NAME, "time", 10); - TCHAR szMinutes[4] = { 0 }; - _itot(minutes, szMinutes, 10); + wchar_t szMinutes[4] = { 0 }; + _itow(minutes, szMinutes, 10); SendDlgItemMessage(hwndDlg, IDC_MAINOPT_TIME, EM_LIMITTEXT, 2, 0); SendDlgItemMessage(hwndDlg, IDC_MAINOPT_SPIN_TIME, UDM_SETRANGE32, 1, (LPARAM)99); SetDlgItemText(hwndDlg, IDC_MAINOPT_TIME, szMinutes); @@ -257,9 +257,9 @@ INT_PTR CALLBACK AdvOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) else if (g_hMenuItem != 0) BossKeyMenuItemUnInit(); - TCHAR szMinutes[4] = { 0 }; + wchar_t szMinutes[4] = { 0 }; GetDlgItemText(hwndDlg, IDC_MAINOPT_TIME, szMinutes, _countof(szMinutes)); - minutes = _ttoi(szMinutes); + minutes = _wtoi(szMinutes); if (minutes < 1) minutes = 1; db_set_b(NULL, MOD_NAME, "time", minutes); db_set_w(NULL, MOD_NAME, "optsmaskadv", wMaskAdv); @@ -323,15 +323,15 @@ int OptsDlgInit(WPARAM wParam, LPARAM) optDi.pfnDlgProc = MainOptDlg; optDi.pszTemplate = MAKEINTRESOURCEA(IDD_OPTDIALOGMAIN); optDi.hInstance = g_hInstance; - optDi.ptszTitle = LPGENT("BossKey"); - optDi.ptszGroup = LPGENT("Events"); - optDi.ptszTab = LPGENT("Main"); + optDi.pwszTitle = LPGENW("BossKey"); + optDi.pwszGroup = LPGENW("Events"); + optDi.pwszTab = LPGENW("Main"); optDi.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; Options_AddPage(wParam, &optDi); optDi.pfnDlgProc = AdvOptDlg; optDi.pszTemplate = MAKEINTRESOURCEA(IDD_OPTDIALOGADV); - optDi.ptszTab = LPGENT("Advanced"); + optDi.pwszTab = LPGENW("Advanced"); Options_AddPage(wParam, &optDi); return 0; } diff --git a/plugins/BossKeyPlus/src/stdafx.h b/plugins/BossKeyPlus/src/stdafx.h index 067b56a694..ea08079f22 100644 --- a/plugins/BossKeyPlus/src/stdafx.h +++ b/plugins/BossKeyPlus/src/stdafx.h @@ -88,10 +88,10 @@ int OptsDlgInit(WPARAM wParam, LPARAM lParam); INT_PTR BossKeyHideMiranda(WPARAM wParam, LPARAM lParam); void BossKeyMenuItemInit(void); void BossKeyMenuItemUnInit(void); -static TCHAR *GetBossKeyText(void); +static wchar_t *GetBossKeyText(void); void InitIdleTimer(void); void UninitIdleTimer(void); -TCHAR* GetDefStatusMsg(unsigned uMode, const char* szProto); +wchar_t* GetDefStatusMsg(unsigned uMode, const char* szProto); // I never really liked STL's vector... hmm this is nicer anyway, more flexible typedef struct HWND_ITEM_TYPE -- cgit v1.2.3