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 --- protocols/GTalkExt/src/avatar.cpp | 8 ++++---- protocols/GTalkExt/src/handlers.cpp | 24 +++++++++++------------- protocols/GTalkExt/src/inbox.cpp | 4 ++-- protocols/GTalkExt/src/notifications.cpp | 6 +++--- protocols/GTalkExt/src/options.cpp | 28 ++++++++++++++-------------- protocols/GTalkExt/src/options.h | 6 +++--- protocols/GTalkExt/src/stdafx.h | 1 - protocols/GTalkExt/src/tipper_items.cpp | 4 ++-- 8 files changed, 39 insertions(+), 42 deletions(-) (limited to 'protocols/GTalkExt') diff --git a/protocols/GTalkExt/src/avatar.cpp b/protocols/GTalkExt/src/avatar.cpp index b0d6c61896..edd023c8d5 100644 --- a/protocols/GTalkExt/src/avatar.cpp +++ b/protocols/GTalkExt/src/avatar.cpp @@ -32,19 +32,19 @@ LPTSTR CreateAvaFile(HANDLE *hFile) { - TCHAR name[MAX_PATH + 2]; + wchar_t name[MAX_PATH + 2]; if (CallService(MS_DB_GETPROFILENAMET, (WPARAM)_countof(name), (LPARAM)&name)) return NULL; - TCHAR *p = _tcsrchr(name, '.'); + wchar_t *p = wcsrchr(name, '.'); if (p) *p = 0; - TCHAR path[MAX_PATH + 2]; + wchar_t path[MAX_PATH + 2]; if (CallService(MS_DB_GETPROFILEPATHT, (WPARAM)_countof(path), (LPARAM)&path)) return NULL; - TCHAR full[MAX_PATH + 2]; + wchar_t full[MAX_PATH + 2]; mir_sntprintf(full, AVA_FILE_NAME_FORMAT, path, name); CreateDirectoryTreeT(full); diff --git a/protocols/GTalkExt/src/handlers.cpp b/protocols/GTalkExt/src/handlers.cpp index 1948a21dbf..5dd4cf0345 100644 --- a/protocols/GTalkExt/src/handlers.cpp +++ b/protocols/GTalkExt/src/handlers.cpp @@ -31,8 +31,6 @@ LRESULT CALLBACK PopupProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam); -#include - GoogleTalkAcc* isGoogle(LPARAM lParam) { return g_accs.find((GoogleTalkAcc*)&lParam); @@ -42,7 +40,7 @@ GoogleTalkAcc* isGoogle(LPARAM lParam) void FormatMessageUrl(LPCTSTR format, LPTSTR buf, LPCTSTR mailbox, LPCTSTR tid) { - ULARGE_INTEGER iTid; iTid.QuadPart = _tstoi64(tid); + ULARGE_INTEGER iTid; iTid.QuadPart = _wtoi64(tid); size_t l = mir_tstrlen(buf); mir_sntprintf(buf, l, format, mailbox, iTid.HighPart, iTid.LowPart); assert(l >= mir_tstrlen(buf)); @@ -50,8 +48,8 @@ void FormatMessageUrl(LPCTSTR format, LPTSTR buf, LPCTSTR mailbox, LPCTSTR tid) void MakeUrlHex(LPTSTR url, LPCTSTR tid) { - ULARGE_INTEGER iTid; iTid.QuadPart = _tstoi64(tid); - LPTSTR tidInUrl = _tcsstr(url, tid); + ULARGE_INTEGER iTid; iTid.QuadPart = _wtoi64(tid); + LPTSTR tidInUrl = wcsstr(url, tid); LPTSTR trail = tidInUrl + mir_tstrlen(tid); wsprintf(tidInUrl, L"%x%08x", iTid.HighPart, iTid.LowPart); //!!!!!!!!!!!! wmemmove(tidInUrl + mir_tstrlen(tidInUrl), trail, mir_tstrlen(trail) + 1); @@ -59,13 +57,13 @@ void MakeUrlHex(LPTSTR url, LPCTSTR tid) LPTSTR ExtractJid(LPCTSTR jidWithRes) { - LPCTSTR p = _tcsrchr(jidWithRes, '/'); + LPCTSTR p = wcsrchr(jidWithRes, '/'); if (p == NULL) return mir_tstrdup(jidWithRes); size_t l = size_t(p - jidWithRes); - LPTSTR result = (LPTSTR)mir_alloc((l + 1) * sizeof(TCHAR)); - _tcsncpy(result, jidWithRes, l); + LPTSTR result = (LPTSTR)mir_alloc((l + 1) * sizeof(wchar_t)); + wcsncpy(result, jidWithRes, l); result[l] = 0; return result; } @@ -166,7 +164,7 @@ BOOL MailListHandler(IJabberInterface *ji, HXML node, void *) __finally { if (jidWithRes) ji->AddTemporaryIqHandler(TimerHandler, JABBER_IQ_TYPE_RESULT, 0, - (PVOID)_tcsdup(jidWithRes), TIMER_INTERVAL); + (PVOID)wcsdup(jidWithRes), TIMER_INTERVAL); // Never get a real result stanza. Results elapsed request after WAIT_TIMER_INTERVAL ms } } @@ -186,7 +184,7 @@ void RequestMail(LPCTSTR jidWithRes, IJabberInterface *ji) lastMailTime(ReadJidSetting(LAST_MAIL_TIME_FROM_JID, jid)), lastThreadId(ReadJidSetting(LAST_THREAD_ID_FROM_JID, jid)); - TCHAR id[30]; + wchar_t id[30]; mir_sntprintf(id, JABBER_IQID_FORMAT, uID); xmlAddAttr(node, ATTRNAME_ID, id); @@ -246,7 +244,7 @@ void SetNotificationSetting(LPCTSTR jidWithResource, IJabberInterface *ji) ptrT jid(ExtractJid(jidWithResource)); xmlAddAttr(node, ATTRNAME_TO, jid); - TCHAR id[30]; + wchar_t id[30]; mir_sntprintf(id, JABBER_IQID_FORMAT, ji->SerialNext()); xmlAddAttr(node, ATTRNAME_ID, id); @@ -293,7 +291,7 @@ BOOL SendHandler(IJabberInterface *ji, HXML node, void *) if (queryNode) { LPCTSTR ptszId = xmlGetAttrValue(node, ATTRNAME_ID); if (ptszId) - ji->AddTemporaryIqHandler(DiscoverHandler, JABBER_IQ_TYPE_RESULT, _ttoi(ptszId + 4), NULL, RESPONSE_TIMEOUT, 500); + ji->AddTemporaryIqHandler(DiscoverHandler, JABBER_IQ_TYPE_RESULT, _wtoi(ptszId + 4), NULL, RESPONSE_TIMEOUT, 500); } if (!mir_tstrcmp(xmlGetName(node), L"presence") && xmlGetAttrValue(node, ATTRNAME_TO) == 0) { @@ -412,7 +410,7 @@ int OnExtListInit(WPARAM wParam, LPARAM lParam) { GoogleTalkAcc *gta = isGoogle(lParam); if (gta != NULL) { - LIST *pList = (LIST*)wParam; + LIST *pList = (LIST*)wParam; pList->insert(JABBER_EXT_GTALK_PMUC); } return 0; diff --git a/protocols/GTalkExt/src/inbox.cpp b/protocols/GTalkExt/src/inbox.cpp index 5b0ab1159e..f4e6c3ee4d 100644 --- a/protocols/GTalkExt/src/inbox.cpp +++ b/protocols/GTalkExt/src/inbox.cpp @@ -200,12 +200,12 @@ void OpenContactInbox(LPCSTR szModuleName) if (tszJid == NULL) return; - LPTSTR host = _tcschr(tszJid, '@'); + LPTSTR host = wcschr(tszJid, '@'); if (!host) return; *host++ = 0; - TCHAR buf[1024]; + wchar_t buf[1024]; if (mir_tstrcmpi(host, COMMON_GMAIL_HOST1) && mir_tstrcmpi(host, COMMON_GMAIL_HOST2)) mir_sntprintf(buf, INBOX_URL_FORMAT, L"a/", host); // hosted else diff --git a/protocols/GTalkExt/src/notifications.cpp b/protocols/GTalkExt/src/notifications.cpp index 6b167af949..fda2db7eb5 100644 --- a/protocols/GTalkExt/src/notifications.cpp +++ b/protocols/GTalkExt/src/notifications.cpp @@ -177,7 +177,7 @@ MCONTACT SetupPseudocontact(LPCTSTR jid, LPCTSTR unreadCount, LPCSTR acc, LPCTST // SetAvatar(hContact); if (displayName == NULL) { - TCHAR *tszTemp = (TCHAR*)alloca((mir_tstrlen(jid) + mir_tstrlen(unreadCount) + 3 + 1) * sizeof(TCHAR)); + wchar_t *tszTemp = (wchar_t*)alloca((mir_tstrlen(jid) + mir_tstrlen(unreadCount) + 3 + 1) * sizeof(wchar_t)); FormatPseudocontactDisplayName(tszTemp, jid, unreadCount); db_set_ts(hContact, CLIST_MODULE_NAME, CONTACT_DISPLAY_NAME_SETTING, tszTemp); } @@ -230,8 +230,8 @@ void ShowNotification(LPCSTR acc, POPUPDATAT *data, LPCTSTR jid, LPCTSTR url, LP } data->PluginWindowProc = PopupProc; - size_t lurl = (mir_tstrlen(url) + 1) * sizeof(TCHAR); - size_t ljid = (mir_tstrlen(jid) + 1) * sizeof(TCHAR); + size_t lurl = (mir_tstrlen(url) + 1) * sizeof(wchar_t); + size_t ljid = (mir_tstrlen(jid) + 1) * sizeof(wchar_t); POPUP_DATA_HEADER *ppdh = (POPUP_DATA_HEADER*)malloc(sizeof(POPUP_DATA_HEADER) + lurl + ljid); ppdh->MarkRead = FALSE; diff --git a/protocols/GTalkExt/src/options.cpp b/protocols/GTalkExt/src/options.cpp index d141179cc8..02394e0949 100644 --- a/protocols/GTalkExt/src/options.cpp +++ b/protocols/GTalkExt/src/options.cpp @@ -26,15 +26,15 @@ #define ACCOUNT_PROP_NAME L"{BF447EBA-27AE-4DB7-893C-FC42A3F74D75}" #define DIALOG_INITIALIZED_PROP_NAME L"{5EE59FE5-679A-4A29-B0A1-03092E7AC20E}" -#define POPUPS_OPTIONS_GROUP LPGENT("Popups") -#define NETWORK_OPTIONS_GROUP LPGENT("Network") +#define POPUPS_OPTIONS_GROUP LPGENW("Popups") +#define NETWORK_OPTIONS_GROUP LPGENW("Network") #define NOTIFY_SETTINGS_FROM_MOD_NAME SHORT_PLUGIN_NAME ".NotifySettingsFromModName" -#define TEST_LETTER_SUBJECT LPGENT("Why C sucks") +#define TEST_LETTER_SUBJECT LPGENW("Why C sucks") #define TEST_LETTER_INBOX L"brickstrace@gmail.com [1]" #define TEST_LETTER_SENDER L" bems\n" -#define TEST_LETTER_SNIP LPGENT("* Primitive type system\n* No overloading\n* Limited possibility of data abstraction, polymorphism, subtyping and code reuse\n* No metaprogramming except preprocessor macros\n* No exceptions") +#define TEST_LETTER_SNIP LPGENW("* Primitive type system\n* No overloading\n* Limited possibility of data abstraction, polymorphism, subtyping and code reuse\n* No metaprogramming except preprocessor macros\n* No exceptions") void CheckControlsEnabled(HWND wnd) { @@ -159,10 +159,10 @@ void ShowTestPopup(HWND wnd) mir_sntprintf(data.lptzText, TranslateTS(FULL_NOTIFICATION_FORMAT), TranslateTS(TEST_LETTER_SUBJECT), TranslateTS(TEST_LETTER_SENDER), TranslateTS(TEST_LETTER_SNIP)); int len = SendDlgItemMessage(wnd, IDC_TIMEOUTEDIT, WM_GETTEXTLENGTH, 0, 0) + 1; - LPTSTR timeout = (LPTSTR)_alloca(len * sizeof(TCHAR)); + LPTSTR timeout = (LPTSTR)_alloca(len * sizeof(wchar_t)); GetDlgItemText(wnd, IDC_TIMEOUTEDIT, timeout, len); - data.iSeconds = _ttoi(timeout); + data.iSeconds = _wtoi(timeout); data.lchIcon = IcoLib_GetIconByHandle(iconList[0].hIcolib); data.colorBack = (COLORREF)SendDlgItemMessage(wnd, IDC_BACKCOLORPICKER, CPM_GETCOLOUR, 0, 0); @@ -176,7 +176,7 @@ void ShowTestPopup(HWND wnd) INT_PTR CALLBACK PopupsOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam) { - TCHAR timeout[20]; + wchar_t timeout[20]; switch (msg) { case WM_INITDIALOG: @@ -184,7 +184,7 @@ INT_PTR CALLBACK PopupsOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM SendDlgItemMessage(wnd, IDC_BACKCOLORPICKER, CPM_SETCOLOUR, 0, (LPARAM)db_get_dw(0, SHORT_PLUGIN_NAME, BACK_COLOR_SETTING, 0)); SendDlgItemMessage(wnd, IDC_TEXTCOLORPICKER, CPM_SETCOLOUR, 0, (LPARAM)db_get_dw(0, SHORT_PLUGIN_NAME, TEXT_COLOR_SETTING, 0)); - _itot(db_get_dw(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, 0), timeout, 10); + _itow(db_get_dw(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, 0), timeout, 10); SetDlgItemText(wnd, IDC_TIMEOUTEDIT, timeout); SetProp(wnd, DIALOG_INITIALIZED_PROP_NAME, (HANDLE)TRUE); @@ -212,7 +212,7 @@ INT_PTR CALLBACK PopupsOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM db_set_dw(0, SHORT_PLUGIN_NAME, TEXT_COLOR_SETTING, (DWORD)SendDlgItemMessage(wnd, IDC_TEXTCOLORPICKER, CPM_GETCOLOUR, 0, 0)); GetDlgItemText(wnd, IDC_TIMEOUTEDIT, timeout, _countof(timeout)); - db_set_dw(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, _ttoi(timeout)); + db_set_dw(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, _wtoi(timeout)); } return 0; } @@ -223,11 +223,11 @@ int OptionsInitialization(WPARAM wParam, LPARAM) { if (ServiceExists(MS_POPUP_ADDPOPUPT)) { OPTIONSDIALOGPAGE odp = { 0 }; - odp.ptszTitle = MAIL_NOTIFICATIONS; + odp.pwszTitle = MAIL_NOTIFICATIONS; odp.pfnDlgProc = PopupsOptionsDlgProc; odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUPSETTINGS); odp.hInstance = g_hInst; - odp.ptszGroup = POPUPS_OPTIONS_GROUP; + odp.pwszGroup = POPUPS_OPTIONS_GROUP; odp.flags = ODPF_UNICODE | ODPF_USERINFOTAB; Options_AddPage(wParam, &odp); } @@ -237,13 +237,13 @@ int OptionsInitialization(WPARAM wParam, LPARAM) PROTOACCOUNT *pa = Proto_GetAccount(szProto); if (pa != NULL) { OPTIONSDIALOGPAGE odp = { 0 }; - odp.ptszTitle = pa->tszAccountName; + odp.pwszTitle = pa->tszAccountName; odp.pfnDlgProc = AccOptionsDlgProc; odp.pszTemplate = MAKEINTRESOURCEA(IDD_MAILSETTINGS); odp.hInstance = g_hInst; - odp.ptszGroup = NETWORK_OPTIONS_GROUP; + odp.pwszGroup = NETWORK_OPTIONS_GROUP; odp.flags = ODPF_UNICODE | ODPF_USERINFOTAB | ODPF_DONTTRANSLATE; - odp.ptszTab = MAIL_NOTIFICATIONS; + odp.pwszTab = MAIL_NOTIFICATIONS; odp.dwInitParam = (LPARAM)szProto; Options_AddPage(wParam, &odp); } diff --git a/protocols/GTalkExt/src/options.h b/protocols/GTalkExt/src/options.h index f6de20a154..b9bb84ceea 100644 --- a/protocols/GTalkExt/src/options.h +++ b/protocols/GTalkExt/src/options.h @@ -25,9 +25,9 @@ #define JABBER_FEAT_GTALK_PMUC L"http://www.google.com/xmpp/protocol/pmuc/v1" -#define MAIL_NOTIFICATIONS LPGENT("GMail notifications") -#define FULL_NOTIFICATION_FORMAT LPGENT("subject\n %s\nfrom\n%s\n%s\n") -#define SHORT_NOTIFICATION_FORMAT LPGENT("subject\n %s\nfrom\n%s") +#define MAIL_NOTIFICATIONS LPGENW("GMail notifications") +#define FULL_NOTIFICATION_FORMAT LPGENW("subject\n %s\nfrom\n%s\n%s\n") +#define SHORT_NOTIFICATION_FORMAT LPGENW("subject\n %s\nfrom\n%s") #define PSEUDOCONTACT_LINK "GTalkExtNotifyContact" #define PSEUDOCONTACT_FLAG "IsNotifyContact" diff --git a/protocols/GTalkExt/src/stdafx.h b/protocols/GTalkExt/src/stdafx.h index 6df16f3fee..f545ff3b25 100644 --- a/protocols/GTalkExt/src/stdafx.h +++ b/protocols/GTalkExt/src/stdafx.h @@ -27,7 +27,6 @@ #include #include #include -#include // Windows Header Files: #include diff --git a/protocols/GTalkExt/src/tipper_items.cpp b/protocols/GTalkExt/src/tipper_items.cpp index 3839aeb5d1..ef886b764f 100644 --- a/protocols/GTalkExt/src/tipper_items.cpp +++ b/protocols/GTalkExt/src/tipper_items.cpp @@ -40,7 +40,7 @@ static LPSTR TipperItemProps[] = #define TIPPER_ITEMS_MOD_NAME "Tipper_Items" #define TIPPER_ITEM_COUNT_SETTING "DINumValues" #define UNREAD_THREADS_RAW L"%raw:" _T(SHORT_PLUGIN_NAME) L"/UnreadThreads%" -#define UNREAD_THREADS_LABEL LPGENT("Unread threads:") +#define UNREAD_THREADS_LABEL LPGENW("Unread threads:") void ShiftTipperSettings(LPSTR buff, int count, LPSTR format) { @@ -99,7 +99,7 @@ void AddTipperItem() for (i = itemCount; i > 0; i /= 10) l++; // var setting path l += 30; // const setting part - LPSTR setting = (LPSTR)_alloca(l * sizeof(TCHAR)); + LPSTR setting = (LPSTR)_alloca(l * sizeof(wchar_t)); for (i = 0; i < itemCount; i++) { mir_snprintf(setting, l, VALUE_SETTING_PROP, i); -- cgit v1.2.3