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/SeenPlugin/src/file.cpp | 10 +++---- plugins/SeenPlugin/src/history.cpp | 6 ++-- plugins/SeenPlugin/src/main.cpp | 8 ++--- plugins/SeenPlugin/src/missed.cpp | 4 +-- plugins/SeenPlugin/src/options.cpp | 16 +++++----- plugins/SeenPlugin/src/stdafx.h | 2 +- plugins/SeenPlugin/src/userinfo.cpp | 2 +- plugins/SeenPlugin/src/utils.cpp | 58 ++++++++++++++++++------------------- 8 files changed, 53 insertions(+), 53 deletions(-) (limited to 'plugins/SeenPlugin/src') diff --git a/plugins/SeenPlugin/src/file.cpp b/plugins/SeenPlugin/src/file.cpp index 3417e06dd2..5337d2ecb5 100644 --- a/plugins/SeenPlugin/src/file.cpp +++ b/plugins/SeenPlugin/src/file.cpp @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" BOOL g_bFileActive; -static TCHAR *g_ptszFileStamp, *g_ptszFileName; +static wchar_t *g_ptszFileStamp, *g_ptszFileName; ///////////////////////////////////////////////////////////////////////////////////////// // Prepares the log file: @@ -35,8 +35,8 @@ void InitFileOutput(void) tszFileName = mir_tstrdup(DEFAULT_FILENAME); replaceStrT(g_ptszFileName, VARST(tszFileName)); - TCHAR *tszPath = NEWTSTR_ALLOCA(g_ptszFileName); - TCHAR *p = _tcsrchr(tszPath, '\\'); + wchar_t *tszPath = NEWWSTR_ALLOCA(g_ptszFileName); + wchar_t *p = wcsrchr(tszPath, '\\'); if (p) *p = 0; CreateDirectoryTreeT(tszPath); @@ -55,9 +55,9 @@ void UninitFileOutput() void FileWrite(MCONTACT hcontact) { - FILE *log = _tfopen(ParseString(g_ptszFileName, hcontact), L"a"); + FILE *log = _wfopen(ParseString(g_ptszFileName, hcontact), L"a"); if (log != NULL) { - _fputts(ParseString(g_ptszFileStamp, hcontact), log); + fputws(ParseString(g_ptszFileStamp, hcontact), log); fputs("\r\n", log); fclose(log); } diff --git a/plugins/SeenPlugin/src/history.cpp b/plugins/SeenPlugin/src/history.cpp index 7d589a95c8..4aa5d23d1b 100644 --- a/plugins/SeenPlugin/src/history.cpp +++ b/plugins/SeenPlugin/src/history.cpp @@ -50,7 +50,7 @@ void HistoryWrite(MCONTACT hContact) if (historyLast >= historyMax) historyLast = historyMax - 1; - TCHAR *ptszString; + wchar_t *ptszString; DBVARIANT dbv; if (!db_get_ts(NULL, S_MOD, "HistoryStamp", &dbv)) { ptszString = ParseString(dbv.ptszVal, hContact); @@ -167,7 +167,7 @@ void MyResizeGetOffset(HWND hwndControl, int nWidth, int nHeight, int* nDx, int* INT_PTR CALLBACK HistoryDlgProc(HWND hwndDlg, UINT Message, WPARAM wparam, LPARAM lparam) { MCONTACT hContact; - TCHAR sztemp[1024]; + wchar_t sztemp[1024]; switch (Message) { case WM_INITDIALOG: @@ -234,7 +234,7 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hwndDlg, UINT Message, WPARAM wparam, LPARA CallService(MS_MSG_SENDMESSAGE, hContact, 0); break; case IDC_TEST: - debug(ParseString(LPGENT("Date: %d.%m.%y(%Y) \n Date desc: %W - %w - %E - %e \n Time: %H:%M:%S (%h-%p) \n user: %n - %u \n Status: %s \n IP: %i - %r"), hContact)); + debug(ParseString(LPGENW("Date: %d.%m.%y(%Y) \n Date desc: %W - %w - %E - %e \n Time: %H:%M:%S (%h-%p) \n user: %n - %u \n Status: %s \n IP: %i - %r"), hContact)); break; } break; diff --git a/plugins/SeenPlugin/src/main.cpp b/plugins/SeenPlugin/src/main.cpp index e3d6c714e6..cb98026c61 100644 --- a/plugins/SeenPlugin/src/main.cpp +++ b/plugins/SeenPlugin/src/main.cpp @@ -104,10 +104,10 @@ extern "C" __declspec(dllexport) int Load(void) LoadWatchedProtos(); - SkinAddNewSoundExT("LastSeenTrackedStatusChange", LPGENT("LastSeen"), LPGENT("User status change")); - SkinAddNewSoundExT("LastSeenTrackedStatusOnline", LPGENT("LastSeen"), LPGENT("Changed to Online")); - SkinAddNewSoundExT("LastSeenTrackedStatusOffline", LPGENT("LastSeen"), LPGENT("User Logged Off")); - SkinAddNewSoundExT("LastSeenTrackedStatusFromOffline", LPGENT("LastSeen"), LPGENT("User Logged In")); + SkinAddNewSoundExT("LastSeenTrackedStatusChange", LPGENW("LastSeen"), LPGENW("User status change")); + SkinAddNewSoundExT("LastSeenTrackedStatusOnline", LPGENW("LastSeen"), LPGENW("Changed to Online")); + SkinAddNewSoundExT("LastSeenTrackedStatusOffline", LPGENW("LastSeen"), LPGENW("User Logged Off")); + SkinAddNewSoundExT("LastSeenTrackedStatusFromOffline", LPGENW("LastSeen"), LPGENW("User Logged In")); return 0; } diff --git a/plugins/SeenPlugin/src/missed.cpp b/plugins/SeenPlugin/src/missed.cpp index eeb15431f4..5288c204f5 100644 --- a/plugins/SeenPlugin/src/missed.cpp +++ b/plugins/SeenPlugin/src/missed.cpp @@ -105,9 +105,9 @@ int ShowMissed(void) if (!mcs.count) return 0; - TCHAR sztemp[1024], szcount[7]; + wchar_t sztemp[1024], szcount[7]; for (int loop = 0; loop < mcs.count; loop++) { - mir_tstrncat(sztemp, (TCHAR*)pcli->pfnGetContactDisplayName(mcs.wpcontact[loop], 0), _countof(sztemp) - mir_tstrlen(sztemp)); + mir_tstrncat(sztemp, (wchar_t*)pcli->pfnGetContactDisplayName(mcs.wpcontact[loop], 0), _countof(sztemp) - mir_tstrlen(sztemp)); if (db_get_b(NULL, S_MOD, "MissedOnes_Count", 0)) { mir_sntprintf(szcount, L" [%i]", mcs.times[loop]); mir_tstrcat(sztemp, szcount); diff --git a/plugins/SeenPlugin/src/options.cpp b/plugins/SeenPlugin/src/options.cpp index adc23838ba..178eaf301d 100644 --- a/plugins/SeenPlugin/src/options.cpp +++ b/plugins/SeenPlugin/src/options.cpp @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. INT_PTR CALLBACK OptsPopupsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) { DBVARIANT dbv; - TCHAR szstamp[256]; + wchar_t szstamp[256]; BOOL hasPopups; BYTE bchecked; @@ -91,10 +91,10 @@ INT_PTR CALLBACK OptsPopupsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp ppd.lchIcon = Skin_LoadProtoIcon(NULL, idBack); GetDlgItemText(hdlg, IDC_POPUPSTAMP, szstamp, _countof(szstamp)); - _tcsncpy(ppd.lptzContactName, ParseString(szstamp, NULL), MAX_CONTACTNAME); + wcsncpy(ppd.lptzContactName, ParseString(szstamp, NULL), MAX_CONTACTNAME); GetDlgItemText(hdlg, IDC_POPUPSTAMPTEXT, szstamp, _countof(szstamp)); - _tcsncpy(ppd.lptzText, ParseString(szstamp, NULL), MAX_SECONDLINE); + wcsncpy(ppd.lptzText, ParseString(szstamp, NULL), MAX_SECONDLINE); PUAddPopupT(&ppd); SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0); @@ -164,7 +164,7 @@ INT_PTR CALLBACK OptsPopupsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) { DBVARIANT dbv; - TCHAR szstamp[256]; + wchar_t szstamp[256]; switch (msg) { case WM_INITDIALOG: @@ -434,15 +434,15 @@ int OptionsInit(WPARAM wparam, LPARAM) odp.hInstance = hInstance; odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; odp.pszTemplate = MAKEINTRESOURCEA(IDD_SETTINGS); - odp.ptszGroup = LPGENT("Contacts"); - odp.ptszTitle = LPGENT("Last seen"); + odp.pwszGroup = LPGENW("Contacts"); + odp.pwszTitle = LPGENW("Last seen"); odp.pfnDlgProc = OptsSettingsDlgProc; Options_AddPage(wparam, &odp); if (ServiceExists(MS_POPUP_ADDPOPUPT)) { odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUPS); - odp.ptszGroup = LPGENT("Popups"); - odp.ptszTitle = LPGENT("Last seen"); + odp.pwszGroup = LPGENW("Popups"); + odp.pwszTitle = LPGENW("Last seen"); odp.pfnDlgProc = OptsPopupsDlgProc; Options_AddPage(wparam, &odp); } diff --git a/plugins/SeenPlugin/src/stdafx.h b/plugins/SeenPlugin/src/stdafx.h index 48999ed4c2..67fb460e2f 100644 --- a/plugins/SeenPlugin/src/stdafx.h +++ b/plugins/SeenPlugin/src/stdafx.h @@ -94,7 +94,7 @@ typedef struct{ } MISSEDCONTACTS; int IsWatchedProtocol(const char* szProto); -TCHAR *ParseString(TCHAR*, MCONTACT); +wchar_t *ParseString(wchar_t*, MCONTACT); void GetColorsFromDWord(LPCOLORREF First, LPCOLORREF Second, DWORD colDword); DWORD GetDWordFromColors(COLORREF First, COLORREF Second); int OptionsInit(WPARAM,LPARAM); diff --git a/plugins/SeenPlugin/src/userinfo.cpp b/plugins/SeenPlugin/src/userinfo.cpp index 25844a0435..318e336278 100644 --- a/plugins/SeenPlugin/src/userinfo.cpp +++ b/plugins/SeenPlugin/src/userinfo.cpp @@ -42,7 +42,7 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lpar case WM_REFRESH_UI: { ptrT szout(db_get_tsa(NULL, S_MOD, "UserStamp")); - TCHAR *str = ParseString((szout != NULL) ? szout : DEFAULT_USERSTAMP, wparam); + wchar_t *str = ParseString((szout != NULL) ? szout : DEFAULT_USERSTAMP, wparam); SetDlgItemText(hdlg, IDC_INFOTEXT, str); if (!mir_tstrcmp(str, TranslateT(""))) diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp index 8b281dd3f9..e820fa97b6 100644 --- a/plugins/SeenPlugin/src/utils.cpp +++ b/plugins/SeenPlugin/src/utils.cpp @@ -141,17 +141,17 @@ DWORD isSeen(MCONTACT hcontact, SYSTEMTIME *st) return res; } -TCHAR *weekdays[] = { LPGENT("Sunday"), LPGENT("Monday"), LPGENT("Tuesday"), LPGENT("Wednesday"), LPGENT("Thursday"), LPGENT("Friday"), LPGENT("Saturday") }; -TCHAR *wdays_short[] = { LPGENT("Sun."), LPGENT("Mon."), LPGENT("Tue."), LPGENT("Wed."), LPGENT("Thu."), LPGENT("Fri."), LPGENT("Sat.") }; -TCHAR *monthnames[] = { LPGENT("January"), LPGENT("February"), LPGENT("March"), LPGENT("April"), LPGENT("May"), LPGENT("June"), LPGENT("July"), LPGENT("August"), LPGENT("September"), LPGENT("October"), LPGENT("November"), LPGENT("December") }; -TCHAR *mnames_short[] = { LPGENT("Jan."), LPGENT("Feb."), LPGENT("Mar."), LPGENT("Apr."), LPGENT("May"), LPGENT("Jun."), LPGENT("Jul."), LPGENT("Aug."), LPGENT("Sep."), LPGENT("Oct."), LPGENT("Nov."), LPGENT("Dec.") }; +wchar_t *weekdays[] = { LPGENW("Sunday"), LPGENW("Monday"), LPGENW("Tuesday"), LPGENW("Wednesday"), LPGENW("Thursday"), LPGENW("Friday"), LPGENW("Saturday") }; +wchar_t *wdays_short[] = { LPGENW("Sun."), LPGENW("Mon."), LPGENW("Tue."), LPGENW("Wed."), LPGENW("Thu."), LPGENW("Fri."), LPGENW("Sat.") }; +wchar_t *monthnames[] = { LPGENW("January"), LPGENW("February"), LPGENW("March"), LPGENW("April"), LPGENW("May"), LPGENW("June"), LPGENW("July"), LPGENW("August"), LPGENW("September"), LPGENW("October"), LPGENW("November"), LPGENW("December") }; +wchar_t *mnames_short[] = { LPGENW("Jan."), LPGENW("Feb."), LPGENW("Mar."), LPGENW("Apr."), LPGENW("May"), LPGENW("Jun."), LPGENW("Jul."), LPGENW("Aug."), LPGENW("Sep."), LPGENW("Oct."), LPGENW("Nov."), LPGENW("Dec.") }; -TCHAR* ParseString(TCHAR *szstring, MCONTACT hcontact) +wchar_t* ParseString(wchar_t *szstring, MCONTACT hcontact) { #define MAXSIZE 1024 - static TCHAR sztemp[MAXSIZE + 1]; - TCHAR szdbsetting[128]; - TCHAR *charPtr; + static wchar_t sztemp[MAXSIZE + 1]; + wchar_t szdbsetting[128]; + wchar_t *charPtr; int isetting = 0; DWORD dwsetting = 0; struct in_addr ia; @@ -168,8 +168,8 @@ TCHAR* ParseString(TCHAR *szstring, MCONTACT hcontact) char *szProto = hcontact ? GetContactProto(hcontact) : courProtoName; ptrT info; - TCHAR *d = sztemp; - for (TCHAR *p = szstring; *p; p++) { + wchar_t *d = sztemp; + for (wchar_t *p = szstring; *p; p++) { if (d >= sztemp + MAXSIZE) break; @@ -182,18 +182,18 @@ TCHAR* ParseString(TCHAR *szstring, MCONTACT hcontact) switch (*++p) { case 'Y': if (!st.wYear) goto LBL_noData; - d += _stprintf(d, L"%04i", st.wYear); //!!!!!!!!!!!! + d += swprintf(d, L"%04i", st.wYear); //!!!!!!!!!!!! break; case 'y': if (!st.wYear) goto LBL_noData; - d += _stprintf(d, L"%02i", st.wYear % 100); //!!!!!!!!!!!! + d += swprintf(d, L"%02i", st.wYear % 100); //!!!!!!!!!!!! break; case 'm': if (!(isetting = st.wMonth)) goto LBL_noData; LBL_2DigNum: - d += _stprintf(d, L"%02i", isetting); //!!!!!!!!!!!! + d += swprintf(d, L"%02i", isetting); //!!!!!!!!!!!! break; case 'd': @@ -252,7 +252,7 @@ TCHAR* ParseString(TCHAR *szstring, MCONTACT hcontact) goto LBL_2DigNum; case 'n': - charPtr = hcontact ? (TCHAR*)pcli->pfnGetContactDisplayName(hcontact, 0) : (wantempty ? L"" : L"---"); + charPtr = hcontact ? (wchar_t*)pcli->pfnGetContactDisplayName(hcontact, 0) : (wantempty ? L"" : L"---"); goto LBL_charPtr; case 'N': @@ -264,7 +264,7 @@ TCHAR* ParseString(TCHAR *szstring, MCONTACT hcontact) case 'G': if (!db_get_ts(hcontact, "CList", "Group", &dbv)) { - _tcsncpy(szdbsetting, dbv.ptszVal, _countof(szdbsetting)); + wcsncpy(szdbsetting, dbv.ptszVal, _countof(szdbsetting)); db_free(&dbv); charPtr = szdbsetting; goto LBL_charPtr; @@ -280,7 +280,7 @@ TCHAR* ParseString(TCHAR *szstring, MCONTACT hcontact) case 's': if (isetting = db_get_w(hcontact, S_MOD, hcontact ? "StatusTriger" : courProtoName, 0)) { - _tcsncpy(szdbsetting, pcli->pfnGetStatusModeDescription(isetting | 0x8000, 0), _countof(szdbsetting)); + wcsncpy(szdbsetting, pcli->pfnGetStatusModeDescription(isetting | 0x8000, 0), _countof(szdbsetting)); if (!(isetting & 0x8000)) { mir_tstrncat(szdbsetting, L"/", _countof(szdbsetting) - mir_tstrlen(szdbsetting)); mir_tstrncat(szdbsetting, TranslateT("Idle"), _countof(szdbsetting) - mir_tstrlen(szdbsetting)); @@ -300,7 +300,7 @@ TCHAR* ParseString(TCHAR *szstring, MCONTACT hcontact) case 'o': if (isetting = db_get_w(hcontact, S_MOD, hcontact ? "OldStatus" : courProtoName, 0)) { - _tcsncpy(szdbsetting, pcli->pfnGetStatusModeDescription(isetting, 0), _countof(szdbsetting)); + wcsncpy(szdbsetting, pcli->pfnGetStatusModeDescription(isetting, 0), _countof(szdbsetting)); if (includeIdle && hcontact && db_get_b(hcontact, S_MOD, "OldIdle", 0)) { mir_tstrncat(szdbsetting, L"/", _countof(szdbsetting) - mir_tstrlen(szdbsetting)); mir_tstrncat(szdbsetting, TranslateT("Idle"), _countof(szdbsetting) - mir_tstrlen(szdbsetting)); @@ -325,13 +325,13 @@ TCHAR* ParseString(TCHAR *szstring, MCONTACT hcontact) goto LBL_noData; ia.S_un.S_addr = htonl(dwsetting); - _tcsncpy(szdbsetting, _A2T(inet_ntoa(ia)), _countof(szdbsetting)); + wcsncpy(szdbsetting, _A2T(inet_ntoa(ia)), _countof(szdbsetting)); charPtr = szdbsetting; } goto LBL_charPtr; case 'P': - _tcsncpy(szdbsetting, szProto ? _A2T(szProto) : (wantempty ? L"" : L"ProtoUnknown"), _countof(szdbsetting)); + wcsncpy(szdbsetting, szProto ? _A2T(szProto) : (wantempty ? L"" : L"ProtoUnknown"), _countof(szdbsetting)); charPtr = szdbsetting; goto LBL_charPtr; @@ -356,7 +356,7 @@ TCHAR* ParseString(TCHAR *szstring, MCONTACT hcontact) if (!pa) goto LBL_noData; - _tcsncpy(szdbsetting, pa->tszAccountName, _countof(szdbsetting)); + wcsncpy(szdbsetting, pa->tszAccountName, _countof(szdbsetting)); charPtr = szdbsetting; } goto LBL_charPtr; @@ -477,16 +477,16 @@ void ShowPopup(MCONTACT hcontact, const char * lpzProto, int newStatus) ppd.lchIcon = Skin_LoadProtoIcon(lpzProto, newStatus); if (!db_get_ts(NULL, S_MOD, "PopupStamp", &dbv)) { - _tcsncpy(ppd.lptzContactName, ParseString(dbv.ptszVal, hcontact), MAX_CONTACTNAME); + wcsncpy(ppd.lptzContactName, ParseString(dbv.ptszVal, hcontact), MAX_CONTACTNAME); db_free(&dbv); } - else _tcsncpy(ppd.lptzContactName, ParseString(DEFAULT_POPUPSTAMP, hcontact), MAX_CONTACTNAME); + else wcsncpy(ppd.lptzContactName, ParseString(DEFAULT_POPUPSTAMP, hcontact), MAX_CONTACTNAME); if (!db_get_ts(NULL, S_MOD, "PopupStampText", &dbv)) { - _tcsncpy(ppd.lptzText, ParseString(dbv.ptszVal, hcontact), MAX_SECONDLINE); + wcsncpy(ppd.lptzText, ParseString(dbv.ptszVal, hcontact), MAX_SECONDLINE); db_free(&dbv); } - else _tcsncpy(ppd.lptzText, ParseString(DEFAULT_POPUPSTAMPTEXT, hcontact), MAX_SECONDLINE); + else wcsncpy(ppd.lptzText, ParseString(DEFAULT_POPUPSTAMPTEXT, hcontact), MAX_SECONDLINE); ppd.PluginWindowProc = PopupDlgProc; PUAddPopupT(&ppd); } @@ -731,24 +731,24 @@ short int isDbZero(MCONTACT hContact, const char *module_name, const char *setti return -1; } -TCHAR* any_to_IdleNotidleUnknown(MCONTACT hContact, const char *module_name, const char *setting_name, TCHAR *buff, int bufflen) +wchar_t* any_to_IdleNotidleUnknown(MCONTACT hContact, const char *module_name, const char *setting_name, wchar_t *buff, int bufflen) { short int r = isDbZero(hContact, module_name, setting_name); if (r == -1) { - _tcsncpy(buff, TranslateT("Unknown"), bufflen); + wcsncpy(buff, TranslateT("Unknown"), bufflen); } else { - _tcsncpy(buff, r ? TranslateT("Not Idle") : TranslateT("Idle"), bufflen); + wcsncpy(buff, r ? TranslateT("Not Idle") : TranslateT("Idle"), bufflen); }; buff[bufflen - 1] = 0; return buff; } -TCHAR* any_to_Idle(MCONTACT hContact, const char *module_name, const char *setting_name, TCHAR *buff, int bufflen) +wchar_t* any_to_Idle(MCONTACT hContact, const char *module_name, const char *setting_name, wchar_t *buff, int bufflen) { if (isDbZero(hContact, module_name, setting_name) == 0) { //DB setting is NOT zero and exists buff[0] = L'/'; - _tcsncpy(&buff[1], TranslateT("Idle"), bufflen - 1); + wcsncpy(&buff[1], TranslateT("Idle"), bufflen - 1); } else buff[0] = 0; buff[bufflen - 1] = 0; -- cgit v1.2.3