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/Ping/src/log.cpp | 18 +++++++++--------- plugins/Ping/src/menu.cpp | 6 +++--- plugins/Ping/src/options.cpp | 12 ++++++------ plugins/Ping/src/pinggraph.cpp | 6 +++--- plugins/Ping/src/pingthread.cpp | 22 +++++++++++----------- plugins/Ping/src/stdafx.h | 10 +++++----- plugins/Ping/src/utils.cpp | 2 +- plugins/Ping/src/utils.h | 2 +- 8 files changed, 39 insertions(+), 39 deletions(-) (limited to 'plugins/Ping/src') diff --git a/plugins/Ping/src/log.cpp b/plugins/Ping/src/log.cpp index 59538f577e..01bb07e671 100644 --- a/plugins/Ping/src/log.cpp +++ b/plugins/Ping/src/log.cpp @@ -2,7 +2,7 @@ INT_PTR Log(WPARAM wParam, LPARAM) { - TCHAR buf[1024], tbuf[512], dbuf[512]; + wchar_t buf[1024], tbuf[512], dbuf[512]; CallService(PLUG "/GetLogFilename", (WPARAM)1024, (LPARAM)buf); //char TBcapt[255]; @@ -13,15 +13,15 @@ INT_PTR Log(WPARAM wParam, LPARAM) { GetTimeFormat(LOCALE_USER_DEFAULT, 0, &systime, 0, tbuf, 512); GetDateFormat(LOCALE_USER_DEFAULT, 0, &systime, 0, dbuf, 512); - TCHAR *line = (TCHAR *)wParam; + wchar_t *line = (wchar_t *)wParam; - FILE *f = _tfopen(buf, L"a+"); + FILE *f = _wfopen(buf, L"a+"); if (f) { if (options.log_csv) { - _ftprintf(f, L"%s, %s, %s\n", dbuf, tbuf, line); + fwprintf(f, L"%s, %s, %s\n", dbuf, tbuf, line); } else { - _ftprintf(f, L"%s, %s: %s\n", dbuf, tbuf, line); + fwprintf(f, L"%s, %s: %s\n", dbuf, tbuf, line); } fclose(f); } @@ -31,7 +31,7 @@ INT_PTR Log(WPARAM wParam, LPARAM) { INT_PTR GetLogFilename(WPARAM wParam, LPARAM lParam) { DBVARIANT dbv; - TCHAR *filename = (TCHAR *)lParam; + wchar_t *filename = (wchar_t *)lParam; if (db_get_ts(0, PLUG, "LogFilename", &dbv)) { CallService(MS_DB_GETPROFILEPATHT, wParam, (LPARAM)filename); mir_tstrncat(filename, L"\\ping_log.txt", wParam - mir_tstrlen(filename)); @@ -41,18 +41,18 @@ INT_PTR GetLogFilename(WPARAM wParam, LPARAM lParam) { db_free(&dbv); } - ((TCHAR *)lParam)[wParam - 1] = 0; + ((wchar_t *)lParam)[wParam - 1] = 0; return 0; } INT_PTR SetLogFilename(WPARAM, LPARAM lParam) { - db_set_ts(0, PLUG, "LogFilename", (TCHAR *)lParam); + db_set_ts(0, PLUG, "LogFilename", (wchar_t *)lParam); return 0; } INT_PTR ViewLogData(WPARAM wParam, LPARAM) { - TCHAR buf[MAX_PATH]; + wchar_t buf[MAX_PATH]; CallService(PLUG "/GetLogFilename", (WPARAM)MAX_PATH, (LPARAM)buf); return (INT_PTR)ShellExecute((HWND)wParam, L"edit", buf, L"", L"", SW_SHOW); } diff --git a/plugins/Ping/src/menu.cpp b/plugins/Ping/src/menu.cpp index 4d886697dc..1fd1ce70dd 100644 --- a/plugins/Ping/src/menu.cpp +++ b/plugins/Ping/src/menu.cpp @@ -8,20 +8,20 @@ void InitMenus() // main menu CMenuItem mi; mi.flags = CMIF_TCHAR; - mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Ping"), 500099900); + mi.root = Menu_CreateRoot(MO_MAIN, LPGENW("Ping"), 500099900); Menu_ConfigureItem(mi.root, MCI_OPT_UID, "FF273885-6AEC-4C8A-B8BC-9247D920F223"); SET_UID(mi, 0xc9a4d17a, 0xd5fa, 0x40d9, 0xbe, 0x7b, 0x9e, 0x2e, 0x5b, 0xbf, 0x8, 0x59); mi.position = 2000060000; mi.hIcolibItem = hIconResponding; - mi.name.t = LPGENT("Enable all pings"); + mi.name.w = LPGENW("Enable all pings"); mi.pszService = PLUG "/EnableAll"; Menu_AddMainMenuItem(&mi); SET_UID(mi, 0x1dac6ea6, 0x116e, 0x41a3, 0xa6, 0xe8, 0x42, 0xdf, 0xf7, 0x27, 0xc4, 0x7c); mi.position = 2000060001; mi.hIcolibItem = hIconDisabled; - mi.name.t = LPGENT("Disable all pings"); + mi.name.w = LPGENW("Disable all pings"); mi.pszService = PLUG "/DisableAll"; Menu_AddMainMenuItem(&mi); } diff --git a/plugins/Ping/src/options.cpp b/plugins/Ping/src/options.cpp index 56e501ee40..853473e3cc 100644 --- a/plugins/Ping/src/options.cpp +++ b/plugins/Ping/src/options.cpp @@ -81,7 +81,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break; case IDC_BTN_LOGBROWSE: { - TCHAR filter[MAX_PATH]; + wchar_t filter[MAX_PATH]; mir_sntprintf(filter, L"%s%c*.txt%c%s%c*.*%c", TranslateT("Text Files (*.txt)"), 0, 0, TranslateT("All Files"), 0, 0); OPENFILENAME ofn = { 0 }; ofn.lStructSize = sizeof(ofn); @@ -169,7 +169,7 @@ INT_PTR CALLBACK DlgProcDestEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM) case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) { - TCHAR *ret = pcli->pfnGetStatusModeDescription(i, 0); + wchar_t *ret = pcli->pfnGetStatusModeDescription(i, 0); SendDlgItemMessage(hwndDlg, IDC_COMBO_DESTSTAT, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)ret); SendDlgItemMessage(hwndDlg, IDC_COMBO_DESTSTAT2, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)ret); } @@ -506,15 +506,15 @@ int PingOptInit(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 }; odp.hInstance = hInst; odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; - odp.ptszGroup = LPGENT("Network"); - odp.ptszTitle = LPGENT("Ping"); + odp.pwszGroup = LPGENW("Network"); + odp.pwszTitle = LPGENW("Ping"); - odp.ptszTab = LPGENT("Settings"); + odp.pwszTab = LPGENW("Settings"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_DIALOG1); odp.pfnDlgProc = DlgProcOpts; Options_AddPage(wParam, &odp); - odp.ptszTab = LPGENT("Hosts"); + odp.pwszTab = LPGENW("Hosts"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_DIALOG2); odp.pfnDlgProc = DlgProcOpts2; Options_AddPage(wParam, &odp); diff --git a/plugins/Ping/src/pinggraph.cpp b/plugins/Ping/src/pinggraph.cpp index bb9b2f94b3..a303aae062 100644 --- a/plugins/Ping/src/pinggraph.cpp +++ b/plugins/Ping/src/pinggraph.cpp @@ -187,7 +187,7 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, GetSysColor(COLOR_3DDKSHADOW)); - TCHAR buff[64]; + wchar_t buff[64]; if (wd->show_grid) { mir_sntprintf(buff, TranslateT("%d ms"), MARK_TIME); @@ -275,11 +275,11 @@ INT_PTR ShowGraph(WPARAM wParam, LPARAM lParam) { wndclass.lpszClassName = _T(PLUG) L"GraphWindow"; RegisterClass(&wndclass); - TCHAR title[256]; + wchar_t title[256]; mir_tstrncpy(title, TranslateT("Ping Graph"), _countof(title)); if (lParam) { mir_tstrncat(title, L" - ", _countof(title) - mir_tstrlen(title)); - mir_tstrncat(title, (TCHAR *)lParam, _countof(title) - mir_tstrlen(title)); + mir_tstrncat(title, (wchar_t *)lParam, _countof(title) - mir_tstrlen(title)); } HWND parent = 0; diff --git a/plugins/Ping/src/pingthread.cpp b/plugins/Ping/src/pingthread.cpp index 16a160387b..76fab1eb0e 100644 --- a/plugins/Ping/src/pingthread.cpp +++ b/plugins/Ping/src/pingthread.cpp @@ -55,7 +55,7 @@ void set_list_changed(bool f) list_changed = f; } -void SetProtoStatus(TCHAR *pszLabel, char *pszProto, int if_status, int new_status) +void SetProtoStatus(wchar_t *pszLabel, char *pszProto, int if_status, int new_status) { if (mir_strcmp(pszProto, Translate("")) == 0) { int num_protocols; @@ -69,7 +69,7 @@ void SetProtoStatus(TCHAR *pszLabel, char *pszProto, int if_status, int new_stat if (ProtoServiceExists(pszProto, PS_GETSTATUS)) { if (CallProtoService(pszProto, PS_GETSTATUS, 0, 0) == if_status) { if (options.logging) { - TCHAR buf[1024]; + wchar_t buf[1024]; mir_sntprintf(buf, TranslateT("%s - setting status of protocol '%S' (%d)"), pszLabel, pszProto, new_status); CallService(PLUG "/Log", (WPARAM)buf, 0); } @@ -194,7 +194,7 @@ void __cdecl sttCheckStatusThreadProc(void*) } } if (pa.miss_count == -1 - options.retries && options.logging) { - TCHAR buf[512]; + wchar_t buf[512]; mir_sntprintf(buf, TranslateT("%s - reply, %d"), pa.pszLabel, pa.round_trip_time); CallService(PLUG "/Log", (WPARAM)buf, 0); } @@ -208,7 +208,7 @@ void __cdecl sttCheckStatusThreadProc(void*) ShowPopup(TranslateT("Ping Timeout"), pa.pszLabel, 0); } if (pa.miss_count == 1 + options.retries && options.logging) { - TCHAR buf[512]; + wchar_t buf[512]; mir_sntprintf(buf, TranslateT("%s - timeout"), pa.pszLabel); CallService(PLUG "/Log", (WPARAM)buf, 0); } @@ -306,7 +306,7 @@ INT_PTR PingPlugShowWindow(WPARAM, LPARAM) void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) { if (frame_id != -1 && ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) { - TCHAR TBcapt[255]; + wchar_t TBcapt[255]; if (total > 0) mir_sntprintf(TBcapt, L"Ping (%d/%d)", upCount, total); else @@ -388,7 +388,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar TextOut(dis->hDC, dis->rcItem.left + 16 + 4, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, itemData.pszLabel, (int)mir_tstrlen(itemData.pszLabel)); if (itemData.status != PS_DISABLED) { - TCHAR buf[256]; + wchar_t buf[256]; if (itemData.responding) { mir_sntprintf(buf, TranslateT("%d ms"), itemData.round_trip_time); GetTextExtentPoint32(dis->hDC, buf, (int)mir_tstrlen(buf), &textSize); @@ -716,7 +716,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar if (wake) SetEvent(hWakeEvent); if (options.logging) { - TCHAR buf[1024]; + wchar_t buf[1024]; mir_sntprintf(buf, L"%s - %s", pItemData->pszLabel, (wake ? TranslateT("enabled") : TranslateT("double clicked"))); CallService(PLUG "/Log", (WPARAM)buf, 0); } @@ -902,13 +902,13 @@ void InitList() CreateServiceFunction(PLUG "/ShowWindow", PingPlugShowWindow); CMenuItem mi; - mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Ping"), 1000200001); + mi.root = Menu_CreateRoot(MO_MAIN, LPGENW("Ping"), 1000200001); Menu_ConfigureItem(mi.root, MCI_OPT_UID, "7CFBF239-86B5-48B2-8D5B-39E09A7DB514"); SET_UID(mi, 0x4adbd753, 0x27d6, 0x457a, 0xa6, 0x6, 0xdf, 0x4f, 0x2c, 0xd8, 0xb9, 0x3b); mi.flags = CMIF_TCHAR; mi.position = 3000320001; - mi.name.t = LPGENT("Show/Hide &Ping Window"); + mi.name.w = LPGENW("Show/Hide &Ping Window"); mi.pszService = PLUG "/ShowWindow"; Menu_AddMainMenuItem(&mi); @@ -917,8 +917,8 @@ void InitList() } font_id.cbSize = sizeof(FontIDT); - mir_tstrncpy(font_id.group, LPGENT("Ping"), _countof(font_id.group)); - mir_tstrncpy(font_id.name, LPGENT("List"), _countof(font_id.name)); + mir_tstrncpy(font_id.group, LPGENW("Ping"), _countof(font_id.group)); + mir_tstrncpy(font_id.name, LPGENW("List"), _countof(font_id.name)); mir_strncpy(font_id.dbSettingsGroup, "PING", _countof(font_id.dbSettingsGroup)); mir_strncpy(font_id.prefix, "Font", _countof(font_id.prefix)); mir_tstrncpy(font_id.backgroundGroup, L"Ping", _countof(font_id.backgroundGroup)); diff --git a/plugins/Ping/src/stdafx.h b/plugins/Ping/src/stdafx.h index 746a2d596b..1e92a443d8 100644 --- a/plugins/Ping/src/stdafx.h +++ b/plugins/Ping/src/stdafx.h @@ -56,7 +56,7 @@ typedef struct { int ping_period, ping_timeout; bool show_popup, show_popup2, block_reps, logging; - TCHAR log_filename[MAX_PATH]; + wchar_t log_filename[MAX_PATH]; bool no_test_icon; int row_height; int indent; @@ -83,16 +83,16 @@ typedef LinkedList< HistPair > HistoryList; struct PINGADDRESS { int cbSize; //size in bytes of this structure DWORD item_id; - TCHAR pszName[MAX_PINGADDRESS_STRING_LENGTH]; //IP address or domain name - TCHAR pszLabel[MAX_PINGADDRESS_STRING_LENGTH]; + wchar_t pszName[MAX_PINGADDRESS_STRING_LENGTH]; //IP address or domain name + wchar_t pszLabel[MAX_PINGADDRESS_STRING_LENGTH]; bool responding; int status; short round_trip_time; int miss_count; int port; // -1 for ICMP, non-zero for TCP char pszProto[MAX_PINGADDRESS_STRING_LENGTH]; - TCHAR pszCommand[MAX_PATH]; - TCHAR pszParams[MAX_PATH]; + wchar_t pszCommand[MAX_PATH]; + wchar_t pszParams[MAX_PATH]; unsigned int get_status; // on success, if status equals this unsigned int set_status; // set it to this int index; diff --git a/plugins/Ping/src/utils.cpp b/plugins/Ping/src/utils.cpp index dedd9cf470..c5f99d431d 100644 --- a/plugins/Ping/src/utils.cpp +++ b/plugins/Ping/src/utils.cpp @@ -26,7 +26,7 @@ void CALLBACK sttMainThreadCallback(ULONG_PTR dwParam) free(ppd); } -void __stdcall ShowPopup(TCHAR *line1, TCHAR *line2, int flags) +void __stdcall ShowPopup(wchar_t *line1, wchar_t *line2, int flags) { if (CallService(MS_SYSTEM_TERMINATED, 0, 0)) return; diff --git a/plugins/Ping/src/utils.h b/plugins/Ping/src/utils.h index f3be0598b6..d084a4ae9a 100644 --- a/plugins/Ping/src/utils.h +++ b/plugins/Ping/src/utils.h @@ -1,7 +1,7 @@ #ifndef _PING_UTILS #define _PING_UTILS -void __stdcall ShowPopup(TCHAR *line1, TCHAR *line2, int flags); +void __stdcall ShowPopup(wchar_t *line1, wchar_t *line2, int flags); INT_PTR PluginPing(WPARAM wParam, LPARAM lParam); -- cgit v1.2.3