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/Clist_blind/src/clcopts.cpp | 48 ++++++++++----------- plugins/Clist_blind/src/clcpaint.cpp | 6 +-- plugins/Clist_blind/src/cluiopts.cpp | 2 +- plugins/Clist_blind/src/contact.cpp | 6 +-- plugins/Clist_blind/src/init.cpp | 82 ++++++++++++++++++------------------ 5 files changed, 72 insertions(+), 72 deletions(-) (limited to 'plugins/Clist_blind/src') diff --git a/plugins/Clist_blind/src/clcopts.cpp b/plugins/Clist_blind/src/clcopts.cpp index 36a6dad54c..3a60f5c8cf 100644 --- a/plugins/Clist_blind/src/clcopts.cpp +++ b/plugins/Clist_blind/src/clcopts.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -TCHAR* MyDBGetContactSettingTString(MCONTACT hContact, char* module, char* setting, TCHAR* out, size_t len, TCHAR *def); +wchar_t* MyDBGetContactSettingTString(MCONTACT hContact, char* module, char* setting, wchar_t* out, size_t len, wchar_t *def); #define DBFONTF_BOLD 1 #define DBFONTF_ITALIC 2 @@ -55,34 +55,34 @@ static const checkBoxToStyleEx[] = { struct CheckBoxValues_t { DWORD style; - TCHAR* szDescr; + wchar_t* szDescr; }; static const struct CheckBoxValues_t greyoutValues[] = { - { GREYF_UNFOCUS, LPGENT("Not focused") }, - { MODEF_OFFLINE, LPGENT("Offline") }, - { PF2_ONLINE, LPGENT("Online") }, - { PF2_SHORTAWAY, LPGENT("Away") }, - { PF2_LONGAWAY, LPGENT("Not available") }, - { PF2_LIGHTDND, LPGENT("Occupied") }, - { PF2_HEAVYDND, LPGENT("Do not disturb")}, - { PF2_FREECHAT, LPGENT("Free for chat") }, - { PF2_INVISIBLE, LPGENT("Invisible") }, - { PF2_OUTTOLUNCH, LPGENT("Out to lunch") }, - { PF2_ONTHEPHONE, LPGENT("On the phone") } + { GREYF_UNFOCUS, LPGENW("Not focused") }, + { MODEF_OFFLINE, LPGENW("Offline") }, + { PF2_ONLINE, LPGENW("Online") }, + { PF2_SHORTAWAY, LPGENW("Away") }, + { PF2_LONGAWAY, LPGENW("Not available") }, + { PF2_LIGHTDND, LPGENW("Occupied") }, + { PF2_HEAVYDND, LPGENW("Do not disturb")}, + { PF2_FREECHAT, LPGENW("Free for chat") }, + { PF2_INVISIBLE, LPGENW("Invisible") }, + { PF2_OUTTOLUNCH, LPGENW("Out to lunch") }, + { PF2_ONTHEPHONE, LPGENW("On the phone") } }; static const struct CheckBoxValues_t offlineValues[] = { - { MODEF_OFFLINE, LPGENT("Offline") }, - { PF2_ONLINE, LPGENT("Online") }, - { PF2_SHORTAWAY, LPGENT("Away") }, - { PF2_LONGAWAY, LPGENT("Not available") }, - { PF2_LIGHTDND, LPGENT("Occupied") }, - { PF2_HEAVYDND, LPGENT("Do not disturb")}, - { PF2_FREECHAT, LPGENT("Free for chat") }, - { PF2_INVISIBLE, LPGENT("Invisible") }, - { PF2_OUTTOLUNCH, LPGENT("Out to lunch") }, - { PF2_ONTHEPHONE, LPGENT("On the phone") } + { MODEF_OFFLINE, LPGENW("Offline") }, + { PF2_ONLINE, LPGENW("Online") }, + { PF2_SHORTAWAY, LPGENW("Away") }, + { PF2_LONGAWAY, LPGENW("Not available") }, + { PF2_LIGHTDND, LPGENW("Occupied") }, + { PF2_HEAVYDND, LPGENW("Do not disturb")}, + { PF2_FREECHAT, LPGENW("Free for chat") }, + { PF2_INVISIBLE, LPGENW("Invisible") }, + { PF2_OUTTOLUNCH, LPGENW("Out to lunch") }, + { PF2_ONTHEPHONE, LPGENW("On the phone") } }; static void FillCheckBoxTree(HWND hwndTree, const struct CheckBoxValues_t *values, int nValues, DWORD style) @@ -118,7 +118,7 @@ static DWORD MakeCheckBoxTreeFlags(HWND hwndTree) static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - TCHAR tmp[1024]; + wchar_t tmp[1024]; switch (msg) { case WM_INITDIALOG: diff --git a/plugins/Clist_blind/src/clcpaint.cpp b/plugins/Clist_blind/src/clcpaint.cpp index 2371b69626..0c9824e4eb 100644 --- a/plugins/Clist_blind/src/clcpaint.cpp +++ b/plugins/Clist_blind/src/clcpaint.cpp @@ -269,7 +269,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) int hottrack = dat->exStyle & CLS_EX_TRACKSELECT && cc->type != CLCIT_DIVIDER && dat->iHotTrack == index; SIZE textSize, countsSize = { 0 }, spaceSize = { 0 }; int width, checkboxWidth; - TCHAR *szCounts = NULL; + wchar_t *szCounts = NULL; // alternating grey if (style & CLS_GREYALTERNATE && index & 1) { @@ -414,7 +414,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) } } else { - TCHAR *szText = cc->szText; + wchar_t *szText = cc->szText; RECT rc; rc.left = dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace; rc.top = y + ((dat->rowHeight - fontHeight) >> 1); @@ -424,7 +424,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) } if (selected) { if (cc->type != CLCIT_DIVIDER) { - TCHAR *szText = cc->szText; + wchar_t *szText = cc->szText; RECT rc; int qlen = (int)mir_tstrlen(dat->szQuickSearch); SetTextColor(hdcMem, dat->quickSearchColour); diff --git a/plugins/Clist_blind/src/cluiopts.cpp b/plugins/Clist_blind/src/cluiopts.cpp index 4490d55ee2..bccb11eca6 100644 --- a/plugins/Clist_blind/src/cluiopts.cpp +++ b/plugins/Clist_blind/src/cluiopts.cpp @@ -167,7 +167,7 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L db_set_b(NULL, "CLUI", "ClientAreaDrag", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CLIENTDRAG)); db_set_b(NULL, "CList", "Min2Tray", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY)); { - TCHAR title[256]; + wchar_t title[256]; GetDlgItemText(hwndDlg, IDC_TITLETEXT, title, _countof(title)); db_set_ts(NULL, "CList", "TitleText", title); SetWindowText(pcli->hwndContactList, title); diff --git a/plugins/Clist_blind/src/contact.cpp b/plugins/Clist_blind/src/contact.cpp index f93b16b71f..3adbd0c4da 100644 --- a/plugins/Clist_blind/src/contact.cpp +++ b/plugins/Clist_blind/src/contact.cpp @@ -83,9 +83,9 @@ int CompareContacts(const ClcContact* c1, const ClcContact* c2) return 2 * (statusa == ID_STATUS_OFFLINE) - 1; } - TCHAR namea[128]; - TCHAR *nameb = pcli->pfnGetContactDisplayName(a, 0); - _tcsncpy_s(namea, nameb, _TRUNCATE); + wchar_t namea[128]; + wchar_t *nameb = pcli->pfnGetContactDisplayName(a, 0); + wcsncpy_s(namea, nameb, _TRUNCATE); namea[ _countof(namea)-1 ] = 0; nameb = pcli->pfnGetContactDisplayName(b, 0); diff --git a/plugins/Clist_blind/src/init.cpp b/plugins/Clist_blind/src/init.cpp index 2bc79bdbed..30ccfa6c0c 100644 --- a/plugins/Clist_blind/src/init.cpp +++ b/plugins/Clist_blind/src/init.cpp @@ -176,11 +176,11 @@ extern "C" int __declspec(dllexport) Unload(void) ///////////////////////////////////////////////////////////////////////////////////////// -TCHAR* MyDBGetContactSettingTString(MCONTACT hContact, char* module, char* setting, TCHAR* out, size_t len, TCHAR *def) +wchar_t* MyDBGetContactSettingTString(MCONTACT hContact, char* module, char* setting, wchar_t* out, size_t len, wchar_t *def) { DBVARIANT dbv; - out[0] = _T('\0'); + out[0] = '\0'; if (!db_get_ts(hContact, module, setting, &dbv)) { if (dbv.type == DBVT_ASCIIZ) @@ -206,13 +206,13 @@ TCHAR* MyDBGetContactSettingTString(MCONTACT hContact, char* module, char* setti typedef struct { - TCHAR *text; + wchar_t *text; size_t allocated; size_t used; } StringHelper; -int CopyData(StringHelper *str, const TCHAR *text, size_t len) +int CopyData(StringHelper *str, const wchar_t *text, size_t len) { size_t totalSize; @@ -228,7 +228,7 @@ int CopyData(StringHelper *str, const TCHAR *text, size_t len) totalSize += DATA_BLOCK - (totalSize % DATA_BLOCK); if (str->text != NULL) { - TCHAR *tmp = (TCHAR *)mir_realloc(str->text, sizeof(TCHAR) * totalSize); + wchar_t *tmp = (wchar_t *)mir_realloc(str->text, sizeof(wchar_t) * totalSize); if (tmp == NULL) { mir_free(str->text); @@ -238,7 +238,7 @@ int CopyData(StringHelper *str, const TCHAR *text, size_t len) str->text = tmp; } else { - str->text = (TCHAR *)mir_alloc(sizeof(TCHAR) * totalSize); + str->text = (wchar_t *)mir_alloc(sizeof(wchar_t) * totalSize); if (str->text == NULL) { return -2; @@ -248,7 +248,7 @@ int CopyData(StringHelper *str, const TCHAR *text, size_t len) str->allocated = totalSize; } - memmove(&str->text[str->used], text, sizeof(TCHAR) * len); + memmove(&str->text[str->used], text, sizeof(wchar_t) * len); str->used += len; str->text[str->used] = '\0'; @@ -256,9 +256,9 @@ int CopyData(StringHelper *str, const TCHAR *text, size_t len) } -TCHAR * ParseText(const TCHAR *text, - const TCHAR **variables, size_t variablesSize, - const TCHAR **data, size_t dataSize) +wchar_t * ParseText(const wchar_t *text, + const wchar_t **variables, size_t variablesSize, + const wchar_t **data, size_t dataSize) { size_t length = mir_tstrlen(text); size_t nextPos = 0; @@ -267,13 +267,13 @@ TCHAR * ParseText(const TCHAR *text, // length - 1 because a % in last char will be a % and point for (i = 0; i < length - 1; i++) { - if (text[i] == _T('%')) { + if (text[i] == '%') { BOOL found = FALSE; if (CopyData(&ret, &text[nextPos], i - nextPos)) return NULL; - if (text[i + 1] == _T('%')) { + if (text[i + 1] == '%') { if (CopyData(&ret, L"%", 1)) return NULL; @@ -289,7 +289,7 @@ TCHAR * ParseText(const TCHAR *text, for (j = 0; j < size; j++) { size_t vlen = mir_tstrlen(variables[j]); - if (_tcsnicmp(&text[i], variables[j], vlen) == 0) { + if (wcsnicmp(&text[i], variables[j], vlen) == 0) { if (CopyData(&ret, data[j], mir_tstrlen(data[j]))) return NULL; @@ -407,18 +407,18 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L return coreCli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); } -TCHAR status_name[128]; -TCHAR* GetStatusName(struct ClcContact *item) +wchar_t status_name[128]; +wchar_t* GetStatusName(struct ClcContact *item) { int status; - status_name[0] = _T('\0'); + status_name[0] = '\0'; if (item->hContact == NULL || item->proto == NULL) return status_name; // Get XStatusName MyDBGetContactSettingTString(item->hContact, item->proto, "XStatusName", status_name, _countof(status_name), NULL); - if (status_name[0] != _T('\0')) + if (status_name[0] != '\0') return status_name; // Get status name @@ -429,16 +429,16 @@ TCHAR* GetStatusName(struct ClcContact *item) } -TCHAR status_message[256]; -TCHAR* GetStatusMessage(struct ClcContact *item) +wchar_t status_message[256]; +wchar_t* GetStatusMessage(struct ClcContact *item) { - status_message[0] = _T('\0'); + status_message[0] = '\0'; if (item->hContact == NULL || item->proto == NULL) return status_message; // Get XStatusMsg MyDBGetContactSettingTString(item->hContact, item->proto, "XStatusMsg", status_message, _countof(status_message), NULL); - if (status_message[0] != _T('\0')) + if (status_message[0] != '\0') return status_message; // Get status message @@ -448,8 +448,8 @@ TCHAR* GetStatusMessage(struct ClcContact *item) } -TCHAR proto_name[128]; -TCHAR* GetProtoName(struct ClcContact *item) +wchar_t proto_name[128]; +wchar_t* GetProtoName(struct ClcContact *item) { #ifdef UNICODE char description[128]; @@ -480,12 +480,12 @@ TCHAR* GetProtoName(struct ClcContact *item) void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig) { ClcData *dat = (ClcData*)tmp_dat; - TCHAR tmp[1024]; - TCHAR count[128]; - TCHAR template_contact[1024]; - TCHAR template_group[1024]; - TCHAR template_divider[1024]; - TCHAR template_info[1024]; + wchar_t tmp[1024]; + wchar_t count[128]; + wchar_t template_contact[1024]; + wchar_t template_group[1024]; + wchar_t template_divider[1024]; + wchar_t template_info[1024]; int selection = dat->selection; BOOL has_focus = (GetFocus() == dat->hwnd_list || GetFocus() == hwnd); @@ -509,7 +509,7 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig) ClcGroup *group = &dat->list; group->scanIndex = 0; - TCHAR *text = tmp; + wchar_t *text = tmp; size_t size = _countof(tmp); while (true) { if (group->scanIndex == group->cl.getCount()) { @@ -522,17 +522,17 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig) } ClcContact *item = group->cl[group->scanIndex]; - text[0] = _T('\0'); + text[0] = '\0'; switch (item->type) { case CLCIT_GROUP: { - TCHAR *szCounts = pcli->pfnGetGroupCountsText(dat, item); - const TCHAR *t[] = { + wchar_t *szCounts = pcli->pfnGetGroupCountsText(dat, item); + const wchar_t *t[] = { L"%name%", L"%count%", L"%mode%" }; - const TCHAR *v[] = { + const wchar_t *v[] = { item->szText, count, item->group->expanded ? TranslateT("Expanded") : TranslateT("Collapsed") @@ -541,9 +541,9 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig) if (szCounts[0] != '\0') mir_sntprintf(count, L"%s ", szCounts); else - count[0] = _T('\0'); + count[0] = '\0'; - TCHAR *txt = ParseText(template_group, t, _countof(t), v, _countof(v)); + wchar_t *txt = ParseText(template_group, t, _countof(t), v, _countof(v)); if (txt != NULL) mir_tstrncpy(text, txt, size); mir_free(txt); @@ -552,20 +552,20 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig) case CLCIT_CONTACT: { - const TCHAR *t[] = { + const wchar_t *t[] = { L"%name%", L"%status%", L"%protocol%", L"%status_message%" }; - const TCHAR *v[] = { + const wchar_t *v[] = { item->szText, GetStatusName(item), GetProtoName(item), GetStatusMessage(item) }; - TCHAR *txt = ParseText(template_contact, t, _countof(t), v, _countof(v)); + wchar_t *txt = ParseText(template_contact, t, _countof(t), v, _countof(v)); if (txt != NULL) mir_tstrncpy(text, txt, size); mir_free(txt); @@ -585,8 +585,8 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig) if (item->type == CLCIT_GROUP && item->group->expanded) { group = item->group; - text[0] = _T(' '); - text[1] = _T(' '); + text[0] = ' '; + text[1] = ' '; text += 2; size -= 2; group->scanIndex = 0; -- cgit v1.2.3