summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/stdauth/src/auth.cpp10
-rw-r--r--src/core/stdauth/src/authdialogs.cpp48
-rw-r--r--src/core/stdautoaway/src/autoaway.cpp2
-rw-r--r--src/core/stdaway/src/awaymsg.cpp6
-rw-r--r--src/core/stdaway/src/sendmsg.cpp20
-rw-r--r--src/core/stdchat/src/manager.cpp2
-rw-r--r--src/core/stdchat/src/options.cpp8
-rw-r--r--src/core/stdchat/src/tools.cpp14
-rw-r--r--src/core/stdchat/src/window.cpp44
-rw-r--r--src/core/stdclist/src/clcpaint.cpp14
-rw-r--r--src/core/stdclist/src/contact.cpp2
-rw-r--r--src/core/stdcrypt/src/stdcrypt.h2
-rw-r--r--src/core/stdfile/src/file.cpp16
-rw-r--r--src/core/stdfile/src/fileexistsdlg.cpp26
-rw-r--r--src/core/stdfile/src/fileopts.cpp6
-rw-r--r--src/core/stdfile/src/filerecvdlg.cpp32
-rw-r--r--src/core/stdfile/src/filesenddlg.cpp36
-rw-r--r--src/core/stdfile/src/filexferdlg.cpp54
-rw-r--r--src/core/stdhelp/src/about.cpp4
-rw-r--r--src/core/stdmsg/src/msgdialog.cpp42
-rw-r--r--src/core/stdmsg/src/msglog.cpp6
-rw-r--r--src/core/stdmsg/src/msgoptions.cpp2
-rw-r--r--src/core/stdmsg/src/msgs.cpp6
-rw-r--r--src/core/stdmsg/src/msgtimedout.cpp6
-rw-r--r--src/core/stdssl/src/netlibssl.cpp2
-rw-r--r--src/core/stduihist/src/history.cpp14
-rw-r--r--src/core/stduserinfo/src/contactinfo.cpp18
-rw-r--r--src/core/stduserinfo/src/stdinfo.cpp18
-rw-r--r--src/core/stduserinfo/src/userinfo.cpp28
-rw-r--r--src/core/stduseronline/src/useronline.cpp2
-rw-r--r--src/mir_app/src/BaseExtraIcon.cpp4
-rw-r--r--src/mir_app/src/ExtraIcon.h4
-rw-r--r--src/mir_app/src/ExtraIconGroup.cpp2
-rw-r--r--src/mir_app/src/FontOptions.cpp38
-rw-r--r--src/mir_app/src/IcoLib.h2
-rw-r--r--src/mir_app/src/addcontact.cpp18
-rw-r--r--src/mir_app/src/button.cpp12
-rw-r--r--src/mir_app/src/chat_clist.cpp18
-rw-r--r--src/mir_app/src/chat_log.cpp20
-rw-r--r--src/mir_app/src/chat_manager.cpp60
-rw-r--r--src/mir_app/src/chat_opts.cpp10
-rw-r--r--src/mir_app/src/chat_rtf.cpp2
-rw-r--r--src/mir_app/src/chat_svc.cpp16
-rw-r--r--src/mir_app/src/chat_tools.cpp94
-rw-r--r--src/mir_app/src/clc.cpp20
-rw-r--r--src/mir_app/src/clcfiledrop.cpp16
-rw-r--r--src/mir_app/src/clcitems.cpp28
-rw-r--r--src/mir_app/src/clcmsgs.cpp10
-rw-r--r--src/mir_app/src/clcutils.cpp22
-rw-r--r--src/mir_app/src/clistevents.cpp2
-rw-r--r--src/mir_app/src/clistgroups.cpp44
-rw-r--r--src/mir_app/src/clistmod.cpp2
-rw-r--r--src/mir_app/src/clistsettings.cpp22
-rw-r--r--src/mir_app/src/clisttray.cpp32
-rw-r--r--src/mir_app/src/clui.cpp22
-rw-r--r--src/mir_app/src/cluiservices.cpp12
-rw-r--r--src/mir_app/src/contacts.cpp12
-rw-r--r--src/mir_app/src/database.cpp58
-rw-r--r--src/mir_app/src/dbini.cpp46
-rw-r--r--src/mir_app/src/dbutils.cpp34
-rw-r--r--src/mir_app/src/descbutton.cpp12
-rw-r--r--src/mir_app/src/encrypt.cpp4
-rw-r--r--src/mir_app/src/enterstring.cpp6
-rw-r--r--src/mir_app/src/extraicons.cpp6
-rw-r--r--src/mir_app/src/filter.cpp18
-rw-r--r--src/mir_app/src/filter.h6
-rw-r--r--src/mir_app/src/findadd.cpp22
-rw-r--r--src/mir_app/src/headerbar.cpp8
-rw-r--r--src/mir_app/src/hotkey_opts.cpp26
-rw-r--r--src/mir_app/src/hotkeys.cpp12
-rw-r--r--src/mir_app/src/icolib.cpp16
-rw-r--r--src/mir_app/src/iconheader.cpp8
-rw-r--r--src/mir_app/src/langpack.cpp10
-rw-r--r--src/mir_app/src/lpopts.cpp12
-rw-r--r--src/mir_app/src/menu_clist.cpp18
-rw-r--r--src/mir_app/src/menu_options.cpp22
-rw-r--r--src/mir_app/src/menu_utils.cpp22
-rw-r--r--src/mir_app/src/meta_addto.cpp6
-rw-r--r--src/mir_app/src/meta_menu.cpp2
-rw-r--r--src/mir_app/src/meta_services.cpp2
-rw-r--r--src/mir_app/src/meta_utils.cpp6
-rw-r--r--src/mir_app/src/movetogroup.cpp10
-rw-r--r--src/mir_app/src/netlib.cpp2
-rw-r--r--src/mir_app/src/netlibhttp.cpp6
-rw-r--r--src/mir_app/src/netliblog.cpp14
-rw-r--r--src/mir_app/src/netlibopts.cpp2
-rw-r--r--src/mir_app/src/netlibsecurity.cpp32
-rw-r--r--src/mir_app/src/newplugins.cpp30
-rw-r--r--src/mir_app/src/options.cpp64
-rw-r--r--src/mir_app/src/path.cpp42
-rw-r--r--src/mir_app/src/pluginopts.cpp34
-rw-r--r--src/mir_app/src/profilemanager.cpp48
-rw-r--r--src/mir_app/src/proto_accs.cpp4
-rw-r--r--src/mir_app/src/proto_internal.cpp18
-rw-r--r--src/mir_app/src/proto_opts.cpp36
-rw-r--r--src/mir_app/src/proto_ui.cpp8
-rw-r--r--src/mir_app/src/proto_utils.cpp2
-rw-r--r--src/mir_app/src/protocols.cpp4
-rw-r--r--src/mir_app/src/searchresults.cpp20
-rw-r--r--src/mir_app/src/services.cpp14
-rw-r--r--src/mir_app/src/skin2opts.cpp60
-rw-r--r--src/mir_app/src/skinicons.cpp6
-rw-r--r--src/mir_app/src/sounds.cpp20
-rw-r--r--src/mir_app/src/srmm_statusicon.cpp8
-rw-r--r--src/mir_app/src/xmlParser.cpp2
-rw-r--r--src/mir_core/src/bitmaps.cpp2
-rw-r--r--src/mir_core/src/db.cpp2
-rw-r--r--src/mir_core/src/hyperlink.cpp2
-rw-r--r--src/mir_core/src/langpack.cpp18
-rw-r--r--src/mir_core/src/logger.cpp6
-rw-r--r--src/mir_core/src/miranda.cpp4
-rw-r--r--src/mir_core/src/openurl.cpp6
-rw-r--r--src/mir_core/src/path.cpp4
-rw-r--r--src/mir_core/src/timezones.cpp16
-rw-r--r--src/mir_core/src/ui_utils.cpp14
-rw-r--r--src/mir_core/src/winver.cpp6
116 files changed, 986 insertions, 996 deletions
diff --git a/src/core/stdauth/src/auth.cpp b/src/core/stdauth/src/auth.cpp
index 191031062c..1548bb7b5f 100644
--- a/src/core/stdauth/src/auth.cpp
+++ b/src/core/stdauth/src/auth.cpp
@@ -65,14 +65,14 @@ static int AuthEventAdded(WPARAM, LPARAM lParam)
cli.lParam = lParam;
cli.hDbEvent = hDbEvent;
- ptrT szUid(Contact_GetInfo(CNF_UNIQUEID, hContact));
+ ptrW szUid(Contact_GetInfo(CNF_UNIQUEID, hContact));
if (dbei.eventType == EVENTTYPE_AUTHREQUEST) {
SkinPlaySound("AuthRequest");
if (szUid)
- mir_sntprintf(szTooltip, TranslateT("%s requests authorization"), szUid);
+ mir_snwprintf(szTooltip, TranslateT("%s requests authorization"), szUid);
else
- mir_sntprintf(szTooltip, TranslateT("%u requests authorization"), *(PDWORD)dbei.pBlob);
+ mir_snwprintf(szTooltip, TranslateT("%u requests authorization"), *(PDWORD)dbei.pBlob);
cli.hIcon = Skin_LoadIcon(SKINICON_AUTH_REQUEST);
cli.pszService = MS_AUTH_SHOWREQUEST;
@@ -81,9 +81,9 @@ static int AuthEventAdded(WPARAM, LPARAM lParam)
else if (dbei.eventType == EVENTTYPE_ADDED) {
SkinPlaySound("AddedEvent");
if (szUid)
- mir_sntprintf(szTooltip, TranslateT("%s added you to their contact list"), szUid);
+ mir_snwprintf(szTooltip, TranslateT("%s added you to their contact list"), szUid);
else
- mir_sntprintf(szTooltip, TranslateT("%u added you to their contact list"), *(PDWORD)dbei.pBlob);
+ mir_snwprintf(szTooltip, TranslateT("%u added you to their contact list"), *(PDWORD)dbei.pBlob);
cli.hIcon = Skin_LoadIcon(SKINICON_AUTH_ADD);
cli.pszService = MS_AUTH_SHOWADDED;
diff --git a/src/core/stdauth/src/authdialogs.cpp b/src/core/stdauth/src/authdialogs.cpp
index 86f9db4ec4..fca48a396a 100644
--- a/src/core/stdauth/src/authdialogs.cpp
+++ b/src/core/stdauth/src/authdialogs.cpp
@@ -55,22 +55,22 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
PROTOACCOUNT* acc = Proto_GetAccount(dbei.szModule);
- 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);
+ wchar_t* lastT = dbei.flags & DBEF_UTF ? Utf8DecodeT(last) : mir_a2u(last);
+ wchar_t* firstT = dbei.flags & DBEF_UTF ? Utf8DecodeT(first) : mir_a2u(first);
+ wchar_t* nickT = dbei.flags & DBEF_UTF ? Utf8DecodeT(nick) : mir_a2u(nick);
+ wchar_t* emailT = dbei.flags & DBEF_UTF ? Utf8DecodeT(email) : mir_a2u(email);
wchar_t name[128] = L"";
int off = 0;
if (firstT[0] && lastT[0])
- off = mir_sntprintf(name, L"%s %s", firstT, lastT);
+ off = mir_snwprintf(name, L"%s %s", firstT, lastT);
else if (firstT[0])
- off = mir_sntprintf(name, L"%s", firstT);
+ off = mir_snwprintf(name, L"%s", firstT);
else if (lastT[0])
- off = mir_sntprintf(name, L"%s", lastT);
+ off = mir_snwprintf(name, L"%s", lastT);
if (nickT[0]) {
if (off)
- mir_sntprintf(name + off, _countof(name) - off, L" (%s)", nickT);
+ mir_snwprintf(name + off, _countof(name) - off, L" (%s)", nickT);
else
wcsncpy_s(name, nickT, _TRUNCATE);
}
@@ -79,11 +79,11 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
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);
+ mir_snwprintf(hdr, TranslateT("%s added you to the contact list\n%u (%s) on %s"), name, uin, emailT, acc->tszAccountName);
else if (uin)
- mir_sntprintf(hdr, TranslateT("%s added you to the contact list\n%u on %s"), name, uin, acc->tszAccountName);
+ mir_snwprintf(hdr, TranslateT("%s added you to the contact list\n%u on %s"), name, uin, acc->tszAccountName);
else
- mir_sntprintf(hdr, TranslateT("%s added you to the contact list\n%s on %s"), name, emailT[0] ? emailT : TranslateT("(Unknown)"), acc->tszAccountName);
+ mir_snwprintf(hdr, TranslateT("%s added you to the contact list\n%s on %s"), name, emailT[0] ? emailT : TranslateT("(Unknown)"), acc->tszAccountName);
SetDlgItemText(hwndDlg, IDC_HEADERBAR, hdr);
@@ -179,23 +179,23 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
PROTOACCOUNT *acc = Proto_GetAccount(dbei.szModule);
- ptrT lastT(dbei.flags & DBEF_UTF ? Utf8DecodeT(last) : mir_a2t(last));
- ptrT firstT(dbei.flags & DBEF_UTF ? Utf8DecodeT(first) : mir_a2t(first));
- ptrT nickT(dbei.flags & DBEF_UTF ? Utf8DecodeT(nick) : mir_a2t(nick));
- ptrT emailT(dbei.flags & DBEF_UTF ? Utf8DecodeT(email) : mir_a2t(email));
- ptrT reasonT(dbei.flags & DBEF_UTF ? Utf8DecodeT(reason) : mir_a2t(reason));
+ ptrW lastT(dbei.flags & DBEF_UTF ? Utf8DecodeT(last) : mir_a2u(last));
+ ptrW firstT(dbei.flags & DBEF_UTF ? Utf8DecodeT(first) : mir_a2u(first));
+ ptrW nickT(dbei.flags & DBEF_UTF ? Utf8DecodeT(nick) : mir_a2u(nick));
+ ptrW emailT(dbei.flags & DBEF_UTF ? Utf8DecodeT(email) : mir_a2u(email));
+ ptrW reasonT(dbei.flags & DBEF_UTF ? Utf8DecodeT(reason) : mir_a2u(reason));
wchar_t name[128] = L"";
int off = 0;
if (firstT[0] && lastT[0])
- off = mir_sntprintf(name, L"%s %s", (wchar_t*)firstT, (wchar_t*)lastT);
+ off = mir_snwprintf(name, L"%s %s", (wchar_t*)firstT, (wchar_t*)lastT);
else if (firstT[0])
- off = mir_sntprintf(name, L"%s", (wchar_t*)firstT);
+ off = mir_snwprintf(name, L"%s", (wchar_t*)firstT);
else if (lastT[0])
- off = mir_sntprintf(name, L"%s", (wchar_t*)lastT);
- if (mir_tstrlen(nickT)) {
+ off = mir_snwprintf(name, L"%s", (wchar_t*)lastT);
+ if (mir_wstrlen(nickT)) {
if (off)
- mir_sntprintf(name + off, _countof(name) - off, L" (%s)", (wchar_t*)nickT);
+ mir_snwprintf(name + off, _countof(name) - off, L" (%s)", (wchar_t*)nickT);
else
wcsncpy_s(name, nickT, _TRUNCATE);
}
@@ -204,11 +204,11 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
wchar_t hdr[256];
if (uin && emailT[0])
- mir_sntprintf(hdr, TranslateT("%s requested authorization\n%u (%s) on %s"), name, uin, (wchar_t*)emailT, acc->tszAccountName);
+ mir_snwprintf(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);
+ mir_snwprintf(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] ? (wchar_t*)emailT : TranslateT("(Unknown)"), acc->tszAccountName);
+ mir_snwprintf(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);
diff --git a/src/core/stdautoaway/src/autoaway.cpp b/src/core/stdautoaway/src/autoaway.cpp
index 2a490ba693..9add845204 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((wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGW, status, (LPARAM)szProto));
+ ptrW awayMsg((wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGW, status, (LPARAM)szProto));
CallProtoService(szProto, PS_SETAWAYMSG, status, awayMsg);
}
diff --git a/src/core/stdaway/src/awaymsg.cpp b/src/core/stdaway/src/awaymsg.cpp
index b51b6f4d7a..141dfc56c1 100644
--- a/src/core/stdaway/src/awaymsg.cpp
+++ b/src/core/stdaway/src/awaymsg.cpp
@@ -61,11 +61,11 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP
wchar_t *status = pcli->pfnGetStatusModeDescription(dwStatus, 0);
GetWindowText(hwndDlg, format, _countof(format));
- mir_sntprintf(str, format, status, contactName);
+ mir_snwprintf(str, format, status, contactName);
SetWindowText(hwndDlg, str);
GetDlgItemText(hwndDlg, IDC_RETRIEVING, format, _countof(format));
- mir_sntprintf(str, format, status);
+ mir_snwprintf(str, format, status);
SetDlgItemText(hwndDlg, IDC_RETRIEVING, str);
Window_SetProtoIcon_IcoLib(hwndDlg, szProto, dwStatus);
@@ -141,7 +141,7 @@ static int AwayMsgPreBuildMenu(WPARAM hContact, LPARAM)
if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGRECV) {
if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(status)) {
wchar_t str[128];
- mir_sntprintf(str, TranslateT("Re&ad %s message"), pcli->pfnGetStatusModeDescription(status, 0));
+ mir_snwprintf(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 a3f2968588..409e598a07 100644
--- a/src/core/stdaway/src/sendmsg.cpp
+++ b/src/core/stdaway/src/sendmsg.cpp
@@ -90,11 +90,11 @@ static wchar_t* GetAwayMessage(int statusMode, char *szProto)
DBVARIANT dbv;
if ( GetStatusModeByte(statusMode, "UsePrev")) {
if ( db_get_ts(NULL, "SRAway", StatusModeToDbSetting(statusMode, "Msg"), &dbv))
- dbv.ptszVal = mir_tstrdup(GetDefaultMessage(statusMode));
+ dbv.ptszVal = mir_wstrdup(GetDefaultMessage(statusMode));
}
else {
if ( db_get_ts(NULL, "SRAway", StatusModeToDbSetting(statusMode, "Default"), &dbv))
- dbv.ptszVal = mir_tstrdup(GetDefaultMessage(statusMode));
+ dbv.ptszVal = mir_wstrdup(GetDefaultMessage(statusMode));
for (int i=0; dbv.ptszVal[i]; i++) {
if (dbv.ptszVal[i] != '%')
@@ -121,10 +121,10 @@ static wchar_t* GetAwayMessage(int statusMode, char *szProto)
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, substituteStr, _countof(substituteStr));
else continue;
- if (mir_tstrlen(substituteStr) > 6)
- 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));
+ if (mir_wstrlen(substituteStr) > 6)
+ dbv.ptszVal = (wchar_t*)mir_realloc(dbv.ptszVal, (mir_wstrlen(dbv.ptszVal) + 1 + mir_wstrlen(substituteStr) - 6) * sizeof(wchar_t));
+ memmove(dbv.ptszVal + i + mir_wstrlen(substituteStr), dbv.ptszVal + i + 6, (mir_wstrlen(dbv.ptszVal) - i - 5) * sizeof(wchar_t));
+ memcpy(dbv.ptszVal+i, substituteStr, mir_wstrlen(substituteStr) * sizeof(wchar_t));
}
}
return dbv.ptszVal;
@@ -226,7 +226,7 @@ static INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
{
wchar_t str[256], format[128];
GetWindowText(hwndDlg, format, _countof(format));
- mir_sntprintf(str, format, pcli->pfnGetStatusModeDescription(dat->statusMode, 0));
+ mir_snwprintf(str, format, pcli->pfnGetStatusModeDescription(dat->statusMode, 0));
SetWindowText(hwndDlg, str);
}
GetDlgItemText(hwndDlg, IDOK, dat->okButtonFormat, _countof(dat->okButtonFormat));
@@ -247,7 +247,7 @@ static INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
case WM_TIMER:
if (--dat->countdown >= 0) {
wchar_t str[64];
- mir_sntprintf(str, dat->okButtonFormat, dat->countdown);
+ mir_snwprintf(str, dat->okButtonFormat, dat->countdown);
SetDlgItemText(hwndDlg, IDOK, str);
}
else {
@@ -397,8 +397,8 @@ static INT_PTR CALLBACK DlgProcAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam
DBVARIANT dbv;
if (db_get_ts(NULL, "SRAway", StatusModeToDbSetting(statusModes[i], "Default"), &dbv))
if (db_get_ts(NULL, "SRAway", StatusModeToDbSetting(statusModes[i], "Msg"), &dbv))
- dbv.ptszVal = mir_tstrdup(GetDefaultMessage(statusModes[i]));
- mir_tstrcpy(dat->info[j].msg, dbv.ptszVal);
+ dbv.ptszVal = mir_wstrdup(GetDefaultMessage(statusModes[i]));
+ mir_wstrcpy(dat->info[j].msg, dbv.ptszVal);
mir_free(dbv.ptszVal);
}
if (hLst)
diff --git a/src/core/stdchat/src/manager.cpp b/src/core/stdchat/src/manager.cpp
index bc901042e8..069e2230a9 100644
--- a/src/core/stdchat/src/manager.cpp
+++ b/src/core/stdchat/src/manager.cpp
@@ -86,7 +86,7 @@ BOOL TabM_AddTab(const wchar_t *pszID, const char* pszModule)
node = (TABLIST*)mir_alloc(sizeof(TABLIST));
memset(node, 0, sizeof(TABLIST));
- node->pszID = mir_tstrdup(pszID);
+ node->pszID = mir_wstrdup(pszID);
node->pszModule = mir_strdup(pszModule);
if (g_TabList == NULL) { // list is empty
diff --git a/src/core/stdchat/src/options.cpp b/src/core/stdchat/src/options.cpp
index 5ce45f72ce..79ea5fc3d2 100644
--- a/src/core/stdchat/src/options.cpp
+++ b/src/core/stdchat/src/options.cpp
@@ -324,10 +324,10 @@ static void InitSetting(wchar_t** ppPointer, char* pszSetting, wchar_t* pszDefau
{
DBVARIANT dbv;
if (!db_get_ts(NULL, CHAT_MODULE, pszSetting, &dbv)) {
- replaceStrT(*ppPointer, dbv.ptszVal);
+ replaceStrW(*ppPointer, dbv.ptszVal);
db_free(&dbv);
}
- else replaceStrT(*ppPointer, pszDefault);
+ else replaceStrW(*ppPointer, pszDefault);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -542,9 +542,9 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam,
LPITEMIDLIST idList = SHBrowseForFolder(&bi);
if (idList) {
SHGetPathFromIDList(idList, szDirectory);
- mir_tstrcat(szDirectory, L"\\");
+ mir_wstrcat(szDirectory, L"\\");
PathToRelativeT(szDirectory, szTemp);
- SetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, mir_tstrlen(szTemp) > 1 ? szTemp : L"Logs\\");
+ SetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, mir_wstrlen(szTemp) > 1 ? szTemp : L"Logs\\");
CoTaskMemFree(idList);
}
}
diff --git a/src/core/stdchat/src/tools.cpp b/src/core/stdchat/src/tools.cpp
index 12731649f2..3568f75caf 100644
--- a/src/core/stdchat/src/tools.cpp
+++ b/src/core/stdchat/src/tools.cpp
@@ -51,9 +51,9 @@ bool LoadMessageFont(LOGFONT *lf, COLORREF *colour)
DBVARIANT dbv;
if (db_get_ts(NULL, "SRMM", str, &dbv))
- mir_tstrcpy(lf->lfFaceName, L"Arial");
+ mir_wstrcpy(lf->lfFaceName, L"Arial");
else {
- mir_tstrncpy(lf->lfFaceName, dbv.ptszVal, _countof(lf->lfFaceName));
+ mir_wstrncpy(lf->lfFaceName, dbv.ptszVal, _countof(lf->lfFaceName));
db_free(&dbv);
}
mir_snprintf(str, "SRMFont%dSet", i);
@@ -135,7 +135,7 @@ UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO
if (pszWordText && pszWordText[0]) {
wchar_t szMenuText[4096];
- mir_sntprintf(szMenuText, TranslateT("Look up '%s':"), pszWordText);
+ mir_snwprintf(szMenuText, TranslateT("Look up '%s':"), pszWordText);
ModifyMenu(*hMenu, 4, MF_STRING | MF_BYPOSITION, 4, szMenuText);
}
else ModifyMenu(*hMenu, 4, MF_STRING | MF_GRAYED | MF_BYPOSITION, 4, TranslateT("No word to look up"));
@@ -144,12 +144,12 @@ UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO
else if (iIndex == 0) {
wchar_t szTemp[50];
if (pszWordText)
- mir_sntprintf(szTemp, TranslateT("&Message %s"), pszWordText);
+ mir_snwprintf(szTemp, TranslateT("&Message %s"), pszWordText);
else
- mir_tstrncpy(szTemp, TranslateT("&Message"), _countof(szTemp) - 1);
+ mir_wstrncpy(szTemp, TranslateT("&Message"), _countof(szTemp) - 1);
- if (mir_tstrlen(szTemp) > 40)
- mir_tstrcpy(szTemp + 40, L"...");
+ if (mir_wstrlen(szTemp) > 40)
+ mir_wstrcpy(szTemp + 40, L"...");
ModifyMenu(*hMenu, ID_MESS, MF_STRING | MF_BYCOMMAND, ID_MESS, szTemp);
gcmi.Type = MENU_ON_NICKLIST;
}
diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp
index bf71ea9f90..b6b54681b8 100644
--- a/src/core/stdchat/src/window.cpp
+++ b/src/core/stdchat/src/window.cpp
@@ -390,10 +390,10 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
end++;
if (dat->szTabSave[0] == '\0')
- mir_tstrncpy(dat->szTabSave, pszText + start, end - start + 1);
+ mir_wstrncpy(dat->szTabSave, pszText + start, end - start + 1);
wchar_t *pszSelName = (wchar_t *)mir_alloc(sizeof(wchar_t)*(end - start + 1));
- mir_tstrncpy(pszSelName, pszText + start, end - start + 1);
+ mir_wstrncpy(pszSelName, pszText + start, end - start + 1);
wchar_t *pszName = pci->UM_FindUserAutoComplete(Parentsi->pUsers, dat->szTabSave, pszSelName);
if (pszName == NULL) {
@@ -996,7 +996,7 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, SESSION_INFO *si
}
if (tszBuf[0] == 0)
- mir_sntprintf(tszBuf, L"%s: %s\r\n%s: %s\r\n%s: %s",
+ mir_snwprintf(tszBuf, L"%s: %s\r\n%s: %s\r\n%s: %s",
TranslateT("Nickname"), ui->pszNick,
TranslateT("Unique ID"), ui->pszUID,
TranslateT("Status"), pci->TM_WordToString(si->pStatuses, ui->Status));
@@ -1314,17 +1314,17 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
wchar_t szTemp[100];
switch (si->iType) {
case GCW_CHATROOM:
- mir_sntprintf(szTemp,
+ mir_snwprintf(szTemp,
(si->nUsersInNicklist == 1) ? TranslateT("%s: chat room (%u user)") : TranslateT("%s: chat room (%u users)"),
si->ptszName, si->nUsersInNicklist);
break;
case GCW_PRIVMESS:
- mir_sntprintf(szTemp,
+ mir_snwprintf(szTemp,
(si->nUsersInNicklist == 1) ? TranslateT("%s: message session") : TranslateT("%s: message session (%u users)"),
si->ptszName, si->nUsersInNicklist);
break;
case GCW_SERVER:
- mir_sntprintf(szTemp, L"%s: Server", si->ptszName);
+ mir_snwprintf(szTemp, L"%s: Server", si->ptszName);
break;
}
SetWindowText(hwndDlg, szTemp);
@@ -1605,9 +1605,9 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
int insertat;
wchar_t szTemp[30];
- mir_tstrncpy(szTemp, s1->ptszName, 21);
- if (mir_tstrlen(s1->ptszName) > 20)
- mir_tstrncpy(szTemp + 20, L"...", 4);
+ mir_wstrncpy(szTemp, s1->ptszName, 21);
+ if (mir_wstrlen(s1->ptszName) > 20)
+ mir_wstrncpy(szTemp + 20, L"...", 4);
tci.mask = TCIF_TEXT | TCIF_PARAM;
tci.pszText = szTemp;
@@ -1863,11 +1863,11 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
}
SetTextColor(dis->hDC, ui->iStatusEx == 0 ? g_Settings.crUserListColor : g_Settings.crUserListHeadingsColor);
- TextOut(dis->hDC, dis->rcItem.left + x_offset, dis->rcItem.top, ui->pszNick, (int)mir_tstrlen(ui->pszNick));
+ TextOut(dis->hDC, dis->rcItem.left + x_offset, dis->rcItem.top, ui->pszNick, (int)mir_wstrlen(ui->pszNick));
SelectObject(dis->hDC, hOldFont);
if (si->pAccPropServicesForNickList) {
- wchar_t *nick = mir_t2u(ui->pszNick);
+ wchar_t *nick = mir_wstrdup(ui->pszNick);
si->pAccPropServicesForNickList->SetHwndPropStr(GetDlgItem(hwndDlg, IDC_LIST), OBJID_CLIENT, dis->itemID + 1, PROPID_ACC_NAME, nick);
mir_free(nick);
}
@@ -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; wcschr(szTrimString, pszWord[iLen]); iLen--)
+ for (size_t iLen = mir_wstrlen(pszWord) - 1; wcschr(szTrimString, pszWord[iLen]); iLen--)
pszWord[iLen] = 0;
}
@@ -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(wchar_t)*(mir_tstrlen(tr.lpstrText) + 1));
- mir_tstrcpy((wchar_t*)GlobalLock(hData), tr.lpstrText);
+ hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t)*(mir_wstrlen(tr.lpstrText) + 1));
+ mir_wstrcpy((wchar_t*)GlobalLock(hData), tr.lpstrText);
GlobalUnlock(hData);
SetClipboardData(CF_UNICODETEXT, hData);
CloseClipboard();
@@ -2331,7 +2331,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
USERINFO *ui = pci->SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, item);
if (ui != NULL) {
static wchar_t ptszBuf[1024];
- mir_sntprintf(ptszBuf, L"%s: %s\r\n%s: %s\r\n%s: %s",
+ mir_snwprintf(ptszBuf, L"%s: %s\r\n%s: %s\r\n%s: %s",
TranslateT("Nickname"), ui->pszNick,
TranslateT("Unique ID"), ui->pszUID,
TranslateT("Status"), pci->TM_WordToString(parentdat->pStatuses, ui->Status));
@@ -2356,12 +2356,12 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
if (GetKeyState(VK_SHIFT) & 0x8000) {
LRESULT lResult = (LRESULT)SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETSEL, 0, 0);
int start = LOWORD(lResult);
- size_t dwNameLenMax = (mir_tstrlen(ui->pszUID) + 3);
+ size_t dwNameLenMax = (mir_wstrlen(ui->pszUID) + 3);
wchar_t* pszName = (wchar_t*)alloca(sizeof(wchar_t) * dwNameLenMax);
if (start == 0)
- mir_sntprintf(pszName, dwNameLenMax, L"%s: ", ui->pszUID);
+ mir_snwprintf(pszName, dwNameLenMax, L"%s: ", ui->pszUID);
else
- mir_sntprintf(pszName, dwNameLenMax, L"%s ", ui->pszUID);
+ mir_snwprintf(pszName, dwNameLenMax, L"%s ", ui->pszUID);
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)pszName);
PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
@@ -2388,7 +2388,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
pci->SM_AddCommand(si->ptszID, si->pszModule, pszRtf);
- CMString ptszText(ptrT(mir_utf8decodeT(pszRtf)));
+ CMString ptszText(ptrW(mir_utf8decodeW(pszRtf)));
pci->DoRtfToTags(ptszText, mi->nColorCount, mi->crColors);
ptszText.Trim();
ptszText.Replace(L"%", L"%%");
@@ -2450,11 +2450,11 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
wcsncpy_s(szName, (pInfo->ptszModDispName ? pInfo->ptszModDispName : _A2T(si->pszModule)), _TRUNCATE);
ValidateFilename(szName);
- mir_sntprintf(szFolder, L"%s\\%s", g_Settings.pszLogDir, szName);
- mir_sntprintf(szName, L"%s.log", si->ptszID);
+ mir_snwprintf(szFolder, L"%s\\%s", g_Settings.pszLogDir, szName);
+ mir_snwprintf(szName, L"%s.log", si->ptszID);
ValidateFilename(szName);
- mir_sntprintf(szFile, L"%s\\%s", szFolder, szName);
+ mir_snwprintf(szFile, L"%s\\%s", szFolder, szName);
ShellExecute(hwndDlg, L"open", szFile, NULL, NULL, SW_SHOW);
}
}
diff --git a/src/core/stdclist/src/clcpaint.cpp b/src/core/stdclist/src/clcpaint.cpp
index cb679abd0e..c5f4539e17 100644
--- a/src/core/stdclist/src/clcpaint.cpp
+++ b/src/core/stdclist/src/clcpaint.cpp
@@ -313,7 +313,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
ChangeToFont(hdcMem, dat, FONTID_OFFLINE, &fontHeight);
else
ChangeToFont(hdcMem, dat, FONTID_CONTACTS, &fontHeight);
- GetTextExtentPoint32(hdcMem, cc->szText, (int)mir_tstrlen(cc->szText), &textSize);
+ GetTextExtentPoint32(hdcMem, cc->szText, (int)mir_wstrlen(cc->szText), &textSize);
width = textSize.cx;
wchar_t *ptszGroupCount = NULL;
@@ -322,7 +322,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
if (*ptszGroupCount) {
GetTextExtentPoint32(hdcMem, L" ", 1, &spaceSize);
ChangeToFont(hdcMem, dat, FONTID_GROUPCOUNTS, &fontHeight);
- GetTextExtentPoint32(hdcMem, ptszGroupCount, (int)mir_tstrlen(ptszGroupCount), &countsSize);
+ GetTextExtentPoint32(hdcMem, ptszGroupCount, (int)mir_wstrlen(ptszGroupCount), &countsSize);
width += spaceSize.cx + countsSize.cx;
}
}
@@ -409,7 +409,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
rc.left = dat->leftMargin + indent * dat->groupIndent;
rc.right = rc.left + ((clRect.right - rc.left - textSize.cx) >> 1) - 3;
DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT);
- TextOut(hdcMem, rc.right + 3, y + ((dat->rowHeight - fontHeight) >> 1), cc->szText, (int)mir_tstrlen(cc->szText));
+ TextOut(hdcMem, rc.right + 3, y + ((dat->rowHeight - fontHeight) >> 1), cc->szText, (int)mir_wstrlen(cc->szText));
rc.left = rc.right + 6 + textSize.cx;
rc.right = clRect.right;
DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT);
@@ -425,16 +425,16 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
if (rc.right < rc.left + 4)
rc.right = clRect.right + 1;
else
- TextOut(hdcMem, rc.right, rc.top + groupCountsFontTopShift, ptszGroupCount, (int)mir_tstrlen(ptszGroupCount));
+ TextOut(hdcMem, rc.right, rc.top + groupCountsFontTopShift, ptszGroupCount, (int)mir_wstrlen(ptszGroupCount));
ChangeToFont(hdcMem, dat, FONTID_GROUPS, &fontHeight);
if (selected)
SetTextColor(hdcMem, dat->selTextColour);
else if (hottrack)
SetHotTrackColour(hdcMem, dat);
rc.right--;
- ExtTextOut(hdcMem, rc.left, rc.top, ETO_CLIPPED, &rc, cc->szText, (int)mir_tstrlen(cc->szText), NULL);
+ ExtTextOut(hdcMem, rc.left, rc.top, ETO_CLIPPED, &rc, cc->szText, (int)mir_wstrlen(cc->szText), NULL);
}
- else TextOut(hdcMem, dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace, y + ((dat->rowHeight - fontHeight) >> 1), cc->szText, (int)mir_tstrlen(cc->szText));
+ else TextOut(hdcMem, dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace, y + ((dat->rowHeight - fontHeight) >> 1), cc->szText, (int)mir_wstrlen(cc->szText));
if (dat->exStyle & CLS_EX_LINEWITHGROUPS) {
rc.top = y + (dat->rowHeight >> 1);
@@ -456,7 +456,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
if (selected) {
if (cc->type != CLCIT_DIVIDER) {
- size_t qlen = mir_tstrlen(dat->szQuickSearch);
+ size_t qlen = mir_wstrlen(dat->szQuickSearch);
SetTextColor(hdcMem, dat->quickSearchColour);
RECT rc;
diff --git a/src/core/stdclist/src/contact.cpp b/src/core/stdclist/src/contact.cpp
index 359419faa3..23163d83fc 100644
--- a/src/core/stdclist/src/contact.cpp
+++ b/src/core/stdclist/src/contact.cpp
@@ -93,5 +93,5 @@ int CompareContacts(const ClcContact* c1, const ClcContact* c2)
nameb = pcli->pfnGetContactDisplayName(b, 0);
//otherwise just compare names
- return mir_tstrcmpi(namea, nameb);
+ return mir_wstrcmpi(namea, nameb);
}
diff --git a/src/core/stdcrypt/src/stdcrypt.h b/src/core/stdcrypt/src/stdcrypt.h
index 420a0fbcc8..fc96dfbe3d 100644
--- a/src/core/stdcrypt/src/stdcrypt.h
+++ b/src/core/stdcrypt/src/stdcrypt.h
@@ -52,7 +52,7 @@ struct CStdCrypt : public MICryptoEngine, public MZeroedObject
STDMETHODIMP_(BYTE*) encodeString(const char *src, size_t *cbResultLen);
STDMETHODIMP_(BYTE*) encodeBuffer(const void *src, size_t cbLen, size_t *cbResultLen);
- // result must be freed using mir_free or assigned to ptrA/ptrT
+ // result must be freed using mir_free or assigned to ptrA/ptrW
STDMETHODIMP_(char*) decodeString(const BYTE *pBuf, size_t bufLen, size_t *cbResultLen);
STDMETHODIMP_(void*) decodeBuffer(const BYTE *pBuf, size_t bufLen, size_t *cbResultLen);
};
diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp
index 1886a29f1a..2d394b6ab0 100644
--- a/src/core/stdfile/src/file.cpp
+++ b/src/core/stdfile/src/file.cpp
@@ -62,7 +62,7 @@ static INT_PTR SendSpecificFiles(WPARAM hContact, LPARAM lParam)
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[i] = mir_a2u(ppFiles[i]);
fsd.ppFiles[count] = NULL;
HWND hWnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd);
@@ -83,7 +83,7 @@ static INT_PTR GetReceivedFilesFolder(WPARAM wParam, LPARAM lParam)
{
wchar_t buf[MAX_PATH];
GetContactReceivedFilesDir(wParam, buf, MAX_PATH, TRUE);
- char* dir = mir_t2a(buf);
+ char* dir = mir_u2a(buf);
mir_strncpy((char*)lParam, dir, MAX_PATH);
mir_free(dir);
return 0;
@@ -108,7 +108,7 @@ void PushFileEvent(MCONTACT hContact, MEVENT hdbe, LPARAM lParam)
SkinPlaySound("RecvFile");
wchar_t szTooltip[256];
- mir_sntprintf(szTooltip, TranslateT("File from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_snwprintf(szTooltip, TranslateT("File from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
cle.ptszTooltip = szTooltip;
cle.flags |= CLEF_TCHAR;
@@ -164,11 +164,11 @@ void GetSensiblyFormattedSize(__int64 size, wchar_t *szOut, int cchOut, int unit
*unitsUsed = unitsOverride;
switch (unitsOverride) {
- case UNITS_BYTES: mir_sntprintf(szOut, cchOut, L"%u%s%s", (int)size, appendUnits ? L" " : L"", appendUnits ? TranslateT("bytes") : L""); break;
- case UNITS_KBPOINT1: mir_sntprintf(szOut, cchOut, L"%.1lf%s", size / 1024.0, appendUnits ? L" KB" : L""); break;
- case UNITS_KBPOINT0: mir_sntprintf(szOut, cchOut, L"%u%s", (int)(size / 1024), appendUnits ? L" KB" : L""); break;
- case UNITS_GBPOINT3: mir_sntprintf(szOut, cchOut, L"%.3f%s", (size >> 20) / 1024.0, appendUnits ? L" GB" : L""); break;
- default: mir_sntprintf(szOut, cchOut, L"%.2lf%s", size / 1048576.0, appendUnits ? L" MB" : L""); break;
+ case UNITS_BYTES: mir_snwprintf(szOut, cchOut, L"%u%s%s", (int)size, appendUnits ? L" " : L"", appendUnits ? TranslateT("bytes") : L""); break;
+ case UNITS_KBPOINT1: mir_snwprintf(szOut, cchOut, L"%.1lf%s", size / 1024.0, appendUnits ? L" KB" : L""); break;
+ case UNITS_KBPOINT0: mir_snwprintf(szOut, cchOut, L"%u%s", (int)(size / 1024), appendUnits ? L" KB" : L""); break;
+ case UNITS_GBPOINT3: mir_snwprintf(szOut, cchOut, L"%.3f%s", (size >> 20) / 1024.0, appendUnits ? L" GB" : L""); break;
+ default: mir_snwprintf(szOut, cchOut, L"%.2lf%s", size / 1048576.0, appendUnits ? L" MB" : L""); break;
}
}
diff --git a/src/core/stdfile/src/fileexistsdlg.cpp b/src/core/stdfile/src/fileexistsdlg.cpp
index d0650fec8d..95e5e65f99 100644
--- a/src/core/stdfile/src/fileexistsdlg.cpp
+++ b/src/core/stdfile/src/fileexistsdlg.cpp
@@ -149,24 +149,24 @@ void __cdecl LoadIconsAndTypesThread(void* param)
wchar_t *pszExtension = wcsrchr(pszFilename, '.');
if (pszExtension)
- mir_tstrncpy(szExtension, pszExtension + 1, _countof(szExtension));
+ mir_wstrncpy(szExtension, pszExtension + 1, _countof(szExtension));
else {
pszExtension = L".";
szExtension[0] = '\0';
}
CharUpper(szExtension);
if (fileInfo.szTypeName[0] == '\0')
- mir_sntprintf(fileInfo.szTypeName, TranslateT("%s file"), szExtension);
+ mir_snwprintf(fileInfo.szTypeName, TranslateT("%s file"), szExtension);
SetDlgItemText(info->hwndDlg, IDC_EXISTINGTYPE, fileInfo.szTypeName);
SetDlgItemText(info->hwndDlg, IDC_NEWTYPE, fileInfo.szTypeName);
SendDlgItemMessage(info->hwndDlg, IDC_EXISTINGICON, STM_SETICON, (WPARAM)fileInfo.hIcon, 0);
szIconFile[0] = '\0';
- if (!mir_tstrcmp(szExtension, L"EXE"))
+ if (!mir_wstrcmp(szExtension, L"EXE"))
SRFile_GetRegValue(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Icons", L"2", szIconFile, _countof(szIconFile));
else {
wchar_t szTypeName[MAX_PATH];
if (SRFile_GetRegValue(HKEY_CLASSES_ROOT, pszExtension, NULL, szTypeName, _countof(szTypeName))) {
- mir_tstrcat(szTypeName, L"\\DefaultIcon");
+ mir_wstrcat(szTypeName, L"\\DefaultIcon");
if (SRFile_GetRegValue(HKEY_CLASSES_ROOT, szTypeName, NULL, szIconFile, _countof(szIconFile))) {
if (wcsstr(szIconFile, L"%1"))
SRFile_GetRegValue(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Icons", L"0", szIconFile, _countof(szIconFile));
@@ -231,7 +231,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
loadiconsstartinfo *lisi = (loadiconsstartinfo*)mir_alloc(sizeof(loadiconsstartinfo));
lisi->hwndDlg = hwndDlg;
- lisi->szFilename = mir_tstrdup(fts->tszCurrentFile);
+ lisi->szFilename = mir_wstrdup(fts->tszCurrentFile);
//can be a little slow, so why not?
mir_forkthread(LoadIconsAndTypesThread, lisi);
SetFocus(hwndFocus);
@@ -250,7 +250,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
case IDC_OPENFOLDER:
{
wchar_t szFile[MAX_PATH];
- mir_tstrncpy(szFile, fts->tszCurrentFile, _countof(szFile));
+ mir_wstrncpy(szFile, fts->tszCurrentFile, _countof(szFile));
wchar_t *pszLastBackslash = wcsrchr(szFile, '\\');
if (pszLastBackslash)
*pszLastBackslash = '\0';
@@ -283,15 +283,15 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
wchar_t filter[512], *pfilter;
wchar_t str[MAX_PATH];
- mir_tstrncpy(str, fts->tszCurrentFile, _countof(str));
+ mir_wstrncpy(str, fts->tszCurrentFile, _countof(str));
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
wcsncpy(filter, TranslateT("All files"),_countof(filter)-1);
- mir_tstrcat(filter, L" (*)");
- pfilter = filter + mir_tstrlen(filter) + 1;
- mir_tstrcpy(pfilter, L"*");
- pfilter = pfilter + mir_tstrlen(pfilter) + 1;
+ mir_wstrcat(filter, L" (*)");
+ pfilter = filter + mir_wstrlen(filter) + 1;
+ mir_wstrcpy(pfilter, L"*");
+ pfilter = pfilter + mir_wstrlen(pfilter) + 1;
*pfilter = '\0';
ofn.lpstrFilter = filter;
ofn.lpstrFile = str;
@@ -300,7 +300,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
if (!GetSaveFileName(&ofn))
return FALSE;
- pfr.szFilename = mir_tstrdup(str);
+ pfr.szFilename = mir_wstrdup(str);
pfr.action = FILERESUME_RENAME;
}
break;
@@ -319,7 +319,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
PROTOFILERESUME *pfrCopy = (PROTOFILERESUME*)mir_alloc(sizeof(pfr));
memcpy(pfrCopy, &pfr, sizeof(pfr));
- PostMessage((HWND)GetPropA(hwndDlg, "Miranda.ParentWnd"), M_FILEEXISTSDLGREPLY, (WPARAM)mir_tstrdup(fts->tszCurrentFile), (LPARAM)pfrCopy);
+ PostMessage((HWND)GetPropA(hwndDlg, "Miranda.ParentWnd"), M_FILEEXISTSDLGREPLY, (WPARAM)mir_wstrdup(fts->tszCurrentFile), (LPARAM)pfrCopy);
DestroyWindow(hwndDlg);
}
break;
diff --git a/src/core/stdfile/src/fileopts.cpp b/src/core/stdfile/src/fileopts.cpp
index 30979c1294..93aca138ae 100644
--- a/src/core/stdfile/src/fileopts.cpp
+++ b/src/core/stdfile/src/fileopts.cpp
@@ -127,7 +127,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
if (iScanner >= _countof(virusScanners) || iScanner < 0) break;
str[0] = '\0';
if (SRFile_GetRegValue(HKEY_LOCAL_MACHINE, virusScanners[iScanner].szExeRegPath, virusScanners[iScanner].szExeRegValue, szScanExe, _countof(szScanExe)))
- mir_sntprintf(str, virusScanners[iScanner].szCommandLine, szScanExe);
+ mir_snwprintf(str, virusScanners[iScanner].szCommandLine, szScanExe);
SetDlgItemText(hwndDlg, IDC_SCANCMDLINE, str);
}
break;
@@ -180,7 +180,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
wchar_t *pszQuote = wcschr(str + 1, '"');
if (pszQuote)
*pszQuote = 0;
- memmove(str, str + 1, (mir_tstrlen(str) * sizeof(wchar_t)));
+ memmove(str, str + 1, (mir_wstrlen(str) * sizeof(wchar_t)));
}
else {
wchar_t *pszSpace = wcschr(str, ' ');
@@ -191,7 +191,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
if (wcschr(str, ' ') != NULL) {
memmove(str + 1, str, ((_countof(str) - 2) * sizeof(wchar_t)));
str[0] = '"';
- mir_tstrcat(str, L"\"");
+ mir_wstrcat(str, L"\"");
}
SetDlgItemText(hwndDlg, IDC_SCANCMDLINE, str);
break;
diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp
index 6df563406d..06f182cd42 100644
--- a/src/core/stdfile/src/filerecvdlg.cpp
+++ b/src/core/stdfile/src/filerecvdlg.cpp
@@ -38,7 +38,7 @@ static void GetLowestExistingDirName(const wchar_t *szTestDir, wchar_t *szExisti
DWORD dwAttributes;
wchar_t *pszLastBackslash;
- mir_tstrncpy(szExistingDir, szTestDir, cchExistingDir);
+ mir_wstrncpy(szExistingDir, szTestDir, cchExistingDir);
while ((dwAttributes = GetFileAttributes(szExistingDir)) != INVALID_FILE_ATTRIBUTES && !(dwAttributes&FILE_ATTRIBUTE_DIRECTORY)) {
pszLastBackslash = wcsrchr(szExistingDir, '\\');
if (pszLastBackslash == NULL) { *szExistingDir = '\0'; break; }
@@ -94,7 +94,7 @@ int BrowseForFolder(HWND hwnd, wchar_t *szPath)
LPITEMIDLIST pidlResult = SHBrowseForFolder(&bi);
if (pidlResult) {
SHGetPathFromIDList(pidlResult, szPath);
- mir_tstrcat(szPath, L"\\");
+ mir_wstrcat(szPath, L"\\");
CoTaskMemFree(pidlResult);
}
return pidlResult != NULL;
@@ -116,31 +116,31 @@ static void patchDir(wchar_t *str, size_t strSize)
mir_free(result);
}
- size_t len = mir_tstrlen(str);
+ size_t len = mir_wstrlen(str);
if (len + 1 < strSize && str[len - 1] != '\\')
- mir_tstrcpy(str + len, L"\\");
+ mir_wstrcpy(str + len, L"\\");
}
void GetContactReceivedFilesDir(MCONTACT hContact, wchar_t *szDir, int cchDir, BOOL patchVars)
{
wchar_t tszTemp[MAX_PATH];
- ptrT tszRecvPath(db_get_tsa(NULL, "SRFile", "RecvFilesDirAdv"));
+ ptrW tszRecvPath(db_get_tsa(NULL, "SRFile", "RecvFilesDirAdv"));
if (tszRecvPath)
wcsncpy_s(tszTemp, tszRecvPath, _TRUNCATE);
else
- mir_sntprintf(tszTemp, L"%%mydocuments%%\\%s\\%%userid%%", TranslateT("My received files"));
+ mir_snwprintf(tszTemp, L"%%mydocuments%%\\%s\\%%userid%%", TranslateT("My received files"));
if (hContact) {
hContact = db_mc_tryMeta(hContact);
REPLACEVARSARRAY rvaVarsToReplace[4];
rvaVarsToReplace[0].key.w = L"nick";
- rvaVarsToReplace[0].value.w = mir_tstrdup((wchar_t *)pcli->pfnGetContactDisplayName(hContact, 0));
+ rvaVarsToReplace[0].value.w = mir_wstrdup((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[2].value.w = mir_a2u(GetContactProto(hContact));
rvaVarsToReplace[3].key.w = NULL;
rvaVarsToReplace[3].value.w = NULL;
for (int i = 0; i < (_countof(rvaVarsToReplace) - 1); i++)
@@ -158,22 +158,22 @@ void GetContactReceivedFilesDir(MCONTACT hContact, wchar_t *szDir, int cchDir, B
if (patchVars)
patchDir(tszTemp, _countof(tszTemp));
RemoveInvalidPathChars(tszTemp);
- mir_tstrncpy(szDir, tszTemp, cchDir);
+ mir_wstrncpy(szDir, tszTemp, cchDir);
}
void GetReceivedFilesDir(wchar_t *szDir, int cchDir)
{
wchar_t tszTemp[MAX_PATH];
- ptrT tszRecvPath(db_get_tsa(NULL, "SRFile", "RecvFilesDirAdv"));
+ ptrW tszRecvPath(db_get_tsa(NULL, "SRFile", "RecvFilesDirAdv"));
if (tszRecvPath)
wcsncpy_s(tszTemp, tszRecvPath, _TRUNCATE);
else
- mir_sntprintf(tszTemp, L"%%mydocuments%%\\%s\\%%userid%%", TranslateT("My received files"));
+ mir_snwprintf(tszTemp, L"%%mydocuments%%\\%s\\%%userid%%", TranslateT("My received files"));
patchDir(tszTemp, _countof(tszTemp));
RemoveInvalidPathChars(tszTemp);
- mir_tstrncpy(szDir, tszTemp, cchDir);
+ mir_wstrncpy(szDir, tszTemp, cchDir);
}
INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -231,13 +231,13 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
dat->fs = cle->lParam ? (HANDLE)cle->lParam : (HANDLE)*(PDWORD)dbei.pBlob;
char *str = (char*)dbei.pBlob + 4;
- ptrT ptszFileName(DbGetEventStringT(&dbei, str));
+ ptrW ptszFileName(DbGetEventStringT(&dbei, str));
SetDlgItemText(hwndDlg, IDC_FILENAMES, ptszFileName);
unsigned len = (unsigned)mir_strlen(str) + 1;
if (len + 4 < dbei.cbBlob) {
str += len;
- ptrT ptszDescription(DbGetEventStringT(&dbei, str));
+ ptrW ptszDescription(DbGetEventStringT(&dbei, str));
SetDlgItemText(hwndDlg, IDC_MSG, ptszDescription);
}
}
@@ -247,7 +247,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
TimeZone_PrintTimeStamp(NULL, dbei.timestamp, L"t d", datetimestr, _countof(datetimestr), 0);
SetDlgItemText(hwndDlg, IDC_DATE, datetimestr);
- ptrT info(Contact_GetInfo(CNF_UNIQUEID, dat->hContact));
+ ptrW info(Contact_GetInfo(CNF_UNIQUEID, dat->hContact));
SetDlgItemText(hwndDlg, IDC_NAME, (info) ? info : contactName);
if (db_get_b(dat->hContact, "CList", "NotOnList", 0)) {
@@ -307,7 +307,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
GetDlgItemText(hwndDlg, IDC_FILEDIR, szRecvDir, _countof(szRecvDir));
RemoveInvalidPathChars(szRecvDir);
GetContactReceivedFilesDir(NULL, szDefaultRecvDir, _countof(szDefaultRecvDir), TRUE);
- if (wcsnicmp(szRecvDir, szDefaultRecvDir, mir_tstrlen(szDefaultRecvDir))) {
+ if (wcsnicmp(szRecvDir, szDefaultRecvDir, mir_wstrlen(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 7d1c780807..4c6089c8c5 100644
--- a/src/core/stdfile/src/filesenddlg.cpp
+++ b/src/core/stdfile/src/filesenddlg.cpp
@@ -49,16 +49,16 @@ static void SetFileListAndSizeControls(HWND hwndDlg, FileDlgData *dat)
if (i > 1) {
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);
+ mir_snwprintf(szFormat, L"%s, %s", TranslateTS(fileCount == 1 ? L"%d file" : L"%d files"), TranslateTS(dirCount == 1 ? L"%d directory" : L"%d directories"));
+ mir_snwprintf(str, szFormat, fileCount, dirCount);
}
else if (fileCount) {
- mir_tstrcpy(szFormat, TranslateT("%d files"));
- mir_sntprintf(str, szFormat, fileCount);
+ mir_wstrcpy(szFormat, TranslateT("%d files"));
+ mir_snwprintf(str, szFormat, fileCount);
}
else {
- mir_tstrcpy(szFormat, TranslateT("%d directories"));
- mir_sntprintf(str, szFormat, dirCount);
+ mir_wstrcpy(szFormat, TranslateT("%d directories"));
+ mir_snwprintf(str, szFormat, dirCount);
}
SetDlgItemText(hwndDlg, IDC_FILE, str);
}
@@ -87,12 +87,12 @@ static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const wchar_t *bu
// NULL separated list of all files
// fileOffset is the offset to the first file.
- size_t fileOffset = mir_tstrlen(buf) + 1;
+ size_t fileOffset = mir_wstrlen(buf) + 1;
// Count number of files
pBuf = buf + fileOffset;
while (*pBuf) {
- pBuf += mir_tstrlen(pBuf) + 1;
+ pBuf += mir_wstrlen(pBuf) + 1;
nNumberOfFiles++;
}
@@ -105,13 +105,13 @@ static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const wchar_t *bu
nTemp = 0;
while (*pBuf) {
// Allocate space for path+filename
- size_t cbFileNameLen = mir_tstrlen(pBuf);
+ size_t cbFileNameLen = mir_wstrlen(pBuf);
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(wchar_t));
dat->files[nTemp][fileOffset - 1] = '\\';
- mir_tstrcpy(dat->files[nTemp] + fileOffset - (buf[fileOffset - 2] == '\\' ? 1 : 0), pBuf);
+ mir_wstrcpy(dat->files[nTemp] + fileOffset - (buf[fileOffset - 2] == '\\' ? 1 : 0), pBuf);
// Move pointers to next file...
pBuf += cbFileNameLen + 1;
@@ -125,7 +125,7 @@ static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const wchar_t *bu
if ((dat->files = (wchar_t **)mir_alloc(2 * sizeof(wchar_t*))) == NULL) // Leaks when aborted
return;
- dat->files[0] = mir_tstrdup(buf);
+ dat->files[0] = mir_wstrdup(buf);
dat->files[1] = NULL;
}
@@ -146,11 +146,11 @@ void __cdecl ChooseFilesThread(void* param)
}
wchar_t filter[128];
- mir_tstrcpy(filter, TranslateT("All files"));
- mir_tstrcat(filter, L" (*)");
- wchar_t *pfilter = filter + mir_tstrlen(filter) + 1;
- mir_tstrcpy(pfilter, L"*");
- pfilter = filter + mir_tstrlen(filter) + 1;
+ mir_wstrcpy(filter, TranslateT("All files"));
+ mir_wstrcat(filter, L" (*)");
+ wchar_t *pfilter = filter + mir_wstrlen(filter) + 1;
+ mir_wstrcpy(pfilter, L"*");
+ pfilter = filter + mir_wstrlen(filter) + 1;
pfilter[0] = '\0';
OPENFILENAME ofn = { 0 };
@@ -230,7 +230,7 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
for (totalCount = 0; fsd->ppFiles[totalCount]; totalCount++);
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[i] = mir_wstrdup(fsd->ppFiles[i]);
dat->files[totalCount] = NULL;
SetFileListAndSizeControls(hwndDlg, dat);
}
@@ -238,7 +238,7 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
wchar_t *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0);
SetDlgItemText(hwndDlg, IDC_TO, contactName);
- ptrT id(Contact_GetInfo(CNF_UNIQUEID, dat->hContact));
+ ptrW id(Contact_GetInfo(CNF_UNIQUEID, dat->hContact));
SetDlgItemText(hwndDlg, IDC_NAME, (id) ? id : contactName);
if (fsd->ppFiles == NULL) {
diff --git a/src/core/stdfile/src/filexferdlg.cpp b/src/core/stdfile/src/filexferdlg.cpp
index 7be203e9bb..ed513f02bb 100644
--- a/src/core/stdfile/src/filexferdlg.cpp
+++ b/src/core/stdfile/src/filexferdlg.cpp
@@ -47,23 +47,23 @@ wchar_t* PFTS_StringToTchar(int flags, const wchar_t* s)
if (flags & PFTS_UTF)
return Utf8DecodeW((char*)s);
if (flags & PFTS_UNICODE)
- return mir_tstrdup(s);
- return mir_a2t((char*)s);
+ return mir_wstrdup(s);
+ return mir_a2u((char*)s);
}
int PFTS_CompareWithTchar(PROTOFILETRANSFERSTATUS *ft, const wchar_t *s, wchar_t *r)
{
if (ft->flags & PFTS_UTF) {
wchar_t *ts = Utf8DecodeW((char*)s);
- int res = mir_tstrcmp(ts, r);
+ int res = mir_wstrcmp(ts, r);
mir_free(ts);
return res;
}
if (ft->flags & PFTS_UNICODE)
- return mir_tstrcmp(s, r);
+ return mir_wstrcmp(s, r);
- wchar_t *ts = mir_a2t((char*)s);
- int res = mir_tstrcmp(ts, r);
+ wchar_t *ts = mir_a2u((char*)s);
+ int res = mir_wstrcmp(ts, r);
mir_free(ts);
return res;
}
@@ -102,10 +102,10 @@ static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info)
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';
+ if (info->szFile[mir_wstrlen(info->szFile) - 1] == '\\')
+ info->szFile[mir_wstrlen(info->szFile) - 1] = '\0';
*pszReplace = 0;
- mir_sntprintf(szCmdLine, L"%s\"%s\"%s", dbv.ptszVal, info->szFile, pszReplace + 2);
+ mir_snwprintf(szCmdLine, L"%s\"%s\"%s", dbv.ptszVal, info->szFile, pszReplace + 2);
} else
wcsncpy_s(szCmdLine, dbv.ptszVal, _TRUNCATE);
@@ -130,7 +130,7 @@ static void SetFilenameControls(HWND hwndDlg, FileDlgData *dat, PROTOFILETRANSFE
SHFILEINFO shfi = { 0 };
if (fts->tszCurrentFile) {
- fnbuf = mir_tstrdup(fts->tszCurrentFile);
+ fnbuf = mir_wstrdup(fts->tszCurrentFile);
if ((fn = wcsrchr(fnbuf, '\\')) == NULL)
fn = fnbuf;
else fn++;
@@ -139,7 +139,7 @@ static void SetFilenameControls(HWND hwndDlg, FileDlgData *dat, PROTOFILETRANSFE
if (dat->hIcon) DestroyIcon(dat->hIcon); dat->hIcon = NULL;
if (fn && (fts->totalFiles > 1)) {
- mir_sntprintf(msg, L"%s: %s (%d %s %d)",
+ mir_snwprintf(msg, L"%s: %s (%d %s %d)",
pcli->pfnGetContactDisplayName(fts->hContact, 0),
fn, fts->currentFileNumber + 1, TranslateT("of"), fts->totalFiles);
@@ -147,13 +147,13 @@ static void SetFilenameControls(HWND hwndDlg, FileDlgData *dat, PROTOFILETRANSFE
dat->hIcon = shfi.hIcon;
}
else if (fn) {
- mir_sntprintf(msg, L"%s: %s", pcli->pfnGetContactDisplayName(fts->hContact, 0), fn);
+ mir_snwprintf(msg, L"%s: %s", pcli->pfnGetContactDisplayName(fts->hContact, 0), fn);
SHGetFileInfo(fn, FILE_ATTRIBUTE_NORMAL, &shfi, sizeof(shfi), SHGFI_USEFILEATTRIBUTES | SHGFI_ICON | SHGFI_SMALLICON);
dat->hIcon = shfi.hIcon;
}
else {
- mir_tstrncpy(msg, pcli->pfnGetContactDisplayName(fts->hContact, 0), _countof(msg));
+ mir_wstrncpy(msg, pcli->pfnGetContactDisplayName(fts->hContact, 0), _countof(msg));
HICON hIcon = Skin_LoadIcon(SKINICON_OTHER_DOWNARROW);
dat->hIcon = CopyIcon(hIcon);
IcoLib_ReleaseIcon(hIcon, NULL);
@@ -247,7 +247,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
else { //recv
CreateDirectoryTreeT(dat->szSavePath);
dat->fs = (HANDLE)ProtoChainSend(dat->hContact, PSS_FILEALLOW, (WPARAM)dat->fs, (LPARAM)dat->szSavePath);
- dat->transferStatus.tszWorkingDir = mir_tstrdup(dat->szSavePath);
+ dat->transferStatus.tszWorkingDir = mir_wstrdup(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, LPGENW("Waiting for connection..."), FTS_TEXT);
@@ -308,7 +308,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
GetSensiblyFormattedSize((dat->bytesRecvedHistory[0] - dat->bytesRecvedHistory[dat->bytesRecvedHistorySize - 1]) / dat->bytesRecvedHistorySize, szSpeed, _countof(szSpeed), 0, 1, NULL);
if (dat->bytesRecvedHistory[0] == dat->bytesRecvedHistory[dat->bytesRecvedHistorySize - 1])
- mir_tstrcpy(szTime, L"??:??:??");
+ mir_wstrcpy(szTime, L"??:??:??");
else {
li.QuadPart = BIGI(10000000)*(dat->transferStatus.currentFileSize - dat->transferStatus.currentFileProgress)*dat->bytesRecvedHistorySize / (dat->bytesRecvedHistory[0] - dat->bytesRecvedHistory[dat->bytesRecvedHistorySize - 1]);
ft.dwHighDateTime = li.HighPart; ft.dwLowDateTime = li.LowPart;
@@ -322,7 +322,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
GetTimeFormat(LOCALE_USER_DEFAULT, TIME_FORCE24HOURFORMAT | TIME_NOTIMEMARKER, &st, NULL, szTime, _countof(szTime));
}
- mir_sntprintf(szDisplay, L"%s/%s (%s %s)", szSpeed, TranslateT("sec"), szTime, TranslateT("remaining"));
+ mir_snwprintf(szDisplay, L"%s/%s (%s %s)", szSpeed, TranslateT("sec"), szTime, TranslateT("remaining"));
SetDlgItemText(hwndDlg, IDC_ALLSPEED, szDisplay);
}
break;
@@ -414,7 +414,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
pszFilename++;
if (pszFilename) {
- size_t cbFileNameLen = mir_tstrlen(pszFilename);
+ size_t cbFileNameLen = mir_wstrlen(pszFilename);
pszNewFileName = (wchar_t*)mir_alloc(cbFileNameLen * 2 * sizeof(wchar_t));
wchar_t *p = pszNewFileName;
@@ -478,12 +478,12 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
{
wchar_t *pszExtension, *pszFilename;
if ((pszFilename = wcsrchr(szOriginalFilename, '\\')) == NULL) pszFilename = szOriginalFilename;
- if ((pszExtension = wcsrchr(pszFilename + 1, '.')) == NULL) pszExtension = pszFilename + mir_tstrlen(pszFilename);
+ if ((pszExtension = wcsrchr(pszFilename + 1, '.')) == NULL) pszExtension = pszFilename + mir_wstrlen(pszFilename);
if (pfr->szFilename) mir_free((wchar_t*)pfr->szFilename);
- size_t size = (pszExtension - szOriginalFilename) + 21 + mir_tstrlen(pszExtension);
+ size_t size = (pszExtension - szOriginalFilename) + 21 + mir_wstrlen(pszExtension);
pfr->szFilename = (wchar_t*)mir_alloc(sizeof(wchar_t)*size);
for (int i = 1;; i++) {
- mir_sntprintf((wchar_t*)pfr->szFilename, size, L"%.*s (%u)%s", pszExtension - szOriginalFilename, szOriginalFilename, i, pszExtension);
+ mir_snwprintf((wchar_t*)pfr->szFilename, size, L"%.*s (%u)%s", pszExtension - szOriginalFilename, szOriginalFilename, i, pszExtension);
if (_waccess(pfr->szFilename, 0) != 0)
break;
}
@@ -528,7 +528,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
virusscanthreadstartinfo *vstsi;
vstsi = (struct virusscanthreadstartinfo*)mir_alloc(sizeof(struct virusscanthreadstartinfo));
vstsi->hwndReply = hwndDlg;
- vstsi->szFile = mir_tstrdup(dat->files[dat->transferStatus.currentFileNumber]);
+ vstsi->szFile = mir_wstrdup(dat->files[dat->transferStatus.currentFileNumber]);
vstsi->returnCode = dat->transferStatus.currentFileNumber;
mir_forkthread((void(*)(void*))RunVirusScannerThread, vstsi);
}
@@ -554,7 +554,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
PROTOFILERESUME *pfr = (PROTOFILERESUME*)mir_alloc(sizeof(PROTOFILERESUME));
pfr->action = dat->resumeBehaviour;
pfr->szFilename = NULL;
- PostMessage(hwndDlg, M_FILEEXISTSDLGREPLY, (WPARAM)mir_tstrdup(fts->tszCurrentFile), (LPARAM)pfr);
+ PostMessage(hwndDlg, M_FILEEXISTSDLGREPLY, (WPARAM)mir_wstrdup(fts->tszCurrentFile), (LPARAM)pfr);
}
}
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, 1);
@@ -596,17 +596,17 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
const unsigned long nextPos = fts->totalBytes ? (BIGI(100) * fts->totalProgress / fts->totalBytes) : 0;
if (lastPos != nextPos || firstTime) {
SendDlgItemMessage(hwndDlg, IDC_ALLFILESPROGRESS, PBM_SETPOS, nextPos, 0);
- mir_sntprintf(str, L"%u%%", nextPos);
+ mir_snwprintf(str, L"%u%%", nextPos);
SetDlgItemText(hwndDlg, IDC_ALLPRECENTS, str);
}
int units;
GetSensiblyFormattedSize(fts->totalBytes, szSizeTotal, _countof(szSizeTotal), 0, 1, &units);
GetSensiblyFormattedSize(fts->totalProgress, szSizeDone, _countof(szSizeDone), units, 0, NULL);
- mir_sntprintf(str, L"%s/%s", szSizeDone, szSizeTotal);
+ mir_snwprintf(str, L"%s/%s", szSizeDone, szSizeTotal);
str2[0] = 0;
GetDlgItemText(hwndDlg, IDC_ALLTRANSFERRED, str2, _countof(str2));
- if (mir_tstrcmp(str, str2))
+ if (mir_wstrcmp(str, str2))
SetDlgItemText(hwndDlg, IDC_ALLTRANSFERRED, str);
}
break;
@@ -665,10 +665,10 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
mir_free(vstsi);
vstsi = NULL;
}
- else vstsi->szFile = mir_tstrdup(dat->files[dat->transferStatus.currentFileNumber]);
+ else vstsi->szFile = mir_wstrdup(dat->files[dat->transferStatus.currentFileNumber]);
}
else {
- vstsi->szFile = mir_tstrdup(dat->transferStatus.tszWorkingDir);
+ vstsi->szFile = mir_wstrdup(dat->transferStatus.tszWorkingDir);
vstsi->returnCode = -1;
}
SetFtStatus(hwndDlg, LPGENW("Scanning for viruses..."), FTS_TEXT);
diff --git a/src/core/stdhelp/src/about.cpp b/src/core/stdhelp/src/about.cpp
index 5fca697ade..ea58985f7d 100644
--- a/src/core/stdhelp/src/about.cpp
+++ b/src/core/stdhelp/src/about.cpp
@@ -51,7 +51,7 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
CallService(MS_SYSTEM_GETVERSIONTEXT, _countof(productVersion), (LPARAM)productVersion);
wchar_t str[64];
- mir_sntprintf(str, STR_VERSION_FORMAT, productVersion);
+ mir_snwprintf(str, STR_VERSION_FORMAT, productVersion);
SetDlgItemText(hwndDlg, IDC_HEADERBAR, str);
}
ShowWindow(GetDlgItem(hwndDlg, IDC_CREDITSFILE), SW_HIDE);
@@ -69,7 +69,7 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
if (ResSize >=3 && pszMsgt[0] == '\xef' && pszMsgt[1] == '\xbb' && pszMsgt[2] == '\xbf')
ptszMsg = Utf8DecodeT(pszMsgt + 3);
else
- ptszMsg = mir_a2t_cp(pszMsgt, 1252);
+ ptszMsg = mir_a2u_cp(pszMsgt, 1252);
SetDlgItemText(hwndDlg, IDC_CREDITSFILE, ptszMsg);
UnlockResource(pszMsg);
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp
index 79822ad339..0c68e5b22d 100644
--- a/src/core/stdmsg/src/msgdialog.cpp
+++ b/src/core/stdmsg/src/msgdialog.cpp
@@ -55,7 +55,7 @@ static void NotifyLocalWinEvent(MCONTACT hContact, HWND hwnd, unsigned int type)
static int RTL_Detect(const wchar_t *ptszText)
{
- int iLen = (int)mir_tstrlen(ptszText);
+ int iLen = (int)mir_wstrlen(ptszText);
WORD *infoTypeC2 = (WORD*)alloca(sizeof(WORD)* (iLen + 2));
GetStringTypeEx(LOCALE_USER_DEFAULT, CT_CTYPE2, ptszText, iLen, infoTypeC2);
@@ -91,17 +91,17 @@ static void AddToFileList(wchar_t ***pppFiles, int *totalCount, const wchar_t* s
{
*pppFiles = (wchar_t**)mir_realloc(*pppFiles, (++*totalCount + 1)*sizeof(wchar_t*));
(*pppFiles)[*totalCount] = NULL;
- (*pppFiles)[*totalCount - 1] = mir_tstrdup(szFilename);
+ (*pppFiles)[*totalCount - 1] = mir_wstrdup(szFilename);
if (GetFileAttributes(szFilename) & FILE_ATTRIBUTE_DIRECTORY) {
WIN32_FIND_DATA fd;
wchar_t szPath[MAX_PATH];
- mir_sntprintf(szPath, L"%s\\*", szFilename);
+ mir_snwprintf(szPath, L"%s\\*", szFilename);
HANDLE hFind = FindFirstFile(szPath, &fd);
if (hFind != INVALID_HANDLE_VALUE) {
do {
- if (!mir_tstrcmp(fd.cFileName, L".") || !mir_tstrcmp(fd.cFileName, L"..")) continue;
- mir_sntprintf(szPath, L"%s\\%s", szFilename, fd.cFileName);
+ if (!mir_wstrcmp(fd.cFileName, L".") || !mir_wstrcmp(fd.cFileName, L"..")) continue;
+ mir_snwprintf(szPath, L"%s\\%s", szFilename, fd.cFileName);
AddToFileList(pppFiles, totalCount, szPath);
}
while (FindNextFile(hFind, &fd));
@@ -122,7 +122,7 @@ static void UpdateReadChars(HWND hwndDlg, HWND hwndStatus)
wchar_t buf[32];
int len = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE));
- mir_sntprintf(buf, L"%d", len);
+ mir_snwprintf(buf, L"%d", len);
SendMessage(hwndStatus, SB_SETTEXT, 1, (LPARAM)buf);
}
}
@@ -495,7 +495,7 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *
HFONT hFont = (HFONT)SelectObject(hdc, (HFONT)SendDlgItemMessage(hwndDlg, IDOK, WM_GETFONT, 0, 0));
SIZE textSize;
- GetTextExtentPoint32(hdc, buf, (int)mir_tstrlen(buf), &textSize);
+ GetTextExtentPoint32(hdc, buf, (int)mir_wstrlen(buf), &textSize);
urc->rcItem.right = urc->rcItem.left + textSize.cx + 10;
if ((g_dat.flags&SMF_SHOWBTNS) && urc->rcItem.right > urc->dlgNewSize.cx - dat->nLabelRight)
urc->rcItem.right = urc->dlgNewSize.cx - dat->nLabelRight;
@@ -918,11 +918,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
case DM_USERNAMETOCLIP:
if (dat->hContact) {
- ptrT id(Contact_GetInfo(CNF_UNIQUEID, dat->hContact, dat->szProto));
+ ptrW id(Contact_GetInfo(CNF_UNIQUEID, dat->hContact, dat->szProto));
if (id != NULL && OpenClipboard(hwndDlg)) {
EmptyClipboard();
- HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, mir_tstrlen(id) * sizeof(wchar_t)+1);
- mir_tstrcpy((wchar_t*)GlobalLock(hData), id);
+ HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, mir_wstrlen(id) * sizeof(wchar_t)+1);
+ mir_wstrcpy((wchar_t*)GlobalLock(hData), id);
GlobalUnlock(hData);
SetClipboardData(CF_UNICODETEXT, hData);
CloseClipboard();
@@ -938,7 +938,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
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);
+ mir_snwprintf(fmt, TranslateT("Last message received on %s at %s."), date, time);
SendMessage(dat->hwndStatus, SB_SETTEXT, 0, (LPARAM)fmt);
}
else SendMessage(dat->hwndStatus, SB_SETTEXT, 0, (LPARAM)L"");
@@ -1007,14 +1007,14 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
dat->wStatus = db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
wchar_t *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0);
- ptrT id(Contact_GetInfo(CNF_DISPLAYUID, dat->hContact, dat->szProto));
+ ptrW id(Contact_GetInfo(CNF_DISPLAYUID, dat->hContact, dat->szProto));
SetDlgItemText(hwndDlg, IDC_NAME, (id) ? id : contactName);
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"));
+ mir_snwprintf(newtitle, L"%s - %s", contactName, TranslateT("Message session"));
else
- mir_sntprintf(newtitle, L"%s (%s): %s", contactName, szStatus, TranslateT("Message session"));
+ mir_snwprintf(newtitle, L"%s (%s): %s", contactName, szStatus, TranslateT("Message session"));
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)wParam;
if (!cws || (!mir_strcmp(cws->szModule, dat->szProto) && !mir_strcmp(cws->szSetting, "Status"))) {
@@ -1026,11 +1026,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
dat->wOldStatus = dat->wStatus;
}
else
- mir_tstrncpy(newtitle, TranslateT("Message session"), _countof(newtitle));
+ mir_wstrncpy(newtitle, TranslateT("Message session"), _countof(newtitle));
wchar_t oldtitle[256];
GetWindowText(hwndDlg, oldtitle, _countof(oldtitle));
- if (mir_tstrcmp(newtitle, oldtitle)) { //swt() flickers even if the title hasn't actually changed
+ if (mir_wstrcmp(newtitle, oldtitle)) { //swt() flickers even if the title hasn't actually changed
SetWindowText(hwndDlg, newtitle);
SendMessage(hwndDlg, WM_SIZE, 0, 0);
}
@@ -1258,7 +1258,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
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);
+ mir_snwprintf(szBuf, TranslateT("%s is typing a message..."), szContactName);
dat->nTypeSecs--;
SendMessage(dat->hwndStatus, SB_SETTEXT, 0, (LPARAM)szBuf);
@@ -1346,9 +1346,9 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
if (!temp[0])
break;
- int sendId = SendMessageDirect(rtrimt(temp), dat->hContact, dat->szProto);
+ int sendId = SendMessageDirect(rtrimw(temp), dat->hContact, dat->szProto);
if (sendId) {
- dat->cmdList.insert(mir_tstrdup(temp));
+ dat->cmdList.insert(mir_wstrdup(temp));
dat->cmdListInd = -1;
if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON)
@@ -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(wchar_t));
- mir_tstrcpy((wchar_t*)GlobalLock(hData), tr.lpstrText);
+ HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, (mir_wstrlen(tr.lpstrText) + 1) * sizeof(wchar_t));
+ mir_wstrcpy((wchar_t*)GlobalLock(hData), tr.lpstrText);
GlobalUnlock(hData);
SetClipboardData(CF_UNICODETEXT, hData);
CloseClipboard();
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp
index 62ab631a35..7096284dac 100644
--- a/src/core/stdmsg/src/msglog.cpp
+++ b/src/core/stdmsg/src/msglog.cpp
@@ -89,7 +89,7 @@ static void AppendToBufferWithRTF(CMStringA &buf, const wchar_t *line)
int i, found = 0;
for (i = 0; i < _countof(bbcodes); ++i) {
if (line[1] == bbcodes[i][1]) {
- size_t lenb = mir_tstrlen(bbcodes[i]);
+ size_t lenb = mir_wstrlen(bbcodes[i]);
if (!wcsnicmp(line, bbcodes[i], lenb)) {
buf.Append(bbcodefmt[i]);
line += lenb - 1;
@@ -317,14 +317,14 @@ static char* CreateRTFFromDbEvent(SrmmWindowData *dat, MCONTACT hContact, MEVENT
char* filename = (char*)dbei.pBlob + sizeof(DWORD);
char* descr = filename + mir_strlen(filename) + 1;
- ptrT ptszFileName(DbGetEventStringT(&dbei, filename));
+ ptrW ptszFileName(DbGetEventStringT(&dbei, filename));
buffer.AppendFormat(" %s ", SetToStyle(MSGFONTID_NOTICE));
AppendToBufferWithRTF(buffer, (dbei.flags & DBEF_SENT) ? TranslateT("File sent") : TranslateT("File received"));
buffer.Append(": ");
AppendToBufferWithRTF(buffer, ptszFileName);
if (*descr != 0) {
- ptrT ptszDescr(DbGetEventStringT(&dbei, descr));
+ ptrW ptszDescr(DbGetEventStringT(&dbei, descr));
buffer.Append(" (");
AppendToBufferWithRTF(buffer, ptszDescr);
buffer.Append(")");
diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp
index 52bfb5f630..f5968b5cce 100644
--- a/src/core/stdmsg/src/msgoptions.cpp
+++ b/src/core/stdmsg/src/msgoptions.cpp
@@ -84,7 +84,7 @@ bool LoadMsgDlgFont(int i, LOGFONT* lf, COLORREF * colour)
if (db_get_ts(NULL, SRMMMOD, str, &dbv))
wcsncpy(lf->lfFaceName, fontOptionsList[i].szDefFace, _countof(lf->lfFaceName)-1);
else {
- mir_tstrncpy(lf->lfFaceName, dbv.ptszVal, _countof(lf->lfFaceName));
+ mir_wstrncpy(lf->lfFaceName, dbv.ptszVal, _countof(lf->lfFaceName));
db_free(&dbv);
}
mir_snprintf(str, "SRMFont%dSet", i);
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp
index 2b67cb4590..2737384610 100644
--- a/src/core/stdmsg/src/msgs.cpp
+++ b/src/core/stdmsg/src/msgs.cpp
@@ -89,7 +89,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam)
}
wchar_t toolTip[256];
- mir_sntprintf(toolTip, TranslateT("Message from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_snwprintf(toolTip, TranslateT("Message from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
CLISTEVENT cle = {};
cle.hContact = hContact;
@@ -167,7 +167,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam)
SendMessage(hwnd, DM_TYPING, 0, lParam);
else if (lParam && (g_dat.flags & SMF_SHOWTYPINGTRAY)) {
wchar_t szTip[256];
- mir_sntprintf(szTip, TranslateT("%s is typing a message"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_snwprintf(szTip, TranslateT("%s is typing a message"), pcli->pfnGetContactDisplayName(hContact, 0));
if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY) && !(g_dat.flags & SMF_SHOWTYPINGCLIST)) {
MIRANDASYSTRAYNOTIFY tn = { sizeof(tn) };
@@ -281,7 +281,7 @@ static void RestoreUnreadMessageAlerts(void)
for (int i = 0; i < arEvents.getCount(); i++) {
MSavedEvent &e = arEvents[i];
- mir_sntprintf(toolTip, TranslateT("Message from %s"), pcli->pfnGetContactDisplayName(e.hContact, 0));
+ mir_snwprintf(toolTip, TranslateT("Message from %s"), pcli->pfnGetContactDisplayName(e.hContact, 0));
cle.hContact = e.hContact;
cle.hDbEvent = e.hEvent;
pcli->pfnAddEvent(&cle);
diff --git a/src/core/stdmsg/src/msgtimedout.cpp b/src/core/stdmsg/src/msgtimedout.cpp
index 0f3d4ac508..2a39135e88 100644
--- a/src/core/stdmsg/src/msgtimedout.cpp
+++ b/src/core/stdmsg/src/msgtimedout.cpp
@@ -44,11 +44,11 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
if (!param->szMsg || !param->szMsg[0])
SetDlgItemText(hwndDlg, IDC_ERRORTEXT, TranslateT("An unknown error has occurred."));
else {
- ptrT ptszError(Langpack_PcharToTchar(param->szMsg));
+ ptrW ptszError(Langpack_PcharToTchar(param->szMsg));
SetDlgItemText(hwndDlg, IDC_ERRORTEXT, ptszError);
}
- SetDlgItemText(hwndDlg, IDC_MSGTEXT, ptrT(mir_utf8decodeT(item->szMsg)));
+ SetDlgItemText(hwndDlg, IDC_MSGTEXT, ptrW(mir_utf8decodeW(item->szMsg)));
HWND hwndParent = GetParent(hwndDlg);
if (hwndParent != NULL)
@@ -76,7 +76,7 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
- SendMessageDirect(ptrT(mir_utf8decodeT(item->szMsg)), item->hContact, GetContactProto(item->hContact));
+ SendMessageDirect(ptrW(mir_utf8decodeW(item->szMsg)), item->hContact, GetContactProto(item->hContact));
DestroyWindow(hwndDlg);
break;
diff --git a/src/core/stdssl/src/netlibssl.cpp b/src/core/stdssl/src/netlibssl.cpp
index af0c2632e1..023aff9c1c 100644
--- a/src/core/stdssl/src/netlibssl.cpp
+++ b/src/core/stdssl/src/netlibssl.cpp
@@ -80,7 +80,7 @@ static void ReportSslError(SECURITY_STATUS scRet, int line, bool = false)
}
wchar_t szMsgBuf2[512];
- mir_sntprintf(szMsgBuf2, L"SSL connection failure (%x %u): %s", scRet, line, szMsgBuf);
+ mir_snwprintf(szMsgBuf2, L"SSL connection failure (%x %u): %s", scRet, line, szMsgBuf);
char* szMsg = Utf8EncodeT(szMsgBuf2);
Netlib_Logf(NULL, szMsg);
diff --git a/src/core/stduihist/src/history.cpp b/src/core/stduihist/src/history.cpp
index 88acd91328..193e730b19 100644
--- a/src/core/stduihist/src/history.cpp
+++ b/src/core/stduihist/src/history.cpp
@@ -55,7 +55,7 @@ static void GetUrlDescription(DBEVENTINFO *dbei, wchar_t* buf, int cbBuf)
buf[ len ] = 0;
if (len < cbBuf-3)
- mir_tstrcat(buf, L"\r\n");
+ mir_wstrcat(buf, L"\r\n");
}
static void GetFileDescription(DBEVENTINFO *dbei, wchar_t* buf, int cbBuf)
@@ -68,7 +68,7 @@ static void GetFileDescription(DBEVENTINFO *dbei, wchar_t* buf, int cbBuf)
buf[ len ] = 0;
if (len < cbBuf-3)
- mir_tstrcat(buf, L"\r\n");
+ mir_wstrcat(buf, L"\r\n");
}
static void GetObjectDescription(DBEVENTINFO *dbei, wchar_t* str, int cbStr)
@@ -117,7 +117,7 @@ static void GetObjectSummary(DBEVENTINFO *dbei, wchar_t* str, int cbStr)
default:
DBEVENTTYPEDESCR* et = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
if (et && (et->flags & DETF_HISTORY)) {
- pszTmp = mir_a2t(et->descr);
+ pszTmp = mir_a2u(et->descr);
pszSrc = TranslateTS(pszTmp);
break;
}
@@ -165,7 +165,7 @@ static void FillHistoryThread(void* param)
GetObjectSummary(&dbei, str, _countof(str));
if (str[0]) {
TimeZone_PrintTimeStamp(NULL, dbei.timestamp, L"d t", strdatetime, _countof(strdatetime), 0);
- mir_sntprintf(eventText, L"%s: %s", strdatetime, str);
+ mir_snwprintf(eventText, L"%s: %s", strdatetime, str);
i = SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)eventText);
SendMessage(hwndList, LB_SETITEMDATA, i, (LPARAM)hDbEvent);
}
@@ -208,7 +208,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
wchar_t* contactName, str[200];
contactName = pcli->pfnGetContactDisplayName(hContact, 0);
- mir_sntprintf(str, TranslateT("History for %s"), contactName);
+ mir_snwprintf(str, TranslateT("History for %s"), contactName);
SetWindowText(hwndDlg, str);
}
Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_OTHER_HISTORY);
@@ -319,7 +319,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP
wchar_t str[1024];
GetObjectDescription(&dbei, str, _countof(str));
if (str[0]) {
- CharUpperBuff(str, (int)mir_tstrlen(str));
+ CharUpperBuff(str, (int)mir_wstrlen(str));
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);
@@ -352,7 +352,7 @@ static INT_PTR CALLBACK DlgProcHistoryFind(HWND hwndDlg, UINT msg, WPARAM wParam
wchar_t str[128];
HWND hwndParent = (HWND)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
GetDlgItemText(hwndDlg, IDC_FINDWHAT, str, _countof(str));
- CharUpperBuff(str, (int)mir_tstrlen(str));
+ CharUpperBuff(str, (int)mir_wstrlen(str));
SendMessage(hwndParent, DM_FINDNEXT, 0, (LPARAM)str);
return TRUE;
}
diff --git a/src/core/stduserinfo/src/contactinfo.cpp b/src/core/stduserinfo/src/contactinfo.cpp
index a125be13ef..ca14e50201 100644
--- a/src/core/stduserinfo/src/contactinfo.cpp
+++ b/src/core/stduserinfo/src/contactinfo.cpp
@@ -197,11 +197,11 @@ static int IsOverEmail(HWND hwndDlg, wchar_t* szEmail, int cchEmail)
SelectObject(hdc, hEmailFont);
SIZE textSize;
- GetTextExtentPoint32(hdc, szText, (int)mir_tstrlen(szText), &textSize);
+ GetTextExtentPoint32(hdc, szText, (int)mir_wstrlen(szText), &textSize);
ReleaseDC(hwndEmails, hdc);
if (hti.pt.x < rc.left + textSize.cx) {
if (szEmail && cchEmail)
- mir_tstrncpy(szEmail, szText, cchEmail);
+ mir_wstrncpy(szEmail, szText, cchEmail);
return 1;
}
return 0;
@@ -284,7 +284,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
break;
lvi.pszText = idstr2;
- mir_sntprintf(idstr2, L"%d", i + 2);
+ mir_snwprintf(idstr2, L"%d", i + 2);
}
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_EMAILS), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_EMAILS), lvi.iItem, 1, dbv.ptszVal);
@@ -298,7 +298,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (db_get_ts(hContact, "UserInfo", idstr, &dbv))
break;
lvi.pszText = idstr2;
- mir_sntprintf(idstr2, TranslateT("Custom %d"), i + 1);
+ mir_snwprintf(idstr2, TranslateT("Custom %d"), i + 1);
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_EMAILS), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_EMAILS), lvi.iItem, 1, dbv.ptszVal);
db_free(&dbv);
@@ -332,7 +332,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
if (mir_strlen(dbv.pszVal) > 4 && !mir_strcmp(dbv.pszVal + mir_strlen(dbv.pszVal) - 4, " SMS")) {
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 2, L"y");
- dbv.ptszVal[mir_tstrlen(dbv.ptszVal) - 4] = '\0';
+ dbv.ptszVal[mir_wstrlen(dbv.ptszVal) - 4] = '\0';
}
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal);
db_free(&dbv);
@@ -359,11 +359,11 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (db_get_ts(hContact, "UserInfo", idstr, &dbv))
break;
lvi.pszText = idstr2;
- mir_sntprintf(idstr2, TranslateT("Custom %d"), i + 1);
+ mir_snwprintf(idstr2, TranslateT("Custom %d"), i + 1);
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
- if (mir_tstrlen(dbv.ptszVal) > 4 && !mir_tstrcmp(dbv.ptszVal + mir_tstrlen(dbv.ptszVal) - 4, L" SMS")) {
+ if (mir_wstrlen(dbv.ptszVal) > 4 && !mir_wstrcmp(dbv.ptszVal + mir_wstrlen(dbv.ptszVal) - 4, L" SMS")) {
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 2, L"y");
- dbv.ptszVal[mir_tstrlen(dbv.ptszVal) - 4] = '\0';
+ dbv.ptszVal[mir_wstrlen(dbv.ptszVal) - 4] = '\0';
}
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal);
db_free(&dbv);
@@ -439,7 +439,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
wchar_t szEmail[256];
if (IsOverEmail(hwndDlg, szEmail, _countof(szEmail))) {
wchar_t szExec[264];
- mir_sntprintf(szExec, L"mailto:%s", szEmail);
+ mir_snwprintf(szExec, L"mailto:%s", szEmail);
ShellExecute(hwndDlg, L"open", szExec, NULL, NULL, SW_SHOW);
break;
}
diff --git a/src/core/stduserinfo/src/stdinfo.cpp b/src/core/stduserinfo/src/stdinfo.cpp
index 100ea132d8..bd2420bdca 100644
--- a/src/core/stduserinfo/src/stdinfo.cpp
+++ b/src/core/stduserinfo/src/stdinfo.cpp
@@ -255,7 +255,7 @@ static INT_PTR CALLBACK SummaryDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_EMAIL))) {
wchar_t szExec[264], szEmail[256];
GetDlgItemText(hwndDlg, IDC_EMAIL, szEmail, _countof(szEmail));
- mir_sntprintf(szExec, L"mailto:%s", szEmail);
+ mir_snwprintf(szExec, L"mailto:%s", szEmail);
ShellExecute(hwndDlg, L"open", szExec, NULL, NULL, SW_SHOW);
}
break;
@@ -442,11 +442,11 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
lvi.iItem = 0;
for (int i = 0;; i++) {
mir_snprintf(idstr, "Past%d", i);
- ptrT tszColText(Proto_GetContactInfoSettingStr(proto_service, hContact, szProto, idstr));
+ ptrW tszColText(Proto_GetContactInfoSettingStr(proto_service, hContact, szProto, idstr));
if (tszColText == NULL)
break;
mir_snprintf(idstr, "Past%dText", i);
- ptrT tszText(db_get_tsa(hContact, szProto, idstr));
+ ptrW tszText(db_get_tsa(hContact, szProto, idstr));
if (tszText == NULL)
break;
@@ -459,11 +459,11 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
// affiliation
for (int i = 0;; i++) {
mir_snprintf(idstr, "Affiliation%d", i);
- ptrT tszColText(Proto_GetContactInfoSettingStr(proto_service, hContact, szProto, idstr));
+ ptrW tszColText(Proto_GetContactInfoSettingStr(proto_service, hContact, szProto, idstr));
if (tszColText == NULL)
break;
mir_snprintf(idstr, "Affiliation%dText", i);
- ptrT tszText(db_get_tsa(hContact, szProto, idstr));
+ ptrW tszText(db_get_tsa(hContact, szProto, idstr));
if (tszText == NULL)
break;
@@ -482,11 +482,11 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
lvi.iItem = 0;
for (int i = 0;; i++) {
mir_snprintf(idstr, "Interest%dCat", i);
- ptrT tszColText(Proto_GetContactInfoSettingStr(proto_service, hContact, szProto, idstr));
+ ptrW tszColText(Proto_GetContactInfoSettingStr(proto_service, hContact, szProto, idstr));
if (tszColText == NULL)
break;
mir_snprintf(idstr, "Interest%dText", i);
- ptrT tszText(db_get_tsa(hContact, szProto, idstr));
+ ptrW tszText(db_get_tsa(hContact, szProto, idstr));
if (tszText == NULL)
break;
@@ -543,12 +543,12 @@ static INT_PTR CALLBACK NotesDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf.lfQuality = DEFAULT_QUALITY;
lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
- mir_tstrcpy(lf.lfFaceName, L"Courier New");
+ mir_wstrcpy(lf.lfFaceName, L"Courier New");
lf.lfCharSet = DEFAULT_CHARSET;
HFONT hFont = CreateFontIndirect(&lf);
SendDlgItemMessage(hwndDlg, IDC_ABOUT, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
- ptrT szNotes(db_get_tsa(lParam, "UserInfo", "MyNotes"));
+ ptrW szNotes(db_get_tsa(lParam, "UserInfo", "MyNotes"));
if (szNotes != nullptr)
SetDlgItemText(hwndDlg, IDC_MYNOTES, szNotes);
}
diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp
index 0de846052e..bcb7e20a39 100644
--- a/src/core/stduserinfo/src/userinfo.cpp
+++ b/src/core/stduserinfo/src/userinfo.cpp
@@ -78,18 +78,18 @@ static int PageSortProc(OPTIONSDIALOGPAGE *item1, OPTIONSDIALOGPAGE *item2)
{
int res;
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;
+ if (!mir_wstrcmp(s1, TranslateT("Summary"))) return -1;
+ if (!mir_wstrcmp(s2, TranslateT("Summary"))) return 1;
+ if (res = mir_wstrcmp(s1, s2)) return res;
s1 = getTab(item1), s2 = getTab(item2);
if (s1 && !s2) return -1;
if (!s1 && s2) return 1;
if (!s1 && !s2) return 0;
- if (s1 && !mir_tstrcmp(s1, TranslateT("General"))) return -1;
- if (s2 && !mir_tstrcmp(s2, TranslateT("General"))) return 1;
- return mir_tstrcmp(s1, s2);
+ if (s1 && !mir_wstrcmp(s1, TranslateT("General"))) return -1;
+ if (s2 && !mir_wstrcmp(s2, TranslateT("General"))) return 1;
+ return mir_wstrcmp(s1, s2);
}
static INT_PTR ShowDetailsDialogCommand(WPARAM wParam, LPARAM)
@@ -151,8 +151,8 @@ static INT_PTR AddDetailsPage(WPARAM wParam, LPARAM lParam)
dst->pwszTab = (!(odp->flags & ODPF_USERINFOTAB) || !odp->pwszTab) ? NULL : mir_wstrdup(odp->pwszTab);
}
else {
- dst->pwszTitle = mir_a2t(odp->pszTitle);
- dst->pwszTab = (!(odp->flags & ODPF_USERINFOTAB) || !odp->pszTab) ? NULL : mir_a2t(odp->pszTab);
+ dst->pwszTitle = mir_a2u(odp->pszTitle);
+ dst->pwszTab = (!(odp->flags & ODPF_USERINFOTAB) || !odp->pszTab) ? NULL : mir_a2u(odp->pszTab);
}
dst->hLangpack = odp->hLangpack;
@@ -180,13 +180,13 @@ static void CreateDetailsTabs(HWND hwndDlg, DetailsData *dat, DetailsPageData *p
TabCtrl_DeleteAllItems(hwndTab);
for (int i = 0; i < dat->pageCount; i++) {
DetailsPageData &odp = dat->opd[i];
- if (!odp.ptszTab || mir_tstrcmp(odp.ptszTitle, ppg->ptszTitle))
+ if (!odp.ptszTab || mir_wstrcmp(odp.ptszTitle, ppg->ptszTitle))
continue;
tie.pszText = TranslateTH(odp.hLangpack, odp.ptszTab);
tie.lParam = i;
TabCtrl_InsertItem(hwndTab, pages, &tie);
- if (!mir_tstrcmp(odp.ptszTab, ppg->ptszTab))
+ if (!mir_wstrcmp(odp.ptszTab, ppg->ptszTab))
sel = pages;
pages++;
}
@@ -255,7 +255,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP
name = pcli->pfnGetContactDisplayName(dat->hContact, 0);
GetWindowText(hwndDlg, oldTitle, _countof(oldTitle));
- mir_sntprintf(newTitle, oldTitle, name);
+ mir_snwprintf(newTitle, oldTitle, name);
SetWindowText(hwndDlg, newTitle);
//////////////////////////////////////////////////////////////////////
@@ -293,7 +293,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP
p.ptszTab = odp[i].pwszTab;
p.hLangpack = odp[i].hLangpack;
- if (i && p.ptszTab && !mir_tstrcmp(dat->opd[i - 1].ptszTitle, p.ptszTitle)) {
+ if (i && p.ptszTab && !mir_wstrcmp(dat->opd[i - 1].ptszTitle, p.ptszTitle)) {
p.hItem = dat->opd[i - 1].hItem;
continue;
}
@@ -307,7 +307,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP
tvis.item.pszText = p.ptszTitle;
else
tvis.item.pszText = TranslateTH(p.hLangpack, p.ptszTitle);
- if (ptszLastTab && !mir_tstrcmp(tvis.item.pszText, ptszLastTab))
+ if (ptszLastTab && !mir_wstrcmp(tvis.item.pszText, ptszLastTab))
dat->currentPage = i;
p.hItem = TreeView_InsertItem(hwndTree, &tvis);
}
@@ -355,7 +355,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case WM_TIMER:
wchar_t str[128];
- mir_sntprintf(str, L"%.*s%s%.*s", dat->updateAnimFrame % 10, L".........", dat->szUpdating, dat->updateAnimFrame % 10, L".........");
+ mir_snwprintf(str, L"%.*s%s%.*s", dat->updateAnimFrame % 10, L".........", dat->szUpdating, dat->updateAnimFrame % 10, L".........");
SetDlgItemText(hwndDlg, IDC_UPDATING, str);
if (++dat->updateAnimFrame == UPDATEANIMFRAMES)
dat->updateAnimFrame = 0;
diff --git a/src/core/stduseronline/src/useronline.cpp b/src/core/stduseronline/src/useronline.cpp
index 6106fd64a4..9deeccecaf 100644
--- a/src/core/stduseronline/src/useronline.cpp
+++ b/src/core/stduseronline/src/useronline.cpp
@@ -58,7 +58,7 @@ static int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam)
// 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)) {
wchar_t tooltip[256];
- mir_sntprintf(tooltip, TranslateT("%s is online"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_snwprintf(tooltip, TranslateT("%s is online"), pcli->pfnGetContactDisplayName(hContact, 0));
CLISTEVENT cle = {};
cle.flags = CLEF_ONLYAFEW | CLEF_TCHAR;
diff --git a/src/mir_app/src/BaseExtraIcon.cpp b/src/mir_app/src/BaseExtraIcon.cpp
index 1aa6b40057..5b9ef3d930 100644
--- a/src/mir_app/src/BaseExtraIcon.cpp
+++ b/src/mir_app/src/BaseExtraIcon.cpp
@@ -28,7 +28,7 @@ BaseExtraIcon::BaseExtraIcon(int id, const char *name, const wchar_t *descriptio
m_id(id),
m_OnClick(OnClick),
m_onClickParam(param),
- m_tszDescription(mir_tstrdup(description)),
+ m_tszDescription(mir_wstrdup(description)),
m_szDescIcon(mir_strdup(descIcon))
{
}
@@ -55,7 +55,7 @@ const wchar_t* BaseExtraIcon::getDescription() const
void BaseExtraIcon::setDescription(const wchar_t *desc)
{
- m_tszDescription = mir_tstrdup(desc);
+ m_tszDescription = mir_wstrdup(desc);
}
const char* BaseExtraIcon::getDescIcon() const
diff --git a/src/mir_app/src/ExtraIcon.h b/src/mir_app/src/ExtraIcon.h
index 7b701c11c9..00bee2dbfc 100644
--- a/src/mir_app/src/ExtraIcon.h
+++ b/src/mir_app/src/ExtraIcon.h
@@ -89,7 +89,7 @@ public:
protected:
int m_id;
- ptrT m_tszDescription;
+ ptrW m_tszDescription;
ptrA m_szDescIcon;
MIRANDAHOOKPARAM m_OnClick;
LPARAM m_onClickParam;
@@ -170,7 +170,7 @@ public:
virtual int ClistSetExtraIcon(MCONTACT hContact, HANDLE hImage);
protected:
- ptrT m_tszDescription;
+ ptrW m_tszDescription;
bool m_setValidExtraIcon;
bool m_insideApply;
diff --git a/src/mir_app/src/ExtraIconGroup.cpp b/src/mir_app/src/ExtraIconGroup.cpp
index 6ed364f50b..7101175272 100644
--- a/src/mir_app/src/ExtraIconGroup.cpp
+++ b/src/mir_app/src/ExtraIconGroup.cpp
@@ -45,7 +45,7 @@ void ExtraIconGroup::addExtraIcon(BaseExtraIcon *extra)
description += m_items[i]->getDescription();
}
- m_tszDescription = mir_tstrdup(description);
+ m_tszDescription = mir_wstrdup(description);
}
void ExtraIconGroup::rebuildIcons()
diff --git a/src/mir_app/src/FontOptions.cpp b/src/mir_app/src/FontOptions.cpp
index ef20702b7a..30a6aa4d5e 100644
--- a/src/mir_app/src/FontOptions.cpp
+++ b/src/mir_app/src/FontOptions.cpp
@@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static int sttCompareFont(const FontInternal* p1, const FontInternal* p2)
{
- int result = mir_tstrcmp(p1->group, p2->group);
+ int result = mir_wstrcmp(p1->group, p2->group);
if (result != 0)
return result;
@@ -38,14 +38,14 @@ static int sttCompareFont(const FontInternal* p1, const FontInternal* p2)
if (result != 0)
return result;
- return mir_tstrcmp(p1->getName(), p2->getName());
+ return mir_wstrcmp(p1->getName(), p2->getName());
}
OBJLIST<FontInternal> font_id_list(20, sttCompareFont), font_id_list_w2(20, sttCompareFont), font_id_list_w3(20, sttCompareFont);
static int sttCompareColour(const ColourInternal* p1, const ColourInternal* p2)
{
- int result = mir_tstrcmp(p1->group, p2->group);
+ int result = mir_wstrcmp(p1->group, p2->group);
if (result != 0)
return result;
@@ -53,14 +53,14 @@ static int sttCompareColour(const ColourInternal* p1, const ColourInternal* p2)
if (result != 0)
return result;
- return mir_tstrcmp(p1->getName(), p2->getName());
+ return mir_wstrcmp(p1->getName(), p2->getName());
}
OBJLIST<ColourInternal> colour_id_list(10, sttCompareColour), colour_id_list_w2(10, sttCompareColour), colour_id_list_w3(10, sttCompareColour);
static int sttCompareEffect(const EffectInternal* p1, const EffectInternal* p2)
{
- int result = mir_tstrcmp(p1->group, p2->group);
+ int result = mir_wstrcmp(p1->group, p2->group);
if (result != 0)
return result;
@@ -68,7 +68,7 @@ static int sttCompareEffect(const EffectInternal* p1, const EffectInternal* p2)
if (result != 0)
return result;
- return mir_tstrcmp(p1->getName(), p2->getName());
+ return mir_wstrcmp(p1->getName(), p2->getName());
}
OBJLIST<EffectInternal> effect_id_list(10, sttCompareEffect), effect_id_list_w2(10, sttCompareEffect), effect_id_list_w3(10, sttCompareEffect);
@@ -261,12 +261,12 @@ static BOOL sttFsuiBindColourIdToFonts(HWND hwndList, const wchar_t *name, const
if (itemData && itemData->font_id >= 0) {
FontInternal& F = font_id_list_w2[itemData->font_id];
- if (name && !mir_tstrcmp(F.name, name)) {
+ if (name && !mir_wstrcmp(F.name, name)) {
itemData->colour_id = colourId;
res = TRUE;
}
- if (backgroundGroup && backgroundName && !mir_tstrcmp(F.backgroundGroup, backgroundGroup) && !mir_tstrcmp(F.backgroundName, backgroundName)) {
+ if (backgroundGroup && backgroundName && !mir_wstrcmp(F.backgroundGroup, backgroundGroup) && !mir_wstrcmp(F.backgroundName, backgroundName)) {
itemData->colour_id = colourId;
res = TRUE;
}
@@ -283,7 +283,7 @@ static bool sttFsuiBindEffectIdToFonts(HWND hwndList, const wchar_t *name, int e
if (itemData && itemData->font_id >= 0) {
FontInternal& F = font_id_list_w2[itemData->font_id];
- if (name && !mir_tstrcmp(F.name, name)) {
+ if (name && !mir_wstrcmp(F.name, name)) {
itemData->effect_id = effectId;
return true;
}
@@ -313,7 +313,7 @@ static HTREEITEM sttFindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const wc
while (tvi.hItem) {
TreeView_GetItem(hwndTree, &tvi);
- if (!mir_tstrcmp(tvi.pszText, name))
+ if (!mir_wstrcmp(tvi.pszText, name))
return tvi.hItem;
tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
@@ -328,7 +328,7 @@ static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const wchar_t *groupNam
int sectionLevel = 0;
HTREEITEM hSection = NULL;
- mir_tstrcpy(itemName, groupName);
+ mir_wstrcpy(itemName, groupName);
sectionName = itemName;
while (sectionName) {
@@ -347,8 +347,8 @@ static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const wchar_t *groupNam
if (!hItem) {
TVINSERTSTRUCT tvis = { 0 };
TreeItem *treeItem = (TreeItem *)mir_alloc(sizeof(TreeItem));
- treeItem->groupName = sectionName ? NULL : mir_tstrdup(groupName);
- treeItem->paramName = mir_t2a(itemName);
+ treeItem->groupName = sectionName ? NULL : mir_wstrdup(groupName);
+ treeItem->paramName = mir_u2a(itemName);
tvis.hParent = hSection;
tvis.hInsertAfter = TVI_SORT;//TVI_LAST;
@@ -639,7 +639,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_ADDSTRING, (WPARAM)-1, (LPARAM)itemData);
}
- if (mir_tstrcmp(C.name, L"Background") == 0)
+ if (mir_wstrcmp(C.name, L"Background") == 0)
hBkgColourBrush = CreateSolidBrush(C.value);
}
}
@@ -711,7 +711,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
hoFont = (HFONT)SelectObject(hdc, (HFONT)SendDlgItemMessage(hwndDlg, mis->CtlID, WM_GETFONT, 0, 0));
SIZE fontSize;
- GetTextExtentPoint32(hdc, itemName, (int)mir_tstrlen(itemName), &fontSize);
+ GetTextExtentPoint32(hdc, itemName, (int)mir_wstrlen(itemName), &fontSize);
if (hoFont) SelectObject(hdc, hoFont);
if (hFont) DeleteObject(hFont);
ReleaseDC(GetDlgItem(hwndDlg, mis->CtlID), hdc);
@@ -828,7 +828,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
}
rc = dis->rcItem;
rc.left += FSUI_FONTLEFT;
- DrawTextWithEffect(dis->hDC, itemName, (int)mir_tstrlen(itemName), &rc, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_WORD_ELLIPSIS, pEffect);
+ DrawTextWithEffect(dis->hDC, itemName, (int)mir_wstrlen(itemName), &rc, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_WORD_ELLIPSIS, pEffect);
}
else {
RECT rc;
@@ -853,7 +853,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
rc = dis->rcItem;
rc.left += FSUI_FONTLEFT;
- DrawTextWithEffect(dis->hDC, itemName, (int)mir_tstrlen(itemName), &rc, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_WORD_ELLIPSIS, pEffect);
+ DrawTextWithEffect(dis->hDC, itemName, (int)mir_wstrlen(itemName), &rc, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_WORD_ELLIPSIS, pEffect);
}
if (hoFont) SelectObject(dis->hDC, hoFont);
if (hFont) DeleteObject(hFont);
@@ -1028,7 +1028,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
if (itemData->colour_id < 0) continue;
colour_id_list_w2[itemData->colour_id].value = SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_GETCOLOUR, 0, 0);
- if (mir_tstrcmp(colour_id_list_w2[itemData->colour_id].name, L"Background") == 0) {
+ if (mir_wstrcmp(colour_id_list_w2[itemData->colour_id].name, L"Background") == 0) {
if (hBkgColourBrush) DeleteObject(hBkgColourBrush);
hBkgColourBrush = CreateSolidBrush(colour_id_list_w2[itemData->colour_id].value);
}
@@ -1075,7 +1075,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
case IDC_BTN_EXPORT:
{
wchar_t fname_buff[MAX_PATH], filter[MAX_PATH];
- mir_sntprintf(filter, L"%s (*.ini)%c*.ini%c%s (*.txt)%c*.TXT%c%s (*.*)%c*.*%c", TranslateT("Configuration files"), 0, 0, TranslateT("Text files"), 0, 0, TranslateT("All files"), 0, 0);
+ mir_snwprintf(filter, L"%s (*.ini)%c*.ini%c%s (*.txt)%c*.TXT%c%s (*.*)%c*.*%c", TranslateT("Configuration files"), 0, 0, TranslateT("Text files"), 0, 0, TranslateT("All files"), 0, 0);
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
diff --git a/src/mir_app/src/IcoLib.h b/src/mir_app/src/IcoLib.h
index 2d8932e406..5510e92996 100644
--- a/src/mir_app/src/IcoLib.h
+++ b/src/mir_app/src/IcoLib.h
@@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
struct SectionItem : public MZeroedObject
{
- ptrT name;
+ ptrW name;
int flags, maxOrder, ref_count;
};
diff --git a/src/mir_app/src/addcontact.cpp b/src/mir_app/src/addcontact.cpp
index e9a729541f..fb6380f9e7 100644
--- a/src/mir_app/src/addcontact.cpp
+++ b/src/mir_app/src/addcontact.cpp
@@ -27,12 +27,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static wchar_t* sttDecodeString(DWORD dwFlags, MAllStrings &src)
{
if (dwFlags & PSR_UNICODE)
- return mir_u2t(src.w);
+ return mir_wstrdup(src.w);
if (dwFlags & PSR_UTF8)
- return mir_utf8decodeT(src.a);
+ return mir_utf8decodeW(src.a);
- return mir_a2t(src.a);
+ return mir_a2u(src.a);
}
class CAddContactDlg : public CDlgBase
@@ -99,7 +99,7 @@ public:
if (!isSet)
{
if (m_acs.handleType == HANDLE_EVENT)
- szName = mir_a2t(szUin);
+ szName = mir_a2u(szUin);
else
{
szName = sttDecodeString(m_acs.psr->flags, m_acs.psr->id);
@@ -120,11 +120,11 @@ public:
m_acs.szProto = GetContactProto(m_acs.hContact);
int groupSel = 0;
- ptrT tszGroup(db_get_tsa(hContact, "CList", "Group"));
+ ptrW tszGroup(db_get_tsa(hContact, "CList", "Group"));
wchar_t *grpName;
for (int groupId = 1; (grpName = Clist_GroupGetName(groupId, NULL)) != NULL; groupId++) {
int id = m_group.AddString(grpName, groupId);
- if (!mir_tstrcmpi(tszGroup, grpName))
+ if (!mir_wstrcmpi(tszGroup, grpName))
groupSel = id;
}
@@ -198,8 +198,8 @@ public:
if (hContact == NULL)
return;
- ptrT szHandle(m_myHandle.GetText());
- if (mir_tstrlen(szHandle))
+ ptrW szHandle(m_myHandle.GetText());
+ if (mir_wstrlen(szHandle))
db_set_ts(hContact, "CList", "MyHandle", szHandle);
int item = m_group.GetCurSel();
@@ -216,7 +216,7 @@ public:
if (flags & PF4_NOCUSTOMAUTH)
ProtoChainSend(hContact, PSS_AUTHREQUEST, 0, 0);
else
- ProtoChainSend(hContact, PSS_AUTHREQUEST, 0, ptrT(m_authReq.GetText()));
+ ProtoChainSend(hContact, PSS_AUTHREQUEST, 0, ptrW(m_authReq.GetText()));
}
if (m_chkOpen.GetState())
diff --git a/src/mir_app/src/button.cpp b/src/mir_app/src/button.cpp
index f687df9c8b..c020904f0d 100644
--- a/src/mir_app/src/button.cpp
+++ b/src/mir_app/src/button.cpp
@@ -205,7 +205,7 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint)
SIZE sz;
wchar_t szText[MAX_PATH];
GetWindowText(ctl->hwnd, szText, _countof(szText));
- GetTextExtentPoint32(hdcMem, szText, (int)mir_tstrlen(szText), &sz);
+ GetTextExtentPoint32(hdcMem, szText, (int)mir_wstrlen(szText), &sz);
int xOffset = (rcClient.right - rcClient.left - sz.cx)/2;
int yOffset = (rcClient.bottom - rcClient.top - sz.cy)/2;
@@ -489,12 +489,10 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
ti.lpszText = mir_wstrdup(TranslateTS((WCHAR*)wParam));
else
ti.lpszText = Langpack_PcharToTchar((char*)wParam);
- if (bct->pAccPropServices) {
- wchar_t *tmpstr = mir_t2u(ti.lpszText);
- bct->pAccPropServices->SetHwndPropStr(bct->hwnd, OBJID_CLIENT,
- CHILDID_SELF, PROPID_ACC_DESCRIPTION, tmpstr);
- mir_free(tmpstr);
- }
+
+ if (bct->pAccPropServices)
+ bct->pAccPropServices->SetHwndPropStr(bct->hwnd, OBJID_CLIENT, CHILDID_SELF, PROPID_ACC_DESCRIPTION, ti.lpszText);
+
SendMessage(bct->hwndToolTips, TTM_ADDTOOL, 0, (LPARAM)&ti);
mir_free(ti.lpszText);
}
diff --git a/src/mir_app/src/chat_clist.cpp b/src/mir_app/src/chat_clist.cpp
index 755904e390..ea92494bc7 100644
--- a/src/mir_app/src/chat_clist.cpp
+++ b/src/mir_app/src/chat_clist.cpp
@@ -25,11 +25,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
MCONTACT AddRoom(const char *pszModule, const wchar_t *pszRoom, const wchar_t *pszDisplayName, int iType)
{
wchar_t pszGroup[50]; *pszGroup = '\0';
- ptrT groupName(db_get_tsa(NULL, CHAT_MODULE, "AddToGroup"));
+ ptrW groupName(db_get_tsa(NULL, CHAT_MODULE, "AddToGroup"));
if (groupName)
wcsncpy_s(pszGroup, groupName, _TRUNCATE);
else
- mir_tstrcpy(pszGroup, L"Chat rooms");
+ mir_wstrcpy(pszGroup, L"Chat rooms");
if (pszGroup[0]) {
MGROUP hGroup = Clist_GroupExists(pszGroup);
@@ -43,8 +43,8 @@ MCONTACT AddRoom(const char *pszModule, const wchar_t *pszRoom, const wchar_t *p
MCONTACT hContact = chatApi.FindRoom(pszModule, pszRoom);
if (hContact) { //contact exist, make sure it is in the right group
if (pszGroup[0]) {
- ptrT grpName(db_get_tsa(hContact, "CList", "Group"));
- if (!mir_tstrcmp(pszGroup, grpName))
+ ptrW grpName(db_get_tsa(hContact, "CList", "Group"));
+ if (!mir_wstrcmp(pszGroup, grpName))
db_set_ts(hContact, "CList", "Group", pszGroup);
}
@@ -110,7 +110,7 @@ int RoomDoubleclicked(WPARAM hContact, LPARAM)
if (db_get_b(hContact, szProto, "ChatRoom", 0) == 0)
return 0;
- ptrT roomid(db_get_tsa(hContact, szProto, "ChatRoomID"));
+ ptrW roomid(db_get_tsa(hContact, szProto, "ChatRoomID"));
if (roomid == NULL)
return 0;
@@ -202,12 +202,12 @@ BOOL AddEvent(MCONTACT hContact, HICON hIcon, MEVENT hEvent, int type, wchar_t*
{
wchar_t szBuf[4096];
- if (!fmt || !fmt[0] || mir_tstrlen(fmt) > 2000)
+ if (!fmt || !fmt[0] || mir_wstrlen(fmt) > 2000)
return FALSE;
va_list marker;
va_start(marker, fmt);
- mir_vsntprintf(szBuf, _countof(szBuf), fmt, marker);
+ mir_vsnwprintf(szBuf, _countof(szBuf), fmt, marker);
va_end(marker);
CLISTEVENT cle = {};
@@ -235,8 +235,8 @@ MCONTACT FindRoom(const char *pszModule, const wchar_t *pszRoom)
if (!db_get_b(hContact, pszModule, "ChatRoom", 0))
continue;
- ptrT roomid(db_get_tsa(hContact, pszModule, "ChatRoomID"));
- if (roomid != NULL && !mir_tstrcmpi(roomid, pszRoom))
+ ptrW roomid(db_get_tsa(hContact, pszModule, "ChatRoomID"));
+ if (roomid != NULL && !mir_wstrcmpi(roomid, pszRoom))
return hContact;
}
diff --git a/src/mir_app/src/chat_log.cpp b/src/mir_app/src/chat_log.cpp
index 590ceb0f9d..529d1b423a 100644
--- a/src/mir_app/src/chat_log.cpp
+++ b/src/mir_app/src/chat_log.cpp
@@ -111,7 +111,7 @@ static int Log_AppendRTF(LOGSTREAMDATA *streamData, BOOL simpleMode, char *&buff
wchar_t* line = (wchar_t*)alloca(8001 * sizeof(wchar_t));
va_start(va, fmt);
- lineLen = mir_vsntprintf(line, 8000, fmt, va);
+ lineLen = mir_vsnwprintf(line, 8000, fmt, va);
if (lineLen < 0) lineLen = 8000;
line[lineLen] = 0;
va_end(va);
@@ -225,14 +225,14 @@ static void AddEventToBuffer(char *&buffer, size_t &bufferEnd, size_t &bufferAll
wchar_t szTemp[512], szTemp2[512];
wchar_t* pszNick = NULL;
if (streamData->lin->ptszNick) {
- if (g_Settings->bLogLimitNames && mir_tstrlen(streamData->lin->ptszNick) > 20) {
- mir_tstrncpy(szTemp2, streamData->lin->ptszNick, 20);
- mir_tstrncpy(szTemp2 + 20, L"...", 4);
+ if (g_Settings->bLogLimitNames && mir_wstrlen(streamData->lin->ptszNick) > 20) {
+ mir_wstrncpy(szTemp2, streamData->lin->ptszNick, 20);
+ mir_wstrncpy(szTemp2 + 20, L"...", 4);
}
- else mir_tstrncpy(szTemp2, streamData->lin->ptszNick, 511);
+ else mir_wstrncpy(szTemp2, streamData->lin->ptszNick, 511);
if (streamData->lin->ptszUserInfo)
- mir_sntprintf(szTemp, L"%s (%s)", szTemp2, streamData->lin->ptszUserInfo);
+ mir_snwprintf(szTemp, L"%s (%s)", szTemp2, streamData->lin->ptszUserInfo);
else
wcsncpy_s(szTemp, szTemp2, _TRUNCATE);
pszNick = szTemp;
@@ -382,9 +382,9 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData)
if (g_Settings->bShowTime) {
wchar_t szTimeStamp[30], szOldTimeStamp[30];
- mir_tstrncpy(szTimeStamp, MakeTimeStamp(g_Settings->pszTimeStamp, lin->time), 30);
- mir_tstrncpy(szOldTimeStamp, MakeTimeStamp(g_Settings->pszTimeStamp, streamData->si->LastTime), 30);
- if (!g_Settings->bShowTimeIfChanged || streamData->si->LastTime == 0 || mir_tstrcmp(szTimeStamp, szOldTimeStamp)) {
+ mir_wstrncpy(szTimeStamp, MakeTimeStamp(g_Settings->pszTimeStamp, lin->time), 30);
+ mir_wstrncpy(szOldTimeStamp, MakeTimeStamp(g_Settings->pszTimeStamp, streamData->si->LastTime), 30);
+ if (!g_Settings->bShowTimeIfChanged || streamData->si->LastTime == 0 || mir_wstrcmp(szTimeStamp, szOldTimeStamp)) {
streamData->si->LastTime = lin->time;
Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced, L"%s", szTimeStamp);
}
@@ -396,7 +396,7 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData)
wchar_t pszTemp[300], *p1;
Log_Append(buffer, bufferEnd, bufferAlloced, "%s ", Log_SetStyle(lin->bIsMe ? 2 : 1));
- mir_tstrncpy(pszTemp, lin->bIsMe ? g_Settings->pszOutgoingNick : g_Settings->pszIncomingNick, 299);
+ mir_wstrncpy(pszTemp, lin->bIsMe ? g_Settings->pszOutgoingNick : g_Settings->pszIncomingNick, 299);
p1 = wcsstr(pszTemp, L"%n");
if (p1)
p1[1] = 's';
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp
index 0e3a3bf276..f031dd24b3 100644
--- a/src/mir_app/src/chat_manager.cpp
+++ b/src/mir_app/src/chat_manager.cpp
@@ -33,7 +33,7 @@ MODULEINFO *m_ModList = 0;
static void SetActiveSessionEx(SESSION_INFO *si)
{
if (si) {
- replaceStrT(chatApi.szActiveWndID, si->ptszID);
+ replaceStrW(chatApi.szActiveWndID, si->ptszID);
replaceStr(chatApi.szActiveWndModule, si->pszModule);
}
}
@@ -66,7 +66,7 @@ static SESSION_INFO* SM_AddSession(const wchar_t *pszID, const char *pszModule)
return NULL;
SESSION_INFO *node = (SESSION_INFO*)mir_calloc(g_cbSession);
- node->ptszID = mir_tstrdup(pszID);
+ node->ptszID = mir_wstrdup(pszID);
node->pszModule = mir_strdup(pszModule);
if (chatApi.wndList == NULL) { // list is empty
@@ -122,7 +122,7 @@ static int SM_RemoveSession(const wchar_t *pszID, const char *pszModule, BOOL re
SESSION_INFO *pTemp = chatApi.wndList, *pLast = NULL;
while (pTemp != NULL) {
// match
- if ((!pszID && pTemp->iType != GCW_SERVER || !mir_tstrcmpi(pTemp->ptszID, pszID)) && !mir_strcmpi(pTemp->pszModule, pszModule)) {
+ if ((!pszID && pTemp->iType != GCW_SERVER || !mir_wstrcmpi(pTemp->ptszID, pszID)) && !mir_strcmpi(pTemp->pszModule, pszModule)) {
DWORD dw = pTemp->dwItemData;
if (chatApi.OnRemoveSession)
@@ -162,7 +162,7 @@ static SESSION_INFO* SM_FindSession(const wchar_t *pszID, const char *pszModule)
return NULL;
for (SESSION_INFO *si = chatApi.wndList; si != NULL; si = si->next)
- if (!mir_tstrcmpi(si->ptszID, pszID) && !mir_strcmpi(si->pszModule, pszModule))
+ if (!mir_wstrcmpi(si->ptszID, pszID) && !mir_strcmpi(si->pszModule, pszModule))
return si;
return NULL;
@@ -174,7 +174,7 @@ static BOOL SM_SetOffline(const wchar_t *pszID, const char *pszModule)
return FALSE;
for (SESSION_INFO *si = chatApi.wndList; si != NULL; si = si->next) {
- if ((pszID && mir_tstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
+ if ((pszID && mir_wstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
continue;
chatApi.UM_RemoveAll(&si->pUsers);
@@ -196,7 +196,7 @@ static BOOL SM_SetStatusEx(const wchar_t *pszID, const char *pszModule, const wc
return FALSE;
for (SESSION_INFO *si = chatApi.wndList; si != NULL; si = si->next) {
- if ((pszID && mir_tstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
+ if ((pszID && mir_wstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
continue;
chatApi.UM_SetStatusEx(si->pUsers, pszText, flags);
@@ -258,10 +258,10 @@ static BOOL SM_AddEvent(const wchar_t *pszID, const char *pszModule, GCEVENT *gc
p->iEventCount += 1;
li->iType = gce->pDest->iType;
- li->ptszNick = mir_tstrdup(gce->ptszNick);
- li->ptszText = mir_tstrdup(gce->ptszText);
- li->ptszStatus = mir_tstrdup(gce->ptszStatus);
- li->ptszUserInfo = mir_tstrdup(gce->ptszUserInfo);
+ li->ptszNick = mir_wstrdup(gce->ptszNick);
+ li->ptszText = mir_wstrdup(gce->ptszText);
+ li->ptszStatus = mir_wstrdup(gce->ptszStatus);
+ li->ptszUserInfo = mir_wstrdup(gce->ptszUserInfo);
li->bIsMe = gce->bIsMe;
li->time = gce->time;
@@ -308,7 +308,7 @@ static BOOL SM_RemoveUser(const wchar_t *pszID, const char *pszModule, const wch
return FALSE;
for (SESSION_INFO *si = chatApi.wndList; si != NULL; si = si->next) {
- if ((pszID && mir_tstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
+ if ((pszID && mir_wstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
continue;
USERINFO *ui = chatApi.UM_FindUser(si->pUsers, pszUID);
@@ -403,7 +403,7 @@ static LRESULT SM_SendMessage(const wchar_t *pszID, const char *pszModule, UINT
return 0;
for (SESSION_INFO *si = chatApi.wndList; si != NULL; si = si->next) {
- if ((pszID && mir_tstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
+ if ((pszID && mir_wstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
continue;
if (si->hWnd) {
@@ -450,7 +450,7 @@ static BOOL SM_SetStatus(const wchar_t *pszID, const char *pszModule, int wStatu
return FALSE;
for (SESSION_INFO *si = chatApi.wndList; si != NULL; si = si->next) {
- if ((pszID && mir_tstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
+ if ((pszID && mir_wstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
continue;
si->wStatus = wStatus;
@@ -476,7 +476,7 @@ static BOOL SM_SendUserMessage(const wchar_t *pszID, const char *pszModule, cons
return FALSE;
for (SESSION_INFO *si = chatApi.wndList; si != NULL; si = si->next) {
- if ((pszID && mir_tstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
+ if ((pszID && mir_wstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
continue;
if (si->iType == GCW_CHATROOM || si->iType == GCW_PRIVMESS)
@@ -493,12 +493,12 @@ static BOOL SM_ChangeUID(const wchar_t *pszID, const char *pszModule, const wcha
return FALSE;
for (SESSION_INFO *si = chatApi.wndList; si != NULL; si = si->next) {
- if ((pszID && mir_tstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
+ if ((pszID && mir_wstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
continue;
USERINFO *ui = chatApi.UM_FindUser(si->pUsers, pszUID);
if (ui)
- replaceStrT(ui->pszUID, pszNewUID);
+ replaceStrW(ui->pszUID, pszNewUID);
if (pszID)
return TRUE;
}
@@ -511,10 +511,10 @@ static BOOL SM_ChangeNick(const wchar_t *pszID, const char *pszModule, GCEVENT *
return FALSE;
for (SESSION_INFO *si = chatApi.wndList; si != NULL; si = si->next) {
- if ((!pszID || !mir_tstrcmpi(si->ptszID, pszID)) && !mir_strcmpi(si->pszModule, pszModule)) {
+ if ((!pszID || !mir_wstrcmpi(si->ptszID, pszID)) && !mir_strcmpi(si->pszModule, pszModule)) {
USERINFO *ui = chatApi.UM_FindUser(si->pUsers, gce->ptszUID);
if (ui) {
- replaceStrT(ui->pszNick, gce->ptszText);
+ replaceStrW(ui->pszNick, gce->ptszText);
SM_MoveUser(si->ptszID, si->pszModule, ui->pszUID);
if (si->hWnd)
SendMessage(si->hWnd, GC_UPDATENICKLIST, 0, 0);
@@ -670,7 +670,7 @@ static char* SM_GetUsers(SESSION_INFO *si)
char* p = NULL;
size_t alloced = 0;
do {
- size_t pLen = mir_strlen(p), nameLen = mir_tstrlen(utemp->pszUID);
+ size_t pLen = mir_strlen(p), nameLen = mir_wstrlen(utemp->pszUID);
if (pLen + nameLen + 2 > alloced)
p = (char*)mir_realloc(p, alloced += 4096);
@@ -795,7 +795,7 @@ static STATUSINFO* TM_AddStatus(STATUSINFO **ppStatusList, const wchar_t *pszSta
if (!chatApi.TM_FindStatus(*ppStatusList, pszStatus)) {
STATUSINFO *node = (STATUSINFO*)mir_alloc(sizeof(STATUSINFO));
memset(node, 0, sizeof(STATUSINFO));
- replaceStrT(node->pszGroup, pszStatus);
+ replaceStrW(node->pszGroup, pszStatus);
node->hIcon = (HICON)(*iCount);
while ((INT_PTR)node->hIcon > STATUSICONCOUNT - 1)
node->hIcon--;
@@ -822,7 +822,7 @@ static STATUSINFO* TM_FindStatus(STATUSINFO *pStatusList, const wchar_t *pszStat
return NULL;
for (STATUSINFO *pTemp = pStatusList; pTemp != NULL; pTemp = pTemp->next)
- if (mir_tstrcmpi(pTemp->pszGroup, pszStatus) == 0)
+ if (mir_wstrcmpi(pTemp->pszGroup, pszStatus) == 0)
return pTemp;
return 0;
@@ -834,7 +834,7 @@ static WORD TM_StringToWord(STATUSINFO *pStatusList, const wchar_t *pszStatus)
return 0;
for (STATUSINFO *pTemp = pStatusList; pTemp != NULL; pTemp = pTemp->next) {
- if (mir_tstrcmpi(pTemp->pszGroup, pszStatus) == 0)
+ if (mir_wstrcmpi(pTemp->pszGroup, pszStatus) == 0)
return pTemp->Status;
if (pTemp->next == NULL)
@@ -893,12 +893,12 @@ static int UM_CompareItem(USERINFO *u1, const wchar_t *pszNick, WORD wStatus)
if ((dw2 & 1) && !(dw1 & 1))
return 1;
if ((dw1 & 1) && (dw2 & 1))
- return mir_tstrcmpi(u1->pszNick, pszNick);
+ return mir_wstrcmpi(u1->pszNick, pszNick);
dw1 = dw1 >> 1;
dw2 = dw2 >> 1;
}
- return mir_tstrcmpi(u1->pszNick, pszNick);
+ return mir_wstrcmpi(u1->pszNick, pszNick);
}
static USERINFO* UM_SortUser(USERINFO **ppUserList, const wchar_t *pszUID)
@@ -907,7 +907,7 @@ static USERINFO* UM_SortUser(USERINFO **ppUserList, const wchar_t *pszUID)
if (!ui || !pszUID)
return NULL;
- while (ui && mir_tstrcmpi(ui->pszUID, pszUID)) {
+ while (ui && mir_wstrcmpi(ui->pszUID, pszUID)) {
pLast = ui;
ui = ui->next;
}
@@ -960,7 +960,7 @@ USERINFO* UM_AddUser(STATUSINFO *pStatusList, USERINFO **ppUserList, const wchar
// if (!UM_FindUser(*ppUserList, pszUI, wStatus)
USERINFO *node = (USERINFO*)mir_calloc(sizeof(USERINFO));
- replaceStrT(node->pszUID, pszUID);
+ replaceStrW(node->pszUID, pszUID);
if (*ppUserList == NULL) { // list is empty
*ppUserList = node;
@@ -986,7 +986,7 @@ static USERINFO* UM_FindUser(USERINFO *pUserList, const wchar_t *pszUID)
return NULL;
for (USERINFO *ui = pUserList; ui != NULL; ui = ui->next)
- if (!mir_tstrcmpi(ui->pszUID, pszUID))
+ if (!mir_wstrcmpi(ui->pszUID, pszUID))
return ui;
return NULL;
@@ -1040,7 +1040,7 @@ static BOOL UM_SetStatusEx(USERINFO *pUserList, const wchar_t* pszText, int flag
if (s) {
ui->iStatusEx = 0;
if (s == pszText || s[-1] == cDelimiter) {
- size_t len = mir_tstrlen(ui->pszUID);
+ size_t len = mir_wstrlen(ui->pszUID);
if (s[len] == cDelimiter || s[len] == '\0')
ui->iStatusEx = (!bOnlyMe || bSetStatus) ? 1 : 0;
}
@@ -1068,7 +1068,7 @@ static wchar_t* UM_FindUserAutoComplete(USERINFO *pUserList, const wchar_t* pszO
wchar_t *pszName = NULL;
for (USERINFO *ui = pUserList; ui != NULL; ui = ui->next)
if (ui->pszNick && my_strstri(ui->pszNick, pszOriginal) == ui->pszNick)
- if (mir_tstrcmpi(ui->pszNick, pszCurrent) > 0 && (!pszName || mir_tstrcmpi(ui->pszNick, pszName) < 0))
+ if (mir_wstrcmpi(ui->pszNick, pszCurrent) > 0 && (!pszName || mir_wstrcmpi(ui->pszNick, pszName) < 0))
pszName = ui->pszNick;
return pszName;
@@ -1081,7 +1081,7 @@ static BOOL UM_RemoveUser(USERINFO **ppUserList, const wchar_t *pszUID)
USERINFO *ui = *ppUserList, *pLast = NULL;
while (ui != NULL) {
- if (!mir_tstrcmpi(ui->pszUID, pszUID)) {
+ if (!mir_wstrcmpi(ui->pszUID, pszUID)) {
if (pLast == NULL)
*ppUserList = ui->next;
else
diff --git a/src/mir_app/src/chat_opts.cpp b/src/mir_app/src/chat_opts.cpp
index 0acccfbd2c..969e01ebb6 100644
--- a/src/mir_app/src/chat_opts.cpp
+++ b/src/mir_app/src/chat_opts.cpp
@@ -120,9 +120,9 @@ void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour)
lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
mir_snprintf(str, "Font%d", i);
- ptrT tszFace(db_get_tsa(NULL, CHATFONT_MODULE, str));
+ ptrW tszFace(db_get_tsa(NULL, CHATFONT_MODULE, str));
if (tszFace == NULL)
- mir_tstrcpy(lf->lfFaceName, FO.szDefFace);
+ mir_wstrcpy(lf->lfFaceName, FO.szDefFace);
else
wcsncpy_s(lf->lfFaceName, tszFace, _TRUNCATE);
}
@@ -193,10 +193,10 @@ static void InitSetting(wchar_t** ppPointer, char* pszSetting, wchar_t* pszDefau
{
DBVARIANT dbv;
if (!db_get_ts(NULL, CHAT_MODULE, pszSetting, &dbv)) {
- replaceStrT(*ppPointer, dbv.ptszVal);
+ replaceStrW(*ppPointer, dbv.ptszVal);
db_free(&dbv);
}
- else replaceStrT(*ppPointer, pszDefault);
+ else replaceStrW(*ppPointer, pszDefault);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -313,7 +313,7 @@ int OptionsInit(void)
LOGFONT lf;
LoadMsgDlgFont(18, &lf, NULL);
- mir_tstrcpy(lf.lfFaceName, L"MS Shell Dlg");
+ mir_wstrcpy(lf.lfFaceName, L"MS Shell Dlg");
lf.lfUnderline = lf.lfItalic = lf.lfStrikeOut = 0;
lf.lfHeight = -17;
lf.lfWeight = FW_BOLD;
diff --git a/src/mir_app/src/chat_rtf.cpp b/src/mir_app/src/chat_rtf.cpp
index e2cf0addef..1b901c3cb4 100644
--- a/src/mir_app/src/chat_rtf.cpp
+++ b/src/mir_app/src/chat_rtf.cpp
@@ -116,7 +116,7 @@ int DoRtfToTags(CMString &pszText, int iNumColors, COLORREF *pColors)
else if (!wcsncmp(p, L"\\highlight", 10)) { //background color
wchar_t szTemp[20];
int iCol = _wtoi(p + 10);
- mir_sntprintf(szTemp, L"%d", iCol);
+ mir_snwprintf(szTemp, L"%d", iCol);
}
else if (!wcsncmp(p, L"\\line", 5)) { // soft line break;
res.AppendChar('\n');
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index 6a00cde117..dd1ad27d09 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -168,7 +168,7 @@ static INT_PTR Service_Register(WPARAM, LPARAM lParam)
if (mi == NULL)
return GC_REGISTER_ERROR;
- mi->ptszModDispName = mir_tstrdup(gcr->ptszDispName);
+ mi->ptszModDispName = mir_wstrdup(gcr->ptszDispName);
mi->bBold = (gcr->dwFlags & GC_BOLD) != 0;
mi->bUnderline = (gcr->dwFlags & GC_UNDERLINE) != 0;
mi->bItalics = (gcr->dwFlags & GC_ITALICS) != 0;
@@ -231,8 +231,8 @@ static INT_PTR Service_NewChat(WPARAM, LPARAM lParam)
si->wStatus = ID_STATUS_ONLINE;
si->iType = gcw->iType;
si->dwFlags = gcw->dwFlags;
- si->ptszName = mir_tstrdup(gcw->ptszName);
- si->ptszStatusbarText = mir_tstrdup(gcw->ptszStatusbarText);
+ si->ptszName = mir_wstrdup(gcw->ptszName);
+ si->ptszStatusbarText = mir_wstrdup(gcw->ptszStatusbarText);
si->iSplitterX = g_Settings->iSplitterX;
si->iSplitterY = g_Settings->iSplitterY;
si->iLogFilterFlags = db_get_dw(NULL, CHAT_MODULE, "FilterFlags", 0x03E0);
@@ -250,7 +250,7 @@ static INT_PTR Service_NewChat(WPARAM, LPARAM lParam)
wchar_t szTemp[256];
if (si->iType == GCW_SERVER)
- mir_sntprintf(szTemp, L"Server: %s", si->ptszName);
+ mir_snwprintf(szTemp, L"Server: %s", si->ptszName);
else
wcsncpy_s(szTemp, si->ptszName, _TRUNCATE);
si->hContact = chatApi.AddRoom(gcw->pszModule, gcw->ptszID, szTemp, si->iType);
@@ -334,7 +334,7 @@ static int DoControl(GCEVENT *gce, WPARAM wp)
else if (gce->pDest->iType == GC_EVENT_CHANGESESSIONAME && gce->ptszText) {
if (si = chatApi.SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule)) {
- replaceStrT(si->ptszName, gce->ptszText);
+ replaceStrW(si->ptszName, gce->ptszText);
if (si->hWnd)
SendMessage(si->hWnd, GC_UPDATETITLE, 0, 0);
if (chatApi.OnRenameSession)
@@ -356,7 +356,7 @@ static int DoControl(GCEVENT *gce, WPARAM wp)
}
else if (gce->pDest->iType == GC_EVENT_SETSBTEXT) {
if (si = chatApi.SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule)) {
- replaceStrT(si->ptszStatusbarText, gce->ptszText);
+ replaceStrW(si->ptszStatusbarText, gce->ptszText);
if (si->ptszStatusbarText)
db_set_ts(si->hContact, si->pszModule, "StatusBar", si->ptszStatusbarText);
else
@@ -389,7 +389,7 @@ static void AddUser(GCEVENT *gce)
USERINFO *ui = chatApi.SM_AddUser(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID, gce->ptszNick, status);
if (ui == NULL) return;
- ui->pszNick = mir_tstrdup(gce->ptszNick);
+ ui->pszNick = mir_wstrdup(gce->ptszNick);
if (gce->bIsMe)
si->pMe = ui;
ui->Status = status;
@@ -450,7 +450,7 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
case GC_EVENT_TOPIC:
if (SESSION_INFO *si = chatApi.SM_FindSession(gcd->ptszID, gcd->pszModule)) {
if (gce->ptszText) {
- replaceStrT(si->ptszTopic, RemoveFormatting(gce->ptszText));
+ replaceStrW(si->ptszTopic, RemoveFormatting(gce->ptszText));
db_set_ts(si->hContact, si->pszModule, "Topic", si->ptszTopic);
if (chatApi.OnSetTopic)
chatApi.OnSetTopic(si);
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp
index 3e18186f85..33f7574dd2 100644
--- a/src/mir_app/src/chat_tools.cpp
+++ b/src/mir_app/src/chat_tools.cpp
@@ -44,7 +44,7 @@ wchar_t* RemoveFormatting(const wchar_t *pszWord)
return NULL;
wchar_t *d = szTemp;
- size_t cbLen = mir_tstrlen(pszWord);
+ size_t cbLen = mir_wstrlen(pszWord);
if (cbLen > _countof(szTemp))
cbLen = _countof(szTemp)-1;
@@ -167,12 +167,12 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char *pszProtoNa
{
static wchar_t szBuf[4 * 1024];
- if (!fmt || fmt[0] == 0 || mir_tstrlen(fmt) > 2000)
+ if (!fmt || fmt[0] == 0 || mir_wstrlen(fmt) > 2000)
return 0;
va_list marker;
va_start(marker, fmt);
- mir_vsntprintf(szBuf, 4096, fmt, marker);
+ mir_vsnwprintf(szBuf, 4096, fmt, marker);
va_end(marker);
POPUPDATAT pd = { 0 };
@@ -184,8 +184,8 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char *pszProtoNa
pd.lchIcon = LoadIconEx("window", FALSE);
PROTOACCOUNT *pa = Proto_GetAccount(pszProtoName);
- mir_sntprintf(pd.lptzContactName, L"%s - %s", (pa == NULL) ? _A2T(pszProtoName) : pa->tszAccountName, cli.pfnGetContactDisplayName(hContact, 0));
- mir_tstrncpy(pd.lptzText, TranslateTS(szBuf), _countof(pd.lptzText));
+ mir_snwprintf(pd.lptzContactName, L"%s - %s", (pa == NULL) ? _A2T(pszProtoName) : pa->tszAccountName, cli.pfnGetContactDisplayName(hContact, 0));
+ mir_wstrncpy(pd.lptzText, TranslateTS(szBuf), _countof(pd.lptzText));
pd.iSeconds = g_Settings->iPopupTimeout;
if (g_Settings->iPopupStyle == 2) {
@@ -443,7 +443,7 @@ BOOL IsHighlighted(SESSION_INFO *si, GCEVENT *gce)
p += _tcsspn(p, L" ");
// compare the words, using wildcards
- if (wildcmpit(p, tszToken))
+ if (wildcmpiw(p, tszToken))
return TRUE;
}
}
@@ -468,7 +468,7 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce)
CreateDirectoryTreeT(tszFolder);
wchar_t szTime[100];
- mir_tstrncpy(szTime, chatApi.MakeTimeStamp(g_Settings->pszTimeStampLog, gce->time), 99);
+ mir_wstrncpy(szTime, chatApi.MakeTimeStamp(g_Settings->pszTimeStampLog, gce->time), 99);
FILE *hFile = _wfopen(si->pszLogFileName, L"ab+");
if (hFile == NULL)
@@ -479,14 +479,14 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce)
if (bFileJustCreated)
fputws((const wchar_t*)"\377\376", hFile); //UTF-16 LE BOM == FF FE
if (gce->ptszNick) {
- if (g_Settings->bLogLimitNames && mir_tstrlen(gce->ptszNick) > 20) {
- mir_tstrncpy(szTemp2, gce->ptszNick, 20);
- mir_tstrncpy(szTemp2 + 20, L"...", 4);
+ if (g_Settings->bLogLimitNames && mir_wstrlen(gce->ptszNick) > 20) {
+ mir_wstrncpy(szTemp2, gce->ptszNick, 20);
+ mir_wstrncpy(szTemp2 + 20, L"...", 4);
}
- else mir_tstrncpy(szTemp2, gce->ptszNick, 511);
+ else mir_wstrncpy(szTemp2, gce->ptszNick, 511);
if (gce->ptszUserInfo)
- mir_sntprintf(szTemp, L"%s (%s)", szTemp2, gce->ptszUserInfo);
+ mir_snwprintf(szTemp, L"%s (%s)", szTemp2, gce->ptszUserInfo);
else
wcsncpy_s(szTemp, szTemp2, _TRUNCATE);
pszNick = szTemp;
@@ -496,52 +496,52 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce)
case GC_EVENT_MESSAGE:
case GC_EVENT_MESSAGE | GC_EVENT_HIGHLIGHT:
p = '*';
- mir_sntprintf(szBuffer, L"%s: %s", gce->ptszNick, chatApi.RemoveFormatting(gce->ptszText));
+ mir_snwprintf(szBuffer, L"%s: %s", gce->ptszNick, chatApi.RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_ACTION:
case GC_EVENT_ACTION | GC_EVENT_HIGHLIGHT:
p = '*';
- mir_sntprintf(szBuffer, L"%s %s", gce->ptszNick, chatApi.RemoveFormatting(gce->ptszText));
+ mir_snwprintf(szBuffer, L"%s %s", gce->ptszNick, chatApi.RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_JOIN:
p = '>';
- mir_sntprintf(szBuffer, TranslateT("%s has joined"), pszNick);
+ mir_snwprintf(szBuffer, TranslateT("%s has joined"), pszNick);
break;
case GC_EVENT_PART:
p = '<';
if (!gce->ptszText)
- mir_sntprintf(szBuffer, TranslateT("%s has left"), pszNick);
+ mir_snwprintf(szBuffer, TranslateT("%s has left"), pszNick);
else
- mir_sntprintf(szBuffer, TranslateT("%s has left (%s)"), pszNick, chatApi.RemoveFormatting(gce->ptszText));
+ mir_snwprintf(szBuffer, TranslateT("%s has left (%s)"), pszNick, chatApi.RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_QUIT:
p = '<';
if (!gce->ptszText)
- mir_sntprintf(szBuffer, TranslateT("%s has disconnected"), pszNick);
+ mir_snwprintf(szBuffer, TranslateT("%s has disconnected"), pszNick);
else
- mir_sntprintf(szBuffer, TranslateT("%s has disconnected (%s)"), pszNick, chatApi.RemoveFormatting(gce->ptszText));
+ mir_snwprintf(szBuffer, TranslateT("%s has disconnected (%s)"), pszNick, chatApi.RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_NICK:
p = '^';
- mir_sntprintf(szBuffer, TranslateT("%s is now known as %s"), gce->ptszNick, gce->ptszText);
+ mir_snwprintf(szBuffer, TranslateT("%s is now known as %s"), gce->ptszNick, gce->ptszText);
break;
case GC_EVENT_KICK:
p = '~';
if (!gce->ptszText)
- mir_sntprintf(szBuffer, TranslateT("%s kicked %s"), gce->ptszStatus, gce->ptszNick);
+ mir_snwprintf(szBuffer, TranslateT("%s kicked %s"), gce->ptszStatus, gce->ptszNick);
else
- mir_sntprintf(szBuffer, TranslateT("%s kicked %s (%s)"), gce->ptszStatus, gce->ptszNick, chatApi.RemoveFormatting(gce->ptszText));
+ mir_snwprintf(szBuffer, TranslateT("%s kicked %s (%s)"), gce->ptszStatus, gce->ptszNick, chatApi.RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_NOTICE:
p = 'o';
- mir_sntprintf(szBuffer, TranslateT("Notice from %s: %s"), gce->ptszNick, chatApi.RemoveFormatting(gce->ptszText));
+ mir_snwprintf(szBuffer, TranslateT("Notice from %s: %s"), gce->ptszNick, chatApi.RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_TOPIC:
p = '#';
if (!gce->ptszNick)
- mir_sntprintf(szBuffer, TranslateT("The topic is '%s'"), chatApi.RemoveFormatting(gce->ptszText));
+ mir_snwprintf(szBuffer, TranslateT("The topic is '%s'"), chatApi.RemoveFormatting(gce->ptszText));
else
- mir_sntprintf(szBuffer, TranslateT("The topic is '%s' (set by %s)"), chatApi.RemoveFormatting(gce->ptszText), gce->ptszNick);
+ mir_snwprintf(szBuffer, TranslateT("The topic is '%s' (set by %s)"), chatApi.RemoveFormatting(gce->ptszText), gce->ptszNick);
break;
case GC_EVENT_INFORMATION:
p = '!';
@@ -549,20 +549,20 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce)
break;
case GC_EVENT_ADDSTATUS:
p = '+';
- mir_sntprintf(szBuffer, TranslateT("%s enables '%s' status for %s"), gce->ptszText, gce->ptszStatus, gce->ptszNick);
+ mir_snwprintf(szBuffer, TranslateT("%s enables '%s' status for %s"), gce->ptszText, gce->ptszStatus, gce->ptszNick);
break;
case GC_EVENT_REMOVESTATUS:
p = '-';
- mir_sntprintf(szBuffer, TranslateT("%s disables '%s' status for %s"), gce->ptszText, gce->ptszStatus, gce->ptszNick);
+ mir_snwprintf(szBuffer, TranslateT("%s disables '%s' status for %s"), gce->ptszText, gce->ptszStatus, gce->ptszNick);
break;
}
// formatting strings don't need to be translatable - changing them via language pack would
// only screw up the log format.
if (p)
- mir_sntprintf(szLine, L"%s %c %s\r\n", szTime, p, szBuffer);
+ mir_snwprintf(szLine, L"%s %c %s\r\n", szTime, p, szBuffer);
else
- mir_sntprintf(szLine, L"%s %s\r\n", szTime, szBuffer);
+ mir_snwprintf(szLine, L"%s %s\r\n", szTime, szBuffer);
if (szLine[0]) {
fputws(szLine, hFile);
@@ -587,11 +587,11 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce)
_wsplitpath(si->pszLogFileName, tszDrive, tszDir, tszName, tszExt);
wchar_t tszNewPath[_MAX_DRIVE + _MAX_DIR + _MAX_FNAME + _MAX_EXT + 20];
- mir_sntprintf(tszNewPath, L"%s%sarchived\\", tszDrive, tszDir);
+ mir_snwprintf(tszNewPath, L"%s%sarchived\\", tszDrive, tszDir);
CreateDirectoryTreeT(tszNewPath);
wchar_t tszNewName[_MAX_DRIVE + _MAX_DIR + _MAX_FNAME + _MAX_EXT + 20];
- mir_sntprintf(tszNewName, L"%s%s-%s%s", tszNewPath, tszName, tszTimestamp, tszExt);
+ mir_snwprintf(tszNewName, L"%s%s-%s%s", tszNewPath, tszName, tszTimestamp, tszExt);
fclose(hFile);
hFile = 0;
if (!PathFileExists(tszNewName))
@@ -614,12 +614,12 @@ BOOL DoEventHookAsync(HWND hwnd, const wchar_t *pszID, const char *pszModule, in
GCDEST *gcd = (GCDEST*)mir_calloc(sizeof(GCDEST));
gcd->pszModule = mir_strdup(pszModule);
- gcd->ptszID = mir_tstrdup(pszID);
+ gcd->ptszID = mir_wstrdup(pszID);
gcd->iType = iType;
GCHOOK *gch = (GCHOOK*)mir_calloc(sizeof(GCHOOK));
- gch->ptszUID = mir_tstrdup(pszUID);
- gch->ptszText = mir_tstrdup(pszText);
+ gch->ptszUID = mir_wstrdup(pszUID);
+ gch->ptszText = mir_wstrdup(pszText);
gch->dwData = dwItem;
gch->pDest = gcd;
PostMessage(hwnd, GC_FIREHOOK, 0, (LPARAM)gch);
@@ -697,7 +697,7 @@ wchar_t* GetChatLogsFilename(SESSION_INFO *si, time_t tTime)
// check whether relevant parts of the timestamp have changed and
// we have to reparse the filename
wchar_t *tszNow = chatApi.MakeTimeStamp(L"%a%d%m%Y", tTime); // once a day
- if (mir_tstrcmp(tszOldTimeStamp, tszNow)) {
+ if (mir_wstrcmp(tszOldTimeStamp, tszNow)) {
wcsncpy_s(tszOldTimeStamp, tszNow, _TRUNCATE);
*si->pszLogFileName = 0;
}
@@ -705,41 +705,41 @@ wchar_t* GetChatLogsFilename(SESSION_INFO *si, time_t tTime)
if (si->pszLogFileName[0] == 0) {
REPLACEVARSARRAY rva[11];
rva[0].key.w = L"d";
- rva[0].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%#d", tTime));
+ rva[0].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%#d", tTime));
// day 01-31
rva[1].key.w = L"dd";
- rva[1].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%d", tTime));
+ rva[1].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%d", tTime));
// month 1-12
rva[2].key.w = L"m";
- rva[2].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%#m", tTime));
+ rva[2].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%#m", tTime));
// month 01-12
rva[3].key.w = L"mm";
- rva[3].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%m", tTime));
+ rva[3].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%m", tTime));
// month text short
rva[4].key.w = L"mon";
- rva[4].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%b", tTime));
+ rva[4].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%b", tTime));
// month text
rva[5].key.w = L"month";
- rva[5].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%B", tTime));
+ rva[5].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%B", tTime));
// year 01-99
rva[6].key.w = L"yy";
- rva[6].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%y", tTime));
+ rva[6].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%y", tTime));
// year 1901-9999
rva[7].key.w = L"yyyy";
- rva[7].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%Y", tTime));
+ rva[7].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%Y", tTime));
// weekday short
rva[8].key.w = L"wday";
- rva[8].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%a", tTime));
+ rva[8].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%a", tTime));
// weekday
rva[9].key.w = L"weekday";
- rva[9].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%A", tTime));
+ rva[9].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%A", tTime));
// end of array
rva[10].key.w = NULL;
rva[10].value.w = NULL;
wchar_t tszTemp[MAX_PATH], *ptszVarPath;
- if (g_Settings->pszLogDir[mir_tstrlen(g_Settings->pszLogDir) - 1] == '\\') {
- mir_sntprintf(tszTemp, L"%s%s", g_Settings->pszLogDir, L"%userid%.log");
+ if (g_Settings->pszLogDir[mir_wstrlen(g_Settings->pszLogDir) - 1] == '\\') {
+ mir_snwprintf(tszTemp, L"%s%s", g_Settings->pszLogDir, L"%userid%.log");
ptszVarPath = tszTemp;
}
else ptszVarPath = g_Settings->pszLogDir;
diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp
index dbc1974660..d331cbbb51 100644
--- a/src/mir_app/src/clc.cpp
+++ b/src/mir_app/src/clc.cpp
@@ -406,9 +406,9 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
}
if (dbcws->value.type == DBVT_ASCIIZ)
- eq = !mir_tstrcmp(szFullName, _A2T(dbcws->value.pszVal+1));
+ eq = !mir_wstrcmp(szFullName, _A2T(dbcws->value.pszVal+1));
else
- eq = !mir_tstrcmp(szFullName, ptrT(mir_utf8decodeT(dbcws->value.pszVal + 1)));
+ eq = !mir_wstrcmp(szFullName, ptrW(mir_utf8decodeW(dbcws->value.pszVal + 1)));
if (eq && (contact->group->hideOffline != 0) == ((dbcws->value.pszVal[0] & GROUPF_HIDEOFFLINE) != 0))
break; //only expanded has changed: no action reqd
@@ -546,7 +546,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
if (!cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL))
break;
- mir_tstrncpy(contact->szText, cli.pfnGetContactDisplayName(wParam, 0), _countof(contact->szText));
+ mir_wstrncpy(contact->szText, cli.pfnGetContactDisplayName(wParam, 0), _countof(contact->szText));
dat->bNeedsResort = true;
SortClcByTimer(hwnd);
break;
@@ -557,7 +557,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
contact->proto = GetContactProto(wParam);
cli.pfnInvalidateDisplayNameCacheEntry(wParam);
- mir_tstrncpy(contact->szText, cli.pfnGetContactDisplayName(wParam, 0), _countof(contact->szText));
+ mir_wstrncpy(contact->szText, cli.pfnGetContactDisplayName(wParam, 0), _countof(contact->szText));
SortClcByTimer(hwnd);
break;
@@ -759,7 +759,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
if (wParam == 27) //escape
dat->szQuickSearch[0] = 0;
else if (wParam == '\b' && dat->szQuickSearch[0])
- dat->szQuickSearch[mir_tstrlen(dat->szQuickSearch) - 1] = '\0';
+ dat->szQuickSearch[mir_wstrlen(dat->szQuickSearch) - 1] = '\0';
else if (wParam < ' ')
break;
else if (wParam == ' ' && dat->szQuickSearch[0] == '\0' && GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_CHECKBOXES) {
@@ -784,11 +784,11 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
wchar_t szNew[2];
szNew[0] = (wchar_t)wParam;
szNew[1] = '\0';
- if (mir_tstrlen(dat->szQuickSearch) >= _countof(dat->szQuickSearch) - 1) {
+ if (mir_wstrlen(dat->szQuickSearch) >= _countof(dat->szQuickSearch) - 1) {
MessageBeep(MB_OK);
break;
}
- mir_tstrcat(dat->szQuickSearch, szNew);
+ mir_wstrcat(dat->szQuickSearch, szNew);
}
if (dat->bFilterSearch)
@@ -801,7 +801,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
dat->selection = index;
else {
MessageBeep(MB_OK);
- dat->szQuickSearch[mir_tstrlen(dat->szQuickSearch) - 1] = '\0';
+ dat->szQuickSearch[mir_wstrlen(dat->szQuickSearch) - 1] = '\0';
cli.pfnSaveStateAndRebuildList(hwnd, dat);
}
cli.pfnInvalidateRect(hwnd, NULL, FALSE);
@@ -1111,7 +1111,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
CallService(MS_CLIST_CONTACTCHANGEGROUP, (WPARAM)contacto->hContact, contactn->groupId);
else if (contacto->type == CLCIT_GROUP) { //dropee is a group
wchar_t szNewName[120];
- mir_sntprintf(szNewName, L"%s\\%s", Clist_GroupGetName(contactn->groupId, NULL), contacto->szText);
+ mir_snwprintf(szNewName, L"%s\\%s", Clist_GroupGetName(contactn->groupId, NULL), contacto->szText);
Clist_GroupRename(contacto->groupId, szNewName);
}
}
@@ -1150,7 +1150,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
break;
if (contact->type == CLCIT_GROUP) { //dropee is a group
wchar_t szNewName[120];
- mir_tstrncpy(szNewName, contact->szText, _countof(szNewName));
+ mir_wstrncpy(szNewName, contact->szText, _countof(szNewName));
Clist_GroupRename(contact->groupId, szNewName);
}
else if (contact->type == CLCIT_CONTACT) //dropee is a contact
diff --git a/src/mir_app/src/clcfiledrop.cpp b/src/mir_app/src/clcfiledrop.cpp
index 8739ae5b86..77ece42958 100644
--- a/src/mir_app/src/clcfiledrop.cpp
+++ b/src/mir_app/src/clcfiledrop.cpp
@@ -147,7 +147,7 @@ HRESULT CDropTarget::DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL
shortPt.y = pt.y;
hwnd = WindowFromPoint(shortPt);
GetClassName(hwnd, szWindowClass, _countof(szWindowClass));
- if (!mir_tstrcmp(szWindowClass, CLISTCONTROL_CLASSW)) {
+ if (!mir_wstrcmp(szWindowClass, CLISTCONTROL_CLASSW)) {
hwndCurrentDrag = hwnd;
ClcData *dat = (ClcData *) GetWindowLongPtr(hwndCurrentDrag, 0);
originalSelection = dat->selection;
@@ -176,20 +176,20 @@ static void AddToFileList(wchar_t ***pppFiles, int *totalCount, const wchar_t *s
{
*pppFiles = (wchar_t **) mir_realloc(*pppFiles, (++*totalCount + 1) * sizeof(wchar_t *));
(*pppFiles)[*totalCount] = NULL;
- (*pppFiles)[*totalCount - 1] = mir_tstrdup(szFilename);
+ (*pppFiles)[*totalCount - 1] = mir_wstrdup(szFilename);
if (GetFileAttributes(szFilename) & FILE_ATTRIBUTE_DIRECTORY) {
WIN32_FIND_DATA fd;
HANDLE hFind;
wchar_t szPath[MAX_PATH];
- mir_tstrcpy(szPath, szFilename);
- mir_tstrcat(szPath, L"\\*");
+ mir_wstrcpy(szPath, szFilename);
+ mir_wstrcat(szPath, L"\\*");
if (hFind = FindFirstFile(szPath, &fd)) {
do {
- if (!mir_tstrcmp(fd.cFileName, L".") || !mir_tstrcmp(fd.cFileName, L".."))
+ if (!mir_wstrcmp(fd.cFileName, L".") || !mir_wstrcmp(fd.cFileName, L".."))
continue;
- mir_tstrcpy(szPath, szFilename);
- mir_tstrcat(szPath, L"\\");
- mir_tstrcat(szPath, fd.cFileName);
+ mir_wstrcpy(szPath, szFilename);
+ mir_wstrcat(szPath, L"\\");
+ mir_wstrcat(szPath, fd.cFileName);
AddToFileList(pppFiles, totalCount, szPath);
} while (FindNextFile(hFind, &fd));
FindClose(hFind);
diff --git a/src/mir_app/src/clcitems.cpp b/src/mir_app/src/clcitems.cpp
index f21811c4f6..c8de95e416 100644
--- a/src/mir_app/src/clcitems.cpp
+++ b/src/mir_app/src/clcitems.cpp
@@ -63,7 +63,7 @@ ClcGroup* fnAddGroup(HWND hwnd, ClcData *dat, const wchar_t *szName, DWORD flags
break;
if (cc->type != CLCIT_GROUP)
continue;
- compareResult = mir_tstrcmp(pThisField, cc->szText);
+ compareResult = mir_wstrcmp(pThisField, cc->szText);
if (compareResult == 0) {
if (pNextField == NULL && flags != (DWORD)-1) {
cc->groupId = (WORD)groupId;
@@ -87,7 +87,7 @@ ClcGroup* fnAddGroup(HWND hwnd, ClcData *dat, const wchar_t *szName, DWORD flags
ClcContact *cc = cli.pfnAddItemToGroup(group, i);
cc->type = CLCIT_GROUP;
- mir_tstrncpy(cc->szText, pThisField, _countof(cc->szText));
+ mir_wstrncpy(cc->szText, pThisField, _countof(cc->szText));
cc->groupId = (WORD)(pNextField ? 0 : groupId);
cc->group = new ClcGroup(10);
cc->group->parent = group;
@@ -107,7 +107,7 @@ ClcGroup* fnAddGroup(HWND hwnd, ClcData *dat, const wchar_t *szName, DWORD flags
DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
ClcCacheEntry *cache = cli.pfnGetCacheEntry(hContact);
- if (!mir_tstrcmp(cache->tszGroup, szName) && (style & CLS_SHOWHIDDEN || !cache->bIsHidden))
+ if (!mir_wstrcmp(cache->tszGroup, szName) && (style & CLS_SHOWHIDDEN || !cache->bIsHidden))
group->totalMembers++;
}
}
@@ -160,7 +160,7 @@ ClcContact* fnAddInfoItemToGroup(ClcGroup *group, int flags, const wchar_t *pszT
cc->type = CLCIT_INFO;
cc->flags = (BYTE)flags;
cc->hContact = (MCONTACT)++iInfoItemUniqueHandle;
- mir_tstrncpy(cc->szText, pszText, _countof(cc->szText));
+ mir_wstrncpy(cc->szText, pszText, _countof(cc->szText));
return cc;
}
@@ -182,7 +182,7 @@ ClcContact* fnAddContactToGroup(ClcData *dat, ClcGroup *group, MCONTACT hContact
char *szProto = GetContactProto(hContact);
ClcCacheEntry *pce = cli.pfnGetCacheEntry(hContact);
- replaceStrT(pce->tszGroup, NULL);
+ replaceStrW(pce->tszGroup, NULL);
ClcContact *cc = cli.pfnAddItemToGroup(group, index + 1);
cc->type = CLCIT_CONTACT;
@@ -204,7 +204,7 @@ ClcContact* fnAddContactToGroup(ClcData *dat, ClcGroup *group, MCONTACT hContact
DWORD idleMode = szProto != NULL ? db_get_dw(hContact, szProto, "IdleTS", 0) : 0;
if (idleMode)
cc->flags |= CONTACTF_IDLE;
- mir_tstrncpy(cc->szText, cli.pfnGetContactDisplayName(hContact, 0), _countof(cc->szText));
+ mir_wstrncpy(cc->szText, cli.pfnGetContactDisplayName(hContact, 0), _countof(cc->szText));
return cc;
}
@@ -224,7 +224,7 @@ void fnAddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTo
int i;
DWORD groupFlags;
ClcGroup *group;
- ptrT tszGroup(db_get_tsa(hContact, "CList", "Group"));
+ ptrW tszGroup(db_get_tsa(hContact, "CList", "Group"));
if (tszGroup == NULL)
group = &dat->list;
else {
@@ -239,7 +239,7 @@ void fnAddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTo
if (szGroupName == NULL)
return;
- if (!mir_tstrcmp(szGroupName, tszGroup))
+ if (!mir_wstrcmp(szGroupName, tszGroup))
break;
}
if (groupFlags & GROUPF_HIDEOFFLINE)
@@ -250,10 +250,10 @@ void fnAddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTo
if (szGroupName == NULL)
return;
- if (!mir_tstrcmp(szGroupName, tszGroup))
+ if (!mir_wstrcmp(szGroupName, tszGroup))
break;
- size_t len = mir_tstrlen(szGroupName);
+ size_t len = mir_wstrlen(szGroupName);
if (!wcsncmp(szGroupName, tszGroup, len) && tszGroup[len] == '\\')
cli.pfnAddGroup(hwnd, dat, szGroupName, groupFlags, i, 1);
}
@@ -322,7 +322,7 @@ void fnDeleteItemFromTree(HWND hwnd, MCONTACT hItem)
ClcContact *cc = group->cl[i];
if (cc->type == CLCIT_GROUP) {
- size_t len = mir_tstrlen(cc->szText);
+ size_t len = mir_wstrlen(cc->szText);
if (!wcsncmp(cc->szText, dbv.ptszVal + nameOffset, len) &&
(dbv.ptszVal[nameOffset + len] == '\\' || dbv.ptszVal[nameOffset + len] == '\0')) {
group->totalMembers--;
@@ -365,7 +365,7 @@ void fnRebuildEntireList(HWND hwnd, ClcData *dat)
ClcCacheEntry *pce = cli.pfnGetCacheEntry(hContact);
ClcGroup *group;
- ptrT tszGroupName(db_get_tsa(hContact, "CList", "Group"));
+ ptrW tszGroupName(db_get_tsa(hContact, "CList", "Group"));
if (tszGroupName == NULL)
group = &dat->list;
else {
@@ -460,7 +460,7 @@ static int __cdecl GroupSortProc(const void* p1, const void* p2)
{
ClcContact **contact1 = (ClcContact**)p1, **contact2 = (ClcContact**)p2;
- return mir_tstrcmpi(contact1[0]->szText, contact2[0]->szText);
+ return mir_wstrcmpi(contact1[0]->szText, contact2[0]->szText);
}
static int __cdecl ContactSortProc(const void* p1, const void* p2)
@@ -540,7 +540,7 @@ static void SortGroup(ClcData *dat, ClcGroup *group, int useInsertionSort)
if (prevContactOnline) {
ClcContact *cc = cli.pfnAddItemToGroup(group, i);
cc->type = CLCIT_DIVIDER;
- mir_tstrcpy(cc->szText, TranslateT("Offline"));
+ mir_wstrcpy(cc->szText, TranslateT("Offline"));
}
break;
}
diff --git a/src/mir_app/src/clcmsgs.cpp b/src/mir_app/src/clcmsgs.cpp
index 8859699db4..2aeecf815d 100644
--- a/src/mir_app/src/clcmsgs.cpp
+++ b/src/mir_app/src/clcmsgs.cpp
@@ -171,14 +171,14 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar
return dat->groupIndent;
case CLM_GETISEARCHSTRING:
- mir_tstrcpy((wchar_t*)lParam, dat->szQuickSearch);
- return mir_tstrlen(dat->szQuickSearch);
+ mir_wstrcpy((wchar_t*)lParam, dat->szQuickSearch);
+ return mir_wstrlen(dat->szQuickSearch);
case CLM_GETITEMTEXT:
if (!cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL))
return 0;
- mir_tstrcpy((wchar_t*)lParam, contact->szText);
- return mir_tstrlen(contact->szText);
+ mir_wstrcpy((wchar_t*)lParam, contact->szText);
+ return mir_wstrlen(contact->szText);
case CLM_GETITEMTYPE:
if (!cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL))
@@ -398,7 +398,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar
case CLM_SETITEMTEXT:
if (!cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL))
break;
- mir_tstrncpy(contact->szText, (wchar_t*)lParam, _countof(contact->szText));
+ mir_wstrncpy(contact->szText, (wchar_t*)lParam, _countof(contact->szText));
cli.pfnSortCLC(hwnd, dat, 1);
cli.pfnInvalidateRect(hwnd, NULL, FALSE);
break;
diff --git a/src/mir_app/src/clcutils.cpp b/src/mir_app/src/clcutils.cpp
index a01f99e3d0..e1814d1f37 100644
--- a/src/mir_app/src/clcutils.cpp
+++ b/src/mir_app/src/clcutils.cpp
@@ -63,7 +63,7 @@ wchar_t* fnGetGroupCountsText(ClcData *dat, ClcContact *contact)
return L"";
static wchar_t szName[32];
- mir_sntprintf(szName, L"(%u/%u)", onlineCount, totalCount);
+ mir_snwprintf(szName, L"(%u/%u)", onlineCount, totalCount);
return szName;
}
@@ -168,7 +168,7 @@ int fnHitTest(HWND hwnd, ClcData *dat, int testx, int testy, ClcContact **contac
HFONT hFont = (HFONT)SelectObject(hdc, dat->fontInfo[hitcontact->type == CLCIT_GROUP ? FONTID_GROUPS : FONTID_CONTACTS].hFont);
SIZE textSize;
- GetTextExtentPoint32(hdc, hitcontact->szText, (int)mir_tstrlen(hitcontact->szText), &textSize);
+ GetTextExtentPoint32(hdc, hitcontact->szText, (int)mir_wstrlen(hitcontact->szText), &textSize);
int width = textSize.cx;
if (hitcontact->type == CLCIT_GROUP) {
wchar_t *szCounts;
@@ -177,7 +177,7 @@ int fnHitTest(HWND hwnd, ClcData *dat, int testx, int testy, ClcContact **contac
GetTextExtentPoint32(hdc, L" ", 1, &textSize);
width += textSize.cx;
SelectObject(hdc, dat->fontInfo[FONTID_GROUPCOUNTS].hFont);
- GetTextExtentPoint32(hdc, szCounts, (int)mir_tstrlen(szCounts), &textSize);
+ GetTextExtentPoint32(hdc, szCounts, (int)mir_wstrlen(szCounts), &textSize);
width += textSize.cx;
}
}
@@ -363,7 +363,7 @@ void fnDoSelectionDefaultAction(HWND hwnd, ClcData *dat)
int fnFindRowByText(HWND hwnd, ClcData *dat, const wchar_t *text, int prefixOk)
{
ClcGroup *group = &dat->list;
- size_t testlen = mir_tstrlen(text);
+ size_t testlen = mir_wstrlen(text);
group->scanIndex = 0;
for (;;) {
@@ -382,7 +382,7 @@ int fnFindRowByText(HWND hwnd, ClcData *dat, const wchar_t *text, int prefixOk)
wchar_t *lowered_text = CharLowerW(NEWWSTR_ALLOCA(text));
show = wcsstr(lowered_szText, lowered_text) != NULL;
}
- else show = ((prefixOk && !wcsnicmp(text, cc->szText, testlen)) || (!prefixOk && !mir_tstrcmpi(text, cc->szText)));
+ else show = ((prefixOk && !wcsnicmp(text, cc->szText, testlen)) || (!prefixOk && !mir_wstrcmpi(text, cc->szText)));
if (show) {
ClcGroup *contactGroup = group;
@@ -417,11 +417,11 @@ void fnEndRename(HWND, ClcData *dat, int save)
ClcContact *contact;
if (cli.pfnGetRowByIndex(dat, dat->selection, &contact, NULL) != -1) {
- if (mir_tstrcmp(contact->szText, text) && !wcsstr(text, L"\\")) {
+ if (mir_wstrcmp(contact->szText, text) && !wcsstr(text, L"\\")) {
if (contact->type == CLCIT_GROUP) {
if (contact->group->parent && contact->group->parent->parent) {
wchar_t szFullName[256];
- mir_sntprintf(szFullName, L"%s\\%s",
+ mir_snwprintf(szFullName, L"%s\\%s",
Clist_GroupGetName(contact->group->parent->groupId, NULL), text);
Clist_GroupRename(contact->groupId, szFullName);
}
@@ -431,7 +431,7 @@ void fnEndRename(HWND, ClcData *dat, int save)
else if (contact->type == CLCIT_CONTACT) {
cli.pfnInvalidateDisplayNameCacheEntry(contact->hContact);
wchar_t* otherName = cli.pfnGetContactDisplayName(contact->hContact, GCDNF_NOMYHANDLE);
- if (!text[0] || !mir_tstrcmp(otherName, text))
+ if (!text[0] || !mir_wstrcmp(otherName, text))
db_unset(contact->hContact, "CList", "MyHandle");
else
db_set_ts(contact->hContact, "CList", "MyHandle", text);
@@ -698,9 +698,9 @@ void fnGetFontSetting(int i, LOGFONT* lf, COLORREF* colour)
char idstr[20];
mir_snprintf(idstr, "Font%dName", i);
- ptrT tszFace(db_get_tsa(NULL, "CLC", idstr));
+ ptrW tszFace(db_get_tsa(NULL, "CLC", idstr));
if (tszFace)
- mir_tstrcpy(lf->lfFaceName, tszFace);
+ mir_wstrcpy(lf->lfFaceName, tszFace);
mir_snprintf(idstr, "Font%dCol", i);
*colour = db_get_dw(NULL, "CLC", idstr, *colour);
@@ -769,7 +769,7 @@ void fnLoadClcOptions(HWND hwnd, ClcData *dat, BOOL bFirst)
dat->hBmpBackground = NULL;
}
if (db_get_b(NULL, "CLC", "UseBitmap", CLCDEFAULT_USEBITMAP)) {
- ptrT tszBitmap(db_get_tsa(NULL, "CLC", "BkBitmap"));
+ ptrW tszBitmap(db_get_tsa(NULL, "CLC", "BkBitmap"));
if (tszBitmap)
dat->hBmpBackground = Bitmap_Load(tszBitmap);
}
diff --git a/src/mir_app/src/clistevents.cpp b/src/mir_app/src/clistevents.cpp
index bf38e584ec..fa69655ebf 100644
--- a/src/mir_app/src/clistevents.cpp
+++ b/src/mir_app/src/clistevents.cpp
@@ -150,7 +150,7 @@ CListEvent* fnAddEvent(CLISTEVENT *cle)
p->flashesDone = 12;
p->pszService = mir_strdup(g_cliEvents[i].pszService);
if (p->flags & CLEF_UNICODE)
- p->ptszTooltip = mir_tstrdup(p->ptszTooltip);
+ p->ptszTooltip = mir_wstrdup(p->ptszTooltip);
else
p->ptszTooltip = mir_a2u(p->pszTooltip); //if no flag defined it handled as unicode
if (g_cliEvents.getCount() == 1) {
diff --git a/src/mir_app/src/clistgroups.cpp b/src/mir_app/src/clistgroups.cpp
index 2a5e5194ca..a9b1e0ab2f 100644
--- a/src/mir_app/src/clistgroups.cpp
+++ b/src/mir_app/src/clistgroups.cpp
@@ -29,7 +29,7 @@ struct CGroupInternal
{
CGroupInternal(int _id, const wchar_t *_name) :
groupId(_id),
- groupName(mir_tstrdup(_name))
+ groupName(mir_wstrdup(_name))
{}
~CGroupInternal()
@@ -50,7 +50,7 @@ struct CGroupInternal
/////////////////////////////////////////////////////////////////////////////////////////
static int CompareGrpByName(const CGroupInternal *p1, const CGroupInternal *p2)
-{ return mir_tstrcmp(p1->groupName+1, p2->groupName+1);
+{ return mir_wstrcmp(p1->groupName+1, p2->groupName+1);
}
static LIST<CGroupInternal> arByName(20, CompareGrpByName);
@@ -111,11 +111,11 @@ static INT_PTR CreateGroupInternal(MGROUP hParent, const wchar_t *ptszName)
if (tmp == NULL)
return NULL;
- mir_sntprintf(newBaseName, L"%s\\%s", tmp->groupName+1, grpName);
+ mir_snwprintf(newBaseName, L"%s\\%s", tmp->groupName+1, grpName);
}
else wcsncpy_s(newBaseName, grpName, _TRUNCATE);
- mir_tstrncpy(newName + 1, newBaseName, _countof(newName) - 1);
+ mir_wstrncpy(newName + 1, newBaseName, _countof(newName) - 1);
if (ptszName) {
int id = GroupNameExists(newBaseName, -1);
if (id)
@@ -123,7 +123,7 @@ static INT_PTR CreateGroupInternal(MGROUP hParent, const wchar_t *ptszName)
}
else {
for (int idCopy = 1; GroupNameExists(newName + 1, -1); idCopy++)
- mir_sntprintf(newName + 1, _countof(newName) - 1, L"%s (%d)", newBaseName, idCopy);
+ mir_snwprintf(newName + 1, _countof(newName) - 1, L"%s (%d)", newBaseName, idCopy);
}
int newId = arByIds.getCount();
@@ -185,7 +185,7 @@ MIR_APP_DLL(int) Clist_GroupDelete(MGROUP hGroup)
if (db_get_b(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT)) {
wchar_t szQuestion[256 + 100];
- mir_sntprintf(szQuestion, TranslateT("Are you sure you want to delete group '%s'? This operation cannot be undone."), pGroup->groupName+1);
+ mir_snwprintf(szQuestion, TranslateT("Are you sure you want to delete group '%s'? This operation cannot be undone."), pGroup->groupName+1);
if (MessageBox(cli.hwndContactList, szQuestion, TranslateT("Delete group"), MB_YESNO | MB_ICONQUESTION) == IDNO)
return 1;
}
@@ -204,8 +204,8 @@ MIR_APP_DLL(int) Clist_GroupDelete(MGROUP hGroup)
}
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- ptrT tszGroupName(db_get_tsa(hContact, "CList", "Group"));
- if (mir_tstrcmp(tszGroupName, pGroup->groupName+1))
+ ptrW tszGroupName(db_get_tsa(hContact, "CList", "Group"));
+ if (mir_wstrcmp(tszGroupName, pGroup->groupName+1))
continue;
CLISTGROUPCHANGE grpChg = { sizeof(grpChg), NULL, NULL };
@@ -238,15 +238,15 @@ MIR_APP_DLL(int) Clist_GroupDelete(MGROUP hGroup)
// rename subgroups
wchar_t szNewName[256];
- size_t len = mir_tstrlen(pGroup->groupName+1);
+ size_t len = mir_wstrlen(pGroup->groupName+1);
for (int i = 0; i < arByIds.getCount(); i++) {
CGroupInternal *p = arByIds[i];
if (!wcsncmp(pGroup->groupName+1, p->groupName+1, len) && p->groupName[len+1] == '\\' && wcschr(p->groupName + len + 2, '\\') == NULL) {
if (szNewParent[0])
- mir_sntprintf(szNewName, L"%s\\%s", szNewParent, p->groupName + len + 2);
+ mir_snwprintf(szNewName, L"%s\\%s", szNewParent, p->groupName + len + 2);
else
- mir_tstrncpy(szNewName, p->groupName + len + 2, _countof(szNewName));
+ mir_wstrncpy(szNewName, p->groupName + len + 2, _countof(szNewName));
Clist_GroupRename(i + 1, szNewName);
}
}
@@ -331,22 +331,22 @@ static int RenameGroupWithMove(int groupId, const wchar_t *szName, int move)
wchar_t str[256];
str[0] = pGroup->groupName[0];
- mir_tstrncpy(str + 1, szName, _countof(str) - 1);
+ mir_wstrncpy(str + 1, szName, _countof(str) - 1);
- pGroup->groupName = mir_tstrdup(str);
+ pGroup->groupName = mir_wstrdup(str);
pGroup->save();
// must rename setting in all child contacts too
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
ClcCacheEntry *cache = cli.pfnGetCacheEntry(hContact);
- if (!mir_tstrcmp(cache->tszGroup, oldName)) {
+ if (!mir_wstrcmp(cache->tszGroup, oldName)) {
db_set_ts(hContact, "CList", "Group", szName);
- replaceStrT(cache->tszGroup, szName);
+ replaceStrW(cache->tszGroup, szName);
}
}
// rename subgroups
- size_t len = mir_tstrlen(oldName);
+ size_t len = mir_wstrlen(oldName);
for (int i = 0; i < arByIds.getCount(); i++) {
if (i == groupId)
continue;
@@ -354,7 +354,7 @@ static int RenameGroupWithMove(int groupId, const wchar_t *szName, int move)
CGroupInternal *p = arByIds[i];
if (!wcsncmp(p->groupName+1, oldName, len) && p->groupName[len+1] == '\\' && wcschr(p->groupName + len + 2, '\\') == NULL) {
wchar_t szNewName[256];
- mir_sntprintf(szNewName, L"%s\\%s", szName, p->groupName + len + 2);
+ mir_snwprintf(szNewName, L"%s\\%s", szName, p->groupName + len + 2);
RenameGroupWithMove(i, szNewName, 0); // luckily, child groups will never need reordering
}
}
@@ -367,7 +367,7 @@ static int RenameGroupWithMove(int groupId, const wchar_t *szName, int move)
*pszLastBackslash = '\0';
for (int i = 0; i < arByIds.getCount(); i++) {
CGroupInternal *p = arByIds[i];
- if (!mir_tstrcmp(p->groupName+1, str)) {
+ if (!mir_wstrcmp(p->groupName+1, str)) {
if (i >= groupId)
Clist_GroupMoveBefore(groupId + 1, i + 2);
break;
@@ -442,11 +442,11 @@ MIR_APP_DLL(HMENU) Clist_GroupBuildMenu()
do {
const wchar_t *pBackslash = wcschr(pNextField, '\\');
if (pBackslash == NULL) {
- mir_tstrncpy(szThisField, pNextField, _countof(szThisField));
+ mir_wstrncpy(szThisField, pNextField, _countof(szThisField));
pNextField = NULL;
}
else {
- mir_tstrncpy(szThisField, pNextField, min(_countof(szThisField), pBackslash - pNextField + 1));
+ mir_wstrncpy(szThisField, pNextField, min(_countof(szThisField), pBackslash - pNextField + 1));
pNextField = pBackslash + 1;
}
int compareResult = 1;
@@ -456,7 +456,7 @@ MIR_APP_DLL(HMENU) Clist_GroupBuildMenu()
mii.cch = _countof(szThisMenuItem);
mii.dwTypeData = szThisMenuItem;
GetMenuItemInfo(hThisMenu, menuId, TRUE, &mii);
- compareResult = mir_tstrcmp(szThisField, szThisMenuItem);
+ compareResult = mir_wstrcmp(szThisField, szThisMenuItem);
if (compareResult == 0) {
if (pNextField == NULL) {
mii.fMask = MIIM_DATA;
@@ -512,7 +512,7 @@ int InitGroupServices(void)
for (int i = 0;; i++) {
char str[32];
_itoa(i, str, 10);
- ptrT tszGroup(db_get_tsa(NULL, "CListGroups", str));
+ ptrW tszGroup(db_get_tsa(NULL, "CListGroups", str));
if (tszGroup == NULL)
break;
diff --git a/src/mir_app/src/clistmod.cpp b/src/mir_app/src/clistmod.cpp
index 894ef43e35..f33faa939a 100644
--- a/src/mir_app/src/clistmod.cpp
+++ b/src/mir_app/src/clistmod.cpp
@@ -101,7 +101,7 @@ wchar_t* fnGetStatusModeDescription(int mode, int flags)
default:
if (IsStatusConnecting(mode)) {
const wchar_t* connFmt = LPGENW("Connecting (attempt %d)");
- mir_sntprintf(szMode, (flags & GSMDF_UNTRANSLATED) ? connFmt : TranslateTS(connFmt), mode - ID_STATUS_CONNECTING + 1);
+ mir_snwprintf(szMode, (flags & GSMDF_UNTRANSLATED) ? connFmt : TranslateTS(connFmt), mode - ID_STATUS_CONNECTING + 1);
return szMode;
}
return NULL;
diff --git a/src/mir_app/src/clistsettings.cpp b/src/mir_app/src/clistsettings.cpp
index 2130672307..b82bc7c746 100644
--- a/src/mir_app/src/clistsettings.cpp
+++ b/src/mir_app/src/clistsettings.cpp
@@ -57,7 +57,7 @@ void fnCheckCacheItem(ClcCacheEntry *p)
if (p->tszGroup == NULL) {
p->tszGroup = db_get_tsa(p->hContact, "CList", "Group");
if (p->tszGroup == NULL)
- p->tszGroup = mir_tstrdup(L"");
+ p->tszGroup = mir_wstrdup(L"");
}
if (p->bIsHidden == -1)
@@ -66,8 +66,8 @@ void fnCheckCacheItem(ClcCacheEntry *p)
void fnFreeCacheItem(ClcCacheEntry *p)
{
- replaceStrT(p->tszName, NULL);
- replaceStrT(p->tszGroup, NULL);
+ replaceStrW(p->tszName, NULL);
+ replaceStrW(p->tszGroup, NULL);
p->bIsHidden = -1;
}
@@ -114,17 +114,17 @@ wchar_t* fnGetContactDisplayName(MCONTACT hContact, int mode)
return cacheEntry->tszName;
}
- ptrT tszDisplayName(Contact_GetInfo((mode == GCDNF_NOMYHANDLE) ? CNF_DISPLAYNC : CNF_DISPLAY, hContact));
+ ptrW tszDisplayName(Contact_GetInfo((mode == GCDNF_NOMYHANDLE) ? CNF_DISPLAYNC : CNF_DISPLAY, hContact));
if (tszDisplayName != NULL) {
if (cacheEntry != NULL)
- replaceStrT(cacheEntry->tszName, tszDisplayName);
+ replaceStrW(cacheEntry->tszName, tszDisplayName);
return tszDisplayName.detach();
}
ProtoChainSend(hContact, PSS_GETINFO, SGIF_MINIMAL, 0);
wchar_t *buffer = TranslateT("(Unknown contact)");
- return (cacheEntry == NULL) ? mir_tstrdup(buffer) : buffer;
+ return (cacheEntry == NULL) ? mir_wstrdup(buffer) : buffer;
}
int ContactAdded(WPARAM hContact, LPARAM)
@@ -157,15 +157,15 @@ static void Dbwcs2tstr(DBCONTACTWRITESETTING *cws, wchar_t* &pStr)
break;
case DBVT_UTF8:
- pStr = mir_utf8decodeT(cws->value.pszVal);
+ pStr = mir_utf8decodeW(cws->value.pszVal);
break;
case DBVT_ASCIIZ:
- pStr = mir_a2t(cws->value.pszVal);
+ pStr = mir_a2u(cws->value.pszVal);
break;
case DBVT_WCHAR:
- pStr = mir_u2t(cws->value.ptszVal);
+ pStr = mir_wstrdup(cws->value.ptszVal);
break;
}
}
@@ -181,7 +181,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam)
if (!mir_strcmp(cws->szModule, szProto)) {
if (!strcmp(cws->szSetting, "UIN") || !strcmp(cws->szSetting, "Nick") || !strcmp(cws->szSetting, "FirstName") || !strcmp(cws->szSetting, "LastName") || !strcmp(cws->szSetting, "e-mail")) {
ClcCacheEntry *pdnce = cli.pfnGetCacheEntry(hContact);
- replaceStrT(pdnce->tszName, NULL);
+ replaceStrW(pdnce->tszName, NULL);
cli.pfnCheckCacheItem(pdnce);
}
else if (!strcmp(cws->szSetting, "Status")) {
@@ -196,7 +196,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam)
}
else if (!strcmp(cws->szSetting, "MyHandle")) {
ClcCacheEntry *pdnce = cli.pfnGetCacheEntry(hContact);
- replaceStrT(pdnce->tszName, NULL);
+ replaceStrW(pdnce->tszName, NULL);
cli.pfnCheckCacheItem(pdnce);
}
else if (!strcmp(cws->szSetting, "Group")) {
diff --git a/src/mir_app/src/clisttray.cpp b/src/mir_app/src/clisttray.cpp
index dd6ea4cc32..aafe45ab1c 100644
--- a/src/mir_app/src/clisttray.cpp
+++ b/src/mir_app/src/clisttray.cpp
@@ -52,7 +52,7 @@ static wchar_t* sttGetXStatus(const char *szProto)
cs.flags = CSSF_MASK_MESSAGE | CSSF_TCHAR;
cs.ptszMessage = tszStatus;
if (CallProtoServiceInt(NULL, szProto, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&cs) == 0)
- return mir_tstrdup(tszStatus);
+ return mir_wstrdup(tszStatus);
}
return NULL;
@@ -109,7 +109,7 @@ wchar_t* fnTrayIconMakeTooltip(const wchar_t *szPrefix, const char *szProto)
if (hasTips()) {
tszTip.AppendFormat(L"<b>%-12.12s</b>\t%s", pa->tszAccountName, szStatus);
- ptrT ProtoXStatus(sttGetXStatus(pa->szModuleName));
+ ptrW ProtoXStatus(sttGetXStatus(pa->szModuleName));
if (ProtoXStatus != NULL) {
if (!tszTip.IsEmpty())
tszTip.AppendChar('\n');
@@ -124,28 +124,28 @@ wchar_t* fnTrayIconMakeTooltip(const wchar_t *szPrefix, const char *szProto)
else {
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
if (pa != NULL) {
- ptrT ProtoXStatus(sttGetXStatus(szProto));
+ ptrW ProtoXStatus(sttGetXStatus(szProto));
wchar_t *szStatus = cli.pfnGetStatusModeDescription(CallProtoServiceInt(NULL, szProto, PS_GETSTATUS, 0, 0), 0);
if (szPrefix && szPrefix[0]) {
if (db_get_b(NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT)) {
if (hasTips()) {
if (ProtoXStatus != NULL)
- mir_sntprintf(cli.szTip, MAX_TIP_SIZE, L"%s%s<b>%-12.12s</b>\t%s%s%-24.24s", szPrefix, szSeparator, pa->tszAccountName, szStatus, szSeparator, ProtoXStatus);
+ mir_snwprintf(cli.szTip, MAX_TIP_SIZE, L"%s%s<b>%-12.12s</b>\t%s%s%-24.24s", szPrefix, szSeparator, pa->tszAccountName, szStatus, szSeparator, ProtoXStatus);
else
- mir_sntprintf(cli.szTip, MAX_TIP_SIZE, L"%s%s<b>%-12.12s</b>\t%s", szPrefix, szSeparator, pa->tszAccountName, szStatus);
+ mir_snwprintf(cli.szTip, MAX_TIP_SIZE, L"%s%s<b>%-12.12s</b>\t%s", szPrefix, szSeparator, pa->tszAccountName, szStatus);
}
- else mir_sntprintf(cli.szTip, MAX_TIP_SIZE, L"%s%s%s %s", szPrefix, szSeparator, pa->tszAccountName, szStatus);
+ else mir_snwprintf(cli.szTip, MAX_TIP_SIZE, L"%s%s%s %s", szPrefix, szSeparator, pa->tszAccountName, szStatus);
}
- else mir_tstrncpy(cli.szTip, szPrefix, MAX_TIP_SIZE);
+ else mir_wstrncpy(cli.szTip, szPrefix, MAX_TIP_SIZE);
}
else {
if (hasTips()) {
if (ProtoXStatus != NULL)
- mir_sntprintf(cli.szTip, MAX_TIP_SIZE, L"<b>%-12.12s</b>\t%s\n%-24.24s", pa->tszAccountName, szStatus, ProtoXStatus);
+ mir_snwprintf(cli.szTip, MAX_TIP_SIZE, L"<b>%-12.12s</b>\t%s\n%-24.24s", pa->tszAccountName, szStatus, ProtoXStatus);
else
- mir_sntprintf(cli.szTip, MAX_TIP_SIZE, L"<b>%-12.12s</b>\t%s", pa->tszAccountName, szStatus);
+ mir_snwprintf(cli.szTip, MAX_TIP_SIZE, L"<b>%-12.12s</b>\t%s", pa->tszAccountName, szStatus);
}
- else mir_sntprintf(cli.szTip, MAX_TIP_SIZE, L"%s %s", pa->tszAccountName, szStatus);
+ else mir_snwprintf(cli.szTip, MAX_TIP_SIZE, L"%s %s", pa->tszAccountName, szStatus);
}
}
}
@@ -180,8 +180,8 @@ int fnTrayIconAdd(HWND hwnd, const char *szProto, const char *szIconProto, int s
cli.pfnTrayIconMakeTooltip(NULL, p.szProto);
if (!hasTips())
- mir_tstrncpy(nid.szTip, cli.szTip, _countof(nid.szTip));
- replaceStrT(p.ptszToolTip, cli.szTip);
+ mir_wstrncpy(nid.szTip, cli.szTip, _countof(nid.szTip));
+ replaceStrW(p.ptszToolTip, cli.szTip);
Shell_NotifyIcon(NIM_ADD, &nid);
p.isBase = 1;
@@ -335,9 +335,9 @@ int fnTrayIconUpdate(HICON hNewIcon, const wchar_t *szNewTip, const char *szPref
nid.uID = cli.trayIcon[i].id;
cli.pfnTrayIconMakeTooltip(szNewTip, cli.trayIcon[i].szProto);
mir_free(cli.trayIcon[i].ptszToolTip);
- cli.trayIcon[i].ptszToolTip = mir_tstrdup(cli.szTip);
+ cli.trayIcon[i].ptszToolTip = mir_wstrdup(cli.szTip);
if (!hasTips())
- mir_tstrncpy(nid.szTip, cli.szTip, _countof(nid.szTip));
+ mir_wstrncpy(nid.szTip, cli.szTip, _countof(nid.szTip));
Shell_NotifyIcon(NIM_MODIFY, &nid);
if (cli.trayIconCount == 1)
@@ -357,9 +357,9 @@ int fnTrayIconUpdate(HICON hNewIcon, const wchar_t *szNewTip, const char *szPref
cli.pfnTrayIconMakeTooltip(szNewTip, cli.trayIcon[i].szProto);
mir_free(cli.trayIcon[i].ptszToolTip);
- cli.trayIcon[i].ptszToolTip = mir_tstrdup(cli.szTip);
+ cli.trayIcon[i].ptszToolTip = mir_wstrdup(cli.szTip);
if (!hasTips())
- mir_tstrncpy(nid.szTip, cli.szTip, _countof(nid.szTip));
+ mir_wstrncpy(nid.szTip, cli.szTip, _countof(nid.szTip));
Shell_NotifyIcon(NIM_MODIFY, &nid);
if (cli.trayIconCount == 1)
diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp
index 717849c38e..37a7fc8739 100644
--- a/src/mir_app/src/clui.cpp
+++ b/src/mir_app/src/clui.cpp
@@ -92,7 +92,7 @@ static int MenuItem_PreBuild(WPARAM, LPARAM)
wchar_t cls[128];
HWND hwndClist = GetFocus();
GetClassName(hwndClist, cls, _countof(cls));
- hwndClist = (!mir_tstrcmp(CLISTCONTROL_CLASSW, cls)) ? hwndClist : cli.hwndContactList;
+ hwndClist = (!mir_wstrcmp(CLISTCONTROL_CLASSW, cls)) ? hwndClist : cli.hwndContactList;
HANDLE hItem = (HANDLE)SendMessage(hwndClist, CLM_GETSELECTION, 0, 0);
Menu_ShowItem(hRenameMenuItem, hItem != 0);
return 0;
@@ -104,7 +104,7 @@ static INT_PTR MenuItem_RenameContact(WPARAM, LPARAM)
HWND hwndClist = GetFocus();
GetClassName(hwndClist, cls, _countof(cls));
// worst case scenario, the rename is sent to the main contact list
- hwndClist = (!mir_tstrcmp(CLISTCONTROL_CLASSW, cls)) ? hwndClist : cli.hwndContactList;
+ hwndClist = (!mir_wstrcmp(CLISTCONTROL_CLASSW, cls)) ? hwndClist : cli.hwndContactList;
HANDLE hItem = (HANDLE)SendMessage(hwndClist, CLM_GETSELECTION, 0, 0);
if (hItem) {
SetFocus(hwndClist);
@@ -127,7 +127,7 @@ static INT_PTR CALLBACK AskForConfirmationDlgProc(HWND hWnd, UINT msg, WPARAM wP
wchar_t szFormat[256], szFinal[256];
GetDlgItemText(hWnd, IDC_TOPLINE, szFormat, _countof(szFormat));
- mir_sntprintf(szFinal, szFormat, cli.pfnGetContactDisplayName(lParam, 0));
+ mir_snwprintf(szFinal, szFormat, cli.pfnGetContactDisplayName(lParam, 0));
SetDlgItemText(hWnd, IDC_TOPLINE, szFinal);
}
SetFocus(GetDlgItem(hWnd, IDNO));
@@ -276,9 +276,9 @@ int LoadCLUIModule(void)
RegisterClassEx(&wndclass);
if (db_get_ts(NULL, "CList", "TitleText", &dbv))
- mir_tstrncpy(titleText, _T(MIRANDANAME), _countof(titleText));
+ mir_wstrncpy(titleText, _T(MIRANDANAME), _countof(titleText));
else {
- mir_tstrncpy(titleText, dbv.ptszVal, _countof(titleText));
+ mir_wstrncpy(titleText, dbv.ptszVal, _countof(titleText));
db_free(&dbv);
}
@@ -412,7 +412,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
if (msg == uMsgProcessProfile) {
wchar_t profile[MAX_PATH];
if (GlobalGetAtomName((ATOM)wParam, profile, _countof(profile))) {
- int rc = mir_tstrcmpi(profile, VARST(L"%miranda_userdata%\\%miranda_profilename%.dat")) == 0;
+ int rc = mir_wstrcmpi(profile, VARST(L"%miranda_userdata%\\%miranda_profilename%.dat")) == 0;
ReplyMessage(rc);
if (rc) {
ShowWindow(hwnd, SW_RESTORE);
@@ -994,20 +994,20 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
PROTOACCOUNT *pa;
wchar_t tszName[64];
if ((pa = Proto_GetAccount(szProto)) != NULL)
- mir_sntprintf(tszName, L"%s ", pa->tszAccountName);
+ mir_snwprintf(tszName, L"%s ", pa->tszAccountName);
else
tszName[0] = 0;
- GetTextExtentPoint32(dis->hDC, tszName, (int)mir_tstrlen(tszName), &textSize);
- TextOut(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, tszName, (int)mir_tstrlen(tszName));
+ GetTextExtentPoint32(dis->hDC, tszName, (int)mir_wstrlen(tszName), &textSize);
+ TextOut(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, tszName, (int)mir_wstrlen(tszName));
x += textSize.cx;
}
if (showOpts & 4) {
wchar_t* szStatus = cli.pfnGetStatusModeDescription(status, 0);
if (!szStatus)
szStatus = L"";
- GetTextExtentPoint32(dis->hDC, szStatus, (int)mir_tstrlen(szStatus), &textSize);
- TextOut(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, szStatus, (int)mir_tstrlen(szStatus));
+ GetTextExtentPoint32(dis->hDC, szStatus, (int)mir_wstrlen(szStatus), &textSize);
+ TextOut(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, szStatus, (int)mir_wstrlen(szStatus));
}
}
else if (dis->CtlType == ODT_MENU) {
diff --git a/src/mir_app/src/cluiservices.cpp b/src/mir_app/src/cluiservices.cpp
index 148a9bd5e7..07b02e9584 100644
--- a/src/mir_app/src/cluiservices.cpp
+++ b/src/mir_app/src/cluiservices.cpp
@@ -32,7 +32,7 @@ EXTERN_C MIR_APP_DLL(void) Clist_GroupAdded(MGROUP hGroup)
wchar_t szFocusClass[64];
GetClassName(hwndFocus, szFocusClass, _countof(szFocusClass));
- if (!mir_tstrcmp(szFocusClass, CLISTCONTROL_CLASSW)) {
+ if (!mir_wstrcmp(szFocusClass, CLISTCONTROL_CLASSW)) {
HANDLE hItem = (HANDLE)SendMessage(hwndFocus, CLM_FINDGROUP, hGroup, 0);
if (hItem)
SendMessage(hwndFocus, CLM_EDITLABEL, (WPARAM)hItem, 0);
@@ -114,19 +114,19 @@ void fnCluiProtocolStatusChanged(int, const char*)
wchar_t tszName[64];
PROTOACCOUNT *pa = Proto_GetAccount(cli.menuProtos[i].szProto);
if (pa)
- mir_sntprintf(tszName, L"%s ", pa->tszAccountName);
+ mir_snwprintf(tszName, L"%s ", pa->tszAccountName);
else
tszName[0] = 0;
- if (showOpts & 4 && mir_tstrlen(tszName) < _countof(tszName) - 1)
- mir_tstrcat(tszName, L" ");
- GetTextExtentPoint32(hdc, tszName, (int)mir_tstrlen(tszName), &textSize);
+ if (showOpts & 4 && mir_wstrlen(tszName) < _countof(tszName) - 1)
+ mir_wstrcat(tszName, L" ");
+ GetTextExtentPoint32(hdc, tszName, (int)mir_wstrlen(tszName), &textSize);
x += textSize.cx;
x += GetSystemMetrics(SM_CXBORDER) * 4; // The SB panel doesnt allocate enough room
}
if (showOpts & 4) {
wchar_t* modeDescr = cli.pfnGetStatusModeDescription(CallProtoServiceInt(NULL, cli.menuProtos[i].szProto, PS_GETSTATUS, 0, 0), 0);
- GetTextExtentPoint32(hdc, modeDescr, (int)mir_tstrlen(modeDescr), &textSize);
+ GetTextExtentPoint32(hdc, modeDescr, (int)mir_wstrlen(modeDescr), &textSize);
x += textSize.cx;
x += GetSystemMetrics(SM_CXBORDER) * 4; // The SB panel doesnt allocate enough room
}
diff --git a/src/mir_app/src/contacts.cpp b/src/mir_app/src/contacts.cpp
index 07d319dd2d..f9e717d541 100644
--- a/src/mir_app/src/contacts.cpp
+++ b/src/mir_app/src/contacts.cpp
@@ -74,11 +74,11 @@ static wchar_t* ProcessDatabaseValueDefault(MCONTACT hContact, const char *szPro
wchar_t buf[40];
switch (dbv.type) {
case DBVT_BYTE:
- return mir_tstrdup(_itow(dbv.bVal, buf, 10));
+ return mir_wstrdup(_itow(dbv.bVal, buf, 10));
case DBVT_WORD:
- return mir_tstrdup(_itow(dbv.wVal, buf, 10));
+ return mir_wstrdup(_itow(dbv.wVal, buf, 10));
case DBVT_DWORD:
- return mir_tstrdup(_itow(dbv.dVal, buf, 10));
+ return mir_wstrdup(_itow(dbv.dVal, buf, 10));
}
db_free(&dbv);
@@ -152,7 +152,7 @@ MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *s
CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&countryCount, (LPARAM)&countries);
for (int i = 0; i < countryCount; i++)
if (countries[i].id == dbv.wVal)
- return mir_a2t(countries[i].szName);
+ return mir_a2u(countries[i].szName);
}
else {
db_free(&dbv);
@@ -181,7 +181,7 @@ MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *s
if (db_mc_isMeta(hContact)) {
wchar_t buf[40];
_itow(hContact, buf, 10);
- return mir_tstrdup(buf);
+ return mir_wstrdup(buf);
}
uid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
@@ -261,7 +261,7 @@ MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *s
break;
case 8:
- return mir_tstrdup(TranslateT("'(Unknown contact)'"));
+ return mir_wstrdup(TranslateT("'(Unknown contact)'"));
}
}
break;
diff --git a/src/mir_app/src/database.cpp b/src/mir_app/src/database.cpp
index a0a9257b87..2331ee3159 100644
--- a/src/mir_app/src/database.cpp
+++ b/src/mir_app/src/database.cpp
@@ -56,7 +56,7 @@ static void fillProfileName(const wchar_t* ptszFileName)
wcsncpy_s(g_shortProfileName, p, _TRUNCATE);
wchar_t *pos = wcsrchr(g_shortProfileName, '.');
- if (mir_tstrcmpi(pos, L".dat") == 0)
+ if (mir_wstrcmpi(pos, L".dat") == 0)
*pos = 0;
}
@@ -64,9 +64,9 @@ bool IsInsideRootDir(wchar_t* profiledir, bool exact)
{
VARST pfd(L"%miranda_path%");
if (exact)
- return mir_tstrcmpi(profiledir, pfd) == 0;
+ return mir_wstrcmpi(profiledir, pfd) == 0;
- return wcsnicmp(profiledir, pfd, mir_tstrlen(pfd)) == 0;
+ return wcsnicmp(profiledir, pfd, mir_wstrlen(pfd)) == 0;
}
// returns 1 if the profile path was returned, without trailing slash
@@ -76,7 +76,7 @@ int getProfilePath(wchar_t *buf, size_t)
GetPrivateProfileString(L"Database", L"ProfileDir", L"", profiledir, _countof(profiledir), mirandabootini);
if (profiledir[0] == 0)
- mir_tstrcpy(profiledir, L"%miranda_path%\\Profiles");
+ mir_wstrcpy(profiledir, L"%miranda_path%\\Profiles");
size_t len = PathToAbsoluteT(VARST(profiledir), buf);
@@ -89,8 +89,8 @@ int getProfilePath(wchar_t *buf, size_t)
// returns 1 if *.dat spec is matched
int isValidProfileName(const wchar_t *name)
{
- size_t len = mir_tstrlen(name) - 4;
- return len > 0 && mir_tstrcmpi(&name[len], L".dat") == 0;
+ size_t len = mir_wstrlen(name) - 4;
+ return len > 0 && mir_wstrcmpi(&name[len], L".dat") == 0;
}
// returns 1 if the profile manager should be shown
@@ -103,7 +103,7 @@ static bool showProfileManager(void)
// wanna show it?
GetPrivateProfileString(L"Database", L"ShowProfileMgr", L"never", Mgr, _countof(Mgr), mirandabootini);
- return (mir_tstrcmpi(Mgr, L"yes") == 0);
+ return (mir_wstrcmpi(Mgr, L"yes") == 0);
}
bool shouldAutoCreate(wchar_t *szProfile)
@@ -113,7 +113,7 @@ bool shouldAutoCreate(wchar_t *szProfile)
wchar_t ac[32];
GetPrivateProfileString(L"Database", L"AutoCreate", L"", ac, _countof(ac), mirandabootini);
- return mir_tstrcmpi(ac, L"yes") == 0;
+ return mir_wstrcmpi(ac, L"yes") == 0;
}
static void getDefaultProfile(wchar_t *szProfile, size_t cch)
@@ -126,7 +126,7 @@ static void getDefaultProfile(wchar_t *szProfile, size_t cch)
VARST res(defaultProfile);
if (res)
- mir_sntprintf(szProfile, cch, L"%s\\%s\\%s%s", g_profileDir, (wchar_t*)res, (wchar_t*)res, isValidProfileName(res) ? L"" : L".dat");
+ mir_snwprintf(szProfile, cch, L"%s\\%s\\%s%s", g_profileDir, (wchar_t*)res, (wchar_t*)res, isValidProfileName(res) ? L"" : L".dat");
else
szProfile[0] = 0;
}
@@ -139,17 +139,17 @@ static void loadProfileByShortName(const wchar_t* src, wchar_t *szProfile, size_
wchar_t *p = wcsrchr(buf, '\\'); if (p) ++p; else p = buf;
if (!isValidProfileName(buf) && *p)
- mir_tstrcat(buf, L".dat");
+ mir_wstrcat(buf, L".dat");
wchar_t profileName[MAX_PATH], newProfileDir[MAX_PATH];
wcsncpy_s(profileName, p, _TRUNCATE);
if (!isValidProfileName(profileName) && *p)
- mir_tstrcat(profileName, L".dat");
+ mir_wstrcat(profileName, L".dat");
wcsncpy_s(profileName, p, _TRUNCATE);
p = wcsrchr(profileName, '.'); if (p) *p = 0;
- mir_sntprintf(newProfileDir, cch, L"%s\\%s\\", g_profileDir, profileName);
+ mir_snwprintf(newProfileDir, cch, L"%s\\%s\\", g_profileDir, profileName);
PathToAbsoluteT(buf, szProfile, newProfileDir);
if (wcschr(buf, '\\')) {
@@ -157,7 +157,7 @@ static void loadProfileByShortName(const wchar_t* src, wchar_t *szProfile, size_
if (profileName[0]) {
p = wcsrchr(g_profileDir, '\\'); *p = 0;
p = wcsrchr(g_profileDir, '\\');
- if (p && mir_tstrcmpi(p + 1, profileName) == 0)
+ if (p && mir_wstrcmpi(p + 1, profileName) == 0)
*p = 0;
}
else szProfile[0] = 0;
@@ -186,7 +186,7 @@ static void moveProfileDirProfiles(wchar_t *profiledir, BOOL isRootDir = TRUE)
if (isRootDir)
wcsncpy_s(pfd, VARST(L"%miranda_path%\\*.dat"), _TRUNCATE);
else
- mir_sntprintf(pfd, L"%s\\*.dat", profiledir);
+ mir_snwprintf(pfd, L"%s\\*.dat", profiledir);
WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile(pfd, &ffd);
@@ -194,22 +194,22 @@ static void moveProfileDirProfiles(wchar_t *profiledir, BOOL isRootDir = TRUE)
wchar_t *c = wcsrchr(pfd, '\\'); if (c) *c = 0;
do {
wchar_t path[MAX_PATH], path2[MAX_PATH];
- wchar_t* profile = mir_tstrdup(ffd.cFileName);
+ wchar_t* profile = mir_wstrdup(ffd.cFileName);
c = wcsrchr(profile, '.'); if (c) *c = 0;
- mir_sntprintf(path, L"%s\\%s", pfd, ffd.cFileName);
- mir_sntprintf(path2, L"%s\\%s", profiledir, profile);
+ mir_snwprintf(path, L"%s\\%s", pfd, ffd.cFileName);
+ mir_snwprintf(path2, L"%s\\%s", profiledir, profile);
CreateDirectoryTreeT(path2);
- mir_sntprintf(path2, L"%s\\%s\\%s", profiledir, profile, ffd.cFileName);
+ mir_snwprintf(path2, L"%s\\%s\\%s", profiledir, profile, ffd.cFileName);
if (_waccess(path2, 0) == 0) {
wchar_t buf[512];
- mir_sntprintf(buf,
+ mir_snwprintf(buf,
TranslateT("Miranda is trying to upgrade your profile structure.\nIt cannot move profile %s to the new location %s\nBecause profile with this name already exists. Please resolve the issue manually."),
path, path2);
MessageBox(NULL, buf, L"Miranda NG", MB_ICONERROR | MB_OK);
}
else if (MoveFile(path, path2) == 0) {
wchar_t buf[512];
- mir_sntprintf(buf,
+ mir_snwprintf(buf,
TranslateT("Miranda is trying to upgrade your profile structure.\nIt cannot move profile %s to the new location %s automatically\nMost likely this is due to insufficient privileges. Please move profile manually."),
path, path2);
MessageBox(NULL, buf, L"Miranda NG", MB_ICONERROR | MB_OK);
@@ -240,18 +240,18 @@ static int getProfile1(wchar_t *szProfile, size_t cch, wchar_t *profiledir, BOOL
if (bShowProfileManager || !reqfd) {
wchar_t searchspec[MAX_PATH];
- mir_sntprintf(searchspec, L"%s\\*.*", profiledir);
+ mir_snwprintf(searchspec, L"%s\\*.*", profiledir);
WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile(searchspec, &ffd);
if (hFind != INVALID_HANDLE_VALUE) {
do {
// make sure the first hit is actually a *.dat file
- if (!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || !mir_tstrcmp(ffd.cFileName, L".") || !mir_tstrcmp(ffd.cFileName, L".."))
+ if (!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || !mir_wstrcmp(ffd.cFileName, L".") || !mir_wstrcmp(ffd.cFileName, L".."))
continue;
wchar_t newProfile[MAX_PATH];
- mir_sntprintf(newProfile, L"%s\\%s\\%s.dat", profiledir, ffd.cFileName, ffd.cFileName);
+ mir_snwprintf(newProfile, L"%s\\%s\\%s.dat", profiledir, ffd.cFileName, ffd.cFileName);
if (_waccess(newProfile, 0) != 0)
continue;
@@ -286,7 +286,7 @@ static int getProfileAutoRun(wchar_t *szProfile)
wchar_t Mgr[32];
GetPrivateProfileString(L"Database", L"ShowProfileMgr", L"", Mgr, _countof(Mgr), mirandabootini);
- if (mir_tstrcmpi(Mgr, L"never"))
+ if (mir_wstrcmpi(Mgr, L"never"))
return 0;
return fileExist(szProfile) || shouldAutoCreate(szProfile);
@@ -338,12 +338,12 @@ LBL_Show:
char* makeFileName(const wchar_t* tszOriginalName)
{
char *szResult = NULL;
- char *szFileName = mir_t2a(tszOriginalName);
- wchar_t *tszFileName = mir_a2t(szFileName);
- if (mir_tstrcmp(tszOriginalName, tszFileName)) {
+ char *szFileName = mir_u2a(tszOriginalName);
+ wchar_t *tszFileName = mir_a2u(szFileName);
+ if (mir_wstrcmp(tszOriginalName, tszFileName)) {
wchar_t tszProfile[MAX_PATH];
if (GetShortPathName(tszOriginalName, tszProfile, MAX_PATH) != 0)
- szResult = mir_t2a(tszProfile);
+ szResult = mir_u2a(tszProfile);
}
if (!szResult)
@@ -454,7 +454,7 @@ static BOOL CALLBACK EnumMirandaWindows(HWND hwnd, LPARAM lParam)
wchar_t classname[256];
ENUMMIRANDAWINDOW *x = (ENUMMIRANDAWINDOW *)lParam;
DWORD_PTR res = 0;
- if (GetClassName(hwnd, classname, _countof(classname)) && mir_tstrcmp(L"Miranda", classname) == 0) {
+ if (GetClassName(hwnd, classname, _countof(classname)) && mir_wstrcmp(L"Miranda", classname) == 0) {
if (SendMessageTimeout(hwnd, x->msg, (WPARAM)x->aPath, 0, SMTO_ABORTIFHUNG, 100, &res) && res) {
x->found++;
return FALSE;
diff --git a/src/mir_app/src/dbini.cpp b/src/mir_app/src/dbini.cpp
index 77a42d8db6..b545aae71c 100644
--- a/src/mir_app/src/dbini.cpp
+++ b/src/mir_app/src/dbini.cpp
@@ -39,11 +39,11 @@ static INT_PTR CALLBACK InstallIniDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
const wchar_t *pszSecurityInfo;
GetPrivateProfileString(L"AutoExec", L"Warn", L"notsafe", szSecurity, _countof(szSecurity), mirandabootini);
- if (!mir_tstrcmpi(szSecurity, L"all"))
+ if (!mir_wstrcmpi(szSecurity, L"all"))
pszSecurityInfo = LPGENW("Security systems to prevent malicious changes are in place and you will be warned before every change that is made.");
- else if (!mir_tstrcmpi(szSecurity, L"onlyunsafe"))
+ else if (!mir_wstrcmpi(szSecurity, L"onlyunsafe"))
pszSecurityInfo = LPGENW("Security systems to prevent malicious changes are in place and you will be warned before changes that are known to be unsafe.");
- else if (!mir_tstrcmpi(szSecurity, L"none"))
+ else if (!mir_wstrcmpi(szSecurity, L"none"))
pszSecurityInfo = LPGENW("Security systems to prevent malicious changes have been disabled. You will receive no further warnings.");
else pszSecurityInfo = NULL;
if (pszSecurityInfo) SetDlgItemText(hwndDlg, IDC_SECURITYINFO, TranslateTS(pszSecurityInfo));
@@ -166,7 +166,7 @@ static INT_PTR CALLBACK IniImportDoneDlgProc(HWND hwndDlg, UINT message, WPARAM
SHFILEOPSTRUCT shfo = { 0 };
shfo.wFunc = FO_DELETE;
shfo.pFrom = szIniPath;
- szIniPath[mir_tstrlen(szIniPath) + 1] = '\0';
+ szIniPath[mir_wstrlen(szIniPath) + 1] = '\0';
shfo.fFlags = FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT | FOF_ALLOWUNDO;
SHFileOperation(&shfo);
}
@@ -424,7 +424,7 @@ LBL_NewLine:
break;
default:
wchar_t buf[250];
- mir_sntprintf(buf, TranslateT("Invalid setting type for '%s'. The first character of every value must be b, w, d, l, s, e, u, g, h or n."), _A2T(szName));
+ mir_snwprintf(buf, TranslateT("Invalid setting type for '%s'. The first character of every value must be b, w, d, l, s, e, u, g, h or n."), _A2T(szName));
MessageBox(NULL, buf, TranslateT("Install database settings"), MB_ICONWARNING | MB_OK);
break;
}
@@ -438,17 +438,17 @@ static void DoAutoExec(void)
wchar_t buf[2048], szSecurity[11], szOverrideSecurityFilename[MAX_PATH], szOnCreateFilename[MAX_PATH];
GetPrivateProfileString(L"AutoExec", L"Use", L"prompt", szUse, _countof(szUse), mirandabootini);
- if (!mir_tstrcmpi(szUse, L"no")) return;
+ if (!mir_wstrcmpi(szUse, L"no")) return;
GetPrivateProfileString(L"AutoExec", L"Safe", L"CLC Icons CLUI CList SkinSounds", buf, _countof(buf), mirandabootini);
- ptrA szSafeSections(mir_t2a(buf));
+ ptrA szSafeSections(mir_u2a(buf));
GetPrivateProfileString(L"AutoExec", L"Unsafe", L"AIM Facebook GG ICQ IRC JABBER MRA MSN SKYPE Tlen TWITTER VKontakte XFire", buf, _countof(buf), mirandabootini);
- ptrA szUnsafeSections(mir_t2a(buf));
+ ptrA szUnsafeSections(mir_u2a(buf));
GetPrivateProfileString(L"AutoExec", L"Warn", L"notsafe", szSecurity, _countof(szSecurity), mirandabootini);
int secur = 0;
- if (!mir_tstrcmpi(szSecurity, L"none")) secur = 0;
- else if (!mir_tstrcmpi(szSecurity, L"notsafe")) secur = 1;
- else if (!mir_tstrcmpi(szSecurity, L"onlyunsafe")) secur = 2;
+ if (!mir_wstrcmpi(szSecurity, L"none")) secur = 0;
+ else if (!mir_wstrcmpi(szSecurity, L"notsafe")) secur = 1;
+ else if (!mir_wstrcmpi(szSecurity, L"onlyunsafe")) secur = 2;
GetPrivateProfileString(L"AutoExec", L"OverrideSecurityFilename", L"", szOverrideSecurityFilename, _countof(szOverrideSecurityFilename), mirandabootini);
GetPrivateProfileString(L"AutoExec", L"OnCreateFilename", L"", szOnCreateFilename, _countof(szOnCreateFilename), mirandabootini);
@@ -473,10 +473,10 @@ static void DoAutoExec(void)
str2[1] = 0;
do {
- bool secFN = mir_tstrcmpi(fd.cFileName, szOverrideSecurityFilename) == 0;
+ bool secFN = mir_wstrcmpi(fd.cFileName, szOverrideSecurityFilename) == 0;
- mir_sntprintf(szIniPath, L"%s%s", szFindPath, fd.cFileName);
- if (!mir_tstrcmpi(szUse, L"prompt") && !secFN) {
+ mir_snwprintf(szIniPath, L"%s%s", szFindPath, fd.cFileName);
+ if (!mir_wstrcmpi(szUse, L"prompt") && !secFN) {
int result = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_INSTALLINI), NULL, InstallIniDlgProc, (LPARAM)szIniPath);
if (result == IDC_NOTOALL) break;
if (result == IDCANCEL) continue;
@@ -489,25 +489,25 @@ static void DoAutoExec(void)
else {
wchar_t szOnCompletion[8];
GetPrivateProfileString(L"AutoExec", L"OnCompletion", L"recycle", szOnCompletion, _countof(szOnCompletion), mirandabootini);
- if (!mir_tstrcmpi(szOnCompletion, L"delete"))
+ if (!mir_wstrcmpi(szOnCompletion, L"delete"))
DeleteFile(szIniPath);
- else if (!mir_tstrcmpi(szOnCompletion, L"recycle")) {
+ else if (!mir_wstrcmpi(szOnCompletion, L"recycle")) {
SHFILEOPSTRUCT shfo = { 0 };
shfo.wFunc = FO_DELETE;
shfo.pFrom = szIniPath;
- szIniPath[mir_tstrlen(szIniPath) + 1] = 0;
+ szIniPath[mir_wstrlen(szIniPath) + 1] = 0;
shfo.fFlags = FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT | FOF_ALLOWUNDO;
SHFileOperation(&shfo);
}
- else if (!mir_tstrcmpi(szOnCompletion, L"rename")) {
+ else if (!mir_wstrcmpi(szOnCompletion, L"rename")) {
wchar_t szRenamePrefix[MAX_PATH], szNewPath[MAX_PATH];
GetPrivateProfileString(L"AutoExec", L"RenamePrefix", L"done_", szRenamePrefix, _countof(szRenamePrefix), mirandabootini);
- mir_tstrcpy(szNewPath, szFindPath);
- mir_tstrcat(szNewPath, szRenamePrefix);
- mir_tstrcat(szNewPath, fd.cFileName);
+ mir_wstrcpy(szNewPath, szFindPath);
+ mir_wstrcat(szNewPath, szRenamePrefix);
+ mir_wstrcat(szNewPath, fd.cFileName);
MoveFile(szIniPath, szNewPath);
}
- else if (!mir_tstrcmpi(szOnCompletion, L"ask"))
+ else if (!mir_wstrcmpi(szOnCompletion, L"ask"))
DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_INIIMPORTDONE), NULL, IniImportDoneDlgProc, (LPARAM)szIniPath);
}
}
@@ -525,7 +525,7 @@ static INT_PTR CheckIniImportNow(WPARAM, LPARAM)
static INT_PTR ImportINI(WPARAM wParam, LPARAM)
{
- ptrT tszIniPath(mir_utf8decodeT((char*)wParam));
+ ptrW tszIniPath(mir_utf8decodeW((char*)wParam));
ProcessIniFile(tszIniPath, "", "", 0, 0);
return 0;
}
diff --git a/src/mir_app/src/dbutils.cpp b/src/mir_app/src/dbutils.cpp
index 8408eaf2b8..8f63f74dbf 100644
--- a/src/mir_app/src/dbutils.cpp
+++ b/src/mir_app/src/dbutils.cpp
@@ -87,7 +87,7 @@ static wchar_t* getEventString(DBEVENTINFO *dbei, LPSTR &buf)
{
LPSTR in = buf;
buf += mir_strlen(buf) + 1;
- return (dbei->flags & DBEF_UTF) ? Utf8DecodeT(in) : mir_a2t(in);
+ return (dbei->flags & DBEF_UTF) ? Utf8DecodeT(in) : mir_a2u(in);
}
static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam)
@@ -113,10 +113,10 @@ static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam)
DWORD uin = *(DWORD*)dbei->pBlob;
MCONTACT hContact = (MCONTACT)*(DWORD*)(dbei->pBlob + sizeof(DWORD));
char *buf = LPSTR(dbei->pBlob) + sizeof(DWORD)*2;
- ptrT tszNick(getEventString(dbei, buf));
- ptrT tszFirst(getEventString(dbei, buf));
- ptrT tszLast(getEventString(dbei, buf));
- ptrT tszEmail(getEventString(dbei, buf));
+ ptrW tszNick(getEventString(dbei, buf));
+ ptrW tszFirst(getEventString(dbei, buf));
+ ptrW tszLast(getEventString(dbei, buf));
+ ptrW tszEmail(getEventString(dbei, buf));
CMString nick, text;
if (tszFirst || tszLast) {
@@ -137,13 +137,13 @@ static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam)
nick = L"(" + nick + L")";
if (dbei->eventType == EVENTTYPE_AUTHREQUEST) {
- ptrT tszReason(getEventString(dbei, buf));
+ ptrW tszReason(getEventString(dbei, buf));
text.Format(TranslateT("Authorization request from %s%s: %s"),
(tszNick == NULL) ? cli.pfnGetContactDisplayName(hContact, 0) : tszNick, nick, tszReason);
}
else text.Format(TranslateT("You were added by %s%s"),
(tszNick == NULL) ? cli.pfnGetContactDisplayName(hContact, 0) : tszNick, nick);
- return (egt->datatype == DBVT_WCHAR) ? (INT_PTR)mir_tstrdup(text) : (INT_PTR)mir_t2a(text);
+ return (egt->datatype == DBVT_WCHAR) ? (INT_PTR)mir_wstrdup(text) : (INT_PTR)mir_u2a(text);
}
if (dbei->eventType == EVENTTYPE_CONTACTS) {
@@ -151,26 +151,26 @@ static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam)
// blob is: [uin(ASCIIZ), nick(ASCIIZ)]*
char *buf = LPSTR(dbei->pBlob), *limit = LPSTR(dbei->pBlob) + dbei->cbBlob;
while (buf < limit) {
- ptrT tszUin(getEventString(dbei, buf));
- ptrT tszNick(getEventString(dbei, buf));
+ ptrW tszUin(getEventString(dbei, buf));
+ ptrW tszNick(getEventString(dbei, buf));
if (tszNick && *tszNick)
text.AppendFormat(L"\"%s\" ", tszNick);
if (tszUin && *tszUin)
text.AppendFormat(L"<%s>; ", tszUin);
}
- return (egt->datatype == DBVT_WCHAR) ? (INT_PTR)mir_tstrdup(text) : (INT_PTR)mir_t2a(text);
+ return (egt->datatype == DBVT_WCHAR) ? (INT_PTR)mir_wstrdup(text) : (INT_PTR)mir_u2a(text);
}
if (dbei->eventType == EVENTTYPE_FILE) {
char *buf = LPSTR(dbei->pBlob) + sizeof(DWORD);
- ptrT tszFileName(getEventString(dbei, buf));
- ptrT tszDescription(getEventString(dbei, buf));
- ptrT &ptszText = (mir_tstrlen(tszDescription) == 0) ? tszFileName : tszDescription;
+ ptrW tszFileName(getEventString(dbei, buf));
+ ptrW tszDescription(getEventString(dbei, buf));
+ ptrW &ptszText = (mir_wstrlen(tszDescription) == 0) ? tszFileName : tszDescription;
switch (egt->datatype) {
case DBVT_WCHAR:
return (INT_PTR)ptszText.detach();
case DBVT_ASCIIZ:
- return (INT_PTR)mir_t2a(ptszText);
+ return (INT_PTR)mir_u2a(ptszText);
}
return 0;
}
@@ -188,7 +188,7 @@ static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam)
return (INT_PTR)msg;
}
- return (INT_PTR)mir_a2t_cp(str, egt->codepage);
+ return (INT_PTR)mir_a2u_cp(str, egt->codepage);
}
if (egt->datatype == DBVT_ASCIIZ) {
@@ -247,7 +247,7 @@ static INT_PTR DbEventGetStringT(WPARAM wParam, LPARAM lParam)
if (dbei->flags & DBEF_UTF)
return (INT_PTR)Utf8DecodeW(string);
- return (INT_PTR)mir_a2t(string);
+ return (INT_PTR)mir_a2u(string);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -324,7 +324,7 @@ static INT_PTR GetProfileNameW(WPARAM wParam, LPARAM lParam)
static INT_PTR SetDefaultProfile(WPARAM wParam, LPARAM)
{
extern wchar_t* g_defaultProfile;
- replaceStrT(g_defaultProfile, (wchar_t*)wParam);
+ replaceStrW(g_defaultProfile, (wchar_t*)wParam);
return 0;
}
diff --git a/src/mir_app/src/descbutton.cpp b/src/mir_app/src/descbutton.cpp
index c45e5fc226..a8aefdae68 100644
--- a/src/mir_app/src/descbutton.cpp
+++ b/src/mir_app/src/descbutton.cpp
@@ -188,7 +188,7 @@ static LRESULT MDescButton_OnPaint(HWND hwndDlg, MDescButtonCtrl *dat)
textRect.top = DBC_BORDER_SIZE;
textRect.bottom = dat->height - DBC_BORDER_SIZE;
DrawText(tempDC, dat->lpzTitle, -1, &textRect, DT_TOP | DT_LEFT | DT_END_ELLIPSIS);
- GetTextExtentPoint32(tempDC, dat->lpzTitle, (int)mir_tstrlen(dat->lpzTitle), &titleSize);
+ GetTextExtentPoint32(tempDC, dat->lpzTitle, (int)mir_wstrlen(dat->lpzTitle), &titleSize);
DeleteObject(SelectObject(tempDC, hOldFont));
}
@@ -200,7 +200,7 @@ static LRESULT MDescButton_OnPaint(HWND hwndDlg, MDescButtonCtrl *dat)
textRect.top = DBC_BORDER_SIZE + titleSize.cy ? titleSize.cy + DBC_HSPACING : 0;
textRect.bottom = dat->height - DBC_BORDER_SIZE;
DrawText(tempDC, dat->lpzDescription, -1, &textRect, DT_TOP | DT_LEFT | DT_WORDBREAK | DT_END_ELLIPSIS);
- GetTextExtentPoint32(tempDC, dat->lpzTitle, (int)mir_tstrlen(dat->lpzTitle), &titleSize);
+ GetTextExtentPoint32(tempDC, dat->lpzTitle, (int)mir_wstrlen(dat->lpzTitle), &titleSize);
}
SelectObject(tempDC, hfntSave);
@@ -280,9 +280,9 @@ static LRESULT CALLBACK MDescButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wPara
if (dat->lpzTitle)
mir_free(dat->lpzTitle);
if (wParam & MDBCF_UNICODE)
- dat->lpzTitle = mir_u2t((WCHAR *)lParam);
+ dat->lpzTitle = mir_wstrdup((WCHAR *)lParam);
else
- dat->lpzTitle = mir_a2t((char *)lParam);
+ dat->lpzTitle = mir_a2u((char *)lParam);
RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
return TRUE;
@@ -290,9 +290,9 @@ static LRESULT CALLBACK MDescButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wPara
if (dat->lpzDescription)
mir_free(dat->lpzDescription);
if (wParam & MDBCF_UNICODE)
- dat->lpzDescription = mir_u2t((WCHAR *)lParam);
+ dat->lpzDescription = mir_wstrdup((WCHAR *)lParam);
else
- dat->lpzDescription = mir_a2t((char *)lParam);
+ dat->lpzDescription = mir_a2u((char *)lParam);
RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
return TRUE;
diff --git a/src/mir_app/src/encrypt.cpp b/src/mir_app/src/encrypt.cpp
index 85a14a8259..2bdf9f0239 100644
--- a/src/mir_app/src/encrypt.cpp
+++ b/src/mir_app/src/encrypt.cpp
@@ -41,9 +41,9 @@ static INT_PTR srvRegister(WPARAM wParam, LPARAM lParam)
CRYPTO_PROVIDER *pNew = new CRYPTO_PROVIDER(*p);
pNew->pszName = mir_strdup(p->pszName);
if (pNew->dwFlags & CPF_UNICODE)
- pNew->ptszDescr = mir_u2t(TranslateW_LP(p->pwszDescr, wParam));
+ pNew->ptszDescr = mir_wstrdup(TranslateW_LP(p->pwszDescr, wParam));
else
- pNew->ptszDescr = mir_a2t(TranslateA_LP(p->pszDescr, wParam));
+ pNew->ptszDescr = mir_a2u(TranslateA_LP(p->pszDescr, wParam));
arProviders.insert(pNew);
return 0;
}
diff --git a/src/mir_app/src/enterstring.cpp b/src/mir_app/src/enterstring.cpp
index 884166c7a9..b68b24b661 100644
--- a/src/mir_app/src/enterstring.cpp
+++ b/src/mir_app/src/enterstring.cpp
@@ -57,7 +57,7 @@ static void ComboLoadRecentStrings(HWND hwndDlg, EnterStringFormParam *pForm)
for (int i = 0; i < pForm->recentCount; i++) {
char setting[MAXMODULELABELLENGTH];
mir_snprintf(setting, "%s%d", pForm->szDataPrefix, i);
- ptrT tszRecent(db_get_tsa(NULL, pForm->szModuleName, setting));
+ ptrW tszRecent(db_get_tsa(NULL, pForm->szModuleName, setting));
if (tszRecent != NULL)
SendDlgItemMessage(hwndDlg, pForm->idcControl, CB_ADDSTRING, 0, tszRecent);
}
@@ -142,7 +142,7 @@ static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
if (params->timeout > 0) {
SetTimer(hwndDlg, 1001, 1000, NULL);
wchar_t buf[128];
- mir_sntprintf(buf, TranslateT("OK (%d)"), params->timeout);
+ mir_snwprintf(buf, TranslateT("OK (%d)"), params->timeout);
SetDlgItemText(hwndDlg, IDOK, buf);
}
@@ -161,7 +161,7 @@ static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
case 1001:
wchar_t buf[128];
- mir_sntprintf(buf, TranslateT("OK (%d)"), --params->timeout);
+ mir_snwprintf(buf, TranslateT("OK (%d)"), --params->timeout);
SetDlgItemText(hwndDlg, IDOK, buf);
if (params->timeout < 0) {
diff --git a/src/mir_app/src/extraicons.cpp b/src/mir_app/src/extraicons.cpp
index 6acbca19fc..bcdeea5161 100644
--- a/src/mir_app/src/extraicons.cpp
+++ b/src/mir_app/src/extraicons.cpp
@@ -394,7 +394,7 @@ EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterCallback(const char *name, const
if (GetExtraIconByName(name) != NULL)
return 0;
- ptrT tszDesc(mir_a2t(description));
+ ptrW tszDesc(mir_a2u(description));
wchar_t *desc = TranslateTH(_hLang, tszDesc);
int id = registeredExtraIcons.getCount() + 1;
@@ -409,7 +409,7 @@ EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterIcolib(const char *name, const ch
if (IsEmpty(name) || IsEmpty(description))
return 0;
- ptrT tszDesc(mir_a2t(description));
+ ptrW tszDesc(mir_a2u(description));
wchar_t *desc = TranslateTH(_hLang, tszDesc);
BaseExtraIcon *extra = GetExtraIconByName(name);
@@ -418,7 +418,7 @@ EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterIcolib(const char *name, const ch
return 0;
// Found one, now merge it
- if (mir_tstrcmpi(extra->getDescription(), desc)) {
+ if (mir_wstrcmpi(extra->getDescription(), desc)) {
CMString newDesc = extra->getDescription();
newDesc += L" / ";
newDesc += desc;
diff --git a/src/mir_app/src/filter.cpp b/src/mir_app/src/filter.cpp
index f6d685fca3..0a41dd552f 100644
--- a/src/mir_app/src/filter.cpp
+++ b/src/mir_app/src/filter.cpp
@@ -62,7 +62,7 @@ void AddTreeViewNodes(HWND hWndDlg, PageHash key, HTREEITEM root)
item.cchTextMax = _countof(title);
if (TreeView_GetItem(hWndDlg, &item))
- if (mir_tstrlen(title) > 0)
+ if (mir_wstrlen(title) > 0)
AddFilterString(key, title);
HTREEITEM child = root;
@@ -79,19 +79,19 @@ void AddDialogString(HWND hWndDlg, const PageHash key)
{
wchar_t title[2048];
GetWindowText(hWndDlg, title, _countof(title));
- if (mir_tstrlen(title) > 0)
+ if (mir_wstrlen(title) > 0)
AddFilterString(key, title);
wchar_t szClass[64];
GetClassName(hWndDlg, szClass, _countof(szClass));
- if (mir_tstrcmpi(szClass, L"SysTreeView32") == 0) {
+ if (mir_wstrcmpi(szClass, L"SysTreeView32") == 0) {
HTREEITEM hItem = TreeView_GetRoot(hWndDlg);
AddTreeViewNodes(hWndDlg, key, hItem);
return;
}
- if (mir_tstrcmpi(szClass, L"listbox") == 0) {
+ if (mir_wstrcmpi(szClass, L"listbox") == 0) {
if (GetWindowStyle(hWndDlg) & LBS_HASSTRINGS) {
int count = ListBox_GetCount(hWndDlg);
for (int i=0; i < count; i++) {
@@ -99,7 +99,7 @@ void AddDialogString(HWND hWndDlg, const PageHash key)
int res = ListBox_GetText(hWndDlg, i, title);
if (res != LB_ERR) {
title[_countof(title) - 1] = 0;
- if (mir_tstrlen(title) > 0)
+ if (mir_wstrlen(title) > 0)
AddFilterString(key, title);
}
}
@@ -107,19 +107,19 @@ void AddDialogString(HWND hWndDlg, const PageHash key)
return;
}
- if (mir_tstrcmpi(szClass, L"SysListView32") == 0) {
+ if (mir_wstrcmpi(szClass, L"SysListView32") == 0) {
int count = ListView_GetItemCount(hWndDlg);
for (int i=0; i < count; i++) {
title[0] = 0; //safety
ListView_GetItemText(hWndDlg, i, 0, title, _countof(title));
- if (mir_tstrlen(title) > 0)
+ if (mir_wstrlen(title) > 0)
AddFilterString(key, title);
}
return;
}
- if (mir_tstrcmpi(szClass, L"combobox") == 0) {
+ if (mir_wstrcmpi(szClass, L"combobox") == 0) {
if (GetWindowStyle(hWndDlg) & CBS_HASSTRINGS) {
int count = ComboBox_GetCount(hWndDlg);
for (int i=0; i < count; i++) {
@@ -128,7 +128,7 @@ void AddDialogString(HWND hWndDlg, const PageHash key)
if (res != CB_ERR) {
title[_countof(title) - 1] = 0;
- if (mir_tstrlen(title) > 0)
+ if (mir_wstrlen(title) > 0)
AddFilterString(key, title);
}
}
diff --git a/src/mir_app/src/filter.h b/src/mir_app/src/filter.h
index 3c20fcfc69..559ccdb310 100644
--- a/src/mir_app/src/filter.h
+++ b/src/mir_app/src/filter.h
@@ -36,7 +36,7 @@ void GetDialogStrings(int enableKeywordFiltering, const PageHash key, wchar_t *p
_inline wchar_t *_tcslwr_locale(wchar_t *buf)
{
- LCMapString(Langpack_GetDefaultLocale() , LCMAP_LOWERCASE, buf, (int)mir_tstrlen(buf), buf, (int)mir_tstrlen(buf));
+ LCMapString(Langpack_GetDefaultLocale() , LCMAP_LOWERCASE, buf, (int)mir_wstrlen(buf), buf, (int)mir_wstrlen(buf));
return buf;
}
@@ -45,7 +45,7 @@ class CPageKeywords
{
PageHash _pageHashKey;
KeywordList _pageKeyWords;
- static int _KeyWordsSortFunc(const wchar_t* p1, const wchar_t* p2) { return mir_tstrcmp(p1, p2); };
+ static int _KeyWordsSortFunc(const wchar_t* p1, const wchar_t* p2) { return mir_wstrcmp(p1, p2); };
public:
CPageKeywords(PageHash pageHashKey) : _pageHashKey(pageHashKey), _pageKeyWords(1, _KeyWordsSortFunc) {};
@@ -57,7 +57,7 @@ public:
void AddKeyWord(wchar_t *ptKeyWord)
{
- wchar_t *plwrWord = _tcslwr_locale(mir_tstrdup(ptKeyWord));
+ wchar_t *plwrWord = _tcslwr_locale(mir_wstrdup(ptKeyWord));
if (_pageKeyWords.getIndex(plwrWord) == -1)
_pageKeyWords.insert(plwrWord);
else
diff --git a/src/mir_app/src/findadd.cpp b/src/mir_app/src/findadd.cpp
index a6c1f98520..cef250a96c 100644
--- a/src/mir_app/src/findadd.cpp
+++ b/src/mir_app/src/findadd.cpp
@@ -302,12 +302,12 @@ static void SetListItemText(HWND hwndList, int idx, int col, wchar_t *szText)
static wchar_t* sttDecodeString(DWORD dwFlags, MAllStrings &src)
{
if (dwFlags & PSR_UNICODE)
- return mir_u2t(src.w);
+ return mir_wstrdup(src.w);
if (dwFlags & PSR_UTF8)
- return mir_utf8decodeT(src.a);
+ return mir_utf8decodeW(src.a);
- return mir_a2t(src.a);
+ return mir_a2u(src.a);
}
static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -350,7 +350,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
SelectObject(hdc, (HFONT)SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, WM_GETFONT, 0, 0));
SIZE textSize;
- GetTextExtentPoint32(hdc, TranslateT("Searching"), (int)mir_tstrlen(TranslateT("Searching")), &textSize);
+ GetTextExtentPoint32(hdc, TranslateT("Searching"), (int)mir_wstrlen(TranslateT("Searching")), &textSize);
int partWidth[3];
partWidth[0] = textSize.cx;
@@ -364,7 +364,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
SetStatusBarSearchInfo(GetDlgItem(hwndDlg, IDC_STATUSBAR), dat);
wchar_t *szProto = NULL;
- ptrT tszLast(db_get_tsa(NULL, "FindAdd", "LastSearched"));
+ ptrW tszLast(db_get_tsa(NULL, "FindAdd", "LastSearched"));
if (tszLast)
szProto = NEWWSTR_ALLOCA(tszLast);
@@ -387,7 +387,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
SelectObject(hdc, (HFONT)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, WM_GETFONT, 0, 0));
if (netProtoCount > 1) {
cbei.pszText = TranslateT("All networks");
- GetTextExtentPoint32(hdc, cbei.pszText, (int)mir_tstrlen(cbei.pszText), &textSize);
+ GetTextExtentPoint32(hdc, cbei.pszText, (int)mir_wstrlen(cbei.pszText), &textSize);
if (textSize.cx > cbwidth)
cbwidth = textSize.cx;
cbei.iImage = cbei.iSelectedImage = ImageList_AddIcon_IconLibLoaded(dat->himlComboIcons, SKINICON_OTHER_SEARCHALL);
@@ -406,7 +406,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
continue;
cbei.pszText = pa->tszAccountName;
- GetTextExtentPoint32(hdc, cbei.pszText, (int)mir_tstrlen(cbei.pszText), &textSize);
+ GetTextExtentPoint32(hdc, cbei.pszText, (int)mir_wstrlen(cbei.pszText), &textSize);
if (textSize.cx > cbwidth)
cbwidth = textSize.cx;
@@ -415,7 +415,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
DestroyIcon(hIcon);
cbei.lParam = (LPARAM)pa->szModuleName;
SendDlgItemMessageA(hwndDlg, IDC_PROTOLIST, CBEM_INSERTITEM, 0, (LPARAM)&cbei);
- if (szProto && cbei.pszText && !mir_tstrcmp(szProto, pa->tszAccountName))
+ if (szProto && cbei.pszText && !mir_wstrcmp(szProto, pa->tszAccountName))
index = cbei.iItem;
cbei.iItem++;
}
@@ -689,7 +689,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
else if (IsDlgButtonChecked(hwndDlg, IDC_BYPROTOID)) {
wchar_t str[256];
GetDlgItemText(hwndDlg, IDC_PROTOID, str, _countof(str));
- rtrimt(str);
+ rtrimw(str);
if (str[0] == 0)
MessageBox(hwndDlg, sttErrMsg, sttErrTitle, MB_ICONERROR | MB_OK);
else
@@ -698,7 +698,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
else if (IsDlgButtonChecked(hwndDlg, IDC_BYEMAIL)) {
wchar_t str[256];
GetDlgItemText(hwndDlg, IDC_EMAIL, str, _countof(str));
- rtrimt(str);
+ rtrimw(str);
if (str[0] == 0)
MessageBox(hwndDlg, sttErrMsg, sttErrTitle, MB_ICONERROR | MB_OK);
else
@@ -760,7 +760,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
else {
wchar_t str[256];
GetDlgItemText(hwndDlg, IDC_PROTOID, str, _countof(str));
- if (*rtrimt(str) == 0)
+ if (*rtrimw(str) == 0)
break;
PROTOSEARCHRESULT psr = { 0 };
diff --git a/src/mir_app/src/headerbar.cpp b/src/mir_app/src/headerbar.cpp
index b8c8651ff2..b863f56770 100644
--- a/src/mir_app/src/headerbar.cpp
+++ b/src/mir_app/src/headerbar.cpp
@@ -208,17 +208,13 @@ static LRESULT MHeaderbar_OnPaint(HWND hwndDlg, MHeaderbarCtrl *mit)
textRect.left = 50;
hOldFont = (HFONT)SelectObject(tempDC, hFntBold);
- wchar_t *szTitleW = mir_t2u(szTitle);
- drawThemeTextEx(hTheme, tempDC, WP_CAPTION, CS_ACTIVE, szTitleW, -1, DT_TOP | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP | DT_END_ELLIPSIS, &textRect, &dto);
- mir_free(szTitleW);
+ drawThemeTextEx(hTheme, tempDC, WP_CAPTION, CS_ACTIVE, szTitle, -1, DT_TOP | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP | DT_END_ELLIPSIS, &textRect, &dto);
if (szSubTitle) {
textRect.left = 66;
SelectObject(tempDC, hFont);
- wchar_t *szSubTitleW = mir_t2u(szSubTitle);
- drawThemeTextEx(hTheme, tempDC, WP_CAPTION, CS_ACTIVE, szSubTitleW, -1, DT_BOTTOM | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP | DT_END_ELLIPSIS, &textRect, &dto);
- mir_free(szSubTitleW);
+ drawThemeTextEx(hTheme, tempDC, WP_CAPTION, CS_ACTIVE, szSubTitle, -1, DT_BOTTOM | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP | DT_END_ELLIPSIS, &textRect, &dto);
}
CloseThemeData(hTheme);
}
diff --git a/src/mir_app/src/hotkey_opts.cpp b/src/mir_app/src/hotkey_opts.cpp
index 22e7443376..cb02b5496e 100644
--- a/src/mir_app/src/hotkey_opts.cpp
+++ b/src/mir_app/src/hotkey_opts.cpp
@@ -101,7 +101,7 @@ static wchar_t* sttHokeyVkToName(WORD vkKey)
void HotkeyToName(wchar_t *buf, int size, BYTE shift, BYTE key)
{
- mir_sntprintf(buf, size, L"%s%s%s%s%s",
+ mir_snwprintf(buf, size, L"%s%s%s%s%s",
(shift & HOTKEYF_CONTROL) ? TranslateT("Ctrl + ") : L"",
(shift & HOTKEYF_ALT) ? TranslateT("Alt + ") : L"",
(shift & HOTKEYF_SHIFT) ? TranslateT("Shift + ") : L"",
@@ -281,23 +281,23 @@ static int CALLBACK sttOptionsSortList(LPARAM lParam1, LPARAM lParam2, LPARAM lP
item2 = (THotkeyItem *)lvi.lParam;
if (!item1 && !item2)
- return mir_tstrcmp(title1, title2);
+ return mir_wstrcmp(title1, title2);
if (!item1 && item2) {
- if (res = mir_tstrcmp(title1, item2->getSection()))
+ if (res = mir_wstrcmp(title1, item2->getSection()))
return res;
return -1;
}
if (!item2 && item1) {
- if (res = mir_tstrcmp(item1->getSection(), title2))
+ if (res = mir_wstrcmp(item1->getSection(), title2))
return res;
return 1;
}
/* item1 != NULL && item2 != NULL */
- if (res = mir_tstrcmp(item1->getSection(), item2->getSection())) return res;
- if (res = mir_tstrcmp(item1->getDescr(), item2->getDescr())) return res;
+ if (res = mir_wstrcmp(item1->getSection(), item2->getSection())) return res;
+ if (res = mir_wstrcmp(item1->getDescr(), item2->getDescr())) return res;
if (!item1->rootHotkey && item2->rootHotkey) return -1;
if (item1->rootHotkey && !item2->rootHotkey) return 1;
return 0;
@@ -311,8 +311,8 @@ static void sttOptionsAddHotkey(HWND hwndList, THotkeyItem *item)
THotkeyItem *newItem = (THotkeyItem *)mir_alloc(sizeof(THotkeyItem));
newItem->pszName = NULL;
newItem->pszService = item->pszService ? mir_strdup(item->pszService) : NULL;
- newItem->ptszSection = mir_tstrdup(item->ptszSection);
- newItem->ptszDescription = mir_tstrdup(item->ptszDescription);
+ newItem->ptszSection = mir_wstrdup(item->ptszSection);
+ newItem->ptszDescription = mir_wstrdup(item->ptszDescription);
newItem->lParam = item->lParam;
newItem->idHotkey = GlobalAddAtomA(buf);
newItem->rootHotkey = item;
@@ -393,7 +393,7 @@ static void sttBuildHotkeyList(HWND hwndList)
if (item->OptDeleted)
continue;
- if (!i || mir_tstrcmp(item->ptszSection, hotkeys[i - 1]->ptszSection)) {
+ if (!i || mir_wstrcmp(item->ptszSection, hotkeys[i - 1]->ptszSection)) {
lvi.mask = LVIF_TEXT | LVIF_PARAM;
lvi.iItem = nItems++;
lvi.iSubItem = 0;
@@ -452,7 +452,7 @@ static void sttOptionsDrawTextChunk(HDC hdc, wchar_t *text, RECT *rc)
DrawText(hdc, text, -1, rc, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_WORD_ELLIPSIS);
SIZE sz;
- GetTextExtentPoint32(hdc, text, (int)mir_tstrlen(text), &sz);
+ GetTextExtentPoint32(hdc, text, (int)mir_wstrlen(text), &sz);
rc->left += sz.cx;
}
@@ -536,7 +536,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
lvi.iSubItem = 1;
ListView_GetItem(hwndHotkey, &lvi);
- szSetting = mir_t2a(lvi.pszText);
+ szSetting = mir_u2a(lvi.pszText);
ListView_SetCheckState(hwndHotkey, lvi.iItem,
db_get_b(NULL, DBMODULENAME "UI", szSetting, TRUE));
@@ -907,7 +907,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
ListView_GetItem(lpnmhdr->hwndFrom, &lvi2);
item = (THotkeyItem*)lvi2.lParam;
if (!item) continue;
- if (!mir_tstrcmp(item->getSection(), buf)) {
+ if (!mir_wstrcmp(item->getSection(), buf)) {
ListView_DeleteItem(lpnmhdr->hwndFrom, lvi2.iItem);
--lvi2.iItem;
--count;
@@ -920,7 +920,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
for (int i = 0; i < hotkeys.getCount(); i++) {
LVITEM lvi2 = { 0 };
item = hotkeys[i];
- if (item->OptDeleted || mir_tstrcmp(buf, item->getSection()))
+ if (item->OptDeleted || mir_wstrcmp(buf, item->getSection()))
continue;
lvi2.mask = LVIF_PARAM | LVIF_INDENT;
diff --git a/src/mir_app/src/hotkeys.cpp b/src/mir_app/src/hotkeys.cpp
index 9a1a844f89..7ecb0b1c3a 100644
--- a/src/mir_app/src/hotkeys.cpp
+++ b/src/mir_app/src/hotkeys.cpp
@@ -29,9 +29,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static int sttCompareHotkeys(const THotkeyItem *p1, const THotkeyItem *p2)
{
int res;
- if (res = mir_tstrcmp(p1->ptszSection, p2->ptszSection))
+ if (res = mir_wstrcmp(p1->ptszSection, p2->ptszSection))
return res;
- if (res = mir_tstrcmp(p1->ptszDescription, p2->ptszDescription))
+ if (res = mir_wstrcmp(p1->ptszDescription, p2->ptszDescription))
return res;
if (!p1->rootHotkey && p2->rootHotkey)
return -1;
@@ -138,8 +138,8 @@ static INT_PTR svcHotkeyRegister(WPARAM wParam, LPARAM lParam)
THotkeyItem *p = (THotkeyItem*)mir_alloc(sizeof(THotkeyItem));
DWORD dwFlags = (desc->cbSize >= sizeof(HOTKEYDESC)) ? desc->dwFlags : 0;
if (dwFlags & HKD_UNICODE) {
- p->ptszSection = mir_tstrdup(desc->ptszSection);
- p->ptszDescription = mir_tstrdup(desc->ptszDescription);
+ p->ptszSection = mir_wstrdup(desc->ptszSection);
+ p->ptszDescription = mir_wstrdup(desc->ptszDescription);
}
else {
p->ptszSection = mir_a2u(desc->pszSection);
@@ -250,7 +250,7 @@ static INT_PTR svcHotkeyUnregister(WPARAM, LPARAM lParam)
static INT_PTR svcHotkeyCheck(WPARAM wParam, LPARAM lParam)
{
MSG *msg = (MSG *)wParam;
- wchar_t *pszSection = mir_a2t((char *)lParam);
+ wchar_t *pszSection = mir_a2u((char *)lParam);
if ((msg->message == WM_KEYDOWN) || (msg->message == WM_SYSKEYDOWN)) {
int i;
@@ -264,7 +264,7 @@ static INT_PTR svcHotkeyCheck(WPARAM wParam, LPARAM lParam)
for (i = 0; i < hotkeys.getCount(); i++) {
THotkeyItem *p = hotkeys[i];
- if ((p->type != HKT_MANUAL) || mir_tstrcmp(pszSection, p->ptszSection))
+ if ((p->type != HKT_MANUAL) || mir_wstrcmp(pszSection, p->ptszSection))
continue;
BYTE hkMod, hkVk;
diff --git a/src/mir_app/src/icolib.cpp b/src/mir_app/src/icolib.cpp
index 45c2e33b27..d2f8f34e24 100644
--- a/src/mir_app/src/icolib.cpp
+++ b/src/mir_app/src/icolib.cpp
@@ -40,14 +40,14 @@ mir_cs csIconList;
static int sttCompareSections(const SectionItem *p1, const SectionItem *p2)
{
- return mir_tstrcmp(p1->name, p2->name);
+ return mir_wstrcmp(p1->name, p2->name);
}
LIST<SectionItem> sectionList(20, sttCompareSections);
static int sttCompareIconSourceFiles(const IconSourceFile *p1, const IconSourceFile *p2)
{
- return mir_tstrcmpi(p1->file, p2->file);
+ return mir_wstrcmpi(p1->file, p2->file);
}
static LIST<IconSourceFile> iconSourceFileList(10, sttCompareIconSourceFiles);
@@ -336,7 +336,7 @@ IconSourceItem* GetIconSourceItemFromPath(const wchar_t *path, int cxIcon, int c
return NULL;
wchar_t file[MAX_PATH];
- mir_tstrncpy(file, path, _countof(file));
+ mir_wstrncpy(file, path, _countof(file));
wchar_t *comma = wcsrchr(file, ',');
int n;
@@ -352,7 +352,7 @@ IconSourceItem* GetIconSourceItemFromPath(const wchar_t *path, int cxIcon, int c
IconSourceItem* CreateStaticIconSourceItem(int cxIcon, int cyIcon)
{
wchar_t tszName[100];
- mir_sntprintf(tszName, L"*StaticIcon_%d", iStaticCount++);
+ mir_snwprintf(tszName, L"*StaticIcon_%d", iStaticCount++);
IconSourceItemKey key = { IconSourceFile_Get(tszName, false), 0, cxIcon, cyIcon };
IconSourceItem *newItem = new IconSourceItem(key);
@@ -390,7 +390,7 @@ static SectionItem* IcoLib_AddSection(wchar_t *sectionName, BOOL create_new)
if (create_new) {
SectionItem *newItem = new SectionItem();
- newItem->name = mir_tstrdup(sectionName);
+ newItem->name = mir_wstrdup(sectionName);
sectionList.insert(newItem);
bNeedRebuild = TRUE;
return newItem;
@@ -476,11 +476,11 @@ MIR_APP_DLL(HANDLE) IcoLib_AddIcon(SKINICONDESC *sid, int _hLang)
item->name = mir_strdup(sid->pszName);
if (sid->flags & SIDF_UNICODE) {
- item->description = mir_u2t(sid->description.w);
+ item->description = mir_wstrdup(sid->description.w);
item->section = IcoLib_AddSection(sid->section.w, TRUE);
}
else {
- item->description = mir_a2t(sid->description.a);
+ item->description = mir_a2u(sid->description.a);
item->section = IcoLib_AddSection(_A2T(sid->section.a), TRUE);
}
@@ -667,7 +667,7 @@ HICON IconItem_GetIcon(HANDLE hIcoLib, bool big)
big = big && !item->cx;
IconSourceItem* &source = big ? item->source_big : item->source_small;
if (source == NULL) {
- ptrT tszCustomPath(db_get_tsa(NULL, "SkinIcons", item->name));
+ ptrW tszCustomPath(db_get_tsa(NULL, "SkinIcons", item->name));
if (tszCustomPath != NULL) {
wchar_t tszFullPath[MAX_PATH];
PathToAbsoluteT(tszCustomPath, tszFullPath);
diff --git a/src/mir_app/src/iconheader.cpp b/src/mir_app/src/iconheader.cpp
index 48c1c97cb0..6ce4ad6c31 100644
--- a/src/mir_app/src/iconheader.cpp
+++ b/src/mir_app/src/iconheader.cpp
@@ -226,9 +226,7 @@ static void MIcoTab_DrawItem(HWND hwnd, HDC hdc, MIcoTabCtrl *dat, MIcoTab *tab,
dto.dwFlags = DTT_COMPOSITED | DTT_GLOWSIZE;
dto.iGlowSize = 10;
HANDLE hTheme = OpenThemeData(hwnd, L"Window");
- wchar_t *tcsNameW = mir_t2u(tab->tcsName);
- drawThemeTextEx(hTheme, hdc, WP_CAPTION, CS_ACTIVE, tcsNameW, -1, DT_VCENTER | DT_CENTER | DT_END_ELLIPSIS, &textRect, &dto);
- mir_free(tcsNameW);
+ drawThemeTextEx(hTheme, hdc, WP_CAPTION, CS_ACTIVE, tab->tcsName, -1, DT_VCENTER | DT_CENTER | DT_END_ELLIPSIS, &textRect, &dto);
CloseThemeData(hTheme);
}
else DrawText(hdc, tab->tcsName, -1, &textRect, DT_VCENTER | DT_CENTER | DT_END_ELLIPSIS);
@@ -463,9 +461,9 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
pListMit->flag = pMit->flag;
pListMit->data = pMit->data;
if (pMit->flag & MITCF_UNICODE)
- pListMit->tcsName = mir_u2t(pMit->lpwzName);
+ pListMit->tcsName = mir_wstrdup(pMit->lpwzName);
else
- pListMit->tcsName = mir_a2t(pMit->lpzName);
+ pListMit->tcsName = mir_a2u(pMit->lpzName);
if (pMit->hIcon) {
if (pListMit->flag&MITCF_SHAREDICON)
pListMit->hIcon = pMit->hIcon;
diff --git a/src/mir_app/src/langpack.cpp b/src/mir_app/src/langpack.cpp
index 020bc0e46f..3a17d94307 100644
--- a/src/mir_app/src/langpack.cpp
+++ b/src/mir_app/src/langpack.cpp
@@ -34,7 +34,7 @@ BOOL EnumLangpacks(ENUM_PACKS_CALLBACK callback, WPARAM wParam, LPARAM lParam)
BOOL res = FALSE;
/* language folder */
- ptrT langpack(db_get_tsa(NULL, "Langpack", "Current"));
+ ptrW langpack(db_get_tsa(NULL, "Langpack", "Current"));
wchar_t tszFullPath[MAX_PATH];
PathToAbsoluteT(L"\\Languages\\langpack_*.txt", tszFullPath);
@@ -47,13 +47,13 @@ BOOL EnumLangpacks(ENUM_PACKS_CALLBACK callback, WPARAM wParam, LPARAM lParam)
if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue;
/* get data */
PathToAbsoluteT(L"\\Languages\\", tszFullPath);
- mir_tstrcat(tszFullPath, wfd.cFileName);
+ mir_wstrcat(tszFullPath, wfd.cFileName);
LANGPACK_INFO pack;
if (!LoadLangPackDescr(tszFullPath, &pack)) {
pack.ftFileDate = wfd.ftLastWriteTime;
/* enabled? */
- if (langpack && !mir_tstrcmpi(langpack, wfd.cFileName)) {
+ if (langpack && !mir_wstrcmpi(langpack, wfd.cFileName)) {
if (!fPackFound) pack.flags |= LPF_ENABLED;
fPackFound = TRUE;
}
@@ -69,14 +69,14 @@ BOOL EnumLangpacks(ENUM_PACKS_CALLBACK callback, WPARAM wParam, LPARAM lParam)
if (callback != NULL) {
LANGPACK_INFO pack;
pack.Locale = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT);
- mir_tstrcpy(pack.tszLanguage, L"English");
+ mir_wstrcpy(pack.tszLanguage, L"English");
pack.szAuthors = "Miranda NG Development Team";
pack.szAuthorEmail = "project-info@miranda-ng.org";
DWORD v = CallService(MS_SYSTEM_GETVERSION, 0, 0);
pack.szLastModifiedUsing.Format("%d.%d.%d", ((v >> 24) & 0xFF), ((v >> 16) & 0xFF), ((v >> 8) & 0xFF));
/* file date */
if (GetModuleFileName(NULL, pack.tszFullPath, _countof(pack.tszFullPath))) {
- mir_tstrcpy(pack.tszFileName, L"default");
+ mir_wstrcpy(pack.tszFileName, L"default");
HANDLE hFile = CreateFile(pack.tszFileName, 0, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
if (hFile != INVALID_HANDLE_VALUE) {
GetFileTime(hFile, NULL, NULL, &pack.ftFileDate);
diff --git a/src/mir_app/src/lpopts.cpp b/src/mir_app/src/lpopts.cpp
index 6166ec692a..c8e7ed7602 100644
--- a/src/mir_app/src/lpopts.cpp
+++ b/src/mir_app/src/lpopts.cpp
@@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static void SetDlgItemText_CP(HWND hwndDlg, int ctrlID, LPCSTR str)
{
- SetDlgItemText(hwndDlg, ctrlID, ptrT(mir_utf8decodeT(str)));
+ SetDlgItemText(hwndDlg, ctrlID, ptrW(mir_utf8decodeW(str)));
}
static void DisplayPackInfo(HWND hwndDlg, const LANGPACK_INFO *pack)
@@ -43,12 +43,12 @@ static void DisplayPackInfo(HWND hwndDlg, const LANGPACK_INFO *pack)
/* add some note if its incompatible */
if (szLanguageName[0] && szContryName[0]) {
- mir_sntprintf(szLocaleName, L"%s (%s)", TranslateTS(szLanguageName), TranslateTS(szContryName));
+ mir_snwprintf(szLocaleName, L"%s (%s)", TranslateTS(szLanguageName), TranslateTS(szContryName));
if (!IsValidLocale(pack->Locale, LCID_INSTALLED)) {
wchar_t *pszIncompat;
pszIncompat = TranslateT("(incompatible)");
- szLocaleName[_countof(szLocaleName) - mir_tstrlen(pszIncompat) - 1] = 0;
- mir_tstrcat(mir_tstrcat(szLocaleName, L" "), pszIncompat);
+ szLocaleName[_countof(szLocaleName) - mir_wstrlen(pszIncompat) - 1] = 0;
+ mir_wstrcat(mir_wstrcat(szLocaleName, L" "), pszIncompat);
}
SetDlgItemText(hwndDlg, IDC_LANGLOCALE, szLocaleName);
}
@@ -77,7 +77,7 @@ static BOOL InsertPackItemEnumProc(LANGPACK_INFO *pack, WPARAM wParam, LPARAM)
/* insert */
wchar_t tszName[512];
- mir_sntprintf(tszName, L"%s [%s]",
+ mir_snwprintf(tszName, L"%s [%s]",
TranslateTS(pack->tszLanguage),
pack->flags & LPF_DEFAULT ? TranslateT("built-in") : pack->tszFileName);
UINT message = pack->flags & LPF_DEFAULT ? CB_INSERTSTRING : CB_ADDSTRING;
@@ -167,7 +167,7 @@ INT_PTR CALLBACK DlgLangpackOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
LANGPACK_INFO *pack = (LANGPACK_INFO*)ComboBox_GetItemData(hwndList, i);
if (i == idx) {
db_set_ts(NULL, "Langpack", "Current", pack->tszFileName);
- mir_tstrcpy(tszPath, pack->tszFullPath);
+ mir_wstrcpy(tszPath, pack->tszFullPath);
pack->flags |= LPF_ENABLED;
}
else pack->flags &= ~LPF_ENABLED;
diff --git a/src/mir_app/src/menu_clist.cpp b/src/mir_app/src/menu_clist.cpp
index 9d2109c4d3..894c323e3b 100644
--- a/src/mir_app/src/menu_clist.cpp
+++ b/src/mir_app/src/menu_clist.cpp
@@ -190,7 +190,7 @@ MIR_APP_DLL(HGENMENU) Menu_AddMainMenuItem(TMO_MenuItem *pmi)
if (pmi->pszService)
name = pmi->pszService;
else if (pmi->flags & CMIF_UNICODE) {
- name = mir_t2a(pmi->name.w);
+ name = mir_u2a(pmi->name.w);
needFree = true;
}
else name = pmi->name.a;
@@ -381,7 +381,7 @@ MIR_APP_DLL(HGENMENU) Menu_AddStatusMenuItem(TMO_MenuItem *pmi, const char *pszP
smep->hMenuItem = pimi;
char buf[MAX_PATH + 64];
- char *p = (pRoot) ? mir_t2a(pRoot->mi.name.w) : NULL;
+ char *p = (pRoot) ? mir_u2a(pRoot->mi.name.w) : NULL;
mir_snprintf(buf, "%s/%s", (p) ? p : "", pmi->pszService ? pmi->pszService : "");
mir_free(p);
@@ -584,7 +584,7 @@ INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM)
if (bIsLocked) {
pimi->mi.flags |= CMIF_CHECKED;
if (cli.bDisplayLocked) {
- mir_sntprintf(buf, TranslateT("%s (locked)"), acc->tszAccountName);
+ mir_snwprintf(buf, TranslateT("%s (locked)"), acc->tszAccountName);
ptszName = buf;
}
else ptszName = acc->tszAccountName;
@@ -593,8 +593,8 @@ INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM)
ptszName = acc->tszAccountName;
pimi->mi.flags &= ~CMIF_CHECKED;
}
- replaceStrT(pimi->mi.name.w, ptszName);
- replaceStrT(root->mi.name.w, ptszName);
+ replaceStrW(pimi->mi.name.w, ptszName);
+ replaceStrW(root->mi.name.w, ptszName);
if (cli.hwndStatus)
InvalidateRect(cli.hwndStatus, NULL, TRUE);
@@ -821,7 +821,7 @@ void RebuildMenuOrder(void)
mi.hIcon = ic = (HICON)CallProtoServiceInt(NULL, pa->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
if (Proto_IsAccountLocked(pa) && cli.bDisplayLocked) {
- mir_sntprintf(tbuf, TranslateT("%s (locked)"), pa->tszAccountName);
+ mir_snwprintf(tbuf, TranslateT("%s (locked)"), pa->tszAccountName);
mi.name.w = tbuf;
}
else mi.name.w = pa->tszAccountName;
@@ -845,7 +845,7 @@ void RebuildMenuOrder(void)
mi.flags |= CMIF_CHECKED;
if ((mi.flags & CMIF_CHECKED) && cli.bDisplayLocked) {
- mir_sntprintf(tbuf, TranslateT("%s (locked)"), pa->tszAccountName);
+ mir_snwprintf(tbuf, TranslateT("%s (locked)"), pa->tszAccountName);
mi.name.w = tbuf;
}
else mi.name.w = pa->tszAccountName;
@@ -928,7 +928,7 @@ void RebuildMenuOrder(void)
wchar_t buf[256], hotkeyName[100];
WORD hotKey = GetHotkeyValue(statusHotkeys[j]);
HotkeyToName(hotkeyName, _countof(hotkeyName), HIBYTE(hotKey), LOBYTE(hotKey));
- mir_sntprintf(buf, L"%s\t%s", cli.pfnGetStatusModeDescription(statusModeList[j], 0), hotkeyName);
+ mir_snwprintf(buf, L"%s\t%s", cli.pfnGetStatusModeDescription(statusModeList[j], 0), hotkeyName);
mi.name.w = buf;
hStatusMainMenuHandles[j] = Menu_AddItem(hStatusMenuObject, &mi, smep);
@@ -958,7 +958,7 @@ static int sttRebuildHotkeys(WPARAM, LPARAM)
wchar_t buf[256], hotkeyName[100];
WORD hotKey = GetHotkeyValue(statusHotkeys[j]);
HotkeyToName(hotkeyName, _countof(hotkeyName), HIBYTE(hotKey), LOBYTE(hotKey));
- mir_sntprintf(buf, L"%s\t%s", cli.pfnGetStatusModeDescription(statusModeList[j], 0), hotkeyName);
+ mir_snwprintf(buf, L"%s\t%s", cli.pfnGetStatusModeDescription(statusModeList[j], 0), hotkeyName);
Menu_ModifyItem(hStatusMainMenuHandles[j], buf);
hStatusMainMenuHandles[j]->hotKey = MAKELONG(HIBYTE(hotKey), LOBYTE(hotKey));
diff --git a/src/mir_app/src/menu_options.cpp b/src/mir_app/src/menu_options.cpp
index 6d7ba2bc0f..a2acb5dfaa 100644
--- a/src/mir_app/src/menu_options.cpp
+++ b/src/mir_app/src/menu_options.cpp
@@ -40,8 +40,8 @@ struct MenuItemOptData : public MZeroedObject
int pos;
- ptrT name;
- ptrT defname;
+ ptrW name;
+ ptrW defname;
bool bShow;
int id;
@@ -91,7 +91,7 @@ class CGenMenuOptionsPage : public CDlgBase
int visible = tvi.iImage != 0;
wchar_t *ptszCustomName;
- if (iod->name != NULL && iod->defname != NULL && mir_tstrcmp(iod->name, iod->defname) != 0)
+ if (iod->name != NULL && iod->defname != NULL && mir_wstrcmp(iod->name, iod->defname) != 0)
ptszCustomName = iod->name;
else
ptszCustomName = L"";
@@ -110,7 +110,7 @@ class CGenMenuOptionsPage : public CDlgBase
runtimepos += 100;
}
- if (iod->name && !mir_tstrcmp(iod->name, STR_SEPARATOR) && tvi.iImage)
+ if (iod->name && !mir_wstrcmp(iod->name, STR_SEPARATOR) && tvi.iImage)
runtimepos += SEPARATORPOSITIONINTERVAL;
tvi.hItem = m_menuItems.GetNextSibling(tvi.hItem);
@@ -170,8 +170,8 @@ class CGenMenuOptionsPage : public CDlgBase
MenuItemOptData *PD = new MenuItemOptData();
PD->pimi = p;
- PD->defname = mir_tstrdup(GetMenuItemText(p));
- PD->name = mir_tstrdup((bReread && p->ptszCustomName != NULL) ? p->ptszCustomName : PD->defname);
+ PD->defname = mir_wstrdup(GetMenuItemText(p));
+ PD->name = mir_wstrdup((bReread && p->ptszCustomName != NULL) ? p->ptszCustomName : PD->defname);
PD->bShow = (p->mi.flags & CMIF_HIDDEN) == 0;
PD->pos = (bReread) ? p->mi.position : p->originalPosition;
PD->id = p->iCommand;
@@ -191,7 +191,7 @@ class CGenMenuOptionsPage : public CDlgBase
if (i > 0 && PD->pos - lastpos >= SEPARATORPOSITIONINTERVAL) {
MenuItemOptData *sep = new MenuItemOptData();
sep->id = -1;
- sep->name = mir_tstrdup(STR_SEPARATOR);
+ sep->name = mir_wstrdup(STR_SEPARATOR);
sep->pos = PD->pos - 1;
tvis.item.lParam = (LPARAM)sep;
@@ -364,7 +364,7 @@ public:
MenuItemOptData *PD = new MenuItemOptData();
PD->id = -1;
- PD->name = mir_tstrdup(STR_SEPARATOR);
+ PD->name = mir_wstrdup(STR_SEPARATOR);
PD->pos = ((MenuItemOptData *)tvi.lParam)->pos - 1;
TVINSERTSTRUCT tvis = { 0 };
@@ -401,7 +401,7 @@ public:
MenuItemOptData *PD = new MenuItemOptData();
PD->id = -1;
- PD->name = mir_tstrdup(pimi->mi.name.w);
+ PD->name = mir_wstrdup(pimi->mi.name.w);
PD->pos = pimi->mi.position;
PD->pimi = pimi;
@@ -440,7 +440,7 @@ public:
if (iod->name && wcsstr(iod->name, STR_SEPARATOR))
return;
- iod->name = mir_tstrdup(iod->defname);
+ iod->name = mir_wstrdup(iod->defname);
m_customName.SetText(iod->defname);
tvi.mask = TVIF_TEXT;
@@ -513,7 +513,7 @@ public:
}
m_btnInsMenu.Enable(iod->pimi->mi.root == NULL);
- m_btnDefault.Enable(mir_tstrcmp(iod->name, iod->defname) != 0);
+ m_btnDefault.Enable(mir_wstrcmp(iod->name, iod->defname) != 0);
m_btnSet.Enable(true);
m_customName.Enable(true);
}
diff --git a/src/mir_app/src/menu_utils.cpp b/src/mir_app/src/menu_utils.cpp
index 91cb530e13..838eb24344 100644
--- a/src/mir_app/src/menu_utils.cpp
+++ b/src/mir_app/src/menu_utils.cpp
@@ -343,7 +343,7 @@ MIR_APP_DLL(int) Menu_ModifyItem(HGENMENU hMenuItem, const wchar_t *ptszName, HA
return -1;
if (ptszName != NULL)
- replaceStrT(pimi->mi.name.w, ptszName);
+ replaceStrW(pimi->mi.name.w, ptszName);
if (iFlags != -1) {
Menu_SetItemFlags(hMenuItem, true, iFlags);
@@ -550,7 +550,7 @@ MIR_APP_DLL(int) Menu_AddObject(LPCSTR szName, LPCSTR szDisplayName, LPCSTR szCh
TIntMenuObject *p = new TIntMenuObject();
p->id = NextObjectId++;
p->pszName = mir_strdup(szName);
- p->ptszDisplayName = mir_a2t(szDisplayName);
+ p->ptszDisplayName = mir_a2u(szDisplayName);
p->CheckService = mir_strdup(szCheckService);
p->ExecService = mir_strdup(szExecService);
p->m_hMenuIcons = ImageList_Create(g_iIconSX, g_iIconSY, ILC_COLOR32 | ILC_MASK, 15, 100);
@@ -667,7 +667,7 @@ static int GetNextObjectMenuItemId()
static int FindRoot(TMO_IntMenuItem *pimi, void *param)
{
if (pimi->mi.name.w != NULL)
- if (pimi->submenu.first && !mir_tstrcmp(pimi->mi.name.w, (wchar_t*)param))
+ if (pimi->submenu.first && !mir_wstrcmp(pimi->mi.name.w, (wchar_t*)param))
return TRUE;
return FALSE;
@@ -718,7 +718,7 @@ MIR_APP_DLL(HGENMENU) Menu_AddItem(int hMenuObject, TMO_MenuItem *pmi, void *pUs
p->pUserData = pUserData;
if (pmi->flags & CMIF_UNICODE)
- p->mi.name.w = mir_tstrdup(pmi->name.w);
+ p->mi.name.w = mir_wstrdup(pmi->name.w);
else
p->mi.name.w = mir_a2u(pmi->name.a);
@@ -989,7 +989,7 @@ int Menu_LoadFromDatabase(TMO_IntMenuItem *pimi, void *szModule)
bin2hex(&pimi->mi.uid, sizeof(pimi->mi.uid), menuItemName);
TIntMenuObject *pmo = pimi->parent;
- ptrT szValue(db_get_tsa(NULL, (char*)szModule, menuItemName));
+ ptrW szValue(db_get_tsa(NULL, (char*)szModule, menuItemName));
if (szValue == NULL)
return 0;
@@ -1005,7 +1005,7 @@ int Menu_LoadFromDatabase(TMO_IntMenuItem *pimi, void *szModule)
case 0: bVisible = _wtoi(ptszToken); break;
case 1: pos = _wtoi(ptszToken); break;
case 2:
- hex2binT(ptszToken, &customRoot, sizeof(customRoot));
+ hex2binW(ptszToken, &customRoot, sizeof(customRoot));
if (customRoot == pimi->mi.uid) // prevent a loop
memset(&customRoot, 0, sizeof(customRoot));
break;
@@ -1026,7 +1026,7 @@ int Menu_LoadFromDatabase(TMO_IntMenuItem *pimi, void *szModule)
else
pimi->mi.flags |= CMIF_HIDDEN;
- replaceStrT(pimi->ptszCustomName, tszCustomName[0] ? tszCustomName : NULL);
+ replaceStrW(pimi->ptszCustomName, tszCustomName[0] ? tszCustomName : NULL);
MUUID currentUid;
if (pimi->mi.root == NULL)
@@ -1128,7 +1128,7 @@ static HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem *pRootMenu, WPARAM
#ifdef PUTPOSITIONSONMENU
if (GetKeyState(VK_CONTROL) & 0x8000) {
wchar_t str[256];
- mir_sntprintf(str, L"%s (%d, id %x)", mi->name.a, mi->position, mii.dwItemData);
+ mir_snwprintf(str, L"%s (%d, id %x)", mi->name.a, mi->position, mii.dwItemData);
mii.dwTypeData = str;
}
#endif
@@ -1142,7 +1142,7 @@ static HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem *pRootMenu, WPARAM
#ifdef PUTPOSITIONSONMENU
if (GetKeyState(VK_CONTROL) & 0x8000) {
wchar_t str[256];
- mir_sntprintf(str, L"%s (%d, id %x)", mi->name.a, mi->position, mii.dwItemData);
+ mir_snwprintf(str, L"%s (%d, id %x)", mi->name.a, mi->position, mii.dwItemData);
mii.dwTypeData = str;
}
#endif
@@ -1221,7 +1221,7 @@ static int MO_RegisterIcon(TMO_IntMenuItem *pmi, void*)
HICON hIcon = ImageList_GetIcon(pmi->parent->m_hMenuIcons, pmi->iconId, 0);
wchar_t sectionName[256];
- mir_sntprintf(sectionName, LPGENW("Menu icons") L"/%s", TranslateTS(pmi->parent->ptszDisplayName));
+ mir_snwprintf(sectionName, LPGENW("Menu icons") L"/%s", TranslateTS(pmi->parent->ptszDisplayName));
char iconame[256], uname[100];
bin2hex(&pmi->mi.uid, sizeof(pmi->mi.uid), uname);
@@ -1235,7 +1235,7 @@ static int MO_RegisterIcon(TMO_IntMenuItem *pmi, void*)
if ((p = wcschr(p, '&')) == NULL)
break;
- memmove(p, p + 1, sizeof(wchar_t)*(mir_tstrlen(p + 1) + 1));
+ memmove(p, p + 1, sizeof(wchar_t)*(mir_wstrlen(p + 1) + 1));
if (*p == '\0')
p++;
}
diff --git a/src/mir_app/src/meta_addto.cpp b/src/mir_app/src/meta_addto.cpp
index 19a59644f5..41e4d349d9 100644
--- a/src/mir_app/src/meta_addto.cpp
+++ b/src/mir_app/src/meta_addto.cpp
@@ -52,7 +52,7 @@ static int FillList(HWND list, BOOL sort)
// get contact display name from clist
wchar_t *swzContactDisplayName = cli.pfnGetContactDisplayName(hMetaUser, 0);
// don't insert huge strings that we have to compare with later
- if (mir_tstrlen(swzContactDisplayName) > 1023)
+ if (mir_wstrlen(swzContactDisplayName) > 1023)
swzContactDisplayName[1024] = 0;
int pos = -1;
@@ -60,7 +60,7 @@ static int FillList(HWND list, BOOL sort)
for (pos = 0; pos < i; pos++) {
wchar_t buff[1024];
SendMessage(list, LB_GETTEXT, pos, (LPARAM)buff);
- if (mir_tstrcmp(buff, swzContactDisplayName) > 0)
+ if (mir_wstrcmp(buff, swzContactDisplayName) > 0)
break;
}
}
@@ -154,7 +154,7 @@ static INT_PTR CALLBACK Meta_SelectDialogProc(HWND hwndDlg, UINT msg, WPARAM wPa
// ... and set it to the Window title.
wchar_t buf[256];
- mir_sntprintf(buf, TranslateT("Adding %s..."), ptszCDN);
+ mir_snwprintf(buf, TranslateT("Adding %s..."), ptszCDN);
SetWindowText(hwndDlg, buf);
}
ShowWindow(hwndDlg, SW_SHOWNORMAL);
diff --git a/src/mir_app/src/meta_menu.cpp b/src/mir_app/src/meta_menu.cpp
index 2f7693ae90..3929c057e8 100644
--- a/src/mir_app/src/meta_menu.cpp
+++ b/src/mir_app/src/meta_menu.cpp
@@ -49,7 +49,7 @@ static HGENMENU
INT_PTR Meta_Convert(WPARAM wParam, LPARAM)
{
- ptrT tszGroup(db_get_tsa(wParam, "CList", "Group"));
+ ptrW tszGroup(db_get_tsa(wParam, "CList", "Group"));
// Create a new metacontact
MCONTACT hMetaContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
diff --git a/src/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp
index 99d31ad899..ae59188348 100644
--- a/src/mir_app/src/meta_services.cpp
+++ b/src/mir_app/src/meta_services.cpp
@@ -380,7 +380,7 @@ int Meta_SettingChanged(WPARAM hContact, LPARAM lParam)
mir_snprintf(buffer, "Nick%d", contact_number);
db_set(ccMeta->contactID, META_PROTO, buffer, &dcws->value);
- ptrT tszMyhandle(db_get_tsa(hContact, "CList", "MyHandle"));
+ ptrW tszMyhandle(db_get_tsa(hContact, "CList", "MyHandle"));
if (tszMyhandle == NULL) {
mir_snprintf(buffer, "CListName%d", contact_number);
db_set(ccMeta->contactID, META_PROTO, buffer, &dcws->value);
diff --git a/src/mir_app/src/meta_utils.cpp b/src/mir_app/src/meta_utils.cpp
index ddf0937972..8ef0a9876f 100644
--- a/src/mir_app/src/meta_utils.cpp
+++ b/src/mir_app/src/meta_utils.cpp
@@ -40,7 +40,7 @@ POINT menuMousePoint;
int Meta_SetNick(char *szProto)
{
- ptrT tszNick(Contact_GetInfo(CNF_DISPLAY, NULL, szProto));
+ ptrW tszNick(Contact_GetInfo(CNF_DISPLAY, NULL, szProto));
if (tszNick == NULL)
return 1;
@@ -431,7 +431,7 @@ int Meta_CopyContactNick(DBCachedContact *ccMeta, MCONTACT hContact)
return 1;
if (options.clist_contact_name == CNNT_NICK) {
- ptrT tszNick(db_get_tsa(hContact, szProto, "Nick"));
+ ptrW tszNick(db_get_tsa(hContact, szProto, "Nick"));
if (tszNick) {
db_set_ts(ccMeta->contactID, META_PROTO, "Nick", tszNick);
return 0;
@@ -439,7 +439,7 @@ int Meta_CopyContactNick(DBCachedContact *ccMeta, MCONTACT hContact)
}
else if (options.clist_contact_name == CNNT_DISPLAYNAME) {
wchar_t *name = cli.pfnGetContactDisplayName(hContact, 0);
- if (name && mir_tstrcmp(name, TranslateT("(Unknown contact)")) != 0) {
+ if (name && mir_wstrcmp(name, TranslateT("(Unknown contact)")) != 0) {
db_set_ts(ccMeta->contactID, META_PROTO, "Nick", name);
return 0;
}
diff --git a/src/mir_app/src/movetogroup.cpp b/src/mir_app/src/movetogroup.cpp
index 318be7e4d9..541404e28b 100644
--- a/src/mir_app/src/movetogroup.cpp
+++ b/src/mir_app/src/movetogroup.cpp
@@ -35,7 +35,7 @@ struct GroupItemSort
int position;
GroupItemSort(wchar_t* pname, int pos)
- : name(mir_tstrdup(pname)), position(pos)
+ : name(mir_wstrdup(pname)), position(pos)
{
}
@@ -51,9 +51,9 @@ static wchar_t* PrepareGroupName(wchar_t* str)
{
wchar_t* p = wcschr(str, '&'), *d;
if (p == NULL)
- return mir_tstrdup(str);
+ return mir_wstrdup(str);
- d = p = (wchar_t*)mir_alloc(sizeof(wchar_t)*(2 * mir_tstrlen(str) + 1));
+ d = p = (wchar_t*)mir_alloc(sizeof(wchar_t)*(2 * mir_wstrlen(str) + 1));
while (*str) {
if (*str == '&')
*d++ = '&';
@@ -92,7 +92,7 @@ static int OnContactMenuBuild(WPARAM wParam, LPARAM)
Menu_RemoveItem((HGENMENU)lphGroupsItems[i]);
lphGroupsItems.destroy();
- ptrT szContactGroup(db_get_tsa(wParam, "CList", "Group"));
+ ptrW szContactGroup(db_get_tsa(wParam, "CList", "Group"));
int pos = 1000;
@@ -115,7 +115,7 @@ static int OnContactMenuBuild(WPARAM wParam, LPARAM)
}
for (int i = 0; i < groups.getCount(); i++) {
- bool checked = szContactGroup && !mir_tstrcmp(szContactGroup, groups[i].name);
+ bool checked = szContactGroup && !mir_wstrcmp(szContactGroup, groups[i].name);
AddGroupItem(hMoveToGroupItem, groups[i].name, ++pos, groups[i].position, checked);
}
diff --git a/src/mir_app/src/netlib.cpp b/src/mir_app/src/netlib.cpp
index 44d7282648..0dab252161 100644
--- a/src/mir_app/src/netlib.cpp
+++ b/src/mir_app/src/netlib.cpp
@@ -160,7 +160,7 @@ static INT_PTR NetlibRegisterUser(WPARAM, LPARAM lParam)
}
if (nlu->szDescriptiveName)
- thisUser->user.ptszDescriptiveName = (thisUser->user.flags&NUF_UNICODE ? mir_u2t((WCHAR*)nlu->ptszDescriptiveName) : mir_a2t(nlu->szDescriptiveName));
+ thisUser->user.ptszDescriptiveName = (thisUser->user.flags&NUF_UNICODE ? mir_wstrdup((WCHAR*)nlu->ptszDescriptiveName) : mir_a2u(nlu->szDescriptiveName));
if ((thisUser->user.szSettingsModule = mir_strdup(nlu->szSettingsModule)) == NULL
|| (nlu->szDescriptiveName && thisUser->user.ptszDescriptiveName == NULL)
diff --git a/src/mir_app/src/netlibhttp.cpp b/src/mir_app/src/netlibhttp.cpp
index e641c08209..cc83510207 100644
--- a/src/mir_app/src/netlibhttp.cpp
+++ b/src/mir_app/src/netlibhttp.cpp
@@ -257,12 +257,12 @@ struct HttpSecurityContext
}
if (m_hNtlmSecurity) {
- ptrT szLogin, szPassw;
+ ptrW szLogin, szPassw;
if (nlu->settings.useProxyAuth) {
mir_cslock lck(csNetlibUser);
- szLogin = mir_a2t(nlu->settings.szProxyAuthUser);
- szPassw = mir_a2t(nlu->settings.szProxyAuthPassword);
+ szLogin = mir_a2u(nlu->settings.szProxyAuthUser);
+ szPassw = mir_a2u(nlu->settings.szProxyAuthPassword);
}
szAuthHdr = NtlmCreateResponseFromChallenge(m_hNtlmSecurity, szChallenge, szLogin, szPassw, true, complete);
diff --git a/src/mir_app/src/netliblog.cpp b/src/mir_app/src/netliblog.cpp
index 7afeb86917..7c78bf6561 100644
--- a/src/mir_app/src/netliblog.cpp
+++ b/src/mir_app/src/netliblog.cpp
@@ -64,8 +64,8 @@ static void InitLog()
hLogger = NULL;
}
- ptrT szBuf(db_get_tsa(NULL, "Netlib", "File"));
- if (mir_tstrlen(szBuf)) {
+ ptrW szBuf(db_get_tsa(NULL, "Netlib", "File"));
+ if (mir_wstrlen(szBuf)) {
logOptions.tszUserFile = szBuf.get();
wchar_t path[MAX_PATH];
@@ -160,7 +160,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
GetWindowText(GetWindow((HWND)lParam, GW_HWNDPREV), str, _countof(str));
{
wchar_t filter[200];
- mir_sntprintf(filter, L"%s (*)%c*%c", TranslateT("All files"), 0, 0);
+ mir_snwprintf(filter, L"%s (*)%c*%c", TranslateT("All files"), 0, 0);
OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
@@ -185,7 +185,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
if (LOWORD(wParam) == IDC_RUNATSTARTBROWSE && wcschr(str, ' ') != NULL) {
memmove(str + 1, str, ((_countof(str) - 2) * sizeof(wchar_t)));
str[0] = '"';
- mir_tstrcat(str, L"\"");
+ mir_wstrcat(str, L"\"");
}
SetWindowText(GetWindow((HWND)lParam, GW_HWNDPREV), str);
}
@@ -206,11 +206,11 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
db_set_b(NULL, "Netlib", "ShowLogOptsAtStart", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWTHISDLGATSTART));
GetDlgItemText(hwndDlg, IDC_FILENAME, str, _countof(str));
- logOptions.tszUserFile = rtrimt(str);
+ logOptions.tszUserFile = rtrimw(str);
db_set_ts(NULL, "Netlib", "File", str);
GetDlgItemText(hwndDlg, IDC_PATH, str, _countof(str));
- logOptions.tszFile = rtrimt(str);
+ logOptions.tszFile = rtrimw(str);
db_set_b(NULL, "Netlib", "DumpRecv", logOptions.dumpRecv = IsDlgButtonChecked(hwndDlg, IDC_DUMPRECV));
db_set_b(NULL, "Netlib", "DumpSent", logOptions.dumpSent = IsDlgButtonChecked(hwndDlg, IDC_DUMPSENT));
@@ -515,7 +515,7 @@ void NetlibLogInit(void)
if (db_get_b(NULL, "Netlib", "ShowLogOptsAtStart", 0))
NetlibLogShowOptions();
- ptrT szBuf(db_get_tsa(NULL, "Netlib", "RunAtStart"));
+ ptrW szBuf(db_get_tsa(NULL, "Netlib", "RunAtStart"));
if (szBuf) {
STARTUPINFO si = { sizeof(si) };
PROCESS_INFORMATION pi;
diff --git a/src/mir_app/src/netlibopts.cpp b/src/mir_app/src/netlibopts.cpp
index ffdde641fd..3a3c3512a5 100644
--- a/src/mir_app/src/netlibopts.cpp
+++ b/src/mir_app/src/netlibopts.cpp
@@ -341,7 +341,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
wchar_t str[80];
{
int selectedProxyType = SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_GETCURSEL, 0, 0), 0);
- mir_sntprintf(str, TranslateT("(often %d)"), oftenProxyPorts[selectedProxyType]);
+ mir_snwprintf(str, TranslateT("(often %d)"), oftenProxyPorts[selectedProxyType]);
SetDlgItemText(hwndDlg, IDC_STOFTENPORT, str);
if (IsDlgButtonChecked(hwndDlg, IDC_USEPROXY) != BST_UNCHECKED) {
int enableAuth = 0, enableUser = 0, enablePass = 0, enableServer = 1;
diff --git a/src/mir_app/src/netlibsecurity.cpp b/src/mir_app/src/netlibsecurity.cpp
index 981a2b4dcd..351e9525c7 100644
--- a/src/mir_app/src/netlibsecurity.cpp
+++ b/src/mir_app/src/netlibsecurity.cpp
@@ -77,9 +77,9 @@ HANDLE NetlibInitSecurityProvider(const wchar_t* szProvider, const wchar_t* szPr
{
HANDLE hSecurity = NULL;
- if (mir_tstrcmpi(szProvider, L"Basic") == 0) {
+ if (mir_wstrcmpi(szProvider, L"Basic") == 0) {
NtlmHandleType* hNtlm = (NtlmHandleType*)mir_calloc(sizeof(NtlmHandleType));
- hNtlm->szProvider = mir_tstrdup(szProvider);
+ hNtlm->szProvider = mir_wstrdup(szProvider);
SecInvalidateHandle(&hNtlm->hClientContext);
SecInvalidateHandle(&hNtlm->hClientCredential);
ntlmCnt++;
@@ -90,7 +90,7 @@ HANDLE NetlibInitSecurityProvider(const wchar_t* szProvider, const wchar_t* szPr
mir_cslock lck(csSec);
PSecPkgInfo ntlmSecurityPackageInfo;
- bool isGSSAPI = mir_tstrcmpi(szProvider, L"GSSAPI") == 0;
+ bool isGSSAPI = mir_wstrcmpi(szProvider, L"GSSAPI") == 0;
const wchar_t *szProviderC = isGSSAPI ? L"Kerberos" : szProvider;
SECURITY_STATUS sc = QuerySecurityPackageInfo((LPTSTR)szProviderC, &ntlmSecurityPackageInfo);
if (sc == SEC_E_OK) {
@@ -100,8 +100,8 @@ HANDLE NetlibInitSecurityProvider(const wchar_t* szProvider, const wchar_t* szPr
hNtlm->cbMaxToken = ntlmSecurityPackageInfo->cbMaxToken;
FreeContextBuffer(ntlmSecurityPackageInfo);
- hNtlm->szProvider = mir_tstrdup(szProvider);
- hNtlm->szPrincipal = mir_tstrdup(szPrincipal ? szPrincipal : L"");
+ hNtlm->szProvider = mir_wstrdup(szProvider);
+ hNtlm->szPrincipal = mir_wstrdup(szPrincipal ? szPrincipal : L"");
SecInvalidateHandle(&hNtlm->hClientContext);
SecInvalidateHandle(&hNtlm->hClientCredential);
ntlmCnt++;
@@ -213,8 +213,8 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge,
char *szOutputToken;
NtlmHandleType* hNtlm = (NtlmHandleType*)hSecurity;
- if (mir_tstrcmpi(hNtlm->szProvider, L"Basic")) {
- bool isGSSAPI = mir_tstrcmpi(hNtlm->szProvider, L"GSSAPI") == 0;
+ if (mir_wstrcmpi(hNtlm->szProvider, L"Basic")) {
+ bool isGSSAPI = mir_wstrcmpi(hNtlm->szProvider, L"GSSAPI") == 0;
wchar_t *szProvider = isGSSAPI ? (wchar_t*)L"Kerberos" : hNtlm->szProvider;
bool hasChallenge = szChallenge != NULL && szChallenge[0] != '\0';
if (hasChallenge) {
@@ -251,12 +251,12 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge,
else domainLen /= sizeof(wchar_t);
if (domainLen) {
- size_t newLoginLen = mir_tstrlen(login) + domainLen + 1;
+ size_t newLoginLen = mir_wstrlen(login) + domainLen + 1;
wchar_t *newLogin = (wchar_t*)alloca(newLoginLen * sizeof(wchar_t));
wcsncpy(newLogin, domainName, domainLen);
newLogin[domainLen] = '\\';
- mir_tstrcpy(newLogin + domainLen + 1, login);
+ mir_wstrcpy(newLogin + domainLen + 1, login);
char* szChl = NtlmCreateResponseFromChallenge(hSecurity, NULL, newLogin, psw, http, complete);
mir_free(szChl);
@@ -280,23 +280,23 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge,
const wchar_t* loginName = login;
const wchar_t* domainName = wcschr(login, '\\');
size_t domainLen = 0;
- size_t loginLen = mir_tstrlen(loginName);
+ size_t loginLen = mir_wstrlen(loginName);
if (domainName != NULL) {
loginName = domainName + 1;
- loginLen = mir_tstrlen(loginName);
+ loginLen = mir_wstrlen(loginName);
domainLen = domainName - login;
domainName = login;
}
else if ((domainName = wcschr(login, '@')) != NULL) {
loginName = login;
loginLen = domainName - login;
- domainLen = mir_tstrlen(++domainName);
+ domainLen = mir_wstrlen(++domainName);
}
auth.User = (PWORD)loginName;
auth.UserLength = (ULONG)loginLen;
auth.Password = (PWORD)psw;
- auth.PasswordLength = (ULONG)mir_tstrlen(psw);
+ auth.PasswordLength = (ULONG)mir_wstrlen(psw);
auth.Domain = (PWORD)domainName;
auth.DomainLength = (ULONG)domainLen;
auth.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
@@ -341,8 +341,8 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge,
else {
if (!login || !psw) return NULL;
- char *szLogin = mir_t2a(login);
- char *szPassw = mir_t2a(psw);
+ char *szLogin = mir_u2a(login);
+ char *szPassw = mir_u2a(psw);
size_t authLen = mir_strlen(szLogin) + mir_strlen(szPassw) + 5;
char *szAuth = (char*)alloca(authLen);
@@ -361,7 +361,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge,
if (!http)
return szOutputToken;
- ptrA szProvider(mir_t2a(hNtlm->szProvider));
+ ptrA szProvider(mir_u2a(hNtlm->szProvider));
size_t resLen = mir_strlen(szOutputToken) + mir_strlen(szProvider) + 10;
char *result = (char*)mir_alloc(resLen);
mir_snprintf(result, resLen, "%s %s", szProvider, szOutputToken);
diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp
index 1e1bb4c995..51edc215b1 100644
--- a/src/mir_app/src/newplugins.cpp
+++ b/src/mir_app/src/newplugins.cpp
@@ -35,7 +35,7 @@ extern bool bModulesLoadedFired;
static int sttComparePluginsByName(const pluginEntry* p1, const pluginEntry* p2)
{
- return mir_tstrcmpi(p1->pluginname, p2->pluginname);
+ return mir_wstrcmpi(p1->pluginname, p2->pluginname);
}
LIST<pluginEntry>
@@ -373,7 +373,7 @@ int Plugin_UnloadDyn(pluginEntry *p)
static int valid_library_name(wchar_t *name)
{
wchar_t *dot = wcsrchr(name, '.');
- if (dot != NULL && mir_tstrcmpi(dot + 1, L"dll") == 0)
+ if (dot != NULL && mir_wstrcmpi(dot + 1, L"dll") == 0)
if (dot[4] == 0)
return 1;
@@ -389,7 +389,7 @@ void enumPlugins(SCAN_PLUGINS_CALLBACK cb, WPARAM wParam, LPARAM lParam)
// create the search filter
wchar_t search[MAX_PATH];
- mir_sntprintf(search, L"%s\\Plugins\\*.dll", exe);
+ mir_snwprintf(search, L"%s\\Plugins\\*.dll", exe);
// FFFN will return filenames for things like dot dll+ or dot dllx
WIN32_FIND_DATA ffd;
@@ -413,7 +413,7 @@ pluginEntry* OpenPlugin(wchar_t *tszFileName, wchar_t *dir, wchar_t *path)
pluginList.insert(p);
wchar_t tszFullPath[MAX_PATH];
- mir_sntprintf(tszFullPath, L"%s\\%s\\%s", path, dir, tszFileName);
+ mir_snwprintf(tszFullPath, L"%s\\%s\\%s", path, dir, tszFileName);
// map dll into the memory and check its exports
bool bIsPlugin = false;
@@ -482,7 +482,7 @@ int isPluginOnWhiteList(const wchar_t* pluginname)
int rc = db_get_b(NULL, PLUGINDISABLELIST, _strlwr(_T2A(pluginname)), 0);
if (rc != 0 && askAboutIgnoredPlugins) {
wchar_t buf[256];
- mir_sntprintf(buf, TranslateT("'%s' is disabled, re-enable?"), pluginname);
+ mir_snwprintf(buf, TranslateT("'%s' is disabled, re-enable?"), pluginname);
if (MessageBox(NULL, buf, TranslateT("Re-enable Miranda plugin?"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
SetPluginOnWhiteList(pluginname, 1);
rc = 0;
@@ -506,7 +506,7 @@ bool TryLoadPlugin(pluginEntry *p, bool bDynamic)
if (!(p->pclass & PCLASS_BASICAPI)) {
BASIC_PLUGIN_INFO bpi;
- mir_sntprintf(tszFullPath, L"%s\\%s\\%s", exe, (p->pclass & PCLASS_CORE) ? L"Core" : L"Plugins", p->pluginname);
+ mir_snwprintf(tszFullPath, L"%s\\%s\\%s", exe, (p->pclass & PCLASS_CORE) ? L"Core" : L"Plugins", p->pluginname);
if (!checkAPI(tszFullPath, &bpi, mirandaVersion, CHECKAPI_NONE)) {
p->pclass |= PCLASS_FAILED;
return false;
@@ -565,7 +565,7 @@ bool LoadCorePlugin(MuuidReplacement &mr)
GetModuleFileName(NULL, exe, _countof(exe));
wchar_t *p = wcsrchr(exe, '\\'); if (p) *p = 0;
- mir_sntprintf(tszPlugName, L"%s.dll", mr.stdplugname);
+ mir_snwprintf(tszPlugName, L"%s.dll", mr.stdplugname);
pluginEntry* pPlug = OpenPlugin(tszPlugName, L"Core", exe);
if (pPlug->pclass & PCLASS_FAILED) {
LBL_Error:
@@ -623,14 +623,14 @@ static pluginEntry* getCListModule(wchar_t *exe)
if (!isPluginOnWhiteList(p->pluginname))
continue;
- mir_sntprintf(tszFullPath, L"%s\\Plugins\\%s", exe, p->pluginname);
+ mir_snwprintf(tszFullPath, L"%s\\Plugins\\%s", exe, p->pluginname);
if (loadClistModule(tszFullPath, p))
return p;
}
MuuidReplacement& stdClist = pluginDefault[10];
if (LoadCorePlugin(stdClist)) {
- mir_sntprintf(tszFullPath, L"%s\\Core\\%s.dll", exe, stdClist.stdplugname);
+ mir_snwprintf(tszFullPath, L"%s\\Core\\%s.dll", exe, stdClist.stdplugname);
if (loadClistModule(tszFullPath, stdClist.pImpl))
return stdClist.pImpl;
}
@@ -642,7 +642,7 @@ int UnloadPlugin(wchar_t* buf, int bufLen)
{
for (int i = pluginList.getCount() - 1; i >= 0; i--) {
pluginEntry *p = pluginList[i];
- if (!mir_tstrcmpi(p->pluginname, buf)) {
+ if (!mir_wstrcmpi(p->pluginname, buf)) {
GetModuleFileName(p->bpi.hInst, buf, bufLen);
Plugin_Uninit(p);
return TRUE;
@@ -686,7 +686,7 @@ int LoadDefaultServiceModePlugin()
if (param == NULL || *param == 0)
return SERVICE_CONTINUE;
- size_t cbLen = mir_tstrlen(param);
+ size_t cbLen = mir_wstrlen(param);
for (int i = 0; i < servicePlugins.getCount(); i++) {
pluginEntry *p = servicePlugins[i];
if (!wcsnicmp(p->pluginname, param, cbLen)) {
@@ -709,7 +709,7 @@ void EnsureCheckerLoaded(bool bEnable)
{
for (int i = 0; i < pluginList.getCount(); i++) {
pluginEntry *p = pluginList[i];
- if (mir_tstrcmpi(p->pluginname, L"dbchecker.dll"))
+ if (mir_wstrcmpi(p->pluginname, L"dbchecker.dll"))
continue;
if (bEnable) {
@@ -789,7 +789,7 @@ int LoadNewPluginsModule(void)
// if freeimage is present, load it to provide the basic core functions
if (plugin_freeimg != NULL) {
BASIC_PLUGIN_INFO bpi;
- mir_sntprintf(fullPath, L"%s\\Plugins\\%s", exe, plugin_freeimg->pluginname);
+ mir_snwprintf(fullPath, L"%s\\Plugins\\%s", exe, plugin_freeimg->pluginname);
if (checkAPI(fullPath, &bpi, mirandaVersion, CHECKAPI_NONE)) {
plugin_freeimg->bpi = bpi;
plugin_freeimg->pclass |= PCLASS_OK | PCLASS_BASICAPI;
@@ -838,12 +838,12 @@ static BOOL scanPluginsDir(WIN32_FIND_DATA *fd, wchar_t *path, WPARAM, LPARAM)
{
pluginEntry *p = OpenPlugin(fd->cFileName, L"Plugins", path);
if (!(p->pclass & PCLASS_FAILED)) {
- if (plugin_freeimg == NULL && mir_tstrcmpi(fd->cFileName, L"advaimg.dll") == 0) {
+ if (plugin_freeimg == NULL && mir_wstrcmpi(fd->cFileName, L"advaimg.dll") == 0) {
plugin_freeimg = p;
p->pclass |= PCLASS_LAST;
}
- if (plugin_crshdmp == NULL && mir_tstrcmpi(fd->cFileName, L"crashdumper.dll") == 0) {
+ if (plugin_crshdmp == NULL && mir_wstrcmpi(fd->cFileName, L"crashdumper.dll") == 0) {
plugin_crshdmp = p;
p->pclass |= PCLASS_LAST;
}
diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp
index f26424a933..556fb50687 100644
--- a/src/mir_app/src/options.cpp
+++ b/src/mir_app/src/options.cpp
@@ -92,19 +92,19 @@ struct OptionsPageData : public MZeroedObject
hLangpack = src->hLangpack;
if (src->flags & ODPF_UNICODE)
- ptszTitle = mir_tstrdup(src->pwszTitle);
+ ptszTitle = mir_wstrdup(src->pwszTitle);
else
- ptszTitle = mir_a2t(src->pszTitle);
+ ptszTitle = mir_a2u(src->pszTitle);
if (src->flags & ODPF_UNICODE)
- ptszGroup = mir_tstrdup(src->pwszGroup);
+ ptszGroup = mir_wstrdup(src->pwszGroup);
else
- ptszGroup = mir_a2t(src->pszGroup);
+ ptszGroup = mir_a2u(src->pszGroup);
if (src->flags & ODPF_UNICODE)
- ptszTab = mir_tstrdup(src->pwszTab);
+ ptszTab = mir_wstrdup(src->pwszTab);
else
- ptszTab = mir_a2t(src->pszTab);
+ ptszTab = mir_a2u(src->pszTab);
}
~OptionsPageData()
@@ -164,7 +164,7 @@ HTREEITEM FindNamedTreeItemAtRoot(HWND hwndTree, const wchar_t* name)
tvi.hItem = TreeView_GetRoot(hwndTree);
while (tvi.hItem != NULL) {
SendMessage(hwndTree, TVM_GETITEM, 0, (LPARAM)&tvi);
- if (!mir_tstrcmpi(str, name))
+ if (!mir_wstrcmpi(str, name))
return tvi.hItem;
tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
@@ -182,7 +182,7 @@ static HTREEITEM FindNamedTreeItemAtChildren(HWND hwndTree, HTREEITEM hItem, con
tvi.hItem = TreeView_GetChild(hwndTree, hItem);
while (tvi.hItem != NULL) {
SendMessage(hwndTree, TVM_GETITEM, 0, (LPARAM)&tvi);
- if (!mir_tstrcmpi(str, name))
+ if (!mir_wstrcmpi(str, name))
return tvi.hItem;
tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
@@ -195,7 +195,7 @@ static BOOL CALLBACK BoldGroupTitlesEnumChildren(HWND hwnd, LPARAM lParam)
wchar_t szClass[64];
GetClassName(hwnd, szClass, _countof(szClass));
- if (!mir_tstrcmp(szClass, L"Button") && (GetWindowLongPtr(hwnd, GWL_STYLE) & 0x0F) == BS_GROUPBOX)
+ if (!mir_wstrcmp(szClass, L"Button") && (GetWindowLongPtr(hwnd, GWL_STYLE) & 0x0F) == BS_GROUPBOX)
SendMessage(hwnd, WM_SETFONT, lParam, 0);
return TRUE;
}
@@ -299,9 +299,9 @@ static LRESULT CALLBACK OptionsFilterSubclassProc(HWND hWnd, UINT message, WPARA
wchar_t buf[255];
if (bSearchState == 1 && FilterLoadProgress < 100 && FilterLoadProgress > 0)
- mir_sntprintf(buf, TranslateT("Loading... %d%%"), FilterLoadProgress);
+ mir_snwprintf(buf, TranslateT("Loading... %d%%"), FilterLoadProgress);
else
- mir_sntprintf(buf, TranslateT("Search"));
+ mir_snwprintf(buf, TranslateT("Search"));
bool bDrawnByTheme = false;
@@ -507,9 +507,9 @@ static void FillFilterCombo(HWND hDlg, OptionsDlgData* dat)
wchar_t tszModuleName[MAX_PATH];
GetModuleFileName(inst, tszModuleName, _countof(tszModuleName));
- wchar_t *dllName = mir_a2t(GetPluginNameByInstance(inst));
- if (!dllName) dllName = mir_tstrdup(wcsrchr(tszModuleName, '\\'));
- if (!dllName) dllName = mir_tstrdup(tszModuleName);
+ wchar_t *dllName = mir_a2u(GetPluginNameByInstance(inst));
+ if (!dllName) dllName = mir_wstrdup(wcsrchr(tszModuleName, '\\'));
+ if (!dllName) dllName = mir_wstrdup(tszModuleName);
if (dllName) {
index = SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT)CB_ADDSTRING, 0, (LPARAM)dllName);
SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT)CB_SETITEMDATA, (WPARAM)index, (LPARAM)inst);
@@ -527,12 +527,12 @@ static void RebuildPageTree(HWND hdlg, OptionsDlgData *dat)
// if filter string is set to all modules then make the filter string empty (this will return all modules)
BOOL bRemoveFocusFromFilter = FALSE;
- if (mir_tstrcmp(dat->szFilterString, ALL_MODULES_FILTER) == 0) {
+ if (mir_wstrcmp(dat->szFilterString, ALL_MODULES_FILTER) == 0) {
dat->szFilterString[0] = 0;
bRemoveFocusFromFilter = TRUE;
}
// if filter string is set to core modules replace it with the name of the executable (this will return all core modules)
- else if (mir_tstrcmp(dat->szFilterString, CORE_MODULES_FILTER) == 0) {
+ else if (mir_wstrcmp(dat->szFilterString, CORE_MODULES_FILTER) == 0) {
// replace string with process name - that will show core settings
wchar_t szFileName[300];
GetModuleFileName(g_hInst, szFileName, _countof(szFileName));
@@ -695,7 +695,7 @@ static BOOL IsInsideTab(HWND hdlg, OptionsDlgData *dat, int i)
for (int j = 0; j < dat->arOpd.getCount() && pages < 2; j++) {
OptionsPageData* opd2 = dat->arOpd[j];
if (!CheckPageShow(hdlg, dat, j)) continue;
- if (mir_tstrcmp(opd2->ptszTitle, opd->ptszTitle) || mir_tstrcmp(opd2->ptszGroup, opd->ptszGroup))
+ if (mir_wstrcmp(opd2->ptszTitle, opd->ptszTitle) || mir_wstrcmp(opd2->ptszGroup, opd->ptszGroup))
continue;
pages++;
}
@@ -795,7 +795,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L
dat->hPluginUnload = HookEventMessage(ME_SYSTEM_MODULEUNLOAD, hdlg, HM_MODULEUNLOAD);
dat->currentPage = -1;
- ptrT lastPage, lastGroup, lastTab;
+ ptrW lastPage, lastGroup, lastTab;
OPENOPTIONSDIALOG *ood = (OPENOPTIONSDIALOG*)psh->pStartPage;
if (ood->pszPage == NULL) {
lastPage = db_get_tsa(NULL, "Options", "LastPage");
@@ -803,17 +803,17 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L
if (ood->pszGroup == NULL)
lastGroup = db_get_tsa(NULL, "Options", "LastGroup");
else
- lastGroup = mir_a2t(ood->pszGroup);
+ lastGroup = mir_a2u(ood->pszGroup);
}
else {
- lastPage = mir_a2t(ood->pszPage);
- lastGroup = mir_a2t(ood->pszGroup);
+ lastPage = mir_a2u(ood->pszPage);
+ lastGroup = mir_a2u(ood->pszGroup);
}
if (ood->pszTab == NULL)
lastTab = db_get_tsa(NULL, "Options", "LastTab");
else
- lastTab = mir_a2t(ood->pszTab);
+ lastTab = mir_a2u(ood->pszTab);
OPTIONSDIALOGPAGE *odp = (OPTIONSDIALOGPAGE*)psh->ppsp;
for (UINT i = 0; i < psh->nPages; i++, odp++) {
@@ -823,8 +823,8 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L
else
dat->arOpd.insert(opd);
- if (!mir_tstrcmp(lastPage, odp->pwszTitle) && !mir_tstrcmp(lastGroup, odp->pwszGroup))
- if ((ood->pszTab == NULL && dat->currentPage == -1) || !mir_tstrcmp(lastTab, odp->pwszTab))
+ if (!mir_wstrcmp(lastPage, odp->pwszTitle) && !mir_wstrcmp(lastGroup, odp->pwszGroup))
+ if ((ood->pszTab == NULL && dat->currentPage == -1) || !mir_wstrcmp(lastTab, odp->pwszTab))
dat->currentPage = (int)i;
}
@@ -976,13 +976,13 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L
continue;
OptionsPageData *p = dat->arOpd[i];
- if (mir_tstrcmp(opd->ptszTitle, p->ptszTitle) || mir_tstrcmp(opd->ptszGroup, p->ptszGroup))
+ if (mir_wstrcmp(opd->ptszTitle, p->ptszTitle) || mir_wstrcmp(opd->ptszGroup, p->ptszGroup))
continue;
tie.pszText = TranslateTH(p->hLangpack, p->ptszTab);
tie.lParam = i;
TabCtrl_InsertItem(hwndTab, pages, &tie);
- if (!mir_tstrcmp(opd->ptszTab, p->ptszTab))
+ if (!mir_wstrcmp(opd->ptszTab, p->ptszTab))
sel = pages;
pages++;
}
@@ -1148,11 +1148,11 @@ void OpenAccountOptions(PROTOACCOUNT *pa)
return;
wchar_t tszTitle[100];
- mir_sntprintf(tszTitle, TranslateT("%s options"), pa->tszAccountName);
+ mir_snwprintf(tszTitle, TranslateT("%s options"), pa->tszAccountName);
OPENOPTIONSDIALOG ood = { sizeof(ood) };
ood.pszGroup = LPGEN("Network");
- ood.pszPage = mir_t2a(pa->tszAccountName);
+ ood.pszPage = mir_u2a(pa->tszAccountName);
PROPSHEETHEADER psh = { sizeof(psh) };
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW;
@@ -1172,10 +1172,10 @@ static void OpenOptionsNow(int _hLang, const char *pszGroup, const char *pszPage
ShowWindow(hwndOptions, SW_RESTORE);
SetForegroundWindow(hwndOptions);
if (pszPage != NULL) {
- ptrT ptszPage(mir_a2t(pszPage));
+ ptrW ptszPage(mir_a2u(pszPage));
HTREEITEM hItem = NULL;
if (pszGroup != NULL) {
- ptrT ptszGroup(mir_a2t(pszGroup));
+ ptrW ptszGroup(mir_a2u(pszGroup));
hItem = FindNamedTreeItemAtRoot(GetDlgItem(hwndOptions, IDC_PAGETREE), TranslateTH(_hLang, ptszGroup));
if (hItem != NULL)
hItem = FindNamedTreeItemAtChildren(GetDlgItem(hwndOptions, IDC_PAGETREE), hItem, TranslateTH(_hLang, ptszPage));
@@ -1267,7 +1267,7 @@ static INT_PTR AddOptionsPage(WPARAM wParam, LPARAM lParam)
if (odp->flags & ODPF_UNICODE)
dst->pwszGroup = mir_wstrdup(odp->pwszGroup);
else {
- dst->pwszGroup = mir_a2t(odp->pszGroup);
+ dst->pwszGroup = mir_a2u(odp->pszGroup);
dst->flags |= ODPF_UNICODE;
}
}
@@ -1276,7 +1276,7 @@ static INT_PTR AddOptionsPage(WPARAM wParam, LPARAM lParam)
if (odp->flags & ODPF_UNICODE)
dst->pwszTab = mir_wstrdup(odp->pwszTab);
else {
- dst->pwszTab = mir_a2t(odp->pszTab);
+ dst->pwszTab = mir_a2u(odp->pszTab);
dst->flags |= ODPF_UNICODE;
}
}
diff --git a/src/mir_app/src/path.cpp b/src/mir_app/src/path.cpp
index c7dd2d468d..cc1986da61 100644
--- a/src/mir_app/src/path.cpp
+++ b/src/mir_app/src/path.cpp
@@ -57,13 +57,13 @@ static __forceinline char *mir_a2x(const char*, const char *s) { return mir_strd
static __forceinline char *GetContactNickX(const char*, MCONTACT hContact)
{
- return mir_t2a(cli.pfnGetContactDisplayName(hContact, 0));
+ return mir_u2a(cli.pfnGetContactDisplayName(hContact, 0));
}
static __forceinline char *GetContactIDX(const char*, MCONTACT hContact)
{
wchar_t *id = GetContactID(hContact);
- char* res = mir_t2a(id);
+ char* res = mir_u2a(id);
mir_free(id);
return res;
}
@@ -78,7 +78,7 @@ static __forceinline char *GetEnvironmentVariableX(const char *variable)
static __forceinline char *GetProfileDirX(const char*)
{
- return mir_t2a(g_profileDir);
+ return mir_u2a(g_profileDir);
}
static __forceinline char *SHGetSpecialFolderPathX(int iCSIDL, char*)
@@ -109,7 +109,7 @@ static __forceinline char *GetUserNameX(const char*)
static __forceinline char *GetProfileNameX(const char*)
{
- return mir_t2a(g_shortProfileName);
+ return mir_u2a(g_shortProfileName);
}
static __forceinline char* GetPathVarX(const char*, int code)
@@ -121,13 +121,13 @@ static __forceinline char* GetPathVarX(const char*, int code)
if (hAvatarFolder != NULL)
wcsncpy_s(szFullPath, tszAvatarRoot, _TRUNCATE);
else
- mir_sntprintf(szFullPath, L"%s\\%s\\AvatarCache", g_profileDir, g_shortProfileName);
+ mir_snwprintf(szFullPath, L"%s\\%s\\AvatarCache", g_profileDir, g_shortProfileName);
break;
case 2:
- mir_sntprintf(szFullPath, L"%s\\%s\\Logs", g_profileDir, g_shortProfileName);
+ mir_snwprintf(szFullPath, L"%s\\%s\\Logs", g_profileDir, g_shortProfileName);
break;
case 3:
- mir_sntprintf(szFullPath, L"%s\\%s", g_profileDir, g_shortProfileName);
+ mir_snwprintf(szFullPath, L"%s\\%s", g_profileDir, g_shortProfileName);
break;
}
return makeFileName(szFullPath);
@@ -140,11 +140,11 @@ static __forceinline wchar_t* _xcscpy(wchar_t *s1, const wchar_t *s2) { return w
static __forceinline wchar_t* _xcsncpy(wchar_t *s1, const wchar_t *s2, size_t n) { return wcsncpy(s1, s2, n); }
static __forceinline const wchar_t* _xstrselect(const wchar_t*, const char*, const wchar_t *s2) { return s2; }
static __forceinline wchar_t* _itox(wchar_t *, int a) { return _itow(a, (wchar_t *)mir_alloc(sizeof(wchar_t)*20), 10); }
-static __forceinline wchar_t* mir_a2x(const wchar_t *, const char *s) { return mir_a2t(s); }
+static __forceinline wchar_t* mir_a2x(const wchar_t *, const char *s) { return mir_a2u(s); }
static __forceinline wchar_t* GetContactNickX(const wchar_t*, MCONTACT hContact)
{
- return mir_tstrdup(cli.pfnGetContactDisplayName(hContact, 0));
+ return mir_wstrdup(cli.pfnGetContactDisplayName(hContact, 0));
}
static __forceinline wchar_t* GetContactIDX(const wchar_t*, MCONTACT hContact)
@@ -156,7 +156,7 @@ static __forceinline wchar_t* GetEnvironmentVariableX(const wchar_t *variable)
{
wchar_t result[512];
if (GetEnvironmentVariable(variable, result, _countof(result)))
- return mir_tstrdup(result);
+ return mir_wstrdup(result);
return NULL;
}
@@ -164,13 +164,13 @@ static __forceinline wchar_t* SHGetSpecialFolderPathX(int iCSIDL, wchar_t*)
{
wchar_t result[512];
if (SHGetSpecialFolderPath(NULL, result, iCSIDL, FALSE))
- return mir_tstrdup(result);
+ return mir_wstrdup(result);
return NULL;
}
static __forceinline wchar_t* GetProfileDirX(const wchar_t*)
{
- return mir_tstrdup(g_profileDir);
+ return mir_wstrdup(g_profileDir);
}
static __forceinline wchar_t* GetModulePathX(const wchar_t*, HMODULE hModule)
@@ -179,7 +179,7 @@ static __forceinline wchar_t* GetModulePathX(const wchar_t*, HMODULE hModule)
GetModuleFileName(hModule, result, _countof(result));
wchar_t* str = wcsrchr(result, '\\');
if (str) *str = 0;
- return mir_tstrdup(result);
+ return mir_wstrdup(result);
}
static __forceinline wchar_t* GetUserNameX(const wchar_t*)
@@ -187,13 +187,13 @@ static __forceinline wchar_t* GetUserNameX(const wchar_t*)
wchar_t result[128];
DWORD size = _countof(result);
if (GetUserName(result, &size))
- return mir_tstrdup(result);
+ return mir_wstrdup(result);
return NULL;
}
static __forceinline wchar_t* GetProfileNameX(const wchar_t*)
{
- return mir_tstrdup(g_shortProfileName);
+ return mir_wstrdup(g_shortProfileName);
}
static __forceinline wchar_t* GetPathVarX(const wchar_t*, int code)
@@ -205,16 +205,16 @@ static __forceinline wchar_t* GetPathVarX(const wchar_t*, int code)
if (hAvatarFolder != NULL)
wcsncpy_s(szFullPath, tszAvatarRoot, _TRUNCATE);
else
- mir_sntprintf(szFullPath, L"%s\\%s\\AvatarCache", g_profileDir, g_shortProfileName);
+ mir_snwprintf(szFullPath, L"%s\\%s\\AvatarCache", g_profileDir, g_shortProfileName);
break;
case 2:
- mir_sntprintf(szFullPath, L"%s\\%s\\Logs", g_profileDir, g_shortProfileName);
+ mir_snwprintf(szFullPath, L"%s\\%s\\Logs", g_profileDir, g_shortProfileName);
break;
case 3:
- mir_sntprintf(szFullPath, L"%s\\%s", g_profileDir, g_shortProfileName);
+ mir_snwprintf(szFullPath, L"%s\\%s", g_profileDir, g_shortProfileName);
break;
}
- return mir_tstrdup(szFullPath);
+ return mir_wstrdup(szFullPath);
}
template<typename XCHAR>
@@ -364,7 +364,7 @@ MIR_APP_DLL(wchar_t*) Utils_ReplaceVarsW(const wchar_t *wszData, MCONTACT hConta
static int OnFoldersChanged(WPARAM, LPARAM)
{
- mir_sntprintf(tszAvatarRoot, L"%s\\%s\\AvatarCache", g_profileDir, g_shortProfileName);
+ mir_snwprintf(tszAvatarRoot, L"%s\\%s\\AvatarCache", g_profileDir, g_shortProfileName);
wchar_t tmpVar[MAX_PATH];
if (!FoldersGetCustomPathT(hAvatarFolder, tmpVar, _countof(tmpVar), tszAvatarRoot))
@@ -374,7 +374,7 @@ static int OnFoldersChanged(WPARAM, LPARAM)
void InitPathVar()
{
- mir_sntprintf(tszAvatarRoot, L"%s\\%s\\AvatarCache", g_profileDir, g_shortProfileName);
+ mir_snwprintf(tszAvatarRoot, L"%s\\%s\\AvatarCache", g_profileDir, g_shortProfileName);
if (hAvatarFolder = FoldersRegisterCustomPathT( LPGEN("Avatars"), LPGEN("Avatars root folder"), tszAvatarRoot)) {
wchar_t tmpVar[MAX_PATH];
if (!FoldersGetCustomPathT(hAvatarFolder, tmpVar, _countof(tmpVar), tszAvatarRoot))
diff --git a/src/mir_app/src/pluginopts.cpp b/src/mir_app/src/pluginopts.cpp
index 757a0318c1..cc4e3132b5 100644
--- a/src/mir_app/src/pluginopts.cpp
+++ b/src/mir_app/src/pluginopts.cpp
@@ -53,7 +53,7 @@ struct PluginListItemData
static int sttSortPlugins(const PluginListItemData *p1, const PluginListItemData *p2)
{
- return mir_tstrcmp(p1->fileName, p2->fileName);
+ return mir_wstrcmp(p1->fileName, p2->fileName);
}
static LIST<PluginListItemData> arPluginList(10, sttSortPlugins);
@@ -61,7 +61,7 @@ static LIST<PluginListItemData> arPluginList(10, sttSortPlugins);
static BOOL dialogListPlugins(WIN32_FIND_DATA *fd, wchar_t *path, WPARAM, LPARAM lParam)
{
wchar_t buf[MAX_PATH];
- mir_sntprintf(buf, L"%s\\Plugins\\%s", path, fd->cFileName);
+ mir_snwprintf(buf, L"%s\\Plugins\\%s", path, fd->cFileName);
HINSTANCE hInst = GetModuleHandle(buf);
BASIC_PLUGIN_INFO pi;
@@ -121,7 +121,7 @@ static BOOL dialogListPlugins(WIN32_FIND_DATA *fd, wchar_t *path, WPARAM, LPARAM
else
memset(&dat->uuid, 0, sizeof(dat->uuid));
- wchar_t *shortNameT = mir_a2t(pi.pluginInfo->shortName);
+ wchar_t *shortNameT = mir_a2u(pi.pluginInfo->shortName);
// column 3: plugin short name
if (shortNameT) {
ListView_SetItemText(hwndList, iRow, 2, shortNameT);
@@ -136,12 +136,12 @@ static BOOL dialogListPlugins(WIN32_FIND_DATA *fd, wchar_t *path, WPARAM, LPARAM
void *pVerInfo = mir_alloc(verInfoSize);
GetFileVersionInfo(buf, 0, verInfoSize, pVerInfo);
VerQueryValue(pVerInfo, L"\\", (LPVOID*)&fi, &blockSize);
- mir_sntprintf(buf, L"%d.%d.%d.%d", HIWORD(fi->dwProductVersionMS),
+ mir_snwprintf(buf, L"%d.%d.%d.%d", HIWORD(fi->dwProductVersionMS),
LOWORD(fi->dwProductVersionMS), HIWORD(fi->dwProductVersionLS), LOWORD(fi->dwProductVersionLS));
mir_free(pVerInfo);
}
else
- mir_sntprintf(buf, L"%d.%d.%d.%d", HIBYTE(HIWORD(pi.pluginInfo->version)),
+ mir_snwprintf(buf, L"%d.%d.%d.%d", HIBYTE(HIWORD(pi.pluginInfo->version)),
LOBYTE(HIWORD(pi.pluginInfo->version)), HIBYTE(LOWORD(pi.pluginInfo->version)),
LOBYTE(LOWORD(pi.pluginInfo->version)));
@@ -299,15 +299,15 @@ static LRESULT CALLBACK PluginListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LP
static int CALLBACK SortPlugins(WPARAM i1, LPARAM i2, LPARAM)
{
PluginListItemData *p1 = (PluginListItemData*)i1, *p2 = (PluginListItemData*)i2;
- return mir_tstrcmp(p1->fileName, p2->fileName);
+ return mir_wstrcmp(p1->fileName, p2->fileName);
}
static wchar_t *latin2t(const char *p)
{
if (p == NULL)
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
- return mir_a2t_cp(p, 1250);
+ return mir_a2u_cp(p, 1250);
}
INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -427,19 +427,19 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
ListView_GetItemText(hwndList, hdr->iItem, 2, buf, _countof(buf));
SetDlgItemText(hwndDlg, IDC_PLUGININFOFRAME, sel ? buf : L"");
- ptrT tszAuthor(latin2t(sel ? dat->author : NULL));
+ ptrW tszAuthor(latin2t(sel ? dat->author : NULL));
SetDlgItemText(hwndDlg, IDC_PLUGINAUTHOR, tszAuthor);
- ptrT tszEmail(latin2t(sel ? dat->authorEmail : NULL));
+ ptrW tszEmail(latin2t(sel ? dat->authorEmail : NULL));
SetDlgItemText(hwndDlg, IDC_PLUGINEMAIL, tszEmail);
- ptrT p(Langpack_PcharToTchar(dat->description));
+ ptrW p(Langpack_PcharToTchar(dat->description));
SetDlgItemText(hwndDlg, IDC_PLUGINLONGINFO, sel ? p.get() : L"");
- ptrT tszCopyright(latin2t(sel ? dat->copyright : NULL));
+ ptrW tszCopyright(latin2t(sel ? dat->copyright : NULL));
SetDlgItemText(hwndDlg, IDC_PLUGINCPYR, tszCopyright);
- ptrT tszUrl(latin2t(sel ? dat->homepage : NULL));
+ ptrW tszUrl(latin2t(sel ? dat->homepage : NULL));
SetDlgItemText(hwndDlg, IDC_PLUGINURL, tszUrl);
if (dat->uuid != miid_last) {
@@ -455,7 +455,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
if (hdr->hdr.code == PSN_APPLY) {
bool needRestart = false;
wchar_t bufRestart[1024];
- int bufLen = mir_sntprintf(bufRestart, L"%s\n", TranslateT("Miranda NG must be restarted to apply changes for these plugins:"));
+ int bufLen = mir_snwprintf(bufRestart, L"%s\n", TranslateT("Miranda NG must be restarted to apply changes for these plugins:"));
HWND hwndList = GetDlgItem(hwndDlg, IDC_PLUGLIST);
for (int iRow = 0; iRow != -1;) {
@@ -482,7 +482,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
ListView_SetItem(hwndList, &lvi);
}
else {
- bufLen += mir_sntprintf(bufRestart + bufLen, _countof(bufRestart) - bufLen, L" - %s\n", buf);
+ bufLen += mir_snwprintf(bufRestart + bufLen, _countof(bufRestart) - bufLen, L" - %s\n", buf);
needRestart = true;
}
}
@@ -495,7 +495,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
ListView_SetItem(hwndList, &lvi);
}
else {
- bufLen += mir_sntprintf(bufRestart + bufLen, _countof(bufRestart) - bufLen, L" - %s\n", buf);
+ bufLen += mir_snwprintf(bufRestart + bufLen, _countof(bufRestart) - bufLen, L" - %s\n", buf);
needRestart = true;
}
}
@@ -509,7 +509,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
ShowWindow(GetDlgItem(hwndDlg, IDC_RESTART), needRestart);
if (needRestart) {
- mir_sntprintf(bufRestart + bufLen, _countof(bufRestart) - bufLen, L"\n%s", TranslateT("Do you want to restart it now?"));
+ mir_snwprintf(bufRestart + bufLen, _countof(bufRestart) - bufLen, L"\n%s", TranslateT("Do you want to restart it now?"));
if (MessageBox(hwndDlg, bufRestart, L"Miranda NG", MB_ICONWARNING | MB_YESNO) == IDYES)
CallService(MS_SYSTEM_RESTART, 1, 0);
}
diff --git a/src/mir_app/src/profilemanager.cpp b/src/mir_app/src/profilemanager.cpp
index 38465b5165..bac436b91a 100644
--- a/src/mir_app/src/profilemanager.cpp
+++ b/src/mir_app/src/profilemanager.cpp
@@ -46,7 +46,7 @@ static int findProfiles(wchar_t *szProfileDir, ENUMPROFILECALLBACK callback, LPA
{
// find in Miranda NG profile subfolders
wchar_t searchspec[MAX_PATH];
- mir_sntprintf(searchspec, L"%s\\*.*", szProfileDir);
+ mir_snwprintf(searchspec, L"%s\\*.*", szProfileDir);
WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile(searchspec, &ffd);
@@ -55,11 +55,11 @@ static int findProfiles(wchar_t *szProfileDir, ENUMPROFILECALLBACK callback, LPA
do {
// find all subfolders except "." and ".."
- if ((ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && mir_tstrcmp(ffd.cFileName, L".") && mir_tstrcmp(ffd.cFileName, L"..")) {
+ if ((ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && mir_wstrcmp(ffd.cFileName, L".") && mir_wstrcmp(ffd.cFileName, L"..")) {
wchar_t buf[MAX_PATH], profile[MAX_PATH];
- mir_sntprintf(buf, L"%s\\%s\\%s.dat", szProfileDir, ffd.cFileName, ffd.cFileName);
+ mir_snwprintf(buf, L"%s\\%s\\%s.dat", szProfileDir, ffd.cFileName, ffd.cFileName);
if (_waccess(buf, 0) == 0) {
- mir_sntprintf(profile, L"%s.dat", ffd.cFileName);
+ mir_snwprintf(profile, L"%s.dat", ffd.cFileName);
if (!callback(buf, profile, lParam))
break;
}
@@ -95,7 +95,7 @@ class CCreateProfileDlg : public CDlgBase
if (file) file++;
if (_waccess(profile, 0) == 0) {
// file already exists!
- mir_sntprintf(buf,
+ mir_snwprintf(buf,
TranslateT("The profile '%s' already exists. Do you want to move it to the Recycle Bin?\n\nWARNING: The profile will be deleted if Recycle Bin is disabled.\nWARNING: A profile may contain confidential information and should be properly deleted."),
file);
if (MessageBox(m_hwnd, buf, TranslateT("The profile already exists"), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2) != IDYES)
@@ -106,9 +106,9 @@ class CCreateProfileDlg : public CDlgBase
sf.wFunc = FO_DELETE;
sf.pFrom = buf;
sf.fFlags = FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT | FOF_ALLOWUNDO;
- mir_sntprintf(buf, L"%s\0", profile);
+ mir_snwprintf(buf, L"%s\0", profile);
if (SHFileOperation(&sf) != 0) {
- mir_sntprintf(buf, TranslateT("Couldn't move '%s' to the Recycle Bin. Please select another profile name."), file);
+ mir_snwprintf(buf, TranslateT("Couldn't move '%s' to the Recycle Bin. Please select another profile name."), file);
MessageBox(m_hwnd, buf, TranslateT("Problem moving profile"), MB_ICONINFORMATION | MB_OK);
return 0;
}
@@ -117,7 +117,7 @@ class CCreateProfileDlg : public CDlgBase
// ask the database to create the profile
CreatePathToFileT(profile);
if ((err = link->makeDatabase(profile)) != ERROR_SUCCESS) {
- mir_sntprintf(buf, TranslateT("Unable to create the profile '%s', the error was %x"), file, err);
+ mir_snwprintf(buf, TranslateT("Unable to create the profile '%s', the error was %x"), file, err);
MessageBox(m_hwnd, buf, TranslateT("Problem creating profile"), MB_ICONERROR | MB_OK);
return 0;
}
@@ -212,12 +212,12 @@ public:
if (curSel == -1 || !m_bFocused)
return; // should never happen
- ptrT szName(m_profileName.GetText());
- if (mir_tstrlen(szName) == 0)
+ ptrW szName(m_profileName.GetText());
+ if (mir_wstrlen(szName) == 0)
return;
// profile placed in "profile_name" subfolder
- mir_sntprintf(m_pd->ptszProfile, MAX_PATH, L"%s\\%s\\%s.dat", m_pd->ptszProfileDir, szName, szName);
+ mir_snwprintf(m_pd->ptszProfile, MAX_PATH, L"%s\\%s\\%s.dat", m_pd->ptszProfileDir, szName, szName);
m_pd->newProfile = 1;
m_pd->dblink = (DATABASELINK *)m_driverList.GetItemData(curSel);
@@ -257,7 +257,7 @@ class CChooseProfileDlg : public CDlgBase
bool bFileLocked = true;
wchar_t *p = wcsrchr(profile, '.');
- mir_tstrcpy(sizeBuf, L"0 KB");
+ mir_wstrcpy(sizeBuf, L"0 KB");
if (p != NULL) *p = 0;
LVITEM item = { 0 };
@@ -268,12 +268,12 @@ class CChooseProfileDlg : public CDlgBase
struct _stat statbuf;
if (_wstat(tszFullPath, &statbuf) == 0) {
if (statbuf.st_size > 1000000) {
- mir_sntprintf(sizeBuf, L"%.3lf", (double)statbuf.st_size / 1048576.0);
- mir_tstrcpy(sizeBuf + 5, L" MB");
+ mir_snwprintf(sizeBuf, L"%.3lf", (double)statbuf.st_size / 1048576.0);
+ mir_wstrcpy(sizeBuf + 5, L" MB");
}
else {
- mir_sntprintf(sizeBuf, L"%.3lf", (double)statbuf.st_size / 1024.0);
- mir_tstrcpy(sizeBuf + 5, L" KB");
+ mir_snwprintf(sizeBuf, L"%.3lf", (double)statbuf.st_size / 1024.0);
+ mir_wstrcpy(sizeBuf + 5, L" KB");
}
bFileLocked = !fileExist(tszFullPath);
}
@@ -293,7 +293,7 @@ class CChooseProfileDlg : public CDlgBase
}
int iItem = list.InsertItem(&item);
- if (mir_tstrcmpi(ped->szProfile, tszFullPath) == 0)
+ if (mir_wstrcmpi(ped->szProfile, tszFullPath) == 0)
list.SetItemState(iItem, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
list.SetItemText(iItem, 2, sizeBuf);
@@ -323,7 +323,7 @@ class CChooseProfileDlg : public CDlgBase
if (!m_profileList.GetItem(&item))
return;
- mir_sntprintf(fullName, L"%s\\%s\\%s.dat", m_pd->ptszProfileDir, profile, profile);
+ mir_snwprintf(fullName, L"%s\\%s\\%s.dat", m_pd->ptszProfileDir, profile, profile);
CallService(MS_DB_CHECKPROFILE, (WPARAM)fullName, item.iImage == 2);
}
@@ -342,11 +342,11 @@ class CChooseProfileDlg : public CDlgBase
if (!m_profileList.GetItem(&item))
return;
- mir_sntprintf(profilef, TranslateT("Are you sure you want to remove profile \"%s\"?"), profile);
+ mir_snwprintf(profilef, TranslateT("Are you sure you want to remove profile \"%s\"?"), profile);
if (IDYES != MessageBox(NULL, profilef, L"Miranda NG", MB_YESNO | MB_TASKMODAL | MB_ICONWARNING))
return;
- mir_sntprintf(profilef, L"%s\\%s%c", m_pd->ptszProfileDir, profile, 0);
+ mir_snwprintf(profilef, L"%s\\%s%c", m_pd->ptszProfileDir, profile, 0);
SHFILEOPSTRUCT sf = { 0 };
sf.wFunc = FO_DELETE;
@@ -387,9 +387,9 @@ class CChooseProfileDlg : public CDlgBase
// profile is placed in "profile_name" subfolder
wchar_t tmpPath[MAX_PATH];
- mir_sntprintf(tmpPath, L"%s\\%s.dat", m_pd->ptszProfileDir, profile);
+ mir_snwprintf(tmpPath, L"%s\\%s.dat", m_pd->ptszProfileDir, profile);
if (_waccess(tmpPath, 2))
- mir_sntprintf(m_pd->ptszProfile, MAX_PATH, L"%s\\%s\\%s.dat", m_pd->ptszProfileDir, profile, profile);
+ mir_snwprintf(m_pd->ptszProfile, MAX_PATH, L"%s\\%s\\%s.dat", m_pd->ptszProfileDir, profile, profile);
else
wcsncpy_s(m_pd->ptszProfile, MAX_PATH, tmpPath, _TRUNCATE);
}
@@ -524,9 +524,9 @@ public:
wchar_t profilename[MAX_PATH], tszFullPath[MAX_PATH];
struct _stat statbuf;
m_profileList.GetItemText(pTip->iItem, 0, profilename, _countof(profilename));
- mir_sntprintf(tszFullPath, L"%s\\%s\\%s.dat", m_pd->ptszProfileDir, profilename, profilename);
+ mir_snwprintf(tszFullPath, L"%s\\%s\\%s.dat", m_pd->ptszProfileDir, profilename, profilename);
_wstat(tszFullPath, &statbuf);
- mir_sntprintf(pTip->pszText, pTip->cchTextMax, L"%s\n%s: %s\n%s: %s", tszFullPath, TranslateT("Created"), rtrimt(NEWWSTR_ALLOCA(_wctime(&statbuf.st_ctime))), TranslateT("Modified"), rtrimt(NEWWSTR_ALLOCA(_wctime(&statbuf.st_mtime))));
+ mir_snwprintf(pTip->pszText, pTip->cchTextMax, L"%s\n%s: %s\n%s: %s", tszFullPath, TranslateT("Created"), rtrimw(NEWWSTR_ALLOCA(_wctime(&statbuf.st_ctime))), TranslateT("Modified"), rtrimw(NEWWSTR_ALLOCA(_wctime(&statbuf.st_mtime))));
}
}
diff --git a/src/mir_app/src/proto_accs.cpp b/src/mir_app/src/proto_accs.cpp
index bb2ba40f79..c6fdab3704 100644
--- a/src/mir_app/src/proto_accs.cpp
+++ b/src/mir_app/src/proto_accs.cpp
@@ -52,7 +52,7 @@ static int EnumDbModules(const char *szModuleName, DWORD, LPARAM)
pa->cbSize = sizeof(*pa);
pa->szModuleName = mir_strdup(szModuleName);
pa->szProtoName = szProtoName.detach();
- pa->tszAccountName = mir_a2t(szModuleName);
+ pa->tszAccountName = mir_a2u(szModuleName);
pa->bIsVisible = TRUE;
pa->bIsEnabled = FALSE;
pa->iOrder = accounts.getCount();
@@ -105,7 +105,7 @@ void LoadDbAccounts(void)
}
if (!pa->tszAccountName)
- pa->tszAccountName = mir_a2t(szModuleName);
+ pa->tszAccountName = mir_a2u(szModuleName);
accounts.insert(pa);
}
diff --git a/src/mir_app/src/proto_internal.cpp b/src/mir_app/src/proto_internal.cpp
index d64e64bd97..5e7cd8f76d 100644
--- a/src/mir_app/src/proto_internal.cpp
+++ b/src/mir_app/src/proto_internal.cpp
@@ -81,7 +81,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
if (m_iVersion > 1)
return (int)ProtoCallService(m_szModuleName, PSS_AUTHREQUEST, 0, (LPARAM)&ccs);
- ccs.lParam = (LPARAM)mir_t2a(szMessage);
+ ccs.lParam = (LPARAM)mir_u2a(szMessage);
int res = (int)ProtoCallService(m_szModuleName, PSS_AUTHREQUEST, 0, (LPARAM)&ccs);
mir_free((char*)ccs.lParam);
return res;
@@ -93,7 +93,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
if (m_iVersion > 1)
return (HANDLE)ProtoCallService(m_szModuleName, PSS_FILEALLOW, 0, (LPARAM)&ccs);
- ccs.lParam = (LPARAM)mir_t2a(szPath);
+ ccs.lParam = (LPARAM)mir_u2a(szPath);
HANDLE res = (HANDLE)ProtoCallService(m_szModuleName, PSS_FILEALLOW, 0, (LPARAM)&ccs);
mir_free((char*)ccs.lParam);
return res;
@@ -111,7 +111,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
if (m_iVersion > 1)
return (int)ProtoCallService(m_szModuleName, PSS_FILEDENY, 0, (LPARAM)&ccs);
- ccs.lParam = (LPARAM)mir_t2a(szReason);
+ ccs.lParam = (LPARAM)mir_u2a(szReason);
int res = (int)ProtoCallService(m_szModuleName, PSS_FILEDENY, 0, (LPARAM)&ccs);
mir_free((char*)ccs.lParam);
return res;
@@ -123,7 +123,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
if (m_iVersion > 1)
return (int)ProtoCallService(m_szModuleName, PS_FILERESUME, (WPARAM)hTransfer, (LPARAM)&pfr);
- pfr.szFilename = (wchar_t*)mir_t2a(pfr.szFilename);
+ pfr.szFilename = (wchar_t*)mir_u2a(pfr.szFilename);
int res = (int)ProtoCallService(m_szModuleName, PS_FILERESUME, (WPARAM)hTransfer, (LPARAM)&pfr);
mir_free((wchar_t*)*szFilename);
*action = pfr.action; *szFilename = (wchar_t*)pfr.szFilename;
@@ -165,9 +165,9 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
HANDLE __cdecl SearchByName(const wchar_t* nick, const wchar_t* firstName, const wchar_t* lastName)
{
PROTOSEARCHBYNAME psn;
- psn.pszNick = (wchar_t*)mir_t2a(nick);
- psn.pszFirstName = (wchar_t*)mir_t2a(firstName);
- psn.pszLastName = (wchar_t*)mir_t2a(lastName);
+ psn.pszNick = (wchar_t*)mir_u2a(nick);
+ psn.pszFirstName = (wchar_t*)mir_u2a(firstName);
+ psn.pszLastName = (wchar_t*)mir_u2a(lastName);
HANDLE res = (HANDLE)ProtoCallService(m_szModuleName, PS_SEARCHBYNAME, 0, (LPARAM)&psn);
mir_free(psn.pszNick);
mir_free(psn.pszFirstName);
@@ -223,7 +223,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
if (m_iVersion > 1)
return (HANDLE)ProtoCallService(m_szModuleName, PSS_FILE, 0, (LPARAM)&ccs);
- ccs.wParam = (WPARAM)mir_t2a(szDescription);
+ ccs.wParam = (WPARAM)mir_u2a(szDescription);
ccs.lParam = (LPARAM)Proto_FilesMatrixA(ppszFiles);
HANDLE res = (HANDLE)ProtoCallService(m_szModuleName, PSS_FILE, 0, (LPARAM)&ccs);
if (res == 0) FreeFilesMatrix((wchar_t***)&ccs.lParam);
@@ -291,7 +291,7 @@ PROTO_INTERFACE* AddDefaultAccount(const char *szProtoName)
{
PROTO_INTERFACE* ppi = new DEFAULT_PROTO_INTERFACE;
ppi->m_szModuleName = mir_strdup(szProtoName);
- ppi->m_tszUserName = mir_a2t(szProtoName);
+ ppi->m_tszUserName = mir_a2u(szProtoName);
return ppi;
}
diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp
index 751af269c0..f056270390 100644
--- a/src/mir_app/src/proto_opts.cpp
+++ b/src/mir_app/src/proto_opts.cpp
@@ -82,7 +82,7 @@ PROTOACCOUNT* Proto_CreateAccount(const char *szModuleName, const char *szBasePr
}
else pa->szModuleName = mir_strdup(szModuleName);
- pa->tszAccountName = mir_tstrdup(tszAccountName);
+ pa->tszAccountName = mir_wstrdup(tszAccountName);
db_set_s(NULL, pa->szModuleName, "AM_BaseProto", szBaseProto);
accounts.insert(pa);
@@ -125,7 +125,7 @@ static bool OnCreateAccount(HWND hwndDlg)
wchar_t tszAccName[256];
GetDlgItemText(hwndDlg, IDC_ACCNAME, tszAccName, _countof(tszAccName));
- rtrimt(tszAccName);
+ rtrimw(tszAccName);
if (tszAccName[0] == 0) {
MessageBox(hwndDlg, TranslateT("Account name must be filled."), TranslateT("Account error"), MB_ICONERROR | MB_OK);
return false;
@@ -143,13 +143,13 @@ static bool OnCreateAccount(HWND hwndDlg)
if (param->action == PRAC_UPGRADED) {
BOOL oldProto = pa->bOldProto;
wchar_t szPlugin[MAX_PATH];
- mir_sntprintf(szPlugin, L"%s.dll", _A2T(pa->szProtoName));
+ mir_snwprintf(szPlugin, L"%s.dll", _A2T(pa->szProtoName));
int idx = accounts.getIndex(pa);
UnloadAccount(pa, false, false);
accounts.remove(idx);
if (oldProto && UnloadPlugin(szPlugin, _countof(szPlugin))) {
wchar_t szNewName[MAX_PATH];
- mir_sntprintf(szNewName, L"%s~", szPlugin);
+ mir_snwprintf(szNewName, L"%s~", szPlugin);
MoveFile(szPlugin, szNewName);
}
param->action = PRAC_ADDED;
@@ -165,7 +165,7 @@ static bool OnCreateAccount(HWND hwndDlg)
pa = Proto_CreateAccount(buf, szBaseProto, tszAccName);
}
- else replaceStrT(pa->tszAccountName, tszAccName);
+ else replaceStrW(pa->tszAccountName, tszAccName);
WriteDbAccounts();
NotifyEventHooks(hAccListChanged, param->action, (LPARAM)pa);
@@ -202,9 +202,9 @@ static INT_PTR CALLBACK AccFormDlgProc(HWND hwndDlg, UINT message, WPARAM wParam
wchar_t str[200];
if (param->action == PRAC_CHANGED) { // update
EnableWindow(GetDlgItem(hwndDlg, IDC_PROTOTYPECOMBO), FALSE);
- mir_sntprintf(str, L"%s: %s", TranslateT("Editing account"), param->pa->tszAccountName);
+ mir_snwprintf(str, L"%s: %s", TranslateT("Editing account"), param->pa->tszAccountName);
}
- else mir_sntprintf(str, L"%s: %s", TranslateT("Upgrading account"), param->pa->tszAccountName);
+ else mir_snwprintf(str, L"%s: %s", TranslateT("Upgrading account"), param->pa->tszAccountName);
SetWindowText(hwndDlg, str);
SetDlgItemText(hwndDlg, IDC_ACCNAME, param->pa->tszAccountName);
@@ -618,24 +618,24 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM
if (lps->itemID == (unsigned)dat->iSelected) {
SelectObject(lps->hDC, dat->hfntText);
- mir_sntprintf(text, size, L"%s: %S", TranslateT("Protocol"), acc->szProtoName);
- length = (int)mir_tstrlen(text);
+ mir_snwprintf(text, size, L"%s: %S", TranslateT("Protocol"), acc->szProtoName);
+ length = (int)mir_wstrlen(text);
DrawText(lps->hDC, text, -1, &lps->rcItem, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
GetTextExtentPoint32(lps->hDC, text, length, &sz);
lps->rcItem.top += sz.cy + 2;
if (acc->ppro && Proto_IsProtocolLoaded(acc->szProtoName)) {
char *szIdName = (char *)acc->ppro->GetCaps(PFLAG_UNIQUEIDTEXT, 0);
- ptrT tszIdName(szIdName ? mir_a2t(szIdName) : mir_tstrdup(TranslateT("Account ID")));
- ptrT tszUniqueID(Contact_GetInfo(CNF_UNIQUEID, NULL, acc->szModuleName));
+ ptrW tszIdName(szIdName ? mir_a2u(szIdName) : mir_wstrdup(TranslateT("Account ID")));
+ ptrW tszUniqueID(Contact_GetInfo(CNF_UNIQUEID, NULL, acc->szModuleName));
if (tszUniqueID != NULL)
- mir_sntprintf(text, size, L"%s: %s", tszIdName, tszUniqueID);
+ mir_snwprintf(text, size, L"%s: %s", tszIdName, tszUniqueID);
else
- mir_sntprintf(text, size, L"%s: %s", tszIdName, TranslateT("<unknown>"));
+ mir_snwprintf(text, size, L"%s: %s", tszIdName, TranslateT("<unknown>"));
}
- else mir_sntprintf(text, size, TranslateT("Protocol is not loaded."));
+ else mir_snwprintf(text, size, TranslateT("Protocol is not loaded."));
- length = (int)mir_tstrlen(text);
+ length = (int)mir_wstrlen(text);
DrawText(lps->hDC, text, -1, &lps->rcItem, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
GetTextExtentPoint32(lps->hDC, text, length, &sz);
lps->rcItem.top += sz.cy + 2;
@@ -771,7 +771,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM
DWORD dwStatus = CallProtoServiceInt(NULL, pa->szModuleName, PS_GETSTATUS, 0, 0);
if (dwStatus >= ID_STATUS_ONLINE) {
wchar_t buf[200];
- mir_sntprintf(buf, TranslateT("Account %s is being disabled"), pa->tszAccountName);
+ mir_snwprintf(buf, TranslateT("Account %s is being disabled"), pa->tszAccountName);
if (IDNO == ::MessageBox(hwndDlg,
TranslateT("Account is online. Disable account?"),
buf, MB_ICONWARNING | MB_DEFBUTTON2 | MB_YESNO)) {
@@ -831,7 +831,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM
if (idx != -1) {
pa = (PROTOACCOUNT*)ListBox_GetItemData(hwndList, idx);
wchar_t buf[200];
- mir_sntprintf(buf, TranslateT("Account %s is being deleted"), pa->tszAccountName);
+ mir_snwprintf(buf, TranslateT("Account %s is being deleted"), pa->tszAccountName);
if (pa->bOldProto) {
MessageBox(hwndDlg, TranslateT("You need to disable plugin to delete this account"), buf, MB_ICONERROR | MB_OK);
break;
@@ -1021,7 +1021,7 @@ static int OnAccListChanged(WPARAM eventCode, LPARAM lParam)
switch (eventCode) {
case PRAC_CHANGED:
if (pa->ppro) {
- replaceStrT(pa->ppro->m_tszUserName, pa->tszAccountName);
+ replaceStrW(pa->ppro->m_tszUserName, pa->tszAccountName);
pa->ppro->OnEvent(EV_PROTO_ONRENAME, 0, lParam);
if (pa->ppro->m_hMainMenuItem)
diff --git a/src/mir_app/src/proto_ui.cpp b/src/mir_app/src/proto_ui.cpp
index 38ee85161b..b3c7f537eb 100644
--- a/src/mir_app/src/proto_ui.cpp
+++ b/src/mir_app/src/proto_ui.cpp
@@ -132,7 +132,7 @@ void CProtoIntDlgBase::UpdateProtoTitle(const wchar_t *szText)
if (szText) {
curText = szText;
- curLength = (int)mir_tstrlen(curText);
+ curLength = (int)mir_wstrlen(curText);
}
else {
curLength = GetWindowTextLength(m_hwnd) + 1;
@@ -142,9 +142,9 @@ void CProtoIntDlgBase::UpdateProtoTitle(const wchar_t *szText)
}
if (!wcsstr(curText, m_proto_interface->m_tszUserName)) {
- size_t length = curLength + mir_tstrlen(m_proto_interface->m_tszUserName) + 256;
+ size_t length = curLength + mir_wstrlen(m_proto_interface->m_tszUserName) + 256;
wchar_t *text = (wchar_t *)_alloca(length * sizeof(wchar_t));
- mir_sntprintf(text, length, L"%s [%s: %s]", curText, TranslateT("Account"), m_proto_interface->m_tszUserName);
+ mir_snwprintf(text, length, L"%s [%s: %s]", curText, TranslateT("Account"), m_proto_interface->m_tszUserName);
SetWindowText(m_hwnd, text);
}
}
@@ -155,7 +155,7 @@ void CProtoIntDlgBase::UpdateStatusBar()
HDC hdc = GetDC(m_hwndStatus);
HFONT hFntSave = (HFONT)SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT));
- GetTextExtentPoint32(hdc, m_proto_interface->m_tszUserName, (int)mir_tstrlen(m_proto_interface->m_tszUserName), &sz);
+ GetTextExtentPoint32(hdc, m_proto_interface->m_tszUserName, (int)mir_wstrlen(m_proto_interface->m_tszUserName), &sz);
sz.cx += GetSystemMetrics(SM_CXSMICON) * 3;
SelectObject(hdc, hFntSave);
ReleaseDC(m_hwndStatus, hdc);
diff --git a/src/mir_app/src/proto_utils.cpp b/src/mir_app/src/proto_utils.cpp
index e91ece4c7e..9689bc973b 100644
--- a/src/mir_app/src/proto_utils.cpp
+++ b/src/mir_app/src/proto_utils.cpp
@@ -84,7 +84,7 @@ MIR_APP_DLL(void) ProtoConstructor(PROTO_INTERFACE *pThis, LPCSTR pszModuleName,
pThis->m_iStatus = pThis->m_iDesiredStatus = ID_STATUS_OFFLINE;
pThis->m_szModuleName = mir_strdup(pszModuleName);
pThis->m_hProtoIcon = IcoLib_IsManaged(Skin_LoadProtoIcon(pszModuleName, ID_STATUS_ONLINE));
- pThis->m_tszUserName = mir_tstrdup(ptszUserName);
+ pThis->m_tszUserName = mir_wstrdup(ptszUserName);
db_set_resident(pThis->m_szModuleName, "Status");
}
diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp
index e06034833e..4f1f1cde42 100644
--- a/src/mir_app/src/protocols.cpp
+++ b/src/mir_app/src/protocols.cpp
@@ -127,7 +127,7 @@ MIR_APP_DLL(int) Proto_RegisterModule(PROTOCOLDESCRIPTOR *pd)
pa->cbSize = sizeof(PROTOACCOUNT);
pa->szModuleName = mir_strdup(pd->szName);
pa->szProtoName = mir_strdup(pd->szName);
- pa->tszAccountName = mir_a2t(pd->szName);
+ pa->tszAccountName = mir_a2u(pd->szName);
pa->bIsVisible = pa->bIsEnabled = true;
pa->iOrder = accounts.getCount();
accounts.insert(pa);
@@ -244,7 +244,7 @@ static INT_PTR Proto_ContactIsTyping(WPARAM wParam, LPARAM lParam)
void Proto_SetStatus(const char *szProto, unsigned status)
{
if (CallProtoServiceInt(NULL, szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) {
- ptrT tszAwayMsg((wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGT, status, (LPARAM)szProto));
+ ptrW tszAwayMsg((wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGT, status, (LPARAM)szProto));
CallProtoServiceInt(NULL, szProto, PS_SETAWAYMSG, status, tszAwayMsg);
}
CallProtoServiceInt(NULL, szProto, PS_SETSTATUS, status, 0);
diff --git a/src/mir_app/src/searchresults.cpp b/src/mir_app/src/searchresults.cpp
index 8db9de005d..571712de7b 100644
--- a/src/mir_app/src/searchresults.cpp
+++ b/src/mir_app/src/searchresults.cpp
@@ -79,7 +79,7 @@ void LoadColumnSizes(HWND hwndResults, const char *szProto)
INT_PTR ret = CallProtoServiceInt(NULL, szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0);
if (ret != CALLSERVICE_NOTFOUND) {
bNeedsFree = true;
- lvc.pszText = mir_a2t((char*)ret);
+ lvc.pszText = mir_a2u((char*)ret);
}
}
}
@@ -139,22 +139,22 @@ int CALLBACK SearchResultsCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lPa
case COLUMNID_PROTO:
return mir_strcmp(lsr1->szProto, lsr2->szProto)*sortMultiplier;
case COLUMNID_HANDLE:
- return mir_tstrcmpi(lsr1->psr.id.w, lsr2->psr.id.w)*sortMultiplier;
+ return mir_wstrcmpi(lsr1->psr.id.w, lsr2->psr.id.w)*sortMultiplier;
case COLUMNID_NICK:
- return mir_tstrcmpi(lsr1->psr.nick.w, lsr2->psr.nick.w)*sortMultiplier;
+ return mir_wstrcmpi(lsr1->psr.nick.w, lsr2->psr.nick.w)*sortMultiplier;
case COLUMNID_FIRST:
- return mir_tstrcmpi(lsr1->psr.firstName.w, lsr2->psr.firstName.w)*sortMultiplier;
+ return mir_wstrcmpi(lsr1->psr.firstName.w, lsr2->psr.firstName.w)*sortMultiplier;
case COLUMNID_LAST:
- return mir_tstrcmpi(lsr1->psr.lastName.w, lsr2->psr.lastName.w)*sortMultiplier;
+ return mir_wstrcmpi(lsr1->psr.lastName.w, lsr2->psr.lastName.w)*sortMultiplier;
case COLUMNID_EMAIL:
- return mir_tstrcmpi(lsr1->psr.email.w, lsr2->psr.email.w)*sortMultiplier;
+ return mir_wstrcmpi(lsr1->psr.email.w, lsr2->psr.email.w)*sortMultiplier;
}
}
else {
wchar_t szText1[100], szText2[100];
ListView_GetItemText(hList, (int)lParam1, sortCol, szText1, _countof(szText1));
ListView_GetItemText(hList, (int)lParam2, sortCol, szText2, _countof(szText2));
- return mir_tstrcmpi(szText1, szText2)*sortMultiplier;
+ return mir_wstrcmpi(szText1, szText2)*sortMultiplier;
}
return 0;
}
@@ -184,12 +184,12 @@ static void BeginSearchFailed(void *arg)
wchar_t buf[128];
if (arg != NULL) {
const wchar_t *protoName = (wchar_t*)arg;
- mir_sntprintf(buf,
+ mir_snwprintf(buf,
TranslateT("Could not start a search on '%s', there was a problem - is %s connected?"),
protoName, protoName);
mir_free((char*)arg);
}
- else mir_tstrncpy(buf, TranslateT("Could not search on any of the protocols, are you online?"), _countof(buf));
+ else mir_wstrncpy(buf, TranslateT("Could not search on any of the protocols, are you online?"), _countof(buf));
MessageBox(0, buf, TranslateT("Problem with search"), MB_OK | MB_ICONERROR);
}
@@ -231,7 +231,7 @@ int BeginSearch(HWND, struct FindAddDlgData *dat, const char *szProto, const cha
if (dat->search[0].hProcess == NULL) {
// infuriatingly vague error message. fixme.
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
- mir_forkthread(BeginSearchFailed, mir_tstrdup(pa->tszAccountName));
+ mir_forkthread(BeginSearchFailed, mir_wstrdup(pa->tszAccountName));
mir_free(dat->search);
dat->search = NULL;
dat->searchCount = 0;
diff --git a/src/mir_app/src/services.cpp b/src/mir_app/src/services.cpp
index 4453ce3c83..fc081a19ce 100644
--- a/src/mir_app/src/services.cpp
+++ b/src/mir_app/src/services.cpp
@@ -142,7 +142,7 @@ int GetFontSettingFromDB(char *settings_group, char *prefix, LOGFONT *lf, COLORR
strncpy_s(idstr, prefix, _TRUNCATE);
int retval = 0;
- ptrT tszGroup(db_get_tsa(NULL, settings_group, idstr));
+ ptrW tszGroup(db_get_tsa(NULL, settings_group, idstr));
if (tszGroup != NULL)
wcsncpy_s(lf->lfFaceName, tszGroup, _TRUNCATE);
else
@@ -245,7 +245,7 @@ static int sttRegisterFontWorker(FontIDW *font_id, int _hLang)
for (int i = 0; i < font_id_list.getCount(); i++) {
FontInternal& F = font_id_list[i];
- if (!mir_tstrcmp(F.group, font_id->group) && !mir_tstrcmp(F.name, font_id->name) && !(F.flags & FIDF_ALLOWREREGISTER))
+ if (!mir_wstrcmp(F.group, font_id->group) && !mir_wstrcmp(F.name, font_id->name) && !(F.flags & FIDF_ALLOWREREGISTER))
return 1;
}
@@ -258,10 +258,10 @@ static int sttRegisterFontWorker(FontIDW *font_id, int _hLang)
memcpy(newItem, font_id, font_id->cbSize);
newItem->hLangpack = _hLang;
- if (!mir_tstrcmp(newItem->deffontsettings.szFace, L"MS Shell Dlg")) {
+ if (!mir_wstrcmp(newItem->deffontsettings.szFace, L"MS Shell Dlg")) {
LOGFONT lf;
SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, FALSE);
- mir_tstrncpy(newItem->deffontsettings.szFace, lf.lfFaceName, _countof(newItem->deffontsettings.szFace));
+ mir_wstrncpy(newItem->deffontsettings.szFace, lf.lfFaceName, _countof(newItem->deffontsettings.szFace));
if (!newItem->deffontsettings.size)
newItem->deffontsettings.size = lf.lfHeight;
}
@@ -353,7 +353,7 @@ static INT_PTR sttRegisterColourWorker(ColourIDW *colour_id, int _hLang)
for (int i = 0; i < colour_id_list.getCount(); i++) {
ColourInternal& C = colour_id_list[i];
- if (!mir_tstrcmp(C.group, colour_id->group) && !mir_tstrcmp(C.name, colour_id->name))
+ if (!mir_wstrcmp(C.group, colour_id->group) && !mir_wstrcmp(C.name, colour_id->name))
return 1;
}
@@ -385,7 +385,7 @@ static INT_PTR sttGetColourWorker(ColourIDW *colour_id)
{
for (int i = 0; i < colour_id_list.getCount(); i++) {
ColourInternal& C = colour_id_list[i];
- if (!mir_tstrcmp(C.group, colour_id->group) && !mir_tstrcmp(C.name, colour_id->name))
+ if (!mir_wstrcmp(C.group, colour_id->group) && !mir_wstrcmp(C.name, colour_id->name))
return db_get_dw(NULL, C.dbSettingsGroup, C.setting, C.defcolour);
}
@@ -445,7 +445,7 @@ static INT_PTR sttRegisterEffectWorker(EffectIDW *effect_id, int _hLang)
for (int i = 0; i < effect_id_list.getCount(); i++) {
EffectInternal& E = effect_id_list[i];
- if (!mir_tstrcmp(E.group, effect_id->group) && !mir_tstrcmp(E.name, effect_id->name))
+ if (!mir_wstrcmp(E.group, effect_id->group) && !mir_wstrcmp(E.name, effect_id->name))
return 1;
}
diff --git a/src/mir_app/src/skin2opts.cpp b/src/mir_app/src/skin2opts.cpp
index feb5795b0d..bfaf0c505e 100644
--- a/src/mir_app/src/skin2opts.cpp
+++ b/src/mir_app/src/skin2opts.cpp
@@ -49,7 +49,7 @@ static HICON ExtractIconFromPath(const wchar_t *path, int cxIcon, int cyIcon)
if (!path)
return (HICON)NULL;
- mir_tstrncpy(file, path, _countof(file));
+ mir_wstrncpy(file, path, _countof(file));
comma = wcsrchr(file, ',');
if (!comma)
n = 0;
@@ -118,8 +118,8 @@ static void __fastcall MySetCursor(wchar_t* nCursor)
static void LoadSectionIcons(wchar_t *filename, SectionItem* sectionActive)
{
wchar_t path[MAX_PATH];
- mir_sntprintf(path, L"%s,", filename);
- size_t suffIndx = mir_tstrlen(path);
+ mir_snwprintf(path, L"%s,", filename);
+ size_t suffIndx = mir_wstrlen(path);
mir_cslock lck(csIconList);
@@ -132,10 +132,10 @@ static void LoadSectionIcons(wchar_t *filename, SectionItem* sectionActive)
if (!hIcon)
continue;
- replaceStrT(item->temp_file, NULL);
+ replaceStrW(item->temp_file, NULL);
SafeDestroyIcon(item->temp_icon);
- item->temp_file = mir_tstrdup(path);
+ item->temp_file = mir_wstrdup(path);
item->temp_icon = hIcon;
item->temp_reset = FALSE;
}
@@ -169,7 +169,7 @@ static void UndoChanges(int iconIndx, int cmd)
if (!item->temp_file && !item->temp_icon && item->temp_reset && cmd == ID_CANCELCHANGE)
item->temp_reset = FALSE;
else {
- replaceStrT(item->temp_file, NULL);
+ replaceStrW(item->temp_file, NULL);
SafeDestroyIcon(item->temp_icon);
}
@@ -228,29 +228,29 @@ static wchar_t* OpenFileDlg(HWND hParent, const wchar_t* szFile, BOOL bAll)
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hParent;
- mir_tstrcpy(filter, TranslateT("Icon sets"));
+ mir_wstrcpy(filter, TranslateT("Icon sets"));
if (bAll)
- mir_tstrcat(filter, L" (*.dll;*.mir;*.icl;*.exe;*.ico)");
+ mir_wstrcat(filter, L" (*.dll;*.mir;*.icl;*.exe;*.ico)");
else
- mir_tstrcat(filter, L" (*.dll;*.mir)");
+ mir_wstrcat(filter, L" (*.dll;*.mir)");
- pfilter = filter + mir_tstrlen(filter) + 1;
+ pfilter = filter + mir_wstrlen(filter) + 1;
if (bAll)
- mir_tstrcpy(pfilter, L"*.DLL;*.MIR;*.ICL;*.EXE;*.ICO");
+ mir_wstrcpy(pfilter, L"*.DLL;*.MIR;*.ICL;*.EXE;*.ICO");
else
- mir_tstrcpy(pfilter, L"*.DLL;*.MIR");
-
- pfilter += mir_tstrlen(pfilter) + 1;
- mir_tstrcpy(pfilter, TranslateT("All files"));
- mir_tstrcat(pfilter, L" (*)");
- pfilter += mir_tstrlen(pfilter) + 1;
- mir_tstrcpy(pfilter, L"*");
- pfilter += mir_tstrlen(pfilter) + 1;
+ mir_wstrcpy(pfilter, L"*.DLL;*.MIR");
+
+ pfilter += mir_wstrlen(pfilter) + 1;
+ mir_wstrcpy(pfilter, TranslateT("All files"));
+ mir_wstrcat(pfilter, L" (*)");
+ pfilter += mir_wstrlen(pfilter) + 1;
+ mir_wstrcpy(pfilter, L"*");
+ pfilter += mir_wstrlen(pfilter) + 1;
*pfilter = '\0';
ofn.lpstrFilter = filter;
ofn.lpstrDefExt = L"dll";
- mir_tstrncpy(file, szFile, _countof(file));
+ mir_wstrncpy(file, szFile, _countof(file));
ofn.lpstrFile = file;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_DONTADDTORECENT;
ofn.nMaxFile = MAX_PATH * 2;
@@ -258,7 +258,7 @@ static wchar_t* OpenFileDlg(HWND hParent, const wchar_t* szFile, BOOL bAll)
if (!GetOpenFileName(&ofn))
return NULL;
- return mir_tstrdup(file);
+ return mir_wstrdup(file);
}
//
@@ -322,7 +322,7 @@ static HTREEITEM FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const wchar
while (tvi.hItem) {
TreeView_GetItem(hwndTree, &tvi);
- if (!mir_tstrcmp(tvi.pszText, name))
+ if (!mir_wstrcmp(tvi.pszText, name))
return tvi.hItem;
tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
@@ -418,7 +418,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
lvi.iItem = 0;
int count = (int)_ExtractIconEx(filename, -1, 16, 16, NULL, LR_DEFAULTCOLOR);
for (int i = 0; i < count; lvi.iItem++, i++) {
- mir_sntprintf(caption, L"%d", i + 1);
+ mir_snwprintf(caption, L"%d", i + 1);
lvi.pszText = caption;
HICON hIcon = NULL;
@@ -520,7 +520,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
lvi.mask = LVIF_PARAM;
lvi.iItem = dragItem; lvi.iSubItem = 0;
ListView_GetItem(hPreview, &lvi);
- mir_sntprintf(path, L"%s,%d", filename, (int)lvi.lParam);
+ mir_snwprintf(path, L"%s,%d", filename, (int)lvi.lParam);
SendMessage(hwndParent, DM_CHANGEICON, dropHiLite, (LPARAM)path);
ListView_SetItemState(GetDlgItem(hwndParent, IDC_PREVIEW), dropHiLite, 0, LVIS_DROPHILITED);
}
@@ -572,7 +572,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
static int CALLBACK DoSortIconsFunc(LPARAM lParam1, LPARAM lParam2, LPARAM)
{
- return mir_tstrcmpi(iconList[lParam1]->getDescr(), iconList[lParam2]->getDescr());
+ return mir_wstrcmpi(iconList[lParam1]->getDescr(), iconList[lParam2]->getDescr());
}
static int CALLBACK DoSortIconsFuncByOrder(LPARAM lParam1, LPARAM lParam2, LPARAM)
@@ -668,7 +668,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
int sectionLevel = 0;
hSection = NULL;
- mir_tstrcpy(itemName, sectionList[indx]->name);
+ mir_wstrcpy(itemName, sectionList[indx]->name);
sectionName = itemName;
while (sectionName) {
@@ -688,7 +688,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
TVINSERTSTRUCT tvis = { 0 };
TreeItem *treeItem = (TreeItem *)mir_alloc(sizeof(TreeItem));
treeItem->value = SECTIONPARAM_MAKE(indx, sectionLevel, sectionName ? 0 : SECTIONPARAM_HAVEPAGE);
- treeItem->paramName = mir_t2a(itemName);
+ treeItem->paramName = mir_u2a(itemName);
tvis.hParent = hSection;
tvis.hInsertAfter = TVI_SORT;
@@ -810,7 +810,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
SafeDestroyIcon(item->temp_icon);
wchar_t *path = (wchar_t*)lParam;
- replaceStrT(item->temp_file, path);
+ replaceStrW(item->temp_file, path);
item->temp_icon = (HICON)ExtractIconFromPath(path, item->cx, item->cy);
item->temp_reset = FALSE;
}
@@ -934,7 +934,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
if (item->temp_file)
wcsncpy_s(pInfoTip->pszText, pInfoTip->cchTextMax, item->temp_file, _TRUNCATE);
else if (item->default_file)
- mir_sntprintf(pInfoTip->pszText, pInfoTip->cchTextMax, L"%s, %d", item->default_file->file, item->default_indx);
+ mir_snwprintf(pInfoTip->pszText, pInfoTip->cchTextMax, L"%s, %d", item->default_file->file, item->default_indx);
}
}
if (bNeedRebuild) {
@@ -981,7 +981,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
for (int indx = 0; indx < iconList.getCount(); indx++) {
IcolibItem *item = iconList[indx];
- replaceStrT(item->temp_file, NULL);
+ replaceStrW(item->temp_file, NULL);
SafeDestroyIcon(item->temp_icon);
}
}
diff --git a/src/mir_app/src/skinicons.cpp b/src/mir_app/src/skinicons.cpp
index e50dba78e5..d653fb7aaf 100644
--- a/src/mir_app/src/skinicons.cpp
+++ b/src/mir_app/src/skinicons.cpp
@@ -278,7 +278,7 @@ MIR_APP_DLL(HICON) Skin_LoadProtoIcon(const char *szProto, int status, bool big)
// Queried protocol isn't in list, adding
wchar_t tszSection[MAX_PATH];
- mir_sntprintf(tszSection, _T(PROTOCOLS_PREFIX)L"/%s", pa->tszAccountName);
+ mir_snwprintf(tszSection, _T(PROTOCOLS_PREFIX)L"/%s", pa->tszAccountName);
SKINICONDESC sid = { 0 };
sid.section.w = tszSection;
@@ -287,11 +287,11 @@ MIR_APP_DLL(HICON) Skin_LoadProtoIcon(const char *szProto, int status, bool big)
str = wcsrchr(szPath, '\\');
if (str != NULL)
*str = 0;
- mir_sntprintf(szFullPath, L"%s\\Icons\\proto_%S.dll", szPath, pa->szProtoName);
+ mir_snwprintf(szFullPath, L"%s\\Icons\\proto_%S.dll", szPath, pa->szProtoName);
if (GetFileAttributes(szFullPath) != INVALID_FILE_ATTRIBUTES)
sid.defaultFile.w = szFullPath;
else {
- mir_sntprintf(szFullPath, L"%s\\Plugins\\%S.dll", szPath, szProto);
+ mir_snwprintf(szFullPath, L"%s\\Plugins\\%S.dll", szPath, szProto);
if (int(ExtractIconEx(szFullPath, statusIcons[statusIndx].resource_id, NULL, &hIcon, 1)) > 0) {
DestroyIcon(hIcon);
sid.defaultFile.w = szFullPath;
diff --git a/src/mir_app/src/sounds.cpp b/src/mir_app/src/sounds.cpp
index acdf34d5b9..847b456494 100644
--- a/src/mir_app/src/sounds.cpp
+++ b/src/mir_app/src/sounds.cpp
@@ -85,14 +85,14 @@ static INT_PTR ServiceSkinAddNewSound(WPARAM wParam, LPARAM lParam)
wchar_t* ptszDefaultFile;
if (ssd->dwFlags & SSDF_UNICODE) {
- item->ptszDescription = mir_tstrdup(ssd->ptszDescription);
- item->ptszSection = mir_tstrdup((ssd->pszSection != NULL) ? ssd->ptszSection : L"Other");
- ptszDefaultFile = mir_tstrdup(ssd->ptszDefaultFile);
+ item->ptszDescription = mir_wstrdup(ssd->ptszDescription);
+ item->ptszSection = mir_wstrdup((ssd->pszSection != NULL) ? ssd->ptszSection : L"Other");
+ ptszDefaultFile = mir_wstrdup(ssd->ptszDefaultFile);
}
else {
- item->ptszDescription = mir_a2t(ssd->pszDescription);
- item->ptszSection = mir_a2t((ssd->pszSection != NULL) ? ssd->pszSection : "Other");
- ptszDefaultFile = mir_a2t(ssd->pszDefaultFile);
+ item->ptszDescription = mir_a2u(ssd->pszDescription);
+ item->ptszSection = mir_a2u((ssd->pszSection != NULL) ? ssd->pszSection : "Other");
+ ptszDefaultFile = mir_a2u(ssd->pszDefaultFile);
}
if (ptszDefaultFile) {
@@ -307,9 +307,9 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
OPENFILENAME ofn;
memset(&ofn, 0, sizeof(ofn));
if (GetModuleHandle(L"bass_interface.dll"))
- mir_sntprintf(filter, L"%s (*.wav, *.mp3, *.ogg)%c*.wav;*.mp3;*.ogg%c%s (*)%c*%c", TranslateT("Sound files"), 0, 0, TranslateT("All files"), 0, 0);
+ mir_snwprintf(filter, L"%s (*.wav, *.mp3, *.ogg)%c*.wav;*.mp3;*.ogg%c%s (*)%c*%c", TranslateT("Sound files"), 0, 0, TranslateT("All files"), 0, 0);
else
- mir_sntprintf(filter, L"%s (*.wav)%c*.wav%c%s (*)%c*%c", TranslateT("WAV files"), 0, 0, TranslateT("All files"), 0, 0);
+ mir_snwprintf(filter, L"%s (*.wav)%c*.wav%c%s (*)%c*%c", TranslateT("WAV files"), 0, 0, TranslateT("All files"), 0, 0);
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = GetParent(hwndDlg);
ofn.hInstance = NULL;
@@ -331,7 +331,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
break;
PathToRelativeT(str, strFull);
- snd.ptszTempFile = mir_tstrdup(strFull);
+ snd.ptszTempFile = mir_wstrdup(strFull);
SetDlgItemText(hwndDlg, IDC_LOCATION, strFull);
}
if (LOWORD(wParam) == IDC_GETMORE) {
@@ -388,7 +388,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
SendMessage(hwndDlg, DM_HIDEPANE, 0, 0);
else {
wchar_t buf[256];
- mir_sntprintf(buf, L"%s: %s", arSounds[tvi.lParam].getSection(), arSounds[tvi.lParam].getDescr());
+ mir_snwprintf(buf, L"%s: %s", arSounds[tvi.lParam].getSection(), arSounds[tvi.lParam].getDescr());
SetDlgItemText(hwndDlg, IDC_NAMEVAL, buf);
if (arSounds[tvi.lParam].ptszTempFile)
SetDlgItemText(hwndDlg, IDC_LOCATION, arSounds[tvi.lParam].ptszTempFile);
diff --git a/src/mir_app/src/srmm_statusicon.cpp b/src/mir_app/src/srmm_statusicon.cpp
index eeb76f9b13..bcf7a8a0b7 100644
--- a/src/mir_app/src/srmm_statusicon.cpp
+++ b/src/mir_app/src/srmm_statusicon.cpp
@@ -91,7 +91,7 @@ INT_PTR ModifyStatusIcon(WPARAM hContact, LPARAM lParam)
mir_free(p->sid.szTooltip);
memcpy(&p->sid, sid, sizeof(p->sid));
p->sid.szModule = mir_strdup(sid->szModule);
- p->sid.tszTooltip = (sid->flags & MBF_UNICODE) ? mir_u2t(sid->wszTooltip) : mir_a2t(sid->szTooltip);
+ p->sid.tszTooltip = (sid->flags & MBF_UNICODE) ? mir_wstrdup(sid->wszTooltip) : mir_a2u(sid->szTooltip);
NotifyEventHooks(hHookIconsChanged, NULL, (LPARAM)p);
return 0;
@@ -110,7 +110,7 @@ INT_PTR ModifyStatusIcon(WPARAM hContact, LPARAM lParam)
pc->hIconDisabled = sid->hIconDisabled;
mir_free(pc->tszTooltip);
- pc->tszTooltip = (sid->flags & MBF_UNICODE) ? mir_u2t(sid->wszTooltip) : mir_a2t(sid->szTooltip);
+ pc->tszTooltip = (sid->flags & MBF_UNICODE) ? mir_wstrdup(sid->wszTooltip) : mir_a2u(sid->szTooltip);
NotifyEventHooks(hHookIconsChanged, hContact, (LPARAM)p);
return 0;
@@ -131,9 +131,9 @@ static INT_PTR AddStatusIcon(WPARAM wParam, LPARAM lParam)
p->hLangpack = (int)wParam;
p->sid.szModule = mir_strdup(sid->szModule);
if (sid->flags & MBF_UNICODE)
- p->sid.tszTooltip = mir_u2t(sid->wszTooltip);
+ p->sid.tszTooltip = mir_wstrdup(sid->wszTooltip);
else
- p->sid.tszTooltip = mir_a2t(sid->szTooltip);
+ p->sid.tszTooltip = mir_a2u(sid->szTooltip);
arIcons.insert(p);
NotifyEventHooks(hHookIconsChanged, NULL, (LPARAM)p);
diff --git a/src/mir_app/src/xmlParser.cpp b/src/mir_app/src/xmlParser.cpp
index 9817e0fce5..945f809008 100644
--- a/src/mir_app/src/xmlParser.cpp
+++ b/src/mir_app/src/xmlParser.cpp
@@ -1199,7 +1199,7 @@ XMLAttribute *XMLNode::addAttribute_priv(int memoryIncrease, XMLSTR lpszName, XM
wchar_t* p = wcschr(lpszName, ':');
if (p)
- if (!mir_tstrcmp(p+1, d->lpszNS) || (d->pParent && !mir_tstrcmp(p+1, d->pParent->lpszNS)))
+ if (!mir_wstrcmp(p+1, d->lpszNS) || (d->pParent && !mir_wstrcmp(p+1, d->pParent->lpszNS)))
*p = 0;
return pAttr;
diff --git a/src/mir_core/src/bitmaps.cpp b/src/mir_core/src/bitmaps.cpp
index c7aab86736..5a06bb50ff 100644
--- a/src/mir_core/src/bitmaps.cpp
+++ b/src/mir_core/src/bitmaps.cpp
@@ -42,7 +42,7 @@ MIR_CORE_DLL(void) Bitmap_GetFilter(wchar_t *dest, size_t destLen)
if (dest == NULL)
return;
- mir_sntprintf(dest, destLen,
+ mir_snwprintf(dest, destLen,
L"%s (*.bmp;*.jpg;*.gif;*.png)%c*.BMP;*.RLE;*.JPG;*.JPEG;*.GIF;*.PNG%c"
L"%s (*.bmp;*.rle)%c*.BMP;*.RLE%c"
L"%s (*.jpg;*.jpeg)%c*.JPG;*.JPEG%c"
diff --git a/src/mir_core/src/db.cpp b/src/mir_core/src/db.cpp
index 84cf413aeb..0e028bb398 100644
--- a/src/mir_core/src/db.cpp
+++ b/src/mir_core/src/db.cpp
@@ -351,7 +351,7 @@ extern "C" MIR_CORE_DLL(void) db_setCurrent(MIDatabase *_db)
currDb = _db;
// try to get the langpack's name from a profile
- ptrT langpack(db_get_tsa(NULL, "Langpack", "Current"));
+ ptrW langpack(db_get_tsa(NULL, "Langpack", "Current"));
if (langpack && langpack[0] != '\0')
LoadLangPack(langpack);
else
diff --git a/src/mir_core/src/hyperlink.cpp b/src/mir_core/src/hyperlink.cpp
index 8c9390f4c7..dbebe701b9 100644
--- a/src/mir_core/src/hyperlink.cpp
+++ b/src/mir_core/src/hyperlink.cpp
@@ -172,7 +172,7 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA
if (dat->hEnableFont != NULL) hPrevFont = (HFONT)SelectObject(hdc, dat->hEnableFont);
if (dat->hEnableFont == NULL || hPrevFont != NULL) { /* select failed? */
SIZE textSize;
- if (GetTextExtentPoint32(hdc, (wchar_t*)lParam, (int)mir_tstrlen((wchar_t*)lParam), &textSize)) {
+ if (GetTextExtentPoint32(hdc, (wchar_t*)lParam, (int)mir_wstrlen((wchar_t*)lParam), &textSize)) {
if (GetClientRect(hwnd, &rc)) {
dat->rcText.top = 0;
dat->rcText.bottom = dat->rcText.top + textSize.cy;
diff --git a/src/mir_core/src/langpack.cpp b/src/mir_core/src/langpack.cpp
index 757345cefe..9c29fc24da 100644
--- a/src/mir_core/src/langpack.cpp
+++ b/src/mir_core/src/langpack.cpp
@@ -219,7 +219,7 @@ static void LoadLangPackFile(FILE *fp, char *line)
wchar_t *p = wcsrchr(langPack.tszFullPath, '\\');
if (p)
*p = 0;
- mir_sntprintf(tszFileName, L"%s\\%S", langPack.tszFullPath, ltrim(line + 9));
+ mir_snwprintf(tszFileName, L"%s\\%S", langPack.tszFullPath, ltrim(line + 9));
if (p)
*p = '\\';
@@ -374,18 +374,18 @@ static int LoadLangDescr(LANGPACK_INFO &lpinfo, FILE *fp, char *line, int &start
MIR_CORE_DLL(int) LoadLangPack(const wchar_t *ptszLangPack)
{
- if (ptszLangPack == NULL || !mir_tstrcmpi(ptszLangPack, L""))
+ if (ptszLangPack == NULL || !mir_wstrcmpi(ptszLangPack, L""))
return 1;
// ensure that a lang's name is a full file name
wchar_t tszFullPath[MAX_PATH];
if (!PathIsAbsoluteT(ptszLangPack))
- mir_sntprintf(tszFullPath, L"%s\\%s", g_tszRoot, ptszLangPack);
+ mir_snwprintf(tszFullPath, L"%s\\%s", g_tszRoot, ptszLangPack);
else
wcsncpy_s(tszFullPath, ptszLangPack, _TRUNCATE);
// this lang is already loaded? nothing to do then
- if (!mir_tstrcmp(tszFullPath, langPack.tszFullPath))
+ if (!mir_wstrcmp(tszFullPath, langPack.tszFullPath))
return 0;
// ok... loading a new langpack. remove the old one if needed
@@ -563,9 +563,9 @@ static BOOL CALLBACK TranslateDialogEnumProc(HWND hwnd, LPARAM lParam)
wchar_t szClass[32];
GetClassName(hwnd, szClass, _countof(szClass));
- if (!mir_tstrcmpi(szClass, L"static") || !mir_tstrcmpi(szClass, L"hyperlink") || !mir_tstrcmpi(szClass, L"button") || !mir_tstrcmpi(szClass, L"MButtonClass") || !mir_tstrcmpi(szClass, L"MHeaderbarCtrl"))
+ if (!mir_wstrcmpi(szClass, L"static") || !mir_wstrcmpi(szClass, L"hyperlink") || !mir_wstrcmpi(szClass, L"button") || !mir_wstrcmpi(szClass, L"MButtonClass") || !mir_wstrcmpi(szClass, L"MHeaderbarCtrl"))
TranslateWindow(uuid, hwnd);
- else if (!mir_tstrcmpi(szClass, L"edit")) {
+ else if (!mir_wstrcmpi(szClass, L"edit")) {
if (GetWindowLongPtr(hwnd, GWL_STYLE) & ES_READONLY)
TranslateWindow(uuid, hwnd);
}
@@ -641,7 +641,7 @@ void GetDefaultLang()
PathToAbsoluteT(L"\\mirandaboot.ini", tszPath);
GetPrivateProfileString(L"Language", L"DefaultLanguage", L"", tszLangName, _countof(tszLangName), tszPath);
if (tszLangName[0]) {
- if (!mir_tstrcmpi(tszLangName, L"default")) {
+ if (!mir_wstrcmpi(tszLangName, L"default")) {
db_set_ts(NULL, "Langpack", "Current", L"default");
return;
}
@@ -653,7 +653,7 @@ void GetDefaultLang()
// try to load langpack that matches UserDefaultUILanguage
if (GetLocaleInfo(MAKELCID(GetUserDefaultUILanguage(), SORT_DEFAULT), LOCALE_SENGLANGUAGE, tszLangName, _countof(tszLangName))) {
- mir_sntprintf(tszPath, L"langpack_%s.txt", wcslwr(tszLangName));
+ mir_snwprintf(tszPath, L"langpack_%s.txt", wcslwr(tszLangName));
if (!LoadLangPack(tszPath)) {
db_set_ts(NULL, "Langpack", "Current", tszPath);
return;
@@ -661,7 +661,7 @@ void GetDefaultLang()
}
// finally try to load first file
- mir_sntprintf(tszPath, L"%s\\langpack_*.txt", g_tszRoot);
+ mir_snwprintf(tszPath, L"%s\\langpack_*.txt", g_tszRoot);
WIN32_FIND_DATA fd;
HANDLE hFind = FindFirstFile(tszPath, &fd);
diff --git a/src/mir_core/src/logger.cpp b/src/mir_core/src/logger.cpp
index 3711d26fa6..a2e526a6a2 100644
--- a/src/mir_core/src/logger.cpp
+++ b/src/mir_core/src/logger.cpp
@@ -30,8 +30,8 @@ struct Logger
{
Logger(const char* pszName, const wchar_t *ptszDescr, const wchar_t *ptszFilename, unsigned options) :
m_name(mir_strdup(pszName)),
- m_descr(mir_tstrdup(ptszDescr)),
- m_fileName(mir_tstrdup(ptszFilename)),
+ m_descr(mir_wstrdup(ptszDescr)),
+ m_fileName(mir_wstrdup(ptszFilename)),
m_options(options),
m_signature(SECRET_SIGNATURE),
m_out(NULL),
@@ -47,7 +47,7 @@ struct Logger
int m_signature;
ptrA m_name;
- ptrT m_fileName, m_descr;
+ ptrW m_fileName, m_descr;
FILE *m_out;
__int64 m_lastwrite;
unsigned m_options;
diff --git a/src/mir_core/src/miranda.cpp b/src/mir_core/src/miranda.cpp
index 055244596f..c2b4208b54 100644
--- a/src/mir_core/src/miranda.cpp
+++ b/src/mir_core/src/miranda.cpp
@@ -58,9 +58,9 @@ static INT_PTR RestartMiranda(WPARAM wParam, LPARAM lParam)
if (wParam) {
VARST profilename(L"%miranda_profilename%");
- mir_sntprintf(cmdLine, L"\"%s\" /restart:%d /profile=%s", mirandaPath, GetCurrentProcessId(), (wchar_t*)profilename);
+ mir_snwprintf(cmdLine, L"\"%s\" /restart:%d /profile=%s", mirandaPath, GetCurrentProcessId(), (wchar_t*)profilename);
}
- else mir_sntprintf(cmdLine, L"\"%s\" /restart:%d", mirandaPath, GetCurrentProcessId());
+ else mir_snwprintf(cmdLine, L"\"%s\" /restart:%d", mirandaPath, GetCurrentProcessId());
CallService("CloseAction", 0, 0);
diff --git a/src/mir_core/src/openurl.cpp b/src/mir_core/src/openurl.cpp
index d75baaa2a3..93aab27ec2 100644
--- a/src/mir_core/src/openurl.cpp
+++ b/src/mir_core/src/openurl.cpp
@@ -32,7 +32,7 @@ struct TOpenUrlInfo
newWindow(_bNew)
{}
- ptrT szUrl;
+ ptrW szUrl;
int newWindow;
};
@@ -56,7 +56,7 @@ static void OpenURLThread(void *arg)
}
// check user defined browser for opening urls
- ptrT tszBrowser(db_get_tsa(NULL, "Miranda", "OpenUrlBrowser"));
+ ptrW tszBrowser(db_get_tsa(NULL, "Miranda", "OpenUrlBrowser"));
if (tszBrowser)
ShellExecute(NULL, L"open", tszBrowser, tszUrl, NULL, (hUrlInfo->newWindow) ? SW_NORMAL : SW_SHOWDEFAULT);
else
@@ -68,7 +68,7 @@ static void OpenURLThread(void *arg)
MIR_CORE_DLL(void) Utils_OpenUrl(const char *pszUrl, bool bOpenInNewWindow)
{
if (pszUrl)
- mir_forkthread(OpenURLThread, new TOpenUrlInfo(mir_a2t(pszUrl), bOpenInNewWindow));
+ mir_forkthread(OpenURLThread, new TOpenUrlInfo(mir_a2u(pszUrl), bOpenInNewWindow));
}
MIR_CORE_DLL(void) Utils_OpenUrlW(const wchar_t *pszUrl, bool bOpenInNewWindow)
diff --git a/src/mir_core/src/path.cpp b/src/mir_core/src/path.cpp
index 64d00da713..56aa054c85 100644
--- a/src/mir_core/src/path.cpp
+++ b/src/mir_core/src/path.cpp
@@ -156,7 +156,7 @@ MIR_CORE_DLL(int) PathToAbsoluteW(const WCHAR *pSrc, WCHAR *pOut, const WCHAR *b
WCHAR buf[MAX_PATH];
if (pSrc[0] < ' ')
- return mir_sntprintf(pOut, MAX_PATH, L"%s", pSrc);
+ return mir_snwprintf(pOut, MAX_PATH, L"%s", pSrc);
if (PathIsAbsoluteW(pSrc))
return GetFullPathName(pSrc, MAX_PATH, pOut, NULL);
@@ -167,7 +167,7 @@ MIR_CORE_DLL(int) PathToAbsoluteW(const WCHAR *pSrc, WCHAR *pOut, const WCHAR *b
if (pSrc[0] == '\\')
pSrc++;
- mir_sntprintf(buf, MAX_PATH, L"%s%s", base, pSrc);
+ mir_snwprintf(buf, MAX_PATH, L"%s%s", base, pSrc);
return GetFullPathName(buf, MAX_PATH, pOut, NULL);
}
diff --git a/src/mir_core/src/timezones.cpp b/src/mir_core/src/timezones.cpp
index c832bd2d42..e8f0e05356 100644
--- a/src/mir_core/src/timezones.cpp
+++ b/src/mir_core/src/timezones.cpp
@@ -176,7 +176,7 @@ MIR_CORE_DLL(LPCTSTR) TimeZone_GetDescription(LPCTSTR TZname)
for (int i = 0; i < g_timezonesBias.getCount(); i++) {
MIM_TIMEZONE *tz = g_timezonesBias[i];
- if (!mir_tstrcmp(tz->tszName, TZname))
+ if (!mir_wstrcmp(tz->tszName, TZname))
return tz->szDisplay;
}
return L"";
@@ -218,7 +218,7 @@ MIR_CORE_DLL(HANDLE) TimeZone_CreateByName(LPCTSTR tszName, DWORD dwFlags)
if (tszName == NULL)
return (dwFlags & (TZF_DIFONLY | TZF_KNOWNONLY)) ? NULL : &myInfo.myTZ;
- if (mir_tstrcmp(myInfo.myTZ.tszName, tszName) == 0)
+ if (mir_wstrcmp(myInfo.myTZ.tszName, tszName) == 0)
return (dwFlags & TZF_DIFONLY) ? NULL : &myInfo.myTZ;
MIM_TIMEZONE tzsearch;
@@ -381,9 +381,9 @@ static const ListMessages* GetListMessages(HWND hWnd, DWORD dwFlags)
if (!(dwFlags & (TZF_PLF_CB | TZF_PLF_LB))) {
wchar_t tszClassName[128];
GetClassName(hWnd, tszClassName, _countof(tszClassName));
- if (!mir_tstrcmpi(tszClassName, L"COMBOBOX"))
+ if (!mir_wstrcmpi(tszClassName, L"COMBOBOX"))
dwFlags |= TZF_PLF_CB;
- else if (!mir_tstrcmpi(tszClassName, L"LISTBOX"))
+ else if (!mir_wstrcmpi(tszClassName, L"LISTBOX"))
dwFlags |= TZF_PLF_LB;
}
if (dwFlags & TZF_PLF_CB)
@@ -405,7 +405,7 @@ MIR_CORE_DLL(int) TimeZone_SelectListItem(MCONTACT hContact, LPCSTR szModule, HW
if (szModule == NULL) szModule = "UserInfo";
int iSelection = 0;
- ptrT tszName(db_get_tsa(hContact, szModule, "TzName"));
+ ptrW tszName(db_get_tsa(hContact, szModule, "TzName"));
if (tszName != NULL) {
unsigned hash = mir_hashstrT(tszName);
for (int i = 0; i < g_timezonesBias.getCount(); i++) {
@@ -506,9 +506,7 @@ void RecalculateTime(void)
DYNAMIC_TIME_ZONE_INFORMATION dtzi;
if (pfnGetDynamicTimeZoneInformation && pfnGetDynamicTimeZoneInformation(&dtzi) != TIME_ZONE_ID_INVALID) {
- wchar_t *myTzKey = mir_u2t(dtzi.TimeZoneKeyName);
- wcsncpy_s(myInfo.myTZ.tszName, myTzKey, _TRUNCATE);
- mir_free(myTzKey);
+ wcsncpy_s(myInfo.myTZ.tszName, dtzi.TimeZoneKeyName, _TRUNCATE);
found = true;
}
@@ -563,7 +561,7 @@ void InitTimeZones(void)
tz->tzi.DaylightDate = tzi.DaylightDate;
tz->tzi.DaylightBias = tzi.DaylightBias;
- mir_tstrcpy(tz->tszName, tszName);
+ mir_wstrcpy(tz->tszName, tszName);
tz->hash = mir_hashstrT(tszName);
tz->offset = INT_MIN;
diff --git a/src/mir_core/src/ui_utils.cpp b/src/mir_core/src/ui_utils.cpp
index 03065d06d2..8de4a148e7 100644
--- a/src/mir_core/src/ui_utils.cpp
+++ b/src/mir_core/src/ui_utils.cpp
@@ -382,7 +382,7 @@ wchar_t* CCtrlCombo::GetItemText(int index, wchar_t *buf, int size)
{
wchar_t *result = (wchar_t *)_alloca(sizeof(wchar_t) * (SendMessage(m_hwnd, CB_GETLBTEXTLEN, index, 0) + 1));
SendMessage(m_hwnd, CB_GETLBTEXT, index, (LPARAM)result);
- mir_tstrncpy(buf, result, size);
+ mir_wstrncpy(buf, result, size);
return buf;
}
@@ -468,7 +468,7 @@ wchar_t* CCtrlListBox::GetItemText(int index, wchar_t *buf, int size)
{
wchar_t *result = (wchar_t *)_alloca(sizeof(wchar_t) * (SendMessage(m_hwnd, LB_GETTEXTLEN, index, 0) + 1));
SendMessage(m_hwnd, LB_GETTEXT, index, (LPARAM)result);
- mir_tstrncpy(buf, result, size);
+ mir_wstrncpy(buf, result, size);
return buf;
}
@@ -966,7 +966,7 @@ void CCtrlListView::AddGroup(int iGroupId, wchar_t *name)
lvg.cbSize = sizeof(lvg);
lvg.mask = LVGF_HEADER | LVGF_GROUPID;
lvg.pszHeader = name;
- lvg.cchHeader = (int)mir_tstrlen(lvg.pszHeader);
+ lvg.cchHeader = (int)mir_wstrlen(lvg.pszHeader);
lvg.iGroupId = iGroupId;
InsertGroup(-1, &lvg);
}
@@ -1680,7 +1680,7 @@ HTREEITEM CCtrlTreeView::FindNamedItem(HTREEITEM hItem, const wchar_t *name)
while (tvi.hItem) {
GetItem(&tvi);
- if (!mir_tstrcmp(tvi.pszText, name))
+ if (!mir_wstrcmp(tvi.pszText, name))
return tvi.hItem;
tvi.hItem = GetNextSibling(tvi.hItem);
@@ -2139,7 +2139,7 @@ void CCtrlPages::AddPage(wchar_t *ptszName, HICON hIcon, CDlgBase *pDlg)
TPageInfo *info = new TPageInfo;
info->m_pDlg = pDlg;
info->m_hIcon = hIcon;
- info->m_ptszHeader = mir_tstrdup(ptszName);
+ info->m_ptszHeader = mir_wstrdup(ptszName);
m_pages.insert(info);
}
@@ -2372,7 +2372,7 @@ void CCtrlBase::SetTextA(const char *text)
void CCtrlBase::SetInt(int value)
{
wchar_t buf[32] = { 0 };
- mir_sntprintf(buf, L"%d", value);
+ mir_snwprintf(buf, L"%d", value);
SetWindowText(m_hwnd, buf);
}
@@ -2469,7 +2469,7 @@ CDbLink::CDbLink(const char *szModule, const char *szSetting, BYTE type, wchar_t
{
m_szModule = mir_strdup(szModule);
m_szSetting = mir_strdup(szSetting);
- m_szDefault = mir_tstrdup(szValue);
+ m_szDefault = mir_wstrdup(szValue);
dbv.type = DBVT_DELETED;
}
diff --git a/src/mir_core/src/winver.cpp b/src/mir_core/src/winver.cpp
index cfbe338b81..8c7d73e98a 100644
--- a/src/mir_core/src/winver.cpp
+++ b/src/mir_core/src/winver.cpp
@@ -95,7 +95,7 @@ MIR_CORE_DLL(BOOL) IsWorkstationLocked(void)
wchar_t tszName[100];
DWORD cbName;
- BOOL bLocked = (!GetUserObjectInformation(hDesk, UOI_NAME, tszName, _countof(tszName), &cbName) || mir_tstrcmpi(tszName, L"default") != 0);
+ BOOL bLocked = (!GetUserObjectInformation(hDesk, UOI_NAME, tszName, _countof(tszName), &cbName) || mir_wstrcmpi(tszName, L"default") != 0);
CloseDesktop(hDesk);
return bLocked;
}
@@ -395,7 +395,7 @@ MIR_CORE_DLL(BOOL) GetOSDisplayString(wchar_t *buf, size_t bufSize)
// Include service pack (if any) and build number.
- if (mir_tstrlen(osvi.szCSDVersion) > 0) {
+ if (mir_wstrlen(osvi.szCSDVersion) > 0) {
ret.Append(L" ");
ret.Append(osvi.szCSDVersion);
}
@@ -408,6 +408,6 @@ MIR_CORE_DLL(BOOL) GetOSDisplayString(wchar_t *buf, size_t bufSize)
ret.AppendFormat(L" (Wine %s)", _A2T(wine_get_version()));
}
- mir_tstrncpy(buf, ret, bufSize);
+ mir_wstrncpy(buf, ret, bufSize);
return TRUE;
}