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/mir_app/src/BaseExtraIcon.cpp | 4 +- src/mir_app/src/ExtraIcon.h | 4 +- src/mir_app/src/ExtraIconGroup.cpp | 2 +- src/mir_app/src/FontOptions.cpp | 38 +++++++-------- src/mir_app/src/IcoLib.h | 2 +- src/mir_app/src/addcontact.cpp | 18 +++---- src/mir_app/src/button.cpp | 12 ++--- src/mir_app/src/chat_clist.cpp | 18 +++---- src/mir_app/src/chat_log.cpp | 20 ++++---- src/mir_app/src/chat_manager.cpp | 60 +++++++++++------------ src/mir_app/src/chat_opts.cpp | 10 ++-- src/mir_app/src/chat_rtf.cpp | 2 +- src/mir_app/src/chat_svc.cpp | 16 +++---- src/mir_app/src/chat_tools.cpp | 94 ++++++++++++++++++------------------- src/mir_app/src/clc.cpp | 20 ++++---- src/mir_app/src/clcfiledrop.cpp | 16 +++---- src/mir_app/src/clcitems.cpp | 28 +++++------ src/mir_app/src/clcmsgs.cpp | 10 ++-- src/mir_app/src/clcutils.cpp | 22 ++++----- src/mir_app/src/clistevents.cpp | 2 +- src/mir_app/src/clistgroups.cpp | 44 ++++++++--------- src/mir_app/src/clistmod.cpp | 2 +- src/mir_app/src/clistsettings.cpp | 22 ++++----- src/mir_app/src/clisttray.cpp | 32 ++++++------- src/mir_app/src/clui.cpp | 22 ++++----- src/mir_app/src/cluiservices.cpp | 12 ++--- src/mir_app/src/contacts.cpp | 12 ++--- src/mir_app/src/database.cpp | 58 +++++++++++------------ src/mir_app/src/dbini.cpp | 46 +++++++++--------- src/mir_app/src/dbutils.cpp | 34 +++++++------- src/mir_app/src/descbutton.cpp | 12 ++--- src/mir_app/src/encrypt.cpp | 4 +- src/mir_app/src/enterstring.cpp | 6 +-- src/mir_app/src/extraicons.cpp | 6 +-- src/mir_app/src/filter.cpp | 18 +++---- src/mir_app/src/filter.h | 6 +-- src/mir_app/src/findadd.cpp | 22 ++++----- src/mir_app/src/headerbar.cpp | 8 +--- src/mir_app/src/hotkey_opts.cpp | 26 +++++----- src/mir_app/src/hotkeys.cpp | 12 ++--- src/mir_app/src/icolib.cpp | 16 +++---- src/mir_app/src/iconheader.cpp | 8 ++-- src/mir_app/src/langpack.cpp | 10 ++-- src/mir_app/src/lpopts.cpp | 12 ++--- src/mir_app/src/menu_clist.cpp | 18 +++---- src/mir_app/src/menu_options.cpp | 22 ++++----- src/mir_app/src/menu_utils.cpp | 22 ++++----- src/mir_app/src/meta_addto.cpp | 6 +-- src/mir_app/src/meta_menu.cpp | 2 +- src/mir_app/src/meta_services.cpp | 2 +- src/mir_app/src/meta_utils.cpp | 6 +-- src/mir_app/src/movetogroup.cpp | 10 ++-- src/mir_app/src/netlib.cpp | 2 +- src/mir_app/src/netlibhttp.cpp | 6 +-- src/mir_app/src/netliblog.cpp | 14 +++--- src/mir_app/src/netlibopts.cpp | 2 +- src/mir_app/src/netlibsecurity.cpp | 32 ++++++------- src/mir_app/src/newplugins.cpp | 30 ++++++------ src/mir_app/src/options.cpp | 64 ++++++++++++------------- src/mir_app/src/path.cpp | 42 ++++++++--------- src/mir_app/src/pluginopts.cpp | 34 +++++++------- src/mir_app/src/profilemanager.cpp | 48 +++++++++---------- src/mir_app/src/proto_accs.cpp | 4 +- src/mir_app/src/proto_internal.cpp | 18 +++---- src/mir_app/src/proto_opts.cpp | 36 +++++++------- src/mir_app/src/proto_ui.cpp | 8 ++-- src/mir_app/src/proto_utils.cpp | 2 +- src/mir_app/src/protocols.cpp | 4 +- src/mir_app/src/searchresults.cpp | 20 ++++---- src/mir_app/src/services.cpp | 14 +++--- src/mir_app/src/skin2opts.cpp | 60 +++++++++++------------ src/mir_app/src/skinicons.cpp | 6 +-- src/mir_app/src/sounds.cpp | 20 ++++---- src/mir_app/src/srmm_statusicon.cpp | 8 ++-- src/mir_app/src/xmlParser.cpp | 2 +- 75 files changed, 702 insertions(+), 710 deletions(-) (limited to 'src/mir_app') 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 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 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 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 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"%-12.12s\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%-12.12s\t%s%s%-24.24s", szPrefix, szSeparator, pa->tszAccountName, szStatus, szSeparator, ProtoXStatus); + mir_snwprintf(cli.szTip, MAX_TIP_SIZE, L"%s%s%-12.12s\t%s%s%-24.24s", szPrefix, szSeparator, pa->tszAccountName, szStatus, szSeparator, ProtoXStatus); else - mir_sntprintf(cli.szTip, MAX_TIP_SIZE, L"%s%s%-12.12s\t%s", szPrefix, szSeparator, pa->tszAccountName, szStatus); + mir_snwprintf(cli.szTip, MAX_TIP_SIZE, L"%s%s%-12.12s\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"%-12.12s\t%s\n%-24.24s", pa->tszAccountName, szStatus, ProtoXStatus); + mir_snwprintf(cli.szTip, MAX_TIP_SIZE, L"%-12.12s\t%s\n%-24.24s", pa->tszAccountName, szStatus, ProtoXStatus); else - mir_sntprintf(cli.szTip, MAX_TIP_SIZE, L"%-12.12s\t%s", pa->tszAccountName, szStatus); + mir_snwprintf(cli.szTip, MAX_TIP_SIZE, L"%-12.12s\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 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 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 @@ -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 @@ -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 arPluginList(10, sttSortPlugins); @@ -61,7 +61,7 @@ static LIST 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("")); + mir_snwprintf(text, size, L"%s: %s", tszIdName, TranslateT("")); } - 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; -- cgit v1.2.3