From 2f261839b60692e33d0e160344d0d636d49c90ba Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 27 Jul 2016 14:23:31 +0000 Subject: less TCHARs git-svn-id: http://svn.miranda-ng.org/main/trunk@17138 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/stdauth/src/auth.cpp | 10 +++--- src/core/stdauth/src/authdialogs.cpp | 48 +++++++++++++-------------- src/core/stdautoaway/src/autoaway.cpp | 2 +- src/core/stdaway/src/awaymsg.cpp | 6 ++-- src/core/stdaway/src/sendmsg.cpp | 20 ++++++------ src/core/stdchat/src/manager.cpp | 2 +- src/core/stdchat/src/options.cpp | 8 ++--- src/core/stdchat/src/tools.cpp | 14 ++++---- src/core/stdchat/src/window.cpp | 44 ++++++++++++------------- src/core/stdclist/src/clcpaint.cpp | 14 ++++---- src/core/stdclist/src/contact.cpp | 2 +- src/core/stdcrypt/src/stdcrypt.h | 2 +- src/core/stdfile/src/file.cpp | 16 ++++----- src/core/stdfile/src/fileexistsdlg.cpp | 26 +++++++-------- src/core/stdfile/src/fileopts.cpp | 6 ++-- src/core/stdfile/src/filerecvdlg.cpp | 32 +++++++++--------- src/core/stdfile/src/filesenddlg.cpp | 36 ++++++++++----------- src/core/stdfile/src/filexferdlg.cpp | 54 +++++++++++++++---------------- src/core/stdhelp/src/about.cpp | 4 +-- src/core/stdmsg/src/msgdialog.cpp | 42 ++++++++++++------------ src/core/stdmsg/src/msglog.cpp | 6 ++-- src/core/stdmsg/src/msgoptions.cpp | 2 +- src/core/stdmsg/src/msgs.cpp | 6 ++-- src/core/stdmsg/src/msgtimedout.cpp | 6 ++-- src/core/stdssl/src/netlibssl.cpp | 2 +- src/core/stduihist/src/history.cpp | 14 ++++---- src/core/stduserinfo/src/contactinfo.cpp | 18 +++++------ src/core/stduserinfo/src/stdinfo.cpp | 18 +++++------ src/core/stduserinfo/src/userinfo.cpp | 28 ++++++++-------- src/core/stduseronline/src/useronline.cpp | 2 +- 30 files changed, 245 insertions(+), 245 deletions(-) (limited to 'src/core') 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; -- cgit v1.2.3