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 --- src/core/stdauth/src/auth.cpp | 2 +- src/core/stdauth/src/authdialogs.cpp | 38 +++--- src/core/stdauth/src/stdafx.h | 1 - src/core/stdautoaway/src/autoaway.cpp | 2 +- src/core/stdautoaway/src/stdafx.h | 1 - src/core/stdaway/src/awaymsg.cpp | 10 +- src/core/stdaway/src/sendmsg.cpp | 42 +++---- src/core/stdaway/src/stdafx.h | 1 - src/core/stdchat/src/main.cpp | 14 +-- src/core/stdchat/src/manager.cpp | 2 +- src/core/stdchat/src/options.cpp | 192 +++++++++++++++--------------- src/core/stdchat/src/stdafx.h | 10 +- src/core/stdchat/src/tools.cpp | 16 +-- src/core/stdchat/src/window.cpp | 46 +++---- src/core/stdclist/src/clcfonts.cpp | 34 +++--- src/core/stdclist/src/clcopts.cpp | 48 ++++---- src/core/stdclist/src/clcpaint.cpp | 2 +- src/core/stdclist/src/cluiopts.cpp | 2 +- src/core/stdclist/src/contact.cpp | 52 ++++---- src/core/stdcrypt/src/stdafx.h | 1 - src/core/stdemail/src/stdafx.h | 1 - src/core/stdfile/src/file.cpp | 36 +++--- src/core/stdfile/src/file.h | 26 ++-- src/core/stdfile/src/fileexistsdlg.cpp | 32 ++--- src/core/stdfile/src/fileopts.cpp | 32 ++--- src/core/stdfile/src/filerecvdlg.cpp | 80 ++++++------- src/core/stdfile/src/filesenddlg.cpp | 32 ++--- src/core/stdfile/src/filexferdlg.cpp | 108 ++++++++--------- src/core/stdfile/src/stdafx.h | 1 - src/core/stdhelp/src/about.cpp | 6 +- src/core/stdhelp/src/help.cpp | 2 +- src/core/stdhelp/src/stdafx.h | 1 - src/core/stdidle/src/stdafx.h | 1 - src/core/stdmsg/src/msgdialog.cpp | 60 +++++----- src/core/stdmsg/src/msglog.cpp | 44 +++---- src/core/stdmsg/src/msgoptions.cpp | 64 +++++----- src/core/stdmsg/src/msgs.cpp | 8 +- src/core/stdmsg/src/msgs.h | 4 +- src/core/stdssl/src/netlibssl.cpp | 8 +- src/core/stduihist/src/history.cpp | 30 ++--- src/core/stduihist/src/stdafx.h | 1 - src/core/stduserinfo/src/contactinfo.cpp | 14 +-- src/core/stduserinfo/src/stdafx.h | 1 - src/core/stduserinfo/src/stdinfo.cpp | 8 +- src/core/stduserinfo/src/userinfo.cpp | 36 +++--- src/core/stduseronline/src/stdafx.h | 1 - src/core/stduseronline/src/useronline.cpp | 2 +- 47 files changed, 572 insertions(+), 583 deletions(-) (limited to 'src/core') diff --git a/src/core/stdauth/src/auth.cpp b/src/core/stdauth/src/auth.cpp index da81b55068..191031062c 100644 --- a/src/core/stdauth/src/auth.cpp +++ b/src/core/stdauth/src/auth.cpp @@ -44,7 +44,7 @@ INT_PTR ShowAddedWindow(WPARAM, LPARAM lParam) static int AuthEventAdded(WPARAM, LPARAM lParam) { - TCHAR szTooltip[256]; + wchar_t szTooltip[256]; MEVENT hDbEvent = (MEVENT)lParam; DBEVENTINFO dbei = { sizeof(dbei) }; diff --git a/src/core/stdauth/src/authdialogs.cpp b/src/core/stdauth/src/authdialogs.cpp index 6ce9a9e66f..86f9db4ec4 100644 --- a/src/core/stdauth/src/authdialogs.cpp +++ b/src/core/stdauth/src/authdialogs.cpp @@ -55,12 +55,12 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar PROTOACCOUNT* acc = Proto_GetAccount(dbei.szModule); - TCHAR* lastT = dbei.flags & DBEF_UTF ? Utf8DecodeT(last) : mir_a2t(last); - TCHAR* firstT = dbei.flags & DBEF_UTF ? Utf8DecodeT(first) : mir_a2t(first); - TCHAR* nickT = dbei.flags & DBEF_UTF ? Utf8DecodeT(nick) : mir_a2t(nick); - TCHAR* emailT = dbei.flags & DBEF_UTF ? Utf8DecodeT(email) : mir_a2t(email); + wchar_t* lastT = dbei.flags & DBEF_UTF ? Utf8DecodeT(last) : mir_a2t(last); + wchar_t* firstT = dbei.flags & DBEF_UTF ? Utf8DecodeT(first) : mir_a2t(first); + wchar_t* nickT = dbei.flags & DBEF_UTF ? Utf8DecodeT(nick) : mir_a2t(nick); + wchar_t* emailT = dbei.flags & DBEF_UTF ? Utf8DecodeT(email) : mir_a2t(email); - TCHAR name[128] = L""; + wchar_t name[128] = L""; int off = 0; if (firstT[0] && lastT[0]) off = mir_sntprintf(name, L"%s %s", firstT, lastT); @@ -72,12 +72,12 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar if (off) mir_sntprintf(name + off, _countof(name) - off, L" (%s)", nickT); else - _tcsncpy_s(name, nickT, _TRUNCATE); + wcsncpy_s(name, nickT, _TRUNCATE); } if (!name[0]) - _tcsncpy_s(name, TranslateT(""), _TRUNCATE); + wcsncpy_s(name, TranslateT(""), _TRUNCATE); - TCHAR hdr[256]; + wchar_t hdr[256]; if (uin && emailT[0]) mir_sntprintf(hdr, TranslateT("%s added you to the contact list\n%u (%s) on %s"), name, uin, emailT, acc->tszAccountName); else if (uin) @@ -185,30 +185,30 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP ptrT emailT(dbei.flags & DBEF_UTF ? Utf8DecodeT(email) : mir_a2t(email)); ptrT reasonT(dbei.flags & DBEF_UTF ? Utf8DecodeT(reason) : mir_a2t(reason)); - TCHAR name[128] = L""; + wchar_t name[128] = L""; int off = 0; if (firstT[0] && lastT[0]) - off = mir_sntprintf(name, L"%s %s", (TCHAR*)firstT, (TCHAR*)lastT); + off = mir_sntprintf(name, L"%s %s", (wchar_t*)firstT, (wchar_t*)lastT); else if (firstT[0]) - off = mir_sntprintf(name, L"%s", (TCHAR*)firstT); + off = mir_sntprintf(name, L"%s", (wchar_t*)firstT); else if (lastT[0]) - off = mir_sntprintf(name, L"%s", (TCHAR*)lastT); + off = mir_sntprintf(name, L"%s", (wchar_t*)lastT); if (mir_tstrlen(nickT)) { if (off) - mir_sntprintf(name + off, _countof(name) - off, L" (%s)", (TCHAR*)nickT); + mir_sntprintf(name + off, _countof(name) - off, L" (%s)", (wchar_t*)nickT); else - _tcsncpy_s(name, nickT, _TRUNCATE); + wcsncpy_s(name, nickT, _TRUNCATE); } if (!name[0]) - _tcsncpy_s(name, TranslateT(""), _TRUNCATE); + wcsncpy_s(name, TranslateT(""), _TRUNCATE); - TCHAR hdr[256]; + wchar_t hdr[256]; if (uin && emailT[0]) - mir_sntprintf(hdr, TranslateT("%s requested authorization\n%u (%s) on %s"), name, uin, (TCHAR*)emailT, acc->tszAccountName); + mir_sntprintf(hdr, TranslateT("%s requested authorization\n%u (%s) on %s"), name, uin, (wchar_t*)emailT, acc->tszAccountName); else if (uin) mir_sntprintf(hdr, TranslateT("%s requested authorization\n%u on %s"), name, uin, acc->tszAccountName); else - mir_sntprintf(hdr, TranslateT("%s requested authorization\n%s on %s"), name, emailT[0] ? (TCHAR*)emailT : TranslateT("(Unknown)"), acc->tszAccountName); + mir_sntprintf(hdr, TranslateT("%s requested authorization\n%s on %s"), name, emailT[0] ? (wchar_t*)emailT : TranslateT("(Unknown)"), acc->tszAccountName); SetDlgItemText(hwndDlg, IDC_HEADERBAR, hdr); SetDlgItemText(hwndDlg, IDC_REASON, reasonT); @@ -264,7 +264,7 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP db_event_get(hDbEvent, &dbei); if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_DENYREASON))) { - TCHAR tszReason[256]; + wchar_t tszReason[256]; GetDlgItemText(hwndDlg, IDC_DENYREASON, tszReason, _countof(tszReason)); CallProtoService(dbei.szModule, PS_AUTHDENY, hDbEvent, (LPARAM)tszReason); } diff --git a/src/core/stdauth/src/stdafx.h b/src/core/stdauth/src/stdafx.h index 06f20fb566..7112db5e94 100644 --- a/src/core/stdauth/src/stdafx.h +++ b/src/core/stdauth/src/stdafx.h @@ -22,7 +22,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include #include #include #include diff --git a/src/core/stdautoaway/src/autoaway.cpp b/src/core/stdautoaway/src/autoaway.cpp index 9eb35a7d25..2a490ba693 100644 --- a/src/core/stdautoaway/src/autoaway.cpp +++ b/src/core/stdautoaway/src/autoaway.cpp @@ -38,7 +38,7 @@ static int AutoAwaySound(WPARAM, LPARAM) static void Proto_SetStatus(const char *szProto, unsigned status) { if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) { - ptrT awayMsg((TCHAR*)CallService(MS_AWAYMSG_GETSTATUSMSGW, status, (LPARAM)szProto)); + ptrT awayMsg((wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGW, status, (LPARAM)szProto)); CallProtoService(szProto, PS_SETAWAYMSG, status, awayMsg); } diff --git a/src/core/stdautoaway/src/stdafx.h b/src/core/stdautoaway/src/stdafx.h index debc097003..7ac8638151 100644 --- a/src/core/stdautoaway/src/stdafx.h +++ b/src/core/stdautoaway/src/stdafx.h @@ -22,7 +22,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include #include #include #include diff --git a/src/core/stdaway/src/awaymsg.cpp b/src/core/stdaway/src/awaymsg.cpp index 2efff40a04..b51b6f4d7a 100644 --- a/src/core/stdaway/src/awaymsg.cpp +++ b/src/core/stdaway/src/awaymsg.cpp @@ -54,11 +54,11 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP dat->hSeq = (HANDLE)ProtoChainSend(dat->hContact, PSS_GETAWAYMSG, 0, 0); WindowList_Add(hWindowList, hwndDlg, dat->hContact); { - TCHAR str[256], format[128]; - TCHAR *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0); + wchar_t str[256], format[128]; + wchar_t *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0); char *szProto = GetContactProto(dat->hContact); WORD dwStatus = db_get_w(dat->hContact, szProto, "Status", ID_STATUS_OFFLINE); - TCHAR *status = pcli->pfnGetStatusModeDescription(dwStatus, 0); + wchar_t *status = pcli->pfnGetStatusModeDescription(dwStatus, 0); GetWindowText(hwndDlg, format, _countof(format)); mir_sntprintf(str, format, status, contactName); @@ -89,7 +89,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP if (ack->result != ACKRESULT_SUCCESS) break; if (dat->hAwayMsgEvent && ack->hProcess == dat->hSeq) { UnhookEvent(dat->hAwayMsgEvent); dat->hAwayMsgEvent = NULL; } - SetDlgItemText(hwndDlg, IDC_MSG, (const TCHAR*)ack->lParam); + SetDlgItemText(hwndDlg, IDC_MSG, (const wchar_t*)ack->lParam); ShowWindow(GetDlgItem(hwndDlg, IDC_RETRIEVING), SW_HIDE); ShowWindow(GetDlgItem(hwndDlg, IDC_MSG), SW_SHOW); @@ -140,7 +140,7 @@ static int AwayMsgPreBuildMenu(WPARAM hContact, LPARAM) int status = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE); if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGRECV) { if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(status)) { - TCHAR str[128]; + wchar_t str[128]; mir_sntprintf(str, TranslateT("Re&ad %s message"), pcli->pfnGetStatusModeDescription(status, 0)); Menu_ModifyItem(hAwayMsgMenuItem, str, Skin_LoadProtoIcon(szProto, status), CMIF_NOTOFFLINE); return 0; diff --git a/src/core/stdaway/src/sendmsg.cpp b/src/core/stdaway/src/sendmsg.cpp index c2460a8a34..a3f2968588 100644 --- a/src/core/stdaway/src/sendmsg.cpp +++ b/src/core/stdaway/src/sendmsg.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static DWORD protoModeMsgFlags; static HWND hwndStatusMsg; -static const TCHAR *GetDefaultMessage(int status) +static const wchar_t *GetDefaultMessage(int status) { switch(status) { case ID_STATUS_AWAY: return TranslateT("I've been away since %time%."); @@ -79,7 +79,7 @@ static void SetStatusModeByte(int status, const char *suffix, BYTE value) db_set_b(NULL, "SRAway", StatusModeToDbSetting(status, suffix), value); } -static TCHAR* GetAwayMessage(int statusMode, char *szProto) +static wchar_t* GetAwayMessage(int statusMode, char *szProto) { if (szProto && !(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(statusMode))) return NULL; @@ -100,8 +100,8 @@ static TCHAR* GetAwayMessage(int statusMode, char *szProto) if (dbv.ptszVal[i] != '%') continue; - TCHAR substituteStr[128]; - if ( !_tcsnicmp(dbv.ptszVal + i, L"%time%", 6)) { + wchar_t substituteStr[128]; + if ( !wcsnicmp(dbv.ptszVal + i, L"%time%", 6)) { MIRANDA_IDLE_INFO mii = { sizeof(mii) }; CallService(MS_IDLE_GETIDLEINFO, 0, (LPARAM)&mii); @@ -117,14 +117,14 @@ static TCHAR* GetAwayMessage(int statusMode, char *szProto) } else GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, NULL, NULL, substituteStr, _countof(substituteStr)); } - else if ( !_tcsnicmp(dbv.ptszVal + i, L"%date%", 6)) + else if ( !wcsnicmp(dbv.ptszVal + i, L"%date%", 6)) GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, substituteStr, _countof(substituteStr)); else continue; if (mir_tstrlen(substituteStr) > 6) - dbv.ptszVal = (TCHAR*)mir_realloc(dbv.ptszVal, (mir_tstrlen(dbv.ptszVal) + 1 + mir_tstrlen(substituteStr) - 6) * sizeof(TCHAR)); - memmove(dbv.ptszVal + i + mir_tstrlen(substituteStr), dbv.ptszVal + i + 6, (mir_tstrlen(dbv.ptszVal) - i - 5) * sizeof(TCHAR)); - memcpy(dbv.ptszVal+i, substituteStr, mir_tstrlen(substituteStr) * sizeof(TCHAR)); + dbv.ptszVal = (wchar_t*)mir_realloc(dbv.ptszVal, (mir_tstrlen(dbv.ptszVal) + 1 + mir_tstrlen(substituteStr) - 6) * sizeof(wchar_t)); + memmove(dbv.ptszVal + i + mir_tstrlen(substituteStr), dbv.ptszVal + i + 6, (mir_tstrlen(dbv.ptszVal) - i - 5) * sizeof(wchar_t)); + memcpy(dbv.ptszVal+i, substituteStr, mir_tstrlen(substituteStr) * sizeof(wchar_t)); } } return dbv.ptszVal; @@ -152,15 +152,15 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar if (wParam == 127 && GetKeyState(VK_CONTROL) & 0x8000) //ctrl-backspace { DWORD start, end; - TCHAR *text; + wchar_t *text; int textLen; SendMessage(hwnd, EM_GETSEL, (WPARAM)&end, 0); SendMessage(hwnd, WM_KEYDOWN, VK_LEFT, 0); SendMessage(hwnd, EM_GETSEL, (WPARAM)&start, 0); textLen = GetWindowTextLength(hwnd); - text = (TCHAR *)alloca(sizeof(TCHAR) * (textLen + 1)); + text = (wchar_t *)alloca(sizeof(wchar_t) * (textLen + 1)); GetWindowText(hwnd, text, textLen + 1); - memmove(text + start, text + end, sizeof(TCHAR) * (textLen + 1 - end)); + memmove(text + start, text + end, sizeof(wchar_t) * (textLen + 1 - end)); SetWindowText(hwnd, text); SendMessage(hwnd, EM_SETSEL, start, start); SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), EN_CHANGE), (LPARAM)hwnd); @@ -171,7 +171,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar return mir_callNextSubclass(hwnd, MessageEditSubclassProc, msg, wParam, lParam); } -void ChangeAllProtoMessages(char *szProto, int statusMode, TCHAR *msg) +void ChangeAllProtoMessages(char *szProto, int statusMode, wchar_t *msg) { if (szProto == NULL) { int nAccounts; @@ -194,7 +194,7 @@ struct SetAwayMsgData { int statusMode; int countdown; - TCHAR okButtonFormat[64]; + wchar_t okButtonFormat[64]; char *szProto; HANDLE hPreshutdown; }; @@ -224,14 +224,14 @@ static INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wPa SendDlgItemMessage(hwndDlg, IDC_MSG, EM_LIMITTEXT, 1024, 0); mir_subclassWindow(GetDlgItem(hwndDlg, IDC_MSG), MessageEditSubclassProc); { - TCHAR str[256], format[128]; + wchar_t str[256], format[128]; GetWindowText(hwndDlg, format, _countof(format)); mir_sntprintf(str, format, pcli->pfnGetStatusModeDescription(dat->statusMode, 0)); SetWindowText(hwndDlg, str); } GetDlgItemText(hwndDlg, IDOK, dat->okButtonFormat, _countof(dat->okButtonFormat)); { - TCHAR *msg = GetAwayMessage(dat->statusMode, dat->szProto); + wchar_t *msg = GetAwayMessage(dat->statusMode, dat->szProto); SetDlgItemText(hwndDlg, IDC_MSG, msg); mir_free(msg); } @@ -246,7 +246,7 @@ static INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wPa case WM_TIMER: if (--dat->countdown >= 0) { - TCHAR str[64]; + wchar_t str[64]; mir_sntprintf(str, dat->okButtonFormat, dat->countdown); SetDlgItemText(hwndDlg, IDOK, str); } @@ -258,7 +258,7 @@ static INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wPa case WM_CLOSE: { - TCHAR *msg = GetAwayMessage(dat->statusMode, dat->szProto); + wchar_t *msg = GetAwayMessage(dat->statusMode, dat->szProto); ChangeAllProtoMessages(dat->szProto, dat->statusMode, msg); mir_free(msg); } @@ -269,7 +269,7 @@ static INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wPa switch (LOWORD(wParam)) { case IDOK: if (dat->countdown < 0) { - TCHAR str[1024]; + wchar_t str[1024]; GetDlgItemText(hwndDlg, IDC_MSG, str, _countof(str)); ChangeAllProtoMessages(dat->szProto, dat->statusMode, str); db_set_ts(NULL, "SRAway", StatusModeToDbSetting(dat->statusMode, "Msg"), str); @@ -329,7 +329,7 @@ static int StatusModeChange(WPARAM wParam, LPARAM lParam) ChangeAllProtoMessages(szProto, statusMode, NULL); else if (bScreenSaverRunning || GetStatusModeByte(statusMode, "NoDlg", true)) { - TCHAR *msg = GetAwayMessage(statusMode, szProto); + wchar_t *msg = GetAwayMessage(statusMode, szProto); ChangeAllProtoMessages(szProto, statusMode, msg); mir_free(msg); } @@ -355,7 +355,7 @@ struct AwayMsgInfo int ignore; int noDialog; int usePrevious; - TCHAR msg[1024]; + wchar_t msg[1024]; }; struct AwayMsgDlgData @@ -422,7 +422,7 @@ static INT_PTR CALLBACK DlgProcAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam; if (dis->CtlID != IDC_LST_STATUS) break; - TCHAR buf[128]; + wchar_t buf[128]; SendDlgItemMessage(hwndDlg, IDC_LST_STATUS, LB_GETTEXT, dis->itemID, (LPARAM)buf); if (dis->itemState & (ODS_SELECTED | ODS_FOCUS)) { diff --git a/src/core/stdaway/src/stdafx.h b/src/core/stdaway/src/stdafx.h index b9f0df09cd..d8bb7b74e3 100644 --- a/src/core/stdaway/src/stdafx.h +++ b/src/core/stdaway/src/stdafx.h @@ -22,7 +22,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include #include #include #include diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp index 28e27f8b5d..430992defb 100644 --- a/src/core/stdchat/src/main.cpp +++ b/src/core/stdchat/src/main.cpp @@ -287,30 +287,30 @@ static void RegisterFonts() { ColourIDT colourid = { sizeof(colourid) }; strncpy(colourid.dbSettingsGroup, CHAT_MODULE, sizeof(colourid.dbSettingsGroup)); - _tcsncpy(colourid.group, LPGENT("Chat module"), _countof(colourid.group)); + wcsncpy(colourid.group, LPGENW("Chat module"), _countof(colourid.group)); strncpy(colourid.setting, "ColorLogBG", _countof(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Group chat log background"), _countof(colourid.name)); + wcsncpy(colourid.name, LPGENW("Group chat log background"), _countof(colourid.name)); colourid.defcolour = GetSysColor(COLOR_WINDOW); ColourRegisterT(&colourid); strncpy(colourid.setting, "ColorMessageBG", _countof(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Message background"), _countof(colourid.name)); + wcsncpy(colourid.name, LPGENW("Message background"), _countof(colourid.name)); colourid.defcolour = GetSysColor(COLOR_WINDOW); ColourRegisterT(&colourid); strncpy(colourid.setting, "ColorNicklistBG", _countof(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Nick list background"), _countof(colourid.name)); + wcsncpy(colourid.name, LPGENW("Nick list background"), _countof(colourid.name)); colourid.defcolour = GetSysColor(COLOR_WINDOW); ColourRegisterT(&colourid); strncpy(colourid.setting, "ColorNicklistLines", _countof(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Nick list lines"), _countof(colourid.name)); + wcsncpy(colourid.name, LPGENW("Nick list lines"), _countof(colourid.name)); colourid.defcolour = GetSysColor(COLOR_INACTIVEBORDER); ColourRegisterT(&colourid); strncpy(colourid.setting, "ColorNicklistSelectedBG", _countof(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Nick list background (selected)"), _countof(colourid.name)); + wcsncpy(colourid.name, LPGENW("Nick list background (selected)"), _countof(colourid.name)); colourid.defcolour = GetSysColor(COLOR_HIGHLIGHT); ColourRegisterT(&colourid); } @@ -345,7 +345,7 @@ extern "C" __declspec(dllexport) int Load(void) AddIcons(); RegisterFonts(); - CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENT("Chat module"), FONTMODE_SKIP }; + CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENW("Chat module"), FONTMODE_SKIP }; mir_getCI(&data); saveCI = *pci; diff --git a/src/core/stdchat/src/manager.cpp b/src/core/stdchat/src/manager.cpp index f0fd3076cc..bc901042e8 100644 --- a/src/core/stdchat/src/manager.cpp +++ b/src/core/stdchat/src/manager.cpp @@ -78,7 +78,7 @@ SESSION_INFO* SM_GetNextWindow(SESSION_INFO *si) // be restored //--------------------------------------------------- -BOOL TabM_AddTab(const TCHAR *pszID, const char* pszModule) +BOOL TabM_AddTab(const wchar_t *pszID, const char* pszModule) { TABLIST *node = NULL; if (!pszID || !pszModule) diff --git a/src/core/stdchat/src/options.cpp b/src/core/stdchat/src/options.cpp index 1bd3a33c5c..5ce45f72ce 100644 --- a/src/core/stdchat/src/options.cpp +++ b/src/core/stdchat/src/options.cpp @@ -23,109 +23,109 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct branch_t { - const TCHAR* szDescr; + const wchar_t* szDescr; const char* szDBName; int iMode; BYTE bDefault; }; static const struct branch_t branch0[] = { - { LPGENT("Use a tabbed interface"), "Tabs", 0, 1 }, - { LPGENT("Close tab on double click"), "TabCloseOnDblClick", 0, 0 }, - { LPGENT("Restore previously open tabs when showing the window"), "TabRestore", 0, 0 }, - { LPGENT("Show tabs at the bottom"), "TabBottom", 0, 0 }, + { LPGENW("Use a tabbed interface"), "Tabs", 0, 1 }, + { LPGENW("Close tab on double click"), "TabCloseOnDblClick", 0, 0 }, + { LPGENW("Restore previously open tabs when showing the window"), "TabRestore", 0, 0 }, + { LPGENW("Show tabs at the bottom"), "TabBottom", 0, 0 }, }; static const struct branch_t branch1[] = { - { LPGENT("Send message by pressing the 'Enter' key"), "SendOnEnter", 0, 1 }, - { LPGENT("Send message by pressing the 'Enter' key twice"), "SendOnDblEnter", 0, 0 }, - { LPGENT("Flash window when someone speaks"), "FlashWindow", 0, 0 }, - { LPGENT("Flash window when a word is highlighted"), "FlashWindowHighlight", 0, 1 }, - { LPGENT("Show list of users in the chat room"), "ShowNicklist", 0, 1 }, - { LPGENT("Show button for sending messages"), "ShowSend", 0, 0 }, - { LPGENT("Show buttons for controlling the chat room"), "ShowTopButtons", 0, 1 }, - { LPGENT("Show buttons for formatting the text you are typing"), "ShowFormatButtons", 0, 1 }, - { LPGENT("Show button menus when right clicking the buttons"), "RightClickFilter", 0, 0 }, - { LPGENT("Show new windows cascaded"), "CascadeWindows", 0, 1 }, - { LPGENT("Save the size and position of chat rooms"), "SavePosition", 0, 0 }, - { LPGENT("Show the topic of the room on your contact list (if supported)"), "TopicOnClist", 0, 0 }, - { LPGENT("Do not play sounds when the chat room is focused"), "SoundsFocus", 0, 0 }, - { LPGENT("Do not pop up the window when joining a chat room"), "PopupOnJoin", 0, 0 }, - { LPGENT("Toggle the visible state when double clicking in the contact list"), "ToggleVisibility", 0, 0 }, - { LPGENT("Show contact statuses if protocol supports them"), "ShowContactStatus", 0, 0 }, - { LPGENT("Display contact status icon before user role icon"), "ContactStatusFirst", 0, 0 }, + { LPGENW("Send message by pressing the 'Enter' key"), "SendOnEnter", 0, 1 }, + { LPGENW("Send message by pressing the 'Enter' key twice"), "SendOnDblEnter", 0, 0 }, + { LPGENW("Flash window when someone speaks"), "FlashWindow", 0, 0 }, + { LPGENW("Flash window when a word is highlighted"), "FlashWindowHighlight", 0, 1 }, + { LPGENW("Show list of users in the chat room"), "ShowNicklist", 0, 1 }, + { LPGENW("Show button for sending messages"), "ShowSend", 0, 0 }, + { LPGENW("Show buttons for controlling the chat room"), "ShowTopButtons", 0, 1 }, + { LPGENW("Show buttons for formatting the text you are typing"), "ShowFormatButtons", 0, 1 }, + { LPGENW("Show button menus when right clicking the buttons"), "RightClickFilter", 0, 0 }, + { LPGENW("Show new windows cascaded"), "CascadeWindows", 0, 1 }, + { LPGENW("Save the size and position of chat rooms"), "SavePosition", 0, 0 }, + { LPGENW("Show the topic of the room on your contact list (if supported)"), "TopicOnClist", 0, 0 }, + { LPGENW("Do not play sounds when the chat room is focused"), "SoundsFocus", 0, 0 }, + { LPGENW("Do not pop up the window when joining a chat room"), "PopupOnJoin", 0, 0 }, + { LPGENW("Toggle the visible state when double clicking in the contact list"), "ToggleVisibility", 0, 0 }, + { LPGENW("Show contact statuses if protocol supports them"), "ShowContactStatus", 0, 0 }, + { LPGENW("Display contact status icon before user role icon"), "ContactStatusFirst", 0, 0 }, }; static const struct branch_t branch2[] = { - { LPGENT("Prefix all events with a timestamp"), "ShowTimeStamp", 0, 1 }, - { LPGENT("Only prefix with timestamp if it has changed"), "ShowTimeStampIfChanged", 0, 0 }, - { LPGENT("Timestamp has same color as the event"), "TimeStampEventColour", 0, 0 }, - { LPGENT("Indent the second line of a message"), "LogIndentEnabled", 0, 1 }, - { LPGENT("Limit user names in the message log to 20 characters"), "LogLimitNames", 0, 1 }, - { LPGENT("Add ':' to auto-completed user names"), "AddColonToAutoComplete", 0, 1 }, - { LPGENT("Strip colors from messages in the log"), "StripFormatting", 0, 0 }, - { LPGENT("Enable the 'event filter' for new rooms"), "FilterEnabled", 0, 0 } + { LPGENW("Prefix all events with a timestamp"), "ShowTimeStamp", 0, 1 }, + { LPGENW("Only prefix with timestamp if it has changed"), "ShowTimeStampIfChanged", 0, 0 }, + { LPGENW("Timestamp has same color as the event"), "TimeStampEventColour", 0, 0 }, + { LPGENW("Indent the second line of a message"), "LogIndentEnabled", 0, 1 }, + { LPGENW("Limit user names in the message log to 20 characters"), "LogLimitNames", 0, 1 }, + { LPGENW("Add ':' to auto-completed user names"), "AddColonToAutoComplete", 0, 1 }, + { LPGENW("Strip colors from messages in the log"), "StripFormatting", 0, 0 }, + { LPGENW("Enable the 'event filter' for new rooms"), "FilterEnabled", 0, 0 } }; static const struct branch_t branch3[] = { - { LPGENT("Show topic changes"), "FilterFlags", GC_EVENT_TOPIC, 0 }, - { LPGENT("Show users joining"), "FilterFlags", GC_EVENT_JOIN, 0 }, - { LPGENT("Show users disconnecting"), "FilterFlags", GC_EVENT_QUIT, 0 }, - { LPGENT("Show messages"), "FilterFlags", GC_EVENT_MESSAGE, 1 }, - { LPGENT("Show actions"), "FilterFlags", GC_EVENT_ACTION, 1 }, - { LPGENT("Show users leaving"), "FilterFlags", GC_EVENT_PART, 0 }, - { LPGENT("Show users being kicked"), "FilterFlags", GC_EVENT_KICK, 1 }, - { LPGENT("Show notices"), "FilterFlags", GC_EVENT_NOTICE, 1 }, - { LPGENT("Show users changing name"), "FilterFlags", GC_EVENT_NICK, 0 }, - { LPGENT("Show information messages"), "FilterFlags", GC_EVENT_INFORMATION, 1 }, - { LPGENT("Show status changes of users"), "FilterFlags", GC_EVENT_ADDSTATUS, 0 }, + { LPGENW("Show topic changes"), "FilterFlags", GC_EVENT_TOPIC, 0 }, + { LPGENW("Show users joining"), "FilterFlags", GC_EVENT_JOIN, 0 }, + { LPGENW("Show users disconnecting"), "FilterFlags", GC_EVENT_QUIT, 0 }, + { LPGENW("Show messages"), "FilterFlags", GC_EVENT_MESSAGE, 1 }, + { LPGENW("Show actions"), "FilterFlags", GC_EVENT_ACTION, 1 }, + { LPGENW("Show users leaving"), "FilterFlags", GC_EVENT_PART, 0 }, + { LPGENW("Show users being kicked"), "FilterFlags", GC_EVENT_KICK, 1 }, + { LPGENW("Show notices"), "FilterFlags", GC_EVENT_NOTICE, 1 }, + { LPGENW("Show users changing name"), "FilterFlags", GC_EVENT_NICK, 0 }, + { LPGENW("Show information messages"), "FilterFlags", GC_EVENT_INFORMATION, 1 }, + { LPGENW("Show status changes of users"), "FilterFlags", GC_EVENT_ADDSTATUS, 0 }, }; static const struct branch_t branch4[] = { - { LPGENT("Show icon for topic changes"), "IconFlags", GC_EVENT_TOPIC, 0 }, - { LPGENT("Show icon for users joining"), "IconFlags", GC_EVENT_JOIN, 1 }, - { LPGENT("Show icon for users disconnecting"), "IconFlags", GC_EVENT_QUIT, 0 }, - { LPGENT("Show icon for messages"), "IconFlags", GC_EVENT_MESSAGE, 0 }, - { LPGENT("Show icon for actions"), "IconFlags", GC_EVENT_ACTION, 0 }, - { LPGENT("Show icon for highlights"), "IconFlags", GC_EVENT_HIGHLIGHT, 0 }, - { LPGENT("Show icon for users leaving"), "IconFlags", GC_EVENT_PART, 0 }, - { LPGENT("Show icon for users kicking other user"), "IconFlags", GC_EVENT_KICK, 0 }, - { LPGENT("Show icon for notices"), "IconFlags", GC_EVENT_NOTICE, 0 }, - { LPGENT("Show icon for name changes"), "IconFlags", GC_EVENT_NICK, 0 }, - { LPGENT("Show icon for information messages"), "IconFlags", GC_EVENT_INFORMATION, 0 }, - { LPGENT("Show icon for status changes"), "IconFlags", GC_EVENT_ADDSTATUS, 0 }, + { LPGENW("Show icon for topic changes"), "IconFlags", GC_EVENT_TOPIC, 0 }, + { LPGENW("Show icon for users joining"), "IconFlags", GC_EVENT_JOIN, 1 }, + { LPGENW("Show icon for users disconnecting"), "IconFlags", GC_EVENT_QUIT, 0 }, + { LPGENW("Show icon for messages"), "IconFlags", GC_EVENT_MESSAGE, 0 }, + { LPGENW("Show icon for actions"), "IconFlags", GC_EVENT_ACTION, 0 }, + { LPGENW("Show icon for highlights"), "IconFlags", GC_EVENT_HIGHLIGHT, 0 }, + { LPGENW("Show icon for users leaving"), "IconFlags", GC_EVENT_PART, 0 }, + { LPGENW("Show icon for users kicking other user"), "IconFlags", GC_EVENT_KICK, 0 }, + { LPGENW("Show icon for notices"), "IconFlags", GC_EVENT_NOTICE, 0 }, + { LPGENW("Show icon for name changes"), "IconFlags", GC_EVENT_NICK, 0 }, + { LPGENW("Show icon for information messages"), "IconFlags", GC_EVENT_INFORMATION, 0 }, + { LPGENW("Show icon for status changes"), "IconFlags", GC_EVENT_ADDSTATUS, 0 }, }; static const struct branch_t branch5[] = { - { LPGENT("Show icons in tray only when the chat room is not active"), "TrayIconInactiveOnly", 0, 1 }, - { LPGENT("Show icon in tray for topic changes"), "TrayIconFlags", GC_EVENT_TOPIC, 0 }, - { LPGENT("Show icon in tray for users joining"), "TrayIconFlags", GC_EVENT_JOIN, 0 }, - { LPGENT("Show icon in tray for users disconnecting"), "TrayIconFlags", GC_EVENT_QUIT, 0 }, - { LPGENT("Show icon in tray for messages"), "TrayIconFlags", GC_EVENT_MESSAGE, 0 }, - { LPGENT("Show icon in tray for actions"), "TrayIconFlags", GC_EVENT_ACTION, 0 }, - { LPGENT("Show icon in tray for highlights"), "TrayIconFlags", GC_EVENT_HIGHLIGHT, 1 }, - { LPGENT("Show icon in tray for users leaving"), "TrayIconFlags", GC_EVENT_PART, 0 }, - { LPGENT("Show icon in tray for users kicking other user"), "TrayIconFlags", GC_EVENT_KICK, 0 }, - { LPGENT("Show icon in tray for notices"), "TrayIconFlags", GC_EVENT_NOTICE, 0 }, - { LPGENT("Show icon in tray for name changes"), "TrayIconFlags", GC_EVENT_NICK, 0 }, - { LPGENT("Show icon in tray for information messages"), "TrayIconFlags", GC_EVENT_INFORMATION, 0 }, - { LPGENT("Show icon in tray for status changes"), "TrayIconFlags", GC_EVENT_ADDSTATUS, 0 }, + { LPGENW("Show icons in tray only when the chat room is not active"), "TrayIconInactiveOnly", 0, 1 }, + { LPGENW("Show icon in tray for topic changes"), "TrayIconFlags", GC_EVENT_TOPIC, 0 }, + { LPGENW("Show icon in tray for users joining"), "TrayIconFlags", GC_EVENT_JOIN, 0 }, + { LPGENW("Show icon in tray for users disconnecting"), "TrayIconFlags", GC_EVENT_QUIT, 0 }, + { LPGENW("Show icon in tray for messages"), "TrayIconFlags", GC_EVENT_MESSAGE, 0 }, + { LPGENW("Show icon in tray for actions"), "TrayIconFlags", GC_EVENT_ACTION, 0 }, + { LPGENW("Show icon in tray for highlights"), "TrayIconFlags", GC_EVENT_HIGHLIGHT, 1 }, + { LPGENW("Show icon in tray for users leaving"), "TrayIconFlags", GC_EVENT_PART, 0 }, + { LPGENW("Show icon in tray for users kicking other user"), "TrayIconFlags", GC_EVENT_KICK, 0 }, + { LPGENW("Show icon in tray for notices"), "TrayIconFlags", GC_EVENT_NOTICE, 0 }, + { LPGENW("Show icon in tray for name changes"), "TrayIconFlags", GC_EVENT_NICK, 0 }, + { LPGENW("Show icon in tray for information messages"), "TrayIconFlags", GC_EVENT_INFORMATION, 0 }, + { LPGENW("Show icon in tray for status changes"), "TrayIconFlags", GC_EVENT_ADDSTATUS, 0 }, }; static const struct branch_t branch6[] = { - { LPGENT("Show popups only when the chat room is not active"), "PopupInactiveOnly", 0, 1 }, - { LPGENT("Show popup for topic changes"), "PopupFlags", GC_EVENT_TOPIC, 0 }, - { LPGENT("Show popup for users joining"), "PopupFlags", GC_EVENT_JOIN, 0 }, - { LPGENT("Show popup for users disconnecting"), "PopupFlags", GC_EVENT_QUIT, 0 }, - { LPGENT("Show popup for messages"), "PopupFlags", GC_EVENT_MESSAGE, 0 }, - { LPGENT("Show popup for actions"), "PopupFlags", GC_EVENT_ACTION, 0 }, - { LPGENT("Show popup for highlights"), "PopupFlags", GC_EVENT_HIGHLIGHT, 0 }, - { LPGENT("Show popup for users leaving"), "PopupFlags", GC_EVENT_PART, 0 }, - { LPGENT("Show popup for users kicking other user"), "PopupFlags", GC_EVENT_KICK, 0 }, - { LPGENT("Show popup for notices"), "PopupFlags", GC_EVENT_NOTICE, 0 }, - { LPGENT("Show popup for name changes"), "PopupFlags", GC_EVENT_NICK, 0 }, - { LPGENT("Show popup for information messages"), "PopupFlags", GC_EVENT_INFORMATION, 0 }, - { LPGENT("Show popup for status changes"), "PopupFlags", GC_EVENT_ADDSTATUS, 0 }, + { LPGENW("Show popups only when the chat room is not active"), "PopupInactiveOnly", 0, 1 }, + { LPGENW("Show popup for topic changes"), "PopupFlags", GC_EVENT_TOPIC, 0 }, + { LPGENW("Show popup for users joining"), "PopupFlags", GC_EVENT_JOIN, 0 }, + { LPGENW("Show popup for users disconnecting"), "PopupFlags", GC_EVENT_QUIT, 0 }, + { LPGENW("Show popup for messages"), "PopupFlags", GC_EVENT_MESSAGE, 0 }, + { LPGENW("Show popup for actions"), "PopupFlags", GC_EVENT_ACTION, 0 }, + { LPGENW("Show popup for highlights"), "PopupFlags", GC_EVENT_HIGHLIGHT, 0 }, + { LPGENW("Show popup for users leaving"), "PopupFlags", GC_EVENT_PART, 0 }, + { LPGENW("Show popup for users kicking other user"), "PopupFlags", GC_EVENT_KICK, 0 }, + { LPGENW("Show popup for notices"), "PopupFlags", GC_EVENT_NOTICE, 0 }, + { LPGENW("Show popup for name changes"), "PopupFlags", GC_EVENT_NICK, 0 }, + { LPGENW("Show popup for information messages"), "PopupFlags", GC_EVENT_INFORMATION, 0 }, + { LPGENW("Show popup for status changes"), "PopupFlags", GC_EVENT_ADDSTATUS, 0 }, }; HTREEITEM hItemB0[_countof(branch0)]; @@ -242,7 +242,7 @@ static void CheckBranches(HWND hwndTree, HTREEITEM hHeading) static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData) { - TCHAR szDir[MAX_PATH]; + wchar_t szDir[MAX_PATH]; switch (uMsg) { case BFFM_INITIALIZED: SendMessage(hwnd, BFFM_SETSELECTION, TRUE, pData); @@ -320,7 +320,7 @@ HANDLE GetIconHandle(const char *pszIcoLibName) return IcoLib_GetIconHandle(szTemp); } -static void InitSetting(TCHAR** ppPointer, char* pszSetting, TCHAR* pszDefault) +static void InitSetting(wchar_t** ppPointer, char* pszSetting, wchar_t* pszDefault) { DBVARIANT dbv; if (!db_get_ts(NULL, CHAT_MODULE, pszSetting, &dbv)) { @@ -484,13 +484,13 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, SendDlgItemMessage(hwndDlg, IDC_SPIN4, UDM_SETRANGE, 0, MAKELONG(255, 10)); SendDlgItemMessage(hwndDlg, IDC_SPIN4, UDM_SETPOS, 0, MAKELONG(db_get_b(NULL, CHAT_MODULE, "NicklistRowDist", 12), 0)); { - TCHAR* pszGroup = NULL; + wchar_t* pszGroup = NULL; InitSetting(&pszGroup, "AddToGroup", L"Chat rooms"); SetDlgItemText(hwndDlg, IDC_GROUP, pszGroup); mir_free(pszGroup); } { - TCHAR szTemp[MAX_PATH]; + wchar_t szTemp[MAX_PATH]; PathToRelativeT(g_Settings.pszLogDir, szTemp); SetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, szTemp); } @@ -529,8 +529,8 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, case IDC_FONTCHOOSE: { - TCHAR szDirectory[MAX_PATH]; - TCHAR szTemp[MAX_PATH]; + wchar_t szDirectory[MAX_PATH]; + wchar_t szTemp[MAX_PATH]; BROWSEINFO bi = { 0 }; bi.hwndOwner = hwndDlg; @@ -561,18 +561,18 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, case WM_NOTIFY: if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY) { - TCHAR * pszText = NULL; + wchar_t * pszText = NULL; int iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_HIGHLIGHTWORDS)); if (iLen > 0) { - TCHAR *ptszText = (TCHAR *)mir_alloc((iLen + 2) * sizeof(TCHAR)); - TCHAR *p2 = NULL; + wchar_t *ptszText = (wchar_t *)mir_alloc((iLen + 2) * sizeof(wchar_t)); + wchar_t *p2 = NULL; if (ptszText) { GetDlgItemText(hwndDlg, IDC_HIGHLIGHTWORDS, ptszText, iLen + 1); - p2 = _tcschr(ptszText, ','); + p2 = wcschr(ptszText, ','); while (p2) { *p2 = ' '; - p2 = _tcschr(ptszText, ','); + p2 = wcschr(ptszText, ','); } db_set_ts(NULL, CHAT_MODULE, "HighlightWords", ptszText); mir_free(ptszText); @@ -582,7 +582,7 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY)); if (iLen > 0) { - pszText = (TCHAR *)mir_realloc(pszText, (iLen + 1) * sizeof(TCHAR)); + pszText = (wchar_t *)mir_realloc(pszText, (iLen + 1) * sizeof(wchar_t)); GetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, pszText, iLen + 1); db_set_ts(NULL, CHAT_MODULE, "LogDirectory", pszText); } @@ -591,7 +591,7 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOGTIMESTAMP)); if (iLen > 0) { - pszText = (TCHAR *)mir_realloc(pszText, (iLen + 1) * sizeof(TCHAR)); + pszText = (wchar_t *)mir_realloc(pszText, (iLen + 1) * sizeof(wchar_t)); GetDlgItemText(hwndDlg, IDC_LOGTIMESTAMP, pszText, iLen + 1); db_set_ts(NULL, CHAT_MODULE, "LogTimestamp", pszText); } @@ -599,7 +599,7 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_TIMESTAMP)); if (iLen > 0) { - pszText = (TCHAR *)mir_realloc(pszText, (iLen + 1) * sizeof(TCHAR)); + pszText = (wchar_t *)mir_realloc(pszText, (iLen + 1) * sizeof(wchar_t)); GetDlgItemText(hwndDlg, IDC_TIMESTAMP, pszText, iLen + 1); db_set_ts(NULL, CHAT_MODULE, "HeaderTime", pszText); } @@ -607,7 +607,7 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_INSTAMP)); if (iLen > 0) { - pszText = (TCHAR *)mir_realloc(pszText, (iLen + 1) * sizeof(TCHAR)); + pszText = (wchar_t *)mir_realloc(pszText, (iLen + 1) * sizeof(wchar_t)); GetDlgItemText(hwndDlg, IDC_INSTAMP, pszText, iLen + 1); db_set_ts(NULL, CHAT_MODULE, "HeaderIncoming", pszText); } @@ -615,7 +615,7 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_OUTSTAMP)); if (iLen > 0) { - pszText = (TCHAR *)mir_realloc(pszText, (iLen + 1) * sizeof(TCHAR)); + pszText = (wchar_t *)mir_realloc(pszText, (iLen + 1) * sizeof(wchar_t)); GetDlgItemText(hwndDlg, IDC_OUTSTAMP, pszText, iLen + 1); db_set_ts(NULL, CHAT_MODULE, "HeaderOutgoing", pszText); } @@ -634,7 +634,7 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_GROUP)); if (iLen > 0) { - pszText = (TCHAR *)mir_realloc(pszText, (iLen + 1) * sizeof(TCHAR)); + pszText = (wchar_t *)mir_realloc(pszText, (iLen + 1) * sizeof(wchar_t)); GetDlgItemText(hwndDlg, IDC_GROUP, pszText, iLen + 1); db_set_ts(NULL, CHAT_MODULE, "AddToGroup", pszText); } diff --git a/src/core/stdchat/src/stdafx.h b/src/core/stdchat/src/stdafx.h index 5acc72626b..5e27b6b467 100644 --- a/src/core/stdchat/src/stdafx.h +++ b/src/core/stdchat/src/stdafx.h @@ -67,7 +67,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct TABLIST { - TCHAR *pszID; + wchar_t *pszID; char *pszModule; TABLIST *next; }; @@ -135,12 +135,12 @@ void LoadIcons(void); // log.c void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedraw, BOOL bPhaseTwo); -void ValidateFilename (TCHAR * filename); +void ValidateFilename (wchar_t * filename); char* Log_CreateRtfHeader(MODULEINFO * mi); // window.c INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam); -int GetTextPixelSize( TCHAR* pszText, HFONT hFont, BOOL bWidth); +int GetTextPixelSize( wchar_t* pszText, HFONT hFont, BOOL bWidth); SESSION_INFO* SM_GetPrevWindow(SESSION_INFO *si); SESSION_INFO* SM_GetNextWindow(SESSION_INFO *si); @@ -158,14 +158,14 @@ void ShowRoom(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground); int GetColorIndex(const char* pszModule, COLORREF cr); void CheckColorsInModule(const char* pszModule); int GetRichTextLength(HWND hwnd); -UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *si, TCHAR* pszUID, TCHAR* pszWordText); +UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *si, wchar_t* pszUID, wchar_t* pszWordText); void DestroyGCMenu(HMENU *hMenu, int iIndex); bool LoadMessageFont(LOGFONT *lf, COLORREF *colour); // message.c char* Message_GetFromStream(HWND hwndDlg, SESSION_INFO *si); -BOOL TabM_AddTab(const TCHAR *pszID, const char* pszModule); +BOOL TabM_AddTab(const wchar_t *pszID, const char* pszModule); BOOL TabM_RemoveAll(void); #pragma comment(lib,"comctl32.lib") diff --git a/src/core/stdchat/src/tools.cpp b/src/core/stdchat/src/tools.cpp index 56765958bd..12731649f2 100644 --- a/src/core/stdchat/src/tools.cpp +++ b/src/core/stdchat/src/tools.cpp @@ -109,7 +109,7 @@ void CheckColorsInModule(const char* pszModule) } } -UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *si, TCHAR* pszUID, TCHAR* pszWordText) +UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *si, wchar_t* pszUID, wchar_t* pszWordText) { HMENU hSubMenu = 0; *hMenu = GetSubMenu(g_hMenu, iIndex); @@ -134,7 +134,7 @@ UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO } if (pszWordText && pszWordText[0]) { - TCHAR szMenuText[4096]; + wchar_t szMenuText[4096]; mir_sntprintf(szMenuText, TranslateT("Look up '%s':"), pszWordText); ModifyMenu(*hMenu, 4, MF_STRING | MF_BYPOSITION, 4, szMenuText); } @@ -142,7 +142,7 @@ UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO gcmi.Type = MENU_ON_LOG; } else if (iIndex == 0) { - TCHAR szTemp[50]; + wchar_t szTemp[50]; if (pszWordText) mir_sntprintf(szTemp, TranslateT("&Message %s"), pszWordText); else @@ -160,7 +160,7 @@ UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO AppendMenu(*hMenu, MF_SEPARATOR, 0, 0); for (int i = 0; i < gcmi.nItems; i++) { - TCHAR* ptszText = TranslateTS(gcmi.Item[i].pszDesc); + wchar_t* ptszText = TranslateTS(gcmi.Item[i].pszDesc); DWORD dwState = gcmi.Item[i].bDisabled ? MF_GRAYED : 0; if (gcmi.Item[i].uType == MENU_NEWPOPUP) { @@ -199,12 +199,12 @@ void DestroyGCMenu(HMENU *hMenu, int iIndex) } } -void ValidateFilename(TCHAR *filename) +void ValidateFilename(wchar_t *filename) { - TCHAR *p1 = filename; - TCHAR szForbidden[] = L"\\/:*?\"<>|"; + wchar_t *p1 = filename; + wchar_t szForbidden[] = L"\\/:*?\"<>|"; while (*p1 != '\0') { - if (_tcschr(szForbidden, *p1)) + if (wcschr(szForbidden, *p1)) *p1 = '_'; p1 += 1; } diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp index 7fdbf8f562..bf71ea9f90 100644 --- a/src/core/stdchat/src/window.cpp +++ b/src/core/stdchat/src/window.cpp @@ -27,10 +27,10 @@ static HKL hkl = NULL; struct MESSAGESUBDATA { time_t lastEnterTime; - TCHAR szTabSave[20]; + wchar_t szTabSave[20]; }; -static TCHAR szTrimString[] = L":;,.!?\'\"><()[]- \r\n"; +static wchar_t szTrimString[] = L":;,.!?\'\"><()[]- \r\n"; static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { @@ -363,7 +363,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, SendMessage(GetParent(hwnd), GC_SWITCHTAB, 0, (int)wParam - (int)VK_NUMPAD1); if (wParam == VK_TAB && !isCtrl && !isShift) { //tab-autocomplete - TCHAR* pszText = NULL; + wchar_t* pszText = NULL; LRESULT lResult = (LRESULT)SendMessage(hwnd, EM_GETSEL, 0, 0); SendMessage(hwnd, WM_SETREDRAW, FALSE, 0); @@ -376,7 +376,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, gtl.codepage = CP_ACP; int iLen = SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)>l, 0); if (iLen > 0) { - pszText = (TCHAR *)mir_alloc(sizeof(TCHAR)*(iLen + 100)); + pszText = (wchar_t *)mir_alloc(sizeof(wchar_t)*(iLen + 100)); GETTEXTEX gt = { 0 }; gt.cb = iLen + 99; @@ -392,10 +392,10 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, if (dat->szTabSave[0] == '\0') mir_tstrncpy(dat->szTabSave, pszText + start, end - start + 1); - TCHAR *pszSelName = (TCHAR *)mir_alloc(sizeof(TCHAR)*(end - start + 1)); + wchar_t *pszSelName = (wchar_t *)mir_alloc(sizeof(wchar_t)*(end - start + 1)); mir_tstrncpy(pszSelName, pszText + start, end - start + 1); - TCHAR *pszName = pci->UM_FindUserAutoComplete(Parentsi->pUsers, dat->szTabSave, pszSelName); + wchar_t *pszName = pci->UM_FindUserAutoComplete(Parentsi->pUsers, dat->szTabSave, pszSelName); if (pszName == NULL) { pszName = dat->szTabSave; SendMessage(hwnd, EM_SETSEL, start, end); @@ -984,13 +984,13 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, SESSION_INFO *si ti.uId = 1; ti.rect = clientRect; - TCHAR tszBuf[1024]; tszBuf[0] = 0; + wchar_t tszBuf[1024]; tszBuf[0] = 0; USERINFO *ui = pci->SM_GetUserFromIndex(si->ptszID, si->pszModule, currentHovered); if (ui) { if (ProtoServiceExists(si->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT)) { - TCHAR *p = (TCHAR*)CallProtoService(si->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT, (WPARAM)si->ptszID, (LPARAM)ui->pszUID); + wchar_t *p = (wchar_t*)CallProtoService(si->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT, (WPARAM)si->ptszID, (LPARAM)ui->pszUID); if (p != NULL) { - _tcsncpy_s(tszBuf, p, _TRUNCATE); + wcsncpy_s(tszBuf, p, _TRUNCATE); mir_free(p); } } @@ -1170,7 +1170,7 @@ static int RestoreWindowPosition(HWND hwnd, MCONTACT hContact, char * szModule, return 1; } -int GetTextPixelSize(TCHAR* pszText, HFONT hFont, BOOL bWidth) +int GetTextPixelSize(wchar_t* pszText, HFONT hFont, BOOL bWidth) { if (!pszText || !hFont) return 0; @@ -1220,7 +1220,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar SendDlgItemMessage(hwndDlg, IDC_LOG, EM_AUTOURLDETECT, 1, 0); int mask = (int)SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETEVENTMASK, 0, 0); SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETEVENTMASK, 0, mask | ENM_LINK | ENM_MOUSEEVENTS); - SendDlgItemMessage(hwndDlg, IDC_LOG, EM_LIMITTEXT, (WPARAM)sizeof(TCHAR) * 0x7FFFFFFF, 0); + SendDlgItemMessage(hwndDlg, IDC_LOG, EM_LIMITTEXT, (WPARAM)sizeof(wchar_t) * 0x7FFFFFFF, 0); SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETOLECALLBACK, 0, (LPARAM)& reOleCallback); si->hwndStatus = CreateWindowEx(0, STATUSCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP | SBT_TOOLTIPS, 0, 0, 0, 0, hwndDlg, NULL, g_hInst, NULL); @@ -1311,7 +1311,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar case GC_UPDATETITLE: { - TCHAR szTemp[100]; + wchar_t szTemp[100]; switch (si->iType) { case GCW_CHATROOM: mir_sntprintf(szTemp, @@ -1334,7 +1334,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar case GC_UPDATESTATUSBAR: { MODULEINFO *mi = pci->MM_FindModule(si->pszModule); - TCHAR* ptszDispName = mi->ptszModDispName; + wchar_t* ptszDispName = mi->ptszModDispName; int x = 12; x += GetTextPixelSize(ptszDispName, (HFONT)SendMessage(si->hwndStatus, WM_GETFONT, 0, 0), TRUE); x += GetSystemMetrics(SM_CXSMICON); @@ -1603,7 +1603,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (!bFound) { // create a new tab int insertat; - TCHAR szTemp[30]; + wchar_t szTemp[30]; mir_tstrncpy(szTemp, s1->ptszName, 21); if (mir_tstrlen(s1->ptszName) > 20) @@ -2170,7 +2170,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar POINT pt; UINT uID = 0; HMENU hMenu = 0; - TCHAR pszWord[4096]; + wchar_t pszWord[4096]; pt.x = (short)LOWORD(((ENLINK *)lParam)->lParam); pt.y = (short)HIWORD(((ENLINK *)lParam)->lParam); @@ -2199,7 +2199,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar tr.lpstrText = pszWord; long iRes = SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETTEXTRANGE, 0, (LPARAM)&tr); if (iRes > 0) - for (size_t iLen = mir_tstrlen(pszWord) - 1; _tcschr(szTrimString, pszWord[iLen]); iLen--) + for (size_t iLen = mir_tstrlen(pszWord) - 1; wcschr(szTrimString, pszWord[iLen]); iLen--) pszWord[iLen] = 0; } @@ -2271,7 +2271,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar TEXTRANGE tr; tr.chrg = ((ENLINK *)lParam)->chrg; - tr.lpstrText = (LPTSTR)mir_alloc(sizeof(TCHAR)*(tr.chrg.cpMax - tr.chrg.cpMin + 1)); + tr.lpstrText = (LPTSTR)mir_alloc(sizeof(wchar_t)*(tr.chrg.cpMax - tr.chrg.cpMin + 1)); SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_GETTEXTRANGE, 0, (LPARAM)&tr); if (((ENLINK *)lParam)->msg == WM_RBUTTONDOWN) { @@ -2298,8 +2298,8 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (!OpenClipboard(hwndDlg)) break; EmptyClipboard(); - hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR)*(mir_tstrlen(tr.lpstrText) + 1)); - mir_tstrcpy((TCHAR*)GlobalLock(hData), tr.lpstrText); + hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t)*(mir_tstrlen(tr.lpstrText) + 1)); + mir_tstrcpy((wchar_t*)GlobalLock(hData), tr.lpstrText); GlobalUnlock(hData); SetClipboardData(CF_UNICODETEXT, hData); CloseClipboard(); @@ -2330,7 +2330,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar int item = LOWORD(SendDlgItemMessage(hwndDlg, IDC_LIST, LB_ITEMFROMPOINT, 0, MAKELPARAM(p.x, p.y))); USERINFO *ui = pci->SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, item); if (ui != NULL) { - static TCHAR ptszBuf[1024]; + static wchar_t ptszBuf[1024]; mir_sntprintf(ptszBuf, L"%s: %s\r\n%s: %s\r\n%s: %s", TranslateT("Nickname"), ui->pszNick, TranslateT("Unique ID"), ui->pszUID, @@ -2357,7 +2357,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar LRESULT lResult = (LRESULT)SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETSEL, 0, 0); int start = LOWORD(lResult); size_t dwNameLenMax = (mir_tstrlen(ui->pszUID) + 3); - TCHAR* pszName = (TCHAR*)alloca(sizeof(TCHAR) * dwNameLenMax); + wchar_t* pszName = (wchar_t*)alloca(sizeof(wchar_t) * dwNameLenMax); if (start == 0) mir_sntprintf(pszName, dwNameLenMax, L"%s: ", ui->pszUID); else @@ -2446,8 +2446,8 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_HISTORY))) { MODULEINFO *pInfo = pci->MM_FindModule(si->pszModule); if (pInfo) { - TCHAR szFile[MAX_PATH], szName[MAX_PATH], szFolder[MAX_PATH]; - _tcsncpy_s(szName, (pInfo->ptszModDispName ? pInfo->ptszModDispName : _A2T(si->pszModule)), _TRUNCATE); + wchar_t szFile[MAX_PATH], szName[MAX_PATH], szFolder[MAX_PATH]; + wcsncpy_s(szName, (pInfo->ptszModDispName ? pInfo->ptszModDispName : _A2T(si->pszModule)), _TRUNCATE); ValidateFilename(szName); mir_sntprintf(szFolder, L"%s\\%s", g_Settings.pszLogDir, szName); diff --git a/src/core/stdclist/src/clcfonts.cpp b/src/core/stdclist/src/clcfonts.cpp index 79150a51f4..74c09a7278 100644 --- a/src/core/stdclist/src/clcfonts.cpp +++ b/src/core/stdclist/src/clcfonts.cpp @@ -28,19 +28,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct { - const TCHAR *tszName; + const wchar_t *tszName; int iMask; } static clistFontDescr[] = { - { LPGENT("Standard contacts"), FIDF_CLASSGENERAL }, - { LPGENT("Online contacts to whom you have a different visibility"), FIDF_CLASSGENERAL }, - { LPGENT("Offline contacts"), FIDF_CLASSGENERAL }, - { LPGENT("Contacts which are 'not on list'"), FIDF_CLASSGENERAL }, - { LPGENT("Groups"), FIDF_CLASSHEADER }, - { LPGENT("Group member counts"), FIDF_CLASSHEADER }, - { LPGENT("Dividers"), FIDF_CLASSSMALL }, - { LPGENT("Offline contacts to whom you have a different visibility"), FIDF_CLASSGENERAL } + { LPGENW("Standard contacts"), FIDF_CLASSGENERAL }, + { LPGENW("Online contacts to whom you have a different visibility"), FIDF_CLASSGENERAL }, + { LPGENW("Offline contacts"), FIDF_CLASSGENERAL }, + { LPGENW("Contacts which are 'not on list'"), FIDF_CLASSGENERAL }, + { LPGENW("Groups"), FIDF_CLASSHEADER }, + { LPGENW("Group member counts"), FIDF_CLASSHEADER }, + { LPGENW("Dividers"), FIDF_CLASSSMALL }, + { LPGENW("Offline contacts to whom you have a different visibility"), FIDF_CLASSGENERAL } }; static int FS_FontsChanged(WPARAM, LPARAM) @@ -54,7 +54,7 @@ void RegisterCListFonts() FontIDT fontid = { sizeof(fontid) }; fontid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWREREGISTER | FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS; strncpy(fontid.dbSettingsGroup, "CLC", sizeof(fontid.dbSettingsGroup)); - _tcsncpy(fontid.group, LPGENT("Contact list"), _countof(fontid.group)); + wcsncpy(fontid.group, LPGENW("Contact list"), _countof(fontid.group)); HDC hdc = GetDC(NULL); for (int i = 0; i < _countof(clistFontDescr); i++) { @@ -62,7 +62,7 @@ void RegisterCListFonts() pcli->pfnGetFontSetting(i, &lf, &fontid.deffontsettings.colour); lf.lfHeight = -MulDiv(lf.lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72); - _tcsncpy_s(fontid.deffontsettings.szFace, lf.lfFaceName, _TRUNCATE); + wcsncpy_s(fontid.deffontsettings.szFace, lf.lfFaceName, _TRUNCATE); fontid.deffontsettings.charset = lf.lfCharSet; fontid.deffontsettings.size = (char)lf.lfHeight; fontid.deffontsettings.style = (lf.lfWeight >= FW_BOLD ? DBFONTF_BOLD : 0) | (lf.lfItalic ? DBFONTF_ITALIC : 0); @@ -70,7 +70,7 @@ void RegisterCListFonts() fontid.flags &= ~FIDF_CLASSMASK; fontid.flags |= clistFontDescr[i].iMask; - _tcsncpy(fontid.name, clistFontDescr[i].tszName, _countof(fontid.name)); + wcsncpy(fontid.name, clistFontDescr[i].tszName, _countof(fontid.name)); char idstr[10]; mir_snprintf(idstr, "Font%d", i); @@ -87,25 +87,25 @@ void RegisterCListFonts() strncpy(colourid.dbSettingsGroup, "CLC", sizeof(colourid.dbSettingsGroup)); strncpy(colourid.setting, "BkColour", sizeof(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Background"), _countof(colourid.name)); - _tcsncpy(colourid.group, LPGENT("Contact list"), _countof(colourid.group)); + wcsncpy(colourid.name, LPGENW("Background"), _countof(colourid.name)); + wcsncpy(colourid.group, LPGENW("Contact list"), _countof(colourid.group)); colourid.defcolour = CLCDEFAULT_BKCOLOUR; ColourRegisterT(&colourid); strncpy(colourid.setting, "SelTextColour", sizeof(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Selected text"), _countof(colourid.name)); + wcsncpy(colourid.name, LPGENW("Selected text"), _countof(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_SELTEXTCOLOUR; ColourRegisterT(&colourid); strncpy(colourid.setting, "HotTextColour", sizeof(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Hottrack text"), _countof(colourid.name)); + wcsncpy(colourid.name, LPGENW("Hottrack text"), _countof(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_HOTTEXTCOLOUR; ColourRegisterT(&colourid); strncpy(colourid.setting, "QuickSearchColour", sizeof(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Quicksearch text"), _countof(colourid.name)); + wcsncpy(colourid.name, LPGENW("Quicksearch text"), _countof(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_QUICKSEARCHCOLOUR; ColourRegisterT(&colourid); diff --git a/src/core/stdclist/src/clcopts.cpp b/src/core/stdclist/src/clcopts.cpp index ef529785e9..53d42c65c3 100644 --- a/src/core/stdclist/src/clcopts.cpp +++ b/src/core/stdclist/src/clcopts.cpp @@ -54,36 +54,36 @@ 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) @@ -340,7 +340,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case WM_COMMAND: if (LOWORD(wParam) == IDC_BROWSE) { - TCHAR str[MAX_PATH], filter[512]; + wchar_t str[MAX_PATH], filter[512]; GetDlgItemText(hwndDlg, IDC_FILENAME, str, _countof(str)); OPENFILENAME ofn = { 0 }; @@ -459,7 +459,7 @@ int ClcModernOptInit(WPARAM wParam, LPARAM) obj.hInstance = g_hInst; obj.iSection = MODERNOPT_PAGE_SKINS; obj.iType = MODERNOPT_TYPE_SUBSECTIONPAGE; - obj.lptzSubsection = LPGENT("Contact list"); + obj.lptzSubsection = LPGENW("Contact list"); obj.iBoldControls = iBoldControls; obj.lpzHelpUrl = "http://wiki.miranda-ng.org/"; diff --git a/src/core/stdclist/src/clcpaint.cpp b/src/core/stdclist/src/clcpaint.cpp index 3360176522..cb679abd0e 100644 --- a/src/core/stdclist/src/clcpaint.cpp +++ b/src/core/stdclist/src/clcpaint.cpp @@ -316,7 +316,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) GetTextExtentPoint32(hdcMem, cc->szText, (int)mir_tstrlen(cc->szText), &textSize); width = textSize.cx; - TCHAR *ptszGroupCount = NULL; + wchar_t *ptszGroupCount = NULL; if (cc->type == CLCIT_GROUP) { ptszGroupCount = pcli->pfnGetGroupCountsText(dat, cc); if (*ptszGroupCount) { diff --git a/src/core/stdclist/src/cluiopts.cpp b/src/core/stdclist/src/cluiopts.cpp index 00f163105c..fdd473a268 100644 --- a/src/core/stdclist/src/cluiopts.cpp +++ b/src/core/stdclist/src/cluiopts.cpp @@ -170,7 +170,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/src/core/stdclist/src/contact.cpp b/src/core/stdclist/src/contact.cpp index 5e4e5634e2..359419faa3 100644 --- a/src/core/stdclist/src/contact.cpp +++ b/src/core/stdclist/src/contact.cpp @@ -24,37 +24,37 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -int g_bSortByStatus, g_bSortByProto; +int g_bSortByStatus, g_bSortByProto; -const struct -{ - int status, order; -} -static statusModeOrder[] = { - { ID_STATUS_OFFLINE, 500 }, - { ID_STATUS_ONLINE, 10 }, - { ID_STATUS_AWAY, 200 }, - { ID_STATUS_DND, 110 }, - { ID_STATUS_NA, 450 }, - { ID_STATUS_OCCUPIED, 100 }, - { ID_STATUS_FREECHAT, 0 }, - { ID_STATUS_INVISIBLE, 20 }, - { ID_STATUS_ONTHEPHONE, 150 }, - { ID_STATUS_OUTTOLUNCH, 425 } }; +const struct +{ + int status, order; +} +static statusModeOrder[] = { + { ID_STATUS_OFFLINE, 500 }, + { ID_STATUS_ONLINE, 10 }, + { ID_STATUS_AWAY, 200 }, + { ID_STATUS_DND, 110 }, + { ID_STATUS_NA, 450 }, + { ID_STATUS_OCCUPIED, 100 }, + { ID_STATUS_FREECHAT, 0 }, + { ID_STATUS_INVISIBLE, 20 }, + { ID_STATUS_ONTHEPHONE, 150 }, + { ID_STATUS_OUTTOLUNCH, 425 } }; -int GetStatusModeOrdering(int statusMode) -{ - int i; - for (i = 0; i < _countof(statusModeOrder); i++) - if (statusModeOrder[i].status == statusMode) - return statusModeOrder[i].order; - return 1000; -} +int GetStatusModeOrdering(int statusMode) +{ + int i; + for (i = 0; i < _countof(statusModeOrder); i++) + if (statusModeOrder[i].status == statusMode) + return statusModeOrder[i].order; + return 1000; +} int CompareContacts(const ClcContact* c1, const ClcContact* c2) { MCONTACT a = c1->hContact, b = c2->hContact; - TCHAR namea[128], *nameb; + wchar_t namea[128], *nameb; int statusa, statusb; int rc; @@ -88,7 +88,7 @@ int CompareContacts(const ClcContact* c1, const ClcContact* c2) } nameb = pcli->pfnGetContactDisplayName(a, 0); - _tcsncpy_s(namea, nameb, _TRUNCATE); + wcsncpy_s(namea, nameb, _TRUNCATE); namea[ _countof(namea)-1 ] = 0; nameb = pcli->pfnGetContactDisplayName(b, 0); diff --git a/src/core/stdcrypt/src/stdafx.h b/src/core/stdcrypt/src/stdafx.h index c6d1bd40d8..a0634867ca 100644 --- a/src/core/stdcrypt/src/stdafx.h +++ b/src/core/stdcrypt/src/stdafx.h @@ -22,7 +22,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include #include #include #include diff --git a/src/core/stdemail/src/stdafx.h b/src/core/stdemail/src/stdafx.h index a4873dbf7f..fbb040c50b 100644 --- a/src/core/stdemail/src/stdafx.h +++ b/src/core/stdemail/src/stdafx.h @@ -22,7 +22,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include #include #include #include diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp index a9f28f51d9..1886a29f1a 100644 --- a/src/core/stdfile/src/file.cpp +++ b/src/core/stdfile/src/file.cpp @@ -27,16 +27,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HANDLE hDlgSucceeded, hDlgCanceled; -TCHAR* PFTS_StringToTchar(int flags, const TCHAR* s); -int PFTS_CompareWithTchar(PROTOFILETRANSFERSTATUS* ft, const TCHAR* s, TCHAR *r); +wchar_t* PFTS_StringToTchar(int flags, const wchar_t* s); +int PFTS_CompareWithTchar(PROTOFILETRANSFERSTATUS* ft, const wchar_t* s, wchar_t *r); static HGENMENU hSRFileMenuItem; -TCHAR* GetContactID(MCONTACT hContact) +wchar_t* GetContactID(MCONTACT hContact) { char *szProto = GetContactProto(hContact); if (db_get_b(hContact, szProto, "ChatRoom", 0) == 1) - if (TCHAR *theValue = db_get_tsa(hContact, szProto, "ChatRoomID")) + if (wchar_t *theValue = db_get_tsa(hContact, szProto, "ChatRoomID")) return theValue; return Contact_GetInfo(CNF_UNIQUEID, hContact, szProto); @@ -60,7 +60,7 @@ static INT_PTR SendSpecificFiles(WPARAM hContact, LPARAM lParam) while (ppFiles[count] != NULL) count++; - fsd.ppFiles = (const TCHAR**)alloca((count + 1) * sizeof(void*)); + fsd.ppFiles = (const wchar_t**)alloca((count + 1) * sizeof(void*)); for (int i = 0; i < count; i++) fsd.ppFiles[i] = mir_a2t(ppFiles[i]); fsd.ppFiles[count] = NULL; @@ -75,13 +75,13 @@ static INT_PTR SendSpecificFilesT(WPARAM hContact, LPARAM lParam) { FileSendData fsd; fsd.hContact = hContact; - fsd.ppFiles = (const TCHAR**)lParam; + fsd.ppFiles = (const wchar_t**)lParam; return (INT_PTR)CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd); } static INT_PTR GetReceivedFilesFolder(WPARAM wParam, LPARAM lParam) { - TCHAR buf[MAX_PATH]; + wchar_t buf[MAX_PATH]; GetContactReceivedFilesDir(wParam, buf, MAX_PATH, TRUE); char* dir = mir_t2a(buf); mir_strncpy((char*)lParam, dir, MAX_PATH); @@ -107,7 +107,7 @@ void PushFileEvent(MCONTACT hContact, MEVENT hdbe, LPARAM lParam) else { SkinPlaySound("RecvFile"); - TCHAR szTooltip[256]; + wchar_t szTooltip[256]; mir_sntprintf(szTooltip, TranslateT("File from %s"), pcli->pfnGetContactDisplayName(hContact, 0)); cle.ptszTooltip = szTooltip; @@ -133,7 +133,7 @@ static int FileEventAdded(WPARAM wParam, LPARAM lParam) return 0; } -int SRFile_GetRegValue(HKEY hKeyBase, const TCHAR *szSubKey, const TCHAR *szValue, TCHAR *szOutput, int cbOutput) +int SRFile_GetRegValue(HKEY hKeyBase, const wchar_t *szSubKey, const wchar_t *szValue, wchar_t *szOutput, int cbOutput) { HKEY hKey; DWORD cbOut = cbOutput; @@ -150,7 +150,7 @@ int SRFile_GetRegValue(HKEY hKeyBase, const TCHAR *szSubKey, const TCHAR *szValu return 1; } -void GetSensiblyFormattedSize(__int64 size, TCHAR *szOut, int cchOut, int unitsOverride, int appendUnits, int *unitsUsed) +void GetSensiblyFormattedSize(__int64 size, wchar_t *szOut, int cchOut, int unitsOverride, int appendUnits, int *unitsUsed) { if (!unitsOverride) { if (size < 1000) unitsOverride = UNITS_BYTES; @@ -173,13 +173,13 @@ void GetSensiblyFormattedSize(__int64 size, TCHAR *szOut, int cchOut, int unitsO } // Tripple redirection sucks but is needed to nullify the array pointer -void FreeFilesMatrix(TCHAR ***files) +void FreeFilesMatrix(wchar_t ***files) { if (*files == NULL) return; // Free each filename in the pointer array - TCHAR **pFile = *files; + wchar_t **pFile = *files; while (*pFile != NULL) { mir_free(*pFile); *pFile = NULL; @@ -206,7 +206,7 @@ void CopyProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANSFE *dest = *src; if (src->tszCurrentFile) dest->tszCurrentFile = PFTS_StringToTchar(src->flags, src->tszCurrentFile); if (src->ptszFiles) { - dest->ptszFiles = (TCHAR**)mir_alloc(sizeof(TCHAR*)*src->totalFiles); + dest->ptszFiles = (wchar_t**)mir_alloc(sizeof(wchar_t*)*src->totalFiles); for (int i = 0; i < src->totalFiles; i++) dest->ptszFiles[i] = PFTS_StringToTchar(src->flags, src->ptszFiles[i]); } @@ -227,7 +227,7 @@ void UpdateProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANS } if (src->ptszFiles) { if (!dest->ptszFiles) - dest->ptszFiles = (TCHAR**)mir_calloc(sizeof(TCHAR*)*src->totalFiles); + dest->ptszFiles = (wchar_t**)mir_calloc(sizeof(wchar_t*)*src->totalFiles); for (int i = 0; i < src->totalFiles; i++) if (!dest->ptszFiles[i] || !src->ptszFiles[i] || PFTS_CompareWithTchar(src, src->ptszFiles[i], dest->ptszFiles[i])) { mir_free(dest->ptszFiles[i]); @@ -336,7 +336,7 @@ INT_PTR FtMgrShowCommand(WPARAM, LPARAM) INT_PTR openContRecDir(WPARAM hContact, LPARAM) { - TCHAR szContRecDir[MAX_PATH]; + wchar_t szContRecDir[MAX_PATH]; GetContactReceivedFilesDir(hContact, szContRecDir, _countof(szContRecDir), TRUE); ShellExecute(0, L"open", szContRecDir, 0, 0, SW_SHOW); return 0; @@ -344,7 +344,7 @@ INT_PTR openContRecDir(WPARAM hContact, LPARAM) INT_PTR openRecDir(WPARAM, LPARAM) { - TCHAR szContRecDir[MAX_PATH]; + wchar_t szContRecDir[MAX_PATH]; GetReceivedFilesDir(szContRecDir, _countof(szContRecDir)); ShellExecute(0, L"open", szContRecDir, 0, 0, SW_SHOW); return 0; @@ -373,9 +373,9 @@ static INT_PTR Proto_RecvFileT(WPARAM, LPARAM lParam) if (bUnicode) { pszFiles = (char**)alloca(pre->fileCount * sizeof(char*)); for (int i = 0; i < pre->fileCount; i++) - pszFiles[i] = Utf8EncodeT(pre->files.t[i]); + pszFiles[i] = Utf8EncodeT(pre->files.w[i]); - szDescr = Utf8EncodeT(pre->descr.t); + szDescr = Utf8EncodeT(pre->descr.w); } else { pszFiles = pre->files.a; diff --git a/src/core/stdfile/src/file.h b/src/core/stdfile/src/file.h index d279789ddd..a41d169fae 100644 --- a/src/core/stdfile/src/file.h +++ b/src/core/stdfile/src/file.h @@ -40,7 +40,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct FileSendData { MCONTACT hContact; - const TCHAR **ppFiles; + const wchar_t **ppFiles; }; #define BYTESRECVEDHISTORYCOUNT 10 //the number of bytes recved is sampled once a second and the last 10 are used to get the transfer speed @@ -51,7 +51,7 @@ struct FileDlgData MCONTACT hContact; MEVENT hDbEvent; HANDLE hNotifyEvent; - TCHAR **files; + wchar_t **files; int send; int closeIfFileChooseCancelled; int resumeBehaviour; @@ -63,8 +63,8 @@ struct FileDlgData HANDLE hPreshutdownEvent; DWORD dwTicks; - TCHAR szSavePath[MAX_PATH]; - TCHAR szMsg[450], szFilenames[1024]; + wchar_t szSavePath[MAX_PATH]; + wchar_t szMsg[450], szFilenames[1024]; HICON hIcon, hIconFolder; }; @@ -75,21 +75,21 @@ struct FileDlgData #define UNITS_MBPOINT2 4 // 1024*1024 <= size: "%.2f MB" #define UNITS_GBPOINT3 5 // 1024*1024*1024 <= size: "%.3f GB" -void GetSensiblyFormattedSize(__int64 size, TCHAR *szOut, int cchOut, int unitsOverride, int appendUnits, int *unitsUsed); -void FreeFilesMatrix(TCHAR ***files); //loving that triple indirection +void GetSensiblyFormattedSize(__int64 size, wchar_t *szOut, int cchOut, int unitsOverride, int appendUnits, int *unitsUsed); +void FreeFilesMatrix(wchar_t ***files); //loving that triple indirection void FreeProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *fts); void CopyProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANSFERSTATUS *src); void UpdateProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANSFERSTATUS *src); -int SRFile_GetRegValue(HKEY hKeyBase, const TCHAR *szSubKey, const TCHAR *szValue, TCHAR *szOutput, int cbOutput); +int SRFile_GetRegValue(HKEY hKeyBase, const wchar_t *szSubKey, const wchar_t *szValue, wchar_t *szOutput, int cbOutput); //filesenddlg.c INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); //filerecv.c INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -void RemoveInvalidFilenameChars(TCHAR *tszString); -void RemoveInvalidPathChars(TCHAR *tszString); -void GetContactReceivedFilesDir(MCONTACT hContact, TCHAR *szDir, int cchDir, BOOL substVars); -void GetReceivedFilesDir(TCHAR *szDir, int cchDir); -int BrowseForFolder(HWND hwnd, TCHAR *szPath); +void RemoveInvalidFilenameChars(wchar_t *tszString); +void RemoveInvalidPathChars(wchar_t *tszString); +void GetContactReceivedFilesDir(MCONTACT hContact, wchar_t *szDir, int cchDir, BOOL substVars); +void GetReceivedFilesDir(wchar_t *szDir, int cchDir); +int BrowseForFolder(HWND hwnd, wchar_t *szPath); //fileexistsdlg.c struct TDlgProcFileExistsParam { @@ -117,6 +117,6 @@ HWND FtMgr_AddTransfer(FileDlgData *dat); void FreeFileDlgData(FileDlgData* dat); -TCHAR *GetContactID(MCONTACT hContact); +wchar_t *GetContactID(MCONTACT hContact); extern HANDLE hDlgSucceeded, hDlgCanceled; diff --git a/src/core/stdfile/src/fileexistsdlg.cpp b/src/core/stdfile/src/fileexistsdlg.cpp index a5243ee528..d0650fec8d 100644 --- a/src/core/stdfile/src/fileexistsdlg.cpp +++ b/src/core/stdfile/src/fileexistsdlg.cpp @@ -47,7 +47,7 @@ static void SetControlToUnixTime(HWND hwndDlg, UINT idCtrl, time_t unixTime) #ifndef CMF_EXTENDEDVERBS #define CMF_EXTENDEDVERBS 0x00000100 #endif -static void DoAnnoyingShellCommand(HWND hwnd, const TCHAR *szFilename, int cmd, POINT *ptCursor) +static void DoAnnoyingShellCommand(HWND hwnd, const wchar_t *szFilename, int cmd, POINT *ptCursor) { IShellFolder *pDesktopFolder; if (SHGetDesktopFolder(&pDesktopFolder) == NOERROR) { @@ -132,7 +132,7 @@ static LRESULT CALLBACK IconCtrlSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, struct loadiconsstartinfo { HWND hwndDlg; - TCHAR *szFilename; + wchar_t *szFilename; }; void __cdecl LoadIconsAndTypesThread(void* param) @@ -141,13 +141,13 @@ void __cdecl LoadIconsAndTypesThread(void* param) SHFILEINFO fileInfo; if (SHGetFileInfo(info->szFilename, 0, &fileInfo, sizeof(fileInfo), SHGFI_TYPENAME | SHGFI_ICON | SHGFI_LARGEICON)) { - TCHAR szExtension[64], szIconFile[MAX_PATH]; + wchar_t szExtension[64], szIconFile[MAX_PATH]; - TCHAR *pszFilename = _tcsrchr(info->szFilename, '\\'); + wchar_t *pszFilename = wcsrchr(info->szFilename, '\\'); if (pszFilename == NULL) pszFilename = info->szFilename; - TCHAR *pszExtension = _tcsrchr(pszFilename, '.'); + wchar_t *pszExtension = wcsrchr(pszFilename, '.'); if (pszExtension) mir_tstrncpy(szExtension, pszExtension + 1, _countof(szExtension)); else { @@ -164,11 +164,11 @@ void __cdecl LoadIconsAndTypesThread(void* param) if (!mir_tstrcmp(szExtension, L"EXE")) SRFile_GetRegValue(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Icons", L"2", szIconFile, _countof(szIconFile)); else { - TCHAR szTypeName[MAX_PATH]; + wchar_t szTypeName[MAX_PATH]; if (SRFile_GetRegValue(HKEY_CLASSES_ROOT, pszExtension, NULL, szTypeName, _countof(szTypeName))) { mir_tstrcat(szTypeName, L"\\DefaultIcon"); if (SRFile_GetRegValue(HKEY_CLASSES_ROOT, szTypeName, NULL, szIconFile, _countof(szIconFile))) { - if (_tcsstr(szIconFile, L"%1")) + if (wcsstr(szIconFile, L"%1")) SRFile_GetRegValue(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Icons", L"0", szIconFile, _countof(szIconFile)); else szIconFile[0] = '\0'; } @@ -176,10 +176,10 @@ void __cdecl LoadIconsAndTypesThread(void* param) } if (szIconFile[0]) { - TCHAR *pszComma = _tcsrchr(szIconFile, ','); + wchar_t *pszComma = wcsrchr(szIconFile, ','); int iconIndex; if (pszComma) { - iconIndex = _ttoi(pszComma + 1); + iconIndex = _wtoi(pszComma + 1); *pszComma = '\0'; } else @@ -201,7 +201,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); { - TCHAR szSize[64]; + wchar_t szSize[64]; struct _stati64 statbuf; struct TDlgProcFileExistsParam *dat = (struct TDlgProcFileExistsParam *)lParam; @@ -219,7 +219,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM mir_subclassWindow(GetDlgItem(hwndDlg, IDC_EXISTINGICON), IconCtrlSubclassProc); HWND hwndFocus = GetDlgItem(hwndDlg, IDC_RESUME); - if (_tstati64(fts->tszCurrentFile, &statbuf) == 0) { + if (_wstat64(fts->tszCurrentFile, &statbuf) == 0) { SetControlToUnixTime(hwndDlg, IDC_EXISTINGDATE, statbuf.st_mtime); GetSensiblyFormattedSize(statbuf.st_size, szSize, _countof(szSize), 0, 1, NULL); SetDlgItemText(hwndDlg, IDC_EXISTINGSIZE, szSize); @@ -249,9 +249,9 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case IDC_OPENFOLDER: { - TCHAR szFile[MAX_PATH]; + wchar_t szFile[MAX_PATH]; mir_tstrncpy(szFile, fts->tszCurrentFile, _countof(szFile)); - TCHAR *pszLastBackslash = _tcsrchr(szFile, '\\'); + wchar_t *pszLastBackslash = wcsrchr(szFile, '\\'); if (pszLastBackslash) *pszLastBackslash = '\0'; ShellExecute(hwndDlg, NULL, szFile, NULL, NULL, SW_SHOW); @@ -280,14 +280,14 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case IDC_SAVEAS: { OPENFILENAME ofn = { 0 }; - TCHAR filter[512], *pfilter; - TCHAR str[MAX_PATH]; + wchar_t filter[512], *pfilter; + wchar_t str[MAX_PATH]; mir_tstrncpy(str, fts->tszCurrentFile, _countof(str)); ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; ofn.hwndOwner = hwndDlg; ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY; - _tcsncpy(filter, TranslateT("All files"),_countof(filter)-1); + wcsncpy(filter, TranslateT("All files"),_countof(filter)-1); mir_tstrcat(filter, L" (*)"); pfilter = filter + mir_tstrlen(filter) + 1; mir_tstrcpy(pfilter, L"*"); diff --git a/src/core/stdfile/src/fileopts.cpp b/src/core/stdfile/src/fileopts.cpp index c608f7311a..30979c1294 100644 --- a/src/core/stdfile/src/fileopts.cpp +++ b/src/core/stdfile/src/fileopts.cpp @@ -30,10 +30,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define VSCAN_CA 4 struct virusscannerinfo { - const TCHAR *szProductName; - const TCHAR *szExeRegPath; - const TCHAR *szExeRegValue; - const TCHAR *szCommandLine; + const wchar_t *szProductName; + const wchar_t *szExeRegPath; + const wchar_t *szExeRegValue; + const wchar_t *szCommandLine; } virusScanners[] = { {L"Network Associates/McAfee VirusScan", L"SOFTWARE\\McAfee\\VirusScan", L"Scan32EXE", L"\"%s\" %%f /nosplash /comp /autoscan /autoexit /noboot"}, {L"Dr Solomon's VirusScan (Network Associates)", L"SOFTWARE\\Network Associates\\TVD\\VirusScan\\AVConsol\\General", L"szScannerExe", L"\"%s\" %%f /uinone /noboot /comp /prompt /autoexit"}, @@ -62,7 +62,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L { SHAutoComplete(GetDlgItem(hwndDlg, IDC_FILEDIR), SHACF_FILESYS_DIRS); - TCHAR str[MAX_PATH]; + wchar_t str[MAX_PATH]; GetContactReceivedFilesDir(NULL, str, _countof(str), FALSE); SetDlgItemText(hwndDlg, IDC_FILEDIR, str); @@ -78,7 +78,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L CheckDlgButton(hwndDlg, IDC_WARNBEFOREOPENING, db_get_b(NULL, "SRFile", "WarnBeforeOpening", 1) ? BST_CHECKED : BST_UNCHECKED); for (int i = 0; i < _countof(virusScanners); i++) { - TCHAR szScanExe[MAX_PATH]; + wchar_t szScanExe[MAX_PATH]; if (SRFile_GetRegValue(HKEY_LOCAL_MACHINE, virusScanners[i].szExeRegPath, virusScanners[i].szExeRegValue, szScanExe, _countof(szScanExe))) { int iItem = SendDlgItemMessage(hwndDlg, IDC_SCANCMDLINE, CB_ADDSTRING, 0, (LPARAM)virusScanners[i].szProductName); SendDlgItemMessage(hwndDlg, IDC_SCANCMDLINE, CB_SETITEMDATA, iItem, i); @@ -121,8 +121,8 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L break; case M_SCANCMDLINESELCHANGE: { - TCHAR str[512]; - TCHAR szScanExe[MAX_PATH]; + wchar_t str[512]; + wchar_t szScanExe[MAX_PATH]; int iScanner = SendDlgItemMessage(hwndDlg, IDC_SCANCMDLINE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_SCANCMDLINE, CB_GETCURSEL, 0, 0), 0); if (iScanner >= _countof(virusScanners) || iScanner < 0) break; str[0] = '\0'; @@ -140,7 +140,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L case IDC_FILEDIRBROWSE: { - TCHAR str[MAX_PATH]; + wchar_t str[MAX_PATH]; GetDlgItemText(hwndDlg, IDC_FILEDIR, str, _countof(str)); if (BrowseForFolder(hwndDlg, str)) SetDlgItemText(hwndDlg, IDC_FILEDIR, str); @@ -162,7 +162,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L break; case IDC_SCANCMDLINEBROWSE: - TCHAR str[MAX_PATH + 2]; + wchar_t str[MAX_PATH + 2]; GetDlgItemText(hwndDlg, IDC_SCANCMDLINE, str, _countof(str)); CMString tszFilter; @@ -177,19 +177,19 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L ofn.lpstrFile = str; ofn.nMaxFile = _countof(str) - 2; if (str[0] == '"') { - TCHAR *pszQuote = _tcschr(str + 1, '"'); + wchar_t *pszQuote = wcschr(str + 1, '"'); if (pszQuote) *pszQuote = 0; - memmove(str, str + 1, (mir_tstrlen(str) * sizeof(TCHAR))); + memmove(str, str + 1, (mir_tstrlen(str) * sizeof(wchar_t))); } else { - TCHAR *pszSpace = _tcschr(str, ' '); + wchar_t *pszSpace = wcschr(str, ' '); if (pszSpace) *pszSpace = 0; } ofn.nMaxFileTitle = MAX_PATH; if (!GetOpenFileName(&ofn)) break; - if (_tcschr(str, ' ') != NULL) { - memmove(str + 1, str, ((_countof(str) - 2) * sizeof(TCHAR))); + if (wcschr(str, ' ') != NULL) { + memmove(str + 1, str, ((_countof(str) - 2) * sizeof(wchar_t))); str[0] = '"'; mir_tstrcat(str, L"\""); } @@ -202,7 +202,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_NOTIFY: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - TCHAR str[512]; + wchar_t str[512]; GetDlgItemText(hwndDlg, IDC_FILEDIR, str, _countof(str)); RemoveInvalidPathChars(str); db_set_ts(NULL, "SRFile", "RecvFilesDirAdv", str); diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp index 3c75d282c0..6df563406d 100644 --- a/src/core/stdfile/src/filerecvdlg.cpp +++ b/src/core/stdfile/src/filerecvdlg.cpp @@ -33,14 +33,14 @@ static BOOL CALLBACK ClipSiblingsChildEnumProc(HWND hwnd, LPARAM) return TRUE; } -static void GetLowestExistingDirName(const TCHAR *szTestDir, TCHAR *szExistingDir, int cchExistingDir) +static void GetLowestExistingDirName(const wchar_t *szTestDir, wchar_t *szExistingDir, int cchExistingDir) { DWORD dwAttributes; - TCHAR *pszLastBackslash; + wchar_t *pszLastBackslash; mir_tstrncpy(szExistingDir, szTestDir, cchExistingDir); while ((dwAttributes = GetFileAttributes(szExistingDir)) != INVALID_FILE_ATTRIBUTES && !(dwAttributes&FILE_ATTRIBUTE_DIRECTORY)) { - pszLastBackslash = _tcsrchr(szExistingDir, '\\'); + pszLastBackslash = wcsrchr(szExistingDir, '\\'); if (pszLastBackslash == NULL) { *szExistingDir = '\0'; break; } *pszLastBackslash = '\0'; } @@ -48,27 +48,27 @@ static void GetLowestExistingDirName(const TCHAR *szTestDir, TCHAR *szExistingDi GetCurrentDirectory(cchExistingDir, szExistingDir); } -static const TCHAR InvalidFilenameChars[] = L"\\/:*?\"<>|"; -void RemoveInvalidFilenameChars(TCHAR *tszString) +static const wchar_t InvalidFilenameChars[] = L"\\/:*?\"<>|"; +void RemoveInvalidFilenameChars(wchar_t *tszString) { size_t i; if (tszString) { - for (i = _tcscspn(tszString, InvalidFilenameChars); tszString[i]; i+=_tcscspn(tszString+i+1, InvalidFilenameChars)+1) - tszString[i] = _T('_'); + for (i = wcscspn(tszString, InvalidFilenameChars); tszString[i]; i+=wcscspn(tszString+i+1, InvalidFilenameChars)+1) + tszString[i] = '_'; } } -static const TCHAR InvalidPathChars[] = L"*?\"<>|"; // "\/:" are excluded as they are allowed in file path -void RemoveInvalidPathChars(TCHAR *tszString) +static const wchar_t InvalidPathChars[] = L"*?\"<>|"; // "\/:" are excluded as they are allowed in file path +void RemoveInvalidPathChars(wchar_t *tszString) { if (tszString) - for (size_t i = _tcscspn(tszString, InvalidPathChars); tszString[i]; i += _tcscspn(tszString + i + 1, InvalidPathChars) + 1) - tszString[i] = _T('_'); + for (size_t i = wcscspn(tszString, InvalidPathChars); tszString[i]; i += wcscspn(tszString + i + 1, InvalidPathChars) + 1) + tszString[i] = '_'; } static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData) { - TCHAR szDir[MAX_PATH]; + wchar_t szDir[MAX_PATH]; switch (uMsg) { case BFFM_INITIALIZED: SendMessage(hwnd, BFFM_SETSELECTION, TRUE, pData); @@ -81,7 +81,7 @@ static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM p return 0; } -int BrowseForFolder(HWND hwnd, TCHAR *szPath) +int BrowseForFolder(HWND hwnd, wchar_t *szPath) { BROWSEINFO bi = { 0 }; bi.hwndOwner = hwnd; @@ -108,11 +108,11 @@ static REPLACEVARSARRAY sttVarsToReplace[] = { NULL, NULL } }; -static void patchDir(TCHAR *str, size_t strSize) +static void patchDir(wchar_t *str, size_t strSize) { - TCHAR *result = Utils_ReplaceVarsT(str, 0, sttVarsToReplace); + wchar_t *result = Utils_ReplaceVarsT(str, 0, sttVarsToReplace); if (result) { - _tcsncpy(str, result, strSize); + wcsncpy(str, result, strSize); mir_free(result); } @@ -121,13 +121,13 @@ static void patchDir(TCHAR *str, size_t strSize) mir_tstrcpy(str + len, L"\\"); } -void GetContactReceivedFilesDir(MCONTACT hContact, TCHAR *szDir, int cchDir, BOOL patchVars) +void GetContactReceivedFilesDir(MCONTACT hContact, wchar_t *szDir, int cchDir, BOOL patchVars) { - TCHAR tszTemp[MAX_PATH]; + wchar_t tszTemp[MAX_PATH]; ptrT tszRecvPath(db_get_tsa(NULL, "SRFile", "RecvFilesDirAdv")); if (tszRecvPath) - _tcsncpy_s(tszTemp, tszRecvPath, _TRUNCATE); + wcsncpy_s(tszTemp, tszRecvPath, _TRUNCATE); else mir_sntprintf(tszTemp, L"%%mydocuments%%\\%s\\%%userid%%", TranslateT("My received files")); @@ -135,23 +135,23 @@ void GetContactReceivedFilesDir(MCONTACT hContact, TCHAR *szDir, int cchDir, BOO hContact = db_mc_tryMeta(hContact); REPLACEVARSARRAY rvaVarsToReplace[4]; - rvaVarsToReplace[0].key.t = L"nick"; - rvaVarsToReplace[0].value.t = mir_tstrdup((TCHAR *)pcli->pfnGetContactDisplayName(hContact, 0)); - rvaVarsToReplace[1].key.t = L"userid"; - rvaVarsToReplace[1].value.t = GetContactID(hContact); - rvaVarsToReplace[2].key.t = L"proto"; - rvaVarsToReplace[2].value.t = mir_a2t(GetContactProto(hContact)); - rvaVarsToReplace[3].key.t = NULL; - rvaVarsToReplace[3].value.t = NULL; + rvaVarsToReplace[0].key.w = L"nick"; + rvaVarsToReplace[0].value.w = mir_tstrdup((wchar_t *)pcli->pfnGetContactDisplayName(hContact, 0)); + rvaVarsToReplace[1].key.w = L"userid"; + rvaVarsToReplace[1].value.w = GetContactID(hContact); + rvaVarsToReplace[2].key.w = L"proto"; + rvaVarsToReplace[2].value.w = mir_a2t(GetContactProto(hContact)); + rvaVarsToReplace[3].key.w = NULL; + rvaVarsToReplace[3].value.w = NULL; for (int i = 0; i < (_countof(rvaVarsToReplace) - 1); i++) - RemoveInvalidFilenameChars(rvaVarsToReplace[i].value.t); + RemoveInvalidFilenameChars(rvaVarsToReplace[i].value.w); - TCHAR *result = Utils_ReplaceVarsT(tszTemp, hContact, rvaVarsToReplace); + wchar_t *result = Utils_ReplaceVarsT(tszTemp, hContact, rvaVarsToReplace); if (result) { - _tcsncpy(tszTemp, result, _countof(tszTemp)); + wcsncpy(tszTemp, result, _countof(tszTemp)); mir_free(result); for (int i = 0; i < (_countof(rvaVarsToReplace) - 1); i++) - mir_free(rvaVarsToReplace[i].value.t); + mir_free(rvaVarsToReplace[i].value.w); } } @@ -161,13 +161,13 @@ void GetContactReceivedFilesDir(MCONTACT hContact, TCHAR *szDir, int cchDir, BOO mir_tstrncpy(szDir, tszTemp, cchDir); } -void GetReceivedFilesDir(TCHAR *szDir, int cchDir) +void GetReceivedFilesDir(wchar_t *szDir, int cchDir) { - TCHAR tszTemp[MAX_PATH]; + wchar_t tszTemp[MAX_PATH]; ptrT tszRecvPath(db_get_tsa(NULL, "SRFile", "RecvFilesDirAdv")); if (tszRecvPath) - _tcsncpy_s(tszTemp, tszRecvPath, _TRUNCATE); + wcsncpy_s(tszTemp, tszRecvPath, _TRUNCATE); else mir_sntprintf(tszTemp, L"%%mydocuments%%\\%s\\%%userid%%", TranslateT("My received files")); @@ -184,7 +184,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); { - TCHAR szPath[450]; + wchar_t szPath[450]; CLISTEVENT* cle = (CLISTEVENT*)lParam; dat = (FileDlgData*)mir_calloc(sizeof(FileDlgData)); @@ -203,7 +203,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l Button_SetIcon_IcoLib(hwndDlg, IDC_HISTORY, SKINICON_OTHER_HISTORY, LPGEN("View user's history")); Button_SetIcon_IcoLib(hwndDlg, IDC_USERMENU, SKINICON_OTHER_DOWNARROW, LPGEN("User menu")); - TCHAR *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0); + wchar_t *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0); SetDlgItemText(hwndDlg, IDC_FROM, contactName); GetContactReceivedFilesDir(dat->hContact, szPath, _countof(szPath), TRUE); SetDlgItemText(hwndDlg, IDC_FILEDIR, szPath); @@ -243,7 +243,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l } else DestroyWindow(hwndDlg); - TCHAR datetimestr[64]; + wchar_t datetimestr[64]; TimeZone_PrintTimeStamp(NULL, dbei.timestamp, L"t d", datetimestr, _countof(datetimestr), 0); SetDlgItemText(hwndDlg, IDC_DATE, datetimestr); @@ -292,7 +292,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l switch (LOWORD(wParam)) { case IDC_FILEDIRBROWSE: { - TCHAR szDirName[MAX_PATH], szExistingDirName[MAX_PATH]; + wchar_t szDirName[MAX_PATH], szExistingDirName[MAX_PATH]; GetDlgItemText(hwndDlg, IDC_FILEDIR, szDirName, _countof(szDirName)); GetLowestExistingDirName(szDirName, szExistingDirName, _countof(szExistingDirName)); @@ -303,11 +303,11 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case IDOK: { //most recently used directories - TCHAR szRecvDir[MAX_PATH], szDefaultRecvDir[MAX_PATH]; + wchar_t szRecvDir[MAX_PATH], szDefaultRecvDir[MAX_PATH]; GetDlgItemText(hwndDlg, IDC_FILEDIR, szRecvDir, _countof(szRecvDir)); RemoveInvalidPathChars(szRecvDir); GetContactReceivedFilesDir(NULL, szDefaultRecvDir, _countof(szDefaultRecvDir), TRUE); - if (_tcsnicmp(szRecvDir, szDefaultRecvDir, mir_tstrlen(szDefaultRecvDir))) { + if (wcsnicmp(szRecvDir, szDefaultRecvDir, mir_tstrlen(szDefaultRecvDir))) { char idstr[32]; int i; DBVARIANT dbv; diff --git a/src/core/stdfile/src/filesenddlg.cpp b/src/core/stdfile/src/filesenddlg.cpp index 318dcab932..7d1c780807 100644 --- a/src/core/stdfile/src/filesenddlg.cpp +++ b/src/core/stdfile/src/filesenddlg.cpp @@ -32,10 +32,10 @@ static void SetFileListAndSizeControls(HWND hwndDlg, FileDlgData *dat) int fileCount = 0, dirCount = 0, i; __int64 totalSize = 0; struct _stati64 statbuf; - TCHAR str[64]; + wchar_t str[64]; for (i = 0; dat->files[i]; i++) { - if (_tstati64(dat->files[i], &statbuf) == 0) { + if (_wstat64(dat->files[i], &statbuf) == 0) { if (statbuf.st_mode & _S_IFDIR) dirCount++; else @@ -47,7 +47,7 @@ static void SetFileListAndSizeControls(HWND hwndDlg, FileDlgData *dat) GetSensiblyFormattedSize(totalSize, str, _countof(str), 0, 1, NULL); SetDlgItemText(hwndDlg, IDC_TOTALSIZE, str); if (i > 1) { - TCHAR szFormat[32]; + wchar_t szFormat[32]; if (fileCount && dirCount) { mir_sntprintf(szFormat, L"%s, %s", TranslateTS(fileCount == 1 ? L"%d file" : L"%d files"), TranslateTS(dirCount == 1 ? L"%d directory" : L"%d directories")); mir_sntprintf(str, szFormat, fileCount, dirCount); @@ -67,7 +67,7 @@ static void SetFileListAndSizeControls(HWND hwndDlg, FileDlgData *dat) EnableWindow(GetDlgItem(hwndDlg, IDOK), fileCount || dirCount); } -static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const TCHAR *buf) +static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const wchar_t *buf) { // Make sure that the file matrix is empty (the user may select files several times) FreeFilesMatrix(&dat->files); @@ -79,7 +79,7 @@ static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const TCHAR *buf) // Check if the selection is a directory or a file if (GetFileAttributes(buf) & FILE_ATTRIBUTE_DIRECTORY) { - const TCHAR *pBuf; + const wchar_t *pBuf; int nNumberOfFiles = 0; int nTemp; @@ -97,7 +97,7 @@ static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const TCHAR *buf) } // Allocate memory for a pointer array - if ((dat->files = (TCHAR**)mir_alloc((nNumberOfFiles + 1) * sizeof(TCHAR*))) == NULL) + if ((dat->files = (wchar_t**)mir_alloc((nNumberOfFiles + 1) * sizeof(wchar_t*))) == NULL) return; // Fill the array @@ -106,10 +106,10 @@ static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const TCHAR *buf) while (*pBuf) { // Allocate space for path+filename size_t cbFileNameLen = mir_tstrlen(pBuf); - dat->files[nTemp] = (TCHAR*)mir_alloc(sizeof(TCHAR)*(fileOffset + cbFileNameLen + 1)); + dat->files[nTemp] = (wchar_t*)mir_alloc(sizeof(wchar_t)*(fileOffset + cbFileNameLen + 1)); // Add path to filename and copy into array - memcpy(dat->files[nTemp], buf, (fileOffset - 1)*sizeof(TCHAR)); + memcpy(dat->files[nTemp], buf, (fileOffset - 1)*sizeof(wchar_t)); dat->files[nTemp][fileOffset - 1] = '\\'; mir_tstrcpy(dat->files[nTemp] + fileOffset - (buf[fileOffset - 2] == '\\' ? 1 : 0), pBuf); @@ -122,7 +122,7 @@ static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const TCHAR *buf) } // ...the selection is a single file else { - if ((dat->files = (TCHAR **)mir_alloc(2 * sizeof(TCHAR*))) == NULL) // Leaks when aborted + if ((dat->files = (wchar_t **)mir_alloc(2 * sizeof(wchar_t*))) == NULL) // Leaks when aborted return; dat->files[0] = mir_tstrdup(buf); @@ -139,16 +139,16 @@ void __cdecl ChooseFilesThread(void* param) HWND hwndDlg = (HWND)param; FileDlgData *dat = (FileDlgData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - TCHAR *buf = (TCHAR*)mir_alloc(sizeof(TCHAR) * 32767); + wchar_t *buf = (wchar_t*)mir_alloc(sizeof(wchar_t) * 32767); if (buf == NULL) { PostMessage(hwndDlg, M_FILECHOOSEDONE, 0, NULL); return; } - TCHAR filter[128]; + wchar_t filter[128]; mir_tstrcpy(filter, TranslateT("All files")); mir_tstrcat(filter, L" (*)"); - TCHAR *pfilter = filter + mir_tstrlen(filter) + 1; + wchar_t *pfilter = filter + mir_tstrlen(filter) + 1; mir_tstrcpy(pfilter, L"*"); pfilter = filter + mir_tstrlen(filter) + 1; pfilter[0] = '\0'; @@ -228,14 +228,14 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l if (fsd->ppFiles != NULL && fsd->ppFiles[0] != NULL) { int totalCount, i; for (totalCount = 0; fsd->ppFiles[totalCount]; totalCount++); - dat->files = (TCHAR**)mir_alloc(sizeof(TCHAR*)*(totalCount + 1)); // Leaks + dat->files = (wchar_t**)mir_alloc(sizeof(wchar_t*)*(totalCount + 1)); // Leaks for (i = 0; i < totalCount; i++) dat->files[i] = mir_tstrdup(fsd->ppFiles[i]); dat->files[totalCount] = NULL; SetFileListAndSizeControls(hwndDlg, dat); } - TCHAR *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0); + wchar_t *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0); SetDlgItemText(hwndDlg, IDC_TO, contactName); ptrT id(Contact_GetInfo(CNF_UNIQUEID, dat->hContact)); @@ -270,8 +270,8 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case M_FILECHOOSEDONE: if (lParam != 0) { - FilenameToFileList(hwndDlg, dat, (TCHAR*)lParam); - mir_free((TCHAR*)lParam); + FilenameToFileList(hwndDlg, dat, (wchar_t*)lParam); + mir_free((wchar_t*)lParam); dat->closeIfFileChooseCancelled = 0; } else if (dat->closeIfFileChooseCancelled) diff --git a/src/core/stdfile/src/filexferdlg.cpp b/src/core/stdfile/src/filexferdlg.cpp index 036e75068e..7be203e9bb 100644 --- a/src/core/stdfile/src/filexferdlg.cpp +++ b/src/core/stdfile/src/filexferdlg.cpp @@ -37,12 +37,12 @@ static int CheckVirusScanned(HWND hwnd, FileDlgData *dat, int i) #define M_VIRUSSCANDONE (WM_USER+100) struct virusscanthreadstartinfo { - TCHAR *szFile; + wchar_t *szFile; int returnCode; HWND hwndReply; }; -TCHAR* PFTS_StringToTchar(int flags, const TCHAR* s) +wchar_t* PFTS_StringToTchar(int flags, const wchar_t* s) { if (flags & PFTS_UTF) return Utf8DecodeW((char*)s); @@ -51,10 +51,10 @@ TCHAR* PFTS_StringToTchar(int flags, const TCHAR* s) return mir_a2t((char*)s); } -int PFTS_CompareWithTchar(PROTOFILETRANSFERSTATUS *ft, const TCHAR *s, TCHAR *r) +int PFTS_CompareWithTchar(PROTOFILETRANSFERSTATUS *ft, const wchar_t *s, wchar_t *r) { if (ft->flags & PFTS_UTF) { - TCHAR *ts = Utf8DecodeW((char*)s); + wchar_t *ts = Utf8DecodeW((char*)s); int res = mir_tstrcmp(ts, r); mir_free(ts); return res; @@ -62,7 +62,7 @@ int PFTS_CompareWithTchar(PROTOFILETRANSFERSTATUS *ft, const TCHAR *s, TCHAR *r) if (ft->flags & PFTS_UNICODE) return mir_tstrcmp(s, r); - TCHAR *ts = mir_a2t((char*)s); + wchar_t *ts = mir_a2t((char*)s); int res = mir_tstrcmp(ts, r); mir_free(ts); return res; @@ -99,15 +99,15 @@ static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info) if (dbv.ptszVal[0]) { STARTUPINFO si = { 0 }; si.cb = sizeof(si); - TCHAR *pszReplace = _tcsstr(dbv.ptszVal, L"%f"); - TCHAR szCmdLine[768]; + wchar_t *pszReplace = wcsstr(dbv.ptszVal, L"%f"); + wchar_t szCmdLine[768]; if (pszReplace) { if (info->szFile[mir_tstrlen(info->szFile) - 1] == '\\') info->szFile[mir_tstrlen(info->szFile) - 1] = '\0'; *pszReplace = 0; mir_sntprintf(szCmdLine, L"%s\"%s\"%s", dbv.ptszVal, info->szFile, pszReplace + 2); } else - _tcsncpy_s(szCmdLine, dbv.ptszVal, _TRUNCATE); + wcsncpy_s(szCmdLine, dbv.ptszVal, _TRUNCATE); PROCESS_INFORMATION pi; if (CreateProcess(NULL, szCmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) { @@ -125,13 +125,13 @@ static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info) static void SetFilenameControls(HWND hwndDlg, FileDlgData *dat, PROTOFILETRANSFERSTATUS *fts) { - TCHAR msg[MAX_PATH]; - TCHAR *fnbuf = NULL, *fn = NULL; + wchar_t msg[MAX_PATH]; + wchar_t *fnbuf = NULL, *fn = NULL; SHFILEINFO shfi = { 0 }; if (fts->tszCurrentFile) { fnbuf = mir_tstrdup(fts->tszCurrentFile); - if ((fn = _tcsrchr(fnbuf, '\\')) == NULL) + if ((fn = wcsrchr(fnbuf, '\\')) == NULL) fn = fnbuf; else fn++; } @@ -166,7 +166,7 @@ static void SetFilenameControls(HWND hwndDlg, FileDlgData *dat, PROTOFILETRANSFE } enum { FTS_TEXT, FTS_PROGRESS, FTS_OPEN }; -static void SetFtStatus(HWND hwndDlg, TCHAR *text, int mode) +static void SetFtStatus(HWND hwndDlg, wchar_t *text, int mode) { SetDlgItemText(hwndDlg, IDC_STATUS, TranslateTS(text)); SetDlgItemText(hwndDlg, IDC_TRANSFERCOMPLETED, TranslateTS(text)); @@ -237,7 +237,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (db_mc_isMeta(dat->hContact)) dat->hContact = db_mc_getMostOnline(dat->hContact); dat->fs = (HANDLE)ProtoChainSend(dat->hContact, PSS_FILE, (WPARAM)dat->szMsg, (LPARAM)dat->files); - SetFtStatus(hwndDlg, LPGENT("Request sent, waiting for acceptance..."), FTS_TEXT); + SetFtStatus(hwndDlg, LPGENW("Request sent, waiting for acceptance..."), FTS_TEXT); SetOpenFileButtonStyle(GetDlgItem(hwndDlg, IDC_OPENFILE), 1); dat->waitingForAcceptance = 1; // hide "open" button since it may cause potential access violations... @@ -250,12 +250,12 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR dat->transferStatus.tszWorkingDir = mir_tstrdup(dat->szSavePath); if (db_get_b(dat->hContact, "CList", "NotOnList", 0)) dat->resumeBehaviour = FILERESUME_ASK; else dat->resumeBehaviour = db_get_b(NULL, "SRFile", "IfExists", FILERESUME_ASK); - SetFtStatus(hwndDlg, LPGENT("Waiting for connection..."), FTS_TEXT); + SetFtStatus(hwndDlg, LPGENW("Waiting for connection..."), FTS_TEXT); } /* check we actually got an fs handle back from the protocol */ if (!dat->fs) { - SetFtStatus(hwndDlg, LPGENT("Unable to initiate transfer."), FTS_TEXT); + SetFtStatus(hwndDlg, LPGENW("Unable to initiate transfer."), FTS_TEXT); dat->waitingForAcceptance = 0; } { @@ -301,7 +301,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR dat->bytesRecvedHistorySize++; { - TCHAR szSpeed[32], szTime[32], szDisplay[96]; + wchar_t szSpeed[32], szTime[32], szDisplay[96]; SYSTEMTIME st; ULARGE_INTEGER li; FILETIME ft; @@ -372,10 +372,10 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case IDC_OPENFOLDER: { - TCHAR *path = dat->transferStatus.tszWorkingDir; + wchar_t *path = dat->transferStatus.tszWorkingDir; if (!path || !path[0]) { - path = NEWTSTR_ALLOCA(dat->transferStatus.tszCurrentFile); - TCHAR *p = _tcsrchr(path, '\\'); if (p) *p = 0; + path = NEWWSTR_ALLOCA(dat->transferStatus.tszCurrentFile); + wchar_t *p = wcsrchr(path, '\\'); if (p) *p = 0; } if (path) ShellExecute(NULL, L"open", path, NULL, NULL, SW_SHOW); @@ -383,7 +383,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR break; case IDC_OPENFILE: - TCHAR **files; + wchar_t **files; if (dat->send) { if (dat->files == NULL) files = dat->transferStatus.ptszFiles; @@ -398,7 +398,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (files && *files) { int limit; - TCHAR *pszFilename, *pszNewFileName; + wchar_t *pszFilename, *pszNewFileName; if (dat->send) limit = dat->transferStatus.totalFiles; @@ -407,7 +407,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR // Loop over all transfered files and add them to the menu for (int i = 0; i < limit; i++) { - pszFilename = _tcsrchr(files[i], '\\'); + pszFilename = wcsrchr(files[i], '\\'); if (pszFilename == NULL) pszFilename = files[i]; else @@ -416,8 +416,8 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (pszFilename) { size_t cbFileNameLen = mir_tstrlen(pszFilename); - pszNewFileName = (TCHAR*)mir_alloc(cbFileNameLen * 2 * sizeof(TCHAR)); - TCHAR *p = pszNewFileName; + pszNewFileName = (wchar_t*)mir_alloc(cbFileNameLen * 2 * sizeof(wchar_t)); + wchar_t *p = pszNewFileName; for (size_t pszlen = 0; pszlen < cbFileNameLen; pszlen++) { *p++ = pszFilename[pszlen]; if (pszFilename[pszlen] == '&') @@ -438,10 +438,10 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR DestroyMenu(hMenu); if (ret == 1) { - TCHAR *path = dat->transferStatus.tszWorkingDir; + wchar_t *path = dat->transferStatus.tszWorkingDir; if (!path || !path[0]) { - path = NEWTSTR_ALLOCA(dat->transferStatus.tszCurrentFile); - TCHAR *p = _tcsrchr(path, '\\'); + path = NEWWSTR_ALLOCA(dat->transferStatus.tszCurrentFile); + wchar_t *p = wcsrchr(path, '\\'); if (p) *p = 0; } @@ -457,7 +457,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR EnableWindow(hwndDlg, TRUE); { PROTOFILERESUME *pfr = (PROTOFILERESUME*)lParam; - TCHAR *szOriginalFilename = (TCHAR*)wParam; + wchar_t *szOriginalFilename = (wchar_t*)wParam; char *szProto = GetContactProto(dat->hContact); switch (pfr->action) { @@ -476,15 +476,15 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case FILERESUME_RENAMEALL: pfr->action = FILERESUME_RENAME; { - TCHAR *pszExtension, *pszFilename; - if ((pszFilename = _tcsrchr(szOriginalFilename, '\\')) == NULL) pszFilename = szOriginalFilename; - if ((pszExtension = _tcsrchr(pszFilename + 1, '.')) == NULL) pszExtension = pszFilename + mir_tstrlen(pszFilename); - if (pfr->szFilename) mir_free((TCHAR*)pfr->szFilename); + wchar_t *pszExtension, *pszFilename; + if ((pszFilename = wcsrchr(szOriginalFilename, '\\')) == NULL) pszFilename = szOriginalFilename; + if ((pszExtension = wcsrchr(pszFilename + 1, '.')) == NULL) pszExtension = pszFilename + mir_tstrlen(pszFilename); + if (pfr->szFilename) mir_free((wchar_t*)pfr->szFilename); size_t size = (pszExtension - szOriginalFilename) + 21 + mir_tstrlen(pszExtension); - pfr->szFilename = (TCHAR*)mir_alloc(sizeof(TCHAR)*size); + pfr->szFilename = (wchar_t*)mir_alloc(sizeof(wchar_t)*size); for (int i = 1;; i++) { - mir_sntprintf((TCHAR*)pfr->szFilename, size, L"%.*s (%u)%s", pszExtension - szOriginalFilename, szOriginalFilename, i, pszExtension); - if (_taccess(pfr->szFilename, 0) != 0) + mir_sntprintf((wchar_t*)pfr->szFilename, size, L"%.*s (%u)%s", pszExtension - szOriginalFilename, szOriginalFilename, i, pszExtension); + if (_waccess(pfr->szFilename, 0) != 0) break; } } @@ -510,14 +510,14 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } switch (ack->result) { - case ACKRESULT_SENTREQUEST: SetFtStatus(hwndDlg, LPGENT("Decision sent"), FTS_TEXT); break; - case ACKRESULT_CONNECTING: SetFtStatus(hwndDlg, LPGENT("Connecting..."), FTS_TEXT); break; - case ACKRESULT_CONNECTPROXY: SetFtStatus(hwndDlg, LPGENT("Connecting to proxy..."), FTS_TEXT); break; - case ACKRESULT_CONNECTED: SetFtStatus(hwndDlg, LPGENT("Connected"), FTS_TEXT); break; - case ACKRESULT_LISTENING: SetFtStatus(hwndDlg, LPGENT("Waiting for connection..."), FTS_TEXT); break; - case ACKRESULT_INITIALISING: SetFtStatus(hwndDlg, LPGENT("Initializing..."), FTS_TEXT); break; + case ACKRESULT_SENTREQUEST: SetFtStatus(hwndDlg, LPGENW("Decision sent"), FTS_TEXT); break; + case ACKRESULT_CONNECTING: SetFtStatus(hwndDlg, LPGENW("Connecting..."), FTS_TEXT); break; + case ACKRESULT_CONNECTPROXY: SetFtStatus(hwndDlg, LPGENW("Connecting to proxy..."), FTS_TEXT); break; + case ACKRESULT_CONNECTED: SetFtStatus(hwndDlg, LPGENW("Connected"), FTS_TEXT); break; + case ACKRESULT_LISTENING: SetFtStatus(hwndDlg, LPGENW("Waiting for connection..."), FTS_TEXT); break; + case ACKRESULT_INITIALISING: SetFtStatus(hwndDlg, LPGENW("Initializing..."), FTS_TEXT); break; case ACKRESULT_NEXTFILE: - SetFtStatus(hwndDlg, LPGENT("Moving to next file..."), FTS_TEXT); + SetFtStatus(hwndDlg, LPGENW("Moving to next file..."), FTS_TEXT); SetDlgItemTextA(hwndDlg, IDC_FILENAME, ""); if (dat->transferStatus.currentFileNumber == 1 && dat->transferStatus.totalFiles > 1 && !dat->send) SetOpenFileButtonStyle(GetDlgItem(hwndDlg, IDC_OPENFILE), 1); @@ -540,10 +540,10 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR { PROTOFILETRANSFERSTATUS *fts = &dat->transferStatus; SetFilenameControls(hwndDlg, dat, fts); - if (_taccess(fts->tszCurrentFile, 0)) + if (_waccess(fts->tszCurrentFile, 0)) break; - SetFtStatus(hwndDlg, LPGENT("File already exists"), FTS_TEXT); + SetFtStatus(hwndDlg, LPGENW("File already exists"), FTS_TEXT); if (dat->resumeBehaviour == FILERESUME_ASK) { TDlgProcFileExistsParam param = { hwndDlg, fts }; ShowWindow(hwndDlg, SW_SHOWNORMAL); @@ -563,7 +563,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case ACKRESULT_DATA: { PROTOFILETRANSFERSTATUS *fts = (PROTOFILETRANSFERSTATUS*)ack->lParam; - TCHAR str[64], str2[64], szSizeDone[32], szSizeTotal[32];//, *contactName; + wchar_t str[64], str2[64], szSizeDone[32], szSizeTotal[32];//, *contactName; if (dat->fileVirusScanned == NULL) dat->fileVirusScanned = (int*)mir_calloc(sizeof(int) * fts->totalFiles); @@ -571,7 +571,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR // This needs to be here - otherwise we get holes in the files array if (!dat->send) { if (dat->files == NULL) - dat->files = (TCHAR**)mir_calloc((fts->totalFiles + 1) * sizeof(TCHAR*)); + dat->files = (wchar_t**)mir_calloc((fts->totalFiles + 1) * sizeof(wchar_t*)); if (fts->currentFileNumber < fts->totalFiles && dat->files[fts->currentFileNumber] == NULL) dat->files[fts->currentFileNumber] = PFTS_StringToTchar(fts->flags, fts->tszCurrentFile); } @@ -587,7 +587,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR bool firstTime = false; if ((GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_ALLFILESPROGRESS), GWL_STYLE) & WS_VISIBLE) == 0) { - SetFtStatus(hwndDlg, (fts->flags & PFTS_SENDING) ? LPGENT("Sending...") : LPGENT("Receiving..."), FTS_PROGRESS); + SetFtStatus(hwndDlg, (fts->flags & PFTS_SENDING) ? LPGENW("Sending...") : LPGENW("Receiving..."), FTS_PROGRESS); SetFilenameControls(hwndDlg, dat, fts); firstTime = true; } @@ -626,18 +626,18 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (ack->result == ACKRESULT_DENIED) { dat->fs = NULL; /* protocol will free structure */ SkinPlaySound("FileDenied"); - SetFtStatus(hwndDlg, LPGENT("File transfer denied"), FTS_TEXT); + SetFtStatus(hwndDlg, LPGENW("File transfer denied"), FTS_TEXT); } else if (ack->result == ACKRESULT_FAILED) { dat->fs = NULL; /* protocol will free structure */ SkinPlaySound("FileFailed"); - SetFtStatus(hwndDlg, LPGENT("File transfer failed"), FTS_TEXT); + SetFtStatus(hwndDlg, LPGENW("File transfer failed"), FTS_TEXT); } else { SkinPlaySound("FileDone"); if (dat->send) { dat->fs = NULL; /* protocol will free structure */ - SetFtStatus(hwndDlg, LPGENT("Transfer completed."), FTS_TEXT); + SetFtStatus(hwndDlg, LPGENW("Transfer completed."), FTS_TEXT); DBEVENTINFO dbei = { 0 }; FillSendData(dat, dbei); @@ -649,8 +649,8 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR else { SetFtStatus(hwndDlg, (dat->transferStatus.totalFiles == 1) ? - LPGENT("Transfer completed, open file.") : - LPGENT("Transfer completed, open folder."), + LPGENW("Transfer completed, open file.") : + LPGENW("Transfer completed, open folder."), FTS_OPEN); int useScanner = db_get_b(NULL, "SRFile", "UseScanner", VIRUSSCAN_DISABLE); @@ -671,7 +671,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR vstsi->szFile = mir_tstrdup(dat->transferStatus.tszWorkingDir); vstsi->returnCode = -1; } - SetFtStatus(hwndDlg, LPGENT("Scanning for viruses..."), FTS_TEXT); + SetFtStatus(hwndDlg, LPGENW("Scanning for viruses..."), FTS_TEXT); if (vstsi) mir_forkthread((void(*)(void*))RunVirusScannerThread, vstsi); } @@ -705,7 +705,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } if (done) { dat->fs = NULL; /* protocol will free structure */ - SetFtStatus(hwndDlg, LPGENT("Transfer and virus scan complete"), FTS_TEXT); + SetFtStatus(hwndDlg, LPGENW("Transfer and virus scan complete"), FTS_TEXT); } } break; diff --git a/src/core/stdfile/src/stdafx.h b/src/core/stdfile/src/stdafx.h index 4be0919b51..0bb8cc54f6 100644 --- a/src/core/stdfile/src/stdafx.h +++ b/src/core/stdfile/src/stdafx.h @@ -22,7 +22,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include #include #include #include diff --git a/src/core/stdhelp/src/about.cpp b/src/core/stdhelp/src/about.cpp index 7ef45cf054..5fca697ade 100644 --- a/src/core/stdhelp/src/about.cpp +++ b/src/core/stdhelp/src/about.cpp @@ -32,7 +32,7 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - { TCHAR filename[MAX_PATH], *productCopyright; + { wchar_t filename[MAX_PATH], *productCopyright; DWORD unused; DWORD verInfoSize; UINT blockSize; @@ -50,7 +50,7 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar char productVersion[56]; CallService(MS_SYSTEM_GETVERSIONTEXT, _countof(productVersion), (LPARAM)productVersion); - TCHAR str[64]; + wchar_t str[64]; mir_sntprintf(str, STR_VERSION_FORMAT, productVersion); SetDlgItemText(hwndDlg, IDC_HEADERBAR, str); } @@ -65,7 +65,7 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar char* pszMsgt = (char*)alloca(ResSize + 1); memcpy(pszMsgt, pszMsg, ResSize); pszMsgt[ResSize] = 0; - TCHAR *ptszMsg; + wchar_t *ptszMsg; if (ResSize >=3 && pszMsgt[0] == '\xef' && pszMsgt[1] == '\xbb' && pszMsgt[2] == '\xbf') ptszMsg = Utf8DecodeT(pszMsgt + 3); else diff --git a/src/core/stdhelp/src/help.cpp b/src/core/stdhelp/src/help.cpp index 25b53757ea..a72cce44af 100644 --- a/src/core/stdhelp/src/help.cpp +++ b/src/core/stdhelp/src/help.cpp @@ -74,7 +74,7 @@ int LoadHelpModule(void) CreateServiceFunction("Help/BugCommand", BugCommand); CMenuItem mi; - mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("&Help"), 2000090000); + mi.root = Menu_CreateRoot(MO_MAIN, LPGENW("&Help"), 2000090000); Menu_ConfigureItem(mi.root, MCI_OPT_UID, "8824ECA5-6942-46D7-9D07-1BA600E0D02E"); SET_UID(mi, 0xf3ebf1fa, 0x587c, 0x494d, 0xbd, 0x33, 0x7f, 0x88, 0xb3, 0x61, 0x1e, 0xd3); diff --git a/src/core/stdhelp/src/stdafx.h b/src/core/stdhelp/src/stdafx.h index 04c94e8013..4d3797d0df 100644 --- a/src/core/stdhelp/src/stdafx.h +++ b/src/core/stdhelp/src/stdafx.h @@ -22,7 +22,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include #include #include #include diff --git a/src/core/stdidle/src/stdafx.h b/src/core/stdidle/src/stdafx.h index e85df5960c..69d89218cc 100644 --- a/src/core/stdidle/src/stdafx.h +++ b/src/core/stdidle/src/stdafx.h @@ -22,7 +22,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include #include #include #include diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 26e30e224b..79822ad339 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -53,7 +53,7 @@ static void NotifyLocalWinEvent(MCONTACT hContact, HWND hwnd, unsigned int type) } } -static int RTL_Detect(const TCHAR *ptszText) +static int RTL_Detect(const wchar_t *ptszText) { int iLen = (int)mir_tstrlen(ptszText); WORD *infoTypeC2 = (WORD*)alloca(sizeof(WORD)* (iLen + 2)); @@ -66,7 +66,7 @@ static int RTL_Detect(const TCHAR *ptszText) return 0; } -int SendMessageDirect(const TCHAR *szMsg, MCONTACT hContact, char*) +int SendMessageDirect(const wchar_t *szMsg, MCONTACT hContact, char*) { if (hContact == NULL) return NULL; @@ -87,15 +87,15 @@ int SendMessageDirect(const TCHAR *szMsg, MCONTACT hContact, char*) return sendId; } -static void AddToFileList(TCHAR ***pppFiles, int *totalCount, const TCHAR* szFilename) +static void AddToFileList(wchar_t ***pppFiles, int *totalCount, const wchar_t* szFilename) { - *pppFiles = (TCHAR**)mir_realloc(*pppFiles, (++*totalCount + 1)*sizeof(TCHAR*)); + *pppFiles = (wchar_t**)mir_realloc(*pppFiles, (++*totalCount + 1)*sizeof(wchar_t*)); (*pppFiles)[*totalCount] = NULL; (*pppFiles)[*totalCount - 1] = mir_tstrdup(szFilename); if (GetFileAttributes(szFilename) & FILE_ATTRIBUTE_DIRECTORY) { WIN32_FIND_DATA fd; - TCHAR szPath[MAX_PATH]; + wchar_t szPath[MAX_PATH]; mir_sntprintf(szPath, L"%s\\*", szFilename); HANDLE hFind = FindFirstFile(szPath, &fd); if (hFind != INVALID_HANDLE_VALUE) { @@ -119,7 +119,7 @@ static void ShowMultipleControls(HWND hwndDlg, const UINT * controls, int cContr static void UpdateReadChars(HWND hwndDlg, HWND hwndStatus) { if (hwndStatus && (g_dat.flags & SMF_SHOWREADCHAR)) { - TCHAR buf[32]; + wchar_t buf[32]; int len = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE)); mir_sntprintf(buf, L"%d", len); @@ -133,7 +133,7 @@ static void ShowTime(SrmmWindowData *dat) SYSTEMTIME st; GetSystemTime(&st); if (dat->wMinute != st.wMinute) { - TCHAR buf[32]; + wchar_t buf[32]; unsigned i = (g_dat.flags & SMF_SHOWREADCHAR) ? 2 : 1; TimeZone_PrintDateTime(dat->hTimeZone, L"t", buf, _countof(buf), 0); @@ -206,7 +206,7 @@ struct MsgEditSubclassData DWORD lastEnterTime; }; -static void SetEditorText(HWND hwnd, const TCHAR* txt) +static void SetEditorText(HWND hwnd, const wchar_t* txt) { SetWindowText(hwnd, txt); SendMessage(hwnd, EM_SETSEL, -1, -1); @@ -488,7 +488,7 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * HWND h = GetDlgItem(hwndDlg, IDC_NAME); int len = GetWindowTextLength(h); if (len > 0) { - TCHAR buf[256]; + wchar_t buf[256]; GetWindowText(h, buf, _countof(buf)); HDC hdc = GetDC(h); @@ -624,7 +624,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l int len; if (newData->isWchar) - SetDlgItemText(hwndDlg, IDC_MESSAGE, (TCHAR*)newData->szInitialText); + SetDlgItemText(hwndDlg, IDC_MESSAGE, (wchar_t*)newData->szInitialText); else SetDlgItemTextA(hwndDlg, IDC_MESSAGE, newData->szInitialText); len = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE)); @@ -687,7 +687,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_LIMITTEXT, (WPARAM)nMax, 0); // get around a lame bug in the Windows template resource code where richedits are limited to 0x7FFF - SendDlgItemMessage(hwndDlg, IDC_LOG, EM_LIMITTEXT, (WPARAM) sizeof(TCHAR) * 0x7FFFFFFF, 0); + SendDlgItemMessage(hwndDlg, IDC_LOG, EM_LIMITTEXT, (WPARAM) sizeof(wchar_t) * 0x7FFFFFFF, 0); } mir_subclassWindow(GetDlgItem(hwndDlg, IDC_MESSAGE), MessageEditSubclassProc); @@ -828,10 +828,10 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (!(CallProtoService(dat->szProto, PS_GETCAPS, PFLAGNUM_1, 0)&PF1_FILESEND)) break; if (dat->wStatus == ID_STATUS_OFFLINE) break; if (dat->hContact != NULL) { - TCHAR szFilename[MAX_PATH]; + wchar_t szFilename[MAX_PATH]; HDROP hDrop = (HDROP)wParam; int fileCount = DragQueryFile(hDrop, -1, NULL, 0), totalCount = 0, i; - TCHAR** ppFiles = NULL; + wchar_t** ppFiles = NULL; for (i = 0; i < fileCount; i++) { DragQueryFile(hDrop, i, szFilename, _countof(szFilename)); AddToFileList(&ppFiles, &totalCount, szFilename); @@ -921,8 +921,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l ptrT id(Contact_GetInfo(CNF_UNIQUEID, dat->hContact, dat->szProto)); if (id != NULL && OpenClipboard(hwndDlg)) { EmptyClipboard(); - HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, mir_tstrlen(id) * sizeof(TCHAR)+1); - mir_tstrcpy((TCHAR*)GlobalLock(hData), id); + HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, mir_tstrlen(id) * sizeof(wchar_t)+1); + mir_tstrcpy((wchar_t*)GlobalLock(hData), id); GlobalUnlock(hData); SetClipboardData(CF_UNICODETEXT, hData); CloseClipboard(); @@ -935,7 +935,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l break; if (dat->lastMessage) { - TCHAR date[64], time[64], fmt[128]; + wchar_t date[64], time[64], fmt[128]; TimeZone_PrintTimeStamp(NULL, dat->lastMessage, L"d", date, _countof(date), 0); TimeZone_PrintTimeStamp(NULL, dat->lastMessage, L"t", time, _countof(time), 0); mir_sntprintf(fmt, TranslateT("Last message received on %s at %s."), date, time); @@ -1000,17 +1000,17 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l case DM_UPDATETITLE: { - TCHAR newtitle[256]; + wchar_t newtitle[256]; if (dat->hContact && dat->szProto) { int statusIcon = db_get_b(NULL, SRMMMOD, SRMSGSET_STATUSICON, SRMSGDEFSET_STATUSICON); dat->wStatus = db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE); - TCHAR *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0); + wchar_t *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0); ptrT id(Contact_GetInfo(CNF_DISPLAYUID, dat->hContact, dat->szProto)); SetDlgItemText(hwndDlg, IDC_NAME, (id) ? id : contactName); - TCHAR *szStatus = pcli->pfnGetStatusModeDescription(dat->szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE), 0); + wchar_t *szStatus = pcli->pfnGetStatusModeDescription(dat->szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE), 0); if (statusIcon) mir_sntprintf(newtitle, L"%s - %s", contactName, TranslateT("Message session")); else @@ -1028,7 +1028,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l else mir_tstrncpy(newtitle, TranslateT("Message session"), _countof(newtitle)); - TCHAR oldtitle[256]; + wchar_t oldtitle[256]; GetWindowText(hwndDlg, oldtitle, _countof(oldtitle)); if (mir_tstrcmp(newtitle, oldtitle)) { //swt() flickers even if the title hasn't actually changed SetWindowText(hwndDlg, newtitle); @@ -1254,8 +1254,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l } else { if (dat->nTypeSecs) { - TCHAR szBuf[256]; - TCHAR* szContactName = pcli->pfnGetContactDisplayName(dat->hContact, 0); + wchar_t szBuf[256]; + wchar_t* szContactName = pcli->pfnGetContactDisplayName(dat->hContact, 0); HICON hTyping = Skin_LoadIcon(SKINICON_OTHER_TYPING); mir_sntprintf(szBuf, TranslateT("%s is typing a message..."), szContactName); @@ -1341,7 +1341,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l case IDOK: if (IsWindowEnabled(GetDlgItem(hwndDlg, IDOK))) { int bufSize = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE)) + 1; - TCHAR *temp = (TCHAR*)alloca(bufSize * sizeof(TCHAR)); + wchar_t *temp = (wchar_t*)alloca(bufSize * sizeof(wchar_t)); GetDlgItemText(hwndDlg, IDC_MESSAGE, temp, bufSize); if (!temp[0]) break; @@ -1522,11 +1522,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l TEXTRANGE tr; tr.chrg = ((ENLINK *)lParam)->chrg; - tr.lpstrText = (TCHAR*)_alloca((tr.chrg.cpMax - tr.chrg.cpMin + 8) * sizeof(TCHAR)); + tr.lpstrText = (wchar_t*)_alloca((tr.chrg.cpMax - tr.chrg.cpMin + 8) * sizeof(wchar_t)); SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETTEXTRANGE, 0, (LPARAM)& tr); - if (_tcschr(tr.lpstrText, '@') != NULL && _tcschr(tr.lpstrText, ':') == NULL && _tcschr(tr.lpstrText, '/') == NULL) { - memmove(tr.lpstrText + 7, tr.lpstrText, (tr.chrg.cpMax - tr.chrg.cpMin + 1) * sizeof(TCHAR)); - memcpy(tr.lpstrText, L"mailto:", 7 * sizeof(TCHAR)); + if (wcschr(tr.lpstrText, '@') != NULL && wcschr(tr.lpstrText, ':') == NULL && wcschr(tr.lpstrText, '/') == NULL) { + memmove(tr.lpstrText + 7, tr.lpstrText, (tr.chrg.cpMax - tr.chrg.cpMin + 1) * sizeof(wchar_t)); + memcpy(tr.lpstrText, L"mailto:", 7 * sizeof(wchar_t)); } if (((ENLINK *)lParam)->msg == WM_RBUTTONDOWN) { @@ -1546,8 +1546,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l case IDM_COPYLINK: if (OpenClipboard(hwndDlg)) { EmptyClipboard(); - HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, (mir_tstrlen(tr.lpstrText) + 1) * sizeof(TCHAR)); - mir_tstrcpy((TCHAR*)GlobalLock(hData), tr.lpstrText); + HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, (mir_tstrlen(tr.lpstrText) + 1) * sizeof(wchar_t)); + mir_tstrcpy((wchar_t*)GlobalLock(hData), tr.lpstrText); GlobalUnlock(hData); SetClipboardData(CF_UNICODETEXT, hData); CloseClipboard(); @@ -1586,7 +1586,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l // save string from the editor if (dat->hContact) { int len = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE)) + 1; - TCHAR *msg = (TCHAR*)alloca(sizeof(TCHAR)*len); + wchar_t *msg = (wchar_t*)alloca(sizeof(wchar_t)*len); GetDlgItemText(hwndDlg, IDC_MESSAGE, msg, len); if (msg[0]) db_set_ts(dat->hContact, SRMSGMOD, DBSAVEDMSG, msg); diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index c40c4eb27f..62ab631a35 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -50,10 +50,10 @@ struct LogStreamData static int logPixelSY; static char szSep2[40], szSep2_RTL[50]; -static const TCHAR *bbcodes[] = { L"[b]", L"[i]", L"[u]", L"[s]", L"[/b]", L"[/i]", L"[/u]", L"[/s]" }; +static const wchar_t *bbcodes[] = { L"[b]", L"[i]", L"[u]", L"[s]", L"[/b]", L"[/i]", L"[/u]", L"[/s]" }; static const char *bbcodefmt[] = { "\\b ", "\\i ", "\\ul ", "\\strike ", "\\b0 ", "\\i0 ", "\\ul0 ", "\\strike0 " }; -static void AppendPlainUnicode(CMStringA &buf, const TCHAR *str) +static void AppendPlainUnicode(CMStringA &buf, const wchar_t *str) { for (; *str; str++) { if (*str < 128) @@ -63,7 +63,7 @@ static void AppendPlainUnicode(CMStringA &buf, const TCHAR *str) } } -static void AppendToBufferWithRTF(CMStringA &buf, const TCHAR *line) +static void AppendToBufferWithRTF(CMStringA &buf, const wchar_t *line) { if (line == NULL) return; @@ -90,7 +90,7 @@ static void AppendToBufferWithRTF(CMStringA &buf, const TCHAR *line) for (i = 0; i < _countof(bbcodes); ++i) { if (line[1] == bbcodes[i][1]) { size_t lenb = mir_tstrlen(bbcodes[i]); - if (!_tcsnicmp(line, bbcodes[i], lenb)) { + if (!wcsnicmp(line, bbcodes[i], lenb)) { buf.Append(bbcodefmt[i]); line += lenb - 1; found = 1; @@ -99,15 +99,15 @@ static void AppendToBufferWithRTF(CMStringA &buf, const TCHAR *line) } } if (!found) { - if (!_tcsnicmp(line, L"[url", 4)) { - const TCHAR* tag = _tcschr(line + 4, ']'); + if (!wcsnicmp(line, L"[url", 4)) { + const wchar_t* tag = wcschr(line + 4, ']'); if (tag) { - const TCHAR *tagu = (line[4] == '=') ? line + 5 : tag + 1; - const TCHAR *tage = _tcsstr(tag, L"[/url]"); - if (!tage) tage = _tcsstr(tag, L"[/URL]"); + const wchar_t *tagu = (line[4] == '=') ? line + 5 : tag + 1; + const wchar_t *tage = wcsstr(tag, L"[/url]"); + if (!tage) tage = wcsstr(tag, L"[/URL]"); if (tage) { - *(TCHAR*)tag = 0; - *(TCHAR*)tage = 0; + *(wchar_t*)tag = 0; + *(wchar_t*)tage = 0; buf.Append("{\\field{\\*\\fldinst HYPERLINK \""); AppendPlainUnicode(buf, tagu); buf.Append("\"}{\\fldrslt "); @@ -118,14 +118,14 @@ static void AppendToBufferWithRTF(CMStringA &buf, const TCHAR *line) } } } - else if (!_tcsnicmp(line, L"[color=", 7)) { - const TCHAR* tag = _tcschr(line + 7, ']'); + else if (!wcsnicmp(line, L"[color=", 7)) { + const wchar_t* tag = wcschr(line + 7, ']'); if (tag) { line = tag; found = 1; } } - else if (!_tcsnicmp(line, L"[/color]", 8)) { + else if (!wcsnicmp(line, L"[/color]", 8)) { line += 7; found = 1; } @@ -254,8 +254,8 @@ static char* CreateRTFFromDbEvent(SrmmWindowData *dat, MCONTACT hContact, MEVENT } if (g_dat.flags & SMF_SHOWTIME) { - const TCHAR* szFormat; - TCHAR str[64]; + const wchar_t* szFormat; + wchar_t str[64]; if (g_dat.flags & SMF_SHOWSECS) szFormat = g_dat.flags & SMF_SHOWDATE ? L"d s" : L"s"; @@ -270,11 +270,11 @@ static char* CreateRTFFromDbEvent(SrmmWindowData *dat, MCONTACT hContact, MEVENT } if (!(g_dat.flags & SMF_HIDENAMES) && dbei.eventType != EVENTTYPE_JABBER_CHATSTATES && dbei.eventType != EVENTTYPE_JABBER_PRESENCE) { - TCHAR *szName; + wchar_t *szName; if (dbei.flags & DBEF_SENT) { - if (TCHAR *p = Contact_GetInfo(CNF_DISPLAY, NULL, dbei.szModule)) - szName = NEWTSTR_ALLOCA(p); + if (wchar_t *p = Contact_GetInfo(CNF_DISPLAY, NULL, dbei.szModule)) + szName = NEWWSTR_ALLOCA(p); else szName = TranslateT("Me"); } @@ -288,13 +288,13 @@ static char* CreateRTFFromDbEvent(SrmmWindowData *dat, MCONTACT hContact, MEVENT if (showColon) buffer.AppendFormat("%s :", SetToStyle(dbei.flags & DBEF_SENT ? MSGFONTID_MYCOLON : MSGFONTID_YOURCOLON)); - TCHAR *msg, *szName; + wchar_t *msg, *szName; switch (dbei.eventType) { case EVENTTYPE_JABBER_CHATSTATES: case EVENTTYPE_JABBER_PRESENCE: if (dbei.flags & DBEF_SENT) { - if (TCHAR *p = Contact_GetInfo(CNF_DISPLAY, NULL, dbei.szModule)) { - szName = NEWTSTR_ALLOCA(p); + if (wchar_t *p = Contact_GetInfo(CNF_DISPLAY, NULL, dbei.szModule)) { + szName = NEWWSTR_ALLOCA(p); mir_free(p); } else szName = L""; diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp index b14d0ec51b..52bfb5f630 100644 --- a/src/core/stdmsg/src/msgoptions.cpp +++ b/src/core/stdmsg/src/msgoptions.cpp @@ -26,27 +26,27 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct FontOptionsList { - const TCHAR* szDescr; + const wchar_t* szDescr; COLORREF defColour; - const TCHAR* szDefFace; + const wchar_t* szDefFace; BYTE defStyle; char defSize; } static const fontOptionsList[] = { - { LPGENT("Outgoing messages"), RGB(106, 106, 106), L"Arial", 0, -12}, - { LPGENT("Incoming messages"), RGB(0, 0, 0), L"Arial", 0, -12}, - { LPGENT("Outgoing name"), RGB(89, 89, 89), L"Arial", DBFONTF_BOLD, -12}, - { LPGENT("Outgoing time"), RGB(0, 0, 0), L"Terminal", DBFONTF_BOLD, -9}, - { LPGENT("Outgoing colon"), RGB(89, 89, 89), L"Arial", 0, -11}, - { LPGENT("Incoming name"), RGB(215, 0, 0), L"Arial", DBFONTF_BOLD, -12}, - { LPGENT("Incoming time"), RGB(0, 0, 0), L"Terminal", DBFONTF_BOLD, -9}, - { LPGENT("Incoming colon"), RGB(215, 0, 0), L"Arial", 0, -11}, - { LPGENT("Message area"), RGB(0, 0, 0), L"Arial", 0, -12}, - { LPGENT("Other events"), RGB(90, 90, 160), L"Arial", 0, -12}, + { LPGENW("Outgoing messages"), RGB(106, 106, 106), L"Arial", 0, -12}, + { LPGENW("Incoming messages"), RGB(0, 0, 0), L"Arial", 0, -12}, + { LPGENW("Outgoing name"), RGB(89, 89, 89), L"Arial", DBFONTF_BOLD, -12}, + { LPGENW("Outgoing time"), RGB(0, 0, 0), L"Terminal", DBFONTF_BOLD, -9}, + { LPGENW("Outgoing colon"), RGB(89, 89, 89), L"Arial", 0, -11}, + { LPGENW("Incoming name"), RGB(215, 0, 0), L"Arial", DBFONTF_BOLD, -12}, + { LPGENW("Incoming time"), RGB(0, 0, 0), L"Terminal", DBFONTF_BOLD, -9}, + { LPGENW("Incoming colon"), RGB(215, 0, 0), L"Arial", 0, -11}, + { LPGENW("Message area"), RGB(0, 0, 0), L"Arial", 0, -12}, + { LPGENW("Other events"), RGB(90, 90, 160), L"Arial", 0, -12}, }; -static BYTE MsgDlgGetFontDefaultCharset(const TCHAR*) +static BYTE MsgDlgGetFontDefaultCharset(const wchar_t*) { return DEFAULT_CHARSET; } @@ -82,7 +82,7 @@ bool LoadMsgDlgFont(int i, LOGFONT* lf, COLORREF * colour) DBVARIANT dbv; if (db_get_ts(NULL, SRMMMOD, str, &dbv)) - _tcsncpy(lf->lfFaceName, fontOptionsList[i].szDefFace, _countof(lf->lfFaceName)-1); + wcsncpy(lf->lfFaceName, fontOptionsList[i].szDefFace, _countof(lf->lfFaceName)-1); else { mir_tstrncpy(lf->lfFaceName, dbv.ptszVal, _countof(lf->lfFaceName)); db_free(&dbv); @@ -101,8 +101,8 @@ void RegisterSRMMFonts(void) fontid.flags = FIDF_ALLOWREREGISTER | FIDF_DEFAULTVALID; for (int i = 0; i < _countof(fontOptionsList); i++) { strncpy_s(fontid.dbSettingsGroup, SRMMMOD, _TRUNCATE); - _tcsncpy_s(fontid.group, LPGENT("Message log"), _TRUNCATE); - _tcsncpy_s(fontid.name, fontOptionsList[i].szDescr, _TRUNCATE); + wcsncpy_s(fontid.group, LPGENW("Message log"), _TRUNCATE); + wcsncpy_s(fontid.name, fontOptionsList[i].szDescr, _TRUNCATE); mir_snprintf(idstr, "SRMFont%d", i); strncpy_s(fontid.prefix, idstr, _TRUNCATE); fontid.order = i; @@ -113,10 +113,10 @@ void RegisterSRMMFonts(void) fontid.deffontsettings.colour = fontOptionsList[i].defColour; fontid.deffontsettings.size = fontOptionsList[i].defSize; fontid.deffontsettings.style = fontOptionsList[i].defStyle; - _tcsncpy_s(fontid.deffontsettings.szFace, fontOptionsList[i].szDefFace, _TRUNCATE); + wcsncpy_s(fontid.deffontsettings.szFace, fontOptionsList[i].szDefFace, _TRUNCATE); fontid.deffontsettings.charset = MsgDlgGetFontDefaultCharset(fontOptionsList[i].szDefFace); - _tcsncpy_s(fontid.backgroundGroup, LPGENT("Message log"), _TRUNCATE); - _tcsncpy_s(fontid.backgroundName, LPGENT("Background"), _TRUNCATE); + wcsncpy_s(fontid.backgroundGroup, LPGENW("Message log"), _TRUNCATE); + wcsncpy_s(fontid.backgroundName, LPGENW("Background"), _TRUNCATE); FontRegisterT(&fontid); } @@ -124,8 +124,8 @@ void RegisterSRMMFonts(void) strncpy_s(colourid.dbSettingsGroup, SRMMMOD, _TRUNCATE); strncpy_s(colourid.setting, SRMSGSET_BKGCOLOUR, _TRUNCATE); colourid.defcolour = SRMSGDEFSET_BKGCOLOUR; - _tcsncpy_s(colourid.name, LPGENT("Background"), _TRUNCATE); - _tcsncpy_s(colourid.group, LPGENT("Message log"), _TRUNCATE); + wcsncpy_s(colourid.name, LPGENW("Background"), _TRUNCATE); + wcsncpy_s(colourid.group, LPGENW("Message log"), _TRUNCATE); ColourRegisterT(&colourid); } @@ -134,20 +134,20 @@ void RegisterSRMMFonts(void) struct CheckBoxValues_t { DWORD style; - TCHAR* szDescr; + wchar_t* szDescr; } statusValues[] = { - { 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) diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 7c9952c0ee..2b67cb4590 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -88,7 +88,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam) return 0; } - TCHAR toolTip[256]; + wchar_t toolTip[256]; mir_sntprintf(toolTip, TranslateT("Message from %s"), pcli->pfnGetContactDisplayName(hContact, 0)); CLISTEVENT cle = {}; @@ -166,7 +166,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam) if (hwnd) SendMessage(hwnd, DM_TYPING, 0, lParam); else if (lParam && (g_dat.flags & SMF_SHOWTYPINGTRAY)) { - TCHAR szTip[256]; + wchar_t szTip[256]; mir_sntprintf(szTip, TranslateT("%s is typing a message"), pcli->pfnGetContactDisplayName(hContact, 0)); if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY) && !(g_dat.flags & SMF_SHOWTYPINGCLIST)) { @@ -271,7 +271,7 @@ static void RestoreUnreadMessageAlerts(void) } } - TCHAR toolTip[256]; + wchar_t toolTip[256]; CLISTEVENT cle = {}; cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE); @@ -402,7 +402,7 @@ static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam) return 0; } -static TCHAR tszError[] = LPGENT("Miranda could not load the built-in message module, msftedit.dll is missing. Press 'Yes' to continue loading Miranda."); +static wchar_t tszError[] = LPGENW("Miranda could not load the built-in message module, msftedit.dll is missing. Press 'Yes' to continue loading Miranda."); int LoadSendRecvMessageModule(void) { diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index ac5c99a003..c034551fa9 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -65,7 +65,7 @@ struct SrmmWindowData : public MZeroedObject WORD wStatus; WORD wOldStatus; int cmdListInd; - LIST cmdList; + LIST cmdList; bool bIsAutoRTL, bIsMeta; WORD wMinute; @@ -126,7 +126,7 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar int DbEventIsForMsgWindow(DBEVENTINFO *dbei); int DbEventIsShown(DBEVENTINFO *dbei); void StreamInEvents(HWND hwndDlg, MEVENT hDbEventFirst, int count, int fAppend); -int SendMessageDirect(const TCHAR *szMsg, MCONTACT hContact, char *szProto); +int SendMessageDirect(const wchar_t *szMsg, MCONTACT hContact, char *szProto); INT_PTR SendMessageCmd(MCONTACT hContact, char *msg, int isWchar); void LoadMsgLogIcons(void); diff --git a/src/core/stdssl/src/netlibssl.cpp b/src/core/stdssl/src/netlibssl.cpp index d59c92c0ec..af0c2632e1 100644 --- a/src/core/stdssl/src/netlibssl.cpp +++ b/src/core/stdssl/src/netlibssl.cpp @@ -60,26 +60,26 @@ struct SslHandle static void ReportSslError(SECURITY_STATUS scRet, int line, bool = false) { - TCHAR szMsgBuf[256]; + wchar_t szMsgBuf[256]; switch (scRet) { case 0: case ERROR_NOT_READY: return; case SEC_E_INVALID_TOKEN: - _tcsncpy_s(szMsgBuf, TranslateT("Client cannot decode host message. Possible causes: host does not support SSL or requires not existing security package"), _TRUNCATE); + wcsncpy_s(szMsgBuf, TranslateT("Client cannot decode host message. Possible causes: host does not support SSL or requires not existing security package"), _TRUNCATE); break; case CERT_E_CN_NO_MATCH: case SEC_E_WRONG_PRINCIPAL: - _tcsncpy_s(szMsgBuf, TranslateT("Host we are connecting to is not the one certificate was issued for"), _TRUNCATE); + wcsncpy_s(szMsgBuf, TranslateT("Host we are connecting to is not the one certificate was issued for"), _TRUNCATE); break; default: FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, scRet, LANG_USER_DEFAULT, szMsgBuf, _countof(szMsgBuf), NULL); } - TCHAR szMsgBuf2[512]; + wchar_t szMsgBuf2[512]; mir_sntprintf(szMsgBuf2, L"SSL connection failure (%x %u): %s", scRet, line, szMsgBuf); char* szMsg = Utf8EncodeT(szMsgBuf2); diff --git a/src/core/stduihist/src/history.cpp b/src/core/stduihist/src/history.cpp index 6b4815309f..88acd91328 100644 --- a/src/core/stduihist/src/history.cpp +++ b/src/core/stduihist/src/history.cpp @@ -37,15 +37,15 @@ static HGENMENU hContactMenu = 0; ///////////////////////////////////////////////////////////////////////////////////////// // Fills the events list -static void GetMessageDescription(DBEVENTINFO *dbei, TCHAR* buf, int cbBuf) +static void GetMessageDescription(DBEVENTINFO *dbei, wchar_t* buf, int cbBuf) { - TCHAR *msg = DbGetEventTextT(dbei, CP_ACP); - _tcsncpy(buf, msg ? msg : TranslateT("Invalid message"), cbBuf); + wchar_t *msg = DbGetEventTextT(dbei, CP_ACP); + wcsncpy(buf, msg ? msg : TranslateT("Invalid message"), cbBuf); buf[ cbBuf-1 ] = 0; mir_free(msg); } -static void GetUrlDescription(DBEVENTINFO *dbei, TCHAR* buf, int cbBuf) +static void GetUrlDescription(DBEVENTINFO *dbei, wchar_t* buf, int cbBuf) { int len = dbei->cbBlob; if (len >= cbBuf) @@ -58,7 +58,7 @@ static void GetUrlDescription(DBEVENTINFO *dbei, TCHAR* buf, int cbBuf) mir_tstrcat(buf, L"\r\n"); } -static void GetFileDescription(DBEVENTINFO *dbei, TCHAR* buf, int cbBuf) +static void GetFileDescription(DBEVENTINFO *dbei, wchar_t* buf, int cbBuf) { int len = dbei->cbBlob - sizeof(DWORD); if (len >= cbBuf) @@ -71,7 +71,7 @@ static void GetFileDescription(DBEVENTINFO *dbei, TCHAR* buf, int cbBuf) mir_tstrcat(buf, L"\r\n"); } -static void GetObjectDescription(DBEVENTINFO *dbei, TCHAR* str, int cbStr) +static void GetObjectDescription(DBEVENTINFO *dbei, wchar_t* str, int cbStr) { switch(dbei->eventType) { case EVENTTYPE_MESSAGE: @@ -94,9 +94,9 @@ static void GetObjectDescription(DBEVENTINFO *dbei, TCHAR* str, int cbStr) *str = 0; } } -static void GetObjectSummary(DBEVENTINFO *dbei, TCHAR* str, int cbStr) +static void GetObjectSummary(DBEVENTINFO *dbei, wchar_t* str, int cbStr) { - TCHAR* pszSrc, *pszTmp = NULL; + wchar_t* pszSrc, *pszTmp = NULL; switch(dbei->eventType) { case EVENTTYPE_MESSAGE: @@ -125,7 +125,7 @@ static void GetObjectSummary(DBEVENTINFO *dbei, TCHAR* str, int cbStr) return; } - _tcsncpy(str, (const TCHAR*)pszSrc, cbStr); + wcsncpy(str, (const wchar_t*)pszSrc, cbStr); str[cbStr-1] = 0; mir_free(pszTmp); } @@ -161,7 +161,7 @@ static void FillHistoryThread(void* param) dbei.cbBlob = oldBlobSize; db_event_get(hDbEvent, &dbei); - TCHAR str[200], eventText[256], strdatetime[64]; + wchar_t str[200], eventText[256], strdatetime[64]; GetObjectSummary(&dbei, str, _countof(str)); if (str[0]) { TimeZone_PrintTimeStamp(NULL, dbei.timestamp, L"d t", strdatetime, _countof(strdatetime), 0); @@ -206,7 +206,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP WindowList_Add(hWindowList, hwndDlg, hContact); Utils_RestoreWindowPosition(hwndDlg, hContact, "History", ""); { - TCHAR* contactName, str[200]; + wchar_t* contactName, str[200]; contactName = pcli->pfnGetContactDisplayName(hContact, 0); mir_sntprintf(str, TranslateT("History for %s"), contactName); SetWindowText(hwndDlg, str); @@ -278,7 +278,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP if ((int)dbei.cbBlob != -1) { dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob); if (db_event_get(hDbEvent, &dbei) == 0) { - TCHAR str[8192]; + wchar_t str[8192]; GetObjectDescription(&dbei, str, _countof(str)); if (str[0]) SetDlgItemText(hwndDlg, IDC_EDIT, str); @@ -316,11 +316,11 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP dbei.cbBlob = oldBlobSize; db_event_get(hDbEvent, &dbei); - TCHAR str[1024]; + wchar_t str[1024]; GetObjectDescription(&dbei, str, _countof(str)); if (str[0]) { CharUpperBuff(str, (int)mir_tstrlen(str)); - if (_tcsstr(str, (const TCHAR*)lParam) != NULL) { + if (wcsstr(str, (const wchar_t*)lParam) != NULL) { SendDlgItemMessage(hwndDlg, IDC_LIST, LB_SETCURSEL, index, 0); SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_LIST, LBN_SELCHANGE), 0); break; @@ -349,7 +349,7 @@ static INT_PTR CALLBACK DlgProcHistoryFind(HWND hwndDlg, UINT msg, WPARAM wParam return TRUE; case IDOK://find Next - TCHAR str[128]; + wchar_t str[128]; HWND hwndParent = (HWND)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); GetDlgItemText(hwndDlg, IDC_FINDWHAT, str, _countof(str)); CharUpperBuff(str, (int)mir_tstrlen(str)); diff --git a/src/core/stduihist/src/stdafx.h b/src/core/stduihist/src/stdafx.h index 59f8cd87a8..084712b5f3 100644 --- a/src/core/stduihist/src/stdafx.h +++ b/src/core/stduihist/src/stdafx.h @@ -22,7 +22,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include #include #include #include diff --git a/src/core/stduserinfo/src/contactinfo.cpp b/src/core/stduserinfo/src/contactinfo.cpp index 1fc523b3ea..a125be13ef 100644 --- a/src/core/stduserinfo/src/contactinfo.cpp +++ b/src/core/stduserinfo/src/contactinfo.cpp @@ -171,7 +171,7 @@ static INT_PTR CALLBACK EditUserPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar return FALSE; } -static int IsOverEmail(HWND hwndDlg, TCHAR* szEmail, int cchEmail) +static int IsOverEmail(HWND hwndDlg, wchar_t* szEmail, int cchEmail) { HWND hwndEmails = GetDlgItem(hwndDlg, IDC_EMAILS); @@ -190,7 +190,7 @@ static int IsOverEmail(HWND hwndDlg, TCHAR* szEmail, int cchEmail) ListView_GetSubItemRect(hwndEmails, hti.iItem, 1, LVIR_LABEL, &rc); - TCHAR szText[256]; szText[0] = 0; + wchar_t szText[256]; szText[0] = 0; ListView_GetItemText(hwndEmails, hti.iItem, 1, szText, _countof(szText)); HDC hdc = GetDC(hwndEmails); @@ -264,7 +264,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP ListView_DeleteAllItems(GetDlgItem(hwndDlg, IDC_EMAILS)); char idstr[33]; - TCHAR idstr2[33]; + wchar_t idstr2[33]; DBVARIANT dbv; LVITEM lvi; @@ -400,7 +400,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP ListView_GetSubItemRect(nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, LVIR_LABEL, &rc); if (nm->iSubItem == 1 && nm->nmcd.hdr.idFrom == IDC_EMAILS) { HFONT hoFont; - TCHAR szText[256] = { 0 }; + wchar_t szText[256] = { 0 }; ListView_GetItemText(nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, szText, _countof(szText)); hoFont = (HFONT)SelectObject(nm->nmcd.hdc, hEmailFont); SetTextColor(nm->nmcd.hdc, RGB(0, 0, 255)); @@ -416,7 +416,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP else if (nm->iSubItem > 1 && nm->nmcd.lItemlParam != -1 && nm->nmcd.lItemlParam != -2) { static int iconResources[3] = { SKINICON_OTHER_RENAME, SKINICON_OTHER_DELETE }; if (nm->iSubItem == 2 && nm->nmcd.hdr.idFrom == IDC_PHONES) { - TCHAR szText[2]; + wchar_t szText[2]; ListView_GetItemText(nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, szText, _countof(szText)); if (szText[0]) hIcon = Skin_LoadIcon(SKINICON_OTHER_SMS); } @@ -436,9 +436,9 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); char *szIdTemplate = (nm->hdr.idFrom == IDC_PHONES) ? "MyPhone%d" : "Mye-mail%d"; - TCHAR szEmail[256]; + wchar_t szEmail[256]; if (IsOverEmail(hwndDlg, szEmail, _countof(szEmail))) { - TCHAR szExec[264]; + wchar_t szExec[264]; mir_sntprintf(szExec, L"mailto:%s", szEmail); ShellExecute(hwndDlg, L"open", szExec, NULL, NULL, SW_SHOW); break; diff --git a/src/core/stduserinfo/src/stdafx.h b/src/core/stduserinfo/src/stdafx.h index 9136d69408..4a07eca120 100644 --- a/src/core/stduserinfo/src/stdafx.h +++ b/src/core/stduserinfo/src/stdafx.h @@ -22,7 +22,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include #include #include #include diff --git a/src/core/stduserinfo/src/stdinfo.cpp b/src/core/stduserinfo/src/stdinfo.cpp index 4b93ab8cd1..100ea132d8 100644 --- a/src/core/stduserinfo/src/stdinfo.cpp +++ b/src/core/stduserinfo/src/stdinfo.cpp @@ -44,7 +44,7 @@ static int Proto_GetContactInfoSetting(MCONTACT hContact, const char *szProto, c return CallProtoService(szProto, PS_GETINFOSETTING, hContact, (LPARAM)&cgs); } -static TCHAR* Proto_GetContactInfoSettingStr(bool proto_service, MCONTACT hContact, const char *szModule, const char *szSetting) +static wchar_t* Proto_GetContactInfoSettingStr(bool proto_service, MCONTACT hContact, const char *szModule, const char *szSetting) { if (!proto_service) return db_get_tsa(hContact, szModule, szSetting); @@ -61,7 +61,7 @@ static TCHAR* Proto_GetContactInfoSettingStr(bool proto_service, MCONTACT hConta static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule, char *szSetting, int special) { char str[80], *pstr = NULL; - TCHAR *ptstr = NULL; + wchar_t *ptstr = NULL; char *szProto = GetContactProto(hContact); bool proto_service = szProto && (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_INFOSETTINGSVC); @@ -253,7 +253,7 @@ static INT_PTR CALLBACK SummaryDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP break; case IDC_EMAIL: if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_EMAIL))) { - TCHAR szExec[264], szEmail[256]; + wchar_t szExec[264], szEmail[256]; GetDlgItemText(hwndDlg, IDC_EMAIL, szEmail, _countof(szEmail)); mir_sntprintf(szExec, L"mailto:%s", szEmail); ShellExecute(hwndDlg, L"open", szExec, NULL, NULL, SW_SHOW); @@ -282,7 +282,7 @@ static INT_PTR CALLBACK LocationDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L { MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); if (hContact != NULL) { - TCHAR szTime[80]; + wchar_t szTime[80]; if (printDateTimeByContact(hContact, L"s", szTime, _countof(szTime), TZF_KNOWNONLY)) { EnableWindow(GetDlgItem(hwndDlg, IDC_LOCALTIME), FALSE); SetDlgItemText(hwndDlg, IDC_LOCALTIME, TranslateT("")); diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp index 9e3d50ddda..0de846052e 100644 --- a/src/core/stduserinfo/src/userinfo.cpp +++ b/src/core/stduserinfo/src/userinfo.cpp @@ -46,7 +46,7 @@ struct DetailsPageData HWND hwnd; HTREEITEM hItem; int changed, hLangpack; - TCHAR *ptszTitle, *ptszTab; + wchar_t *ptszTitle, *ptszTab; }; struct DetailsData @@ -60,24 +60,24 @@ struct DetailsData DetailsPageData *opd; RECT rcDisplay, rcDisplayTab; int updateAnimFrame; - TCHAR szUpdating[64]; + wchar_t szUpdating[64]; int *infosUpdated; }; -TCHAR* getTitle(OPTIONSDIALOGPAGE *p) +wchar_t* getTitle(OPTIONSDIALOGPAGE *p) { - return (p->flags & ODPF_DONTTRANSLATE) ? p->ptszTitle : TranslateTH(p->hLangpack, p->ptszTitle); + return (p->flags & ODPF_DONTTRANSLATE) ? p->pwszTitle : TranslateTH(p->hLangpack, p->pwszTitle); } -TCHAR* getTab(OPTIONSDIALOGPAGE *p) +wchar_t* getTab(OPTIONSDIALOGPAGE *p) { - return (p->flags & ODPF_DONTTRANSLATE) ? p->ptszTab : TranslateTH(p->hLangpack, p->ptszTab); + return (p->flags & ODPF_DONTTRANSLATE) ? p->pwszTab : TranslateTH(p->hLangpack, p->pwszTab); } static int PageSortProc(OPTIONSDIALOGPAGE *item1, OPTIONSDIALOGPAGE *item2) { int res; - TCHAR *s1 = getTitle(item1), *s2 = getTitle(item2); + wchar_t *s1 = getTitle(item1), *s2 = getTitle(item2); if (!mir_tstrcmp(s1, TranslateT("Summary"))) return -1; if (!mir_tstrcmp(s2, TranslateT("Summary"))) return 1; if (res = mir_tstrcmp(s1, s2)) return res; @@ -115,7 +115,7 @@ static INT_PTR ShowDetailsDialogCommand(WPARAM wParam, LPARAM) psh.hwndParent = NULL; psh.nPages = opi.pageCount; psh.pStartPage = 0; - psh.pszCaption = (TCHAR*)wParam; //more abuses of structure: this is hContact + psh.pszCaption = (wchar_t*)wParam; //more abuses of structure: this is hContact psh.ppsp = (PROPSHEETPAGE*)opi.odp; //blatent misuse of the structure, but what the hell CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DETAILS), NULL, DlgProcDetails, (LPARAM)&psh); @@ -147,12 +147,12 @@ static INT_PTR AddDetailsPage(WPARAM wParam, LPARAM lParam) dst->pszTemplate = ((DWORD_PTR)odp->pszTemplate & 0xFFFF0000) ? mir_strdup(odp->pszTemplate) : odp->pszTemplate; if (odp->flags & ODPF_UNICODE) { - dst->ptszTitle = (odp->ptszTitle == 0) ? NULL : mir_wstrdup(odp->ptszTitle); - dst->ptszTab = (!(odp->flags & ODPF_USERINFOTAB) || !odp->ptszTab) ? NULL : mir_wstrdup(odp->ptszTab); + dst->pwszTitle = (odp->pwszTitle == 0) ? NULL : mir_wstrdup(odp->pwszTitle); + dst->pwszTab = (!(odp->flags & ODPF_USERINFOTAB) || !odp->pwszTab) ? NULL : mir_wstrdup(odp->pwszTab); } else { - dst->ptszTitle = mir_a2t(odp->pszTitle); - dst->ptszTab = (!(odp->flags & ODPF_USERINFOTAB) || !odp->pszTab) ? NULL : mir_a2t(odp->pszTab); + dst->pwszTitle = mir_a2t(odp->pszTitle); + dst->pwszTab = (!(odp->flags & ODPF_USERINFOTAB) || !odp->pszTab) ? NULL : mir_a2t(odp->pszTab); } dst->hLangpack = odp->hLangpack; @@ -248,7 +248,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP WindowList_Add(hWindowList, hwndDlg, dat->hContact); ////////////////////////////////////////////////////////////////////// - TCHAR *name, oldTitle[256], newTitle[256]; + wchar_t *name, oldTitle[256], newTitle[256]; if (dat->hContact == NULL) name = TranslateT("Owner"); else @@ -269,7 +269,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP LPTSTR ptszLastTab; DBVARIANT dbv; if (!db_get_ts(NULL, "UserInfo", "LastTab", &dbv)) { - ptszLastTab = NEWTSTR_ALLOCA(dbv.ptszVal); + ptszLastTab = NEWWSTR_ALLOCA(dbv.ptszVal); db_free(&dbv); } else ptszLastTab = NULL; @@ -289,8 +289,8 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP p.dlgParam = odp[i].dwInitParam; p.hInst = odp[i].hInstance; - p.ptszTitle = odp[i].ptszTitle; - p.ptszTab = odp[i].ptszTab; + p.ptszTitle = odp[i].pwszTitle; + p.ptszTab = odp[i].pwszTab; p.hLangpack = odp[i].hLangpack; if (i && p.ptszTab && !mir_tstrcmp(dat->opd[i - 1].ptszTitle, p.ptszTitle)) { @@ -354,7 +354,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP return TRUE; case WM_TIMER: - TCHAR str[128]; + wchar_t str[128]; mir_sntprintf(str, L"%.*s%s%.*s", dat->updateAnimFrame % 10, L".........", dat->szUpdating, dat->updateAnimFrame % 10, L"........."); SetDlgItemText(hwndDlg, IDC_UPDATING, str); if (++dat->updateAnimFrame == UPDATEANIMFRAMES) @@ -580,7 +580,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP break; case WM_DESTROY: - TCHAR name[128]; + wchar_t name[128]; TVITEM tvi; tvi.mask = TVIF_TEXT; tvi.hItem = dat->opd[dat->currentPage].hItem; diff --git a/src/core/stduseronline/src/stdafx.h b/src/core/stduseronline/src/stdafx.h index 10177ae864..2fda33718c 100644 --- a/src/core/stduseronline/src/stdafx.h +++ b/src/core/stduseronline/src/stdafx.h @@ -22,7 +22,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include #include #include #include diff --git a/src/core/stduseronline/src/useronline.cpp b/src/core/stduseronline/src/useronline.cpp index 20ba0e68cf..6106fd64a4 100644 --- a/src/core/stduseronline/src/useronline.cpp +++ b/src/core/stduseronline/src/useronline.cpp @@ -57,7 +57,7 @@ static int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam) DWORD ticked = db_get_dw(NULL, "UserOnline", cws->szModule, GetTickCount()); // only play the sound (or show event) if this event happens at least 10 secs after the proto went from offline if (GetTickCount() - ticked > (1000*10)) { - TCHAR tooltip[256]; + wchar_t tooltip[256]; mir_sntprintf(tooltip, TranslateT("%s is online"), pcli->pfnGetContactDisplayName(hContact, 0)); CLISTEVENT cle = {}; -- cgit v1.2.3