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/BuddyPounce/src/dialog.cpp | 48 +++++++++++++++++++------------------- plugins/BuddyPounce/src/main.cpp | 14 +++++------ plugins/BuddyPounce/src/stdafx.h | 4 ++-- 3 files changed, 33 insertions(+), 33 deletions(-) (limited to 'plugins/BuddyPounce') diff --git a/plugins/BuddyPounce/src/dialog.cpp b/plugins/BuddyPounce/src/dialog.cpp index becca80478..d17340cfb0 100644 --- a/plugins/BuddyPounce/src/dialog.cpp +++ b/plugins/BuddyPounce/src/dialog.cpp @@ -15,7 +15,7 @@ void populateContacts(MCONTACT BPhContact, HWND hwnd2CB) for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char *szProto = GetContactProto(hContact); if (szProto && (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM)) { - TCHAR name[300]; + wchar_t name[300]; mir_sntprintf(name, L"%s (%s)", pcli->pfnGetContactDisplayName(hContact, 0), _A2T(szProto)); int index = SendMessage(hwnd2CB, CB_ADDSTRING, 0, (LPARAM)name); SendMessage(hwnd2CB, CB_SETITEMDATA, index, hContact); @@ -27,7 +27,7 @@ void populateContacts(MCONTACT BPhContact, HWND hwnd2CB) void saveLastSetting(MCONTACT hContact, HWND hwnd) { - TCHAR number[8];//, string[1024];//for sending file name + wchar_t number[8];//, string[1024];//for sending file name switch (db_get_b(hContact, modname, "LastSetting", 2)) { // nothing to do case 0: // Send If My Status Is... break; @@ -38,18 +38,18 @@ void saveLastSetting(MCONTACT hContact, HWND hwnd) break; case 3: // Reuse Pounce GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, _countof(number)); - db_set_b(hContact, modname, "Reuse", (BYTE)_ttoi(number)); + db_set_b(hContact, modname, "Reuse", (BYTE)_wtoi(number)); break; case 4: // Give Up delay GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, _countof(number)); - db_set_b(hContact, modname, "GiveUpDays", (BYTE)_ttoi(number)); + db_set_b(hContact, modname, "GiveUpDays", (BYTE)_wtoi(number)); { - db_set_dw(hContact, modname, "GiveUpDate", (DWORD)(_ttoi(number)*SECONDSINADAY)); + db_set_dw(hContact, modname, "GiveUpDate", (DWORD)(_wtoi(number)*SECONDSINADAY)); } break; case 5: // confirm window GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, _countof(number)); - db_set_w(hContact, modname, "ConfirmTimeout", (WORD)_ttoi(number)); + db_set_w(hContact, modname, "ConfirmTimeout", (WORD)_wtoi(number)); break; } } @@ -88,7 +88,7 @@ INT_PTR CALLBACK StatusModesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case IDOK: case IDCANCEL: windowInfo *wi = (windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA); - TCHAR type[32]; + wchar_t type[32]; GetDlgItemText(hwnd, IDC_CHECK1, type, _countof(type)); WORD flag = (IsDlgButtonChecked(hwnd, IDC_CHECK1)) @@ -192,7 +192,7 @@ void deletePounce(MCONTACT hContact) INT_PTR CALLBACK BuddyPounceSimpleDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA); - TCHAR msg[1024]; + wchar_t msg[1024]; switch(uMsg) { case WM_INITDIALOG: @@ -222,7 +222,7 @@ INT_PTR CALLBACK BuddyPounceSimpleDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, L { int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)) + 1; if (length>1) { - TCHAR *text = (TCHAR*)_alloca(length*sizeof(TCHAR)); + wchar_t *text = (wchar_t*)_alloca(length*sizeof(wchar_t)); GetDlgItemText(hwnd, IDC_MESSAGE, text, length); db_set_ts(hContact, modname, "PounceMsg", text); } @@ -242,7 +242,7 @@ INT_PTR CALLBACK BuddyPounceSimpleDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, L INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { windowInfo *wi = (windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA); - TCHAR msg[1024]; + wchar_t msg[1024]; switch(uMsg) { case WM_INITDIALOG: @@ -283,7 +283,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM MCONTACT hContact = (MCONTACT)SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_GETITEMDATA, SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_GETCURSEL, 0, 0), 0); int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE))+1; if (length>1) { - TCHAR *text = (TCHAR*)mir_alloc(length*sizeof(TCHAR)); + wchar_t *text = (wchar_t*)mir_alloc(length*sizeof(wchar_t)); if (!text) { msg(TranslateT("Couldn't allocate enough memory"), L""); break; @@ -329,7 +329,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM case IDC_SETTINGS: if (HIWORD(wParam) == LBN_SELCHANGE) { int item = SendDlgItemMessage(hwnd, IDC_SETTINGS, LB_GETCURSEL, 0, 0); - TCHAR temp[5]; + wchar_t temp[5]; saveLastSetting(wi->hContact, hwnd); hideAll(hwnd); switch (item) { @@ -344,7 +344,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM SetDlgItemText(hwnd, IDC_SETTINGMSG, TranslateT("Reuse this message? (0 to use it once)")); ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG2), SW_SHOW); SetDlgItemText(hwnd, IDC_SETTINGMSG2, TranslateT("Times")); - SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itot(db_get_b(wi->hContact, modname, "Reuse", 0), temp, 10)); + SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itow(db_get_b(wi->hContact, modname, "Reuse", 0), temp, 10)); ShowWindow(GetDlgItem(hwnd, IDC_SETTINGNUMBER), SW_SHOW); ShowWindow(GetDlgItem(hwnd, IDC_SPIN), SW_SHOW); break; @@ -353,7 +353,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM SetDlgItemText(hwnd, IDC_SETTINGMSG, TranslateT("Give up after... (0 to not give up)")); ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG2), SW_SHOW); SetDlgItemText(hwnd, IDC_SETTINGMSG2, TranslateT("Days")); - SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itot(db_get_b(wi->hContact, modname, "GiveUpDays", 0), temp, 10)); + SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itow(db_get_b(wi->hContact, modname, "GiveUpDays", 0), temp, 10)); ShowWindow(GetDlgItem(hwnd, IDC_SETTINGNUMBER), SW_SHOW); ShowWindow(GetDlgItem(hwnd, IDC_SPIN), SW_SHOW); break; @@ -362,7 +362,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM SetDlgItemText(hwnd, IDC_SETTINGMSG, TranslateT("Show confirmation window? (0 to not Show)")); ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG2), SW_SHOW); SetDlgItemText(hwnd, IDC_SETTINGMSG2, TranslateT("Seconds to wait before sending")); - SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itot(db_get_w(wi->hContact, modname, "ConfirmTimeout", 0), temp, 10)); + SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itow(db_get_w(wi->hContact, modname, "ConfirmTimeout", 0), temp, 10)); ShowWindow(GetDlgItem(hwnd, IDC_SETTINGNUMBER), SW_SHOW); ShowWindow(GetDlgItem(hwnd, IDC_SPIN), SW_SHOW); break; @@ -377,7 +377,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - TCHAR msg[1024]; + wchar_t msg[1024]; switch(uMsg) { case WM_INITDIALOG: @@ -409,7 +409,7 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, MCONTACT hContact = ((windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->hContact; int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE))+1; if (length > 1) { - TCHAR *text = (TCHAR*)mir_alloc(length*sizeof(TCHAR)); + wchar_t *text = (wchar_t*)mir_alloc(length*sizeof(wchar_t)); if (!text) { msg(TranslateT("Couldn't allocate enough memory"), L""); break; @@ -448,7 +448,7 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, if (HIWORD(wParam) == LBN_SELCHANGE) { windowInfo *wi = (windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA); int item = SendDlgItemMessage(hwnd, IDC_SETTINGS, LB_GETCURSEL, 0, 0); - TCHAR temp[5]; + wchar_t temp[5]; SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); saveLastSetting(wi->hContact, hwnd); hideAll(hwnd); @@ -464,7 +464,7 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, SetDlgItemText(hwnd, IDC_SETTINGMSG, TranslateT("Reuse this message? (0 to use it once)")); ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG2), SW_SHOW); SetDlgItemText(hwnd, IDC_SETTINGMSG2, TranslateT("Times")); - SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itot(db_get_b(wi->hContact, modname, "Reuse", 0), temp, 10)); + SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itow(db_get_b(wi->hContact, modname, "Reuse", 0), temp, 10)); ShowWindow(GetDlgItem(hwnd, IDC_SETTINGNUMBER), SW_SHOW); ShowWindow(GetDlgItem(hwnd, IDC_SPIN), SW_SHOW); break; @@ -473,7 +473,7 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, SetDlgItemText(hwnd, IDC_SETTINGMSG, TranslateT("Give up after... (0 to not give up)")); ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG2), SW_SHOW); SetDlgItemText(hwnd, IDC_SETTINGMSG2, TranslateT("Days")); - SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itot(db_get_b(wi->hContact, modname, "GiveUpDays", 0), temp, 10)); + SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itow(db_get_b(wi->hContact, modname, "GiveUpDays", 0), temp, 10)); ShowWindow(GetDlgItem(hwnd, IDC_SETTINGNUMBER), SW_SHOW); ShowWindow(GetDlgItem(hwnd, IDC_SPIN), SW_SHOW); break; @@ -482,7 +482,7 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, SetDlgItemText(hwnd, IDC_SETTINGMSG, TranslateT("Show confirmation window? (0 to not Show)")); ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG2), SW_SHOW); SetDlgItemText(hwnd, IDC_SETTINGMSG2, TranslateT("Seconds to wait before sending")); - SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itot(db_get_w(wi->hContact, modname, "ConfirmTimeout", 0), temp, 10)); + SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itow(db_get_w(wi->hContact, modname, "ConfirmTimeout", 0), temp, 10)); ShowWindow(GetDlgItem(hwnd, IDC_SETTINGNUMBER), SW_SHOW); ShowWindow(GetDlgItem(hwnd, IDC_SPIN), SW_SHOW); break; @@ -523,7 +523,7 @@ INT_PTR CALLBACK SendPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP case WM_TIMER: { - TCHAR message[1024]; + wchar_t message[1024]; mir_sntprintf(message, TranslateT("Pounce being sent to %s in %d seconds"), pcli->pfnGetContactDisplayName(spdps->hContact, 0), spdps->timer); SetDlgItemText(hwnd, LBL_CONTACT, message); } @@ -580,7 +580,7 @@ INT_PTR CALLBACK PounceSentDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP switch(LOWORD(wParam)) { case IDOK: { - TCHAR text[2048]; + wchar_t text[2048]; GetDlgItemText(hwnd, IDOK, text, _countof(text)); if (!mir_tstrcmp(text, TranslateT("Retry"))) { GetDlgItemText(hwnd, IDC_MESSAGE, text, _countof(text)); @@ -599,7 +599,7 @@ INT_PTR CALLBACK PounceSentDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP void CreateMessageAcknowlegedWindow(MCONTACT hContact, int SentSuccess) { HWND hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONFIRMSEND), 0, PounceSentDlgProc, hContact); - TCHAR msg[256]; + wchar_t msg[256]; if (SentSuccess) { mir_sntprintf(msg, TranslateT("Message successfully sent to %s"), pcli->pfnGetContactDisplayName(hContact, 0)); SetDlgItemText(hwnd, IDOK, TranslateT("OK")); diff --git a/plugins/BuddyPounce/src/main.cpp b/plugins/BuddyPounce/src/main.cpp index 3d15dc36be..0d112acef5 100644 --- a/plugins/BuddyPounce/src/main.cpp +++ b/plugins/BuddyPounce/src/main.cpp @@ -98,8 +98,8 @@ int BuddyPounceOptInit(WPARAM wParam, LPARAM) odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); - odp.ptszGroup = LPGENT("Message sessions"); - odp.ptszTitle = LPGENT("Buddy Pounce"); + odp.pwszGroup = LPGENW("Message sessions"); + odp.pwszTitle = LPGENW("Buddy Pounce"); odp.pfnDlgProc = BuddyPounceOptionsDlgProc; Options_AddPage(wParam, &odp); return 0; @@ -142,7 +142,7 @@ int CheckDate(MCONTACT hContact) return 0; } -void SendPounce(TCHAR *text, MCONTACT hContact) +void SendPounce(wchar_t *text, MCONTACT hContact) { if (HANDLE hSendId = (HANDLE)ProtoChainSend(hContact, PSS_MESSAGE, 0, T2Utf(text))) WindowList_Add(hWindowList, (HWND)hSendId, hContact); @@ -169,7 +169,7 @@ int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam) if (CheckDate(hContact)) { if (db_get_w(hContact, modname, "ConfirmTimeout", 0)) { SendPounceDlgProcStruct *spdps = (SendPounceDlgProcStruct *)mir_alloc(sizeof(SendPounceDlgProcStruct)); - TCHAR *message = mir_tstrdup(dbv.ptszVal); // will get free()ed in the send confirm window proc + wchar_t *message = mir_tstrdup(dbv.ptszVal); // will get free()ed in the send confirm window proc spdps->hContact = hContact; spdps->message = message; CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONFIRMSEND), 0, SendPounceDlgProc, (LPARAM)spdps); @@ -198,7 +198,7 @@ INT_PTR BuddyPounceMenuCommand(WPARAM hContact, LPARAM) INT_PTR AddSimpleMessage(WPARAM wParam, LPARAM lParam) { MCONTACT hContact = wParam; - TCHAR* message = (TCHAR*)lParam; + wchar_t* message = (wchar_t*)lParam; db_set_ws(hContact, modname, "PounceMsg", message); db_set_w(hContact, modname, "SendIfMyStatusIsFLAG", (WORD)db_get_w(NULL, modname, "SendIfMyStatusIsFLAG",1)); db_set_w(hContact, modname, "SendIfTheirStatusIsFLAG", (WORD)db_get_w(NULL, modname, "SendIfTheirStatusIsFLAG",1)); @@ -211,11 +211,11 @@ INT_PTR AddSimpleMessage(WPARAM wParam, LPARAM lParam) INT_PTR AddToPounce(WPARAM wParam, LPARAM lParam) { MCONTACT hContact = wParam; - TCHAR* message = (TCHAR*)lParam; + wchar_t* message = (wchar_t*)lParam; DBVARIANT dbv; if (!db_get_ts(hContact, modname, "PounceMsg",&dbv)) { - TCHAR* newPounce = (TCHAR*)mir_alloc(mir_tstrlen(dbv.ptszVal) + mir_tstrlen(message) + 1); + wchar_t* newPounce = (wchar_t*)mir_alloc(mir_tstrlen(dbv.ptszVal) + mir_tstrlen(message) + 1); if (!newPounce) return 1; mir_tstrcpy(newPounce, dbv.ptszVal); mir_tstrcat(newPounce, message); diff --git a/plugins/BuddyPounce/src/stdafx.h b/plugins/BuddyPounce/src/stdafx.h index 5174042431..1187a52a6f 100644 --- a/plugins/BuddyPounce/src/stdafx.h +++ b/plugins/BuddyPounce/src/stdafx.h @@ -56,7 +56,7 @@ struct SendPounceDlgProcStruct { MCONTACT hContact; int timer; - TCHAR *message; + wchar_t *message; }; extern HINSTANCE hInst; @@ -66,7 +66,7 @@ extern HINSTANCE hInst; //======================================================= // main.c -void SendPounce(TCHAR* text, MCONTACT hContact); +void SendPounce(wchar_t* text, MCONTACT hContact); //dialog.c INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -- cgit v1.2.3