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/ContactsPlus/src/main.cpp | 2 +- plugins/ContactsPlus/src/receive.cpp | 40 ++++++++++++++++++------------------ plugins/ContactsPlus/src/receive.h | 6 +++--- plugins/ContactsPlus/src/send.cpp | 10 ++++----- plugins/ContactsPlus/src/utils.cpp | 30 +++++++++++++-------------- plugins/ContactsPlus/src/utils.h | 6 +++--- 6 files changed, 47 insertions(+), 47 deletions(-) (limited to 'plugins/ContactsPlus/src') diff --git a/plugins/ContactsPlus/src/main.cpp b/plugins/ContactsPlus/src/main.cpp index 109bb50043..8852ad0eea 100644 --- a/plugins/ContactsPlus/src/main.cpp +++ b/plugins/ContactsPlus/src/main.cpp @@ -73,7 +73,7 @@ static int HookDBEventAdded(WPARAM hContact, LPARAM hDbEvent) SkinPlaySound("RecvContacts"); { //add event to the contact list - TCHAR caToolTip[128]; + wchar_t caToolTip[128]; mir_sntprintf(caToolTip, L"%s %s", TranslateT("Contacts received from"), pcli->pfnGetContactDisplayName(hContact, 0)); CLISTEVENT cle = {}; diff --git a/plugins/ContactsPlus/src/receive.cpp b/plugins/ContactsPlus/src/receive.cpp index 0a008a12da..0373609632 100644 --- a/plugins/ContactsPlus/src/receive.cpp +++ b/plugins/ContactsPlus/src/receive.cpp @@ -81,17 +81,17 @@ static int RecvDlg_Resize(HWND, LPARAM, UTILRESIZECONTROL *urc) return RD_ANCHORX_LEFT | RD_ANCHORY_TOP; // default } -static TCHAR* ListView_GetItemTextEx(HWND hLV, int iItem, int iSubItem) +static wchar_t* ListView_GetItemTextEx(HWND hLV, int iItem, int iSubItem) { LVITEM lvi = {0}; lvi.mask = LVIF_TEXT; lvi.iSubItem = iSubItem; lvi.cchTextMax = 64; - lvi.pszText = (TCHAR*)mir_alloc(lvi.cchTextMax * sizeof(TCHAR)); + lvi.pszText = (wchar_t*)mir_alloc(lvi.cchTextMax * sizeof(wchar_t)); // loop until the returned size is smaller than buffer size while (SendMessage(hLV, LVM_GETITEMTEXT, iItem, (LPARAM)&lvi) == lvi.cchTextMax - 1) { lvi.cchTextMax += 64; - lvi.pszText = (TCHAR*)mir_realloc(lvi.pszText, lvi.cchTextMax * sizeof(TCHAR)); + lvi.pszText = (wchar_t*)mir_realloc(lvi.pszText, lvi.cchTextMax * sizeof(wchar_t)); } return lvi.pszText; } @@ -108,18 +108,18 @@ static void RebuildGroupCombo(HWND hwndDlg) if (bHasGroups) { int curs = SendMessage(hGroupsCombo, CB_GETCURSEL, 0, 0); - TCHAR *curst = NULL; + wchar_t *curst = NULL; EnableDlgItem(hwndDlg, IDC_ENABLEGROUPS, TRUE); EnableGroupCombo(hwndDlg); if (curs != CB_ERR) { - curst = (TCHAR*)_alloca((SendMessage(hGroupsCombo, CB_GETLBTEXTLEN, curs, 0) + 1) * sizeof(TCHAR)); + curst = (wchar_t*)_alloca((SendMessage(hGroupsCombo, CB_GETLBTEXTLEN, curs, 0) + 1) * sizeof(wchar_t)); SendMessage(hGroupsCombo, CB_GETLBTEXT, curs, (LPARAM)curst); } SendMessage(hGroupsCombo, CB_RESETCONTENT, 0, 0); - TCHAR *szGroup; + wchar_t *szGroup; for (int i=1; (szGroup = Clist_GroupGetName(i, NULL)) != NULL; i++) { int nIndex = SendMessage(hGroupsCombo, CB_ADDSTRING, 0, (LPARAM)szGroup); SendMessage(hGroupsCombo, CB_SETITEMDATA, nIndex, i); @@ -138,7 +138,7 @@ static void RebuildGroupCombo(HWND hwndDlg) static MCONTACT CreateTemporaryContactForItem(HWND hwndDlg, TRecvContactsData *wndData, int iItem) { - TCHAR *caUIN = ListView_GetItemTextEx(GetDlgItem(hwndDlg, IDC_CONTACTS), iItem, 0); + wchar_t *caUIN = ListView_GetItemTextEx(GetDlgItem(hwndDlg, IDC_CONTACTS), iItem, 0); char *szProto = GetContactProto(wndData->mhContact); wndData->rhSearch = (HANDLE)CallProtoService(szProto, PS_BASICSEARCH, 0, (LPARAM)caUIN); // find it replaceStrT(wndData->haUin, caUIN); @@ -148,7 +148,7 @@ static MCONTACT CreateTemporaryContactForItem(HWND hwndDlg, TRecvContactsData *w return NULL; } -void RecvListView_AddColumn(HWND hList, int nWidth, TCHAR *szTitle, int nItem) +void RecvListView_AddColumn(HWND hList, int nWidth, wchar_t *szTitle, int nItem) { LVCOLUMN col; col.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; @@ -239,10 +239,10 @@ INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara } } // new dlg init - wndData->hIcons[0] = InitMButton(hwndDlg, IDC_ADD, SKINICON_OTHER_ADDCONTACT, LPGENT("Add Contact Permanently to List")); - wndData->hIcons[1] = InitMButton(hwndDlg, IDC_DETAILS, SKINICON_OTHER_USERDETAILS, LPGENT("View User's Details")); - wndData->hIcons[2] = InitMButton(hwndDlg, IDC_HISTORY, SKINICON_OTHER_HISTORY, LPGENT("View User's History")); - wndData->hIcons[3] = InitMButton(hwndDlg, IDC_USERMENU, SKINICON_OTHER_DOWNARROW, LPGENT("User Menu")); + wndData->hIcons[0] = InitMButton(hwndDlg, IDC_ADD, SKINICON_OTHER_ADDCONTACT, LPGENW("Add Contact Permanently to List")); + wndData->hIcons[1] = InitMButton(hwndDlg, IDC_DETAILS, SKINICON_OTHER_USERDETAILS, LPGENW("View User's Details")); + wndData->hIcons[2] = InitMButton(hwndDlg, IDC_HISTORY, SKINICON_OTHER_HISTORY, LPGENW("View User's History")); + wndData->hIcons[3] = InitMButton(hwndDlg, IDC_USERMENU, SKINICON_OTHER_DOWNARROW, LPGENW("User Menu")); SendMessage(hwndDlg,DM_UPDATETITLE,0,0); // new dialog init done @@ -301,11 +301,11 @@ INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara HWND hGroupsCombo = GetDlgItem(hwndDlg, IDC_GROUPS); HWND hGroupsCheck = GetDlgItem(hwndDlg, IDC_ENABLEGROUPS); int curs = SendMessage(hGroupsCombo, CB_GETCURSEL, 0, 0); - TCHAR* caGroup = NULL; + wchar_t* caGroup = NULL; int nGroupId = -1; if (curs != CB_ERR && IsWindowEnabled(hGroupsCheck) && SendMessage(hGroupsCheck, BM_GETCHECK, 0, 0)) { //got groups, get the one selected in combo - caGroup = (TCHAR*)_alloca((SendMessage(hGroupsCombo, CB_GETLBTEXTLEN, curs, 0) + 1) * sizeof(TCHAR)); + caGroup = (wchar_t*)_alloca((SendMessage(hGroupsCombo, CB_GETLBTEXTLEN, curs, 0) + 1) * sizeof(wchar_t)); SendMessage(hGroupsCombo, CB_GETLBTEXT, curs, (LPARAM)caGroup); nGroupId = SendMessage(hGroupsCombo, CB_GETITEMDATA, curs, 0); } @@ -313,7 +313,7 @@ INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara for (int i = 0; i < ListView_GetItemCount(hLV); i++) if (ListView_GetCheckState(hLV, i)) { // found checked contact item, add it - TCHAR *caUIN = ListView_GetItemTextEx(hLV, i, 0); + wchar_t *caUIN = ListView_GetItemTextEx(hLV, i, 0); for (int j = 0; j < wndData->cbReceived; j++) // determine item index in packet if (!mir_tstrcmp(wndData->maReceived[j]->mcaUIN, caUIN)) { char *szProto =GetContactProto(wndData->mhContact); @@ -437,10 +437,10 @@ INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara fi.psz = wndData->haUin; int iLPos = ListView_FindItem(hLV, -1, &fi); if (iLPos == -1) iLPos = 0; - if (mir_tstrcmp(psr->nick.t, L"") && psr->nick.t) - ListView_SetItemText(hLV, iLPos, 1, psr->nick.t); - ListView_SetItemText(hLV, iLPos, 2, psr->firstName.t); - ListView_SetItemText(hLV, iLPos, 3, psr->lastName.t); + if (mir_tstrcmp(psr->nick.w, L"") && psr->nick.w) + ListView_SetItemText(hLV, iLPos, 1, psr->nick.w); + ListView_SetItemText(hLV, iLPos, 2, psr->firstName.w); + ListView_SetItemText(hLV, iLPos, 3, psr->lastName.w); break; } mir_free(wndData->haUin); @@ -482,7 +482,7 @@ INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara break; case DM_UPDATETITLE: - UpdateDialogTitle(hwndDlg, wndData ? wndData->mhContact : NULL, LPGENT("Contacts from")); + UpdateDialogTitle(hwndDlg, wndData ? wndData->mhContact : NULL, LPGENW("Contacts from")); if (wndData) UpdateDialogAddButton(hwndDlg, wndData->mhContact); break; diff --git a/plugins/ContactsPlus/src/receive.h b/plugins/ContactsPlus/src/receive.h index 52db60a171..2bb0f5f659 100644 --- a/plugins/ContactsPlus/src/receive.h +++ b/plugins/ContactsPlus/src/receive.h @@ -35,8 +35,8 @@ #define IDI_DOWNARROW 264 struct TReceivedItem { - TCHAR* mcaUIN; - TCHAR* mcaNick; + wchar_t* mcaUIN; + wchar_t* mcaNick; ~TReceivedItem() { mir_free(mcaUIN); mir_free(mcaNick); } TReceivedItem() { mcaUIN = NULL; mcaNick = NULL; } }; @@ -52,7 +52,7 @@ struct TRecvContactsData HMENU mhPopup; // popup menu for listview HANDLE hHook; // hook to event HANDLE rhSearch; // handle to uin-search - TCHAR* haUin; + wchar_t* haUin; int iPopupItem; TReceivedItem** maReceived;// received contacts int cbReceived; diff --git a/plugins/ContactsPlus/src/send.cpp b/plugins/ContactsPlus/src/send.cpp index 38505ded75..7674ed4d57 100644 --- a/plugins/ContactsPlus/src/send.cpp +++ b/plugins/ContactsPlus/src/send.cpp @@ -234,10 +234,10 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara wndData = new TSendContactsData(lParam); SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)wndData); // new dlg init - wndData->hIcons[0] = InitMButton(hwndDlg, IDC_ADD, SKINICON_OTHER_ADDCONTACT, LPGENT("Add Contact Permanently to List")); - wndData->hIcons[1] = InitMButton(hwndDlg, IDC_DETAILS, SKINICON_OTHER_USERDETAILS, LPGENT("View User's Details")); - wndData->hIcons[2] = InitMButton(hwndDlg, IDC_HISTORY, SKINICON_OTHER_HISTORY, LPGENT("View User's History")); - wndData->hIcons[3] = InitMButton(hwndDlg, IDC_USERMENU, SKINICON_OTHER_DOWNARROW, LPGENT("User Menu")); + wndData->hIcons[0] = InitMButton(hwndDlg, IDC_ADD, SKINICON_OTHER_ADDCONTACT, LPGENW("Add Contact Permanently to List")); + wndData->hIcons[1] = InitMButton(hwndDlg, IDC_DETAILS, SKINICON_OTHER_USERDETAILS, LPGENW("View User's Details")); + wndData->hIcons[2] = InitMButton(hwndDlg, IDC_HISTORY, SKINICON_OTHER_HISTORY, LPGENW("View User's History")); + wndData->hIcons[3] = InitMButton(hwndDlg, IDC_USERMENU, SKINICON_OTHER_DOWNARROW, LPGENW("User Menu")); SendMessage(hwndDlg, DM_UPDATETITLE, 0, 0); // new dialog init done @@ -479,7 +479,7 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar TranslateDialogDefault(hwndDlg); { if (lParam) - SetDlgItemText(hwndDlg, IDC_ERRORTEXT, TranslateTS((TCHAR*)lParam)); + SetDlgItemText(hwndDlg, IDC_ERRORTEXT, TranslateTS((wchar_t*)lParam)); RECT rc, rcParent; GetWindowRect(hwndDlg, &rc); diff --git a/plugins/ContactsPlus/src/utils.cpp b/plugins/ContactsPlus/src/utils.cpp index 5ba7efea54..f16a559fe2 100644 --- a/plugins/ContactsPlus/src/utils.cpp +++ b/plugins/ContactsPlus/src/utils.cpp @@ -55,7 +55,7 @@ char* __fastcall null_strdup(const char *string) return NULL; } -TCHAR* GetContactUID(MCONTACT hContact) +wchar_t* GetContactUID(MCONTACT hContact) { char *szProto = GetContactProto(hContact); char *uid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); @@ -67,19 +67,19 @@ TCHAR* GetContactUID(MCONTACT hContact) return NULL; if (vrUid.type == DBVT_DWORD) { - TCHAR tmp[100]; - _itot(vrUid.dVal, tmp, 10); + wchar_t tmp[100]; + _itow(vrUid.dVal, tmp, 10); return mir_tstrdup(tmp); } if (vrUid.type == DBVT_ASCIIZ) { - TCHAR *res = mir_a2t(vrUid.pszVal); + wchar_t *res = mir_a2t(vrUid.pszVal); mir_free(vrUid.pszVal); return res; } if (vrUid.type == DBVT_UTF8) { - TCHAR *res = mir_utf8decodeT(vrUid.pszVal); + wchar_t *res = mir_utf8decodeT(vrUid.pszVal); mir_free(vrUid.pszVal); return res; } @@ -112,24 +112,24 @@ void DrawProtocolIcon(HWND hwndDlg, LPARAM lParam, MCONTACT hContact) } -void UpdateDialogTitle(HWND hwndDlg, MCONTACT hContact, TCHAR *pszTitleStart) +void UpdateDialogTitle(HWND hwndDlg, MCONTACT hContact, wchar_t *pszTitleStart) { - TCHAR newtitle[512]; + wchar_t newtitle[512]; mir_tstrncpy(newtitle, TranslateTS(pszTitleStart), _countof(newtitle)); if (hContact) { char *szProto = GetContactProto(hContact); if (szProto) { ptrT uid(GetContactUID(hContact)); - TCHAR *contactName = pcli->pfnGetContactDisplayName(hContact, 0); + wchar_t *contactName = pcli->pfnGetContactDisplayName(hContact, 0); - TCHAR oldTitle[MAX_PATH]; + wchar_t oldTitle[MAX_PATH]; GetDlgItemText(hwndDlg, IDC_NAME, oldTitle, _countof(oldTitle)); if (mir_tstrcmp(uid ? uid : contactName, oldTitle)) SetDlgItemText(hwndDlg, IDC_NAME, uid ? uid : contactName); - TCHAR *szStatus = pcli->pfnGetStatusModeDescription(db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), 0); + wchar_t *szStatus = pcli->pfnGetStatusModeDescription(db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), 0); mir_sntprintf(newtitle, L"%s %s (%s)", TranslateTS(pszTitleStart), contactName, szStatus); } } @@ -145,7 +145,7 @@ void UpdateDialogAddButton(HWND hwndDlg, MCONTACT hContact) } -HICON InitMButton(HWND hDlg, int idButton, int idIcon, TCHAR *szTip) +HICON InitMButton(HWND hDlg, int idButton, int idIcon, wchar_t *szTip) { HWND hButton = GetDlgItem(hDlg, idButton); HICON hIcon = Skin_LoadIcon(idIcon); @@ -172,10 +172,10 @@ void EnableDlgItem(HWND hwndDlg, UINT control, int state) } -TCHAR* GetWindowTextT(HWND hWnd) +wchar_t* GetWindowTextT(HWND hWnd) { int len = GetWindowTextLength(hWnd) + 1; - TCHAR* txt = (TCHAR*)mir_alloc(len * sizeof(TCHAR)); + wchar_t* txt = (wchar_t*)mir_alloc(len * sizeof(wchar_t)); if (txt) { txt[0] = 0; GetWindowText(hWnd, txt, len); @@ -183,9 +183,9 @@ TCHAR* GetWindowTextT(HWND hWnd) return txt; } -TCHAR* __fastcall strdupT(const TCHAR *string) +wchar_t* __fastcall strdupT(const wchar_t *string) { if (string) - return (TCHAR*)wcsdup((TCHAR*)string); + return (wchar_t*)wcsdup((wchar_t*)string); return NULL; } diff --git a/plugins/ContactsPlus/src/utils.h b/plugins/ContactsPlus/src/utils.h index cf284b44e7..6783f5bd74 100644 --- a/plugins/ContactsPlus/src/utils.h +++ b/plugins/ContactsPlus/src/utils.h @@ -32,13 +32,13 @@ int __fastcall strcmpnull(const char *str1, const char *str2); void __fastcall strcpynull(char *str1, const char *str2); char* __fastcall null_strdup(const char *string); -TCHAR* GetContactUID(MCONTACT hContact); +wchar_t* GetContactUID(MCONTACT hContact); void DrawProtocolIcon(HWND hwndDlg, LPARAM lParam, MCONTACT hContact); -void UpdateDialogTitle(HWND hwndDlg, MCONTACT hContact, TCHAR *pszTitleStart); +void UpdateDialogTitle(HWND hwndDlg, MCONTACT hContact, wchar_t *pszTitleStart); void UpdateDialogAddButton(HWND hwndDlg, MCONTACT hContact); -HICON InitMButton(HWND hDlg, int idButton, int idIcon, TCHAR *szTip); +HICON InitMButton(HWND hDlg, int idButton, int idIcon, wchar_t *szTip); void DialogAddContactExecute(HWND hwndDlg, MCONTACT hNewContact); -- cgit v1.2.3