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/StatusPlugins/StartupStatus/options.cpp | 28 +++++++++++----------- plugins/StatusPlugins/StartupStatus/profiles.cpp | 18 +++++++------- .../StatusPlugins/StartupStatus/startupstatus.cpp | 4 ++-- .../StatusPlugins/StartupStatus/startupstatus.h | 6 ++--- 4 files changed, 28 insertions(+), 28 deletions(-) (limited to 'plugins/StatusPlugins/StartupStatus') diff --git a/plugins/StatusPlugins/StartupStatus/options.cpp b/plugins/StatusPlugins/StartupStatus/options.cpp index f50907a46f..389b7a4d66 100644 --- a/plugins/StatusPlugins/StartupStatus/options.cpp +++ b/plugins/StatusPlugins/StartupStatus/options.cpp @@ -128,7 +128,7 @@ static char* GetCMDL(TSettingsList& protoSettings) ///////////////////////////////////////////////////////////////////////////////////////// // Link processing -static TCHAR* GetLinkDescription(TSettingsList& protoSettings) +static wchar_t* GetLinkDescription(TSettingsList& protoSettings) { if ( protoSettings.getCount() == 0 ) return NULL; @@ -137,7 +137,7 @@ static TCHAR* GetLinkDescription(TSettingsList& protoSettings) for (int i=0; i < protoSettings.getCount(); i++) { TSSSetting &p = protoSettings[i]; - TCHAR *status; + wchar_t *status; if ( p.status == ID_STATUS_LAST) status = TranslateT(""); else if (p.status == ID_STATUS_CURRENT) @@ -161,9 +161,9 @@ static TCHAR* GetLinkDescription(TSettingsList& protoSettings) HRESULT CreateLink(TSettingsList& protoSettings) { - TCHAR savePath[MAX_PATH]; + wchar_t savePath[MAX_PATH]; if (SHGetSpecialFolderPath(NULL, savePath, 0x10, FALSE)) - _tcsncat_s(savePath, SHORTCUT_FILENAME, _countof(savePath) - mir_tstrlen(savePath)); + wcsncat_s(savePath, SHORTCUT_FILENAME, _countof(savePath) - mir_tstrlen(savePath)); else mir_sntprintf(savePath, L".\\%s", SHORTCUT_FILENAME); @@ -172,11 +172,11 @@ HRESULT CreateLink(TSettingsList& protoSettings) HRESULT hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, ( void** )&psl); if (SUCCEEDED(hres)) { char *args = GetCMDLArguments(protoSettings); - TCHAR *desc = GetLinkDescription(protoSettings); + wchar_t *desc = GetLinkDescription(protoSettings); // Set the path to the shortcut target, and add the // description. - TCHAR path[MAX_PATH]; + wchar_t path[MAX_PATH]; GetModuleFileName(NULL, path, _countof(path)); psl->SetPath(path); psl->SetDescription(desc); @@ -323,7 +323,7 @@ static INT_PTR CALLBACK StartupStatusOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wPa break; } else { - TCHAR text[128]; + wchar_t text[128]; mir_sntprintf(text, TranslateT("size: %d x %d"), db_get_dw(NULL, MODULE_CLIST, SETTING_WIDTH, 0), db_get_dw(NULL, MODULE_CLIST, SETTING_HEIGHT, 0)); @@ -343,7 +343,7 @@ static INT_PTR CALLBACK StartupStatusOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wPa int defProfile; int profileCount = GetProfileCount((WPARAM)&defProfile, 0); for ( int i=0; i < profileCount; i++ ) { - TCHAR profileName[128]; + wchar_t profileName[128]; if ( GetProfileName(i, (LPARAM)profileName)) continue; @@ -427,7 +427,7 @@ static INT_PTR CALLBACK StartupStatusOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wPa GetProfile( defProfile, *ps ); for ( int i=0; i < ps->getCount(); i++ ) if ( (*ps)[i].szMsg != NULL ) - (*ps)[i].szMsg = _tcsdup( (*ps)[i].szMsg ); + (*ps)[i].szMsg = wcsdup( (*ps)[i].szMsg ); CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CMDLOPTIONS), hwndDlg, CmdlOptionsDlgProc, (LPARAM)ps); } @@ -536,7 +536,7 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP else { for (int j=0; j < ar.getCount(); j++) if ( ar[j].szMsg != NULL) - ar[j].szMsg = _tcsdup( ar[j].szMsg ); + ar[j].szMsg = wcsdup( ar[j].szMsg ); ppo->tszName = db_get_tsa(NULL, MODULENAME, OptName(i, SETTING_PROFILENAME)); if (ppo->tszName == NULL) { @@ -660,7 +660,7 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP case UM_ADDPROFILE: { - TCHAR *tszName = (TCHAR*)lParam; + wchar_t *tszName = (wchar_t*)lParam; if (tszName == NULL) break; @@ -738,7 +738,7 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP ps->szMsg = NULL; if (IsDlgButtonChecked(hwndDlg, IDC_CUSTOMMSG)) { len = SendDlgItemMessage(hwndDlg, IDC_STATUSMSG, WM_GETTEXTLENGTH, 0, 0); - ps->szMsg = (TCHAR*)calloc(sizeof(TCHAR), len+1); + ps->szMsg = (wchar_t*)calloc(sizeof(wchar_t), len+1); GetDlgItemText(hwndDlg, IDC_STATUSMSG, ps->szMsg, (len + 1)); } SendMessage(hwndDlg, UM_SETSTATUSMSG, 0, 0); @@ -757,7 +757,7 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP ps->szMsg = NULL; } int len = SendDlgItemMessage(hwndDlg, IDC_STATUSMSG, WM_GETTEXTLENGTH, 0, 0); - ps->szMsg = (TCHAR*)calloc(sizeof(TCHAR), len+1); + ps->szMsg = (wchar_t*)calloc(sizeof(wchar_t), len+1); GetDlgItemText(hwndDlg, IDC_STATUSMSG, ps->szMsg, (len + 1)); } break; @@ -867,7 +867,7 @@ INT_PTR CALLBACK addProfileDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lP case WM_COMMAND: if (LOWORD(wParam) == IDC_OK) { - TCHAR profileName[128]; + wchar_t profileName[128]; GetDlgItemText(hwndDlg, IDC_PROFILENAME, profileName, _countof(profileName)); SendMessage(hwndParent, UM_ADDPROFILE, 0, (LPARAM)profileName); // done and exit diff --git a/plugins/StatusPlugins/StartupStatus/profiles.cpp b/plugins/StatusPlugins/StartupStatus/profiles.cpp index cfc69ce732..d370e53999 100644 --- a/plugins/StatusPlugins/StartupStatus/profiles.cpp +++ b/plugins/StatusPlugins/StartupStatus/profiles.cpp @@ -65,12 +65,12 @@ static int CreateMainMenuItems(WPARAM, LPARAM) mcount = 0; int count = GetProfileCount(0, 0); for (int i = 0; i < count && mcount < MAX_MMITEMS; i++) { - TCHAR profilename[128]; + wchar_t profilename[128]; if (!db_get_b(NULL, MODULENAME, OptName(i, SETTING_CREATEMMITEM), 0) || GetProfileName(i, (LPARAM)profilename)) continue; if (db_get_b(NULL, MODULENAME, OptName(i, SETTING_INSUBMENU), 1) && !mi.root) { - mi.root = Menu_CreateRoot(MO_STATUS, LPGENT("Status profiles"), 2000100000); + mi.root = Menu_CreateRoot(MO_STATUS, LPGENW("Status profiles"), 2000100000); Menu_ConfigureItem(mi.root, MCI_OPT_UID, "1AB30D51-BABA-4B27-9288-1A12278BAD8D"); } @@ -78,7 +78,7 @@ static int CreateMainMenuItems(WPARAM, LPARAM) mir_snprintf(servicename, "%s%d", MS_SS_MENUSETPROFILEPREFIX, mcount); hProfileServices[mcount] = CreateServiceFunctionParam(servicename, profileService, mcount); - mi.name.t = profilename; + mi.name.w = profilename; mi.position = 2000100000 + mcount; mi.pszService = servicename; if (Menu_AddStatusMenuItem(&mi)) @@ -100,9 +100,9 @@ INT_PTR GetProfileName(WPARAM wParam, LPARAM lParam) if (profile >= count && count > 0) return -1; - TCHAR* buf = (TCHAR*)lParam; + wchar_t* buf = (wchar_t*)lParam; if (count == 0) { - _tcsncpy(buf, TranslateT("default"), 128 - 1); + wcsncpy(buf, TranslateT("default"), 128 - 1); return 0; } @@ -112,7 +112,7 @@ INT_PTR GetProfileName(WPARAM wParam, LPARAM lParam) if (db_get_ts(NULL, MODULENAME, setting, &dbv)) return -1; - _tcsncpy(buf, dbv.ptszVal, 128 - 1); buf[127] = 0; + wcsncpy(buf, dbv.ptszVal, 128 - 1); buf[127] = 0; db_free(&dbv); return 0; } @@ -130,7 +130,7 @@ INT_PTR GetProfileCount(WPARAM wParam, LPARAM) return count; } -TCHAR *GetStatusMessage(int profile, char *szProto) +wchar_t *GetStatusMessage(int profile, char *szProto) { char dbSetting[80]; DBVARIANT dbv; @@ -139,7 +139,7 @@ TCHAR *GetStatusMessage(int profile, char *szProto) if ((pce[i].profile == profile) && (!mir_strcmp(pce[i].szProto, szProto))) { mir_snprintf(dbSetting, "%d_%s_%s", profile, szProto, SETTING_PROFILE_STSMSG); if (!db_get_ts(NULL, MODULENAME, dbSetting, &dbv)) { // reload from db - pce[i].msg = (TCHAR*)realloc(pce[i].msg, sizeof(TCHAR)*(mir_tstrlen(dbv.ptszVal) + 1)); + pce[i].msg = (wchar_t*)realloc(pce[i].msg, sizeof(wchar_t)*(mir_tstrlen(dbv.ptszVal) + 1)); if (pce[i].msg != NULL) { mir_tstrcpy(pce[i].msg, dbv.ptszVal); } @@ -163,7 +163,7 @@ TCHAR *GetStatusMessage(int profile, char *szProto) pce[pceCount].msg = NULL; mir_snprintf(dbSetting, "%d_%s_%s", profile, szProto, SETTING_PROFILE_STSMSG); if (!db_get_ts(NULL, MODULENAME, dbSetting, &dbv)) { - pce[pceCount].msg = _tcsdup(dbv.ptszVal); + pce[pceCount].msg = wcsdup(dbv.ptszVal); db_free(&dbv); } pceCount++; diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp index e592da5e71..13d708f0de 100644 --- a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp +++ b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp @@ -63,7 +63,7 @@ TSSSetting::TSSSetting(int profile, PROTOACCOUNT *pa) szMsg = GetStatusMessage(profile, szName); if (szMsg) - szMsg = _tcsdup(szMsg); + szMsg = wcsdup(szMsg); } TSSSetting::~TSSSetting() @@ -173,7 +173,7 @@ static void SetLastStatusMessages(TSettingsList &ps) DBVARIANT dbv; if (ps[i].szMsg == NULL && !db_get_ts(NULL, MODULENAME, dbSetting, &dbv)) { - ps[i].szMsg = _tcsdup(dbv.ptszVal); // remember this won't be freed + ps[i].szMsg = wcsdup(dbv.ptszVal); // remember this won't be freed db_free(&dbv); } } diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.h b/plugins/StatusPlugins/StartupStatus/startupstatus.h index 0346567861..5303ab3468 100644 --- a/plugins/StatusPlugins/StartupStatus/startupstatus.h +++ b/plugins/StatusPlugins/StartupStatus/startupstatus.h @@ -40,7 +40,7 @@ struct PROFILECE { int profile; char *szProto; - TCHAR *msg; + wchar_t *msg; }; struct PROFILEOPTIONS : public MZeroedObject @@ -51,7 +51,7 @@ struct PROFILEOPTIONS : public MZeroedObject mir_free(tszName); } - TCHAR *tszName; + wchar_t *tszName; TSettingsList* ps; BOOL showDialog; BOOL createTtb; @@ -144,7 +144,7 @@ TSettingsList* GetCurrentProtoSettings(); // profile int GetProfile(int profileID, TSettingsList& arSettings ); -TCHAR *GetStatusMessage(int profile, char *szProto); +wchar_t *GetStatusMessage(int profile, char *szProto); INT_PTR LoadAndSetProfile(WPARAM wParam, LPARAM lParam); INT_PTR GetProfileCount(WPARAM wParam, LPARAM lParam); -- cgit v1.2.3