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 --- .../AdvancedAutoAway/advancedautoaway.cpp | 4 +-- .../StatusPlugins/AdvancedAutoAway/msgoptions.cpp | 2 +- plugins/StatusPlugins/AdvancedAutoAway/options.cpp | 2 +- plugins/StatusPlugins/KeepStatus/keepstatus.cpp | 20 +++++++------- plugins/StatusPlugins/KeepStatus/options.cpp | 12 ++++---- plugins/StatusPlugins/StartupStatus/options.cpp | 28 +++++++++---------- plugins/StatusPlugins/StartupStatus/profiles.cpp | 18 ++++++------ .../StatusPlugins/StartupStatus/startupstatus.cpp | 4 +-- .../StatusPlugins/StartupStatus/startupstatus.h | 6 ++-- plugins/StatusPlugins/commonstatus.cpp | 22 +++++++-------- plugins/StatusPlugins/commonstatus.h | 3 +- plugins/StatusPlugins/confirmdialog.cpp | 32 +++++++++++----------- 12 files changed, 76 insertions(+), 77 deletions(-) (limited to 'plugins/StatusPlugins') diff --git a/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp b/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp index bd6ea8f7dc..1cb68c1f1d 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp +++ b/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp @@ -242,7 +242,7 @@ static int changeState(TAAAProtoSetting &setting, STATES newState) if (db_get_b(NULL, MODULENAME, StatusModeToDbSetting(setting.status, SETTING_MSGCUSTOM), FALSE)) { DBVARIANT dbv; if (!db_get_ts(NULL, MODULENAME, StatusModeToDbSetting(setting.status, SETTING_STATUSMSG), &dbv)) { - setting.szMsg = _tcsdup(dbv.ptszVal); + setting.szMsg = wcsdup(dbv.ptszVal); db_free(&dbv); } } @@ -375,7 +375,7 @@ static VOID CALLBACK AutoAwayTimer(HWND hwnd, UINT message, UINT_PTR idEvent, DW TAAAProtoSettingList ps = autoAwaySettings; for (int i = 0; i < ps.getCount(); i++) { if (ps[i].szMsg) - ps[i].szMsg = _tcsdup(ps[i].szMsg); + ps[i].szMsg = wcsdup(ps[i].szMsg); if (ps[i].status == ID_STATUS_DISABLED) ps[i].szName = ""; diff --git a/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp b/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp index 0ae73b66d0..818631c5dc 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp +++ b/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp @@ -127,7 +127,7 @@ INT_PTR CALLBACK DlgProcAutoAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L if (settings[i]->msg != NULL) SetDlgItemTextA(hwndDlg, IDC_STATUSMSG, settings[i]->msg); else { - ptrT msg((TCHAR*)CallService(MS_AWAYMSG_GETSTATUSMSGT, settings[i]->status, 0)); + ptrT msg((wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGT, settings[i]->status, 0)); SetDlgItemText(hwndDlg, IDC_STATUSMSG, (msg != NULL) ? msg : L""); } diff --git a/plugins/StatusPlugins/AdvancedAutoAway/options.cpp b/plugins/StatusPlugins/AdvancedAutoAway/options.cpp index fddb288e73..58e2dba951 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/options.cpp +++ b/plugins/StatusPlugins/AdvancedAutoAway/options.cpp @@ -205,7 +205,7 @@ static INT_PTR CALLBACK DlgProcAutoAwayRulesOpts(HWND hwndDlg, UINT msg, WPARAM SendDlgItemMessage(hwndDlg, IDC_LV2STATUS, CB_RESETCONTENT, 0, 0); for (int i=0; i < _countof(statusModeList); i++) { if ((flags & statusModePf2List[i]) || statusModePf2List[i] == PF2_OFFLINE || bSettingSame) { - TCHAR *statusMode = pcli->pfnGetStatusModeDescription(statusModeList[i], 0); + wchar_t *statusMode = pcli->pfnGetStatusModeDescription(statusModeList[i], 0); int item = SendDlgItemMessage(hwndDlg, IDC_LV1STATUS, CB_ADDSTRING, 0, (LPARAM)statusMode); SendDlgItemMessage(hwndDlg, IDC_LV1STATUS, CB_SETITEMDATA, item, (LPARAM)statusModeList[i]); item = SendDlgItemMessage(hwndDlg, IDC_LV2STATUS, CB_ADDSTRING, 0, (LPARAM)statusMode); diff --git a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp index 6f76de23d5..413c8f0f54 100644 --- a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp +++ b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp @@ -67,7 +67,7 @@ static int StartTimer(int timer, int timeout, BOOL restart); static int StopTimer(int timer); int LoadMainOptions(); static void GetCurrentConnectionSettings(); -static int AssignStatus(TConnectionSettings* connSetting, int status, int lastStatus, TCHAR *szMsg); +static int AssignStatus(TConnectionSettings* connSetting, int status, int lastStatus, wchar_t *szMsg); static int ProcessProtoAck(WPARAM wParam, LPARAM lParam); static VOID CALLBACK CheckConnectingTimer(HWND hwnd, UINT message, UINT_PTR idEvent, DWORD dwTime); static VOID CALLBACK CheckAckStatusTimer(HWND hwnd, UINT message, UINT_PTR idEvent, DWORD dwTime); @@ -83,7 +83,7 @@ static VOID CALLBACK CheckContinueslyTimer(HWND hwnd, UINT message, UINT_PTR idE INT_PTR IsProtocolEnabledService(WPARAM wParam, LPARAM lParam); static int ProcessPopup(int reason, LPARAM lParam); -static INT_PTR ShowPopup(TCHAR *msg, HICON hIcon); +static INT_PTR ShowPopup(wchar_t *msg, HICON hIcon); LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); static DWORD CALLBACK MessageWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); @@ -205,7 +205,7 @@ static void FreeProtoSettings(PROTOCOLSETTINGEX** ps) free(ps); } -static int AssignStatus(TConnectionSettings* cs, int status, int lastStatus, TCHAR *szMsg) +static int AssignStatus(TConnectionSettings* cs, int status, int lastStatus, wchar_t *szMsg) { if (status < MIN_STATUS || status > MAX_STATUS) return -1; @@ -228,7 +228,7 @@ static int AssignStatus(TConnectionSettings* cs, int status, int lastStatus, TCH if (cs->szMsg != NULL) free(cs->szMsg); - cs->szMsg = _tcsdup(szMsg); + cs->szMsg = wcsdup(szMsg); } else if (szMsg != cs->szMsg) { if (cs->szMsg != NULL) @@ -877,7 +877,7 @@ static VOID CALLBACK CheckContinueslyTimer(HWND, UINT, UINT_PTR, DWORD) } // =============== popup ====================== -static TCHAR* GetHumanName(LPARAM lParam) +static wchar_t* GetHumanName(LPARAM lParam) { PROTOACCOUNT *ProtoAccount = Proto_GetAccount((char*)lParam); return (ProtoAccount != NULL) ? ProtoAccount->tszAccountName : TranslateT("Protocol"); @@ -886,7 +886,7 @@ static TCHAR* GetHumanName(LPARAM lParam) static int ProcessPopup(int reason, LPARAM lParam) { HICON hIcon = NULL; - TCHAR text[MAX_SECONDLINE]; + wchar_t text[MAX_SECONDLINE]; if (!db_get_b(NULL, MODULENAME, SETTING_SHOWCONNECTIONPOPUPS, FALSE) || !ServiceExists(MS_POPUP_ADDPOPUPT)) return -1; @@ -929,7 +929,7 @@ static int ProcessPopup(int reason, LPARAM lParam) return -1; if (lParam) { PROTOCOLSETTINGEX **ps = (PROTOCOLSETTINGEX **)lParam; - TCHAR protoInfoLine[512], protoInfo[MAX_SECONDLINE]; + wchar_t protoInfoLine[512], protoInfo[MAX_SECONDLINE]; memset(protoInfoLine, '\0', sizeof(protoInfoLine)); memset(protoInfo, '\0', sizeof(protoInfo)); mir_tstrcpy(protoInfo, L"\r\n"); @@ -979,12 +979,12 @@ static int ProcessPopup(int reason, LPARAM lParam) return ShowPopup(text, hIcon); } -static INT_PTR ShowPopup(TCHAR *msg, HICON hIcon) +static INT_PTR ShowPopup(wchar_t *msg, HICON hIcon) { POPUPDATAT ppd = { 0 }; ppd.lchIcon = hIcon; - _tcsncpy(ppd.lptzContactName, TranslateT("KeepStatus"), MAX_CONTACTNAME); - _tcsncpy(ppd.lptzText, msg, MAX_SECONDLINE); + wcsncpy(ppd.lptzContactName, TranslateT("KeepStatus"), MAX_CONTACTNAME); + wcsncpy(ppd.lptzText, msg, MAX_SECONDLINE); if (db_get_b(NULL, MODULENAME, SETTING_POPUP_USEWINCOLORS, 0)) { ppd.colorBack = GetSysColor(COLOR_BTNFACE); ppd.colorText = GetSysColor(COLOR_WINDOWTEXT); diff --git a/plugins/StatusPlugins/KeepStatus/options.cpp b/plugins/StatusPlugins/KeepStatus/options.cpp index effa88cf8a..147fcf0b5d 100644 --- a/plugins/StatusPlugins/KeepStatus/options.cpp +++ b/plugins/StatusPlugins/KeepStatus/options.cpp @@ -481,8 +481,8 @@ INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l ppd.lchContact = NULL; ppd.lchIcon = Skin_LoadIcon(SKINICON_STATUS_OFFLINE); - _tcsncpy(ppd.lptzContactName, TranslateT("KeepStatus"), MAX_CONTACTNAME); - _tcsncpy(ppd.lptzText, TranslateT("You broke the Internet!"), MAX_SECONDLINE); + wcsncpy(ppd.lptzContactName, TranslateT("KeepStatus"), MAX_CONTACTNAME); + wcsncpy(ppd.lptzText, TranslateT("You broke the Internet!"), MAX_SECONDLINE); if (IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS)) { ppd.colorBack = GetSysColor(COLOR_BTNFACE); @@ -568,8 +568,8 @@ int OptionsInit(WPARAM wparam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; odp.hInstance = hInst; - odp.ptszGroup = LPGENT("Status"); - odp.ptszTitle = LPGENT("KeepStatus"); + odp.pwszGroup = LPGENW("Status"); + odp.pwszTitle = LPGENW("KeepStatus"); odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TABS); odp.pfnDlgProc = DlgProcKsTabs; @@ -578,11 +578,11 @@ int OptionsInit(WPARAM wparam, LPARAM) if (ServiceExists(MS_POPUP_ADDPOPUPT)) { memset(&odp, 0, sizeof(odp)); odp.position = 150000000; - odp.ptszGroup = LPGENT("Popups"); + odp.pwszGroup = LPGENW("Popups"); odp.groupPosition = 910000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_PUOPT_KEEPSTATUS); - odp.ptszTitle = LPGENT("KeepStatus"); + odp.pwszTitle = LPGENW("KeepStatus"); odp.pfnDlgProc = PopupOptDlgProc; odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; Options_AddPage(wparam, &odp); 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); diff --git a/plugins/StatusPlugins/commonstatus.cpp b/plugins/StatusPlugins/commonstatus.cpp index 4f78f829d1..19411d9938 100644 --- a/plugins/StatusPlugins/commonstatus.cpp +++ b/plugins/StatusPlugins/commonstatus.cpp @@ -95,7 +95,7 @@ int GetActualStatus(PROTOCOLSETTINGEX *protoSetting) } // helper, from core -static TCHAR* GetDefaultMessage(int status) +static wchar_t* GetDefaultMessage(int status) { switch (status) { case ID_STATUS_AWAY: return TranslateT("I've been away since %time%."); @@ -113,14 +113,14 @@ static TCHAR* GetDefaultMessage(int status) return NULL; } -TCHAR* GetDefaultStatusMessage(PROTOCOLSETTINGEX *ps, int newstatus) +wchar_t* GetDefaultStatusMessage(PROTOCOLSETTINGEX *ps, int newstatus) { if (ps->szMsg != NULL) {// custom message set log_infoA("CommonStatus: Status message set by calling plugin"); return mir_tstrdup(ps->szMsg); } - TCHAR *tMsg = (TCHAR*)CallService(MS_AWAYMSG_GETSTATUSMSGT, newstatus, (LPARAM)ps->szName); + wchar_t *tMsg = (wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGT, newstatus, (LPARAM)ps->szName); log_debugA("CommonStatus: Status message retrieved from general awaysys: %S", tMsg); return tMsg; } @@ -169,28 +169,28 @@ static int equalsGlobalStatus(PROTOCOLSETTINGEX **ps) static void SetStatusMsg(PROTOCOLSETTINGEX *ps, int newstatus) { - TCHAR* tszMsg = GetDefaultStatusMessage(ps, newstatus); + wchar_t* tszMsg = GetDefaultStatusMessage(ps, newstatus); if (tszMsg) { /* replace the default vars in msg (I believe this is from core) */ for (int j = 0; tszMsg[j]; j++) { if (tszMsg[j] != '%') continue; - TCHAR substituteStr[128]; - if (!_tcsnicmp(tszMsg + j, L"%time%", 6)) + wchar_t substituteStr[128]; + if (!wcsnicmp(tszMsg + j, L"%time%", 6)) GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, 0, 0, substituteStr, _countof(substituteStr)); - else if (!_tcsnicmp(tszMsg + j, L"%date%", 6)) + else if (!wcsnicmp(tszMsg + j, L"%date%", 6)) GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, 0, 0, substituteStr, _countof(substituteStr)); else continue; if (mir_tstrlen(substituteStr) > 6) - tszMsg = (TCHAR*)mir_realloc(tszMsg, sizeof(TCHAR)*(mir_tstrlen(tszMsg) + 1 + mir_tstrlen(substituteStr) - 6)); - memmove(tszMsg + j + mir_tstrlen(substituteStr), tszMsg + j + 6, sizeof(TCHAR)*(mir_tstrlen(tszMsg) - j - 5)); - memcpy(tszMsg + j, substituteStr, sizeof(TCHAR)*mir_tstrlen(substituteStr)); + tszMsg = (wchar_t*)mir_realloc(tszMsg, sizeof(wchar_t)*(mir_tstrlen(tszMsg) + 1 + mir_tstrlen(substituteStr) - 6)); + memmove(tszMsg + j + mir_tstrlen(substituteStr), tszMsg + j + 6, sizeof(wchar_t)*(mir_tstrlen(tszMsg) - j - 5)); + memcpy(tszMsg + j, substituteStr, sizeof(wchar_t)*mir_tstrlen(substituteStr)); } - TCHAR *szFormattedMsg = variables_parsedup(tszMsg, ps->tszAccName, NULL); + wchar_t *szFormattedMsg = variables_parsedup(tszMsg, ps->tszAccName, NULL); if (szFormattedMsg != NULL) { mir_free(tszMsg); tszMsg = szFormattedMsg; diff --git a/plugins/StatusPlugins/commonstatus.h b/plugins/StatusPlugins/commonstatus.h index e43c7b5e25..2288cc0e34 100644 --- a/plugins/StatusPlugins/commonstatus.h +++ b/plugins/StatusPlugins/commonstatus.h @@ -28,7 +28,6 @@ #include #include #include -#include #include #include @@ -71,7 +70,7 @@ static int statusModeList[] = { ID_STATUS_OFFLINE, ID_STATUS_ONLINE, ID_STATUS_AWAY, ID_STATUS_NA, ID_STATUS_OCCUPIED, ID_STATUS_DND, ID_STATUS_FREECHAT, ID_STATUS_INVISIBLE, ID_STATUS_ONTHEPHONE, ID_STATUS_OUTTOLUNCH }; static int statusModePf2List[] = { PF2_OFFLINE, PF2_ONLINE, PF2_SHORTAWAY, PF2_LONGAWAY, PF2_LIGHTDND, PF2_HEAVYDND, PF2_FREECHAT, PF2_INVISIBLE, PF2_ONTHEPHONE, PF2_OUTTOLUNCH }; -TCHAR *GetDefaultStatusMessage(PROTOCOLSETTINGEX *ps, int status); +wchar_t *GetDefaultStatusMessage(PROTOCOLSETTINGEX *ps, int status); int GetActualStatus(PROTOCOLSETTINGEX *protoSetting); int InitCommonStatus(); bool IsSuitableProto(PROTOACCOUNT *pa); diff --git a/plugins/StatusPlugins/confirmdialog.cpp b/plugins/StatusPlugins/confirmdialog.cpp index ac622de347..34b82714a8 100644 --- a/plugins/StatusPlugins/confirmdialog.cpp +++ b/plugins/StatusPlugins/confirmdialog.cpp @@ -34,7 +34,7 @@ struct TConfirmSetting : public PROTOCOLSETTINGEX { memcpy(this, &x, sizeof(PROTOCOLSETTINGEX)); if (szMsg) - szMsg = _tcsdup(szMsg); + szMsg = wcsdup(szMsg); } ~TConfirmSetting() @@ -59,7 +59,7 @@ static INT_PTR CALLBACK StatusMessageDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar protoSetting = (PROTOCOLSETTINGEX *)lParam; if (protoSetting->szMsg == NULL) { - TCHAR* smsg = GetDefaultStatusMessage(protoSetting, GetActualStatus(protoSetting)); + wchar_t* smsg = GetDefaultStatusMessage(protoSetting, GetActualStatus(protoSetting)); if (smsg != NULL) { SetDlgItemText(hwndDlg, IDC_STSMSG, smsg); mir_free(smsg); @@ -68,7 +68,7 @@ static INT_PTR CALLBACK StatusMessageDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar else SetDlgItemText(hwndDlg, IDC_STSMSG, protoSetting->szMsg); { - TCHAR desc[512]; + wchar_t desc[512]; mir_sntprintf(desc, TranslateT("Set %s message for %s."), pcli->pfnGetStatusModeDescription(GetActualStatus(protoSetting), 0), protoSetting->tszAccName); SetDlgItemText(hwndDlg, IDC_DESCRIPTION, desc); @@ -81,7 +81,7 @@ static INT_PTR CALLBACK StatusMessageDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar { int len = SendDlgItemMessage(hwndDlg, IDC_STSMSG, WM_GETTEXTLENGTH, 0, 0); if (len > 0) { - protoSetting->szMsg = (TCHAR*)realloc(protoSetting->szMsg, sizeof(TCHAR)*(len + 1)); + protoSetting->szMsg = (wchar_t*)realloc(protoSetting->szMsg, sizeof(wchar_t)*(len + 1)); if (protoSetting->szMsg != NULL) GetDlgItemText(hwndDlg, IDC_STSMSG, protoSetting->szMsg, len + 1); } @@ -107,7 +107,7 @@ static int SetStatusList(HWND hwndDlg) return -1; HWND hList = GetDlgItem(hwndDlg, IDC_STARTUPLIST); - TCHAR buf[100]; + wchar_t buf[100]; // create items LVITEM lvItem = { 0 }; @@ -124,7 +124,7 @@ static int SetStatusList(HWND hwndDlg) case ID_STATUS_CURRENT: actualStatus = CallProtoService((*confirmSettings)[i].szName, PS_GETSTATUS, 0, 0); break; default: actualStatus = (*confirmSettings)[i].status; } - TCHAR* status = pcli->pfnGetStatusModeDescription(actualStatus, 0); + wchar_t* status = pcli->pfnGetStatusModeDescription(actualStatus, 0); switch ((*confirmSettings)[i].status) { case ID_STATUS_LAST: mir_sntprintf(buf, L"%s (%s)", TranslateT(""), status); @@ -140,9 +140,9 @@ static int SetStatusList(HWND hwndDlg) // status message if (!((!((CallProtoService((*confirmSettings)[i].szName, PS_GETCAPS, (WPARAM)PFLAGNUM_1, 0)&PF1_MODEMSGSEND)&~PF1_INDIVMODEMSG)) || (!(CallProtoService((*confirmSettings)[i].szName, PS_GETCAPS, (WPARAM)PFLAGNUM_3, 0)&Proto_Status2Flag(actualStatus))))) { - TCHAR *msg = GetDefaultStatusMessage(&(*confirmSettings)[i], actualStatus); + wchar_t *msg = GetDefaultStatusMessage(&(*confirmSettings)[i], actualStatus); if (msg != NULL) { - TCHAR* fMsg = variables_parsedup(msg, (*confirmSettings)[i].tszAccName, NULL); + wchar_t* fMsg = variables_parsedup(msg, (*confirmSettings)[i].tszAccName, NULL); ListView_SetItemText(hList, lvItem.iItem, 2, fMsg); mir_free(fMsg); mir_free(msg); @@ -197,7 +197,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP int defaultProfile; int profileCount = (int)CallService(MS_SS_GETPROFILECOUNT, (WPARAM)&defaultProfile, 0); for (int i = 0; i < profileCount; i++) { - TCHAR profileName[128]; + wchar_t profileName[128]; CallService(MS_SS_GETPROFILENAME, i, (LPARAM)profileName); int item = SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_ADDSTRING, 0, (LPARAM)profileName); SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_SETITEMDATA, item, i); @@ -209,7 +209,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP } // start timer if (timeOut > 0) { - TCHAR text[32]; + wchar_t text[32]; mir_sntprintf(text, TranslateT("Closing in %d"), timeOut); SetDlgItemText(hwndDlg, IDC_CLOSE, text); SetTimer(hwndDlg, TIMER_ID, 1000, NULL); @@ -218,7 +218,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_TIMER: { - TCHAR text[32]; + wchar_t text[32]; mir_sntprintf(text, TranslateT("Closing in %d"), timeOut - 1); SetDlgItemText(hwndDlg, IDC_CLOSE, text); if (timeOut <= 0) { @@ -247,7 +247,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP CallService(MS_SS_GETPROFILE, (WPARAM)profile, (LPARAM)confirmSettings); for (int i = 0; i < confirmSettings->getCount(); i++) if ((*confirmSettings)[i].szMsg != NULL) // we free this later, copy to our memory space - (*confirmSettings)[i].szMsg = _tcsdup((*confirmSettings)[i].szMsg); + (*confirmSettings)[i].szMsg = wcsdup((*confirmSettings)[i].szMsg); SetStatusList(hwndDlg); } @@ -268,7 +268,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP // LAST STATUS if (proto->status == ID_STATUS_LAST) { - TCHAR last[80]; + wchar_t last[80]; mir_sntprintf(last, L"%s (%s)", TranslateT(""), pcli->pfnGetStatusModeDescription(proto->lastStatus, 0)); ListView_SetItemText(GetDlgItem(hwndDlg, IDC_STARTUPLIST), lvItem.iItem, 1, last); actualStatus = proto->lastStatus; @@ -277,7 +277,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP // CURRENT STATUS else if (proto->status == ID_STATUS_CURRENT) { int currentStatus = CallProtoService(proto->szName, PS_GETSTATUS, 0, 0); - TCHAR current[80]; + wchar_t current[80]; mir_sntprintf(current, L"%s (%s)", TranslateT(""), pcli->pfnGetStatusModeDescription(currentStatus, 0)); ListView_SetItemText(GetDlgItem(hwndDlg, IDC_STARTUPLIST), lvItem.iItem, 1, current); actualStatus = currentStatus; @@ -343,7 +343,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP int actualStatus = proto->status; // last - TCHAR buf[100]; + wchar_t buf[100]; mir_sntprintf(buf, L"%s (%s)", TranslateT(""), pcli->pfnGetStatusModeDescription(proto->lastStatus, 0)); int item = SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_ADDSTRING, 0, (LPARAM)buf); SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_SETITEMDATA, item, ID_STATUS_LAST); @@ -364,7 +364,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP for (int i = 0; i < _countof(statusModeList); i++) { if (((flags & statusModePf2List[i]) || (statusModePf2List[i] == PF2_OFFLINE)) && (!((!(flags)& Proto_Status2Flag(statusModePf2List[i]))) || ((CallProtoService(proto->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_5, 0)&Proto_Status2Flag(statusModePf2List[i]))))) { - TCHAR *statusMode = pcli->pfnGetStatusModeDescription(statusModeList[i], 0); + wchar_t *statusMode = pcli->pfnGetStatusModeDescription(statusModeList[i], 0); item = SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_ADDSTRING, 0, (LPARAM)statusMode); SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_SETITEMDATA, item, statusModeList[i]); if (statusModeList[i] == proto->status) -- cgit v1.2.3