diff options
author | George Hazan <george.hazan@gmail.com> | 2016-07-27 14:23:31 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-07-27 14:23:31 +0000 |
commit | 2f261839b60692e33d0e160344d0d636d49c90ba (patch) | |
tree | 187921722698b681d29df3f6e60fb18394a5e9d5 | |
parent | 2e931a0b2780587d85f3902468c935f5adba70c8 (diff) |
less TCHARs
git-svn-id: http://svn.miranda-ng.org/main/trunk@17138 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
966 files changed, 8514 insertions, 8620 deletions
diff --git a/include/m_core.h b/include/m_core.h index 8b7e4d80fa..353eba25fa 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -437,90 +437,6 @@ typedef union { wchar_t **w; // array of strings of WCHARs
} MAllStringArray;
-#ifdef _UNICODE
- #define mir_t2a(s) mir_u2a(s)
- #define mir_a2t(s) mir_a2u(s)
- #define mir_t2u(s) mir_wstrdup(s)
- #define mir_u2t(s) mir_wstrdup(s)
-
- #define mir_t2a_cp(s,c) mir_u2a_cp(s,c)
- #define mir_a2t_cp(s,c) mir_a2u_cp(s,c)
- #define mir_t2u_cp(s,c) mir_wstrdup(s)
- #define mir_u2t_cp(s,c) mir_wstrdup(s)
-
- #define mir_tstrlen mir_wstrlen
- #define mir_tstrcpy mir_wstrcpy
- #define mir_tstrncpy mir_wstrncpy
- #define mir_tstrcat mir_wstrcat
- #define mir_tstrncat mir_wstrncat
- #define mir_tstrcmp mir_wstrcmp
- #define mir_tstrcmpi mir_wstrcmpi
- #define mir_tstrncmp mir_wstrncmp
- #define mir_tstrncmpi mir_wstrncmpi
- #define mir_tstrdup mir_wstrdup
- #define mir_tstrndup mir_wstrndup
-
- #define replaceStrT replaceStrW
- #define bin2hexT bin2hexW
- #define hex2binT hex2binW
-
- #define rtrimt rtrimw
- #define ltrimt ltrimw
- #define ltrimpt ltrimpw
-
- #define strdelt strdelw
-
- #define wildcmpt wildcmpw
- #define wildcmpit wildcmpiw
-
- #define mir_sntprintf mir_snwprintf
- #define mir_vsntprintf mir_vsnwprintf
-
- #define mir_writeLogT mir_writeLogW
- #define mir_writeLogVT mir_writeLogVW
-#else
- #define mir_t2a(s) mir_strdup(s)
- #define mir_a2t(s) mir_strdup(s)
- #define mir_t2u(s) mir_a2u(s)
- #define mir_u2t(s) mir_u2a(s)
-
- #define mir_t2a_cp(s,c) mir_strdup(s)
- #define mir_a2t_cp(s,c) mir_strdup(s)
- #define mir_t2u_cp(s,c) mir_a2u_cp(s,c)
- #define mir_u2t_cp(s,c) mir_u2a_cp(s,c)
-
- #define mir_tstrlen mir_strlen
- #define mir_tstrcpy mir_strcpy
- #define mir_tstrncpy mir_strncpy
- #define mir_tstrcat mir_strcat
- #define mir_tstrncat mir_strncat
- #define mir_tstrcmp mir_strcmp
- #define mir_tstrcmpi mir_strcmpi
- #define mir_tstrncmp mir_strncmp
- #define mir_tstrncmpi mir_strncmpi
- #define mir_tstrdup mir_strdup
- #define mir_tstrndup mir_strndup
-
- #define replaceStrT replaceStr
- #define bin2hexT bin2hex
- #define hex2binT hex2bin
-
- #define rtrimt rtrim
- #define ltrimt ltrim
- #define ltrimpt ltrimp
-
- #define strdelt strdel
-
- #define wildcmpt wildcmp
- #define wildcmpit wildcmpi
-
- #define mir_sntprintf mir_snprintf
- #define mir_vsntprintf mir_vsnprintf
-
- #define mir_writeLogT mir_writeLogA
- #define mir_writeLogVT mir_writeLogVA
-#endif
-
MIR_CORE_DLL(wchar_t*) mir_a2u_cp(const char* src, int codepage);
MIR_CORE_DLL(wchar_t*) mir_a2u(const char* src);
MIR_CORE_DLL(char*) mir_u2a_cp(const wchar_t* src, int codepage);
@@ -585,19 +501,11 @@ MIR_CORE_DLL(BOOL) Utf8CheckString(const char* str); __forceinline char* mir_utf8decodeA(const char* src)
{
- char* tmp = mir_strdup(src);
+ char *tmp = mir_strdup(src);
mir_utf8decode(tmp, NULL);
return tmp;
}
-#if defined(_UNICODE)
- #define mir_utf8decodeT mir_utf8decodeW
- #define mir_utf8encodeT mir_utf8encodeW
-#else
- #define mir_utf8decodeT mir_utf8decodeA
- #define mir_utf8encodeT mir_utf8encode
-#endif
-
///////////////////////////////////////////////////////////////////////////////
// Window subclassing
diff --git a/include/m_gui.h b/include/m_gui.h index c0e22e0026..9090efc69a 100644 --- a/include/m_gui.h +++ b/include/m_gui.h @@ -1144,7 +1144,7 @@ private: struct TPageInfo : public MZeroedObject
{
int m_pageId;
- ptrT m_ptszHeader;
+ ptrW m_ptszHeader;
HICON m_hIcon;
BOOL m_bChanged;
CDlgBase *m_pDlg;
diff --git a/include/m_system_cpp.h b/include/m_system_cpp.h index 1f60a5c399..e595583b9d 100644 --- a/include/m_system_cpp.h +++ b/include/m_system_cpp.h @@ -51,8 +51,7 @@ public: };
typedef mir_ptr<char> ptrA;
-typedef mir_ptr<wchar_t> ptrT;
-typedef mir_ptr<WCHAR> ptrW;
+typedef mir_ptr<wchar_t> ptrW;
///////////////////////////////////////////////////////////////////////////////
// mir_cs - simple wrapper for the critical sections
diff --git a/libs/libjson/src/internalJSONNode.h b/libs/libjson/src/internalJSONNode.h index 5381d2fcdc..05f89b6220 100644 --- a/libs/libjson/src/internalJSONNode.h +++ b/libs/libjson/src/internalJSONNode.h @@ -290,7 +290,7 @@ inline json_string internalJSONNode::as_string(void) const { inline CMString internalJSONNode::as_mstring(void) const {
Fetch();
- return CMString(ptrT(mir_utf8decodeT(_string.c_str())));
+ return CMString(ptrW(mir_utf8decodeW(_string.c_str())));
}
inline long internalJSONNode::as_int(void) const {
diff --git a/libs/libjson/src/libJSON.cpp b/libs/libjson/src/libJSON.cpp index a14c7865e2..0431da1f02 100644 --- a/libs/libjson/src/libJSON.cpp +++ b/libs/libjson/src/libJSON.cpp @@ -55,7 +55,7 @@ extern JSONNode nullNode; inline wchar_t* toCString(const json_string & str)
{
- return mir_utf8decodeT( str.c_str());
+ return mir_utf8decodeW( str.c_str());
}
/*
diff --git a/plugins/AVS/src/acc.cpp b/plugins/AVS/src/acc.cpp index 96935ace4f..38e62a954f 100644 --- a/plugins/AVS/src/acc.cpp +++ b/plugins/AVS/src/acc.cpp @@ -469,7 +469,7 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP return TRUE;
case AVATAR_SETNOAVATARTEXT:
- mir_tstrncpy(data->noAvatarText, TranslateTS((wchar_t*)lParam), _countof(data->noAvatarText));
+ mir_wstrncpy(data->noAvatarText, TranslateTS((wchar_t*)lParam), _countof(data->noAvatarText));
Invalidate(hwnd);
return TRUE;
diff --git a/plugins/AVS/src/cache.cpp b/plugins/AVS/src/cache.cpp index c4702ae89c..2f521cc01d 100644 --- a/plugins/AVS/src/cache.cpp +++ b/plugins/AVS/src/cache.cpp @@ -150,7 +150,7 @@ void NotifyMetaAware(MCONTACT hContact, CacheNode *node, AVATARCACHEENTRY *ace) // Default value
if (cacn.hash[0] == '\0')
- mir_sntprintf(cacn.hash, L"AVS-HASH-%x", GetFileHash(cacn.filename));
+ mir_snwprintf(cacn.hash, L"AVS-HASH-%x", GetFileHash(cacn.filename));
NotifyEventHooks(hEventContactAvatarChanged, hContact, (LPARAM)&cacn);
}
diff --git a/plugins/AVS/src/image_utils.cpp b/plugins/AVS/src/image_utils.cpp index 61c548c96b..70fe12713e 100644 --- a/plugins/AVS/src/image_utils.cpp +++ b/plugins/AVS/src/image_utils.cpp @@ -212,7 +212,7 @@ int BmpFilterSaveBitmap(HBITMAP hBmp, const wchar_t *ptszFile, int flags) if (!PathToAbsoluteT(ptszFile, tszFilename))
wcsncpy_s(tszFilename, ptszFile, _TRUNCATE);
- if (mir_tstrlen(tszFilename) <= 4)
+ if (mir_wstrlen(tszFilename) <= 4)
return -1;
IMGSRVC_INFO i = { 0 };
diff --git a/plugins/AVS/src/main.cpp b/plugins/AVS/src/main.cpp index 516d6a204b..a52cd78b6a 100644 --- a/plugins/AVS/src/main.cpp +++ b/plugins/AVS/src/main.cpp @@ -132,7 +132,7 @@ static void LoadDefaultInfo() db_unset(0, PPICT_MODULE, AVS_DEFAULT);
pce->szProtoname = mir_strdup(AVS_DEFAULT);
- pce->tszAccName = mir_tstrdup(TranslateT("Global avatar"));
+ pce->tszAccName = mir_wstrdup(TranslateT("Global avatar"));
g_ProtoPictures.insert(pce);
}
@@ -145,13 +145,13 @@ static void LoadProtoInfo(PROTOCOLDESCRIPTOR *proto) mir_snprintf(protoName, "Global avatar for %s accounts", proto->szName);
wchar_t protoNameTmp[MAX_PATH];
- mir_sntprintf(protoNameTmp, TranslateT("Global avatar for %s accounts"), _A2T(proto->szName));
+ mir_snwprintf(protoNameTmp, TranslateT("Global avatar for %s accounts"), _A2T(proto->szName));
protoPicCacheEntry *pce = new protoPicCacheEntry;
if (CreateAvatarInCache(0, pce, protoName) != 1)
db_unset(0, PPICT_MODULE, protoName);
pce->szProtoname = mir_strdup(protoName);
- pce->tszAccName = mir_tstrdup(protoNameTmp);
+ pce->tszAccName = mir_wstrdup(protoNameTmp);
g_ProtoPictures.insert(pce);
}
@@ -162,13 +162,13 @@ static void LoadAccountInfo(PROTOACCOUNT *acc) db_unset(0, PPICT_MODULE, acc->szModuleName);
pce->szProtoname = mir_strdup(acc->szModuleName);
- pce->tszAccName = mir_tstrdup(acc->tszAccountName);
+ pce->tszAccName = mir_wstrdup(acc->tszAccountName);
g_ProtoPictures.insert(pce);
pce = new protoPicCacheEntry;
CreateAvatarInCache(INVALID_CONTACT_ID, pce, acc->szModuleName);
pce->szProtoname = mir_strdup(acc->szModuleName);
- pce->tszAccName = mir_tstrdup(acc->tszAccountName);
+ pce->tszAccName = mir_wstrdup(acc->tszAccountName);
g_MyAvatars.insert(pce);
}
@@ -323,7 +323,7 @@ void InternalDrawAvatar(AVATARDRAWREQUEST *r, HBITMAP hbm, LONG bmWidth, LONG bm static int ModulesLoaded(WPARAM, LPARAM)
{
wchar_t szEventName[100];
- mir_sntprintf(szEventName, L"avs_loaderthread_%d", GetCurrentThreadId());
+ mir_snwprintf(szEventName, L"avs_loaderthread_%d", GetCurrentThreadId());
hLoaderEvent = CreateEvent(NULL, TRUE, FALSE, szEventName);
SetThreadPriority(mir_forkthread(PicLoader, 0), THREAD_PRIORITY_IDLE);
diff --git a/plugins/AVS/src/options.cpp b/plugins/AVS/src/options.cpp index 7254543bb3..cead97c735 100644 --- a/plugins/AVS/src/options.cpp +++ b/plugins/AVS/src/options.cpp @@ -388,7 +388,7 @@ static INT_PTR CALLBACK DlgProcOptionsProtos(HWND hwndDlg, UINT msg, WPARAM wPar if (!db_get_ts(NULL, PPICT_MODULE, g_selectedProto, &dbv)) { if (!PathIsAbsoluteT(VARST(dbv.ptszVal))) { wchar_t szFinalPath[MAX_PATH]; - mir_sntprintf(szFinalPath, L"%%miranda_path%%\\%s", dbv.ptszVal); + mir_snwprintf(szFinalPath, L"%%miranda_path%%\\%s", dbv.ptszVal); SetDlgItemText(hwndDlg, IDC_PROTOAVATARNAME, szFinalPath); } else SetDlgItemText(hwndDlg, IDC_PROTOAVATARNAME, dbv.ptszVal); @@ -489,7 +489,7 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA TranslateDialogDefault(hwndDlg); if (hContact) { wchar_t szTitle[512]; - mir_sntprintf(szTitle, TranslateT("Set avatar options for %s"), pcli->pfnGetContactDisplayName(hContact, 0)); + mir_snwprintf(szTitle, TranslateT("Set avatar options for %s"), pcli->pfnGetContactDisplayName(hContact, 0)); SetWindowText(hwndDlg, szTitle); } SendMessage(hwndDlg, DM_SETAVATARNAME, 0, 0); @@ -1082,7 +1082,7 @@ static INT_PTR CALLBACK DlgProcAvatarProtoInfo(HWND hwndDlg, UINT msg, WPARAM wP char description[256]; CallProtoService(proto, PS_GETNAME, _countof(description), (LPARAM)description); - wchar_t *descr = mir_a2t(description); + wchar_t *descr = mir_a2u(description); if (MessageBox(hwndDlg, TranslateT("Are you sure you want to remove your avatar?"), descr, MB_YESNO) == IDYES) avSetMyAvatar(proto, L""); mir_free(descr); diff --git a/plugins/AVS/src/services.cpp b/plugins/AVS/src/services.cpp index 79a21f3b8a..817c15630e 100644 --- a/plugins/AVS/src/services.cpp +++ b/plugins/AVS/src/services.cpp @@ -347,7 +347,7 @@ void SaveImage(SaveProtocolData &d, char *protocol, int format) if (!Proto_IsAvatarFormatSupported(protocol, format))
return;
- mir_sntprintf(d.image_file_name, L"%s%s", d.temp_file, ProtoGetAvatarExtension(format));
+ mir_snwprintf(d.image_file_name, L"%s%s", d.temp_file, ProtoGetAvatarExtension(format));
if (BmpFilterSaveBitmap(d.hBmpProto, d.image_file_name, format == PA_FORMAT_JPEG ? JPEG_QUALITYSUPERB : 0))
return;
@@ -550,13 +550,13 @@ static int InternalSetMyAvatar(char *protocol, wchar_t *szFinalName, SetMyAvatar wchar_t globalFile[1024];
BOOL saved = TRUE;
if (FoldersGetCustomPathT(hGlobalAvatarFolder, globalFile, _countof(globalFile), L"")) {
- mir_sntprintf(globalFile, L"%s%s", g_szDataPath, L"GlobalAvatar");
+ mir_snwprintf(globalFile, L"%s%s", g_szDataPath, L"GlobalAvatar");
CreateDirectory(globalFile, NULL);
}
wchar_t *ext = wcsrchr(szFinalName, '.'); // Can't be NULL here
if (format == PA_FORMAT_XML || format == PA_FORMAT_SWF) {
- mir_sntprintf(globalFile, L"%s\\my_global_avatar%s", globalFile, ext);
+ mir_snwprintf(globalFile, L"%s\\my_global_avatar%s", globalFile, ext);
CopyFile(szFinalName, globalFile, FALSE);
}
else {
@@ -574,12 +574,12 @@ static int InternalSetMyAvatar(char *protocol, wchar_t *szFinalName, SetMyAvatar // Check if need to resize
if (hBmpTmp == hBmp || hBmpTmp == NULL) {
// Use original image
- mir_sntprintf(globalFile, L"%s\\my_global_avatar%s", globalFile, ext);
+ mir_snwprintf(globalFile, L"%s\\my_global_avatar%s", globalFile, ext);
CopyFile(szFinalName, globalFile, FALSE);
}
else {
// Save as PNG
- mir_sntprintf(globalFile, L"%s\\my_global_avatar.png", globalFile);
+ mir_snwprintf(globalFile, L"%s\\my_global_avatar.png", globalFile);
if (BmpFilterSaveBitmap(hBmpTmp, globalFile, 0))
saved = FALSE;
@@ -685,10 +685,10 @@ INT_PTR avSetMyAvatar(char* protocol, wchar_t* tszPath) wchar_t title[256];
if (protocol == NULL)
- mir_sntprintf(title, TranslateT("Set my avatar"));
+ mir_snwprintf(title, TranslateT("Set my avatar"));
else {
- wchar_t* prototmp = mir_a2t(protocol);
- mir_sntprintf(title, TranslateT("Set my avatar for %s"), prototmp);
+ wchar_t* prototmp = mir_a2u(protocol);
+ mir_snwprintf(title, TranslateT("Set my avatar for %s"), prototmp);
mir_free(prototmp);
}
ofn.lpstrTitle = title;
diff --git a/plugins/AVS/src/utils.cpp b/plugins/AVS/src/utils.cpp index c46fff6a58..4cfc38d67f 100644 --- a/plugins/AVS/src/utils.cpp +++ b/plugins/AVS/src/utils.cpp @@ -56,7 +56,7 @@ void MakePathRelative(MCONTACT hContact, wchar_t *path) void MakePathRelative(MCONTACT hContact)
{
- ptrT tszPath(db_get_tsa(hContact, "ContactPhoto", "File"));
+ ptrW tszPath(db_get_tsa(hContact, "ContactPhoto", "File"));
if (tszPath)
MakePathRelative(hContact, tszPath);
}
@@ -67,7 +67,7 @@ void MakePathRelative(MCONTACT hContact) int CreateAvatarInCache(MCONTACT hContact, avatarCacheEntry *ace, char *szProto)
{
- ptrT tszValue;
+ ptrW tszValue;
wchar_t tszFilename[MAX_PATH]; tszFilename[0] = 0;
ace->hbmPic = 0;
@@ -136,7 +136,7 @@ int CreateAvatarInCache(MCONTACT hContact, avatarCacheEntry *ace, char *szProto) }
}
- if (mir_tstrlen(tszFilename) < 4)
+ if (mir_wstrlen(tszFilename) < 4)
return -1;
wcsncpy_s(tszFilename, VARST(tszFilename), _TRUNCATE);
diff --git a/plugins/AddContactPlus/src/addcontact.cpp b/plugins/AddContactPlus/src/addcontact.cpp index 424976f0b0..84b1ae5768 100644 --- a/plugins/AddContactPlus/src/addcontact.cpp +++ b/plugins/AddContactPlus/src/addcontact.cpp @@ -62,7 +62,7 @@ void AddContactDlgOpts(HWND hdlg, const char* szProto, BOOL bAuthOptsOnly = FALS if (szUniqueId) {
size_t cbLen = mir_strlen(szUniqueId) + 2;
wchar_t* pszUniqueId = (wchar_t*)mir_alloc(cbLen * sizeof(wchar_t));
- mir_sntprintf(pszUniqueId, cbLen, L"%S:", szUniqueId);
+ mir_snwprintf(pszUniqueId, cbLen, L"%S:", szUniqueId);
SetDlgItemText(hdlg, IDC_IDLABEL, pszUniqueId);
mir_free(pszUniqueId);
}
@@ -126,7 +126,7 @@ bool AddContactDlgAccounts(HWND hdlg, AddDialogParam *acs) continue;
cbei.pszText = pAccounts[i]->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;
HICON hIcon = (HICON)CallProtoService(pAccounts[i]->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
cbei.iImage = cbei.iSelectedImage = ImageList_AddIcon(hIml, hIcon);
@@ -236,7 +236,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) wchar_t szUserId[256];
GetDlgItemText(hdlg, IDC_USERID, szUserId, _countof(szUserId));
- if (*rtrimt(szUserId) == 0 ||
+ if (*rtrimw(szUserId) == 0 ||
(strstr(acs->proto, "GG") && wcstoul(szUserId, NULL, 10) > INT_MAX) || // Gadu-Gadu protocol
((CallProtoService(acs->proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_NUMERICUSERID) && !wcstoul(szUserId, NULL, 10)))
{
@@ -264,7 +264,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) }
psr->flags = PSR_TCHAR;
- psr->id.w = mir_tstrdup(szUserId);
+ psr->id.w = mir_wstrdup(szUserId);
acs->psr = psr;
MCONTACT hContact = (MCONTACT)CallProtoService(acs->proto, PS_ADDTOLIST, IsDlgButtonChecked(hdlg, IDC_ADDTEMP) ? PALF_TEMPORARY : 0, (LPARAM)acs->psr);
diff --git a/plugins/Alarms/src/alarm_win.cpp b/plugins/Alarms/src/alarm_win.cpp index f39333767d..4052bc7f79 100644 --- a/plugins/Alarms/src/alarm_win.cpp +++ b/plugins/Alarms/src/alarm_win.cpp @@ -267,7 +267,7 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar #define AddItem(x) \
mii.wID++; \
mii.dwTypeData = TranslateW(x); \
- mii.cch = ( UINT )mir_tstrlen(mii.dwTypeData); \
+ mii.cch = ( UINT )mir_wstrlen(mii.dwTypeData); \
InsertMenuItem(hMenu, mii.wID, FALSE, &mii);
AddItem(LPGENW("5 mins"));
@@ -350,31 +350,31 @@ int ReloadFonts(WPARAM, LPARAM) int AlarmWinModulesLoaded(WPARAM, LPARAM)
{
title_font_id.cbSize = sizeof(FontIDT);
- mir_tstrcpy(title_font_id.group, LPGENW("Alarms"));
- mir_tstrcpy(title_font_id.name, LPGENW("Title"));
+ mir_wstrcpy(title_font_id.group, LPGENW("Alarms"));
+ mir_wstrcpy(title_font_id.name, LPGENW("Title"));
mir_strcpy(title_font_id.dbSettingsGroup, MODULE);
mir_strcpy(title_font_id.prefix, "FontTitle");
- mir_tstrcpy(title_font_id.backgroundGroup, LPGENW("Alarms"));
- mir_tstrcpy(title_font_id.backgroundName, LPGENW("Background"));
+ mir_wstrcpy(title_font_id.backgroundGroup, LPGENW("Alarms"));
+ mir_wstrcpy(title_font_id.backgroundName, LPGENW("Background"));
title_font_id.flags = 0;
title_font_id.order = 0;
FontRegisterT(&title_font_id);
window_font_id.cbSize = sizeof(FontIDT);
- mir_tstrcpy(window_font_id.group, LPGENW("Alarms"));
- mir_tstrcpy(window_font_id.name, LPGENW("Window"));
+ mir_wstrcpy(window_font_id.group, LPGENW("Alarms"));
+ mir_wstrcpy(window_font_id.name, LPGENW("Window"));
mir_strcpy(window_font_id.dbSettingsGroup, MODULE);
mir_strcpy(window_font_id.prefix, "FontWindow");
- mir_tstrcpy(window_font_id.backgroundGroup, LPGENW("Alarms"));
- mir_tstrcpy(window_font_id.backgroundName, LPGENW("Background"));
+ mir_wstrcpy(window_font_id.backgroundGroup, LPGENW("Alarms"));
+ mir_wstrcpy(window_font_id.backgroundName, LPGENW("Background"));
window_font_id.flags = 0;
window_font_id.order = 1;
FontRegisterT(&window_font_id);
bk_colour_id.cbSize = sizeof(ColourIDT);
mir_strcpy(bk_colour_id.dbSettingsGroup, MODULE);
- mir_tstrcpy(bk_colour_id.group, LPGENW("Alarms"));
- mir_tstrcpy(bk_colour_id.name, LPGENW("Background"));
+ mir_wstrcpy(bk_colour_id.group, LPGENW("Alarms"));
+ mir_wstrcpy(bk_colour_id.name, LPGENW("Background"));
mir_strcpy(bk_colour_id.setting, "BkColour");
bk_colour_id.defcolour = GetSysColor(COLOR_3DFACE);
bk_colour_id.flags = 0;
diff --git a/plugins/Alarms/src/alarmlist.cpp b/plugins/Alarms/src/alarmlist.cpp index c11ecba568..e108e04132 100644 --- a/plugins/Alarms/src/alarmlist.cpp +++ b/plugins/Alarms/src/alarmlist.cpp @@ -34,10 +34,10 @@ void copy_alarm_data(ALARM *dest, ALARM *src) { dest->time = src->time;
free_alarm_data(dest);
- dest->szTitle = mir_tstrdup(src->szTitle);
- dest->szDesc = mir_tstrdup(src->szDesc);
- dest->szCommand = mir_tstrdup(src->szCommand);
- dest->szCommandParams = mir_tstrdup(src->szCommandParams);
+ dest->szTitle = mir_wstrdup(src->szTitle);
+ dest->szDesc = mir_wstrdup(src->szDesc);
+ dest->szCommand = mir_wstrdup(src->szCommand);
+ dest->szCommandParams = mir_wstrdup(src->szCommandParams);
}
void GetPluginTime(SYSTEMTIME *t) {
@@ -191,12 +191,12 @@ void LoadAlarms() { mir_snprintf(buff, "Title%d", i);
if (!db_get_ts(0, MODULE, buff, &dbv)) {
- alarm.szTitle = mir_tstrdup(dbv.ptszVal);
+ alarm.szTitle = mir_wstrdup(dbv.ptszVal);
db_free(&dbv);
}
mir_snprintf(buff, "Desc%d", i);
if (!db_get_ts(0, MODULE, buff, &dbv)) {
- alarm.szDesc = mir_tstrdup(dbv.ptszVal);
+ alarm.szDesc = mir_wstrdup(dbv.ptszVal);
db_free(&dbv);
}
mir_snprintf(buff, "Occ%d", i);
@@ -245,11 +245,11 @@ void LoadAlarms() { if (alarm.action & AAF_COMMAND) {
mir_snprintf(buff, "ActionCommand%d", i);
if (!db_get_ts(0, MODULE, buff, &dbv)) {
- alarm.szCommand = mir_tstrdup(dbv.ptszVal);
+ alarm.szCommand = mir_wstrdup(dbv.ptszVal);
db_free(&dbv);
mir_snprintf(buff, "ActionParams%d", i);
if (!db_get_ts(0, MODULE, buff, &dbv)) {
- alarm.szCommandParams = mir_tstrdup(dbv.ptszVal);
+ alarm.szCommandParams = mir_wstrdup(dbv.ptszVal);
db_free(&dbv);
}
}
@@ -326,10 +326,10 @@ void SaveAlarms() { mir_snprintf(buff, "ActionFlags%d", index);
db_set_dw(0, MODULE, buff, i->action);
if (i->action & AAF_COMMAND) {
- if (mir_tstrlen(i->szCommand)) {
+ if (mir_wstrlen(i->szCommand)) {
mir_snprintf(buff, "ActionCommand%d", index);
db_set_ts(0, MODULE, buff, i->szCommand);
- if (mir_tstrlen(i->szCommandParams)) {
+ if (mir_wstrlen(i->szCommandParams)) {
mir_snprintf(buff, "ActionParams%d", index);
db_set_ts(0, MODULE, buff, i->szCommandParams);
}
@@ -493,8 +493,8 @@ void ShowPopup(ALARM *alarm) POPUPDATAT ppd = { 0 };
ppd.lchIcon = hIconMenuSet;
- mir_tstrncpy(ppd.lptzContactName, data->szTitle, MAX_CONTACTNAME);
- mir_tstrncpy(ppd.lptzText, data->szDesc, MAX_SECONDLINE);
+ mir_wstrncpy(ppd.lptzContactName, data->szTitle, MAX_CONTACTNAME);
+ mir_wstrncpy(ppd.lptzText, data->szDesc, MAX_SECONDLINE);
ppd.PluginWindowProc = PopupAlarmDlgProc;
ppd.PluginData = data;
ppd.iSeconds = -1;
@@ -633,10 +633,10 @@ INT_PTR AddAlarmService(WPARAM, LPARAM lParam) alarm.occurrence = alarm_info->occurrence;
alarm.snoozer = alarm_info->snoozer;
alarm.sound_num = alarm_info->sound_num;
- alarm.szCommand = mir_tstrdup(alarm_info->szCommand);
- alarm.szCommandParams = mir_tstrdup(alarm_info->szCommandParams);
- alarm.szDesc = mir_tstrdup(alarm_info->szDesc);
- alarm.szTitle = mir_tstrdup(alarm_info->szTitle);
+ alarm.szCommand = mir_wstrdup(alarm_info->szCommand);
+ alarm.szCommandParams = mir_wstrdup(alarm_info->szCommandParams);
+ alarm.szDesc = mir_wstrdup(alarm_info->szDesc);
+ alarm.szTitle = mir_wstrdup(alarm_info->szTitle);
alarm.time = alarm_info->time;
append_to_list(&alarm);
diff --git a/plugins/Alarms/src/alarms.cpp b/plugins/Alarms/src/alarms.cpp index e5b80405c2..71c2606ec0 100644 --- a/plugins/Alarms/src/alarms.cpp +++ b/plugins/Alarms/src/alarms.cpp @@ -73,8 +73,8 @@ void ShowPopup(MCONTACT hContact, const wchar_t *msg) POPUPDATAT ppd = { 0 };
ppd.lchContact = hContact; //Be sure to use a GOOD handle, since this will not be checked.
ppd.lchIcon = hIconList1;
- mir_tstrncpy(ppd.lptzContactName, lpzContactName,MAX_CONTACTNAME);
- mir_tstrncpy(ppd.lptzText, msg, MAX_SECONDLINE);
+ mir_wstrncpy(ppd.lptzContactName, lpzContactName,MAX_CONTACTNAME);
+ mir_wstrncpy(ppd.lptzText, msg, MAX_SECONDLINE);
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
ppd.colorText = RGB(0,0,0);
ppd.PluginWindowProc = PopupDlgProc;
diff --git a/plugins/Alarms/src/frame.cpp b/plugins/Alarms/src/frame.cpp index 15f0fd185f..7ad231858c 100644 --- a/plugins/Alarms/src/frame.cpp +++ b/plugins/Alarms/src/frame.cpp @@ -136,34 +136,34 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar HICON hIcon = (min <= 5 ? hIconList2 : hIconList1);
DrawIconEx(dis->hDC,dis->rcItem.left,(dis->rcItem.top + dis->rcItem.bottom - 16)>>1,hIcon,0, 0, 0, NULL, DI_NORMAL);
- GetTextExtentPoint32(dis->hDC,alarm.szTitle,(int)mir_tstrlen(alarm.szTitle),&textSize);
+ GetTextExtentPoint32(dis->hDC,alarm.szTitle,(int)mir_wstrlen(alarm.szTitle),&textSize);
wchar_t buff[100];
if (min >= 60)
- mir_sntprintf(buff, TranslateT("%dh %dm"), min / 60, min % 60);
+ mir_snwprintf(buff, TranslateT("%dh %dm"), min / 60, min % 60);
else
- mir_sntprintf(buff, TranslateT("%dm"), min);
+ mir_snwprintf(buff, TranslateT("%dm"), min);
- GetTextExtentPoint32(dis->hDC,buff,(int)mir_tstrlen(buff),&timeSize);
+ GetTextExtentPoint32(dis->hDC,buff,(int)mir_wstrlen(buff),&timeSize);
if (textSize.cx > (dis->rcItem.right - dis->rcItem.left) - (GetSystemMetrics(SM_CXSMICON) + 4) - timeSize.cx - 2 - 4) {
// need elipsis
wchar_t titlebuff[512];
- size_t len = mir_tstrlen(alarm.szTitle);
+ size_t len = mir_wstrlen(alarm.szTitle);
if (len > 511) len = 511;
while(len > 0 && textSize.cx > (dis->rcItem.right - dis->rcItem.left) - (GetSystemMetrics(SM_CXSMICON) + 4) - timeSize.cx - 2 - 4) {
len--;
wcsncpy(titlebuff, alarm.szTitle, len);
titlebuff[len] = 0;
- mir_tstrcat(titlebuff, L"...");
- GetTextExtentPoint32(dis->hDC,titlebuff,(int)mir_tstrlen(titlebuff),&textSize);
+ mir_wstrcat(titlebuff, L"...");
+ GetTextExtentPoint32(dis->hDC,titlebuff,(int)mir_wstrlen(titlebuff),&textSize);
}
- TextOut(dis->hDC,dis->rcItem.left + 16 + 4,(dis->rcItem.top + dis->rcItem.bottom - textSize.cy)>>1,titlebuff,(int)mir_tstrlen(titlebuff));
- TextOut(dis->hDC,dis->rcItem.right - timeSize.cx - 2,(dis->rcItem.top + dis->rcItem.bottom - timeSize.cy)>>1, buff,(int)mir_tstrlen(buff));
+ TextOut(dis->hDC,dis->rcItem.left + 16 + 4,(dis->rcItem.top + dis->rcItem.bottom - textSize.cy)>>1,titlebuff,(int)mir_wstrlen(titlebuff));
+ TextOut(dis->hDC,dis->rcItem.right - timeSize.cx - 2,(dis->rcItem.top + dis->rcItem.bottom - timeSize.cy)>>1, buff,(int)mir_wstrlen(buff));
}
else {
- TextOut(dis->hDC,dis->rcItem.left + 16 + 4,(dis->rcItem.top + dis->rcItem.bottom - textSize.cy)>>1,alarm.szTitle,(int)mir_tstrlen(alarm.szTitle));
- TextOut(dis->hDC,dis->rcItem.right - timeSize.cx - 2,(dis->rcItem.top + dis->rcItem.bottom - timeSize.cy)>>1, buff,(int)mir_tstrlen(buff));
+ TextOut(dis->hDC,dis->rcItem.left + 16 + 4,(dis->rcItem.top + dis->rcItem.bottom - textSize.cy)>>1,alarm.szTitle,(int)mir_wstrlen(alarm.szTitle));
+ TextOut(dis->hDC,dis->rcItem.right - timeSize.cx - 2,(dis->rcItem.top + dis->rcItem.bottom - timeSize.cy)>>1, buff,(int)mir_wstrlen(buff));
}
SetBkMode(dis->hDC, OPAQUE);
diff --git a/plugins/Alarms/src/options.cpp b/plugins/Alarms/src/options.cpp index d92f7a6685..1920adb518 100644 --- a/plugins/Alarms/src/options.cpp +++ b/plugins/Alarms/src/options.cpp @@ -417,10 +417,10 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDOK:
{
GetDlgItemText(hwndDlg, IDC_TITLE, buff, _countof(buff));
- replaceStrT(add_edit_alarm->szTitle, buff);
+ replaceStrW(add_edit_alarm->szTitle, buff);
GetDlgItemText(hwndDlg, IDC_DESC, buff, _countof(buff));
- replaceStrT(add_edit_alarm->szDesc, buff);
+ replaceStrW(add_edit_alarm->szDesc, buff);
if (add_edit_alarm->szTitle == 0 || add_edit_alarm->szTitle[0] == '\0') {
MessageBox(hwndDlg, TranslateT("Please enter a title for this alarm."), TranslateT("Error"), MB_OK | MB_ICONERROR);
@@ -447,9 +447,9 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (add_edit_alarm->action & AAF_COMMAND) {
GetDlgItemText(hwndDlg, IDC_ED_COMMAND, buff, _countof(buff));
- replaceStrT(add_edit_alarm->szCommand, buff);
+ replaceStrW(add_edit_alarm->szCommand, buff);
GetDlgItemText(hwndDlg, IDC_ED_PARAMS, buff, _countof(buff));
- replaceStrT(add_edit_alarm->szCommandParams, buff);
+ replaceStrW(add_edit_alarm->szCommandParams, buff);
}
if (add_edit_alarm->action & AAF_SOUND) {
diff --git a/plugins/AssocMgr/src/assoclist.cpp b/plugins/AssocMgr/src/assoclist.cpp index 495cb4f125..7305022b0b 100644 --- a/plugins/AssocMgr/src/assoclist.cpp +++ b/plugins/AssocMgr/src/assoclist.cpp @@ -218,14 +218,14 @@ static ASSOCDATA* CopyAssocItem(const ASSOCDATA *assoc) assoc2 = (ASSOCDATA*)mir_alloc(sizeof(ASSOCDATA));
if (assoc2 == NULL) return NULL;
assoc2->pszClassName = mir_strdup(assoc->pszClassName);
- assoc2->pszDescription = mir_tstrdup(assoc->pszDescription);
+ assoc2->pszDescription = mir_wstrdup(assoc->pszDescription);
assoc2->hInstance = assoc->hInstance;
assoc2->nIconResID = assoc->nIconResID;
assoc2->pszService = mir_strdup(assoc->pszService);
assoc2->flags = assoc->flags;
assoc2->pszFileExt = mir_strdup(assoc->pszFileExt);
assoc2->pszMimeType = mir_strdup(assoc->pszMimeType);
- assoc2->pszVerbDesc = mir_tstrdup(assoc->pszVerbDesc);
+ assoc2->pszVerbDesc = mir_wstrdup(assoc->pszVerbDesc);
if (assoc2->pszClassName == NULL || assoc2->pszDescription == NULL ||
(assoc2->pszFileExt == NULL && assoc->pszFileExt != NULL)) {
mir_free(assoc2->pszClassName); // does NULL check
@@ -268,9 +268,9 @@ static wchar_t* GetAssocTypeDesc(const ASSOCDATA *assoc) {
static wchar_t szDesc[32];
if (assoc->pszFileExt == NULL)
- mir_sntprintf(szDesc, L"%hs:", assoc->pszClassName);
+ mir_snwprintf(szDesc, L"%hs:", assoc->pszClassName);
else
- mir_sntprintf(szDesc, TranslateT("%hs files"), assoc->pszFileExt);
+ mir_snwprintf(szDesc, TranslateT("%hs files"), assoc->pszFileExt);
return szDesc;
}
diff --git a/plugins/AssocMgr/src/dde.cpp b/plugins/AssocMgr/src/dde.cpp index aca64350e7..f6c52a67df 100644 --- a/plugins/AssocMgr/src/dde.cpp +++ b/plugins/AssocMgr/src/dde.cpp @@ -79,7 +79,7 @@ static wchar_t* GetExecuteParam(wchar_t **ppszString) *(p++) = 0;
if (fQuoted && *p == ',') p++;
}
- else p = &pszParam[mir_tstrlen(pszParam)];
+ else p = &pszParam[mir_wstrlen(pszParam)];
*ppszString = p;
return pszParam;
}
@@ -115,10 +115,10 @@ static LRESULT CALLBACK DdeMessageWindow(HWND hwnd, UINT msg, WPARAM wParam, LPA if (pszArg != NULL) {
/* we are inside miranda here, we make it async so the shell does
* not timeout regardless what the plugins try to do. */
- if (!mir_tstrcmpi(pszAction, L"file"))
- CallFunctionAsync(FileActionAsync, mir_tstrdup(pszArg));
- else if (!mir_tstrcmpi(pszAction, L"url"))
- CallFunctionAsync(UrlActionAsync, mir_tstrdup(pszArg));
+ if (!mir_wstrcmpi(pszAction, L"file"))
+ CallFunctionAsync(FileActionAsync, mir_wstrdup(pszArg));
+ else if (!mir_wstrcmpi(pszAction, L"url"))
+ CallFunctionAsync(UrlActionAsync, mir_wstrdup(pszArg));
}
GlobalUnlock(hCommand);
}
@@ -170,7 +170,7 @@ static HANDLE StartupMainProcess(wchar_t *pszDatabasePath) p = wcsrchr(szPath, '\\');
if (p != NULL) { *p = 0; p = wcsrchr(szPath, '\\'); }
if (p == NULL) return NULL;
- mir_tstrcpy(++p, L"miranda32.exe");
+ mir_wstrcpy(++p, L"miranda32.exe");
/* inherit startup data from RunDll32 process */
STARTUPINFO si;
diff --git a/plugins/AssocMgr/src/main.cpp b/plugins/AssocMgr/src/main.cpp index 4f0c116c36..ddc2075d52 100644 --- a/plugins/AssocMgr/src/main.cpp +++ b/plugins/AssocMgr/src/main.cpp @@ -48,27 +48,27 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) static void InstallFile(const wchar_t *pszFileName,const wchar_t *pszDestSubDir)
{
wchar_t szFileFrom[MAX_PATH+1],szFileTo[MAX_PATH+1];
- if (!GetModuleFileName(hInst, szFileFrom, _countof(szFileFrom) - (int)mir_tstrlen(pszFileName)))
+ if (!GetModuleFileName(hInst, szFileFrom, _countof(szFileFrom) - (int)mir_wstrlen(pszFileName)))
return;
wchar_t *p = wcsrchr(szFileFrom,'\\');
if (p != NULL)
*(++p) = 0;
- mir_tstrcat(szFileFrom,pszFileName); /* buffer safe */
+ mir_wstrcat(szFileFrom,pszFileName); /* buffer safe */
HANDLE hFile = CreateFile(szFileFrom,0,FILE_SHARE_READ,0,OPEN_EXISTING,0,0);
if (hFile == INVALID_HANDLE_VALUE)
return;
CloseHandle(hFile);
- if (!GetModuleFileName(NULL, szFileTo, _countof(szFileTo)-(int)mir_tstrlen(pszDestSubDir)-(int)mir_tstrlen(pszFileName)))
+ if (!GetModuleFileName(NULL, szFileTo, _countof(szFileTo)-(int)mir_wstrlen(pszDestSubDir)-(int)mir_wstrlen(pszFileName)))
return;
p = wcsrchr(szFileTo,'\\');
if (p)
*(++p)=0;
- mir_tstrcat(szFileTo,pszDestSubDir); /* buffer safe */
+ mir_wstrcat(szFileTo,pszDestSubDir); /* buffer safe */
CreateDirectory(szFileTo,NULL);
- mir_tstrcat(szFileTo,pszFileName); /* buffer safe */
+ mir_wstrcat(szFileTo,pszFileName); /* buffer safe */
if ( !MoveFile(szFileFrom,szFileTo) && GetLastError() == ERROR_ALREADY_EXISTS) {
DeleteFile(szFileTo);
diff --git a/plugins/AssocMgr/src/reg.cpp b/plugins/AssocMgr/src/reg.cpp index 3f079b7810..842ce654a3 100644 --- a/plugins/AssocMgr/src/reg.cpp +++ b/plugins/AssocMgr/src/reg.cpp @@ -33,7 +33,7 @@ static __inline LONG regchk(LONG res, const char *pszFunc, const void *pszInfo, char *pszErr;
pszErr = GetWinErrorDescription(res);
pszInfo2 = s2t(pszInfo, fInfoUnicode, FALSE); /* does NULL check */
- mir_sntprintf(szMsg, TranslateT("Access failed:\n%.64hs(%.128s)\n%.250hs(%u)\n%.256hs (%u)"), pszFunc, pszInfo2, pszFile, nLine, pszErr, res);
+ mir_snwprintf(szMsg, TranslateT("Access failed:\n%.64hs(%.128s)\n%.250hs(%u)\n%.256hs (%u)"), pszFunc, pszInfo2, pszFile, nLine, pszErr, res);
MessageBox(NULL, szMsg, TranslateT("Registry warning"), MB_OK | MB_ICONINFORMATION | MB_SETFOREGROUND | MB_TOPMOST | MB_TASKMODAL);
if (pszErr != NULL) LocalFree(pszErr);
mir_free(pszInfo2); /* does NULL check */
@@ -133,7 +133,7 @@ wchar_t *MakeRunCommand(BOOL fMirExe,BOOL fFixedDbProfile) if (p)
*p = 0;
}
- else mir_tstrcpy(szDbFile, L"%1"); /* buffer safe */
+ else mir_wstrcpy(szDbFile, L"%1"); /* buffer safe */
if ( !GetModuleFileName(fMirExe ? NULL : hInst, szExe, _countof(szExe)))
return NULL;
@@ -147,7 +147,7 @@ wchar_t *MakeRunCommand(BOOL fMirExe,BOOL fFixedDbProfile) /* ensure the command line is not too long */
GetShortPathName(szExe, szExe, _countof(szExe));
/* surround by quotes if failed */
- size_t len = mir_tstrlen(szExe);
+ size_t len = mir_wstrlen(szExe);
if ( wcschr(szExe,' ') != NULL && (len+2) < _countof(szExe)) {
memmove(szExe, szExe+1, (len+1)*sizeof(wchar_t));
szExe[len+2] = szExe[0] = '\"';
@@ -156,15 +156,15 @@ wchar_t *MakeRunCommand(BOOL fMirExe,BOOL fFixedDbProfile) }
wchar_t tszBuffer[1024];
- mir_sntprintf(tszBuffer, pszFmt, szExe, szDbFile);
- return mir_tstrdup(tszBuffer);
+ mir_snwprintf(tszBuffer, pszFmt, szExe, szDbFile);
+ return mir_wstrdup(tszBuffer);
}
static BOOL IsValidRunCommand(const wchar_t *pszRunCmd)
{
wchar_t *buf,*pexe,*pargs;
wchar_t szFullExe[MAX_PATH],*pszFilePart;
- buf=mir_tstrcpy((wchar_t*)_alloca((mir_tstrlen(pszRunCmd)+1)*sizeof(wchar_t)),pszRunCmd);
+ buf=mir_wstrcpy((wchar_t*)_alloca((mir_wstrlen(pszRunCmd)+1)*sizeof(wchar_t)),pszRunCmd);
/* split into executable path and arguments */
if (buf[0]=='\"') {
pargs=wcschr(&buf[1],'\"');
@@ -178,7 +178,7 @@ static BOOL IsValidRunCommand(const wchar_t *pszRunCmd) }
if (SearchPath(NULL,pexe,L".exe",_countof(szFullExe),szFullExe,&pszFilePart)) {
if (pszFilePart!=NULL)
- if (!mir_tstrcmpi(pszFilePart,L"rundll32.exe") || !mir_tstrcmpi(pszFilePart,L"rundll.exe")) {
+ if (!mir_wstrcmpi(pszFilePart,L"rundll32.exe") || !mir_wstrcmpi(pszFilePart,L"rundll.exe")) {
/* split into dll path and arguments */
if (pargs[0]=='\"') {
++pargs;
@@ -203,7 +203,7 @@ wchar_t *MakeIconLocation(HMODULE hModule,WORD nIconResID) if ((cch=GetModuleFileName(hModule,szModule,_countof(szModule))) != 0) {
pszIconLoc=(wchar_t*)mir_alloc((cch+=8)*sizeof(wchar_t));
if (pszIconLoc!=NULL)
- mir_sntprintf(pszIconLoc, cch, L"%s,%i", szModule, -(int)nIconResID); /* id may be 0, buffer safe */
+ mir_snwprintf(pszIconLoc, cch, L"%s,%i", szModule, -(int)nIconResID); /* id may be 0, buffer safe */
}
return pszIconLoc;
}
@@ -216,7 +216,7 @@ wchar_t *MakeAppFileName(BOOL fMirExe) psz=wcsrchr(szExe,'\\');
if (psz!=NULL) ++psz;
else psz=szExe;
- return mir_tstrdup(psz);
+ return mir_wstrdup(psz);
}
return NULL;
}
@@ -253,7 +253,7 @@ static LONG SetRegSubKeyStrDefValue(HKEY hMainKey,const wchar_t *pszSubKey,const HKEY hSubKey;
LONG res=RegCreateKeyEx(hMainKey,pszSubKey,0,NULL,0,KEY_SET_VALUE|KEY_QUERY_VALUE,NULL,&hSubKey,NULL);
if (!res) {
- res=RegSetValueEx(hSubKey,NULL,0,REG_SZ,(BYTE*)pszVal,(int)(mir_tstrlen(pszVal)+1)*sizeof(wchar_t));
+ res=RegSetValueEx(hSubKey,NULL,0,REG_SZ,(BYTE*)pszVal,(int)(mir_wstrlen(pszVal)+1)*sizeof(wchar_t));
RegCloseKey(hSubKey);
}
return res;
@@ -262,9 +262,9 @@ static LONG SetRegSubKeyStrDefValue(HKEY hMainKey,const wchar_t *pszSubKey,const // hKey must have been opened with KEY_SET_VALUE access right
static void SetRegStrPrefixValue(HKEY hKey,const wchar_t *pszValPrefix,const wchar_t *pszVal)
{
- size_t dwSize = (mir_tstrlen(pszVal)+mir_tstrlen(pszValPrefix)+1)*sizeof(wchar_t);
+ size_t dwSize = (mir_wstrlen(pszVal)+mir_wstrlen(pszValPrefix)+1)*sizeof(wchar_t);
wchar_t *pszStr = (wchar_t*)_alloca(dwSize);
- mir_tstrcat(mir_tstrcpy(pszStr, pszValPrefix), pszVal); /* buffer safe */
+ mir_wstrcat(mir_wstrcpy(pszStr, pszValPrefix), pszVal); /* buffer safe */
RegSetValueEx(hKey, NULL, 0, REG_SZ, (BYTE*)pszStr, (int)dwSize);
}
@@ -304,7 +304,7 @@ static BOOL IsRegStrValue(HKEY hKey,const wchar_t *pszValName,const wchar_t *psz BOOL fSame=FALSE;
wchar_t *pszVal=GetRegStrValue(hKey,pszValName);
if (pszVal!=NULL) {
- fSame=!mir_tstrcmp(pszVal,pszCmpVal);
+ fSame=!mir_wstrcmp(pszVal,pszCmpVal);
mir_free(pszVal);
}
return fSame;
@@ -601,7 +601,7 @@ BOOL AddRegClass(const char *pszClassName,const wchar_t *pszTypeDescription,cons if (fUrlProto) BackupRegTree(hRootKey,pszClassName,"bak_");
/* type description */
if (fUrlProto) SetRegStrPrefixValue(hClassKey,L"URL:",pszTypeDescription);
- else RegSetValueEx(hClassKey,NULL,0,REG_SZ,(BYTE*)pszTypeDescription,(int)(mir_tstrlen(pszTypeDescription)+1)*sizeof(wchar_t));
+ else RegSetValueEx(hClassKey,NULL,0,REG_SZ,(BYTE*)pszTypeDescription,(int)(mir_wstrlen(pszTypeDescription)+1)*sizeof(wchar_t));
/* default icon */
if (pszIconLoc!=NULL) SetRegSubKeyStrDefValue(hClassKey,L"DefaultIcon",pszIconLoc);
/* url protocol */
@@ -629,16 +629,16 @@ BOOL AddRegClass(const char *pszClassName,const wchar_t *pszTypeDescription,cons if ((res=RegCreateKeyEx(hShellKey,L"open",0,NULL,0,KEY_SET_VALUE|KEY_CREATE_SUB_KEY|DELETE,NULL,&hVerbKey,NULL))==ERROR_SUCCESS) {
/* verb description */
if (pszVerbDesc==NULL) RegDeleteValue(hVerbKey,NULL);
- else RegSetValueEx(hVerbKey,NULL,0,REG_SZ,(BYTE*)pszVerbDesc,(int)(mir_tstrlen(pszVerbDesc)+1)*sizeof(wchar_t));
+ else RegSetValueEx(hVerbKey,NULL,0,REG_SZ,(BYTE*)pszVerbDesc,(int)(mir_wstrlen(pszVerbDesc)+1)*sizeof(wchar_t));
/* friendly appname (mui string) */
- RegSetValueEx(hVerbKey,L"FriendlyAppName",0,REG_SZ,(BYTE*)pszAppName,(int)(mir_tstrlen(pszAppName)+1)*sizeof(wchar_t));
+ RegSetValueEx(hVerbKey,L"FriendlyAppName",0,REG_SZ,(BYTE*)pszAppName,(int)(mir_wstrlen(pszAppName)+1)*sizeof(wchar_t));
/* command */
SetRegSubKeyStrDefValue(hVerbKey,L"command",pszRunCmd);
/* ddeexec */
if (pszDdeCmd!=NULL) {
if (!RegCreateKeyEx(hVerbKey,L"ddeexec",0,NULL,0,KEY_SET_VALUE|KEY_CREATE_SUB_KEY|DELETE,NULL,&hDdeKey,NULL)) {
/* command */
- RegSetValueEx(hDdeKey,NULL,0,REG_SZ,(BYTE*)pszDdeCmd,(int)(mir_tstrlen(pszDdeCmd)+1)*sizeof(wchar_t));
+ RegSetValueEx(hDdeKey,NULL,0,REG_SZ,(BYTE*)pszDdeCmd,(int)(mir_wstrlen(pszDdeCmd)+1)*sizeof(wchar_t));
/* application */
SetRegSubKeyStrDefValue(hDdeKey,L"application",pszDdeApp);
/* topic */
@@ -993,7 +993,7 @@ void AddRegOpenWith(const wchar_t *pszAppFileName,BOOL fAllowOpenWith,const wcha /* filename */
if (!RegCreateKeyEx(hAppsKey,pszAppFileName,0,NULL,0,KEY_SET_VALUE|KEY_CREATE_SUB_KEY,NULL,&hExeKey,NULL)) {
/* appname */
- RegSetValueEx(hExeKey,NULL,0,REG_SZ,(BYTE*)pszAppName,(int)(mir_tstrlen(pszAppName)+1)*sizeof(wchar_t));
+ RegSetValueEx(hExeKey,NULL,0,REG_SZ,(BYTE*)pszAppName,(int)(mir_wstrlen(pszAppName)+1)*sizeof(wchar_t));
/* no open-with flag */
if (fAllowOpenWith) RegDeleteValue(hExeKey,L"NoOpenWith");
else RegSetValueEx(hExeKey,L"NoOpenWith",0,REG_SZ,NULL,0);
@@ -1006,14 +1006,14 @@ void AddRegOpenWith(const wchar_t *pszAppFileName,BOOL fAllowOpenWith,const wcha /* verb */
if (!RegCreateKeyEx(hShellKey,L"open",0,NULL,0,KEY_SET_VALUE|KEY_CREATE_SUB_KEY,NULL,&hVerbKey,NULL)) {
/* friendly appname (mui string) */
- RegSetValueEx(hVerbKey,L"FriendlyAppName",0,REG_SZ,(BYTE*)pszAppName,(int)(mir_tstrlen(pszAppName)+1)*sizeof(wchar_t));
+ RegSetValueEx(hVerbKey,L"FriendlyAppName",0,REG_SZ,(BYTE*)pszAppName,(int)(mir_wstrlen(pszAppName)+1)*sizeof(wchar_t));
/* command */
SetRegSubKeyStrDefValue(hVerbKey,L"command",pszRunCmd);
/* ddeexec */
if (pszDdeCmd!=NULL)
if (!RegCreateKeyEx(hVerbKey,L"ddeexec",0,NULL,0,KEY_SET_VALUE|KEY_CREATE_SUB_KEY,NULL,&hDdeKey,NULL)) {
/* command */
- RegSetValueEx(hDdeKey,NULL,0,REG_SZ,(BYTE*)pszDdeCmd,(int)(mir_tstrlen(pszDdeCmd)+1)*sizeof(wchar_t));
+ RegSetValueEx(hDdeKey,NULL,0,REG_SZ,(BYTE*)pszDdeCmd,(int)(mir_wstrlen(pszDdeCmd)+1)*sizeof(wchar_t));
/* application */
SetRegSubKeyStrDefValue(hDdeKey,L"application",pszDdeApp);
/* topic */
@@ -1101,7 +1101,7 @@ void AddRegOpenWithExtEntry(const wchar_t *pszAppFileName,const char *pszFileExt wchar_t *ptszFileExt;
ptszFileExt=a2t(pszFileExt);
if (ptszFileExt!=NULL)
- RegSetValueEx(hTypesKey,ptszFileExt,0,REG_SZ,(BYTE*)pszFileDesc,(int)(mir_tstrlen(pszFileDesc)+1)*sizeof(wchar_t));
+ RegSetValueEx(hTypesKey,ptszFileExt,0,REG_SZ,(BYTE*)pszFileDesc,(int)(mir_wstrlen(pszFileDesc)+1)*sizeof(wchar_t));
mir_free(ptszFileExt); /* does NULL check */
RegCloseKey(hTypesKey);
}
@@ -1154,7 +1154,7 @@ BOOL AddRegRunEntry(const wchar_t *pszAppName,const wchar_t *pszRunCmd) /* run */
if (!RegCreateKeyEx(HKEY_CURRENT_USER,L"Software\\Microsoft\\Windows\\CurrentVersion\\Run",0,NULL,0,KEY_SET_VALUE,NULL,&hRunKey,NULL)) {
/* appname */
- fSuccess=!RegSetValueEx(hRunKey,pszAppName,0,REG_SZ,(BYTE*)pszRunCmd,(int)(mir_tstrlen(pszRunCmd)+1)*sizeof(wchar_t));
+ fSuccess=!RegSetValueEx(hRunKey,pszAppName,0,REG_SZ,(BYTE*)pszRunCmd,(int)(mir_wstrlen(pszRunCmd)+1)*sizeof(wchar_t));
RegCloseKey(hRunKey);
}
return fSuccess;
diff --git a/plugins/AutoRun/src/main.cpp b/plugins/AutoRun/src/main.cpp index 7781742096..eddc483179 100644 --- a/plugins/AutoRun/src/main.cpp +++ b/plugins/AutoRun/src/main.cpp @@ -33,7 +33,7 @@ void GetProfilePath(wchar_t *res, size_t resLen) wchar_t *p = wcsrchr(dbname, '.');
if (p) *p = 0;
- mir_sntprintf(res, resLen, L"\"%s\" \"/profile:%s\"", exename, dbname);
+ mir_snwprintf(res, resLen, L"\"%s\" \"/profile:%s\"", exename, dbname);
}
static void SetAutorun(BOOL autorun)
@@ -45,7 +45,7 @@ static void SetAutorun(BOOL autorun) if ( RegCreateKeyEx(ROOT_KEY, SUB_KEY, 0, NULL, 0, KEY_CREATE_SUB_KEY|KEY_SET_VALUE,NULL,&hKey,&dw) == ERROR_SUCCESS) {
wchar_t result[MAX_PATH];
GetProfilePath(result, _countof(result));
- RegSetValueEx(hKey, L"MirandaNG", 0, REG_SZ, (BYTE*)result, sizeof(wchar_t)*(DWORD)mir_tstrlen(result));
+ RegSetValueEx(hKey, L"MirandaNG", 0, REG_SZ, (BYTE*)result, sizeof(wchar_t)*(DWORD)mir_wstrlen(result));
RegCloseKey(hKey);
}
break;
@@ -70,7 +70,7 @@ static BOOL CmpCurrentAndRegistry() return FALSE;
GetProfilePath(result, _countof(result));
- return mir_tstrcmpi(result, dbpath) == 0;
+ return mir_wstrcmpi(result, dbpath) == 0;
}
static INT_PTR CALLBACK DlgProcAutorunOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam)
diff --git a/plugins/AutoShutdown/src/frame.cpp b/plugins/AutoShutdown/src/frame.cpp index 972102796f..f89a183373 100644 --- a/plugins/AutoShutdown/src/frame.cpp +++ b/plugins/AutoShutdown/src/frame.cpp @@ -422,7 +422,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP if (hdc != NULL) {
if (dat->hFont != NULL)
hFontPrev = (HFONT)SelectObject(hdc, dat->hFont);
- if (GetTextExtentPoint32(hdc, szOutput, (int)mir_tstrlen(szOutput), &size))
+ if (GetTextExtentPoint32(hdc, szOutput, (int)mir_wstrlen(szOutput), &size))
if (size.cx >= (rc.right - rc.left))
dat->flags &= FWPDF_TIMEISCLIPPED;
if (dat->hFont != NULL)
@@ -468,7 +468,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP if (dat->fTimeFlags&SDWTF_ST_TIME)
GetFormatedDateTime(szTime, _countof(szTime), dat->settingLastTime, FALSE);
else GetFormatedCountdown(szTime, _countof(szTime), dat->countdown);
- mir_sntprintf(ttdi->szText, L"%s %s", (dat->fTimeFlags&SDWTF_ST_TIME) ? TranslateT("Shutdown at:") : TranslateT("Time left:"), szTime);
+ mir_snwprintf(ttdi->szText, L"%s %s", (dat->fTimeFlags&SDWTF_ST_TIME) ? TranslateT("Shutdown at:") : TranslateT("Time left:"), szTime);
ttdi->lpszText = ttdi->szText;
}
return 0;
diff --git a/plugins/AutoShutdown/src/settingsdlg.cpp b/plugins/AutoShutdown/src/settingsdlg.cpp index 33a4e647c4..0488ef6a65 100644 --- a/plugins/AutoShutdown/src/settingsdlg.cpp +++ b/plugins/AutoShutdown/src/settingsdlg.cpp @@ -48,7 +48,7 @@ static BOOL CALLBACK DisplayCpuUsageProc(BYTE nCpuUsage, LPARAM lParam) return FALSE; /* stop poll thread */
wchar_t str[64];
- mir_sntprintf(str, TranslateT("(current: %u%%)"), nCpuUsage);
+ mir_snwprintf(str, TranslateT("(current: %u%%)"), nCpuUsage);
SetWindowText((HWND)lParam, str);
return TRUE;
}
diff --git a/plugins/AutoShutdown/src/shutdownsvc.cpp b/plugins/AutoShutdown/src/shutdownsvc.cpp index b77aab3558..e8ba15d8a0 100644 --- a/plugins/AutoShutdown/src/shutdownsvc.cpp +++ b/plugins/AutoShutdown/src/shutdownsvc.cpp @@ -384,7 +384,7 @@ static INT_PTR CALLBACK ShutdownDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case M_UPDATE_COUNTDOWN: /* lParam=(WORD)countdown */
{
wchar_t szText[256];
- mir_sntprintf(szText, TranslateTS(desc[shutdownType - 1]), lParam);
+ mir_snwprintf(szText, TranslateTS(desc[shutdownType - 1]), lParam);
SetDlgItemText(hwndDlg, IDC_TEXT_HEADER, szText);
/* countdown finished */
if (!lParam)
diff --git a/plugins/AutoShutdown/src/utils.cpp b/plugins/AutoShutdown/src/utils.cpp index ffe41e4a0a..c6724ab982 100644 --- a/plugins/AutoShutdown/src/utils.cpp +++ b/plugins/AutoShutdown/src/utils.cpp @@ -52,7 +52,7 @@ void TrimString(wchar_t *pszStr) wchar_t *psz, szChars[] = L" \r\n\t";
for (int i = 0; i < _countof(szChars); ++i) {
/* trim end */
- psz = &pszStr[mir_tstrlen(pszStr) - 1];
+ psz = &pszStr[mir_wstrlen(pszStr) - 1];
while (pszStr[0] && *psz == szChars[i]) {
*psz = 0;
psz = CharPrev(pszStr, psz);
@@ -60,7 +60,7 @@ void TrimString(wchar_t *pszStr) /* trim beginning */
for (psz = pszStr; (*psz && *psz == szChars[i]); psz = CharNext(psz))
;
- memmove(pszStr, psz, (mir_tstrlen(psz) + 1)*sizeof(wchar_t));
+ memmove(pszStr, psz, (mir_wstrlen(psz) + 1)*sizeof(wchar_t));
}
}
@@ -199,7 +199,7 @@ BOOL GetFormatedDateTime(wchar_t *pszOut, int nSize, time_t timestamp, BOOL fSho return FALSE;
if (!GetDateFormat(locale, DATE_SHORTDATE, &st, NULL, szDate, _countof(szDate)))
return FALSE;
- mir_sntprintf(pszOut, nSize, L"%s %s", szTime, szDate);
+ mir_snwprintf(pszOut, nSize, L"%s %s", szTime, szDate);
return TRUE;
}
}
diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp index 623d4a8c0e..ebd5c219a7 100644 --- a/plugins/AvatarHistory/src/AvatarDlg.cpp +++ b/plugins/AvatarHistory/src/AvatarDlg.cpp @@ -136,7 +136,7 @@ static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM l wchar_t *displayName = pcli->pfnGetContactDisplayName(data->hContact, 0);
if (displayName) {
wchar_t title[MAX_PATH];
- mir_sntprintf(title, TranslateT("Avatar History for %s"), displayName);
+ mir_snwprintf(title, TranslateT("Avatar History for %s"), displayName);
SetWindowText(hwnd, title);
}
@@ -356,8 +356,8 @@ int AddFileToList(wchar_t *path,wchar_t *lnk,wchar_t *filename, HWND list) {
// Add to list
ListEntry *le = new ListEntry();
- le->filename = mir_tstrdup(path);
- le->filelink = mir_tstrdup(lnk);
+ le->filename = mir_wstrdup(path);
+ le->filelink = mir_wstrdup(lnk);
wchar_t *p = wcschr(filename, '.');
if (p != NULL)
@@ -374,7 +374,7 @@ int FillAvatarListFromFiles(HWND list, MCONTACT hContact) WIN32_FIND_DATA finddata;
GetContactFolder(dir, hContact);
- mir_sntprintf(path, L"%s\\*.*", dir);
+ mir_snwprintf(path, L"%s\\*.*", dir);
HANDLE hFind = FindFirstFile(path, &finddata);
if (hFind == INVALID_HANDLE_VALUE)
@@ -384,7 +384,7 @@ int FillAvatarListFromFiles(HWND list, MCONTACT hContact) {
if (finddata.cFileName[0] != '.')
{
- mir_sntprintf(path, L"%s\\%s", dir, finddata.cFileName);
+ mir_snwprintf(path, L"%s\\%s", dir, finddata.cFileName);
max_pos = AddFileToList(path,finddata.cFileName,finddata.cFileName,list);
}
}
@@ -401,7 +401,7 @@ int FillAvatarListFromFolder(HWND list, MCONTACT hContact) WIN32_FIND_DATA finddata;
GetContactFolder(dir, hContact);
- mir_sntprintf(path, L"%s\\*.lnk", dir);
+ mir_snwprintf(path, L"%s\\*.lnk", dir);
HANDLE hFind = FindFirstFile(path, &finddata);
if (hFind == INVALID_HANDLE_VALUE)
@@ -412,7 +412,7 @@ int FillAvatarListFromFolder(HWND list, MCONTACT hContact) if (finddata.cFileName[0] != '.')
{
wchar_t lnk[MAX_PATH];
- mir_sntprintf(lnk, L"%s\\%s", dir, finddata.cFileName);
+ mir_snwprintf(lnk, L"%s\\%s", dir, finddata.cFileName);
if (ResolveShortcut(lnk, path))
max_pos = AddFileToList(path,lnk,finddata.cFileName,list);
}
@@ -440,13 +440,13 @@ int FillAvatarListFromDB(HWND list, MCONTACT hContact) // Get file in disk
wchar_t path[MAX_PATH];
- ptrT tszStoredPath(mir_utf8decodeT((char*)dbei.pBlob));
+ ptrW tszStoredPath(mir_utf8decodeW((char*)dbei.pBlob));
PathToAbsoluteT(tszStoredPath, path);
// Add to list
ListEntry *le = new ListEntry();
le->hDbEvent = hDbEvent;
- le->filename = mir_tstrdup(path);
+ le->filename = mir_wstrdup(path);
max_pos = SendMessage(list,LB_ADDSTRING, 0, (LPARAM)date);
SendMessage(list, LB_SETITEMDATA, max_pos, (LPARAM)le);
}
@@ -550,7 +550,7 @@ int ShowSaveDialog(HWND hwnd, wchar_t* fn, MCONTACT hContact) wchar_t title[MAX_PATH];
if (displayName)
{
- mir_sntprintf(title, TranslateT("Save Avatar for %s"), displayName);
+ mir_snwprintf(title, TranslateT("Save Avatar for %s"), displayName);
ofn.lpstrTitle = title;
}
else
diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp index 46547ae455..a678580bcc 100644 --- a/plugins/AvatarHistory/src/AvatarHistory.cpp +++ b/plugins/AvatarHistory/src/AvatarHistory.cpp @@ -120,7 +120,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) CONTACTAVATARCHANGEDNOTIFICATION* avatar = (CONTACTAVATARCHANGEDNOTIFICATION*)lParam;
if (avatar == NULL) {
- if (!ret || !mir_tstrcmp(dbvOldHash.ptszVal, L"-")) {
+ if (!ret || !mir_wstrcmp(dbvOldHash.ptszVal, L"-")) {
//avoid duplicate "removed avatar" notifications
//do not notify on an empty profile
ShowDebugPopup(hContact, TranslateT("AVH Debug"), TranslateT("Removed avatar, no avatar before... skipping"));
@@ -136,7 +136,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) ShowPopup(hContact, NULL, opts.popup_removed);
}
else {
- if (ret && !mir_tstrcmp(dbvOldHash.ptszVal, avatar->hash)) {
+ if (ret && !mir_wstrcmp(dbvOldHash.ptszVal, avatar->hash)) {
// same avatar hash, skipping
ShowDebugPopup(hContact, TranslateT("AVH Debug"), TranslateT("Hashes are the same... skipping"));
db_free(&dbvOldHash);
@@ -178,7 +178,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) wchar_t *file = GetCachedAvatar(proto, hash);
if (file != NULL) {
- mir_tstrncpy(history_filename, file, _countof(history_filename));
+ mir_wstrncpy(history_filename, file, _countof(history_filename));
mir_free(file);
}
else {
@@ -187,7 +187,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) else
GetProtocolFolder(history_filename, proto);
- mir_sntprintf(history_filename,
+ mir_snwprintf(history_filename,
L"%s\\%s", history_filename, hash);
if (CopyImageFile(avatar->filename, history_filename))
@@ -236,7 +236,7 @@ static int PreShutdown(WPARAM, LPARAM) static int ModulesLoaded(WPARAM, LPARAM)
{
- mir_sntprintf(basedir, L"%s\\Avatars History", profilePath);
+ mir_snwprintf(basedir, L"%s\\Avatars History", profilePath);
hFolder = FoldersRegisterCustomPathT( LPGEN("Avatars"), LPGEN("Avatar History"),
PROFILE_PATHT L"\\" CURRENT_PROFILET L"\\Avatars History");
@@ -344,7 +344,7 @@ extern "C" __declspec(dllexport) int Load(void) CreateServiceFunction(MS_AVATARHISTORY_GET_CACHED_AVATAR, GetCachedAvatar);
if (CallService(MS_DB_GETPROFILEPATHT, MAX_PATH, (LPARAM)profilePath) != 0)
- mir_tstrcpy(profilePath, L"."); // Failed, use current dir
+ mir_wstrcpy(profilePath, L"."); // Failed, use current dir
SkinAddNewSoundExT("avatar_changed",LPGENW("Avatar History"),LPGENW("Contact changed avatar"));
SkinAddNewSoundExT("avatar_removed",LPGENW("Avatar History"),LPGENW("Contact removed avatar"));
diff --git a/plugins/AvatarHistory/src/popup.cpp b/plugins/AvatarHistory/src/popup.cpp index f936953b4b..165741a06e 100644 --- a/plugins/AvatarHistory/src/popup.cpp +++ b/plugins/AvatarHistory/src/popup.cpp @@ -105,13 +105,13 @@ void ShowPopupEx(MCONTACT hContact, const wchar_t *title, const wchar_t *descrip ((PopupDataType*)ppd.PluginData)->hIcon = ppd.lchIcon;
if (title != NULL)
- mir_tstrncpy(ppd.lptzContactName, title, _countof(ppd.lptzContactName));
+ mir_wstrncpy(ppd.lptzContactName, title, _countof(ppd.lptzContactName));
else if (hContact != NULL)
- mir_tstrncpy(ppd.lptzContactName, (wchar_t *)pcli->pfnGetContactDisplayName(hContact, 0),
+ mir_wstrncpy(ppd.lptzContactName, (wchar_t *)pcli->pfnGetContactDisplayName(hContact, 0),
_countof(ppd.lptzContactName));
if (description != NULL)
- mir_tstrncpy(ppd.lptzText, description, _countof(ppd.lptzText));
+ mir_wstrncpy(ppd.lptzText, description, _countof(ppd.lptzText));
if (type == POPUP_TYPE_NORMAL || type == POPUP_TYPE_TEST)
{
diff --git a/plugins/AvatarHistory/src/utils.cpp b/plugins/AvatarHistory/src/utils.cpp index 07ef4f9e97..e3c7bbe109 100644 --- a/plugins/AvatarHistory/src/utils.cpp +++ b/plugins/AvatarHistory/src/utils.cpp @@ -104,7 +104,7 @@ wchar_t* GetProtocolFolder(wchar_t *fn, char *proto) if (proto == NULL)
proto = Translate("Unknown Protocol");
- mir_sntprintf(fn, MAX_PATH, L"%s\\%S", fn, proto);
+ mir_snwprintf(fn, MAX_PATH, L"%s\\%S", fn, proto);
CreateDirectoryTreeT(fn);
return fn;
}
@@ -115,15 +115,15 @@ wchar_t* GetContactFolder(wchar_t *fn, MCONTACT hContact) GetProtocolFolder(fn, proto);
wchar_t uin[MAX_PATH];
- ptrT id(Contact_GetInfo(CNF_UNIQUEID, hContact, proto));
+ ptrW id(Contact_GetInfo(CNF_UNIQUEID, hContact, proto));
wcsncpy_s(uin, (id == NULL) ? TranslateT("Unknown UIN") : id, _TRUNCATE);
ConvertToFilename(uin, MAX_PATH); //added so that weather id's like "yw/CI0000" work
- mir_sntprintf(fn, MAX_PATH, L"%s\\%s", fn, uin);
+ mir_snwprintf(fn, MAX_PATH, L"%s\\%s", fn, uin);
CreateDirectoryTreeT(fn);
#ifdef DBGPOPUPS
wchar_t log[1024];
- mir_sntprintf(log, L"Path: %s\nProto: %S\nUIN: %s", fn, proto, uin);
+ mir_snwprintf(log, L"Path: %s\nProto: %S\nUIN: %s", fn, proto, uin);
ShowPopup(hContact, L"AVH Debug: GetContactFolder", log);
#endif
@@ -136,7 +136,7 @@ wchar_t* GetOldStyleAvatarName(wchar_t *fn, MCONTACT hContact) SYSTEMTIME curtime;
GetLocalTime(&curtime);
- mir_sntprintf(fn, MAX_PATH,
+ mir_snwprintf(fn, MAX_PATH,
L"%s\\%04d-%02d-%02d %02dh%02dm%02ds", fn,
curtime.wYear, curtime.wMonth, curtime.wDay,
curtime.wHour, curtime.wMinute, curtime.wSecond);
@@ -150,7 +150,7 @@ void CreateOldStyleShortcut(MCONTACT hContact, wchar_t *history_filename) GetOldStyleAvatarName(shortcut, hContact);
- mir_sntprintf(shortcut, L"%s.%s.lnk", shortcut,
+ mir_snwprintf(shortcut, L"%s.%s.lnk", shortcut,
GetExtension(history_filename));
if (!CreateShortcut(history_filename, shortcut))
@@ -166,7 +166,7 @@ void CreateOldStyleShortcut(MCONTACT hContact, wchar_t *history_filename) BOOL CopyImageFile(wchar_t *old_file, wchar_t *new_file)
{
wchar_t *ext = GetExtension(old_file);
- mir_sntprintf(new_file, MAX_PATH, L"%s.%s", new_file, ext);
+ mir_snwprintf(new_file, MAX_PATH, L"%s.%s", new_file, ext);
return !CopyFile(old_file, new_file, TRUE);
}
@@ -180,7 +180,7 @@ wchar_t * GetCachedAvatar(char *proto, wchar_t *hash) else
GetProtocolFolder(file, proto);
- mir_sntprintf(search, L"%s\\%s.*", file, hash);
+ mir_snwprintf(search, L"%s\\%s.*", file, hash);
WIN32_FIND_DATA finddata;
HANDLE hFind = FindFirstFile(search, &finddata);
@@ -189,16 +189,16 @@ wchar_t * GetCachedAvatar(char *proto, wchar_t *hash) do
{
- size_t len = mir_tstrlen(finddata.cFileName);
+ size_t len = mir_wstrlen(finddata.cFileName);
if (len > 4
- && (!mir_tstrcmpi(&finddata.cFileName[len-4], L".png")
- || !mir_tstrcmpi(&finddata.cFileName[len-4], L".bmp")
- || !mir_tstrcmpi(&finddata.cFileName[len-4], L".gif")
- || !mir_tstrcmpi(&finddata.cFileName[len-4], L".jpg")
- || !mir_tstrcmpi(&finddata.cFileName[len-5], L".jpeg")))
+ && (!mir_wstrcmpi(&finddata.cFileName[len-4], L".png")
+ || !mir_wstrcmpi(&finddata.cFileName[len-4], L".bmp")
+ || !mir_wstrcmpi(&finddata.cFileName[len-4], L".gif")
+ || !mir_wstrcmpi(&finddata.cFileName[len-4], L".jpg")
+ || !mir_wstrcmpi(&finddata.cFileName[len-5], L".jpeg")))
{
- mir_sntprintf(file, L"%s\\%s", file, finddata.cFileName);
- ret = mir_tstrdup(file);
+ mir_snwprintf(file, L"%s\\%s", file, finddata.cFileName);
+ ret = mir_wstrdup(file);
break;
}
} while(FindNextFile(hFind, &finddata));
diff --git a/plugins/BASS_interface/src/Main.cpp b/plugins/BASS_interface/src/Main.cpp index ea4c0c93fc..8e3ab62e57 100644 --- a/plugins/BASS_interface/src/Main.cpp +++ b/plugins/BASS_interface/src/Main.cpp @@ -188,7 +188,7 @@ INT_PTR CALLBACK OptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara }
else {
DWORD bassver = BASS_GetVersion();
- mir_sntprintf(tmp, TranslateT("un4seen's bass version: %d.%d.%d.%d"), bassver >> 24, (bassver >> 16) & 0xff, (bassver >> 8) & 0xff, bassver & 0xff);
+ mir_snwprintf(tmp, TranslateT("un4seen's bass version: %d.%d.%d.%d"), bassver >> 24, (bassver >> 16) & 0xff, (bassver >> 8) & 0xff, bassver & 0xff);
SetDlgItemText(hwndDlg, IDC_BASSVERSION, tmp);
SendDlgItemMessage(hwndDlg, IDC_OUTDEVICE, CB_RESETCONTENT, 0, 0);
@@ -196,10 +196,10 @@ INT_PTR CALLBACK OptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara SendDlgItemMessage(hwndDlg, IDC_OUTDEVICE, CB_SETCURSEL, 0, 0);
BASS_DEVICEINFO info;
- ptrT tszDeviceName(db_get_tsa(NULL, ModuleName, OPT_OUTDEVICE));
+ ptrW tszDeviceName(db_get_tsa(NULL, ModuleName, OPT_OUTDEVICE));
for (int i = 1; BASS_GetDeviceInfo(i + newBass, &info); i++) {
SendDlgItemMessage(hwndDlg, IDC_OUTDEVICE, CB_ADDSTRING, 0, _A2T(info.name));
- if (!mir_tstrcmp(tszDeviceName, _A2T(info.name)))
+ if (!mir_wstrcmp(tszDeviceName, _A2T(info.name)))
SendDlgItemMessage(hwndDlg, IDC_OUTDEVICE, CB_SETCURSEL, i, 0);
}
}
@@ -424,8 +424,8 @@ int ReloadColors(WPARAM, LPARAM) {
ColourIDT colourid = { 0 };
colourid.cbSize = sizeof(colourid);
- mir_tstrcpy(colourid.group, _A2W(ModuleName));
- mir_tstrcpy(colourid.name, LPGENW("Frame background"));
+ mir_wstrcpy(colourid.group, _A2W(ModuleName));
+ mir_wstrcpy(colourid.name, LPGENW("Frame background"));
clBack = CallService(MS_COLOUR_GETT, (WPARAM)&colourid, 0);
if (hBkgBrush)
@@ -499,7 +499,7 @@ void LoadBassLibrary(const wchar_t *ptszPath) BASS_DEVICEINFO info;
if (!db_get_ts(NULL, ModuleName, OPT_OUTDEVICE, &dbv))
for (size_t i = 1; BASS_GetDeviceInfo((DWORD)i, &info); i++)
- if (!mir_tstrcmp(dbv.ptszVal, _A2T(info.name)))
+ if (!mir_wstrcmp(dbv.ptszVal, _A2T(info.name)))
device = (int)i;
db_free(&dbv);
@@ -526,7 +526,7 @@ void LoadBassLibrary(const wchar_t *ptszPath) int OnFoldersChanged(WPARAM, LPARAM)
{
FoldersGetCustomPathT(hBASSFolder, CurrBassPath, MAX_PATH, L"");
- mir_tstrcat(CurrBassPath, L"\\bass.dll");
+ mir_wstrcat(CurrBassPath, L"\\bass.dll");
if (hBass != NULL) {
BASS_Free();
@@ -544,16 +544,16 @@ int OnModulesLoaded(WPARAM, LPARAM) {
if (hBASSFolder = FoldersRegisterCustomPathT(LPGEN("Bass Interface"), LPGEN("Bass library"), PLUGINS_PATHT L"\\Bass")) {
FoldersGetCustomPathT(hBASSFolder, CurrBassPath, MAX_PATH, L"");
- mir_tstrcat(CurrBassPath, L"\\bass.dll");
+ mir_wstrcat(CurrBassPath, L"\\bass.dll");
}
else {
DBVARIANT dbv;
if (db_get_ts(NULL, ModuleName, OPT_BASSPATH, &dbv)) {
- mir_tstrncpy(CurrBassPath, VARST(L"Plugins\\Bass\\bass.dll"), _countof(CurrBassPath));
+ mir_wstrncpy(CurrBassPath, VARST(L"Plugins\\Bass\\bass.dll"), _countof(CurrBassPath));
db_set_ts(NULL, ModuleName, OPT_BASSPATH, CurrBassPath);
}
else {
- mir_tstrcpy(CurrBassPath, dbv.ptszVal);
+ mir_wstrcpy(CurrBassPath, dbv.ptszVal);
db_free(&dbv);
}
}
diff --git a/plugins/BasicHistory/src/EventList.cpp b/plugins/BasicHistory/src/EventList.cpp index eab014339e..bea541c11a 100644 --- a/plugins/BasicHistory/src/EventList.cpp +++ b/plugins/BasicHistory/src/EventList.cpp @@ -346,11 +346,11 @@ void HistoryEventList::InitNames() wchar_t str[200];
if (m_hContact) {
wcscpy_s(m_contactName, pcli->pfnGetContactDisplayName(m_hContact, 0));
- mir_sntprintf(str, TranslateT("History for %s"), m_contactName);
+ mir_snwprintf(str, TranslateT("History for %s"), m_contactName);
}
else {
wcscpy_s(m_contactName, TranslateT("System"));
- mir_sntprintf(str, TranslateT("History"));
+ mir_snwprintf(str, TranslateT("History"));
}
if (m_isWnd)
@@ -398,7 +398,7 @@ std::wstring HistoryEventList::GetContactName() std::wstring HistoryEventList::GetMyName()
{
- ptrT name(Contact_GetInfo(CNF_DISPLAY, NULL, GetContactProto(m_hContact)));
+ ptrW name(Contact_GetInfo(CNF_DISPLAY, NULL, GetContactProto(m_hContact)));
return (name == NULL) ? TranslateT("Me") : name;
}
@@ -431,13 +431,13 @@ std::string HistoryEventList::GetBaseProtocol() std::wstring HistoryEventList::GetMyId()
{
- ptrT id(Contact_GetInfo(CNF_DISPLAYUID, NULL, GetContactProto(m_hContact)));
+ ptrW id(Contact_GetInfo(CNF_DISPLAYUID, NULL, GetContactProto(m_hContact)));
return (id == NULL) ? L"" : id;
}
inline std::wstring GetContactId(MCONTACT hContact)
{
- ptrT id(Contact_GetInfo(CNF_DISPLAYUID, hContact));
+ ptrW id(Contact_GetInfo(CNF_DISPLAYUID, hContact));
return (id == NULL) ? L"" : id;
}
@@ -600,7 +600,7 @@ void HistoryEventList::AddImporter(MCONTACT hContact, IImport::ImportType type, mir_cslock lck(csEventList);
wchar_t buf[32];
- mir_sntprintf(buf, L"%016llx", (unsigned long long int)hContact);
+ mir_snwprintf(buf, L"%016llx", (unsigned long long int)hContact);
ImportDiscData data;
data.file = m_contactFileDir + buf;
data.type = type;
diff --git a/plugins/BasicHistory/src/ExportManager.cpp b/plugins/BasicHistory/src/ExportManager.cpp index c2168d861c..c7ac9b099c 100644 --- a/plugins/BasicHistory/src/ExportManager.cpp +++ b/plugins/BasicHistory/src/ExportManager.cpp @@ -41,16 +41,16 @@ std::wstring GetFile(const wchar_t* ext, HWND hwnd, bool open) wcscpy_s(extUpper, ext);
extUpper[0] = std::toupper(ext[0], loc);
- mir_sntprintf(filter, TranslateT("%s Files (*.%s)"), extUpper, ext);
- size_t len = mir_tstrlen(filter) + 1;
- mir_sntprintf(filter + len, _countof(filter) - len, L"*.%s", ext);
- len += mir_tstrlen(filter + len);
+ mir_snwprintf(filter, TranslateT("%s Files (*.%s)"), extUpper, ext);
+ size_t len = mir_wstrlen(filter) + 1;
+ mir_snwprintf(filter + len, _countof(filter) - len, L"*.%s", ext);
+ len += mir_wstrlen(filter + len);
filter[++len] = 0;
wchar_t stzFilePath[1024];
wcscpy_s(stzFilePath, TranslateT("History"));
wcscat_s(stzFilePath, L".");
wcscat_s(stzFilePath, ext);
- len = mir_tstrlen(stzFilePath) + 1;
+ len = mir_wstrlen(stzFilePath) + 1;
stzFilePath[len] = 0;
OPENFILENAME ofn = {0};
ofn.lStructSize = sizeof(ofn);
diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp index 499488c6e4..be1dac8781 100644 --- a/plugins/BasicHistory/src/HistoryWindow.cpp +++ b/plugins/BasicHistory/src/HistoryWindow.cpp @@ -1378,7 +1378,7 @@ void HistoryWindow::SelectEventGroup(int sel) }
TimeZone_PrintTimeStamp(NULL, data.timestamp, formatDate, str, MAXSELECTSTR, 0);
- *strLen = (unsigned int)mir_tstrlen(str) * sizeof(wchar_t);
+ *strLen = (unsigned int)mir_wstrlen(str) * sizeof(wchar_t);
TextSelection->SetStart(MAXLONG);
TextSelection->GetFont(&TextFont);
SetFontFromOptions(TextFont, caps, lastMe ? Options::OutTimestamp : Options::InTimestamp);
@@ -1387,8 +1387,8 @@ void HistoryWindow::SelectEventGroup(int sel) TextFont->Release();
if (isUser) {
- mir_sntprintf(str, MAXSELECTSTR, L"%s\n", (lastMe) ? m_myName : m_contactName);
- *strLen = (unsigned int)mir_tstrlen(str) * sizeof(wchar_t);
+ mir_snwprintf(str, MAXSELECTSTR, L"%s\n", (lastMe) ? m_myName : m_contactName);
+ *strLen = (unsigned int)mir_wstrlen(str) * sizeof(wchar_t);
TextSelection->SetStart(MAXLONG);
TextSelection->GetFont(&TextFont);
SetFontFromOptions(TextFont, caps, lastMe ? Options::OutName : Options::InName);
@@ -1945,7 +1945,7 @@ void HistoryWindow::Delete(int what) return;
wchar_t message[256];
- mir_sntprintf(message, TranslateT("Number of history items to delete: %d.\nAre you sure you want to do this?"), toDelete);
+ mir_snwprintf(message, TranslateT("Number of history items to delete: %d.\nAre you sure you want to do this?"), toDelete);
if (MessageBox(m_hWnd, message, TranslateT("Are You sure?"), MB_OKCANCEL | MB_ICONERROR) != IDOK)
return;
diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp index 262b46e47c..4e243c3682 100644 --- a/plugins/BasicHistory/src/Options.cpp +++ b/plugins/BasicHistory/src/Options.cpp @@ -722,7 +722,7 @@ void SetEventCB(HWND hwndCB, int eventId) if (selCpIdx == -1) {
wchar_t buf[24];
- mir_sntprintf(buf, L"%d", eventId);
+ mir_snwprintf(buf, L"%d", eventId);
ComboBox_SetText(hwndCB, buf);
}
else ComboBox_SetCurSel(hwndCB, selCpIdx);
@@ -777,7 +777,7 @@ void ReloadEventLB(HWND hwndLB, const FilterOptions &sel) if (selCpIdx == -1) {
wchar_t buf[24];
- mir_sntprintf(buf, L"%d", *it);
+ mir_snwprintf(buf, L"%d", *it);
ListBox_AddString(hwndLB, buf);
}
else ListBox_AddString(hwndLB, TranslateTS(EventNames[selCpIdx].name));
@@ -805,25 +805,25 @@ bool OpenFileDlg(HWND hwndDlg, HWND hwndEdit, const wchar_t* defName, const wcha wchar_t extUpper[32];
wcscpy_s(extUpper, ext);
extUpper[0] = std::toupper(ext[0], loc);
- mir_sntprintf(filter, TranslateT("%s Files (*.%s)"), extUpper, ext);
- size_t len = mir_tstrlen(filter) + 1;
- mir_sntprintf(filter + len, _countof(filter) - len, L"*.%s", ext);
- len += mir_tstrlen(filter + len) + 1;
+ mir_snwprintf(filter, TranslateT("%s Files (*.%s)"), extUpper, ext);
+ size_t len = mir_wstrlen(filter) + 1;
+ mir_snwprintf(filter + len, _countof(filter) - len, L"*.%s", ext);
+ len += mir_wstrlen(filter + len) + 1;
wcscpy_s(filter + len, 1024 - len, TranslateT("All Files (*.*)"));
- len += mir_tstrlen(filter + len) + 1;
+ len += mir_wstrlen(filter + len) + 1;
wcscpy_s(filter + len, 1024 - len, L"*.*");
- len += mir_tstrlen(filter + len) + 1;
+ len += mir_wstrlen(filter + len) + 1;
filter[len] = 0;
wchar_t stzFilePath[1024];
Edit_GetText(hwndEdit, stzFilePath, 1023);
if (stzFilePath[0] == 0) {
wcscpy_s(stzFilePath, defName);
- len = mir_tstrlen(stzFilePath) + 1;
+ len = mir_wstrlen(stzFilePath) + 1;
stzFilePath[len] = 0;
}
else {
- len = mir_tstrlen(stzFilePath) + 1;
+ len = mir_wstrlen(stzFilePath) + 1;
stzFilePath[len] = 0;
}
@@ -1283,7 +1283,7 @@ void InitCodepageCB(HWND hwndCB, unsigned int codepage, const std::wstring& name if (selCpIdx == -1) {
wchar_t buf[300];
- mir_sntprintf(buf, L"%d;%s", codepage, name.c_str());
+ mir_snwprintf(buf, L"%d;%s", codepage, name.c_str());
ComboBox_SetText(hwndCB, buf);
}
else ComboBox_SetCurSel(hwndCB, selCpIdx);
@@ -1701,7 +1701,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam, wchar_t sep = ':';
if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, timeFormat, 10) > 0)
sep = timeFormat[0];
- mir_sntprintf(timeFormat, L"HH%cmm", sep);
+ mir_snwprintf(timeFormat, L"HH%cmm", sep);
}
SYSTEMTIME st;
@@ -1748,7 +1748,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam, toCp.eventDeltaTime = GetDlgItemInt(hwndDlg, IDC_EVENT_TIME, &isOK, TRUE);
if (!isOK) {
wchar_t tszBuf[256];
- mir_sntprintf(tszBuf, TranslateT("Invalid '%s' value."), TranslateT("Events older than"));
+ mir_snwprintf(tszBuf, TranslateT("Invalid '%s' value."), TranslateT("Events older than"));
MessageBox(hwndDlg, tszBuf, TranslateT("Error"), MB_ICONERROR);
break;
}
@@ -1779,7 +1779,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam, if (!isOK) {
if (toCp.trigerType == TaskOptions::Monthly) {
wchar_t tszBuf[256];
- mir_sntprintf(tszBuf, TranslateT("Invalid '%s' value."), TranslateT("Day"));
+ mir_snwprintf(tszBuf, TranslateT("Invalid '%s' value."), TranslateT("Day"));
MessageBox(hwndDlg, tszBuf, TranslateT("Error"), MB_ICONERROR);
break;
}
@@ -1789,7 +1789,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam, if (!isOK) {
if (toCp.trigerType == TaskOptions::DeltaMin || toCp.trigerType == TaskOptions::DeltaHour) {
wchar_t tszBuf[256];
- mir_sntprintf(tszBuf, TranslateT("Invalid '%s' value."), TranslateT("Delta time"));
+ mir_snwprintf(tszBuf, TranslateT("Invalid '%s' value."), TranslateT("Delta time"));
MessageBox(hwndDlg, tszBuf, TranslateT("Error"), MB_ICONERROR);
break;
}
@@ -1806,9 +1806,9 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam, if (err.empty())
wcscpy_s(tszBuf, TranslateT("Some value is invalid"));
else if (errDescr.empty())
- mir_sntprintf(tszBuf, TranslateT("Invalid '%s' value."), err.c_str());
+ mir_snwprintf(tszBuf, TranslateT("Invalid '%s' value."), err.c_str());
else
- mir_sntprintf(tszBuf, TranslateT("Invalid '%s' value.\n%s"), err.c_str(), errDescr.c_str());
+ mir_snwprintf(tszBuf, TranslateT("Invalid '%s' value.\n%s"), err.c_str(), errDescr.c_str());
MessageBox(hwndDlg, tszBuf, TranslateT("Error"), MB_ICONERROR);
break;
}
diff --git a/plugins/BasicHistory/src/PlainHtmlExport.cpp b/plugins/BasicHistory/src/PlainHtmlExport.cpp index 52bf4fadd7..1f00085b7a 100644 --- a/plugins/BasicHistory/src/PlainHtmlExport.cpp +++ b/plugins/BasicHistory/src/PlainHtmlExport.cpp @@ -75,7 +75,7 @@ void PlainHtmlExport::WriteGroup(bool, const std::wstring &time, const std::wstr {
wchar_t buf[256];
EXP_FILE << L"<div class=mes id=session>\n";
- mir_sntprintf(buf, TranslateT("Conversation started at %s"), time.c_str());
+ mir_snwprintf(buf, TranslateT("Conversation started at %s"), time.c_str());
EXP_FILE << L"<div class=text>" << buf << L"</div>\n";
EXP_FILE << L"</div>\n";
}
diff --git a/plugins/BasicHistory/src/RichHtmlExport.cpp b/plugins/BasicHistory/src/RichHtmlExport.cpp index 45bc07ee5b..c1a639267e 100644 --- a/plugins/BasicHistory/src/RichHtmlExport.cpp +++ b/plugins/BasicHistory/src/RichHtmlExport.cpp @@ -256,7 +256,7 @@ void IcoSave(const std::wstring &fileName, HICON hicon) bool DeleteDirectory(LPCTSTR lpszDir, bool noRecycleBin = true)
{
- size_t len = mir_tstrlen(lpszDir);
+ size_t len = mir_wstrlen(lpszDir);
wchar_t *pszFrom = new wchar_t[len+2];
wcscpy_s(pszFrom, len+2, lpszDir);
pszFrom[len] = 0;
diff --git a/plugins/BasicHistory/src/Scheduler.cpp b/plugins/BasicHistory/src/Scheduler.cpp index 7ad20eb6b9..238a65cfdf 100644 --- a/plugins/BasicHistory/src/Scheduler.cpp +++ b/plugins/BasicHistory/src/Scheduler.cpp @@ -236,9 +236,9 @@ bool DoTask(TaskOptions& to) if (err.empty())
wcscpy_s(msg, TranslateT("Some value is invalid"));
else if (errDescr.empty())
- mir_sntprintf(msg, TranslateT("Invalid '%s' value."), err.c_str());
+ mir_snwprintf(msg, TranslateT("Invalid '%s' value."), err.c_str());
else
- mir_sntprintf(msg, TranslateT("Invalid '%s' value.\n%s"), err.c_str(), errDescr.c_str());
+ mir_snwprintf(msg, TranslateT("Invalid '%s' value.\n%s"), err.c_str(), errDescr.c_str());
DoError(to, msg);
return true;
@@ -395,7 +395,7 @@ bool DoTask(TaskOptions& to) errorStr += L"\n";
wchar_t msg[1024];
- mir_sntprintf(msg, TranslateT("Incorrect file format: %s."), GetName(*it).c_str());
+ mir_snwprintf(msg, TranslateT("Incorrect file format: %s."), GetName(*it).c_str());
errorStr += msg;
}
else {
@@ -404,7 +404,7 @@ bool DoTask(TaskOptions& to) wchar_t msg[1024];
- mir_sntprintf(msg, TranslateT("Unknown contact in file: %s."), GetName(*it).c_str());
+ mir_snwprintf(msg, TranslateT("Unknown contact in file: %s."), GetName(*it).c_str());
errorStr += msg;
}
}
@@ -460,7 +460,7 @@ bool DoTask(TaskOptions& to) wchar_t msg[1024];
- mir_sntprintf(msg, TranslateT("Cannot export history for contact: %s."), exp->GetContactName().c_str());
+ mir_snwprintf(msg, TranslateT("Cannot export history for contact: %s."), exp->GetContactName().c_str());
errorStr += msg;
}
@@ -481,7 +481,7 @@ bool DoTask(TaskOptions& to) errorStr += L"\n";
wchar_t msg[1024];
- mir_sntprintf(msg, TranslateT("Cannot export history for contact: %s."), exp->GetContactName().c_str());
+ mir_snwprintf(msg, TranslateT("Cannot export history for contact: %s."), exp->GetContactName().c_str());
errorStr += msg;
break;
}
@@ -586,7 +586,7 @@ std::wstring GetFileName(const std::wstring &baseName, std::wstring contactName, wchar_t time[256];
SYSTEMTIME st;
GetLocalTime(&st);
- mir_sntprintf(time, L"%d-%02d-%02d %02d%02d", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute);
+ mir_snwprintf(time, L"%d-%02d-%02d %02d%02d", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute);
std::wstring str1 = str.substr(0, pos);
str1 += time;
str1 += str.substr(pos + 6);
@@ -843,9 +843,9 @@ bool ExecuteCurrentTask(time_t now) size_t size = to.taskName.size() + 1024;
wchar_t *name = new wchar_t[size];
if (error)
- mir_sntprintf(name, size, TranslateT("Task '%s' execution failed"), to.taskName.c_str());
+ mir_snwprintf(name, size, TranslateT("Task '%s' execution failed"), to.taskName.c_str());
else
- mir_sntprintf(name, size, TranslateT("Task '%s' finished successfully"), to.taskName.c_str());
+ mir_snwprintf(name, size, TranslateT("Task '%s' finished successfully"), to.taskName.c_str());
QueueUserAPC(DoTaskFinishInMainAPCFunc, g_hMainThread, (ULONG_PTR) name);
}
}
@@ -1129,7 +1129,7 @@ bool FtpFiles(const std::wstring& dir, const std::wstring& filePath, const std:: DeleteFile(log.c_str());
wchar_t cmdLine[MAX_PATH];
- mir_sntprintf(cmdLine, L"\"%s\" /nointeractiveinput /log=\"%s\" /script=script.sc", Options::instance->ftpExePath.c_str(), log.c_str());
+ mir_snwprintf(cmdLine, L"\"%s\" /nointeractiveinput /log=\"%s\" /script=script.sc", Options::instance->ftpExePath.c_str(), log.c_str());
STARTUPINFO startupInfo = { 0 };
startupInfo.cb = sizeof(STARTUPINFO);
@@ -1220,7 +1220,7 @@ bool FtpGetFiles(const std::wstring& dir, const std::list<std::wstring>& files, CreateDirectory(GetDirectoryName(log).c_str(), NULL);
DeleteFile(log.c_str());
wchar_t cmdLine[MAX_PATH];
- mir_sntprintf(cmdLine, L"\"%s\" /nointeractiveinput /log=\"%s\" /script=script.sc", Options::instance->ftpExePath.c_str(), log.c_str());
+ mir_snwprintf(cmdLine, L"\"%s\" /nointeractiveinput /log=\"%s\" /script=script.sc", Options::instance->ftpExePath.c_str(), log.c_str());
STARTUPINFO startupInfo = { 0 };
PROCESS_INFORMATION processInfo;
startupInfo.cb = sizeof(STARTUPINFO);
@@ -1250,7 +1250,7 @@ void CreatePath(const wchar_t *szDir) DWORD dwAttributes;
wchar_t *pszLastBackslash, szTestDir[MAX_PATH];
- mir_tstrncpy(szTestDir, szDir, _countof(szTestDir));
+ mir_wstrncpy(szTestDir, szDir, _countof(szTestDir));
if ((dwAttributes = GetFileAttributes(szTestDir)) != INVALID_FILE_ATTRIBUTES && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY))
return;
@@ -1283,7 +1283,7 @@ INT_PTR ExecuteTaskService(WPARAM wParam, LPARAM) void DoError(const TaskOptions& to, const std::wstring _error)
{
wchar_t msg[256];
- mir_sntprintf(msg, TranslateT("Task '%s' execution failed:"), to.taskName.c_str());
+ mir_snwprintf(msg, TranslateT("Task '%s' execution failed:"), to.taskName.c_str());
if (Options::instance->schedulerHistoryAlerts) {
std::wstring error = msg;
error += L"\n";
diff --git a/plugins/BasicHistory/src/Searcher.cpp b/plugins/BasicHistory/src/Searcher.cpp index a3c8b4f093..97158d7796 100644 --- a/plugins/BasicHistory/src/Searcher.cpp +++ b/plugins/BasicHistory/src/Searcher.cpp @@ -75,7 +75,7 @@ bool Searcher::CompareStr(std::wstring str, wchar_t *strFind) return str.find(strFind) < str.length();
size_t findid = str.find(strFind);
- size_t findLen = mir_tstrlen(strFind);
+ size_t findLen = mir_wstrlen(strFind);
while(findid < str.length()) {
if ((findid == 0 || std::isspace(str[findid - 1], loc) || std::ispunct(str[findid - 1], loc)) &&
(findid + findLen >= str.length() || std::isspace(str[findid + findLen], loc) || std::ispunct(str[findid + findLen], loc)))
@@ -105,13 +105,13 @@ void Searcher::Find() GetWindowText(context->findWindow, str, _countof(str));
if (!str[0]) {
wchar_t buf[256];
- mir_sntprintf(buf, TranslateT("\"%s\" not found"), str);
+ mir_snwprintf(buf, TranslateT("\"%s\" not found"), str);
MessageBox(context->m_hWnd, buf, TranslateT("Search"), MB_OK | MB_ICONINFORMATION);
return;
}
if (!matchCase) {
std::locale loc;
- std::transform(str, str + mir_tstrlen(str), str, std::bind2nd(std::ptr_fun(mytoupper), &loc));
+ std::transform(str, str + mir_wstrlen(str), str, std::bind2nd(std::ptr_fun(mytoupper), &loc));
}
bool findBack1 = findBack ^ !searchForInMes;
@@ -299,7 +299,7 @@ void Searcher::Find() if (isStart) {
wchar_t buf[256];
GetWindowText(context->findWindow, str, _countof(str));
- mir_sntprintf(buf, TranslateT("\"%s\" not found"), str);
+ mir_snwprintf(buf, TranslateT("\"%s\" not found"), str);
MessageBox(context->m_hWnd, buf, TranslateT("Search"), MB_OK | MB_ICONINFORMATION);
}
else MessageBox(context->m_hWnd, TranslateTS(onlyGroup ? LPGENW("You have reached the end of the group.") : LPGENW("You have reached the end of the history.")), TranslateT("Search"), MB_OK | MB_ICONINFORMATION);
diff --git a/plugins/Boltun/src/Engine/Mind.cpp b/plugins/Boltun/src/Engine/Mind.cpp index 120dbc85ef..cfee26fbf0 100644 --- a/plugins/Boltun/src/Engine/Mind.cpp +++ b/plugins/Boltun/src/Engine/Mind.cpp @@ -129,7 +129,7 @@ void Mind::Load(wstring filename) format(st);
count = st.length();
c = co = new wchar_t[count + 1];
- mir_tstrcpy(c, st.c_str());
+ mir_wstrcpy(c, st.c_str());
size_t pos = 0;
while (pos < count && iswspace(*c)) {
++pos;
@@ -209,25 +209,25 @@ void Mind::Load(wstring filename) ++c;
count -= 2;
c[count] = '\0';
- if (mir_tstrcmp(c, L"QUESTION") == 0) {
+ if (mir_wstrcmp(c, L"QUESTION") == 0) {
toLowerStr(c);
data->question.insert(s1);
}
- else if (mir_tstrcmp(c, L"IGNORED") == 0) {
+ else if (mir_wstrcmp(c, L"IGNORED") == 0) {
toLowerStr(c);
data->special.insert(s1);
}
- else if (mir_tstrcmp(c, L"ESCAPE") == 0) {
+ else if (mir_wstrcmp(c, L"ESCAPE") == 0) {
data->escape.push_back(s1);
}
- else if (mir_tstrcmp(c, L"FAILURE") == 0) {
+ else if (mir_wstrcmp(c, L"FAILURE") == 0) {
data->failure.push_back(s1);
}
- else if (mir_tstrcmp(c, L"REPEAT") == 0) {
+ else if (mir_wstrcmp(c, L"REPEAT") == 0) {
data->repeats.push_back(s1);
}
else {
- if (mir_tstrcmp(c, L"INITIAL") != 0)
+ if (mir_wstrcmp(c, L"INITIAL") != 0)
throw error;
data->initial.push_back(s1);
}
diff --git a/plugins/Boltun/src/Engine/TalkEngine.cpp b/plugins/Boltun/src/Engine/TalkEngine.cpp index 0f53403003..7d1ca265ed 100644 --- a/plugins/Boltun/src/Engine/TalkEngine.cpp +++ b/plugins/Boltun/src/Engine/TalkEngine.cpp @@ -264,7 +264,7 @@ wstring TalkBot::AllReplies(const wstring &incomingMessage, ContactData *contact TalkBot::MessageInfo* TalkBot::Reply(MCONTACT contact, wstring incomingMessage, bool saveChoice)
{
wchar_t* str = new wchar_t[incomingMessage.length() + 1];
- mir_tstrcpy(str, incomingMessage.c_str());
+ mir_wstrcpy(str, incomingMessage.c_str());
CharLower(str);
incomingMessage = str;
delete[] str;
diff --git a/plugins/Boltun/src/boltun.cpp b/plugins/Boltun/src/boltun.cpp index 100c18b144..ebe6dd21d6 100644 --- a/plugins/Boltun/src/boltun.cpp +++ b/plugins/Boltun/src/boltun.cpp @@ -65,14 +65,14 @@ void UpdateEngine() wchar_t* GetFullName(const wchar_t *filename)
{
- size_t flen = mir_tstrlen(filename);
+ size_t flen = mir_wstrlen(filename);
wchar_t* fullname = const_cast<wchar_t*>(filename);
if (!wcschr(filename, ':')) {
- size_t plen = mir_tstrlen(tszPath);
+ size_t plen = mir_wstrlen(tszPath);
fullname = new wchar_t[plen + flen + 1];
fullname[0] = NULL;
- mir_tstrcat(fullname, tszPath);
- mir_tstrcat(fullname, filename);
+ mir_wstrcat(fullname, tszPath);
+ mir_wstrcat(fullname, filename);
}
return fullname;
}
@@ -361,7 +361,7 @@ static INT_PTR CALLBACK EngineDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP const size_t fileNameSize = 5000;
wchar_t *filename = new wchar_t[fileNameSize];
wchar_t *fullname = GetFullName(Config.MindFileName);
- mir_tstrcpy(filename, fullname);
+ mir_wstrcpy(filename, fullname);
if (fullname != Config.MindFileName)
delete[] fullname;
@@ -407,7 +407,7 @@ static INT_PTR CALLBACK EngineDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP bTranslated = blInit = LoadMind(c, line);
if (!bTranslated) {
wchar_t message[5000];
- mir_sntprintf(message, TranslateTS(FAILED_TO_LOAD_BASE), line, c);
+ mir_snwprintf(message, TranslateTS(FAILED_TO_LOAD_BASE), line, c);
MessageBox(NULL, message, TranslateTS(BOLTUN_ERROR), MB_ICONERROR | MB_TASKMODAL | MB_OK);
}
}
@@ -575,7 +575,7 @@ extern "C" int __declspec(dllexport) Load(void) blInit = LoadMind(Config.MindFileName, line);
if (!blInit) {
wchar_t path[2000];
- mir_sntprintf(path, TranslateTS(FAILED_TO_LOAD_BASE), line, (const wchar_t*)Config.MindFileName);
+ mir_snwprintf(path, TranslateTS(FAILED_TO_LOAD_BASE), line, (const wchar_t*)Config.MindFileName);
MessageBox(NULL, path, TranslateTS(BOLTUN_ERROR), MB_ICONERROR | MB_TASKMODAL | MB_OK);
}
return 0;
@@ -593,7 +593,7 @@ extern "C" int __declspec(dllexport) Unload(void) //So in case of saving error we will remain silent
#if 0
wchar_t path[MAX_PATH];
- mir_sntprintf(path, TranslateTS(FAILED_TO_SAVE_BASE), (const wchar_t*)Config.MindFileName);
+ mir_snwprintf(path, TranslateTS(FAILED_TO_SAVE_BASE), (const wchar_t*)Config.MindFileName);
wchar_t* err = TranslateTS(BOLTUN_ERROR);
MessageBox(NULL, path, err, MB_ICONERROR | MB_TASKMODAL | MB_OK); */
#endif
diff --git a/plugins/Boltun/src/config.cpp b/plugins/Boltun/src/config.cpp index dd821a886b..68d6035315 100644 --- a/plugins/Boltun/src/config.cpp +++ b/plugins/Boltun/src/config.cpp @@ -58,7 +58,7 @@ inline wchar_t* GetString(char* key, const wchar_t* def) inline const wchar_t* SetString(char* key, const wchar_t* value)
{
- size_t len = mir_tstrlen(value) + 1;
+ size_t len = mir_wstrlen(value) + 1;
wchar_t* val = new wchar_t[len];
wcscpy_s(val, len, value);
db_set_ts(NULL, BOLTUN_KEY, key, val);
diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp index bd725b6e8b..d1e1fab75e 100644 --- a/plugins/BossKeyPlus/src/BossKey.cpp +++ b/plugins/BossKeyPlus/src/BossKey.cpp @@ -174,12 +174,12 @@ BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM) wchar_t szTemp[32];
GetClassName(hWnd, szTemp, 32);
- if (mir_tstrcmp(szTemp, L"MirandaThumbsWnd") == 0) // hide floating contacts
+ if (mir_wstrcmp(szTemp, L"MirandaThumbsWnd") == 0) // hide floating contacts
{
CallService("FloatingContacts/MainHideAllThumbs", 0, 0);
g_bOldSetting |= OLD_FLTCONT;
}
- else if (mir_tstrcmp(szTemp, L"PopupWnd2") == 0 || mir_tstrcmp(szTemp, L"YAPPWinClass") == 0) // destroy opened popups
+ else if (mir_wstrcmp(szTemp, L"PopupWnd2") == 0 || mir_wstrcmp(szTemp, L"YAPPWinClass") == 0) // destroy opened popups
PUDeletePopup(hWnd);
else
{
@@ -398,7 +398,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara wchar_t szTemp[32];
GetClassName(pCurWnd->hWnd, szTemp, 32);
- if (IsWindow(pCurWnd->hWnd) && mir_tstrcmp(szTemp, L"SysShadow") != 0) // precaution
+ if (IsWindow(pCurWnd->hWnd) && mir_wstrcmp(szTemp, L"SysShadow") != 0) // precaution
ShowWindow(pCurWnd->hWnd, SW_SHOW);
delete pCurWnd; // bye-bye
@@ -503,7 +503,7 @@ static wchar_t *GetBossKeyText(void) BYTE shift = HIBYTE(wHotKey);
static wchar_t buf[128] = { 0 };
- mir_sntprintf(buf, L"%s%s%s%s%s",
+ mir_snwprintf(buf, L"%s%s%s%s%s",
(shift & HOTKEYF_CONTROL) ? L"Ctrl + " : L"",
(shift & HOTKEYF_SHIFT) ? L"Shift + " : L"",
(shift & HOTKEYF_ALT) ? L"Alt + " : L"",
@@ -522,7 +522,7 @@ static int GenMenuInit(WPARAM, LPARAM) // Modify menu item text before to show t {
if (g_hMenuItem) {
wchar_t buf[128];
- mir_sntprintf(buf, L"%s [%s]", TranslateT("Hide"), GetBossKeyText());
+ mir_snwprintf(buf, L"%s [%s]", TranslateT("Hide"), GetBossKeyText());
Menu_ModifyItem(g_hMenuItem, buf);
}
return 0;
diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp index cc3b479be4..4fc8a9e978 100644 --- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp @@ -231,8 +231,8 @@ bool isContactGoneFor(MCONTACT hContact, int days) ppd.lchContact = hContact;
ppd.lchIcon = IcoLib_GetIcon("enabled_icon");
- mir_sntprintf(ppd.lptzContactName, TranslateT("Hiding %s (%S)"), pcli->pfnGetContactDisplayName(hContact, 0), GetContactProto(hContact));
- mir_sntprintf(ppd.lptzText, TranslateT("%d days since last message"), daysSinceMessage);
+ mir_snwprintf(ppd.lptzContactName, TranslateT("Hiding %s (%S)"), pcli->pfnGetContactDisplayName(hContact, 0), GetContactProto(hContact));
+ mir_snwprintf(ppd.lptzText, TranslateT("%d days since last message"), daysSinceMessage);
if (!options.iUsePopupColors) {
ppd.colorBack = options.iPopupColorBack;
@@ -286,7 +286,7 @@ void ReturnNotify(MCONTACT hContact, wchar_t *message) wchar_t* nick = (wchar_t*)pcli->pfnGetContactDisplayName(hContact, 0);
wchar_t tmpMsg[512];
- mir_sntprintf(tmpMsg, L"%s %s", nick, message);
+ mir_snwprintf(tmpMsg, L"%s %s", nick, message);
cle.ptszTooltip = tmpMsg;
pcli->pfnAddEvent(&cle);
}
@@ -323,7 +323,7 @@ void GoneNotify(MCONTACT hContact, wchar_t *message) wchar_t* nick = (wchar_t*)pcli->pfnGetContactDisplayName(hContact, 0);
wchar_t tmpMsg[512];
- mir_sntprintf(tmpMsg, L"%s %s", nick, message);
+ mir_snwprintf(tmpMsg, L"%s %s", nick, message);
cle.ptszTooltip = tmpMsg;
cle.flags = CLEF_TCHAR;
pcli->pfnAddEvent(&cle);
diff --git a/plugins/BuddyExpectator/src/options.cpp b/plugins/BuddyExpectator/src/options.cpp index b0be57b26e..c2bdeb591c 100644 --- a/plugins/BuddyExpectator/src/options.cpp +++ b/plugins/BuddyExpectator/src/options.cpp @@ -327,7 +327,7 @@ static INT_PTR CALLBACK PopupOptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wP ppd.lchIcon = hIcon;
wcsncpy(ppd.lptzContactName, TranslateT("Contact name"), MAX_CONTACTNAME);
wchar_t szPreviewText[250];
- mir_sntprintf(szPreviewText, TranslateT("has returned after being absent since %d days"), rand() % 30);
+ mir_snwprintf(szPreviewText, TranslateT("has returned after being absent since %d days"), rand() % 30);
wcsncpy(ppd.lptzText, szPreviewText, MAX_SECONDLINE);
// Get current popups colors options
diff --git a/plugins/BuddyPounce/src/dialog.cpp b/plugins/BuddyPounce/src/dialog.cpp index d17340cfb0..12a70ba570 100644 --- a/plugins/BuddyPounce/src/dialog.cpp +++ b/plugins/BuddyPounce/src/dialog.cpp @@ -16,7 +16,7 @@ void populateContacts(MCONTACT BPhContact, HWND hwnd2CB) char *szProto = GetContactProto(hContact);
if (szProto && (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM)) {
wchar_t name[300];
- mir_sntprintf(name, L"%s (%s)", pcli->pfnGetContactDisplayName(hContact, 0), _A2T(szProto));
+ mir_snwprintf(name, L"%s (%s)", pcli->pfnGetContactDisplayName(hContact, 0), _A2T(szProto));
int index = SendMessage(hwnd2CB, CB_ADDSTRING, 0, (LPARAM)name);
SendMessage(hwnd2CB, CB_SETITEMDATA, index, hContact);
if (BPhContact == hContact)
@@ -102,7 +102,7 @@ INT_PTR CALLBACK StatusModesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l |(IsDlgButtonChecked(hwnd, IDC_CHECK9)<<8)
|(IsDlgButtonChecked(hwnd, IDC_CHECK10)<<9);
- if (!mir_tstrcmp(type, L"Any")) {
+ if (!mir_wstrcmp(type, L"Any")) {
if (LOWORD(wParam) == IDOK)
db_set_w(wi->hContact, modname, "SendIfMyStatusIsFLAG", flag);
wi->SendIfMy = 0;
@@ -201,7 +201,7 @@ INT_PTR CALLBACK BuddyPounceSimpleDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, L SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)lParam);
getDefaultMessage(hwnd, IDC_MESSAGE, hContact);
- mir_sntprintf(msg, TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
+ mir_snwprintf(msg, TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
SetDlgItemText(hwnd, GRP_MSG, msg);
return FALSE;
@@ -210,7 +210,7 @@ INT_PTR CALLBACK BuddyPounceSimpleDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, L case IDC_MESSAGE:
if (HIWORD(wParam) == EN_CHANGE) {
int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE));
- mir_sntprintf(msg, TranslateT("The Message (%d Characters)"), length);
+ mir_snwprintf(msg, TranslateT("The Message (%d Characters)"), length);
SetDlgItemText(hwnd, GRP_MSG, msg);
}
break;
@@ -258,7 +258,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)wi);
getDefaultMessage(hwnd, IDC_MESSAGE, wi->hContact);
- mir_sntprintf(msg, TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
+ mir_snwprintf(msg, TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
SetDlgItemText(hwnd, GRP_MSG, msg);
populateSettingsList(GetDlgItem(hwnd, IDC_SETTINGS));
@@ -272,7 +272,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM case IDC_MESSAGE:
if (HIWORD(wParam) == EN_CHANGE) {
int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE));
- mir_sntprintf(msg, TranslateT("The Message (%d Characters)"), length);
+ mir_snwprintf(msg, TranslateT("The Message (%d Characters)"), length);
SetDlgItemText(hwnd, GRP_MSG, msg);
}
break;
@@ -315,7 +315,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM case IDC_DEFAULT:
getDefaultMessage(hwnd, IDC_MESSAGE, wi->hContact);
- mir_sntprintf(msg, TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
+ mir_snwprintf(msg, TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
SetDlgItemText(hwnd, GRP_MSG, msg);
db_set_w(wi->hContact, modname, "SendIfMyStatusIsFLAG", (WORD)db_get_w(NULL, modname, "SendIfMyStatusIsFLAG",0));
@@ -390,7 +390,7 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)wi);
getDefaultMessage(hwnd, IDC_MESSAGE, wi->hContact);
- mir_sntprintf(msg, TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
+ mir_snwprintf(msg, TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
SetDlgItemText(hwnd, GRP_MSG, msg);
populateSettingsList(GetDlgItem(hwnd, IDC_SETTINGS));
SendDlgItemMessage(hwnd, IDC_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG((short)1024, (short)0));
@@ -433,7 +433,7 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, case IDC_MESSAGE:
if (HIWORD(wParam) == EN_CHANGE) {
int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE));
- mir_sntprintf(msg, TranslateT("The Message (%d Characters)"), length);
+ mir_snwprintf(msg, TranslateT("The Message (%d Characters)"), length);
SetDlgItemText(hwnd, GRP_MSG, msg);
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
}
@@ -524,7 +524,7 @@ INT_PTR CALLBACK SendPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP case WM_TIMER:
{
wchar_t message[1024];
- mir_sntprintf(message, TranslateT("Pounce being sent to %s in %d seconds"), pcli->pfnGetContactDisplayName(spdps->hContact, 0), spdps->timer);
+ mir_snwprintf(message, TranslateT("Pounce being sent to %s in %d seconds"), pcli->pfnGetContactDisplayName(spdps->hContact, 0), spdps->timer);
SetDlgItemText(hwnd, LBL_CONTACT, message);
}
spdps->timer--;
@@ -582,7 +582,7 @@ INT_PTR CALLBACK PounceSentDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP {
wchar_t text[2048];
GetDlgItemText(hwnd, IDOK, text, _countof(text));
- if (!mir_tstrcmp(text, TranslateT("Retry"))) {
+ if (!mir_wstrcmp(text, TranslateT("Retry"))) {
GetDlgItemText(hwnd, IDC_MESSAGE, text, _countof(text));
SendPounce(text, hContact);
}
@@ -601,12 +601,12 @@ void CreateMessageAcknowlegedWindow(MCONTACT hContact, int SentSuccess) HWND hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONFIRMSEND), 0, PounceSentDlgProc, hContact);
wchar_t msg[256];
if (SentSuccess) {
- mir_sntprintf(msg, TranslateT("Message successfully sent to %s"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_snwprintf(msg, TranslateT("Message successfully sent to %s"), pcli->pfnGetContactDisplayName(hContact, 0));
SetDlgItemText(hwnd, IDOK, TranslateT("OK"));
ShowWindow(GetDlgItem(hwnd, IDCANCEL), 0);
}
else {
- mir_sntprintf(msg, TranslateT("Message failed to send to %s"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_snwprintf(msg, TranslateT("Message failed to send to %s"), pcli->pfnGetContactDisplayName(hContact, 0));
SetDlgItemText(hwnd, IDOK, TranslateT("Retry"));
}
SetDlgItemText(hwnd, LBL_CONTACT, msg);
diff --git a/plugins/BuddyPounce/src/main.cpp b/plugins/BuddyPounce/src/main.cpp index 0d112acef5..35e6f5d9ba 100644 --- a/plugins/BuddyPounce/src/main.cpp +++ b/plugins/BuddyPounce/src/main.cpp @@ -169,7 +169,7 @@ int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam) if (CheckDate(hContact)) {
if (db_get_w(hContact, modname, "ConfirmTimeout", 0)) {
SendPounceDlgProcStruct *spdps = (SendPounceDlgProcStruct *)mir_alloc(sizeof(SendPounceDlgProcStruct));
- wchar_t *message = mir_tstrdup(dbv.ptszVal); // will get free()ed in the send confirm window proc
+ wchar_t *message = mir_wstrdup(dbv.ptszVal); // will get free()ed in the send confirm window proc
spdps->hContact = hContact;
spdps->message = message;
CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONFIRMSEND), 0, SendPounceDlgProc, (LPARAM)spdps);
@@ -215,10 +215,10 @@ INT_PTR AddToPounce(WPARAM wParam, LPARAM lParam) DBVARIANT dbv;
if (!db_get_ts(hContact, modname, "PounceMsg",&dbv))
{
- wchar_t* newPounce = (wchar_t*)mir_alloc(mir_tstrlen(dbv.ptszVal) + mir_tstrlen(message) + 1);
+ wchar_t* newPounce = (wchar_t*)mir_alloc(mir_wstrlen(dbv.ptszVal) + mir_wstrlen(message) + 1);
if (!newPounce) return 1;
- mir_tstrcpy(newPounce, dbv.ptszVal);
- mir_tstrcat(newPounce, message);
+ mir_wstrcpy(newPounce, dbv.ptszVal);
+ mir_wstrcat(newPounce, message);
db_set_ws(hContact, modname, "PounceMsg", newPounce);
mir_free(newPounce);
db_free(&dbv);
diff --git a/plugins/CSList/src/cslist.cpp b/plugins/CSList/src/cslist.cpp index 77a43eff9f..ecb5941fea 100644 --- a/plugins/CSList/src/cslist.cpp +++ b/plugins/CSList/src/cslist.cpp @@ -262,14 +262,14 @@ void importCustomStatuses(CSWindow* csw, int result) mir_snprintf(bufTitle, "XStatus%dName", i); if (!db_get_ts(NULL, protoName, bufTitle, &dbv)) { - mir_tstrcpy(si->m_tszTitle, dbv.ptszVal); + mir_wstrcpy(si->m_tszTitle, dbv.ptszVal); db_free(&dbv); } else si->m_tszTitle[0] = 0; mir_snprintf(bufMessage, "XStatus%dMsg", i); if (!db_get_ts(NULL, protoName, bufMessage, &dbv)) { - mir_tstrcpy(si->m_tszMessage, dbv.ptszVal); + mir_wstrcpy(si->m_tszMessage, dbv.ptszVal); db_free(&dbv); } else si->m_tszMessage[0] = 0; @@ -391,10 +391,10 @@ BOOL CSWindow::itemPassedFilter(ListItem< StatusItem >* li) wchar_t filter[MAX_PATH]; GetDlgItemText(m_handle, IDC_FILTER_FIELD, filter, _countof(filter)); - if (mir_tstrlen(filter)) + if (mir_wstrlen(filter)) { wchar_t title[EXTRASTATUS_TITLE_LIMIT], message[EXTRASTATUS_MESSAGE_LIMIT]; - mir_tstrcpy(title, li->m_item->m_tszTitle); mir_tstrcpy(message, li->m_item->m_tszMessage); + mir_wstrcpy(title, li->m_item->m_tszTitle); mir_wstrcpy(message, li->m_item->m_tszMessage); if (strpos(wcslwr(title), wcslwr(filter)) == -1) if (strpos(wcslwr(message), wcslwr(filter)) == -1) return FALSE; @@ -532,13 +532,13 @@ void CSAMWindow::checkFieldLimit(WORD action, WORD item) GetDlgItemText(m_handle, item, ptszInputText, limit + 8); - if (mir_tstrlen(ptszInputText) > limit) + if (mir_wstrlen(ptszInputText) > limit) { wchar_t tszPopupTip[MAX_PATH]; EDITBALLOONTIP ebt = { 0 }; ebt.cbStruct = sizeof(ebt); ebt.pszTitle = TranslateT("Warning"); - mir_sntprintf(tszPopupTip, TranslateT("This field doesn't accept string longer than %d characters. The string will be truncated."), limit); + mir_snwprintf(tszPopupTip, TranslateT("This field doesn't accept string longer than %d characters. The string will be truncated."), limit); ebt.pszText = tszPopupTip; ebt.ttiIcon = TTI_WARNING; SendDlgItemMessage(m_handle, item, EM_SHOWBALLOONTIP, 0, (LPARAM)&ebt); @@ -578,10 +578,10 @@ void CSAMWindow::checkItemValidity() cs.ptszName = tszTitle; cs.wParam = &i; if (CallProtoService(pdescr->szModuleName, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&cs) == 0) - mir_tstrncpy(m_item->m_tszTitle, TranslateTS(tszTitle), _countof(m_item->m_tszTitle)); + mir_wstrncpy(m_item->m_tszTitle, TranslateTS(tszTitle), _countof(m_item->m_tszTitle)); - if (mir_tstrcmp(m_item->m_tszMessage, tszInputMessage)) - mir_tstrcpy(m_item->m_tszMessage, tszInputMessage), m_bChanged = true; + if (mir_wstrcmp(m_item->m_tszMessage, tszInputMessage)) + mir_wstrcpy(m_item->m_tszMessage, tszInputMessage), m_bChanged = true; } CSListView::CSListView(HWND hwnd, CSWindow* parent) @@ -713,10 +713,10 @@ int CSItemsList::compareItems(const StatusItem* p1, const StatusItem* p2) else if (p1->m_iIcon < p2->m_iIcon) icoRes = -1; - result = mir_tstrcmp(p1->m_tszTitle, p2->m_tszTitle); + result = mir_wstrcmp(p1->m_tszTitle, p2->m_tszTitle); ttlRes = result; - result = mir_tstrcmp(p1->m_tszMessage, p2->m_tszMessage); + result = mir_wstrcmp(p1->m_tszMessage, p2->m_tszMessage); msgRes = result; if (!icoRes && !ttlRes && !msgRes) @@ -748,14 +748,14 @@ void CSItemsList::loadItems(char *protoName) mir_snprintf(dbSetting, "%s_Item%dTitle", protoName, i); if (!getTString(dbSetting, &dbv)) { - mir_tstrcpy(item->m_tszTitle, dbv.ptszVal); + mir_wstrcpy(item->m_tszTitle, dbv.ptszVal); db_free(&dbv); } else item->m_tszTitle[0] = 0; mir_snprintf(dbSetting, "%s_Item%dMessage", protoName, i); if (!getTString(dbSetting, &dbv)) { - mir_tstrcpy(item->m_tszMessage, dbv.ptszVal); + mir_wstrcpy(item->m_tszMessage, dbv.ptszVal); db_free(&dbv); } else item->m_tszMessage[0] = 0; diff --git a/plugins/CSList/src/stdafx.h b/plugins/CSList/src/stdafx.h index a99e42fe2d..e64119f5ea 100644 --- a/plugins/CSList/src/stdafx.h +++ b/plugins/CSList/src/stdafx.h @@ -110,16 +110,16 @@ struct StatusItem // list item structure StatusItem()
{
m_iIcon = 0;
- mir_tstrcpy(m_tszTitle, L"");
- mir_tstrcpy(m_tszMessage, L"");
+ mir_wstrcpy(m_tszTitle, L"");
+ mir_wstrcpy(m_tszMessage, L"");
m_bFavourite = FALSE;
}
StatusItem(const StatusItem& p)
{
m_iIcon = p.m_iIcon;
- mir_tstrcpy(m_tszTitle, p.m_tszTitle);
- mir_tstrcpy(m_tszMessage, p.m_tszMessage);
+ mir_wstrcpy(m_tszTitle, p.m_tszTitle);
+ mir_wstrcpy(m_tszMessage, p.m_tszMessage);
m_bFavourite = p.m_bFavourite;
}
diff --git a/plugins/ChangeKeyboardLayout/src/hook_events.cpp b/plugins/ChangeKeyboardLayout/src/hook_events.cpp index c0d2b34140..be5c8f100d 100644 --- a/plugins/ChangeKeyboardLayout/src/hook_events.cpp +++ b/plugins/ChangeKeyboardLayout/src/hook_events.cpp @@ -101,14 +101,14 @@ int ModulesLoaded(WPARAM, LPARAM) for (int i = 0; i < bLayNum; i++) {
LPTSTR ptszCurrLayout = GenerateLayoutString(hklLayouts[i]);
LPSTR ptszTemp = GetNameOfLayout(hklLayouts[i]);
- ptrT tszValue(db_get_tsa(NULL, ModuleName, ptszTemp));
+ ptrW tszValue(db_get_tsa(NULL, ModuleName, ptszTemp));
if (tszValue == 0)
ptszLayStrings[i] = ptszCurrLayout;
- else if (!mir_tstrcmp(tszValue, ptszEmptySting))
+ else if (!mir_wstrcmp(tszValue, ptszEmptySting))
ptszLayStrings[i] = ptszCurrLayout;
else {
ptszLayStrings[i] = tszValue.detach();
- if (!mir_tstrcmp(ptszCurrLayout, ptszLayStrings[i]))
+ if (!mir_wstrcmp(ptszCurrLayout, ptszLayStrings[i]))
db_unset(NULL, ModuleName, ptszTemp);
mir_free(ptszCurrLayout);
}
diff --git a/plugins/ChangeKeyboardLayout/src/options.cpp b/plugins/ChangeKeyboardLayout/src/options.cpp index 1f1a5af025..a610cef0fe 100644 --- a/plugins/ChangeKeyboardLayout/src/options.cpp +++ b/plugins/ChangeKeyboardLayout/src/options.cpp @@ -205,12 +205,12 @@ INT_PTR CALLBACK DlgMainProcOptions(HWND hWnd, UINT uiMessage, WPARAM wParam, LP GetDlgItemText(hWnd, IDC_EDIT_SET, ptszFormLay, MaxTextSize);
i = SendDlgItemMessage(hWnd, IDC_COMBO_LANG, CB_GETCURSEL, 0, 0);
ptszMemLay = ptszLayStrings[i];
- if (mir_tstrcmp(ptszMemLay, ptszFormLay) != 0) {
- mir_tstrcpy(ptszMemLay, ptszFormLay);
+ if (mir_wstrcmp(ptszMemLay, ptszFormLay) != 0) {
+ mir_wstrcpy(ptszMemLay, ptszFormLay);
ptszGenLay = GenerateLayoutString(hklLayouts[i]);
pszNameLay = GetNameOfLayout(hklLayouts[i]);
- if (mir_tstrcmp(ptszMemLay, ptszGenLay) != 0)
+ if (mir_wstrcmp(ptszMemLay, ptszGenLay) != 0)
db_set_ts(NULL, ModuleName, pszNameLay, ptszMemLay);
else
db_unset(NULL, ModuleName, pszNameLay);
@@ -382,7 +382,7 @@ INT_PTR CALLBACK DlgPopupsProcOptions(HWND hWnd, UINT uiMessage, WPARAM wParam, pdtData.iSeconds = poOptionsTemp.bTimeout;
break;
}
- mir_tstrcpy(ptszPopupPreviewText, pdtData.lptzText);
+ mir_wstrcpy(ptszPopupPreviewText, pdtData.lptzText);
pdtData.PluginData = ptszPopupPreviewText;
pdtData.lchIcon = hPopupIcon;
poOptions.paActions[0].lchIcon = hCopyIcon;
diff --git a/plugins/ChangeKeyboardLayout/src/text_operations.cpp b/plugins/ChangeKeyboardLayout/src/text_operations.cpp index ed1cdf4460..c8c44b1042 100644 --- a/plugins/ChangeKeyboardLayout/src/text_operations.cpp +++ b/plugins/ChangeKeyboardLayout/src/text_operations.cpp @@ -31,7 +31,7 @@ LPTSTR GeTStringFromStreamData(EditStreamData *esd) LPTSTR ptszOutText = (LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t));
LPTSTR ptszTemp = (wchar_t*)esd->pbBuff;
- for (i = k = 0; i < mir_tstrlen(ptszTemp); i++) {
+ for (i = k = 0; i < mir_wstrlen(ptszTemp); i++) {
if ((ptszTemp[i] == 0x0A) || (ptszTemp[i] == 0x2028))
ptszOutText[k++] = 0x0D;
else if (ptszTemp[i] == 0x0D) {
@@ -52,8 +52,8 @@ BOOL CopyTextToClipboard(LPTSTR ptszText) return FALSE;
EmptyClipboard();
- HGLOBAL hCopy = GlobalAlloc(GMEM_MOVEABLE, (mir_tstrlen(ptszText) + 1)*sizeof(wchar_t));
- mir_tstrcpy((wchar_t*)GlobalLock(hCopy), ptszText);
+ HGLOBAL hCopy = GlobalAlloc(GMEM_MOVEABLE, (mir_wstrlen(ptszText) + 1)*sizeof(wchar_t));
+ mir_wstrcpy((wchar_t*)GlobalLock(hCopy), ptszText);
GlobalUnlock(hCopy);
SetClipboardData(CF_UNICODETEXT, hCopy);
CloseClipboard();
@@ -97,7 +97,7 @@ LPTSTR GenerateLayoutString(HKL hklLayout) ptszTemp[0] = 0;
DWORD i;
- for (i = 0; i < mir_tstrlen(ptszKeybEng); i++) {
+ for (i = 0; i < mir_wstrlen(ptszKeybEng); i++) {
SHORT shVirtualKey = VkKeyScanEx(ptszKeybEng[i], hklEng);
UINT iScanCode = MapVirtualKeyEx(shVirtualKey & 0x00FF, 0, hklEng);
@@ -139,9 +139,9 @@ LPTSTR GetLayoutString(HKL hklLayout) LPTSTR ChangeTextCase(LPCTSTR ptszInText)
{
LPTSTR ptszOutText = (LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t));
- mir_tstrcpy(ptszOutText, ptszInText);
+ mir_wstrcpy(ptszOutText, ptszInText);
- for (DWORD i = 0; i < mir_tstrlen(ptszInText); i++) {
+ for (DWORD i = 0; i < mir_wstrlen(ptszInText); i++) {
CharUpperBuff(&ptszOutText[i], 1);
if (ptszOutText[i] == ptszInText[i])
CharLowerBuff(&ptszOutText[i], 1);
@@ -152,7 +152,7 @@ LPTSTR ChangeTextCase(LPCTSTR ptszInText) LPTSTR ChangeTextLayout(LPCTSTR ptszInText, HKL hklCurLay, HKL hklToLay, BOOL TwoWay)
{
LPTSTR ptszOutText = (LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t));
- mir_tstrcpy(ptszOutText, ptszInText);
+ mir_wstrcpy(ptszOutText, ptszInText);
if (hklCurLay == NULL || hklToLay == NULL)
return ptszOutText;
@@ -162,20 +162,20 @@ LPTSTR ChangeTextLayout(LPCTSTR ptszInText, HKL hklCurLay, HKL hklToLay, BOOL Tw if (ptszKeybCur == 0 || ptszKeybNext == 0)
return ptszOutText;
- for (DWORD i = 0; i < mir_tstrlen(ptszInText); i++) {
+ for (DWORD i = 0; i < mir_wstrlen(ptszInText); i++) {
BOOL Found = FALSE;
- for (DWORD j = 0; j < mir_tstrlen(ptszKeybCur) && !Found; j++)
+ for (DWORD j = 0; j < mir_wstrlen(ptszKeybCur) && !Found; j++)
if (ptszKeybCur[j] == ptszInText[i]) {
Found = TRUE;
- if (mir_tstrlen(ptszKeybNext) >= j)
+ if (mir_wstrlen(ptszKeybNext) >= j)
ptszOutText[i] = ptszKeybNext[j];
}
if (TwoWay && !Found)
- for (DWORD j = 0; j < mir_tstrlen(ptszKeybNext) && !Found; j++)
+ for (DWORD j = 0; j < mir_wstrlen(ptszKeybNext) && !Found; j++)
if (ptszKeybNext[j] == ptszInText[i]) {
Found = TRUE;
- if (mir_tstrlen(ptszKeybCur) >= j)
+ if (mir_wstrlen(ptszKeybCur) >= j)
ptszOutText[i] = ptszKeybCur[j];
}
}
@@ -188,7 +188,7 @@ HKL GetLayoutOfText(LPCTSTR ptszInText) LPTSTR ptszKeybBuff = ptszLayStrings[0];
DWORD dwMaxSymbols = 0, dwTemp = 0;
- for (DWORD j = 0; j < mir_tstrlen(ptszInText); j++)
+ for (DWORD j = 0; j < mir_wstrlen(ptszInText); j++)
if (wcschr(ptszKeybBuff, ptszInText[j]) != NULL)
++dwMaxSymbols;
@@ -196,7 +196,7 @@ HKL GetLayoutOfText(LPCTSTR ptszInText) ptszKeybBuff = ptszLayStrings[i];
DWORD dwCountSymbols = 0;
- for (DWORD j = 0; j<mir_tstrlen(ptszInText); j++)
+ for (DWORD j = 0; j<mir_wstrlen(ptszInText); j++)
if (wcschr(ptszKeybBuff, ptszInText[j]) != NULL)
++dwCountSymbols;
@@ -218,7 +218,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) {
HKL hklCurLay = 0, hklToLay = 0;
- ptrT ptszInText;
+ ptrW ptszInText;
CHARRANGE crSelection = { 0 }, crTemp = { 0 };
DWORD dwStartWord, dwEndWord;
int i, iRes;
@@ -256,7 +256,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) }
if (WindowType == WTYPE_Unknown) {
- ptrT ptszTemp((LPTSTR)mir_alloc(255 * sizeof(wchar_t)));
+ ptrW ptszTemp((LPTSTR)mir_alloc(255 * sizeof(wchar_t)));
i = GetClassName(hTextWnd, ptszTemp, 255);
ptszTemp[i] = 0;
@@ -297,7 +297,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) }
}
if (WindowType == WTYPE_Edit) {
- ptrT ptszTemp((LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t)));
+ ptrW ptszTemp((LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t)));
ptszInText = (LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t));
iRes = GetWindowText(hTextWnd, ptszTemp, MaxTextSize);
if (!IsBadStringPtr(ptszInText, MaxTextSize) && (iRes > 0)) {
@@ -339,7 +339,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) if (!IsBadStringPtr(ptszInText, MaxTextSize) && (iRes > 0)) {
crTemp.cpMin = 0;
- crTemp.cpMax = (int)mir_tstrlen(ptszInText);
+ crTemp.cpMax = (int)mir_wstrlen(ptszInText);
}
else {
SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection);
@@ -351,7 +351,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) // Ïîëó÷àåì òåêóùåå ñëîâî
if (CurrentWord) {
for (dwStartWord = crSelection.cpMin; (dwStartWord > 0) && (wcschr(ptszSeparators, ptszInText[dwStartWord - 1]) == NULL); dwStartWord--);
- for (dwEndWord = crSelection.cpMin; (dwEndWord < (mir_tstrlen(ptszInText))) && (wcschr(ptszSeparators, ptszInText[dwEndWord]) == NULL); dwEndWord++);
+ for (dwEndWord = crSelection.cpMin; (dwEndWord < (mir_wstrlen(ptszInText))) && (wcschr(ptszSeparators, ptszInText[dwEndWord]) == NULL); dwEndWord++);
crTemp.cpMin = dwStartWord;
crTemp.cpMax = dwEndWord;
@@ -374,12 +374,12 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) }
if (WindowType == WTYPE_Edit) {
- ptrT ptszTemp((LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t)));
+ ptrW ptszTemp((LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t)));
wcsncpy(ptszTemp, &ptszInText[crTemp.cpMin], crTemp.cpMax - crTemp.cpMin);
ptszTemp[crTemp.cpMax - crTemp.cpMin] = 0;
- mir_tstrcpy(ptszInText, ptszTemp);
+ mir_wstrcpy(ptszInText, ptszTemp);
- if (mir_tstrlen(ptszInText) == 0) {
+ if (mir_wstrlen(ptszInText) == 0) {
SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection);
SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0);
InvalidateRect(hTextWnd, NULL, FALSE);
@@ -403,7 +403,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) // Ëîã Èåâüþ è ÕèñòîðèÏÏ â ðåæèìå ýìóëÿöèè Èåâüþ è ïîëÿ òîëüêî äëÿ ÷òåíèÿ.
if (WindowType != WTYPE_Unknown && !IsBadStringPtr(ptszInText, MaxTextSize))
if (WindowIsReadOnly) {
- ptrT ptszMBox((LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t)));
+ ptrW ptszMBox((LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t)));
ptszMBox[0] = 0;
if (TextOperation == TOT_Layout) {
@@ -416,13 +416,13 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) else {
for (i = 0; i < bLayNum; i++)
if (hklLayouts[i] != hklCurLay) {
- if (mir_tstrlen(ptszMBox) != 0)
- mir_tstrcat(ptszMBox, L"\n\n");
- ptrT ptszTemp(GetShortNameOfLayout(hklLayouts[i]));
- mir_tstrcat(ptszMBox, ptszTemp);
- mir_tstrcat(ptszMBox, L":\n");
- ptrT ptszOutText(ChangeTextLayout(ptszInText, hklCurLay, hklLayouts[i], FALSE));
- mir_tstrcat(ptszMBox, ptszOutText);
+ if (mir_wstrlen(ptszMBox) != 0)
+ mir_wstrcat(ptszMBox, L"\n\n");
+ ptrW ptszTemp(GetShortNameOfLayout(hklLayouts[i]));
+ mir_wstrcat(ptszMBox, ptszTemp);
+ mir_wstrcat(ptszMBox, L":\n");
+ ptrW ptszOutText(ChangeTextLayout(ptszInText, hklCurLay, hklLayouts[i], FALSE));
+ mir_wstrcat(ptszMBox, ptszOutText);
}
}
}
@@ -446,7 +446,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) //-------------------------------Ïîêàæåì ïîïàïû------------------------------------------
if (moOptions.ShowPopup) {
LPTSTR ptszPopupText = (LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t));
- mir_tstrcpy(ptszPopupText, ptszMBox);
+ mir_wstrcpy(ptszPopupText, ptszMBox);
POPUPDATAT_V2 pdtData = { 0 };
pdtData.cbSize = sizeof(pdtData);
@@ -494,7 +494,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) }
//------------------Ðåäàêòèðóåìûå ïîëÿ ----------------------------
else {
- ptrT ptszOutText;
+ ptrW ptszOutText;
if (TextOperation == TOT_Layout) {
hklCurLay = GetLayoutOfText(ptszInText);
hklToLay = GetNextLayout(hklCurLay);
@@ -510,7 +510,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection);
}
else {
- ptrT ptszTemp((LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t)));
+ ptrW ptszTemp((LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t)));
GetWindowText(hTextWnd, ptszTemp, MaxTextSize);
for (i = crTemp.cpMin; i < crTemp.cpMax; i++)
ptszTemp[i] = ptszOutText[i - crTemp.cpMin];
diff --git a/plugins/ClientChangeNotify/src/CString.cpp b/plugins/ClientChangeNotify/src/CString.cpp index 2427c06aea..4f4064d60a 100644 --- a/plugins/ClientChangeNotify/src/CString.cpp +++ b/plugins/ClientChangeNotify/src/CString.cpp @@ -280,7 +280,7 @@ CString db_get_s(MCONTACT hContact, const char *szModule, const char *szSetting, TCString db_get_s(MCONTACT hContact, const char *szModule, const char *szSetting, const wchar_t *szDefaultValue)
{
- ptrT p( db_get_tsa(hContact, szModule, szSetting));
+ ptrW p( db_get_tsa(hContact, szModule, szSetting));
return TCString(p == NULL ? szDefaultValue : p);
}
diff --git a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp index 33e4e1f5d5..f70270d757 100644 --- a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp +++ b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp @@ -149,11 +149,11 @@ void ShowPopup(SHOWPOPUP_DATA *sd) {
TCString PopupText;
if (sd->PopupOptPage->GetValue(IDC_POPUPOPTDLG_SHOWPREVCLIENT)) {
- mir_sntprintf(PopupText.GetBuffer(MAX_MSG_LEN), MAX_MSG_LEN, TranslateT("changed client to %s (was %s)"), (const wchar_t*)sd->MirVer, (const wchar_t*)sd->OldMirVer);
+ mir_snwprintf(PopupText.GetBuffer(MAX_MSG_LEN), MAX_MSG_LEN, TranslateT("changed client to %s (was %s)"), (const wchar_t*)sd->MirVer, (const wchar_t*)sd->OldMirVer);
PopupText.ReleaseBuffer();
}
else {
- mir_sntprintf(PopupText.GetBuffer(MAX_MSG_LEN), MAX_MSG_LEN, TranslateT("changed client to %s"), (const wchar_t*)sd->MirVer);
+ mir_snwprintf(PopupText.GetBuffer(MAX_MSG_LEN), MAX_MSG_LEN, TranslateT("changed client to %s"), (const wchar_t*)sd->MirVer);
PopupText.ReleaseBuffer();
}
@@ -257,7 +257,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) if (hContact) {
TCString ClientName;
if (PopupOptPage.GetValue(IDC_POPUPOPTDLG_SHOWPREVCLIENT) && sd.OldMirVer.GetLen()) {
- mir_sntprintf(ClientName.GetBuffer(MAX_MSG_LEN), MAX_MSG_LEN, TranslateT("%s (was %s)"), (const wchar_t*)sd.MirVer, (const wchar_t*)sd.OldMirVer);
+ mir_snwprintf(ClientName.GetBuffer(MAX_MSG_LEN), MAX_MSG_LEN, TranslateT("%s (was %s)"), (const wchar_t*)sd.MirVer, (const wchar_t*)sd.OldMirVer);
ClientName.ReleaseBuffer();
}
else ClientName = sd.MirVer;
diff --git a/plugins/ClientChangeNotify/src/Misc.h b/plugins/ClientChangeNotify/src/Misc.h index 7d1b1eb238..11b323ada1 100644 --- a/plugins/ClientChangeNotify/src/Misc.h +++ b/plugins/ClientChangeNotify/src/Misc.h @@ -26,8 +26,8 @@ __inline void ShowMsg(wchar_t *FirstLine, wchar_t *SecondLine = L"", bool IsErro {
POPUPDATAT ppd = {0};
ppd.lchIcon = LoadIcon(NULL, IsErrorMsg ? IDI_EXCLAMATION : IDI_INFORMATION);
- mir_tstrcpy(ppd.lptzContactName, FirstLine);
- mir_tstrcpy(ppd.lptzText, SecondLine);
+ mir_wstrcpy(ppd.lptzContactName, FirstLine);
+ mir_wstrcpy(ppd.lptzText, SecondLine);
ppd.colorBack = IsErrorMsg ? 0x0202E3 : 0xE8F1FD;
ppd.colorText = IsErrorMsg ? 0xE8F1FD : 0x000000;
ppd.iSeconds = Timeout;
@@ -44,7 +44,7 @@ __inline void ShowLog(TCString &LogFilePath) if (Result <= 32) // Error
{
wchar_t szError[64];
- mir_sntprintf(szError, TranslateT("Error #%d"), Result);
+ mir_snwprintf(szError, TranslateT("Error #%d"), Result);
ShowMsg(szError, TranslateT("Can't open log file ") + LogFilePath, true);
}
}
diff --git a/plugins/Clist_blind/src/clcpaint.cpp b/plugins/Clist_blind/src/clcpaint.cpp index 0c9824e4eb..e70a8e024c 100644 --- a/plugins/Clist_blind/src/clcpaint.cpp +++ b/plugins/Clist_blind/src/clcpaint.cpp @@ -304,14 +304,14 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) ChangeToFont(hdcMem, dat, FONTID_OFFLINE, &fontHeight);
else
ChangeToFont(hdcMem, dat, FONTID_CONTACTS, &fontHeight);
- GetTextExtentPoint32(hdcMem, cc->szText, (int)mir_tstrlen(cc->szText), &textSize);
+ GetTextExtentPoint32(hdcMem, cc->szText, (int)mir_wstrlen(cc->szText), &textSize);
width = textSize.cx;
if (cc->type == CLCIT_GROUP) {
szCounts = pcli->pfnGetGroupCountsText(dat, cc);
if (szCounts[0]) {
GetTextExtentPoint32(hdcMem, L" ", 1, &spaceSize);
ChangeToFont(hdcMem, dat, FONTID_GROUPCOUNTS, &fontHeight);
- GetTextExtentPoint32(hdcMem, szCounts, (int)mir_tstrlen(szCounts), &countsSize);
+ GetTextExtentPoint32(hdcMem, szCounts, (int)mir_wstrlen(szCounts), &countsSize);
width += spaceSize.cx + countsSize.cx;
}
}
@@ -374,7 +374,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) rc.right = rc.left + ((clRect.right - rc.left - textSize.cx) >> 1) - 3;
DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT);
TextOut(hdcMem, rc.right + 3, y + ((dat->rowHeight - fontHeight) >> 1), cc->szText,
- (int)mir_tstrlen(cc->szText));
+ (int)mir_wstrlen(cc->szText));
rc.left = rc.right + 6 + textSize.cx;
rc.right = clRect.right;
DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT);
@@ -390,7 +390,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) if (rc.right < rc.left + 4)
rc.right = clRect.right + 1;
else
- TextOut(hdcMem, rc.right, rc.top + groupCountsFontTopShift, szCounts, (int)mir_tstrlen(szCounts));
+ TextOut(hdcMem, rc.right, rc.top + groupCountsFontTopShift, szCounts, (int)mir_wstrlen(szCounts));
ChangeToFont(hdcMem, dat, FONTID_GROUPS, &fontHeight);
if (selected)
SetTextColor(hdcMem, dat->selTextColour);
@@ -398,12 +398,12 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) SetHotTrackColour(hdcMem, dat);
rc.right--;
ExtTextOut(hdcMem, rc.left, rc.top, ETO_CLIPPED, &rc, cc->szText,
- (int)mir_tstrlen(cc->szText), NULL);
+ (int)mir_wstrlen(cc->szText), NULL);
}
else
TextOut(hdcMem, dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace,
y + ((dat->rowHeight - fontHeight) >> 1), cc->szText,
- (int)mir_tstrlen(cc->szText));
+ (int)mir_wstrlen(cc->szText));
if (dat->exStyle & CLS_EX_LINEWITHGROUPS) {
rc.top = y + (dat->rowHeight >> 1);
rc.bottom = rc.top + 2;
@@ -426,7 +426,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) if (cc->type != CLCIT_DIVIDER) {
wchar_t *szText = cc->szText;
RECT rc;
- int qlen = (int)mir_tstrlen(dat->szQuickSearch);
+ int qlen = (int)mir_wstrlen(dat->szQuickSearch);
SetTextColor(hdcMem, dat->quickSearchColour);
rc.left = dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace;
rc.top = y + ((dat->rowHeight - fontHeight) >> 1);
diff --git a/plugins/Clist_blind/src/contact.cpp b/plugins/Clist_blind/src/contact.cpp index 3adbd0c4da..6fa199fdd0 100644 --- a/plugins/Clist_blind/src/contact.cpp +++ b/plugins/Clist_blind/src/contact.cpp @@ -90,5 +90,5 @@ int CompareContacts(const ClcContact* c1, const ClcContact* c2) nameb = pcli->pfnGetContactDisplayName(b, 0);
//otherwise just compare names
- return mir_tstrcmpi(namea, nameb);
+ return mir_wstrcmpi(namea, nameb);
}
diff --git a/plugins/Clist_blind/src/init.cpp b/plugins/Clist_blind/src/init.cpp index 30ccfa6c0c..d1889144f1 100644 --- a/plugins/Clist_blind/src/init.cpp +++ b/plugins/Clist_blind/src/init.cpp @@ -188,15 +188,15 @@ wchar_t* MyDBGetContactSettingTString(MCONTACT hContact, char* module, char* set else if (dbv.type == DBVT_UTF8)
MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, out, (int)len);
else if (dbv.type == DBVT_WCHAR)
- mir_tstrncpy(out, dbv.pwszVal, (int)len);
+ mir_wstrncpy(out, dbv.pwszVal, (int)len);
else if (def != NULL)
- mir_tstrncpy(out, def, (int)len);
+ mir_wstrncpy(out, def, (int)len);
db_free(&dbv);
}
else {
if (def != NULL)
- mir_tstrncpy(out, def, (int)len);
+ mir_wstrncpy(out, def, (int)len);
}
return out;
@@ -260,7 +260,7 @@ wchar_t * ParseText(const wchar_t *text, const wchar_t **variables, size_t variablesSize,
const wchar_t **data, size_t dataSize)
{
- size_t length = mir_tstrlen(text);
+ size_t length = mir_wstrlen(text);
size_t nextPos = 0;
StringHelper ret = { 0 };
size_t i;
@@ -287,10 +287,10 @@ wchar_t * ParseText(const wchar_t *text, // See if can find it
for (j = 0; j < size; j++) {
- size_t vlen = mir_tstrlen(variables[j]);
+ size_t vlen = mir_wstrlen(variables[j]);
if (wcsnicmp(&text[i], variables[j], vlen) == 0) {
- if (CopyData(&ret, data[j], mir_tstrlen(data[j])))
+ if (CopyData(&ret, data[j], mir_wstrlen(data[j])))
return NULL;
i += vlen - 1;
@@ -423,7 +423,7 @@ wchar_t* GetStatusName(struct ClcContact *item) // Get status name
status = db_get_w(item->hContact, item->proto, "Status", ID_STATUS_OFFLINE);
- mir_tstrncpy(status_name, pcli->pfnGetStatusModeDescription(status, 0), _countof(status_name));
+ mir_wstrncpy(status_name, pcli->pfnGetStatusModeDescription(status, 0), _countof(status_name));
return status_name;
}
@@ -457,7 +457,7 @@ wchar_t* GetProtoName(struct ClcContact *item) proto_name[0] = '\0';
if (item->hContact == NULL || item->proto == NULL) {
- mir_tstrncpy(proto_name, TranslateT("Unknown protocol"), _countof(proto_name));
+ mir_wstrncpy(proto_name, TranslateT("Unknown protocol"), _countof(proto_name));
return proto_name;
}
@@ -465,14 +465,14 @@ wchar_t* GetProtoName(struct ClcContact *item) if (acc == NULL) {
#ifdef UNICODE
CallProtoService(item->proto, PS_GETNAME, sizeof(description), (LPARAM)description);
- mir_sntprintf(proto_name, L"%S", description);
+ mir_snwprintf(proto_name, L"%S", description);
#else
CallProtoService(item->proto, PS_GETNAME, sizeof(proto_name), (LPARAM)proto_name);
#endif
return proto_name;
}
- mir_tstrncpy(proto_name, acc->tszAccountName, _countof(proto_name));
+ mir_wstrncpy(proto_name, acc->tszAccountName, _countof(proto_name));
return proto_name;
}
@@ -539,13 +539,13 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig) };
if (szCounts[0] != '\0')
- mir_sntprintf(count, L"%s ", szCounts);
+ mir_snwprintf(count, L"%s ", szCounts);
else
count[0] = '\0';
wchar_t *txt = ParseText(template_group, t, _countof(t), v, _countof(v));
if (txt != NULL)
- mir_tstrncpy(text, txt, size);
+ mir_wstrncpy(text, txt, size);
mir_free(txt);
}
break;
@@ -567,17 +567,17 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig) wchar_t *txt = ParseText(template_contact, t, _countof(t), v, _countof(v));
if (txt != NULL)
- mir_tstrncpy(text, txt, size);
+ mir_wstrncpy(text, txt, size);
mir_free(txt);
}
break;
case CLCIT_DIVIDER:
- mir_sntprintf(text, size, template_divider, item->szText);
+ mir_snwprintf(text, size, template_divider, item->szText);
break;
case CLCIT_INFO:
- mir_sntprintf(text, size, template_info, item->szText);
+ mir_snwprintf(text, size, template_info, item->szText);
break;
}
diff --git a/plugins/Clist_modern/src/cluiframes.cpp b/plugins/Clist_modern/src/cluiframes.cpp index 38d402c835..4cd01abef0 100644 --- a/plugins/Clist_modern/src/cluiframes.cpp +++ b/plugins/Clist_modern/src/cluiframes.cpp @@ -681,7 +681,7 @@ static int LocateStorePosition(int Frameid, int maxstored) if (db_get_ts(NULL, CLUIFrameModule, settingname, &dbv))
continue;
- if (mir_tstrcmpi(dbv.ptszVal, g_pfwFrames[Frameid].name) == 0) {
+ if (mir_wstrcmpi(dbv.ptszVal, g_pfwFrames[Frameid].name) == 0) {
db_free(&dbv);
return i;
}
@@ -1049,9 +1049,9 @@ static int _us_DoSetFrameOptions(WPARAM wParam, LPARAM lParam) mir_free(fw.name);
if (bUnicodeText)
- fw.name = mir_tstrdup((LPTSTR)lParam);
+ fw.name = mir_wstrdup((LPTSTR)lParam);
else
- fw.name = mir_a2t((char *)lParam);
+ fw.name = mir_a2u((char *)lParam);
return 0;
case FO_TBNAME:
@@ -1060,9 +1060,9 @@ static int _us_DoSetFrameOptions(WPARAM wParam, LPARAM lParam) mir_free(fw.TitleBar.tbname);
if (bUnicodeText)
- fw.TitleBar.tbname = mir_tstrdup((LPTSTR)lParam);
+ fw.TitleBar.tbname = mir_wstrdup((LPTSTR)lParam);
else
- fw.TitleBar.tbname = mir_a2t((char*)lParam);
+ fw.TitleBar.tbname = mir_a2u((char*)lParam);
if (fw.floating && (fw.TitleBar.tbname != NULL))
SetWindowText(fw.ContainerWnd, fw.TitleBar.tbname);
@@ -1075,9 +1075,9 @@ static int _us_DoSetFrameOptions(WPARAM wParam, LPARAM lParam) if (fw.TitleBar.tooltip != NULL)
mir_free_and_nil(fw.TitleBar.tooltip);
if (bUnicodeText)
- fw.TitleBar.tooltip = mir_tstrdup((LPTSTR)lParam);
+ fw.TitleBar.tooltip = mir_wstrdup((LPTSTR)lParam);
else
- fw.TitleBar.tooltip = mir_a2t((char*)lParam);
+ fw.TitleBar.tooltip = mir_a2u((char*)lParam);
UpdateTBToolTip(pos);
return 0;
@@ -1568,13 +1568,13 @@ static int _us_DoAddFrame(WPARAM wParam, LPARAM) g_pfwFrames[g_nFramesCount].name = (LPTSTR)mir_alloc(255 * sizeof(wchar_t));
GetClassName(g_pfwFrames[g_nFramesCount].hWnd, g_pfwFrames[g_nFramesCount].name, 255);
}
- else g_pfwFrames[g_nFramesCount].name = (clfrm->Flags & F_UNICODE) ? mir_u2t(clfrm->wname) : mir_a2t(clfrm->name);
+ else g_pfwFrames[g_nFramesCount].name = (clfrm->Flags & F_UNICODE) ? mir_wstrdup(clfrm->wname) : mir_a2u(clfrm->name);
if (IsBadCodePtr((FARPROC)clfrm->TBname) || clfrm->TBname == NULL
|| ((clfrm->Flags&F_UNICODE) ? mir_wstrlen(clfrm->TBwname) : mir_strlen(clfrm->TBname)) == 0)
- g_pfwFrames[g_nFramesCount].TitleBar.tbname = mir_tstrdup(g_pfwFrames[g_nFramesCount].name);
+ g_pfwFrames[g_nFramesCount].TitleBar.tbname = mir_wstrdup(g_pfwFrames[g_nFramesCount].name);
else
- g_pfwFrames[g_nFramesCount].TitleBar.tbname = (clfrm->Flags & F_UNICODE) ? mir_u2t(clfrm->TBwname) : mir_a2t(clfrm->TBname);
+ g_pfwFrames[g_nFramesCount].TitleBar.tbname = (clfrm->Flags & F_UNICODE) ? mir_wstrdup(clfrm->TBwname) : mir_a2u(clfrm->TBname);
g_pfwFrames[g_nFramesCount].needhide = FALSE;
g_pfwFrames[g_nFramesCount].TitleBar.ShowTitleBar = (clfrm->Flags & F_SHOWTB ? TRUE : FALSE);
@@ -2362,7 +2362,7 @@ int OnFrameTitleBarBackgroundChange(WPARAM, LPARAM) }
if (g_CluiData.fDisableSkinEngine) {
if (db_get_b(NULL, "FrameTitleBar", "UseBitmap", CLCDEFAULT_USEBITMAP)) {
- ptrT tszBitmapName(db_get_tsa(NULL, "FrameTitleBar", "BkBitmap"));
+ ptrW tszBitmapName(db_get_tsa(NULL, "FrameTitleBar", "BkBitmap"));
if (tszBitmapName)
sttBmpBackground = Bitmap_Load(tszBitmapName);
}
@@ -2552,7 +2552,7 @@ int DrawTitleBar(HDC hdcMem2, RECT *rect, int Frameid) textrc.left += GetSystemMetrics(SM_CXSMICON) + 2;
textrc.top += 2;
}
- ske_TextOut(hdcMem, textrc.left, textrc.top, g_pfwFrames[pos].TitleBar.tbname, (int)mir_tstrlen(g_pfwFrames[pos].TitleBar.tbname));
+ ske_TextOut(hdcMem, textrc.left, textrc.top, g_pfwFrames[pos].TitleBar.tbname, (int)mir_wstrlen(g_pfwFrames[pos].TitleBar.tbname));
if (!AlignCOLLIconToLeft)
ske_DrawIconEx(hdcMem, g_pfwFrames[pos].TitleBar.wndSize.right - GetSystemMetrics(SM_CXSMICON) - 2, rc.top + ((g_nTitleBarHeight >> 1) - (GetSystemMetrics(SM_CXSMICON) >> 1)), g_pfwFrames[pos].collapsed ? Skin_LoadIcon(SKINICON_OTHER_GROUPOPEN) : Skin_LoadIcon(SKINICON_OTHER_GROUPSHUT), GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL);
@@ -2735,7 +2735,7 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam if (pos != -1) {
int oldflags;
- mir_sntprintf(TBcapt, L"%s - h:%d, vis:%d, fl:%d, fl:(%d,%d,%d,%d),or: %d",
+ mir_snwprintf(TBcapt, L"%s - h:%d, vis:%d, fl:%d, fl:(%d,%d,%d,%d),or: %d",
g_pfwFrames[pos].name, g_pfwFrames[pos].height, g_pfwFrames[pos].visible, g_pfwFrames[pos].floating,
g_pfwFrames[pos].FloatingPos.x, g_pfwFrames[pos].FloatingPos.y,
g_pfwFrames[pos].FloatingSize.x, g_pfwFrames[pos].FloatingSize.y,
diff --git a/plugins/Clist_modern/src/modern_aniavatars.cpp b/plugins/Clist_modern/src/modern_aniavatars.cpp index 9eb5a578f8..74e4809ab5 100644 --- a/plugins/Clist_modern/src/modern_aniavatars.cpp +++ b/plugins/Clist_modern/src/modern_aniavatars.cpp @@ -153,7 +153,7 @@ static int _AniAva_SortAvatarInfo(const ANIAVA_INFO *aai1, const ANIAVA_INFO *aa {
int res;
if (aai1 && aai1->tcsFilename && aai2 && aai2->tcsFilename)
- res = mir_tstrcmpi(aai2->tcsFilename, aai1->tcsFilename);
+ res = mir_wstrcmpi(aai2->tcsFilename, aai1->tcsFilename);
else {
int a1 = (aai1 != NULL && aai1->tcsFilename != NULL);
int a2 = (aai2 != NULL && aai2->tcsFilename != NULL);
@@ -351,7 +351,7 @@ static int _AniAva_LoadAvatarFromImage(wchar_t * szFileName, int width, int heig int idx = s_AniAvatarList.getIndex(&aai);
if (idx == -1) { //item not present in list
paai = (ANIAVA_INFO *)mir_calloc(sizeof(ANIAVA_INFO));
- paai->tcsFilename = mir_tstrdup(szFileName);
+ paai->tcsFilename = mir_wstrdup(szFileName);
paai->dwAvatarUniqId = rand();
// get image strip
diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp index 95e2a7f196..2406754e47 100644 --- a/plugins/Clist_modern/src/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp @@ -79,7 +79,7 @@ void CSmileyString::AddListeningToIcon(ClcData *dat, wchar_t *szText) if (szText == NULL) return; - int text_size = (int)mir_tstrlen(szText); + int text_size = (int)mir_wstrlen(szText); plText = List_Create(0, 1); @@ -180,7 +180,7 @@ void CSmileyString::ReplaceSmileys(ClcData *dat, ClcCacheEntry *pdnce, wchar_t * if (!dat->text_replace_smileys || !replace_smileys || szText == NULL) return; - int text_size = (int)mir_tstrlen(szText); + int text_size = (int)mir_wstrlen(szText); // Call service for the first time to see if needs to be used... SMADD_BATCHPARSE2 sp = { 0 }; @@ -283,7 +283,7 @@ int GetStatusName(wchar_t *text, int text_size, ClcCacheEntry *pdnce, BOOL xstat if (!noAwayMsg && !noXstatus && xstatus_has_priority && pdnce->hContact && pdnce->m_pszProto) { DBVARIANT dbv = { 0 }; if (!db_get_ts(pdnce->hContact, pdnce->m_pszProto, "XStatusName", &dbv)) { - //mir_tstrncpy(text, dbv.pszVal, text_size); + //mir_wstrncpy(text, dbv.pszVal, text_size); CopySkipUnprintableChars(text, dbv.ptszVal, text_size - 1); db_free(&dbv); @@ -295,7 +295,7 @@ int GetStatusName(wchar_t *text, int text_size, ClcCacheEntry *pdnce, BOOL xstat // Get Status name wchar_t *tmp = pcli->pfnGetStatusModeDescription(nStatus, 0); if (tmp && *tmp) { - mir_tstrncpy(text, tmp, text_size); + mir_wstrncpy(text, tmp, text_size); return 1; } @@ -324,7 +324,7 @@ void GetListeningTo(wchar_t *text, int text_size, ClcCacheEntry *pdnce) if (pdnce->m_iStatus == ID_STATUS_OFFLINE || pdnce->m_iStatus == 0) return; - ptrT tszValue(db_get_tsa(pdnce->hContact, pdnce->m_pszProto, "ListeningTo")); + ptrW tszValue(db_get_tsa(pdnce->hContact, pdnce->m_pszProto, "ListeningTo")); if (tszValue != NULL) CopySkipUnprintableChars(text, tszValue, text_size - 1); } @@ -345,7 +345,7 @@ int GetStatusMessage(wchar_t *text, int text_size, ClcCacheEntry *pdnce, BOOL xs // Get XStatusMsg if (!noAwayMsg && xstatus_has_priority && pdnce->hContact && pdnce->m_pszProto) { - ptrT tszXStatusMsg(db_get_tsa(pdnce->hContact, pdnce->m_pszProto, "XStatusMsg")); + ptrW tszXStatusMsg(db_get_tsa(pdnce->hContact, pdnce->m_pszProto, "XStatusMsg")); if (tszXStatusMsg != NULL) { CopySkipUnprintableChars(text, tszXStatusMsg, text_size - 1); if (text[0] != '\0') @@ -355,7 +355,7 @@ int GetStatusMessage(wchar_t *text, int text_size, ClcCacheEntry *pdnce, BOOL xs // Get StatusMsg if (pdnce->hContact && text[0] == '\0') { - ptrT tszStatusMsg(db_get_tsa(pdnce->hContact, "CList", "StatusMsg")); + ptrW tszStatusMsg(db_get_tsa(pdnce->hContact, "CList", "StatusMsg")); if (tszStatusMsg != NULL) { CopySkipUnprintableChars(text, tszStatusMsg, text_size - 1); if (text[0] != '\0') @@ -366,7 +366,7 @@ int GetStatusMessage(wchar_t *text, int text_size, ClcCacheEntry *pdnce, BOOL xs // Get XStatusMsg if (!noAwayMsg && !xstatus_has_priority && pdnce->hContact && pdnce->m_pszProto && text[0] == '\0') { // Try to get XStatusMsg - ptrT tszXStatusMsg(db_get_tsa(pdnce->hContact, pdnce->m_pszProto, "XStatusMsg")); + ptrW tszXStatusMsg(db_get_tsa(pdnce->hContact, pdnce->m_pszProto, "XStatusMsg")); if (tszXStatusMsg != NULL) { CopySkipUnprintableChars(text, tszXStatusMsg, text_size - 1); if (text[0] != '\0') @@ -391,10 +391,10 @@ int Cache_GetLineText(ClcCacheEntry *pdnce, int type, LPTSTR text, int text_size LBL_Status: if (GetStatusName(text, text_size, pdnce, line.xstatus_has_priority) == -1 && line.use_name_and_message_for_xstatus) { // Try to get XStatusMsg - ptrT tszXStatusMsg(db_get_tsa(pdnce->hContact, pdnce->m_pszProto, "XStatusMsg")); + ptrW tszXStatusMsg(db_get_tsa(pdnce->hContact, pdnce->m_pszProto, "XStatusMsg")); if (tszXStatusMsg != NULL && tszXStatusMsg[0] != 0) { wchar_t *tmp = NEWWSTR_ALLOCA(text); - mir_sntprintf(text, text_size, L"%s: %s", tmp, tszXStatusMsg); + mir_snwprintf(text, text_size, L"%s: %s", tmp, tszXStatusMsg); CopySkipUnprintableChars(text, text, text_size - 1); } } @@ -402,9 +402,9 @@ LBL_Status: case TEXT_NICKNAME: if (pdnce->hContact && pdnce->m_pszProto) { - ptrT tszNick(db_get_tsa(pdnce->hContact, pdnce->m_pszProto, "Nick")); + ptrW tszNick(db_get_tsa(pdnce->hContact, pdnce->m_pszProto, "Nick")); if (tszNick != NULL) { - mir_tstrncpy(text, tszNick, text_size); + mir_wstrncpy(text, tszNick, text_size); CopySkipUnprintableChars(text, text, text_size - 1); } } @@ -413,18 +413,18 @@ LBL_Status: case TEXT_STATUS_MESSAGE: if (GetStatusMessage(text, text_size, pdnce, line.xstatus_has_priority) == -1 && line.use_name_and_message_for_xstatus) { // Try to get XStatusName - ptrT tszXStatusName(db_get_tsa(pdnce->hContact, pdnce->m_pszProto, "XStatusName")); + ptrW tszXStatusName(db_get_tsa(pdnce->hContact, pdnce->m_pszProto, "XStatusName")); if (tszXStatusName != NULL && tszXStatusName[0] != 0) { wchar_t *tmp = NEWWSTR_ALLOCA(text); - mir_sntprintf(text, text_size, L"%s: %s", tszXStatusName, tmp); + mir_snwprintf(text, text_size, L"%s: %s", tszXStatusName, tmp); CopySkipUnprintableChars(text, text, text_size - 1); } } else if (line.use_name_and_message_for_xstatus && line.xstatus_has_priority) { // Try to get XStatusName - ptrT tszXStatusName(db_get_tsa(pdnce->hContact, pdnce->m_pszProto, "XStatusName")); + ptrW tszXStatusName(db_get_tsa(pdnce->hContact, pdnce->m_pszProto, "XStatusName")); if (tszXStatusName != NULL && tszXStatusName[0] != 0) { - mir_tstrncpy(text, tszXStatusName, text_size); + mir_wstrncpy(text, tszXStatusName, text_size); CopySkipUnprintableChars(text, text, text_size - 1); } } @@ -447,8 +447,8 @@ LBL_Status: case TEXT_TEXT: { - ptrT tmp(variables_parsedup(line.text, pdnce->tszName, pdnce->hContact)); - mir_tstrncpy(text, tmp, text_size); + ptrW tmp(variables_parsedup(line.text, pdnce->tszName, pdnce->hContact)); + mir_wstrncpy(text, tmp, text_size); CopySkipUnprintableChars(text, text, text_size - 1); } return TEXT_TEXT; @@ -479,18 +479,18 @@ void Cache_GetFirstLineText(ClcData *dat, ClcContact *contact) DBVARIANT dbv = { 0 }; if (!db_get_ts(pdnce->hContact, pdnce->m_pszProto, "Nick", &dbv)) { wchar_t nick[_countof(contact->szText)]; - mir_tstrncpy(nick, dbv.ptszVal, _countof(contact->szText)); + mir_wstrncpy(nick, dbv.ptszVal, _countof(contact->szText)); db_free(&dbv); // They are the same -> use the name to keep the case - if (mir_tstrcmpi(name, nick) == 0) - mir_tstrncpy(contact->szText, name, _countof(contact->szText)); + if (mir_wstrcmpi(name, nick) == 0) + mir_wstrncpy(contact->szText, name, _countof(contact->szText)); else // Append then - mir_sntprintf(contact->szText, L"%s - %s", name, nick); + mir_snwprintf(contact->szText, L"%s - %s", name, nick); } - else mir_tstrncpy(contact->szText, name, _countof(contact->szText)); + else mir_wstrncpy(contact->szText, name, _countof(contact->szText)); } - else mir_tstrncpy(contact->szText, name, _countof(contact->szText)); + else mir_wstrncpy(contact->szText, name, _countof(contact->szText)); if (!dat->bForceInDialog) contact->ssText.ReplaceSmileys(dat, pdnce, contact->szText, dat->first_line_draw_smileys); @@ -505,20 +505,20 @@ void Cache_GetNthLineText(ClcData *dat, ClcCacheEntry *pdnce, int n) ClcLineInfo &line = (n == 2) ? dat->secondLine : dat->thirdLine; wchar_t* &szText = (n == 2) ? pdnce->szSecondLineText : pdnce->szThirdLineText; - // in most cases replaceStrT does nothing + // in most cases replaceStrW does nothing if (!line.show) { - replaceStrT(szText, NULL); + replaceStrW(szText, NULL); return; } int type = Cache_GetLineText(pdnce, line.type, Text, _countof(Text), line); if (Text[0] == 0) { - replaceStrT(szText, NULL); + replaceStrW(szText, NULL); return; } Text[_countof(Text) - 1] = 0; //to be sure that it is null terminated string - replaceStrT(szText, Text); + replaceStrW(szText, Text); CSmileyString &ss = (n == 2) ? pdnce->ssSecondLine : pdnce->ssThirdLine; if (type == TEXT_LISTENING_TO && szText[0] != '\0') @@ -532,8 +532,8 @@ void Cache_GetNthLineText(ClcData *dat, ClcCacheEntry *pdnce, int n) void RemoveTag(wchar_t *to, wchar_t *tag) { wchar_t *st = to; - int len = (int)mir_tstrlen(tag); - int lastsize = (int)mir_tstrlen(to) + 1; + int len = (int)mir_wstrlen(tag); + int lastsize = (int)mir_wstrlen(to) + 1; while (st = wcsstr(st, tag)) { lastsize -= len; memmove((void*)st, (void*)(st + len), (lastsize)*sizeof(wchar_t)); @@ -669,7 +669,7 @@ void Cache_ProceedAvatarInList(ClcData *dat, ClcContact *contact) else height_clip = width_clip * ace->bmHeight / ace->bmWidth; - if (wildcmpit(contact->avatar_data->szFilename, L"*.gif")) { + if (wildcmpiw(contact->avatar_data->szFilename, L"*.gif")) { if (old_pos == AVATAR_POS_ANIMATED) AniAva_RemoveAvatar(contact->hContact); diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index b2c4001665..ed48ac41bc 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -205,7 +205,7 @@ static int clcProceedDragToScroll(HWND hwnd, int Y) static int clcSearchNextContact(HWND hwnd, ClcData *dat, int index, const wchar_t *text, int prefixOk, BOOL fSearchUp)
{
ClcGroup *group = &dat->list;
- int testlen = (int)mir_tstrlen(text);
+ int testlen = (int)mir_wstrlen(text);
BOOL fReturnAsFound = FALSE;
int nLastFound = -1;
if (index == -1) fReturnAsFound = TRUE;
@@ -229,7 +229,7 @@ static int clcSearchNextContact(HWND hwnd, ClcData *dat, int index, const wchar_ wchar_t *lowered_search = CharLowerW(NEWWSTR_ALLOCA(dat->szQuickSearch));
found = wcsstr(lowered_szText, lowered_search) != NULL;
}
- else found = ((prefixOk && CSTR_EQUAL == CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, text, -1, cc->szText, testlen)) || (!prefixOk && !mir_tstrcmpi(text, cc->szText)));
+ else found = ((prefixOk && CSTR_EQUAL == CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, text, -1, cc->szText, testlen)) || (!prefixOk && !mir_wstrcmpi(text, cc->szText)));
if (found) {
ClcGroup *contactGroup = group;
@@ -1083,7 +1083,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, if (mir_strcmp(contSour->proto, META_PROTO)) {
if (!contSour->iSubNumber) {
MCONTACT hDest = contDest->hContact;
- mir_sntprintf(Wording, TranslateT("Do you want contact '%s' to be converted to metacontact and '%s' be added to it?"), contDest->szText, contSour->szText);
+ mir_snwprintf(Wording, TranslateT("Do you want contact '%s' to be converted to metacontact and '%s' be added to it?"), contDest->szText, contSour->szText);
int res = MessageBox(hwnd, Wording, TranslateT("Converting to metacontact"), MB_OKCANCEL | MB_ICONQUESTION);
if (res == 1) {
MCONTACT handle = CallService(MS_MC_CONVERTTOMETA, hDest, 0);
@@ -1096,7 +1096,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, else {
hcontact = contSour->hContact;
MCONTACT hdest = contDest->hContact;
- mir_sntprintf(Wording, TranslateT("Do you want contact '%s' to be converted to metacontact and '%s' be added to it (remove it from '%s')?"), contDest->szText, contSour->szText, contSour->subcontacts->szText);
+ mir_snwprintf(Wording, TranslateT("Do you want contact '%s' to be converted to metacontact and '%s' be added to it (remove it from '%s')?"), contDest->szText, contSour->szText, contSour->subcontacts->szText);
int res = MessageBox(hwnd, Wording, TranslateT("Converting to metacontact (moving)"), MB_OKCANCEL | MB_ICONQUESTION);
if (res == 1) {
MCONTACT handle = (MCONTACT)CallService(MS_MC_CONVERTTOMETA, (WPARAM)hdest, 0);
@@ -1122,7 +1122,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, if (!contSour->iSubNumber) {
MCONTACT hcontact = contSour->hContact;
MCONTACT handle = contDest->hContact;
- mir_sntprintf(Wording, TranslateT("Do you want contact '%s' to be added to metacontact '%s'?"), contSour->szText, contDest->szText);
+ mir_snwprintf(Wording, TranslateT("Do you want contact '%s' to be added to metacontact '%s'?"), contSour->szText, contDest->szText);
int res = MessageBox(hwnd, Wording, TranslateT("Adding contact to metacontact"), MB_OKCANCEL | MB_ICONQUESTION);
if (res == 1) {
if (!handle)
@@ -1132,7 +1132,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, }
else if (contSour->subcontacts == contDest) {
MCONTACT hsour = contSour->hContact;
- mir_sntprintf(Wording, TranslateT("Do you want contact '%s' to be default?"), contSour->szText);
+ mir_snwprintf(Wording, TranslateT("Do you want contact '%s' to be default?"), contSour->szText);
int res = MessageBox(hwnd, Wording, TranslateT("Set default contact"), MB_OKCANCEL | MB_ICONQUESTION);
if (res == 1)
db_mc_setDefault(contDest->hContact, hsour, true);
@@ -1140,7 +1140,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, else {
MCONTACT hcontact = contSour->hContact;
MCONTACT handle = contDest->hContact;
- mir_sntprintf(Wording, TranslateT("Do you want contact '%s' to be removed from metacontact '%s' and added to '%s'?"), contSour->szText, contSour->subcontacts->szText, contDest->szText);
+ mir_snwprintf(Wording, TranslateT("Do you want contact '%s' to be removed from metacontact '%s' and added to '%s'?"), contSour->szText, contSour->subcontacts->szText, contDest->szText);
int res = MessageBox(hwnd, Wording, TranslateT("Changing metacontacts (moving)"), MB_OKCANCEL | MB_ICONQUESTION);
if (res == 1) {
if (!handle)
@@ -1164,7 +1164,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, if (!contSour->iSubNumber) {
MCONTACT hcontact = contSour->hContact;
MCONTACT handle = contDest->subcontacts->hContact;
- mir_sntprintf(Wording, TranslateT("Do you want contact '%s' to be added to metacontact '%s'?"), contSour->szText, contDest->subcontacts->szText);
+ mir_snwprintf(Wording, TranslateT("Do you want contact '%s' to be added to metacontact '%s'?"), contSour->szText, contDest->subcontacts->szText);
int res = MessageBox(hwnd, Wording, TranslateT("Changing metacontacts (moving)"), MB_OKCANCEL | MB_ICONQUESTION);
if (res == 1) {
if (!handle)
@@ -1176,7 +1176,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, else if (contSour->subcontacts != contDest->subcontacts) {
MCONTACT hcontact = contSour->hContact;
MCONTACT handle = contDest->subcontacts->hContact;
- mir_sntprintf(Wording, TranslateT("Do you want contact '%s' to be removed from metacontact '%s' and added to '%s'?"), contSour->szText, contSour->subcontacts->szText, contDest->subcontacts->szText);
+ mir_snwprintf(Wording, TranslateT("Do you want contact '%s' to be removed from metacontact '%s' and added to '%s'?"), contSour->szText, contSour->subcontacts->szText, contDest->subcontacts->szText);
int res = MessageBox(hwnd, Wording, TranslateT("Changing metacontacts (moving)"), MB_OKCANCEL | MB_ICONQUESTION);
if (res == 1) {
if (!handle)
@@ -1202,11 +1202,11 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, pcli->pfnGetRowByIndex(dat, dat->iDragItem, &contact, &group);
int i = pcli->pfnGetRowByIndex(dat, dat->iInsertionMark, &destcontact, &destgroup);
if (i != -1 && group->groupId != destgroup->groupId) {
- wchar_t *groupName = mir_tstrdup(Clist_GroupGetName(contact->groupId, 0));
+ wchar_t *groupName = mir_wstrdup(Clist_GroupGetName(contact->groupId, 0));
wchar_t *shortGroup = NULL;
- wchar_t *sourceGrName = mir_tstrdup(Clist_GroupGetName(destgroup->groupId, 0));
+ wchar_t *sourceGrName = mir_wstrdup(Clist_GroupGetName(destgroup->groupId, 0));
if (groupName) {
- int len = (int)mir_tstrlen(groupName);
+ int len = (int)mir_wstrlen(groupName);
do { len--; } while (len >= 0 && groupName[len] != '\\');
if (len >= 0)
shortGroup = groupName + len + 1;
@@ -1216,9 +1216,9 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, if (shortGroup) {
NeedRename = TRUE;
if (sourceGrName)
- mir_sntprintf(newName, L"%s\\%s", sourceGrName, shortGroup);
+ mir_snwprintf(newName, L"%s\\%s", sourceGrName, shortGroup);
else
- mir_tstrncpy(newName, shortGroup, _countof(newName));
+ mir_wstrncpy(newName, shortGroup, _countof(newName));
}
mir_free(groupName);
mir_free(sourceGrName);
diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index e2a5cb896f..d23703ba0a 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -433,10 +433,10 @@ int CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, ClcData *dat) }
if (g_CluiData.bFilterEffective & CLVM_FILTER_GROUPS) {
- ptrT tszGroup(db_get_tsa(hContact, "CList", "Group"));
+ ptrW tszGroup(db_get_tsa(hContact, "CList", "Group"));
if (tszGroup != NULL) {
wchar_t szGroupMask[256];
- mir_sntprintf(szGroupMask, L"%s|", tszGroup);
+ mir_snwprintf(szGroupMask, L"%s|", tszGroup);
filterResult = (g_CluiData.filterFlags & CLVM_PROTOGROUP_OP) ? (filterResult | (wcsstr(g_CluiData.groupFilter, szGroupMask) ? 1 : 0)) : (filterResult & (wcsstr(g_CluiData.groupFilter, szGroupMask) ? 1 : 0));
}
else if (g_CluiData.filterFlags & CLVM_INCLUDED_UNGROUPED)
diff --git a/plugins/Clist_modern/src/modern_clcopts.cpp b/plugins/Clist_modern/src/modern_clcopts.cpp index 4abc781b90..bacc564cc9 100644 --- a/plugins/Clist_modern/src/modern_clcopts.cpp +++ b/plugins/Clist_modern/src/modern_clcopts.cpp @@ -138,8 +138,8 @@ void RegisterCLUIFonts(void) fontid.flags = FIDF_DEFAULTVALID | FIDF_APPENDNAME | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_ALLOWREREGISTER | FIDF_NOAS;
fontid.flags |= fontOptionsList[i].dwFlags;
- mir_tstrncpy(fontid.group, fontOptionsList[i].szGroup, _countof(fontid.group));
- mir_tstrncpy(fontid.name, fontOptionsList[i].szDescr, _countof(fontid.name));
+ mir_wstrncpy(fontid.group, fontOptionsList[i].szGroup, _countof(fontid.group));
+ mir_wstrncpy(fontid.name, fontOptionsList[i].szDescr, _countof(fontid.name));
mir_snprintf(idstr, "Font%d", fontOptionsList[i].fontID);
mir_strncpy(fontid.prefix, idstr, _countof(fontid.prefix));
fontid.order = i + 1;
@@ -148,12 +148,12 @@ void RegisterCLUIFonts(void) fontid.deffontsettings.colour = fontOptionsList[i].defColour;
fontid.deffontsettings.size = fontOptionsList[i].defSize;
fontid.deffontsettings.style = fontOptionsList[i].defStyle;
- mir_tstrncpy(fontid.deffontsettings.szFace, fontOptionsList[i].szDefFace, _countof(fontid.deffontsettings.szFace));
+ mir_wstrncpy(fontid.deffontsettings.szFace, fontOptionsList[i].szDefFace, _countof(fontid.deffontsettings.szFace));
FontRegisterT(&fontid);
- mir_tstrncpy(effectid.group, fontOptionsList[i].szGroup, _countof(effectid.group));
- mir_tstrncpy(effectid.name, fontOptionsList[i].szDescr, _countof(effectid.name));
+ mir_wstrncpy(effectid.group, fontOptionsList[i].szGroup, _countof(effectid.group));
+ mir_wstrncpy(effectid.name, fontOptionsList[i].szDescr, _countof(effectid.name));
mir_snprintf(idstr, "Font%d", fontOptionsList[i].fontID);
mir_strncpy(effectid.setting, idstr, _countof(effectid.setting));
effectid.order = i + 1;
@@ -169,8 +169,8 @@ void RegisterCLUIFonts(void) colourid.cbSize = sizeof(colourid);
for (int i = 0; i < _countof(colourOptionsList); i++) {
- mir_tstrncpy(colourid.group, colourOptionsList[i].szGroup, _countof(colourid.group));
- mir_tstrncpy(colourid.name, colourOptionsList[i].szDescr, _countof(colourid.group));
+ mir_wstrncpy(colourid.group, colourOptionsList[i].szGroup, _countof(colourid.group));
+ mir_wstrncpy(colourid.name, colourOptionsList[i].szDescr, _countof(colourid.group));
mir_strncpy(colourid.setting, colourOptionsList[i].chName, _countof(colourid.setting));
mir_strncpy(colourid.dbSettingsGroup, colourOptionsList[i].chGroup, _countof(colourid.dbSettingsGroup));
colourid.defcolour = colourOptionsList[i].defColour;
@@ -205,8 +205,8 @@ void GetFontSetting(int i, LOGFONT *lf, COLORREF *colour, BYTE *effect, COLORREF FontIDT fontid = { 0 };
fontid.cbSize = sizeof(fontid);
- mir_tstrncpy(fontid.group, fontOptionsList[index].szGroup, _countof(fontid.group));
- mir_tstrncpy(fontid.name, fontOptionsList[index].szDescr, _countof(fontid.name));
+ mir_wstrncpy(fontid.group, fontOptionsList[index].szGroup, _countof(fontid.group));
+ mir_wstrncpy(fontid.name, fontOptionsList[index].szDescr, _countof(fontid.name));
COLORREF col = CallService(MS_FONT_GETT, (WPARAM)&fontid, (LPARAM)lf);
diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp index e03c992085..babe45df32 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.cpp +++ b/plugins/Clist_modern/src/modern_clcpaint.cpp @@ -199,7 +199,7 @@ void CLCPaint::GetTextSize(SIZE *text_size, HDC hdcMem, RECT free_row_rc, wchar_ free_height = text_rc.bottom - text_rc.top;
// Always need cy...
- text_size->cy = ske_DrawText(hdcMem, szText, (int)mir_tstrlen(szText), &text_rc, DT_CALCRECT | uTextFormat);
+ text_size->cy = ske_DrawText(hdcMem, szText, (int)mir_wstrlen(szText), &text_rc, DT_CALCRECT | uTextFormat);
text_size->cy = min(text_size->cy, free_height);
if (plText == NULL)
text_size->cx = min(text_rc.right - text_rc.left + 2, free_width);
@@ -419,7 +419,7 @@ void CLCPaint::_DrawTextSmiley(HDC hdcMem, RECT *free_rc, SIZE * text_size, wcha int pos_x = 0;
int row_height;
RECT tmp_rc = *free_rc;
- if (len == -1) len = (int)mir_tstrlen(szText);
+ if (len == -1) len = (int)mir_wstrlen(szText);
if (uTextFormat & DT_RTLREADING)
i = plText->realCount - 1;
else
@@ -783,7 +783,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R int space_width = 0;
szCounts = pcli->pfnGetGroupCountsText(dat, Drawing);
// Has to draw the count?
- if (szCounts && mir_tstrlen(szCounts) > 0) {
+ if (szCounts && mir_wstrlen(szCounts) > 0) {
// calc width and height
ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPCOUNTS : FONTID_CLOSEDGROUPCOUNTS, NULL);
ske_DrawText(hdcMem, L" ", 1, &count_rc, DT_CALCRECT | DT_NOPREFIX);
@@ -791,7 +791,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R space_width = count_size.cx;
count_rc.right = 0;
count_rc.left = 0;
- ske_DrawText(hdcMem, szCounts, (int)mir_tstrlen(szCounts), &count_rc, DT_CALCRECT);
+ ske_DrawText(hdcMem, szCounts, (int)mir_wstrlen(szCounts), &count_rc, DT_CALCRECT);
count_size.cx += count_rc.right - count_rc.left;
count_size.cy = count_rc.bottom - count_rc.top;
}
@@ -833,21 +833,21 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R else if (hottrack)
_SetHotTrackColour(hdcMem, dat);
if (dat->text_rtl != 0) _RTLRect(&nameRect, free_row_rc.right);
- _DrawTextSmiley(hdcMem, &nameRect, &text_size, Drawing->szText, 0, (int)mir_tstrlen(Drawing->szText), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
+ _DrawTextSmiley(hdcMem, &nameRect, &text_size, Drawing->szText, 0, (int)mir_wstrlen(Drawing->szText), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
if (selected && !dat->bFilterSearch) {
SetTextColor(hdcMem, dat->quickSearchColour);
- _DrawTextSmiley(hdcMem, &nameRect, &text_size, Drawing->szText, 0, (int)mir_tstrlen(Drawing->szText), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
+ _DrawTextSmiley(hdcMem, &nameRect, &text_size, Drawing->szText, 0, (int)mir_wstrlen(Drawing->szText), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
}
- if (szCounts && mir_tstrlen(szCounts) > 0) {
+ if (szCounts && mir_wstrlen(szCounts) > 0) {
ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPCOUNTS : FONTID_CLOSEDGROUPCOUNTS, NULL);
if (selected)
SetTextColor(hdcMem, dat->selTextColour);
else if (hottrack)
_SetHotTrackColour(hdcMem, dat);
if (dat->text_rtl != 0) _RTLRect(&countRect, free_row_rc.right);
- ske_DrawText(hdcMem, szCounts, (int)mir_tstrlen(szCounts), &countRect, uTextFormat);
+ ske_DrawText(hdcMem, szCounts, (int)mir_wstrlen(szCounts), &countRect, uTextFormat);
}
Drawing->pos_label = nameRect;
return;
@@ -869,7 +869,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R space_size.cy = min(space_rc.bottom - space_rc.top, fr_rc.bottom - fr_rc.top);
ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPCOUNTS : FONTID_CLOSEDGROUPCOUNTS, NULL);
- DrawText(hdcMem, szCounts, (int)mir_tstrlen(szCounts), &counts_rc, DT_CALCRECT);
+ DrawText(hdcMem, szCounts, (int)mir_wstrlen(szCounts), &counts_rc, DT_CALCRECT);
counts_size.cx = counts_rc.right - counts_rc.left;
counts_size.cy = min(counts_rc.bottom - counts_rc.top, fr_rc.bottom - fr_rc.top);
@@ -899,7 +899,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R else if (hottrack)
_SetHotTrackColour(hdcMem, dat);
if (dat->text_rtl != 0) _RTLRect(&text_rect, free_row_rc.right);
- _DrawTextSmiley(hdcMem, &text_rect, &text_size, Drawing->szText, 0, (int)mir_tstrlen(Drawing->szText), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
+ _DrawTextSmiley(hdcMem, &text_rect, &text_size, Drawing->szText, 0, (int)mir_wstrlen(Drawing->szText), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
if (((dat->bFilterSearch && Drawing->type != CLCIT_GROUP) || selected) && dat->szQuickSearch[0] != '\0') {
int idx = 0;
if (dat->bFilterSearch) {
@@ -910,12 +910,12 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R idx = int(p1 - lowered);
}
SetTextColor(hdcMem, dat->quickSearchColour);
- _DrawTextSmiley(hdcMem, &text_rect, &text_size, Drawing->szText, idx, (int)mir_tstrlen(dat->szQuickSearch), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
+ _DrawTextSmiley(hdcMem, &text_rect, &text_size, Drawing->szText, idx, (int)mir_wstrlen(dat->szQuickSearch), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
}
if (Drawing->type == CLCIT_GROUP && szCounts && szCounts[0] && counts_rc.right - counts_rc.left > 0) {
ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPCOUNTS : FONTID_CLOSEDGROUPCOUNTS, NULL);
if (dat->text_rtl != 0) _RTLRect(&counts_rc, free_row_rc.right);
- ske_DrawText(hdcMem, szCounts, (int)mir_tstrlen(szCounts), &counts_rc, uTextFormat);
+ ske_DrawText(hdcMem, szCounts, (int)mir_wstrlen(szCounts), &counts_rc, uTextFormat);
if (dat->text_rtl == 0)
text_rect.right = counts_rc.right;
else
@@ -977,7 +977,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R SetTextColor(hdcMem, dat->selTextColour);
else if (hottrack)
_SetHotTrackColour(hdcMem, dat);
- _DrawTextSmiley(hdcMem, &p_rect, &text_size, Drawing->szText, 0, (int)mir_tstrlen(Drawing->szText), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
+ _DrawTextSmiley(hdcMem, &p_rect, &text_size, Drawing->szText, 0, (int)mir_wstrlen(Drawing->szText), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
if ((dat->bFilterSearch || selected) && dat->szQuickSearch[0] != '\0') {
int idx = 0;
if (dat->bFilterSearch) {
@@ -988,7 +988,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R idx = int(p1 - lowered);
}
SetTextColor(hdcMem, dat->quickSearchColour);
- _DrawTextSmiley(hdcMem, &p_rect, &text_size, Drawing->szText, idx, (int)mir_tstrlen(dat->szQuickSearch), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
+ _DrawTextSmiley(hdcMem, &p_rect, &text_size, Drawing->szText, idx, (int)mir_wstrlen(dat->szQuickSearch), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
}
SIZE size;
@@ -1004,7 +1004,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R int space_width = 0;
wchar_t *szCounts = pcli->pfnGetGroupCountsText(dat, Drawing);
// Has to draw the count?
- if (szCounts && mir_tstrlen(szCounts) > 0) {
+ if (szCounts && mir_wstrlen(szCounts) > 0) {
// calc width and height
ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPCOUNTS : FONTID_CLOSEDGROUPCOUNTS, NULL);
ske_DrawText(hdcMem, L" ", 1, &count_rc, DT_CALCRECT | DT_NOPREFIX);
@@ -1012,7 +1012,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R space_width = count_size.cx;
count_rc.right = 0;
count_rc.left = 0;
- ske_DrawText(hdcMem, szCounts, (int)mir_tstrlen(szCounts), &count_rc, DT_CALCRECT);
+ ske_DrawText(hdcMem, szCounts, (int)mir_wstrlen(szCounts), &count_rc, DT_CALCRECT);
count_size.cx += count_rc.right - count_rc.left;
count_size.cy = count_rc.bottom - count_rc.top;
}
@@ -1053,18 +1053,18 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R SetTextColor(hdcMem, dat->selTextColour);
else if (hottrack)
_SetHotTrackColour(hdcMem, dat);
- _DrawTextSmiley(hdcMem, &nameRect, &text_size, Drawing->szText, 0, (int)mir_tstrlen(Drawing->szText), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
+ _DrawTextSmiley(hdcMem, &nameRect, &text_size, Drawing->szText, 0, (int)mir_wstrlen(Drawing->szText), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
if (selected && !dat->bFilterSearch) {
SetTextColor(hdcMem, dat->quickSearchColour);
- _DrawTextSmiley(hdcMem, &nameRect, &text_size, Drawing->szText, 0, (int)mir_tstrlen(Drawing->szText), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
+ _DrawTextSmiley(hdcMem, &nameRect, &text_size, Drawing->szText, 0, (int)mir_wstrlen(Drawing->szText), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
}
- if (szCounts && mir_tstrlen(szCounts) > 0) {
+ if (szCounts && mir_wstrlen(szCounts) > 0) {
ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPCOUNTS : FONTID_CLOSEDGROUPCOUNTS, NULL);
if (selected)
SetTextColor(hdcMem, dat->selTextColour);
else if (hottrack)
_SetHotTrackColour(hdcMem, dat);
- ske_DrawText(hdcMem, szCounts, (int)mir_tstrlen(szCounts), &countRect, uTextFormat);
+ ske_DrawText(hdcMem, szCounts, (int)mir_wstrlen(szCounts), &countRect, uTextFormat);
}
Drawing->pos_label = nameRect;
}
@@ -1084,7 +1084,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R mir_free_and_nil(pdnce->szSecondLineText);
TimeZone_PrintDateTime(pdnce->hTimeZone, L"t", buf, _countof(buf), 0);
- pdnce->szSecondLineText = mir_tstrdup(buf);
+ pdnce->szSecondLineText = mir_wstrdup(buf);
}
uTextFormat |= (gl_RowTabAccess[i]->valign == TC_VCENTER) ? DT_VCENTER : (gl_RowTabAccess[i]->valign == TC_BOTTOM) ? DT_BOTTOM : 0;
@@ -1096,7 +1096,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R ChangeToFont(hdcMem, dat, FONTID_SECONDLINE, NULL);
uTextFormat = uTextFormat | (gl_TrimText ? DT_END_ELLIPSIS : 0) | DT_SINGLELINE;
if (Drawing->type == CLCIT_CONTACT)
- _DrawTextSmiley(hdcMem, &p_rect, &text_size, pdnce->szSecondLineText, 0, (int)mir_tstrlen(pdnce->szSecondLineText), pdnce->ssSecondLine.plText, uTextFormat, dat->text_resize_smileys);
+ _DrawTextSmiley(hdcMem, &p_rect, &text_size, pdnce->szSecondLineText, 0, (int)mir_wstrlen(pdnce->szSecondLineText), pdnce->ssSecondLine.plText, uTextFormat, dat->text_resize_smileys);
}
break;
@@ -1112,7 +1112,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R mir_free(pdnce->szThirdLineText);
TimeZone_PrintDateTime(pdnce->hTimeZone, L"t", buf, _countof(buf), 0);
- pdnce->szThirdLineText = mir_tstrdup(buf);
+ pdnce->szThirdLineText = mir_wstrdup(buf);
}
uTextFormat |= (gl_RowTabAccess[i]->valign == TC_VCENTER) ? DT_VCENTER : (gl_RowTabAccess[i]->valign == TC_BOTTOM) ? DT_BOTTOM : 0;
@@ -1124,7 +1124,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R ChangeToFont(hdcMem, dat, FONTID_THIRDLINE, NULL);
uTextFormat = uTextFormat | (gl_TrimText ? DT_END_ELLIPSIS : 0) | DT_SINGLELINE;
if (Drawing->type == CLCIT_CONTACT)
- _DrawTextSmiley(hdcMem, &p_rect, &text_size, pdnce->szThirdLineText, 0, (int)mir_tstrlen(pdnce->szThirdLineText), pdnce->ssThirdLine.plText, uTextFormat, dat->text_resize_smileys);
+ _DrawTextSmiley(hdcMem, &p_rect, &text_size, pdnce->szThirdLineText, 0, (int)mir_wstrlen(pdnce->szThirdLineText), pdnce->ssThirdLine.plText, uTextFormat, dat->text_resize_smileys);
}
break;
@@ -1395,7 +1395,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R if (!TimeZone_PrintDateTime(pdnce->hTimeZone, L"t", szResult, _countof(szResult), 0)) {
// Select font
ChangeToFont(hdcMem, dat, FONTID_CONTACT_TIME, NULL);
- ske_DrawText(hdcMem, szResult, (int)mir_tstrlen(szResult), &p_rect, DT_NOPREFIX | DT_SINGLELINE | (dat->text_rtl ? DT_RTLREADING : 0));
+ ske_DrawText(hdcMem, szResult, (int)mir_wstrlen(szResult), &p_rect, DT_NOPREFIX | DT_SINGLELINE | (dat->text_rtl ? DT_RTLREADING : 0));
}
break;
}
@@ -2112,7 +2112,7 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT // Get text size
RECT rc;
SIZE text_size;
- text_size.cy = ske_DrawText(hdcMem, szResult, (int)mir_tstrlen(szResult), &rc, DT_CALCRECT | DT_NOPREFIX | DT_SINGLELINE);
+ text_size.cy = ske_DrawText(hdcMem, szResult, (int)mir_wstrlen(szResult), &rc, DT_CALCRECT | DT_NOPREFIX | DT_SINGLELINE);
text_size.cy = min(text_size.cy, free_row_rc.bottom - free_row_rc.top);
text_size.cx = rc.right - rc.left;
@@ -2213,7 +2213,7 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT space_size.cy = min(space_rc.bottom - space_rc.top, free_height);
ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPCOUNTS : FONTID_CLOSEDGROUPCOUNTS, NULL);
- DrawText(hdcMem, szCounts, (int)mir_tstrlen(szCounts), &counts_rc, DT_CALCRECT);
+ DrawText(hdcMem, szCounts, (int)mir_wstrlen(szCounts), &counts_rc, DT_CALCRECT);
counts_size.cx = counts_rc.right - counts_rc.left;
counts_size.cy = min(counts_rc.bottom - counts_rc.top, free_height);
@@ -2267,7 +2267,7 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT // Get contact time
wchar_t buf[70] = L"";
TimeZone_PrintDateTime(pdnce->hTimeZone, L"t", buf, _countof(buf), 0);
- replaceStrT(pdnce->szSecondLineText, buf);
+ replaceStrW(pdnce->szSecondLineText, buf);
}
if (pdnce->szSecondLineText && pdnce->szSecondLineText[0] && free_height > dat->secondLine.top_space) {
@@ -2300,7 +2300,7 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT // Get contact time
wchar_t buf[70] = L"";
TimeZone_PrintDateTime(pdnce->hTimeZone, L"t", buf, _countof(buf), 0);
- replaceStrT(pdnce->szThirdLineText, buf);
+ replaceStrW(pdnce->szThirdLineText, buf);
}
if (pdnce->szThirdLineText != NULL && pdnce->szThirdLineText[0] && free_height > dat->thirdLine.top_space) {
ChangeToFont(hdcMem, dat, FONTID_THIRDLINE, NULL);
@@ -2652,7 +2652,7 @@ void CLCPaint::_DrawContactText(HDC hdcMem, ClcData *dat, ClcContact *Drawing, i ske_DrawText(hdcMem, Drawing->szText, -1, prcItem, uTextFormat);
if (selected && !dat->bFilterSearch) {
SetTextColor(hdcMem, dat->quickSearchColour);
- ske_DrawText(hdcMem, Drawing->szText, (int)mir_tstrlen(dat->szQuickSearch), prcItem, uTextFormat);
+ ske_DrawText(hdcMem, Drawing->szText, (int)mir_wstrlen(dat->szQuickSearch), prcItem, uTextFormat);
}
}
else if (Drawing->type == CLCIT_CONTACT) {
@@ -2672,7 +2672,7 @@ void CLCPaint::_DrawContactText(HDC hdcMem, ClcData *dat, ClcContact *Drawing, i idx = int(p1 - lowered);
}
SetTextColor(hdcMem, dat->quickSearchColour);
- _DrawTextSmiley(hdcMem, prcItem, &text_size, Drawing->szText, idx, (int)mir_tstrlen(dat->szQuickSearch), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
+ _DrawTextSmiley(hdcMem, prcItem, &text_size, Drawing->szText, idx, (int)mir_wstrlen(dat->szQuickSearch), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
}
}
else ske_DrawText(hdcMem, Drawing->szText, -1, prcItem, uTextFormat);
@@ -2726,7 +2726,7 @@ void CLCPaint::_DrawContactTime(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R if (!TimeZone_PrintDateTime(pdnce->hTimeZone, L"t", szResult, _countof(szResult), 0)) {
// Select font
ChangeToFont(hdcMem, dat, FONTID_CONTACT_TIME, NULL);
- ske_DrawText(hdcMem, szResult, (int)mir_tstrlen(szResult), prcItem, DT_NOPREFIX | DT_SINGLELINE);
+ ske_DrawText(hdcMem, szResult, (int)mir_wstrlen(szResult), prcItem, DT_NOPREFIX | DT_SINGLELINE);
}
}
diff --git a/plugins/Clist_modern/src/modern_clcutils.cpp b/plugins/Clist_modern/src/modern_clcutils.cpp index c20e9740e8..1d99f11abf 100644 --- a/plugins/Clist_modern/src/modern_clcutils.cpp +++ b/plugins/Clist_modern/src/modern_clcutils.cpp @@ -560,9 +560,9 @@ void cli_LoadCLCOptions(HWND hwnd, ClcData *dat, BOOL bFirst) dat->secondLine.draw_smileys = db_get_b(NULL, "CList", "SecondLineDrawSmileys", SETTING_SECONDLINE_SMILEYS_DEFAULT);
dat->secondLine.type = db_get_w(NULL, "CList", "SecondLineType", SETTING_SECONDLINE_TYPE_DEFAULT);
- ptrT tszLineText(db_get_tsa(NULL, "CList", "SecondLineText"));
+ ptrW tszLineText(db_get_tsa(NULL, "CList", "SecondLineText"));
if (tszLineText)
- mir_tstrncpy(dat->secondLine.text, tszLineText, _countof(dat->secondLine.text));
+ mir_wstrncpy(dat->secondLine.text, tszLineText, _countof(dat->secondLine.text));
else
dat->secondLine.text[0] = '\0';
@@ -580,9 +580,9 @@ void cli_LoadCLCOptions(HWND hwnd, ClcData *dat, BOOL bFirst) dat->thirdLine.draw_smileys = db_get_b(NULL, "CList", "ThirdLineDrawSmileys", SETTING_THIRDLINE_SMILEYS_DEFAULT);
dat->thirdLine.type = db_get_w(NULL, "CList", "ThirdLineType", SETTING_THIRDLINE_TYPE_DEFAULT);
- ptrT tszLineText(db_get_tsa(NULL, "CList", "ThirdLineText"));
+ ptrW tszLineText(db_get_tsa(NULL, "CList", "ThirdLineText"));
if (tszLineText)
- mir_tstrncpy(dat->thirdLine.text, tszLineText, _countof(dat->thirdLine.text));
+ mir_wstrncpy(dat->thirdLine.text, tszLineText, _countof(dat->thirdLine.text));
else
dat->thirdLine.text[0] = '\0';
@@ -608,7 +608,7 @@ void cli_LoadCLCOptions(HWND hwnd, ClcData *dat, BOOL bFirst) dat->MenuTextHiColor = cliGetColor("Menu", "SelTextColour", CLCDEFAULT_MODERN_SELTEXTCOLOUR);
if (db_get_b(NULL, "Menu", "UseBitmap", CLCDEFAULT_USEBITMAP)) {
- ptrT tszBitmap(db_get_tsa(NULL, "Menu", "BkBitmap"));
+ ptrW tszBitmap(db_get_tsa(NULL, "Menu", "BkBitmap"));
if (tszBitmap != NULL)
dat->hMenuBackground = Bitmap_Load(tszBitmap);
}
@@ -657,7 +657,7 @@ int ExpandMetaContact(HWND hwnd, ClcContact *contact, ClcData *dat) int cliFindRowByText(HWND hwnd, ClcData *dat, const wchar_t *text, int prefixOk)
{
ClcGroup *group = &dat->list;
- int testlen = (int)mir_tstrlen(text);
+ int testlen = (int)mir_wstrlen(text);
int SubCount = 0;
group->scanIndex = 0;
@@ -677,7 +677,7 @@ int cliFindRowByText(HWND hwnd, ClcData *dat, const wchar_t *text, int prefixOk) wchar_t *lowered_text = CharLowerW(NEWWSTR_ALLOCA(text));
found = wcsstr(lowered_szText, lowered_text) != NULL;
}
- else found = (prefixOk && !wcsnicmp(text, cc->szText, testlen)) || (!prefixOk && !mir_tstrcmpi(text, cc->szText));
+ else found = (prefixOk && !wcsnicmp(text, cc->szText, testlen)) || (!prefixOk && !mir_wstrcmpi(text, cc->szText));
if (found) {
ClcGroup *ccGroup = group;
@@ -708,7 +708,7 @@ int cliFindRowByText(HWND hwnd, ClcData *dat, const wchar_t *text, int prefixOk) wchar_t *lowered_text = CharLowerW(NEWWSTR_ALLOCA(text));
found = wcsstr(lowered_szText, lowered_text) != NULL;
}
- else found = (prefixOk && !wcsnicmp(text, ccSub.szText, testlen)) || (!prefixOk && !mir_tstrcmpi(text, ccSub.szText));
+ else found = (prefixOk && !wcsnicmp(text, ccSub.szText, testlen)) || (!prefixOk && !mir_wstrcmpi(text, ccSub.szText));
if (found) {
ClcGroup *ccGroup = group;
diff --git a/plugins/Clist_modern/src/modern_clistevents.cpp b/plugins/Clist_modern/src/modern_clistevents.cpp index 24cc1f273c..2585918e00 100644 --- a/plugins/Clist_modern/src/modern_clistevents.cpp +++ b/plugins/Clist_modern/src/modern_clistevents.cpp @@ -119,7 +119,7 @@ CListEvent* cli_AddEvent(CLISTEVENT *cle) wchar_t szwProto[64];
MultiByteToWideChar(CP_ACP, 0, szProto, -1, szwProto, 64);
szwProto[63] = 0;
- mir_sntprintf(szBuffer, L"%s: %s (%s)", szwProto, szName, szStatus);
+ mir_snwprintf(szBuffer, L"%s: %s (%s)", szwProto, szName, szStatus);
szBuffer[127] = 0;
AppendMenu(g_CluiData.hMenuNotify, MF_BYCOMMAND | MF_STRING, g_CluiData.wNextMenuID, szBuffer);
mii.hbmpItem = HBMMENU_CALLBACK;
@@ -249,7 +249,7 @@ static int ehhEventAreaBackgroundSettingsChanged(WPARAM, LPARAM) if (g_CluiData.fDisableSkinEngine) {
event_area.bkColour = cliGetColor("EventArea", "BkColour", CLCDEFAULT_BKCOLOUR);
if (db_get_b(NULL, "EventArea", "UseBitmap", CLCDEFAULT_USEBITMAP)) {
- ptrT tszBitmap(db_get_tsa(NULL, "EventArea", "BkBitmap"));
+ ptrW tszBitmap(db_get_tsa(NULL, "EventArea", "BkBitmap"));
if (tszBitmap != NULL)
event_area.hBmpBackground = Bitmap_Load(tszBitmap);
}
@@ -321,7 +321,7 @@ static int EventArea_DrawWorker(HWND hWnd, HDC hDC) else {
HICON hIcon = (HICON)LoadImage(g_hMirApp, MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, 16, 16, 0);
wchar_t *ptszEvents = TranslateT("No events");
- ske_DrawText(hDC, ptszEvents, (int)mir_tstrlen(ptszEvents), &rc, DT_VCENTER | DT_SINGLELINE);
+ ske_DrawText(hDC, ptszEvents, (int)mir_wstrlen(ptszEvents), &rc, DT_VCENTER | DT_SINGLELINE);
ske_DrawIconEx(hDC, 4, (rc.bottom + rc.top - 16) / 2, hIcon, 16, 16, 0, 0, DI_NORMAL | DI_COMPAT);
DestroyIcon(hIcon);
}
diff --git a/plugins/Clist_modern/src/modern_clistmod.cpp b/plugins/Clist_modern/src/modern_clistmod.cpp index 5e8f223061..bc23afacfe 100644 --- a/plugins/Clist_modern/src/modern_clistmod.cpp +++ b/plugins/Clist_modern/src/modern_clistmod.cpp @@ -292,7 +292,7 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) if (hAuxOld == hAux) {
wchar_t buf[255];
GetClassName(hAux, buf, _countof(buf));
- if (!mir_tstrcmp(buf, CLUIFrameSubContainerClassName)) {
+ if (!mir_wstrcmp(buf, CLUIFrameSubContainerClassName)) {
hWndFound = TRUE;
break;
}
diff --git a/plugins/Clist_modern/src/modern_clistopts.cpp b/plugins/Clist_modern/src/modern_clistopts.cpp index ed7b571b64..051ef974a9 100644 --- a/plugins/Clist_modern/src/modern_clistopts.cpp +++ b/plugins/Clist_modern/src/modern_clistopts.cpp @@ -584,7 +584,7 @@ static INT_PTR CALLBACK DlgProcItemSecondLineOpts(HWND hwndDlg, UINT msg, WPARAM CheckDlgButton(hwndDlg, IDC_DRAW_SMILEYS, db_get_b(NULL, "CList", "SecondLineDrawSmileys", SETTING_SECONDLINE_SMILEYS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED);
{
- ptrT tszText(db_get_tsa(NULL, "CList", "SecondLineText"));
+ ptrW tszText(db_get_tsa(NULL, "CList", "SecondLineText"));
if (tszText)
SetDlgItemText(hwndDlg, IDC_VARIABLE_TEXT, tszText);
}
diff --git a/plugins/Clist_modern/src/modern_clistsettings.cpp b/plugins/Clist_modern/src/modern_clistsettings.cpp index a212170259..71e4dc11c6 100644 --- a/plugins/Clist_modern/src/modern_clistsettings.cpp +++ b/plugins/Clist_modern/src/modern_clistsettings.cpp @@ -57,7 +57,7 @@ void cliCheckCacheItem(ClcCacheEntry *pdnce) if (pdnce->tszName == NULL) {
pdnce->tszName = pcli->pfnGetContactDisplayName(pdnce->hContact, GCDNF_NOCACHE);
- pdnce->m_bIsUnknown = !mir_tstrcmp(pdnce->tszName, UnknownConctactTranslatedName);
+ pdnce->m_bIsUnknown = !mir_wstrcmp(pdnce->tszName, UnknownConctactTranslatedName);
}
if (pdnce->m_iStatus == 0) //very strange look status sort is broken let always reread status
diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp index 6ab0f4926f..30c489ca90 100644 --- a/plugins/Clist_modern/src/modern_clisttray.cpp +++ b/plugins/Clist_modern/src/modern_clisttray.cpp @@ -461,7 +461,7 @@ int cliTrayCalcChanged(const char *szChangedProto, int, int) trayIconInfo_t &p = pcli->trayIcon[i];
DestroyIcon(p.hBaseIcon);
p.hBaseIcon = hIcon;
- replaceStrT(p.ptszToolTip, pcli->szTip);
+ replaceStrW(p.ptszToolTip, pcli->szTip);
NOTIFYICONDATA nid = { sizeof(NOTIFYICONDATA) };
nid.hWnd = pcli->hwndContactList;
@@ -471,7 +471,7 @@ int cliTrayCalcChanged(const char *szChangedProto, int, int) // if Tipper is missing or turned off for tray, use system tooltips
if (!ServiceExists("mToolTip/ShowTip") || !db_get_b(NULL, "Tipper", "TrayTip", 1))
- mir_tstrncpy(nid.szTip, pcli->szTip, _countof(nid.szTip));
+ mir_wstrncpy(nid.szTip, pcli->szTip, _countof(nid.szTip));
Shell_NotifyIcon(NIM_MODIFY, &nid);
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index 9256ecf893..6fd42fbb23 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -186,7 +186,7 @@ int CLUI::OnEvent_ContactMenuPreBuild(WPARAM, LPARAM) HWND hwndClist = GetFocus();
wchar_t cls[128];
GetClassName(hwndClist, cls, _countof(cls));
- if (mir_tstrcmp(CLISTCONTROL_CLASSW, cls))
+ if (mir_wstrcmp(CLISTCONTROL_CLASSW, cls))
hwndClist = pcli->hwndContactList;
MCONTACT hItem = (MCONTACT)SendMessage(hwndClist, CLM_GETSELECTION, 0, 0);
@@ -498,7 +498,7 @@ BOOL CLUI_CheckOwnedByClui(HWND hWnd) wchar_t buf[255];
GetClassName(hWndMid, buf, 254);
- if (!mir_tstrcmpi(buf, CLUIFrameSubContainerClassName))
+ if (!mir_wstrcmpi(buf, CLUIFrameSubContainerClassName))
return TRUE;
return FALSE;
@@ -667,9 +667,9 @@ void CLUI_ChangeWindowMode() wchar_t titleText[255] = { 0 };
DBVARIANT dbv;
if (db_get_ts(NULL, "CList", "TitleText", &dbv))
- mir_tstrncpy(titleText, _A2W(MIRANDANAME), _countof(titleText));
+ mir_wstrncpy(titleText, _A2W(MIRANDANAME), _countof(titleText));
else {
- mir_tstrncpy(titleText, dbv.ptszVal, _countof(titleText));
+ mir_wstrncpy(titleText, dbv.ptszVal, _countof(titleText));
db_free(&dbv);
}
SetWindowText(pcli->hwndContactList, titleText);
@@ -893,7 +893,7 @@ static int CLUI_GetConnectingIconForProtoCount(char *szAccoName) if (szAccoName) {
// first of all try to find by account name( or empty - global )
- mir_sntprintf(fileFull, L"%s\\Icons\\proto_conn_%S.dll", tszFolderPath, szAccoName);
+ mir_snwprintf(fileFull, L"%s\\Icons\\proto_conn_%S.dll", tszFolderPath, szAccoName);
if (count = ExtractIconEx(fileFull, -1, NULL, NULL, 1))
return count;
@@ -901,7 +901,7 @@ static int CLUI_GetConnectingIconForProtoCount(char *szAccoName) // second try to find by protocol name
PROTOACCOUNT *acc = Proto_GetAccount(szAccoName);
if (acc && !acc->bOldProto) {
- mir_sntprintf(fileFull, L"%s\\Icons\\proto_conn_%S.dll", tszFolderPath, acc->szProtoName);
+ mir_snwprintf(fileFull, L"%s\\Icons\\proto_conn_%S.dll", tszFolderPath, acc->szProtoName);
if (count = ExtractIconEx(fileFull, -1, NULL, NULL, 1))
return count;
}
@@ -909,7 +909,7 @@ static int CLUI_GetConnectingIconForProtoCount(char *szAccoName) }
// third try global
- mir_sntprintf(fileFull, L"%s\\Icons\\proto_conn.dll", tszFolderPath);
+ mir_snwprintf(fileFull, L"%s\\Icons\\proto_conn.dll", tszFolderPath);
if (count = ExtractIconEx(fileFull, -1, NULL, NULL, 1))
return count;
@@ -919,7 +919,7 @@ static int CLUI_GetConnectingIconForProtoCount(char *szAccoName) static HICON CLUI_LoadIconFromExternalFile(wchar_t *filename, int i)
{
wchar_t szPath[MAX_PATH], szFullPath[MAX_PATH];
- mir_sntprintf(szPath, L"Icons\\%s", filename);
+ mir_snwprintf(szPath, L"Icons\\%s", filename);
PathToAbsoluteT(szPath, szFullPath);
if (_waccess(szPath, 0))
return NULL;
@@ -935,7 +935,7 @@ static HICON CLUI_GetConnectingIconForProto(char *szAccoName, int idx) HICON hIcon;
if (szAccoName) {
- mir_sntprintf(szFullPath, L"proto_conn_%S.dll", szAccoName);
+ mir_snwprintf(szFullPath, L"proto_conn_%S.dll", szAccoName);
if (hIcon = CLUI_LoadIconFromExternalFile(szFullPath, idx))
return hIcon;
@@ -943,7 +943,7 @@ static HICON CLUI_GetConnectingIconForProto(char *szAccoName, int idx) // second try to find by protocol name
PROTOACCOUNT *acc = Proto_GetAccount(szAccoName);
if (acc && !acc->bOldProto) {
- mir_sntprintf(szFullPath, L"proto_conn_%S.dll", acc->szProtoName);
+ mir_snwprintf(szFullPath, L"proto_conn_%S.dll", acc->szProtoName);
if (hIcon = CLUI_LoadIconFromExternalFile(szFullPath, idx))
return hIcon;
}
@@ -951,7 +951,7 @@ static HICON CLUI_GetConnectingIconForProto(char *szAccoName, int idx) }
// third try global
- mir_tstrncpy(szFullPath, L"proto_conn.dll", _countof(szFullPath));
+ mir_wstrncpy(szFullPath, L"proto_conn.dll", _countof(szFullPath));
if (hIcon = CLUI_LoadIconFromExternalFile(szFullPath, idx))
return hIcon;
@@ -2421,7 +2421,7 @@ LRESULT CLUI::OnMeasureItem(UINT, WPARAM, LPARAM lParam) HDC hdc = GetDC(m_hWnd);
wchar_t *ptszStr = TranslateT("Status");
SIZE textSize;
- GetTextExtentPoint32(hdc, ptszStr, (int)mir_tstrlen(ptszStr), &textSize);
+ GetTextExtentPoint32(hdc, ptszStr, (int)mir_wstrlen(ptszStr), &textSize);
pmis->itemWidth = textSize.cx;
pmis->itemHeight = 0;
ReleaseDC(m_hWnd, hdc);
diff --git a/plugins/Clist_modern/src/modern_contact.cpp b/plugins/Clist_modern/src/modern_contact.cpp index 33c21ce24c..6d6d5698e0 100644 --- a/plugins/Clist_modern/src/modern_contact.cpp +++ b/plugins/Clist_modern/src/modern_contact.cpp @@ -118,7 +118,7 @@ int cliCompareContacts(const ClcContact *contact1, const ClcContact *contact2) switch (by) {
case SORTBY_NAME: // name
- r = mir_tstrcmpi(contact1->szText, contact2->szText);
+ r = mir_wstrcmpi(contact1->szText, contact2->szText);
break;
case SORTBY_NAME_LOCALE: // name
diff --git a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp index 1fe7d491fb..a6dedca8db 100644 --- a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp +++ b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp @@ -109,7 +109,7 @@ int RowHeight_CalcRowHeight(ClcData *dat, ClcContact *contact, int item) g_clcPainter.GetTextSize(&size, hdc, dummyRect, contact->szText, contact->ssText.plText, 0, dat->text_resize_smileys ? 0 : contact->ssText.iMaxSmileyHeight);
if (contact->type == CLCIT_GROUP) {
wchar_t *szCounts = pcli->pfnGetGroupCountsText(dat, contact);
- if (szCounts && mir_tstrlen(szCounts) > 0) {
+ if (szCounts && mir_wstrlen(szCounts) > 0) {
RECT count_rc = { 0 };
// calc width and height
g_clcPainter.ChangeToFont(hdc, dat, contact->group->expanded ? FONTID_OPENGROUPCOUNTS : FONTID_CLOSEDGROUPCOUNTS, NULL);
@@ -117,7 +117,7 @@ int RowHeight_CalcRowHeight(ClcData *dat, ClcContact *contact, int item) size.cx += count_rc.right - count_rc.left;
count_rc.right = 0;
count_rc.left = 0;
- ske_DrawText(hdc, szCounts, (int)mir_tstrlen(szCounts), &count_rc, DT_CALCRECT);
+ ske_DrawText(hdc, szCounts, (int)mir_wstrlen(szCounts), &count_rc, DT_CALCRECT);
size.cx += count_rc.right - count_rc.left;
pCell->h = max(pCell->h, count_rc.bottom - count_rc.top);
}
@@ -249,7 +249,7 @@ int RowHeight_CalcRowHeight(ClcData *dat, ClcContact *contact, int item) g_clcPainter.ChangeToFont(hdc, dat, FONTID_CONTACT_TIME, NULL);
// Get text size
- text_size.cy = ske_DrawText(hdc, szResult, (int)mir_tstrlen(szResult), &rc, DT_CALCRECT | DT_NOPREFIX | DT_SINGLELINE);
+ text_size.cy = ske_DrawText(hdc, szResult, (int)mir_wstrlen(szResult), &rc, DT_CALCRECT | DT_NOPREFIX | DT_SINGLELINE);
SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT));
ske_ResetTextEffect(hdc);
DeleteDC(hdc);
diff --git a/plugins/Clist_modern/src/modern_rowtemplateopt.cpp b/plugins/Clist_modern/src/modern_rowtemplateopt.cpp index a83baa7089..2cbabaafe4 100644 --- a/plugins/Clist_modern/src/modern_rowtemplateopt.cpp +++ b/plugins/Clist_modern/src/modern_rowtemplateopt.cpp @@ -312,18 +312,18 @@ void RefreshTree(HWND hwndDlg, HTREEITEM hti) if (!cell->child)
{
if (cell->type == 0)
- mir_sntprintf(buf, TranslateT("Empty %s cell"), cell->cont == TC_COL ? TranslateT("column") : TranslateT("line"));
+ mir_snwprintf(buf, TranslateT("Empty %s cell"), cell->cont == TC_COL ? TranslateT("column") : TranslateT("line"));
else
- mir_tstrncpy(buf, TranslateTS(types[cell->type]), _countof(buf));
+ mir_wstrncpy(buf, TranslateTS(types[cell->type]), _countof(buf));
}
else
{
if (cell->type == 0)
- mir_tstrncpy(buf, (cell->cont != TC_COL ? TranslateT("columns") : TranslateT("lines")), _countof(buf));
+ mir_wstrncpy(buf, (cell->cont != TC_COL ? TranslateT("columns") : TranslateT("lines")), _countof(buf));
else
- mir_sntprintf(buf, TranslateT("%s, contain %s"), TranslateTS(types[cell->type]), cell->cont != TC_COL ? TranslateT("columns") : TranslateT("lines"));
+ mir_snwprintf(buf, TranslateT("%s, contain %s"), TranslateTS(types[cell->type]), cell->cont != TC_COL ? TranslateT("columns") : TranslateT("lines"));
}
- if (cell->layer) mir_tstrncat(buf, TranslateT(" layered"), _countof(buf) - mir_tstrlen(buf));
+ if (cell->layer) mir_wstrncat(buf, TranslateT(" layered"), _countof(buf) - mir_wstrlen(buf));
tvi.mask = TVIF_HANDLE | TVIF_TEXT;
tvi.pszText = buf;
TreeView_SetItem(htree, &tvi);
diff --git a/plugins/Clist_modern/src/modern_skinbutton.cpp b/plugins/Clist_modern/src/modern_skinbutton.cpp index f37a2a4715..5d9b79ddfe 100644 --- a/plugins/Clist_modern/src/modern_skinbutton.cpp +++ b/plugins/Clist_modern/src/modern_skinbutton.cpp @@ -561,7 +561,7 @@ int ModernSkinButton_AddButton(HWND parent, if (DBkey && *DBkey != '\0') bct->ValueDBSection = mir_strdup(DBkey); else bct->ValueDBSection = NULL; if (TypeDef && *TypeDef != '\0') bct->ValueTypeDef = mir_strdup(TypeDef); else bct->ValueTypeDef = mir_strdup("sDefault"); bct->ID = mir_strdup(ID); - bct->Hint = mir_tstrdup(Hint); + bct->Hint = mir_wstrdup(Hint); Buttons[ButtonsCount].bct = bct; Buttons[ButtonsCount].hwnd = NULL; Buttons[ButtonsCount].OrL = Left; diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp index cc28081cb1..f493876e60 100644 --- a/plugins/Clist_modern/src/modern_skinengine.cpp +++ b/plugins/Clist_modern/src/modern_skinengine.cpp @@ -202,22 +202,22 @@ HRESULT IniParser::WriteStrToDb(const char * szSection, const char * szName, con int IniParser::GetSkinFolder(IN const wchar_t * szFileName, OUT wchar_t * pszFolderName) { - wchar_t *szBuff = mir_tstrdup(szFileName); - wchar_t *pszPos = szBuff + mir_tstrlen(szBuff); + wchar_t *szBuff = mir_wstrdup(szFileName); + wchar_t *pszPos = szBuff + mir_wstrlen(szBuff); while (pszPos > szBuff && *pszPos != '.') { pszPos--; } *pszPos = '\0'; - mir_tstrcpy(pszFolderName, szBuff); + mir_wstrcpy(pszFolderName, szBuff); wchar_t custom_folder[MAX_PATH], cus[MAX_PATH]; wchar_t *b3; - mir_tstrncpy(custom_folder, pszFolderName, _countof(custom_folder)); - b3 = custom_folder + mir_tstrlen(custom_folder); + mir_wstrncpy(custom_folder, pszFolderName, _countof(custom_folder)); + b3 = custom_folder + mir_wstrlen(custom_folder); while (b3 > custom_folder && *b3 != '\\') { b3--; } *b3 = '\0'; GetPrivateProfileString(L"Skin_Description_Section", L"SkinFolder", L"", cus, _countof(custom_folder), szFileName); if (cus[0] != 0) - mir_sntprintf(pszFolderName, MAX_PATH, L"%s\\%s", custom_folder, cus); + mir_snwprintf(pszFolderName, MAX_PATH, L"%s\\%s", custom_folder, cus); mir_free(szBuff); PathToRelativeT(pszFolderName, pszFolderName); @@ -1471,13 +1471,13 @@ int ske_GetFullFilename(wchar_t *buf, const wchar_t *file, wchar_t *skinfolder, { wchar_t *SkinPlace = db_get_tsa(NULL, SKIN, "SkinFolder"); if (SkinPlace == NULL) - SkinPlace = mir_tstrdup(L"\\Skin\\default"); + SkinPlace = mir_wstrdup(L"\\Skin\\default"); wchar_t b2[MAX_PATH]; if (file[0] != '\\' && file[1] != ':') - mir_sntprintf(b2, L"%s\\%s", (skinfolder == NULL) ? SkinPlace : ((INT_PTR)skinfolder != -1) ? skinfolder : L"", file); + mir_snwprintf(b2, L"%s\\%s", (skinfolder == NULL) ? SkinPlace : ((INT_PTR)skinfolder != -1) ? skinfolder : L"", file); else - mir_tstrncpy(b2, file, _countof(b2)); + mir_wstrncpy(b2, file, _countof(b2)); if (madeAbsolute) { if (b2[0] == '\\' && b2[1] != '\\') @@ -1485,7 +1485,7 @@ int ske_GetFullFilename(wchar_t *buf, const wchar_t *file, wchar_t *skinfolder, else PathToAbsoluteT(b2, buf); } - else mir_tstrncpy(buf, b2, MAX_PATH); + else mir_wstrncpy(buf, b2, MAX_PATH); mir_free(SkinPlace); return 0; @@ -1564,7 +1564,7 @@ static HBITMAP ske_LoadGlyphImage_TGA(const wchar_t *szFilename) BOOL err = FALSE; tga_header_t header; if (!szFilename) return NULL; - if (!wildcmpit(szFilename, L"*\\*%.tga")) { + if (!wildcmpiw(szFilename, L"*\\*%.tga")) { //Loading TGA image from file FILE *fp = _wfopen(szFilename, L"rb"); if (!fp) { @@ -1631,7 +1631,7 @@ static HBITMAP ske_LoadGlyphImageByDecoders(const wchar_t *tszFileName) HBITMAP hBitmap; bool f = false; - if (!mir_tstrcmpi(ext, L".tga")) { + if (!mir_wstrcmpi(ext, L".tga")) { hBitmap = ske_LoadGlyphImage_TGA(tszFileName); f = true; } @@ -1663,7 +1663,7 @@ static HBITMAP ske_LoadGlyphImageByDecoders(const wchar_t *tszFileName) static HBITMAP ske_skinLoadGlyphImage(const wchar_t *tszFileName) { - if (!wildcmpit(tszFileName, L"*.tga")) + if (!wildcmpiw(tszFileName, L"*.tga")) return GDIPlus_LoadGlyphImage(tszFileName); return ske_LoadGlyphImageByDecoders(tszFileName); @@ -1679,7 +1679,7 @@ HBITMAP ske_LoadGlyphImage(const wchar_t *tszFileName) if (pLoadedImages) { for (DWORD i = 0; i < dwLoadedImagesCount; i++) { - if (!mir_tstrcmpi(pLoadedImages[i].szFileName, szFile)) { + if (!mir_wstrcmpi(pLoadedImages[i].szFileName, szFile)) { pLoadedImages[i].dwLoadedTimes++; return pLoadedImages[i].hGlyph; } @@ -1701,7 +1701,7 @@ HBITMAP ske_LoadGlyphImage(const wchar_t *tszFileName) pLoadedImages[dwLoadedImagesCount].dwLoadedTimes = 1; pLoadedImages[dwLoadedImagesCount].hGlyph = hbmp; - pLoadedImages[dwLoadedImagesCount].szFileName = mir_tstrdup(szFile); + pLoadedImages[dwLoadedImagesCount].szFileName = mir_wstrdup(szFile); dwLoadedImagesCount++; return hbmp; } @@ -1918,7 +1918,7 @@ static int ske_GetSkinFromDB(char *, SKINOBJECTSLIST *Skin) if (Skin->szSkinPlace && wcschr(Skin->szSkinPlace, '%')) bOnlyObjects = TRUE; mir_free(Skin->szSkinPlace); - Skin->szSkinPlace = mir_tstrdup(L"%Default%"); + Skin->szSkinPlace = mir_wstrdup(L"%Default%"); ske_LoadSkinFromResource(bOnlyObjects); } @@ -2217,7 +2217,7 @@ static int ske_AlphaTextOut(HDC hDC, LPCTSTR lpString, int nCount, RECT *lpRect, // Calc len of input string if (nCount == -1) - nCount = (int)mir_tstrlen(lpString); + nCount = (int)mir_wstrlen(lpString); // retrieve destination bitmap bits HBITMAP hDestBitmap = (HBITMAP)GetCurrentObject(hDC, OBJ_BITMAP); @@ -3299,8 +3299,8 @@ static DWORD ske_HexToARGB(char * Hex) static wchar_t *ske_ReAppend(wchar_t *lfirst, wchar_t * lsecond, int len) { - size_t l1 = lfirst ? mir_tstrlen(lfirst) : 0; - size_t l2 = (len ? len : (mir_tstrlen(lsecond) + 1)); + size_t l1 = lfirst ? mir_wstrlen(lfirst) : 0; + size_t l2 = (len ? len : (mir_wstrlen(lsecond) + 1)); wchar_t *buf = (wchar_t *)mir_alloc((l1 + l2 + 1)*sizeof(wchar_t)); if (lfirst) memmove(buf, lfirst, l1*sizeof(wchar_t)); memmove(buf + l1, lsecond, l2*sizeof(wchar_t)); @@ -3311,8 +3311,8 @@ static wchar_t *ske_ReAppend(wchar_t *lfirst, wchar_t * lsecond, int len) wchar_t* ske_ReplaceVar(wchar_t *var) { - if (!var) return mir_tstrdup(L""); - if (!mir_tstrcmpi(var, L"Profile")) { + if (!var) return mir_wstrdup(L""); + if (!mir_wstrcmpi(var, L"Profile")) { char buf[MAX_PATH] = { 0 }; CallService(MS_DB_GETPROFILENAME, (WPARAM)MAX_PATH, (LPARAM)buf); @@ -3324,12 +3324,12 @@ wchar_t* ske_ReplaceVar(wchar_t *var) } mir_free(var); - return mir_tstrdup(L""); + return mir_wstrdup(L""); } wchar_t *ske_ParseText(wchar_t *stzText) { - size_t len = mir_tstrlen(stzText); + size_t len = mir_wstrlen(stzText); wchar_t *result = NULL; size_t stpos = 0, curpos = 0; diff --git a/plugins/Clist_modern/src/modern_skinopt.cpp b/plugins/Clist_modern/src/modern_skinopt.cpp index 1b2514e0f7..5207c15c8b 100644 --- a/plugins/Clist_modern/src/modern_skinopt.cpp +++ b/plugins/Clist_modern/src/modern_skinopt.cpp @@ -123,11 +123,11 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara GetPrivateProfileString(L"Skin_Description_Section", L"URL", L"", URL, _countof(URL), sd->File); GetPrivateProfileString(L"Skin_Description_Section", L"Contact", L"", Contact, _countof(Contact), sd->File); GetPrivateProfileString(L"Skin_Description_Section", L"Description", L"", Description, _countof(Description), sd->File); - mir_sntprintf(text, TranslateT("%s\n\n%s\n\nAuthor(s):\t %s\nContact:\t %s\nWeb:\t %s\n\nFile:\t %s"), + mir_snwprintf(text, TranslateT("%s\n\n%s\n\nAuthor(s):\t %s\nContact:\t %s\nWeb:\t %s\n\nFile:\t %s"), sd->Name, Description, Author, Contact, URL, sd->File); } else { - mir_sntprintf(text, TranslateT("%s\n\n%s\n\nAuthor(s): %s\nContact:\t %s\nWeb:\t %s\n\nFile:\t %s"), + mir_snwprintf(text, TranslateT("%s\n\n%s\n\nAuthor(s): %s\nContact:\t %s\nWeb:\t %s\n\nFile:\t %s"), TranslateT("reVista for Modern v0.5"), TranslateT("This is second default Modern Contact list skin in Vista Aero style"), TranslateT("Angeli-Ka (graphics), FYR (template)"), @@ -261,7 +261,7 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara wchar_t prfn[MAX_PATH] = { 0 }, imfn[MAX_PATH] = { 0 }, skinfolder[MAX_PATH] = { 0 }; GetPrivateProfileString(L"Skin_Description_Section", L"Preview", L"", imfn, _countof(imfn), sd->File); IniParser::GetSkinFolder(sd->File, skinfolder); - mir_sntprintf(prfn, L"%s\\%s", skinfolder, imfn); + mir_snwprintf(prfn, L"%s\\%s", skinfolder, imfn); PathToAbsoluteT(prfn, imfn); hPreviewBitmap = ske_LoadGlyphImage(imfn); @@ -288,11 +288,11 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara GetPrivateProfileString(L"Skin_Description_Section", L"URL", L"", URL, _countof(URL), sd2->File); GetPrivateProfileString(L"Skin_Description_Section", L"Contact", L"", Contact, _countof(Contact), sd2->File); GetPrivateProfileString(L"Skin_Description_Section", L"Description", L"", Description, _countof(Description), sd2->File); - mir_sntprintf(text, TranslateT("Preview is not available\n\n%s\n----------------------\n\n%s\n\nAUTHOR(S):\n%s\n\nCONTACT:\n%s\n\nHOMEPAGE:\n%s"), + mir_snwprintf(text, TranslateT("Preview is not available\n\n%s\n----------------------\n\n%s\n\nAUTHOR(S):\n%s\n\nCONTACT:\n%s\n\nHOMEPAGE:\n%s"), sd2->Name, Description, Author, Contact, URL); } else { - mir_sntprintf(text, TranslateT("%s\n\n%s\n\nAUTHORS:\n%s\n\nCONTACT:\n%s\n\nWEB:\n%s\n\n\n"), + mir_snwprintf(text, TranslateT("%s\n\n%s\n\nAUTHORS:\n%s\n\nCONTACT:\n%s\n\nWEB:\n%s\n\n\n"), TranslateT("reVista for Modern v0.5"), TranslateT("This is second default Modern Contact list skin in Vista Aero style"), TranslateT("graphics by Angeli-Ka\ntemplate by FYR"), @@ -330,7 +330,7 @@ int SearchSkinFiles(HWND hwndDlg, wchar_t * Folder) struct _wfinddata_t fd = { 0 }; wchar_t mask[MAX_PATH]; long hFile; - mir_sntprintf(mask, L"%s\\*.msf", Folder); + mir_snwprintf(mask, L"%s\\*.msf", Folder); //fd.attrib = _A_SUBDIR; hFile = _wfindfirst(mask, &fd); if (hFile != -1) { @@ -339,13 +339,13 @@ int SearchSkinFiles(HWND hwndDlg, wchar_t * Folder) } while (!_wfindnext(hFile, &fd)); _findclose(hFile); } - mir_sntprintf(mask, L"%s\\*", Folder); + mir_snwprintf(mask, L"%s\\*", Folder); hFile = _wfindfirst(mask, &fd); do { - if (fd.attrib&_A_SUBDIR && !(mir_tstrcmpi(fd.name, L".") == 0 || mir_tstrcmpi(fd.name, L"..") == 0)) {//Next level of subfolders + if (fd.attrib&_A_SUBDIR && !(mir_wstrcmpi(fd.name, L".") == 0 || mir_wstrcmpi(fd.name, L"..") == 0)) {//Next level of subfolders wchar_t path[MAX_PATH]; - mir_sntprintf(path, L"%s\\%s", Folder, fd.name); + mir_snwprintf(path, L"%s\\%s", Folder, fd.name); SearchSkinFiles(hwndDlg, path); } } while (!_wfindnext(hFile, &fd)); @@ -367,7 +367,7 @@ HTREEITEM FillAvailableSkinList(HWND hwndDlg) SearchSkinFiles(hwndDlg, SkinsFolder); { wchar_t skinfull[MAX_PATH]; - ptrT skinfile(db_get_tsa(NULL, SKIN, "SkinFile")); + ptrW skinfile(db_get_tsa(NULL, SKIN, "SkinFile")); if (skinfile) { PathToAbsoluteT(skinfile, skinfull); res = AddSkinToListFullName(hwndDlg, skinfull); @@ -380,8 +380,8 @@ HTREEITEM AddSkinToListFullName(HWND hwndDlg, wchar_t * fullName) wchar_t path[MAX_PATH] = { 0 }; wchar_t file[MAX_PATH] = { 0 }; wchar_t *buf; - mir_tstrncpy(path, fullName, _countof(path)); - buf = path + mir_tstrlen(path); + mir_wstrncpy(path, fullName, _countof(path)); + buf = path + mir_wstrlen(path); while (buf > path) { if (*buf == '\\') { *buf = '\0'; @@ -390,7 +390,7 @@ HTREEITEM AddSkinToListFullName(HWND hwndDlg, wchar_t * fullName) buf--; } buf++; - mir_tstrncpy(file, buf, _countof(file)); + mir_wstrncpy(file, buf, _countof(file)); return AddSkinToList(hwndDlg, path, file); } @@ -403,12 +403,12 @@ HTREEITEM AddSkinToList(HWND hwndDlg, wchar_t * path, wchar_t* file) return 0; if (!file || wcschr(file, '%')) { - mir_sntprintf(sd->File, L"%%Default Skin%%"); - mir_sntprintf(sd->Name, TranslateT("%Default Skin%")); + mir_snwprintf(sd->File, L"%%Default Skin%%"); + mir_snwprintf(sd->Name, TranslateT("%Default Skin%")); wcsncpy_s(fullName, TranslateT("Default Skin"), _TRUNCATE); } else { - mir_sntprintf(fullName, L"%s\\%s", path, file); + mir_snwprintf(fullName, L"%s\\%s", path, file); wcsncpy_s(defskinname, file, _TRUNCATE); wchar_t *p = wcsrchr(defskinname, '.'); if (p) *p = 0; GetPrivateProfileString(L"Skin_Description_Section", L"Name", defskinname, sd->Name, _countof(sd->Name), fullName); @@ -433,7 +433,7 @@ HTREEITEM FindChild(HWND hTree, HTREEITEM Parent, wchar_t * Caption, void * data tvi.pszText = buf; tvi.cchTextMax = _countof(buf); TreeView_GetItem(hTree, &tvi); - if (mir_tstrcmpi(Caption, tvi.pszText) == 0) { + if (mir_wstrcmpi(Caption, tvi.pszText) == 0) { if (!data) return tmp; @@ -443,7 +443,7 @@ HTREEITEM FindChild(HWND hTree, HTREEITEM Parent, wchar_t * Caption, void * data TreeView_GetItem(hTree, &tvi2); SkinListData *sd = (SkinListData*)tvi2.lParam; if (sd) - if (!mir_tstrcmpi(sd->File, ((SkinListData*)data)->File)) + if (!mir_wstrcmpi(sd->File, ((SkinListData*)data)->File)) return tmp; } tmp = TreeView_GetNextSibling(hTree, tmp); @@ -471,11 +471,11 @@ HTREEITEM AddItemToTree(HWND hTree, wchar_t *itemName, void *data) INT_PTR SvcActiveSkin(WPARAM, LPARAM) { - ptrT skinfile(db_get_tsa(NULL, SKIN, "SkinFile")); + ptrW skinfile(db_get_tsa(NULL, SKIN, "SkinFile")); if (skinfile) { wchar_t skinfull[MAX_PATH]; PathToAbsoluteT(skinfile, skinfull); - return (INT_PTR)mir_tstrdup(skinfull); + return (INT_PTR)mir_wstrdup(skinfull); } return NULL; @@ -524,7 +524,7 @@ INT_PTR SvcPreviewSkin(WPARAM wParam, LPARAM lParam) wchar_t skinfolder[MAX_PATH] = { 0 }; GetPrivateProfileString(L"Skin_Description_Section", L"Preview", L"", imfn, _countof(imfn), (LPCTSTR)lParam); IniParser::GetSkinFolder((LPCTSTR)lParam, skinfolder); - mir_sntprintf(prfn, L"%s\\%s", skinfolder, imfn); + mir_snwprintf(prfn, L"%s\\%s", skinfolder, imfn); PathToAbsoluteT(prfn, imfn); hPreviewBitmap = ske_LoadGlyphImage(imfn); diff --git a/plugins/Clist_modern/src/modern_skinselector.cpp b/plugins/Clist_modern/src/modern_skinselector.cpp index d6a4a80fc5..119ceb7f8d 100644 --- a/plugins/Clist_modern/src/modern_skinselector.cpp +++ b/plugins/Clist_modern/src/modern_skinselector.cpp @@ -375,7 +375,7 @@ wchar_t* GetParamNT(char *string, wchar_t *buf, int buflen, BYTE paramN, char De WCHAR* GetParamN(WCHAR *string, WCHAR *buf, int buflen, BYTE paramN, WCHAR Delim, BOOL SkipSpaces)
{
size_t i = 0, start = 0, CurentCount = 0, len;
- while (i < mir_tstrlen(string)) {
+ while (i < mir_wstrlen(string)) {
if (string[i] == Delim) {
if (CurentCount == paramN) break;
start = i + 1;
@@ -385,13 +385,13 @@ WCHAR* GetParamN(WCHAR *string, WCHAR *buf, int buflen, BYTE paramN, WCHAR Delim }
if (CurentCount == paramN) {
if (SkipSpaces) { //remove spaces
- while (string[start] == ' ' && (int)start < mir_tstrlen(string))
+ while (string[start] == ' ' && (int)start < mir_wstrlen(string))
start++;
while (i > 1 && string[i - 1] == ' ' && i > (int)start)
i--;
}
len = ((int)(i - start) < buflen) ? i - start : buflen;
- mir_tstrncpy(buf, string + start, len);
+ mir_wstrncpy(buf, string + start, len);
buf[len] = '\0';
}
else buf[0] = '\0';
diff --git a/plugins/Clist_modern/src/modern_statusbar.cpp b/plugins/Clist_modern/src/modern_statusbar.cpp index f49faaa894..8e2e364a9b 100644 --- a/plugins/Clist_modern/src/modern_statusbar.cpp +++ b/plugins/Clist_modern/src/modern_statusbar.cpp @@ -28,10 +28,10 @@ struct ProtoItemData : public MZeroedObject ptrA szProtoName;
ptrA szAccountName;
int iProtoStatus;
- ptrT tszProtoHumanName;
- ptrT szProtoEMailCount;
- ptrT tszProtoStatusText;
- ptrT tszProtoXStatus;
+ ptrW tszProtoHumanName;
+ ptrW szProtoEMailCount;
+ ptrW tszProtoStatusText;
+ ptrW tszProtoXStatus;
int iProtoPos;
int fullWidth;
RECT protoRect;
@@ -106,7 +106,7 @@ int LoadStatusBarData() if (g_CluiData.fDisableSkinEngine) {
g_StatusBarData.bkColour = cliGetColor("StatusBar", "BkColour", CLCDEFAULT_BKCOLOUR);
if (db_get_b(NULL, "StatusBar", "UseBitmap", CLCDEFAULT_USEBITMAP)) {
- ptrT tszBitmapName(db_get_tsa(NULL, "StatusBar", "BkBitmap"));
+ ptrW tszBitmapName(db_get_tsa(NULL, "StatusBar", "BkBitmap"));
if (tszBitmapName)
g_StatusBarData.hBmpBackground = Bitmap_Load(tszBitmapName);
}
@@ -241,15 +241,15 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) int nEmails = (int)CallProtoService(szProto, PS_GETUNREADEMAILCOUNT, 0, 0);
if (nEmails > 0) {
wchar_t str[40];
- mir_sntprintf(str, L"[%d]", nEmails);
- p->szProtoEMailCount = mir_tstrdup(str);
+ mir_snwprintf(str, L"[%d]", nEmails);
+ p->szProtoEMailCount = mir_wstrdup(str);
}
}
- p->tszProtoHumanName = mir_tstrdup(accs[i]->tszAccountName);
+ p->tszProtoHumanName = mir_wstrdup(accs[i]->tszAccountName);
p->szAccountName = mir_strdup(szProto);
p->szProtoName = mir_strdup(accs[i]->szProtoName);
- p->tszProtoStatusText = mir_tstrdup(pcli->pfnGetStatusModeDescription(p->iProtoStatus, 0));
+ p->tszProtoStatusText = mir_wstrdup(pcli->pfnGetStatusModeDescription(p->iProtoStatus, 0));
p->iProtoPos = iProtoInStatusMenu++;
p->bIsDimmed = 0;
@@ -348,7 +348,7 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) cs.flags = CSSF_MASK_NAME | CSSF_TCHAR;
cs.ptszName = str;
if (CallProtoService(p.szAccountName, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&cs) == 0)
- p.tszProtoXStatus = mir_tstrdup(str);
+ p.tszProtoXStatus = mir_wstrdup(str);
}
if ((p.xStatusMode & 3)) {
@@ -363,22 +363,22 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) SIZE txtSize;
if (p.bShowProtoName) {
- GetTextExtentPoint32(hDC, p.tszProtoHumanName, (int)mir_tstrlen(p.tszProtoHumanName), &txtSize);
+ GetTextExtentPoint32(hDC, p.tszProtoHumanName, (int)mir_wstrlen(p.tszProtoHumanName), &txtSize);
w += txtSize.cx + 3 + spaceWidth;
}
if (p.bShowProtoEmails && p.szProtoEMailCount) {
- GetTextExtentPoint32(hDC, p.szProtoEMailCount, (int)mir_tstrlen(p.szProtoEMailCount), &txtSize);
+ GetTextExtentPoint32(hDC, p.szProtoEMailCount, (int)mir_wstrlen(p.szProtoEMailCount), &txtSize);
w += txtSize.cx + 3 + spaceWidth;
}
if (p.bShowStatusName) {
- GetTextExtentPoint32(hDC, p.tszProtoStatusText, (int)mir_tstrlen(p.tszProtoStatusText), &txtSize);
+ GetTextExtentPoint32(hDC, p.tszProtoStatusText, (int)mir_wstrlen(p.tszProtoStatusText), &txtSize);
w += txtSize.cx + 3 + spaceWidth;
}
if ((p.xStatusMode & 8) && p.tszProtoXStatus) {
- GetTextExtentPoint32(hDC, p.tszProtoXStatus, (int)mir_tstrlen(p.tszProtoXStatus), &txtSize);
+ GetTextExtentPoint32(hDC, p.tszProtoXStatus, (int)mir_wstrlen(p.tszProtoXStatus), &txtSize);
w += txtSize.cx + 3 + spaceWidth;
}
@@ -517,7 +517,7 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) }
if (p.bShowProtoName) {
- int cbLen = (int)mir_tstrlen(p.tszProtoHumanName);
+ int cbLen = (int)mir_wstrlen(p.tszProtoHumanName);
RECT rt = r;
rt.left = x + (spaceWidth >> 1);
rt.top = textY;
@@ -531,7 +531,7 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) }
if (p.bShowProtoEmails && p.szProtoEMailCount != NULL) {
- int cbLen = (int)mir_tstrlen(p.szProtoEMailCount);
+ int cbLen = (int)mir_wstrlen(p.szProtoEMailCount);
RECT rt = r;
rt.left = x + (spaceWidth >> 1);
rt.top = textY;
@@ -544,7 +544,7 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) }
if (p.bShowStatusName) {
- int cbLen = (int)mir_tstrlen(p.tszProtoStatusText);
+ int cbLen = (int)mir_wstrlen(p.tszProtoStatusText);
RECT rt = r;
rt.left = x + (spaceWidth >> 1);
rt.top = textY;
@@ -560,7 +560,7 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) RECT rt = r;
rt.left = x + (spaceWidth >> 1);
rt.top = textY;
- ske_DrawText(hDC, p.tszProtoXStatus, (int)mir_tstrlen(p.tszProtoXStatus), &rt, 0);
+ ske_DrawText(hDC, p.tszProtoXStatus, (int)mir_wstrlen(p.tszProtoXStatus), &rt, 0);
}
p.protoRect = r;
diff --git a/plugins/Clist_modern/src/modern_tbbutton.cpp b/plugins/Clist_modern/src/modern_tbbutton.cpp index 0ea00a70be..24b642d0d9 100644 --- a/plugins/Clist_modern/src/modern_tbbutton.cpp +++ b/plugins/Clist_modern/src/modern_tbbutton.cpp @@ -238,7 +238,7 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam break;
case WM_SETTEXT:
- mir_tstrncpy(bct->szText, (wchar_t*)lParam, _countof(bct->szText));
+ mir_wstrncpy(bct->szText, (wchar_t*)lParam, _countof(bct->szText));
break;
case WM_SETFONT:
diff --git a/plugins/Clist_modern/src/modern_toolbar.cpp b/plugins/Clist_modern/src/modern_toolbar.cpp index 7db4523adb..3009c46d0c 100644 --- a/plugins/Clist_modern/src/modern_toolbar.cpp +++ b/plugins/Clist_modern/src/modern_toolbar.cpp @@ -138,7 +138,7 @@ static int ehhToolBarBackgroundSettingsChanged(WPARAM, LPARAM) if (g_CluiData.fDisableSkinEngine) {
tbdat.mtb_bkColour = cliGetColor("ToolBar", "BkColour", CLCDEFAULT_BKCOLOUR);
if (db_get_b(NULL, "ToolBar", "UseBitmap", CLCDEFAULT_USEBITMAP)) {
- ptrT tszBitmapName(db_get_tsa(NULL, "ToolBar", "BkBitmap"));
+ ptrW tszBitmapName(db_get_tsa(NULL, "ToolBar", "BkBitmap"));
if (tszBitmapName)
tbdat.mtb_hBmpBackground = Bitmap_Load(tszBitmapName);
}
diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp index 8c4a49db88..bcfec081be 100644 --- a/plugins/Clist_modern/src/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp @@ -116,7 +116,7 @@ int FillModes(char *szsetting) if (szsetting[0] == 13)
return 1;
- ptrT temp(mir_utf8decodeT(szsetting));
+ ptrW temp(mir_utf8decodeW(szsetting));
if (temp != NULL)
SendDlgItemMessage(clvmHwnd, IDC_VIEWMODES, LB_INSERTSTRING, -1, (LPARAM)temp);
return 1;
@@ -413,8 +413,8 @@ void SaveState() item.cchTextMax = _countof(szTemp);
item.iItem = i;
SendMessage(hwndList, LVM_GETITEM, 0, (LPARAM)&item);
- mir_tstrncat(newGroupFilter, szTemp, _countof(newGroupFilter) - mir_tstrlen(newGroupFilter));
- mir_tstrncat(newGroupFilter, L"|", _countof(newGroupFilter) - mir_tstrlen(newGroupFilter));
+ mir_wstrncat(newGroupFilter, szTemp, _countof(newGroupFilter) - mir_wstrlen(newGroupFilter));
+ mir_wstrncat(newGroupFilter, L"|", _countof(newGroupFilter) - mir_wstrlen(newGroupFilter));
newGroupFilter[2047] = 0;
}
}
@@ -502,7 +502,7 @@ static void UpdateFilters() mir_strncpy(g_szModename, szBuf, _countof(g_szModename));
{
wchar_t szTemp[100];
- mir_sntprintf(szTemp, TranslateT("Configuring view mode: %s"), szTempBuf);
+ mir_snwprintf(szTemp, TranslateT("Configuring view mode: %s"), szTempBuf);
SetDlgItemText(clvmHwnd, IDC_CURVIEWMODE2, szTemp);
}
mir_snprintf(szSetting, "%c%s_PF", 246, szBuf);
@@ -511,7 +511,7 @@ static void UpdateFilters() return;
mir_snprintf(szSetting, "%c%s_GF", 246, szBuf);
- ptrT szGF(db_get_tsa(NULL, CLVM_MODULE, szSetting));
+ ptrW szGF(db_get_tsa(NULL, CLVM_MODULE, szSetting));
if (szGF == NULL)
return;
@@ -561,7 +561,7 @@ static void UpdateFilters() for (i = 1; i < ListView_GetItemCount(hwndList); i++) {
item.iItem = i;
SendMessage(hwndList, LVM_GETITEM, 0, (LPARAM)&item);
- mir_sntprintf(szMask, L"%s|", szTemp);
+ mir_snwprintf(szMask, L"%s|", szTemp);
if (szGF && wcsstr(szGF, szMask))
ListView_SetCheckState(hwndList, i, TRUE)
else
@@ -890,7 +890,7 @@ static int FillMenuCallback(char *szSetting) if (szSetting[0] == 13)
return 1;
- wchar_t *temp = mir_utf8decodeT(szSetting);
+ wchar_t *temp = mir_utf8decodeW(szSetting);
if (temp) {
AppendMenu(hViewModeMenu, MFT_STRING, menuCounter++, temp);
mir_free(temp);
@@ -987,7 +987,7 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM }
if (g_CluiData.bFilterEffective)
- SetDlgItemText(hwnd, IDC_SELECTMODE, ptrT(mir_utf8decodeT(g_CluiData.current_viewmode)));
+ SetDlgItemText(hwnd, IDC_SELECTMODE, ptrW(mir_utf8decodeW(g_CluiData.current_viewmode)));
else
SetDlgItemText(hwnd, IDC_SELECTMODE, TranslateT("All contacts"));
break;
@@ -1167,7 +1167,7 @@ static int ehhViewModeBackgroundSettingsChanged(WPARAM, LPARAM) if (g_CluiData.fDisableSkinEngine) {
view_mode.bkColour = cliGetColor("ViewMode", "BkColour", CLCDEFAULT_BKCOLOUR);
if (db_get_b(NULL, "ViewMode", "UseBitmap", CLCDEFAULT_USEBITMAP)) {
- ptrT tszBitmapName(db_get_tsa(NULL, "ViewMode", "BkBitmap"));
+ ptrW tszBitmapName(db_get_tsa(NULL, "ViewMode", "BkBitmap"));
if (tszBitmapName)
view_mode.hBmpBackground = Bitmap_Load(tszBitmapName);
}
@@ -1268,8 +1268,8 @@ void ApplyViewMode(const char *Name, bool onlySelector) }
mir_snprintf(szSetting, "%c%s_GF", 246, Name);
if (!db_get_ts(NULL, CLVM_MODULE, szSetting, &dbv)) {
- if (mir_tstrlen(dbv.ptszVal) >= 2) {
- mir_tstrncpy(g_CluiData.groupFilter, dbv.ptszVal, _countof(g_CluiData.groupFilter));
+ if (mir_wstrlen(dbv.ptszVal) >= 2) {
+ mir_wstrncpy(g_CluiData.groupFilter, dbv.ptszVal, _countof(g_CluiData.groupFilter));
g_CluiData.groupFilter[_countof(g_CluiData.groupFilter) - 1] = 0;
g_CluiData.bFilterEffective |= CLVM_FILTER_GROUPS;
}
@@ -1360,7 +1360,7 @@ void ApplyViewMode(const char *Name, bool onlySelector) }
}
- SetWindowText(hwndSelector, ptrT(mir_utf8decodeW((Name[0] == 13) ? Name + 1 : Name)));
+ SetWindowText(hwndSelector, ptrW(mir_utf8decodeW((Name[0] == 13) ? Name + 1 : Name)));
Clist_Broadcast(CLM_AUTOREBUILD, 0, 0);
cliInvalidateRect(pcli->hwndStatus, NULL, FALSE);
diff --git a/plugins/Clist_modern/src/stdafx.h b/plugins/Clist_modern/src/stdafx.h index 814eed1ffa..3f58571406 100644 --- a/plugins/Clist_modern/src/stdafx.h +++ b/plugins/Clist_modern/src/stdafx.h @@ -181,7 +181,7 @@ void MakeButtonSkinned(HWND hWnd); #endif
#define strsetA(a,b) {if (a) mir_free_and_nill(a); a=mir_strdup(b);}
-#define strsetT(a,b) {if (a) mir_free_and_nill(a); a=mir_tstrdup(b);}
+#define strsetT(a,b) {if (a) mir_free_and_nill(a); a=mir_wstrdup(b);}
void TRACE_ERROR();
diff --git a/plugins/Clist_nicer/src/CLCButton.cpp b/plugins/Clist_nicer/src/CLCButton.cpp index fef024d3b1..42ce47c46c 100644 --- a/plugins/Clist_nicer/src/CLCButton.cpp +++ b/plugins/Clist_nicer/src/CLCButton.cpp @@ -326,7 +326,7 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint) ctl->sLabel.cx = ctl->sLabel.cy = 0;
}
else {
- GetTextExtentPoint32(hdcMem, ctl->szText, (int)mir_tstrlen(ctl->szText), &ctl->sLabel);
+ GetTextExtentPoint32(hdcMem, ctl->szText, (int)mir_wstrlen(ctl->szText), &ctl->sLabel);
if (g_cxsmIcon + ctl->sLabel.cx + 8 > rcClient.right - rcClient.left)
ctl->sLabel.cx = (rcClient.right - rcClient.left) - g_cxsmIcon - 8;
diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index cc7ec10771..7d25e6faf0 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -404,7 +404,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L case INTM_NAMECHANGED:
if (!pcli->pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL))
break;
- mir_tstrncpy(contact->szText, pcli->pfnGetContactDisplayName(wParam, 0), _countof(contact->szText));
+ mir_wstrncpy(contact->szText, pcli->pfnGetContactDisplayName(wParam, 0), _countof(contact->szText));
RTL_DetectAndSet(contact, 0);
@@ -490,7 +490,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L contact->proto = GetContactProto(wParam);
pcli->pfnInvalidateDisplayNameCacheEntry(wParam);
- mir_tstrncpy(contact->szText, pcli->pfnGetContactDisplayName(wParam, 0), _countof(contact->szText));
+ mir_wstrncpy(contact->szText, pcli->pfnGetContactDisplayName(wParam, 0), _countof(contact->szText));
RTL_DetectAndSet(contact, 0);
diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index d46f474e20..4aeb70399c 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -164,7 +164,7 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) DBVARIANT dbv = { 0 };
INT_PTR result = db_get_ts(hContact, "CList", "StatusMsg", &dbv);
- if (!result && mir_tstrlen(dbv.ptszVal) > 0)
+ if (!result && mir_wstrlen(dbv.ptszVal) > 0)
p->bStatusMsgValid = STATUSMSG_CLIST;
else {
if (!szProto)
@@ -172,11 +172,11 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) if (szProto) {
if (!result)
db_free(&dbv);
- if (!(result = db_get_ts(hContact, szProto, "YMsg", &dbv)) && mir_tstrlen(dbv.ptszVal) > 0)
+ if (!(result = db_get_ts(hContact, szProto, "YMsg", &dbv)) && mir_wstrlen(dbv.ptszVal) > 0)
p->bStatusMsgValid = STATUSMSG_YIM;
- else if (!(result = db_get_ts(hContact, szProto, "StatusDescr", &dbv)) && mir_tstrlen(dbv.ptszVal) > 0)
+ else if (!(result = db_get_ts(hContact, szProto, "StatusDescr", &dbv)) && mir_wstrlen(dbv.ptszVal) > 0)
p->bStatusMsgValid = STATUSMSG_GG;
- else if (!(result = db_get_ts(hContact, szProto, "XStatusMsg", &dbv)) && mir_tstrlen(dbv.ptszVal) > 0)
+ else if (!(result = db_get_ts(hContact, szProto, "XStatusMsg", &dbv)) && mir_wstrlen(dbv.ptszVal) > 0)
p->bStatusMsgValid = STATUSMSG_XSTATUS;
}
}
@@ -185,8 +185,8 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) if (!result)
db_free(&dbv);
result = db_get_ts(hContact, szProto, "XStatusName", &dbv);
- if (!result && mir_tstrlen(dbv.ptszVal) > 1) {
- size_t iLen = mir_tstrlen(dbv.ptszVal);
+ if (!result && mir_wstrlen(dbv.ptszVal) > 1) {
+ size_t iLen = mir_wstrlen(dbv.ptszVal);
p->bStatusMsgValid = STATUSMSG_XSTATUSNAME;
p->statusMsg = (wchar_t *)realloc(p->statusMsg, (iLen + 2) * sizeof(wchar_t));
wcsncpy(p->statusMsg, dbv.ptszVal, iLen + 1);
@@ -205,8 +205,8 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) cst.ptszName = xStatusName;
if (!CallProtoService(szProto, PS_GETCUSTOMSTATUSEX, hContact, (LPARAM)&cst)) {
wchar_t *szwXstatusName = TranslateTS(xStatusName);
- p->statusMsg = (wchar_t *)realloc(p->statusMsg, (mir_tstrlen(szwXstatusName) + 2) * sizeof(wchar_t));
- wcsncpy(p->statusMsg, szwXstatusName, mir_tstrlen(szwXstatusName) + 1);
+ p->statusMsg = (wchar_t *)realloc(p->statusMsg, (mir_wstrlen(szwXstatusName) + 2) * sizeof(wchar_t));
+ wcsncpy(p->statusMsg, szwXstatusName, mir_wstrlen(szwXstatusName) + 1);
p->bStatusMsgValid = STATUSMSG_XSTATUSNAME;
}
}
@@ -215,7 +215,7 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) if (p->bStatusMsgValid > STATUSMSG_XSTATUSNAME) {
int j = 0;
- p->statusMsg = (wchar_t *)realloc(p->statusMsg, (mir_tstrlen(dbv.ptszVal) + 2) * sizeof(wchar_t));
+ p->statusMsg = (wchar_t *)realloc(p->statusMsg, (mir_wstrlen(dbv.ptszVal) + 2) * sizeof(wchar_t));
for (int i = 0; dbv.ptszVal[i]; i++) {
if (dbv.ptszVal[i] == (wchar_t)0x0d)
continue;
@@ -407,10 +407,10 @@ int CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, struct ClcData }
if (cfg::dat.bFilterEffective & CLVM_FILTER_GROUPS) {
- ptrT tszGroup(db_get_tsa(hContact, "CList", "Group"));
+ ptrW tszGroup(db_get_tsa(hContact, "CList", "Group"));
if (tszGroup != NULL) {
wchar_t szGroupMask[256];
- mir_sntprintf(szGroupMask, L"%s|", tszGroup);
+ mir_snwprintf(szGroupMask, L"%s|", tszGroup);
int bHasGroup = wcsstr(cfg::dat.groupFilter, szGroupMask) ? 1 : 0;
filterResult = (cfg::dat.filterFlags & CLVM_PROTOGROUP_OP) ? (filterResult | bHasGroup) : (filterResult & bHasGroup);
}
diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp index 76d2aa23ed..e8f3488f7b 100644 --- a/plugins/Clist_nicer/src/clcpaint.cpp +++ b/plugins/Clist_nicer/src/clcpaint.cpp @@ -485,7 +485,7 @@ set_bg_l: }
else if (type == CLCIT_DIVIDER) {
ChangeToFont(hdcMem, dat, FONTID_DIVIDERS, &fontHeight);
- GetTextExtentPoint32(hdcMem, contact->szText, (int)mir_tstrlen(contact->szText), &textSize);
+ GetTextExtentPoint32(hdcMem, contact->szText, (int)mir_wstrlen(contact->szText), &textSize);
}
else if (type == CLCIT_CONTACT && flags & CONTACTF_NOTONLIST)
ChangeToFont(hdcMem, dat, FONTID_NOTONLIST, &fontHeight);
@@ -501,13 +501,13 @@ set_bg_l: wchar_t *szCounts = NULL;
if (type == CLCIT_GROUP) {
- GetTextExtentPoint32(hdcMem, contact->szText, (int)mir_tstrlen(contact->szText), &textSize);
+ GetTextExtentPoint32(hdcMem, contact->szText, (int)mir_wstrlen(contact->szText), &textSize);
int width = textSize.cx;
szCounts = pcli->pfnGetGroupCountsText(dat, contact);
if (szCounts[0]) {
GetTextExtentPoint32(hdcMem, L" ", 1, &spaceSize);
ChangeToFont(hdcMem, dat, FONTID_GROUPCOUNTS, &fontHeight);
- GetTextExtentPoint32(hdcMem, szCounts, (int)mir_tstrlen(szCounts), &countsSize);
+ GetTextExtentPoint32(hdcMem, szCounts, (int)mir_wstrlen(szCounts), &countsSize);
width += spaceSize.cx + countsSize.cx;
}
}
@@ -969,7 +969,7 @@ bgskipped: rc2.left = rcContent.left;
rc2.right = rc2.left - dat->rightMargin + ((clRect->right - rc2.left - textSize.cx) >> 1) - 3;
DrawEdge(hdcMem, &rc2, BDR_SUNKENOUTER, BF_RECT);
- TextOut(hdcMem, rc2.right + 3, y + ((rowHeight - fontHeight) >> 1), contact->szText, (int)mir_tstrlen(contact->szText));
+ TextOut(hdcMem, rc2.right + 3, y + ((rowHeight - fontHeight) >> 1), contact->szText, (int)mir_wstrlen(contact->szText));
rc2.left = rc2.right + 6 + textSize.cx;
rc2.right = clRect->right - dat->rightMargin;
DrawEdge(hdcMem, &rc2, BDR_SUNKENOUTER, BF_RECT);
@@ -1002,7 +1002,7 @@ bgskipped: int labelWidth = textSize.cx + countsSize.cx + spaceSize.cx;
int offset = (g_center) ? ((rc2.right - rc2.left) - labelWidth) / 2 : 0;
- TextOut(hdcMem, rc2.left + offset + textSize.cx + spaceSize.cx, rc2.top + groupCountsFontTopShift, szCounts, (int)mir_tstrlen(szCounts));
+ TextOut(hdcMem, rc2.left + offset + textSize.cx + spaceSize.cx, rc2.top + groupCountsFontTopShift, szCounts, (int)mir_wstrlen(szCounts));
rightLineStart = rc2.left + offset + textSize.cx + spaceSize.cx + countsSize.cx + 2;
if (selected && !g_ignoreselforgroups)
@@ -1110,7 +1110,7 @@ bgskipped: COLORREF oldColor = GetTextColor(hdcMem);
int idOldFont = dat->currentFontID;
ChangeToFont(hdcMem, dat, FONTID_TIMESTAMP, &fHeight);
- GetTextExtentPoint32(hdcMem, szResult, (int)mir_tstrlen(szResult), &szTime);
+ GetTextExtentPoint32(hdcMem, szResult, (int)mir_wstrlen(szResult), &szTime);
verticalfit = (rowHeight - fHeight >= g_cysmIcon + 1);
if (av_right) {
@@ -1191,7 +1191,7 @@ bgskipped: LONG rightIconsTop = rcContent.bottom - g_cysmIcon;
LONG old_right = rcContent.right;
ULONG textCounter = 0;
- size_t ulLen = mir_tstrlen(szText);
+ size_t ulLen = mir_wstrlen(szText);
LONG old_bottom = rcContent.bottom;
DWORD i_dtFlags = DT_WORDBREAK | DT_NOPREFIX | dt_2ndrowflags;
dtp.cbSize = sizeof(dtp);
@@ -1215,7 +1215,7 @@ bgskipped: if (selected) {
if (type != CLCIT_DIVIDER) {
RECT rc2;
- int qlen = (int)mir_tstrlen(dat->szQuickSearch);
+ int qlen = (int)mir_wstrlen(dat->szQuickSearch);
if (hPreviousFont)
SelectObject(hdcMem, hPreviousFont);
SetTextColor(hdcMem, dat->quickSearchColour);
diff --git a/plugins/Clist_nicer/src/clcutils.cpp b/plugins/Clist_nicer/src/clcutils.cpp index 576642bf86..3bfc67c656 100644 --- a/plugins/Clist_nicer/src/clcutils.cpp +++ b/plugins/Clist_nicer/src/clcutils.cpp @@ -37,7 +37,7 @@ extern void ( *saveRecalcScrollBar )(HWND hwnd, struct ClcData *dat); static int MY_pathIsAbsolute(const wchar_t *path)
{
- if (!path || !(mir_tstrlen(path) > 2))
+ if (!path || !(mir_wstrlen(path) > 2))
return 0;
if ((path[1] == ':' && path[2] == '\\') || (path[0] == '\\' && path[1] == '\\'))
@@ -52,7 +52,7 @@ size_t MY_pathToRelative(const wchar_t *pSrc, wchar_t *pOut) if (!pSrc || !pOut)
return 0;
- dwSrcLen = mir_tstrlen(pSrc);
+ dwSrcLen = mir_wstrlen(pSrc);
if (!dwSrcLen || dwSrcLen > (MAX_PATH - 1))
return 0;
if (!MY_pathIsAbsolute(pSrc))
@@ -63,7 +63,7 @@ size_t MY_pathToRelative(const wchar_t *pSrc, wchar_t *pOut) szTmp[dwSrcLen] = 0;
wcslwr(szTmp);
if (wcsstr(szTmp, cfg::dat.tszProfilePath)) {
- dwProfilePathLen = mir_tstrlen(cfg::dat.tszProfilePath);
+ dwProfilePathLen = mir_wstrlen(cfg::dat.tszProfilePath);
memcpy(pOut, (pSrc + (dwProfilePathLen - 1)), ((dwSrcLen - (dwProfilePathLen - 1)) * sizeof(wchar_t)));
pOut[0] = '.';
pOut[dwSrcLen] = 0;
@@ -82,7 +82,7 @@ size_t MY_pathToAbsolute(const wchar_t *pSrc, wchar_t *pOut) if (!pSrc || !pOut)
return 0;
- dwSrcLen = mir_tstrlen(pSrc);
+ dwSrcLen = mir_wstrlen(pSrc);
if (!dwSrcLen || dwSrcLen > (MAX_PATH - 1))
return 0;
@@ -92,7 +92,7 @@ size_t MY_pathToAbsolute(const wchar_t *pSrc, wchar_t *pOut) return dwSrcLen;
}
if (pSrc[0] == '.')
- return (mir_sntprintf(pOut, MAX_PATH, L"%s\\%s", cfg::dat.tszProfilePath, pSrc));
+ return (mir_snwprintf(pOut, MAX_PATH, L"%s\\%s", cfg::dat.tszProfilePath, pSrc));
return 0;
}
@@ -164,7 +164,7 @@ int RTL_HitTest(HWND hwnd, struct ClcData *dat, int testx, ClcContact *hitcontac hFont = reinterpret_cast<HFONT>(SelectObject(hdc, dat->fontInfo[FONTID_GROUPS].hFont));
else
hFont = reinterpret_cast<HFONT>(SelectObject(hdc, dat->fontInfo[FONTID_CONTACTS].hFont));
- GetTextExtentPoint32(hdc, hitcontact->szText, (int)mir_tstrlen(hitcontact->szText), &textSize);
+ GetTextExtentPoint32(hdc, hitcontact->szText, (int)mir_wstrlen(hitcontact->szText), &textSize);
width = textSize.cx;
if (hitcontact->type == CLCIT_GROUP) {
wchar_t *szCounts;
@@ -173,7 +173,7 @@ int RTL_HitTest(HWND hwnd, struct ClcData *dat, int testx, ClcContact *hitcontac 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;
}
}
@@ -305,7 +305,7 @@ int HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact **c hFont = reinterpret_cast<HFONT>(SelectObject(hdc, dat->fontInfo[FONTID_GROUPS].hFont));
else
hFont = reinterpret_cast<HFONT>(SelectObject(hdc, dat->fontInfo[FONTID_CONTACTS].hFont));
- GetTextExtentPoint32(hdc, hitcontact->szText, (int)mir_tstrlen(hitcontact->szText), &textSize);
+ GetTextExtentPoint32(hdc, hitcontact->szText, (int)mir_wstrlen(hitcontact->szText), &textSize);
width = textSize.cx;
if (hitcontact->type == CLCIT_GROUP) {
wchar_t *szCounts;
@@ -314,7 +314,7 @@ int HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact **c 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;
}
}
diff --git a/plugins/Clist_nicer/src/clistevents.cpp b/plugins/Clist_nicer/src/clistevents.cpp index 6a504da5b3..01f6882ce7 100644 --- a/plugins/Clist_nicer/src/clistevents.cpp +++ b/plugins/Clist_nicer/src/clistevents.cpp @@ -264,7 +264,7 @@ CListEvent* AddEvent(CLISTEVENT *cle) wchar_t szwProto[64];
MultiByteToWideChar(CP_ACP, 0, szProto, -1, szwProto, 64);
szwProto[63] = 0;
- mir_sntprintf(szBuffer, L"%s: %s (%s)", szwProto, szName, szStatus);
+ mir_snwprintf(szBuffer, L"%s: %s (%s)", szwProto, szName, szStatus);
szBuffer[127] = 0;
AppendMenu(cfg::dat.hMenuNotify, MF_BYCOMMAND | MF_STRING, cfg::dat.wNextMenuID, szBuffer);
diff --git a/plugins/Clist_nicer/src/clistmenus.cpp b/plugins/Clist_nicer/src/clistmenus.cpp index 94cfbf6e52..8f8f9b6018 100644 --- a/plugins/Clist_nicer/src/clistmenus.cpp +++ b/plugins/Clist_nicer/src/clistmenus.cpp @@ -102,7 +102,7 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA DWORD dwFlags = db_get_dw(hContact, "CList", "CLN_Flags", 0);
BYTE bSecondLine = db_get_b(hContact, "CList", "CLN_2ndline", -1);
- mir_sntprintf(szTitle, TranslateT("Contact list display and ignore options for %s"), contact ? contact->szText : pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_snwprintf(szTitle, TranslateT("Contact list display and ignore options for %s"), contact ? contact->szText : pcli->pfnGetContactDisplayName(hContact, 0));
SetWindowText(hWnd, szTitle);
Window_SetSkinIcon_IcoLib(hWnd, SKINICON_OTHER_MIRANDA);
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index 954d08a5bd..639cffa96e 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -267,7 +267,7 @@ static void InitIcoLib() continue; wchar_t szDescr[128]; - mir_sntprintf(szDescr, TranslateT("%s connecting"), accs[k]->tszAccountName); + mir_snwprintf(szDescr, TranslateT("%s connecting"), accs[k]->tszAccountName); IconItemT icon = { szDescr, "conn", IDI_PROTOCONNECTING }; Icon_RegisterT(g_hInst, LPGENW("Contact list") L"/" LPGENW("Connecting icons"), &icon, 1, accs[k]->szModuleName); } @@ -1416,7 +1416,7 @@ skipbg: MessageBox(0, TranslateT("The requested action requires a valid contact selection. Please select a contact from the contact list and repeat."), TranslateT("Parameter mismatch"), MB_OK); if (serviceFailure) { wchar_t szError[512]; - mir_sntprintf(szError, TranslateT("The service %S specified by the %S button definition was not found. You may need to install additional plugins."), item->szService, item->szName); + mir_snwprintf(szError, TranslateT("The service %S specified by the %S button definition was not found. You may need to install additional plugins."), item->szService, item->szName); MessageBox(NULL, szError, TranslateT("Service failure"), MB_OK); } break; @@ -1709,22 +1709,22 @@ buttons_done: wchar_t szName[64]; PROTOACCOUNT *pa = Proto_GetAccount(szProto); if (pa) { - mir_tstrncpy(szName, pa->tszAccountName, _countof(szName)); + mir_wstrncpy(szName, pa->tszAccountName, _countof(szName)); szName[_countof(szName) - 1] = 0; } else szName[0] = 0; - if (mir_tstrlen(szName) < sizeof(szName) - 1) - mir_tstrcat(szName, L" "); - GetTextExtentPoint32(dis->hDC, szName, (int)mir_tstrlen(szName), &textSize); - TextOut(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, szName, (int)mir_tstrlen(szName)); + if (mir_wstrlen(szName) < sizeof(szName) - 1) + mir_wstrcat(szName, L" "); + GetTextExtentPoint32(dis->hDC, szName, (int)mir_wstrlen(szName), &textSize); + TextOut(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, szName, (int)mir_wstrlen(szName)); x += textSize.cx; } if (showOpts & 4) { wchar_t *szStatus = pcli->pfnGetStatusModeDescription(status, 0); - 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) { @@ -1827,7 +1827,7 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar { wchar_t str[64]; DWORD v = pluginInfo.version; - mir_sntprintf(str, L"%s %d.%d.%d.%d", TranslateT("Version"), HIBYTE(HIWORD(v)), LOBYTE(HIWORD(v)), HIBYTE(LOWORD(v)), LOBYTE(LOWORD(v))); + mir_snwprintf(str, L"%s %d.%d.%d.%d", TranslateT("Version"), HIBYTE(HIWORD(v)), LOBYTE(HIWORD(v)), HIBYTE(LOWORD(v)), LOBYTE(LOWORD(v))); SetDlgItemText(hwndDlg, IDC_VERSION, str); } { diff --git a/plugins/Clist_nicer/src/cluiframes.cpp b/plugins/Clist_nicer/src/cluiframes.cpp index 53e2692258..4e7b17a37f 100644 --- a/plugins/Clist_nicer/src/cluiframes.cpp +++ b/plugins/Clist_nicer/src/cluiframes.cpp @@ -472,9 +472,9 @@ int LocateStorePosition(int Frameid, int maxstored) for (int i = 0; i < maxstored; i++) { char settingname[255]; mir_snprintf(settingname, "Name%d", i); - ptrT frmname(db_get_tsa(0, CLUIFrameModule, settingname)); + ptrW frmname(db_get_tsa(0, CLUIFrameModule, settingname)); if (frmname == NULL) continue; - if (mir_tstrcmpi(frmname, Frames[Frameid].name) == 0) + if (mir_wstrcmpi(frmname, Frames[Frameid].name) == 0) return i; } return -1; @@ -867,7 +867,7 @@ INT_PTR CLUIFramesSetFrameOptions(WPARAM wParam, LPARAM lParam) return -1; mir_free(Frames[pos].name); - Frames[pos].name = (wParam & FO_UNICODETEXT) ? mir_u2t((LPWSTR)lParam) : mir_a2t((LPSTR)lParam); + Frames[pos].name = (wParam & FO_UNICODETEXT) ? mir_wstrdup((LPWSTR)lParam) : mir_a2u((LPSTR)lParam); return 0; case FO_TBNAME: @@ -875,7 +875,7 @@ INT_PTR CLUIFramesSetFrameOptions(WPARAM wParam, LPARAM lParam) return -1; mir_free(Frames[pos].TitleBar.tbname); - Frames[pos].TitleBar.tbname = (wParam & FO_UNICODETEXT) ? mir_u2t((LPWSTR)lParam) : mir_a2t((LPSTR)lParam); + Frames[pos].TitleBar.tbname = (wParam & FO_UNICODETEXT) ? mir_wstrdup((LPWSTR)lParam) : mir_a2u((LPSTR)lParam); lck.unlock(); if (Frames[pos].floating && (Frames[pos].TitleBar.tbname != NULL)) @@ -887,7 +887,7 @@ INT_PTR CLUIFramesSetFrameOptions(WPARAM wParam, LPARAM lParam) return -1; mir_free(Frames[pos].TitleBar.tooltip); - Frames[pos].TitleBar.tooltip = (wParam & FO_UNICODETEXT) ? mir_u2t((LPWSTR)lParam) : mir_a2t((LPSTR)lParam); + Frames[pos].TitleBar.tooltip = (wParam & FO_UNICODETEXT) ? mir_wstrdup((LPWSTR)lParam) : mir_a2u((LPSTR)lParam); UpdateTBToolTip(pos); return 0; @@ -1014,7 +1014,7 @@ INT_PTR CLUIFramesShowHideFrame(WPARAM frameId, LPARAM) { mir_cslock lck(csFrameHook); pos = id2pos(frameId); - if (pos >= 0 && !mir_tstrcmp(Frames[pos].name, L"My contacts")) + if (pos >= 0 && !mir_wstrcmp(Frames[pos].name, L"My contacts")) Frames[pos].visible = 1; else { if (pos >= 0 && (int)pos < nFramescount) @@ -1599,15 +1599,15 @@ INT_PTR CLUIFramesAddFrame(WPARAM wParam, LPARAM) if (clfrm->name == NULL || ((clfrm->Flags&F_UNICODE) ? mir_wstrlen(clfrm->wname) : mir_strlen(clfrm->name)) == 0) { wchar_t ptszClassName[256]; GetClassName(Frames[nFramescount].hWnd, ptszClassName, _countof(ptszClassName)); - Frames[nFramescount].name = mir_tstrdup(ptszClassName); + Frames[nFramescount].name = mir_wstrdup(ptszClassName); } - else Frames[nFramescount].name = (clfrm->Flags & F_UNICODE) ? mir_u2t(clfrm->wname) : mir_a2t(clfrm->name); + else Frames[nFramescount].name = (clfrm->Flags & F_UNICODE) ? mir_wstrdup(clfrm->wname) : mir_a2u(clfrm->name); if (IsBadCodePtr((FARPROC)clfrm->TBname) || clfrm->TBname == NULL || ((clfrm->Flags&F_UNICODE) ? mir_wstrlen(clfrm->TBwname) : mir_strlen(clfrm->TBname)) == 0) - Frames[nFramescount].TitleBar.tbname = mir_tstrdup(Frames[nFramescount].name); + Frames[nFramescount].TitleBar.tbname = mir_wstrdup(Frames[nFramescount].name); else - Frames[nFramescount].TitleBar.tbname = (clfrm->Flags & F_UNICODE) ? mir_u2t(clfrm->TBwname) : mir_a2t(clfrm->TBname); + Frames[nFramescount].TitleBar.tbname = (clfrm->Flags & F_UNICODE) ? mir_wstrdup(clfrm->TBwname) : mir_a2u(clfrm->TBname); Frames[nFramescount].needhide = FALSE; Frames[nFramescount].TitleBar.ShowTitleBar = (clfrm->Flags & F_SHOWTB ? TRUE : FALSE); Frames[nFramescount].TitleBar.ShowTitleBarTip = (clfrm->Flags & F_SHOWTBTIP ? TRUE : FALSE); @@ -2153,7 +2153,7 @@ int OnFrameTitleBarBackgroundChange() hBmpBackground = NULL; } if (db_get_b(NULL, "FrameTitleBar", "UseBitmap", CLCDEFAULT_USEBITMAP)) { - ptrT tszBitmapName(db_get_tsa(NULL, "FrameTitleBar", "BkBitmap")); + ptrW tszBitmapName(db_get_tsa(NULL, "FrameTitleBar", "BkBitmap")); if (tszBitmapName != NULL) hBmpBackground = Bitmap_Load(tszBitmapName); } @@ -2224,11 +2224,11 @@ static int DrawTitleBar(HDC dc, RECT rect, int Frameid) if (!AlignCOLLIconToLeft) { if (Frames[pos].TitleBar.hicon != NULL) { DrawIconEx(hdcMem, 6 + cfg::dat.bClipBorder, ((TitleBarH >> 1) - 8), Frames[pos].TitleBar.hicon, 16, 16, 0, NULL, DI_NORMAL); - TextOut(hdcMem, 24 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, (int)mir_tstrlen(Frames[pos].TitleBar.tbname)); + TextOut(hdcMem, 24 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, (int)mir_wstrlen(Frames[pos].TitleBar.tbname)); } - else TextOut(hdcMem, 6 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, (int)mir_tstrlen(Frames[pos].TitleBar.tbname)); + else TextOut(hdcMem, 6 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, (int)mir_wstrlen(Frames[pos].TitleBar.tbname)); } - else TextOut(hdcMem, 18 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, (int)mir_tstrlen(Frames[pos].TitleBar.tbname)); + else TextOut(hdcMem, 18 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, (int)mir_wstrlen(Frames[pos].TitleBar.tbname)); if (!AlignCOLLIconToLeft) DrawIconEx(hdcMem, Frames[pos].TitleBar.wndSize.right - 22, ((TitleBarH >> 1) - 8), Frames[pos].collapsed ? Skin_LoadIcon(SKINICON_OTHER_GROUPOPEN) : Skin_LoadIcon(SKINICON_OTHER_GROUPSHUT), 16, 16, 0, NULL, DI_NORMAL); @@ -2896,7 +2896,7 @@ wchar_t g_ptszEventName[100]; static int CLUIFrameOnModulesLoad(WPARAM, LPARAM) { - mir_sntprintf(g_ptszEventName, L"mf_update_evt_%d", GetCurrentThreadId()); + mir_snwprintf(g_ptszEventName, L"mf_update_evt_%d", GetCurrentThreadId()); g_hEventThread = CreateEvent(NULL, TRUE, FALSE, g_ptszEventName); hThreadMFUpdate = mir_forkthread(MF_UpdateThread, NULL); SetThreadPriority(hThreadMFUpdate, THREAD_PRIORITY_IDLE); diff --git a/plugins/Clist_nicer/src/cluiopts.cpp b/plugins/Clist_nicer/src/cluiopts.cpp index fe8f5e380f..f3cdc54267 100644 --- a/plugins/Clist_nicer/src/cluiopts.cpp +++ b/plugins/Clist_nicer/src/cluiopts.cpp @@ -84,7 +84,7 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l Utils::enableDlgControl(hwndDlg, IDC_AUTOSIZEUPWARD, FALSE);
}
{
- ptrT tszTitle(db_get_tsa(NULL, "CList", "TitleText"));
+ ptrW tszTitle(db_get_tsa(NULL, "CList", "TitleText"));
if (tszTitle != NULL)
SetDlgItemText(hwndDlg, IDC_TITLETEXT, tszTitle);
else
diff --git a/plugins/Clist_nicer/src/cluiservices.cpp b/plugins/Clist_nicer/src/cluiservices.cpp index 826fcdfcab..e4116b900a 100644 --- a/plugins/Clist_nicer/src/cluiservices.cpp +++ b/plugins/Clist_nicer/src/cluiservices.cpp @@ -131,16 +131,16 @@ void CluiProtocolStatusChanged(int, const char*) if (showOpts & 1)
x += 16;
if (showOpts & 2) {
- mir_tstrncpy(szName, pa->tszAccountName, _countof(szName));
+ mir_wstrncpy(szName, pa->tszAccountName, _countof(szName));
szName[_countof(szName) - 1] = 0;
- if ((showOpts & 4) && mir_tstrlen(szName) < sizeof(szName) - 1)
- mir_tstrcat(szName, L" ");
- GetTextExtentPoint32(hdc, szName, (int)mir_tstrlen(szName), &textSize);
+ if ((showOpts & 4) && mir_wstrlen(szName) < sizeof(szName) - 1)
+ mir_wstrcat(szName, L" ");
+ GetTextExtentPoint32(hdc, szName, (int)mir_wstrlen(szName), &textSize);
x += textSize.cx + GetSystemMetrics(SM_CXBORDER) * 4; // The SB panel doesnt allocate enough room
}
if (showOpts & 4) {
wchar_t* modeDescr = pcli->pfnGetStatusModeDescription(CallProtoService(accs[i]->szModuleName, PS_GETSTATUS, 0, 0), 0);
- GetTextExtentPoint32(hdc, modeDescr, (int)mir_tstrlen(modeDescr), &textSize);
+ GetTextExtentPoint32(hdc, modeDescr, (int)mir_wstrlen(modeDescr), &textSize);
x += textSize.cx + GetSystemMetrics(SM_CXBORDER) * 4; // The SB panel doesnt allocate enough room
}
partWidths[partCount] = (partCount ? partWidths[partCount - 1] : cfg::dat.bCLeft) + x + 2;
diff --git a/plugins/Clist_nicer/src/config.cpp b/plugins/Clist_nicer/src/config.cpp index 663e4dadef..b42c4a24ab 100644 --- a/plugins/Clist_nicer/src/config.cpp +++ b/plugins/Clist_nicer/src/config.cpp @@ -202,7 +202,7 @@ int API::Ex_ShowDialog(EXCEPTION_POINTERS *ep, const char *szFile, int line, wch memcpy(&exCtx, ep->ContextRecord, sizeof(CONTEXT));
mir_snprintf(exSzFile, "%s%s", szName, szExt);
- mir_sntprintf(exReason, L"An application error has occured: %s", szReason);
+ mir_snwprintf(exReason, L"An application error has occured: %s", szReason);
exLine = line;
exLastResult = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_EXCEPTION), 0, Ex_DlgProc, 0);
exAllowContinue = fAllowContinue;
@@ -240,10 +240,10 @@ HMODULE Utils::loadSystemLibrary(const wchar_t* szFilename, bool useGetHandle) throw(CRTException("Error while loading system library", szFilename));
sysPathName[MAX_PATH - 1] = 0;
- if (mir_tstrlen(sysPathName) + mir_tstrlen(szFilename) >= MAX_PATH)
+ if (mir_wstrlen(sysPathName) + mir_wstrlen(szFilename) >= MAX_PATH)
throw(CRTException("Error while loading system library", szFilename));
- mir_tstrcat(sysPathName, szFilename);
+ mir_wstrcat(sysPathName, szFilename);
if (useGetHandle)
_h = ::GetModuleHandle(sysPathName);
else
@@ -260,15 +260,15 @@ HMODULE Utils::loadSystemLibrary(const wchar_t* szFilename, bool useGetHandle) CRTException::CRTException(const char *szMsg, const wchar_t *szParam) : std::runtime_error(std::string(szMsg))
{
- mir_sntprintf(m_szParam, MAX_PATH, szParam);
+ mir_snwprintf(m_szParam, MAX_PATH, szParam);
}
void CRTException::display() const
{
- wchar_t *tszMsg = mir_a2t(what());
+ wchar_t *tszMsg = mir_a2u(what());
wchar_t tszBoxMsg[500];
- mir_sntprintf(tszBoxMsg, L"%s\n\n(%s)", tszMsg, m_szParam);
+ mir_snwprintf(tszBoxMsg, L"%s\n\n(%s)", tszMsg, m_szParam);
::MessageBox(0, tszBoxMsg, L"Clist_nicer runtime error", MB_OK | MB_ICONERROR);
mir_free(tszMsg);
}
diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp index 5ed6ee4347..f25aa3dc81 100644 --- a/plugins/Clist_nicer/src/extBackg.cpp +++ b/plugins/Clist_nicer/src/extBackg.cpp @@ -1543,7 +1543,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L DBVARIANT dbv = { 0 };
if (!db_get_ts(NULL, "CLC", "AdvancedSkin", &dbv)) {
- if (mir_tstrcmp(dbv.ptszVal, final_path))
+ if (mir_wstrcmp(dbv.ptszVal, final_path))
skinChanged = TRUE;
db_free(&dbv);
}
diff --git a/plugins/Clist_nicer/src/statusbar.cpp b/plugins/Clist_nicer/src/statusbar.cpp index 6484ccba6a..0bdf030fb0 100644 --- a/plugins/Clist_nicer/src/statusbar.cpp +++ b/plugins/Clist_nicer/src/statusbar.cpp @@ -160,7 +160,7 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM BYTE isLocked = db_get_b(NULL, PD->RealName, "LockMainStatus", 0);
wchar_t szTipText[256];
- mir_sntprintf(szTipText, L"<b>%s</b>: %s%s",
+ mir_snwprintf(szTipText, L"<b>%s</b>: %s%s",
PD->RealName, pcli->pfnGetStatusModeDescription(wStatus, 0), isLocked ? L" (LOCKED)" : L"");
CLCINFOTIP ti = { sizeof(ti) };
diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp index 772f2e0fa0..8a0e588ce9 100644 --- a/plugins/Clist_nicer/src/viewmodes.cpp +++ b/plugins/Clist_nicer/src/viewmodes.cpp @@ -434,7 +434,7 @@ void UpdateFilters() mir_strncpy(sttModeName, szBuf, sizeof(sttModeName));
{
wchar_t szTemp[100];
- mir_sntprintf(szTemp, TranslateT("Current view mode: %S"), sttModeName);
+ mir_snwprintf(szTemp, TranslateT("Current view mode: %S"), sttModeName);
SetDlgItemText(sttClvmHwnd, IDC_CURVIEWMODE2, szTemp);
}
@@ -493,7 +493,7 @@ void UpdateFilters() for (int i = 1; i < ListView_GetItemCount(hwndList); i++) {
item.iItem = i;
SendMessage(hwndList, LVM_GETITEM, 0, (LPARAM)&item);
- mir_sntprintf(szMask, L"%s|", szTemp);
+ mir_snwprintf(szMask, L"%s|", szTemp);
if (dbv_gf.ptszVal && wcsstr(dbv_gf.ptszVal, szMask)) {
ListView_SetCheckState(hwndList, i, TRUE);
}
@@ -1042,8 +1042,8 @@ void ApplyViewMode(const char *name) }
mir_snprintf(szSetting, "%c%s_GF", 246, name);
- ptrT tszGroups(db_get_tsa(NULL, CLVM_MODULE, szSetting));
- if (mir_tstrlen(tszGroups) >= 2) {
+ ptrW tszGroups(db_get_tsa(NULL, CLVM_MODULE, szSetting));
+ if (mir_wstrlen(tszGroups) >= 2) {
wcsncpy_s(cfg::dat.groupFilter, tszGroups, _TRUNCATE);
cfg::dat.bFilterEffective |= CLVM_FILTER_GROUPS;
}
diff --git a/plugins/CmdLine/src/utils.cpp b/plugins/CmdLine/src/utils.cpp index 69d3d93578..066dc41aa0 100644 --- a/plugins/CmdLine/src/utils.cpp +++ b/plugins/CmdLine/src/utils.cpp @@ -152,7 +152,7 @@ int GetStringFromDatabase(char *szSettingName, WCHAR *szError, WCHAR *szResult, #pragma warning (disable: 4312)
char* GetContactName(MCONTACT hContact, char *szProto)
{
- ptrT name(Contact_GetInfo(CNF_DISPLAY, hContact, szProto));
+ ptrW name(Contact_GetInfo(CNF_DISPLAY, hContact, szProto));
return (name == NULL) ? NULL : strdup(_T2A(name));
}
#pragma warning (default: 4312)
@@ -175,7 +175,7 @@ char* GetContactID(MCONTACT hContact) char* GetContactID(MCONTACT hContact, char *szProto)
{
- ptrT name(Contact_GetInfo(CNF_UNIQUEID, hContact, szProto));
+ ptrW name(Contact_GetInfo(CNF_UNIQUEID, hContact, szProto));
return (name == NULL) ? NULL : strdup(_T2A(name));
}
#pragma warning (default: 4312)
diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.cpp b/plugins/ConnectionNotify/src/ConnectionNotify.cpp index 51371d27fc..e62f6c83b9 100644 --- a/plugins/ConnectionNotify/src/ConnectionNotify.cpp +++ b/plugins/ConnectionNotify/src/ConnectionNotify.cpp @@ -76,11 +76,11 @@ BOOL strrep(wchar_t *src, wchar_t *needle, wchar_t *newstring) wcsncpy_s(begining, src, pos);
begining[pos] = 0;
- pos = pos + mir_tstrlen(needle);
+ pos = pos + mir_wstrlen(needle);
wcsncpy_s(tail, src + pos, _TRUNCATE);
begining[pos] = 0;
- pos = mir_sntprintf(src, mir_tstrlen(src), L"%s%s%s", begining, newstring, tail);
+ pos = mir_snwprintf(src, mir_wstrlen(src), L"%s%s%s", begining, newstring, tail);
return TRUE;
}
@@ -194,16 +194,16 @@ void fillExceptionsListView(HWND hwndDlg) ListView_InsertItem(hwndList, &lvI);
lvI.iSubItem = 1;
if (tmp->intIntPort == -1)
- mir_sntprintf(tmpAddress, L"%s:*", tmp->strIntIp);
+ mir_snwprintf(tmpAddress, L"%s:*", tmp->strIntIp);
else
- mir_sntprintf(tmpAddress, L"%s:%d", tmp->strIntIp, tmp->intIntPort);
+ mir_snwprintf(tmpAddress, L"%s:%d", tmp->strIntIp, tmp->intIntPort);
lvI.pszText = tmpAddress;
ListView_SetItem(hwndList, &lvI);
lvI.iSubItem = 2;
if (tmp->intExtPort == -1)
- mir_sntprintf(tmpAddress, L"%s:*", tmp->strExtIp);
+ mir_snwprintf(tmpAddress, L"%s:*", tmp->strExtIp);
else
- mir_sntprintf(tmpAddress, L"%s:%d", tmp->strExtIp, tmp->intExtPort);
+ mir_snwprintf(tmpAddress, L"%s:%d", tmp->strExtIp, tmp->intExtPort);
lvI.pszText = tmpAddress;
ListView_SetItem(hwndList, &lvI);
lvI.iSubItem = 3;
@@ -298,9 +298,9 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar bOptionsOpen = TRUE;
TranslateDialogDefault(hwndDlg);//translate miranda function
#ifdef _WIN64
- mir_sntprintf(buff, L"%d.%d.%d.%d/64", HIBYTE(HIWORD(pluginInfo.version)), LOBYTE(HIWORD(pluginInfo.version)), HIBYTE(LOWORD(pluginInfo.version)), LOBYTE(LOWORD(pluginInfo.version)));
+ mir_snwprintf(buff, L"%d.%d.%d.%d/64", HIBYTE(HIWORD(pluginInfo.version)), LOBYTE(HIWORD(pluginInfo.version)), HIBYTE(LOWORD(pluginInfo.version)), LOBYTE(LOWORD(pluginInfo.version)));
#else
- mir_sntprintf(buff, L"%d.%d.%d.%d/32", HIBYTE(HIWORD(pluginInfo.version)), LOBYTE(HIWORD(pluginInfo.version)), HIBYTE(LOWORD(pluginInfo.version)), LOBYTE(LOWORD(pluginInfo.version)));
+ mir_snwprintf(buff, L"%d.%d.%d.%d/32", HIBYTE(HIWORD(pluginInfo.version)), LOBYTE(HIWORD(pluginInfo.version)), HIBYTE(LOWORD(pluginInfo.version)), LOBYTE(LOWORD(pluginInfo.version)));
#endif
SetDlgItemText(hwndDlg, IDC_VERSION, buff);
LoadSettings();
@@ -699,7 +699,7 @@ static unsigned __stdcall checkthread(void *) #ifdef _DEBUG
wchar_t msg[1024];
- mir_sntprintf(msg, L"%s:%d\n%s:%d", cur->strIntIp, cur->intIntPort, cur->strExtIp, cur->intExtPort);
+ mir_snwprintf(msg, L"%s:%d\n%s:%d", cur->strIntIp, cur->intIntPort, cur->strExtIp, cur->intExtPort);
_OutputDebugString(L"New connection: %s", msg);
#endif
pid2name(cur->Pid, cur->PName, _countof(cur->PName));
@@ -769,7 +769,7 @@ void showMsg(wchar_t *pName, DWORD pid, wchar_t *intIp, wchar_t *extIp, int intP //99% of the times you'll just copy this line.
//1% of the times you may wish to change the contact's name. I don't know why you should, but you can.
//char * lpzText;
- //The text for the second line. You could even make something like: char lpzText[128]; mir_tstrcpy(lpzText, "Hello world!"); It's your choice.
+ //The text for the second line. You could even make something like: char lpzText[128]; mir_wstrcpy(lpzText, "Hello world!"); It's your choice.
struct CONNECTION *mpd = (struct CONNECTION*)mir_alloc(sizeof(struct CONNECTION));
//MessageBox(NULL,"aaa","aaa",1);
@@ -779,11 +779,11 @@ void showMsg(wchar_t *pName, DWORD pid, wchar_t *intIp, wchar_t *extIp, int intP if (settingResolveIp) {
wchar_t hostName[128];
getDnsName(extIp, hostName, _countof(hostName));
- mir_sntprintf(ppd.lptzText, L"%s:%d\n%s:%d", hostName, extPort, intIp, intPort);
+ mir_snwprintf(ppd.lptzText, L"%s:%d\n%s:%d", hostName, extPort, intIp, intPort);
}
- else mir_sntprintf(ppd.lptzText, L"%s:%d\n%s:%d", extIp, extPort, intIp, intPort);
+ else mir_snwprintf(ppd.lptzText, L"%s:%d\n%s:%d", extIp, extPort, intIp, intPort);
- mir_sntprintf(ppd.lptzContactName, L"%s (%s)", pName, tcpStates[state - 1]);
+ mir_snwprintf(ppd.lptzContactName, L"%s (%s)", pName, tcpStates[state - 1]);
if (settingSetColours) {
ppd.colorBack = settingBgColor;
diff --git a/plugins/ConnectionNotify/src/filter.cpp b/plugins/ConnectionNotify/src/filter.cpp index f0c40dfed8..db9b205e0f 100644 --- a/plugins/ConnectionNotify/src/filter.cpp +++ b/plugins/ConnectionNotify/src/filter.cpp @@ -133,7 +133,7 @@ static INT_PTR CALLBACK ConnectionFilterEditProc(HWND hWnd, UINT message, WPARAM BOOL checkFilter(struct CONNECTION *head, struct CONNECTION *conn)
{
for (struct CONNECTION *cur = head; cur != NULL; cur = cur->next)
- if (wildcmpt(conn->PName, cur->PName) && wildcmpt(conn->strIntIp, cur->strIntIp) && wildcmpt(conn->strExtIp, cur->strExtIp)
+ if (wildcmpw(conn->PName, cur->PName) && wildcmpw(conn->strIntIp, cur->strIntIp) && wildcmpw(conn->strExtIp, cur->strExtIp)
&& (cur->intIntPort == -1 || cur->intIntPort == conn->intIntPort) && (cur->intExtPort == -1 || cur->intExtPort == conn->intExtPort))
return cur->Pid;
diff --git a/plugins/ConnectionNotify/src/netstat.cpp b/plugins/ConnectionNotify/src/netstat.cpp index a9827bf7f4..663e22a16e 100644 --- a/plugins/ConnectionNotify/src/netstat.cpp +++ b/plugins/ConnectionNotify/src/netstat.cpp @@ -41,14 +41,14 @@ struct CONNECTION *GetConnectionsTable() if (pTcpTable->table[i].dwLocalAddr) { IpAddr.S_un.S_addr = (ULONG)pTcpTable->table[i].dwLocalAddr; //_snprintf(newConn->strIntIp,_countof(newConn->strIntIp),"%d.%d.%d.%d",IpAddr.S_un.S_un_b.s_b1,IpAddr.S_un.S_un_b.s_b2,IpAddr.S_un.S_un_b.s_b3,IpAddr.S_un.S_un_b.s_b4); - wchar_t *strIntIp = mir_a2t(inet_ntoa(IpAddr)); + wchar_t *strIntIp = mir_a2u(inet_ntoa(IpAddr)); wcsncpy(newConn->strIntIp, strIntIp, _countof(newConn->strIntIp) - 1); mir_free(strIntIp); } if (pTcpTable->table[i].dwRemoteAddr) { IpAddr.S_un.S_addr = (u_long)pTcpTable->table[i].dwRemoteAddr; - wchar_t *strExtIp = mir_a2t(inet_ntoa(IpAddr)); + wchar_t *strExtIp = mir_a2u(inet_ntoa(IpAddr)); wcsncpy(newConn->strExtIp, strExtIp, _countof(newConn->strExtIp) - 1); mir_free(strExtIp); } @@ -126,8 +126,8 @@ void deleteConnectionsTable(struct CONNECTION *head) struct CONNECTION *searchConnection(struct CONNECTION *head, wchar_t *intIp, wchar_t *extIp, int intPort, int extPort, int state) { for (struct CONNECTION *cur = head; cur != NULL; cur = cur->next) { - if (mir_tstrcmp(cur->strIntIp, intIp) == 0 && - mir_tstrcmp(cur->strExtIp, extIp) == 0 && + if (mir_wstrcmp(cur->strIntIp, intIp) == 0 && + mir_wstrcmp(cur->strExtIp, extIp) == 0 && cur->intExtPort == extPort && cur->intIntPort == intPort && cur->state == state) @@ -140,7 +140,7 @@ void getDnsName(wchar_t *strIp, wchar_t *strHostName, size_t len) { in_addr iaHost; - char *szStrIP = mir_t2a(strIp); + char *szStrIP = mir_u2a(strIp); iaHost.s_addr = inet_addr(szStrIP); mir_free(szStrIP); hostent *h = gethostbyaddr((char *)&iaHost, sizeof(struct in_addr), AF_INET); diff --git a/plugins/Console/src/Console.cpp b/plugins/Console/src/Console.cpp index 5c3d44da55..856a2752c7 100644 --- a/plugins/Console/src/Console.cpp +++ b/plugins/Console/src/Console.cpp @@ -404,7 +404,7 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LP while (str != NULL) {
lvi.pszText = &str[0];
- tmplen = len = (DWORD)mir_tstrlen(lvi.pszText);
+ tmplen = len = (DWORD)mir_wstrlen(lvi.pszText);
while (len > wraplen) {
szBreak = lvi.pszText[wraplen];
@@ -505,7 +505,7 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LP HGLOBAL hClipboardData = GlobalAlloc(GMEM_DDESHARE, (dst - buf + 1) * sizeof(wchar_t));
if (hClipboardData) {
wchar_t *pchData = (wchar_t *)GlobalLock(hClipboardData);
- mir_tstrcpy(pchData, buf);
+ mir_wstrcpy(pchData, buf);
GlobalUnlock(hClipboardData);
SetClipboardData(CF_UNICODETEXT, hClipboardData);
}
@@ -621,7 +621,7 @@ static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg, UINT message, WPARAM wParam CallService(MS_DB_GETPROFILEPATHT, (WPARAM)_countof(path), (LPARAM)path);
- mir_sntprintf(title, L"%s - %s\\%s", TranslateT("Miranda Console"), path, name);
+ mir_snwprintf(title, L"%s - %s\\%s", TranslateT("Miranda Console"), path, name);
SetWindowText(hwndDlg, title);
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcons[0]);
@@ -1096,8 +1096,8 @@ static int OnFontChange(WPARAM, LPARAM) FontIDT fid = { 0 };
fid.cbSize = sizeof(fid);
- mir_tstrncpy(fid.group, LPGENW("Console"), _countof(fid.group));
- mir_tstrncpy(fid.name, LPGENW("Text"), _countof(fid.name));
+ mir_wstrncpy(fid.group, LPGENW("Console"), _countof(fid.group));
+ mir_wstrncpy(fid.name, LPGENW("Text"), _countof(fid.name));
colLogFont = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&LogFont);
@@ -1120,26 +1120,26 @@ static int OnSystemModulesLoaded(WPARAM, LPARAM) FontIDT fid = { 0 };
fid.cbSize = sizeof(fid);
- mir_tstrncpy(fid.group, LPGENW("Console"), _countof(fid.group));
- mir_tstrncpy(fid.name, LPGENW("Text"), _countof(fid.name));
+ mir_wstrncpy(fid.group, LPGENW("Console"), _countof(fid.group));
+ mir_wstrncpy(fid.name, LPGENW("Text"), _countof(fid.name));
mir_strncpy(fid.dbSettingsGroup, "Console", _countof(fid.dbSettingsGroup));
mir_strncpy(fid.prefix, "ConsoleFont", _countof(fid.prefix));
- mir_tstrncpy(fid.backgroundGroup, LPGENW("Console"), _countof(fid.backgroundGroup));
- mir_tstrncpy(fid.backgroundName, LPGENW("Background"), _countof(fid.backgroundName));
+ mir_wstrncpy(fid.backgroundGroup, LPGENW("Console"), _countof(fid.backgroundGroup));
+ mir_wstrncpy(fid.backgroundName, LPGENW("Background"), _countof(fid.backgroundName));
fid.flags = FIDF_DEFAULTVALID;
fid.deffontsettings.charset = DEFAULT_CHARSET;
fid.deffontsettings.colour = RGB(0, 0, 0);
fid.deffontsettings.size = 10;
fid.deffontsettings.style = 0;
- mir_tstrncpy(fid.deffontsettings.szFace, L"Courier", _countof(fid.deffontsettings.szFace));
+ mir_wstrncpy(fid.deffontsettings.szFace, L"Courier", _countof(fid.deffontsettings.szFace));
FontRegisterT(&fid);
HookEvent(ME_FONT_RELOAD, OnFontChange);
ColourIDT cid = { 0 };
cid.cbSize = sizeof(cid);
- mir_tstrncpy(cid.group, LPGENW("Console"), _countof(cid.group));
- mir_tstrncpy(cid.name, LPGENW("Background"), _countof(cid.name));
+ mir_wstrncpy(cid.group, LPGENW("Console"), _countof(cid.group));
+ mir_wstrncpy(cid.name, LPGENW("Background"), _countof(cid.name));
mir_strncpy(cid.dbSettingsGroup, "Console", _countof(cid.dbSettingsGroup));
mir_strncpy(cid.setting, "BgColor", _countof(cid.setting));
cid.defcolour = RGB(255, 255, 255);
@@ -1259,8 +1259,8 @@ void ShutdownConsole(void) ////////////////////////////////////////////////////////////////////////////////
wchar_t *addstring(wchar_t *str, wchar_t *add) {
- mir_tstrcpy(str, add);
- return str + mir_tstrlen(add) + 1;
+ mir_wstrcpy(str, add);
+ return str + mir_wstrlen(add) + 1;
}
@@ -1272,7 +1272,7 @@ static int Openfile(wchar_t *outputFile, int selection) wchar_t *filter, *tmp, *tmp1, *tmp2;
tmp1 = TranslateT("Text Files (*.txt)");
tmp2 = TranslateT("All Files");
- filter = tmp = (wchar_t*)_alloca((mir_tstrlen(tmp1) + mir_tstrlen(tmp2) + 11)*sizeof(wchar_t));
+ filter = tmp = (wchar_t*)_alloca((mir_wstrlen(tmp1) + mir_wstrlen(tmp2) + 11)*sizeof(wchar_t));
tmp = addstring(tmp, tmp1);
tmp = addstring(tmp, L"*.TXT");
tmp = addstring(tmp, tmp2);
@@ -1296,7 +1296,7 @@ static int Openfile(wchar_t *outputFile, int selection) if (!GetSaveFileName(&ofn))
return 0;
- mir_tstrcpy(outputFile, filename);
+ mir_wstrcpy(outputFile, filename);
return 1;
}
diff --git a/plugins/ContactsPlus/src/main.cpp b/plugins/ContactsPlus/src/main.cpp index 8852ad0eea..2117b37bb1 100644 --- a/plugins/ContactsPlus/src/main.cpp +++ b/plugins/ContactsPlus/src/main.cpp @@ -74,7 +74,7 @@ static int HookDBEventAdded(WPARAM hContact, LPARAM hDbEvent) {
//add event to the contact list
wchar_t caToolTip[128];
- mir_sntprintf(caToolTip, L"%s %s", TranslateT("Contacts received from"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_snwprintf(caToolTip, L"%s %s", TranslateT("Contacts received from"), pcli->pfnGetContactDisplayName(hContact, 0));
CLISTEVENT cle = {};
cle.hContact = hContact;
diff --git a/plugins/ContactsPlus/src/receive.cpp b/plugins/ContactsPlus/src/receive.cpp index 0373609632..fe354361d6 100644 --- a/plugins/ContactsPlus/src/receive.cpp +++ b/plugins/ContactsPlus/src/receive.cpp @@ -141,9 +141,9 @@ static MCONTACT CreateTemporaryContactForItem(HWND hwndDlg, TRecvContactsData *w wchar_t *caUIN = ListView_GetItemTextEx(GetDlgItem(hwndDlg, IDC_CONTACTS), iItem, 0);
char *szProto = GetContactProto(wndData->mhContact);
wndData->rhSearch = (HANDLE)CallProtoService(szProto, PS_BASICSEARCH, 0, (LPARAM)caUIN); // find it
- replaceStrT(wndData->haUin, caUIN);
+ replaceStrW(wndData->haUin, caUIN);
for (int j = 0; j < wndData->cbReceived; j++)
- if (!mir_tstrcmp(wndData->maReceived[j]->mcaUIN, caUIN))
+ if (!mir_wstrcmp(wndData->maReceived[j]->mcaUIN, caUIN))
return (MCONTACT)CallProtoService(szProto, PS_ADDTOLISTBYEVENT, MAKEWPARAM(PALF_TEMPORARY, j), (LPARAM)wndData->mhDbEvent);
return NULL;
}
@@ -220,13 +220,13 @@ INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara TReceivedItem* pItem = wndData->AddReceivedItem();
if (dbe.flags & DBEF_UTF)
- pItem->mcaNick = mir_utf8decodeT(pcBlob);
+ pItem->mcaNick = mir_utf8decodeW(pcBlob);
else
- pItem->mcaNick = mir_a2t(pcBlob);
+ pItem->mcaNick = mir_a2u(pcBlob);
pcBlob += strsize + 1;
// UIN
strsize = (int)strlennull(pcBlob);
- pItem->mcaUIN = mir_a2t(pcBlob);
+ pItem->mcaUIN = mir_a2u(pcBlob);
pcBlob += strsize + 1;
// add to listview
lvi.iItem = nItem;
@@ -315,7 +315,7 @@ INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara // found checked contact item, add it
wchar_t *caUIN = ListView_GetItemTextEx(hLV, i, 0);
for (int j = 0; j < wndData->cbReceived; j++) // determine item index in packet
- if (!mir_tstrcmp(wndData->maReceived[j]->mcaUIN, caUIN)) {
+ if (!mir_wstrcmp(wndData->maReceived[j]->mcaUIN, caUIN)) {
char *szProto =GetContactProto(wndData->mhContact);
hContact = (MCONTACT)CallProtoService(szProto, PS_ADDTOLISTBYEVENT, MAKEWPARAM(0, j), (LPARAM)wndData->mhDbEvent);
if (hContact && caGroup) {
@@ -437,7 +437,7 @@ INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara fi.psz = wndData->haUin;
int iLPos = ListView_FindItem(hLV, -1, &fi);
if (iLPos == -1) iLPos = 0;
- if (mir_tstrcmp(psr->nick.w, L"") && psr->nick.w)
+ if (mir_wstrcmp(psr->nick.w, L"") && psr->nick.w)
ListView_SetItemText(hLV, iLPos, 1, psr->nick.w);
ListView_SetItemText(hLV, iLPos, 2, psr->firstName.w);
ListView_SetItemText(hLV, iLPos, 3, psr->lastName.w);
diff --git a/plugins/ContactsPlus/src/send.cpp b/plugins/ContactsPlus/src/send.cpp index 7674ed4d57..5031b03ac9 100644 --- a/plugins/ContactsPlus/src/send.cpp +++ b/plugins/ContactsPlus/src/send.cpp @@ -411,8 +411,8 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara int i;
for (i = 0; i < ackData->nContacts; i++) {
// prepare data & count size
- maSend[i].mcaNick = mir_utf8encodeT(pcli->pfnGetContactDisplayName(ackData->aContacts[i], 0));
- maSend[i].mcaUIN = mir_utf8encodeT(ptrT(GetContactUID(ackData->aContacts[i])));
+ maSend[i].mcaNick = mir_utf8encodeW(pcli->pfnGetContactDisplayName(ackData->aContacts[i], 0));
+ maSend[i].mcaUIN = mir_utf8encodeW(ptrW(GetContactUID(ackData->aContacts[i])));
dbei.cbBlob += (DWORD)strlennull(maSend[i].mcaUIN) + (DWORD)strlennull((char*)maSend[i].mcaNick) + 2;
}
dbei.pBlob = (PBYTE)_alloca(dbei.cbBlob);
diff --git a/plugins/ContactsPlus/src/utils.cpp b/plugins/ContactsPlus/src/utils.cpp index f16a559fe2..0cb84a1642 100644 --- a/plugins/ContactsPlus/src/utils.cpp +++ b/plugins/ContactsPlus/src/utils.cpp @@ -69,17 +69,17 @@ wchar_t* GetContactUID(MCONTACT hContact) if (vrUid.type == DBVT_DWORD) {
wchar_t tmp[100];
_itow(vrUid.dVal, tmp, 10);
- return mir_tstrdup(tmp);
+ return mir_wstrdup(tmp);
}
if (vrUid.type == DBVT_ASCIIZ) {
- wchar_t *res = mir_a2t(vrUid.pszVal);
+ wchar_t *res = mir_a2u(vrUid.pszVal);
mir_free(vrUid.pszVal);
return res;
}
if (vrUid.type == DBVT_UTF8) {
- wchar_t *res = mir_utf8decodeT(vrUid.pszVal);
+ wchar_t *res = mir_utf8decodeW(vrUid.pszVal);
mir_free(vrUid.pszVal);
return res;
}
@@ -115,22 +115,22 @@ void DrawProtocolIcon(HWND hwndDlg, LPARAM lParam, MCONTACT hContact) void UpdateDialogTitle(HWND hwndDlg, MCONTACT hContact, wchar_t *pszTitleStart)
{
wchar_t newtitle[512];
- mir_tstrncpy(newtitle, TranslateTS(pszTitleStart), _countof(newtitle));
+ mir_wstrncpy(newtitle, TranslateTS(pszTitleStart), _countof(newtitle));
if (hContact) {
char *szProto = GetContactProto(hContact);
if (szProto) {
- ptrT uid(GetContactUID(hContact));
+ ptrW uid(GetContactUID(hContact));
wchar_t *contactName = pcli->pfnGetContactDisplayName(hContact, 0);
wchar_t oldTitle[MAX_PATH];
GetDlgItemText(hwndDlg, IDC_NAME, oldTitle, _countof(oldTitle));
- if (mir_tstrcmp(uid ? uid : contactName, oldTitle))
+ if (mir_wstrcmp(uid ? uid : contactName, oldTitle))
SetDlgItemText(hwndDlg, IDC_NAME, uid ? uid : contactName);
wchar_t *szStatus = pcli->pfnGetStatusModeDescription(db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
- mir_sntprintf(newtitle, L"%s %s (%s)", TranslateTS(pszTitleStart), contactName, szStatus);
+ mir_snwprintf(newtitle, L"%s %s (%s)", TranslateTS(pszTitleStart), contactName, szStatus);
}
}
diff --git a/plugins/CountryFlags/src/ip2country.cpp b/plugins/CountryFlags/src/ip2country.cpp index 261f91aaa2..b3411d8ec9 100644 --- a/plugins/CountryFlags/src/ip2country.cpp +++ b/plugins/CountryFlags/src/ip2country.cpp @@ -207,27 +207,27 @@ static int EnumIpDataLines(const char *pszFileCSV,const char *pszFileOut) buf=strchr(pszCountry,'"');
*buf=pszTwo[2]='\0';
/* corrections */
- if (!mir_tstrcmpi(pszCountry,"ANTARCTICA")) continue;
- if (!mir_tstrcmpi(pszCountry,"TIMOR-LESTE")) continue;
- if (!mir_tstrcmpi(pszCountry,"PALESTINIAN TERRITORY, OCCUPIED"))
- mir_tstrcpy(pszCountry,"ISRAEL");
- else if (!mir_tstrcmpi(pszCountry,"UNITED STATES MINOR OUTLYING ISLANDS"))
- mir_tstrcpy(pszCountry,"UNITED STATES");
- else if (!mir_tstrcmpi(pszCountry,"SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS"))
- mir_tstrcpy(pszCountry,"UNITED KINGDOM");
- else if (!mir_tstrcmpi(pszTwo,"JE")) /* map error */
- mir_tstrcpy(pszCountry,"UNITED KINGDOM");
- else if (!mir_tstrcmpi(pszTwo,"AX")) /* Åland Island belongs to Finland */
- mir_tstrcpy(pszCountry,"FINLAND");
- else if (!mir_tstrcmpi(pszTwo,"ME"))
- mir_tstrcpy(pszCountry,"MONTENEGRO");
- else if (!mir_tstrcmpi(pszTwo,"RS") || !mir_tstrcmpi(pszTwo,"CS"))
- mir_tstrcpy(pszCountry,"SERBIA");
+ if (!mir_wstrcmpi(pszCountry,"ANTARCTICA")) continue;
+ if (!mir_wstrcmpi(pszCountry,"TIMOR-LESTE")) continue;
+ if (!mir_wstrcmpi(pszCountry,"PALESTINIAN TERRITORY, OCCUPIED"))
+ mir_wstrcpy(pszCountry,"ISRAEL");
+ else if (!mir_wstrcmpi(pszCountry,"UNITED STATES MINOR OUTLYING ISLANDS"))
+ mir_wstrcpy(pszCountry,"UNITED STATES");
+ else if (!mir_wstrcmpi(pszCountry,"SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS"))
+ mir_wstrcpy(pszCountry,"UNITED KINGDOM");
+ else if (!mir_wstrcmpi(pszTwo,"JE")) /* map error */
+ mir_wstrcpy(pszCountry,"UNITED KINGDOM");
+ else if (!mir_wstrcmpi(pszTwo,"AX")) /* Åland Island belongs to Finland */
+ mir_wstrcpy(pszCountry,"FINLAND");
+ else if (!mir_wstrcmpi(pszTwo,"ME"))
+ mir_wstrcpy(pszCountry,"MONTENEGRO");
+ else if (!mir_wstrcmpi(pszTwo,"RS") || !mir_wstrcmpi(pszTwo,"CS"))
+ mir_wstrcpy(pszCountry,"SERBIA");
/* convert */
for(i=0;i<nCountriesCount;i++) {
/* map different writings */
for(j=0;j<_countof(differentCountryNames);j++)
- if (!mir_tstrcmpi(countries[i].szName,differentCountryNames[j].szMir)) {
+ if (!mir_wstrcmpi(countries[i].szName,differentCountryNames[j].szMir)) {
buf=(char*)differentCountryNames[j].szCSV;
break;
}
diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp index 5c96a12456..eec8817037 100644 --- a/plugins/CrashDumper/src/crshdmp.cpp +++ b/plugins/CrashDumper/src/crshdmp.cpp @@ -68,7 +68,7 @@ INT_PTR StoreVersionInfoToFile(WPARAM, LPARAM lParam) CreateDirectoryTreeT(VersionInfoFolder);
wchar_t path[MAX_PATH];
- mir_sntprintf(path, TEXT("%s\\VersionInfo.txt"), VersionInfoFolder);
+ mir_snwprintf(path, TEXT("%s\\VersionInfo.txt"), VersionInfoFolder);
HANDLE hDumpFile = CreateFile(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hDumpFile != INVALID_HANDLE_VALUE) {
@@ -103,7 +103,7 @@ INT_PTR UploadVersionInfo(WPARAM, LPARAM lParam) PrintVersionInfo(buffer);
VerTrnsfr *trn = (VerTrnsfr*)mir_alloc(sizeof(VerTrnsfr));
- trn->buf = mir_utf8encodeT(buffer.c_str());
+ trn->buf = mir_utf8encodeW(buffer.c_str());
trn->autot = lParam == 0xa1;
mir_forkthread(VersionInfoUploadThread, trn);
@@ -133,7 +133,7 @@ INT_PTR GetVersionInfo(WPARAM wParam, LPARAM lParam) CMString buffer;
PrintVersionInfo(buffer, (unsigned int)wParam);
char **retData = (char **)lParam;
- *retData = mir_utf8encodeT(buffer.c_str());
+ *retData = mir_utf8encodeW(buffer.c_str());
if (*retData)
result = 0; //success
}
@@ -156,10 +156,10 @@ INT_PTR OpenUrl(WPARAM wParam, LPARAM) INT_PTR CopyLinkToClipboard(WPARAM, LPARAM)
{
- ptrT tmp(db_get_wsa(NULL, PluginName, "Username"));
+ ptrW tmp(db_get_wsa(NULL, PluginName, "Username"));
if (tmp != NULL) {
wchar_t buffer[MAX_PATH];
- mir_sntprintf(buffer, L"http://vi.miranda-ng.org/detail/%s", tmp);
+ mir_snwprintf(buffer, L"http://vi.miranda-ng.org/detail/%s", tmp);
int bufLen = (sizeof(buffer) + 1) * sizeof(wchar_t);
HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, bufLen);
@@ -245,7 +245,7 @@ static int ModulesLoaded(WPARAM, LPARAM) crs_a2t(vertxt, temp);
if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) {
- replaceStrT(profpath, L"%miranda_userdata%");
+ replaceStrW(profpath, L"%miranda_userdata%");
// Removed because it isn't available on Load()
// hCrashLogFolder = FoldersRegisterCustomPathT(PluginName, LPGEN("Crash Reports"), CrashLogFolder);
@@ -368,7 +368,7 @@ extern "C" int __declspec(dllexport) Load(void) profname = Utils_ReplaceVarsT(L"%miranda_profilename%.dat");
profpath = Utils_ReplaceVarsT(L"%miranda_userdata%");
if (catchcrashes && !needrestart)
- mir_sntprintf(CrashLogFolder, TEXT("%s\\CrashLog"), profpath);
+ mir_snwprintf(CrashLogFolder, TEXT("%s\\CrashLog"), profpath);
wcsncpy_s(VersionInfoFolder, profpath, _TRUNCATE);
diff --git a/plugins/CrashDumper/src/dumper.cpp b/plugins/CrashDumper/src/dumper.cpp index 3fa432aa47..7843451951 100644 --- a/plugins/CrashDumper/src/dumper.cpp +++ b/plugins/CrashDumper/src/dumper.cpp @@ -178,7 +178,7 @@ static void GetPluginsString(CMString& buffer, unsigned& flags) LPTSTR fname = wcsrchr(path, TEXT('\\'));
if (fname == NULL) fname = path;
- mir_sntprintf(fname, MAX_PATH - (fname - path), TEXT("\\plugins\\*.dll"));
+ mir_snwprintf(fname, MAX_PATH - (fname - path), TEXT("\\plugins\\*.dll"));
WIN32_FIND_DATA FindFileData;
HANDLE hFind = FindFirstFile(path, &FindFileData);
@@ -193,7 +193,7 @@ static void GetPluginsString(CMString& buffer, unsigned& flags) do {
bool loaded = false;
- mir_sntprintf(fname, MAX_PATH - (fname - path), TEXT("\\plugins\\%s"), FindFileData.cFileName);
+ mir_snwprintf(fname, MAX_PATH - (fname - path), TEXT("\\plugins\\%s"), FindFileData.cFileName);
HMODULE hModule = GetModuleHandle(path);
if (hModule == NULL && servicemode) {
hModule = LoadLibrary(path);
@@ -264,7 +264,7 @@ static void GetPluginsString(CMString& buffer, unsigned& flags) else
lsttmppv->next = lst;
- if (mir_tstrcmpi(FindFileData.cFileName, TEXT("weather.dll")) == 0)
+ if (mir_wstrcmpi(FindFileData.cFileName, TEXT("weather.dll")) == 0)
flags |= VI_FLAG_WEATHER;
++count;
@@ -357,7 +357,7 @@ static void GetWeatherStrings(CMString& buffer, unsigned flags) LPTSTR fname = wcsrchr(path, TEXT('\\'));
if (fname == NULL) fname = path;
- mir_sntprintf(fname, MAX_PATH - (fname - path), TEXT("\\plugins\\weather\\*.ini"));
+ mir_snwprintf(fname, MAX_PATH - (fname - path), TEXT("\\plugins\\weather\\*.ini"));
WIN32_FIND_DATA FindFileData;
HANDLE hFind = FindFirstFile(path, &FindFileData);
@@ -366,7 +366,7 @@ static void GetWeatherStrings(CMString& buffer, unsigned flags) do {
if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue;
- mir_sntprintf(fname, MAX_PATH - (fname - path), TEXT("\\plugins\\weather\\%s"), FindFileData.cFileName);
+ mir_snwprintf(fname, MAX_PATH - (fname - path), TEXT("\\plugins\\weather\\%s"), FindFileData.cFileName);
HANDLE hDumpFile = CreateFile(path, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
@@ -424,7 +424,7 @@ static void GetIconStrings(CMString& buffer) LPTSTR fname = wcsrchr(path, TEXT('\\'));
if (fname == NULL) fname = path;
- mir_sntprintf(fname, MAX_PATH - (fname - path), TEXT("\\Icons\\*.*"));
+ mir_snwprintf(fname, MAX_PATH - (fname - path), TEXT("\\Icons\\*.*"));
WIN32_FIND_DATA FindFileData;
HANDLE hFind = FindFirstFile(path, &FindFileData);
@@ -480,7 +480,7 @@ void PrintVersionInfo(CMString& buffer, unsigned flags) buffer.AppendFormat(TEXT("Build time: %s\r\n"), mirtime);
wchar_t profpn[MAX_PATH];
- mir_sntprintf(profpn, TEXT("%s\\%s"), profpathfull, profname);
+ mir_snwprintf(profpn, TEXT("%s\\%s"), profpathfull, profname);
DATABASELINK *db = FindDatabasePlugin(profpn);
diff --git a/plugins/CrashDumper/src/exhndlr.cpp b/plugins/CrashDumper/src/exhndlr.cpp index 6fbace54c1..eef812a33a 100644 --- a/plugins/CrashDumper/src/exhndlr.cpp +++ b/plugins/CrashDumper/src/exhndlr.cpp @@ -55,13 +55,13 @@ void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify) __try {
if (dtsubfldr) {
- mir_sntprintf(path, TEXT("%s\\%02d.%02d.%02d"), CrashLogFolder, st.wYear, st.wMonth, st.wDay);
+ mir_snwprintf(path, TEXT("%s\\%02d.%02d.%02d"), CrashLogFolder, st.wYear, st.wMonth, st.wDay);
CreateDirectory(path, NULL);
- mir_sntprintf(path, TEXT("%s\\%02d.%02d.%02d\\crash%02d%02d%02d%02d%02d%02d.mdmp"), CrashLogFolder,
+ mir_snwprintf(path, TEXT("%s\\%02d.%02d.%02d\\crash%02d%02d%02d%02d%02d%02d.mdmp"), CrashLogFolder,
st.wYear, st.wMonth, st.wDay, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
}
else
- mir_sntprintf(path, TEXT("%s\\crash%02d%02d%02d%02d%02d%02d.mdmp"), CrashLogFolder,
+ mir_snwprintf(path, TEXT("%s\\crash%02d%02d%02d%02d%02d%02d.mdmp"), CrashLogFolder,
st.wYear, st.wMonth, st.wDay, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
hDumpFile = CreateFile(path, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
@@ -82,18 +82,18 @@ void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify) __try {
if (dtsubfldr) {
- mir_sntprintf(path, TEXT("%s\\%02d.%02d.%02d"), CrashLogFolder, st.wYear, st.wMonth, st.wDay);
+ mir_snwprintf(path, TEXT("%s\\%02d.%02d.%02d"), CrashLogFolder, st.wYear, st.wMonth, st.wDay);
CreateDirectory(path, NULL);
- mir_sntprintf(path, TEXT("%s\\%02d.%02d.%02d\\crash%02d%02d%02d%02d%02d%02d.txt"), CrashLogFolder,
+ mir_snwprintf(path, TEXT("%s\\%02d.%02d.%02d\\crash%02d%02d%02d%02d%02d%02d.txt"), CrashLogFolder,
st.wYear, st.wMonth, st.wDay, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
}
else
- mir_sntprintf(path, TEXT("%s\\crash%02d%02d%02d%02d%02d%02d.txt"), CrashLogFolder,
+ mir_snwprintf(path, TEXT("%s\\crash%02d%02d%02d%02d%02d%02d.txt"), CrashLogFolder,
st.wYear, st.wMonth, st.wDay, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
hDumpFile = CreateFile(path, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
- mir_sntprintf(path, TranslateT("Miranda crashed. Crash report stored in the folder:\n %s\n\n Would you like store it in the clipboard as well?"), CrashLogFolder);
+ mir_snwprintf(path, TranslateT("Miranda crashed. Crash report stored in the folder:\n %s\n\n Would you like store it in the clipboard as well?"), CrashLogFolder);
if (hDumpFile != INVALID_HANDLE_VALUE)
CreateCrashReport(hDumpFile, exc_ptr, notify ? path : NULL);
diff --git a/plugins/CrashDumper/src/ui.cpp b/plugins/CrashDumper/src/ui.cpp index 14e018aa2f..319740aaa7 100644 --- a/plugins/CrashDumper/src/ui.cpp +++ b/plugins/CrashDumper/src/ui.cpp @@ -69,7 +69,7 @@ INT_PTR CALLBACK DlgProcView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara CHARFORMAT2 chf;
chf.cbSize = sizeof(chf);
SendDlgItemMessage(hwndDlg, IDC_VIEWVERSIONINFO, EM_GETCHARFORMAT, SCF_DEFAULT, (LPARAM)&chf);
- mir_tstrcpy(chf.szFaceName, TEXT("Courier New"));
+ mir_wstrcpy(chf.szFaceName, TEXT("Courier New"));
SendDlgItemMessage(hwndDlg, IDC_VIEWVERSIONINFO, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&chf);
CMString buffer;
@@ -279,7 +279,7 @@ LRESULT CALLBACK DlgProcPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) case 3:
wchar_t path[MAX_PATH];
- mir_sntprintf(path, TEXT("%s\\VersionInfo.txt"), VersionInfoFolder);
+ mir_snwprintf(path, TEXT("%s\\VersionInfo.txt"), VersionInfoFolder);
ShellExecute(NULL, TEXT("open"), path, NULL, NULL, SW_SHOW);
break;
@@ -301,12 +301,12 @@ void ShowMessage(int type, const wchar_t* format, ...) va_list va;
va_start(va, format);
- int len = mir_vsntprintf(pi.lptzText, _countof(pi.lptzText) - 1, format, va);
+ int len = mir_vsnwprintf(pi.lptzText, _countof(pi.lptzText) - 1, format, va);
pi.lptzText[len] = 0;
va_end(va);
if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
- mir_tstrcpy(pi.lptzContactName, TEXT(PluginName));
+ mir_wstrcpy(pi.lptzContactName, TEXT(PluginName));
pi.lchIcon = LoadIconEx(IDI_VI);
pi.PluginWindowProc = DlgProcPopup;
pi.PluginData = (void*)type;
diff --git a/plugins/CrashDumper/src/utils.cpp b/plugins/CrashDumper/src/utils.cpp index 356bf6a8a1..df32598f4a 100644 --- a/plugins/CrashDumper/src/utils.cpp +++ b/plugins/CrashDumper/src/utils.cpp @@ -52,14 +52,14 @@ void GetISO8061Time(SYSTEMTIME *stLocal, LPTSTR lpszString, DWORD dwSize) if (clsdates) {
GetDateFormat(LOCALE_INVARIANT, 0, stLocal, TEXT("d MMM yyyy"), lpszString, dwSize);
- int dlen = (int)mir_tstrlen(lpszString);
+ int dlen = (int)mir_wstrlen(lpszString);
GetTimeFormat(LOCALE_INVARIANT, 0, stLocal, TEXT(" H:mm:ss"), lpszString + dlen, dwSize - dlen);
}
else {
int offset = GetTZOffset();
// Build a string showing the date and time.
- mir_sntprintf(lpszString, dwSize, TEXT("%d-%02d-%02d %02d:%02d:%02d%+03d%02d"),
+ mir_snwprintf(lpszString, dwSize, TEXT("%d-%02d-%02d %02d:%02d:%02d%+03d%02d"),
stLocal->wYear, stLocal->wMonth, stLocal->wDay,
stLocal->wHour, stLocal->wMinute, stLocal->wSecond,
offset / 60, offset % 60);
@@ -129,13 +129,13 @@ void GetInternetExplorerVersion(CMString &buffer) if (ieVersion[0] == 0) {
if (iVer[0] == 0)
buffer.Append(TEXT("<not installed>"));
- else if (mir_tstrcmp(iVer, TEXT("100")) == 0)
+ else if (mir_wstrcmp(iVer, TEXT("100")) == 0)
buffer.Append(TEXT("1.0"));
- else if (mir_tstrcmp(iVer, TEXT("101")) == 0)
+ else if (mir_wstrcmp(iVer, TEXT("101")) == 0)
buffer.Append(TEXT("NT"));
- else if (mir_tstrcmp(iVer, TEXT("102")) == 0)
+ else if (mir_wstrcmp(iVer, TEXT("102")) == 0)
buffer.Append(TEXT("2.0"));
- else if (mir_tstrcmp(iVer, TEXT("103")) == 0)
+ else if (mir_wstrcmp(iVer, TEXT("103")) == 0)
buffer.Append(TEXT("3.0"));
}
else buffer.Append(ieVersion);
@@ -175,12 +175,12 @@ void GetProcessorString(CMString &buffer) if (!RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("Hardware\\Description\\System\\CentralProcessor\\0"), 0, KEY_QUERY_VALUE, &hKey)) {
size = _countof(cpuName);
if (RegQueryValueEx(hKey, TEXT("ProcessorNameString"), NULL, NULL, (LPBYTE)cpuName, &size) != ERROR_SUCCESS)
- mir_tstrcpy(cpuName, TEXT("Unknown"));
+ mir_wstrcpy(cpuName, TEXT("Unknown"));
size = _countof(cpuIdent);
if (RegQueryValueEx(hKey, TEXT("Identifier"), NULL, NULL, (LPBYTE)cpuIdent, &size) != ERROR_SUCCESS)
if (RegQueryValueEx(hKey, TEXT("VendorIdentifier"), NULL, NULL, (LPBYTE)cpuIdent, &size) != ERROR_SUCCESS)
- mir_tstrcpy(cpuIdent, TEXT("Unknown"));
+ mir_wstrcpy(cpuIdent, TEXT("Unknown"));
RegCloseKey(hKey);
}
diff --git a/plugins/CryptoPP/src/PGPw/sdk8.cpp b/plugins/CryptoPP/src/PGPw/sdk8.cpp index e91f714d6b..5dd4cb1ebe 100644 --- a/plugins/CryptoPP/src/PGPw/sdk8.cpp +++ b/plugins/CryptoPP/src/PGPw/sdk8.cpp @@ -163,7 +163,7 @@ LPSTR __cdecl _pgp_encrypt_keydb(LPCSTR szPlainMsg, PVOID pgpKeyID) PGPFindKeyByKeyID(pgpKeyDB, RemoteKeyID, &PublicKey);
PGPError err = PGPEncode(pgpContext,
- PGPOInputBuffer(pgpContext, szPlainMsg, mir_tstrlen(szPlainMsg)),
+ PGPOInputBuffer(pgpContext, szPlainMsg, mir_strlen(szPlainMsg)),
PGPOArmorOutput(pgpContext, TRUE),
PGPOAllocatedOutputBuffer(pgpContext, (LPVOID *)&szEncMsg, 16384, &dwEncMsgLen),
PGPOEncryptToKeyDBObj(pgpContext, PublicKey),
@@ -206,7 +206,7 @@ LPSTR __cdecl _pgp_decrypt_keydb(LPCSTR szEncMsg) }
PGPError err = PGPDecode(pgpContext,
- PGPOInputBuffer(pgpContext, szEncMsg, mir_tstrlen(szEncMsg)),
+ PGPOInputBuffer(pgpContext, szEncMsg, mir_strlen(szEncMsg)),
PGPOAllocatedOutputBuffer(pgpContext, (LPVOID *)&szPlainMsg, 16384, &dwPlainMsgLen),
PGPOKeyDBRef(pgpContext, pgpKeyDB),
PGPOPassphrase(pgpContext, pszPassphrase),
@@ -244,7 +244,7 @@ PGPError _pgp_import_key(PGPKeyDBRef *keyDB, LPCSTR pgpKey) keyDB,
PGPOInputBuffer( pgpContext,
pgpKey,
- mir_tstrlen(pgpKey) ),
+ mir_strlen(pgpKey) ),
PGPOLastOption(pgpContext ));
#endif
}
@@ -278,7 +278,7 @@ LPSTR __cdecl _pgp_encrypt_key(LPCSTR szPlainMsg, LPCSTR pgpKey) }
PGPError err = PGPEncode(pgpContext,
- PGPOInputBuffer(pgpContext, szPlainMsg, mir_tstrlen(szPlainMsg)),
+ PGPOInputBuffer(pgpContext, szPlainMsg, mir_strlen(szPlainMsg)),
PGPOArmorOutput(pgpContext, TRUE),
PGPOAllocatedOutputBuffer(pgpContext, (LPVOID *)&szEncMsg, 16384, &dwEncMsgLen),
PGPOEncryptToKeyDBObj(pgpContext, PublicKey),
@@ -332,7 +332,7 @@ LPSTR __cdecl _pgp_decrypt_key(LPCSTR szEncMsg, LPCSTR pgpKey) }
PGPError err = PGPDecode(pgpContext,
- PGPOInputBuffer(pgpContext, szEncMsg, mir_tstrlen(szEncMsg)),
+ PGPOInputBuffer(pgpContext, szEncMsg, mir_strlen(szEncMsg)),
PGPOAllocatedOutputBuffer(pgpContext, (LPVOID *)&szPlainMsg, 16384, &dwPlainMsgLen),
PGPOKeyDBRef(pgpContext, PrivateKeyDB),
PGPOPassphrase(pgpContext, pszPassphrase),
diff --git a/plugins/Db3x_mmap/src/database.cpp b/plugins/Db3x_mmap/src/database.cpp index 06cfcaf963..80dc43d777 100644 --- a/plugins/Db3x_mmap/src/database.cpp +++ b/plugins/Db3x_mmap/src/database.cpp @@ -87,7 +87,7 @@ void __cdecl dbpanic(void *) msg = TranslateT("Disk is full. Miranda will now shut down.");
wchar_t err[256];
- mir_sntprintf(err, msg, TranslateT("Database failure. Miranda will now shut down."), dwErr);
+ mir_snwprintf(err, msg, TranslateT("Database failure. Miranda will now shut down."), dwErr);
MessageBox(0, err, TranslateT("Database Error"), MB_SETFOREGROUND | MB_TOPMOST | MB_APPLMODAL | MB_ICONWARNING | MB_OK);
}
diff --git a/plugins/Db3x_mmap/src/dbintf.cpp b/plugins/Db3x_mmap/src/dbintf.cpp index f831b627b8..5a11c25259 100644 --- a/plugins/Db3x_mmap/src/dbintf.cpp +++ b/plugins/Db3x_mmap/src/dbintf.cpp @@ -54,7 +54,7 @@ CDb3Mmap::CDb3Mmap(const wchar_t *tszFileName, int iMode) : m_lOfs(50, OfsCompare),
m_lResidentSettings(50, stringCompare2)
{
- m_tszProfileName = mir_tstrdup(tszFileName);
+ m_tszProfileName = mir_wstrdup(tszFileName);
InitDbInstance(this);
SYSTEM_INFO sinf;
diff --git a/plugins/Db3x_mmap/src/ui.cpp b/plugins/Db3x_mmap/src/ui.cpp index 36896352e4..5e6929572f 100644 --- a/plugins/Db3x_mmap/src/ui.cpp +++ b/plugins/Db3x_mmap/src/ui.cpp @@ -201,13 +201,13 @@ static INT_PTR CALLBACK sttChangePassword(HWND hwndDlg, UINT uMsg, WPARAM wParam case IDOK:
wchar_t buf2[100];
GetDlgItemText(hwndDlg, IDC_USERPASS1, buf2, _countof(buf2));
- if (mir_tstrlen(buf2) < 3) {
+ if (mir_wstrlen(buf2) < 3) {
SetDlgItemText(hwndDlg, IDC_HEADERBAR, TranslateT("Password is too short!"));
goto LBL_Error;
}
GetDlgItemText(hwndDlg, IDC_USERPASS2, buf, _countof(buf));
- if (mir_tstrcmp(buf2, buf)) {
+ if (mir_wstrcmp(buf2, buf)) {
SetDlgItemText(hwndDlg, IDC_HEADERBAR, TranslateT("Passwords do not match!"));
goto LBL_Error;
}
diff --git a/plugins/DbChecker/src/progress.cpp b/plugins/DbChecker/src/progress.cpp index e5dce00b3f..5c123b86e0 100644 --- a/plugins/DbChecker/src/progress.cpp +++ b/plugins/DbChecker/src/progress.cpp @@ -34,7 +34,7 @@ void AddToStatus(int flags, const wchar_t* fmt, ...) va_start(vararg, fmt);
wchar_t str[256];
- mir_vsntprintf(str, _countof(str), fmt, vararg);
+ mir_vsnwprintf(str, _countof(str), fmt, vararg);
va_end(vararg);
int i = SendMessage(hwndStatus, LB_ADDSTRING, 0, (LPARAM)str);
@@ -147,7 +147,7 @@ INT_PTR CALLBACK ProgressDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM break;
}
if (bold) hoFont = (HFONT)SelectObject(dis->hDC, hBoldFont);
- ExtTextOut(dis->hDC, dis->rcItem.left, dis->rcItem.top, ETO_CLIPPED | ETO_OPAQUE, &dis->rcItem, str, (UINT)mir_tstrlen(str), NULL);
+ ExtTextOut(dis->hDC, dis->rcItem.left, dis->rcItem.top, ETO_CLIPPED | ETO_OPAQUE, &dis->rcItem, str, (UINT)mir_wstrlen(str), NULL);
if (bold) SelectObject(dis->hDC, hoFont);
}
return TRUE;
diff --git a/plugins/DbChecker/src/selectdb.cpp b/plugins/DbChecker/src/selectdb.cpp index 72ac4e9824..0a704fe2ef 100644 --- a/plugins/DbChecker/src/selectdb.cpp +++ b/plugins/DbChecker/src/selectdb.cpp @@ -36,7 +36,7 @@ int OpenDatabase(HWND hdlg, INT iNextPage) if (opts.dbChecker == NULL) {
DATABASELINK* dblink = FindDatabasePlugin(opts.filename);
if (dblink == NULL) {
- mir_sntprintf(tszMsg,
+ mir_snwprintf(tszMsg,
TranslateT("Database Checker cannot find a suitable database plugin to open '%s'."),
opts.filename);
LBL_Error:
@@ -45,7 +45,7 @@ int OpenDatabase(HWND hdlg, INT iNextPage) }
if (dblink->CheckDB == NULL) {
- mir_sntprintf(tszMsg,
+ mir_snwprintf(tszMsg,
TranslateT("Database driver '%s' doesn't support checking."),
TranslateTS(dblink->szFullName));
goto LBL_Error;
@@ -77,15 +77,15 @@ void GetProfileDirectory(wchar_t* szMirandaDir, wchar_t* szPath, int cbPath) {
wchar_t szProfileDir[MAX_PATH], szExpandedProfileDir[MAX_PATH], szMirandaBootIni[MAX_PATH];
- mir_tstrcpy(szMirandaBootIni, szMirandaDir);
- mir_tstrcat(szMirandaBootIni, L"\\mirandaboot.ini");
+ mir_wstrcpy(szMirandaBootIni, szMirandaDir);
+ mir_wstrcat(szMirandaBootIni, L"\\mirandaboot.ini");
GetPrivateProfileString(L"Database", L"ProfileDir", L"./Profiles", szProfileDir, _countof(szProfileDir), szMirandaBootIni);
ExpandEnvironmentStrings(szProfileDir, szExpandedProfileDir, _countof(szExpandedProfileDir));
_wchdir(szMirandaDir);
if (!_wfullpath(szPath, szExpandedProfileDir, cbPath))
- mir_tstrncpy(szPath, szMirandaDir, cbPath);
- if (szPath[mir_tstrlen(szPath) - 1] == '\\')
- szPath[mir_tstrlen(szPath) - 1] = 0;
+ mir_wstrncpy(szPath, szMirandaDir, cbPath);
+ if (szPath[mir_wstrlen(szPath) - 1] == '\\')
+ szPath[mir_wstrlen(szPath) - 1] = 0;
}
static int AddDatabaseToList(HWND hwndList, const wchar_t* filename, wchar_t* dir)
@@ -95,7 +95,7 @@ static int AddDatabaseToList(HWND hwndList, const wchar_t* filename, wchar_t* di lvi.iSubItem = 0;
for (lvi.iItem = ListView_GetItemCount(hwndList) - 1; lvi.iItem >= 0; lvi.iItem--) {
ListView_GetItem(hwndList, &lvi);
- if (!mir_tstrcmpi((wchar_t*)lvi.lParam, filename))
+ if (!mir_wstrcmpi((wchar_t*)lvi.lParam, filename))
return lvi.iItem;
}
@@ -114,10 +114,10 @@ static int AddDatabaseToList(HWND hwndList, const wchar_t* filename, wchar_t* di pName++;
wchar_t szName[MAX_PATH];
- mir_sntprintf(szName, L"%s%s", dir, pName);
+ mir_snwprintf(szName, L"%s%s", dir, pName);
wchar_t *pDot = wcsrchr(szName, '.');
- if (pDot != NULL && !mir_tstrcmpi(pDot, L".dat"))
+ if (pDot != NULL && !mir_wstrcmpi(pDot, L".dat"))
*pDot = 0;
lvi.iItem = 0;
@@ -129,7 +129,7 @@ static int AddDatabaseToList(HWND hwndList, const wchar_t* filename, wchar_t* di int iNewItem = ListView_InsertItem(hwndList, &lvi);
wchar_t szSize[20];
- mir_sntprintf(szSize, L"%.2lf MB", totalSize / 1048576.0);
+ mir_snwprintf(szSize, L"%.2lf MB", totalSize / 1048576.0);
ListView_SetItemText(hwndList, iNewItem, 1, szSize);
return iNewItem;
}
@@ -140,16 +140,16 @@ void FindAdd(HWND hdlg, wchar_t *szProfileDir, wchar_t *szPrefix) WIN32_FIND_DATA fd;
wchar_t szSearchPath[MAX_PATH], szFilename[MAX_PATH];
- mir_tstrcpy(szSearchPath, szProfileDir);
- mir_tstrcat(szSearchPath, L"\\*.*");
+ mir_wstrcpy(szSearchPath, szProfileDir);
+ mir_wstrcat(szSearchPath, L"\\*.*");
hFind = FindFirstFile(szSearchPath, &fd);
if (hFind != INVALID_HANDLE_VALUE) {
do {
- if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || !mir_tstrcmp(fd.cFileName, L".") || !mir_tstrcmp(fd.cFileName, L".."))
+ if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || !mir_wstrcmp(fd.cFileName, L".") || !mir_wstrcmp(fd.cFileName, L".."))
continue;
- mir_sntprintf(szFilename, L"%s\\%s\\%s.dat", szProfileDir, fd.cFileName, fd.cFileName);
+ mir_snwprintf(szFilename, L"%s\\%s\\%s.dat", szProfileDir, fd.cFileName, fd.cFileName);
if (_waccess(szFilename, 0) == 0)
AddDatabaseToList(GetDlgItem(hdlg, IDC_DBLIST), szFilename, szPrefix);
} while (FindNextFile(hFind, &fd));
@@ -159,8 +159,8 @@ void FindAdd(HWND hdlg, wchar_t *szProfileDir, wchar_t *szPrefix) wchar_t *addstring(wchar_t *str, wchar_t *add)
{
- mir_tstrcpy(str, add);
- return str + mir_tstrlen(add) + 1;
+ mir_wstrcpy(str, add);
+ return str + mir_wstrlen(add) + 1;
}
INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
@@ -203,12 +203,12 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM wchar_t szMirandaProfiles[MAX_PATH];
DWORD cbData = _countof(szMirandaPath);
- mir_tstrcpy(szMirandaProfiles, szMirandaPath);
- mir_tstrcat(szMirandaProfiles, L"\\Profiles");
+ mir_wstrcpy(szMirandaProfiles, szMirandaPath);
+ mir_wstrcat(szMirandaProfiles, L"\\Profiles");
GetProfileDirectory(szMirandaPath, szProfileDir, _countof(szProfileDir));
// search in profile dir (using ini file)
- if (mir_tstrcmpi(szProfileDir, szMirandaProfiles))
+ if (mir_wstrcmpi(szProfileDir, szMirandaProfiles))
FindAdd(hdlg, szProfileDir, L"[ini]\\");
FindAdd(hdlg, szMirandaProfiles, L"[prf]\\");
@@ -218,7 +218,7 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM // search in profile dir (using registry path + ini file)
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\miranda32.exe", 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) {
if (RegQueryValueEx(hKey, L"Path", NULL, NULL, (PBYTE)szMirandaPath, &cbData) == ERROR_SUCCESS) {
- if (mir_tstrcmp(szProfileDir, szMirandaPath)) {
+ if (mir_wstrcmp(szProfileDir, szMirandaPath)) {
GetProfileDirectory(szMirandaPath, szProfileDir, _countof(szProfileDir));
FindAdd(hdlg, szProfileDir, L"[reg]\\");
}
@@ -265,7 +265,7 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM wchar_t *filter, *tmp, *tmp1, *tmp2;
tmp1 = TranslateT("Miranda Databases (*.dat)");
tmp2 = TranslateT("All Files");
- filter = tmp = (wchar_t*)_alloca((mir_tstrlen(tmp1) + mir_tstrlen(tmp2) + 11)*sizeof(wchar_t));
+ filter = tmp = (wchar_t*)_alloca((mir_wstrlen(tmp1) + mir_wstrlen(tmp2) + 11)*sizeof(wchar_t));
tmp = addstring(tmp, tmp1);
tmp = addstring(tmp, L"*.DAT");
tmp = addstring(tmp, tmp2);
diff --git a/plugins/DbChecker/src/welcome.cpp b/plugins/DbChecker/src/welcome.cpp index 326f7b5c14..321eba23a8 100644 --- a/plugins/DbChecker/src/welcome.cpp +++ b/plugins/DbChecker/src/welcome.cpp @@ -42,7 +42,7 @@ INT_PTR CALLBACK WelcomeDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM l SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
LOGFONT TitleLogFont = ncm.lfMessageFont;
TitleLogFont.lfWeight = FW_BOLD;
- mir_tstrcpy(TitleLogFont.lfFaceName, TEXT("Verdana Bold"));
+ mir_wstrcpy(TitleLogFont.lfFaceName, TEXT("Verdana Bold"));
HDC hdc = GetDC(NULL);
INT FontSize = 12;
diff --git a/plugins/DbChecker/src/worker.cpp b/plugins/DbChecker/src/worker.cpp index 92ab1cf497..ab97b54b33 100644 --- a/plugins/DbChecker/src/worker.cpp +++ b/plugins/DbChecker/src/worker.cpp @@ -42,21 +42,21 @@ static void Finalize(time_t& ts) if (opts.bBackup) {
wchar_t dbPath[MAX_PATH], dbFile[MAX_PATH];
- mir_tstrcpy(dbPath, opts.filename);
+ mir_wstrcpy(dbPath, opts.filename);
wchar_t* str2 = wcsrchr(dbPath, '\\');
if (str2 != NULL) {
- mir_tstrcpy(dbFile, str2 + 1);
+ mir_wstrcpy(dbFile, str2 + 1);
*str2 = 0;
}
else {
- mir_tstrcpy(dbFile, dbPath);
+ mir_wstrcpy(dbFile, dbPath);
dbPath[0] = 0;
}
for (int i = 1;; i++) {
if (i == 1)
- mir_sntprintf(opts.backupFilename, TranslateT("%s\\Backup of %s"), dbPath, dbFile);
+ mir_snwprintf(opts.backupFilename, TranslateT("%s\\Backup of %s"), dbPath, dbFile);
else
- mir_sntprintf(opts.backupFilename, TranslateT("%s\\Backup (%d) of %s"), dbPath, i, dbFile);
+ mir_snwprintf(opts.backupFilename, TranslateT("%s\\Backup (%d) of %s"), dbPath, i, dbFile);
if (_waccess(opts.backupFilename, 0) == -1) break;
}
@@ -79,16 +79,16 @@ void __cdecl WorkerThread(void *) AddToStatus(STATUS_MESSAGE, TranslateT("Database worker thread activated"));
- mir_tstrcpy(opts.workingFilename, opts.filename);
+ mir_wstrcpy(opts.workingFilename, opts.filename);
if (opts.bCheckOnly) {
- mir_tstrcpy(opts.outputFilename, TranslateT("<check only>"));
+ mir_wstrcpy(opts.outputFilename, TranslateT("<check only>"));
opts.hOutFile = INVALID_HANDLE_VALUE;
}
else {
- mir_tstrcpy(opts.outputFilename, opts.filename);
+ mir_wstrcpy(opts.outputFilename, opts.filename);
*wcsrchr(opts.outputFilename, '.') = 0;
- mir_tstrcat(opts.outputFilename, TranslateT(" (Output).dat"));
+ mir_wstrcat(opts.outputFilename, TranslateT(" (Output).dat"));
opts.hOutFile = CreateFile(opts.outputFilename, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (opts.hOutFile == INVALID_HANDLE_VALUE) {
AddToStatus(STATUS_FATAL, TranslateT("Can't create output file (%u)"), GetLastError());
diff --git a/plugins/DbEditorPP/src/copymodule.cpp b/plugins/DbEditorPP/src/copymodule.cpp index 042719fe53..faa42d29ea 100644 --- a/plugins/DbEditorPP/src/copymodule.cpp +++ b/plugins/DbEditorPP/src/copymodule.cpp @@ -29,7 +29,7 @@ INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar mac = (ModuleAndContact *)lParam;
wchar_t name[NAME_SIZE], msg[MSG_SIZE];
- mir_sntprintf(msg, TranslateT("Copy module \"%s\""), _A2T(mac->module));
+ mir_snwprintf(msg, TranslateT("Copy module \"%s\""), _A2T(mac->module));
SetWindowText(hwnd, msg);
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
diff --git a/plugins/DbEditorPP/src/deletemodule.cpp b/plugins/DbEditorPP/src/deletemodule.cpp index 5bb46feefb..8ea862845e 100644 --- a/plugins/DbEditorPP/src/deletemodule.cpp +++ b/plugins/DbEditorPP/src/deletemodule.cpp @@ -10,7 +10,7 @@ int deleteModule(MCONTACT hContact, const char *module, int confirm) if (confirm && db_get_b(NULL, modname, "WarnOnDelete", 1)) {
wchar_t text[MSG_SIZE];
- mir_sntprintf(text, TranslateT("Are you sure you want to delete module \"%s\"?"), _A2T(module));
+ mir_snwprintf(text, TranslateT("Are you sure you want to delete module \"%s\"?"), _A2T(module));
if (dlg(text, MB_YESNO | MB_ICONEXCLAMATION) == IDNO)
return 0;
}
diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index 40b0fd405a..f87b9af57a 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -3,7 +3,7 @@ wchar_t *GetFilter()
{
static wchar_t filter[MAX_PATH];
- mir_sntprintf(filter, L"%s%c*.ini%c%s%c*.*%c", TranslateT("INI Files"), 0, 0, TranslateT("All Files"), 0, 0);
+ mir_snwprintf(filter, L"%s%c*.ini%c%s%c*.*%c", TranslateT("INI Files"), 0, 0, TranslateT("All Files"), 0, 0);
return filter;
}
@@ -13,7 +13,7 @@ int Openfile(wchar_t *outputFile, const char *module, int maxlen) if (module) {
int n = 0;
- mir_tstrncpy(filename, _A2T(module), _countof(filename));
+ mir_wstrncpy(filename, _A2T(module), _countof(filename));
while (filename[n]) {
switch (filename[n]) {
@@ -42,7 +42,7 @@ int Openfile(wchar_t *outputFile, const char *module, int maxlen) if (!GetSaveFileName(&ofn))
return 0;
- mir_tstrncpy(outputFile, filename, maxlen);
+ mir_wstrncpy(outputFile, filename, maxlen);
return 1;
}
@@ -356,7 +356,7 @@ void importSettings(MCONTACT hContact, char *utf8) // get the type
type = *(end + 1);
if (mir_strcmp(module, "CList") == 0 && mir_strcmp(setting, "Group") == 0) {
- ptrT GroupName(mir_utf8decodeT(end + 2));
+ ptrW GroupName(mir_utf8decodeW(end + 2));
if (!GroupName)
continue;
@@ -431,7 +431,7 @@ INT_PTR CALLBACK ImportDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPara GetContactName((MCONTACT)lParam, NULL, name, _countof(name));
- mir_sntprintf(msg, TranslateT("Import to \"%s\""), name);
+ mir_snwprintf(msg, TranslateT("Import to \"%s\""), name);
SetWindowText(hwnd, msg);
break;
@@ -492,28 +492,28 @@ void ImportSettingsFromFileMenuItem(MCONTACT hContact, const char *FilePath) DWORD offset = 0;
- mir_tstrcpy(szFileNames, L"");
+ mir_wstrcpy(szFileNames, L"");
if (!FilePath)
offset = Openfile2Import(szFileNames, _countof(szFileNames));
else {
_A2T tmp(FilePath);
if (GetFileAttributes(tmp) != INVALID_FILE_ATTRIBUTES)
- mir_tstrncpy(szFileNames, tmp, _countof(szFileNames));
+ mir_wstrncpy(szFileNames, tmp, _countof(szFileNames));
}
int index = 0;
- if (mir_tstrcmp(szFileNames, L"")) {
- if ((DWORD)mir_tstrlen(szFileNames) < offset) {
+ if (mir_wstrcmp(szFileNames, L"")) {
+ if ((DWORD)mir_wstrlen(szFileNames) < offset) {
index += offset;
- mir_tstrncpy(szPath, szFileNames, offset);
- mir_tstrcat(szPath, L"\\");
+ mir_wstrncpy(szPath, szFileNames, offset);
+ mir_wstrcat(szPath, L"\\");
}
while (szFileNames[index]) {
- mir_tstrcpy(szFile, szPath);
- mir_tstrcat(szFile, &szFileNames[index]);
- index += (int)mir_tstrlen(&szFileNames[index]) + 1;
+ mir_wstrcpy(szFile, szPath);
+ mir_wstrcat(szFile, &szFileNames[index]);
+ index += (int)mir_wstrlen(&szFileNames[index]) + 1;
HANDLE hFile = CreateFile(szFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
if (hFile != INVALID_HANDLE_VALUE) {
diff --git a/plugins/DbEditorPP/src/findwindow.cpp b/plugins/DbEditorPP/src/findwindow.cpp index 3769825cd9..b97dd4ab0d 100644 --- a/plugins/DbEditorPP/src/findwindow.cpp +++ b/plugins/DbEditorPP/src/findwindow.cpp @@ -127,7 +127,7 @@ INT_PTR CALLBACK FindWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP if (IsDlgButtonChecked(hwnd, IDC_ENTIRELY))
fi->options |= F_ENTIRE;
- fi->replace = mir_tstrdup(replace);
+ fi->replace = mir_wstrdup(replace);
SetDlgItemText(hwnd, IDOK, TranslateT("Stop"));
EnableWindow(GetDlgItem(hwnd, IDC_SEARCH), 0);
@@ -138,7 +138,7 @@ INT_PTR CALLBACK FindWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP EnableWindow(GetDlgItem(hwnd, IDOK), 0);
}
- fi->search = mir_tstrdup(text);
+ fi->search = mir_wstrdup(text);
ListView_DeleteAllItems(fi->hwnd);
SetWindowLongPtr(GetDlgItem(hwnd, IDC_SEARCH), GWLP_USERDATA, 1);
@@ -459,15 +459,15 @@ void __cdecl FindSettings(LPVOID param) break;
case DBVT_WCHAR:
- if (!value) value = mir_u2t(dbv.pwszVal);
+ if (!value) value = mir_wstrdup(dbv.pwszVal);
case DBVT_UTF8:
- if (!value) value = mir_utf8decodeT(dbv.pszVal);
+ if (!value) value = mir_utf8decodeW(dbv.pszVal);
case DBVT_ASCIIZ:
- if (!value) value = mir_a2t(dbv.pszVal);
+ if (!value) value = mir_a2u(dbv.pszVal);
if (FindMatchT(value, fi->search, fi->options)) {
foundCount++;
- ptrT ptr;
+ ptrW ptr;
wchar_t *newValue = value;
int flag = F_SETVAL;
@@ -568,7 +568,7 @@ void __cdecl FindSettings(LPVOID param) }
wchar_t msg[MSG_SIZE];
- mir_sntprintf(msg, TranslateT("Finished. Items found: %d / replaced: %d / deleted: %d"), foundCount, replaceCount, deleteCount);
+ mir_snwprintf(msg, TranslateT("Finished. Items found: %d / replaced: %d / deleted: %d"), foundCount, replaceCount, deleteCount);
SendDlgItemMessage(hwndParent, IDC_SBAR, SB_SETTEXT, 0, (LPARAM)msg);
if (fi->replace) {
diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index 442237c4f6..20026bb8bc 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -421,7 +421,7 @@ int GetContactName(MCONTACT hContact, const char *proto, wchar_t *value, int max return 0;
if (!hContact) {
- mir_tstrncpy(value, TranslateT("Settings"), maxlen);
+ mir_wstrncpy(value, TranslateT("Settings"), maxlen);
return 1;
}
@@ -471,10 +471,10 @@ int GetContactName(MCONTACT hContact, const char *proto, wchar_t *value, int max if (szProto) {
GetValue(hContact, szProto, "FirstName", name, _countof(name));
- int len = (int)mir_tstrlen(name);
+ int len = (int)mir_wstrlen(name);
if (len + 2 < _countof(name)) {
if (len)
- mir_tstrncat(name, L" ", _countof(name));
+ mir_wstrncat(name, L" ", _countof(name));
len++;
GetValue(hContact, szProto, "LastName", &name[len], _countof(name) - len);
}
@@ -487,20 +487,20 @@ int GetContactName(MCONTACT hContact, const char *proto, wchar_t *value, int max }
if (!name[0])
- mir_tstrncpy(name, TranslateT("<UNKNOWN>"), _countof(name));
+ mir_wstrncpy(name, TranslateT("<UNKNOWN>"), _countof(name));
if (szProto && szProto[0]) {
if (g_Order)
- mir_sntprintf(value, maxlen, L"(%s) %s", _A2T(szProto), name);
+ mir_snwprintf(value, maxlen, L"(%s) %s", _A2T(szProto), name);
else
- mir_sntprintf(value, maxlen, L"%s (%s)", name, _A2T(szProto));
+ mir_snwprintf(value, maxlen, L"%s (%s)", name, _A2T(szProto));
}
- else mir_tstrncpy(value, name, maxlen);
+ else mir_wstrncpy(value, name, maxlen);
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
if (!Proto_IsAccountEnabled(pa)) {
- mir_tstrncat(value, L" ", maxlen);
- mir_tstrncat(value, TranslateT("[UNLOADED]"), maxlen);
+ mir_wstrncat(value, L" ", maxlen);
+ mir_wstrncat(value, TranslateT("[UNLOADED]"), maxlen);
}
return 1;
@@ -560,6 +560,6 @@ INT_PTR CALLBACK ColumnsCompare(LPARAM lParam1, LPARAM lParam2, LPARAM myParam) ListView_GetItemText(params.hList, lParam1, params.column, text1, _countof(text1));
ListView_GetItemText(params.hList, lParam2, params.column, text2, _countof(text2));
- int res = mir_tstrcmpi(text1, text2);
+ int res = mir_wstrcmpi(text1, text2);
return (params.column == params.last) ? -res : res;
}
diff --git a/plugins/DbEditorPP/src/main_window.cpp b/plugins/DbEditorPP/src/main_window.cpp index 7351297335..ba44c3fa20 100644 --- a/plugins/DbEditorPP/src/main_window.cpp +++ b/plugins/DbEditorPP/src/main_window.cpp @@ -130,7 +130,7 @@ LRESULT CALLBACK ModuleTreeSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR else if ((mtis->type == CONTACT) && hContact) {
if (db_get_b(NULL, "CList", "ConfirmDelete", 1)) {
wchar_t str[MSG_SIZE];
- mir_sntprintf(str, TranslateT("Are you sure you want to delete contact \"%s\"?"), text);
+ mir_snwprintf(str, TranslateT("Are you sure you want to delete contact \"%s\"?"), text);
if (dlg(str, MB_YESNO | MB_ICONEXCLAMATION) == IDNO)
break;
}
@@ -443,7 +443,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case MENU_FIX_RESIDENT:
if (dlg(TranslateT("Delete resident settings from database?"), MB_YESNO | MB_ICONEXCLAMATION) == IDYES) {
int cnt = fixResidentSettings();
- mir_sntprintf(text, TranslateT("%d items deleted."), cnt);
+ mir_snwprintf(text, TranslateT("%d items deleted."), cnt);
msg(text);
}
break;
diff --git a/plugins/DbEditorPP/src/moduletree.cpp b/plugins/DbEditorPP/src/moduletree.cpp index 00fce5eb74..2853c4a57c 100644 --- a/plugins/DbEditorPP/src/moduletree.cpp +++ b/plugins/DbEditorPP/src/moduletree.cpp @@ -106,7 +106,7 @@ void doItems(ModuleSettingLL* modlist, int count) HWND hwnd = GetParent(hwnd2Tree); //!!!
wchar_t percent[128], title[96];
- mir_sntprintf(title, TranslateT("Loading modules..."));
+ mir_snwprintf(title, TranslateT("Loading modules..."));
TVITEM item = { 0 };
item.mask = TVIF_STATE | TVIF_PARAM;
@@ -131,7 +131,7 @@ void doItems(ModuleSettingLL* modlist, int count) continue;
// Caption
- mir_sntprintf(percent, L"%s %d%%", title, (int)(100 * i / count));
+ mir_snwprintf(percent, L"%s %d%%", title, (int)(100 * i / count));
SetWindowText(hwnd, percent);
for (ModSetLinkLinkItem *module = modlist->first; module && hwnd2mainWindow; module = module->next) {
@@ -169,7 +169,7 @@ HTREEITEM findItemInTree(MCONTACT hContact, const char* module) if (lastItem != TVI_ROOT) {
/* these next 2 lines are not from code guru..... */
if (TreeView_GetItem(hwnd2Tree, &item) && item.lParam) {
- if ((hContact == ((ModuleTreeInfoStruct *)item.lParam)->hContact) && (!module || !module[0] || !mir_tstrcmp(szModule, text))) {
+ if ((hContact == ((ModuleTreeInfoStruct *)item.lParam)->hContact) && (!module || !module[0] || !mir_wstrcmp(szModule, text))) {
return item.hItem;
}
@@ -252,7 +252,7 @@ http://www.codeguru.com/Cpp/controls/treeview/treetraversal/comments.php/c683/?t /* these next lines are not from code guru..... */
if (item.lParam) {
ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct *)item.lParam;
- if (hContact == mtis->hContact && !mir_tstrcmp(text, szModule)) {
+ if (hContact == mtis->hContact && !mir_wstrcmp(text, szModule)) {
mir_free(mtis);
TreeView_DeleteItem(hwnd2Tree, item.hItem);
lastItem = prelastItem;
@@ -719,7 +719,7 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t case MENU_DELETE_CONTACT:
if (db_get_b(NULL, "CList", "ConfirmDelete", 1)) {
wchar_t str[MSG_SIZE];
- mir_sntprintf(str, TranslateT("Are you sure you want to delete contact \"%s\"?"), text);
+ mir_snwprintf(str, TranslateT("Are you sure you want to delete contact \"%s\"?"), text);
if (dlg(str, MB_YESNO | MB_ICONEXCLAMATION) == IDNO)
break;
}
diff --git a/plugins/DbEditorPP/src/renamemodule.cpp b/plugins/DbEditorPP/src/renamemodule.cpp index bb713adadd..1844907aba 100644 --- a/plugins/DbEditorPP/src/renamemodule.cpp +++ b/plugins/DbEditorPP/src/renamemodule.cpp @@ -33,7 +33,7 @@ INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPara wchar_t msg[MSG_SIZE], name[NAME_SIZE];
GetContactName((MCONTACT)lParam, NULL, name, _countof(name));
- mir_sntprintf(msg, TranslateT("Add module to \"%s\""), name);
+ mir_snwprintf(msg, TranslateT("Add module to \"%s\""), name);
SetWindowText(hwnd, msg);
break;
diff --git a/plugins/DbEditorPP/src/settinglist.cpp b/plugins/DbEditorPP/src/settinglist.cpp index 5b0f8371a9..501aa0e75e 100644 --- a/plugins/DbEditorPP/src/settinglist.cpp +++ b/plugins/DbEditorPP/src/settinglist.cpp @@ -50,7 +50,7 @@ int convertSetting(MCONTACT hContact, const char *module, const char *setting, i int res = 0;
DWORD val = 0;
wchar_t tmp[16];
- ptrT value;
+ ptrW value;
switch (dbv.type) {
@@ -58,22 +58,22 @@ int convertSetting(MCONTACT hContact, const char *module, const char *setting, i case DBVT_WORD:
case DBVT_DWORD:
val = getNumericValue(&dbv);
- value = mir_tstrdup(_ultow(val, tmp, 10));
+ value = mir_wstrdup(_ultow(val, tmp, 10));
break;
case DBVT_WCHAR:
if (!value)
- value = mir_u2t(dbv.pwszVal);
+ value = mir_wstrdup(dbv.pwszVal);
// fall through
case DBVT_UTF8:
if (!value)
- value = mir_utf8decodeT(dbv.pszVal);
+ value = mir_utf8decodeW(dbv.pszVal);
// fall through
case DBVT_ASCIIZ:
if (!value)
- value = mir_a2t(dbv.pszVal);
+ value = mir_a2u(dbv.pszVal);
- if (mir_tstrlen(value) < 11)
+ if (mir_wstrlen(value) < 11)
val = wcstoul(value, NULL, NULL);
}
@@ -82,7 +82,7 @@ int convertSetting(MCONTACT hContact, const char *module, const char *setting, i case DBVT_BYTE:
case DBVT_WORD:
case DBVT_DWORD:
- if (val != 0 || !mir_tstrcmp(value, L"0"))
+ if (val != 0 || !mir_wstrcmp(value, L"0"))
res = setNumericValue(hContact, module, setting, val, toType);
break;
@@ -133,7 +133,7 @@ void DeleteSettingsFromList(MCONTACT hContact, const char *module, const char *s if (db_get_b(NULL, modname, "WarnOnDelete", 1)) {
wchar_t text[MSG_SIZE];
- mir_sntprintf(text, TranslateT("Are you sure you want to delete setting(s): %d?"), count);
+ mir_snwprintf(text, TranslateT("Are you sure you want to delete setting(s): %d?"), count);
if (dlg(text, MB_YESNO | MB_ICONEXCLAMATION) == IDNO)
return;
}
@@ -216,7 +216,7 @@ void updateListItem(int index, const char *setting, DBVARIANT *dbv, int resident ListView_SetItemTextA(hwnd2List, index, 1, ptrA(StringFromBlob(dbv->pbVal, dbv->cpbVal)));
- mir_sntprintf(data, L"0x%04X (%u)", dbv->cpbVal, dbv->cpbVal);
+ mir_snwprintf(data, L"0x%04X (%u)", dbv->cpbVal, dbv->cpbVal);
ListView_SetItemText(hwnd2List, index, 3, data);
break;
@@ -224,7 +224,7 @@ void updateListItem(int index, const char *setting, DBVARIANT *dbv, int resident lvi.iImage = IMAGE_BYTE;
ListView_SetItem(hwnd2List, &lvi);
- mir_sntprintf(data, L"0x%02X (%u)", dbv->bVal, dbv->bVal);
+ mir_snwprintf(data, L"0x%02X (%u)", dbv->bVal, dbv->bVal);
ListView_SetItemText(hwnd2List, index, 1, data);
ListView_SetItemText(hwnd2List, index, 3, L"0x0001 (1)");
@@ -234,7 +234,7 @@ void updateListItem(int index, const char *setting, DBVARIANT *dbv, int resident lvi.iImage = IMAGE_WORD;
ListView_SetItem(hwnd2List, &lvi);
- mir_sntprintf(data, L"0x%04X (%u)", dbv->wVal, dbv->wVal);
+ mir_snwprintf(data, L"0x%04X (%u)", dbv->wVal, dbv->wVal);
ListView_SetItemText(hwnd2List, index, 1, data);
ListView_SetItemText(hwnd2List, index, 3, L"0x0002 (2)");
@@ -244,7 +244,7 @@ void updateListItem(int index, const char *setting, DBVARIANT *dbv, int resident lvi.iImage = IMAGE_DWORD;
ListView_SetItem(hwnd2List, &lvi);
- mir_sntprintf(data, L"0x%08X (%u)", dbv->dVal, dbv->dVal);
+ mir_snwprintf(data, L"0x%08X (%u)", dbv->dVal, dbv->dVal);
ListView_SetItemText(hwnd2List, index, 1, data);
ListView_SetItemText(hwnd2List, index, 3, L"0x0004 (4)");
@@ -257,7 +257,7 @@ void updateListItem(int index, const char *setting, DBVARIANT *dbv, int resident ListView_SetItemTextA(hwnd2List, index, 1, dbv->pszVal);
length = (int)mir_strlen(dbv->pszVal) + 1;
- mir_sntprintf(data, L"0x%04X (%u)", length, length);
+ mir_snwprintf(data, L"0x%04X (%u)", length, length);
ListView_SetItemText(hwnd2List, index, 3, data);
break;
@@ -268,7 +268,7 @@ void updateListItem(int index, const char *setting, DBVARIANT *dbv, int resident length = (int)mir_wstrlen(dbv->pwszVal) + 1;
ListView_SetItemText(hwnd2List, index, 1, dbv->pwszVal);
- mir_sntprintf(data, L"0x%04X (%u)", length, length);
+ mir_snwprintf(data, L"0x%04X (%u)", length, length);
ListView_SetItemText(hwnd2List, index, 3, data);
break;
@@ -278,10 +278,10 @@ void updateListItem(int index, const char *setting, DBVARIANT *dbv, int resident length = (int)mir_strlen(dbv->pszVal) + 1;
{
- ptrT tszText(mir_utf8decodeT(dbv->pszVal));
+ ptrW tszText(mir_utf8decodeW(dbv->pszVal));
ListView_SetItemText(hwnd2List, index, 1, tszText);
}
- mir_sntprintf(data, L"0x%04X (%u)", length, length);
+ mir_snwprintf(data, L"0x%04X (%u)", length, length);
ListView_SetItemText(hwnd2List, index, 3, data);
break;
@@ -306,7 +306,7 @@ void addListHandle(MCONTACT hContact) int index = ListView_InsertItem(hwnd2List, &lvi);
- mir_sntprintf(data, L"0x%08X (%ld)", hContact, hContact);
+ mir_snwprintf(data, L"0x%08X (%ld)", hContact, hContact);
ListView_SetItemText(hwnd2List, index, 1, data);
ListView_SetItemText(hwnd2List, index, 2, L"HANDLE");
@@ -570,7 +570,7 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd, UINT msg, WPARAM case '\"':
case '\'':
{
- size_t nlen = mir_tstrlen(value);
+ size_t nlen = mir_wstrlen(value);
int sh = 0;
if (nlen > 3) {
if (value[nlen - 1] == value[0]) {
@@ -642,25 +642,25 @@ void EditLabel(int item, int subitem) switch (dbv.type) {
case DBVT_ASCIIZ:
- str = mir_a2t(dbv.pszVal);
+ str = mir_a2u(dbv.pszVal);
break;
case DBVT_BYTE:
- mir_sntprintf(value, (g_Hex & HEX_BYTE) ? L"0x%02X" : L"%u", dbv.bVal);
+ mir_snwprintf(value, (g_Hex & HEX_BYTE) ? L"0x%02X" : L"%u", dbv.bVal);
break;
case DBVT_WORD:
- mir_sntprintf(value, (g_Hex & HEX_WORD) ? L"0x%04X" : L"%u", dbv.wVal);
+ mir_snwprintf(value, (g_Hex & HEX_WORD) ? L"0x%04X" : L"%u", dbv.wVal);
break;
case DBVT_DWORD:
- mir_sntprintf(value, (g_Hex & HEX_DWORD) ? L"0x%08X" : L"%u", dbv.dVal);
+ mir_snwprintf(value, (g_Hex & HEX_DWORD) ? L"0x%08X" : L"%u", dbv.dVal);
break;
case DBVT_WCHAR:
- str = mir_u2t(dbv.pwszVal);
+ str = mir_wstrdup(dbv.pwszVal);
break;
case DBVT_UTF8:
- str = mir_utf8decodeT(dbv.pszVal);
+ str = mir_utf8decodeW(dbv.pszVal);
break;
case DBVT_BLOB:
- str = mir_a2t(ptrA(StringFromBlob(dbv.pbVal, dbv.cpbVal)));
+ str = mir_a2u(ptrA(StringFromBlob(dbv.pbVal, dbv.cpbVal)));
break;
}
diff --git a/plugins/DbEditorPP/src/settingsdlg.cpp b/plugins/DbEditorPP/src/settingsdlg.cpp index ed13f64227..bddbc89b0d 100644 --- a/plugins/DbEditorPP/src/settingsdlg.cpp +++ b/plugins/DbEditorPP/src/settingsdlg.cpp @@ -131,7 +131,7 @@ INT_PTR CALLBACK EditSettingDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l TranslateDialogDefault(hwnd);
{
wchar_t text[MSG_SIZE];
- mir_sntprintf(text, dbsetting->setting?TranslateT("Edit setting (%s)"):TranslateT("New setting (%s)"), DBVType(dbsetting->dbv.type));
+ mir_snwprintf(text, dbsetting->setting?TranslateT("Edit setting (%s)"):TranslateT("New setting (%s)"), DBVType(dbsetting->dbv.type));
SetWindowText(hwnd, text);
}
}
@@ -167,12 +167,12 @@ INT_PTR CALLBACK EditSettingDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l if (LOWORD(wParam) == CHK_DECIMAL && IsDlgButtonChecked(hwnd, CHK_DECIMAL))
{
swscanf(setting, L"%X", &tmp);
- mir_sntprintf(text, L"%u", tmp);
+ mir_snwprintf(text, L"%u", tmp);
}
else
{
swscanf(setting, L"%u", &tmp);
- mir_sntprintf(text, L"%X", tmp);
+ mir_snwprintf(text, L"%X", tmp);
}
SetDlgItemText(hwnd, IDC_SETTINGVALUE, text);
mir_free(setting);
diff --git a/plugins/DbEditorPP/src/watchedvars.cpp b/plugins/DbEditorPP/src/watchedvars.cpp index 6407bd5b35..e4a175d1ff 100644 --- a/plugins/DbEditorPP/src/watchedvars.cpp +++ b/plugins/DbEditorPP/src/watchedvars.cpp @@ -131,16 +131,16 @@ void addwatchtolist(HWND hwnd, struct DBsetting *lParam) break;
}
case DBVT_BYTE:
- mir_sntprintf(data, L"0x%02X (%s)", dbv->bVal, _ultow(dbv->bVal, tmp, 10));
+ mir_snwprintf(data, L"0x%02X (%s)", dbv->bVal, _ultow(dbv->bVal, tmp, 10));
ListView_SetItemText(hwnd, index, 3, data);
break;
case DBVT_WORD:
- mir_sntprintf(data, L"0x%04X (%s)", dbv->wVal, _ultow(dbv->wVal, tmp, 10));
+ mir_snwprintf(data, L"0x%04X (%s)", dbv->wVal, _ultow(dbv->wVal, tmp, 10));
ListView_SetItemText(hwnd, index, 3, data);
break;
case DBVT_DWORD:
- mir_sntprintf(data, L"0x%08X (%s)", dbv->dVal, _ultow(dbv->dVal, tmp, 10));
+ mir_snwprintf(data, L"0x%08X (%s)", dbv->dVal, _ultow(dbv->dVal, tmp, 10));
ListView_SetItemText(hwnd, index, 3, data);
break;
@@ -150,14 +150,14 @@ void addwatchtolist(HWND hwnd, struct DBsetting *lParam) case DBVT_WCHAR:
{
- ptrT str(mir_u2t(dbv->pwszVal));
+ ptrW str(mir_wstrdup(dbv->pwszVal));
ListView_SetItemText(hwnd, index, 3, str);
break;
}
case DBVT_UTF8:
{
- ptrT str(mir_utf8decodeT(dbv->pszVal));
+ ptrW str(mir_utf8decodeW(dbv->pszVal));
ListView_SetItemText(hwnd, index, 3, str);
break;
}
@@ -357,13 +357,13 @@ void popupWatchedVar(MCONTACT hContact, const char *module, const char *setting) // 2nd line
int type = GetValue(hContact, module, setting, value, _countof(value));
- mir_sntprintf(text, TranslateT("Database Setting Changed: \nModule: \"%s\", Setting: \"%s\"\nNew Value (%s): \"%s\""), _A2T(module), _A2T(setting), DBVType(type), value);
+ mir_snwprintf(text, TranslateT("Database Setting Changed: \nModule: \"%s\", Setting: \"%s\"\nNew Value (%s): \"%s\""), _A2T(module), _A2T(setting), DBVType(type), value);
POPUPDATAT ppd = { 0 };
ppd.lchContact = (MCONTACT)hContact;
ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(ICO_REGEDIT));
- mir_tstrncpy(ppd.lptzContactName, name, _countof(ppd.lptzContactName));
- mir_tstrncpy(ppd.lptzText, text, _countof(ppd.lptzText));
+ mir_wstrncpy(ppd.lptzContactName, name, _countof(ppd.lptzContactName));
+ mir_wstrncpy(ppd.lptzText, text, _countof(ppd.lptzText));
ppd.colorBack = colorBack;
ppd.colorText = colorText;
ppd.iSeconds = timeout ? timeout : -1;
diff --git a/plugins/Db_autobackups/src/backup.cpp b/plugins/Db_autobackups/src/backup.cpp index 82d06ad4bb..ea18899542 100644 --- a/plugins/Db_autobackups/src/backup.cpp +++ b/plugins/Db_autobackups/src/backup.cpp @@ -32,7 +32,7 @@ void ShowPopup(wchar_t* ptszText, wchar_t* ptszHeader, wchar_t* ptszPath) wcsncpy_s(ppd.lptzText, ptszText, _TRUNCATE);
wcsncpy_s(ppd.lptzContactName, ptszHeader, _TRUNCATE);
if (ptszPath != NULL)
- ppd.PluginData = (void*)mir_tstrdup(ptszPath);
+ ppd.PluginData = (void*)mir_wstrdup(ptszPath);
ppd.PluginWindowProc = DlgProcPopup;
ppd.lchIcon = IcoLib_GetIcon(iconList[0].szName);
@@ -112,7 +112,7 @@ bool MakeZip(wchar_t *tszSource, wchar_t *tszDest, wchar_t *dbname, HWND progres HWND hProgBar = GetDlgItem(progress_dialog, IDC_PROGRESS);
ptrA szSourceName(mir_u2a(dbname));
- ptrT tszDestPath(DoubleSlash(tszDest));
+ ptrW tszDestPath(DoubleSlash(tszDest));
OBJLIST<ZipFile> lstFiles(15);
lstFiles.insert(new ZipFile((char*)_T2A(tszSource), (char*)szSourceName));
@@ -149,7 +149,7 @@ int RotateBackups(wchar_t *backupfolder, wchar_t *dbname) if (options.num_backups == 0)
return 0; /* Roration disabled. */
- mir_sntprintf(backupfolderTmp, L"%s\\%s*", backupfolder, dbname);
+ mir_snwprintf(backupfolderTmp, L"%s\\%s*", backupfolder, dbname);
hFind = FindFirstFile(backupfolderTmp, &FindFileData);
if (hFind == INVALID_HANDLE_VALUE)
return 0;
@@ -169,7 +169,7 @@ int RotateBackups(wchar_t *backupfolder, wchar_t *dbname) if (i > 0)
qsort(bf, i, sizeof(backupFile), Comp); /* Sort the list of found files by date in descending order. */
for (; i >= options.num_backups; i --) {
- mir_sntprintf(backupfolderTmp, L"%s\\%s", backupfolder, bf[(i - 1)].Name);
+ mir_snwprintf(backupfolderTmp, L"%s\\%s", backupfolder, bf[(i - 1)].Name);
DeleteFile(backupfolderTmp);
}
err_out:
@@ -205,12 +205,12 @@ int Backup(wchar_t *backup_filename) GetLocalTime(&st);
GetComputerName(buffer, &size);
- mir_sntprintf(dest_file, L"%s\\%s_%02d.%02d.%02d@%02d-%02d-%02d_%s.%s", backupfolder, dbname, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, buffer, bZip ? L"zip" : L"dat");
+ mir_snwprintf(dest_file, L"%s\\%s_%02d.%02d.%02d@%02d-%02d-%02d_%s.%s", backupfolder, dbname, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, buffer, bZip ? L"zip" : L"dat");
mir_free(backupfolder);
}
else {
wcsncpy_s(dest_file, backup_filename, _TRUNCATE);
- if (!mir_tstrcmp(wcsrchr(backup_filename, '.'), L".zip"))
+ if (!mir_wstrcmp(wcsrchr(backup_filename, '.'), L".zip"))
bZip = true;
}
if (!options.disable_popups)
@@ -221,7 +221,7 @@ int Backup(wchar_t *backup_filename) SetDlgItemText(progress_dialog, IDC_PROGRESSMESSAGE, TranslateT("Copying database file..."));
- mir_sntprintf(source_file, L"%s\\%s", profilePath, dbname);
+ mir_snwprintf(source_file, L"%s\\%s", profilePath, dbname);
wchar_t *pathtmp = Utils_ReplaceVarsT(source_file);
BOOL res = 0;
if (bZip)
@@ -253,7 +253,7 @@ int Backup(wchar_t *backup_filename) }
if (!options.disable_popups) {
- size_t dest_file_len = mir_tstrlen(dest_file);
+ size_t dest_file_len = mir_wstrlen(dest_file);
wchar_t *puText;
if (dest_file_len > 50) {
@@ -262,12 +262,12 @@ int Backup(wchar_t *backup_filename) for (i = (dest_file_len - 1); dest_file[i] != '\\'; i--)
;
//wcsncpy_s(dest_file, backup_filename, _TRUNCATE);
- mir_tstrncpy(puText, dest_file, (i + 2));
- mir_tstrcat(puText, L"\n");
- mir_tstrcat(puText, (dest_file + i + 1));
+ mir_wstrncpy(puText, dest_file, (i + 2));
+ mir_wstrcat(puText, L"\n");
+ mir_wstrcat(puText, (dest_file + i + 1));
}
else
- puText = mir_tstrdup(dest_file);
+ puText = mir_wstrdup(dest_file);
// Now we need to know, which folder we made a backup. Let's break unnecessary variables :)
while (dest_file[--dest_file_len] != L'\\')
@@ -303,7 +303,7 @@ void BackupStart(wchar_t *backup_filename) return;
}
if (backup_filename != NULL)
- tm = mir_tstrdup(backup_filename);
+ tm = mir_wstrdup(backup_filename);
if (mir_forkthread(BackupThread, (void*)tm) == INVALID_HANDLE_VALUE) {
InterlockedExchange(&m_state, 0); /* Backup done. */
mir_free(tm);
diff --git a/plugins/Db_autobackups/src/main.cpp b/plugins/Db_autobackups/src/main.cpp index 52cc10aa91..4efd79dec5 100644 --- a/plugins/Db_autobackups/src/main.cpp +++ b/plugins/Db_autobackups/src/main.cpp @@ -38,7 +38,7 @@ static INT_PTR DBSaveAs(WPARAM, LPARAM) OPENFILENAME ofn = { 0 };
CallService(MS_DB_GETPROFILENAMET, _countof(fname_buff), (LPARAM)fname_buff);
- mir_sntprintf(tszFilter, L"%s (*.dat)%c*.dat%c%s (*.zip)%c*.zip%c%s (*.*)%c*%c",
+ mir_snwprintf(tszFilter, L"%s (*.dat)%c*.dat%c%s (*.zip)%c*.zip%c%s (*.*)%c*%c",
TranslateT("Miranda NG databases"), 0, 0,
TranslateT("Compressed Miranda NG databases"), 0, 0,
TranslateT("All files"), 0, 0);
diff --git a/plugins/Db_autobackups/src/options.cpp b/plugins/Db_autobackups/src/options.cpp index 046f777fd9..52ca03f8ad 100644 --- a/plugins/Db_autobackups/src/options.cpp +++ b/plugins/Db_autobackups/src/options.cpp @@ -45,15 +45,15 @@ int LoadOptions(void) if (!db_get_ts(0, "AutoBackups", "Folder", &dbv)) {
wchar_t *tmp = Utils_ReplaceVarsT(dbv.ptszVal);
- if (mir_tstrlen(tmp) >= 2 && tmp[1] == ':')
+ if (mir_wstrlen(tmp) >= 2 && tmp[1] == ':')
wcsncpy_s(options.folder, dbv.ptszVal, _TRUNCATE);
else
- mir_sntprintf(options.folder, L"%s\\%s", profilePath, dbv.ptszVal);
+ mir_snwprintf(options.folder, L"%s\\%s", profilePath, dbv.ptszVal);
db_free(&dbv);
mir_free(tmp);
}
- else mir_sntprintf(options.folder, L"%s%s", DIR, SUB_DIR);
+ else mir_snwprintf(options.folder, L"%s%s", DIR, SUB_DIR);
}
options.num_backups = db_get_w(0, "AutoBackups", "NumBackups", 3);
@@ -77,9 +77,9 @@ int SaveOptions(void) db_set_w(0, "AutoBackups", "Period", (WORD)options.period);
db_set_b(0, "AutoBackups", "PeriodType", (BYTE)options.period_type);
- mir_sntprintf(prof_dir, L"%s\\", profilePath);
- size_t prof_len = mir_tstrlen(prof_dir);
- size_t opt_len = mir_tstrlen(options.folder);
+ mir_snwprintf(prof_dir, L"%s\\", profilePath);
+ size_t prof_len = mir_wstrlen(prof_dir);
+ size_t opt_len = mir_wstrlen(options.folder);
if (opt_len > prof_len && wcsncmp(options.folder, prof_dir, prof_len) == 0) {
db_set_ts(0, "AutoBackups", "Folder", (options.folder + prof_len));
@@ -88,9 +88,9 @@ int SaveOptions(void) db_set_ts(0, "AutoBackups", "Folder", options.folder);
wchar_t *tmp = Utils_ReplaceVarsT(options.folder);
- if (mir_tstrlen(tmp) < 2 || tmp[1] != ':') {
+ if (mir_wstrlen(tmp) < 2 || tmp[1] != ':') {
wcsncpy_s(prof_dir, options.folder, _TRUNCATE);
- mir_sntprintf(options.folder, L"%s\\%s", profilePath, prof_dir);
+ mir_snwprintf(options.folder, L"%s\\%s", profilePath, prof_dir);
}
mir_free(tmp);
db_set_w(0, "AutoBackups", "NumBackups", options.num_backups);
@@ -195,7 +195,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
else {
wchar_t tszTooltipText[4096];
- mir_sntprintf(tszTooltipText, L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s",
+ mir_snwprintf(tszTooltipText, L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s",
L"%miranda_path%", TranslateT("path to Miranda root folder"),
L"%miranda_profilesdir%", TranslateT("path to folder containing Miranda profiles"),
L"%miranda_profilename%", TranslateT("name of current Miranda profile (filename, without extension)"),
@@ -359,10 +359,10 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP BOOL folder_ok = TRUE;
wchar_t *tmp = Utils_ReplaceVarsT(folder_buff);
- if (mir_tstrlen(tmp) >= 2 && tmp[1] == ':')
+ if (mir_wstrlen(tmp) >= 2 && tmp[1] == ':')
wcsncpy_s(backupfolder, tmp, _TRUNCATE);
else
- mir_sntprintf(backupfolder, L"%s\\%s", profilePath, tmp);
+ mir_snwprintf(backupfolder, L"%s\\%s", profilePath, tmp);
mir_free(tmp);
int err = CreateDirectoryTreeT(backupfolder);
diff --git a/plugins/Dbx_mdb/src/dbcrypt.cpp b/plugins/Dbx_mdb/src/dbcrypt.cpp index 0b5d3e6bf2..74b51d1084 100644 --- a/plugins/Dbx_mdb/src/dbcrypt.cpp +++ b/plugins/Dbx_mdb/src/dbcrypt.cpp @@ -100,7 +100,7 @@ int CDbxMdb::InitCrypt() {
if (-128 != dlg.DoModal())
return 4;
- m_crypto->setPassword(pass_ptrA(mir_utf8encodeT(param.newPass)));
+ m_crypto->setPassword(pass_ptrA(mir_utf8encodeW(param.newPass)));
if (m_crypto->setKey((const BYTE*)value.mv_data, value.mv_size))
{
m_bUsesPassword = true;
@@ -156,7 +156,7 @@ void CDbxMdb::SetPassword(LPCTSTR ptszPassword) else
{
m_bUsesPassword = true;
- m_crypto->setPassword(pass_ptrA(mir_utf8encodeT(ptszPassword)));
+ m_crypto->setPassword(pass_ptrA(mir_utf8encodeW(ptszPassword)));
}
UpdateMenuItem();
}
diff --git a/plugins/Dbx_mdb/src/dbintf.cpp b/plugins/Dbx_mdb/src/dbintf.cpp index 1bfc1ddc24..a47dd6b677 100644 --- a/plugins/Dbx_mdb/src/dbintf.cpp +++ b/plugins/Dbx_mdb/src/dbintf.cpp @@ -30,7 +30,7 @@ CDbxMdb::CDbxMdb(const TCHAR *tszFileName, int iMode) : m_lResidentSettings(50, strcmp),
m_maxContactId(1)
{
- m_tszProfileName = mir_tstrdup(tszFileName);
+ m_tszProfileName = mir_wstrdup(tszFileName);
InitDbInstance(this);
mdb_env_create(&m_pMdbEnv);
@@ -226,7 +226,7 @@ EXTERN_C void __cdecl dbpanic(void *) msg = TranslateT("Disk is full. Miranda will now shut down.");
TCHAR err[256];
- mir_sntprintf(err, _countof(err), msg, TranslateT("Database failure. Miranda will now shut down."), dwErr);
+ mir_snwprintf(err, msg, TranslateT("Database failure. Miranda will now shut down."), dwErr);
MessageBox(0, err, TranslateT("Database Error"), MB_SETFOREGROUND | MB_TOPMOST | MB_APPLMODAL | MB_ICONWARNING | MB_OK);
}
diff --git a/plugins/Dbx_mdb/src/ui.cpp b/plugins/Dbx_mdb/src/ui.cpp index 7f73b41cd6..9845552062 100644 --- a/plugins/Dbx_mdb/src/ui.cpp +++ b/plugins/Dbx_mdb/src/ui.cpp @@ -48,7 +48,7 @@ static bool CheckOldPassword(HWND hwndDlg, CDbxMdb *db) {
TCHAR buf[100];
GetDlgItemText(hwndDlg, IDC_OLDPASS, buf, _countof(buf));
- pass_ptrA oldPass(mir_utf8encodeT(buf));
+ pass_ptrA oldPass(mir_utf8encodeW(buf));
if (!db->m_crypto->checkPassword(oldPass))
{
SetDlgItemText(hwndDlg, IDC_HEADERBAR, TranslateT("Wrong old password entered!"));
diff --git a/plugins/Dropbox/src/dropbox.cpp b/plugins/Dropbox/src/dropbox.cpp index 4a6faac5b1..6ec01a5354 100644 --- a/plugins/Dropbox/src/dropbox.cpp +++ b/plugins/Dropbox/src/dropbox.cpp @@ -173,7 +173,7 @@ UINT CDropbox::RequestAccessTokenAsync(void *owner, void *param) JSONNode node = root.at("error_description");
if (node != JSONNULL) {
- ptrT error_description(mir_a2t_cp(node.as_string().c_str(), CP_UTF8));
+ ptrW error_description(mir_a2u_cp(node.as_string().c_str(), CP_UTF8));
Netlib_Logf(instance->hNetlibConnection, "%s: %s", MODULE, HttpStatusToText((HTTP_STATUS)response->resultCode));
if (hwndDlg)
SetDlgItemText(hwndDlg, IDC_AUTH_STATUS, error_description);
diff --git a/plugins/Dropbox/src/dropbox_options.cpp b/plugins/Dropbox/src/dropbox_options.cpp index f5ff7516fd..3bba4c0520 100644 --- a/plugins/Dropbox/src/dropbox_options.cpp +++ b/plugins/Dropbox/src/dropbox_options.cpp @@ -77,8 +77,8 @@ void CDropboxOptionsInterception::OnInitDialog() PROTOACCOUNT *acc = accounts[i];
if (strstr(acc->szProtoName, MODULE) || strstr(acc->szProtoName, "Meta"))
continue;
- int iItem = m_accounts.AddItem(mir_tstrdup(acc->tszAccountName), -1, (LPARAM)acc);
- m_accounts.SetItem(iItem, 1, mir_a2t(acc->szProtoName));
+ int iItem = m_accounts.AddItem(mir_wstrdup(acc->tszAccountName), -1, (LPARAM)acc);
+ m_accounts.SetItem(iItem, 1, mir_a2u(acc->szProtoName));
if (interceptedAccounts && strstr(interceptedAccounts, acc->szModuleName))
m_accounts.SetCheckState(iItem, TRUE);
}
diff --git a/plugins/Dropbox/src/dropbox_services.cpp b/plugins/Dropbox/src/dropbox_services.cpp index 6896398ced..9dd4100a68 100644 --- a/plugins/Dropbox/src/dropbox_services.cpp +++ b/plugins/Dropbox/src/dropbox_services.cpp @@ -192,7 +192,7 @@ INT_PTR CDropbox::UploadToDropbox(WPARAM wParam, LPARAM lParam) int res = UploadToDropbox(this, ftp);
if (res == ACKRESULT_SUCCESS && wParam) {
char **data = (char**)wParam;
- *data = mir_utf8encodeT(ftp->GetData());
+ *data = mir_utf8encodeW(ftp->GetData());
}
transfers.remove(ftp);
diff --git a/plugins/Dropbox/src/dropbox_transfers.cpp b/plugins/Dropbox/src/dropbox_transfers.cpp index 33d9ed8613..85f3d44592 100644 --- a/plugins/Dropbox/src/dropbox_transfers.cpp +++ b/plugins/Dropbox/src/dropbox_transfers.cpp @@ -102,7 +102,7 @@ UINT CDropbox::UploadToDropbox(void *owner, void *arg) PreparePath(folderName, path);
instance->CreateFolder(path);
instance->CreateDownloadUrl(path, url);
- ftp->AppendFormatData(L"%s\r\n", ptrT(mir_utf8decodeT(url)));
+ ftp->AppendFormatData(L"%s\r\n", ptrW(mir_utf8decodeW(url)));
}
ftp->FirstFile();
@@ -142,7 +142,7 @@ UINT CDropbox::UploadToDropbox(void *owner, void *arg) const wchar_t *serverFolder = ftp->GetServerFolder();
if (serverFolder) {
wchar_t serverPath[MAX_PATH] = { 0 };
- mir_sntprintf(serverPath, L"%s\\%s", serverFolder, fileName);
+ mir_snwprintf(serverPath, L"%s\\%s", serverFolder, fileName);
PreparePath(serverPath, path);
}
else
@@ -154,7 +154,7 @@ UINT CDropbox::UploadToDropbox(void *owner, void *arg) if (!wcschr(fileName, L'\\')) {
char url[MAX_PATH];
instance->CreateDownloadUrl(path, url);
- ftp->AppendFormatData(L"%s\r\n", ptrT(mir_utf8decodeT(url)));
+ ftp->AppendFormatData(L"%s\r\n", ptrW(mir_utf8decodeW(url)));
}
} while (ftp->NextFile());
}
diff --git a/plugins/Dropbox/src/dropbox_utils.cpp b/plugins/Dropbox/src/dropbox_utils.cpp index 28bf244984..b388117db5 100644 --- a/plugins/Dropbox/src/dropbox_utils.cpp +++ b/plugins/Dropbox/src/dropbox_utils.cpp @@ -98,26 +98,26 @@ MEVENT CDropbox::AddEventToDb(MCONTACT hContact, WORD type, DWORD flags, DWORD c void CDropbox::SendToContact(MCONTACT hContact, const wchar_t *data)
{
if (hContact == GetDefaultContact()) {
- char *message = mir_utf8encodeT(data);
+ char *message = mir_utf8encodeW(data);
AddEventToDb(hContact, EVENTTYPE_MESSAGE, DBEF_UTF, (DWORD)mir_strlen(message), (PBYTE)message);
return;
}
const char *szProto = GetContactProto(hContact);
if (db_get_b(hContact, szProto, "ChatRoom", 0) == TRUE) {
- ptrT tszChatRoom(db_get_tsa(hContact, szProto, "ChatRoomID"));
+ ptrW tszChatRoom(db_get_tsa(hContact, szProto, "ChatRoomID"));
GCDEST gcd = { szProto, tszChatRoom, GC_EVENT_SENDMESSAGE };
GCEVENT gce = { sizeof(gce), &gcd };
gce.bIsMe = TRUE;
gce.dwFlags = GCEF_ADDTOLOG;
- gce.ptszText = mir_tstrdup(data);
+ gce.ptszText = mir_wstrdup(data);
gce.time = time(NULL);
CallServiceSync(MS_GC_EVENT, WINDOW_VISIBLE, (LPARAM)&gce);
mir_free((void*)gce.ptszText);
return;
}
- char *message = mir_utf8encodeT(data);
+ char *message = mir_utf8encodeW(data);
if (ProtoChainSend(hContact, PSS_MESSAGE, 0, (LPARAM)message) != ACKRESULT_FAILED)
AddEventToDb(hContact, EVENTTYPE_MESSAGE, DBEF_UTF | DBEF_SENT, (DWORD)mir_strlen(message), (PBYTE)message);
}
@@ -142,7 +142,7 @@ void CDropbox::PasteToClipboard(const wchar_t *data) if (OpenClipboard(NULL)) {
EmptyClipboard();
- size_t size = sizeof(wchar_t) * (mir_tstrlen(data) + 1);
+ size_t size = sizeof(wchar_t) * (mir_wstrlen(data) + 1);
HGLOBAL hClipboardData = GlobalAlloc(NULL, size);
if (hClipboardData) {
wchar_t *pchData = (wchar_t*)GlobalLock(hClipboardData);
diff --git a/plugins/Dropbox/src/file_transfer.h b/plugins/Dropbox/src/file_transfer.h index 6feacbb445..f5ef1e56fd 100644 --- a/plugins/Dropbox/src/file_transfer.h +++ b/plugins/Dropbox/src/file_transfer.h @@ -91,7 +91,7 @@ public: {
relativePathStart = wcsrchr(path, '\\') - path + 1;
pfts.tszWorkingDir = (wchar_t*)mir_calloc(sizeof(wchar_t) * relativePathStart);
- mir_tstrncpy(pfts.tszWorkingDir, path, relativePathStart);
+ mir_wstrncpy(pfts.tszWorkingDir, path, relativePathStart);
if (PathIsDirectory(path))
folderName = wcsrchr(path, '\\') + 1;
}
@@ -117,7 +117,7 @@ public: void AddFile(const wchar_t *path)
{
pfts.ptszFiles = (wchar_t**)mir_realloc(pfts.ptszFiles, sizeof(wchar_t*) * (pfts.totalFiles + 2));
- pfts.ptszFiles[pfts.totalFiles++] = mir_tstrdup(path);
+ pfts.ptszFiles[pfts.totalFiles++] = mir_wstrdup(path);
pfts.ptszFiles[pfts.totalFiles] = NULL;
FILE *file = _wfopen(path, L"rb");
diff --git a/plugins/Exchange/src/MirandaExchange.cpp b/plugins/Exchange/src/MirandaExchange.cpp index 346ca7471b..a60992410f 100644 --- a/plugins/Exchange/src/MirandaExchange.cpp +++ b/plugins/Exchange/src/MirandaExchange.cpp @@ -116,17 +116,17 @@ CKeeper::CKeeper( LPTSTR szSender, LPTSTR szSubject, LPSTR szEntryID) m_nSizeEntryID = 0 ;
if (NULL != szSender) {
- m_nSizeSender = (UINT)mir_tstrlen(szSender)+1;
+ m_nSizeSender = (UINT)mir_wstrlen(szSender)+1;
m_szSender = new wchar_t[ m_nSizeSender ];
memset(m_szSender, 0, m_nSizeSender * sizeof(wchar_t));
- mir_tstrcpy(m_szSender, szSender);
+ mir_wstrcpy(m_szSender, szSender);
}
if (NULL != szSubject) {
- m_nSizeSubject = (UINT)mir_tstrlen(szSubject) +1;
+ m_nSizeSubject = (UINT)mir_wstrlen(szSubject) +1;
m_szSubject = new wchar_t[m_nSizeSubject];
memset(m_szSubject, 0, m_nSizeSubject * sizeof(wchar_t));
- mir_tstrcpy(m_szSubject, szSubject);
+ mir_wstrcpy(m_szSubject, szSubject);
}
if (NULL != szEntryID) {
@@ -392,32 +392,32 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass short nSizeOfTCHAR = sizeof( wchar_t );
if (m_szUsername == NULL && NULL != szUsername) {
- nSize = (UINT)mir_tstrlen(szUsername);
+ nSize = (UINT)mir_wstrlen(szUsername);
if (nSize > 0) {
nSize++;
m_szUsername = new wchar_t[nSize];
memset ( m_szUsername, 0, nSize * nSizeOfTCHAR );
- mir_tstrcpy( m_szUsername, szUsername );
+ mir_wstrcpy( m_szUsername, szUsername );
}
}
if (m_szPassword == NULL && NULL != szPassword) {
- nSize = (UINT)mir_tstrlen(szPassword);
+ nSize = (UINT)mir_wstrlen(szPassword);
if (nSize > 0) {
nSize++;
m_szPassword = new wchar_t[nSize];
memset(m_szPassword, 0, nSize * nSizeOfTCHAR);
- mir_tstrcpy(m_szPassword, szPassword);
+ mir_wstrcpy(m_szPassword, szPassword);
}
}
if (m_szExchangeServer == NULL && NULL != szExchangeServer) {
- nSize = (UINT)mir_tstrlen(szExchangeServer);
+ nSize = (UINT)mir_wstrlen(szExchangeServer);
if (nSize > 0) {
nSize++;
m_szExchangeServer = new wchar_t[nSize];
memset(m_szExchangeServer, 0, nSize * nSizeOfTCHAR);
- mir_tstrcpy(m_szExchangeServer, szExchangeServer);
+ mir_wstrcpy(m_szExchangeServer, szExchangeServer);
}
}
@@ -436,7 +436,7 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass _wstrtime(szPID);
wcsncpy(szPIDandName, m_szUsername, _countof(szPIDandName)-1);
- mir_tstrncat(szPIDandName, szPID, _countof(szPIDandName) - mir_tstrlen(szPIDandName));
+ mir_wstrncat(szPIDandName, szPID, _countof(szPIDandName) - mir_wstrlen(szPIDandName));
hr = CreateProfile(szPIDandName);
if ( HR_FAILED(hr)) {
@@ -446,7 +446,7 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass DWORD dwFlags = MAPI_EXPLICIT_PROFILE|MAPI_EXTENDED|MAPI_NEW_SESSION|MAPI_NO_MAIL ;
- hr = MAPILogonEx( 0, (LPTSTR)mir_t2a(szPIDandName), (LPTSTR)mir_t2a(m_szPassword), dwFlags, &m_lpMAPISession );
+ hr = MAPILogonEx( 0, (LPTSTR)mir_u2a(szPIDandName), (LPTSTR)mir_u2a(m_szPassword), dwFlags, &m_lpMAPISession );
if (FAILED(hr)) {
//Log( L"MAPI Logon failed: 0x%08X", hr );
@@ -461,7 +461,7 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass //Log("Admin profile interface creation failed: 0x%08X", hr);
}
else {
- hr = pProfAdmin->DeleteProfile( (LPTSTR)mir_t2a(szPIDandName), 0 );
+ hr = pProfAdmin->DeleteProfile( (LPTSTR)mir_u2a(szPIDandName), 0 );
if ( FAILED(hr) )
{
//Log( "Failed to delete the profile: 0x%08X", hr );
@@ -527,13 +527,13 @@ HRESULT CMirandaExchange::CreateProfile( LPTSTR szProfileName ) hr = MAPIAdminProfiles(ulFlags, &pProfAdmin);
if (FAILED(hr) || pProfAdmin == NULL)
return hr;
- hr = pProfAdmin->CreateProfile((LPTSTR)mir_t2a(szProfileName), NULL, NULL, ulFlags);
+ hr = pProfAdmin->CreateProfile((LPTSTR)mir_u2a(szProfileName), NULL, NULL, ulFlags);
if (FAILED(hr)) {
- pProfAdmin->DeleteProfile((LPTSTR)mir_t2a(szProfileName), ulFlags);
+ pProfAdmin->DeleteProfile((LPTSTR)mir_u2a(szProfileName), ulFlags);
return hr;
}
- hr = pProfAdmin->AdminServices( (LPTSTR)mir_t2a(szProfileName), NULL, NULL, ulFlags, &pMsgSvcAdmin);
+ hr = pProfAdmin->AdminServices( (LPTSTR)mir_u2a(szProfileName), NULL, NULL, ulFlags, &pMsgSvcAdmin);
if (FAILED(hr) || pMsgSvcAdmin == NULL)
return hr;
@@ -562,7 +562,7 @@ HRESULT CMirandaExchange::CreateProfile( LPTSTR szProfileName ) if (FAILED(hr))
return hr;
- nSize = mir_tstrlen(m_szUsername);
+ nSize = mir_wstrlen(m_szUsername);
szUniqName = (wchar_t*)mir_alloc(sizeof(wchar_t) * (nSize + 4));
if (szUniqName != NULL) {
memcpy(szUniqName, L"=", sizeof(wchar_t));
@@ -570,9 +570,9 @@ HRESULT CMirandaExchange::CreateProfile( LPTSTR szProfileName ) // Set values for PR_PROFILE_UNRESOLVED_NAME and PR_PROFILE_UNRESOLVED_SERVER
SPropValue spval[2];
spval[0].ulPropTag = PR_PROFILE_UNRESOLVED_NAME;
- spval[0].Value.lpszA = mir_t2a(szUniqName);
+ spval[0].Value.lpszA = mir_u2a(szUniqName);
spval[1].ulPropTag = PR_PROFILE_UNRESOLVED_SERVER;
- spval[1].Value.lpszA = mir_t2a(m_szExchangeServer);
+ spval[1].Value.lpszA = mir_u2a(m_szExchangeServer);
// Configure msg service
/*hr =*/ pMsgSvcAdmin->ConfigureMsgService(
@@ -867,8 +867,8 @@ HRESULT CMirandaExchange::OpenTheMessage( LPTSTR ) if ( NULL != szTheEnd )
{
- szRegValue[ mir_tstrlen(szRegValue) - mir_tstrlen(szTheEnd) +5 ] = '\0';
- mir_tstrcat( szRegValue, L" /recycle" );
+ szRegValue[ mir_wstrlen(szRegValue) - mir_wstrlen(szTheEnd) +5 ] = '\0';
+ mir_wstrcat( szRegValue, L" /recycle" );
STARTUPINFO si;
PROCESS_INFORMATION pi;
diff --git a/plugins/Exchange/src/dlg_handlers.cpp b/plugins/Exchange/src/dlg_handlers.cpp index 4032a748e6..93e5cde48f 100644 --- a/plugins/Exchange/src/dlg_handlers.cpp +++ b/plugins/Exchange/src/dlg_handlers.cpp @@ -242,7 +242,7 @@ INT_PTR CALLBACK DlgProcEmails(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam item.pszText = email.szSender;
ListView_InsertItem(hList, &item);
ListView_SetItemText(hList, i, 1, email.szSubject);
- ListView_SetItemText(hList, i, 2, mir_a2t(email.emailID));
+ ListView_SetItemText(hList, i, 2, mir_a2u(email.emailID));
}
SetFocus(hList);
}
diff --git a/plugins/Exchange/src/emails.cpp b/plugins/Exchange/src/emails.cpp index f38bc7335c..5f22aa6a29 100644 --- a/plugins/Exchange/src/emails.cpp +++ b/plugins/Exchange/src/emails.cpp @@ -68,7 +68,7 @@ int CExchangeServer::Connect(int bForceConnect) GetStringFromDatabase("Server", L"", server, _countof(server));
int port = db_get_dw(NULL, ModuleName, "Port", EXCHANGE_PORT);
- if (mir_tstrlen(server) > 0) //only connect if there's a server to connect to
+ if (mir_wstrlen(server) > 0) //only connect if there's a server to connect to
return DoConnect(user, password, server, port);
_popupUtil(TranslateT("Server is not configured..."));
@@ -155,7 +155,7 @@ int CExchangeServer::IsServerAvailable() wchar_t szServer[1024];
GetStringFromDatabase("Server", L"", szServer, sizeof(szServer));
sockaddr_in addrServer;
- InitSocketAddr(&addrServer, mir_t2a(szServer));
+ InitSocketAddr(&addrServer, mir_u2a(szServer));
int res = connect(sServer, (sockaddr *) &addrServer, sizeof(addrServer));
int bAvailable = 0;
if (!res) {
@@ -279,9 +279,9 @@ int CExchangeServer::Check(int bNoEmailsNotify) if (((count > 0) || ((bNoEmailsNotify) && (count >= 0))) && (count != -1)) {
wchar_t buffer[1024];
if (count != 1)
- mir_sntprintf(buffer, TranslateT("You have %d unread emails..."), count);
+ mir_snwprintf(buffer, TranslateT("You have %d unread emails..."), count);
else
- mir_sntprintf(buffer, TranslateT("You have one unread email..."));
+ mir_snwprintf(buffer, TranslateT("You have one unread email..."));
ShowMessage(buffer, count);
}
diff --git a/plugins/Exchange/src/utils.cpp b/plugins/Exchange/src/utils.cpp index 9b5204a0cb..e65843eb88 100644 --- a/plugins/Exchange/src/utils.cpp +++ b/plugins/Exchange/src/utils.cpp @@ -115,7 +115,7 @@ int GetStringFromDatabase(char *szSettingName, wchar_t *szError, wchar_t *szResu dbv.type = DBVT_ASCIIZ;
if (db_get_ts(NULL, ModuleName, szSettingName, &dbv) == 0) {
res = 0;
- size_t tmp = mir_tstrlen(dbv.ptszVal);
+ size_t tmp = mir_wstrlen(dbv.ptszVal);
size_t len = (tmp < size - 1) ? tmp : size - 1;
wcsncpy(szResult, dbv.ptszVal, len);
szResult[len] = '\0';
@@ -123,7 +123,7 @@ int GetStringFromDatabase(char *szSettingName, wchar_t *szError, wchar_t *szResu }
else {
res = 1;
- size_t tmp = mir_tstrlen(szError);
+ size_t tmp = mir_wstrlen(szError);
size_t len = (tmp < size - 1) ? tmp : size - 1;
wcsncpy(szResult, szError, len);
szResult[len] = '\0';
diff --git a/plugins/ExternalAPI/m_variables.h b/plugins/ExternalAPI/m_variables.h index d80bb06e9b..daadc28c60 100644 --- a/plugins/ExternalAPI/m_variables.h +++ b/plugins/ExternalAPI/m_variables.h @@ -157,7 +157,7 @@ __inline static TCHAR *variables_parsedup(TCHAR *tszFormat, TCHAR *tszExtraText, if (tszParsed)
return tszParsed;
}
- return tszFormat ? mir_tstrdup(tszFormat) : tszFormat;
+ return tszFormat ? mir_wstrdup(tszFormat) : tszFormat;
}
__inline static TCHAR *variables_parsedup_ex(TCHAR *tszFormat, TCHAR *tszExtraText, MCONTACT hContact,
@@ -175,7 +175,7 @@ __inline static TCHAR *variables_parsedup_ex(TCHAR *tszFormat, TCHAR *tszExtraTe if (tszParsed)
return tszParsed;
}
- return tszFormat ? mir_tstrdup(tszFormat) : tszFormat;
+ return tszFormat ? mir_wstrdup(tszFormat) : tszFormat;
}
#endif
@@ -517,7 +517,7 @@ __inline static int variables_skin_helpbutton(HWND hwndDlg, UINT uIDButton) { hIcon = (HICON)CallService(MS_VARS_GETSKINITEM, 0, (LPARAM)VSI_HELPICON);
GetClassName(GetDlgItem(hwndDlg, uIDButton), tszClass, _countof(tszClass));
- if (!mir_tstrcmp(tszClass, L"Button")) {
+ if (!mir_wstrcmp(tszClass, L"Button")) {
if (hIcon != NULL) {
SetWindowLongPtr(GetDlgItem(hwndDlg, uIDButton), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, uIDButton), GWL_STYLE)|BS_ICON);
SendMessage(GetDlgItem(hwndDlg, uIDButton), BM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)hIcon);
@@ -527,7 +527,7 @@ __inline static int variables_skin_helpbutton(HWND hwndDlg, UINT uIDButton) { SetDlgItemText(hwndDlg, uIDButton, L"V");
}
}
- else if (!mir_tstrcmp(tszClass, MIRANDABUTTONCLASS)) {
+ else if (!mir_wstrcmp(tszClass, MIRANDABUTTONCLASS)) {
if (hIcon != NULL) {
char *szTipInfo = NULL;
diff --git a/plugins/FTPFileYM/src/dialog.cpp b/plugins/FTPFileYM/src/dialog.cpp index 39192e6583..06c914070c 100644 --- a/plugins/FTPFileYM/src/dialog.cpp +++ b/plugins/FTPFileYM/src/dialog.cpp @@ -131,7 +131,7 @@ void UploadDialog::Tab::select() void UploadDialog::Tab::labelCompleted()
{
wchar_t buff[64], buff2[256];
- mir_sntprintf(buff2, L"* %s", Utils::getTextFragment(m_job->m_tszFileName, 20, buff));
+ mir_snwprintf(buff2, L"* %s", Utils::getTextFragment(m_job->m_tszFileName, 20, buff));
TCITEM tab = { 0 };
tab.mask = TCIF_TEXT;
@@ -293,11 +293,11 @@ INT_PTR CALLBACK UploadDialog::UploadDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar AppendMenu(hTimeMenu, MF_SEPARATOR, 0, 0);
if (i < 3)
- mir_sntprintf(buff, TranslateT("%d minutes"), times[i]);
+ mir_snwprintf(buff, TranslateT("%d minutes"), times[i]);
else if (i < 7)
- mir_sntprintf(buff, TranslateT("%d hours"), times[i] / 60);
+ mir_snwprintf(buff, TranslateT("%d hours"), times[i] / 60);
else
- mir_sntprintf(buff, TranslateT("%d days"), times[i] / 60 / 24);
+ mir_snwprintf(buff, TranslateT("%d days"), times[i] / 60 / 24);
UINT check = MF_UNCHECKED;
if (!bChecked && tab->m_iOptAutoDelete == times[i]) {
@@ -310,9 +310,9 @@ INT_PTR CALLBACK UploadDialog::UploadDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar if (opt.bAutoDelete) {
switch (opt.timeRange) {
- case Options::TR_MINUTES: mir_sntprintf(buff, TranslateT("%d minutes"), opt.iDeleteTime); break;
- case Options::TR_HOURS: mir_sntprintf(buff, TranslateT("%d hours"), opt.iDeleteTime); break;
- case Options::TR_DAYS: mir_sntprintf(buff, TranslateT("%d days"), opt.iDeleteTime); break;
+ case Options::TR_MINUTES: mir_snwprintf(buff, TranslateT("%d minutes"), opt.iDeleteTime); break;
+ case Options::TR_HOURS: mir_snwprintf(buff, TranslateT("%d hours"), opt.iDeleteTime); break;
+ case Options::TR_DAYS: mir_snwprintf(buff, TranslateT("%d days"), opt.iDeleteTime); break;
}
AppendMenu(hTimeMenu, MF_SEPARATOR, 0, 0);
diff --git a/plugins/FTPFileYM/src/ftpfile.cpp b/plugins/FTPFileYM/src/ftpfile.cpp index c5e4d548b3..f2681e24c4 100644 --- a/plugins/FTPFileYM/src/ftpfile.cpp +++ b/plugins/FTPFileYM/src/ftpfile.cpp @@ -112,7 +112,7 @@ void InitMenuItems() for (int i = 0; i < ServerList::FTP_COUNT; i++) {
if (DB::getStringF(0, MODULE, "Name%d", i, stzName))
- mir_sntprintf(stzName, TranslateT("FTP Server %d"), i + 1);
+ mir_snwprintf(stzName, TranslateT("FTP Server %d"), i + 1);
mi.root = (opt.bUseSubmenu) ? hMenu : 0;
mi.hIcolibItem = iconList[i].hIcolib;
diff --git a/plugins/FTPFileYM/src/job_delete.cpp b/plugins/FTPFileYM/src/job_delete.cpp index 2449d1e91a..858bb9e58e 100644 --- a/plugins/FTPFileYM/src/job_delete.cpp +++ b/plugins/FTPFileYM/src/job_delete.cpp @@ -89,8 +89,8 @@ void DeleteJob::run() DBEntry::remove(m_entry->m_fileID);
}
else if (manDlg != NULL && m_treeItem) {
- wchar_t *error = mir_a2t(szError);
- mir_tstrcpy(m_treeItem->m_tszToolTip, error);
+ wchar_t *error = mir_a2u(szError);
+ mir_wstrcpy(m_treeItem->m_tszToolTip, error);
m_treeItem->setState(Manager::TreeItem::_ERROR());
FREE(error);
}
diff --git a/plugins/FTPFileYM/src/job_generic.cpp b/plugins/FTPFileYM/src/job_generic.cpp index 9d4adf6013..ddeb5ee282 100644 --- a/plugins/FTPFileYM/src/job_generic.cpp +++ b/plugins/FTPFileYM/src/job_generic.cpp @@ -41,8 +41,8 @@ GenericJob::GenericJob(GenericJob *job) : m_ftp(job->m_ftp),
m_tab(job->m_tab)
{
- mir_tstrcpy(m_tszFilePath, job->m_tszFilePath);
- mir_tstrcpy(m_tszFileName, job->m_tszFileName);
+ mir_wstrcpy(m_tszFilePath, job->m_tszFilePath);
+ mir_wstrcpy(m_tszFileName, job->m_tszFileName);
mir_strcpy(m_szSafeFileName, job->m_szSafeFileName);
}
@@ -55,7 +55,7 @@ GenericJob::~GenericJob() int GenericJob::openFileDialog()
{
wchar_t temp[MAX_PATH] = L"";
- mir_sntprintf(temp, L"%s\0*.*\0", TranslateT("All Files (*.*)"));
+ mir_snwprintf(temp, L"%s\0*.*\0", TranslateT("All Files (*.*)"));
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = 0;
@@ -87,14 +87,14 @@ void GenericJob::getFilesFromOpenDialog() {
wchar_t stzFile[MAX_PATH];
- size_t length = mir_tstrlen(m_tszFilePath);
+ size_t length = mir_wstrlen(m_tszFilePath);
if (m_tszFilePath[0] && m_tszFilePath[length + 1]) // multiple files
{
wchar_t *ptr = m_tszFilePath + length + 1;
while (ptr[0]) {
- mir_sntprintf(stzFile, L"%s\\%s", m_tszFilePath, ptr);
+ mir_snwprintf(stzFile, L"%s\\%s", m_tszFilePath, ptr);
addFile(stzFile);
- ptr += mir_tstrlen(ptr) + 1;
+ ptr += mir_wstrlen(ptr) + 1;
}
}
else {
@@ -116,7 +116,7 @@ int GenericJob::getFilesFromFolder(wchar_t *stzFolder) HANDLE hFind = FindFirstFile(L"*.*", &ffd);
while (hFind != INVALID_HANDLE_VALUE) {
if (!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
- mir_sntprintf(stzFile, L"%s\\%s", stzFolder, ffd.cFileName);
+ mir_snwprintf(stzFile, L"%s\\%s", stzFolder, ffd.cFileName);
addFile(stzFile);
}
@@ -154,9 +154,9 @@ int GenericJob::getFiles(void **objects, int objCount, DWORD flags) if (m_mode == FTP_ZIPFOLDER) {
wchar_t *folder;
if (flags & FUPL_UNICODE)
- folder = mir_u2t((wchar_t *)objects[0]);
+ folder = mir_wstrdup((wchar_t *)objects[0]);
else
- folder = mir_a2t((char *)objects[0]);
+ folder = mir_a2u((char *)objects[0]);
int result = getFilesFromFolder(folder);
FREE(folder);
@@ -166,9 +166,9 @@ int GenericJob::getFiles(void **objects, int objCount, DWORD flags) for (int i = 0; i < objCount; i++) {
wchar_t *fileName;
if (flags & FUPL_UNICODE)
- fileName = mir_u2t((wchar_t *)objects[i]);
+ fileName = mir_wstrdup((wchar_t *)objects[i]);
else
- fileName = mir_a2t((char *)objects[i]);
+ fileName = mir_a2u((char *)objects[i]);
addFile(fileName);
FREE(fileName);
@@ -180,7 +180,7 @@ int GenericJob::getFiles(void **objects, int objCount, DWORD flags) void GenericJob::addFile(wchar_t *fileName)
{
- wchar_t *buff = mir_tstrdup(fileName);
+ wchar_t *buff = mir_wstrdup(fileName);
m_files.push_back(buff);
}
diff --git a/plugins/FTPFileYM/src/job_packer.cpp b/plugins/FTPFileYM/src/job_packer.cpp index 135b06e665..29ec91c4b8 100644 --- a/plugins/FTPFileYM/src/job_packer.cpp +++ b/plugins/FTPFileYM/src/job_packer.cpp @@ -39,27 +39,27 @@ void PackerJob::getZipFilePath() wchar_t *pch;
if (m_files.size() == 1) {
- mir_tstrcpy(stzFileName, Utils::getFileNameFromPath(m_files[0]));
+ mir_wstrcpy(stzFileName, Utils::getFileNameFromPath(m_files[0]));
pch = wcsrchr(stzFileName, '.');
if (pch) *pch = 0;
}
else {
- mir_tstrcpy(buff, m_files[0]);
+ mir_wstrcpy(buff, m_files[0]);
pch = wcsrchr(buff, '\\');
if (pch) {
*pch = 0;
pch = wcsrchr(buff, '\\');
- if (pch) mir_tstrcpy(stzFileName, pch + 1);
+ if (pch) mir_wstrcpy(stzFileName, pch + 1);
}
}
if (stzFileName[0] == '\0')
- mir_tstrcpy(stzFileName, L"archive");
+ mir_wstrcpy(stzFileName, L"archive");
GetTempPath(_countof(buff), buff);
- mir_sntprintf(m_tszFilePath, L"%s%s.zip", buff, stzFileName);
- mir_tstrcpy(m_tszFileName, Utils::getFileNameFromPath(m_tszFilePath));
+ mir_snwprintf(m_tszFilePath, L"%s%s.zip", buff, stzFileName);
+ mir_wstrcpy(m_tszFileName, Utils::getFileNameFromPath(m_tszFilePath));
if (opt.bSetZipName)
Utils::setFileNameDlg(m_tszFileName);
@@ -156,7 +156,7 @@ int PackerJob::createZipFile() getFileTime(m_files[i], &zi.tmz_date, &zi.dosDate);
- char *file = mir_t2a(Utils::getFileNameFromPath(m_files[i]));
+ char *file = mir_u2a(Utils::getFileNameFromPath(m_files[i]));
int err = zipOpenNewFileInZip(zf, file, &zi, NULL, 0, NULL, 0, NULL, Z_DEFLATED, opt.iCompressionLevel);
FREE(file);
@@ -233,10 +233,10 @@ void PackerJob::updateStats() m_lastUpdateTick = dwNewTick;
double speed = ((double)m_uiReaded / 1024) / (time(NULL) - m_startTS);
- mir_sntprintf(m_tab->m_stzSpeed, TranslateT("%0.1f kB/s"), speed);
+ mir_snwprintf(m_tab->m_stzSpeed, TranslateT("%0.1f kB/s"), speed);
double perc = m_uiFileSize ? ((double)m_uiReaded / m_uiFileSize) * 100 : 0;
- mir_sntprintf(m_tab->m_stzComplet, TranslateT("%0.1f%% (%d kB/%d kB)"), perc, (int)m_uiReaded / 1024, (int)m_uiFileSize / 1024);
+ mir_snwprintf(m_tab->m_stzComplet, TranslateT("%0.1f%% (%d kB/%d kB)"), perc, (int)m_uiReaded / 1024, (int)m_uiFileSize / 1024);
wchar_t buff[256];
long s = (m_uiFileSize - m_uiReaded) / (long)(speed * 1024);
@@ -245,9 +245,9 @@ void PackerJob::updateStats() int m = (s - d * 60 * 60 * 24 - h * 60 * 60) / 60;
s = s - (d * 24 * 60 * 60) - (h * 60 * 60) - (m * 60);
- if (d > 0) mir_sntprintf(buff, L"%dd %02d:%02d:%02d", d, h, m, s);
- else mir_sntprintf(buff, L"%02d:%02d:%02d", h, m, s);
- mir_sntprintf(m_tab->m_stzRemain, TranslateT("%s (%d kB/%d kB)"), buff, (m_uiFileSize - m_uiReaded) / 1024, m_uiFileSize / 1024);
+ if (d > 0) mir_snwprintf(buff, L"%dd %02d:%02d:%02d", d, h, m, s);
+ else mir_snwprintf(buff, L"%02d:%02d:%02d", h, m, s);
+ mir_snwprintf(m_tab->m_stzRemain, TranslateT("%s (%d kB/%d kB)"), buff, (m_uiFileSize - m_uiReaded) / 1024, m_uiFileSize / 1024);
refreshTab(false);
}
@@ -313,6 +313,6 @@ void PackerJob::closeAllTabs() void PackerJob::createToolTip()
{
- mir_sntprintf(uDlg->m_tszToolTipText, TranslateT("Status: %s\r\nFile: %s\r\nServer: %S"),
+ mir_snwprintf(uDlg->m_tszToolTipText, TranslateT("Status: %s\r\nFile: %s\r\nServer: %S"),
getStatusString(), m_tszFileName, m_ftp->m_szServer);
}
diff --git a/plugins/FTPFileYM/src/job_upload.cpp b/plugins/FTPFileYM/src/job_upload.cpp index b6c1e9a20c..5bd60536f5 100644 --- a/plugins/FTPFileYM/src/job_upload.cpp +++ b/plugins/FTPFileYM/src/job_upload.cpp @@ -64,8 +64,8 @@ void UploadJob::addToUploadDlg() {
for (UINT i = 0; i < m_files.size(); i++) {
UploadJob *jobCopy = new UploadJob(this);
- mir_tstrcpy(jobCopy->m_tszFilePath, m_files[i]);
- mir_tstrcpy(jobCopy->m_tszFileName, Utils::getFileNameFromPath(jobCopy->m_tszFilePath));
+ mir_wstrcpy(jobCopy->m_tszFilePath, m_files[i]);
+ mir_wstrcpy(jobCopy->m_tszFileName, Utils::getFileNameFromPath(jobCopy->m_tszFilePath));
Utils::makeSafeString(jobCopy->m_tszFileName, jobCopy->m_szSafeFileName);
UploadDialog::Tab *newTab = new UploadDialog::Tab(jobCopy);
@@ -246,8 +246,8 @@ INT_PTR CALLBACK UploadJob::DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wPa TranslateDialogDefault(hwndDlg);
{
wchar_t buff[256];
- wchar_t *fileName = mir_a2t((char *)lParam);
- mir_sntprintf(buff, TranslateT("File exists - %s"), fileName);
+ wchar_t *fileName = mir_a2u((char *)lParam);
+ mir_snwprintf(buff, TranslateT("File exists - %s"), fileName);
SetWindowText(hwndDlg, buff);
FREE(fileName);
}
@@ -391,10 +391,10 @@ void UploadJob::updateStats() m_avgSpeed /= _countof(m_lastSpeed) + 1;
m_lastSpeed[0] = speed;
- mir_sntprintf(m_tab->m_stzSpeed, L"%0.1f kB/s", m_avgSpeed);
+ mir_snwprintf(m_tab->m_stzSpeed, L"%0.1f kB/s", m_avgSpeed);
double perc = m_uiFileSize ? ((double)m_uiTotalSent / m_uiFileSize) * 100 : 0;
- mir_sntprintf(m_tab->m_stzComplet, L"%0.1f%% (%d kB/%d kB)", perc, (int)m_uiTotalSent / 1024, (int)m_uiFileSize / 1024);
+ mir_snwprintf(m_tab->m_stzComplet, L"%0.1f%% (%d kB/%d kB)", perc, (int)m_uiTotalSent / 1024, (int)m_uiFileSize / 1024);
long s = (m_uiFileSize - m_uiTotalSent) / (long)(m_avgSpeed * 1024);
int d = (s / 60 / 60 / 24);
@@ -403,9 +403,9 @@ void UploadJob::updateStats() s = s - (d * 24 * 60 * 60) - (h * 60 * 60) - (m * 60);
wchar_t buff[256];
- if (d > 0) mir_sntprintf(buff, L"%dd %02d:%02d:%02d", d, h, m, s);
- else mir_sntprintf(buff, L"%02d:%02d:%02d", h, m, s);
- mir_sntprintf(m_tab->m_stzRemain, L"%s (%d kB/%d kB)", buff, (m_uiFileSize - m_uiTotalSent) / 1024, m_uiFileSize / 1024);
+ if (d > 0) mir_snwprintf(buff, L"%dd %02d:%02d:%02d", d, h, m, s);
+ else mir_snwprintf(buff, L"%02d:%02d:%02d", h, m, s);
+ mir_snwprintf(m_tab->m_stzRemain, L"%s (%d kB/%d kB)", buff, (m_uiFileSize - m_uiTotalSent) / 1024, m_uiFileSize / 1024);
refreshTab(false);
}
@@ -493,10 +493,10 @@ void UploadJob::closeAllTabs() void UploadJob::createToolTip()
{
- mir_sntprintf(uDlg->m_tszToolTipText, TranslateT("Status: %s\r\nFile: %s\r\nServer: %S"),
+ mir_snwprintf(uDlg->m_tszToolTipText, TranslateT("Status: %s\r\nFile: %s\r\nServer: %S"),
getStatusString(), m_tszFileName, m_ftp->m_szServer);
if (m_tab->m_stzSpeed[0] && m_tab->m_stzComplet[0] && m_tab->m_stzRemain[0])
- mir_sntprintf(uDlg->m_tszToolTipText, TranslateT("%s\r\nSpeed: %s\r\nCompleted: %s\r\nRemaining: %s"),
+ mir_snwprintf(uDlg->m_tszToolTipText, TranslateT("%s\r\nSpeed: %s\r\nCompleted: %s\r\nRemaining: %s"),
uDlg->m_tszToolTipText, m_tab->m_stzSpeed, m_tab->m_stzComplet, m_tab->m_stzRemain);
}
diff --git a/plugins/FTPFileYM/src/manager.cpp b/plugins/FTPFileYM/src/manager.cpp index d838e77884..84e648bcfd 100644 --- a/plugins/FTPFileYM/src/manager.cpp +++ b/plugins/FTPFileYM/src/manager.cpp @@ -121,7 +121,7 @@ void Manager::fillTree() DBEntry *entry = DBEntry::getFirst();
while (entry != NULL) {
if ((UINT)entry->m_iFtpNum < m_rootItems.size()) {
- tvi.item.pszText = mir_a2t(entry->m_szFileName);
+ tvi.item.pszText = mir_a2u(entry->m_szFileName);
tvi.hParent = m_rootItems[entry->m_iFtpNum]->m_handle;
HTREEITEM hItem = TreeView_InsertItem(m_hwndFileTree, &tvi);
AddLeaf(hItem, tvi.hParent, entry->m_fileID);
diff --git a/plugins/FTPFileYM/src/mir_db.cpp b/plugins/FTPFileYM/src/mir_db.cpp index e14e2caccc..dadc502028 100644 --- a/plugins/FTPFileYM/src/mir_db.cpp +++ b/plugins/FTPFileYM/src/mir_db.cpp @@ -98,7 +98,7 @@ int DB::getString(MCONTACT hContact, char *szModule, char *szSetting, wchar_t *b {
DBVARIANT dbv;
if (!db_get_ts(hContact, szModule, szSetting, &dbv)) {
- mir_tstrcpy(buff, dbv.ptszVal);
+ mir_wstrcpy(buff, dbv.ptszVal);
db_free(&dbv);
return 0;
}
diff --git a/plugins/FTPFileYM/src/serverlist.cpp b/plugins/FTPFileYM/src/serverlist.cpp index b5be374920..b4a854b3d1 100644 --- a/plugins/FTPFileYM/src/serverlist.cpp +++ b/plugins/FTPFileYM/src/serverlist.cpp @@ -64,7 +64,7 @@ void ServerList::saveToDb() const ServerList::FTP::FTP(int index)
{
if (DB::getStringF(0, MODULE, "Name%d", index, m_stzName))
- mir_sntprintf(m_stzName, TranslateT("FTP Server %d"), index + 1);
+ mir_snwprintf(m_stzName, TranslateT("FTP Server %d"), index + 1);
DB::getAStringF(0, MODULE, "Password%d", index, m_szPass);
DB::getAStringF(0, MODULE, "Server%d", index, m_szServer);
diff --git a/plugins/FTPFileYM/src/utils.cpp b/plugins/FTPFileYM/src/utils.cpp index d15a706055..eb2c8a2dc1 100644 --- a/plugins/FTPFileYM/src/utils.cpp +++ b/plugins/FTPFileYM/src/utils.cpp @@ -67,10 +67,10 @@ wchar_t* Utils::getFileNameFromPath(wchar_t *stzPath) wchar_t* Utils::getTextFragment(wchar_t *stzText, size_t length, wchar_t *buff)
{
- if (mir_tstrlen(stzText) > length) {
- mir_tstrcpy(buff, stzText);
+ if (mir_wstrlen(stzText) > length) {
+ mir_wstrcpy(buff, stzText);
buff[length - 1] = 0;
- mir_tstrcat(buff, L"...");
+ mir_wstrcat(buff, L"...");
return buff;
}
@@ -97,7 +97,7 @@ const char to_chars[] = "abvgdeezziiklmnoprstufhccwwqyqeuaABVGDEEZZIIKLMNOPRSTUF char* Utils::makeSafeString(wchar_t *input, char *output)
{
- char *buff = mir_t2a(input);
+ char *buff = mir_u2a(input);
size_t length = mir_strlen(buff);
for (UINT i = 0; i < length; i++) {
@@ -166,7 +166,7 @@ INT_PTR CALLBACK Utils::DlgProcSetFileName(HWND hwndDlg, UINT msg, WPARAM wParam if (GetDlgCtrlID((HWND)wParam) != IDC_NAME) {
SetFocus(GetDlgItem(hwndDlg, IDC_NAME));
- SendDlgItemMessage(hwndDlg, IDC_NAME, EM_SETSEL, 0, mir_tstrlen(fileName) - 4);
+ SendDlgItemMessage(hwndDlg, IDC_NAME, EM_SETSEL, 0, mir_wstrlen(fileName) - 4);
return FALSE;
}
@@ -200,13 +200,13 @@ bool Utils::setFileNameDlg(wchar_t *nameBuff) bool Utils::setFileNameDlgA(char *nameBuff)
{
wchar_t buff[64];
- wchar_t *tmp = mir_a2t(nameBuff);
- mir_tstrcpy(buff, tmp);
+ wchar_t *tmp = mir_a2u(nameBuff);
+ mir_wstrcpy(buff, tmp);
FREE(tmp);
bool res = setFileNameDlg(buff);
if (res) {
- char *p = mir_t2a(buff);
+ char *p = mir_u2a(buff);
mir_strcpy(nameBuff, p);
FREE(p);
}
diff --git a/plugins/FavContacts/src/contact_cache.cpp b/plugins/FavContacts/src/contact_cache.cpp index fb837cdd09..632875cf57 100644 --- a/plugins/FavContacts/src/contact_cache.cpp +++ b/plugins/FavContacts/src/contact_cache.cpp @@ -116,9 +116,9 @@ float CContactCache::getWeight(int rate) static bool AppendInfo(wchar_t *buf, int size, MCONTACT hContact, int info)
{
- ptrT str(Contact_GetInfo(info, hContact));
+ ptrW str(Contact_GetInfo(info, hContact));
if (str != NULL) {
- mir_tstrncpy(buf, str, size);
+ mir_wstrncpy(buf, str, size);
return true;
}
@@ -140,7 +140,7 @@ void CContactCache::TContactInfo::LoadInfo() for (int i = 0; i < _countof(items); ++i)
if (AppendInfo(p, _countof(info) - (p - info), hContact, items[i]))
- p += mir_tstrlen(p) + 1;
+ p += mir_wstrlen(p) + 1;
*p = 0;
@@ -155,8 +155,8 @@ wchar_t *nb_stristr(wchar_t *str, wchar_t *substr) wchar_t *str_up = NEWWSTR_ALLOCA(str);
wchar_t *substr_up = NEWWSTR_ALLOCA(substr);
- CharUpperBuff(str_up, (DWORD)mir_tstrlen(str_up));
- CharUpperBuff(substr_up, (DWORD)mir_tstrlen(substr_up));
+ CharUpperBuff(str_up, (DWORD)mir_wstrlen(str_up));
+ CharUpperBuff(substr_up, (DWORD)mir_wstrlen(substr_up));
wchar_t *p = wcsstr(str_up, substr_up);
return p ? (str + (p - str_up)) : NULL;
@@ -177,7 +177,7 @@ bool CContactCache::filter(int rate, wchar_t *str) for (int iLayout = 0; iLayout < nKbdLayouts; ++iLayout) {
if (kbdLayoutActive == kbdLayouts[iLayout])
- mir_tstrcpy(buf, str);
+ mir_wstrcpy(buf, str);
else {
int i;
for (i = 0; str[i]; ++i) {
@@ -188,7 +188,7 @@ bool CContactCache::filter(int rate, wchar_t *str) buf[i] = 0;
}
- for (wchar_t *p = m_cache[rate]->info; p && *p; p = p + mir_tstrlen(p) + 1)
+ for (wchar_t *p = m_cache[rate]->info; p && *p; p = p + mir_wstrlen(p) + 1)
if (nb_stristr(p, buf))
return true;
}
diff --git a/plugins/FavContacts/src/favlist.h b/plugins/FavContacts/src/favlist.h index 91245327d7..3cbb4a8285 100644 --- a/plugins/FavContacts/src/favlist.h +++ b/plugins/FavContacts/src/favlist.h @@ -17,13 +17,13 @@ public: bManual(_bManual),
fRate(_fRate)
{
- name = mir_tstrdup(pcli->pfnGetContactDisplayName(hContact, 0));
+ name = mir_wstrdup(pcli->pfnGetContactDisplayName(hContact, 0));
if (g_Options.bUseGroups) {
if ((group = db_get_tsa(hContact, "CList", "Group")) == NULL)
- group = mir_tstrdup(TranslateT("<no group>"));
+ group = mir_wstrdup(TranslateT("<no group>"));
}
- else group = mir_tstrdup(TranslateT("Favorite Contacts"));
+ else group = mir_wstrdup(TranslateT("Favorite Contacts"));
status = db_get_w(hContact, GetContactProto(hContact), "Status", ID_STATUS_OFFLINE);
}
@@ -56,8 +56,8 @@ public: }
int res = 0;
- if (res = mir_tstrcmp(p1->group, p2->group)) return res;
- if (res = mir_tstrcmp(p1->name, p2->name)) return res;
+ if (res = mir_wstrcmp(p1->group, p2->group)) return res;
+ if (res = mir_wstrcmp(p1->name, p2->name)) return res;
return 0;
}
};
@@ -85,7 +85,7 @@ private: TContactInfo *info = new TContactInfo(hContact, bManual);
insert(info);
wchar_t *group = info->getGroup();
- if (prevGroup && mir_tstrcmp(prevGroup, group))
+ if (prevGroup && mir_wstrcmp(prevGroup, group))
++nGroups;
prevGroup = group;
return 1;
diff --git a/plugins/FavContacts/src/menu.cpp b/plugins/FavContacts/src/menu.cpp index 15c2f3189e..64568587c2 100644 --- a/plugins/FavContacts/src/menu.cpp +++ b/plugins/FavContacts/src/menu.cpp @@ -47,7 +47,7 @@ static BOOL sttMeasureItem_Group(LPMEASUREITEMSTRUCT lpmis, Options *options) SelectObject(hdc, g_Options.hfntName);
SIZE sz;
- GetTextExtentPoint32(hdc, name, (int)mir_tstrlen(name), &sz);
+ GetTextExtentPoint32(hdc, name, (int)mir_wstrlen(name), &sz);
lpmis->itemHeight = sz.cy + 8;
lpmis->itemWidth = sz.cx + 10;
SelectObject(hdc, hfntSave);
@@ -81,7 +81,7 @@ static BOOL sttMeasureItem_Contact(LPMEASUREITEMSTRUCT lpmis, Options *options) if (!options->bSysColors)
SelectObject(hdc, g_Options.hfntSecond);
- GetTextExtentPoint32(hdc, title, (int)mir_tstrlen(title), &sz);
+ GetTextExtentPoint32(hdc, title, (int)mir_wstrlen(title), &sz);
textWidth = sz.cx;
lpmis->itemHeight += sz.cy + 3;
@@ -92,7 +92,7 @@ static BOOL sttMeasureItem_Contact(LPMEASUREITEMSTRUCT lpmis, Options *options) wchar_t *name = (wchar_t *)pcli->pfnGetContactDisplayName(hContact, 0);
if (!options->bSysColors) SelectObject(hdc, g_Options.hfntName);
- GetTextExtentPoint32(hdc, name, (int)mir_tstrlen(name), &sz);
+ GetTextExtentPoint32(hdc, name, (int)mir_wstrlen(name), &sz);
textWidth = max(textWidth, sz.cx);
SelectObject(hdc, hfntSave);
@@ -309,7 +309,7 @@ static BOOL sttDrawItem_Contact(LPDRAWITEMSTRUCT lpdis, Options *options = NULL) DrawText(hdcTemp, name, -1, &lpdis->rcItem, DT_NOPREFIX | DT_SINGLELINE | DT_TOP | DT_LEFT);
SIZE sz;
- GetTextExtentPoint32(hdcTemp, name, (int)mir_tstrlen(name), &sz);
+ GetTextExtentPoint32(hdcTemp, name, (int)mir_wstrlen(name), &sz);
lpdis->rcItem.top += sz.cy + 3;
}
@@ -390,13 +390,13 @@ static LRESULT CALLBACK MenuHostWndProc(HWND hwnd, UINT message, WPARAM wParam, RemoveMenu((HMENU)lParam, 1, MF_BYPOSITION);
if (LOWORD(wParam) == VK_BACK) {
- if (size_t l = mir_tstrlen(g_filter))
+ if (size_t l = mir_wstrlen(g_filter))
g_filter[l - 1] = 0;
}
else if (iswalnum(LOWORD(wParam))) {
- if (mir_tstrlen(g_filter) < _countof(g_filter) - 1) {
+ if (mir_wstrlen(g_filter) < _countof(g_filter) - 1) {
wchar_t s[] = { LOWORD(wParam), 0 };
- mir_tstrcat(g_filter, s);
+ mir_wstrcat(g_filter, s);
}
}
{
@@ -465,7 +465,7 @@ int ShowMenu(bool centered) mis.CtlID = 0;
mis.CtlType = ODT_MENU;
- if (!prevGroup || mir_tstrcmp(prevGroup, favList[i]->getGroup())) {
+ if (!prevGroup || mir_wstrcmp(prevGroup, favList[i]->getGroup())) {
if (prevGroup && g_Options.bUseColumns) {
szMenu.cx += szColumn.cx;
szMenu.cy = max(szMenu.cy, szColumn.cy);
diff --git a/plugins/FavContacts/src/services.cpp b/plugins/FavContacts/src/services.cpp index 556e0ebbaa..00a053b996 100644 --- a/plugins/FavContacts/src/services.cpp +++ b/plugins/FavContacts/src/services.cpp @@ -128,27 +128,27 @@ int ProcessReloadFonts(WPARAM, LPARAM) LOGFONT lf = { 0 };
FontIDT fontid = { sizeof(fontid) };
- mir_tstrcpy(fontid.group, LPGENW("Favorite Contacts"));
- mir_tstrcpy(fontid.name, LPGENW("Contact name"));
+ mir_wstrcpy(fontid.group, LPGENW("Favorite Contacts"));
+ mir_wstrcpy(fontid.name, LPGENW("Contact name"));
g_Options.clLine1 = CallService(MS_FONT_GETT, (WPARAM)&fontid, (LPARAM)&lf);
g_Options.hfntName = CreateFontIndirect(&lf);
- mir_tstrcpy(fontid.name, LPGENW("Second line"));
+ mir_wstrcpy(fontid.name, LPGENW("Second line"));
g_Options.clLine2 = CallService(MS_FONT_GETT, (WPARAM)&fontid, (LPARAM)&lf);
g_Options.hfntSecond = CreateFontIndirect(&lf);
- mir_tstrcpy(fontid.name, LPGENW("Selected contact name (color)"));
+ mir_wstrcpy(fontid.name, LPGENW("Selected contact name (color)"));
g_Options.clLine1Sel = CallService(MS_FONT_GETT, (WPARAM)&fontid, (LPARAM)&lf);
- mir_tstrcpy(fontid.name, LPGENW("Selected second line (color)"));
+ mir_wstrcpy(fontid.name, LPGENW("Selected second line (color)"));
g_Options.clLine2Sel = CallService(MS_FONT_GETT, (WPARAM)&fontid, (LPARAM)&lf);
ColourIDT colourid = { sizeof(colourid) };
- mir_tstrcpy(colourid.group, LPGENW("Favorite Contacts"));
- mir_tstrcpy(colourid.name, LPGENW("Background"));
+ mir_wstrcpy(colourid.group, LPGENW("Favorite Contacts"));
+ mir_wstrcpy(colourid.name, LPGENW("Background"));
g_Options.clBack = CallService(MS_COLOUR_GETT, (WPARAM)&colourid, (LPARAM)&lf);
- mir_tstrcpy(colourid.name, LPGENW("Selected background"));
+ mir_wstrcpy(colourid.name, LPGENW("Selected background"));
g_Options.clBackSel = CallService(MS_COLOUR_GETT, (WPARAM)&colourid, (LPARAM)&lf);
return 0;
@@ -171,38 +171,38 @@ int ProcessModulesLoaded(WPARAM, LPARAM) /////////////////////////////////////////////////////////////////////////////////////
FontIDT fontid = { sizeof(fontid) };
- mir_tstrcpy(fontid.group, LPGENW("Favorite Contacts"));
+ mir_wstrcpy(fontid.group, LPGENW("Favorite Contacts"));
mir_strcpy(fontid.dbSettingsGroup, "FavContacts");
- mir_tstrcpy(fontid.backgroundGroup, LPGENW("Favorite Contacts"));
+ mir_wstrcpy(fontid.backgroundGroup, LPGENW("Favorite Contacts"));
fontid.flags = FIDF_DEFAULTVALID;
fontid.deffontsettings.charset = DEFAULT_CHARSET;
fontid.deffontsettings.size = -11;
- mir_tstrcpy(fontid.deffontsettings.szFace, L"MS Shell Dlg");
+ mir_wstrcpy(fontid.deffontsettings.szFace, L"MS Shell Dlg");
fontid.deffontsettings.style = 0;
- mir_tstrcpy(fontid.backgroundName, LPGENW("Background"));
+ mir_wstrcpy(fontid.backgroundName, LPGENW("Background"));
- mir_tstrcpy(fontid.name, LPGENW("Contact name"));
+ mir_wstrcpy(fontid.name, LPGENW("Contact name"));
mir_strcpy(fontid.prefix, "fntName");
fontid.deffontsettings.colour = GetSysColor(COLOR_MENUTEXT);
fontid.deffontsettings.style = DBFONTF_BOLD;
FontRegisterT(&fontid);
- mir_tstrcpy(fontid.name, LPGENW("Second line"));
+ mir_wstrcpy(fontid.name, LPGENW("Second line"));
mir_strcpy(fontid.prefix, "fntSecond");
fontid.deffontsettings.colour = sttShadeColor(GetSysColor(COLOR_MENUTEXT), GetSysColor(COLOR_MENU));
fontid.deffontsettings.style = 0;
FontRegisterT(&fontid);
- mir_tstrcpy(fontid.backgroundName, LPGENW("Selected background"));
+ mir_wstrcpy(fontid.backgroundName, LPGENW("Selected background"));
- mir_tstrcpy(fontid.name, LPGENW("Selected contact name (color)"));
+ mir_wstrcpy(fontid.name, LPGENW("Selected contact name (color)"));
mir_strcpy(fontid.prefix, "fntNameSel");
fontid.deffontsettings.colour = GetSysColor(COLOR_HIGHLIGHTTEXT);
fontid.deffontsettings.style = DBFONTF_BOLD;
FontRegisterT(&fontid);
- mir_tstrcpy(fontid.name, LPGENW("Selected second line (color)"));
+ mir_wstrcpy(fontid.name, LPGENW("Selected second line (color)"));
mir_strcpy(fontid.prefix, "fntSecondSel");
fontid.deffontsettings.colour = sttShadeColor(GetSysColor(COLOR_HIGHLIGHTTEXT), GetSysColor(COLOR_HIGHLIGHT));
fontid.deffontsettings.style = 0;
@@ -211,15 +211,15 @@ int ProcessModulesLoaded(WPARAM, LPARAM) /////////////////////////////////////////////////////////////////////////////////////
ColourIDT colourid = { sizeof(colourid) };
- mir_tstrcpy(colourid.group, LPGENW("Favorite Contacts"));
+ mir_wstrcpy(colourid.group, LPGENW("Favorite Contacts"));
mir_strcpy(colourid.dbSettingsGroup, "FavContacts");
- mir_tstrcpy(colourid.name, LPGENW("Background"));
+ mir_wstrcpy(colourid.name, LPGENW("Background"));
mir_strcpy(colourid.setting, "BackColour");
colourid.defcolour = GetSysColor(COLOR_MENU);
ColourRegisterT(&colourid);
- mir_tstrcpy(colourid.name, LPGENW("Selected background"));
+ mir_wstrcpy(colourid.name, LPGENW("Selected background"));
mir_strcpy(colourid.setting, "SelectedColour");
colourid.defcolour = GetSysColor(COLOR_HIGHLIGHT);
ColourRegisterT(&colourid);
diff --git a/plugins/FileAsMessage/src/dialog.cpp b/plugins/FileAsMessage/src/dialog.cpp index ad2b494846..a9940f2437 100644 --- a/plugins/FileAsMessage/src/dialog.cpp +++ b/plugins/FileAsMessage/src/dialog.cpp @@ -101,13 +101,13 @@ void MakePopupMsg(HWND hDlg, MCONTACT hContact, char *msg) if (hDlg == hFocused || hDlg == GetParent(hFocused)) return;
//
- //The text for the second line. You could even make something like: char lpzText[128]; mir_tstrcpy(lpzText, "Hello world!"); It's your choice.
+ //The text for the second line. You could even make something like: char lpzText[128]; mir_wstrcpy(lpzText, "Hello world!"); It's your choice.
//
POPUPDATA ppd = { 0 };
ppd.lchContact = hContact;
ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_SMALLICON));
- mir_tstrcpy(ppd.lpzContactName, (char *)pcli->pfnGetContactDisplayName(hContact, 0));
- mir_tstrcpy(ppd.lpzText, msg);
+ mir_strcpy(ppd.lpzContactName, (char*)pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_strcpy(ppd.lpzText, msg);
ppd.colorBack = GetSysColor(COLOR_INFOBK);
ppd.colorText = GetSysColor(COLOR_INFOTEXT);
ppd.PluginWindowProc = (WNDPROC)PopupDlgProc;
@@ -618,7 +618,7 @@ void FILEECHO::onSendTimer() char prefix[128];
mir_snprintf(prefix, "%X,%X,%X>", chunkIndx + 1, chunkPos[chunkIndx], chksum);
#ifdef DEBUG
- overhead += mir_tstrlen((char*)buffer);
+ overhead += mir_wstrlen((char*)buffer);
#endif
sendCmd(0, CMD_DATA, (char*)buffer, (char*)prefix);
chunkAck[chunkIndx] = CHUNK_SENT;
@@ -844,18 +844,17 @@ void FILEECHO::perform(char *str) int FILEECHO::sendCmd(int id, int cmd, char *szParam, char *szPrefix)
{
- char *buf;
- int retval;
- int buflen = (int)mir_tstrlen(szServicePrefix) + (int)mir_tstrlen(szParam) + 2;
+ int buflen = (int)mir_strlen(szServicePrefix) + (int)mir_strlen(szParam) + 2;
if (szPrefix != NULL)
- buflen += (int)mir_tstrlen(szPrefix);
+ buflen += (int)mir_strlen(szPrefix);
- buf = (char*)malloc(buflen);
+ char *buf = (char*)malloc(buflen);
if (szPrefix == NULL)
mir_snprintf(buf, buflen, "%s%c%s", szServicePrefix, cCmdList[cmd], szParam);
else
mir_snprintf(buf, buflen, "%s%c%s%s", szServicePrefix, cCmdList[cmd], szPrefix, szParam);
- retval = ProtoChainSend(hContact, PSS_MESSAGE, 0, (LPARAM)buf);
+
+ int retval = ProtoChainSend(hContact, PSS_MESSAGE, 0, (LPARAM)buf);
free(buf);
updateProgress();
return retval;
diff --git a/plugins/FingerprintNG/src/fingerprint.cpp b/plugins/FingerprintNG/src/fingerprint.cpp index 4ca28bdac2..3d0f14b90c 100644 --- a/plugins/FingerprintNG/src/fingerprint.cpp +++ b/plugins/FingerprintNG/src/fingerprint.cpp @@ -57,7 +57,7 @@ void __fastcall Prepare(KN_FP_MASK* mask, bool bEnable) if (!mask->szMask || !bEnable) return; - size_t iMaskLen = mir_tstrlen(mask->szMask) + 1; + size_t iMaskLen = mir_wstrlen(mask->szMask) + 1; LPTSTR pszNewMask = (LPTSTR)HeapAlloc(hHeap, HEAP_NO_SERIALIZE, iMaskLen * sizeof(wchar_t)); wcscpy_s(pszNewMask, iMaskLen, mask->szMask); _wcsupr_s(pszNewMask, iMaskLen); @@ -147,7 +147,7 @@ static void SetSrmmIcon(MCONTACT hContact, LPTSTR ptszMirver) sid.flags = MBF_TCHAR; sid.tszTooltip = ptszMirver; - if (mir_tstrlen(ptszMirver)) + if (mir_wstrlen(ptszMirver)) sid.hIcon = (HICON)ServiceGetClientIconW((WPARAM)ptszMirver, TRUE); else sid.flags |= MBF_HIDDEN; @@ -326,7 +326,7 @@ void __fastcall GetIconsIndexesA(LPSTR szMirVer, short *base, short *overlay, sh return; } - LPTSTR tszMirVerUp = mir_a2t(szMirVer); + LPTSTR tszMirVerUp = mir_a2u(szMirVer); wcsupr(tszMirVerUp); MatchMasks(tszMirVerUp, base, overlay, overlay2, overlay3, overlay4); mir_free(tszMirVerUp); @@ -840,7 +840,7 @@ int OnExtraImageApply(WPARAM hContact, LPARAM) if (hContact == NULL) return 0; - ptrT tszMirver; + ptrW tszMirver; char *szProto = GetContactProto(hContact); if (szProto != NULL) tszMirver = db_get_tsa(hContact, szProto, "MirVer"); @@ -863,7 +863,7 @@ static int OnContactSettingChanged(WPARAM hContact, LPARAM lParam) if (cws && cws->szSetting && !strcmp(cws->szSetting, "MirVer")) { switch (cws->value.type) { case DBVT_UTF8: - ApplyFingerprintImage(hContact, ptrT(mir_utf8decodeT(cws->value.pszVal))); + ApplyFingerprintImage(hContact, ptrW(mir_utf8decodeW(cws->value.pszVal))); break; case DBVT_ASCIIZ: ApplyFingerprintImage(hContact, _A2T(cws->value.pszVal)); @@ -893,7 +893,7 @@ static int OnSrmmWindowEvent(WPARAM, LPARAM lParam) return 0; if (event->uType == MSG_WINDOW_EVT_OPEN) { - ptrT ptszMirVer; + ptrW ptszMirVer; char *szProto = GetContactProto(event->hContact); if (szProto != NULL) ptszMirVer = db_get_tsa(event->hContact, szProto, "MirVer"); diff --git a/plugins/FloatingContacts/src/bitmap_funcs.cpp b/plugins/FloatingContacts/src/bitmap_funcs.cpp index 4db3c8f07c..577bd7ecc7 100644 --- a/plugins/FloatingContacts/src/bitmap_funcs.cpp +++ b/plugins/FloatingContacts/src/bitmap_funcs.cpp @@ -699,7 +699,7 @@ void MyBitmap::DrawIcon(HICON hic, int x, int y, int w, int h) // slightly modified and integrated to MyBitmap class
void MyBitmap::DrawText(wchar_t *str, int x, int y, int blur, int strength)
{
- SIZE sz; GetTextExtentPoint32(this->getDC(), str, (int)mir_tstrlen(str), &sz);
+ SIZE sz; GetTextExtentPoint32(this->getDC(), str, (int)mir_wstrlen(str), &sz);
sz.cx += (blur + 2) * 2; sz.cy += (blur + 2) * 2;
x -= blur + 2; y -= blur + 2;
diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index ac8d80cadc..dbd018a81a 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -570,7 +570,7 @@ static void CreateBackgroundBrush() }
if (db_get_b(NULL, MODULE, "BkUseBitmap", FLT_DEFAULT_BKGNDUSEBITMAP)) {
- ptrT tszBitmapName(db_get_tsa(NULL, MODULE, "BkBitmap"));
+ ptrW tszBitmapName(db_get_tsa(NULL, MODULE, "BkBitmap"));
if (tszBitmapName != NULL)
hBmpBackground = Bitmap_Load(tszBitmapName);
}
diff --git a/plugins/FloatingContacts/src/thumbs.cpp b/plugins/FloatingContacts/src/thumbs.cpp index a5d901bdd6..e394581046 100644 --- a/plugins/FloatingContacts/src/thumbs.cpp +++ b/plugins/FloatingContacts/src/thumbs.cpp @@ -271,7 +271,7 @@ void ThumbInfo::ResizeThumb() // Get text and icon sizes
SIZEL sizeText;
- GetTextExtentPoint32(hdc, ptszName, (int)mir_tstrlen(ptszName), &sizeText);
+ GetTextExtentPoint32(hdc, ptszName, (int)mir_wstrlen(ptszName), &sizeText);
SelectObject(hdc, hOldFont);
@@ -624,7 +624,7 @@ void ThumbInfo::UpdateContent() hOldFont = (HFONT)SelectObject(hdcDraw, hFont[index]);
SIZE szText;
- GetTextExtentPoint32(hdcDraw, ptszName, (int)mir_tstrlen(ptszName), &szText);
+ GetTextExtentPoint32(hdcDraw, ptszName, (int)mir_wstrlen(ptszName), &szText);
SetTextColor(hdcDraw, bkColor);
// simple border
diff --git a/plugins/Folders/src/dlg_handlers.cpp b/plugins/Folders/src/dlg_handlers.cpp index 82a1b38d04..cc22e06423 100644 --- a/plugins/Folders/src/dlg_handlers.cpp +++ b/plugins/Folders/src/dlg_handlers.cpp @@ -37,7 +37,7 @@ static void LoadRegisteredFolderSections(HWND hWnd) for (int i = 0; i < lstRegisteredFolders.getCount(); i++) {
CFolderItem &tmp = lstRegisteredFolders[i];
- wchar_t *translated = mir_a2t(tmp.GetSection());
+ wchar_t *translated = mir_a2u(tmp.GetSection());
if (!ContainsSection(hWnd, TranslateTS(translated))) {
int idx = SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)TranslateTS(translated));
SendMessage(hwndList, LB_SETITEMDATA, idx, (LPARAM)tmp.GetSection());
@@ -105,7 +105,7 @@ static int ChangesNotSaved(HWND hWnd, PFolderItem item) wchar_t buffer[MAX_FOLDER_SIZE];
GetEditText(hWnd, buffer, MAX_FOLDER_SIZE);
- return mir_tstrcmp(item->GetFormat(), buffer) != 0;
+ return mir_wstrcmp(item->GetFormat(), buffer) != 0;
}
static void CheckForChanges(HWND hWnd, int bNeedConfirmation = 1)
@@ -123,7 +123,7 @@ static INT_PTR CALLBACK DlgProcVariables(HWND hWnd, UINT msg, WPARAM wParam, LPA switch (msg) {
case WM_INITDIALOG:
- mir_sntprintf(tszMessage, L"%s\r\n%s\r\n\r\n%s\t\t%s\r\n%%miranda_path%%\t\t%s\r\n%%profile_path%%\t\t%s\r\n\t\t\t%s\r\n%%current_profile%%\t\t%s\r\n\t\t\t%s\r\n\r\n\r\n%s\r\n%s\r\n%s\r\n%s\r\n%s\r\n%s\r\n\r\n%s\r\n%s\r\n%s\r\n%%miranda_path%%\t\t\t%s\r\n%%profile_path%%\t\t\t%s\r\n%%current_profile%%\t\t\t%s\r\n%%temp%%\t\t\t\t%s\r\n%%profile_path%%\\%%current_profile%%\t%s\r\n%%miranda_path%%\\plugins\\config\t%s\r\n' %%miranda_path%%\\\\\\\\ '\t\t%s\r\n\r\n%s",
+ mir_snwprintf(tszMessage, L"%s\r\n%s\r\n\r\n%s\t\t%s\r\n%%miranda_path%%\t\t%s\r\n%%profile_path%%\t\t%s\r\n\t\t\t%s\r\n%%current_profile%%\t\t%s\r\n\t\t\t%s\r\n\r\n\r\n%s\r\n%s\r\n%s\r\n%s\r\n%s\r\n%s\r\n\r\n%s\r\n%s\r\n%s\r\n%%miranda_path%%\t\t\t%s\r\n%%profile_path%%\t\t\t%s\r\n%%current_profile%%\t\t\t%s\r\n%%temp%%\t\t\t\t%s\r\n%%profile_path%%\\%%current_profile%%\t%s\r\n%%miranda_path%%\\plugins\\config\t%s\r\n' %%miranda_path%%\\\\\\\\ '\t\t%s\r\n\r\n%s",
TranslateT("Don't forget to click on Apply to save the changes. If you don't then the changes won't"),
TranslateT("be saved to the database, they will only be valid for this session."),
TranslateT("Variable string"),
diff --git a/plugins/Folders/src/folderItem.cpp b/plugins/Folders/src/folderItem.cpp index 9cc475593e..4a47eb5c7d 100644 --- a/plugins/Folders/src/folderItem.cpp +++ b/plugins/Folders/src/folderItem.cpp @@ -25,9 +25,9 @@ CFolderItem::CFolderItem(const char *sectionName, const char *name, const wchar_ m_szSection = mir_strdup(sectionName);
m_szName = mir_strdup(name);
if (userName)
- m_tszUserName = mir_tstrdup(userName);
+ m_tszUserName = mir_wstrdup(userName);
else
- m_tszUserName = mir_a2t(name);
+ m_tszUserName = mir_a2u(name);
m_tszFormat = NULL;
m_tszOldFormat = NULL;
GetDataFromDatabase(format);
@@ -47,7 +47,7 @@ void CFolderItem::SetFormat(const wchar_t *newFormat) {
mir_free(m_tszOldFormat);
m_tszOldFormat = m_tszFormat;
- m_tszFormat = mir_tstrdup(*newFormat ? newFormat : MIRANDA_PATHT);
+ m_tszFormat = mir_wstrdup(*newFormat ? newFormat : MIRANDA_PATHT);
}
int CFolderItem::IsEqual(const CFolderItem *other)
@@ -57,12 +57,12 @@ int CFolderItem::IsEqual(const CFolderItem *other) int CFolderItem::IsEqual(const char *section, const wchar_t *name)
{
- return !mir_tstrcmp(m_tszUserName, name) && !mir_strcmp(m_szSection, section);
+ return !mir_wstrcmp(m_tszUserName, name) && !mir_strcmp(m_szSection, section);
}
int CFolderItem::IsEqualTranslated(const char *trSection, const wchar_t *trName)
{
- return !mir_tstrcmp(TranslateTS(m_tszUserName), trName) && !mir_strcmp(Translate(m_szSection), trSection);
+ return !mir_wstrcmp(TranslateTS(m_tszUserName), trName) && !mir_strcmp(Translate(m_szSection), trSection);
}
int CFolderItem::operator ==(const CFolderItem *other)
@@ -100,7 +100,7 @@ int CFolderItem::FolderDeleteOldDirectory(int showFolder) if (!m_tszOldFormat)
return FOLDER_SUCCESS;
- if (!mir_tstrcmp(m_tszFormat, m_tszOldFormat)) //format wasn't changed
+ if (!mir_wstrcmp(m_tszFormat, m_tszOldFormat)) //format wasn't changed
return FOLDER_SUCCESS;
CMString buffer(ExpandPath(m_tszOldFormat));
@@ -117,7 +117,7 @@ void CFolderItem::GetDataFromDatabase(const wchar_t *szNotFound) strcpy_s(szSettingName, _countof(szSettingName), m_szSection);
strcat_s(szSettingName, _countof(szSettingName), m_szName);
- ptrT tszValue(db_get_tsa(NULL, ModuleName, szSettingName));
+ ptrW tszValue(db_get_tsa(NULL, ModuleName, szSettingName));
SetFormat(tszValue != NULL ? tszValue : szNotFound);
}
diff --git a/plugins/Folders/src/services.cpp b/plugins/Folders/src/services.cpp index de7669c4e9..c05f4ee007 100644 --- a/plugins/Folders/src/services.cpp +++ b/plugins/Folders/src/services.cpp @@ -87,7 +87,7 @@ int InitServices() pos = wcsrchr(szMirandaPath, '\\'); if (pos) *pos = 0;
wchar_t *szTemp = Utils_ReplaceVarsT(L"%miranda_userdata%");
- mir_sntprintf(szUserDataPath, szTemp);
+ mir_snwprintf(szUserDataPath, szTemp);
mir_free(szTemp);
CreateServiceFunction(MS_FOLDERS_GET_PATH, GetPathService);
diff --git a/plugins/Folders/src/utils.cpp b/plugins/Folders/src/utils.cpp index 2adc3b7035..f2fb0087af 100644 --- a/plugins/Folders/src/utils.cpp +++ b/plugins/Folders/src/utils.cpp @@ -25,7 +25,7 @@ CMString ExpandPath(const wchar_t *format) CMString res;
if (ServiceExists(MS_VARS_FORMATSTRING))
- res = VARST(ptrT(variables_parse((wchar_t*)format, NULL, NULL)));
+ res = VARST(ptrW(variables_parse((wchar_t*)format, NULL, NULL)));
else
res = VARST(format);
diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp index 9cad408bbd..e0f87a2171 100644 --- a/plugins/HTTPServer/src/main.cpp +++ b/plugins/HTTPServer/src/main.cpp @@ -900,7 +900,7 @@ extern "C" __declspec(dllexport) int Load() MessageBox(NULL, "Failed to retrieve plugin path.", MSG_BOX_TITEL, MB_OK);
return 1;
}
- mir_tstrncat(szPluginPath, "\\HTTPServer\\", _countof(szPluginPath) - mir_tstrlen(szPluginPath));
+ mir_strncat(szPluginPath, "\\HTTPServer\\", _countof(szPluginPath) - mir_strlen(szPluginPath));
int err = CreateDirectoryTree(szPluginPath);
if ((err != 0) && (err != ERROR_ALREADY_EXISTS)) {
MessageBox(NULL, "Failed to create HTTPServer directory.", MSG_BOX_TITEL, MB_OK);
diff --git a/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp b/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp index 812a828b6b..f17efc864a 100644 --- a/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp @@ -76,7 +76,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) SetClassLongPtr(hDlg, GCLP_HICON, (LONG_PTR)LoadIcon(hInst, MAKEINTRESOURCE(IDI_LINKLISTICON)));
WindowList_Add(hWindowList, hDlg, DlgParam->hContact);
- mir_sntprintf(title, L"%s [%s]", TranslateT("Linklist plugin"), pcli->pfnGetContactDisplayName(DlgParam->hContact, 0));
+ mir_snwprintf(title, L"%s [%s]", TranslateT("Linklist plugin"), pcli->pfnGetContactDisplayName(DlgParam->hContact, 0));
SetWindowText(hDlg, title);
GetFilterText(listMenu, filter, _countof(filter));
SetDlgItemText(hDlg, IDC_STATUS, filter);
@@ -170,7 +170,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) break;
EmptyClipboard();
- size_t dataLen = ((mir_tstrlen(link) + 1) * sizeof(wchar_t));
+ size_t dataLen = ((mir_wstrlen(link) + 1) * sizeof(wchar_t));
HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, dataLen);
memcpy((LPTSTR)GlobalLock(hData), link, dataLen);
GlobalUnlock(hData);
@@ -399,7 +399,7 @@ INT_PTR CALLBACK SearchDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara WriteLinkList(hListDlg, flags, DlgParam->listStart, buffer, 0);
mir_free(buffer);
}
- mir_sntprintf(filter, L"%s: %s", TXT_FILTER, TXT_SEARCHFILTER);
+ mir_snwprintf(filter, L"%s: %s", TXT_FILTER, TXT_SEARCHFILTER);
SetDlgItemText(hWndMain, IDC_STATUS, filter);
} break;
}
diff --git a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp index 7517494115..c267c1d03c 100644 --- a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp @@ -116,7 +116,7 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart) CharLower(wordsearch);
for (j = 0; j < _countof(hyperlinkPrefixes); j ++) {
- if (!wcsncmp(wordsearch, hyperlinkPrefixes[j], mir_tstrlen(hyperlinkPrefixes[j]))) {
+ if (!wcsncmp(wordsearch, hyperlinkPrefixes[j], mir_wstrlen(hyperlinkPrefixes[j]))) {
isLink = 1;
break;
}
@@ -305,7 +305,7 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc wcscpy_s(cf.szFaceName, L"Arial");
SendDlgItemMessage( hDlg, IDC_MAIN, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM) &cf);
- mir_sntprintf(searchText, L"%s '%s': %d\n\n", TranslateT("Matches for searchtext"), searchString, listCount);
+ mir_snwprintf(searchText, L"%s '%s': %d\n\n", TranslateT("Matches for searchtext"), searchString, listCount);
SendDlgItemMessage(hDlg, IDC_MAIN, EM_REPLACESEL, FALSE, (LPARAM)searchText);
linePos += 2;
}
@@ -401,7 +401,7 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc {
LPCTSTR type;
- if ( mir_tstrcmp(actualElement->date, lastDate) != 0 )
+ if ( mir_wstrcmp(actualElement->date, lastDate) != 0 )
{
memset(&cf, 0, sizeof(cf));
cf.cbSize = sizeof(cf);
@@ -454,7 +454,7 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc type = L"[UNK ]";
}
- mir_sntprintf(textLine, L"%s%s%s%s%s%s%s\n",
+ mir_snwprintf(textLine, L"%s%s%s%s%s%s%s\n",
options.showDirection ? (actualElement->direction==DIRECTION_IN?L"[in ]":L"[out]") : L"",
options.showDirection? L" " : L"",
options.showType ? type : L"",
@@ -660,17 +660,17 @@ void GetFilterText(HMENU listMenu, LPTSTR filter, size_t max_len) if ( GetMenuState(listMenu, IDM_DIR_IN, MF_BYCOMMAND) == MF_CHECKED )
{
//incoming URLs
- mir_sntprintf(filter, max_len, L"%s: %s %s", TXT_FILTER, TXT_INCOMING, TXT_URLSONLY);
+ mir_snwprintf(filter, max_len, L"%s: %s %s", TXT_FILTER, TXT_INCOMING, TXT_URLSONLY);
}
else if ( GetMenuState(listMenu, IDM_DIR_OUT, MF_BYCOMMAND) == MF_CHECKED )
{
//outgoing URLs
- mir_sntprintf(filter, max_len, L"%s: %s %s", TXT_FILTER, TXT_OUTGOING, TXT_URLSONLY);
+ mir_snwprintf(filter, max_len, L"%s: %s %s", TXT_FILTER, TXT_OUTGOING, TXT_URLSONLY);
}
else
{
// both directions (URL)
- mir_sntprintf(filter, max_len, L"%s: %s %s", TXT_FILTER, "", TXT_URLSONLY);
+ mir_snwprintf(filter, max_len, L"%s: %s %s", TXT_FILTER, "", TXT_URLSONLY);
}
}
else if ( GetMenuState(listMenu, IDM_TYPE_MAIL, MF_BYCOMMAND) == MF_CHECKED )
@@ -678,17 +678,17 @@ void GetFilterText(HMENU listMenu, LPTSTR filter, size_t max_len) if ( GetMenuState(listMenu, IDM_DIR_IN, MF_BYCOMMAND) == MF_CHECKED )
{
//incoming mail
- mir_sntprintf(filter, max_len, L"%s: %s %s", TXT_FILTER, TXT_INCOMING, TXT_MAILSONLY);
+ mir_snwprintf(filter, max_len, L"%s: %s %s", TXT_FILTER, TXT_INCOMING, TXT_MAILSONLY);
}
else if ( GetMenuState(listMenu, IDM_DIR_OUT, MF_BYCOMMAND) == MF_CHECKED )
{
//outgoing mail
- mir_sntprintf(filter, max_len, L"%s: %s %s", TXT_FILTER, TXT_OUTGOING, TXT_MAILSONLY);
+ mir_snwprintf(filter, max_len, L"%s: %s %s", TXT_FILTER, TXT_OUTGOING, TXT_MAILSONLY);
}
else
{
// both directions (mail)
- mir_sntprintf(filter, max_len, L"%s: %s %s", TXT_FILTER, "", TXT_MAILSONLY);
+ mir_snwprintf(filter, max_len, L"%s: %s %s", TXT_FILTER, "", TXT_MAILSONLY);
}
}
else
@@ -696,17 +696,17 @@ void GetFilterText(HMENU listMenu, LPTSTR filter, size_t max_len) if ( GetMenuState(listMenu, IDM_DIR_IN, MF_BYCOMMAND) == MF_CHECKED )
{
//incoming (both)
- mir_sntprintf(filter, max_len, L"%s: %s %s", TXT_FILTER, TXT_INCOMING, "");
+ mir_snwprintf(filter, max_len, L"%s: %s %s", TXT_FILTER, TXT_INCOMING, "");
}
else if ( GetMenuState(listMenu, IDM_DIR_OUT, MF_BYCOMMAND) == MF_CHECKED )
{
//outgoing (both)
- mir_sntprintf(filter, max_len, L"%s: %s %s", TXT_FILTER, TXT_OUTGOING, "");
+ mir_snwprintf(filter, max_len, L"%s: %s %s", TXT_FILTER, TXT_OUTGOING, "");
}
else
{
// no filter
- mir_sntprintf(filter, max_len, L"%s: %s %s", TXT_FILTER, TXT_NOFILTER, "");
+ mir_snwprintf(filter, max_len, L"%s: %s %s", TXT_FILTER, TXT_NOFILTER, "");
}
}
}
@@ -795,7 +795,7 @@ void GetListInfo(BYTE params, LISTELEMENT *listStart, LPCTSTR searchString, siz {
(*elementCount)++;
- tempLen = mir_tstrlen(actualElement->link);
+ tempLen = mir_wstrlen(actualElement->link);
if (*maxLen < tempLen)
*maxLen = tempLen;
}
@@ -1246,7 +1246,7 @@ BOOL SaveEditAsStream( HWND hDlg ) ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hDlg;
wchar_t temp[MAX_PATH];
- mir_sntprintf(temp, L"%s (*.rtf)%c*.rtf%c%s (*.*)%c*.*%c%c", TranslateT("RTF file"), 0, 0, TranslateT("All files"), 0, 0, 0);
+ mir_snwprintf(temp, L"%s (*.rtf)%c*.rtf%c%s (*.*)%c*.*%c%c", TranslateT("RTF file"), 0, 0, TranslateT("All files"), 0, 0, 0);
ofn.lpstrFilter = temp;
ofn.lpstrFile = szFilename;
ofn.nMaxFile = _countof(szFilename);
diff --git a/plugins/HistorySweeperLight/src/options.cpp b/plugins/HistorySweeperLight/src/options.cpp index b01f1c2f32..9744a5b889 100644 --- a/plugins/HistorySweeperLight/src/options.cpp +++ b/plugins/HistorySweeperLight/src/options.cpp @@ -119,12 +119,12 @@ void LoadSettings(HWND hwndDlg) SendDlgItemMessage(hwndDlg, IDC_SSKEEP, CB_RESETCONTENT, 0, 0);
for (i = 0; i < _countof(time_stamp_strings); i++) {
- ptrT ptszTimeStr(Langpack_PcharToTchar(time_stamp_strings[i]));
+ ptrW ptszTimeStr(Langpack_PcharToTchar(time_stamp_strings[i]));
SendDlgItemMessage(hwndDlg, IDC_SSOLDER, CB_ADDSTRING, 0, (LPARAM)ptszTimeStr);
}
for (i = 0; i < _countof(keep_strings); i++) {
- ptrT ptszTimeStr(Langpack_PcharToTchar(keep_strings[i]));
+ ptrW ptszTimeStr(Langpack_PcharToTchar(keep_strings[i]));
SendDlgItemMessage(hwndDlg, IDC_SSKEEP, CB_ADDSTRING, 0, (LPARAM)ptszTimeStr);
}
diff --git a/plugins/IEHistory/src/utils.cpp b/plugins/IEHistory/src/utils.cpp index 090033c533..d3a656f1c6 100644 --- a/plugins/IEHistory/src/utils.cpp +++ b/plugins/IEHistory/src/utils.cpp @@ -80,7 +80,7 @@ returns the name of a contact wchar_t* GetContactName(MCONTACT contact) { - ptrT name(Contact_GetInfo(CNF_DISPLAY, contact)); + ptrW name(Contact_GetInfo(CNF_DISPLAY, contact)); return (name) ? wcsdup(name) : NULL; } diff --git a/plugins/IEView/src/HTMLBuilder.cpp b/plugins/IEView/src/HTMLBuilder.cpp index c43c1dc415..8dd3337a13 100644 --- a/plugins/IEView/src/HTMLBuilder.cpp +++ b/plugins/IEView/src/HTMLBuilder.cpp @@ -88,7 +88,7 @@ char* HTMLBuilder::encodeUTF8(MCONTACT hContact, const char *proto, const wchar_ CMStringW str;
encode(hContact, proto, wtext, str, 0, flags, isSent);
- return mir_utf8encodeT(str);
+ return mir_utf8encodeW(str);
}
char* HTMLBuilder::encodeUTF8(MCONTACT hContact, const char *proto, const char *text, int flags, bool isSent)
@@ -104,7 +104,7 @@ char* HTMLBuilder::encodeUTF8(MCONTACT hContact, const char *proto, const char * if (text == NULL)
return NULL;
- ptrW wtext(mir_a2t_cp(text, cp));
+ ptrW wtext(mir_a2u_cp(text, cp));
return encodeUTF8(hContact, proto, wtext, flags, isSent);
}
@@ -184,11 +184,11 @@ void HTMLBuilder::getUINs(MCONTACT hContact, char *&uinIn, char *&uinOut) {
hContact = getRealContact(hContact);
- ptrT id(Contact_GetInfo(CNF_UNIQUEID, hContact));
- uinIn = mir_utf8encodeT(id ? id.get() : L"");
+ ptrW id(Contact_GetInfo(CNF_UNIQUEID, hContact));
+ uinIn = mir_utf8encodeW(id ? id.get() : L"");
id = Contact_GetInfo(CNF_UNIQUEID, NULL);
- uinOut = mir_utf8encodeT(id ? id.get() : L"");
+ uinOut = mir_utf8encodeW(id ? id.get() : L"");
}
wchar_t* HTMLBuilder::getContactName(MCONTACT hContact, const char *szProto)
@@ -203,9 +203,9 @@ wchar_t* HTMLBuilder::getContactName(MCONTACT hContact, const char *szProto) str = pcli->pfnGetContactDisplayName(hContact, 0);
if (str != NULL)
- return mir_tstrdup(str);
+ return mir_wstrdup(str);
- return mir_tstrdup(TranslateT("(Unknown Contact)"));
+ return mir_wstrdup(TranslateT("(Unknown Contact)"));
}
char* HTMLBuilder::getEncodedContactName(MCONTACT hContact, const char* szProto, const char* szSmileyProto)
@@ -302,13 +302,13 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event) }
else if (dbei.eventType == EVENTTYPE_AUTHREQUEST) {
//blob is: uin(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ)
- eventData->ptszText = mir_tstrdup(TranslateT(" requested authorization"));
+ eventData->ptszText = mir_wstrdup(TranslateT(" requested authorization"));
eventData->ptszNick = DbGetEventStringT(&dbei, (char *)dbei.pBlob + 8);
eventData->iType = IEED_EVENT_SYSTEM;
}
else if (dbei.eventType == EVENTTYPE_ADDED) {
//blob is: uin(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ)
- eventData->ptszText = mir_tstrdup(TranslateT(" was added."));
+ eventData->ptszText = mir_wstrdup(TranslateT(" was added."));
eventData->ptszNick = DbGetEventStringT(&dbei, (char *)dbei.pBlob + 8);
eventData->iType = IEED_EVENT_SYSTEM;
}
diff --git a/plugins/IEView/src/IEView.cpp b/plugins/IEView/src/IEView.cpp index adc87feb1b..8a4cddba29 100644 --- a/plugins/IEView/src/IEView.cpp +++ b/plugins/IEView/src/IEView.cpp @@ -168,7 +168,7 @@ void IEViewSink::PropertyChange(BSTR) {} void IEViewSink::BeforeNavigate2(IDispatch*, VARIANT* url, VARIANT*, VARIANT*, VARIANT*, VARIANT*, VARIANT_BOOL* cancel)
{
#ifndef GECKO
- if (mir_tstrcmp(url->bstrVal, L"about:blank"))
+ if (mir_wstrcmp(url->bstrVal, L"about:blank"))
{
Utils_OpenUrlT(url->bstrVal);
*cancel = VARIANT_TRUE;
@@ -989,7 +989,7 @@ void* IEView::getSelection(IEVIEWEVENT *event) if (event->cbSize >= IEVIEWEVENT_SIZE_V2)
cp = event->codepage;
- char *str = mir_t2a_cp(selectedText, cp);
+ char *str = mir_u2a_cp(selectedText, cp);
mir_free(selectedText);
selectedText = (BSTR)str;
}
diff --git a/plugins/IEView/src/Options.cpp b/plugins/IEView/src/Options.cpp index f99da29479..5e055c1cac 100644 --- a/plugins/IEView/src/Options.cpp +++ b/plugins/IEView/src/Options.cpp @@ -386,7 +386,7 @@ static void RefreshProtoList(HWND hwndDlg, int mode, bool protoTemplates) else
CallProtoService(proto->getProtocolName(), PS_GETNAME, sizeof(protoName), (LPARAM)protoName);
- tvi.item.pszText = mir_a2t(protoName);
+ tvi.item.pszText = mir_a2u(protoName);
tvi.item.lParam = (LPARAM)proto;
tvi.item.iImage = i;
tvi.item.iSelectedImage = i;
diff --git a/plugins/IEView/src/TemplateHTMLBuilder.cpp b/plugins/IEView/src/TemplateHTMLBuilder.cpp index c0712adff6..438fa6f6ef 100644 --- a/plugins/IEView/src/TemplateHTMLBuilder.cpp +++ b/plugins/IEView/src/TemplateHTMLBuilder.cpp @@ -53,11 +53,11 @@ char* TemplateHTMLBuilder::getAvatar(MCONTACT hContact, const char *szProto) }
}
if (!db_get_ts(hContact, "ContactPhoto", "File", &dbv)) {
- if (mir_tstrlen(dbv.ptszVal) > 0) {
+ if (mir_wstrlen(dbv.ptszVal) > 0) {
//wchar_t *ext = wcsrchr(dbv.ptszVal, '.');
if (result == NULL) {
/* relative -> absolute */
- mir_tstrcpy(tmpPath, dbv.ptszVal);
+ mir_wstrcpy(tmpPath, dbv.ptszVal);
if (wcsncmp(tmpPath, L"http://", 7))
PathToAbsoluteT(dbv.ptszVal, tmpPath);
result = tmpPath;
@@ -65,7 +65,7 @@ char* TemplateHTMLBuilder::getAvatar(MCONTACT hContact, const char *szProto) }
db_free(&dbv);
}
- char* res = mir_utf8encodeT(result);
+ char* res = mir_utf8encodeW(result);
Utils::convertPath(res);
return res;
}
@@ -157,7 +157,7 @@ void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, Pr wchar_t *szNoAvatarPathTmp = wcsrchr(szNoAvatarPath, '\\');
if (szNoAvatarPathTmp != NULL)
*szNoAvatarPathTmp = 0;
- mir_tstrcat(szNoAvatarPath, L"\\noavatar.png");
+ mir_wstrcat(szNoAvatarPath, L"\\noavatar.png");
if (_waccess(szNoAvatarPath, 0) == -1)
mir_snprintf(tempStr, "%snoavatar.jpg", tempBase);
else
@@ -178,7 +178,7 @@ void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, Pr db_free(&dbv);
}
- ptrT tszNick(Contact_GetInfo(CNF_NICK, event->hContact, szProto));
+ ptrW tszNick(Contact_GetInfo(CNF_NICK, event->hContact, szProto));
if (tszNick != NULL)
szNickIn = encodeUTF8(event->hContact, szRealProto, tszNick, ENF_NAMESMILEYS, true);
@@ -326,7 +326,7 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, wchar_t *szNoAvatarPathTmp = wcsrchr(szNoAvatarPath, '\\');
if (szNoAvatarPathTmp != NULL)
*szNoAvatarPathTmp = 0;
- mir_tstrcat(szNoAvatarPath, L"\\noavatar.png");
+ mir_wstrcat(szNoAvatarPath, L"\\noavatar.png");
if (_waccess(szNoAvatarPath, 0) == -1)
mir_snprintf(tempStr, "%snoavatar.jpg", tempBase);
else
@@ -352,7 +352,7 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, }
}
- ptrT tszNick(Contact_GetInfo(CNF_NICK, event->hContact, szProto));
+ ptrW tszNick(Contact_GetInfo(CNF_NICK, event->hContact, szProto));
if (tszNick != NULL)
szNickIn = encodeUTF8(event->hContact, szRealProto, tszNick, ENF_NAMESMILEYS, true);
diff --git a/plugins/IEView/src/TextToken.cpp b/plugins/IEView/src/TextToken.cpp index ab3441f5b6..1b77f1efb4 100644 --- a/plugins/IEView/src/TextToken.cpp +++ b/plugins/IEView/src/TextToken.cpp @@ -28,7 +28,7 @@ TextToken::TextToken(int _type, const char *_text, int _len) end = false;
type = _type;
text = mir_strndup(_text, _len);
- wtext = mir_a2t(text);
+ wtext = mir_a2u(text);
link = NULL;
wlink = NULL;
}
@@ -39,8 +39,8 @@ TextToken::TextToken(int _type, const wchar_t *_wtext, int _len) tag = 0;
end = false;
type = _type;
- wtext = mir_tstrndup(_wtext, _len);
- text = mir_t2a(wtext);
+ wtext = mir_wstrndup(_wtext, _len);
+ text = mir_u2a(wtext);
link = NULL;
wlink = NULL;
}
@@ -58,7 +58,7 @@ void TextToken::setLink(const char *_link) replaceStr(link, _link);
mir_free(wlink);
- this->wlink = mir_a2t(_link);
+ this->wlink = mir_a2u(_link);
}
void TextToken::setLink(const wchar_t *_link)
@@ -169,7 +169,7 @@ TextToken* TextToken::tokenizeBBCodes(const wchar_t *text, int l) newTokenType = BBCODE;
newTokenSize = k - i;
if (bbTagArg[j]) {
- wchar_t *urlLink = mir_tstrndup(text + tagArgStart, tagArgEnd - tagArgStart);
+ wchar_t *urlLink = mir_wstrndup(text + tagArgStart, tagArgEnd - tagArgStart);
bbToken->setLink(urlLink);
mir_free(urlLink);
}
diff --git a/plugins/IEView/src/ieview_main.cpp b/plugins/IEView/src/ieview_main.cpp index ecf69d2561..87997933dd 100644 --- a/plugins/IEView/src/ieview_main.cpp +++ b/plugins/IEView/src/ieview_main.cpp @@ -63,7 +63,7 @@ extern "C" int __declspec(dllexport) Load(void) wchar_t *workingDir = new wchar_t[wdsize];
GetCurrentDirectory(wdsize, workingDir);
Utils::convertPath(workingDir);
- workingDirUtf8 = mir_utf8encodeT(workingDir);
+ workingDirUtf8 = mir_utf8encodeW(workingDir);
delete[] workingDir;
mir_getLP(&pluginInfoEx);
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp index c19816d33c..2db83b8a7c 100644 --- a/plugins/Import/src/import.cpp +++ b/plugins/Import/src/import.cpp @@ -29,14 +29,14 @@ struct AccountMap AccountMap(const char *_src, int _origIdx, const wchar_t *_srcName) :
szSrcAcc(mir_strdup(_src)),
iSrcIndex(_origIdx),
- tszSrcName(mir_tstrdup(_srcName)),
+ tszSrcName(mir_wstrdup(_srcName)),
pa(NULL)
{}
~AccountMap() {}
ptrA szSrcAcc, szBaseProto;
- ptrT tszSrcName;
+ ptrW tszSrcName;
int iSrcIndex;
PROTOACCOUNT *pa;
};
@@ -77,7 +77,7 @@ void AddMessage(const wchar_t* fmt, ...) va_list args;
wchar_t msgBuf[4096];
va_start(args, fmt);
- mir_vsntprintf(msgBuf, _countof(msgBuf), TranslateTS(fmt), args);
+ mir_vsnwprintf(msgBuf, _countof(msgBuf), TranslateTS(fmt), args);
SendMessage(hdlgProgress, PROGM_ADDMESSAGE, 0, (LPARAM)msgBuf);
}
@@ -144,7 +144,7 @@ static MCONTACT HContactFromID(char *pszProtoName, char *pszSetting, wchar_t *pw char *szProto = GetContactProto(hContact);
if (!mir_strcmp(szProto, pszProtoName)) {
ptrW id(db_get_tsa(hContact, pszProtoName, pszSetting));
- if (!mir_tstrcmp(pwszID, id))
+ if (!mir_wstrcmp(pwszID, id))
return hContact;
}
}
@@ -259,7 +259,7 @@ static LRESULT CALLBACK ListWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM int idx = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM)accs[i]->tszAccountName);
SendMessage(hwndCombo, CB_SETITEMDATA, idx, (LPARAM)accs[i]);
- if (!mir_tstrcmpi(accs[i]->tszAccountName, tszText))
+ if (!mir_wstrcmpi(accs[i]->tszAccountName, tszText))
iSel = idx;
}
@@ -390,7 +390,7 @@ static PROTOACCOUNT* FindMyAccount(const char *szProto, const char *szBaseProto, if (pa->bOldProto || pa->bIsVirtual || pa->bDynDisabled)
return pa;
- if (ptszName && !mir_tstrcmp(pa->tszAccountName, ptszName))
+ if (ptszName && !mir_wstrcmp(pa->tszAccountName, ptszName))
return pa;
char *pszUniqueSetting = (char*)CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
@@ -430,7 +430,7 @@ bool ImportAccounts(OBJLIST<char> &arSkippedModules) continue;
itoa(800 + i, szSetting, 10);
- ptrT tszName(myGetWs(NULL, "Protocols", szSetting));
+ ptrW tszName(myGetWs(NULL, "Protocols", szSetting));
AccountMap *pNew = new AccountMap(szProto, i, tszName);
arAccountMap.insert(pNew);
@@ -498,7 +498,7 @@ bool ImportAccounts(OBJLIST<char> &arSkippedModules) p.pa->bIsEnabled = iVal != 0;
if (p.tszSrcName == NULL) {
- p.pa->tszAccountName = mir_a2t(p.pa->szModuleName);
+ p.pa->tszAccountName = mir_a2u(p.pa->szModuleName);
itoa(800 + p.pa->iOrder, szSetting, 10);
db_set_ts(NULL, "Protocols", szSetting, p.pa->tszAccountName);
}
@@ -663,7 +663,7 @@ void ImportMeta(DBCachedContact *ccSrc) return;
}
- ptrT tszGroup(myGetWs(ccSrc->contactID, "CList", "Group")), tszNick(myGetWs(ccSrc->contactID, "CList", "MyHandle"));
+ ptrW tszGroup(myGetWs(ccSrc->contactID, "CList", "Group")), tszNick(myGetWs(ccSrc->contactID, "CList", "MyHandle"));
if (tszNick == NULL)
tszNick = myGetWs(ccSrc->contactID, ccSrc->szProto, "Nick");
@@ -795,7 +795,7 @@ static MCONTACT ImportContact(MCONTACT hSrc) return NULL;
}
- ptrT tszGroup(myGetWs(hSrc, "CList", "Group")), tszNick(myGetWs(hSrc, "CList", "MyHandle"));
+ ptrW tszGroup(myGetWs(hSrc, "CList", "Group")), tszNick(myGetWs(hSrc, "CList", "MyHandle"));
if (tszNick == NULL)
tszNick = myGetWs(hSrc, cc->szProto, "Nick");
diff --git a/plugins/Import/src/miranda.cpp b/plugins/Import/src/miranda.cpp index dc4c5c86f8..bed803d016 100644 --- a/plugins/Import/src/miranda.cpp +++ b/plugins/Import/src/miranda.cpp @@ -33,7 +33,7 @@ static void SearchForLists(HWND hwndDlg, const wchar_t *mirandaPath, const wchar {
// find in Miranda profile subfolders
wchar_t searchspec[MAX_PATH];
- mir_sntprintf(searchspec, L"%s\\*.*", mirandaPath);
+ mir_snwprintf(searchspec, L"%s\\*.*", mirandaPath);
WIN32_FIND_DATA fd;
HANDLE hFind = FindFirstFile(searchspec, &fd);
@@ -42,20 +42,20 @@ static void SearchForLists(HWND hwndDlg, const wchar_t *mirandaPath, const wchar do {
// find all subfolders except "." and ".."
- if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || !mir_tstrcmp(fd.cFileName, L".") || !mir_tstrcmp(fd.cFileName, L".."))
+ if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || !mir_wstrcmp(fd.cFileName, L".") || !mir_wstrcmp(fd.cFileName, L".."))
continue;
// skip the current profile too
- if (mirandaProf != NULL && !mir_tstrcmpi(mirandaProf, fd.cFileName))
+ if (mirandaProf != NULL && !mir_wstrcmpi(mirandaProf, fd.cFileName))
continue;
wchar_t buf[MAX_PATH], profile[MAX_PATH];
- mir_sntprintf(buf, L"%s\\%s\\%s.dat", mirandaPath, fd.cFileName, fd.cFileName);
+ mir_snwprintf(buf, L"%s\\%s\\%s.dat", mirandaPath, fd.cFileName, fd.cFileName);
if (_waccess(buf, 0) == 0) {
- mir_sntprintf(profile, L"%s.dat", fd.cFileName);
+ mir_snwprintf(profile, L"%s.dat", fd.cFileName);
int i = SendDlgItemMessage(hwndDlg, IDC_LIST, LB_ADDSTRING, 0, (LPARAM)profile);
- SendDlgItemMessage(hwndDlg, IDC_LIST, LB_SETITEMDATA, i, (LPARAM)mir_tstrdup(buf));
+ SendDlgItemMessage(hwndDlg, IDC_LIST, LB_SETITEMDATA, i, (LPARAM)mir_wstrdup(buf));
}
}
while (FindNextFile(hFind, &fd));
@@ -78,7 +78,7 @@ INT_PTR CALLBACK MirandaPageProc(HWND hwndDlg, UINT message, WPARAM wParam, LPAR SearchForLists(hwndDlg, pfd2, pfn);
SearchForLists(hwndDlg, pfd1, NULL);
- if (mir_tstrcmpi(pfd, pfd2))
+ if (mir_wstrcmpi(pfd, pfd2))
SearchForLists(hwndDlg, pfd, NULL);
}
SendDlgItemMessage(hwndDlg, IDC_LIST, LB_SETCURSEL, 0, 0);
@@ -100,7 +100,7 @@ INT_PTR CALLBACK MirandaPageProc(HWND hwndDlg, UINT message, WPARAM wParam, LPAR MessageBox(hwndDlg, TranslateT("The given file does not exist. Please check that you have entered the name correctly."), TranslateT("Miranda Import"), MB_OK);
break;
}
- mir_tstrcpy(importFile, filename);
+ mir_wstrcpy(importFile, filename);
PostMessage(GetParent(hwndDlg), WIZM_GOTOPAGE, IDD_OPTIONS, (LPARAM)MirandaOptionsPageProc);
break;
@@ -119,11 +119,11 @@ INT_PTR CALLBACK MirandaPageProc(HWND hwndDlg, UINT message, WPARAM wParam, LPAR break;
case IDC_OTHER:
- ptrT pfd(Utils_ReplaceVarsT(L"%miranda_profilesdir%"));
+ ptrW pfd(Utils_ReplaceVarsT(L"%miranda_profilesdir%"));
wchar_t str[MAX_PATH], text[256];
GetDlgItemText(hwndDlg, IDC_FILENAME, str, _countof(str));
- mir_sntprintf(text, L"%s (*.dat, *.bak)%c*.dat;*.bak%c%s (*.*)%c*.*%c%c", TranslateT("Miranda NG database"), 0, 0, TranslateT("All Files"), 0, 0, 0);
+ mir_snwprintf(text, L"%s (*.dat, *.bak)%c*.dat;*.bak%c%s (*.*)%c*.*%c%c", TranslateT("Miranda NG database"), 0, 0, TranslateT("All Files"), 0, 0, 0);
OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
diff --git a/plugins/KeyboardNotify/src/flash.cpp b/plugins/KeyboardNotify/src/flash.cpp index bbbcc84da4..6f56a9552d 100644 --- a/plugins/KeyboardNotify/src/flash.cpp +++ b/plugins/KeyboardNotify/src/flash.cpp @@ -88,7 +88,7 @@ void setFlashingSequence(void) FLASHING_SEQUENCE *getCustomSeq(void)
{
- ptrT tszSeq( db_get_wsa(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", wCustomTheme)));
+ ptrW tszSeq( db_get_wsa(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", wCustomTheme)));
static FLASHING_SEQUENCE Custom = {0};
Custom = str2FS((tszSeq != 0) ? tszSeq : L"");
diff --git a/plugins/KeyboardNotify/src/keyboard.cpp b/plugins/KeyboardNotify/src/keyboard.cpp index 5fd5116dc5..eaa613c661 100644 --- a/plugins/KeyboardNotify/src/keyboard.cpp +++ b/plugins/KeyboardNotify/src/keyboard.cpp @@ -40,11 +40,11 @@ BOOL OpenKeyboardDevice() wchar_t aux1[MAX_PATH+1], aux2[MAX_PATH+1];
do {
- mir_sntprintf(aux1, L"Kbd%d", i);
- mir_sntprintf(aux2, L"\\Device\\KeyboardClass%d", i);
+ mir_snwprintf(aux1, L"Kbd%d", i);
+ mir_snwprintf(aux2, L"\\Device\\KeyboardClass%d", i);
DefineDosDevice(DDD_RAW_TARGET_PATH, aux1, aux2);
- mir_sntprintf(aux1, L"\\\\.\\Kbd%d", i);
+ mir_snwprintf(aux1, L"\\\\.\\Kbd%d", i);
hKbdDev[i] = CreateFile(aux1, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
} while (hKbdDev[i] != INVALID_HANDLE_VALUE && ++i < MAX_KBDHANDLES);
@@ -80,7 +80,7 @@ void CloseKeyboardDevice() if (hKbdDev[i] != INVALID_HANDLE_VALUE)
CloseHandle(hKbdDev[i]);
- mir_sntprintf(aux, L"Kbd%d", i);
+ mir_snwprintf(aux, L"Kbd%d", i);
DefineDosDevice(DDD_REMOVE_DEFINITION, aux, NULL);
} while (hKbdDev[i] != INVALID_HANDLE_VALUE && ++i < MAX_KBDHANDLES);
diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp index 3cafb2523b..2ccf62e6f1 100644 --- a/plugins/KeyboardNotify/src/main.cpp +++ b/plugins/KeyboardNotify/src/main.cpp @@ -829,12 +829,12 @@ void createEventPrefix(wchar_t *prefixName, size_t maxLen) while (str = wcschr(profileName, '\\'))
*str = '/';
- if ((len = mir_tstrlen(profileName)) <= maxLen)
+ if ((len = mir_wstrlen(profileName)) <= maxLen)
wcsncpy_s(prefixName, maxLen, profileName, _TRUNCATE);
else {
str = profileName + len - maxLen / 2;
wcsncpy_s(prefixName, (maxLen / 2), profileName, _TRUNCATE);
- mir_tstrcat(prefixName, str);
+ mir_wstrcat(prefixName, str);
}
}
@@ -914,9 +914,9 @@ static int ModulesLoaded(WPARAM, LPARAM) // Create some synchronisation objects
createEventPrefix(eventPrefix, MAX_PATH - 11);
- mir_sntprintf(eventName, L"%s/FlashEvent", eventPrefix);
+ mir_snwprintf(eventName, L"%s/FlashEvent", eventPrefix);
hFlashEvent = CreateEvent(NULL, FALSE, FALSE, eventName);
- mir_sntprintf(eventName, L"%s/ExitEvent", eventPrefix);
+ mir_snwprintf(eventName, L"%s/ExitEvent", eventPrefix);
hExitEvent = CreateEvent(NULL, FALSE, FALSE, eventName);
hThread = mir_forkthread(FlashThreadFunction, 0);
diff --git a/plugins/KeyboardNotify/src/options.cpp b/plugins/KeyboardNotify/src/options.cpp index 5f5f0bd92d..1fdc35eae0 100644 --- a/plugins/KeyboardNotify/src/options.cpp +++ b/plugins/KeyboardNotify/src/options.cpp @@ -46,14 +46,14 @@ static void writeThemeToCombo(const wchar_t *theme, const wchar_t *custom, BOOL int item = SendDlgItemMessage(hwndTheme, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme); if (item == CB_ERR) { item = SendDlgItemMessage(hwndTheme, IDC_THEME, CB_ADDSTRING, 0, (LPARAM)theme); - wchar_t *str = mir_tstrdup(custom); + wchar_t *str = mir_wstrdup(custom); SendDlgItemMessage(hwndTheme, IDC_THEME, CB_SETITEMDATA, (WPARAM)item, (LPARAM)str); } else if (overrideExisting) { wchar_t *str = (wchar_t *)SendDlgItemMessage(hwndTheme, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0); if (str) - mir_tstrcpy(str, custom); + mir_wstrcpy(str, custom); } } @@ -97,12 +97,12 @@ void importThemes(const wchar_t *filename, BOOL overrideExisting) for (str = buffer; *str && isspace(*str); str++); //ltrim if (!*str || *str == ';') //empty line or comment continue; - for (i = mir_tstrlen(str) - 1; isspace(str[i]); str[i--] = '\0'); //rtrim + for (i = mir_wstrlen(str) - 1; isspace(str[i]); str[i--] = '\0'); //rtrim switch (status) { case 0: if (i > 1 && str[0] == '[' && str[i] == ']') { status = 1; - mir_tstrcpy(theme, str + 1); + mir_wstrcpy(theme, str + 1); theme[i - 1] = '\0'; } break; @@ -127,7 +127,7 @@ static void createProcessListAux(void) if (!ProcessList.szFileName[i]) ProcessListAux.szFileName[i] = NULL; else { - ProcessListAux.szFileName[i] = mir_tstrdup(ProcessList.szFileName[i]); + ProcessListAux.szFileName[i] = mir_wstrdup(ProcessList.szFileName[i]); } } @@ -264,7 +264,7 @@ static INT_PTR CALLBACK DlgProcProcesses(HWND hwndDlg, UINT msg, WPARAM wParam, wchar_t szFileNameAux[MAX_PATH + 1]; SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_GETLBTEXT, (WPARAM)i, (LPARAM)szFileNameAux); - ProcessListAux.szFileName[i] = mir_tstrdup(szFileNameAux); + ProcessListAux.szFileName[i] = mir_wstrdup(szFileNameAux); } // fallthrough @@ -1162,15 +1162,15 @@ static INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wPara ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = hwndDlg; ofn.hInstance = NULL; - mir_tstrcpy(filter, TranslateT("Keyboard Notify Theme")); + mir_wstrcpy(filter, TranslateT("Keyboard Notify Theme")); mir_wstrcat(filter, L" (*.knt)"); - pfilter = filter + mir_tstrlen(filter) + 1; - mir_tstrcpy(pfilter, L"*.knt"); - pfilter = pfilter + mir_tstrlen(pfilter) + 1; - mir_tstrcpy(pfilter, TranslateT("All Files")); - pfilter = pfilter + mir_tstrlen(pfilter) + 1; - mir_tstrcpy(pfilter, L"*.*"); - pfilter = pfilter + mir_tstrlen(pfilter) + 1; + pfilter = filter + mir_wstrlen(filter) + 1; + mir_wstrcpy(pfilter, L"*.knt"); + pfilter = pfilter + mir_wstrlen(pfilter) + 1; + mir_wstrcpy(pfilter, TranslateT("All Files")); + pfilter = pfilter + mir_wstrlen(pfilter) + 1; + mir_wstrcpy(pfilter, L"*.*"); + pfilter = pfilter + mir_wstrlen(pfilter) + 1; *pfilter = '\0'; ofn.lpstrFilter = filter; ofn.lpstrFile = path; @@ -1190,15 +1190,15 @@ static INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wPara ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = hwndDlg; ofn.hInstance = NULL; - mir_tstrcpy(filter, TranslateT("Keyboard Notify Theme")); + mir_wstrcpy(filter, TranslateT("Keyboard Notify Theme")); mir_wstrcat(filter, L" (*.knt)"); - pfilter = filter + mir_tstrlen(filter) + 1; - mir_tstrcpy(pfilter, L"*.knt"); - pfilter = pfilter + mir_tstrlen(pfilter) + 1; - mir_tstrcpy(pfilter, TranslateT("All Files")); - pfilter = pfilter + mir_tstrlen(pfilter) + 1; - mir_tstrcpy(pfilter, L"*.*"); - pfilter = pfilter + mir_tstrlen(pfilter) + 1; + pfilter = filter + mir_wstrlen(filter) + 1; + mir_wstrcpy(pfilter, L"*.knt"); + pfilter = pfilter + mir_wstrlen(pfilter) + 1; + mir_wstrcpy(pfilter, TranslateT("All Files")); + pfilter = pfilter + mir_wstrlen(pfilter) + 1; + mir_wstrcpy(pfilter, L"*.*"); + pfilter = pfilter + mir_wstrlen(pfilter) + 1; *pfilter = '\0'; ofn.lpstrFilter = filter; ofn.lpstrFile = path; @@ -1227,7 +1227,7 @@ static INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wPara switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: if (szTheme = db_get_tsa(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", wCustomTheme))) { - mir_tstrcpy(theme, szTheme); + mir_wstrcpy(theme, szTheme); mir_free(szTheme); } else diff --git a/plugins/KeyboardNotify/src/utils.cpp b/plugins/KeyboardNotify/src/utils.cpp index b7d59819b8..f7d8bc4ab8 100644 --- a/plugins/KeyboardNotify/src/utils.cpp +++ b/plugins/KeyboardNotify/src/utils.cpp @@ -38,7 +38,7 @@ wchar_t *getAbsoluteProfileName(wchar_t *absoluteProfileName, size_t maxLen) profilePath[0] = profileName[0] = '\0';
CallService(MS_DB_GETPROFILEPATHT, MAX_PATH, (LPARAM)profilePath);
CallService(MS_DB_GETPROFILENAMET, MAX_PATH, (LPARAM)profileName);
- mir_sntprintf(absoluteProfileName, maxLen, L"%s\\%s", profilePath, profileName);
+ mir_snwprintf(absoluteProfileName, maxLen, L"%s\\%s", profilePath, profileName);
return absoluteProfileName;
}
diff --git a/plugins/ListeningTo/src/listeningto.cpp b/plugins/ListeningTo/src/listeningto.cpp index 6292695560..8f7dfe7465 100644 --- a/plugins/ListeningTo/src/listeningto.cpp +++ b/plugins/ListeningTo/src/listeningto.cpp @@ -170,7 +170,7 @@ struct compareFunc : std::binary_function<const ProtocolInfo, const ProtocolInfo {
bool operator()(const ProtocolInfo &one, const ProtocolInfo &two) const
{
- return mir_tstrcmp(one.account, two.account) < 0;
+ return mir_wstrcmp(one.account, two.account) < 0;
}
};
@@ -186,7 +186,7 @@ void RebuildMenu() Menu_RemoveItem(info->hMenu);
wchar_t text[512];
- mir_sntprintf(text, TranslateT("Send to %s"), info->account);
+ mir_snwprintf(text, TranslateT("Send to %s"), info->account);
CMenuItem mi;
mi.position = 100000 + i;
@@ -216,7 +216,7 @@ void RegisterProtocol(char *proto, wchar_t *account) strncpy(proto_items[id].proto, proto, _countof(proto_items[id].proto));
proto_items[id].proto[_countof(proto_items[id].proto) - 1] = 0;
- mir_tstrncpy(proto_items[id].account, account, _countof(proto_items[id].account));
+ mir_wstrncpy(proto_items[id].account, account, _countof(proto_items[id].account));
proto_items[id].hMenu = NULL;
proto_items[id].old_xstatus = 0;
@@ -234,10 +234,10 @@ int AccListChanged(WPARAM wParam, LPARAM lParam) ProtocolInfo *info = GetProtoInfo(proto->szModuleName);
if (info != NULL) {
if (wParam == PRAC_UPGRADED || wParam == PRAC_CHANGED) {
- mir_tstrncpy(info->account, proto->tszAccountName, _countof(info->account));
+ mir_wstrncpy(info->account, proto->tszAccountName, _countof(info->account));
wchar_t text[512];
- mir_sntprintf(text, TranslateT("Send to %s"), info->account);
+ mir_snwprintf(text, TranslateT("Send to %s"), info->account);
Menu_ModifyItem(info->hMenu, text);
}
else if (wParam == PRAC_REMOVED || (wParam == PRAC_CHECKED && !proto->bIsEnabled)) {
@@ -644,7 +644,7 @@ void SetListeningInfo(char *proto, LISTENINGTOINFO *lti = NULL) if (lti == NULL)
CallProtoService(proto, PS_SETAWAYMSG, status, 0);
else {
- ptrT fr(GetParsedFormat(lti));
+ ptrW fr(GetParsedFormat(lti));
CallProtoService(proto, PS_SETAWAYMSG, status, fr);
}
}
@@ -713,7 +713,7 @@ INT_PTR GetTextFormat(WPARAM, LPARAM) if (!loaded)
return NULL;
- return (INT_PTR)mir_tstrdup(opts.templ);
+ return (INT_PTR)mir_wstrdup(opts.templ);
}
wchar_t *GetParsedFormat(LISTENINGTOINFO *lti)
@@ -764,7 +764,7 @@ void SetListeningInfos(LISTENINGTOINFO *lti) if (lti) {
fr = GetParsedFormat(lti);
- if (fr) info = mir_t2a(fr);
+ if (fr) info = mir_u2a(fr);
}
NotifyEventHooks(hListeningInfoChangedEvent, (WPARAM)info, 0);
@@ -910,7 +910,7 @@ wchar_t* VariablesParseInfo(ARGUMENTSINFO *ai) LISTENINGTOINFO *lti = GetListeningInfo();
if (lti == NULL) {
ai->flags = AIF_FALSE;
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
wchar_t *fr[] = {
@@ -938,17 +938,17 @@ wchar_t* VariablesParseInfo(ARGUMENTSINFO *ai) if (lti == NULL) \
{ \
ai->flags = AIF_FALSE; \
- return mir_tstrdup(L""); \
+ return mir_wstrdup(L""); \
} \
else if (IsEmpty(lti->__field__)) \
{ \
ai->flags = AIF_FALSE; \
- return mir_tstrdup(opts.unknown); \
+ return mir_wstrdup(opts.unknown); \
} \
else \
{ \
ai->flags = AIF_DONTPARSE; \
- wchar_t *ret = mir_tstrdup(lti->__field__); \
+ wchar_t *ret = mir_wstrdup(lti->__field__); \
return ret; \
}
diff --git a/plugins/ListeningTo/src/music.cpp b/plugins/ListeningTo/src/music.cpp index 2cc709e025..3ded9a24d2 100644 --- a/plugins/ListeningTo/src/music.cpp +++ b/plugins/ListeningTo/src/music.cpp @@ -68,15 +68,15 @@ void CopyListeningInfo(LISTENINGTOINFO *dest, const LISTENINGTOINFO * const src) dest->cbSize = src->cbSize;
dest->dwFlags = src->dwFlags;
- dest->ptszArtist = mir_tstrdup(src->ptszArtist);
- dest->ptszAlbum = mir_tstrdup(src->ptszAlbum);
- dest->ptszTitle = mir_tstrdup(src->ptszTitle);
- dest->ptszTrack = mir_tstrdup(src->ptszTrack);
- dest->ptszYear = mir_tstrdup(src->ptszYear);
- dest->ptszGenre = mir_tstrdup(src->ptszGenre);
- dest->ptszLength = mir_tstrdup(src->ptszLength);
- dest->ptszPlayer = mir_tstrdup(src->ptszPlayer);
- dest->ptszType = mir_tstrdup(src->ptszType);
+ dest->ptszArtist = mir_wstrdup(src->ptszArtist);
+ dest->ptszAlbum = mir_wstrdup(src->ptszAlbum);
+ dest->ptszTitle = mir_wstrdup(src->ptszTitle);
+ dest->ptszTrack = mir_wstrdup(src->ptszTrack);
+ dest->ptszYear = mir_wstrdup(src->ptszYear);
+ dest->ptszGenre = mir_wstrdup(src->ptszGenre);
+ dest->ptszLength = mir_wstrdup(src->ptszLength);
+ dest->ptszPlayer = mir_wstrdup(src->ptszPlayer);
+ dest->ptszType = mir_wstrdup(src->ptszType);
}
BOOL Equals(const LISTENINGTOINFO *lti1, const LISTENINGTOINFO *lti2)
@@ -84,15 +84,15 @@ BOOL Equals(const LISTENINGTOINFO *lti1, const LISTENINGTOINFO *lti2) if (lti1->cbSize != lti2->cbSize)
return FALSE;
- return mir_tstrcmpi(lti1->ptszArtist, lti2->ptszArtist) == 0
- && mir_tstrcmpi(lti1->ptszAlbum, lti2->ptszAlbum) == 0
- && mir_tstrcmpi(lti1->ptszTitle, lti2->ptszTitle) == 0
- && mir_tstrcmpi(lti1->ptszTrack, lti2->ptszTrack) == 0
- && mir_tstrcmpi(lti1->ptszYear, lti2->ptszYear) == 0
- && mir_tstrcmpi(lti1->ptszGenre, lti2->ptszGenre) == 0
- && mir_tstrcmpi(lti1->ptszLength, lti2->ptszLength) == 0
- && mir_tstrcmpi(lti1->ptszPlayer, lti2->ptszPlayer) == 0
- && mir_tstrcmpi(lti1->ptszType, lti2->ptszType) == 0;
+ return mir_wstrcmpi(lti1->ptszArtist, lti2->ptszArtist) == 0
+ && mir_wstrcmpi(lti1->ptszAlbum, lti2->ptszAlbum) == 0
+ && mir_wstrcmpi(lti1->ptszTitle, lti2->ptszTitle) == 0
+ && mir_wstrcmpi(lti1->ptszTrack, lti2->ptszTrack) == 0
+ && mir_wstrcmpi(lti1->ptszYear, lti2->ptszYear) == 0
+ && mir_wstrcmpi(lti1->ptszGenre, lti2->ptszGenre) == 0
+ && mir_wstrcmpi(lti1->ptszLength, lti2->ptszLength) == 0
+ && mir_wstrcmpi(lti1->ptszPlayer, lti2->ptszPlayer) == 0
+ && mir_wstrcmpi(lti1->ptszType, lti2->ptszType) == 0;
}
diff --git a/plugins/ListeningTo/src/options.cpp b/plugins/ListeningTo/src/options.cpp index 121a5e5869..26667de180 100644 --- a/plugins/ListeningTo/src/options.cpp +++ b/plugins/ListeningTo/src/options.cpp @@ -131,11 +131,11 @@ BOOL IsTypeEnabled(LISTENINGTOINFO *lti) return TRUE;
if (lti->dwFlags & LTI_UNICODE) {
- if (mir_tstrcmpi(lti->ptszType, LPGENW("Music")) == 0)
+ if (mir_wstrcmpi(lti->ptszType, LPGENW("Music")) == 0)
return opts.enable_music;
- if (mir_tstrcmpi(lti->ptszType, LPGENW("Radio")) == 0)
+ if (mir_wstrcmpi(lti->ptszType, LPGENW("Radio")) == 0)
return opts.enable_radio;
- if (mir_tstrcmpi(lti->ptszType, LPGENW("Video")) == 0)
+ if (mir_wstrcmpi(lti->ptszType, LPGENW("Video")) == 0)
return opts.enable_video;
return opts.enable_others;
}
diff --git a/plugins/ListeningTo/src/players/generic.cpp b/plugins/ListeningTo/src/players/generic.cpp index 551d0d2a5e..e6a7a77c7b 100644 --- a/plugins/ListeningTo/src/players/generic.cpp +++ b/plugins/ListeningTo/src/players/generic.cpp @@ -32,11 +32,11 @@ void m_log(const wchar_t *function, const wchar_t *fmt, ...) return;
}
- mir_writeLogT(hLog, L"%s: ", function);
+ mir_writeLogW(hLog, L"%s: ", function);
va_list args;
va_start(args, fmt);
- mir_writeLogVT(hLog, fmt, args);
+ mir_writeLogVW(hLog, fmt, args);
}
static LRESULT CALLBACK ReceiverWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
@@ -163,9 +163,9 @@ void GenericPlayer::ProcessReceived() li->ptszGenre = U2T(parts[8]);
if (player == this)
- li->ptszPlayer = mir_u2t(parts[1]);
+ li->ptszPlayer = mir_wstrdup(parts[1]);
else
- li->ptszPlayer = mir_tstrdup(player->name);
+ li->ptszPlayer = mir_wstrdup(player->name);
if (parts[9] != NULL) {
long length = _wtoi(parts[9]);
@@ -177,9 +177,9 @@ void GenericPlayer::ProcessReceived() int h = (length / 60) / 60;
if (h > 0)
- mir_sntprintf(li->ptszLength, 9, L"%d:%02d:%02d", h, m, s);
+ mir_snwprintf(li->ptszLength, 9, L"%d:%02d:%02d", h, m, s);
else
- mir_sntprintf(li->ptszLength, 9, L"%d:%02d", m, s);
+ mir_snwprintf(li->ptszLength, 9, L"%d:%02d", m, s);
}
}
}
diff --git a/plugins/ListeningTo/src/players/itunes.cpp b/plugins/ListeningTo/src/players/itunes.cpp index fa6f2478e6..167779db76 100644 --- a/plugins/ListeningTo/src/players/itunes.cpp +++ b/plugins/ListeningTo/src/players/itunes.cpp @@ -125,12 +125,12 @@ BOOL ITunes::FillCache() int h = (lret / 60) / 60;
if (h > 0)
- mir_sntprintf(listening_info.ptszLength, 9, L"%d:%02d:%02d", h, m, s);
+ mir_snwprintf(listening_info.ptszLength, 9, L"%d:%02d:%02d", h, m, s);
else
- mir_sntprintf(listening_info.ptszLength, 9, L"%d:%02d", m, s);
+ mir_snwprintf(listening_info.ptszLength, 9, L"%d:%02d", m, s);
}
- listening_info.ptszType = mir_tstrdup(L"Music");
+ listening_info.ptszType = mir_wstrdup(L"Music");
if (listening_info.ptszTitle == NULL) {
// Get from filename
@@ -140,14 +140,14 @@ BOOL ITunes::FillCache() else
p = filename;
- listening_info.ptszTitle = mir_u2t(p);
+ listening_info.ptszTitle = mir_wstrdup(p);
wchar_t *pt = wcsrchr(listening_info.ptszTitle, '.');
if (pt != NULL)
*p = '\0';
}
- listening_info.ptszPlayer = mir_tstrdup(name);
+ listening_info.ptszPlayer = mir_wstrdup(name);
listening_info.cbSize = sizeof(listening_info);
listening_info.dwFlags = LTI_TCHAR;
diff --git a/plugins/ListeningTo/src/players/mradio.cpp b/plugins/ListeningTo/src/players/mradio.cpp index 5654325be2..60a88ec252 100644 --- a/plugins/ListeningTo/src/players/mradio.cpp +++ b/plugins/ListeningTo/src/players/mradio.cpp @@ -43,9 +43,9 @@ int MRadio::GetData() if (!db_get_s(hContact, "mRadio", "Nick", &dbv)) {
listening_info.cbSize = sizeof(listening_info);
listening_info.dwFlags = LTI_TCHAR;
- listening_info.ptszArtist = mir_tstrdup(L"Radio");
- listening_info.ptszType = mir_tstrdup(L"Radio");
- listening_info.ptszTitle = mir_a2t(dbv.pszVal);
+ listening_info.ptszArtist = mir_wstrdup(L"Radio");
+ listening_info.ptszType = mir_wstrdup(L"Radio");
+ listening_info.ptszTitle = mir_a2u(dbv.pszVal);
db_free(&dbv);
return 1;
diff --git a/plugins/ListeningTo/src/players/watrack.cpp b/plugins/ListeningTo/src/players/watrack.cpp index d76b79571b..895c555b91 100644 --- a/plugins/ListeningTo/src/players/watrack.cpp +++ b/plugins/ListeningTo/src/players/watrack.cpp @@ -102,15 +102,15 @@ void WATrack::GetData() int h = (si->total / 60) / 60;
if (h > 0)
- mir_sntprintf(listening_info.ptszLength, 9, L"%d:%02d:%02d", h, m, s);
+ mir_snwprintf(listening_info.ptszLength, 9, L"%d:%02d:%02d", h, m, s);
else
- mir_sntprintf(listening_info.ptszLength, 9, L"%d:%02d", m, s);
+ mir_snwprintf(listening_info.ptszLength, 9, L"%d:%02d", m, s);
}
if (si->width > 0)
- listening_info.ptszType = mir_tstrdup(L"Video");
+ listening_info.ptszType = mir_wstrdup(L"Video");
else
- listening_info.ptszType = mir_tstrdup(L"Music");
+ listening_info.ptszType = mir_wstrdup(L"Music");
listening_info.ptszPlayer = DUPD(si->player, name);
diff --git a/plugins/ListeningTo/src/players/wmp.cpp b/plugins/ListeningTo/src/players/wmp.cpp index c3131e8718..f7d2ab6df2 100644 --- a/plugins/ListeningTo/src/players/wmp.cpp +++ b/plugins/ListeningTo/src/players/wmp.cpp @@ -100,7 +100,7 @@ void WindowsMediaPlayer::ProcessReceived() listening_info.ptszArtist = U2T(parts[5]);
listening_info.ptszAlbum = U2T(parts[6]);
- listening_info.ptszPlayer = mir_tstrdup(name);
+ listening_info.ptszPlayer = mir_wstrdup(name);
}
// Put back the '\\'s
diff --git a/plugins/ListeningTo/src/stdafx.h b/plugins/ListeningTo/src/stdafx.h index 535d581660..9bf16d8c66 100644 --- a/plugins/ListeningTo/src/stdafx.h +++ b/plugins/ListeningTo/src/stdafx.h @@ -107,10 +107,10 @@ static bool IsEmpty(const WCHAR *str) return str == NULL || str[0] == 0;
}
-#define DUP(_X_) ( IsEmpty(_X_) ? NULL : mir_tstrdup(_X_))
-#define DUPD(_X_, _DEF_) ( IsEmpty(_X_) ? mir_tstrdup(_DEF_) : mir_tstrdup(_X_))
-#define U2T(_X_) ( IsEmpty(_X_) ? NULL : mir_u2t(_X_))
-#define U2TD(_X_, _DEF_) ( IsEmpty(_X_) ? mir_u2t(_DEF_) : mir_u2t(_X_))
+#define DUP(_X_) ( IsEmpty(_X_) ? NULL : mir_wstrdup(_X_))
+#define DUPD(_X_, _DEF_) ( IsEmpty(_X_) ? mir_wstrdup(_DEF_) : mir_wstrdup(_X_))
+#define U2T(_X_) ( IsEmpty(_X_) ? NULL : mir_wstrdup(_X_))
+#define U2TD(_X_, _DEF_) ( IsEmpty(_X_) ? mir_wstrdup(_DEF_) : mir_wstrdup(_X_))
#endif // __COMMONS_H__
diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp index 96aa582cf6..02a83da50d 100644 --- a/plugins/LotusNotify/src/LotusNotify.cpp +++ b/plugins/LotusNotify/src/LotusNotify.cpp @@ -446,7 +446,7 @@ void showMsg(wchar_t* sender,wchar_t* text, DWORD id, char *strUID) //99% of the times you'll just copy this line.
//1% of the times you may wish to change the contact's name. I don't know why you should, but you can.
//char * lpzText;
- //The text for the second line. You could even make something like: char lpzText[128]; mir_tstrcpy(lpzText, "Hello world!"); It's your choice.
+ //The text for the second line. You could even make something like: char lpzText[128]; mir_wstrcpy(lpzText, "Hello world!"); It's your choice.
POPUPATT * mpd = (POPUPATT*)malloc(sizeof(POPUPATT));
memset(&ppd, 0, sizeof(ppd)); //This is always a good thing to do.
@@ -478,7 +478,7 @@ void showMsg(wchar_t* sender,wchar_t* text, DWORD id, char *strUID) //what to do with error msg
void ErMsgW(WCHAR* msg)
{
- wchar_t* msgT = mir_u2t(msg);
+ wchar_t* msgT = mir_wstrdup(msg);
ErMsgT(msgT);
mir_free(msgT);
}
@@ -775,11 +775,11 @@ void checkthread(void*) if (attSize) {
WCHAR field_attachments_UNICODE[MAX_FIELD];
- mir_sntprintf(field_attachments_UNICODE, TranslateT("Attachments: %d bytes"), attSize);
- mir_sntprintf(msgSubject, L"%S\n%s\n%s", field_date, field_subject_UNICODE, field_attachments_UNICODE);
+ mir_snwprintf(field_attachments_UNICODE, TranslateT("Attachments: %d bytes"), attSize);
+ mir_snwprintf(msgSubject, L"%S\n%s\n%s", field_date, field_subject_UNICODE, field_attachments_UNICODE);
}
else {
- mir_sntprintf(msgSubject, L"%S\n%s", field_date, field_subject_UNICODE);
+ mir_snwprintf(msgSubject, L"%S\n%s", field_date, field_subject_UNICODE);
}
//check if this is not filtered msg
@@ -1574,7 +1574,7 @@ void checkEnvPath(wchar_t *path) wchar_t *cur = _wgetenv(L"PATH");
wcslwr(cur);
wchar_t *found = wcsstr(cur, path);
- size_t len = mir_tstrlen(path);
+ size_t len = mir_wstrlen(path);
if (found != NULL && (found[len] == ';' || found[len] == 0 || (found[len] == '\\' && (found[len + 1] == ';' || found[len + 1] == 0))))
return;
@@ -1600,7 +1600,7 @@ static int modulesloaded(WPARAM, LPARAM) GetLotusPath(path, sizeof(path));
checkEnvPath(path);
wcscat_s(path, _countof(path), L"nnotes.dll");
- assert(mir_tstrlen(path) > 0);
+ assert(mir_wstrlen(path) > 0);
log_p(L"Loading dll: %s", path);
diff --git a/plugins/LotusNotify/src/debug.cpp b/plugins/LotusNotify/src/debug.cpp index 37f5f26948..965538e7f4 100644 --- a/plugins/LotusNotify/src/debug.cpp +++ b/plugins/LotusNotify/src/debug.cpp @@ -34,7 +34,7 @@ void log_p(const wchar_t* szText, ...){ va_start(args, szText);
int len = _vscwprintf(szText, args ) + 1; // _vscprintf doesn't count terminating '\0' //!!!!!!!!!!!!!!!!
wchar_t* buffer = new wchar_t[len * sizeof(wchar_t)];
- mir_vsntprintf(buffer, len, szText, args);
+ mir_vsnwprintf(buffer, len, szText, args);
va_end(args);
log(buffer);
delete[] buffer;
diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index ed5005e30d..a71bac9998 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -209,9 +209,9 @@ void ShowPopup(char* szText, wchar_t* tszText, MCONTACT hContact) wchar_t* text = 0;
if (tszText)
- text = mir_tstrdup(tszText);
+ text = mir_wstrdup(tszText);
else if (szText)
- text = mir_a2t(szText);
+ text = mir_a2u(szText);
if (!text) return;
ppd.lchIcon = Skin_LoadIcon(SKINICON_OTHER_MIRANDA);
@@ -236,16 +236,16 @@ void CopyToClipboard(HWND, LPSTR pszMsg, LPTSTR ptszMsg) {
LPTSTR buf = 0;
if (ptszMsg)
- buf = mir_tstrdup(ptszMsg);
+ buf = mir_wstrdup(ptszMsg);
else if (pszMsg)
- buf = mir_a2t(pszMsg);
+ buf = mir_a2u(pszMsg);
if (buf == 0)
return;
- HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (mir_tstrlen(buf) + 1)*sizeof(wchar_t));
+ HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (mir_wstrlen(buf) + 1)*sizeof(wchar_t));
LPTSTR lptstrCopy = (LPTSTR)GlobalLock(hglbCopy);
- mir_tstrcpy(lptstrCopy, buf);
+ mir_wstrcpy(lptstrCopy, buf);
mir_free(buf);
GlobalUnlock(hglbCopy);
@@ -331,8 +331,8 @@ BOOL MirVerExists(MCONTACT hContact) if (!szProto)
return 0;
- ptrT msg(db_get_tsa(hContact, szProto, "MirVer"));
- return mir_tstrlen(msg) != 0;
+ ptrW msg(db_get_tsa(hContact, szProto, "MirVer"));
+ return mir_wstrlen(msg) != 0;
}
void getIP(MCONTACT hContact, LPSTR szProto, LPSTR szIP)
@@ -507,7 +507,7 @@ void ModifyCopyID(MCONTACT hContact, BOOL bShowID, BOOL bTrimID) szID[MAX_IDLEN + 1] = 0;
}
- mir_sntprintf(buffer, L"%s [%S]", TranslateT("Copy ID"), szID);
+ mir_snwprintf(buffer, L"%s [%S]", TranslateT("Copy ID"), szID);
Menu_ModifyItem(hmenuCopyID, buffer, hIconCID);
}
else Menu_ModifyItem(hmenuCopyID, LPGENW("Copy ID"), hIconCID);
@@ -628,11 +628,11 @@ INT_PTR onCopyStatusMsg(WPARAM wparam, LPARAM lparam) if (msg) {
if (wcslen(msg)) {
if (flags & VF_SMNAME) {
- mir_tstrncat(buffer, TranslateTS(statusMsg[i].fullName), (_countof(buffer) - wcslen(buffer) - 1));
- mir_tstrncat(buffer, L": ", (_countof(buffer) - wcslen(buffer) - 1));
+ mir_wstrncat(buffer, TranslateTS(statusMsg[i].fullName), (_countof(buffer) - wcslen(buffer) - 1));
+ mir_wstrncat(buffer, L": ", (_countof(buffer) - wcslen(buffer) - 1));
}
- mir_tstrncat(buffer, msg, (_countof(buffer) - wcslen(buffer) - 1));
- mir_tstrncat(buffer, L"\r\n", (_countof(buffer) - wcslen(buffer) - 1));
+ mir_wstrncat(buffer, msg, (_countof(buffer) - wcslen(buffer) - 1));
+ mir_wstrncat(buffer, L"\r\n", (_countof(buffer) - wcslen(buffer) - 1));
}
mir_free(msg);
}
diff --git a/plugins/MenuItemEx/src/options.cpp b/plugins/MenuItemEx/src/options.cpp index 75e33c58a5..2f94374064 100644 --- a/plugins/MenuItemEx/src/options.cpp +++ b/plugins/MenuItemEx/src/options.cpp @@ -48,7 +48,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) for (i = 0; i < 4; i++)
{
GetDlgItemText(hdlg, checkboxes[i].idc, buffer, (_countof(buffer) - 3));
- mir_tstrcat(buffer, L" *");
+ mir_wstrcat(buffer, L" *");
SetDlgItemText(hdlg, checkboxes[i].idc, buffer);
}
}
diff --git a/plugins/MirFox/src/MirandaUtils.cpp b/plugins/MirFox/src/MirandaUtils.cpp index b37be018a8..a29245cff6 100644 --- a/plugins/MirFox/src/MirandaUtils.cpp +++ b/plugins/MirFox/src/MirandaUtils.cpp @@ -200,12 +200,12 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ wchar_t* buffer = new wchar_t[1024 * sizeof(wchar_t)];
if (contactNameW != NULL && tszAccountName != NULL)
if (args->mirfoxDataPtr->getAddAccountToContactNameCheckbox()){
- mir_sntprintf(buffer, 1024, TranslateT("Message sent to %s"), contactNameW);
+ mir_snwprintf(buffer, 1024, TranslateT("Message sent to %s"), contactNameW);
} else {
- mir_sntprintf(buffer, 1024, TranslateT("Message sent to %s (%s)"), contactNameW, tszAccountName);
+ mir_snwprintf(buffer, 1024, TranslateT("Message sent to %s (%s)"), contactNameW, tszAccountName);
}
else
- mir_sntprintf(buffer, 1024, TranslateT("Message sent"));
+ mir_snwprintf(buffer, 1024, TranslateT("Message sent"));
if(ServiceExists(MS_POPUP_ADDPOPUPCLASS))
ShowClassPopupT("MirFox_Notify", L"MirFox", buffer);
@@ -229,23 +229,23 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ logger->log_p(L"SMTC: ERROR - Cannot send message - result = [%d] ", myMfAck->result);
if (myMfAck->errorDesc != NULL){
if (contactNameW != NULL && tszAccountName != NULL){
- mir_sntprintf(buffer, 1024, TranslateT("Cannot send message to %s (%s) - %S"), contactNameW, tszAccountName, myMfAck->errorDesc);
+ mir_snwprintf(buffer, 1024, TranslateT("Cannot send message to %s (%s) - %S"), contactNameW, tszAccountName, myMfAck->errorDesc);
} else {
- mir_sntprintf(buffer, 1024, TranslateT("Cannot send message - %S"), myMfAck->errorDesc);
+ mir_snwprintf(buffer, 1024, TranslateT("Cannot send message - %S"), myMfAck->errorDesc);
}
} else {
if (contactNameW != NULL && tszAccountName != NULL){
- mir_sntprintf(buffer, 1024, TranslateT("Cannot send message to %s (%s)"), contactNameW, tszAccountName);
+ mir_snwprintf(buffer, 1024, TranslateT("Cannot send message to %s (%s)"), contactNameW, tszAccountName);
} else {
- mir_sntprintf(buffer, 1024, TranslateT("Cannot send message"));
+ mir_snwprintf(buffer, 1024, TranslateT("Cannot send message"));
}
}
} else {
logger->log(L"SMTC: ERROR - Cannot send message 2");
if (contactNameW != NULL && tszAccountName != NULL){
- mir_sntprintf(buffer, 1024, TranslateT("Cannot send message to %s (%s)"), contactNameW, tszAccountName);
+ mir_snwprintf(buffer, 1024, TranslateT("Cannot send message to %s (%s)"), contactNameW, tszAccountName);
} else {
- mir_sntprintf(buffer, 1024, TranslateT("Cannot send message"));
+ mir_snwprintf(buffer, 1024, TranslateT("Cannot send message"));
}
}
@@ -342,7 +342,7 @@ int MirandaUtils::on_hook_OpenMW(WPARAM wParam, LPARAM lParam) OnHookOpenMvStruct* param = (OnHookOpenMvStruct*)wParam;
if (param->msgBuffer != NULL){
- wchar_t *msgBuffer = mir_tstrdup(param->msgBuffer->c_str());
+ wchar_t *msgBuffer = mir_wstrdup(param->msgBuffer->c_str());
CallServiceSync(MS_MSG_SENDMESSAGET, (WPARAM)param->targetHandle, (LPARAM)msgBuffer);
mir_free(msgBuffer);
@@ -400,10 +400,10 @@ void MirandaUtils::setStatusOnAccount(ActionThreadArgStruct* args) if(result == 0){
if (tszAccountName != NULL){
logger->log_p(L"SSOA: Status message set on [%s]", tszAccountName);
- mir_sntprintf(buffer, 1024, TranslateT("Status message set on %s"), tszAccountName);
+ mir_snwprintf(buffer, 1024, TranslateT("Status message set on %s"), tszAccountName);
} else {
logger->log(L"SSOA: Status message set");
- mir_sntprintf(buffer, 1024, TranslateT("Status message set"));
+ mir_snwprintf(buffer, 1024, TranslateT("Status message set"));
}
if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
@@ -414,10 +414,10 @@ void MirandaUtils::setStatusOnAccount(ActionThreadArgStruct* args) } else {
if (tszAccountName != NULL){
logger->log_p(L"SSOA: ERROR - Cannot set status message 2 on [%s] - result = [%d] ", tszAccountName, result);
- mir_sntprintf(buffer, 1024, TranslateT("Cannot set status message on %s"), tszAccountName);
+ mir_snwprintf(buffer, 1024, TranslateT("Cannot set status message on %s"), tszAccountName);
} else {
logger->log_p(L"SSOA: ERROR - Cannot set status message 2 - result = [%d] ", result);
- mir_sntprintf(buffer, 1024, TranslateT("Cannot set status message"));
+ mir_snwprintf(buffer, 1024, TranslateT("Cannot set status message"));
}
if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
diff --git a/plugins/MirFox/src/MirfoxMiranda.cpp b/plugins/MirFox/src/MirfoxMiranda.cpp index da140c8d17..c19a436e84 100644 --- a/plugins/MirFox/src/MirfoxMiranda.cpp +++ b/plugins/MirFox/src/MirfoxMiranda.cpp @@ -270,7 +270,7 @@ void CMirfoxMiranda::initializeSharedMemoryData(MirfoxData& mirfoxData, SharedMe } else {
mirfoxData.processCsmId = result.processCsmId;
wchar_t prefix[7];
- mir_sntprintf(prefix, L"MNG%d", result.processCsmId);
+ mir_snwprintf(prefix, L"MNG%d", result.processCsmId);
logger->set6CharsPrefix(prefix);
}
diff --git a/plugins/MirLua/Modules/WinAPI/src/winapi.cpp b/plugins/MirLua/Modules/WinAPI/src/winapi.cpp index 8bb7ec0d8b..40c80555bf 100644 --- a/plugins/MirLua/Modules/WinAPI/src/winapi.cpp +++ b/plugins/MirLua/Modules/WinAPI/src/winapi.cpp @@ -23,9 +23,9 @@ static int lua_MessageBox(lua_State *L) static int lua_ShellExecute(lua_State *L)
{
- ptrT command(mir_utf8decodeT(lua_tostring(L, 1)));
- ptrT file(mir_utf8decodeT(lua_tostring(L, 2)));
- ptrT args(mir_utf8decodeT(lua_tostring(L, 3)));
+ ptrW command(mir_utf8decodeW(lua_tostring(L, 1)));
+ ptrW file(mir_utf8decodeW(lua_tostring(L, 2)));
+ ptrW args(mir_utf8decodeW(lua_tostring(L, 3)));
int flags = lua_tointeger(L, 4);
::ShellExecute(NULL, command, file, args, NULL, flags);
@@ -62,8 +62,8 @@ static int lua_FindIterator(lua_State *L) }
}
- if (!mir_tstrcmpi(ffd.cFileName, L".") ||
- !mir_tstrcmpi(ffd.cFileName, L"..") ||
+ if (!mir_wstrcmpi(ffd.cFileName, L".") ||
+ !mir_wstrcmpi(ffd.cFileName, L"..") ||
(ffd.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT))
{
lua_pushlightuserdata(L, hFind);
@@ -98,7 +98,7 @@ static int lua_FindIterator(lua_State *L) static int lua_Find(lua_State *L)
{
- wchar_t *path = mir_utf8decodeT(luaL_checkstring(L, 1));
+ wchar_t *path = mir_utf8decodeW(luaL_checkstring(L, 1));
lua_pushlightuserdata(L, NULL);
lua_pushlightuserdata(L, path);
@@ -121,9 +121,9 @@ static int lua_GetKeyState(lua_State *L) static int lua_GetIniValue(lua_State *L)
{
- ptrT path(mir_utf8decodeT(luaL_checkstring(L, 1)));
- ptrT section(mir_utf8decodeT(luaL_checkstring(L, 2)));
- ptrT key(mir_utf8decodeT(luaL_checkstring(L, 3)));
+ ptrW path(mir_utf8decodeW(luaL_checkstring(L, 1)));
+ ptrW section(mir_utf8decodeW(luaL_checkstring(L, 2)));
+ ptrW key(mir_utf8decodeW(luaL_checkstring(L, 3)));
if (lua_isinteger(L, 4))
{
@@ -135,7 +135,7 @@ static int lua_GetIniValue(lua_State *L) return 1;
}
- ptrT default(mir_utf8decodeT(lua_tostring(L, 4)));
+ ptrW default(mir_utf8decodeW(lua_tostring(L, 4)));
wchar_t value[MAX_PATH] = { 0 };
if (!::GetPrivateProfileString(section, key, default, value, _countof(value), path))
@@ -143,7 +143,7 @@ static int lua_GetIniValue(lua_State *L) lua_pushvalue(L, 4);
}
- ptrA res(mir_utf8encodeT(value));
+ ptrA res(mir_utf8encodeW(value));
lua_pushstring(L, res);
return 1;
@@ -151,10 +151,10 @@ static int lua_GetIniValue(lua_State *L) static int lua_SetIniValue(lua_State *L)
{
- ptrT path(mir_utf8decodeT(luaL_checkstring(L, 1)));
- ptrT section(mir_utf8decodeT(luaL_checkstring(L, 2)));
- ptrT key(mir_utf8decodeT(luaL_checkstring(L, 3)));
- ptrT value(mir_utf8decodeT(lua_tostring(L, 4)));
+ ptrW path(mir_utf8decodeW(luaL_checkstring(L, 1)));
+ ptrW section(mir_utf8decodeW(luaL_checkstring(L, 2)));
+ ptrW key(mir_utf8decodeW(luaL_checkstring(L, 3)));
+ ptrW value(mir_utf8decodeW(lua_tostring(L, 4)));
bool res = ::WritePrivateProfileString(section, key, value, path) != 0;
lua_pushboolean(L, res);
@@ -164,9 +164,9 @@ static int lua_SetIniValue(lua_State *L) static int lua_DeleteIniValue(lua_State *L)
{
- ptrT path(mir_utf8decodeT(luaL_checkstring(L, 1)));
- ptrT section(mir_utf8decodeT(luaL_checkstring(L, 2)));
- ptrT key(mir_utf8decodeT(luaL_checkstring(L, 3)));
+ ptrW path(mir_utf8decodeW(luaL_checkstring(L, 1)));
+ ptrW section(mir_utf8decodeW(luaL_checkstring(L, 2)));
+ ptrW key(mir_utf8decodeW(luaL_checkstring(L, 3)));
bool res = ::WritePrivateProfileString(section, key, NULL, path) != 0;
lua_pushboolean(L, res);
@@ -179,8 +179,8 @@ static int lua_DeleteIniValue(lua_State *L) static int lua_GetRegValue(lua_State *L)
{
HKEY hRootKey = (HKEY)luaL_checkinteger(L, 1);
- ptrT path(mir_utf8decodeT(luaL_checkstring(L, 2)));
- ptrT valueName(mir_utf8decodeT(luaL_checkstring(L, 3)));
+ ptrW path(mir_utf8decodeW(luaL_checkstring(L, 2)));
+ ptrW valueName(mir_utf8decodeW(luaL_checkstring(L, 3)));
HKEY hKey = 0;
LSTATUS res = ::RegOpenKeyEx(hRootKey, path, NULL, KEY_READ, &hKey);
@@ -240,8 +240,8 @@ static int lua_GetRegValue(lua_State *L) static int lua_SetRegValue(lua_State *L)
{
HKEY hRootKey = (HKEY)luaL_checkinteger(L, 1);
- ptrT path(mir_utf8decodeT(luaL_checkstring(L, 2)));
- ptrT valueName(mir_utf8decodeT(luaL_checkstring(L, 3)));
+ ptrW path(mir_utf8decodeW(luaL_checkstring(L, 2)));
+ ptrW valueName(mir_utf8decodeW(luaL_checkstring(L, 3)));
HKEY hKey = 0;
LSTATUS res = ::RegOpenKeyEx(hRootKey, path, NULL, KEY_WRITE, &hKey);
@@ -275,7 +275,7 @@ static int lua_SetRegValue(lua_State *L) case LUA_TSTRING:
type = REG_SZ;
length = mir_strlen(lua_tostring(L, 4)) * sizeof(wchar_t);
- value = (BYTE*)mir_utf8decodeT(lua_tostring(L, 4));
+ value = (BYTE*)mir_utf8decodeW(lua_tostring(L, 4));
break;
default:
@@ -296,8 +296,8 @@ static int lua_SetRegValue(lua_State *L) static int lua_DeleteRegValue(lua_State *L)
{
HKEY hRootKey = (HKEY)luaL_checkinteger(L, 1);
- ptrT path(mir_utf8decodeT(luaL_checkstring(L, 2)));
- ptrT valueName(mir_utf8decodeT(luaL_checkstring(L, 3)));
+ ptrW path(mir_utf8decodeW(luaL_checkstring(L, 2)));
+ ptrW valueName(mir_utf8decodeW(luaL_checkstring(L, 3)));
HKEY hKey = 0;
LSTATUS res = ::RegOpenKeyEx(hRootKey, path, NULL, KEY_WRITE, &hKey);
diff --git a/plugins/MirLua/Modules/m_msg_buttonsbar/src/main.cpp b/plugins/MirLua/Modules/m_msg_buttonsbar/src/main.cpp index de2fbdc021..f8f7ce7b7f 100644 --- a/plugins/MirLua/Modules/m_msg_buttonsbar/src/main.cpp +++ b/plugins/MirLua/Modules/m_msg_buttonsbar/src/main.cpp @@ -22,7 +22,7 @@ static BBButton* MakeBBButton(lua_State *L) bbb->bbbFlags &= ~BBBF_ANSITOOLTIP;
lua_getfield(L, -1, "Tooltip");
- bbb->ptszTooltip = mir_utf8decodeT(lua_tostring(L, -1));
+ bbb->ptszTooltip = mir_utf8decodeW(lua_tostring(L, -1));
lua_pop(L, 1);
lua_getfield(L, -1, "Icon");
@@ -140,7 +140,7 @@ extern "C" LUAMOD_API int luaopen_m_msg_buttonsbar(lua_State *L) lua_register(L, MT_CUSTOMBUTTONCLICKDATA, bcd_new);
luaL_newmetatable(L, MT_CUSTOMBUTTONCLICKDATA);
- lua_pushcfunction(L, bcd__index); + lua_pushcfunction(L, bcd__index);
lua_setfield(L, -2, "__index");
lua_pop(L, 1);
diff --git a/plugins/MirLua/Modules/m_popup/src/main.cpp b/plugins/MirLua/Modules/m_popup/src/main.cpp index 288f03c1ca..c169ba72e6 100644 --- a/plugins/MirLua/Modules/m_popup/src/main.cpp +++ b/plugins/MirLua/Modules/m_popup/src/main.cpp @@ -5,11 +5,11 @@ static POPUPDATAT* MakePopupData(lua_State *L) POPUPDATAT *ppd = (POPUPDATAT*)mir_calloc(sizeof(POPUPDATAT));
lua_getfield(L, -1, "ContactName");
- mir_tstrcpy(ppd->lptzContactName, ptrT(mir_utf8decodeT(lua_tostring(L, -1))));
+ mir_wstrcpy(ppd->lptzContactName, ptrW(mir_utf8decodeW(lua_tostring(L, -1))));
lua_pop(L, 1);
lua_getfield(L, -1, "Text");
- mir_tstrcpy(ppd->lptzText, ptrT(mir_utf8decodeT(luaL_checkstring(L, -1))));
+ mir_wstrcpy(ppd->lptzText, ptrW(mir_utf8decodeW(luaL_checkstring(L, -1))));
lua_pop(L, 1);
lua_getfield(L, -1, "hContact");
@@ -60,11 +60,11 @@ static POPUPDATA2* MakePopupData2(lua_State *L) ppd->flags |= PU2_TCHAR;
lua_getfield(L, -1, "Title");
- ppd->lptzTitle = mir_utf8decodeT(lua_tostring(L, -1));
+ ppd->lptzTitle = mir_utf8decodeW(lua_tostring(L, -1));
lua_pop(L, 1);
lua_getfield(L, -1, "Text");
- ppd->lptzText = mir_utf8decodeT(luaL_checkstring(L, -1));
+ ppd->lptzText = mir_utf8decodeW(luaL_checkstring(L, -1));
lua_pop(L, 1);
lua_getfield(L, -1, "hContact");
diff --git a/plugins/MirLua/Modules/m_variables/src/main.cpp b/plugins/MirLua/Modules/m_variables/src/main.cpp index 308325e202..a9c5204f96 100644 --- a/plugins/MirLua/Modules/m_variables/src/main.cpp +++ b/plugins/MirLua/Modules/m_variables/src/main.cpp @@ -8,7 +8,7 @@ static int lua_Parse(lua_State *L) return 1;
}
- ptrT format(mir_utf8decodeT(luaL_checkstring(L, 1)));
+ ptrW format(mir_utf8decodeW(luaL_checkstring(L, 1)));
MCONTACT hContact = lua_tointeger(L, 2);
wchar_t *res = variables_parse_ex(format, NULL, hContact, NULL, 0);
diff --git a/plugins/MirLua/src/m_clist.cpp b/plugins/MirLua/src/m_clist.cpp index 70ac7ebfe3..59a5415b32 100644 --- a/plugins/MirLua/src/m_clist.cpp +++ b/plugins/MirLua/src/m_clist.cpp @@ -6,7 +6,7 @@ static int clist_AddMainMenuRoot(lua_State *L) int position = lua_tointeger(L, 2);
HANDLE hIcon = (HANDLE)lua_touserdata(L, 3);
- HGENMENU res = Menu_CreateRoot(MO_MAIN, ptrT(Utf8DecodeT(name)), position, hIcon);
+ HGENMENU res = Menu_CreateRoot(MO_MAIN, ptrW(Utf8DecodeT(name)), position, hIcon);
lua_pushlightuserdata(L, res);
return 1;
@@ -29,7 +29,7 @@ static int clist_AddContactMenuRoot(lua_State *L) int position = lua_tointeger(L, 2);
HANDLE hIcon = (HANDLE)lua_touserdata(L, 3);
- HGENMENU res = Menu_CreateRoot(MO_MAIN, ptrT(Utf8DecodeT(name)), position, hIcon);
+ HGENMENU res = Menu_CreateRoot(MO_MAIN, ptrW(Utf8DecodeT(name)), position, hIcon);
lua_pushlightuserdata(L, res);
return 1;
diff --git a/plugins/MirLua/src/m_core.cpp b/plugins/MirLua/src/m_core.cpp index 27d4cc7714..07f3c9329e 100644 --- a/plugins/MirLua/src/m_core.cpp +++ b/plugins/MirLua/src/m_core.cpp @@ -278,7 +278,7 @@ static int core_Translate(lua_State *L) {
char *what = (char*)luaL_checkstring(L, 1);
- ptrT value(mir_utf8decodeT(what));
+ ptrW value(mir_utf8decodeW(what));
lua_pushstring(L, T2Utf(TranslateW_LP(value, hLangpack)));
return 1;
@@ -288,7 +288,7 @@ static int core_Parse(lua_State *L) {
char *what = (char*)luaL_checkstring(L, 1);
- ptrT value(mir_utf8decodeT(what));
+ ptrW value(mir_utf8decodeW(what));
lua_pushstring(L, T2Utf(VARST(value)));
return 1;
@@ -299,7 +299,7 @@ static int core_GetFullPath(lua_State *L) wchar_t path[MAX_PATH];
GetModuleFileName(NULL, path, MAX_PATH);
- lua_pushstring(L, ptrA(mir_utf8encodeT(path)));
+ lua_pushstring(L, ptrA(mir_utf8encodeW(path)));
return 1;
}
diff --git a/plugins/MirLua/src/m_database.cpp b/plugins/MirLua/src/m_database.cpp index fab5f86d57..5f5ea774d0 100644 --- a/plugins/MirLua/src/m_database.cpp +++ b/plugins/MirLua/src/m_database.cpp @@ -103,9 +103,9 @@ static int db_GetContactInfo(lua_State *L) }
}
- ptrT value(Contact_GetInfo(type, hContact));
+ ptrW value(Contact_GetInfo(type, hContact));
if (value)
- lua_pushstring(L, ptrA(mir_utf8encodeT(value)));
+ lua_pushstring(L, ptrA(mir_utf8encodeW(value)));
else
{
lua_pushnil(L);
diff --git a/plugins/MirLua/src/m_genmenu.cpp b/plugins/MirLua/src/m_genmenu.cpp index 78ed5343d6..e5b33d58a7 100644 --- a/plugins/MirLua/src/m_genmenu.cpp +++ b/plugins/MirLua/src/m_genmenu.cpp @@ -18,7 +18,7 @@ void MakeMenuItem(lua_State *L, CMenuItem &mi) lua_pop(L, 1);
lua_getfield(L, -1, "Name");
- mi.name.w = mir_utf8decodeT(luaL_checkstring(L, -1));
+ mi.name.w = mir_utf8decodeW(luaL_checkstring(L, -1));
lua_pop(L, 1);
lua_getfield(L, -1, "Position");
@@ -47,7 +47,7 @@ void MakeMenuItem(lua_State *L, CMenuItem &mi) int position = lua_tointeger(L, 3);
HANDLE hIcon = (HANDLE)lua_touserdata(L, 4);
- HGENMENU res = Menu_CreateRoot(hMenuObject, ptrT(Utf8DecodeT(name)), position, hIcon);
+ HGENMENU res = Menu_CreateRoot(hMenuObject, ptrW(Utf8DecodeT(name)), position, hIcon);
lua_pushlightuserdata(L, res);
return 1;
@@ -78,7 +78,7 @@ static int genmenu_ModifyMenuItem(lua_State *L) {
luaL_checktype(L, 1, LUA_TLIGHTUSERDATA);
HGENMENU hMenuItem = (HGENMENU)lua_touserdata(L, 1);
- ptrT name(mir_utf8decodeT(lua_tostring(L, 2)));
+ ptrW name(mir_utf8decodeW(lua_tostring(L, 2)));
HANDLE hIcolibItem = luaL_opt(L, lua_touserdata, 3, INVALID_HANDLE_VALUE);
int flags = luaL_optinteger(L, 4, -1);
diff --git a/plugins/MirLua/src/m_hotkeys.cpp b/plugins/MirLua/src/m_hotkeys.cpp index 4023904fe4..c99ef4290b 100644 --- a/plugins/MirLua/src/m_hotkeys.cpp +++ b/plugins/MirLua/src/m_hotkeys.cpp @@ -16,11 +16,11 @@ void MakeHotkey(lua_State *L, HOTKEYDESC &hk) lua_pop(L, 1);
lua_getfield(L, -1, "Description");
- hk.ptszDescription = mir_utf8decodeT(lua_tostring(L, -1));
+ hk.ptszDescription = mir_utf8decodeW(lua_tostring(L, -1));
lua_pop(L, 1);
lua_getfield(L, -1, "Section");
- hk.ptszSection = mir_utf8decodeT(luaL_optstring(L, -1, MODULE));
+ hk.ptszSection = mir_utf8decodeW(luaL_optstring(L, -1, MODULE));
lua_pop(L, 1);
lua_getfield(L, -1, "Hotkey");
diff --git a/plugins/MirLua/src/m_icolib.cpp b/plugins/MirLua/src/m_icolib.cpp index 8827cc749c..018931ffb7 100644 --- a/plugins/MirLua/src/m_icolib.cpp +++ b/plugins/MirLua/src/m_icolib.cpp @@ -3,9 +3,9 @@ static int icolib_AddIcon(lua_State *L)
{
const char *name = luaL_checkstring(L, 1);
- ptrT description(mir_utf8decodeT(luaL_checkstring(L, 2)));
- ptrT section(mir_utf8decodeT(luaL_optstring(L, 3, MODULE)));
- ptrT filePath(mir_utf8decodeT(lua_tostring(L, 4)));
+ ptrW description(mir_utf8decodeW(luaL_checkstring(L, 2)));
+ ptrW section(mir_utf8decodeW(luaL_optstring(L, 3, MODULE)));
+ ptrW filePath(mir_utf8decodeW(lua_tostring(L, 4)));
if (filePath == NULL)
{
diff --git a/plugins/MirLua/src/m_message.cpp b/plugins/MirLua/src/m_message.cpp index b907807929..0a56c791e3 100644 --- a/plugins/MirLua/src/m_message.cpp +++ b/plugins/MirLua/src/m_message.cpp @@ -3,7 +3,7 @@ static int message_Paste(lua_State *L)
{
MCONTACT hContact = luaL_checkinteger(L, 1);
- ptrT text(mir_utf8decodeT(luaL_checkstring(L, 2)));
+ ptrW text(mir_utf8decodeW(luaL_checkstring(L, 2)));
MessageWindowInputData mwid = { sizeof(MessageWindowInputData) };
mwid.hContact = hContact;
@@ -34,12 +34,12 @@ static int message_Send(lua_State *L) const char *szProto = GetContactProto(hContact);
if (db_get_b(hContact, szProto, "ChatRoom", 0) == TRUE)
{
- ptrT tszChatRoom(db_get_tsa(hContact, szProto, "ChatRoomID"));
+ ptrW tszChatRoom(db_get_tsa(hContact, szProto, "ChatRoomID"));
GCDEST gcd = { szProto, tszChatRoom, GC_EVENT_SENDMESSAGE };
GCEVENT gce = { sizeof(gce), &gcd };
gce.bIsMe = TRUE;
gce.dwFlags = GCEF_ADDTOLOG;
- gce.ptszText = mir_utf8decodeT(message);
+ gce.ptszText = mir_utf8decodeW(message);
gce.time = time(NULL);
res = CallServiceSync(MS_GC_EVENT, WINDOW_VISIBLE, (LPARAM)&gce);
diff --git a/plugins/MirLua/src/m_options.cpp b/plugins/MirLua/src/m_options.cpp index d67106d247..6bb25cbe26 100644 --- a/plugins/MirLua/src/m_options.cpp +++ b/plugins/MirLua/src/m_options.cpp @@ -54,15 +54,15 @@ void MakeOptionDialogPage(lua_State *L, OPTIONSDIALOGPAGE &odp) odp.flags |= ODPF_TCHAR;
lua_getfield(L, -1, "Group");
- odp.pwszGroup = mir_utf8decodeT(lua_tostring(L, -1));
+ odp.pwszGroup = mir_utf8decodeW(lua_tostring(L, -1));
lua_pop(L, 1);
lua_getfield(L, -1, "Title");
- odp.pwszTitle = mir_utf8decodeT(luaL_checkstring(L, -1));
+ odp.pwszTitle = mir_utf8decodeW(luaL_checkstring(L, -1));
lua_pop(L, 1);
lua_getfield(L, -1, "Tab");
- odp.pwszTab = mir_utf8decodeT(lua_tostring(L, -1));
+ odp.pwszTab = mir_utf8decodeW(lua_tostring(L, -1));
lua_pop(L, 1);
int onInitDialogRef = LUA_NOREF;
diff --git a/plugins/MirLua/src/m_sounds.cpp b/plugins/MirLua/src/m_sounds.cpp index cd31adfe76..0291515ee7 100644 --- a/plugins/MirLua/src/m_sounds.cpp +++ b/plugins/MirLua/src/m_sounds.cpp @@ -3,9 +3,9 @@ static int sounds_AddSound(lua_State *L)
{
ptrA name(mir_utf8decodeA(luaL_checkstring(L, 1)));
- ptrT description(mir_utf8decodeT(luaL_checkstring(L, 2)));
- ptrT section(mir_utf8decodeT(luaL_optstring(L, 3, MODULE)));
- ptrT filePath(mir_utf8decodeT(lua_tostring(L, 4)));
+ ptrW description(mir_utf8decodeW(luaL_checkstring(L, 2)));
+ ptrW section(mir_utf8decodeW(luaL_optstring(L, 3, MODULE)));
+ ptrW filePath(mir_utf8decodeW(lua_tostring(L, 4)));
SKINSOUNDDESCEX ssd = { sizeof(SKINSOUNDDESCEX) };
ssd.pszName = name;
@@ -34,7 +34,7 @@ static int sounds_PlaySound(lua_State *L) static int sounds_PlayFile(lua_State *L)
{
- ptrT filePath(mir_utf8decodeT(luaL_checkstring(L, 1)));
+ ptrW filePath(mir_utf8decodeW(luaL_checkstring(L, 1)));
INT_PTR res = SkinPlaySoundFile(filePath);
lua_pushboolean(L, res == 0);
diff --git a/plugins/MirLua/src/mlua.cpp b/plugins/MirLua/src/mlua.cpp index 5386f364d1..b6c62101a6 100644 --- a/plugins/MirLua/src/mlua.cpp +++ b/plugins/MirLua/src/mlua.cpp @@ -28,11 +28,11 @@ void CMLua::SetPaths() lua_getglobal(L, "package");
FoldersGetCustomPathT(g_hCLibsFolder, path, _countof(path), VARST(MIRLUA_PATHT));
- lua_pushfstring(L, "%s\\?.dll", ptrA(mir_utf8encodeT(path)));
+ lua_pushfstring(L, "%s\\?.dll", ptrA(mir_utf8encodeW(path)));
lua_setfield(L, -2, "cpath");
FoldersGetCustomPathT(g_hScriptsFolder, path, _countof(path), VARST(MIRLUA_PATHT));
- lua_pushfstring(L, "%s\\?.lua", ptrA(mir_utf8encodeT(path)));
+ lua_pushfstring(L, "%s\\?.lua", ptrA(mir_utf8encodeW(path)));
lua_setfield(L, -2, "path");
lua_pop(L, 1);
diff --git a/plugins/MirLua/src/mlua_options.cpp b/plugins/MirLua/src/mlua_options.cpp index cc902165d6..524cd427bb 100644 --- a/plugins/MirLua/src/mlua_options.cpp +++ b/plugins/MirLua/src/mlua_options.cpp @@ -62,7 +62,7 @@ void CMLuaOptions::OnInitDialog() wchar_t scriptDir[MAX_PATH], relativeScriptDir[MAX_PATH], header[MAX_PATH + 100];
FoldersGetCustomPathT(g_hScriptsFolder, scriptDir, _countof(scriptDir), VARST(MIRLUA_PATHT));
PathToRelativeT(scriptDir, relativeScriptDir, NULL);
- mir_sntprintf(header, L"%s (%s)", TranslateT("Common scripts"), relativeScriptDir);
+ mir_snwprintf(header, L"%s (%s)", TranslateT("Common scripts"), relativeScriptDir);
m_scripts.AddColumn(0, L"Script", 380);
m_scripts.AddColumn(1, NULL, 32 - GetSystemMetrics(SM_CXVSCROLL));
diff --git a/plugins/MirLua/src/mlua_script.cpp b/plugins/MirLua/src/mlua_script.cpp index b84c3d978e..f4cfef8c7c 100644 --- a/plugins/MirLua/src/mlua_script.cpp +++ b/plugins/MirLua/src/mlua_script.cpp @@ -5,17 +5,17 @@ CMLuaScript::CMLuaScript(lua_State *L, const wchar_t *path)
: L(L), status(None), unloadRef(LUA_NOREF)
{
- mir_tstrcpy(filePath, path);
+ mir_wstrcpy(filePath, path);
fileName = wcsrchr(filePath, '\\') + 1;
wchar_t *dot = wcsrchr(fileName, '.');
- size_t length = mir_tstrlen(fileName) - mir_tstrlen(dot) + 1;
+ size_t length = mir_wstrlen(fileName) - mir_wstrlen(dot) + 1;
- ptrT name((wchar_t*)mir_calloc(sizeof(wchar_t) * (length + 1)));
- mir_tstrncpy(name, fileName, length);
+ ptrW name((wchar_t*)mir_calloc(sizeof(wchar_t) * (length + 1)));
+ mir_wstrncpy(name, fileName, length);
- moduleName = mir_utf8encodeT(name);
+ moduleName = mir_utf8encodeW(name);
MUUID muidLast = MIID_LAST;
id = GetPluginLangId(muidLast, 0);
diff --git a/plugins/MirLua/src/mlua_script_loader.cpp b/plugins/MirLua/src/mlua_script_loader.cpp index a8efa32320..3a3d88fbc7 100644 --- a/plugins/MirLua/src/mlua_script_loader.cpp +++ b/plugins/MirLua/src/mlua_script_loader.cpp @@ -7,7 +7,7 @@ CMLuaScriptLoader::CMLuaScriptLoader(lua_State *L) : L(L) void CMLuaScriptLoader::LoadScript(const wchar_t *scriptDir, const wchar_t *file)
{
wchar_t fullPath[MAX_PATH], path[MAX_PATH];
- mir_sntprintf(fullPath, L"%s\\%s", scriptDir, file);
+ mir_snwprintf(fullPath, L"%s\\%s", scriptDir, file);
PathToRelativeT(fullPath, path);
CMLuaScript *script = new CMLuaScript(L, path);
@@ -31,7 +31,7 @@ void CMLuaScriptLoader::LoadScripts() Log(L"Loading scripts from %s", scriptDir);
wchar_t searchMask[MAX_PATH];
- mir_sntprintf(searchMask, L"%s\\%s", scriptDir, L"*.lua");
+ mir_snwprintf(searchMask, L"%s\\%s", scriptDir, L"*.lua");
WIN32_FIND_DATA fd;
HANDLE hFind = FindFirstFile(searchMask, &fd);
diff --git a/plugins/MirOTR/src/dialogs.cpp b/plugins/MirOTR/src/dialogs.cpp index cc3ab94d61..98d0d5edef 100644 --- a/plugins/MirOTR/src/dialogs.cpp +++ b/plugins/MirOTR/src/dialogs.cpp @@ -40,11 +40,11 @@ static INT_PTR CALLBACK DlgSMPUpdateProc(HWND hwndDlg, UINT msg, WPARAM wParam, smp_for_contact[context->app_data].responder = data->responder; mir_free(data); - wchar_t title[512], *proto = mir_a2t(GetContactProto(hContact)); + wchar_t title[512], *proto = mir_a2u(GetContactProto(hContact)); const wchar_t *name = contact_get_nameT(hContact); - mir_sntprintf(title, TranslateW(LANG_SMP_PROGRESS_TITLE), name, proto); + mir_snwprintf(title, TranslateW(LANG_SMP_PROGRESS_TITLE), name, proto); SetWindowText(hwndDlg, title); - mir_sntprintf(title, TranslateW(LANG_SMP_PROGRESS_DESC), name, proto); + mir_snwprintf(title, TranslateW(LANG_SMP_PROGRESS_DESC), name, proto); mir_free(proto); SetDlgItemText(hwndDlg, IDC_STC_SMP_HEADPRO, title); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)context); @@ -183,15 +183,15 @@ static INT_PTR CALLBACK DlgSMPResponseProc(HWND hwndDlg, UINT msg, WPARAM wParam smp_for_contact[context->app_data].oldlevel = data->oldlevel; smp_for_contact[context->app_data].responder = data->responder; - wchar_t buff[512], *proto = mir_a2t(GetContactProto(hContact)); - mir_sntprintf(buff, TranslateW(LANG_SMP_VERIFY_TITLE), contact_get_nameT(hContact), proto); + wchar_t buff[512], *proto = mir_a2u(GetContactProto(hContact)); + mir_snwprintf(buff, TranslateW(LANG_SMP_VERIFY_TITLE), contact_get_nameT(hContact), proto); mir_free(proto); SetWindowText(hwndDlg, buff); SetDlgItemText(hwndDlg, IDC_STC_SMP_HEAD, buff); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)context); if (data->question) { - mir_sntprintf(buff, TranslateW(LANG_OTR_SMPQUESTION_RESPOND_DESC), contact_get_nameT(hContact)); + mir_snwprintf(buff, TranslateW(LANG_OTR_SMPQUESTION_RESPOND_DESC), contact_get_nameT(hContact)); SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff); @@ -211,7 +211,7 @@ static INT_PTR CALLBACK DlgSMPResponseProc(HWND hwndDlg, UINT msg, WPARAM wParam mir_free(data->question); } else { - mir_sntprintf(buff, TranslateW(LANG_OTR_SMPPASSWORD_RESPOND_DESC), contact_get_nameT(hContact)); + mir_snwprintf(buff, TranslateW(LANG_OTR_SMPPASSWORD_RESPOND_DESC), contact_get_nameT(hContact)); SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff); @@ -303,7 +303,7 @@ void SMPInitResponseDialog(ConnContext *context, const wchar_t *question) { data->context = context; data->oldlevel = TRUST_NOT_PRIVATE; data->responder = true; - data->question = (question) ? mir_tstrdup(question) : NULL; + data->question = (question) ? mir_wstrdup(question) : NULL; CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), 0, DlgSMPResponseProc, (LPARAM) data); } */ @@ -326,8 +326,8 @@ static INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam } MCONTACT hContact = (UINT_PTR)context->app_data; - wchar_t title[512], *proto = mir_a2t(GetContactProto(hContact)); - mir_sntprintf(title, TranslateW(LANG_SMP_VERIFY_TITLE), contact_get_nameT(hContact), proto); + wchar_t title[512], *proto = mir_a2u(GetContactProto(hContact)); + mir_snwprintf(title, TranslateW(LANG_SMP_VERIFY_TITLE), contact_get_nameT(hContact), proto); mir_free(proto); SetWindowText(hwndDlg, title); SetDlgItemText(hwndDlg, IDC_STC_SMP_HEAD, title); @@ -380,9 +380,9 @@ static INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam } wchar_t buff[1024]; if (!fp->trust || fp->trust[0] == '\0') - mir_sntprintf(buff, TranslateW(LANG_OTR_SMPQUESTION_VERIFY_DESC), contact_get_nameT(hContact)); + mir_snwprintf(buff, TranslateW(LANG_OTR_SMPQUESTION_VERIFY_DESC), contact_get_nameT(hContact)); else - mir_sntprintf(buff, TranslateW(LANG_OTR_SMPQUESTION_VERIFIED_DESC), contact_get_nameT(hContact)); + mir_snwprintf(buff, TranslateW(LANG_OTR_SMPQUESTION_VERIFIED_DESC), contact_get_nameT(hContact)); SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff); @@ -418,7 +418,7 @@ static INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam GetDlgItemText(hwndDlg, IDC_CBO_SMP_CHOOSE, szMsg, _countof(szMsg)); if (wcsncmp(szMsg, TranslateW(LANG_SMPTYPE_QUESTION), _countof(szMsg)) == 0) { if (smp_for_contact.find(context->app_data) != smp_for_contact.end()) { - mir_sntprintf(szMsg, TranslateW(LANG_SMP_IN_PROGRESS), contact_get_nameT(hContact)); + mir_snwprintf(szMsg, TranslateW(LANG_SMP_IN_PROGRESS), contact_get_nameT(hContact)); ShowError(szMsg); } else { @@ -441,7 +441,7 @@ static INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam } else if (wcsncmp(szMsg, TranslateW(LANG_SMPTYPE_PASSWORD), _countof(szMsg)) == 0) { if (smp_for_contact.find(context->app_data) != smp_for_contact.end()) { - mir_sntprintf(szMsg, TranslateW(LANG_SMP_IN_PROGRESS), contact_get_nameT(hContact)); + mir_snwprintf(szMsg, TranslateW(LANG_SMP_IN_PROGRESS), contact_get_nameT(hContact)); ShowError(szMsg); } else { @@ -489,9 +489,9 @@ static INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam GetDlgItemText(hwndDlg, IDC_CBO_SMP_CHOOSE, buff, 255); if (wcsncmp(buff, TranslateW(LANG_SMPTYPE_QUESTION), 255) == 0) { if (trusted) - mir_sntprintf(buff, TranslateW(LANG_OTR_SMPQUESTION_VERIFIED_DESC), contact_get_nameT(hContact)); + mir_snwprintf(buff, TranslateW(LANG_OTR_SMPQUESTION_VERIFIED_DESC), contact_get_nameT(hContact)); else - mir_sntprintf(buff, TranslateW(LANG_OTR_SMPQUESTION_VERIFY_DESC), contact_get_nameT(hContact)); + mir_snwprintf(buff, TranslateW(LANG_OTR_SMPQUESTION_VERIFY_DESC), contact_get_nameT(hContact)); SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff); @@ -510,9 +510,9 @@ static INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam } else if (wcsncmp(buff, TranslateW(LANG_SMPTYPE_PASSWORD), 255) == 0) { if (trusted) - mir_sntprintf(buff, TranslateW(LANG_OTR_SMPPASSWORD_VERIFIED_DESC), contact_get_nameT(hContact)); + mir_snwprintf(buff, TranslateW(LANG_OTR_SMPPASSWORD_VERIFIED_DESC), contact_get_nameT(hContact)); else - mir_sntprintf(buff, TranslateW(LANG_OTR_SMPPASSWORD_VERIFY_DESC), contact_get_nameT(hContact)); + mir_snwprintf(buff, TranslateW(LANG_OTR_SMPPASSWORD_VERIFY_DESC), contact_get_nameT(hContact)); SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff); @@ -531,9 +531,9 @@ static INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam } else if (wcsncmp(buff, TranslateW(LANG_SMPTYPE_FINGERPRINT), 255) == 0) { if (trusted) - mir_sntprintf(buff, TranslateW(LANG_OTR_FPVERIFIED_DESC), contact_get_nameT(hContact)); + mir_snwprintf(buff, TranslateW(LANG_OTR_FPVERIFIED_DESC), contact_get_nameT(hContact)); else - mir_sntprintf(buff, TranslateW(LANG_OTR_FPVERIFY_DESC), contact_get_nameT(hContact)); + mir_snwprintf(buff, TranslateW(LANG_OTR_FPVERIFY_DESC), contact_get_nameT(hContact)); SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff); @@ -608,7 +608,7 @@ void SMPDialogReply(ConnContext *context, const char* question) data->context = context; data->oldlevel = TRUST_NOT_PRIVATE; data->responder = true; - data->question = (question) ? mir_utf8decodeT(question) : NULL; + data->question = (question) ? mir_utf8decodeW(question) : NULL; CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), 0, DlgSMPResponseProc, (LPARAM)data); /* ShowError(L"SMP requires user password (NOT IMPL YET)"); @@ -671,9 +671,9 @@ static INT_PTR CALLBACK DlgBoxProcVerifyContext(HWND hwndDlg, UINT msg, WPARAM w } wchar_t buff[512]; if (!fp->trust || fp->trust[0] == '\0') - mir_sntprintf(buff, TranslateW(LANG_OTR_FPVERIFY_DESC), contact_get_nameT(hContact)); + mir_snwprintf(buff, TranslateW(LANG_OTR_FPVERIFY_DESC), contact_get_nameT(hContact)); else - mir_sntprintf(buff, TranslateW(LANG_OTR_FPVERIFIED_DESC), contact_get_nameT(hContact)); + mir_snwprintf(buff, TranslateW(LANG_OTR_FPVERIFIED_DESC), contact_get_nameT(hContact)); SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff); @@ -735,7 +735,7 @@ static unsigned int CALLBACK verify_context_thread(void *param) lib_cs_lock(); otrl_context_set_trust(context->active_fingerprint, "verified"); otrl_privkey_write_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename)); - mir_sntprintf(msg, TranslateW(LANG_FINGERPRINT_VERIFIED), contact_get_nameT(hContact)); + mir_snwprintf(msg, TranslateW(LANG_FINGERPRINT_VERIFIED), contact_get_nameT(hContact)); ShowMessage(hContact, msg); SetEncryptionStatus(hContact, otr_context_get_trust(context)); break; @@ -744,7 +744,7 @@ static unsigned int CALLBACK verify_context_thread(void *param) lib_cs_lock(); otrl_context_set_trust(context->active_fingerprint, NULL); otrl_privkey_write_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename)); - mir_sntprintf(msg, TranslateW(LANG_FINGERPRINT_NOT_VERIFIED), contact_get_nameT(hContact)); + mir_snwprintf(msg, TranslateW(LANG_FINGERPRINT_NOT_VERIFIED), contact_get_nameT(hContact)); ShowMessage(hContact, msg); SetEncryptionStatus(hContact, otr_context_get_trust(context)); break; diff --git a/plugins/MirOTR/src/mirotrmenu.cpp b/plugins/MirOTR/src/mirotrmenu.cpp index 23e7ecf35c..2629202ed3 100644 --- a/plugins/MirOTR/src/mirotrmenu.cpp +++ b/plugins/MirOTR/src/mirotrmenu.cpp @@ -68,12 +68,12 @@ INT_PTR MirOTRMenuCheckService(WPARAM wParam, LPARAM) switch (level) { case TRUST_PRIVATE: - mir_sntprintf(text, L"%s [v%i]", TranslateW(LANG_STATUS_PRIVATE), context->protocol_version); + mir_snwprintf(text, L"%s [v%i]", TranslateW(LANG_STATUS_PRIVATE), context->protocol_version); Menu_ModifyItem(hStatusInfoItem, text, IcoLib_GetIconHandle(ICON_PRIVATE)); break; case TRUST_UNVERIFIED: - mir_sntprintf(text, L"%s [v%i]", TranslateW(LANG_STATUS_UNVERIFIED), context->protocol_version); + mir_snwprintf(text, L"%s [v%i]", TranslateW(LANG_STATUS_UNVERIFIED), context->protocol_version); Menu_ModifyItem(hStatusInfoItem, text, IcoLib_GetIconHandle(ICON_UNVERIFIED)); break; diff --git a/plugins/MirOTR/src/options.cpp b/plugins/MirOTR/src/options.cpp index a3a4d04ec0..861dec4677 100644 --- a/plugins/MirOTR/src/options.cpp +++ b/plugins/MirOTR/src/options.cpp @@ -21,9 +21,9 @@ void SetFilenames(const wchar_t *path) return; CreateDirectoryTreeT(path); - mir_sntprintf(g_private_key_filename, L"%s\\" _A2W(PRIVATE_KEY_FILENAME), path); - mir_sntprintf(g_fingerprint_store_filename, L"%s\\" _A2W(FINGERPRINT_STORE_FILENAME), path); - mir_sntprintf(g_instag_filename, L"%s\\" _A2W(INSTAG_FILENAME), path); + mir_snwprintf(g_private_key_filename, L"%s\\" _A2W(PRIVATE_KEY_FILENAME), path); + mir_snwprintf(g_fingerprint_store_filename, L"%s\\" _A2W(FINGERPRINT_STORE_FILENAME), path); + mir_snwprintf(g_instag_filename, L"%s\\" _A2W(INSTAG_FILENAME), path); } int FoldersChanged(WPARAM, LPARAM) @@ -161,7 +161,7 @@ static INT_PTR CALLBACK DlgProcMirOTROpts(HWND hwndDlg, UINT msg, WPARAM wParam, CheckDlgButton(hwndDlg, IDC_CHK_ENDOFFLINE, options.end_offline ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CHK_ENDCLOSE, options.end_window_close ? BST_CHECKED : BST_UNCHECKED); - prefix = mir_utf8decodeT(options.prefix); + prefix = mir_utf8decodeW(options.prefix); SetDlgItemText(hwndDlg, IDC_ED_PREFIX, prefix); mir_free(prefix); bInit = true; @@ -238,10 +238,10 @@ static unsigned int CALLBACK regen_key_thread(void* param) PROTOREGENKEYOPTIONS *opts = (PROTOREGENKEYOPTIONS *)param; wchar_t buff[512]; - mir_sntprintf(buff, TranslateW(LANG_OTR_ASK_NEWKEY), opts->proto); + mir_snwprintf(buff, TranslateW(LANG_OTR_ASK_NEWKEY), opts->proto); EnableWindow(opts->refresh, FALSE); if (IDYES == MessageBox(opts->refresh, buff, TranslateT(LANG_OTR_INFO), MB_ICONQUESTION|MB_YESNO)) { - char* proto = mir_t2a(opts->proto); + char* proto = mir_u2a(opts->proto); otr_gui_create_privkey(0, proto, proto); mir_free(proto); SendMessage(opts->refresh, WMU_REFRESHPROTOLIST, 0, 0); @@ -332,7 +332,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP char fprint[45]; if (otrl_privkey_fingerprint(otr_user_state, fprint, pppDesc[i]->szModuleName, pppDesc[i]->szModuleName)) { - wchar_t *temp = mir_a2t(fprint); + wchar_t *temp = mir_a2u(fprint); ListView_SetItemText(lv, ilvItem, 2, temp); mir_free(temp); } @@ -360,7 +360,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP wchar_t buff_proto[128]; ListView_GetItemText(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS), sel, 0, buff_proto, _countof(buff_proto)); wchar_t buff[512]; - mir_sntprintf(buff, TranslateW(LANG_OTR_ASK_REMOVEKEY), buff_proto); + mir_snwprintf(buff, TranslateW(LANG_OTR_ASK_REMOVEKEY), buff_proto); if (IDYES == MessageBox(hwndDlg, buff, TranslateT(LANG_OTR_INFO), MB_ICONQUESTION | MB_YESNO)) { char *proto = GetProtoName(lv, sel); if (proto == NULL) @@ -745,7 +745,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w wchar_t buff[1024], hash[45]; otrl_privkey_hash_to_humanT(hash, fp->fingerprint); PROTOACCOUNT *pa = Proto_GetAccount(GetContactProto(hContact)); - mir_sntprintf(buff, TranslateW(LANG_FINGERPRINT_STILL_IN_USE), hash, contact_get_nameT(hContact), pa->tszAccountName); + mir_snwprintf(buff, TranslateW(LANG_FINGERPRINT_STILL_IN_USE), hash, contact_get_nameT(hContact), pa->tszAccountName); ShowError(buff); } else { @@ -775,7 +775,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w wchar_t buff[1024], hash[45]; otrl_privkey_hash_to_humanT(hash, it->first->fingerprint); PROTOACCOUNT *pa = Proto_GetAccount(GetContactProto(hContact)); - mir_sntprintf(buff, TranslateW(LANG_FINGERPRINT_NOT_DELETED), hash, contact_get_nameT(hContact), pa->tszAccountName); + mir_snwprintf(buff, TranslateW(LANG_FINGERPRINT_NOT_DELETED), hash, contact_get_nameT(hContact), pa->tszAccountName); ShowError(buff); } else otrl_context_forget_fingerprint(it->first, 1); diff --git a/plugins/MirOTR/src/otr.cpp b/plugins/MirOTR/src/otr.cpp index da2af8a178..c521025ef2 100644 --- a/plugins/MirOTR/src/otr.cpp +++ b/plugins/MirOTR/src/otr.cpp @@ -57,8 +57,8 @@ INT_PTR CALLBACK GenKeyDlgBoxProc(HWND hWndDlg, UINT msg, WPARAM, LPARAM lParam) TranslateDialogDefault(hWndDlg); SetClassLongPtr(hWndDlg, GCLP_HICON, (LONG_PTR)IcoLib_GetIcon(ICON_OTR, 1)); wchar_t buff[256]; - wchar_t *proto = mir_a2t((char*)lParam); - mir_sntprintf(buff, TranslateW(LANG_GENERATE_KEY), proto); + wchar_t *proto = mir_a2u((char*)lParam); + mir_snwprintf(buff, TranslateW(LANG_GENERATE_KEY), proto); mir_free(proto); SetDlgItemText(hWndDlg, IDC_GENERATE, buff); GenKeyData *data = (GenKeyData *)mir_calloc(sizeof(GenKeyData)); @@ -177,20 +177,20 @@ extern "C" { SetEncryptionStatus(hContact, trusted); wchar_t buff[512]; if (trusted == TRUST_PRIVATE) { - mir_sntprintf(buff, TranslateW(LANG_SESSION_START_OTR), contact_get_nameT(hContact)); + mir_snwprintf(buff, TranslateW(LANG_SESSION_START_OTR), contact_get_nameT(hContact)); } else if (trusted == TRUST_UNVERIFIED) { if (options.autoshow_verify) SMPInitDialog(context); //VerifyContextDialog(context); - mir_sntprintf(buff, TranslateW(LANG_SESSION_START_OTR_VERIFY), contact_get_nameT(hContact)); + mir_snwprintf(buff, TranslateW(LANG_SESSION_START_OTR_VERIFY), contact_get_nameT(hContact)); } else { // should never happen - mir_sntprintf(buff, TranslateW(LANG_SESSION_NOT_STARTED_OTR), contact_get_nameT(hContact)); + mir_snwprintf(buff, TranslateW(LANG_SESSION_NOT_STARTED_OTR), contact_get_nameT(hContact)); } if (context->protocol_version < MIROTR_PROTO_LATEST){ - size_t remaining = mir_tstrlen(buff); + size_t remaining = mir_wstrlen(buff); wchar_t *offset = buff + remaining; remaining = _countof(buff) - remaining; - mir_sntprintf(offset, remaining, TranslateT("\nusing older protocol version %i"), context->protocol_version); + mir_snwprintf(offset, remaining, TranslateT("\nusing older protocol version %i"), context->protocol_version); } ShowMessage(hContact, buff); @@ -201,7 +201,7 @@ extern "C" { MCONTACT hContact = (UINT_PTR)opdata; DEBUGOUTA("OTR_GUI_GONE_INSECURE\n"); wchar_t buff[512]; - mir_sntprintf(buff, TranslateW(LANG_SESSION_TERMINATED_BY_OTR), contact_get_nameT(hContact)); + mir_snwprintf(buff, TranslateW(LANG_SESSION_TERMINATED_BY_OTR), contact_get_nameT(hContact)); //MessageBox(0, buff, Translate("OTR Information"), MB_OK); if (!Miranda_Terminated()) { ShowMessage(hContact, buff); @@ -221,27 +221,27 @@ extern "C" { wchar_t buff[1024]; if (!is_reply) { if (trusted == TRUST_PRIVATE) { - mir_sntprintf(buff, TranslateW(LANG_SESSION_CONTINUE_OTR), contact_get_nameT(hContact)); + mir_snwprintf(buff, TranslateW(LANG_SESSION_CONTINUE_OTR), contact_get_nameT(hContact)); } else if (trusted == TRUST_UNVERIFIED) { if (options.autoshow_verify) SMPInitDialog(context); //VerifyContextDialog(context); - mir_sntprintf(buff, TranslateW(LANG_SESSION_CONTINUE_OTR_VERIFY), contact_get_nameT(hContact)); + mir_snwprintf(buff, TranslateW(LANG_SESSION_CONTINUE_OTR_VERIFY), contact_get_nameT(hContact)); } else { // should never happen - mir_sntprintf(buff, TranslateW(LANG_SESSION_NOT_STARTED_OTR), contact_get_nameT(hContact)); + mir_snwprintf(buff, TranslateW(LANG_SESSION_NOT_STARTED_OTR), contact_get_nameT(hContact)); } // opdata is hContact ShowMessage(hContact, buff); } else { if (trusted == TRUST_PRIVATE) { - mir_sntprintf(buff, TranslateW(LANG_SESSION_HAS_CONTINUE_OTR), contact_get_nameT(hContact)); + mir_snwprintf(buff, TranslateW(LANG_SESSION_HAS_CONTINUE_OTR), contact_get_nameT(hContact)); } else if (trusted == TRUST_UNVERIFIED) { - mir_sntprintf(buff, TranslateW(LANG_SESSION_HAS_CONTINUE_OTR_VERIFY), contact_get_nameT(hContact)); + mir_snwprintf(buff, TranslateW(LANG_SESSION_HAS_CONTINUE_OTR_VERIFY), contact_get_nameT(hContact)); } else { // should never happen - mir_sntprintf(buff, TranslateW(LANG_SESSION_NOT_STARTED_OTR), contact_get_nameT(hContact)); + mir_snwprintf(buff, TranslateW(LANG_SESSION_NOT_STARTED_OTR), contact_get_nameT(hContact)); } } @@ -328,11 +328,11 @@ extern "C" { break; case OTRL_MSGEVENT_ENCRYPTION_REQUIRED: msgfunc = ShowMessageInline; - mir_tstrncpy(msg, TranslateT("Attempting to start a private conversation..."), _countof(msg)); + mir_wstrncpy(msg, TranslateT("Attempting to start a private conversation..."), _countof(msg)); break; case OTRL_MSGEVENT_ENCRYPTION_ERROR: msgfunc = ShowMessageInline; - mir_tstrncpy(msg, TranslateT("An error occurred when encrypting your message.\nThe message was not sent"), _countof(msg)); + mir_wstrncpy(msg, TranslateT("An error occurred when encrypting your message.\nThe message was not sent"), _countof(msg)); break; case OTRL_MSGEVENT_CONNECTION_ENDED: msgfunc = ShowMessageInline; @@ -346,14 +346,14 @@ extern "C" { mir_snwprintf(msg, _countof(msg), TranslateT("Error setting up private conversation: %s"), TranslateT("Malformed message received")); break; default:{ - wchar_t* tmp = mir_utf8decodeT(gcry_strerror(err)); + wchar_t* tmp = mir_utf8decodeW(gcry_strerror(err)); mir_snwprintf(msg, _countof(msg), TranslateT("Error setting up private conversation: %s"), tmp); mir_free(tmp); } } break; case OTRL_MSGEVENT_MSG_REFLECTED: // title = TranslateT("OTR Error"); - mir_tstrncpy(msg, TranslateT("We are receiving our own OTR messages.\nYou are either trying to talk to yourself, or someone is reflecting your messages back at you"), _countof(msg)); + mir_wstrncpy(msg, TranslateT("We are receiving our own OTR messages.\nYou are either trying to talk to yourself, or someone is reflecting your messages back at you"), _countof(msg)); break; case OTRL_MSGEVENT_MSG_RESENT: // title = TranslateT("Message resent"); @@ -373,14 +373,14 @@ extern "C" { break; case OTRL_MSGEVENT_RCVDMSG_GENERAL_ERR:{ // title = TranslateT("OTR Error"); - wchar_t* tmp = mir_utf8decodeT(message); - mir_tstrncpy(msg, tmp, _countof(msg)); + wchar_t* tmp = mir_utf8decodeW(message); + mir_wstrncpy(msg, tmp, _countof(msg)); mir_free(tmp); break; } case OTRL_MSGEVENT_RCVDMSG_UNENCRYPTED:{ // title = TranslateT("Received unencrypted message"); msgfunc = ShowMessageInline; - wchar_t* tmp = mir_utf8decodeT(message); + wchar_t* tmp = mir_utf8decodeW(message); mir_snwprintf(msg, _countof(msg), TranslateT("The following message received from '%s' was NOT encrypted:\n\n%s"), contact, tmp); mir_free(tmp); ProtoChainSend(hContact, PSS_MESSAGE, PREF_BYPASS_OTR, (LPARAM)message); @@ -391,7 +391,7 @@ extern "C" { break; default: // title = TranslateT("OTR Error"); - mir_tstrncpy(msg, TranslateT("unknown OTR message received, please report that to Miranda NG developers"), _countof(msg)); + mir_wstrncpy(msg, TranslateT("unknown OTR message received, please report that to Miranda NG developers"), _countof(msg)); } if (msg[0]) msgfunc(hContact, msg); diff --git a/plugins/MirOTR/src/svcs_menu.cpp b/plugins/MirOTR/src/svcs_menu.cpp index 8bd87e7dd0..c86d81ef4f 100644 --- a/plugins/MirOTR/src/svcs_menu.cpp +++ b/plugins/MirOTR/src/svcs_menu.cpp @@ -31,7 +31,7 @@ int StartOTR(MCONTACT hContact) { LCID langid = Langpack_GetDefaultLocale(); if(langid != 0x0409/*US*/ && langid != 0x1009/*CA*/ && langid != 0x0809/*GB*/){ // non english const wchar_t* translated=TranslateTS(MIROTR_PROTO_HELLO_MSG); - if(mir_tstrcmp(MIROTR_PROTO_HELLO_MSG,translated)){ + if(mir_wstrcmp(MIROTR_PROTO_HELLO_MSG,translated)){ *msgoff++ = '\n'; for(const wchar_t* c=nick; *c && msgoff<msgend; *msgoff++=*c++); for(const wchar_t* c=translated; *c && msgoff<msgend; *msgoff++=*c++); @@ -57,12 +57,12 @@ INT_PTR SVC_StartOTR(WPARAM hContact, LPARAM) hContact = hSub; if ( options.bHaveSecureIM && CallService("SecureIM/IsContactSecured", hContact, 0) != 0 ) { - mir_sntprintf(buff, TranslateW(LANG_OTR_SECUREIM_STARTED), contact_get_nameT(hContact)); + mir_snwprintf(buff, TranslateW(LANG_OTR_SECUREIM_STARTED), contact_get_nameT(hContact)); ShowError(buff); return 0; } - mir_sntprintf(buff, TranslateW(LANG_SESSION_REQUEST_OTR), contact_get_nameT(hContact)); + mir_snwprintf(buff, TranslateW(LANG_SESSION_REQUEST_OTR), contact_get_nameT(hContact)); ShowMessage(hContact, buff); return StartOTR(hContact); @@ -77,12 +77,12 @@ INT_PTR SVC_RefreshOTR(WPARAM hContact, LPARAM) hContact = hSub; if ( options.bHaveSecureIM && CallService("SecureIM/IsContactSecured", hContact, 0) != 0 ) { - mir_sntprintf(buff, 512, TranslateW(LANG_OTR_SECUREIM_STARTED), contact_get_nameT(hContact)); + mir_snwprintf(buff, 512, TranslateW(LANG_OTR_SECUREIM_STARTED), contact_get_nameT(hContact)); ShowError(buff); return 0; } - mir_sntprintf(buff, TranslateW(LANG_SESSION_TRY_CONTINUE_OTR), contact_get_nameT(hContact)); + mir_snwprintf(buff, TranslateW(LANG_SESSION_TRY_CONTINUE_OTR), contact_get_nameT(hContact)); ShowMessage(hContact, buff); int res = StartOTR(hContact); @@ -116,7 +116,7 @@ INT_PTR SVC_StopOTR(WPARAM hContact, LPARAM) SetEncryptionStatus(hContact, TRUST_NOT_PRIVATE); wchar_t buff[512]; - mir_sntprintf(buff, TranslateW(LANG_SESSION_TERMINATED_OTR), contact_get_nameT(hContact)); + mir_snwprintf(buff, TranslateW(LANG_SESSION_TERMINATED_OTR), contact_get_nameT(hContact)); ShowMessage(hContact, buff); return 0; } diff --git a/plugins/MirOTR/src/svcs_proto.cpp b/plugins/MirOTR/src/svcs_proto.cpp index 375484f775..74934fbfd1 100644 --- a/plugins/MirOTR/src/svcs_proto.cpp +++ b/plugins/MirOTR/src/svcs_proto.cpp @@ -111,7 +111,7 @@ INT_PTR SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam) if (tlv && !Miranda_Terminated()) { /* Notify the user that the other side disconnected. */ wchar_t buff[256]; - mir_sntprintf(buff, TranslateW(LANG_SESSION_TERMINATED_BY_OTR), contact_get_nameT(ccs->hContact)); + mir_snwprintf(buff, TranslateW(LANG_SESSION_TERMINATED_BY_OTR), contact_get_nameT(ccs->hContact)); SetEncryptionStatus(ccs->hContact, otr_context_get_trust(context)); // required since libotr 4!? ShowMessage(ccs->hContact, buff); } diff --git a/plugins/MirOTR/src/utils.cpp b/plugins/MirOTR/src/utils.cpp index e4fbc217ec..5b10c37451 100644 --- a/plugins/MirOTR/src/utils.cpp +++ b/plugins/MirOTR/src/utils.cpp @@ -93,11 +93,11 @@ void otrl_privkey_hash_to_humanT(wchar_t human[45], const unsigned char hash[20] char* contact_get_id(MCONTACT hContact, bool bNameOnError) { - ptrT pszUniqueID(Contact_GetInfo(CNF_UNIQUEID, hContact)); + ptrW pszUniqueID(Contact_GetInfo(CNF_UNIQUEID, hContact)); if (!pszUniqueID && bNameOnError) - pszUniqueID = mir_tstrdup(pcli->pfnGetContactDisplayName(hContact, 0)); + pszUniqueID = mir_wstrdup(pcli->pfnGetContactDisplayName(hContact, 0)); - return mir_t2a(pszUniqueID); + return mir_u2a(pszUniqueID); } __inline const wchar_t* contact_get_nameT(MCONTACT hContact) { @@ -107,7 +107,7 @@ __inline const wchar_t* contact_get_nameT(MCONTACT hContact) { wchar_t* ProtoGetNickname(const char* proto) { wchar_t *p = Contact_GetInfo(CNF_NICK, NULL, proto); - return (p != NULL) ? p : mir_tstrdup(L""); + return (p != NULL) ? p : mir_wstrdup(L""); } void ShowPopup(const wchar_t* line1, const wchar_t* line2, int timeout, const MCONTACT hContact) { @@ -115,12 +115,12 @@ void ShowPopup(const wchar_t* line1, const wchar_t* line2, int timeout, const MC if ( !options.bHavePopups) { wchar_t title[256]; - mir_sntprintf(title, L"%s Message", _A2W(MODULENAME)); + mir_snwprintf(title, L"%s Message", _A2W(MODULENAME)); if(line1 && line2) { - int size = int(mir_tstrlen(line1) + mir_tstrlen(line2) + 3); + int size = int(mir_wstrlen(line1) + mir_wstrlen(line2) + 3); wchar_t *message = new wchar_t[size]; // newline and null terminator - mir_sntprintf(message, size, L"%s\r\n%s", line1, line2); + mir_snwprintf(message, size, L"%s\r\n%s", line1, line2); MessageBox( NULL, message, title, MB_OK | MB_ICONINFORMATION ); delete[] message; } else if(line1) { @@ -165,15 +165,15 @@ void ShowWarning(wchar_t *msg) { if(disp == ED_POP && !options.bHavePopups) disp = ED_BAL; if(disp == ED_BAL && !ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) disp = ED_MB; - mir_sntprintf(buffer, L"%s Warning", _A2W(MODULENAME)); + mir_snwprintf(buffer, L"%s Warning", _A2W(MODULENAME)); switch(disp) { case ED_POP: { - int size = int(mir_tstrlen(msg) + 515); + int size = int(mir_wstrlen(msg) + 515); wchar_t *message = new wchar_t[size]; // newline and null terminator - mir_sntprintf(message, size, L"%s\r\n%s", buffer, msg); + mir_snwprintf(message, size, L"%s\r\n%s", buffer, msg); PUShowMessageT(message, SM_WARNING); delete[] message; } @@ -211,16 +211,16 @@ void ShowError(wchar_t *msg) { if(disp == ED_POP && !options.bHavePopups) disp = ED_BAL; if(disp == ED_BAL && !ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) disp = ED_MB; - mir_sntprintf(buffer, L"%s Error", _A2W(MODULENAME)); + mir_snwprintf(buffer, L"%s Error", _A2W(MODULENAME)); wchar_t *message; switch(disp) { case ED_POP: { - int size = int(mir_tstrlen(msg) + 515); + int size = int(mir_wstrlen(msg) + 515); message = new wchar_t[size]; // newline and null terminator - mir_sntprintf(message, size, L"%s\r\n%s", buffer, msg); + mir_snwprintf(message, size, L"%s\r\n%s", buffer, msg); PUShowMessageT(message, SM_WARNING); delete[] message; } @@ -249,27 +249,27 @@ void ShowError(wchar_t *msg) { void ShowPopupUtf(const char* line1, const char* line2, int timeout, const MCONTACT hContact) { - wchar_t* l1 = (line1) ? mir_utf8decodeT(line1) : NULL; - wchar_t* l2 = (line2) ? mir_utf8decodeT(line2) : NULL; + wchar_t* l1 = (line1) ? mir_utf8decodeW(line1) : NULL; + wchar_t* l2 = (line2) ? mir_utf8decodeW(line2) : NULL; ShowPopup(l1, l2, timeout, hContact); if (l1) mir_free(l1); if (l2) mir_free(l2); } void ShowWarningUtf(char* msg) { - wchar_t* m = (msg) ? mir_utf8decodeT(msg) : NULL; + wchar_t* m = (msg) ? mir_utf8decodeW(msg) : NULL; ShowWarning(m); if (m) mir_free(m); } void ShowErrorUtf(char* msg) { - wchar_t* m = (msg) ? mir_utf8decodeT(msg) : NULL; + wchar_t* m = (msg) ? mir_utf8decodeW(msg) : NULL; ShowError(m); if (m) mir_free(m); } void ShowMessageInline(const MCONTACT hContact, const wchar_t *msg) { wchar_t buff[1024]; - mir_sntprintf(buff, L"%s%s", _A2W(LANG_INLINE_PREFIX), msg); + mir_snwprintf(buff, L"%s%s", _A2W(LANG_INLINE_PREFIX), msg); T2Utf utf(buff); PROTORECVEVENT pre = {0}; @@ -321,13 +321,13 @@ const wchar_t *policy_to_string(OtrlPolicy policy) { } OtrlPolicy policy_from_string(const wchar_t *polstring) { - if (mir_tstrcmp(polstring, TranslateW(LANG_POLICY_NEVER)) == 0) + if (mir_wstrcmp(polstring, TranslateW(LANG_POLICY_NEVER)) == 0) return OTRL_POLICY_NEVER; - else if (mir_tstrcmp(polstring, TranslateW(LANG_POLICY_OPP)) == 0) + else if (mir_wstrcmp(polstring, TranslateW(LANG_POLICY_OPP)) == 0) return OTRL_POLICY_OPPORTUNISTIC; - else if (mir_tstrcmp(polstring, TranslateW(LANG_POLICY_MANUAL)) == 0) + else if (mir_wstrcmp(polstring, TranslateW(LANG_POLICY_MANUAL)) == 0) return OTRL_POLICY_MANUAL_MOD; - else if (mir_tstrcmp(polstring, TranslateW(LANG_POLICY_ALWAYS)) == 0) + else if (mir_wstrcmp(polstring, TranslateW(LANG_POLICY_ALWAYS)) == 0) return OTRL_POLICY_ALWAYS; else return CONTACT_DEFAULT_POLICY; diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp index b914945698..436881080f 100644 --- a/plugins/MirandaG15/src/CAppletManager.cpp +++ b/plugins/MirandaG15/src/CAppletManager.cpp @@ -1127,7 +1127,7 @@ int CAppletManager::HookChatInbound(WPARAM, LPARAM lParam) // fetch the network name if (gcd->iType == GC_EVENT_CHANGESESSIONAME) { - if (gcd->ptszID && !mir_tstrcmpi(gcd->ptszID, L"Network log")) { + if (gcd->ptszID && !mir_wstrcmpi(gcd->ptszID, L"Network log")) { pIRCCon->strNetwork = toTstring(gce->ptszText); TRACE(L"\t Found network identifier: %s\n", pIRCCon->strNetwork.c_str()); return 0; @@ -1149,7 +1149,7 @@ int CAppletManager::HookChatInbound(WPARAM, LPARAM lParam) if (pos != tstring::npos) strChannel = strChannel.substr(0, pos - 1); else { - if (mir_tstrcmpi(gcd->ptszID, L"Network log")) + if (mir_wstrcmpi(gcd->ptszID, L"Network log")) TRACE(L"\t WARNING: ignoring unknown event!\n"); return 0; } diff --git a/plugins/MirandaG15/src/CConfig.cpp b/plugins/MirandaG15/src/CConfig.cpp index 46cd677105..5903b8f2ca 100644 --- a/plugins/MirandaG15/src/CConfig.cpp +++ b/plugins/MirandaG15/src/CConfig.cpp @@ -338,9 +338,9 @@ void CConfig::LoadFontSettings(int iFont) mir_snprintf(szSetting, "Font%dName", iFont);
DBVARIANT dbv;
if (db_get_ts(NULL, "MirandaG15", szSetting, &dbv))
- mir_tstrcpy(m_logfont[iFont].lfFaceName, L"Small Fonts");
+ mir_wstrcpy(m_logfont[iFont].lfFaceName, L"Small Fonts");
else {
- mir_tstrcpy(m_logfont[iFont].lfFaceName, dbv.ptszVal);
+ mir_wstrcpy(m_logfont[iFont].lfFaceName, dbv.ptszVal);
db_free(&dbv);
}
diff --git a/plugins/MirandaG15/src/CContactList.cpp b/plugins/MirandaG15/src/CContactList.cpp index 69a7e1e972..d8bd87325d 100644 --- a/plugins/MirandaG15/src/CContactList.cpp +++ b/plugins/MirandaG15/src/CContactList.cpp @@ -502,7 +502,7 @@ bool CContactList::CompareEntries(CListEntry<CContactListEntry*,CContactListGrou else if(pLeftEntry->iStatus != pRightEntry->iStatus)
return (aiStatusPriority[pLeftEntry->iStatus - ID_STATUS_OFFLINE] > aiStatusPriority[pRightEntry->iStatus - ID_STATUS_OFFLINE]);
else
- return mir_tstrcmpi(pLeftEntry->strName.c_str(),pRightEntry->strName.c_str())<0;
+ return mir_wstrcmpi(pLeftEntry->strName.c_str(),pRightEntry->strName.c_str())<0;
}
else if(pLeft->GetType() == ITEM && pRight->GetType() == CONTAINER)
return false;
@@ -520,7 +520,7 @@ bool CContactList::CompareEntries(CListEntry<CContactListEntry*,CContactListGrou else if (pGroup1->iEvents && pGroup2->iEvents)
return (pGroup1->iEvents > pGroup2->iEvents);
else
- return mir_tstrcmpi(pGroup1->strName.c_str(),pGroup2->strName.c_str())<0;
+ return mir_wstrcmpi(pGroup1->strName.c_str(),pGroup2->strName.c_str())<0;
}
return false;
diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp index 7d874a7a33..f7bed6776c 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp @@ -302,7 +302,7 @@ void CLCDGfx::DrawText(int nX, int nY, LPCTSTR sText) dtp.cbSize = sizeof(DRAWTEXTPARAMS);
RECT rBounds = {nX,nY,GetClipWidth(),GetClipHeight()};
- DrawTextEx(m_hDC, (LPTSTR)sText, (int)mir_tstrlen(sText), &rBounds, (DT_LEFT | DT_NOPREFIX), &dtp);
+ DrawTextEx(m_hDC, (LPTSTR)sText, (int)mir_wstrlen(sText), &rBounds, (DT_LEFT | DT_NOPREFIX), &dtp);
// restores
SetMapMode(m_hDC, nOldMapMode);
diff --git a/plugins/MobileState/src/main.cpp b/plugins/MobileState/src/main.cpp index b18452a7d8..b170f9d704 100644 --- a/plugins/MobileState/src/main.cpp +++ b/plugins/MobileState/src/main.cpp @@ -54,7 +54,7 @@ bool hasMobileClient(MCONTACT hContact, LPARAM) {
char *proto = GetContactProto(hContact);
- ptrT client(db_get_tsa(hContact, proto, "MirVer"));
+ ptrW client(db_get_tsa(hContact, proto, "MirVer"));
if (client) {
// Make client lower-case
wcslwr(client);
diff --git a/plugins/ModernOpt/src/modernopt.cpp b/plugins/ModernOpt/src/modernopt.cpp index 8ef64ff744..9f7716d456 100644 --- a/plugins/ModernOpt/src/modernopt.cpp +++ b/plugins/ModernOpt/src/modernopt.cpp @@ -121,7 +121,7 @@ static int ModernOptionsObject_Comparator(const ModernOptionsObject *ptr1, const if (obj1->optObject.lptzSubsection && obj2->optObject.lptzSubsection)
{
- int c = mir_tstrcmp(obj1->optObject.lptzSubsection, obj2->optObject.lptzSubsection);
+ int c = mir_wstrcmp(obj1->optObject.lptzSubsection, obj2->optObject.lptzSubsection);
if (c) return c;
}
@@ -376,7 +376,7 @@ static int lstrcmp_null(wchar_t *p1, wchar_t *p2) if (!p1 && !p2) return 0;
if (!p1) return -1;
if (!p2) return 1;
- return mir_tstrcmp(p1, p2);
+ return mir_wstrcmp(p1, p2);
}
static void ModernOptUI_ShowPage(HWND hwndDlg, struct ModernOptionsData *dat, int iPage)
@@ -540,14 +540,14 @@ static INT_PTR svcModernOpt_AddObject(WPARAM wParam, LPARAM lParam) case MODERNOPT_TYPE_SUBSECTIONPAGE:
objCopy->optObject.lptzSubsection = (objCopy->optObject.dwFlags & MODEROPT_FLG_UNICODE) ?
- mir_u2t(obj->lpwzSubsection) :
- mir_a2t(obj->lpzSubsection);
+ mir_wstrdup(obj->lpwzSubsection) :
+ mir_a2u(obj->lpzSubsection);
break;
case MODERNOPT_TYPE_IGNOREOBJECT:
objCopy->optObject.lptzSubsection = (objCopy->optObject.dwFlags & MODEROPT_FLG_UNICODE) ?
- mir_u2t(obj->lpwzSubsection) :
- mir_a2t(obj->lpzSubsection);
+ mir_wstrdup(obj->lpwzSubsection) :
+ mir_a2u(obj->lpzSubsection);
objCopy->optObject.lpzIgnoreModule = mir_strdup(obj->lpzIgnoreModule);
objCopy->optObject.lpzIgnoreSetting = mir_strdup(obj->lpzIgnoreSetting);
objCopy->optObject.dwIgnoreBit = obj->dwIgnoreBit;
@@ -559,8 +559,8 @@ static INT_PTR svcModernOpt_AddObject(WPARAM wParam, LPARAM lParam) objCopy->optObject.lpzTemplate = MAKEINTRESOURCEA(IDD_MODERNOPT_SKINS);
objCopy->optObject.pfnDlgProc = ModernOptSelector_DlgProc;
objCopy->optObject.lptzSubsection = (objCopy->optObject.dwFlags & MODEROPT_FLG_UNICODE) ?
- mir_u2t(obj->lpwzSubsection) :
- mir_a2t(obj->lpzSubsection);
+ mir_wstrdup(obj->lpwzSubsection) :
+ mir_a2u(obj->lpzSubsection);
objCopy->optObject.lpzThemeExtension = mir_strdup(obj->lpzThemeExtension);
objCopy->optObject.lpzThemeModuleName = mir_strdup(obj->lpzThemeModuleName);
break;
diff --git a/plugins/ModernOpt/src/mopt_selector.cpp b/plugins/ModernOpt/src/mopt_selector.cpp index 5e97984584..24c7ebb47c 100644 --- a/plugins/ModernOpt/src/mopt_selector.cpp +++ b/plugins/ModernOpt/src/mopt_selector.cpp @@ -81,7 +81,7 @@ struct TSkinListItem TSkinListItem(wchar_t *fn)
{
- title = mir_tstrdup(fn);
+ title = mir_wstrdup(fn);
if (wchar_t *p = wcsrchr(title, '.'))
*p = 0;
@@ -91,9 +91,9 @@ struct TSkinListItem path = (wchar_t *)mir_alloc(MAX_PATH * sizeof(wchar_t));
PathToRelativeT(curPath, path);
- size_t length = mir_tstrlen(curPath) + mir_tstrlen(fn) + 2;
+ size_t length = mir_wstrlen(curPath) + mir_wstrlen(fn) + 2;
filename = (wchar_t *)mir_alloc(length * sizeof(wchar_t));
- mir_sntprintf(filename, length, L"%s\\%s", curPath, fn);
+ mir_snwprintf(filename, length, L"%s\\%s", curPath, fn);
}
~TSkinListItem()
@@ -123,8 +123,8 @@ struct TSelectorData static bool CheckExt(wchar_t *fn, wchar_t *ext, int n)
{
- size_t l = mir_tstrlen(fn);
- return (l > n) && !mir_tstrcmp(fn + l - n, ext);
+ size_t l = mir_wstrlen(fn);
+ return (l > n) && !mir_wstrcmp(fn + l - n, ext);
}
static void BuildSkinList(HWND hwndList, wchar_t *szExt, int nExtLength = -1, bool start = true)
@@ -135,7 +135,7 @@ static void BuildSkinList(HWND hwndList, wchar_t *szExt, int nExtLength = -1, bo if (wchar_t *p = wcsrchr(mirPath, '\\')) *p = 0;
SetCurrentDirectory(mirPath);
SendMessage(hwndList, LB_RESETCONTENT, 0, 0);
- nExtLength = (int)mir_tstrlen(szExt);
+ nExtLength = (int)mir_wstrlen(szExt);
SendMessage(hwndList, WM_SETREDRAW, FALSE, 0);
}
@@ -143,7 +143,7 @@ static void BuildSkinList(HWND hwndList, wchar_t *szExt, int nExtLength = -1, bo HANDLE h = FindFirstFile(L"*.*", &ffd);
if (h != INVALID_HANDLE_VALUE) {
do {
- if (!mir_tstrcmp(ffd.cFileName, L"") || !mir_tstrcmp(ffd.cFileName, L".") || !mir_tstrcmp(ffd.cFileName, L".."))
+ if (!mir_wstrcmp(ffd.cFileName, L"") || !mir_wstrcmp(ffd.cFileName, L".") || !mir_wstrcmp(ffd.cFileName, L".."))
continue;
if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
@@ -300,7 +300,7 @@ INT_PTR CALLBACK ModernOptSelector_DlgProc(HWND hwndDlg, UINT msg, WPARAM wPara int cxIcon = GetSystemMetrics(SM_CXSMICON);
int cyIcon = GetSystemMetrics(SM_CYSMICON);
- if (sd->active && !mir_tstrcmp(sd->active, dat->filename)) {
+ if (sd->active && !mir_wstrcmp(sd->active, dat->filename)) {
DrawIconEx(lps->hDC, lps->rcItem.left, (lps->rcItem.top + lps->rcItem.bottom - cyIcon) / 2,
Skin_LoadIcon(SKINICON_OTHER_EMPTYBLOB),
cxIcon, cyIcon, 0, NULL, DI_NORMAL);
diff --git a/plugins/MsgPopup/src/main.cpp b/plugins/MsgPopup/src/main.cpp index 56f1d5b2cc..01f6807f53 100644 --- a/plugins/MsgPopup/src/main.cpp +++ b/plugins/MsgPopup/src/main.cpp @@ -87,8 +87,8 @@ void popupMessage(LPCTSTR lpText, LPCTSTR lpCaption, UINT uType) ppd.iSeconds = options.Timeout[indx];
ppd.lchIcon = (HICON)LoadImage(NULL, MAKEINTRESOURCE(iIcon), IMAGE_ICON, SM_CXSMICON, SM_CYSMICON, LR_SHARED);
- mir_tstrcpy(ppd.lptzContactName, lpCaption);
- mir_tstrcpy(ppd.lptzText, lpText);
+ mir_wstrcpy(ppd.lptzContactName, lpCaption);
+ mir_wstrcpy(ppd.lptzText, lpText);
PUAddPopupT(&ppd);
if (options.Sound)
MessageBeep(uType);
@@ -135,7 +135,7 @@ void HookOnImport(HMODULE hModule, char *lpszImpModName, PVOID lpOrigFunc, PVOID wchar_t buf[200];
g_HookError = TRUE;
- mir_sntprintf(buf, TranslateT("VirtualProtect failed. Code %d\nTry to call the author"), GetLastError());
+ mir_snwprintf(buf, TranslateT("VirtualProtect failed. Code %d\nTry to call the author"), GetLastError());
prevMessageBox(0, buf, TranslateT("Error"), MB_OK);
}
}
diff --git a/plugins/Msg_Export/src/FileViewer.cpp b/plugins/Msg_Export/src/FileViewer.cpp index ecc4f8305c..f8b48d7ece 100755 --- a/plugins/Msg_Export/src/FileViewer.cpp +++ b/plugins/Msg_Export/src/FileViewer.cpp @@ -258,7 +258,7 @@ int CLStreamRTFInfo::nLoadFileStream(LPBYTE pbBuff, LONG cb) }
dwCurrent += nWriteHeader((char*)pbBuff, cb);
- tstring sMyNick = ptrT(GetMyOwnNick(hContact));
+ tstring sMyNick = ptrW(GetMyOwnNick(hContact));
nNickLen = WideCharToMultiByte(bUtf8File ? CP_UTF8 : CP_ACP, 0, sMyNick.c_str(), (int)sMyNick.length(), szMyNick, sizeof(szMyNick), NULL, NULL);
}
@@ -621,9 +621,9 @@ bool bLoadFile(HWND hwndDlg, CLHistoryDlg * pclDlg) wchar_t szTmp[1500];
if (nDBCount == -1)
- mir_sntprintf(szTmp, TranslateT("Failed to open file\r\n%s\r\n\r\nContact handle is invalid"), pclDlg->sPath.c_str());
+ mir_snwprintf(szTmp, TranslateT("Failed to open file\r\n%s\r\n\r\nContact handle is invalid"), pclDlg->sPath.c_str());
else
- mir_sntprintf(szTmp, TranslateT("Failed to open file\r\n%s\r\n\r\nMiranda database contains %d events"), pclDlg->sPath.c_str(), nDBCount);
+ mir_snwprintf(szTmp, TranslateT("Failed to open file\r\n%s\r\n\r\nMiranda database contains %d events"), pclDlg->sPath.c_str(), nDBCount);
SETTEXTEX stText = { 0 };
stText.codepage = 1200;
@@ -670,7 +670,7 @@ bool bLoadFile(HWND hwndDlg, CLHistoryDlg * pclDlg) CloseHandle(hFile);
wchar_t szTmp[100];
- mir_sntprintf(szTmp, L"File open time %d\n", GetTickCount() - dwStart);
+ mir_snwprintf(szTmp, L"File open time %d\n", GetTickCount() - dwStart);
OutputDebugString(szTmp);
GETTEXTLENGTHEX sData = { 0 };
@@ -682,7 +682,7 @@ bool bLoadFile(HWND hwndDlg, CLHistoryDlg * pclDlg) if (!bScrollToBottom)
SendMessage(hRichEdit, EM_SETSCROLLPOS, 0, (LPARAM)&ptOldPos);
- mir_sntprintf(szTmp, TranslateT("With scroll to bottom %d\n"), GetTickCount() - dwStart);
+ mir_snwprintf(szTmp, TranslateT("With scroll to bottom %d\n"), GetTickCount() - dwStart);
OutputDebugString(szTmp);
return true;
}
@@ -828,7 +828,7 @@ LRESULT CALLBACK EditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa }
}
ft.chrg.cpMin = LONG(res);
- ft.chrg.cpMax = LONG(res + mir_tstrlen(fr->lpstrFindWhat));
+ ft.chrg.cpMax = LONG(res + mir_wstrlen(fr->lpstrFindWhat));
SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&ft.chrg);
return 0;
}
@@ -908,7 +908,7 @@ void SetRichEditFont(HWND hRichEdit, bool bUseSyntaxHL) ncf.dwMask = CFM_BOLD | CFM_FACE | CFM_ITALIC | CFM_SIZE | CFM_UNDERLINE;
ncf.dwEffects = db_get_dw(NULL, MODULE, szFileViewDB "TEffects", 0);
ncf.yHeight = db_get_dw(NULL, MODULE, szFileViewDB "THeight", 165);
- mir_tstrcpy(ncf.szFaceName, _DBGetString(NULL, MODULE, szFileViewDB "TFace", L"Courier New").c_str());
+ mir_wstrcpy(ncf.szFaceName, _DBGetString(NULL, MODULE, szFileViewDB "TFace", L"Courier New").c_str());
if (!bUseSyntaxHL) {
ncf.dwMask |= CFM_COLOR;
@@ -988,7 +988,7 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, if (n != sPath.npos)
sPath.erase(0, n + 1);
- if (mir_sntprintf(szTitle, szFormat, pszNick, sPath.c_str(), (pclDlg->bUtf8File ? L"UTF8" : L"ANSI")) > 0)
+ if (mir_snwprintf(szTitle, szFormat, pszNick, sPath.c_str(), (pclDlg->bUtf8File ? L"UTF8" : L"ANSI")) > 0)
SetWindowText(hwndDlg, szTitle);
}
@@ -1036,7 +1036,7 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, lf.lfStrikeOut = (dwEffects & CFE_STRIKEOUT) != 0;
lf.lfItalic = (dwEffects & CFE_ITALIC) != 0;
- mir_tstrcpy(lf.lfFaceName, _DBGetString(NULL, MODULE, szFileViewDB "TFace", L"Courier New").c_str());
+ mir_wstrcpy(lf.lfFaceName, _DBGetString(NULL, MODULE, szFileViewDB "TFace", L"Courier New").c_str());
CHOOSEFONT cf = { 0 };
cf.lStructSize = sizeof(cf);
cf.hwndOwner = hwndDlg;
diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp index bbcd2d8513..0b3faed0f8 100755 --- a/plugins/Msg_Export/src/options.cpp +++ b/plugins/Msg_Export/src/options.cpp @@ -92,7 +92,7 @@ public: int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
if (lParamSort == 1)
- return mir_tstrcmpi(pcli->pfnGetContactDisplayName(lParam1, 0), pcli->pfnGetContactDisplayName(lParam2, 0));
+ return mir_wstrcmpi(pcli->pfnGetContactDisplayName(lParam1, 0), pcli->pfnGetContactDisplayName(lParam2, 0));
if (lParamSort == 2)
return _DBGetString((MCONTACT)lParam1, "Protocol", "p", L"").compare(_DBGetString((MCONTACT)lParam2, "Protocol", "p", L""));
@@ -322,7 +322,7 @@ BOOL bApplyChanges(HWND hwndDlg) int nTmp = GetDlgItemInt(hwndDlg, IDC_MAX_CLOUMN_WIDTH, &bTrans, TRUE);
if (!bTrans || nTmp < 5) {
- mir_sntprintf(szTemp, TranslateT("Max line width must be at least %d"), 5);
+ mir_snwprintf(szTemp, TranslateT("Max line width must be at least %d"), 5);
MessageBox(hwndDlg, szTemp, MSG_BOX_TITEL, MB_OK);
bRet = false;
}
@@ -365,7 +365,7 @@ BOOL bApplyChanges(HWND hwndDlg) if (ListView_GetItem(hMapUser, &sItem)) {
MCONTACT hUser = (MCONTACT)sItem.lParam;
- if (mir_tstrlen(szTemp) > 0)
+ if (mir_wstrlen(szTemp) > 0)
db_set_ts(hUser, MODULE, "FileName", szTemp);
else
db_unset(hUser, MODULE, "FileName");
@@ -461,7 +461,7 @@ void AutoFindeFileNames(HWND hwndDlg) sItem.pszText = szSubCur;
sItem.cchTextMax = _countof(szSubCur);
if (ListView_GetItem(hMapUser, &sItem)) {
- size_t nLen = mir_tstrlen(szSubCur);
+ size_t nLen = mir_wstrlen(szSubCur);
if (wcsnicmp(szSubCur, szSearch, nLen) == 0) {
if (nLen < (size_t)nShortestMatch) {
nShortestMatch = (int)nLen;
@@ -523,7 +523,7 @@ void OpenHelp(HWND hwndDlg) {
wchar_t szPath[MAX_PATH];
if (GetModuleFileName(hInstance, szPath, _countof(szPath))) {
- size_t nLen = mir_tstrlen(szPath);
+ size_t nLen = mir_wstrlen(szPath);
if (nLen > 3) {
szPath[nLen - 1] = 't';
szPath[nLen - 2] = 'x';
@@ -643,7 +643,7 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar DWORD dwUIN = db_get_dw(hContact, pa->szModuleName, "UIN", 0);
wchar_t szTmp[50];
- mir_sntprintf(szTmp, L"%d", dwUIN);
+ mir_snwprintf(szTmp, L"%d", dwUIN);
sItem.iSubItem = 3;
sItem.pszText = szTmp;
ListView_SetItem(hMapUser, &sItem);
@@ -793,7 +793,7 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar GetDlgItemText(hwndDlg, IDC_FILE_VIEWER, szFile, _countof(szFile));
wchar_t buf[MAX_PATH];
- mir_sntprintf(buf, L"%s (*.exe;*.com;*.bat;*.cmd)%c*.exe;*.com;*.bat;*.cmd%c%s (*.*)%c*.*%c%c", TranslateT("Executable files"), 0, 0, TranslateT("All files"), 0, 0, 0);
+ mir_snwprintf(buf, L"%s (*.exe;*.com;*.bat;*.cmd)%c*.exe;*.com;*.bat;*.cmd%c%s (*.*)%c*.*%c%c", TranslateT("Executable files"), 0, 0, TranslateT("All files"), 0, 0, 0);
{
OPENFILENAME ofn = {}; // common dialog box structure
ofn.lStructSize = sizeof(OPENFILENAME);
@@ -843,7 +843,7 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar LPITEMIDLIST psItemIDList = SHBrowseForFolder(&sBrowseInfo);
if (psItemIDList) {
SHGetPathFromIDList(psItemIDList, lpDestDir);
- size_t n = mir_tstrlen(lpDestDir);
+ size_t n = mir_wstrlen(lpDestDir);
if (n > 0 && lpDestDir[n] != '\\') {
lpDestDir[n] = '\\';
lpDestDir[n + 1] = 0;
diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index c485229adc..686b006ffb 100755 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -198,7 +198,7 @@ void DisplayLastError(const wchar_t *pszError) DWORD error = GetLastError();
wchar_t szTemp[50];
- mir_sntprintf(szTemp, L"\r\nErrorCode: %d\r\n", error);
+ mir_snwprintf(szTemp, L"\r\nErrorCode: %d\r\n", error);
sError += szTemp;
sError += sGetErrorString(error);
MessageBox(NULL, sError.c_str(), MSG_BOX_TITEL, MB_OK);
@@ -274,7 +274,7 @@ void ReplaceAll(tstring &sSrc, const wchar_t *pszReplace, const tstring &sNew) {
string::size_type nCur = 0;
while ((nCur = sSrc.find(pszReplace, nCur)) != sSrc.npos) {
- sSrc.replace(nCur, mir_tstrlen(pszReplace), sNew);
+ sSrc.replace(nCur, mir_wstrlen(pszReplace), sNew);
nCur += sNew.size();
}
}
@@ -368,13 +368,13 @@ static bool bWriteTextToFile(HANDLE hFile, const wchar_t *pszSrc, bool bUtf8File {
if (nLen != -1) {
wchar_t *tmp = (wchar_t*)alloca(sizeof(wchar_t)*(nLen + 1));
- mir_tstrncpy(tmp, pszSrc, nLen + 1);
+ mir_wstrncpy(tmp, pszSrc, nLen + 1);
pszSrc = tmp;
}
if (!bUtf8File) {
// We need to downgrade text to ansi
- ptrA pszAstr(mir_t2a(pszSrc));
+ ptrA pszAstr(mir_u2a(pszSrc));
return bWriteToFile(hFile, pszAstr, -1);
}
@@ -464,7 +464,7 @@ bool bWriteHexToFile(HANDLE hFile, void * pData, int nSize) bool bReadMirandaDirAndPath()
{
wchar_t szDBPath[MAX_PATH], tmp[MAX_PATH];
- mir_tstrcpy(szDBPath, pszDbPathError);
+ mir_wstrcpy(szDBPath, pszDbPathError);
PathToAbsoluteT(L"miranda32.exe", tmp);
sMirandaPath = tmp;
sMirandaPath.erase(sMirandaPath.find_last_of(L"\\"));
@@ -562,7 +562,7 @@ tstring GetFilePathFromUser(MCONTACT hContact) if (enRenameAction != eDAAutomatic) {
tstring sRemoteUser = pcli->pfnGetContactDisplayName(hContact, 0);
- mir_sntprintf(szTemp,
+ mir_snwprintf(szTemp,
TranslateT("File name for the user \"%s\" has changed!\n\nfrom:\t%s\nto:\t%s\n\nDo you wish to rename file?"),
sRemoteUser.c_str(),
sPrevFileName.c_str(),
@@ -580,7 +580,7 @@ tstring GetFilePathFromUser(MCONTACT hContact) bCreatePathToFile(sFilePath);
while (!MoveFile(sPrevFileName.c_str(), sFilePath.c_str())) {
- mir_sntprintf(szTemp,
+ mir_snwprintf(szTemp,
TranslateT("Failed to rename file\n\nfrom:\t%s\nto:\t%s\n\nFailed with error: %s"),
sPrevFileName.c_str(),
sFilePath.c_str(),
@@ -679,7 +679,7 @@ void ReplaceDefines(MCONTACT hContact, tstring & sTarget) tstring sReplaceUin;
if (dwUIN) {
wchar_t sTmp[20];
- mir_sntprintf(sTmp, L"%d", dwUIN);
+ mir_snwprintf(sTmp, L"%d", dwUIN);
sReplaceUin = sTmp;
}
else sReplaceUin = FileNickFromHandle(hContact);
@@ -761,11 +761,11 @@ void ReplaceTimeVariables(tstring &sRet) GetLocalTime(&stTime);
wchar_t sTmp[20];
- mir_sntprintf(sTmp, L"%d", stTime.wYear);
+ mir_snwprintf(sTmp, L"%d", stTime.wYear);
ReplaceAll(sRet, L"%year%", sTmp);
- mir_sntprintf(sTmp, L"%.2d", stTime.wMonth);
+ mir_snwprintf(sTmp, L"%.2d", stTime.wMonth);
ReplaceAll(sRet, L"%month%", sTmp);
- mir_sntprintf(sTmp, L"%.2d", stTime.wDay);
+ mir_snwprintf(sTmp, L"%.2d", stTime.wDay);
ReplaceAll(sRet, L"%day%", sTmp);
}
}
@@ -821,7 +821,7 @@ void DisplayErrorDialog(const wchar_t *pszError, tstring& sFilePath, DBEVENTINFO if (MessageBox(NULL, sError.c_str(), MSG_BOX_TITEL, MB_YESNO) == IDYES) {
OPENFILENAME ofn; // common dialog box structure
wchar_t szFile[260]; // buffer for file name
- mir_tstrcpy(szFile, L"DebugInfo.txt");
+ mir_wstrcpy(szFile, L"DebugInfo.txt");
// Initialize OPENFILENAME
memset(&ofn, 0, sizeof(OPENFILENAME));
@@ -908,7 +908,7 @@ void ExportDBEventInfo(MCONTACT hContact, DBEVENTINFO &dbei) nFirstColumnWidth = 4;
}
else {
- sLocalUser = ptrT(GetMyOwnNick(hContact));
+ sLocalUser = ptrW(GetMyOwnNick(hContact));
sRemoteUser = pcli->pfnGetContactDisplayName(hContact, 0);
nFirstColumnWidth = max(sRemoteUser.size(), clFileTo1ColWidth[sFilePath]);
nFirstColumnWidth = max(sLocalUser.size(), nFirstColumnWidth);
@@ -973,11 +973,11 @@ void ExportDBEventInfo(MCONTACT hContact, DBEVENTINFO &dbei) for (int nCur = 0; nCur < 9; nCur++)
ReplaceAll(output, pszReplaceList[nCur], _DBGetString(hContact, sProto.c_str(), pszReplaceListA[nCur], L""));
- ptrT id(Contact_GetInfo(CNF_UNIQUEID, hContact, sProto.c_str()));
+ ptrW id(Contact_GetInfo(CNF_UNIQUEID, hContact, sProto.c_str()));
if (id != NULL)
ReplaceAll(output, L"%UIN%", id);
- mir_sntprintf(szTemp, L"%d", db_get_w(hContact, sProto.c_str(), "Age", 0));
+ mir_snwprintf(szTemp, L"%d", db_get_w(hContact, sProto.c_str(), "Age", 0));
ReplaceAll(output, L"%Age%", szTemp);
szTemp[0] = (wchar_t)db_get_b(hContact, sProto.c_str(), "Gender", 0);
@@ -993,11 +993,11 @@ void ExportDBEventInfo(MCONTACT hContact, DBEVENTINFO &dbei) }
// Get time stamp
- int nIndent = mir_sntprintf(szTemp, L"%-*s", nFirstColumnWidth, dbei.flags & DBEF_SENT ? sLocalUser.c_str() : sRemoteUser.c_str());
+ int nIndent = mir_snwprintf(szTemp, L"%-*s", nFirstColumnWidth, dbei.flags & DBEF_SENT ? sLocalUser.c_str() : sRemoteUser.c_str());
TimeZone_ToStringT(dbei.timestamp, sTimeFormat.c_str(), &szTemp[nIndent], _countof(szTemp) - nIndent - 2);
- nIndent = (int)mir_tstrlen(szTemp);
+ nIndent = (int)mir_wstrlen(szTemp);
szTemp[nIndent++] = ' ';
// Write first part of line with name and timestamp
@@ -1075,7 +1075,7 @@ void ExportDBEventInfo(MCONTACT hContact, DBEVENTINFO &dbei) LPGENW("Reason :") };
if (dbei.cbBlob < 8 || dbei.cbBlob > 5000) {
- int n = mir_sntprintf(szTemp, TranslateT("Invalid Database event received. Type %d, size %d"), dbei.eventType, dbei.cbBlob);
+ int n = mir_snwprintf(szTemp, TranslateT("Invalid Database event received. Type %d, size %d"), dbei.eventType, dbei.cbBlob);
if (!bWriteTextToFile(hFile, szTemp, bWriteUTF8Format, n))
DisplayErrorDialog(LPGENW("Failed to write Invalid Database event the file :\n"), sFilePath, &dbei);
break;
@@ -1103,7 +1103,7 @@ void ExportDBEventInfo(MCONTACT hContact, DBEVENTINFO &dbei) bWriteNewLine(hFile, nIndent) &&
bWriteTextToFile(hFile, LPGENW("UIN :"), bWriteUTF8Format)) {
DWORD uin = *((PDWORD)(dbei.pBlob));
- int n = mir_sntprintf(szTemp, L"%d", uin);
+ int n = mir_snwprintf(szTemp, L"%d", uin);
if (bWriteTextToFile(hFile, szTemp, bWriteUTF8Format, n)) {
char *pszEnd = (char *)(dbei.pBlob + dbei.cbSize);
for (int i = 0; i < nStringCount && pszCurBlobPos < pszEnd; i++) {
@@ -1178,14 +1178,14 @@ void ExportDBEventInfo(MCONTACT hContact, DBEVENTINFO &dbei) break;
default:
- int n = mir_sntprintf(szTemp, TranslateT("Unknown event type %d, size %d"), dbei.eventType, dbei.cbBlob);
+ int n = mir_snwprintf(szTemp, TranslateT("Unknown event type %d, size %d"), dbei.eventType, dbei.cbBlob);
if (!bWriteTextToFile(hFile, szTemp, bWriteUTF8Format, n))
DisplayErrorDialog(LPGENW("Failed to write Unknown event to the file :\n"), sFilePath, &dbei);
break;
}
}
else {
- int n = mir_sntprintf(szTemp, TranslateT("Unknown event type %d, size %d"), dbei.eventType, dbei.cbBlob);
+ int n = mir_snwprintf(szTemp, TranslateT("Unknown event type %d, size %d"), dbei.eventType, dbei.cbBlob);
bWriteTextToFile(hFile, szTemp, bWriteUTF8Format, n);
}
@@ -1380,13 +1380,13 @@ int nContactDeleted(WPARAM wparam, LPARAM /*lparam*/) CloseHandle(hPrevFile);
wchar_t szTemp[500];
- mir_sntprintf(szTemp, L"%s\r\n%s",
+ mir_snwprintf(szTemp, L"%s\r\n%s",
TranslateT("User has been deleted. Do you want to delete the file?"), sFilePath.c_str());
if (enDeleteAction == eDAAutomatic ||
MessageBox(NULL, szTemp, MSG_BOX_TITEL, MB_YESNO) == IDYES) {
if (!DeleteFile(sFilePath.c_str())) {
- mir_sntprintf(szTemp,
+ mir_snwprintf(szTemp,
L"%s\r\n%s",
TranslateT("Failed to delete the file"),
sFilePath.c_str());
@@ -1434,5 +1434,5 @@ void SaveSettings() wchar_t* GetMyOwnNick(MCONTACT hContact)
{
wchar_t *p = Contact_GetInfo(CNF_DISPLAY, NULL, GetContactProto(hContact));
- return (p != NULL) ? p : mir_tstrdup(TranslateT("No_Nick"));
+ return (p != NULL) ? p : mir_wstrdup(TranslateT("No_Nick"));
}
diff --git a/plugins/MyDetails/src/data.cpp b/plugins/MyDetails/src/data.cpp index c9b2a1b0ea..681c2d4f61 100644 --- a/plugins/MyDetails/src/data.cpp +++ b/plugins/MyDetails/src/data.cpp @@ -55,7 +55,7 @@ void DeInitProtocolData() Protocol::Protocol(const char *aName, const wchar_t *descr)
{
mir_strncpy(name, aName, _countof(name));
- mir_tstrncpy(description, descr, _countof(description));
+ mir_wstrncpy(description, descr, _countof(description));
data_changed = true;
@@ -86,9 +86,9 @@ Protocol::~Protocol() void Protocol::lcopystr(wchar_t *dest, wchar_t *src, size_t maxlen)
{
- if (mir_tstrcmp(dest, src) != 0) {
+ if (mir_wstrcmp(dest, src) != 0) {
data_changed = true;
- mir_tstrncpy(dest, src, (DWORD)maxlen);
+ mir_wstrncpy(dest, src, (DWORD)maxlen);
}
}
@@ -134,7 +134,7 @@ int Protocol::GetStatus() else {
wchar_t *p = (tszXStatusName[0] != 0) ? TranslateTS(tszXStatusName) : TranslateT("<no status name>");
if (tszXStatusMessage[0])
- mir_sntprintf(status_name, L"%s: %s", p, tszXStatusMessage);
+ mir_snwprintf(status_name, L"%s: %s", p, tszXStatusMessage);
else
lcopystr(status_name, p, _countof(status_name));
}
@@ -214,11 +214,11 @@ void Protocol::GetStatusMsg(int aStatus, wchar_t *msg, size_t msg_size) if (!CanGetStatusMsg())
lcopystr(msg, L"", msg_size);
else if (aStatus == status && ProtoServiceExists(name, PS_GETMYAWAYMSG)) {
- ptrT tmp((wchar_t *)CallProtoService(name, PS_GETMYAWAYMSG, 0, SGMA_TCHAR));
+ ptrW tmp((wchar_t *)CallProtoService(name, PS_GETMYAWAYMSG, 0, SGMA_TCHAR));
lcopystr(msg, tmp == NULL ? L"" : tmp, msg_size);
}
else if (ServiceExists(MS_AWAYMSG_GETSTATUSMSGT)) {
- ptrT tmp((wchar_t *)CallService(MS_AWAYMSG_GETSTATUSMSGT, (WPARAM)aStatus, (LPARAM)name));
+ ptrW tmp((wchar_t *)CallService(MS_AWAYMSG_GETSTATUSMSGT, (WPARAM)aStatus, (LPARAM)name));
lcopystr(msg, tmp == NULL ? L"" : tmp, msg_size);
}
}
@@ -286,7 +286,7 @@ int Protocol::GetNickMaxLength() wchar_t* Protocol::GetNick()
{
- ptrT nick(Contact_GetInfo(CNF_DISPLAY, NULL, name));
+ ptrW nick(Contact_GetInfo(CNF_DISPLAY, NULL, name));
lcopystr(nickname, (nick != NULL) ? nick : L"", _countof(nickname));
return nickname;
}
@@ -458,7 +458,7 @@ void ProtocolArray::SetNicks(const wchar_t *nick) if (nick == NULL || nick[0] == '\0')
return;
- mir_tstrncpy(default_nick, nick, _countof(default_nick));
+ mir_wstrncpy(default_nick, nick, _countof(default_nick));
db_set_ts(0, MODULE_NAME, SETTING_DEFAULT_NICK, nick);
@@ -493,18 +493,18 @@ void ProtocolArray::SetStatusMsgs(int status, const wchar_t *message) void ProtocolArray::GetDefaultNick()
{
- ptrT tszNick(db_get_tsa(0, MODULE_NAME, SETTING_DEFAULT_NICK));
+ ptrW tszNick(db_get_tsa(0, MODULE_NAME, SETTING_DEFAULT_NICK));
if (tszNick)
- mir_tstrncpy(default_nick, tszNick, _countof(default_nick));
+ mir_wstrncpy(default_nick, tszNick, _countof(default_nick));
else
default_nick[0] = '\0';
}
void ProtocolArray::GetDefaultAvatar()
{
- ptrT tszFile(db_get_tsa(0, "ContactPhoto", "File"));
+ ptrW tszFile(db_get_tsa(0, "ContactPhoto", "File"));
if (tszFile)
- mir_tstrncpy(default_avatar_file, tszFile, _countof(default_avatar_file));
+ mir_wstrncpy(default_avatar_file, tszFile, _countof(default_avatar_file));
else
default_avatar_file[0] = '\0';
}
@@ -523,7 +523,7 @@ wchar_t *ProtocolArray::GetDefaultStatusMsg(int status) wchar_t *tmp = (wchar_t *)CallService(MS_AWAYMSG_GETSTATUSMSGT, (WPARAM)status, 0);
if (tmp != NULL) {
- mir_tstrncpy(default_status_message, tmp, _countof(default_status_message));
+ mir_wstrncpy(default_status_message, tmp, _countof(default_status_message));
mir_free(tmp);
}
diff --git a/plugins/MyDetails/src/frame.cpp b/plugins/MyDetails/src/frame.cpp index 2778f655b9..b392bbc185 100644 --- a/plugins/MyDetails/src/frame.cpp +++ b/plugins/MyDetails/src/frame.cpp @@ -234,11 +234,11 @@ int CreateFrame() memset(&font_id[i], 0, sizeof(font_id[i]));
font_id[i].cbSize = sizeof(FontIDT);
- mir_tstrncpy(font_id[i].group, LPGENW("My details"), _countof(font_id[i].group));
- mir_tstrncpy(font_id[i].name, font_names[i], _countof(font_id[i].name));
+ mir_wstrncpy(font_id[i].group, LPGENW("My details"), _countof(font_id[i].group));
+ mir_wstrncpy(font_id[i].name, font_names[i], _countof(font_id[i].name));
mir_strncpy(font_id[i].dbSettingsGroup, MODULE_NAME, _countof(font_id[i].dbSettingsGroup));
- mir_tstrncpy(font_id[i].backgroundName, LPGENW("Background"), _countof(font_id[i].backgroundName));
- mir_tstrncpy(font_id[i].backgroundGroup, LPGENW("My details"), _countof(font_id[i].backgroundGroup));
+ mir_wstrncpy(font_id[i].backgroundName, LPGENW("Background"), _countof(font_id[i].backgroundName));
+ mir_wstrncpy(font_id[i].backgroundGroup, LPGENW("My details"), _countof(font_id[i].backgroundGroup));
mir_strncpy(font_id[i].prefix, font_settings[i], _countof(font_id[i].prefix));
@@ -246,7 +246,7 @@ int CreateFrame() font_id[i].deffontsettings.size = -MulDiv(font_sizes[i], GetDeviceCaps(hdc, LOGPIXELSY), 72);
font_id[i].deffontsettings.style = font_styles[i];
font_id[i].deffontsettings.charset = DEFAULT_CHARSET;
- mir_tstrncpy(font_id[i].deffontsettings.szFace, L"Tahoma", _countof(font_id[i].deffontsettings.szFace));
+ mir_wstrncpy(font_id[i].deffontsettings.szFace, L"Tahoma", _countof(font_id[i].deffontsettings.szFace));
font_id[i].order = i;
font_id[i].flags = FIDF_DEFAULTVALID;
FontRegisterT(&font_id[i]);
@@ -493,7 +493,7 @@ RECT GetRect(HDC hdc, RECT rc, const wchar_t *text, const wchar_t *def_text, Pro RECT r_tmp = rc;
// Only first line
- wchar_t *tmp2 = mir_tstrdup(tmp);
+ wchar_t *tmp2 = mir_wstrdup(tmp);
wchar_t *pos = wcschr(tmp2, '\r');
if (pos != NULL)
pos[0] = '\0';
@@ -502,7 +502,7 @@ RECT GetRect(HDC hdc, RECT rc, const wchar_t *text, const wchar_t *def_text, Pro pos[0] = '\0';
if (smileys)
- DRAW_TEXT(hdc, tmp2, (int)mir_tstrlen(tmp2), &r_tmp, uFormat | DT_CALCRECT, proto->name);
+ DRAW_TEXT(hdc, tmp2, (int)mir_wstrlen(tmp2), &r_tmp, uFormat | DT_CALCRECT, proto->name);
else
DrawText(hdc, tmp2, -1, &r_tmp, uFormat | DT_CALCRECT);
@@ -1030,7 +1030,7 @@ void DrawTextWithRect(HDC hdc, const wchar_t *text, const wchar_t *def_text, REC tmp = text;
// Only first line
- wchar_t *tmp2 = mir_tstrdup(tmp);
+ wchar_t *tmp2 = mir_wstrdup(tmp);
wchar_t *pos = wcsrchr(tmp2, '\r');
if (pos != NULL)
pos[0] = '\0';
@@ -1073,7 +1073,7 @@ void DrawTextWithRect(HDC hdc, const wchar_t *text, const wchar_t *def_text, REC }
}
- DRAW_TEXT(hdc, tmp2, (int)mir_tstrlen(tmp2), &r, uFormat, proto->name);
+ DRAW_TEXT(hdc, tmp2, (int)mir_wstrlen(tmp2), &r, uFormat, proto->name);
if (mouse_over)
DrawText(hdc, L" ...", 4, &rc_tmp, uFormat);
@@ -1267,7 +1267,7 @@ void Draw(HWND hwnd, HDC hdc_orig) SelectObject(hdc, hFont[FONT_STATUS]);
SetTextColor(hdc, font_colour[FONT_STATUS]);
- DRAW_TEXT(hdc, proto->status_name, (int)mir_tstrlen(proto->status_name), &rc, uFormat, proto->name);
+ DRAW_TEXT(hdc, proto->status_name, (int)mir_wstrlen(proto->status_name), &rc, uFormat, proto->name);
SelectClipRgn(hdc, NULL);
DeleteObject(rgn);
@@ -1421,7 +1421,7 @@ void ShowProtocolStatusMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto mii.dwTypeData = (wchar_t *)malloc(sizeof(wchar_t) * mii.cch);
GetMenuItemInfo(menu, i, TRUE, &mii);
- if (mir_tstrcmp(mii.dwTypeData, proto->description) == 0)
+ if (mir_wstrcmp(mii.dwTypeData, proto->description) == 0)
submenu = GetSubMenu(menu, i);
free(mii.dwTypeData);
@@ -1478,7 +1478,7 @@ void ShowListeningToMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto, P // Add this proto to menu
wchar_t tmp[128];
- mir_sntprintf(tmp, TranslateT("Enable listening to for %s"), proto->description);
+ mir_snwprintf(tmp, TranslateT("Enable listening to for %s"), proto->description);
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
@@ -1486,7 +1486,7 @@ void ShowListeningToMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto, P mii.fType = MFT_STRING;
mii.fState = proto->ListeningToEnabled() ? MFS_CHECKED : 0;
mii.dwTypeData = tmp;
- mii.cch = (int)mir_tstrlen(tmp);
+ mii.cch = (int)mir_wstrlen(tmp);
mii.wID = 1;
if (!proto->CanSetListeningTo())
@@ -1665,7 +1665,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar mii.fMask = MIIM_ID | MIIM_TYPE;
mii.fType = MFT_STRING;
mii.dwTypeData = protocols->Get(i)->description;
- mii.cch = (int)mir_tstrlen(protocols->Get(i)->description);
+ mii.cch = (int)mir_wstrlen(protocols->Get(i)->description);
mii.wID = i + 1;
if (i == data->protocol_number) {
@@ -1716,14 +1716,14 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar // Add this proto to menu
wchar_t tmp[128];
- mir_sntprintf(tmp, TranslateT("Set my avatar for %s..."), proto->description);
+ mir_snwprintf(tmp, TranslateT("Set my avatar for %s..."), proto->description);
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_ID | MIIM_TYPE;
mii.fType = MFT_STRING;
mii.dwTypeData = tmp;
- mii.cch = (int)mir_tstrlen(tmp);
+ mii.cch = (int)mir_wstrlen(tmp);
mii.wID = 1;
if (!proto->CanSetAvatar()) {
@@ -1756,14 +1756,14 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar // Add this proto to menu
wchar_t tmp[128];
- mir_sntprintf(tmp, TranslateT("Set my nickname for %s..."), proto->description);
+ mir_snwprintf(tmp, TranslateT("Set my nickname for %s..."), proto->description);
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_ID | MIIM_TYPE;
mii.fType = MFT_STRING;
mii.dwTypeData = tmp;
- mii.cch = (int)mir_tstrlen(tmp);
+ mii.cch = (int)mir_wstrlen(tmp);
mii.wID = 1;
if (!proto->CanSetNick()) {
@@ -1804,14 +1804,14 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar if (protocols->CanSetStatusMsgPerProtocol()) {
// Add this proto to menu
- mir_sntprintf(tmp, TranslateT("Set my status message for %s..."), proto->description);
+ mir_snwprintf(tmp, TranslateT("Set my status message for %s..."), proto->description);
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_ID | MIIM_TYPE;
mii.fType = MFT_STRING;
mii.dwTypeData = tmp;
- mii.cch = (int)mir_tstrlen(tmp);
+ mii.cch = (int)mir_wstrlen(tmp);
mii.wID = 1;
if (!proto->CanSetStatusMsg()) {
@@ -1823,14 +1823,14 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar }
// Add this to menu
- mir_sntprintf(tmp, TranslateT("Set my status message for %s..."), pcli->pfnGetStatusModeDescription(proto->status, 0));
+ mir_snwprintf(tmp, TranslateT("Set my status message for %s..."), pcli->pfnGetStatusModeDescription(proto->status, 0));
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_ID | MIIM_TYPE;
mii.fType = MFT_STRING;
mii.dwTypeData = tmp;
- mii.cch = (int)mir_tstrlen(tmp);
+ mii.cch = (int)mir_wstrlen(tmp);
mii.wID = 2;
if (proto->status == ID_STATUS_OFFLINE) {
@@ -1886,7 +1886,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar // Add this proto to menu
wchar_t tmp[128];
- mir_sntprintf(tmp, TranslateT("Enable listening to for %s"), proto->description);
+ mir_snwprintf(tmp, TranslateT("Enable listening to for %s"), proto->description);
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
@@ -1894,7 +1894,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar mii.fType = MFT_STRING;
mii.fState = proto->ListeningToEnabled() ? MFS_CHECKED : 0;
mii.dwTypeData = tmp;
- mii.cch = (int)mir_tstrlen(tmp);
+ mii.cch = (int)mir_wstrlen(tmp);
mii.wID = 5;
if (!proto->CanSetListeningTo())
mii.fState |= MFS_DISABLED;
@@ -1902,14 +1902,14 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar InsertMenuItem(submenu, 0, TRUE, &mii);
// Add this to menu
- mir_sntprintf(tmp, TranslateT("Set my status message for %s..."), pcli->pfnGetStatusModeDescription(proto->status, 0));
+ mir_snwprintf(tmp, TranslateT("Set my status message for %s..."), pcli->pfnGetStatusModeDescription(proto->status, 0));
memset(&mii, 0, sizeof(mii));
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_ID | MIIM_TYPE;
mii.fType = MFT_STRING;
mii.dwTypeData = tmp;
- mii.cch = (int)mir_tstrlen(tmp);
+ mii.cch = (int)mir_wstrlen(tmp);
mii.wID = 4;
if (proto->status == ID_STATUS_OFFLINE) {
@@ -1921,14 +1921,14 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar if (protocols->CanSetStatusMsgPerProtocol()) {
// Add this proto to menu
- mir_sntprintf(tmp, TranslateT("Set my status message for %s..."), proto->description);
+ mir_snwprintf(tmp, TranslateT("Set my status message for %s..."), proto->description);
memset(&mii, 0, sizeof(mii));
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_ID | MIIM_TYPE;
mii.fType = MFT_STRING;
mii.dwTypeData = tmp;
- mii.cch = (int)mir_tstrlen(tmp);
+ mii.cch = (int)mir_wstrlen(tmp);
mii.wID = 3;
if (!proto->CanSetStatusMsg()) {
@@ -1939,14 +1939,14 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar InsertMenuItem(submenu, 0, TRUE, &mii);
}
- mir_sntprintf(tmp, TranslateT("Set my nickname for %s..."), proto->description);
+ mir_snwprintf(tmp, TranslateT("Set my nickname for %s..."), proto->description);
memset(&mii, 0, sizeof(mii));
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_ID | MIIM_TYPE;
mii.fType = MFT_STRING;
mii.dwTypeData = tmp;
- mii.cch = (int)mir_tstrlen(tmp);
+ mii.cch = (int)mir_wstrlen(tmp);
mii.wID = 2;
if (!proto->CanSetNick()) {
@@ -1956,14 +1956,14 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar InsertMenuItem(submenu, 0, TRUE, &mii);
- mir_sntprintf(tmp, TranslateT("Set my avatar for %s..."), proto->description);
+ mir_snwprintf(tmp, TranslateT("Set my avatar for %s..."), proto->description);
memset(&mii, 0, sizeof(mii));
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_ID | MIIM_TYPE;
mii.fType = MFT_STRING;
mii.dwTypeData = tmp;
- mii.cch = (int)mir_tstrlen(tmp);
+ mii.cch = (int)mir_wstrlen(tmp);
mii.wID = 1;
if (!proto->CanSetAvatar()) {
diff --git a/plugins/MyDetails/src/services.cpp b/plugins/MyDetails/src/services.cpp index 30be916a0f..aa474bb453 100644 --- a/plugins/MyDetails/src/services.cpp +++ b/plugins/MyDetails/src/services.cpp @@ -52,15 +52,15 @@ static INT_PTR CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam bool foundDefNick = true;
for (int i = 1; foundDefNick && i < protocols->GetSize(); i++) {
- if (mir_tstrcmpi(protocols->Get(i)->nickname, nick) != 0) {
+ if (mir_wstrcmpi(protocols->Get(i)->nickname, nick) != 0) {
foundDefNick = false;
break;
}
}
if (foundDefNick)
- if (mir_tstrcmpi(protocols->default_nick, nick) != 0)
- mir_tstrcpy(protocols->default_nick, nick);
+ if (mir_wstrcmpi(protocols->default_nick, nick) != 0)
+ mir_wstrcpy(protocols->default_nick, nick);
}
SetDlgItemText(hwndDlg, IDC_NICKNAME, protocols->default_nick);
@@ -70,7 +70,7 @@ static INT_PTR CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam Protocol *proto = protocols->Get(proto_num);
wchar_t tmp[128];
- mir_sntprintf(tmp, TranslateT("Set my nickname for %s"), proto->description);
+ mir_snwprintf(tmp, TranslateT("Set my nickname for %s"), proto->description);
SetWindowText(hwndDlg, tmp);
@@ -188,13 +188,13 @@ INT_PTR PluginCommand_GetMyNickname(WPARAM wParam, LPARAM lParam) char *proto = (char *)wParam;
if (proto == NULL) {
- mir_tstrncpy(ret, protocols->default_nick, MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE);
+ mir_wstrncpy(ret, protocols->default_nick, MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE);
return 0;
}
else {
Protocol *protocol = protocols->Get(proto);
if (protocol != NULL) {
- mir_tstrncpy(ret, protocol->nickname, MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE);
+ mir_wstrncpy(ret, protocol->nickname, MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE);
return 0;
}
@@ -263,7 +263,7 @@ INT_PTR PluginCommand_GetMyAvatar(WPARAM wParam, LPARAM lParam) return -1;
if (proto == NULL) {
- mir_tstrncpy(ret, protocols->default_avatar_file, MS_MYDETAILS_GETMYAVATAR_BUFFER_SIZE);
+ mir_wstrncpy(ret, protocols->default_avatar_file, MS_MYDETAILS_GETMYAVATAR_BUFFER_SIZE);
return 0;
}
@@ -274,8 +274,8 @@ INT_PTR PluginCommand_GetMyAvatar(WPARAM wParam, LPARAM lParam) protocols->Get(i)->GetAvatar();
- if (mir_tstrlen(protocols->Get(i)->avatar_file))
- mir_tstrncpy(ret, protocols->Get(i)->avatar_file, MS_MYDETAILS_GETMYAVATAR_BUFFER_SIZE);
+ if (mir_wstrlen(protocols->Get(i)->avatar_file))
+ mir_wstrncpy(ret, protocols->Get(i)->avatar_file, MS_MYDETAILS_GETMYAVATAR_BUFFER_SIZE);
else
ret[0] = '\0';
@@ -333,7 +333,7 @@ static INT_PTR CALLBACK DlgProcSetStatusMessage(HWND hwndDlg, UINT msg, WPARAM w }
wchar_t title[256];
- mir_sntprintf(title, TranslateT("Set my status message for %s"), proto->description);
+ mir_snwprintf(title, TranslateT("Set my status message for %s"), proto->description);
SetWindowText(hwndDlg, title);
SetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, proto->GetStatusMsg());
@@ -342,7 +342,7 @@ static INT_PTR CALLBACK DlgProcSetStatusMessage(HWND hwndDlg, UINT msg, WPARAM w Window_SetProtoIcon_IcoLib(hwndDlg, NULL, data->status);
wchar_t title[256];
- mir_sntprintf(title, TranslateT("Set my status message for %s"), pcli->pfnGetStatusModeDescription(data->status, 0));
+ mir_snwprintf(title, TranslateT("Set my status message for %s"), pcli->pfnGetStatusModeDescription(data->status, 0));
SetWindowText(hwndDlg, title);
SetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, protocols->GetDefaultStatusMsg(data->status));
diff --git a/plugins/NewAwaySysMod/src/AwaySys.cpp b/plugins/NewAwaySysMod/src/AwaySys.cpp index 7a86594b43..e80fa4c2c7 100644 --- a/plugins/NewAwaySysMod/src/AwaySys.cpp +++ b/plugins/NewAwaySysMod/src/AwaySys.cpp @@ -325,11 +325,11 @@ int PreBuildContactMenu(WPARAM hContact, LPARAM) // the protocol supports status message sending for current status, or autoreplying
if ((Flag1 & PF1_MODEMSGSEND && CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(iMode)) ||
((Flag1 & PF1_IM) == PF1_IM && (i < 0 || !g_AutoreplyOptPage.GetDBValueCopy(StatusModeList[i].DisableReplyCtlID))))
- mir_sntprintf(szSetStr, TranslateT("Set %s message for the contact"), pcli->pfnGetStatusModeDescription(iMode, 0), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_snwprintf(szSetStr, TranslateT("Set %s message for the contact"), pcli->pfnGetStatusModeDescription(iMode, 0), pcli->pfnGetContactDisplayName(hContact, 0));
// the protocol supports status message reading for contact's status
if (Flag1 & PF1_MODEMSGRECV && CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(iContactMode)) {
- mir_sntprintf(szReadStr, TranslateT("Re&ad %s message"), pcli->pfnGetStatusModeDescription(iContactMode, 0));
+ mir_snwprintf(szReadStr, TranslateT("Re&ad %s message"), pcli->pfnGetStatusModeDescription(iContactMode, 0));
hReadMsgIcon = Skin_LoadProtoIcon(szProto, iContactMode);
}
}
@@ -488,18 +488,18 @@ INT_PTR srvVariablesHandler(WPARAM, LPARAM lParam) ARGUMENTSINFO *ai = (ARGUMENTSINFO*)lParam;
ai->flags = AIF_DONTPARSE;
TCString Result;
- if (!mir_tstrcmp(ai->targv[0], VAR_AWAYSINCE_TIME)) {
+ if (!mir_wstrcmp(ai->targv[0], VAR_AWAYSINCE_TIME)) {
GetTimeFormat(LOCALE_USER_DEFAULT, 0, g_ProtoStates[VarParseData.szProto].m_awaySince, (ai->argc > 1 && *ai->targv[1]) ? ai->targv[1] : L"H:mm", Result.GetBuffer(256), 256);
Result.ReleaseBuffer();
}
- else if (!mir_tstrcmp(ai->targv[0], VAR_AWAYSINCE_DATE)) {
+ else if (!mir_wstrcmp(ai->targv[0], VAR_AWAYSINCE_DATE)) {
GetDateFormat(LOCALE_USER_DEFAULT, 0, g_ProtoStates[VarParseData.szProto].m_awaySince, (ai->argc > 1 && *ai->targv[1]) ? ai->targv[1] : NULL, Result.GetBuffer(256), 256);
Result.ReleaseBuffer();
}
- else if (!mir_tstrcmp(ai->targv[0], VAR_STATDESC)) {
+ else if (!mir_wstrcmp(ai->targv[0], VAR_STATDESC)) {
Result = (VarParseData.Flags & VPF_XSTATUS) ? STR_XSTATUSDESC : pcli->pfnGetStatusModeDescription(g_ProtoStates[VarParseData.szProto].m_status, 0);
}
- else if (!mir_tstrcmp(ai->targv[0], VAR_MYNICK)) {
+ else if (!mir_wstrcmp(ai->targv[0], VAR_MYNICK)) {
if (g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_MYNICKPERPROTO) && VarParseData.szProto)
Result = db_get_s(NULL, VarParseData.szProto, "Nick", (wchar_t*)NULL);
@@ -509,15 +509,15 @@ INT_PTR srvVariablesHandler(WPARAM, LPARAM lParam) if (Result == NULL)
Result = TranslateT("Stranger");
}
- else if (!mir_tstrcmp(ai->targv[0], VAR_REQUESTCOUNT)) {
- mir_sntprintf(Result.GetBuffer(16), 16, L"%d", db_get_w(ai->fi->hContact, MOD_NAME, DB_REQUESTCOUNT, 0));
+ else if (!mir_wstrcmp(ai->targv[0], VAR_REQUESTCOUNT)) {
+ mir_snwprintf(Result.GetBuffer(16), 16, L"%d", db_get_w(ai->fi->hContact, MOD_NAME, DB_REQUESTCOUNT, 0));
Result.ReleaseBuffer();
}
- else if (!mir_tstrcmp(ai->targv[0], VAR_MESSAGENUM)) {
- mir_sntprintf(Result.GetBuffer(16), 16, L"%d", db_get_w(ai->fi->hContact, MOD_NAME, DB_MESSAGECOUNT, 0));
+ else if (!mir_wstrcmp(ai->targv[0], VAR_MESSAGENUM)) {
+ mir_snwprintf(Result.GetBuffer(16), 16, L"%d", db_get_w(ai->fi->hContact, MOD_NAME, DB_MESSAGECOUNT, 0));
Result.ReleaseBuffer();
}
- else if (!mir_tstrcmp(ai->targv[0], VAR_TIMEPASSED)) {
+ else if (!mir_wstrcmp(ai->targv[0], VAR_TIMEPASSED)) {
ULARGE_INTEGER ul_AwaySince, ul_Now;
SYSTEMTIME st;
GetLocalTime(&st);
@@ -527,14 +527,14 @@ INT_PTR srvVariablesHandler(WPARAM, LPARAM lParam) ul_Now.QuadPart /= 10000000; // now it's in seconds
Result.GetBuffer(256);
if (ul_Now.LowPart >= 7200) // more than 2 hours
- mir_sntprintf(Result, 256, TranslateT("%d hours"), ul_Now.LowPart / 3600);
+ mir_snwprintf(Result, 256, TranslateT("%d hours"), ul_Now.LowPart / 3600);
else if (ul_Now.LowPart >= 120) // more than 2 minutes
- mir_sntprintf(Result, 256, TranslateT("%d minutes"), ul_Now.LowPart / 60);
+ mir_snwprintf(Result, 256, TranslateT("%d minutes"), ul_Now.LowPart / 60);
else
- mir_sntprintf(Result, 256, TranslateT("%d seconds"), ul_Now.LowPart);
+ mir_snwprintf(Result, 256, TranslateT("%d seconds"), ul_Now.LowPart);
Result.ReleaseBuffer();
}
- else if (!mir_tstrcmp(ai->targv[0], VAR_PREDEFINEDMESSAGE)) {
+ else if (!mir_wstrcmp(ai->targv[0], VAR_PREDEFINEDMESSAGE)) {
ai->flags = 0; // reset AIF_DONTPARSE flag
if (ai->argc != 2)
return NULL;
@@ -544,7 +544,7 @@ INT_PTR srvVariablesHandler(WPARAM, LPARAM lParam) TreeCtrl->DBToMem(CString(MOD_NAME));
for (int i = 0; i < TreeCtrl->m_value.GetSize(); i++) {
- if (!(TreeCtrl->m_value[i].Flags & TIF_GROUP) && !mir_tstrcmpi(TreeCtrl->m_value[i].Title, ai->targv[1])) {
+ if (!(TreeCtrl->m_value[i].Flags & TIF_GROUP) && !mir_wstrcmpi(TreeCtrl->m_value[i].Title, ai->targv[1])) {
Result = TreeCtrl->m_value[i].User_Str1;
break;
}
@@ -552,7 +552,7 @@ INT_PTR srvVariablesHandler(WPARAM, LPARAM lParam) if (Result == NULL) // if we didn't find a message with specified title
return NULL; // return it now, as later we change NULL to ""
}
- else if (!mir_tstrcmp(ai->targv[0], VAR_PROTOCOL)) {
+ else if (!mir_wstrcmp(ai->targv[0], VAR_PROTOCOL)) {
if (VarParseData.szProto) {
CString AnsiResult;
CallProtoService(VarParseData.szProto, PS_GETNAME, 256, (LPARAM)AnsiResult.GetBuffer(256));
@@ -566,7 +566,7 @@ INT_PTR srvVariablesHandler(WPARAM, LPARAM lParam) if (!szResult)
return NULL;
- mir_tstrcpy(szResult, (Result != NULL) ? Result : L"");
+ mir_wstrcpy(szResult, (Result != NULL) ? Result : L"");
return (INT_PTR)szResult;
}
diff --git a/plugins/NewAwaySysMod/src/CString.cpp b/plugins/NewAwaySysMod/src/CString.cpp index 58a8826ed9..83c9717ee5 100644 --- a/plugins/NewAwaySysMod/src/CString.cpp +++ b/plugins/NewAwaySysMod/src/CString.cpp @@ -279,7 +279,7 @@ CString db_get_s(MCONTACT hContact, const char *szModule, const char *szSetting, TCString db_get_s(MCONTACT hContact, const char *szModule, const char *szSetting, const wchar_t *szDefaultValue)
{
- ptrT p( db_get_tsa(hContact, szModule, szSetting));
+ ptrW p( db_get_tsa(hContact, szModule, szSetting));
return TCString(p == NULL ? szDefaultValue : p);
}
diff --git a/plugins/NewAwaySysMod/src/Client.cpp b/plugins/NewAwaySysMod/src/Client.cpp index dbee9f8da2..a571f7f2b1 100644 --- a/plugins/NewAwaySysMod/src/Client.cpp +++ b/plugins/NewAwaySysMod/src/Client.cpp @@ -149,7 +149,7 @@ int GetRecentGroupID(int iMode) return g_Messages_RecentRootID;
for (int Order = 0; Order < TreeCtrl->m_value.GetSize(); Order++) // find a group named accordingly to the current status
- if (TreeCtrl->m_value[Order].ParentID == g_Messages_RecentRootID && TreeCtrl->m_value[Order].Flags & TIF_GROUP && !mir_tstrcmpi(TreeCtrl->m_value[Order].Title, iMode ? pcli->pfnGetStatusModeDescription(iMode, 0) : MSGTREE_RECENT_OTHERGROUP))
+ if (TreeCtrl->m_value[Order].ParentID == g_Messages_RecentRootID && TreeCtrl->m_value[Order].Flags & TIF_GROUP && !mir_wstrcmpi(TreeCtrl->m_value[Order].Title, iMode ? pcli->pfnGetStatusModeDescription(iMode, 0) : MSGTREE_RECENT_OTHERGROUP))
return TreeCtrl->m_value[Order].ID;
return -1;
diff --git a/plugins/NewAwaySysMod/src/GroupCheckbox.cpp b/plugins/NewAwaySysMod/src/GroupCheckbox.cpp index 913edfe261..4ec48644bb 100644 --- a/plugins/NewAwaySysMod/src/GroupCheckbox.cpp +++ b/plugins/NewAwaySysMod/src/GroupCheckbox.cpp @@ -96,7 +96,7 @@ static int CALLBACK CheckboxWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM l SIZE size;
wchar_t *szText = (wchar_t*)_alloca(Len * sizeof(wchar_t));
GetWindowText(hWnd, szText, Len);
- GetTextExtentPoint32(hdc, szText, (int)mir_tstrlen(szText), &size);
+ GetTextExtentPoint32(hdc, szText, (int)mir_wstrlen(szText), &size);
rcText.right = size.cx;
rcText.bottom = size.cy;
}
@@ -290,7 +290,7 @@ static int CALLBACK CheckboxWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM l GetThemeTextExtent(hTheme, hdcMem, BP_GROUPBOX, IsWindowEnabled(hWnd) ? GBS_NORMAL : GBS_DISABLED, szTextT, -1, DT_CALCRECT | DT_LEFT | DT_VCENTER | DT_SINGLELINE, 0, &rcText);
else {
SIZE size;
- GetTextExtentPoint32(hdcMem, szTextT, (int)mir_tstrlen(szTextT), &size);
+ GetTextExtentPoint32(hdcMem, szTextT, (int)mir_wstrlen(szTextT), &size);
rcText.right = size.cx;
rcText.bottom = size.cy;
}
diff --git a/plugins/NewAwaySysMod/src/Notification.cpp b/plugins/NewAwaySysMod/src/Notification.cpp index 3aaee466f0..e52cdeff3d 100644 --- a/plugins/NewAwaySysMod/src/Notification.cpp +++ b/plugins/NewAwaySysMod/src/Notification.cpp @@ -26,8 +26,8 @@ void ShowMsg(wchar_t *FirstLine, wchar_t *SecondLine, bool IsErrorMsg, int Timeo if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
POPUPDATAT ppd = { 0 };
ppd.lchIcon = LoadIcon(NULL, IsErrorMsg ? IDI_EXCLAMATION : IDI_INFORMATION);
- mir_tstrncpy(ppd.lptzContactName, FirstLine, MAX_CONTACTNAME);
- mir_tstrncpy(ppd.lptzText, SecondLine, MAX_SECONDLINE);
+ mir_wstrncpy(ppd.lptzContactName, FirstLine, MAX_CONTACTNAME);
+ mir_wstrncpy(ppd.lptzText, SecondLine, MAX_SECONDLINE);
ppd.colorBack = IsErrorMsg ? 0x0202E3 : 0xE8F1FD;
ppd.colorText = IsErrorMsg ? 0xE8F1FD : 0x000000;
ppd.iSeconds = Timeout;
@@ -69,7 +69,7 @@ void ShowLog(TCString &LogFilePath) INT_PTR Result = (INT_PTR)ShellExecute(NULL, L"open", LogFilePath, NULL, NULL, SW_SHOW);
if (Result <= 32) {
wchar_t szError[64];
- mir_sntprintf(szError, TranslateT("Error #%d"), Result);
+ mir_snwprintf(szError, TranslateT("Error #%d"), Result);
ShowMsg(szError, TranslateT("Can't open log file ") + LogFilePath, true);
}
}
diff --git a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp index bc8398e62e..13cf39c03b 100644 --- a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp +++ b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp @@ -67,10 +67,10 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam char *szProto = GetContactProto(awayData->hContact);
wchar_t *status = pcli->pfnGetStatusModeDescription(db_get_w(awayData->hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
GetWindowText(hwndDlg, format, _countof(format));
- mir_sntprintf(str, format, status, contactName);
+ mir_snwprintf(str, format, status, contactName);
SetWindowText(hwndDlg, str);
GetDlgItemText(hwndDlg, IDC_READAWAYMSG_RETRIEVE, format, _countof(format));
- mir_sntprintf(str, format, status);
+ mir_snwprintf(str, format, status);
SetDlgItemText(hwndDlg, IDC_READAWAYMSG_RETRIEVE, str);
}
return true;
diff --git a/plugins/NewAwaySysMod/src/Services.cpp b/plugins/NewAwaySysMod/src/Services.cpp index f961e23d84..36ecd5a7ab 100644 --- a/plugins/NewAwaySysMod/src/Services.cpp +++ b/plugins/NewAwaySysMod/src/Services.cpp @@ -53,7 +53,7 @@ __inline void PSSetStatus(char *szProto, WORD Status, int bNoClistSetStatusMode INT_PTR GetStatusMsgW(WPARAM wParam, LPARAM)
{
LogMessage("MS_AWAYMSG_GETSTATUSMSGW called. status=%d", wParam);
- WCHAR *szMsg = mir_t2u(GetDynamicStatMsg(INVALID_CONTACT_ID, NULL, 0, wParam));
+ WCHAR *szMsg = mir_wstrdup(GetDynamicStatMsg(INVALID_CONTACT_ID, NULL, 0, wParam));
LogMessage("returned szMsgW:\n%S", szMsg ? szMsg : L"NULL");
return (INT_PTR)szMsg;
}
@@ -90,7 +90,7 @@ int GetState(WPARAM wParam, LPARAM lParam, int Widechar) TCString Msg(pi->status ? CProtoSettings(pi->szProto, pi->status).GetMsgFormat(GMF_LASTORDEFAULT) : CProtoSettings(pi->szProto).GetMsgFormat(((Flags & PIF_NOTTEMPORARY) ? 0 : GMF_TEMPORARY) | GMF_PERSONAL));
if (Msg != NULL) {
if (Widechar)
- pi->tszMsg = mir_tstrdup(Msg);
+ pi->tszMsg = mir_wstrdup(Msg);
else
pi->szMsg = mir_strdup(_T2A(Msg));
}
diff --git a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp index 9d0346a124..e2ec9e24a0 100644 --- a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp +++ b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp @@ -80,7 +80,7 @@ static LRESULT CALLBACK MsgEditSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, int nLen = GetWindowTextLength(hWnd);
wchar_t *text = (wchar_t*)_alloca((nLen + 1) * sizeof(wchar_t));
GetWindowText(hWnd, text, nLen + 1);
- memmove(text + start, text + end, sizeof(wchar_t)* (mir_tstrlen(text) + 1 - end));
+ memmove(text + start, text + end, sizeof(wchar_t)* (mir_wstrlen(text) + 1 - end));
SetWindowText(hWnd, text);
SendMessage(hWnd, EM_SETSEL, start, start);
@@ -368,7 +368,7 @@ void ApplySelContactsMessage(SetAwayMsgData* dat, CCList *CList, PTREEITEMARRAY HWND hwndDlg = g_SetAwayMsgPage.GetWnd();
GetDlgItemText(hwndDlg, IDC_SAWAYMSG_MSGDATA, Message.GetBuffer(AWAY_MSGDATA_MAX), AWAY_MSGDATA_MAX);
Message.ReleaseBuffer();
- if (!mir_tstrlen(Message))
+ if (!mir_wstrlen(Message))
Message = NULL; // delete personal message if it's empty
if (CList) {
@@ -843,7 +843,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA return true;
}
wchar_t BtnTitle[64];
- mir_sntprintf(BtnTitle, TranslateT("Closing in %d"), Countdown);
+ mir_snwprintf(BtnTitle, TranslateT("Closing in %d"), Countdown);
SetDlgItemText(hwndDlg, IDC_OK, BtnTitle);
Countdown--;
}
diff --git a/plugins/NewEventNotify/src/popup.cpp b/plugins/NewEventNotify/src/popup.cpp index 41b792d5c6..0e4cc47692 100644 --- a/plugins/NewEventNotify/src/popup.cpp +++ b/plugins/NewEventNotify/src/popup.cpp @@ -180,22 +180,22 @@ static wchar_t* GetEventPreview(DBEVENTINFO *dbei) if (dbei->pBlob) {
if (dbei->flags & DBEF_UTF) {
// utf-8 in blob
- comment1 = mir_utf8decodeT((char*)dbei->pBlob);
+ comment1 = mir_utf8decodeW((char*)dbei->pBlob);
}
- else if (dbei->cbBlob == (mir_tstrlen((wchar_t *)dbei->pBlob)+1)*(sizeof(wchar_t)+1)) {
+ else if (dbei->cbBlob == (mir_wstrlen((wchar_t *)dbei->pBlob)+1)*(sizeof(wchar_t)+1)) {
// wchar in blob (the old hack)
- comment1 = mir_tstrdup((wchar_t*)dbei->pBlob);
+ comment1 = mir_wstrdup((wchar_t*)dbei->pBlob);
}
- else comment1 = mir_a2t((char *)dbei->pBlob);
+ else comment1 = mir_a2u((char *)dbei->pBlob);
}
commentFix = POPUP_COMMENT_MESSAGE;
break;
case EVENTTYPE_URL:
// url
- if (dbei->pBlob) comment2 = mir_a2t((char *)dbei->pBlob);
+ if (dbei->pBlob) comment2 = mir_a2u((char *)dbei->pBlob);
// comment
- if (dbei->pBlob) comment1 = mir_a2t((char *)dbei->pBlob + mir_strlen((char *)dbei->pBlob) + 1);
+ if (dbei->pBlob) comment1 = mir_a2u((char *)dbei->pBlob + mir_strlen((char *)dbei->pBlob) + 1);
commentFix = POPUP_COMMENT_URL;
break;
@@ -203,10 +203,10 @@ static wchar_t* GetEventPreview(DBEVENTINFO *dbei) if (dbei->pBlob) {
char *p = (char*)dbei->pBlob + sizeof(DWORD);
// filenames
- comment2 = (dbei->flags & DBEF_UTF) ? mir_utf8decodeT(p) : mir_a2t(p);
+ comment2 = (dbei->flags & DBEF_UTF) ? mir_utf8decodeW(p) : mir_a2u(p);
p += mir_strlen(p) + 1;
// description
- comment1 = (dbei->flags & DBEF_UTF) ? mir_utf8decodeT(p) : mir_a2t(p);
+ comment1 = (dbei->flags & DBEF_UTF) ? mir_utf8decodeW(p) : mir_a2u(p);
}
commentFix = POPUP_COMMENT_FILE;
break;
@@ -231,8 +231,8 @@ static wchar_t* GetEventPreview(DBEVENTINFO *dbei) if (pcBlob >= pcEnd)
break;
}
- mir_sntprintf(szBuf, TranslateT("Received %d contacts."), nContacts);
- comment1 = mir_tstrdup(szBuf);
+ mir_snwprintf(szBuf, TranslateT("Received %d contacts."), nContacts);
+ comment1 = mir_wstrdup(szBuf);
}
commentFix = POPUP_COMMENT_CONTACTS;
break;
@@ -257,24 +257,24 @@ static wchar_t* GetEventPreview(DBEVENTINFO *dbei) mir_snprintf(szUin, "%d", *((DWORD*)dbei->pBlob));
if (mir_strlen(pszNick) > 0) {
if (dbei->flags & DBEF_UTF)
- szNick = mir_utf8decodeT(pszNick);
+ szNick = mir_utf8decodeW(pszNick);
else
- szNick = mir_a2t(pszNick);
+ szNick = mir_a2u(pszNick);
}
else if (mir_strlen(pszEmail) > 0) {
if (dbei->flags & DBEF_UTF)
- szNick = mir_utf8decodeT(pszEmail);
+ szNick = mir_utf8decodeW(pszEmail);
else
- szNick = mir_a2t(pszEmail);
+ szNick = mir_a2u(pszEmail);
}
else if (*((DWORD*)dbei->pBlob) > 0)
- szNick = mir_a2t(szUin);
+ szNick = mir_a2u(szUin);
if (szNick) {
- mir_tstrcpy(szBuf, szNick);
- mir_tstrcat(szBuf, TranslateT(" added you to the contact list"));
+ mir_wstrcpy(szBuf, szNick);
+ mir_wstrcat(szBuf, TranslateT(" added you to the contact list"));
mir_free(szNick);
- comment1 = mir_tstrdup(szBuf);
+ comment1 = mir_wstrdup(szBuf);
}
}
commentFix = POPUP_COMMENT_ADDED;
@@ -293,24 +293,24 @@ static wchar_t* GetEventPreview(DBEVENTINFO *dbei) mir_snprintf(szUin, "%d", *((DWORD*)dbei->pBlob));
if (mir_strlen(pszNick) > 0) {
if (dbei->flags & DBEF_UTF)
- szNick = mir_utf8decodeT(pszNick);
+ szNick = mir_utf8decodeW(pszNick);
else
- szNick = mir_a2t(pszNick);
+ szNick = mir_a2u(pszNick);
}
else if (mir_strlen(pszEmail) > 0) {
if (dbei->flags & DBEF_UTF)
- szNick = mir_utf8decodeT(pszEmail);
+ szNick = mir_utf8decodeW(pszEmail);
else
- szNick = mir_a2t(pszEmail);
+ szNick = mir_a2u(pszEmail);
}
else if (*((DWORD*)dbei->pBlob) > 0)
- szNick = mir_a2t(szUin);
+ szNick = mir_a2u(szUin);
if (szNick) {
- mir_tstrcpy(szBuf, szNick);
- mir_tstrcat(szBuf, TranslateT(" requested authorization"));
+ mir_wstrcpy(szBuf, szNick);
+ mir_wstrcat(szBuf, TranslateT(" requested authorization"));
mir_free(szNick);
- comment1 = mir_tstrdup(szBuf);
+ comment1 = mir_wstrdup(szBuf);
}
}
commentFix = POPUP_COMMENT_AUTH;
@@ -321,7 +321,7 @@ static wchar_t* GetEventPreview(DBEVENTINFO *dbei) //ASCIIZ from name
//ASCIIZ from e-mail
case ICQEVENTTYPE_WEBPAGER:
- if (dbei->pBlob) comment1 = mir_a2t((const char *)dbei->pBlob);
+ if (dbei->pBlob) comment1 = mir_a2u((const char *)dbei->pBlob);
commentFix = POPUP_COMMENT_WEBPAGER;
break;
@@ -330,7 +330,7 @@ static wchar_t* GetEventPreview(DBEVENTINFO *dbei) //ASCIIZ from name
//ASCIIZ from e-mail
case ICQEVENTTYPE_EMAILEXPRESS:
- if (dbei->pBlob) comment1 = mir_a2t((const char *)dbei->pBlob);
+ if (dbei->pBlob) comment1 = mir_a2u((const char *)dbei->pBlob);
commentFix = POPUP_COMMENT_EMAILEXP;
break;
@@ -340,13 +340,13 @@ static wchar_t* GetEventPreview(DBEVENTINFO *dbei) if (dbei->pBlob) {
if (dbei->flags & DBEF_UTF) {
// utf-8 in blob
- comment1 = mir_utf8decodeT((char*)dbei->pBlob);
+ comment1 = mir_utf8decodeW((char*)dbei->pBlob);
}
- else if (dbei->cbBlob == (mir_tstrlen((wchar_t *)dbei->pBlob)+1)*(sizeof(wchar_t)+1)) {
+ else if (dbei->cbBlob == (mir_wstrlen((wchar_t *)dbei->pBlob)+1)*(sizeof(wchar_t)+1)) {
// wchar in blob (the old hack)
- comment1 = mir_tstrdup((wchar_t*)dbei->pBlob);
+ comment1 = mir_wstrdup((wchar_t*)dbei->pBlob);
}
- else comment1 = mir_a2t((char *)dbei->pBlob);
+ else comment1 = mir_a2u((char *)dbei->pBlob);
}
commentFix = POPUP_COMMENT_SMS;
break;
@@ -357,13 +357,13 @@ static wchar_t* GetEventPreview(DBEVENTINFO *dbei) if (dbei->pBlob) {
if (dbei->flags & DBEF_UTF) {
// utf-8 in blob
- comment1 = mir_utf8decodeT((char*)dbei->pBlob);
+ comment1 = mir_utf8decodeW((char*)dbei->pBlob);
}
- else if (dbei->cbBlob == (mir_tstrlen((wchar_t *)dbei->pBlob)+1)*(sizeof(wchar_t)+1)) {
+ else if (dbei->cbBlob == (mir_wstrlen((wchar_t *)dbei->pBlob)+1)*(sizeof(wchar_t)+1)) {
// wchar in blob (the old hack)
- comment1 = mir_tstrdup((wchar_t*)dbei->pBlob);
+ comment1 = mir_wstrdup((wchar_t*)dbei->pBlob);
}
- else comment1 = mir_a2t((char *)dbei->pBlob);
+ else comment1 = mir_a2u((char *)dbei->pBlob);
}
commentFix = POPUP_COMMENT_SMSCONFIRMATION;
break;
@@ -377,7 +377,7 @@ static wchar_t* GetEventPreview(DBEVENTINFO *dbei) wchar_t *pet = (wchar_t*)CallService(MS_DB_EVENT_GETTEXT, 0, (LPARAM)&svc);
if (pet) {
// we've got event text, move to our memory space
- comment1 = mir_tstrdup(pet);
+ comment1 = mir_wstrdup(pet);
mir_free(pet);
}
commentFix = pei->descr;
@@ -387,17 +387,17 @@ static wchar_t* GetEventPreview(DBEVENTINFO *dbei) else commentFix = POPUP_COMMENT_OTHER;
}
- if ( mir_tstrlen(comment1) > 0) {
+ if ( mir_wstrlen(comment1) > 0) {
mir_free(comment2);
return comment1;
}
- if ( mir_tstrlen(comment2) > 0) {
+ if ( mir_wstrlen(comment2) > 0) {
mir_free(comment1);
return comment2;
}
mir_free(comment1);
mir_free(comment2);
- return TranslateTS( mir_a2t(commentFix));
+ return TranslateTS( mir_a2u(commentFix));
}
int PopupShow(PLUGIN_OPTIONS* pluginOptions, MCONTACT hContact, MEVENT hEvent, UINT eventType)
@@ -495,7 +495,7 @@ int PopupShow(PLUGIN_OPTIONS* pluginOptions, MCONTACT hContact, MEVENT hEvent, U }
else { // get the needed event data
wcsncpy(pudw.lptzContactName, (wchar_t*)pcli->pfnGetContactDisplayName(hContact, 0), MAX_CONTACTNAME);
- wcsncpy(pudw.lptzText, ptrT(GetEventPreview(&dbe)), MAX_SECONDLINE);
+ wcsncpy(pudw.lptzText, ptrW(GetEventPreview(&dbe)), MAX_SECONDLINE);
}
PopupCount++;
@@ -540,12 +540,12 @@ int PopupUpdate(MCONTACT hContact, MEVENT hEvent) wchar_t lpzText[MAX_SECONDLINE*2] = L"\0\0";
if (pdata->pluginOptions->bShowHeaders)
- mir_sntprintf(lpzText, TranslateT("[b]Number of new message(s): %d[/b]\n"), pdata->countEvent);
+ mir_snwprintf(lpzText, TranslateT("[b]Number of new message(s): %d[/b]\n"), pdata->countEvent);
int doReverse = pdata->pluginOptions->bShowON;
if ((pdata->firstShowEventData != pdata->firstEventData && doReverse) || (pdata->firstShowEventData != pdata->lastEventData && !doReverse))
- mir_sntprintf(lpzText, L"%s...\n", lpzText);
+ mir_snwprintf(lpzText, L"%s...\n", lpzText);
//take the active event as starting one
EVENT_DATA_EX *eventData = pdata->firstShowEventData;
@@ -575,15 +575,15 @@ int PopupUpdate(MCONTACT hContact, MEVENT hEvent) if (pdata->pluginOptions->bShowDate)
wcsncpy(formatTime, L"%Y.%m.%d", _countof(formatTime));
else if (pdata->pluginOptions->bShowTime)
- mir_tstrncat(formatTime, L" %H:%M", _countof(formatTime) - mir_tstrlen(formatTime));
+ mir_wstrncat(formatTime, L" %H:%M", _countof(formatTime) - mir_wstrlen(formatTime));
time_t localTime = dbe.timestamp;
wcsftime(timestamp, _countof(timestamp), formatTime, localtime(&localTime));
- mir_sntprintf(lpzText, L"%s[b][i]%s[/i][/b]\n", lpzText, timestamp);
+ mir_snwprintf(lpzText, L"%s[b][i]%s[/i][/b]\n", lpzText, timestamp);
}
// prepare event preview
wchar_t* szEventPreview = GetEventPreview(&dbe);
- mir_sntprintf(lpzText, L"%s%s", lpzText, szEventPreview);
+ mir_snwprintf(lpzText, L"%s%s", lpzText, szEventPreview);
mir_free(szEventPreview);
if (dbe.pBlob)
@@ -595,11 +595,11 @@ int PopupUpdate(MCONTACT hContact, MEVENT hEvent) else if ((iEvent >= pdata->pluginOptions->iNumberMsg && pdata->pluginOptions->iNumberMsg) || !eventData->prev)
break;
- mir_sntprintf(lpzText, L"%s\n", lpzText);
+ mir_snwprintf(lpzText, L"%s\n", lpzText);
}
if ((doReverse && eventData->next) || (!doReverse && eventData->prev))
- mir_sntprintf(lpzText, L"%s\n...", lpzText);
+ mir_snwprintf(lpzText, L"%s\n...", lpzText);
PUChangeTextT(pdata->hWnd, lpzText);
return 0;
diff --git a/plugins/NewXstatusNotify/src/indsnd.cpp b/plugins/NewXstatusNotify/src/indsnd.cpp index ee0aae304d..eeceb22253 100644 --- a/plugins/NewXstatusNotify/src/indsnd.cpp +++ b/plugins/NewXstatusNotify/src/indsnd.cpp @@ -33,7 +33,7 @@ void PreviewSound(HWND hList) int hlpStatus = lvi.lParam;
ListView_GetItemText(hList, lvi.iItem, 1, buff, _countof(buff));
- if (!mir_tstrcmp(buff, TranslateTS(DEFAULT_SOUND))) {
+ if (!mir_wstrcmp(buff, TranslateTS(DEFAULT_SOUND))) {
if (hlpStatus < ID_STATUS_MIN)
SkinPlaySound(StatusListEx[hlpStatus].lpzSkinSoundName);
else
@@ -64,7 +64,7 @@ wchar_t *SelectSound(HWND hwndDlg, wchar_t *buff, size_t bufflen) HWND hList = GetDlgItem(hwndDlg, IDC_INDSNDLIST);
ListView_GetItemText(hList, ListView_GetNextItem(hList, -1, LVNI_SELECTED), 1, buff, (DWORD)bufflen);
- if (!mir_tstrcmp(buff, TranslateTS(DEFAULT_SOUND)))
+ if (!mir_wstrcmp(buff, TranslateTS(DEFAULT_SOUND)))
buff = NULL;
ofn.lStructSize = sizeof(ofn);
@@ -72,9 +72,9 @@ wchar_t *SelectSound(HWND hwndDlg, wchar_t *buff, size_t bufflen) ofn.hInstance = hInst;
wchar_t filter[MAX_PATH];
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("Wave files"), 0, 0, TranslateT("All files"), 0, 0);
+ mir_snwprintf(filter, L"%s (*.wav)%c*.wav%c%s (*.*)%c*%c", TranslateT("Wave files"), 0, 0, TranslateT("All files"), 0, 0);
ofn.lpstrFilter = filter;
ofn.lpstrFile = buff;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_NOCHANGEDIR;
@@ -150,10 +150,10 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA lvi.iItem = ListView_InsertItem(hList, &lvi);
if (!db_get_ts(hContact, MODULE, StatusList[Index(i)].lpzSkinSoundName, &dbv)) {
- mir_tstrcpy(buff, dbv.ptszVal);
+ mir_wstrcpy(buff, dbv.ptszVal);
db_free(&dbv);
}
- else mir_tstrcpy(buff, TranslateTS(DEFAULT_SOUND));
+ else mir_wstrcpy(buff, TranslateTS(DEFAULT_SOUND));
ListView_SetItemText(hList, lvi.iItem, 1, buff);
}
@@ -236,7 +236,7 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA ListView_GetItem(hList, &lvi);
ListView_GetItemText(hList, lvi.iItem, 1, buff, _countof(buff));
- if (!mir_tstrcmp(buff, TranslateTS(DEFAULT_SOUND))) {
+ if (!mir_wstrcmp(buff, TranslateTS(DEFAULT_SOUND))) {
if (lvi.lParam < ID_STATUS_MIN)
db_unset(hContact, MODULE, StatusListEx[lvi.lParam].lpzSkinSoundName);
else
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index db07011b5c..bf7ef10106 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -114,10 +114,10 @@ static int CompareStatusMsg(STATUSMSGINFO *smi, DBCONTACTWRITESETTING *cws_new, switch (cws_new->value.type) {
case DBVT_ASCIIZ:
- smi->newstatusmsg = (CheckStr(cws_new->value.pszVal, 0, 1) ? NULL : mir_a2t_cp(cws_new->value.pszVal, CP_ACP));
+ smi->newstatusmsg = (CheckStr(cws_new->value.pszVal, 0, 1) ? NULL : mir_a2u_cp(cws_new->value.pszVal, CP_ACP));
break;
case DBVT_UTF8:
- smi->newstatusmsg = (CheckStr(cws_new->value.pszVal, 0, 1) ? NULL : mir_a2t_cp(cws_new->value.pszVal, CP_UTF8));
+ smi->newstatusmsg = (CheckStr(cws_new->value.pszVal, 0, 1) ? NULL : mir_a2u_cp(cws_new->value.pszVal, CP_UTF8));
break;
case DBVT_WCHAR:
smi->newstatusmsg = (CheckStrW(cws_new->value.pwszVal, 0, 1) ? NULL : mir_wstrdup(cws_new->value.pwszVal));
@@ -131,10 +131,10 @@ static int CompareStatusMsg(STATUSMSGINFO *smi, DBCONTACTWRITESETTING *cws_new, if (!db_get_s(smi->hContact, "UserOnline", szSetting, &dbv_old, 0)) {
switch (dbv_old.type) {
case DBVT_ASCIIZ:
- smi->oldstatusmsg = (CheckStr(dbv_old.pszVal, 0, 1) ? NULL : mir_a2t_cp(dbv_old.pszVal, CP_ACP));
+ smi->oldstatusmsg = (CheckStr(dbv_old.pszVal, 0, 1) ? NULL : mir_a2u_cp(dbv_old.pszVal, CP_ACP));
break;
case DBVT_UTF8:
- smi->oldstatusmsg = (CheckStr(dbv_old.pszVal, 0, 1) ? NULL : mir_a2t_cp(dbv_old.pszVal, CP_UTF8));
+ smi->oldstatusmsg = (CheckStr(dbv_old.pszVal, 0, 1) ? NULL : mir_a2u_cp(dbv_old.pszVal, CP_UTF8));
break;
case DBVT_WCHAR:
smi->oldstatusmsg = (CheckStrW(dbv_old.pwszVal, 0, 1) ? NULL : mir_wstrdup(dbv_old.pwszVal));
@@ -188,21 +188,21 @@ wchar_t* GetStr(STATUSMSGINFO *n, const wchar_t *tmplt) return NULL;
CMString res;
- size_t len = mir_tstrlen(tmplt);
+ size_t len = mir_wstrlen(tmplt);
for (size_t i = 0; i < len; i++) {
if (tmplt[i] == '%') {
i++;
switch (tmplt[i]) {
case 'n':
- if (n->compare == COMPARE_DEL || mir_tstrcmp(n->newstatusmsg, TranslateT("<no status message>")) == 0)
+ if (n->compare == COMPARE_DEL || mir_wstrcmp(n->newstatusmsg, TranslateT("<no status message>")) == 0)
res.Append(TranslateT("<no status message>"));
else
AddCR(res, n->newstatusmsg);
break;
case 'o':
- if (n->oldstatusmsg == NULL || n->oldstatusmsg[0] == '\0' || mir_tstrcmp(n->oldstatusmsg, TranslateT("<no status message>")) == 0)
+ if (n->oldstatusmsg == NULL || n->oldstatusmsg[0] == '\0' || mir_wstrcmp(n->oldstatusmsg, TranslateT("<no status message>")) == 0)
res.Append(TranslateT("<no status message>"));
else
AddCR(res, n->oldstatusmsg);
@@ -252,7 +252,7 @@ wchar_t* GetStr(STATUSMSGINFO *n, const wchar_t *tmplt) res.Append(L"...");
}
- return mir_tstrndup(res, res.GetLength());
+ return mir_wstrndup(res, res.GetLength());
}
bool SkipHiddenContact(MCONTACT hContact)
@@ -262,7 +262,7 @@ bool SkipHiddenContact(MCONTACT hContact) void LogSMsgToDB(STATUSMSGINFO *smi, const wchar_t *tmplt)
{
- ptrT str(GetStr(smi, tmplt));
+ ptrW str(GetStr(smi, tmplt));
T2Utf blob(str);
DBEVENTINFO dbei = { 0 };
@@ -304,8 +304,8 @@ void GetStatusText(MCONTACT hContact, WORD newStatus, WORD oldStatus, wchar_t *s if (opt.ShowPreviousStatus) {
wchar_t buff[MAX_STATUSTEXT];
- mir_sntprintf(buff, TranslateTS(STRING_SHOWPREVIOUSSTATUS), StatusList[Index(oldStatus)].lpzStandardText);
- mir_tstrcat(mir_tstrcat(stzStatusText, L" "), buff);
+ mir_snwprintf(buff, TranslateTS(STRING_SHOWPREVIOUSSTATUS), StatusList[Index(oldStatus)].lpzStandardText);
+ mir_wstrcat(mir_wstrcat(stzStatusText, L" "), buff);
}
}
@@ -441,7 +441,7 @@ int ContactStatusChanged(MCONTACT hContact, WORD oldStatus, WORD newStatus) if (opt.BlinkIcon && !opt.TempDisabled) {
HICON hIcon = opt.BlinkIcon_Status ? Skin_LoadProtoIcon(szProto, newStatus) : Skin_LoadIcon(SKINICON_OTHER_USERONLINE);
wchar_t str[256];
- mir_sntprintf(str, TranslateT("%s is now %s"), pcli->pfnGetContactDisplayName(hContact, 0), StatusList[Index(newStatus)].lpzStandardText);
+ mir_snwprintf(str, TranslateT("%s is now %s"), pcli->pfnGetContactDisplayName(hContact, 0), StatusList[Index(newStatus)].lpzStandardText);
BlinkIcon(hContact, hIcon, str);
}
@@ -457,7 +457,7 @@ int ContactStatusChanged(MCONTACT hContact, WORD oldStatus, WORD newStatus) GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, L"HH':'mm", stzTime, _countof(stzTime));
GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, L"dd/MM/yyyy", stzDate, _countof(stzDate));
- mir_sntprintf(stzText, TranslateT("%s, %s. %s changed status to %s (was %s)\r\n"),
+ mir_snwprintf(stzText, TranslateT("%s, %s. %s changed status to %s (was %s)\r\n"),
stzDate, stzTime, pcli->pfnGetContactDisplayName(hContact, 0), StatusList[Index(newStatus)].lpzStandardText,
StatusList[Index(oldStatus)].lpzStandardText);
LogToFile(stzText);
@@ -537,8 +537,8 @@ int ProcessExtraStatus(DBCONTACTWRITESETTING *cws, MCONTACT hContact) if (strstr(cws->szSetting, "title")) {
smi.compare = CompareStatusMsg(&smi, cws, szSetting);
if (smi.compare == COMPARE_SAME) {
- replaceStrT(smi.newstatusmsg, 0);
- replaceStrT(smi.oldstatusmsg, 0);
+ replaceStrW(smi.newstatusmsg, 0);
+ replaceStrW(smi.oldstatusmsg, 0);
}
if (cws->value.type == DBVT_DELETED)
@@ -554,8 +554,8 @@ int ProcessExtraStatus(DBCONTACTWRITESETTING *cws, MCONTACT hContact) mir_snprintf(dbSetting, "%s%s", szSetting, "Msg");
smi.compare = CompareStatusMsg(&smi, cws, dbSetting);
if (smi.compare == COMPARE_SAME) {
- replaceStrT(smi.newstatusmsg, 0);
- replaceStrT(smi.oldstatusmsg, 0);
+ replaceStrW(smi.newstatusmsg, 0);
+ replaceStrW(smi.oldstatusmsg, 0);
}
if (cws->value.type == DBVT_DELETED)
@@ -576,8 +576,8 @@ int ProcessExtraStatus(DBCONTACTWRITESETTING *cws, MCONTACT hContact) if (mir_strcmp(cws->szSetting, "XStatusName") == 0) {
smi.compare = CompareStatusMsg(&smi, cws, "LastXStatusName");
if (smi.compare == COMPARE_SAME) {
- replaceStrT(smi.newstatusmsg, 0);
- replaceStrT(smi.oldstatusmsg, 0);
+ replaceStrW(smi.newstatusmsg, 0);
+ replaceStrW(smi.oldstatusmsg, 0);
}
if (cws->value.type == DBVT_DELETED)
@@ -591,8 +591,8 @@ int ProcessExtraStatus(DBCONTACTWRITESETTING *cws, MCONTACT hContact) else if (!mir_strcmp(cws->szSetting, "XStatusMsg")) {
smi.compare = CompareStatusMsg(&smi, cws, "LastXStatusMsg");
if (smi.compare == COMPARE_SAME) {
- replaceStrT(smi.newstatusmsg, 0);
- replaceStrT(smi.oldstatusmsg, 0);
+ replaceStrW(smi.newstatusmsg, 0);
+ replaceStrW(smi.oldstatusmsg, 0);
}
if (cws->value.type == DBVT_DELETED)
@@ -629,11 +629,11 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact) //don't show popup when mradio connecting and disconnecting
if (_stricmp(szProto, "mRadio") == 0 && !cws->value.type == DBVT_DELETED) {
wchar_t buf[MAX_PATH];
- mir_sntprintf(buf, L" (%s)", TranslateT("connecting"));
+ mir_snwprintf(buf, L" (%s)", TranslateT("connecting"));
T2Utf pszUtf(buf);
- mir_sntprintf(buf, L" (%s)", TranslateT("aborting"));
+ mir_snwprintf(buf, L" (%s)", TranslateT("aborting"));
T2Utf pszUtf2(buf);
- mir_sntprintf(buf, L" (%s)", TranslateT("playing"));
+ mir_snwprintf(buf, L" (%s)", TranslateT("playing"));
T2Utf pszUtf3(buf);
if (_stricmp(cws->value.pszVal, pszUtf) == 0 || _stricmp(cws->value.pszVal, pszUtf2) == 0 || _stricmp(cws->value.pszVal, pszUtf3) == 0)
goto skip_notify;
@@ -681,13 +681,13 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact) if (bEnablePopup && db_get_b(hContact, MODULE, "EnablePopups", 1) && !opt.TempDisabled) {
// cut message if needed
wchar_t *copyText = NULL;
- if (opt.PSMsgTruncate && (opt.PSMsgLen > 0) && smi.newstatusmsg && (mir_tstrlen(smi.newstatusmsg) > opt.PSMsgLen)) {
+ if (opt.PSMsgTruncate && (opt.PSMsgLen > 0) && smi.newstatusmsg && (mir_wstrlen(smi.newstatusmsg) > opt.PSMsgLen)) {
wchar_t buff[MAX_TEXT_LEN + 3];
- copyText = mir_tstrdup(smi.newstatusmsg);
+ copyText = mir_wstrdup(smi.newstatusmsg);
wcsncpy(buff, smi.newstatusmsg, opt.PSMsgLen);
buff[opt.PSMsgLen] = 0;
- mir_tstrcat(buff, L"...");
- replaceStrT(smi.newstatusmsg, buff);
+ mir_wstrcat(buff, L"...");
+ replaceStrW(smi.newstatusmsg, buff);
}
wchar_t *str;
@@ -731,7 +731,7 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact) if (opt.BlinkIcon && opt.BlinkIcon_ForMsgs && !opt.TempDisabled) {
HICON hIcon = opt.BlinkIcon_Status ? Skin_LoadProtoIcon(szProto, db_get_w(hContact, szProto, "Status", ID_STATUS_ONLINE)) : Skin_LoadIcon(SKINICON_OTHER_USERONLINE);
wchar_t str[256];
- mir_sntprintf(str, TranslateT("%s changed status message to %s"), pcli->pfnGetContactDisplayName(hContact, 0), smi.newstatusmsg);
+ mir_snwprintf(str, TranslateT("%s changed status message to %s"), pcli->pfnGetContactDisplayName(hContact, 0), smi.newstatusmsg);
BlinkIcon(hContact, hIcon, str);
}
@@ -758,15 +758,15 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact) else
str = GetStr(&smi, templates.LogSMsgChanged);
- mir_sntprintf(stzText, L"%s, %s. %s %s\r\n", stzDate, stzTime, pcli->pfnGetContactDisplayName(hContact, 0), str);
+ mir_snwprintf(stzText, L"%s, %s. %s %s\r\n", stzDate, stzTime, pcli->pfnGetContactDisplayName(hContact, 0), str);
LogToFile(stzText);
mir_free(str);
}
skip_notify:
- replaceStrT(smi.newstatusmsg, 0);
- replaceStrT(smi.oldstatusmsg, 0);
+ replaceStrW(smi.newstatusmsg, 0);
+ replaceStrW(smi.oldstatusmsg, 0);
return 1;
}
@@ -850,121 +850,121 @@ void InitStatusList() int index = 0;
//Online
index = Index(ID_STATUS_ONLINE);
- mir_tstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) is back online!"), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) is back online!"), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) is back online!"), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("Online"), MAX_STANDARDTEXT);
+ mir_wstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) is back online!"), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) is back online!"), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) is back online!"), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzStandardText, TranslateT("Online"), MAX_STANDARDTEXT);
mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOnline", MAX_SKINSOUNDNAME);
- mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Online"), MAX_SKINSOUNDDESC);
- mir_tstrncpy(StatusList[index].lpzSkinSoundFile, L"global.wav", MAX_PATH);
+ mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Online"), MAX_SKINSOUNDDESC);
+ mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"global.wav", MAX_PATH);
StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40072bg", COLOR_BG_AVAILDEFAULT);
StatusList[index].colorText = db_get_dw(NULL, MODULE, "40072tx", COLOR_TX_DEFAULT);
//Offline
index = Index(ID_STATUS_OFFLINE);
- mir_tstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) went offline! :("), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) went offline! :("), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) went offline! :("), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("Offline"), MAX_STANDARDTEXT);
+ mir_wstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) went offline! :("), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) went offline! :("), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) went offline! :("), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzStandardText, TranslateT("Offline"), MAX_STANDARDTEXT);
mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOffline", MAX_SKINSOUNDNAME);
- mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Offline"), MAX_SKINSOUNDDESC);
- mir_tstrncpy(StatusList[index].lpzSkinSoundFile, L"offline.wav", MAX_PATH);
+ mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Offline"), MAX_SKINSOUNDDESC);
+ mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"offline.wav", MAX_PATH);
StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40071bg", COLOR_BG_NAVAILDEFAULT);
StatusList[index].colorText = db_get_dw(NULL, MODULE, "40071tx", COLOR_TX_DEFAULT);
//Invisible
index = Index(ID_STATUS_INVISIBLE);
- mir_tstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) hides in shadows..."), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) hides in shadows..."), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) hides in shadows..."), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("Invisible"), MAX_STANDARDTEXT);
+ mir_wstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) hides in shadows..."), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) hides in shadows..."), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) hides in shadows..."), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzStandardText, TranslateT("Invisible"), MAX_STANDARDTEXT);
mir_strncpy(StatusList[index].lpzSkinSoundName, "UserInvisible", MAX_SKINSOUNDNAME);
- mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Invisible"), MAX_SKINSOUNDDESC);
- mir_tstrncpy(StatusList[index].lpzSkinSoundFile, L"invisible.wav", MAX_PATH);
+ mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Invisible"), MAX_SKINSOUNDDESC);
+ mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"invisible.wav", MAX_PATH);
StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40078bg", COLOR_BG_AVAILDEFAULT);
StatusList[index].colorText = db_get_dw(NULL, MODULE, "40078tx", COLOR_TX_DEFAULT);
//Free for chat
index = Index(ID_STATUS_FREECHAT);
- mir_tstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) feels talkative!"), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) feels talkative!"), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) feels talkative!"), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("Free for chat"), MAX_STANDARDTEXT);
+ mir_wstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) feels talkative!"), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) feels talkative!"), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) feels talkative!"), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzStandardText, TranslateT("Free for chat"), MAX_STANDARDTEXT);
mir_strncpy(StatusList[index].lpzSkinSoundName, "UserFreeForChat", MAX_SKINSOUNDNAME);
- mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Free for chat"), MAX_SKINSOUNDDESC);
- mir_tstrncpy(StatusList[index].lpzSkinSoundFile, L"free4chat.wav", MAX_PATH);
+ mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Free for chat"), MAX_SKINSOUNDDESC);
+ mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"free4chat.wav", MAX_PATH);
StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40077bg", COLOR_BG_AVAILDEFAULT);
StatusList[index].colorText = db_get_dw(NULL, MODULE, "40077tx", COLOR_TX_DEFAULT);
//Away
index = Index(ID_STATUS_AWAY);
- mir_tstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) went away"), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) went away"), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) went away"), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("Away"), MAX_STANDARDTEXT);
+ mir_wstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) went away"), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) went away"), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) went away"), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzStandardText, TranslateT("Away"), MAX_STANDARDTEXT);
mir_strncpy(StatusList[index].lpzSkinSoundName, "UserAway", MAX_SKINSOUNDNAME);
- mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Away"), MAX_SKINSOUNDDESC);
- mir_tstrncpy(StatusList[index].lpzSkinSoundFile, L"away.wav", MAX_PATH);
+ mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Away"), MAX_SKINSOUNDDESC);
+ mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"away.wav", MAX_PATH);
StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40073bg", COLOR_BG_NAVAILDEFAULT);
StatusList[index].colorText = db_get_dw(NULL, MODULE, "40073tx", COLOR_TX_DEFAULT);
//NA
index = Index(ID_STATUS_NA);
- mir_tstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) isn't there anymore!"), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) isn't there anymore!"), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) isn't there anymore!"), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("Not available"), MAX_STANDARDTEXT);
+ mir_wstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) isn't there anymore!"), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) isn't there anymore!"), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) isn't there anymore!"), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzStandardText, TranslateT("Not available"), MAX_STANDARDTEXT);
mir_strncpy(StatusList[index].lpzSkinSoundName, "UserNA", MAX_SKINSOUNDNAME);
- mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Not available"), MAX_SKINSOUNDDESC);
- mir_tstrncpy(StatusList[index].lpzSkinSoundFile, L"na.wav", MAX_PATH);
+ mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Not available"), MAX_SKINSOUNDDESC);
+ mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"na.wav", MAX_PATH);
StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40075bg", COLOR_BG_NAVAILDEFAULT);
StatusList[index].colorText = db_get_dw(NULL, MODULE, "40075tx", COLOR_TX_DEFAULT);
//Occupied
index = Index(ID_STATUS_OCCUPIED);
- mir_tstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) has something else to do"), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) has something else to do"), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) has something else to do"), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("Occupied"), MAX_STANDARDTEXT);
+ mir_wstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) has something else to do"), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) has something else to do"), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) has something else to do"), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzStandardText, TranslateT("Occupied"), MAX_STANDARDTEXT);
mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOccupied", MAX_SKINSOUNDNAME);
- mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Occupied"), MAX_SKINSOUNDDESC);
- mir_tstrncpy(StatusList[index].lpzSkinSoundFile, L"occupied.wav", MAX_PATH);
+ mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Occupied"), MAX_SKINSOUNDDESC);
+ mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"occupied.wav", MAX_PATH);
StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40076bg", COLOR_BG_NAVAILDEFAULT);
StatusList[index].colorText = db_get_dw(NULL, MODULE, "40076tx", COLOR_TX_DEFAULT);
//Do not disturb
index = Index(ID_STATUS_DND);
- mir_tstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) doesn't want to be disturbed!"), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) doesn't want to be disturbed!"), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) doesn't want to be disturbed!"), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("Do not disturb"), MAX_STANDARDTEXT);
+ mir_wstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) doesn't want to be disturbed!"), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) doesn't want to be disturbed!"), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) doesn't want to be disturbed!"), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzStandardText, TranslateT("Do not disturb"), MAX_STANDARDTEXT);
mir_strncpy(StatusList[index].lpzSkinSoundName, "UserDND", MAX_SKINSOUNDNAME);
- mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Do not disturb"), MAX_SKINSOUNDDESC);
- mir_tstrncpy(StatusList[index].lpzSkinSoundFile, L"dnd.wav", MAX_PATH);
+ mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Do not disturb"), MAX_SKINSOUNDDESC);
+ mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"dnd.wav", MAX_PATH);
StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40074bg", COLOR_BG_NAVAILDEFAULT);
StatusList[index].colorText = db_get_dw(NULL, MODULE, "40074tx", COLOR_TX_DEFAULT);
//Out to lunch
index = Index(ID_STATUS_OUTTOLUNCH);
- mir_tstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) is eating something"), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) is eating something"), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) is eating something"), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("Out to lunch"), MAX_STANDARDTEXT);
+ mir_wstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) is eating something"), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) is eating something"), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) is eating something"), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzStandardText, TranslateT("Out to lunch"), MAX_STANDARDTEXT);
mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOutToLunch", MAX_SKINSOUNDNAME);
- mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Out to lunch"), MAX_SKINSOUNDDESC);
- mir_tstrncpy(StatusList[index].lpzSkinSoundFile, L"lunch.wav", MAX_PATH);
+ mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Out to lunch"), MAX_SKINSOUNDDESC);
+ mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"lunch.wav", MAX_PATH);
StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40080bg", COLOR_BG_NAVAILDEFAULT);
StatusList[index].colorText = db_get_dw(NULL, MODULE, "40080tx", COLOR_TX_DEFAULT);
//On the phone
index = Index(ID_STATUS_ONTHEPHONE);
- mir_tstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) had to answer the phone"), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) had to answer the phone"), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) had to answer the phone"), MAX_STATUSTEXT);
- mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("On the phone"), MAX_STANDARDTEXT);
+ mir_wstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) had to answer the phone"), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) had to answer the phone"), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) had to answer the phone"), MAX_STATUSTEXT);
+ mir_wstrncpy(StatusList[index].lpzStandardText, TranslateT("On the phone"), MAX_STANDARDTEXT);
mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOnThePhone", MAX_SKINSOUNDNAME);
- mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: On the phone"), MAX_SKINSOUNDDESC);
- mir_tstrncpy(StatusList[index].lpzSkinSoundFile, L"phone.wav", MAX_PATH);
+ mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: On the phone"), MAX_SKINSOUNDDESC);
+ mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"phone.wav", MAX_PATH);
StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40079bg", COLOR_BG_NAVAILDEFAULT);
StatusList[index].colorText = db_get_dw(NULL, MODULE, "40079tx", COLOR_TX_DEFAULT);
@@ -981,37 +981,37 @@ void InitStatusList() //From offline
index = ID_STATUS_FROMOFFLINE;
mir_strncpy(StatusListEx[index].lpzSkinSoundName, "UserFromOffline", MAX_SKINSOUNDNAME);
- mir_tstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENW("User: from offline (has priority!)"), MAX_SKINSOUNDDESC);
+ mir_wstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENW("User: from offline (has priority!)"), MAX_SKINSOUNDDESC);
//Status message removed
index = ID_STATUS_SMSGREMOVED;
mir_strncpy(StatusListEx[index].lpzSkinSoundName, "StatusMsgRemoved", MAX_SKINSOUNDNAME);
- mir_tstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENW("Status message removed"), MAX_SKINSOUNDDESC);
+ mir_wstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENW("Status message removed"), MAX_SKINSOUNDDESC);
//Status message changed
index = ID_STATUS_SMSGCHANGED;
mir_strncpy(StatusListEx[index].lpzSkinSoundName, "StatusMsgChanged", MAX_SKINSOUNDNAME);
- mir_tstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENW("Status message changed"), MAX_SKINSOUNDDESC);
+ mir_wstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENW("Status message changed"), MAX_SKINSOUNDDESC);
//Extra status removed
index = ID_STATUS_XREMOVED;
mir_strncpy(StatusListEx[index].lpzSkinSoundName, XSTATUS_SOUND_REMOVED, MAX_SKINSOUNDNAME);
- mir_tstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENW("Extra status removed"), MAX_SKINSOUNDDESC);
+ mir_wstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENW("Extra status removed"), MAX_SKINSOUNDDESC);
//Extra status message changed
index = ID_STATUS_XMSGCHANGED;
mir_strncpy(StatusListEx[index].lpzSkinSoundName, XSTATUS_SOUND_MSGCHANGED, MAX_SKINSOUNDNAME);
- mir_tstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENW("Extra status message changed"), MAX_SKINSOUNDDESC);
+ mir_wstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENW("Extra status message changed"), MAX_SKINSOUNDDESC);
//Extra status changed
index = ID_STATUS_XCHANGED;
mir_strncpy(StatusListEx[index].lpzSkinSoundName, XSTATUS_SOUND_CHANGED, MAX_SKINSOUNDNAME);
- mir_tstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENW("Extra status changed"), MAX_SKINSOUNDDESC);
+ mir_wstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENW("Extra status changed"), MAX_SKINSOUNDDESC);
//Extra status message removed
index = ID_STATUS_XMSGREMOVED;
mir_strncpy(StatusListEx[index].lpzSkinSoundName, XSTATUS_SOUND_MSGREMOVED, MAX_SKINSOUNDNAME);
- mir_tstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENW("Extra status message removed"), MAX_SKINSOUNDDESC);
+ mir_wstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENW("Extra status message removed"), MAX_SKINSOUNDDESC);
}
void CALLBACK ConnectionTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD)
diff --git a/plugins/NewXstatusNotify/src/options.cpp b/plugins/NewXstatusNotify/src/options.cpp index 61ca3ad9a7..2e602a4586 100644 --- a/plugins/NewXstatusNotify/src/options.cpp +++ b/plugins/NewXstatusNotify/src/options.cpp @@ -256,7 +256,7 @@ INT_PTR CALLBACK DlgProcGeneralOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA ofn.nMaxFile = MAX_PATH;
ofn.hwndOwner = hwndDlg;
wchar_t filter[MAX_PATH];
- mir_sntprintf(filter, L"%s (*.*)%c*.*%c%s (*.log)%c*.log%c%s (*.txt)%c*.txt%c", TranslateT("All Files"), 0, 0, TranslateT("Log"), 0, 0, TranslateT("Text"), 0, 0);
+ mir_snwprintf(filter, L"%s (*.*)%c*.*%c%s (*.log)%c*.log%c%s (*.txt)%c*.txt%c", TranslateT("All Files"), 0, 0, TranslateT("Log"), 0, 0, TranslateT("Text"), 0, 0);
ofn.lpstrFilter = filter;
ofn.nFilterIndex = 2;
ofn.lpstrInitialDir = buff;
@@ -391,16 +391,16 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (opt.ShowPreviousStatus) {
wchar_t buff[MAX_STATUSTEXT];
- mir_sntprintf(buff, TranslateTS(STRING_SHOWPREVIOUSSTATUS), StatusList[Index(i)].lpzStandardText);
- mir_tstrcat(str, L" ");
- mir_tstrcat(str, buff);
+ mir_snwprintf(buff, TranslateTS(STRING_SHOWPREVIOUSSTATUS), StatusList[Index(i)].lpzStandardText);
+ mir_wstrcat(str, L" ");
+ mir_wstrcat(str, buff);
}
}
if (opt.ReadAwayMsg) {
if (str[0])
- mir_tstrcat(str, L"\n");
- mir_tstrcat(str, TranslateT("This is status message"));
+ mir_wstrcat(str, L"\n");
+ mir_wstrcat(str, TranslateT("This is status message"));
}
ShowChangePopup(NULL, Skin_LoadProtoIcon(NULL, i), i, str);
diff --git a/plugins/NewXstatusNotify/src/popup.cpp b/plugins/NewXstatusNotify/src/popup.cpp index a6346e67d9..2f7e702036 100644 --- a/plugins/NewXstatusNotify/src/popup.cpp +++ b/plugins/NewXstatusNotify/src/popup.cpp @@ -30,7 +30,7 @@ void ShowChangePopup(MCONTACT hContact, HICON hIcon, WORD newStatus, const wchar // add group name to popup title
if (opt.ShowGroup) {
- ptrT tszGroup(db_get_tsa(hContact, "CList", "Group"));
+ ptrW tszGroup(db_get_tsa(hContact, "CList", "Group"));
if (tszGroup)
buf.AppendFormat(L" (%s)", tszGroup);
}
@@ -77,7 +77,7 @@ static int AwayMsgHook(WPARAM, LPARAM lParam, LPARAM pObj) return 0;
MCONTACT hContact = PUGetContact(pdp->hWnd);
- ptrT pstzLast(db_get_tsa(hContact, MODULE, "LastPopupText"));
+ ptrW pstzLast(db_get_tsa(hContact, MODULE, "LastPopupText"));
wchar_t *tszStatus = (wchar_t *)ack->lParam;
if (tszStatus == NULL || *tszStatus == 0)
@@ -85,7 +85,7 @@ static int AwayMsgHook(WPARAM, LPARAM lParam, LPARAM pObj) wchar_t stzText[1024];
if (pstzLast)
- mir_sntprintf(stzText, L"%s\n%s", pstzLast, tszStatus);
+ mir_snwprintf(stzText, L"%s\n%s", pstzLast, tszStatus);
else
wcsncpy(stzText, tszStatus, _countof(stzText));
SendMessage(pdp->hWnd, WM_SETREDRAW, FALSE, 0);
diff --git a/plugins/NewXstatusNotify/src/xstatus.cpp b/plugins/NewXstatusNotify/src/xstatus.cpp index 5640113053..ec650d1775 100644 --- a/plugins/NewXstatusNotify/src/xstatus.cpp +++ b/plugins/NewXstatusNotify/src/xstatus.cpp @@ -80,13 +80,13 @@ wchar_t* GetStatusTypeAsString(int type, wchar_t *buff) {
switch (type) {
case TYPE_JABBER_MOOD:
- mir_tstrcpy(buff, TranslateT("Mood")); return buff;
+ mir_wstrcpy(buff, TranslateT("Mood")); return buff;
case TYPE_JABBER_ACTIVITY:
- mir_tstrcpy(buff, TranslateT("Activity")); return buff;
+ mir_wstrcpy(buff, TranslateT("Activity")); return buff;
case TYPE_ICQ_XSTATUS:
- mir_tstrcpy(buff, TranslateT("xStatus")); return buff;
+ mir_wstrcpy(buff, TranslateT("xStatus")); return buff;
default:
- mir_tstrcpy(buff, TranslateT("<unknown>")); return buff;
+ mir_wstrcpy(buff, TranslateT("<unknown>")); return buff;
}
}
@@ -95,7 +95,7 @@ CMString ReplaceVars(XSTATUSCHANGE *xsc, const wchar_t *tmplt) if (xsc == NULL || tmplt == NULL || tmplt[0] == '\0')
return CMString();
- size_t len = mir_tstrlen(tmplt);
+ size_t len = mir_wstrlen(tmplt);
CMString res;
for (size_t i = 0; i < len; i++) {
@@ -189,13 +189,13 @@ void ShowXStatusPopup(XSTATUSCHANGE *xsc) // cut message if needed
wchar_t *copyText = NULL;
- if (opt.PXMsgTruncate && (opt.PXMsgLen > 0) && xsc->stzText && (mir_tstrlen(xsc->stzText) > opt.PXMsgLen)) {
+ if (opt.PXMsgTruncate && (opt.PXMsgLen > 0) && xsc->stzText && (mir_wstrlen(xsc->stzText) > opt.PXMsgLen)) {
wchar_t buff[MAX_TEXT_LEN + 3];
- copyText = mir_tstrdup(xsc->stzText);
+ copyText = mir_wstrdup(xsc->stzText);
wcsncpy(buff, xsc->stzText, opt.PXMsgLen);
buff[opt.PXMsgLen] = 0;
- mir_tstrcat(buff, L"...");
- replaceStrT(xsc->stzText, buff);
+ mir_wstrcat(buff, L"...");
+ replaceStrW(xsc->stzText, buff);
}
wchar_t *Template = L"";
@@ -226,7 +226,7 @@ void BlinkXStatusIcon(XSTATUSCHANGE *xsc) HICON hIcon = NULL;
wchar_t str[256] = { 0 };
wchar_t stzType[32];
- mir_sntprintf(str, TranslateT("%s changed %s"), pcli->pfnGetContactDisplayName(xsc->hContact, 0), GetStatusTypeAsString(xsc->type, stzType));
+ mir_snwprintf(str, TranslateT("%s changed %s"), pcli->pfnGetContactDisplayName(xsc->hContact, 0), GetStatusTypeAsString(xsc->type, stzType));
if (opt.BlinkIcon_Status) {
DBVARIANT dbv;
@@ -337,7 +337,7 @@ void LogChangeToFile(XSTATUSCHANGE *xsc) Template = templates.LogXMsgRemoved; break;
}
- mir_sntprintf(stzText, L"%s, %s. %s %s\r\n", stzDate, stzTime,
+ mir_snwprintf(stzText, L"%s, %s. %s %s\r\n", stzDate, stzTime,
pcli->pfnGetContactDisplayName(xsc->hContact, 0), ReplaceVars(xsc, Template).GetString());
LogToFile(stzText);
@@ -464,7 +464,7 @@ wchar_t* GetJabberAdvStatusText(MCONTACT hContact, char *szProto, char *szSlot, void LogXstatusChange(MCONTACT hContact, char *szProto, int xstatusType, wchar_t *stzTitle, wchar_t *stzText)
{
- XSTATUSCHANGE *xsc = NewXSC(hContact, szProto, xstatusType, NOTIFY_OPENING_ML, stzTitle[0] ? mir_tstrdup(stzTitle) : NULL, stzText[0] ? mir_tstrdup(stzText) : NULL);
+ XSTATUSCHANGE *xsc = NewXSC(hContact, szProto, xstatusType, NOTIFY_OPENING_ML, stzTitle[0] ? mir_wstrdup(stzTitle) : NULL, stzText[0] ? mir_wstrdup(stzText) : NULL);
LogChangeToDB(xsc);
FreeXSC(xsc);
diff --git a/plugins/New_GPG/src/gpg_wrapper.cpp b/plugins/New_GPG/src/gpg_wrapper.cpp index ef52cbe196..5b2b319fa4 100755 --- a/plugins/New_GPG/src/gpg_wrapper.cpp +++ b/plugins/New_GPG/src/gpg_wrapper.cpp @@ -49,7 +49,7 @@ pxResult pxExecute(std::vector<std::wstring> &aargv, string *aoutput, LPDWORD ae env.push_back(L"LANG=C"); argv.push_back(bin_path); wchar_t *home_dir = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L""); - if(mir_tstrlen(home_dir)) //this check are required for first run gpg binary validation + if(mir_wstrlen(home_dir)) //this check are required for first run gpg binary validation { argv.push_back(L"--homedir"); argv.push_back(home_dir); diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp index d3e7d1679b..bc7c4764ac 100755 --- a/plugins/New_GPG/src/main.cpp +++ b/plugins/New_GPG/src/main.cpp @@ -280,7 +280,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam, if (wcschr(name, '(')) { wstring str = name; wstring::size_type p = str.find(L"(") - 1; - mir_tstrcpy(name, str.substr(0, p).c_str()); + mir_wstrcpy(name, str.substr(0, p).c_str()); } } string out; @@ -333,7 +333,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam, GetDlgItemText(hwndDlg, IDC_KEY_PASSWORD, passwd, _countof(passwd)); if (passwd[0]) { string dbsetting = "szKey_"; - char *keyid = mir_t2a(fp); + char *keyid = mir_u2a(fp); dbsetting += keyid; mir_free(keyid); dbsetting += "_Password"; @@ -452,7 +452,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam, while ((p = tmp.find(" ", p)) != string::npos) tmp.erase(p, 1); - str = mir_a2t(tmp.c_str()); + str = mir_a2u(tmp.c_str()); } cmd.clear(); out.clear(); @@ -661,7 +661,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam, char *szKey = (char*)GlobalLock(hMem); if (!szKey) { wchar_t msg[64]; - mir_sntprintf(msg, TranslateT("Failed to lock memory with error %d"), GetLastError()); + mir_snwprintf(msg, TranslateT("Failed to lock memory with error %d"), GetLastError()); MessageBox(0, msg, TranslateT("Error"), MB_OK); GlobalFree(hMem); } @@ -672,7 +672,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam, if (!SetClipboardData(CF_OEMTEXT, hMem)) { GlobalFree(hMem); wchar_t msg[64]; - mir_sntprintf(msg, TranslateT("Failed write to clipboard with error %d"), GetLastError()); + mir_snwprintf(msg, TranslateT("Failed write to clipboard with error %d"), GetLastError()); MessageBox(0, msg, TranslateT("Error"), MB_OK); } CloseClipboard(); @@ -687,7 +687,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam, //TODO: handle error break; } - char *path = mir_t2a(p); + char *path = mir_u2a(p); delete[] p; std::ofstream file; file.open(path, std::ios::trunc | std::ios::out); @@ -794,16 +794,16 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, PathToAbsolute("\\", mir_path); SetCurrentDirectoryA(mir_path); - ptrT tmp(mir_a2t(mir_path)); + ptrW tmp(mir_a2u(mir_path)); wstring gpg_path(tmp); gpg_path += L"\\GnuPG\\gpg.exe"; wstring gpg_lang_path(tmp); gpg_lang_path += L"\\GnuPG\\gnupg.nls\\en@quot.mo"; if (boost::filesystem::exists(gpg_path)) { gpg_exists = true; - mir_tstrcpy(path, L"GnuPG\\gpg.exe"); + mir_wstrcpy(path, L"GnuPG\\gpg.exe"); } - else mir_tstrcpy(path, gpg_path.c_str()); + else mir_wstrcpy(path, gpg_path.c_str()); if (boost::filesystem::exists(gpg_lang_path)) lang_exists = true; @@ -813,7 +813,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, DWORD len = MAX_PATH; bool bad_version = false; { - ptrT tmp; + ptrW tmp; if (!gpg_exists) { tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", (SHGetValue(HKEY_CURRENT_USER, L"Software\\GNU\\GnuPG", L"gpgProgram", 0, path, &len) == ERROR_SUCCESS) ? path : L""); if (tmp[0]) @@ -854,7 +854,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, } } { - ptrT tmp(UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"")); + ptrW tmp(UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"")); if (!tmp[0]) { mir_free(tmp); char *mir_path = (char*)mir_alloc(sizeof(char) * MAX_PATH); @@ -890,13 +890,13 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, wchar_t *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", L"gpg.exe"); SetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp); char mir_path[MAX_PATH]; - char *atmp = mir_t2a(tmp); + char *atmp = mir_u2a(tmp); mir_free(tmp); PathToAbsolute("\\", mir_path); char* p_path = NULL; if (StriStr(atmp, mir_path)) { p_path = atmp + mir_strlen(mir_path); - tmp = mir_a2t(p_path); + tmp = mir_a2u(p_path); SetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp); } } @@ -907,13 +907,13 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, wchar_t *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L""); SetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp); char mir_path[MAX_PATH]; - char *atmp = mir_t2a(tmp); + char *atmp = mir_u2a(tmp); mir_free(tmp); PathToAbsolute("\\", mir_path); char* p_path = NULL; if (StriStr(atmp, mir_path)) { p_path = atmp + mir_strlen(mir_path); - tmp = mir_a2t(p_path); + tmp = mir_a2u(p_path); SetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp); } } @@ -967,8 +967,8 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, } db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp); GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, _countof(tmp)); - while (tmp[mir_tstrlen(tmp) - 1] == '\\') - tmp[mir_tstrlen(tmp) - 1] = '\0'; + while (tmp[mir_wstrlen(tmp) - 1] == '\\') + tmp[mir_wstrlen(tmp) - 1] = '\0'; if (!tmp[0]) { MessageBox(0, TranslateT("Please set keyring's home directory"), TranslateT("Warning"), MB_OK); break; @@ -1038,8 +1038,8 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, } db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp); GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, _countof(tmp)); - while (tmp[mir_tstrlen(tmp) - 1] == '\\') - tmp[mir_tstrlen(tmp) - 1] = '\0'; + while (tmp[mir_wstrlen(tmp) - 1] == '\\') + tmp[mir_wstrlen(tmp) - 1] = '\0'; if (!tmp[0]) { MessageBox(0, TranslateT("Please set keyring's home directory"), TranslateT("Warning"), MB_OK); break; @@ -1196,7 +1196,7 @@ static INT_PTR CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wPara SetDlgItemText(hwndDlg, ID_IMPORT, tmp[0] ? TranslateT("Replace") : TranslateT("Accept")); mir_free(tmp); tmp = new wchar_t[256]; - mir_sntprintf(tmp, 255 * sizeof(wchar_t), TranslateT("Received key from %s"), pcli->pfnGetContactDisplayName(hContact, 0)); + mir_snwprintf(tmp, 255 * sizeof(wchar_t), TranslateT("Received key from %s"), pcli->pfnGetContactDisplayName(hContact, 0)); SetDlgItemText(hwndDlg, IDC_KEY_FROM, tmp); delete[] tmp; } @@ -1269,7 +1269,7 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara { //data sanity checks wchar_t *tmp = (wchar_t*)mir_alloc(sizeof(wchar_t) * 5); GetDlgItemText(hwndDlg, IDC_KEY_TYPE, tmp, 5); - if (mir_tstrlen(tmp) < 3) { + if (mir_wstrlen(tmp) < 3) { mir_free(tmp); tmp = NULL; MessageBox(0, TranslateT("You must set encryption algorithm first"), TranslateT("Error"), MB_OK); break; @@ -1286,7 +1286,7 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara } tmp = (wchar_t*)mir_alloc(sizeof(wchar_t) * 12); GetDlgItemText(hwndDlg, IDC_KEY_EXPIRE_DATE, tmp, 11); - if (mir_tstrlen(tmp) != 10 && tmp[0] != '0') { + if (mir_wstrlen(tmp) != 10 && tmp[0] != '0') { MessageBox(0, TranslateT("Invalid date"), TranslateT("Error"), MB_OK); mir_free(tmp); break; @@ -1294,7 +1294,7 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara mir_free(tmp); tmp = (wchar_t*)mir_alloc(sizeof(wchar_t) * 128); GetDlgItemText(hwndDlg, IDC_KEY_REAL_NAME, tmp, 127); - if (mir_tstrlen(tmp) < 5) { + if (mir_wstrlen(tmp) < 5) { MessageBox(0, TranslateT("Name must contain at least 5 characters"), TranslateT("Error"), MB_OK); mir_free(tmp); break; @@ -1307,7 +1307,7 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara mir_free(tmp); tmp = (wchar_t*)mir_alloc(sizeof(wchar_t) * 128); GetDlgItemText(hwndDlg, IDC_KEY_EMAIL, tmp, 128); - if ((mir_tstrlen(tmp)) < 5 || (!wcschr(tmp, '@')) || (!wcschr(tmp, '.'))) { + if ((mir_wstrlen(tmp)) < 5 || (!wcschr(tmp, '@')) || (!wcschr(tmp, '.'))) { MessageBox(0, TranslateT("Invalid Email"), TranslateT("Error"), MB_OK); mir_free(tmp); break; @@ -1316,7 +1316,7 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara } { //generating key file wchar_t *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L""); - char *tmp2;// = mir_t2a(tmp); + char *tmp2;// = mir_u2a(tmp); path = tmp; mir_free(tmp); // mir_free(tmp2); @@ -1329,7 +1329,7 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara f << "Key-Type: "; tmp = (wchar_t*)mir_alloc(sizeof(wchar_t) * 5); GetDlgItemText(hwndDlg, IDC_KEY_TYPE, tmp, 5); - tmp2 = mir_t2a(tmp); + tmp2 = mir_u2a(tmp); mir_free(tmp); char *subkeytype = (char*)mir_alloc(6); if (strstr(tmp2, "RSA")) @@ -1714,7 +1714,7 @@ static INT_PTR CALLBACK DlgProcLoadExistingKey(HWND hwndDlg, UINT msg, WPARAM wP if (p2 != std::string::npos) { p2 += mir_strlen("-----END PGP PUBLIC KEY BLOCK-----"); out = out.substr(p1, p2 - p1); - wchar_t *tmp = mir_a2t(out.c_str()); + wchar_t *tmp = mir_a2u(out.c_str()); SetWindowText(hPubKeyEdit, tmp); mir_free(tmp); } @@ -1910,10 +1910,10 @@ void InitCheck() if (!home_dir_access || !temp_access || !gpg_valid) { wchar_t buf[4096]; wcsncpy(buf, gpg_valid ? TranslateT("GPG binary is set and valid (this is good).\n") : TranslateT("GPG binary unset or invalid (plugin will not work).\n"), _countof(buf)); - mir_tstrncat(buf, home_dir_access ? TranslateT("Home dir write access granted (this is good).\n") : TranslateT("Home dir has no write access (plugin most probably will not work).\n"), _countof(buf) - mir_tstrlen(buf)); - mir_tstrncat(buf, temp_access ? TranslateT("Temp dir write access granted (this is good).\n") : TranslateT("Temp dir has no write access (plugin should work, but may have some problems, file transfers will not work)."), _countof(buf) - mir_tstrlen(buf)); + mir_wstrncat(buf, home_dir_access ? TranslateT("Home dir write access granted (this is good).\n") : TranslateT("Home dir has no write access (plugin most probably will not work).\n"), _countof(buf) - mir_wstrlen(buf)); + mir_wstrncat(buf, temp_access ? TranslateT("Temp dir write access granted (this is good).\n") : TranslateT("Temp dir has no write access (plugin should work, but may have some problems, file transfers will not work)."), _countof(buf) - mir_wstrlen(buf)); if (!gpg_valid) - mir_tstrncat(buf, TranslateT("\nGPG will be disabled until you solve these problems"), _countof(buf) - mir_tstrlen(buf)); + mir_wstrncat(buf, TranslateT("\nGPG will be disabled until you solve these problems"), _countof(buf) - mir_wstrlen(buf)); MessageBox(0, buf, TranslateT("GPG plugin problems"), MB_OK); } if (!gpg_valid) @@ -2137,12 +2137,12 @@ void ImportKey() std::vector<wstring> cmd; wchar_t tmp2[MAX_PATH] = { 0 }; { - wcsncpy(tmp2, ptrT(UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"")), MAX_PATH - 1); - mir_tstrncat(tmp2, L"\\", _countof(tmp2) - mir_tstrlen(tmp2)); - mir_tstrncat(tmp2, L"temporary_exported.asc", _countof(tmp2) - mir_tstrlen(tmp2)); + wcsncpy(tmp2, ptrW(UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"")), MAX_PATH - 1); + mir_wstrncat(tmp2, L"\\", _countof(tmp2) - mir_wstrlen(tmp2)); + mir_wstrncat(tmp2, L"temporary_exported.asc", _countof(tmp2) - mir_wstrlen(tmp2)); boost::filesystem::remove(tmp2); - ptrT ptmp; + ptrW ptmp; if (db_mc_isMeta(hContact)) ptmp = UniGetContactSettingUtf(metaGetMostOnline(hContact), szGPGModuleName, "GPGPubKey", L""); else diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp index 7ea7e6f1eb..89e77e782c 100755 --- a/plugins/New_GPG/src/messages.cpp +++ b/plugins/New_GPG/src/messages.cpp @@ -68,9 +68,9 @@ void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD, DWOR else if (bDebugLog) debuglog << std::string(time_str() + ": info: received encrypted message from: " + toUTF8(pcli->pfnGetContactDisplayName(hContact, 0))); boost::algorithm::erase_all(str, "\r"); - s2 += mir_tstrlen(L"-----END PGP MESSAGE-----"); + s2 += mir_wstrlen(L"-----END PGP MESSAGE-----"); - ptrT ptszHomePath(UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"")); + ptrW ptszHomePath(UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"")); wstring encfile = toUTF16(get_random(10)); wstring decfile = toUTF16(get_random(10)); { @@ -100,7 +100,7 @@ void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD, DWOR } f.open(path.c_str(), std::ios::out); } - char *tmp = mir_t2a(str.substr(s1, s2 - s1).c_str()); + char *tmp = mir_u2a(str.substr(s1, s2 - s1).c_str()); f << tmp; mir_free(tmp); f.close(); @@ -418,7 +418,7 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l) { if (bDebugLog) debuglog << std::string(time_str() + ": info(autoexchange): found pubkey block:" + toUTF8(pcli->pfnGetContactDisplayName(ccs->hContact, 0))); - s2 += mir_tstrlen(L"-----END PGP PUBLIC KEY BLOCK-----"); + s2 += mir_wstrlen(L"-----END PGP PUBLIC KEY BLOCK-----"); db_set_ts(ccs->hContact, szGPGModuleName, "GPGPubKey", str.substr(s1, s2 - s1).c_str()); { //gpg execute block std::vector<wstring> cmd; @@ -426,15 +426,15 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l) string output; DWORD exitcode; { - ptrT ptmp(UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"")); - mir_tstrcpy(tmp2, ptmp); + ptrW ptmp(UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"")); + mir_wstrcpy(tmp2, ptmp); mir_free(ptmp); - mir_tstrcat(tmp2, L"\\"); - wchar_t *tmp3 = mir_a2t(get_random(5).c_str()); - mir_tstrcat(tmp2, tmp3); - mir_tstrcat(tmp2, L".asc"); + mir_wstrcat(tmp2, L"\\"); + wchar_t *tmp3 = mir_a2u(get_random(5).c_str()); + mir_wstrcat(tmp2, tmp3); + mir_wstrcat(tmp2, L".asc"); mir_free(tmp3); - //mir_tstrcat(tmp2, L"temporary_exported.asc"); + //mir_wstrcat(tmp2, L"temporary_exported.asc"); if(!bDebugLog) { boost::system::error_code e; @@ -565,9 +565,9 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l) str.erase(s1, 1); void ShowNewKeyDialog(); if (((s2 = str.find(L"-----END PGP PUBLIC KEY BLOCK-----")) != wstring::npos) && ((s1 = str.find(L"-----BEGIN PGP PUBLIC KEY BLOCK-----")) != wstring::npos)) - s2 += mir_tstrlen(L"-----END PGP PUBLIC KEY BLOCK-----"); + s2 += mir_wstrlen(L"-----END PGP PUBLIC KEY BLOCK-----"); else if (((s2 = str.find(L"-----BEGIN PGP PRIVATE KEY BLOCK-----")) != wstring::npos) && ((s1 = str.find(L"-----END PGP PRIVATE KEY BLOCK-----")) != wstring::npos)) - s2 += mir_tstrlen(L"-----END PGP PRIVATE KEY BLOCK-----"); + s2 += mir_wstrlen(L"-----END PGP PRIVATE KEY BLOCK-----"); new_key.append(str.substr(s1, s2 - s1)); //new_key_hcnt_mutex.lock(); new_key_hcnt = ccs->hContact; @@ -688,7 +688,7 @@ void SendMsgSvc_func(MCONTACT hContact, char *msg, DWORD flags) cmd.push_back(L"--batch"); cmd.push_back(L"--yes"); cmd.push_back(L"-eatr"); - tmp2 = mir_a2t(tmp); + tmp2 = mir_a2u(tmp); mir_free(tmp); } cmd.push_back(tmp2); @@ -1040,8 +1040,8 @@ static INT_PTR CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam } if (password) mir_free(password); - password = (wchar_t*)mir_alloc(sizeof(wchar_t)*(mir_tstrlen(tmp) + 1)); - mir_tstrcpy(password, tmp); + password = (wchar_t*)mir_alloc(sizeof(wchar_t)*(mir_wstrlen(tmp) + 1)); + mir_wstrcpy(password, tmp); } mir_free(inkeyid); DestroyWindow(hwndDlg); diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp index 68595f9ce9..5a7592f833 100755 --- a/plugins/New_GPG/src/options.cpp +++ b/plugins/New_GPG/src/options.cpp @@ -128,14 +128,14 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT uMsg, WPARAM wParam, L iRow = ListView_InsertItem(hwndList, &item);
ListView_SetItemText(hwndList, iRow, 0, name);
- wchar_t *tmp = mir_a2t(GetContactProto(hContact));
+ wchar_t *tmp = mir_a2u(GetContactProto(hContact));
ListView_SetItemText(hwndList, iRow, 4, tmp);
mir_free(tmp);
char *tmp2 = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyID", "");
- tmp = mir_a2t(tmp2);
+ tmp = mir_a2u(tmp2);
mir_free(tmp2);
- ListView_SetItemText(hwndList, iRow, 1, (mir_tstrlen(tmp) > 1) ? tmp : L"not set");
+ ListView_SetItemText(hwndList, iRow, 1, (mir_wstrlen(tmp) > 1) ? tmp : L"not set");
mir_free(tmp);
tmp2 = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainName", "");
@@ -144,7 +144,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT uMsg, WPARAM wParam, L else
tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainName", L"");
mir_free(tmp2);
- ListView_SetItemText(hwndList, iRow, 2, (mir_tstrlen(tmp) > 1) ? tmp : L"not set");
+ ListView_SetItemText(hwndList, iRow, 2, (mir_wstrlen(tmp) > 1) ? tmp : L"not set");
mir_free(tmp);
tmp2 = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainEmail", "");
@@ -153,7 +153,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT uMsg, WPARAM wParam, L else
tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainEmail", L"");
mir_free(tmp2);
- ListView_SetItemText(hwndList, iRow, 3, (mir_tstrlen(tmp) > 1) ? tmp : L"not set");
+ ListView_SetItemText(hwndList, iRow, 3, (mir_wstrlen(tmp) > 1) ? tmp : L"not set");
mir_free(tmp);
if (db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0))
@@ -169,7 +169,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT uMsg, WPARAM wParam, L }
}
wchar_t *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szLogFilePath", L"");
- SetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, (mir_tstrlen(tmp) > 1) ? tmp : L"c:\\GPGdebug.log");
+ SetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, (mir_wstrlen(tmp) > 1) ? tmp : L"c:\\GPGdebug.log");
mir_free(tmp);
CheckStateLoadDB(hwndDlg, IDC_DEBUG_LOG, "bDebugLog", 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_JABBER_API), bIsMiranda09);
@@ -230,7 +230,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT uMsg, WPARAM wParam, L cmd.push_back(L"--batch");
cmd.push_back(L"--yes");
cmd.push_back(L"--delete-key");
- ptmp = mir_a2t(tmp);
+ ptmp = mir_a2u(tmp);
cmd.push_back(ptmp);
mir_free(ptmp);
gpg_execution_params params(cmd);
@@ -306,7 +306,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT uMsg, WPARAM wParam, L {
wchar_t *tmp = GetFilePath(TranslateT("Export public key"), L"*", TranslateT(".asc pubkey file"), true);
if (tmp) {
- wstring str(ptrT(UniGetContactSettingUtf(user_data[item_num + 1], szGPGModuleName, "GPGPubKey", L"")));
+ wstring str(ptrW(UniGetContactSettingUtf(user_data[item_num + 1], szGPGModuleName, "GPGPubKey", L"")));
wstring::size_type s = 0;
while ((s = str.find(L"\r", s)) != wstring::npos)
str.erase(s, 1);
@@ -333,7 +333,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT uMsg, WPARAM wParam, L szKey = (char*)GlobalLock(hMem);
if (!szKey) {
wchar_t msg[64];
- mir_sntprintf(msg, TranslateT("Failed to lock memory with error %d"), GetLastError());
+ mir_snwprintf(msg, TranslateT("Failed to lock memory with error %d"), GetLastError());
MessageBox(0, msg, TranslateT("Error"), MB_OK);
GlobalFree(hMem);
}
@@ -346,7 +346,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT uMsg, WPARAM wParam, L if (!SetClipboardData(CF_OEMTEXT, hMem)) {
GlobalFree(hMem);
wchar_t msg[64];
- mir_sntprintf(msg, TranslateT("Failed write to clipboard with error %d"), GetLastError());
+ mir_snwprintf(msg, TranslateT("Failed write to clipboard with error %d"), GetLastError());
MessageBox(0, msg, TranslateT("Error"), MB_OK);
}
CloseClipboard();
@@ -354,13 +354,13 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT uMsg, WPARAM wParam, L }
else {
wchar_t msg[64];
- mir_sntprintf(msg, TranslateT("Failed to open clipboard with error %d"), GetLastError());
+ mir_snwprintf(msg, TranslateT("Failed to open clipboard with error %d"), GetLastError());
MessageBox(0, msg, TranslateT("Error"), MB_OK);
}
break;
case IDC_LOG_FILE_SET:
- SetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, ptrT(GetFilePath(TranslateT("Set log file"), L"*", TranslateT("LOG files"), 1)));
+ SetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, ptrW(GetFilePath(TranslateT("Set log file"), L"*", TranslateT("LOG files"), 1)));
break;
}
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
@@ -415,8 +415,8 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- SetDlgItemText(hwndDlg, IDC_BIN_PATH, ptrT(UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", L"gpg.exe")));
- SetDlgItemText(hwndDlg, IDC_HOME_DIR, ptrT(UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"gpg")));
+ SetDlgItemText(hwndDlg, IDC_BIN_PATH, ptrW(UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", L"gpg.exe")));
+ SetDlgItemText(hwndDlg, IDC_HOME_DIR, ptrW(UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"gpg")));
return TRUE;
case WM_COMMAND:
@@ -464,13 +464,13 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, }
}
char mir_path[MAX_PATH];
- char *atmp = mir_t2a(tmp);
+ char *atmp = mir_u2a(tmp);
mir_free(tmp);
PathToAbsolute("\\", mir_path);
char* p_path = NULL;
if (StriStr(atmp, mir_path)) {
p_path = atmp + mir_strlen(mir_path);
- tmp = mir_a2t(p_path);
+ tmp = mir_a2u(p_path);
SetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp);
}
}
@@ -481,13 +481,13 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, wchar_t *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"");
SetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp);
char mir_path[MAX_PATH];
- char *atmp = mir_t2a(tmp);
+ char *atmp = mir_u2a(tmp);
mir_free(tmp);
PathToAbsolute("\\", mir_path);
char* p_path = NULL;
if (StriStr(atmp, mir_path)) {
p_path = atmp + mir_strlen(mir_path);
- tmp = mir_a2t(p_path);
+ tmp = mir_a2u(p_path);
SetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp);
}
mir_free(atmp);
@@ -507,8 +507,8 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, _countof(tmp));
db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp);
GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, _countof(tmp));
- while (tmp[mir_tstrlen(tmp) - 1] == '\\')
- tmp[mir_tstrlen(tmp) - 1] = '\0';
+ while (tmp[mir_wstrlen(tmp) - 1] == '\\')
+ tmp[mir_wstrlen(tmp) - 1] = '\0';
db_set_ts(NULL, szGPGModuleName, "szHomePath", tmp);
return TRUE;
}
@@ -569,23 +569,23 @@ static INT_PTR CALLBACK DlgProcGpgMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, GetDlgItemText(hwndDlg, IDC_IN_OPEN_TAG, tmp, _countof(tmp));
db_set_ts(NULL, szGPGModuleName, "szInOpenTag", tmp);
mir_free(inopentag);
- inopentag = (wchar_t*)mir_alloc(sizeof(wchar_t)* (mir_tstrlen(tmp) + 1));
- mir_tstrcpy(inopentag, tmp);
+ inopentag = (wchar_t*)mir_alloc(sizeof(wchar_t)* (mir_wstrlen(tmp) + 1));
+ mir_wstrcpy(inopentag, tmp);
GetDlgItemText(hwndDlg, IDC_IN_CLOSE_TAG, tmp, _countof(tmp));
db_set_ts(NULL, szGPGModuleName, "szInCloseTag", tmp);
mir_free(inclosetag);
- inclosetag = (wchar_t*)mir_alloc(sizeof(wchar_t)* (mir_tstrlen(tmp) + 1));
- mir_tstrcpy(inclosetag, tmp);
+ inclosetag = (wchar_t*)mir_alloc(sizeof(wchar_t)* (mir_wstrlen(tmp) + 1));
+ mir_wstrcpy(inclosetag, tmp);
GetDlgItemText(hwndDlg, IDC_OUT_OPEN_TAG, tmp, _countof(tmp));
db_set_ts(NULL, szGPGModuleName, "szOutOpenTag", tmp);
mir_free(outopentag);
- outopentag = (wchar_t*)mir_alloc(sizeof(wchar_t)* (mir_tstrlen(tmp) + 1));
- mir_tstrcpy(outopentag, tmp);
+ outopentag = (wchar_t*)mir_alloc(sizeof(wchar_t)* (mir_wstrlen(tmp) + 1));
+ mir_wstrcpy(outopentag, tmp);
GetDlgItemText(hwndDlg, IDC_OUT_CLOSE_TAG, tmp, _countof(tmp));
db_set_ts(NULL, szGPGModuleName, "szOutCloseTag", tmp);
mir_free(outclosetag);
- outclosetag = (wchar_t*)mir_alloc(sizeof(wchar_t)*(mir_tstrlen(tmp) + 1));
- mir_tstrcpy(outclosetag, tmp);
+ outclosetag = (wchar_t*)mir_alloc(sizeof(wchar_t)*(mir_wstrlen(tmp) + 1));
+ mir_wstrcpy(outclosetag, tmp);
}
return TRUE;
}
@@ -713,7 +713,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa if ((out.find("-----BEGIN PGP PUBLIC KEY BLOCK-----") != string::npos) && (out.find("-----END PGP PUBLIC KEY BLOCK-----") != string::npos)) {
boost::algorithm::replace_all(out, "\n", "\r\n");
- wchar_t *tmp3 = mir_a2t(out.c_str());
+ wchar_t *tmp3 = mir_a2u(out.c_str());
str.clear();
str.append(tmp3);
mir_free(tmp3);
@@ -758,22 +758,22 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa }
ws1 = 0;
if (((ws2 = key_buf.find(L"-----END PGP PUBLIC KEY BLOCK-----")) != wstring::npos) && ((ws1 = key_buf.find(L"-----BEGIN PGP PUBLIC KEY BLOCK-----")) != wstring::npos)) {
- begin = (wchar_t*)mir_alloc(sizeof(wchar_t) * (mir_tstrlen(L"-----BEGIN PGP PUBLIC KEY BLOCK-----") + 1));
- mir_tstrcpy(begin, L"-----BEGIN PGP PUBLIC KEY BLOCK-----");
- end = (wchar_t*)mir_alloc(sizeof(wchar_t) * (mir_tstrlen(L"-----END PGP PUBLIC KEY BLOCK-----") + 1));
- mir_tstrcpy(end, L"-----END PGP PUBLIC KEY BLOCK-----");
+ begin = (wchar_t*)mir_alloc(sizeof(wchar_t) * (mir_wstrlen(L"-----BEGIN PGP PUBLIC KEY BLOCK-----") + 1));
+ mir_wstrcpy(begin, L"-----BEGIN PGP PUBLIC KEY BLOCK-----");
+ end = (wchar_t*)mir_alloc(sizeof(wchar_t) * (mir_wstrlen(L"-----END PGP PUBLIC KEY BLOCK-----") + 1));
+ mir_wstrcpy(end, L"-----END PGP PUBLIC KEY BLOCK-----");
}
else if (((ws2 = key_buf.find(L"-----END PGP PRIVATE KEY BLOCK-----")) != wstring::npos) && ((ws1 = key_buf.find(L"-----BEGIN PGP PRIVATE KEY BLOCK-----")) != wstring::npos)) {
- begin = (wchar_t*)mir_alloc(sizeof(wchar_t) * (mir_tstrlen(L"-----BEGIN PGP PRIVATE KEY BLOCK-----") + 1));
- mir_tstrcpy(begin, L"-----BEGIN PGP PRIVATE KEY BLOCK-----");
- end = (wchar_t*)mir_alloc(sizeof(wchar_t) * (mir_tstrlen(L"-----END PGP PRIVATE KEY BLOCK-----") + 1));
- mir_tstrcpy(end, L"-----END PGP PRIVATE KEY BLOCK-----");
+ begin = (wchar_t*)mir_alloc(sizeof(wchar_t) * (mir_wstrlen(L"-----BEGIN PGP PRIVATE KEY BLOCK-----") + 1));
+ mir_wstrcpy(begin, L"-----BEGIN PGP PRIVATE KEY BLOCK-----");
+ end = (wchar_t*)mir_alloc(sizeof(wchar_t) * (mir_wstrlen(L"-----END PGP PRIVATE KEY BLOCK-----") + 1));
+ mir_wstrcpy(end, L"-----END PGP PRIVATE KEY BLOCK-----");
}
else {
MessageBox(0, TranslateT("This is not public or private key"), L"INFO", MB_OK);
break;
}
- ws2 += mir_tstrlen(end);
+ ws2 += mir_wstrlen(end);
bool allsubcontacts = false;
{
if (db_mc_isMeta(hContact)) {
@@ -791,7 +791,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa else db_set_ts(hContact, szGPGModuleName, "GPGPubKey", key_buf.substr(ws1, ws2 - ws1).c_str());
}
tmp = (wchar_t*)mir_alloc(sizeof(wchar_t) * (key_buf.length() + 1));
- mir_tstrcpy(tmp, key_buf.substr(ws1, ws2 - ws1).c_str());
+ mir_wstrcpy(tmp, key_buf.substr(ws1, ws2 - ws1).c_str());
{ //gpg execute block
std::vector<wstring> cmd;
wchar_t tmp2[MAX_PATH] = { 0 };
@@ -803,8 +803,8 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"");
wcsncpy(tmp2, ptmp, MAX_PATH - 1);
mir_free(ptmp);
- mir_tstrncat(tmp2, L"\\", _countof(tmp2) - mir_tstrlen(tmp2));
- mir_tstrncat(tmp2, L"temporary_exported.asc", _countof(tmp2) - mir_tstrlen(tmp2));
+ mir_wstrncat(tmp2, L"\\", _countof(tmp2) - mir_wstrlen(tmp2));
+ mir_wstrncat(tmp2, L"temporary_exported.asc", _countof(tmp2) - mir_wstrlen(tmp2));
boost::filesystem::remove(tmp2);
wfstream f(tmp2, std::ios::out);
ptmp = UniGetContactSettingUtf(hcnt, szGPGModuleName, "GPGPubKey", L"");
@@ -1105,7 +1105,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa MessageBox(0, TranslateT("There is no public or private key."), TranslateT("Info"), MB_OK);
break;
}
- ws2 += mir_tstrlen(L"-----END PGP PUBLIC KEY BLOCK-----");
+ ws2 += mir_wstrlen(L"-----END PGP PUBLIC KEY BLOCK-----");
SetDlgItemText(hwndDlg, IDC_PUBLIC_KEY_EDIT, key_buf.substr(ws1, ws2 - ws1).c_str());
key_buf.clear();
}
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index 1a169bbcb3..a0359340a9 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -29,11 +29,11 @@ wchar_t* __stdcall UniGetContactSettingUtf(MCONTACT hContact, const char *szModu DBVARIANT dbv = { DBVT_DELETED }; wchar_t* szRes = NULL; if (db_get_ts(hContact, szModule, szSetting, &dbv)) - return mir_tstrdup(szDef); + return mir_wstrdup(szDef); else if (dbv.pszVal) - szRes = mir_tstrdup(dbv.ptszVal); + szRes = mir_wstrdup(dbv.ptszVal); else - szRes = mir_tstrdup(szDef); + szRes = mir_wstrdup(szDef); db_free(&dbv); return szRes; @@ -62,15 +62,15 @@ void GetFilePath(wchar_t *WindowTittle, char *szSetting, wchar_t *szExt, wchar_t ofn.Flags = OFN_EXPLORER; ofn.lpstrTitle = TranslateW(WindowTittle); wcsncpy(filter, TranslateW(szExtDesc), _countof(filter) - 1); - pfilter = filter + mir_tstrlen(filter) + 1; - mir_tstrcpy(pfilter, szExt); - pfilter[mir_tstrlen(pfilter) + 1] = '\0'; - pfilter[mir_tstrlen(pfilter) + 2] = '\0'; + pfilter = filter + mir_wstrlen(filter) + 1; + mir_wstrcpy(pfilter, szExt); + pfilter[mir_wstrlen(pfilter) + 1] = '\0'; + pfilter[mir_wstrlen(pfilter) + 2] = '\0'; ofn.lpstrFilter = filter; tmp = UniGetContactSettingUtf(0, szGPGModuleName, szSetting, L""); wcsncpy(str, tmp, _countof(str) - 1); mir_free(tmp); - if (mir_tstrlen(str) < 2) + if (mir_wstrlen(str) < 2) str[0] = '\0'; ofn.lpstrFile = str; ofn.nMaxFile = _MAX_PATH; @@ -88,14 +88,14 @@ wchar_t *GetFilePath(wchar_t *WindowTittle, wchar_t *szExt, wchar_t *szExtDesc, ofn.lStructSize = CDSIZEOF_STRUCT(OPENFILENAME, lpTemplateName); ofn.Flags = OFN_EXPLORER; ofn.lpstrTitle = TranslateW(WindowTittle); - mir_tstrcpy(filter, TranslateW(szExtDesc)); - pfilter = filter + mir_tstrlen(filter) + 1; - mir_tstrcpy(pfilter, szExt); - pfilter[mir_tstrlen(pfilter) + 1] = '\0'; - pfilter[mir_tstrlen(pfilter) + 2] = '\0'; + mir_wstrcpy(filter, TranslateW(szExtDesc)); + pfilter = filter + mir_wstrlen(filter) + 1; + mir_wstrcpy(pfilter, szExt); + pfilter[mir_wstrlen(pfilter) + 1] = '\0'; + pfilter[mir_wstrlen(pfilter) + 2] = '\0'; ofn.lpstrFilter = filter; - mir_tstrcpy(str, L""); - if (mir_tstrlen(str) < 2) + mir_wstrcpy(str, L""); + if (mir_wstrlen(str) < 2) str[0] = '\0'; ofn.lpstrFile = str; ofn.nMaxFile = _MAX_PATH; @@ -238,7 +238,7 @@ int OnPreBuildContactMenu(WPARAM w, LPARAM) keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); } wchar_t buf[128] = { 0 }; - mir_sntprintf(buf, L"%s: %s", TranslateT("Send public key"), toUTF16(keyid).c_str()); + mir_snwprintf(buf, L"%s: %s", TranslateT("Send public key"), toUTF16(keyid).c_str()); mir_free(keyid); Menu_ModifyItem(hSendKey, buf); } @@ -285,7 +285,7 @@ int onProtoAck(WPARAM, LPARAM l) } else { if (f->szCurrentFile && f->szCurrentFile[0]) - filename = mir_utf8decodeT(f->szCurrentFile); + filename = mir_utf8decodeW(f->szCurrentFile); if (!filename) return 0; } @@ -309,7 +309,7 @@ int onProtoAck(WPARAM, LPARAM l) cmd.push_back(L"-o"); wstring file = filename; wstring::size_type p1 = file.rfind(L".gpg"); - file.erase(p1, mir_tstrlen(L".gpg")); + file.erase(p1, mir_wstrlen(L".gpg")); if (boost::filesystem::exists(file)) { if (MessageBox(0, TranslateT("Target file exists, do you want to replace it?"), TranslateT("Warning"), MB_YESNO) == IDNO) return 0; @@ -325,15 +325,15 @@ int onProtoAck(WPARAM, LPARAM l) dbsetting += keyid; dbsetting += "_Password"; pass = UniGetContactSettingUtf(NULL, szGPGModuleName, dbsetting.c_str(), L""); - if (mir_tstrlen(pass) > 0 && bDebugLog) + if (mir_wstrlen(pass) > 0 && bDebugLog) debuglog << std::string(time_str() + ": info: found password in database for key ID: " + keyid + ", trying to decrypt message from " + toUTF8(pcli->pfnGetContactDisplayName(ack->hContact, 0)) + " with password"); } else { pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", L""); - if (mir_tstrlen(pass) > 0 && bDebugLog) + if (mir_wstrlen(pass) > 0 && bDebugLog) debuglog << std::string(time_str() + ": info: found password for all keys in database, trying to decrypt message from " + toUTF8(pcli->pfnGetContactDisplayName(ack->hContact, 0)) + " with password"); } - if (mir_tstrlen(pass) > 0) { + if (mir_wstrlen(pass) > 0) { cmd.push_back(L"--passphrase"); cmd.push_back(pass); } @@ -432,14 +432,14 @@ std::wstring encrypt_file(MCONTACT hContact, wchar_t *filename) cmd.push_back(L"--tes"); cmd.push_back(L"-r"); char *keyid = UniGetContactSettingUtf(hcnt, szGPGModuleName, "KeyID", ""); - wchar_t *szKeyid = mir_a2t(keyid); + wchar_t *szKeyid = mir_a2u(keyid); wchar_t *name = wcsrchr(filename, '\\'); if (!name) name = filename; else name++; - wchar_t *file_out = new wchar_t[mir_tstrlen(name) + mir_tstrlen(L".gpg") + 1]; - mir_sntprintf(file_out, mir_tstrlen(name) + mir_tstrlen(L".gpg") + 1, L"%s.gpg", name); + wchar_t *file_out = new wchar_t[mir_wstrlen(name) + mir_wstrlen(L".gpg") + 1]; + mir_snwprintf(file_out, mir_wstrlen(name) + mir_wstrlen(L".gpg") + 1, L"%s.gpg", name); cmd.push_back(szKeyid); if (db_get_b(hcnt, szGPGModuleName, "bAlwaysTrust", 0)) { cmd.push_back(L"--trust-model"); @@ -542,7 +542,7 @@ INT_PTR onSendFile(WPARAM w, LPARAM l) continue; std::wstring path_out = encrypt_file(ccs->hContact, file[i]); mir_free(file[i]); - file[i] = mir_tstrdup(path_out.c_str()); + file[i] = mir_wstrdup(path_out.c_str()); transfers.push_back(path_out); } } @@ -553,7 +553,7 @@ INT_PTR onSendFile(WPARAM w, LPARAM l) return 0; //we do not want to send file unencrypted (sometimes ack have wrong info) if (strstr(file[i], ".gpg")) continue; - wchar_t *tmp = mir_utf8decodeT(file[i]); + wchar_t *tmp = mir_utf8decodeW(file[i]); std::wstring path_out = encrypt_file(ccs->hContact, tmp); mir_free(tmp); char* tmp2 = mir_utf8encodeW(path_out.c_str()); @@ -618,11 +618,11 @@ int GetJabberInterface(WPARAM, LPARAM) //get interface for all jabber accounts, if (JIftmp) { (*p)->setJabberInterface(JIftmp); if (accounts[i]->tszAccountName) { - wchar_t* tmp = mir_tstrdup(accounts[i]->tszAccountName); + wchar_t* tmp = mir_wstrdup(accounts[i]->tszAccountName); (*p)->setAccountName(tmp); } else { - wchar_t *tmp = mir_a2t(accounts[i]->szModuleName); + wchar_t *tmp = mir_a2u(accounts[i]->szModuleName); (*p)->setAccountName(tmp); } (*p)->setAccountNumber(a); @@ -657,7 +657,7 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void*) if (wcsstr(str, L"-----BEGIN PGP MESSAGE-----") && wcsstr(str, L"-----END PGP MESSAGE-----")) { wstring data = str; xmlSetText(local_node, L"This message is encrypted."); - wstring::size_type p1 = data.find(L"-----BEGIN PGP MESSAGE-----") + mir_tstrlen(L"-----BEGIN PGP MESSAGE-----"); + wstring::size_type p1 = data.find(L"-----BEGIN PGP MESSAGE-----") + mir_wstrlen(L"-----BEGIN PGP MESSAGE-----"); while (data.find(L"Version: ", p1) != wstring::npos) { p1 = data.find(L"Version: ", p1); p1 = data.find(L"\n", p1); @@ -713,7 +713,7 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void*) inkeyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); } - ptrT pass; + ptrW pass; if (inkeyid[0]) { string dbsetting = "szKey_"; dbsetting += inkeyid; @@ -778,7 +778,7 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void*) break; } if (data.find(L"-----BEGIN PGP SIGNATURE-----") != wstring::npos && data.find(L"-----END PGP SIGNATURE-----") != wstring::npos) { - wstring::size_type p1 = data.find(L"-----BEGIN PGP SIGNATURE-----") + mir_tstrlen(L"-----BEGIN PGP SIGNATURE-----"); + wstring::size_type p1 = data.find(L"-----BEGIN PGP SIGNATURE-----") + mir_wstrlen(L"-----BEGIN PGP SIGNATURE-----"); if (data.find(L"Version: ", p1) != wstring::npos) { p1 = data.find(L"Version: ", p1); p1 = data.find(L"\n", p1); @@ -978,7 +978,7 @@ bool isContactSecured(MCONTACT hContact) bool isContactHaveKey(MCONTACT hContact) { wchar_t *key = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", L""); - if (mir_tstrlen(key) > 0) { + if (mir_wstrlen(key) > 0) { mir_free(key); return true; } @@ -1015,21 +1015,21 @@ bool isGPGValid() wchar_t *mir_path = (wchar_t*)mir_alloc(MAX_PATH * sizeof(wchar_t)); PathToAbsoluteW(L"\\", mir_path); SetCurrentDirectoryW(mir_path); - tmp = mir_tstrdup(mir_path); + tmp = mir_wstrdup(mir_path); mir_free(mir_path); - //mir_realloc(path, (mir_tstrlen(path)+64)*sizeof(wchar_t)); + //mir_realloc(path, (mir_wstrlen(path)+64)*sizeof(wchar_t)); wchar_t *gpg_path = (wchar_t*)mir_alloc(sizeof(wchar_t)*MAX_PATH); - mir_tstrcpy(gpg_path, tmp); - mir_tstrcat(gpg_path, L"\\GnuPG\\gpg.exe"); + mir_wstrcpy(gpg_path, tmp); + mir_wstrcat(gpg_path, L"\\GnuPG\\gpg.exe"); mir_free(tmp); tmp = NULL; p = boost::filesystem::path(gpg_path); if (boost::filesystem::exists(p) && boost::filesystem::is_regular_file(p)) { gpg_exists = true; - mir_tstrcpy(path, L"GnuPG\\gpg.exe"); + mir_wstrcpy(path, L"GnuPG\\gpg.exe"); } mir_free(gpg_path); - tmp = mir_tstrdup(path); + tmp = mir_wstrdup(path); mir_free(path); } @@ -1254,7 +1254,7 @@ void ExportGpGKeysFunc(int type) //TODO: handle error return; } - char *path = mir_t2a(p); + char *path = mir_u2a(p); delete[] p; std::ofstream file; file.open(path, std::ios::trunc | std::ios::out); @@ -1414,11 +1414,11 @@ void ExportGpGKeysFunc(int type) file.close(); wchar_t msg[512]; if (type == 2) - mir_sntprintf(msg, TranslateT("We have successfully exported %d public keys and all private keys."), exported_keys); + mir_snwprintf(msg, TranslateT("We have successfully exported %d public keys and all private keys."), exported_keys); else if (type == 1) - mir_sntprintf(msg, TranslateT("We have successfully exported all private keys.")); + mir_snwprintf(msg, TranslateT("We have successfully exported all private keys.")); else if (!type) - mir_sntprintf(msg, TranslateT("We have successfully exported %d public keys."), exported_keys); + mir_snwprintf(msg, TranslateT("We have successfully exported %d public keys."), exported_keys); MessageBox(NULL, msg, TranslateT("Keys export result"), MB_OK); } @@ -1438,7 +1438,7 @@ INT_PTR ImportGpGKeys(WPARAM, LPARAM) } std::ifstream file; { - ptrA szPath(mir_t2a(p)); + ptrA szPath(mir_u2a(p)); delete[] p; file.open(szPath, std::ios::in); @@ -1724,8 +1724,8 @@ INT_PTR ImportGpGKeys(WPARAM, LPARAM) ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L""); wcsncpy(tmp2, ptmp, MAX_PATH - 1); mir_free(ptmp); - mir_tstrncat(tmp2, L"\\", _countof(tmp2) - mir_tstrlen(tmp2)); - mir_tstrncat(tmp2, L"temporary_exported.asc", _countof(tmp2) - mir_tstrlen(tmp2)); + mir_wstrncat(tmp2, L"\\", _countof(tmp2) - mir_wstrlen(tmp2)); + mir_wstrncat(tmp2, L"temporary_exported.asc", _countof(tmp2) - mir_wstrlen(tmp2)); boost::filesystem::remove(tmp2); wfstream f(tmp2, std::ios::out); f << toUTF16(key).c_str(); @@ -1752,9 +1752,9 @@ INT_PTR ImportGpGKeys(WPARAM, LPARAM) file.close(); wchar_t msg[512]; if (processed_private_keys) - mir_sntprintf(msg, TranslateT("We have successfully processed %d public keys and some private keys."), processed_keys); + mir_snwprintf(msg, TranslateT("We have successfully processed %d public keys and some private keys."), processed_keys); else - mir_sntprintf(msg, TranslateT("We have successfully processed %d public keys."), processed_keys); + mir_snwprintf(msg, TranslateT("We have successfully processed %d public keys."), processed_keys); MessageBox(NULL, msg, TranslateT("Keys import result"), MB_OK); return 0; } @@ -1910,7 +1910,7 @@ static INT_PTR CALLBACK DlgProcChangePasswd(HWND hwndDlg, UINT msg, WPARAM wPara old_pass = toUTF8(buf); bool old_pass_match = false; wchar_t *pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", L""); - if (!mir_tstrcmp(pass, buf)) + if (!mir_wstrcmp(pass, buf)) old_pass_match = true; mir_free(pass); @@ -1920,7 +1920,7 @@ static INT_PTR CALLBACK DlgProcChangePasswd(HWND hwndDlg, UINT msg, WPARAM wPara dbsetting += toUTF8(key_id_global); dbsetting += "_Password"; pass = UniGetContactSettingUtf(NULL, szGPGModuleName, dbsetting.c_str(), L""); - if (!mir_tstrcmp(pass, buf)) + if (!mir_wstrcmp(pass, buf)) old_pass_match = true; mir_free(pass); } diff --git a/plugins/NewsAggregator/Src/Authentication.cpp b/plugins/NewsAggregator/Src/Authentication.cpp index f72bee89fc..8b587f8779 100644 --- a/plugins/NewsAggregator/Src/Authentication.cpp +++ b/plugins/NewsAggregator/Src/Authentication.cpp @@ -29,11 +29,11 @@ void CreateAuthString(char *auth, MCONTACT hContact, HWND hwndDlg) else if (hwndDlg && IsDlgButtonChecked(hwndDlg, IDC_USEAUTH)) {
wchar_t buf[MAX_PATH] = {0};
GetDlgItemText(hwndDlg, IDC_LOGIN, buf, _countof(buf));
- tlogin = mir_tstrdup(buf);
+ tlogin = mir_wstrdup(buf);
GetDlgItemText(hwndDlg, IDC_PASSWORD, buf, _countof(buf));
- tpass = mir_tstrdup(buf);
+ tpass = mir_wstrdup(buf);
}
- char *user = mir_t2a(tlogin), *pass = mir_t2a(tpass);
+ char *user = mir_u2a(tlogin), *pass = mir_u2a(tpass);
char str[MAX_PATH];
int len = mir_snprintf(str, "%s:%s", user, pass);
diff --git a/plugins/NewsAggregator/Src/CheckFeed.cpp b/plugins/NewsAggregator/Src/CheckFeed.cpp index 4abe1c0395..8586d20477 100644 --- a/plugins/NewsAggregator/Src/CheckFeed.cpp +++ b/plugins/NewsAggregator/Src/CheckFeed.cpp @@ -25,9 +25,9 @@ LPCTSTR CheckFeed(wchar_t *tszURL, HWND hwndDlg) char *szData = NULL;
GetNewsData(tszURL, &szData, NULL, hwndDlg);
if (szData) {
- wchar_t *tszData = mir_utf8decodeT(szData);
+ wchar_t *tszData = mir_utf8decodeW(szData);
if (!tszData)
- tszData = mir_a2t(szData);
+ tszData = mir_a2u(szData);
int bytesParsed = 0;
HXML hXml = xmlParseString(tszData, &bytesParsed, NULL);
mir_free(tszData);
@@ -36,11 +36,11 @@ LPCTSTR CheckFeed(wchar_t *tszURL, HWND hwndDlg) LPCTSTR codepage = NULL;
int childcount = 0;
HXML node;
- if (!mir_tstrcmpi(xmlGetName(hXml), L"xml")) {
+ if (!mir_wstrcmpi(xmlGetName(hXml), L"xml")) {
int attrcount = xmlGetAttrCount(hXml);
for (int i = 0; i < attrcount; i++) {
LPCTSTR szAttrName = xmlGetAttrName(hXml, i);
- if (!mir_tstrcmpi(szAttrName, L"encoding")) {
+ if (!mir_wstrcmpi(szAttrName, L"encoding")) {
codepage = xmlGetAttrValue(hXml, szAttrName);
break;
}
@@ -51,38 +51,38 @@ LPCTSTR CheckFeed(wchar_t *tszURL, HWND hwndDlg) node = hXml;
while (node) {
LPCTSTR szNodeName = xmlGetName(node);
- if (!mir_tstrcmpi(szNodeName, L"rss") || !mir_tstrcmpi(szNodeName, L"rdf")) {
+ if (!mir_wstrcmpi(szNodeName, L"rss") || !mir_wstrcmpi(szNodeName, L"rdf")) {
HXML chan = xmlGetChild(node, 0);
for (int j = 0; j < xmlGetChildCount(chan); j++) {
HXML child = xmlGetChild(chan, j);
- if (!mir_tstrcmpi(xmlGetName(child), L"title")) {
+ if (!mir_wstrcmpi(xmlGetName(child), L"title")) {
wchar_t mes[MAX_PATH];
- mir_sntprintf(mes, TranslateT("%s\nis a valid feed's address."), tszURL);
+ mir_snwprintf(mes, TranslateT("%s\nis a valid feed's address."), tszURL);
MessageBox(hwndDlg, mes, TranslateT("News Aggregator"), MB_OK | MB_ICONINFORMATION);
- if (!mir_tstrcmpi(codepage, L"koi8-r")) {
+ if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf));
- return mir_tstrdup(buf);
+ return mir_wstrdup(buf);
}
else
- return mir_tstrdup(xmlGetText(child));
+ return mir_wstrdup(xmlGetText(child));
}
}
}
- else if (!mir_tstrcmpi(szNodeName, L"feed")) {
+ else if (!mir_wstrcmpi(szNodeName, L"feed")) {
for (int j = 0; j < xmlGetChildCount(node); j++) {
HXML child = xmlGetChild(node, j);
- if (!mir_tstrcmpi(xmlGetName(child), L"title")) {
+ if (!mir_wstrcmpi(xmlGetName(child), L"title")) {
wchar_t mes[MAX_PATH];
- mir_sntprintf(mes, TranslateT("%s\nis a valid feed's address."), tszURL);
+ mir_snwprintf(mes, TranslateT("%s\nis a valid feed's address."), tszURL);
MessageBox(hwndDlg, mes, TranslateT("News Aggregator"), MB_OK | MB_ICONINFORMATION);
- if (!mir_tstrcmpi(codepage, L"koi8-r")) {
+ if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf));
- return mir_tstrdup(buf);
+ return mir_wstrdup(buf);
}
else
- return mir_tstrdup(xmlGetText(child));
+ return mir_wstrdup(xmlGetText(child));
}
}
}
@@ -93,7 +93,7 @@ LPCTSTR CheckFeed(wchar_t *tszURL, HWND hwndDlg) }
Netlib_LogfT(hNetlibUser, L"%s is not a valid feed's address.", tszURL);
wchar_t mes[MAX_PATH];
- mir_sntprintf(mes, TranslateT("%s\nis not a valid feed's address."), tszURL);
+ mir_snwprintf(mes, TranslateT("%s\nis not a valid feed's address."), tszURL);
MessageBox(hwndDlg, mes, TranslateT("News Aggregator"), MB_OK | MB_ICONERROR);
return NULL;
}
@@ -194,9 +194,9 @@ void CheckCurrentFeed(MCONTACT hContact) mir_free(szURL);
if (szData) {
- wchar_t *tszData = mir_utf8decodeT(szData);
+ wchar_t *tszData = mir_utf8decodeW(szData);
if (!tszData)
- tszData = mir_a2t(szData);
+ tszData = mir_a2u(szData);
int bytesParsed = 0;
HXML hXml = xmlParseString(tszData, &bytesParsed, NULL);
mir_free(tszData);
@@ -207,11 +207,11 @@ void CheckCurrentFeed(MCONTACT hContact) LPCTSTR codepage = NULL;
int childcount = 0;
HXML node;
- if (!mir_tstrcmpi(xmlGetName(hXml), L"xml")) {
+ if (!mir_wstrcmpi(xmlGetName(hXml), L"xml")) {
int attrcount = xmlGetAttrCount(hXml);
for (int i = 0; i < attrcount; i++) {
LPCTSTR szAttrName = xmlGetAttrName(hXml, i);
- if (!mir_tstrcmpi(szAttrName, L"encoding")) {
+ if (!mir_wstrcmpi(szAttrName, L"encoding")) {
codepage = xmlGetAttrValue(hXml, szAttrName);
break;
}
@@ -222,14 +222,14 @@ void CheckCurrentFeed(MCONTACT hContact) node = hXml;
while (node) {
LPCTSTR szNodeName = xmlGetName(node);
- bool isRSS = !mir_tstrcmpi(szNodeName, L"rss"), isAtom = !mir_tstrcmpi(szNodeName, L"rdf");
+ bool isRSS = !mir_wstrcmpi(szNodeName, L"rss"), isAtom = !mir_wstrcmpi(szNodeName, L"rdf");
if (isRSS || isAtom) {
if (isRSS) {
for (int i = 0; i < xmlGetAttrCount(node); i++) {
LPCTSTR szAttrName = xmlGetAttrName(node, i);
- if (!mir_tstrcmpi(szAttrName, L"version")) {
+ if (!mir_wstrcmpi(szAttrName, L"version")) {
wchar_t ver[MAX_PATH];
- mir_sntprintf(ver, L"RSS %s", xmlGetAttrValue(node, szAttrName));
+ mir_snwprintf(ver, L"RSS %s", xmlGetAttrValue(node, szAttrName));
db_set_ts(hContact, MODULE, "MirVer", ver);
break;
}
@@ -242,9 +242,9 @@ void CheckCurrentFeed(MCONTACT hContact) for (int j = 0; j < xmlGetChildCount(chan); j++) {
HXML child = xmlGetChild(chan, j);
LPCTSTR childName = xmlGetName(child);
- if (!mir_tstrcmpi(childName, L"title")) {
+ if (!mir_wstrcmpi(childName, L"title")) {
LPCTSTR szChildText = NULL;
- if (!mir_tstrcmpi(codepage, L"koi8-r")) {
+ if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf));
szChildText = buf;
@@ -254,9 +254,9 @@ void CheckCurrentFeed(MCONTACT hContact) if (szChildText)
db_set_ts(hContact, MODULE, "FirstName", ClearText(szValue, szChildText));
}
- else if (!mir_tstrcmpi(childName, L"link")) {
+ else if (!mir_wstrcmpi(childName, L"link")) {
LPCTSTR szChildText = NULL;
- if (!mir_tstrcmpi(codepage, L"koi8-r")) {
+ if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf));
szChildText = buf;
@@ -266,9 +266,9 @@ void CheckCurrentFeed(MCONTACT hContact) if (szChildText)
db_set_ts(hContact, MODULE, "Homepage", ClearText(szValue, szChildText));
}
- else if (!mir_tstrcmpi(childName, L"description")) {
+ else if (!mir_wstrcmpi(childName, L"description")) {
LPCTSTR szChildText = NULL;
- if (!mir_tstrcmpi(codepage, L"koi8-r")) {
+ if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf));
szChildText = buf;
@@ -281,9 +281,9 @@ void CheckCurrentFeed(MCONTACT hContact) db_set_ts(hContact, "CList", "StatusMsg", szValue);
}
}
- else if (!mir_tstrcmpi(childName, L"language")) {
+ else if (!mir_wstrcmpi(childName, L"language")) {
LPCTSTR szChildText = NULL;
- if (!mir_tstrcmpi(codepage, L"koi8-r")) {
+ if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf));
szChildText = buf;
@@ -293,9 +293,9 @@ void CheckCurrentFeed(MCONTACT hContact) if (szChildText)
db_set_ts(hContact, MODULE, "Language1", ClearText(szValue, szChildText));
}
- else if (!mir_tstrcmpi(childName, L"managingEditor")) {
+ else if (!mir_wstrcmpi(childName, L"managingEditor")) {
LPCTSTR szChildText = NULL;
- if (!mir_tstrcmpi(codepage, L"koi8-r")) {
+ if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf));
szChildText = buf;
@@ -305,9 +305,9 @@ void CheckCurrentFeed(MCONTACT hContact) if (szChildText)
db_set_ts(hContact, MODULE, "e-mail", ClearText(szValue, szChildText));
}
- else if (!mir_tstrcmpi(childName, L"category")) {
+ else if (!mir_wstrcmpi(childName, L"category")) {
LPCTSTR szChildText = NULL;
- if (!mir_tstrcmpi(codepage, L"koi8-r")) {
+ if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf));
szChildText = buf;
@@ -317,9 +317,9 @@ void CheckCurrentFeed(MCONTACT hContact) if (szChildText)
db_set_ts(hContact, MODULE, "Interest0Text", ClearText(szValue, szChildText));
}
- else if (!mir_tstrcmpi(childName, L"copyright")) {
+ else if (!mir_wstrcmpi(childName, L"copyright")) {
LPCTSTR szChildText = NULL;
- if (!mir_tstrcmpi(codepage, L"koi8-r")) {
+ if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf));
szChildText = buf;
@@ -329,10 +329,10 @@ void CheckCurrentFeed(MCONTACT hContact) if (szChildText)
db_set_s(hContact, "UserInfo", "MyNotes", _T2A(ClearText(szValue, szChildText)));
}
- else if (!mir_tstrcmpi(childName, L"image")) {
+ else if (!mir_wstrcmpi(childName, L"image")) {
for (int x = 0; x < xmlGetChildCount(child); x++) {
HXML imageval = xmlGetChild(child, x);
- if (!mir_tstrcmpi(xmlGetName(imageval), L"url")) {
+ if (!mir_wstrcmpi(xmlGetName(imageval), L"url")) {
LPCTSTR url = xmlGetText(imageval);
db_set_ts(hContact, MODULE, "ImageURL", url);
@@ -346,7 +346,7 @@ void CheckCurrentFeed(MCONTACT hContact) CMString filename = szNick;
filename.Replace(L"/", L"_");
- mir_sntprintf(ai.filename, L"%s\\%s.%s", tszRoot, filename.c_str(), ext);
+ mir_snwprintf(ai.filename, L"%s\\%s.%s", tszRoot, filename.c_str(), ext);
CreateDirectoryTreeT(tszRoot);
if (DownloadFile(url, ai.filename)) {
db_set_ts(hContact, MODULE, "ImagePath", ai.filename);
@@ -359,9 +359,9 @@ void CheckCurrentFeed(MCONTACT hContact) }
}
}
- else if (!mir_tstrcmpi(childName, L"lastBuildDate")) {
+ else if (!mir_wstrcmpi(childName, L"lastBuildDate")) {
LPCTSTR szChildText = NULL;
- if (!mir_tstrcmpi(codepage, L"koi8-r")) {
+ if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf));
szChildText = buf;
@@ -379,14 +379,14 @@ void CheckCurrentFeed(MCONTACT hContact) }
}
}
- else if (!mir_tstrcmpi(childName, L"item")) {
+ else if (!mir_wstrcmpi(childName, L"item")) {
CMString title, link, descr, author, comments, guid, category;
time_t stamp = 0;
for (int z = 0; z < xmlGetChildCount(child); z++) {
HXML itemval = xmlGetChild(child, z);
LPCTSTR itemName = xmlGetName(itemval);
LPCTSTR value = NULL;
- if (!mir_tstrcmpi(codepage, L"koi8-r")) {
+ if (!mir_wstrcmpi(codepage, L"koi8-r")) {
wchar_t buf[MAX_PATH];
MultiByteToWideChar(20866, 0, _T2A(xmlGetText(itemval)), -1, buf, _countof(buf));
value = buf;
@@ -395,29 +395,29 @@ void CheckCurrentFeed(MCONTACT hContact) value = xmlGetText(itemval);
// We only use the first tag for now and ignore the rest.
- if (!mir_tstrcmpi(itemName, L"title"))
+ if (!mir_wstrcmpi(itemName, L"title"))
ClearText(title, value);
- else if (!mir_tstrcmpi(itemName, L"link"))
+ else if (!mir_wstrcmpi(itemName, L"link"))
ClearText(link, value);
- else if (!mir_tstrcmpi(itemName, L"pubDate") || !mir_tstrcmpi(itemName, L"date")) {
+ else if (!mir_wstrcmpi(itemName, L"pubDate") || !mir_wstrcmpi(itemName, L"date")) {
if (stamp == 0)
stamp = DateToUnixTime(value, 0);
}
- else if (!mir_tstrcmpi(itemName, L"description") || !mir_tstrcmpi(itemName, L"encoded"))
+ else if (!mir_wstrcmpi(itemName, L"description") || !mir_wstrcmpi(itemName, L"encoded"))
ClearText(descr, value);
- else if (!mir_tstrcmpi(itemName, L"author") || !mir_tstrcmpi(itemName, L"creator"))
+ else if (!mir_wstrcmpi(itemName, L"author") || !mir_wstrcmpi(itemName, L"creator"))
ClearText(author, value);
- else if (!mir_tstrcmpi(itemName, L"comments"))
+ else if (!mir_wstrcmpi(itemName, L"comments"))
ClearText(comments, value);
- else if (!mir_tstrcmpi(itemName, L"guid"))
+ else if (!mir_wstrcmpi(itemName, L"guid"))
ClearText(guid, value);
- else if (!mir_tstrcmpi(itemName, L"category"))
+ else if (!mir_wstrcmpi(itemName, L"category"))
ClearText(category, value);
}
@@ -425,27 +425,27 @@ void CheckCurrentFeed(MCONTACT hContact) }
}
}
- else if (!mir_tstrcmpi(szNodeName, L"feed")) {
+ else if (!mir_wstrcmpi(szNodeName, L"feed")) {
db_set_ts(hContact, MODULE, "MirVer", L"Atom 3");
for (int j = 0; j < xmlGetChildCount(node); j++) {
HXML child = xmlGetChild(node, j);
LPCTSTR szChildName = xmlGetName(child);
- if (!mir_tstrcmpi(szChildName, L"title")) {
+ if (!mir_wstrcmpi(szChildName, L"title")) {
LPCTSTR szChildText = xmlGetText(child);
if (szChildText)
db_set_ts(hContact, MODULE, "FirstName", ClearText(szValue, szChildText));
}
- else if (!mir_tstrcmpi(szChildName, L"link")) {
+ else if (!mir_wstrcmpi(szChildName, L"link")) {
for (int x = 0; x < xmlGetAttrCount(child); x++) {
- if (!mir_tstrcmpi(xmlGetAttrName(child, x), L"rel"))
- if (!mir_tstrcmpi(xmlGetAttrValue(child, xmlGetAttrName(child, x)), L"self"))
+ if (!mir_wstrcmpi(xmlGetAttrName(child, x), L"rel"))
+ if (!mir_wstrcmpi(xmlGetAttrValue(child, xmlGetAttrName(child, x)), L"self"))
break;
- if (!mir_tstrcmpi(xmlGetAttrName(child, x), L"href"))
+ if (!mir_wstrcmpi(xmlGetAttrName(child, x), L"href"))
db_set_ts(hContact, MODULE, "Homepage", xmlGetAttrValue(child, xmlGetAttrName(child, x)));
}
}
- else if (!mir_tstrcmpi(szChildName, L"subtitle")) {
+ else if (!mir_wstrcmpi(szChildName, L"subtitle")) {
LPCTSTR szChildText = xmlGetText(child);
if (szChildText) {
ClearText(szValue, szChildText);
@@ -453,33 +453,33 @@ void CheckCurrentFeed(MCONTACT hContact) db_set_ts(hContact, "CList", "StatusMsg", szValue);
}
}
- else if (!mir_tstrcmpi(szChildName, L"language")) {
+ else if (!mir_wstrcmpi(szChildName, L"language")) {
LPCTSTR szChildText = xmlGetText(child);
if (szChildText)
db_set_ts(hContact, MODULE, "Language1", ClearText(szValue, szChildText));
}
- else if (!mir_tstrcmpi(szChildName, L"author")) {
+ else if (!mir_wstrcmpi(szChildName, L"author")) {
for (int x = 0; x < xmlGetChildCount(child); x++) {
HXML authorval = xmlGetChild(child, x);
- if (!mir_tstrcmpi(xmlGetName(authorval), L"email")) {
+ if (!mir_wstrcmpi(xmlGetName(authorval), L"email")) {
db_set_ts(hContact, MODULE, "e-mail", xmlGetText(authorval));
break;
}
}
}
- else if (!mir_tstrcmpi(szChildName, L"category")) {
+ else if (!mir_wstrcmpi(szChildName, L"category")) {
LPCTSTR szChildText = xmlGetText(child);
if (szChildText)
db_set_ts(hContact, MODULE, "Interest0Text", ClearText(szValue, szChildText));
}
- else if (!mir_tstrcmpi(szChildName, L"icon")) {
+ else if (!mir_wstrcmpi(szChildName, L"icon")) {
for (int x = 0; x < xmlGetChildCount(child); x++) {
HXML imageval = xmlGetChild(child, x);
- if (!mir_tstrcmpi(xmlGetName(imageval), L"url")) {
+ if (!mir_wstrcmpi(xmlGetName(imageval), L"url")) {
LPCTSTR url = xmlGetText(imageval);
db_set_ts(hContact, MODULE, "ImageURL", url);
- ptrT szNick(db_get_tsa(hContact, MODULE, "Nick"));
+ ptrW szNick(db_get_tsa(hContact, MODULE, "Nick"));
if (szNick) {
PROTO_AVATAR_INFORMATION ai = { 0 };
ai.hContact = hContact;
@@ -487,7 +487,7 @@ void CheckCurrentFeed(MCONTACT hContact) ai.format = ProtoGetAvatarFormat(ext);
wchar_t *filename = szNick;
- mir_sntprintf(ai.filename, L"%s\\%s.%s", tszRoot, filename, ext);
+ mir_snwprintf(ai.filename, L"%s\\%s.%s", tszRoot, filename, ext);
if (DownloadFile(url, ai.filename)) {
db_set_ts(hContact, MODULE, "ImagePath", ai.filename);
ProtoBroadcastAck(MODULE, hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, NULL);
@@ -498,7 +498,7 @@ void CheckCurrentFeed(MCONTACT hContact) }
}
}
- else if (!mir_tstrcmpi(szChildName, L"updated")) {
+ else if (!mir_wstrcmpi(szChildName, L"updated")) {
LPCTSTR szChildText = xmlGetText(child);
if (szChildText) {
wchar_t *lastupdtime = (wchar_t *)szChildText;
@@ -512,57 +512,57 @@ void CheckCurrentFeed(MCONTACT hContact) }
}
}
- else if (!mir_tstrcmpi(szChildName, L"entry")) {
+ else if (!mir_wstrcmpi(szChildName, L"entry")) {
CMString title, link, descr, author, comments, guid, category;
time_t stamp = 0;
for (int z = 0; z < xmlGetChildCount(child); z++) {
HXML itemval = xmlGetChild(child, z);
LPCTSTR szItemName = xmlGetName(itemval);
- if (!mir_tstrcmpi(szItemName, L"title")) {
+ if (!mir_wstrcmpi(szItemName, L"title")) {
LPCTSTR szItemText = xmlGetText(itemval);
if (szItemText)
ClearText(title, szItemText);
}
- else if (!mir_tstrcmpi(szItemName, L"link")) {
+ else if (!mir_wstrcmpi(szItemName, L"link")) {
for (int x = 0; x < xmlGetAttrCount(itemval); x++) {
- if (!mir_tstrcmpi(xmlGetAttrName(itemval, x), L"href")) {
+ if (!mir_wstrcmpi(xmlGetAttrName(itemval, x), L"href")) {
ClearText(link, xmlGetAttrValue(itemval, xmlGetAttrName(itemval, x)));
break;
}
}
}
- else if (!mir_tstrcmpi(szItemName, L"updated")) {
+ else if (!mir_wstrcmpi(szItemName, L"updated")) {
if (stamp == 0)
stamp = DateToUnixTime(xmlGetText(itemval), 0);
}
- else if (!mir_tstrcmpi(szItemName, L"summary") || !mir_tstrcmpi(szItemName, L"content")) {
+ else if (!mir_wstrcmpi(szItemName, L"summary") || !mir_wstrcmpi(szItemName, L"content")) {
LPCTSTR szItemText = xmlGetText(itemval);
if (szItemText)
ClearText(descr, szItemText);
}
- else if (!mir_tstrcmpi(szItemName, L"author")) {
+ else if (!mir_wstrcmpi(szItemName, L"author")) {
for (int x = 0; x < xmlGetChildCount(itemval); x++) {
HXML authorval = xmlGetChild(itemval, x);
- if (!mir_tstrcmpi(xmlGetName(authorval), L"name") && xmlGetText(authorval)) {
+ if (!mir_wstrcmpi(xmlGetName(authorval), L"name") && xmlGetText(authorval)) {
ClearText(author, xmlGetText(authorval));
break;
}
}
}
- else if (!mir_tstrcmpi(szItemName, L"comments")) {
+ else if (!mir_wstrcmpi(szItemName, L"comments")) {
LPCTSTR szItemText = xmlGetText(itemval);
if (szItemText)
ClearText(comments, szItemText);
}
- else if (!mir_tstrcmpi(szItemName, L"id")) {
+ else if (!mir_wstrcmpi(szItemName, L"id")) {
LPCTSTR szItemText = xmlGetText(itemval);
if (szItemText)
ClearText(guid, xmlGetText(itemval));
}
- else if (!mir_tstrcmpi(szItemName, L"category")) {
+ else if (!mir_wstrcmpi(szItemName, L"category")) {
for (int x = 0; x < xmlGetAttrCount(itemval); x++) {
LPCTSTR szAttrName = xmlGetAttrName(itemval, x);
- if (!mir_tstrcmpi(szAttrName, L"term") && xmlGetText(itemval)) {
+ if (!mir_wstrcmpi(szAttrName, L"term") && xmlGetText(itemval)) {
ClearText(category, xmlGetAttrValue(itemval, szAttrName));
break;
}
@@ -598,9 +598,9 @@ void CheckCurrentFeedAvatar(MCONTACT hContact) if (szData == NULL)
return;
- wchar_t *tszData = mir_utf8decodeT(szData);
+ wchar_t *tszData = mir_utf8decodeW(szData);
if (!tszData)
- tszData = mir_a2t(szData);
+ tszData = mir_a2u(szData);
int bytesParsed = 0;
HXML hXml = xmlParseString(tszData, &bytesParsed, NULL);
mir_free(tszData);
@@ -612,14 +612,14 @@ void CheckCurrentFeedAvatar(MCONTACT hContact) HXML node = xmlGetChild(hXml, childcount);
while (node) {
LPCTSTR szNodeName = xmlGetName(node);
- if (!mir_tstrcmpi(szNodeName, L"rss") || !mir_tstrcmpi(szNodeName, L"rdf")) {
+ if (!mir_wstrcmpi(szNodeName, L"rss") || !mir_wstrcmpi(szNodeName, L"rdf")) {
HXML chan = xmlGetChild(node, 0);
for (int j = 0; j < xmlGetChildCount(chan); j++) {
HXML child = xmlGetChild(chan, j);
- if (!mir_tstrcmpi(xmlGetName(child), L"image")) {
+ if (!mir_wstrcmpi(xmlGetName(child), L"image")) {
for (int x = 0; x < xmlGetChildCount(child); x++) {
HXML imageval = xmlGetChild(child, x);
- if (!mir_tstrcmpi(xmlGetName(imageval), L"url")) {
+ if (!mir_wstrcmpi(xmlGetName(imageval), L"url")) {
LPCTSTR url = xmlGetText(imageval);
db_set_ts(hContact, MODULE, "ImageURL", url);
@@ -632,7 +632,7 @@ void CheckCurrentFeedAvatar(MCONTACT hContact) ai.format = ProtoGetAvatarFormat(ext);
wchar_t *filename = szNick;
- mir_sntprintf(ai.filename, L"%s\\%s.%s", tszRoot, filename, ext);
+ mir_snwprintf(ai.filename, L"%s\\%s.%s", tszRoot, filename, ext);
if (DownloadFile(url, ai.filename)) {
db_set_ts(hContact, MODULE, "ImagePath", ai.filename);
ProtoBroadcastAck(MODULE, hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, NULL);
@@ -646,17 +646,17 @@ void CheckCurrentFeedAvatar(MCONTACT hContact) }
}
}
- else if (!mir_tstrcmpi(szNodeName, L"feed")) {
+ else if (!mir_wstrcmpi(szNodeName, L"feed")) {
for (int j = 0; j < xmlGetChildCount(node); j++) {
HXML child = xmlGetChild(node, j);
- if (!mir_tstrcmpi(xmlGetName(child), L"icon")) {
+ if (!mir_wstrcmpi(xmlGetName(child), L"icon")) {
for (int x = 0; x < xmlGetChildCount(child); x++) {
HXML imageval = xmlGetChild(child, x);
- if (!mir_tstrcmpi(xmlGetName(imageval), L"url")) {
+ if (!mir_wstrcmpi(xmlGetName(imageval), L"url")) {
LPCTSTR url = xmlGetText(imageval);
db_set_ts(hContact, MODULE, "ImageURL", url);
- ptrT szNick(db_get_tsa(hContact, MODULE, "Nick"));
+ ptrW szNick(db_get_tsa(hContact, MODULE, "Nick"));
if (szNick) {
PROTO_AVATAR_INFORMATION ai = { 0 };
ai.hContact = hContact;
@@ -665,7 +665,7 @@ void CheckCurrentFeedAvatar(MCONTACT hContact) ai.format = ProtoGetAvatarFormat(ext);
wchar_t *filename = szNick;
- mir_sntprintf(ai.filename, L"%s\\%s.%s", tszRoot, filename, ext);
+ mir_snwprintf(ai.filename, L"%s\\%s.%s", tszRoot, filename, ext);
if (DownloadFile(url, ai.filename)) {
db_set_ts(hContact, MODULE, "ImagePath", ai.filename);
ProtoBroadcastAck(MODULE, hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, NULL);
diff --git a/plugins/NewsAggregator/Src/ExportImport.cpp b/plugins/NewsAggregator/Src/ExportImport.cpp index 0943dcd303..e1a5b18e85 100644 --- a/plugins/NewsAggregator/Src/ExportImport.cpp +++ b/plugins/NewsAggregator/Src/ExportImport.cpp @@ -68,7 +68,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM node = xmlGetNextNode(node);
if (node)
break;
- } while (mir_tstrcmpi(xmlGetName(node), L"body"));
+ } while (mir_wstrcmpi(xmlGetName(node), L"body"));
}
}
else if (!xmlUrl && outlineChildsCount)
@@ -77,8 +77,8 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM wchar_t *text = NULL, *url = NULL, *siteurl = NULL, *group = NULL;
BYTE NeedToImport = FALSE;
for (int i = 0; i < outlineAttr; i++) {
- if (!mir_tstrcmpi(xmlGetAttrName(node, i), L"text")) {
- text = mir_utf8decodeT(_T2A(xmlGetAttrValue(node, xmlGetAttrName(node, i))));
+ if (!mir_wstrcmpi(xmlGetAttrName(node, i), L"text")) {
+ text = mir_utf8decodeW(_T2A(xmlGetAttrValue(node, xmlGetAttrName(node, i))));
if (!text) {
isTextUTF = 0;
text = (wchar_t *)xmlGetAttrValue(node, xmlGetAttrName(node, i));
@@ -88,15 +88,15 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM for (int j = 0; j < count; j++) {
wchar_t item[MAX_PATH];
SendMessage(FeedsImportList, LB_GETTEXT, (WPARAM)j, (LPARAM)item);
- if (!mir_tstrcmpi(item, text)) {
+ if (!mir_wstrcmpi(item, text)) {
NeedToImport = TRUE;
break;
}
}
continue;
}
- if (!mir_tstrcmpi(xmlGetAttrName(node, i), L"xmlUrl")) {
- url = mir_utf8decodeT(_T2A(xmlGetAttrValue(node, xmlGetAttrName(node, i))));
+ if (!mir_wstrcmpi(xmlGetAttrName(node, i), L"xmlUrl")) {
+ url = mir_utf8decodeW(_T2A(xmlGetAttrValue(node, xmlGetAttrName(node, i))));
if ( !url) {
isURLUTF = false;
url = (wchar_t *)xmlGetAttrValue(node, xmlGetAttrName(node, i));
@@ -108,8 +108,8 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM }
continue;
}
- if (!mir_tstrcmpi(xmlGetAttrName(node, i), L"htmlUrl")) {
- siteurl = mir_utf8decodeT(_T2A(xmlGetAttrValue(node, xmlGetAttrName(node, i))));
+ if (!mir_wstrcmpi(xmlGetAttrName(node, i), L"htmlUrl")) {
+ siteurl = mir_utf8decodeW(_T2A(xmlGetAttrValue(node, xmlGetAttrName(node, i))));
if ( !siteurl) {
isSiteURLUTF = false;
siteurl = (wchar_t *)xmlGetAttrValue(node, xmlGetAttrName(node, i));
@@ -124,13 +124,13 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (NeedToImport) {
HXML parent = xmlGetParent(node);
wchar_t tmpgroup[1024];
- while (mir_tstrcmpi(xmlGetName(parent), L"body")) {
+ while (mir_wstrcmpi(xmlGetName(parent), L"body")) {
for (int i = 0; i < xmlGetAttrCount(parent); i++) {
- if (!mir_tstrcmpi(xmlGetAttrName(parent, i), L"text")) {
+ if (!mir_wstrcmpi(xmlGetAttrName(parent, i), L"text")) {
if ( !group)
group = (wchar_t *)xmlGetAttrValue(parent, xmlGetAttrName(parent, i));
else {
- mir_sntprintf(tmpgroup, L"%s\\%s", xmlGetAttrValue(parent, xmlGetAttrName(parent, i)), group);
+ mir_snwprintf(tmpgroup, L"%s\\%s", xmlGetAttrValue(parent, xmlGetAttrName(parent, i)), group);
group = tmpgroup;
}
break;
@@ -141,7 +141,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM wchar_t *ptszGroup = NULL;
if (group) {
- ptszGroup = mir_utf8decodeT(_T2A(group));
+ ptszGroup = mir_utf8decodeW(_T2A(group));
if ( !ptszGroup) {
isGroupUTF = false;
ptszGroup = group;
@@ -183,7 +183,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (node)
break;
}
- while (mir_tstrcmpi(xmlGetName(tmpnode), L"body"));
+ while (mir_wstrcmpi(xmlGetName(tmpnode), L"body"));
}
}
}
@@ -195,9 +195,9 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM }
wchar_t mes[MAX_PATH];
if (DUPES)
- mir_sntprintf(mes, TranslateT("Imported %d feed(s)\r\nNot imported %d duplicate(s)."), count - DUPES, DUPES);
+ mir_snwprintf(mes, TranslateT("Imported %d feed(s)\r\nNot imported %d duplicate(s)."), count - DUPES, DUPES);
else
- mir_sntprintf(mes, TranslateT("Imported %d feed(s)."), count);
+ mir_snwprintf(mes, TranslateT("Imported %d feed(s)."), count);
MessageBox(hwndDlg, mes, TranslateT("News Aggregator"), MB_OK | MB_ICONINFORMATION);
}
}
@@ -214,7 +214,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM OPENFILENAME ofn = {0};
ofn.lStructSize = sizeof(ofn);
wchar_t tmp[MAX_PATH];
- mir_sntprintf(tmp, L"%s (*.opml, *.xml)%c*.opml;*.xml%c%c", TranslateT("OPML files"), 0, 0, 0);
+ mir_snwprintf(tmp, L"%s (*.opml, *.xml)%c*.opml;*.xml%c%c", TranslateT("OPML files"), 0, 0, 0);
ofn.lpstrFilter = tmp;
ofn.hwndOwner = 0;
ofn.lpstrFile = FileName;
@@ -248,15 +248,15 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM node = xmlGetNextNode(node);
if (node)
break;
- } while (mir_tstrcmpi(xmlGetName(node), L"body"));
+ } while (mir_wstrcmpi(xmlGetName(node), L"body"));
}
}
else if (!xmlUrl && outlineChildsCount)
node = xmlGetFirstChild(node);
else if (xmlUrl) {
for (int i = 0; i < outlineAttr; i++) {
- if (!mir_tstrcmpi(xmlGetAttrName(node, i), L"text")) {
- wchar_t *text = mir_utf8decodeT(_T2A(xmlGetAttrValue(node, xmlGetAttrName(node, i))));
+ if (!mir_wstrcmpi(xmlGetAttrName(node, i), L"text")) {
+ wchar_t *text = mir_utf8decodeW(_T2A(xmlGetAttrValue(node, xmlGetAttrName(node, i))));
bool isTextUTF;
if (!text) {
isTextUTF = false;
@@ -282,7 +282,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM node = xmlGetNextNode(node);
if (node)
break;
- } while (mir_tstrcmpi(xmlGetName(tmpnode), L"body"));
+ } while (mir_wstrcmpi(xmlGetName(tmpnode), L"body"));
}
}
}
@@ -477,7 +477,7 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM OPENFILENAME ofn = {0};
ofn.lStructSize = sizeof(ofn);
wchar_t tmp[MAX_PATH];
- mir_sntprintf(tmp, L"%s (*.opml)%c*.opml%c%c", TranslateT("OPML files"), 0, 0, 0);
+ mir_snwprintf(tmp, L"%s (*.opml)%c*.opml%c%c", TranslateT("OPML files"), 0, 0, 0);
ofn.lpstrFilter = tmp;
ofn.hwndOwner = 0;
ofn.lpstrFile = FileName;
diff --git a/plugins/NewsAggregator/Src/Options.cpp b/plugins/NewsAggregator/Src/Options.cpp index e27cd761d9..fb3deb5320 100644 --- a/plugins/NewsAggregator/Src/Options.cpp +++ b/plugins/NewsAggregator/Src/Options.cpp @@ -44,7 +44,7 @@ INT_PTR CALLBACK DlgProcAddFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA MessageBox(hwndDlg, TranslateT("Enter Feed name"), TranslateT("Error"), MB_OK);
break;
}
- if (!GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str)) || mir_tstrcmp(str, L"http://") == 0) {
+ if (!GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str)) || mir_wstrcmp(str, L"http://") == 0) {
MessageBox(hwndDlg, TranslateT("Enter Feed URL"), TranslateT("Error"), MB_OK);
break;
}
@@ -95,7 +95,7 @@ INT_PTR CALLBACK DlgProcAddFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case IDC_TAGHELP:
wchar_t tszTagHelp[1024];
- mir_sntprintf(tszTagHelp, L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s",
+ mir_snwprintf(tszTagHelp, L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s",
L"#<title>#", TranslateT("The title of the item."),
L"#<description>#", TranslateT("The item synopsis."),
L"#<link>#", TranslateT("The URL of the item."),
@@ -116,7 +116,7 @@ INT_PTR CALLBACK DlgProcAddFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SetDlgItemText(hwndDlg, IDC_DISCOVERY, TranslateT("Wait..."));
wchar_t tszURL[MAX_PATH] = { 0 };
wchar_t *tszTitle = NULL;
- if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, _countof(tszURL)) || mir_tstrcmp(tszURL, L"http://") != 0)
+ if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, _countof(tszURL)) || mir_wstrcmp(tszURL, L"http://") != 0)
tszTitle = (wchar_t*)CheckFeed(tszURL, hwndDlg);
else
MessageBox(hwndDlg, TranslateT("Enter Feed URL"), TranslateT("Error"), MB_OK);
@@ -152,12 +152,12 @@ INT_PTR CALLBACK DlgProcChangeFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage(hwndDlg, IDC_TIMEOUT_VALUE_SPIN, UDM_SETRANGE32, 0, 999);
for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) {
- ptrT dbNick(db_get_tsa(hContact, MODULE, "Nick"));
- if ((dbNick == NULL) || (mir_tstrcmp(dbNick, SelItem.nick) != 0))
+ ptrW dbNick(db_get_tsa(hContact, MODULE, "Nick"));
+ if ((dbNick == NULL) || (mir_wstrcmp(dbNick, SelItem.nick) != 0))
continue;
- ptrT dbURL(db_get_tsa(hContact, MODULE, "URL"));
- if ((dbURL == NULL) || (mir_tstrcmp(dbURL, SelItem.url) != 0))
+ ptrW dbURL(db_get_tsa(hContact, MODULE, "URL"));
+ if ((dbURL == NULL) || (mir_wstrcmp(dbURL, SelItem.url) != 0))
continue;
ItemInfo *nSelItem = new ItemInfo(SelItem);
@@ -203,7 +203,7 @@ INT_PTR CALLBACK DlgProcChangeFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP MessageBox(hwndDlg, TranslateT("Enter Feed name"), TranslateT("Error"), MB_OK);
break;
}
- if (!GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str)) || mir_tstrcmp(str, L"http://") == 0) {
+ if (!GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str)) || mir_wstrcmp(str, L"http://") == 0) {
MessageBox(hwndDlg, TranslateT("Enter Feed URL"), TranslateT("Error"), MB_OK);
break;
}
@@ -255,7 +255,7 @@ INT_PTR CALLBACK DlgProcChangeFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_TAGHELP:
wchar_t tszTagHelp[1024];
- mir_sntprintf(tszTagHelp, L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s",
+ mir_snwprintf(tszTagHelp, L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s",
L"#<title>#", TranslateT("The title of the item."),
L"#<description>#", TranslateT("The item synopsis."),
L"#<link>#", TranslateT("The URL of the item."),
@@ -273,7 +273,7 @@ INT_PTR CALLBACK DlgProcChangeFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_DISCOVERY:
wchar_t tszURL[MAX_PATH] = { 0 };
- if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, _countof(tszURL)) || mir_tstrcmp(tszURL, L"http://") != 0) {
+ if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, _countof(tszURL)) || mir_wstrcmp(tszURL, L"http://") != 0) {
EnableWindow(GetDlgItem(hwndDlg, IDC_DISCOVERY), FALSE);
SetDlgItemText(hwndDlg, IDC_DISCOVERY, TranslateT("Wait..."));
wchar_t *tszTitle = (wchar_t*)CheckFeed(tszURL, hwndDlg);
@@ -361,7 +361,7 @@ INT_PTR CALLBACK DlgProcChangeFeedMenu(HWND hwndDlg, UINT msg, WPARAM wParam, LP MessageBox(hwndDlg, TranslateT("Enter Feed name"), TranslateT("Error"), MB_OK);
break;
}
- if (!GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str)) || mir_tstrcmp(str, L"http://") == 0) {
+ if (!GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str)) || mir_wstrcmp(str, L"http://") == 0) {
MessageBox(hwndDlg, TranslateT("Enter Feed URL"), TranslateT("Error"), MB_OK);
break;
}
@@ -411,7 +411,7 @@ INT_PTR CALLBACK DlgProcChangeFeedMenu(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_TAGHELP:
wchar_t tszTagHelp[1024];
- mir_sntprintf(tszTagHelp, L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s",
+ mir_snwprintf(tszTagHelp, L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s",
L"#<title>#", TranslateT("The title of the item."),
L"#<description>#", TranslateT("The item synopsis."),
L"#<link>#", TranslateT("The URL of the item."),
@@ -429,7 +429,7 @@ INT_PTR CALLBACK DlgProcChangeFeedMenu(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_DISCOVERY:
wchar_t tszURL[MAX_PATH] = { 0 };
- if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, _countof(tszURL)) || mir_tstrcmp(tszURL, L"http://") != 0) {
+ if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, _countof(tszURL)) || mir_wstrcmp(tszURL, L"http://") != 0) {
EnableWindow(GetDlgItem(hwndDlg, IDC_DISCOVERY), FALSE);
SetDlgItemText(hwndDlg, IDC_DISCOVERY, TranslateT("Wait..."));
wchar_t *tszTitle = (wchar_t*)CheckFeed(tszURL, hwndDlg);
@@ -498,16 +498,16 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA ListView_GetItemText(hwndList, sel, 1, url, _countof(url));
for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) {
- ptrT dbNick(db_get_tsa(hContact, MODULE, "Nick"));
+ ptrW dbNick(db_get_tsa(hContact, MODULE, "Nick"));
if (dbNick == NULL)
break;
- if (mir_tstrcmp(dbNick, nick))
+ if (mir_wstrcmp(dbNick, nick))
continue;
- ptrT dbURL(db_get_tsa(hContact, MODULE, "URL"));
+ ptrW dbURL(db_get_tsa(hContact, MODULE, "URL"));
if (dbURL == NULL)
break;
- if (mir_tstrcmp(dbURL, url))
+ if (mir_wstrcmp(dbURL, url))
continue;
CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
diff --git a/plugins/NewsAggregator/Src/Services.cpp b/plugins/NewsAggregator/Src/Services.cpp index d3cdfb6839..6b613a231d 100644 --- a/plugins/NewsAggregator/Src/Services.cpp +++ b/plugins/NewsAggregator/Src/Services.cpp @@ -40,7 +40,7 @@ int NewsAggrInit(WPARAM, LPARAM) if (hNewsAggregatorFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), LPGEN("News Aggregator"), MIRANDA_USERDATAT L"\\Avatars\\" _A2W(DEFAULT_AVATARS_FOLDER)))
FoldersGetCustomPathT(hNewsAggregatorFolder, tszRoot, MAX_PATH, L"");
else
- mir_tstrncpy(tszRoot, VARST(L"%miranda_userdata%\\Avatars\\" _A2W(DEFAULT_AVATARS_FOLDER)), _countof(tszRoot));
+ mir_wstrncpy(tszRoot, VARST(L"%miranda_userdata%\\Avatars\\" _A2W(DEFAULT_AVATARS_FOLDER)), _countof(tszRoot));
for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) {
if (!db_get_b(NULL, MODULE, "StartupRetrieve", 1))
diff --git a/plugins/NewsAggregator/Src/Utils.cpp b/plugins/NewsAggregator/Src/Utils.cpp index 6a7558ba34..8c6ba7e73b 100644 --- a/plugins/NewsAggregator/Src/Utils.cpp +++ b/plugins/NewsAggregator/Src/Utils.cpp @@ -54,7 +54,7 @@ void GetNewsData(wchar_t *tszUrl, char **szData, MCONTACT hContact, HWND hwndDlg nlhr.flags = NLHRF_DUMPASTEXT | NLHRF_HTTP11 | NLHRF_REDIRECT;
if (wcsstr(tszUrl, L"https://") != NULL)
nlhr.flags |= NLHRF_SSL;
- char *szUrl = mir_t2a(tszUrl);
+ char *szUrl = mir_u2a(tszUrl);
nlhr.szUrl = szUrl;
nlhr.nlc = hNetlibHttp;
@@ -197,52 +197,52 @@ time_t __stdcall DateToUnixTime(const wchar_t *stamp, bool FeedType) weekday = wcstok(p, L",");
p = wcstok(NULL, L",");
swscanf(p + 1, L"%d %3s %d %d:%d:%d %1s%02d%02d", &day, &monthstr, &year, &hour, &min, &sec, &timezonesign, &timezoneh, &timezonem);
- if (!mir_tstrcmpi(monthstr, L"Jan"))
+ if (!mir_wstrcmpi(monthstr, L"Jan"))
month = 1;
- if (!mir_tstrcmpi(monthstr, L"Feb"))
+ if (!mir_wstrcmpi(monthstr, L"Feb"))
month = 2;
- if (!mir_tstrcmpi(monthstr, L"Mar"))
+ if (!mir_wstrcmpi(monthstr, L"Mar"))
month = 3;
- if (!mir_tstrcmpi(monthstr, L"Apr"))
+ if (!mir_wstrcmpi(monthstr, L"Apr"))
month = 4;
- if (!mir_tstrcmpi(monthstr, L"May"))
+ if (!mir_wstrcmpi(monthstr, L"May"))
month = 5;
- if (!mir_tstrcmpi(monthstr, L"Jun"))
+ if (!mir_wstrcmpi(monthstr, L"Jun"))
month = 6;
- if (!mir_tstrcmpi(monthstr, L"Jul"))
+ if (!mir_wstrcmpi(monthstr, L"Jul"))
month = 7;
- if (!mir_tstrcmpi(monthstr, L"Aug"))
+ if (!mir_wstrcmpi(monthstr, L"Aug"))
month = 8;
- if (!mir_tstrcmpi(monthstr, L"Sep"))
+ if (!mir_wstrcmpi(monthstr, L"Sep"))
month = 9;
- if (!mir_tstrcmpi(monthstr, L"Oct"))
+ if (!mir_wstrcmpi(monthstr, L"Oct"))
month = 10;
- if (!mir_tstrcmpi(monthstr, L"Nov"))
+ if (!mir_wstrcmpi(monthstr, L"Nov"))
month = 11;
- if (!mir_tstrcmpi(monthstr, L"Dec"))
+ if (!mir_wstrcmpi(monthstr, L"Dec"))
month = 12;
if (year < 2000)
year += 2000;
- if (!mir_tstrcmp(timezonesign, L"+"))
- mir_sntprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, L"%04d%02d%02dT%02d:%02d:%02d", year, month, day, hour - timezoneh, min - timezonem, sec);
- else if (!mir_tstrcmp(timezonesign, L"-"))
- mir_sntprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, L"%04d%02d%02dT%02d:%02d:%02d", year, month, day, hour + timezoneh, min + timezonem, sec);
+ if (!mir_wstrcmp(timezonesign, L"+"))
+ mir_snwprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, L"%04d%02d%02dT%02d:%02d:%02d", year, month, day, hour - timezoneh, min - timezonem, sec);
+ else if (!mir_wstrcmp(timezonesign, L"-"))
+ mir_snwprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, L"%04d%02d%02dT%02d:%02d:%02d", year, month, day, hour + timezoneh, min + timezonem, sec);
else
- mir_sntprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, L"%04d%02d%02dT%02d:%02d:%02d", year, month, day, hour, min, sec);
+ mir_snwprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, L"%04d%02d%02dT%02d:%02d:%02d", year, month, day, hour, min, sec);
}
else if (wcsstr(p, L"T")) {
swscanf(p, L"%d-%d-%dT%d:%d:%d", &year, &month, &day, &hour, &min, &sec);
- mir_sntprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, L"%04d%02d%02dT%02d:%02d:%02d", year, month, day, hour, min, sec);
+ mir_snwprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, L"%04d%02d%02dT%02d:%02d:%02d", year, month, day, hour, min, sec);
}
else
{
swscanf(p, L"%d-%d-%d %d:%d:%d %1s%02d%02d", &year, &month, &day, &hour, &min, &sec, &timezonesign, &timezoneh, &timezonem);
- if (!mir_tstrcmp(timezonesign, L"+"))
- mir_sntprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, L"%04d%02d%02dT%02d:%02d:%02d", year, month, day, hour - timezoneh, min - timezonem, sec);
- else if (!mir_tstrcmp(timezonesign, L"-"))
- mir_sntprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, L"%04d%02d%02dT%02d:%02d:%02d", year, month, day, hour + timezoneh, min + timezonem, sec);
+ if (!mir_wstrcmp(timezonesign, L"+"))
+ mir_snwprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, L"%04d%02d%02dT%02d:%02d:%02d", year, month, day, hour - timezoneh, min - timezonem, sec);
+ else if (!mir_wstrcmp(timezonesign, L"-"))
+ mir_snwprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, L"%04d%02d%02dT%02d:%02d:%02d", year, month, day, hour + timezoneh, min + timezonem, sec);
else
- mir_sntprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, L"%04d%02d%02dT%02d:%02d:%02d", year, month, day, hour, min, sec);
+ mir_snwprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, L"%04d%02d%02dT%02d:%02d:%02d", year, month, day, hour, min, sec);
}
}
// Get the date part
@@ -290,7 +290,7 @@ bool DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal) nlhr.cbSize = sizeof(nlhr);
nlhr.requestType = REQUEST_GET;
nlhr.flags = NLHRF_DUMPASTEXT | NLHRF_HTTP11;
- char *szUrl = mir_t2a(tszURL);
+ char *szUrl = mir_u2a(tszURL);
nlhr.szUrl = szUrl;
NETLIBHTTPHEADER headers[4];
nlhr.headersCount = 4;
@@ -320,8 +320,8 @@ bool DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal) }
}
if (date != NULL && size != NULL) {
- wchar_t *tdate = mir_a2t(date);
- wchar_t *tsize = mir_a2t(size);
+ wchar_t *tdate = mir_a2u(date);
+ wchar_t *tsize = mir_a2u(size);
struct _stat buf;
int fh = _wopen(tszLocal, _O_RDONLY);
@@ -471,7 +471,7 @@ MCONTACT GetContactByNick(const wchar_t *nick) for (hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) {
ptrW contactNick(::db_get_wsa(hContact, MODULE, "Nick"));
- if (!mir_tstrcmpi(contactNick, nick))
+ if (!mir_wstrcmpi(contactNick, nick))
break;
}
return hContact;
@@ -483,7 +483,7 @@ MCONTACT GetContactByURL(const wchar_t *url) for (hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) {
ptrW contactURL(::db_get_wsa(hContact, MODULE, "URL"));
- if (!mir_tstrcmpi(contactURL, url))
+ if (!mir_wstrcmpi(contactURL, url))
break;
}
return hContact;
diff --git a/plugins/Non-IM Contact/src/contactinfo.cpp b/plugins/Non-IM Contact/src/contactinfo.cpp index 07bd984377..530463def5 100644 --- a/plugins/Non-IM Contact/src/contactinfo.cpp +++ b/plugins/Non-IM Contact/src/contactinfo.cpp @@ -86,7 +86,7 @@ int BrowseForFolder(HWND hwnd, char *szPath) LPMALLOC pMalloc;
if (SUCCEEDED(CoGetMalloc(1, &pMalloc))) {
- ptrT tszPath(mir_a2t(szPath));
+ ptrW tszPath(mir_a2u(szPath));
BROWSEINFO bi = { 0 };
bi.hwndOwner = hwnd;
bi.pszDisplayName = tszPath;
@@ -159,7 +159,7 @@ INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP if (!db_get_w(NULL, MODNAME, "Timer", 1))
SetDlgItemText(hwnd, IDC_TIMER_INTERVAL_MSG, TranslateT("Non-IM Contact protocol timer is Disabled"));
else {
- mir_sntprintf(string, TranslateT("Timer intervals... Non-IM Contact Protocol timer is %d seconds"), db_get_w(NULL, MODNAME, "Timer", 1));
+ mir_snwprintf(string, TranslateT("Timer intervals... Non-IM Contact Protocol timer is %d seconds"), db_get_w(NULL, MODNAME, "Timer", 1));
SetDlgItemText(hwnd, IDC_TIMER_INTERVAL_MSG, string);
}
}
diff --git a/plugins/NotesAndReminders/src/notes.cpp b/plugins/NotesAndReminders/src/notes.cpp index 706e245013..dc506b5420 100644 --- a/plugins/NotesAndReminders/src/notes.cpp +++ b/plugins/NotesAndReminders/src/notes.cpp @@ -185,7 +185,7 @@ static void InitStickyNoteLogFont(STICKYNOTEFONT *pCustomFont, LOGFONT *lf) lf->lfHeight = pCustomFont->size; } - mir_tstrcpy(lf->lfFaceName, pCustomFont->szFace); + mir_strcpy(lf->lfFaceName, pCustomFont->szFace); lf->lfWidth = lf->lfEscapement = lf->lfOrientation = 0; lf->lfWeight = pCustomFont->style & DBFONTF_BOLD ? FW_BOLD : FW_NORMAL; @@ -518,7 +518,7 @@ void LoadNotes(BOOL bIsStartup) pCustomFont->size = (char)fsize; pCustomFont->style = (BYTE)fstyle; pCustomFont->charset = (BYTE)fcharset; - mir_tstrcpy(pCustomFont->szFace, TVal2); + mir_strcpy(pCustomFont->szFace, TVal2); pCustomFont->hFont = NULL; if ( !CreateStickyNoteFont(pCustomFont, NULL) ) @@ -989,7 +989,7 @@ static int FindMenuItem(HMENU h, LPTSTR lpszName) { if ( GetMenuString(h, i, s, 128, MF_BYPOSITION) ) { - if ( !mir_tstrcmp(s, lpszName) ) + if ( !mir_strcmp(s, lpszName) ) { return (int)i; } @@ -1042,7 +1042,7 @@ static void MeasureColorPresetMenuItem(HWND hdlg, LPMEASUREITEMSTRUCT lpMeasureI HDC hdc = GetDC(hdlg); LPSTR lpsz = TranslateTS(clrPresets->szName); SIZE sz; - GetTextExtentPoint32(hdc, lpsz, (int)mir_tstrlen(lpsz), &sz); + GetTextExtentPoint32(hdc, lpsz, (int)mir_strlen(lpsz), &sz); ReleaseDC(hdlg, hdc); lpMeasureItem->itemWidth = 50 + sz.cx; @@ -1558,7 +1558,7 @@ INT_PTR CALLBACK StickyNoteWndProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM l SN->pCustomFont->size = (char)lf.lfHeight; SN->pCustomFont->style = (lf.lfWeight >= FW_BOLD ? DBFONTF_BOLD : 0) | (lf.lfItalic ? DBFONTF_ITALIC : 0) | (lf.lfUnderline ? DBFONTF_UNDERLINE : 0) | (lf.lfStrikeOut ? DBFONTF_STRIKEOUT : 0); SN->pCustomFont->charset = lf.lfCharSet; - mir_tstrcpy(SN->pCustomFont->szFace, lf.lfFaceName); + mir_strcpy(SN->pCustomFont->szFace, lf.lfFaceName); if ( !CreateStickyNoteFont(SN->pCustomFont, &lf) ) { diff --git a/plugins/NotifyAnything/src/main.cpp b/plugins/NotifyAnything/src/main.cpp index 616d95f8e9..88e4b16fbf 100644 --- a/plugins/NotifyAnything/src/main.cpp +++ b/plugins/NotifyAnything/src/main.cpp @@ -982,7 +982,7 @@ extern "C" int __declspec(dllexport) Load() mir_getLP(&pluginInfo);
wchar_t buf[MAX_PATH + 1];
- mir_tstrcpy(buf, L".");
+ mir_wstrcpy(buf, L".");
g_mirandaDir = _wgetcwd(buf, MAX_PATH);
registerSound(L"Notice");
diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp index c474591f69..d87d37e373 100644 --- a/plugins/Nudge/src/main.cpp +++ b/plugins/Nudge/src/main.cpp @@ -51,7 +51,7 @@ INT_PTR NudgeSend(WPARAM hContact, LPARAM lParam) int diff = time(NULL) - db_get_dw(hContact, "Nudge", "LastSent", time(NULL) - 30);
if (diff < GlobalNudge.sendTimeSec) {
wchar_t msg[500];
- mir_sntprintf(msg, TranslateT("You are not allowed to send too much nudge (only 1 each %d sec, %d sec left)"), GlobalNudge.sendTimeSec, 30 - diff);
+ mir_snwprintf(msg, TranslateT("You are not allowed to send too much nudge (only 1 each %d sec, %d sec left)"), GlobalNudge.sendTimeSec, 30 - diff);
if (GlobalNudge.useByProtocol) {
for (int i = 0; i < arNudges.getCount(); i++) {
CNudgeElement &p = arNudges[i];
@@ -523,7 +523,7 @@ void Nudge_AddAccount(PROTOACCOUNT *proto) p->hEvent = hevent;
wchar_t soundDesc[MAXMODULELABELLENGTH + 10];
- mir_sntprintf(soundDesc, LPGENW("Nudge for %s"), proto->tszAccountName);
+ mir_snwprintf(soundDesc, LPGENW("Nudge for %s"), proto->tszAccountName);
SkinAddNewSoundExT(p->NudgeSoundname, LPGENW("Nudge"), soundDesc);
arNudges.insert(p);
diff --git a/plugins/Nudge/src/options.cpp b/plugins/Nudge/src/options.cpp index 57dcaf9c0a..5954fdfdc9 100644 --- a/plugins/Nudge/src/options.cpp +++ b/plugins/Nudge/src/options.cpp @@ -94,14 +94,14 @@ static INT_PTR CALLBACK DlgProcShakeOpt(HWND hwnd,UINT msg,WPARAM wParam,LPARAM TranslateDialogDefault(hwnd);
{
wchar_t szBuf[20];
- mir_sntprintf(szBuf, L"%d", shake.nMoveClist);
+ mir_snwprintf(szBuf, L"%d", shake.nMoveClist);
SetDlgItemText(hwnd, IDC_LNUMBER_CLIST, szBuf);
- mir_sntprintf(szBuf, L"%d", shake.nMoveChat);
+ mir_snwprintf(szBuf, L"%d", shake.nMoveChat);
SetDlgItemText(hwnd, IDC_LNUMBER_CHAT, szBuf);
- mir_sntprintf(szBuf, L"%d", shake.nScaleClist);
+ mir_snwprintf(szBuf, L"%d", shake.nScaleClist);
SetDlgItemText(hwnd, IDC_LSCALE_CLIST, szBuf);
- mir_sntprintf(szBuf, L"%d", shake.nScaleChat);
+ mir_snwprintf(szBuf, L"%d", shake.nScaleChat);
SetDlgItemText(hwnd, IDC_LSCALE_CHAT, szBuf);
}
@@ -132,7 +132,7 @@ static INT_PTR CALLBACK DlgProcShakeOpt(HWND hwnd,UINT msg,WPARAM wParam,LPARAM {
wchar_t szBuf[20];
DWORD dwPos = SendMessage((HWND)lParam, TBM_GETPOS, 0, 0);
- mir_sntprintf(szBuf, L"%d", dwPos);
+ mir_snwprintf(szBuf, L"%d", dwPos);
if ((HWND)lParam == GetDlgItem(hwnd, IDC_SNUMBER_CLIST))
SetDlgItemText(hwnd, IDC_LNUMBER_CLIST, szBuf);
if ((HWND)lParam == GetDlgItem(hwnd, IDC_SNUMBER_CHAT))
diff --git a/plugins/PackUpdater/Src/Notifications.cpp b/plugins/PackUpdater/Src/Notifications.cpp index b22066e480..9670d9e905 100644 --- a/plugins/PackUpdater/Src/Notifications.cpp +++ b/plugins/PackUpdater/Src/Notifications.cpp @@ -115,8 +115,8 @@ void show_popup(HWND hDlg, LPCTSTR pszTitle, LPCTSTR pszText, int iNumber, int A pd.cbSize = sizeof(pd);
pd.lchContact = NULL; //(HANDLE)wParam;
pd.lchIcon = Skin_LoadIcon(PopupsList[iNumber].Icon);
- mir_tstrncpy(pd.lptzText, pszText, _countof(pd.lptzText));
- mir_tstrncpy(pd.lptzContactName, pszTitle, _countof(pd.lptzContactName));
+ mir_wstrncpy(pd.lptzText, pszText, _countof(pd.lptzText));
+ mir_wstrncpy(pd.lptzContactName, pszTitle, _countof(pd.lptzContactName));
switch (MyOptions.DefColors) {
case byCOLOR_WINDOWS:
pd.colorBack = GetSysColor(COLOR_BTNFACE);
@@ -179,7 +179,7 @@ static void __stdcall CreateDownloadDialog(void*) if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups3", DEFAULT_POPUP_ENABLED))
hDlgDld = CreateDialog(hInst, MAKEINTRESOURCE(IDD_POPUPDUMMI), NULL, DlgDownloadPop);
else if (db_get_b(NULL, MODNAME, "Popups3M", DEFAULT_MESSAGE_ENABLED)) {
- mir_tstrncpy(tszDialogMsg, Text, _countof(tszDialogMsg));
+ mir_wstrncpy(tszDialogMsg, Text, _countof(tszDialogMsg));
hDlgDld = CreateDialog(hInst, MAKEINTRESOURCE(IDD_DOWNLOAD), NULL, DlgDownload);
}
}
@@ -307,7 +307,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam EnableWindow(hwOk, enableOk ? TRUE : FALSE);
}
if (nmlv->uNewState & LVIS_SELECTED) {
- if (mir_tstrcmp(todo[lvI.iItem].tszInfoURL, L""))
+ if (mir_wstrcmp(todo[lvI.iItem].tszInfoURL, L""))
EnableWindow(GetDlgItem(hDlg, IDC_INFO), TRUE);
else
EnableWindow(GetDlgItem(hDlg, IDC_INFO), FALSE);
@@ -349,38 +349,38 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam if (todo[i].enabled) {
switch (todo[i].FileType) {
case 1:
- mir_sntprintf(tszFileDest, L"%s\\Pack", tszRoot);
+ mir_snwprintf(tszFileDest, L"%s\\Pack", tszRoot);
CreateDirectory(tszFileDest, NULL);
break;
case 2:
- mir_sntprintf(tszFileDest, L"%s\\Plugins", tszRoot);
+ mir_snwprintf(tszFileDest, L"%s\\Plugins", tszRoot);
CreateDirectory(tszFileDest, NULL);
break;
case 3:
- mir_sntprintf(tszFileDest, L"%s\\Icons", tszRoot);
+ mir_snwprintf(tszFileDest, L"%s\\Icons", tszRoot);
CreateDirectory(tszFileDest, NULL);
break;
case 4:
- mir_sntprintf(tszFileDest, L"%s\\Others", tszRoot);
+ mir_snwprintf(tszFileDest, L"%s\\Others", tszRoot);
CreateDirectory(tszFileDest, NULL);
break;
case 5:
- mir_sntprintf(tszFileDest, L"%s\\Others", tszRoot);
+ mir_snwprintf(tszFileDest, L"%s\\Others", tszRoot);
CreateDirectory(tszFileDest, NULL);
break;
default:
- mir_tstrncpy(tszFileDest, tszRoot, _countof(tszFileDest));
+ mir_wstrncpy(tszFileDest, tszRoot, _countof(tszFileDest));
break;
}
- mir_sntprintf(tszBuff, L"%s\\Backups", tszRoot);
+ mir_snwprintf(tszBuff, L"%s\\Backups", tszRoot);
CreateDirectory(tszBuff, NULL);
- mir_tstrncpy(tszFileName, todo[i].File.tszDiskPath, _countof(tszFileName));
- mir_sntprintf(todo[i].File.tszDiskPath, L"%s\\%s", tszFileDest, tszFileName);
+ mir_wstrncpy(tszFileName, todo[i].File.tszDiskPath, _countof(tszFileName));
+ mir_snwprintf(todo[i].File.tszDiskPath, L"%s\\%s", tszFileDest, tszFileName);
UpdatesCount++;
- tszExt = &todo[i].File.tszDownloadURL[mir_tstrlen(todo[i].File.tszDownloadURL) - 5];
- if (mir_tstrcmp(tszExt, L".html") == 0) {
- char* szUrl = mir_t2a(todo[i].File.tszDownloadURL);
+ tszExt = &todo[i].File.tszDownloadURL[mir_wstrlen(todo[i].File.tszDownloadURL) - 5];
+ if (mir_wstrcmp(tszExt, L".html") == 0) {
+ char* szUrl = mir_u2a(todo[i].File.tszDownloadURL);
Utils_OpenUrl(szUrl);
mir_free(szUrl);
}
@@ -399,7 +399,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam continue;
}
}
- mir_tstrncpy(todo[i].tszCurVer, todo[i].tszNewVer, _countof(todo[i].tszCurVer));
+ mir_wstrncpy(todo[i].tszCurVer, todo[i].tszNewVer, _countof(todo[i].tszCurVer));
mir_snprintf(szKey, "File_%d_CurrentVersion", todo[i].FileNum);
db_set_ts(NULL, MODNAME, szKey, todo[i].tszCurVer);
arFileType.push_back(todo[i].FileType);
@@ -412,11 +412,11 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam }
}
- if (UpdatesCount > 1 && mir_tstrcmp(arExt[0].c_str(), L".html") != 0)
- mir_tstrncpy(tszBuff, TranslateT("Downloads complete. Start updating? All your data will be saved and Miranda NG will be closed."), _countof(tszBuff));
- else if (UpdatesCount == 1 && mir_tstrcmp(arExt[0].c_str(), L".html") != 0)
- mir_tstrncpy(tszBuff, TranslateT("Download complete. Start updating? All your data will be saved and Miranda NG will be closed."), _countof(tszBuff));
- if (UpdatesCount > 0 && mir_tstrcmp(arExt[0].c_str(), L".html") != 0) {
+ if (UpdatesCount > 1 && mir_wstrcmp(arExt[0].c_str(), L".html") != 0)
+ mir_wstrncpy(tszBuff, TranslateT("Downloads complete. Start updating? All your data will be saved and Miranda NG will be closed."), _countof(tszBuff));
+ else if (UpdatesCount == 1 && mir_wstrcmp(arExt[0].c_str(), L".html") != 0)
+ mir_wstrncpy(tszBuff, TranslateT("Download complete. Start updating? All your data will be saved and Miranda NG will be closed."), _countof(tszBuff));
+ if (UpdatesCount > 0 && mir_wstrcmp(arExt[0].c_str(), L".html") != 0) {
INT rc = -1;
Title = TranslateT("Pack Updater");
Text = tszBuff;
@@ -451,11 +451,11 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam break;
case 2:
tszUtilRootPlug = Utils_ReplaceVarsT(L"%miranda_path%\\Plugins");
- if (mir_tstrcmp(arAdvFolder[i].c_str(), L"") == 0)
- mir_sntprintf(tszFilePathDest, L"%s\\%s", tszUtilRootPlug, arFileName[i].c_str());
+ if (mir_wstrcmp(arAdvFolder[i].c_str(), L"") == 0)
+ mir_snwprintf(tszFilePathDest, L"%s\\%s", tszUtilRootPlug, arFileName[i].c_str());
else
- mir_sntprintf(tszFilePathDest, L"%s\\%s\\%s", tszUtilRootPlug, arAdvFolder[i].c_str(), arFileName[i].c_str());
- mir_sntprintf(tszFilePathBack, L"%s\\Backups\\%s", tszRoot, arFileName[i].c_str());
+ mir_snwprintf(tszFilePathDest, L"%s\\%s\\%s", tszUtilRootPlug, arAdvFolder[i].c_str(), arFileName[i].c_str());
+ mir_snwprintf(tszFilePathBack, L"%s\\Backups\\%s", tszRoot, arFileName[i].c_str());
MoveFile(tszFilePathDest, tszFilePathBack);
MoveFile(arFilePath[i].c_str(), tszFilePathDest);
mir_free(tszUtilRootPlug);
@@ -464,11 +464,11 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam break;
case 3:
tszUtilRootIco = Utils_ReplaceVarsT(L"%miranda_path%\\Icons");
- if (mir_tstrcmp(arAdvFolder[i].c_str(), L"") == 0)
- mir_sntprintf(tszFilePathDest, L"%s\\%s", tszUtilRootIco, arFileName[i].c_str());
+ if (mir_wstrcmp(arAdvFolder[i].c_str(), L"") == 0)
+ mir_snwprintf(tszFilePathDest, L"%s\\%s", tszUtilRootIco, arFileName[i].c_str());
else
- mir_sntprintf(tszFilePathDest, L"%s\\%s\\%s", tszUtilRootIco, arAdvFolder[i].c_str(), arFileName[i].c_str());
- mir_sntprintf(tszFilePathBack, L"%s\\Backups\\%s", tszRoot, arFileName[i].c_str());
+ mir_snwprintf(tszFilePathDest, L"%s\\%s\\%s", tszUtilRootIco, arAdvFolder[i].c_str(), arFileName[i].c_str());
+ mir_snwprintf(tszFilePathBack, L"%s\\Backups\\%s", tszRoot, arFileName[i].c_str());
MoveFile(tszFilePathDest, tszFilePathBack);
MoveFile(arFilePath[i].c_str(), tszFilePathDest);
mir_free(tszUtilRootIco);
@@ -477,11 +477,11 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam break;
case 4:
tszUtilRoot = Utils_ReplaceVarsT(L"%miranda_path%");
- if (mir_tstrcmp(arAdvFolder[i].c_str(), L"") == 0)
- mir_sntprintf(tszFilePathDest, L"%s\\%s", tszUtilRoot, arFileName[i].c_str());
+ if (mir_wstrcmp(arAdvFolder[i].c_str(), L"") == 0)
+ mir_snwprintf(tszFilePathDest, L"%s\\%s", tszUtilRoot, arFileName[i].c_str());
else
- mir_sntprintf(tszFilePathDest, L"%s\\%s\\%s", tszUtilRoot, arAdvFolder[i].c_str(), arFileName[i].c_str());
- mir_sntprintf(tszFilePathBack, L"%s\\Backups\\%s", tszRoot, arFileName[i].c_str());
+ mir_snwprintf(tszFilePathDest, L"%s\\%s\\%s", tszUtilRoot, arAdvFolder[i].c_str(), arFileName[i].c_str());
+ mir_snwprintf(tszFilePathBack, L"%s\\Backups\\%s", tszRoot, arFileName[i].c_str());
MoveFile(tszFilePathDest, tszFilePathBack);
MoveFile(arFilePath[i].c_str(), tszFilePathDest);
mir_free(tszUtilRoot);
@@ -490,11 +490,11 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam break;
case 5:
tszUtilRoot = Utils_ReplaceVarsT(L"%miranda_path%");
- if (mir_tstrcmp(arAdvFolder[i].c_str(), L"") == 0)
- mir_sntprintf(tszFilePathDest, L"%s\\%s", tszUtilRoot, arFileName[i].c_str());
+ if (mir_wstrcmp(arAdvFolder[i].c_str(), L"") == 0)
+ mir_snwprintf(tszFilePathDest, L"%s\\%s", tszUtilRoot, arFileName[i].c_str());
else
- mir_sntprintf(tszFilePathDest, L"%s\\%s\\%s", tszUtilRoot, arAdvFolder[i].c_str(), arFileName[i].c_str());
- mir_sntprintf(tszFilePathBack, L"%s\\Backups\\%s", tszRoot, arFileName[i].c_str());
+ mir_snwprintf(tszFilePathDest, L"%s\\%s\\%s", tszUtilRoot, arAdvFolder[i].c_str(), arFileName[i].c_str());
+ mir_snwprintf(tszFilePathBack, L"%s\\Backups\\%s", tszRoot, arFileName[i].c_str());
MoveFile(tszFilePathDest, tszFilePathBack);
MoveFile(arFilePath[i].c_str(), tszFilePathDest);
mir_free(tszUtilRoot);
@@ -505,7 +505,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam else { //reminder for not installed pack update
if (Reminder && (UpdatesCount == 1) && (arFileType[0] == 1))
db_set_b(NULL, MODNAME, "Reminder", 2);
- mir_sntprintf(tszBuff, TranslateT("You have chosen not to install the pack update immediately.\nYou can install it manually from this location:\n\n%s"), arFilePath[0].c_str());
+ mir_snwprintf(tszBuff, TranslateT("You have chosen not to install the pack update immediately.\nYou can install it manually from this location:\n\n%s"), arFilePath[0].c_str());
Title = TranslateT("Pack Updater");
Text = tszBuff;
if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
diff --git a/plugins/PackUpdater/Src/PackUpdater.cpp b/plugins/PackUpdater/Src/PackUpdater.cpp index eabc12dbba..d4df5c677f 100644 --- a/plugins/PackUpdater/Src/PackUpdater.cpp +++ b/plugins/PackUpdater/Src/PackUpdater.cpp @@ -55,7 +55,7 @@ extern "C" __declspec(dllexport) int Load(void) mir_getLP(&pluginInfoEx);
wchar_t *tszFolder = Utils_ReplaceVarsT(L"%miranda_userdata%\\" DEFAULT_UPDATES_FOLDER);
- mir_tstrncpy(tszRoot, tszFolder, _countof(tszRoot));
+ mir_wstrncpy(tszRoot, tszFolder, _countof(tszRoot));
hPackUpdaterFolder = FoldersRegisterCustomPathT(MODULEA, LPGEN("Pack Updater"), MIRANDA_USERDATAT L"\\" DEFAULT_UPDATES_FOLDER);
if (hPackUpdaterFolder)
diff --git a/plugins/PackUpdater/Src/Utils.cpp b/plugins/PackUpdater/Src/Utils.cpp index 62fa5d83e1..b555e97d37 100644 --- a/plugins/PackUpdater/Src/Utils.cpp +++ b/plugins/PackUpdater/Src/Utils.cpp @@ -112,7 +112,7 @@ BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal) nlhr.cbSize = sizeof(nlhr);
nlhr.requestType = REQUEST_GET;
nlhr.flags = NLHRF_REDIRECT | NLHRF_DUMPASTEXT | NLHRF_HTTP11;
- char* szUrl = mir_t2a(tszURL);
+ char* szUrl = mir_u2a(tszURL);
nlhr.szUrl = szUrl;
nlhr.headersCount = 4;
nlhr.headers = (NETLIBHTTPHEADER*)mir_alloc(sizeof(NETLIBHTTPHEADER)*nlhr.headersCount);
@@ -164,7 +164,7 @@ BOOL Exists(LPCTSTR strName) BOOL IsPluginDisabled(wchar_t* filename)
{
- char* fname = mir_t2a(filename);
+ char* fname = mir_u2a(filename);
int res = db_get_b(NULL, "PluginDisable", fname, 0);
mir_free(fname);
return res;
@@ -190,7 +190,7 @@ static void CheckUpdates(void *) FileCount = db_get_dw(NULL, MODNAME, "FileCount", DEFAULT_FILECOUNT);
// Load files info
- ptrT tszDownloadURL(db_get_tsa(NULL, MODNAME, "File_VersionURL"));
+ ptrW tszDownloadURL(db_get_tsa(NULL, MODNAME, "File_VersionURL"));
if (!tszDownloadURL) { // URL is not set
Title = TranslateT("Pack Updater");
Text = TranslateT("URL for checking updates not found.");
@@ -205,10 +205,10 @@ static void CheckUpdates(void *) }
// Download version info
pFileUrl = (FILEURL *)mir_alloc(sizeof(*pFileUrl));
- mir_tstrncpy(pFileUrl->tszDownloadURL, tszDownloadURL, _countof(pFileUrl->tszDownloadURL));
- mir_sntprintf(tszBuff, L"%s\\tmp.ini", tszRoot);
- mir_tstrncpy(pFileUrl->tszDiskPath, tszBuff, _countof(pFileUrl->tszDiskPath));
- mir_tstrncpy(tszTmpIni, tszBuff, _countof(tszTmpIni));
+ mir_wstrncpy(pFileUrl->tszDownloadURL, tszDownloadURL, _countof(pFileUrl->tszDownloadURL));
+ mir_snwprintf(tszBuff, L"%s\\tmp.ini", tszRoot);
+ mir_wstrncpy(pFileUrl->tszDiskPath, tszBuff, _countof(pFileUrl->tszDiskPath));
+ mir_wstrncpy(tszTmpIni, tszBuff, _countof(tszTmpIni));
Title = TranslateT("Pack Updater");
Text = TranslateT("Downloading version info...");
DlgDownloadProc();
@@ -222,23 +222,23 @@ static void CheckUpdates(void *) FILEINFO FileInfo = { L"", L"", L"", L"", L"", L"", L"", { L"", L"" } };
mir_snprintf(szKey, "File_%d_CurrentVersion", CurrentFile + 1);
- ptrT tszCurVer(db_get_tsa(NULL, MODNAME, szKey));
+ ptrW tszCurVer(db_get_tsa(NULL, MODNAME, szKey));
if (tszCurVer)
- mir_tstrncpy(FileInfo.tszCurVer, tszCurVer, _countof(FileInfo.tszCurVer));
+ mir_wstrncpy(FileInfo.tszCurVer, tszCurVer, _countof(FileInfo.tszCurVer));
else
- mir_tstrncpy(FileInfo.tszCurVer, L"", _countof(FileInfo.tszCurVer));
+ mir_wstrncpy(FileInfo.tszCurVer, L"", _countof(FileInfo.tszCurVer));
mir_snprintf(szKey, "File_%d_LastVersion", CurrentFile + 1);
- ptrT tszLastVer(db_get_tsa(NULL, MODNAME, szKey));
+ ptrW tszLastVer(db_get_tsa(NULL, MODNAME, szKey));
if (tszLastVer)
- mir_tstrncpy(FileInfo.tszLastVer, tszLastVer, _countof(FileInfo.tszLastVer));
+ mir_wstrncpy(FileInfo.tszLastVer, tszLastVer, _countof(FileInfo.tszLastVer));
else
- mir_tstrncpy(FileInfo.tszLastVer, L"", _countof(FileInfo.tszLastVer));
+ mir_wstrncpy(FileInfo.tszLastVer, L"", _countof(FileInfo.tszLastVer));
Files.push_back(FileInfo);
// Read version info
- mir_sntprintf(tszFileInfo, L"FileInfo_%d", CurrentFile + 1);
+ mir_snwprintf(tszFileInfo, L"FileInfo_%d", CurrentFile + 1);
GetPrivateProfileString(tszFileInfo, L"FileVersion", L"", Files[CurrentFile].tszNewVer, _countof(Files[CurrentFile].tszNewVer), tszTmpIni);
GetPrivateProfileString(tszFileInfo, L"Message", L"", Files[CurrentFile].tszMessage, _countof(Files[CurrentFile].tszMessage), tszTmpIni);
GetPrivateProfileString(tszFileInfo, L"DownloadURL", L"", Files[CurrentFile].File.tszDownloadURL, _countof(Files[CurrentFile].File.tszDownloadURL), tszTmpIni);
@@ -257,17 +257,17 @@ static void CheckUpdates(void *) MessageBox(NULL, Text, Title, MB_ICONINFORMATION);
continue;
} // end check update name
- mir_tstrncpy(Files[CurrentFile].File.tszDiskPath, tszBuff, _countof(Files[CurrentFile].File.tszDiskPath));
+ mir_wstrncpy(Files[CurrentFile].File.tszDiskPath, tszBuff, _countof(Files[CurrentFile].File.tszDiskPath));
GetPrivateProfileString(tszFileInfo, L"InfoURL", L"", Files[CurrentFile].tszInfoURL, _countof(Files[CurrentFile].tszInfoURL), tszTmpIni);
Files[CurrentFile].FileType = GetPrivateProfileInt(tszFileInfo, L"FileType", 0, tszTmpIni);
Files[CurrentFile].Force = GetPrivateProfileInt(tszFileInfo, L"Force", 0, tszTmpIni);
Files[CurrentFile].FileNum = CurrentFile + 1;
if (Files[CurrentFile].FileType == 2) {
- if (mir_tstrcmp(Files[CurrentFile].tszAdvFolder, L"") == 0)
- mir_sntprintf(tszBuff, L"Plugins\\%s", Files[CurrentFile].File.tszDiskPath);
+ if (mir_wstrcmp(Files[CurrentFile].tszAdvFolder, L"") == 0)
+ mir_snwprintf(tszBuff, L"Plugins\\%s", Files[CurrentFile].File.tszDiskPath);
else
- mir_sntprintf(tszBuff, L"Plugins\\%s\\%s", Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath);
+ mir_snwprintf(tszBuff, L"Plugins\\%s\\%s", Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath);
wchar_t pluginFolderName[MAX_PATH];
PathToAbsoluteT(tszBuff, pluginFolderName);
if (!Files[CurrentFile].Force && (IsPluginDisabled(Files[CurrentFile].File.tszDiskPath) || !Exists(pluginFolderName))) //check if plugin disabled or not exists
@@ -293,27 +293,27 @@ static void CheckUpdates(void *) break;
case 2: {
VARST tszUtilRootPlug(L"%miranda_path%\\Plugins");
- if (mir_tstrcmp(Files[CurrentFile].tszAdvFolder, L"") == 0)
- mir_sntprintf(tszFilePathDest, L"%s\\%s", tszUtilRootPlug, Files[CurrentFile].File.tszDiskPath);
+ if (mir_wstrcmp(Files[CurrentFile].tszAdvFolder, L"") == 0)
+ mir_snwprintf(tszFilePathDest, L"%s\\%s", tszUtilRootPlug, Files[CurrentFile].File.tszDiskPath);
else
- mir_sntprintf(tszFilePathDest, L"%s\\%s\\%s", tszUtilRootPlug, Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath);
+ mir_snwprintf(tszFilePathDest, L"%s\\%s\\%s", tszUtilRootPlug, Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath);
}
break;
case 3: {
VARST tszUtilRootIco(L"%miranda_path%\\Icons");
- if (mir_tstrcmp(Files[CurrentFile].tszAdvFolder, L"") == 0)
- mir_sntprintf(tszFilePathDest, L"%s\\%s", tszUtilRootIco, Files[CurrentFile].File.tszDiskPath);
+ if (mir_wstrcmp(Files[CurrentFile].tszAdvFolder, L"") == 0)
+ mir_snwprintf(tszFilePathDest, L"%s\\%s", tszUtilRootIco, Files[CurrentFile].File.tszDiskPath);
else
- mir_sntprintf(tszFilePathDest, L"%s\\%s\\%s", tszUtilRootIco, Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath);
+ mir_snwprintf(tszFilePathDest, L"%s\\%s\\%s", tszUtilRootIco, Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath);
}
break;
case 4:
case 5: {
wchar_t *tszUtilRoot = VARST(L"%miranda_path%");
- if (mir_tstrcmp(Files[CurrentFile].tszAdvFolder, L"") == 0)
- mir_sntprintf(tszFilePathDest, L"%s\\%s", tszUtilRoot, Files[CurrentFile].File.tszDiskPath);
+ if (mir_wstrcmp(Files[CurrentFile].tszAdvFolder, L"") == 0)
+ mir_snwprintf(tszFilePathDest, L"%s\\%s", tszUtilRoot, Files[CurrentFile].File.tszDiskPath);
else
- mir_sntprintf(tszFilePathDest, L"%s\\%s\\%s", tszUtilRoot, Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath);
+ mir_snwprintf(tszFilePathDest, L"%s\\%s\\%s", tszUtilRoot, Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath);
}
break;
}//end* switch (Files[CurrentFile].FileType)
@@ -321,7 +321,7 @@ static void CheckUpdates(void *) if (Files[CurrentFile].Force || Exists(tszFilePathDest))
UpdateFiles.push_back(Files[CurrentFile]);
// Save last version
- mir_tstrncpy(Files[CurrentFile].tszLastVer, Files[CurrentFile].tszNewVer, _countof(Files[CurrentFile].tszLastVer));
+ mir_wstrncpy(Files[CurrentFile].tszLastVer, Files[CurrentFile].tszNewVer, _countof(Files[CurrentFile].tszLastVer));
mir_snprintf(szKey, "File_%d_LastVersion", CurrentFile + 1);
db_set_ts(NULL, MODNAME, szKey, Files[CurrentFile].tszLastVer);
} // end compare versions
diff --git a/plugins/PasteIt/src/Options.cpp b/plugins/PasteIt/src/Options.cpp index 628fdd9182..8efd3d1174 100644 --- a/plugins/PasteIt/src/Options.cpp +++ b/plugins/PasteIt/src/Options.cpp @@ -646,7 +646,7 @@ void Options::InitCodepageCB(HWND hwndCB, unsigned int codepage) if (selCpIdx == -1) {
wchar_t buf[10];
- mir_sntprintf(buf, L"%d", codepage);
+ mir_snwprintf(buf, L"%d", codepage);
ComboBox_SetText(hwndCB, buf);
}
else {
@@ -667,7 +667,7 @@ void Options::SetCodepageCB(HWND hwndCB, unsigned int codepage) if (selCpIdx == -1) {
wchar_t buf[10];
- mir_sntprintf(buf, L"%d", codepage);
+ mir_snwprintf(buf, L"%d", codepage);
ComboBox_SetText(hwndCB, buf);
}
else {
diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp index 6c96d4d1ba..fe85a759c3 100644 --- a/plugins/PasteIt/src/PasteIt.cpp +++ b/plugins/PasteIt/src/PasteIt.cpp @@ -71,8 +71,8 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda std::wstring GetFile()
{
wchar_t filter[512];
- mir_tstrncpy(filter, TranslateT("All Files (*.*)"), _countof(filter));
- memcpy(filter + mir_tstrlen(filter), L"\0*.*\0", 6 * sizeof(wchar_t));
+ mir_wstrncpy(filter, TranslateT("All Files (*.*)"), _countof(filter));
+ memcpy(filter + mir_wstrlen(filter), L"\0*.*\0", 6 * sizeof(wchar_t));
wchar_t stzFilePath[1024];
stzFilePath[0] = 0;
stzFilePath[1] = 0;
diff --git a/plugins/PasteIt/src/PasteToWeb.cpp b/plugins/PasteIt/src/PasteToWeb.cpp index 8e0cecb447..3e62035de1 100644 --- a/plugins/PasteIt/src/PasteToWeb.cpp +++ b/plugins/PasteIt/src/PasteToWeb.cpp @@ -384,7 +384,7 @@ void PasteToWeb::FromFile(std::wstring file) {
if (fileSize.QuadPart > 512000LL)
{
- mir_sntprintf(bufErr, TranslateT("File size is %d KB, do you really want to paste such a large file?"), fileSize.LowPart / 1024);
+ mir_snwprintf(bufErr, TranslateT("File size is %d KB, do you really want to paste such a large file?"), fileSize.LowPart / 1024);
if (MessageBox(NULL, bufErr, TranslateT("Are You sure?"), MB_YESNO | MB_ICONQUESTION) != IDYES)
{
CloseHandle(hFile);
@@ -399,7 +399,7 @@ void PasteToWeb::FromFile(std::wstring file) mir_free(fromFileData.content);
fromFileData.content = NULL;
fromFileData.contentLen = 0;
- mir_sntprintf(bufErr, TranslateT("Cannot read file '%s'"), file.c_str());
+ mir_snwprintf(bufErr, TranslateT("Cannot read file '%s'"), file.c_str());
error = bufErr;
}
}
@@ -413,7 +413,7 @@ void PasteToWeb::FromFile(std::wstring file) }
else
{
- mir_sntprintf(bufErr, TranslateT("Cannot open file '%s'"), file.c_str());
+ mir_snwprintf(bufErr, TranslateT("Cannot open file '%s'"), file.c_str());
error = bufErr;
}
@@ -491,7 +491,7 @@ void PasteToWeb::FromFile(std::wstring file) }
else
{
- mir_sntprintf(bufErr, TranslateT("File '%s' is empty"), file.c_str());
+ mir_snwprintf(bufErr, TranslateT("File '%s' is empty"), file.c_str());
error = bufErr;
}
mir_free(fromFileData.content);
diff --git a/plugins/PasteIt/src/PasteToWeb1.cpp b/plugins/PasteIt/src/PasteToWeb1.cpp index 73b4b77667..a7de2c10fc 100644 --- a/plugins/PasteIt/src/PasteToWeb1.cpp +++ b/plugins/PasteIt/src/PasteToWeb1.cpp @@ -304,7 +304,7 @@ void PasteToWeb1::SendToServer(std::wstring str, std::wstring fileName, std::wst {
if (memcmp(L"Bad API request, ", resCont, 17 * sizeof(wchar_t)) == 0)
{
- mir_sntprintf(bufErr, TranslateT("Error during sending text to web page: %s"), resCont + 17);
+ mir_snwprintf(bufErr, TranslateT("Error during sending text to web page: %s"), resCont + 17);
error = bufErr;
}
else
@@ -336,7 +336,7 @@ std::wstring PasteToWeb1::GetUserKey(std::wstring& user, std::wstring& password) {
if (memcmp(L"Bad API request, ", resCont, 17 * sizeof(wchar_t)) == 0)
{
- mir_sntprintf(bufErr, TranslateT("Error during getting user key from web page: %s"), resCont + 17);
+ mir_snwprintf(bufErr, TranslateT("Error during getting user key from web page: %s"), resCont + 17);
MessageBox(NULL, bufErr, TranslateT("Error"), MB_OK | MB_ICONERROR);
}
else
diff --git a/plugins/PasteIt/src/PasteToWeb2.cpp b/plugins/PasteIt/src/PasteToWeb2.cpp index f9645ee447..a5843149a3 100644 --- a/plugins/PasteIt/src/PasteToWeb2.cpp +++ b/plugins/PasteIt/src/PasteToWeb2.cpp @@ -109,7 +109,7 @@ void PasteToWeb2::SendToServer(std::wstring str, std::wstring fileName, std::wst if (hXml != NULL)
{
HXML node = xmlGetChildByPath(hXml, L"params/param/value/array/data/value/int", 0);
- if (node != NULL && !mir_tstrcmp(xmlGetText(node), L"1"))
+ if (node != NULL && !mir_wstrcmp(xmlGetText(node), L"1"))
{
node = xmlGetChildByPath(hXml, L"params/param/value/array/data", 0);
if (node != NULL)
@@ -120,7 +120,7 @@ void PasteToWeb2::SendToServer(std::wstring str, std::wstring fileName, std::wst node = xmlGetChildByPath(node, L"string", 0);
if (node != NULL)
{
- char* s = mir_t2a_cp(xmlGetText(node), CP_ACP);
+ char* s = mir_u2a_cp(xmlGetText(node), CP_ACP);
mir_strncpy(szFileLink, s, _countof(szFileLink));
mir_free(s);
error = NULL;
@@ -149,7 +149,7 @@ std::list<PasteFormat> PasteToWeb2::GetFormats() if (hXml != NULL)
{
HXML node = xmlGetChildByPath(hXml, L"params/param/value/array/data/value/int", 0);
- if (node != NULL && !mir_tstrcmp(xmlGetText(node), L"1"))
+ if (node != NULL && !mir_wstrcmp(xmlGetText(node), L"1"))
{
node = xmlGetChildByPath(hXml, L"params/param/value/array/data", 0);
if (node != NULL)
diff --git a/plugins/Ping/src/log.cpp b/plugins/Ping/src/log.cpp index 01bb07e671..c99af91c06 100644 --- a/plugins/Ping/src/log.cpp +++ b/plugins/Ping/src/log.cpp @@ -34,10 +34,10 @@ INT_PTR GetLogFilename(WPARAM wParam, LPARAM lParam) { wchar_t *filename = (wchar_t *)lParam;
if (db_get_ts(0, PLUG, "LogFilename", &dbv)) {
CallService(MS_DB_GETPROFILEPATHT, wParam, (LPARAM)filename);
- mir_tstrncat(filename, L"\\ping_log.txt", wParam - mir_tstrlen(filename));
+ mir_wstrncat(filename, L"\\ping_log.txt", wParam - mir_wstrlen(filename));
}
else {
- mir_tstrncpy(filename, dbv.ptszVal, wParam);
+ mir_wstrncpy(filename, dbv.ptszVal, wParam);
db_free(&dbv);
}
diff --git a/plugins/Ping/src/options.cpp b/plugins/Ping/src/options.cpp index 853473e3cc..1f77da46d2 100644 --- a/plugins/Ping/src/options.cpp +++ b/plugins/Ping/src/options.cpp @@ -82,7 +82,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case IDC_BTN_LOGBROWSE:
{
wchar_t filter[MAX_PATH];
- mir_sntprintf(filter, L"%s%c*.txt%c%s%c*.*%c", TranslateT("Text Files (*.txt)"), 0, 0, TranslateT("All Files"), 0, 0);
+ mir_snwprintf(filter, L"%s%c*.txt%c%s%c*.*%c", TranslateT("Text Files (*.txt)"), 0, 0, TranslateT("All Files"), 0, 0);
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
ofn.lpstrFile = options.log_filename;
diff --git a/plugins/Ping/src/pinggraph.cpp b/plugins/Ping/src/pinggraph.cpp index f8a5fef2c5..1b95e95649 100644 --- a/plugins/Ping/src/pinggraph.cpp +++ b/plugins/Ping/src/pinggraph.cpp @@ -190,20 +190,20 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar wchar_t buff[64];
if (wd->show_grid)
{
- mir_sntprintf(buff, TranslateT("%d ms"), MARK_TIME);
- TextOut(hdc, r.right - 100, r.bottom - (int)(unit_height * MARK_TIME + 0.5f), buff, (int)mir_tstrlen(buff));
+ mir_snwprintf(buff, TranslateT("%d ms"), MARK_TIME);
+ TextOut(hdc, r.right - 100, r.bottom - (int)(unit_height * MARK_TIME + 0.5f), buff, (int)mir_wstrlen(buff));
}
if (wd->show_stat)
{
SetTextColor(hdc, RGB(255, 0, 0));
- mir_sntprintf(buff, TranslateT("AVG %.1lf ms"), avg);
- TextOut(hdc, r.left + 10, r.bottom - (int)(avg * unit_height + 0.5f), buff, (int)mir_tstrlen(buff));
+ mir_snwprintf(buff, TranslateT("AVG %.1lf ms"), avg);
+ TextOut(hdc, r.left + 10, r.bottom - (int)(avg * unit_height + 0.5f), buff, (int)mir_wstrlen(buff));
if (max_value != avg) {
- mir_sntprintf(buff, TranslateT("MAX %hd ms"), max_value);
- TextOut(hdc, r.left + 10, r.bottom - (int)(max_value * unit_height + 0.5f), buff, (int)mir_tstrlen(buff));
- mir_sntprintf(buff, TranslateT("MIN %hd ms"), min_value);
- TextOut(hdc, r.left + 10, r.bottom - (int)(min_value * unit_height + 0.5f), buff, (int)mir_tstrlen(buff));
+ mir_snwprintf(buff, TranslateT("MAX %hd ms"), max_value);
+ TextOut(hdc, r.left + 10, r.bottom - (int)(max_value * unit_height + 0.5f), buff, (int)mir_wstrlen(buff));
+ mir_snwprintf(buff, TranslateT("MIN %hd ms"), min_value);
+ TextOut(hdc, r.left + 10, r.bottom - (int)(min_value * unit_height + 0.5f), buff, (int)mir_wstrlen(buff));
}
}
@@ -276,10 +276,10 @@ INT_PTR ShowGraph(WPARAM wParam, LPARAM lParam) { RegisterClass(&wndclass);
wchar_t title[256];
- mir_tstrncpy(title, TranslateT("Ping Graph"), _countof(title));
+ mir_wstrncpy(title, TranslateT("Ping Graph"), _countof(title));
if (lParam) {
- mir_tstrncat(title, L" - ", _countof(title) - mir_tstrlen(title));
- mir_tstrncat(title, (wchar_t *)lParam, _countof(title) - mir_tstrlen(title));
+ mir_wstrncat(title, L" - ", _countof(title) - mir_wstrlen(title));
+ mir_wstrncat(title, (wchar_t *)lParam, _countof(title) - mir_wstrlen(title));
}
HWND parent = 0;
diff --git a/plugins/Ping/src/pinglist.cpp b/plugins/Ping/src/pinglist.cpp index c08d279610..9ba42dad03 100644 --- a/plugins/Ping/src/pinglist.cpp +++ b/plugins/Ping/src/pinglist.cpp @@ -68,11 +68,11 @@ void write_ping_address(PINGADDRESS &i) db_set_w(0, buff, "Status", i.status);
db_set_dw(0, buff, "Port", i.port);
db_set_s(0, buff, "Proto", i.pszProto);
- if (mir_tstrlen(i.pszCommand))
+ if (mir_wstrlen(i.pszCommand))
db_set_ts(0, buff, "Command", i.pszCommand);
else
db_unset(0, buff, "Command");
- if (mir_tstrlen(i.pszParams))
+ if (mir_wstrlen(i.pszParams))
db_set_ts(0, buff, "CommandParams", i.pszParams);
else
db_unset(0, buff, "CommandParams");
@@ -116,13 +116,13 @@ bool read_ping_address(PINGADDRESS &pa) { DBVARIANT dbv;
if (!db_get_ts(0, buff, "Address", &dbv)) {
- mir_tstrncpy(pa.pszName, dbv.ptszVal, _countof(pa.pszName));
+ mir_wstrncpy(pa.pszName, dbv.ptszVal, _countof(pa.pszName));
db_free(&dbv);
}
else return false;
if (!db_get_ts(0, buff, "Label", &dbv)) {
- mir_tstrncpy(pa.pszLabel, dbv.ptszVal, _countof(pa.pszLabel));
+ mir_wstrncpy(pa.pszLabel, dbv.ptszVal, _countof(pa.pszLabel));
db_free(&dbv);
}
else return false;
@@ -139,13 +139,13 @@ bool read_ping_address(PINGADDRESS &pa) { else pa.pszProto[0] = '\0';
if (!db_get_ts(0, buff, "Command", &dbv)) {
- mir_tstrncpy(pa.pszCommand, dbv.ptszVal, _countof(pa.pszCommand));
+ mir_wstrncpy(pa.pszCommand, dbv.ptszVal, _countof(pa.pszCommand));
db_free(&dbv);
}
else
pa.pszCommand[0] = '\0';
if (!db_get_ts(0, buff, "CommandParams", &dbv)) {
- mir_tstrncpy(pa.pszParams, dbv.ptszVal, _countof(pa.pszParams));
+ mir_wstrncpy(pa.pszParams, dbv.ptszVal, _countof(pa.pszParams));
db_free(&dbv);
}
else
diff --git a/plugins/Ping/src/pingthread.cpp b/plugins/Ping/src/pingthread.cpp index 0381c05b35..7e6ccdbfc4 100644 --- a/plugins/Ping/src/pingthread.cpp +++ b/plugins/Ping/src/pingthread.cpp @@ -70,7 +70,7 @@ void SetProtoStatus(wchar_t *pszLabel, char *pszProto, int if_status, int new_st if (CallProtoService(pszProto, PS_GETSTATUS, 0, 0) == if_status) {
if (options.logging) {
wchar_t buf[1024];
- mir_sntprintf(buf, TranslateT("%s - setting status of protocol '%S' (%d)"), pszLabel, pszProto, new_status);
+ mir_snwprintf(buf, TranslateT("%s - setting status of protocol '%S' (%d)"), pszLabel, pszProto, new_status);
CallService(PLUG "/Log", (WPARAM)buf, 0);
}
CallProtoService(pszProto, PS_SETSTATUS, new_status, 0);
@@ -118,8 +118,8 @@ void __cdecl sttCheckStatusThreadProc(void*) pa.item_id = i->item_id;
pa.miss_count = i->miss_count;
pa.port = i->port;
- mir_tstrncpy(pa.pszLabel, i->pszLabel, _countof(pa.pszLabel));
- mir_tstrncpy(pa.pszName, i->pszName, _countof(pa.pszName));
+ mir_wstrncpy(pa.pszLabel, i->pszLabel, _countof(pa.pszLabel));
+ mir_wstrncpy(pa.pszName, i->pszName, _countof(pa.pszName));
mir_strncpy(pa.pszProto, i->pszProto, _countof(pa.pszProto));
pa.set_status = i->set_status;
pa.status = i->status;
@@ -195,7 +195,7 @@ void __cdecl sttCheckStatusThreadProc(void*) }
if (pa.miss_count == -1 - options.retries && options.logging) {
wchar_t buf[512];
- mir_sntprintf(buf, TranslateT("%s - reply, %d"), pa.pszLabel, pa.round_trip_time);
+ mir_snwprintf(buf, TranslateT("%s - reply, %d"), pa.pszLabel, pa.round_trip_time);
CallService(PLUG "/Log", (WPARAM)buf, 0);
}
SetProtoStatus(pa.pszLabel, pa.pszProto, pa.get_status, pa.set_status);
@@ -209,7 +209,7 @@ void __cdecl sttCheckStatusThreadProc(void*) }
if (pa.miss_count == 1 + options.retries && options.logging) {
wchar_t buf[512];
- mir_sntprintf(buf, TranslateT("%s - timeout"), pa.pszLabel);
+ mir_snwprintf(buf, TranslateT("%s - timeout"), pa.pszLabel);
CallService(PLUG "/Log", (WPARAM)buf, 0);
}
}
@@ -308,9 +308,9 @@ void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) if (frame_id != -1 && ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
wchar_t TBcapt[255];
if (total > 0)
- mir_sntprintf(TBcapt, L"Ping (%d/%d)", upCount, total);
+ mir_snwprintf(TBcapt, L"Ping (%d/%d)", upCount, total);
else
- mir_sntprintf(TBcapt, L"Ping");
+ mir_snwprintf(TBcapt, L"Ping");
CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_TBNAME | FO_TCHAR, frame_id), (LPARAM)TBcapt);
CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_TBTIPNAME | FO_TCHAR, frame_id), (LPARAM)TBcapt);
@@ -384,20 +384,20 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar dis->rcItem.left += options.indent;
DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top + ((options.row_height - 16) >> 1), hIcon, 0, 0, 0, NULL, DI_NORMAL);
- GetTextExtentPoint32(dis->hDC, itemData.pszLabel, (int)mir_tstrlen(itemData.pszLabel), &textSize);
- TextOut(dis->hDC, dis->rcItem.left + 16 + 4, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, itemData.pszLabel, (int)mir_tstrlen(itemData.pszLabel));
+ GetTextExtentPoint32(dis->hDC, itemData.pszLabel, (int)mir_wstrlen(itemData.pszLabel), &textSize);
+ TextOut(dis->hDC, dis->rcItem.left + 16 + 4, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, itemData.pszLabel, (int)mir_wstrlen(itemData.pszLabel));
if (itemData.status != PS_DISABLED) {
wchar_t buf[256];
if (itemData.responding) {
- mir_sntprintf(buf, TranslateT("%d ms"), itemData.round_trip_time);
- GetTextExtentPoint32(dis->hDC, buf, (int)mir_tstrlen(buf), &textSize);
- TextOut(dis->hDC, dis->rcItem.right - textSize.cx - 2, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, buf, (int)mir_tstrlen(buf));
+ mir_snwprintf(buf, TranslateT("%d ms"), itemData.round_trip_time);
+ GetTextExtentPoint32(dis->hDC, buf, (int)mir_wstrlen(buf), &textSize);
+ TextOut(dis->hDC, dis->rcItem.right - textSize.cx - 2, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, buf, (int)mir_wstrlen(buf));
}
else if (itemData.miss_count > 0) {
- mir_sntprintf(buf, L"[%d]", itemData.miss_count);
- GetTextExtentPoint32(dis->hDC, buf, (int)mir_tstrlen(buf), &textSize);
- TextOut(dis->hDC, dis->rcItem.right - textSize.cx - 2, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, buf, (int)mir_tstrlen(buf));
+ mir_snwprintf(buf, L"[%d]", itemData.miss_count);
+ GetTextExtentPoint32(dis->hDC, buf, (int)mir_wstrlen(buf), &textSize);
+ TextOut(dis->hDC, dis->rcItem.right - textSize.cx - 2, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, buf, (int)mir_wstrlen(buf));
}
}
SetBkMode(dis->hDC, OPAQUE);
@@ -717,7 +717,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar if (options.logging) {
wchar_t buf[1024];
- mir_sntprintf(buf, L"%s - %s", pItemData->pszLabel, (wake ? TranslateT("enabled") : TranslateT("double clicked")));
+ mir_snwprintf(buf, L"%s - %s", pItemData->pszLabel, (wake ? TranslateT("enabled") : TranslateT("double clicked")));
CallService(PLUG "/Log", (WPARAM)buf, 0);
}
}
@@ -917,25 +917,25 @@ void InitList() }
font_id.cbSize = sizeof(FontIDT);
- mir_tstrncpy(font_id.group, LPGENW("Ping"), _countof(font_id.group));
- mir_tstrncpy(font_id.name, LPGENW("List"), _countof(font_id.name));
+ mir_wstrncpy(font_id.group, LPGENW("Ping"), _countof(font_id.group));
+ mir_wstrncpy(font_id.name, LPGENW("List"), _countof(font_id.name));
mir_strncpy(font_id.dbSettingsGroup, "PING", _countof(font_id.dbSettingsGroup));
mir_strncpy(font_id.prefix, "Font", _countof(font_id.prefix));
- mir_tstrncpy(font_id.backgroundGroup, L"Ping", _countof(font_id.backgroundGroup));
- mir_tstrncpy(font_id.backgroundName, L"Background", _countof(font_id.backgroundName));
+ mir_wstrncpy(font_id.backgroundGroup, L"Ping", _countof(font_id.backgroundGroup));
+ mir_wstrncpy(font_id.backgroundName, L"Background", _countof(font_id.backgroundName));
font_id.order = 0;
font_id.flags = FIDF_DEFAULTVALID;
font_id.deffontsettings.charset = DEFAULT_CHARSET;
font_id.deffontsettings.size = -14;
font_id.deffontsettings.style = 0;
font_id.deffontsettings.colour = RGB(255, 255, 255);
- mir_tstrncpy(font_id.deffontsettings.szFace, L"Tahoma", _countof(font_id.deffontsettings.szFace));
+ mir_wstrncpy(font_id.deffontsettings.szFace, L"Tahoma", _countof(font_id.deffontsettings.szFace));
FontRegisterT(&font_id);
bk_col_id.cbSize = sizeof(ColourIDT);
- mir_tstrncpy(bk_col_id.group, L"Ping", _countof(bk_col_id.group));
- mir_tstrncpy(bk_col_id.name, L"Background", _countof(bk_col_id.name));
+ mir_wstrncpy(bk_col_id.group, L"Ping", _countof(bk_col_id.group));
+ mir_wstrncpy(bk_col_id.name, L"Background", _countof(bk_col_id.name));
mir_strncpy(bk_col_id.dbSettingsGroup, "PING", _countof(bk_col_id.dbSettingsGroup));
mir_strncpy(bk_col_id.setting, "BgColor", _countof(bk_col_id.setting));
bk_col_id.defcolour = RGB(0, 0, 0);
diff --git a/plugins/Ping/src/utils.cpp b/plugins/Ping/src/utils.cpp index db10527710..37c01d0d28 100644 --- a/plugins/Ping/src/utils.cpp +++ b/plugins/Ping/src/utils.cpp @@ -38,8 +38,8 @@ void __stdcall ShowPopup(wchar_t *line1, wchar_t *line2, int flags) ppd->lchContact = NULL;
ppd->lchIcon = (flags ? hIconResponding : hIconNotResponding);
- mir_tstrncpy(ppd->lptzContactName, line1, _countof(ppd->lptzContactName));
- mir_tstrncpy(ppd->lptzText, line2, _countof(ppd->lptzText));
+ mir_wstrncpy(ppd->lptzContactName, line1, _countof(ppd->lptzContactName));
+ mir_wstrncpy(ppd->lptzText, line2, _countof(ppd->lptzText));
ppd->colorBack = GetSysColor(COLOR_BTNFACE);
ppd->colorText = GetSysColor(COLOR_WINDOWTEXT);
@@ -89,7 +89,7 @@ INT_PTR PluginPing(WPARAM, LPARAM lParam) //GetLocalTime(&systime);
NETLIBOPENCONNECTION conn = { 0 };
conn.cbSize = sizeof(NETLIBOPENCONNECTION);
- conn.szHost = mir_t2a(pa->pszName);
+ conn.szHost = mir_u2a(pa->pszName);
conn.wPort = pa->port;
conn.timeout = options.ping_timeout;
@@ -205,7 +205,7 @@ INT_PTR DblClick(WPARAM wParam, LPARAM) { CallService(PLUG "/GetPingList", 0, (LPARAM)&pl);
for (pinglist_it i = pl.begin(); i != pl.end(); ++i) {
if (i->item_id == (DWORD)wParam) {
- if (mir_tstrlen(i->pszCommand)) {
+ if (mir_wstrlen(i->pszCommand)) {
ShellExecute(0, L"open", i->pszCommand, i->pszParams, 0, SW_SHOW);
}
else {
@@ -222,19 +222,19 @@ void import_ping_address(int index, PINGADDRESS &pa) { char buf[256];
mir_snprintf(buf, "Address%d", index);
if (!db_get_ts(0, "PingPlug", buf, &dbv)) {
- mir_tstrncpy(pa.pszName, dbv.ptszVal, _countof(pa.pszName));
+ mir_wstrncpy(pa.pszName, dbv.ptszVal, _countof(pa.pszName));
db_free(&dbv);
}
else
- mir_tstrncpy(pa.pszName, TranslateT("Unknown Address"), _countof(pa.pszName));
+ mir_wstrncpy(pa.pszName, TranslateT("Unknown Address"), _countof(pa.pszName));
mir_snprintf(buf, "Label%d", index);
if (!db_get_ts(0, "PingPlug", buf, &dbv)) {
- mir_tstrncpy(pa.pszLabel, dbv.ptszVal, _countof(pa.pszLabel));
+ mir_wstrncpy(pa.pszLabel, dbv.ptszVal, _countof(pa.pszLabel));
db_free(&dbv);
}
else
- mir_tstrncpy(pa.pszLabel, TranslateT("Unknown"), _countof(pa.pszLabel));
+ mir_wstrncpy(pa.pszLabel, TranslateT("Unknown"), _countof(pa.pszLabel));
mir_snprintf(buf, "Port%d", index);
pa.port = (int)db_get_dw(0, "PingPlug", buf, -1);
diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp index 89ccf41904..7f28faab29 100644 --- a/plugins/PluginUpdater/src/DlgListNew.cpp +++ b/plugins/PluginUpdater/src/DlgListNew.cpp @@ -55,10 +55,10 @@ static void ApplyDownloads(void *param) //create needed folders after escalating priviledges. Folders creates when we actually install updates
wchar_t tszFileTemp[MAX_PATH], tszFileBack[MAX_PATH];
- mir_sntprintf(tszFileBack, L"%s\\Backups", g_tszRoot);
+ mir_snwprintf(tszFileBack, L"%s\\Backups", g_tszRoot);
SafeCreateDirectory(tszFileBack);
- mir_sntprintf(tszFileTemp, L"%s\\Temp", g_tszRoot);
+ mir_snwprintf(tszFileTemp, L"%s\\Temp", g_tszRoot);
SafeCreateDirectory(tszFileTemp);
VARST tszMirandaPath(L"%miranda_path%");
@@ -116,7 +116,7 @@ static LRESULT CALLBACK PluginListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LP wchar_t *p = wcschr(tszFileName, L'.'); *p = 0;
wchar_t link[MAX_PATH];
- mir_sntprintf(link, PLUGIN_INFO_URL, tszFileName);
+ mir_snwprintf(link, PLUGIN_INFO_URL, tszFileName);
Utils_OpenUrlT(link);
}
}
@@ -362,8 +362,8 @@ static FILEINFO* ServerEntryToFileInfo(const ServListEntry &hash, const wchar_t* tp = wcschr(tszRelFileName, L'\\'); if (tp) tp++; else tp = tszRelFileName;
wcslwr(tp);
- mir_sntprintf(FileInfo->File.tszDiskPath, L"%s\\Temp\\%s.zip", g_tszRoot, tszFileName);
- mir_sntprintf(FileInfo->File.tszDownloadURL, L"%s/%s.zip", tszBaseUrl, tszRelFileName);
+ mir_snwprintf(FileInfo->File.tszDiskPath, L"%s\\Temp\\%s.zip", g_tszRoot, tszFileName);
+ mir_snwprintf(FileInfo->File.tszDownloadURL, L"%s/%s.zip", tszBaseUrl, tszRelFileName);
for (tp = wcschr(FileInfo->File.tszDownloadURL, '\\'); tp != 0; tp = wcschr(tp, '\\'))
*tp++ = '/';
FileInfo->File.CRCsum = hash.m_crc;
@@ -385,7 +385,7 @@ static void GetList(void *) if (tszTempPath[dwLen-1] == '\\')
tszTempPath[dwLen-1] = 0;
- ptrT updateUrl( GetDefaultUrl()), baseUrl;
+ ptrW updateUrl( GetDefaultUrl()), baseUrl;
SERVLIST hashes(50, CompareHashes);
if (!ParseHashes(updateUrl, baseUrl, hashes)) {
hListThread = NULL;
@@ -399,7 +399,7 @@ static void GetList(void *) ServListEntry &hash = hashes[i];
wchar_t tszPath[MAX_PATH];
- mir_sntprintf(tszPath, L"%s\\%s", dirname, hash.m_name);
+ mir_snwprintf(tszPath, L"%s\\%s", dirname, hash.m_name);
if (GetFileAttributes(tszPath) == INVALID_FILE_ATTRIBUTES) {
FILEINFO *FileInfo = ServerEntryToFileInfo(hash, baseUrl, tszPath);
@@ -462,14 +462,14 @@ static INT_PTR ParseUriService(WPARAM, LPARAM lParam) return 1;
wchar_t pluginPath[MAX_PATH];
- mir_tstrcpy(pluginPath, p + 1);
+ mir_wstrcpy(pluginPath, p + 1);
p = wcschr(pluginPath, '/');
if (p) *p = '\\';
if (GetFileAttributes(pluginPath) != INVALID_FILE_ATTRIBUTES)
return 0;
- ptrT updateUrl(GetDefaultUrl()), baseUrl;
+ ptrW updateUrl(GetDefaultUrl()), baseUrl;
SERVLIST hashes(50, CompareHashes);
if (!ParseHashes(updateUrl, baseUrl, hashes)) {
hListThread = NULL;
@@ -482,7 +482,7 @@ static INT_PTR ParseUriService(WPARAM, LPARAM lParam) VARST dirName(L"%miranda_path%");
wchar_t tszPath[MAX_PATH];
- mir_sntprintf(tszPath, L"%s\\%s", dirName, hash->m_name);
+ mir_snwprintf(tszPath, L"%s\\%s", dirName, hash->m_name);
FILEINFO *fileInfo = ServerEntryToFileInfo(*hash, baseUrl, tszPath);
FILELIST *fileList = new FILELIST(1);
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp index 27f8377952..9f02de304d 100644 --- a/plugins/PluginUpdater/src/DlgUpdate.cpp +++ b/plugins/PluginUpdater/src/DlgUpdate.cpp @@ -61,9 +61,9 @@ static void ApplyUpdates(void *param) HWND hwndList = GetDlgItem(hDlg, IDC_LIST_UPDATES);
//create needed folders after escalating priviledges. Folders creates when we actually install updates
wchar_t tszFileTemp[MAX_PATH], tszFileBack[MAX_PATH];
- mir_sntprintf(tszFileBack, L"%s\\Backups", g_tszRoot);
+ mir_snwprintf(tszFileBack, L"%s\\Backups", g_tszRoot);
SafeCreateDirectory(tszFileBack);
- mir_sntprintf(tszFileTemp, L"%s\\Temp", g_tszRoot);
+ mir_snwprintf(tszFileTemp, L"%s\\Temp", g_tszRoot);
SafeCreateDirectory(tszFileTemp);
// 2) Download all plugins
@@ -103,7 +103,7 @@ static void ApplyUpdates(void *param) if (p.bDeleteOnly) {
// we need only to backup the old file
wchar_t *ptszRelPath = p.tszNewName + wcslen(tszMirandaPath) + 1, tszBackFile[MAX_PATH];
- mir_sntprintf(tszBackFile, L"%s\\%s", tszFileBack, ptszRelPath);
+ mir_snwprintf(tszBackFile, L"%s\\%s", tszFileBack, ptszRelPath);
BackupFile(p.tszNewName, tszBackFile);
}
else {
@@ -111,8 +111,8 @@ static void ApplyUpdates(void *param) // otherwise it would be replaced by unzip
if ( wcsicmp(p.tszOldName, p.tszNewName)) {
wchar_t tszSrcPath[MAX_PATH], tszBackFile[MAX_PATH];
- mir_sntprintf(tszSrcPath, L"%s\\%s", tszMirandaPath, p.tszOldName);
- mir_sntprintf(tszBackFile, L"%s\\%s", tszFileBack, p.tszOldName);
+ mir_snwprintf(tszSrcPath, L"%s\\%s", tszMirandaPath, p.tszOldName);
+ mir_snwprintf(tszBackFile, L"%s\\%s", tszFileBack, p.tszOldName);
BackupFile(tszSrcPath, tszBackFile);
}
@@ -125,7 +125,7 @@ static void ApplyUpdates(void *param) #if MIRANDA_VER < 0x0A00
// 4) Change title of clist
- ptrT title(db_get_tsa(NULL, "CList", "TitleText"));
+ ptrW title(db_get_tsa(NULL, "CList", "TitleText"));
if (!lstrcmpi(title, L"Miranda IM"))
db_set_ts(NULL, "CList", "TitleText", L"Miranda NG");
#endif
@@ -143,7 +143,7 @@ static void ApplyUpdates(void *param) db_unset(NULL, MODNAME, DB_SETTING_CHANGEPLATFORM);
}
else {
- ptrT oldbin(db_get_tsa(NULL, MODNAME, "OldBin2"));
+ ptrW oldbin(db_get_tsa(NULL, MODNAME, "OldBin2"));
if (oldbin) {
SafeDeleteFile(oldbin);
db_unset(NULL, MODNAME, "OldBin2");
@@ -165,9 +165,9 @@ static void ApplyUpdates(void *param) wchar_t mirstartpath[MAX_PATH];
#ifdef _WIN64
- mir_sntprintf(mirstartpath, L"%s\\miranda32.exe", tszMirandaPath);
+ mir_snwprintf(mirstartpath, L"%s\\miranda32.exe", tszMirandaPath);
#else
- mir_sntprintf(mirstartpath, L"%s\\miranda64.exe", tszMirandaPath);
+ mir_snwprintf(mirstartpath, L"%s\\miranda64.exe", tszMirandaPath);
#endif
CallServiceSync(MS_SYSTEM_RESTART, bRestartCurrentProfile, (LPARAM)mirstartpath);
}
@@ -412,10 +412,10 @@ static void DlgUpdateSilent(void *param) //create needed folders after escalating priviledges. Folders creates when we actually install updates
wchar_t tszFileTemp[MAX_PATH], tszFileBack[MAX_PATH];
- mir_sntprintf(tszFileBack, L"%s\\Backups", g_tszRoot);
+ mir_snwprintf(tszFileBack, L"%s\\Backups", g_tszRoot);
SafeCreateDirectory(tszFileBack);
- mir_sntprintf(tszFileTemp, L"%s\\Temp", g_tszRoot);
+ mir_snwprintf(tszFileTemp, L"%s\\Temp", g_tszRoot);
SafeCreateDirectory(tszFileTemp);
// 2) Download all plugins
@@ -453,7 +453,7 @@ static void DlgUpdateSilent(void *param) if (p.bDeleteOnly) {
// we need only to backup the old file
wchar_t *ptszRelPath = p.tszNewName + wcslen(tszMirandaPath) + 1, tszBackFile[MAX_PATH];
- mir_sntprintf(tszBackFile, L"%s\\%s", tszFileBack, ptszRelPath);
+ mir_snwprintf(tszBackFile, L"%s\\%s", tszFileBack, ptszRelPath);
BackupFile(p.tszNewName, tszBackFile);
}
else {
@@ -461,8 +461,8 @@ static void DlgUpdateSilent(void *param) // otherwise it would be replaced by unzip
if (wcsicmp(p.tszOldName, p.tszNewName)) {
wchar_t tszSrcPath[MAX_PATH], tszBackFile[MAX_PATH];
- mir_sntprintf(tszSrcPath, L"%s\\%s", tszMirandaPath, p.tszOldName);
- mir_sntprintf(tszBackFile, L"%s\\%s", tszFileBack, p.tszOldName);
+ mir_snwprintf(tszSrcPath, L"%s\\%s", tszMirandaPath, p.tszOldName);
+ mir_snwprintf(tszBackFile, L"%s\\%s", tszFileBack, p.tszOldName);
BackupFile(tszSrcPath, tszBackFile);
}
@@ -477,7 +477,7 @@ static void DlgUpdateSilent(void *param) #if MIRANDA_VER < 0x0A00
// 4) Change title of clist
- ptrT title = db_get_tsa(NULL, "CList", "TitleText");
+ ptrW title = db_get_tsa(NULL, "CList", "TitleText");
if (!wcsicmp(title, L"Miranda IM"))
db_set_ts(NULL, "CList", "TitleText", L"Miranda NG");
#endif
@@ -493,7 +493,7 @@ static void DlgUpdateSilent(void *param) // 5) Prepare Restart
wchar_t tszTitle[100];
- mir_sntprintf(tszTitle, TranslateT("%d component(s) was updated"), count);
+ mir_snwprintf(tszTitle, TranslateT("%d component(s) was updated"), count);
if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1)) {
ShowPopup(tszTitle,TranslateT("You need to restart your Miranda to apply installed updates."),POPUP_TYPE_MSG);
@@ -515,7 +515,7 @@ static void DlgUpdateSilent(void *param) if (!notified) {
// Error, let's try to show MessageBox as last way to inform user about successful update
wchar_t tszText[200];
- mir_sntprintf(tszText, L"%s\n\n%s", TranslateT("You need to restart your Miranda to apply installed updates."), TranslateT("Would you like to restart it now?"));
+ mir_snwprintf(tszText, L"%s\n\n%s", TranslateT("You need to restart your Miranda to apply installed updates."), TranslateT("Would you like to restart it now?"));
if (MessageBox(NULL, tszText, tszTitle, MB_ICONINFORMATION | MB_YESNO) == IDYES)
#if MIRANDA_VER >= 0x0A00
@@ -606,7 +606,7 @@ static renameTable[] = static bool CheckFileRename(const wchar_t *ptszOldName, wchar_t *pNewName)
{
for (int i = 0; i < _countof(renameTable); i++) {
- if (wildcmpit(ptszOldName, renameTable[i].oldName)) {
+ if (wildcmpiw(ptszOldName, renameTable[i].oldName)) {
wchar_t *ptszDest = renameTable[i].newName;
if (ptszDest == NULL)
*pNewName = 0;
@@ -642,7 +642,7 @@ static bool isValidDirectory(const wchar_t *ptszDirName) static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t *tszBaseUrl, SERVLIST& hashes, OBJLIST<FILEINFO> *UpdateFiles, int level = 0)
{
wchar_t tszBuf[MAX_PATH];
- mir_sntprintf(tszBuf, L"%s\\*", tszFolder);
+ mir_snwprintf(tszBuf, L"%s\\*", tszFolder);
WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile(tszBuf, &ffd);
@@ -656,7 +656,7 @@ static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
// Scan recursively all subfolders
if (isValidDirectory(ffd.cFileName)) {
- mir_sntprintf(tszBuf, L"%s\\%s", tszFolder, ffd.cFileName);
+ mir_snwprintf(tszBuf, L"%s\\%s", tszFolder, ffd.cFileName);
count += ScanFolder(tszBuf, cbBaseLen, tszBaseUrl, hashes, UpdateFiles, level + 1);
}
}
@@ -666,17 +666,17 @@ static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t if (CheckFileRename(ffd.cFileName, tszNewName)) {
Netlib_LogfT(hNetlibUser, L"File %s will be renamed to %s.", ffd.cFileName, tszNewName);
// Yes, we need the old file name, because this will be hashed later
- mir_sntprintf(tszBuf, L"%s\\%s", tszFolder, ffd.cFileName);
+ mir_snwprintf(tszBuf, L"%s\\%s", tszFolder, ffd.cFileName);
}
else {
if (level == 0) {
// Rename Miranda*.exe
- wcsncpy_s(tszNewName, opts.bChangePlatform && !mir_tstrcmpi(ffd.cFileName, OLD_FILENAME) ? NEW_FILENAME : ffd.cFileName, _TRUNCATE);
- mir_sntprintf(tszBuf, L"%s\\%s", tszFolder, tszNewName);
+ wcsncpy_s(tszNewName, opts.bChangePlatform && !mir_wstrcmpi(ffd.cFileName, OLD_FILENAME) ? NEW_FILENAME : ffd.cFileName, _TRUNCATE);
+ mir_snwprintf(tszBuf, L"%s\\%s", tszFolder, tszNewName);
}
else {
- mir_sntprintf(tszNewName, L"%s\\%s", tszFolder + cbBaseLen, ffd.cFileName);
- mir_sntprintf(tszBuf, L"%s\\%s", tszFolder, ffd.cFileName);
+ mir_snwprintf(tszNewName, L"%s\\%s", tszFolder + cbBaseLen, ffd.cFileName);
+ mir_snwprintf(tszBuf, L"%s\\%s", tszFolder, ffd.cFileName);
}
}
@@ -698,13 +698,13 @@ static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t // remove trailing w or W and try again
int iPos = int(p - tszNewName) - 1;
- strdelt(p - 1, 1);
+ strdelw(p - 1, 1);
if ((item = hashes.find((ServListEntry*)&pName)) == NULL) {
Netlib_LogfT(hNetlibUser, L"File %s: Not found on server, skipping", ffd.cFileName);
continue;
}
- strdelt(tszNewName + iPos, 1);
+ strdelw(tszNewName + iPos, 1);
}
#if MIRANDA_VER >= 0x0A00
@@ -761,8 +761,8 @@ static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t p = (p) ? p + 1 : tszBuf;
wcslwr(p);
- mir_sntprintf(FileInfo->File.tszDiskPath, L"%s\\Temp\\%s.zip", g_tszRoot, p);
- mir_sntprintf(FileInfo->File.tszDownloadURL, L"%s/%s.zip", tszBaseUrl, tszBuf);
+ mir_snwprintf(FileInfo->File.tszDiskPath, L"%s\\Temp\\%s.zip", g_tszRoot, p);
+ mir_snwprintf(FileInfo->File.tszDownloadURL, L"%s/%s.zip", tszBaseUrl, tszBuf);
for (p = wcschr(FileInfo->File.tszDownloadURL, '\\'); p != 0; p = wcschr(p, '\\'))
*p++ = '/';
@@ -797,7 +797,7 @@ static void CheckUpdates(void *) if (!opts.bSilent)
ShowPopup(TranslateT("Plugin Updater"), TranslateT("Checking for new updates..."), POPUP_TYPE_INFO);
- ptrT updateUrl(GetDefaultUrl()), baseUrl;
+ ptrW updateUrl(GetDefaultUrl()), baseUrl;
SERVLIST hashes(50, CompareHashes);
bool success = ParseHashes(updateUrl, baseUrl, hashes);
if (success) {
diff --git a/plugins/PluginUpdater/src/Notifications.cpp b/plugins/PluginUpdater/src/Notifications.cpp index 5741de81bd..819cf521e3 100644 --- a/plugins/PluginUpdater/src/Notifications.cpp +++ b/plugins/PluginUpdater/src/Notifications.cpp @@ -71,7 +71,7 @@ static LRESULT CALLBACK PopupDlgProc(HWND hPopup, UINT uMsg, WPARAM wParam, LPAR static void _stdcall RestartPrompt(void *)
{
wchar_t tszText[200];
- mir_sntprintf(tszText, L"%s\n\n%s", TranslateT("You need to restart your Miranda to apply installed updates."), TranslateT("Would you like to restart it now?"));
+ mir_snwprintf(tszText, L"%s\n\n%s", TranslateT("You need to restart your Miranda to apply installed updates."), TranslateT("Would you like to restart it now?"));
if (MessageBox(0, tszText, TranslateT("Plugin Updater"), MB_YESNO | MB_ICONQUESTION | MB_TOPMOST) == IDYES)
CallService(MS_SYSTEM_RESTART, db_get_b(NULL, MODNAME, "RestartCurrentProfile", 1) ? 1 : 0, 0);
diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp index 5d54e559fe..38dd4d5802 100644 --- a/plugins/PluginUpdater/src/Options.cpp +++ b/plugins/PluginUpdater/src/Options.cpp @@ -33,7 +33,7 @@ static int GetUpdateMode() // Check if there is url for custom mode
if (UpdateMode == UPDATE_MODE_CUSTOM) {
- ptrT url(db_get_tsa(NULL, MODNAME, DB_SETTING_UPDATE_URL));
+ ptrW url(db_get_tsa(NULL, MODNAME, DB_SETTING_UPDATE_URL));
if (url == NULL || !wcslen(url)) {
// No url for custom mode, reset that setting so it will be determined automatically
db_unset(NULL, MODNAME, DB_SETTING_UPDATE_MODE);
@@ -56,14 +56,14 @@ wchar_t* GetDefaultUrl() wchar_t url[MAX_PATH];
switch (GetUpdateMode()) {
case UPDATE_MODE_STABLE:
- mir_sntprintf(url, DEFAULT_UPDATE_URL, opts.bChangePlatform ? DEFAULT_OPP_BITS : DEFAULT_BITS);
- return mir_tstrdup(url);
+ mir_snwprintf(url, DEFAULT_UPDATE_URL, opts.bChangePlatform ? DEFAULT_OPP_BITS : DEFAULT_BITS);
+ return mir_wstrdup(url);
case UPDATE_MODE_TRUNK:
- mir_sntprintf(url, DEFAULT_UPDATE_URL_TRUNK, opts.bChangePlatform ? DEFAULT_OPP_BITS : DEFAULT_BITS);
- return mir_tstrdup(url);
+ mir_snwprintf(url, DEFAULT_UPDATE_URL_TRUNK, opts.bChangePlatform ? DEFAULT_OPP_BITS : DEFAULT_BITS);
+ return mir_wstrdup(url);
case UPDATE_MODE_TRUNK_SYMBOLS:
- mir_sntprintf(url, DEFAULT_UPDATE_URL_TRUNK_SYMBOLS, opts.bChangePlatform ? DEFAULT_OPP_BITS : DEFAULT_BITS);
- return mir_tstrdup(url);
+ mir_snwprintf(url, DEFAULT_UPDATE_URL_TRUNK_SYMBOLS, opts.bChangePlatform ? DEFAULT_OPP_BITS : DEFAULT_BITS);
+ return mir_wstrdup(url);
default:
return db_get_tsa(NULL, MODNAME, DB_SETTING_UPDATE_URL);
}
@@ -121,17 +121,17 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar switch (GetUpdateMode()) {
case UPDATE_MODE_STABLE:
- mir_sntprintf(defurl, DEFAULT_UPDATE_URL, GetBits(hwndDlg));
+ mir_snwprintf(defurl, DEFAULT_UPDATE_URL, GetBits(hwndDlg));
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
CheckDlgButton(hwndDlg, IDC_STABLE, BST_CHECKED);
break;
case UPDATE_MODE_TRUNK:
- mir_sntprintf(defurl, DEFAULT_UPDATE_URL_TRUNK, GetBits(hwndDlg));
+ mir_snwprintf(defurl, DEFAULT_UPDATE_URL_TRUNK, GetBits(hwndDlg));
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
CheckDlgButton(hwndDlg, IDC_TRUNK, BST_CHECKED);
break;
case UPDATE_MODE_TRUNK_SYMBOLS:
- mir_sntprintf(defurl, DEFAULT_UPDATE_URL_TRUNK_SYMBOLS, GetBits(hwndDlg));
+ mir_snwprintf(defurl, DEFAULT_UPDATE_URL_TRUNK_SYMBOLS, GetBits(hwndDlg));
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
CheckDlgButton(hwndDlg, IDC_TRUNK_SYMBOLS, BST_CHECKED);
break;
@@ -140,7 +140,7 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE_PLATFORM), FALSE);
- ptrT url(db_get_tsa(NULL, MODNAME, DB_SETTING_UPDATE_URL));
+ ptrW url(db_get_tsa(NULL, MODNAME, DB_SETTING_UPDATE_URL));
if (url == NULL)
url = GetDefaultUrl();
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, url);
@@ -181,7 +181,7 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar case IDC_TRUNK_SYMBOLS:
EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE_PLATFORM), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE);
- mir_sntprintf(defurl, DEFAULT_UPDATE_URL_TRUNK_SYMBOLS, GetBits(hwndDlg));
+ mir_snwprintf(defurl, DEFAULT_UPDATE_URL_TRUNK_SYMBOLS, GetBits(hwndDlg));
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
@@ -189,7 +189,7 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar case IDC_TRUNK:
EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE_PLATFORM), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE);
- mir_sntprintf(defurl, DEFAULT_UPDATE_URL_TRUNK, GetBits(hwndDlg));
+ mir_snwprintf(defurl, DEFAULT_UPDATE_URL_TRUNK, GetBits(hwndDlg));
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
@@ -197,7 +197,7 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar case IDC_STABLE:
EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE_PLATFORM), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE);
- mir_sntprintf(defurl, DEFAULT_UPDATE_URL, GetBits(hwndDlg));
+ mir_snwprintf(defurl, DEFAULT_UPDATE_URL, GetBits(hwndDlg));
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
@@ -206,7 +206,7 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE_PLATFORM), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), TRUE);
{
- ptrT url(db_get_tsa(NULL, MODNAME, DB_SETTING_UPDATE_URL));
+ ptrW url(db_get_tsa(NULL, MODNAME, DB_SETTING_UPDATE_URL));
if (url == NULL)
url = GetDefaultUrl();
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, url);
@@ -227,15 +227,15 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar case IDC_CHANGE_PLATFORM:
if (IsDlgButtonChecked(hwndDlg, IDC_STABLE)) {
- mir_sntprintf(defurl, DEFAULT_UPDATE_URL, GetBits(hwndDlg));
+ mir_snwprintf(defurl, DEFAULT_UPDATE_URL, GetBits(hwndDlg));
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
}
else if (IsDlgButtonChecked(hwndDlg, IDC_TRUNK)) {
- mir_sntprintf(defurl, DEFAULT_UPDATE_URL_TRUNK, GetBits(hwndDlg));
+ mir_snwprintf(defurl, DEFAULT_UPDATE_URL_TRUNK, GetBits(hwndDlg));
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
}
else if (IsDlgButtonChecked(hwndDlg, IDC_TRUNK_SYMBOLS)) {
- mir_sntprintf(defurl, DEFAULT_UPDATE_URL_TRUNK_SYMBOLS, GetBits(hwndDlg));
+ mir_snwprintf(defurl, DEFAULT_UPDATE_URL_TRUNK_SYMBOLS, GetBits(hwndDlg));
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
}
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
diff --git a/plugins/PluginUpdater/src/PluginUpdater.cpp b/plugins/PluginUpdater/src/PluginUpdater.cpp index d5b1b23564..3a2a2fdb1d 100644 --- a/plugins/PluginUpdater/src/PluginUpdater.cpp +++ b/plugins/PluginUpdater/src/PluginUpdater.cpp @@ -132,7 +132,7 @@ extern "C" __declspec(dllexport) int Load(void) #if MIRANDA_VER >= 0x0A00
// Upgrade old settings
if (-1 == db_get_b(0, MODNAME, DB_SETTING_UPDATE_MODE, -1)) {
- ptrT dbvUpdateURL(db_get_tsa(0, MODNAME, DB_SETTING_UPDATE_URL));
+ ptrW dbvUpdateURL(db_get_tsa(0, MODNAME, DB_SETTING_UPDATE_URL));
if (dbvUpdateURL) {
if (!wcscmp(dbvUpdateURL, _A2W(DEFAULT_UPDATE_URL_OLD))) {
db_set_b(0, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE);
diff --git a/plugins/PluginUpdater/src/Services.cpp b/plugins/PluginUpdater/src/Services.cpp index bd12b68f17..698fac6021 100644 --- a/plugins/PluginUpdater/src/Services.cpp +++ b/plugins/PluginUpdater/src/Services.cpp @@ -27,7 +27,7 @@ static INT_PTR srvParseHashes(WPARAM wParam, LPARAM lParam) return NULL;
SERVLIST *pList = new SERVLIST(50, CompareHashes);
- ptrT baseUrl;
+ ptrW baseUrl;
if ( ParseHashes(ptszUrl, baseUrl, *pList)) {
wcsncpy(ptszBaseUrl, baseUrl, MAX_PATH);
return (INT_PTR)pList;
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index 00009c75d1..26b395a1c4 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -128,7 +128,7 @@ int CompareHashes(const ServListEntry *p1, const ServListEntry *p2) return wcsicmp(p1->m_name, p2->m_name);
}
-bool ParseHashes(const wchar_t *ptszUrl, ptrT &baseUrl, SERVLIST &arHashes)
+bool ParseHashes(const wchar_t *ptszUrl, ptrW &baseUrl, SERVLIST &arHashes)
{
REPLACEVARSARRAY vars[2];
#if MIRANDA_VER >=0x0A00
@@ -152,8 +152,8 @@ bool ParseHashes(const wchar_t *ptszUrl, ptrT &baseUrl, SERVLIST &arHashes) // Download version info
FILEURL pFileUrl;
- mir_sntprintf(pFileUrl.tszDownloadURL, L"%s/hashes.zip", baseUrl);
- mir_sntprintf(pFileUrl.tszDiskPath, L"%s\\hashes.zip", g_tszTempPath);
+ mir_snwprintf(pFileUrl.tszDownloadURL, L"%s/hashes.zip", baseUrl);
+ mir_snwprintf(pFileUrl.tszDiskPath, L"%s\\hashes.zip", g_tszTempPath);
pFileUrl.CRCsum = 0;
HANDLE nlc;
@@ -177,7 +177,7 @@ bool ParseHashes(const wchar_t *ptszUrl, ptrT &baseUrl, SERVLIST &arHashes) DeleteFile(pFileUrl.tszDiskPath);
wchar_t tszTmpIni[MAX_PATH] = {0};
- mir_sntprintf(tszTmpIni, L"%s\\hashes.txt", g_tszTempPath);
+ mir_snwprintf(tszTmpIni, L"%s\\hashes.txt", g_tszTempPath);
FILE *fp = _wfopen(tszTmpIni, L"r");
if (!fp) {
Netlib_LogfT(hNetlibUser,L"Opening %s failed", g_tszTempPath);
@@ -243,7 +243,7 @@ bool DownloadFile(FILEURL *pFileURL, HANDLE &nlc) #endif
nlhr.requestType = REQUEST_GET;
nlhr.nlc = nlc;
- char *szUrl = mir_t2a(pFileURL->tszDownloadURL);
+ char *szUrl = mir_u2a(pFileURL->tszDownloadURL);
nlhr.szUrl = szUrl;
nlhr.headersCount = 4;
nlhr.headers=(NETLIBHTTPHEADER*)mir_alloc(sizeof(NETLIBHTTPHEADER)*nlhr.headersCount);
@@ -285,7 +285,7 @@ bool DownloadFile(FILEURL *pFileURL, HANDLE &nlc) else {
// try to write it via PU stub
wchar_t tszTempFile[MAX_PATH];
- mir_sntprintf(tszTempFile, L"%s\\pulocal.tmp", g_tszTempPath);
+ mir_snwprintf(tszTempFile, L"%s\\pulocal.tmp", g_tszTempPath);
hFile = CreateFile(tszTempFile, GENERIC_READ | GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile != INVALID_HANDLE_VALUE) {
DWORD dwBytes;
@@ -502,7 +502,7 @@ bool PrepareEscalation() else {
// Elevate the process. Create a pipe for a stub first
wchar_t tszPipeName[MAX_PATH];
- mir_sntprintf(tszPipeName, L"\\\\.\\pipe\\Miranda_Pu_%d", GetCurrentProcessId());
+ mir_snwprintf(tszPipeName, L"\\\\.\\pipe\\Miranda_Pu_%d", GetCurrentProcessId());
hPipe = CreateNamedPipe(tszPipeName, PIPE_ACCESS_DUPLEX, PIPE_READMODE_BYTE | PIPE_WAIT, 1, 1024, 1024, NMPWAIT_USE_DEFAULT_WAIT, NULL);
if (hPipe == INVALID_HANDLE_VALUE) {
hPipe = NULL;
@@ -512,7 +512,7 @@ bool PrepareEscalation() GetModuleFileName(NULL, szPath, ARRAYSIZE(szPath));
if ((p = wcsrchr(szPath, '\\')) != 0)
wcscpy(p+1, L"pu_stub.exe");
- mir_sntprintf(cmdLine, L"%d", GetCurrentProcessId());
+ mir_snwprintf(cmdLine, L"%d", GetCurrentProcessId());
// Launch a stub
SHELLEXECUTEINFO sei = { sizeof(sei) };
diff --git a/plugins/PluginUpdater/src/stdafx.h b/plugins/PluginUpdater/src/stdafx.h index 2fa09762b7..096ef9e247 100644 --- a/plugins/PluginUpdater/src/stdafx.h +++ b/plugins/PluginUpdater/src/stdafx.h @@ -188,7 +188,7 @@ public: struct ServListEntry
{
ServListEntry(const char* _name, const char* _hash, int _crc) :
- m_name( mir_a2t(_name)),
+ m_name( mir_a2u(_name)),
m_crc(_crc)
{
strncpy(m_szHash, _hash, sizeof(m_szHash));
@@ -225,7 +225,7 @@ void UnloadNetlib(); void BackupFile(wchar_t *ptszSrcFileName, wchar_t *ptszBackFileName);
-bool ParseHashes(const wchar_t *ptszUrl, ptrT &baseUrl, SERVLIST &arHashes);
+bool ParseHashes(const wchar_t *ptszUrl, ptrW &baseUrl, SERVLIST &arHashes);
int CompareHashes(const ServListEntry *p1, const ServListEntry *p2);
wchar_t* GetDefaultUrl();
diff --git a/plugins/PluginUpdater/src/unzipfile.cpp b/plugins/PluginUpdater/src/unzipfile.cpp index 979dcd289e..7698e056a0 100644 --- a/plugins/PluginUpdater/src/unzipfile.cpp +++ b/plugins/PluginUpdater/src/unzipfile.cpp @@ -32,7 +32,7 @@ extern "C" static void PrepareFileName(wchar_t *dest, size_t destSize, const wchar_t *ptszPath, const wchar_t *ptszFileName)
{
- mir_sntprintf(dest, destSize, L"%s\\%s", ptszPath, ptszFileName);
+ mir_snwprintf(dest, destSize, L"%s\\%s", ptszPath, ptszFileName);
for (wchar_t *p = dest; *p; ++p)
if (*p == '/')
@@ -57,9 +57,9 @@ bool extractCurrentFile(unzFile uf, wchar_t *ptszDestPath, wchar_t *ptszBackPath return true;
wchar_t tszDestFile[MAX_PATH], tszBackFile[MAX_PATH];
- wchar_t *ptszNewName = mir_utf8decodeT(filename);
+ wchar_t *ptszNewName = mir_utf8decodeW(filename);
if (ptszNewName == NULL)
- ptszNewName = mir_a2t(filename);
+ ptszNewName = mir_a2u(filename);
if (!(file_info.external_fa & FILE_ATTRIBUTE_DIRECTORY)) {
err = unzOpenCurrentFile(uf);
diff --git a/plugins/Popup/src/actions.cpp b/plugins/Popup/src/actions.cpp index 92ae2f282b..5a84d99d0e 100644 --- a/plugins/Popup/src/actions.cpp +++ b/plugins/Popup/src/actions.cpp @@ -236,9 +236,9 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM LVGROUP group = { 0 };
group.cbSize = sizeof(group);
group.mask = LVGF_HEADER | LVGF_GROUPID;
- LPTSTR wszGroup = mir_a2t(szGroup);
+ LPTSTR wszGroup = mir_a2u(szGroup);
group.pszHeader = TranslateTS(wszGroup);
- group.cchHeader = (int)mir_tstrlen(wszGroup);
+ group.cchHeader = (int)mir_wstrlen(wszGroup);
grpId = group.iGroupId = groups.getCount();
ListView_InsertGroup(hwndList, -1, &group);
mir_free(wszGroup);
@@ -248,7 +248,7 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM LVITEM item = { 0 };
item.mask = LVIF_IMAGE | LVIF_PARAM | LVIF_TEXT | LVIF_STATE | LVIF_INDENT;
item.iItem = i;
- ptrT tszName(mir_a2t(szName));
+ ptrW tszName(mir_a2u(szName));
item.pszText = TranslateTS(tszName);
item.iImage = ImageList_AddIcon(hImgList, gActions[i]->lchIcon);
item.lParam = i;
diff --git a/plugins/Popup/src/avatars.cpp b/plugins/Popup/src/avatars.cpp index 4f278f3572..73bd43ede4 100644 --- a/plugins/Popup/src/avatars.cpp +++ b/plugins/Popup/src/avatars.cpp @@ -28,8 +28,8 @@ PopupAvatar *PopupAvatar::create(MCONTACT hContact) if (hContact) {
if (ServiceExists(MS_AV_GETAVATARBITMAP)) {
avatarCacheEntry *av = (avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, hContact, 0);
- if (av && (mir_tstrlen(av->szFilename) > 4))
- if (!mir_tstrcmpi(av->szFilename + mir_tstrlen(av->szFilename) - 4, L".gif"))
+ if (av && (mir_wstrlen(av->szFilename) > 4))
+ if (!mir_wstrcmpi(av->szFilename + mir_wstrlen(av->szFilename) - 4, L".gif"))
if (db_get_b(NULL, MODULNAME, "EnableGifAnimation", 1) && GDIPlus_IsAnimatedGIF(av->szFilename))
return new GifAvatar(hContact);
}
diff --git a/plugins/Popup/src/bitmap_funcs.cpp b/plugins/Popup/src/bitmap_funcs.cpp index 9e2c094464..945be3e482 100644 --- a/plugins/Popup/src/bitmap_funcs.cpp +++ b/plugins/Popup/src/bitmap_funcs.cpp @@ -596,7 +596,7 @@ void MyBitmap::DrawIcon(HICON hic, int x, int y, int w, int h) void MyBitmap::Draw_Text(wchar_t *str, int x, int y)
{
- SIZE sz; GetTextExtentPoint32(this->getDC(), str, (int)mir_tstrlen(str), &sz);
+ SIZE sz; GetTextExtentPoint32(this->getDC(), str, (int)mir_wstrlen(str), &sz);
RECT rc; SetRect(&rc, x, y, x + 10000, y + 10000);
this->saveAlpha(x, y, sz.cx, sz.cy);
DrawText(this->getDC(), str, -1, &rc, DT_LEFT | DT_TOP | DT_SINGLELINE | DT_NOPREFIX);
@@ -680,7 +680,7 @@ bool MyBitmap::loadFromFile_pixel(const wchar_t *fn) {
allocate(1, 1);
int r, g, b, a = 255;
- const wchar_t *p = fn + mir_tstrlen(L"pixel:");
+ const wchar_t *p = fn + mir_wstrlen(L"pixel:");
r = (hex2dec(p[0]) << 4) + hex2dec(p[1]);
g = (hex2dec(p[2]) << 4) + hex2dec(p[3]);
b = (hex2dec(p[4]) << 4) + hex2dec(p[5]);
@@ -690,7 +690,7 @@ bool MyBitmap::loadFromFile_pixel(const wchar_t *fn) bool MyBitmap::loadFromFile_gradient(const wchar_t *fn)
{
- const wchar_t *p = fn + mir_tstrlen(L"gradient:");
+ const wchar_t *p = fn + mir_wstrlen(L"gradient:");
if (*p == 'h') allocate(256, 1);
else allocate(1, 256);
@@ -724,10 +724,10 @@ bool MyBitmap::loadFromFile(const wchar_t *fn) {
if (bits) freemem();
- if (!wcsncmp(fn, L"pixel:", mir_tstrlen(L"pixel:")))
+ if (!wcsncmp(fn, L"pixel:", mir_wstrlen(L"pixel:")))
return loadFromFile_pixel(fn);
- if (!wcsncmp(fn, L"gradient:", mir_tstrlen(L"gradient:")))
+ if (!wcsncmp(fn, L"gradient:", mir_wstrlen(L"gradient:")))
return loadFromFile_gradient(fn);
SIZE sz;
diff --git a/plugins/Popup/src/common.h b/plugins/Popup/src/common.h index 28eac5417f..5fff5e0444 100644 --- a/plugins/Popup/src/common.h +++ b/plugins/Popup/src/common.h @@ -70,9 +70,9 @@ inline INT_PTR DBGetContactSettingStringX(MCONTACT hContact, const char *ModuleN break;
case DBVT_TCHAR:
if (!result)
- ret = (INT_PTR)mir_tstrdup(dbv.ptszVal);
+ ret = (INT_PTR)mir_wstrdup(dbv.ptszVal);
else
- ret = (INT_PTR)mir_a2t(Default);
+ ret = (INT_PTR)mir_a2u(Default);
break;
}
if (!result)
@@ -89,7 +89,7 @@ inline void AddTooltipTranslated(HWND hwndToolTip, HWND hwnd, int id, RECT rc, c ti.uId = id;
SendMessage(hwndToolTip, TTM_DELTOOL, 0, (LPARAM)&ti);
- LPTSTR wtext = mir_a2t(text);
+ LPTSTR wtext = mir_a2u(text);
ti.uFlags = TTF_SUBCLASS;
ti.hwnd = hwnd;
diff --git a/plugins/Popup/src/font.cpp b/plugins/Popup/src/font.cpp index 56b9c26eca..23a6156b55 100644 --- a/plugins/Popup/src/font.cpp +++ b/plugins/Popup/src/font.cpp @@ -30,52 +30,52 @@ void InitFonts() // Fonts
FontIDT fid = { 0 };
fid.cbSize = sizeof(FontIDT);
- mir_tstrncpy(fid.group, PU_FNT_AND_COLORW, _countof(fid.group));
+ mir_wstrncpy(fid.group, PU_FNT_AND_COLORW, _countof(fid.group));
mir_strncpy(fid.dbSettingsGroup, PU_FNT_AND_COLOR_DB, _countof(fid.dbSettingsGroup));
fid.flags = FIDF_DEFAULTVALID;
fid.deffontsettings.charset = DEFAULT_CHARSET;
fid.deffontsettings.size = -11;
- mir_tstrncpy(fid.backgroundGroup, PU_FNT_AND_COLORW, _countof(fid.backgroundGroup));
- mir_tstrncpy(fid.backgroundName, PU_COL_BACK_NAME, _countof(fid.backgroundName));
- mir_tstrncpy(fid.deffontsettings.szFace, L"Tahoma", _countof(fid.deffontsettings.szFace));
+ mir_wstrncpy(fid.backgroundGroup, PU_FNT_AND_COLORW, _countof(fid.backgroundGroup));
+ mir_wstrncpy(fid.backgroundName, PU_COL_BACK_NAME, _countof(fid.backgroundName));
+ mir_wstrncpy(fid.deffontsettings.szFace, L"Tahoma", _countof(fid.deffontsettings.szFace));
- mir_tstrncpy(fid.name, PU_FNT_NAME_TITLE, _countof(fid.name));
+ mir_wstrncpy(fid.name, PU_FNT_NAME_TITLE, _countof(fid.name));
mir_snprintf(fid.prefix, PU_FNT_PREFIX, PU_FNT_NAME_TITLE);
fid.deffontsettings.style = DBFONTF_BOLD;
fid.deffontsettings.colour = RGB(0, 0, 0);
FontRegisterT(&fid);
- mir_tstrncpy(fid.name, PU_FNT_NAME_CLOCK, _countof(fid.name));
+ mir_wstrncpy(fid.name, PU_FNT_NAME_CLOCK, _countof(fid.name));
mir_snprintf(fid.prefix, PU_FNT_PREFIX, PU_FNT_NAME_CLOCK);
FontRegisterT(&fid);
- mir_tstrncpy(fid.name, PU_FNT_NAME_TEXT, _countof(fid.name));
+ mir_wstrncpy(fid.name, PU_FNT_NAME_TEXT, _countof(fid.name));
mir_snprintf(fid.prefix, PU_FNT_PREFIX, PU_FNT_NAME_TEXT);
fid.deffontsettings.style = 0;
FontRegisterT(&fid);
- mir_tstrncpy(fid.name, PU_FNT_NAME_ACTION, _countof(fid.name));
+ mir_wstrncpy(fid.name, PU_FNT_NAME_ACTION, _countof(fid.name));
mir_snprintf(fid.prefix, PU_FNT_PREFIX, PU_FNT_NAME_ACTION);
fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS;
fid.deffontsettings.colour = RGB(0, 0, 255);
FontRegisterT(&fid);
- mir_tstrncpy(fid.name, PU_FNT_NAME_HOVERED_ACTION, _countof(fid.name));
+ mir_wstrncpy(fid.name, PU_FNT_NAME_HOVERED_ACTION, _countof(fid.name));
mir_snprintf(fid.prefix, PU_FNT_PREFIX, PU_FNT_NAME_HOVERED_ACTION);
fid.deffontsettings.style = DBFONTF_UNDERLINE;
FontRegisterT(&fid);
ColourIDT cid = { 0 };
cid.cbSize = sizeof(ColourIDT);
- mir_tstrncpy(cid.group, PU_FNT_AND_COLORW, _countof(cid.group));
+ mir_wstrncpy(cid.group, PU_FNT_AND_COLORW, _countof(cid.group));
mir_strncpy(cid.dbSettingsGroup, PU_FNT_AND_COLOR_DB, _countof(cid.dbSettingsGroup));
- mir_tstrncpy(cid.name, PU_COL_BACK_NAME, _countof(cid.name));
+ mir_wstrncpy(cid.name, PU_COL_BACK_NAME, _countof(cid.name));
mir_strncpy(cid.setting, PU_COL_BACK_SETTING, _countof(cid.setting));
cid.defcolour = SETTING_BACKCOLOUR_DEFAULT;
ColourRegisterT(&cid);
- mir_tstrncpy(cid.name, PU_COL_AVAT_NAME, _countof(cid.name));
+ mir_wstrncpy(cid.name, PU_COL_AVAT_NAME, _countof(cid.name));
mir_strncpy(cid.setting, PU_COL_AVAT_SETTING, _countof(cid.setting));
cid.defcolour = SETTING_TEXTCOLOUR_DEFAULT;
ColourRegisterT(&cid);
@@ -95,36 +95,36 @@ void ReloadFonts() LOGFONT lf = { 0 };
FontIDT fid = { 0 };
fid.cbSize = sizeof(FontIDT);
- mir_tstrncpy(fid.group, PU_FNT_AND_COLORW, _countof(fid.name));
+ mir_wstrncpy(fid.group, PU_FNT_AND_COLORW, _countof(fid.name));
- mir_tstrncpy(fid.name, PU_FNT_NAME_TITLE, _countof(fid.name));
+ mir_wstrncpy(fid.name, PU_FNT_NAME_TITLE, _countof(fid.name));
fonts.clTitle = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf);
fonts.title = CreateFontIndirect(&lf);
- mir_tstrncpy(fid.name, PU_FNT_NAME_CLOCK, _countof(fid.name));
+ mir_wstrncpy(fid.name, PU_FNT_NAME_CLOCK, _countof(fid.name));
fonts.clClock = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf);
fonts.clock = CreateFontIndirect(&lf);
- mir_tstrncpy(fid.name, PU_FNT_NAME_TEXT, _countof(fid.name));
+ mir_wstrncpy(fid.name, PU_FNT_NAME_TEXT, _countof(fid.name));
fonts.clText = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf);
fonts.text = CreateFontIndirect(&lf);
- mir_tstrncpy(fid.name, PU_FNT_NAME_ACTION, _countof(fid.name));
+ mir_wstrncpy(fid.name, PU_FNT_NAME_ACTION, _countof(fid.name));
fonts.clAction = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf);
fonts.action = CreateFontIndirect(&lf);
- mir_tstrncpy(fid.name, PU_FNT_NAME_HOVERED_ACTION, _countof(fid.name));
+ mir_wstrncpy(fid.name, PU_FNT_NAME_HOVERED_ACTION, _countof(fid.name));
fonts.clActionHover = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf);
fonts.actionHover = CreateFontIndirect(&lf);
ColourIDT cid = { 0 };
cid.cbSize = sizeof(ColourIDT);
- mir_tstrncpy(cid.group, PU_FNT_AND_COLORW, _countof(cid.group));
- mir_tstrncpy(cid.name, PU_COL_BACK_NAME, _countof(cid.name));
+ mir_wstrncpy(cid.group, PU_FNT_AND_COLORW, _countof(cid.group));
+ mir_wstrncpy(cid.name, PU_COL_BACK_NAME, _countof(cid.name));
fonts.clBack = (COLORREF)CallService(MS_COLOUR_GETT, (WPARAM)&cid, (LPARAM)&lf);
- mir_tstrncpy(cid.group, PU_FNT_AND_COLORW, _countof(cid.group));
- mir_tstrncpy(cid.name, PU_COL_AVAT_NAME, _countof(cid.name));
+ mir_wstrncpy(cid.group, PU_FNT_AND_COLORW, _countof(cid.group));
+ mir_wstrncpy(cid.name, PU_COL_AVAT_NAME, _countof(cid.name));
fonts.clAvatarBorder = (COLORREF)CallService(MS_COLOUR_GETT, (WPARAM)&cid, (LPARAM)&lf);
// update class popupps(only temp at this point, must rework)
diff --git a/plugins/Popup/src/font.h b/plugins/Popup/src/font.h index 0967bb4c12..c94739c13f 100644 --- a/plugins/Popup/src/font.h +++ b/plugins/Popup/src/font.h @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define PU_FNT_AND_COLOR_DB MODULNAME //use eg mir_strcpy(fid.dbSettingsGroup, PU_FNT_GROUP_DB);
#define PU_FNT_PREFIX "fnt%s" //use eg mir_snprintf(fid.prefix, _countof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_....);
-#define PU_FNT_NAME_TITLE LPGENW("Title") //use eg mir_tstrcpy(fid.name, _T(FNT_NAME_....)) for FontIDT
+#define PU_FNT_NAME_TITLE LPGENW("Title") //use eg mir_wstrcpy(fid.name, _T(FNT_NAME_....)) for FontIDT
#define PU_FNT_NAME_CLOCK LPGENW("Clock")
#define PU_FNT_NAME_TEXT LPGENW("Text")
#define PU_FNT_NAME_ACTION LPGENW("Action")
diff --git a/plugins/Popup/src/formula.h b/plugins/Popup/src/formula.h index 0abbc50565..65a9eae3ee 100644 --- a/plugins/Popup/src/formula.h +++ b/plugins/Popup/src/formula.h @@ -79,10 +79,10 @@ private: int eval_atom(wchar_t *&s, Args *args, bool *vars) const;
public:
- Formula() :m_str(mir_tstrdup(L"")) {}
- Formula(wchar_t *s) :m_str(mir_tstrdup(s)) {}
+ Formula() :m_str(mir_wstrdup(L"")) {}
+ Formula(wchar_t *s) :m_str(mir_wstrdup(s)) {}
~Formula() { mir_free(m_str); }
- void set(wchar_t *s){ mir_free(m_str); m_str = mir_tstrdup(s); }
+ void set(wchar_t *s){ mir_free(m_str); m_str = mir_wstrdup(s); }
int eval(Args *args, bool *vars = 0) const;
};
diff --git a/plugins/Popup/src/history.cpp b/plugins/Popup/src/history.cpp index daf8e90a73..4746c4d4a9 100644 --- a/plugins/Popup/src/history.cpp +++ b/plugins/Popup/src/history.cpp @@ -74,8 +74,8 @@ void PopupHistoryAdd(POPUPDATA2 *ppdNew) POPUPDATA2 *ppd = (POPUPDATA2*)mir_alloc(sizeof(POPUPDATA2));
*ppd = *ppdNew;
if (ppd->flags & PU2_UNICODE) {
- ppd->lptzTitle = mir_tstrdup(ppd->lpwzTitle);
- ppd->lptzText = mir_tstrdup(ppd->lptzText);
+ ppd->lptzTitle = mir_wstrdup(ppd->lpwzTitle);
+ ppd->lptzText = mir_wstrdup(ppd->lptzText);
}
else {
ppd->lpzTitle = mir_strdup(ppd->lpzTitle);
diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index ff38a8977a..b572ae477c 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -265,7 +265,7 @@ static int ModulesLoaded(WPARAM, LPARAM) const PopupSkin *skin;
if (skin = skins.getSkin(PopupOptions.SkinPack)) {
mir_free(PopupOptions.SkinPack);
- PopupOptions.SkinPack = mir_tstrdup(skin->getName());
+ PopupOptions.SkinPack = mir_wstrdup(skin->getName());
skin->loadOpts();
}
// init PopupEfects
diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp index 9958db8c7d..ad176ca7ed 100644 --- a/plugins/Popup/src/notifications.cpp +++ b/plugins/Popup/src/notifications.cpp @@ -29,9 +29,9 @@ HANDLE g_hntfError, g_hntfWarning, g_hntfNotification; int TreeDataSortFunc(const POPUPTREEDATA *p1, const POPUPTREEDATA *p2)
{
- if (int cmp = mir_tstrcmp(p1->pszTreeRoot, p2->pszTreeRoot))
+ if (int cmp = mir_wstrcmp(p1->pszTreeRoot, p2->pszTreeRoot))
return cmp;
- return mir_tstrcmp(p1->pszDescription, p2->pszDescription);
+ return mir_wstrcmp(p1->pszDescription, p2->pszDescription);
}
LIST<POPUPTREEDATA> gTreeData(20, TreeDataSortFunc);
@@ -172,8 +172,8 @@ HANDLE RegisterNotification(POPUPNOTIFICATION *notification) POPUPTREEDATA *ptd = (POPUPTREEDATA *)mir_alloc(sizeof(POPUPTREEDATA));
ptd->signature = PopupNotificationData_SIGNATURE;
ptd->typ = 1;
- ptd->pszTreeRoot = mir_a2t(notification->lpzGroup);
- ptd->pszDescription = mir_a2t(notification->lpzName);
+ ptd->pszTreeRoot = mir_a2u(notification->lpzGroup);
+ ptd->pszDescription = mir_a2u(notification->lpzName);
ptd->notification = *notification;
ptd->hIcoLib = notification->lchIcoLib;
if (!ptd->notification.lpzLAction) ptd->notification.lpzLAction = POPUP_ACTION_NOTHING;
@@ -215,7 +215,7 @@ HANDLE FindTreeData(LPTSTR group, LPTSTR name, BYTE typ) {
for (int i = 0; i < gTreeData.getCount(); i++) {
POPUPTREEDATA *p = gTreeData[i];
- if (p->typ == typ && (!group || (mir_tstrcmp(p->pszTreeRoot, group) == 0)) && (!name || (mir_tstrcmp(p->pszDescription, name) == 0)))
+ if (p->typ == typ && (!group || (mir_wstrcmp(p->pszTreeRoot, group) == 0)) && (!name || (mir_wstrcmp(p->pszDescription, name) == 0)))
return p;
}
return NULL;
diff --git a/plugins/Popup/src/opt_adv.cpp b/plugins/Popup/src/opt_adv.cpp index 323bd1ce7b..b85db14921 100644 --- a/plugins/Popup/src/opt_adv.cpp +++ b/plugins/Popup/src/opt_adv.cpp @@ -32,7 +32,7 @@ LRESULT CALLBACK AlphaTrackBarWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA LIST<wchar_t> g_lstPopupVfx(5, wcsicmp);
void OptAdv_RegisterVfx(char *name)
{
- g_lstPopupVfx.insert(mir_a2t(name));
+ g_lstPopupVfx.insert(mir_a2u(name));
}
void OptAdv_UnregisterVfx()
@@ -161,7 +161,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM SendDlgItemMessage(hwnd, IDC_TRANS_SLIDER, TBM_SETRANGE, FALSE, MAKELONG(1, 255));
SendDlgItemMessage(hwnd, IDC_TRANS_SLIDER, TBM_SETPOS, TRUE, PopupOptions.Alpha);
mir_subclassWindow(GetDlgItem(hwnd, IDC_TRANS_SLIDER), AlphaTrackBarWndProc);
- mir_sntprintf(tstr, L"%d%%", Byte2Percentile(PopupOptions.Alpha));
+ mir_snwprintf(tstr, L"%d%%", Byte2Percentile(PopupOptions.Alpha));
SetDlgItemText(hwnd, IDC_TRANS_PERCENT, tstr);
CheckDlgButton(hwnd, IDC_TRANS_OPAQUEONHOVER, PopupOptions.OpaqueOnHover ? BST_CHECKED : BST_UNCHECKED);
{
@@ -210,7 +210,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM for (int i = 0; i < g_lstPopupVfx.getCount(); ++i) {
DWORD dwItem = ComboBox_AddString(hCtrl, TranslateTS(g_lstPopupVfx[i]));
ComboBox_SetItemData(hCtrl, dwItem, i);
- if (PopupOptions.UseEffect && !mir_tstrcmp(g_lstPopupVfx[i], PopupOptions.Effect))
+ if (PopupOptions.UseEffect && !mir_wstrcmp(g_lstPopupVfx[i], PopupOptions.Effect))
dwActiveItem = dwItem;
}
SendDlgItemMessage(hwnd, IDC_EFFECT, CB_SETCURSEL, dwActiveItem, 0);
@@ -236,7 +236,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case IDC_TRANS_SLIDER:
PopupOptions.Alpha = (BYTE)SendDlgItemMessage(hwnd, IDC_TRANS_SLIDER, TBM_GETPOS, 0, 0);
- mir_sntprintf(tstr, TranslateT("%d%%"), Byte2Percentile(PopupOptions.Alpha));
+ mir_snwprintf(tstr, TranslateT("%d%%"), Byte2Percentile(PopupOptions.Alpha));
SetDlgItemText(hwnd, IDC_TRANS_PERCENT, tstr);
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
break;
@@ -341,7 +341,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM int iEffect = ComboBox_GetItemData((HWND)lParam, ComboBox_GetCurSel((HWND)lParam));
PopupOptions.UseEffect = (iEffect != -2) ? TRUE : FALSE;
mir_free(PopupOptions.Effect);
- PopupOptions.Effect = mir_tstrdup((iEffect >= 0) ? g_lstPopupVfx[iEffect] : L"");
+ PopupOptions.Effect = mir_wstrdup((iEffect >= 0) ? g_lstPopupVfx[iEffect] : L"");
BOOL enable = PopupOptions.UseAnimations || PopupOptions.UseEffect;
EnableWindow(GetDlgItem(hwnd, IDC_FADEIN_TXT1), enable);
diff --git a/plugins/Popup/src/opt_class.cpp b/plugins/Popup/src/opt_class.cpp index 170603d799..29b2702137 100644 --- a/plugins/Popup/src/opt_class.cpp +++ b/plugins/Popup/src/opt_class.cpp @@ -191,11 +191,11 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l if (p->typ == 1) { // Treeview part for typ 1 (notification)
iconIndex = ImageList_ReplaceIcon(hImgLst, -1, IcoLib_GetIconByHandle(p->hIcoLib));
- mir_sntprintf(itemName, L"%s/%s", p->pszTreeRoot, p->pszDescription);
+ mir_snwprintf(itemName, L"%s/%s", p->pszTreeRoot, p->pszDescription);
}
else { // Treeview part typ 2 (popup class api)
iconIndex = ImageList_ReplaceIcon(hImgLst, -1, p->pupClass.hIcon);
- mir_sntprintf(itemName, L"%s/%s", LPGENW("CLASS Plugins"), p->pszDescription);
+ mir_snwprintf(itemName, L"%s/%s", LPGENW("CLASS Plugins"), p->pszDescription);
}
OptTree_AddItem(hwndTree, itemName, (LPARAM)p, iconIndex);
}
@@ -266,7 +266,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l // combo left action (EXTRA)
hCtrl = GetDlgItem(hwnd, IDC_LACTION);
for (i = 0; i < ptd->notification.actionCount; ++i) {
- psztAction = mir_a2t(ptd->notification.lpActions[i].lpzTitle);
+ psztAction = mir_a2u(ptd->notification.lpActions[i].lpzTitle);
ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateTS(psztAction)), ptd->notification.lpActions[i].lpzTitle);
mir_free(psztAction); psztAction = NULL;
}
@@ -274,7 +274,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l hCtrl = GetDlgItem(hwnd, IDC_RACTION);
psztAction = NULL;
for (i = 0; i < ptd->notification.actionCount; ++i) {
- psztAction = mir_a2t(ptd->notification.lpActions[i].lpzTitle);
+ psztAction = mir_a2u(ptd->notification.lpActions[i].lpzTitle);
ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateTS(psztAction)), ptd->notification.lpActions[i].lpzTitle);
mir_free(psztAction); psztAction = NULL;
}
diff --git a/plugins/Popup/src/opt_gen.cpp b/plugins/Popup/src/opt_gen.cpp index 70272f8176..b2b6fba0e7 100644 --- a/plugins/Popup/src/opt_gen.cpp +++ b/plugins/Popup/src/opt_gen.cpp @@ -47,24 +47,24 @@ int AddStatusMode(OPTTREE_OPTION *options, int pos, LPTSTR prefix, DWORD flag) if (!flag) return pos;
options[pos].dwFlag = flag;
options[pos].groupId = OPTTREE_CHECK;
- options[pos].pszOptionName = (LPTSTR)mir_alloc(sizeof(wchar_t) * mir_tstrlen(prefix) + 32);
- options[pos].pszSettingName = mir_tstrdup(prefix);
+ options[pos].pszOptionName = (LPTSTR)mir_alloc(sizeof(wchar_t) * mir_wstrlen(prefix) + 32);
+ options[pos].pszSettingName = mir_wstrdup(prefix);
options[pos].iconIndex = 0;
- mir_tstrcpy(options[pos].pszOptionName, prefix);
- mir_tstrcat(options[pos].pszOptionName, L"/");
+ mir_wstrcpy(options[pos].pszOptionName, prefix);
+ mir_wstrcat(options[pos].pszOptionName, L"/");
switch (flag)
{
- case PF2_IDLE: mir_tstrcat(options[pos].pszOptionName, LPGENW("Offline")); break;
- case PF2_ONLINE: mir_tstrcat(options[pos].pszOptionName, LPGENW("Online")); break;
- case PF2_INVISIBLE: mir_tstrcat(options[pos].pszOptionName, LPGENW("Invisible")); break;
- case PF2_SHORTAWAY: mir_tstrcat(options[pos].pszOptionName, LPGENW("Away")); break;
- case PF2_LONGAWAY: mir_tstrcat(options[pos].pszOptionName, LPGENW("Not available")); break;
- case PF2_LIGHTDND: mir_tstrcat(options[pos].pszOptionName, LPGENW("Occupied")); break;
- case PF2_HEAVYDND: mir_tstrcat(options[pos].pszOptionName, LPGENW("Do not disturb")); break;
- case PF2_FREECHAT: mir_tstrcat(options[pos].pszOptionName, LPGENW("Free for chat")); break;
- case PF2_OUTTOLUNCH: mir_tstrcat(options[pos].pszOptionName, LPGENW("Out to lunch")); break;
- case PF2_ONTHEPHONE: mir_tstrcat(options[pos].pszOptionName, LPGENW("On the phone")); break;
+ case PF2_IDLE: mir_wstrcat(options[pos].pszOptionName, LPGENW("Offline")); break;
+ case PF2_ONLINE: mir_wstrcat(options[pos].pszOptionName, LPGENW("Online")); break;
+ case PF2_INVISIBLE: mir_wstrcat(options[pos].pszOptionName, LPGENW("Invisible")); break;
+ case PF2_SHORTAWAY: mir_wstrcat(options[pos].pszOptionName, LPGENW("Away")); break;
+ case PF2_LONGAWAY: mir_wstrcat(options[pos].pszOptionName, LPGENW("Not available")); break;
+ case PF2_LIGHTDND: mir_wstrcat(options[pos].pszOptionName, LPGENW("Occupied")); break;
+ case PF2_HEAVYDND: mir_wstrcat(options[pos].pszOptionName, LPGENW("Do not disturb")); break;
+ case PF2_FREECHAT: mir_wstrcat(options[pos].pszOptionName, LPGENW("Free for chat")); break;
+ case PF2_OUTTOLUNCH: mir_wstrcat(options[pos].pszOptionName, LPGENW("Out to lunch")); break;
+ case PF2_ONTHEPHONE: mir_wstrcat(options[pos].pszOptionName, LPGENW("On the phone")); break;
}
return pos + 1;
}
@@ -225,7 +225,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM continue;
wchar_t prefix[128];
- mir_sntprintf(prefix, LPGENW("Protocol Status")L"/%s", protocols[i]->tszAccountName);
+ mir_snwprintf(prefix, LPGENW("Protocol Status")L"/%s", protocols[i]->tszAccountName);
pos = AddStatusModes(statusOptions, pos, prefix, protoFlags);
}
}
@@ -243,7 +243,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM mir_snprintf(prefix, "Protocol Status/%s", protocols[i]->szModuleName);
wchar_t pszSettingName[256];
- mir_sntprintf(pszSettingName, LPGENW("Protocol Status")L"/%s", protocols[i]->tszAccountName);
+ mir_snwprintf(pszSettingName, LPGENW("Protocol Status")L"/%s", protocols[i]->tszAccountName);
OptTree_SetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, db_get_dw(NULL, MODULNAME, prefix, 0), pszSettingName);
}
}
@@ -529,7 +529,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM mir_snprintf(prefix, "Protocol Status/%s", protocols[i]->szModuleName);
wchar_t pszSettingName[256];
- mir_sntprintf(pszSettingName, L"Protocol Status/%s", protocols[i]->tszAccountName);
+ mir_snwprintf(pszSettingName, L"Protocol Status/%s", protocols[i]->tszAccountName);
db_set_dw(NULL, MODULNAME, prefix, OptTree_GetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, pszSettingName));
}
}
@@ -581,7 +581,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM void ErrorMSG(int minValue, int maxValue)
{
wchar_t str[128];
- mir_sntprintf(str, TranslateT("You cannot specify a value lower than %d and higher than %d."), minValue, maxValue);
+ mir_snwprintf(str, TranslateT("You cannot specify a value lower than %d and higher than %d."), minValue, maxValue);
MSGERROR(str);
}
diff --git a/plugins/Popup/src/opt_skins.cpp b/plugins/Popup/src/opt_skins.cpp index a86b82c380..2274390955 100644 --- a/plugins/Popup/src/opt_skins.cpp +++ b/plugins/Popup/src/opt_skins.cpp @@ -48,7 +48,7 @@ void RegisterOptPrevBox() err = GetLastError();
if (!g_wndClass.cPopupPreviewBoxWndclass) {
wchar_t msg[1024];
- mir_sntprintf(msg, TranslateT("Failed to register %s class."), wcl.lpszClassName);
+ mir_snwprintf(msg, TranslateT("Failed to register %s class."), wcl.lpszClassName);
MSGERROR(msg);
}
@@ -62,7 +62,7 @@ void RegisterOptPrevBox() err = GetLastError();
if (!g_wndClass.cPopupPlusDlgBox) {
wchar_t msg[1024];
- mir_sntprintf(msg, TranslateT("Failed to register %s class."), wcl.lpszClassName);
+ mir_snwprintf(msg, TranslateT("Failed to register %s class."), wcl.lpszClassName);
MSGERROR(msg);
}
}
@@ -184,9 +184,9 @@ int SkinOptionList_AddSkin(OPTTREE_OPTION* &options, int *OptionsCount, int pos options[pos].dwFlag = (DWORD)(1 << (i - 1));
options[pos].groupId = OPTTREE_CHECK;
options[pos].iconIndex = 0;
- options[pos].pszSettingName = mir_tstrdup(L"Skin options");
+ options[pos].pszSettingName = mir_wstrdup(L"Skin options");
options[pos].pszOptionName = (LPTSTR)mir_alloc(sizeof(wchar_t)*(
- mir_tstrlen(options[pos].pszSettingName) +
+ mir_wstrlen(options[pos].pszSettingName) +
mir_strlen(skin->getFlagName(i)) + 10));
wsprintf(options[pos].pszOptionName, L"%s/%hs", options[pos].pszSettingName, skin->getFlagName(i)); // !!!!!!!!!!!!!
options[pos].bState = skin->getFlag(i) ? TRUE : FALSE;
@@ -245,10 +245,10 @@ int SkinOptionList_AddMain(OPTTREE_OPTION* &options, int *OptionsCount, int pos, options[pos].dwFlag = (1 << i);
options[pos].groupId = OPTTREE_CHECK;
options[pos].iconIndex = 0;
- options[pos].pszSettingName = mir_tstrdup(LPGENW("Global settings"));
+ options[pos].pszSettingName = mir_wstrdup(LPGENW("Global settings"));
options[pos].pszOptionName = (LPTSTR)mir_alloc(sizeof(wchar_t)*(
- mir_tstrlen(options[pos].pszSettingName) +
- mir_tstrlen(mainOption[i]) + 10));
+ mir_wstrlen(options[pos].pszSettingName) +
+ mir_wstrlen(mainOption[i]) + 10));
wsprintf(options[pos].pszOptionName, L"%s/%s", options[pos].pszSettingName, mainOption[i]); // !!!!!!!!!!!!!
options[pos].bState = bCheck;
pos++;
@@ -314,13 +314,13 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR int index = -1;
OptTree_ProcessMessage(hwndDlg, msg, wParam, lParam, &index, IDC_SKIN_LIST_OPT, skinOptions, skinOptionsCount);
if (index != -1) {
- if (mir_tstrcmp(skinOptions[index].pszSettingName, L"Skin options") == 0) {
+ if (mir_wstrcmp(skinOptions[index].pszSettingName, L"Skin options") == 0) {
const PopupSkin *skin = 0;
if (skin = skins.getSkin(PopupOptions.SkinPack)) {
skin->setFlag(skinOptions[index].Data, skinOptions[index].bState ? true : false);
}
}
- else if (mir_tstrcmp(skinOptions[index].pszSettingName, L"Global settings") == 0) {
+ else if (mir_wstrcmp(skinOptions[index].pszSettingName, L"Global settings") == 0) {
switch (skinOptions[index].dwFlag) {
case (1 << 0) :
PopupOptions.DisplayTime = skinOptions[index].bState;
@@ -416,9 +416,9 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR // make shure we have select skin (ListBox_SetCurSel may be fail)
wchar_t szNewSkin[128];
ListBox_GetText(hCtrl, ListBox_GetCurSel(hCtrl), &szNewSkin);
- if (mir_tstrcmp(pszOldSkin, szNewSkin) != 0) {
+ if (mir_wstrcmp(pszOldSkin, szNewSkin) != 0) {
mir_free(PopupOptions.SkinPack);
- PopupOptions.SkinPack = mir_tstrdup(szNewSkin);
+ PopupOptions.SkinPack = mir_wstrdup(szNewSkin);
}
const PopupSkin *skin = 0;
@@ -440,7 +440,7 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR {
// Skin list change
mir_free(PopupOptions.SkinPack);
- PopupOptions.SkinPack = mir_tstrdup((wchar_t *)SendDlgItemMessage(
+ PopupOptions.SkinPack = mir_wstrdup((wchar_t *)SendDlgItemMessage(
hwndDlg,
IDC_SKINLIST,
LB_GETITEMDATA,
@@ -449,7 +449,7 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR const PopupSkin *skin = 0;
if (skin = skins.getSkin(PopupOptions.SkinPack)) {
mir_free(PopupOptions.SkinPack);
- PopupOptions.SkinPack = mir_tstrdup(skin->getName());
+ PopupOptions.SkinPack = mir_wstrdup(skin->getName());
// update Skin Option List
bDlgInit = false;
diff --git a/plugins/Popup/src/opttree.cpp b/plugins/Popup/src/opttree.cpp index c86ec17fb2..cc2e48e141 100644 --- a/plugins/Popup/src/opttree.cpp +++ b/plugins/Popup/src/opttree.cpp @@ -85,7 +85,7 @@ HTREEITEM OptTree_FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const wcha 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);
@@ -101,7 +101,7 @@ HTREEITEM OptTree_AddItem(HWND hwndTree, LPTSTR name, LPARAM lParam, int iconInd int sectionLevel = 0;
HTREEITEM hSection = NULL, result = NULL;
- mir_tstrcpy(itemName, name);
+ mir_wstrcpy(itemName, name);
sectionName = itemName;
while (sectionName) {
@@ -176,7 +176,7 @@ BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM, LPARAM lparam, int *res int sectionLevel = 0;
HTREEITEM hSection = NULL;
- mir_tstrcpy(itemName, options[indx].pszOptionName);
+ mir_wstrcpy(itemName, options[indx].pszOptionName);
sectionName = itemName;
while (sectionName) {
@@ -324,7 +324,7 @@ DWORD OptTree_GetOptions(HWND hwnd, int idcTree, OPTTREE_OPTION *options, int op int i;
for (i = 0; i < optionCount; ++i) {
if ((!options[i].pszSettingName && !pszSettingName) ||
- (options[i].pszSettingName && pszSettingName && !mir_tstrcmp(options[i].pszSettingName, pszSettingName)))
+ (options[i].pszSettingName && pszSettingName && !mir_wstrcmp(options[i].pszSettingName, pszSettingName)))
{
TVITEM tvi = { 0 };
tvi.mask = TVIF_HANDLE | TVIF_IMAGE;
@@ -342,7 +342,7 @@ void OptTree_SetOptions(HWND hwnd, int idcTree, OPTTREE_OPTION *options, int opt HWND hwndTree = GetDlgItem(hwnd, idcTree);
for (int i = 0; i < optionCount; ++i) {
if ((!options[i].pszSettingName && !pszSettingName) ||
- (options[i].pszSettingName && pszSettingName && !mir_tstrcmp(options[i].pszSettingName, pszSettingName)))
+ (options[i].pszSettingName && pszSettingName && !mir_wstrcmp(options[i].pszSettingName, pszSettingName)))
{
TVITEM tvi;
tvi.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
diff --git a/plugins/Popup/src/popup_thread.cpp b/plugins/Popup/src/popup_thread.cpp index a2a42b263d..54dc146040 100644 --- a/plugins/Popup/src/popup_thread.cpp +++ b/plugins/Popup/src/popup_thread.cpp @@ -232,7 +232,7 @@ static unsigned __stdcall PopupThread(void *) err = GetLastError();
if (!g_wndClass.cPopupThreadManagerWnd) {
wchar_t msg[1024];
- mir_sntprintf(msg, TranslateT("Failed to register %s class."), wcl.lpszClassName);
+ mir_snwprintf(msg, TranslateT("Failed to register %s class."), wcl.lpszClassName);
MSGERROR(msg);
}
diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index b64c225c26..a31ce9b23e 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -61,7 +61,7 @@ bool LoadPopupWnd2() if (!g_wndClass.cPopupWnd2) {
res = false;
wchar_t msg[1024];
- mir_sntprintf(msg, TranslateT("Failed to register %s class."), wcl.lpszClassName);
+ mir_snwprintf(msg, TranslateT("Failed to register %s class."), wcl.lpszClassName);
MessageBox(NULL, msg, MODULNAME_LONG, MB_ICONSTOP | MB_OK);
}
@@ -76,7 +76,7 @@ bool LoadPopupWnd2() err = GetLastError();
if (!g_wndClass.cPopupEditBox) {
wchar_t msg[2048];
- mir_sntprintf(msg, TranslateT("Failed to register custom edit box window class.\r\n\r\ncbSize: %i\r\nstyle: %p\r\nlpfnWndProc: %i\r\ncbClsExtra: %i\r\ncbWndExtra: %i\r\nhInstance: %i\r\nhIcon: %i\r\nhCursor: %i\r\nhbrBackground: %i\r\nlpszMenuName: %s\r\nlpszClassName: %s\r\nhIconSm: %i\r\n"),
+ mir_snwprintf(msg, TranslateT("Failed to register custom edit box window class.\r\n\r\ncbSize: %i\r\nstyle: %p\r\nlpfnWndProc: %i\r\ncbClsExtra: %i\r\ncbWndExtra: %i\r\nhInstance: %i\r\nhIcon: %i\r\nhCursor: %i\r\nhbrBackground: %i\r\nlpszMenuName: %s\r\nlpszClassName: %s\r\nhIconSm: %i\r\n"),
wclw.cbSize, wclw.style, wclw.lpfnWndProc, wclw.cbClsExtra, wclw.cbWndExtra, wclw.hInstance, wclw.hIcon, wclw.hCursor,
wclw.hbrBackground, wclw.lpszMenuName, wclw.lpszClassName, wclw.hIconSm);
@@ -101,7 +101,7 @@ bool LoadPopupWnd2() if (!g_wndClass.cPopupMenuHostWnd) {
res = false;
wchar_t msg[1024];
- mir_sntprintf(msg, TranslateT("Failed to register %s class."), wcl.lpszClassName);
+ mir_snwprintf(msg, TranslateT("Failed to register %s class."), wcl.lpszClassName);
MSGERROR(msg);
}
@@ -261,7 +261,7 @@ void PopupWnd2::update() if (*m_time && skin->useInternalClock()) {
SetTextColor(hdc, m_clClock);
HFONT hfnSave = (HFONT)SelectObject(m_bmpBase->getDC(), fonts.clock);
- SIZE sz; GetTextExtentPoint32(m_bmpBase->getDC(), m_time, (int)mir_tstrlen(m_time), &sz);
+ SIZE sz; GetTextExtentPoint32(m_bmpBase->getDC(), m_time, (int)mir_wstrlen(m_time), &sz);
m_bmpBase->Draw_Text(m_time, this->m_sz.cx - sz.cx - STYLE_SZ_GAP - skin->getRightGap(), STYLE_SZ_GAP);
SelectObject(m_bmpBase->getDC(), hfnSave);
}
@@ -688,8 +688,8 @@ void PopupWnd2::updateData(POPUPDATAW_V2 *ppd) if (m_textType == TT_NONE)
m_textType = TT_UNICODE;
- replaceStrT(m_lptzTitle, ppd->lptzContactName);
- replaceStrT(m_lptzText, ppd->lptzText);
+ replaceStrW(m_lptzTitle, ppd->lptzContactName);
+ replaceStrW(m_lptzText, ppd->lptzText);
setIcon(ppd->lchIcon);
m_hNotification = ppd->hNotification;
@@ -717,12 +717,12 @@ void PopupWnd2::updateData(POPUPDATA2 *ppd) if (ppd->flags & PU2_UNICODE) {
if (m_textType == TT_NONE)
m_textType = TT_UNICODE;
- replaceStrT(m_lptzTitle, ppd->lptzTitle);
- replaceStrT(m_lptzText, ppd->lptzText);
+ replaceStrW(m_lptzTitle, ppd->lptzTitle);
+ replaceStrW(m_lptzText, ppd->lptzText);
}
else {
- replaceStrT(m_lptzTitle, NULL);
- replaceStrT(m_lptzText, NULL);
+ replaceStrW(m_lptzTitle, NULL);
+ replaceStrW(m_lptzText, NULL);
}
setIcon(ppd->lchIcon);
@@ -733,7 +733,7 @@ void PopupWnd2::updateData(POPUPDATA2 *ppd) m_customPopup = (ppd->flags & PU2_CUSTOM_POPUP) != 0;
m_hbmAvatar = ppd->hbmAvatar;
- m_lpzSkin = mir_a2t(ppd->lpzSkin);
+ m_lpzSkin = mir_a2u(ppd->lpzSkin);
if (m_options->DisplayTime) {
if (ppd->dwTimestamp)
@@ -768,7 +768,7 @@ void PopupWnd2::buildMText() void PopupWnd2::updateText(wchar_t *text)
{
if (m_lptzText) {
- replaceStrT(m_lptzText, text);
+ replaceStrW(m_lptzText, text);
if (m_textType == TT_MTEXT)
buildMText();
}
@@ -778,7 +778,7 @@ void PopupWnd2::updateText(wchar_t *text) void PopupWnd2::updateTitle(wchar_t *title)
{
if (m_lptzTitle) {
- replaceStrT(m_lptzTitle, title);
+ replaceStrW(m_lptzTitle, title);
if (m_textType == TT_MTEXT)
buildMText();
}
@@ -985,7 +985,7 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara EmptyClipboard();
HGLOBAL clipbuffer = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, (tszText.GetLength() + 1) * sizeof(wchar_t));
wchar_t *buffer = (wchar_t *)GlobalLock(clipbuffer);
- mir_tstrcpy(buffer, tszText);
+ mir_wstrcpy(buffer, tszText);
GlobalUnlock(clipbuffer);
SetClipboardData(CF_UNICODETEXT, clipbuffer);
CloseClipboard();
diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp index 676ac0beab..23f5ac5026 100644 --- a/plugins/Popup/src/services.cpp +++ b/plugins/Popup/src/services.cpp @@ -364,15 +364,15 @@ INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam) ptd->signature = 0/*PopupNotificationData_SIGNATURE*/;
ptd->typ = 2;
memcpy(&ptd->pupClass, pc, sizeof(POPUPCLASS));
- ptd->pszTreeRoot = mir_a2t(pc->pszName);
+ ptd->pszTreeRoot = mir_a2u(pc->pszName);
ptd->pupClass.pszName = mir_strdup(pc->pszName);
if (pc->flags & PCF_UNICODE) {
ptd->pupClass.pwszDescription = mir_wstrdup(pc->pwszDescription);
- ptd->pszDescription = mir_u2t(pc->pwszDescription);
+ ptd->pszDescription = mir_wstrdup(pc->pwszDescription);
}
else {
ptd->pupClass.pszDescription = mir_strdup(pc->pszDescription);
- ptd->pszDescription = mir_a2t(pc->pszDescription);
+ ptd->pszDescription = mir_a2u(pc->pszDescription);
}
LoadClassSettings(ptd, PU_MODULCLASS);
@@ -381,13 +381,13 @@ INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam) ptd->pupClass.colorText = (COLORREF)db_get_dw(NULL, PU_MODULCLASS, setting, fonts.clText/*pc->colorText*/);
FontIDT fid = { 0 };
fid.cbSize = sizeof(FontIDT);
- mir_sntprintf(fid.group, _A2W(PU_FNT_AND_COLOR) L"/%S", ptd->pupClass.pszName);
+ mir_snwprintf(fid.group, _A2W(PU_FNT_AND_COLOR) L"/%S", ptd->pupClass.pszName);
mir_strncpy(fid.dbSettingsGroup, PU_MODULCLASS, _countof(fid.dbSettingsGroup) - 1);
fid.flags = FIDF_DEFAULTVALID;
fid.deffontsettings.charset = DEFAULT_CHARSET;
fid.deffontsettings.size = -11;
- mir_tstrncpy(fid.deffontsettings.szFace, L"Verdana", _countof(fid.deffontsettings.szFace) - 1);
- mir_tstrncpy(fid.name, PU_FNT_NAME_TEXT, _countof(fid.name) - 1);
+ mir_wstrncpy(fid.deffontsettings.szFace, L"Verdana", _countof(fid.deffontsettings.szFace) - 1);
+ mir_wstrncpy(fid.name, PU_FNT_NAME_TEXT, _countof(fid.name) - 1);
mir_strncpy(fid.prefix, setting, _countof(fid.prefix));
mir_snprintf(fid.prefix, "%s/Text", ptd->pupClass.pszName); // result is "%s/TextCol"
fid.deffontsettings.style = 0;
@@ -399,9 +399,9 @@ INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam) ptd->pupClass.colorBack = (COLORREF)db_get_dw(NULL, PU_MODULCLASS, setting, (DWORD)fonts.clBack/*pc->colorBack*/);
ColourIDT cid = { 0 };
cid.cbSize = sizeof(ColourIDT);
- mir_sntprintf(cid.group, _A2W(PU_FNT_AND_COLOR) L"/%S", ptd->pupClass.pszName);
+ mir_snwprintf(cid.group, _A2W(PU_FNT_AND_COLOR) L"/%S", ptd->pupClass.pszName);
mir_strncpy(cid.dbSettingsGroup, PU_MODULCLASS, _countof(fid.dbSettingsGroup));
- mir_tstrncpy(cid.name, PU_COL_BACK_NAME, _countof(cid.name));
+ mir_wstrncpy(cid.name, PU_COL_BACK_NAME, _countof(cid.name));
mir_snprintf(cid.setting, "%s/BgCol", ptd->pupClass.pszName);
cid.defcolour = fonts.clBack;
ColourRegisterT(&cid);
@@ -438,7 +438,7 @@ INT_PTR Popup_CreateClassPopup(WPARAM wParam, LPARAM lParam) if (wParam)
pc = (POPUPCLASS*)wParam;
else {
- LPTSTR group = mir_a2t(pdc->pszClassName);
+ LPTSTR group = mir_a2u(pdc->pszClassName);
POPUPTREEDATA *ptd = (POPUPTREEDATA *)FindTreeData(group, NULL, 2);
if (ptd)
pc = &ptd->pupClass;
@@ -481,13 +481,13 @@ INT_PTR Popup_LoadSkin(WPARAM, LPARAM lParam) if (lParam)
{
mir_free(PopupOptions.SkinPack);
- PopupOptions.SkinPack = mir_a2t((char*)lParam);
+ PopupOptions.SkinPack = mir_a2u((char*)lParam);
}
const PopupSkin *skin = 0;
if (skin = skins.getSkin(PopupOptions.SkinPack)) {
mir_free(PopupOptions.SkinPack);
- PopupOptions.SkinPack = mir_tstrdup(skin->getName());
+ PopupOptions.SkinPack = mir_wstrdup(skin->getName());
}
return 1;
diff --git a/plugins/Popup/src/skin.cpp b/plugins/Popup/src/skin.cpp index 242bf7b4c2..73756e4e51 100644 --- a/plugins/Popup/src/skin.cpp +++ b/plugins/Popup/src/skin.cpp @@ -33,7 +33,7 @@ PopupSkin::PopupSkin(LPCTSTR aName) for (int i = 0; i < 32; i++)
m_flag_names[i] = NULL;
m_elements = 0;
- m_name = aName ? mir_tstrdup(aName) : NULL;
+ m_name = aName ? mir_wstrdup(aName) : NULL;
}
PopupSkin::~PopupSkin()
@@ -61,9 +61,9 @@ SIZE PopupSkin::measureAction(HDC hdc, POPUPACTION *act) const else ++name;
SIZE szText, szSpace;
- LPTSTR wname = mir_a2t(name);
+ LPTSTR wname = mir_a2u(name);
wchar_t *str = TranslateTS(wname);
- GetTextExtentPoint32(hdc, str, (int)mir_tstrlen(str), &szText);
+ GetTextExtentPoint32(hdc, str, (int)mir_wstrlen(str), &szText);
mir_free(wname);
GetTextExtentPoint32(hdc, L" ", 1, &szSpace);
@@ -124,9 +124,9 @@ void PopupSkin::drawAction(MyBitmap *bmp, POPUPACTION *act, int x, int y, bool h GetTextExtentPoint32(bmp->getDC(), L" ", 1, &szSpace);
- LPTSTR wname = mir_a2t(name);
+ LPTSTR wname = mir_a2u(name);
wchar_t *str = TranslateTS(wname);
- GetTextExtentPoint32(bmp->getDC(), str, (int)mir_tstrlen(str), &szText);
+ GetTextExtentPoint32(bmp->getDC(), str, (int)mir_wstrlen(str), &szText);
bmp->Draw_Text(str,
(PopupOptions.actions&ACT_LARGE) ? (x + szSpace.cx + 32) : (x + szSpace.cx + 16),
max(y + 2, y + 2 + (((PopupOptions.actions&ACT_LARGE) ? 32 : 16) - szText.cy) / 2));
@@ -197,7 +197,7 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options }
else { // normal clock
HFONT hfnSave = (HFONT)SelectObject(hdc, fonts.clock);
- SIZE sz; GetTextExtentPoint32(hdc, wnd->getTime(), (int)mir_tstrlen(wnd->getTime()), &sz);
+ SIZE sz; GetTextExtentPoint32(hdc, wnd->getTime(), (int)mir_wstrlen(wnd->getTime()), &sz);
SelectObject(hdc, hfnSave);
wnd->getArgs()->add("clock.width", sz.cx + 2 * STYLE_SZ_GAP);
wnd->getArgs()->add("clock.height", sz.cy);
@@ -239,7 +239,7 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options case PopupWnd2::TT_UNICODE:
{
RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0);
- DrawTextEx(hdc, wnd->getText(), (int)mir_tstrlen(wnd->getText()), &rc,
+ DrawTextEx(hdc, wnd->getText(), (int)mir_wstrlen(wnd->getText()), &rc,
DT_CALCRECT | DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL);
szNew.cx = rc.right;
szNew.cy = rc.bottom;
@@ -282,7 +282,7 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options case PopupWnd2::TT_UNICODE:
{
RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0);
- DrawTextEx(hdc, wnd->getTitle(), (int)mir_tstrlen(wnd->getTitle()), &rc,
+ DrawTextEx(hdc, wnd->getTitle(), (int)mir_wstrlen(wnd->getTitle()), &rc,
DT_CALCRECT | DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL);
szNew.cx = rc.right;
szNew.cy = rc.bottom;
@@ -345,7 +345,7 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options else {
HFONT hfnSave = (HFONT)SelectObject(hdc, fonts.clock);
SIZE szClock;
- GetTextExtentPoint32(hdc, wnd->getTime(), (int)mir_tstrlen(wnd->getTime()), &szClock);
+ GetTextExtentPoint32(hdc, wnd->getTime(), (int)mir_wstrlen(wnd->getTime()), &szClock);
SelectObject(hdc, hfnSave);
wnd->getArgs()->add("clock.width", szClock.cx + 2 * STYLE_SZ_GAP);
wnd->getArgs()->add("clock.height", szClock.cy);
@@ -439,7 +439,7 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, POPUPOPTIONS *options, DW }
else {
HFONT hfnSave = (HFONT)SelectObject(hdc, fonts.clock);
- SIZE sz; GetTextExtentPoint32(hdc, wnd->getTime(), (int)mir_tstrlen(wnd->getTime()), &sz);
+ SIZE sz; GetTextExtentPoint32(hdc, wnd->getTime(), (int)mir_wstrlen(wnd->getTime()), &sz);
SelectObject(hdc, hfnSave);
STYLE_SZ_CLOCK = sz.cx + 2 * STYLE_SZ_GAP;
}
@@ -501,7 +501,7 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, POPUPOPTIONS *options, DW case PopupWnd2::TT_UNICODE:
{
RECT rc; SetRect(&rc, pt.x, pt.y, pt.x + sz.cx, pt.y + sz.cy);
- DrawTextEx(hdc, wnd->getText(), (int)mir_tstrlen(wnd->getText()), &rc,
+ DrawTextEx(hdc, wnd->getText(), (int)mir_wstrlen(wnd->getText()), &rc,
DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL);
}
break;
@@ -549,7 +549,7 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, POPUPOPTIONS *options, DW {
HFONT hFntSave = (HFONT)SelectObject(hdc, fonts.title);
RECT rc; SetRect(&rc, pt.x, pt.y, pt.x + sz.cx, pt.y + sz.cy);
- DrawTextEx(hdc, wnd->getTitle(), (int)mir_tstrlen(wnd->getTitle()), &rc,
+ DrawTextEx(hdc, wnd->getTitle(), (int)mir_wstrlen(wnd->getTitle()), &rc,
DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL);
SelectObject(hdc, hFntSave);
}
@@ -689,7 +689,7 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, POPUPOPTIONS *options, DW SetTextColor(hdc, wnd->getClockColor());
HFONT hfnSave = (HFONT)SelectObject(bmp->getDC(), fonts.clock);
- GetTextExtentPoint32(bmp->getDC(), wnd->getTime(), (int)mir_tstrlen(wnd->getTime()), &sz);
+ GetTextExtentPoint32(bmp->getDC(), wnd->getTime(), (int)mir_wstrlen(wnd->getTime()), &sz);
bmp->Draw_Text(wnd->getTime(), x, y);
SelectObject(bmp->getDC(), hfnSave);
}
@@ -748,7 +748,7 @@ void PopupSkin::loadOptions(std::wistream &f) f.ignore(1024, '\n');
continue;
}
- if (!mir_tstrcmp(buf, L"option")) {
+ if (!mir_wstrcmp(buf, L"option")) {
int id, val;
f >> id >> val;
f.getline(buf, 1024);
@@ -758,16 +758,16 @@ void PopupSkin::loadOptions(std::wistream &f) wchar_t *p = buf;
while (isspace(*p))
p++;
- wchar_t *q = p + mir_tstrlen(p) - 1;
+ wchar_t *q = p + mir_wstrlen(p) - 1;
while ((q >= p) && isspace(*q))
*q-- = 0;
- m_flag_names[id] = mir_t2a(p);
+ m_flag_names[id] = mir_u2a(p);
if (val)
m_flags |= 1 << id;
else
m_flags &= ~(1 << id);
}
- else if (!mir_tstrcmp(buf, L"end"))
+ else if (!mir_wstrcmp(buf, L"end"))
break;
}
delete[] buf;
@@ -840,40 +840,40 @@ void PopupSkin::loadSkin(std::wistream &f) continue;
}
- if (!mir_tstrcmp(buf, L"popup-version")) {
+ if (!mir_wstrcmp(buf, L"popup-version")) {
f >> m_popup_version;
m_popup_version = PLUGIN_MAKE_VERSION((m_popup_version / 1000000) % 100, (m_popup_version / 10000) % 100, (m_popup_version / 100) % 100, (m_popup_version / 1) % 100);
if (!isCompatible())
break;
}
- else if (!mir_tstrcmp(buf, L"padding-right")) {
+ else if (!mir_wstrcmp(buf, L"padding-right")) {
f >> m_right_gap;
}
- else if (!mir_tstrcmp(buf, L"padding-bottom")) {
+ else if (!mir_wstrcmp(buf, L"padding-bottom")) {
f >> m_bottom_gap;
}
- else if (!mir_tstrcmp(buf, L"shadow-region-opacity")) {
+ else if (!mir_wstrcmp(buf, L"shadow-region-opacity")) {
f >> m_shadow_region_opacity;
}
- else if (!mir_tstrcmp(buf, L"legacy-region-opacity")) {
+ else if (!mir_wstrcmp(buf, L"legacy-region-opacity")) {
f >> m_legacy_region_opacity;
}
- else if (!mir_tstrcmp(buf, L"w")) {
+ else if (!mir_wstrcmp(buf, L"w")) {
f.getline(buf, 1024);
m_fw.set(buf);
}
- else if (!mir_tstrcmp(buf, L"h")) {
+ else if (!mir_wstrcmp(buf, L"h")) {
f.getline(buf, 1024);
m_fh.set(buf);
}
- else if (!mir_tstrcmp(buf, L"object")) {
+ else if (!mir_wstrcmp(buf, L"object")) {
head->next = loadObject(f);
if (head->next && ((head->next->type & ST_TYPEMASK) == ST_CLOCK))
m_internalClock = false;
head = head->next;
head->next = NULL;
}
- else if (!mir_tstrcmp(buf, L"options")) {
+ else if (!mir_wstrcmp(buf, L"options")) {
loadOptions(f);
}
}
@@ -928,76 +928,76 @@ PopupSkin::SKINELEMENT *PopupSkin::loadObject(std::wistream &f) continue;
}
- if (!mir_tstrcmp(buf, L"type")) {
+ if (!mir_wstrcmp(buf, L"type")) {
f >> buf;
- if (!mir_tstrcmp(buf, L"icon"))
+ if (!mir_wstrcmp(buf, L"icon"))
element->type = (element->type & ~ST_TYPEMASK) | ST_ICON;
- else if (!mir_tstrcmp(buf, L"bitmap"))
+ else if (!mir_wstrcmp(buf, L"bitmap"))
element->type = (element->type & ~ST_TYPEMASK) | ST_MYBITMAP;
- else if (!mir_tstrcmp(buf, L"text")) {
+ else if (!mir_wstrcmp(buf, L"text")) {
element->type = (element->type & ~ST_TYPEMASK) | ST_TEXT;
element->textColor = (COLORREF)0xffffffff;
element->hfn = 0;
}
- else if (!mir_tstrcmp(buf, L"title")) {
+ else if (!mir_wstrcmp(buf, L"title")) {
element->type = (element->type & ~ST_TYPEMASK) | ST_TITLE;
element->textColor = (COLORREF)0xffffffff;
element->hfn = 0;
}
- else if (!mir_tstrcmp(buf, L"avatar")) {
+ else if (!mir_wstrcmp(buf, L"avatar")) {
element->type = (element->type & ~ST_TYPEMASK) | ST_AVATAR;
}
- else if (!mir_tstrcmp(buf, L"clock")) {
+ else if (!mir_wstrcmp(buf, L"clock")) {
element->type = (element->type & ~ST_TYPEMASK) | ST_CLOCK;
element->textColor = (COLORREF)0xffffffff;
element->hfn = 0;
}
}
- else if (!mir_tstrcmp(buf, L"source")) {
+ else if (!mir_wstrcmp(buf, L"source")) {
f >> buf;
if (((element->type & ST_TYPEMASK) == ST_MYBITMAP) || ((element->type & ST_TYPEMASK) == ST_CLOCK))
element->myBmp = new MyBitmap(buf);
}
- else if (!mir_tstrcmp(buf, L"mono")) {
+ else if (!mir_wstrcmp(buf, L"mono")) {
element->type |= ST_MONO;
}
- else if (!mir_tstrcmp(buf, L"layer")) {
+ else if (!mir_wstrcmp(buf, L"layer")) {
element->type |= ST_BLEND;
}
- else if (!mir_tstrcmp(buf, L"proportional")) {
+ else if (!mir_wstrcmp(buf, L"proportional")) {
f >> element->proportional;
}
- else if (!mir_tstrcmp(buf, L"x")) {
+ else if (!mir_wstrcmp(buf, L"x")) {
f.getline(buf, 1024);
element->fx.set(buf);
element->type &= ~ST_BADPOS;
}
- else if (!mir_tstrcmp(buf, L"y")) {
+ else if (!mir_wstrcmp(buf, L"y")) {
f.getline(buf, 1024);
element->fy.set(buf);
element->type &= ~ST_BADPOS;
}
- else if (!mir_tstrcmp(buf, L"w")) {
+ else if (!mir_wstrcmp(buf, L"w")) {
f.getline(buf, 1024);
element->fw.set(buf);
}
- else if (!mir_tstrcmp(buf, L"h")) {
+ else if (!mir_wstrcmp(buf, L"h")) {
f.getline(buf, 1024);
element->fh.set(buf);
}
- else if (!mir_tstrcmp(buf, L"ifset")) {
+ else if (!mir_wstrcmp(buf, L"ifset")) {
int id;
f >> id; id--;
element->flag_mask |= 1 << id;
element->flags |= 1 << id;
}
- else if (!mir_tstrcmp(buf, L"ifnotset")) {
+ else if (!mir_wstrcmp(buf, L"ifnotset")) {
int id;
f >> id; id--;
element->flag_mask |= 1 << id;
element->flags &= ~(1 << id);
}
- else if (!mir_tstrcmp(buf, L"color")) {
+ else if (!mir_wstrcmp(buf, L"color")) {
if (((element->type & ST_TYPEMASK) != ST_TEXT) &&
((element->type & ST_TYPEMASK) != ST_TITLE) &&
((element->type & ST_TYPEMASK) != ST_CLOCK)) continue;
@@ -1006,7 +1006,7 @@ PopupSkin::SKINELEMENT *PopupSkin::loadObject(std::wistream &f) f >> r >> g >> b;
element->textColor = RGB(r, g, b);
}
- else if (!mir_tstrcmp(buf, L"clocksize")) {
+ else if (!mir_wstrcmp(buf, L"clocksize")) {
element->clockstart[0] = 0;
f >> element->clocksize[0];
for (int i = 1; i < CLOCK_ITEMS; i++) {
@@ -1014,7 +1014,7 @@ PopupSkin::SKINELEMENT *PopupSkin::loadObject(std::wistream &f) f >> element->clocksize[i];
}
}
- else if (!mir_tstrcmp(buf, L"end")) {
+ else if (!mir_wstrcmp(buf, L"end")) {
break;
}
}
@@ -1086,9 +1086,9 @@ bool Skins::load() SKINLIST *skin = new SKINLIST;
skin->next = m_skins;
m_skins = skin;
- m_skins->name = mir_tstrdup(L"* Popup Classic");
+ m_skins->name = mir_wstrdup(L"* Popup Classic");
m_skins->dir = new wchar_t[1024];
- mir_tstrcpy(m_skins->dir, L"res:classic.popupskin");
+ mir_wstrcpy(m_skins->dir, L"res:classic.popupskin");
m_skins->skin = 0;
wchar_t dir[1024] = { '\0' };
@@ -1098,7 +1098,7 @@ bool Skins::load() return false;
}
else {
- mir_tstrncpy(dir, VARST(L"%miranda_path%\\skins\\popup"), _countof(dir));
+ mir_wstrncpy(dir, VARST(L"%miranda_path%\\skins\\popup"), _countof(dir));
DWORD fa = GetFileAttributes(dir);
if ((fa == INVALID_FILE_ATTRIBUTES) || !(fa&FILE_ATTRIBUTE_DIRECTORY))
return false;
@@ -1111,13 +1111,13 @@ bool Skins::load() WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile(L"*.*", &ffd);
while (hFind != INVALID_HANDLE_VALUE) {
- if ((ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && mir_tstrcmp(L".", ffd.cFileName) && mir_tstrcmp(L"..", ffd.cFileName)) {
+ if ((ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && mir_wstrcmp(L".", ffd.cFileName) && mir_wstrcmp(L"..", ffd.cFileName)) {
SetCurrentDirectory(ffd.cFileName);
skin = new SKINLIST;
skin->next = m_skins;
m_skins = skin;
- m_skins->name = mir_tstrdup(ffd.cFileName);
+ m_skins->name = mir_wstrdup(ffd.cFileName);
m_skins->dir = new wchar_t[1024];
GetCurrentDirectory(1024, m_skins->dir);
m_skins->skin = 0;
@@ -1139,9 +1139,9 @@ const PopupSkin *Skins::getSkin(LPCTSTR name) {
SKINLIST *any = 0;
for (SKINLIST *p = m_skins; p; p = p->next) {
- if (!mir_tstrcmp(p->name, L"* Popup Classic") || !any)
+ if (!mir_wstrcmp(p->name, L"* Popup Classic") || !any)
any = p;
- if (!mir_tstrcmpi(p->name, name)) {
+ if (!mir_wstrcmpi(p->name, name)) {
any = p;
break;
}
@@ -1166,7 +1166,7 @@ const PopupSkin *Skins::getSkin(LPCTSTR name) void Skins::loadActiveSkin()
{
for (SKINLIST *p = m_skins; p; p = p->next)
- if (!mir_tstrcmpi(p->name, PopupOptions.SkinPack)) {
+ if (!mir_wstrcmpi(p->name, PopupOptions.SkinPack)) {
if (p->skin)
break;
@@ -1179,7 +1179,7 @@ void Skins::loadActiveSkin() void Skins::freeAllButActive()
{
for (SKINLIST *p = m_skins; p; p = p->next)
- if (mir_tstrcmpi(p->name, PopupOptions.SkinPack)) {
+ if (mir_wstrcmpi(p->name, PopupOptions.SkinPack)) {
delete p->skin;
p->skin = NULL;
}
diff --git a/plugins/ProfileManager/src/pmanagerEx.cpp b/plugins/ProfileManager/src/pmanagerEx.cpp index 44c62b11c6..9bc378596b 100644 --- a/plugins/ProfileManager/src/pmanagerEx.cpp +++ b/plugins/ProfileManager/src/pmanagerEx.cpp @@ -71,7 +71,7 @@ static INT_PTR CheckDb(WPARAM, LPARAM) STARTUPINFO si = { 0 };
si.cb = sizeof(si);
GetModuleFileName(NULL, mirandaPath, _countof(mirandaPath));
- mir_sntprintf(cmdLine, L"\"%s\" /restart:%d /svc:dbchecker", mirandaPath, GetCurrentProcessId());
+ mir_snwprintf(cmdLine, L"\"%s\" /restart:%d /svc:dbchecker", mirandaPath, GetCurrentProcessId());
CallService("CloseAction", 0, 0);
CreateProcess(mirandaPath, cmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
}
diff --git a/plugins/QuickContacts/src/quickcontacts.cpp b/plugins/QuickContacts/src/quickcontacts.cpp index a50b89881c..855c5df62d 100644 --- a/plugins/QuickContacts/src/quickcontacts.cpp +++ b/plugins/QuickContacts/src/quickcontacts.cpp @@ -249,7 +249,7 @@ wchar_t *GetListName(c_struct *cs) {
if (opts.group_append && cs->szgroup[0] != '\0')
{
- mir_sntprintf(tmp_list_name, L"%s (%s)", cs->szname, cs->szgroup);
+ mir_snwprintf(tmp_list_name, L"%s (%s)", cs->szname, cs->szgroup);
return tmp_list_name;
}
else
@@ -267,7 +267,7 @@ int lstreq(wchar_t *a, wchar_t *b, size_t len = -1) if (len > 0)
ret = wcsncmp(a, b, len);
else
- ret = mir_tstrcmp(a, b);
+ ret = mir_wstrcmp(a, b);
free(a);
free(b);
return ret;
@@ -403,7 +403,7 @@ void LoadContacts(HWND hwndDlg, BOOL show_all) if (db_get_ts(hMeta == NULL ? hContact : hMeta, "CList", "Group", &dbv) == 0)
{
if (dbv.ptszVal != NULL)
- mir_tstrncpy(contact->szgroup, dbv.ptszVal, _countof(contact->szgroup));
+ mir_wstrncpy(contact->szgroup, dbv.ptszVal, _countof(contact->szgroup));
db_free(&dbv);
}
@@ -411,11 +411,11 @@ void LoadContacts(HWND hwndDlg, BOOL show_all) // Make contact name
wchar_t *tmp = (wchar_t *) pcli->pfnGetContactDisplayName(hContact, 0);
- mir_tstrncpy(contact->szname, tmp, _countof(contact->szname));
+ mir_wstrncpy(contact->szname, tmp, _countof(contact->szname));
PROTOACCOUNT *acc = Proto_GetAccount(pszProto);
if (acc != NULL)
- mir_tstrncpy(contact->proto, acc->tszAccountName, _countof(contact->proto));
+ mir_wstrncpy(contact->proto, acc->tszAccountName, _countof(contact->proto));
contact->hcontact = hContact;
contacts.insert(contact);
@@ -483,7 +483,7 @@ int CheckText(HWND hdlg, wchar_t *sztext, BOOL only_enable = FALSE) if(sztext == NULL || sztext[0] == '\0')
return 0;
- size_t len = mir_tstrlen(sztext);
+ size_t len = mir_wstrlen(sztext);
if (only_enable)
{
@@ -533,7 +533,7 @@ MCONTACT GetSelectedContact(HWND hwndDlg) for(int loop = 0; loop < contacts.getCount(); loop++)
{
- if(!mir_tstrcmpi(cname, GetListName(contacts[loop])))
+ if(!mir_wstrcmpi(cname, GetListName(contacts[loop])))
return contacts[loop]->hcontact;
}
@@ -570,7 +570,7 @@ LRESULT CALLBACK EditProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) GetWindowText(hdlg, sztext, _countof(sztext));
- BOOL at_end = (mir_tstrlen(sztext) == (int)end);
+ BOOL at_end = (mir_wstrlen(sztext) == (int)end);
if (ret != -1)
{
@@ -716,7 +716,7 @@ static void FillButton(HWND hwndDlg, int dlgItem, wchar_t *name, wchar_t *key, H if (key == NULL)
full = TranslateTS(name);
else
- mir_sntprintf(tmp, L"%s (%s)", TranslateTS(name), key);
+ mir_snwprintf(tmp, L"%s (%s)", TranslateTS(name), key);
SendDlgItemMessage(hwndDlg, dlgItem, BUTTONSETASFLATBTN, 0, 0);
SendDlgItemMessage(hwndDlg, dlgItem, BUTTONADDTOOLTIP, (LPARAM)full, BATF_TCHAR);
@@ -732,7 +732,7 @@ static void FillCheckbox(HWND hwndDlg, int dlgItem, wchar_t *name, wchar_t *key) if (key == NULL)
full = TranslateTS(name);
else
- mir_sntprintf(tmp, L"%s (%s)", TranslateTS(name), key);
+ mir_snwprintf(tmp, L"%s (%s)", TranslateTS(name), key);
SetDlgItemText(hwndDlg, dlgItem, full);
}
diff --git a/plugins/QuickMessages/src/Utils.cpp b/plugins/QuickMessages/src/Utils.cpp index 82aa13cd5a..b5f1943aed 100644 --- a/plugins/QuickMessages/src/Utils.cpp +++ b/plugins/QuickMessages/src/Utils.cpp @@ -356,8 +356,8 @@ wchar_t* getMenuEntry(int buttonnum, int entrynum, BYTE mode) } if (!db_get_ts(NULL, PLGNAME, szMEntry, &dbv)) { - if (mir_tstrlen(dbv.ptszVal)) - buffer = mir_tstrdup(dbv.ptszVal); + if (mir_wstrlen(dbv.ptszVal)) + buffer = mir_wstrdup(dbv.ptszVal); db_free(&dbv); } @@ -453,7 +453,7 @@ wchar_t* ParseString(MCONTACT hContact, wchar_t* ptszQValIn, wchar_t* ptszText, break; case 'P': ptszName = mir_a2u(GetContactProto(hContact)); - NameLenght = (int)mir_tstrlen(ptszName); + NameLenght = (int)mir_wstrlen(ptszName); p = (wchar_t *)realloc(tempQValue, (QVSize + NameLenght + 1) * sizeof(wchar_t)); if (!p) { mir_free(ptszName); @@ -478,7 +478,7 @@ wchar_t* ParseString(MCONTACT hContact, wchar_t* ptszQValIn, wchar_t* ptszText, case 'n': ptszName = (wchar_t *)pcli->pfnGetContactDisplayName(hContact, 0); - NameLenght = (int)mir_tstrlen(ptszName); + NameLenght = (int)mir_wstrlen(ptszName); p = (wchar_t *)realloc(tempQValue, (QVSize + NameLenght + 1) * sizeof(wchar_t)); if (!p) break; @@ -501,7 +501,7 @@ wchar_t* ParseString(MCONTACT hContact, wchar_t* ptszQValIn, wchar_t* ptszText, ptszName = Contact_GetInfo(CNF_FIRSTNAME, hContact); if (ptszName == NULL) break; - NameLenght = (int)mir_tstrlen(ptszName); + NameLenght = (int)mir_wstrlen(ptszName); p = (wchar_t *)realloc(tempQValue, (QVSize + NameLenght + 1) * sizeof(wchar_t)); if (!p) { mir_free(ptszName); @@ -528,7 +528,7 @@ wchar_t* ParseString(MCONTACT hContact, wchar_t* ptszQValIn, wchar_t* ptszText, if (ptszName == NULL) break; - NameLenght = (int)mir_tstrlen(ptszName); + NameLenght = (int)mir_wstrlen(ptszName); p = (wchar_t *)realloc(tempQValue, (QVSize + NameLenght + 1) * sizeof(wchar_t)); if (!p) { mir_free(ptszName); diff --git a/plugins/QuickMessages/src/main.cpp b/plugins/QuickMessages/src/main.cpp index 6dc22694c7..267dd279b0 100644 --- a/plugins/QuickMessages/src/main.cpp +++ b/plugins/QuickMessages/src/main.cpp @@ -94,8 +94,8 @@ static int InputMenuPopup(WPARAM, LPARAM lParam) hData = GetClipboardData(CF_UNICODETEXT);
chBuffer = (wchar_t*)GlobalLock(hData);
- textLength = (int)mir_tstrlen(chBuffer);
- pszCBText = mir_tstrdup(chBuffer);
+ textLength = (int)mir_wstrlen(chBuffer);
+ pszCBText = mir_wstrdup(chBuffer);
GlobalUnlock(hData);
CloseClipboard();
}
@@ -110,7 +110,7 @@ static int InputMenuPopup(WPARAM, LPARAM lParam) SendMessage(mwpd->hwnd, EM_GETSELTEXT, 0, (LPARAM)pszText);
}
if (qd->ptszValue) {
- ptszQValue = ParseString(mwpd->hContact, qd->ptszValue, pszText ? pszText : L"", pszCBText ? pszCBText : L"", (int)mir_tstrlen(qd->ptszValue), textlenght, pszCBText ? (int)mir_tstrlen(pszCBText) : 0);
+ ptszQValue = ParseString(mwpd->hContact, qd->ptszValue, pszText ? pszText : L"", pszCBText ? pszCBText : L"", (int)mir_wstrlen(qd->ptszValue), textlenght, pszCBText ? (int)mir_wstrlen(pszCBText) : 0);
if ((bIsService = qd->bIsService) && ptszQValue)
CallService(mir_u2a(ptszQValue), (WPARAM)mwpd->hContact, 0);
@@ -163,8 +163,8 @@ static int CustomButtonPressed(WPARAM, LPARAM lParam) hData = GetClipboardData(CF_UNICODETEXT);
chBuffer = (wchar_t*)GlobalLock(hData);
- textLength = (int)mir_tstrlen(chBuffer);
- pszCBText = mir_tstrdup(chBuffer);
+ textLength = (int)mir_wstrlen(chBuffer);
+ pszCBText = mir_wstrdup(chBuffer);
GlobalUnlock(hData);
CloseClipboard();
}
@@ -195,7 +195,7 @@ static int CustomButtonPressed(WPARAM, LPARAM lParam) switch (state) {
case 1:
if (ButtonsList[cbcd->dwButtonId]->ptszQValue)
- ptszQValue = ParseString(cbcd->hContact, ButtonsList[cbcd->dwButtonId]->ptszQValue, pszText ? pszText : L"", pszCBText ? pszCBText : L"", (int)mir_tstrlen(ButtonsList[cbcd->dwButtonId]->ptszQValue), textlenght, pszCBText ? (int)mir_tstrlen(pszCBText) : 0);
+ ptszQValue = ParseString(cbcd->hContact, ButtonsList[cbcd->dwButtonId]->ptszQValue, pszText ? pszText : L"", pszCBText ? pszCBText : L"", (int)mir_wstrlen(ButtonsList[cbcd->dwButtonId]->ptszQValue), textlenght, pszCBText ? (int)mir_wstrlen(pszCBText) : 0);
if ((bIsService = ButtonsList[cbcd->dwButtonId]->bIsServName) && ptszQValue)
CallService(mir_u2a(ptszQValue), (WPARAM)cbcd->hContact, 0);
break;
@@ -204,7 +204,7 @@ static int CustomButtonPressed(WPARAM, LPARAM lParam) {
ButtonData *bd = (ButtonData *)sl->items[0];
if (bd && bd->pszValue) {
- ptszQValue = ParseString(cbcd->hContact, bd->pszValue, pszText ? pszText : L"", pszCBText ? pszCBText : L"", (int)mir_tstrlen(bd->pszValue), textlenght, pszCBText ? (int)mir_tstrlen(pszCBText) : 0);
+ ptszQValue = ParseString(cbcd->hContact, bd->pszValue, pszText ? pszText : L"", pszCBText ? pszCBText : L"", (int)mir_wstrlen(bd->pszValue), textlenght, pszCBText ? (int)mir_wstrlen(pszCBText) : 0);
if ((bIsService = bd->bIsServName) && ptszQValue)
CallService(mir_u2a(ptszQValue), (WPARAM)cbcd->hContact, 0);
}
@@ -246,7 +246,7 @@ static int CustomButtonPressed(WPARAM, LPARAM lParam) ButtonData *bd = (ButtonData *)sl->items[res - 1];
bCTRL = (GetKeyState(VK_CONTROL) & 0x8000) ? 1 : 0;
if (bd->pszValue) {
- ptszQValue = ParseString(cbcd->hContact, bd->pszValue, pszText ? pszText : L"", pszCBText ? pszCBText : L"", (int)mir_tstrlen(bd->pszValue), textlenght, pszCBText ? (int)mir_tstrlen(pszCBText) : 0);
+ ptszQValue = ParseString(cbcd->hContact, bd->pszValue, pszText ? pszText : L"", pszCBText ? pszCBText : L"", (int)mir_wstrlen(bd->pszValue), textlenght, pszCBText ? (int)mir_wstrlen(pszCBText) : 0);
if ((bIsService = bd->bIsServName) && ptszQValue)
CallService(mir_u2a(ptszQValue), (WPARAM)cbcd->hContact, 0);
}
diff --git a/plugins/QuickMessages/src/options.cpp b/plugins/QuickMessages/src/options.cpp index 65d55d874a..297a6b0f9f 100644 --- a/plugins/QuickMessages/src/options.cpp +++ b/plugins/QuickMessages/src/options.cpp @@ -121,10 +121,10 @@ void SetMenuEntryProperties(HWND hdlg) ListData* ld = (ListData*)tvi.lParam;
wchar_t szValue[256];
GetDlgItemText(hdlg, IDC_RCLICKVALUE, szValue, _countof(szValue));
- if (mir_tstrlen(szValue)) {
+ if (mir_wstrlen(szValue)) {
if (ld->ptszOPQValue && (ld->ptszOPQValue != ld->ptszQValue))
mir_free(ld->ptszOPQValue);
- ld->ptszOPQValue = mir_tstrdup(szValue);
+ ld->ptszOPQValue = mir_wstrdup(szValue);
}
ld->bIsOpServName = IsDlgButtonChecked(hdlg, IDC_ISSERVNAME2);
}
@@ -139,10 +139,10 @@ void SetMenuEntryProperties(HWND hdlg) ButtonData *bd = (ButtonData*)tvi.lParam;
wchar_t szValue[256];
GetDlgItemText(hdlg, IDC_MENUVALUE, szValue, _countof(szValue));
- if (mir_tstrlen(szValue)) {
- if (mir_tstrlen(bd->pszOpValue) && (bd->pszOpValue != bd->pszValue))
+ if (mir_wstrlen(szValue)) {
+ if (mir_wstrlen(bd->pszOpValue) && (bd->pszOpValue != bd->pszValue))
mir_free(bd->pszOpValue);
- bd->pszOpValue = mir_tstrdup(szValue);
+ bd->pszOpValue = mir_wstrdup(szValue);
}
bd->bOpInQMenu = IsDlgButtonChecked(hdlg, IDC_INQMENU);
bd->bIsOpServName = IsDlgButtonChecked(hdlg, IDC_ISSERVNAME);
@@ -177,7 +177,7 @@ void SetMenuEntryProperties(HWND hdlg) }
else {
if (!bd->pszOpValue)
- bd->pszOpValue = mir_tstrdup(LPGENW("Enter Value"));
+ bd->pszOpValue = mir_wstrdup(LPGENW("Enter Value"));
}
if (TreeView_GetParent(hMenuTree, tvi.hItem))
bd->fEntryOpType |= QMF_EX_CHILD;
@@ -244,7 +244,7 @@ void SaveMenuTree() TreeView_GetItem(hButtonsList, &tvi);
}
- ld->ptszButtonName = mir_tstrdup(tvi.pszText);
+ ld->ptszButtonName = mir_wstrdup(tvi.pszText);
if (ld->ptszQValue) {
mir_snprintf(szMEntry, "ButtonValue_%u", iBl);
@@ -748,9 +748,9 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) GetWindowText(hwndEdit, szLabel, _countof(szLabel));
hwndEdit = NULL;
- if (!mir_tstrlen(szLabel)) break;
+ if (!mir_wstrlen(szLabel)) break;
if (bd = (ButtonData*)tvi.lParam) {
- if (!mir_tstrcmp(szLabel, L"---")) {
+ if (!mir_wstrcmp(szLabel, L"---")) {
if (TreeView_GetChild(hMenuTree, tvi.hItem))
break;
else {
@@ -767,7 +767,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) SetDlgItemText(hdlg, IDC_MENUVALUE, bd->pszOpValue/*?bd->pszOpValue:bd->pszValue*/);
}
- bd->pszOpName = mir_tstrdup(szLabel);
+ bd->pszOpName = mir_wstrdup(szLabel);
tvi.pszText = szLabel;
TreeView_SetItem(hMenuTree, &tvi);
@@ -804,10 +804,10 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) if (bd) {
wchar_t szValue[256];
GetDlgItemText(hdlg, IDC_MENUVALUE, szValue, _countof(szValue));
- if (mir_tstrlen(szValue)) {
+ if (mir_wstrlen(szValue)) {
if (bd->pszOpValue && (bd->pszOpValue != bd->pszValue))
mir_free(bd->pszOpValue);
- bd->pszOpValue = mir_tstrdup(szValue);
+ bd->pszOpValue = mir_wstrdup(szValue);
}
bd->bOpInQMenu = IsDlgButtonChecked(hdlg, IDC_INQMENU);
bd->bIsOpServName = IsDlgButtonChecked(hdlg, IDC_ISSERVNAME);
@@ -877,7 +877,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) GetWindowText(hwndEdit, szLabel, _countof(szLabel));
hwndEdit = NULL;
- if (!mir_tstrlen(szLabel)) break;
+ if (!mir_wstrlen(szLabel)) break;
tvi.pszText = szLabel;
((ListData*)tvi.lParam)->dwOPFlags |= QMF_RENAMED;
@@ -964,7 +964,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) GetDlgItemText(hdlg, IDC_BUTTONNAME, namebuff, _countof(namebuff));
tvis.item.mask = TVIF_PARAM | TVIF_TEXT;
- tvis.item.pszText = (mir_tstrlen(namebuff)) ? namebuff : TranslateT("New Button");
+ tvis.item.pszText = (mir_wstrlen(namebuff)) ? namebuff : TranslateT("New Button");
tvis.item.lParam = (LPARAM)ld;
TreeView_SelectItem(hButtonsList, TreeView_InsertItem(hButtonsList, &tvis));
}break;
@@ -1014,9 +1014,9 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) GetDlgItemText(hdlg, IDC_MENUNAME, namebuff, _countof(namebuff));
bd->dwOPPos = TreeView_GetCount(hMenuTree) - 1;
- bd->pszOpName = mir_tstrlen(namebuff) ? mir_tstrdup(namebuff) : mir_tstrdup(TranslateT("New Menu Entry"));
- bd->pszOpValue = mir_tstrdup(bd->pszOpName);
- bd->fEntryOpType = !mir_tstrcmp(namebuff, L"---") ? QMF_EX_SEPARATOR : 0;
+ bd->pszOpName = mir_wstrlen(namebuff) ? mir_wstrdup(namebuff) : mir_wstrdup(TranslateT("New Menu Entry"));
+ bd->pszOpValue = mir_wstrdup(bd->pszOpName);
+ bd->fEntryOpType = !mir_wstrcmp(namebuff, L"---") ? QMF_EX_SEPARATOR : 0;
bd->dwOPFlags = QMF_NEW;
bd->pszName = NULL;
bd->pszValue = NULL;
diff --git a/plugins/QuickReplies/src/events.cpp b/plugins/QuickReplies/src/events.cpp index 4a3b57da5c..0c575930dd 100644 --- a/plugins/QuickReplies/src/events.cpp +++ b/plugins/QuickReplies/src/events.cpp @@ -116,7 +116,7 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam) else
replyList.insert(variables_parsedup(value, 0, wParam));
- if (!mir_tstrcmp(value, L"---"))
+ if (!mir_wstrcmp(value, L"---"))
AppendMenu((HMENU)hMenu, MF_SEPARATOR, i + 1, NULL);
else
AppendMenu((HMENU)hMenu, MF_STRING, i + 1, replyList[i]);
@@ -129,7 +129,7 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam) int index = TrackPopupMenu(hMenu, TPM_RETURNCMD, cbcd->pt.x, cbcd->pt.y, 0, cbcd->hwndFrom, NULL);
if (index > 0)
{
- if (mir_tstrcmp(replyList[index - 1], L""))
+ if (mir_wstrcmp(replyList[index - 1], L""))
{
HWND hEdit = GetDlgItem(cbcd->hwndFrom, IDC_MESSAGE);
if (!hEdit) hEdit = GetDlgItem(cbcd->hwndFrom, IDC_CHATMESSAGE);
diff --git a/plugins/Quotes/src/CurrencyConverter.cpp b/plugins/Quotes/src/CurrencyConverter.cpp index 45f5628890..c86356aa27 100644 --- a/plugins/Quotes/src/CurrencyConverter.cpp +++ b/plugins/Quotes/src/CurrencyConverter.cpp @@ -107,11 +107,11 @@ INT_PTR CALLBACK CurrencyConverterDlgProc(HWND hDlg, UINT msg, WPARAM wp, LPARAM LRESULT nFrom = ::SendMessage(hcbxFrom, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(pszName));
LRESULT nTo = ::SendMessage(hcbxTo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(pszName));
- if (0 == mir_tstrcmpi(rQuote.GetID().c_str(), sFromQuoteID.c_str())) {
+ if (0 == mir_wstrcmpi(rQuote.GetID().c_str(), sFromQuoteID.c_str())) {
::SendMessage(hcbxFrom, CB_SETCURSEL, nFrom, 0);
}
- if (0 == mir_tstrcmpi(rQuote.GetID().c_str(), sToQuoteID.c_str())) {
+ if (0 == mir_wstrcmpi(rQuote.GetID().c_str(), sToQuoteID.c_str())) {
::SendMessage(hcbxTo, CB_SETCURSEL, nTo, 0);
}
}
diff --git a/plugins/Quotes/src/HTTPSession.cpp b/plugins/Quotes/src/HTTPSession.cpp index 16583b071a..fb2ab0d62c 100644 --- a/plugins/Quotes/src/HTTPSession.cpp +++ b/plugins/Quotes/src/HTTPSession.cpp @@ -97,7 +97,7 @@ public: char* pResult = &*(apBuffer.begin());
int nIndex = find_header(pReply, "Content-Type");
if ((-1 != nIndex) && (NULL != strstr(_strlwr(pReply->headers[nIndex].szValue), "utf-8"))) {
- wchar_t* p = mir_utf8decodeT(pResult);
+ wchar_t* p = mir_utf8decodeW(pResult);
rsResponce = p;
mir_free(p);
}
diff --git a/plugins/Quotes/src/ImportExport.cpp b/plugins/Quotes/src/ImportExport.cpp index ca9e9440fa..6818c5c879 100644 --- a/plugins/Quotes/src/ImportExport.cpp +++ b/plugins/Quotes/src/ImportExport.cpp @@ -140,25 +140,25 @@ LPCTSTR prepare_filter(LPTSTR pszBuffer, size_t cBuffer) {
LPTSTR p = pszBuffer;
LPCTSTR pszXml = TranslateT("XML File (*.xml)");
- mir_tstrncpy(p, pszXml, (int)cBuffer);
- size_t nLen = mir_tstrlen(pszXml) + 1;
+ mir_wstrncpy(p, pszXml, (int)cBuffer);
+ size_t nLen = mir_wstrlen(pszXml) + 1;
p += nLen;
if (nLen < cBuffer) {
- mir_tstrncpy(p, L"*.xml", (int)(cBuffer - nLen));
+ mir_wstrncpy(p, L"*.xml", (int)(cBuffer - nLen));
p += 6;
nLen += 6;
}
if (nLen < cBuffer) {
LPCTSTR pszAll = TranslateT("All files (*.*)");
- mir_tstrncpy(p, pszAll, (int)(cBuffer - nLen));
- size_t n = mir_tstrlen(pszAll) + 1;
+ mir_wstrncpy(p, pszAll, (int)(cBuffer - nLen));
+ size_t n = mir_wstrlen(pszAll) + 1;
nLen += n;
p += n;
}
if (nLen < cBuffer) {
- mir_tstrncpy(p, L"*.*", (int)(cBuffer - nLen));
+ mir_wstrncpy(p, L"*.*", (int)(cBuffer - nLen));
p += 4;
nLen += 4;
}
@@ -255,13 +255,13 @@ bool handle_module(MCONTACT hContact, const IXMLNode::TXMLNodePtr& pXmlModule) std::string s = quotes_t2a(sModuleName.c_str());
dbs.szModule = s.c_str();//T2CA(sModuleName.c_str());
- bool bCListModule = 0 == mir_tstrcmpi(sModuleName.c_str(), L"CList");
+ bool bCListModule = 0 == mir_wstrcmpi(sModuleName.c_str(), L"CList");
size_t cChild = pXmlModule->GetChildCount();
for (size_t i = 0; i < cChild; ++i) {
IXMLNode::TXMLNodePtr pSetting = pXmlModule->GetChildNode(i);
tstring sSetting = pSetting->GetName();
- if (0 == mir_tstrcmpi(g_pszXmlSetting, sSetting.c_str())) {
+ if (0 == mir_wstrcmpi(g_pszXmlSetting, sSetting.c_str())) {
size_t cSetChild = pSetting->GetChildCount();
if (cSetChild >= 2) {
tstring sName;
@@ -270,10 +270,10 @@ bool handle_module(MCONTACT hContact, const IXMLNode::TXMLNodePtr& pXmlModule) for (size_t j = 0; j < cSetChild; ++j) {
IXMLNode::TXMLNodePtr pNode = pSetting->GetChildNode(j);
tstring sNode = pNode->GetName();
- if (0 == mir_tstrcmpi(g_pszXmlName, sNode.c_str())) {
+ if (0 == mir_wstrcmpi(g_pszXmlName, sNode.c_str())) {
sName = pNode->GetText();
}
- else if (0 == mir_tstrcmpi(g_pszXmlValue, sNode.c_str())) {
+ else if (0 == mir_wstrcmpi(g_pszXmlValue, sNode.c_str())) {
sValue = pNode->GetText();
sType = pNode->GetAttributeValue(g_pszXmlType);
}
@@ -282,7 +282,7 @@ bool handle_module(MCONTACT hContact, const IXMLNode::TXMLNodePtr& pXmlModule) if ((false == sName.empty()) && (false == sType.empty())) {
std::string s1 = quotes_t2a(sName.c_str());
dbs.szSetting = s1.c_str();
- if (0 == mir_tstrcmpi(g_pszXmlTypeByte, sType.c_str())) {
+ if (0 == mir_wstrcmpi(g_pszXmlTypeByte, sType.c_str())) {
tistringstream in(sValue.c_str());
in.imbue(GetSystemLocale());
dbs.value.cVal = in.get();
@@ -292,7 +292,7 @@ bool handle_module(MCONTACT hContact, const IXMLNode::TXMLNodePtr& pXmlModule) ++cCreatedRecords;
}
}
- else if (0 == mir_tstrcmpi(g_pszXmlTypeWord, sType.c_str())) {
+ else if (0 == mir_wstrcmpi(g_pszXmlTypeWord, sType.c_str())) {
tistringstream in(sValue.c_str());
in.imbue(GetSystemLocale());
in >> dbs.value.wVal;
@@ -302,7 +302,7 @@ bool handle_module(MCONTACT hContact, const IXMLNode::TXMLNodePtr& pXmlModule) ++cCreatedRecords;
}
}
- else if (0 == mir_tstrcmpi(g_pszXmlTypeDword, sType.c_str())) {
+ else if (0 == mir_wstrcmpi(g_pszXmlTypeDword, sType.c_str())) {
tistringstream in(sValue.c_str());
in.imbue(GetSystemLocale());
in >> dbs.value.dVal;
@@ -312,22 +312,22 @@ bool handle_module(MCONTACT hContact, const IXMLNode::TXMLNodePtr& pXmlModule) ++cCreatedRecords;
}
}
- else if (0 == mir_tstrcmpi(g_pszXmlTypeAsciiz, sType.c_str())) {
- ptrA v(mir_t2a(sValue.c_str()));
+ else if (0 == mir_wstrcmpi(g_pszXmlTypeAsciiz, sType.c_str())) {
+ ptrA v(mir_u2a(sValue.c_str()));
dbs.value.pszVal = v;
dbs.value.type = DBVT_ASCIIZ;
if (set_contact_settings(hContact, dbs))
++cCreatedRecords;
}
- else if (0 == mir_tstrcmpi(g_pszXmlTypeUtf8, sType.c_str())) {
+ else if (0 == mir_wstrcmpi(g_pszXmlTypeUtf8, sType.c_str())) {
T2Utf szValue(sValue.c_str());
dbs.value.pszVal = szValue;
dbs.value.type = DBVT_UTF8;
if (set_contact_settings(hContact, dbs))
++cCreatedRecords;
}
- else if (0 == mir_tstrcmpi(g_pszXmlTypeWchar, sType.c_str())) {
- ptrW val(mir_t2u(sValue.c_str()));
+ else if (0 == mir_wstrcmpi(g_pszXmlTypeWchar, sType.c_str())) {
+ ptrW val(mir_wstrdup(sValue.c_str()));
dbs.value.pwszVal = val;
dbs.value.type = DBVT_WCHAR;
if (set_contact_settings(hContact, dbs))
@@ -335,7 +335,7 @@ bool handle_module(MCONTACT hContact, const IXMLNode::TXMLNodePtr& pXmlModule) mir_free(dbs.value.pwszVal);
}
- else if (0 == mir_tstrcmpi(g_pszXmlTypeBlob, sType.c_str())) {
+ else if (0 == mir_wstrcmpi(g_pszXmlTypeBlob, sType.c_str())) {
unsigned bufLen;
mir_ptr<BYTE> buf((PBYTE)mir_base64_decode(_T2A(sValue.c_str()), &bufLen));
if (buf) {
@@ -348,7 +348,7 @@ bool handle_module(MCONTACT hContact, const IXMLNode::TXMLNodePtr& pXmlModule) }
}
- if ((true == bCListModule) && (0 == mir_tstrcmpi(sName.c_str(), L"Group")))
+ if ((true == bCListModule) && (0 == mir_wstrcmpi(sName.c_str(), L"Group")))
Clist_GroupCreate(NULL, sValue.c_str());
}
}
@@ -367,13 +367,13 @@ size_t count_contacts(const IXMLNode::TXMLNodePtr& pXmlRoot, bool bInContactsGro IXMLNode::TXMLNodePtr pNode = pXmlRoot->GetChildNode(i);
tstring sName = pNode->GetName();
if (false == bInContactsGroup) {
- if (0 == mir_tstrcmpi(g_pszXmlContacts, sName.c_str()))
+ if (0 == mir_wstrcmpi(g_pszXmlContacts, sName.c_str()))
cContacts += count_contacts(pNode, true);
else
cContacts += count_contacts(pNode, false);
}
else {
- if (0 == mir_tstrcmpi(g_pszXmlContact, sName.c_str()))
+ if (0 == mir_wstrcmpi(g_pszXmlContact, sName.c_str()))
++cContacts;
}
}
@@ -405,8 +405,8 @@ IXMLNode::TXMLNodePtr find_quotes_module(const IXMLNode::TXMLNodePtr& pXmlContac for (size_t i = 0; i < cChild; ++i) {
IXMLNode::TXMLNodePtr pNode = pXmlContact->GetChildNode(i);
tstring sName = pNode->GetName();
- if ((0 == mir_tstrcmpi(g_pszXmlModule, sName.c_str()))
- && (0 == mir_tstrcmpi(g_sQuotes.c_str(), pNode->GetText().c_str()))) {
+ if ((0 == mir_wstrcmpi(g_pszXmlModule, sName.c_str()))
+ && (0 == mir_wstrcmpi(g_sQuotes.c_str(), pNode->GetText().c_str()))) {
return pNode;
}
}
@@ -424,10 +424,10 @@ TNameValue parse_setting_node(const IXMLNode::TXMLNodePtr& pXmlSetting) for (size_t j = 0; j < cSettingChildItems; ++j) {
IXMLNode::TXMLNodePtr pXMLSetChild = pXmlSetting->GetChildNode(j);
if (pXMLSetChild) {
- if (0 == mir_tstrcmpi(g_pszXmlName, pXMLSetChild->GetName().c_str())) {
+ if (0 == mir_wstrcmpi(g_pszXmlName, pXMLSetChild->GetName().c_str())) {
sName = pXMLSetChild->GetText();
}
- else if (0 == mir_tstrcmpi(g_pszXmlValue, pXMLSetChild->GetName().c_str())) {
+ else if (0 == mir_wstrcmpi(g_pszXmlValue, pXMLSetChild->GetName().c_str())) {
sValue = pXMLSetChild->GetText();
}
}
@@ -443,9 +443,9 @@ CQuotesProviders::TQuotesProviderPtr find_provider(const IXMLNode::TXMLNodePtr& size_t cChild = pXmlQuotesModule->GetChildCount();
for (size_t i = 0; i < cChild; ++i) {
IXMLNode::TXMLNodePtr pXMLSetting = pXmlQuotesModule->GetChildNode(i);
- if (pXMLSetting && (0 == mir_tstrcmpi(g_pszXmlSetting, pXMLSetting->GetName().c_str()))) {
+ if (pXMLSetting && (0 == mir_wstrcmpi(g_pszXmlSetting, pXMLSetting->GetName().c_str()))) {
TNameValue Item = parse_setting_node(pXMLSetting);
- if ((0 == mir_tstrcmpi(g_sQuotesProvider.c_str(), Item.first.c_str())) && (false == Item.second.empty())) {
+ if ((0 == mir_wstrcmpi(g_sQuotesProvider.c_str(), Item.first.c_str())) && (false == Item.second.empty())) {
return CModuleInfo::GetInstance().GetQuoteProvidersPtr()->FindProvider(Item.second);
}
}
@@ -486,12 +486,12 @@ bool get_contact_state(const IXMLNode::TXMLNodePtr& pXmlContact, CContactState& size_t cChild = m_pXmlQuotes->GetChildCount();
for (size_t i = 0; i < cChild; ++i) {
IXMLNode::TXMLNodePtr pNode = m_pXmlQuotes->GetChildNode(i);
- if (pNode && (0 == mir_tstrcmpi(g_pszXmlSetting, pNode->GetName().c_str()))) {
+ if (pNode && (0 == mir_wstrcmpi(g_pszXmlSetting, pNode->GetName().c_str()))) {
TNameValue Item = parse_setting_node(pNode);
- if (0 == mir_tstrcmpi(g_sFromID.c_str(), Item.first.c_str())) {
+ if (0 == mir_wstrcmpi(g_sFromID.c_str(), Item.first.c_str())) {
sFromID = Item.second;
}
- else if (0 == mir_tstrcmpi(g_sToID.c_str(), Item.first.c_str())) {
+ else if (0 == mir_wstrcmpi(g_sToID.c_str(), Item.first.c_str())) {
sToID = Item.second;
}
}
@@ -518,9 +518,9 @@ bool get_contact_state(const IXMLNode::TXMLNodePtr& pXmlContact, CContactState& size_t cChild = m_pXmlQuotes->GetChildCount();
for (size_t i = 0; i < cChild; ++i) {
IXMLNode::TXMLNodePtr pNode = m_pXmlQuotes->GetChildNode(i);
- if (pNode && (0 == mir_tstrcmpi(g_pszXmlSetting, pNode->GetName().c_str()))) {
+ if (pNode && (0 == mir_wstrcmpi(g_pszXmlSetting, pNode->GetName().c_str()))) {
TNameValue Item = parse_setting_node(pNode);
- if (0 == mir_tstrcmpi(Item.first.c_str(), sXMLNodeName.c_str())) {
+ if (0 == mir_wstrcmpi(Item.first.c_str(), sXMLNodeName.c_str())) {
sValue = Item.second;
break;
}
@@ -568,7 +568,7 @@ bool import_contact(const IXMLNode::TXMLNodePtr& pXmlContact, CImportContext& im for (size_t i = 0; i < cChild && bResult; ++i) {
IXMLNode::TXMLNodePtr pNode = pXmlContact->GetChildNode(i);
tstring sName = pNode->GetName();
- if (0 == mir_tstrcmpi(g_pszXmlModule, sName.c_str()))
+ if (0 == mir_wstrcmpi(g_pszXmlModule, sName.c_str()))
bResult &= handle_module(cst.m_hContact, pNode);
}
@@ -590,7 +590,7 @@ size_t import_contacts(const IXMLNode::TXMLNodePtr& pXmlContacts, CImportContext for (size_t i = 0; i < cChild; ++i) {
IXMLNode::TXMLNodePtr pNode = pXmlContacts->GetChildNode(i);
tstring sName = pNode->GetName();
- if (0 == mir_tstrcmpi(g_pszXmlContact, sName.c_str()))
+ if (0 == mir_wstrcmpi(g_pszXmlContact, sName.c_str()))
if (true == import_contact(pNode, impctx))
++cContacts;
}
@@ -606,7 +606,7 @@ size_t handle_contacts_node(const IXMLNode::TXMLNodePtr& pXmlRoot, CImportContex for (size_t i = 0; i < cChild; ++i) {
IXMLNode::TXMLNodePtr pNode = pXmlRoot->GetChildNode(i);
tstring sName = pNode->GetName();
- if (0 == mir_tstrcmpi(g_pszXmlContacts, sName.c_str()))
+ if (0 == mir_wstrcmpi(g_pszXmlContacts, sName.c_str()))
cContacts += import_contacts(pNode, impctx);
else
cContacts += handle_contacts_node(pNode, impctx);
diff --git a/plugins/Quotes/src/QuotesProviderBase.cpp b/plugins/Quotes/src/QuotesProviderBase.cpp index 263df84fac..7c058e6830 100644 --- a/plugins/Quotes/src/QuotesProviderBase.cpp +++ b/plugins/Quotes/src/QuotesProviderBase.cpp @@ -26,15 +26,15 @@ bool parse_quote(const IXMLNode::TXMLNodePtr& pTop, CQuotesProviderBase::CQuote& for (size_t i = 0; i < cChild; ++i) {
IXMLNode::TXMLNodePtr pNode = pTop->GetChildNode(i);
tstring sName = pNode->GetName();
- if (0 == mir_tstrcmpi(L"symbol", sName.c_str())) {
+ if (0 == mir_wstrcmpi(L"symbol", sName.c_str())) {
sSymbol = pNode->GetText();
if (true == sSymbol.empty())
return false;
}
- else if (0 == mir_tstrcmpi(L"description", sName.c_str())) {
+ else if (0 == mir_wstrcmpi(L"description", sName.c_str())) {
sDescription = pNode->GetText();
}
- else if (0 == mir_tstrcmpi(L"id", sName.c_str())) {
+ else if (0 == mir_wstrcmpi(L"id", sName.c_str())) {
sID = pNode->GetText();
if (true == sID.empty())
return false;
@@ -55,17 +55,17 @@ bool parse_section(const IXMLNode::TXMLNodePtr& pTop, CQuotesProviderBase::CQuot for (size_t i = 0; i < cChild; ++i) {
IXMLNode::TXMLNodePtr pNode = pTop->GetChildNode(i);
tstring sName = pNode->GetName();
- if (0 == mir_tstrcmpi(L"section", sName.c_str())) {
+ if (0 == mir_wstrcmpi(L"section", sName.c_str())) {
CQuotesProviderBase::CQuoteSection qs1;
if (true == parse_section(pNode, qs1))
aSections.push_back(qs1);
}
- else if (0 == mir_tstrcmpi(L"quote", sName.c_str())) {
+ else if (0 == mir_wstrcmpi(L"quote", sName.c_str())) {
CQuotesProviderBase::CQuote q;
if (true == parse_quote(pNode, q))
aQuotes.push_back(q);
}
- else if (0 == mir_tstrcmpi(L"name", sName.c_str())) {
+ else if (0 == mir_wstrcmpi(L"name", sName.c_str())) {
sSectionName = pNode->GetText();
if (true == sSectionName.empty())
return false;
@@ -83,7 +83,7 @@ IXMLNode::TXMLNodePtr find_provider(const IXMLNode::TXMLNodePtr& pRoot) for (size_t i = 0; i < cChild; ++i) {
IXMLNode::TXMLNodePtr pNode = pRoot->GetChildNode(i);
tstring sName = pNode->GetName();
- if (0 == mir_tstrcmpi(L"Provider", sName.c_str())) {
+ if (0 == mir_wstrcmpi(L"Provider", sName.c_str())) {
pProvider = pNode;
break;
}
@@ -111,16 +111,16 @@ CQuotesProviderBase::CXMLFileInfo parse_ini_file(const tstring& rsXMLFile, bool& for (size_t i = 0; i < cChild; ++i) {
IXMLNode::TXMLNodePtr pNode = pProvider->GetChildNode(i);
tstring sName = pNode->GetName();
- if (0 == mir_tstrcmpi(L"section", sName.c_str())) {
+ if (0 == mir_wstrcmpi(L"section", sName.c_str())) {
CQuotesProviderBase::CQuoteSection qs;
if (true == parse_section(pNode, qs))
aSections.push_back(qs);
}
- else if (0 == mir_tstrcmpi(L"Name", sName.c_str()))
+ else if (0 == mir_wstrcmpi(L"Name", sName.c_str()))
res.m_pi.m_sName = pNode->GetText();
- else if (0 == mir_tstrcmpi(L"ref", sName.c_str()))
+ else if (0 == mir_wstrcmpi(L"ref", sName.c_str()))
res.m_pi.m_sURL = pNode->GetText();
- else if (0 == mir_tstrcmpi(L"url", sName.c_str()))
+ else if (0 == mir_wstrcmpi(L"url", sName.c_str()))
res.m_sURL = pNode->GetText();
}
}
@@ -508,11 +508,11 @@ bool show_popup(const IQuotesProvider* pProvider, CQuotesProviderVisitorFormater visitor(hContact, 's', 0);
pProvider->Accept(visitor);
const tstring& sTitle = visitor.GetResult();
- mir_tstrncpy(ppd.lptzContactName, sTitle.c_str(), MAX_CONTACTNAME);
+ mir_wstrncpy(ppd.lptzContactName, sTitle.c_str(), MAX_CONTACTNAME);
{
- ptrT ss(variables_parsedup((wchar_t*)rsFormat.c_str(), 0, hContact));
+ ptrW ss(variables_parsedup((wchar_t*)rsFormat.c_str(), 0, hContact));
tstring sText = format_rate(pProvider, hContact, tstring(ss));
- mir_tstrncpy(ppd.lptzText, sText.c_str(), MAX_SECONDLINE);
+ mir_wstrncpy(ppd.lptzText, sText.c_str(), MAX_SECONDLINE);
}
if (CPopupSettings::colourDefault == ps.GetColourMode()) {
diff --git a/plugins/Quotes/src/QuotesProviderDukasCopy.cpp b/plugins/Quotes/src/QuotesProviderDukasCopy.cpp index 8404c2b479..8ecfcf1498 100644 --- a/plugins/Quotes/src/QuotesProviderDukasCopy.cpp +++ b/plugins/Quotes/src/QuotesProviderDukasCopy.cpp @@ -114,13 +114,13 @@ void parse_row(const THTMLNodePtr& pRow, TEconomicRates& raRates) if (pCol) {
tstring sColID = pCol->GetAttribute(L"id");
if (false == sColID.empty()) {
- if (0 == mir_tstrcmpi(sColID.c_str(), L"stock")) {
+ if (0 == mir_wstrcmpi(sColID.c_str(), L"stock")) {
ri.m_sName = pCol->GetText();
if (false == ri.m_sName.empty()) {
++cColsHandled;
}
}
- else if (0 == mir_tstrcmpi(sSidID.str().c_str(), sColID.c_str())) {
+ else if (0 == mir_wstrcmpi(sSidID.str().c_str(), sColID.c_str())) {
tstring sRate = pCol->GetText();
if ((false == sRate.empty()) && (true == string2double(sRate.c_str(), ri.m_dCurRate))) {
ri.m_dPrevRate = ri.m_dCurRate;
diff --git a/plugins/Quotes/src/QuotesProviderFinance.cpp b/plugins/Quotes/src/QuotesProviderFinance.cpp index 9403611d54..9f02e9e2b2 100644 --- a/plugins/Quotes/src/QuotesProviderFinance.cpp +++ b/plugins/Quotes/src/QuotesProviderFinance.cpp @@ -106,9 +106,9 @@ namespace for (int i = 0; i < cItems; ++i) {
const CQuotesProviderBase::CQuote* pQuote = get_quote_ptr_from_lb_index(hwndList, i);
if ((nullptr != pQuote)
- && ((0 == mir_tstrcmpi(rsQuoteID.c_str(), pQuote->GetID().c_str()))
- || (0 == mir_tstrcmpi(rsQuoteID.c_str(), pQuote->GetName().c_str()))
- || (0 == mir_tstrcmpi(rsQuoteID.c_str(), pQuote->GetSymbol().c_str())))) {
+ && ((0 == mir_wstrcmpi(rsQuoteID.c_str(), pQuote->GetID().c_str()))
+ || (0 == mir_wstrcmpi(rsQuoteID.c_str(), pQuote->GetName().c_str()))
+ || (0 == mir_wstrcmpi(rsQuoteID.c_str(), pQuote->GetSymbol().c_str())))) {
return i;
}
}
@@ -218,7 +218,7 @@ namespace [&apCurrent, pProvider](const CQuotesProviderBase::CQuote& quote)
{
if (apCurrent.end() == std::find_if(apCurrent.begin(), apCurrent.end(),
- ["e](const CQuotesProviderBase::CQuote* pQuote) { return 0 == mir_tstrcmpi(pQuote->GetID().c_str(), quote.GetID().c_str()); })) {
+ ["e](const CQuotesProviderBase::CQuote* pQuote) { return 0 == mir_wstrcmpi(pQuote->GetID().c_str(), quote.GetID().c_str()); })) {
pProvider->WatchForQuote(quote, false);
}
});
@@ -228,7 +228,7 @@ namespace {
if (aTemp.end() ==
std::find_if(aTemp.begin(), aTemp.end(),
- [pQuote](const CQuotesProviderBase::CQuote& quote) { return 0 == mir_tstrcmpi(pQuote->GetID().c_str(), quote.GetID().c_str()); })) {
+ [pQuote](const CQuotesProviderBase::CQuote& quote) { return 0 == mir_wstrcmpi(pQuote->GetID().c_str(), quote.GetID().c_str()); })) {
pProvider->WatchForQuote(*pQuote, true);
}
diff --git a/plugins/Quotes/src/QuotesProviderGoogle.cpp b/plugins/Quotes/src/QuotesProviderGoogle.cpp index 95e15ca85b..a124a1b002 100644 --- a/plugins/Quotes/src/QuotesProviderGoogle.cpp +++ b/plugins/Quotes/src/QuotesProviderGoogle.cpp @@ -21,8 +21,8 @@ inline bool is_rate_watched(MCONTACT hContact, {
tstring sFrom = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_FROM_ID);
tstring sTo = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_TO_ID);
- return ((0 == mir_tstrcmpi(from.GetID().c_str(), sFrom.c_str()))
- && (0 == mir_tstrcmpi(to.GetID().c_str(), sTo.c_str())));
+ return ((0 == mir_wstrcmpi(from.GetID().c_str(), sFrom.c_str()))
+ && (0 == mir_wstrcmpi(to.GetID().c_str(), sTo.c_str())));
}
bool CQuotesProviderGoogle::WatchForRate(const CRateInfo& ri,
@@ -102,7 +102,7 @@ typedef IHTMLNode::THTMLNodePtr THTMLNodePtr; bool parse_html_node(const THTMLNodePtr& pNode, double& rdRate)
{
tstring sID = pNode->GetAttribute(L"id");
- if ((false == sID.empty()) && (0 == mir_tstrcmpi(sID.c_str(), L"currency_converter_result"))) {
+ if ((false == sID.empty()) && (0 == mir_wstrcmpi(sID.c_str(), L"currency_converter_result"))) {
size_t cChild = pNode->GetChildCount();
// assert(1 == cChild);
if (cChild > 0) {
@@ -218,8 +218,8 @@ TWatchedRates g_aWatchedRates; bool is_equal_rate(const CQuotesProviderGoogle::CRateInfo& riL, const CQuotesProviderGoogle::CRateInfo& riR)
{
- return ((0 == mir_tstrcmpi(riL.m_from.GetID().c_str(), riR.m_from.GetID().c_str()))
- && ((0 == mir_tstrcmpi(riL.m_to.GetID().c_str(), riR.m_to.GetID().c_str()))));
+ return ((0 == mir_wstrcmpi(riL.m_from.GetID().c_str(), riR.m_from.GetID().c_str()))
+ && ((0 == mir_wstrcmpi(riL.m_to.GetID().c_str(), riR.m_to.GetID().c_str()))));
}
INT_PTR CALLBACK GoogleOptDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
@@ -419,8 +419,8 @@ namespace {
tstring sFrom = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_FROM_ID);
tstring sTo = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_TO_ID);
- return ((0 == mir_tstrcmpi(rsFromID.c_str(), sFrom.c_str()))
- && (0 == mir_tstrcmpi(rsToID.c_str(), sTo.c_str())));
+ return ((0 == mir_wstrcmpi(rsFromID.c_str(), sFrom.c_str()))
+ && (0 == mir_wstrcmpi(rsToID.c_str(), sTo.c_str())));
}
}
diff --git a/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp b/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp index cfcda85e76..4b18bdf7ac 100644 --- a/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp +++ b/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp @@ -80,7 +80,7 @@ tstring get_var_value(const tstring& rsHTML, LPCTSTR pszVarName, size_t cVarName tstring get_company_id(const tstring& rsHTML)
{
static LPCTSTR pszVarName = L"setCompanyId(";
- static size_t cVarNameLength = mir_tstrlen(pszVarName);
+ static size_t cVarNameLength = mir_wstrlen(pszVarName);
tstring sResult;
tstring::size_type n = rsHTML.find(pszVarName);
@@ -100,7 +100,7 @@ tstring get_company_id(const tstring& rsHTML) tstring get_company_name(const tstring& rsHTML)
{
static LPCTSTR pszVarName = L"var _companyName = ";
- static size_t cVarNameLength = mir_tstrlen(pszVarName);
+ static size_t cVarNameLength = mir_wstrlen(pszVarName);
tstring s = get_var_value(rsHTML, pszVarName, cVarNameLength);
if (s.size() > 0 && '\'' == s[0])
@@ -151,7 +151,7 @@ bool get_inline_data(const IHTMLNode::THTMLNodePtr& pNode, CGoogleInfo& rInfo) IHTMLNode::THTMLNodePtr pName = pChild->GetChildPtr(0);
tstring sName = pName->GetText();
- if (0 == mir_tstrcmpi(sName.c_str(), L"Open")) {
+ if (0 == mir_wstrcmpi(sName.c_str(), L"Open")) {
IHTMLNode::THTMLNodePtr pValue = pChild->GetChildPtr(1);
tstring sValue = pValue->GetText();
if (true == get_double_value(sValue, rInfo.m_dOpenValue)) {
diff --git a/plugins/Quotes/src/QuotesProviders.cpp b/plugins/Quotes/src/QuotesProviders.cpp index 0a3e220d7f..3a316df3d3 100644 --- a/plugins/Quotes/src/QuotesProviders.cpp +++ b/plugins/Quotes/src/QuotesProviders.cpp @@ -82,7 +82,7 @@ CQuotesProviders::TQuotesProviderPtr CQuotesProviders::FindProvider(const tstrin for (TQuotesProviders::const_iterator i = m_apProviders.begin(); i != m_apProviders.end(); ++i) {
const TQuotesProviderPtr& pProvider = *i;
const IQuotesProvider::CProviderInfo& rInfo = pProvider->GetInfo();
- if (0 == ::mir_tstrcmpi(rsName.c_str(), rInfo.m_sName.c_str())) {
+ if (0 == ::mir_wstrcmpi(rsName.c_str(), rInfo.m_sName.c_str())) {
pResult = pProvider;
break;
}
diff --git a/plugins/Quotes/src/SettingsDlg.cpp b/plugins/Quotes/src/SettingsDlg.cpp index 5e8b0f0751..c11f038809 100644 --- a/plugins/Quotes/src/SettingsDlg.cpp +++ b/plugins/Quotes/src/SettingsDlg.cpp @@ -977,7 +977,7 @@ tstring GenerateLogFileName(const tstring &rsLogFilePattern, const tstring &rsQu if (tstring::npos != n) {
tstring s = rsQuoteSymbol;
std::for_each(s.begin(), s.end(), boost::bind(replace_invalid_char, _1, '_'));
- sPath.replace(n, mir_tstrlen(g_pszVariableQuoteName), s.c_str());
+ sPath.replace(n, mir_wstrlen(g_pszVariableQuoteName), s.c_str());
}
}
diff --git a/plugins/Quotes/src/XMLEngineMI.cpp b/plugins/Quotes/src/XMLEngineMI.cpp index 5f694a31d0..ed63a63784 100644 --- a/plugins/Quotes/src/XMLEngineMI.cpp +++ b/plugins/Quotes/src/XMLEngineMI.cpp @@ -77,7 +77,7 @@ public: virtual void Write(tostream& o)const
{
- ptrT ss(xmlToString(m_hXML, NULL));
+ ptrW ss(xmlToString(m_hXML, NULL));
if (ss != NULL)
o << (char*)T2Utf(ss);
}
@@ -109,7 +109,7 @@ IXMLNode::TXMLNodePtr CXMLEngineMI::LoadFile(const tstring& rsFileName)const pBuffer[cBytes] = '\0';
int nLen = (int)cBytes;
- ptrT ss(mir_utf8decodeT(pBuffer));
+ ptrW ss(mir_utf8decodeW(pBuffer));
if (ss) {
HXML h = xmlParseString(ss, &nLen, NULL);
if (h)
diff --git a/plugins/Quotes/src/stdafx.h b/plugins/Quotes/src/stdafx.h index d4c5d2ffc1..fe0bde6b88 100644 --- a/plugins/Quotes/src/stdafx.h +++ b/plugins/Quotes/src/stdafx.h @@ -53,7 +53,7 @@ typedef boost::posix_time::wtime_facet ttime_facet; inline std::string quotes_t2a(const wchar_t* t)
{
std::string s;
- char* p = mir_t2a(t);
+ char* p = mir_u2a(t);
if (p) {
s = p;
mir_free(p);
@@ -64,7 +64,7 @@ inline std::string quotes_t2a(const wchar_t* t) inline tstring quotes_a2t(const char* s)
{
tstring t;
- wchar_t* p = mir_a2t(s);
+ wchar_t* p = mir_a2u(s);
if (p) {
t = p;
mir_free(p);
diff --git a/plugins/SMS/src/functions.cpp b/plugins/SMS/src/functions.cpp index d6256e4726..7f36b72935 100644 --- a/plugins/SMS/src/functions.cpp +++ b/plugins/SMS/src/functions.cpp @@ -445,10 +445,10 @@ void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour) if (lf) {
if (db_get(NULL, SRMMMOD, str, &dbv)) {
- mir_tstrncpy(lf->lfFaceName, fontOptionsList[0].szDefFace, _countof(lf->lfFaceName));
+ mir_wstrncpy(lf->lfFaceName, fontOptionsList[0].szDefFace, _countof(lf->lfFaceName));
}
else {
- mir_tstrncpy(lf->lfFaceName, dbv.ptszVal, _countof(lf->lfFaceName));
+ mir_wstrncpy(lf->lfFaceName, dbv.ptszVal, _countof(lf->lfFaceName));
db_free(&dbv);
}
diff --git a/plugins/SMS/src/options.cpp b/plugins/SMS/src/options.cpp index 5a464a79c5..2157187e06 100644 --- a/plugins/SMS/src/options.cpp +++ b/plugins/SMS/src/options.cpp @@ -38,7 +38,7 @@ INT_PTR CALLBACK DlgProcEditorOptions(HWND hWndDlg, UINT msg, WPARAM wParam, LPA TranslateDialogDefault(hWndDlg);
if (DB_SMS_GetStaticStringW(NULL,"Signature",tszSign,_countof(tszSign),NULL)==FALSE)
- mir_sntprintf(tszSign, TranslateT("From %s:\r\n\r\n"), pcli->pfnGetContactDisplayName(0, 0));
+ mir_snwprintf(tszSign, TranslateT("From %s:\r\n\r\n"), pcli->pfnGetContactDisplayName(0, 0));
SetDlgItemText(hWndDlg,IDC_SIGNATURE,tszSign);
{
diff --git a/plugins/SMS/src/receive.cpp b/plugins/SMS/src/receive.cpp index 9779f46907..e4f50f03e8 100644 --- a/plugins/SMS/src/receive.cpp +++ b/plugins/SMS/src/receive.cpp @@ -158,7 +158,7 @@ int handleAckSMS(WPARAM wParam, LPARAM lParam) GetXMLFieldExBuff(lpszXML, dwXMLSize, szBuff, sizeof(szBuff), NULL, "sms_response", "error", "params", "param", NULL);
}
- mir_sntprintf(tszErrorMessage, TranslateT("SMS message didn't send by %S to %s because: %S"), szNetwork, tszPhone, lpszErrorDescription);
+ mir_snwprintf(tszErrorMessage, TranslateT("SMS message didn't send by %S to %s because: %S"), szNetwork, tszPhone, lpszErrorDescription);
ShowWindow(hWndDlg, SW_SHOWNORMAL);
EnableWindow(hWndDlg, FALSE);
HWND hwndTimeOut = CreateDialog(ssSMSSettings.hInstance, MAKEINTRESOURCE(IDD_SENDSMSTIMEDOUT), hWndDlg, SMSTimedOutDlgProc);
@@ -232,7 +232,7 @@ int handleNewMessage(WPARAM hContact, LPARAM hDbEvent) }
else {
memcpy(pszServiceFunctionName, SMS_READ, sizeof(SMS_READ));
- mir_sntprintf(szToolTip, TranslateT("SMS Message from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_snwprintf(szToolTip, TranslateT("SMS Message from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
CLISTEVENT cle = {};
cle.flags = CLEF_TCHAR;
@@ -255,7 +255,7 @@ int handleNewMessage(WPARAM hContact, LPARAM hDbEvent) UINT iIcon;
if (GetDataFromMessage((LPSTR)dbei.pBlob, dbei.cbBlob, NULL, NULL, 0, NULL, &iIcon)) {
memcpy(pszServiceFunctionName, SMS_READ_ACK, sizeof(SMS_READ_ACK));
- mir_sntprintf(szToolTip, TranslateT("SMS Confirmation from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_snwprintf(szToolTip, TranslateT("SMS Confirmation from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
CLISTEVENT cle = {};
cle.flags = CLEF_TCHAR;
diff --git a/plugins/SMS/src/recvdlg.cpp b/plugins/SMS/src/recvdlg.cpp index a2a231e20e..4734d8cf0e 100644 --- a/plugins/SMS/src/recvdlg.cpp +++ b/plugins/SMS/src/recvdlg.cpp @@ -210,7 +210,7 @@ HWND RecvSMSWindowAdd(MCONTACT hContact, DWORD dwEventType, LPWSTR lpwszPhone, s }
lpwszContactDisplayName = pcli->pfnGetContactDisplayName(hContact, 0);
- mir_sntprintf(wszTitle, L"%s - %s", lpwszContactDisplayName, lpwszTitlepart);
+ mir_snwprintf(wszTitle, L"%s - %s", lpwszContactDisplayName, lpwszTitlepart);
MultiByteToWideChar(CP_UTF8, 0, lpszMessage, (int)dwMessageSize, lpwszMessage, (int)dwMessageSize + MAX_PATH);
SetWindowText(prswdWindowData->hWnd, wszTitle);
diff --git a/plugins/SMS/src/senddlg.cpp b/plugins/SMS/src/senddlg.cpp index 96f36d700a..637ccfae0c 100644 --- a/plugins/SMS/src/senddlg.cpp +++ b/plugins/SMS/src/senddlg.cpp @@ -154,7 +154,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA EnableWindow(GetDlgItem(hWndDlg, IDOK), dwSignLen != 0);
}
- mir_sntprintf(tszSign, L"%d/%d", dwSignLen, GetSMSMessageLenMax(hWndDlg));
+ mir_snwprintf(tszSign, L"%d/%d", dwSignLen, GetSMSMessageLenMax(hWndDlg));
SetDlgItemText(hWndDlg, IDC_COUNT, tszSign);
}
@@ -222,7 +222,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA else {
GetDlgItemText(hWndDlg, IDC_ADDRESS, tszPhone, _countof(tszPhone));
}
- mir_sntprintf(tszMessage, TranslateT("The SMS message send to %s timed out."), tszPhone);
+ mir_snwprintf(tszMessage, TranslateT("The SMS message send to %s timed out."), tszPhone);
KillTimer(hWndDlg, wParam);
ShowWindow(hWndDlg, SW_SHOWNORMAL);
EnableWindow(hWndDlg, FALSE);
@@ -281,7 +281,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA tvi.pszText = tszPhone;
tvi.cchTextMax = _countof(tszPhone);
TreeView_GetItem(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), &tvi);
- dwPhoneSize = mir_tstrlen(tszPhone);
+ dwPhoneSize = mir_wstrlen(tszPhone);
}
else dwPhoneSize = GetDlgItemText(hWndDlg, IDC_ADDRESS, tszPhone, _countof(tszPhone));
@@ -386,7 +386,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA size_t dwMessageSize = GET_DLG_ITEM_TEXT_LENGTH(hWndDlg, IDC_MESSAGE);
EnableWindow(GetDlgItem(hWndDlg, IDOK), dwMessageSize != 0);
- mir_sntprintf(tszBuff, L"%d/%d", dwMessageSize, GetSMSMessageLenMax(hWndDlg));
+ mir_snwprintf(tszBuff, L"%d/%d", dwMessageSize, GetSMSMessageLenMax(hWndDlg));
SetDlgItemText(hWndDlg, IDC_COUNT, tszBuff);
}
break;
@@ -400,7 +400,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA size_t dwPhoneSize = GetDlgItemText(hWndDlg, IDC_ADDRESS, tszPhone, (_countof(tszPhone) - 4));
if (IsPhoneW(tszPhone, dwPhoneSize)) {
if (IsContactPhone(psswdWindowData->hMyContact, tszPhone, dwPhoneSize) == FALSE) {
- mir_tstrcat(tszPhone, L" SMS");
+ mir_wstrcat(tszPhone, L" SMS");
for (DWORD i = 0; bCont; i++) {
mir_snprintf(szBuff, "MyPhone%d", i);
if (db_get(psswdWindowData->hMyContact, "UserInfo", szBuff, &dbv)) bCont = FALSE;
@@ -559,7 +559,7 @@ HWND SendSMSWindowAdd(MCONTACT hContact) LPTSTR lptszContactDisplayName = pcli->pfnGetContactDisplayName(hContact, 0);
wchar_t tszTitle[MAX_PATH];
- mir_sntprintf(tszTitle, L"%s - %s", lptszContactDisplayName, TranslateT("Send SMS"));
+ mir_snwprintf(tszTitle, L"%s - %s", lptszContactDisplayName, TranslateT("Send SMS"));
SetWindowText(psswdWindowData->hWnd, tszTitle);
SendDlgItemMessage(psswdWindowData->hWnd, IDC_NAME, CB_ADDSTRING, 0, (LPARAM)lptszContactDisplayName);
SendDlgItemMessage(psswdWindowData->hWnd, IDC_NAME, CB_SETCURSEL, 0, 0);
diff --git a/plugins/Scriver/src/chat/manager.cpp b/plugins/Scriver/src/chat/manager.cpp index e71eecc249..1d4e61c90a 100644 --- a/plugins/Scriver/src/chat/manager.cpp +++ b/plugins/Scriver/src/chat/manager.cpp @@ -48,7 +48,7 @@ SESSION_INFO* SM_FindSessionAutoComplete(const char* pszModule, SESSION_INFO* cu while (pTemp != NULL) {
if (pTemp != currSession && !mir_strcmpi(pszModule, pTemp->pszModule)) {
if (my_strstri(pTemp->ptszName, pszOriginal) == pTemp->ptszName) {
- if (prevSession != pTemp && mir_tstrcmpi(pTemp->ptszName, pszCurrent) > 0 && (!pszName || mir_tstrcmpi(pTemp->ptszName, pszName) < 0)) {
+ if (prevSession != pTemp && mir_wstrcmpi(pTemp->ptszName, pszCurrent) > 0 && (!pszName || mir_wstrcmpi(pTemp->ptszName, pszName) < 0)) {
pResult = pTemp;
pszName = pTemp->ptszName;
}
diff --git a/plugins/Scriver/src/chat/options.cpp b/plugins/Scriver/src/chat/options.cpp index 6f83994009..985077fde9 100644 --- a/plugins/Scriver/src/chat/options.cpp +++ b/plugins/Scriver/src/chat/options.cpp @@ -226,10 +226,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);
}
#define OPT_FIXHEADINGS (WM_USER+1)
@@ -365,7 +365,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa wchar_t tszTooltipText[2048];
RECT rect;
- mir_sntprintf(tszTooltipText,
+ mir_snwprintf(tszTooltipText,
L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n\n"
L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n\n"
L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s",
@@ -464,9 +464,9 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa LPITEMIDLIST idList = SHBrowseForFolder(&bi);
if (idList) {
SHGetPathFromIDList(idList, tszDirectory);
- mir_tstrcat(tszDirectory, L"\\");
+ mir_wstrcat(tszDirectory, L"\\");
PathToRelativeT(tszDirectory, tszTemp);
- SetDlgItemText(hwndDlg, IDC_CHAT_LOGDIRECTORY, mir_tstrlen(tszTemp) > 1 ? tszTemp : DEFLOGFILENAME);
+ SetDlgItemText(hwndDlg, IDC_CHAT_LOGDIRECTORY, mir_wstrlen(tszTemp) > 1 ? tszTemp : DEFLOGFILENAME);
}
psMalloc->Free(idList);
psMalloc->Release();
@@ -543,7 +543,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa free(pszText1);
}
else {
- mir_tstrncpy(g_Settings.pszLogDir, DEFLOGFILENAME, MAX_PATH);
+ mir_wstrncpy(g_Settings.pszLogDir, DEFLOGFILENAME, MAX_PATH);
db_unset(NULL, CHAT_MODULE, "LogDirectory");
}
pci->SM_InvalidateLogDirectories();
diff --git a/plugins/Scriver/src/chat/tools.cpp b/plugins/Scriver/src/chat/tools.cpp index eebd6fdd00..3b9c78291c 100644 --- a/plugins/Scriver/src/chat/tools.cpp +++ b/plugins/Scriver/src/chat/tools.cpp @@ -53,7 +53,7 @@ UINT CreateGCMenu(HWND hwnd, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *s if (pszWordText && pszWordText[0]) {
wchar_t szMenuText[4096];
- mir_sntprintf(szMenuText, TranslateT("Look up '%s':"), pszWordText);
+ mir_snwprintf(szMenuText, TranslateT("Look up '%s':"), pszWordText);
ModifyMenu(*hMenu, 4, MF_STRING | MF_BYPOSITION, 4, szMenuText);
SetSearchEngineIcons(*hMenu, g_dat.hSearchEngineIconList);
}
@@ -63,12 +63,12 @@ UINT CreateGCMenu(HWND hwnd, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *s else if (iIndex == 0) {
wchar_t szTemp[50];
if (pszWordText)
- mir_sntprintf(szTemp, TranslateT("&Message %s"), pszWordText);
+ mir_snwprintf(szTemp, TranslateT("&Message %s"), pszWordText);
else
- mir_tstrncpy(szTemp, TranslateT("&Message"), _countof(szTemp) - 1);
+ mir_wstrncpy(szTemp, TranslateT("&Message"), _countof(szTemp) - 1);
- if (mir_tstrlen(szTemp) > 40)
- mir_tstrncpy(szTemp + 40, L"...", 4);
+ if (mir_wstrlen(szTemp) > 40)
+ mir_wstrncpy(szTemp + 40, L"...", 4);
ModifyMenu(*hMenu, ID_MESS, MF_STRING | MF_BYCOMMAND, ID_MESS, szTemp);
gcmi.Type = MENU_ON_NICKLIST;
}
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index 9e5d799407..0be7880de0 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -217,7 +217,7 @@ static void TabAutoComplete(HWND hwnd, MESSAGESUBDATA *dat, SESSION_INFO *si) start -= 2;
if (dat->szSearchResult != NULL) {
- int cbResult = (int)mir_tstrlen(dat->szSearchResult);
+ int cbResult = (int)mir_wstrlen(dat->szSearchResult);
if (start >= cbResult && !wcsnicmp(dat->szSearchResult, pszText + start - cbResult, cbResult)) {
start -= cbResult;
goto LBL_SkipEnd;
@@ -243,8 +243,8 @@ LBL_SkipEnd: if (dat->szSearchQuery == NULL) {
dat->szSearchQuery = (wchar_t*)mir_alloc(sizeof(wchar_t)*(end - start + 1));
- mir_tstrncpy(dat->szSearchQuery, pszText + start, end - start + 1);
- dat->szSearchResult = mir_tstrdup(dat->szSearchQuery);
+ mir_wstrncpy(dat->szSearchQuery, pszText + start, end - start + 1);
+ dat->szSearchResult = mir_wstrdup(dat->szSearchQuery);
dat->lastSession = NULL;
}
@@ -258,23 +258,23 @@ LBL_SkipEnd: else pszName = pci->UM_FindUserAutoComplete(si->pUsers, dat->szSearchQuery, dat->szSearchResult);
mir_free(pszText);
- replaceStrT(dat->szSearchResult, NULL);
+ replaceStrW(dat->szSearchResult, NULL);
if (pszName == NULL) {
if (end != start) {
SendMessage(hwnd, EM_SETSEL, start, end);
SendMessage(hwnd, EM_REPLACESEL, FALSE, (LPARAM)dat->szSearchQuery);
}
- replaceStrT(dat->szSearchQuery, NULL);
+ replaceStrW(dat->szSearchQuery, NULL);
}
else {
- dat->szSearchResult = mir_tstrdup(pszName);
+ dat->szSearchResult = mir_wstrdup(pszName);
if (end != start) {
- ptrT szReplace;
+ ptrW szReplace;
if (!isRoom && !isTopic && g_Settings.bAddColonToAutoComplete && start == 0) {
- szReplace = (wchar_t*)mir_alloc((mir_tstrlen(pszName) + 4) * sizeof(wchar_t));
- mir_tstrcpy(szReplace, pszName);
- mir_tstrcat(szReplace, L": ");
+ szReplace = (wchar_t*)mir_alloc((mir_wstrlen(pszName) + 4) * sizeof(wchar_t));
+ mir_wstrcpy(szReplace, pszName);
+ mir_wstrcat(szReplace, L": ");
pszName = szReplace;
}
SendMessage(hwnd, EM_SETSEL, start, end);
@@ -684,7 +684,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR ptl.y = (LONG)pt.y;
ScreenToClient(hwnd, (LPPOINT)&ptl);
{
- ptrT pszWord(GetRichTextWord(hwnd, &ptl));
+ ptrW pszWord(GetRichTextWord(hwnd, &ptl));
inMenu = TRUE;
CHARRANGE all = { 0, -1 };
@@ -795,7 +795,7 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, SESSION_INFO * p }
if (tszBuf[0] == 0)
- mir_sntprintf(tszBuf, L"%s: %s\r\n%s: %s\r\n%s: %s",
+ mir_snwprintf(tszBuf, L"%s: %s\r\n%s: %s\r\n%s: %s",
TranslateT("Nickname"), ui->pszNick,
TranslateT("Unique ID"), ui->pszUID,
TranslateT("Status"), pci->TM_WordToString(parentdat->pStatuses, ui->Status));
@@ -956,18 +956,18 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, break;
}
else if (wParam == '\b' && si->szSearch[0]) // backspace
- si->szSearch[mir_tstrlen(si->szSearch) - 1] = '\0';
+ si->szSearch[mir_wstrlen(si->szSearch) - 1] = '\0';
else if (wParam < ' ')
break;
else {
wchar_t szNew[2];
szNew[0] = (wchar_t)wParam;
szNew[1] = '\0';
- if (mir_tstrlen(si->szSearch) >= _countof(si->szSearch) - 2) {
+ if (mir_wstrlen(si->szSearch) >= _countof(si->szSearch) - 2) {
MessageBeep(MB_OK);
break;
}
- mir_tstrcat(si->szSearch, szNew);
+ mir_wstrcat(si->szSearch, szNew);
}
if (si->szSearch[0]) {
// iterate over the (sorted) list of nicknames and search for the
@@ -976,7 +976,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, for (int i = 0; i < iItems; i++) {
USERINFO *ui = pci->UM_FindUserFromIndex(si->pUsers, i);
if (ui) {
- if (!wcsnicmp(ui->pszNick, si->szSearch, mir_tstrlen(si->szSearch))) {
+ if (!wcsnicmp(ui->pszNick, si->szSearch, mir_wstrlen(si->szSearch))) {
SendMessage(hwnd, LB_SETCURSEL, i, 0);
InvalidateRect(hwnd, NULL, FALSE);
return 0;
@@ -985,7 +985,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, }
MessageBeep(MB_OK);
- si->szSearch[mir_tstrlen(si->szSearch) - 1] = '\0';
+ si->szSearch[mir_wstrlen(si->szSearch) - 1] = '\0';
return 0;
}
break;
@@ -1177,17 +1177,17 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR switch (si->iType) {
case GCW_CHATROOM:
- mir_sntprintf(szTemp,
+ mir_snwprintf(szTemp,
(si->nUsersInNicklist == 1) ? TranslateT("%s: chat room (%u user)") : TranslateT("%s: chat room (%u users)"),
si->ptszName, si->nUsersInNicklist);
break;
case GCW_PRIVMESS:
- mir_sntprintf(szTemp,
+ mir_snwprintf(szTemp,
(si->nUsersInNicklist == 1) ? TranslateT("%s: message session") : TranslateT("%s: message session (%u users)"),
si->ptszName, si->nUsersInNicklist);
break;
case GCW_SERVER:
- mir_sntprintf(szTemp, L"%s: Server", si->ptszName);
+ mir_snwprintf(szTemp, L"%s: Server", si->ptszName);
break;
}
tbd.iFlags = TBDF_TEXT | TBDF_ICON;
@@ -1200,7 +1200,7 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR {
MODULEINFO *mi = pci->MM_FindModule(si->pszModule);
hIcon = si->wStatus == ID_STATUS_ONLINE ? mi->hOnlineIcon : mi->hOfflineIcon;
- mir_sntprintf(szTemp, L"%s : %s", mi->ptszModDispName, si->ptszStatusbarText ? si->ptszStatusbarText : L"");
+ mir_snwprintf(szTemp, L"%s : %s", mi->ptszModDispName, si->ptszStatusbarText ? si->ptszStatusbarText : L"");
StatusBarData sbd;
sbd.iItem = 0;
@@ -1411,7 +1411,7 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR }
SetTextColor(dis->hDC, ui->iStatusEx == 0 ? g_Settings.crUserListColor : g_Settings.crUserListHeadingsColor);
- TextOut(dis->hDC, dis->rcItem.left + x_offset, dis->rcItem.top, ui->pszNick, (int)mir_tstrlen(ui->pszNick));
+ TextOut(dis->hDC, dis->rcItem.left + x_offset, dis->rcItem.top, ui->pszNick, (int)mir_wstrlen(ui->pszNick));
SelectObject(dis->hDC, hOldFont);
}
return TRUE;
@@ -1428,7 +1428,7 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR char szIndicator = SM_GetStatusIndicator(si, ui);
if (szIndicator > '\0') {
static wchar_t ptszBuf[128];
- mir_sntprintf(ptszBuf, L"%c%s", szIndicator, ui->pszNick);
+ mir_snwprintf(ptszBuf, L"%c%s", szIndicator, ui->pszNick);
SendDlgItemMessage(hwndDlg, IDC_CHAT_LIST, LB_ADDSTRING, 0, (LPARAM)ptszBuf);
}
else SendDlgItemMessage(hwndDlg, IDC_CHAT_LIST, LB_ADDSTRING, 0, (LPARAM)ui->pszNick);
@@ -1637,7 +1637,7 @@ LABEL_SHOWWINDOW: USERINFO *ui = pci->SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, item);
if (ui != NULL) {
static wchar_t ptszBuf[1024];
- mir_sntprintf(ptszBuf, L"%s: %s\r\n%s: %s\r\n%s: %s",
+ mir_snwprintf(ptszBuf, L"%s: %s\r\n%s: %s\r\n%s: %s",
TranslateT("Nickname"), ui->pszNick,
TranslateT("Unique ID"), ui->pszUID,
TranslateT("Status"), pci->TM_WordToString(parentdat->pStatuses, ui->Status));
@@ -1667,12 +1667,12 @@ LABEL_SHOWWINDOW: if (GetKeyState(VK_SHIFT) & 0x8000) {
LRESULT lResult = (LRESULT)SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_GETSEL, 0, 0);
int start = LOWORD(lResult);
- size_t dwNameLenMax = (mir_tstrlen(ui->pszUID) + 4);
+ size_t dwNameLenMax = (mir_wstrlen(ui->pszUID) + 4);
wchar_t* pszName = (wchar_t*)alloca(sizeof(wchar_t) * dwNameLenMax);
if (start == 0)
- mir_sntprintf(pszName, dwNameLenMax, L"%s: ", ui->pszUID);
+ mir_snwprintf(pszName, dwNameLenMax, L"%s: ", ui->pszUID);
else
- mir_sntprintf(pszName, dwNameLenMax, L"%s ", ui->pszUID);
+ mir_snwprintf(pszName, dwNameLenMax, L"%s ", ui->pszUID);
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)pszName);
PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
@@ -1706,7 +1706,7 @@ LABEL_SHOWWINDOW: // takes pszRtf to a queue, no leak here
si->cmdList = tcmdlist_append(si->cmdList, pszRtf, 20, FALSE);
- CMString ptszText(ptrT(mir_utf8decodeT(pszRtf)));
+ CMString ptszText(ptrW(mir_utf8decodeW(pszRtf)));
pci->DoRtfToTags(ptszText, mi->nColorCount, mi->crColors);
ptszText.Trim();
ptszText.Replace(L"%", L"%%");
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index 42ec8e52c0..cf50d1ad42 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -131,8 +131,8 @@ static int ackevent(WPARAM, LPARAM lParam) SendMessage(hwndSender, DM_STOPMESSAGESENDING, 0, 0);
ErrorWindowData *ewd = (ErrorWindowData*)mir_alloc(sizeof(ErrorWindowData));
- ewd->szName = mir_tstrdup(pcli->pfnGetContactDisplayName(item->hContact, 0));
- ewd->szDescription = mir_a2t((char *)pAck->lParam);
+ ewd->szName = mir_wstrdup(pcli->pfnGetContactDisplayName(item->hContact, 0));
+ ewd->szDescription = mir_a2u((char *)pAck->lParam);
ewd->szText = GetSendBufferMsg(item);
ewd->hwndParent = hwndSender;
ewd->queueItem = item;
diff --git a/plugins/Scriver/src/infobar.cpp b/plugins/Scriver/src/infobar.cpp index 0175199ccc..8ff69e1288 100644 --- a/plugins/Scriver/src/infobar.cpp +++ b/plugins/Scriver/src/infobar.cpp @@ -79,14 +79,14 @@ void RefreshInfobar(InfobarWindowData* idat) {
HWND hwnd = idat->hWnd;
SrmmWindowData *dat = idat->mwd;
- ptrT szContactStatusMsg(db_get_tsa(dat->hContact, "CList", "StatusMsg"));
- ptrT szXStatusName(db_get_tsa(idat->mwd->hContact, idat->mwd->szProto, "XStatusName"));
- ptrT szXStatusMsg(db_get_tsa(idat->mwd->hContact, idat->mwd->szProto, "XStatusMsg"));
+ ptrW szContactStatusMsg(db_get_tsa(dat->hContact, "CList", "StatusMsg"));
+ ptrW szXStatusName(db_get_tsa(idat->mwd->hContact, idat->mwd->szProto, "XStatusName"));
+ ptrW szXStatusMsg(db_get_tsa(idat->mwd->hContact, idat->mwd->szProto, "XStatusMsg"));
HICON hIcon = GetExtraStatusIcon(idat);
wchar_t szText[2048];
SETTEXTEX st;
if (szXStatusMsg && *szXStatusMsg)
- mir_sntprintf(szText, L"%s (%s)", TranslateTS(szXStatusName), szXStatusMsg);
+ mir_snwprintf(szText, L"%s (%s)", TranslateTS(szXStatusName), szXStatusMsg);
else
wcsncpy_s(szText, TranslateTS(szXStatusName), _TRUNCATE);
st.flags = ST_DEFAULT;
diff --git a/plugins/Scriver/src/input.cpp b/plugins/Scriver/src/input.cpp index d9ecad41e3..e0e838ddbc 100644 --- a/plugins/Scriver/src/input.cpp +++ b/plugins/Scriver/src/input.cpp @@ -399,8 +399,8 @@ BOOL HandleLinkClick(HINSTANCE hInstance, HWND hwndDlg, HWND hwndFocus, ENLINK * if (!OpenClipboard(hwndDlg))
break;
EmptyClipboard();
- HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t)*(mir_tstrlen(tr.lpstrText) + 1));
- mir_tstrcpy((LPWSTR)GlobalLock(hData), tr.lpstrText);
+ HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t)*(mir_wstrlen(tr.lpstrText) + 1));
+ mir_wstrcpy((LPWSTR)GlobalLock(hData), tr.lpstrText);
GlobalUnlock(hData);
SetClipboardData(CF_UNICODETEXT, hData);
CloseClipboard();
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 341c9c6a3a..5aab926147 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -48,7 +48,7 @@ static wchar_t* GetIEViewSelection(SrmmWindowData *dat) evt.hwnd = dat->hwndLog;
evt.hContact = dat->hContact;
evt.iType = IEE_GET_SELECTION;
- return mir_tstrdup((wchar_t*)CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&evt));
+ return mir_wstrdup((wchar_t*)CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&evt));
}
static wchar_t* GetQuotedTextW(wchar_t *text)
@@ -160,17 +160,17 @@ static void AddToFileList(wchar_t ***pppFiles, int *totalCount, const wchar_t* s {
*pppFiles = (wchar_t**)mir_realloc(*pppFiles, (++*totalCount + 1)*sizeof(wchar_t*));
(*pppFiles)[*totalCount] = NULL;
- (*pppFiles)[*totalCount - 1] = mir_tstrdup(szFilename);
+ (*pppFiles)[*totalCount - 1] = mir_wstrdup(szFilename);
if (GetFileAttributes(szFilename) & FILE_ATTRIBUTE_DIRECTORY) {
WIN32_FIND_DATA fd;
wchar_t szPath[MAX_PATH];
- mir_sntprintf(szPath, L"%s\\*", szFilename);
+ mir_snwprintf(szPath, L"%s\\*", szFilename);
HANDLE hFind = FindFirstFile(szPath, &fd);
if (hFind != INVALID_HANDLE_VALUE) {
do {
- if (!mir_tstrcmp(fd.cFileName, L".") || !mir_tstrcmp(fd.cFileName, L"..")) continue;
- mir_sntprintf(szPath, L"%s\\%s", szFilename, fd.cFileName);
+ if (!mir_wstrcmp(fd.cFileName, L".") || !mir_wstrcmp(fd.cFileName, L"..")) continue;
+ mir_snwprintf(szPath, L"%s\\%s", szFilename, fd.cFileName);
AddToFileList(pppFiles, totalCount, szPath);
} while (FindNextFile(hFind, &fd));
FindClose(hFind);
@@ -295,10 +295,10 @@ static LRESULT CALLBACK LogEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, POINTL ptl = { (LONG)pt.x, (LONG)pt.y };
ScreenToClient(hwnd, (LPPOINT)&ptl);
- ptrT pszWord(GetRichTextWord(hwnd, &ptl));
+ ptrW pszWord(GetRichTextWord(hwnd, &ptl));
if (pszWord && pszWord[0]) {
wchar_t szMenuText[4096];
- mir_sntprintf(szMenuText, TranslateT("Look up '%s':"), pszWord);
+ mir_snwprintf(szMenuText, TranslateT("Look up '%s':"), pszWord);
ModifyMenu(hSubMenu, 5, MF_STRING | MF_BYPOSITION, 5, szMenuText);
SetSearchEngineIcons(hMenu, g_dat.hSearchEngineIconList);
}
@@ -552,7 +552,7 @@ static void UpdateReadChars(HWND hwndDlg, SrmmWindowData *dat) sbd.iFlags = SBDF_TEXT | SBDF_ICON;
sbd.hIcon = NULL;
sbd.pszText = szText;
- mir_sntprintf(szText, L"%d", len);
+ mir_snwprintf(szText, L"%d", len);
SendMessage(dat->hwndParent, CM_UPDATESTATUSBAR, (WPARAM)&sbd, (LPARAM)hwndDlg);
}
}
@@ -759,7 +759,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SetDlgItemTextA(hwndDlg, IDC_MESSAGE, newData->szInitialText);
}
else if (g_dat.flags & SMF_SAVEDRAFTS) {
- ptrT ptszSavedMsg(db_get_tsa(dat->hContact, "SRMM", "SavedMsg"));
+ ptrW ptszSavedMsg(db_get_tsa(dat->hContact, "SRMM", "SavedMsg"));
if (ptszSavedMsg)
len = SetRichText(GetDlgItem(hwndDlg, IDC_MESSAGE), ptszSavedMsg);
PostMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), EM_SETSEL, len, len);
@@ -1351,19 +1351,19 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (dat->messagesInProgress && (g_dat.flags & SMF_SHOWPROGRESS)) {
sbd.hIcon = GetCachedIcon("scriver_DELIVERING");
sbd.pszText = szText;
- mir_sntprintf(szText, TranslateT("Sending in progress: %d message(s) left..."), dat->messagesInProgress);
+ mir_snwprintf(szText, TranslateT("Sending in progress: %d message(s) left..."), dat->messagesInProgress);
}
else if (dat->nTypeSecs) {
sbd.hIcon = GetCachedIcon("scriver_TYPING");
sbd.pszText = szText;
- mir_sntprintf(szText, TranslateT("%s is typing a message..."), pcli->pfnGetContactDisplayName(dat->hContact, 0));
+ mir_snwprintf(szText, TranslateT("%s is typing a message..."), pcli->pfnGetContactDisplayName(dat->hContact, 0));
dat->nTypeSecs--;
}
else if (dat->lastMessage) {
wchar_t date[64], time[64];
TimeZone_PrintTimeStamp(NULL, dat->lastMessage, L"d", date, _countof(date), 0);
TimeZone_PrintTimeStamp(NULL, dat->lastMessage, L"t", time, _countof(time), 0);
- mir_sntprintf(szText, TranslateT("Last message received on %s at %s."), date, time);
+ mir_snwprintf(szText, TranslateT("Last message received on %s at %s."), date, time);
sbd.pszText = szText;
}
else sbd.pszText = L"";
@@ -1576,7 +1576,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETPARAFORMAT, 0, (LPARAM)&pf2);
int bufSize = GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE), 1200, TRUE) + 2;
- ptrT ptszUnicode((wchar_t*)mir_alloc(bufSize * sizeof(wchar_t)));
+ ptrW ptszUnicode((wchar_t*)mir_alloc(bufSize * sizeof(wchar_t)));
MessageSendQueueItem msi = { 0 };
if (pf2.wEffects & PFE_RTLPARA)
@@ -1590,7 +1590,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (RTL_Detect(ptszUnicode))
msi.flags |= PREF_RTL;
- msi.sendBuffer = mir_utf8encodeT(ptszUnicode);
+ msi.sendBuffer = mir_utf8encodeW(ptszUnicode);
msi.sendBufferSize = (int)mir_strlen(msi.sendBuffer);
if (msi.sendBufferSize == 0)
break;
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index fc1bdea405..f75057670b 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -147,7 +147,7 @@ EventData* getEventFromDB(SrmmWindowData *dat, MCONTACT hContact, MEVENT hDbEven if (evt->dwFlags & IEEDF_SENT)
evt->pszNickT = Contact_GetInfo(CNF_DISPLAY, NULL, dat->szProto);
else
- evt->pszNickT = mir_tstrdup(pcli->pfnGetContactDisplayName(hContact, 0));
+ evt->pszNickT = mir_wstrdup(pcli->pfnGetContactDisplayName(hContact, 0));
if (evt->eventType == EVENTTYPE_FILE) {
char *filename = ((char*)dbei.pBlob) + sizeof(DWORD);
@@ -179,24 +179,24 @@ static EventData* GetTestEvents() {
EventData *evt, *firstEvent, *prevEvent;
firstEvent = prevEvent = evt = GetTestEvent(IEEDF_SENT);
- evt->pszNickT = mir_tstrdup(TranslateT("Me"));
- evt->pszTextT = mir_tstrdup(TranslateT("O Lord, bless this Thy hand grenade that with it Thou mayest blow Thine enemies"));
+ evt->pszNickT = mir_wstrdup(TranslateT("Me"));
+ evt->pszTextT = mir_wstrdup(TranslateT("O Lord, bless this Thy hand grenade that with it Thou mayest blow Thine enemies"));
evt = GetTestEvent(IEEDF_SENT);
- evt->pszNickT = mir_tstrdup(TranslateT("Me"));
- evt->pszTextT = mir_tstrdup(TranslateT("to tiny bits, in Thy mercy"));
+ evt->pszNickT = mir_wstrdup(TranslateT("Me"));
+ evt->pszTextT = mir_wstrdup(TranslateT("to tiny bits, in Thy mercy"));
prevEvent->next = evt;
prevEvent = evt;
evt = GetTestEvent(0);
- evt->pszNickT = mir_tstrdup(TranslateT("My contact"));
- evt->pszTextT = mir_tstrdup(TranslateT("Lorem ipsum dolor sit amet,"));
+ evt->pszNickT = mir_wstrdup(TranslateT("My contact"));
+ evt->pszTextT = mir_wstrdup(TranslateT("Lorem ipsum dolor sit amet,"));
prevEvent->next = evt;
prevEvent = evt;
evt = GetTestEvent(0);
- evt->pszNickT = mir_tstrdup(TranslateT("My contact"));
- evt->pszTextT = mir_tstrdup(TranslateT("consectetur adipisicing elit"));
+ evt->pszNickT = mir_wstrdup(TranslateT("My contact"));
+ evt->pszTextT = mir_wstrdup(TranslateT("consectetur adipisicing elit"));
prevEvent->next = evt;
prevEvent = evt;
return firstEvent;
@@ -364,31 +364,31 @@ wchar_t* TimestampToString(DWORD dwFlags, time_t check, int mode) today = mktime(&tm_today);
if (dwFlags & SMF_RELATIVEDATE && check >= today) {
- mir_tstrcpy(szResult, TranslateT("Today"));
+ mir_wstrcpy(szResult, TranslateT("Today"));
if (mode == 0)
- mir_tstrcat(szResult, L",");
+ mir_wstrcat(szResult, L",");
}
else if (dwFlags & SMF_RELATIVEDATE && check > (today - 86400)) {
- mir_tstrcpy(szResult, TranslateT("Yesterday"));
+ mir_wstrcpy(szResult, TranslateT("Yesterday"));
if (mode == 0)
- mir_tstrcat(szResult, L",");
+ mir_wstrcat(szResult, L",");
}
else {
if (dwFlags & SMF_LONGDATE)
- mir_tstrcpy(format, L"D");
+ mir_wstrcpy(format, L"D");
else
- mir_tstrcpy(format, L"d");
+ mir_wstrcpy(format, L"d");
}
}
if (mode == 0 || mode == 2) {
if (mode == 0 && (dwFlags & SMF_SHOWDATE))
- mir_tstrcat(format, L" ");
+ mir_wstrcat(format, L" ");
- mir_tstrcat(format, (dwFlags & SMF_SHOWSECONDS) ? L"s" : L"t");
+ mir_wstrcat(format, (dwFlags & SMF_SHOWSECONDS) ? L"s" : L"t");
}
if (format[0] != '\0') {
TimeZone_PrintTimeStamp(NULL, check, format, str, _countof(str), 0);
- mir_tstrncat(szResult, str, _countof(szResult) - mir_tstrlen(szResult));
+ mir_wstrncat(szResult, str, _countof(szResult) - mir_wstrlen(szResult));
}
return szResult;
}
diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index 85f3f26fcc..6685fdc099 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -188,9 +188,9 @@ void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour) lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
mir_snprintf(str, "%s%d", "SRMFont", i);
- ptrT tszFace(db_get_tsa(NULL, SRMMMOD, str));
+ ptrW tszFace(db_get_tsa(NULL, SRMMMOD, str));
if (tszFace == NULL)
- mir_tstrcpy(lf->lfFaceName, fontOptionsList[i].szDefFace);
+ mir_wstrcpy(lf->lfFaceName, fontOptionsList[i].szDefFace);
else
wcsncpy(lf->lfFaceName, tszFace, _countof(lf->lfFaceName));
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 41c9fc09e9..19f42b14f9 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -121,7 +121,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam) }
if (hwnd == NULL || !IsWindowVisible(GetParent(hwnd))) {
wchar_t toolTip[256];
- mir_sntprintf(toolTip, TranslateT("Message from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_snwprintf(toolTip, TranslateT("Message from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
CLISTEVENT cle = {};
cle.flags = CLEF_TCHAR;
@@ -206,7 +206,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam) SendMessage(hwnd, DM_TYPING, 0, lParam);
else if (lParam && (g_dat.flags2 & SMF2_SHOWTYPINGTRAY)) {
wchar_t szTip[256];
- mir_sntprintf(szTip, TranslateT("%s is typing a message"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_snwprintf(szTip, TranslateT("%s is typing a message"), pcli->pfnGetContactDisplayName(hContact, 0));
if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY) && !(g_dat.flags2 & SMF2_SHOWTYPINGCLIST)) {
MIRANDASYSTRAYNOTIFY tn;
@@ -302,7 +302,7 @@ static void RestoreUnreadMessageAlerts(void) for (int i = 0; i < arEvents.getCount(); i++) {
MSavedEvent &e = arEvents[i];
- mir_sntprintf(toolTip, TranslateT("Message from %s"), pcli->pfnGetContactDisplayName(e.hContact, 0));
+ mir_snwprintf(toolTip, TranslateT("Message from %s"), pcli->pfnGetContactDisplayName(e.hContact, 0));
cle.hContact = e.hContact;
cle.hDbEvent = e.hEvent;
pcli->pfnAddEvent(&cle);
@@ -647,7 +647,7 @@ STDMETHODIMP CREOleCallback::GetInPlaceContext(LPOLEINPLACEFRAME*, LPOLEINPLACEU STDMETHODIMP CREOleCallback::GetNewStorage(LPSTORAGE *lplpstg)
{
wchar_t sztName[64];
- mir_sntprintf(sztName, L"s%u", nextStgId++);
+ mir_snwprintf(sztName, L"s%u", nextStgId++);
if (pictStg == NULL)
return STG_E_MEDIUMFULL;
return pictStg->CreateStorage(sztName, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, lplpstg);
diff --git a/plugins/Scriver/src/msgtimedout.cpp b/plugins/Scriver/src/msgtimedout.cpp index 1db437ddbf..61c930800a 100644 --- a/plugins/Scriver/src/msgtimedout.cpp +++ b/plugins/Scriver/src/msgtimedout.cpp @@ -50,7 +50,7 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar SendDlgItemMessage(hwndDlg, IDC_MSGTEXT, EM_SETTEXTEX, (WPARAM)&st, (LPARAM)ewd->szText);
}
if (ewd->szName)
- mir_sntprintf(szText, L"%s - %s", TranslateT("Send error"), ewd->szName);
+ mir_snwprintf(szText, L"%s - %s", TranslateT("Send error"), ewd->szName);
else
wcsncpy_s(szText, TranslateT("Send error"), _TRUNCATE);
diff --git a/plugins/Scriver/src/msgwindow.cpp b/plugins/Scriver/src/msgwindow.cpp index 3bf73b1fb3..8744cb1b64 100644 --- a/plugins/Scriver/src/msgwindow.cpp +++ b/plugins/Scriver/src/msgwindow.cpp @@ -37,7 +37,7 @@ static const wchar_t *titleTokenNames[] = { L"%name%", L"%status%", L"%statusmsg wchar_t* GetWindowTitle(MCONTACT hContact, const char *szProto)
{
- ptrT tmplt;
+ ptrW tmplt;
const wchar_t* tokens[4] = { 0 };
CMString tszTemplate, tszStatus, tszTitle;
@@ -45,7 +45,7 @@ wchar_t* GetWindowTitle(MCONTACT hContact, const char *szProto) tokens[0] = pcli->pfnGetContactDisplayName(hContact, 0);
tokens[1] = pcli->pfnGetStatusModeDescription(db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
- tszStatus = ptrT(db_get_tsa(hContact, "CList", "StatusMsg"));
+ tszStatus = ptrW(db_get_tsa(hContact, "CList", "StatusMsg"));
tszStatus.Replace(L"\r\n", L" ");
tokens[2] = tszStatus;
@@ -53,7 +53,7 @@ wchar_t* GetWindowTitle(MCONTACT hContact, const char *szProto) if (accModule != NULL) {
PROTOACCOUNT* proto = Proto_GetAccount(accModule);
if (proto != NULL)
- tokens[3] = mir_tstrdup(proto->tszAccountName);
+ tokens[3] = mir_wstrdup(proto->tszAccountName);
}
tmplt = db_get_tsa(NULL, SRMMMOD, SRMSGSET_WINDOWTITLE);
@@ -71,7 +71,7 @@ wchar_t* GetWindowTitle(MCONTACT hContact, const char *szProto) if (*p == '%') {
int i;
for (i = 0; i < _countof(titleTokenNames); i++) {
- size_t tnlen = mir_tstrlen(titleTokenNames[i]);
+ size_t tnlen = mir_wstrlen(titleTokenNames[i]);
if (!wcsncmp(p, titleTokenNames[i], tnlen)) {
if (tokens[i] != NULL)
tszTitle.Append(tokens[i]);
@@ -1209,7 +1209,7 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (tbd->iFlags & TBDF_TEXT) {
wchar_t oldtitle[256];
GetWindowText(hwndDlg, oldtitle, _countof(oldtitle));
- if (mir_tstrcmp(tbd->pszText, oldtitle))
+ if (mir_wstrcmp(tbd->pszText, oldtitle))
SetWindowText(hwndDlg, tbd->pszText);
}
if (tbd->iFlags & TBDF_ICON) {
diff --git a/plugins/Scriver/src/sendqueue.cpp b/plugins/Scriver/src/sendqueue.cpp index 770d00dc9c..d192556df0 100644 --- a/plugins/Scriver/src/sendqueue.cpp +++ b/plugins/Scriver/src/sendqueue.cpp @@ -104,8 +104,8 @@ void ReportSendQueueTimeouts(HWND hwndSender) if (item->hwndSender == hwndSender && item->hwndErrorDlg == NULL) {
if (hwndSender != NULL) {
ErrorWindowData *ewd = (ErrorWindowData *)mir_alloc(sizeof(ErrorWindowData));
- ewd->szName = mir_tstrdup(pcli->pfnGetContactDisplayName(item->hContact, 0));
- ewd->szDescription = mir_tstrdup(TranslateT("The message send timed out."));
+ ewd->szName = mir_wstrdup(pcli->pfnGetContactDisplayName(item->hContact, 0));
+ ewd->szDescription = mir_wstrdup(TranslateT("The message send timed out."));
ewd->szText = GetSendBufferMsg(item);
ewd->hwndParent = hwndSender;
ewd->queueItem = item;
diff --git a/plugins/Scriver/src/utils.cpp b/plugins/Scriver/src/utils.cpp index 8e771e2485..e52f9db5cc 100644 --- a/plugins/Scriver/src/utils.cpp +++ b/plugins/Scriver/src/utils.cpp @@ -143,7 +143,7 @@ char* GetRichTextRTF(HWND hwnd) void rtrimText(wchar_t *text)
{
static wchar_t szTrimString[] = L":;,.!?\'\"><()[]- \r\n";
- size_t iLen = mir_tstrlen(text) - 1;
+ size_t iLen = mir_wstrlen(text) - 1;
while (wcschr(szTrimString, text[iLen])) {
text[iLen] = '\0';
iLen--;
@@ -152,7 +152,7 @@ void rtrimText(wchar_t *text) wchar_t* limitText(wchar_t *text, int limit)
{
- size_t len = mir_tstrlen(text);
+ size_t len = mir_wstrlen(text);
if (len > g_dat.limitNamesLength) {
wchar_t *ptszTemp = (wchar_t*)mir_alloc(sizeof(wchar_t) * (limit + 4));
wcsncpy(ptszTemp, text, limit + 1);
@@ -387,7 +387,7 @@ void SetSearchEngineIcons(HMENU hMenu, HIMAGELIST hImageList) void GetContactUniqueId(SrmmWindowData *dat, char *buf, int maxlen)
{
- ptrT id(Contact_GetInfo(CNF_UNIQUEID, dat->hContact, dat->szProto));
+ ptrW id(Contact_GetInfo(CNF_UNIQUEID, dat->hContact, dat->szProto));
if (id != NULL)
strncpy_s(buf, maxlen, _T2A(id), _TRUNCATE);
}
diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp index 0adf09a814..acbe31564a 100644 --- a/plugins/SecureIM/src/options.cpp +++ b/plugins/SecureIM/src/options.cpp @@ -1624,7 +1624,7 @@ BOOL SaveExportRSAKeyDlg(HWND hParent, LPSTR key, BOOL priv) {
char szFile[MAX_PATH] = "rsa_pub.asc";
if (priv)
- mir_tstrcpy(szFile, "rsa_priv.asc");
+ mir_strcpy(szFile, "rsa_priv.asc");
OPENFILENAME ofn = { sizeof(ofn) };
char temp[MAX_PATH];
@@ -1652,7 +1652,7 @@ BOOL LoadImportRSAKeyDlg(HWND hParent, LPSTR key, BOOL priv) {
char szFile[MAX_PATH] = "rsa_pub.asc";
if (priv)
- mir_tstrcpy(szFile, "rsa_priv.asc");
+ mir_strcpy(szFile, "rsa_priv.asc");
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
diff --git a/plugins/SeenPlugin/src/file.cpp b/plugins/SeenPlugin/src/file.cpp index 5337d2ecb5..bd61b7a820 100644 --- a/plugins/SeenPlugin/src/file.cpp +++ b/plugins/SeenPlugin/src/file.cpp @@ -30,18 +30,18 @@ static wchar_t *g_ptszFileStamp, *g_ptszFileName; void InitFileOutput(void)
{
- ptrT tszFileName(db_get_tsa(NULL, S_MOD, "FileName"));
+ ptrW tszFileName(db_get_tsa(NULL, S_MOD, "FileName"));
if (tszFileName == NULL)
- tszFileName = mir_tstrdup(DEFAULT_FILENAME);
- replaceStrT(g_ptszFileName, VARST(tszFileName));
+ tszFileName = mir_wstrdup(DEFAULT_FILENAME);
+ replaceStrW(g_ptszFileName, VARST(tszFileName));
wchar_t *tszPath = NEWWSTR_ALLOCA(g_ptszFileName);
wchar_t *p = wcsrchr(tszPath, '\\');
if (p) *p = 0;
CreateDirectoryTreeT(tszPath);
- ptrT tszFileStamp(db_get_tsa(NULL, S_MOD, "FileStamp"));
- replaceStrT(g_ptszFileStamp, (tszFileStamp == NULL) ? DEFAULT_FILESTAMP : tszFileStamp);
+ ptrW tszFileStamp(db_get_tsa(NULL, S_MOD, "FileStamp"));
+ replaceStrW(g_ptszFileStamp, (tszFileStamp == NULL) ? DEFAULT_FILESTAMP : tszFileStamp);
}
void UninitFileOutput()
diff --git a/plugins/SeenPlugin/src/history.cpp b/plugins/SeenPlugin/src/history.cpp index 4aa5d23d1b..a89a7f2ce3 100644 --- a/plugins/SeenPlugin/src/history.cpp +++ b/plugins/SeenPlugin/src/history.cpp @@ -174,7 +174,7 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hwndDlg, UINT Message, WPARAM wparam, LPARA TranslateDialogDefault(hwndDlg);
hContact = (MCONTACT)lparam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lparam);
- mir_sntprintf(sztemp, L"%s: %s",
+ mir_snwprintf(sztemp, L"%s: %s",
pcli->pfnGetContactDisplayName(hContact, 0),
TranslateT("last seen history"));
SetWindowText(hwndDlg, sztemp);
diff --git a/plugins/SeenPlugin/src/menu.cpp b/plugins/SeenPlugin/src/menu.cpp index a5fec18486..b2728560d2 100644 --- a/plugins/SeenPlugin/src/menu.cpp +++ b/plugins/SeenPlugin/src/menu.cpp @@ -43,7 +43,7 @@ int BuildContactMenu(WPARAM hContact, LPARAM) }
LPCTSTR ptszName;
- ptrT tszStamp(db_get_tsa(NULL, S_MOD, "MenuStamp"));
+ ptrW tszStamp(db_get_tsa(NULL, S_MOD, "MenuStamp"));
if (tszStamp != NULL)
ptszName = ParseString(tszStamp , hContact);
else
@@ -51,7 +51,7 @@ int BuildContactMenu(WPARAM hContact, LPARAM) int flags = 0;
HICON hIcon = NULL;
- if (!mir_tstrcmp(ptszName, TranslateT("<unknown>"))) {
+ if (!mir_wstrcmp(ptszName, TranslateT("<unknown>"))) {
if (IsWatchedProtocol(szProto))
flags |= CMIF_GRAYED;
else
diff --git a/plugins/SeenPlugin/src/missed.cpp b/plugins/SeenPlugin/src/missed.cpp index 5288c204f5..a3ce568a16 100644 --- a/plugins/SeenPlugin/src/missed.cpp +++ b/plugins/SeenPlugin/src/missed.cpp @@ -105,18 +105,16 @@ int ShowMissed(void) if (!mcs.count)
return 0;
- wchar_t sztemp[1024], szcount[7];
+ CMStringW buf;
for (int loop = 0; loop < mcs.count; loop++) {
- mir_tstrncat(sztemp, (wchar_t*)pcli->pfnGetContactDisplayName(mcs.wpcontact[loop], 0), _countof(sztemp) - mir_tstrlen(sztemp));
- if (db_get_b(NULL, S_MOD, "MissedOnes_Count", 0)) {
- mir_sntprintf(szcount, L" [%i]", mcs.times[loop]);
- mir_tstrcat(sztemp, szcount);
- }
+ buf.Append(pcli->pfnGetContactDisplayName(mcs.wpcontact[loop], 0));
+ if (db_get_b(NULL, S_MOD, "MissedOnes_Count", 0))
+ buf.AppendFormat(L" [%i]", mcs.times[loop]);
- mir_tstrcat(sztemp, L"\n");
+ buf.AppendChar('\n');
}
- CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_MISSED), NULL, MissedDlgProc, (LPARAM)sztemp);
+ CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_MISSED), NULL, MissedDlgProc, (LPARAM)buf.c_str());
return 0;
}
diff --git a/plugins/SeenPlugin/src/userinfo.cpp b/plugins/SeenPlugin/src/userinfo.cpp index 318e336278..4fb56ce9f7 100644 --- a/plugins/SeenPlugin/src/userinfo.cpp +++ b/plugins/SeenPlugin/src/userinfo.cpp @@ -41,11 +41,11 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lpar case WM_REFRESH_UI:
{
- ptrT szout(db_get_tsa(NULL, S_MOD, "UserStamp"));
+ ptrW szout(db_get_tsa(NULL, S_MOD, "UserStamp"));
wchar_t *str = ParseString((szout != NULL) ? szout : DEFAULT_USERSTAMP, wparam);
SetDlgItemText(hdlg, IDC_INFOTEXT, str);
- if (!mir_tstrcmp(str, TranslateT("<unknown>")))
+ if (!mir_wstrcmp(str, TranslateT("<unknown>")))
EnableWindow(GetDlgItem(hdlg, IDC_INFOTEXT), FALSE);
}
break;
diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp index e820fa97b6..8ff36e51f0 100644 --- a/plugins/SeenPlugin/src/utils.cpp +++ b/plugins/SeenPlugin/src/utils.cpp @@ -161,12 +161,12 @@ wchar_t* ParseString(wchar_t *szstring, MCONTACT hcontact) SYSTEMTIME st;
if (!isSeen(hcontact, &st)) {
- mir_tstrcat(sztemp, TranslateT("<never seen>"));
+ mir_wstrcat(sztemp, TranslateT("<never seen>"));
return sztemp;
}
char *szProto = hcontact ? GetContactProto(hcontact) : courProtoName;
- ptrT info;
+ ptrW info;
wchar_t *d = sztemp;
for (wchar_t *p = szstring; *p; p++) {
@@ -209,7 +209,7 @@ wchar_t* ParseString(wchar_t *szstring, MCONTACT hcontact) }
charPtr = TranslateTS(weekdays[isetting]);
LBL_charPtr:
- d += mir_sntprintf(d, MAXSIZE - (d - sztemp), L"%s", charPtr);
+ d += mir_snwprintf(d, MAXSIZE - (d - sztemp), L"%s", charPtr);
break;
case 'w':
@@ -282,8 +282,8 @@ wchar_t* ParseString(wchar_t *szstring, MCONTACT hcontact) if (isetting = db_get_w(hcontact, S_MOD, hcontact ? "StatusTriger" : courProtoName, 0)) {
wcsncpy(szdbsetting, pcli->pfnGetStatusModeDescription(isetting | 0x8000, 0), _countof(szdbsetting));
if (!(isetting & 0x8000)) {
- mir_tstrncat(szdbsetting, L"/", _countof(szdbsetting) - mir_tstrlen(szdbsetting));
- mir_tstrncat(szdbsetting, TranslateT("Idle"), _countof(szdbsetting) - mir_tstrlen(szdbsetting));
+ mir_wstrncat(szdbsetting, L"/", _countof(szdbsetting) - mir_wstrlen(szdbsetting));
+ mir_wstrncat(szdbsetting, TranslateT("Idle"), _countof(szdbsetting) - mir_wstrlen(szdbsetting));
}
charPtr = szdbsetting;
goto LBL_charPtr;
@@ -294,7 +294,7 @@ wchar_t* ParseString(wchar_t *szstring, MCONTACT hcontact) if (db_get_ts(hcontact, "CList", "StatusMsg", &dbv))
goto LBL_noData;
- d += mir_sntprintf(d, MAXSIZE - (d - sztemp), L"%s", dbv.ptszVal);
+ d += mir_snwprintf(d, MAXSIZE - (d - sztemp), L"%s", dbv.ptszVal);
db_free(&dbv);
break;
@@ -302,8 +302,8 @@ wchar_t* ParseString(wchar_t *szstring, MCONTACT hcontact) if (isetting = db_get_w(hcontact, S_MOD, hcontact ? "OldStatus" : courProtoName, 0)) {
wcsncpy(szdbsetting, pcli->pfnGetStatusModeDescription(isetting, 0), _countof(szdbsetting));
if (includeIdle && hcontact && db_get_b(hcontact, S_MOD, "OldIdle", 0)) {
- mir_tstrncat(szdbsetting, L"/", _countof(szdbsetting) - mir_tstrlen(szdbsetting));
- mir_tstrncat(szdbsetting, TranslateT("Idle"), _countof(szdbsetting) - mir_tstrlen(szdbsetting));
+ mir_wstrncat(szdbsetting, L"/", _countof(szdbsetting) - mir_wstrlen(szdbsetting));
+ mir_wstrncat(szdbsetting, TranslateT("Idle"), _countof(szdbsetting) - mir_wstrlen(szdbsetting));
}
charPtr = szdbsetting;
goto LBL_charPtr;
diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp index cfbbb32b07..ac1082df93 100644 --- a/plugins/SendScreenshotPlus/src/CSend.cpp +++ b/plugins/SendScreenshotPlus/src/CSend.cpp @@ -94,7 +94,7 @@ INT_PTR CALLBACK CSend::ResultDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(ICO_MAIN)); { CSend* self = (CSend*)lParam; - wchar_t* tmp = mir_tstrdup(TranslateT("Resulting URL from\n")); + wchar_t* tmp = mir_wstrdup(TranslateT("Resulting URL from\n")); mir_tstradd(tmp, self->m_pszSendTyp); SetDlgItemText(hwndDlg, IDC_HEADERBAR, tmp); mir_free(tmp); @@ -189,7 +189,7 @@ INT_PTR CALLBACK CSend::ResultDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, EmptyClipboard(); HGLOBAL clipbuffer = GlobalAlloc(GMEM_MOVEABLE, len*sizeof(wchar_t) + sizeof(wchar_t)); wchar_t* tmp2 = (wchar_t*)GlobalLock(clipbuffer); - mir_tstrncpy(tmp2, tmp, len + 1); tmp2[len] = '\0'; + mir_wstrncpy(tmp2, tmp, len + 1); tmp2[len] = '\0'; GlobalUnlock(clipbuffer); SetClipboardData(CF_UNICODETEXT, clipbuffer); CloseClipboard(); @@ -211,11 +211,11 @@ void CSend::svcSendMsgExit(const char* szMessage) } if (!m_hContact) { if (!m_pszFileDesc) - m_pszFileDesc = mir_a2t(szMessage); + m_pszFileDesc = mir_a2u(szMessage); Exit(CSEND_DIALOG); return; } if (m_ChatRoom) { - wchar_t* tmp = mir_a2t(szMessage); + wchar_t* tmp = mir_a2u(szMessage); if (m_pszFileDesc) { mir_tstradd(tmp, L"\r\n"); mir_tstradd(tmp, m_pszFileDesc); @@ -252,7 +252,7 @@ void CSend::svcSendMsgExit(const char* szMessage) memset(m_szEventMsg, 0, (sizeof(char) * m_cbEventMsg)); mir_strcpy(m_szEventMsg, szMessage); if (m_pszFileDesc && m_pszFileDesc[0] != NULL) { - char *temp = mir_t2a(m_pszFileDesc); + char *temp = mir_u2a(m_pszFileDesc); mir_stradd(m_szEventMsg, "\r\n"); mir_stradd(m_szEventMsg, temp); m_cbEventMsg = (DWORD)mir_strlen(m_szEventMsg) + 1; @@ -286,13 +286,13 @@ void CSend::svcSendFileExit() Exit(ACKRESULT_FAILED); return; } mir_freeAndNil(m_szEventMsg); - char* szFile = mir_t2a(m_pszFile); + char* szFile = mir_u2a(m_pszFile); m_cbEventMsg = (DWORD)mir_strlen(szFile) + 2; m_szEventMsg = (char*)mir_realloc(m_szEventMsg, (sizeof(char) * m_cbEventMsg)); memset(m_szEventMsg, 0, (sizeof(char) * m_cbEventMsg)); mir_strcpy(m_szEventMsg, szFile); if (m_pszFileDesc && m_pszFileDesc[0] != NULL) { - char* temp = mir_t2a(m_pszFileDesc); + char* temp = mir_u2a(m_pszFileDesc); m_cbEventMsg += (DWORD)mir_strlen(temp); m_szEventMsg = (char*)mir_realloc(m_szEventMsg, sizeof(char)*m_cbEventMsg); mir_strcpy(m_szEventMsg + mir_strlen(szFile) + 1, temp); @@ -308,8 +308,8 @@ void CSend::svcSendFileExit() // Start miranda PSS_FILE based on mir ver (T) wchar_t* ppFile[2] = { 0, 0 }; - wchar_t* pDesc = mir_tstrdup(m_pszFileDesc); - ppFile[0] = mir_tstrdup(m_pszFile); + wchar_t* pDesc = mir_wstrdup(m_pszFileDesc); + ppFile[0] = mir_wstrdup(m_pszFile); ppFile[1] = NULL; m_hSend = (HANDLE)ProtoChainSend(m_hContact, PSS_FILE, (WPARAM)pDesc, (LPARAM)ppFile); mir_free(pDesc); @@ -399,14 +399,14 @@ void CSend::Error(LPCTSTR pszFormat, ...) { wchar_t tszMsg[MAX_SECONDLINE]; - mir_sntprintf(tszMsg, L"%s - %s", _A2W(SZ_SENDSS), TranslateT("Error")); - mir_free(m_ErrorTitle), m_ErrorTitle = mir_tstrdup(tszMsg); + mir_snwprintf(tszMsg, L"%s - %s", _A2W(SZ_SENDSS), TranslateT("Error")); + mir_free(m_ErrorTitle), m_ErrorTitle = mir_wstrdup(tszMsg); va_list vl; va_start(vl, pszFormat); - mir_vsntprintf(tszMsg, _countof(tszMsg), TranslateTS(pszFormat), vl); + mir_vsnwprintf(tszMsg, _countof(tszMsg), TranslateTS(pszFormat), vl); va_end(vl); - mir_free(m_ErrorMsg), m_ErrorMsg = mir_tstrdup(tszMsg); + mir_free(m_ErrorMsg), m_ErrorMsg = mir_wstrdup(tszMsg); memset(&m_box, 0, sizeof(MSGBOX)); m_box.cbSize = sizeof(MSGBOX); diff --git a/plugins/SendScreenshotPlus/src/CSend.h b/plugins/SendScreenshotPlus/src/CSend.h index 293e34f077..3c5362be3f 100644 --- a/plugins/SendScreenshotPlus/src/CSend.h +++ b/plugins/SendScreenshotPlus/src/CSend.h @@ -56,9 +56,9 @@ class CSend { virtual int Send() = NULL; // returns 1 if sent (you must delete class) and 0 when still sending (class deletes itself) int SendSilent() {m_bAsync=m_bSilent=true; return Send();}; - void SetFile(wchar_t* file){mir_free(m_pszFile), m_pszFile=mir_tstrdup(file);}; - void SetFile(char* file){mir_free(m_pszFile), m_pszFile=mir_a2t(file);}; - void SetDescription(wchar_t* descr){mir_free(m_pszFileDesc), m_pszFileDesc=mir_tstrdup(descr);}; + void SetFile(wchar_t* file){mir_free(m_pszFile), m_pszFile=mir_wstrdup(file);}; + void SetFile(char* file){mir_free(m_pszFile), m_pszFile=mir_a2u(file);}; + void SetDescription(wchar_t* descr){mir_free(m_pszFileDesc), m_pszFileDesc=mir_wstrdup(descr);}; void SetContact(MCONTACT hContact); char* GetURL(){return m_URL;}; char* GetURLthumbnail(){return m_URLthumb;}; diff --git a/plugins/SendScreenshotPlus/src/CSendEmail.cpp b/plugins/SendScreenshotPlus/src/CSendEmail.cpp index dc91c4a867..9b8eb752d3 100644 --- a/plugins/SendScreenshotPlus/src/CSendEmail.cpp +++ b/plugins/SendScreenshotPlus/src/CSendEmail.cpp @@ -61,11 +61,11 @@ int CSendEmail::Send() m_pszFileName = GetFileNameA(m_pszFile); mir_free(m_pszFileA); - m_pszFileA = mir_t2a(m_pszFile); + m_pszFileA = mir_u2a(m_pszFile); - m_Email = mir_t2a(ptrT(Contact_GetInfo(CNF_EMAIL, m_hContact, m_pszProto))); - m_FriendlyName = mir_t2a(ptrT(Contact_GetInfo(CNF_DISPLAY, m_hContact, m_pszProto))); - m_Subject = mir_t2a(m_pszFileDesc); + m_Email = mir_u2a(ptrW(Contact_GetInfo(CNF_EMAIL, m_hContact, m_pszProto))); + m_FriendlyName = mir_u2a(ptrW(Contact_GetInfo(CNF_DISPLAY, m_hContact, m_pszProto))); + m_Subject = mir_u2a(m_pszFileDesc); //SendByEmail(m_pszFileA, "", m_FriendlyName, m_Email, m_Subject); diff --git a/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp b/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp index 870ae89f82..559efceaae 100644 --- a/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp +++ b/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp @@ -50,7 +50,7 @@ int CSendHost_ImageShack::Send() return !m_bAsync; } memset(&m_nlhr, 0, sizeof(m_nlhr)); - char* tmp; tmp = mir_t2a(m_pszFile); + char* tmp; tmp = mir_u2a(m_pszFile); HTTPFormData frm[] = { // {"Referer",HTTPFORM_HEADER("http://www.imageshack.us/upload_api.php")}, { "fileupload", HTTPFORM_FILE(tmp) }, @@ -101,10 +101,10 @@ void CSendHost_ImageShack::SendThread() else {/// check error mess from server url = GetHTMLContent(reply->pData, "<error ", "</error>"); wchar_t* err = NULL; - if (url) err = mir_a2t(url); + if (url) err = mir_a2u(url); if (!err || !*err) {/// fallback to server response mess mir_free(err); - err = mir_a2t(reply->pData); + err = mir_a2u(reply->pData); } Error(L"%s", err); mir_free(err); diff --git a/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp b/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp index a6eb7c6e57..e87cc78e3f 100644 --- a/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp +++ b/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp @@ -35,7 +35,7 @@ int CSendHost_Imgur::Send() return !m_bAsync; } memset(&m_nlhr, 0, sizeof(m_nlhr)); - char* tmp; tmp = mir_t2a(m_pszFile); + char* tmp; tmp = mir_u2a(m_pszFile); HTTPFormData frm[] = { { "Authorization", HTTPFORM_HEADER("Client-ID 2a7303d78abe041") }, { "image", HTTPFORM_FILE(tmp) }, diff --git a/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp b/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp index 68232006ce..731bdc08f2 100644 --- a/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp +++ b/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp @@ -35,7 +35,7 @@ int CSendHost_UploadPie::Send() return !m_bAsync; } memset(&m_nlhr, 0, sizeof(m_nlhr)); - char* tmp; tmp = mir_t2a(m_pszFile); + char* tmp; tmp = mir_u2a(m_pszFile); HTTPFormData frm[] = { { "MAX_FILE_SIZE", HTTPFORM_INT(3145728) },// ?? { "upload", HTTPFORM_INT(1) },// ?? @@ -93,8 +93,8 @@ void CSendHost_UploadPie::SendThread(void* obj) else {/// check error mess from server const char* err = GetHTMLContent(reply->pData, "<p id=\"error\"", "</p>"); wchar_t* werr; - if (err) werr = mir_a2t(err); - else werr = mir_a2t(reply->pData); + if (err) werr = mir_a2u(err); + else werr = mir_a2u(reply->pData); self->Error(L"%s", werr); mir_free(werr); } diff --git a/plugins/SendScreenshotPlus/src/Main.cpp b/plugins/SendScreenshotPlus/src/Main.cpp index c2db7bff90..dd1e9f5111 100644 --- a/plugins/SendScreenshotPlus/src/Main.cpp +++ b/plugins/SendScreenshotPlus/src/Main.cpp @@ -75,7 +75,7 @@ wchar_t* GetCustomPath() wchar_t szPath[1024] = { 0 }; FoldersGetCustomPathT(m_hFolderScreenshot, szPath, 1024, pszPath); mir_free(pszPath); - pszPath = mir_tstrdup(szPath); + pszPath = mir_wstrdup(szPath); } if (!pszPath) { MessageBox(NULL, L"Can not retrieve screenshot path.", L"SendSS", MB_OK | MB_ICONERROR | MB_APPLMODAL); @@ -84,7 +84,7 @@ wchar_t* GetCustomPath() int result = CreateDirectoryTreeT(pszPath); if (result) { wchar_t szError[MAX_PATH]; - mir_sntprintf(szError, MAX_PATH, TranslateT("Could not create screenshot folder (error code: %d):\n%s\nDo you have write permissions?"), result, pszPath); + mir_snwprintf(szError, MAX_PATH, TranslateT("Could not create screenshot folder (error code: %d):\n%s\nDo you have write permissions?"), result, pszPath); MessageBox(NULL, szError, L"SendSS", MB_OK | MB_ICONERROR | MB_APPLMODAL); mir_free(pszPath); return 0; @@ -194,7 +194,7 @@ INT_PTR service_Send2ImageShack(WPARAM wParam, LPARAM lParam) result = mir_strdup(cSend->GetURL()); } else { - result = mir_t2a(cSend->GetErrorMsg()); + result = mir_u2a(cSend->GetErrorMsg()); } delete cSend; return (INT_PTR)result; diff --git a/plugins/SendScreenshotPlus/src/UAboutForm.cpp b/plugins/SendScreenshotPlus/src/UAboutForm.cpp index ae216cbbcd..2ef1e9470c 100644 --- a/plugins/SendScreenshotPlus/src/UAboutForm.cpp +++ b/plugins/SendScreenshotPlus/src/UAboutForm.cpp @@ -102,7 +102,7 @@ LRESULT TfrmAbout::wmInitdialog(WPARAM, LPARAM) char* data = (char*)mir_alloc(size + 1); memcpy(data, LockResource(LoadResource(g_hSendSS, hRes)), size); data[size] = '\0'; - wchar_t* pszCopyright = mir_a2t(data); + wchar_t* pszCopyright = mir_a2u(data); mir_free(data); mir_tstradd(pszText, pszCopyright); mir_free(pszCopyright); @@ -117,7 +117,7 @@ LRESULT TfrmAbout::wmInitdialog(WPARAM, LPARAM) char* data = (char*)mir_alloc(size + 1); memcpy(data, LockResource(LoadResource(g_hSendSS, hRes)), size); data[size] = '\0'; - wchar_t* pszText = mir_a2t(data); + wchar_t* pszText = mir_a2u(data); mir_free(data); SetDlgItemText(m_hWnd, IDC_CREDIT, pszText); mir_free(pszText); @@ -203,9 +203,9 @@ void TfrmAbout::btnPageClick() } SetWindowText(hCtrl, button); wchar_t newTitle[128]; - wchar_t* pszPlug = mir_a2t(__PLUGIN_NAME); - wchar_t* pszVer = mir_a2t(__VERSION_STRING_DOTS); - mir_sntprintf(newTitle, L"%s - %s\nv%s", pszPlug, title, pszVer); + wchar_t* pszPlug = mir_a2u(__PLUGIN_NAME); + wchar_t* pszVer = mir_a2u(__VERSION_STRING_DOTS); + mir_snwprintf(newTitle, L"%s - %s\nv%s", pszPlug, title, pszVer); mir_free(pszPlug); mir_free(pszVer); SetDlgItemText(m_hWnd, IDC_HEADERBAR, newTitle); diff --git a/plugins/SendScreenshotPlus/src/UMainForm.cpp b/plugins/SendScreenshotPlus/src/UMainForm.cpp index 765cbfc410..9d7ac40e04 100644 --- a/plugins/SendScreenshotPlus/src/UMainForm.cpp +++ b/plugins/SendScreenshotPlus/src/UMainForm.cpp @@ -175,7 +175,7 @@ void TfrmMain::wmInitdialog(WPARAM, LPARAM) /// Taskbar and Window icon Window_SetIcon_IcoLib(m_hWnd, GetIconHandle(ICO_MAIN)); - wchar_t *pt = mir_tstrdup(pcli->pfnGetContactDisplayName(m_hContact, 0)); + wchar_t *pt = mir_wstrdup(pcli->pfnGetContactDisplayName(m_hContact, 0)); if (pt && (m_hContact != 0)) { CMString string; string.AppendFormat(TranslateT("Send screenshot to %s"), pt); @@ -240,7 +240,7 @@ void TfrmMain::wmInitdialog(WPARAM, LPARAM) if (m_MonitorCount > 1) { wchar_t tszTemp[120]; for (size_t mon = 0; mon < m_MonitorCount; ++mon) { /// @todo : fix format for non MSVC compilers - mir_sntprintf(tszTemp, L"%Iu. %s%s", + mir_snwprintf(tszTemp, L"%Iu. %s%s", mon + 1, TranslateT("Monitor"), (m_Monitors[mon].dwFlags & MONITORINFOF_PRIMARY) ? TranslateT(" (primary)") : L"" ); @@ -783,7 +783,7 @@ void TfrmMain::SaveOptions(void) //--------------------------------------------------------------------------- void TfrmMain::Init(wchar_t* DestFolder, MCONTACT Contact) { - m_FDestFolder = mir_tstrdup(DestFolder); + m_FDestFolder = mir_wstrdup(DestFolder); m_hContact = Contact; // create window @@ -810,7 +810,7 @@ void TfrmMain::btnCaptureClick() return; } fclose(fp); - mir_free(m_pszFile); m_pszFile = mir_tstrdup(filename); + mir_free(m_pszFile); m_pszFile = mir_wstrdup(filename); } else if (!m_hTargetWindow) { wchar_t *err = TranslateT("Select a target window."); @@ -944,8 +944,8 @@ void TfrmMain::edtSizeUpdate(HWND hWnd, BOOL ClientArea, HWND hTarget, UINT Ctrl _itow(rect.right - rect.left, B, 10); // _itow_s(rect.bottom - rect.top, H, 16, 10); _itow(rect.bottom - rect.top, H, 10); - mir_tstrncat(B, L"x", _countof(B) - mir_tstrlen(B)); - mir_tstrncat(B, H, _countof(B) - mir_tstrlen(B)); + mir_wstrncat(B, L"x", _countof(B) - mir_wstrlen(B)); + mir_wstrncat(B, H, _countof(B) - mir_wstrlen(B)); SetDlgItemText(hTarget, Ctrl, B); } @@ -956,8 +956,8 @@ void TfrmMain::edtSizeUpdate(RECT rect, HWND hTarget, UINT Ctrl) _itow(ABS(rect.right - rect.left), B, 10); // _itow_s(ABS(rect.bottom - rect.top), H, 16, 10); _itow(ABS(rect.bottom - rect.top), H, 10); - mir_tstrncat(B, L"x", _countof(B) - mir_tstrlen(B)); - mir_tstrncat(B, H, _countof(B) - mir_tstrlen(B)); + mir_wstrncat(B, L"x", _countof(B) - mir_wstrlen(B)); + mir_wstrncat(B, H, _countof(B) - mir_wstrlen(B)); SetDlgItemText(hTarget, Ctrl, B); } @@ -975,11 +975,11 @@ INT_PTR TfrmMain::SaveScreenshot(FIBITMAP* dib) if (FileNumber > 99999) FileNumber = 1; //Generate FileName mir_tstradd(path, m_FDestFolder); - if (path[mir_tstrlen(path) - 1] != '\\') mir_tstradd(path, L"\\"); + if (path[mir_wstrlen(path) - 1] != '\\') mir_tstradd(path, L"\\"); mir_tstradd(path, L"shot%.5u");//on format change, adapt "len" below - size_t len = mir_tstrlen(path) + 2; + size_t len = mir_wstrlen(path) + 2; pszFilename = (wchar_t*)mir_alloc(sizeof(wchar_t)*(len)); - mir_sntprintf(pszFilename, len, path, FileNumber); + mir_snwprintf(pszFilename, len, path, FileNumber); mir_free(path); //Generate a description according to the screenshot @@ -1103,7 +1103,7 @@ INT_PTR TfrmMain::SaveScreenshot(FIBITMAP* dib) //wchar_t* pszFormat = (wchar_t*)ComboBox_GetItemData(hwndCombo, ComboBox_GetCurSel(hwndCombo)); wchar_t pszFormat[6]; ComboBox_GetText(hwndCombo, pszFormat, 6); - if(ret && (mir_tstrcmpi (pszFormat,L"png") != 0)) { + if(ret && (mir_wstrcmpi (pszFormat,L"png") != 0)) { fif = FIP->FI_GetFIFFromFilenameU(ret); dib_new = FIP->FI_LoadU(fif, ret,0); @@ -1130,7 +1130,7 @@ INT_PTR TfrmMain::SaveScreenshot(FIBITMAP* dib) } else { mir_free(pszFileDesc); - m_pszFileDesc = mir_tstrdup(L""); + m_pszFileDesc = mir_wstrdup(L""); } if (m_cSend) { diff --git a/plugins/SendScreenshotPlus/src/Utils.cpp b/plugins/SendScreenshotPlus/src/Utils.cpp index 260631038f..21b70fc890 100644 --- a/plugins/SendScreenshotPlus/src/Utils.cpp +++ b/plugins/SendScreenshotPlus/src/Utils.cpp @@ -343,15 +343,15 @@ wchar_t* GetFileNameW(const wchar_t* pszPath) const wchar_t* slash = wcsrchr(pszPath, '\\'); if (!slash) slash = wcsrchr(pszPath, '/'); if (slash) - return mir_t2u(slash + 1); + return mir_wstrdup(slash + 1); else - return mir_t2u(pszPath); + return mir_wstrdup(pszPath); } wchar_t* GetFileExtW(const wchar_t* pszPath) { const wchar_t* slash = wcsrchr(pszPath, '.'); if (slash) - return mir_t2u(slash); + return mir_wstrdup(slash); return NULL; } @@ -360,15 +360,15 @@ char* GetFileNameA(const wchar_t* pszPath) const wchar_t* slash = wcsrchr(pszPath, '\\'); if (!slash) slash = wcsrchr(pszPath, '/'); if (slash) - return mir_t2a(slash + 1); + return mir_u2a(slash + 1); else - return mir_t2a(pszPath); + return mir_u2a(pszPath); } char* GetFileExtA(const wchar_t* pszPath) { const wchar_t* slash = wcsrchr(pszPath, '.'); if (slash) - return mir_t2a(slash); + return mir_u2a(slash); return NULL; } @@ -406,7 +406,7 @@ void SaveGIF(HBITMAP hBmp, wchar_t* szFilename) // Get the CLSID of the GIF encoder. CLSID clsidEncoder; if (GetEncoderClsid(L"image/gif", clsidEncoder)) { - LPWSTR pswFile = mir_t2u(szFilename); + LPWSTR pswFile = mir_wstrdup(szFilename); pBitmap->Save((const WCHAR*)pswFile, &clsidEncoder, NULL); mir_free(pswFile); } @@ -445,7 +445,7 @@ void SaveTIF(HBITMAP hBmp, wchar_t* szFilename) EncParams->Parameter[1].NumberOfValues = 1; EncParams->Parameter[1].Value = &ulColorDepth; - LPWSTR pswFile = mir_t2u(szFilename); + LPWSTR pswFile = mir_wstrdup(szFilename); stat = pBitmap->Save((const WCHAR*)pswFile, &EncCLSID, EncParams); mir_free(pswFile); free(EncParams); diff --git a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp index 975be30b92..95b567af0f 100644 --- a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp +++ b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp @@ -507,8 +507,8 @@ static INT_PTR CALLBACK MsgBoxPop(HWND hDlg, UINT uMsg, WPARAM, LPARAM lParam) pd.lchContact = NULL; //(HANDLE)wParam; // icon pd.lchIcon = MsgLoadIcon(pMsgBox); - mir_tstrncpy(pd.lptzContactName, pMsgBox->ptszTitle, _countof(pd.lptzContactName)); - mir_tstrncpy(pd.lptzText, pMsgBox->ptszMsg, _countof(pd.lptzText)); + mir_wstrncpy(pd.lptzContactName, pMsgBox->ptszTitle, _countof(pd.lptzContactName)); + mir_wstrncpy(pd.lptzText, pMsgBox->ptszMsg, _countof(pd.lptzText)); // CALLBAC Proc pd.PluginWindowProc = PopupProc; @@ -677,7 +677,7 @@ INT_PTR CALLBACK MsgBox(HWND hParent, UINT uType, LPCTSTR pszTitle, LPCTSTR pszI va_list vl; va_start(vl, pszFormat); - mir_vsntprintf(tszMsg, _countof(tszMsg), TranslateTS(pszFormat), vl); + mir_vsnwprintf(tszMsg, _countof(tszMsg), TranslateTS(pszFormat), vl); va_end(vl); MSGBOX mb = { 0 }; @@ -700,11 +700,11 @@ INT_PTR CALLBACK MsgBox(HWND hParent, UINT uType, LPCTSTR pszTitle, LPCTSTR pszI INT_PTR CALLBACK MsgErr(HWND hParent, LPCTSTR pszFormat, ...) { wchar_t tszTitle[MAX_SECONDLINE], tszMsg[MAX_SECONDLINE]; - mir_sntprintf(tszTitle, L"%s - %s", _A2W(MODNAME), TranslateT("Error")); + mir_snwprintf(tszTitle, L"%s - %s", _A2W(MODNAME), TranslateT("Error")); va_list vl; va_start(vl, pszFormat); - mir_vsntprintf(tszMsg, TranslateTS(pszFormat), vl); + mir_vsnwprintf(tszMsg, TranslateTS(pszFormat), vl); va_end(vl); MSGBOX mb = { 0 }; diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index 7a88a5816f..6c11fafe4f 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -459,7 +459,7 @@ INT_PTR OpenSessionsManagerWindow(WPARAM, LPARAM) return 0;
}
- ptrT
+ ptrW
tszSession(db_get_tsa(NULL, MODNAME, "SessionDate_0")),
tszUserSession(db_get_tsa(NULL, MODNAME, "UserSessionDsc_0"));
if (g_bIncompletedSave || tszSession || tszUserSession) {
@@ -485,7 +485,7 @@ int SaveSessionDate() GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, szDateBuf, DateSize);
int lenn = (DateSize + TimeSize + 5);
wchar_t *szSessionTime = (wchar_t*)mir_alloc(lenn*sizeof(wchar_t));
- mir_sntprintf(szSessionTime, lenn, L"%s - %s", szTimeBuf, szDateBuf);
+ mir_snwprintf(szSessionTime, lenn, L"%s - %s", szTimeBuf, szDateBuf);
char szSetting[256];
mir_snprintf(szSetting, "%s_%d", "SessionDate", 0);
@@ -607,7 +607,7 @@ int DelUserDefSession(int ses_count) for (int i = ses_count + 1;; i++) {
mir_snprintf(szSessionName, "%s_%u", "UserSessionDsc", i);
- ptrT szSessionNameBuf(db_get_tsa(NULL, MODNAME, szSessionName));
+ ptrW szSessionNameBuf(db_get_tsa(NULL, MODNAME, szSessionName));
mir_snprintf(szSessionName, "%s_%u", "UserSessionDsc", i - 1);
if (szSessionNameBuf) {
@@ -640,7 +640,7 @@ int DeleteAutoSession(int ses_count) for (int i = ses_count + 1;; i++) {
mir_snprintf(szSessionName, "%s_%u", "SessionDate", i);
- ptrT szSessionNameBuf(db_get_tsa(NULL, MODNAME, szSessionName));
+ ptrW szSessionNameBuf(db_get_tsa(NULL, MODNAME, szSessionName));
mir_snprintf(szSessionName, "%s_%u", "SessionDate", i - 1);
if (szSessionNameBuf)
diff --git a/plugins/ShellExt/src/options.cpp b/plugins/ShellExt/src/options.cpp index e052f2fda7..9fe7d6aee2 100644 --- a/plugins/ShellExt/src/options.cpp +++ b/plugins/ShellExt/src/options.cpp @@ -30,7 +30,7 @@ static void InitControls(HWND hwndDlg) int comReg = IsCOMRegistered();
wchar_t szBuf[MAX_PATH];
- mir_sntprintf(szBuf, L"%s (%s)",
+ mir_snwprintf(szBuf, L"%s (%s)",
TranslateTS(COM_OKSTR[(comReg & COMREG_OK) != 0]),
TranslateTS(COM_APPROVEDSTR[(comReg & COMREG_APPROVED) != 0]));
SetDlgItemText(hwndDlg, IDC_STATUS, szBuf);
diff --git a/plugins/ShellExt/src/shlcom.cpp b/plugins/ShellExt/src/shlcom.cpp index f711fb1512..e984015fe7 100644 --- a/plugins/ShellExt/src/shlcom.cpp +++ b/plugins/ShellExt/src/shlcom.cpp @@ -301,7 +301,7 @@ bool ipcGetSortedContacts(THeaderIPC *ipch, int *pSlot, bool bGroupMode) // create an IPC slot for each contact and store display name, etc
for (i = 0; i < dwContacts; i++) {
- ptrA szContact(mir_t2a(pcli->pfnGetContactDisplayName(pContacts[i].hContact, 0)));
+ ptrA szContact(mir_u2a(pcli->pfnGetContactDisplayName(pContacts[i].hContact, 0)));
if (szContact != NULL) {
ptrA szGroup;
if (bGroupMode)
@@ -552,7 +552,7 @@ void CheckUnregisterServer() // launches regsvr to remove the dll under admin.
wchar_t szFileName[MAX_PATH], szBuf[MAX_PATH * 2];
GetModuleFileName(hInst, szFileName, _countof(szFileName));
- mir_sntprintf(szBuf, L"/s /u \"%s\"", szFileName);
+ mir_snwprintf(szBuf, L"/s /u \"%s\"", szFileName);
SHELLEXECUTEINFO sei = { sizeof(sei) };
sei.lpVerb = L"runas";
@@ -581,7 +581,7 @@ void CheckRegisterServer() TranslateT("Miranda NG - Shell context menus (shellext.dll)"), MB_OK | MB_ICONINFORMATION);
// /s = silent
GetModuleFileName(hInst, szFileName, _countof(szFileName));
- mir_sntprintf(szBuf, L"/s \"%s\"", szFileName);
+ mir_snwprintf(szBuf, L"/s \"%s\"", szFileName);
SHELLEXECUTEINFO sei = { sizeof(sei) };
sei.lpVerb = L"runas";
diff --git a/plugins/SimpleAR/src/Main.cpp b/plugins/SimpleAR/src/Main.cpp index 451539ba83..a9b9200fd3 100644 --- a/plugins/SimpleAR/src/Main.cpp +++ b/plugins/SimpleAR/src/Main.cpp @@ -196,18 +196,18 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent) return FALSE;
}
- msgLen += mir_tstrlen(ptszVal);
+ msgLen += mir_wstrlen(ptszVal);
wchar_t *ptszHead = db_get_tsa(NULL, protocolname, KEY_HEADING);
if (ptszHead != NULL) {
ptszTemp = ptszHead;
ptszTemp.Replace(L"%user%", ptszNick);
- msgLen += mir_tstrlen(ptszTemp);
+ msgLen += mir_wstrlen(ptszTemp);
mir_free(ptszHead);
}
wchar_t *ptszTemp2 = (wchar_t*)mir_alloc(sizeof(wchar_t) * (msgLen + 5));
- mir_sntprintf(ptszTemp2, msgLen + 5, L"%s\r\n\r\n%s", ptszTemp.c_str(), ptszVal);
+ mir_snwprintf(ptszTemp2, msgLen + 5, L"%s\r\n\r\n%s", ptszTemp.c_str(), ptszVal);
if (ServiceExists(MS_VARS_FORMATSTRING)) {
ptszTemp = variables_parse(ptszTemp2, 0, hContact);
}
diff --git a/plugins/SimpleStatusMsg/src/awaymsg.cpp b/plugins/SimpleStatusMsg/src/awaymsg.cpp index dc3896efa3..177282ccad 100644 --- a/plugins/SimpleStatusMsg/src/awaymsg.cpp +++ b/plugins/SimpleStatusMsg/src/awaymsg.cpp @@ -41,9 +41,9 @@ static wchar_t *StrNormNewline(wchar_t *tszStr) nCR++;
if (!nCR)
- return mir_tstrdup(tszStr);
+ return mir_wstrdup(tszStr);
- wchar_t *tszNewStr = (wchar_t *)mir_alloc((mir_tstrlen(tszStr) + nCR + 1) * sizeof(wchar_t)), *ptszStr = tszNewStr;
+ wchar_t *tszNewStr = (wchar_t *)mir_alloc((mir_wstrlen(tszStr) + nCR + 1) * sizeof(wchar_t)), *ptszStr = tszNewStr;
while (*tszStr) {
if (*tszStr == 0x0A)
*ptszStr++ = 0x0D;
@@ -86,14 +86,14 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP wchar_t *status = pcli->pfnGetStatusModeDescription(dwStatus, 0);
GetWindowText(hwndDlg, format, _countof(format));
- mir_sntprintf(str, format, status, contactName);
+ mir_snwprintf(str, format, status, contactName);
SetWindowText(hwndDlg, str);
if (dat->hSeq) {
GetDlgItemText(hwndDlg, IDC_RETRIEVING, format, _countof(format));
- mir_sntprintf(str, format, status);
+ mir_snwprintf(str, format, status);
}
else {
- mir_sntprintf(str, TranslateT("Failed to retrieve %s message."), status);
+ mir_snwprintf(str, TranslateT("Failed to retrieve %s message."), status);
SetDlgItemText(hwndDlg, IDOK, TranslateT("&Close"));
}
SetDlgItemText(hwndDlg, IDC_RETRIEVING, str);
@@ -205,7 +205,7 @@ static INT_PTR CALLBACK CopyAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP wchar_t *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0);
wchar_t str[256], format[128];
GetWindowText(hwndDlg, format, _countof(format));
- mir_sntprintf(str, format, contactName);
+ mir_snwprintf(str, format, contactName);
SetWindowText(hwndDlg, str);
if (!dat->hSeq)
DestroyWindow(hwndDlg);
@@ -237,7 +237,7 @@ static INT_PTR CALLBACK CopyAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP wchar_t *tszMsg = StrNormNewline((wchar_t *)ack->lParam);
wcsncpy_s(msg, tszMsg, _TRUNCATE);
mir_free(tszMsg);
- size_t len = mir_tstrlen(msg);
+ size_t len = mir_wstrlen(msg);
if (len) {
LPTSTR lptstrCopy;
HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(wchar_t));
@@ -344,17 +344,17 @@ static int AwayMsgPreBuildMenu(WPARAM hContact, LPARAM) if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGRECV) {
if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(iStatus == ID_STATUS_OFFLINE ? ID_STATUS_INVISIBLE : iStatus)) {
HICON hIcon = Skin_LoadProtoIcon(szProto, iStatus);
- mir_sntprintf(str, TranslateT("Re&ad %s message"), pcli->pfnGetStatusModeDescription(iStatus, 0));
+ mir_snwprintf(str, TranslateT("Re&ad %s message"), pcli->pfnGetStatusModeDescription(iStatus, 0));
Menu_ModifyItem(hAwayMsgMenuItem, str, hIcon, 0);
IcoLib_ReleaseIcon(hIcon);
ptrA szMsg(db_get_sa(hContact, "CList", "StatusMsg"));
if (szMsg != NULL) {
- mir_sntprintf(str, TranslateT("Copy %s message"), pcli->pfnGetStatusModeDescription(iStatus, 0));
+ mir_snwprintf(str, TranslateT("Copy %s message"), pcli->pfnGetStatusModeDescription(iStatus, 0));
Menu_ModifyItem(hCopyMsgMenuItem, str);
if (StrFindURL(szMsg) != NULL) {
- mir_sntprintf(str, TranslateT("&Go to URL in %s message"), pcli->pfnGetStatusModeDescription(iStatus, 0));
+ mir_snwprintf(str, TranslateT("&Go to URL in %s message"), pcli->pfnGetStatusModeDescription(iStatus, 0));
Menu_ModifyItem(hGoToURLMenuItem, str);
}
}
diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp index 942eaa19a5..13893bcc83 100644 --- a/plugins/SimpleStatusMsg/src/main.cpp +++ b/plugins/SimpleStatusMsg/src/main.cpp @@ -122,7 +122,7 @@ static wchar_t *GetWinampSong(void) if (pstr < szTitle + (iTitleLen / 2))
{
- memmove(szTitle, pstr + 9, mir_tstrlen(pstr + 9) * sizeof(wchar_t));
+ memmove(szTitle, pstr + 9, mir_wstrlen(pstr + 9) * sizeof(wchar_t));
pstr = wcsstr(pstr + 1, L" - Winamp");
if (pstr == NULL)
{
@@ -140,7 +140,7 @@ static wchar_t *GetWinampSong(void) }
pstr += 2;
- res = mir_tstrdup(pstr);
+ res = mir_wstrdup(pstr);
mir_free(szTitle);
return res;
@@ -149,7 +149,7 @@ static wchar_t *GetWinampSong(void) wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int)
{
int i, count = 0, len;
- wchar_t substituteStr[1024], *msg = mir_tstrdup(in);
+ wchar_t substituteStr[1024], *msg = mir_wstrdup(in);
for (i = 0; msg[i]; i++)
{
@@ -163,7 +163,7 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) if (i + 2 <= 1024 && msg[i + 2])
{
count++;
- memmove(p, p + 1, (mir_tstrlen(p) - 1) * sizeof(wchar_t));
+ memmove(p, p + 1, (mir_wstrlen(p) - 1) * sizeof(wchar_t));
}
else
{
@@ -184,21 +184,21 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) if (ptszWinampTitle != NULL)
{
mir_free(g_ptszWinampSong);
- g_ptszWinampSong = mir_tstrdup(ptszWinampTitle);
+ g_ptszWinampSong = mir_wstrdup(ptszWinampTitle);
}
- else if (g_ptszWinampSong && mir_tstrcmp(g_ptszWinampSong, L"SimpleStatusMsg")
+ else if (g_ptszWinampSong && mir_wstrcmp(g_ptszWinampSong, L"SimpleStatusMsg")
&& db_get_b(NULL, "SimpleStatusMsg", "AmpLeaveTitle", 1))
{
- ptszWinampTitle = mir_tstrdup(g_ptszWinampSong);
+ ptszWinampTitle = mir_wstrdup(g_ptszWinampSong);
}
else
continue;
- if (mir_tstrlen(ptszWinampTitle) > 12)
- msg = (wchar_t *)mir_realloc(msg, (mir_tstrlen(msg) + 1 + mir_tstrlen(ptszWinampTitle) - 12) * sizeof(wchar_t));
+ if (mir_wstrlen(ptszWinampTitle) > 12)
+ msg = (wchar_t *)mir_realloc(msg, (mir_wstrlen(msg) + 1 + mir_wstrlen(ptszWinampTitle) - 12) * sizeof(wchar_t));
- memmove(msg + i + mir_tstrlen(ptszWinampTitle), msg + i + 12, (mir_tstrlen(msg) - i - 11) * sizeof(wchar_t));
- memcpy(msg + i, ptszWinampTitle, mir_tstrlen(ptszWinampTitle) * sizeof(wchar_t));
+ memmove(msg + i + mir_wstrlen(ptszWinampTitle), msg + i + 12, (mir_wstrlen(msg) - i - 11) * sizeof(wchar_t));
+ memcpy(msg + i, ptszWinampTitle, mir_wstrlen(ptszWinampTitle) * sizeof(wchar_t));
mir_free(ptszWinampTitle);
}
@@ -229,28 +229,28 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) }
else GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, NULL, NULL, substituteStr, _countof(substituteStr));
- if (mir_tstrlen(substituteStr) > 6)
- msg = (wchar_t *)mir_realloc(msg, (mir_tstrlen(msg) + 1 + mir_tstrlen(substituteStr) - 6) * sizeof(wchar_t));
+ if (mir_wstrlen(substituteStr) > 6)
+ msg = (wchar_t *)mir_realloc(msg, (mir_wstrlen(msg) + 1 + mir_wstrlen(substituteStr) - 6) * sizeof(wchar_t));
- memmove(msg + i + mir_tstrlen(substituteStr), msg + i + 6, (mir_tstrlen(msg) - i - 5) * sizeof(wchar_t));
- memcpy(msg + i, substituteStr, mir_tstrlen(substituteStr) * sizeof(wchar_t));
+ memmove(msg + i + mir_wstrlen(substituteStr), msg + i + 6, (mir_wstrlen(msg) - i - 5) * sizeof(wchar_t));
+ memcpy(msg + i, substituteStr, mir_wstrlen(substituteStr) * sizeof(wchar_t));
}
else if (!wcsnicmp(msg + i, L"%date%", 6))
{
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, substituteStr, _countof(substituteStr));
- if (mir_tstrlen(substituteStr) > 6)
- msg = (wchar_t *)mir_realloc(msg, (mir_tstrlen(msg) + 1 + mir_tstrlen(substituteStr) - 6) * sizeof(wchar_t));
+ if (mir_wstrlen(substituteStr) > 6)
+ msg = (wchar_t *)mir_realloc(msg, (mir_wstrlen(msg) + 1 + mir_wstrlen(substituteStr) - 6) * sizeof(wchar_t));
- memmove(msg + i + mir_tstrlen(substituteStr), msg + i + 6, (mir_tstrlen(msg) - i - 5) * sizeof(wchar_t));
- memcpy(msg + i, substituteStr, mir_tstrlen(substituteStr) * sizeof(wchar_t));
+ memmove(msg + i + mir_wstrlen(substituteStr), msg + i + 6, (mir_wstrlen(msg) - i - 5) * sizeof(wchar_t));
+ memcpy(msg + i, substituteStr, mir_wstrlen(substituteStr) * sizeof(wchar_t));
}
else if (!wcsnicmp(msg+i, L"%rand(", 6))
{
wchar_t *temp, *token;
int ran_from, ran_to, k;
- temp = mir_tstrdup(msg + i + 6);
+ temp = mir_wstrdup(msg + i + 6);
token = wcstok(temp, L",)");
ran_from = _wtoi(token);
token = wcstok(NULL, L",)%%");
@@ -258,14 +258,14 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) if (ran_to > ran_from)
{
- mir_sntprintf(substituteStr, L"%d", GetRandom(ran_from, ran_to));
+ mir_snwprintf(substituteStr, L"%d", GetRandom(ran_from, ran_to));
for (k = i + 1; msg[k]; k++) if (msg[k] == '%') { k++; break; }
- if (mir_tstrlen(substituteStr) > k - i)
- msg = (wchar_t *)mir_realloc(msg, (mir_tstrlen(msg) + 1 + mir_tstrlen(substituteStr) - (k - i)) * sizeof(wchar_t));
+ if (mir_wstrlen(substituteStr) > k - i)
+ msg = (wchar_t *)mir_realloc(msg, (mir_wstrlen(msg) + 1 + mir_wstrlen(substituteStr) - (k - i)) * sizeof(wchar_t));
- memmove(msg + i + mir_tstrlen(substituteStr), msg + i + (k - i), (mir_tstrlen(msg) - i - (k - i - 1)) * sizeof(wchar_t));
- memcpy(msg + i, substituteStr, mir_tstrlen(substituteStr) * sizeof(wchar_t));
+ memmove(msg + i + mir_wstrlen(substituteStr), msg + i + (k - i), (mir_wstrlen(msg) - i - (k - i - 1)) * sizeof(wchar_t));
+ memcpy(msg + i, substituteStr, mir_wstrlen(substituteStr) * sizeof(wchar_t));
}
mir_free(temp);
}
@@ -293,10 +293,10 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) if (tszStatusMsg == NULL)
continue;
- mir_tstrcpy(substituteStr, tszStatusMsg);
+ mir_wstrcpy(substituteStr, tszStatusMsg);
mir_free(tszStatusMsg);
- if (!mir_tstrlen(substituteStr))
+ if (!mir_wstrlen(substituteStr))
continue;
if (wcsstr(substituteStr, L"%randmsg%") != NULL || wcsstr(substituteStr, L"%randdefmsg%") != NULL)
@@ -306,13 +306,13 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) else rmark[0] = TRUE;
}
- if (k2 == maxk || k2 > maxk) mir_tstrcpy(substituteStr, L"");
+ if (k2 == maxk || k2 > maxk) mir_wstrcpy(substituteStr, L"");
- if (mir_tstrlen(substituteStr) > 9)
- msg = (wchar_t *)mir_realloc(msg, (mir_tstrlen(msg) + 1 + mir_tstrlen(substituteStr) - 9) * sizeof(wchar_t));
+ if (mir_wstrlen(substituteStr) > 9)
+ msg = (wchar_t *)mir_realloc(msg, (mir_wstrlen(msg) + 1 + mir_wstrlen(substituteStr) - 9) * sizeof(wchar_t));
- memmove(msg + i + mir_tstrlen(substituteStr), msg + i + 9, (mir_tstrlen(msg) - i - 8) * sizeof(wchar_t));
- memcpy(msg + i, substituteStr, mir_tstrlen(substituteStr) * sizeof(wchar_t));
+ memmove(msg + i + mir_wstrlen(substituteStr), msg + i + 9, (mir_wstrlen(msg) - i - 8) * sizeof(wchar_t));
+ memcpy(msg + i, substituteStr, mir_wstrlen(substituteStr) * sizeof(wchar_t));
}
else if (!wcsnicmp(msg+i, L"%randdefmsg%", 12))
{
@@ -338,10 +338,10 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) if (tszStatusMsg == NULL)
continue;
- mir_tstrcpy(substituteStr, tszStatusMsg);
+ mir_wstrcpy(substituteStr, tszStatusMsg);
mir_free(tszStatusMsg);
- if (!mir_tstrlen(substituteStr))
+ if (!mir_wstrlen(substituteStr))
continue;
if (wcsstr(substituteStr, L"%randmsg%") != NULL || wcsstr(substituteStr, L"%randdefmsg%") != NULL)
@@ -351,24 +351,24 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) else rmark[0] = TRUE;
}
- if (k2 == maxk || k2 > maxk) mir_tstrcpy(substituteStr, L"");
+ if (k2 == maxk || k2 > maxk) mir_wstrcpy(substituteStr, L"");
- if (mir_tstrlen(substituteStr) > 12)
- msg = (wchar_t *)mir_realloc(msg, (mir_tstrlen(msg)+1+mir_tstrlen(substituteStr)-12) * sizeof(wchar_t));
+ if (mir_wstrlen(substituteStr) > 12)
+ msg = (wchar_t *)mir_realloc(msg, (mir_wstrlen(msg)+1+mir_wstrlen(substituteStr)-12) * sizeof(wchar_t));
- memmove(msg + i + mir_tstrlen(substituteStr), msg + i + 12, (mir_tstrlen(msg) - i - 11) * sizeof(wchar_t));
- memcpy(msg + i, substituteStr, mir_tstrlen(substituteStr) * sizeof(wchar_t));
+ memmove(msg + i + mir_wstrlen(substituteStr), msg + i + 12, (mir_wstrlen(msg) - i - 11) * sizeof(wchar_t));
+ memcpy(msg + i, substituteStr, mir_wstrlen(substituteStr) * sizeof(wchar_t));
}
}
- if (count) msg[mir_tstrlen(msg) - count] = 0;
+ if (count) msg[mir_wstrlen(msg) - count] = 0;
if (szProto)
{
char szSetting[80];
mir_snprintf(szSetting, "Proto%sMaxLen", szProto);
len = db_get_w(NULL, "SimpleStatusMsg", szSetting, 1024);
- if (len < mir_tstrlen(msg))
+ if (len < mir_wstrlen(msg))
{
msg = (wchar_t *)mir_realloc(msg, len * sizeof(wchar_t));
msg[len] = 0;
@@ -404,7 +404,7 @@ static wchar_t *GetAwayMessageFormat(int iStatus, const char *szProto) if (flags & STATUS_EMPTY_MSG)
{
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
else if (flags & STATUS_LAST_STATUS_MSG)
{
@@ -424,7 +424,7 @@ static wchar_t *GetAwayMessageFormat(int iStatus, const char *szProto) char *szLastMsg = db_get_sa(NULL, "SimpleStatusMsg", szSetting);
if (szLastMsg == NULL)
- return NULL; //mir_tstrdup(L"");
+ return NULL; //mir_wstrdup(L"");
format = db_get_tsa(NULL, "SimpleStatusMsg", szLastMsg);
mir_free(szLastMsg);
@@ -438,17 +438,17 @@ static wchar_t *GetAwayMessageFormat(int iStatus, const char *szProto) format = db_get_tsa(NULL, "SRAway", StatusModeToDbSetting(iStatus, szSetting));
if (format == NULL)
- format = mir_tstrdup(L"");
+ format = mir_wstrdup(L"");
}
else
- format = mir_tstrdup(GetDefaultMessage(iStatus));
+ format = mir_wstrdup(GetDefaultMessage(iStatus));
return format;
}
void DBWriteMessage(char *szSetting, wchar_t *tszMsg)
{
- if (tszMsg && mir_tstrlen(tszMsg))
+ if (tszMsg && mir_wstrlen(tszMsg))
db_set_ts(NULL, "SimpleStatusMsg", szSetting, tszMsg);
else
db_unset(NULL, "SimpleStatusMsg", szSetting);
@@ -527,7 +527,7 @@ static wchar_t *GetAwayMessage(int iStatus, const char *szProto, BOOL bInsertVar //if (flags & PROTO_NO_MSG)
//{
- // format = mir_tstrdup(L"");
+ // format = mir_wstrdup(L"");
//}
//else
if (flags & PROTO_THIS_MSG)
@@ -535,7 +535,7 @@ static wchar_t *GetAwayMessage(int iStatus, const char *szProto, BOOL bInsertVar mir_snprintf(szSetting, "Proto%sDefault", szProto);
format = db_get_tsa(NULL, "SimpleStatusMsg", szSetting);
if (format == NULL)
- format = mir_tstrdup(L"");
+ format = mir_wstrdup(L"");
}
else if (flags & PROTO_NOCHANGE && szProto)
{
@@ -1306,7 +1306,7 @@ VOID CALLBACK UpdateMsgTimerProc(HWND, UINT, UINT_PTR, DWORD) mir_snprintf(szBuffer, "Cur%sMsg", accounts->pa[i]->szModuleName);
tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", szBuffer);
- if ((tszMsg && tszStatusMsg && !mir_tstrcmp(tszMsg, tszStatusMsg)) || (!tszMsg && !tszStatusMsg))
+ if ((tszMsg && tszStatusMsg && !mir_wstrcmp(tszMsg, tszStatusMsg)) || (!tszMsg && !tszStatusMsg))
{
mir_free(tszStatusMsg);
mir_free(tszMsg);
@@ -1315,7 +1315,7 @@ VOID CALLBACK UpdateMsgTimerProc(HWND, UINT, UINT_PTR, DWORD) else
mir_free(tszStatusMsg);
- if (tszMsg && mir_tstrlen(tszMsg))
+ if (tszMsg && mir_wstrlen(tszMsg))
{
#ifdef _DEBUG
log2file("UpdateMsgTimerProc(): Set %s status and \"%S\" status message for %s.", StatusModeToDbSetting(iCurrentStatus, ""), tszMsg, accounts->pa[i]->szModuleName);
@@ -1419,7 +1419,7 @@ static int ChangeStatusMsgPrebuild(WPARAM, LPARAM) if (Proto_IsAccountLocked(pa[i]))
{
wchar_t szBuffer[256];
- mir_sntprintf(szBuffer, TranslateT("%s (locked)"), pa[i]->tszAccountName);
+ mir_snwprintf(szBuffer, TranslateT("%s (locked)"), pa[i]->tszAccountName);
mi.root = Menu_CreateRoot(MO_STATUS, szBuffer, mi.position);
}
else mi.root = Menu_CreateRoot(MO_STATUS, pa[i]->tszAccountName, mi.position);
@@ -1520,7 +1520,7 @@ static int CSStatusChange(WPARAM wParam, LPARAM) char buff[80];
bool found = false;
- wchar_t *szMsgW = mir_t2u(ps[i]->szMsg);
+ wchar_t *szMsgW = mir_wstrdup(ps[i]->szMsg);
#ifdef _DEBUG
@@ -1533,7 +1533,7 @@ static int CSStatusChange(WPARAM wParam, LPARAM) wchar_t *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", buff);
if (tszStatusMsg != NULL)
{
- if (!mir_tstrcmp(tszStatusMsg, szMsgW))
+ if (!mir_wstrcmp(tszStatusMsg, szMsgW))
{
found = true;
mir_snprintf(szSetting, "Last%sMsg", ps[i]->szName);
@@ -1578,10 +1578,10 @@ static wchar_t *ParseWinampSong(ARGUMENTSINFO *ai) if (ptszWinampTitle != NULL) {
mir_free(g_ptszWinampSong);
- g_ptszWinampSong = mir_tstrdup(ptszWinampTitle);
+ g_ptszWinampSong = mir_wstrdup(ptszWinampTitle);
}
- else if (g_ptszWinampSong && mir_tstrcmp(g_ptszWinampSong, L"SimpleStatusMsg") && db_get_b(NULL, "SimpleStatusMsg", "AmpLeaveTitle", 1))
- ptszWinampTitle = mir_tstrdup(g_ptszWinampSong);
+ else if (g_ptszWinampSong && mir_wstrcmp(g_ptszWinampSong, L"SimpleStatusMsg") && db_get_b(NULL, "SimpleStatusMsg", "AmpLeaveTitle", 1))
+ ptszWinampTitle = mir_wstrdup(g_ptszWinampSong);
return ptszWinampTitle;
}
@@ -1595,7 +1595,7 @@ static wchar_t *ParseDate(ARGUMENTSINFO *ai) ai->flags |= AIF_DONTPARSE;
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, szStr, _countof(szStr));
- return mir_tstrdup(szStr);
+ return mir_wstrdup(szStr);
}
int ICQMsgTypeToStatus(int iMsgType)
@@ -1720,7 +1720,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) g_ptszWinampSong = db_get_tsa(NULL, "SimpleStatusMsg", "AmpLastTitle");
if (g_ptszWinampSong == NULL)
- g_ptszWinampSong = mir_tstrdup(L"SimpleStatusMsg");
+ g_ptszWinampSong = mir_wstrdup(L"SimpleStatusMsg");
if (db_get_b(NULL, "SimpleStatusMsg", "UpdateMsgOn", 1))
g_uUpdateMsgTimer = SetTimer(NULL, 0, db_get_w(NULL, "SimpleStatusMsg", "UpdateMsgInt", 10) * 1000, UpdateMsgTimerProc);
@@ -1769,7 +1769,7 @@ static int OnOkToExit(WPARAM, LPARAM) db_set_w(NULL, "SimpleStatusMsg", szSetting, (WORD)CallProtoService(accounts->pa[i]->szModuleName, PS_GETSTATUS, 0, 0));
}
- if (g_ptszWinampSong && mir_tstrcmp(g_ptszWinampSong, L"SimpleStatusMsg") /*&& db_get_b(NULL, "SimpleStatusMsg", "AmpLeaveTitle", 1)*/)
+ if (g_ptszWinampSong && mir_wstrcmp(g_ptszWinampSong, L"SimpleStatusMsg") /*&& db_get_b(NULL, "SimpleStatusMsg", "AmpLeaveTitle", 1)*/)
DBWriteMessage("AmpLastTitle", g_ptszWinampSong);
}
diff --git a/plugins/SimpleStatusMsg/src/msgbox.cpp b/plugins/SimpleStatusMsg/src/msgbox.cpp index 6162d10dbe..20bc2a0347 100644 --- a/plugins/SimpleStatusMsg/src/msgbox.cpp +++ b/plugins/SimpleStatusMsg/src/msgbox.cpp @@ -274,12 +274,12 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) else if (data->m_iDlgFlags & DLG_SHOW_BUTTONS_INLIST) { if (found) { if (data->m_iDlgFlags & DLG_SHOW_LIST_ICONS) { - mir_sntprintf(text, TranslateT("Clear history")); + mir_snwprintf(text, TranslateT("Clear history")); cbei.iImage = I_ICON_CLEAR; cbei.iSelectedImage = I_ICON_CLEAR; } else { - mir_sntprintf(text, L"## %s ##", TranslateT("Clear history")); + mir_snwprintf(text, L"## %s ##", TranslateT("Clear history")); cbei.iIndent = 1; } cbei.iItem = -1; @@ -291,12 +291,12 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) cbei.iItem = -1; if (data->m_iDlgFlags & DLG_SHOW_LIST_ICONS) { - mir_sntprintf(text, TranslateT("Add to predefined")); + mir_snwprintf(text, TranslateT("Add to predefined")); cbei.iImage = I_ICON_ADD; cbei.iSelectedImage = I_ICON_ADD; } else { - mir_sntprintf(text, L"## %s ##", TranslateT("Add to predefined")); + mir_snwprintf(text, L"## %s ##", TranslateT("Add to predefined")); cbei.iIndent = 1; } cbei.pszText = (LPTSTR)text; @@ -305,13 +305,13 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) SendMessage(handle, CBEM_INSERTITEM, 0, (LPARAM)&cbei); if (data->m_iDlgFlags & DLG_SHOW_LIST_ICONS) { - mir_sntprintf(text, TranslateT("Delete selected")); + mir_snwprintf(text, TranslateT("Delete selected")); cbei.iImage = I_ICON_DEL; cbei.iSelectedImage = I_ICON_DEL; } else { cbei.iIndent = 1; - mir_sntprintf(text, L"## %s ##", TranslateT("Delete selected")); + mir_snwprintf(text, L"## %s ##", TranslateT("Delete selected")); } cbei.iItem = -1; cbei.pszText = (LPTSTR)text; @@ -468,7 +468,7 @@ VOID APIENTRY HandlePopupMenu(HWND hwnd, POINT pt, HWND edit_control) wchar_t item_string[128]; GetMenuString(hmenu, m_selection, (LPTSTR)&item_string, 128, MF_BYCOMMAND); - int len = (int)mir_tstrlen(item_string); + int len = (int)mir_wstrlen(item_string); if (len) { LPTSTR lptstrCopy; HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(wchar_t)); @@ -609,7 +609,7 @@ int AddToPredefined(HWND hwndDlg, struct MsgBoxData *data) newitem.pszText = text; SendMessage(data->recent_cbex, CBEM_GETITEM, 0, (LPARAM)&newitem); - if (LOWORD(newitem.lParam) == PREDEFINED_MSG && !mir_tstrcmp(text, msg)) + if (LOWORD(newitem.lParam) == PREDEFINED_MSG && !mir_wstrcmp(text, msg)) return num_items; } @@ -692,7 +692,7 @@ void DisplayCharsCount(struct MsgBoxData *dlg_data, HWND hwndDlg) lines++; } } - mir_sntprintf(status_text, TranslateT("OK (%d)"), len - (lines - 1)); + mir_snwprintf(status_text, TranslateT("OK (%d)"), len - (lines - 1)); SetDlgItemText(hwndDlg, IDC_OK, status_text); } @@ -779,12 +779,12 @@ void ChangeDlgStatus(HWND hwndDlg, struct MsgBoxData *msgbox_data, int iStatus) wchar_t szTitle[256], szProtoName[128]; BOOL bDisabled = msgbox_data->m_szProto && !(CallProtoService(msgbox_data->m_szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND); - mir_sntprintf(szProtoName, msgbox_data->m_szProto ? Proto_GetAccount(msgbox_data->m_szProto)->tszAccountName : TranslateT("global")); + mir_snwprintf(szProtoName, msgbox_data->m_szProto ? Proto_GetAccount(msgbox_data->m_szProto)->tszAccountName : TranslateT("global")); if (iStatus == ID_STATUS_CURRENT) { if (msgbox_data->m_bOnStartup) - mir_sntprintf(szTitle, TranslateT("%s message (%s)"), TranslateT("<startup>"), szProtoName); + mir_snwprintf(szTitle, TranslateT("%s message (%s)"), TranslateT("<startup>"), szProtoName); else - mir_sntprintf(szTitle, TranslateT("%s message (%s)"), TranslateT("<current>"), szProtoName); + mir_snwprintf(szTitle, TranslateT("%s message (%s)"), TranslateT("<current>"), szProtoName); } else if (iStatus > ID_STATUS_CURRENT) { wchar_t buff[128]; @@ -793,10 +793,10 @@ void ChangeDlgStatus(HWND hwndDlg, struct MsgBoxData *msgbox_data, int iStatus) CallService(MS_SS_GETPROFILENAME, iStatus - 40083, (LPARAM)buff1); MultiByteToWideChar(Langpack_GetDefaultCodePage(), 0, buff1, -1, buff, 128); - mir_sntprintf(szTitle, TranslateT("%s message (%s)"), buff, szProtoName); + mir_snwprintf(szTitle, TranslateT("%s message (%s)"), buff, szProtoName); } else - mir_sntprintf(szTitle, TranslateT("%s message (%s)"), pcli->pfnGetStatusModeDescription(iStatus, 0), szProtoName); + mir_snwprintf(szTitle, TranslateT("%s message (%s)"), pcli->pfnGetStatusModeDescription(iStatus, 0), szProtoName); SetWindowText(hwndDlg, szTitle); if (iStatus == ID_STATUS_CURRENT) @@ -904,16 +904,16 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA TranslateDialogDefault(hwndDlg); init_data = (struct MsgBoxInitData *)lParam; GetWindowText(hwndDlg, szFormat, _countof(szFormat)); - mir_sntprintf(szProtoName, init_data->m_szProto ? Proto_GetAccount(init_data->m_szProto)->tszAccountName : TranslateT("global")); + mir_snwprintf(szProtoName, init_data->m_szProto ? Proto_GetAccount(init_data->m_szProto)->tszAccountName : TranslateT("global")); if (init_data->m_iStatus == ID_STATUS_CURRENT) { if (init_data->m_bOnStartup) - mir_sntprintf(szTitle, szFormat, TranslateT("<startup>"), szProtoName); + mir_snwprintf(szTitle, szFormat, TranslateT("<startup>"), szProtoName); else - mir_sntprintf(szTitle, szFormat, TranslateT("<current>"), szProtoName); + mir_snwprintf(szTitle, szFormat, TranslateT("<current>"), szProtoName); } else - mir_sntprintf(szTitle, szFormat, pcli->pfnGetStatusModeDescription(init_data->m_iStatus, 0), szProtoName); + mir_snwprintf(szTitle, szFormat, pcli->pfnGetStatusModeDescription(init_data->m_iStatus, 0), szProtoName); SetWindowText(hwndDlg, szTitle); int icoStatus = ID_STATUS_OFFLINE; @@ -1097,7 +1097,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA } else { wchar_t str[64]; - mir_sntprintf(str, TranslateT("Closing in %d"), msgbox_data->m_iCountdown); + mir_snwprintf(str, TranslateT("Closing in %d"), msgbox_data->m_iCountdown); SetDlgItemText(hwndDlg, IDC_OK, str); } msgbox_data->m_iCountdown--; @@ -1174,7 +1174,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA mir_snprintf(buff, "SMsg%d", i); wchar_t *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", buff); if (tszStatusMsg != NULL) { - if (!mir_tstrcmp(tszStatusMsg, tszMsg)) { + if (!mir_wstrcmp(tszStatusMsg, tszMsg)) { found = true; if (msgbox_data->m_szProto) { mir_snprintf(buff2, "Last%sMsg", msgbox_data->m_szProto); diff --git a/plugins/SimpleStatusMsg/src/options.cpp b/plugins/SimpleStatusMsg/src/options.cpp index e7695ca304..ebed7ada43 100644 --- a/plugins/SimpleStatusMsg/src/options.cpp +++ b/plugins/SimpleStatusMsg/src/options.cpp @@ -138,8 +138,8 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l val = db_get_b(NULL, "SimpleStatusMsg", (char *)StatusModeToDbSetting(i, "Flags"), STATUS_DEFAULT);
data->status_msg[0].flags[i - ID_STATUS_ONLINE] = val;
- ptrT text( db_get_tsa(NULL, "SRAway", StatusModeToDbSetting(i, "Default")));
- mir_tstrncpy(data->status_msg[0].msg[i - ID_STATUS_ONLINE], (text == NULL) ? GetDefaultMessage(i) : text, 1024);
+ ptrW text( db_get_tsa(NULL, "SRAway", StatusModeToDbSetting(i, "Default")));
+ mir_wstrncpy(data->status_msg[0].msg[i - ID_STATUS_ONLINE], (text == NULL) ? GetDefaultMessage(i) : text, 1024);
for (j = 0; j < accounts->count; j++)
{
@@ -151,7 +151,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l data->status_msg[j+1].flags[i-ID_STATUS_ONLINE] = val;
mir_snprintf(setting, "%sDefault", accounts->pa[j]->szModuleName);
text = db_get_tsa(NULL, "SRAway", StatusModeToDbSetting(i, setting));
- mir_tstrncpy(data->status_msg[j + 1].msg[i - ID_STATUS_ONLINE], (text == NULL) ? GetDefaultMessage(i) : text, 1024);
+ mir_wstrncpy(data->status_msg[j + 1].msg[i - ID_STATUS_ONLINE], (text == NULL) ? GetDefaultMessage(i) : text, 1024);
}
}
}
@@ -452,9 +452,9 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (szSetting)
{
wchar_t *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", szSetting);
- if (tszStatusMsg && mir_tstrlen(tszStatusMsg))
+ if (tszStatusMsg && mir_wstrlen(tszStatusMsg))
{
- if (tszStatusMsg && mir_tstrlen(tszStatusMsg))
+ if (tszStatusMsg && mir_wstrlen(tszStatusMsg))
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, tszStatusMsg);
mir_free(tszStatusMsg);
@@ -870,11 +870,11 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (len > 0)
{
if (data->proto_msg[j].msg == NULL)
- data->proto_msg[j].msg = mir_tstrdup(msg);
+ data->proto_msg[j].msg = mir_wstrdup(msg);
else
{
mir_free(data->proto_msg[j].msg);
- data->proto_msg[j].msg = mir_tstrdup(msg);
+ data->proto_msg[j].msg = mir_wstrdup(msg);
}
}
else
@@ -889,7 +889,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l else
{
GetDlgItemText(hwndDlg, IDC_OPTEDIT1, msg, _countof(msg));
- mir_tstrcpy(data->status_msg[j].msg[i], msg);
+ mir_wstrcpy(data->status_msg[j].msg[i], msg);
}
}
break;
@@ -911,7 +911,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l {
data->status_msg[0].flags[i-ID_STATUS_ONLINE] = data->status_msg[j].flags[i-ID_STATUS_ONLINE];
if (data->status_msg[j].flags[i-ID_STATUS_ONLINE] & STATUS_THIS_MSG)
- mir_tstrcpy(data->status_msg[0].msg[i-ID_STATUS_ONLINE], data->status_msg[j].msg[i-ID_STATUS_ONLINE]);
+ mir_wstrcpy(data->status_msg[0].msg[i-ID_STATUS_ONLINE], data->status_msg[j].msg[i-ID_STATUS_ONLINE]);
}
}
}
@@ -929,15 +929,15 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (data->proto_msg[j].flags & PROTO_THIS_MSG)
{
- size_t len = mir_tstrlen(data->proto_msg[j].msg);
+ size_t len = mir_wstrlen(data->proto_msg[j].msg);
if (len > 0)
{
if (data->proto_msg[k+1].msg == NULL)
- data->proto_msg[k+1].msg = mir_tstrdup(data->proto_msg[j].msg);
+ data->proto_msg[k+1].msg = mir_wstrdup(data->proto_msg[j].msg);
else
{
mir_free(data->proto_msg[k+1].msg);
- data->proto_msg[k+1].msg = mir_tstrdup(data->proto_msg[j].msg);
+ data->proto_msg[k+1].msg = mir_wstrdup(data->proto_msg[j].msg);
}
}
else
@@ -957,7 +957,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l {
data->status_msg[k + 1].flags[i - ID_STATUS_ONLINE] = data->status_msg[j].flags[i - ID_STATUS_ONLINE];
if (data->status_msg[j].flags[i - ID_STATUS_ONLINE] & STATUS_THIS_MSG)
- mir_tstrcpy(data->status_msg[k + 1].msg[i - ID_STATUS_ONLINE], data->status_msg[j].msg[i - ID_STATUS_ONLINE]);
+ mir_wstrcpy(data->status_msg[k + 1].msg[i - ID_STATUS_ONLINE], data->status_msg[j].msg[i - ID_STATUS_ONLINE]);
}
}
}
@@ -983,7 +983,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l {
data->status_msg[j].flags[k - ID_STATUS_ONLINE] = data->status_msg[j].flags[i];
if (data->status_msg[j].flags[i] & STATUS_THIS_MSG)
- mir_tstrcpy(data->status_msg[j].msg[k - ID_STATUS_ONLINE], data->status_msg[j].msg[i]);
+ mir_wstrcpy(data->status_msg[j].msg[k - ID_STATUS_ONLINE], data->status_msg[j].msg[i]);
}
}
break;
@@ -1235,7 +1235,7 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w if (!ServiceExists(MS_SS_GETPROFILECOUNT)) {
wchar_t szText[100];
- mir_sntprintf(szText, L"%s *", TranslateT("Show status profiles in status list"));
+ mir_snwprintf(szText, L"%s *", TranslateT("Show status profiles in status list"));
SetDlgItemText(hwndDlg, IDC_CPROFILES, szText);
EnableWindow(GetDlgItem(hwndDlg, IDC_CPROFILES), FALSE);
ShowWindow(GetDlgItem(hwndDlg, IDC_NOTE1), SW_SHOW);
diff --git a/plugins/SmileyAdd/src/customsmiley.cpp b/plugins/SmileyAdd/src/customsmiley.cpp index a61a014e9c..64fdd3d17e 100644 --- a/plugins/SmileyAdd/src/customsmiley.cpp +++ b/plugins/SmileyAdd/src/customsmiley.cpp @@ -78,7 +78,7 @@ bool SmileyCType::CreateTriggerText(char *text) return false;
char save = res[reslen]; res[reslen] = 0; // safe because of mir_alloc
- wchar_t *txt = mir_utf8decodeT(res);
+ wchar_t *txt = mir_utf8decodeW(res);
res[reslen] = save;
if (txt == NULL)
diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp index 2f45d51950..8a46c4fc70 100644 --- a/plugins/SmileyAdd/src/download.cpp +++ b/plugins/SmileyAdd/src/download.cpp @@ -213,7 +213,7 @@ void GetSmileyCacheFolder(void) FoldersGetCustomPathT(hFolder, cachepath, MAX_PATH, L"");
HookEvent(ME_FOLDERS_PATH_CHANGED, FolderChanged);
}
- else mir_tstrncpy(cachepath, VARST(L"%miranda_userdata%\\SmileyCache"), MAX_PATH);
+ else mir_wstrncpy(cachepath, VARST(L"%miranda_userdata%\\SmileyCache"), MAX_PATH);
}
void DownloadInit(void)
diff --git a/plugins/SmileyAdd/src/general.cpp b/plugins/SmileyAdd/src/general.cpp index 0a27734c92..4fda95dd92 100644 --- a/plugins/SmileyAdd/src/general.cpp +++ b/plugins/SmileyAdd/src/general.cpp @@ -232,8 +232,8 @@ void ReportError(const wchar_t *errmsg) static const wchar_t title[] = L"Miranda SmileyAdd";
POPUPDATAT pd = { 0 };
- mir_tstrcpy(pd.lpwzContactName, title);
- mir_tstrcpy(pd.lpwzText, errmsg);
+ mir_wstrcpy(pd.lpwzContactName, title);
+ mir_wstrcpy(pd.lpwzText, errmsg);
pd.iSeconds = -1;
if (PUAddPopupT(&pd) == CALLSERVICE_NOTFOUND)
MessageBox(NULL, errmsg, title, MB_OK | MB_ICONWARNING | MB_TOPMOST);
diff --git a/plugins/SmileyAdd/src/options.cpp b/plugins/SmileyAdd/src/options.cpp index 8466424240..eca94429b5 100644 --- a/plugins/SmileyAdd/src/options.cpp +++ b/plugins/SmileyAdd/src/options.cpp @@ -481,16 +481,16 @@ bool OptionsDialogType::BrowseForSmileyPacks(int item) ofn.hwndOwner = m_hwndDialog;
wchar_t filter[512], *pfilter;
- mir_tstrcpy(filter, TranslateT("Smiley packs"));
- mir_tstrcat(filter, L" (*.msl;*.asl;*.xep)");
- pfilter = filter + mir_tstrlen(filter) + 1;
- mir_tstrcpy(pfilter, L"*.msl;*.asl;*.xep");
- pfilter = pfilter + mir_tstrlen(pfilter) + 1;
- mir_tstrcpy(pfilter, TranslateT("All files"));
- mir_tstrcat(pfilter, L" (*.*)");
- pfilter = pfilter + mir_tstrlen(pfilter) + 1;
- mir_tstrcpy(pfilter, L"*.*");
- pfilter = pfilter + mir_tstrlen(pfilter) + 1;
+ mir_wstrcpy(filter, TranslateT("Smiley packs"));
+ mir_wstrcat(filter, L" (*.msl;*.asl;*.xep)");
+ pfilter = filter + mir_wstrlen(filter) + 1;
+ mir_wstrcpy(pfilter, L"*.msl;*.asl;*.xep");
+ pfilter = pfilter + mir_wstrlen(pfilter) + 1;
+ mir_wstrcpy(pfilter, TranslateT("All files"));
+ mir_wstrcat(pfilter, L" (*.*)");
+ pfilter = pfilter + mir_wstrlen(pfilter) + 1;
+ mir_wstrcpy(pfilter, L"*.*");
+ pfilter = pfilter + mir_wstrlen(pfilter) + 1;
*pfilter = '\0';
ofn.lpstrFilter = filter;
@@ -592,7 +592,7 @@ void OptionsType::ReadPackFileName(CMString &filename, const CMString &name, con {
CMString settingKey = name + L"-filename";
- ptrT tszValue(db_get_tsa(NULL, "SmileyAdd", _T2A(settingKey.c_str())));
+ ptrW tszValue(db_get_tsa(NULL, "SmileyAdd", _T2A(settingKey.c_str())));
filename = (tszValue != NULL) ? (wchar_t*)tszValue : defaultFilename;
}
@@ -604,7 +604,7 @@ void OptionsType::WritePackFileName(const CMString &filename, const CMString &na void OptionsType::ReadCustomCategories(CMString &cats)
{
- ptrT tszValue(db_get_tsa(NULL, "SmileyAdd", "CustomCategories"));
+ ptrW tszValue(db_get_tsa(NULL, "SmileyAdd", "CustomCategories"));
if (tszValue != NULL)
cats = tszValue;
}
@@ -619,7 +619,7 @@ void OptionsType::WriteCustomCategories(const CMString &cats) void OptionsType::ReadContactCategory(MCONTACT hContact, CMString &cats)
{
- ptrT tszValue(db_get_tsa(hContact, "SmileyAdd", "CustomCategory"));
+ ptrW tszValue(db_get_tsa(hContact, "SmileyAdd", "CustomCategory"));
if (tszValue != NULL)
cats = tszValue;
}
diff --git a/plugins/SmileyAdd/src/smileys.cpp b/plugins/SmileyAdd/src/smileys.cpp index c2f70ffc31..213e8307d0 100644 --- a/plugins/SmileyAdd/src/smileys.cpp +++ b/plugins/SmileyAdd/src/smileys.cpp @@ -212,7 +212,7 @@ static DWORD_PTR ConvertServiceParam(MCONTACT hContact, const wchar_t *param) {
if (param == NULL)
return 0;
- if (mir_tstrcmpi(L"hContact", param) == 0)
+ if (mir_wstrcmpi(L"hContact", param) == 0)
return hContact;
if (iswdigit(*param))
return _wtoi(param);
@@ -359,7 +359,7 @@ bool SmileyPackType::LoadSmileyFile(const CMString &filename, const CMString &pa if (!noerr) {
static const wchar_t errmsg[] = LPGENW("Smiley pack %s for category \"%s\" not found.\nSelect correct smiley pack in the Options -> Customize -> Smileys.");
wchar_t msgtxt[1024];
- mir_sntprintf(msgtxt, TranslateTS(errmsg), modpath.c_str(), packname);
+ mir_snwprintf(msgtxt, TranslateTS(errmsg), modpath.c_str(), packname);
ReportError(msgtxt);
}
@@ -519,7 +519,7 @@ bool SmileyPackType::LoadSmileyFileMSL(CMString &tbuf, bool onlyInfo, CMString & if (!noerr) {
static const wchar_t errmsg[] = LPGENW("Smiley #%u in file %s for smiley pack %s not found.");
wchar_t msgtxt[1024];
- mir_sntprintf(msgtxt, TranslateTS(errmsg), smnum, resname.c_str(), modpath.c_str());
+ mir_snwprintf(msgtxt, TranslateTS(errmsg), smnum, resname.c_str(), modpath.c_str());
CallService(MS_NETLIB_LOG, (WPARAM)hNetlibUser, _T2A(msgtxt));
errorFound = true;
}
@@ -733,7 +733,7 @@ SmileyPackType* SmileyPackListType::GetSmileyPack(CMString &filename) for (int i = 0; i < m_SmileyPacks.getCount(); i++) {
CMString modpath1;
pathToAbsolute(m_SmileyPacks[i].GetFilename(), modpath1);
- if (mir_tstrcmpi(modpath.c_str(), modpath1.c_str()) == 0) return &m_SmileyPacks[i];
+ if (mir_wstrcmpi(modpath.c_str(), modpath1.c_str()) == 0) return &m_SmileyPacks[i];
}
return NULL;
}
@@ -1068,13 +1068,13 @@ SmileyLookup::SmileyLookup(const CMString &str, const bool regexs, const int ind matcher->getStartingIndex() != matcher->getEndingIndex());
if (!m_valid) {
static const wchar_t errmsg[] = LPGENW("Regular expression \"%s\" in smiley pack \"%s\" could produce \"empty matches\".");
- mir_sntprintf(msgtxt, TranslateTS(errmsg), str.c_str(), smpt.c_str());
+ mir_snwprintf(msgtxt, TranslateTS(errmsg), str.c_str(), smpt.c_str());
}
delete matcher;
}
else {
static const wchar_t errmsg[] = LPGENW("Regular expression \"%s\" in smiley pack \"%s\" malformed.");
- mir_sntprintf(msgtxt, TranslateTS(errmsg), str.c_str(), smpt.c_str());
+ mir_snwprintf(msgtxt, TranslateTS(errmsg), str.c_str(), smpt.c_str());
}
if (!m_valid)
diff --git a/plugins/Spamotron/src/options.cpp b/plugins/Spamotron/src/options.cpp index 550c9143e6..6cdaf66110 100644 --- a/plugins/Spamotron/src/options.cpp +++ b/plugins/Spamotron/src/options.cpp @@ -7,9 +7,9 @@ wchar_t* _getCOptS(wchar_t *buf, unsigned int buflen, MCONTACT hContact, const c DBVARIANT dbv = {0};
wcsnset(buf, 0, buflen);
if (db_get_ts(hContact, PLUGIN_NAME, option, &dbv) != 0)
- wcsncpy(buf, def, min(buflen, mir_tstrlen(def)+1));
+ wcsncpy(buf, def, min(buflen, mir_wstrlen(def)+1));
else if (dbv.type == DBVT_TCHAR) {
- wcsncpy(buf, dbv.ptszVal, min(buflen, mir_tstrlen(dbv.ptszVal)+1));
+ wcsncpy(buf, dbv.ptszVal, min(buflen, mir_wstrlen(dbv.ptszVal)+1));
}
db_free(&dbv);
return buf;
@@ -20,12 +20,12 @@ wchar_t* _getMOptS(wchar_t *buf, unsigned int buflen, const char* module, const DBVARIANT dbv = {0};
wcsnset(buf, 0, buflen);
if (db_get_s(NULL, module, option, &dbv) != 0)
- wcsncpy(buf, def, min(buflen, mir_tstrlen(def)+1));
+ wcsncpy(buf, def, min(buflen, mir_wstrlen(def)+1));
else if (dbv.type == DBVT_TCHAR) {
- wcsncpy(buf, dbv.ptszVal, min(buflen, mir_tstrlen(dbv.ptszVal)+1));
+ wcsncpy(buf, dbv.ptszVal, min(buflen, mir_wstrlen(dbv.ptszVal)+1));
} else {
tmp = mir_a2u(dbv.pszVal);
- wcsncpy(buf, tmp, min(buflen, mir_tstrlen(tmp)+1));
+ wcsncpy(buf, tmp, min(buflen, mir_wstrlen(tmp)+1));
mir_free(tmp);
}
db_free(&dbv);
@@ -130,7 +130,7 @@ INT_PTR CALLBACK DlgProcOptionsMain(HWND optDlg, UINT msg, WPARAM wParam, LPARAM {
lvi.iItem = i;
_getMOptS(pName, 200*sizeof(wchar_t), pd[i]->szModuleName, "AM_BaseProto", L"");
- if (mir_tstrcmp(pName, L"ICQ") != 0)
+ if (mir_wstrcmp(pName, L"ICQ") != 0)
continue;
lvi.pszText = mir_a2u(pd[i]->szModuleName);
ListView_InsertItem(hProtocolsList, &lvi);
@@ -436,17 +436,17 @@ INT_PTR CALLBACK DlgProcOptionsBayes(HWND optDlg, UINT msg, WPARAM wParam, LPARA EnableControlsBayes(optDlg, bEnabled);
- mir_sntprintf(buf, L"%0.02f", (double)_getOptD("BayesSpamScore", defaultBayesSpamScore)*SCORE_C);
+ mir_snwprintf(buf, L"%0.02f", (double)_getOptD("BayesSpamScore", defaultBayesSpamScore)*SCORE_C);
SetDlgItemText(optDlg, IDC_OPT_BAYES_SPAM_SCORE, buf);
- mir_sntprintf(buf, L"%.02f", (double)_getOptD("BayesHamScore", defaultBayesHamScore)*SCORE_C);
+ mir_snwprintf(buf, L"%.02f", (double)_getOptD("BayesHamScore", defaultBayesHamScore)*SCORE_C);
SetDlgItemText(optDlg, IDC_OPT_BAYES_HAM_SCORE, buf);
- mir_sntprintf(buf, L"%d", _getOptD("BayesWaitApprove", defaultBayesWaitApprove));
+ mir_snwprintf(buf, L"%d", _getOptD("BayesWaitApprove", defaultBayesWaitApprove));
SetDlgItemText(optDlg, IDC_OPT_BAYES_WAIT_APPROVE, buf);
if (bEnabled) {
- mir_sntprintf(buf, L"%d", get_msg_count(SPAM));
+ mir_snwprintf(buf, L"%d", get_msg_count(SPAM));
SetDlgItemText(optDlg, IDC_STATIC_SPAM_COUNT, buf);
- mir_sntprintf(buf, L"%d", get_msg_count(HAM));
+ mir_snwprintf(buf, L"%d", get_msg_count(HAM));
SetDlgItemText(optDlg, IDC_STATIC_HAM_COUNT, buf);
}
@@ -490,9 +490,9 @@ INT_PTR CALLBACK DlgProcOptionsBayes(HWND optDlg, UINT msg, WPARAM wParam, LPARA SetDlgItemText(optDlg, IDC_OPT_BAYES_LEARNBOX, L"");
free(dbuf);
- mir_sntprintf(buf, L"%d", get_msg_count(SPAM));
+ mir_snwprintf(buf, L"%d", get_msg_count(SPAM));
SetDlgItemText(optDlg, IDC_STATIC_SPAM_COUNT, buf);
- mir_sntprintf(buf, L"%d", get_msg_count(HAM));
+ mir_snwprintf(buf, L"%d", get_msg_count(HAM));
SetDlgItemText(optDlg, IDC_STATIC_HAM_COUNT, buf);
return FALSE;
@@ -507,9 +507,9 @@ INT_PTR CALLBACK DlgProcOptionsBayes(HWND optDlg, UINT msg, WPARAM wParam, LPARA SetDlgItemText(optDlg, IDC_OPT_BAYES_LEARNBOX, L"");
free(dbuf);
- mir_sntprintf(buf, L"%d", get_msg_count(SPAM));
+ mir_snwprintf(buf, L"%d", get_msg_count(SPAM));
SetDlgItemText(optDlg, IDC_STATIC_SPAM_COUNT, buf);
- mir_sntprintf(buf, L"%d", get_msg_count(HAM));
+ mir_snwprintf(buf, L"%d", get_msg_count(HAM));
SetDlgItemText(optDlg, IDC_STATIC_HAM_COUNT, buf);
return FALSE;
diff --git a/plugins/Spamotron/src/spamotron.cpp b/plugins/Spamotron/src/spamotron.cpp index a96cc0551b..4951bac756 100644 --- a/plugins/Spamotron/src/spamotron.cpp +++ b/plugins/Spamotron/src/spamotron.cpp @@ -179,7 +179,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) bCorrectResponse = TRUE;
} else {
if (_tcsstr_cc(message, buf, _getOptB("ResponseCC", defaultResponseCC)) &&
- (mir_tstrlen(message) == mir_tstrlen(buf)))
+ (mir_wstrlen(message) == mir_wstrlen(buf)))
bCorrectResponse = TRUE;
}
break;
@@ -196,7 +196,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) }
} else {
if (_tcsstr_cc(message, buf, _getOptB("ResponseCC", defaultResponseCC)) &&
- (mir_tstrlen(message) == mir_tstrlen(buf))) {
+ (mir_wstrlen(message) == mir_wstrlen(buf))) {
bCorrectResponse = TRUE;
break;
}
@@ -208,7 +208,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) if (message == NULL)
break;
_itow(_getCOptD(hContact, "ResponseMath", -1), buf, 10);
- if (wcsstr(message, buf) && (mir_tstrlen(buf) == mir_tstrlen(message))) {
+ if (wcsstr(message, buf) && (mir_wstrlen(buf) == mir_wstrlen(message))) {
bCorrectResponse = TRUE;
}
break;
@@ -290,7 +290,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) // Completely reject if duplicate incoming message found
if (_getOptD("MaxSameMsgCountPerDay", defaultMaxSameMsgCountPerDay) > 0 &&
_getCOptD(hContact, "SameMsgCount", 0) >= _getOptD("MaxSameMsgCountPerDay", defaultMaxSameMsgCountPerDay) &&
- mir_tstrcmp(message, _getCOptS(buf, buflen, hContact, "LastInMsg", L"")) == 0) {
+ mir_wstrcmp(message, _getCOptS(buf, buflen, hContact, "LastInMsg", L"")) == 0) {
_notify(hContact, POPUP_BLOCKED, TranslateT("Message from %s rejected because it reached a maximum for same responses per day."), message);
if (bayesEnabled)
queue_message(hContact, dbei->timestamp, message);
@@ -388,7 +388,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) case SPAMOTRON_MODE_MATH:
a = (rand() % 10) + 1;
b = (rand() % 10) + 1;
- mir_sntprintf(mexpr, L"%d + %d", a, b);
+ mir_snwprintf(mexpr, L"%d + %d", a, b);
if (dbei->eventType == EVENTTYPE_AUTHREQUEST)
_getOptS(challengeW, maxmsglen, "AuthChallengeMath", defaultAuthChallengeMath);
else
@@ -423,7 +423,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) // Save Last Msg and update SameMsgCount
if (message != NULL) {
- if (mir_tstrcmp(_getCOptS(buf, buflen, hContact, "LastInMsg", L""), message) == 0)
+ if (mir_wstrcmp(_getCOptS(buf, buflen, hContact, "LastInMsg", L""), message) == 0)
_setCOptD(hContact, "SameMsgCount", 1+_getCOptD(hContact, "SameMsgCount", 0));
else
_setCOptD(hContact, "SameMsgCount", 1);
diff --git a/plugins/Spamotron/src/utils.cpp b/plugins/Spamotron/src/utils.cpp index 4d5ca64280..a95f2a976f 100644 --- a/plugins/Spamotron/src/utils.cpp +++ b/plugins/Spamotron/src/utils.cpp @@ -7,7 +7,7 @@ wchar_t *_tcstolower(wchar_t *dst) if (dst == NULL) return NULL; - SIZE_T dst_len = mir_tstrlen(dst); + SIZE_T dst_len = mir_wstrlen(dst); for (SIZE_T i = 0; i < dst_len; i ++) dst[i] = towlower(dst[i]); return dst; @@ -18,7 +18,7 @@ wchar_t *_tcstoupper(wchar_t *dst) if (dst == NULL) return NULL; - SIZE_T dst_len = mir_tstrlen(dst); + SIZE_T dst_len = mir_wstrlen(dst); for (SIZE_T i = 0; i < dst_len; i ++) dst[i] = towupper(dst[i]); return dst; @@ -39,10 +39,10 @@ BOOL _isregex(wchar_t* strSearch) re = pcre16_compile(regex_parse, 0, &error, &erroroffs, NULL); if (re == NULL) return FALSE; - regex = mir_tstrdup(strSearch); + regex = mir_wstrdup(strSearch); if (regex == NULL) goto err_out; - rc = pcre16_exec(re, NULL, regex, (int)mir_tstrlen(regex), 0, 0, ovector, 9); + rc = pcre16_exec(re, NULL, regex, (int)mir_wstrlen(regex), 0, 0, ovector, 9); if (rc == 3) ret = TRUE; mir_free(regex); @@ -68,12 +68,12 @@ BOOL _isvalidregex(wchar_t* strSearch) re = pcre16_compile(regex_parse, 0, &error, &erroroffs, NULL); if (re == NULL) return FALSE; - regex = mir_tstrdup(strSearch); + regex = mir_wstrdup(strSearch); if (regex == NULL) { pcre16_free(re); return FALSE; } - rc = pcre16_exec(re, NULL, regex, (int)mir_tstrlen(regex), 0, 0, ovector, 9); + rc = pcre16_exec(re, NULL, regex, (int)mir_wstrlen(regex), 0, 0, ovector, 9); pcre16_free(re); if (rc != 3) goto err_out; @@ -116,12 +116,12 @@ BOOL _regmatch(wchar_t* str, wchar_t* strSearch) re = pcre16_compile(regex_parse, 0, &error, &erroroffs, NULL); if (re == NULL) return FALSE; // [TODO] and log some error - regex = mir_tstrdup(strSearch); + regex = mir_wstrdup(strSearch); if (regex == NULL) { pcre16_free(re); return FALSE; } - rc = pcre16_exec(re, NULL, regex, (int)mir_tstrlen(regex), 0, 0, ovector, 9); + rc = pcre16_exec(re, NULL, regex, (int)mir_wstrlen(regex), 0, 0, ovector, 9); pcre16_free(re); if (rc != 3) goto err_out; // [TODO] and log some error (better check for valid regex on options save) @@ -130,7 +130,7 @@ BOOL _regmatch(wchar_t* str, wchar_t* strSearch) mod = regex + ovector[4]; mod[ovector[5] - ovector[4]] = 0; - data = mir_tstrdup(str); + data = mir_wstrdup(str); if (data == NULL) goto err_out; if (wcsstr(mod, L"i")) @@ -143,7 +143,7 @@ BOOL _regmatch(wchar_t* str, wchar_t* strSearch) re = pcre16_compile(regexp, opts, &error, &erroroffs, NULL); if (re == NULL) goto err_out; - rc = pcre16_exec(re, NULL, data, (int)mir_tstrlen(data), 0, 0, NULL, 0); + rc = pcre16_exec(re, NULL, data, (int)mir_wstrlen(data), 0, 0, NULL, 0); pcre16_free(re); if (rc >= 0) ret = TRUE; @@ -169,12 +169,12 @@ int get_response_id(const wchar_t* strvar) re = pcre16_compile(regex, 0, &error, &erroroffs, NULL); if (re == NULL) return 0; // [TODO] and log some error - _strvar = mir_tstrdup(strvar); + _strvar = mir_wstrdup(strvar); if (_strvar == NULL) { pcre16_free(re); return 0; } - rc = pcre16_exec(re, NULL, _strvar, (int)mir_tstrlen(_strvar), 0, 0, ovector, 9); + rc = pcre16_exec(re, NULL, _strvar, (int)mir_wstrlen(_strvar), 0, 0, ovector, 9); pcre16_free(re); if (rc < 0) { ret = -1; @@ -195,7 +195,7 @@ int get_response_num(const wchar_t *str) if (str == NULL) return 0; - strc = mir_tstrdup(str); + strc = mir_wstrdup(str); if (strc == NULL) return 0; tmp = wcstok(strc, L"\r\n"); @@ -222,7 +222,7 @@ wchar_t* get_response(wchar_t* dst, unsigned int dstlen, int num) tmp = wcstok(src, L"\r\n"); while (tmp) { if (i == num) { - mir_tstrcpy(dst, tmp); + mir_wstrcpy(dst, tmp); mir_free(src); return dst; } @@ -242,10 +242,10 @@ wchar_t* _tcsstr_cc(wchar_t* str, wchar_t* strSearch, BOOL cc) if (cc) return wcsstr(str, strSearch); - _str = mir_tstrdup(str); + _str = mir_wstrdup(str); if (_str == NULL) goto err_out; - _strSearch = mir_tstrdup(strSearch); + _strSearch = mir_wstrdup(strSearch); if (_strSearch == NULL) goto err_out; ret = wcsstr(_tcstolower(_str), _tcstolower(_strSearch)); @@ -266,17 +266,17 @@ BOOL Contains(wchar_t* dst, wchar_t* src) // Checks for occurence of substring f if (dst == NULL || src == NULL) return FALSE; - tsrc = mir_tstrdup(src); + tsrc = mir_wstrdup(src); if (tsrc == NULL) goto err_out; - tdst = mir_tstrdup(dst); + tdst = mir_wstrdup(dst); if (tdst == NULL) goto err_out; tdst = _tcstoupper(tdst); - dst_len = mir_tstrlen(tdst); + dst_len = mir_wstrlen(tdst); token = wcstok(tsrc, L","); while (token) { - token_end = (token + mir_tstrlen(token)); + token_end = (token + mir_wstrlen(token)); while (!wcsncmp(token, L" ", 1)) { /* Skeep spaces at start. */ token ++; } @@ -328,9 +328,9 @@ wchar_t* ReplaceVar(wchar_t *dst, unsigned int len, const wchar_t *var, const wc if (dst == NULL || var == NULL || rvar == NULL) return NULL; - dst_len = mir_tstrlen(dst); - var_len = mir_tstrlen(var); - rvar_len = mir_tstrlen(rvar); + dst_len = mir_wstrlen(dst); + var_len = mir_wstrlen(var); + rvar_len = mir_wstrlen(rvar); var_start = wcsstr(dst, var); while (var_start) { if (len < (dst_len + rvar_len - var_len + 1)) @@ -382,14 +382,14 @@ wchar_t* ReplaceVarsNum(wchar_t *dst, unsigned int len, int num) } do { - _str = mir_tstrdup(dst); - dstcopy = mir_tstrdup(dst); + _str = mir_wstrdup(dst); + dstcopy = mir_wstrdup(dst); if (_str == NULL || dstcopy == NULL) { mir_free(_str); mir_free(dstcopy); goto err_out; } - rc = pcre16_exec(re, NULL, _str, (int)mir_tstrlen(_str), 0, 0, ovector, 9); + rc = pcre16_exec(re, NULL, _str, (int)mir_wstrlen(_str), 0, 0, ovector, 9); if (rc < 0) { ret = -1; } else if (rc == 3) { @@ -427,7 +427,7 @@ int _notify(MCONTACT hContact, BYTE type, wchar_t *message, wchar_t *origmessage { char *tmp, *tmporig; wchar_t msg[MAX_BUFFER_LENGTH]; - mir_sntprintf(msg, message, pcli->pfnGetContactDisplayName(hContact, 0)); + mir_snwprintf(msg, message, pcli->pfnGetContactDisplayName(hContact, 0)); if (_getOptB("LogActions", defaultLogActions)) { tmp = mir_u2a(msg); diff --git a/plugins/SpellChecker/src/RichEdit.cpp b/plugins/SpellChecker/src/RichEdit.cpp index 1317f767cd..e81e679606 100644 --- a/plugins/SpellChecker/src/RichEdit.cpp +++ b/plugins/SpellChecker/src/RichEdit.cpp @@ -201,17 +201,17 @@ wchar_t* RichEdit::GetText(int start, int end) const if (m_textDocument != NULL) {
ITextRange *range;
if (m_textDocument->Range(start, end, &range) != S_OK)
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
BSTR text = NULL;
if (FAILED(range->GetText(&text))) {
if (text)
::SysFreeString(text);
range->Release();
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
- wchar_t *res = mir_u2t(text);
+ wchar_t *res = mir_wstrdup(text);
range->Release();
::SysFreeString(text);
return res;
@@ -241,7 +241,7 @@ void RichEdit::ReplaceSel(const wchar_t *new_text) SuspendUndo();
- FixSel(&m_old_sel, sel, mir_tstrlen(new_text));
+ FixSel(&m_old_sel, sel, mir_wstrlen(new_text));
SendMessage(WM_SETREDRAW, FALSE, 0);
SendMessage(EM_SETEVENTMASK, 0, m_old_mask & ~ENM_CHANGE);
@@ -257,7 +257,7 @@ int RichEdit::Replace(int start, int end, const wchar_t *new_text) ReplaceSel(new_text);
- int dif = FixSel(&sel, replace_sel, mir_tstrlen(new_text));
+ int dif = FixSel(&sel, replace_sel, mir_wstrlen(new_text));
SetSel(sel);
return dif;
}
@@ -270,7 +270,7 @@ int RichEdit::Insert(int pos, const wchar_t *text) ReplaceSel(text);
- int dif = FixSel(&sel, replace_sel, mir_tstrlen(text));
+ int dif = FixSel(&sel, replace_sel, mir_wstrlen(text));
SetSel(sel);
return dif;
}
diff --git a/plugins/SpellChecker/src/ardialog.cpp b/plugins/SpellChecker/src/ardialog.cpp index 0b1a14fa56..f74058bcab 100644 --- a/plugins/SpellChecker/src/ardialog.cpp +++ b/plugins/SpellChecker/src/ardialog.cpp @@ -215,7 +215,7 @@ static INT_PTR CALLBACK AddReplacementDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa wchar_t find[256];
if (data->findReadOnly)
- mir_tstrncpy(find, data->find.c_str(), _countof(find));
+ mir_wstrncpy(find, data->find.c_str(), _countof(find));
else {
GetDlgItemText(hwndDlg, IDC_OLD, find, _countof(find));
lstrtrim(find);
@@ -231,7 +231,7 @@ static INT_PTR CALLBACK AddReplacementDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa else if (replace[0] == 0)
MessageBox(hwndDlg, TranslateT("The correction can't be empty!"), TranslateT("Wrong Correction"), MB_OK | MB_ICONERROR);
- else if (mir_tstrcmp(find, replace) == 0)
+ else if (mir_wstrcmp(find, replace) == 0)
MessageBox(hwndDlg, TranslateT("The correction can't be equal to the wrong word!"), TranslateT("Wrong Correction"), MB_OK | MB_ICONERROR);
else {
diff --git a/plugins/SpellChecker/src/autoreplace.cpp b/plugins/SpellChecker/src/autoreplace.cpp index a3ad88e928..de4350eed3 100644 --- a/plugins/SpellChecker/src/autoreplace.cpp +++ b/plugins/SpellChecker/src/autoreplace.cpp @@ -33,7 +33,7 @@ AutoReplacement::AutoReplacement(const wchar_t *replace, BOOL useVariables) AutoReplaceMap::AutoReplaceMap(wchar_t *aFilename, Dictionary *dict)
{
m_dict = dict;
- mir_tstrncpy(m_filename, aFilename, _countof(m_filename));
+ mir_wstrncpy(m_filename, aFilename, _countof(m_filename));
loadAutoReplaceMap();
}
@@ -143,7 +143,7 @@ wchar_t* AutoReplaceMap::autoReplace(const wchar_t * word) to = wcsdup(ar.replace.c_str());
// Wich case to use?
- size_t len = mir_tstrlen(word);
+ size_t len = mir_wstrlen(word);
size_t i;
for (i = 0; i < len; i++)
if (IsCharLower(word[i]))
@@ -167,7 +167,7 @@ wchar_t* AutoReplaceMap::autoReplace(const wchar_t * word) wchar_t* AutoReplaceMap::filterText(const wchar_t *find)
{
wchar_t *ret = wcsdup(find);
- int len = mir_tstrlen(ret);
+ int len = mir_wstrlen(ret);
int pos = 0;
for (int i = 0; i < len; i++)
if (isWordChar(find[i]))
diff --git a/plugins/SpellChecker/src/dictionary.cpp b/plugins/SpellChecker/src/dictionary.cpp index ee491e541c..10f03b5c92 100644 --- a/plugins/SpellChecker/src/dictionary.cpp +++ b/plugins/SpellChecker/src/dictionary.cpp @@ -365,7 +365,7 @@ protected: void loadCustomDict() { wchar_t filename[1024]; - mir_sntprintf(filename, L"%s\\%s.cdic", userPath, language); + mir_snwprintf(filename, L"%s\\%s.cdic", userPath, language); FILE *file = _wfopen(filename, L"rb"); if (file != NULL) { @@ -393,7 +393,7 @@ protected: CreateDirectoryTreeT(userPath); wchar_t filename[1024]; - mir_sntprintf(filename, L"%s\\%s.cdic", userPath, language); + mir_snwprintf(filename, L"%s\\%s.cdic", userPath, language); FILE *file = _wfopen(filename, L"ab"); if (file != NULL) { @@ -441,13 +441,13 @@ protected: public: HunspellDictionary(wchar_t *aLanguage, wchar_t *aFileWithoutExtension, wchar_t *anUserPath, wchar_t *aSource) { - mir_tstrncpy(language, aLanguage, _countof(language)); - mir_tstrncpy(fileWithoutExtension, aFileWithoutExtension, _countof(fileWithoutExtension)); - mir_tstrncpy(userPath, anUserPath, _countof(userPath)); + mir_wstrncpy(language, aLanguage, _countof(language)); + mir_wstrncpy(fileWithoutExtension, aFileWithoutExtension, _countof(fileWithoutExtension)); + mir_wstrncpy(userPath, anUserPath, _countof(userPath)); if (aSource == NULL) source[0] = '\0'; else - mir_tstrncpy(source, aSource, _countof(source)); + mir_wstrncpy(source, aSource, _countof(source)); loaded = LANGUAGE_NOT_LOADED; localized_name[0] = '\0'; @@ -469,14 +469,14 @@ public: wchar_t * merge(wchar_t * s1, wchar_t *s2) { - int len1 = (s1 == NULL ? 0 : mir_tstrlen(s1)); - int len2 = (s2 == NULL ? 0 : mir_tstrlen(s2)); + int len1 = (s1 == NULL ? 0 : mir_wstrlen(s1)); + int len2 = (s2 == NULL ? 0 : mir_wstrlen(s2)); wchar_t *ret; if (len1 > 0 && len2 > 0) { ret = (wchar_t *)malloc(sizeof(wchar_t) * (len1 + len2 + 1)); - mir_tstrncpy(ret, s1, len1 + 1); - mir_tstrncpy(&ret[len1], s2, len2 + 1); + mir_wstrncpy(ret, s1, len1 + 1); + mir_wstrncpy(&ret[len1], s2, len2 + 1); FREE(s1); FREE(s2); @@ -498,7 +498,7 @@ public: } // Remove duplicated chars - int last = mir_tstrlen(ret) - 1; + int last = mir_wstrlen(ret) - 1; for (int i = 0; i <= last; i++) { wchar_t c = ret[i]; for (int j = last; j > i; j--) { @@ -734,11 +734,11 @@ BOOL CALLBACK EnumLocalesProc(LPTSTR lpLocaleString) GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SISO3166CTRYNAME, end, _countof(end)); wchar_t name[64]; - mir_sntprintf(name, L"%s_%s", ini, end); + mir_snwprintf(name, L"%s_%s", ini, end); for (int i = 0; i < tmp_dicts->getCount(); i++) { Dictionary *dict = (*tmp_dicts)[i]; - if (mir_tstrcmpi(dict->language, name) == 0) { + if (mir_wstrcmpi(dict->language, name) == 0) { GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SENGLANGUAGE, dict->english_name, _countof(dict->english_name)); GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SLANGUAGE, dict->localized_name, _countof(dict->localized_name)); @@ -752,15 +752,15 @@ BOOL CALLBACK EnumLocalesProc(LPTSTR lpLocaleString) wchar_t localName[1024]; if (country[0] != 0) - mir_sntprintf(localName, L"%s (%s)", dict->english_name, country); + mir_snwprintf(localName, L"%s (%s)", dict->english_name, country); else - mir_tstrncpy(localName, dict->english_name, _countof(localName)); + mir_wstrncpy(localName, dict->english_name, _countof(localName)); - mir_tstrncpy(dict->localized_name, TranslateTS(localName), _countof(dict->localized_name)); + mir_wstrncpy(dict->localized_name, TranslateTS(localName), _countof(dict->localized_name)); } if (dict->localized_name[0] != 0) { - mir_sntprintf(dict->full_name, L"%s [%s]", dict->localized_name, dict->language); + mir_snwprintf(dict->full_name, L"%s [%s]", dict->localized_name, dict->language); } break; } @@ -784,24 +784,24 @@ void GetDictsInfo(LIST<Dictionary> &dicts) char lang[128]; WideCharToMultiByte(CP_ACP, 0, dict->language, -1, lang, sizeof(lang), NULL, NULL); if (!db_get_ts(NULL, MODULE_NAME, lang, &dbv)) { - mir_tstrncpy(dict->localized_name, dbv.ptszVal, _countof(dict->localized_name)); + mir_wstrncpy(dict->localized_name, dbv.ptszVal, _countof(dict->localized_name)); db_free(&dbv); } if (dict->localized_name[0] == '\0') { for (size_t j = 0; j < _countof(aditionalLanguages); j++) { - if (!mir_tstrcmp(aditionalLanguages[j].language, dict->language)) { - mir_tstrncpy(dict->localized_name, TranslateTS(aditionalLanguages[j].localized_name), _countof(dict->localized_name)); + if (!mir_wstrcmp(aditionalLanguages[j].language, dict->language)) { + mir_wstrncpy(dict->localized_name, TranslateTS(aditionalLanguages[j].localized_name), _countof(dict->localized_name)); break; } } } if (dict->localized_name[0] != '\0') { - mir_sntprintf(dict->full_name, L"%s [%s]", dict->localized_name, dict->language); + mir_snwprintf(dict->full_name, L"%s [%s]", dict->localized_name, dict->language); } else { - mir_tstrncpy(dict->full_name, dict->language, _countof(dict->full_name)); + mir_wstrncpy(dict->full_name, dict->language, _countof(dict->full_name)); } } } @@ -812,7 +812,7 @@ void GetHunspellDictionariesFromFolder(LIST<Dictionary> &dicts, wchar_t *path, w { // Load the language files and create an array with then wchar_t file[1024] = { 0 }; - mir_sntprintf(file, L"%s\\*.dic", path); + mir_snwprintf(file, L"%s\\*.dic", path); BOOL found = FALSE; @@ -820,7 +820,7 @@ void GetHunspellDictionariesFromFolder(LIST<Dictionary> &dicts, wchar_t *path, w HANDLE hFFD = FindFirstFile(file, &ffd); if (hFFD != INVALID_HANDLE_VALUE) { do { - mir_sntprintf(file, L"%s\\%s", path, ffd.cFileName); + mir_snwprintf(file, L"%s\\%s", path, ffd.cFileName); // Check .dic DWORD attrib = GetFileAttributes(file); @@ -828,29 +828,29 @@ void GetHunspellDictionariesFromFolder(LIST<Dictionary> &dicts, wchar_t *path, w continue; // See if .aff exists too - mir_tstrcpy(&file[mir_tstrlen(file) - 4], L".aff"); + mir_wstrcpy(&file[mir_wstrlen(file) - 4], L".aff"); attrib = GetFileAttributes(file); if (attrib == 0xFFFFFFFF || (attrib & FILE_ATTRIBUTE_DIRECTORY)) continue; - ffd.cFileName[mir_tstrlen(ffd.cFileName) - 4] = '\0'; + ffd.cFileName[mir_wstrlen(ffd.cFileName) - 4] = '\0'; wchar_t *lang = ffd.cFileName; // Replace - for _ - for (size_t i = 0; i < mir_tstrlen(lang); i++) + for (size_t i = 0; i < mir_wstrlen(lang); i++) if (lang[i] == '-') lang[i] = '_'; // Check if dict is new bool exists = false; for (int i = 0; i < dicts.getCount() && !exists; i++) - if (mir_tstrcmp(dicts[i]->language, lang) == 0) + if (mir_wstrcmp(dicts[i]->language, lang) == 0) exists = true; if (!exists) { found = TRUE; - file[mir_tstrlen(file) - 4] = '\0'; + file[mir_wstrlen(file) - 4] = '\0'; dicts.insert(new HunspellDictionary(lang, file, user_path, source)); } } while (FindNextFile(hFFD, &ffd)); @@ -870,7 +870,7 @@ void GetAvaibleDictionaries(LIST<Dictionary> &dicts, wchar_t *path, wchar_t *use // Get other apps dicts for (int i = 0; i < _countof(otherHunspellApps); i++) { wchar_t key[1024]; - mir_sntprintf(key, APPPATH, otherHunspellApps[i].key); + mir_snwprintf(key, APPPATH, otherHunspellApps[i].key); HKEY hKey = 0; LONG lResult = 0; @@ -895,7 +895,7 @@ void GetAvaibleDictionaries(LIST<Dictionary> &dicts, wchar_t *path, wchar_t *use key[cchValue] = 0; wchar_t *pos; if (pos = wcsrchr(key, '\\')) { - if (!mir_tstrcmpi(&pos[1], otherHunspellApps[i].key)) { + if (!mir_wstrcmpi(&pos[1], otherHunspellApps[i].key)) { pos[0] = 0; lResult = ERROR_SUCCESS; break; @@ -908,7 +908,7 @@ void GetAvaibleDictionaries(LIST<Dictionary> &dicts, wchar_t *path, wchar_t *use if (ERROR_SUCCESS == lResult) { wchar_t folder[1024]; - mir_sntprintf(folder, L"%s\\Dictionaries", key); + mir_snwprintf(folder, L"%s\\Dictionaries", key); GetHunspellDictionariesFromFolder(languages, folder, user_path, otherHunspellApps[i].name); } @@ -923,7 +923,7 @@ void GetAvaibleDictionaries(LIST<Dictionary> &dicts, wchar_t *path, wchar_t *use // Sort dicts for (int i = 0; i < dicts.getCount(); i++) { for (int j = i + 1; j < dicts.getCount(); j++) { - if (mir_tstrcmp(dicts[i]->full_name, dicts[j]->full_name) > 0) { + if (mir_wstrcmp(dicts[i]->full_name, dicts[j]->full_name) > 0) { Dictionary *dict = dicts[i]; sl->items[i] = dicts[j]; sl->items[j] = dict; diff --git a/plugins/SpellChecker/src/options.cpp b/plugins/SpellChecker/src/options.cpp index c0bc78ab5a..21309b391a 100644 --- a/plugins/SpellChecker/src/options.cpp +++ b/plugins/SpellChecker/src/options.cpp @@ -94,17 +94,17 @@ void LoadOptions() DBVARIANT dbv;
if (!db_get_ts(NULL, MODULE_NAME, "DefaultLanguage", &dbv)) {
- mir_tstrncpy(opts.default_language, dbv.ptszVal, _countof(opts.default_language));
+ mir_wstrncpy(opts.default_language, dbv.ptszVal, _countof(opts.default_language));
db_free(&dbv);
}
int i;
for (i = 0; i < languages.getCount(); i++)
- if (mir_tstrcmp(languages[i]->language, opts.default_language) == 0)
+ if (mir_wstrcmp(languages[i]->language, opts.default_language) == 0)
break;
if (i >= languages.getCount())
- mir_tstrcpy(opts.default_language, languages[0]->language);
+ mir_wstrcpy(opts.default_language, languages[0]->language);
}
static void DrawItem(LPDRAWITEMSTRUCT lpdis, Dictionary *dict)
@@ -179,7 +179,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage(hwndDlg, IDC_DEF_LANG, CB_ADDSTRING, 0, (LPARAM)languages[i]->full_name);
SendDlgItemMessage(hwndDlg, IDC_DEF_LANG, CB_SETITEMDATA, i, (LPARAM)languages[i]);
- if (!mir_tstrcmp(opts.default_language, languages[i]->language))
+ if (!mir_wstrcmp(opts.default_language, languages[i]->language))
sel = i;
}
SendDlgItemMessage(hwndDlg, IDC_DEF_LANG, CB_SETCURSEL, sel, 0);
@@ -214,7 +214,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP sel = 0;
db_set_ts(NULL, MODULE_NAME, "DefaultLanguage",
(wchar_t *)languages[sel]->language);
- mir_tstrcpy(opts.default_language, languages[sel]->language);
+ mir_wstrcpy(opts.default_language, languages[sel]->language);
}
}
break;
@@ -328,7 +328,7 @@ static void SaveNewReplacements(BOOL canceled, Dictionary*, AutoreplaceData *data = (AutoreplaceData *)param;
- if (mir_tstrlen(original_find) > 0)
+ if (mir_wstrlen(original_find) > 0)
data->RemoveWord(original_find);
data->AddWord(find, replace, useVariables);
@@ -351,7 +351,7 @@ static void ShowAddReplacement(HWND hwndDlg, int item = -1) else
ListView_GetItemText(GetDlgItem(hwndDlg, IDC_REPLACEMENTS), item, 0, find, _countof(find));
- if (mir_tstrlen(find) > 0) {
+ if (mir_wstrlen(find) > 0) {
AutoReplacement &ar = data->autoReplaceMap[find];
replace = ar.replace.c_str();
useVariables = ar.useVariables;
@@ -378,7 +378,7 @@ static INT_PTR CALLBACK AutoreplaceDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam SendDlgItemMessage(hwndDlg, IDC_LANGUAGE, CB_ADDSTRING, 0, (LPARAM)p->full_name);
SendDlgItemMessage(hwndDlg, IDC_LANGUAGE, CB_SETITEMDATA, i, (LPARAM)new AutoreplaceData(p));
- if (!mir_tstrcmp(opts.default_language, p->language))
+ if (!mir_wstrcmp(opts.default_language, p->language))
sel = i;
}
SendDlgItemMessage(hwndDlg, IDC_LANGUAGE, CB_SETCURSEL, sel, 0);
diff --git a/plugins/SpellChecker/src/spellchecker.cpp b/plugins/SpellChecker/src/spellchecker.cpp index e6217118c4..f40a0a6ee3 100644 --- a/plugins/SpellChecker/src/spellchecker.cpp +++ b/plugins/SpellChecker/src/spellchecker.cpp @@ -80,7 +80,7 @@ static int IconsChanged(WPARAM, LPARAM) sid.dwId = i; wchar_t tmp[128]; - mir_sntprintf(tmp, L"%s - %s", TranslateT("Spell Checker"), languages[i]->full_name); + mir_snwprintf(tmp, L"%s - %s", TranslateT("Spell Checker"), languages[i]->full_name); sid.tszTooltip = tmp; HICON hIcon = (opts.use_flags) ? IcoLib_GetIconByHandle(languages[i]->hIcolib) : IcoLib_GetIcon("spellchecker_enabled"); @@ -134,7 +134,7 @@ static int ModulesLoaded(WPARAM, LPARAM) if (opts.use_flags) { // Load flags dll wchar_t flag_file[MAX_PATH]; - mir_sntprintf(flag_file, L"%s\\flags_icons.dll", flagsDllFolder); + mir_snwprintf(flag_file, L"%s\\flags_icons.dll", flagsDllFolder); HMODULE hFlagsDll = LoadLibraryEx(flag_file, NULL, LOAD_LIBRARY_AS_DATAFILE); wchar_t path[MAX_PATH]; @@ -184,10 +184,10 @@ static int ModulesLoaded(WPARAM, LPARAM) Dictionary *dict = languages[j]; wchar_t filename[MAX_PATH]; - mir_sntprintf(filename, L"%s\\%s.ar", customDictionariesFolder, dict->language); + mir_snwprintf(filename, L"%s\\%s.ar", customDictionariesFolder, dict->language); dict->autoReplace = new AutoReplaceMap(filename, dict); - if (mir_tstrcmp(dict->language, opts.default_language) == 0) + if (mir_wstrcmp(dict->language, opts.default_language) == 0) dict->load(); } @@ -205,7 +205,7 @@ static int ModulesLoaded(WPARAM, LPARAM) sid.dwId = i; wchar_t tmp[128]; - mir_sntprintf(tmp, L"%s - %s", TranslateT("Spell Checker"), languages[i]->full_name); + mir_snwprintf(tmp, L"%s - %s", TranslateT("Spell Checker"), languages[i]->full_name); sid.tszTooltip = tmp; sid.hIcon = (opts.use_flags) ? IcoLib_GetIconByHandle(languages[i]->hIcolib) : IcoLib_GetIcon("spellchecker_enabled"); Srmm_AddIcon(&sid); diff --git a/plugins/SpellChecker/src/utils.cpp b/plugins/SpellChecker/src/utils.cpp index 7df9b00d14..a3cab0e333 100644 --- a/plugins/SpellChecker/src/utils.cpp +++ b/plugins/SpellChecker/src/utils.cpp @@ -276,7 +276,7 @@ int CheckTextLine(Dialog *dlg, int line, TextParser *parser, int errors = 0;
wchar_t text[1024];
dlg->re->GetLine(line, text, _countof(text));
- int len = mir_tstrlen(text);
+ int len = mir_wstrlen(text);
int first_char = dlg->re->GetFirstCharOfLine(line);
// Now lets get the words
@@ -365,7 +365,7 @@ int CheckTextLine(Dialog *dlg, int line, TextParser *parser, if (dif != 0) {
// Read line again
dlg->re->GetLine(line, text, _countof(text));
- len = mir_tstrlen(text);
+ len = mir_wstrlen(text);
int old_first_char = first_char;
first_char = dlg->re->GetFirstCharOfLine(line);
@@ -440,7 +440,7 @@ void ToLocaleID(wchar_t *szKLName, size_t size) GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SISO639LANGNAME, ini, _countof(ini));
GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SISO3166CTRYNAME, end, _countof(end));
- mir_sntprintf(szKLName, size, L"%s_%s", ini, end);
+ mir_snwprintf(szKLName, size, L"%s_%s", ini, end);
}
void LoadDictFromKbdl(Dialog *dlg)
@@ -449,7 +449,7 @@ void LoadDictFromKbdl(Dialog *dlg) // Use default input language
HKL hkl = GetKeyboardLayout(0);
- mir_sntprintf(szKLName, L"%x", (int)LOWORD(hkl));
+ mir_snwprintf(szKLName, L"%x", (int)LOWORD(hkl));
ToLocaleID(szKLName, _countof(szKLName));
int d = GetClosestLanguage(szKLName);
@@ -501,7 +501,7 @@ LRESULT CALLBACK OwnerProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) int errors = TimerCheck(dlg, TRUE);
if (errors > 0) {
wchar_t text[500];
- mir_sntprintf(text, TranslateT("There are %d spelling errors. Are you sure you want to send this message?"), errors);
+ mir_snwprintf(text, TranslateT("There are %d spelling errors. Are you sure you want to send this message?"), errors);
if (MessageBox(hwnd, text, TranslateT("Spell Checker"), MB_ICONQUESTION | MB_YESNO) == IDNO)
return TRUE;
}
@@ -680,12 +680,12 @@ int GetClosestLanguage(wchar_t *lang_name) // Search the language by name
for (i = 0; i < languages.getCount(); i++)
- if (mir_tstrcmpi(languages[i]->language, lang_name) == 0)
+ if (mir_wstrcmpi(languages[i]->language, lang_name) == 0)
return i;
// Try searching by the prefix only
wchar_t lang[128];
- mir_tstrncpy(lang, lang_name, _countof(lang));
+ mir_wstrncpy(lang, lang_name, _countof(lang));
{
wchar_t *p = wcschr(lang, '_');
if (p != NULL) *p = '\0';
@@ -693,11 +693,11 @@ int GetClosestLanguage(wchar_t *lang_name) // First check if there is a language that is only the prefix
for (i = 0; i < languages.getCount(); i++)
- if (mir_tstrcmpi(languages[i]->language, lang) == 0)
+ if (mir_wstrcmpi(languages[i]->language, lang) == 0)
return i;
// Now try any suffix
- size_t len = mir_tstrlen(lang);
+ size_t len = mir_wstrlen(lang);
for (i = 0; i < languages.getCount(); i++) {
wchar_t *p = wcschr(languages[i]->language, '_');
if (p == NULL)
@@ -738,10 +738,10 @@ void GetUserProtoLanguageSetting(Dialog *dlg, MCONTACT hContact, char *group, ch for (int i = 0; i < languages.getCount(); i++) {
Dictionary *dict = languages[i];
- if (mir_tstrcmpi(dict->localized_name, lang) == 0
- || mir_tstrcmpi(dict->english_name, lang) == 0
- || mir_tstrcmpi(dict->language, lang) == 0) {
- mir_tstrncpy(dlg->lang_name, dict->language, _countof(dlg->lang_name));
+ if (mir_wstrcmpi(dict->localized_name, lang) == 0
+ || mir_wstrcmpi(dict->english_name, lang) == 0
+ || mir_wstrcmpi(dict->language, lang) == 0) {
+ mir_wstrncpy(dlg->lang_name, dict->language, _countof(dlg->lang_name));
break;
}
}
@@ -782,18 +782,18 @@ void GetContactLanguage(Dialog *dlg) if (dlg->hContact == NULL) {
if (!db_get_ts(NULL, MODULE_NAME, dlg->name, &dbv)) {
- mir_tstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name));
+ mir_wstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name));
db_free(&dbv);
}
}
else {
if (!db_get_ts(dlg->hContact, MODULE_NAME, "TalkLanguage", &dbv)) {
- mir_tstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name));
+ mir_wstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name));
db_free(&dbv);
}
if (dlg->lang_name[0] == '\0' && !db_get_ts(dlg->hContact, "eSpeak", "TalkLanguage", &dbv)) {
- mir_tstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name));
+ mir_wstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name));
db_free(&dbv);
}
@@ -802,12 +802,12 @@ void GetContactLanguage(Dialog *dlg) MCONTACT hMetaContact = db_mc_getMeta(dlg->hContact);
if (hMetaContact != NULL) {
if (!db_get_ts(hMetaContact, MODULE_NAME, "TalkLanguage", &dbv)) {
- mir_tstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name));
+ mir_wstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name));
db_free(&dbv);
}
if (dlg->lang_name[0] == '\0' && !db_get_ts(hMetaContact, "eSpeak", "TalkLanguage", &dbv)) {
- mir_tstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name));
+ mir_wstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name));
db_free(&dbv);
}
}
@@ -825,13 +825,13 @@ void GetContactLanguage(Dialog *dlg) // Use default lang
if (dlg->lang_name[0] == '\0')
- mir_tstrncpy(dlg->lang_name, opts.default_language, _countof(dlg->lang_name));
+ mir_wstrncpy(dlg->lang_name, opts.default_language, _countof(dlg->lang_name));
}
int i = GetClosestLanguage(dlg->lang_name);
if (i < 0) {
// Lost a dict?
- mir_tstrncpy(dlg->lang_name, opts.default_language, _countof(dlg->lang_name));
+ mir_wstrncpy(dlg->lang_name, opts.default_language, _countof(dlg->lang_name));
i = GetClosestLanguage(dlg->lang_name);
}
@@ -1035,7 +1035,7 @@ void AppendSubmenu(HMENU hMenu, HMENU hSubMenu, wchar_t *name) mii.fType = MFT_STRING;
mii.hSubMenu = hSubMenu;
mii.dwTypeData = name;
- mii.cch = mir_tstrlen(name);
+ mii.cch = mir_wstrlen(name);
InsertMenuItem(hMenu, 0, TRUE, &mii);
}
@@ -1053,7 +1053,7 @@ void AppendMenuItem(HMENU hMenu, int id, wchar_t *name, HICON hIcon, BOOL checke mii.hbmpChecked = iconInfo.hbmColor;
mii.hbmpUnchecked = iconInfo.hbmColor;
mii.dwTypeData = name;
- mii.cch = mir_tstrlen(name);
+ mii.cch = mir_wstrlen(name);
InsertMenuItem(hMenu, 0, TRUE, &mii);
}
@@ -1117,7 +1117,7 @@ void AddMenuForWord(Dialog *dlg, wchar_t *word, CHARRANGE &pos, HMENU hMenu, BOO InsertMenu(hMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, 0);
wchar_t text[128];
- mir_sntprintf(text, TranslateT("Wrong word: %s"), word);
+ mir_snwprintf(text, TranslateT("Wrong word: %s"), word);
InsertMenu(hMenu, 0, MF_BYPOSITION, 0, text);
}
}
@@ -1551,7 +1551,7 @@ LRESULT CALLBACK MenuWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) wchar_t* lstrtrim(wchar_t *str)
{
- int len = mir_tstrlen(str);
+ int len = mir_wstrlen(str);
int i;
for (i = len - 1; i >= 0 && (str[i] == ' ' || str[i] == '\t'); --i);
@@ -1572,7 +1572,7 @@ BOOL lstreq(wchar_t *a, wchar_t *b, size_t len) {
a = CharLower(wcsdup(a));
b = CharLower(wcsdup(b));
- BOOL ret = len ? !wcsncmp(a, b, len) : !mir_tstrcmp(a, b);
+ BOOL ret = len ? !wcsncmp(a, b, len) : !mir_wstrcmp(a, b);
free(a);
free(b);
return ret;
diff --git a/plugins/SplashScreen/src/bitmap_funcs.cpp b/plugins/SplashScreen/src/bitmap_funcs.cpp index 9c89965cbe..c0d1531c17 100644 --- a/plugins/SplashScreen/src/bitmap_funcs.cpp +++ b/plugins/SplashScreen/src/bitmap_funcs.cpp @@ -120,7 +120,7 @@ void MyBitmap::restoreAlpha(int x, int y, int w, int h) void MyBitmap::DrawText(wchar_t *str, int x, int y)
{
- SIZE sz; GetTextExtentPoint32(this->getDC(), str, (int)mir_tstrlen(str), &sz);
+ SIZE sz; GetTextExtentPoint32(this->getDC(), str, (int)mir_wstrlen(str), &sz);
RECT rc; SetRect(&rc, x, y, x + 10000, y + 10000);
this->saveAlpha(x - 2, y - 2, sz.cx + 2, sz.cy + 2);
::DrawText(this->getDC(), str, -1, &rc, DT_LEFT | DT_TOP | DT_SINGLELINE | DT_NOPREFIX);
diff --git a/plugins/SplashScreen/src/debug.h b/plugins/SplashScreen/src/debug.h index c283bd30d9..91f45ef971 100644 --- a/plugins/SplashScreen/src/debug.h +++ b/plugins/SplashScreen/src/debug.h @@ -17,17 +17,17 @@ int inline _DebugPopup(MCONTACT hContact, wchar_t *fmt, ...) wchar_t debug[1024];
va_start(va, fmt);
- mir_sntprintf(debug, fmt, va);
+ mir_snwprintf(debug, fmt, va);
if(CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0) == 1) {
POPUPDATAT ppd = { 0 };
ppd.lchContact = hContact;
ppd.lchIcon = Skin_LoadIcon(SKINICON_OTHER_MIRANDA);
if(hContact != 0)
- mir_tstrncpy(ppd.lptzContactName, (wchar_t*)pcli->pfnGetContactDisplayName(hContact, 0), MAX_CONTACTNAME);
+ mir_wstrncpy(ppd.lptzContactName, (wchar_t*)pcli->pfnGetContactDisplayName(hContact, 0), MAX_CONTACTNAME);
else
- mir_tstrncpy(ppd.lptzContactName, _A2W(PlugName), MAX_CONTACTNAME);
- mir_tstrncpy(ppd.lptzText, debug, MAX_SECONDLINE - 20);
+ mir_wstrncpy(ppd.lptzContactName, _A2W(PlugName), MAX_CONTACTNAME);
+ mir_wstrncpy(ppd.lptzText, debug, MAX_SECONDLINE - 20);
ppd.colorText = RGB(255,255,255);
ppd.colorBack = RGB(255,0,0);
PUAddPopupT(&ppd);
diff --git a/plugins/SplashScreen/src/main.cpp b/plugins/SplashScreen/src/main.cpp index 0a88380ac3..9fa6d0263d 100644 --- a/plugins/SplashScreen/src/main.cpp +++ b/plugins/SplashScreen/src/main.cpp @@ -65,13 +65,13 @@ void SplashMain() if (bstartup) {
// Retrive path to exe of current running Miranda is located
szMirDir = Utils_ReplaceVarsT(L"%miranda_path%");
- mir_sntprintf(szhAdvaimgPath, L"%s\\plugins\\advaimg.dll", szMirDir);
+ mir_snwprintf(szhAdvaimgPath, L"%s\\plugins\\advaimg.dll", szMirDir);
CallService(MS_SYSTEM_GETVERSIONTEXT, MAX_PATH, (LPARAM)szVersion);
#ifdef _DEBUG
- mir_sntprintf(szLogFile, L"%s\\%s.log", szMirDir, _A2W(__PLUGIN_NAME));
+ mir_snwprintf(szLogFile, L"%s\\%s.log", szMirDir, _A2W(__PLUGIN_NAME));
initLog();
- wchar_t *mirandaVerString = mir_a2t(szVersion);
+ wchar_t *mirandaVerString = mir_a2u(szVersion);
logMessage(L"Miranda version", mirandaVerString);
mir_free(mirandaVerString);
logMessage(L"Dll Name", _A2W(__FILENAME));
@@ -84,45 +84,45 @@ void SplashMain() if (bstartup & (options.active == 1)) {
DBVARIANT dbv = { 0 };
if (!db_get_ts(NULL, MODNAME, "VersionPrefix", &dbv)) {
- mir_tstrcpy(szPrefix, dbv.ptszVal);
+ mir_wstrcpy(szPrefix, dbv.ptszVal);
db_free(&dbv);
}
else
- mir_tstrcpy(szPrefix, L"");
+ mir_wstrcpy(szPrefix, L"");
if (!db_get_ts(NULL, MODNAME, "Path", &dbv)) {
- mir_tstrcpy(inBuf, dbv.ptszVal);
+ mir_wstrcpy(inBuf, dbv.ptszVal);
db_free(&dbv);
}
- else mir_tstrcpy(inBuf, L"splash\\splash.png");
+ else mir_wstrcpy(inBuf, L"splash\\splash.png");
wchar_t szExpandedSplashFile[MAX_PATH];
ExpandEnvironmentStrings(inBuf, szExpandedSplashFile, _countof(szExpandedSplashFile));
- mir_tstrcpy(inBuf, szExpandedSplashFile);
+ mir_wstrcpy(inBuf, szExpandedSplashFile);
wchar_t *pos3 = 0;
pos3 = wcsrchr(inBuf, ':');
if (pos3 == NULL)
- mir_sntprintf(szSplashFile, L"%s\\%s", szMirDir, inBuf);
+ mir_snwprintf(szSplashFile, L"%s\\%s", szMirDir, inBuf);
else
- mir_tstrcpy(szSplashFile, inBuf);
+ mir_wstrcpy(szSplashFile, inBuf);
if (!db_get_ts(NULL, MODNAME, "Sound", &dbv)) {
- mir_tstrcpy(inBuf, dbv.ptszVal);
+ mir_wstrcpy(inBuf, dbv.ptszVal);
db_free(&dbv);
}
- else mir_tstrcpy(inBuf, L"sounds\\startup.wav");
+ else mir_wstrcpy(inBuf, L"sounds\\startup.wav");
wchar_t szExpandedSoundFile[MAX_PATH];
ExpandEnvironmentStrings(inBuf, szExpandedSoundFile, _countof(szExpandedSoundFile));
- mir_tstrcpy(inBuf, szExpandedSoundFile);
+ mir_wstrcpy(inBuf, szExpandedSoundFile);
wchar_t *pos2;
pos2 = wcschr(inBuf, ':');
if (pos2 == NULL)
- mir_sntprintf(szSoundFile, L"%s\\%s", szMirDir, inBuf);
+ mir_snwprintf(szSoundFile, L"%s\\%s", szMirDir, inBuf);
else
- mir_tstrcpy(szSoundFile, inBuf);
+ mir_wstrcpy(szSoundFile, inBuf);
#ifdef _DEBUG
logMessage(L"SoundFilePath", szSoundFile);
@@ -137,13 +137,13 @@ void SplashMain() wchar_t *p = 0;
wchar_t files[255][50]; //TODO: make memory allocation dynamic
- mir_tstrcpy(szSplashDir, szSplashFile);
- mir_tstrcpy(szOldPath, szSplashFile);
+ mir_wstrcpy(szSplashDir, szSplashFile);
+ mir_wstrcpy(szOldPath, szSplashFile);
// find the last \ and null it out, this leaves no trailing slash
p = wcsrchr(szSplashDir, '\\');
if (p) *p = 0;
// create the search filter
- mir_sntprintf(szSearch, L"%s\\*.*", szSplashDir);
+ mir_snwprintf(szSearch, L"%s\\*.*", szSplashDir);
// FFFN will return filenames
HANDLE hFind = INVALID_HANDLE_VALUE;
WIN32_FIND_DATA ffd;
@@ -157,19 +157,19 @@ void SplashMain() //files = new char[mir_strlen(ffd.cFileName)];
//files[filescount] = new char[mir_strlen(ffd.cFileName)];
wchar_t ext[5];
- wmemcpy(ext, ffd.cFileName + (mir_tstrlen(ffd.cFileName) - 4), 5);
+ wmemcpy(ext, ffd.cFileName + (mir_wstrlen(ffd.cFileName) - 4), 5);
#ifdef _DEBUG
logMessage(L"Extention", ext);
#endif
- if (mir_tstrcmpi(ext, L".png") & mir_tstrcmpi(ext, L".bmp"))
+ if (mir_wstrcmpi(ext, L".png") & mir_wstrcmpi(ext, L".bmp"))
continue;
#ifdef _DEBUG
logMessage(L"File has valid ext", ext);
#endif
- mir_tstrcpy(files[filescount++], ffd.cFileName);
+ mir_wstrcpy(files[filescount++], ffd.cFileName);
} //if
} while (FindNextFile(hFind, &ffd));
@@ -177,7 +177,7 @@ void SplashMain() int r = 0;
if (filescount) r = (rand() % filescount) + 1;
- mir_sntprintf(szSplashFile, L"%s\\%s", szSplashDir, files[r - 1]);
+ mir_snwprintf(szSplashFile, L"%s\\%s", szSplashDir, files[r - 1]);
#ifdef _DEBUG
logMessage(L"final file", szSplashFile);
diff --git a/plugins/SplashScreen/src/options.cpp b/plugins/SplashScreen/src/options.cpp index f68eac44be..dce6380576 100644 --- a/plugins/SplashScreen/src/options.cpp +++ b/plugins/SplashScreen/src/options.cpp @@ -69,27 +69,27 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP wchar_t inBuf[80];
DBVARIANT dbv = { 0 };
if (!db_get_ts(NULL, MODNAME, "Path", &dbv)) {
- mir_tstrcpy(inBuf, dbv.ptszVal);
+ mir_wstrcpy(inBuf, dbv.ptszVal);
db_free(&dbv);
}
else
- mir_tstrcpy(inBuf, L"splash\\splash.png");
+ mir_wstrcpy(inBuf, L"splash\\splash.png");
SetDlgItemText(hwndDlg, IDC_SPLASHPATH, inBuf);
if (!db_get_ts(NULL, MODNAME, "Sound", &dbv)) {
- mir_tstrcpy(inBuf, dbv.ptszVal);
+ mir_wstrcpy(inBuf, dbv.ptszVal);
db_free(&dbv);
}
else
- mir_tstrcpy(inBuf, L"sounds\\startup.wav");
+ mir_wstrcpy(inBuf, L"sounds\\startup.wav");
SetDlgItemText(hwndDlg, IDC_SNDPATH, inBuf);
if (!db_get_ts(NULL, MODNAME, "VersionPrefix", &dbv)) {
- mir_tstrcpy(inBuf, dbv.ptszVal);
+ mir_wstrcpy(inBuf, dbv.ptszVal);
db_free(&dbv);
}
else
- mir_tstrcpy(inBuf, L"");
+ mir_wstrcpy(inBuf, L"");
SetDlgItemText(hwndDlg, IDC_VERSIONPREFIX, inBuf);
if (options.active)
@@ -169,19 +169,19 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP wchar_t szTempPath[MAX_PATH], initDir[MAX_PATH];
if (Exists(szSplashFile)) {
- mir_tstrcpy(initDir, szSplashFile);
+ mir_wstrcpy(initDir, szSplashFile);
wchar_t *pos = wcsrchr(initDir, '\\');
if (pos != NULL)
*pos = 0;
}
else {
szMirDir = Utils_ReplaceVarsT(L"%miranda_path%");
- mir_tstrcpy(initDir, szMirDir);
+ mir_wstrcpy(initDir, szMirDir);
mir_free(szMirDir);
}
wchar_t tmp[MAX_PATH];
- mir_sntprintf(tmp, L"%s (*.png, *.bmp)%c*.png;*.bmp%c%c", TranslateT("Graphic files"), 0, 0, 0);
+ mir_snwprintf(tmp, L"%s (*.png, *.bmp)%c*.png;*.bmp%c%c", TranslateT("Graphic files"), 0, 0, 0);
OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
@@ -195,19 +195,19 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP ofn.lpstrDefExt = L"";
if (GetOpenFileName(&ofn)) {
- mir_tstrcpy(szSplashFile, szTempPath);
+ mir_wstrcpy(szSplashFile, szTempPath);
#ifdef _DEBUG
logMessage(L"Set path", szSplashFile);
#endif
// Make path relative
int result = PathToRelativeT(szTempPath, szPath2Spash);
- if (result && mir_tstrlen(szPath2Spash) > 0) {
+ if (result && mir_wstrlen(szPath2Spash) > 0) {
if (options.random) {
wchar_t *pos = wcsrchr(szPath2Spash, '\\');
if (pos != NULL) {
*pos = 0;
- mir_tstrcat(szPath2Spash, L"\\");
+ mir_wstrcat(szPath2Spash, L"\\");
}
}
@@ -226,20 +226,20 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP wchar_t *pos;
if (Exists(szSoundFile)) {
- mir_tstrcpy(initDir, szSoundFile);
+ mir_wstrcpy(initDir, szSoundFile);
pos = wcsrchr(initDir, '\\');
if (pos != NULL) *pos = 0;
}
else {
szMirDir = Utils_ReplaceVarsT(L"%miranda_path%");
- mir_tstrcpy(initDir, szMirDir);
+ mir_wstrcpy(initDir, szMirDir);
mir_free(szMirDir);
}
OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
wchar_t tmp[MAX_PATH];
- mir_sntprintf(tmp, L"%s (*.wav, *.mp3)%c*.wav;*.mp3%c%c", TranslateT("Sound Files"), 0, 0, 0);
+ mir_snwprintf(tmp, L"%s (*.wav, *.mp3)%c*.wav;*.mp3%c%c", TranslateT("Sound Files"), 0, 0, 0);
ofn.lpstrFilter = tmp;
ofn.hwndOwner = 0;
ofn.lpstrFile = szTempPath;
@@ -251,7 +251,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP ofn.lpstrDefExt = L"";
if (GetOpenFileName(&ofn)) {
- mir_tstrcpy(szSoundFile, szTempPath);
+ mir_wstrcpy(szSoundFile, szTempPath);
#ifdef _DEBUG
logMessage(L"Set sound path", szSoundFile);
@@ -259,7 +259,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP // Make path relative
int result = PathToRelativeT(szTempPath, szSoundFilePath);
- if (result && mir_tstrlen(szSoundFile) > 0)
+ if (result && mir_wstrlen(szSoundFile) > 0)
SetDlgItemText(hwndDlg, IDC_SNDPATH, szSoundFilePath);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
@@ -295,7 +295,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP GetDlgItemText(hwndDlg, IDC_VERSIONPREFIX, tmp, _countof(tmp));
db_set_ts(NULL, MODNAME, "VersionPrefix", tmp);
- mir_tstrcpy(szPrefix, tmp);
+ mir_wstrcpy(szPrefix, tmp);
GetDlgItemText(hwndDlg, IDC_SHOWTIME, tmp, _countof(tmp));
db_set_dw(NULL, MODNAME, "TimeToShow", _wtoi(tmp));
diff --git a/plugins/SplashScreen/src/services.cpp b/plugins/SplashScreen/src/services.cpp index 7a9e35cc69..8b9f6e4caf 100644 --- a/plugins/SplashScreen/src/services.cpp +++ b/plugins/SplashScreen/src/services.cpp @@ -26,18 +26,18 @@ INT_PTR ShowSplashService(WPARAM wparam, LPARAM lparam) wchar_t *filename = (wchar_t*)wparam;
int timetoshow = (int)lparam;
- mir_tstrcpy(szOldfn, szSplashFile);
+ mir_wstrcpy(szOldfn, szSplashFile);
options.showtime = timetoshow;
wchar_t *pos = wcsrchr(filename, ':');
if (pos == NULL)
- mir_sntprintf(szSplashFile, L"%s\\%s", szMirDir, filename);
+ mir_snwprintf(szSplashFile, L"%s\\%s", szMirDir, filename);
else
- mir_tstrcpy(szSplashFile, filename);
+ mir_wstrcpy(szSplashFile, filename);
ShowSplash(false);
- mir_tstrcpy(szSplashFile, szOldfn);
+ mir_wstrcpy(szSplashFile, szOldfn);
return 0;
}
diff --git a/plugins/SplashScreen/src/splash.cpp b/plugins/SplashScreen/src/splash.cpp index c3cafffbc6..fa5f838ab2 100644 --- a/plugins/SplashScreen/src/splash.cpp +++ b/plugins/SplashScreen/src/splash.cpp @@ -42,9 +42,9 @@ LRESULT CALLBACK SplashWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM #ifdef _DEBUG
wchar_t b[40];
- mir_sntprintf(b, L"%d", wParam);
+ mir_snwprintf(b, L"%d", wParam);
logMessage(L"Timer ID", b);
- mir_sntprintf(b, L"%d", options.showtime);
+ mir_snwprintf(b, L"%d", options.showtime);
logMessage(L"ShowTime value", b);
#endif
@@ -228,16 +228,16 @@ void __cdecl SplashThread(void *arg) }
wchar_t verString[256] = { 0 };
- wchar_t *mirandaVerString = mir_a2t(szVersion);
- mir_sntprintf(verString, L"%s%s", szPrefix, mirandaVerString);
+ wchar_t *mirandaVerString = mir_a2u(szVersion);
+ mir_snwprintf(verString, L"%s%s", szPrefix, mirandaVerString);
mir_free(mirandaVerString);
LOGFONT lf = { 0 };
lf.lfHeight = 14;
- mir_tstrcpy(lf.lfFaceName, L"Verdana");
+ mir_wstrcpy(lf.lfFaceName, L"Verdana");
SelectObject(SplashBmp->getDC(), CreateFontIndirect(&lf));
if (!splashWithMarkers) {
SIZE v_sz = { 0, 0 };
- GetTextExtentPoint32(SplashBmp->getDC(), verString, (int)mir_tstrlen(verString), &v_sz);
+ GetTextExtentPoint32(SplashBmp->getDC(), verString, (int)mir_wstrlen(verString), &v_sz);
x = SplashBmp->getWidth() / 2 - (v_sz.cx / 2);
y = SplashBmp->getHeight() - (SplashBmp->getHeight()*(100 - 90) / 100);
}
@@ -327,7 +327,7 @@ BOOL ShowSplash(BOOL bpreview) timeout = options.showtime;
#ifdef _DEBUG
wchar_t b[40];
- mir_sntprintf(b, L"%d", options.showtime);
+ mir_snwprintf(b, L"%d", options.showtime);
logMessage(L"Timeout", b);
#endif
}
diff --git a/plugins/StartupSilence/src/main.cpp b/plugins/StartupSilence/src/main.cpp index fa478010c4..2c6fd9d728 100644 --- a/plugins/StartupSilence/src/main.cpp +++ b/plugins/StartupSilence/src/main.cpp @@ -351,7 +351,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
LoadSettings();
- SetDlgItemText(hwndDlg, IDC_HST, mir_a2t(hostname));
+ SetDlgItemText(hwndDlg, IDC_HST, mir_a2u(hostname));
CheckDlgButton(hwndDlg, IDC_DELAY, (Enabled == 1) ? BST_CHECKED : BST_UNCHECKED);
SendDlgItemMessage(hwndDlg, IDC_SSSPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_SSTIME), 0);
SendDlgItemMessage(hwndDlg, IDC_SSSPIN, UDM_SETRANGE32, 10, 300);
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp b/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp index 818631c5dc..1941273470 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp +++ b/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp @@ -127,7 +127,7 @@ INT_PTR CALLBACK DlgProcAutoAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L if (settings[i]->msg != NULL)
SetDlgItemTextA(hwndDlg, IDC_STATUSMSG, settings[i]->msg);
else {
- ptrT msg((wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGT, settings[i]->status, 0));
+ ptrW msg((wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGT, settings[i]->status, 0));
SetDlgItemText(hwndDlg, IDC_STATUSMSG, (msg != NULL) ? msg : L"");
}
diff --git a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp index 413c8f0f54..54cb3028d4 100644 --- a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp +++ b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp @@ -224,7 +224,7 @@ static int AssignStatus(TConnectionSettings* cs, int status, int lastStatus, wch log_infoA("KeepStatus: assigning status %d to %s", cs->status, cs->szName); - if (szMsg != NULL && mir_tstrcmp(szMsg, cs->szMsg)) { + if (szMsg != NULL && mir_wstrcmp(szMsg, cs->szMsg)) { if (cs->szMsg != NULL) free(cs->szMsg); @@ -897,7 +897,7 @@ static int ProcessPopup(int reason, LPARAM lParam) return -1; hIcon = Skin_LoadProtoIcon((char*)lParam, SKINICON_STATUS_OFFLINE); - mir_sntprintf(text, TranslateT("%s connected from another location"), GetHumanName(lParam)); + mir_snwprintf(text, TranslateT("%s connected from another location"), GetHumanName(lParam)); break; case KS_CONN_STATE_LOGINERROR: // lParam = 1 proto @@ -906,9 +906,9 @@ static int ProcessPopup(int reason, LPARAM lParam) hIcon = Skin_LoadProtoIcon((char*)lParam, SKINICON_STATUS_OFFLINE); if (db_get_b(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING) == LOGINERR_CANCEL) - mir_sntprintf(text, TranslateT("%s login error, cancel reconnecting"), GetHumanName(lParam)); + mir_snwprintf(text, TranslateT("%s login error, cancel reconnecting"), GetHumanName(lParam)); else if (db_get_b(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING) == LOGINERR_SETDELAY) - mir_sntprintf(text, TranslateT("%s login error (next retry (%d) in %d s)"), GetHumanName(lParam), retryCount + 1, db_get_dw(NULL, MODULENAME, SETTING_LOGINERR_DELAY, DEFAULT_MAXDELAY)); + mir_snwprintf(text, TranslateT("%s login error (next retry (%d) in %d s)"), GetHumanName(lParam), retryCount + 1, db_get_dw(NULL, MODULENAME, SETTING_LOGINERR_DELAY, DEFAULT_MAXDELAY)); else return -1; break; @@ -919,9 +919,9 @@ static int ProcessPopup(int reason, LPARAM lParam) if (lParam) { // Óêàçàòåëü íà èìÿ ìîäóëÿ. hIcon = Skin_LoadProtoIcon((char*)lParam, SKINICON_STATUS_OFFLINE); - mir_sntprintf(text, TranslateT("%s status error (next retry (%d) in %d s)"), GetHumanName(lParam), retryCount + 1, currentDelay / 1000); + mir_snwprintf(text, TranslateT("%s status error (next retry (%d) in %d s)"), GetHumanName(lParam), retryCount + 1, currentDelay / 1000); } - else mir_sntprintf(text, TranslateT("Status error (next retry (%d) in %d s)"), retryCount + 1, currentDelay / 1000); + else mir_snwprintf(text, TranslateT("Status error (next retry (%d) in %d s)"), retryCount + 1, currentDelay / 1000); break; case KS_CONN_STATE_RETRY: // lParam = PROTOCOLSETTINGEX** @@ -932,22 +932,22 @@ static int ProcessPopup(int reason, LPARAM lParam) wchar_t protoInfoLine[512], protoInfo[MAX_SECONDLINE]; memset(protoInfoLine, '\0', sizeof(protoInfoLine)); memset(protoInfo, '\0', sizeof(protoInfo)); - mir_tstrcpy(protoInfo, L"\r\n"); + mir_wstrcpy(protoInfo, L"\r\n"); for (int i = 0; i < connectionSettings.getCount(); i++) { - if (mir_tstrlen(ps[i]->tszAccName) > 0 && mir_strlen(ps[i]->szName) > 0) { + if (mir_wstrlen(ps[i]->tszAccName) > 0 && mir_strlen(ps[i]->szName) > 0) { if (db_get_b(NULL, MODULENAME, SETTING_PUSHOWEXTRA, TRUE)) { - mir_sntprintf(protoInfoLine, TranslateT("%s\t(will be set to %s)\r\n"), ps[i]->tszAccName, pcli->pfnGetStatusModeDescription(ps[i]->status, 0)); - mir_tstrncat(protoInfo, protoInfoLine, _countof(protoInfo) - mir_tstrlen(protoInfo) - 1); + mir_snwprintf(protoInfoLine, TranslateT("%s\t(will be set to %s)\r\n"), ps[i]->tszAccName, pcli->pfnGetStatusModeDescription(ps[i]->status, 0)); + mir_wstrncat(protoInfo, protoInfoLine, _countof(protoInfo) - mir_wstrlen(protoInfo) - 1); } } } hIcon = Skin_LoadProtoIcon(ps[0]->szName, SKINICON_STATUS_OFFLINE); - rtrimt(protoInfo); + rtrimw(protoInfo); if (retryCount == (maxRetries - 1)) - mir_sntprintf(text, TranslateT("Resetting status... (last try (%d))%s"), retryCount + 1, protoInfo); + mir_snwprintf(text, TranslateT("Resetting status... (last try (%d))%s"), retryCount + 1, protoInfo); else - mir_sntprintf(text, TranslateT("Resetting status... (next retry (%d) in %d s)%s"), retryCount + 2, currentDelay / 1000, protoInfo); + mir_snwprintf(text, TranslateT("Resetting status... (next retry (%d) in %d s)%s"), retryCount + 2, currentDelay / 1000, protoInfo); } break; @@ -956,9 +956,9 @@ static int ProcessPopup(int reason, LPARAM lParam) return -1; if (retryCount == maxRetries - 1) - mir_sntprintf(text, TranslateT("No internet connection seems available... (last try (%d))"), retryCount + 1); + mir_snwprintf(text, TranslateT("No internet connection seems available... (last try (%d))"), retryCount + 1); else - mir_sntprintf(text, TranslateT("No internet connection seems available... (next retry (%d) in %d s)"), retryCount + 2, currentDelay / 1000); + mir_snwprintf(text, TranslateT("No internet connection seems available... (next retry (%d) in %d s)"), retryCount + 2, currentDelay / 1000); break; case KS_CONN_STATE_STOPPEDCHECKING: // lParam == BOOL succes @@ -967,9 +967,9 @@ static int ProcessPopup(int reason, LPARAM lParam) if (lParam) { hIcon = Skin_LoadIcon(SKINICON_STATUS_ONLINE); - mir_sntprintf(text, TranslateT("Status was set ok")); + mir_snwprintf(text, TranslateT("Status was set ok")); } - else mir_sntprintf(text, TranslateT("Giving up")); + else mir_snwprintf(text, TranslateT("Giving up")); break; } if (hIcon == NULL) diff --git a/plugins/StatusPlugins/StartupStatus/options.cpp b/plugins/StatusPlugins/StartupStatus/options.cpp index 389b7a4d66..31d8324e22 100644 --- a/plugins/StatusPlugins/StartupStatus/options.cpp +++ b/plugins/StatusPlugins/StartupStatus/options.cpp @@ -156,16 +156,16 @@ static wchar_t* GetLinkDescription(TSettingsList& protoSettings) result.Append(status);
}
- return mir_tstrndup(result, result.GetLength());
+ return mir_wstrndup(result, result.GetLength());
}
HRESULT CreateLink(TSettingsList& protoSettings)
{
wchar_t savePath[MAX_PATH];
if (SHGetSpecialFolderPath(NULL, savePath, 0x10, FALSE))
- wcsncat_s(savePath, SHORTCUT_FILENAME, _countof(savePath) - mir_tstrlen(savePath));
+ wcsncat_s(savePath, SHORTCUT_FILENAME, _countof(savePath) - mir_wstrlen(savePath));
else
- mir_sntprintf(savePath, L".\\%s", SHORTCUT_FILENAME);
+ mir_snwprintf(savePath, L".\\%s", SHORTCUT_FILENAME);
// Get a pointer to the IShellLink interface.
IShellLink *psl;
@@ -324,12 +324,12 @@ static INT_PTR CALLBACK StartupStatusOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wPa }
else {
wchar_t text[128];
- mir_sntprintf(text, TranslateT("size: %d x %d"),
+ mir_snwprintf(text, TranslateT("size: %d x %d"),
db_get_dw(NULL, MODULE_CLIST, SETTING_WIDTH, 0),
db_get_dw(NULL, MODULE_CLIST, SETTING_HEIGHT, 0));
SetDlgItemText(hwndDlg, IDC_CURWINSIZE, text);
- mir_sntprintf(text, TranslateT("loc: %d x %d"),
+ mir_snwprintf(text, TranslateT("loc: %d x %d"),
db_get_dw(NULL, MODULE_CLIST, SETTING_XPOS, 0),
db_get_dw(NULL, MODULE_CLIST, SETTING_YPOS, 0));
SetDlgItemText(hwndDlg, IDC_CURWINLOC, text);
@@ -529,9 +529,9 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP if ( GetProfile(i, ar) == -1) {
/* create an empty profile */
if (i == defProfile)
- ppo->tszName = mir_tstrdup( TranslateT("default"));
+ ppo->tszName = mir_wstrdup( TranslateT("default"));
else
- ppo->tszName = mir_tstrdup( TranslateT("unknown"));
+ ppo->tszName = mir_wstrdup( TranslateT("unknown"));
}
else {
for (int j=0; j < ar.getCount(); j++)
@@ -541,9 +541,9 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP ppo->tszName = db_get_tsa(NULL, MODULENAME, OptName(i, SETTING_PROFILENAME));
if (ppo->tszName == NULL) {
if (i == defProfile)
- ppo->tszName = mir_tstrdup( TranslateT("default"));
+ ppo->tszName = mir_wstrdup( TranslateT("default"));
else
- ppo->tszName = mir_tstrdup( TranslateT("unknown"));
+ ppo->tszName = mir_wstrdup( TranslateT("unknown"));
}
ppo->createTtb = db_get_b(NULL, MODULENAME, OptName(i, SETTING_CREATETTBBUTTON), 0);
ppo->showDialog = db_get_b(NULL, MODULENAME, OptName(i, SETTING_SHOWCONFIRMDIALOG), 0);
@@ -665,7 +665,7 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP break;
PROFILEOPTIONS* ppo = new PROFILEOPTIONS;
- ppo->tszName = mir_tstrdup(tszName);
+ ppo->tszName = mir_wstrdup(tszName);
ppo->ps = GetCurrentProtoSettings();
arProfiles.insert(ppo);
diff --git a/plugins/StatusPlugins/StartupStatus/profiles.cpp b/plugins/StatusPlugins/StartupStatus/profiles.cpp index d370e53999..6cb631e3cb 100644 --- a/plugins/StatusPlugins/StartupStatus/profiles.cpp +++ b/plugins/StatusPlugins/StartupStatus/profiles.cpp @@ -139,9 +139,9 @@ wchar_t *GetStatusMessage(int profile, char *szProto) if ((pce[i].profile == profile) && (!mir_strcmp(pce[i].szProto, szProto))) { mir_snprintf(dbSetting, "%d_%s_%s", profile, szProto, SETTING_PROFILE_STSMSG); if (!db_get_ts(NULL, MODULENAME, dbSetting, &dbv)) { // reload from db - pce[i].msg = (wchar_t*)realloc(pce[i].msg, sizeof(wchar_t)*(mir_tstrlen(dbv.ptszVal) + 1)); + pce[i].msg = (wchar_t*)realloc(pce[i].msg, sizeof(wchar_t)*(mir_wstrlen(dbv.ptszVal) + 1)); if (pce[i].msg != NULL) { - mir_tstrcpy(pce[i].msg, dbv.ptszVal); + mir_wstrcpy(pce[i].msg, dbv.ptszVal); } db_free(&dbv); } diff --git a/plugins/StatusPlugins/commonstatus.cpp b/plugins/StatusPlugins/commonstatus.cpp index 19411d9938..c04f8ab085 100644 --- a/plugins/StatusPlugins/commonstatus.cpp +++ b/plugins/StatusPlugins/commonstatus.cpp @@ -117,7 +117,7 @@ wchar_t* GetDefaultStatusMessage(PROTOCOLSETTINGEX *ps, int newstatus) {
if (ps->szMsg != NULL) {// custom message set
log_infoA("CommonStatus: Status message set by calling plugin");
- return mir_tstrdup(ps->szMsg);
+ return mir_wstrdup(ps->szMsg);
}
wchar_t *tMsg = (wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGT, newstatus, (LPARAM)ps->szName);
@@ -184,10 +184,10 @@ static void SetStatusMsg(PROTOCOLSETTINGEX *ps, int newstatus) else
continue;
- if (mir_tstrlen(substituteStr) > 6)
- tszMsg = (wchar_t*)mir_realloc(tszMsg, sizeof(wchar_t)*(mir_tstrlen(tszMsg) + 1 + mir_tstrlen(substituteStr) - 6));
- memmove(tszMsg + j + mir_tstrlen(substituteStr), tszMsg + j + 6, sizeof(wchar_t)*(mir_tstrlen(tszMsg) - j - 5));
- memcpy(tszMsg + j, substituteStr, sizeof(wchar_t)*mir_tstrlen(substituteStr));
+ if (mir_wstrlen(substituteStr) > 6)
+ tszMsg = (wchar_t*)mir_realloc(tszMsg, sizeof(wchar_t)*(mir_wstrlen(tszMsg) + 1 + mir_wstrlen(substituteStr) - 6));
+ memmove(tszMsg + j + mir_wstrlen(substituteStr), tszMsg + j + 6, sizeof(wchar_t)*(mir_wstrlen(tszMsg) - j - 5));
+ memcpy(tszMsg + j, substituteStr, sizeof(wchar_t)*mir_wstrlen(substituteStr));
}
wchar_t *szFormattedMsg = variables_parsedup(tszMsg, ps->tszAccName, NULL);
diff --git a/plugins/StatusPlugins/confirmdialog.cpp b/plugins/StatusPlugins/confirmdialog.cpp index 34b82714a8..e19b1d0a55 100644 --- a/plugins/StatusPlugins/confirmdialog.cpp +++ b/plugins/StatusPlugins/confirmdialog.cpp @@ -69,7 +69,7 @@ static INT_PTR CALLBACK StatusMessageDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar {
wchar_t desc[512];
- mir_sntprintf(desc, TranslateT("Set %s message for %s."),
+ mir_snwprintf(desc, TranslateT("Set %s message for %s."),
pcli->pfnGetStatusModeDescription(GetActualStatus(protoSetting), 0), protoSetting->tszAccName);
SetDlgItemText(hwndDlg, IDC_DESCRIPTION, desc);
}
@@ -127,11 +127,11 @@ static int SetStatusList(HWND hwndDlg) wchar_t* status = pcli->pfnGetStatusModeDescription(actualStatus, 0);
switch ((*confirmSettings)[i].status) {
case ID_STATUS_LAST:
- mir_sntprintf(buf, L"%s (%s)", TranslateT("<last>"), status);
+ mir_snwprintf(buf, L"%s (%s)", TranslateT("<last>"), status);
ListView_SetItemText(hList, lvItem.iItem, 1, buf);
break;
case ID_STATUS_CURRENT:
- mir_sntprintf(buf, L"%s (%s)", TranslateT("<current>"), status);
+ mir_snwprintf(buf, L"%s (%s)", TranslateT("<current>"), status);
ListView_SetItemText(hList, lvItem.iItem, 1, buf);
break;
default:
@@ -210,7 +210,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP // start timer
if (timeOut > 0) {
wchar_t text[32];
- mir_sntprintf(text, TranslateT("Closing in %d"), timeOut);
+ mir_snwprintf(text, TranslateT("Closing in %d"), timeOut);
SetDlgItemText(hwndDlg, IDC_CLOSE, text);
SetTimer(hwndDlg, TIMER_ID, 1000, NULL);
}
@@ -219,7 +219,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_TIMER:
{
wchar_t text[32];
- mir_sntprintf(text, TranslateT("Closing in %d"), timeOut - 1);
+ mir_snwprintf(text, TranslateT("Closing in %d"), timeOut - 1);
SetDlgItemText(hwndDlg, IDC_CLOSE, text);
if (timeOut <= 0) {
KillTimer(hwndDlg, TIMER_ID);
@@ -269,7 +269,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP // LAST STATUS
if (proto->status == ID_STATUS_LAST) {
wchar_t last[80];
- mir_sntprintf(last, L"%s (%s)", TranslateT("<last>"), pcli->pfnGetStatusModeDescription(proto->lastStatus, 0));
+ mir_snwprintf(last, L"%s (%s)", TranslateT("<last>"), pcli->pfnGetStatusModeDescription(proto->lastStatus, 0));
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_STARTUPLIST), lvItem.iItem, 1, last);
actualStatus = proto->lastStatus;
}
@@ -278,7 +278,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP else if (proto->status == ID_STATUS_CURRENT) {
int currentStatus = CallProtoService(proto->szName, PS_GETSTATUS, 0, 0);
wchar_t current[80];
- mir_sntprintf(current, L"%s (%s)", TranslateT("<current>"), pcli->pfnGetStatusModeDescription(currentStatus, 0));
+ mir_snwprintf(current, L"%s (%s)", TranslateT("<current>"), pcli->pfnGetStatusModeDescription(currentStatus, 0));
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_STARTUPLIST), lvItem.iItem, 1, current);
actualStatus = currentStatus;
}
@@ -344,7 +344,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP // last
wchar_t buf[100];
- mir_sntprintf(buf, L"%s (%s)", TranslateT("<last>"), pcli->pfnGetStatusModeDescription(proto->lastStatus, 0));
+ mir_snwprintf(buf, L"%s (%s)", TranslateT("<last>"), pcli->pfnGetStatusModeDescription(proto->lastStatus, 0));
int item = SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_ADDSTRING, 0, (LPARAM)buf);
SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_SETITEMDATA, item, ID_STATUS_LAST);
if (proto->status == ID_STATUS_LAST) {
@@ -354,7 +354,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP // current
int currentStatus = CallProtoService(proto->szName, PS_GETSTATUS, 0, 0);
- mir_sntprintf(buf, L"%s (%s)", TranslateT("<current>"), pcli->pfnGetStatusModeDescription(currentStatus, 0));
+ mir_snwprintf(buf, L"%s (%s)", TranslateT("<current>"), pcli->pfnGetStatusModeDescription(currentStatus, 0));
item = SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_ADDSTRING, 0, (LPARAM)buf);
SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_SETITEMDATA, item, ID_STATUS_CURRENT);
if (proto->status == ID_STATUS_CURRENT) {
diff --git a/plugins/StopSpamMod/src/stopspam.cpp b/plugins/StopSpamMod/src/stopspam.cpp index c5cc135954..3f5311b9ad 100755 --- a/plugins/StopSpamMod/src/stopspam.cpp +++ b/plugins/StopSpamMod/src/stopspam.cpp @@ -143,7 +143,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) } } else if (!gbRegexMatch) - answered = gbCaseInsensitive ? (!Stricmp(message.c_str(), (variables_parse(gbAnswer, hContact).c_str()))) : (!mir_tstrcmp(message.c_str(), (variables_parse(gbAnswer, hContact).c_str()))); + answered = gbCaseInsensitive ? (!Stricmp(message.c_str(), (variables_parse(gbAnswer, hContact).c_str()))) : (!mir_wstrcmp(message.c_str(), (variables_parse(gbAnswer, hContact).c_str()))); else { if (gbCaseInsensitive) { std::string check(toUTF8(variables_parse(gbAnswer, hContact))), msg(toUTF8(message)); diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp index e2fa1253d1..bb2086b078 100755 --- a/plugins/StopSpamMod/src/utilities.cpp +++ b/plugins/StopSpamMod/src/utilities.cpp @@ -109,9 +109,9 @@ wstring variables_parse(wstring const &tstrFormat, MCONTACT hContact) return tstrFormat;
}
-// case-insensitive mir_tstrcmp
+// case-insensitive mir_wstrcmp
//by nullbie as i remember...
-#define NEWTSTR_MALLOC(A) (A==NULL) ? NULL : mir_tstrcpy((wchar_t*)mir_alloc(sizeof(wchar_t)*(mir_tstrlen(A)+1)),A)
+#define NEWTSTR_MALLOC(A) (A==NULL) ? NULL : mir_wstrcpy((wchar_t*)mir_alloc(sizeof(wchar_t)*(mir_wstrlen(A)+1)),A)
const int Stricmp(const wchar_t *str, const wchar_t *substr)
{
int i = 0;
@@ -119,10 +119,10 @@ const int Stricmp(const wchar_t *str, const wchar_t *substr) wchar_t *str_up = NEWTSTR_MALLOC(str);
wchar_t *substr_up = NEWTSTR_MALLOC(substr);
- CharUpperBuff(str_up, (int)mir_tstrlen(str_up));
- CharUpperBuff(substr_up, (int)mir_tstrlen(substr_up));
+ CharUpperBuff(str_up, (int)mir_wstrlen(str_up));
+ CharUpperBuff(substr_up, (int)mir_wstrlen(substr_up));
- i = mir_tstrcmp(str_up, substr_up);
+ i = mir_wstrcmp(str_up, substr_up);
mir_free(str_up);
mir_free(substr_up);
@@ -175,9 +175,9 @@ BOOL IsUrlContains(wchar_t * Str) L".tv"
};
- if (Str && mir_tstrlen(Str) > 0) {
+ if (Str && mir_wstrlen(Str) > 0) {
wchar_t *StrLower = NEWTSTR_MALLOC(Str);
- CharLowerBuff(StrLower, (int)mir_tstrlen(StrLower));
+ CharLowerBuff(StrLower, (int)mir_wstrlen(StrLower));
for (int i = 0; i < CountUrl; i++)
if (wcsstr(StrLower, URL[i])) {
mir_free(StrLower);
@@ -191,7 +191,7 @@ BOOL IsUrlContains(wchar_t * Str) wstring GetContactUid(MCONTACT hContact, wstring Protocol)
{
char *szProto = mir_utf8encodeW(Protocol.c_str());
- ptrT uid(Contact_GetInfo(CNF_DISPLAYUID, hContact, szProto));
+ ptrW uid(Contact_GetInfo(CNF_DISPLAYUID, hContact, szProto));
return (uid) ? uid : L"";
}
@@ -206,7 +206,7 @@ void LogSpamToFile(MCONTACT hContact, wstring message) if (hStopSpamLogDirH)
FoldersGetCustomPathT(hStopSpamLogDirH, pszName, MAX_PATH, L"");
else
- mir_tstrncpy(pszName, VARST(L"%miranda_logpath%"), _countof(pszName));
+ mir_wstrncpy(pszName, VARST(L"%miranda_logpath%"), _countof(pszName));
wstring filename = pszName;
filename += L"\\stopspam_mod.log";
diff --git a/plugins/StopSpamPlus/src/events.cpp b/plugins/StopSpamPlus/src/events.cpp index a4996d034a..d7965d04db 100644 --- a/plugins/StopSpamPlus/src/events.cpp +++ b/plugins/StopSpamPlus/src/events.cpp @@ -107,7 +107,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) // if answer not empty
if (answer.length() > 0) {
// if message equal right answer...
- if (plSets->AnswNotCaseSens.Get() ? !mir_tstrcmpi(message.c_str(), answer.c_str()) : !mir_tstrcmp(message.c_str(), answer.c_str())) {
+ if (plSets->AnswNotCaseSens.Get() ? !mir_wstrcmpi(message.c_str(), answer.c_str()) : !mir_wstrcmp(message.c_str(), answer.c_str())) {
// unhide contact
db_unset(hContact, "CList", "Hidden");
diff --git a/plugins/StopSpamPlus/src/services.cpp b/plugins/StopSpamPlus/src/services.cpp index 5026af7098..3d022a2ba8 100644 --- a/plugins/StopSpamPlus/src/services.cpp +++ b/plugins/StopSpamPlus/src/services.cpp @@ -25,7 +25,7 @@ INT_PTR RemoveTempContacts(WPARAM, LPARAM lParam) {
for (MCONTACT hContact = db_find_first(); hContact;) {
MCONTACT hNext = db_find_next(hContact);
- ptrT szGroup(db_get_tsa(hContact, "CList", "Group"));
+ ptrW szGroup(db_get_tsa(hContact, "CList", "Group"));
if (db_get_b(hContact, "CList", "NotOnList", 0) || (szGroup != NULL && (wcsstr(szGroup, L"Not In List") || wcsstr(szGroup, TranslateT("Not In List"))))) {
char *szProto = GetContactProto(hContact);
diff --git a/plugins/TabSRMM/src/TSButton.cpp b/plugins/TabSRMM/src/TSButton.cpp index 673ad7d5a2..443039eba6 100644 --- a/plugins/TabSRMM/src/TSButton.cpp +++ b/plugins/TabSRMM/src/TSButton.cpp @@ -291,7 +291,7 @@ static void PaintWorker(TSButtonCtrl *ctl, HDC hdcPaint) }
SIZE sz;
- GetTextExtentPoint32(hdcMem, szText, (int)mir_tstrlen(szText), &sz);
+ GetTextExtentPoint32(hdcMem, szText, (int)mir_wstrlen(szText), &sz);
if (ctl->cHot) {
SIZE szHot;
GetTextExtentPoint32A(hdcMem, "&", 1, &szHot);
@@ -300,7 +300,7 @@ static void PaintWorker(TSButtonCtrl *ctl, HDC hdcPaint) if (ctl->arrow)
DrawState(hdcMem, NULL, NULL, (LPARAM)ctl->arrow, 0, rcClient.right - rcClient.left - 5 - PluginConfig.m_smcxicon + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), (rcClient.bottom - rcClient.top) / 2 - PluginConfig.m_smcyicon / 2 + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, IsWindowEnabled(ctl->hwnd) ? DST_ICON : DST_ICON | DSS_DISABLED);
SelectObject(hdcMem, ctl->hFont);
- DrawState(hdcMem, NULL, NULL, (LPARAM)szText, mir_tstrlen(szText), (rcText.right - rcText.left - sz.cx) / 2 + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), ctl->hThemeButton ? (rcText.bottom - rcText.top - sz.cy) / 2 : (rcText.bottom - rcText.top - sz.cy) / 2 - (ctl->stateId == PBS_PRESSED ? 0 : 1), sz.cx, sz.cy, IsWindowEnabled(ctl->hwnd) || ctl->hThemeButton ? DST_PREFIXTEXT | DSS_NORMAL : DST_PREFIXTEXT | DSS_DISABLED);
+ DrawState(hdcMem, NULL, NULL, (LPARAM)szText, mir_wstrlen(szText), (rcText.right - rcText.left - sz.cx) / 2 + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), ctl->hThemeButton ? (rcText.bottom - rcText.top - sz.cy) / 2 : (rcText.bottom - rcText.top - sz.cy) / 2 - (ctl->stateId == PBS_PRESSED ? 0 : 1), sz.cx, sz.cy, IsWindowEnabled(ctl->hwnd) || ctl->hThemeButton ? DST_PREFIXTEXT | DSS_NORMAL : DST_PREFIXTEXT | DSS_DISABLED);
SelectObject(hdcMem, hOldFont);
}
diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index 2e2561c2c2..b7116265d1 100644 --- a/plugins/TabSRMM/src/buttonsbar.cpp +++ b/plugins/TabSRMM/src/buttonsbar.cpp @@ -121,7 +121,7 @@ static INT_PTR CB_AddButton(WPARAM, LPARAM lParam) if (bbdi->bbbFlags & BBBF_ANSITOOLTIP) cbd->m_ptszTooltip = mir_a2u(bbdi->pszTooltip); else - cbd->m_ptszTooltip = mir_tstrdup(bbdi->ptszTooltip); + cbd->m_ptszTooltip = mir_wstrdup(bbdi->ptszTooltip); } else cbd->m_ptszTooltip = NULL; @@ -314,7 +314,7 @@ static INT_PTR CB_ModifyButton(WPARAM, LPARAM lParam) if (bbdi->bbbFlags & BBBF_ANSITOOLTIP) cbd->m_ptszTooltip = mir_a2u(bbdi->pszTooltip); else - cbd->m_ptszTooltip = mir_tstrdup(bbdi->ptszTooltip); + cbd->m_ptszTooltip = mir_wstrdup(bbdi->ptszTooltip); } if (bbdi->hIcon) cbd->m_hIcon = bbdi->hIcon; @@ -369,7 +369,7 @@ static int SaveTree(HWND hToolBarTree) while (tvi.hItem != NULL) { TreeView_GetItem(hToolBarTree, &tvi); - if (mir_tstrcmp(tvi.pszText, MIDDLE_SEPARATOR) == 0) { + if (mir_wstrcmp(tvi.pszText, MIDDLE_SEPARATOR) == 0) { RSide = true; count = TreeView_GetCount(hToolBarTree) * 10 - count; tvi.hItem = TreeView_GetNextSibling(hToolBarTree, tvi.hItem); @@ -708,7 +708,7 @@ INT_PTR CALLBACK DlgProcToolBar(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l tvi.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_PARAM; TreeView_GetItem(hToolBarTree, &tvi); - if (tvi.lParam == 0 || !TreeView_GetCheckState(hToolBarTree, tvi.hItem) || !mir_tstrcmp(tvi.pszText, MIDDLE_SEPARATOR)) + if (tvi.lParam == 0 || !TreeView_GetCheckState(hToolBarTree, tvi.hItem) || !mir_wstrcmp(tvi.pszText, MIDDLE_SEPARATOR)) break; CustomButtonData *cbd = (CustomButtonData*)tvi.lParam; @@ -736,7 +736,7 @@ INT_PTR CALLBACK DlgProcToolBar(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l tvi.hItem = hItem; TreeView_GetItem(hToolBarTree, &tvi); - if (!TreeView_GetCheckState(hToolBarTree, tvi.hItem) || !mir_tstrcmp(tvi.pszText, MIDDLE_SEPARATOR)) { + if (!TreeView_GetCheckState(hToolBarTree, tvi.hItem) || !mir_wstrcmp(tvi.pszText, MIDDLE_SEPARATOR)) { Utils::enableDlgControl(hwndDlg, IDC_IMCHECK, false); Utils::enableDlgControl(hwndDlg, IDC_CHATCHECK, false); Utils::enableDlgControl(hwndDlg, IDC_CANBEHIDDEN, false); diff --git a/plugins/TabSRMM/src/chat/log.cpp b/plugins/TabSRMM/src/chat/log.cpp index 09b240c6aa..3cec3e01bb 100644 --- a/plugins/TabSRMM/src/chat/log.cpp +++ b/plugins/TabSRMM/src/chat/log.cpp @@ -81,7 +81,7 @@ static int Log_AppendIEView(LOGSTREAMDATA* streamData, BOOL simpleMode, wchar_t MODULEINFO *mi = pci->MM_FindModule(streamData->si->pszModule);
va_start(va, fmt);
- lineLen = mir_vsntprintf(line, 8000, fmt, va);
+ lineLen = mir_vsnwprintf(line, 8000, fmt, va);
if (lineLen < 0)
return 0;
line[lineLen] = 0;
@@ -115,7 +115,7 @@ static int Log_AppendIEView(LOGSTREAMDATA* streamData, BOOL simpleMode, wchar_t szTemp3[1] = line[2];
szTemp3[2] = '\0';
col = _wtoi(szTemp3);
- mir_sntprintf(szTemp, L"%%%c#%02X%02X%02X", c, GetRValue(mi->crColors[col]), GetGValue(mi->crColors[col]), GetBValue(mi->crColors[col]));
+ mir_snwprintf(szTemp, L"%%%c#%02X%02X%02X", c, GetRValue(mi->crColors[col]), GetGValue(mi->crColors[col]), GetBValue(mi->crColors[col]));
}
}
line += 2;
@@ -123,7 +123,7 @@ static int Log_AppendIEView(LOGSTREAMDATA* streamData, BOOL simpleMode, wchar_t case 'C':
case 'F':
if (!g_Settings.bStripFormat && !streamData->bStripFormat) {
- mir_sntprintf(szTemp, L"%%%c", *line);
+ mir_snwprintf(szTemp, L"%%%c", *line);
}
break;
case 'b':
@@ -134,13 +134,13 @@ static int Log_AppendIEView(LOGSTREAMDATA* streamData, BOOL simpleMode, wchar_t case 'I':
case 'r':
if (!streamData->bStripFormat) {
- mir_sntprintf(szTemp, L"%%%c", *line);
+ mir_snwprintf(szTemp, L"%%%c", *line);
}
break;
}
if (szTemp[0]) {
- size_t iLen = mir_tstrlen(szTemp);
+ size_t iLen = mir_wstrlen(szTemp);
memcpy(d, szTemp, iLen * sizeof(wchar_t));
d += iLen;
}
@@ -429,7 +429,7 @@ static void Log_AppendRTF(LOGSTREAMDATA *streamData, BOOL simpleMode, CMStringA va_list va;
va_start(va, fmt);
- int lineLen = mir_vsntprintf(line, 8000, fmt, va);
+ int lineLen = mir_vsnwprintf(line, 8000, fmt, va);
if (lineLen < 0)
lineLen = 8000;
line[lineLen] = 0;
@@ -530,19 +530,19 @@ static void AddEventToBuffer(CMStringA &str, LOGSTREAMDATA *streamData) return;
if (streamData->lin->ptszNick) {
- if (g_Settings.bLogLimitNames && mir_tstrlen(streamData->lin->ptszNick) > 20) {
+ if (g_Settings.bLogLimitNames && mir_wstrlen(streamData->lin->ptszNick) > 20) {
wcsncpy_s(szTemp, 20, streamData->lin->ptszNick, _TRUNCATE);
wcsncpy_s(szTemp + 20, 4, L"...", _TRUNCATE);
}
else wcsncpy_s(szTemp, streamData->lin->ptszNick, _TRUNCATE);
if (g_Settings.bClickableNicks)
- mir_sntprintf(szTemp2, L"~~++#%s#++~~", szTemp);
+ mir_snwprintf(szTemp2, L"~~++#%s#++~~", szTemp);
else
wcsncpy_s(szTemp2, szTemp, _TRUNCATE);
if (streamData->lin->ptszUserInfo && streamData->lin->iType != GC_EVENT_TOPIC)
- 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;
@@ -774,7 +774,7 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData) wcsncpy_s(szTimeStamp, pci->MakeTimeStamp(g_Settings.pszTimeStamp, lin->time), _TRUNCATE);
wcsncpy_s(szOldTimeStamp, pci->MakeTimeStamp(g_Settings.pszTimeStamp, streamData->si->LastTime), _TRUNCATE);
- if (!g_Settings.bShowTimeIfChanged || streamData->si->LastTime == 0 || mir_tstrcmp(szTimeStamp, szOldTimeStamp)) {
+ if (!g_Settings.bShowTimeIfChanged || streamData->si->LastTime == 0 || mir_wstrcmp(szTimeStamp, szOldTimeStamp)) {
streamData->si->LastTime = lin->time;
Log_AppendRTF(streamData, TRUE, str, L"%s", szTimeStamp);
}
@@ -985,7 +985,7 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, bool bRedra // this uses hidden marks in the rich text to find the events which should be deleted
if (si->bTrimmed) {
wchar_t szPattern[50];
- mir_sntprintf(szPattern, L"~-+%d+-~", si->pLogEnd);
+ mir_snwprintf(szPattern, L"~-+%d+-~", si->pLogEnd);
FINDTEXTEX fi;
fi.lpstrText = szPattern;
diff --git a/plugins/TabSRMM/src/chat/main.cpp b/plugins/TabSRMM/src/chat/main.cpp index 61859eab96..0694e9f815 100644 --- a/plugins/TabSRMM/src/chat/main.cpp +++ b/plugins/TabSRMM/src/chat/main.cpp @@ -156,7 +156,7 @@ static void OnLoadSettings() g_Settings.bNewLineAfterNames = M.GetBool(CHAT_MODULE, "NewlineAfterNames", false);
g_Settings.bUseCommaAsColon = M.GetBool(CHAT_MODULE, "UseCommaAsColon", false);
- replaceStrT(g_Settings.pszLogDir, M.getChatLogPath());
+ replaceStrW(g_Settings.pszLogDir, M.getChatLogPath());
g_Settings.LogIconSize = (g_Settings.bScaleIcons) ? 12 : 16;
diff --git a/plugins/TabSRMM/src/chat/manager.cpp b/plugins/TabSRMM/src/chat/manager.cpp index 014b238b05..2b5143465c 100644 --- a/plugins/TabSRMM/src/chat/manager.cpp +++ b/plugins/TabSRMM/src/chat/manager.cpp @@ -41,7 +41,7 @@ static int sttCompareNicknames(const wchar_t *s1, const wchar_t *s2) if (*s1 && !*s2) return -1;
// compare tails
- return mir_tstrcmpi(s1, s2);
+ return mir_wstrcmpi(s1, s2);
}
int UM_CompareItem(USERINFO *u1, const wchar_t* pszNick, WORD wStatus)
@@ -58,7 +58,7 @@ int UM_CompareItem(USERINFO *u1, const wchar_t* pszNick, WORD wStatus) if (g_Settings.bAlternativeSorting)
return sttCompareNicknames(u1->pszNick, pszNick);
else
- return mir_tstrcmp(u1->pszNick, pszNick);
+ return mir_wstrcmp(u1->pszNick, pszNick);
}
dw1 = dw1 >> 1;
dw2 = dw2 >> 1;
@@ -66,7 +66,7 @@ int UM_CompareItem(USERINFO *u1, const wchar_t* pszNick, WORD wStatus) if (g_Settings.bAlternativeSorting)
return sttCompareNicknames(u1->pszNick, pszNick);
- return mir_tstrcmp(u1->pszNick, pszNick);
+ return mir_wstrcmp(u1->pszNick, pszNick);
}
//---------------------------------------------------
@@ -121,7 +121,7 @@ SESSION_INFO* SM_FindSessionAutoComplete(const char* pszModule, SESSION_INFO* cu for (SESSION_INFO *si = pci->wndList; si; si = si->next)
if (si != currSession && !mir_strcmpi(pszModule, si->pszModule))
if (my_strstri(si->ptszName, pszOriginal) == si->ptszName)
- if (prevSession != si && mir_tstrcmpi(si->ptszName, pszCurrent) > 0 && (!pszName || mir_tstrcmpi(si->ptszName, pszName) < 0)) {
+ if (prevSession != si && mir_wstrcmpi(si->ptszName, pszCurrent) > 0 && (!pszName || mir_wstrcmpi(si->ptszName, pszName) < 0)) {
pResult = si;
pszName = si->ptszName;
}
diff --git a/plugins/TabSRMM/src/chat/muchighlight.cpp b/plugins/TabSRMM/src/chat/muchighlight.cpp index 0ec60454ff..e6a00d5784 100644 --- a/plugins/TabSRMM/src/chat/muchighlight.cpp +++ b/plugins/TabSRMM/src/chat/muchighlight.cpp @@ -151,7 +151,7 @@ int CMUCHighlight::match(const GCEVENT *pgce, const SESSION_INFO *psi, DWORD dwF p1 = 0;
for (UINT i = 0; i < m_iTextPatterns && !result; i++)
- result = wildcmpt(p, m_TextPatterns[i]) ? MATCH_TEXT : 0;
+ result = wildcmpw(p, m_TextPatterns[i]) ? MATCH_TEXT : 0;
if (p1) {
*p1 = ' ';
@@ -167,9 +167,9 @@ skip_textpatterns: if ((m_dwFlags & MATCH_NICKNAME) && (dwFlags & MATCH_NICKNAME) && pgce->ptszNick && m_iNickPatterns > 0) {
for (UINT i = 0; i < m_iNickPatterns && !nResult; i++) {
if (pgce->ptszNick)
- nResult = wildcmpt(pgce->ptszNick, m_NickPatterns[i]) ? MATCH_NICKNAME : 0;
+ nResult = wildcmpw(pgce->ptszNick, m_NickPatterns[i]) ? MATCH_NICKNAME : 0;
if ((m_dwFlags & MATCH_UIN) && pgce->ptszUserInfo)
- nResult = wildcmpt(pgce->ptszUserInfo, m_NickPatterns[i]) ? MATCH_NICKNAME : 0;
+ nResult = wildcmpw(pgce->ptszUserInfo, m_NickPatterns[i]) ? MATCH_NICKNAME : 0;
}
}
@@ -300,7 +300,7 @@ INT_PTR CALLBACK CMUCHighlight::dlgProcAdd(HWND hwndDlg, UINT msg, WPARAM wParam Utils::showDlgControl(hwndDlg, IDC_ADDHIGHLIGHTEDITLIST, SW_HIDE);
::SetDlgItemText(hwndDlg, IDC_ADDHIGHLIGHTTITLE, TranslateT("Add user to highlight list"));
::SendDlgItemMessage(hwndDlg, IDC_ADDHIGHLIGHTNAME, CB_INSERTSTRING, -1, (LPARAM)the->ui->pszNick);
- if (mir_tstrcmp(the->ui->pszNick, the->ui->pszUID))
+ if (mir_wstrcmp(the->ui->pszNick, the->ui->pszUID))
::SendDlgItemMessage(hwndDlg, IDC_ADDHIGHLIGHTNAME, CB_INSERTSTRING, -1, (LPARAM)the->ui->pszUID);
::SendDlgItemMessage(hwndDlg, IDC_ADDHIGHLIGHTNAME, CB_SETCURSEL, 0, 0);
}
diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp index 79bfc11d83..65ee0a3dee 100644 --- a/plugins/TabSRMM/src/chat/options.cpp +++ b/plugins/TabSRMM/src/chat/options.cpp @@ -225,7 +225,7 @@ void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szM wcsncpy_s(lf->lfFaceName, L"Webdings", _TRUNCATE);
}
else {
- ptrT tszDefFace(db_get_tsa(NULL, szMod, str));
+ ptrW tszDefFace(db_get_tsa(NULL, szMod, str));
if (tszDefFace == NULL)
wcsncpy_s(lf->lfFaceName, fol[j].szDefFace, _TRUNCATE);
else
@@ -356,8 +356,8 @@ HICON LoadIconEx(char *pszIcoLibName) static void InitSetting(wchar_t* &ppPointer, const char *pszSetting, const wchar_t *pszDefault)
{
- ptrT val(db_get_tsa(NULL, CHAT_MODULE, pszSetting));
- replaceStrT(ppPointer, (val != NULL) ? val : pszDefault);
+ ptrW val(db_get_tsa(NULL, CHAT_MODULE, pszSetting));
+ replaceStrW(ppPointer, (val != NULL) ? val : pszDefault);
}
#define OPT_FIXHEADINGS (WM_USER+1)
@@ -691,7 +691,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM wchar_t tszTooltipText[2048];
- mir_sntprintf(tszTooltipText,
+ mir_snwprintf(tszTooltipText,
L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n\n"
L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n\n"
L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s",
@@ -757,12 +757,12 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM *p1 = 0;
wchar_t tszInitialDir[_MAX_DRIVE + _MAX_PATH + 10];
- mir_sntprintf(tszInitialDir, L"%s%s", M.getChatLogPath(), p);
+ mir_snwprintf(tszInitialDir, L"%s%s", M.getChatLogPath(), p);
if (!PathFileExists(tszInitialDir))
wcsncpy_s(tszInitialDir, M.getChatLogPath(), _TRUNCATE);
wchar_t tszReturnName[MAX_PATH]; tszReturnName[0] = 0;
- mir_sntprintf(tszTemp, L"%s%c*.*%c%c", TranslateT("All files"), 0, 0, 0);
+ mir_snwprintf(tszTemp, L"%s%c*.*%c%c", TranslateT("All files"), 0, 0, 0);
OPENFILENAME ofn = { 0 };
ofn.lpstrInitialDir = tszInitialDir;
@@ -795,11 +795,11 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM if (idList) {
const wchar_t *szUserDir = M.getUserDir();
SHGetPathFromIDList(idList, tszDirectory);
- mir_tstrcat(tszDirectory, L"\\");
+ mir_wstrcat(tszDirectory, L"\\");
wchar_t tszTemp[MAX_PATH];
PathToRelativeT(tszDirectory, tszTemp, szUserDir);
- SetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, mir_tstrlen(tszTemp) > 1 ? tszTemp : DEFLOGFILENAME);
+ SetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, mir_wstrlen(tszTemp) > 1 ? tszTemp : DEFLOGFILENAME);
}
psMalloc->Free(idList);
psMalloc->Release();
diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp index 4fd40eb4d2..6f318e40f6 100644 --- a/plugins/TabSRMM/src/chat/services.cpp +++ b/plugins/TabSRMM/src/chat/services.cpp @@ -37,7 +37,7 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateT if (hContact != 0 && M.GetByte("limittabs", 0) && !wcsncmp(pContainer->szName, L"default", 6)) {
if ((pContainer = FindMatchingContainer(L"default")) == NULL) {
wchar_t szName[CONTAINER_NAMELEN + 1];
- mir_sntprintf(szName, L"default");
+ mir_snwprintf(szName, L"default");
if ((pContainer = CreateContainer(szName, CNT_CREATEFLAG_CLONED, hContact)) == NULL)
return 0;
}
@@ -53,7 +53,7 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateT // cut nickname if larger than x chars...
wchar_t newcontactname[128];
- if (mir_tstrlen(contactName) > 0) {
+ if (mir_wstrlen(contactName) > 0) {
if (M.GetByte("cuttitle", 0))
CutContactName(contactName, newcontactname, _countof(newcontactname));
else
@@ -167,7 +167,7 @@ void ShowRoom(SESSION_INFO *si, WPARAM, BOOL) TContainerData *pContainer = si->pContainer;
if (pContainer == NULL) {
GetContainerNameForContact(si->hContact, szName, CONTAINER_NAMELEN);
- if (!g_Settings.bOpenInDefault && !mir_tstrcmp(szName, L"default"))
+ if (!g_Settings.bOpenInDefault && !mir_wstrcmp(szName, L"default"))
wcsncpy(szName, L"Chat Rooms", CONTAINER_NAMELEN);
szName[CONTAINER_NAMELEN] = 0;
pContainer = FindContainerByName(szName);
diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp index 274e4ab8a0..63f7f8134a 100644 --- a/plugins/TabSRMM/src/chat/tools.cpp +++ b/plugins/TabSRMM/src/chat/tools.cpp @@ -98,11 +98,11 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoNa va_list marker;
static wchar_t szBuf[4 * 1024];
- if (!fmt || mir_tstrlen(fmt) == 0 || mir_tstrlen(fmt) > 2000)
+ if (!fmt || mir_wstrlen(fmt) == 0 || mir_wstrlen(fmt) > 2000)
return 0;
va_start(marker, fmt);
- mir_vsntprintf(szBuf, _countof(szBuf), fmt, marker);
+ mir_vsnwprintf(szBuf, _countof(szBuf), fmt, marker);
va_end(marker);
pd.lchContact = hContact;
@@ -113,7 +113,7 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoNa pd.lchIcon = LoadIconEx("window");
PROTOACCOUNT *pa = Proto_GetAccount(pszProtoName);
- mir_sntprintf(pd.lptzContactName, L"%s - %s", (pa == NULL) ? _A2T(pszProtoName) : pa->tszAccountName, pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_snwprintf(pd.lptzContactName, L"%s - %s", (pa == NULL) ? _A2T(pszProtoName) : pa->tszAccountName, pcli->pfnGetContactDisplayName(hContact, 0));
wcsncpy_s(pd.lptzText, TranslateTS(szBuf), _TRUNCATE);
pd.iSeconds = g_Settings.iPopupTimeout;
@@ -532,7 +532,7 @@ UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO if (pszWordText && pszWordText[0]) {
wchar_t szMenuText[4096];
- mir_sntprintf(szMenuText, TranslateT("Look up '%s':"), pszWordText);
+ mir_snwprintf(szMenuText, TranslateT("Look up '%s':"), pszWordText);
ModifyMenu(*hMenu, 4, MF_STRING | MF_BYPOSITION, 4, szMenuText);
}
else ModifyMenu(*hMenu, 4, MF_STRING | MF_GRAYED | MF_BYPOSITION, 4, TranslateT("No word to look up"));
@@ -541,11 +541,11 @@ UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO else if (iIndex == 0) {
wchar_t szTemp[50];
if (pszWordText)
- mir_sntprintf(szTemp, TranslateT("&Message %s"), pszWordText);
+ mir_snwprintf(szTemp, TranslateT("&Message %s"), pszWordText);
else
wcsncpy_s(szTemp, TranslateT("&Message"), _TRUNCATE);
- if (mir_tstrlen(szTemp) > 40)
+ if (mir_wstrlen(szTemp) > 40)
wcsncpy_s(szTemp + 40, 4, L"...", _TRUNCATE);
ModifyMenu(*hMenu, ID_MESS, MF_STRING | MF_BYCOMMAND, ID_MESS, szTemp);
gcmi.Type = MENU_ON_NICKLIST;
@@ -658,7 +658,7 @@ char GetIndicator(SESSION_INFO *si, LPCTSTR ptszNick, int *iNickIndex) *iNickIndex = 0;
for (USERINFO *ui = si->pUsers; ui; ui = ui->next) {
- if (!mir_tstrcmp(ui->pszNick, ptszNick)) {
+ if (!mir_wstrcmp(ui->pszNick, ptszNick)) {
STATUSINFO *ti = pci->TM_FindStatus(si->pStatuses, pci->TM_WordToString(si->pStatuses, ui->Status));
if (ti && (INT_PTR)ti->hIcon < si->iStatusCount) {
if (iNickIndex)
@@ -685,10 +685,10 @@ BOOL IsHighlighted(SESSION_INFO *si, GCEVENT *gce) if (gce->ptszNick != NULL) {
dwMask |= CMUCHighlight::MATCH_NICKNAME;
if (si && g_Settings.bLogClassicIndicators) {
- size_t len = mir_tstrlen(gce->ptszNick) + 1;
+ size_t len = mir_wstrlen(gce->ptszNick) + 1;
wchar_t *tmp = (wchar_t*)_alloca(sizeof(wchar_t)*(len + 1));
*tmp = GetIndicator(si, gce->ptszNick, 0);
- mir_tstrcpy(tmp + 1, gce->ptszNick);
+ mir_wstrcpy(tmp + 1, gce->ptszNick);
evTmp.ptszNick = tmp;
}
}
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index cde016a19e..a38dfc6291 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -135,7 +135,7 @@ bool IsStringValidLink(wchar_t *pszText) if (pszText == NULL) return false; - if (mir_tstrlen(pszText) < 5 || wcschr(pszText, '"')) + if (mir_wstrlen(pszText) < 5 || wcschr(pszText, '"')) return false; if (towlower(pszText[0]) == 'w' && towlower(pszText[1]) == 'w' && towlower(pszText[2]) == 'w' && pszText[3] == '.' && iswalnum(pszText[4])) @@ -451,7 +451,7 @@ static bool TabAutoComplete(HWND hwnd, MESSAGESUBDATA *dat, SESSION_INFO *si) start -= 2; if (dat->szSearchResult != NULL) { - int cbResult = (int)mir_tstrlen(dat->szSearchResult); + int cbResult = (int)mir_wstrlen(dat->szSearchResult); if (start >= cbResult && !wcsnicmp(dat->szSearchResult, pszText + start - cbResult, cbResult)) { start -= cbResult; goto LBL_SkipEnd; @@ -475,8 +475,8 @@ LBL_SkipEnd: isTopic = TRUE; } if (dat->szSearchQuery == NULL) { - dat->szSearchQuery = mir_tstrndup(pszText + start, end - start); - dat->szSearchResult = mir_tstrdup(dat->szSearchQuery); + dat->szSearchQuery = mir_wstrndup(pszText + start, end - start); + dat->szSearchResult = mir_wstrdup(dat->szSearchQuery); dat->lastSession = NULL; } if (isTopic) @@ -488,12 +488,12 @@ LBL_SkipEnd: } else pszName = pci->UM_FindUserAutoComplete(si->pUsers, dat->szSearchQuery, dat->szSearchResult); - replaceStrT(dat->szSearchResult, NULL); + replaceStrW(dat->szSearchResult, NULL); if (pszName != NULL) { - dat->szSearchResult = mir_tstrdup(pszName); + dat->szSearchResult = mir_wstrdup(pszName); if (end != start) { - ptrT szReplace; + ptrW szReplace; if (!isRoom && !isTopic && g_Settings.bAddColonToAutoComplete && start == 0) { szReplace = (wchar_t*)mir_alloc((mir_wstrlen(pszName) + 4) * sizeof(wchar_t)); mir_wstrcpy(szReplace, pszName); @@ -510,7 +510,7 @@ LBL_SkipEnd: SendMessage(hwnd, EM_SETSEL, start, end); SendMessage(hwnd, EM_REPLACESEL, TRUE, (LPARAM)dat->szSearchQuery); } - replaceStrT(dat->szSearchQuery, NULL); + replaceStrW(dat->szSearchQuery, NULL); return false; } @@ -1321,7 +1321,7 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, SESSION_INFO *pa } if (tszBuf[0] == 0) - mir_sntprintf(tszBuf, L"%s: %s\r\n%s: %s\r\n%s: %s", + mir_snwprintf(tszBuf, L"%s: %s\r\n%s: %s\r\n%s: %s", TranslateT("Nickname"), ui1->pszNick, TranslateT("Unique ID"), ui1->pszUID, TranslateT("Status"), pci->TM_WordToString(parentdat->pStatuses, ui1->Status)); @@ -1452,18 +1452,18 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, break; } if (wParam == '\b' && si->szSearch[0]) // backspace - si->szSearch[mir_tstrlen(si->szSearch) - 1] = '\0'; + si->szSearch[mir_wstrlen(si->szSearch) - 1] = '\0'; else if (wParam < ' ') break; else { - if (mir_tstrlen(si->szSearch) >= _countof(si->szSearch) - 2) { + if (mir_wstrlen(si->szSearch) >= _countof(si->szSearch) - 2) { MessageBeep(MB_OK); break; } wchar_t szNew[2]; szNew[0] = (wchar_t)wParam; szNew[1] = '\0'; - mir_tstrcat(si->szSearch, szNew); + mir_wstrcat(si->szSearch, szNew); } if (si->szSearch[0]) { // iterate over the (sorted) list of nicknames and search for the @@ -1472,7 +1472,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, for (i = 0; i < iItems; i++) { USERINFO *ui = pci->UM_FindUserFromIndex(si->pUsers, i); if (ui) { - if (!wcsnicmp(ui->pszNick, si->szSearch, mir_tstrlen(si->szSearch))) { + if (!wcsnicmp(ui->pszNick, si->szSearch, mir_wstrlen(si->szSearch))) { SendMessage(hwnd, LB_SETSEL, FALSE, -1); SendMessage(hwnd, LB_SETSEL, TRUE, i); si->iSearchItem = i; @@ -1483,7 +1483,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, } if (i == iItems) { MessageBeep(MB_OK); - si->szSearch[mir_tstrlen(si->szSearch) - 1] = '\0'; + si->szSearch[mir_wstrlen(si->szSearch) - 1] = '\0'; return 0; } } @@ -1671,7 +1671,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, } } if (tszBuf[0] == 0) - mir_sntprintf(tszBuf, L"<b>%s:</b>\t%s\n<b>%s:</b>\t%s\n<b>%s:</b>\t%s", + mir_snwprintf(tszBuf, L"<b>%s:</b>\t%s\n<b>%s:</b>\t%s\n<b>%s:</b>\t%s", TranslateT("Nick"), ui1->pszNick, TranslateT("Unique ID"), ui1->pszUID, TranslateT("Status"), pci->TM_WordToString(parentdat->pStatuses, ui1->Status)); @@ -1890,7 +1890,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar dat->wStatus = si->wStatus; const wchar_t *szNick = dat->cache->getNick(); - if (mir_tstrlen(szNick) > 0) { + if (mir_wstrlen(szNick) > 0) { if (M.GetByte("cuttitle", 0)) CutContactName(szNick, dat->newtitle, _countof(dat->newtitle)); else @@ -1903,19 +1903,19 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar switch (si->iType) { case GCW_CHATROOM: hIcon = Skin_LoadProtoIcon(si->pszModule, (dat->wStatus <= ID_STATUS_OFFLINE) ? ID_STATUS_OFFLINE : dat->wStatus); - mir_sntprintf(szTemp, + mir_snwprintf(szTemp, (si->nUsersInNicklist == 1) ? TranslateT("%s: chat room (%u user%s)") : TranslateT("%s: chat room (%u users%s)"), szNick, si->nUsersInNicklist, si->bFilterEnabled ? TranslateT(", event filter active") : L""); break; case GCW_PRIVMESS: hIcon = Skin_LoadProtoIcon(si->pszModule, (dat->wStatus <= ID_STATUS_OFFLINE) ? ID_STATUS_OFFLINE : dat->wStatus); if (si->nUsersInNicklist == 1) - mir_sntprintf(szTemp, TranslateT("%s: message session"), szNick); + mir_snwprintf(szTemp, TranslateT("%s: message session"), szNick); else - mir_sntprintf(szTemp, TranslateT("%s: message session (%u users)"), szNick, si->nUsersInNicklist); + mir_snwprintf(szTemp, TranslateT("%s: message session (%u users)"), szNick, si->nUsersInNicklist); break; case GCW_SERVER: - mir_sntprintf(szTemp, L"%s: Server", szNick); + mir_snwprintf(szTemp, L"%s: Server", szNick); hIcon = LoadIconEx("window"); break; } @@ -1978,17 +1978,17 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar else if (diff > 59) { DWORD hours = diff / 60; DWORD minutes = diff % 60; - mir_sntprintf(mi->tszIdleMsg, TranslateT(", %d %s, %d %s idle"), hours, hours > 1 ? + mir_snwprintf(mi->tszIdleMsg, TranslateT(", %d %s, %d %s idle"), hours, hours > 1 ? TranslateT("hours") : TranslateT("hour"), minutes, minutes > 1 ? TranslateT("minutes") : TranslateT("minute")); } - else mir_sntprintf(mi->tszIdleMsg, TranslateT(", %d %s idle"), diff, diff > 1 ? TranslateT("minutes") : TranslateT("minute")); + else mir_snwprintf(mi->tszIdleMsg, TranslateT(", %d %s idle"), diff, diff > 1 ? TranslateT("minutes") : TranslateT("minute")); } - mir_sntprintf(szFinalStatusBarText, TranslateT("%s on %s%s"), dat->szMyNickname, mi->ptszModDispName, mi->tszIdleMsg); + mir_snwprintf(szFinalStatusBarText, TranslateT("%s on %s%s"), dat->szMyNickname, mi->ptszModDispName, mi->tszIdleMsg); } else { if (si->ptszStatusbarText) - mir_sntprintf(szFinalStatusBarText, L"%s %s", mi->ptszModDispName, si->ptszStatusbarText); + mir_snwprintf(szFinalStatusBarText, L"%s %s", mi->ptszModDispName, si->ptszStatusbarText); else wcsncpy_s(szFinalStatusBarText, mi->ptszModDispName, _TRUNCATE); } @@ -2213,16 +2213,16 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar SIZE sz; if (si->iSearchItem != -1 && si->iSearchItem == index && si->szSearch[0]) { COLORREF clr_orig = GetTextColor(dis->hDC); - GetTextExtentPoint32(dis->hDC, ui->pszNick, (int)mir_tstrlen(si->szSearch), &sz); + GetTextExtentPoint32(dis->hDC, ui->pszNick, (int)mir_wstrlen(si->szSearch), &sz); SetTextColor(dis->hDC, RGB(250, 250, 0)); - TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick, (int)mir_tstrlen(si->szSearch)); + TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick, (int)mir_wstrlen(si->szSearch)); SetTextColor(dis->hDC, clr_orig); x_offset += sz.cx; - TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick + mir_tstrlen(si->szSearch), int(mir_tstrlen(ui->pszNick) - mir_tstrlen(si->szSearch))); + TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick + mir_wstrlen(si->szSearch), int(mir_wstrlen(ui->pszNick) - mir_wstrlen(si->szSearch))); } else { - GetTextExtentPoint32(dis->hDC, ui->pszNick, (int)mir_tstrlen(ui->pszNick), &sz); - TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick, (int)mir_tstrlen(ui->pszNick)); + GetTextExtentPoint32(dis->hDC, ui->pszNick, (int)mir_wstrlen(ui->pszNick), &sz); + TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick, (int)mir_wstrlen(ui->pszNick)); SelectObject(dis->hDC, hOldFont); } return TRUE; @@ -2535,7 +2535,7 @@ LABEL_SHOWWINDOW: int iRes = SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_GETTEXTRANGE, 0, (LPARAM)&tr); if (iRes > 0) { - size_t iLen = mir_tstrlen(pszWord) - 1; + size_t iLen = mir_wstrlen(pszWord) - 1; while (strchr(szTrimString, pszWord[iLen])) { pszWord[iLen] = '\0'; iLen--; @@ -2655,7 +2655,7 @@ LABEL_SHOWWINDOW: HMENU hMenu = 0; USERINFO uiNew; for (USERINFO *ui = si->pUsers; ui; ui = ui->next) { - if (mir_tstrcmp(ui->pszNick, tr.lpstrText)) + if (mir_wstrcmp(ui->pszNick, tr.lpstrText)) continue; pt.x = (short)LOWORD(((ENLINK*)lParam)->lParam); @@ -2685,7 +2685,7 @@ LABEL_SHOWWINDOW: SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_EXGETSEL, 0, (LPARAM)&chr); wchar_t tszAplTmpl[] = L"%s:"; - size_t bufSize = mir_tstrlen(tr.lpstrText) + mir_tstrlen(tszAplTmpl) + 3; + size_t bufSize = mir_wstrlen(tr.lpstrText) + mir_wstrlen(tszAplTmpl) + 3; wchar_t *tszTmp = (wchar_t*)mir_alloc(bufSize * sizeof(wchar_t)), *tszAppeal = tszTmp; TEXTRANGE tr2; @@ -2697,12 +2697,12 @@ LABEL_SHOWWINDOW: SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_GETTEXTRANGE, 0, (LPARAM)&tr2); if (!iswspace(*tr2.lpstrText)) *tszTmp++ = ' '; - mir_tstrcpy(tszTmp, tr.lpstrText); + mir_wstrcpy(tszTmp, tr.lpstrText); } else // in the beginning of the message window - mir_sntprintf(tszAppeal, bufSize, tszAplTmpl, tr.lpstrText); + mir_snwprintf(tszAppeal, bufSize, tszAplTmpl, tr.lpstrText); - size_t st = mir_tstrlen(tszAppeal); + size_t st = mir_wstrlen(tszAppeal); if (chr.cpMax != -1) { tr2.chrg.cpMin = chr.cpMax; tr2.chrg.cpMax = chr.cpMax + 1; @@ -2824,7 +2824,7 @@ LABEL_SHOWWINDOW: ptrA pszRtf(Message_GetFromStream(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE))); pci->SM_AddCommand(si->ptszID, si->pszModule, pszRtf); - CMString ptszText(ptrT(mir_utf8decodeT(pszRtf))); + CMString ptszText(ptrW(mir_utf8decodeW(pszRtf))); if (ptszText.IsEmpty()) break; @@ -3203,7 +3203,7 @@ LABEL_SHOWWINDOW: case DM_CONTAINERSELECTED: { wchar_t *szNewName = (wchar_t*)lParam; - if (!mir_tstrcmp(szNewName, TranslateT("Default container"))) + if (!mir_wstrcmp(szNewName, TranslateT("Default container"))) szNewName = CGlobals::m_default_container_name; int iOldItems = TabCtrl_GetItemCount(hwndTab); if (!wcsncmp(dat->pContainer->szName, szNewName, CONTAINER_NAMELEN)) diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index b955bd2cb8..e9923d78b2 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -118,7 +118,7 @@ bool CContactCache::updateNick() bool fChanged = false; if (m_Valid) { wchar_t *tszNick = pcli->pfnGetContactDisplayName(getActiveContact(), 0); - if (tszNick && mir_tstrcmp(m_szNick, tszNick)) + if (tszNick && mir_wstrcmp(m_szNick, tszNick)) fChanged = true; wcsncpy_s(m_szNick, (tszNick ? tszNick : L"<undef>"), _TRUNCATE); } @@ -178,7 +178,7 @@ bool CContactCache::updateUIN() m_szUIN[0] = 0; if (m_Valid) { - ptrT uid(Contact_GetInfo(CNF_DISPLAYUID, getActiveContact(), getActiveProto())); + ptrW uid(Contact_GetInfo(CNF_DISPLAYUID, getActiveContact(), getActiveProto())); if (uid != NULL) wcsncpy_s(m_szUIN, uid, _TRUNCATE); } @@ -446,15 +446,15 @@ void CContactCache::updateStatusMsg(const char *szKey) if (m_szStatusMsg) mir_free(m_szStatusMsg); m_szStatusMsg = 0; - ptrT szStatus(db_get_tsa(hContact, "CList", "StatusMsg")); + ptrW szStatus(db_get_tsa(hContact, "CList", "StatusMsg")); if (szStatus != 0) - m_szStatusMsg = (mir_tstrlen(szStatus) > 0 ? getNormalizedStatusMsg(szStatus) : 0); + m_szStatusMsg = (mir_wstrlen(szStatus) > 0 ? getNormalizedStatusMsg(szStatus) : 0); } if (szKey == 0 || (szKey && !mir_strcmp("ListeningTo", szKey))) { if (m_ListeningInfo) mir_free(m_ListeningInfo); m_ListeningInfo = 0; - ptrT szListeningTo(db_get_tsa(hContact, cc->szProto, "ListeningTo")); + ptrW szListeningTo(db_get_tsa(hContact, cc->szProto, "ListeningTo")); if (szListeningTo != 0 && *szListeningTo) m_ListeningInfo = szListeningTo.detach(); } @@ -462,7 +462,7 @@ void CContactCache::updateStatusMsg(const char *szKey) if (m_xStatusMsg) mir_free(m_xStatusMsg); m_xStatusMsg = 0; - ptrT szXStatusMsg(db_get_tsa(hContact, cc->szProto, "XStatusMsg")); + ptrW szXStatusMsg(db_get_tsa(hContact, cc->szProto, "XStatusMsg")); if (szXStatusMsg != 0 && *szXStatusMsg) m_xStatusMsg = szXStatusMsg.detach(); } @@ -523,7 +523,7 @@ int CContactCache::cacheUpdateMetaChanged(WPARAM bMetaEnabled, LPARAM) */ wchar_t* CContactCache::getNormalizedStatusMsg(const wchar_t *src, bool fStripAll) { - if (src == 0 || mir_tstrlen(src) < 2) + if (src == 0 || mir_wstrlen(src) < 2) return 0; CMString dest; @@ -542,7 +542,7 @@ wchar_t* CContactCache::getNormalizedStatusMsg(const wchar_t *src, bool fStripAl dest.AppendChar(src[i]); } - return mir_tstrndup(dest, dest.GetLength()); + return mir_wstrndup(dest, dest.GetLength()); } /** diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 02851f893c..06d188730a 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -803,7 +803,7 @@ panel_found: char szIndex[10];
itoa(iSelection - IDM_CONTAINERMENU, szIndex, 10);
if (iSelection - IDM_CONTAINERMENU >= 0) {
- ptrT tszName(db_get_tsa(NULL, CONTAINER_KEY, szIndex));
+ ptrW tszName(db_get_tsa(NULL, CONTAINER_KEY, szIndex));
if (tszName != NULL)
SendMessage((HWND)tci.lParam, DM_CONTAINERSELECTED, 0, tszName);
}
@@ -1719,7 +1719,7 @@ panel_found: char szCName[40];
mir_snprintf(szCName, "%s_theme", CONTAINER_PREFIX);
- if (mir_tstrlen(pContainer->szRelThemeFile) > 1) {
+ if (mir_wstrlen(pContainer->szRelThemeFile) > 1) {
if (pContainer->fPrivateThemeChanged == TRUE) {
PathToRelativeT(pContainer->szRelThemeFile, pContainer->szAbsThemeFile, M.getDataPath());
db_set_ts(hContact, SRMSGMOD_T, szCName, pContainer->szRelThemeFile);
@@ -1759,7 +1759,7 @@ TContainerData* TSAPI CreateContainer(const wchar_t *name, int iTemp, MCONTACT h wcsncpy(pContainer->szName, name, CONTAINER_NAMELEN + 1);
AppendToContainerList(pContainer);
- if (M.GetByte("limittabs", 0) && !mir_tstrcmp(name, L"default"))
+ if (M.GetByte("limittabs", 0) && !mir_wstrcmp(name, L"default"))
iTemp |= CNT_CREATEFLAG_CLONED;
// save container name to the db
@@ -1768,7 +1768,7 @@ TContainerData* TSAPI CreateContainer(const wchar_t *name, int iTemp, MCONTACT h do {
char szCounter[10];
itoa(i, szCounter, 10);
- ptrT tszName(db_get_tsa(NULL, CONTAINER_KEY, szCounter));
+ ptrW tszName(db_get_tsa(NULL, CONTAINER_KEY, szCounter));
if (tszName == NULL) {
if (iFirstFree != -1) {
pContainer->iContainerIndex = iFirstFree;
@@ -1876,12 +1876,12 @@ void TSAPI CloseOtherTabs(HWND hwndTab, TWindowData &dat) int TSAPI CutContactName(const wchar_t *oldname, wchar_t *newname, size_t size)
{
- if (mir_tstrlen(oldname) <= PluginConfig.m_iTabNameLimit)
+ if (mir_wstrlen(oldname) <= PluginConfig.m_iTabNameLimit)
wcsncpy_s(newname, size, oldname, _TRUNCATE);
else {
wchar_t fmt[30];
- mir_sntprintf(fmt, L"%%%d.%ds...", PluginConfig.m_iTabNameLimit, PluginConfig.m_iTabNameLimit);
- mir_sntprintf(newname, size, fmt, oldname);
+ mir_snwprintf(fmt, L"%%%d.%ds...", PluginConfig.m_iTabNameLimit, PluginConfig.m_iTabNameLimit);
+ mir_snwprintf(newname, size, fmt, oldname);
}
return 0;
}
@@ -1906,7 +1906,7 @@ static TContainerData* TSAPI AppendToContainerList(TContainerData *pContainer) TContainerData* TSAPI FindContainerByName(const wchar_t *name)
{
- if (name == NULL || mir_tstrlen(name) == 0)
+ if (name == NULL || mir_wstrlen(name) == 0)
return 0;
if (M.GetByte("singlewinmode", 0)) // single window mode - always return 0 and force a new container
@@ -2016,7 +2016,7 @@ int TSAPI GetContainerNameForContact(MCONTACT hContact, wchar_t *szName, int iNa // use clist group names for containers...
if (M.GetByte("useclistgroups", 0)) {
- ptrT tszGroup(db_get_tsa(hContact, "CList", "Group"));
+ ptrW tszGroup(db_get_tsa(hContact, "CList", "Group"));
if (tszGroup == NULL) {
wcsncpy_s(szName, iNameLen, L"default", _TRUNCATE);
return 0;
@@ -2026,7 +2026,7 @@ int TSAPI GetContainerNameForContact(MCONTACT hContact, wchar_t *szName, int iNa return 1;
}
- ptrT tszContainerName(db_get_tsa(hContact, SRMSGMOD_T, CONTAINER_SUBKEY));
+ ptrW tszContainerName(db_get_tsa(hContact, SRMSGMOD_T, CONTAINER_SUBKEY));
if (tszContainerName == NULL) {
wcsncpy_s(szName, iNameLen, L"default", _TRUNCATE);
return 0;
@@ -2040,15 +2040,15 @@ void TSAPI DeleteContainer(int iIndex) {
char szIndex[10];
itoa(iIndex, szIndex, 10);
- ptrT tszContainerName(db_get_tsa(NULL, CONTAINER_KEY, szIndex));
+ ptrW tszContainerName(db_get_tsa(NULL, CONTAINER_KEY, szIndex));
if (tszContainerName == NULL)
return;
db_set_ts(NULL, CONTAINER_KEY, szIndex, L"**mir_free**");
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- ptrT tszValue(db_get_tsa(hContact, SRMSGMOD_T, CONTAINER_SUBKEY));
- if (!mir_tstrcmp(tszValue, tszContainerName))
+ ptrW tszValue(db_get_tsa(hContact, SRMSGMOD_T, CONTAINER_SUBKEY));
+ if (!mir_wstrcmp(tszValue, tszContainerName))
db_unset(hContact, SRMSGMOD_T, CONTAINER_SUBKEY);
}
@@ -2069,20 +2069,20 @@ void TSAPI DeleteContainer(int iIndex) void TSAPI RenameContainer(int iIndex, const wchar_t *szNew)
{
- if (mir_tstrlen(szNew) == 0)
+ if (mir_wstrlen(szNew) == 0)
return;
char szIndex[10];
itoa(iIndex, szIndex, 10);
- ptrT tszContainerName(db_get_tsa(NULL, CONTAINER_KEY, szIndex));
+ ptrW tszContainerName(db_get_tsa(NULL, CONTAINER_KEY, szIndex));
if (tszContainerName == NULL)
return;
db_set_ts(NULL, CONTAINER_KEY, szIndex, szNew);
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- ptrT tszValue(db_get_tsa(hContact, SRMSGMOD_T, CONTAINER_SUBKEY));
- if (!mir_tstrcmp(tszValue, tszContainerName))
+ ptrW tszValue(db_get_tsa(hContact, SRMSGMOD_T, CONTAINER_SUBKEY));
+ if (!mir_wstrcmp(tszValue, tszContainerName))
db_set_ts(hContact, SRMSGMOD_T, CONTAINER_SUBKEY, szNew);
}
}
@@ -2105,12 +2105,12 @@ HMENU TSAPI BuildContainerMenu() while (true) {
char szCounter[10];
itoa(i, szCounter, 10);
- ptrT tszName(db_get_tsa(NULL, CONTAINER_KEY, szCounter));
+ ptrW tszName(db_get_tsa(NULL, CONTAINER_KEY, szCounter));
if (tszName == NULL)
break;
if (wcsncmp(tszName, L"**mir_free**", CONTAINER_NAMELEN))
- AppendMenu(hMenu, MF_STRING, IDM_CONTAINERMENU + i, !mir_tstrcmp(tszName, L"default") ? TranslateT("Default container") : tszName);
+ AppendMenu(hMenu, MF_STRING, IDM_CONTAINERMENU + i, !mir_wstrcmp(tszName, L"default") ? TranslateT("Default container") : tszName);
i++;
}
diff --git a/plugins/TabSRMM/src/containeroptions.cpp b/plugins/TabSRMM/src/containeroptions.cpp index 33f27f8b7c..9dbc431c96 100644 --- a/plugins/TabSRMM/src/containeroptions.cpp +++ b/plugins/TabSRMM/src/containeroptions.cpp @@ -153,7 +153,7 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, pContainer->hWndOptions = hwndDlg;
SetWindowText(hwndDlg, TranslateT("Container options"));
wchar_t szNewTitle[128];
- mir_sntprintf(szNewTitle, L"%s", !mir_tstrcmp(pContainer->szName, L"default") ?
+ mir_snwprintf(szNewTitle, L"%s", !mir_wstrcmp(pContainer->szName, L"default") ?
TranslateT("Default container") : pContainer->szName);
SetDlgItemText(hwndDlg, IDC_HEADERBAR, szNewTitle);
Utils::enableDlgControl(hwndDlg, IDC_O_HIDETITLE, !CSkin::m_frameSkins);
@@ -338,7 +338,7 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, szFilename[MAX_PATH - 1] = 0;
PathToAbsoluteT(szFilename, szFinalThemeFile, M.getDataPath());
- if (mir_tstrcmp(szFilename, pContainer->szRelThemeFile))
+ if (mir_wstrcmp(szFilename, pContainer->szRelThemeFile))
pContainer->fPrivateThemeChanged = TRUE;
if (PathFileExists(szFinalThemeFile))
diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp index a60bf718a8..5d69e24d89 100644 --- a/plugins/TabSRMM/src/controls.cpp +++ b/plugins/TabSRMM/src/controls.cpp @@ -966,12 +966,12 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR if (!mir_strcmp(sid->szModule, MSG_ICON_MODULE)) {
if (sid->dwId == MSG_ICON_SOUND)
- mir_sntprintf(wBuf, TranslateT("Sounds are %s. Click to toggle status, hold SHIFT and click to set for all open containers"),
+ mir_snwprintf(wBuf, TranslateT("Sounds are %s. Click to toggle status, hold SHIFT and click to set for all open containers"),
pContainer->dwFlags & CNT_NOSOUND ? TranslateT("disabled") : TranslateT("enabled"));
else if (sid->dwId == MSG_ICON_UTN && (dat->bType == SESSIONTYPE_IM || dat->si->iType == GCW_PRIVMESS)) {
int mtnStatus = db_get_b(dat->hContact, SRMSGMOD, SRMSGSET_TYPING, M.GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW));
- mir_sntprintf(wBuf, TranslateT("Sending typing notifications is %s."),
+ mir_snwprintf(wBuf, TranslateT("Sending typing notifications is %s."),
mtnStatus ? TranslateT("enabled") : TranslateT("disabled"));
}
else if (sid->dwId == MSG_ICON_SESSION)
@@ -997,7 +997,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR const wchar_t *szFormat = TranslateT("There are %d pending send jobs. Message length: %d bytes, message length limit: %d bytes\n\n%d messages are queued for later delivery");
- mir_sntprintf(wBuf, szFormat, dat->iOpenJobs, iLength, dat->nMax ? dat->nMax : 20000, iQueued);
+ mir_snwprintf(wBuf, szFormat, dat->iOpenJobs, iLength, dat->nMax ? dat->nMax : 20000, iQueued);
CallService("mToolTip/ShowTipW", (WPARAM)wBuf, (LPARAM)&ti);
}
@@ -1010,7 +1010,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR if (PtInRect(&rc, pt) && ((rc.right - rc.left) < size.cx)) {
if (dat->bType == SESSIONTYPE_CHAT) {
- ptrT tszTopic(db_get_tsa(dat->hContact, dat->szProto, "Topic"));
+ ptrW tszTopic(db_get_tsa(dat->hContact, dat->szProto, "Topic"));
if (tszTopic != NULL) {
tooltip_active = TRUE;
CallService("mToolTip/ShowTipW", tszTopic, (LPARAM)&ti);
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index 0680d86d3a..24f0fe2898 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -422,7 +422,7 @@ static wchar_t* ShortenPreview(DBEVENTINFO* dbe) iPreviewLimit = 500;
wchar_t *buf = DbGetEventTextT(dbe, CP_ACP);
- if (mir_tstrlen(buf) > iPreviewLimit) {
+ if (mir_wstrlen(buf) > iPreviewLimit) {
fAddEllipsis = true;
size_t iIndex = iPreviewLimit;
size_t iWordThreshold = 20;
@@ -432,8 +432,8 @@ static wchar_t* ShortenPreview(DBEVENTINFO* dbe) buf[iIndex] = 0;
}
if (fAddEllipsis) {
- buf = (wchar_t*)mir_realloc(buf, (mir_tstrlen(buf) + 5) * sizeof(wchar_t));
- mir_tstrcat(buf, L"...");
+ buf = (wchar_t*)mir_realloc(buf, (mir_wstrlen(buf) + 5) * sizeof(wchar_t));
+ mir_wstrcat(buf, L"...");
}
return buf;
}
@@ -447,12 +447,12 @@ static wchar_t* GetPreviewT(WORD eventType, DBEVENTINFO* dbe) if (pBlob && nen_options.bPreview)
return ShortenPreview(dbe);
- return mir_tstrdup(TranslateT("Message"));
+ return mir_wstrdup(TranslateT("Message"));
case EVENTTYPE_FILE:
if (pBlob) {
if (!nen_options.bPreview)
- return mir_tstrdup(TranslateT("Incoming file"));
+ return mir_wstrdup(TranslateT("Incoming file"));
if (dbe->cbBlob > 5) { // min valid size = (sizeof(DWORD) + 1 character file name + terminating 0)
char* szFileName = (char *)dbe->pBlob + sizeof(DWORD);
@@ -462,30 +462,30 @@ static wchar_t* GetPreviewT(WORD eventType, DBEVENTINFO* dbe) if (dbe->cbBlob > (sizeof(DWORD) + namelength + 1))
szDescr = szFileName + namelength + 1;
- ptrT tszFileName(DbGetEventStringT(dbe, szFileName));
+ ptrW tszFileName(DbGetEventStringT(dbe, szFileName));
wchar_t buf[1024];
if (szDescr && Utils::safe_strlen(szDescr, dbe->cbBlob - sizeof(DWORD) - namelength - 1) > 0) {
- ptrT tszDescr(DbGetEventStringT(dbe, szDescr));
+ ptrW tszDescr(DbGetEventStringT(dbe, szDescr));
if (tszFileName && tszDescr) {
- mir_sntprintf(buf, L"%s: %s (%s)", TranslateT("Incoming file"), tszFileName, tszDescr);
- return mir_tstrdup(buf);
+ mir_snwprintf(buf, L"%s: %s (%s)", TranslateT("Incoming file"), tszFileName, tszDescr);
+ return mir_wstrdup(buf);
}
}
if (tszFileName) {
- mir_sntprintf(buf, L"%s: %s (%s)", TranslateT("Incoming file"), tszFileName, TranslateT("No description given"));
- return mir_tstrdup(buf);
+ mir_snwprintf(buf, L"%s: %s (%s)", TranslateT("Incoming file"), tszFileName, TranslateT("No description given"));
+ return mir_wstrdup(buf);
}
}
}
- return mir_tstrdup(TranslateT("Incoming file (invalid format)"));
+ return mir_wstrdup(TranslateT("Incoming file (invalid format)"));
default:
if (nen_options.bPreview)
return ShortenPreview(dbe);
- return mir_tstrdup(TranslateT("Unknown event"));
+ return mir_wstrdup(TranslateT("Unknown event"));
}
}
@@ -500,7 +500,7 @@ static int PopupUpdateT(MCONTACT hContact, MEVENT hEvent) wchar_t szHeader[256];
if (pdata->pluginOptions->bShowHeaders)
- mir_sntprintf(szHeader, L"%s %d\n", TranslateT("New messages: "), pdata->nrMerged + 1);
+ mir_snwprintf(szHeader, L"%s %d\n", TranslateT("New messages: "), pdata->nrMerged + 1);
else
szHeader[0] = 0;
@@ -513,14 +513,14 @@ static int PopupUpdateT(MCONTACT hContact, MEVENT hEvent) wchar_t timestamp[MAX_DATASIZE];
wcsftime(timestamp, MAX_DATASIZE, L"%Y.%m.%d %H:%M", _localtime32((__time32_t *)&dbe.timestamp));
- mir_sntprintf(pdata->eventData[pdata->nrMerged].tszText, L"\n\n%s\n", timestamp);
+ mir_snwprintf(pdata->eventData[pdata->nrMerged].tszText, L"\n\n%s\n", timestamp);
wchar_t *szPreview = GetPreviewT(dbe.eventType, &dbe);
if (szPreview) {
- mir_tstrncat(pdata->eventData[pdata->nrMerged].tszText, szPreview, _countof(pdata->eventData[pdata->nrMerged].tszText) - mir_tstrlen(pdata->eventData[pdata->nrMerged].tszText));
+ mir_wstrncat(pdata->eventData[pdata->nrMerged].tszText, szPreview, _countof(pdata->eventData[pdata->nrMerged].tszText) - mir_wstrlen(pdata->eventData[pdata->nrMerged].tszText));
mir_free(szPreview);
}
- else mir_tstrncat(pdata->eventData[pdata->nrMerged].tszText, L" ", _countof(pdata->eventData[pdata->nrMerged].tszText) - mir_tstrlen(pdata->eventData[pdata->nrMerged].tszText));
+ else mir_wstrncat(pdata->eventData[pdata->nrMerged].tszText, L" ", _countof(pdata->eventData[pdata->nrMerged].tszText) - mir_wstrlen(pdata->eventData[pdata->nrMerged].tszText));
pdata->eventData[pdata->nrMerged].tszText[MAX_SECONDLINE - 1] = 0;
@@ -533,18 +533,18 @@ static int PopupUpdateT(MCONTACT hContact, MEVENT hEvent) int i, available = MAX_SECONDLINE - 1;
if (pdata->pluginOptions->bShowHeaders) {
wcsncpy(lpzText, szHeader, MAX_SECONDLINE);
- available -= (int)mir_tstrlen(szHeader);
+ available -= (int)mir_wstrlen(szHeader);
}
else lpzText[0] = 0;
for (i = pdata->nrMerged; i >= 0; i--) {
- available -= (int)mir_tstrlen(pdata->eventData[i].tszText);
+ available -= (int)mir_wstrlen(pdata->eventData[i].tszText);
if (available <= 0)
break;
}
i = (available > 0) ? i + 1 : i + 2;
for (; i <= pdata->nrMerged; i++)
- mir_tstrncat(lpzText, pdata->eventData[i].tszText, _countof(lpzText) - mir_tstrlen(lpzText));
+ mir_wstrncat(lpzText, pdata->eventData[i].tszText, _countof(lpzText) - mir_wstrlen(lpzText));
pdata->eventData[pdata->nrMerged].hEvent = hEvent;
pdata->eventData[pdata->nrMerged].timestamp = dbe.timestamp;
@@ -670,14 +670,14 @@ void TSAPI UpdateTrayMenuState(TWindowData *dat, BOOL bForced) PluginConfig.m_UnreadInTray -= (mii.dwItemData & 0x0000ffff);
if (mii.dwItemData > 0 || bForced) {
wchar_t szMenuEntry[80];
- mir_sntprintf(szMenuEntry, L"%s: %s (%s) [%d]", tszProto,
+ mir_snwprintf(szMenuEntry, L"%s: %s (%s) [%d]", tszProto,
dat->cache->getNick(), dat->szStatus[0] ? dat->szStatus : L"(undef)", mii.dwItemData & 0x0000ffff);
if (!bForced)
mii.dwItemData = 0;
mii.fMask |= MIIM_STRING;
mii.dwTypeData = (LPTSTR)szMenuEntry;
- mii.cch = (int)mir_tstrlen(szMenuEntry) + 1;
+ mii.cch = (int)mir_wstrlen(szMenuEntry) + 1;
}
mii.hbmpItem = HBMMENU_CALLBACK;
SetMenuItemInfo(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)dat->hContact, FALSE, &mii);
@@ -712,7 +712,7 @@ int TSAPI UpdateTrayMenu(const TWindowData *dat, WORD wStatus, const char *szPro if (fromEvent == 2) // from chat...
mii.dwItemData |= 0x10000000;
DeleteMenu(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)hContact, MF_BYCOMMAND);
- mir_sntprintf(szMenuEntry, L"%s: %s (%s) [%d]", tszFinalProto, szNick, szMyStatus, mii.dwItemData & 0x0000ffff);
+ mir_snwprintf(szMenuEntry, L"%s: %s (%s) [%d]", tszFinalProto, szNick, szMyStatus, mii.dwItemData & 0x0000ffff);
AppendMenu(PluginConfig.g_hMenuTrayUnread, MF_BYCOMMAND | MF_STRING, (UINT_PTR)hContact, szMenuEntry);
PluginConfig.m_UnreadInTray++;
if (PluginConfig.m_UnreadInTray)
@@ -722,7 +722,7 @@ int TSAPI UpdateTrayMenu(const TWindowData *dat, WORD wStatus, const char *szPro else {
szNick = pcli->pfnGetContactDisplayName(hContact, 0);
if (CheckMenuItem(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)hContact, MF_BYCOMMAND | MF_UNCHECKED) == -1) {
- mir_sntprintf(szMenuEntry, L"%s: %s (%s) [%d]", tszFinalProto, szNick, szMyStatus, fromEvent ? 1 : 0);
+ mir_snwprintf(szMenuEntry, L"%s: %s (%s) [%d]", tszFinalProto, szNick, szMyStatus, fromEvent ? 1 : 0);
AppendMenu(PluginConfig.g_hMenuTrayUnread, MF_BYCOMMAND | MF_STRING, (UINT_PTR)hContact, szMenuEntry);
mii.dwItemData = fromEvent ? 1 : 0;
PluginConfig.m_UnreadInTray += (mii.dwItemData & 0x0000ffff);
@@ -740,8 +740,8 @@ int TSAPI UpdateTrayMenu(const TWindowData *dat, WORD wStatus, const char *szPro mii.fMask |= MIIM_STRING;
if (fromEvent == 2)
mii.dwItemData |= 0x10000000;
- mir_sntprintf(szMenuEntry, L"%s: %s (%s) [%d]", tszFinalProto, szNick, szMyStatus, mii.dwItemData & 0x0000ffff);
- mii.cch = (int)mir_tstrlen(szMenuEntry) + 1;
+ mir_snwprintf(szMenuEntry, L"%s: %s (%s) [%d]", tszFinalProto, szNick, szMyStatus, mii.dwItemData & 0x0000ffff);
+ mii.cch = (int)mir_wstrlen(szMenuEntry) + 1;
mii.dwTypeData = (LPTSTR)szMenuEntry;
}
SetMenuItemInfo(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)hContact, FALSE, &mii);
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 03317d8d5b..365fe0a812 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -44,13 +44,13 @@ void TSAPI DM_SaveLogAsRTF(const TWindowData *dat) } else if (dat) { wchar_t szFilter[MAX_PATH], szFilename[MAX_PATH]; - mir_sntprintf(szFilter, L"%s%c*.rtf%c%c", TranslateT("Rich Edit file"), 0, 0, 0); - mir_sntprintf(szFilename, L"%s.rtf", dat->cache->getNick()); + mir_snwprintf(szFilter, L"%s%c*.rtf%c%c", TranslateT("Rich Edit file"), 0, 0, 0); + mir_snwprintf(szFilename, L"%s.rtf", dat->cache->getNick()); Utils::sanitizeFilename(szFilename); wchar_t szInitialDir[MAX_PATH + 2]; - mir_sntprintf(szInitialDir, L"%s%s\\", M.getDataPath(), L"\\Saved message logs"); + mir_snwprintf(szInitialDir, L"%s%s\\", M.getDataPath(), L"\\Saved message logs"); CreateDirectoryTreeT(szInitialDir); OPENFILENAME ofn = { 0 }; @@ -613,7 +613,7 @@ static INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR CallService(MS_SYSTEM_GETFILEVERSION, 0, (LPARAM)&v); wchar_t tStr[80]; - mir_sntprintf(tStr, L"%s %d.%d.%d.%d [build %d]", + mir_snwprintf(tStr, L"%s %d.%d.%d.%d [build %d]", TranslateT("Version"), __MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM, v[3]); SetDlgItemText(hwndDlg, IDC_HEADERBAR, tStr); } @@ -1004,7 +1004,7 @@ void TSAPI DM_LoadLocale(TWindowData *dat) if (!PluginConfig.m_bDontUseDefaultKbd) { wchar_t szBuf[20]; GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_ILANGUAGE, szBuf, 20); - mir_sntprintf(szKLName, L"0000%s", szBuf); + mir_snwprintf(szKLName, L"0000%s", szBuf); db_set_ts(dat->hContact, SRMSGMOD_T, "locale", szKLName); } else { @@ -1042,7 +1042,7 @@ void TSAPI DM_UpdateLastMessage(const TWindowData *dat) wchar_t szBuf[100]; if (dat->bShowTyping) { SendMessage(dat->pContainer->hwndStatus, SB_SETICON, 0, (LPARAM)PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING]); - mir_sntprintf(szBuf, TranslateT("%s is typing a message..."), dat->cache->getNick()); + mir_snwprintf(szBuf, TranslateT("%s is typing a message..."), dat->cache->getNick()); } else if (dat->sbCustom) { SendMessage(dat->pContainer->hwndStatus, SB_SETICON, 0, (LPARAM)dat->sbCustom->hIcon); @@ -1053,14 +1053,14 @@ void TSAPI DM_UpdateLastMessage(const TWindowData *dat) SendMessage(dat->pContainer->hwndStatus, SB_SETICON, 0, 0); if (dat->pContainer->dwFlags & CNT_UINSTATUSBAR) - mir_sntprintf(szBuf, L"UID: %s", dat->cache->getUIN()); + mir_snwprintf(szBuf, L"UID: %s", dat->cache->getUIN()); else if (dat->lastMessage) { wchar_t date[64], time[64]; TimeZone_PrintTimeStamp(NULL, dat->lastMessage, L"d", date, _countof(date), 0); - if (dat->pContainer->dwFlags & CNT_UINSTATUSBAR && mir_tstrlen(date) > 6) - date[mir_tstrlen(date) - 5] = 0; + if (dat->pContainer->dwFlags & CNT_UINSTATUSBAR && mir_wstrlen(date) > 6) + date[mir_wstrlen(date) - 5] = 0; TimeZone_PrintTimeStamp(NULL, dat->lastMessage, L"t", time, _countof(time), 0); - mir_sntprintf(szBuf, TranslateT("Last received: %s at %s"), date, time); + mir_snwprintf(szBuf, TranslateT("Last received: %s at %s"), date, time); } else szBuf[0] = 0; } @@ -1374,7 +1374,7 @@ void TSAPI DM_Typing(TWindowData *dat, bool fForceOff) dat->bShowTyping = 2; dat->nTypeSecs = 86400; - mir_sntprintf(dat->szStatusBar, TranslateT("%s has entered text."), dat->cache->getNick()); + mir_snwprintf(dat->szStatusBar, TranslateT("%s has entered text."), dat->cache->getNick()); if (hwndStatus && dat->pContainer->hwndActive == hwndDlg) SendMessage(hwndStatus, SB_SETTEXT, 0, (LPARAM)dat->szStatusBar); } @@ -1399,7 +1399,7 @@ void TSAPI DM_Typing(TWindowData *dat, bool fForceOff) UpdateStatusBar(dat); } else if (dat->nTypeSecs > 0) { - mir_sntprintf(dat->szStatusBar, TranslateT("%s is typing a message"), dat->cache->getNick()); + mir_snwprintf(dat->szStatusBar, TranslateT("%s is typing a message"), dat->cache->getNick()); dat->nTypeSecs--; if (hwndStatus && dat->pContainer->hwndActive == hwndDlg) { @@ -1592,7 +1592,7 @@ void TSAPI DM_EventAdded(TWindowData *dat, WPARAM hContact, LPARAM lParam) dat->hQueuedEvents[dat->iNextQueuedEvent++] = hDbEvent; wchar_t szBuf[100]; - mir_sntprintf(szBuf, TranslateT("Auto scrolling is disabled, %d message(s) queued (press F12 to enable it)"), + mir_snwprintf(szBuf, TranslateT("Auto scrolling is disabled, %d message(s) queued (press F12 to enable it)"), dat->iNextQueuedEvent); SetDlgItemText(hwndDlg, IDC_LOGFROZENTEXT, szBuf); RedrawWindow(GetDlgItem(hwndDlg, IDC_LOGFROZENTEXT), NULL, NULL, RDW_INVALIDATE); @@ -1742,9 +1742,9 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM, LPARAM lParam) Utils::DoubleAmpersands(newcontactname, _countof(newcontactname)); - if (mir_tstrlen(newcontactname) != 0) { + if (mir_wstrlen(newcontactname) != 0) { if (PluginConfig.m_bStatusOnTabs) - mir_sntprintf(newtitle, L"%s (%s)", newcontactname, dat->szStatus); + mir_snwprintf(newtitle, L"%s (%s)", newcontactname, dat->szStatus); else wcsncpy_s(newtitle, newcontactname, _TRUNCATE); } @@ -1756,11 +1756,11 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM, LPARAM lParam) wchar_t fulluin[256]; if (dat->bIsMeta) - mir_sntprintf(fulluin, + mir_snwprintf(fulluin, TranslateT("UID: %s (SHIFT click -> copy to clipboard)\nClick for user's details\nRight click for metacontact control\nClick dropdown to add or remove user from your favorites."), bHasName ? dat->cache->getUIN() : TranslateT("No UID")); else - mir_sntprintf(fulluin, + mir_snwprintf(fulluin, TranslateT("UID: %s (SHIFT click -> copy to clipboard)\nClick for user's details\nClick dropdown to change this contact's favorite status."), bHasName ? dat->cache->getUIN() : TranslateT("No UID")); diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 9bb015b8bf..d901380ae2 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -568,7 +568,7 @@ void CGlobals::RestoreUnreadMessageAlerts(void) for (int i = 0; i < arEvents.getCount(); i++) {
MSavedEvent &e = arEvents[i];
- mir_sntprintf(toolTip, TranslateT("Message from %s"), pcli->pfnGetContactDisplayName(e.hContact, 0));
+ mir_snwprintf(toolTip, TranslateT("Message from %s"), pcli->pfnGetContactDisplayName(e.hContact, 0));
cle.hContact = e.hContact;
cle.hDbEvent = e.hEvent;
pcli->pfnAddEvent(&cle);
diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index 00b3abf2fe..f2888d3f99 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -421,9 +421,9 @@ void CInfoPanel::RenderIPNickname(const HDC hdc, RECT &rcItem) if (szStatusMsg) {
SIZE sStatusMsg, sMask;
- ::GetTextExtentPoint32(hdc, szTextToShow, (int)mir_tstrlen(szTextToShow), &m_szNick);
+ ::GetTextExtentPoint32(hdc, szTextToShow, (int)mir_wstrlen(szTextToShow), &m_szNick);
::GetTextExtentPoint32(hdc, L"A", 1, &sMask);
- ::GetTextExtentPoint32(hdc, szStatusMsg, (int)mir_tstrlen(szStatusMsg), &sStatusMsg);
+ ::GetTextExtentPoint32(hdc, szStatusMsg, (int)mir_wstrlen(szStatusMsg), &sStatusMsg);
DWORD dtFlagsNick = DT_SINGLELINE | DT_WORD_ELLIPSIS | DT_NOPREFIX;
if ((m_szNick.cx + sStatusMsg.cx + 6) < (rcItem.right - rcItem.left) || (rcItem.bottom - rcItem.top) < (2 * sMask.cy)) {
@@ -456,7 +456,7 @@ void CInfoPanel::RenderIPNickname(const HDC hdc, RECT &rcItem) CSkin::RenderText(hdc, m_dat->hThemeIP, szStatusMsg, &rcItem, dtFlags, CSkin::m_glowSize, clr);
}
else {
- GetTextExtentPoint32(hdc, szTextToShow, (int)mir_tstrlen(szTextToShow), &m_szNick);
+ GetTextExtentPoint32(hdc, szTextToShow, (int)mir_wstrlen(szTextToShow), &m_szNick);
mapRealRect(rcItem, m_rcNick, m_szNick);
if (m_hoverFlags & HOVER_NICK)
setUnderlinedFont(hdc, fShowUin ? m_ipConfig.hFonts[IPFONTID_UIN] : m_ipConfig.hFonts[IPFONTID_NICK]);
@@ -496,22 +496,22 @@ void CInfoPanel::RenderIPUIN(const HDC hdc, RECT& rcItem) time_t diff = time(NULL) - m_dat->idle;
int i_hrs = diff / 3600;
int i_mins = (diff - i_hrs * 3600) / 60;
- mir_sntprintf(szBuf, TranslateT("%s Idle: %dh,%02dm"), tszUin, i_hrs, i_mins);
+ mir_snwprintf(szBuf, TranslateT("%s Idle: %dh,%02dm"), tszUin, i_hrs, i_mins);
}
else wcscpy_s(szBuf, 256, tszUin);
if (M.GetByte("ShowClientDescription", 1)) {
wchar_t temp[256];
- ptrT szVersion(db_get_tsa(m_dat->cache->getActiveContact(), m_dat->cache->getActiveProto(), "MirVer"));
+ ptrW szVersion(db_get_tsa(m_dat->cache->getActiveContact(), m_dat->cache->getActiveProto(), "MirVer"));
if (szVersion)
- mir_sntprintf(temp, TranslateT(" Client: %s"), szVersion);
+ mir_snwprintf(temp, TranslateT(" Client: %s"), szVersion);
else
- mir_sntprintf(temp, TranslateT(" Client not cached yet"));
+ mir_snwprintf(temp, TranslateT(" Client not cached yet"));
wcscat_s(szBuf, 256, temp);
}
SIZE sUIN;
- ::GetTextExtentPoint32(hdc, szBuf, (int)mir_tstrlen(szBuf), &sUIN);
+ ::GetTextExtentPoint32(hdc, szBuf, (int)mir_wstrlen(szBuf), &sUIN);
mapRealRect(rcItem, m_rcUIN, sUIN);
CSkin::RenderText(hdc, m_dat->hThemeIP, szBuf, &rcItem, DT_SINGLELINE | DT_VCENTER, CSkin::m_glowSize, clr);
}
@@ -532,19 +532,19 @@ void CInfoPanel::RenderIPStatus(const HDC hdc, RECT& rcItem) DWORD oldPanelStatusCX = m_dat->panelStatusCX;
if (m_dat->szStatus[0])
- GetTextExtentPoint32(hdc, m_dat->szStatus, (int)mir_tstrlen(m_dat->szStatus), &sStatus);
+ GetTextExtentPoint32(hdc, m_dat->szStatus, (int)mir_wstrlen(m_dat->szStatus), &sStatus);
// figure out final account name
const wchar_t *szFinalProto = m_dat->cache->getRealAccount();
if (szFinalProto) {
SelectObject(hdc, m_ipConfig.hFonts[IPFONTID_PROTO]);
- GetTextExtentPoint32(hdc, szFinalProto, (int)mir_tstrlen(szFinalProto), &sProto);
+ GetTextExtentPoint32(hdc, szFinalProto, (int)mir_wstrlen(szFinalProto), &sProto);
}
wchar_t szResult[80]; szResult[0] = 0;
if (m_dat->hTimeZone) {
TimeZone_PrintDateTime(m_dat->hTimeZone, L"t", szResult, _countof(szResult), 0);
- GetTextExtentPoint32(hdc, szResult, (int)mir_tstrlen(szResult), &sTime);
+ GetTextExtentPoint32(hdc, szResult, (int)mir_wstrlen(szResult), &sTime);
}
m_dat->panelStatusCX = 3 + sStatus.cx + sProto.cx + 14 + (m_dat->hClientIcon ? 20 : 0) + sTime.cx + 13;
@@ -613,7 +613,7 @@ void CInfoPanel::Chat_RenderIPNickname(const HDC hdc, RECT& rcItem) if (m_height < DEGRADE_THRESHOLD) {
wchar_t tszText[2048];
- mir_sntprintf(tszText, TranslateT("Topic is: %s"),
+ mir_snwprintf(tszText, TranslateT("Topic is: %s"),
si->ptszTopic ? si->ptszTopic : TranslateT("no topic set."));
hOldFont = reinterpret_cast<HFONT>(::SelectObject(hdc, m_ipConfig.hFonts[IPFONTID_UIN]));
@@ -624,7 +624,7 @@ void CInfoPanel::Chat_RenderIPNickname(const HDC hdc, RECT& rcItem) const wchar_t *tszNick = m_dat->cache->getNick();
hOldFont = reinterpret_cast<HFONT>(::SelectObject(hdc, m_ipConfig.hFonts[IPFONTID_NICK]));
- ::GetTextExtentPoint32(hdc, tszNick, (int)mir_tstrlen(tszNick), &m_szNick);
+ ::GetTextExtentPoint32(hdc, tszNick, (int)mir_wstrlen(tszNick), &m_szNick);
mapRealRect(rcItem, m_rcNick, m_szNick);
if (m_hoverFlags & HOVER_NICK)
@@ -670,8 +670,8 @@ void CInfoPanel::Chat_RenderIPSecondLine(const HDC hdc, RECT& rcItem) SIZE szTitle;
wchar_t szPrefix[100];
- mir_sntprintf(szPrefix, TranslateT("Topic is: %s"), L"");
- ::GetTextExtentPoint32(hdc, szPrefix, (int)mir_tstrlen(szPrefix), &szTitle);
+ mir_snwprintf(szPrefix, TranslateT("Topic is: %s"), L"");
+ ::GetTextExtentPoint32(hdc, szPrefix, (int)mir_wstrlen(szPrefix), &szTitle);
mapRealRect(rcItem, m_rcUIN, szTitle);
if (m_hoverFlags & HOVER_UIN)
setUnderlinedFont(hdc, m_ipConfig.hFonts[IPFONTID_UIN]);
@@ -680,7 +680,7 @@ void CInfoPanel::Chat_RenderIPSecondLine(const HDC hdc, RECT& rcItem) rcItem.left += (szTitle.cx + 4);
if (m_hoverFlags & HOVER_UIN)
::DeleteObject(::SelectObject(hdc, m_ipConfig.hFonts[IPFONTID_UIN]));
- if (si->ptszTopic && mir_tstrlen(si->ptszTopic) > 1)
+ if (si->ptszTopic && mir_wstrlen(si->ptszTopic) > 1)
CSkin::RenderText(hdc, m_dat->hThemeIP, si->ptszTopic, &rcItem, DT_WORDBREAK | DT_END_ELLIPSIS | DT_NOPREFIX | DT_TOP, CSkin::m_glowSize, clr);
else
CSkin::RenderText(hdc, m_dat->hThemeIP, TranslateT("no topic set."), &rcItem, DT_TOP | DT_SINGLELINE | DT_NOPREFIX, CSkin::m_glowSize, clr);
@@ -1061,11 +1061,11 @@ INT_PTR CALLBACK CInfoPanel::ConfigDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L case WM_INITDIALOG:
{
wchar_t tszTitle[100];
- mir_sntprintf(tszTitle, TranslateT("Set panel visibility for this %s"),
+ mir_snwprintf(tszTitle, TranslateT("Set panel visibility for this %s"),
m_isChat ? TranslateT("chat room") : TranslateT("contact"));
::SetDlgItemText(hwnd, IDC_STATIC_VISIBILTY, tszTitle);
- mir_sntprintf(tszTitle, m_isChat ? TranslateT("Do not synchronize the panel height with IM windows") :
+ mir_snwprintf(tszTitle, m_isChat ? TranslateT("Do not synchronize the panel height with IM windows") :
TranslateT("Do not synchronize the panel height with group chat windows"));
::SetDlgItemText(hwnd, IDC_NOSYNC, tszTitle);
@@ -1322,7 +1322,7 @@ CTip::CTip(const HWND hwndParent, const MCONTACT hContact, const wchar_t *pszTex ::SendMessage(m_hRich, WM_SETFONT, (WPARAM)CInfoPanel::m_ipConfig.hFonts[IPFONTID_STATUS], 0);
m_hContact = hContact;
- m_pszText = mir_utf8encodeT(pszText);
+ m_pszText = mir_utf8encodeW(pszText);
m_panel = panel;
m_hwndParent = hwndParent;
mir_subclassWindow(m_hRich, RichEditProc);
@@ -1503,7 +1503,7 @@ INT_PTR CALLBACK CTip::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam LONG cy = rc.bottom;
HANDLE hTheme = 0;
- mir_sntprintf(szTitle, m_szTitle ? L"%s (%s)" : L"%s%s", c->getNick(), m_szTitle ? m_szTitle : L"");
+ mir_snwprintf(szTitle, m_szTitle ? L"%s (%s)" : L"%s%s", c->getNick(), m_szTitle ? m_szTitle : L"");
if (m_panel) {
HDC hdcMem = ::CreateCompatibleDC(hdc);
@@ -1568,7 +1568,7 @@ INT_PTR CALLBACK CTip::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam switch (((ENLINK*)lParam)->msg) {
case WM_LBUTTONUP:
ENLINK *e = reinterpret_cast<ENLINK *>(lParam);
- ptrT tszUrl(Utils::extractURLFromRichEdit(e, m_hRich));
+ ptrW tszUrl(Utils::extractURLFromRichEdit(e, m_hRich));
if (tszUrl)
Utils_OpenUrlT(tszUrl);
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index d79da9851b..73d017a64c 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -149,7 +149,7 @@ void CMimAPI::InitPaths() { const wchar_t *szUserdataDir = getUserDir(); - mir_sntprintf(m_szProfilePath, L"%stabSRMM", szUserdataDir); + mir_snwprintf(m_szProfilePath, L"%stabSRMM", szUserdataDir); if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) { wcsncpy_s(m_szChatLogsPath, L"%miranda_logpath%", _TRUNCATE); wcsncpy_s(m_szSkinsPath, L"%miranda_path%\\Skins\\TabSRMM", _TRUNCATE); @@ -160,11 +160,11 @@ void CMimAPI::InitPaths() } Utils::ensureTralingBackslash(m_szChatLogsPath); - replaceStrT(g_Settings.pszLogDir, m_szChatLogsPath); + replaceStrW(g_Settings.pszLogDir, m_szChatLogsPath); Utils::ensureTralingBackslash(m_szSkinsPath); - mir_sntprintf(m_szSavedAvatarsPath, L"%s\\Saved Contact Pictures", m_szProfilePath); + mir_snwprintf(m_szSavedAvatarsPath, L"%s\\Saved Contact Pictures", m_szProfilePath); } bool CMimAPI::getAeroState() @@ -299,7 +299,7 @@ int CMimAPI::TypingMessage(WPARAM hContact, LPARAM mode) if (mode) { wchar_t szTip[256]; - mir_sntprintf(szTip, TranslateT("%s is typing a message"), pcli->pfnGetContactDisplayName(hContact, 0)); + mir_snwprintf(szTip, TranslateT("%s is typing a message"), pcli->pfnGetContactDisplayName(hContact, 0)); if (fShowOnClist && ServiceExists(MS_CLIST_SYSTRAY_NOTIFY) && M.GetByte(SRMSGMOD, "ShowTypingBalloon", 0)) { MIRANDASYSTRAYNOTIFY tn; tn.szProto = NULL; @@ -551,7 +551,7 @@ nowindowcreate: cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE); cle.pszService = "SRMsg/ReadMessage"; contactName = pcli->pfnGetContactDisplayName(hContact, 0); - mir_sntprintf(toolTip, TranslateT("Message from %s"), contactName); + mir_snwprintf(toolTip, TranslateT("Message from %s"), contactName); cle.ptszTooltip = toolTip; pcli->pfnAddEvent(&cle); } diff --git a/plugins/TabSRMM/src/modplus.cpp b/plugins/TabSRMM/src/modplus.cpp index 1fc829c606..333da241f8 100644 --- a/plugins/TabSRMM/src/modplus.cpp +++ b/plugins/TabSRMM/src/modplus.cpp @@ -117,9 +117,9 @@ static int CustomButtonPressed(WPARAM wParam, LPARAM lParam) if (res == 0)
break;
- bufSize = textlenght + mir_tstrlen(pszMenu[res - 1]) + 2;
+ bufSize = textlenght + mir_wstrlen(pszMenu[res - 1]) + 2;
pszFormatedText = (wchar_t*)_alloca(bufSize*sizeof(wchar_t));
- mir_sntprintf(pszFormatedText, bufSize, pszMenu[res - 1], pszText);
+ mir_snwprintf(pszFormatedText, bufSize, pszMenu[res - 1], pszText);
}
break;
@@ -128,7 +128,7 @@ static int CustomButtonPressed(WPARAM wParam, LPARAM lParam) bufSize = textlenght + 12;
pszFormatedText = (wchar_t*)_alloca(bufSize*sizeof(wchar_t));
- mir_sntprintf(pszFormatedText, bufSize, L"[img]%s[/img]", pszText);
+ mir_snwprintf(pszFormatedText, bufSize, L"[img]%s[/img]", pszText);
bbd.ptszTooltip = 0;
bbd.hIcon = 0;
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 529dac6ce1..d43e5bb62e 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -589,9 +589,9 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar if ((int)mir_strlen((char*)hClip) > mwdat->nMax) {
wchar_t szBuffer[512];
if (M.GetByte("autosplit", 0))
- mir_sntprintf(szBuffer, TranslateT("WARNING: The message you are trying to paste exceeds the message size limit for the active protocol. It will be sent in chunks of max %d characters"), mwdat->nMax - 10);
+ mir_snwprintf(szBuffer, TranslateT("WARNING: The message you are trying to paste exceeds the message size limit for the active protocol. It will be sent in chunks of max %d characters"), mwdat->nMax - 10);
else
- mir_sntprintf(szBuffer, TranslateT("The message you are trying to paste exceeds the message size limit for the active protocol. Only the first %d characters will be sent."), mwdat->nMax);
+ mir_snwprintf(szBuffer, TranslateT("The message you are trying to paste exceeds the message size limit for the active protocol. Only the first %d characters will be sent."), mwdat->nMax);
SendMessage(hwndParent, DM_ACTIVATETOOLTIP, IDC_MESSAGE, (LPARAM)szBuffer);
}
}
@@ -1342,7 +1342,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l // restore saved msg if any...
if (dat->hContact) {
- ptrT tszSavedMsg(db_get_tsa(dat->hContact, SRMSGMOD, "SavedMsg"));
+ ptrW tszSavedMsg(db_get_tsa(dat->hContact, SRMSGMOD, "SavedMsg"));
if (tszSavedMsg != 0) {
SETTEXTEX stx = { ST_DEFAULT, 1200 };
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, tszSavedMsg);
@@ -2017,7 +2017,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l case WM_RBUTTONDOWN:
case WM_LBUTTONUP:
- ptrT tszUrl(Utils::extractURLFromRichEdit((ENLINK*)lParam, GetDlgItem(hwndDlg, IDC_LOG)));
+ ptrW tszUrl(Utils::extractURLFromRichEdit((ENLINK*)lParam, GetDlgItem(hwndDlg, IDC_LOG)));
if (!IsStringValidLink(tszUrl))
break;
@@ -2326,7 +2326,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (iIndex < SendQueue::NR_SENDJOBS) { // single sendjob timer
SendJob *job = sendQueue->getJobByIndex(iIndex);
KillTimer(hwndDlg, wParam);
- mir_sntprintf(job->szErrorMsg, TranslateT("Delivery failure: %s"), TranslateT("The message send timed out"));
+ mir_snwprintf(job->szErrorMsg, TranslateT("Delivery failure: %s"), TranslateT("The message send timed out"));
job->iStatus = SendQueue::SQ_ERROR;
if (!nen_options.iNoSounds && !(m_pContainer->dwFlags & CNT_NOSOUND))
SkinPlaySound("SendError");
@@ -2545,7 +2545,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l mir_snprintf(szIndex, "%d", iSelection - IDM_CONTAINERMENU);
if (iSelection - IDM_CONTAINERMENU >= 0) {
- ptrT val(db_get_tsa(NULL, szKey, szIndex));
+ ptrW val(db_get_tsa(NULL, szKey, szIndex));
if (val)
SendMessage(hwndDlg, DM_CONTAINERSELECTED, 0, (LPARAM)val);
}
@@ -2623,7 +2623,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (streamOut == NULL)
break;
- CMString decoded(ptrT(mir_utf8decodeT(streamOut)));
+ CMString decoded(ptrW(mir_utf8decodeW(streamOut)));
if (decoded.IsEmpty())
break;
@@ -2723,7 +2723,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l }
if (selected != NULL) {
- ptrT szQuoted(QuoteText(selected));
+ ptrW szQuoted(QuoteText(selected));
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szQuoted);
break;
}
@@ -2773,7 +2773,7 @@ quote_from_last: bNeedsFree = true;
}
if (szConverted != NULL) {
- ptrT szQuoted(QuoteText(szConverted));
+ ptrW szQuoted(QuoteText(szConverted));
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szQuoted);
}
mir_free(szText);
@@ -2784,7 +2784,7 @@ quote_from_last: ptrA szFromStream(Message_GetFromStream(GetDlgItem(hwndDlg, IDC_LOG), SF_TEXT | SFF_SELECTION));
ptrW converted(mir_utf8decodeW(szFromStream));
Utils::FilterEventMarkers(converted);
- ptrT szQuoted(QuoteText(converted));
+ ptrW szQuoted(QuoteText(converted));
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szQuoted);
}
SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
@@ -2875,7 +2875,7 @@ quote_from_last: case DM_CONTAINERSELECTED:
{
wchar_t *szNewName = (wchar_t*)lParam;
- if (!mir_tstrcmp(szNewName, TranslateT("Default container")))
+ if (!mir_wstrcmp(szNewName, TranslateT("Default container")))
szNewName = CGlobals::m_default_container_name;
int iOldItems = TabCtrl_GetItemCount(hwndTab);
@@ -3055,7 +3055,7 @@ quote_from_last: else {
if (ServiceExists(MS_HTTPSERVER_ADDFILENAME)) {
for (i = 0; i < totalCount; i++) {
- char* szFileName = mir_t2a(ppFiles[i]);
+ char* szFileName = mir_u2a(ppFiles[i]);
CallService(MS_HTTPSERVER_ADDFILENAME, (WPARAM)szFileName, 0);
mir_free(szFileName);
}
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index f68dd7c692..06c130e036 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -135,12 +135,12 @@ static void SaveAvatarToFile(TWindowData *dat, HBITMAP hbm, int isOwnPic) DWORD setView = 1;
wchar_t szTimestamp[100];
- mir_sntprintf(szTimestamp, L"%04u %02u %02u_%02u%02u", lt->tm_year + 1900, lt->tm_mon, lt->tm_mday, lt->tm_hour, lt->tm_min);
+ mir_snwprintf(szTimestamp, L"%04u %02u %02u_%02u%02u", lt->tm_year + 1900, lt->tm_mon, lt->tm_mday, lt->tm_hour, lt->tm_min);
- wchar_t *szProto = mir_a2t(dat->cache->getActiveProto());
+ wchar_t *szProto = mir_a2u(dat->cache->getActiveProto());
wchar_t szFinalPath[MAX_PATH];
- mir_sntprintf(szFinalPath, L"%s\\%s", M.getSavedAvatarPath(), szProto);
+ mir_snwprintf(szFinalPath, L"%s\\%s", M.getSavedAvatarPath(), szProto);
mir_free(szProto);
if (CreateDirectory(szFinalPath, 0) == 0) {
@@ -153,17 +153,17 @@ static void SaveAvatarToFile(TWindowData *dat, HBITMAP hbm, int isOwnPic) wchar_t szBaseName[MAX_PATH];
if (isOwnPic)
- mir_sntprintf(szBaseName, L"My Avatar_%s", szTimestamp);
+ mir_snwprintf(szBaseName, L"My Avatar_%s", szTimestamp);
else
- mir_sntprintf(szBaseName, L"%s_%s", dat->cache->getNick(), szTimestamp);
+ mir_snwprintf(szBaseName, L"%s_%s", dat->cache->getNick(), szTimestamp);
- mir_sntprintf(szFinalFilename, L"%s.png", szBaseName);
+ mir_snwprintf(szFinalFilename, L"%s.png", szBaseName);
// do not allow / or \ or % in the filename
Utils::sanitizeFilename(szFinalFilename);
wchar_t filter[MAX_PATH];
- mir_sntprintf(filter, L"%s%c*.bmp;*.png;*.jpg;*.gif%c%c", TranslateT("Image files"), 0, 0, 0);
+ mir_snwprintf(filter, L"%s%c*.bmp;*.png;*.jpg;*.gif%c%c", TranslateT("Image files"), 0, 0, 0);
OPENFILENAME ofn = { 0 };
ofn.lpstrDefExt = L"png";
@@ -286,7 +286,7 @@ int TSAPI MsgWindowUpdateMenu(TWindowData *dat, HMENU submenu, int menuID) szText = TranslateT("Set your avatar...");
}
mii.dwTypeData = szText;
- mii.cch = (int)mir_tstrlen(szText) + 1;
+ mii.cch = (int)mir_wstrlen(szText) + 1;
SetMenuItemInfo(submenu, ID_PICMENU_SETTINGS, FALSE, &mii);
}
else if (menuID == MENU_PANELPICMENU) {
@@ -443,15 +443,15 @@ void TSAPI UpdateReadChars(const TWindowData *dat) wchar_t szBuf[20]; szBuf[0] = 0;
if (dat->fInsertMode)
- mir_tstrcat(szBuf, L"O");
+ mir_wstrcat(szBuf, L"O");
if (fCaps)
- mir_tstrcat(szBuf, L"C");
+ mir_wstrcat(szBuf, L"C");
if (fNum)
- mir_tstrcat(szBuf, L"N");
+ mir_wstrcat(szBuf, L"N");
if (dat->fInsertMode || fCaps || fNum)
- mir_tstrcat(szBuf, L" | ");
+ mir_wstrcat(szBuf, L" | ");
- mir_sntprintf(buf, L"%s%s %d/%d", szBuf, dat->lcID, dat->iOpenJobs, len);
+ mir_snwprintf(buf, L"%s%s %d/%d", szBuf, dat->lcID, dat->iOpenJobs, len);
SendMessage(dat->pContainer->hwndStatus, SB_SETTEXT, 1, (LPARAM)buf);
if (PluginConfig.m_visualMessageSizeIndicator)
InvalidateRect(dat->pContainer->hwndStatus, NULL, FALSE);
@@ -931,7 +931,7 @@ BOOL TSAPI DoRtfToTags(const TWindowData *dat, CMString &pszText, int iNumColors 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');
@@ -1037,7 +1037,7 @@ BOOL TSAPI DoRtfToTags(const TWindowData *dat, CMString &pszText, int iNumColors void TSAPI GetMYUIN(TWindowData *dat)
{
- ptrT uid(Contact_GetInfo(CNF_DISPLAYUID, NULL, dat->cache->getActiveProto()));
+ ptrW uid(Contact_GetInfo(CNF_DISPLAYUID, NULL, dat->cache->getActiveProto()));
if (uid != NULL)
wcsncpy_s(dat->myUin, uid, _TRUNCATE);
else
@@ -1271,7 +1271,7 @@ void TSAPI GetLocaleID(TWindowData *dat, const wchar_t *szKLName) wchar_t szKey[20];
DWORD dwLID = wcstoul(szKLName, &stopped, 16);
- mir_sntprintf(szKey, L"%04.04x", LOWORD(dwLID));
+ mir_snwprintf(szKey, L"%04.04x", LOWORD(dwLID));
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_CLASSES_ROOT, L"MIME\\Database\\Rfc1766", 0, KEY_READ, &hKey)) {
DWORD dwLength = 255;
if (ERROR_SUCCESS == RegQueryValueEx(hKey, szKey, 0, 0, (unsigned char *)szLI, &dwLength)) {
@@ -1291,7 +1291,7 @@ void TSAPI GetLocaleID(TWindowData *dat, const wchar_t *szKLName) wcsupr(szLI);
}
fLocaleNotSet = (dat->lcID[0] == 0 && dat->lcID[1] == 0);
- mir_sntprintf(dat->lcID, szLI);
+ mir_snwprintf(dat->lcID, szLI);
GetStringTypeA(dat->lcid, CT_CTYPE2, (char*)szTest, 3, wCtype2);
pf2.cbSize = sizeof(pf2);
pf2.dwMask = PFM_RTLPARA;
@@ -1625,7 +1625,7 @@ void TSAPI LoadThemeDefaults(TContainerData *pContainer) void TSAPI LoadOverrideTheme(TContainerData *pContainer)
{
memset(&pContainer->theme, 0, sizeof(TLogTheme));
- if (mir_tstrlen(pContainer->szAbsThemeFile) > 1) {
+ if (mir_wstrlen(pContainer->szAbsThemeFile) > 1) {
if (PathFileExists(pContainer->szAbsThemeFile)) {
if (CheckThemeVersion(pContainer->szAbsThemeFile) == 0) {
LoadThemeDefaults(pContainer);
@@ -1726,7 +1726,7 @@ void TSAPI GetClientIcon(TWindowData *dat) dat->hClientIcon = 0;
if (ServiceExists(MS_FP_GETCLIENTICONT)) {
- ptrT tszMirver(db_get_tsa(dat->cache->getActiveContact(), dat->cache->getActiveProto(), "MirVer"));
+ ptrW tszMirver(db_get_tsa(dat->cache->getActiveContact(), dat->cache->getActiveProto(), "MirVer"));
if (tszMirver)
dat->hClientIcon = Finger_GetClientIcon(tszMirver, 1);
}
@@ -1734,9 +1734,9 @@ void TSAPI GetClientIcon(TWindowData *dat) void TSAPI GetMyNick(TWindowData *dat)
{
- ptrT tszNick(Contact_GetInfo(CNF_NICK, NULL, dat->cache->getActiveProto()));
+ ptrW tszNick(Contact_GetInfo(CNF_NICK, NULL, dat->cache->getActiveProto()));
if (tszNick != NULL) {
- if (mir_tstrlen(tszNick) == 0 || !mir_tstrcmp(tszNick, TranslateT("'(Unknown contact)'")))
+ if (mir_wstrlen(tszNick) == 0 || !mir_wstrcmp(tszNick, TranslateT("'(Unknown contact)'")))
wcsncpy_s(dat->szMyNickname, (dat->myUin[0] ? dat->myUin : TranslateT("'(Unknown contact)'")), _TRUNCATE);
else
wcsncpy_s(dat->szMyNickname, tszNick, _TRUNCATE);
@@ -1886,14 +1886,14 @@ void TSAPI SendHBitmapAsFile(const TWindowData *dat, HBITMAP hbmp) return;
}
- if (tempdirlen <= 0 || tempdirlen >= MAX_PATH - mir_tstrlen(mirandatempdir) - mir_tstrlen(filenametemplate) - 2) // -2 is because %Y takes 4 symbols
+ if (tempdirlen <= 0 || tempdirlen >= MAX_PATH - mir_wstrlen(mirandatempdir) - mir_wstrlen(filenametemplate) - 2) // -2 is because %Y takes 4 symbols
filename[0] = 0; // prompt for a new name
else {
- mir_tstrcpy(filename + tempdirlen, mirandatempdir);
+ mir_wstrcpy(filename + tempdirlen, mirandatempdir);
if ((GetFileAttributes(filename) == INVALID_FILE_ATTRIBUTES || ((GetFileAttributes(filename) & FILE_ATTRIBUTE_DIRECTORY) == 0)) && CreateDirectory(filename, NULL) == 0)
filename[0] = 0;
else {
- tempdirlen = mir_tstrlen(filename);
+ tempdirlen = mir_wstrlen(filename);
time_t rawtime;
time(&rawtime);
@@ -1917,7 +1917,7 @@ void TSAPI SendHBitmapAsFile(const TWindowData *dat, HBITMAP hbmp) if (filename[0] == 0) { // prompting to save
wchar_t filter[MAX_PATH];
- mir_sntprintf(filter, L"%s%c*.jpg%c%c", TranslateT("JPEG-compressed images"), 0, 0, 0);
+ mir_snwprintf(filter, L"%s%c*.jpg%c%c", TranslateT("JPEG-compressed images"), 0, 0, 0);
OPENFILENAME dlg;
dlg.lStructSize = sizeof(dlg);
@@ -1943,7 +1943,7 @@ void TSAPI SendHBitmapAsFile(const TWindowData *dat, HBITMAP hbmp) wchar_t **ppFiles = NULL;
Utils::AddToFileList(&ppFiles, &totalCount, filename);
- wchar_t* _t = mir_tstrdup(filename);
+ wchar_t* _t = mir_wstrdup(filename);
vTempFilenames.insert(_t);
CallService(MS_FILE_SENDSPECIFICFILEST, (WPARAM)dat->cache->getActiveContact(), (LPARAM)ppFiles);
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index 8abd3a071b..088a42847b 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -109,7 +109,7 @@ __forceinline char *GetRTFFont(DWORD dwIndex) */
static void TrimMessage(wchar_t *msg)
{
- size_t iLen = mir_tstrlen(msg) - 1;
+ size_t iLen = mir_wstrlen(msg) - 1;
size_t i = iLen;
while (i && (msg[i] == '\r' || msg[i] == '\n')) {
@@ -353,9 +353,9 @@ static wchar_t* Template_MakeRelativeDate(HANDLE hTimeZone, time_t check, wchar_ const wchar_t *szFormat;
if ((code == (wchar_t)'R' || code == (wchar_t)'r') && check >= today)
- mir_tstrcpy(szResult, szToday);
+ mir_wstrcpy(szResult, szToday);
else if ((code == (wchar_t)'R' || code == (wchar_t)'r') && check > (today - 86400))
- mir_tstrcpy(szResult, szYesterday);
+ mir_wstrcpy(szResult, szYesterday);
else {
if (code == 'D' || code == 'R')
szFormat = L"D";
@@ -514,7 +514,7 @@ static char* Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact, szTemplate = isSent ? this_templateset->szTemplates[TMPL_MSGOUT] : this_templateset->szTemplates[TMPL_MSGIN];
}
- size_t iTemplateLen = mir_tstrlen(szTemplate);
+ size_t iTemplateLen = mir_wstrlen(szTemplate);
BOOL showTime = dwEffectiveFlags & MWF_LOG_SHOWTIME;
BOOL showDate = dwEffectiveFlags & MWF_LOG_SHOWDATES;
@@ -824,14 +824,14 @@ static char* Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact, }
{
char *szFileName = (char *)dbei.pBlob + sizeof(DWORD);
- ptrT tszFileName(DbGetEventStringT(&dbei, szFileName));
+ ptrW tszFileName(DbGetEventStringT(&dbei, szFileName));
char *szDescr = szFileName + mir_strlen(szFileName) + 1;
if (*szDescr != 0) {
- ptrT tszDescr(DbGetEventStringT(&dbei, szDescr));
+ ptrW tszDescr(DbGetEventStringT(&dbei, szDescr));
wchar_t buf[1000];
- mir_sntprintf(buf, L"%s (%s)", tszFileName, tszDescr);
+ mir_snwprintf(buf, L"%s (%s)", tszFileName, tszDescr);
AppendUnicodeToBuffer(str, buf, 0);
}
else AppendUnicodeToBuffer(str, tszFileName, 0);
@@ -844,7 +844,7 @@ static char* Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact, str.AppendChar(' ');
}
- ptrT tszText(DbGetEventTextT(&dbei, CP_ACP));
+ ptrW tszText(DbGetEventTextT(&dbei, CP_ACP));
AppendUnicodeToBuffer(str, tszText, 0);
}
break;
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index 4928636933..0be5543c4d 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -97,12 +97,12 @@ static int TSAPI ScanSkinDir(const wchar_t* tszFolder, HWND hwndCombobox) {
bool fValid = false;
wchar_t tszMask[MAX_PATH];
- mir_sntprintf(tszMask, L"%s*.*", tszFolder);
+ mir_snwprintf(tszMask, L"%s*.*", tszFolder);
WIN32_FIND_DATA fd = { 0 };
HANDLE h = FindFirstFile(tszMask, &fd);
while (h != INVALID_HANDLE_VALUE) {
- if (mir_tstrlen(fd.cFileName) >= 5 && !wcsnicmp(fd.cFileName + mir_tstrlen(fd.cFileName) - 4, L".tsk", 4)) {
+ if (mir_wstrlen(fd.cFileName) >= 5 && !wcsnicmp(fd.cFileName + mir_wstrlen(fd.cFileName) - 4, L".tsk", 4)) {
fValid = true;
break;
}
@@ -117,19 +117,19 @@ static int TSAPI ScanSkinDir(const wchar_t* tszFolder, HWND hwndCombobox) LRESULT lr;
wchar_t szBuf[255];
- mir_sntprintf(tszFinalName, L"%s%s", tszFolder, fd.cFileName);
+ mir_snwprintf(tszFinalName, L"%s%s", tszFolder, fd.cFileName);
GetPrivateProfileString(L"Global", L"Name", L"None", szBuf, _countof(szBuf), tszFinalName);
- if (!mir_tstrcmp(szBuf, L"None")) {
- fd.cFileName[mir_tstrlen(fd.cFileName) - 4] = 0;
+ if (!mir_wstrcmp(szBuf, L"None")) {
+ fd.cFileName[mir_wstrlen(fd.cFileName) - 4] = 0;
wcsncpy_s(szBuf, fd.cFileName, _TRUNCATE);
}
PathToRelativeT(tszFinalName, tszRel, M.getSkinPath());
if ((lr = SendMessage(hwndCombobox, CB_INSERTSTRING, -1, (LPARAM)szBuf)) != CB_ERR) {
- wchar_t *idata = (wchar_t*)mir_alloc((mir_tstrlen(tszRel) + 1) * sizeof(wchar_t));
+ wchar_t *idata = (wchar_t*)mir_alloc((mir_wstrlen(tszRel) + 1) * sizeof(wchar_t));
- mir_tstrcpy(idata, tszRel);
+ mir_wstrcpy(idata, tszRel);
SendMessage(hwndCombobox, CB_SETITEMDATA, lr, (LPARAM)idata);
}
}
@@ -153,7 +153,7 @@ static int TSAPI RescanSkins(HWND hwndCombobox) wcsncpy_s(tszSkinRoot, M.getSkinPath(), _TRUNCATE);
SetDlgItemText(GetParent(hwndCombobox), IDC_SKINROOTFOLDER, tszSkinRoot);
- mir_sntprintf(tszFindMask, L"%s*.*", tszSkinRoot);
+ mir_snwprintf(tszFindMask, L"%s*.*", tszSkinRoot);
SendMessage(hwndCombobox, CB_RESETCONTENT, 0, 0);
SendMessage(hwndCombobox, CB_INSERTSTRING, -1, (LPARAM)TranslateT("<no skin>"));
@@ -163,7 +163,7 @@ static int TSAPI RescanSkins(HWND hwndCombobox) while (h != INVALID_HANDLE_VALUE) {
if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY && fd.cFileName[0] != '.') {
wchar_t tszSubDir[MAX_PATH];
- mir_sntprintf(tszSubDir, L"%s%s\\", tszSkinRoot, fd.cFileName);
+ mir_snwprintf(tszSubDir, L"%s%s\\", tszSkinRoot, fd.cFileName);
ScanSkinDir(tszSubDir, hwndCombobox);
}
if (FindNextFile(h, &fd) == 0)
@@ -178,7 +178,7 @@ static int TSAPI RescanSkins(HWND hwndCombobox) for (int i = 1; i < lr; i++) {
wchar_t *idata = (wchar_t*)SendMessage(hwndCombobox, CB_GETITEMDATA, i, 0);
if (idata && idata != (wchar_t*)CB_ERR) {
- if (!mir_tstrcmpi(dbv.ptszVal, idata)) {
+ if (!mir_wstrcmpi(dbv.ptszVal, idata)) {
SendMessage(hwndCombobox, CB_SETCURSEL, i, 0);
break;
}
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 1301f3af80..57be74dd2b 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -491,7 +491,7 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact, // cut nickname if larger than x chars...
wchar_t newcontactname[128], tabtitle[128];
- if (contactName && mir_tstrlen(contactName) > 0) {
+ if (contactName && mir_wstrlen(contactName) > 0) {
if (M.GetByte("cuttitle", 0))
CutContactName(contactName, newcontactname, _countof(newcontactname));
else
@@ -504,9 +504,9 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact, wchar_t *szStatus = pcli->pfnGetStatusModeDescription(szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(newData.hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
if (M.GetByte("tabstatus", 1))
- mir_sntprintf(tabtitle, L"%s (%s) ", newcontactname, szStatus);
+ mir_snwprintf(tabtitle, L"%s (%s) ", newcontactname, szStatus);
else
- mir_sntprintf(tabtitle, L"%s ", newcontactname);
+ mir_snwprintf(tabtitle, L"%s ", newcontactname);
newData.item.pszText = tabtitle;
newData.item.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM;
@@ -1069,7 +1069,7 @@ STDMETHODIMP CREOleCallback::GetInPlaceContext(LPOLEINPLACEFRAME*, LPOLEINPLACEU STDMETHODIMP CREOleCallback::GetNewStorage(LPSTORAGE *lplpstg)
{
wchar_t sztName[64];
- mir_sntprintf(sztName, L"s%u", nextStgId++);
+ mir_snwprintf(sztName, L"s%u", nextStgId++);
if (pictStg == NULL)
return STG_E_MEDIUMFULL;
return pictStg->CreateStorage(sztName, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, lplpstg);
diff --git a/plugins/TabSRMM/src/selectcontainer.cpp b/plugins/TabSRMM/src/selectcontainer.cpp index d52a25f738..6529bfaabf 100644 --- a/plugins/TabSRMM/src/selectcontainer.cpp +++ b/plugins/TabSRMM/src/selectcontainer.cpp @@ -47,7 +47,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L if (lParam) {
TWindowData *dat = (TWindowData*)GetWindowLongPtr((HWND)lParam, GWLP_USERDATA);
if (dat) {
- mir_sntprintf(szNewTitle, TranslateT("Select container for %s"), dat->cache->getNick());
+ mir_snwprintf(szNewTitle, TranslateT("Select container for %s"), dat->cache->getNick());
SetWindowText(hwndDlg, szNewTitle);
}
}
@@ -112,7 +112,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L if (iItem != LB_ERR) {
wchar_t szOldName[CONTAINER_NAMELEN + 1];
SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETTEXT, (WPARAM)iItem, (LPARAM)szOldName);
- if (mir_tstrlen(szOldName) == mir_tstrlen(szNewName)) {
+ if (mir_wstrlen(szOldName) == mir_wstrlen(szNewName)) {
MessageBox(0, TranslateT("This name is already in use"), TranslateT("Error"), MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwndDlg, IDC_NEWCONTAINERNAME));
break;
@@ -127,7 +127,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L RenameContainer(iIndex, szNewName);
SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_RESETCONTENT, 0, 0);
for (TContainerData *p = pFirstContainer; p; p = p->pNext) {
- if (!wcsncmp(p->szName, szName, CONTAINER_NAMELEN) && mir_tstrlen(p->szName) == mir_tstrlen(szName)) {
+ if (!wcsncmp(p->szName, szName, CONTAINER_NAMELEN) && mir_wstrlen(p->szName) == mir_wstrlen(szName)) {
wcsncpy(p->szName, szNewName, CONTAINER_NAMELEN);
SendMessage(p->hwnd, DM_CONFIGURECONTAINER, 0, 0);
}
@@ -148,7 +148,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L int iItem = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_FINDSTRING, (WPARAM)-1, (LPARAM)szNewName);
if (iItem != LB_ERR || !wcsncmp(szNewName, CGlobals::m_default_container_name, CONTAINER_NAMELEN)) {
SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETTEXT, (WPARAM)iItem, (LPARAM)szName);
- if (mir_tstrlen(szName) == mir_tstrlen(szNewName) || !wcsncmp(szNewName, CGlobals::m_default_container_name, CONTAINER_NAMELEN)) {
+ if (mir_wstrlen(szName) == mir_wstrlen(szNewName) || !wcsncmp(szNewName, CGlobals::m_default_container_name, CONTAINER_NAMELEN)) {
MessageBox(0, TranslateT("This name is already in use"), TranslateT("Error"), MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwndDlg, IDC_NEWCONTAINER));
break;
@@ -183,7 +183,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L break; // end of list
if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_WCHAR) {
if (wcsncmp(dbv.ptszVal, L"**mir_free**", CONTAINER_NAMELEN)) {
- iItemNew = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_ADDSTRING, 0, (LPARAM)(!mir_tstrcmp(dbv.ptszVal, L"default") ?
+ iItemNew = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_ADDSTRING, 0, (LPARAM)(!mir_wstrcmp(dbv.ptszVal, L"default") ?
TranslateT("Default container") : dbv.ptszVal));
if (iItemNew != LB_ERR)
SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_SETITEMDATA, (WPARAM)iItemNew, (LPARAM)iCounter);
@@ -200,7 +200,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L if (pContainer) {
LRESULT iItem;
- iItem = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_FINDSTRING, (WPARAM)-1, (LPARAM)(!mir_tstrcmp(pContainer->szName, L"default") ?
+ iItem = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_FINDSTRING, (WPARAM)-1, (LPARAM)(!mir_wstrcmp(pContainer->szName, L"default") ?
TranslateT("Default container") : pContainer->szName));
if (iItem != LB_ERR)
SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_SETCURSEL, (WPARAM)iItem, 0);
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index e52fb5adb0..e717c1817b 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -123,12 +123,12 @@ CSendLaterJob::~CSendLaterJob() wcsncpy_s(ppd.lptzContactName, (tszName ? tszName : TranslateT("'(Unknown contact)'")), _TRUNCATE);
wchar_t *msgPreview = Utils::GetPreviewWithEllipsis(reinterpret_cast<wchar_t *>(&pBuf[mir_strlen((char *)pBuf) + 1]), 100);
if (fSuccess) {
- mir_sntprintf(ppd.lptzText, TranslateT("A send later job completed successfully.\nThe original message: %s"),
+ mir_snwprintf(ppd.lptzText, TranslateT("A send later job completed successfully.\nThe original message: %s"),
msgPreview);
mir_free(msgPreview);
}
else if (fFailed) {
- mir_sntprintf(ppd.lptzText, TranslateT("A send later job failed to complete.\nThe original message: %s"),
+ mir_snwprintf(ppd.lptzText, TranslateT("A send later job failed to complete.\nThe original message: %s"),
msgPreview);
mir_free(msgPreview);
}
@@ -523,7 +523,7 @@ void CSendLater::qMgrFillList(bool fClear) lvItem.mask = LVIF_TEXT | LVIF_PARAM;
wchar_t tszBuf[255];
- mir_sntprintf(tszBuf, L"%s [%s]", tszNick, c->getRealAccount());
+ mir_snwprintf(tszBuf, L"%s [%s]", tszNick, c->getRealAccount());
lvItem.pszText = tszBuf;
lvItem.cchTextMax = _countof(tszBuf);
lvItem.iItem = uIndex++;
@@ -540,7 +540,7 @@ void CSendLater::qMgrFillList(bool fClear) lvItem.iSubItem = 1;
::SendMessage(m_hwndList, LVM_SETITEM, 0, LPARAM(&lvItem));
- wchar_t *msg = mir_utf8decodeT(p->sendBuffer);
+ wchar_t *msg = mir_utf8decodeW(p->sendBuffer);
wchar_t *preview = Utils::GetPreviewWithEllipsis(msg, 255);
lvItem.pszText = preview;
lvItem.iSubItem = 2;
@@ -575,7 +575,7 @@ void CSendLater::qMgrFillList(bool fClear) bCode = p->bCode;
wchar_t tszStatus[20];
- mir_sntprintf(tszStatus, L"X/%s[%c] (%d)", tszStatusText, bCode, p->iSendCount);
+ mir_snwprintf(tszStatus, L"X/%s[%c] (%d)", tszStatusText, bCode, p->iSendCount);
tszStatus[0] = p->szId[0];
lvItem.pszText = tszStatus;
lvItem.iSubItem = 3;
@@ -807,7 +807,7 @@ INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM job->writeFlags();
break;
case ID_QUEUEMANAGER_COPYMESSAGETOCLIPBOARD:
- Utils::CopyToClipBoard((wchar_t*)ptrT(mir_utf8decodeT(job->sendBuffer)), m_hwndDlg);
+ Utils::CopyToClipBoard((wchar_t*)ptrW(mir_utf8decodeW(job->sendBuffer)), m_hwndDlg);
break;
case ID_QUEUEMANAGER_RESETSELECTED:
if (job->bCode == CSendLaterJob::JOB_DEFERRED) {
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index b7a6f80f5a..aed683997e 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -219,7 +219,7 @@ int SendQueue::sendQueued(TWindowData *dat, const int iEntry) if (iSendLength >= iMinLength) { wchar_t tszError[256]; - mir_sntprintf(tszError, TranslateT("The message cannot be sent delayed or to multiple contacts, because it exceeds the maximum allowed message length of %d bytes"), iMinLength); + mir_snwprintf(tszError, TranslateT("The message cannot be sent delayed or to multiple contacts, because it exceeds the maximum allowed message length of %d bytes"), iMinLength); ::SendMessage(dat->hwnd, DM_ACTIVATETOOLTIP, IDC_MESSAGE, LPARAM(tszError)); sendQueue->clearJob(iEntry); return 0; @@ -274,7 +274,7 @@ int SendQueue::sendQueued(TWindowData *dat, const int iEntry) size_t iSendLength = getSendLength(iEntry); if (iSendLength >= dat->nMax) { - mir_sntprintf(tszError, TranslateT("The message cannot be sent delayed or to multiple contacts, because it exceeds the maximum allowed message length of %d bytes"), dat->nMax); + mir_snwprintf(tszError, TranslateT("The message cannot be sent delayed or to multiple contacts, because it exceeds the maximum allowed message length of %d bytes"), dat->nMax); SendMessage(dat->hwnd, DM_ACTIVATETOOLTIP, IDC_MESSAGE, LPARAM(tszError)); clearJob(iEntry); return 0; @@ -543,8 +543,8 @@ int SendQueue::ackMessage(TWindowData *dat, WPARAM wParam, LPARAM lParam) if (!nen_options.iNoSounds && !(m_pContainer->dwFlags & CNT_NOSOUND)) SkinPlaySound("SendError"); - wchar_t *szAckMsg = mir_a2t((char *)ack->lParam); - mir_sntprintf(job.szErrorMsg, TranslateT("Delivery failure: %s"), szAckMsg); + wchar_t *szAckMsg = mir_a2u((char *)ack->lParam); + mir_snwprintf(job.szErrorMsg, TranslateT("Delivery failure: %s"), szAckMsg); job.iStatus = SQ_ERROR; mir_free(szAckMsg); KillTimer(dat->hwnd, TIMERID_MSGSEND + iFound); @@ -684,9 +684,9 @@ int SendQueue::doSendLater(int iJobIndex, TWindowData *dat, MCONTACT hContact, b wchar_t tszTimestamp[30]; wcsftime(tszTimestamp, _countof(tszTimestamp), L"%Y.%m.%d - %H:%M", _localtime32((__time32_t *)&now)); mir_snprintf(szKeyName, "S%d", now); - mir_sntprintf(tszHeader, TranslateT("\n(Sent delayed. Original timestamp %s)"), tszTimestamp); + mir_snwprintf(tszHeader, TranslateT("\n(Sent delayed. Original timestamp %s)"), tszTimestamp); } - else mir_sntprintf(tszHeader, L"M%d|", time(0)); + else mir_snwprintf(tszHeader, L"M%d|", time(0)); T2Utf utf_header(tszHeader); size_t required = mir_strlen(utf_header) + mir_strlen(job->szSendBuffer) + 10; diff --git a/plugins/TabSRMM/src/sidebar.cpp b/plugins/TabSRMM/src/sidebar.cpp index 908b4b59d0..ccaf889ee2 100644 --- a/plugins/TabSRMM/src/sidebar.cpp +++ b/plugins/TabSRMM/src/sidebar.cpp @@ -145,7 +145,7 @@ const SIZE& CSideBarButton::measureItem() HFONT oldFont = reinterpret_cast<HFONT>(::SelectObject(dc, ::GetStockObject(DEFAULT_GUI_FONT)));
wcsncpy_s(tszLabel, m_dat->newtitle, _TRUNCATE);
- ::GetTextExtentPoint32(dc, tszLabel, (int)mir_tstrlen(tszLabel), &sz);
+ ::GetTextExtentPoint32(dc, tszLabel, (int)mir_wstrlen(tszLabel), &sz);
sz.cx += 28;
if (m_dat->pContainer->dwFlagsEx & TCF_CLOSEBUTTON)
@@ -1158,9 +1158,9 @@ const SIZE& __fastcall CSideBar::m_measureAdvancedVertical(CSideBarButton* item) HDC dc = ::GetDC(dat->hwnd);
HFONT hOldFont = reinterpret_cast<HFONT>(::SelectObject(dc, CInfoPanel::m_ipConfig.hFonts[IPFONTID_NICK]));
- ::GetTextExtentPoint32(dc, dat->cache->getNick(), (int)mir_tstrlen(dat->cache->getNick()), &szFirstLine);
+ ::GetTextExtentPoint32(dc, dat->cache->getNick(), (int)mir_wstrlen(dat->cache->getNick()), &szFirstLine);
::SelectObject(dc, CInfoPanel::m_ipConfig.hFonts[IPFONTID_STATUS]);
- ::GetTextExtentPoint32(dc, dat->szStatus, (int)mir_tstrlen(dat->szStatus), &szSecondLine);
+ ::GetTextExtentPoint32(dc, dat->szStatus, (int)mir_wstrlen(dat->szStatus), &szSecondLine);
::SelectObject(dc, hOldFont);
ReleaseDC(dat->hwnd, dc);
diff --git a/plugins/TabSRMM/src/srmm.cpp b/plugins/TabSRMM/src/srmm.cpp index 78ec8e47da..2b6de13dfd 100644 --- a/plugins/TabSRMM/src/srmm.cpp +++ b/plugins/TabSRMM/src/srmm.cpp @@ -111,7 +111,7 @@ int _DebugTraceW(const wchar_t *fmt, ...) mir_snprintf(tszTime, "%02d.%02d.%04d - %02d:%02d:%02d.%04d: ", st.wDay, st.wMonth, st.wYear, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds); - mir_vsntprintf(debug, ibsize - 10, fmt, va); + mir_vsnwprintf(debug, ibsize - 10, fmt, va); //#ifdef _DEBUG OutputDebugStringW(debug); //#else @@ -148,12 +148,12 @@ int _DebugPopup(MCONTACT hContact, const wchar_t *fmt, ...) int ibsize = 1023; va_start(va, fmt); - mir_vsntprintf(debug, ibsize, fmt, va); + mir_vsnwprintf(debug, ibsize, fmt, va); if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) { MIRANDASYSTRAYNOTIFY tn; wchar_t szTitle[128]; - mir_sntprintf(szTitle, TranslateT("TabSRMM message (%s)"), + mir_snwprintf(szTitle, TranslateT("TabSRMM message (%s)"), (hContact != 0) ? pcli->pfnGetContactDisplayName(hContact, 0) : TranslateT("Global")); tn.szProto = NULL; diff --git a/plugins/TabSRMM/src/taskbar.cpp b/plugins/TabSRMM/src/taskbar.cpp index 224053c4c8..1e319a6c96 100644 --- a/plugins/TabSRMM/src/taskbar.cpp +++ b/plugins/TabSRMM/src/taskbar.cpp @@ -686,7 +686,7 @@ void CThumbBase::renderBase() wchar_t tszTemp[30];
m_rcIcon.top += m_sz.cy;
- mir_sntprintf(tszTemp, TranslateT("%d unread"), m_dat->dwUnread);
+ mir_snwprintf(tszTemp, TranslateT("%d unread"), m_dat->dwUnread);
CSkin::RenderText(m_hdc, m_dat->hTheme, tszTemp, &m_rcIcon, m_dtFlags | DT_CENTER | DT_WORD_ELLIPSIS, 10, 0, true);
}
m_rcIcon = m_rcTop;
@@ -862,7 +862,7 @@ void CThumbMUC::renderContent() if (mi) {
if (m_dat->dwUnread) {
- mir_sntprintf(szTemp, TranslateT("%d unread"), m_dat->dwUnread);
+ mir_snwprintf(szTemp, TranslateT("%d unread"), m_dat->dwUnread);
CSkin::RenderText(m_hdc, m_dat->hTheme, szTemp, &m_rcIcon, m_dtFlags | DT_SINGLELINE | DT_RIGHT, 10, 0, true);
m_rcIcon.top += m_sz.cy;
}
@@ -874,20 +874,20 @@ void CThumbMUC::renderContent() _p++;
wchar_t _t = *_p;
*_p = 0;
- mir_sntprintf(szTemp, TranslateT("Chat room %s"), m_dat->si->ptszStatusbarText);
+ mir_snwprintf(szTemp, TranslateT("Chat room %s"), m_dat->si->ptszStatusbarText);
*_p = _t;
}
else
- mir_sntprintf(szTemp, TranslateT("Chat room %s"), L"");
+ mir_snwprintf(szTemp, TranslateT("Chat room %s"), L"");
CSkin::RenderText(m_hdc, m_dat->hTheme, szTemp, &m_rcIcon, m_dtFlags | DT_SINGLELINE | DT_RIGHT, 10, 0, true);
m_rcIcon.top += m_sz.cy;
- mir_sntprintf(szTemp, TranslateT("%d user(s)"), m_dat->si->nUsersInNicklist);
+ mir_snwprintf(szTemp, TranslateT("%d user(s)"), m_dat->si->nUsersInNicklist);
CSkin::RenderText(m_hdc, m_dat->hTheme, szTemp, &m_rcIcon, m_dtFlags | DT_SINGLELINE | DT_RIGHT, 10, 0, true);
}
else {
- mir_sntprintf(szTemp, TranslateT("Server window"));
+ mir_snwprintf(szTemp, TranslateT("Server window"));
CSkin::RenderText(m_hdc, m_dat->hTheme, szTemp, &m_rcIcon, m_dtFlags | DT_SINGLELINE | DT_RIGHT, 10, 0, true);
- if (mi->tszIdleMsg[0] && mir_tstrlen(mi->tszIdleMsg) > 2) {
+ if (mi->tszIdleMsg[0] && mir_wstrlen(mi->tszIdleMsg) > 2) {
m_rcIcon.top += m_sz.cy;
CSkin::RenderText(m_hdc, m_dat->hTheme, &mi->tszIdleMsg[2], &m_rcIcon, m_dtFlags | DT_SINGLELINE | DT_RIGHT, 10, 0, true);
}
@@ -904,7 +904,7 @@ void CThumbMUC::renderContent() szStatusMsg = TranslateT("no topic set.");
}
else if (mi) {
- mir_sntprintf(szTemp, TranslateT("%s on %s%s"), m_dat->szMyNickname, mi->ptszModDispName, L"");
+ mir_snwprintf(szTemp, TranslateT("%s on %s%s"), m_dat->szMyNickname, mi->ptszModDispName, L"");
szStatusMsg = szTemp;
}
diff --git a/plugins/TabSRMM/src/templates.cpp b/plugins/TabSRMM/src/templates.cpp index 9ad2b93557..48c8168a55 100644 --- a/plugins/TabSRMM/src/templates.cpp +++ b/plugins/TabSRMM/src/templates.cpp @@ -357,7 +357,7 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP dat->dwFlags = MWF_LOG_ALL; dat->dwFlags = (teInfo->rtl ? dat->dwFlags | MWF_LOG_RTL : dat->dwFlags & ~MWF_LOG_RTL); dat->dwFlags = (iIndex == 0 || iIndex == 1) ? dat->dwFlags & ~MWF_LOG_GROUPMODE : dat->dwFlags | MWF_LOG_GROUPMODE; - mir_sntprintf(dat->szMyNickname, L"My Nickname"); + mir_snwprintf(dat->szMyNickname, L"My Nickname"); StreamInEvents(hwndDlg, 0, 1, 0, &dbei); SendDlgItemMessage(hwndDlg, IDC_PREVIEW, EM_SETSEL, -1, -1); if (teInfo->changed) diff --git a/plugins/TabSRMM/src/themeio.cpp b/plugins/TabSRMM/src/themeio.cpp index 96cbe340d7..92a6571fe3 100644 --- a/plugins/TabSRMM/src/themeio.cpp +++ b/plugins/TabSRMM/src/themeio.cpp @@ -425,7 +425,7 @@ const wchar_t* TSAPI GetThemeFileName(int iMode) szFilename[0] = 0;
wchar_t filter[MAX_PATH];
- mir_sntprintf(filter, L"%s%c*.tabsrmm%c%c", TranslateT("TabSRMM themes"), 0, 0, 0);
+ mir_snwprintf(filter, L"%s%c*.tabsrmm%c%c", TranslateT("TabSRMM themes"), 0, 0, 0);
ofn.lpstrFilter = filter;
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = 0;
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp index 740f69c74b..d2ba2c8e3c 100644 --- a/plugins/TabSRMM/src/themes.cpp +++ b/plugins/TabSRMM/src/themes.cpp @@ -802,7 +802,7 @@ wchar_t* CImageItem::Read(const wchar_t *szFilename) wchar_t *szFinalName = 0;
GetPrivateProfileString(m_szName, L"Glyph", L"None", buffer, 500, szFilename);
- if (mir_tstrcmp(buffer, L"None")) {
+ if (mir_wstrcmp(buffer, L"None")) {
swscanf(buffer, L"%d,%d,%d,%d", &m_glyphMetrics[0], &m_glyphMetrics[1],
&m_glyphMetrics[2], &m_glyphMetrics[3]);
if (m_glyphMetrics[2] > m_glyphMetrics[0] && m_glyphMetrics[3] > m_glyphMetrics[1]) {
@@ -813,12 +813,12 @@ wchar_t* CImageItem::Read(const wchar_t *szFilename) }
GetPrivateProfileString(m_szName, L"Image", L"None", buffer, 500, szFilename);
- if (mir_tstrcmp(buffer, L"None") || m_dwFlags & IMAGE_GLYPH) {
+ if (mir_wstrcmp(buffer, L"None") || m_dwFlags & IMAGE_GLYPH) {
szFinalName = new wchar_t[MAX_PATH];
//strncpy(m_szName, &m_szName[1], sizeof(m_szName));
//m_szName[sizeof(m_szName) - 1] = 0;
_wsplitpath(szFilename, szDrive, szPath, NULL, NULL);
- mir_sntprintf(szFinalName, MAX_PATH, L"%s\\%s%s", szDrive, szPath, buffer);
+ mir_snwprintf(szFinalName, MAX_PATH, L"%s\\%s%s", szDrive, szPath, buffer);
if (!PathFileExists(szFinalName)) {
delete[] szFinalName;
szFinalName = 0;
@@ -852,7 +852,7 @@ wchar_t* CImageItem::Read(const wchar_t *szFilename) }
}
GetPrivateProfileString(m_szName, L"Fillcolor", L"None", buffer, 500, szFilename);
- if (mir_tstrcmp(buffer, L"None")) {
+ if (mir_wstrcmp(buffer, L"None")) {
COLORREF fillColor = CSkin::HexStringToLong(buffer);
m_fillBrush = CreateSolidBrush(fillColor);
m_dwFlags |= IMAGE_FILLSOLID;
@@ -860,7 +860,7 @@ wchar_t* CImageItem::Read(const wchar_t *szFilename) else
m_fillBrush = 0;
GetPrivateProfileString(m_szName, L"Colorkey", L"None", buffer, 500, szFilename);
- if (mir_tstrcmp(buffer, L"None")) {
+ if (mir_wstrcmp(buffer, L"None")) {
CSkin::m_ContainerColorKey = CSkin::HexStringToLong(buffer);
if (CSkin::m_ContainerColorKeyBrush)
DeleteObject(CSkin::m_ContainerColorKeyBrush);
@@ -1204,11 +1204,11 @@ void CSkin::LoadIcon(const wchar_t *szSection, const wchar_t *name, HICON &hIcon GetPrivateProfileString(szSection, name, L"none", buffer, 250, m_tszFileName);
buffer[500] = 0;
- if (mir_tstrcmpi(buffer, L"none")) {
+ if (mir_wstrcmpi(buffer, L"none")) {
wchar_t szDrive[MAX_PATH], szDir[MAX_PATH], szImagePath[MAX_PATH];
_wsplitpath(m_tszFileName, szDrive, szDir, NULL, NULL);
- mir_sntprintf(szImagePath, L"%s\\%s\\%s", szDrive, szDir, buffer);
+ mir_snwprintf(szImagePath, L"%s\\%s\\%s", szDrive, szDir, buffer);
hIcon = (HICON)LoadImage(0, szImagePath, IMAGE_ICON, 16, 16, LR_LOADFROMFILE);
}
else hIcon = NULL;
@@ -1237,12 +1237,12 @@ void CSkin::ReadItem(const int id, const wchar_t *szItem) this_item->ALPHA = min(this_item->ALPHA, 100);
clr = RGB(GetBValue(defaults->COLOR), GetGValue(defaults->COLOR), GetRValue(defaults->COLOR));
- mir_sntprintf(def_color, L"%6.6x", clr);
+ mir_snwprintf(def_color, L"%6.6x", clr);
GetPrivateProfileString(szItem, L"Color1", def_color, buffer, 400, m_tszFileName);
this_item->COLOR = HexStringToLong(buffer);
clr = RGB(GetBValue(defaults->COLOR2), GetGValue(defaults->COLOR2), GetRValue(defaults->COLOR2));
- mir_sntprintf(def_color, L"%6.6x", clr);
+ mir_snwprintf(def_color, L"%6.6x", clr);
GetPrivateProfileString(szItem, L"Color2", def_color, buffer, 400, m_tszFileName);
this_item->COLOR2 = HexStringToLong(buffer);
@@ -1299,7 +1299,7 @@ void CSkin::ReadImageItem(const wchar_t *itemname) wchar_t *szImageFileName = tmpItem.Read(m_tszFileName);
- if (!mir_tstrcmpi(itemname, L"$glyphs") && szImageFileName != 0) { // the glyph item MUST have a valid image
+ if (!mir_wstrcmpi(itemname, L"$glyphs") && szImageFileName != 0) { // the glyph item MUST have a valid image
tmpItem.Create(szImageFileName);
if (tmpItem.getHbm()) {
m_glyphItem = tmpItem;
@@ -1312,12 +1312,12 @@ void CSkin::ReadImageItem(const wchar_t *itemname) // handle the assignments of image items to skin items
for (int n = 0;; n++) {
- mir_sntprintf(szItemNr, L"Item%d", n);
+ mir_snwprintf(szItemNr, L"Item%d", n);
GetPrivateProfileString(itemname, szItemNr, L"None", buffer, 500, m_tszFileName);
- if (!mir_tstrcmp(buffer, L"None"))
+ if (!mir_wstrcmp(buffer, L"None"))
break;
for (int i = 0; i <= ID_EXTBK_LAST; i++) {
- if (!mir_tstrcmpi(SkinItems[i].szName[0] == '{' ? &SkinItems[i].szName[3] : SkinItems[i].szName, buffer)) {
+ if (!mir_wstrcmpi(SkinItems[i].szName[0] == '{' ? &SkinItems[i].szName[3] : SkinItems[i].szName, buffer)) {
if (!(tmpItem.getFlags() & IMAGE_GLYPH)) {
if (szImageFileName)
tmpItem.Create(szImageFileName);
@@ -1406,18 +1406,18 @@ void CSkin::Load(void) GetPrivateProfileSectionNames(szSections, 3000, m_tszFileName);
szSections[3001] = szSections[3000] = 0;
wchar_t *p = szSections;
- while (mir_tstrlen(p) > 1) {
+ while (mir_wstrlen(p) > 1) {
if (p[0] != '%') {
- p += (mir_tstrlen(p) + 1);
+ p += (mir_wstrlen(p) + 1);
continue;
}
for (i = 0; i <= ID_EXTBK_LAST; i++) {
- if (!mir_tstrcmpi(&p[1], SkinItems[i].szName[0] == '{' ? &SkinItems[i].szName[3] : SkinItems[i].szName)) {
+ if (!mir_wstrcmpi(&p[1], SkinItems[i].szName[0] == '{' ? &SkinItems[i].szName[3] : SkinItems[i].szName)) {
ReadItem(i, p);
break;
}
}
- p += (mir_tstrlen(p) + 1);
+ p += (mir_wstrlen(p) + 1);
j++;
}
@@ -1430,7 +1430,7 @@ void CSkin::Load(void) m_avatarBorderClr = (COLORREF)HexStringToLong(buffer);
GetPrivateProfileString(L"Global", L"SideBarBG", L"None", buffer, 20, m_tszFileName);
- if (mir_tstrcmp(buffer, L"None"))
+ if (mir_wstrcmp(buffer, L"None"))
m_sideBarContainerBG = (COLORREF)HexStringToLong(buffer);
else
m_sideBarContainerBG = SkinItems[ID_EXTBKSIDEBARBG].COLOR;
@@ -1477,7 +1477,7 @@ void CSkin::Load(void) GetPrivateProfileString(L"Theme", L"File", L"None", buffer, MAX_PATH, m_tszFileName);
_wsplitpath(m_tszFileName, szDrive, szPath, NULL, NULL);
- mir_sntprintf(szFinalName, L"%s\\%s\\%s", szDrive, szPath, buffer);
+ mir_snwprintf(szFinalName, L"%s\\%s\\%s", szDrive, szPath, buffer);
if (PathFileExists(szFinalName)) {
ReadThemeFromINI(szFinalName, 0, FALSE, m_fLoadOnStartup ? 0 : M.GetByte("skin_loadmode", 0));
CacheLogFonts();
@@ -1490,7 +1490,7 @@ void CSkin::Load(void) DeleteObject(m_MenuBGBrush);
m_MenuBGBrush = 0;
}
- if (mir_tstrcmp(buffer, L"None"))
+ if (mir_wstrcmp(buffer, L"None"))
m_MenuBGBrush = CreateSolidBrush(data);
GetPrivateProfileString(L"Global", L"LightShadow", L"000000", buffer, 20, m_tszFileName);
@@ -1503,7 +1503,7 @@ void CSkin::Load(void) SkinCalcFrameWidth();
GetPrivateProfileString(L"Global", L"FontColor", L"None", buffer, 20, m_tszFileName);
- if (mir_tstrcmp(buffer, L"None"))
+ if (mir_wstrcmp(buffer, L"None"))
CSkin::m_DefaultFontColor = HexStringToLong(buffer);
else
CSkin::m_DefaultFontColor = GetSysColor(COLOR_BTNTEXT);
@@ -1539,7 +1539,7 @@ void CSkin::LoadItems() szSections[SECT_BUFFER_SIZE] = 0;
p = szSections;
- while (mir_tstrlen(p) > 1) {
+ while (mir_wstrlen(p) > 1) {
p1 = wcschr(p, (int)'=');
if (p1)
*p1 = 0;
@@ -1549,14 +1549,14 @@ void CSkin::LoadItems() memset(&m_skinIcons[m_nrSkinIcons], 0, sizeof(TIconDesc));
m_skinIcons[m_nrSkinIcons].uId = tmpIconDesc.uId;
m_skinIcons[m_nrSkinIcons].phIcon = (HICON *)(&m_skinIcons[m_nrSkinIcons].uId);
- m_skinIcons[m_nrSkinIcons].szName = (wchar_t*)mir_alloc(sizeof(wchar_t) * (mir_tstrlen(p) + 1));
- mir_tstrcpy(m_skinIcons[m_nrSkinIcons].szName, p);
+ m_skinIcons[m_nrSkinIcons].szName = (wchar_t*)mir_alloc(sizeof(wchar_t) * (mir_wstrlen(p) + 1));
+ mir_wstrcpy(m_skinIcons[m_nrSkinIcons].szName, p);
m_nrSkinIcons++;
}
}
if (p1)
*p1 = '=';
- p += (mir_tstrlen(p) + 1);
+ p += (mir_wstrlen(p) + 1);
}
memset(szSections, 0, ((SECT_BUFFER_SIZE + 2) * sizeof(wchar_t)));
@@ -1564,10 +1564,10 @@ void CSkin::LoadItems() szSections[SECT_BUFFER_SIZE] = 0;
p = szSections;
- while (mir_tstrlen(p) > 1) {
+ while (mir_wstrlen(p) > 1) {
if (p[0] == '$')
ReadImageItem(p);
- p += (mir_tstrlen(p) + 1);
+ p += (mir_wstrlen(p) + 1);
}
nextButtonID = IDC_TBFIRSTUID;
@@ -1668,14 +1668,14 @@ void CSkin::setupAeroSkins() wchar_t tszFilename[MAX_PATH], tszBasePath[MAX_PATH];
wcsncpy_s(tszBasePath, M.getDataPath(), _TRUNCATE);
- if (tszBasePath[mir_tstrlen(tszBasePath) - 1] != '\\')
- mir_tstrcat(tszBasePath, L"\\");
+ if (tszBasePath[mir_wstrlen(tszBasePath) - 1] != '\\')
+ mir_wstrcat(tszBasePath, L"\\");
// load unknown avatar..
if (0 == PluginConfig.g_hbmUnknown) {
- mir_sntprintf(tszFilename, L"%scustom_unknown.png", tszBasePath);
+ mir_snwprintf(tszFilename, L"%scustom_unknown.png", tszBasePath);
if (!PathFileExists(tszFilename))
- mir_sntprintf(tszFilename, L"%sunknown.png", tszBasePath);
+ mir_snwprintf(tszFilename, L"%sunknown.png", tszBasePath);
PluginConfig.g_hbmUnknown = (HBITMAP)CallService(MS_IMG_LOAD, (WPARAM)tszFilename, IMGL_TCHAR);
if (PluginConfig.g_hbmUnknown == 0) {
HDC dc = GetDC(0);
@@ -1684,9 +1684,9 @@ void CSkin::setupAeroSkins() }
}
- mir_sntprintf(tszFilename, L"%scustom_tabskin_aero.png", tszBasePath);
+ mir_snwprintf(tszFilename, L"%scustom_tabskin_aero.png", tszBasePath);
if (!PathFileExists(tszFilename))
- mir_sntprintf(tszFilename, L"%stabskin_aero.png", tszBasePath);
+ mir_snwprintf(tszFilename, L"%stabskin_aero.png", tszBasePath);
BOOL isOpaque = false;
if (CMimAPI::m_pfnDwmGetColorizationColor && M.isAero())
@@ -1771,9 +1771,9 @@ void CSkin::setupAeroSkins() m_tabBottom->setMetrics(bm.bmWidth, bm.bmHeight);
- mir_sntprintf(tszFilename, L"%scustom_tabskin_aero_glow.png", tszBasePath);
+ mir_snwprintf(tszFilename, L"%scustom_tabskin_aero_glow.png", tszBasePath);
if (!PathFileExists(tszFilename))
- mir_sntprintf(tszFilename, L"%stabskin_aero_glow.png", tszBasePath);
+ mir_snwprintf(tszFilename, L"%stabskin_aero_glow.png", tszBasePath);
fib = (FIBITMAP *)CallService(MS_IMG_LOAD, (WPARAM)tszFilename, IMGL_TCHAR | IMGL_RETURNDIB);
@@ -1804,9 +1804,9 @@ void CSkin::setupAeroSkins() m_tabGlowBottom->setMetrics(bm.bmWidth, bm.bmHeight);
// background item for the button switch bar
- mir_sntprintf(tszFilename, L"%scustom_tabskin_aero_button.png", tszBasePath);
+ mir_snwprintf(tszFilename, L"%scustom_tabskin_aero_button.png", tszBasePath);
if (!PathFileExists(tszFilename))
- mir_sntprintf(tszFilename, L"%stabskin_aero_button.png", tszBasePath);
+ mir_snwprintf(tszFilename, L"%stabskin_aero_button.png", tszBasePath);
hbm = (HBITMAP)CallService(MS_IMG_LOAD, (WPARAM)tszFilename, IMGL_TCHAR);
@@ -2439,8 +2439,8 @@ void CSkin::extractSkinsAndLogo(bool fForceOverwrite) const {
wchar_t tszBasePath[MAX_PATH];
wcsncpy_s(tszBasePath, M.getDataPath(), _TRUNCATE);
- if (tszBasePath[mir_tstrlen(tszBasePath) - 1] != '\\')
- mir_tstrcat(tszBasePath, L"\\");
+ if (tszBasePath[mir_wstrlen(tszBasePath) - 1] != '\\')
+ mir_wstrcat(tszBasePath, L"\\");
CreateDirectoryTreeT(tszBasePath);
diff --git a/plugins/TabSRMM/src/themes.h b/plugins/TabSRMM/src/themes.h index 32d3ac2d2d..4b35e4b366 100644 --- a/plugins/TabSRMM/src/themes.h +++ b/plugins/TabSRMM/src/themes.h @@ -151,7 +151,7 @@ public: CImageItem(const wchar_t *szName)
{
memset(this, 0, sizeof(CImageItem));
- mir_sntprintf(m_szName, szName);
+ mir_snwprintf(m_szName, szName);
m_szName[39] = 0;
}
diff --git a/plugins/TabSRMM/src/trayicon.cpp b/plugins/TabSRMM/src/trayicon.cpp index f13c5195c5..f9d01f7c87 100644 --- a/plugins/TabSRMM/src/trayicon.cpp +++ b/plugins/TabSRMM/src/trayicon.cpp @@ -92,7 +92,7 @@ static void TrayAnimThread(LPVOID) void TSAPI CreateTrayMenus(int mode)
{
if (mode) {
- mir_sntprintf(g_eventName, L"tsr_evt_%d", GetCurrentThreadId());
+ mir_snwprintf(g_eventName, L"tsr_evt_%d", GetCurrentThreadId());
g_hEvent = CreateEvent(NULL, FALSE, FALSE, g_eventName);
isAnimThreadRunning = TRUE;
hTrayAnimThread = mir_forkthread(TrayAnimThread, NULL);
@@ -217,7 +217,7 @@ void TSAPI AddContactToFavorites(MCONTACT hContact, const wchar_t *szNickname, c if (acc && acc->tszAccountName) {
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
- mir_sntprintf(szMenuEntry, L"%s: %s (%s)", acc->tszAccountName, szFinalNick, szStatus);
+ mir_snwprintf(szMenuEntry, L"%s: %s (%s)", acc->tszAccountName, szFinalNick, szStatus);
if (mode) {
if (hMenu == PluginConfig.g_hMenuRecent) {
if (CheckMenuItem(hMenu, (UINT_PTR)hContact, MF_BYCOMMAND | MF_UNCHECKED) == 0) {
@@ -264,7 +264,7 @@ void TSAPI AddContactToFavorites(MCONTACT hContact, const wchar_t *szNickname, c if (!mode) {
mii.fMask |= MIIM_STRING;
mii.dwTypeData = (LPTSTR)szMenuEntry;
- mii.cch = (int)mir_tstrlen(szMenuEntry) + 1;
+ mii.cch = (int)mir_wstrlen(szMenuEntry) + 1;
}
mii.hbmpItem = HBMMENU_CALLBACK;
mii.dwItemData = (ULONG_PTR)hIcon;
diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp index a9a06b6611..0c05c1ba27 100644 --- a/plugins/TabSRMM/src/typingnotify.cpp +++ b/plugins/TabSRMM/src/typingnotify.cpp @@ -528,8 +528,8 @@ int TN_ModuleInit() for (i = 0; i < _countof(colorPicker); i++)
colorPicker[i].color = M.GetDword(Module, colorPicker[i].desc, 0);
- mir_sntprintf(szStart, TranslateT("...is typing a message."));
- mir_sntprintf(szStop, TranslateT("...has stopped typing."));
+ mir_snwprintf(szStart, TranslateT("...is typing a message."));
+ mir_snwprintf(szStop, TranslateT("...has stopped typing."));
if (PluginConfig.g_bPopupAvail && ShowMenu) {
hTypingNotify = CreateServiceFunction("TypingNotify/EnableDisableMenuCommand", EnableDisableMenuCommand);
diff --git a/plugins/TabSRMM/src/userprefs.cpp b/plugins/TabSRMM/src/userprefs.cpp index 39f367e2c1..cd4653b191 100644 --- a/plugins/TabSRMM/src/userprefs.cpp +++ b/plugins/TabSRMM/src/userprefs.cpp @@ -416,7 +416,7 @@ INT_PTR CALLBACK DlgProcUserPrefsFrame(HWND hwndDlg, UINT msg, WPARAM wParam, LP GetClientRect(hwndDlg, &rcClient);
wchar_t szBuffer[180];
- mir_sntprintf(szBuffer, TranslateT("Set messaging options for %s"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_snwprintf(szBuffer, TranslateT("Set messaging options for %s"), pcli->pfnGetContactDisplayName(hContact, 0));
SetWindowText(hwndDlg, szBuffer);
memset(&tci, 0, sizeof(tci));
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index 82918649a4..5ce367b1a0 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -103,8 +103,8 @@ const wchar_t* Utils::FormatRaw(TWindowData *dat, const wchar_t *msg, int flags, search_again:
bool clr_found = false;
for (int ii = 0; ii < rtf_ctable_size; ii++) {
- if (!wcsnicmp((wchar_t*)colorname.c_str(), rtf_ctable[ii].szName, mir_tstrlen(rtf_ctable[ii].szName))) {
- closing = beginmark + 7 + mir_tstrlen(rtf_ctable[ii].szName);
+ if (!wcsnicmp((wchar_t*)colorname.c_str(), rtf_ctable[ii].szName, mir_wstrlen(rtf_ctable[ii].szName))) {
+ closing = beginmark + 7 + mir_wstrlen(rtf_ctable[ii].szName);
if (endmark != message.npos) {
message.erase(endmark, 4);
message.replace(endmark, 4, L"c0 ");
@@ -113,13 +113,13 @@ search_again: wchar_t szTemp[5];
message.insert(beginmark, L"cxxx ");
- mir_sntprintf(szTemp, L"%02d", MSGDLGFONTCOUNT + 13 + ii);
+ mir_snwprintf(szTemp, L"%02d", MSGDLGFONTCOUNT + 13 + ii);
message[beginmark + 3] = szTemp[0];
message[beginmark + 4] = szTemp[1];
clr_found = true;
if (was_added) {
wchar_t wszTemp[100];
- mir_sntprintf(wszTemp, L"##col##%06u:%04u", endmark - closing, ii);
+ mir_snwprintf(wszTemp, L"##col##%06u:%04u", endmark - closing, ii);
wszTemp[99] = 0;
message.insert(beginmark, wszTemp);
}
@@ -236,7 +236,7 @@ ok: static wchar_t* Trunc500(wchar_t *str)
{
- if (mir_tstrlen(str) > 500)
+ if (mir_wstrlen(str) > 500)
str[500] = 0;
return str;
}
@@ -271,7 +271,7 @@ bool Utils::FormatTitleBar(const TWindowData *dat, const wchar_t *szFormat, CMSt break;
case 'c':
- dest.Append(!mir_tstrcmp(dat->pContainer->szName, L"default") ? TranslateT("Default container") : dat->pContainer->szName);
+ dest.Append(!mir_wstrcmp(dat->pContainer->szName, L"default") ? TranslateT("Default container") : dat->pContainer->szName);
break;
case 'o':
@@ -286,7 +286,7 @@ bool Utils::FormatTitleBar(const TWindowData *dat, const wchar_t *szFormat, CMSt {
BYTE xStatus = dat->cache->getXStatusId();
if (dat->wStatus != ID_STATUS_OFFLINE && xStatus > 0 && xStatus <= 31) {
- ptrT szXStatus(db_get_tsa(dat->hContact, dat->szProto, "XStatusName"));
+ ptrW szXStatus(db_get_tsa(dat->hContact, dat->szProto, "XStatusName"));
dest.Append((szXStatus != NULL) ? Trunc500(szXStatus) : xStatusDescr[xStatus - 1]);
}
}
@@ -296,7 +296,7 @@ bool Utils::FormatTitleBar(const TWindowData *dat, const wchar_t *szFormat, CMSt {
BYTE xStatus = dat->cache->getXStatusId();
if (dat->wStatus != ID_STATUS_OFFLINE && xStatus > 0 && xStatus <= 31) {
- ptrT szXStatus(db_get_tsa(dat->hContact, dat->szProto, "XStatusName"));
+ ptrW szXStatus(db_get_tsa(dat->hContact, dat->szProto, "XStatusName"));
dest.Append((szXStatus != NULL) ? Trunc500(szXStatus) : xStatusDescr[xStatus - 1]);
}
else dest.Append(dat->szStatus && dat->szStatus[0] ? dat->szStatus : L"(undef)");
@@ -307,7 +307,7 @@ bool Utils::FormatTitleBar(const TWindowData *dat, const wchar_t *szFormat, CMSt case 't':
case 'T':
{
- ptrT tszStatus(dat->cache->getNormalizedStatusMsg(dat->cache->getStatusMsg(), true));
+ ptrW tszStatus(dat->cache->getNormalizedStatusMsg(dat->cache->getStatusMsg(), true));
if (tszStatus)
dest.Append(tszStatus);
else if (*src == 't')
@@ -317,7 +317,7 @@ bool Utils::FormatTitleBar(const TWindowData *dat, const wchar_t *szFormat, CMSt case 'g':
{
- ptrT tszGroup(db_get_tsa(dat->hContact, "CList", "Group"));
+ ptrW tszGroup(db_get_tsa(dat->hContact, "CList", "Group"));
if (tszGroup != NULL)
dest.Append(tszGroup);
}
@@ -365,7 +365,7 @@ void Utils::DoubleAmpersands(wchar_t *pszText, size_t len) {
CMString text(pszText);
text.Replace(L"&", L"&&");
- mir_tstrncpy(pszText, text.c_str(), len);
+ mir_wstrncpy(pszText, text.c_str(), len);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -381,8 +381,8 @@ wchar_t* Utils::GetPreviewWithEllipsis(wchar_t *szText, size_t iMaxLen) wchar_t *p = 0, cSaved;
bool fEllipsis = false;
- if (mir_tstrlen(szText) <= iMaxLen) {
- uRequired = mir_tstrlen(szText) + 4;
+ if (mir_wstrlen(szText) <= iMaxLen) {
+ uRequired = mir_wstrlen(szText) + 4;
cSaved = 0;
}
else {
@@ -399,7 +399,7 @@ wchar_t* Utils::GetPreviewWithEllipsis(wchar_t *szText, size_t iMaxLen) uRequired = (p - szText) + 6;
}
wchar_t *szResult = reinterpret_cast<wchar_t *>(mir_alloc((uRequired + 1) * sizeof(wchar_t)));
- mir_sntprintf(szResult, (uRequired + 1), fEllipsis ? L"%s..." : L"%s", szText);
+ mir_snwprintf(szResult, (uRequired + 1), fEllipsis ? L"%s..." : L"%s", szText);
if (p)
*p = cSaved;
@@ -457,7 +457,7 @@ void Utils::RTF_ColorAdd(const wchar_t *tszColname, size_t length) rtf_ctable_size++;
rtf_ctable = (TRTFColorTable *)mir_realloc(rtf_ctable, sizeof(TRTFColorTable) * rtf_ctable_size);
COLORREF clr = wcstol(tszColname, &stopped, 16);
- mir_sntprintf(rtf_ctable[rtf_ctable_size - 1].szName, length + 1, L"%06x", clr);
+ mir_snwprintf(rtf_ctable[rtf_ctable_size - 1].szName, length + 1, L"%06x", clr);
rtf_ctable[rtf_ctable_size - 1].menuid = 0;
clr = wcstol(tszColname, &stopped, 16);
@@ -570,7 +570,7 @@ void Utils::SaveContainerSettings(TContainerData *pContainer, const char *szSett WriteContainerSettingsToDB(0, pContainer->settings, szCName);
}
mir_snprintf(szCName, "%s%d_theme", szSetting, pContainer->iContainerIndex);
- if (mir_tstrlen(pContainer->szRelThemeFile) > 1) {
+ if (mir_wstrlen(pContainer->szRelThemeFile) > 1) {
if (pContainer->fPrivateThemeChanged == TRUE) {
PathToRelativeT(pContainer->szRelThemeFile, pContainer->szAbsThemeFile, M.getDataPath());
db_set_ts(NULL, SRMSGMOD_T, szCName, pContainer->szAbsThemeFile);
@@ -715,7 +715,7 @@ void Utils::addMenuItem(const HMENU& m, MENUITEMINFO &mii, HICON hIcon, const wc mii.wID = uID;
mii.dwItemData = (ULONG_PTR)hIcon;
mii.dwTypeData = const_cast<wchar_t *>(szText);
- mii.cch = (int)mir_tstrlen(mii.dwTypeData) + 1;
+ mii.cch = (int)mir_wstrlen(mii.dwTypeData) + 1;
::InsertMenuItem(m, pos, TRUE, &mii);
}
@@ -800,7 +800,7 @@ bool Utils::extractResource(const HMODULE h, const UINT uID, const wchar_t *tszN DWORD dwSize = SizeofResource(g_hInst, hRes), written = 0;
wchar_t szFilename[MAX_PATH];
- mir_sntprintf(szFilename, L"%s%s", tszPath, tszFilename);
+ mir_snwprintf(szFilename, L"%s%s", tszPath, tszFilename);
if (!fForceOverwrite)
if (PathFileExists(szFilename))
return true;
@@ -834,8 +834,8 @@ wchar_t* Utils::extractURLFromRichEdit(const ENLINK* _e, const HWND hwndRich) tr.lpstrText = (wchar_t*)mir_alloc(sizeof(wchar_t) * (tr.chrg.cpMax - tr.chrg.cpMin + 8));
::SendMessage(hwndRich, EM_GETTEXTRANGE, 0, (LPARAM)&tr);
if (wcschr(tr.lpstrText, '@') != NULL && wcschr(tr.lpstrText, ':') == NULL && wcschr(tr.lpstrText, '/') == NULL) {
- mir_tstrncpy(tr.lpstrText, L"mailto:", 7);
- mir_tstrncpy(tr.lpstrText + 7, tr.lpstrText, tr.chrg.cpMax - tr.chrg.cpMin + 1);
+ mir_wstrncpy(tr.lpstrText, L"mailto:", 7);
+ mir_wstrncpy(tr.lpstrText + 7, tr.lpstrText, tr.chrg.cpMax - tr.chrg.cpMin + 1);
}
return tr.lpstrText;
}
@@ -935,7 +935,7 @@ size_t Utils::CopyToClipBoard(const wchar_t *str, const HWND hwndOwner) if (!OpenClipboard(hwndOwner) || str == 0)
return 0;
- size_t i = sizeof(wchar_t) * (mir_tstrlen(str) + 1);
+ size_t i = sizeof(wchar_t) * (mir_wstrlen(str) + 1);
EmptyClipboard();
HGLOBAL hData = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, i);
@@ -954,21 +954,21 @@ void Utils::AddToFileList(wchar_t ***pppFiles, int *totalCount, LPCTSTR szFilena {
*pppFiles = (wchar_t**)mir_realloc(*pppFiles, (++*totalCount + 1) * sizeof(wchar_t*));
(*pppFiles)[*totalCount] = NULL;
- (*pppFiles)[*totalCount - 1] = mir_tstrdup(szFilename);
+ (*pppFiles)[*totalCount - 1] = mir_wstrdup(szFilename);
if (GetFileAttributes(szFilename) & FILE_ATTRIBUTE_DIRECTORY) {
WIN32_FIND_DATA fd;
wchar_t szPath[MAX_PATH];
- mir_tstrcpy(szPath, szFilename);
- mir_tstrcat(szPath, L"\\*");
+ mir_wstrcpy(szPath, szFilename);
+ mir_wstrcat(szPath, L"\\*");
HANDLE hFind = FindFirstFile(szPath, &fd);
if (hFind != INVALID_HANDLE_VALUE) {
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);
@@ -1179,7 +1179,7 @@ INT_PTR CALLBACK CWarning::dlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP ::SendDlgItemMessage(hwnd, IDC_WARNTEXT, EM_AUTOURLDETECT, TRUE, 0);
::SendDlgItemMessage(hwnd, IDC_WARNTEXT, EM_SETEVENTMASK, 0, ENM_LINK);
- mir_sntprintf(temp, RTF_DEFAULT_HEADER, 0, 0, 0, 30 * 15);
+ mir_snwprintf(temp, RTF_DEFAULT_HEADER, 0, 0, 0, 30 * 15);
tstring *str = new tstring(temp);
str->append(m_szText);
diff --git a/plugins/TabSRMM/src/utils.h b/plugins/TabSRMM/src/utils.h index 245db9db97..cd6ca460a8 100644 --- a/plugins/TabSRMM/src/utils.h +++ b/plugins/TabSRMM/src/utils.h @@ -167,7 +167,7 @@ public: LRESULT ShowDialog() const;
private:
- ptrT m_szTitle, m_szText;
+ ptrW m_szTitle, m_szText;
UINT m_uId;
HFONT m_hFontCaption;
DWORD m_dwFlags;
diff --git a/plugins/TipperYM/src/message_pump.cpp b/plugins/TipperYM/src/message_pump.cpp index d19096e067..558faed14f 100644 --- a/plugins/TipperYM/src/message_pump.cpp +++ b/plugins/TipperYM/src/message_pump.cpp @@ -284,7 +284,7 @@ INT_PTR ShowTipW(WPARAM wParam, LPARAM lParam) if (wParam) // wParam is char pointer containing text - e.g. status bar tooltip
{
- clcit2->swzText = mir_tstrdup((wchar_t *)wParam);
+ clcit2->swzText = mir_wstrdup((wchar_t *)wParam);
GetCursorPos(&clcit2->ptCursor);
}
@@ -316,8 +316,8 @@ int ProtoAck(WPARAM, LPARAM lParam) if (ack->type == ACKTYPE_AWAYMSG) {
wchar_t *tszMsg = (wchar_t*)ack->lParam;
- if (mir_tstrlen(tszMsg))
- PostMPMessage(MUM_GOTSTATUS, (WPARAM)ack->hContact, (LPARAM)mir_tstrdup(tszMsg));
+ if (mir_wstrlen(tszMsg))
+ PostMPMessage(MUM_GOTSTATUS, (WPARAM)ack->hContact, (LPARAM)mir_wstrdup(tszMsg));
}
else if (ack->type == ICQACKTYPE_XSTATUS_RESPONSE)
PostMPMessage(MUM_GOTXSTATUS, (WPARAM)ack->hContact, 0);
diff --git a/plugins/TipperYM/src/mir_smileys.cpp b/plugins/TipperYM/src/mir_smileys.cpp index 5e8c62b8c9..ed8ad1a0b4 100644 --- a/plugins/TipperYM/src/mir_smileys.cpp +++ b/plugins/TipperYM/src/mir_smileys.cpp @@ -42,7 +42,7 @@ SMILEYPARSEINFO Smileys_PreParse(LPCTSTR lpString, int nCount, const char *proto return NULL;
if (nCount == -1)
- nCount = (int)mir_tstrlen(lpString);
+ nCount = (int)mir_wstrlen(lpString);
SMILEYPARSEINFO info = (SMILEYPARSEINFO)mir_calloc(sizeof(tagSMILEYPARSEINFO));
info->pieces = ReplaceSmileys(lpString, nCount, protocol, &info->max_height);
@@ -71,7 +71,7 @@ void Smileys_FreeParse(SMILEYPARSEINFO parseInfo) int Smileys_DrawText(HDC hDC, LPCTSTR lpString, int nCount, LPRECT lpRect, UINT uFormat, SMILEYPARSEINFO parseInfo)
{
if (nCount == -1)
- nCount = (int)mir_tstrlen(lpString);
+ nCount = (int)mir_wstrlen(lpString);
if (uFormat & DT_CALCRECT) {
SIZE text_size = GetTextSize(hDC, lpString, parseInfo, uFormat, (lpRect->right - lpRect->left));
diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp index d083f1bc98..ae1b3e931b 100644 --- a/plugins/TipperYM/src/options.cpp +++ b/plugins/TipperYM/src/options.cpp @@ -308,7 +308,7 @@ void LoadObsoleteSkinSetting() opt.transfMode[i] = (TransformationMode)db_get_b(0, MODULE, setting, 0);
mir_snprintf(setting, "SImgFile%d", i);
if (!db_get_ts(NULL, MODULE, setting, &dbv)) {
- opt.szImgFile[i] = mir_tstrdup(dbv.ptszVal);
+ opt.szImgFile[i] = mir_wstrdup(dbv.ptszVal);
db_free(&dbv);
}
@@ -587,7 +587,7 @@ INT_PTR CALLBACK DlgProcAddItem(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP wchar_t buff[256];
SendDlgItemMessage(hwndDlg, IDC_CMB_PRESETITEMS, CB_GETLBTEXT, sel, (LPARAM)buff);
for (int i = 0; presetItems[i].szID; i++) {
- if (mir_tstrcmp(buff, TranslateTS(presetItems[i].swzName)) == 0) {
+ if (mir_wstrcmp(buff, TranslateTS(presetItems[i].swzName)) == 0) {
if (presetItems[i].szNeededSubst[0])
EndDialog(hwndDlg, IDPRESETITEM + i);
else
@@ -623,7 +623,7 @@ INT_PTR CALLBACK DlgProcAddItem(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP wchar_t buff[256];
SendDlgItemMessage(hwndDlg, IDC_CMB_PRESETITEMS, CB_GETLBTEXT, sel, (LPARAM)buff);
for (int i = 0; presetItems[i].szID; i++) {
- if (mir_tstrcmp(buff, TranslateTS(presetItems[i].swzName)) == 0) {
+ if (mir_wstrcmp(buff, TranslateTS(presetItems[i].swzName)) == 0) {
SetDlgItemText(hwndDlg, IDC_ED_LABEL, TranslateTS(presetItems[i].swzLabel));
SetDlgItemText(hwndDlg, IDC_ED_VALUE, presetItems[i].swzValue);
break;
@@ -2038,8 +2038,8 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA while (item.hItem != NULL) {
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_PROTOS), &item);
if (((item.state & TVIS_STATEIMAGEMASK) >> 12) == 2) {
- mir_tstrcat(swzProtos, buff);
- mir_tstrcat(swzProtos, L" ");
+ mir_wstrcat(swzProtos, buff);
+ mir_wstrcat(swzProtos, L" ");
}
item.hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_FIRST_PROTOS), item.hItem);
@@ -2053,8 +2053,8 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA while (item.hItem != NULL) {
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_SECOND_PROTOS), &item);
if (((item.state & TVIS_STATEIMAGEMASK) >> 12) == 2) {
- mir_tstrcat(swzProtos, buff);
- mir_tstrcat(swzProtos, L" ");
+ mir_wstrcat(swzProtos, buff);
+ mir_wstrcat(swzProtos, L" ");
}
item.hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_SECOND_PROTOS), item.hItem);
diff --git a/plugins/TipperYM/src/popwin.cpp b/plugins/TipperYM/src/popwin.cpp index 2b0cbebb6b..117758d058 100644 --- a/plugins/TipperYM/src/popwin.cpp +++ b/plugins/TipperYM/src/popwin.cpp @@ -26,9 +26,9 @@ __inline void AddRow(PopupWindowData *pwd, wchar_t *swzLabel, wchar_t *swzValue, if (pRows == NULL) return; pwd->rows = pRows; - pwd->rows[pwd->iRowCount].swzLabel = swzLabel ? mir_tstrdup(swzLabel) : NULL; - pwd->rows[pwd->iRowCount].swzValue = swzValue ? mir_tstrdup(swzValue) : NULL; - pwd->rows[pwd->iRowCount].spi = bParseSmileys ? Smileys_PreParse(swzValue, (int)mir_tstrlen(swzValue), szProto) : NULL; + pwd->rows[pwd->iRowCount].swzLabel = swzLabel ? mir_wstrdup(swzLabel) : NULL; + pwd->rows[pwd->iRowCount].swzValue = swzValue ? mir_wstrdup(swzValue) : NULL; + pwd->rows[pwd->iRowCount].spi = bParseSmileys ? Smileys_PreParse(swzValue, (int)mir_wstrlen(swzValue), szProto) : NULL; pwd->rows[pwd->iRowCount].bValueNewline = bNewline; pwd->rows[pwd->iRowCount].bLineAbove = bLineAbove; pwd->rows[pwd->iRowCount].bIsTitle = bIsTitle; @@ -73,13 +73,13 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa PROTOACCOUNT *pa = Proto_GetAccount(pwd->clcit.szProto); if (pa) - mir_tstrcpy(pwd->swzTitle, pa->tszAccountName); + mir_wstrcpy(pwd->swzTitle, pa->tszAccountName); - if (mir_tstrlen(pwd->swzTitle) == 0) + if (mir_wstrlen(pwd->swzTitle) == 0) a2t(pwd->clcit.szProto, pwd->swzTitle, TITLE_TEXT_LEN); if (Proto_IsAccountLocked(pa)) - mir_sntprintf(pwd->swzTitle, TranslateT("%s (locked)"), pwd->swzTitle); + mir_snwprintf(pwd->swzTitle, TranslateT("%s (locked)"), pwd->swzTitle); // protocol status WORD wStatus = (WORD)CallProtoService(pwd->clcit.szProto, PS_GETSTATUS, 0, 0); @@ -99,7 +99,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa // uid info wchar_t swzUid[256], swzUidName[256]; if (Uid(0, pwd->clcit.szProto, swzUid, 256) && UidName(pwd->clcit.szProto, swzUidName, 253)) { - mir_tstrcat(swzUidName, L": "); + mir_wstrcat(swzUidName, L": "); AddRow(pwd, swzUidName, swzUid, NULL, false, false, false); } @@ -107,7 +107,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa wchar_t swzLogon[64]; if (TimestampToTimeDifference(NULL, pwd->clcit.szProto, "LogonTS", swzLogon, 59)) { wchar_t ago[96]; - mir_sntprintf(ago, TranslateT("%s ago"), swzLogon); + mir_snwprintf(ago, TranslateT("%s ago"), swzLogon); AddRow(pwd, TranslateT("Log on:"), ago, NULL, false, false, false); } @@ -127,7 +127,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (wStatus >= ID_STATUS_ONLINE && wStatus <= ID_STATUS_OUTTOLUNCH) { // status message - ptrT ptszStatus(GetProtoStatusMessage(pwd->clcit.szProto, wStatus)); + ptrW ptszStatus(GetProtoStatusMessage(pwd->clcit.szProto, wStatus)); if (ptszStatus) { StripBBCodesInPlace(ptszStatus); AddRow(pwd, TranslateT("Status message:"), ptszStatus, pwd->clcit.szProto, true, true, true); @@ -139,7 +139,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa StripBBCodesInPlace(swzAdvTitle); AddRow(pwd, TranslateT("Mood:"), swzAdvTitle, pwd->clcit.szProto, true, false, true); - ptrT swzAdvText(GetJabberAdvStatusText(pwd->clcit.szProto, "mood", "text")); + ptrW swzAdvText(GetJabberAdvStatusText(pwd->clcit.szProto, "mood", "text")); if (swzAdvText) { StripBBCodesInPlace(swzAdvText); AddRow(pwd, L"", swzAdvText, pwd->clcit.szProto, true, true, false); @@ -155,7 +155,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa } // xstatus message - ptrT swzAdvText(GetProtoExtraStatusMessage(pwd->clcit.szProto)); + ptrW swzAdvText(GetProtoExtraStatusMessage(pwd->clcit.szProto)); if (swzAdvText) { StripBBCodesInPlace(swzAdvText); AddRow(pwd, L"", swzAdvText, pwd->clcit.szProto, true, true, false); @@ -173,20 +173,20 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa } // jabber activity - ptrT swzActTitle(GetJabberAdvStatusText(pwd->clcit.szProto, "activity", "title")); + ptrW swzActTitle(GetJabberAdvStatusText(pwd->clcit.szProto, "activity", "title")); if (swzActTitle) { StripBBCodesInPlace(swzActTitle); AddRow(pwd, TranslateT("Activity:"), swzActTitle, pwd->clcit.szProto, true, false, true); } - ptrT swzActText(GetJabberAdvStatusText(pwd->clcit.szProto, "activity", "text")); + ptrW swzActText(GetJabberAdvStatusText(pwd->clcit.szProto, "activity", "text")); if (swzActText) { StripBBCodesInPlace(swzActText); AddRow(pwd, L"", swzActText, pwd->clcit.szProto, true, true, false); } // listening to - ptrT swzListening(GetListeningTo(pwd->clcit.szProto)); + ptrW swzListening(GetListeningTo(pwd->clcit.szProto)); if (swzListening) { StripBBCodesInPlace(swzListening); AddRow(pwd, TranslateT("Listening to:"), swzListening, NULL, false, true, true); @@ -218,7 +218,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa } else { wchar_t buff[2048], *swzText = pwd->clcit.swzText; - size_t iBuffPos, i = 0, iSize = mir_tstrlen(pwd->clcit.swzText); + size_t iBuffPos, i = 0, iSize = mir_wstrlen(pwd->clcit.swzText); bool bTopMessage = false; while (i < iSize && swzText[i] != '<') { @@ -262,7 +262,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (iBuffPos) { pwd->rows = (RowData *)mir_realloc(pwd->rows, sizeof(RowData)* (pwd->iRowCount + 1)); pwd->rows[pwd->iRowCount].bValueNewline = false; - pwd->rows[pwd->iRowCount].swzLabel = mir_tstrdup(buff); + pwd->rows[pwd->iRowCount].swzLabel = mir_wstrdup(buff); if (pwd->iRowCount == 1 && bTopMessage) pwd->rows[pwd->iRowCount].bLineAbove = true; else @@ -276,7 +276,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa } buff[iBuffPos] = 0; - pwd->rows[pwd->iRowCount].swzValue = mir_tstrdup(buff); + pwd->rows[pwd->iRowCount].swzValue = mir_wstrdup(buff); pwd->rows[pwd->iRowCount].spi = NULL; pwd->iRowCount++; } @@ -382,7 +382,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (pwd->bIsIconVisible[5]) { for (i = 0; opt.exIconsOrder[i] != 5; i++); if (ServiceExists(MS_FP_GETCLIENTICONT)) { - ptrT tszVersion(db_get_tsa(pwd->hContact, szProto, "MirVer")); + ptrW tszVersion(db_get_tsa(pwd->hContact, szProto, "MirVer")); if (tszVersion != NULL) { pwd->extraIcons[i].hIcon = Finger_GetClientIcon(tszVersion, 0); pwd->extraIcons[i].bDestroy = true; @@ -766,14 +766,14 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa for (int i = 0; i < pwd->iRowCount; i++) { if (pwd->rows[i].swzValue) { wchar_t buff[128]; - int iLen = (int)mir_tstrlen(pwd->rows[i].swzValue); + int iLen = (int)mir_wstrlen(pwd->rows[i].swzValue); if (iLen) { if (iLen > MAX_VALUE_LEN) { wcsncpy(buff, pwd->rows[i].swzValue, MAX_VALUE_LEN); buff[MAX_VALUE_LEN] = 0; - mir_tstrcat(buff, L"..."); + mir_wstrcat(buff, L"..."); } - else mir_tstrcpy(buff, pwd->rows[i].swzValue); + else mir_wstrcpy(buff, pwd->rows[i].swzValue); AppendMenu(hMenu, MF_STRING, i + 1, buff); // first id = 1, because no select have id = 0 SetMenuItemBitmaps(hMenu, i + 1, MF_BYCOMMAND, hbmpItem, hbmpItem); @@ -822,30 +822,30 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa for (int i = 0; i < pwd->iRowCount; i++) { if ((pwd->rows[i].swzLabel && pwd->rows[i].swzLabel[0]) || (pwd->rows[i].swzValue && pwd->rows[i].swzValue[0])) { if (pwd->rows[i].swzLabel && pwd->rows[i].swzLabel[0]) { - mir_tstrcat(pchData, pwd->rows[i].swzLabel); - mir_tstrcat(pchData, L" "); + mir_wstrcat(pchData, pwd->rows[i].swzLabel); + mir_wstrcat(pchData, L" "); } - else mir_tstrcat(pchData, TranslateT("<No Label>: ")); + else mir_wstrcat(pchData, TranslateT("<No Label>: ")); if (pwd->rows[i].swzValue && pwd->rows[i].swzValue[0]) - mir_tstrcat(pchData, pwd->rows[i].swzValue); + mir_wstrcat(pchData, pwd->rows[i].swzValue); else - mir_tstrcat(pchData, TranslateT("<No Value>")); + mir_wstrcat(pchData, TranslateT("<No Value>")); - mir_tstrcat(pchData, L"\r\n"); + mir_wstrcat(pchData, L"\r\n"); } } } else if (iSelItem == COPYMENU_ALLITEMS) { // copy all items for (int i = 0; i < pwd->iRowCount; i++) { if (pwd->rows[i].swzValue && pwd->rows[i].swzValue[0]) { - mir_tstrcat(pchData, pwd->rows[i].swzValue); - mir_tstrcat(pchData, L"\r\n"); + mir_wstrcat(pchData, pwd->rows[i].swzValue); + mir_wstrcat(pchData, L"\r\n"); } } } // single row - else mir_tstrcpy(pchData, pwd->rows[iSelItem - 1].swzValue); + else mir_wstrcpy(pchData, pwd->rows[iSelItem - 1].swzValue); GlobalUnlock(hClipboardData); SetClipboardData(CF_UNICODETEXT, hClipboardData); @@ -1055,9 +1055,9 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa char *szProto = GetContactProto(pwd->hContact); - pwd->rows[pwd->iRowCount].swzLabel = mir_tstrdup(buff_label); - pwd->rows[pwd->iRowCount].swzValue = mir_tstrdup(buff); - pwd->rows[pwd->iRowCount].spi = Smileys_PreParse(buff, (int)mir_tstrlen(buff), szProto); + pwd->rows[pwd->iRowCount].swzLabel = mir_wstrdup(buff_label); + pwd->rows[pwd->iRowCount].swzValue = mir_wstrdup(buff); + pwd->rows[pwd->iRowCount].spi = Smileys_PreParse(buff, (int)mir_wstrlen(buff), szProto); pwd->rows[pwd->iRowCount].bValueNewline = node->di.bValueNewline; pwd->rows[pwd->iRowCount].bLineAbove = node->di.bLineAbove; pwd->iRowCount++; @@ -1174,7 +1174,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa else if (hFontLabels) SelectObject(hdc, (HGDIOBJ)hFontLabels); - GetTextExtentPoint32(hdc, pwd->rows[i].swzLabel, (int)mir_tstrlen(pwd->rows[i].swzLabel), &sz); + GetTextExtentPoint32(hdc, pwd->rows[i].swzLabel, (int)mir_wstrlen(pwd->rows[i].swzLabel), &sz); if (sz.cx > pwd->iLabelWidth) pwd->iLabelWidth = sz.cx; } @@ -1189,7 +1189,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa SelectObject(hdc, (HGDIOBJ)hFontLabels); if (pwd->rows[i].swzLabel && pwd->rows[i].swzLabel[0]) - GetTextExtentPoint32(hdc, pwd->rows[i].swzLabel, (int)mir_tstrlen(pwd->rows[i].swzLabel), &sz); + GetTextExtentPoint32(hdc, pwd->rows[i].swzLabel, (int)mir_wstrlen(pwd->rows[i].swzLabel), &sz); else sz.cy = sz.cx = 0; @@ -1210,7 +1210,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (pwd->rows[i].swzValue && pwd->rows[i].swzValue[0]) { if (!bStatusMsg && opt.bGetNewStatusMsg) { - if (!mir_tstrcmp(pwd->rows[i].swzValue, L"%sys:status_msg%")) + if (!mir_wstrcmp(pwd->rows[i].swzValue, L"%sys:status_msg%")) bStatusMsg = true; } @@ -1484,15 +1484,15 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa iCountOnline++; iCount++; } - mir_sntprintf(buff, L"(%d/%d)", iCountOnline, iCount); + mir_snwprintf(buff, L"(%d/%d)", iCountOnline, iCount); } else buff[0] = 0; wchar_t swzProto[256]; - mir_tstrcpy(swzProto, pa->tszAccountName); + mir_wstrcpy(swzProto, pa->tszAccountName); if (dwItems & TRAYTIP_LOCKSTATUS) if (Proto_IsAccountLocked(pa)) - mir_sntprintf(swzProto, TranslateT("%s (locked)"), pa->tszAccountName); + mir_snwprintf(swzProto, TranslateT("%s (locked)"), pa->tszAccountName); AddRow(pwd, swzProto, buff, NULL, false, false, !bFirstItem, true, Skin_LoadProtoIcon(pa->szModuleName, wStatus)); bFirstItem = false; @@ -1500,7 +1500,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (dwItems & TRAYTIP_LOGON) { if (TimestampToTimeDifference(NULL, pa->szModuleName, "LogonTS", buff, 59)) { wchar_t ago[96]; - mir_sntprintf(ago, TranslateT("%s ago"), buff); + mir_snwprintf(ago, TranslateT("%s ago"), buff); AddRow(pwd, TranslateT("Log on:"), ago, NULL, false, false, false); } } @@ -1621,10 +1621,10 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa wchar_t *swzNick = (wchar_t *)pcli->pfnGetContactDisplayName(hContact, 0); if (opt.iFavoriteContFlags & FAVCONT_APPEND_PROTO) { wchar_t *swzProto = a2t(proto); - mir_sntprintf(swzName, L"%s (%s)", swzNick, swzProto); + mir_snwprintf(swzName, L"%s (%s)", swzNick, swzProto); mir_free(swzProto); } - else mir_tstrcpy(swzName, swzNick); + else mir_wstrcpy(swzName, swzNick); AddRow(pwd, swzName, swzStatus, NULL, false, false, false); } @@ -1638,8 +1638,8 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa index -= iCount; if (index >= 0 && (dwItems & TRAYTIP_NUMCONTACTS) && !((opt.iFavoriteContFlags & FAVCONT_HIDE_OFFLINE) && iCountOnline == 0)) { - mir_sntprintf(buff, L"(%d/%d)", iCountOnline, iCount); - pwd->rows[index].swzValue = mir_tstrdup(buff); + mir_snwprintf(buff, L"(%d/%d)", iCountOnline, iCount); + pwd->rows[index].swzValue = mir_wstrdup(buff); } } } @@ -1657,7 +1657,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (!pchBold || pchBold != pwd->clcit.swzText) { wchar_t swzText[256]; - mir_tstrcpy(swzText, pwd->clcit.swzText); + mir_wstrcpy(swzText, pwd->clcit.swzText); if (pchBr) swzText[pchBr - pwd->clcit.swzText] = 0; AddRow(pwd, swzText, L"", NULL, false, true, false, true, Skin_LoadIcon(SKINICON_OTHER_FILLEDBLOB)); } diff --git a/plugins/TipperYM/src/skin_parser.cpp b/plugins/TipperYM/src/skin_parser.cpp index 8bcb23daca..c115fd6643 100644 --- a/plugins/TipperYM/src/skin_parser.cpp +++ b/plugins/TipperYM/src/skin_parser.cpp @@ -34,7 +34,7 @@ int RefreshSkinList(HWND hwndDlg) HANDLE hFind = FindFirstFile(L"*.*", &ffd);
while (hFind != INVALID_HANDLE_VALUE)
{
- if ((ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && mir_tstrcmp(L".", ffd.cFileName) && mir_tstrcmp(L"..", ffd.cFileName))
+ if ((ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && mir_wstrcmp(L".", ffd.cFileName) && mir_wstrcmp(L"..", ffd.cFileName))
{
SetCurrentDirectory(ffd.cFileName);
WIN32_FIND_DATA ffd2;
@@ -88,9 +88,9 @@ void ParseAboutPart(FILE *fp, wchar_t *buff, wchar_t *szSkinName) else if (wcsstr(buff, L"preview"))
{
wchar_t szImgPath[1024];
- mir_sntprintf(szImgPath, L"%s\\%s\\%s", SKIN_FOLDER, szSkinName, pch);
+ mir_snwprintf(szImgPath, L"%s\\%s\\%s", SKIN_FOLDER, szSkinName, pch);
if (FileExists(szImgPath))
- mir_tstrcpy(opt.szPreviewFile, szImgPath);
+ mir_wstrcpy(opt.szPreviewFile, szImgPath);
}
}
}
@@ -126,26 +126,26 @@ void ParseImagePart(FILE *fp, wchar_t *buff, int iPart) if (wcsstr(buff, L"image"))
{
wchar_t szImgPath[1024];
- mir_sntprintf(szImgPath, L"%s\\%s\\%s", SKIN_FOLDER, opt.szSkinName, pch);
- opt.szImgFile[iPart] = mir_tstrdup(szImgPath);
+ mir_snwprintf(szImgPath, L"%s\\%s\\%s", SKIN_FOLDER, opt.szSkinName, pch);
+ opt.szImgFile[iPart] = mir_wstrdup(szImgPath);
}
else if (wcsstr(buff, L"tm"))
{
- if (!mir_tstrcmpi(pch, L"TM_NONE"))
+ if (!mir_wstrcmpi(pch, L"TM_NONE"))
opt.transfMode[iPart] = TM_NONE;
- else if (!mir_tstrcmpi(pch, L"TM_CENTRE"))
+ else if (!mir_wstrcmpi(pch, L"TM_CENTRE"))
opt.transfMode[iPart] = TM_CENTRE;
- else if (!mir_tstrcmpi(pch, L"TM_STRECH_ALL"))
+ else if (!mir_wstrcmpi(pch, L"TM_STRECH_ALL"))
opt.transfMode[iPart] = TM_STRECH_ALL;
- else if (!mir_tstrcmpi(pch, L"TM_STRECH_HORIZONTAL"))
+ else if (!mir_wstrcmpi(pch, L"TM_STRECH_HORIZONTAL"))
opt.transfMode[iPart] = TM_STRECH_HORIZONTAL;
- else if (!mir_tstrcmpi(pch, L"TM_STRECH_VERTICAL"))
+ else if (!mir_wstrcmpi(pch, L"TM_STRECH_VERTICAL"))
opt.transfMode[iPart] = TM_STRECH_VERTICAL;
- else if (!mir_tstrcmpi(pch, L"TM_TILE_ALL"))
+ else if (!mir_wstrcmpi(pch, L"TM_TILE_ALL"))
opt.transfMode[iPart] = TM_TILE_ALL;
- else if (!mir_tstrcmpi(pch, L"TM_TILE_HORIZONTAL"))
+ else if (!mir_wstrcmpi(pch, L"TM_TILE_HORIZONTAL"))
opt.transfMode[iPart] = TM_TILE_HORIZONTAL;
- else if (!mir_tstrcmpi(pch, L"TM_TILE_VERTICAL"))
+ else if (!mir_wstrcmpi(pch, L"TM_TILE_VERTICAL"))
opt.transfMode[iPart] = TM_TILE_VERTICAL;
else
opt.transfMode[iPart] = TM_NONE;
@@ -206,7 +206,7 @@ void ParseFontPart(FILE *fp, wchar_t *buff) {
if (GetSettingName(buff, "", szSetting, sizeof(szSetting) - 1))
{
- if (mir_tstrlen(pch) > 32)
+ if (mir_wstrlen(pch) > 32)
pch[32] = 0;
db_set_ts(0, MODULE, szSetting, pch);
@@ -362,34 +362,34 @@ void ParseSkinFile(wchar_t *szSkinName, bool bStartup, bool bOnlyPreview) {
if (buff[0] == '[')
{
- if (!mir_tstrcmp(L"[about]", buff))
+ if (!mir_wstrcmp(L"[about]", buff))
{
ParseAboutPart(fp, buff, szSkinName);
continue;
}
- else if (!mir_tstrcmp(L"[other]", buff))
+ else if (!mir_wstrcmp(L"[other]", buff))
{
ParseOtherPart(fp, buff);
continue;
}
else if (!bOnlyPreview)
{
- if (!mir_tstrcmp(L"[background]", buff))
+ if (!mir_wstrcmp(L"[background]", buff))
{
ParseImagePart(fp, buff, SKIN_ITEM_BG);
continue;
}
- else if (!mir_tstrcmp(L"[sidebar]", buff))
+ else if (!mir_wstrcmp(L"[sidebar]", buff))
{
ParseImagePart(fp, buff, SKIN_ITEM_SIDEBAR);
continue;
}
- else if (!bStartup && opt.bLoadFonts && !mir_tstrcmp(L"[fonts]", buff))
+ else if (!bStartup && opt.bLoadFonts && !mir_wstrcmp(L"[fonts]", buff))
{
ParseFontPart(fp, buff);
continue;
}
- else if (!bStartup && opt.bLoadProportions && !mir_tstrcmp(L"[appearance]", buff))
+ else if (!bStartup && opt.bLoadProportions && !mir_wstrcmp(L"[appearance]", buff))
{
ParseAppearancePart(fp, buff);
continue;
diff --git a/plugins/TipperYM/src/str_utils.cpp b/plugins/TipperYM/src/str_utils.cpp index ccc537581a..4d77c38c19 100644 --- a/plugins/TipperYM/src/str_utils.cpp +++ b/plugins/TipperYM/src/str_utils.cpp @@ -168,7 +168,7 @@ wchar_t *w2t(const wchar_t *ws) wchar_t *t2w(const wchar_t *ts)
{
- return mir_tstrdup(ts);
+ return mir_wstrdup(ts);
}
@@ -195,7 +195,7 @@ char *t2utf(const wchar_t *ts) wchar_t *myfgets(wchar_t *Buf, int MaxCount, FILE *File)
{
fgetws(Buf, MaxCount, File);
- for (size_t i = mir_tstrlen(Buf) - 1; ; i--)
+ for (size_t i = mir_wstrlen(Buf) - 1; ; i--)
{
if (Buf[i] == '\n' || Buf[i] == ' ')
Buf[i] = 0;
diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp index 071e73c212..bbcce4b4e7 100644 --- a/plugins/TipperYM/src/subst.cpp +++ b/plugins/TipperYM/src/subst.cpp @@ -85,7 +85,7 @@ void StripBBCodesInPlace(wchar_t *ptszText) return; size_t iRead = 0, iWrite = 0; - size_t iLen = mir_tstrlen(ptszText); + size_t iLen = mir_wstrlen(ptszText); while(iRead <= iLen) { // copy terminating null too while (iRead <= iLen && ptszText[iRead] != '[') { @@ -174,7 +174,7 @@ wchar_t* GetLastMessageText(MCONTACT hContact, bool received) return 0; wchar_t *buff = DbGetEventTextT( &dbei, CP_ACP ); - wchar_t *swzMsg = mir_tstrdup(buff); + wchar_t *swzMsg = mir_wstrdup(buff); mir_free(buff); StripBBCodesInPlace(swzMsg); @@ -221,8 +221,8 @@ wchar_t* GetStatusMessageText(MCONTACT hContact) return NULL; if (!db_get_ts(hContact, MODULE, "TempStatusMsg", &dbv)) { - if (mir_tstrlen(dbv.ptszVal) != 0) - swzMsg = mir_tstrdup(dbv.ptszVal); + if (mir_wstrlen(dbv.ptszVal) != 0) + swzMsg = mir_wstrdup(dbv.ptszVal); db_free(&dbv); } } @@ -233,8 +233,8 @@ wchar_t* GetStatusMessageText(MCONTACT hContact) return NULL; if (!db_get_ts(hContact, "CList", "StatusMsg", &dbv)) { - if (mir_tstrlen(dbv.ptszVal) != 0) - swzMsg = mir_tstrdup(dbv.ptszVal); + if (mir_wstrlen(dbv.ptszVal) != 0) + swzMsg = mir_wstrdup(dbv.ptszVal); db_free(&dbv); } } @@ -250,17 +250,17 @@ bool GetSysSubstText(MCONTACT hContact, wchar_t *swzRawSpec, wchar_t *buff, int { bool recv = false; - if (!mir_tstrcmp(swzRawSpec, L"uid")) + if (!mir_wstrcmp(swzRawSpec, L"uid")) return Uid(hContact, 0, buff, bufflen); - if (!mir_tstrcmp(swzRawSpec, L"proto")) { + if (!mir_wstrcmp(swzRawSpec, L"proto")) { char *szProto = GetContactProto(hContact); if (szProto) { a2t(szProto, buff, bufflen); return true; } } - else if (!mir_tstrcmp(swzRawSpec, L"account")) { + else if (!mir_wstrcmp(swzRawSpec, L"account")) { char *szProto = Proto_GetBaseAccountName(hContact); if ((INT_PTR)szProto == CALLSERVICE_NOTFOUND) { return GetSysSubstText(hContact, L"proto", buff, bufflen); @@ -275,15 +275,15 @@ bool GetSysSubstText(MCONTACT hContact, wchar_t *swzRawSpec, wchar_t *buff, int return GetSysSubstText(hContact, L"proto", buff, bufflen); } } - else if (!mir_tstrcmp(swzRawSpec, L"time")) { + else if (!mir_wstrcmp(swzRawSpec, L"time")) { if (!printDateTimeByContact(hContact, L"t", buff, bufflen, TZF_KNOWNONLY)) return true; } - else if (!mir_tstrcmp(swzRawSpec, L"uidname")) { + else if (!mir_wstrcmp(swzRawSpec, L"uidname")) { char *szProto = GetContactProto(hContact); return UidName(szProto, buff, bufflen); } - else if (!mir_tstrcmp(swzRawSpec, L"status_msg")) { + else if (!mir_wstrcmp(swzRawSpec, L"status_msg")) { wchar_t *swzMsg = GetStatusMessageText(hContact); if (swzMsg) { wcsncpy(buff, swzMsg, bufflen); @@ -291,7 +291,7 @@ bool GetSysSubstText(MCONTACT hContact, wchar_t *swzRawSpec, wchar_t *buff, int return true; } } - else if ((recv = !mir_tstrcmp(swzRawSpec, L"last_msg")) || !mir_tstrcmp(swzRawSpec, L"last_msg_out")) { + else if ((recv = !mir_wstrcmp(swzRawSpec, L"last_msg")) || !mir_wstrcmp(swzRawSpec, L"last_msg_out")) { wchar_t *swzMsg = GetLastMessageText(hContact, recv); if (swzMsg) { wcsncpy(buff, swzMsg, bufflen); @@ -299,7 +299,7 @@ bool GetSysSubstText(MCONTACT hContact, wchar_t *swzRawSpec, wchar_t *buff, int return true; } } - else if (!mir_tstrcmp(swzRawSpec, L"meta_subname")) { + else if (!mir_wstrcmp(swzRawSpec, L"meta_subname")) { // get contact list name of active subcontact MCONTACT hSubContact = db_mc_getMostOnline(hContact); if (!hSubContact) @@ -310,32 +310,32 @@ bool GetSysSubstText(MCONTACT hContact, wchar_t *swzRawSpec, wchar_t *buff, int wcsncpy(buff, swzNick, bufflen); return true; } - else if (!mir_tstrcmp(swzRawSpec, L"meta_subuid")) { + else if (!mir_wstrcmp(swzRawSpec, L"meta_subuid")) { MCONTACT hSubContact = db_mc_getMostOnline(hContact); if (!hSubContact || (INT_PTR)hSubContact == CALLSERVICE_NOTFOUND) return false; return Uid(hSubContact, 0, buff, bufflen); } - else if (!mir_tstrcmp(swzRawSpec, L"meta_subproto")) { + else if (!mir_wstrcmp(swzRawSpec, L"meta_subproto")) { // get protocol of active subcontact MCONTACT hSubContact = db_mc_getMostOnline(hContact); if (!hSubContact || (INT_PTR)hSubContact == CALLSERVICE_NOTFOUND) return false; return GetSysSubstText(hSubContact, L"account", buff, bufflen); } - else if ((recv = !mir_tstrcmp(swzRawSpec, L"last_msg_time")) || !mir_tstrcmp(swzRawSpec, L"last_msg_out_time")) { + else if ((recv = !mir_wstrcmp(swzRawSpec, L"last_msg_time")) || !mir_wstrcmp(swzRawSpec, L"last_msg_out_time")) { DWORD ts = LastMessageTimestamp(hContact, recv); if (ts == 0) return false; FormatTimestamp(ts, "t", buff, bufflen); return true; } - else if ((recv = !mir_tstrcmp(swzRawSpec, L"last_msg_date")) || !mir_tstrcmp(swzRawSpec, L"last_msg_out_date")) { + else if ((recv = !mir_wstrcmp(swzRawSpec, L"last_msg_date")) || !mir_wstrcmp(swzRawSpec, L"last_msg_out_date")) { DWORD ts = LastMessageTimestamp(hContact, recv); if (ts == 0) return false; FormatTimestamp(ts, "d", buff, bufflen); return true; } - else if ((recv = !mir_tstrcmp(swzRawSpec, L"last_msg_reltime")) || !mir_tstrcmp(swzRawSpec, L"last_msg_out_reltime")) { + else if ((recv = !mir_wstrcmp(swzRawSpec, L"last_msg_reltime")) || !mir_wstrcmp(swzRawSpec, L"last_msg_out_reltime")) { DWORD ts = LastMessageTimestamp(hContact, recv); if (ts == 0) return false; DWORD t = (DWORD)time(0); @@ -343,12 +343,12 @@ bool GetSysSubstText(MCONTACT hContact, wchar_t *swzRawSpec, wchar_t *buff, int int d = (diff / 60 / 60 / 24); int h = (diff - d * 60 * 60 * 24) / 60 / 60; int m = (diff - d * 60 * 60 * 24 - h * 60 * 60) / 60; - if (d > 0) mir_sntprintf(buff, bufflen, TranslateT("%dd %dh %dm"), d, h, m); - else if (h > 0) mir_sntprintf(buff, bufflen, TranslateT("%dh %dm"), h, m); - else mir_sntprintf(buff, bufflen, TranslateT("%dm"), m); + if (d > 0) mir_snwprintf(buff, bufflen, TranslateT("%dd %dh %dm"), d, h, m); + else if (h > 0) mir_snwprintf(buff, bufflen, TranslateT("%dh %dm"), h, m); + else mir_snwprintf(buff, bufflen, TranslateT("%dm"), m); return true; } - else if (!mir_tstrcmp(swzRawSpec, L"msg_count_all") || !mir_tstrcmp(swzRawSpec, L"msg_count_out") || !mir_tstrcmp(swzRawSpec, L"msg_count_in")) { + else if (!mir_wstrcmp(swzRawSpec, L"msg_count_all") || !mir_wstrcmp(swzRawSpec, L"msg_count_out") || !mir_wstrcmp(swzRawSpec, L"msg_count_in")) { DWORD dwCountOut, dwCountIn; DWORD dwMetaCountOut = 0, dwMetaCountIn = 0; DWORD dwLastTs, dwNewTs, dwRecountTs; @@ -406,12 +406,12 @@ bool GetSysSubstText(MCONTACT hContact, wchar_t *swzRawSpec, wchar_t *buff, int dwMetaCountIn += dwCountIn; } - if (!mir_tstrcmp(swzRawSpec, L"msg_count_out")) - mir_sntprintf(buff, bufflen, L"%d", dwMetaCountOut); - else if (!mir_tstrcmp(swzRawSpec, L"msg_count_in")) - mir_sntprintf(buff, bufflen, L"%d", dwMetaCountIn); + if (!mir_wstrcmp(swzRawSpec, L"msg_count_out")) + mir_snwprintf(buff, bufflen, L"%d", dwMetaCountOut); + else if (!mir_wstrcmp(swzRawSpec, L"msg_count_in")) + mir_snwprintf(buff, bufflen, L"%d", dwMetaCountIn); else - mir_sntprintf(buff, bufflen, L"%d", dwMetaCountOut + dwMetaCountIn); + mir_snwprintf(buff, bufflen, L"%d", dwMetaCountOut + dwMetaCountIn); return true; } @@ -475,9 +475,9 @@ bool ApplySubst(MCONTACT hContact, const wchar_t *swzSource, bool parseTipperVar } // pass to variables plugin if available - wchar_t *swzVarSrc = (parseTipperVarsFirst ? mir_tstrdup(swzSource) : variables_parsedup((wchar_t *)swzSource, 0, hContact)); + wchar_t *swzVarSrc = (parseTipperVarsFirst ? mir_wstrdup(swzSource) : variables_parsedup((wchar_t *)swzSource, 0, hContact)); - size_t iSourceLen = mir_tstrlen(swzVarSrc); + size_t iSourceLen = mir_wstrlen(swzVarSrc); size_t si = 0, di = 0, v = 0; wchar_t swzVName[LABEL_LEN], swzRep[VALUE_LEN], swzAlt[VALUE_LEN]; @@ -555,13 +555,13 @@ bool ApplySubst(MCONTACT hContact, const wchar_t *swzSource, bool parseTipperVar if (p) { *p = 0; // clip swzAlt from swzVName p++; - if (mir_tstrlen(p) > 4 && wcsncmp(p, L"raw:", 4) == 0) { // raw db substitution + if (mir_wstrlen(p) > 4 && wcsncmp(p, L"raw:", 4) == 0) { // raw db substitution char raw_spec[LABEL_LEN]; p += 4; t2a(p, raw_spec, LABEL_LEN); GetRawSubstText(hContact, raw_spec, swzAlt, VALUE_LEN); } - else if (mir_tstrlen(p) > 4 && wcsncmp(p, L"sys:", 4) == 0) { // 'system' substitution + else if (mir_wstrlen(p) > 4 && wcsncmp(p, L"sys:", 4) == 0) { // 'system' substitution p += 4; GetSysSubstText(hContact, p, swzAlt, VALUE_LEN); } @@ -569,7 +569,7 @@ bool ApplySubst(MCONTACT hContact, const wchar_t *swzSource, bool parseTipperVar // see if we can find the bSubst DSListNode *ds_node = opt.dsList; while (ds_node) { - if (mir_tstrcmp(ds_node->ds.swzName, p) == 0) + if (mir_wstrcmp(ds_node->ds.swzName, p) == 0) break; ds_node = ds_node->next; @@ -583,7 +583,7 @@ bool ApplySubst(MCONTACT hContact, const wchar_t *swzSource, bool parseTipperVar } } swzAlt[VALUE_LEN - 1] = 0; - if (mir_tstrlen(swzAlt) != 0) + if (mir_wstrlen(swzAlt) != 0) bAltSubst = true; } @@ -602,7 +602,7 @@ bool ApplySubst(MCONTACT hContact, const wchar_t *swzSource, bool parseTipperVar // see if we can find the bSubst DSListNode *ds_node = opt.dsList; while (ds_node) { - if (mir_tstrcmp(ds_node->ds.swzName, swzVName) == 0) + if (mir_wstrcmp(ds_node->ds.swzName, swzVName) == 0) break; ds_node = ds_node->next; @@ -615,12 +615,12 @@ bool ApplySubst(MCONTACT hContact, const wchar_t *swzSource, bool parseTipperVar } if (bSubst) { - size_t rep_len = mir_tstrlen(swzRep); + size_t rep_len = mir_wstrlen(swzRep); wcsncpy(&swzDest[di], swzRep, min(rep_len, iDestLen - di)); di += rep_len - 1; // -1 because we inc at bottom of loop } else if (bAltSubst) { - size_t alt_len = mir_tstrlen(swzAlt); + size_t alt_len = mir_wstrlen(swzAlt); wcsncpy(&swzDest[di], swzAlt, min(alt_len, iDestLen - di)); di += alt_len - 1; // -1 because we inc at bottom of loop } @@ -677,9 +677,9 @@ bool GetValueText(MCONTACT hContact, const DISPLAYITEM &di, wchar_t *buff, size_ void TruncateString(wchar_t *ptszText) { if (ptszText && opt.iLimitCharCount > 3) { - if ((int)mir_tstrlen(ptszText) > opt.iLimitCharCount) { + if ((int)mir_wstrlen(ptszText) > opt.iLimitCharCount) { ptszText[opt.iLimitCharCount - 3] = 0; - mir_tstrcat(ptszText, L"..."); + mir_wstrcat(ptszText, L"..."); } } } @@ -702,7 +702,7 @@ wchar_t* GetProtoStatusMessage(char *szProto, WORD wStatus) // try to use service without SGMA_TCHAR char *tmpMsg = (char *)CallProtoService(szProto, PS_GETMYAWAYMSG, 0, 0); if (tmpMsg && (INT_PTR)tmpMsg != CALLSERVICE_NOTFOUND) { - ptszText = mir_a2t(tmpMsg); + ptszText = mir_a2u(tmpMsg); mir_free(tmpMsg); } } @@ -728,7 +728,7 @@ wchar_t* GetProtoExtraStatusTitle(char *szProto) if (!ptszText) { wchar_t buff[256]; if (EmptyXStatusToDefaultName(0, szProto, 0, buff, 256)) - ptszText = mir_tstrdup(buff); + ptszText = mir_wstrdup(buff); } if (opt.bLimitMsg) diff --git a/plugins/TipperYM/src/tipper.cpp b/plugins/TipperYM/src/tipper.cpp index 770d1348ce..4442d56285 100644 --- a/plugins/TipperYM/src/tipper.cpp +++ b/plugins/TipperYM/src/tipper.cpp @@ -124,8 +124,8 @@ int ReloadSkinFolder(WPARAM, LPARAM) void InitFonts()
{
colourBg.cbSize = sizeof(ColourIDT);
- mir_tstrcpy(colourBg.group, LPGENW("Tooltips"));
- mir_tstrcpy(colourBg.name, LPGENW("Background"));
+ mir_wstrcpy(colourBg.group, LPGENW("Tooltips"));
+ mir_wstrcpy(colourBg.name, LPGENW("Background"));
mir_strcpy(colourBg.dbSettingsGroup, MODULE);
mir_strcpy(colourBg.setting, "ColourBg");
colourBg.defcolour = RGB(219, 219, 219);
@@ -133,8 +133,8 @@ void InitFonts() ColourRegisterT(&colourBg);
colourBorder.cbSize = sizeof(ColourIDT);
- mir_tstrcpy(colourBorder.group, LPGENW("Tooltips"));
- mir_tstrcpy(colourBorder.name, LPGENW("Border"));
+ mir_wstrcpy(colourBorder.group, LPGENW("Tooltips"));
+ mir_wstrcpy(colourBorder.name, LPGENW("Border"));
mir_strcpy(colourBorder.dbSettingsGroup, MODULE);
mir_strcpy(colourBorder.setting, "BorderCol");
colourBorder.defcolour = 0;
@@ -142,8 +142,8 @@ void InitFonts() ColourRegisterT(&colourBorder);
colourAvatarBorder.cbSize = sizeof(ColourIDT);
- mir_tstrcpy(colourAvatarBorder.group, LPGENW("Tooltips"));
- mir_tstrcpy(colourAvatarBorder.name, LPGENW("Avatar border"));
+ mir_wstrcpy(colourAvatarBorder.group, LPGENW("Tooltips"));
+ mir_wstrcpy(colourAvatarBorder.name, LPGENW("Avatar border"));
mir_strcpy(colourAvatarBorder.dbSettingsGroup, MODULE);
mir_strcpy(colourAvatarBorder.setting, "AvBorderCol");
colourAvatarBorder.defcolour = 0;
@@ -151,8 +151,8 @@ void InitFonts() ColourRegisterT(&colourAvatarBorder);
colourDivider.cbSize = sizeof(ColourIDT);
- mir_tstrcpy(colourDivider.group, LPGENW("Tooltips"));
- mir_tstrcpy(colourDivider.name, LPGENW("Dividers"));
+ mir_wstrcpy(colourDivider.group, LPGENW("Tooltips"));
+ mir_wstrcpy(colourDivider.name, LPGENW("Dividers"));
mir_strcpy(colourDivider.dbSettingsGroup, MODULE);
mir_strcpy(colourDivider.setting, "DividerCol");
colourDivider.defcolour = 0;
@@ -160,8 +160,8 @@ void InitFonts() ColourRegisterT(&colourDivider);
colourSidebar.cbSize = sizeof(ColourIDT);
- mir_tstrcpy(colourSidebar.group, LPGENW("Tooltips"));
- mir_tstrcpy(colourSidebar.name, LPGENW("Sidebar"));
+ mir_wstrcpy(colourSidebar.group, LPGENW("Tooltips"));
+ mir_wstrcpy(colourSidebar.name, LPGENW("Sidebar"));
mir_strcpy(colourSidebar.dbSettingsGroup, MODULE);
mir_strcpy(colourSidebar.setting, "SidebarCol");
colourSidebar.defcolour = RGB(192, 192, 192);
@@ -170,12 +170,12 @@ void InitFonts() fontTitle.cbSize = sizeof(FontIDT);
fontTitle.flags = FIDF_ALLOWEFFECTS;
- mir_tstrcpy(fontTitle.group, LPGENW("Tooltips"));
- mir_tstrcpy(fontTitle.name, LPGENW("Title"));
+ mir_wstrcpy(fontTitle.group, LPGENW("Tooltips"));
+ mir_wstrcpy(fontTitle.name, LPGENW("Title"));
mir_strcpy(fontTitle.dbSettingsGroup, MODULE);
mir_strcpy(fontTitle.prefix, "FontFirst");
- mir_tstrcpy(fontTitle.backgroundGroup, LPGENW("Tooltips"));
- mir_tstrcpy(fontTitle.backgroundName, LPGENW("Background"));
+ mir_wstrcpy(fontTitle.backgroundGroup, LPGENW("Tooltips"));
+ mir_wstrcpy(fontTitle.backgroundName, LPGENW("Background"));
fontTitle.order = 0;
fontTitle.deffontsettings.charset = DEFAULT_CHARSET;
@@ -186,12 +186,12 @@ void InitFonts() fontLabels.cbSize = sizeof(FontIDT);
fontLabels.flags = FIDF_ALLOWEFFECTS;
- mir_tstrcpy(fontLabels.group, LPGENW("Tooltips"));
- mir_tstrcpy(fontLabels.name, LPGENW("Labels"));
+ mir_wstrcpy(fontLabels.group, LPGENW("Tooltips"));
+ mir_wstrcpy(fontLabels.name, LPGENW("Labels"));
mir_strcpy(fontLabels.dbSettingsGroup, MODULE);
mir_strcpy(fontLabels.prefix, "FontLabels");
- mir_tstrcpy(fontLabels.backgroundGroup, LPGENW("Tooltips"));
- mir_tstrcpy(fontLabels.backgroundName, LPGENW("Background"));
+ mir_wstrcpy(fontLabels.backgroundGroup, LPGENW("Tooltips"));
+ mir_wstrcpy(fontLabels.backgroundName, LPGENW("Background"));
fontLabels.order = 1;
fontLabels.deffontsettings.charset = DEFAULT_CHARSET;
@@ -202,12 +202,12 @@ void InitFonts() fontValues.cbSize = sizeof(FontIDT);
fontValues.flags = FIDF_ALLOWEFFECTS;
- mir_tstrcpy(fontValues.group, LPGENW("Tooltips"));
- mir_tstrcpy(fontValues.name, LPGENW("Values"));
+ mir_wstrcpy(fontValues.group, LPGENW("Tooltips"));
+ mir_wstrcpy(fontValues.name, LPGENW("Values"));
mir_strcpy(fontValues.dbSettingsGroup, MODULE);
mir_strcpy(fontValues.prefix, "FontValues");
- mir_tstrcpy(fontValues.backgroundGroup, LPGENW("Tooltips"));
- mir_tstrcpy(fontValues.backgroundName, LPGENW("Background"));
+ mir_wstrcpy(fontValues.backgroundGroup, LPGENW("Tooltips"));
+ mir_wstrcpy(fontValues.backgroundName, LPGENW("Background"));
fontValues.order = 2;
fontValues.deffontsettings.charset = DEFAULT_CHARSET;
@@ -218,12 +218,12 @@ void InitFonts() fontTrayTitle.cbSize = sizeof(FontIDT);
fontTrayTitle.flags = FIDF_ALLOWEFFECTS;
- mir_tstrcpy(fontTrayTitle.group, LPGENW("Tooltips"));
- mir_tstrcpy(fontTrayTitle.name, LPGENW("Tray title"));
+ mir_wstrcpy(fontTrayTitle.group, LPGENW("Tooltips"));
+ mir_wstrcpy(fontTrayTitle.name, LPGENW("Tray title"));
mir_strcpy(fontTrayTitle.dbSettingsGroup, MODULE);
mir_strcpy(fontTrayTitle.prefix, "FontTrayTitle");
- mir_tstrcpy(fontTrayTitle.backgroundGroup, LPGENW("Tooltips"));
- mir_tstrcpy(fontTrayTitle.backgroundName, LPGENW("Background"));
+ mir_wstrcpy(fontTrayTitle.backgroundGroup, LPGENW("Tooltips"));
+ mir_wstrcpy(fontTrayTitle.backgroundName, LPGENW("Background"));
fontTrayTitle.order = 0;
fontTrayTitle.deffontsettings.charset = DEFAULT_CHARSET;
diff --git a/plugins/TipperYM/src/translations.cpp b/plugins/TipperYM/src/translations.cpp index 87679f08a7..879f100f5d 100644 --- a/plugins/TipperYM/src/translations.cpp +++ b/plugins/TipperYM/src/translations.cpp @@ -35,11 +35,11 @@ void AddTranslation(DBVTranslation *newTrans) iTransFuncsCount++;
translations[iTransFuncsCount - 1] = *newTrans;
- char *szName = mir_t2a(newTrans->swzName);
+ char *szName = mir_u2a(newTrans->swzName);
char szSetting[256];
mir_snprintf(szSetting, sizeof(szSetting),"Trans_%s",szName);
- if (mir_tstrcmp(newTrans->swzName, L"[No translation]") == 0)
+ if (mir_wstrcmp(newTrans->swzName, L"[No translation]") == 0)
{
translations[iTransFuncsCount - 1].id = 0;
}
@@ -117,11 +117,11 @@ wchar_t* TimestampToTimeDifference(MCONTACT hContact, const char *szModuleName, int h = (diff - d * 60 * 60 * 24) / 60 / 60;
int m = (diff - d * 60 * 60 * 24 - h * 60 * 60) / 60;
if (d > 0)
- mir_sntprintf(buff, bufflen, TranslateT("%dd %dh %dm"), d, h, m);
+ mir_snwprintf(buff, bufflen, TranslateT("%dd %dh %dm"), d, h, m);
else if (h > 0)
- mir_sntprintf(buff, bufflen, TranslateT("%dh %dm"), h, m);
+ mir_snwprintf(buff, bufflen, TranslateT("%dh %dm"), h, m);
else
- mir_sntprintf(buff, bufflen, TranslateT("%dm"), m);
+ mir_snwprintf(buff, bufflen, TranslateT("%dm"), m);
return buff;
}
@@ -133,11 +133,11 @@ wchar_t *SecondsToTimeDifference(MCONTACT hContact, const char *szModuleName, co int h = (diff - d * 60 * 60 * 24) / 60 / 60;
int m = (diff - d * 60 * 60 * 24 - h * 60 * 60) / 60;
if (d > 0)
- mir_sntprintf(buff, bufflen, TranslateT("%dd %dh %dm"), d, h, m);
+ mir_snwprintf(buff, bufflen, TranslateT("%dd %dh %dm"), d, h, m);
else if (h > 0)
- mir_sntprintf(buff, bufflen, TranslateT("%dh %dm"), h, m);
+ mir_snwprintf(buff, bufflen, TranslateT("%dh %dm"), h, m);
else
- mir_sntprintf(buff, bufflen, TranslateT("%dm"), m);
+ mir_snwprintf(buff, bufflen, TranslateT("%dm"), m);
return buff;
}
@@ -204,7 +204,7 @@ wchar_t *DwordToIp(MCONTACT hContact, const char *szModuleName, const char *szSe DWORD ip = db_get_dw(hContact, szModuleName, szSettingName, 0);
if (ip) {
unsigned char *ipc = (unsigned char*)&ip;
- mir_sntprintf(buff, bufflen, L"%u.%u.%u.%u", ipc[3], ipc[2], ipc[1], ipc[0]);
+ mir_snwprintf(buff, bufflen, L"%u.%u.%u.%u", ipc[3], ipc[2], ipc[1], ipc[0]);
return buff;
}
return 0;
@@ -306,7 +306,7 @@ wchar_t *DayMonthYearToAge(MCONTACT hContact, const char *szModuleName, const ch int age = now.wYear - year;
if (now.wMonth < month || (now.wMonth == month && now.wDay < day))
age--;
- mir_sntprintf(buff, bufflen, L"%d", age);
+ mir_snwprintf(buff, bufflen, L"%d", age);
return buff;
}
else
@@ -473,13 +473,13 @@ wchar_t *DmyToTimeDifference(MCONTACT hContact, const char *szModuleName, const int h = (diff - y * 60 * 60 * 24 * 365 - d * 60 * 60 * 24) / 60 / 60;
int m = (diff - y * 60 * 60 * 24 * 365 - d * 60 * 60 * 24 - h * 60 * 60) / 60;
if (y != 0)
- mir_sntprintf(buff, bufflen, TranslateT("%dy %dd %dh %dm"), y, d, h, m);
+ mir_snwprintf(buff, bufflen, TranslateT("%dy %dd %dh %dm"), y, d, h, m);
else if (d != 0)
- mir_sntprintf(buff, bufflen, TranslateT("%dd %dh %dm"), d, h, m);
+ mir_snwprintf(buff, bufflen, TranslateT("%dd %dh %dm"), d, h, m);
else if (h != 0)
- mir_sntprintf(buff, bufflen, TranslateT("%dh %dm"), h, m);
+ mir_snwprintf(buff, bufflen, TranslateT("%dh %dm"), h, m);
else
- mir_sntprintf(buff, bufflen, TranslateT("%dm"), m);
+ mir_snwprintf(buff, bufflen, TranslateT("%dm"), m);
return buff;
}
@@ -539,7 +539,7 @@ wchar_t *DayMonthToDaysToNextBirthday(MCONTACT hContact, const char *szModuleNam }
int diff = yday_birth - yday_now;
- mir_sntprintf(buff, bufflen, TranslateT("%dd"), diff);
+ mir_snwprintf(buff, bufflen, TranslateT("%dd"), diff);
return buff;
}
diff --git a/plugins/Toaster/src/services.cpp b/plugins/Toaster/src/services.cpp index 1b921690dc..95bfc49a8b 100644 --- a/plugins/Toaster/src/services.cpp +++ b/plugins/Toaster/src/services.cpp @@ -12,7 +12,7 @@ void __stdcall ShowToastNotification(void* p) if (!db_get_b(0, "Popup", "ModuleIsEnabled", 1))
return;
- ptrT imagePath;
+ ptrW imagePath;
if (td->hContact != NULL && td->hContact != INVALID_CONTACT_ID)
{
const char* szProto = GetContactProto(td->hContact);
@@ -21,7 +21,7 @@ void __stdcall ShowToastNotification(void* p) PROTO_AVATAR_INFORMATION pai = { td->hContact };
if (CallProtoService(szProto, PS_GETAVATARINFO, 0, (LPARAM)&pai) == GAIR_SUCCESS)
{
- imagePath = mir_tstrdup(pai.filename);
+ imagePath = mir_wstrdup(pai.filename);
}
}
@@ -140,7 +140,7 @@ static INT_PTR CreateClassPopup(WPARAM, LPARAM lParam) }
else
{
- td = new ToastData(ppc->hContact, ptrT(mir_utf8decodeT(ppc->pszTitle)), ptrT(mir_utf8decodeT(ppc->pszText)), it->second->hIcon);
+ td = new ToastData(ppc->hContact, ptrW(mir_utf8decodeW(ppc->pszTitle)), ptrW(mir_utf8decodeW(ppc->pszText)), it->second->hIcon);
}
td->vPopupData = ppc->PluginData;
diff --git a/plugins/Toaster/src/structs.h b/plugins/Toaster/src/structs.h index fe8a658850..96900ce785 100644 --- a/plugins/Toaster/src/structs.h +++ b/plugins/Toaster/src/structs.h @@ -17,8 +17,8 @@ struct ToastData : public MZeroedObject ToastData(MCONTACT _hContact, const wchar_t *_tszTitle, const wchar_t *_tszText, HICON _hIcon = NULL) :
hContact(_hContact),
- tszTitle(mir_tstrdup(_tszTitle)),
- tszText(mir_tstrdup(_tszText)),
+ tszTitle(mir_wstrdup(_tszTitle)),
+ tszText(mir_wstrdup(_tszText)),
hIcon(_hIcon),
iType(_hIcon ? 2 : 0) ,
pPopupProc(NULL),
@@ -26,8 +26,8 @@ struct ToastData : public MZeroedObject {}
ToastData(MCONTACT _hContact, const wchar_t *_tszTitle, const wchar_t *_tszText, HBITMAP bmp = NULL) :
hContact(_hContact),
- tszTitle(mir_tstrdup(_tszTitle)),
- tszText(mir_tstrdup(_tszText)),
+ tszTitle(mir_wstrdup(_tszTitle)),
+ tszText(mir_wstrdup(_tszText)),
hBitmap(bmp),
iType(bmp ? 1 : 0),
pPopupProc(NULL),
diff --git a/plugins/Toaster/src/toast_notification.cpp b/plugins/Toaster/src/toast_notification.cpp index 2df72af9ad..0ade7ce217 100644 --- a/plugins/Toaster/src/toast_notification.cpp +++ b/plugins/Toaster/src/toast_notification.cpp @@ -64,7 +64,7 @@ HRESULT ToastNotification::CreateXml(_Outptr_ ABI::Windows::Data::Xml::Dom::IXml }
int nLength;
- ptrT xtmp(xmlToString(xmlToast, &nLength));
+ ptrW xtmp(xmlToString(xmlToast, &nLength));
xmlDestroyNode(xmlToast);
CHECKHR(xmlDocument->LoadXml(StringReferenceWrapper(xtmp, nLength).Get()));
diff --git a/plugins/Toaster/src/utils.h b/plugins/Toaster/src/utils.h index 85547164ab..fe9e5998bd 100644 --- a/plugins/Toaster/src/utils.h +++ b/plugins/Toaster/src/utils.h @@ -8,7 +8,7 @@ extern wchar_t wszTempDir[]; class ToasterImage
{
HBITMAP _hBitmap;
- ptrT tszId;
+ ptrW tszId;
public:
__inline explicit ToasterImage(HICON hIcon) : _hBitmap(NULL), tszId(CMString(FORMAT, L"%p", hIcon).Detach())
@@ -25,7 +25,7 @@ public: {
}
- __inline explicit ToasterImage(const char *szProto) : _hBitmap(NULL), tszId(mir_a2t(szProto))
+ __inline explicit ToasterImage(const char *szProto) : _hBitmap(NULL), tszId(mir_a2u(szProto))
{
ICONINFO icon = { 0 };
if (GetIconInfo(Skin_LoadProtoIcon(szProto, ID_STATUS_ONLINE, 1), &icon))
diff --git a/plugins/TooltipNotify/src/Tooltip.cpp b/plugins/TooltipNotify/src/Tooltip.cpp index 9f9edc03e4..9289c34824 100644 --- a/plugins/TooltipNotify/src/Tooltip.cpp +++ b/plugins/TooltipNotify/src/Tooltip.cpp @@ -147,7 +147,7 @@ void CTooltip::Validate() SIZE Size;
HDC hDC = GetDC(m_hWnd);
SelectObject(hDC, m_hFont);
- GetTextExtentPoint32(hDC, m_szText, (int)mir_tstrlen(m_szText), &Size);
+ GetTextExtentPoint32(hDC, m_szText, (int)mir_wstrlen(m_szText), &Size);
SetWindowPos(m_hWnd, 0, 0, 0, Size.cx+6, Size.cy+4,
SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOREDRAW);
ReleaseDC(m_hWnd, hDC);
diff --git a/plugins/TooltipNotify/src/TooltipNotify.cpp b/plugins/TooltipNotify/src/TooltipNotify.cpp index 3bb08f45ad..2d7988e339 100644 --- a/plugins/TooltipNotify/src/TooltipNotify.cpp +++ b/plugins/TooltipNotify/src/TooltipNotify.cpp @@ -537,7 +537,7 @@ BOOL CTooltipNotify::OptionsDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l case WM_VSCROLL:
case WM_HSCROLL:
wchar_t str[10];
- mir_sntprintf(str, L"%d%%", 100 * SendDlgItemMessage(hDlg, IDC_TRANSPARENCY_SLIDER, TBM_GETPOS, 0, 0) / 255);
+ mir_snwprintf(str, L"%d%%", 100 * SendDlgItemMessage(hDlg, IDC_TRANSPARENCY_SLIDER, TBM_GETPOS, 0, 0) / 255);
SetDlgItemText(hDlg, IDC_TRANSPERC, str);
if (wParam != 0x12345678)
SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0);
@@ -679,7 +679,7 @@ BOOL CTooltipNotify::ProtosDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM) ListView_GetItemText(GetDlgItem(hDlg, IDC_PROTOS), i, 0, szProto, _countof(szProto));
char szMultiByteProto[128];
- long lLen = WideCharToMultiByte(CP_ACP, 0, szProto, (int)mir_tstrlen(szProto),
+ long lLen = WideCharToMultiByte(CP_ACP, 0, szProto, (int)mir_wstrlen(szProto),
szMultiByteProto, sizeof(szMultiByteProto), NULL, NULL);
szMultiByteProto[lLen] = '\0';
@@ -799,23 +799,23 @@ BOOL CTooltipNotify::ContactsDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM) wchar_t* CTooltipNotify::StatusToString(int iStatus, wchar_t *szStatus, int iBufSize)
{
if (iStatus >= ID_STATUS_OFFLINE && iStatus <= ID_STATUS_OUTTOLUNCH)
- mir_tstrncpy(szStatus, pcli->pfnGetStatusModeDescription(iStatus, 0), iBufSize);
+ mir_wstrncpy(szStatus, pcli->pfnGetStatusModeDescription(iStatus, 0), iBufSize);
else {
switch (iStatus) {
case ID_TTNTF_STATUS_TYPING:
- mir_tstrncpy(szStatus, TranslateT("Typing"), iBufSize);
+ mir_wstrncpy(szStatus, TranslateT("Typing"), iBufSize);
break;
case ID_TTNTF_STATUS_IDLE:
- mir_tstrncpy(szStatus, TranslateT("Idle"), iBufSize);
+ mir_wstrncpy(szStatus, TranslateT("Idle"), iBufSize);
break;
case ID_TTNTF_STATUS_NOT_IDLE:
- mir_tstrncpy(szStatus, TranslateT("Not Idle"), iBufSize);
+ mir_wstrncpy(szStatus, TranslateT("Not Idle"), iBufSize);
break;
default:
- mir_tstrncpy(szStatus, TranslateT("Unknown"), iBufSize);
+ mir_wstrncpy(szStatus, TranslateT("Unknown"), iBufSize);
break;
}
}
@@ -841,11 +841,11 @@ wchar_t* CTooltipNotify::MakeTooltipString(MCONTACT hContact, int iStatus, wchar long lLen = MultiByteToWideChar(CP_ACP, 0, szProto, (int)mir_strlen(szProto), wszProto, _countof(wszProto));
wszProto[lLen] = '\0';
- mir_sntprintf(szString, iBufSize - 1, szFormatString, wszProto, L": ", szContactName);
+ mir_snwprintf(szString, iBufSize - 1, szFormatString, wszProto, L": ", szContactName);
- TruncateWithDots(szString, iBufSize - 1 - mir_tstrlen(szStatus) - mir_tstrlen(szIs) - 2); // 2 spaces around szIs
- mir_sntprintf(szString + mir_tstrlen(szString), iBufSize - 1 - mir_tstrlen(szString), L" %s %s", szIs, szStatus);
+ TruncateWithDots(szString, iBufSize - 1 - mir_wstrlen(szStatus) - mir_wstrlen(szIs) - 2); // 2 spaces around szIs
+ mir_snwprintf(szString + mir_wstrlen(szString), iBufSize - 1 - mir_wstrlen(szString), L" %s %s", szIs, szStatus);
return szString;
}
diff --git a/plugins/TooltipNotify/src/Utils.cpp b/plugins/TooltipNotify/src/Utils.cpp index 4d102f9822..9338efebbe 100644 --- a/plugins/TooltipNotify/src/Utils.cpp +++ b/plugins/TooltipNotify/src/Utils.cpp @@ -13,7 +13,7 @@ BOOL IsNt50() void TruncateWithDots(wchar_t* szString, size_t iNewLen)
{
- size_t iOrigLen = mir_tstrlen(szString);
+ size_t iOrigLen = mir_wstrlen(szString);
if (iNewLen < iOrigLen) {
wchar_t* p = szString+iNewLen;
*p = '\0';
diff --git a/plugins/TopToolBar/src/toolbar.cpp b/plugins/TopToolBar/src/toolbar.cpp index 9b6f9721f0..d02ab8240a 100644 --- a/plugins/TopToolBar/src/toolbar.cpp +++ b/plugins/TopToolBar/src/toolbar.cpp @@ -177,7 +177,7 @@ TopButtonInt *CreateButton(TTBButton *but) b->bPushed = (but->dwFlags & TTBBF_PUSHED) ? TRUE : FALSE;
if (but->dwFlags & TTBBF_ISLBUTTON) {
- b->ptszProgram = mir_tstrdup(but->program);
+ b->ptszProgram = mir_wstrdup(but->program);
b->pszService = mir_strdup(TTB_LAUNCHSERVICE);
}
else {
@@ -190,8 +190,8 @@ TopButtonInt *CreateButton(TTBButton *but) Icon2button(but, b->hIconHandleUp, b->hIconUp, true);
Icon2button(but, b->hIconHandleDn, b->hIconDn, false);
- b->ptszTooltipUp = mir_a2t(but->pszTooltipUp);
- b->ptszTooltipDn = mir_a2t(but->pszTooltipDn);
+ b->ptszTooltipUp = mir_a2u(but->pszTooltipUp);
+ b->ptszTooltipDn = mir_a2u(but->pszTooltipDn);
}
return b;
}
@@ -399,7 +399,7 @@ INT_PTR TTBGetOptions(WPARAM wParam, LPARAM lParam) lpTTB->wParamDown = b->wParamDown;
if (b->dwFlags & TTBBF_ISLBUTTON)
- replaceStrT(lpTTB->program, b->ptszProgram);
+ replaceStrW(lpTTB->program, b->ptszProgram);
else
replaceStr(lpTTB->pszService, b->pszService);
@@ -440,7 +440,7 @@ INT_PTR TTBSetOptions(WPARAM wParam, LPARAM lParam) if (lParam == 0)
return -1;
- replaceStrT(b->ptszTooltip, TranslateTS(_A2T((LPCSTR)lParam)));
+ replaceStrW(b->ptszTooltip, TranslateTS(_A2T((LPCSTR)lParam)));
SendMessage(b->hwnd, BUTTONADDTOOLTIP, (WPARAM)b->ptszTooltip, BATF_UNICODE);
return 1;
@@ -467,7 +467,7 @@ INT_PTR TTBSetOptions(WPARAM wParam, LPARAM lParam) }
if (b->dwFlags & TTBBF_ISLBUTTON)
- replaceStrT(b->ptszProgram, lpTTB->program);
+ replaceStrW(b->ptszProgram, lpTTB->program);
else
replaceStr(b->pszService, lpTTB->pszService);
diff --git a/plugins/TopToolBar/src/toolbarwnd.cpp b/plugins/TopToolBar/src/toolbarwnd.cpp index 73661085dd..90f3199b24 100644 --- a/plugins/TopToolBar/src/toolbarwnd.cpp +++ b/plugins/TopToolBar/src/toolbarwnd.cpp @@ -299,7 +299,7 @@ int LoadBackgroundOptions() }
if (db_get_b(NULL, TTB_OPTDIR, "UseBitmap", TTBDEFAULT_USEBITMAP)) {
- ptrT tszBitmapName(db_get_tsa(NULL, TTB_OPTDIR, "BkBitmap"));
+ ptrW tszBitmapName(db_get_tsa(NULL, TTB_OPTDIR, "BkBitmap"));
if (tszBitmapName != NULL)
hBmpBackground = Bitmap_Load(tszBitmapName);
}
diff --git a/plugins/TopToolBar/src/ttbopt.cpp b/plugins/TopToolBar/src/ttbopt.cpp index b78101a566..e4a2edd8e5 100644 --- a/plugins/TopToolBar/src/ttbopt.cpp +++ b/plugins/TopToolBar/src/ttbopt.cpp @@ -33,7 +33,7 @@ static HTREEITEM AddLine(HWND hTree,TopButtonInt *b, HTREEITEM hItem, HIMAGELIST }
else index = ImageList_AddIcon(il, b->hIconUp);
- tmp = mir_a2t( b->pszName );
+ tmp = mir_a2u( b->pszName );
tvis.item.pszText = TranslateTS(tmp);
}
tvis.item.iImage = tvis.item.iSelectedImage = index;
@@ -298,7 +298,7 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR TreeView_SetItem(hTree, &tvi);
GetDlgItemText(hwndDlg, IDC_EPATH, buf, _countof(buf));
- replaceStrT(btn->ptszProgram, buf);
+ replaceStrW(btn->ptszProgram, buf);
}
break;
}
diff --git a/plugins/TrafficCounter/src/TrafficCounter.cpp b/plugins/TrafficCounter/src/TrafficCounter.cpp index d54155159e..2366819516 100644 --- a/plugins/TrafficCounter/src/TrafficCounter.cpp +++ b/plugins/TrafficCounter/src/TrafficCounter.cpp @@ -216,26 +216,26 @@ int TrafficCounterModulesLoaded(WPARAM, LPARAM) // Ôîðìàò ñ÷¸ò÷èêà äëÿ êàæäîãî àêòèâíîãî ïðîòîêîëà
if (db_get_ts(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_COUNTER_FORMAT, &dbv) == 0) {
- if (mir_tstrlen(dbv.ptszVal) > 0)
- mir_tstrncpy(Traffic_CounterFormat, dbv.ptszVal, _countof(Traffic_CounterFormat));
+ if (mir_wstrlen(dbv.ptszVal) > 0)
+ mir_wstrncpy(Traffic_CounterFormat, dbv.ptszVal, _countof(Traffic_CounterFormat));
//
db_free(&dbv);
}
else //defaults here
{
- mir_tstrcpy(Traffic_CounterFormat, tszFormat);
+ mir_wstrcpy(Traffic_CounterFormat, tszFormat);
}
// Ôîðìàò âñïëûâàþùèõ ïîäñêàçîê
if (db_get_ts(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_TOOLTIP_FORMAT, &dbv) == 0) {
- if (mir_tstrlen(dbv.ptszVal) > 0)
- mir_tstrncpy(Traffic_TooltipFormat, dbv.ptszVal, _countof(Traffic_TooltipFormat));
+ if (mir_wstrlen(dbv.ptszVal) > 0)
+ mir_wstrncpy(Traffic_TooltipFormat, dbv.ptszVal, _countof(Traffic_TooltipFormat));
//
db_free(&dbv);
}
else //defaults here
{
- mir_tstrcpy(Traffic_TooltipFormat, L"Traffic Counter");
+ mir_wstrcpy(Traffic_TooltipFormat, L"Traffic Counter");
}
Traffic_AdditionSpace = db_get_b(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_ADDITION_SPACE, 0);
@@ -245,8 +245,8 @@ int TrafficCounterModulesLoaded(WPARAM, LPARAM) //register traffic font
TrafficFontID.cbSize = sizeof(FontIDT);
- mir_tstrcpy(TrafficFontID.group, LPGENW("Traffic counter"));
- mir_tstrcpy(TrafficFontID.name, LPGENW("Font"));
+ mir_wstrcpy(TrafficFontID.group, LPGENW("Traffic counter"));
+ mir_wstrcpy(TrafficFontID.name, LPGENW("Font"));
mir_strcpy(TrafficFontID.dbSettingsGroup, TRAFFIC_SETTINGS_GROUP);
mir_strcpy(TrafficFontID.prefix, "Font");
TrafficFontID.flags = FIDF_DEFAULTVALID | FIDF_SAVEPOINTSIZE;
@@ -254,14 +254,14 @@ int TrafficCounterModulesLoaded(WPARAM, LPARAM) TrafficFontID.deffontsettings.colour = GetSysColor(COLOR_BTNTEXT);
TrafficFontID.deffontsettings.size = 12;
TrafficFontID.deffontsettings.style = 0;
- mir_tstrcpy(TrafficFontID.deffontsettings.szFace, L"Arial");
+ mir_wstrcpy(TrafficFontID.deffontsettings.szFace, L"Arial");
TrafficFontID.order = 0;
FontRegisterT(&TrafficFontID);
// Ðåãèñòðèðóåì öâåò ôîíà
TrafficBackgroundColorID.cbSize = sizeof(ColourIDT);
- mir_tstrcpy(TrafficBackgroundColorID.group, LPGENW("Traffic counter"));
- mir_tstrcpy(TrafficBackgroundColorID.name, LPGENW("Font"));
+ mir_wstrcpy(TrafficBackgroundColorID.group, LPGENW("Traffic counter"));
+ mir_wstrcpy(TrafficBackgroundColorID.name, LPGENW("Font"));
mir_strcpy(TrafficBackgroundColorID.dbSettingsGroup, TRAFFIC_SETTINGS_GROUP);
mir_strcpy(TrafficBackgroundColorID.setting, "FontBkColor");
TrafficBackgroundColorID.defcolour = GetSysColor(COLOR_BTNFACE);
@@ -385,7 +385,7 @@ int TrafficCounter_Draw(HWND hwnd, HDC hDC) static void TC_AlphaText(HDC hDC, LPCTSTR lpString, RECT* lpRect, UINT format, BYTE ClistModernPresent)
{
- int nCount = (int)mir_tstrlen(lpString);
+ int nCount = (int)mir_wstrlen(lpString);
if (ClistModernPresent)
AlphaText(hDC, lpString, nCount, lpRect, format, Traffic_FontColor);
@@ -539,7 +539,7 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) // Âûâîäèì òåêñò
// Èçîáðàæàåì èìÿ
if (unOptions.DrawProtoName) {
- wchar_t *bu = mir_a2t("Summary");
+ wchar_t *bu = mir_a2u("Summary");
rect.left += dx;
TC_AlphaText(hdc, bu, &rect, DT_SINGLELINE | DT_LEFT | DT_TOP, ClistModernPresent);
@@ -594,7 +594,7 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) // Âûâîäèì òåêñò
// Èçîáðàæàåì èìÿ
if (unOptions.DrawProtoName) {
- wchar_t *bu = mir_a2t("Overall");
+ wchar_t *bu = mir_a2u("Overall");
rect.left += dx;
TC_AlphaText(hdc, bu, &rect, DT_SINGLELINE | DT_LEFT | DT_TOP, ClistModernPresent);
@@ -639,7 +639,7 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) ExtraText = (wchar_t**)mir_realloc(ExtraText, sizeof(wchar_t*) * (RowsNumber + 1));
ahIcon = (HICON*)mir_realloc(ahIcon, sizeof(HICON) * (RowsNumber + 1));
- ExtraText[RowsNumber] = mir_a2t(ProtoList[i].name);
+ ExtraText[RowsNumber] = mir_a2u(ProtoList[i].name);
ahIcon[RowsNumber++] = Skin_LoadProtoIcon(ProtoList[i].name, CallProtoService(ProtoList[i].name, PS_GETSTATUS, 0, 0));
}
}
@@ -648,14 +648,14 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) ExtraText = (wchar_t**)mir_realloc(ExtraText, sizeof(wchar_t*) * (RowsNumber + 1));
ahIcon = (HICON*)mir_realloc(ahIcon, sizeof(HICON) * (RowsNumber + 1));
- ExtraText[RowsNumber] = mir_a2t("summary");
+ ExtraText[RowsNumber] = mir_a2u("summary");
ahIcon[RowsNumber++] = Skin_LoadIcon(SKINICON_OTHER_MIRANDA);
}
if (unOptions.ShowOverall) {
ExtraText = (wchar_t**)mir_realloc(ExtraText, sizeof(wchar_t*) * (RowsNumber + 1));
ahIcon = (HICON*)mir_realloc(ahIcon, sizeof(HICON) * (RowsNumber + 1));
- ExtraText[RowsNumber] = mir_a2t("overall");
+ ExtraText[RowsNumber] = mir_a2u("overall");
ahIcon[RowsNumber++] = Skin_LoadIcon(SKINICON_OTHER_MIRANDA);
}
@@ -1065,7 +1065,7 @@ void NotifyOnSend(void) ppd.lchContact = NULL;
ppd.lchIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
wcsncpy(ppd.lptzContactName, TranslateT("Traffic counter notification"), MAX_CONTACTNAME);
- mir_sntprintf(ppd.lptzText, TranslateT("%d kilobytes sent"), notify_send_size = OverallInfo.CurrentSentTraffic >> 10);
+ mir_snwprintf(ppd.lptzText, TranslateT("%d kilobytes sent"), notify_send_size = OverallInfo.CurrentSentTraffic >> 10);
ppd.colorBack = Traffic_PopupBkColor;
ppd.colorText = Traffic_PopupFontColor;
ppd.PluginWindowProc = NULL;
@@ -1081,7 +1081,7 @@ void NotifyOnRecv(void) ppd.lchContact = NULL;
ppd.lchIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
wcsncpy(ppd.lptzContactName, TranslateT("Traffic counter notification"), MAX_CONTACTNAME);
- mir_sntprintf(ppd.lptzText, TranslateT("%d kilobytes received"), notify_recv_size = OverallInfo.CurrentRecvTraffic >> 10);
+ mir_snwprintf(ppd.lptzText, TranslateT("%d kilobytes received"), notify_recv_size = OverallInfo.CurrentRecvTraffic >> 10);
ppd.colorBack = Traffic_PopupBkColor;
ppd.colorText = Traffic_PopupFontColor;
ppd.PluginWindowProc = NULL;
@@ -1100,7 +1100,7 @@ void CreateProtocolList(void) //
for (i = 0; i < NumberOfAccounts; i++) {
ProtoList[i].name = mir_strdup(acc[i]->szModuleName);
- ProtoList[i].tszAccountName = mir_tstrdup(acc[i]->tszAccountName);
+ ProtoList[i].tszAccountName = mir_wstrdup(acc[i]->tszAccountName);
ProtoList[i].Flags = db_get_b(NULL, ProtoList[i].name, SETTINGS_PROTO_FLAGS, 3);
ProtoList[i].CurrentRecvTraffic =
diff --git a/plugins/TrafficCounter/src/misc.cpp b/plugins/TrafficCounter/src/misc.cpp index 398feaab96..240ba55aa1 100644 --- a/plugins/TrafficCounter/src/misc.cpp +++ b/plugins/TrafficCounter/src/misc.cpp @@ -63,9 +63,9 @@ WORD GetRowItems(wchar_t *InputString, RowItemInfo **RowItemsList) }
else {
// Âûäåëÿåì ïàìÿòü ïîä ñòðîêó.
- (*RowItemsList)[c].String = (wchar_t*)mir_alloc(sizeof(wchar_t) * mir_tstrlen(end));
+ (*RowItemsList)[c].String = (wchar_t*)mir_alloc(sizeof(wchar_t) * mir_wstrlen(end));
// Êîïèðóåì ñòðîêó.
- wcsncpy((*RowItemsList)[c].String, end + 1, mir_tstrlen(end));
+ wcsncpy((*RowItemsList)[c].String, end + 1, mir_wstrlen(end));
}
c++;
@@ -148,20 +148,20 @@ size_t GetFormattedTraffic(DWORD Value, BYTE Unit, wchar_t *Buffer, size_t Size) return 0;
}
- mir_sntprintf(Str1, L"%d.%d", Value / Divider, Value % Divider);
+ mir_snwprintf(Str1, L"%d.%d", Value / Divider, Value % Divider);
size_t l = GetNumberFormat(LOCALE_USER_DEFAULT, 0, Str1, &nf, NULL, 0);
if (!l) return 0;
- l += mir_tstrlen(szUnit) + 1;
+ l += mir_wstrlen(szUnit) + 1;
Res = (wchar_t*)malloc(l * sizeof(wchar_t));
if (!Res) return 0;
GetNumberFormat(LOCALE_USER_DEFAULT, 0, Str1, &nf, Res, (int)l);
- mir_tstrcat(Res, szUnit);
+ mir_wstrcat(Res, szUnit);
if (Size && Buffer) {
- mir_tstrcpy(Buffer, Res);
- l = mir_tstrlen(Buffer);
+ mir_wstrcpy(Buffer, Res);
+ l = mir_wstrlen(Buffer);
}
- else l = mir_tstrlen(Res) + 1;
+ else l = mir_wstrlen(Res) + 1;
free(Res);
return l;
@@ -197,53 +197,53 @@ size_t GetDurationFormatM(DWORD Duration, wchar_t *Format, wchar_t *Buffer, size Token[TokenIndex] = 0;
// ×òî ïîëó÷èëè â àêêóìóëÿòîðå?
- if (!mir_tstrcmp(Token, L"d")) {
+ if (!mir_wstrcmp(Token, L"d")) {
q = Duration / (60 * 60 * 24);
- mir_sntprintf(Token, L"%d", q);
+ mir_snwprintf(Token, L"%d", q);
Duration -= q * 60 * 60 * 24;
}
- else if (!mir_tstrcmp(Token, L"h")) {
+ else if (!mir_wstrcmp(Token, L"h")) {
q = Duration / (60 * 60);
- mir_sntprintf(Token, L"%d", q);
+ mir_snwprintf(Token, L"%d", q);
Duration -= q * 60 * 60;
}
- else if (!mir_tstrcmp(Token, L"hh")) {
+ else if (!mir_wstrcmp(Token, L"hh")) {
q = Duration / (60 * 60);
- mir_sntprintf(Token, L"%02d", q);
+ mir_snwprintf(Token, L"%02d", q);
Duration -= q * 60 * 60;
}
- else if (!mir_tstrcmp(Token, L"m")) {
+ else if (!mir_wstrcmp(Token, L"m")) {
q = Duration / 60;
- mir_sntprintf(Token, L"%d", q);
+ mir_snwprintf(Token, L"%d", q);
Duration -= q * 60;
}
- else if (!mir_tstrcmp(Token, L"mm")) {
+ else if (!mir_wstrcmp(Token, L"mm")) {
q = Duration / 60;
- mir_sntprintf(Token, L"%02d", q);
+ mir_snwprintf(Token, L"%02d", q);
Duration -= q * 60;
}
- else if (!mir_tstrcmp(Token, L"s")) {
+ else if (!mir_wstrcmp(Token, L"s")) {
q = Duration;
- mir_sntprintf(Token, L"%d", q);
+ mir_snwprintf(Token, L"%d", q);
Duration -= q;
}
- else if (!mir_tstrcmp(Token, L"ss")) {
+ else if (!mir_wstrcmp(Token, L"ss")) {
q = Duration;
- mir_sntprintf(Token, L"%02d", q);
+ mir_snwprintf(Token, L"%02d", q);
Duration -= q;
}
// Äîáàâèì ïàìÿòè, åñëè íóæíî.
- Length = mir_tstrlen(Res) + mir_tstrlen(Token) + 1;
+ Length = mir_wstrlen(Res) + mir_wstrlen(Token) + 1;
Res = (wchar_t*)realloc(Res, Length * sizeof(wchar_t));
- mir_tstrcat(Res, Token);
+ mir_wstrcat(Res, Token);
}
if (Size && Buffer) {
wcsncpy(Buffer, Res, Size);
- Length = mir_tstrlen(Buffer);
+ Length = mir_wstrlen(Buffer);
}
- else Length = mir_tstrlen(Res) + 1;
+ else Length = mir_wstrlen(Res) + 1;
free(Res);
return Length;
diff --git a/plugins/TrafficCounter/src/options.cpp b/plugins/TrafficCounter/src/options.cpp index 02bfd9d5d5..db0e0c3c28 100644 --- a/plugins/TrafficCounter/src/options.cpp +++ b/plugins/TrafficCounter/src/options.cpp @@ -194,9 +194,9 @@ static INT_PTR CALLBACK DlgProcTCOptions(HWND hwndDlg, UINT msg, WPARAM wParam, {
options[i].szSettingName = (char*)mir_alloc(1 + mir_strlen(ProtoList[j].name));
mir_strcpy(options[i].szSettingName, ProtoList[j].name);
- size_t l = 20 + mir_tstrlen(ProtoList[j].tszAccountName);
+ size_t l = 20 + mir_wstrlen(ProtoList[j].tszAccountName);
options[i].szOptionName = (wchar_t*)mir_alloc(sizeof(wchar_t) * l);
- mir_sntprintf(options[i].szOptionName, l, L"Visible accounts/%s", ProtoList[j].tszAccountName);
+ mir_snwprintf(options[i].szOptionName, l, L"Visible accounts/%s", ProtoList[j].tszAccountName);
options[i].dwFlag = (ProtoList[j++].Enabled ? 1 : OPTTREE_INVISIBLE) | OPTTREE_NOTRANSLATE;
}
Initialized = 1;
diff --git a/plugins/TrafficCounter/src/opttree.cpp b/plugins/TrafficCounter/src/opttree.cpp index 337fca2806..b75de3cca5 100644 --- a/plugins/TrafficCounter/src/opttree.cpp +++ b/plugins/TrafficCounter/src/opttree.cpp @@ -93,7 +93,7 @@ HTREEITEM OptTree_FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const wcha {
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);
@@ -109,7 +109,7 @@ HTREEITEM OptTree_AddItem(HWND hwndTree, wchar_t *name, LPARAM lParam, int iconI int sectionLevel = 0;
HTREEITEM hSection = NULL, result = NULL;
- mir_tstrcpy(itemName, name);
+ mir_wstrcpy(itemName, name);
sectionName = itemName;
while (sectionName)
@@ -193,7 +193,7 @@ BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM, LPARAM lparam, BOOL*, HTREEITEM hSection = NULL;
if (options[indx].szOptionName)
- mir_tstrcpy(itemName, options[indx].szOptionName);
+ mir_wstrcpy(itemName, options[indx].szOptionName);
else
itemName[0] = 0;
diff --git a/plugins/TrafficCounter/src/statistics.cpp b/plugins/TrafficCounter/src/statistics.cpp index cb0f7e3f6d..1815f8544c 100644 --- a/plugins/TrafficCounter/src/statistics.cpp +++ b/plugins/TrafficCounter/src/statistics.cpp @@ -187,7 +187,7 @@ INT_PTR CALLBACK DlgProcOptStatistics(HWND hwndDlg, UINT msg, WPARAM wParam, LPA switch (unOptions.Stat_Tab) {
case 0: // Hourly
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, szBufW, 32);
- mir_sntprintf(pdi->item.pszText, 32, L"%s %02d:00 - %02d:59",
+ mir_snwprintf(pdi->item.pszText, 32, L"%s %02d:00 - %02d:59",
szBufW,
ProtoList[EldestAcc].AllStatistics[Index].Hour,
ProtoList[EldestAcc].AllStatistics[Index].Hour);
@@ -206,13 +206,13 @@ INT_PTR CALLBACK DlgProcOptStatistics(HWND hwndDlg, UINT msg, WPARAM wParam, LPA vartime += 6;
VariantTimeToSystemTime(vartime, &st);
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, szBufW, 32);
- mir_sntprintf(pdi->item.pszText, 32, L"%s - %s", pdi->item.pszText, szBufW);
+ mir_snwprintf(pdi->item.pszText, 32, L"%s - %s", pdi->item.pszText, szBufW);
break;
case 3: // Monthly
GetDateFormat(LOCALE_USER_DEFAULT, DATE_YEARMONTH, &st, NULL, pdi->item.pszText, 32);
break;
case 4: // Yearly
- mir_sntprintf(pdi->item.pszText, 32, L"%d", st.wYear);
+ mir_snwprintf(pdi->item.pszText, 32, L"%d", st.wYear);
break;
}
return 0;
@@ -302,7 +302,7 @@ void Stat_ReadFile(BYTE n) pszPath = Utils_ReplaceVarsT(L"%miranda_userdata%\\statistics");
CreateDirectoryTreeT(pszPath);
- mir_sntprintf(FileName, L"%s\\%S.stat", pszPath, ProtoList[n].name);
+ mir_snwprintf(FileName, L"%s\\%S.stat", pszPath, ProtoList[n].name);
mir_free(pszPath);
GetLocalTime(&stNow);
ProtoList[n].hFile = CreateFile(FileName, GENERIC_READ | GENERIC_WRITE,
diff --git a/plugins/TrafficCounter/src/vars.cpp b/plugins/TrafficCounter/src/vars.cpp index 64a71c71b5..989df08b21 100644 --- a/plugins/TrafficCounter/src/vars.cpp +++ b/plugins/TrafficCounter/src/vars.cpp @@ -30,7 +30,7 @@ static wchar_t* GetTraffic(ARGUMENTSINFO *ai) if (ai->argc != 5) return NULL;
- if (!mir_tstrcmp(ai->targv[1], L"overall"))
+ if (!mir_wstrcmp(ai->targv[1], L"overall"))
{
tmpsn = OverallInfo.CurrentSentTraffic;
tmprn = OverallInfo.CurrentRecvTraffic;
@@ -38,7 +38,7 @@ static wchar_t* GetTraffic(ARGUMENTSINFO *ai) tmprt = OverallInfo.TotalRecvTraffic;
}
else
- if (!mir_tstrcmp(ai->targv[1], L"summary"))
+ if (!mir_wstrcmp(ai->targv[1], L"summary"))
{
for (ed = 0; ed < NumberOfAccounts; ed++)
if (ProtoList[ed].Visible)
@@ -54,8 +54,8 @@ static wchar_t* GetTraffic(ARGUMENTSINFO *ai) for (tmp = ed = 0; ed < NumberOfAccounts; ed++)
{
if (!ProtoList[ed].name) continue;
- wchar_t *buf = mir_a2t(ProtoList[ed].name);
- if (!mir_tstrcmp(buf, ai->targv[1]))
+ wchar_t *buf = mir_a2u(ProtoList[ed].name);
+ if (!mir_wstrcmp(buf, ai->targv[1]))
{
tmpsn = ProtoList[ed].CurrentSentTraffic;
tmprn = ProtoList[ed].CurrentRecvTraffic;
@@ -68,34 +68,34 @@ static wchar_t* GetTraffic(ARGUMENTSINFO *ai) if (tmp != 0xAA) return NULL;
}
- if (!mir_tstrcmp(ai->targv[2], L"now"))
+ if (!mir_wstrcmp(ai->targv[2], L"now"))
{
- if (!mir_tstrcmp(ai->targv[3], L"sent")) tmp = tmpsn;
+ if (!mir_wstrcmp(ai->targv[3], L"sent")) tmp = tmpsn;
else
- if (!mir_tstrcmp(ai->targv[3], L"received")) tmp = tmprn;
+ if (!mir_wstrcmp(ai->targv[3], L"received")) tmp = tmprn;
else
- if (!mir_tstrcmp(ai->targv[3], L"both")) tmp = tmprn + tmpsn;
+ if (!mir_wstrcmp(ai->targv[3], L"both")) tmp = tmprn + tmpsn;
else return NULL;
}
else
- if (!mir_tstrcmp(ai->targv[2], L"total"))
+ if (!mir_wstrcmp(ai->targv[2], L"total"))
{
- if (!mir_tstrcmp(ai->targv[3], L"sent")) tmp = tmpst;
+ if (!mir_wstrcmp(ai->targv[3], L"sent")) tmp = tmpst;
else
- if (!mir_tstrcmp(ai->targv[3], L"received")) tmp = tmprt;
+ if (!mir_wstrcmp(ai->targv[3], L"received")) tmp = tmprt;
else
- if (!mir_tstrcmp(ai->targv[3], L"both")) tmp = tmprt + tmpst;
+ if (!mir_wstrcmp(ai->targv[3], L"both")) tmp = tmprt + tmpst;
else return NULL;
}
else return NULL;
- if (!mir_tstrcmp(ai->targv[4], L"b")) ed = 0;
+ if (!mir_wstrcmp(ai->targv[4], L"b")) ed = 0;
else
- if (!mir_tstrcmp(ai->targv[4], L"k")) ed = 1;
+ if (!mir_wstrcmp(ai->targv[4], L"k")) ed = 1;
else
- if (!mir_tstrcmp(ai->targv[4], L"m")) ed = 2;
+ if (!mir_wstrcmp(ai->targv[4], L"m")) ed = 2;
else
- if (!mir_tstrcmp(ai->targv[4], L"d")) ed = 3;
+ if (!mir_wstrcmp(ai->targv[4], L"d")) ed = 3;
else return NULL;
// Ïîëó÷àåì ôîðìàòèðîâàííóþ ñòðîêó è âîçâðàùàåì óêàçàòåëü íà íå¸.
@@ -122,25 +122,25 @@ static wchar_t* GetTime(ARGUMENTSINFO *ai) {
wchar_t *buf;
if (!ProtoList[ed].name) continue;
- buf = mir_a2t(ProtoList[ed].name);
- if (!mir_tstrcmp(buf, ai->targv[1]))
+ buf = mir_a2u(ProtoList[ed].name);
+ if (!mir_wstrcmp(buf, ai->targv[1]))
{
flag = 0xAA;
- if (!mir_tstrcmp(ai->targv[2], L"now"))
+ if (!mir_wstrcmp(ai->targv[2], L"now"))
Duration = ProtoList[ed].Session.Timer;
- else if (!mir_tstrcmp(ai->targv[2], L"total"))
+ else if (!mir_wstrcmp(ai->targv[2], L"total"))
Duration = ProtoList[ed].Total.Timer;
else flag = 0;
break;
}
mir_free(buf);
}
- if ( (flag != 0xAA) && !mir_tstrcmp(ai->targv[1], L"summary") )
+ if ( (flag != 0xAA) && !mir_wstrcmp(ai->targv[1], L"summary") )
{
flag = 0xAA;
- if (!mir_tstrcmp(ai->targv[2], L"now"))
+ if (!mir_wstrcmp(ai->targv[2], L"now"))
Duration = OverallInfo.Session.Timer;
- else if (!mir_tstrcmp(ai->targv[2], L"total"))
+ else if (!mir_wstrcmp(ai->targv[2], L"total"))
Duration = OverallInfo.Total.Timer;
else flag = 0;
}
diff --git a/plugins/TranslitSwitcher/src/Layoutproc.cpp b/plugins/TranslitSwitcher/src/Layoutproc.cpp index e0c08bb045..0f75d9f64b 100644 --- a/plugins/TranslitSwitcher/src/Layoutproc.cpp +++ b/plugins/TranslitSwitcher/src/Layoutproc.cpp @@ -40,7 +40,7 @@ bool isItSmiley(unsigned int position) static DWORD CALLBACK StreamOutCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
{
wchar_t **ppText = (wchar_t**)dwCookie;
- *ppText = mir_tstrndup((wchar_t*)pbBuff, cb / sizeof(wchar_t));
+ *ppText = mir_wstrndup((wchar_t*)pbBuff, cb / sizeof(wchar_t));
*pcb = cb;
return 0;
}
@@ -60,292 +60,292 @@ wchar_t* Message_GetFromStream(HWND hwndRtf, DWORD dwPassedFlags) void Transliterate(wchar_t *&str)
{
- wchar_t *newStr = (wchar_t*)mir_alloc(sizeof(wchar_t) * mir_tstrlen(str) * 3 + 1);
+ wchar_t *newStr = (wchar_t*)mir_alloc(sizeof(wchar_t) * mir_wstrlen(str) * 3 + 1);
newStr[0] = 0;
for (; *str != 0; str++) {
switch (str[0]) {
- case 'à': mir_tstrcat(newStr, L"a"); break;
- case 'á': mir_tstrcat(newStr, L"b"); break;
- case 'â': mir_tstrcat(newStr, L"v"); break;
- case 'ã': mir_tstrcat(newStr, L"g"); break;
- case 'ä': mir_tstrcat(newStr, L"d"); break;
- case 'å': mir_tstrcat(newStr, L"e"); break;
- case '¸': mir_tstrcat(newStr, L"ye"); break;
- case 'æ': mir_tstrcat(newStr, L"zh"); break;
- case 'ç': mir_tstrcat(newStr, L"z"); break;
- case 'è': mir_tstrcat(newStr, L"i"); break;
- case 'é': mir_tstrcat(newStr, L"y"); break;
- case 'ê': mir_tstrcat(newStr, L"k"); break;
- case 'ë': mir_tstrcat(newStr, L"l"); break;
- case 'ì': mir_tstrcat(newStr, L"m"); break;
- case 'í': mir_tstrcat(newStr, L"n"); break;
- case 'î': mir_tstrcat(newStr, L"o"); break;
- case 'ï': mir_tstrcat(newStr, L"p"); break;
- case 'ð': mir_tstrcat(newStr, L"r"); break;
- case 'ñ': mir_tstrcat(newStr, L"s"); break;
- case 'ò': mir_tstrcat(newStr, L"t"); break;
- case 'ó': mir_tstrcat(newStr, L"u"); break;
- case 'ô': mir_tstrcat(newStr, L"f"); break;
- case 'õ': mir_tstrcat(newStr, L"kh"); break;
- case 'ö': mir_tstrcat(newStr, L"ts"); break;
- case '÷': mir_tstrcat(newStr, L"ch"); break;
- case 'ø': mir_tstrcat(newStr, L"sh"); break;
- case 'ù': mir_tstrcat(newStr, L"sch"); break;
- case 'ú': mir_tstrcat(newStr, L"'"); break;
- case 'û': mir_tstrcat(newStr, L"yi"); break;
- case 'ü': mir_tstrcat(newStr, L""); break;
- case 'ý': mir_tstrcat(newStr, L"e"); break;
- case 'þ': mir_tstrcat(newStr, L"yu"); break;
- case 'ÿ': mir_tstrcat(newStr, L"ya"); break;
- case 'À': mir_tstrcat(newStr, L"A"); break;
- case 'Á': mir_tstrcat(newStr, L"B"); break;
- case 'Â': mir_tstrcat(newStr, L"V"); break;
- case 'Ã': mir_tstrcat(newStr, L"G"); break;
- case 'Ä': mir_tstrcat(newStr, L"D"); break;
- case 'Å': mir_tstrcat(newStr, L"E"); break;
- case '¨': mir_tstrcat(newStr, L"Ye"); break;
- case 'Æ': mir_tstrcat(newStr, L"Zh"); break;
- case 'Ç': mir_tstrcat(newStr, L"Z"); break;
- case 'È': mir_tstrcat(newStr, L"I"); break;
- case 'É': mir_tstrcat(newStr, L"Y"); break;
- case 'Ê': mir_tstrcat(newStr, L"K"); break;
- case 'Ë': mir_tstrcat(newStr, L"L"); break;
- case 'Ì': mir_tstrcat(newStr, L"M"); break;
- case 'Í': mir_tstrcat(newStr, L"N"); break;
- case 'Î': mir_tstrcat(newStr, L"O"); break;
- case 'Ï': mir_tstrcat(newStr, L"P"); break;
- case 'Ð': mir_tstrcat(newStr, L"R"); break;
- case 'Ñ': mir_tstrcat(newStr, L"S"); break;
- case 'Ò': mir_tstrcat(newStr, L"T"); break;
- case 'Ó': mir_tstrcat(newStr, L"U"); break;
- case 'Ô': mir_tstrcat(newStr, L"F"); break;
- case 'Õ': mir_tstrcat(newStr, L"Kh"); break;
- case 'Ö': mir_tstrcat(newStr, L"Ts"); break;
- case '×': mir_tstrcat(newStr, L"Ch"); break;
- case 'Ø': mir_tstrcat(newStr, L"Sh"); break;
- case 'Ù': mir_tstrcat(newStr, L"Sch"); break;
- case 'Ú': mir_tstrcat(newStr, L"'"); break;
- case 'Û': mir_tstrcat(newStr, L"Yi"); break;
- case 'Ü': mir_tstrcat(newStr, L""); break;
- case 'Ý': mir_tstrcat(newStr, L"E"); break;
- case 'Þ': mir_tstrcat(newStr, L"Yu"); break;
- case 'ß': mir_tstrcat(newStr, L"Ya"); break;
-
- case 'a': mir_tstrcat(newStr, L"à"); break;
- case 'b': mir_tstrcat(newStr, L"á"); break;
- case 'v': mir_tstrcat(newStr, L"â"); break;
- case 'g': mir_tstrcat(newStr, L"ã"); break;
- case 'd': mir_tstrcat(newStr, L"ä"); break;
- case 'e': mir_tstrcat(newStr, L"å"); break;
+ case 'à': mir_wstrcat(newStr, L"a"); break;
+ case 'á': mir_wstrcat(newStr, L"b"); break;
+ case 'â': mir_wstrcat(newStr, L"v"); break;
+ case 'ã': mir_wstrcat(newStr, L"g"); break;
+ case 'ä': mir_wstrcat(newStr, L"d"); break;
+ case 'å': mir_wstrcat(newStr, L"e"); break;
+ case '¸': mir_wstrcat(newStr, L"ye"); break;
+ case 'æ': mir_wstrcat(newStr, L"zh"); break;
+ case 'ç': mir_wstrcat(newStr, L"z"); break;
+ case 'è': mir_wstrcat(newStr, L"i"); break;
+ case 'é': mir_wstrcat(newStr, L"y"); break;
+ case 'ê': mir_wstrcat(newStr, L"k"); break;
+ case 'ë': mir_wstrcat(newStr, L"l"); break;
+ case 'ì': mir_wstrcat(newStr, L"m"); break;
+ case 'í': mir_wstrcat(newStr, L"n"); break;
+ case 'î': mir_wstrcat(newStr, L"o"); break;
+ case 'ï': mir_wstrcat(newStr, L"p"); break;
+ case 'ð': mir_wstrcat(newStr, L"r"); break;
+ case 'ñ': mir_wstrcat(newStr, L"s"); break;
+ case 'ò': mir_wstrcat(newStr, L"t"); break;
+ case 'ó': mir_wstrcat(newStr, L"u"); break;
+ case 'ô': mir_wstrcat(newStr, L"f"); break;
+ case 'õ': mir_wstrcat(newStr, L"kh"); break;
+ case 'ö': mir_wstrcat(newStr, L"ts"); break;
+ case '÷': mir_wstrcat(newStr, L"ch"); break;
+ case 'ø': mir_wstrcat(newStr, L"sh"); break;
+ case 'ù': mir_wstrcat(newStr, L"sch"); break;
+ case 'ú': mir_wstrcat(newStr, L"'"); break;
+ case 'û': mir_wstrcat(newStr, L"yi"); break;
+ case 'ü': mir_wstrcat(newStr, L""); break;
+ case 'ý': mir_wstrcat(newStr, L"e"); break;
+ case 'þ': mir_wstrcat(newStr, L"yu"); break;
+ case 'ÿ': mir_wstrcat(newStr, L"ya"); break;
+ case 'À': mir_wstrcat(newStr, L"A"); break;
+ case 'Á': mir_wstrcat(newStr, L"B"); break;
+ case 'Â': mir_wstrcat(newStr, L"V"); break;
+ case 'Ã': mir_wstrcat(newStr, L"G"); break;
+ case 'Ä': mir_wstrcat(newStr, L"D"); break;
+ case 'Å': mir_wstrcat(newStr, L"E"); break;
+ case '¨': mir_wstrcat(newStr, L"Ye"); break;
+ case 'Æ': mir_wstrcat(newStr, L"Zh"); break;
+ case 'Ç': mir_wstrcat(newStr, L"Z"); break;
+ case 'È': mir_wstrcat(newStr, L"I"); break;
+ case 'É': mir_wstrcat(newStr, L"Y"); break;
+ case 'Ê': mir_wstrcat(newStr, L"K"); break;
+ case 'Ë': mir_wstrcat(newStr, L"L"); break;
+ case 'Ì': mir_wstrcat(newStr, L"M"); break;
+ case 'Í': mir_wstrcat(newStr, L"N"); break;
+ case 'Î': mir_wstrcat(newStr, L"O"); break;
+ case 'Ï': mir_wstrcat(newStr, L"P"); break;
+ case 'Ð': mir_wstrcat(newStr, L"R"); break;
+ case 'Ñ': mir_wstrcat(newStr, L"S"); break;
+ case 'Ò': mir_wstrcat(newStr, L"T"); break;
+ case 'Ó': mir_wstrcat(newStr, L"U"); break;
+ case 'Ô': mir_wstrcat(newStr, L"F"); break;
+ case 'Õ': mir_wstrcat(newStr, L"Kh"); break;
+ case 'Ö': mir_wstrcat(newStr, L"Ts"); break;
+ case '×': mir_wstrcat(newStr, L"Ch"); break;
+ case 'Ø': mir_wstrcat(newStr, L"Sh"); break;
+ case 'Ù': mir_wstrcat(newStr, L"Sch"); break;
+ case 'Ú': mir_wstrcat(newStr, L"'"); break;
+ case 'Û': mir_wstrcat(newStr, L"Yi"); break;
+ case 'Ü': mir_wstrcat(newStr, L""); break;
+ case 'Ý': mir_wstrcat(newStr, L"E"); break;
+ case 'Þ': mir_wstrcat(newStr, L"Yu"); break;
+ case 'ß': mir_wstrcat(newStr, L"Ya"); break;
+
+ case 'a': mir_wstrcat(newStr, L"à"); break;
+ case 'b': mir_wstrcat(newStr, L"á"); break;
+ case 'v': mir_wstrcat(newStr, L"â"); break;
+ case 'g': mir_wstrcat(newStr, L"ã"); break;
+ case 'd': mir_wstrcat(newStr, L"ä"); break;
+ case 'e': mir_wstrcat(newStr, L"å"); break;
case 'z':
{
if (str[1] == 'h') {
- mir_tstrcat(newStr, L"æ");
+ mir_wstrcat(newStr, L"æ");
str++;
break;
}
else {
- mir_tstrcat(newStr, L"ç");
+ mir_wstrcat(newStr, L"ç");
break;
}
}
- case 'i': mir_tstrcat(newStr, L"è"); break;
+ case 'i': mir_wstrcat(newStr, L"è"); break;
case 'y':
{
if (str[1] == 'a') {
- mir_tstrcat(newStr, L"ÿ");
+ mir_wstrcat(newStr, L"ÿ");
str++;
break;
}
else if (str[1] == 'e') {
- mir_tstrcat(newStr, L"¸");
+ mir_wstrcat(newStr, L"¸");
str++;
break;
}
else if (str[1] == 'u') {
- mir_tstrcat(newStr, L"þ");
+ mir_wstrcat(newStr, L"þ");
str++;
break;
}
else if (str[1] == 'i') {
- mir_tstrcat(newStr, L"û");
+ mir_wstrcat(newStr, L"û");
str++;
break;
}
else {
- mir_tstrcat(newStr, L"é");
+ mir_wstrcat(newStr, L"é");
break;
}
}
case 'k':
{
if (str[1] == 'h') {
- mir_tstrcat(newStr, L"õ");
+ mir_wstrcat(newStr, L"õ");
str++;
break;
}
else {
- mir_tstrcat(newStr, L"ê");
+ mir_wstrcat(newStr, L"ê");
break;
}
}
- case 'l': mir_tstrcat(newStr, L"ë"); break;
- case 'm': mir_tstrcat(newStr, L"ì"); break;
- case 'n': mir_tstrcat(newStr, L"í"); break;
- case 'o': mir_tstrcat(newStr, L"î"); break;
- case 'p': mir_tstrcat(newStr, L"ï"); break;
- case 'r': mir_tstrcat(newStr, L"ð"); break;
+ case 'l': mir_wstrcat(newStr, L"ë"); break;
+ case 'm': mir_wstrcat(newStr, L"ì"); break;
+ case 'n': mir_wstrcat(newStr, L"í"); break;
+ case 'o': mir_wstrcat(newStr, L"î"); break;
+ case 'p': mir_wstrcat(newStr, L"ï"); break;
+ case 'r': mir_wstrcat(newStr, L"ð"); break;
case 's':
{
if (str[1] == 'h') {
- mir_tstrcat(newStr, L"ø");
+ mir_wstrcat(newStr, L"ø");
str++;
break;
}
else if (str[1] == 'c' && str[2] == 'h') {
- mir_tstrcat(newStr, L"ù");
+ mir_wstrcat(newStr, L"ù");
str += 2;
break;
}
else {
- mir_tstrcat(newStr, L"ñ");
+ mir_wstrcat(newStr, L"ñ");
break;
}
}
case 't':
{
if (str[1] == 's') {
- mir_tstrcat(newStr, L"ö");
+ mir_wstrcat(newStr, L"ö");
str++;
break;
}
else {
- mir_tstrcat(newStr, L"ò");
+ mir_wstrcat(newStr, L"ò");
break;
}
}
- case 'u': mir_tstrcat(newStr, L"ó"); break;
- case 'f': mir_tstrcat(newStr, L"ô"); break;
+ case 'u': mir_wstrcat(newStr, L"ó"); break;
+ case 'f': mir_wstrcat(newStr, L"ô"); break;
case 'c':
{
if (str[1] == 'h') {
- mir_tstrcat(newStr, L"÷");
+ mir_wstrcat(newStr, L"÷");
str++;
break;
}
}
- case 'A': mir_tstrcat(newStr, L"À"); break;
- case 'B': mir_tstrcat(newStr, L"Á"); break;
- case 'V': mir_tstrcat(newStr, L"Â"); break;
- case 'G': mir_tstrcat(newStr, L"Ã"); break;
- case 'D': mir_tstrcat(newStr, L"Ä"); break;
- case 'E': mir_tstrcat(newStr, L"Å"); break;
+ case 'A': mir_wstrcat(newStr, L"À"); break;
+ case 'B': mir_wstrcat(newStr, L"Á"); break;
+ case 'V': mir_wstrcat(newStr, L"Â"); break;
+ case 'G': mir_wstrcat(newStr, L"Ã"); break;
+ case 'D': mir_wstrcat(newStr, L"Ä"); break;
+ case 'E': mir_wstrcat(newStr, L"Å"); break;
case 'Y':
{
if (str[1] == 'a') {
- mir_tstrcat(newStr, L"ß");
+ mir_wstrcat(newStr, L"ß");
str++;
break;
}
else if (str[1] == 'e') {
- mir_tstrcat(newStr, L"¨");
+ mir_wstrcat(newStr, L"¨");
str++;
break;
}
else if (str[1] == 'u') {
- mir_tstrcat(newStr, L"Þ");
+ mir_wstrcat(newStr, L"Þ");
str++;
break;
}
else if (str[1] == 'i') {
- mir_tstrcat(newStr, L"Û");
+ mir_wstrcat(newStr, L"Û");
str++;
break;
}
else {
- mir_tstrcat(newStr, L"É");
+ mir_wstrcat(newStr, L"É");
break;
}
}
case 'Z':
{
if (str[1] == 'h') {
- mir_tstrcat(newStr, L"Æ");
+ mir_wstrcat(newStr, L"Æ");
str++;
break;
}
else {
- mir_tstrcat(newStr, L"Ç");
+ mir_wstrcat(newStr, L"Ç");
break;
}
}
- case 'I': mir_tstrcat(newStr, L"È"); break;
+ case 'I': mir_wstrcat(newStr, L"È"); break;
case 'K':
{
if (str[1] == 'h') {
- mir_tstrcat(newStr, L"Õ");
+ mir_wstrcat(newStr, L"Õ");
str++;
break;
}
else {
- mir_tstrcat(newStr, L"Ê");
+ mir_wstrcat(newStr, L"Ê");
break;
}
}
- case 'L': mir_tstrcat(newStr, L"Ë"); break;
- case 'M': mir_tstrcat(newStr, L"Ì"); break;
- case 'N': mir_tstrcat(newStr, L"Í"); break;
- case 'O': mir_tstrcat(newStr, L"Î"); break;
- case 'P': mir_tstrcat(newStr, L"Ï"); break;
- case 'R': mir_tstrcat(newStr, L"Ð"); break;
+ case 'L': mir_wstrcat(newStr, L"Ë"); break;
+ case 'M': mir_wstrcat(newStr, L"Ì"); break;
+ case 'N': mir_wstrcat(newStr, L"Í"); break;
+ case 'O': mir_wstrcat(newStr, L"Î"); break;
+ case 'P': mir_wstrcat(newStr, L"Ï"); break;
+ case 'R': mir_wstrcat(newStr, L"Ð"); break;
case 'S':
{
if (str[1] == 'h') {
- mir_tstrcat(newStr, L"Ø");
+ mir_wstrcat(newStr, L"Ø");
str++;
break;
}
else if (str[1] == 'c' && str[2] == 'h') {
- mir_tstrcat(newStr, L"Ù");
+ mir_wstrcat(newStr, L"Ù");
str += 2;
break;
}
else {
- mir_tstrcat(newStr, L"Ñ");
+ mir_wstrcat(newStr, L"Ñ");
break;
}
}
case 'T':
{
if (str[1] == 's') {
- mir_tstrcat(newStr, L"Ö");
+ mir_wstrcat(newStr, L"Ö");
str++;
break;
}
else {
- mir_tstrcat(newStr, L"Ò");
+ mir_wstrcat(newStr, L"Ò");
break;
}
}
- case 'U': mir_tstrcat(newStr, L"Ó"); break;
- case 'F': mir_tstrcat(newStr, L"Ô"); break;
+ case 'U': mir_wstrcat(newStr, L"Ó"); break;
+ case 'F': mir_wstrcat(newStr, L"Ô"); break;
case 'C':
{
if (str[1] == 'h') {
- mir_tstrcat(newStr, L"×");
+ mir_wstrcat(newStr, L"×");
str++;
break;
}
}
- case '\'': mir_tstrcat(newStr, L"ú"); break;
+ case '\'': mir_wstrcat(newStr, L"ú"); break;
- default: { wchar_t Temp[2] = { str[0], 0 }; mir_tstrcat(newStr, &Temp[0]); }
+ default: { wchar_t Temp[2] = { str[0], 0 }; mir_wstrcat(newStr, &Temp[0]); }
}
}
- size_t len = mir_tstrlen(newStr);
+ size_t len = mir_wstrlen(newStr);
str = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
str[0] = 0;
- mir_tstrcpy(str, newStr);
+ mir_wstrcpy(str, newStr);
mir_free(newStr);
}
@@ -376,9 +376,9 @@ void SwitchLayout(bool lastword) wchar_t szClassName[MAX_PATH];
GetClassName(hwnd2, szClassName, _countof(szClassName));
- if ((mir_tstrcmp(szClassName, L"THppRichEdit.UnicodeClass") == 0 || mir_tstrcmp(szClassName, L"THistoryGrid.UnicodeClass") == 0 || mir_tstrcmp(szClassName, L"TExtHistoryGrid.UnicodeClass") == 0 || mir_tstrcmp(szClassName, L"Internet Explorer_Server") == 0) && ServiceExists(MS_POPUP_SHOWMESSAGE)) { // make popup here
+ if ((mir_wstrcmp(szClassName, L"THppRichEdit.UnicodeClass") == 0 || mir_wstrcmp(szClassName, L"THistoryGrid.UnicodeClass") == 0 || mir_wstrcmp(szClassName, L"TExtHistoryGrid.UnicodeClass") == 0 || mir_wstrcmp(szClassName, L"Internet Explorer_Server") == 0) && ServiceExists(MS_POPUP_SHOWMESSAGE)) { // make popup here
wchar_t buf[2048];
- if (mir_tstrcmp(szClassName, L"Internet Explorer_Server") == 0) {
+ if (mir_wstrcmp(szClassName, L"Internet Explorer_Server") == 0) {
IEVIEWEVENT event;
HWND hwnd3 = GetParent(GetParent(hwnd2));
memset(&event, 0, sizeof(event));
@@ -388,11 +388,11 @@ void SwitchLayout(bool lastword) event.iType = IEE_GET_SELECTION;
event.hwnd = hwnd3;
wchar_t *selected = (wchar_t *)CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&event);
- mir_tstrncpy(buf, selected, _countof(buf));
+ mir_wstrncpy(buf, selected, _countof(buf));
}
else GetWindowText(hwnd2, buf, _countof(buf)); // gimme, gimme, gimme...
- size_t slen = mir_tstrlen(buf);
+ size_t slen = mir_wstrlen(buf);
if (slen != 0) {
HKL hkl;
ActivateKeyboardLayout((HKL)HKL_NEXT, KLF_ACTIVATE); // go to next layout before....
@@ -429,12 +429,12 @@ void SwitchLayout(bool lastword) POPUPDATAT pd = { 0 };
pd.lchIcon = IcoLib_GetIcon("Switch Layout and Send");
- mir_tstrncpy(pd.lptzText, buf, _countof(pd.lptzText));
- mir_tstrncpy(pd.lptzContactName, TranslateT("TranslitSwitcher"), _countof(pd.lptzContactName));
+ mir_wstrncpy(pd.lptzText, buf, _countof(pd.lptzText));
+ mir_wstrncpy(pd.lptzContactName, TranslateT("TranslitSwitcher"), _countof(pd.lptzContactName));
PUAddPopupT(&pd);
}
}
- else if (mir_tstrcmpi(szClassName, L"RichEdit50W") == 0) {
+ else if (mir_wstrcmpi(szClassName, L"RichEdit50W") == 0) {
size_t i, start = 0, end = 0;
SHORT vks;
BYTE keys[256] = { 0 };
@@ -447,7 +447,7 @@ void SwitchLayout(bool lastword) dwFlags += SFF_SELECTION;
wchar_t *sel = Message_GetFromStream(hwnd2, dwFlags);
- size_t slen = mir_tstrlen(sel);
+ size_t slen = mir_wstrlen(sel);
if (slen != 0) {
if (ServiceExists(MS_SMILEYADD_BATCHPARSE)) {
memset(&smgp, 0, sizeof(smgp));
@@ -515,7 +515,7 @@ void TranslitLayout(bool lastword) wchar_t szClassName[16];
GetClassName(hwnd2, szClassName, _countof(szClassName));
- if (mir_tstrcmpi(szClassName, L"RichEdit50W") != 0)
+ if (mir_wstrcmpi(szClassName, L"RichEdit50W") != 0)
return;
DWORD dwStart, dwEnd, dwFlags = SF_TEXT | SF_UNICODE;
@@ -525,7 +525,7 @@ void TranslitLayout(bool lastword) dwFlags += SFF_SELECTION;
wchar_t *boo, *sel = Message_GetFromStream(hwnd2, dwFlags);
- size_t slen = mir_tstrlen(sel), start = 0, end = 0;
+ size_t slen = mir_wstrlen(sel), start = 0, end = 0;
if (slen != 0) {
end = slen;
if (lastword && !somethingIsSelected) {
@@ -542,12 +542,12 @@ void TranslitLayout(bool lastword) start--;
}
boo = (wchar_t*)mir_alloc((end - start + 1) * sizeof(wchar_t));
- mir_tstrncpy(boo, sel + start, end - start);
+ mir_wstrncpy(boo, sel + start, end - start);
boo[end - start] = 0;
}
else {
boo = (wchar_t*)mir_alloc((slen + 1) * sizeof(wchar_t));
- mir_tstrcpy(boo, sel);
+ mir_wstrcpy(boo, sel);
}
Transliterate(boo);
@@ -555,11 +555,11 @@ void TranslitLayout(bool lastword) if (somethingIsSelected)
SendMessage(hwnd2, EM_REPLACESEL, false, (LPARAM)boo);
else {
- wchar_t *NewText = (wchar_t*)mir_alloc((start + mir_tstrlen(boo) + (slen - start) + 1) * sizeof(wchar_t));
+ wchar_t *NewText = (wchar_t*)mir_alloc((start + mir_wstrlen(boo) + (slen - start) + 1) * sizeof(wchar_t));
NewText[0] = 0;
- mir_tstrncat(NewText, sel, start);
- mir_tstrcat(NewText, boo);
- mir_tstrncat(NewText, sel + end, slen - end);
+ mir_wstrncat(NewText, sel, start);
+ mir_wstrcat(NewText, boo);
+ mir_wstrncat(NewText, sel + end, slen - end);
SetWindowText(hwnd2, NewText);
mir_free(NewText);
}
@@ -583,7 +583,7 @@ void InvertCase(bool lastword) wchar_t szClassName[16];
GetClassName(hwnd2, szClassName, _countof(szClassName));
- if (mir_tstrcmpi(szClassName, L"RichEdit50W") != 0)
+ if (mir_wstrcmpi(szClassName, L"RichEdit50W") != 0)
return;
DWORD dwStart, dwEnd, dwFlags = SF_TEXT | SF_UNICODE;
@@ -593,7 +593,7 @@ void InvertCase(bool lastword) dwFlags += SFF_SELECTION;
wchar_t *boo, *sel = Message_GetFromStream(hwnd2, dwFlags);
- size_t slen = mir_tstrlen(sel), start = 0, end = 0;
+ size_t slen = mir_wstrlen(sel), start = 0, end = 0;
if (slen != 0) {
end = slen;
if (lastword && !somethingIsSelected) {
@@ -610,12 +610,12 @@ void InvertCase(bool lastword) start--;
}
boo = (wchar_t*)mir_alloc((end - start + 1) * sizeof(wchar_t));
- mir_tstrncpy(boo, sel + start, end - start);
+ mir_wstrncpy(boo, sel + start, end - start);
boo[end - start] = 0;
}
else {
boo = (wchar_t*)mir_alloc((slen + 1) * sizeof(wchar_t));
- mir_tstrcpy(boo, sel);
+ mir_wstrcpy(boo, sel);
}
Invert(boo);
@@ -623,11 +623,11 @@ void InvertCase(bool lastword) if (somethingIsSelected)
SendMessage(hwnd2, EM_REPLACESEL, false, (LPARAM)boo);
else {
- wchar_t *NewText = (wchar_t*)mir_alloc((start + mir_tstrlen(boo) + (slen - start) + 1) * sizeof(wchar_t));
+ wchar_t *NewText = (wchar_t*)mir_alloc((start + mir_wstrlen(boo) + (slen - start) + 1) * sizeof(wchar_t));
NewText[0] = 0;
- mir_tstrncat(NewText, sel, start);
- mir_tstrcat(NewText, boo);
- mir_tstrncat(NewText, sel + end, slen - end);
+ mir_wstrncat(NewText, sel, start);
+ mir_wstrcat(NewText, boo);
+ mir_wstrncat(NewText, sel + end, slen - end);
SetWindowText(hwnd2, NewText);
mir_free(NewText);
}
@@ -665,7 +665,7 @@ int OnButtonPressed(WPARAM, LPARAM lParam) SetKeyboardState(byKeybState);
wchar_t *sel = Message_GetFromStream(hEdit, SF_TEXT | SF_UNICODE);
- size_t slen = mir_tstrlen(sel);
+ size_t slen = mir_wstrlen(sel);
if (slen != 0) {
switch (iType) {
case 3: Invert(sel); break;
@@ -705,13 +705,13 @@ int OnButtonPressed(WPARAM, LPARAM lParam) }
}
- ptrT tszSymbol(db_get_tsa(NULL, "TranslitSwitcher", "ResendSymbol"));
+ ptrW tszSymbol(db_get_tsa(NULL, "TranslitSwitcher", "ResendSymbol"));
if (!tszSymbol && sel) {
SetWindowText(hEdit, sel);
SendMessage(hEdit, EM_SETSEL, 0, (LPARAM)slen);
SendMessage(cbcd->hwndFrom, WM_COMMAND, IDOK, 0);
}
- else if (sel && !mir_tstrncmp(sel, tszSymbol, mir_tstrlen(tszSymbol))) {
+ else if (sel && !mir_wstrncmp(sel, tszSymbol, mir_wstrlen(tszSymbol))) {
SetWindowText(hEdit, sel);
SendMessage(hEdit, EM_SETSEL, 0, (LPARAM)slen);
SendMessage(cbcd->hwndFrom, WM_COMMAND, IDOK, 0);
diff --git a/plugins/UserGuide/src/main.cpp b/plugins/UserGuide/src/main.cpp index 2d591663ba..3f37ede40b 100644 --- a/plugins/UserGuide/src/main.cpp +++ b/plugins/UserGuide/src/main.cpp @@ -28,28 +28,28 @@ static INT_PTR ShowGuideFile(WPARAM, LPARAM) if (ptszHelpFile==0)
{
- mir_tstrcpy(pszDirName, L"%miranda_path%\\Plugins");
- mir_tstrcpy(pszFileName, L"UserGuide.chm");
+ mir_wstrcpy(pszDirName, L"%miranda_path%\\Plugins");
+ mir_wstrcpy(pszFileName, L"UserGuide.chm");
}
else
{
- if(!mir_tstrcmp(ptszHelpFile, L""))
+ if(!mir_wstrcmp(ptszHelpFile, L""))
{
- mir_tstrcpy(pszDirName, L"%miranda_path%\\Plugins");
- mir_tstrcpy(pszFileName, L"UserGuide.chm");
+ mir_wstrcpy(pszDirName, L"%miranda_path%\\Plugins");
+ mir_wstrcpy(pszFileName, L"UserGuide.chm");
}
else
{
LPTSTR pszDivider = wcsrchr(ptszHelpFile, '\\');
if (pszDivider == NULL)
{
- mir_tstrcpy(pszDirName, L"");
- wcsncpy(pszFileName, ptszHelpFile, mir_tstrlen(ptszHelpFile));
+ mir_wstrcpy(pszDirName, L"");
+ wcsncpy(pszFileName, ptszHelpFile, mir_wstrlen(ptszHelpFile));
}
else
{
- wcsncpy(pszFileName, pszDivider + 1, mir_tstrlen(ptszHelpFile) - mir_tstrlen(pszDivider) - 1);
- pszFileName[mir_tstrlen(ptszHelpFile) - mir_tstrlen(pszDivider) - 1] = 0;
+ wcsncpy(pszFileName, pszDivider + 1, mir_wstrlen(ptszHelpFile) - mir_wstrlen(pszDivider) - 1);
+ pszFileName[mir_wstrlen(ptszHelpFile) - mir_wstrlen(pszDivider) - 1] = 0;
wcsncpy(pszDirName, ptszHelpFile, pszDivider - ptszHelpFile);
pszDirName[pszDivider - ptszHelpFile] = 0;
}
diff --git a/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp b/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp index 445928a641..2eb24aff20 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp @@ -347,7 +347,7 @@ void InitIcons() sid.flags = SIDF_SORTED | SIDF_TCHAR;
for (int i=0; i < nCountriesCount; i++) {
- sid.description.w = mir_a2t(LPGEN(countries[i].szName));
+ sid.description.w = mir_a2u(LPGEN(countries[i].szName));
/* create identifier */
mir_snprintf(szId, (countries[i].id == 0xFFFF) ? "%s0x%X" : "%s%i", "flags_", countries[i].id); /* buffer safe */
int index = CountryNumberToBitmapIndex(countries[i].id);
diff --git a/plugins/UserInfoEx/src/classMAnnivDate.cpp b/plugins/UserInfoEx/src/classMAnnivDate.cpp index 2bf0c62670..b4f9ed84fd 100644 --- a/plugins/UserInfoEx/src/classMAnnivDate.cpp +++ b/plugins/UserInfoEx/src/classMAnnivDate.cpp @@ -687,7 +687,7 @@ static WORD AskUser(MCONTACT hContact, MAnnivDate *pOldCustomDate, MAnnivDate *p pOldCustomDate->DateFormat(szoldDate, _countof(szoldDate));
pNewProtoDate->DateFormat(szDate, _countof(szDate));
- mir_sntprintf(szMsg,
+ mir_snwprintf(szMsg,
TranslateT("%s provides a new birthday via protocol.\nIt is %s. The old one was %s.\n\nDo you want to use this as the new birthday for this contact?"),
DB::Contact::DisplayName(hContact), szDate, szoldDate);
diff --git a/plugins/UserInfoEx/src/classMTime.cpp b/plugins/UserInfoEx/src/classMTime.cpp index 03cc310118..cb3a485fad 100644 --- a/plugins/UserInfoEx/src/classMTime.cpp +++ b/plugins/UserInfoEx/src/classMTime.cpp @@ -367,8 +367,8 @@ WORD MTime::DateFormatAlt(LPTSTR ptszTimeFormat, WORD cchTimeFormat) _itow(mtNow.Year(), tszText, 10);
wchar_t * tszYear = wcsstr(ptszTimeFormat, tszText);
- if (tszYear && mir_tstrlen(tszYear) == 4)
- mir_tstrcpy(tszYear, L"????");
+ if (tszYear && mir_wstrlen(tszYear) == 4)
+ mir_wstrcpy(tszYear, L"????");
else {
*ptszTimeFormat = 0;
return 0;
diff --git a/plugins/UserInfoEx/src/classPsTree.cpp b/plugins/UserInfoEx/src/classPsTree.cpp index ba83d12e61..8108f38d2d 100644 --- a/plugins/UserInfoEx/src/classPsTree.cpp +++ b/plugins/UserInfoEx/src/classPsTree.cpp @@ -130,7 +130,7 @@ int CPsTree::AddDummyItem(LPCSTR pszGroup) OPTIONSDIALOGPAGE odp = { 0 }; odp.hInstance = ghInst; odp.flags = ODPF_TCHAR; - odp.pwszTitle = mir_utf8decodeT(pszGroup); + odp.pwszTitle = mir_utf8decodeW(pszGroup); INT_PTR rc = UserInfo_AddPage((WPARAM)&psh, &odp); mir_free(odp.pwszTitle); diff --git a/plugins/UserInfoEx/src/classPsTreeItem.cpp b/plugins/UserInfoEx/src/classPsTreeItem.cpp index 2035874a55..22d6872017 100644 --- a/plugins/UserInfoEx/src/classPsTreeItem.cpp +++ b/plugins/UserInfoEx/src/classPsTreeItem.cpp @@ -31,7 +31,7 @@ BOOL CALLBACK BoldGroupTitlesEnumChildren(HWND hWnd, LPARAM lParam) {
wchar_t szClass[64];
GetClassName(hWnd, szClass, 64);
- 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, NULL);
return TRUE;
}
@@ -211,7 +211,7 @@ BYTE CPsTreeItem::HasName(const LPCSTR pszName) const void CPsTreeItem::Rename(const LPTSTR pszLabel)
{
if (pszLabel && *pszLabel) {
- LPTSTR pszDup = mir_tstrdup(pszLabel);
+ LPTSTR pszDup = mir_wstrdup(pszLabel);
if (pszDup) {
if (_ptszLabel)
mir_free(_ptszLabel);
@@ -253,9 +253,9 @@ int CPsTreeItem::ItemLabel(const BYTE bReadDBValue) else
pszName = _pszName;
- LPTSTR ptszLabel = mir_utf8decodeT(pszName);
+ LPTSTR ptszLabel = mir_utf8decodeW(pszName);
if (ptszLabel) {
- _ptszLabel = mir_tstrdup(TranslateTS(ptszLabel));
+ _ptszLabel = mir_wstrdup(TranslateTS(ptszLabel));
mir_free(ptszLabel);
}
}
@@ -279,7 +279,7 @@ HICON CPsTreeItem::ProtoIcon() int ProtoCount;
Proto_EnumAccounts(&ProtoCount, &pa);
for (int i = 0; i < ProtoCount; i++) {
- if (!mir_tstrncmpi(pa[i]->tszAccountName, _A2T(_pszName), mir_tstrlen(pa[i]->tszAccountName))) {
+ if (!mir_wstrncmpi(pa[i]->tszAccountName, _A2T(_pszName), mir_wstrlen(pa[i]->tszAccountName))) {
CHAR szIconID[MAX_PATH];
mir_snprintf(szIconID, "core_status_%s1", pa[i]->szModuleName);
HICON hIco = IcoLib_GetIcon(szIconID);
@@ -403,15 +403,15 @@ int CPsTreeItem::Create(CPsHdr* pPsh, OPTIONSDIALOGPAGE *odp) if (pPsh->_dwFlags & PSF_PROTOPAGESONLY) {
if (_dwFlags & ODPF_USERINFOTAB)
- mir_sntprintf(szTitle, L"%s %d\\%s", odp->pwszTitle, pPsh->_nSubContact+1, odp->pwszTab);
+ mir_snwprintf(szTitle, L"%s %d\\%s", odp->pwszTitle, pPsh->_nSubContact+1, odp->pwszTab);
else
- mir_sntprintf(szTitle, L"%s %d", odp->pwszTitle, pPsh->_nSubContact+1);
+ mir_snwprintf(szTitle, L"%s %d", odp->pwszTitle, pPsh->_nSubContact+1);
}
else {
if (_dwFlags & ODPF_USERINFOTAB)
- mir_sntprintf(szTitle, L"%s\\%s", odp->pwszTitle, odp->pwszTab);
+ mir_snwprintf(szTitle, L"%s\\%s", odp->pwszTitle, odp->pwszTab);
else
- mir_tstrcpy(szTitle, odp->pwszTitle);
+ mir_wstrcpy(szTitle, odp->pwszTitle);
}
// set the unique utf8 encoded name for the item
if (err = Name(szTitle, (_dwFlags & ODPF_UNICODE) == ODPF_UNICODE))
diff --git a/plugins/UserInfoEx/src/ctrl_annivedit.cpp b/plugins/UserInfoEx/src/ctrl_annivedit.cpp index a8fcf14a4d..3755643b45 100644 --- a/plugins/UserInfoEx/src/ctrl_annivedit.cpp +++ b/plugins/UserInfoEx/src/ctrl_annivedit.cpp @@ -404,7 +404,7 @@ INT_PTR CAnnivEditCtrl::SetCurSel(WORD wIndex) }
else {
wchar_t szText[MAX_DESC];
- mir_sntprintf(szText, L"'%s'", TranslateT("Unspecified"));
+ mir_snwprintf(szText, L"'%s'", TranslateT("Unspecified"));
DateTime_SetSystemtime(_hwndDate, GDT_NONE, NULL);
DateTime_SetFormat(_hwndDate, szText);
}
diff --git a/plugins/UserInfoEx/src/ctrl_contact.cpp b/plugins/UserInfoEx/src/ctrl_contact.cpp index ae37e6eaac..1e882cdfa9 100644 --- a/plugins/UserInfoEx/src/ctrl_contact.cpp +++ b/plugins/UserInfoEx/src/ctrl_contact.cpp @@ -65,7 +65,7 @@ typedef struct TComboEx static int compareProc(LPCVOID cbi1, LPCVOID cbi2)
{
- return mir_tstrcmp(((LPCBEXITEMINTERN)cbi1)->szCat, ((LPCBEXITEMINTERN)cbi2)->szCat);
+ return mir_wstrcmp(((LPCBEXITEMINTERN)cbi1)->szCat, ((LPCBEXITEMINTERN)cbi2)->szCat);
}
static int CheckPhoneSyntax(LPTSTR pszSrc, LPTSTR szNumber, WORD cchNumber, int& errorPos)
@@ -211,7 +211,7 @@ static INT_PTR CALLBACK DlgProc_EMail(HWND hDlg, UINT msg, WPARAM wParam, LPARAM *(pszAdd + 1) != '.' &&
(pszDot = wcschr(pszAdd, '.')) &&
*(pszDot + 1) &&
- mir_tstrcmp(szText, cbi->pszVal)));
+ mir_wstrcmp(szText, cbi->pszVal)));
}
}
break;
@@ -328,7 +328,7 @@ INT_PTR CALLBACK DlgProc_Phone(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam GetDlgItemText(hDlg, EDIT_AREA, szArea, _countof(szArea));
GetDlgItemText(hDlg, EDIT_NUMBER, szData, _countof(szData));
- mir_sntprintf(szPhone, L"+%u (%s) %s", nCountry, szArea, szData);
+ mir_snwprintf(szPhone, L"+%u (%s) %s", nCountry, szArea, szData);
noRecursion = 1;
SetDlgItemText(hDlg, EDIT_PHONE, szPhone);
noRecursion = 0;
@@ -780,7 +780,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L !cbex->pItems ||
cbex->iSelectedItem < 0 ||
cbex->iSelectedItem >= cbex->numItems ||
- FAILED(mir_sntprintf(szMsg, TranslateT("Do you really want to delete the current selected item?\n\t%s\n\t%s"),
+ FAILED(mir_snwprintf(szMsg, TranslateT("Do you really want to delete the current selected item?\n\t%s\n\t%s"),
cbex->pItems[cbex->iSelectedItem].szCat, cbex->pItems[cbex->iSelectedItem].pszVal))
)
{
@@ -866,7 +866,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L SendMessage(hDlgDetails, PSM_GETCONTACT, NULL, (LPARAM)&hContact);
if ((cbex->pItems[cbex->iSelectedItem].wFlags & CTRLF_CHANGED) && !(hContact && (cbex->pItems[cbex->iSelectedItem].wFlags & CTRLF_HASCUSTOM))) return 0;
- if (*szVal == 0 || !cbex->pItems[cbex->iSelectedItem].pszVal || mir_tstrcmp(szVal, cbex->pItems[cbex->iSelectedItem].pszVal)) {
+ if (*szVal == 0 || !cbex->pItems[cbex->iSelectedItem].pszVal || mir_wstrcmp(szVal, cbex->pItems[cbex->iSelectedItem].pszVal)) {
cbex->pItems[cbex->iSelectedItem].wFlags |= CTRLF_CHANGED;
cbex->pItems[cbex->iSelectedItem].wFlags |= (hContact ? CTRLF_HASCUSTOM : CTRLF_HASPROTO);
cbex->bIsChanged = TRUE;
@@ -945,13 +945,13 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L cbex->pItems[cbex->numItems].dwID = (pItem->wMask & CBEXIM_ID) ? pItem->dwID : 0;
// set category string
- if (!pItem->pszCat || !pItem->pszCat[0] || !mir_tstrncpy(cbex->pItems[cbex->numItems].szCat, pItem->pszCat, MAX_CAT)) {
- mir_sntprintf(cbex->pItems[cbex->numItems].szCat, L"%s %d", TranslateT("Other"), ++cbex->numOther);
+ if (!pItem->pszCat || !pItem->pszCat[0] || !mir_wstrncpy(cbex->pItems[cbex->numItems].szCat, pItem->pszCat, MAX_CAT)) {
+ mir_snwprintf(cbex->pItems[cbex->numItems].szCat, L"%s %d", TranslateT("Other"), ++cbex->numOther);
}
// set value string
if ((pItem->wMask & CBEXIM_VAL) && pItem->pszVal && pItem->pszVal[0])
- cbex->pItems[cbex->numItems].pszVal = mir_tstrdup(pItem->pszVal);
+ cbex->pItems[cbex->numItems].pszVal = mir_wstrdup(pItem->pszVal);
else
cbex->pItems[cbex->numItems].pszVal = NULL;
// set icon
@@ -985,8 +985,8 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L // set new category string
if (pItem->wMask & CBEXIM_CAT) {
// set category string
- if (!pItem->pszCat || !pItem->pszCat[0] || !mir_tstrncpy(cbex->pItems[pItem->iItem].szCat, pItem->pszCat, _countof(cbex->pItems[pItem->iItem].szCat)))
- mir_sntprintf(cbex->pItems[pItem->iItem].szCat, L"%s %d", TranslateT("Other"), ++cbex->numOther);
+ if (!pItem->pszCat || !pItem->pszCat[0] || !mir_wstrncpy(cbex->pItems[pItem->iItem].szCat, pItem->pszCat, _countof(cbex->pItems[pItem->iItem].szCat)))
+ mir_snwprintf(cbex->pItems[pItem->iItem].szCat, L"%s %d", TranslateT("Other"), ++cbex->numOther);
if (pItem->iItem == cbex->iSelectedItem)
SetWindowText(cbex->hBtnEdit, cbex->pItems[pItem->iItem].szCat);
}
@@ -994,7 +994,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L if (pItem->wMask & CBEXIM_VAL) {
MIR_FREE(cbex->pItems[pItem->iItem].pszVal);
if (pItem->pszVal && pItem->pszVal[0])
- cbex->pItems[pItem->iItem].pszVal = mir_tstrdup(pItem->pszVal);
+ cbex->pItems[pItem->iItem].pszVal = mir_wstrdup(pItem->pszVal);
if (pItem->iItem == cbex->iSelectedItem)
SetWindowText(cbex->hEdit, cbex->pItems[pItem->iItem].pszVal ? cbex->pItems[pItem->iItem].pszVal : L"");
}
@@ -1049,14 +1049,14 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L // return category string
if ((pItem->wMask & CBEXIM_CAT) && pItem->pszCat) {
if (*cbex->pItems[pItem->iItem].szCat != 0)
- mir_tstrncpy(pItem->pszCat, cbex->pItems[pItem->iItem].szCat, pItem->ccCat - 1);
+ mir_wstrncpy(pItem->pszCat, cbex->pItems[pItem->iItem].szCat, pItem->ccCat - 1);
else
*pItem->pszCat = 0;
}
// return value string
if ((pItem->wMask & CBEXIM_VAL) && pItem->pszVal) {
if (cbex->pItems[pItem->iItem].pszVal)
- mir_tstrncpy(pItem->pszVal, cbex->pItems[pItem->iItem].pszVal, pItem->ccVal - 1);
+ mir_wstrncpy(pItem->pszVal, cbex->pItems[pItem->iItem].pszVal, pItem->ccVal - 1);
else
*pItem->pszVal = 0;
}
@@ -1428,7 +1428,7 @@ int CtrlContactWriteItemToDB( db_unset(hContact, pszModule, pszSetting);
else {
if (cbi.wFlags & CBEXIF_SMS)
- mir_tstrncat(szVal, L" SMS", _countof(szVal) - mir_tstrlen(szVal));
+ mir_wstrncat(szVal, L" SMS", _countof(szVal) - mir_wstrlen(szVal));
if (db_set_ts(hContact, pszModule, pszSetting, szVal)) return 1;
}
@@ -1466,7 +1466,7 @@ int CtrlContactWriteMyItemsToDB( if (!hContact && !(pszModule = pszProto)) return 1;
pszOther = TranslateT("Other");
- ccOther = mir_tstrlen(pszOther);
+ ccOther = mir_wstrlen(pszOther);
cbi.wMask = CBEXIM_CAT|CBEXIM_VAL|CBEXIM_FLAGS;
cbi.pszCat = szCat;
cbi.ccCat = MAX_CAT;
@@ -1478,7 +1478,7 @@ int CtrlContactWriteMyItemsToDB( while (CtrlContactWndProc(hCtrl, CBEXM_GETITEM, NULL, (LPARAM)&cbi) && cbi.iItem < 50) {
if (!(cbi.wFlags & CBEXIF_DELETED) && *szVal) {
if (cbi.wFlags & CBEXIF_SMS) {
- mir_tstrncat(szVal, L" SMS", _countof(szVal) - mir_tstrlen(szVal));
+ mir_wstrncat(szVal, L" SMS", _countof(szVal) - mir_wstrlen(szVal));
}
mir_snprintf(pszSetting, szFormatCat, i);
if (*szCat && wcsncmp(szCat, pszOther, ccOther)) {
diff --git a/plugins/UserInfoEx/src/ctrl_edit.cpp b/plugins/UserInfoEx/src/ctrl_edit.cpp index cc08d5f408..874b6846dd 100644 --- a/plugins/UserInfoEx/src/ctrl_edit.cpp +++ b/plugins/UserInfoEx/src/ctrl_edit.cpp @@ -121,19 +121,19 @@ BOOL CEditCtrl::OnInfoChanged(MCONTACT hContact, LPCSTR pszProto) case DBVT_BYTE: _itow_s(dbv.bVal, szText, _countof(szText), 10); SetWindowText(_hwnd, szText); - _pszValue = mir_tstrdup(szText); + _pszValue = mir_wstrdup(szText); break; case DBVT_WORD: _itow_s(dbv.wVal, szText, _countof(szText), 10); SetWindowText(_hwnd, szText); - _pszValue = mir_tstrdup(szText); + _pszValue = mir_wstrdup(szText); break; case DBVT_DWORD: _itow_s(dbv.dVal, szText, _countof(szText), 10); SetWindowText(_hwnd, szText); - _pszValue = mir_tstrdup(szText); + _pszValue = mir_wstrdup(szText); break; case DBVT_TCHAR: @@ -237,7 +237,7 @@ void CEditCtrl::OnChangedByUser(WORD wChangedMsg) if ((wChangedMsg == EN_UPDATE) || (wChangedMsg == EN_CHANGE)) { DWORD cch = GetWindowTextLength(_hwnd); - _Flags.B.hasChanged = mir_tstrlen(_pszValue) != cch; + _Flags.B.hasChanged = mir_wstrlen(_pszValue) != cch; _Flags.B.hasCustom = (cch > 0); if (!_Flags.B.hasChanged && _Flags.B.hasCustom) { @@ -255,7 +255,7 @@ void CEditCtrl::OnChangedByUser(WORD wChangedMsg) if (szText != NULL) { GetWindowText(_hwnd, szText, cch + 1); - _Flags.B.hasChanged = mir_tstrcmp(_pszValue, szText) != 0; + _Flags.B.hasChanged = mir_wstrcmp(_pszValue, szText) != 0; if (need_free) MIR_FREE(szText); } diff --git a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp index ede54b4d37..73e8018d72 100644 --- a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp +++ b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp @@ -244,7 +244,7 @@ class CAnnivList case COLUMN_DESC:
ListView_GetItemText(pDlg->_hList, iItem1, pDlg->_sortHeader, szText1, _countof(szText1));
ListView_GetItemText(pDlg->_hList, iItem2, pDlg->_sortHeader, szText2, _countof(szText2));
- result = pDlg->_sortOrder * mir_tstrcmp(szText1, szText2);
+ result = pDlg->_sortOrder * mir_wstrcmp(szText1, szText2);
break;
case COLUMN_AGE:
@@ -698,7 +698,7 @@ class CAnnivList AddSubItem(iItem, COLUMN_CONTACT, DB::Contact::DisplayName(hContact));
// third column: protocol
- wchar_t *ptszProto = mir_a2t(pszProto);
+ wchar_t *ptszProto = mir_a2u(pszProto);
AddSubItem(iItem, COLUMN_PROTO, ptszProto);
mir_free(ptszProto);
@@ -768,7 +768,7 @@ class CAnnivList // add anniversaries
if (_filter.bFilterIndex != FILTER_BIRTHDAY && (!_filter.pszProto || !_strcmpi(pszProto, _filter.pszProto)))
for (i = 0; !ad.DBGetAnniversaryDate(hContact, i); i++)
- if (!_filter.pszAnniv || !mir_tstrcmpi(_filter.pszAnniv, ad.Description()))
+ if (!_filter.pszAnniv || !mir_wstrcmpi(_filter.pszAnniv, ad.Description()))
AddRow(hContact, pszProto, ad, mtNow, wDaysBefore);
}
}
diff --git a/plugins/UserInfoEx/src/dlg_msgbox.cpp b/plugins/UserInfoEx/src/dlg_msgbox.cpp index a3b3444e43..68aacb64fa 100644 --- a/plugins/UserInfoEx/src/dlg_msgbox.cpp +++ b/plugins/UserInfoEx/src/dlg_msgbox.cpp @@ -495,8 +495,8 @@ static INT_PTR CALLBACK MsgBoxPop(HWND hDlg, UINT uMsg, WPARAM, LPARAM lParam) pd.lchContact = NULL; //(HANDLE)wParam;
// icon
pd.lchIcon = MsgLoadIcon(pMsgBox);
- mir_tstrncpy(pd.lptzContactName, pMsgBox->ptszTitle, _countof(pd.lptzContactName));
- mir_tstrncpy(pd.lptzText, pMsgBox->ptszMsg, _countof(pd.lptzText));
+ mir_wstrncpy(pd.lptzContactName, pMsgBox->ptszTitle, _countof(pd.lptzContactName));
+ mir_wstrncpy(pd.lptzText, pMsgBox->ptszMsg, _countof(pd.lptzText));
// CALLBAC Proc
pd.PluginWindowProc = PopupProc;
@@ -664,7 +664,7 @@ INT_PTR CALLBACK MsgBox(HWND hParent, UINT uType, LPCTSTR pszTitle, LPCTSTR pszI va_list vl;
va_start(vl, pszFormat);
- mir_vsntprintf(tszMsg, _countof(tszMsg), TranslateTS(pszFormat), vl);
+ mir_vsnwprintf(tszMsg, _countof(tszMsg), TranslateTS(pszFormat), vl);
va_end(vl);
MSGBOX mb = { 0 };
@@ -687,11 +687,11 @@ INT_PTR CALLBACK MsgBox(HWND hParent, UINT uType, LPCTSTR pszTitle, LPCTSTR pszI INT_PTR CALLBACK MsgErr(HWND hParent, LPCTSTR pszFormat, ...)
{
wchar_t tszTitle[MAX_SECONDLINE], tszMsg[MAX_SECONDLINE];
- mir_sntprintf(tszTitle, L"%s - %s", _T(MODNAME), TranslateT("Error"));
+ mir_snwprintf(tszTitle, L"%s - %s", _T(MODNAME), TranslateT("Error"));
va_list vl;
va_start(vl, pszFormat);
- mir_vsntprintf(tszMsg, TranslateTS(pszFormat), vl);
+ mir_vsnwprintf(tszMsg, TranslateTS(pszFormat), vl);
va_end(vl);
MSGBOX mb = {0};
diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index c4c9cc2d17..71f4fef8d7 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -356,7 +356,7 @@ static INT_PTR AddPage(WPARAM wParam, LPARAM lParam) if (pPsh->_dwFlags & (PSF_PROTOPAGESONLY | PSF_PROTOPAGESONLY_INIT)) {
BYTE bIsUnicode = (odp->flags & ODPF_UNICODE) == ODPF_UNICODE;
- wchar_t *ptszTitle = bIsUnicode ? mir_tstrdup(odp->pwszTitle) : mir_a2t(odp->pszTitle);
+ wchar_t *ptszTitle = bIsUnicode ? mir_wstrdup(odp->pwszTitle) : mir_a2u(odp->pszTitle);
// avoid adding pages for a meta subcontact, which have been added for a metacontact.
if (pPsh->_dwFlags & PSF_PROTOPAGESONLY) {
@@ -367,7 +367,7 @@ static INT_PTR AddPage(WPARAM wParam, LPARAM lParam) }
// init ignore list with pages added by metacontact
else if (pPsh->_dwFlags & PSF_PROTOPAGESONLY_INIT)
- pPsh->_ignore.insert(mir_tstrdup(ptszTitle));
+ pPsh->_ignore.insert(mir_wstrdup(ptszTitle));
mir_free(ptszTitle);
}
@@ -429,7 +429,7 @@ static int OnShutdown(WPARAM, LPARAM) static int AddProtocolPages(OPTIONSDIALOGPAGE& odp, WPARAM wParam, LPSTR pszProto = NULL)
{
wchar_t szTitle[MAX_PATH];
- const BYTE ofs = (pszProto) ? mir_sntprintf(szTitle, L"%S\\", pszProto) : 0;
+ const BYTE ofs = (pszProto) ? mir_snwprintf(szTitle, L"%S\\", pszProto) : 0;
odp.pwszTitle = szTitle;
@@ -437,56 +437,56 @@ static int AddProtocolPages(OPTIONSDIALOGPAGE& odp, WPARAM wParam, LPSTR pszProt odp.position = 0x8000000;
odp.pfnDlgProc = PSPProcGeneral;
odp.hIcon = (HICON)ICONINDEX(IDI_TREE_GENERAL);
- mir_tstrncpy(szTitle + ofs, LPGENW("General"), _countof(szTitle) - ofs);
+ mir_wstrncpy(szTitle + ofs, LPGENW("General"), _countof(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ADDRESS);
odp.position = 0x8000001;
odp.pfnDlgProc = PSPProcContactHome;
odp.hIcon = (HICON)ICONINDEX(IDI_TREE_ADDRESS);
- mir_tstrncpy(szTitle + ofs, LPGENW("General") L"\\" LPGENW("Contact (private)"), _countof(szTitle) - ofs);
+ mir_wstrncpy(szTitle + ofs, LPGENW("General") L"\\" LPGENW("Contact (private)"), _countof(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ORIGIN);
odp.position = 0x8000002;
odp.pfnDlgProc = PSPProcOrigin;
odp.hIcon = (HICON)ICONINDEX(IDI_TREE_ADVANCED);
- mir_tstrncpy(szTitle + ofs, LPGENW("General") L"\\" LPGENW("Origin"), _countof(szTitle) - ofs);
+ mir_wstrncpy(szTitle + ofs, LPGENW("General") L"\\" LPGENW("Origin"), _countof(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ANNIVERSARY);
odp.position = 0x8000003;
odp.pfnDlgProc = PSPProcAnniversary;
odp.hIcon = (HICON)ICONINDEX(IDI_BIRTHDAY);
- mir_tstrncpy(szTitle + ofs, LPGENW("General") L"\\" LPGENW("Anniversaries"), _countof(szTitle) - ofs);
+ mir_wstrncpy(szTitle + ofs, LPGENW("General") L"\\" LPGENW("Anniversaries"), _countof(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_COMPANY);
odp.position = 0x8000004;
odp.pfnDlgProc = PSPProcCompany;
odp.hIcon = (HICON)ICONINDEX(IDI_TREE_COMPANY);
- mir_tstrncpy(szTitle + ofs, LPGENW("Work"), _countof(szTitle) - ofs);
+ mir_wstrncpy(szTitle + ofs, LPGENW("Work"), _countof(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ADDRESS);
odp.position = 0x8000005;
odp.pfnDlgProc = PSPProcContactWork;
odp.hIcon = (HICON)ICONINDEX(IDI_TREE_ADDRESS);
- mir_tstrncpy(szTitle + ofs, LPGENW("Work") L"\\" LPGENW("Contact (work)"), _countof(szTitle) - ofs);
+ mir_wstrncpy(szTitle + ofs, LPGENW("Work") L"\\" LPGENW("Contact (work)"), _countof(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ABOUT);
odp.position = 0x8000006;
odp.pfnDlgProc = PSPProcAbout;
odp.hIcon = (HICON)ICONINDEX(IDI_TREE_ABOUT);
- mir_tstrncpy(szTitle + ofs, LPGENW("About"), _countof(szTitle) - ofs);
+ mir_wstrncpy(szTitle + ofs, LPGENW("About"), _countof(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_PROFILE);
odp.position = 0x8000007;
odp.pfnDlgProc = PSPProcContactProfile;
odp.hIcon = (HICON)ICONINDEX(IDI_TREE_PROFILE);
- mir_tstrncpy(szTitle + ofs, LPGENW("About") L"\\" LPGENW("Profile"), _countof(szTitle) - ofs);
+ mir_wstrncpy(szTitle + ofs, LPGENW("About") L"\\" LPGENW("Profile"), _countof(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
return 0;
}
@@ -735,7 +735,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar GetObject(hNormalFont, sizeof(lf), &lf);
lf.lfHeight = 22;
- mir_tstrcpy(lf.lfFaceName, L"Segoe UI");
+ mir_wstrcpy(lf.lfFaceName, L"Segoe UI");
pPs->hCaptionFont = CreateFontIndirect(&lf);
SendDlgItemMessage(hDlg, IDC_PAGETITLE, WM_SETFONT, (WPARAM)pPs->hCaptionFont, 0);
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp index 96cd972f8c..74f2a84c49 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp @@ -256,7 +256,7 @@ MCONTACT CExImContactBase::toDB() // add group if (_pszGroup) { - ptrT ptszGroup(mir_utf8decodeT(_pszGroup)); + ptrW ptszGroup(mir_utf8decodeW(_pszGroup)); db_set_ts(_hContact, MOD_CLIST, "Group", ptszGroup); Clist_GroupCreate(NULL, ptszGroup); } @@ -291,7 +291,7 @@ void CExImContactBase::toIni(FILE* file, int modCount) } else { // Proto loaded - GetContactName(hContact,pszProto,0) - ptrT pszCI(Contact_GetInfo(CNF_DISPLAY, _hContact, _pszProto)); + ptrW pszCI(Contact_GetInfo(CNF_DISPLAY, _hContact, _pszProto)); ptrA pszUID(uid2String(FALSE)); if (_pszUIDKey && pszUID) mir_snprintf(name, "%S *(%s)*<%s>*{%s}*", pszCI, _pszProto, _pszUIDKey, pszUID); @@ -475,8 +475,8 @@ BYTE CExImContactBase::isHandle(MCONTACT hContact) // compare nicknames if no UID else if (!DB::Setting::GetUString(hContact, _pszProto, SET_CONTACT_NICK, &dbv)) { if (dbv.type == DBVT_UTF8 && dbv.pszVal && !mir_strcmpi(dbv.pszVal,_pszNick)) { - LPTSTR ptszNick = mir_utf8decodeT(_pszNick); - LPTSTR ptszProto = mir_a2t(_pszProto); + LPTSTR ptszNick = mir_utf8decodeW(_pszNick); + LPTSTR ptszProto = mir_a2u(_pszProto); int ans = MsgBox(NULL, MB_ICONQUESTION|MB_YESNO, LPGENW("Question"), LPGENW("contact identification"), LPGENW("The contact %s(%s) has no unique ID in the vCard,\nbut there is a contact in your contact list with the same nick and protocol.\nDo you wish to use this contact?"), ptszNick, ptszProto); diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp index e75750654f..4a9b06f82e 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp @@ -688,7 +688,7 @@ int CExImContactXML::Import(BYTE keepMetaSubContact) do {
// update progressbar and abort if user clicked cancel
int result = _pXmlFile->_progress.UpdateContact(L"Sub Contact: %s (%S)",
- ptrT(mir_utf8decodeT(xContact->Attribute("nick"))), xContact->Attribute("proto"));
+ ptrW(mir_utf8decodeW(xContact->Attribute("nick"))), xContact->Attribute("proto"));
// user clicked abort button
if (!result) break;
@@ -739,8 +739,8 @@ int CExImContactXML::ImportMetaSubContact(CExImContactXML * pMetaContact) if (err == FALSE) {
// ask to delete new contact
if (_isNewContact && _hContact != NULL) {
- LPTSTR ptszNick = mir_utf8decodeT(_pszNick);
- LPTSTR ptszMetaNick = mir_utf8decodeT(pMetaContact->_pszNick);
+ LPTSTR ptszNick = mir_utf8decodeW(_pszNick);
+ LPTSTR ptszMetaNick = mir_utf8decodeW(pMetaContact->_pszNick);
int result = MsgBox(NULL, MB_YESNO|MB_ICONWARNING,
LPGENW("Question"),
LPGENW("Importing a new meta subcontact failed!"),
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp index 10c51971b4..13d8558ec7 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp @@ -221,7 +221,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar }
TranslateDialogDefault(hDlg); //to translate oldTitle
GetWindowText(hDlg, oldTitle, _countof(oldTitle));
- mir_sntprintf(newTitle, L"%s - %s", name, oldTitle);
+ mir_snwprintf(newTitle, L"%s - %s", name, oldTitle);
SetWindowText(hDlg, newTitle);
}
@@ -301,7 +301,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar case EXIM_GROUP:
break;
case EXIM_SUBGROUP:
- if (mir_tstrncmp(pDat->ExImContact->ptszName, DB::Setting::GetTString(hContact, "CList", "Group"), mir_tstrlen(pDat->ExImContact->ptszName))) {
+ if (mir_wstrncmp(pDat->ExImContact->ptszName, DB::Setting::GetTString(hContact, "CList", "Group"), mir_wstrlen(pDat->ExImContact->ptszName))) {
continue;
}
break;
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp index 380e238788..36886e384f 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp @@ -114,7 +114,7 @@ static LRESULT CALLBACK PlacesBarSubclassProc(HWND hWnd, UINT uMsg, WPARAM wPara // miranda button
switch (tbb->idCommand) {
case 41063:
- mir_tstrncpy(szBtnText, TranslateT("Miranda NG"), _countof(szBtnText));
+ mir_wstrncpy(szBtnText, TranslateT("Miranda NG"), _countof(szBtnText));
iString = SendMessage(hWnd, TB_ADDSTRING, NULL, (LPARAM)szBtnText);
if (iString != -1) tbb->iString = iString;
// set tooltip
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp index 92981e12d7..ea71cc0d20 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp @@ -191,7 +191,7 @@ BYTE CProgress::UpdateContact(LPCTSTR pszFormat, ...) va_list vl;
va_start(vl, pszFormat);
- mir_vsntprintf(buf, _countof(buf), TranslateTS(pszFormat), vl);
+ mir_vsnwprintf(buf, _countof(buf), TranslateTS(pszFormat), vl);
va_end(vl);
SetDlgItemText(_hDlg, TXT_CONTACT, buf);
}
@@ -218,10 +218,10 @@ BYTE CProgress::UpdateSetting(LPCTSTR pszFormat, ...) va_list vl;
va_start(vl, pszFormat);
- mir_vsntprintf(buf, _countof(buf), TranslateTS(pszFormat), vl);
+ mir_vsnwprintf(buf, _countof(buf), TranslateTS(pszFormat), vl);
va_end(vl);
GetDlgItemText(_hDlg, TXT_SETTING, tmp, _countof(tmp));
- if (mir_tstrcmpi(tmp,buf))
+ if (mir_wstrcmpi(tmp,buf))
SetDlgItemText(_hDlg, TXT_SETTING, buf);
}
SendMessage(hProg, PBM_SETPOS, (int)SendMessage(hProg, PBM_GETPOS, 0, 0) + 1, 0);
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp index 30f7151067..2ac2aaa37d 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp @@ -164,7 +164,7 @@ int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName) // dont export meta subcontacts by default and
// export only contact with selectet group name
if (!db_mc_isSub(hContact) &&
- mir_tstrncmp(ExImContact->ptszName, DB::Setting::GetTString(hContact, "CList", "Group"), mir_tstrlen(ExImContact->ptszName))== 0)
+ mir_wstrncmp(ExImContact->ptszName, DB::Setting::GetTString(hContact, "CList", "Group"), mir_wstrlen(ExImContact->ptszName))== 0)
{
if (vContact.fromDB(hContact)) {
vContact.Export(xmlfile, &Modules);
@@ -253,7 +253,7 @@ int CFileXml::ImportContacts(TiXmlElement* xmlParent) for (TiXmlElement *xContact = xmlParent->FirstChildElement(); xContact != NULL; xContact = xContact->NextSiblingElement()) {
if (!mir_strcmpi(xContact->Value(), XKEY_CONTACT)) {
// update progressbar and abort if user clicked cancel
- LPTSTR pszNick = mir_utf8decodeT(xContact->Attribute("nick"));
+ LPTSTR pszNick = mir_utf8decodeW(xContact->Attribute("nick"));
// user clicked abort button
if (_progress.UpdateContact(LPGENW("Contact: %s (%S)"), pszNick, xContact->Attribute("proto"))) {
int result = vContact.LoadXmlElemnt(xContact);
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp index 864129010c..078f0ee27d 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp @@ -53,17 +53,17 @@ static void DisplayNameToFileName(lpExImParam ExImContact, LPSTR pszFileName, WO return;
}
- disp = temp = mir_t2a(pcli->pfnGetContactDisplayName(ExImContact->hContact, NULL));
+ disp = temp = mir_u2a(pcli->pfnGetContactDisplayName(ExImContact->hContact, NULL));
break;
case EXIM_SUBGROUP:
- temp = mir_t2a(ExImContact->ptszName);
+ temp = mir_u2a(ExImContact->ptszName);
disp = temp;
break;
case EXIM_ACCOUNT:
PROTOACCOUNT* acc = Proto_GetAccount(ExImContact->pszName);
- disp = temp = mir_t2a(acc->tszAccountName);
+ disp = temp = mir_u2a(acc->tszAccountName);
break;
}
@@ -280,8 +280,8 @@ INT_PTR svcExIm_Group_Service(WPARAM wParam, LPARAM) while (hItem) {
if (SendMessage(hClist,CLM_GETITEMTYPE, (WPARAM)hItem, 0) == CLCIT_GROUP) {
SendMessage(hClist,CLM_GETITEMTEXT, (WPARAM)hItem, (LPARAM)ptszItem);
- LPTSTR temp = mir_tstrdup(ptszGroup);
- mir_sntprintf(tszGroup, L"%s%s%s", ptszItem, mir_tstrlen(temp)? L"\\":L"", temp);
+ LPTSTR temp = mir_wstrdup(ptszGroup);
+ mir_snwprintf(tszGroup, L"%s%s%s", ptszItem, mir_wstrlen(temp)? L"\\":L"", temp);
mir_free (temp);
}
hParent = SendMessage(hClist,CLM_GETNEXTITEM, (WPARAM)CLGN_PARENT, (LPARAM)hItem);
diff --git a/plugins/UserInfoEx/src/mir_icolib.cpp b/plugins/UserInfoEx/src/mir_icolib.cpp index 6cb53675a8..33c1a84934 100644 --- a/plugins/UserInfoEx/src/mir_icolib.cpp +++ b/plugins/UserInfoEx/src/mir_icolib.cpp @@ -229,8 +229,8 @@ static HANDLE IcoLib_RegisterIconHandleEx(LPSTR szIconID, LPSTR szDescription, L SKINICONDESC sid = { 0 };
sid.flags = SIDF_ALL_TCHAR;
sid.pszName = szIconID;
- sid.description.w = mir_a2t(szDescription);
- sid.section.w = mir_a2t(szSection);
+ sid.description.w = mir_a2u(szDescription);
+ sid.section.w = mir_a2u(szSection);
if (sid.description.w && sid.section.w) {
switch (Size) {
diff --git a/plugins/UserInfoEx/src/psp_anniversary.cpp b/plugins/UserInfoEx/src/psp_anniversary.cpp index b1c7514edc..5ce0033301 100644 --- a/plugins/UserInfoEx/src/psp_anniversary.cpp +++ b/plugins/UserInfoEx/src/psp_anniversary.cpp @@ -85,7 +85,7 @@ static INT_PTR CALLBACK DlgProc_AnniversaryEditor(HWND hDlg, UINT uMsg, WPARAM w break;
}
- if (mir_tstrcmpi(pszText, pDlgEditAnniv->Description())) {
+ if (mir_wstrcmpi(pszText, pDlgEditAnniv->Description())) {
pDlgEditAnniv->Description(pszText);
pDlgEditAnniv->SetFlags(MAnnivDate::MADF_HASCUSTOM | MAnnivDate::MADF_CHANGED);
}
diff --git a/plugins/UserInfoEx/src/psp_contact.cpp b/plugins/UserInfoEx/src/psp_contact.cpp index 2f0f6a9fa0..afb2061c38 100644 --- a/plugins/UserInfoEx/src/psp_contact.cpp +++ b/plugins/UserInfoEx/src/psp_contact.cpp @@ -46,7 +46,7 @@ INT_PTR CALLBACK PSPProcContactHome(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM PSGetBoldFont(hDlg, hBoldFont);
SendDlgItemMessage(hDlg, IDC_PAGETITLE, WM_SETFONT, (WPARAM)hBoldFont, 0);
- mir_sntprintf(szAddr, L"%s (%s)", TranslateT("Address"), TranslateT("home"));
+ mir_snwprintf(szAddr, L"%s (%s)", TranslateT("Address"), TranslateT("home"));
SetDlgItemText(hDlg, IDC_PAGETITLE, szAddr);
SendDlgItemMessage(hDlg, BTN_GOTO, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Open in browser"), MBBF_TCHAR);
TranslateDialogDefault(hDlg);
@@ -192,7 +192,7 @@ INT_PTR CALLBACK PSPProcContactWork(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM PSGetBoldFont(hDlg, hBoldFont);
SendDlgItemMessage(hDlg, IDC_PAGETITLE, WM_SETFONT, (WPARAM)hBoldFont, 0);
- mir_sntprintf(szAddr, L"%s (%s)", TranslateT("Address and contact"), TranslateT("company"));
+ mir_snwprintf(szAddr, L"%s (%s)", TranslateT("Address and contact"), TranslateT("company"));
SetDlgItemText(hDlg, IDC_PAGETITLE, szAddr);
SendDlgItemMessage(hDlg, BTN_GOTO, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Open in browser"), MBBF_TCHAR);
TranslateDialogDefault(hDlg);
diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp index fa6a41a010..1c93297951 100644 --- a/plugins/UserInfoEx/src/psp_options.cpp +++ b/plugins/UserInfoEx/src/psp_options.cpp @@ -883,10 +883,10 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR {
POPUPDATAT ppd = { 0 };
ppd.iSeconds = (int)db_get_b(NULL, MODNAME, SET_POPUP_DELAY, 0);
- mir_tstrncpy(ppd.lptzText, TranslateT("This is the reminder message"), MAX_SECONDLINE);
+ mir_wstrncpy(ppd.lptzText, TranslateT("This is the reminder message"), MAX_SECONDLINE);
// Birthday
- mir_tstrncpy(ppd.lptzContactName, TranslateT("Birthday"), _countof(ppd.lptzContactName));
+ mir_wstrncpy(ppd.lptzContactName, TranslateT("Birthday"), _countof(ppd.lptzContactName));
ppd.lchIcon = IcoLib_GetIcon(ICO_RMD_DTB0);
if (IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_WINCLR)) {
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
@@ -899,7 +899,7 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR PUAddPopupT(&ppd);
// Anniversary
- mir_tstrncpy(ppd.lptzContactName, TranslateT("Anniversary"), _countof(ppd.lptzContactName));
+ mir_wstrncpy(ppd.lptzContactName, TranslateT("Anniversary"), _countof(ppd.lptzContactName));
ppd.lchIcon = IcoLib_GetIcon(ICO_RMD_DTAX);
if (IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_WINCLR)) {
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
diff --git a/plugins/UserInfoEx/src/psp_origin.cpp b/plugins/UserInfoEx/src/psp_origin.cpp index 7dd0f8cc53..b9d50cec7f 100644 --- a/plugins/UserInfoEx/src/psp_origin.cpp +++ b/plugins/UserInfoEx/src/psp_origin.cpp @@ -92,8 +92,8 @@ INT_PTR CALLBACK PSPProcOrigin(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara mt.UTCToLocal();
mt.DateFormatLong(szTime, _countof(szTime));
- mir_tstrcat(szTime, L" - ");
- ptr = szTime + mir_tstrlen(szTime);
+ mir_wstrcat(szTime, L" - ");
+ ptr = szTime + mir_wstrlen(szTime);
mt.TimeFormat(ptr, _countof(szTime) - (ptr - szTime));
SetDlgItemText(hDlg, TXT_DATEADDED, szTime);
}
diff --git a/plugins/UserInfoEx/src/psp_profile.cpp b/plugins/UserInfoEx/src/psp_profile.cpp index ead5c48503..651054eb5c 100644 --- a/plugins/UserInfoEx/src/psp_profile.cpp +++ b/plugins/UserInfoEx/src/psp_profile.cpp @@ -231,7 +231,7 @@ static int ProfileList_EndLabelEdit(LPLISTCTRL pList, BYTE bSave) pList->labelEdit.pItem->pszText[pList->labelEdit.iSubItem] = szEdit;
bChanged = TRUE;
}
- else if (mir_tstrcmp(pList->labelEdit.pItem->pszText[pList->labelEdit.iSubItem], szEdit)) {
+ else if (mir_wstrcmp(pList->labelEdit.pItem->pszText[pList->labelEdit.iSubItem], szEdit)) {
mir_free(pList->labelEdit.pItem->pszText[pList->labelEdit.iSubItem]);
pList->labelEdit.pItem->pszText[pList->labelEdit.iSubItem] = szEdit;
bChanged = TRUE;
@@ -537,7 +537,7 @@ static int ProfileList_AddItemlistFromDB( }
// item not found in the predefined category list?
if ((idList == NULL || j == nList) && dbvCat.type == DBVT_ASCIIZ) {
- pItem->pszText[0] = mir_a2t(dbvCat.pszVal);
+ pItem->pszText[0] = mir_a2u(dbvCat.pszVal);
db_free(&dbvCat);
}
if ((lvi.iItem = ListView_InsertItem(pList->hList, &lvi)) < 0) {
@@ -826,7 +826,7 @@ static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa HDC hDC = GetDC(GetParent(hwnd));
if (hDC != NULL) {
SelectObject(hDC, (HFONT)SendMessage(GetParent(hwnd), WM_GETFONT, NULL, NULL));
- GetTextExtentPoint32(hDC, pItem->pszText[hi.iSubItem], (int)mir_tstrlen(pItem->pszText[hi.iSubItem]), &textSize);
+ GetTextExtentPoint32(hDC, pItem->pszText[hi.iSubItem], (int)mir_wstrlen(pItem->pszText[hi.iSubItem]), &textSize);
ReleaseDC(GetParent(hwnd), hDC);
}
else textSize.cx = textSize.cy = 0;
@@ -948,7 +948,7 @@ static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa for (i = 0; i < pList->labelEdit.pItem->idstrListCount; i++) {
add = ListBox_AddString(pList->labelEdit.dropDown.hDrop, pList->labelEdit.pItem->idstrList[i].ptszTranslated);
ListBox_SetItemData(pList->labelEdit.dropDown.hDrop, add, pList->labelEdit.pItem->idstrList + i);
- if (!mir_tstrcmp(szEdit, pList->labelEdit.pItem->idstrList[i].ptszTranslated))
+ if (!mir_wstrcmp(szEdit, pList->labelEdit.pItem->idstrList[i].ptszTranslated))
ListBox_SetCurSel(pList->labelEdit.dropDown.hDrop, add);
}
}
@@ -957,7 +957,7 @@ static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa i = 0;
while (PtrIsValid(lpidList = (LPIDSTRLIST)ListBox_GetItemData(pList->labelEdit.dropDown.hDrop, i))) {
- if (!mir_tstrcmp(szEdit, lpidList->ptszTranslated)) {
+ if (!mir_wstrcmp(szEdit, lpidList->ptszTranslated)) {
ListBox_SetCurSel(pList->labelEdit.dropDown.hDrop, i);
break;
}
@@ -1203,7 +1203,7 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR }
// find information about the group
for (iFmt = 0; iFmt < _countof(pFmt); iFmt++) {
- if (!mir_tstrcmp(szGroup, pFmt[iFmt].szGroup))
+ if (!mir_wstrcmp(szGroup, pFmt[iFmt].szGroup))
break;
}
// indicate, no group was found. should not happen!!
diff --git a/plugins/UserInfoEx/src/svc_constants.cpp b/plugins/UserInfoEx/src/svc_constants.cpp index 899d944700..4deefca9b4 100644 --- a/plugins/UserInfoEx/src/svc_constants.cpp +++ b/plugins/UserInfoEx/src/svc_constants.cpp @@ -252,12 +252,12 @@ static UINT MyCountriesCount = 0; * @param p1 - (LPIDSTRLIST) first item to compare
* @param p2 - (LPIDSTRLIST) second item to compare
*
-* returns -1, 0, 1 according to the comparison result of mir_tstrcmp.
+* returns -1, 0, 1 according to the comparison result of mir_wstrcmp.
**/
static int __cdecl ListSortProc(const LPIDSTRLIST p1, const LPIDSTRLIST p2)
{
- return mir_tstrcmpi(p1->ptszTranslated, p2->ptszTranslated);
+ return mir_wstrcmpi(p1->ptszTranslated, p2->ptszTranslated);
}
/**
diff --git a/plugins/UserInfoEx/src/svc_refreshci.cpp b/plugins/UserInfoEx/src/svc_refreshci.cpp index b844322721..f9b4da5021 100644 --- a/plugins/UserInfoEx/src/svc_refreshci.cpp +++ b/plugins/UserInfoEx/src/svc_refreshci.cpp @@ -119,7 +119,7 @@ public: va_list vl;
va_start(vl, szText);
- if (mir_vsntprintf(buf, _countof(buf), szText, vl) != -1)
+ if (mir_vsnwprintf(buf, _countof(buf), szText, vl) != -1)
{
SetTitle(buf);
}
@@ -143,7 +143,7 @@ public: {
if (szText)
{
- INT_PTR cch = mir_tstrlen(szText);
+ INT_PTR cch = mir_wstrlen(szText);
LPTSTR fmt = (LPTSTR) mir_alloc((cch + 1) * sizeof(wchar_t));
if (fmt)
@@ -151,7 +151,7 @@ public: wchar_t buf[MAXDATASIZE];
va_list vl;
- mir_tstrcpy(fmt, szText);
+ mir_wstrcpy(fmt, szText);
// delete bbcodes
if (!_bBBCode)
@@ -179,7 +179,7 @@ public: }
va_start(vl, szText);
- if (mir_vsntprintf(buf, _countof(buf), fmt, vl) != -1)
+ if (mir_vsnwprintf(buf, _countof(buf), fmt, vl) != -1)
{
SetText(buf);
}
@@ -345,12 +345,12 @@ class CPopupUpdProgress : public CUpdProgress {
if (_szText)
{
- INT_PTR cb = mir_tstrlen(_szText) + 8;
+ INT_PTR cb = mir_wstrlen(_szText) + 8;
LPTSTR pb = (LPTSTR) mir_alloc(cb * sizeof(wchar_t));
if (pb)
{
- mir_tstrcpy(pb, _szText);
+ mir_wstrcpy(pb, _szText);
SendMessage(_hWnd, UM_CHANGEPOPUP, CPT_TITLET, (LPARAM) pb);
}
@@ -424,10 +424,10 @@ public: pd.lpActions = _popupButtons;
// dummy text
- _szText = mir_tstrdup(szTitle);
- mir_tstrcpy(pd.lptzContactName, _szText);
+ _szText = mir_wstrdup(szTitle);
+ mir_wstrcpy(pd.lptzContactName, _szText);
- mir_tstrcpy(pd.lptzText, L" ");
+ mir_wstrcpy(pd.lptzText, L" ");
_pFnCallBack = pFnCallBack;
_hWnd = (HWND) CallService(MS_POPUP_ADDPOPUPT, (WPARAM) &pd, APF_RETURN_HWND|APF_NEWDATA);
@@ -455,7 +455,7 @@ public: virtual void SetTitle(LPCTSTR szText)
{
MIR_FREE(_szText);
- _szText = mir_tstrdup(szText);
+ _szText = mir_wstrdup(szText);
UpdateText();
}
@@ -465,7 +465,7 @@ public: **/
virtual void SetText(LPCTSTR szText)
{
- SendMessage(_hWnd, UM_CHANGEPOPUP, CPT_TEXTT, (LPARAM) mir_tstrdup(szText));
+ SendMessage(_hWnd, UM_CHANGEPOPUP, CPT_TEXTT, (LPARAM) mir_wstrdup(szText));
}
};
diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp index 700575c708..63e077a06f 100644 --- a/plugins/UserInfoEx/src/svc_reminder.cpp +++ b/plugins/UserInfoEx/src/svc_reminder.cpp @@ -255,11 +255,11 @@ static int NotifyWithPopup(MCONTACT hContact, CEvent::EType eventType, int DaysT if (hContact) {
ppd.lchContact = hContact;
- mir_sntprintf(ppd.lptzContactName, L"%s - %s", TranslateTS(pszDesc), DB::Contact::DisplayName(hContact));
+ mir_snwprintf(ppd.lptzContactName, L"%s - %s", TranslateTS(pszDesc), DB::Contact::DisplayName(hContact));
}
- else mir_tstrncpy(ppd.lptzContactName, TranslateT("Reminder"), _countof(ppd.lptzContactName));
+ else mir_wstrncpy(ppd.lptzContactName, TranslateT("Reminder"), _countof(ppd.lptzContactName));
- mir_tstrncpy(ppd.lptzText, pszMsg, MAX_SECONDLINE);
+ mir_wstrncpy(ppd.lptzText, pszMsg, MAX_SECONDLINE);
ppd.lchIcon = GetAnnivIcon(CEvent(eventType, DaysToAnniv));
@@ -317,12 +317,12 @@ static void NotifyFlashCListIcon(MCONTACT hContact, const CEvent &evt) switch (evt._eType) {
case CEvent::BIRTHDAY:
- mir_sntprintf(szMsg, TranslateT("%s has %s today."), DB::Contact::DisplayName(hContact), TranslateT("Birthday"));
+ mir_snwprintf(szMsg, TranslateT("%s has %s today."), DB::Contact::DisplayName(hContact), TranslateT("Birthday"));
cle.hIcon = IcoLib_GetIcon(ICO_COMMON_BIRTHDAY);
break;
case CEvent::ANNIVERSARY:
- mir_sntprintf(szMsg, TranslateT("%s has %s today."), DB::Contact::DisplayName(hContact), TranslateT("an anniversary"));
+ mir_snwprintf(szMsg, TranslateT("%s has %s today."), DB::Contact::DisplayName(hContact), TranslateT("an anniversary"));
cle.hIcon = IcoLib_GetIcon(ICO_COMMON_ANNIVERSARY);
break;
@@ -481,29 +481,29 @@ static bool CheckBirthday(MCONTACT hContact, MTime &Now, CEvent &evt, BYTE bNoti switch (Diff) {
case 0:
- cchMsg = mir_sntprintf(szMsg, TranslateT("%s has birthday today."), DB::Contact::DisplayName(hContact));
+ cchMsg = mir_snwprintf(szMsg, TranslateT("%s has birthday today."), DB::Contact::DisplayName(hContact));
break;
case 1:
- cchMsg = mir_sntprintf(szMsg, TranslateT("%s has birthday tomorrow."), DB::Contact::DisplayName(hContact));
+ cchMsg = mir_snwprintf(szMsg, TranslateT("%s has birthday tomorrow."), DB::Contact::DisplayName(hContact));
break;
default:
- cchMsg = mir_sntprintf(szMsg, TranslateT("%s has birthday in %d days."), DB::Contact::DisplayName(hContact), Diff);
+ cchMsg = mir_snwprintf(szMsg, TranslateT("%s has birthday in %d days."), DB::Contact::DisplayName(hContact), Diff);
}
int age = mtb.Age(&Now);
if (age > 0)
switch (GenderOf(hContact)){
case 0:
- mir_sntprintf(szMsg + cchMsg, _countof(szMsg) - cchMsg,
+ mir_snwprintf(szMsg + cchMsg, _countof(szMsg) - cchMsg,
TranslateT("\nHe/she becomes %d years old."),
age + (Diff > 0));
break;
case 'M':
- mir_sntprintf(szMsg + cchMsg, _countof(szMsg) - cchMsg,
+ mir_snwprintf(szMsg + cchMsg, _countof(szMsg) - cchMsg,
TranslateT("\nHe becomes %d years old."),
age + (Diff > 0));
break;
case 'F':
- mir_sntprintf(szMsg + cchMsg, _countof(szMsg) - cchMsg,
+ mir_snwprintf(szMsg + cchMsg, _countof(szMsg) - cchMsg,
TranslateT("\nShe becomes %d years old."),
age + (Diff > 0));
break;
diff --git a/plugins/UserInfoEx/src/svc_timezone_old.cpp b/plugins/UserInfoEx/src/svc_timezone_old.cpp index dfc50be0ed..dfb93928ba 100644 --- a/plugins/UserInfoEx/src/svc_timezone_old.cpp +++ b/plugins/UserInfoEx/src/svc_timezone_old.cpp @@ -91,8 +91,8 @@ class CTzBias : public LIST<CTimeZone> {
int result = tz2->Bias - tz1->Bias;
// DO NOT USE mir_tcsicmp here as it does only return TRUE or FALSE!!!
- // mir_tstrcmpi takes care of umlauts e.g. Ä,Ö,....
- return (result || !tz1->ptszDisplay || !tz2->ptszDisplay) ? result : mir_tstrcmpi(tz1->ptszDisplay, tz2->ptszDisplay);
+ // mir_wstrcmpi takes care of umlauts e.g. Ä,Ö,....
+ return (result || !tz1->ptszDisplay || !tz2->ptszDisplay) ? result : mir_wstrcmpi(tz1->ptszDisplay, tz2->ptszDisplay);
}
public:
CTzBias() : LIST<CTimeZone>(50, &CTzBias::sortFunc)
@@ -126,7 +126,7 @@ class CTzMgr : public LIST<CTimeZone> static int sortFunc(const CTimeZone *tz1, const CTimeZone *tz2)
{
// DO NOT USE mir_tcsicmp here as it does only return TRUE or FALSE!!!
- return mir_tstrcmpi(tz1->ptszName, tz2->ptszName);
+ return mir_wstrcmpi(tz1->ptszName, tz2->ptszName);
}
/**
@@ -203,8 +203,8 @@ public: pTimeZone->dwIndex = TZINDEX_UNSPECIFIED;
if (result == ERROR_SUCCESS) {
- pTimeZone->ptszName = mir_tstrdup(szName);
- pTimeZone->ptszDisplay = mir_tstrdup(szDisplay);
+ pTimeZone->ptszName = mir_wstrdup(szName);
+ pTimeZone->ptszDisplay = mir_wstrdup(szDisplay);
result = (insert(pTimeZone) == ERROR_SUCCESS);
}
diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp index 160b78a1ad..b0a46021ee 100644 --- a/plugins/Variables/src/contact.cpp +++ b/plugins/Variables/src/contact.cpp @@ -96,11 +96,11 @@ static mir_cs csContactCache; // converts a string into a CNF_ type
BYTE getContactInfoType(wchar_t* type)
{
- if (type == NULL || mir_tstrlen(type) == 0)
+ if (type == NULL || mir_wstrlen(type) == 0)
return 0;
for (int i = 0; i < _countof(builtinCnfs); i++)
- if (!mir_tstrcmp(builtinCnfs[i].str, type))
+ if (!mir_wstrcmp(builtinCnfs[i].str, type))
return builtinCnfs[i].cnfCode;
return 0;
@@ -120,22 +120,22 @@ wchar_t* getContactInfoT(BYTE type, MCONTACT hContact) wchar_t *res = NULL;
switch (type) {
case CCNF_PROTOID:
- return mir_a2t(szProto);
+ return mir_a2u(szProto);
case CCNF_ACCOUNT:
{
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
- return pa ? mir_tstrdup(pa->tszAccountName) : NULL;
+ return pa ? mir_wstrdup(pa->tszAccountName) : NULL;
}
case CCNF_PROTOCOL:
char protoname[128];
if (CallProtoService(szProto, PS_GETNAME, (WPARAM)sizeof(protoname), (LPARAM)protoname))
return NULL;
- return mir_a2t(protoname);
+ return mir_a2u(protoname);
case CCNF_STATUS:
- return mir_tstrdup(pcli->pfnGetStatusModeDescription(db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), 0));
+ return mir_wstrdup(pcli->pfnGetStatusModeDescription(db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), 0));
case CCNF_INTERNALIP:
case CCNF_EXTERNALIP:
@@ -144,7 +144,7 @@ wchar_t* getContactInfoT(BYTE type, MCONTACT hContact) if (ip != 0) {
struct in_addr in;
in.s_addr = htonl(ip);
- return mir_a2t(inet_ntoa(in));
+ return mir_a2u(inet_ntoa(in));
}
}
return NULL;
@@ -208,7 +208,7 @@ MCONTACT getContactFromString(const wchar_t *tszContact, DWORD dwFlags, int nMat // <proto:id> (exact)
if ((dwFlags & CI_PROTOID) && !bMatch) {
- ptrT cInfo(getContactInfoT(CNF_UNIQUEID, hContact));
+ ptrW cInfo(getContactInfoT(CNF_UNIQUEID, hContact));
if (cInfo) {
tmp.Format(L"<%S:%s>", szProto, cInfo);
if (tmp == tszContact)
@@ -218,50 +218,50 @@ MCONTACT getContactFromString(const wchar_t *tszContact, DWORD dwFlags, int nMat // id (exact)
if ((dwFlags & CI_UNIQUEID) && !bMatch) {
- ptrT szFind(getContactInfoT(CNF_UNIQUEID, hContact));
- if (!mir_tstrcmp(tszContact, szFind))
+ ptrW szFind(getContactInfoT(CNF_UNIQUEID, hContact));
+ if (!mir_wstrcmp(tszContact, szFind))
bMatch = true;
}
// nick (not exact)
if ((dwFlags & CI_NICK) && !bMatch) {
- ptrT szFind(getContactInfoT(CNF_NICK, hContact));
- if (!mir_tstrcmp(tszContact, szFind))
+ ptrW szFind(getContactInfoT(CNF_NICK, hContact));
+ if (!mir_wstrcmp(tszContact, szFind))
bMatch = true;
}
// list name (not exact)
if ((dwFlags & CI_LISTNAME) && !bMatch) {
- ptrT szFind(getContactInfoT(CNF_DISPLAY, hContact));
- if (!mir_tstrcmp(tszContact, szFind))
+ ptrW szFind(getContactInfoT(CNF_DISPLAY, hContact));
+ if (!mir_wstrcmp(tszContact, szFind))
bMatch = true;
}
// firstname (exact)
if ((dwFlags & CI_FIRSTNAME) && !bMatch) {
- ptrT szFind(getContactInfoT(CNF_FIRSTNAME, hContact));
- if (!mir_tstrcmp(tszContact, szFind))
+ ptrW szFind(getContactInfoT(CNF_FIRSTNAME, hContact));
+ if (!mir_wstrcmp(tszContact, szFind))
bMatch = true;
}
// lastname (exact)
if ((dwFlags & CI_LASTNAME) && !bMatch) {
- ptrT szFind(getContactInfoT(CNF_LASTNAME, hContact));
- if (!mir_tstrcmp(tszContact, szFind))
+ ptrW szFind(getContactInfoT(CNF_LASTNAME, hContact));
+ if (!mir_wstrcmp(tszContact, szFind))
bMatch = true;
}
// email (exact)
if ((dwFlags & CI_EMAIL) && !bMatch) {
- ptrT szFind(getContactInfoT(CNF_EMAIL, hContact));
- if (!mir_tstrcmp(tszContact, szFind))
+ ptrW szFind(getContactInfoT(CNF_EMAIL, hContact));
+ if (!mir_wstrcmp(tszContact, szFind))
bMatch = true;
}
// CNF_ (exact)
if ((dwFlags & CI_CNFINFO) && !bMatch) {
- ptrT szFind(getContactInfoT((BYTE)(dwFlags & ~CI_CNFINFO), hContact));
- if (!mir_tstrcmp(tszContact, szFind))
+ ptrW szFind(getContactInfoT((BYTE)(dwFlags & ~CI_CNFINFO), hContact));
+ if (!mir_wstrcmp(tszContact, szFind))
bMatch = true;
}
@@ -291,7 +291,7 @@ MCONTACT getContactFromString(const wchar_t *tszContact, DWORD dwFlags, int nMat CONTACTCE *cce = new CONTACTCE();
cce->hContact = hContact;
cce->flags = dwFlags;
- cce->tszContact = mir_tstrdup(tszContact);
+ cce->tszContact = mir_wstrdup(tszContact);
arContactCache.insert(cce);
}
@@ -365,9 +365,9 @@ wchar_t* encodeContactToString(MCONTACT hContact) if (tszUniqueId == NULL)
return NULL;
- size_t size = mir_tstrlen(tszUniqueId) + mir_strlen(szProto) + 4;
+ size_t size = mir_wstrlen(tszUniqueId) + mir_strlen(szProto) + 4;
wchar_t *tszResult = (wchar_t *)mir_calloc(size * sizeof(wchar_t));
if (tszResult)
- mir_sntprintf(tszResult, size, L"<%S:%s>", szProto, tszUniqueId);
+ mir_snwprintf(tszResult, size, L"<%S:%s>", szProto, tszUniqueId);
return tszResult;
}
diff --git a/plugins/Variables/src/help.cpp b/plugins/Variables/src/help.cpp index 57d5ad1e0c..7d663d4aae 100644 --- a/plugins/Variables/src/help.cpp +++ b/plugins/Variables/src/help.cpp @@ -228,14 +228,14 @@ static wchar_t *getTokenCategory(TOKENREGISTEREX *tr) { *cur = 0; helpText = ( char* )mir_realloc(helpText, mir_strlen(helpText)+1); - wchar_t *res = mir_a2t(helpText); + wchar_t *res = mir_a2u(helpText); mir_free(helpText); return res; } cur++; } - wchar_t *res = mir_a2t(helpText); + wchar_t *res = mir_a2u(helpText); mir_free(helpText); return res; @@ -251,7 +251,7 @@ static wchar_t *getHelpDescription(TOKENREGISTEREX *tr) if (*cur == '\t') { cur = mir_strdup(cur+1); - wchar_t *res = mir_a2t(cur); + wchar_t *res = mir_a2u(cur); mir_free(cur); return res; @@ -259,7 +259,7 @@ static wchar_t *getHelpDescription(TOKENREGISTEREX *tr) cur--; } - return mir_a2t(tr->szHelpText); + return mir_a2u(tr->szHelpText); } @@ -269,7 +269,7 @@ static wchar_t *getTokenDescription(TOKENREGISTEREX *tr) return NULL; if (tr->szHelpText == NULL) - return mir_tstrdup(tr->tszTokenString); + return mir_wstrdup(tr->tszTokenString); char *helpText = mir_strdup(tr->szHelpText); if (helpText == NULL) @@ -294,7 +294,7 @@ static wchar_t *getTokenDescription(TOKENREGISTEREX *tr) } else args = NULL; - size_t len = mir_tstrlen(tr->tszTokenString) + (args!=NULL?mir_strlen(args):0) + 3; + size_t len = mir_wstrlen(tr->tszTokenString) + (args!=NULL?mir_strlen(args):0) + 3; wchar_t *desc = (wchar_t*)mir_calloc(len * sizeof(wchar_t)); if (desc == NULL) { mir_free(helpText); @@ -302,12 +302,12 @@ static wchar_t *getTokenDescription(TOKENREGISTEREX *tr) } if (tr->flags&TRF_FIELD) - mir_sntprintf(desc, len, L"%c%s%c", FIELD_CHAR, tr->szTokenString, FIELD_CHAR); + mir_snwprintf(desc, len, L"%c%s%c", FIELD_CHAR, tr->szTokenString, FIELD_CHAR); else { if (args != NULL) - tArgs = mir_a2t(args); + tArgs = mir_a2u(args); - mir_sntprintf(desc, len, L"%c%s%s", FUNC_CHAR, tr->tszTokenString, (tArgs!=NULL?tArgs:L"")); + mir_snwprintf(desc, len, L"%c%s%s", FUNC_CHAR, tr->tszTokenString, (tArgs!=NULL?tArgs:L"")); } mir_free(tArgs); @@ -322,19 +322,19 @@ static int CALLBACK compareTokenHelp(LPARAM lParam1, LPARAM lParam2, LPARAM) if (tr1 == NULL || tr2 == NULL) return 0; - ptrT cat1(getTokenCategory(tr1)); - ptrT cat2(getTokenCategory(tr2)); + ptrW cat1(getTokenCategory(tr1)); + ptrW cat2(getTokenCategory(tr2)); if (cat1 == NULL || cat2 == NULL) return 0; - int res = mir_tstrcmp(cat1, cat2); + int res = mir_wstrcmp(cat1, cat2); if (res != 0) return res; if (tr1->tszTokenString == NULL || tr2->tszTokenString == NULL) return 0; - return mir_tstrcmp(tr1->tszTokenString, tr2->tszTokenString); + return mir_wstrcmp(tr1->tszTokenString, tr2->tszTokenString); } static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam) @@ -367,19 +367,19 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM, LPA continue; else if (hdd != NULL) { - if (!mir_tstrcmp(tr->tszTokenString, SUBJECT)) { + if (!mir_wstrcmp(tr->tszTokenString, SUBJECT)) { if (hdd->vhs->flags&VHF_HIDESUBJECTTOKEN) continue; if (hdd->vhs->szSubjectDesc != NULL) - tszHelpDesc = mir_a2t(hdd->vhs->szSubjectDesc); + tszHelpDesc = mir_a2u(hdd->vhs->szSubjectDesc); } - if (!mir_tstrcmp(tr->tszTokenString, MIR_EXTRATEXT)) { + if (!mir_wstrcmp(tr->tszTokenString, MIR_EXTRATEXT)) { if (hdd->vhs->flags & VHF_HIDEEXTRATEXTTOKEN) continue; if (hdd->vhs->szExtraTextDesc != NULL) - tszHelpDesc = mir_a2t(hdd->vhs->szExtraTextDesc); + tszHelpDesc = mir_a2u(hdd->vhs->szExtraTextDesc); } } @@ -400,7 +400,7 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM, LPA tszHelpDesc = getHelpDescription(tr); if (tszHelpDesc == NULL) - tszHelpDesc = mir_tstrdup(L"unknown"); + tszHelpDesc = mir_wstrdup(L"unknown"); lvItem.iSubItem = 1; lvItem.pszText = TranslateTS(tszHelpDesc); @@ -422,12 +422,12 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM, LPA cat = getTokenCategory((TOKENREGISTEREX *)lvItem.lParam); if (cat != NULL) { - text = mir_tstrdup(TranslateTS(cat)); + text = mir_wstrdup(TranslateTS(cat)); mir_free(cat); } else text = NULL; - if (text != NULL && (last == NULL || mir_tstrcmpi(last, text))) { + if (text != NULL && (last == NULL || mir_wstrcmpi(last, text))) { lvItem.mask = LVIF_TEXT; lvItem.pszText = text; ListView_InsertItem(hList, &lvItem); @@ -464,13 +464,13 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM, LPA if (tr == NULL) break; - size_t len = mir_tstrlen(tr->tszTokenString) + 2; + size_t len = mir_wstrlen(tr->tszTokenString) + 2; wchar_t *tokenString = (wchar_t*)mir_alloc((len+1)*sizeof(wchar_t)); if (tokenString == NULL) break; memset(tokenString, 0, ((len + 1) * sizeof(wchar_t))); - mir_sntprintf(tokenString, len + 1, L"%c%s%c", (tr->flags & TRF_FIELD) ? FIELD_CHAR : FUNC_CHAR, tr->tszTokenString, (tr->flags & TRF_FIELD) ? FIELD_CHAR : '('); + mir_snwprintf(tokenString, len + 1, L"%c%s%c", (tr->flags & TRF_FIELD) ? FIELD_CHAR : FUNC_CHAR, tr->tszTokenString, (tr->flags & TRF_FIELD) ? FIELD_CHAR : '('); SendDlgItemMessage(hwndInputDlg, IDC_TESTSTRING, EM_REPLACESEL, TRUE, (LPARAM)tokenString); mir_free(tokenString); SetFocus(GetDlgItem(hwndInputDlg, IDC_TESTSTRING)); @@ -685,7 +685,7 @@ static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM wchar_t *newString = variables_parsedup(string, extraText, (MCONTACT)SendMessage(GetParent(hwndDlg), VARM_GETSUBJECT, 0, 0)); if (newString != NULL) { wchar_t *oldString = Hlp_GetDlgItemText(hwndDlg, IDC_RESULT); - if (oldString == NULL || mir_tstrcmp(oldString, newString)) + if (oldString == NULL || mir_wstrcmp(oldString, newString)) SetDlgItemText(hwndDlg, IDC_RESULT, newString); mir_free(newString); @@ -812,7 +812,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l SendMessage(hwndDlg, VARM_SETINPUTTEXT, 0, (LPARAM)dat->vhs->fi->tszFormat); else { - WCHAR *wszFormatString = mir_a2t(dat->vhs->fi->szFormat); + WCHAR *wszFormatString = mir_a2u(dat->vhs->fi->szFormat); SendMessage(hwndDlg, VARM_SETINPUTTEXT, 0, (LPARAM)wszFormatString); mir_free(wszFormatString); @@ -866,7 +866,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l SendMessage(hwndDlg, VARM_SETEXTRATEXT, 0, (LPARAM)dat->vhs->fi->tszExtraText); else { - WCHAR *wszSource = mir_a2t(dat->vhs->fi->szExtraText); + WCHAR *wszSource = mir_a2u(dat->vhs->fi->szExtraText); SendMessage(hwndDlg, VARM_SETEXTRATEXT, 0, (LPARAM)wszSource); mir_free(wszSource); diff --git a/plugins/Variables/src/parse_alias.cpp b/plugins/Variables/src/parse_alias.cpp index 8f7ccd9f2e..0c3f1a8060 100644 --- a/plugins/Variables/src/parse_alias.cpp +++ b/plugins/Variables/src/parse_alias.cpp @@ -37,7 +37,7 @@ static ALIASREGISTER* searchAliasRegister(wchar_t *szAlias) mir_cslock lck(csAliasRegister);
for (int i = 0; i < arAliases.getCount(); i++)
- if (!mir_tstrcmp(arAliases[i]->szAlias, szAlias))
+ if (!mir_wstrcmp(arAliases[i]->szAlias, szAlias))
return arAliases[i];
return NULL;
@@ -45,7 +45,7 @@ static ALIASREGISTER* searchAliasRegister(wchar_t *szAlias) static wchar_t *replaceArguments(wchar_t *res, wchar_t *tArg, wchar_t *rArg)
{
- if (mir_tstrlen(tArg) == 0)
+ if (mir_wstrlen(tArg) == 0)
return res;
unsigned int cur = 0, ecur = 0;
@@ -55,14 +55,14 @@ static wchar_t *replaceArguments(wchar_t *res, wchar_t *tArg, wchar_t *rArg) while ((*(res + ecur) != ')') && (*(res + ecur) != ','))
ecur++;
- if (((signed int)mir_tstrlen(tArg) == (ecur - cur)) && (!wcsncmp(tArg, res + cur, mir_tstrlen(tArg)))) {
- if (mir_tstrlen(rArg) > mir_tstrlen(tArg)) {
- res = (wchar_t*)mir_realloc(res, (mir_tstrlen(res) + (mir_tstrlen(rArg) - mir_tstrlen(tArg)) + 1)*sizeof(wchar_t));
+ if (((signed int)mir_wstrlen(tArg) == (ecur - cur)) && (!wcsncmp(tArg, res + cur, mir_wstrlen(tArg)))) {
+ if (mir_wstrlen(rArg) > mir_wstrlen(tArg)) {
+ res = (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + (mir_wstrlen(rArg) - mir_wstrlen(tArg)) + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
}
- memmove(res + ecur + (mir_tstrlen(rArg) - mir_tstrlen(tArg)), res + ecur, (mir_tstrlen(res + ecur) + 1)*sizeof(wchar_t));
- wcsncpy(res + cur, rArg, mir_tstrlen(rArg));
+ memmove(res + ecur + (mir_wstrlen(rArg) - mir_wstrlen(tArg)), res + ecur, (mir_wstrlen(res + ecur) + 1)*sizeof(wchar_t));
+ wcsncpy(res + cur, rArg, mir_wstrlen(rArg));
}
}
cur++;
@@ -77,7 +77,7 @@ static wchar_t *parseTranslateAlias(ARGUMENTSINFO *ai) if (areg == NULL || areg->argc != ai->argc - 1)
return NULL;
- wchar_t *res = mir_tstrdup(areg->szTranslation);
+ wchar_t *res = mir_wstrdup(areg->szTranslation);
for (unsigned i = 0; i < areg->argc; i++) {
res = replaceArguments(res, areg->argv[i], ai->targv[i + 1]);
if (res == NULL)
@@ -89,17 +89,17 @@ static wchar_t *parseTranslateAlias(ARGUMENTSINFO *ai) static int addToAliasRegister(wchar_t *szAlias, unsigned int argc, wchar_t** argv, wchar_t *szTranslation)
{
- if (szAlias == NULL || szTranslation == NULL || mir_tstrlen(szAlias) == 0)
+ if (szAlias == NULL || szTranslation == NULL || mir_wstrlen(szAlias) == 0)
return -1;
mir_cslock lck(csAliasRegister);
for (int i = 0; i < arAliases.getCount(); i++) {
ALIASREGISTER *p = arAliases[i];
- if (mir_tstrcmp(p->szAlias, szAlias))
+ if (mir_wstrcmp(p->szAlias, szAlias))
continue;
mir_free(p->szTranslation);
- p->szTranslation = mir_tstrdup(szTranslation);
+ p->szTranslation = mir_wstrdup(szTranslation);
for (unsigned j = 0; j < p->argc; j++)
mir_free(p->argv[j]);
@@ -110,7 +110,7 @@ static int addToAliasRegister(wchar_t *szAlias, unsigned int argc, wchar_t** arg for (unsigned j = 0; j < argc; j++) {
if (argv[j] != NULL)
- p->argv[j] = mir_tstrdup(argv[j]);
+ p->argv[j] = mir_wstrdup(argv[j]);
else
p->argv[j] = NULL;
}
@@ -121,14 +121,14 @@ static int addToAliasRegister(wchar_t *szAlias, unsigned int argc, wchar_t** arg return -1;
ALIASREGISTER *p = new ALIASREGISTER;
- p->szAlias = mir_tstrdup(szAlias);
- p->szTranslation = mir_tstrdup(szTranslation);
+ p->szAlias = mir_wstrdup(szAlias);
+ p->szTranslation = mir_wstrdup(szTranslation);
p->argc = argc;
p->argv = pargv;
for (unsigned j = 0; j < p->argc; j++) {
if (argv[j] != NULL)
- p->argv[j] = mir_tstrdup(argv[j]);
+ p->argv[j] = mir_wstrdup(argv[j]);
else
p->argv[j] = NULL;
}
@@ -146,7 +146,7 @@ static wchar_t *parseAddAlias(ARGUMENTSINFO *ai) while (isValidTokenChar(*cur))
cur++;
- ptrT alias(mir_tstrndup(ai->targv[1], cur - ai->targv[1]));
+ ptrW alias(mir_wstrndup(ai->targv[1], cur - ai->targv[1]));
TArgList argv;
getArguments(cur, argv);
@@ -156,17 +156,17 @@ static wchar_t *parseAddAlias(ARGUMENTSINFO *ai) wchar_t *szArgs = NULL;
for (int i = 0; i < argv.getCount(); i++) {
if (i == 0)
- szArgs = (wchar_t*)mir_calloc((mir_tstrlen(argv[i]) + 2)*sizeof(wchar_t));
+ szArgs = (wchar_t*)mir_calloc((mir_wstrlen(argv[i]) + 2)*sizeof(wchar_t));
else
- szArgs = (wchar_t*)mir_realloc(szArgs, (mir_tstrlen(szArgs) + mir_tstrlen(argv[i]) + 2)*sizeof(wchar_t));
+ szArgs = (wchar_t*)mir_realloc(szArgs, (mir_wstrlen(szArgs) + mir_wstrlen(argv[i]) + 2)*sizeof(wchar_t));
- mir_tstrcat(szArgs, argv[i]);
+ mir_wstrcat(szArgs, argv[i]);
if (i != argv.getCount() - 1)
- mir_tstrcat(szArgs, L",");
+ mir_wstrcat(szArgs, L",");
}
int res;
if (szArgs != NULL && argv.getCount() > 0) {
- szArgsA = mir_t2a(szArgs);
+ szArgsA = mir_u2a(szArgs);
size_t size = 32 + mir_strlen(szArgsA);
szHelp = (char *)mir_alloc(size);
@@ -184,7 +184,7 @@ static wchar_t *parseAddAlias(ARGUMENTSINFO *ai) mir_free(szArgs);
mir_free(szHelp);
argv.destroy();
- return (res == 0) ? mir_tstrdup(L"") : NULL;
+ return (res == 0) ? mir_wstrdup(L"") : NULL;
}
void registerAliasTokens()
diff --git a/plugins/Variables/src/parse_external.cpp b/plugins/Variables/src/parse_external.cpp index 873be4f90b..820b4a01ee 100644 --- a/plugins/Variables/src/parse_external.cpp +++ b/plugins/Variables/src/parse_external.cpp @@ -37,13 +37,13 @@ static wchar_t *getFullWinampTitleText() mir_free(szWinText);
return NULL;
}
- wchar_t *szTitle = (wchar_t*)mir_alloc((2 * mir_tstrlen(szWinText) + 1)*sizeof(wchar_t));
+ wchar_t *szTitle = (wchar_t*)mir_alloc((2 * mir_wstrlen(szWinText) + 1)*sizeof(wchar_t));
if (szTitle == NULL) {
mir_free(szWinText);
return NULL;
}
- mir_tstrcpy(szTitle, szWinText);
- mir_tstrcpy(szTitle + mir_tstrlen(szTitle), szWinText);
+ mir_wstrcpy(szTitle, szWinText);
+ mir_wstrcpy(szTitle + mir_wstrlen(szTitle), szWinText);
mir_free(szWinText);
return szTitle;
@@ -61,14 +61,14 @@ static wchar_t *parseWinampSong(ARGUMENTSINFO *ai) wchar_t *scur = wcschr(szTitle, '.');
wchar_t *cur;
- if ((scur == NULL) || ((cur = wcsstr(scur, L" - Winamp")) == NULL) || (scur >= cur) || (scur > (szTitle + mir_tstrlen(szTitle) - 2)) || (cur > (szTitle + mir_tstrlen(szTitle)))) {
+ if ((scur == NULL) || ((cur = wcsstr(scur, L" - Winamp")) == NULL) || (scur >= cur) || (scur > (szTitle + mir_wstrlen(szTitle) - 2)) || (cur > (szTitle + mir_wstrlen(szTitle)))) {
mir_free(szTitle);
return NULL;
}
scur++;
scur++;
*cur = '\0';
- res = mir_tstrdup(scur);
+ res = mir_wstrdup(scur);
mir_free(szTitle);
ai->flags |= AIF_DONTPARSE;
@@ -88,13 +88,13 @@ static wchar_t *parseWinampState(ARGUMENTSINFO *ai) wchar_t *scur = wcschr(szTitle, '.');
wchar_t *cur;
if (scur == NULL || (cur = wcsstr(scur, L" - Winamp")) == NULL)
- res = mir_tstrdup(TranslateT("Stopped"));
+ res = mir_wstrdup(TranslateT("Stopped"));
else if ((!wcsncmp(cur + 10, L"[Stopped]", 9)))
- res = mir_tstrdup(TranslateT("Stopped"));
+ res = mir_wstrdup(TranslateT("Stopped"));
else if ((!wcsncmp(cur + 10, L"[Paused]", 8)))
- res = mir_tstrdup(TranslateT("Paused"));
+ res = mir_wstrdup(TranslateT("Paused"));
else
- res = mir_tstrdup(L"Playing");
+ res = mir_wstrdup(L"Playing");
mir_free(szTitle);
return res;
}
diff --git a/plugins/Variables/src/parse_inet.cpp b/plugins/Variables/src/parse_inet.cpp index 58c96df015..cd927fb98b 100644 --- a/plugins/Variables/src/parse_inet.cpp +++ b/plugins/Variables/src/parse_inet.cpp @@ -24,7 +24,7 @@ static wchar_t *parseUrlEnc(ARGUMENTSINFO *ai) if (ai->argc != 2)
return NULL;
- char *res = mir_t2a(ai->targv[1]);
+ char *res = mir_u2a(ai->targv[1]);
if (res == NULL)
return NULL;
@@ -45,7 +45,7 @@ static wchar_t *parseUrlEnc(ARGUMENTSINFO *ai) cur += mir_strlen(hex);
}
- wchar_t *tres = mir_a2t(res);
+ wchar_t *tres = mir_a2u(res);
mir_free(res);
return tres;
}
@@ -55,7 +55,7 @@ static wchar_t *parseUrlDec(ARGUMENTSINFO *ai) if (ai->argc != 2)
return NULL;
- char *res = mir_t2a(ai->targv[1]);
+ char *res = mir_u2a(ai->targv[1]);
if (res == NULL)
return NULL;
@@ -72,7 +72,7 @@ static wchar_t *parseUrlDec(ARGUMENTSINFO *ai) }
res = (char*)mir_realloc(res, mir_strlen(res) + 1);
- wchar_t *tres = mir_a2t(res);
+ wchar_t *tres = mir_a2u(res);
mir_free(res);
return tres;
}
@@ -84,7 +84,7 @@ static wchar_t *parseNToA(ARGUMENTSINFO *ai) struct in_addr in;
in.s_addr = ttoi(ai->targv[1]);
- return mir_a2t(inet_ntoa(in));
+ return mir_a2u(inet_ntoa(in));
}
static wchar_t *parseHToA(ARGUMENTSINFO *ai)
@@ -94,7 +94,7 @@ static wchar_t *parseHToA(ARGUMENTSINFO *ai) struct in_addr in;
in.s_addr = htonl(ttoi(ai->targv[1]));
- return mir_a2t(inet_ntoa(in));
+ return mir_a2u(inet_ntoa(in));
}
void registerInetTokens()
diff --git a/plugins/Variables/src/parse_logic.cpp b/plugins/Variables/src/parse_logic.cpp index 763136f821..0737a17d11 100644 --- a/plugins/Variables/src/parse_logic.cpp +++ b/plugins/Variables/src/parse_logic.cpp @@ -32,11 +32,11 @@ static wchar_t *parseAnd(ARGUMENTSINFO *ai) if (fi.eCount > 0) {
ai->flags |= AIF_FALSE;
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
}
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseFalse(ARGUMENTSINFO *ai)
@@ -45,7 +45,7 @@ static wchar_t *parseFalse(ARGUMENTSINFO *ai) return NULL;
ai->flags |= AIF_FALSE;
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseIf(ARGUMENTSINFO *ai)
@@ -59,7 +59,7 @@ static wchar_t *parseIf(ARGUMENTSINFO *ai) fi.tszFormat = ai->targv[1];
mir_free(formatString(&fi));
- return mir_tstrdup((fi.eCount == 0) ? ai->targv[2] : ai->targv[3]);
+ return mir_wstrdup((fi.eCount == 0) ? ai->targv[2] : ai->targv[3]);
}
static wchar_t *parseIf2(ARGUMENTSINFO *ai)
@@ -76,7 +76,7 @@ static wchar_t *parseIf2(ARGUMENTSINFO *ai) return szCondition;
mir_free(szCondition);
- return mir_tstrdup(ai->targv[2]);
+ return mir_wstrdup(ai->targv[2]);
}
static wchar_t *parseIf3(ARGUMENTSINFO *ai)
@@ -104,16 +104,16 @@ static wchar_t *parseIfequal(ARGUMENTSINFO *ai) FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
fi.szFormat = ai->argv[1];
- ptrT tszFirst(formatString(&fi));
+ ptrW tszFirst(formatString(&fi));
fi.szFormat = ai->argv[2];
- ptrT tszSecond(formatString(&fi));
+ ptrW tszSecond(formatString(&fi));
if (tszFirst == NULL || tszSecond == NULL)
return NULL;
if (ttoi(tszFirst) == ttoi(tszSecond))
- return mir_tstrdup(ai->targv[3]);
+ return mir_wstrdup(ai->targv[3]);
- return mir_tstrdup(ai->targv[4]);
+ return mir_wstrdup(ai->targv[4]);
}
static wchar_t *parseIfgreater(ARGUMENTSINFO *ai)
@@ -124,16 +124,16 @@ static wchar_t *parseIfgreater(ARGUMENTSINFO *ai) FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
fi.szFormat = ai->argv[1];
- ptrT tszFirst(formatString(&fi));
+ ptrW tszFirst(formatString(&fi));
fi.szFormat = ai->argv[2];
- ptrT tszSecond(formatString(&fi));
+ ptrW tszSecond(formatString(&fi));
if (tszFirst == NULL || tszSecond == NULL)
return NULL;
if (ttoi(tszFirst) > ttoi(tszSecond))
- return mir_tstrdup(ai->targv[3]);
+ return mir_wstrdup(ai->targv[3]);
- return mir_tstrdup(ai->targv[4]);
+ return mir_wstrdup(ai->targv[4]);
}
static wchar_t *parseIflonger(ARGUMENTSINFO *ai)
@@ -144,16 +144,16 @@ static wchar_t *parseIflonger(ARGUMENTSINFO *ai) FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
fi.szFormat = ai->argv[1];
- ptrT tszFirst(formatString(&fi));
+ ptrW tszFirst(formatString(&fi));
fi.szFormat = ai->argv[2];
- ptrT tszSecond(formatString(&fi));
+ ptrW tszSecond(formatString(&fi));
if (tszFirst == NULL || tszSecond == NULL)
return NULL;
- if (mir_tstrlen(tszFirst) > mir_tstrlen(tszSecond))
- return mir_tstrdup(ai->targv[3]);
+ if (mir_wstrlen(tszFirst) > mir_wstrlen(tszSecond))
+ return mir_wstrdup(ai->targv[3]);
- return mir_tstrdup(ai->targv[4]);
+ return mir_wstrdup(ai->targv[4]);
}
/*
@@ -166,7 +166,7 @@ static wchar_t *parseFor(ARGUMENTSINFO *ai) if (ai->argc != 5)
return NULL;
- wchar_t *res = mir_tstrdup(L"");
+ wchar_t *res = mir_wstrdup(L"");
FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
@@ -180,15 +180,15 @@ static wchar_t *parseFor(ARGUMENTSINFO *ai) wchar_t *parsed = formatString(&fi);
if (parsed != NULL) {
if (res == NULL) {
- res = (wchar_t*)mir_alloc(mir_tstrlen(parsed) + 1 * sizeof(wchar_t));
+ res = (wchar_t*)mir_alloc(mir_wstrlen(parsed) + 1 * sizeof(wchar_t));
if (res == NULL) {
mir_free(parsed);
return NULL;
}
}
- else res = (wchar_t*)mir_realloc(res, (mir_tstrlen(res) + mir_tstrlen(parsed) + 1)*sizeof(wchar_t));
+ else res = (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + mir_wstrlen(parsed) + 1)*sizeof(wchar_t));
- mir_tstrcat(res, parsed);
+ mir_wstrcat(res, parsed);
mir_free(parsed);
}
fi.tszFormat = ai->targv[3];
@@ -209,7 +209,7 @@ static wchar_t *parseEqual(ARGUMENTSINFO *ai) if (ttoi(ai->targv[1]) != ttoi(ai->targv[2]))
ai->flags |= AIF_FALSE;
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseGreater(ARGUMENTSINFO *ai)
@@ -220,7 +220,7 @@ static wchar_t *parseGreater(ARGUMENTSINFO *ai) if (ttoi(ai->targv[1]) <= ttoi(ai->targv[2]))
ai->flags |= AIF_FALSE;
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseLonger(ARGUMENTSINFO *ai)
@@ -228,10 +228,10 @@ static wchar_t *parseLonger(ARGUMENTSINFO *ai) if (ai->argc != 3)
return NULL;
- if (mir_tstrlen(ai->targv[1]) <= mir_tstrlen(ai->targv[2]))
+ if (mir_wstrlen(ai->targv[1]) <= mir_wstrlen(ai->targv[2]))
ai->flags |= AIF_FALSE;
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseNot(ARGUMENTSINFO *ai)
@@ -248,7 +248,7 @@ static wchar_t *parseNot(ARGUMENTSINFO *ai) if (fi.eCount == 0)
ai->flags |= AIF_FALSE;
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseOr(ARGUMENTSINFO *ai)
@@ -268,12 +268,12 @@ static wchar_t *parseOr(ARGUMENTSINFO *ai) ai->flags &= ~AIF_FALSE;
}
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseTrue(ARGUMENTSINFO *ai)
{
- return (ai->argc != 1) ? NULL : mir_tstrdup(L"");
+ return (ai->argc != 1) ? NULL : mir_wstrdup(L"");
}
static wchar_t *parseXor(ARGUMENTSINFO *ai)
@@ -293,7 +293,7 @@ static wchar_t *parseXor(ARGUMENTSINFO *ai) int val2 = fi.eCount == 0;
ai->flags |= ((val1 & AIF_FALSE) == !(val2 & AIF_FALSE)) ? 0 : AIF_FALSE;
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
void registerLogicTokens()
diff --git a/plugins/Variables/src/parse_math.cpp b/plugins/Variables/src/parse_math.cpp index a9946d8a7a..cd028d3651 100644 --- a/plugins/Variables/src/parse_math.cpp +++ b/plugins/Variables/src/parse_math.cpp @@ -54,18 +54,18 @@ static wchar_t *parseHex(ARGUMENTSINFO *ai) int val = ttoi(ai->targv[1]);
int padding = ttoi(ai->targv[2]);
- mir_sntprintf(szVal, L"%x", val);
- unsigned int zeros = max(padding - (signed int)mir_tstrlen(szVal), 0);
- wchar_t *res = (wchar_t*)mir_alloc((zeros + mir_tstrlen(szVal) + 3)*sizeof(wchar_t));
+ mir_snwprintf(szVal, L"%x", val);
+ unsigned int zeros = max(padding - (signed int)mir_wstrlen(szVal), 0);
+ wchar_t *res = (wchar_t*)mir_alloc((zeros + mir_wstrlen(szVal) + 3)*sizeof(wchar_t));
if (res == NULL)
return NULL;
- memset(res, 0, ((zeros + mir_tstrlen(szVal) + 3) * sizeof(wchar_t)));
- mir_tstrcpy(res, L"0x");
+ memset(res, 0, ((zeros + mir_wstrlen(szVal) + 3) * sizeof(wchar_t)));
+ mir_wstrcpy(res, L"0x");
for (i = 0; i < zeros; i++)
*(res + 2 + i) = '0';
- mir_tstrcat(res, szVal);
+ mir_wstrcat(res, szVal);
return res;
}
@@ -140,19 +140,19 @@ static wchar_t *parseNum(ARGUMENTSINFO *ai) if (szVal == NULL)
return NULL;
- unsigned zeros = max(padding - (signed int)mir_tstrlen(szVal), 0);
- wchar_t *res = (wchar_t*)mir_alloc((zeros + mir_tstrlen(szVal) + 1)*sizeof(wchar_t));
+ unsigned zeros = max(padding - (signed int)mir_wstrlen(szVal), 0);
+ wchar_t *res = (wchar_t*)mir_alloc((zeros + mir_wstrlen(szVal) + 1)*sizeof(wchar_t));
if (res == NULL) {
mir_free(szVal);
return NULL;
}
- memset(res, 0, ((zeros + mir_tstrlen(szVal) + 1) * sizeof(wchar_t)));
+ memset(res, 0, ((zeros + mir_wstrlen(szVal) + 1) * sizeof(wchar_t)));
wchar_t *cur = res;
for (unsigned i = 0; i < zeros; i++)
*cur++ = '0';
- mir_tstrcat(res, szVal);
+ mir_wstrcat(res, szVal);
mir_free(szVal);
return res;
diff --git a/plugins/Variables/src/parse_metacontacts.cpp b/plugins/Variables/src/parse_metacontacts.cpp index ac1185edb3..b8d2e9e324 100644 --- a/plugins/Variables/src/parse_metacontacts.cpp +++ b/plugins/Variables/src/parse_metacontacts.cpp @@ -32,7 +32,7 @@ static wchar_t *parseGetParent(ARGUMENTSINFO *ai) if (hContact == NULL)
return NULL;
- ptrT szUniqueID;
+ ptrW szUniqueID;
char* szProto = GetContactProto(hContact);
if (szProto != NULL)
szUniqueID = getContactInfoT(CNF_UNIQUEID, hContact);
@@ -40,8 +40,8 @@ static wchar_t *parseGetParent(ARGUMENTSINFO *ai) if (szUniqueID == NULL) {
szProto = PROTOID_HANDLE;
wchar_t tszID[40];
- mir_sntprintf(tszID, L"%p", hContact);
- szUniqueID = mir_tstrdup(tszID);
+ mir_snwprintf(tszID, L"%p", hContact);
+ szUniqueID = mir_wstrdup(tszID);
}
return CMString(FORMAT, L"<%S:%s>", szProto, szUniqueID).Detach();
@@ -60,7 +60,7 @@ static wchar_t *parseGetDefault(ARGUMENTSINFO *ai) if (hContact == NULL)
return NULL;
- ptrT szUniqueID;
+ ptrW szUniqueID;
char* szProto = GetContactProto(hContact);
if (szProto != NULL)
szUniqueID = getContactInfoT(CNF_UNIQUEID, hContact);
@@ -68,8 +68,8 @@ static wchar_t *parseGetDefault(ARGUMENTSINFO *ai) if (szUniqueID == NULL) {
szProto = PROTOID_HANDLE;
wchar_t tszID[40];
- mir_sntprintf(tszID, L"%p", hContact);
- szUniqueID = mir_tstrdup(tszID);
+ mir_snwprintf(tszID, L"%p", hContact);
+ szUniqueID = mir_wstrdup(tszID);
}
return CMString(FORMAT, L"<%S:%s>", szProto, szUniqueID).Detach();
@@ -88,7 +88,7 @@ static wchar_t *parseGetMostOnline(ARGUMENTSINFO *ai) if (hContact == NULL)
return NULL;
- ptrT szUniqueID;
+ ptrW szUniqueID;
char *szProto = GetContactProto(hContact);
if (szProto != NULL)
szUniqueID = getContactInfoT(CNF_UNIQUEID, hContact);
@@ -96,8 +96,8 @@ static wchar_t *parseGetMostOnline(ARGUMENTSINFO *ai) if (szUniqueID == NULL) {
szProto = PROTOID_HANDLE;
wchar_t tszID[40];
- mir_sntprintf(tszID, L"%p", hContact);
- szUniqueID = mir_tstrdup(tszID);
+ mir_snwprintf(tszID, L"%p", hContact);
+ szUniqueID = mir_wstrdup(tszID);
}
return CMString(FORMAT, L"<%S:%s>", szProto, szUniqueID).Detach();
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp index 71722f7e45..11eb8d0181 100644 --- a/plugins/Variables/src/parse_miranda.cpp +++ b/plugins/Variables/src/parse_miranda.cpp @@ -27,7 +27,7 @@ static wchar_t* parseCodeToStatus(ARGUMENTSINFO *ai) unsigned int status = ttoi(ai->targv[1]);
wchar_t *szStatus = pcli->pfnGetStatusModeDescription(status, 0);
if (szStatus != NULL)
- return mir_tstrdup(szStatus);
+ return mir_wstrdup(szStatus);
return NULL;
}
@@ -35,34 +35,34 @@ static wchar_t* parseCodeToStatus(ARGUMENTSINFO *ai) static int getContactInfoFlags(wchar_t *tszDesc)
{
int flags = 0;
- for (wchar_t *cur = tszDesc; (cur < (tszDesc + mir_tstrlen(tszDesc))); cur++) {
- if (!wcsnicmp(cur, STR_PROTOID, mir_tstrlen(STR_PROTOID))) {
+ for (wchar_t *cur = tszDesc; (cur < (tszDesc + mir_wstrlen(tszDesc))); cur++) {
+ if (!wcsnicmp(cur, STR_PROTOID, mir_wstrlen(STR_PROTOID))) {
flags |= CI_PROTOID;
- cur += mir_tstrlen(STR_PROTOID) - 1;
+ cur += mir_wstrlen(STR_PROTOID) - 1;
}
- else if (!wcsnicmp(cur, STR_NICK, mir_tstrlen(STR_NICK))) {
+ else if (!wcsnicmp(cur, STR_NICK, mir_wstrlen(STR_NICK))) {
flags |= CI_NICK;
- cur += mir_tstrlen(STR_NICK) - 1;
+ cur += mir_wstrlen(STR_NICK) - 1;
}
- else if (!wcsnicmp(cur, STR_FIRSTNAME, mir_tstrlen(STR_FIRSTNAME))) {
+ else if (!wcsnicmp(cur, STR_FIRSTNAME, mir_wstrlen(STR_FIRSTNAME))) {
flags |= CI_FIRSTNAME;
- cur += mir_tstrlen(STR_FIRSTNAME) - 1;
+ cur += mir_wstrlen(STR_FIRSTNAME) - 1;
}
- else if (!wcsnicmp(cur, STR_LASTNAME, mir_tstrlen(STR_LASTNAME))) {
+ else if (!wcsnicmp(cur, STR_LASTNAME, mir_wstrlen(STR_LASTNAME))) {
flags |= CI_LASTNAME;
- cur += mir_tstrlen(STR_LASTNAME) - 1;
+ cur += mir_wstrlen(STR_LASTNAME) - 1;
}
- else if (!wcsnicmp(cur, STR_DISPLAY, mir_tstrlen(STR_DISPLAY))) {
+ else if (!wcsnicmp(cur, STR_DISPLAY, mir_wstrlen(STR_DISPLAY))) {
flags |= CI_LISTNAME;
- cur += mir_tstrlen(STR_DISPLAY) - 1;
+ cur += mir_wstrlen(STR_DISPLAY) - 1;
}
- else if (!wcsnicmp(cur, STR_EMAIL, mir_tstrlen(STR_EMAIL))) {
+ else if (!wcsnicmp(cur, STR_EMAIL, mir_wstrlen(STR_EMAIL))) {
flags |= CI_EMAIL;
- cur += mir_tstrlen(STR_EMAIL) - 1;
+ cur += mir_wstrlen(STR_EMAIL) - 1;
}
- else if (!wcsnicmp(cur, STR_UNIQUEID, mir_tstrlen(STR_UNIQUEID))) {
+ else if (!wcsnicmp(cur, STR_UNIQUEID, mir_wstrlen(STR_UNIQUEID))) {
flags |= CI_UNIQUEID;
- cur += mir_tstrlen(STR_UNIQUEID) - 1;
+ cur += mir_wstrlen(STR_UNIQUEID) - 1;
}
}
if (flags == 0) {
@@ -129,7 +129,7 @@ static wchar_t* parseDBProfileName(ARGUMENTSINFO *ai) if (CallService(MS_DB_GETPROFILENAMET, _countof(name), (LPARAM)name))
return NULL;
- return mir_tstrdup(name);
+ return mir_wstrdup(name);
}
static wchar_t* parseDBProfilePath(ARGUMENTSINFO *ai)
@@ -141,7 +141,7 @@ static wchar_t* parseDBProfilePath(ARGUMENTSINFO *ai) if (CallService(MS_DB_GETPROFILEPATHT, _countof(path), (LPARAM)path))
return NULL;
- return mir_tstrdup(path);
+ return mir_wstrdup(path);
}
static wchar_t* getDBSetting(MCONTACT hContact, char* module, char* setting, wchar_t* defaultValue)
@@ -162,7 +162,7 @@ static wchar_t* getDBSetting(MCONTACT hContact, char* module, char* setting, wch var = itot(dbv.dVal);
break;
case DBVT_ASCIIZ:
- var = mir_a2t(dbv.pszVal);
+ var = mir_a2u(dbv.pszVal);
break;
case DBVT_WCHAR:
var = mir_wstrdup(dbv.pwszVal);
@@ -182,23 +182,23 @@ static wchar_t* parseDBSetting(ARGUMENTSINFO *ai) return NULL;
MCONTACT hContact = NULL;
- if (mir_tstrlen(ai->targv[1]) > 0) {
+ if (mir_wstrlen(ai->targv[1]) > 0) {
hContact = getContactFromString(ai->targv[1], CI_ALLFLAGS);
if (hContact == INVALID_CONTACT_ID)
return NULL;
}
- char *szModule = mir_t2a(ai->targv[2]);
+ char *szModule = mir_u2a(ai->targv[2]);
if (szModule == NULL)
return NULL;
- char *szSetting = mir_t2a(ai->targv[3]);
+ char *szSetting = mir_u2a(ai->targv[3]);
if (szSetting == NULL) {
mir_free(szModule);
return NULL;
}
- wchar_t *szDefaultValue = ((ai->argc > 4 && mir_tstrlen(ai->targv[4]) > 0) ? mir_tstrdup(ai->targv[4]) : NULL);
+ wchar_t *szDefaultValue = ((ai->argc > 4 && mir_wstrlen(ai->targv[4]) > 0) ? mir_wstrdup(ai->targv[4]) : NULL);
wchar_t *res = getDBSetting(hContact, szModule, szSetting, szDefaultValue);
mir_free(szDefaultValue);
mir_free(szSetting);
@@ -216,7 +216,7 @@ static wchar_t* parseLastSeenDate(ARGUMENTSINFO *ai) return NULL;
wchar_t *szFormat;
- if (ai->argc == 2 || (ai->argc > 2 && mir_tstrlen(ai->targv[2]) == 0))
+ if (ai->argc == 2 || (ai->argc > 2 && mir_wstrlen(ai->targv[2]) == 0))
szFormat = NULL;
else
szFormat = ai->targv[2];
@@ -258,7 +258,7 @@ static wchar_t* parseLastSeenTime(ARGUMENTSINFO *ai) return NULL;
wchar_t *szFormat;
- if (ai->argc == 2 || (ai->argc > 2 && mir_tstrlen(ai->targv[2]) == 0))
+ if (ai->argc == 2 || (ai->argc > 2 && mir_wstrlen(ai->targv[2]) == 0))
szFormat = NULL;
else
szFormat = ai->targv[2];
@@ -307,7 +307,7 @@ static wchar_t* parseLastSeenStatus(ARGUMENTSINFO *ai) wchar_t *szStatus = pcli->pfnGetStatusModeDescription(status, 0);
if (szStatus != NULL)
- return mir_tstrdup(szStatus);
+ return mir_wstrdup(szStatus);
return NULL;
}
@@ -322,7 +322,7 @@ static wchar_t* parseMirandaPath(ARGUMENTSINFO *ai) if (GetModuleFileName(NULL, path, _countof(path)) == 0)
return NULL;
- return mir_tstrdup(path);
+ return mir_wstrdup(path);
}
static wchar_t* parseMyStatus(ARGUMENTSINFO *ai)
@@ -331,13 +331,13 @@ static wchar_t* parseMyStatus(ARGUMENTSINFO *ai) return NULL;
int status;
- if (ai->argc == 1 || mir_tstrlen(ai->targv[1]) == 0)
+ if (ai->argc == 1 || mir_wstrlen(ai->targv[1]) == 0)
status = CallService(MS_CLIST_GETSTATUSMODE, 0, 0);
else
status = CallProtoService(_T2A(ai->targv[1]), PS_GETSTATUS, 0, 0);
wchar_t *szStatus = pcli->pfnGetStatusModeDescription(status, 0);
- return (szStatus != NULL) ? mir_tstrdup(szStatus) : NULL;
+ return (szStatus != NULL) ? mir_wstrdup(szStatus) : NULL;
}
static wchar_t* parseProtoInfo(ARGUMENTSINFO *ai)
@@ -347,28 +347,28 @@ static wchar_t* parseProtoInfo(ARGUMENTSINFO *ai) char *szRes = NULL;
wchar_t *tszRes = NULL;
- ptrA szProto(mir_t2a(ai->targv[1]));
+ ptrA szProto(mir_u2a(ai->targv[1]));
- if (!mir_tstrcmp(ai->targv[2], _A2W(STR_PINAME)))
+ if (!mir_wstrcmp(ai->targv[2], _A2W(STR_PINAME)))
tszRes = Hlp_GetProtocolName(szProto);
- else if (!mir_tstrcmp(ai->targv[2], _A2W(STR_PIUIDTEXT))) {
+ else if (!mir_wstrcmp(ai->targv[2], _A2W(STR_PIUIDTEXT))) {
szRes = (char *)CallProtoService(szProto, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDTEXT, 0);
if (INT_PTR(szRes) == CALLSERVICE_NOTFOUND)
return NULL;
}
- else if (!mir_tstrcmp(ai->targv[2], _A2W(STR_PIUIDSETTING))) {
+ else if (!mir_wstrcmp(ai->targv[2], _A2W(STR_PIUIDSETTING))) {
szRes = (char *)CallProtoService(szProto, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDSETTING, 0);
if (INT_PTR(szRes) == CALLSERVICE_NOTFOUND)
return NULL;
}
- else if (!mir_tstrcmp(ai->targv[2], _A2W(STR_PINICK)))
+ else if (!mir_wstrcmp(ai->targv[2], _A2W(STR_PINICK)))
tszRes = Contact_GetInfo(CNF_DISPLAY, NULL, szProto);
if (szRes == NULL && tszRes == NULL)
return NULL;
if (szRes != NULL && tszRes == NULL)
- tszRes = mir_a2t(szRes);
+ tszRes = mir_a2u(szRes);
return tszRes;
}
@@ -379,7 +379,7 @@ static wchar_t* parseSpecialContact(ARGUMENTSINFO *ai) return NULL;
ai->flags |= AIF_DONTPARSE;
- ptrT szUniqueID;
+ ptrW szUniqueID;
char *szProto = GetContactProto(ai->fi->hContact);
if (szProto != NULL)
szUniqueID = getContactInfoT(CNF_UNIQUEID, ai->fi->hContact);
@@ -389,7 +389,7 @@ static wchar_t* parseSpecialContact(ARGUMENTSINFO *ai) szUniqueID = (wchar_t*)mir_alloc(40);
if (szUniqueID == NULL)
return NULL;
- mir_sntprintf(szUniqueID, 20, L"%p", ai->fi->hContact);
+ mir_snwprintf(szUniqueID, 20, L"%p", ai->fi->hContact);
}
if (szUniqueID == NULL)
@@ -590,7 +590,7 @@ static wchar_t* parseTranslate(ARGUMENTSINFO *ai) return NULL;
wchar_t *res = TranslateTS(ai->targv[1]);
- return (res == NULL) ? NULL : mir_tstrdup(res);
+ return (res == NULL) ? NULL : mir_wstrdup(res);
}
static wchar_t* parseVersionString(ARGUMENTSINFO *ai)
@@ -603,7 +603,7 @@ static wchar_t* parseVersionString(ARGUMENTSINFO *ai) if (CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)sizeof(versionString), (LPARAM)versionString))
return NULL;
- return mir_a2t(versionString);
+ return mir_a2u(versionString);
}
static wchar_t *parseContactNameString(ARGUMENTSINFO *ai)
@@ -613,7 +613,7 @@ static wchar_t *parseContactNameString(ARGUMENTSINFO *ai) ai->flags |= AIF_DONTPARSE;
wchar_t *ret = (wchar_t*)pcli->pfnGetContactDisplayName(ai->fi->hContact, 0);
- return (ret == NULL) ? NULL : mir_tstrdup(ret);
+ return (ret == NULL) ? NULL : mir_wstrdup(ret);
}
static wchar_t *parseMirDateString(ARGUMENTSINFO *ai)
@@ -624,7 +624,7 @@ static wchar_t *parseMirDateString(ARGUMENTSINFO *ai) ai->flags |= AIF_DONTPARSE;
wchar_t ret[128];
- return mir_tstrdup(TimeZone_ToStringT(time(NULL), L"d s", ret, _countof(ret)));
+ return mir_wstrdup(TimeZone_ToStringT(time(NULL), L"d s", ret, _countof(ret)));
}
static wchar_t *parseMirandaCoreVar(ARGUMENTSINFO *ai)
@@ -635,7 +635,7 @@ static wchar_t *parseMirandaCoreVar(ARGUMENTSINFO *ai) ai->flags |= AIF_DONTPARSE;
wchar_t corevar[MAX_PATH];
- mir_sntprintf(corevar, L"%%%s%%", ai->targv[0]);
+ mir_snwprintf(corevar, L"%%%s%%", ai->targv[0]);
return Utils_ReplaceVarsT(corevar);
}
@@ -647,7 +647,7 @@ static wchar_t *parseMirSrvExists(ARGUMENTSINFO *ai) if (!ServiceExists(_T2A(ai->targv[1])))
ai->flags |= AIF_FALSE;
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
void registerMirandaTokens()
diff --git a/plugins/Variables/src/parse_regexp.cpp b/plugins/Variables/src/parse_regexp.cpp index f5cb3c6ba8..7031fc4cc6 100644 --- a/plugins/Variables/src/parse_regexp.cpp +++ b/plugins/Variables/src/parse_regexp.cpp @@ -39,14 +39,14 @@ static wchar_t *parseRegExpCheck(ARGUMENTSINFO *ai) return NULL;
pcre16_extra *extra = pcre16_study(ppat, 0, &err);
- int nmat = pcre16_exec(ppat, extra, ai->targv[2], (int)mir_tstrlen(ai->targv[2]), 0, 0, offsets, 99);
+ int nmat = pcre16_exec(ppat, extra, ai->targv[2], (int)mir_wstrlen(ai->targv[2]), 0, 0, offsets, 99);
if (nmat > 0) {
ai->flags &= ~AIF_FALSE;
_ltoa(nmat, szVal, 10);
- return mir_a2t(szVal);
+ return mir_a2u(szVal);
}
- return mir_tstrdup(L"0");
+ return mir_wstrdup(L"0");
}
/*
@@ -72,19 +72,19 @@ static wchar_t *parseRegExpSubstr(ARGUMENTSINFO *ai) return NULL;
pcre16_extra *extra = pcre16_study(ppat, 0, &err);
- int nmat = pcre16_exec(ppat, extra, ai->targv[2], (int)mir_tstrlen(ai->targv[2]), 0, 0, offsets, 99);
+ int nmat = pcre16_exec(ppat, extra, ai->targv[2], (int)mir_wstrlen(ai->targv[2]), 0, 0, offsets, 99);
if (nmat >= 0)
ai->flags &= ~AIF_FALSE;
if (pcre16_get_substring(ai->targv[2], offsets, nmat, number, &substring) < 0)
ai->flags |= AIF_FALSE;
else {
- wchar_t *tres = mir_tstrdup(substring);
+ wchar_t *tres = mir_wstrdup(substring);
pcre16_free_substring(substring);
return tres;
}
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
void registerRegExpTokens()
diff --git a/plugins/Variables/src/parse_str.cpp b/plugins/Variables/src/parse_str.cpp index 5ee00fb0f7..5779f13dc1 100644 --- a/plugins/Variables/src/parse_str.cpp +++ b/plugins/Variables/src/parse_str.cpp @@ -24,7 +24,7 @@ static wchar_t *parseCaps(ARGUMENTSINFO *ai) if (ai->argc != 2)
return NULL;
- wchar_t *res = mir_tstrdup(ai->targv[1]);
+ wchar_t *res = mir_wstrdup(ai->targv[1]);
wchar_t *cur = res;
CharLower(res);
*cur = (wchar_t)CharUpper((LPTSTR)*cur);
@@ -49,7 +49,7 @@ static wchar_t *parseCaps2(ARGUMENTSINFO *ai) if (ai->argc != 2)
return NULL;
- wchar_t *res = mir_tstrdup(ai->targv[1]);
+ wchar_t *res = mir_wstrdup(ai->targv[1]);
wchar_t *cur = res;
*cur = (wchar_t)CharUpper((LPTSTR)*cur);
cur++;
@@ -67,7 +67,7 @@ static wchar_t *parseCaps2(ARGUMENTSINFO *ai) static wchar_t *parseCrlf(ARGUMENTSINFO *ai)
{
ai->flags |= AIF_DONTPARSE;
- return mir_tstrdup(L"\r\n");
+ return mir_wstrdup(L"\r\n");
}
static wchar_t *parseEolToCrlf(ARGUMENTSINFO *ai)
@@ -75,7 +75,7 @@ static wchar_t *parseEolToCrlf(ARGUMENTSINFO *ai) if (ai->argc != 2)
return NULL;
- wchar_t *res = mir_tstrdup(ai->targv[1]);
+ wchar_t *res = mir_wstrdup(ai->targv[1]);
wchar_t *cur = res;
do {
cur = wcschr(cur, '\n');
@@ -84,9 +84,9 @@ static wchar_t *parseEolToCrlf(ARGUMENTSINFO *ai) log_debug(cur);
int loc = cur - res;
- res = (wchar_t*)mir_realloc(res, (mir_tstrlen(res) + 2)*sizeof(wchar_t));
+ res = (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + 2)*sizeof(wchar_t));
cur = res + loc;
- memmove(cur + 2, cur + 1, (mir_tstrlen(cur + 1) + 1)*sizeof(wchar_t));
+ memmove(cur + 2, cur + 1, (mir_wstrlen(cur + 1) + 1)*sizeof(wchar_t));
memcpy(cur, L"\r\n", 2 * sizeof(wchar_t));
cur += 2;
}
@@ -106,20 +106,20 @@ static wchar_t *parseFixeol(ARGUMENTSINFO *ai) return NULL;
wchar_t *cur = ai->targv[1];
- while (mir_tstrcmp(cur, L"\r\n") && *cur != '\n' && *cur != 0)
+ while (mir_wstrcmp(cur, L"\r\n") && *cur != '\n' && *cur != 0)
cur++;
if (*cur == '\0')
- return mir_tstrdup(ai->targv[1]);
+ return mir_wstrdup(ai->targv[1]);
cur--;
- wchar_t *res = (wchar_t*)mir_alloc((cur - ai->targv[1] + mir_tstrlen(szReplacement) + 1)*sizeof(wchar_t));
+ wchar_t *res = (wchar_t*)mir_alloc((cur - ai->targv[1] + mir_wstrlen(szReplacement) + 1)*sizeof(wchar_t));
if (res == NULL)
return res;
memset(res, 0, (((cur - ai->targv[1]) + 1) * sizeof(wchar_t)));
wcsncpy(res, ai->targv[1], cur - ai->targv[1]);
- mir_tstrcat(res, szReplacement);
+ mir_wstrcat(res, szReplacement);
return res;
}
@@ -132,27 +132,27 @@ static wchar_t *parseFixeol2(ARGUMENTSINFO *ai) default: return NULL;
}
- wchar_t *res = mir_tstrdup(ai->targv[1]);
- for (size_t pos = 0; pos < mir_tstrlen(res); pos++) {
+ wchar_t *res = mir_wstrdup(ai->targv[1]);
+ for (size_t pos = 0; pos < mir_wstrlen(res); pos++) {
wchar_t *cur = res + pos;
wchar_t *szEol = NULL;
- if (!wcsncmp(cur, L"\r\n", mir_tstrlen(L"\r\n")))
+ if (!wcsncmp(cur, L"\r\n", mir_wstrlen(L"\r\n")))
szEol = L"\r\n";
if (*cur == '\n')
szEol = L"\n";
if (szEol != NULL) {
- if (mir_tstrlen(szReplacement) > mir_tstrlen(szEol)) {
- res = (wchar_t*)mir_realloc(res, (mir_tstrlen(res) + mir_tstrlen(szReplacement) - mir_tstrlen(szEol) + 1)*sizeof(wchar_t));
+ if (mir_wstrlen(szReplacement) > mir_wstrlen(szEol)) {
+ res = (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + mir_wstrlen(szReplacement) - mir_wstrlen(szEol) + 1)*sizeof(wchar_t));
cur = res + pos;
}
- memmove(cur + mir_tstrlen(szReplacement), cur + mir_tstrlen(szEol), (mir_tstrlen(cur + mir_tstrlen(szEol)) + 1)*sizeof(wchar_t));
- memcpy(cur, szReplacement, mir_tstrlen(szReplacement)*sizeof(wchar_t));
- pos += mir_tstrlen(szReplacement) - 1;
+ memmove(cur + mir_wstrlen(szReplacement), cur + mir_wstrlen(szEol), (mir_wstrlen(cur + mir_wstrlen(szEol)) + 1)*sizeof(wchar_t));
+ memcpy(cur, szReplacement, mir_wstrlen(szReplacement)*sizeof(wchar_t));
+ pos += mir_wstrlen(szReplacement) - 1;
}
}
- return (wchar_t*)mir_realloc(res, (mir_tstrlen(res) + 1)*sizeof(wchar_t));
+ return (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + 1)*sizeof(wchar_t));
}
static wchar_t *parseInsert(ARGUMENTSINFO *ai)
@@ -161,17 +161,17 @@ static wchar_t *parseInsert(ARGUMENTSINFO *ai) return NULL;
unsigned int pos = ttoi(ai->targv[3]);
- if (pos > mir_tstrlen(ai->targv[1]))
+ if (pos > mir_wstrlen(ai->targv[1]))
return NULL;
- wchar_t *res = (wchar_t*)mir_alloc((mir_tstrlen(ai->targv[1]) + mir_tstrlen(ai->targv[2]) + 1)*sizeof(wchar_t));
+ wchar_t *res = (wchar_t*)mir_alloc((mir_wstrlen(ai->targv[1]) + mir_wstrlen(ai->targv[2]) + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
- memset(res, 0, ((mir_tstrlen(ai->targv[1]) + mir_tstrlen(ai->targv[2]) + 1) * sizeof(wchar_t)));
+ memset(res, 0, ((mir_wstrlen(ai->targv[1]) + mir_wstrlen(ai->targv[2]) + 1) * sizeof(wchar_t)));
wcsncpy(res, ai->targv[1], pos);
- mir_tstrcpy(res + pos, ai->targv[2]);
- mir_tstrcpy(res + pos + mir_tstrlen(ai->targv[2]), ai->targv[1] + pos);
+ mir_wstrcpy(res + pos, ai->targv[2]);
+ mir_wstrcpy(res + pos + mir_wstrlen(ai->targv[2]), ai->targv[1] + pos);
return res;
}
@@ -184,7 +184,7 @@ static wchar_t *parseLeft(ARGUMENTSINFO *ai) if (len < 0)
return NULL;
- len = min(len, (signed int)mir_tstrlen(ai->targv[1]));
+ len = min(len, (signed int)mir_wstrlen(ai->targv[1]));
wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
@@ -199,7 +199,7 @@ static wchar_t *parseLen(ARGUMENTSINFO *ai) if (ai->argc != 2)
return NULL;
- return itot((int)mir_tstrlen(ai->targv[1]));
+ return itot((int)mir_wstrlen(ai->targv[1]));
}
static wchar_t *parseLineCount(ARGUMENTSINFO *ai)
@@ -209,7 +209,7 @@ static wchar_t *parseLineCount(ARGUMENTSINFO *ai) int count = 1;
wchar_t *cur = ai->targv[1];
- while (cur < (ai->targv[1] + mir_tstrlen(ai->targv[1]))) {
+ while (cur < (ai->targv[1] + mir_wstrlen(ai->targv[1]))) {
if (!wcsncmp(cur, L"\r\n", 2)) {
count++;
cur++;
@@ -228,7 +228,7 @@ static wchar_t *parseLower(ARGUMENTSINFO *ai) if (ai->argc != 2)
return NULL;
- wchar_t *res = mir_tstrdup(ai->targv[1]);
+ wchar_t *res = mir_wstrdup(ai->targv[1]);
if (res == NULL)
return NULL;
@@ -242,10 +242,10 @@ static wchar_t *parseLongest(ARGUMENTSINFO *ai) unsigned int iLong = 1;
for (unsigned int i = 2; i < ai->argc; i++)
- if (mir_tstrlen(ai->targv[i]) > mir_tstrlen(ai->targv[iLong]))
+ if (mir_wstrlen(ai->targv[i]) > mir_wstrlen(ai->targv[iLong]))
iLong = i;
- return mir_tstrdup(ai->targv[iLong]);
+ return mir_wstrdup(ai->targv[iLong]);
}
static wchar_t *parseNoOp(ARGUMENTSINFO *ai)
@@ -253,7 +253,7 @@ static wchar_t *parseNoOp(ARGUMENTSINFO *ai) if (ai->argc != 2)
return NULL;
- return mir_tstrdup(ai->targv[1]);
+ return mir_wstrdup(ai->targv[1]);
}
static wchar_t *parsePad(ARGUMENTSINFO *ai)
@@ -269,17 +269,17 @@ static wchar_t *parsePad(ARGUMENTSINFO *ai) if (padding < 0)
return NULL;
- unsigned int addcount = max(padding - (signed int)mir_tstrlen(ai->targv[1]), 0);
- wchar_t *res = (wchar_t*)mir_alloc((addcount + mir_tstrlen(ai->targv[1]) + 1)*sizeof(wchar_t));
+ unsigned int addcount = max(padding - (signed int)mir_wstrlen(ai->targv[1]), 0);
+ wchar_t *res = (wchar_t*)mir_alloc((addcount + mir_wstrlen(ai->targv[1]) + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
- memset(res, 0, ((addcount + mir_tstrlen(ai->targv[1]) + 1) * sizeof(wchar_t)));
+ memset(res, 0, ((addcount + mir_wstrlen(ai->targv[1]) + 1) * sizeof(wchar_t)));
wchar_t *cur = res;
for (unsigned int i = 0; i < addcount; i++)
*cur++ = padchar;
- mir_tstrcat(res, ai->targv[1]);
+ mir_wstrcat(res, ai->targv[1]);
return res;
}
@@ -296,14 +296,14 @@ static wchar_t *parsePadright(ARGUMENTSINFO *ai) if (padding < 0)
return NULL;
- unsigned int addcount = max(padding - (signed int)mir_tstrlen(ai->targv[1]), 0);
- wchar_t *res = (wchar_t*)mir_alloc((addcount + mir_tstrlen(ai->targv[1]) + 1)*sizeof(wchar_t));
+ unsigned int addcount = max(padding - (signed int)mir_wstrlen(ai->targv[1]), 0);
+ wchar_t *res = (wchar_t*)mir_alloc((addcount + mir_wstrlen(ai->targv[1]) + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
- memset(res, 0, ((addcount + mir_tstrlen(ai->targv[1]) + 1) * sizeof(wchar_t)));
- mir_tstrcpy(res, ai->targv[1]);
- wchar_t *cur = res + mir_tstrlen(ai->targv[1]);
+ memset(res, 0, ((addcount + mir_wstrlen(ai->targv[1]) + 1) * sizeof(wchar_t)));
+ mir_wstrcpy(res, ai->targv[1]);
+ wchar_t *cur = res + mir_wstrlen(ai->targv[1]);
for (unsigned int i = 0; i < addcount; i++)
*cur++ = padchar;
@@ -323,7 +323,7 @@ static wchar_t *parsePadcut(ARGUMENTSINFO *ai) if (padding < 0)
return NULL;
- int addcount = max(padding - (signed int)mir_tstrlen(ai->targv[1]), 0);
+ int addcount = max(padding - (signed int)mir_wstrlen(ai->targv[1]), 0);
wchar_t *res = (wchar_t*)mir_alloc((padding + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
@@ -352,7 +352,7 @@ static wchar_t *parsePadcutright(ARGUMENTSINFO *ai) if (padding < 0)
return NULL;
- int addcount = max(padding - (signed int)mir_tstrlen(ai->targv[1]), 0);
+ int addcount = max(padding - (signed int)mir_wstrlen(ai->targv[1]), 0);
wchar_t *res = (wchar_t*)mir_alloc((padding + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
@@ -377,13 +377,13 @@ static wchar_t *parseRepeat(ARGUMENTSINFO *ai) if (count < 0)
return NULL;
- wchar_t *res = (wchar_t*)mir_alloc((count * mir_tstrlen(ai->targv[1]) + 1)*sizeof(wchar_t));
+ wchar_t *res = (wchar_t*)mir_alloc((count * mir_wstrlen(ai->targv[1]) + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
- memset(res, 0, ((count * mir_tstrlen(ai->targv[1]) + 1) * sizeof(wchar_t)));
+ memset(res, 0, ((count * mir_wstrlen(ai->targv[1]) + 1) * sizeof(wchar_t)));
for (int i = 0; i < count; i++)
- mir_tstrcat(res, ai->targv[1]);
+ mir_wstrcat(res, ai->targv[1]);
return res;
}
@@ -396,24 +396,24 @@ static wchar_t *parseReplace(ARGUMENTSINFO *ai) wchar_t *cur;
size_t pos = 0;
- wchar_t *res = mir_tstrdup(ai->targv[1]);
+ wchar_t *res = mir_wstrdup(ai->targv[1]);
for (size_t i = 2; i < ai->argc; i += 2) {
- if (mir_tstrlen(ai->targv[i]) == 0)
+ if (mir_wstrlen(ai->targv[i]) == 0)
continue;
- for (pos = 0; pos<mir_tstrlen(res); pos++) {
+ for (pos = 0; pos<mir_wstrlen(res); pos++) {
cur = res + pos;
- if (!wcsncmp(cur, ai->targv[i], mir_tstrlen(ai->targv[i]))) {
- if (mir_tstrlen(ai->targv[i + 1]) > mir_tstrlen(ai->targv[i])) {
- res = (wchar_t*)mir_realloc(res, (mir_tstrlen(res) + mir_tstrlen(ai->targv[i + 1]) - mir_tstrlen(ai->targv[i]) + 1)*sizeof(wchar_t));
+ if (!wcsncmp(cur, ai->targv[i], mir_wstrlen(ai->targv[i]))) {
+ if (mir_wstrlen(ai->targv[i + 1]) > mir_wstrlen(ai->targv[i])) {
+ res = (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + mir_wstrlen(ai->targv[i + 1]) - mir_wstrlen(ai->targv[i]) + 1)*sizeof(wchar_t));
cur = res + pos;
}
- memmove(cur + mir_tstrlen(ai->targv[i + 1]), cur + mir_tstrlen(ai->targv[i]), (mir_tstrlen(cur + mir_tstrlen(ai->targv[i])) + 1)*sizeof(wchar_t));
- memcpy(cur, ai->targv[i + 1], mir_tstrlen(ai->targv[i + 1])*sizeof(wchar_t));
- pos += mir_tstrlen(ai->targv[i + 1]) - 1;
+ memmove(cur + mir_wstrlen(ai->targv[i + 1]), cur + mir_wstrlen(ai->targv[i]), (mir_wstrlen(cur + mir_wstrlen(ai->targv[i])) + 1)*sizeof(wchar_t));
+ memcpy(cur, ai->targv[i + 1], mir_wstrlen(ai->targv[i + 1])*sizeof(wchar_t));
+ pos += mir_wstrlen(ai->targv[i + 1]) - 1;
}
}
- res = (wchar_t*)mir_realloc(res, (mir_tstrlen(res) + 1)*sizeof(wchar_t));
+ res = (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + 1)*sizeof(wchar_t));
}
return res;
@@ -428,13 +428,13 @@ static wchar_t *parseRight(ARGUMENTSINFO *ai) if (len < 0)
return NULL;
- len = min(len, (signed int)mir_tstrlen(ai->targv[1]));
+ len = min(len, (signed int)mir_wstrlen(ai->targv[1]));
wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
memset(res, 0, ((len + 1)*sizeof(wchar_t)));
- wcsncpy(res, ai->targv[1] + mir_tstrlen(ai->targv[1]) - len, len);
+ wcsncpy(res, ai->targv[1] + mir_wstrlen(ai->targv[1]) - len, len);
return res;
}
@@ -446,24 +446,24 @@ static wchar_t *parseScroll(ARGUMENTSINFO *ai) if (ai->argc != 4)
return NULL;
- if (mir_tstrlen(ai->targv[1]) == 0)
- return mir_tstrdup(ai->targv[1]);
+ if (mir_wstrlen(ai->targv[1]) == 0)
+ return mir_wstrdup(ai->targv[1]);
- size_t move = ttoi(ai->targv[3]) % mir_tstrlen(ai->targv[1]);
+ size_t move = ttoi(ai->targv[3]) % mir_wstrlen(ai->targv[1]);
size_t display = ttoi(ai->targv[2]);
- if (display > mir_tstrlen(ai->targv[1]))
- display = (unsigned)mir_tstrlen(ai->targv[1]);
+ if (display > mir_wstrlen(ai->targv[1]))
+ display = (unsigned)mir_wstrlen(ai->targv[1]);
- wchar_t *res = (wchar_t*)mir_alloc((2 * mir_tstrlen(ai->targv[1]) + 1)*sizeof(wchar_t));
+ wchar_t *res = (wchar_t*)mir_alloc((2 * mir_wstrlen(ai->targv[1]) + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
- memset(res, 0, ((2 * mir_tstrlen(ai->targv[1]) + 1) * sizeof(wchar_t)));
- mir_tstrcpy(res, ai->targv[1]);
- mir_tstrcat(res, ai->targv[1]);
- memmove(res, res + move, (mir_tstrlen(res + move) + 1)*sizeof(wchar_t));
+ memset(res, 0, ((2 * mir_wstrlen(ai->targv[1]) + 1) * sizeof(wchar_t)));
+ mir_wstrcpy(res, ai->targv[1]);
+ mir_wstrcat(res, ai->targv[1]);
+ memmove(res, res + move, (mir_wstrlen(res + move) + 1)*sizeof(wchar_t));
*(res + display) = 0;
- res = (wchar_t*)mir_realloc(res, (mir_tstrlen(res) + 1)*sizeof(wchar_t));
+ res = (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + 1)*sizeof(wchar_t));
return res;
}
@@ -475,10 +475,10 @@ static wchar_t *parseShortest(ARGUMENTSINFO *ai) int iShort = 1;
for (unsigned i = 2; i < ai->argc; i++)
- if (mir_tstrlen(ai->targv[i]) < mir_tstrlen(ai->targv[iShort]))
+ if (mir_wstrlen(ai->targv[i]) < mir_wstrlen(ai->targv[iShort]))
iShort = i;
- return mir_tstrdup(ai->targv[iShort]);
+ return mir_wstrdup(ai->targv[iShort]);
}
static wchar_t *parseStrchr(ARGUMENTSINFO *ai)
@@ -490,7 +490,7 @@ static wchar_t *parseStrchr(ARGUMENTSINFO *ai) memset(szVal, 0, sizeof(szVal));
wchar_t *c = wcschr(ai->targv[1], *ai->targv[2]);
if (c == NULL || *c == 0)
- return mir_tstrdup(L"0");
+ return mir_wstrdup(L"0");
return itot(c - ai->targv[1] + 1);
}
@@ -500,10 +500,10 @@ static wchar_t *parseStrcmp(ARGUMENTSINFO *ai) if (ai->argc != 3)
return NULL;
- if (mir_tstrcmp(ai->targv[1], ai->targv[2]))
+ if (mir_wstrcmp(ai->targv[1], ai->targv[2]))
ai->flags |= AIF_FALSE;
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseStrmcmp(ARGUMENTSINFO *ai)
@@ -513,13 +513,13 @@ static wchar_t *parseStrmcmp(ARGUMENTSINFO *ai) ai->flags |= AIF_FALSE;
for (unsigned i = 2; i < ai->argc; i++) {
- if (!mir_tstrcmp(ai->targv[1], ai->targv[i])) {
+ if (!mir_wstrcmp(ai->targv[1], ai->targv[i])) {
ai->flags &= ~AIF_FALSE;
break;
}
}
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseStrncmp(ARGUMENTSINFO *ai)
@@ -534,7 +534,7 @@ static wchar_t *parseStrncmp(ARGUMENTSINFO *ai) if (wcsncmp(ai->targv[1], ai->targv[2], n))
ai->flags |= AIF_FALSE;
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseStricmp(ARGUMENTSINFO *ai)
@@ -542,10 +542,10 @@ static wchar_t *parseStricmp(ARGUMENTSINFO *ai) if (ai->argc != 3)
return NULL;
- if (mir_tstrcmpi(ai->targv[1], ai->targv[2]))
+ if (mir_wstrcmpi(ai->targv[1], ai->targv[2]))
ai->flags |= AIF_FALSE;
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseStrnicmp(ARGUMENTSINFO *ai)
@@ -560,7 +560,7 @@ static wchar_t *parseStrnicmp(ARGUMENTSINFO *ai) if (wcsnicmp(ai->targv[1], ai->targv[2], n))
ai->flags |= AIF_FALSE;
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseStrrchr(ARGUMENTSINFO *ai)
@@ -570,7 +570,7 @@ static wchar_t *parseStrrchr(ARGUMENTSINFO *ai) wchar_t *c = wcsrchr(ai->targv[1], *ai->targv[2]);
if ((c == NULL) || (*c == 0))
- return mir_tstrdup(L"0");
+ return mir_wstrdup(L"0");
return itot(c - ai->targv[1] + 1);
}
@@ -582,7 +582,7 @@ static wchar_t *parseStrstr(ARGUMENTSINFO *ai) wchar_t *c = wcsstr(ai->targv[1], ai->targv[2]);
if ((c == NULL) || (*c == 0))
- return mir_tstrdup(L"0");
+ return mir_wstrdup(L"0");
return itot(c - ai->targv[1] + 1);
}
@@ -594,9 +594,9 @@ static wchar_t *parseSubstr(ARGUMENTSINFO *ai) int to, from = max(ttoi(ai->targv[2]) - 1, 0);
if (ai->argc > 3)
- to = min(ttoi(ai->targv[3]), (int)mir_tstrlen(ai->targv[1]));
+ to = min(ttoi(ai->targv[3]), (int)mir_wstrlen(ai->targv[1]));
else
- to = (int)mir_tstrlen(ai->targv[1]);
+ to = (int)mir_wstrlen(ai->targv[1]);
if (to < from)
return NULL;
@@ -616,7 +616,7 @@ static wchar_t *parseSelect(ARGUMENTSINFO *ai) if ((n > (signed int)ai->argc - 2) || n <= 0)
return NULL;
- return mir_tstrdup(ai->targv[n + 1]);
+ return mir_wstrdup(ai->targv[n + 1]);
}
static wchar_t *parseSwitch(ARGUMENTSINFO *ai)
@@ -625,8 +625,8 @@ static wchar_t *parseSwitch(ARGUMENTSINFO *ai) return NULL;
for (unsigned i = 2; i < ai->argc; i += 2)
- if (!mir_tstrcmp(ai->targv[1], ai->targv[i]))
- return mir_tstrdup(ai->targv[i + 1]);
+ if (!mir_wstrcmp(ai->targv[1], ai->targv[i]))
+ return mir_wstrdup(ai->targv[i + 1]);
return NULL;
}
@@ -640,12 +640,12 @@ static wchar_t *parseTrim(ARGUMENTSINFO *ai) while (*scur == ' ')
scur++;
- wchar_t *ecur = ai->targv[1] + mir_tstrlen(ai->targv[1]) - 1;
+ wchar_t *ecur = ai->targv[1] + mir_wstrlen(ai->targv[1]) - 1;
while ((*ecur == ' ') && (ecur > ai->targv[1]))
ecur--;
if (scur >= ecur)
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
wchar_t *res = (wchar_t*)mir_alloc((ecur - scur + 2)*sizeof(wchar_t));
if (res == NULL)
@@ -660,7 +660,7 @@ static wchar_t *parseTrim(ARGUMENTSINFO *ai) static wchar_t *parseTab(ARGUMENTSINFO *ai)
{
int count = 1;
- if ((ai->argc == 2) && (mir_tstrlen(ai->targv[1]) > 0))
+ if ((ai->argc == 2) && (mir_wstrlen(ai->targv[1]) > 0))
count = ttoi(ai->targv[1]);
if (count < 0)
@@ -683,7 +683,7 @@ static wchar_t *parseUpper(ARGUMENTSINFO *ai) if (ai->argc != 2)
return NULL;
- wchar_t *res = mir_tstrdup(ai->targv[1]);
+ wchar_t *res = mir_wstrdup(ai->targv[1]);
if (res == NULL)
return NULL;
@@ -701,7 +701,7 @@ static wchar_t *getNthWord(wchar_t *szString, int w) scur++;
count++;
- while ((count < w) && (scur < szString + mir_tstrlen(szString))) {
+ while ((count < w) && (scur < szString + mir_wstrlen(szString))) {
if (*scur == ' ') {
while (*scur == ' ')
scur++;
@@ -735,7 +735,7 @@ static wchar_t *parseWord(ARGUMENTSINFO *ai) wchar_t *res = NULL;
int to, from = ttoi(ai->targv[2]);
if (ai->argc == 4) {
- if (mir_tstrlen(ai->targv[3]) > 0)
+ if (mir_wstrlen(ai->targv[3]) > 0)
to = ttoi(ai->targv[3]);
else
to = 100000; // rework
@@ -751,11 +751,11 @@ static wchar_t *parseWord(ARGUMENTSINFO *ai) return res;
if (res != NULL) {
- wchar_t *pres = (wchar_t*)mir_realloc(res, (mir_tstrlen(res) + mir_tstrlen(szWord) + 2)*sizeof(wchar_t));
+ wchar_t *pres = (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + mir_wstrlen(szWord) + 2)*sizeof(wchar_t));
if (pres != NULL) {
res = pres;
- mir_tstrcat(res, L" ");
- mir_tstrcat(res, szWord);
+ mir_wstrcat(res, L" ");
+ mir_wstrcat(res, szWord);
}
mir_free(szWord);
}
@@ -772,7 +772,7 @@ static wchar_t *parseExtratext(ARGUMENTSINFO *ai) ai->flags |= AIF_DONTPARSE;
if (ai->fi->szExtraText != NULL)
- return mir_tstrdup(ai->fi->tszExtraText);
+ return mir_wstrdup(ai->fi->tszExtraText);
return NULL;
}
diff --git a/plugins/Variables/src/parse_system.cpp b/plugins/Variables/src/parse_system.cpp index 370c84881e..947a6b33e4 100644 --- a/plugins/Variables/src/parse_system.cpp +++ b/plugins/Variables/src/parse_system.cpp @@ -51,15 +51,15 @@ static wchar_t *parseCpuLoad(ARGUMENTSINFO *ai) if (ai->argc != 2)
return NULL;
- if (mir_tstrlen(ai->targv[1]) == 0)
- szCounter = mir_tstrdup(L"\\Processor(_Total)\\% Processor Time");
+ if (mir_wstrlen(ai->targv[1]) == 0)
+ szCounter = mir_wstrdup(L"\\Processor(_Total)\\% Processor Time");
else {
- int size = (int)mir_tstrlen(ai->targv[1]) + 32;
+ int size = (int)mir_wstrlen(ai->targv[1]) + 32;
szCounter = (wchar_t *)mir_alloc(size * sizeof(wchar_t));
if (szCounter == NULL)
return NULL;
- mir_sntprintf(szCounter, size, L"\\Process(%s)\\%% Processor Time", ai->targv[1]);
+ mir_snwprintf(szCounter, size, L"\\Process(%s)\\%% Processor Time", ai->targv[1]);
}
PDH_STATUS pdhStatus = PdhValidatePath(szCounter);
if (pdhStatus != ERROR_SUCCESS) {
@@ -105,18 +105,18 @@ static wchar_t *parseCpuLoad(ARGUMENTSINFO *ai) pdhStatus = PdhCloseQuery(hQuery);
return NULL;
}
- mir_sntprintf(szVal, L"%.0f", cValue.doubleValue);
+ mir_snwprintf(szVal, L"%.0f", cValue.doubleValue);
//PdhRemoveCounter(*hCounter);
PdhCloseQuery(hQuery);
mir_free(szCounter);
- return mir_tstrdup(szVal);
+ return mir_wstrdup(szVal);
}
static wchar_t *parseCurrentDate(ARGUMENTSINFO *ai)
{
wchar_t *szFormat;
- if (ai->argc == 1 || (ai->argc > 1 && mir_tstrlen(ai->targv[1]) == 0))
+ if (ai->argc == 1 || (ai->argc > 1 && mir_wstrlen(ai->targv[1]) == 0))
szFormat = NULL;
else
szFormat = ai->targv[1];
@@ -137,7 +137,7 @@ static wchar_t *parseCurrentDate(ARGUMENTSINFO *ai) static wchar_t *parseCurrentTime(ARGUMENTSINFO *ai)
{
wchar_t *szFormat;
- if (ai->argc == 1 || (ai->argc > 1) && (mir_tstrlen(ai->targv[1]) == 0))
+ if (ai->argc == 1 || (ai->argc > 1) && (mir_wstrlen(ai->targv[1]) == 0))
szFormat = NULL;
else
szFormat = ai->targv[1];
@@ -165,16 +165,16 @@ static wchar_t *parseDirectory(ARGUMENTSINFO *ai) depth = ttoi(ai->targv[2]);
if (depth <= 0)
- return mir_tstrdup(ai->targv[1]);
+ return mir_wstrdup(ai->targv[1]);
size_t bi, ei;
- for (ei = 0; ei < mir_tstrlen(ai->targv[1]); ei++) {
+ for (ei = 0; ei < mir_wstrlen(ai->targv[1]); ei++) {
if (ai->targv[1][ei] == '\\')
depth--;
if (!depth)
break;
}
- if (ei >= mir_tstrlen(ai->targv[1]))
+ if (ei >= mir_wstrlen(ai->targv[1]))
return ai->targv[1];
for (bi = ei - 1; bi > 0; bi--)
@@ -203,7 +203,7 @@ static wchar_t *parseDirectory2(ARGUMENTSINFO *ai) if (depth <= 0)
return NULL;
- wchar_t *ecur = ai->targv[1] + mir_tstrlen(ai->targv[1]);
+ wchar_t *ecur = ai->targv[1] + mir_wstrlen(ai->targv[1]);
while (depth > 0) {
while ((*ecur != '\\') && (ecur > ai->targv[1]))
ecur--;
@@ -226,17 +226,17 @@ static int getTime(wchar_t *szTime, struct tm *date) {
// do some extra checks here
wchar_t *cur = szTime;
- if (cur >= szTime + mir_tstrlen(szTime))
+ if (cur >= szTime + mir_wstrlen(szTime))
return -1;
date->tm_mon = wcstoul(cur, &cur, 10) - 1;
cur++;
- if (cur >= szTime + mir_tstrlen(szTime))
+ if (cur >= szTime + mir_wstrlen(szTime))
return -1;
date->tm_mday = wcstoul(cur, &cur, 10);
cur++;
- if (cur >= szTime + mir_tstrlen(szTime))
+ if (cur >= szTime + mir_wstrlen(szTime))
return -1;
date->tm_year = wcstoul(cur, &cur, 10);
@@ -247,17 +247,17 @@ static int getTime(wchar_t *szTime, struct tm *date) date->tm_year = date->tm_year < 38 ? date->tm_year + 100 : date->tm_year;
cur++;
- if (cur >= szTime + mir_tstrlen(szTime))
+ if (cur >= szTime + mir_wstrlen(szTime))
return -1;
date->tm_hour = wcstoul(cur, &cur, 10);
cur++;
- if (cur >= szTime + mir_tstrlen(szTime))
+ if (cur >= szTime + mir_wstrlen(szTime))
return -1;
date->tm_min = wcstoul(cur, &cur, 10);
cur++;
- if (cur >= szTime + mir_tstrlen(szTime))
+ if (cur >= szTime + mir_wstrlen(szTime))
return -1;
date->tm_sec = wcstoul(cur, &cur, 10);
@@ -282,9 +282,9 @@ static wchar_t *parseDiffTime(ARGUMENTSINFO *ai) return NULL;
diff = difftime(mktime(&t1), mktime(&t0));
- mir_sntprintf(szTime, L"%.0f", diff);
+ mir_snwprintf(szTime, L"%.0f", diff);
- return mir_tstrdup(szTime);
+ return mir_wstrdup(szTime);
}
static wchar_t *parseDirExists(ARGUMENTSINFO *ai)
@@ -298,7 +298,7 @@ static wchar_t *parseDirExists(ARGUMENTSINFO *ai) else
CloseHandle(hFile);
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseEnvironmentVariable(ARGUMENTSINFO *ai)
@@ -333,7 +333,7 @@ static wchar_t *parseFileExists(ARGUMENTSINFO *ai) else
CloseHandle(hFile);
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseFindWindow(ARGUMENTSINFO *ai)
@@ -386,11 +386,11 @@ static wchar_t *parseListDir(ARGUMENTSINFO *ai) if (*ai->targv[4] == 'd')
bFiles = FALSE;
}
- if (tszFirst[mir_tstrlen(tszFirst) - 1] == '\\')
- mir_tstrncat(tszFirst, tszFilter, _countof(tszFirst) - mir_tstrlen(tszFirst) - 1);
+ if (tszFirst[mir_wstrlen(tszFirst) - 1] == '\\')
+ mir_wstrncat(tszFirst, tszFilter, _countof(tszFirst) - mir_wstrlen(tszFirst) - 1);
else {
- mir_tstrncat(tszFirst, L"\\", _countof(tszFirst) - mir_tstrlen(tszFirst) - 1);
- mir_tstrncat(tszFirst, tszFilter, _countof(tszFirst) - mir_tstrlen(tszFirst) - 1);
+ mir_wstrncat(tszFirst, L"\\", _countof(tszFirst) - mir_wstrlen(tszFirst) - 1);
+ mir_wstrncat(tszFirst, tszFilter, _countof(tszFirst) - mir_wstrlen(tszFirst) - 1);
}
WIN32_FIND_DATA ffd;
@@ -399,20 +399,20 @@ static wchar_t *parseListDir(ARGUMENTSINFO *ai) return NULL;
}
if (((ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) && (bDirs)) || ((!(ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)) && (bFiles))) {
- tszRes = (wchar_t*)mir_alloc((mir_tstrlen(ffd.cFileName) + mir_tstrlen(tszSeperator) + 1)*sizeof(wchar_t));
- mir_tstrcpy(tszRes, ffd.cFileName);
+ tszRes = (wchar_t*)mir_alloc((mir_wstrlen(ffd.cFileName) + mir_wstrlen(tszSeperator) + 1)*sizeof(wchar_t));
+ mir_wstrcpy(tszRes, ffd.cFileName);
}
while (FindNextFile(hFind, &ffd) != 0) {
if (((ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) && (bDirs)) || ((!(ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)) && (bFiles))) {
if (tszRes != NULL) {
- mir_tstrcat(tszRes, tszSeperator);
- tszRes = (wchar_t*)mir_realloc(tszRes, (mir_tstrlen(tszRes) + mir_tstrlen(ffd.cFileName) + mir_tstrlen(tszSeperator) + 1)*sizeof(wchar_t));
+ mir_wstrcat(tszRes, tszSeperator);
+ tszRes = (wchar_t*)mir_realloc(tszRes, (mir_wstrlen(tszRes) + mir_wstrlen(ffd.cFileName) + mir_wstrlen(tszSeperator) + 1)*sizeof(wchar_t));
}
else {
- tszRes = (wchar_t*)mir_alloc((mir_tstrlen(ffd.cFileName) + mir_tstrlen(tszSeperator) + 1)*sizeof(wchar_t));
- mir_tstrcpy(tszRes, L"");
+ tszRes = (wchar_t*)mir_alloc((mir_wstrlen(ffd.cFileName) + mir_wstrlen(tszSeperator) + 1)*sizeof(wchar_t));
+ mir_wstrcpy(tszRes, L"");
}
- mir_tstrcat(tszRes, ffd.cFileName);
+ mir_wstrcat(tszRes, ffd.cFileName);
}
}
FindClose(hFind);
@@ -443,7 +443,7 @@ static wchar_t *parseProcessRunning(ARGUMENTSINFO *ai) ai->flags |= AIF_FALSE;
mir_free(ref);
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
#endif
@@ -454,7 +454,7 @@ static wchar_t *parseRegistryValue(ARGUMENTSINFO *ai) DWORD len, type;
- wchar_t *key = mir_tstrdup(ai->targv[1]);
+ wchar_t *key = mir_wstrdup(ai->targv[1]);
if (key == NULL)
return NULL;
@@ -466,13 +466,13 @@ static wchar_t *parseRegistryValue(ARGUMENTSINFO *ai) *cur = 0;
HKEY hKey;
- if (!mir_tstrcmp(key, L"HKEY_CLASSES_ROOT"))
+ if (!mir_wstrcmp(key, L"HKEY_CLASSES_ROOT"))
hKey = HKEY_CLASSES_ROOT;
- else if (!mir_tstrcmp(key, L"HKEY_CURRENT_USER"))
+ else if (!mir_wstrcmp(key, L"HKEY_CURRENT_USER"))
hKey = HKEY_CURRENT_USER;
- else if (!mir_tstrcmp(key, L"HKEY_LOCAL_MACHINE"))
+ else if (!mir_wstrcmp(key, L"HKEY_LOCAL_MACHINE"))
hKey = HKEY_LOCAL_MACHINE;
- else if (!mir_tstrcmp(key, L"HKEY_USERS"))
+ else if (!mir_wstrcmp(key, L"HKEY_USERS"))
hKey = HKEY_USERS;
else {
mir_free(key);
@@ -530,7 +530,7 @@ static wchar_t *parseTimestamp2Date(ARGUMENTSINFO *ai) if (timestamp == 0)
return NULL;
- if ((ai->argc == 2) || ((ai->argc > 2) && (mir_tstrlen(ai->targv[2]) == 0)))
+ if ((ai->argc == 2) || ((ai->argc > 2) && (mir_wstrlen(ai->targv[2]) == 0)))
szFormat = NULL;
else
szFormat = ai->targv[2];
@@ -562,7 +562,7 @@ static wchar_t *parseTimestamp2Time(ARGUMENTSINFO *ai) return NULL;
wchar_t *szFormat;
- if ((ai->argc == 2) || ((ai->argc > 2) && (mir_tstrlen(ai->targv[2]) == 0)))
+ if ((ai->argc == 2) || ((ai->argc > 2) && (mir_wstrlen(ai->targv[2]) == 0)))
szFormat = NULL;
else
szFormat = ai->targv[2];
@@ -634,7 +634,7 @@ static wchar_t *parseTextFile(ARGUMENTSINFO *ai) if (tUC)
res = (wchar_t*)pBuf;
else {
- res = mir_a2t((char *)pBuf);
+ res = mir_a2u((char *)pBuf);
mir_free(pBuf);
}
@@ -749,7 +749,7 @@ static wchar_t *parseTextFile(ARGUMENTSINFO *ai) if (tUC)
res = (wchar_t*)pBuf;
else {
- res = mir_a2t((char *)pBuf);
+ res = mir_a2u((char *)pBuf);
mir_free(pBuf);
}
@@ -763,7 +763,7 @@ static wchar_t *parseTextFile(ARGUMENTSINFO *ai) res = (wchar_t*)pBuf;
}
else {
- res = mir_a2t((char *)pBuf);
+ res = mir_a2u((char *)pBuf);
mir_free(pBuf);
}
@@ -819,10 +819,10 @@ static wchar_t *parseUpTime(ARGUMENTSINFO *ai) }
wchar_t szVal[32];
- mir_sntprintf(szVal, L"%u", cValue.largeValue);
+ mir_snwprintf(szVal, L"%u", cValue.largeValue);
PdhRemoveCounter(hCounter);
PdhCloseQuery(hQuery);
- return mir_tstrdup(szVal);
+ return mir_wstrdup(szVal);
}
static wchar_t *parseUserName(ARGUMENTSINFO *ai)
@@ -859,9 +859,9 @@ static wchar_t *parseClipboard(ARGUMENTSINFO *ai) HANDLE hData = GetClipboardData(CF_UNICODETEXT);
if (hData != NULL) {
wchar_t *tszText = (wchar_t*)GlobalLock(hData);
- size_t len = mir_tstrlen(tszText);
+ size_t len = mir_wstrlen(tszText);
res = (wchar_t*)mir_alloc((len + 1) * sizeof(wchar_t));
- mir_tstrcpy(res, tszText);
+ mir_wstrcpy(res, tszText);
res[len] = 0;
GlobalUnlock(hData);
}
diff --git a/plugins/Variables/src/parse_variables.cpp b/plugins/Variables/src/parse_variables.cpp index c54bbf6dce..11d168e678 100644 --- a/plugins/Variables/src/parse_variables.cpp +++ b/plugins/Variables/src/parse_variables.cpp @@ -26,14 +26,14 @@ static int vrCount = 0; static int addToVariablesRegister(wchar_t *szName, wchar_t *szText)
{
- if ((szName == NULL) || (szText == NULL) || (mir_tstrlen(szName) <= 0))
+ if ((szName == NULL) || (szText == NULL) || (mir_wstrlen(szName) <= 0))
return -1;
mir_cslock lck(csVarRegister);
for (int i = 0; i < vrCount; i++) {
- if ((!mir_tstrcmp(vr[i].szName, szName))) {
+ if ((!mir_wstrcmp(vr[i].szName, szName))) {
mir_free(vr[i].szText);
- vr[i].szText = mir_tstrdup(szText);
+ vr[i].szText = mir_wstrdup(szText);
return 0;
}
}
@@ -42,21 +42,21 @@ static int addToVariablesRegister(wchar_t *szName, wchar_t *szText) return -1;
vr = pvr;
- vr[vrCount].szName = mir_tstrdup(szName);
- vr[vrCount].szText = mir_tstrdup(szText);
+ vr[vrCount].szName = mir_wstrdup(szName);
+ vr[vrCount].szText = mir_wstrdup(szText);
vr[vrCount++].dwOwnerThread = GetCurrentThreadId();
return 0;
}
static wchar_t *searchVariableRegister(wchar_t *szName)
{
- if ((szName == NULL) || (mir_tstrlen(szName) <= 0))
+ if ((szName == NULL) || (mir_wstrlen(szName) <= 0))
return NULL;
mir_cslock lck(csVarRegister);
for (int i = 0; i < vrCount; i++)
- if ((!mir_tstrcmp(vr[i].szName, szName)))
- return mir_tstrdup(vr[i].szText);
+ if ((!mir_wstrcmp(vr[i].szName, szName)))
+ return mir_wstrdup(vr[i].szText);
return NULL;
}
@@ -85,7 +85,7 @@ static wchar_t *parsePuts(ARGUMENTSINFO *ai) if (addToVariablesRegister(ai->targv[1], ai->targv[2]))
return NULL;
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseGet(ARGUMENTSINFO *ai)
diff --git a/plugins/Variables/src/tokenregister.cpp b/plugins/Variables/src/tokenregister.cpp index 101d8024f1..158a429582 100644 --- a/plugins/Variables/src/tokenregister.cpp +++ b/plugins/Variables/src/tokenregister.cpp @@ -41,7 +41,7 @@ unsigned long int hashlittle(void *key, size_t length, unsigned long int initval static DWORD NameHashFunction(wchar_t *tszStr)
{
- return (DWORD)hashlittle(tszStr, mir_tstrlen(tszStr)*sizeof(wchar_t), 0);
+ return (DWORD)hashlittle(tszStr, mir_wstrlen(tszStr)*sizeof(wchar_t), 0);
}
static TokenRegisterEntry* FindTokenRegisterByName(wchar_t *name)
@@ -109,7 +109,7 @@ INT_PTR registerToken(WPARAM, LPARAM lParam) hash = NameHashFunction(newVr->tszTokenString);
}
else {
- WCHAR *wtoken = mir_a2t(newVr->szTokenString);
+ WCHAR *wtoken = mir_a2u(newVr->szTokenString);
deRegisterToken(wtoken);
hash = NameHashFunction(wtoken);
mir_free(wtoken);
@@ -121,16 +121,16 @@ INT_PTR registerToken(WPARAM, LPARAM lParam) memcpy(&tre->tr, newVr, newVr->cbSize);
tre->nameHash = hash;
- if (!mir_tstrcmp(newVr->tszTokenString, L"alias"))
+ if (!mir_wstrcmp(newVr->tszTokenString, L"alias"))
log_debugA("alias");
if (!(newVr->flags & TRF_PARSEFUNC) && newVr->szService != NULL)
tre->tr.szService = mir_strdup(newVr->szService);
if (newVr->flags & TRF_TCHAR)
- tre->tr.tszTokenString = mir_tstrdup(newVr->tszTokenString);
+ tre->tr.tszTokenString = mir_wstrdup(newVr->tszTokenString);
else
- tre->tr.tszTokenString = mir_a2t(newVr->szTokenString);
+ tre->tr.tszTokenString = mir_a2u(newVr->szTokenString);
if (newVr->szHelpText != NULL)
tre->tr.szHelpText = mir_strdup(newVr->szHelpText);
@@ -180,7 +180,7 @@ wchar_t *parseFromRegister(ARGUMENTSINFO *ai) memcpy(&cAi, ai, sizeof(ARGUMENTSINFO));
cAi.argv = (char**)mir_alloc(ai->argc*sizeof(char *));
for (unsigned j = 0; j < ai->argc; j++)
- cAi.argv[j] = mir_t2a(ai->targv[j]);
+ cAi.argv[j] = mir_u2a(ai->targv[j]);
if (thisVr->flags & TRF_PARSEFUNC)
callRes = (INT_PTR)thisVr->parseFunction(&cAi);
@@ -191,7 +191,7 @@ wchar_t *parseFromRegister(ARGUMENTSINFO *ai) mir_free(cAi.argv[j]);
if ((char *)callRes != NULL)
- res = mir_a2t((char*)callRes);
+ res = mir_a2u((char*)callRes);
}
else {
// unicode variables calls unicode plugin
@@ -201,7 +201,7 @@ wchar_t *parseFromRegister(ARGUMENTSINFO *ai) callRes = CallService(thisVr->szService, 0, (LPARAM)ai);
if ((wchar_t*)callRes != NULL)
- res = mir_tstrdup((wchar_t*)callRes);
+ res = mir_wstrdup((wchar_t*)callRes);
}
if (callRes != NULL) {
diff --git a/plugins/Variables/src/variables.cpp b/plugins/Variables/src/variables.cpp index 2b2e13af0f..ace282aac9 100644 --- a/plugins/Variables/src/variables.cpp +++ b/plugins/Variables/src/variables.cpp @@ -76,9 +76,9 @@ wchar_t* getArguments(wchar_t *string, TArgList &argv) if (bNewArg) { wchar_t *tszArg = NULL; if (cur > scur) - tszArg = mir_tstrndup(scur + 1, cur - (scur + 1)); + tszArg = mir_wstrndup(scur + 1, cur - (scur + 1)); if (tszArg == NULL) - tszArg = mir_tstrdup(L""); + tszArg = mir_wstrdup(L""); argv.insert(tszArg); bNewArg = false; @@ -118,7 +118,7 @@ static wchar_t* replaceDynVars(FORMATINFO *fi) int i, scurPos, curPos, tmpVarPos; - wchar_t *string = mir_tstrdup(fi->tszFormat); + wchar_t *string = mir_wstrdup(fi->tszFormat); if (string == NULL) return NULL; @@ -127,31 +127,31 @@ static wchar_t* replaceDynVars(FORMATINFO *fi) FORMATINFO afi; memcpy(&afi, fi, sizeof(afi)); - for (size_t pos = 0; pos < mir_tstrlen(string); pos++) { + for (size_t pos = 0; pos < mir_wstrlen(string); pos++) { // string may move in memory, iterate by remembering the position in the string wchar_t *cur = string + pos; // new round if (*cur == DONTPARSE_CHAR) { - memmove(cur, cur + 1, (mir_tstrlen(cur + 1) + 1)*sizeof(wchar_t)); + memmove(cur, cur + 1, (mir_wstrlen(cur + 1) + 1)*sizeof(wchar_t)); if (*cur == DONTPARSE_CHAR) continue; while ((*cur != DONTPARSE_CHAR) && (*cur != 0)) cur++; - memmove(cur, cur + 1, (mir_tstrlen(cur + 1) + 1)*sizeof(wchar_t)); + memmove(cur, cur + 1, (mir_wstrlen(cur + 1) + 1)*sizeof(wchar_t)); pos = cur - string - 1; continue; } // remove end of lines else if ((!wcsncmp(cur, L"\r\n", 2)) && (gParseOpts.bStripEOL)) { - memmove(cur, cur + 2, (mir_tstrlen(cur + 2) + 1)*sizeof(wchar_t)); + memmove(cur, cur + 2, (mir_wstrlen(cur + 2) + 1)*sizeof(wchar_t)); pos = cur - string - 1; continue; } else if ((*cur == '\n' && gParseOpts.bStripEOL) || (*cur == ' ' && gParseOpts.bStripWS)) { - memmove(cur, cur + 1, (mir_tstrlen(cur + 1) + 1)*sizeof(wchar_t)); + memmove(cur, cur + 1, (mir_wstrlen(cur + 1) + 1)*sizeof(wchar_t)); pos = cur - string - 1; continue; } @@ -163,16 +163,16 @@ static wchar_t* replaceDynVars(FORMATINFO *fi) if (*cur == 0) { *scur = 0; - string = (wchar_t*)mir_realloc(string, (mir_tstrlen(string) + 1)*sizeof(wchar_t)); + string = (wchar_t*)mir_realloc(string, (mir_wstrlen(string) + 1)*sizeof(wchar_t)); continue; } - memmove(scur, cur, (mir_tstrlen(cur) + 1)*sizeof(wchar_t)); + memmove(scur, cur, (mir_wstrlen(cur) + 1)*sizeof(wchar_t)); pos = scur - string - 1; continue; } else if ((*cur != FIELD_CHAR) && (*cur != FUNC_CHAR) && (*cur != FUNC_ONCE_CHAR)) { if (gParseOpts.bStripAll) { - memmove(cur, cur + 1, (mir_tstrlen(cur + 1) + 1)*sizeof(wchar_t)); + memmove(cur, cur + 1, (mir_wstrlen(cur + 1) + 1)*sizeof(wchar_t)); pos = cur - string - 1; } continue; @@ -189,13 +189,13 @@ static wchar_t* replaceDynVars(FORMATINFO *fi) TOKENREGISTEREX *tr = NULL; { - ptrT token(mir_tstrndup(cur + 1, tcur - scur)); + ptrW token(mir_wstrndup(cur + 1, tcur - scur)); // cur points to FIELD_CHAR or FUNC_CHAR tmpVarPos = -1; if (*cur == FIELD_CHAR) { for (i = 0; i < fi->cbTemporaryVarsSize; i += 2) { - if (!mir_tstrcmp(fi->tszaTemporaryVars[i], token)) { + if (!mir_wstrcmp(fi->tszaTemporaryVars[i], token)) { tmpVarPos = i; break; } @@ -214,7 +214,7 @@ static wchar_t* replaceDynVars(FORMATINFO *fi) scur = cur; // store this pointer for later use if (*cur == FIELD_CHAR) { - size_t len = mir_tstrlen(tr != NULL ? tr->tszTokenString : fi->tszaTemporaryVars[tmpVarPos]); + size_t len = mir_wstrlen(tr != NULL ? tr->tszTokenString : fi->tszaTemporaryVars[tmpVarPos]); cur++; if (cur[len] != FIELD_CHAR) { // the next char after the token should be % fi->eCount++; @@ -223,7 +223,7 @@ static wchar_t* replaceDynVars(FORMATINFO *fi) cur += len + 1; } else if ((*cur == FUNC_CHAR) || (*cur == FUNC_ONCE_CHAR)) { - cur += mir_tstrlen(tr->tszTokenString) + 1; + cur += mir_wstrlen(tr->tszTokenString) + 1; wchar_t *argcur = getArguments(cur, argv); if (argcur == cur || argcur == NULL) { fi->eCount++; @@ -247,9 +247,9 @@ static wchar_t* replaceDynVars(FORMATINFO *fi) // cur should now point at the character after FIELD_CHAR or after the last ')' ARGUMENTSINFO ai = { 0 }; - ptrT parsedToken; + ptrW parsedToken; if (tr != NULL) { - argv.insert(mir_tstrdup(tr->tszTokenString), 0); + argv.insert(mir_wstrdup(tr->tszTokenString), 0); ai.cbSize = sizeof(ai); ai.argc = argv.getCount(); @@ -260,7 +260,7 @@ static wchar_t* replaceDynVars(FORMATINFO *fi) parsedToken = parseFromRegister(&ai); } - else parsedToken = mir_tstrdup(fi->tszaTemporaryVars[tmpVarPos + 1]); + else parsedToken = mir_wstrdup(fi->tszaTemporaryVars[tmpVarPos + 1]); argv.destroy(); @@ -275,8 +275,8 @@ static wchar_t* replaceDynVars(FORMATINFO *fi) else fi->pCount++; - size_t parsedTokenLen = mir_tstrlen(parsedToken); - size_t initStrLen = mir_tstrlen(string); + size_t parsedTokenLen = mir_wstrlen(parsedToken); + size_t initStrLen = mir_wstrlen(string); size_t tokenLen = cur - scur; scurPos = scur - string; curPos = cur - string; @@ -290,10 +290,10 @@ static wchar_t* replaceDynVars(FORMATINFO *fi) } scur = string + scurPos; cur = string + curPos; - memmove(scur + parsedTokenLen, cur, (mir_tstrlen(cur) + 1)*sizeof(wchar_t)); + memmove(scur + parsedTokenLen, cur, (mir_wstrlen(cur) + 1)*sizeof(wchar_t)); memcpy(scur, parsedToken, parsedTokenLen*sizeof(wchar_t)); { - size_t len = mir_tstrlen(string); + size_t len = mir_wstrlen(string); string = (wchar_t*)mir_realloc(string, (len + 1)*sizeof(wchar_t)); } if ((ai.flags & AIF_DONTPARSE) || tmpVarPos >= 0) @@ -302,7 +302,7 @@ static wchar_t* replaceDynVars(FORMATINFO *fi) pos--; // parse the same pos again, it changed } - return (wchar_t*)mir_realloc(string, (mir_tstrlen(string) + 1)*sizeof(wchar_t)); + return (wchar_t*)mir_realloc(string, (mir_wstrlen(string) + 1)*sizeof(wchar_t)); } /* @@ -341,11 +341,11 @@ static INT_PTR formatStringService(WPARAM wParam, LPARAM) if (!(fi->flags & FIF_TCHAR)) { copied = TRUE; - log_debugA("mir_a2t (%s)", fi->szExtraText); - tszFormat = fi->szFormat != NULL ? mir_a2t(fi->szFormat) : NULL; - tszSource = fi->szExtraText != NULL ? mir_a2t(fi->szExtraText) : NULL; + log_debugA("mir_a2u (%s)", fi->szExtraText); + tszFormat = fi->szFormat != NULL ? mir_a2u(fi->szFormat) : NULL; + tszSource = fi->szExtraText != NULL ? mir_a2u(fi->szExtraText) : NULL; for (i = 0; i < fi->cbTemporaryVarsSize; i++) { - fi->tszaTemporaryVars[i] = fi->szaTemporaryVars[i] != NULL ? mir_a2t(fi->szaTemporaryVars[i]) : NULL; + fi->tszaTemporaryVars[i] = fi->szaTemporaryVars[i] != NULL ? mir_a2u(fi->szaTemporaryVars[i]) : NULL; } } else { diff --git a/plugins/Watrack_MPD/src/main.cpp b/plugins/Watrack_MPD/src/main.cpp index 079718a0f9..a4ca0c1943 100755 --- a/plugins/Watrack_MPD/src/main.cpp +++ b/plugins/Watrack_MPD/src/main.cpp @@ -75,7 +75,7 @@ int Parser() if(!Connected) { char tmp[128]; - char *tmp2 = mir_t2a(gbPassword); + char *tmp2 = mir_u2a(gbPassword); recvResult = CallService(MS_NETLIB_GETMOREPACKETS,(WPARAM)ghPacketReciever, (LPARAM)&nlpr); if(recvResult == SOCKET_ERROR) { @@ -124,20 +124,20 @@ int Parser() tmp[i] = ptr[i]; tmp[i] = '\0'; strncpy_s(ver, tmp, _TRUNCATE); - SongInfo.txtver = mir_utf8decodeT(tmp); + SongInfo.txtver = mir_utf8decodeW(tmp); } else - SongInfo.txtver = mir_utf8decodeT(ver); + SongInfo.txtver = mir_utf8decodeW(ver); if(ptr = strstr(buf, "file:")) { ptr = &ptr[6]; for(i = 0; ((ptr[i] != '\n') && (ptr[i] != '\0')); i++) tmp[i] = ptr[i]; tmp[i] = '\0'; - SongInfo.mfile = mir_utf8decodeT(tmp); + SongInfo.mfile = mir_utf8decodeW(tmp); } else - SongInfo.mfile = mir_tstrdup(L""); + SongInfo.mfile = mir_wstrdup(L""); if(ptr = strstr(buf, "Time:")) { ptr = &ptr[6]; @@ -164,50 +164,50 @@ int Parser() for(i = 0; ((ptr[i] != '\n') && (ptr[i] != '\0')); i++) tmp[i] = ptr[i]; tmp[i] = '\0'; - SongInfo.title = mir_utf8decodeT(tmp); + SongInfo.title = mir_utf8decodeW(tmp); } else - SongInfo.title = mir_tstrdup(L"Unknown track"); + SongInfo.title = mir_wstrdup(L"Unknown track"); if(ptr = strstr(buf, "Artist:")) { ptr = &ptr[8]; for(i = 0; ((ptr[i] != '\n') && (ptr[i] != '\0')); i++) tmp[i] = ptr[i]; tmp[i] = '\0'; - SongInfo.artist = mir_utf8decodeT(tmp); + SongInfo.artist = mir_utf8decodeW(tmp); } else - SongInfo.artist = mir_tstrdup(L"Unknown artist"); + SongInfo.artist = mir_wstrdup(L"Unknown artist"); if(ptr = strstr(buf, "Genre:")) { ptr = &ptr[7]; for(i = 0; ((ptr[i] != '\n') && (ptr[i] != '\0')); i++) tmp[i] = ptr[i]; tmp[i] = '\0'; - SongInfo.genre = mir_utf8decodeT(tmp); + SongInfo.genre = mir_utf8decodeW(tmp); } else - SongInfo.genre = mir_tstrdup(L"Unknown genre"); + SongInfo.genre = mir_wstrdup(L"Unknown genre"); if(ptr = strstr(buf, "Album:")) { ptr = &ptr[7]; for(i = 0; ((ptr[i] != '\n') && (ptr[i] != '\0')); i++) tmp[i] = ptr[i]; tmp[i] = '\0'; - SongInfo.album = mir_utf8decodeT(tmp); + SongInfo.album = mir_utf8decodeW(tmp); } else - SongInfo.album = mir_tstrdup(L"Unknown album"); + SongInfo.album = mir_wstrdup(L"Unknown album"); if(ptr = strstr(buf, "Date:")) { ptr = &ptr[6]; for(i = 0; ((ptr[i] != '\n') && (ptr[i] != '\0')); i++) tmp[i] = ptr[i]; tmp[i] = '\0'; - SongInfo.year = mir_utf8decodeT(tmp); + SongInfo.year = mir_utf8decodeW(tmp); } else - SongInfo.year = mir_tstrdup(L"Unknown year"); + SongInfo.year = mir_wstrdup(L"Unknown year"); if(ptr = strstr(buf, "volume:")) { ptr = &ptr[8]; diff --git a/plugins/Watrack_MPD/src/options.cpp b/plugins/Watrack_MPD/src/options.cpp index 315c2f4100..3178947f61 100755 --- a/plugins/Watrack_MPD/src/options.cpp +++ b/plugins/Watrack_MPD/src/options.cpp @@ -52,10 +52,10 @@ static INT_PTR CALLBACK DlgProcWaMpdOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM gbPort = (WORD)GetDlgItemInt(hwndDlg, IDC_PORT, NULL, FALSE); GetDlgItemText(hwndDlg, IDC_SERVER, szText, _countof(szText)); db_set_ts(NULL, szModuleName, "Server", szText); - mir_tstrcpy(gbHost, szText); + mir_wstrcpy(gbHost, szText); GetDlgItemText(hwndDlg, IDC_PASSWORD, szText, _countof(szText)); db_set_ts(NULL, szModuleName, "Password", szText); - mir_tstrcpy(gbPassword, szText); + mir_wstrcpy(gbPassword, szText); return TRUE; } } diff --git a/plugins/Watrack_MPD/src/utilities.cpp b/plugins/Watrack_MPD/src/utilities.cpp index edaf3f42bd..c3e9e40cc8 100755 --- a/plugins/Watrack_MPD/src/utilities.cpp +++ b/plugins/Watrack_MPD/src/utilities.cpp @@ -20,5 +20,5 @@ wchar_t* __stdcall UniGetContactSettingUtf(MCONTACT hContact, const char *szModule,const char* szSetting, wchar_t* szDef) { wchar_t *szRes = db_get_tsa(hContact, szModule, szSetting); - return szRes ? szRes : mir_tstrdup(szDef); + return szRes ? szRes : mir_wstrdup(szDef); } diff --git a/plugins/Weather/src/weather.cpp b/plugins/Weather/src/weather.cpp index bb0e86e011..c1c2f26f67 100644 --- a/plugins/Weather/src/weather.cpp +++ b/plugins/Weather/src/weather.cpp @@ -231,7 +231,7 @@ extern "C" int __declspec(dllexport) Load(void) // window needed for popup commands
wchar_t SvcFunc[100];
- mir_sntprintf(SvcFunc, L"%s__PopupWindow", _A2W(WEATHERPROTONAME));
+ mir_snwprintf(SvcFunc, L"%s__PopupWindow", _A2W(WEATHERPROTONAME));
hPopupWindow = CreateWindowEx(WS_EX_TOOLWINDOW, L"static", SvcFunc, 0, CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, hInst, NULL);
SetWindowLongPtr(hPopupWindow, GWLP_WNDPROC, (LONG_PTR)PopupWndProc);
diff --git a/plugins/Weather/src/weather_addstn.cpp b/plugins/Weather/src/weather_addstn.cpp index bf999c9dea..c9a276a484 100644 --- a/plugins/Weather/src/weather_addstn.cpp +++ b/plugins/Weather/src/weather_addstn.cpp @@ -45,7 +45,7 @@ INT_PTR WeatherAddToList(WPARAM, LPARAM lParam) DBVARIANT dbv;
// check ID to see if the contact already exist in the database
if (!db_get_ts(hContact, WEATHERPROTONAME, "ID", &dbv)) {
- if (!mir_tstrcmpi(psr->email.w, dbv.ptszVal)) {
+ if (!mir_wstrcmpi(psr->email.w, dbv.ptszVal)) {
// remove the flag for not on list and hidden, thus make the contact visible
// and add them on the list
if (db_get_b(hContact, "CList", "NotOnList", 1)) {
@@ -90,7 +90,7 @@ INT_PTR WeatherAddToList(WPARAM, LPARAM lParam) AvatarDownloaded(hContact);
wchar_t str[256];
- mir_sntprintf(str, TranslateT("Current weather information for %s."), psr->nick.w);
+ mir_snwprintf(str, TranslateT("Current weather information for %s."), psr->nick.w);
db_set_ts(hContact, WEATHERPROTONAME, "About", str);
// make the last update tags to something invalid
@@ -109,7 +109,7 @@ INT_PTR WeatherAddToList(WPARAM, LPARAM lParam) opt.DefStn = hContact;
if (!db_get_ts(hContact, WEATHERPROTONAME, "Nick", &dbv)) {
// notification message box
- mir_sntprintf(str, TranslateT("%s is now the default weather station"), dbv.ptszVal);
+ mir_snwprintf(str, TranslateT("%s is now the default weather station"), dbv.ptszVal);
db_free(&dbv);
MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
}
@@ -251,7 +251,7 @@ int IDSearchProc(wchar_t *sID, const int searchId, WIIDSEARCH *sData, wchar_t *s // give no station name but only ID if the search is unavailable
else wcsncpy(str, TranslateT("<Enter station name here>"), MAX_DATA_LEN - 1);
- mir_sntprintf(newID, L"%s/%s", svc, sID);
+ mir_snwprintf(newID, L"%s/%s", svc, sID);
// set the search result and broadcast it
PROTOSEARCHRESULT psr = { sizeof(psr) };
@@ -272,7 +272,7 @@ int IDSearchProc(wchar_t *sID, const int searchId, WIIDSEARCH *sData, wchar_t *s int IDSearch(wchar_t *sID, const int searchId)
{
// for a normal ID search (ID != #)
- if (mir_tstrcmp(sID, L"#")) {
+ if (mir_wstrcmp(sID, L"#")) {
WIDATALIST *Item = WIHead;
// search every weather service using the search station ID
@@ -322,16 +322,16 @@ int NameSearchProc(wchar_t *name, const int searchId, WINAMESEARCH *sData, wchar // for single result
if (sData->Single.Available && (search != NULL || !sData->Multiple.Available)) { // single result
// if station ID appears first in the downloaded data
- if (!mir_tstrcmpi(sData->Single.First, L"ID")) {
+ if (!mir_wstrcmpi(sData->Single.First, L"ID")) {
GetDataValue(&sData->Single.ID, str, &szInfo);
- mir_sntprintf(sID, L"%s/%s", svc, str);
+ mir_snwprintf(sID, L"%s/%s", svc, str);
GetDataValue(&sData->Single.Name, Name, &szInfo);
}
// if station name appears first in the downloaded data
- else if (!mir_tstrcmpi(sData->Single.First, L"NAME")) {
+ else if (!mir_wstrcmpi(sData->Single.First, L"NAME")) {
GetDataValue(&sData->Single.Name, Name, &szInfo);
GetDataValue(&sData->Single.ID, str, &szInfo);
- mir_sntprintf(sID, L"%s/%s", svc, str);
+ mir_snwprintf(sID, L"%s/%s", svc, str);
}
else
str[0] = 0;
@@ -363,16 +363,16 @@ int NameSearchProc(wchar_t *name, const int searchId, WINAMESEARCH *sData, wchar // search for the next occurrence of the string
while (true) {
// if station ID appears first in the downloaded data
- if (!mir_tstrcmpi(sData->Multiple.First, L"ID")) {
+ if (!mir_wstrcmpi(sData->Multiple.First, L"ID")) {
GetDataValue(&sData->Multiple.ID, str, &szInfo);
- mir_sntprintf(sID, L"%s/%s", svc, str);
+ mir_snwprintf(sID, L"%s/%s", svc, str);
GetDataValue(&sData->Multiple.Name, Name, &szInfo);
}
// if station name appears first in the downloaded data
- else if (!mir_tstrcmpi(sData->Multiple.First, L"NAME")) {
+ else if (!mir_wstrcmpi(sData->Multiple.First, L"NAME")) {
GetDataValue(&sData->Multiple.Name, Name, &szInfo);
GetDataValue(&sData->Multiple.ID, str, &szInfo);
- mir_sntprintf(sID, L"%s/%s", svc, str);
+ mir_snwprintf(sID, L"%s/%s", svc, str);
}
else
break;
diff --git a/plugins/Weather/src/weather_contacts.cpp b/plugins/Weather/src/weather_contacts.cpp index 77ecbb11cd..80e7d5f970 100644 --- a/plugins/Weather/src/weather_contacts.cpp +++ b/plugins/Weather/src/weather_contacts.cpp @@ -29,7 +29,7 @@ static void OpenUrl(wchar_t* format, wchar_t* id) {
wchar_t loc[512];
GetID(id);
- mir_sntprintf(loc, format, id);
+ mir_snwprintf(loc, format, id);
Utils_OpenUrlT(loc);
}
@@ -161,7 +161,7 @@ static INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPA if (!db_get_ts(hContact, WEATHERPROTONAME, "ID", &dbv)) {
SetDlgItemText(hwndDlg, IDC_ID, dbv.ptszVal);
// check if the station is a default station
- CheckDlgButton(hwndDlg, IDC_DEFA, mir_tstrcmp(dbv.ptszVal, opt.Default) != 0 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DEFA, mir_wstrcmp(dbv.ptszVal, opt.Default) != 0 ? BST_CHECKED : BST_UNCHECKED);
db_free(&dbv);
}
if (!db_get_ts(hContact, WEATHERPROTONAME, "Nick", &dbv)) {
@@ -272,15 +272,15 @@ static INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPA ofn.nMaxFile = _countof(str);
// set filters
wcsncpy(filter, TranslateT("Text Files"), _countof(filter) - 1);
- mir_tstrncat(filter, L" (*.txt)", _countof(filter) - mir_tstrlen(filter));
- pfilter = filter + mir_tstrlen(filter) + 1;
+ mir_wstrncat(filter, L" (*.txt)", _countof(filter) - mir_wstrlen(filter));
+ pfilter = filter + mir_wstrlen(filter) + 1;
wcsncpy(pfilter, L"*.txt", _countof(filter) - 1);
- pfilter = pfilter + mir_tstrlen(pfilter) + 1;
+ pfilter = pfilter + mir_wstrlen(pfilter) + 1;
wcsncpy(pfilter, TranslateT("All Files"), _countof(filter) - 1);
- mir_tstrncat(pfilter, L" (*.*)", _countof(filter) - mir_tstrlen(filter));
- pfilter = pfilter + mir_tstrlen(pfilter) + 1;
+ mir_wstrncat(pfilter, L" (*.*)", _countof(filter) - mir_wstrlen(filter));
+ pfilter = pfilter + mir_wstrlen(pfilter) + 1;
wcsncpy(pfilter, L"*.*", _countof(filter) - 1);
- pfilter = pfilter + mir_tstrlen(pfilter) + 1;
+ pfilter = pfilter + mir_wstrlen(pfilter) + 1;
*pfilter = '\0';
ofn.lpstrFilter = filter;
ofn.nFilterIndex = 1;
@@ -343,13 +343,13 @@ static INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPA GetDlgItemText(hwndDlg, IDC_ID, str, _countof(str));
db_set_ts(hContact, WEATHERPROTONAME, "ID", str);
if ((BYTE)IsDlgButtonChecked(hwndDlg, IDC_DEFA)) { // if default station is set
- mir_tstrcpy(opt.Default, str);
+ mir_wstrcpy(opt.Default, str);
opt.DefStn = hContact;
db_set_ts(NULL, WEATHERPROTONAME, "Default", opt.Default);
}
GetDlgItemText(hwndDlg, IDC_NAME, city, _countof(city));
db_set_ts(hContact, WEATHERPROTONAME, "Nick", city);
- mir_sntprintf(str2, TranslateT("Current weather information for %s."), city);
+ mir_snwprintf(str2, TranslateT("Current weather information for %s."), city);
if ((BYTE)IsDlgButtonChecked(hwndDlg, IDC_External)) {
GetDlgItemText(hwndDlg, IDC_LOG, str, _countof(str));
db_set_ts(hContact, WEATHERPROTONAME, "Log", str);
@@ -436,9 +436,9 @@ int ContactDeleted(WPARAM wParam, LPARAM) removeWindow(wParam);
// exit this function if it is not default station
- ptrT tszID(db_get_tsa(wParam, WEATHERPROTONAME, "ID"));
+ ptrW tszID(db_get_tsa(wParam, WEATHERPROTONAME, "ID"));
if (tszID != NULL)
- if (mir_tstrcmp(tszID, opt.Default))
+ if (mir_wstrcmp(tszID, opt.Default))
return 0;
// now the default station is deleted, try to get a new one
@@ -451,13 +451,13 @@ int ContactDeleted(WPARAM wParam, LPARAM) // if the station is not a default station, set it as the new default station
// this is the first weather station encountered from the search
- if (mir_tstrcmp(opt.Default, tszID)) {
+ if (mir_wstrcmp(opt.Default, tszID)) {
wcsncpy_s(opt.Default, tszID, _TRUNCATE);
opt.DefStn = hContact;
- ptrT tszNick(db_get_tsa(hContact, WEATHERPROTONAME, "Nick"));
+ ptrW tszNick(db_get_tsa(hContact, WEATHERPROTONAME, "Nick"));
if (tszNick != NULL) {
wchar_t str[255];
- mir_sntprintf(str, TranslateT("%s is now the default weather station"), (wchar_t*)tszNick);
+ mir_snwprintf(str, TranslateT("%s is now the default weather station"), (wchar_t*)tszNick);
MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
}
db_set_ts(NULL, WEATHERPROTONAME, "Default", opt.Default);
diff --git a/plugins/Weather/src/weather_conv.cpp b/plugins/Weather/src/weather_conv.cpp index 44805cc451..168fd77d09 100644 --- a/plugins/Weather/src/weather_conv.cpp +++ b/plugins/Weather/src/weather_conv.cpp @@ -64,9 +64,9 @@ static void numToStr(double num, wchar_t *str, size_t strSize) if (i < 0 && (w || r)) w = -w;
if (r)
- mir_sntprintf(str, strSize, L"%i.%i", w, r);
+ mir_snwprintf(str, strSize, L"%i.%i", w, r);
else
- mir_sntprintf(str, strSize, L"%i", w);
+ mir_snwprintf(str, strSize, L"%i", w);
}
//============ UNIT CONVERSIONS ============
@@ -83,15 +83,15 @@ void GetTemp(wchar_t *tempchar, wchar_t *unit, wchar_t* str) TrimString(tempchar);
if (tempchar[0] == '-' && tempchar[1] == ' ')
- memmove(&tempchar[1], &tempchar[2], sizeof(wchar_t)*(mir_tstrlen(&tempchar[2]) + 1));
+ memmove(&tempchar[1], &tempchar[2], sizeof(wchar_t)*(mir_wstrlen(&tempchar[2]) + 1));
// quit if the value obtained is N/A or not a number
- if (!mir_tstrcmp(tempchar, NODATA) || !mir_tstrcmp(tempchar, L"N/A")) {
- mir_tstrcpy(str, tempchar);
+ if (!mir_wstrcmp(tempchar, NODATA) || !mir_wstrcmp(tempchar, L"N/A")) {
+ mir_wstrcpy(str, tempchar);
return;
}
if (!is_number(tempchar)) {
- mir_tstrcpy(str, NODATA);
+ mir_wstrcpy(str, NODATA);
return;
}
@@ -99,8 +99,8 @@ void GetTemp(wchar_t *tempchar, wchar_t *unit, wchar_t* str) temp = _wtof(tempchar);
// convert all to F first
- if (!mir_tstrcmpi(unit, L"C")) temp = (temp * 9 / 5) + 32;
- else if (!mir_tstrcmpi(unit, L"K")) temp = ((temp - 273.15) * 9 / 5) + 32;
+ if (!mir_wstrcmpi(unit, L"C")) temp = (temp * 9 / 5) + 32;
+ else if (!mir_wstrcmpi(unit, L"K")) temp = ((temp - 273.15) * 9 / 5) + 32;
// convert to apporiate unit
switch (opt.tUnit) {
@@ -110,7 +110,7 @@ void GetTemp(wchar_t *tempchar, wchar_t *unit, wchar_t* str) if (opt.DoNotAppendUnit)
wcsncpy_s(str, MAX_DATA_LEN, tstr, _TRUNCATE);
else
- mir_sntprintf(str, MAX_DATA_LEN, L"%s%sC", tstr, opt.DegreeSign);
+ mir_snwprintf(str, MAX_DATA_LEN, L"%s%sC", tstr, opt.DegreeSign);
break;
case 2:
@@ -118,7 +118,7 @@ void GetTemp(wchar_t *tempchar, wchar_t *unit, wchar_t* str) if (opt.DoNotAppendUnit)
wcsncpy_s(str, MAX_DATA_LEN, tstr, _TRUNCATE);
else
- mir_sntprintf(str, MAX_DATA_LEN, L"%s%sF", tstr, opt.DegreeSign);
+ mir_snwprintf(str, MAX_DATA_LEN, L"%s%sF", tstr, opt.DegreeSign);
break;
}
}
@@ -137,44 +137,44 @@ void GetPressure(wchar_t *tempchar, wchar_t *unit, wchar_t* str) // if it end up with 0, then it's not a number, return the original string and quit
output = _wtof(tempchar);
if (output == 0) {
- mir_tstrcpy(str, tempchar);
+ mir_wstrcpy(str, tempchar);
return;
}
// convert all to mb first
- if (!mir_tstrcmpi(unit, L"KPA"))
+ if (!mir_wstrcmpi(unit, L"KPA"))
tempunit = (double)output * 10;
- else if (!mir_tstrcmpi(unit, L"HPA"))
+ else if (!mir_wstrcmpi(unit, L"HPA"))
tempunit = (double)output;
- else if (!mir_tstrcmpi(unit, L"MB"))
+ else if (!mir_wstrcmpi(unit, L"MB"))
tempunit = (double)output;
- else if (!mir_tstrcmpi(unit, L"IN"))
+ else if (!mir_wstrcmpi(unit, L"IN"))
tempunit = (double)output * 33.86388;
- else if (!mir_tstrcmpi(unit, L"MM"))
+ else if (!mir_wstrcmpi(unit, L"MM"))
tempunit = (double)output * 1.33322;
- else if (!mir_tstrcmpi(unit, L"TORR"))
+ else if (!mir_wstrcmpi(unit, L"TORR"))
tempunit = (double)output * 1.33322;
// convert to apporiate unit
switch (opt.pUnit) {
case 1:
intunit = (int)(tempunit + 0.5);
- mir_sntprintf(str, MAX_DATA_LEN, L"%i.%i %s", intunit / 10, intunit % 10, opt.DoNotAppendUnit ? L"" : TranslateT("kPa"));
+ mir_snwprintf(str, MAX_DATA_LEN, L"%i.%i %s", intunit / 10, intunit % 10, opt.DoNotAppendUnit ? L"" : TranslateT("kPa"));
break;
case 2:
intunit = (int)(tempunit + 0.5);
- mir_sntprintf(str, MAX_DATA_LEN, L"%i %s", intunit, opt.DoNotAppendUnit ? L"" : TranslateT("mb"));
+ mir_snwprintf(str, MAX_DATA_LEN, L"%i %s", intunit, opt.DoNotAppendUnit ? L"" : TranslateT("mb"));
break;
case 3:
intunit = (int)((tempunit * 10 / 33.86388) + 0.5);
- mir_sntprintf(str, MAX_DATA_LEN, L"%i.%i %s", intunit / 10, intunit % 10, opt.DoNotAppendUnit ? L"" : TranslateT("in"));
+ mir_snwprintf(str, MAX_DATA_LEN, L"%i.%i %s", intunit / 10, intunit % 10, opt.DoNotAppendUnit ? L"" : TranslateT("in"));
break;
case 4:
intunit = (int)((tempunit * 10 / 1.33322) + 0.5);
- mir_sntprintf(str, MAX_DATA_LEN, L"%i.%i %s", intunit / 10, intunit % 10, opt.DoNotAppendUnit ? L"" : TranslateT("mm"));
+ mir_snwprintf(str, MAX_DATA_LEN, L"%i.%i %s", intunit / 10, intunit % 10, opt.DoNotAppendUnit ? L"" : TranslateT("mm"));
break;
default:
- mir_tstrcpy(str, tempchar);
+ mir_wstrcpy(str, tempchar);
break;
}
@@ -199,32 +199,32 @@ void GetSpeed(wchar_t *tempchar, wchar_t *unit, wchar_t *str) return;
// convert all to m/s first
- if (!mir_tstrcmpi(unit, L"KM/H"))
+ if (!mir_wstrcmpi(unit, L"KM/H"))
tempunit /= 3.6;
- // else if ( !mir_tstrcmpi(unit, L"M/S")
+ // else if ( !mir_wstrcmpi(unit, L"M/S")
// tempunit = tempunit;
- else if (!mir_tstrcmpi(unit, L"MPH"))
+ else if (!mir_wstrcmpi(unit, L"MPH"))
tempunit *= 0.44704;
- else if (!mir_tstrcmpi(unit, L"KNOTS"))
+ else if (!mir_wstrcmpi(unit, L"KNOTS"))
tempunit *= 0.514444;
// convert to apporiate unit
switch (opt.wUnit) {
case 1:
numToStr(tempunit * 3.6, tstr, _countof(tstr));
- mir_sntprintf(str, MAX_DATA_LEN, L"%s %s", tstr, opt.DoNotAppendUnit ? L"" : TranslateT("km/h"));
+ mir_snwprintf(str, MAX_DATA_LEN, L"%s %s", tstr, opt.DoNotAppendUnit ? L"" : TranslateT("km/h"));
break;
case 2:
numToStr(tempunit, tstr, _countof(tstr));
- mir_sntprintf(str, MAX_DATA_LEN, L"%s %s", tstr, opt.DoNotAppendUnit ? L"" : TranslateT("m/s"));
+ mir_snwprintf(str, MAX_DATA_LEN, L"%s %s", tstr, opt.DoNotAppendUnit ? L"" : TranslateT("m/s"));
break;
case 3:
numToStr(tempunit / 0.44704, tstr, _countof(tstr));
- mir_sntprintf(str, MAX_DATA_LEN, L"%s %s", tstr, opt.DoNotAppendUnit ? L"" : TranslateT("mph"));
+ mir_snwprintf(str, MAX_DATA_LEN, L"%s %s", tstr, opt.DoNotAppendUnit ? L"" : TranslateT("mph"));
break;
case 4:
numToStr(tempunit / 0.514444, tstr, _countof(tstr));
- mir_sntprintf(str, MAX_DATA_LEN, L"%s %s", tstr, opt.DoNotAppendUnit ? L"" : TranslateT("knots"));
+ mir_snwprintf(str, MAX_DATA_LEN, L"%s %s", tstr, opt.DoNotAppendUnit ? L"" : TranslateT("knots"));
break;
}
}
@@ -243,28 +243,28 @@ void GetDist(wchar_t *tempchar, wchar_t *unit, wchar_t *str) // if it end up with 0, then it's not a number, return the original string and quit
output = _wtof(tempchar);
if (output == 0) {
- mir_tstrcpy(str, tempchar);
+ mir_wstrcpy(str, tempchar);
return;
}
// convert all to km first
- if (!mir_tstrcmpi(unit, L"KM"))
+ if (!mir_wstrcmpi(unit, L"KM"))
tempunit = (double)output;
- else if (!mir_tstrcmpi(unit, L"MILES"))
+ else if (!mir_wstrcmpi(unit, L"MILES"))
tempunit = (double)output * 1.609;
// convert to apporiate unit
switch (opt.vUnit) {
case 1:
intunit = (int)((tempunit * 10) + 0.5);
- mir_sntprintf(str, MAX_DATA_LEN, L"%i.%i %s", intunit / 10, intunit % 10, opt.DoNotAppendUnit ? L"" : TranslateT("km"));
+ mir_snwprintf(str, MAX_DATA_LEN, L"%i.%i %s", intunit / 10, intunit % 10, opt.DoNotAppendUnit ? L"" : TranslateT("km"));
break;
case 2:
intunit = (int)((tempunit * 10 / 1.609) + 0.5);
- mir_sntprintf(str, MAX_DATA_LEN, L"%i.%i %s", intunit / 10, intunit % 10, opt.DoNotAppendUnit ? L"" : TranslateT("miles"));
+ mir_snwprintf(str, MAX_DATA_LEN, L"%i.%i %s", intunit / 10, intunit % 10, opt.DoNotAppendUnit ? L"" : TranslateT("miles"));
break;
default:
- mir_tstrcpy(str, tempchar);
+ mir_wstrcpy(str, tempchar);
break;
}
}
@@ -283,28 +283,28 @@ void GetElev(wchar_t *tempchar, wchar_t *unit, wchar_t *str) // if it end up with 0, then it's not a number, return the original string and quit
output = _wtof(tempchar);
if (output == 0) {
- mir_tstrcpy(str, tempchar);
+ mir_wstrcpy(str, tempchar);
return;
}
// convert all to m first
- if (!mir_tstrcmpi(unit, L"M"))
+ if (!mir_wstrcmpi(unit, L"M"))
tempunit = (double)output;
- else if (!mir_tstrcmpi(unit, L"FT"))
+ else if (!mir_wstrcmpi(unit, L"FT"))
tempunit = (double)output / 3.28;
// convert to apporiate unit
switch (opt.eUnit) {
case 1:
intunit = (int)((tempunit * 10 * 3.28) + 0.5);
- mir_sntprintf(str, MAX_DATA_LEN, L"%i.%i %s", intunit / 10, intunit % 10, opt.DoNotAppendUnit ? L"" : TranslateT("ft"));
+ mir_snwprintf(str, MAX_DATA_LEN, L"%i.%i %s", intunit / 10, intunit % 10, opt.DoNotAppendUnit ? L"" : TranslateT("ft"));
break;
case 2:
intunit = (int)((tempunit * 10) + 0.5);
- mir_sntprintf(str, MAX_DATA_LEN, L"%i.%i %s", intunit / 10, intunit % 10, opt.DoNotAppendUnit ? L"" : TranslateT("m"));
+ mir_snwprintf(str, MAX_DATA_LEN, L"%i.%i %s", intunit / 10, intunit % 10, opt.DoNotAppendUnit ? L"" : TranslateT("m"));
break;
default:
- mir_tstrcpy(str, tempchar);
+ mir_wstrcpy(str, tempchar);
break;
}
}
@@ -390,13 +390,13 @@ WORD GetIcon(const wchar_t* cond, WIDATA *Data) do {
j++;
// using the format _T("# Weather <condition name> <counter> #"
- mir_sntprintf(LangPackStr, L"# Weather %s %i #", statusStr[i], j);
+ mir_snwprintf(LangPackStr, L"# Weather %s %i #", statusStr[i], j);
wcsncpy_s(LangPackStr1, TranslateTS(LangPackStr), _TRUNCATE);
- CharLowerBuff(LangPackStr1, (DWORD)mir_tstrlen(LangPackStr1));
+ CharLowerBuff(LangPackStr1, (DWORD)mir_wstrlen(LangPackStr1));
if (wcsstr(cond, LangPackStr1) != NULL)
return statusValue[i];
// loop until the translation string exists (ie, the translated string is differ from original)
- } while (mir_tstrcmp(TranslateTS(LangPackStr), LangPackStr));
+ } while (mir_wstrcmp(TranslateTS(LangPackStr), LangPackStr));
}
return NA;
@@ -409,7 +409,7 @@ void CaseConv(wchar_t *str) {
BOOL nextUp = TRUE;
- CharLowerBuff(str, (DWORD)mir_tstrlen(str));
+ CharLowerBuff(str, (DWORD)mir_wstrlen(str));
for (wchar_t *pstr = str; *pstr; pstr++) {
if (*pstr == ' ' || *pstr == '-')
nextUp = TRUE;
@@ -496,16 +496,16 @@ wchar_t* GetDisplay(WEATHERINFO *w, const wchar_t *dis, wchar_t* str) str[0] = 0;
// looking character by character
- for (i = 0; i < mir_tstrlen(dis); i++) {
+ for (i = 0; i < mir_wstrlen(dis); i++) {
// for the escape characters
if (dis[i] == '\\') {
i++;
chr = dis[i];
switch (chr) {
- case '%': mir_tstrcat(str, L"%"); break;
- case 't': mir_tstrcat(str, L"\t"); break;
- case 'n': mir_tstrcat(str, L"\r\n"); break;
- case '\\': mir_tstrcat(str, L"\\"); break;
+ case '%': mir_wstrcat(str, L"%"); break;
+ case 't': mir_wstrcat(str, L"\t"); break;
+ case 'n': mir_wstrcat(str, L"\r\n"); break;
+ case '\\': mir_wstrcat(str, L"\\"); break;
}
}
@@ -516,41 +516,41 @@ wchar_t* GetDisplay(WEATHERINFO *w, const wchar_t *dis, wchar_t* str) // turn capitalized characters to small case
if (chr < 'a' && chr != '[' && chr != '%') chr = (char)((int)chr + 32);
switch (chr) {
- case 'c': mir_tstrcat(str, w->cond); break;
+ case 'c': mir_wstrcat(str, w->cond); break;
case 'd': // get the current date
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, lpzDate, _countof(lpzDate));
- mir_tstrcat(str, lpzDate); break;
- case 'e': mir_tstrcat(str, w->dewpoint); break;
- case 'f': mir_tstrcat(str, w->feel); break;
- case 'h': mir_tstrcat(str, w->high); break;
- case 'i': mir_tstrcat(str, w->winddir); break;
- case 'l': mir_tstrcat(str, w->low); break;
- case 'm': mir_tstrcat(str, w->humid); break;
- case 'n': mir_tstrcat(str, w->city); break;
- case 'p': mir_tstrcat(str, w->pressure); break;
- case 'r': mir_tstrcat(str, w->sunrise); break;
- case 's': mir_tstrcat(str, w->id); break;
- case 't': mir_tstrcat(str, w->temp); break;
+ mir_wstrcat(str, lpzDate); break;
+ case 'e': mir_wstrcat(str, w->dewpoint); break;
+ case 'f': mir_wstrcat(str, w->feel); break;
+ case 'h': mir_wstrcat(str, w->high); break;
+ case 'i': mir_wstrcat(str, w->winddir); break;
+ case 'l': mir_wstrcat(str, w->low); break;
+ case 'm': mir_wstrcat(str, w->humid); break;
+ case 'n': mir_wstrcat(str, w->city); break;
+ case 'p': mir_wstrcat(str, w->pressure); break;
+ case 'r': mir_wstrcat(str, w->sunrise); break;
+ case 's': mir_wstrcat(str, w->id); break;
+ case 't': mir_wstrcat(str, w->temp); break;
case 'u':
- if (mir_tstrcmp(w->update, NODATA)) mir_tstrcat(str, w->update);
- else mir_tstrcat(str, TranslateT("<unknown time>"));
+ if (mir_wstrcmp(w->update, NODATA)) mir_wstrcat(str, w->update);
+ else mir_wstrcat(str, TranslateT("<unknown time>"));
break;
- case 'v': mir_tstrcat(str, w->vis); break;
- case 'w': mir_tstrcat(str, w->wind); break;
- case 'y': mir_tstrcat(str, w->sunset); break;
- case '%': mir_tstrcat(str, L"%"); break;
+ case 'v': mir_wstrcat(str, w->vis); break;
+ case 'w': mir_wstrcat(str, w->wind); break;
+ case 'y': mir_wstrcat(str, w->sunset); break;
+ case '%': mir_wstrcat(str, L"%"); break;
case '[': // custom variables
i++;
name[0] = 0;
// read the entire variable name
- while (dis[i] != ']' && i < mir_tstrlen(dis)) {
+ while (dis[i] != ']' && i < mir_wstrlen(dis)) {
mir_snprintf(temp, "%c", dis[i++]);
mir_strcat(name, temp);
}
// access the database to get its value
if (!db_get_ts(w->hContact, WEATHERCONDITION, name, &dbv)) {
if (dbv.ptszVal != TranslateTS(NODATA) && dbv.ptszVal != TranslateT("<Error>"))
- mir_tstrcat(str, dbv.ptszVal);
+ mir_wstrcat(str, dbv.ptszVal);
db_free(&dbv);
}
break;
@@ -558,8 +558,8 @@ wchar_t* GetDisplay(WEATHERINFO *w, const wchar_t *dis, wchar_t* str) }
// if the character is not a variable, write the original character to the new string
else {
- mir_sntprintf(lpzDate, L"%c", dis[i]);
- mir_tstrcat(str, lpzDate);
+ mir_snwprintf(lpzDate, L"%c", dis[i]);
+ mir_wstrcat(str, lpzDate);
}
}
@@ -591,7 +591,7 @@ void GetSvc(wchar_t *pszID) void GetID(wchar_t *pszID)
{
wchar_t *chop = wcsstr(pszID, L"/");
- if (chop != NULL) mir_tstrcpy(pszID, chop + 1);
+ if (chop != NULL) mir_wstrcpy(pszID, chop + 1);
else pszID[0] = 0;
}
@@ -631,9 +631,9 @@ wchar_t *GetError(int code) case 503: str = E503; break;
case 504: str = E504; break;
default:
- mir_sntprintf(str2, TranslateT("HTTP Error %i"), code);
+ mir_snwprintf(str2, TranslateT("HTTP Error %i"), code);
str = str2;
break;
}
- return mir_tstrdup(str);
+ return mir_wstrdup(str);
}
diff --git a/plugins/Weather/src/weather_data.cpp b/plugins/Weather/src/weather_data.cpp index 88e9ca12e4..f8df3f7f18 100644 --- a/plugins/Weather/src/weather_data.cpp +++ b/plugins/Weather/src/weather_data.cpp @@ -142,7 +142,7 @@ void EraseAllInfo() opt.DefStn = hContact;
if (!db_get_ts(hContact, WEATHERPROTONAME, "Nick", &dbv)) {
- mir_sntprintf(str, TranslateT("%s is now the default weather station"), dbv.ptszVal);
+ mir_snwprintf(str, TranslateT("%s is now the default weather station"), dbv.ptszVal);
db_free(&dbv);
MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
}
@@ -150,7 +150,7 @@ void EraseAllInfo() // get the handle of the default station
if (opt.DefStn == NULL) {
if (!db_get_ts(hContact, WEATHERPROTONAME, "ID", &dbv)) {
- if (!mir_tstrcmp(dbv.ptszVal, opt.Default))
+ if (!mir_wstrcmp(dbv.ptszVal, opt.Default))
opt.DefStn = hContact;
db_free(&dbv);
}
@@ -169,7 +169,7 @@ void EraseAllInfo() }
opt.DefStn = LastContact;
if (!db_get_ts(LastContact, WEATHERPROTONAME, "Nick", &dbv)) {
- mir_sntprintf(str, TranslateT("%s is now the default weather station"), dbv.ptszVal);
+ mir_snwprintf(str, TranslateT("%s is now the default weather station"), dbv.ptszVal);
db_free(&dbv);
MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
}
@@ -183,57 +183,57 @@ void ConvertDataValue(WIDATAITEM *UpdateData, wchar_t *Data) wchar_t str[MAX_DATA_LEN];
// convert the unit
- if (mir_tstrcmp(Data, TranslateT("<Error>")) && mir_tstrcmp(Data, NODATA) && mir_tstrcmp(Data, TranslateTS(NODATA))) {
+ if (mir_wstrcmp(Data, TranslateT("<Error>")) && mir_wstrcmp(Data, NODATA) && mir_wstrcmp(Data, TranslateTS(NODATA))) {
// temperature
- if (!mir_tstrcmp(UpdateData->Name, L"Temperature") || !mir_tstrcmp(UpdateData->Name, L"High") ||
- !mir_tstrcmp(UpdateData->Name, L"Low") || !mir_tstrcmp(UpdateData->Name, L"Feel") ||
- !mir_tstrcmp(UpdateData->Name, L"Dewpoint") ||
- !mir_tstrcmpi(UpdateData->Unit, L"C") || !mir_tstrcmpi(UpdateData->Unit, L"F") ||
- !mir_tstrcmpi(UpdateData->Unit, L"K")) {
+ if (!mir_wstrcmp(UpdateData->Name, L"Temperature") || !mir_wstrcmp(UpdateData->Name, L"High") ||
+ !mir_wstrcmp(UpdateData->Name, L"Low") || !mir_wstrcmp(UpdateData->Name, L"Feel") ||
+ !mir_wstrcmp(UpdateData->Name, L"Dewpoint") ||
+ !mir_wstrcmpi(UpdateData->Unit, L"C") || !mir_wstrcmpi(UpdateData->Unit, L"F") ||
+ !mir_wstrcmpi(UpdateData->Unit, L"K")) {
GetTemp(Data, UpdateData->Unit, str);
- mir_tstrcpy(Data, str);
+ mir_wstrcpy(Data, str);
}
// pressure
- else if (!mir_tstrcmp(UpdateData->Name, L"Pressure") || !mir_tstrcmpi(UpdateData->Unit, L"HPA") ||
- !mir_tstrcmpi(UpdateData->Unit, L"KPA") || !mir_tstrcmpi(UpdateData->Unit, L"MB") ||
- !mir_tstrcmpi(UpdateData->Unit, L"TORR") || !mir_tstrcmpi(UpdateData->Unit, L"IN") ||
- !mir_tstrcmpi(UpdateData->Unit, L"MM")) {
+ else if (!mir_wstrcmp(UpdateData->Name, L"Pressure") || !mir_wstrcmpi(UpdateData->Unit, L"HPA") ||
+ !mir_wstrcmpi(UpdateData->Unit, L"KPA") || !mir_wstrcmpi(UpdateData->Unit, L"MB") ||
+ !mir_wstrcmpi(UpdateData->Unit, L"TORR") || !mir_wstrcmpi(UpdateData->Unit, L"IN") ||
+ !mir_wstrcmpi(UpdateData->Unit, L"MM")) {
GetPressure(Data, UpdateData->Unit, str);
- mir_tstrcpy(Data, str);
+ mir_wstrcpy(Data, str);
}
// speed
- else if (!mir_tstrcmp(UpdateData->Name, L"Wind Speed") || !mir_tstrcmpi(UpdateData->Unit, L"KM/H") ||
- !mir_tstrcmpi(UpdateData->Unit, L"M/S") || !mir_tstrcmpi(UpdateData->Unit, L"MPH") ||
- !mir_tstrcmpi(UpdateData->Unit, L"KNOTS")) {
+ else if (!mir_wstrcmp(UpdateData->Name, L"Wind Speed") || !mir_wstrcmpi(UpdateData->Unit, L"KM/H") ||
+ !mir_wstrcmpi(UpdateData->Unit, L"M/S") || !mir_wstrcmpi(UpdateData->Unit, L"MPH") ||
+ !mir_wstrcmpi(UpdateData->Unit, L"KNOTS")) {
GetSpeed(Data, UpdateData->Unit, str);
- mir_tstrcpy(Data, str);
+ mir_wstrcpy(Data, str);
}
// visibility
- else if (!mir_tstrcmp(UpdateData->Name, L"Visibility") || !mir_tstrcmpi(UpdateData->Unit, L"KM") ||
- !mir_tstrcmpi(UpdateData->Unit, L"MILES")) {
+ else if (!mir_wstrcmp(UpdateData->Name, L"Visibility") || !mir_wstrcmpi(UpdateData->Unit, L"KM") ||
+ !mir_wstrcmpi(UpdateData->Unit, L"MILES")) {
GetDist(Data, UpdateData->Unit, str);
- mir_tstrcpy(Data, str);
+ mir_wstrcpy(Data, str);
}
// elevation
- else if (!mir_tstrcmp(UpdateData->Name, L"Elevation") || !mir_tstrcmpi(UpdateData->Unit, L"FT") ||
- !mir_tstrcmpi(UpdateData->Unit, L"M")) {
+ else if (!mir_wstrcmp(UpdateData->Name, L"Elevation") || !mir_wstrcmpi(UpdateData->Unit, L"FT") ||
+ !mir_wstrcmpi(UpdateData->Unit, L"M")) {
GetElev(Data, UpdateData->Unit, str);
- mir_tstrcpy(Data, str);
+ mir_wstrcpy(Data, str);
}
// converting case for condition to the upper+lower format
- else if (!mir_tstrcmpi(UpdateData->Unit, L"COND"))
+ else if (!mir_wstrcmpi(UpdateData->Unit, L"COND"))
CaseConv(Data);
// degree sign
- else if (!mir_tstrcmpi(UpdateData->Unit, L"DEG")) {
- if (!opt.DoNotAppendUnit) mir_tstrcat(Data, opt.DegreeSign);
+ else if (!mir_wstrcmpi(UpdateData->Unit, L"DEG")) {
+ if (!opt.DoNotAppendUnit) mir_wstrcat(Data, opt.DegreeSign);
}
// percent sign
- else if (!mir_tstrcmpi(UpdateData->Unit, L"%")) {
- if (!opt.DoNotAppendUnit) mir_tstrcat(Data, L"%");
+ else if (!mir_wstrcmpi(UpdateData->Unit, L"%")) {
+ if (!opt.DoNotAppendUnit) mir_wstrcat(Data, L"%");
}
// truncating strings for day/month to 2 or 3 characters
- else if (!mir_tstrcmpi(UpdateData->Unit, L"DAY") || !mir_tstrcmpi(UpdateData->Unit, L"MONTH"))
- if (opt.dUnit > 1 && mir_tstrlen(Data) > opt.dUnit)
+ else if (!mir_wstrcmpi(UpdateData->Unit, L"DAY") || !mir_wstrcmpi(UpdateData->Unit, L"MONTH"))
+ if (opt.dUnit > 1 && mir_wstrlen(Data) > opt.dUnit)
Data[opt.dUnit] = '\0';
}
}
@@ -261,7 +261,7 @@ void GetDataValue(WIDATAITEM *UpdateData, wchar_t *Data, wchar_t** szData) start = wcsstr(szInfo, UpdateData->Start);
if (start != NULL) {
// set the starting location for getting data
- start += mir_tstrlen(UpdateData->Start);
+ start += mir_wstrlen(UpdateData->Start);
szInfo = start;
}
}
@@ -276,7 +276,7 @@ void GetDataValue(WIDATAITEM *UpdateData, wchar_t *Data, wchar_t** szData) // set the ending location
startloc = 0;
endloc = end - szInfo;
- end += mir_tstrlen(UpdateData->End);
+ end += mir_wstrlen(UpdateData->End);
last = '\n';
}
@@ -315,8 +315,8 @@ void GetDataValue(WIDATAITEM *UpdateData, wchar_t *Data, wchar_t** szData) ++startloc;
// prevent crashes if the string go over maximun length -> generate an error
if (respos >= MAX_DATA_LEN) {
- if (opt.ShowWarnings && UpdateData->Name[0] != 0 && mir_tstrcmp(UpdateData->Name, L"Ignore")) {
- mir_sntprintf(Data, MAX_DATA_LEN, TranslateT("Error when obtaining data: %s"), UpdateData->Name);
+ if (opt.ShowWarnings && UpdateData->Name[0] != 0 && mir_wstrcmp(UpdateData->Name, L"Ignore")) {
+ mir_snwprintf(Data, MAX_DATA_LEN, TranslateT("Error when obtaining data: %s"), UpdateData->Name);
WPShowMessage(Data, SM_WARNING);
}
wcsncpy(Data, TranslateT("<Error>"), MAX_DATA_LEN);
diff --git a/plugins/Weather/src/weather_http.cpp b/plugins/Weather/src/weather_http.cpp index 5567dff83f..7b48509a4d 100644 --- a/plugins/Weather/src/weather_http.cpp +++ b/plugins/Weather/src/weather_http.cpp @@ -79,7 +79,7 @@ int InternetDownloadFile(char *szUrl, char *cookie, char *userAgent, wchar_t **s // if the data does not downloaded successfully (ie. disconnected), then return 1000 as error code
*szData = (wchar_t*)mir_alloc(512);
// store the error code in szData
- mir_tstrcpy(*szData, L"NetLib error occurred!!");
+ mir_wstrcpy(*szData, L"NetLib error occurred!!");
hNetlibHttp = NULL;
return NLHRF_REDIRECT;
}
@@ -126,9 +126,9 @@ int InternetDownloadFile(char *szUrl, char *cookie, char *userAgent, wchar_t **s wchar_t *retVal = NULL;
if (bIsUtf)
- retVal = mir_utf8decodeT(nlhrReply->pData);
+ retVal = mir_utf8decodeW(nlhrReply->pData);
if (retVal == NULL)
- retVal = mir_a2t(nlhrReply->pData);
+ retVal = mir_a2u(nlhrReply->pData);
*szData = retVal;
}
else result = DATA_EMPTY;
@@ -137,7 +137,7 @@ int InternetDownloadFile(char *szUrl, char *cookie, char *userAgent, wchar_t **s else {
*szData = (wchar_t*)mir_alloc(512);
// store the error code in szData
- mir_sntprintf(*szData, 512, L"Error occured! HTTP Error: %i\n", nlhrReply->resultCode);
+ mir_snwprintf(*szData, 512, L"Error occured! HTTP Error: %i\n", nlhrReply->resultCode);
result = nlhrReply->resultCode;
}
diff --git a/plugins/Weather/src/weather_info.cpp b/plugins/Weather/src/weather_info.cpp index f0b3ca4eac..e6ed5291e9 100644 --- a/plugins/Weather/src/weather_info.cpp +++ b/plugins/Weather/src/weather_info.cpp @@ -147,54 +147,54 @@ void GetINIInfo(wchar_t *pszSvc) WIDATA *sData = GetWIData(pszSvc);
// if the service does not exist among the loaded INI's
if (sData == NULL) {
- mir_sntprintf(str2, TranslateT("The corresponding INI file for \"%s\" is not found."), pszSvc);
+ mir_snwprintf(str2, TranslateT("The corresponding INI file for \"%s\" is not found."), pszSvc);
MessageBox(NULL, str2, TranslateT("Weather INI information"), MB_OK | MB_ICONINFORMATION);
}
// if exist, get the information
else {
- mir_sntprintf(str2, TranslateT("Weather INI information for \"%s\":"), pszSvc);
- mir_tstrncat(str2, L"\n\n", _countof(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, TranslateT("Name:"), _countof(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, L"\t\t", _countof(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, sData->DisplayName, _countof(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, L"\n", _countof(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, TranslateT("Internal Name:"), _countof(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, L"\t", _countof(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, sData->InternalName, _countof(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, L"\n", _countof(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, TranslateT("Author:"), _countof(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, L"\t\t", _countof(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, sData->Author, _countof(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, L"\n", _countof(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, TranslateT("Version:"), _countof(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, L"\t\t", _countof(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, sData->Version, _countof(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, L"\n", _countof(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, TranslateT("INI Version:"), _countof(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, L"\t", _countof(str2) - mir_tstrlen(str2));
+ mir_snwprintf(str2, TranslateT("Weather INI information for \"%s\":"), pszSvc);
+ mir_wstrncat(str2, L"\n\n", _countof(str2) - mir_wstrlen(str2));
+ mir_wstrncat(str2, TranslateT("Name:"), _countof(str2) - mir_wstrlen(str2));
+ mir_wstrncat(str2, L"\t\t", _countof(str2) - mir_wstrlen(str2));
+ mir_wstrncat(str2, sData->DisplayName, _countof(str2) - mir_wstrlen(str2));
+ mir_wstrncat(str2, L"\n", _countof(str2) - mir_wstrlen(str2));
+ mir_wstrncat(str2, TranslateT("Internal Name:"), _countof(str2) - mir_wstrlen(str2));
+ mir_wstrncat(str2, L"\t", _countof(str2) - mir_wstrlen(str2));
+ mir_wstrncat(str2, sData->InternalName, _countof(str2) - mir_wstrlen(str2));
+ mir_wstrncat(str2, L"\n", _countof(str2) - mir_wstrlen(str2));
+ mir_wstrncat(str2, TranslateT("Author:"), _countof(str2) - mir_wstrlen(str2));
+ mir_wstrncat(str2, L"\t\t", _countof(str2) - mir_wstrlen(str2));
+ mir_wstrncat(str2, sData->Author, _countof(str2) - mir_wstrlen(str2));
+ mir_wstrncat(str2, L"\n", _countof(str2) - mir_wstrlen(str2));
+ mir_wstrncat(str2, TranslateT("Version:"), _countof(str2) - mir_wstrlen(str2));
+ mir_wstrncat(str2, L"\t\t", _countof(str2) - mir_wstrlen(str2));
+ mir_wstrncat(str2, sData->Version, _countof(str2) - mir_wstrlen(str2));
+ mir_wstrncat(str2, L"\n", _countof(str2) - mir_wstrlen(str2));
+ mir_wstrncat(str2, TranslateT("INI Version:"), _countof(str2) - mir_wstrlen(str2));
+ mir_wstrncat(str2, L"\t", _countof(str2) - mir_wstrlen(str2));
switch (sData->InternalVer) {
- case 1: mir_tstrncat(str2, L"1.0", _countof(str2) - mir_tstrlen(str2)); break;
- case 2: mir_tstrncat(str2, L"1.1", _countof(str2) - mir_tstrlen(str2)); break;
- case 3: mir_tstrncat(str2, L"1.1a", _countof(str2) - mir_tstrlen(str2)); break;
- case 4: mir_tstrncat(str2, L"1.2", _countof(str2) - mir_tstrlen(str2)); break;
- case 5: mir_tstrncat(str2, L"1.3", _countof(str2) - mir_tstrlen(str2)); break;
- case 6: mir_tstrncat(str2, L"1.4", _countof(str2) - mir_tstrlen(str2)); break;
- case 7: mir_tstrncat(str2, L"1.5", _countof(str2) - mir_tstrlen(str2)); break;
+ case 1: mir_wstrncat(str2, L"1.0", _countof(str2) - mir_wstrlen(str2)); break;
+ case 2: mir_wstrncat(str2, L"1.1", _countof(str2) - mir_wstrlen(str2)); break;
+ case 3: mir_wstrncat(str2, L"1.1a", _countof(str2) - mir_wstrlen(str2)); break;
+ case 4: mir_wstrncat(str2, L"1.2", _countof(str2) - mir_wstrlen(str2)); break;
+ case 5: mir_wstrncat(str2, L"1.3", _countof(str2) - mir_wstrlen(str2)); break;
+ case 6: mir_wstrncat(str2, L"1.4", _countof(str2) - mir_wstrlen(str2)); break;
+ case 7: mir_wstrncat(str2, L"1.5", _countof(str2) - mir_wstrlen(str2)); break;
}
- mir_tstrncat(str2, L"\n", _countof(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, TranslateT("File Name:"), _countof(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, L"\t", _countof(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, sData->ShortFileName, _countof(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, L"\n", _countof(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, TranslateT("Item Count:"), _countof(str2) - mir_tstrlen(str2));
- mir_sntprintf(str2, L"%s\t%i\n", str2, sData->UpdateDataCount);
- mir_tstrncat(str2, TranslateT("Memory Used:"), _countof(str2) - mir_tstrlen(str2));
- mir_sntprintf(str2, L"%s\t%i ", str2, sData->MemUsed);
- mir_tstrncat(str2, TranslateT("bytes"), _countof(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, L"\n\n", _countof(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, TranslateT("Description:"), _countof(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, L"\n", _countof(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, sData->Description, _countof(str2) - mir_tstrlen(str2));
+ mir_wstrncat(str2, L"\n", _countof(str2) - mir_wstrlen(str2));
+ mir_wstrncat(str2, TranslateT("File Name:"), _countof(str2) - mir_wstrlen(str2));
+ mir_wstrncat(str2, L"\t", _countof(str2) - mir_wstrlen(str2));
+ mir_wstrncat(str2, sData->ShortFileName, _countof(str2) - mir_wstrlen(str2));
+ mir_wstrncat(str2, L"\n", _countof(str2) - mir_wstrlen(str2));
+ mir_wstrncat(str2, TranslateT("Item Count:"), _countof(str2) - mir_wstrlen(str2));
+ mir_snwprintf(str2, L"%s\t%i\n", str2, sData->UpdateDataCount);
+ mir_wstrncat(str2, TranslateT("Memory Used:"), _countof(str2) - mir_wstrlen(str2));
+ mir_snwprintf(str2, L"%s\t%i ", str2, sData->MemUsed);
+ mir_wstrncat(str2, TranslateT("bytes"), _countof(str2) - mir_wstrlen(str2));
+ mir_wstrncat(str2, L"\n\n", _countof(str2) - mir_wstrlen(str2));
+ mir_wstrncat(str2, TranslateT("Description:"), _countof(str2) - mir_wstrlen(str2));
+ mir_wstrncat(str2, L"\n", _countof(str2) - mir_wstrlen(str2));
+ mir_wstrncat(str2, sData->Description, _countof(str2) - mir_wstrlen(str2));
// display the message box and quit
MessageBox(NULL, str2, TranslateT("Weather INI information"), MB_OK | MB_ICONINFORMATION);
@@ -211,20 +211,20 @@ void MoreVarList(void) // heading
wcsncpy(str, VARS_LIST, _countof(str) - 1);
- mir_tstrncat(str, L"\n\n", _countof(str) - mir_tstrlen(str));
+ mir_wstrncat(str, L"\n\n", _countof(str) - mir_wstrlen(str));
// loop through all weather services to find custom variables
for (WIDATALIST *Item = WIHead; Item != NULL; Item = Item->next) {
// loop through all update items in a service
for (WIDATAITEMLIST *WItem = Item->Data.UpdateData; WItem != NULL; WItem = WItem->Next) {
// the custom variable is defined as "%[<variable name>]"
// ignore the "hi" item and hidden items
- if (mir_tstrcmp(WItem->Item.Name, L"Ignore") && WItem->Item.Name[0] != '#') {
- mir_sntprintf(tempstr, L"%c[%s]", '%', WItem->Item.Name);
+ if (mir_wstrcmp(WItem->Item.Name, L"Ignore") && WItem->Item.Name[0] != '#') {
+ mir_snwprintf(tempstr, L"%c[%s]", '%', WItem->Item.Name);
wchar_t *find = wcsstr(str, tempstr);
// if the custom variable does not exist in the list, add it to the list
if (find == NULL) {
- mir_tstrncat(str, tempstr, _countof(str) - mir_tstrlen(str));
- mir_tstrncat(str, L", ", _countof(str) - mir_tstrlen(str));
+ mir_wstrncat(str, tempstr, _countof(str) - mir_wstrlen(str));
+ mir_wstrncat(str, L", ", _countof(str) - mir_wstrlen(str));
}
}
}
diff --git a/plugins/Weather/src/weather_ini.cpp b/plugins/Weather/src/weather_ini.cpp index efa3fb7af2..62514148b2 100644 --- a/plugins/Weather/src/weather_ini.cpp +++ b/plugins/Weather/src/weather_ini.cpp @@ -53,7 +53,7 @@ WIDATA* GetWIData(wchar_t *pszServ) // loop through the list to find matching internal name
for (WIDATALIST *Item = WIHead; Item != NULL; Item = Item->next)
// if internal name found, return the data
- if (mir_tstrcmp(Item->Data.InternalName, pszServ) == 0)
+ if (mir_wstrcmp(Item->Data.InternalName, pszServ) == 0)
return &Item->Data;
// return NULL when no match found
@@ -78,7 +78,7 @@ void WIItemListAdd(WIDATAITEM *DataItem, WIDATA *Data) // name = the string to store in the "name" field
void ResetDataItem(WIDATAITEM *Item, const wchar_t *name)
{
- Item->Name = mir_tstrdup(name);
+ Item->Name = mir_wstrdup(name);
Item->Start = L"";
Item->End = L"";
Item->Unit = L"";
@@ -113,7 +113,7 @@ void WICondListAdd(char *str, WICONDLIST *List) {
WICONDITEM *newItem = (WICONDITEM*)mir_alloc(sizeof(WICONDITEM));
wSetData(&newItem->Item, str);
- CharLowerBuff(newItem->Item, (DWORD)mir_tstrlen(newItem->Item));
+ CharLowerBuff(newItem->Item, (DWORD)mir_wstrlen(newItem->Item));
newItem->Next = NULL;
if (List->Tail == NULL) List->Head = newItem;
else List->Tail->Next = newItem;
@@ -183,7 +183,7 @@ static INT_PTR CALLBACK DlgProcSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR wchar_t *chop = wcsrchr(szPath, '\\');
if (chop) {
*chop = '\0';
- mir_tstrncat(szPath, L"\\Plugins\\weather\\", _countof(szPath) - mir_tstrlen(szPath));
+ mir_wstrncat(szPath, L"\\Plugins\\weather\\", _countof(szPath) - mir_wstrlen(szPath));
if (_wmkdir(szPath) == 0)
ShellExecute((HWND)lParam, L"open", szPath, L"", L"", SW_SHOW);
}
@@ -270,7 +270,7 @@ static void LoadStationData(wchar_t *pszFile, wchar_t *pszShortFile, WIDATA *Dat Data->InternalVer = 7;
else {
wchar_t str[4096];
- mir_sntprintf(str, TranslateT("Invalid ini format for: %s"), pszFile);
+ mir_snwprintf(str, TranslateT("Invalid ini format for: %s"), pszFile);
MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONERROR);
fclose(pfile);
return;
@@ -323,7 +323,7 @@ static void LoadStationData(wchar_t *pszFile, wchar_t *pszShortFile, WIDATA *Dat // initialize the linked list for update items
Data->UpdateDataCount = 0;
- Data->MemUsed = sizeof(WIDATA) + sizeof(WIDATALIST) + (mir_tstrlen(pszShortFile) + mir_tstrlen(pszFile) + 20)*sizeof(wchar_t);
+ Data->MemUsed = sizeof(WIDATA) + sizeof(WIDATALIST) + (mir_wstrlen(pszShortFile) + mir_wstrlen(pszFile) + 20)*sizeof(wchar_t);
Data->UpdateData = NULL;
Data->UpdateDataTail = NULL;
@@ -447,7 +447,7 @@ static void LoadStationData(wchar_t *pszFile, wchar_t *pszShortFile, WIDATA *Dat else if (!_stricmp(ValName, "HIDDEN")) {
if (!_stricmp(Value, "TRUE")) {
wchar_t *nm = Data->UpdateDataTail->Item.Name;
- size_t len = mir_tstrlen(nm) + 1;
+ size_t len = mir_wstrlen(nm) + 1;
Data->UpdateDataTail->Item.Name = nm = (wchar_t*)mir_realloc(nm, sizeof(wchar_t)*(len + 3));
memmove(nm + 1, nm, len*sizeof(wchar_t));
@@ -491,7 +491,7 @@ bool LoadWIData(bool dial) if (chop == NULL)
return false;
*chop = '\0';
- mir_tstrncat(szSearchPath, L"\\Plugins\\Weather\\*.ini", _countof(szSearchPath) - mir_tstrlen(szSearchPath));
+ mir_wstrncat(szSearchPath, L"\\Plugins\\Weather\\*.ini", _countof(szSearchPath) - mir_wstrlen(szSearchPath));
wcsncpy(FileName, szSearchPath, MAX_PATH - 1);
WIN32_FIND_DATA fd;
@@ -503,8 +503,8 @@ bool LoadWIData(bool dial) do {
chop = wcsrchr(FileName, '\\');
chop[1] = '\0';
- mir_tstrncat(FileName, fd.cFileName, _countof(FileName) - mir_tstrlen(FileName));
- if (mir_tstrcmpi(fd.cFileName, L"SAMPLE_INI.INI")) {
+ mir_wstrncat(FileName, fd.cFileName, _countof(FileName) - mir_wstrlen(FileName));
+ if (mir_wstrcmpi(fd.cFileName, L"SAMPLE_INI.INI")) {
WIDATA Data;
LoadStationData(FileName, fd.cFileName, &Data);
if (Data.Enabled)
diff --git a/plugins/Weather/src/weather_mwin.cpp b/plugins/Weather/src/weather_mwin.cpp index 1dd09bf864..aa47bb3580 100644 --- a/plugins/Weather/src/weather_mwin.cpp +++ b/plugins/Weather/src/weather_mwin.cpp @@ -158,15 +158,15 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara {
FontIDT fntid = { 0 };
- mir_tstrcpy(fntid.group, _A2W(WEATHERPROTONAME));
- mir_tstrcpy(fntid.name, LPGENW("Frame Font"));
+ mir_wstrcpy(fntid.group, _A2W(WEATHERPROTONAME));
+ mir_wstrcpy(fntid.name, LPGENW("Frame Font"));
fntc = CallService(MS_FONT_GETT, (WPARAM)&fntid, (LPARAM)&lfnt);
- mir_tstrcpy(fntid.name, LPGENW("Frame Title Font"));
+ mir_wstrcpy(fntid.name, LPGENW("Frame Title Font"));
fntc1 = CallService(MS_FONT_GETT, (WPARAM)&fntid, (LPARAM)&lfnt1);
}
- ptrT tszInfo(db_get_tsa(data->hContact, WEATHERCONDITION, "WeatherInfo"));
+ ptrW tszInfo(db_get_tsa(data->hContact, WEATHERCONDITION, "WeatherInfo"));
GetClientRect(hwnd, &rc);
@@ -242,7 +242,7 @@ static void addWindow(MCONTACT hContact) return;
wchar_t winname[512];
- mir_sntprintf(winname, L"Weather: %s", dbv.ptszVal);
+ mir_snwprintf(winname, L"Weather: %s", dbv.ptszVal);
db_free(&dbv);
HWND hWnd = CreateWindow(L"WeatherFrame", L"", WS_CHILD | WS_VISIBLE,
@@ -328,8 +328,8 @@ void InitMwin(void) colourid.cbSize = sizeof(ColourIDT);
mir_strcpy(colourid.dbSettingsGroup, WEATHERPROTONAME);
mir_strcpy(colourid.setting, "ColorMwinFrame");
- mir_tstrcpy(colourid.name, LPGENW("Frame Background"));
- mir_tstrcpy(colourid.group, _A2W(WEATHERPROTONAME));
+ mir_wstrcpy(colourid.name, LPGENW("Frame Background"));
+ mir_wstrcpy(colourid.group, _A2W(WEATHERPROTONAME));
colourid.defcolour = GetSysColor(COLOR_3DFACE);
ColourRegisterT(&colourid);
@@ -337,8 +337,8 @@ void InitMwin(void) fontid.cbSize = sizeof(FontIDT);
fontid.flags = FIDF_ALLOWREREGISTER | FIDF_DEFAULTVALID;
mir_strcpy(fontid.dbSettingsGroup, WEATHERPROTONAME);
- mir_tstrcpy(fontid.group, _A2W(WEATHERPROTONAME));
- mir_tstrcpy(fontid.name, LPGENW("Frame Font"));
+ mir_wstrcpy(fontid.group, _A2W(WEATHERPROTONAME));
+ mir_wstrcpy(fontid.name, LPGENW("Frame Font"));
mir_strcpy(fontid.prefix, "fnt0");
HDC hdc = GetDC(NULL);
@@ -346,13 +346,13 @@ void InitMwin(void) ReleaseDC(0, hdc);
fontid.deffontsettings.charset = DEFAULT_CHARSET;
- mir_tstrcpy(fontid.deffontsettings.szFace, L"Verdana");
- mir_tstrcpy(fontid.backgroundGroup, _A2W(WEATHERPROTONAME));
- mir_tstrcpy(fontid.backgroundName, LPGENW("Frame Background"));
+ mir_wstrcpy(fontid.deffontsettings.szFace, L"Verdana");
+ mir_wstrcpy(fontid.backgroundGroup, _A2W(WEATHERPROTONAME));
+ mir_wstrcpy(fontid.backgroundName, LPGENW("Frame Background"));
FontRegisterT(&fontid);
fontid.deffontsettings.style = DBFONTF_BOLD;
- mir_tstrcpy(fontid.name, LPGENW("Frame Title Font"));
+ mir_wstrcpy(fontid.name, LPGENW("Frame Title Font"));
mir_strcpy(fontid.prefix, "fnt1");
FontRegisterT(&fontid);
diff --git a/plugins/Weather/src/weather_opt.cpp b/plugins/Weather/src/weather_opt.cpp index 6f866cd99a..c971ef7857 100644 --- a/plugins/Weather/src/weather_opt.cpp +++ b/plugins/Weather/src/weather_opt.cpp @@ -114,7 +114,7 @@ void LoadOptions(void) opt.dUnit = db_get_w(NULL, WEATHERPROTONAME, "dUnit", 1);
opt.eUnit = db_get_w(NULL, WEATHERPROTONAME, "eUnit", 2);
- ptrT szValue(db_get_tsa(NULL, WEATHERPROTONAME, "DegreeSign"));
+ ptrW szValue(db_get_tsa(NULL, WEATHERPROTONAME, "DegreeSign"));
wcsncpy_s(opt.DegreeSign, (szValue == NULL) ? L"" : szValue, _TRUNCATE);
opt.DoNotAppendUnit = db_get_b(NULL, WEATHERPROTONAME, "DoNotAppendUnit", 0);
diff --git a/plugins/Weather/src/weather_popup.cpp b/plugins/Weather/src/weather_popup.cpp index 4e721a07a5..6e1ddba4ea 100644 --- a/plugins/Weather/src/weather_popup.cpp +++ b/plugins/Weather/src/weather_popup.cpp @@ -67,8 +67,8 @@ int WeatherError(WPARAM wParam, LPARAM lParam) // setup the popup
ppd.lchIcon = (HICON)LoadImage(NULL, MAKEINTRESOURCE(OIC_BANG), IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED);
- mir_tstrcpy(ppd.lptzContactName, str1);
- mir_tstrcpy(ppd.lptzText, str2);
+ mir_wstrcpy(ppd.lptzContactName, str1);
+ mir_wstrcpy(ppd.lptzText, str2);
ppd.colorBack = (opt.UseWinColors) ? GetSysColor(COLOR_BTNFACE) : opt.BGColour;
ppd.colorText = (opt.UseWinColors) ? GetSysColor(COLOR_WINDOWTEXT) : opt.TextColour;
ppd.iSeconds = opt.pDelay;
@@ -395,9 +395,9 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) case IDC_VAR3:
// display variable list
wcsncpy(str, L" \n", _countof(str) - 1); // to make the message box wider
- mir_tstrncat(str, VAR_LIST_POPUP, _countof(str) - mir_tstrlen(str));
- mir_tstrncat(str, L"\n", _countof(str) - mir_tstrlen(str));
- mir_tstrncat(str, CUSTOM_VARS, _countof(str) - mir_tstrlen(str));
+ mir_wstrncat(str, VAR_LIST_POPUP, _countof(str) - mir_wstrlen(str));
+ mir_wstrncat(str, L"\n", _countof(str) - mir_wstrlen(str));
+ mir_wstrncat(str, CUSTOM_VARS, _countof(str) - mir_wstrlen(str));
MessageBox(NULL, str, TranslateT("Variable List"), MB_OK | MB_ICONASTERISK | MB_TOPMOST);
break;
diff --git a/plugins/Weather/src/weather_svcs.cpp b/plugins/Weather/src/weather_svcs.cpp index cd283324bb..e301a0302d 100644 --- a/plugins/Weather/src/weather_svcs.cpp +++ b/plugins/Weather/src/weather_svcs.cpp @@ -147,12 +147,12 @@ INT_PTR WeatherGetAvatarInfo(WPARAM, LPARAM lParam) return GAIR_NOAVATAR;
pai->format = PA_FORMAT_PNG;
- mir_sntprintf(pai->filename, L"%s\\Plugins\\Weather\\%s.png", szSearchPath, statusStr[i]);
+ mir_snwprintf(pai->filename, L"%s\\Plugins\\Weather\\%s.png", szSearchPath, statusStr[i]);
if (_waccess(pai->filename, 4) == 0)
return GAIR_SUCCESS;
pai->format = PA_FORMAT_GIF;
- mir_sntprintf(pai->filename, L"%s\\Plugins\\Weather\\%s.gif", szSearchPath, statusStr[i]);
+ mir_snwprintf(pai->filename, L"%s\\Plugins\\Weather\\%s.gif", szSearchPath, statusStr[i]);
if (_waccess(pai->filename, 4) == 0)
return GAIR_SUCCESS;
diff --git a/plugins/Weather/src/weather_update.cpp b/plugins/Weather/src/weather_update.cpp index 65c814dee1..c6159a10a3 100644 --- a/plugins/Weather/src/weather_update.cpp +++ b/plugins/Weather/src/weather_update.cpp @@ -56,11 +56,11 @@ int UpdateWeather(MCONTACT hContact) // error occurs if the return value is not equals to 0
if (opt.ShowWarnings) {
// show warnings by popup
- mir_sntprintf(str, _countof(str) - 105,
+ mir_snwprintf(str, _countof(str) - 105,
TranslateT("Unable to retrieve weather information for %s"), dbv.ptszVal);
- mir_tstrncat(str, L"\n", _countof(str) - mir_tstrlen(str));
+ mir_wstrncat(str, L"\n", _countof(str) - mir_wstrlen(str));
wchar_t *tszError = GetError(code);
- mir_tstrncat(str, tszError, _countof(str) - mir_tstrlen(str));
+ mir_wstrncat(str, tszError, _countof(str) - mir_wstrlen(str));
WPShowMessage(str, SM_WARNING);
mir_free(tszError);
}
@@ -76,24 +76,24 @@ int UpdateWeather(MCONTACT hContact) WEATHERINFO winfo = LoadWeatherInfo(hContact);
// translate weather condition
- mir_tstrcpy(winfo.cond, TranslateTS(winfo.cond));
+ mir_wstrcpy(winfo.cond, TranslateTS(winfo.cond));
// compare the old condition and determine if the weather had changed
if (opt.UpdateOnlyConditionChanged) { // consider condition change
if (!db_get_ts(hContact, WEATHERPROTONAME, "LastCondition", &dbv)) {
- if (mir_tstrcmpi(winfo.cond, dbv.ptszVal)) Ch = TRUE; // the weather condition is changed
+ if (mir_wstrcmpi(winfo.cond, dbv.ptszVal)) Ch = TRUE; // the weather condition is changed
db_free(&dbv);
}
else Ch = TRUE;
if (!db_get_ts(hContact, WEATHERPROTONAME, "LastTemperature", &dbv)) {
- if (mir_tstrcmpi(winfo.temp, dbv.ptszVal)) Ch = TRUE; // the temperature is changed
+ if (mir_wstrcmpi(winfo.temp, dbv.ptszVal)) Ch = TRUE; // the temperature is changed
db_free(&dbv);
}
else Ch = TRUE;
}
else { // consider update time change
if (!db_get_ts(hContact, WEATHERPROTONAME, "LastUpdate", &dbv)) {
- if (mir_tstrcmpi(winfo.update, dbv.ptszVal)) Ch = TRUE; // the update time is changed
+ if (mir_wstrcmpi(winfo.update, dbv.ptszVal)) Ch = TRUE; // the update time is changed
db_free(&dbv);
}
else Ch = TRUE;
@@ -104,7 +104,7 @@ int UpdateWeather(MCONTACT hContact) if (!dbres && dbv.ptszVal[0] != 0) {
if (opt.AlertPopup && !db_get_b(hContact, WEATHERPROTONAME, "DPopUp", 0) && Ch) {
// display alert popup
- mir_sntprintf(str, L"Alert for %s%c%s", winfo.city, 255, dbv.ptszVal);
+ mir_snwprintf(str, L"Alert for %s%c%s", winfo.city, 255, dbv.ptszVal);
WPShowMessage(str, SM_WEATHERALERT);
}
// alert issued, set display to italic
@@ -150,7 +150,7 @@ int UpdateWeather(MCONTACT hContact) db_set_b(hContact, WEATHERPROTONAME, "IsUpdated", TRUE);
// save info for default weather condition
- if (!mir_tstrcmp(winfo.id, opt.Default) && !opt.NoProtoCondition) {
+ if (!mir_wstrcmp(winfo.id, opt.Default) && !opt.NoProtoCondition) {
// save current condition for default station to be displayed after the update
old_status = status;
status = winfo.status;
@@ -458,7 +458,7 @@ int GetWeatherData(MCONTACT hContact) // if it is a normal item with start= and end=, then parse through the downloaded string
// to get a data value.
GetDataValue(&Item->Item, DataValue, &szInfo);
- if (mir_tstrcmp(Item->Item.Name, L"Condition") && mir_tstrcmpi(Item->Item.Unit, L"Cond"))
+ if (mir_wstrcmp(Item->Item.Name, L"Condition") && mir_wstrcmpi(Item->Item.Unit, L"Cond"))
wcsncpy(DataValue, TranslateTS(DataValue), MAX_DATA_LEN - 1);
break;
@@ -488,14 +488,14 @@ int GetWeatherData(MCONTACT hContact) case '[': // variable, add the value to the result string
hasvar = TRUE;
if (!DBGetData(hContact, _T2A(str2), &dbv)) {
- mir_tstrncat(DataValue, dbv.ptszVal, _countof(DataValue) - mir_tstrlen(DataValue));
+ mir_wstrncat(DataValue, dbv.ptszVal, _countof(DataValue) - mir_wstrlen(DataValue));
DataValue[_countof(DataValue) - 1] = 0;
db_free(&dbv);
}
break;
case'\"': // constant, add it to the result string
- mir_tstrncat(DataValue, TranslateTS(str2), _countof(DataValue) - mir_tstrlen(DataValue));
+ mir_wstrncat(DataValue, TranslateTS(str2), _countof(DataValue) - mir_wstrlen(DataValue));
DataValue[_countof(DataValue) - 1] = 0;
break;
}
@@ -528,7 +528,7 @@ int GetWeatherData(MCONTACT hContact) break; // exit if break string is not found
}
*end = '\0';
- end += mir_tstrlen(Item->Item.Break);
+ end += mir_wstrlen(Item->Item.Break);
while (end[0] == ' ')
end++; // remove extra space
@@ -542,28 +542,28 @@ int GetWeatherData(MCONTACT hContact) }
// don't store data if it is not available
- if ((DataValue[0] != 0 && mir_tstrcmp(DataValue, NODATA) &&
- mir_tstrcmp(DataValue, TranslateTS(NODATA)) && mir_tstrcmp(Item->Item.Name, L"Ignore")) ||
- (!mir_tstrcmp(Item->Item.Name, L"Alert") && i == 0)) {
+ if ((DataValue[0] != 0 && mir_wstrcmp(DataValue, NODATA) &&
+ mir_wstrcmp(DataValue, TranslateTS(NODATA)) && mir_wstrcmp(Item->Item.Name, L"Ignore")) ||
+ (!mir_wstrcmp(Item->Item.Name, L"Alert") && i == 0)) {
// temporary workaround for mToolTip to show feel-like temperature
- if (!mir_tstrcmp(Item->Item.Name, L"Feel"))
+ if (!mir_wstrcmp(Item->Item.Name, L"Feel"))
db_set_ts(hContact, WEATHERCONDITION, "Heat Index", DataValue);
GetStationID(hContact, Svc, _countof(Svc));
- if (!mir_tstrcmp(Svc, opt.Default))
+ if (!mir_wstrcmp(Svc, opt.Default))
db_set_ts(NULL, DEFCURRENTWEATHER, _T2A(Item->Item.Name), DataValue);
- if (!mir_tstrcmp(Item->Item.Name, L"Condition")) {
+ if (!mir_wstrcmp(Item->Item.Name, L"Condition")) {
wchar_t buf[128], *cbuf;
- mir_sntprintf(buf, L"#%s Weather", DataValue);
+ mir_snwprintf(buf, L"#%s Weather", DataValue);
cbuf = TranslateTS(buf);
if (cbuf[0] == '#')
cbuf = TranslateTS(DataValue);
db_set_ts(hContact, WEATHERCONDITION, _T2A(Item->Item.Name), cbuf);
- CharLowerBuff(DataValue, (DWORD)mir_tstrlen(DataValue));
+ CharLowerBuff(DataValue, (DWORD)mir_wstrlen(DataValue));
cond = GetIcon(DataValue, Data);
}
- else if (mir_tstrcmpi(Item->Item.Unit, L"Cond") == 0) {
+ else if (mir_wstrcmpi(Item->Item.Unit, L"Cond") == 0) {
wchar_t buf[128], *cbuf;
- mir_sntprintf(buf, L"#%s Weather", DataValue);
+ mir_snwprintf(buf, L"#%s Weather", DataValue);
cbuf = TranslateTS(buf);
if (cbuf[0] == '#')
cbuf = TranslateTS(DataValue);
diff --git a/plugins/WebView/src/main.cpp b/plugins/WebView/src/main.cpp index 7bc2acf7a3..a47782293c 100644 --- a/plugins/WebView/src/main.cpp +++ b/plugins/WebView/src/main.cpp @@ -221,7 +221,7 @@ extern "C" int __declspec(dllexport) Load() CreateServiceFunction("Countdown", CountdownMenuCommand);
mi.flags |= CMIF_KEEPUNTRANSLATED;
wchar_t countername[100];
- mir_sntprintf(countername, TranslateT("%d minutes to update"), db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0));
+ mir_snwprintf(countername, TranslateT("%d minutes to update"), db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0));
mi.position = 600090099;
mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_UPDATEALL));
mi.name.w = countername;
diff --git a/plugins/WebView/src/webview.cpp b/plugins/WebView/src/webview.cpp index 3abb94ffb6..39cbf6dfc7 100644 --- a/plugins/WebView/src/webview.cpp +++ b/plugins/WebView/src/webview.cpp @@ -64,7 +64,7 @@ void ChangeMenuItemCountdown() HICON hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_UPDATEALL));
wchar_t countername[100];
- mir_sntprintf(countername, TranslateT("%d minutes to update"), db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0));
+ mir_snwprintf(countername, TranslateT("%d minutes to update"), db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0));
Menu_ModifyItem(hMenuItemCountdown, countername, hIcon, CMIF_KEEPUNTRANSLATED);
}
@@ -173,7 +173,7 @@ int Doubleclick(WPARAM wParam, LPARAM) int action = db_get_b(hContact, MODULENAME, DBLE_WIN_KEY, 1);
if (action == 0) {
- ptrT url(db_get_tsa(hContact, MODULENAME, "URL"));
+ ptrW url(db_get_tsa(hContact, MODULENAME, "URL"));
Utils_OpenUrlT(url);
db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE);
@@ -241,10 +241,10 @@ int SendToRichEdit(HWND hWindow, char *truncated, COLORREF rgbText, COLORREF rgb cfFM.dwEffects = bold | italic | underline;
if (!db_get_ts(NULL, MODULENAME, FONT_FACE_KEY, &dbv)) {
- mir_tstrcpy(cfFM.szFaceName, dbv.ptszVal);
+ mir_wstrcpy(cfFM.szFaceName, dbv.ptszVal);
db_free(&dbv);
}
- else mir_tstrcpy(cfFM.szFaceName, Def_font_face);
+ else mir_wstrcpy(cfFM.szFaceName, Def_font_face);
HDC hDC = GetDC(hWindow);
cfFM.yHeight = (BYTE)MulDiv(abs(g_lf.lfHeight), 120, GetDeviceCaps(GetDC(hWindow), LOGPIXELSY)) * (db_get_b(NULL, MODULENAME, FONT_SIZE_KEY, 14));
@@ -327,7 +327,7 @@ void FontSettings(void) g_lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
g_lf.lfQuality = DEFAULT_QUALITY;
g_lf.lfPitchAndFamily = FIXED_PITCH | FF_MODERN;
- mir_tstrcpy(g_lf.lfFaceName, Def_font_face);
+ mir_wstrcpy(g_lf.lfFaceName, Def_font_face);
}
/*****************************************************************************/
@@ -443,7 +443,7 @@ int OnTopMenuCommand(WPARAM, LPARAM, MCONTACT singlecontact) INT_PTR WebsiteMenuCommand(WPARAM wParam, LPARAM)
{
MCONTACT hContact = wParam;
- ptrT url(db_get_tsa(hContact, MODULENAME, "URL"));
+ ptrW url(db_get_tsa(hContact, MODULENAME, "URL"));
if (url)
Utils_OpenUrlT(url);
diff --git a/plugins/WebView/src/webview_alerts.cpp b/plugins/WebView/src/webview_alerts.cpp index 65987f66f9..eee757a5e8 100644 --- a/plugins/WebView/src/webview_alerts.cpp +++ b/plugins/WebView/src/webview_alerts.cpp @@ -30,7 +30,7 @@ int CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_COMMAND:
case WM_CONTEXTMENU:
MCONTACT hContact = PUGetContact(hWnd);
- ptrT url( db_get_tsa(hContact, MODULENAME, URL_KEY));
+ ptrW url( db_get_tsa(hContact, MODULENAME, URL_KEY));
if (message == WM_COMMAND) { // left click
if(hContact != NULL) {
@@ -116,19 +116,19 @@ int PopupAlert(WPARAM wParam, LPARAM lParam) if( ((HANDLE)wParam) != NULL) {
DBVARIANT dbv;
db_get_ts(wParam, MODULENAME, PRESERVE_NAME_KEY, &dbv);
- mir_tstrncpy(ppd.lptzContactName, dbv.ptszVal, _countof(ppd.lptzContactName));
+ mir_wstrncpy(ppd.lptzContactName, dbv.ptszVal, _countof(ppd.lptzContactName));
db_free(&dbv);
}
- else mir_tstrcpy(ppd.lptzContactName, MODULENAMEW);
+ else mir_wstrcpy(ppd.lptzContactName, MODULENAMEW);
ppd.lchContact = wParam;
ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_SITE));
wchar_t *displaytext = (wchar_t*)lParam;
- if ((mir_tstrlen(displaytext) == MAX_SECONDLINE) || (mir_tstrlen(displaytext) > MAX_SECONDLINE))
- mir_sntprintf(ppd.lptzText, displaytext);
- else if (mir_tstrlen(displaytext) < MAX_SECONDLINE)
- mir_sntprintf(ppd.lptzText, displaytext);
+ if ((mir_wstrlen(displaytext) == MAX_SECONDLINE) || (mir_wstrlen(displaytext) > MAX_SECONDLINE))
+ mir_snwprintf(ppd.lptzText, displaytext);
+ else if (mir_wstrlen(displaytext) < MAX_SECONDLINE)
+ mir_snwprintf(ppd.lptzText, displaytext);
if ( db_get_b(NULL, MODULENAME, POP_USECUSTCLRS_KEY, 0)) {
ppd.colorBack = db_get_dw(NULL, MODULENAME, POP_BG_CLR_KEY, Def_color_bg);
@@ -188,11 +188,11 @@ int ErrorMsgs(WPARAM wParam, LPARAM lParam) wchar_t *ptszContactName = pcli->pfnGetContactDisplayName(hContact, 0);
if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, MODULENAME, ERROR_POPUP_KEY, 0)) {
- mir_sntprintf(newdisplaytext, L"%s\n%s", ptszContactName, displaytext);
+ mir_snwprintf(newdisplaytext, L"%s\n%s", ptszContactName, displaytext);
PUShowMessageT(newdisplaytext, SM_WARNING);
}
else if ( ServiceExists("OSD/Announce") && db_get_b(NULL, MODULENAME, ERROR_POPUP_KEY, 0)) {
- mir_sntprintf(newdisplaytext, L"%s: %s", ptszContactName, TranslateTS(displaytext));
+ mir_snwprintf(newdisplaytext, L"%s: %s", ptszContactName, TranslateTS(displaytext));
CallService("OSD/Announce", (WPARAM)newdisplaytext, 0);
}
else if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) {
@@ -357,7 +357,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn //
if ((!notpresent)) {
if (alertIndex == 0) { // popup
- mir_sntprintf(displaystring, L"%s \"%S\" %s.", Translate("The string"), alertstring, Translate("has been found on the web page"));
+ mir_snwprintf(displaystring, L"%s \"%S\" %s.", Translate("The string"), alertstring, Translate("has been found on the web page"));
WAlertPopup(hContact, displaystring);
// contactlist name//
@@ -397,7 +397,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn }
}
else if (alertIndex == 3) {
- mir_sntprintf(displaystring, L"%s \"%s\" %s.", TranslateT("The string"), alertstring, TranslateT("has been found on the web page"));
+ mir_snwprintf(displaystring, L"%s \"%s\" %s.", TranslateT("The string"), alertstring, TranslateT("has been found on the web page"));
WAlertOSD(hContact, displaystring);
// contactlist name//
@@ -426,9 +426,9 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn cacheend++;
*cacheend = '\0';
- mir_sntprintf(cachedirectorypath, L"%s%S%S", cachepath, MODULENAME, "cache\\");
+ mir_snwprintf(cachedirectorypath, L"%s%S%S", cachepath, MODULENAME, "cache\\");
CreateDirectory(cachedirectorypath, NULL);
- mir_sntprintf(newcachepath, L"%s%S%S%S%S", cachepath, MODULENAME, "cache\\", contactname, ".txt");
+ mir_snwprintf(newcachepath, L"%s%S%S%S%S", cachepath, MODULENAME, "cache\\", contactname, ".txt");
// file exists?
if ( _waccess(newcachepath, 0) != -1) {
if ((pcachefile = _wfopen(newcachepath, L"r")) == NULL)
@@ -638,9 +638,9 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn cacheend++;
*cacheend = '\0';
- mir_sntprintf(cachedirectorypath, L"%s%S%S", cachepath, MODULENAME, "cache\\");
+ mir_snwprintf(cachedirectorypath, L"%s%S%S", cachepath, MODULENAME, "cache\\");
CreateDirectory(cachedirectorypath, NULL);
- mir_sntprintf(newcachepath, L"%s%S%S%S%S", cachepath, MODULENAME, "cache\\", contactname, ".txt");
+ mir_snwprintf(newcachepath, L"%s%S%S%S%S", cachepath, MODULENAME, "cache\\", contactname, ".txt");
// file exists?
if ( _waccess(newcachepath, 0) != -1) {
if ((pcachefile = _wfopen(newcachepath, L"r")) == NULL)
diff --git a/plugins/WebView/src/webview_datawnd.cpp b/plugins/WebView/src/webview_datawnd.cpp index acd228eb6d..a45f188ac1 100644 --- a/plugins/WebView/src/webview_datawnd.cpp +++ b/plugins/WebView/src/webview_datawnd.cpp @@ -129,10 +129,10 @@ static MCONTACT FindContactByUrl(HWND hwndDlg) GetWindowText(hwndDlg, titlebartxt, _countof(titlebartxt));
for (MCONTACT hContact = db_find_first(MODULENAME); hContact != NULL; hContact = db_find_next(hContact, MODULENAME)) {
- ptrT db1( db_get_tsa(hContact, MODULENAME, URL_KEY));
- ptrT db2( db_get_tsa(hContact, MODULENAME, PRESERVE_NAME_KEY));
+ ptrW db1( db_get_tsa(hContact, MODULENAME, URL_KEY));
+ ptrW db2( db_get_tsa(hContact, MODULENAME, PRESERVE_NAME_KEY));
- if (!mir_tstrcmp(urltext, db1) && !mir_tstrcmp(titlebartxt, db2)) {
+ if (!mir_wstrcmp(urltext, db1) && !mir_wstrcmp(titlebartxt, db2)) {
contactcount++;
if (contactcount > 1) {
MessageBox(NULL, TranslateT("ERROR: You have two or more Webview contacts with the same URL and contact name."), MODULENAMEW, MB_OK);
diff --git a/plugins/WebView/src/webview_opts.cpp b/plugins/WebView/src/webview_opts.cpp index a833fed559..69d878fbd6 100644 --- a/plugins/WebView/src/webview_opts.cpp +++ b/plugins/WebView/src/webview_opts.cpp @@ -53,9 +53,9 @@ wchar_t* FixButtonText(wchar_t *url, size_t len) int pos = (stringafter - buttontext);
int posbefore = (stringafter - buttontext) - 1;
int posafter = (stringafter - buttontext) + 1;
- strdelt(stringafter, 1);
+ strdelw(stringafter, 1);
wcsncpy_s(stringbefore, pos, buttontext, _TRUNCATE);
- mir_sntprintf(newbuttontext, L"%s!!%s", stringbefore, stringafter);
+ mir_snwprintf(newbuttontext, L"%s!!%s", stringbefore, stringafter);
posafter = 0;
posbefore = 0;
@@ -206,9 +206,9 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) TextColour = TextClr;
}
ppd.lchContact = NULL;
- mir_tstrcpy(ppd.lptzContactName, MODULENAMEW);
+ mir_wstrcpy(ppd.lptzContactName, MODULENAMEW);
ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_SITE));
- mir_tstrcpy(ppd.lptzText, TranslateT("This is a preview popup."));
+ mir_wstrcpy(ppd.lptzText, TranslateT("This is a preview popup."));
ppd.colorBack = BGColour;
ppd.colorText = TextColour;
ppd.PluginWindowProc = NULL;
diff --git a/plugins/WebView/src/webview_services.cpp b/plugins/WebView/src/webview_services.cpp index 718c57fdbf..b3d8a70504 100644 --- a/plugins/WebView/src/webview_services.cpp +++ b/plugins/WebView/src/webview_services.cpp @@ -46,12 +46,12 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam) // A contact is renamed if (!strcmp(cws->szSetting, "MyHandle")) { - ptrT oldName( db_get_tsa(hContact, MODULENAME, PRESERVE_NAME_KEY)); + ptrW oldName( db_get_tsa(hContact, MODULENAME, PRESERVE_NAME_KEY)); if (oldName == NULL) return 0; wchar_t nick[100]; - ptrT oldnick( db_get_tsa(hContact, "CList", "MyHandle")); + ptrW oldnick( db_get_tsa(hContact, "CList", "MyHandle")); if (oldnick != NULL) wcsncpy_s(nick, oldnick, _TRUNCATE); else @@ -70,7 +70,7 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam) srand((unsigned)time(NULL)); wchar_t ranStr[7]; _itow((int)10000 *rand() / (RAND_MAX + 1.0), ranStr, 10); - mir_tstrcat(nick, ranStr); + mir_wstrcat(nick, ranStr); } if ( wcschr(nick, '(') == 0) { @@ -85,19 +85,19 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam) wchar_t *cacheend = wcsrchr(cachepath, '\\'); cacheend++; *cacheend = '\0'; - mir_sntprintf(cachedirectorypath, L"%s" MODULENAMEW L"cache\\", cachepath); + mir_snwprintf(cachedirectorypath, L"%s" MODULENAMEW L"cache\\", cachepath); CreateDirectory(cachedirectorypath, NULL); wchar_t newcachepath[MAX_PATH + 50], renamedcachepath[MAX_PATH + 50]; - mir_sntprintf(newcachepath, L"%s" MODULENAMEW L"cache\\%s.txt", cachepath, oldName); - mir_sntprintf(renamedcachepath, L"%s" MODULENAMEW L"cache\\%s.txt", cachepath, nick); + mir_snwprintf(newcachepath, L"%s" MODULENAMEW L"cache\\%s.txt", cachepath, oldName); + mir_snwprintf(renamedcachepath, L"%s" MODULENAMEW L"cache\\%s.txt", cachepath, nick); // file exists? if ( _waccess(newcachepath, 0) != -1) { FILE *pcachefile = _wfopen(newcachepath, L"r"); if (pcachefile != NULL) { fclose(pcachefile); - if (mir_tstrcmp(newcachepath, renamedcachepath)) { + if (mir_wstrcmp(newcachepath, renamedcachepath)) { MoveFile(newcachepath, renamedcachepath); db_set_ts(hContact, MODULENAME, CACHE_FILE_KEY, renamedcachepath); } @@ -115,7 +115,7 @@ int SiteDeleted(WPARAM wParam, LPARAM) if (mir_strcmp(GetContactProto(hContact), MODULENAME)) return 0; - ptrT contactName( db_get_tsa(hContact, MODULENAME, PRESERVE_NAME_KEY)); + ptrW contactName( db_get_tsa(hContact, MODULENAME, PRESERVE_NAME_KEY)); // TEST GET NAME FOR CACHE wchar_t cachepath[MAX_PATH], cachedirectorypath[MAX_PATH], newcachepath[MAX_PATH + 50]; @@ -124,9 +124,9 @@ int SiteDeleted(WPARAM wParam, LPARAM) cacheend++; *cacheend = '\0'; - mir_sntprintf(cachedirectorypath, L"%s" MODULENAMEW L"cache\\", cachepath); + mir_snwprintf(cachedirectorypath, L"%s" MODULENAMEW L"cache\\", cachepath); CreateDirectory(cachedirectorypath, NULL); - mir_sntprintf(newcachepath, L"%s" MODULENAMEW L"cache\\%s.txt", cachepath, contactName); + mir_snwprintf(newcachepath, L"%s" MODULENAMEW L"cache\\%s.txt", cachepath, contactName); // file exists? if ( _waccess(newcachepath, 0) != -1) { FILE *pcachefile = _wfopen(newcachepath, L"r"); @@ -149,7 +149,7 @@ INT_PTR OpenCacheDir(WPARAM, LPARAM) cacheend++; *cacheend = '\0'; - mir_sntprintf(cachedirectorypath, L"%s" MODULENAMEW L"cache\\%s", cachepath, cacheend); + mir_snwprintf(cachedirectorypath, L"%s" MODULENAMEW L"cache\\%s", cachepath, cacheend); if( _waccess(cachedirectorypath, 0) != 0) WErrorPopup((UINT_PTR)"ERROR", TranslateT("Cache folder does not exist.")); @@ -167,7 +167,7 @@ INT_PTR PingWebsiteMenuCommand(WPARAM wParam, LPARAM) return 0; } - ptrT url( db_get_tsa(wParam, MODULENAME, "URL")); + ptrW url( db_get_tsa(wParam, MODULENAME, "URL")); if (url == NULL) return 0; @@ -319,12 +319,12 @@ INT_PTR BasicSearch(WPARAM, LPARAM lParam) static wchar_t buf[300]; if (lParam) - mir_tstrncpy(buf, (const wchar_t*) lParam, 256); + mir_wstrncpy(buf, (const wchar_t*) lParam, 256); if (searchId != -1) return 0; // only one search at a time - mir_tstrncpy(sID, (wchar_t*)lParam, _countof(sID)); + mir_wstrncpy(sID, (wchar_t*)lParam, _countof(sID)); searchId = 1; // create a thread for the ID search @@ -355,7 +355,7 @@ INT_PTR AddToList(WPARAM, LPARAM lParam) // check ID to see if the contact already exist in the database if (db_get_ts(hContact, MODULENAME, "URL", &dbv)) continue; - if (!mir_tstrcmpi(psr->nick.w, dbv.ptszVal)) { + if (!mir_wstrcmpi(psr->nick.w, dbv.ptszVal)) { // remove the flag for not on list and hidden, thus make the // contact visible // and add them on the list @@ -406,7 +406,7 @@ INT_PTR AddToList(WPARAM, LPARAM lParam) for (MCONTACT hContact2 = db_find_first(MODULENAME); hContact2 != NULL; hContact2 = db_find_next(hContact2, MODULENAME)) { if (!db_get_ts(hContact2, MODULENAME, PRESERVE_NAME_KEY, &dbv)) { - if (!mir_tstrcmpi(Newnick, dbv.ptszVal)) { + if (!mir_wstrcmpi(Newnick, dbv.ptszVal)) { // remove the flag for not on list and hidden, thus make the // contact visible // and add them on the list @@ -427,7 +427,7 @@ INT_PTR AddToList(WPARAM, LPARAM lParam) wchar_t ranStr[10]; _itow((int) 10000 *rand() / (RAND_MAX + 1.0), ranStr, 10); - mir_tstrcat(Newnick, ranStr); + mir_wstrcat(Newnick, ranStr); } //end convert diff --git a/plugins/WhenWasIt/src/dlg_handlers.cpp b/plugins/WhenWasIt/src/dlg_handlers.cpp index 3b269468c9..24af71cc3d 100644 --- a/plugins/WhenWasIt/src/dlg_handlers.cpp +++ b/plugins/WhenWasIt/src/dlg_handlers.cpp @@ -124,7 +124,7 @@ SIZE GetControlTextSize(HWND hCtrl) wchar_t buffer[maxSize];
SIZE size;
GetWindowText(hCtrl, buffer, _countof(buffer));
- GetTextExtentPoint32(hDC, buffer, (int)mir_tstrlen(buffer), &size);
+ GetTextExtentPoint32(hDC, buffer, (int)mir_wstrlen(buffer), &size);
SelectObject(hDC, oldFont);
ReleaseDC(hCtrl, hDC);
return size;
@@ -144,7 +144,7 @@ int EnlargeControl(HWND hCtrl, HWND, SIZE oldSize) wchar_t *strtrim(wchar_t *str)
{
size_t i = 0;
- size_t len = mir_tstrlen(str);
+ size_t len = mir_wstrlen(str);
while ((i < len) && (str[i] == ' ')) { i++; }
if (i) {
memmove(str, str + i, len - i + 1);
@@ -195,7 +195,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara SetDlgItemText(hWnd, IDC_DAYS_IN_ADVANCE, buffer);
_itow(commonData.checkInterval, buffer, 10);
SetDlgItemText(hWnd, IDC_CHECK_INTERVAL, buffer);
- mir_sntprintf(buffer, L"%d|%d", commonData.popupTimeout, commonData.popupTimeoutToday);
+ mir_snwprintf(buffer, L"%d|%d", commonData.popupTimeout, commonData.popupTimeoutToday);
SetDlgItemText(hWnd, IDC_POPUP_TIMEOUT, buffer);
_itow(commonData.cSoundNearDays, buffer, 10);
SetDlgItemText(hWnd, IDC_SOUND_NEAR_DAYS_EDIT, buffer);
@@ -327,11 +327,11 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara if (pos) {
wchar_t tmp[128];
*pos = 0;
- mir_tstrcpy(tmp, buffer);
+ mir_wstrcpy(tmp, buffer);
strtrim(tmp);
commonData.popupTimeout = _wtol(tmp);
- mir_tstrcpy(tmp, pos + 1);
+ mir_wstrcpy(tmp, pos + 1);
strtrim(tmp);
commonData.popupTimeoutToday = _wtol(tmp);
@@ -417,7 +417,7 @@ INT_PTR CALLBACK DlgProcAddBirthday(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l char *szProto = GetContactProto(hContact);
wchar_t buffer[2048];
- mir_sntprintf(buffer, TranslateT("Set birthday for %s:"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_snwprintf(buffer, TranslateT("Set birthday for %s:"), pcli->pfnGetContactDisplayName(hContact, 0));
SetWindowText(hWnd, buffer);
HWND hDate = GetDlgItem(hWnd, IDC_DATE);
@@ -441,7 +441,7 @@ INT_PTR CALLBACK DlgProcAddBirthday(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l case DOB_PROTOCOL:
DateTime_SetMonthCalColor(hDate, MCSC_TITLEBK, COLOR_PROTOCOL);
- mir_sntprintf(buffer, TranslateT("%S protocol"), szProto);
+ mir_snwprintf(buffer, TranslateT("%S protocol"), szProto);
szCurrentModuleTooltip = buffer;
break;
@@ -560,7 +560,7 @@ INT_PTR CALLBACK BirthdaysCompare(LPARAM lParam1, LPARAM lParam2, LPARAM myParam else
res = (value1 != value2);
}
- else res = mir_tstrcmpi(text1, text2);
+ else res = mir_wstrcmpi(text1, text2);
res = (params.column == lastColumn) ? -res : res;
return res;
@@ -609,22 +609,22 @@ int UpdateBirthdayEntry(HWND hList, MCONTACT hContact, int entry, int bShowAll, wchar_t buffer[2048];
if ((dtb <= 366) && (dtb >= 0))
- mir_sntprintf(buffer, L"%d", dtb);
+ mir_snwprintf(buffer, L"%d", dtb);
else
- mir_sntprintf(buffer, NA);
+ mir_snwprintf(buffer, NA);
ListView_SetItemText(hList, entry, 2, buffer);
if ((month != 0) && (day != 0))
- mir_sntprintf(buffer, L"%04d-%02d-%02d", year, month, day);
+ mir_snwprintf(buffer, L"%04d-%02d-%02d", year, month, day);
else
- mir_sntprintf(buffer, NA);
+ mir_snwprintf(buffer, NA);
ListView_SetItemText(hList, entry, 3, buffer);
if (age < 400 && age > 0) //hopefully noone lives longer than this :)
- mir_sntprintf(buffer, L"%d", age);
+ mir_snwprintf(buffer, L"%d", age);
else
- mir_sntprintf(buffer, NA);
+ mir_snwprintf(buffer, NA);
ListView_SetItemText(hList, entry, 4, buffer);
ListView_SetItemText(hList, entry, 5, GetBirthdayModule(module, hContact));
@@ -694,7 +694,7 @@ void SetBirthdaysCount(HWND hWnd) {
int count = ListView_GetItemCount((GetDlgItem(hWnd, IDC_BIRTHDAYS_LIST)));
wchar_t title[512];
- mir_sntprintf(title, TranslateT("Birthday list (%d)"), count);
+ mir_snwprintf(title, TranslateT("Birthday list (%d)"), count);
SetWindowText(hWnd, title);
}
@@ -881,7 +881,7 @@ INT_PTR CALLBACK DlgProcUpcoming(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar const int MAX_SIZE = 512;
wchar_t buffer[MAX_SIZE];
timeout--;
- mir_sntprintf(buffer, (timeout != 2) ? TranslateT("Closing in %d seconds") : TranslateT("Closing in %d second"), timeout);
+ mir_snwprintf(buffer, (timeout != 2) ? TranslateT("Closing in %d seconds") : TranslateT("Closing in %d second"), timeout);
SetDlgItemText(hWnd, IDC_CLOSE, buffer);
if (timeout <= 0)
@@ -914,9 +914,9 @@ INT_PTR CALLBACK DlgProcUpcoming(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar ListView_InsertItem(hList, &item);
wchar_t buffer[512];
- mir_sntprintf(buffer, L"%d", data->age);
+ mir_snwprintf(buffer, L"%d", data->age);
ListView_SetItemText(hList, index, 1, buffer);
- mir_sntprintf(buffer, L"%d", data->dtb);
+ mir_snwprintf(buffer, L"%d", data->dtb);
ListView_SetItemText(hList, index, 2, buffer);
BirthdaysSortParams params = { 0 };
diff --git a/plugins/WhenWasIt/src/notifiers.cpp b/plugins/WhenWasIt/src/notifiers.cpp index f7eeb0c150..c4869a53dd 100644 --- a/plugins/WhenWasIt/src/notifiers.cpp +++ b/plugins/WhenWasIt/src/notifiers.cpp @@ -43,11 +43,11 @@ void PopupNotifyNoBirthdays() wchar_t *BuildDTBText(int dtb, wchar_t *name, wchar_t *text, int size)
{
if (dtb > 1)
- mir_sntprintf(text, size, TranslateT("%s has birthday in %d days."), name, dtb);
+ mir_snwprintf(text, size, TranslateT("%s has birthday in %d days."), name, dtb);
else if (dtb == 1)
- mir_sntprintf(text, size, TranslateT("%s has birthday tomorrow."), name);
+ mir_snwprintf(text, size, TranslateT("%s has birthday tomorrow."), name);
else
- mir_sntprintf(text, size, TranslateT("%s has birthday today."), name);
+ mir_snwprintf(text, size, TranslateT("%s has birthday today."), name);
return text;
}
@@ -55,11 +55,11 @@ wchar_t *BuildDTBText(int dtb, wchar_t *name, wchar_t *text, int size) wchar_t *BuildDABText(int dab, wchar_t *name, wchar_t *text, int size)
{
if (dab > 1)
- mir_sntprintf(text, size, TranslateT("%s had birthday %d days ago."), name, dab);
+ mir_snwprintf(text, size, TranslateT("%s had birthday %d days ago."), name, dab);
else if (dab == 1)
- mir_sntprintf(text, size, TranslateT("%s had birthday yesterday."), name);
+ mir_snwprintf(text, size, TranslateT("%s had birthday yesterday."), name);
else
- mir_sntprintf(text, size, TranslateT("%s has birthday today (Should not happen, please report)."), name);
+ mir_snwprintf(text, size, TranslateT("%s has birthday today (Should not happen, please report)."), name);
return text;
}
@@ -81,7 +81,7 @@ int PopupNotifyBirthday(MCONTACT hContact, int dtb, int age) pd.PluginWindowProc = DlgProcPopup;
pd.lchIcon = GetDTBIcon(dtb);
- mir_sntprintf(pd.lptzContactName, MAX_CONTACTNAME, TranslateT("Birthday - %s"), name);
+ mir_snwprintf(pd.lptzContactName, MAX_CONTACTNAME, TranslateT("Birthday - %s"), name);
wchar_t *sex;
switch (toupper(gender)) {
case 'M':
@@ -96,12 +96,12 @@ int PopupNotifyBirthday(MCONTACT hContact, int dtb, int age) }
if (age > 0) {
if (dtb > 0)
- mir_sntprintf(pd.lptzText, MAX_SECONDLINE, TranslateT("%s\n%s will be %d years old."), text, sex, age);
+ mir_snwprintf(pd.lptzText, MAX_SECONDLINE, TranslateT("%s\n%s will be %d years old."), text, sex, age);
else
- mir_sntprintf(pd.lptzText, MAX_SECONDLINE, TranslateT("%s\n%s just turned %d."), text, sex, age);
+ mir_snwprintf(pd.lptzText, MAX_SECONDLINE, TranslateT("%s\n%s just turned %d."), text, sex, age);
}
else
- mir_tstrncpy(pd.lptzText, text, MAX_SECONDLINE - 1);
+ mir_wstrncpy(pd.lptzText, text, MAX_SECONDLINE - 1);
PUAddPopupT(&pd);
@@ -125,7 +125,7 @@ int PopupNotifyMissedBirthday(MCONTACT hContact, int dab, int age) pd.PluginWindowProc = DlgProcPopup;
pd.lchIcon = GetDTBIcon(dab);
- mir_sntprintf(pd.lptzContactName, MAX_CONTACTNAME, TranslateT("Birthday - %s"), name);
+ mir_snwprintf(pd.lptzContactName, MAX_CONTACTNAME, TranslateT("Birthday - %s"), name);
wchar_t *sex;
switch (toupper(gender)) {
case 'M':
@@ -140,12 +140,12 @@ int PopupNotifyMissedBirthday(MCONTACT hContact, int dab, int age) }
if (age > 0){
if (dab > 0)
- mir_sntprintf(pd.lptzText, MAX_SECONDLINE, TranslateT("%s\n%s just turned %d."), text, sex, age);
+ mir_snwprintf(pd.lptzText, MAX_SECONDLINE, TranslateT("%s\n%s just turned %d."), text, sex, age);
else
- mir_sntprintf(pd.lptzText, MAX_SECONDLINE, TranslateT("%s\n%s just turned %d."), text, sex, age);
+ mir_snwprintf(pd.lptzText, MAX_SECONDLINE, TranslateT("%s\n%s just turned %d."), text, sex, age);
}
else
- mir_tstrncpy(pd.lptzText, text, MAX_SECONDLINE - 1);
+ mir_wstrncpy(pd.lptzText, text, MAX_SECONDLINE - 1);
PUAddPopupT(&pd);
return 0;
diff --git a/plugins/WhenWasIt/src/services.cpp b/plugins/WhenWasIt/src/services.cpp index a40f104f13..7ac4d016a5 100644 --- a/plugins/WhenWasIt/src/services.cpp +++ b/plugins/WhenWasIt/src/services.cpp @@ -217,7 +217,7 @@ INT_PTR ImportBirthdaysService(WPARAM, LPARAM) of.lStructSize = sizeof(OPENFILENAME);
//of.hInstance = hInstance;
wchar_t filter[MAX_PATH];
- mir_sntprintf(filter, L"%s (*" BIRTHDAY_EXTENSION L")%c*" BIRTHDAY_EXTENSION L"%c", TranslateT("Birthdays files"), 0, 0);
+ mir_snwprintf(filter, L"%s (*" BIRTHDAY_EXTENSION L")%c*" BIRTHDAY_EXTENSION L"%c", TranslateT("Birthdays files"), 0, 0);
of.lpstrFilter = filter;
of.lpstrFile = fileName;
of.nMaxFile = _countof(fileName);
@@ -226,7 +226,7 @@ INT_PTR ImportBirthdaysService(WPARAM, LPARAM) if (GetOpenFileName(&of)) {
wchar_t buffer[2048];
- mir_sntprintf(buffer, TranslateT("Importing birthdays from file: %s"), fileName);
+ mir_snwprintf(buffer, TranslateT("Importing birthdays from file: %s"), fileName);
ShowPopupMessage(TranslateT("WhenWasIt"), buffer, hImportBirthdays);
DoImport(fileName);
ShowPopupMessage(TranslateT("WhenWasIt"), TranslateT("Done importing birthdays"), hImportBirthdays);
@@ -242,7 +242,7 @@ INT_PTR ExportBirthdaysService(WPARAM, LPARAM) of.lStructSize = sizeof(OPENFILENAME);
//of.hInstance = hInstance;
wchar_t filter[MAX_PATH];
- mir_sntprintf(filter, L"%s (*" BIRTHDAY_EXTENSION L")%c*" BIRTHDAY_EXTENSION L"%c%s (*.*)%c*.*%c", TranslateT("Birthdays files"), 0, 0, TranslateT("All Files"), 0, 0);
+ mir_snwprintf(filter, L"%s (*" BIRTHDAY_EXTENSION L")%c*" BIRTHDAY_EXTENSION L"%c%s (*.*)%c*.*%c", TranslateT("Birthdays files"), 0, 0, TranslateT("All Files"), 0, 0);
of.lpstrFilter = filter;
of.lpstrFile = fileName;
of.nMaxFile = _countof(fileName);
@@ -252,9 +252,9 @@ INT_PTR ExportBirthdaysService(WPARAM, LPARAM) wchar_t buffer[2048];
wchar_t *fn = wcsrchr(fileName, '\\') + 1;
if (!wcschr(fn, '.'))
- mir_tstrcat(fileName, BIRTHDAY_EXTENSION);
+ mir_wstrcat(fileName, BIRTHDAY_EXTENSION);
- mir_sntprintf(buffer, TranslateT("Exporting birthdays to file: %s"), fileName);
+ mir_snwprintf(buffer, TranslateT("Exporting birthdays to file: %s"), fileName);
ShowPopupMessage(TranslateT("WhenWasIt"), buffer, hExportBirthdays);
DoExport(fileName);
ShowPopupMessage(TranslateT("WhenWasIt"), TranslateT("Done exporting birthdays"), hExportBirthdays);
diff --git a/plugins/WhenWasIt/src/utils.cpp b/plugins/WhenWasIt/src/utils.cpp index 6c0c253a12..2b1a8e3551 100644 --- a/plugins/WhenWasIt/src/utils.cpp +++ b/plugins/WhenWasIt/src/utils.cpp @@ -145,7 +145,7 @@ wchar_t* GetContactID(MCONTACT hContact) wchar_t* GetContactID(MCONTACT hContact, char *szProto)
{
- ptrT res(Contact_GetInfo(CNF_UNIQUEID, hContact, szProto));
+ ptrW res(Contact_GetInfo(CNF_UNIQUEID, hContact, szProto));
return (res) ? wcsdup(res) : NULL;
}
@@ -155,7 +155,7 @@ MCONTACT GetContactFromID(wchar_t *szID, char *szProto) char *m_szProto = GetContactProto(hContact);
wchar_t *szHandle = GetContactID(hContact, szProto);
if (szHandle) {
- bool found = (!mir_tstrcmpi(szHandle, szID) && !_stricmp(szProto, m_szProto));
+ bool found = (!mir_wstrcmpi(szHandle, szID) && !_stricmp(szProto, m_szProto));
free(szHandle);
if (found)
return hContact;
diff --git a/plugins/WhoUsesMyFiles/src/list.cpp b/plugins/WhoUsesMyFiles/src/list.cpp index 2a1c189c9b..028d17f035 100644 --- a/plugins/WhoUsesMyFiles/src/list.cpp +++ b/plugins/WhoUsesMyFiles/src/list.cpp @@ -13,18 +13,18 @@ PWumf new_wumf( DWORD dwID, if (!w)
return NULL;
- w->szUser = mir_tstrdup(szUser);
- w->szPath = mir_tstrdup(szPath);
- w->szComp = mir_tstrdup(szComp);
- w->szUNC = mir_tstrdup(szUNC);
+ w->szUser = mir_wstrdup(szUser);
+ w->szPath = mir_wstrdup(szPath);
+ w->szComp = mir_wstrdup(szComp);
+ w->szUNC = mir_wstrdup(szUNC);
switch(dwPerm) {
- case PERM_FILE_READ: mir_tstrcpy(w->szPerm, L"Read");break;
- case PERM_FILE_WRITE: mir_tstrcpy(w->szPerm, L"Write");break;
- case PERM_FILE_CREATE: mir_tstrcpy(w->szPerm, L"Create");break;
- default: mir_tstrcpy(w->szPerm, L"Execute");
+ case PERM_FILE_READ: mir_wstrcpy(w->szPerm, L"Read");break;
+ case PERM_FILE_WRITE: mir_wstrcpy(w->szPerm, L"Write");break;
+ case PERM_FILE_CREATE: mir_wstrcpy(w->szPerm, L"Create");break;
+ default: mir_wstrcpy(w->szPerm, L"Execute");
}
- mir_sntprintf(w->szID, L"%i", dwID);
+ mir_snwprintf(w->szID, L"%i", dwID);
w->dwID = dwID;
w->dwSess = dwSess;
diff --git a/plugins/WhoUsesMyFiles/src/wumf.cpp b/plugins/WhoUsesMyFiles/src/wumf.cpp index 00508fe262..99e2102d04 100644 --- a/plugins/WhoUsesMyFiles/src/wumf.cpp +++ b/plugins/WhoUsesMyFiles/src/wumf.cpp @@ -5,8 +5,8 @@ #define NAME "WUMF"
#define WM_MYCMD 0x0401
-static PWumf list = NULL;
-static PWumf lst = NULL;
+PWumf list = NULL;
+PWumf lst = NULL;
HANDLE hLogger = NULL;
BOOL wumf();
@@ -140,7 +140,7 @@ void LogWumf(PWumf w) hLogger = mir_createLog("wumf", L"WhoIsUsingMyFiles log file", WumfOptions.LogFile, 0);
if (hLogger == NULL) {
wchar_t str[256];
- mir_sntprintf(str, L"Can't open log file %s", WumfOptions.LogFile);
+ mir_snwprintf(str, L"Can't open log file %s", WumfOptions.LogFile);
MessageBox(NULL, str, TranslateT("Error opening file"), MB_OK | MB_ICONSTOP);
WumfOptions.LogToFile = FALSE;
return;
@@ -153,7 +153,7 @@ void LogWumf(PWumf w) wchar_t lpDateStr[20], lpTimeStr[20];
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &time, NULL, lpDateStr, 20);
GetTimeFormat(LOCALE_USER_DEFAULT, TIME_FORCE24HOURFORMAT | TIME_NOTIMEMARKER, &time, NULL, lpTimeStr, 20);
- mir_writeLogT(hLogger, L"%s %s %20s\t%s\r\n", lpDateStr, lpTimeStr, w->szUser, w->szPath);
+ mir_writeLogW(hLogger, L"%s %s %20s\t%s\r\n", lpDateStr, lpTimeStr, w->szUser, w->szPath);
}
BOOL wumf()
diff --git a/plugins/WhoUsesMyFiles/src/wumfplug.cpp b/plugins/WhoUsesMyFiles/src/wumfplug.cpp index f39cb61e82..fc2ff253db 100644 --- a/plugins/WhoUsesMyFiles/src/wumfplug.cpp +++ b/plugins/WhoUsesMyFiles/src/wumfplug.cpp @@ -119,8 +119,8 @@ void ShowWumfPopup(PWumf w) wchar_t text[512], title[512];
if (!WumfOptions.AlertFolders && (w->dwAttr & FILE_ATTRIBUTE_DIRECTORY)) return;
- mir_sntprintf(title, L"%s (%s)", w->szComp, w->szUser);
- mir_sntprintf(text, L"%s (%s)", w->szPath, w->szPerm);
+ mir_snwprintf(title, L"%s (%s)", w->szComp, w->szUser);
+ mir_snwprintf(text, L"%s (%s)", w->szPath, w->szPerm);
ShowThePopup(w, title, text);
}
@@ -137,8 +137,8 @@ void ShowThePopup(PWumf w, LPTSTR title, LPTSTR text) else if (WumfOptions.DelaySet)
ppd.iSeconds = WumfOptions.DelaySec;
- mir_tstrncpy(ppd.lptzContactName, title, MAX_CONTACTNAME);
- mir_tstrncpy(ppd.lptzText, text, MAX_SECONDLINE);
+ mir_wstrncpy(ppd.lptzContactName, title, MAX_CONTACTNAME);
+ mir_wstrncpy(ppd.lptzText, text, MAX_SECONDLINE);
if (WumfOptions.UseWinColor) {
ppd.colorBack = GetSysColor(COLOR_WINDOW);
ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
@@ -268,13 +268,13 @@ void ChooseFile(HWND hwndDlg) HANDLE hf = CreateFile(szFile,GENERIC_WRITE,0,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL, NULL);
if (hf != INVALID_HANDLE_VALUE) {
SetDlgItemText(hwndDlg,IDC_FILE,szFile);
- mir_tstrncpy(WumfOptions.LogFile, szFile, MAX_PATH);
+ mir_wstrncpy(WumfOptions.LogFile, szFile, MAX_PATH);
CloseHandle(hf);
}
}
else if (CommDlgExtendedError() != 0) {
wchar_t str[256];
- mir_sntprintf(str, TranslateT("Common Dialog Error 0x%lx"), CommDlgExtendedError());
+ mir_snwprintf(str, TranslateT("Common Dialog Error 0x%lx"), CommDlgExtendedError());
MessageBox(hwndDlg, str, TranslateT("Error"), MB_OK | MB_ICONSTOP);
}
}
diff --git a/plugins/WinterSpeak/src/EventInformation.cpp b/plugins/WinterSpeak/src/EventInformation.cpp index 451449f343..f9a9799a4f 100644 --- a/plugins/WinterSpeak/src/EventInformation.cpp +++ b/plugins/WinterSpeak/src/EventInformation.cpp @@ -67,7 +67,7 @@ std::wstring EventInformation::getMessage() {
const std::wstring intro = TranslateT("%u says");
- return intro + L" " + mir_a2t_cp((char*)m_event_info.pBlob, CP_UTF8);
+ return intro + L" " + mir_a2u_cp((char*)m_event_info.pBlob, CP_UTF8);
}
//------------------------------------------------------------------------------
diff --git a/plugins/WinterSpeak/src/SpeechApi40a.cpp b/plugins/WinterSpeak/src/SpeechApi40a.cpp index 518e9ed602..fbb6851364 100644 --- a/plugins/WinterSpeak/src/SpeechApi40a.cpp +++ b/plugins/WinterSpeak/src/SpeechApi40a.cpp @@ -88,7 +88,7 @@ bool SpeechApi40a::isLoaded() const //------------------------------------------------------------------------------
bool SpeechApi40a::say(const std::wstring &sentence)
{
- //std::string text = mir_t2a_cp(sentence.c_str(), CP_ACP);
+ //std::string text = mir_u2a_cp(sentence.c_str(), CP_ACP);
//MessageBoxA(NULL, text.c_str(), "TTS4", MB_OK);
bool ret = true;
diff --git a/plugins/XSoundNotify/src/dialog.cpp b/plugins/XSoundNotify/src/dialog.cpp index 5a6bff9772..ca68cabc9f 100644 --- a/plugins/XSoundNotify/src/dialog.cpp +++ b/plugins/XSoundNotify/src/dialog.cpp @@ -35,17 +35,17 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP break;
case DBVT_ASCIIZ:
- mir_tstrcpy(uid, _A2T(dbvuid.pszVal));
+ mir_wstrcpy(uid, _A2T(dbvuid.pszVal));
break;
case DBVT_UTF8:
- mir_tstrcpy(uid, ptrT(mir_utf8decodeT(dbvuid.pszVal)));
+ mir_wstrcpy(uid, ptrW(mir_utf8decodeW(dbvuid.pszVal)));
break;
}
wchar_t *nick = (wchar_t *)pcli->pfnGetContactDisplayName(hContact, 0);
wchar_t value[100];
- mir_sntprintf(value, TranslateT("Custom sound for %s (%s)"), nick, uid);
+ mir_snwprintf(value, TranslateT("Custom sound for %s (%s)"), nick, uid);
SetWindowText(hwndDlg, value);
db_free(&dbvuid);
}
@@ -67,7 +67,7 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP CheckDlgButton(hwndDlg, IDC_CONT_IGNORE_SOUND, db_get_b(hContact, SETTINGSNAME, SETTINGSIGNOREKEY, 0) ? BST_CHECKED : BST_UNCHECKED);
p = XSN_Users.find((XSN_Data *)&hContact);
if (p == NULL) {
- ptrT name(db_get_tsa(hContact, SETTINGSNAME, SETTINGSKEY));
+ ptrW name(db_get_tsa(hContact, SETTINGSNAME, SETTINGSKEY));
if (name != NULL)
XSN_Users.insert(new XSN_Data(hContact, name, IsDlgButtonChecked(hwndDlg, IDC_CONT_IGNORE_SOUND) ? 1 : 0));
}
@@ -79,7 +79,7 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP case IDOK:
p = XSN_Users.find((XSN_Data *)&hContact);
if (p != NULL) {
- if (mir_tstrcmpi(p->path, L"")) {
+ if (mir_wstrcmpi(p->path, L"")) {
wchar_t shortpath[MAX_PATH];
PathToRelativeT(p->path, shortpath);
db_set_ts(hContact, SETTINGSNAME, SETTINGSKEY, shortpath);
@@ -100,9 +100,9 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP ofn.lStructSize = sizeof(ofn);
wchar_t tmp[MAX_PATH];
if (GetModuleHandle(L"bass_interface.dll"))
- mir_sntprintf(tmp, L"%s (*.wav, *.mp3, *.ogg)%c*.wav;*.mp3;*.ogg%c%c", TranslateT("Sound files"), 0, 0, 0);
+ mir_snwprintf(tmp, L"%s (*.wav, *.mp3, *.ogg)%c*.wav;*.mp3;*.ogg%c%c", TranslateT("Sound files"), 0, 0, 0);
else
- mir_sntprintf(tmp, L"%s (*.wav)%c*.wav%c%c", TranslateT("WAV files"), 0, 0, 0);
+ mir_snwprintf(tmp, L"%s (*.wav)%c*.wav%c%c", TranslateT("WAV files"), 0, 0, 0);
ofn.lpstrFilter = tmp;
ofn.hwndOwner = 0;
ofn.lpstrFile = FileName;
diff --git a/plugins/XSoundNotify/src/options.cpp b/plugins/XSoundNotify/src/options.cpp index 775cfc6ffd..61a846a53e 100644 --- a/plugins/XSoundNotify/src/options.cpp +++ b/plugins/XSoundNotify/src/options.cpp @@ -66,21 +66,21 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l break;
case DBVT_ASCIIZ:
- mir_tstrcpy(uid, _A2T(dbvuid.pszVal));
+ mir_wstrcpy(uid, _A2T(dbvuid.pszVal));
break;
case DBVT_UTF8:
- mir_tstrcpy(uid, ptrT(mir_utf8decodeT(dbvuid.pszVal)));
+ mir_wstrcpy(uid, ptrW(mir_utf8decodeW(dbvuid.pszVal)));
break;
default:
- mir_tstrcpy(uid, TranslateT("(Unknown contact)"));
+ mir_wstrcpy(uid, TranslateT("(Unknown contact)"));
}
wchar_t *nick = (wchar_t *)pcli->pfnGetContactDisplayName(hContact, 0);
- size_t value_max_len = (mir_tstrlen(uid) + mir_tstrlen(nick) + 4);
+ size_t value_max_len = (mir_wstrlen(uid) + mir_wstrlen(nick) + 4);
wchar_t *value = (wchar_t *)mir_alloc(sizeof(wchar_t) * value_max_len);
- mir_sntprintf(value, value_max_len, L"%s (%s)", nick, uid);
+ mir_snwprintf(value, value_max_len, L"%s (%s)", nick, uid);
SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_SETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_ADDSTRING, 0, (LPARAM)value), hContact);
mir_free(value);
db_free(&dbvuid);
@@ -122,9 +122,9 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l ofn.lStructSize = sizeof(ofn);
wchar_t tmp[MAX_PATH];
if (GetModuleHandle(L"bass_interface.dll"))
- mir_sntprintf(tmp, L"%s (*.wav, *.mp3, *.ogg)%c*.wav;*.mp3;*.ogg%c%c", TranslateT("Sound files"), 0, 0, 0);
+ mir_snwprintf(tmp, L"%s (*.wav, *.mp3, *.ogg)%c*.wav;*.mp3;*.ogg%c%c", TranslateT("Sound files"), 0, 0, 0);
else
- mir_sntprintf(tmp, L"%s (*.wav)%c*.wav%c%c", TranslateT("WAV files"), 0, 0, 0);
+ mir_snwprintf(tmp, L"%s (*.wav)%c*.wav%c%c", TranslateT("WAV files"), 0, 0, 0);
ofn.lpstrFilter = tmp;
ofn.hwndOwner = 0;
ofn.lpstrFile = FileName;
@@ -224,7 +224,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l switch (hdr->code) {
case PSN_APPLY:
for (int i = 0; i < XSN_Users.getCount(); i++) {
- if (mir_tstrcmpi(XSN_Users[i]->path, L"")) {
+ if (mir_wstrcmpi(XSN_Users[i]->path, L"")) {
wchar_t shortpath[MAX_PATH];
PathToRelativeT(XSN_Users[i]->path, shortpath);
db_set_ts(XSN_Users[i]->hContact, SETTINGSNAME, SETTINGSKEY, shortpath);
diff --git a/plugins/XSoundNotify/src/xsn_main.cpp b/plugins/XSoundNotify/src/xsn_main.cpp index afb720d85b..02ea729792 100644 --- a/plugins/XSoundNotify/src/xsn_main.cpp +++ b/plugins/XSoundNotify/src/xsn_main.cpp @@ -77,7 +77,7 @@ void InitSelfSounds() mir_snprintf(namebuf, "%s%s", protos[i]->szModuleName, selfSounds[j].szName);
wchar_t infobuf[256];
- mir_sntprintf(infobuf, L"%s [%s]", TranslateT("Self status"), protos[i]->tszAccountName);
+ mir_snwprintf(infobuf, L"%s [%s]", TranslateT("Self status"), protos[i]->tszAccountName);
SkinAddNewSoundExT(namebuf, infobuf, pcli->pfnGetStatusModeDescription(selfSounds[j].iStatus, 0));
}
}
@@ -141,7 +141,7 @@ static int ProcessChatEvent(WPARAM, LPARAM lParam) MCONTACT hContact = pci->FindRoom(gcd->pszModule, gcd->ptszID);
if (hContact != 0) {
- ptrT nick(db_get_tsa(hContact, gcd->pszModule, "MyNick"));
+ ptrW nick(db_get_tsa(hContact, gcd->pszModule, "MyNick"));
if (nick == NULL || gce->ptszText == NULL)
return 0;
if (wcsstr(gce->ptszText, nick)) {
diff --git a/plugins/YAMN/src/account.cpp b/plugins/YAMN/src/account.cpp index a79c650ce7..fa1262c1da 100644 --- a/plugins/YAMN/src/account.cpp +++ b/plugins/YAMN/src/account.cpp @@ -224,7 +224,7 @@ DWORD ReadStringFromMemory(char **Parser,wchar_t *End,char **StoreTo,wchar_t *De Finder=*Parser; while((*Finder != (wchar_t)0) && (Finder<=End)) Finder++; - mir_sntprintf(Debug, L"%s: %s,length is %d, remaining %d chars", DebugString, *Parser, Finder-*Parser, End-Finder); + mir_snwprintf(Debug, L"%s: %s,length is %d, remaining %d chars", DebugString, *Parser, Finder-*Parser, End-Finder); MessageBox(NULL,Debug,L"debug",MB_OK); if (Finder>=End) return EACC_FILECOMPATIBILITY; @@ -279,7 +279,7 @@ DWORD ReadStringFromMemoryW(WCHAR **Parser,wchar_t *End,WCHAR **StoreTo,WCHAR *D Finder=*Parser; while((*Finder != (WCHAR)0) && (Finder<=(WCHAR *)End)) Finder++; - mir_sntprintf(Debug, L"%s: %s,length is %d, remaining %d chars", DebugString, *Parser, Finder-*Parser, (WCHAR *)End-Finder); + mir_snwprintf(Debug, L"%s: %s,length is %d, remaining %d chars", DebugString, *Parser, Finder-*Parser, (WCHAR *)End-Finder); MessageBoxW(NULL,Debug,L"debug",MB_OK); if (Finder>=(WCHAR *)End) return EACC_FILECOMPATIBILITY; @@ -335,7 +335,7 @@ static DWORD ReadNotificationFromMemory(char **Parser, char *End, YAMN_NOTIFICAT if (*Parser >= End) return EACC_FILECOMPATIBILITY; #ifdef DEBUG_FILEREAD - mir_sntprintf(Debug, L"NFlags: %04x, remaining %d chars", Which->Flags, End-*Parser); + mir_snwprintf(Debug, L"NFlags: %04x, remaining %d chars", Which->Flags, End-*Parser); MessageBox(NULL,Debug,L"debug",MB_OK); #endif @@ -344,7 +344,7 @@ static DWORD ReadNotificationFromMemory(char **Parser, char *End, YAMN_NOTIFICAT if (*Parser >= End) return EACC_FILECOMPATIBILITY; #ifdef DEBUG_FILEREAD - mir_sntprintf(Debug, L"PopupB: %04x, remaining %d chars", Which->PopupB, End-*Parser); + mir_snwprintf(Debug, L"PopupB: %04x, remaining %d chars", Which->PopupB, End-*Parser); MessageBox(NULL,Debug,L"debug",MB_OK); #endif Which->PopupT = *(COLORREF *)(*Parser); @@ -352,7 +352,7 @@ static DWORD ReadNotificationFromMemory(char **Parser, char *End, YAMN_NOTIFICAT if (*Parser >= End) return EACC_FILECOMPATIBILITY; #ifdef DEBUG_FILEREAD - mir_sntprintf(Debug, L"PopupT: %04x, remaining %d chars", Which->PopupT, End-*Parser); + mir_snwprintf(Debug, L"PopupT: %04x, remaining %d chars", Which->PopupT, End-*Parser); MessageBox(NULL,Debug,L"debug",MB_OK); #endif Which->PopupTime = *(DWORD *)(*Parser); @@ -360,7 +360,7 @@ static DWORD ReadNotificationFromMemory(char **Parser, char *End, YAMN_NOTIFICAT if (*Parser >= End) return EACC_FILECOMPATIBILITY; #ifdef DEBUG_FILEREAD - mir_sntprintf(Debug, L"PopupTime: %04x, remaining %d chars", Which->PopupTime, End-*Parser); + mir_snwprintf(Debug, L"PopupTime: %04x, remaining %d chars", Which->PopupTime, End-*Parser); MessageBox(NULL,Debug,L"debug",MB_OK); #endif @@ -510,7 +510,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which, char **Parser, char *End) if (*Parser >= End) return EACC_FILECOMPATIBILITY; #ifdef DEBUG_FILEREAD - mir_sntprintf(Debug, L"Port: %d, remaining %d chars", Which->Server->Port, End-*Parser); + mir_snwprintf(Debug, L"Port: %d, remaining %d chars", Which->Server->Port, End-*Parser); MessageBox(NULL,Debug,L"debug",MB_OK); #endif #ifdef DEBUG_FILEREAD @@ -533,19 +533,19 @@ DWORD ReadAccountFromMemory(HACCOUNT Which, char **Parser, char *End) if (*Parser >= End) return EACC_FILECOMPATIBILITY; #ifdef DEBUG_FILEREAD - mir_sntprintf(Debug, L"Flags: %04x, remaining %d chars", Which->Flags, End-*Parser); + mir_snwprintf(Debug, L"Flags: %04x, remaining %d chars", Which->Flags, End-*Parser); MessageBox(NULL,Debug,L"debug",MB_OK); #endif Which->StatusFlags = *(DWORD *)(*Parser); (*Parser) += sizeof(DWORD); #ifdef DEBUG_FILEREAD - mir_sntprintf(Debug, L"STFlags: %04x, remaining %d chars", Which->StatusFlags, End-*Parser); + mir_snwprintf(Debug, L"STFlags: %04x, remaining %d chars", Which->StatusFlags, End-*Parser); MessageBox(NULL,Debug,L"debug",MB_OK); #endif Which->PluginFlags = *(DWORD *)(*Parser); (*Parser) += sizeof(DWORD); #ifdef DEBUG_FILEREAD - mir_sntprintf(Debug, L"PFlags: %04x, remaining %d chars", Which->PluginFlags, End-*Parser); + mir_snwprintf(Debug, L"PFlags: %04x, remaining %d chars", Which->PluginFlags, End-*Parser); MessageBox(NULL,Debug,L"debug",MB_OK); #endif @@ -556,7 +556,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which, char **Parser, char *End) if (*Parser >= End) return EACC_FILECOMPATIBILITY; #ifdef DEBUG_FILEREAD - mir_sntprintf(Debug, L"Interval: %d, remaining %d chars", Which->Interval, End-*Parser); + mir_snwprintf(Debug, L"Interval: %d, remaining %d chars", Which->Interval, End-*Parser); MessageBox(NULL,Debug,L"debug",MB_OK); #endif @@ -599,7 +599,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which, char **Parser, char *End) if (*Parser >= End) return EACC_FILECOMPATIBILITY; #ifdef DEBUG_FILEREAD - mir_sntprintf(Debug, L"LastChecked: %04x, remaining %d chars", Which->LastChecked, End-*Parser); + mir_snwprintf(Debug, L"LastChecked: %04x, remaining %d chars", Which->LastChecked, End-*Parser); MessageBox(NULL,Debug,L"debug",MB_OK); #endif Which->LastSChecked = *(SYSTEMTIME *)(*Parser); @@ -607,7 +607,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which, char **Parser, char *End) if (*Parser >= End) return EACC_FILECOMPATIBILITY; #ifdef DEBUG_FILEREAD - mir_sntprintf(Debug, L"LastSChecked: %04x, remaining %d chars", Which->LastSChecked, End-*Parser); + mir_snwprintf(Debug, L"LastSChecked: %04x, remaining %d chars", Which->LastSChecked, End-*Parser); MessageBox(NULL,Debug,L"debug",MB_OK); #endif Which->LastSynchronised = *(SYSTEMTIME *)(*Parser); @@ -615,7 +615,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which, char **Parser, char *End) if (*Parser >= End) return EACC_FILECOMPATIBILITY; #ifdef DEBUG_FILEREAD - mir_sntprintf(Debug, L"LastSynchronised: %04x, remaining %d chars", Which->LastSynchronised, End-*Parser); + mir_snwprintf(Debug, L"LastSynchronised: %04x, remaining %d chars", Which->LastSynchronised, End-*Parser); MessageBox(NULL,Debug,L"debug",MB_OK); #endif Which->LastMail = *(SYSTEMTIME *)(*Parser); @@ -623,7 +623,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which, char **Parser, char *End) if (*Parser > End) //WARNING! There's only > at the end of testing return EACC_FILECOMPATIBILITY; #ifdef DEBUG_FILEREAD - mir_sntprintf(Debug, L"LastMail: %04x, remaining %d chars", Which->LastMail, End-*Parser); + mir_snwprintf(Debug, L"LastMail: %04x, remaining %d chars", Which->LastMail, End-*Parser); MessageBox(NULL,Debug,L"debug",MB_OK); #endif if (*Parser == End) @@ -1232,14 +1232,14 @@ void WINAPI GetStatusFcn(HACCOUNT Which, wchar_t *Value) return; mir_cslock lck(csAccountStatusCS); - mir_tstrcpy(Value, Which->Status); + mir_wstrcpy(Value, Which->Status); } void WINAPI SetStatusFcn(HACCOUNT Which, wchar_t *Value) { if (Which != NULL) { mir_cslock lck(csAccountStatusCS); - mir_tstrcpy(Which->Status, Value); + mir_wstrcpy(Which->Status, Value); } WindowList_BroadcastAsync(YAMNVar.MessageWnds, WM_YAMN_CHANGESTATUS, (WPARAM)Which, 0); diff --git a/plugins/YAMN/src/browser/badconnect.cpp b/plugins/YAMN/src/browser/badconnect.cpp index d6e4fdf2e6..31cbb57829 100644 --- a/plugins/YAMN/src/browser/badconnect.cpp +++ b/plugins/YAMN/src/browser/badconnect.cpp @@ -119,7 +119,7 @@ INT_PTR CALLBACK DlgProcYAMNBadConnection(HWND hDlg, UINT msg, WPARAM wParam, LP BadConnectPopup.PluginWindowProc = BadConnectPopupProc;
BadConnectPopup.PluginData = ActualAccount;
- mir_tstrncpy(BadConnectPopup.lptzContactName, _A2T(ActualAccount->Name), _countof(BadConnectPopup.lptzContactName));
+ mir_wstrncpy(BadConnectPopup.lptzContactName, _A2T(ActualAccount->Name), _countof(BadConnectPopup.lptzContactName));
}
if (ActualAccount->Plugin->Fcn != NULL && ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr != NULL) {
@@ -257,7 +257,7 @@ void __cdecl BadConnection(void *Param) nid.hIcon = g_LoadIconEx(3);
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
nid.uCallbackMessage = WM_YAMN_NOTIFYICON;
- mir_sntprintf(nid.szTip, L"%S%s", ActualAccount->Name, TranslateT(" - connection error"));
+ mir_snwprintf(nid.szTip, L"%S%s", ActualAccount->Name, TranslateT(" - connection error"));
Shell_NotifyIcon(NIM_ADD, &nid);
}
diff --git a/plugins/YAMN/src/browser/mailbrowser.cpp b/plugins/YAMN/src/browser/mailbrowser.cpp index d768f3e363..2dae05544b 100644 --- a/plugins/YAMN/src/browser/mailbrowser.cpp +++ b/plugins/YAMN/src/browser/mailbrowser.cpp @@ -543,7 +543,7 @@ int AddNewMailsToListView(HWND hListView, HACCOUNT ActualAccount, DWORD nflags) if ((UnicodeHeader.From != NULL) && (UnicodeHeader.FromNick != NULL)) { size_t size = mir_wstrlen(UnicodeHeader.From) + mir_wstrlen(UnicodeHeader.FromNick) + 4; FromStr = new WCHAR[size]; - mir_sntprintf(FromStr, size, L"%s <%s>", UnicodeHeader.FromNick, UnicodeHeader.From); + mir_snwprintf(FromStr, size, L"%s <%s>", UnicodeHeader.FromNick, UnicodeHeader.From); FromStrNew = TRUE; } else if (UnicodeHeader.From != NULL) @@ -569,7 +569,7 @@ int AddNewMailsToListView(HWND hListView, HACCOUNT ActualAccount, DWORD nflags) SendMessage(hListView, LVM_SETITEMTEXT, (WPARAM)item.iItem, (LPARAM)&item); item.iSubItem = 2; - mir_sntprintf(SizeStr, L"%d kB", msgq->MailData->Size / 1024); + mir_snwprintf(SizeStr, L"%d kB", msgq->MailData->Size / 1024); item.pszText = SizeStr; SendMessage(hListView, LVM_SETITEMTEXT, (WPARAM)item.iItem, (LPARAM)&item); @@ -587,8 +587,8 @@ int AddNewMailsToListView(HWND hListView, HACCOUNT ActualAccount, DWORD nflags) } if ((nflags & YAMN_ACC_POP) && (ActualAccount->Flags & YAMN_ACC_POPN) && (msgq->Flags & YAMN_MSG_POPUP) && (msgq->Flags & YAMN_MSG_NEW)) { - mir_tstrncpy(NewMailPopup.lptzContactName, FromStr, _countof(NewMailPopup.lptzContactName)); - mir_tstrncpy(NewMailPopup.lptzText, UnicodeHeader.Subject, _countof(NewMailPopup.lptzText)); + mir_wstrncpy(NewMailPopup.lptzContactName, FromStr, _countof(NewMailPopup.lptzContactName)); + mir_wstrncpy(NewMailPopup.lptzText, UnicodeHeader.Subject, _countof(NewMailPopup.lptzText)); PYAMN_MAILSHOWPARAM MailParam = (PYAMN_MAILSHOWPARAM)malloc(sizeof(YAMN_MAILSHOWPARAM)); if (MailParam) { @@ -634,7 +634,7 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D if ((nflags & YAMN_ACC_CONT) && (MN->Real.PopupRun + MN->Virtual.PopupRun)) { wchar_t tszMsg[250]; - mir_sntprintf(tszMsg, TranslateT("%s : %d new mail message(s), %d total"), _A2T(ActualAccount->Name), MN->Real.PopupNC + MN->Virtual.PopupNC, MN->Real.PopupTC + MN->Virtual.PopupTC); + mir_snwprintf(tszMsg, TranslateT("%s : %d new mail message(s), %d total"), _A2T(ActualAccount->Name), MN->Real.PopupNC + MN->Virtual.PopupNC, MN->Real.PopupTC + MN->Virtual.PopupTC); if (!(nflags & YAMN_ACC_CONTNOEVENT)) { CLISTEVENT evt = {}; @@ -673,8 +673,8 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D NewMailPopup.PluginWindowProc = NewMailPopupProc; NewMailPopup.PluginData = (void *)0; //multiple popups - mir_tstrncpy(NewMailPopup.lptzContactName, _A2T(ActualAccount->Name), _countof(NewMailPopup.lptzContactName)); - mir_sntprintf(NewMailPopup.lptzText, TranslateT("%d new mail message(s), %d total"), MN->Real.PopupNC + MN->Virtual.PopupNC, MN->Real.PopupTC + MN->Virtual.PopupTC); + mir_wstrncpy(NewMailPopup.lptzContactName, _A2T(ActualAccount->Name), _countof(NewMailPopup.lptzContactName)); + mir_snwprintf(NewMailPopup.lptzText, TranslateT("%d new mail message(s), %d total"), MN->Real.PopupNC + MN->Virtual.PopupNC, MN->Real.PopupTC + MN->Virtual.PopupTC); PUAddPopupT(&NewMailPopup); } @@ -704,7 +704,7 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D nid.hIcon = g_LoadIconEx(2); nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP; nid.uCallbackMessage = WM_YAMN_NOTIFYICON; - mir_sntprintf(nid.szTip, L"%S %s", ActualAccount->Name, TranslateT("- new mail message(s)")); + mir_snwprintf(nid.szTip, L"%S %s", ActualAccount->Name, TranslateT("- new mail message(s)")); Shell_NotifyIcon(NIM_ADD, &nid); SetTimer(hDlg, TIMER_FLASHING, 500, NULL); } @@ -761,11 +761,11 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D NoNewMailPopup.PluginWindowProc = NoNewMailPopupProc; NoNewMailPopup.PluginData = 0; //it's not new mail popup - mir_tstrncpy(NoNewMailPopup.lptzContactName, _A2T(ActualAccount->Name), _countof(NoNewMailPopup.lptzContactName)); + mir_wstrncpy(NoNewMailPopup.lptzContactName, _A2T(ActualAccount->Name), _countof(NoNewMailPopup.lptzContactName)); if (MN->Real.PopupSL2NC + MN->Virtual.PopupSL2NC) - mir_sntprintf(NoNewMailPopup.lptzText, TranslateT("No new mail message, %d spam(s)"), MN->Real.PopupSL2NC + MN->Virtual.PopupSL2NC); + mir_snwprintf(NoNewMailPopup.lptzText, TranslateT("No new mail message, %d spam(s)"), MN->Real.PopupSL2NC + MN->Virtual.PopupSL2NC); else - mir_tstrncpy(NoNewMailPopup.lptzText, TranslateT("No new mail message"), _countof(NoNewMailPopup.lptzText)); + mir_wstrncpy(NoNewMailPopup.lptzText, TranslateT("No new mail message"), _countof(NoNewMailPopup.lptzText)); PUAddPopupT(&NoNewMailPopup); } @@ -1435,7 +1435,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR size_t size = (From ? mir_wstrlen(From) : 0) + (Subj ? mir_wstrlen(Subj) : 0) + 4; title = new WCHAR[size]; if (From && Subj) - mir_sntprintf(title, size, L"%s (%s)", Subj, From); + mir_snwprintf(title, size, L"%s (%s)", Subj, From); else if (From) wcsncpy_s(title, size, From, _TRUNCATE); else if (Subj) @@ -1562,9 +1562,9 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR if ((nReturnCmd == 1) && (ListView_GetItemState(hList, courRow, LVIS_SELECTED) == 0)) continue; ListView_GetItemText(hList, courRow, 0, headname, _countof(headname)); ListView_GetItemText(hList, courRow, 1, headvalue, _countof(headvalue)); - size_t headnamelen = mir_tstrlen(headname); + size_t headnamelen = mir_wstrlen(headname); if (headnamelen) sizeNeeded += 1 + headnamelen; - sizeNeeded += 3 + mir_tstrlen(headvalue); + sizeNeeded += 3 + mir_wstrlen(headvalue); } if (sizeNeeded && OpenClipboard(hDlg)) { EmptyClipboard(); @@ -1575,8 +1575,8 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR if ((nReturnCmd == 1) && (ListView_GetItemState(hList, courRow, LVIS_SELECTED) == 0)) continue; ListView_GetItemText(hList, courRow, 0, headname, _countof(headname)); ListView_GetItemText(hList, courRow, 1, headvalue, _countof(headvalue)); - if (mir_tstrlen(headname)) courPos += mir_sntprintf(&buff[courPos], sizeNeeded + 1, L"%s:\t%s\r\n", headname, headvalue); - else courPos += mir_sntprintf(&buff[courPos], sizeNeeded + 1, L"\t%s\r\n", headvalue); + if (mir_wstrlen(headname)) courPos += mir_snwprintf(&buff[courPos], sizeNeeded + 1, L"%s:\t%s\r\n", headname, headvalue); + else courPos += mir_snwprintf(&buff[courPos], sizeNeeded + 1, L"\t%s\r\n", headvalue); } GlobalUnlock(hData); @@ -2039,7 +2039,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR if (Total) { wchar_t DeleteMsg[1024]; - mir_sntprintf(DeleteMsg, TranslateT("Do you really want to delete %d selected mails?"), Total); + mir_snwprintf(DeleteMsg, TranslateT("Do you really want to delete %d selected mails?"), Total); if (IDOK == MessageBox(hDlg, DeleteMsg, TranslateT("Delete confirmation"), MB_OKCANCEL | MB_ICONWARNING)) { struct DeleteParam ParamToDeleteMails = { YAMN_DELETEVERSION, ThreadRunningEV, ActualAccount, NULL }; @@ -2243,7 +2243,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR ListView_GetItemText(hList, courRow, 1, subject, _countof(subject)); ListView_GetItemText(hList, courRow, 2, size, _countof(size)); ListView_GetItemText(hList, courRow, 3, date, _countof(date)); - sizeNeeded += 5 + mir_tstrlen(from) + mir_tstrlen(subject) + mir_tstrlen(size) + mir_tstrlen(date); + sizeNeeded += 5 + mir_wstrlen(from) + mir_wstrlen(subject) + mir_wstrlen(size) + mir_wstrlen(date); } if (sizeNeeded && OpenClipboard(hDlg)) { EmptyClipboard(); @@ -2256,7 +2256,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR ListView_GetItemText(hList, courRow, 1, subject, _countof(subject)); ListView_GetItemText(hList, courRow, 2, size, _countof(size)); ListView_GetItemText(hList, courRow, 3, date, _countof(date)); - courPos += mir_sntprintf(&buff[courPos], sizeNeeded + 1, L"%s\t%s\t%s\t%s\r\n", from, subject, size, date); + courPos += mir_snwprintf(&buff[courPos], sizeNeeded + 1, L"%s\t%s\t%s\t%s\r\n", from, subject, size, date); } GlobalUnlock(hData); diff --git a/plugins/YAMN/src/debug.cpp b/plugins/YAMN/src/debug.cpp index fcf594018d..06644d78ef 100644 --- a/plugins/YAMN/src/debug.cpp +++ b/plugins/YAMN/src/debug.cpp @@ -43,21 +43,21 @@ void InitDebug() InitializeCriticalSection(&FileAccessCS);
#ifdef DEBUG_SYNCHRO
- mir_sntprintf(DebugFileName, DebugSynchroFileName2, DebugUserDirectory);
+ mir_snwprintf(DebugFileName, DebugSynchroFileName2, DebugUserDirectory);
SynchroFile=CreateFile(DebugFileName,GENERIC_WRITE,FILE_SHARE_WRITE|FILE_SHARE_READ,NULL,CREATE_ALWAYS,0,NULL);
DebugLog(SynchroFile,"Synchro debug file created by %s\n",YAMN_VER);
#endif
#ifdef DEBUG_COMM
- mir_sntprintf(DebugFileName, DebugCommFileName2, DebugUserDirectory);
+ mir_snwprintf(DebugFileName, DebugCommFileName2, DebugUserDirectory);
CommFile=CreateFile(DebugFileName,GENERIC_WRITE,FILE_SHARE_WRITE|FILE_SHARE_READ,NULL,CREATE_ALWAYS,0,NULL);
DebugLog(CommFile,"Communication debug file created by %s\n",YAMN_VER);
#endif
#ifdef DEBUG_DECODE
- mir_sntprintf(DebugFileName, DebugDecodeFileName2, DebugUserDirectory);
+ mir_snwprintf(DebugFileName, DebugDecodeFileName2, DebugUserDirectory);
DecodeFile=CreateFile(DebugFileName,GENERIC_WRITE,FILE_SHARE_WRITE|FILE_SHARE_READ,NULL,CREATE_ALWAYS,0,NULL);
DebugLog(DecodeFile,"Decoding kernel debug file created by %s\n",YAMN_VER);
diff --git a/plugins/YAMN/src/main.cpp b/plugins/YAMN/src/main.cpp index 230ee89486..73e21c95af 100644 --- a/plugins/YAMN/src/main.cpp +++ b/plugins/YAMN/src/main.cpp @@ -63,7 +63,7 @@ static void GetProfileDirectory(wchar_t *szPath, int cbPath) { wchar_t tszOldPath[MAX_PATH]; CallService(MS_DB_GETPROFILEPATHT, _countof(tszOldPath), (LPARAM)tszOldPath); - mir_tstrcat(tszOldPath, L"\\*.book"); + mir_wstrcat(tszOldPath, L"\\*.book"); VARST ptszNewPath( L"%miranda_userdata%"); @@ -125,8 +125,8 @@ BOOL CALLBACK EnumSystemCodePagesProc(LPTSTR cpStr) } #ifdef _DEBUG if (!found) { - mir_tstrcat(unknownCP, info.CodePageName); - mir_tstrcat(unknownCP, L"\n"); + mir_wstrcat(unknownCP, info.CodePageName); + mir_wstrcat(unknownCP, L"\n"); } #endif } @@ -207,7 +207,7 @@ void WINAPI g_ReleaseIcon( HICON hIcon ) static void LoadPlugins() { wchar_t szSearchPath[MAX_PATH]; - mir_sntprintf(szSearchPath, L"%s\\Plugins\\YAMN\\*.dll", szMirandaDir); + mir_snwprintf(szSearchPath, L"%s\\Plugins\\YAMN\\*.dll", szMirandaDir); hDllPlugins = NULL; @@ -221,15 +221,15 @@ static void LoadPlugins() continue; // we have a dot - int len = (int)mir_tstrlen(fd.cFileName); // find the length of the string + int len = (int)mir_wstrlen(fd.cFileName); // find the length of the string wchar_t* end = fd.cFileName+len; // get a pointer to the NULL int safe = (end-dot)-1; // figure out how many chars after the dot are "safe", not including NULL - if ((safe != 3) || (mir_tstrcmpi(dot+1, L"dll") != 0)) //not bound, however the "dll" string should mean only 3 chars are compared + if ((safe != 3) || (mir_wstrcmpi(dot+1, L"dll") != 0)) //not bound, however the "dll" string should mean only 3 chars are compared continue; wchar_t szPluginPath[MAX_PATH]; - mir_sntprintf(szPluginPath, L"%s\\Plugins\\YAMN\\%s", szMirandaDir, fd.cFileName); + mir_snwprintf(szPluginPath, L"%s\\Plugins\\YAMN\\%s", szMirandaDir, fd.cFileName); HINSTANCE hDll = LoadLibrary(szPluginPath); if (hDll == NULL) continue; diff --git a/plugins/YAMN/src/proto/pop3/pop3comm.cpp b/plugins/YAMN/src/proto/pop3/pop3comm.cpp index cd8c3121db..9b2d0da53e 100644 --- a/plugins/YAMN/src/proto/pop3/pop3comm.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3comm.cpp @@ -269,7 +269,7 @@ int RegisterPOP3Plugin(WPARAM, LPARAM) if (ERROR_FILE_NOT_FOUND != GetLastError())
{
wchar_t temp[1024] = { 0 };
- mir_sntprintf(temp, L"%s\n%s", TranslateT("Reading file error. File already in use?"), FileName);
+ mir_snwprintf(temp, L"%s\n%s", TranslateT("Reading file error. File already in use?"), FileName);
MessageBox(NULL, temp, TranslateT("YAMN (internal POP3) read error"), MB_OK);
CallService(MS_YAMN_DELETEFILENAME, (WPARAM)FileName, 0);
FileName = NULL;
@@ -344,7 +344,7 @@ DWORD WINAPI WritePOP3Accounts() DWORD ReturnValue = CallService(MS_YAMN_WRITEACCOUNTS, (WPARAM)POP3Plugin, (LPARAM)FileName);
if (ReturnValue == EACC_SYSTEM) {
wchar_t temp[1024] = { 0 };
- mir_sntprintf(temp, L"%s\n%s", TranslateT("Error while copying data to disk occurred. Is file in use?"), FileName);
+ mir_snwprintf(temp, L"%s\n%s", TranslateT("Error while copying data to disk occurred. Is file in use?"), FileName);
MessageBox(NULL, temp, TranslateT("POP3 plugin - write file error"), MB_OK);
}
@@ -380,7 +380,7 @@ DWORD WINAPI ReadPOP3Options(HACCOUNT Which, char **Parser, char *End) if (*Parser >= End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
- mir_sntprintf(Debug, L"CodePage: %d, remaining %d chars", ((HPOP3ACCOUNT)Which)->CP, End-*Parser);
+ mir_snwprintf(Debug, L"CodePage: %d, remaining %d chars", ((HPOP3ACCOUNT)Which)->CP, End-*Parser);
MessageBox(NULL,Debug,L"debug",MB_OK);
#endif
return 0;
@@ -713,7 +713,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) for (NewMsgsPtr = (HYAMNMAIL)NewMails; NewMsgsPtr != NULL; NewMsgsPtr = NewMsgsPtr->Next) {
if (!mir_strcmp(MsgQueuePtr->ID, NewMsgsPtr->ID)) {
wchar_t accstatus[512];
- mir_sntprintf(accstatus, TranslateT("Reading body %s"), NewMsgsPtr->ID);
+ mir_snwprintf(accstatus, TranslateT("Reading body %s"), NewMsgsPtr->ID);
SetAccountStatus(ActualAccount, accstatus);
DataRX = MyClient->Top(MsgQueuePtr->Number, 100);
#ifdef DEBUG_DECODE
@@ -786,7 +786,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) {
BOOL autoretr = (ActualAccount->Flags & YAMN_ACC_BODY) != 0;
DataRX = MyClient->Top(MsgQueuePtr->Number, autoretr ? 100 : 0);
- mir_sntprintf(accstatus, TranslateT("Reading new mail messages (%d%% done)"), 100 * i / msgs);
+ mir_snwprintf(accstatus, TranslateT("Reading new mail messages (%d%% done)"), 100 * i / msgs);
SetAccountStatus(ActualAccount, accstatus);
#ifdef DEBUG_DECODE
@@ -1542,14 +1542,14 @@ wchar_t* WINAPI GetErrorString(DWORD Code) wchar_t *ErrorString = new wchar_t[ERRORSTR_MAXLEN];
POP3_ERRORCODE *ErrorCode = (POP3_ERRORCODE *)(UINT_PTR)Code;
- mir_sntprintf(ErrorString, ERRORSTR_MAXLEN, TranslateT("Error %d-%d-%d-%d:"), ErrorCode->AppError, ErrorCode->POP3Error, ErrorCode->NetError, ErrorCode->SystemError);
+ mir_snwprintf(ErrorString, ERRORSTR_MAXLEN, TranslateT("Error %d-%d-%d-%d:"), ErrorCode->AppError, ErrorCode->POP3Error, ErrorCode->NetError, ErrorCode->SystemError);
if (ErrorCode->POP3Error)
- mir_sntprintf(ErrorString, ERRORSTR_MAXLEN, L"%s\n%s", ErrorString, TranslateTS(POP3Errors[ErrorCode->POP3Error - 1]));
+ mir_snwprintf(ErrorString, ERRORSTR_MAXLEN, L"%s\n%s", ErrorString, TranslateTS(POP3Errors[ErrorCode->POP3Error - 1]));
if (ErrorCode->NetError) {
if (ErrorCode->SSL)
- mir_sntprintf(ErrorString, ERRORSTR_MAXLEN, L"%s\n%s", ErrorString, TranslateTS(SSLErrors[ErrorCode->NetError - 1]));
+ mir_snwprintf(ErrorString, ERRORSTR_MAXLEN, L"%s\n%s", ErrorString, TranslateTS(SSLErrors[ErrorCode->NetError - 1]));
else
- mir_sntprintf(ErrorString, ERRORSTR_MAXLEN, L"%s\n%s", ErrorString, TranslateTS(NetlibErrors[ErrorCode->NetError - 4]));
+ mir_snwprintf(ErrorString, ERRORSTR_MAXLEN, L"%s\n%s", ErrorString, TranslateTS(NetlibErrors[ErrorCode->NetError - 4]));
}
return ErrorString;
diff --git a/plugins/YAMN/src/proto/pop3/pop3opt.cpp b/plugins/YAMN/src/proto/pop3/pop3opt.cpp index 4e083211fd..3148158989 100644 --- a/plugins/YAMN/src/proto/pop3/pop3opt.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3opt.cpp @@ -650,7 +650,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP SendDlgItemMessage(hDlg, IDC_COMBOCP, CB_ADDSTRING, 0, (LPARAM)TranslateT("Default"));
for (i = 1; i < CPLENSUPP; i++) {
CPINFOEX info; GetCPInfoEx(CodePageNamesSupp[i].CP, 0, &info);
- size_t len = mir_tstrlen(info.CodePageName + 7);
+ size_t len = mir_wstrlen(info.CodePageName + 7);
info.CodePageName[len + 6] = 0;
SendDlgItemMessage(hDlg, IDC_COMBOCP, CB_ADDSTRING, 0, (LPARAM)(info.CodePageName + 7));
}
@@ -687,7 +687,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP case WM_YAMN_CHANGETIME:
if ((HPOP3ACCOUNT)wParam == ActualAccount) {
wchar_t Text[256];
- mir_sntprintf(Text, TranslateT("Time left to next check [s]: %d"), (DWORD)lParam);
+ mir_snwprintf(Text, TranslateT("Time left to next check [s]: %d"), (DWORD)lParam);
SetDlgItemText(hDlg, IDC_STTIMELEFT, Text);
}
return TRUE;
@@ -830,7 +830,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP case IDC_BTNAPP:
{
wchar_t filter[MAX_PATH];
- mir_sntprintf(filter, L"%s (*.exe;*.bat;*.cmd;*.com)%c*.exe;*.bat;*.cmd;*.com%c%s (*.*)%c*.*%c",
+ mir_snwprintf(filter, L"%s (*.exe;*.bat;*.cmd;*.com)%c*.exe;*.bat;*.cmd;*.com%c%s (*.*)%c*.*%c",
TranslateT("Executables"), 0, 0, TranslateT("All Files"), 0, 0);
OPENFILENAME OFNStruct = { 0 };
@@ -1289,12 +1289,12 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg, UINT msg, WPARAM wParam, LPARAM TesterF.lchIcon = g_LoadIconEx(3);
TesterN.lchIcon = g_LoadIconEx(1);
- mir_tstrncpy(Tester.lptzContactName, TranslateT("Account Test"), MAX_CONTACTNAME);
- mir_tstrncpy(TesterF.lptzContactName, TranslateT("Account Test (failed)"), MAX_CONTACTNAME);
- mir_tstrncpy(TesterN.lptzContactName, TranslateT("Account Test"), MAX_CONTACTNAME);
- mir_tstrncpy(Tester.lptzText, TranslateT("You have N new mail messages"), MAX_SECONDLINE);
- mir_tstrncpy(TesterF.lptzText, TranslateT("Connection failed message"), MAX_SECONDLINE);
- mir_tstrncpy(TesterN.lptzText, TranslateT("No new mail message"), MAX_SECONDLINE);
+ mir_wstrncpy(Tester.lptzContactName, TranslateT("Account Test"), MAX_CONTACTNAME);
+ mir_wstrncpy(TesterF.lptzContactName, TranslateT("Account Test (failed)"), MAX_CONTACTNAME);
+ mir_wstrncpy(TesterN.lptzContactName, TranslateT("Account Test"), MAX_CONTACTNAME);
+ mir_wstrncpy(Tester.lptzText, TranslateT("You have N new mail messages"), MAX_SECONDLINE);
+ mir_wstrncpy(TesterF.lptzText, TranslateT("Connection failed message"), MAX_SECONDLINE);
+ mir_wstrncpy(TesterN.lptzText, TranslateT("No new mail message"), MAX_SECONDLINE);
if (TesterC) {
Tester.colorBack = SendDlgItemMessage(hDlg, IDC_CPB, CPM_GETCOLOUR, 0, 0);
Tester.colorText = SendDlgItemMessage(hDlg, IDC_CPT, CPM_GETCOLOUR, 0, 0);
diff --git a/plugins/YAMN/src/protoplugin.cpp b/plugins/YAMN/src/protoplugin.cpp index 25e7a5a42c..20fc0f5817 100644 --- a/plugins/YAMN/src/protoplugin.cpp +++ b/plugins/YAMN/src/protoplugin.cpp @@ -179,7 +179,7 @@ INT_PTR GetFileNameSvc(WPARAM wParam,LPARAM) if (FileName == NULL)
return NULL;
- mir_sntprintf(FileName, MAX_PATH, L"%s\\yamn-accounts.%s.%s.book", UserDirectory, wParam, ProfileName);
+ mir_snwprintf(FileName, MAX_PATH, L"%s\\yamn-accounts.%s.%s.book", UserDirectory, wParam, ProfileName);
return (INT_PTR)FileName;
}
diff --git a/plugins/YAPP/src/popwin.cpp b/plugins/YAPP/src/popwin.cpp index 7bbdc6ca52..60f273e1f0 100644 --- a/plugins/YAPP/src/popwin.cpp +++ b/plugins/YAPP/src/popwin.cpp @@ -469,7 +469,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (pwd->custom_col) SetTextColor(ps.hdc, pd->colorText);
else SetTextColor(ps.hdc, colFirstLine);
- wchar_t *title = mir_u2t(pd->pwzTitle);
+ wchar_t *title = mir_wstrdup(pd->pwzTitle);
DrawText(ps.hdc, title, -1, &tr, DT_VCENTER | DT_LEFT | DT_END_ELLIPSIS | DT_SINGLELINE | DT_NOPREFIX);
mir_free(title);
@@ -491,7 +491,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (options.av_layout != PAV_NONE && options.time_layout == PT_WITHAV && pwd->time_height <= pwd->tb_height && !pwd->have_av)
GetClientRect(hwnd, &r);
- wchar_t *text = mir_u2t(pd->pwzText);
+ wchar_t *text = mir_wstrdup(pd->pwzText);
tr.left = r.left + options.padding + options.text_indent; tr.right = r.right - options.padding; tr.top = tr.bottom + options.padding; tr.bottom = r.bottom - options.padding;
DrawText(ps.hdc, text, -1, &tr, DT_NOPREFIX | DT_WORDBREAK | DT_EXTERNALLEADING | DT_TOP | DT_LEFT | DT_WORD_ELLIPSIS);
mir_free(text);
@@ -560,7 +560,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa return TRUE;
case PUM_SETTEXT:
- replaceStrT(pd->ptzText, (wchar_t*)lParam);
+ replaceStrW(pd->ptzText, (wchar_t*)lParam);
InvalidateRect(hwnd, 0, TRUE);
RepositionWindows();
return TRUE;
@@ -585,15 +585,15 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (options.time_layout != PT_NONE) {
SIZE size_t;
if (hFontTime) SelectObject(hdc, (HGDIOBJ)hFontTime);
- GetTextExtentPoint32(hdc, pwd->tbuff, (int)mir_tstrlen(pwd->tbuff), &size_t);
+ GetTextExtentPoint32(hdc, pwd->tbuff, (int)mir_wstrlen(pwd->tbuff), &size_t);
pwd->time_height = size_t.cy;
pwd->time_width = size_t.cx;
}
// titlebar height
if (hFontFirstLine) SelectObject(hdc, (HGDIOBJ)hFontFirstLine);
- wchar_t *title = mir_u2t(pd->pwzTitle);
- GetTextExtentPoint32(hdc, title, (int)mir_tstrlen(title), &size);
+ wchar_t *title = mir_wstrdup(pd->pwzTitle);
+ GetTextExtentPoint32(hdc, title, (int)mir_wstrlen(title), &size);
mir_free(title);
pwd->tb_height = size.cy;
if (options.time_layout == PT_LEFT || options.time_layout == PT_RIGHT) {
@@ -630,7 +630,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa r.right -= pwd->time_width + options.padding;
if (hFontSecondLine) SelectObject(hdc, (HGDIOBJ)hFontSecondLine);
- wchar_t *text = mir_u2t(pd->pwzText);
+ wchar_t *text = mir_wstrdup(pd->pwzText);
DrawText(hdc, text, -1, &r, DT_CALCRECT | DT_NOPREFIX | DT_WORDBREAK | DT_EXTERNALLEADING | DT_TOP | DT_LEFT | DT_WORD_ELLIPSIS);
pwd->text_height = r.bottom;
mir_free(text);
diff --git a/plugins/YAPP/src/services.cpp b/plugins/YAPP/src/services.cpp index 8b74676a1b..da7c2d89b8 100644 --- a/plugins/YAPP/src/services.cpp +++ b/plugins/YAPP/src/services.cpp @@ -289,7 +289,7 @@ static INT_PTR ShowMessage(WPARAM wParam, LPARAM lParam) if (db_get_b(0, "Popup", "ModuleIsEnabled", 1)) {
POPUPDATAT pd = {0};
- mir_tstrcpy(pd.lptzContactName, lParam == SM_WARNING ? L"Warning" : L"Notification");
+ mir_wstrcpy(pd.lptzContactName, lParam == SM_WARNING ? L"Warning" : L"Notification");
pd.lchIcon = LoadIcon(0, lParam == SM_WARNING ? IDI_WARNING : IDI_INFORMATION);
wcsncpy(pd.lptzText, _A2T((char *)wParam), MAX_SECONDLINE); pd.lptzText[MAX_SECONDLINE-1] = 0;
CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&pd, 0);
diff --git a/plugins/YAPP/src/yapp.cpp b/plugins/YAPP/src/yapp.cpp index 06ce6610fd..79f787dbc7 100644 --- a/plugins/YAPP/src/yapp.cpp +++ b/plugins/YAPP/src/yapp.cpp @@ -94,40 +94,40 @@ static void InitFonts() {
font_id_firstline.cbSize = sizeof(FontIDT);
font_id_firstline.flags = FIDF_ALLOWEFFECTS;
- mir_tstrcpy(font_id_firstline.group, LPGENW("Popups"));
- mir_tstrcpy(font_id_firstline.name, LPGENW("First line"));
+ mir_wstrcpy(font_id_firstline.group, LPGENW("Popups"));
+ mir_wstrcpy(font_id_firstline.name, LPGENW("First line"));
mir_strcpy(font_id_firstline.dbSettingsGroup, MODULE);
mir_strcpy(font_id_firstline.prefix, "FontFirst");
- mir_tstrcpy(font_id_firstline.backgroundGroup, L"Popups");
- mir_tstrcpy(font_id_firstline.backgroundName, L"Background");
+ mir_wstrcpy(font_id_firstline.backgroundGroup, L"Popups");
+ mir_wstrcpy(font_id_firstline.backgroundName, L"Background");
font_id_firstline.order = 0;
FontRegisterT(&font_id_firstline);
font_id_secondline.cbSize = sizeof(FontIDT);
font_id_secondline.flags = FIDF_ALLOWEFFECTS;
- mir_tstrcpy(font_id_secondline.group, LPGENW("Popups"));
- mir_tstrcpy(font_id_secondline.name, LPGENW("Second line"));
+ mir_wstrcpy(font_id_secondline.group, LPGENW("Popups"));
+ mir_wstrcpy(font_id_secondline.name, LPGENW("Second line"));
mir_strcpy(font_id_secondline.dbSettingsGroup, MODULE);
mir_strcpy(font_id_secondline.prefix, "FontSecond");
- mir_tstrcpy(font_id_secondline.backgroundGroup, L"Popups");
- mir_tstrcpy(font_id_secondline.backgroundName, L"Background");
+ mir_wstrcpy(font_id_secondline.backgroundGroup, L"Popups");
+ mir_wstrcpy(font_id_secondline.backgroundName, L"Background");
font_id_secondline.order = 1;
FontRegisterT(&font_id_secondline);
font_id_time.cbSize = sizeof(FontIDT);
font_id_time.flags = FIDF_ALLOWEFFECTS;
- mir_tstrcpy(font_id_time.group, LPGENW("Popups"));
- mir_tstrcpy(font_id_time.name, LPGENW("Time"));
+ mir_wstrcpy(font_id_time.group, LPGENW("Popups"));
+ mir_wstrcpy(font_id_time.name, LPGENW("Time"));
mir_strcpy(font_id_time.dbSettingsGroup, MODULE);
mir_strcpy(font_id_time.prefix, "FontTime");
- mir_tstrcpy(font_id_time.backgroundGroup, L"Popups");
- mir_tstrcpy(font_id_time.backgroundName, L"Background");
+ mir_wstrcpy(font_id_time.backgroundGroup, L"Popups");
+ mir_wstrcpy(font_id_time.backgroundName, L"Background");
font_id_time.order = 2;
FontRegisterT(&font_id_time);
colour_id_bg.cbSize = sizeof(ColourIDT);
- mir_tstrcpy(colour_id_bg.group, LPGENW("Popups"));
- mir_tstrcpy(colour_id_bg.name, LPGENW("Background"));
+ mir_wstrcpy(colour_id_bg.group, LPGENW("Popups"));
+ mir_wstrcpy(colour_id_bg.name, LPGENW("Background"));
mir_strcpy(colour_id_bg.dbSettingsGroup, MODULE);
mir_strcpy(colour_id_bg.setting, "ColourBg");
colour_id_bg.defcolour = GetSysColor(COLOR_3DSHADOW);
@@ -135,8 +135,8 @@ static void InitFonts() ColourRegisterT(&colour_id_bg);
colour_id_border.cbSize = sizeof(ColourIDT);
- mir_tstrcpy(colour_id_border.group, LPGENW("Popups"));
- mir_tstrcpy(colour_id_border.name, LPGENW("Border"));
+ mir_wstrcpy(colour_id_border.group, LPGENW("Popups"));
+ mir_wstrcpy(colour_id_border.name, LPGENW("Border"));
mir_strcpy(colour_id_border.dbSettingsGroup, MODULE);
mir_strcpy(colour_id_border.setting, "ColourBorder");
colour_id_border.defcolour = RGB(0, 0, 0);
@@ -144,8 +144,8 @@ static void InitFonts() ColourRegisterT(&colour_id_border);
colour_id_sidebar.cbSize = sizeof(ColourIDT);
- mir_tstrcpy(colour_id_sidebar.group, LPGENW("Popups"));
- mir_tstrcpy(colour_id_sidebar.name, LPGENW("Sidebar"));
+ mir_wstrcpy(colour_id_sidebar.group, LPGENW("Popups"));
+ mir_wstrcpy(colour_id_sidebar.name, LPGENW("Sidebar"));
mir_strcpy(colour_id_sidebar.dbSettingsGroup, MODULE);
mir_strcpy(colour_id_sidebar.setting, "ColourSidebar");
colour_id_sidebar.defcolour = RGB(128, 128, 128);
@@ -153,8 +153,8 @@ static void InitFonts() ColourRegisterT(&colour_id_sidebar);
colour_id_titleunderline.cbSize = sizeof(ColourIDT);
- mir_tstrcpy(colour_id_titleunderline.group, LPGENW("Popups"));
- mir_tstrcpy(colour_id_titleunderline.name, LPGENW("Title underline"));
+ mir_wstrcpy(colour_id_titleunderline.group, LPGENW("Popups"));
+ mir_wstrcpy(colour_id_titleunderline.name, LPGENW("Title underline"));
mir_strcpy(colour_id_titleunderline.dbSettingsGroup, MODULE);
mir_strcpy(colour_id_titleunderline.setting, "ColourTitleUnderline");
colour_id_titleunderline.defcolour = GetSysColor(COLOR_3DSHADOW);
diff --git a/plugins/YAPP/src/yapp_history.cpp b/plugins/YAPP/src/yapp_history.cpp index 08ff8f747a..8e02c3c2ca 100644 --- a/plugins/YAPP/src/yapp_history.cpp +++ b/plugins/YAPP/src/yapp_history.cpp @@ -68,8 +68,8 @@ void PopupHistoryList::Add(wchar_t *title, wchar_t *message, time_t timestamp) PopupHistoryData item = {0}; //create an unicode history item item.flags = PHDF_UNICODE; //mark it as unicode item.timestamp = timestamp; - item.titleT = mir_u2t(title); - item.messageT = mir_u2t(message); + item.titleT = mir_wstrdup(title); + item.messageT = mir_wstrdup(message); AddItem(item); //add it } diff --git a/plugins/YAPP/src/yapp_history_dlg.cpp b/plugins/YAPP/src/yapp_history_dlg.cpp index 535b4a7ee5..c3b7a08e35 100644 --- a/plugins/YAPP/src/yapp_history_dlg.cpp +++ b/plugins/YAPP/src/yapp_history_dlg.cpp @@ -120,7 +120,7 @@ static int lastColumn = -1; //last sort column int MatchesFilterCS(const wchar_t *filter, const PopupHistoryData *popupItem) //case sensitive
{
- if (mir_tstrlen(filter) <= 0) { return 1; } //if no filter is set then the popup item matches the filter
+ if (mir_wstrlen(filter) <= 0) { return 1; } //if no filter is set then the popup item matches the filter
int match = 0;
match = (wcsstr(popupItem->messageT, filter)) ? 1 : match; //check message part
@@ -149,7 +149,7 @@ __inline void ConvertCase(wchar_t *dest, const wchar_t *source, size_t size) int MatchesFilterCI(const wchar_t *filterS, const PopupHistoryData *popupItem)
{
- if (mir_tstrlen(filterS) <= 0) { return 1; } //if no filter is set then the popup item matches the filter
+ if (mir_wstrlen(filterS) <= 0) { return 1; } //if no filter is set then the popup item matches the filter
int match = 0;
const int BUFFER_SIZE = 1024;
wchar_t buffer[BUFFER_SIZE];
@@ -187,7 +187,7 @@ int CALLBACK PopupsCompare(LPARAM lParam1, LPARAM lParam2, LPARAM myParam) ListView_GetItemText(params.hList, (int) lParam1, params.column, text1, _countof(text1));
ListView_GetItemText(params.hList, (int) lParam2, params.column, text2, _countof(text2));
- res = mir_tstrcmpi(text1, text2);
+ res = mir_wstrcmpi(text1, text2);
res = (params.column == lastColumn) ? -res : res; //do reverse search on second click on same column
@@ -489,7 +489,7 @@ void CopyPopupDataToClipboard(HWND hList, int selection) if (found)
{
EmptyClipboard();
- int len = (int)mir_tstrlen(buffer);
+ int len = (int)mir_wstrlen(buffer);
HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, (len + 2) * sizeof(wchar_t));
clipboard = (wchar_t *) GlobalLock(hData);
diff --git a/plugins/YARelay/src/main.cpp b/plugins/YARelay/src/main.cpp index f611fce2f5..3e2112eb27 100644 --- a/plugins/YARelay/src/main.cpp +++ b/plugins/YARelay/src/main.cpp @@ -151,11 +151,11 @@ static int MessageEventAdded(WPARAM hContact, LPARAM hDBEvent) case 'i':
case 'I':
{
- ptrT id(Contact_GetInfo(CNF_UNIQUEID, NULL));
+ ptrW id(Contact_GetInfo(CNF_UNIQUEID, NULL));
if (id != NULL)
wcsncpy_s(buf, id, _TRUNCATE);
else
- mir_sntprintf(buf, L"%p", hContact);
+ mir_snwprintf(buf, L"%p", hContact);
}
szUtfMsg.append(T2Utf(buf));
break;
diff --git a/plugins/YahooGroups/src/utils.cpp b/plugins/YahooGroups/src/utils.cpp index 57ac86c10c..7b9ff8ec90 100644 --- a/plugins/YahooGroups/src/utils.cpp +++ b/plugins/YahooGroups/src/utils.cpp @@ -160,7 +160,7 @@ int GetStringFromDatabase(char *szSettingName, WCHAR *szError, WCHAR *szResult, wchar_t* GetContactName(MCONTACT hContact, char *szProto)
{
- ptrT id(Contact_GetInfo(CNF_DISPLAYUID, hContact, szProto));
+ ptrW id(Contact_GetInfo(CNF_DISPLAYUID, hContact, szProto));
return (id != NULL) ? wcsdup(id) : NULL;
}
@@ -179,7 +179,7 @@ wchar_t *GetContactID(MCONTACT hContact) wchar_t* GetContactID(MCONTACT hContact, char *szProto)
{
- ptrT id(Contact_GetInfo(CNF_DISPLAY, hContact, szProto));
+ ptrW id(Contact_GetInfo(CNF_DISPLAY, hContact, szProto));
return (id != NULL) ? wcsdup(id) : NULL;
}
@@ -198,7 +198,7 @@ MCONTACT GetContactFromID(wchar_t *szID, char *szProto) tmp = pcli->pfnGetContactDisplayName(hContact, 0);
wcsncpy(dispName, tmp, _countof(dispName));
- if ((szHandle) && ((mir_tstrcmpi(szHandle, szID) == 0) || (mir_tstrcmpi(dispName, szID) == 0)) && ((szProto == NULL) || (_stricmp(szProto, cProtocol) == 0)))
+ if ((szHandle) && ((mir_wstrcmpi(szHandle, szID) == 0) || (mir_wstrcmpi(dispName, szID) == 0)) && ((szProto == NULL) || (_stricmp(szProto, cProtocol) == 0)))
found = 1;
if (szHandle) { free(szHandle); }
diff --git a/plugins/helpers/gen_helpers.cpp b/plugins/helpers/gen_helpers.cpp index 41f4f20276..c397936b37 100644 --- a/plugins/helpers/gen_helpers.cpp +++ b/plugins/helpers/gen_helpers.cpp @@ -26,7 +26,7 @@ wchar_t *Hlp_GetProtocolName(const char *proto) { if ((!ProtoServiceExists(proto, PS_GETNAME)) || (CallProtoService(proto, PS_GETNAME, (WPARAM)sizeof(protoname), (LPARAM)protoname)))
return NULL;
- return mir_a2t(protoname);
+ return mir_a2u(protoname);
}
@@ -103,16 +103,16 @@ int AddDebugLogMessage(const wchar_t* fmt, ...) va_list va;
va_start(va, fmt);
- mir_vsntprintf(tszText, _countof(tszText), fmt, va);
+ mir_vsnwprintf(tszText, _countof(tszText), fmt, va);
va_end(va);
#ifdef MODULENAME
- mir_sntprintf(tszFinal, L"%s: %s", MODULENAME, tszText);
+ mir_snwprintf(tszFinal, L"%s: %s", MODULENAME, tszText);
#else
wcsncpy(tszFinal, tszText, _countof(tszFinal));
#endif
- szFinal = mir_t2a(tszFinal);
+ szFinal = mir_u2a(tszFinal);
res = WriteToDebugLogA(szFinal);
mir_free(szFinal);
@@ -130,5 +130,5 @@ wchar_t *itot(int num) wchar_t tRes[32];
// check this
_itow(num, tRes, 10);
- return mir_tstrdup(tRes);
+ return mir_wstrdup(tRes);
}
diff --git a/plugins/mTextControl/src/richeditutils.cpp b/plugins/mTextControl/src/richeditutils.cpp index 3f3614dc1b..442e512d4e 100644 --- a/plugins/mTextControl/src/richeditutils.cpp +++ b/plugins/mTextControl/src/richeditutils.cpp @@ -77,7 +77,7 @@ public: HRESULT STDMETHODCALLTYPE GetNewStorage(LPSTORAGE * lplpstg)
{
wchar_t sztName[64];
- mir_sntprintf(sztName, L"s%u", this->nextStgId);
+ mir_snwprintf(sztName, L"s%u", this->nextStgId);
if (this->pictStg == NULL)
return STG_E_MEDIUMFULL;
diff --git a/plugins/wbOSD/src/events.cpp b/plugins/wbOSD/src/events.cpp index 015e240ff4..e2207bd059 100644 --- a/plugins/wbOSD/src/events.cpp +++ b/plugins/wbOSD/src/events.cpp @@ -63,7 +63,7 @@ int ProtoAck(WPARAM,LPARAM lparam) DWORD ann = db_get_dw( NULL, THIS_MODULE, "announce", DEFAULT_ANNOUNCE );
if ( ann & ( 1 << ( ack->lParam - ID_STATUS_OFFLINE ))) {
wchar_t buffer[512];
- mir_sntprintf(buffer, TranslateT("%s is %s"), pcli->pfnGetContactDisplayName(ack->hContact, 0), pcli->pfnGetStatusModeDescription(ack->lParam, 0));
+ mir_snwprintf(buffer, TranslateT("%s is %s"), pcli->pfnGetContactDisplayName(ack->hContact, 0), pcli->pfnGetStatusModeDescription(ack->lParam, 0));
ShowOSD(buffer, 0, db_get_dw(NULL,THIS_MODULE, "clr_status", DEFAULT_CLRSTATUS), ack->hContact);
} } }
@@ -121,7 +121,7 @@ int ContactStatusChanged(WPARAM wParam, LPARAM lParam) return 0;
wchar_t bufferW[512];
- mir_sntprintf(bufferW, TranslateT("%s is %s"), pcli->pfnGetContactDisplayName(wParam, 0), pcli->pfnGetStatusModeDescription(newStatus, 0));
+ mir_snwprintf(bufferW, TranslateT("%s is %s"), pcli->pfnGetContactDisplayName(wParam, 0), pcli->pfnGetStatusModeDescription(newStatus, 0));
ShowOSD(bufferW, 0, db_get_dw(NULL,THIS_MODULE, "clr_status", DEFAULT_CLRSTATUS), hContact);
return 0;
}
@@ -155,7 +155,7 @@ int HookedNewEvent(WPARAM wParam, LPARAM hDBEvent) DBVARIANT dbv;
if(!db_get_ts(NULL,THIS_MODULE,"message_format",&dbv)) {
- mir_tstrcpy(buf, dbv.ptszVal);
+ mir_wstrcpy(buf, dbv.ptszVal);
db_free(&dbv);
}
@@ -183,17 +183,17 @@ int HookedNewEvent(WPARAM wParam, LPARAM hDBEvent) wchar_t *c1 = 0, *c2 = 0;
if ( i1 == 1 )
- c1 = mir_tstrdup(pcli->pfnGetContactDisplayName(wParam, 0));
+ c1 = mir_wstrdup(pcli->pfnGetContactDisplayName(wParam, 0));
else if ( i1 == 2 )
c1 = DbGetEventTextT( &dbe, 0 );
if ( i2 == 1 )
- c2 = mir_tstrdup(pcli->pfnGetContactDisplayName(wParam, 0));
+ c2 = mir_wstrdup(pcli->pfnGetContactDisplayName(wParam, 0));
else if ( i2 == 2 )
c2 = DbGetEventTextT( &dbe, 0 );
wchar_t buffer[512];
- mir_sntprintf(buffer, buf, c1, c2);
+ mir_snwprintf(buffer, buf, c1, c2);
ShowOSD(buffer, 0, db_get_dw(NULL,THIS_MODULE, "clr_msg", DEFAULT_CLRMSG), wParam);
mir_free( c1 );
diff --git a/plugins/wbOSD/src/options.cpp b/plugins/wbOSD/src/options.cpp index 76af0a3bb1..3749330a0f 100644 --- a/plugins/wbOSD/src/options.cpp +++ b/plugins/wbOSD/src/options.cpp @@ -128,10 +128,10 @@ void loadDBSettings(plgsettings *ps) DBVARIANT dbv;
if (!db_get_ts(NULL, THIS_MODULE, "message_format", &dbv)) {
- mir_tstrcpy(ps->msgformat, dbv.ptszVal);
+ mir_wstrcpy(ps->msgformat, dbv.ptszVal);
db_free(&dbv);
}
- else mir_tstrcpy(ps->msgformat, DEFAULT_MESSAGEFORMAT);
+ else mir_wstrcpy(ps->msgformat, DEFAULT_MESSAGEFORMAT);
ps->announce = db_get_dw(NULL, THIS_MODULE, "announce", DEFAULT_ANNOUNCE);
@@ -150,11 +150,11 @@ void loadDBSettings(plgsettings *ps) ps->lf.lfPitchAndFamily = db_get_b(NULL, THIS_MODULE, "fntPitchAndFamily", DEFAULT_FNT_PITCHANDFAM);
if (!db_get_ts(NULL, THIS_MODULE, "fntFaceName", &dbv)) {
- mir_tstrcpy(ps->lf.lfFaceName, dbv.ptszVal);
+ mir_wstrcpy(ps->lf.lfFaceName, dbv.ptszVal);
db_free(&dbv);
}
else
- mir_tstrcpy(ps->lf.lfFaceName, DEFAULT_FNT_FACENAME);
+ mir_wstrcpy(ps->lf.lfFaceName, DEFAULT_FNT_FACENAME);
}
void saveDBSettings(plgsettings *ps)
@@ -250,7 +250,7 @@ INT_PTR CALLBACK OptDlgProc(HWND hDlg, UINT msg, WPARAM wparam, LPARAM lparam) {
wchar_t buf[20];
- mir_sntprintf(buf, L"%d %%", ps->alpha * 100 / 255);
+ mir_snwprintf(buf, L"%d %%", ps->alpha * 100 / 255);
SetDlgItemText(hDlg, IDC_ALPHATXT, buf);
}
@@ -266,7 +266,7 @@ INT_PTR CALLBACK OptDlgProc(HWND hDlg, UINT msg, WPARAM wparam, LPARAM lparam) ps->alpha = SendDlgItemMessage(hDlg, IDC_SLIDER1, TBM_GETPOS, 0, 0);
{
wchar_t buf[20];
- mir_sntprintf(buf, L"%d %%", ps->alpha * 100 / 255);
+ mir_snwprintf(buf, L"%d %%", ps->alpha * 100 / 255);
SetDlgItemText(hDlg, IDC_ALPHATXT, buf);
}
goto xxx;
diff --git a/plugins/wbOSD/src/wbOSD.cpp b/plugins/wbOSD/src/wbOSD.cpp index bc602ec52c..b48bfd6ee0 100644 --- a/plugins/wbOSD/src/wbOSD.cpp +++ b/plugins/wbOSD/src/wbOSD.cpp @@ -161,7 +161,7 @@ LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM logmsg("WindowProcedure::USER+1");
ms = (osdmsg*)mir_alloc(sizeof(osdmsg));
- ms->text = mir_tstrdup((wchar_t *)wParam);
+ ms->text = mir_wstrdup((wchar_t *)wParam);
if (lParam == 0)
lParam = db_get_dw(NULL, THIS_MODULE, "timeout", DEFAULT_TIMEOUT);
ms->timeout = lParam;
@@ -206,7 +206,7 @@ LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM ms = (osdmsg*)mir_alloc(sizeof(osdmsg));
memcpy(ms, (osdmsg*)wParam, sizeof(osdmsg));
- ms->text = mir_tstrdup(ms->text);
+ ms->text = mir_wstrdup(ms->text);
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)ms);
SetTimer(hwnd, (UINT_PTR)ms, (UINT)ms->timeout, 0);
diff --git a/protocols/AimOscar/src/aim.cpp b/protocols/AimOscar/src/aim.cpp index d9cbc9b6de..9172347766 100644 --- a/protocols/AimOscar/src/aim.cpp +++ b/protocols/AimOscar/src/aim.cpp @@ -30,7 +30,7 @@ HINSTANCE hInstance; // Protocol instances
static int sttCompareProtocols(const CAimProto *p1, const CAimProto *p2)
{
- return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName);
+ return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName);
}
OBJLIST<CAimProto> g_Instances(1, sttCompareProtocols);
diff --git a/protocols/AimOscar/src/avatars.cpp b/protocols/AimOscar/src/avatars.cpp index ec3b7c3812..9a8a160503 100644 --- a/protocols/AimOscar/src/avatars.cpp +++ b/protocols/AimOscar/src/avatars.cpp @@ -118,7 +118,7 @@ void CAimProto::avatar_retrieval_handler(const char* sn, const char* /*hash*/, c int CAimProto::get_avatar_filename(MCONTACT hContact, wchar_t* pszDest, size_t cbLen, const wchar_t *ext)
{
- int tPathLen = mir_sntprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
+ int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
if (ext && _waccess(pszDest, 0))
CreateDirectoryTreeT(pszDest);
@@ -127,19 +127,19 @@ int CAimProto::get_avatar_filename(MCONTACT hContact, wchar_t* pszDest, size_t c DBVARIANT dbv;
if (getTString(hContact, AIM_KEY_AH, &dbv)) return GAIR_NOAVATAR;
- tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s", dbv.ptszVal);
+ tPathLen += mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s", dbv.ptszVal);
db_free(&dbv);
bool found = false;
if (ext == NULL) {
- mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L".*");
+ mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L".*");
_tfinddata_t c_file;
long hFile = _tfindfirst(pszDest, &c_file);
if (hFile > -1L) {
do {
if (wcsrchr(c_file.name, '.')) {
- mir_sntprintf(pszDest + tPathLen2, cbLen - tPathLen2, L"\\%s", c_file.name);
+ mir_snwprintf(pszDest + tPathLen2, cbLen - tPathLen2, L"\\%s", c_file.name);
found = true;
}
} while (_tfindnext(hFile, &c_file) == 0);
@@ -149,7 +149,7 @@ int CAimProto::get_avatar_filename(MCONTACT hContact, wchar_t* pszDest, size_t c if (!found) pszDest[0] = 0;
}
else {
- mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, ext);
+ mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, ext);
found = _waccess(pszDest, 0) == 0;
}
diff --git a/protocols/AimOscar/src/chat.cpp b/protocols/AimOscar/src/chat.cpp index dcc0d9449e..40a59adea1 100644 --- a/protocols/AimOscar/src/chat.cpp +++ b/protocols/AimOscar/src/chat.cpp @@ -36,7 +36,7 @@ void CAimProto::chat_register(void) void CAimProto::chat_start(const char* id, unsigned short exchange)
{
- wchar_t *idt = mir_a2t(id);
+ wchar_t *idt = mir_a2u(id);
GCSESSION gcw = { sizeof(gcw) };
gcw.iType = GCW_CHATROOM;
@@ -66,8 +66,8 @@ void CAimProto::chat_start(const char* id, unsigned short exchange) void CAimProto::chat_event(const char* id, const char* sn, int evt, const wchar_t* msg)
{
- wchar_t *idt = mir_a2t(id);
- wchar_t *snt = mir_a2t(sn);
+ wchar_t *idt = mir_a2u(id);
+ wchar_t *snt = mir_a2u(sn);
MCONTACT hContact = contact_from_sn(sn);
wchar_t *nick = hContact ? (wchar_t*)pcli->pfnGetContactDisplayName(
@@ -91,7 +91,7 @@ void CAimProto::chat_event(const char* id, const char* sn, int evt, const wchar_ void CAimProto::chat_leave(const char* id)
{
- wchar_t *idt = mir_a2t(id);
+ wchar_t *idt = mir_a2u(id);
GCDEST gcd = { m_szModuleName, idt, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
@@ -110,7 +110,7 @@ int CAimProto::OnGCEvent(WPARAM, LPARAM lParam) if (mir_strcmp(gch->pDest->pszModule, m_szModuleName)) return 0;
- char *id = mir_t2a(gch->pDest->ptszID);
+ char *id = mir_u2a(gch->pDest->ptszID);
chat_list_item* item = find_chat_by_id(id);
if (item == NULL) return 0;
@@ -122,7 +122,7 @@ int CAimProto::OnGCEvent(WPARAM, LPARAM lParam) break;
case GC_USER_MESSAGE:
- if (gch->ptszText && mir_tstrlen(gch->ptszText))
+ if (gch->ptszText && mir_wstrlen(gch->ptszText))
aim_chat_send_message(item->hconn, item->seqno, T2Utf(gch->ptszText));
break;
@@ -133,7 +133,7 @@ int CAimProto::OnGCEvent(WPARAM, LPARAM lParam) case GC_USER_PRIVMESS:
{
- char* sn = mir_t2a(gch->ptszUID);
+ char* sn = mir_u2a(gch->ptszUID);
MCONTACT hContact = contact_from_sn(sn);
mir_free(sn);
CallService(MS_MSG_SENDMESSAGE, hContact, 0);
@@ -155,7 +155,7 @@ int CAimProto::OnGCEvent(WPARAM, LPARAM lParam) case GC_USER_NICKLISTMENU:
{
- char *sn = mir_t2a(gch->ptszUID);
+ char *sn = mir_u2a(gch->ptszUID);
MCONTACT hContact = contact_from_sn(sn);
mir_free(sn);
@@ -198,7 +198,7 @@ int CAimProto::OnGCMenuHook(WPARAM, LPARAM lParam) gcmi->Item = (gc_item*)Items;
}
else if (gcmi->Type == MENU_ON_NICKLIST) {
- char* sn = mir_t2a(gcmi->pszUID);
+ char* sn = mir_u2a(gcmi->pszUID);
if (!mir_strcmp(m_username, sn)) {
static const struct gc_item Items[] = {
{ TranslateT("User &details"), 10, MENU_ITEM, FALSE },
diff --git a/protocols/AimOscar/src/conv.cpp b/protocols/AimOscar/src/conv.cpp index a2e3420b2e..ca36a38663 100644 --- a/protocols/AimOscar/src/conv.cpp +++ b/protocols/AimOscar/src/conv.cpp @@ -726,7 +726,7 @@ char* get_fname(char *path) wchar_t* get_dir(wchar_t *path)
{
- wchar_t *cpath = mir_tstrdup(path);
+ wchar_t *cpath = mir_wstrdup(path);
wchar_t *swd = wcsrchr(cpath, '\\');
if (swd) swd[1] = 0; else cpath[0] = 0;
diff --git a/protocols/AimOscar/src/file.cpp b/protocols/AimOscar/src/file.cpp index d2a392b9a7..a186b29fa8 100644 --- a/protocols/AimOscar/src/file.cpp +++ b/protocols/AimOscar/src/file.cpp @@ -96,8 +96,8 @@ bool send_init_oft2(file_transfer *ft, char* file) void CAimProto::report_file_error(wchar_t *fname)
{
wchar_t errmsg[512];
- wchar_t* error = mir_a2t(_strerror(NULL));
- mir_sntprintf(errmsg, TranslateT("Failed to open file: %s : %s"), fname, error);
+ wchar_t* error = mir_a2u(_strerror(NULL));
+ mir_snwprintf(errmsg, TranslateT("Failed to open file: %s : %s"), fname, error);
mir_free(error);
ShowPopup((char*)errmsg, ERROR_POPUP | TCHAR_POPUP);
}
@@ -266,7 +266,7 @@ int CAimProto::receiving_file(file_transfer *ft, HANDLE hServerPacketRecver, NET oft2 *oft = NULL;
- ft->pfts.tszWorkingDir = mir_utf8decodeT(ft->file);
+ ft->pfts.tszWorkingDir = mir_utf8decodeW(ft->file);
//start listen for packets stuff
for (;;) {
@@ -314,20 +314,20 @@ int CAimProto::receiving_file(file_transfer *ft, HANDLE hServerPacketRecver, NET wchar_t* wbuf = (wchar_t*)buf;
wcs_htons(wbuf);
for (wchar_t *p = wbuf; *p; ++p) { if (*p == 1) *p = '\\'; }
- name = mir_u2t(wbuf);
+ name = mir_wstrdup(wbuf);
}
else {
for (char *p = buf; *p; ++p) { if (*p == 1) *p = '\\'; }
- name = mir_a2t(buf);
+ name = mir_a2u(buf);
}
mir_free(buf);
wchar_t fname[256];
- mir_sntprintf(fname, L"%s%s", ft->pfts.tszWorkingDir, name);
+ mir_snwprintf(fname, L"%s%s", ft->pfts.tszWorkingDir, name);
mir_free(name);
mir_free(ft->pfts.tszCurrentFile);
- ft->pfts.tszCurrentFile = mir_tstrdup(fname);
+ ft->pfts.tszCurrentFile = mir_wstrdup(fname);
ResetEvent(ft->hResumeEvent);
if (ProtoBroadcastAck(ft->hContact, ACKTYPE_FILE, ACKRESULT_FILERESUME, ft, (LPARAM)&ft->pfts))
diff --git a/protocols/AimOscar/src/links.cpp b/protocols/AimOscar/src/links.cpp index ea50d67c58..d759679d9f 100644 --- a/protocols/AimOscar/src/links.cpp +++ b/protocols/AimOscar/src/links.cpp @@ -92,9 +92,9 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) tok2 = wcschr(++tok, '&'); /* first token */
if (tok2) *tok2 = 0;
if (!wcsnicmp(tok, L"screenname=", 11) && *(tok + 11) != 0)
- sn = mir_t2a(url_decode(tok + 11));
+ sn = mir_u2a(url_decode(tok + 11));
if (!wcsnicmp(tok, L"groupname=", 10) && *(tok + 10) != 0)
- group = mir_utf8encodeT(url_decode(tok + 10)); /* group is currently ignored */
+ group = mir_utf8encodeW(url_decode(tok + 10)); /* group is currently ignored */
}
if (sn == NULL) {
mir_free(group);
@@ -119,7 +119,7 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) tok2 = wcschr(++tok, '&'); /* first token */
if (tok2) *tok2 = 0;
if (!wcsnicmp(tok, L"screenname=", 11) && *(tok + 11) != 0)
- sn = mir_t2a(url_decode(tok + 11));
+ sn = mir_u2a(url_decode(tok + 11));
if (!wcsnicmp(tok, L"message=", 8) && *(tok + 8) != 0)
msg = url_decode(tok + 8);
}
@@ -143,7 +143,7 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) tok2 = wcschr(++tok, '&'); /* first token */
if (tok2) *tok2 = 0;
if (!wcsnicmp(tok, L"roomname=", 9) && *(tok + 9) != 0) {
- rm = mir_t2a(url_decode(tok + 9));
+ rm = mir_u2a(url_decode(tok + 9));
for (char *ch = rm; *ch; ++ch)
if (*ch == '+') *ch = ' ';
}
diff --git a/protocols/AimOscar/src/popup.cpp b/protocols/AimOscar/src/popup.cpp index 8747508724..7e52cd572c 100644 --- a/protocols/AimOscar/src/popup.cpp +++ b/protocols/AimOscar/src/popup.cpp @@ -65,13 +65,13 @@ void CAimProto::ShowPopup(const char* msg, int flags, char* url) {
POPUPDATAT ppd = {0};
- mir_sntprintf(ppd.lptzContactName, TranslateT("%s Protocol"), m_tszUserName);
+ mir_snwprintf(ppd.lptzContactName, TranslateT("%s Protocol"), m_tszUserName);
if (flags & ERROR_POPUP)
{
if (flags & TCHAR_POPUP)
{
- char* errmsg = mir_t2a((wchar_t*)msg);
+ char* errmsg = mir_u2a((wchar_t*)msg);
debugLogA(errmsg);
mir_free(errmsg);
}
@@ -79,7 +79,7 @@ void CAimProto::ShowPopup(const char* msg, int flags, char* url) debugLogA(msg);
}
- wchar_t *msgt = (flags & TCHAR_POPUP) ? mir_tstrdup((wchar_t*)msg) : mir_a2t(msg);
+ wchar_t *msgt = (flags & TCHAR_POPUP) ? mir_wstrdup((wchar_t*)msg) : mir_a2u(msg);
wcsncpy_s(ppd.lptzText, TranslateTS(msgt), _TRUNCATE);
mir_free(msgt);
@@ -87,8 +87,8 @@ void CAimProto::ShowPopup(const char* msg, int flags, char* url) {
if (flags & MAIL_POPUP)
{
- size_t len = mir_tstrlen(ppd.lptzText);
- mir_sntprintf(&ppd.lptzText[len], _countof(ppd.lptzText) - len, L" %s", TranslateT("Open mail account?"));
+ size_t len = mir_wstrlen(ppd.lptzText);
+ mir_snwprintf(&ppd.lptzText[len], _countof(ppd.lptzText) - len, L" %s", TranslateT("Open mail account?"));
if (MessageBox(NULL, ppd.lptzText, ppd.lptzContactName, MB_YESNO | MB_ICONINFORMATION) == IDYES)
ShellExecuteA(NULL, "open", url, NULL, NULL, SW_SHOW);
}
diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp index a198c04b63..0a1f2e9e35 100644 --- a/protocols/AimOscar/src/proto.cpp +++ b/protocols/AimOscar/src/proto.cpp @@ -52,14 +52,14 @@ CAimProto::CAimProto(const char* aProtoName, const wchar_t* aUserName) : nlu.cbSize = sizeof(nlu);
nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
nlu.szSettingsModule = m_szModuleName;
- mir_sntprintf(descr, TranslateT("%s server connection"), m_tszUserName);
+ mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName);
nlu.ptszDescriptiveName = descr;
m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
char szP2P[128];
mir_snprintf(szP2P, "%sP2P", m_szModuleName);
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_TCHAR;
- mir_sntprintf(descr, TranslateT("%s client-to-client connections"), m_tszUserName);
+ mir_snwprintf(descr, TranslateT("%s client-to-client connections"), m_tszUserName);
nlu.szSettingsModule = szP2P;
nlu.minIncomingPorts = 1;
m_hNetlibPeer = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
@@ -155,7 +155,7 @@ HANDLE __cdecl CAimProto::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t *s {
file_transfer *ft = (file_transfer*)hTransfer;
if (ft && m_ft_list.find_by_ft(ft)) {
- char *path = mir_utf8encodeT(szPath);
+ char *path = mir_utf8encodeW(szPath);
if (ft->pfts.totalFiles > 1 && ft->file[0]) {
size_t path_len = mir_strlen(path);
@@ -231,7 +231,7 @@ int __cdecl CAimProto::FileResume(HANDLE hTransfer, int* action, const wchar_t** case FILERESUME_RENAME:
mir_free(ft->pfts.tszCurrentFile);
- ft->pfts.tszCurrentFile = mir_tstrdup(*szFilename);
+ ft->pfts.tszCurrentFile = mir_wstrdup(*szFilename);
break;
case FILERESUME_OVERWRITE:
@@ -321,7 +321,7 @@ HANDLE __cdecl CAimProto::SearchBasic(const wchar_t *szId) return 0;
//duplicating the parameter so that it isn't deleted before it's needed- e.g. this function ends before it's used
- ForkThread(&CAimProto::basic_search_ack_success, mir_t2a(szId));
+ ForkThread(&CAimProto::basic_search_ack_success, mir_u2a(szId));
return (HANDLE)1;
}
@@ -331,10 +331,10 @@ HANDLE __cdecl CAimProto::SearchBasic(const wchar_t *szId) HANDLE __cdecl CAimProto::SearchByEmail(const wchar_t *email)
{
// Maximum email size should really be 320, but the char string is limited to 255.
- if (m_state != 1 || email == NULL || mir_tstrlen(email) >= 254)
+ if (m_state != 1 || email == NULL || mir_wstrlen(email) >= 254)
return NULL;
- char *szEmail = mir_t2a(email);
+ char *szEmail = mir_u2a(email);
aim_search_by_email(m_hServerConn, m_seqno, szEmail);
mir_free(szEmail);
return (HANDLE)1;
@@ -396,9 +396,9 @@ HANDLE __cdecl CAimProto::SendFile(MCONTACT hContact, const wchar_t* szDescripti ft->pfts.flags |= PFTS_SENDING;
ft->pfts.ptszFiles = ppszFiles;
- ft->file = ft->pfts.totalFiles == 1 || isDir ? mir_utf8encodeT(ppszFiles[0]) : (char*)mir_calloc(1);
+ ft->file = ft->pfts.totalFiles == 1 || isDir ? mir_utf8encodeW(ppszFiles[0]) : (char*)mir_calloc(1);
ft->sending = true;
- ft->message = szDescription[0] ? mir_utf8encodeT(szDescription) : NULL;
+ ft->message = szDescription[0] ? mir_utf8encodeW(szDescription) : NULL;
ft->me_force_proxy = getByte(AIM_KEY_FP, 0) != 0;
ft->requester = true;
@@ -598,7 +598,7 @@ int __cdecl CAimProto::SetAwayMsg(int status, const wchar_t* msg) char **msgptr = get_status_msg_loc(status);
if (msgptr == NULL) return 1;
- char *nmsg = mir_utf8encodeT(msg);
+ char *nmsg = mir_utf8encodeW(msg);
mir_free(*msgptr); *msgptr = nmsg;
switch (status) {
diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp index 34bc6151e2..db3679447b 100644 --- a/protocols/AimOscar/src/server.cpp +++ b/protocols/AimOscar/src/server.cpp @@ -487,7 +487,7 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003 char* msg_s = process_status_msg(msg, sn);
db_set_utf(hContact, MOD_KEY_CL, OTH_KEY_SM, msg_s);
- wchar_t* tszMsg = mir_utf8decodeT(msg_s);
+ wchar_t* tszMsg = mir_utf8decodeW(msg_s);
ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, NULL, (LPARAM)tszMsg);
mir_free(tszMsg);
mir_free(msg);
@@ -1247,13 +1247,13 @@ void CAimProto::snac_received_message(SNAC &snac, HANDLE hServerConn, unsigned s if (!descr_included) msg_buf = NULL;
- wchar_t* filenameT = mir_utf8decodeT(filename);
+ wchar_t* filenameT = mir_utf8decodeW(filename);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.descr.w = mir_utf8decodeT(msg_buf);
+ pre.descr.w = mir_utf8decodeW(msg_buf);
pre.files.w = &filenameT;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(hContact, &pre);
@@ -1661,7 +1661,7 @@ void CAimProto::snac_mail_response(SNAC &snac)//family 0x0018 if (new_mail && num_msgs) {
wchar_t msg[1024];
- int len = mir_sntprintf(msg, L"%S@%S (%d)\r\n%s ", sn, address, num_msgs,
+ int len = mir_snwprintf(msg, L"%S@%S (%d)\r\n%s ", sn, address, num_msgs,
TranslateT("You've got mail! Checked at"));
SYSTEMTIME stLocal;
@@ -1864,19 +1864,19 @@ void CAimProto::snac_chat_received_message(SNAC &snac, chat_list_item* item)//fa if (uni) {
char* msg = msg_tlv.dupw();
html_decode(msg);
- message = mir_utf8decodeT(msg);
+ message = mir_utf8decodeW(msg);
mir_free(msg);
}
else if (utf) {
char* msg = msg_tlv.dup();
html_decode(msg);
- message = mir_utf8decodeT(msg);
+ message = mir_utf8decodeW(msg);
mir_free(msg);
}
else {
char* msg = msg_tlv.dup();
html_decode(msg);
- message = mir_a2t(msg);
+ message = mir_a2u(msg);
mir_free(msg);
}
}
diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp index ee833e6eee..71ebfb2e10 100755 --- a/protocols/AimOscar/src/ui.cpp +++ b/protocols/AimOscar/src/ui.cpp @@ -105,7 +105,7 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L cf.cbSize = sizeof(cf);
cf.yHeight = 12 * 20;
cf.dwMask = CFM_SIZE | CFM_FACE;
- mir_tstrcpy(cf.szFaceName, TEXT("Arial"));
+ mir_wstrcpy(cf.szFaceName, TEXT("Arial"));
SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
else {
@@ -190,7 +190,7 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L DBVARIANT dbv;
if (!db_get_utf(NULL, ppro->m_szModuleName, AIM_KEY_PR, &dbv)) {
html_decode(dbv.pszVal);
- wchar_t *txt = mir_utf8decodeT(dbv.pszVal);
+ wchar_t *txt = mir_utf8decodeW(dbv.pszVal);
SetDlgItemText(hwndDlg, IDC_PROFILE, txt);
mir_free(txt);
db_free(&dbv);
@@ -1270,7 +1270,7 @@ static void clist_chat_invite_send(MCONTACT hItem, HWND hwndList, chat_list_item wchar_t buf[128] = L"";
SendMessage(hwndList, CLM_GETITEMTEXT, (WPARAM)hItem, (LPARAM)buf);
- char *sn = mir_t2a(buf);
+ char *sn = mir_u2a(buf);
ppro->aim_chat_invite(ppro->m_hServerConn, ppro->m_seqno,
item->cookie, item->exchange, item->instance, sn, msg);
mir_free(sn);
diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp index 247d8bd3fa..10a18ba5af 100755 --- a/protocols/AimOscar/src/utility.cpp +++ b/protocols/AimOscar/src/utility.cpp @@ -363,7 +363,7 @@ void create_group(const char *group) {
if (mir_strcmp(group, AIM_DEFAULT_GROUP) == 0) return;
- wchar_t* szGroupName = mir_utf8decodeT(group);
+ wchar_t* szGroupName = mir_utf8decodeW(group);
Clist_GroupCreate(0, szGroupName);
mir_free(szGroupName);
}
@@ -533,18 +533,18 @@ int CAimProto::open_contact_file(const char*, const wchar_t* file, const char*, {
path = (wchar_t*)mir_alloc(MAX_PATH * sizeof(wchar_t));
- int pos = mir_sntprintf(path, MAX_PATH, L"%s\\%S", VARST(L"%miranda_userdata%"), m_szModuleName);
+ int pos = mir_snwprintf(path, MAX_PATH, L"%s\\%S", VARST(L"%miranda_userdata%"), m_szModuleName);
if (contact_dir)
- pos += mir_sntprintf(path + pos, MAX_PATH - pos, L"\\%S", m_szModuleName);
+ pos += mir_snwprintf(path + pos, MAX_PATH - pos, L"\\%S", m_szModuleName);
if (_waccess(path, 0))
CreateDirectoryTreeT(path);
- mir_sntprintf(path + pos, MAX_PATH - pos, L"\\%s", file);
+ mir_snwprintf(path + pos, MAX_PATH - pos, L"\\%s", file);
int fid = _wopen(path, _O_CREAT | _O_RDWR | _O_BINARY, _S_IREAD);
if (fid < 0) {
wchar_t errmsg[512];
- mir_sntprintf(errmsg, TranslateT("Failed to open file: %s %s"), path, __tcserror(NULL));
+ mir_snwprintf(errmsg, TranslateT("Failed to open file: %s %s"), path, __tcserror(NULL));
ShowPopup((char*)errmsg, ERROR_POPUP | TCHAR_POPUP);
}
return fid;
diff --git a/protocols/Dummy/src/dummy_proto.cpp b/protocols/Dummy/src/dummy_proto.cpp index 11643b57b3..2a75554c83 100644 --- a/protocols/Dummy/src/dummy_proto.cpp +++ b/protocols/Dummy/src/dummy_proto.cpp @@ -49,7 +49,7 @@ void CDummyProto::SearchIdAckThread(void *targ) static int sttCompareProtocols(const CDummyProto *p1, const CDummyProto *p2) { - return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName); + return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName); } LIST<CDummyProto> dummy_Instances(1, sttCompareProtocols); @@ -147,7 +147,7 @@ HANDLE CDummyProto::SearchBasic(const wchar_t* id) if (uniqueIdSetting[0] == '\0') return 0; - wchar_t *tid = mir_tstrdup(id); + wchar_t *tid = mir_wstrdup(id); ForkThread(&CDummyProto::SearchIdAckThread, tid); return tid; } diff --git a/protocols/EmLanProto/src/amdproto.cpp b/protocols/EmLanProto/src/amdproto.cpp index 49b41bd1d6..5956be29e0 100644 --- a/protocols/EmLanProto/src/amdproto.cpp +++ b/protocols/EmLanProto/src/amdproto.cpp @@ -79,7 +79,7 @@ static INT_PTR __cdecl EMPGetCaps(WPARAM wParam, LPARAM) static INT_PTR __cdecl EMPGetName(WPARAM wParam, LPARAM lParam)
{
- mir_tstrncpy((char*)lParam, "EmLan", wParam);
+ mir_strncpy((char*)lParam, "EmLan", wParam);
return 0;
}
diff --git a/protocols/EmLanProto/src/mlan.cpp b/protocols/EmLanProto/src/mlan.cpp index 1ba95f8429..25e0258bd5 100644 --- a/protocols/EmLanProto/src/mlan.cpp +++ b/protocols/EmLanProto/src/mlan.cpp @@ -383,9 +383,9 @@ void CMLan::RecvMessageUrl(CCSDATA* ccs) dbei.szModule = PROTONAME; dbei.timestamp = pre->timestamp; dbei.flags = pre->flags & PREF_CREATEREAD ? DBEF_READ : 0; - dbei.cbBlob = (DWORD)mir_tstrlen(pre->szMessage) + 1; + dbei.cbBlob = (DWORD)mir_strlen(pre->szMessage) + 1; if (!mir_strcmp(ccs->szProtoService, PSR_URL)) { - dbei.cbBlob += 2 + (DWORD)mir_tstrlen(pre->szMessage + dbei.cbBlob + 1); + dbei.cbBlob += 2 + (DWORD)mir_strlen(pre->szMessage + dbei.cbBlob + 1); } dbei.pBlob = (PBYTE)pre->szMessage; @@ -418,7 +418,7 @@ int CMLan::SendMessageUrl(CCSDATA* ccs, bool isUrl) int cid = GetRandomProcId(); size_t len; if (isUrl) { - len = mir_tstrlen((char*)ccs->lParam); + len = mir_strlen((char*)ccs->lParam); ((char*)ccs->lParam)[len] = 1; } TDataHolder* hold = new TDataHolder(ccs, cid, isUrl ? LEXT_SENDURL : LEXT_SENDMESSAGE, this); @@ -479,10 +479,10 @@ void CMLan::SearchExt(TDataHolder* hold) for (TContact *cont = m_pRootContact; cont; cont = cont->m_prev) { if (mir_strcmp(hold->msg, cont->m_nick) == 0 || mir_strcmp(hold->msg, "*") == 0) { char buf[MAX_HOSTNAME_LEN]; - mir_tstrcpy(buf, cont->m_nick); - size_t len = mir_tstrlen(buf); + mir_strcpy(buf, cont->m_nick); + size_t len = mir_strlen(buf); buf[len] = '@'; - mir_tstrcpy(buf + len + 1, inet_ntoa(cont->m_addr)); + mir_strcpy(buf + len + 1, inet_ntoa(cont->m_addr)); psr.nick.a = cont->m_nick; psr.firstName.a = ""; psr.lastName.a = ""; @@ -590,7 +590,7 @@ u_char* CMLan::CreatePacket(TPacket& pak, int* pBufLen) size_t nameLen; if (pak.strName) { - nameLen = mir_tstrlen(pak.strName); + nameLen = mir_strlen(pak.strName); len += 1 + 1 + nameLen + 1; } @@ -599,9 +599,9 @@ u_char* CMLan::CreatePacket(TPacket& pak, int* pBufLen) size_t mesLen = 0; if (pak.strMessage) { - mesLen = mir_tstrlen(pak.strMessage); + mesLen = mir_strlen(pak.strMessage); if (pak.flIsUrl) - mesLen += 1 + mir_tstrlen(pak.strMessage + mesLen + 1); + mesLen += 1 + mir_strlen(pak.strMessage + mesLen + 1); len += 3 + 1 + 4 + mesLen + 1; } @@ -613,7 +613,7 @@ u_char* CMLan::CreatePacket(TPacket& pak, int* pBufLen) size_t awayLen = 0; if (pak.strAwayMessage) { - awayLen = mir_tstrlen(pak.strAwayMessage); + awayLen = mir_strlen(pak.strAwayMessage); len += 3 + 1 + 4 + awayLen + 1; } @@ -780,9 +780,9 @@ void CMLan::LoadSettings() } if (!dbv.pszVal[0]) dbv.pszVal = "EmLan_User"; - mir_tstrcpy(m_name, dbv.pszVal); + mir_strcpy(m_name, dbv.pszVal); } - m_nameLen = (int)mir_tstrlen(m_name); + m_nameLen = (int)mir_strlen(m_name); if (GetStatus() != LM_LISTEN) { int ipcount = GetHostAddrCount(); diff --git a/protocols/FacebookRM/src/avatars.cpp b/protocols/FacebookRM/src/avatars.cpp index c41c7026d5..55c7f046e6 100644 --- a/protocols/FacebookRM/src/avatars.cpp +++ b/protocols/FacebookRM/src/avatars.cpp @@ -126,7 +126,7 @@ void FacebookProto::UpdateAvatarWorker(void *) std::wstring FacebookProto::GetAvatarFolder()
{
wchar_t path[MAX_PATH];
- mir_sntprintf(path, L"%s\\%s", VARST(L"%miranda_avatarcache%"), m_tszUserName);
+ mir_snwprintf(path, L"%s\\%s", VARST(L"%miranda_avatarcache%"), m_tszUserName);
return path;
}
diff --git a/protocols/FacebookRM/src/chat.cpp b/protocols/FacebookRM/src/chat.cpp index c3a02a8a22..eeb44b4c59 100644 --- a/protocols/FacebookRM/src/chat.cpp +++ b/protocols/FacebookRM/src/chat.cpp @@ -30,10 +30,10 @@ void FacebookProto::UpdateChat(const char *chat_id, const char *id, const char * std::string smessage = message; utils::text::replace_all(&smessage, "%", "%%"); - ptrT tid(mir_a2t(id)); - ptrT tnick(mir_a2t_cp(name, CP_UTF8)); - ptrT ttext(mir_a2t_cp(smessage.c_str(), CP_UTF8)); - ptrT tchat_id(mir_a2t(chat_id)); + ptrW tid(mir_a2u(id)); + ptrW tnick(mir_a2u_cp(name, CP_UTF8)); + ptrW ttext(mir_a2u_cp(smessage.c_str(), CP_UTF8)); + ptrW tchat_id(mir_a2u(chat_id)); GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_MESSAGE }; GCEVENT gce = { sizeof(gce), &gcd }; @@ -55,8 +55,8 @@ void FacebookProto::UpdateChat(const char *chat_id, const char *id, const char * void FacebookProto::RenameChat(const char *chat_id, const char *name) { - ptrT tchat_id(mir_a2t(chat_id)); - ptrT tname(mir_a2t_cp(name, CP_UTF8)); + ptrW tchat_id(mir_a2u(chat_id)); + ptrW tname(mir_a2u_cp(name, CP_UTF8)); GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_CHANGESESSIONAME }; GCEVENT gce = { sizeof(gce), &gcd }; @@ -72,7 +72,7 @@ int FacebookProto::OnGCEvent(WPARAM, LPARAM lParam) return 0; // Ignore for special chatrooms - if (!mir_tstrcmp(hook->pDest->ptszID, _A2W(FACEBOOK_NOTIFICATIONS_CHATROOM))) + if (!mir_wstrcmp(hook->pDest->ptszID, _A2W(FACEBOOK_NOTIFICATIONS_CHATROOM))) return 0; switch (hook->pDest->iType) @@ -169,9 +169,9 @@ void FacebookProto::AddChatContact(const char *chat_id, const chatroom_participa if (IsChatContact(chat_id, user.user_id.c_str())) return; - ptrT tchat_id(mir_a2t(chat_id)); - ptrT tnick(mir_a2t_cp(user.nick.c_str(), CP_UTF8)); - ptrT tid(mir_a2t(user.user_id.c_str())); + ptrW tchat_id(mir_a2u(chat_id)); + ptrW tnick(mir_a2u_cp(user.nick.c_str(), CP_UTF8)); + ptrW tid(mir_a2u(user.user_id.c_str())); GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_JOIN }; GCEVENT gce = { sizeof(gce), &gcd }; @@ -208,9 +208,9 @@ void FacebookProto::RemoveChatContact(const char *chat_id, const char *id, const if (!mir_strcmp(id, facy.self_.user_id.c_str())) return; - ptrT tchat_id(mir_a2t(chat_id)); - ptrT tnick(mir_a2t_cp(name, CP_UTF8)); - ptrT tid(mir_a2t(id)); + ptrW tchat_id(mir_a2u(chat_id)); + ptrW tnick(mir_a2u_cp(name, CP_UTF8)); + ptrW tid(mir_a2u(id)); GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_PART }; GCEVENT gce = { sizeof(gce), &gcd }; @@ -226,7 +226,7 @@ void FacebookProto::RemoveChatContact(const char *chat_id, const char *id, const /** Caller must free result */ char *FacebookProto::GetChatUsers(const char *chat_id) { - ptrT ptszChatID(mir_a2t(chat_id)); + ptrW ptszChatID(mir_a2u(chat_id)); GC_INFO gci = { 0 }; gci.Flags = GCF_USERS; @@ -246,7 +246,7 @@ bool FacebookProto::IsChatContact(const char *chat_id, const char *id) void FacebookProto::AddChat(const char *id, const wchar_t *tname) { - ptrT tid(mir_a2t(id)); + ptrW tid(mir_a2u(id)); // Create the group chat session GCSESSION gcw = { sizeof(gcw) }; @@ -285,8 +285,8 @@ INT_PTR FacebookProto::OnJoinChat(WPARAM hContact, LPARAM) if (!m_enableChat || IsSpecialChatRoom(hContact)) return 0; - ptrT idT(getTStringA(hContact, "ChatRoomID")); - ptrT nameT(getTStringA(hContact, "Nick")); + ptrW idT(getTStringA(hContact, "ChatRoomID")); + ptrW nameT(getTStringA(hContact, "Nick")); ptrA threadId(getStringA(hContact, FACEBOOK_KEY_TID)); if (!idT || !nameT || !threadId) @@ -338,7 +338,7 @@ INT_PTR FacebookProto::OnJoinChat(WPARAM hContact, LPARAM) INT_PTR FacebookProto::OnLeaveChat(WPARAM wParam, LPARAM) { - ptrT idT(wParam ? getTStringA(wParam, "ChatRoomID") : NULL); + ptrW idT(wParam ? getTStringA(wParam, "ChatRoomID") : NULL); GCDEST gcd = { m_szModuleName, NULL, GC_EVENT_CONTROL }; gcd.ptszID = idT; @@ -430,7 +430,7 @@ void FacebookProto::PrepareNotificationsChatRoom() { MCONTACT hNotificationsChatRoom = ChatIDToHContact(FACEBOOK_NOTIFICATIONS_CHATROOM); if (hNotificationsChatRoom == NULL || getDword(hNotificationsChatRoom, "Status", ID_STATUS_OFFLINE) != ID_STATUS_ONLINE) { wchar_t nameT[200]; - mir_sntprintf(nameT, L"%s: %s", m_tszUserName, TranslateT("Notifications")); + mir_snwprintf(nameT, L"%s: %s", m_tszUserName, TranslateT("Notifications")); // Create the group chat session GCSESSION gcw = { sizeof(gcw) }; @@ -460,8 +460,8 @@ void FacebookProto::UpdateNotificationsChatRoom(facebook_notification *notificat std::string message = text.str(); utils::text::replace_all(&message, "%", "%%"); - ptrT idT(mir_tstrdup(_A2W(FACEBOOK_NOTIFICATIONS_CHATROOM))); - ptrT messageT(mir_a2t_cp(message.c_str(), CP_UTF8)); + ptrW idT(mir_wstrdup(_A2W(FACEBOOK_NOTIFICATIONS_CHATROOM))); + ptrW messageT(mir_a2u_cp(message.c_str(), CP_UTF8)); GCDEST gcd = { m_szModuleName, _A2W(FACEBOOK_NOTIFICATIONS_CHATROOM), GC_EVENT_MESSAGE }; GCEVENT gce = { sizeof(gce), &gcd }; diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index cfbae1cbc9..63bdec6d32 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -727,7 +727,7 @@ void facebook_client::insert_reader(MCONTACT hContact, time_t timestamp, const s std::wstring treaders; // Load old readers - ptrT told(parent->getTStringA(hContact, FACEBOOK_KEY_MESSAGE_READERS)); + ptrW told(parent->getTStringA(hContact, FACEBOOK_KEY_MESSAGE_READERS)); if (told) treaders = std::wstring(told) + L", "; @@ -772,8 +772,8 @@ void loginError(FacebookProto *proto, std::string error_str) { proto->debugLogA("!!! Login error: %s", !error_str.empty() ? error_str.c_str() : "Unknown error"); wchar_t buf[200]; - mir_sntprintf(buf, TranslateT("Login error: %s"), - (error_str.empty()) ? TranslateT("Unknown error") : ptrT(mir_utf8decodeT(error_str.c_str()))); + mir_snwprintf(buf, TranslateT("Login error: %s"), + (error_str.empty()) ? TranslateT("Unknown error") : ptrW(mir_utf8decodeW(error_str.c_str()))); proto->facy.client_notify(buf); } @@ -932,7 +932,7 @@ bool facebook_client::login(const char *username, const char *password) std::string activity = utils::text::slashu_to_utf8(utils::text::source_get_value(&resp.data, 3, "<body", "</strong></div>", "</div>")); activity = utils::text::trim(utils::text::html_entities_decode(utils::text::remove_html(activity))); if (!activity.empty()) { - tszMessage.AppendFormat(L"\n\n%s", ptrT(mir_utf8decodeT(activity.c_str()))); + tszMessage.AppendFormat(L"\n\n%s", ptrW(mir_utf8decodeW(activity.c_str()))); } if (MessageBox(0, tszMessage, tszTitle, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON1) == IDYES) { diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp index 028c2a918f..ad82b665be 100644 --- a/protocols/FacebookRM/src/contacts.cpp +++ b/protocols/FacebookRM/src/contacts.cpp @@ -409,7 +409,7 @@ void FacebookProto::LoadChatInfo(facebook_chatroom *fbc) if (fbc->participants.size() > namesUsed) { wchar_t more[200]; - mir_sntprintf(more, TranslateT("%s and more (%d)"), fbc->chat_name.c_str(), fbc->participants.size() - namesUsed); + mir_snwprintf(more, TranslateT("%s and more (%d)"), fbc->chat_name.c_str(), fbc->participants.size() - namesUsed); fbc->chat_name = more; } @@ -734,7 +734,7 @@ void FacebookProto::SendPokeWorker(void *p) message = utils::text::html_entities_decode( utils::text::remove_html(message)); - ptrT tmessage(mir_utf8decodeT(message.c_str())); + ptrW tmessage(mir_utf8decodeW(message.c_str())); NotifyEvent(m_tszUserName, tmessage, NULL, FACEBOOK_EVENT_OTHER); } diff --git a/protocols/FacebookRM/src/definitions.h b/protocols/FacebookRM/src/definitions.h index 97c8025833..1fd4102920 100644 --- a/protocols/FacebookRM/src/definitions.h +++ b/protocols/FacebookRM/src/definitions.h @@ -39,5 +39,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define NIIF_INTERN_TCHAR NIIF_INTERN_UNICODE // m_clist.h
-#define mir_tstrdup mir_wstrdup // m_system.h
+#define mir_wstrdup mir_wstrdup // m_system.h
diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp index 75aa98da3b..8574cf9431 100644 --- a/protocols/FacebookRM/src/dialogs.cpp +++ b/protocols/FacebookRM/src/dialogs.cpp @@ -159,7 +159,7 @@ void GetSelectedContacts(FacebookProto *proto, MCONTACT hItem, HWND hwndList, st if (userId) fu->user_id = userId; - ptrT realName(proto->getTStringA(hItem, FACEBOOK_KEY_NICK)); + ptrW realName(proto->getTStringA(hItem, FACEBOOK_KEY_NICK)); if (realName) fu->real_name = _T2A(realName); @@ -201,7 +201,7 @@ INT_PTR CALLBACK FBMindProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lpara SendDlgItemMessage(hwnd, IDC_MINDMSG, EM_LIMITTEXT, FACEBOOK_MIND_LIMIT, 0); SendDlgItemMessage(hwnd, IDC_URL, EM_LIMITTEXT, 1024, 0); - ptrT place(data->proto->getTStringA(FACEBOOK_KEY_PLACE)); + ptrW place(data->proto->getTStringA(FACEBOOK_KEY_PLACE)); SetDlgItemText(hwnd, IDC_PLACE, place != NULL ? place : L"Miranda NG"); bShowContacts = data->proto->getByte("PostStatusExpand", 0) > 0; @@ -405,7 +405,7 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp GetDlgItemText(hwnd, IDC_GROUP, tstr, _countof(tstr)); if (tstr[0] != '\0') { - proto->m_tszDefaultGroup = mir_tstrdup(tstr); + proto->m_tszDefaultGroup = mir_wstrdup(tstr); proto->setTString(FACEBOOK_KEY_DEF_GROUP, tstr); Clist_GroupCreate(0, tstr); } diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index 2ab26361da..cd17067e89 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -328,7 +328,7 @@ void parseAttachments(FacebookProto *proto, std::string *message_text, const JSO newText = _A2T(type.c_str()); wchar_t title[200]; - mir_sntprintf(title, TranslateT("User sent %s:"), newText.c_str()); + mir_snwprintf(title, TranslateT("User sent %s:"), newText.c_str()); *message_text += T2Utf(title); *message_text += attachments_text; @@ -615,7 +615,7 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo // Notify it, if user wants to be notified if (proto->getByte(FACEBOOK_KEY_EVENT_FRIENDSHIP_ENABLE, DEFAULT_EVENT_FRIENDSHIP_ENABLE)) { - proto->NotifyEvent(proto->m_tszUserName, ptrT(mir_utf8decodeT(text.c_str())), NULL, FACEBOOK_EVENT_FRIENDSHIP, &url, alert_id.empty() ? NULL : &alert_id); + proto->NotifyEvent(proto->m_tszUserName, ptrW(mir_utf8decodeW(text.c_str())), NULL, FACEBOOK_EVENT_FRIENDSHIP, &url, alert_id.empty() ? NULL : &alert_id); } } } @@ -671,13 +671,13 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo participant = participants.find(from_id); if (participant != participants.end()) { MCONTACT hChatContact = proto->ChatIDToHContact(tid); - ptrT name(mir_utf8decodeT(participant->second.nick.c_str())); + ptrW name(mir_utf8decodeW(participant->second.nick.c_str())); if (st_.as_int() == 1) { StatusTextData st = { 0 }; st.cbSize = sizeof(st); - mir_sntprintf(st.tszText, TranslateT("%s is typing a message..."), name); + mir_snwprintf(st.tszText, TranslateT("%s is typing a message..."), name); CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, (LPARAM)&st); } @@ -775,8 +775,8 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo client = FACEBOOK_CLIENT_OTHER; } - ptrT oldClient(proto->getTStringA(hContact, "MirVer")); - if (!oldClient || mir_tstrcmp(oldClient, client)) + ptrW oldClient(proto->getTStringA(hContact, "MirVer")); + if (!oldClient || mir_wstrcmp(oldClient, client)) proto->setTString(hContact, "MirVer", client); } } @@ -813,13 +813,13 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo std::string url = FACEBOOK_URL_PROFILE + fbu->user_id; std::string contactname = getContactName(this, fbu->handle, !fbu->real_name.empty() ? fbu->real_name.c_str() : fbu->user_id.c_str()); - ptrT szTitle(mir_utf8decodeT(contactname.c_str())); + ptrW szTitle(mir_utf8decodeW(contactname.c_str())); NotifyEvent(szTitle, TranslateT("Contact is back on server-list."), fbu->handle, FACEBOOK_EVENT_FRIENDSHIP, &url); } */ - /* ptrT client(getTStringA(fbu->handle, "MirVer")); - if (!client || mir_tstrcmp(client, fbu->getMirVer())) + /* ptrW client(getTStringA(fbu->handle, "MirVer")); + if (!client || mir_wstrcmp(client, fbu->getMirVer())) setTString(fbu->handle, "MirVer", fbu->getMirVer()); */ @@ -894,8 +894,8 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo client = FACEBOOK_CLIENT_OTHER; }*/ - ptrT oldClient(proto->getTStringA(hContact, "MirVer")); - if (!oldClient || mir_tstrcmp(oldClient, client)) + ptrW oldClient(proto->getTStringA(hContact, "MirVer")); + if (!oldClient || mir_wstrcmp(oldClient, client)) proto->setTString(hContact, "MirVer", client); } } @@ -922,7 +922,7 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo proto->debugLogA("+++ Got ticker type='%s' class='%s'", story_type.c_str(), story_class.c_str()); if (!text.empty()) - proto->NotifyEvent(proto->m_tszUserName, ptrT(mir_utf8decodeT(text.c_str())), hContact, FACEBOOK_EVENT_TICKER, &url); + proto->NotifyEvent(proto->m_tszUserName, ptrW(mir_utf8decodeW(text.c_str())), hContact, FACEBOOK_EVENT_TICKER, &url); } else if (t == "mercury") { // rename multi user chat, video call, ... @@ -1073,7 +1073,7 @@ int facebook_json_parser::parse_thread_messages(std::string *data, std::vector< chatrooms->erase(iter); // this is not chatroom } else { - iter->second->chat_name = std::wstring(ptrT(mir_utf8decodeT(name.as_string().c_str()))); // TODO: create name from users if there is no name... + iter->second->chat_name = std::wstring(ptrW(mir_utf8decodeW(name.as_string().c_str()))); // TODO: create name from users if there is no name... const JSONNode &participants = (*it)["participants"]; for (auto jt = participants.begin(); jt != participants.end(); ++jt) { @@ -1275,7 +1275,7 @@ int facebook_json_parser::parse_chat_info(std::string *data, facebook_chatroom* fbc->is_archived = (*it)["is_archived"].as_bool(); fbc->is_subscribed = (*it)["is_subscribed"].as_bool(); fbc->read_only = (*it)["read_only"].as_bool(); - fbc->chat_name = std::wstring(ptrT(mir_utf8decodeT(name_.as_string().c_str()))); + fbc->chat_name = std::wstring(ptrW(mir_utf8decodeW(name_.as_string().c_str()))); } return EXIT_SUCCESS; diff --git a/protocols/FacebookRM/src/main.cpp b/protocols/FacebookRM/src/main.cpp index bf63f1f8a7..35f9477192 100644 --- a/protocols/FacebookRM/src/main.cpp +++ b/protocols/FacebookRM/src/main.cpp @@ -49,7 +49,7 @@ PLUGININFOEX pluginInfo = { // Protocol instances
static int compare_protos(const FacebookProto *p1, const FacebookProto *p2)
{
- return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName);
+ return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName);
}
OBJLIST<FacebookProto> g_Instances(1, compare_protos);
diff --git a/protocols/FacebookRM/src/messages.cpp b/protocols/FacebookRM/src/messages.cpp index e5777e6f29..5076730817 100644 --- a/protocols/FacebookRM/src/messages.cpp +++ b/protocols/FacebookRM/src/messages.cpp @@ -218,7 +218,7 @@ void FacebookProto::StickerAsSmiley(std::string sticker, const std::string &url, b64 = utils::url::encode(b64); std::wstring filename = GetAvatarFolder() + L"\\stickers\\"; - ptrT dir(mir_tstrdup(filename.c_str())); + ptrW dir(mir_wstrdup(filename.c_str())); filename += (wchar_t*)_A2T(b64.c_str()); filename += L".png"; diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index 6be6c3f539..3a3e00905c 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -134,7 +134,7 @@ void FacebookProto::ProcessFriendList(void*) std::string url = FACEBOOK_URL_PROFILE + fbu->user_id; std::string contactname = getContactName(this, hContact, !fbu->real_name.empty() ? fbu->real_name.c_str() : fbu->user_id.c_str()); - ptrT szTitle(mir_utf8decodeT(contactname.c_str())); + ptrW szTitle(mir_utf8decodeW(contactname.c_str())); NotifyEvent(szTitle, TranslateT("Contact is back on server-list."), hContact, FACEBOOK_EVENT_FRIENDSHIP, &url); } } @@ -158,7 +158,7 @@ void FacebookProto::ProcessFriendList(void*) std::string url = FACEBOOK_URL_PROFILE + std::string(id); std::string contactname = getContactName(this, hContact, id); - ptrT szTitle(mir_utf8decodeT(contactname.c_str())); + ptrW szTitle(mir_utf8decodeW(contactname.c_str())); NotifyEvent(szTitle, TranslateT("Contact is no longer on server-list."), hContact, FACEBOOK_EVENT_FRIENDSHIP, &url); } } @@ -518,7 +518,7 @@ void FacebookProto::SyncThreads(void*) std::string truncateUtf8(std::string &text, size_t maxLength) { // To not split some unicode character we need to transform it to wchar_t first, then split it, and then convert it back, because we want std::string as result // TODO: Probably there is much simpler and nicer way - std::wstring ttext = ptrT(mir_utf8decodeT(text.c_str())); + std::wstring ttext = ptrW(mir_utf8decodeW(text.c_str())); if (ttext.length() > maxLength) { ttext = ttext.substr(0, maxLength) + L"\x2026"; // unicode ellipsis return std::string(_T2A(ttext.c_str(), CP_UTF8)); @@ -703,8 +703,8 @@ void FacebookProto::ProcessMemories(void*) for (std::vector<facebook_newsfeed*>::size_type i = 0; i < news.size(); i++) { - ptrT tszTitle(mir_utf8decodeT(news[i]->title.c_str())); - ptrT tszText(mir_utf8decodeT(news[i]->text.c_str())); + ptrW tszTitle(mir_utf8decodeW(news[i]->title.c_str())); + ptrW tszText(mir_utf8decodeW(news[i]->text.c_str())); NotifyEvent(TranslateT("On this day"), tszText, NULL, FACEBOOK_EVENT_ON_THIS_DAY, &news[i]->link); delete news[i]; @@ -952,7 +952,7 @@ void FacebookProto::ShowNotifications() { facebook_notification *notification = it->second; if (notification != NULL && !notification->seen) { debugLogA(" Showing popup for notification ID: %s", notification->id.c_str()); - ptrT szText(mir_utf8decodeT(notification->text.c_str())); + ptrW szText(mir_utf8decodeW(notification->text.c_str())); MCONTACT hContact = (notification->user_id.empty() ? NULL : ContactIDToHContact(notification->user_id)); notification->hWndPopup = NotifyEvent(m_tszUserName, szText, hContact, FACEBOOK_EVENT_NOTIFICATION, ¬ification->link, ¬ification->id, notification->icon); notification->seen = true; @@ -1124,8 +1124,8 @@ void FacebookProto::ProcessFeeds(void*) for (std::vector<facebook_newsfeed*>::size_type i = 0; i < news.size(); i++) { - ptrT tszTitle(mir_utf8decodeT(news[i]->title.c_str())); - ptrT tszText(mir_utf8decodeT(news[i]->text.c_str())); + ptrW tszTitle(mir_utf8decodeW(news[i]->title.c_str())); + ptrW tszText(mir_utf8decodeW(news[i]->text.c_str())); MCONTACT hContact = ContactIDToHContact(news[i]->user_id); NotifyEvent(tszTitle, tszText, hContact, FACEBOOK_EVENT_NEWSFEED, &news[i]->link); @@ -1237,11 +1237,11 @@ void FacebookProto::SearchAckThread(void *targ) if (id.empty() || id == facy.self_.user_id) continue; - ptrT tid(mir_utf8decodeT(id.c_str())); - ptrT tname(mir_utf8decodeT(utils::text::html_entities_decode(name).c_str())); - ptrT tsurname(mir_utf8decodeT(utils::text::html_entities_decode(surname).c_str())); - ptrT tnick(mir_utf8decodeT(utils::text::html_entities_decode(nick).c_str())); - ptrT tcommon(mir_utf8decodeT(utils::text::html_entities_decode(common).c_str())); + ptrW tid(mir_utf8decodeW(id.c_str())); + ptrW tname(mir_utf8decodeW(utils::text::html_entities_decode(name).c_str())); + ptrW tsurname(mir_utf8decodeW(utils::text::html_entities_decode(surname).c_str())); + ptrW tnick(mir_utf8decodeW(utils::text::html_entities_decode(nick).c_str())); + ptrW tcommon(mir_utf8decodeW(utils::text::html_entities_decode(common).c_str())); PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); @@ -1300,9 +1300,9 @@ void FacebookProto::SearchIdAckThread(void *targ) // ignore self contact and empty ids if (!id.empty() && id != facy.self_.user_id){ - ptrT tid(mir_utf8decodeT(id.c_str())); - ptrT tname(mir_utf8decodeT(name.c_str())); - ptrT tsurname(mir_utf8decodeT(surname.c_str())); + ptrW tid(mir_utf8decodeW(id.c_str())); + ptrW tname(mir_utf8decodeW(name.c_str())); + ptrW tsurname(mir_utf8decodeW(surname.c_str())); PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index a0fdcf6c52..667738556f 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -48,11 +48,11 @@ FacebookProto::FacebookProto(const char* proto_name, const wchar_t* username) : m_locale = locale; // Load custom page prefix, if set - ptrT pagePrefix(getTStringA(FACEBOOK_KEY_PAGE_PREFIX)); + ptrW pagePrefix(getTStringA(FACEBOOK_KEY_PAGE_PREFIX)); m_pagePrefix = (pagePrefix != NULL) ? _T2A(pagePrefix, CP_UTF8) : TEXT_EMOJI_PAGE; if (m_tszDefaultGroup == NULL) - m_tszDefaultGroup = mir_tstrdup(L"Facebook"); + m_tszDefaultGroup = mir_wstrdup(L"Facebook"); CreateProtoService(PS_CREATEACCMGRUI, &FacebookProto::SvcCreateAccMgrUI); CreateProtoService(PS_GETMYAWAYMSG, &FacebookProto::GetMyAwayMsg); @@ -86,12 +86,12 @@ FacebookProto::FacebookProto(const char* proto_name, const wchar_t* username) : NETLIBUSER nlu = { sizeof(nlu) }; nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR; nlu.szSettingsModule = m_szModuleName; - mir_sntprintf(descr, TranslateT("%s server connection"), m_tszUserName); + mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName); nlu.ptszDescriptiveName = descr; m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); if (m_hNetlibUser == NULL) { wchar_t error[200]; - mir_sntprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName); + mir_snwprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName); MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR); } @@ -253,7 +253,7 @@ HANDLE FacebookProto::SearchBasic(const wchar_t* id) if (isOffline()) return 0; - wchar_t *tid = mir_tstrdup(id); + wchar_t *tid = mir_wstrdup(id); ForkThread(&FacebookProto::SearchIdAckThread, tid); return tid; } @@ -263,7 +263,7 @@ HANDLE FacebookProto::SearchByEmail(const wchar_t* email) if (isOffline()) return 0; - wchar_t *temail = mir_tstrdup(email); + wchar_t *temail = mir_wstrdup(email); ForkThread(&FacebookProto::SearchAckThread, temail); return temail; } @@ -271,15 +271,15 @@ HANDLE FacebookProto::SearchByEmail(const wchar_t* email) HANDLE FacebookProto::SearchByName(const wchar_t* nick, const wchar_t* firstName, const wchar_t* lastName) { wchar_t arg[200]; - mir_sntprintf(arg, L"%s %s %s", nick, firstName, lastName); + mir_snwprintf(arg, L"%s %s %s", nick, firstName, lastName); return SearchByEmail(arg); // Facebook is using one search method for everything (except IDs) } MCONTACT FacebookProto::AddToList(int flags, PROTOSEARCHRESULT* psr) { - ptrA id(mir_t2a_cp(psr->id.w, CP_UTF8)); - ptrA name(mir_t2a_cp(psr->firstName.w, CP_UTF8)); - ptrA surname(mir_t2a_cp(psr->lastName.w, CP_UTF8)); + ptrA id(mir_u2a_cp(psr->id.w, CP_UTF8)); + ptrA name(mir_u2a_cp(psr->firstName.w, CP_UTF8)); + ptrA surname(mir_u2a_cp(psr->lastName.w, CP_UTF8)); if (id == NULL) return NULL; @@ -380,11 +380,11 @@ int FacebookProto::GetInfo(MCONTACT hContact, int) INT_PTR FacebookProto::GetMyAwayMsg(WPARAM, LPARAM lParam) { - ptrT statusMsg(getTStringA("StatusMsg")); + ptrW statusMsg(getTStringA("StatusMsg")); if (statusMsg == NULL || statusMsg[0] == '\0') return 0; - return (lParam & SGMA_UNICODE) ? (INT_PTR)mir_t2u(statusMsg) : (INT_PTR)mir_t2a(statusMsg); + return (lParam & SGMA_UNICODE) ? (INT_PTR)mir_wstrdup(statusMsg) : (INT_PTR)mir_u2a(statusMsg); } int FacebookProto::OnIdleChanged(WPARAM, LPARAM lParam) @@ -570,7 +570,7 @@ INT_PTR FacebookProto::OnMind(WPARAM wParam, LPARAM) if (wall->user_id == facy.self_.user_id) { for (std::map<std::string, std::string>::iterator iter = facy.pages.begin(); iter != facy.pages.end(); ++iter) { - data->walls.push_back(new wall_data(iter->first, mir_utf8decodeT(iter->second.c_str()), true)); + data->walls.push_back(new wall_data(iter->first, mir_utf8decodeW(iter->second.c_str()), true)); } } @@ -782,7 +782,7 @@ INT_PTR FacebookProto::CancelFriendship(WPARAM wParam, LPARAM lParam) if (isChatRoom(hContact) || (deleting && getByte(hContact, FACEBOOK_KEY_CONTACT_TYPE) != CONTACT_FRIEND)) return 0; - ptrT tname(getTStringA(hContact, FACEBOOK_KEY_NICK)); + ptrW tname(getTStringA(hContact, FACEBOOK_KEY_NICK)); if (tname == NULL) tname = getTStringA(hContact, FACEBOOK_KEY_ID); @@ -790,7 +790,7 @@ INT_PTR FacebookProto::CancelFriendship(WPARAM wParam, LPARAM lParam) return 1; wchar_t tstr[256]; - mir_sntprintf(tstr, TranslateT("Do you want to cancel your friendship with '%s'?"), tname); + mir_snwprintf(tstr, TranslateT("Do you want to cancel your friendship with '%s'?"), tname); if (MessageBox(0, tstr, m_tszUserName, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2) == IDYES) { ptrA id(getStringA(hContact, FACEBOOK_KEY_ID)); @@ -923,10 +923,10 @@ std::string FacebookProto::PrepareUrl(std::string url) { void FacebookProto::OpenUrl(std::string url) { url = PrepareUrl(url); - ptrT data(mir_utf8decodeT(url.c_str())); + ptrW data(mir_utf8decodeW(url.c_str())); // Check if there is user defined browser for opening links - ptrT browser(getTStringA(FACEBOOK_KEY_OPEN_URL_BROWSER)); + ptrW browser(getTStringA(FACEBOOK_KEY_OPEN_URL_BROWSER)); if (browser != NULL) // If so, use it to open this link ForkThread(&FacebookProto::OpenUrlThread, new open_url(browser, data)); @@ -1009,7 +1009,7 @@ void FacebookProto::InitPopups() char name[256]; // Client - mir_sntprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Client errors")); + mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Client errors")); mir_snprintf(name, "%s_%s", m_szModuleName, "Client"); ppc.ptszDescription = desc; ppc.pszName = name; @@ -1020,7 +1020,7 @@ void FacebookProto::InitPopups() popupClasses.push_back(Popup_RegisterClass(&ppc)); // Newsfeeds - mir_sntprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Wall posts")); + mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Wall posts")); mir_snprintf(name, "%s_%s", m_szModuleName, "Newsfeed"); ppc.ptszDescription = desc; ppc.pszName = name; @@ -1031,7 +1031,7 @@ void FacebookProto::InitPopups() popupClasses.push_back(Popup_RegisterClass(&ppc)); // Notifications - mir_sntprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Notifications")); + mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Notifications")); mir_snprintf(name, "%s_%s", m_szModuleName, "Notification"); ppc.ptszDescription = desc; ppc.pszName = name; @@ -1042,7 +1042,7 @@ void FacebookProto::InitPopups() popupClasses.push_back(Popup_RegisterClass(&ppc)); // Others - mir_sntprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Other events")); + mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Other events")); mir_snprintf(name, "%s_%s", m_szModuleName, "Other"); ppc.ptszDescription = desc; ppc.pszName = name; @@ -1053,7 +1053,7 @@ void FacebookProto::InitPopups() popupClasses.push_back(Popup_RegisterClass(&ppc)); // Friendship changes - mir_sntprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Friendship events")); + mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Friendship events")); mir_snprintf(name, "%s_%s", m_szModuleName, "Friendship"); ppc.ptszDescription = desc; ppc.pszName = name; @@ -1064,7 +1064,7 @@ void FacebookProto::InitPopups() popupClasses.push_back(Popup_RegisterClass(&ppc)); // Ticker - mir_sntprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Real-time friends activity")); + mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Real-time friends activity")); mir_snprintf(name, "%s_%s", m_szModuleName, "Ticker"); ppc.ptszDescription = desc; ppc.pszName = name; @@ -1075,7 +1075,7 @@ void FacebookProto::InitPopups() popupClasses.push_back(Popup_RegisterClass(&ppc)); // On this day (memories) - mir_sntprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Memories")); + mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Memories")); mir_snprintf(name, "%s_%s", m_szModuleName, "Memories"); ppc.ptszDescription = desc; ppc.pszName = name; @@ -1151,11 +1151,11 @@ void FacebookProto::MessageRead(MCONTACT hContact) if (isChatRoom(hContact)) { // Load readers names - ptrT treaders(getTStringA(hContact, FACEBOOK_KEY_MESSAGE_READERS)); - mir_sntprintf(st.tszText, TranslateT("Message read: %s by %s"), ttime, treaders ? treaders : L"???"); + ptrW treaders(getTStringA(hContact, FACEBOOK_KEY_MESSAGE_READERS)); + mir_snwprintf(st.tszText, TranslateT("Message read: %s by %s"), ttime, treaders ? treaders : L"???"); CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st); } else if (!ServiceExists(MS_MESSAGESTATE_UPDATE)){ - mir_sntprintf(st.tszText, TranslateT("Message read: %s"), ttime); + mir_snwprintf(st.tszText, TranslateT("Message read: %s"), ttime); CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st); } } diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h index d7792aa029..cb1b8febe3 100644 --- a/protocols/FacebookRM/src/proto.h +++ b/protocols/FacebookRM/src/proto.h @@ -250,7 +250,7 @@ public: HANDLE log_lock_; HANDLE update_loop_lock_; - ptrT m_tszDefaultGroup; + ptrW m_tszDefaultGroup; std::vector<HANDLE> popupClasses; diff --git a/protocols/GTalkExt/src/avatar.cpp b/protocols/GTalkExt/src/avatar.cpp index edd023c8d5..9c87926832 100644 --- a/protocols/GTalkExt/src/avatar.cpp +++ b/protocols/GTalkExt/src/avatar.cpp @@ -45,7 +45,7 @@ LPTSTR CreateAvaFile(HANDLE *hFile) return NULL;
wchar_t full[MAX_PATH + 2];
- mir_sntprintf(full, AVA_FILE_NAME_FORMAT, path, name);
+ mir_snwprintf(full, AVA_FILE_NAME_FORMAT, path, name);
CreateDirectoryTreeT(full);
HANDLE h = CreateFile(full, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
@@ -57,7 +57,7 @@ LPTSTR CreateAvaFile(HANDLE *hFile) else
CloseHandle(h);
- return mir_tstrdup(full);
+ return mir_wstrdup(full);
}
BOOL SaveAvatar(HANDLE hFile)
@@ -144,7 +144,7 @@ void SetAvatar(MCONTACT hContact) return;
HANDLE hFile;
- ptrT avaFile(CreateAvaFile(&hFile));
+ ptrW avaFile(CreateAvaFile(&hFile));
if (avaFile == NULL)
return;
diff --git a/protocols/GTalkExt/src/handlers.cpp b/protocols/GTalkExt/src/handlers.cpp index 5dd4cf0345..485dc454a4 100644 --- a/protocols/GTalkExt/src/handlers.cpp +++ b/protocols/GTalkExt/src/handlers.cpp @@ -41,25 +41,25 @@ GoogleTalkAcc* isGoogle(LPARAM lParam) void FormatMessageUrl(LPCTSTR format, LPTSTR buf, LPCTSTR mailbox, LPCTSTR tid)
{
ULARGE_INTEGER iTid; iTid.QuadPart = _wtoi64(tid);
- size_t l = mir_tstrlen(buf);
- mir_sntprintf(buf, l, format, mailbox, iTid.HighPart, iTid.LowPart);
- assert(l >= mir_tstrlen(buf));
+ size_t l = mir_wstrlen(buf);
+ mir_snwprintf(buf, l, format, mailbox, iTid.HighPart, iTid.LowPart);
+ assert(l >= mir_wstrlen(buf));
}
void MakeUrlHex(LPTSTR url, LPCTSTR tid)
{
ULARGE_INTEGER iTid; iTid.QuadPart = _wtoi64(tid);
LPTSTR tidInUrl = wcsstr(url, tid);
- LPTSTR trail = tidInUrl + mir_tstrlen(tid);
+ LPTSTR trail = tidInUrl + mir_wstrlen(tid);
wsprintf(tidInUrl, L"%x%08x", iTid.HighPart, iTid.LowPart); //!!!!!!!!!!!!
- wmemmove(tidInUrl + mir_tstrlen(tidInUrl), trail, mir_tstrlen(trail) + 1);
+ wmemmove(tidInUrl + mir_wstrlen(tidInUrl), trail, mir_wstrlen(trail) + 1);
}
LPTSTR ExtractJid(LPCTSTR jidWithRes)
{
LPCTSTR p = wcsrchr(jidWithRes, '/');
if (p == NULL)
- return mir_tstrdup(jidWithRes);
+ return mir_wstrdup(jidWithRes);
size_t l = size_t(p - jidWithRes);
LPTSTR result = (LPTSTR)mir_alloc((l + 1) * sizeof(wchar_t));
@@ -149,7 +149,7 @@ BOOL MailListHandler(IJabberInterface *ji, HXML node, void *) {
LPCTSTR jidWithRes = xmlGetAttrValue(node, ATTRNAME_TO);
__try {
- if (!node || mir_tstrcmp(xmlGetAttrValue(node, ATTRNAME_TYPE), IQTYPE_RESULT)) return TRUE;
+ if (!node || mir_wstrcmp(xmlGetAttrValue(node, ATTRNAME_TYPE), IQTYPE_RESULT)) return TRUE;
LPCTSTR jid = xmlGetAttrValue(node, ATTRNAME_FROM);
assert(jid);
@@ -177,15 +177,15 @@ void RequestMail(LPCTSTR jidWithRes, IJabberInterface *ji) xmlAddAttr(node, ATTRNAME_FROM, jidWithRes);
UINT uID = ji->SerialNext();
- ptrT jid(ExtractJid(jidWithRes));
+ ptrW jid(ExtractJid(jidWithRes));
xmlAddAttr(node, ATTRNAME_TO, jid);
- ptrT
+ ptrW
lastMailTime(ReadJidSetting(LAST_MAIL_TIME_FROM_JID, jid)),
lastThreadId(ReadJidSetting(LAST_THREAD_ID_FROM_JID, jid));
wchar_t id[30];
- mir_sntprintf(id, JABBER_IQID_FORMAT, uID);
+ mir_snwprintf(id, JABBER_IQID_FORMAT, uID);
xmlAddAttr(node, ATTRNAME_ID, id);
child = xmlAddChild(node, NODENAME_QUERY, NULL);
@@ -241,11 +241,11 @@ void SetNotificationSetting(LPCTSTR jidWithResource, IJabberInterface *ji) xmlAddAttr(node, ATTRNAME_TYPE, IQTYPE_SET);
xmlAddAttr(node, ATTRNAME_FROM, jidWithResource);
- ptrT jid(ExtractJid(jidWithResource));
+ ptrW jid(ExtractJid(jidWithResource));
xmlAddAttr(node, ATTRNAME_TO, jid);
wchar_t id[30];
- mir_sntprintf(id, JABBER_IQID_FORMAT, ji->SerialNext());
+ mir_snwprintf(id, JABBER_IQID_FORMAT, ji->SerialNext());
xmlAddAttr(node, ATTRNAME_ID, id);
child = xmlAddChild(node, NODENAME_USERSETTING, NULL);
@@ -294,7 +294,7 @@ BOOL SendHandler(IJabberInterface *ji, HXML node, void *) ji->AddTemporaryIqHandler(DiscoverHandler, JABBER_IQ_TYPE_RESULT, _wtoi(ptszId + 4), NULL, RESPONSE_TIMEOUT, 500);
}
- if (!mir_tstrcmp(xmlGetName(node), L"presence") && xmlGetAttrValue(node, ATTRNAME_TO) == 0) {
+ if (!mir_wstrcmp(xmlGetName(node), L"presence") && xmlGetAttrValue(node, ATTRNAME_TO) == 0) {
if (!gta->m_bGoogleSharedStatus)
return FALSE;
@@ -317,7 +317,7 @@ BOOL OnIqResultGoogleSharedStatus(IJabberInterface *ji, HXML node, void *) {
GoogleTalkAcc *gta = isGoogle(LPARAM(ji));
if (gta != NULL) {
- gta->m_bGoogleSharedStatus = mir_tstrcmp(xmlGetAttrValue(node, ATTRNAME_TYPE), IQTYPE_RESULT) == 0;
+ gta->m_bGoogleSharedStatus = mir_wstrcmp(xmlGetAttrValue(node, ATTRNAME_TYPE), IQTYPE_RESULT) == 0;
gta->m_bGoogleSharedStatusLock = FALSE;
}
return FALSE;
@@ -328,7 +328,7 @@ BOOL OnIqSetGoogleSharedStatus(IJabberInterface *ji, HXML iqNode, void *) GoogleTalkAcc *gta = isGoogle(LPARAM(ji));
if (gta == NULL)
return FALSE;
- if (mir_tstrcmp(xmlGetAttrValue(iqNode, ATTRNAME_TYPE), IQTYPE_SET))
+ if (mir_wstrcmp(xmlGetAttrValue(iqNode, ATTRNAME_TYPE), IQTYPE_SET))
return FALSE;
if (gta->m_bGoogleSharedStatusLock)
return TRUE;
@@ -336,11 +336,11 @@ BOOL OnIqSetGoogleSharedStatus(IJabberInterface *ji, HXML iqNode, void *) int status;
HXML query = xmlGetChildByPath(iqNode, NODENAME_QUERY, 0);
HXML node = xmlGetChildByPath(query, L"invisible", 0);
- if (0 == mir_tstrcmpi(L"true", xmlGetAttrValue(node, L"value")))
+ if (0 == mir_wstrcmpi(L"true", xmlGetAttrValue(node, L"value")))
status = ID_STATUS_INVISIBLE;
else {
LPCTSTR txt = xmlGetText(xmlGetChildByPath(query, L"show", 0));
- if (txt && 0 == mir_tstrcmpi(L"dnd", txt))
+ if (txt && 0 == mir_wstrcmpi(L"dnd", txt))
status = ID_STATUS_DND;
else if (gta->m_pa->ppro->m_iStatus == ID_STATUS_DND || gta->m_pa->ppro->m_iStatus == ID_STATUS_INVISIBLE)
status = ID_STATUS_ONLINE;
@@ -364,12 +364,12 @@ void GoogleTalkAcc::SendIqGoogleSharedStatus(LPCTSTR status, LPCTSTR msg) xmlAddAttrInt(query, L"version", 2);
xmlAddChild(query, L"status", msg);
- if (!mir_tstrcmp(status, L"invisible")) {
+ if (!mir_wstrcmp(status, L"invisible")) {
xmlAddChild(query, L"show", L"default");
xmlAddAttr(xmlAddChild(query, L"invisible", 0), L"value", L"true");
}
else {
- if (!mir_tstrcmp(status, L"dnd"))
+ if (!mir_wstrcmp(status, L"dnd"))
xmlAddChild(query, L"show", L"dnd");
else
xmlAddChild(query, L"show", L"default");
@@ -390,7 +390,7 @@ int OnServerDiscoInfo(WPARAM wParam, LPARAM lParam) // m_ThreadInfo->jabberServerCaps |= JABBER_CAPS_PING;
JABBER_DISCO_FIELD *fld = (JABBER_DISCO_FIELD*)wParam;
- if (!mir_tstrcmp(fld->category, L"server") && !mir_tstrcmp(fld->type, L"im") && !mir_tstrcmp(fld->name, L"Google Talk")) {
+ if (!mir_wstrcmp(fld->category, L"server") && !mir_wstrcmp(fld->type, L"im") && !mir_wstrcmp(fld->name, L"Google Talk")) {
HXML iq = xmlCreateNode(NODENAME_IQ, NULL, FALSE);
xmlAddAttr(iq, ATTRNAME_TYPE, IQTYPE_GET);
diff --git a/protocols/GTalkExt/src/inbox.cpp b/protocols/GTalkExt/src/inbox.cpp index f4e6c3ee4d..2e73250e7d 100644 --- a/protocols/GTalkExt/src/inbox.cpp +++ b/protocols/GTalkExt/src/inbox.cpp @@ -168,8 +168,8 @@ BOOL OpenUrlWithAuth(LPCSTR acc, LPCTSTR mailbox, LPCTSTR url) int pwdLen = GetMailboxPwd(acc, NULL, 0);
if (!pwdLen++) return FALSE;
- size_t urlLen = mir_tstrlen(url) + 1;
- size_t mailboxLen = mir_tstrlen(mailbox) + 1;
+ size_t urlLen = mir_wstrlen(url) + 1;
+ size_t mailboxLen = mir_wstrlen(mailbox) + 1;
OPEN_URL_HEADER *data = (OPEN_URL_HEADER*)malloc(sizeof(OPEN_URL_HEADER) + urlLen + mailboxLen + pwdLen);
data->url = (LPSTR)data + sizeof(OPEN_URL_HEADER);
@@ -196,7 +196,7 @@ void OpenUrl(LPCSTR acc, LPCTSTR mailbox, LPCTSTR url) void OpenContactInbox(LPCSTR szModuleName)
{
- ptrT tszJid(db_get_tsa(0, szModuleName, "jid"));
+ ptrW tszJid(db_get_tsa(0, szModuleName, "jid"));
if (tszJid == NULL)
return;
@@ -206,9 +206,9 @@ void OpenContactInbox(LPCSTR szModuleName) *host++ = 0;
wchar_t buf[1024];
- if (mir_tstrcmpi(host, COMMON_GMAIL_HOST1) && mir_tstrcmpi(host, COMMON_GMAIL_HOST2))
- mir_sntprintf(buf, INBOX_URL_FORMAT, L"a/", host); // hosted
+ if (mir_wstrcmpi(host, COMMON_GMAIL_HOST1) && mir_wstrcmpi(host, COMMON_GMAIL_HOST2))
+ mir_snwprintf(buf, INBOX_URL_FORMAT, L"a/", host); // hosted
else
- mir_sntprintf(buf, INBOX_URL_FORMAT, L"", L"mail"); // common
+ mir_snwprintf(buf, INBOX_URL_FORMAT, L"", L"mail"); // common
OpenUrl(szModuleName, tszJid, buf);
}
diff --git a/protocols/GTalkExt/src/notifications.cpp b/protocols/GTalkExt/src/notifications.cpp index fda2db7eb5..e2243609ca 100644 --- a/protocols/GTalkExt/src/notifications.cpp +++ b/protocols/GTalkExt/src/notifications.cpp @@ -54,8 +54,8 @@ LPCSTR GetJidAcc(LPCTSTR jid) Proto_EnumAccounts(&count, &protos);
for (int i = 0; i < count; i++) {
if (getJabberApi(protos[i]->szModuleName)) {
- ptrT tszJid(db_get_tsa(0, protos[i]->szModuleName, "jid"));
- if (!mir_tstrcmpi(jid, tszJid))
+ ptrW tszJid(db_get_tsa(0, protos[i]->szModuleName, "jid"));
+ if (!mir_wstrcmpi(jid, tszJid))
return protos[i]->szModuleName;
}
}
@@ -158,7 +158,7 @@ static bool DoAddPopup(POPUPDATAT *data) void FormatPseudocontactDisplayName(LPTSTR buff, LPCTSTR jid, LPCTSTR unreadCount)
{
- if (mir_tstrcmp(unreadCount, L"0"))
+ if (mir_wstrcmp(unreadCount, L"0"))
wsprintf(buff, L"%s [%s]", jid, unreadCount); //!!!!!!!!!!!
else
wsprintf(buff, L"%s", jid); //!!!!!!!!!!!
@@ -177,7 +177,7 @@ MCONTACT SetupPseudocontact(LPCTSTR jid, LPCTSTR unreadCount, LPCSTR acc, LPCTST // SetAvatar(hContact);
if (displayName == NULL) {
- wchar_t *tszTemp = (wchar_t*)alloca((mir_tstrlen(jid) + mir_tstrlen(unreadCount) + 3 + 1) * sizeof(wchar_t));
+ wchar_t *tszTemp = (wchar_t*)alloca((mir_wstrlen(jid) + mir_wstrlen(unreadCount) + 3 + 1) * sizeof(wchar_t));
FormatPseudocontactDisplayName(tszTemp, jid, unreadCount);
db_set_ts(hContact, CLIST_MODULE_NAME, CONTACT_DISPLAY_NAME_SETTING, tszTemp);
}
@@ -230,8 +230,8 @@ void ShowNotification(LPCSTR acc, POPUPDATAT *data, LPCTSTR jid, LPCTSTR url, LP }
data->PluginWindowProc = PopupProc;
- size_t lurl = (mir_tstrlen(url) + 1) * sizeof(wchar_t);
- size_t ljid = (mir_tstrlen(jid) + 1) * sizeof(wchar_t);
+ size_t lurl = (mir_wstrlen(url) + 1) * sizeof(wchar_t);
+ size_t ljid = (mir_wstrlen(jid) + 1) * sizeof(wchar_t);
POPUP_DATA_HEADER *ppdh = (POPUP_DATA_HEADER*)malloc(sizeof(POPUP_DATA_HEADER) + lurl + ljid);
ppdh->MarkRead = FALSE;
@@ -253,7 +253,7 @@ void UnreadMailNotification(LPCSTR acc, LPCTSTR jid, LPCTSTR url, LPCTSTR unread POPUPDATAT data = { 0 };
FormatPseudocontactDisplayName(&data.lptzContactName[0], jid, unreadCount);
- mir_sntprintf(data.lptzText, TranslateT("You've received an e-mail\n%s unread threads"), unreadCount);
+ mir_snwprintf(data.lptzText, TranslateT("You've received an e-mail\n%s unread threads"), unreadCount);
ShowNotification(acc, &data, jid, url, unreadCount);
}
@@ -276,9 +276,9 @@ void UnreadThreadNotification(LPCSTR acc, LPCTSTR jid, LPCTSTR url, LPCTSTR unre }
if (ReadCheckbox(0, IDC_ADDSNIP, (UINT_PTR)TlsGetValue(itlsSettings)))
- mir_sntprintf(data.lptzText, TranslateTS(FULL_NOTIFICATION_FORMAT), mtn->subj, tszSenders.c_str(), mtn->snip);
+ mir_snwprintf(data.lptzText, TranslateTS(FULL_NOTIFICATION_FORMAT), mtn->subj, tszSenders.c_str(), mtn->snip);
else
- mir_sntprintf(data.lptzText, TranslateTS(SHORT_NOTIFICATION_FORMAT), mtn->subj, tszSenders.c_str());
+ mir_snwprintf(data.lptzText, TranslateTS(SHORT_NOTIFICATION_FORMAT), mtn->subj, tszSenders.c_str());
ShowNotification(acc, &data, jid, url, unreadCount);
}
@@ -321,7 +321,7 @@ BOOL CALLBACK ClosePopupFunc(__in HWND hwnd, __in LPARAM lParam) if (!ppdh)
return TRUE;
- if (!mir_tstrcmpi(ppis->url, ppdh->url) && !mir_tstrcmpi(ppis->jid, ppdh->jid))
+ if (!mir_wstrcmpi(ppis->url, ppdh->url) && !mir_wstrcmpi(ppis->jid, ppdh->jid))
SendMessage(hwnd, MESSAGE_CLOSEPOPUP, 0, 0);
return TRUE;
diff --git a/protocols/GTalkExt/src/options.cpp b/protocols/GTalkExt/src/options.cpp index 02394e0949..9183d773e4 100644 --- a/protocols/GTalkExt/src/options.cpp +++ b/protocols/GTalkExt/src/options.cpp @@ -155,8 +155,8 @@ INT_PTR CALLBACK AccOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lPa void ShowTestPopup(HWND wnd)
{
POPUPDATAT data = { 0 };
- mir_sntprintf(data.lptzContactName, TranslateTS(TEST_LETTER_INBOX));
- mir_sntprintf(data.lptzText, TranslateTS(FULL_NOTIFICATION_FORMAT), TranslateTS(TEST_LETTER_SUBJECT), TranslateTS(TEST_LETTER_SENDER), TranslateTS(TEST_LETTER_SNIP));
+ mir_snwprintf(data.lptzContactName, TranslateTS(TEST_LETTER_INBOX));
+ mir_snwprintf(data.lptzText, TranslateTS(FULL_NOTIFICATION_FORMAT), TranslateTS(TEST_LETTER_SUBJECT), TranslateTS(TEST_LETTER_SENDER), TranslateTS(TEST_LETTER_SNIP));
int len = SendDlgItemMessage(wnd, IDC_TIMEOUTEDIT, WM_GETTEXTLENGTH, 0, 0) + 1;
LPTSTR timeout = (LPTSTR)_alloca(len * sizeof(wchar_t));
diff --git a/protocols/GTalkExt/src/tipper_items.cpp b/protocols/GTalkExt/src/tipper_items.cpp index ef886b764f..929078c2f7 100644 --- a/protocols/GTalkExt/src/tipper_items.cpp +++ b/protocols/GTalkExt/src/tipper_items.cpp @@ -74,15 +74,15 @@ void SetLabelProp(int index, LPSTR setting) {
sprintf(setting, LABEL_SETTING_PROP, index); //!!!!!!!!!!!!!!
- ptrT tszProp(db_get_tsa(0, TIPPER_ITEMS_MOD_NAME, setting));
+ ptrW tszProp(db_get_tsa(0, TIPPER_ITEMS_MOD_NAME, setting));
if (tszProp == NULL)
return;
- ptrT tszLastWritten(db_get_tsa(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING));
+ ptrW tszLastWritten(db_get_tsa(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING));
if (tszLastWritten == NULL)
return;
- if (!mir_tstrcmp(tszProp, tszLastWritten)) {
+ if (!mir_wstrcmp(tszProp, tszLastWritten)) {
LPTSTR label = TranslateTS(UNREAD_THREADS_LABEL);
db_set_ts(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING, label);
db_set_ts(0, TIPPER_ITEMS_MOD_NAME, setting, label);
@@ -103,9 +103,9 @@ void AddTipperItem() for (i = 0; i < itemCount; i++) {
mir_snprintf(setting, l, VALUE_SETTING_PROP, i);
- ptrT tszSetting(db_get_tsa(0, TIPPER_ITEMS_MOD_NAME, setting));
+ ptrW tszSetting(db_get_tsa(0, TIPPER_ITEMS_MOD_NAME, setting));
if (tszSetting) {
- if (!mir_tstrcmp(UNREAD_THREADS_RAW, tszSetting)) {
+ if (!mir_wstrcmp(UNREAD_THREADS_RAW, tszSetting)) {
SetLabelProp(i, setting);
return;
}
diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp index f3c8a3cc05..764cc426ef 100644 --- a/protocols/Gadu-Gadu/src/avatar.cpp +++ b/protocols/Gadu-Gadu/src/avatar.cpp @@ -28,7 +28,7 @@ //
void GGPROTO::getAvatarFilename(MCONTACT hContact, wchar_t *pszDest, int cbLen)
{
- int tPathLen = mir_sntprintf(pszDest, cbLen, L"%s\\%S", VARST( L"%miranda_avatarcache%"), m_szModuleName);
+ int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARST( L"%miranda_avatarcache%"), m_szModuleName);
if (_waccess(pszDest, 0)) {
int ret = CreateDirectoryTreeT(pszDest);
@@ -37,7 +37,7 @@ void GGPROTO::getAvatarFilename(MCONTACT hContact, wchar_t *pszDest, int cbLen) else {
debugLog(L"getAvatarFilename(): Can not create directory for avatar cache: %s. errno=%d: %s", pszDest, errno, ws_strerror(errno));
wchar_t error[512];
- mir_sntprintf(error, TranslateT("Cannot create avatars cache directory. ERROR: %d: %s\n%s"), errno, ws_strerror(errno), pszDest);
+ mir_snwprintf(error, TranslateT("Cannot create avatars cache directory. ERROR: %d: %s\n%s"), errno, ws_strerror(errno), pszDest);
showpopup(m_tszUserName, error, GG_POPUP_ERROR | GG_POPUP_ALLOW_MSGBOX | GG_POPUP_ONCE);
}
}
@@ -47,13 +47,13 @@ void GGPROTO::getAvatarFilename(MCONTACT hContact, wchar_t *pszDest, int cbLen) if (hContact != NULL) {
DBVARIANT dbv;
if (!getString(hContact, GG_KEY_AVATARHASH, &dbv)) {
- wchar_t* avatarHashT = mir_a2t(dbv.pszVal);
- mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s%s", avatarHashT, avatartype);
+ wchar_t* avatarHashT = mir_a2u(dbv.pszVal);
+ mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s%s", avatarHashT, avatartype);
mir_free(avatarHashT);
db_free(&dbv);
}
}
- else mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%S avatar%s", m_szModuleName, avatartype);
+ else mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%S avatar%s", m_szModuleName, avatartype);
}
bool GGPROTO::getAvatarFileInfo(uin_t uin, char **avatarurl, char **avatarts)
@@ -83,19 +83,19 @@ bool GGPROTO::getAvatarFileInfo(uin_t uin, char **avatarurl, char **avatarts) if ((strncmp(resp->pData, "<result>", 8) == 0) || (strncmp(resp->pData, "<?xml", 5) == 0)){
//if this url returned xml data (before and after 11.2013 gg convention)
- wchar_t *xmlAction = mir_a2t(resp->pData);
+ wchar_t *xmlAction = mir_a2u(resp->pData);
HXML hXml = xmlParseString(xmlAction, 0, L"result");
if (hXml != NULL) {
HXML node = xmlGetChildByPath(hXml, L"users/user/avatars/avatar", 0);
const wchar_t *blank = (node != NULL) ? xmlGetAttrValue(node, L"blank") : NULL;
- if (blank != NULL && mir_tstrcmp(blank, L"1")) {
+ if (blank != NULL && mir_wstrcmp(blank, L"1")) {
node = xmlGetChildByPath(hXml, L"users/user/avatars/avatar/timestamp", 0);
- *avatarts = node != NULL ? mir_t2a(xmlGetText(node)) : NULL;
+ *avatarts = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
node = xmlGetChildByPath(hXml, L"users/user/avatars/avatar/bigavatar", 0); //new gg convention
if (node == NULL){
node = xmlGetChildByPath(hXml, L"users/user/avatars/avatar/originBigAvatar", 0); //old gg convention
}
- *avatarurl = node != NULL ? mir_t2a(xmlGetText(node)) : NULL;
+ *avatarurl = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
}
xmlDestroyNode(hXml);
}
@@ -271,7 +271,7 @@ void __cdecl GGPROTO::avatarrequestthread(void*) } else {
debugLog(L"avatarrequestthread(): _wopen file %s error. errno=%d: %s", ai.filename, errno, ws_strerror(errno));
wchar_t error[512];
- mir_sntprintf(error, TranslateT("Cannot create avatar file. ERROR: %d: %s\n%s"), errno, ws_strerror(errno), ai.filename);
+ mir_snwprintf(error, TranslateT("Cannot create avatar file. ERROR: %d: %s\n%s"), errno, ws_strerror(errno), ai.filename);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
}
}
@@ -363,7 +363,7 @@ void __cdecl GGPROTO::setavatarthread(void *param) if (file_fd == -1) {
debugLog(L"setavatarthread(): Failed to open avatar file errno=%d: %s", errno, ws_strerror(errno));
wchar_t error[512];
- mir_sntprintf(error, TranslateT("Cannot open avatar file. ERROR: %d: %s\n%s"), errno, ws_strerror(errno), szFilename);
+ mir_snwprintf(error, TranslateT("Cannot open avatar file. ERROR: %d: %s\n%s"), errno, ws_strerror(errno), szFilename);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
mir_free(szFilename);
int prevType = getByte(GG_KEY_AVATARTYPEPREV, -1);
@@ -512,5 +512,5 @@ void GGPROTO::setAvatar(const wchar_t *szFilename) #ifdef DEBUGMODE
debugLogA("setAvatar(): ForkThread 3 GGPROTO::setavatarthread");
#endif
- ForkThread(&GGPROTO::setavatarthread, mir_tstrdup(szFilename));
+ ForkThread(&GGPROTO::setavatarthread, mir_wstrdup(szFilename));
}
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 692b36aef5..dec48051e4 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -67,58 +67,58 @@ void GGPROTO::disconnect() switch (getWord(GG_KEY_LEAVESTATUS, GG_KEYDEF_LEAVESTATUS)) {
case ID_STATUS_ONLINE:
gg_EnterCriticalSection(&modemsg_mutex, "disconnect", 6, "modemsg_mutex", 1);
- szMsg = mir_utf8encodeT(modemsg.online);
+ szMsg = mir_utf8encodeW(modemsg.online);
gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 6, 1, "modemsg_mutex", 1);
if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_ONLINE, "Default"), &dbv, DBVT_TCHAR)) {
if (dbv.ptszVal && *(dbv.ptszVal))
- szMsg = mir_utf8encodeT(dbv.ptszVal);
+ szMsg = mir_utf8encodeW(dbv.ptszVal);
db_free(&dbv);
}
break;
case ID_STATUS_AWAY:
gg_EnterCriticalSection(&modemsg_mutex, "disconnect", 7, "modemsg_mutex", 1);
- szMsg = mir_utf8encodeT(modemsg.away);
+ szMsg = mir_utf8encodeW(modemsg.away);
gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 7, 1, "modemsg_mutex", 1);
if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_AWAY, "Default"), &dbv, DBVT_TCHAR)) {
if (dbv.ptszVal && *(dbv.ptszVal))
- szMsg = mir_utf8encodeT(dbv.ptszVal);
+ szMsg = mir_utf8encodeW(dbv.ptszVal);
db_free(&dbv);
}
break;
case ID_STATUS_DND:
gg_EnterCriticalSection(&modemsg_mutex, "disconnect", 8, "modemsg_mutex", 1);
- szMsg = mir_utf8encodeT(modemsg.dnd);
+ szMsg = mir_utf8encodeW(modemsg.dnd);
gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 8, 1, "modemsg_mutex", 1);
if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_DND, "Default"), &dbv, DBVT_TCHAR)) {
if (dbv.ptszVal && *(dbv.ptszVal))
- szMsg = mir_utf8encodeT(dbv.ptszVal);
+ szMsg = mir_utf8encodeW(dbv.ptszVal);
db_free(&dbv);
}
break;
case ID_STATUS_FREECHAT:
gg_EnterCriticalSection(&modemsg_mutex, "disconnect", 9, "modemsg_mutex", 1);
- szMsg = mir_utf8encodeT(modemsg.freechat);
+ szMsg = mir_utf8encodeW(modemsg.freechat);
gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 9, 1, "modemsg_mutex", 1);
if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_FREECHAT, "Default"), &dbv, DBVT_TCHAR)) {
if (dbv.ptszVal && *(dbv.ptszVal))
- szMsg = mir_utf8encodeT(dbv.ptszVal);
+ szMsg = mir_utf8encodeW(dbv.ptszVal);
db_free(&dbv);
}
break;
case ID_STATUS_INVISIBLE:
gg_EnterCriticalSection(&modemsg_mutex, "disconnect", 10, "modemsg_mutex", 1);
- szMsg = mir_utf8encodeT(modemsg.invisible);
+ szMsg = mir_utf8encodeW(modemsg.invisible);
gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 10, 1, "modemsg_mutex", 1);
if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_INVISIBLE, "Default"), &dbv, DBVT_TCHAR)) {
if (dbv.ptszVal && *(dbv.ptszVal))
- szMsg = mir_utf8encodeT(dbv.ptszVal);
+ szMsg = mir_utf8encodeW(dbv.ptszVal);
db_free(&dbv);
}
break;
default:
// Set last status
gg_EnterCriticalSection(&modemsg_mutex, "disconnect", 11, "modemsg_mutex", 1);
- szMsg = mir_utf8encodeT(getstatusmsg(m_iStatus));
+ szMsg = mir_utf8encodeW(getstatusmsg(m_iStatus));
gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 11, 1, "modemsg_mutex", 1);
}
}
@@ -360,8 +360,8 @@ void __cdecl GGPROTO::mainthread(void *) if (!getString(GG_KEY_FORWARDHOST, &dbv)) {
if (!(p.external_addr = gg_dnslookup(this, dbv.pszVal))) {
wchar_t error[128];
- wchar_t* forwardHostT = mir_a2t(dbv.pszVal);
- mir_sntprintf(error, TranslateT("External direct connections hostname %s is invalid. Disabling external host forwarding."), forwardHostT);
+ wchar_t* forwardHostT = mir_a2u(dbv.pszVal);
+ mir_snwprintf(error, TranslateT("External direct connections hostname %s is invalid. Disabling external host forwarding."), forwardHostT);
mir_free(forwardHostT);
showpopup(m_tszUserName, error, GG_POPUP_WARNING | GG_POPUP_ALLOW_MSGBOX);
}
@@ -378,7 +378,7 @@ retry: // Loadup startup status & description
gg_EnterCriticalSection(&modemsg_mutex, "mainthread", 13, "modemsg_mutex", 1);
- p.status_descr = mir_utf8encodeT(getstatusmsg(m_iDesiredStatus));
+ p.status_descr = mir_utf8encodeW(getstatusmsg(m_iDesiredStatus));
p.status = status_m2gg(m_iDesiredStatus, p.status_descr != NULL);
debugLog(L"mainthread() (%x): Connecting with number %d, status %d and description \"%s\".", this, p.uin, m_iDesiredStatus,
@@ -391,8 +391,8 @@ retry: if (!(p.server_addr = gg_dnslookup(this, hosts[hostnum].hostname)))
{
wchar_t error[128];
- wchar_t* hostnameT = mir_a2t(hosts[hostnum].hostname);
- mir_sntprintf(error, TranslateT("Server hostname %s is invalid. Using default hostname provided by the network."), hostnameT);
+ wchar_t* hostnameT = mir_a2u(hosts[hostnum].hostname);
+ mir_snwprintf(error, TranslateT("Server hostname %s is invalid. Using default hostname provided by the network."), hostnameT);
mir_free(hostnameT);
showpopup(m_tszUserName, error, GG_POPUP_WARNING | GG_POPUP_ALLOW_MSGBOX);
}
@@ -423,7 +423,7 @@ retry: }
}
if (!perror) {
- mir_sntprintf(error, TranslateT("Connection cannot be established. errno=%d: %s"), errno, ws_strerror(errno));
+ mir_snwprintf(error, TranslateT("Connection cannot be established. errno=%d: %s"), errno, ws_strerror(errno));
perror = error;
}
debugLog(L"mainthread() (%x): %s", this, perror);
@@ -480,7 +480,7 @@ retry: {
broadcastnewstatus(m_iDesiredStatus);
// Change status of the contact with our own UIN (if got yourself added to the contact list)
- wchar_t *status_descr = mir_utf8decodeT(p.status_descr);
+ wchar_t *status_descr = mir_utf8decodeW(p.status_descr);
changecontactstatus(p.uin, p.status, status_descr, 0, 0, 0, 0);
mir_free(status_descr);
}
@@ -562,7 +562,7 @@ retry: for (; n->uin; n++)
{
- wchar_t *descrT = (e->type == GG_EVENT_NOTIFY_DESCR) ? mir_utf8decodeT(e->event.notify_descr.descr) : NULL;
+ wchar_t *descrT = (e->type == GG_EVENT_NOTIFY_DESCR) ? mir_utf8decodeW(e->event.notify_descr.descr) : NULL;
changecontactstatus(n->uin, n->status, descrT, 0, n->remote_ip, n->remote_port, n->version);
if (descrT) mir_free(descrT);
}
@@ -575,7 +575,7 @@ retry: int i;
for(i = 0; e->event.notify60[i].uin; i++) {
if (e->event.notify60[i].uin == uin) continue;
- wchar_t *descrT = mir_utf8decodeT(e->event.notify60[i].descr);
+ wchar_t *descrT = mir_utf8decodeW(e->event.notify60[i].descr);
changecontactstatus(e->event.notify60[i].uin, e->event.notify60[i].status, descrT,
e->event.notify60[i].time, e->event.notify60[i].remote_ip, e->event.notify60[i].remote_port,
e->event.notify60[i].version);
@@ -617,12 +617,12 @@ retry: {
// Loadup fields
const char *__fmnumber = gg_pubdir50_get(res, i, GG_PUBDIR50_UIN);
- wchar_t *__nickname = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_NICKNAME));
- wchar_t *__firstname = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_FIRSTNAME));
- wchar_t *__lastname = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_LASTNAME));
- wchar_t *__familyname = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_FAMILYNAME));
- wchar_t *__city = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_CITY));
- wchar_t *__familycity = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_FAMILYCITY));
+ wchar_t *__nickname = mir_utf8decodeW(gg_pubdir50_get(res, i, GG_PUBDIR50_NICKNAME));
+ wchar_t *__firstname = mir_utf8decodeW(gg_pubdir50_get(res, i, GG_PUBDIR50_FIRSTNAME));
+ wchar_t *__lastname = mir_utf8decodeW(gg_pubdir50_get(res, i, GG_PUBDIR50_LASTNAME));
+ wchar_t *__familyname = mir_utf8decodeW(gg_pubdir50_get(res, i, GG_PUBDIR50_FAMILYNAME));
+ wchar_t *__city = mir_utf8decodeW(gg_pubdir50_get(res, i, GG_PUBDIR50_CITY));
+ wchar_t *__familycity = mir_utf8decodeW(gg_pubdir50_get(res, i, GG_PUBDIR50_FAMILYCITY));
const char *__birthyear = gg_pubdir50_get(res, i, GG_PUBDIR50_BIRTHYEAR);
const char *__gender = gg_pubdir50_get(res, i, GG_PUBDIR50_GENDER);
const char *__status = gg_pubdir50_get(res, i, GG_PUBDIR50_STATUS);
@@ -637,8 +637,8 @@ retry: wcsncpy_s(strFmt2, pcli->pfnGetStatusModeDescription( status_gg2m(atoi(__status)), 0), _TRUNCATE);
if (__city) {
- mir_sntprintf(strFmt1, L", %s %s", TranslateT("City:"), __city);
- mir_tstrncat(strFmt2, strFmt1, _countof(strFmt2) - mir_tstrlen(strFmt2));
+ mir_snwprintf(strFmt1, L", %s %s", TranslateT("City:"), __city);
+ mir_wstrncat(strFmt2, strFmt1, _countof(strFmt2) - mir_wstrlen(strFmt2));
}
if (__birthyear) {
time_t t = time(NULL);
@@ -646,8 +646,8 @@ retry: int br = atoi(__birthyear);
if (br < (lt->tm_year + 1900) && br > 1900) {
- mir_sntprintf(strFmt1, L", %s %d", TranslateT("Age:"), (lt->tm_year + 1900) - br);
- mir_tstrncat(strFmt2, strFmt1, _countof(strFmt2) - mir_tstrlen(strFmt2));
+ mir_snwprintf(strFmt1, L", %s %d", TranslateT("Age:"), (lt->tm_year + 1900) - br);
+ mir_wstrncat(strFmt2, strFmt1, _countof(strFmt2) - mir_wstrlen(strFmt2));
}
}
@@ -757,7 +757,7 @@ retry: // Status (deprecated)
case GG_EVENT_STATUS:
{
- wchar_t *descrT = mir_utf8decodeT(e->event.status.descr);
+ wchar_t *descrT = mir_utf8decodeW(e->event.status.descr);
changecontactstatus(e->event.status.uin, e->event.status.status, descrT, 0, 0, 0, 0);
mir_free(descrT);
}
@@ -770,7 +770,7 @@ retry: int oldstatus = getWord(hContact, GG_KEY_STATUS, (WORD)ID_STATUS_OFFLINE);
uin_t uin = (uin_t)getDword(GG_KEY_UIN, 0);
- wchar_t *descrT = mir_utf8decodeT(e->event.status60.descr);
+ wchar_t *descrT = mir_utf8decodeW(e->event.status60.descr);
if (e->event.status60.uin == uin)
{
@@ -832,7 +832,7 @@ retry: GCEVENT gce = { sizeof(gce), &gcd };
time_t t = time(NULL);
gce.ptszUID = id;
- wchar_t* messageT = mir_utf8decodeT(e->event.msg.message);
+ wchar_t* messageT = mir_utf8decodeW(e->event.msg.message);
gce.ptszText = messageT;
gce.ptszNick = (wchar_t*) pcli->pfnGetContactDisplayName( getcontact(e->event.msg.sender, 1, 0, NULL), 0);
gce.time = (!(e->event.msg.msgclass & GG_CLASS_OFFLINE) || e->event.msg.time > (t - timeDeviation)) ? t : e->event.msg.time;
@@ -895,14 +895,14 @@ retry: GCDEST gcd = { m_szModuleName, chat, GC_EVENT_MESSAGE };
GCEVENT gce = { sizeof(gce), &gcd };
gce.ptszUID = id;
- wchar_t* messageT = mir_utf8decodeT(e->event.multilogon_msg.message);
+ wchar_t* messageT = mir_utf8decodeW(e->event.multilogon_msg.message);
gce.ptszText = messageT;
wchar_t* nickT;
if (!getTString(GG_KEY_NICK, &dbv)){
- nickT = mir_tstrdup(dbv.ptszVal);
+ nickT = mir_wstrdup(dbv.ptszVal);
db_free(&dbv);
}
- else nickT = mir_tstrdup(TranslateT("Me"));
+ else nickT = mir_wstrdup(TranslateT("Me"));
gce.ptszNick = nickT;
gce.time = e->event.multilogon_msg.time;
gce.bIsMe = 1;
@@ -974,7 +974,7 @@ retry: if (iIndexes && iIndexes[i])
continue;
- mir_sntprintf(szMsg, L"%s (%s)", szText,
+ mir_snwprintf(szMsg, L"%s (%s)", szText,
*e->event.multilogon_info.sessions[i].name != '\0' ?
_A2T(e->event.multilogon_info.sessions[i].name) : TranslateT("Unknown client"));
showpopup(m_tszUserName, szMsg, GG_POPUP_MULTILOGON);
@@ -1052,7 +1052,7 @@ retry: debugLogA("mainthread() (%x): Client: %d, File ack filename \"%s\" size %d.", this, dcc7->peer_uin,
dcc7->filename, dcc7->size);
- wchar_t* filenameT = mir_a2t((char*)dcc7->filename);
+ wchar_t* filenameT = mir_a2u((char*)dcc7->filename);
PROTORECVFILET pre = {0};
pre.dwFlags = PRFF_TCHAR;
@@ -1149,8 +1149,8 @@ retry: wchar_t *xmlAction;
wchar_t *tag;
- xmlAction = mir_a2t(e->event.xml_action.data);
- tag = mir_a2t("events");
+ xmlAction = mir_a2u(e->event.xml_action.data);
+ tag = mir_a2u("events");
hXml = xmlParseString(xmlAction, 0, tag);
if (hXml != NULL) {
@@ -1158,14 +1158,14 @@ retry: char *type, *sender;
mir_free(tag);
- tag = mir_a2t("event/type");
+ tag = mir_a2u("event/type");
node = xmlGetChildByPath(hXml, tag, 0);
- type = node != NULL ? mir_t2a(xmlGetText(node)) : NULL;
+ type = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
mir_free(tag);
- tag = mir_a2t("event/sender");
+ tag = mir_a2u("event/sender");
node = xmlGetChildByPath(hXml, tag, 0);
- sender = node != NULL ? mir_t2a(xmlGetText(node)) : NULL;
+ sender = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
debugLogA("mainthread() (%x): XML Action type: %s.", this, type != NULL ? type : "unknown");
// Avatar change notify
if (type != NULL && !mir_strcmp(type, "28")) {
@@ -1311,11 +1311,11 @@ static wchar_t* sttSettingToTchar( DBVARIANT* value ) {
switch(value->type) {
case DBVT_ASCIIZ:
- return mir_a2t(value->pszVal);
+ return mir_a2u(value->pszVal);
case DBVT_UTF8:
- return mir_utf8decodeT(value->pszVal);
+ return mir_utf8decodeW(value->pszVal);
case DBVT_WCHAR:
- return mir_u2t(value->pwszVal);
+ return mir_wstrdup(value->pwszVal);
}
return NULL;
}
@@ -1570,7 +1570,7 @@ MCONTACT GGPROTO::getcontact(uin_t uin, int create, int inlist, wchar_t *szNick) gg_pubdir50(sess, req);
gg_LeaveCriticalSection(&sess_mutex, "getcontact", 31, 1, "sess_mutex", 1);
gg_pubdir50_free(req);
- wchar_t* uinT = mir_a2t(ditoa(uin));
+ wchar_t* uinT = mir_a2u(ditoa(uin));
setTString(hContact, GG_KEY_NICK, uinT);
mir_free(uinT);
debugLogA("getcontact(): Search for nick on uin: %d", uin);
@@ -1591,7 +1591,7 @@ MCONTACT GGPROTO::getcontact(uin_t uin, int create, int inlist, wchar_t *szNick) // Change status of the contact with our own UIN (if got yourself added to the contact list)
if (getDword(GG_KEY_UIN, 0) == uin) {
gg_EnterCriticalSection(&modemsg_mutex, "getcontact", 33, "modemsg_mutex", 1);
- wchar_t *szMsg = mir_tstrdup(getstatusmsg(m_iStatus));
+ wchar_t *szMsg = mir_wstrdup(getstatusmsg(m_iStatus));
gg_LeaveCriticalSection(&modemsg_mutex, "getcontact", 33, 1, "modemsg_mutex", 1);
changecontactstatus(uin, status_m2gg(m_iStatus, szMsg != NULL), szMsg, 0, 0, 0, 0);
mir_free(szMsg);
diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp index e4a593496f..1aceff00a9 100644 --- a/protocols/Gadu-Gadu/src/dialogs.cpp +++ b/protocols/Gadu-Gadu/src/dialogs.cpp @@ -65,7 +65,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule if (dbv.cVal == -100) unspecified = 1; else { ptstr = str; - mir_sntprintf(str, dbv.cVal ? L"GMT%+d:%02d" : L"GMT", -dbv.cVal / 2, (dbv.cVal & 1) * 30); + mir_snwprintf(str, dbv.cVal ? L"GMT%+d:%02d" : L"GMT", -dbv.cVal / 2, (dbv.cVal & 1) * 30); } } else { unspecified = (special == SVS_ZEROISUNSPEC && dbv.bVal == 0); @@ -79,7 +79,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule unspecified = 1; } else { ptstr = str; - mir_sntprintf(str, L"%S", pstr); + mir_snwprintf(str, L"%S", pstr); } } else { @@ -97,12 +97,12 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule unspecified = 1; } else { ptstr = str; - mir_sntprintf(str, L"%S", pstr); + mir_snwprintf(str, L"%S", pstr); } if (dbv.dVal == 0) unspecified = 1; } else if (special == SVS_GGVERSION) { ptstr = str; - mir_sntprintf(str, L"%S", (char *)gg_version2string(dbv.dVal)); + mir_snwprintf(str, L"%S", (char *)gg_version2string(dbv.dVal)); } else { ptstr = _itow(special == SVS_SIGNED ? dbv.lVal : dbv.dVal, str, 10); } @@ -110,7 +110,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule case DBVT_ASCIIZ: unspecified = (special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0'); ptstr = str; - mir_sntprintf(str, L"%S", dbv.pszVal); + mir_snwprintf(str, L"%S", dbv.pszVal); break; case DBVT_TCHAR: unspecified = (special == SVS_ZEROISUNSPEC && dbv.ptszVal[0] == '\0'); @@ -118,14 +118,14 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule break; case DBVT_UTF8: unspecified = (special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0'); - valT = mir_utf8decodeT(dbv.pszVal); + valT = mir_utf8decodeW(dbv.pszVal); ptstr = str; wcscpy_s(str, _countof(str), valT); mir_free(valT); break; default: ptstr = str; - mir_tstrcpy(str, L"???"); + mir_wstrcpy(str, L"???"); break; } } @@ -803,19 +803,19 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, break; GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, _countof(text)); - if (mir_tstrlen(text)) + if (mir_wstrlen(text)) gg_pubdir50_add(req, GG_PUBDIR50_FIRSTNAME, T2Utf(text)); GetDlgItemText(hwndDlg, IDC_LASTNAME, text, _countof(text)); - if (mir_tstrlen(text)) + if (mir_wstrlen(text)) gg_pubdir50_add(req, GG_PUBDIR50_LASTNAME, T2Utf(text)); GetDlgItemText(hwndDlg, IDC_NICKNAME, text, _countof(text)); - if (mir_tstrlen(text)) + if (mir_wstrlen(text)) gg_pubdir50_add(req, GG_PUBDIR50_NICKNAME, T2Utf(text)); GetDlgItemText(hwndDlg, IDC_CITY, text, _countof(text)); - if (mir_tstrlen(text)) + if (mir_wstrlen(text)) gg_pubdir50_add(req, GG_PUBDIR50_CITY, T2Utf(text)); // Gadu-Gadu Female <-> Male @@ -831,15 +831,15 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, } GetDlgItemText(hwndDlg, IDC_BIRTHYEAR, text, _countof(text)); - if (mir_tstrlen(text)) + if (mir_wstrlen(text)) gg_pubdir50_add(req, GG_PUBDIR50_BIRTHYEAR, T2Utf(text)); GetDlgItemText(hwndDlg, IDC_FAMILYNAME, text, _countof(text)); - if (mir_tstrlen(text)) + if (mir_wstrlen(text)) gg_pubdir50_add(req, GG_PUBDIR50_FAMILYNAME, T2Utf(text)); GetDlgItemText(hwndDlg, IDC_CITYORIGIN, text, _countof(text)); - if (mir_tstrlen(text)) + if (mir_wstrlen(text)) gg_pubdir50_add(req, GG_PUBDIR50_FAMILYCITY, T2Utf(text)); // Run update diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp index 14a82d4b58..38909300a0 100644 --- a/protocols/Gadu-Gadu/src/filetransfer.cpp +++ b/protocols/Gadu-Gadu/src/filetransfer.cpp @@ -381,7 +381,7 @@ void __cdecl GGPROTO::dccmainthread(void*) {
// Make new ggtransfer struct
local_dcc->contact = (void*)getcontact(local_dcc->peer_uin, 0, 0, NULL);
- wchar_t* filenameT = mir_utf8decodeT((char*)dcc->file_info.filename);
+ wchar_t* filenameT = mir_utf8decodeW((char*)dcc->file_info.filename);
PROTORECVFILET pre = {0};
pre.dwFlags = PRFF_TCHAR;
@@ -662,7 +662,7 @@ void __cdecl GGPROTO::dccmainthread(void*) HANDLE GGPROTO::dccfileallow(HANDLE hTransfer, const wchar_t* szPath)
{
struct gg_dcc *dcc = (struct gg_dcc *) hTransfer;
- char fileName[MAX_PATH], *path = mir_t2a(szPath);
+ char fileName[MAX_PATH], *path = mir_u2a(szPath);
mir_snprintf(fileName, "%s%s", path, dcc->file_info.filename);
dcc->folder = _strdup((char*)path);
dcc->tick = 0;
@@ -678,7 +678,7 @@ HANDLE GGPROTO::dccfileallow(HANDLE hTransfer, const wchar_t* szPath) {
debugLogA("dccfileallow(): Failed to create file \"%s\". errno=%d: %s", fileName, errno, strerror(errno));
wchar_t error[512];
- mir_sntprintf(error, TranslateT("Cannot create transfer file. ERROR: %d: %s (dcc)\n%s"), errno, _tcserror(errno), szPath);
+ mir_snwprintf(error, TranslateT("Cannot create transfer file. ERROR: %d: %s (dcc)\n%s"), errno, _tcserror(errno), szPath);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
ProtoBroadcastAck((UINT_PTR)dcc->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc, 0);
// Free transfer
@@ -702,7 +702,7 @@ HANDLE GGPROTO::dccfileallow(HANDLE hTransfer, const wchar_t* szPath) HANDLE GGPROTO::dcc7fileallow(HANDLE hTransfer, const wchar_t* szPath)
{
struct gg_dcc7 *dcc7 = (struct gg_dcc7 *) hTransfer;
- char fileName[MAX_PATH], *path = mir_t2a(szPath);
+ char fileName[MAX_PATH], *path = mir_u2a(szPath);
mir_snprintf(fileName, "%s%s", path, dcc7->filename);
dcc7->folder = _strdup((char*)path);
dcc7->tick = 0;
@@ -727,7 +727,7 @@ HANDLE GGPROTO::dcc7fileallow(HANDLE hTransfer, const wchar_t* szPath) {
debugLogA("dcc7fileallow(): Failed to create file \"%s\". errno=%d: %s", fileName, errno, strerror(errno));
wchar_t error[512];
- mir_sntprintf(error, TranslateT("Cannot create transfer file. ERROR: %d: %s (dcc7)\n%s"), errno, _tcserror(errno), szPath);
+ mir_snwprintf(error, TranslateT("Cannot create transfer file. ERROR: %d: %s (dcc7)\n%s"), errno, _tcserror(errno), szPath);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
gg_dcc7_reject(dcc7, GG_DCC7_REJECT_USER);
ProtoBroadcastAck((UINT_PTR)dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc7, 0);
@@ -917,7 +917,7 @@ HANDLE GGPROTO::SendFile(MCONTACT hContact, const wchar_t *, wchar_t** ppszFiles if (!isonline())
return ftfail(this, hContact);
- filename = mir_t2a(ppszFiles[0]);
+ filename = mir_u2a(ppszFiles[0]);
// Read user IP and port
ip = swap32(getDword(hContact, GG_KEY_CLIENTIP, 0));
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index 11c44a47de..18e264e031 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -65,9 +65,9 @@ wchar_t* ws_strerror(int code) wchar_t buff[128];
int len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, WSAGetLastError(), 0, buff, _countof(buff), NULL);
if (len == 0)
- mir_sntprintf(err_desc, L"WinSock %u: Unknown error.", WSAGetLastError());
+ mir_snwprintf(err_desc, L"WinSock %u: Unknown error.", WSAGetLastError());
else
- mir_sntprintf(err_desc, L"WinSock %d: %s", WSAGetLastError(), buff);
+ mir_snwprintf(err_desc, L"WinSock %d: %s", WSAGetLastError(), buff);
return err_desc;
}
@@ -174,18 +174,18 @@ void GGPROTO::cleanuplastplugin(DWORD version) debugLogA("cleanuplastplugin() 1: version=%d Cleaning junk avatar files from < 0.11.0.2", version);
wchar_t avatarsPath[MAX_PATH];
- mir_sntprintf(avatarsPath, L"%s\\%s", VARST( L"%miranda_avatarcache%"), m_tszUserName);
+ mir_snwprintf(avatarsPath, L"%s\\%s", VARST( L"%miranda_avatarcache%"), m_tszUserName);
debugLog(L"cleanuplastplugin() 1: miranda_avatarcache = %s", avatarsPath);
wchar_t spec[MAX_PATH + 10];
- mir_sntprintf(spec, L"%s\\*.(null)", avatarsPath);
+ mir_snwprintf(spec, L"%s\\*.(null)", avatarsPath);
WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile(spec, &ffd);
if (hFind != INVALID_HANDLE_VALUE) {
do {
wchar_t filePathT [2*MAX_PATH + 10];
- mir_sntprintf(filePathT, L"%s\\%s", avatarsPath, ffd.cFileName);
+ mir_snwprintf(filePathT, L"%s\\%s", avatarsPath, ffd.cFileName);
if (!_waccess(filePathT, 0)){
debugLog(L"cleanuplastplugin() 1: remove file = %s", filePathT);
_wremove(filePathT);
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 10ea01e41b..be0a8943fe 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -40,7 +40,7 @@ GGPROTO::GGPROTO(const char *pszProtoName, const wchar_t *tszUserName) : // Register m_hNetlibUser user
wchar_t name[128];
- mir_sntprintf(name, TranslateT("%s connection"), m_tszUserName);
+ mir_snwprintf(name, TranslateT("%s connection"), m_tszUserName);
NETLIBUSER nlu = { 0 };
nlu.cbSize = sizeof(nlu);
@@ -68,7 +68,7 @@ GGPROTO::GGPROTO(const char *pszProtoName, const wchar_t *tszUserName) : db_set_resident(m_szModuleName, GG_KEY_AVATARREQUESTED);
wchar_t szPath[MAX_PATH];
- mir_sntprintf(szPath, L"%s\\%s\\ImageCache", (wchar_t*)VARST(L"%miranda_userdata%"), m_tszUserName);
+ mir_snwprintf(szPath, L"%s\\%s\\ImageCache", (wchar_t*)VARST(L"%miranda_userdata%"), m_tszUserName);
hImagesFolder = FoldersRegisterCustomPathT(LPGEN("Images"), m_szModuleName, szPath, m_tszUserName);
DWORD dwVersion;
@@ -379,7 +379,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) // Fetch search data
wchar_t text[64];
GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, _countof(text));
- if (mir_tstrlen(text)) {
+ if (mir_wstrlen(text)) {
T2Utf firstName_utf8(text);
gg_pubdir50_add(req, GG_PUBDIR50_FIRSTNAME, firstName_utf8);
szQuery.Append(firstName_utf8);
@@ -387,7 +387,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) /* 1 */ szQuery.AppendChar('.');
GetDlgItemText(hwndDlg, IDC_LASTNAME, text, _countof(text));
- if (mir_tstrlen(text)) {
+ if (mir_wstrlen(text)) {
T2Utf lastName_utf8(text);
gg_pubdir50_add(req, GG_PUBDIR50_LASTNAME, lastName_utf8);
szQuery.Append(lastName_utf8);
@@ -395,7 +395,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) /* 2 */ szQuery.AppendChar('.');
GetDlgItemText(hwndDlg, IDC_NICKNAME, text, _countof(text));
- if (mir_tstrlen(text)) {
+ if (mir_wstrlen(text)) {
T2Utf nickName_utf8(text);
gg_pubdir50_add(req, GG_PUBDIR50_NICKNAME, nickName_utf8);
szQuery.Append(nickName_utf8);
@@ -403,7 +403,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) /* 3 */ szQuery.AppendChar('.');
GetDlgItemText(hwndDlg, IDC_CITY, text, _countof(text));
- if (mir_tstrlen(text)) {
+ if (mir_wstrlen(text)) {
T2Utf city_utf8(text);
gg_pubdir50_add(req, GG_PUBDIR50_CITY, city_utf8);
szQuery.Append(city_utf8);
@@ -411,7 +411,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) /* 4 */ szQuery.AppendChar('.');
GetDlgItemText(hwndDlg, IDC_AGEFROM, text, _countof(text));
- if (mir_tstrlen(text)) {
+ if (mir_wstrlen(text)) {
int yearTo = _tstoi(text);
int yearFrom;
time_t t = time(NULL);
@@ -431,7 +431,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) yearFrom = 0;
else
yearFrom = ay - yearFrom;
- mir_sntprintf(text, L"%d %d", yearFrom, yearTo);
+ mir_snwprintf(text, L"%d %d", yearFrom, yearTo);
T2Utf age_utf8(text);
gg_pubdir50_add(req, GG_PUBDIR50_BIRTHYEAR, age_utf8);
@@ -653,7 +653,7 @@ int GGPROTO::SetAwayMsg(int iStatus, const wchar_t *newMsg) }
// Check if we change status here somehow
- if (*msgPtr && newMsg && !mir_tstrcmp(*msgPtr, newMsg)
+ if (*msgPtr && newMsg && !mir_wstrcmp(*msgPtr, newMsg)
|| !*msgPtr && (!newMsg || !*newMsg)) {
if (status == m_iDesiredStatus && m_iDesiredStatus == m_iStatus) {
debugLogA("SetAwayMsg(): Message hasn't been changed, return.");
@@ -664,7 +664,7 @@ int GGPROTO::SetAwayMsg(int iStatus, const wchar_t *newMsg) else {
if (*msgPtr)
mir_free(*msgPtr);
- *msgPtr = newMsg && *newMsg ? mir_tstrdup(newMsg) : NULL;
+ *msgPtr = newMsg && *newMsg ? mir_wstrdup(newMsg) : NULL;
#ifdef DEBUGMODE
debugLogA("SetAwayMsg(): Message changed.");
#endif
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index 85790434eb..52d5399ef8 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -102,7 +102,7 @@ GGGC* GGPROTO::gc_lookup(const wchar_t *id) for(l = chats; l; l = l->next)
{
chat = (GGGC *)l->data;
- if (chat && !mir_tstrcmp(chat->id, id))
+ if (chat && !mir_wstrcmp(chat->id, id))
return chat;
}
@@ -138,7 +138,7 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam) MCONTACT hNext = db_find_next(hContact);
DBVARIANT dbv;
if (!getTString(hContact, "ChatRoomID", &dbv)) {
- if (dbv.ptszVal && !mir_tstrcmp(gch->pDest->ptszID, dbv.ptszVal))
+ if (dbv.ptszVal && !mir_wstrcmp(gch->pDest->ptszID, dbv.ptszVal))
CallService(MS_DB_CONTACT_DELETE, hContact, 0);
db_free(&dbv);
}
@@ -159,14 +159,14 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam) gce.ptszText = gch->ptszText;
wchar_t* nickT;
if (!getTString(GG_KEY_NICK, &dbv)){
- nickT = mir_tstrdup(dbv.ptszVal);
+ nickT = mir_wstrdup(dbv.ptszVal);
db_free(&dbv);
}
- else nickT = mir_tstrdup(TranslateT("Me"));
+ else nickT = mir_wstrdup(TranslateT("Me"));
gce.ptszNick = nickT;
// Get rid of CRLF at back
- int lc = (int)mir_tstrlen(gch->ptszText) - 1;
+ int lc = (int)mir_wstrlen(gch->ptszText) - 1;
while(lc >= 0 && (gch->ptszText[lc] == '\n' || gch->ptszText[lc] == '\r'))
gch->ptszText[lc --] = 0;
@@ -282,7 +282,7 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou wchar_t *senderName = unknownSender ?
TranslateT("Unknown") : pcli->pfnGetContactDisplayName(getcontact(sender, 0, 0, NULL), 0);
wchar_t error[256];
- mir_sntprintf(error, TranslateT("%s has initiated conference with %d participants (%d unknowns).\nDo you want to participate?"),
+ mir_snwprintf(error, TranslateT("%s has initiated conference with %d participants (%d unknowns).\nDo you want to participate?"),
senderName, recipients_count + 1, unknown);
chat->ignore = MessageBox(NULL, error, m_tszUserName, MB_OKCANCEL | MB_ICONEXCLAMATION) != IDOK;
}
@@ -307,12 +307,12 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou if (sender)
{
senderName = pcli->pfnGetContactDisplayName(getcontact(sender, 1, 0, NULL), 0);
- mir_sntprintf(status, TranslateT("%s initiated the conference.") , senderName);
+ mir_snwprintf(status, TranslateT("%s initiated the conference.") , senderName);
}
else
{
senderName = NULL;
- mir_sntprintf(status, TranslateT("This is my own conference."));
+ mir_snwprintf(status, TranslateT("This is my own conference."));
}
GCSESSION gcwindow = { sizeof(gcwindow) };
@@ -324,8 +324,8 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou gcwindow.ptszStatusbarText = status;
// Here we put nice new hash sign
- wchar_t *name = (wchar_t*)calloc(mir_tstrlen(gcwindow.ptszName) + 2, sizeof(wchar_t));
- *name = '#'; mir_tstrcpy(name + 1, gcwindow.ptszName);
+ wchar_t *name = (wchar_t*)calloc(mir_wstrlen(gcwindow.ptszName) + 2, sizeof(wchar_t));
+ *name = '#'; mir_wstrcpy(name + 1, gcwindow.ptszName);
gcwindow.ptszName = name;
// Create new room
@@ -354,10 +354,10 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou wchar_t* nickT;
if (!getTString(GG_KEY_NICK, &dbv)) {
- nickT = mir_tstrdup(dbv.ptszVal);
+ nickT = mir_wstrdup(dbv.ptszVal);
db_free(&dbv);
} else {
- nickT = mir_tstrdup(TranslateT("Me"));
+ nickT = mir_wstrdup(TranslateT("Me"));
}
gce.ptszNick = nickT;
diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp index a883917caf..106b8e2d5f 100644 --- a/protocols/Gadu-Gadu/src/image.cpp +++ b/protocols/Gadu-Gadu/src/image.cpp @@ -223,10 +223,10 @@ wchar_t *gg_img_getfilter(wchar_t *szFilter, int nSize) // Make up filter
wcsncpy(pFilter, szFilterName, nSize);
- pFilter += mir_tstrlen(pFilter) + 1;
+ pFilter += mir_wstrlen(pFilter) + 1;
if (pFilter >= szFilter + nSize) return NULL;
wcsncpy(pFilter, szFilterMask, nSize - (pFilter - szFilter));
- pFilter += mir_tstrlen(pFilter) + 1;
+ pFilter += mir_wstrlen(pFilter) + 1;
if (pFilter >= szFilter + nSize) return NULL;
*pFilter = 0;
@@ -420,9 +420,9 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP wchar_t *szName = pcli->pfnGetContactDisplayName(dat->hContact, 0), szTitle[128];
if (dat->bReceiving)
- mir_sntprintf(szTitle, TranslateT("Image from %s"), szName);
+ mir_snwprintf(szTitle, TranslateT("Image from %s"), szName);
else
- mir_sntprintf(szTitle, TranslateT("Image for %s"), szName);
+ mir_snwprintf(szTitle, TranslateT("Image for %s"), szName);
SetWindowText(hwndDlg, szTitle);
// Store client extents
@@ -495,7 +495,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (dat->bReceiving)
{
wchar_t szTitle[128];
- mir_sntprintf(szTitle, L"%s (%d / %d)", img->lpszFileName, dat->nImg, dat->nImgTotal);
+ mir_snwprintf(szTitle, L"%s (%d / %d)", img->lpszFileName, dat->nImg, dat->nImgTotal);
SetDlgItemText(hwndDlg, IDC_IMG_NAME, szTitle);
}
else
@@ -777,14 +777,14 @@ wchar_t *gg_img_hasextension(wchar_t *filename) wchar_t *imgtype = wcsrchr(filename, '.');
if (imgtype != NULL)
{
- size_t len = mir_tstrlen(imgtype);
+ size_t len = mir_wstrlen(imgtype);
imgtype++;
- if (len == 4 && (mir_tstrcmpi(imgtype, L"bmp") == 0 ||
- mir_tstrcmpi(imgtype, L"gif") == 0 ||
- mir_tstrcmpi(imgtype, L"jpg") == 0 ||
- mir_tstrcmpi(imgtype, L"png") == 0))
+ if (len == 4 && (mir_wstrcmpi(imgtype, L"bmp") == 0 ||
+ mir_wstrcmpi(imgtype, L"gif") == 0 ||
+ mir_wstrcmpi(imgtype, L"jpg") == 0 ||
+ mir_wstrcmpi(imgtype, L"png") == 0))
return --imgtype;
- if (len == 5 && mir_tstrcmpi(imgtype, L"jpeg") == 0)
+ if (len == 5 && mir_wstrcmpi(imgtype, L"jpeg") == 0)
return --imgtype;
}
}
@@ -803,12 +803,12 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) if (hImagesFolder == NULL || FoldersGetCustomPathT(hImagesFolder, path, MAX_PATH, L"")) {
wchar_t *tmpPath = Utils_ReplaceVarsT( L"%miranda_userdata%");
- tPathLen = mir_sntprintf(szPath, L"%s\\%s\\ImageCache", tmpPath, m_tszUserName);
+ tPathLen = mir_snwprintf(szPath, L"%s\\%s\\ImageCache", tmpPath, m_tszUserName);
mir_free(tmpPath);
}
else {
- mir_tstrcpy(szPath, path);
- tPathLen = mir_tstrlen(szPath);
+ mir_wstrcpy(szPath, path);
+ tPathLen = mir_wstrlen(szPath);
}
if ( _waccess(szPath, 0)){
@@ -818,19 +818,19 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) } else {
debugLog(L"img_displayasmsg(): Can not create directory for image cache: %s. errno=%d: %s", szPath, errno, strerror(errno));
wchar_t error[512];
- mir_sntprintf(error, TranslateT("Cannot create image cache directory. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szPath);
+ mir_snwprintf(error, TranslateT("Cannot create image cache directory. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szPath);
showpopup(m_tszUserName, error, GG_POPUP_ERROR | GG_POPUP_ALLOW_MSGBOX | GG_POPUP_ONCE);
}
}
- mir_sntprintf(szPath + tPathLen, MAX_PATH - tPathLen, L"\\%s", dat->lpszFileName);
+ mir_snwprintf(szPath + tPathLen, MAX_PATH - tPathLen, L"\\%s", dat->lpszFileName);
if ((pImgext = gg_img_hasextension(szPath)) == NULL)
- pImgext = szPath + mir_tstrlen(szPath);
+ pImgext = szPath + mir_wstrlen(szPath);
wcsncpy_s(imgext, pImgext, _TRUNCATE);
for (i = 1; ; ++i)
{
if ((res = gg_img_isexists(szPath, dat)) != -1) break;
- mir_sntprintf(szPath, L"%.*s (%u)%s", pImgext - szPath, szPath, i, imgext);
+ mir_snwprintf(szPath, L"%.*s (%u)%s", pImgext - szPath, szPath, i, imgext);
}
if (res == 0) {
@@ -842,7 +842,7 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) } else {
debugLog(L"img_displayasmsg(): Cannot open file %s for write image. errno=%d: %s", szPath, errno, strerror(errno));
wchar_t error[512];
- mir_sntprintf(error, TranslateT("Cannot save received image to file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szPath);
+ mir_snwprintf(error, TranslateT("Cannot save received image to file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szPath);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
return 0;
}
@@ -850,7 +850,7 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) if (res != 0) {
wchar_t image_msg[MAX_PATH + 11];
- mir_sntprintf(image_msg, L"[img]%s[/img]", szPath);
+ mir_snwprintf(image_msg, L"[img]%s[/img]", szPath);
T2Utf szMessage(image_msg);
PROTORECVEVENT pre = {0};
@@ -963,7 +963,7 @@ void* GGPROTO::img_loadpicture(gg_event* e, wchar_t *szFileName) free(dat);
debugLog(L"img_loadpicture(): fopen(\"%s\", \"rb\" failed. errno=%d: %s)", szFileName, errno, strerror(errno));
wchar_t error[512];
- mir_sntprintf(error, TranslateT("Cannot open image file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szFileName);
+ mir_snwprintf(error, TranslateT("Cannot open image file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szFileName);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
return NULL;
}
@@ -1005,15 +1005,15 @@ void* GGPROTO::img_loadpicture(gg_event* e, wchar_t *szFileName) dat->lpData = (char*)malloc(dat->nSize);
memcpy(dat->lpData, e->event.image_reply.image, dat->nSize);
- ptrT tmpFileName( mir_a2t(e->event.image_reply.filename));
+ ptrW tmpFileName( mir_a2u(e->event.image_reply.filename));
if (!gg_img_hasextension(tmpFileName)) {
// Add missing file extension
const wchar_t *szImgType = gg_img_guessfileextension(dat->lpData);
if (*szImgType) {
- dat->lpszFileName = (wchar_t*)calloc(sizeof(wchar_t), mir_tstrlen(tmpFileName) + mir_tstrlen(szImgType) + 1);
+ dat->lpszFileName = (wchar_t*)calloc(sizeof(wchar_t), mir_wstrlen(tmpFileName) + mir_wstrlen(szImgType) + 1);
if (dat->lpszFileName != NULL) {
- mir_tstrcpy(dat->lpszFileName, tmpFileName);
- mir_tstrcat(dat->lpszFileName, szImgType);
+ mir_wstrcpy(dat->lpszFileName, tmpFileName);
+ mir_wstrcat(dat->lpszFileName, szImgType);
}
}
}
@@ -1143,7 +1143,7 @@ BOOL GGPROTO::img_sendonrequest(gg_event* e) if (!dat || !isonline())
return FALSE;
- char* lpszFileNameA = mir_t2a(dat->lpImages->lpszFileName);
+ char* lpszFileNameA = mir_u2a(dat->lpImages->lpszFileName);
gg_EnterCriticalSection(&sess_mutex, "img_sendonrequest", 63, "sess_mutex", 1);
gg_image_reply(sess, e->event.image_request.sender, lpszFileNameA, dat->lpImages->lpData, dat->lpImages->nSize);
gg_LeaveCriticalSection(&sess_mutex, "img_sendonrequest", 63, 1, "sess_mutex", 1);
diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp index 08a882079e..6e8e3f43f0 100644 --- a/protocols/Gadu-Gadu/src/import.cpp +++ b/protocols/Gadu-Gadu/src/import.cpp @@ -34,7 +34,7 @@ char *gg_makecontacts(GGPROTO *gg, int cr) DBVARIANT dbv;
if (!gg->getTString(hContact, GG_KEY_PD_FIRSTNAME, &dbv))
{
- char* pszValA = mir_t2a(dbv.ptszVal);
+ char* pszValA = mir_u2a(dbv.ptszVal);
string_append(s, dbv.pszVal);
mir_free(pszValA);
db_free(&dbv);
@@ -43,7 +43,7 @@ char *gg_makecontacts(GGPROTO *gg, int cr) // Readup LastName
if (!gg->getTString(hContact, GG_KEY_PD_LASTNAME, &dbv))
{
- char* pszValA = mir_t2a(dbv.ptszVal);
+ char* pszValA = mir_u2a(dbv.ptszVal);
string_append(s, dbv.pszVal);
mir_free(pszValA);
db_free(&dbv);
@@ -53,11 +53,11 @@ char *gg_makecontacts(GGPROTO *gg, int cr) // Readup Nick
if (!db_get_ts(hContact, "CList", "MyHandle", &dbv) || !gg->getTString(hContact, GG_KEY_NICK, &dbv))
{
- char* dbvA = mir_t2a(dbv.ptszVal);
+ char* dbvA = mir_u2a(dbv.ptszVal);
DBVARIANT dbv2;
if (!gg->getTString(hContact, GG_KEY_PD_NICKNAME, &dbv2))
{
- char* pszValA = mir_t2a(dbv2.ptszVal);
+ char* pszValA = mir_u2a(dbv2.ptszVal);
string_append(s, pszValA);
mir_free(pszValA);
db_free(&dbv2);
@@ -216,19 +216,19 @@ void GGPROTO::parsecontacts(char *contacts) #endif
// Write group
if (hContact && strGroup) {
- ptrT tszGrpName( mir_a2t(strGroup));
+ ptrW tszGrpName( mir_a2u(strGroup));
Clist_GroupCreate(0, tszGrpName);
db_set_ts(hContact, "CList", "Group", tszGrpName);
}
// Write misc data
if (hContact && strFirstName){
- wchar_t *tstrFirstName = mir_a2t(strFirstName);
+ wchar_t *tstrFirstName = mir_a2u(strFirstName);
setTString(hContact, GG_KEY_PD_FIRSTNAME, tstrFirstName);
mir_free(tstrFirstName);
}
if (hContact && strLastName){
- wchar_t *tstrLastName = mir_a2t(strLastName);
+ wchar_t *tstrLastName = mir_a2u(strLastName);
setTString(hContact, GG_KEY_PD_LASTNAME, tstrLastName);
mir_free(tstrLastName);
}
@@ -278,7 +278,7 @@ INT_PTR GGPROTO::import_server(WPARAM, LPARAM) {
wchar_t error[128];
gg_LeaveCriticalSection(&sess_mutex, "import_server", 65, 1, "sess_mutex", 1);
- mir_sntprintf(error, TranslateT("List cannot be imported because of error:\n\t%s (Error: %d)"), ws_strerror(errno), errno);
+ mir_snwprintf(error, TranslateT("List cannot be imported because of error:\n\t%s (Error: %d)"), ws_strerror(errno), errno);
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
debugLog(L"import_server(): Cannot import list. errno:%d: %s", errno, ws_strerror(errno));
}
@@ -316,7 +316,7 @@ INT_PTR GGPROTO::remove_server(WPARAM, LPARAM) {
wchar_t error[128];
gg_LeaveCriticalSection(&sess_mutex, "remove_server", 66, 1, "sess_mutex", 1);
- mir_sntprintf(error, TranslateT("List cannot be removed because of error: %s (Error: %d)"), ws_strerror(errno), errno);
+ mir_snwprintf(error, TranslateT("List cannot be removed because of error: %s (Error: %d)"), ws_strerror(errno), errno);
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
debugLog(L"remove_server(): Cannot remove list. errno=%d: %s", errno, ws_strerror(errno));
}
@@ -337,24 +337,24 @@ INT_PTR GGPROTO::import_text(WPARAM, LPARAM) OPENFILENAME ofn = {0};
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
wcsncpy(filter, TranslateT("Text files"), _countof(filter));
- mir_tstrncat(filter, L" (*.txt)", _countof(filter) - mir_tstrlen(filter));
- pfilter = filter + mir_tstrlen(filter) + 1;
+ mir_wstrncat(filter, L" (*.txt)", _countof(filter) - mir_wstrlen(filter));
+ pfilter = filter + mir_wstrlen(filter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
wcsncpy(pfilter, L"*.TXT", _countof(filter) - (pfilter - filter));
- pfilter = pfilter + mir_tstrlen(pfilter) + 1;
+ pfilter = pfilter + mir_wstrlen(pfilter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
wcsncpy(pfilter, TranslateT("All Files"), _countof(filter) - (pfilter - filter));
- mir_tstrncat(pfilter, L" (*)", _countof(filter) - (pfilter - filter) - mir_tstrlen(pfilter));
- pfilter = pfilter + mir_tstrlen(pfilter) + 1;
+ mir_wstrncat(pfilter, L" (*)", _countof(filter) - (pfilter - filter) - mir_wstrlen(pfilter));
+ pfilter = pfilter + mir_wstrlen(pfilter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
wcsncpy(pfilter, L"*", _countof(filter) - (pfilter - filter));
- pfilter = pfilter + mir_tstrlen(pfilter) + 1;
+ pfilter = pfilter + mir_wstrlen(pfilter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
@@ -390,7 +390,7 @@ INT_PTR GGPROTO::import_text(WPARAM, LPARAM) else
{
wchar_t error[256];
- mir_sntprintf(error, TranslateT("List cannot be imported from file \"%s\" because of error:\n\t%s (Error: %d)"), str, _tcserror(errno), errno);
+ mir_snwprintf(error, TranslateT("List cannot be imported from file \"%s\" because of error:\n\t%s (Error: %d)"), str, _tcserror(errno), errno);
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
debugLog(L"import_text(): Cannot import list from file \"%s\". errno=%d: %s", str, errno, _tcserror(errno));
if (f)
@@ -406,25 +406,25 @@ INT_PTR GGPROTO::export_text(WPARAM, LPARAM) wchar_t filter[512], *pfilter;
wcsncpy(str, TranslateT("contacts"), _countof(str));
- mir_tstrncat(str, L".txt", _countof(str) - mir_tstrlen(str));
+ mir_wstrncat(str, L".txt", _countof(str) - mir_wstrlen(str));
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
wcsncpy(filter, TranslateT("Text files"), _countof(filter));
- mir_tstrncat(filter, L" (*.txt)", _countof(filter) - mir_tstrlen(filter));
- pfilter = filter + mir_tstrlen(filter) + 1;
+ mir_wstrncat(filter, L" (*.txt)", _countof(filter) - mir_wstrlen(filter));
+ pfilter = filter + mir_wstrlen(filter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
wcsncpy(pfilter, L"*.TXT", _countof(filter) - (pfilter - filter));
- pfilter = pfilter + mir_tstrlen(pfilter) + 1;
+ pfilter = pfilter + mir_wstrlen(pfilter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
wcsncpy(pfilter, TranslateT("All Files"), _countof(filter) - (pfilter - filter));
- mir_tstrncat(pfilter, L" (*)", _countof(filter) - (pfilter - filter) - mir_tstrlen(pfilter));
- pfilter = pfilter + mir_tstrlen(pfilter) + 1;
+ mir_wstrncat(pfilter, L" (*)", _countof(filter) - (pfilter - filter) - mir_wstrlen(pfilter));
+ pfilter = pfilter + mir_wstrlen(pfilter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
wcsncpy(pfilter, L"*", _countof(filter) - (pfilter - filter));
- pfilter = pfilter + mir_tstrlen(pfilter) + 1;
+ pfilter = pfilter + mir_wstrlen(pfilter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
*pfilter = '\0';
@@ -452,7 +452,7 @@ INT_PTR GGPROTO::export_text(WPARAM, LPARAM) else
{
wchar_t error[128];
- mir_sntprintf(error, TranslateT("List cannot be exported to file \"%s\" because of error:\n\t%s (Error: %d)"), str, _tcserror(errno), errno);
+ mir_snwprintf(error, TranslateT("List cannot be exported to file \"%s\" because of error:\n\t%s (Error: %d)"), str, _tcserror(errno), errno);
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
debugLog(L"export_text(): Cannot export list to file \"%s\". errno=%d: %s", str, errno, _tcserror(errno));
}
@@ -496,7 +496,7 @@ INT_PTR GGPROTO::export_server(WPARAM, LPARAM) {
wchar_t error[128];
gg_LeaveCriticalSection(&sess_mutex, "export_server", 67, 1, "sess_mutex", 1);
- mir_sntprintf(error, TranslateT("List cannot be exported because of error:\n\t%s (Error: %d)"), ws_strerror(errno), errno);
+ mir_snwprintf(error, TranslateT("List cannot be exported because of error:\n\t%s (Error: %d)"), ws_strerror(errno), errno);
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
debugLog(L"export_server(): Cannot export list. errno=%d: %s", errno, ws_strerror(errno));
}
diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp index 818daa2d8d..2a24e7e5c5 100644 --- a/protocols/Gadu-Gadu/src/oauth.cpp +++ b/protocols/Gadu-Gadu/src/oauth.cpp @@ -315,14 +315,14 @@ int GGPROTO::oauth_receivetoken() if (resp) {
nlc = resp->nlc;
if (resp->resultCode == 200 && resp->dataLength > 0 && resp->pData) {
- wchar_t *xmlAction = mir_a2t(resp->pData);
+ wchar_t *xmlAction = mir_a2u(resp->pData);
HXML hXml = xmlParseString(xmlAction, 0, L"result");
if (hXml != NULL) {
HXML node = xmlGetChildByPath(hXml, L"oauth_token", 0);
- token = node != NULL ? mir_t2a(xmlGetText(node)) : NULL;
+ token = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
node = xmlGetChildByPath(hXml, L"oauth_token_secret", 0);
- token_secret = node != NULL ? mir_t2a(xmlGetText(node)) : NULL;
+ token_secret = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
xmlDestroyNode(hXml);
}
@@ -384,14 +384,14 @@ int GGPROTO::oauth_receivetoken() resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req);
if (resp) {
if (resp->resultCode == 200 && resp->dataLength > 0 && resp->pData) {
- wchar_t *xmlAction = mir_a2t(resp->pData);
+ wchar_t *xmlAction = mir_a2u(resp->pData);
HXML hXml = xmlParseString(xmlAction, 0, L"result");
if (hXml != NULL) {
HXML node = xmlGetChildByPath(hXml, L"oauth_token", 0);
- token = mir_t2a(xmlGetText(node));
+ token = mir_u2a(xmlGetText(node));
node = xmlGetChildByPath(hXml, L"oauth_token_secret", 0);
- token_secret = mir_t2a(xmlGetText(node));
+ token_secret = mir_u2a(xmlGetText(node));
xmlDestroyNode(hXml);
}
diff --git a/protocols/Gadu-Gadu/src/ownerinfo.cpp b/protocols/Gadu-Gadu/src/ownerinfo.cpp index 7d7ebeb5cd..c89521354f 100644 --- a/protocols/Gadu-Gadu/src/ownerinfo.cpp +++ b/protocols/Gadu-Gadu/src/ownerinfo.cpp @@ -57,7 +57,7 @@ void __cdecl GGPROTO::remindpasswordthread(void *param) if (!(h = gg_remind_passwd3(rp->uin, rp->email, token.id, token.val, 0)))
{
wchar_t error[128];
- mir_sntprintf(error, TranslateT("Password could not be reminded because of error:\n\t%s (Error: %d)"), ws_strerror(errno), errno);
+ mir_snwprintf(error, TranslateT("Password could not be reminded because of error:\n\t%s (Error: %d)"), ws_strerror(errno), errno);
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
debugLog(L"remindpasswordthread(): Password could not be reminded. errno=%d: %s", errno, ws_strerror(errno));
}
diff --git a/protocols/Gadu-Gadu/src/popups.cpp b/protocols/Gadu-Gadu/src/popups.cpp index ca8ff1fa74..7712477bc2 100644 --- a/protocols/Gadu-Gadu/src/popups.cpp +++ b/protocols/Gadu-Gadu/src/popups.cpp @@ -87,7 +87,7 @@ void GGPROTO::initpopups() puc.hIcon = CopyIcon(LoadIconEx("main", FALSE));
ReleaseIconEx("main", FALSE);
puc.iSeconds = 4;
- mir_sntprintf(szDescr, L"%s/%s", m_tszUserName, TranslateT("Notify"));
+ mir_snwprintf(szDescr, L"%s/%s", m_tszUserName, TranslateT("Notify"));
mir_snprintf(szName, "%s_%s", m_szModuleName, "Notify");
hPopupNotify = Popup_RegisterClass(&puc);
@@ -95,7 +95,7 @@ void GGPROTO::initpopups() puc.colorText = RGB(255, 245, 225); // Yellow
puc.iSeconds = 60;
puc.hIcon = (HICON)LoadImage(NULL, IDI_WARNING, IMAGE_ICON, 0, 0, LR_SHARED);
- mir_sntprintf(szDescr, L"%s/%s", m_tszUserName, TranslateT("Error"));
+ mir_snwprintf(szDescr, L"%s/%s", m_tszUserName, TranslateT("Error"));
mir_snprintf(szName, "%s_%s", m_szModuleName, "Error");
hPopupError = Popup_RegisterClass(&puc);
}
@@ -155,8 +155,8 @@ void GGPROTO::showpopup(const wchar_t* nickname, const wchar_t* msg, int flags) PopupData *puData = (PopupData*)mir_calloc(sizeof(PopupData));
puData->flags = flags;
- puData->title = mir_tstrdup(nickname);
- puData->text = mir_tstrdup(msg);
+ puData->title = mir_wstrdup(nickname);
+ puData->text = mir_wstrdup(msg);
puData->gg = this;
CallFunctionAsync(sttMainThreadCallback, puData);
diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp index f067ae87b7..e0fde48c40 100644 --- a/protocols/Gadu-Gadu/src/services.cpp +++ b/protocols/Gadu-Gadu/src/services.cpp @@ -189,7 +189,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) //directly check if contact has protected user avatar set by AVS, and if yes return it as protocol avatar
DBVARIANT dbv;
if (!db_get_ts(pai->hContact, "ContactPhoto", "Backup", &dbv)) {
- if ((mir_tstrlen(dbv.ptszVal)>0) && db_get_b(pai->hContact, "ContactPhoto", "Locked", 0)){
+ if ((mir_wstrlen(dbv.ptszVal)>0) && db_get_b(pai->hContact, "ContactPhoto", "Locked", 0)){
debugLogA("getavatarinfo(): Incoming request for avatar information. Contact has assigned Locked ContactPhoto. return GAIR_SUCCESS");
wcscpy_s(pai->filename, _countof(pai->filename) ,dbv.ptszVal);
pai->format = ProtoGetAvatarFormat(pai->filename);
@@ -242,7 +242,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) if (_wremove(pai->filename) != 0){
debugLog(L"getavatarinfo(): refresh. _wremove 1 file %s error. errno=%d: %s", pai->filename, errno, _tcserror(errno));
wchar_t error[512];
- mir_sntprintf(error, TranslateT("Cannot remove old avatar file before refresh. ERROR: %d: %s\n%s"), errno, _tcserror(errno), pai->filename);
+ mir_snwprintf(error, TranslateT("Cannot remove old avatar file before refresh. ERROR: %d: %s\n%s"), errno, _tcserror(errno), pai->filename);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
}
setString(pai->hContact, GG_KEY_AVATARHASH, AvatarHash);
@@ -257,7 +257,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) if (_wremove(pai->filename) != 0){
debugLog(L"getavatarinfo(): delete. _wremove file %s error. errno=%d: %s", pai->filename, errno, _tcserror(errno));
wchar_t error[512];
- mir_sntprintf(error, TranslateT("Cannot remove old avatar file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), pai->filename);
+ mir_snwprintf(error, TranslateT("Cannot remove old avatar file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), pai->filename);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
}
delSetting(pai->hContact, GG_KEY_AVATARHASH);
@@ -337,7 +337,7 @@ INT_PTR GGPROTO::setmyavatar(WPARAM, LPARAM lParam) wchar_t szMyFilename[MAX_PATH];
getAvatarFilename(NULL, szMyFilename, _countof(szMyFilename));
- if ( mir_tstrcmp(szFilename, szMyFilename) && !CopyFile(szFilename, szMyFilename, FALSE)) {
+ if ( mir_wstrcmp(szFilename, szMyFilename) && !CopyFile(szFilename, szMyFilename, FALSE)) {
debugLogA("setmyavatar(): Failed to set user avatar. File with type %d could not be created/overwritten.", iAvType);
return -1;
}
@@ -357,7 +357,7 @@ INT_PTR GGPROTO::getmyawaymsg(WPARAM wParam, LPARAM lParam) gg_EnterCriticalSection(&modemsg_mutex, "refreshstatus", 72, "modemsg_mutex", 1);
wchar_t *szMsg = getstatusmsg(wParam ? gg_normalizestatus(wParam) : m_iStatus);
if (isonline() && szMsg)
- res = (lParam & SGMA_UNICODE) ? (INT_PTR)mir_t2u(szMsg) : (INT_PTR)mir_t2a(szMsg);
+ res = (lParam & SGMA_UNICODE) ? (INT_PTR)mir_wstrdup(szMsg) : (INT_PTR)mir_u2a(szMsg);
gg_LeaveCriticalSection(&modemsg_mutex, "refreshstatus", 72, 1, "modemsg_mutex", 1);
return res;
}
diff --git a/protocols/Gadu-Gadu/src/sessions.cpp b/protocols/Gadu-Gadu/src/sessions.cpp index 13db5b1072..cd2225ddad 100644 --- a/protocols/Gadu-Gadu/src/sessions.cpp +++ b/protocols/Gadu-Gadu/src/sessions.cpp @@ -142,7 +142,7 @@ static BOOL IsOverAction(HWND hwndDlg) szText[0] = 0;
ListView_GetItemText(hList, hti.iItem, hti.iSubItem, szText, _countof(szText));
hdc = GetDC(hList);
- GetTextExtentPoint32(hdc, szText, (int)mir_tstrlen(szText), &textSize);
+ GetTextExtentPoint32(hdc, szText, (int)mir_wstrlen(szText), &textSize);
ReleaseDC(hList, hdc);
textPosX = rc.left + (((rc.right - rc.left) - textSize.cx) / 2);
return (hti.pt.x > textPosX && hti.pt.x < textPosX + textSize.cx);
@@ -168,7 +168,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w HANDLE hProtoAckEvent;
GetWindowText(hwndDlg, oldTitle, _countof(oldTitle));
- mir_sntprintf(newTitle, oldTitle, gg->m_tszUserName);
+ mir_snwprintf(newTitle, oldTitle, gg->m_tszUserName);
SetWindowText(hwndDlg, newTitle);
Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(IDI_SESSIONS));
@@ -247,7 +247,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w GetClientRect(hwndHeader, &rcHeader);
rc.top += rcHeader.bottom;
}
- int cbLen = (int)mir_tstrlen(szText);
+ int cbLen = (int)mir_wstrlen(szText);
SIZE textSize;
GetTextExtentPoint32(nm->nmcd.hdc, szText, cbLen, &textSize);
int textPosX = rc.left + (((rc.right - rc.left) - textSize.cx) / 2);
@@ -330,10 +330,10 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w ListView_GetItemText(hList, lvhti.iItem, 0, szClientName, _countof(szClientName));
ListView_GetItemText(hList, lvhti.iItem, 1, szIP, _countof(szIP));
ListView_GetItemText(hList, lvhti.iItem, 2, szLoginTime, _countof(szLoginTime));
- mir_sntprintf(szText, L"%s\t%s\t%s", szClientName, szIP, szLoginTime);
- if ((hData = GlobalAlloc(GMEM_MOVEABLE, mir_tstrlen(szText) + 1)) != NULL)
+ mir_snwprintf(szText, L"%s\t%s\t%s", szClientName, szIP, szLoginTime);
+ if ((hData = GlobalAlloc(GMEM_MOVEABLE, mir_wstrlen(szText) + 1)) != NULL)
{
- mir_tstrcpy((wchar_t*)GlobalLock(hData), szText);
+ mir_wstrcpy((wchar_t*)GlobalLock(hData), szText);
GlobalUnlock(hData);
SetClipboardData(CF_TEXT, hData);
}
@@ -346,7 +346,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w wchar_t szUrl[256], szIP[64];
szIP[0] = 0;
ListView_GetItemText(hList, lvhti.iItem, 1, szIP, _countof(szIP));
- mir_sntprintf(szUrl, L"http://whois.domaintools.com/%s", szIP);
+ mir_snwprintf(szUrl, L"http://whois.domaintools.com/%s", szIP);
Utils_OpenUrlT(szUrl);
break;
}
diff --git a/protocols/Gadu-Gadu/src/token.cpp b/protocols/Gadu-Gadu/src/token.cpp index da89d11331..351b0df053 100644 --- a/protocols/Gadu-Gadu/src/token.cpp +++ b/protocols/Gadu-Gadu/src/token.cpp @@ -114,7 +114,7 @@ int GGPROTO::gettoken(GGTOKEN *token) struct gg_http *h = gg_token(0);
if (!h || gg_token_watch_fd(h) || h->state == GG_STATE_ERROR || h->state != GG_STATE_DONE) {
wchar_t error[128];
- mir_sntprintf(error, TranslateT("Token retrieval failed because of error:\n\t%s"), http_error_string(h ? h->error : 0));
+ mir_snwprintf(error, TranslateT("Token retrieval failed because of error:\n\t%s"), http_error_string(h ? h->error : 0));
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
gg_free_pubdir(h);
return FALSE;
@@ -123,7 +123,7 @@ int GGPROTO::gettoken(GGTOKEN *token) struct gg_token *t = (struct gg_token *)h->data;
if (!t || !h->body) {
wchar_t error[128];
- mir_sntprintf(error, TranslateT("Token retrieval failed because of error:\n\t%s"), http_error_string(h->error));
+ mir_snwprintf(error, TranslateT("Token retrieval failed because of error:\n\t%s"), http_error_string(h->error));
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
gg_free_pubdir(h);
return FALSE;
diff --git a/protocols/Gadu-Gadu/src/userutils.cpp b/protocols/Gadu-Gadu/src/userutils.cpp index 0a2e424c2f..2b8be7fb7a 100644 --- a/protocols/Gadu-Gadu/src/userutils.cpp +++ b/protocols/Gadu-Gadu/src/userutils.cpp @@ -40,7 +40,7 @@ void *gg_doregister(GGPROTO *gg, char *newPass, char *newEmail) if (!(h = gg_register3(newEmail, newPass, token.id, token.val, 0)) || !(s = (gg_pubdir*)h->data) || !s->success || !s->uin) {
wchar_t error[128];
- mir_sntprintf(error, TranslateT("Cannot register new account because of error:\n\t%s"),
+ mir_snwprintf(error, TranslateT("Cannot register new account because of error:\n\t%s"),
(h && !s) ? http_error_string(h->error) :
(s ? TranslateT("Registration rejected") : ws_strerror(errno)));
MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
@@ -86,7 +86,7 @@ void *gg_dounregister(GGPROTO *gg, uin_t uin, char *password) if (!(h = gg_unregister3(uin, password, token.id, token.val, 0)) || !(s = (gg_pubdir*)h->data) || !s->success || s->uin != uin)
{
wchar_t error[128];
- mir_sntprintf(error, TranslateT("Your account cannot be removed because of error:\n\t%s"),
+ mir_snwprintf(error, TranslateT("Your account cannot be removed because of error:\n\t%s"),
(h && !s) ? http_error_string(h->error) :
(s ? TranslateT("Bad number or password") : ws_strerror(errno)));
MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
@@ -138,7 +138,7 @@ void *gg_dochpass(GGPROTO *gg, uin_t uin, char *password, char *newPass) if (!(h = gg_change_passwd4(uin, email, password, newPass, token.id, token.val, 0)) || !(s = (gg_pubdir*)h->data) || !s->success)
{
wchar_t error[128];
- mir_sntprintf(error, TranslateT("Your password cannot be changed because of error:\n\t%s"),
+ mir_snwprintf(error, TranslateT("Your password cannot be changed because of error:\n\t%s"),
(h && !s) ? http_error_string(h->error) :
(s ? TranslateT("Invalid data entered") : ws_strerror(errno)));
MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
@@ -180,7 +180,7 @@ void *gg_dochemail(GGPROTO *gg, uin_t uin, char *password, char *email, char *ne if (!h || !(s = (gg_pubdir*)h->data) || !s->success)
{
wchar_t error[128];
- mir_sntprintf(error, TranslateT("Your e-mail cannot be changed because of error:\n\t%s"),
+ mir_snwprintf(error, TranslateT("Your e-mail cannot be changed because of error:\n\t%s"),
(h && !s) ? http_error_string(h->error) : (s ? TranslateT("Bad old e-mail or password") : ws_strerror(errno)));
MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
gg->debugLog(L"gg_dochemail(): Cannot change e-mail. errno=%d: %s", errno, ws_strerror(errno));
diff --git a/protocols/ICQCorp/src/protocol.cpp b/protocols/ICQCorp/src/protocol.cpp index 06215bfe8c..19b51ca642 100644 --- a/protocols/ICQCorp/src/protocol.cpp +++ b/protocols/ICQCorp/src/protocol.cpp @@ -2203,12 +2203,12 @@ void ICQ::addUrl(ICQUser *u, char *m, unsigned short theCmd, unsigned short theS CCSDATA ccs;
PROTORECVEVENT pre;
- messageLen = (int)mir_tstrlen(m);
+ messageLen = (int)mir_strlen(m);
for (i=0; i<messageLen; i++) if (m[i] == (char)0xFE) m[i] = 0;
url = new char[messageLen + 1];
- lstrcpy(url, m + mir_tstrlen(m) + 1);
- lstrcpy(url + mir_tstrlen(url) + 1, m);
+ lstrcpy(url, m + mir_strlen(m) + 1);
+ lstrcpy(url + mir_strlen(url) + 1, m);
ccs.hContact = u->hContact;
ccs.szProtoService = PSR_URL;
diff --git a/protocols/ICQCorp/src/services.cpp b/protocols/ICQCorp/src/services.cpp index a03ac228ad..d2d559f7da 100644 --- a/protocols/ICQCorp/src/services.cpp +++ b/protocols/ICQCorp/src/services.cpp @@ -199,7 +199,7 @@ static INT_PTR icqRecvMessage(WPARAM, LPARAM lParam) dbei.timestamp = pre->timestamp;
dbei.flags = pre->flags & (PREF_CREATEREAD ? DBEF_READ : 0);
dbei.eventType = EVENTTYPE_MESSAGE;
- dbei.cbBlob = (DWORD)mir_tstrlen(pre->szMessage) + 1;
+ dbei.cbBlob = (DWORD)mir_strlen(pre->szMessage) + 1;
dbei.pBlob = (PBYTE)pre->szMessage;
db_event_add(ccs->hContact, &dbei);
return 0;
@@ -235,14 +235,14 @@ static INT_PTR icqRecvUrl(WPARAM, LPARAM lParam) T("[ ] recieve url\n");
db_unset(ccs->hContact, "CList", "Hidden");
- pszDescr = pre->szMessage + mir_tstrlen(pre->szMessage) + 1;
+ pszDescr = pre->szMessage + mir_strlen(pre->szMessage) + 1;
ZeroMemory(&dbei, sizeof(dbei));
dbei.cbSize = sizeof(dbei);
dbei.szModule = protoName;
dbei.timestamp = pre->timestamp;
dbei.flags = pre->flags & (PREF_CREATEREAD ? DBEF_READ : 0);
dbei.eventType = EVENTTYPE_URL;
- dbei.cbBlob = (DWORD)(mir_tstrlen(pre->szMessage) + mir_tstrlen(pszDescr) + 2);
+ dbei.cbBlob = (DWORD)(mir_strlen(pre->szMessage) + mir_strlen(pszDescr) + 2);
dbei.pBlob = (PBYTE)pre->szMessage;
db_event_add(ccs->hContact, &dbei);
return 0;
diff --git a/protocols/IRCG/src/clist.cpp b/protocols/IRCG/src/clist.cpp index 3f3676869e..c4f076d1c7 100644 --- a/protocols/IRCG/src/clist.cpp +++ b/protocols/IRCG/src/clist.cpp @@ -69,7 +69,7 @@ BOOL CIrcProto::CList_AddDCCChat(const CMString& name, const CMString& hostmask, cle.hIcon = LoadIconEx(IDI_DCC);
mir_snprintf(szService, "%s/DblClickEvent", m_szModuleName);
cle.pszService = szService;
- mir_sntprintf(szNick, TranslateT("CTCP chat request from %s"), name.c_str());
+ mir_snwprintf(szNick, TranslateT("CTCP chat request from %s"), name.c_str());
cle.ptszTooltip = szNick;
cle.lParam = (LPARAM)pdci;
@@ -165,7 +165,7 @@ MCONTACT CIrcProto::CList_FindContact(CONTACT *user) if (!user || !user->name)
return 0;
- wchar_t* lowercasename = mir_tstrdup(user->name);
+ wchar_t* lowercasename = mir_wstrdup(user->name);
CharLower(lowercasename);
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
@@ -173,33 +173,33 @@ MCONTACT CIrcProto::CList_FindContact(CONTACT *user) continue;
MCONTACT hContact_temp = NULL;
- ptrT DBNick(getTStringA(hContact, "Nick"));
- ptrT DBUser(getTStringA(hContact, "UUser"));
- ptrT DBHost(getTStringA(hContact, "UHost"));
- ptrT DBDefault(getTStringA(hContact, "Default"));
- ptrT DBWildcard(getTStringA(hContact, "UWildcard"));
+ ptrW DBNick(getTStringA(hContact, "Nick"));
+ ptrW DBUser(getTStringA(hContact, "UUser"));
+ ptrW DBHost(getTStringA(hContact, "UHost"));
+ ptrW DBDefault(getTStringA(hContact, "Default"));
+ ptrW DBWildcard(getTStringA(hContact, "UWildcard"));
if (DBWildcard)
CharLower(DBWildcard);
if (IsChannel(user->name)) {
- if (DBDefault && !mir_tstrcmpi(DBDefault, user->name))
+ if (DBDefault && !mir_wstrcmpi(DBDefault, user->name))
hContact_temp = (MCONTACT)-1;
}
- else if (user->ExactNick && DBNick && !mir_tstrcmpi(DBNick, user->name))
+ else if (user->ExactNick && DBNick && !mir_wstrcmpi(DBNick, user->name))
hContact_temp = hContact;
- else if (user->ExactOnly && DBDefault && !mir_tstrcmpi(DBDefault, user->name))
+ else if (user->ExactOnly && DBDefault && !mir_wstrcmpi(DBDefault, user->name))
hContact_temp = hContact;
else if (user->ExactWCOnly) {
- if (DBWildcard && !mir_tstrcmpi(DBWildcard, lowercasename)
- || (DBWildcard && !mir_tstrcmpi(DBNick, lowercasename) && !WCCmp(DBWildcard, lowercasename))
- || (!DBWildcard && !mir_tstrcmpi(DBNick, lowercasename))) {
+ if (DBWildcard && !mir_wstrcmpi(DBWildcard, lowercasename)
+ || (DBWildcard && !mir_wstrcmpi(DBNick, lowercasename) && !WCCmp(DBWildcard, lowercasename))
+ || (!DBWildcard && !mir_wstrcmpi(DBNick, lowercasename))) {
hContact_temp = hContact;
}
}
else if (wcschr(user->name, ' ') == 0) {
- if ((DBDefault && !mir_tstrcmpi(DBDefault, user->name) || DBNick && !mir_tstrcmpi(DBNick, user->name) ||
+ if ((DBDefault && !mir_wstrcmpi(DBDefault, user->name) || DBNick && !mir_wstrcmpi(DBNick, user->name) ||
DBWildcard && WCCmp(DBWildcard, lowercasename))
&& (WCCmp(DBUser, user->user) && WCCmp(DBHost, user->host))) {
hContact_temp = hContact;
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index 8a10cecca7..ab36e0d46e 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -71,9 +71,9 @@ VOID CALLBACK KeepAliveTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD) wchar_t temp2[270];
if (!ppro->m_info.sServerName.IsEmpty())
- mir_sntprintf(temp2, L"PING %s", ppro->m_info.sServerName.c_str());
+ mir_snwprintf(temp2, L"PING %s", ppro->m_info.sServerName.c_str());
else
- mir_sntprintf(temp2, L"PING %u", time(0));
+ mir_snwprintf(temp2, L"PING %u", time(0));
if (ppro->IsConnected())
ppro->SendIrcMessage(temp2, false);
@@ -261,7 +261,7 @@ void __cdecl CIrcProto::ResolveIPThread(LPVOID di) bool CIrcProto::OnIrc_PING(const CIrcMessage* pmsg)
{
wchar_t szResponse[100];
- mir_sntprintf(szResponse, L"PONG %s", pmsg->parameters[0].c_str());
+ mir_snwprintf(szResponse, L"PONG %s", pmsg->parameters[0].c_str());
SendIrcMessage(szResponse);
return false;
}
@@ -277,7 +277,7 @@ bool CIrcProto::OnIrc_WELCOME(const CIrcMessage* pmsg) CMString word = GetWord(pmsg->parameters[1].c_str(), i);
while (!word.IsEmpty()) {
if (wcschr(word.c_str(), '!') && wcschr(word.c_str(), '@')) {
- mir_tstrncpy(host, word.c_str(), _countof(host));
+ mir_wstrncpy(host, word.c_str(), _countof(host));
wchar_t* p1 = wcschr(host, '@');
if (p1)
ForkThread(&CIrcProto::ResolveIPThread, new IPRESOLVE(_T2A(p1 + 1), IP_AUTO));
@@ -497,7 +497,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg) if (strchr(sUserModes.c_str(), (char)*p1)) {
CMString sStatus = ModeToStatus(*p1);
if ((int)pmsg->parameters.getCount() > iParametercount) {
- if (!mir_tstrcmp(pmsg->parameters[2].c_str(), m_info.sNick.c_str())) {
+ if (!mir_wstrcmp(pmsg->parameters[2].c_str(), m_info.sNick.c_str())) {
char cModeBit = -1;
CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, pmsg->parameters[0].c_str(), NULL, NULL, NULL, NULL, NULL, false, false, 0);
switch (*p1) {
@@ -532,7 +532,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg) if (m_oldStyleModes) {
wchar_t temp[256];
- mir_sntprintf(temp, TranslateT("%s sets mode %s"),
+ mir_snwprintf(temp, TranslateT("%s sets mode %s"),
pmsg->prefix.sNick.c_str(), pmsg->parameters[1].c_str());
CMString sMessage = temp;
@@ -546,7 +546,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg) sParams += L" " + pmsg->parameters[i];
wchar_t temp[4000];
- mir_sntprintf(temp, TranslateT("%s sets mode %s%s"), pmsg->prefix.sNick.c_str(), sModes.c_str(), sParams.c_str());
+ mir_snwprintf(temp, TranslateT("%s sets mode %s%s"), pmsg->prefix.sNick.c_str(), sModes.c_str(), sParams.c_str());
DoEvent(GC_EVENT_INFORMATION, pmsg->parameters[0].c_str(), pmsg->prefix.sNick.c_str(), temp, NULL, NULL, NULL, true, false);
}
@@ -555,7 +555,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg) }
else {
wchar_t temp[256];
- mir_sntprintf(temp, TranslateT("%s sets mode %s"), pmsg->prefix.sNick.c_str(), pmsg->parameters[1].c_str());
+ mir_snwprintf(temp, TranslateT("%s sets mode %s"), pmsg->prefix.sNick.c_str(), pmsg->parameters[1].c_str());
CMString sMessage = temp;
for (int i = 2; i < (int)pmsg->parameters.getCount(); i++)
@@ -661,7 +661,7 @@ bool CIrcProto::OnIrc_INVITE(const CIrcMessage* pmsg) if (pmsg->m_bIncoming && (m_ignore && IsIgnored(pmsg->prefix.sNick, pmsg->prefix.sUser, pmsg->prefix.sHost, 'i')))
return true;
- if (pmsg->m_bIncoming && m_joinOnInvite && pmsg->parameters.getCount() > 1 && mir_tstrcmpi(pmsg->parameters[0].c_str(), m_info.sNick.c_str()) == 0)
+ if (pmsg->m_bIncoming && m_joinOnInvite && pmsg->parameters.getCount() > 1 && mir_wstrcmpi(pmsg->parameters[0].c_str(), m_info.sNick.c_str()) == 0)
PostIrcMessage(L"/JOIN %s", pmsg->parameters[1].c_str());
ShowMessage(pmsg);
@@ -672,7 +672,7 @@ bool CIrcProto::OnIrc_PINGPONG(const CIrcMessage* pmsg) {
if (pmsg->m_bIncoming && pmsg->sCommand == L"PING") {
wchar_t szResponse[100];
- mir_sntprintf(szResponse, L"PONG %s", pmsg->parameters[0].c_str());
+ mir_snwprintf(szResponse, L"PONG %s", pmsg->parameters[0].c_str());
SendIrcMessage(szResponse);
}
@@ -743,7 +743,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) // exploit???
if (mess.Find(1) != -1 || mess.Find(L"%newl") != -1) {
wchar_t temp[4096];
- mir_sntprintf(temp, TranslateT("CTCP ERROR: Malformed CTCP command received from %s!%s@%s. Possible attempt to take control of your IRC client registered"), pmsg->prefix.sNick.c_str(), pmsg->prefix.sUser.c_str(), pmsg->prefix.sHost.c_str());
+ mir_snwprintf(temp, TranslateT("CTCP ERROR: Malformed CTCP command received from %s!%s@%s. Possible attempt to take control of your IRC client registered"), pmsg->prefix.sNick.c_str(), pmsg->prefix.sUser.c_str(), pmsg->prefix.sHost.c_str());
DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), temp, NULL, NULL, NULL, true, false);
return true;
}
@@ -801,7 +801,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) PostIrcMessage(L"/NOTICE %s \001FINGER %s (%s)\001", pmsg->prefix.sNick.c_str(), m_name, m_userID);
wchar_t temp[300];
- mir_sntprintf(temp, TranslateT("CTCP FINGER requested by %s"), pmsg->prefix.sNick.c_str());
+ mir_snwprintf(temp, TranslateT("CTCP FINGER requested by %s"), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
}
@@ -810,7 +810,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) PostIrcMessage(L"/NOTICE %s \001VERSION Miranda NG %%mirver (IRC v.%%version)" L", " _A2W(__COPYRIGHT) L"\001", pmsg->prefix.sNick.c_str());
wchar_t temp[300];
- mir_sntprintf(temp, TranslateT("CTCP VERSION requested by %s"), pmsg->prefix.sNick.c_str());
+ mir_snwprintf(temp, TranslateT("CTCP VERSION requested by %s"), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
}
@@ -819,7 +819,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) PostIrcMessage(L"/NOTICE %s \001SOURCE Get Miranda IRC here: http://miranda-ng.org/ \001", pmsg->prefix.sNick.c_str());
wchar_t temp[300];
- mir_sntprintf(temp, TranslateT("CTCP SOURCE requested by %s"), pmsg->prefix.sNick.c_str());
+ mir_snwprintf(temp, TranslateT("CTCP SOURCE requested by %s"), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
}
@@ -828,7 +828,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) PostIrcMessage(L"/NOTICE %s \001USERINFO %s\001", pmsg->prefix.sNick.c_str(), m_userInfo);
wchar_t temp[300];
- mir_sntprintf(temp, TranslateT("CTCP USERINFO requested by %s"), pmsg->prefix.sNick.c_str());
+ mir_snwprintf(temp, TranslateT("CTCP USERINFO requested by %s"), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
}
@@ -837,7 +837,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) PostIrcMessage(L"/NOTICE %s \001%s\001", pmsg->prefix.sNick.c_str(), mess.c_str());
wchar_t temp[300];
- mir_sntprintf(temp, TranslateT("CTCP PING requested by %s"), pmsg->prefix.sNick.c_str());
+ mir_snwprintf(temp, TranslateT("CTCP PING requested by %s"), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
}
@@ -845,10 +845,10 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) else if (pmsg->m_bIncoming && command == L"time") {
wchar_t temp[300];
time_t tim = time(NULL);
- mir_tstrncpy(temp, _wctime(&tim), 25);
+ mir_wstrncpy(temp, _wctime(&tim), 25);
PostIrcMessage(L"/NOTICE %s \001TIME %s\001", pmsg->prefix.sNick.c_str(), temp);
- mir_sntprintf(temp, TranslateT("CTCP TIME requested by %s"), pmsg->prefix.sNick.c_str());
+ mir_snwprintf(temp, TranslateT("CTCP TIME requested by %s"), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
}
@@ -1016,16 +1016,16 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) ulAdr = ConvertIPToInteger(m_IPFromServer ? m_myHost : m_myLocalHost);
if (bIsChat && !m_DCCChatEnabled)
- mir_sntprintf(szTemp, TranslateT("DCC: Chat request from %s denied"), pmsg->prefix.sNick.c_str());
+ mir_snwprintf(szTemp, TranslateT("DCC: Chat request from %s denied"), pmsg->prefix.sNick.c_str());
else if (type == L"send" && !m_DCCFileEnabled)
- mir_sntprintf(szTemp, TranslateT("DCC: File transfer request from %s denied"), pmsg->prefix.sNick.c_str());
+ mir_snwprintf(szTemp, TranslateT("DCC: File transfer request from %s denied"), pmsg->prefix.sNick.c_str());
else if (type == L"send" && !iPort && ulAdr == 0)
- mir_sntprintf(szTemp, TranslateT("DCC: Reverse file transfer request from %s denied [No local IP]"), pmsg->prefix.sNick.c_str());
+ mir_snwprintf(szTemp, TranslateT("DCC: Reverse file transfer request from %s denied [No local IP]"), pmsg->prefix.sNick.c_str());
if (sFile.IsEmpty() || dwAdr == 0 || dwSize == 0 || iPort == 0 && sToken.IsEmpty())
- mir_sntprintf(szTemp, TranslateT("DCC ERROR: Malformed CTCP request from %s [%s]"), pmsg->prefix.sNick.c_str(), mess.c_str());
+ mir_snwprintf(szTemp, TranslateT("DCC ERROR: Malformed CTCP request from %s [%s]"), pmsg->prefix.sNick.c_str(), mess.c_str());
if (szTemp[0]) {
DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
@@ -1044,10 +1044,10 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) szTemp[0] = '\0';
if (type == L"resume" && !m_DCCFileEnabled)
- mir_sntprintf(szTemp, TranslateT("DCC: File transfer resume request from %s denied"), pmsg->prefix.sNick.c_str());
+ mir_snwprintf(szTemp, TranslateT("DCC: File transfer resume request from %s denied"), pmsg->prefix.sNick.c_str());
if (sToken.IsEmpty() && iPort == 0 || sFile.IsEmpty())
- mir_sntprintf(szTemp, TranslateT("DCC ERROR: Malformed CTCP request from %s [%s]"), pmsg->prefix.sNick.c_str(), mess.c_str());
+ mir_snwprintf(szTemp, TranslateT("DCC ERROR: Malformed CTCP request from %s [%s]"), pmsg->prefix.sNick.c_str(), mess.c_str());
if (szTemp[0]) {
DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
@@ -1079,7 +1079,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) }
else {
wchar_t szTemp[512];
- mir_sntprintf(szTemp, TranslateT("DCC: Chat request from %s denied"), pmsg->prefix.sNick.c_str());
+ mir_snwprintf(szTemp, TranslateT("DCC: Chat request from %s denied"), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
}
}
@@ -1176,7 +1176,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) }
else if (pmsg->m_bIncoming) {
wchar_t temp[300];
- mir_sntprintf(temp, TranslateT("CTCP %s requested by %s"), ocommand.c_str(), pmsg->prefix.sNick.c_str());
+ mir_snwprintf(temp, TranslateT("CTCP %s requested by %s"), ocommand.c_str(), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
}
}
@@ -1197,7 +1197,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) // if the whois window is visible and the ctcp reply belongs to the user in it, then show the reply in the whois window
if (m_whoisDlg && IsWindowVisible(m_whoisDlg->GetHwnd())) {
m_whoisDlg->m_InfoNick.GetText(szTemp, _countof(szTemp));
- if (mir_tstrcmpi(szTemp, pmsg->prefix.sNick.c_str()) == 0) {
+ if (mir_wstrcmpi(szTemp, pmsg->prefix.sNick.c_str()) == 0) {
if (pmsg->m_bIncoming && (command == L"version" || command == L"userinfo" || command == L"time")) {
SetActiveWindow(m_whoisDlg->GetHwnd());
m_whoisDlg->m_Reply.SetText(DoColorCodes(GetWordAddress(mess.c_str(), 1), TRUE, FALSE));
@@ -1208,9 +1208,9 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) int s = (int)time(0) - (int)_wtol(GetWordAddress(mess.c_str(), 1));
wchar_t szTmp[30];
if (s == 1)
- mir_sntprintf(szTmp, TranslateT("%u second"), s);
+ mir_snwprintf(szTmp, TranslateT("%u second"), s);
else
- mir_sntprintf(szTmp, TranslateT("%u seconds"), s);
+ mir_snwprintf(szTmp, TranslateT("%u seconds"), s);
m_whoisDlg->m_Reply.SetText(DoColorCodes(szTmp, TRUE, FALSE));
return true;
@@ -1221,11 +1221,11 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) //... else show the reply in the current window
if (pmsg->m_bIncoming && command == L"ping") {
int s = (int)time(0) - (int)_wtol(GetWordAddress(mess.c_str(), 1));
- mir_sntprintf(szTemp, TranslateT("CTCP PING reply from %s: %u sec(s)"), pmsg->prefix.sNick.c_str(), s);
+ mir_snwprintf(szTemp, TranslateT("CTCP PING reply from %s: %u sec(s)"), pmsg->prefix.sNick.c_str(), s);
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, szTemp, NULL, NULL, NULL, true, false);
}
else {
- mir_sntprintf(szTemp, TranslateT("CTCP %s reply from %s: %s"), ocommand.c_str(), pmsg->prefix.sNick.c_str(), GetWordAddress(mess.c_str(), 1));
+ mir_snwprintf(szTemp, TranslateT("CTCP %s reply from %s: %s"), ocommand.c_str(), pmsg->prefix.sNick.c_str(), GetWordAddress(mess.c_str(), 1));
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, szTemp, NULL, NULL, NULL, true, false);
}
}
@@ -1257,7 +1257,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) while (wcschr(sUserModePrefixes.c_str(), name[index]))
index++;
- if (!mir_tstrcmpi(name.Mid(index).c_str(), m_info.sNick.c_str())) {
+ if (!mir_wstrcmpi(name.Mid(index).c_str(), m_info.sNick.c_str())) {
bFlag = true;
break;
}
@@ -1316,7 +1316,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) gce.ptszUID = sTemp.c_str();
gce.ptszNick = sTemp.c_str();
gce.ptszStatus = sStat.c_str();
- BOOL bIsMe = (!mir_tstrcmpi(gce.ptszNick, m_info.sNick.c_str())) ? TRUE : FALSE;
+ BOOL bIsMe = (!mir_wstrcmpi(gce.ptszNick, m_info.sNick.c_str())) ? TRUE : FALSE;
if (bIsMe) {
char BitNr = -1;
switch (sTemp2[0]) {
@@ -1364,7 +1364,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) wi->codepage = getCodepage();
DoEvent(GC_EVENT_SETITEMDATA, sChanName, NULL, NULL, NULL, NULL, (DWORD_PTR)wi, false, false, 0);
- if (!sTopic.IsEmpty() && !mir_tstrcmpi(GetWord(sTopic.c_str(), 0).c_str(), sChanName)) {
+ if (!sTopic.IsEmpty() && !mir_wstrcmpi(GetWord(sTopic.c_str(), 0).c_str(), sChanName)) {
DoEvent(GC_EVENT_TOPIC, sChanName, sTopicName.IsEmpty() ? NULL : sTopicName.c_str(), GetWordAddress(sTopic.c_str(), 1), NULL, sTopicTime.IsEmpty() ? NULL : sTopicTime.c_str(), NULL, true, false);
AddWindowItemData(sChanName, 0, 0, 0, GetWordAddress(sTopic.c_str(), 1));
sTopic = L"";
@@ -1396,7 +1396,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) k++;
if (!command.IsEmpty()) {
CMString S = command.Mid(1);
- if (!mir_tstrcmpi(sChanName, S))
+ if (!mir_wstrcmpi(sChanName, S))
break;
save += command + L" ";
@@ -1514,13 +1514,13 @@ bool CIrcProto::OnIrc_LIST(const CIrcMessage* pmsg) lvItem.pszText = (wchar_t*)pmsg->parameters[pmsg->parameters.getCount() - 2].c_str();
ListView_SetItem(hListView, &lvItem);
- wchar_t* temp = mir_tstrdup(pmsg->parameters[pmsg->parameters.getCount() - 1]);
+ wchar_t* temp = mir_wstrdup(pmsg->parameters[pmsg->parameters.getCount() - 1]);
wchar_t* find = wcsstr(temp, L"[+");
wchar_t* find2 = wcsstr(temp, L"]");
wchar_t* save = temp;
if (find == temp && find2 != NULL && find + 8 >= find2) {
temp = wcsstr(temp, L"]");
- if (mir_tstrlen(temp) > 1) {
+ if (mir_wstrlen(temp) > 1) {
temp++;
temp[0] = '\0';
lvItem.iSubItem = 2;
@@ -1545,9 +1545,9 @@ bool CIrcProto::OnIrc_LIST(const CIrcMessage* pmsg) wchar_t text[100];
if (percent < 100)
- mir_sntprintf(text, TranslateT("Downloading list (%u%%) - %u channels"), percent, m_channelNumber);
+ mir_snwprintf(text, TranslateT("Downloading list (%u%%) - %u channels"), percent, m_channelNumber);
else
- mir_sntprintf(text, TranslateT("Downloading list - %u channels"), m_channelNumber);
+ mir_snwprintf(text, TranslateT("Downloading list - %u channels"), m_channelNumber);
m_listDlg->m_status.SetText(text);
}
@@ -1565,13 +1565,13 @@ bool CIrcProto::OnIrc_LISTEND(const CIrcMessage* pmsg) m_listDlg->UpdateList();
wchar_t text[100];
- mir_sntprintf(text, TranslateT("Done: %u channels"), m_channelNumber);
+ mir_snwprintf(text, TranslateT("Done: %u channels"), m_channelNumber);
int percent = 100;
if (m_noOfChannels > 0)
percent = (int)(m_channelNumber * 100) / m_noOfChannels;
if (percent < 70) {
- mir_tstrcat(text, L" ");
- mir_tstrcat(text, TranslateT("(probably truncated by server)"));
+ mir_wstrcat(text, L" ");
+ mir_wstrcat(text, TranslateT("(probably truncated by server)"));
}
SetDlgItemText(m_listDlg->GetHwnd(), IDC_TEXT, text);
}
@@ -1678,8 +1678,8 @@ bool CIrcProto::OnIrc_WHOIS_OTHER(const CIrcMessage* pmsg) if (pmsg->m_bIncoming && m_whoisDlg && pmsg->parameters.getCount() > 2 && m_manualWhoisCount > 0) {
wchar_t temp[1024], temp2[1024];
m_whoisDlg->m_InfoOther.GetText(temp, 1000);
- mir_tstrcat(temp, L"%s\r\n");
- mir_sntprintf(temp2, temp, pmsg->parameters[2].c_str());
+ mir_wstrcat(temp, L"%s\r\n");
+ mir_snwprintf(temp2, temp, pmsg->parameters[2].c_str());
m_whoisDlg->m_InfoOther.SetText(temp2);
}
ShowMessage(pmsg);
@@ -1715,13 +1715,13 @@ bool CIrcProto::OnIrc_WHOIS_IDLE(const CIrcMessage* pmsg) wchar_t temp[100];
if (D)
- mir_sntprintf(temp, TranslateT("%ud, %uh, %um, %us"), D, H, M, S);
+ mir_snwprintf(temp, TranslateT("%ud, %uh, %um, %us"), D, H, M, S);
else if (H)
- mir_sntprintf(temp, TranslateT("%uh, %um, %us"), H, M, S);
+ mir_snwprintf(temp, TranslateT("%uh, %um, %us"), H, M, S);
else if (M)
- mir_sntprintf(temp, TranslateT("%um, %us"), M, S);
+ mir_snwprintf(temp, TranslateT("%um, %us"), M, S);
else if (S)
- mir_sntprintf(temp, TranslateT("%us"), S);
+ mir_snwprintf(temp, TranslateT("%us"), S);
else
temp[0] = 0;
@@ -1729,7 +1729,7 @@ bool CIrcProto::OnIrc_WHOIS_IDLE(const CIrcMessage* pmsg) wchar_t tTimeBuf[128], *tStopStr;
time_t ttTime = wcstol(pmsg->parameters[3].c_str(), &tStopStr, 10);
wcsftime(tTimeBuf, 128, L"%c", localtime(&ttTime));
- mir_sntprintf(temp3, TranslateT("online since %s, idle %s"), tTimeBuf, temp);
+ mir_snwprintf(temp3, TranslateT("online since %s, idle %s"), tTimeBuf, temp);
m_whoisDlg->m_AwayTime.SetText(temp3);
}
ShowMessage(pmsg);
@@ -1813,9 +1813,9 @@ static void __stdcall sttShowNickWnd(void* param) bool CIrcProto::OnIrc_NICK_ERR(const CIrcMessage* pmsg)
{
if (pmsg->m_bIncoming) {
- if (nickflag && ((m_alternativeNick[0] != 0)) && (pmsg->parameters.getCount() > 2 && mir_tstrcmp(pmsg->parameters[1].c_str(), m_alternativeNick))) {
+ if (nickflag && ((m_alternativeNick[0] != 0)) && (pmsg->parameters.getCount() > 2 && mir_wstrcmp(pmsg->parameters[1].c_str(), m_alternativeNick))) {
wchar_t m[200];
- mir_sntprintf(m, L"NICK %s", m_alternativeNick);
+ mir_snwprintf(m, L"NICK %s", m_alternativeNick);
if (IsConnected())
SendIrcMessage(m);
}
@@ -1943,20 +1943,20 @@ bool CIrcProto::OnIrc_WHO_END(const CIrcMessage* pmsg) }
/// if it is not a channel
- ptrT UserList(mir_tstrdup(m_whoReply.c_str()));
+ ptrW UserList(mir_wstrdup(m_whoReply.c_str()));
const wchar_t* p1 = UserList;
m_whoReply = L"";
CONTACT ccUser = { (wchar_t*)pmsg->parameters[1].c_str(), NULL, NULL, false, true, false };
MCONTACT hContact = CList_FindContact(&ccUser);
if (hContact && getByte(hContact, "AdvancedMode", 0) == 1) {
- ptrT DBHost(getTStringA(hContact, "UHost"));
- ptrT DBNick(getTStringA(hContact, "Nick"));
- ptrT DBUser(getTStringA(hContact, "UUser"));
- ptrT DBDefault(getTStringA(hContact, "Default"));
- ptrT DBManUser(getTStringA(hContact, "User"));
- ptrT DBManHost(getTStringA(hContact, "Host"));
- ptrT DBWildcard(getTStringA(hContact, "UWildcard"));
+ ptrW DBHost(getTStringA(hContact, "UHost"));
+ ptrW DBNick(getTStringA(hContact, "Nick"));
+ ptrW DBUser(getTStringA(hContact, "UUser"));
+ ptrW DBDefault(getTStringA(hContact, "Default"));
+ ptrW DBManUser(getTStringA(hContact, "User"));
+ ptrW DBManHost(getTStringA(hContact, "Host"));
+ ptrW DBWildcard(getTStringA(hContact, "UWildcard"));
if (DBWildcard)
CharLower(DBWildcard);
@@ -1969,18 +1969,18 @@ bool CIrcProto::OnIrc_WHO_END(const CIrcMessage* pmsg) nick = GetWord(p1, 0);
user = GetWord(p1, 1);
host = GetWord(p1, 2);
- if ((DBWildcard && WCCmp(DBWildcard, nick.c_str()) || DBNick && !mir_tstrcmpi(DBNick, nick.c_str()) || DBDefault && !mir_tstrcmpi(DBDefault, nick.c_str()))
+ if ((DBWildcard && WCCmp(DBWildcard, nick.c_str()) || DBNick && !mir_wstrcmpi(DBNick, nick.c_str()) || DBDefault && !mir_wstrcmpi(DBDefault, nick.c_str()))
&& (WCCmp(DBUser, user.c_str()) && WCCmp(DBHost, host.c_str()))) {
if (away[0] == 'G' && getWord(hContact, "Status", ID_STATUS_OFFLINE) != ID_STATUS_AWAY)
setWord(hContact, "Status", ID_STATUS_AWAY);
else if (away[0] == 'H' && getWord(hContact, "Status", ID_STATUS_OFFLINE) != ID_STATUS_ONLINE)
setWord(hContact, "Status", ID_STATUS_ONLINE);
- if ((DBNick && mir_tstrcmpi(nick.c_str(), DBNick)) || !DBNick)
+ if ((DBNick && mir_wstrcmpi(nick.c_str(), DBNick)) || !DBNick)
setTString(hContact, "Nick", nick.c_str());
- if ((DBManUser && mir_tstrcmpi(user.c_str(), DBManUser)) || !DBManUser)
+ if ((DBManUser && mir_wstrcmpi(user.c_str(), DBManUser)) || !DBManUser)
setTString(hContact, "User", user.c_str());
- if ((DBManHost && mir_tstrcmpi(host.c_str(), DBManHost)) || !DBManHost)
+ if ((DBManHost && mir_wstrcmpi(host.c_str(), DBManHost)) || !DBManHost)
setTString(hContact, "Host", host.c_str());
return true;
}
@@ -2016,9 +2016,9 @@ bool CIrcProto::OnIrc_WHO_REPLY(const CIrcMessage* pmsg) CMString command = PeekAtReasons(2);
if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 6 && command[0] == 'S') {
m_whoReply.AppendFormat(L"%s %s %s %s ", pmsg->parameters[5].c_str(), pmsg->parameters[2].c_str(), pmsg->parameters[3].c_str(), pmsg->parameters[6].c_str());
- if (mir_tstrcmpi(pmsg->parameters[5].c_str(), m_info.sNick.c_str()) == 0) {
+ if (mir_wstrcmpi(pmsg->parameters[5].c_str(), m_info.sNick.c_str()) == 0) {
wchar_t host[1024];
- mir_tstrncpy(host, pmsg->parameters[3].c_str(), 1024);
+ mir_wstrncpy(host, pmsg->parameters[3].c_str(), 1024);
ForkThread(&CIrcProto::ResolveIPThread, new IPRESOLVE(_T2A(host), IP_AUTO));
}
}
@@ -2076,7 +2076,7 @@ bool CIrcProto::OnIrc_USERHOST_REPLY(const CIrcMessage* pmsg) if (sTemp.IsEmpty())
break;
- wchar_t *p1 = mir_tstrdup(sTemp.c_str());
+ wchar_t *p1 = mir_wstrdup(sTemp.c_str());
// Pull out host, user and nick
wchar_t *p2 = wcschr(p1, '@');
@@ -2119,7 +2119,7 @@ bool CIrcProto::OnIrc_USERHOST_REPLY(const CIrcMessage* pmsg) // If user found, remove from checklist
for (int i = 0; i < checklist.getCount(); i++)
- if (!mir_tstrcmpi(checklist[i].c_str(), nick.c_str()))
+ if (!mir_wstrcmpi(checklist[i].c_str(), nick.c_str()))
checklist.remove(i);
}
}
@@ -2203,17 +2203,17 @@ bool CIrcProto::OnIrc_SUPPORT(const CIrcMessage* pmsg) if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 0) {
CMString S;
for (int i = 0; i < pmsg->parameters.getCount(); i++) {
- wchar_t* temp = mir_tstrdup(pmsg->parameters[i].c_str());
+ wchar_t* temp = mir_wstrdup(pmsg->parameters[i].c_str());
if (wcsstr(temp, L"CHANTYPES=")) {
wchar_t* p1 = wcschr(temp, '=');
p1++;
- if (mir_tstrlen(p1) > 0)
+ if (mir_wstrlen(p1) > 0)
sChannelPrefixes = p1;
}
if (wcsstr(temp, L"CHANMODES=")) {
wchar_t* p1 = wcschr(temp, '=');
p1++;
- if (mir_tstrlen(p1) > 0)
+ if (mir_wstrlen(p1) > 0)
sChannelModes = (char*)_T2A(p1);
}
if (wcsstr(temp, L"PREFIX=")) {
@@ -2414,12 +2414,12 @@ int CIrcProto::IsIgnored(CMString user, char type) for (int i = 0; i < m_ignoreItems.getCount(); i++) {
const CIrcIgnoreItem& C = m_ignoreItems[i];
- if (type == 0 && !mir_tstrcmpi(user.c_str(), C.mask.c_str()))
+ if (type == 0 && !mir_wstrcmpi(user.c_str(), C.mask.c_str()))
return i + 1;
bool bUserContainsWild = (wcschr(user.c_str(), '*') != NULL || wcschr(user.c_str(), '?') != NULL);
if (!bUserContainsWild && WCCmp(C.mask.c_str(), user.c_str()) ||
- bUserContainsWild && !mir_tstrcmpi(user.c_str(), C.mask.c_str())) {
+ bUserContainsWild && !mir_wstrcmpi(user.c_str(), C.mask.c_str())) {
if (C.flags.IsEmpty() || C.flags[0] != '+')
continue;
@@ -2429,7 +2429,7 @@ int CIrcProto::IsIgnored(CMString user, char type) if (C.network.IsEmpty())
return i + 1;
- if (IsConnected() && !mir_tstrcmpi(C.network.c_str(), m_info.sNetwork.c_str()))
+ if (IsConnected() && !mir_wstrcmpi(C.network.c_str(), m_info.sNetwork.c_str()))
return i + 1;
}
}
diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp index aef90b870e..c8deea034a 100644 --- a/protocols/IRCG/src/input.cpp +++ b/protocols/IRCG/src/input.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void CIrcProto::FormatMsg(CMString& text)
{
wchar_t temp[30];
- mir_tstrncpy(temp, GetWord(text.c_str(), 0).c_str(), 29);
+ mir_wstrncpy(temp, GetWord(text.c_str(), 0).c_str(), 29);
CharLower(temp);
CMString command = temp;
CMString S = L"";
@@ -89,16 +89,16 @@ CMString CIrcProto::DoAlias(const wchar_t *text, wchar_t *window) Messageout += L"\r\n";
wchar_t* line = new wchar_t[p2 - p1 + 1];
- mir_tstrncpy(line, p1, p2 - p1 + 1);
+ mir_wstrncpy(line, p1, p2 - p1 + 1);
wchar_t* test = line;
while (*test == ' ')
test++;
if (*test == '/') {
- mir_tstrncpy(line, GetWordAddress(line, 0), p2 - p1 + 1);
+ mir_wstrncpy(line, GetWordAddress(line, 0), p2 - p1 + 1);
CMString S = line;
delete[] line;
line = new wchar_t[S.GetLength() + 2];
- mir_tstrncpy(line, S.c_str(), S.GetLength() + 1);
+ mir_wstrncpy(line, S.c_str(), S.GetLength() + 1);
CMString alias(m_alias);
const wchar_t* p3 = wcsstr(alias.c_str(), (GetWord(line, 0) + L" ").c_str());
if (p3 != alias.c_str()) {
@@ -121,7 +121,7 @@ CMString CIrcProto::DoAlias(const wchar_t *text, wchar_t *window) wchar_t buf[5];
for (int index = 1; index < 8; index++) {
- mir_sntprintf(buf, L"#$%u", index);
+ mir_snwprintf(buf, L"#$%u", index);
if (!GetWord(line, index).IsEmpty() && IsChannel(GetWord(line, index)))
str.Replace(buf, GetWord(line, index).c_str());
else {
@@ -131,11 +131,11 @@ CMString CIrcProto::DoAlias(const wchar_t *text, wchar_t *window) }
}
for (int index2 = 1; index2 < 8; index2++) {
- mir_sntprintf(buf, L"$%u-", index2);
+ mir_snwprintf(buf, L"$%u-", index2);
str.Replace(buf, GetWordAddress(line, index2));
}
for (int index3 = 1; index3 < 8; index3++) {
- mir_sntprintf(buf, L"$%u", index3);
+ mir_snwprintf(buf, L"$%u", index3);
str.Replace(buf, GetWord(line, index3).c_str());
}
Messageout += GetWordAddress(str.c_str(), 1);
@@ -245,7 +245,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon else
S = MakeWndID(one.c_str());
}
- else if (mir_tstrcmpi(window, SERVERWINDOW) == 0)
+ else if (mir_wstrcmpi(window, SERVERWINDOW) == 0)
S = window;
else
S = MakeWndID(window);
@@ -267,12 +267,12 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("Ignore system is disabled"), NULL, NULL, NULL, true, false);
return true;
}
- if (!mir_tstrcmpi(one.c_str(), L"on")) {
+ if (!mir_wstrcmpi(one.c_str(), L"on")) {
m_ignore = 1;
DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("Ignore system is enabled"), NULL, NULL, NULL, true, false);
return true;
}
- if (!mir_tstrcmpi(one.c_str(), L"off")) {
+ if (!mir_wstrcmpi(one.c_str(), L"off")) {
m_ignore = 0;
DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("Ignore system is disabled"), NULL, NULL, NULL, true, false);
return true;
@@ -304,7 +304,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon AddIgnore(one.c_str(), IgnoreFlags.c_str(), szNetwork.c_str());
- mir_sntprintf(temp, TranslateT("%s on %s is now ignored (+%s)"), one.c_str(), szNetwork.c_str(), IgnoreFlags.c_str());
+ mir_snwprintf(temp, TranslateT("%s on %s is now ignored (+%s)"), one.c_str(), szNetwork.c_str(), IgnoreFlags.c_str());
DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), temp, NULL, NULL, NULL, true, false);
}
return true;
@@ -316,9 +316,9 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon wchar_t temp[500];
if (RemoveIgnore(one.c_str()))
- mir_sntprintf(temp, TranslateT("%s is not ignored now"), one.c_str());
+ mir_snwprintf(temp, TranslateT("%s is not ignored now"), one.c_str());
else
- mir_sntprintf(temp, TranslateT("%s was not ignored"), one.c_str());
+ mir_snwprintf(temp, TranslateT("%s was not ignored"), one.c_str());
DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), temp, NULL, NULL, NULL, true, false);
return true;
}
@@ -369,7 +369,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon gci.pszModule = m_szModuleName;
gci.pszID = S.c_str();
if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci))
- mir_sntprintf(szTemp, L"users: %u", gci.iCount);
+ mir_snwprintf(szTemp, L"users: %u", gci.iCount);
DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
return true;
@@ -379,12 +379,12 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon if (one.IsEmpty())
return true;
- if (!mir_tstrcmpi(one.c_str(), L"on")) {
+ if (!mir_wstrcmpi(one.c_str(), L"on")) {
bEcho = TRUE;
DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("Outgoing commands are shown"), NULL, NULL, NULL, true, false);
}
- if (!mir_tstrcmpi(one.c_str(), L"off")) {
+ if (!mir_wstrcmpi(one.c_str(), L"off")) {
DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("Outgoing commands are not shown"), NULL, NULL, NULL, true, false);
bEcho = FALSE;
}
@@ -400,17 +400,17 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("The buddy check function is disabled"), NULL, NULL, NULL, true, false);
return true;
}
- if (!mir_tstrcmpi(one.c_str(), L"on")) {
+ if (!mir_wstrcmpi(one.c_str(), L"on")) {
bTempForceCheck = true;
bTempDisableCheck = false;
CallFunctionAsync(sttSetTimerOn, this);
}
- if (!mir_tstrcmpi(one.c_str(), L"off")) {
+ if (!mir_wstrcmpi(one.c_str(), L"off")) {
bTempForceCheck = false;
bTempDisableCheck = true;
CallFunctionAsync(sttSetTimerOff, this);
}
- if (!mir_tstrcmpi(one.c_str(), L"time") && !two.IsEmpty()) {
+ if (!mir_wstrcmpi(one.c_str(), L"time") && !two.IsEmpty()) {
m_iTempCheckTime = _wtoi(two.c_str());
if (m_iTempCheckTime < 10 && m_iTempCheckTime != 0)
m_iTempCheckTime = 10;
@@ -419,7 +419,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("The time interval for the buddy check function is now at default setting"), NULL, NULL, NULL, true, false);
else {
wchar_t temp[200];
- mir_sntprintf(temp, TranslateT("The time interval for the buddy check function is now %u seconds"), m_iTempCheckTime);
+ mir_snwprintf(temp, TranslateT("The time interval for the buddy check function is now %u seconds"), m_iTempCheckTime);
DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), temp, NULL, NULL, NULL, true, false);
}
}
@@ -507,7 +507,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon return true;
wchar_t szTemp[4000];
- mir_sntprintf(szTemp, L"\001ACTION %s\001", GetWordAddress(text.c_str(), 1));
+ mir_snwprintf(szTemp, L"\001ACTION %s\001", GetWordAddress(text.c_str(), 1));
PostIrcMessageWnd(window, hContact, szTemp);
return true;
}
@@ -537,7 +537,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon return true;
wchar_t szTemp[4000];
- mir_sntprintf(szTemp, L"/PRIVMSG %s", GetWordAddress(text.c_str(), 1));
+ mir_snwprintf(szTemp, L"/PRIVMSG %s", GetWordAddress(text.c_str(), 1));
PostIrcMessageWnd(window, hContact, szTemp);
return true;
@@ -572,7 +572,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon if (!two.IsEmpty()) {
wchar_t szTemp[4000];
- mir_sntprintf(szTemp, L"/PRIVMSG %s", GetWordAddress(text.c_str(), 1));
+ mir_snwprintf(szTemp, L"/PRIVMSG %s", GetWordAddress(text.c_str(), 1));
PostIrcMessageWnd(window, hContact, szTemp);
}
return true;
@@ -590,16 +590,16 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon ulAdr = ConvertIPToInteger(m_IPFromServer ? m_myHost : m_myLocalHost);
// if it is not dcc or if it is dcc and a local ip exist
- if (mir_tstrcmpi(two.c_str(), L"dcc") != 0 || ulAdr) {
- if (mir_tstrcmpi(two.c_str(), L"ping") == 0)
- mir_sntprintf(szTemp, L"/PRIVMSG %s \001%s %u\001", one.c_str(), two.c_str(), time(0));
+ if (mir_wstrcmpi(two.c_str(), L"dcc") != 0 || ulAdr) {
+ if (mir_wstrcmpi(two.c_str(), L"ping") == 0)
+ mir_snwprintf(szTemp, L"/PRIVMSG %s \001%s %u\001", one.c_str(), two.c_str(), time(0));
else
- mir_sntprintf(szTemp, L"/PRIVMSG %s \001%s\001", one.c_str(), GetWordAddress(text.c_str(), 2));
+ mir_snwprintf(szTemp, L"/PRIVMSG %s \001%s\001", one.c_str(), GetWordAddress(text.c_str(), 2));
PostIrcMessageWnd(window, hContact, szTemp);
}
- if (mir_tstrcmpi(two.c_str(), L"dcc") != 0) {
- mir_sntprintf(szTemp, TranslateT("CTCP %s request sent to %s"), two.c_str(), one.c_str());
+ if (mir_wstrcmpi(two.c_str(), L"dcc") != 0) {
+ mir_snwprintf(szTemp, TranslateT("CTCP %s request sent to %s"), two.c_str(), one.c_str());
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
}
@@ -610,7 +610,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon if (one.IsEmpty() || two.IsEmpty())
return true;
- if (mir_tstrcmpi(one.c_str(), L"send") == 0) {
+ if (mir_wstrcmpi(one.c_str(), L"send") == 0) {
wchar_t szTemp[1000];
unsigned long ulAdr = 0;
@@ -654,13 +654,13 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon }
}
else {
- mir_sntprintf(szTemp, TranslateT("DCC ERROR: Unable to automatically resolve external IP"));
+ mir_snwprintf(szTemp, TranslateT("DCC ERROR: Unable to automatically resolve external IP"));
DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
}
return true;
}
- if (mir_tstrcmpi(one.c_str(), L"chat") == 0) {
+ if (mir_wstrcmpi(one.c_str(), L"chat") == 0) {
wchar_t szTemp[1000];
unsigned long ulAdr = 0;
@@ -693,16 +693,16 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon if (iPort != 0) {
PostIrcMessage(L"/CTCP %s DCC CHAT chat %u %u", two.c_str(), ulAdr, iPort);
- mir_sntprintf(szTemp, TranslateT("DCC CHAT request sent to %s"), two.c_str(), one.c_str());
+ mir_snwprintf(szTemp, TranslateT("DCC CHAT request sent to %s"), two.c_str(), one.c_str());
DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
}
else {
- mir_sntprintf(szTemp, TranslateT("DCC ERROR: Unable to bind port"));
+ mir_snwprintf(szTemp, TranslateT("DCC ERROR: Unable to bind port"));
DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
}
}
else {
- mir_sntprintf(szTemp, TranslateT("DCC ERROR: Unable to automatically resolve external IP"));
+ mir_snwprintf(szTemp, TranslateT("DCC ERROR: Unable to automatically resolve external IP"));
DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
}
}
@@ -717,7 +717,7 @@ struct DoInputRequestParam {
DoInputRequestParam(CIrcProto* _pro, const wchar_t* _str) :
ppro(_pro),
- str(mir_tstrdup(_str))
+ str(mir_wstrdup(_str))
{}
CIrcProto *ppro;
@@ -786,13 +786,13 @@ static void __stdcall DoInputRequestAliasApcStub(void* _par) bool CIrcProto::PostIrcMessage(const wchar_t* fmt, ...)
{
- if (!fmt || mir_tstrlen(fmt) < 1 || mir_tstrlen(fmt) > 4000)
+ if (!fmt || mir_wstrlen(fmt) < 1 || mir_wstrlen(fmt) > 4000)
return 0;
va_list marker;
va_start(marker, fmt);
static wchar_t szBuf[4 * 1024];
- mir_vsntprintf(szBuf, _countof(szBuf), fmt, marker);
+ mir_vsnwprintf(szBuf, _countof(szBuf), fmt, marker);
va_end(marker);
return PostIrcMessageWnd(NULL, NULL, szBuf);
@@ -807,19 +807,19 @@ bool CIrcProto::PostIrcMessageWnd(wchar_t *window, MCONTACT hContact, const wcha if (hContact)
bDCC = getByte(hContact, "DCC", 0);
- if (!IsConnected() && !bDCC || !szBuf || mir_tstrlen(szBuf) < 1)
+ if (!IsConnected() && !bDCC || !szBuf || mir_wstrlen(szBuf) < 1)
return 0;
if (hContact && !getTString(hContact, "Nick", &dbv)) {
- mir_tstrncpy(windowname, dbv.ptszVal, 255);
+ mir_wstrncpy(windowname, dbv.ptszVal, 255);
db_free(&dbv);
}
else if (window)
- mir_tstrncpy(windowname, window, 255);
+ mir_wstrncpy(windowname, window, 255);
else
- mir_tstrncpy(windowname, SERVERWINDOW, 255);
+ mir_wstrncpy(windowname, SERVERWINDOW, 255);
- if (mir_tstrcmpi(window, SERVERWINDOW) != 0) {
+ if (mir_wstrcmpi(window, SERVERWINDOW) != 0) {
wchar_t* p1 = wcschr(windowname, ' ');
if (p1)
*p1 = '\0';
@@ -878,7 +878,7 @@ bool CIrcProto::PostIrcMessageWnd(wchar_t *window, MCONTACT hContact, const wcha ((GetWord(DoThis.c_str(), 0)[0] == '/') && (GetWord(DoThis.c_str(), 0)[1] == '/')) || // or double backslash at the beginning
hContact) {
CMString S = L"/PRIVMSG ";
- if (mir_tstrcmpi(window, SERVERWINDOW) == 0 && !m_info.sServerName.IsEmpty())
+ if (mir_wstrcmpi(window, SERVERWINDOW) == 0 && !m_info.sServerName.IsEmpty())
S += m_info.sServerName + L" " + DoThis;
else
S += CMString(windowname) + L" " + DoThis;
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index 3828a45f5f..ab4430ad42 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -29,7 +29,7 @@ int CDccSession::nDcc = 0; static int CompareHandlers( const CIrcHandler* p1, const CIrcHandler* p2 ) { - return mir_tstrcmp( p1->m_name, p2->m_name ); + return mir_wstrcmp( p1->m_name, p2->m_name ); } OBJLIST<CIrcHandler> CIrcProto::m_handlers( 30, CompareHandlers ); @@ -174,7 +174,7 @@ void CIrcProto::SendIrcMessage(const wchar_t* msg, bool bNotify, int cp) cp = getCodepage(); if (this) { - char* str = mir_t2a_cp(msg, cp); + char* str = mir_u2a_cp(msg, cp); rtrim(str); int cbLen = (int)mir_strlen(str); str = (char*)mir_realloc(str, cbLen + 3); @@ -201,7 +201,7 @@ bool CIrcProto::Connect(const CIrcSessionInfo& info) con = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)m_hNetlibUser, (LPARAM)&ncon); if (con == NULL) { wchar_t szTemp[300]; - mir_sntprintf(szTemp, L"\0035%s \002%s\002 (%S: %u).", + mir_snwprintf(szTemp, L"\0035%s \002%s\002 (%S: %u).", TranslateT("Failed to connect to"), si.sNetwork.c_str(), si.sServer.c_str(), si.iPort); DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, szTemp, NULL, NULL, NULL, true, false); return false; @@ -289,10 +289,10 @@ int CIrcProto::NLSend(const wchar_t* fmt, ...) va_start(marker, fmt); wchar_t szBuf[1024 * 4]; - mir_vsntprintf(szBuf, _countof(szBuf), fmt, marker); + mir_vsnwprintf(szBuf, _countof(szBuf), fmt, marker); va_end(marker); - char* buf = mir_t2a_cp(szBuf, getCodepage()); + char* buf = mir_u2a_cp(szBuf, getCodepage()); int result = NLSend((unsigned char*)buf, (int)mir_strlen(buf)); mir_free(buf); return result; @@ -344,9 +344,9 @@ void CIrcProto::createMessageFromPchar(const char* p) wchar_t* ptszMsg; if (codepage != CP_UTF8 && m_utfAutodetect) { if (mir_utf8decodecp(NEWSTR_ALLOCA(p), codepage, &ptszMsg) == NULL) - ptszMsg = mir_a2t_cp(p, codepage); + ptszMsg = mir_a2u_cp(p, codepage); } - else ptszMsg = mir_a2t_cp(p, codepage); + else ptszMsg = mir_a2u_cp(p, codepage); CIrcMessage msg(this, ptszMsg, codepage, true); Notify(&msg); mir_free(ptszMsg); @@ -526,7 +526,7 @@ CDccSession* CIrcProto::FindDCCRecvByPortAndName(int iPort, const wchar_t* szNam CDccSession* p = m_dcc_xfers[i]; DBVARIANT dbv; if (!getTString(p->di->hContact, "Nick", &dbv)) { - if (p->di->iType == DCC_SEND && !p->di->bSender && !mir_tstrcmpi(szName, dbv.ptszVal) && iPort == p->di->iPort) { + if (p->di->iType == DCC_SEND && !p->di->bSender && !mir_wstrcmpi(szName, dbv.ptszVal) && iPort == p->di->iPort) { db_free(&dbv); return p; } diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index dc17feab0a..2d3b16f50f 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -181,7 +181,7 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM) nlu.cbSize = sizeof(nlu);
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR;
nlu.szSettingsModule = m_szModuleName;
- mir_sntprintf(name, TranslateT("%s server connection"), m_tszUserName);
+ mir_snwprintf(name, TranslateT("%s server connection"), m_tszUserName);
nlu.ptszDescriptiveName = name;
m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
@@ -189,7 +189,7 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM) char szTemp2[256];
mir_snprintf(szTemp2, "%s DCC", m_szModuleName);
nlu.szSettingsModule = szTemp2;
- mir_sntprintf(name, TranslateT("%s client-to-client connections"), m_tszUserName);
+ mir_snwprintf(name, TranslateT("%s client-to-client connections"), m_tszUserName);
nlu.ptszDescriptiveName = name;
hNetlibDCC = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
@@ -219,7 +219,7 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM) CallChatEvent(WINDOW_HIDDEN, (LPARAM)&gce);
wchar_t szTemp[MAX_PATH];
- mir_sntprintf(szTemp, L"%%miranda_path%%\\Plugins\\%S_perform.ini", m_szModuleName);
+ mir_snwprintf(szTemp, L"%%miranda_path%%\\Plugins\\%S_perform.ini", m_szModuleName);
wchar_t *szLoadFileName = Utils_ReplaceVarsT(szTemp);
char* pszPerformData = IrcLoadFile(szLoadFileName);
if (pszPerformData != NULL) {
@@ -273,16 +273,16 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM) if (m_nick[0]) {
wchar_t szBuf[40];
- if (mir_tstrlen(m_alternativeNick) == 0) {
- mir_sntprintf(szBuf, L"%s%u", m_nick, rand() % 9999);
+ if (mir_wstrlen(m_alternativeNick) == 0) {
+ mir_snwprintf(szBuf, L"%s%u", m_nick, rand() % 9999);
setTString("AlernativeNick", szBuf);
- mir_tstrncpy(m_alternativeNick, szBuf, 30);
+ mir_wstrncpy(m_alternativeNick, szBuf, 30);
}
- if (mir_tstrlen(m_name) == 0) {
- mir_sntprintf(szBuf, L"Miranda%u", rand() % 9999);
+ if (mir_wstrlen(m_name) == 0) {
+ mir_snwprintf(szBuf, L"Miranda%u", rand() % 9999);
setTString("Name", szBuf);
- mir_tstrncpy(m_name, szBuf, 200);
+ mir_wstrncpy(m_name, szBuf, 200);
}
}
@@ -298,7 +298,7 @@ MCONTACT __cdecl CIrcProto::AddToList(int, PROTOSEARCHRESULT* psr) return 0;
wchar_t *id = psr->id.w ? psr->id.w : psr->nick.w;
- id = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)id) : mir_a2t((char*)id);
+ id = psr->flags & PSR_UNICODE ? mir_wstrdup((wchar_t*)id) : mir_a2u((char*)id);
CONTACT user = { id, NULL, NULL, true, false, false };
MCONTACT hContact = CList_AddContact(&user, true, false);
@@ -497,7 +497,7 @@ HANDLE __cdecl CIrcProto::SearchBasic(const wchar_t* szId) if (m_iStatus != ID_STATUS_OFFLINE && m_iStatus != ID_STATUS_CONNECTING &&
szId && szId[0] && !IsChannel(szId)) {
AckBasicSearchParam* param = new AckBasicSearchParam;
- mir_tstrncpy(param->buf, szId, 50);
+ mir_wstrncpy(param->buf, szId, 50);
ForkThread(&CIrcProto::AckBasicSearch, param);
return (HANDLE)1;
}
@@ -592,13 +592,13 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t** PostIrcMessage(L"/CTCP %s DCC SEND %s 200 0 %I64u %u",
dci->sContactName.c_str(), sFileWithQuotes.c_str(), dci->dwSize, dcc->iToken);
- mir_sntprintf(szTemp,
+ mir_snwprintf(szTemp,
TranslateT("DCC reversed file transfer request sent to %s [%s]"),
dci->sContactName.c_str(), sFileCorrect.c_str());
DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
if (m_sendNotice) {
- mir_sntprintf(szTemp,
+ mir_snwprintf(szTemp,
L"/NOTICE %s I am sending the file '\002%s\002' (%I64u kB) to you, please accept it. [Reverse transfer]",
dci->sContactName.c_str(), sFileCorrect.c_str(), dci->dwSize / 1024);
PostIrcMessage(szTemp);
@@ -611,13 +611,13 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t** PostIrcMessage(L"/CTCP %s DCC SEND %s %u %u %I64u",
dci->sContactName.c_str(), sFileWithQuotes.c_str(), ulAdr, iPort, dci->dwSize);
- mir_sntprintf(szTemp,
+ mir_snwprintf(szTemp,
TranslateT("DCC file transfer request sent to %s [%s]"),
dci->sContactName.c_str(), sFileCorrect.c_str());
DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
if (m_sendNotice) {
- mir_sntprintf(szTemp,
+ mir_snwprintf(szTemp,
L"/NOTICE %s I am sending the file '\002%s\002' (%I64u kB) to you, please accept it. [IP: %s]",
dci->sContactName.c_str(), sFileCorrect.c_str(), dci->dwSize / 1024, (wchar_t*)_A2T(ConvertIntegerToIP(ulAdr)));
PostIrcMessage(szTemp);
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index 3dee470d0d..9102b14c3a 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -62,11 +62,11 @@ void CIrcProto::ReadSettings(TDbSetting* sets, int count) case DBVT_TCHAR:
if (!getTString(p->name, &dbv)) {
if (p->size != -1) {
- size_t len = min(p->size - 1, mir_tstrlen(dbv.ptszVal));
+ size_t len = min(p->size - 1, mir_wstrlen(dbv.ptszVal));
memcpy(ptr, dbv.pszVal, len*sizeof(wchar_t));
*(wchar_t*)&ptr[len*sizeof(wchar_t)] = 0;
}
- else *(wchar_t**)ptr = mir_tstrdup(dbv.ptszVal);
+ else *(wchar_t**)ptr = mir_wstrdup(dbv.ptszVal);
db_free(&dbv);
}
else {
@@ -74,9 +74,9 @@ void CIrcProto::ReadSettings(TDbSetting* sets, int count) if (p->defStr == NULL)
*ptr = 0;
else
- mir_tstrncpy((wchar_t*)ptr, p->defStr, (int)p->size);
+ mir_wstrncpy((wchar_t*)ptr, p->defStr, (int)p->size);
}
- else *(wchar_t**)ptr = mir_tstrdup(p->defStr);
+ else *(wchar_t**)ptr = mir_wstrdup(p->defStr);
}
break;
} } }
@@ -177,7 +177,7 @@ static void removeSpaces(wchar_t* p) {
while (*p) {
if (*p == ' ')
- memmove(p, p + 1, sizeof(wchar_t)*mir_tstrlen(p));
+ memmove(p, p + 1, sizeof(wchar_t)*mir_wstrlen(p));
p++;
}
}
@@ -602,7 +602,7 @@ void CConnectPrefsDlg::OnDeleteServer(CCtrlButton*) SERVER_INFO *pData = (SERVER_INFO*)m_serverCombo.GetItemData(i);
wchar_t temp[200];
- mir_sntprintf(temp, TranslateT("Do you want to delete\r\n%s"), (wchar_t*)_A2T(pData->m_name));
+ mir_snwprintf(temp, TranslateT("Do you want to delete\r\n%s"), (wchar_t*)_A2T(pData->m_name));
if (MessageBox(m_hwnd, temp, TranslateT("Delete server"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
g_servers.remove(pData);
@@ -828,7 +828,7 @@ void CCtcpPrefsDlg::OnInitDialog() m_combo.AddStringA("8192");
wchar_t szTemp[10];
- mir_sntprintf(szTemp, L"%u", m_proto->m_DCCPacketSize);
+ mir_snwprintf(szTemp, L"%u", m_proto->m_DCCPacketSize);
int i = m_combo.SelectString(szTemp);
if (i == CB_ERR)
m_combo.SelectString(L"4096");
@@ -1282,7 +1282,7 @@ static int CALLBACK IgnoreListSort(LPARAM lParam1, LPARAM lParam2, LPARAM lParam hwndDlg->m_list.GetItem(&lvm);
if (temp1[0] && temp2[0])
- return mir_tstrcmpi(temp1, temp2);
+ return mir_wstrcmpi(temp1, temp2);
return (temp1[0] == 0) ? 1 : -1;
}
@@ -1316,7 +1316,7 @@ static LRESULT CALLBACK ListviewSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, void CIrcProto::InitIgnore(void)
{
wchar_t szTemp[MAX_PATH];
- mir_sntprintf(szTemp, L"%%miranda_path%%\\Plugins\\%S_ignore.ini", m_szModuleName);
+ mir_snwprintf(szTemp, L"%%miranda_path%%\\Plugins\\%S_ignore.ini", m_szModuleName);
wchar_t *szLoadFileName = Utils_ReplaceVarsT(szTemp);
char* pszIgnoreData = IrcLoadFile(szLoadFileName);
if (pszIgnoreData != NULL) {
@@ -1701,7 +1701,7 @@ void CIrcProto::InitPrefs(void) m_mySpecifiedHostIP[0] = 0;
if (m_alias == NULL)
- m_alias = mir_tstrdup(L"/op /mode ## +ooo $1 $2 $3\r\n/dop /mode ## -ooo $1 $2 $3\r\n/voice /mode ## +vvv $1 $2 $3\r\n/dvoice /mode ## -vvv $1 $2 $3\r\n/j /join #$1 $2-\r\n/p /part ## $1-\r\n/w /whois $1\r\n/k /kick ## $1 $2-\r\n/q /query $1\r\n/logon /log on ##\r\n/logoff /log off ##\r\n/save /log buffer $1\r\n/slap /me slaps $1 around a bit with a large trout");
+ m_alias = mir_wstrdup(L"/op /mode ## +ooo $1 $2 $3\r\n/dop /mode ## -ooo $1 $2 $3\r\n/voice /mode ## +vvv $1 $2 $3\r\n/dvoice /mode ## -vvv $1 $2 $3\r\n/j /join #$1 $2-\r\n/p /part ## $1-\r\n/w /whois $1\r\n/k /kick ## $1 $2-\r\n/q /query $1\r\n/logon /log on ##\r\n/logoff /log off ##\r\n/save /log buffer $1\r\n/slap /me slaps $1 around a bit with a large trout");
m_quickComboSelection = getDword("QuickComboSelection", m_serverComboSelection + 1);
m_myHost[0] = '\0';
diff --git a/protocols/IRCG/src/output.cpp b/protocols/IRCG/src/output.cpp index 711b164e22..eacf4c785b 100644 --- a/protocols/IRCG/src/output.cpp +++ b/protocols/IRCG/src/output.cpp @@ -28,7 +28,7 @@ static CMString FormatOutput(const CIrcMessage* pmsg) if (pmsg->m_bIncoming) { // Is it an incoming message?
if (pmsg->sCommand == L"WALLOPS" && pmsg->parameters.getCount() > 0) {
wchar_t temp[200]; *temp = '\0';
- mir_sntprintf(temp, TranslateT("WallOps from %s: "), pmsg->prefix.sNick.c_str());
+ mir_snwprintf(temp, TranslateT("WallOps from %s: "), pmsg->prefix.sNick.c_str());
sMessage = temp;
for (int i = 0; i < (int)pmsg->parameters.getCount(); i++) {
sMessage += pmsg->parameters[i];
@@ -40,7 +40,7 @@ static CMString FormatOutput(const CIrcMessage* pmsg) if (pmsg->sCommand == L"INVITE" && pmsg->parameters.getCount() > 1) {
wchar_t temp[256]; *temp = '\0';
- mir_sntprintf(temp, TranslateT("%s invites you to %s"), pmsg->prefix.sNick.c_str(), pmsg->parameters[1].c_str());
+ mir_snwprintf(temp, TranslateT("%s invites you to %s"), pmsg->prefix.sNick.c_str(), pmsg->parameters[1].c_str());
sMessage = temp;
for (int i = 2; i < (int)pmsg->parameters.getCount(); i++) {
sMessage += L": " + pmsg->parameters[i];
@@ -53,7 +53,7 @@ static CMString FormatOutput(const CIrcMessage* pmsg) int index = _wtoi(pmsg->sCommand.c_str());
if (index == 301 && pmsg->parameters.getCount() > 0) {
wchar_t temp[500]; *temp = '\0';
- mir_sntprintf(temp, TranslateT("%s is away"), pmsg->parameters[1].c_str());
+ mir_snwprintf(temp, TranslateT("%s is away"), pmsg->parameters[1].c_str());
sMessage = temp;
for (int i = 2; i < (int)pmsg->parameters.getCount(); i++) {
sMessage += L": " + pmsg->parameters[i];
@@ -89,14 +89,14 @@ static CMString FormatOutput(const CIrcMessage* pmsg) tempstr.Delete(0, 1);
tempstr.Delete(tempstr.GetLength() - 1, 1);
CMString type = GetWord(tempstr.c_str(), 0);
- if (mir_tstrcmpi(type.c_str(), L"ping") == 0)
- mir_sntprintf(temp, TranslateT("CTCP %s reply sent to %s"), type.c_str(), pmsg->parameters[0].c_str());
+ if (mir_wstrcmpi(type.c_str(), L"ping") == 0)
+ mir_snwprintf(temp, TranslateT("CTCP %s reply sent to %s"), type.c_str(), pmsg->parameters[0].c_str());
else
- mir_sntprintf(temp, TranslateT("CTCP %s reply sent to %s: %s"), type.c_str(), pmsg->parameters[0].c_str(), GetWordAddress(tempstr.c_str(), 1));
+ mir_snwprintf(temp, TranslateT("CTCP %s reply sent to %s: %s"), type.c_str(), pmsg->parameters[0].c_str(), GetWordAddress(tempstr.c_str(), 1));
sMessage = temp;
}
else {
- mir_sntprintf(temp, TranslateT("Notice to %s: "), pmsg->parameters[0].c_str());
+ mir_snwprintf(temp, TranslateT("Notice to %s: "), pmsg->parameters[0].c_str());
sMessage = temp;
for (int i = 1; i < (int)pmsg->parameters.getCount(); i++) {
sMessage += pmsg->parameters[i];
diff --git a/protocols/IRCG/src/scripting.cpp b/protocols/IRCG/src/scripting.cpp index 1620b46e24..9813630002 100644 --- a/protocols/IRCG/src/scripting.cpp +++ b/protocols/IRCG/src/scripting.cpp @@ -26,7 +26,7 @@ INT_PTR __cdecl CIrcProto::Scripting_InsertRawIn(WPARAM, LPARAM lParam) char* pszRaw = (char*)lParam;
if (m_scriptingEnabled && pszRaw && IsConnected()) {
- wchar_t* p = mir_a2t(pszRaw);
+ wchar_t* p = mir_a2u(pszRaw);
InsertIncomingEvent(p);
mir_free(p);
return 0;
@@ -117,7 +117,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam) int i = sString.Find("|");
if (i != -1) {
sRequest = sString.Mid(0, i);
- wchar_t* p = mir_a2t(sString.Mid(i + 1));
+ wchar_t* p = mir_a2u(sString.Mid(i + 1));
sChannel = p;
mir_free(p);
}
@@ -149,7 +149,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam) gci.pszID = S.c_str();
if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci)) {
wchar_t szTemp[40];
- mir_sntprintf(szTemp, L"%u", gci.iCount);
+ mir_snwprintf(szTemp, L"%u", gci.iCount);
sOutput = szTemp;
}
}
@@ -173,7 +173,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam) gci.pszModule = m_szModuleName;
gci.iItem = j;
if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci)) {
- if (mir_tstrcmpi(gci.pszID, SERVERWINDOW)) {
+ if (mir_wstrcmpi(gci.pszID, SERVERWINDOW)) {
CMString S1 = gci.pszID;
int k = S1.Find(L" ");
if (k != -1)
@@ -190,7 +190,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam) }
// send it to mbot
if (!sOutput.IsEmpty())
- return (INT_PTR)mir_t2a(sOutput.c_str());
+ return (INT_PTR)mir_u2a(sOutput.c_str());
}
return 0;
}
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index 2f7e814455..a05b6d0b17 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -182,7 +182,7 @@ INT_PTR __cdecl CIrcProto::OnDoubleclicked(WPARAM, LPARAM lParam) dlg->Show();
HWND hWnd = dlg->GetHwnd();
wchar_t szTemp[500];
- mir_sntprintf(szTemp, TranslateT("%s (%s) is requesting a client-to-client chat connection."),
+ mir_snwprintf(szTemp, TranslateT("%s (%s) is requesting a client-to-client chat connection."),
pdci->sContactName.c_str(), pdci->sHostmask.c_str());
SetDlgItemText(hWnd, IDC_TEXT, szTemp);
ShowWindow(hWnd, SW_SHOW);
@@ -404,61 +404,61 @@ static void DoChatFormatting(wchar_t* pszText) switch (p1[1]) {
case 'B':
case 'b':
- mir_tstrcpy(InsertThis, L"\002");
+ mir_wstrcpy(InsertThis, L"\002");
iRemoveChars = 2;
break;
case 'I':
case 'i':
- mir_tstrcpy(InsertThis, L"\026");
+ mir_wstrcpy(InsertThis, L"\026");
iRemoveChars = 2;
break;
case 'U':
case 'u':
- mir_tstrcpy(InsertThis, L"\037");
+ mir_wstrcpy(InsertThis, L"\037");
iRemoveChars = 2;
break;
case 'c':
{
- mir_tstrcpy(InsertThis, L"\003");
+ mir_wstrcpy(InsertThis, L"\003");
iRemoveChars = 2;
wchar_t szTemp[3];
- mir_tstrncpy(szTemp, p1 + 2, 3);
+ mir_wstrncpy(szTemp, p1 + 2, 3);
iFG = _wtoi(szTemp);
}
break;
case 'C':
if (p1[2] == '%' && p1[3] == 'F') {
- mir_tstrcpy(InsertThis, L"\x0399,99");
+ mir_wstrcpy(InsertThis, L"\x0399,99");
iRemoveChars = 4;
}
else {
- mir_tstrcpy(InsertThis, L"\x0399");
+ mir_wstrcpy(InsertThis, L"\x0399");
iRemoveChars = 2;
}
iFG = -1;
break;
case 'f':
if (p1 - 3 >= pszText && p1[-3] == '\003')
- mir_tstrcpy(InsertThis, L",");
+ mir_wstrcpy(InsertThis, L",");
else if (iFG >= 0)
- mir_sntprintf(InsertThis, L"\x03%u,", iFG);
+ mir_snwprintf(InsertThis, L"\x03%u,", iFG);
else
- mir_tstrcpy(InsertThis, L"\x0399,");
+ mir_wstrcpy(InsertThis, L"\x0399,");
iRemoveChars = 2;
break;
case 'F':
if (iFG >= 0)
- mir_sntprintf(InsertThis, L"\x03%u,99", iFG);
+ mir_snwprintf(InsertThis, L"\x03%u,99", iFG);
else
- mir_tstrcpy(InsertThis, L"\x0399,99");
+ mir_wstrcpy(InsertThis, L"\x0399,99");
iRemoveChars = 2;
break;
case '%':
- mir_tstrcpy(InsertThis, L"%");
+ mir_wstrcpy(InsertThis, L"%");
iRemoveChars = 2;
break;
@@ -467,10 +467,10 @@ static void DoChatFormatting(wchar_t* pszText) break;
}
- memmove(p1 + mir_tstrlen(InsertThis), p1 + iRemoveChars, sizeof(wchar_t)*(mir_tstrlen(p1) - iRemoveChars + 1));
- memcpy(p1, InsertThis, sizeof(wchar_t)*mir_tstrlen(InsertThis));
- if (iRemoveChars || mir_tstrlen(InsertThis))
- p1 += mir_tstrlen(InsertThis);
+ memmove(p1 + mir_wstrlen(InsertThis), p1 + iRemoveChars, sizeof(wchar_t)*(mir_wstrlen(p1) - iRemoveChars + 1));
+ memcpy(p1, InsertThis, sizeof(wchar_t)*mir_wstrlen(InsertThis));
+ if (iRemoveChars || mir_wstrlen(InsertThis))
+ p1 += mir_wstrlen(InsertThis);
else
p1++;
}
@@ -488,7 +488,7 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam) // handle the hook
if (gch) {
if (!mir_strcmpi(gch->pDest->pszModule, m_szModuleName)) {
- wchar_t *p1 = mir_tstrdup(gch->pDest->ptszID);
+ wchar_t *p1 = mir_wstrdup(gch->pDest->ptszID);
wchar_t *p2 = wcsstr(p1, L" - ");
if (p2)
*p2 = '\0';
@@ -500,8 +500,8 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam) case GC_USER_MESSAGE:
if (gch && gch->ptszText && *gch->ptszText) {
- wchar_t* pszText = new wchar_t[mir_tstrlen(gch->ptszText) + 1000];
- mir_tstrcpy(pszText, gch->ptszText);
+ wchar_t* pszText = new wchar_t[mir_wstrlen(gch->ptszText) + 1000];
+ mir_wstrcpy(pszText, gch->ptszText);
DoChatFormatting(pszText);
PostIrcMessageWnd(p1, NULL, pszText);
delete[]pszText;
@@ -515,7 +515,7 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam) case GC_USER_PRIVMESS:
{
wchar_t szTemp[4000];
- mir_sntprintf(szTemp, L"/QUERY %s", gch->ptszUID);
+ mir_snwprintf(szTemp, L"/QUERY %s", gch->ptszUID);
PostIrcMessageWnd(p1, NULL, szTemp);
}
break;
@@ -835,7 +835,7 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam) if (gcmi) {
if (!mir_strcmpi(gcmi->pszModule, m_szModuleName)) {
if (gcmi->Type == MENU_ON_LOG) {
- if (mir_tstrcmpi(gcmi->pszID, SERVERWINDOW)) {
+ if (mir_wstrcmpi(gcmi->pszID, SERVERWINDOW)) {
gcmi->nItems = _countof(logItems);
gcmi->Item = logItems;
}
@@ -860,8 +860,8 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam) wchar_t stzChanName[100];
const wchar_t* temp = wcschr(gcmi->pszID, ' ');
- size_t len = min(((temp == NULL) ? mir_tstrlen(gcmi->pszID) : (int)(temp - gcmi->pszID + 1)), _countof(stzChanName) - 1);
- mir_tstrncpy(stzChanName, gcmi->pszID, len);
+ size_t len = min(((temp == NULL) ? mir_wstrlen(gcmi->pszID) : (int)(temp - gcmi->pszID + 1)), _countof(stzChanName) - 1);
+ mir_wstrncpy(stzChanName, gcmi->pszID, len);
stzChanName[len] = 0;
CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, stzChanName, NULL, NULL, NULL, NULL, NULL, false, false, 0);
BOOL bServOwner = strchr(sUserModes.c_str(), 'q') == NULL ? FALSE : TRUE;
@@ -1056,7 +1056,7 @@ void CIrcProto::ConnectToServer(void) InterlockedIncrement((long *)&m_bConnectRequested);
wchar_t szTemp[300];
- mir_sntprintf(szTemp, L"\033%s \002%s\002 (%S: %u)",
+ mir_snwprintf(szTemp, L"\033%s \002%s\002 (%S: %u)",
TranslateT("Connecting to"), si.sNetwork.c_str(), si.sServer.c_str(), si.iPort);
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, szTemp, NULL, NULL, NULL, true, false);
}
@@ -1082,5 +1082,5 @@ INT_PTR __cdecl CIrcProto::GetMyAwayMsg(WPARAM wParam, LPARAM lParam) const wchar_t* p = m_statusMessage.c_str();
- return (lParam & SGMA_UNICODE) ? (INT_PTR)mir_t2u(p) : (INT_PTR)mir_t2a(p);
+ return (lParam & SGMA_UNICODE) ? (INT_PTR)mir_wstrdup(p) : (INT_PTR)mir_u2a(p);
}
diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp index 6a2af3446e..4869720b3f 100644 --- a/protocols/IRCG/src/tools.cpp +++ b/protocols/IRCG/src/tools.cpp @@ -84,7 +84,7 @@ CMString __stdcall GetWord(const wchar_t* text, int index) const wchar_t* __stdcall GetWordAddress(const wchar_t* text, int index)
{
- if (!text || !mir_tstrlen(text))
+ if (!text || !mir_wstrlen(text))
return text;
const wchar_t* temp = text;
@@ -141,7 +141,7 @@ char* __stdcall IrcLoadFile(wchar_t* szPath) int __stdcall WCCmp(const wchar_t* wild, const wchar_t* string)
{
- if (wild == NULL || !mir_tstrlen(wild) || string == NULL || !mir_tstrlen(string))
+ if (wild == NULL || !mir_wstrlen(wild) || string == NULL || !mir_wstrlen(string))
return 1;
const wchar_t *cp = NULL, *mp = NULL;
@@ -309,10 +309,10 @@ wchar_t* __stdcall DoColorCodes(const wchar_t* text, bool bStrip, bool bReplaceP // fix foreground index
if (text[1] > 47 && text[1] < 58 && text[1] != '\0')
- mir_tstrncpy(buf, text, 3);
+ mir_wstrncpy(buf, text, 3);
else
- mir_tstrncpy(buf, text, 2);
- text += mir_tstrlen(buf);
+ mir_wstrncpy(buf, text, 2);
+ text += mir_wstrlen(buf);
iFG = _wtoi(buf);
// fix background color
@@ -320,10 +320,10 @@ wchar_t* __stdcall DoColorCodes(const wchar_t* text, bool bStrip, bool bReplaceP text++;
if (text[1] > 47 && text[1] < 58 && text[1] != '\0')
- mir_tstrncpy(buf, text, 3);
+ mir_wstrncpy(buf, text, 3);
else
- mir_tstrncpy(buf, text, 2);
- text += mir_tstrlen(buf);
+ mir_wstrncpy(buf, text, 2);
+ text += mir_wstrlen(buf);
iBG = _wtoi(buf);
}
}
@@ -342,7 +342,7 @@ wchar_t* __stdcall DoColorCodes(const wchar_t* text, bool bStrip, bool bReplaceP *p++ = '%';
*p++ = 'c';
- mir_sntprintf(buf, L"%02u", iFG);
+ mir_snwprintf(buf, L"%02u", iFG);
for (int i = 0; i < 2; i++)
*p++ = buf[i];
}
@@ -355,7 +355,7 @@ wchar_t* __stdcall DoColorCodes(const wchar_t* text, bool bStrip, bool bReplaceP *p++ = '%';
*p++ = 'f';
- mir_sntprintf(buf, L"%02u", iBG);
+ mir_snwprintf(buf, L"%02u", iBG);
for (int i = 0; i < 2; i++)
*p++ = buf[i];
}
@@ -400,7 +400,7 @@ INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t* }
if (pszWindow) {
- if (mir_tstrcmpi(pszWindow, SERVERWINDOW))
+ if (mir_wstrcmpi(pszWindow, SERVERWINDOW))
sID = pszWindow + (CMString)L" - " + m_info.sNetwork;
else
sID = pszWindow;
@@ -548,7 +548,7 @@ int CIrcProto::SetChannelSBText(CMString sWindow, CHANNELINFO * wi) CMString CIrcProto::MakeWndID(const wchar_t* sWindow)
{
wchar_t buf[200];
- mir_sntprintf(buf, L"%s - %s", sWindow, (IsConnected()) ? m_info.sNetwork.c_str() : TranslateT("Offline"));
+ mir_snwprintf(buf, L"%s - %s", sWindow, (IsConnected()) ? m_info.sNetwork.c_str() : TranslateT("Offline"));
return CMString(buf);
}
@@ -575,20 +575,20 @@ bool CIrcProto::AddWindowItemData(CMString window, const wchar_t* pszLimit, cons CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, window.c_str(), NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
if (wi) {
if (pszLimit) {
- wi->pszLimit = (wchar_t*)realloc(wi->pszLimit, sizeof(wchar_t)*(mir_tstrlen(pszLimit) + 1));
- mir_tstrcpy(wi->pszLimit, pszLimit);
+ wi->pszLimit = (wchar_t*)realloc(wi->pszLimit, sizeof(wchar_t)*(mir_wstrlen(pszLimit) + 1));
+ mir_wstrcpy(wi->pszLimit, pszLimit);
}
if (pszMode) {
- wi->pszMode = (wchar_t*)realloc(wi->pszMode, sizeof(wchar_t)*(mir_tstrlen(pszMode) + 1));
- mir_tstrcpy(wi->pszMode, pszMode);
+ wi->pszMode = (wchar_t*)realloc(wi->pszMode, sizeof(wchar_t)*(mir_wstrlen(pszMode) + 1));
+ mir_wstrcpy(wi->pszMode, pszMode);
}
if (pszPassword) {
- wi->pszPassword = (wchar_t*)realloc(wi->pszPassword, sizeof(wchar_t)*(mir_tstrlen(pszPassword) + 1));
- mir_tstrcpy(wi->pszPassword, pszPassword);
+ wi->pszPassword = (wchar_t*)realloc(wi->pszPassword, sizeof(wchar_t)*(mir_wstrlen(pszPassword) + 1));
+ mir_wstrcpy(wi->pszPassword, pszPassword);
}
if (pszTopic) {
- wi->pszTopic = (wchar_t*)realloc(wi->pszTopic, sizeof(wchar_t)*(mir_tstrlen(pszTopic) + 1));
- mir_tstrcpy(wi->pszTopic, pszTopic);
+ wi->pszTopic = (wchar_t*)realloc(wi->pszTopic, sizeof(wchar_t)*(mir_wstrlen(pszTopic) + 1));
+ mir_wstrcpy(wi->pszTopic, pszTopic);
}
SetChannelSBText(window, wi);
@@ -628,7 +628,7 @@ void CIrcProto::DoUserhostWithReason(int type, CMString reason, bool bSendComman va_list ap;
va_start(ap, userhostparams);
- mir_vsntprintf(temp, _countof(temp), (S + L" " + userhostparams).c_str(), ap);
+ mir_vsnwprintf(temp, _countof(temp), (S + L" " + userhostparams).c_str(), ap);
va_end(ap);
// Add reason
diff --git a/protocols/IRCG/src/userinfo.cpp b/protocols/IRCG/src/userinfo.cpp index 6237ceaa31..0079e410e0 100644 --- a/protocols/IRCG/src/userinfo.cpp +++ b/protocols/IRCG/src/userinfo.cpp @@ -117,7 +117,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM S += L" (";
S += dbv.ptszVal;
S += L")";
- if ((mir_tstrlen(temp) < 4 && mir_tstrlen(temp)) || !WCCmp(CharLower(temp), CharLower(dbv.ptszVal))) {
+ if ((mir_wstrlen(temp) < 4 && mir_wstrlen(temp)) || !WCCmp(CharLower(temp), CharLower(dbv.ptszVal))) {
MessageBox(NULL, TranslateTS(S.c_str()), TranslateT("IRC error"), MB_OK | MB_ICONERROR);
db_free(&dbv);
return FALSE;
@@ -126,7 +126,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM }
GetDlgItemText(m_hwnd, IDC_WILDCARD, temp, _countof(temp));
- if (mir_tstrlen(GetWord(temp, 0).c_str()))
+ if (mir_wstrlen(GetWord(temp, 0).c_str()))
p->ppro->setTString(p->hContact, "UWildcard", GetWord(temp, 0).c_str());
else
db_unset(p->hContact, p->ppro->m_szModuleName, "UWildcard");
@@ -135,13 +135,13 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM p->ppro->setByte(p->hContact, "AdvancedMode", bAdvanced);
GetDlgItemText(m_hwnd, IDC_USER, temp, _countof(temp));
- if (mir_tstrlen(GetWord(temp, 0).c_str()))
+ if (mir_wstrlen(GetWord(temp, 0).c_str()))
p->ppro->setTString(p->hContact, "UUser", GetWord(temp, 0).c_str());
else
db_unset(p->hContact, p->ppro->m_szModuleName, "UUser");
GetDlgItemText(m_hwnd, IDC_HOST, temp, _countof(temp));
- if (mir_tstrlen(GetWord(temp, 0).c_str()))
+ if (mir_wstrlen(GetWord(temp, 0).c_str()))
p->ppro->setTString(p->hContact, "UHost", GetWord(temp, 0).c_str());
else
db_unset(p->hContact, p->ppro->m_szModuleName, "UHost");
diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp index de14672a0a..494000553c 100644 --- a/protocols/IRCG/src/windows.cpp +++ b/protocols/IRCG/src/windows.cpp @@ -278,10 +278,10 @@ void CListDlg::OnInitDialog() lvC.cx = COLUMNS_SIZES[index];
switch (index) {
- case 0: mir_tstrcpy(szBuffer, TranslateT("Channel")); break;
- case 1: mir_tstrcpy(szBuffer, L"#"); break;
- case 2: mir_tstrcpy(szBuffer, TranslateT("Mode")); break;
- case 3: mir_tstrcpy(szBuffer, TranslateT("Topic")); break;
+ case 0: mir_wstrcpy(szBuffer, TranslateT("Channel")); break;
+ case 1: mir_wstrcpy(szBuffer, L"#"); break;
+ case 2: mir_wstrcpy(szBuffer, TranslateT("Mode")); break;
+ case 3: mir_wstrcpy(szBuffer, TranslateT("Topic")); break;
}
lvC.pszText = szBuffer;
m_list.InsertColumn(index, &lvC);
@@ -376,13 +376,13 @@ INT_PTR CListDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) ShowWindow(m_list.GetHwnd(), SW_HIDE);
// New dialog title
- mir_sntprintf(newTitle, TranslateT("%s - Filtered - %d items"), strFilterText, itemCount);
+ mir_snwprintf(newTitle, TranslateT("%s - Filtered - %d items"), strFilterText, itemCount);
SetWindowText(m_hwnd, newTitle);
}
else {
ShowWindow(m_list.GetHwnd(), SW_SHOW);
ShowWindow(m_list2.GetHwnd(), SW_HIDE);
- mir_sntprintf(newTitle, TranslateT("Channels on server"));
+ mir_snwprintf(newTitle, TranslateT("Channels on server"));
SetWindowText(m_hwnd, newTitle);
}
}
@@ -429,8 +429,8 @@ static int CALLBACK ListViewSort(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSo lvm.pszText = temp2;
param->pList->GetItem(&lvm);
if (param->iSubItem != 1) {
- if (mir_tstrlen(temp1) != 0 && mir_tstrlen(temp2) != 0)
- return mir_tstrcmpi(temp1, temp2);
+ if (mir_wstrlen(temp1) != 0 && mir_wstrlen(temp2) != 0)
+ return mir_wstrcmpi(temp1, temp2);
return (*temp1 == 0) ? 1 : -1;
}
@@ -633,7 +633,7 @@ void CQuickDlg::OnOk(CCtrlButton*) wchar_t windowname[20];
GetWindowText(m_hwnd, windowname, _countof(windowname));
- if (mir_tstrcmpi(windowname, L"Miranda IRC") == 0) {
+ if (mir_wstrcmpi(windowname, L"Miranda IRC") == 0) {
m_proto->m_serverComboSelection = m_serverCombo.GetCurSel() - 1;
m_proto->setDword("ServerComboSelection", m_proto->m_serverComboSelection);
m_proto->setString("ServerName", m_proto->m_serverName);
@@ -923,8 +923,8 @@ void CManagerDlg::OnClose() }
if (!S.IsEmpty() && m_proto->IsConnected()) {
- mir_sntprintf(temp, L"Topic%s%s", window, m_proto->m_info.sNetwork.c_str());
- char* p = mir_t2a(temp);
+ mir_snwprintf(temp, L"Topic%s%s", window, m_proto->m_info.sNetwork.c_str());
+ char* p = mir_u2a(temp);
m_proto->setTString(p, S.c_str());
mir_free(p);
}
@@ -942,16 +942,16 @@ void CManagerDlg::OnAdd(CCtrlButton*) wchar_t temp[100];
wchar_t mode[3];
if (m_radio1.GetState()) {
- mir_tstrcpy(mode, L"+b");
- mir_tstrncpy(temp, TranslateT("Add ban"), 100);
+ mir_wstrcpy(mode, L"+b");
+ mir_wstrncpy(temp, TranslateT("Add ban"), 100);
}
if (m_radio2.GetState()) {
- mir_tstrcpy(mode, L"+I");
- mir_tstrncpy(temp, TranslateT("Add invite"), 100);
+ mir_wstrcpy(mode, L"+I");
+ mir_wstrncpy(temp, TranslateT("Add invite"), 100);
}
if (m_radio3.GetState()) {
- mir_tstrcpy(mode, L"+e");
- mir_tstrncpy(temp, TranslateT("Add exception"), 100);
+ mir_wstrcpy(mode, L"+e");
+ mir_wstrncpy(temp, TranslateT("Add exception"), 100);
}
m_add.Disable();
@@ -967,7 +967,7 @@ void CManagerDlg::OnAdd(CCtrlButton*) wchar_t temp2[450];
wchar_t window[256];
GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
- mir_sntprintf(temp2, L"/MODE %s %s %s", window, mode, L"%question");
+ mir_snwprintf(temp2, L"/MODE %s %s %s", window, mode, L"%question");
SetDlgItemText(addban_hWnd, IDC_HIDDENEDIT, temp2);
dlg->Activate();
}
@@ -984,16 +984,16 @@ void CManagerDlg::OnEdit(CCtrlButton*) wchar_t temp[100];
wchar_t mode[3];
if (m_radio1.GetState()) {
- mir_tstrcpy(mode, L"b");
- mir_tstrncpy(temp, TranslateT("Edit ban"), 100);
+ mir_wstrcpy(mode, L"b");
+ mir_wstrncpy(temp, TranslateT("Edit ban"), 100);
}
if (m_radio2.GetState()) {
- mir_tstrcpy(mode, L"I");
- mir_tstrncpy(temp, TranslateT("Edit invite?"), 100);
+ mir_wstrcpy(mode, L"I");
+ mir_wstrncpy(temp, TranslateT("Edit invite?"), 100);
}
if (m_radio3.GetState()) {
- mir_tstrcpy(mode, L"e");
- mir_tstrncpy(temp, TranslateT("Edit exception?"), 100);
+ mir_wstrcpy(mode, L"e");
+ mir_wstrncpy(temp, TranslateT("Edit exception?"), 100);
}
CQuestionDlg* dlg = new CQuestionDlg(m_proto, this);
@@ -1010,7 +1010,7 @@ void CManagerDlg::OnEdit(CCtrlButton*) wchar_t temp2[450];
wchar_t window[256];
GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
- mir_sntprintf(temp2, L"/MODE %s -%s %s%s/MODE %s +%s %s", window, mode, user.c_str(), L"%newl", window, mode, L"%question");
+ mir_snwprintf(temp2, L"/MODE %s -%s %s%s/MODE %s +%s %s", window, mode, user.c_str(), L"%newl", window, mode, L"%question");
SetDlgItemText(addban_hWnd, IDC_HIDDENEDIT, temp2);
dlg->Activate();
}
@@ -1030,16 +1030,16 @@ void CManagerDlg::OnRemove(CCtrlButton*) CMString user = GetWord(m, 0);
if (m_radio1.GetState()) {
- mir_tstrcpy(mode, L"-b");
- mir_tstrncpy(temp, TranslateT("Remove ban?"), 100);
+ mir_wstrcpy(mode, L"-b");
+ mir_wstrncpy(temp, TranslateT("Remove ban?"), 100);
}
if (m_radio2.GetState()) {
- mir_tstrcpy(mode, L"-I");
- mir_tstrncpy(temp, TranslateT("Remove invite?"), 100);
+ mir_wstrcpy(mode, L"-I");
+ mir_wstrncpy(temp, TranslateT("Remove invite?"), 100);
}
if (m_radio3.GetState()) {
- mir_tstrcpy(mode, L"-e");
- mir_tstrncpy(temp, TranslateT("Remove exception?"), 100);
+ mir_wstrcpy(mode, L"-e");
+ mir_wstrncpy(temp, TranslateT("Remove exception?"), 100);
}
wchar_t window[256];
@@ -1087,58 +1087,58 @@ void CManagerDlg::OnApplyModes(CCtrlButton*) CMString appendixremove = L"";
if (wi->pszMode && wcschr(wi->pszMode, 't')) {
if (!m_check1.GetState())
- mir_tstrcat(toremove, L"t");
+ mir_wstrcat(toremove, L"t");
}
else if (m_check1.GetState())
- mir_tstrcat(toadd, L"t");
+ mir_wstrcat(toadd, L"t");
if (wi->pszMode && wcschr(wi->pszMode, 'n')) {
if (!m_check2.GetState())
- mir_tstrcat(toremove, L"n");
+ mir_wstrcat(toremove, L"n");
}
else if (m_check2.GetState())
- mir_tstrcat(toadd, L"n");
+ mir_wstrcat(toadd, L"n");
if (wi->pszMode && wcschr(wi->pszMode, 'i')) {
if (!m_check3.GetState())
- mir_tstrcat(toremove, L"i");
+ mir_wstrcat(toremove, L"i");
}
else if (m_check3.GetState())
- mir_tstrcat(toadd, L"i");
+ mir_wstrcat(toadd, L"i");
if (wi->pszMode && wcschr(wi->pszMode, 'm')) {
if (!m_check4.GetState())
- mir_tstrcat(toremove, L"m");
+ mir_wstrcat(toremove, L"m");
}
else if (m_check4.GetState())
- mir_tstrcat(toadd, L"m");
+ mir_wstrcat(toadd, L"m");
if (wi->pszMode && wcschr(wi->pszMode, 'p')) {
if (!m_check7.GetState())
- mir_tstrcat(toremove, L"p");
+ mir_wstrcat(toremove, L"p");
}
else if (m_check7.GetState())
- mir_tstrcat(toadd, L"p");
+ mir_wstrcat(toadd, L"p");
if (wi->pszMode && wcschr(wi->pszMode, 's')) {
if (!m_check8.GetState())
- mir_tstrcat(toremove, L"s");
+ mir_wstrcat(toremove, L"s");
}
else if (m_check8.GetState())
- mir_tstrcat(toadd, L"s");
+ mir_wstrcat(toadd, L"s");
if (wi->pszMode && wcschr(wi->pszMode, 'c')) {
if (!m_check9.GetState())
- mir_tstrcat(toremove, L"c");
+ mir_wstrcat(toremove, L"c");
}
else if (m_check9.GetState())
- mir_tstrcat(toadd, L"c");
+ mir_wstrcat(toadd, L"c");
CMString Key = L"";
CMString Limit = L"";
if (wi->pszMode && wi->pszPassword && wcschr(wi->pszMode, 'k')) {
if (!m_check5.GetState()) {
- mir_tstrcat(toremove, L"k");
+ mir_wstrcat(toremove, L"k");
appendixremove += L" " + CMString(wi->pszPassword);
}
else if (GetWindowTextLength(m_key.GetHwnd())) {
@@ -1146,15 +1146,15 @@ void CManagerDlg::OnApplyModes(CCtrlButton*) m_key.GetText(temp, 14);
if (Key != temp) {
- mir_tstrcat(toremove, L"k");
- mir_tstrcat(toadd, L"k");
+ mir_wstrcat(toremove, L"k");
+ mir_wstrcat(toadd, L"k");
appendixadd += L" " + CMString(temp);
appendixremove += L" " + CMString(wi->pszPassword);
}
}
}
else if (m_check5.GetState() && GetWindowTextLength(m_key.GetHwnd())) {
- mir_tstrcat(toadd, L"k");
+ mir_wstrcat(toadd, L"k");
appendixadd += L" ";
wchar_t temp[400];
@@ -1164,18 +1164,18 @@ void CManagerDlg::OnApplyModes(CCtrlButton*) if (wcschr(wi->pszMode, 'l')) {
if (!m_check6.GetState())
- mir_tstrcat(toremove, L"l");
+ mir_wstrcat(toremove, L"l");
else if (GetWindowTextLength(GetDlgItem(m_hwnd, IDC_LIMIT))) {
wchar_t temp[15];
GetDlgItemText(m_hwnd, IDC_LIMIT, temp, _countof(temp));
- if (wi->pszLimit && mir_tstrcmpi(wi->pszLimit, temp)) {
- mir_tstrcat(toadd, L"l");
+ if (wi->pszLimit && mir_wstrcmpi(wi->pszLimit, temp)) {
+ mir_wstrcat(toadd, L"l");
appendixadd += L" " + CMString(temp);
}
}
}
else if (m_check6.GetState() && GetWindowTextLength(m_limit.GetHwnd())) {
- mir_tstrcat(toadd, L"l");
+ mir_wstrcat(toadd, L"l");
appendixadd += L" ";
wchar_t temp[15];
@@ -1183,19 +1183,19 @@ void CManagerDlg::OnApplyModes(CCtrlButton*) appendixadd += temp;
}
- if (mir_tstrlen(toadd) || mir_tstrlen(toremove)) {
+ if (mir_wstrlen(toadd) || mir_wstrlen(toremove)) {
wchar_t temp[500];
- mir_tstrcpy(temp, L"/mode ");
- mir_tstrcat(temp, window);
- mir_tstrcat(temp, L" ");
- if (mir_tstrlen(toremove))
- mir_sntprintf(temp, L"%s-%s", temp, toremove);
- if (mir_tstrlen(toadd))
- mir_sntprintf(temp, L"%s+%s", temp, toadd);
+ mir_wstrcpy(temp, L"/mode ");
+ mir_wstrcat(temp, window);
+ mir_wstrcat(temp, L" ");
+ if (mir_wstrlen(toremove))
+ mir_snwprintf(temp, L"%s-%s", temp, toremove);
+ if (mir_wstrlen(toadd))
+ mir_snwprintf(temp, L"%s+%s", temp, toadd);
if (!appendixremove.IsEmpty())
- mir_tstrcat(temp, appendixremove.c_str());
+ mir_wstrcat(temp, appendixremove.c_str());
if (!appendixadd.IsEmpty())
- mir_tstrcat(temp, appendixadd.c_str());
+ mir_wstrcat(temp, appendixadd.c_str());
m_proto->PostIrcMessage(temp);
}
}
@@ -1246,11 +1246,11 @@ void CManagerDlg::ApplyQuestion() GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
wchar_t mode[3];
- mir_tstrcpy(mode, L"+b");
+ mir_wstrcpy(mode, L"+b");
if (m_radio2.GetState())
- mir_tstrcpy(mode, L"+I");
+ mir_wstrcpy(mode, L"+I");
if (m_radio3.GetState())
- mir_tstrcpy(mode, L"+e");
+ mir_wstrcpy(mode, L"+e");
m_list.ResetContent();
m_radio1.Disable();
m_radio2.Disable();
@@ -1278,9 +1278,9 @@ void CManagerDlg::InitManager(int mode, const wchar_t* window) if (wi) {
if (m_proto->IsConnected()) {
wchar_t temp[1000];
- mir_sntprintf(temp, L"Topic%s%s", window, m_proto->m_info.sNetwork.c_str());
+ mir_snwprintf(temp, L"Topic%s%s", window, m_proto->m_info.sNetwork.c_str());
- char* p = mir_t2a(temp);
+ char* p = mir_u2a(temp);
DBVARIANT dbv;
if (!m_proto->getTString(p, &dbv)) {
diff --git a/protocols/IcqOscarJ/src/dlgproc.cpp b/protocols/IcqOscarJ/src/dlgproc.cpp index 9a99841d22..cf1a1a8f1c 100644 --- a/protocols/IcqOscarJ/src/dlgproc.cpp +++ b/protocols/IcqOscarJ/src/dlgproc.cpp @@ -465,7 +465,7 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM for (done = 0, i = 0; i < _countof(dat->hUpload); i++)
done += dat->hUpload[i] == NULL;
wchar_t buf[MAX_PATH];
- mir_sntprintf(buf, TranslateT("Upload in progress...%d%%"), 100 * done / (_countof(dat->hUpload)));
+ mir_snwprintf(buf, TranslateT("Upload in progress...%d%%"), 100 * done / (_countof(dat->hUpload)));
SetDlgItemText(hwndDlg, IDC_UPLOADING, buf);
if (done < _countof(dat->hUpload)) break;
diff --git a/protocols/IcqOscarJ/src/fam_03buddy.cpp b/protocols/IcqOscarJ/src/fam_03buddy.cpp index 4a86609b9e..f78ba6541c 100644 --- a/protocols/IcqOscarJ/src/fam_03buddy.cpp +++ b/protocols/IcqOscarJ/src/fam_03buddy.cpp @@ -692,7 +692,7 @@ void CIcqProto::parseStatusNote(DWORD dwUin, char *szUid, MCONTACT hContact, osc if (getContactXStatus(hContact) != 0 || !CheckContactCapabilities(hContact, CAPF_STATUS_MESSAGES)) {
setStatusMsgVar(hContact, szStatusNote, false);
- wchar_t *tszNote = mir_utf8decodeT(szStatusNote);
+ wchar_t *tszNote = mir_utf8decodeW(szStatusNote);
ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, NULL, (LPARAM)tszNote);
mir_free(tszNote);
}
diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp index 3d03ed6f43..c2cc01818e 100644 --- a/protocols/IcqOscarJ/src/icq_avatar.cpp +++ b/protocols/IcqOscarJ/src/icq_avatar.cpp @@ -76,7 +76,7 @@ void CIcqProto::GetFullAvatarFileName(int dwUin, const char *szUid, int dwFormat void CIcqProto::GetAvatarFileName(int dwUin, const char *szUid, wchar_t *pszDest, size_t cbLen)
{
wchar_t szPath[MAX_PATH * 2];
- mir_sntprintf(szPath, L"%s\\%S\\", VARST(L"%miranda_avatarcache%"), m_szModuleName);
+ mir_snwprintf(szPath, L"%s\\%S\\", VARST(L"%miranda_avatarcache%"), m_szModuleName);
FOLDERSGETDATA fgd = { sizeof(fgd) };
fgd.nMaxPathSize = _countof(szPath);
@@ -84,8 +84,8 @@ void CIcqProto::GetAvatarFileName(int dwUin, const char *szUid, wchar_t *pszDest fgd.flags = FF_TCHAR;
// fill the destination
- mir_tstrncpy(pszDest, szPath, cbLen - 1);
- size_t tPathLen = mir_tstrlen(pszDest);
+ mir_wstrncpy(pszDest, szPath, cbLen - 1);
+ size_t tPathLen = mir_wstrlen(pszDest);
// make sure the avatar cache directory exists
CreateDirectoryTreeT(szPath);
@@ -93,21 +93,21 @@ void CIcqProto::GetAvatarFileName(int dwUin, const char *szUid, wchar_t *pszDest if (dwUin != 0)
_ltow(dwUin, pszDest + tPathLen, 10);
else if (szUid) {
- wchar_t* p = mir_a2t(szUid);
- mir_tstrcpy(pszDest + tPathLen, p);
+ wchar_t* p = mir_a2u(szUid);
+ mir_wstrcpy(pszDest + tPathLen, p);
mir_free(p);
}
else {
wchar_t szBuf[MAX_PATH];
if (CallService(MS_DB_GETPROFILENAMET, MAX_PATH, (LPARAM)szBuf))
- mir_tstrcpy(pszDest + tPathLen, L"avatar");
+ mir_wstrcpy(pszDest + tPathLen, L"avatar");
else {
wchar_t *szLastDot = wcsrchr(szBuf, '.');
if (szLastDot)
szLastDot[0] = '\0';
- mir_tstrcpy(pszDest + tPathLen, szBuf);
- mir_tstrcat(pszDest + tPathLen, L"_avt");
+ mir_wstrcpy(pszDest + tPathLen, szBuf);
+ mir_wstrcat(pszDest + tPathLen, L"_avt");
}
}
}
@@ -115,7 +115,7 @@ void CIcqProto::GetAvatarFileName(int dwUin, const char *szUid, wchar_t *pszDest void AddAvatarExt(int dwFormat, wchar_t *pszDest)
{
const wchar_t *ext = ProtoGetAvatarExtension(dwFormat);
- mir_tstrcat(pszDest, (*ext == 0) ? L".dat" : ext);
+ mir_wstrcat(pszDest, (*ext == 0) ? L".dat" : ext);
}
#define MD5_BLOCK_SIZE 1024*1024 /* use 1MB blocks */
@@ -1159,7 +1159,7 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, size_t wBufferLen PROTO_AVATAR_INFORMATION ai = { 0 };
ai.format = PA_FORMAT_JPEG; // this is for error only
ai.hContact = pCookieData->hContact;
- mir_tstrncpy(ai.filename, pCookieData->szFile, _countof(ai.filename));
+ mir_wstrncpy(ai.filename, pCookieData->szFile, _countof(ai.filename));
AddAvatarExt(PA_FORMAT_JPEG, ai.filename);
ppro->FreeCookie(pSnacHeader->dwRef);
@@ -1212,11 +1212,11 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, size_t wBufferLen const wchar_t *ptszExt;
int dwPaFormat = ProtoGetBufferFormat(pBuffer, &ptszExt);
wchar_t tszImageFile[MAX_PATH];
- mir_sntprintf(tszImageFile, L"%s%s", pCookieData->szFile, ptszExt);
+ mir_snwprintf(tszImageFile, L"%s%s", pCookieData->szFile, ptszExt);
ppro->setByte(pCookieData->hContact, "AvatarType", (BYTE)dwPaFormat);
ai.format = dwPaFormat; // set the format
- mir_tstrncpy(ai.filename, tszImageFile, _countof(ai.filename));
+ mir_wstrncpy(ai.filename, tszImageFile, _countof(ai.filename));
int out = _wopen(tszImageFile, _O_BINARY | _O_CREAT | _O_TRUNC | _O_WRONLY, _S_IREAD | _S_IWRITE);
if (out != -1) {
diff --git a/protocols/IcqOscarJ/src/icq_filerequests.cpp b/protocols/IcqOscarJ/src/icq_filerequests.cpp index e993445c08..93382f6b04 100644 --- a/protocols/IcqOscarJ/src/icq_filerequests.cpp +++ b/protocols/IcqOscarJ/src/icq_filerequests.cpp @@ -152,13 +152,13 @@ void CIcqProto::handleFileRequest(PBYTE buf, DWORD dwUin, DWORD dwCookie, DWORD ft->bEmptyDesc = bEmptyDesc;
// Send chain event
- wchar_t* ptszFileName = mir_utf8decodeT(pszFileName);
+ wchar_t* ptszFileName = mir_utf8decodeW(pszFileName);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.descr.w = mir_utf8decodeT(pszDescription);
+ pre.descr.w = mir_utf8decodeW(pszDescription);
pre.files.w = &ptszFileName;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(hContact, &pre);
diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index 7843f50a10..0c755f0d79 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -158,7 +158,7 @@ CIcqProto::CIcqProto(const char* aProtoName, const wchar_t* aUserName) : // Register netlib users
NETLIBUSER nlu = { 0 };
wchar_t szBuffer[MAX_PATH + 64];
- mir_sntprintf(szBuffer, TranslateT("%s server connection"), m_tszUserName);
+ mir_snwprintf(szBuffer, TranslateT("%s server connection"), m_tszUserName);
nlu.cbSize = sizeof(nlu);
nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
nlu.ptszDescriptiveName = szBuffer;
@@ -173,7 +173,7 @@ CIcqProto::CIcqProto(const char* aProtoName, const wchar_t* aUserName) : char szP2PModuleName[MAX_PATH];
mir_snprintf(szP2PModuleName, "%sP2P", m_szModuleName);
- mir_sntprintf(szBuffer, TranslateT("%s client-to-client connections"), m_tszUserName);
+ mir_snwprintf(szBuffer, TranslateT("%s client-to-client connections"), m_tszUserName);
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_TCHAR;
nlu.ptszDescriptiveName = szBuffer;
nlu.szSettingsModule = szP2PModuleName;
@@ -1644,7 +1644,7 @@ void __cdecl CIcqProto::GetAwayMsgThread(void *pStatusData) setStatusMsgVar(pThreadData->hContact, pThreadData->szMessage, false);
- wchar_t *tszMsg = mir_utf8decodeT(pThreadData->szMessage);
+ wchar_t *tszMsg = mir_utf8decodeW(pThreadData->szMessage);
ProtoBroadcastAck(pThreadData->hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, pThreadData->hProcess, (LPARAM)tszMsg);
mir_free(tszMsg);
@@ -1743,7 +1743,7 @@ int __cdecl CIcqProto::RecvAwayMsg(MCONTACT hContact, int, PROTORECVEVENT* evt) {
setStatusMsgVar(hContact, evt->szMessage, false);
- wchar_t* pszMsg = mir_utf8decodeT(evt->szMessage);
+ wchar_t* pszMsg = mir_utf8decodeW(evt->szMessage);
ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)evt->lParam, (LPARAM)pszMsg);
mir_free(pszMsg);
return 0;
diff --git a/protocols/IcqOscarJ/src/icq_servlist.cpp b/protocols/IcqOscarJ/src/icq_servlist.cpp index 4c91d239ac..856c8327c9 100644 --- a/protocols/IcqOscarJ/src/icq_servlist.cpp +++ b/protocols/IcqOscarJ/src/icq_servlist.cpp @@ -1386,7 +1386,7 @@ int CIcqProto::getCListGroupExists(const char *szGroup) break;
// we have found the group
- if (!mir_tstrcmp(tszGroup, tszGroupName))
+ if (!mir_wstrcmp(tszGroup, tszGroupName))
return i;
}
@@ -1396,7 +1396,7 @@ int CIcqProto::getCListGroupExists(const char *szGroup) int CIcqProto::moveContactToCListGroup(MCONTACT hContact, const char *szGroup)
{
- MGROUP hGroup = Clist_GroupCreate(0, ptrT(mir_utf8decodeT(szGroup)));
+ MGROUP hGroup = Clist_GroupCreate(0, ptrW(mir_utf8decodeW(szGroup)));
return CallService(MS_CLIST_CONTACTCHANGEGROUP, hContact, hGroup);
}
diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp index ecc192ac4d..52f532436f 100644 --- a/protocols/IcqOscarJ/src/icq_xstatus.cpp +++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp @@ -125,15 +125,15 @@ static HANDLE LoadXStatusIconLibrary(wchar_t *path, const wchar_t *sub) wchar_t* p = wcsrchr(path, '\\');
HANDLE hLib;
- mir_tstrcpy(p, sub);
- mir_tstrcat(p, L"\\xstatus_ICQ.dll");
+ mir_wstrcpy(p, sub);
+ mir_wstrcat(p, L"\\xstatus_ICQ.dll");
if (hLib = LoadLibrary(path))
return hLib;
- mir_tstrcpy(p, sub);
- mir_tstrcat(p, L"\\xstatus_icons.dll");
+ mir_wstrcpy(p, sub);
+ mir_wstrcat(p, L"\\xstatus_icons.dll");
if (hLib = LoadLibrary(path))
return hLib;
- mir_tstrcpy(p, L"\\");
+ mir_wstrcpy(p, L"\\");
return hLib;
}
@@ -852,7 +852,7 @@ void CIcqProto::InitXStatusItems(BOOL bAllowStatus) HGENMENU hRoot;
{
wchar_t szItem[MAX_PATH + 64];
- mir_sntprintf(szItem, TranslateT("%s Custom Status"), m_tszUserName);
+ mir_snwprintf(szItem, TranslateT("%s Custom Status"), m_tszUserName);
CMenuItem mi;
mi.root = pcli->pfnGetProtocolMenu(m_szModuleName);
diff --git a/protocols/IcqOscarJ/src/icqosc_svcs.cpp b/protocols/IcqOscarJ/src/icqosc_svcs.cpp index a2c40d3b83..d8e50a1837 100644 --- a/protocols/IcqOscarJ/src/icqosc_svcs.cpp +++ b/protocols/IcqOscarJ/src/icqosc_svcs.cpp @@ -352,7 +352,7 @@ INT_PTR CIcqProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) GetFullAvatarFileName(dwUIN, szUID, dwPaFormat, tszFile, MAX_PATH * 2);
- mir_tstrncpy(pai->filename, tszFile, _countof(pai->filename)); // Avatar API does not support unicode :-(
+ mir_wstrncpy(pai->filename, tszFile, _countof(pai->filename)); // Avatar API does not support unicode :-(
pai->format = dwPaFormat;
if (!IsAvatarChanged(pai->hContact, dbv.pbVal, dbv.cpbVal)) { // hashes are the same
@@ -370,7 +370,7 @@ INT_PTR CIcqProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) GetAvatarFileName(dwUIN, szUID, tszFile, MAX_PATH * 2);
GetAvatarData(pai->hContact, dwUIN, szUID, dbv.pbVal, dbv.cpbVal, tszFile);
- mir_tstrncpy(pai->filename, tszFile, _countof(pai->filename)); // Avatar API does not support unicode :-(
+ mir_wstrncpy(pai->filename, tszFile, _countof(pai->filename)); // Avatar API does not support unicode :-(
db_free(&dbv);
@@ -501,7 +501,7 @@ INT_PTR CIcqProto::SetMyAvatar(WPARAM, LPARAM lParam) GetFullAvatarFileName(0, NULL, dwPaFormat, tszMyFile, MAX_PATH);
// if not in our storage, copy
- if (mir_tstrcmp(tszFile, tszMyFile) && !CopyFile(tszFile, tszMyFile, FALSE)) {
+ if (mir_wstrcmp(tszFile, tszMyFile) && !CopyFile(tszFile, tszMyFile, FALSE)) {
debugLogA("Failed to copy our avatar to local storage.");
return -1;
}
diff --git a/protocols/IcqOscarJ/src/loginpassword.cpp b/protocols/IcqOscarJ/src/loginpassword.cpp index 253bb1b843..8d37efc053 100644 --- a/protocols/IcqOscarJ/src/loginpassword.cpp +++ b/protocols/IcqOscarJ/src/loginpassword.cpp @@ -41,7 +41,7 @@ INT_PTR CALLBACK LoginPasswdDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA DWORD dwUin = ppro->getContactUin(NULL);
wchar_t pszUIN[MAX_PATH];
- mir_sntprintf(pszUIN, TranslateT("Enter a password for UIN %u:"), dwUin);
+ mir_snwprintf(pszUIN, TranslateT("Enter a password for UIN %u:"), dwUin);
SetDlgItemText(hwndDlg, IDC_INSTRUCTION, pszUIN);
SendDlgItemMessage(hwndDlg, IDC_LOGINPW, EM_LIMITTEXT, PASSWORDMAXLEN - 1, 0);
diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp index be3dae1b0d..fdfa9da536 100644 --- a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp +++ b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp @@ -497,13 +497,13 @@ void CIcqProto::handleRecvServMsgOFT(BYTE *buf, size_t wLen, DWORD dwUin, char * mir_strcpy(szBlob + sizeof(DWORD), pszFileName);
mir_strcpy(szBlob + sizeof(DWORD) + mir_strlen(pszFileName) + 1, pszDescription);
- wchar_t* ptszFileName = mir_utf8decodeT(pszFileName);
+ wchar_t* ptszFileName = mir_utf8decodeW(pszFileName);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.descr.w = mir_utf8decodeT(pszDescription);
+ pre.descr.w = mir_utf8decodeW(pszDescription);
pre.files.w = &ptszFileName;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(ft->hContact, &pre);
diff --git a/protocols/IcqOscarJ/src/userinfotab.cpp b/protocols/IcqOscarJ/src/userinfotab.cpp index 207ff0fe32..25ba1d7e98 100644 --- a/protocols/IcqOscarJ/src/userinfotab.cpp +++ b/protocols/IcqOscarJ/src/userinfotab.cpp @@ -279,7 +279,7 @@ int CIcqProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) if (!lParam) {
wchar_t buf[200];
- mir_sntprintf(buf, TranslateT("%s Details"), m_tszUserName);
+ mir_snwprintf(buf, TranslateT("%s Details"), m_tszUserName);
odp.pwszTitle = buf;
odp.position = -1899999999;
diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp index 75c4f3dfab..c074e502ef 100644 --- a/protocols/JabberG/src/jabber.cpp +++ b/protocols/JabberG/src/jabber.cpp @@ -75,7 +75,7 @@ bool bSecureIM, bMirOTR, bNewGPG, bPlatform; // Protocol instances
static int sttCompareProtocols(const CJabberProto *p1, const CJabberProto *p2)
{
- return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName);
+ return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName);
}
LIST<CJabberProto> g_Instances(1, sttCompareProtocols);
@@ -135,7 +135,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) fontid.deffontsettings.charset = DEFAULT_CHARSET;
fontid.deffontsettings.colour = GetSysColor(COLOR_WINDOWTEXT);
fontid.deffontsettings.size = -11;
- mir_tstrncpy(fontid.deffontsettings.szFace, L"MS Shell Dlg", _countof(fontid.deffontsettings.szFace));
+ mir_wstrncpy(fontid.deffontsettings.szFace, L"MS Shell Dlg", _countof(fontid.deffontsettings.szFace));
fontid.deffontsettings.style = 0;
wcsncpy_s(fontid.name, LPGENW("Frame title"), _TRUNCATE);
@@ -195,7 +195,7 @@ extern "C" int __declspec(dllexport) Load() WORD v[4];
CallService(MS_SYSTEM_GETFILEVERSION, 0, (LPARAM)v);
- mir_sntprintf(szCoreVersion, L"%d.%d.%d.%d", v[0], v[1], v[2], v[3]);
+ mir_snwprintf(szCoreVersion, L"%d.%d.%d.%d", v[0], v[1], v[2], v[3]);
CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&g_cbCountries, (LPARAM)&g_countries);
@@ -235,13 +235,13 @@ extern "C" int __declspec(dllexport) Unload(void) if (g_nTempFileId != 0) {
wchar_t tszTempPath[MAX_PATH], tszFilePath[MAX_PATH];
GetTempPath(_countof(tszTempPath), tszTempPath);
- mir_sntprintf(tszFilePath, L"%sjab*.tmp.*", tszTempPath);
+ mir_snwprintf(tszFilePath, L"%sjab*.tmp.*", tszTempPath);
WIN32_FIND_DATA findData;
HANDLE hFind = FindFirstFile(tszFilePath, &findData);
if (hFind != INVALID_HANDLE_VALUE) {
do {
- mir_sntprintf(tszFilePath, L"%s%s", tszTempPath, findData.cFileName);
+ mir_snwprintf(tszFilePath, L"%s%s", tszTempPath, findData.cFileName);
DeleteFile(tszFilePath);
} while (FindNextFile(hFind, &findData));
diff --git a/protocols/JabberG/src/jabber_adhoc.cpp b/protocols/JabberG/src/jabber_adhoc.cpp index ea2d3c6748..e29f3fde4e 100644 --- a/protocols/JabberG/src/jabber_adhoc.cpp +++ b/protocols/JabberG/src/jabber_adhoc.cpp @@ -143,7 +143,7 @@ int CJabberProto::AdHoc_OnJAHMCommandListResult(HWND hwndDlg, HXML iqNode, Jabbe {
int nodeIdx = 0;
const wchar_t * type = XmlGetAttrValue(iqNode, L"type");
- if (!type || !mir_tstrcmp(type, L"error")) {
+ if (!type || !mir_wstrcmp(type, L"error")) {
// error occurred here
wchar_t buff[255];
const wchar_t *code = NULL;
@@ -154,10 +154,10 @@ int CJabberProto::AdHoc_OnJAHMCommandListResult(HWND hwndDlg, HXML iqNode, Jabbe code = XmlGetAttrValue(errorNode, L"code");
description = XmlGetText(errorNode);
}
- mir_sntprintf(buff, TranslateT("Error %s %s"), (code) ? code : L"", (description) ? description : L"");
+ mir_snwprintf(buff, TranslateT("Error %s %s"), (code) ? code : L"", (description) ? description : L"");
JabberFormSetInstruction(hwndDlg, buff);
}
- else if (!mir_tstrcmp(type, L"result")) {
+ else if (!mir_wstrcmp(type, L"result")) {
BOOL validResponse = FALSE;
EnumChildWindows(GetDlgItem(hwndDlg, IDC_FRAME), sttDeleteChildWindowsProc, 0);
dat->CurrentHeight = 0;
@@ -167,7 +167,7 @@ int CJabberProto::AdHoc_OnJAHMCommandListResult(HWND hwndDlg, HXML iqNode, Jabbe if (queryNode) {
const wchar_t *xmlns = XmlGetAttrValue(queryNode, L"xmlns");
const wchar_t *node = XmlGetAttrValue(queryNode, L"node");
- if (xmlns && node && !mir_tstrcmp(xmlns, JABBER_FEAT_DISCO_ITEMS) && !mir_tstrcmp(node, JABBER_FEAT_COMMANDS))
+ if (xmlns && node && !mir_wstrcmp(xmlns, JABBER_FEAT_DISCO_ITEMS) && !mir_wstrcmp(node, JABBER_FEAT_COMMANDS))
validResponse = TRUE;
}
if (queryNode && XmlGetChild(queryNode, 0) && validResponse) {
@@ -213,7 +213,7 @@ int CJabberProto::AdHoc_OnJAHMProcessResult(HWND hwndDlg, HXML workNode, JabberA const wchar_t *type;
if ((type = XmlGetAttrValue(workNode, L"type")) == NULL) return TRUE;
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
// wParam = <iq/> node from responder as a result of command execution
HXML commandNode, xNode;
if ((commandNode = XmlGetChild(dat->AdHocNode, L"command")) == NULL)
@@ -264,12 +264,12 @@ int CJabberProto::AdHoc_OnJAHMProcessResult(HWND hwndDlg, HXML workNode, JabberA EnableDlgItem(hwndDlg, IDC_SUBMIT, TRUE);
}
- if (!status || mir_tstrcmp(status, L"executing")) {
+ if (!status || mir_wstrcmp(status, L"executing")) {
ShowDlgItem(hwndDlg, IDC_SUBMIT, SW_HIDE);
SetDlgItemText(hwndDlg, IDCANCEL, TranslateT("Done"));
}
}
- else if (!mir_tstrcmp(type, L"error")) {
+ else if (!mir_wstrcmp(type, L"error")) {
// error occurred here
int toHide[] = { IDC_FRAME, IDC_FRAME_TEXT, IDC_VSCROLL, IDC_PREV, IDC_NEXT, IDC_COMPLETE, IDC_SUBMIT, 0};
sttShowControls(hwndDlg, FALSE, toHide);
@@ -282,7 +282,7 @@ int CJabberProto::AdHoc_OnJAHMProcessResult(HWND hwndDlg, HXML workNode, JabberA code = XmlGetAttrValue(errorNode, L"code");
description = XmlGetText(errorNode);
}
- mir_sntprintf(buff, TranslateT("Error %s %s"), code ? code : L"", description ? description : L"");
+ mir_snwprintf(buff, TranslateT("Error %s %s"), code ? code : L"", description ? description : L"");
JabberFormSetInstruction(hwndDlg,buff);
}
JabberAdHoc_RefreshFrameScroll(hwndDlg, dat);
@@ -354,7 +354,7 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA dat = (JabberAdHocData*)mir_calloc(sizeof(JabberAdHocData));
{
CJabberAdhocStartupParams* pStartupParams = (CJabberAdhocStartupParams *)lParam;
- dat->ResponderJID = mir_tstrdup(pStartupParams->m_szJid);
+ dat->ResponderJID = mir_wstrdup(pStartupParams->m_szJid);
dat->proto = pStartupParams->m_pProto;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
@@ -385,7 +385,7 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA dat->proto->AdHoc_RequestListOfCommands(pStartupParams->m_szJid, hwndDlg);
wchar_t Caption[512];
- mir_sntprintf(Caption, TranslateT("Jabber Ad-Hoc commands at %s"), dat->ResponderJID);
+ mir_snwprintf(Caption, TranslateT("Jabber Ad-Hoc commands at %s"), dat->ResponderJID);
SetWindowText(hwndDlg, Caption);
}
else {
@@ -398,7 +398,7 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA SetDlgItemText(hwndDlg, IDC_SUBMIT, TranslateT("OK"));
wchar_t Caption[512];
- mir_sntprintf(Caption, TranslateT("Sending Ad-Hoc command to %s"), dat->ResponderJID);
+ mir_snwprintf(Caption, TranslateT("Sending Ad-Hoc command to %s"), dat->ResponderJID);
SetWindowText(hwndDlg, Caption);
}
@@ -513,7 +513,7 @@ int __cdecl CJabberProto::ContactMenuRunCommands(WPARAM hContact, LPARAM lParam) int res = -1;
if ((hContact != NULL || lParam != 0) && m_bJabberOnline) {
- ptrT szJid(getTStringA(hContact, "jid"));
+ ptrW szJid(getTStringA(hContact, "jid"));
if (hContact && szJid != NULL) {
JABBER_LIST_ITEM *item = NULL;
int selected = 0;
@@ -541,8 +541,8 @@ int __cdecl CJabberProto::ContactMenuRunCommands(WPARAM hContact, LPARAM lParam) if (selected > 0) {
JABBER_RESOURCE_STATUS *r = item->arResources[selected - 1];
if (r) {
- mir_tstrncat(jid, L"/", _countof(jid) - mir_tstrlen(jid));
- mir_tstrncat(jid, r->m_tszResourceName, _countof(jid) - mir_tstrlen(jid));
+ mir_wstrncat(jid, L"/", _countof(jid) - mir_wstrlen(jid));
+ mir_wstrncat(jid, r->m_tszResourceName, _countof(jid) - mir_wstrlen(jid));
}
selected = 1;
}
diff --git a/protocols/JabberG/src/jabber_agent.cpp b/protocols/JabberG/src/jabber_agent.cpp index a09ad50983..2e8654f265 100644 --- a/protocols/JabberG/src/jabber_agent.cpp +++ b/protocols/JabberG/src/jabber_agent.cpp @@ -169,13 +169,13 @@ public: break;
if (XmlGetName(n)) {
- if (!mir_tstrcmp(XmlGetName(n), L"instructions")) {
+ if (!mir_wstrcmp(XmlGetName(n), L"instructions")) {
JabberFormSetInstruction(m_hwnd, XmlGetText(n));
}
- else if (!mir_tstrcmp(XmlGetName(n), L"key") || !mir_tstrcmp(XmlGetName(n), L"registered")) {
+ else if (!mir_wstrcmp(XmlGetName(n), L"key") || !mir_wstrcmp(XmlGetName(n), L"registered")) {
// do nothing
}
- else if (!mir_tstrcmp(XmlGetName(n), L"password"))
+ else if (!mir_wstrcmp(XmlGetName(n), L"password"))
JabberFormAppendControl(hFrame, layout_info, JFORM_CTYPE_TEXT_PRIVATE, XmlGetName(n), XmlGetText(n));
else // everything else is a normal text field
JabberFormAppendControl(hFrame, layout_info, JFORM_CTYPE_TEXT_SINGLE, XmlGetName(n), XmlGetText(n));
@@ -253,14 +253,14 @@ public: break;
if (XmlGetName(n)) {
- if (!mir_tstrcmp(XmlGetName(n), L"key")) {
+ if (!mir_wstrcmp(XmlGetName(n), L"key")) {
// field that must be passed along with the registration
if (XmlGetText(n))
XmlAddChild(query, XmlGetName(n), XmlGetText(n));
else
XmlAddChild(query, XmlGetName(n));
}
- else if (!mir_tstrcmp(XmlGetName(n), L"registered") || !mir_tstrcmp(XmlGetName(n), L"instructions")) {
+ else if (!mir_wstrcmp(XmlGetName(n), L"registered") || !mir_wstrcmp(XmlGetName(n), L"instructions")) {
// do nothing, we will skip these
}
else {
diff --git a/protocols/JabberG/src/jabber_api.cpp b/protocols/JabberG/src/jabber_api.cpp index a144c1324d..167c518bdc 100644 --- a/protocols/JabberG/src/jabber_api.cpp +++ b/protocols/JabberG/src/jabber_api.cpp @@ -67,9 +67,9 @@ LPTSTR CJabberProto::GetBestResourceName(LPCTSTR jid) LPCTSTR p = wcschr(jid, '/');
if (p == NULL) {
mir_cslock lck(m_csLists);
- return mir_tstrdup(ListGetBestClientResourceNamePtr(jid));
+ return mir_wstrdup(ListGetBestClientResourceNamePtr(jid));
}
- return mir_tstrdup(jid);
+ return mir_wstrdup(jid);
}
LPTSTR CJabberProto::GetResourceList(LPCTSTR jid)
@@ -94,7 +94,7 @@ LPTSTR CJabberProto::GetResourceList(LPCTSTR jid) }
res.AppendChar(0);
- return mir_tstrndup(res, res.GetLength());
+ return mir_wstrndup(res, res.GetLength());
}
char *CJabberProto::GetModuleName() const
@@ -199,7 +199,7 @@ int CJabberProto::RemoveHandler(HJHANDLER hHandler) JabberFeatCapPairDynamic *CJabberProto::FindFeature(LPCTSTR szFeature)
{
for (int i=0; i < m_lstJabberFeatCapPairsDynamic.getCount(); i++)
- if (!mir_tstrcmp(m_lstJabberFeatCapPairsDynamic[i]->szFeature, szFeature))
+ if (!mir_wstrcmp(m_lstJabberFeatCapPairsDynamic[i]->szFeature, szFeature))
return m_lstJabberFeatCapPairsDynamic[i];
return NULL;
@@ -213,7 +213,7 @@ int CJabberProto::RegisterFeature(LPCTSTR szFeature, LPCTSTR szDescription) // check for this feature in core features, and return false if it's present, to prevent re-registering a core feature
int i;
for (i=0; g_JabberFeatCapPairs[i].szFeature; i++)
- if (!mir_tstrcmp(g_JabberFeatCapPairs[i].szFeature, szFeature))
+ if (!mir_wstrcmp(g_JabberFeatCapPairs[i].szFeature, szFeature))
return false;
mir_cslock lck(m_csLists);
@@ -237,7 +237,7 @@ int CJabberProto::RegisterFeature(LPCTSTR szFeature, LPCTSTR szDescription) return false;
// remove unnecessary symbols from szFeature to make the string shorter, and use it as szExt
- LPTSTR szExt = mir_tstrdup(szFeature);
+ LPTSTR szExt = mir_wstrdup(szFeature);
LPTSTR pSrc, pDst;
for (pSrc = szExt, pDst = szExt; *pSrc; pSrc++)
if (wcschr(L"bcdfghjklmnpqrstvwxz0123456789", *pSrc))
@@ -247,15 +247,15 @@ int CJabberProto::RegisterFeature(LPCTSTR szFeature, LPCTSTR szDescription) fcp = new JabberFeatCapPairDynamic();
fcp->szExt = szExt; // will be deallocated along with other values of JabberFeatCapPairDynamic in CJabberProto destructor
- fcp->szFeature = mir_tstrdup(szFeature);
- fcp->szDescription = szDescription ? mir_tstrdup(szDescription) : NULL;
+ fcp->szFeature = mir_wstrdup(szFeature);
+ fcp->szDescription = szDescription ? mir_wstrdup(szDescription) : NULL;
fcp->jcbCap = jcb;
m_lstJabberFeatCapPairsDynamic.insert(fcp);
}
else if (szDescription) { // update description
if (fcp->szDescription)
mir_free(fcp->szDescription);
- fcp->szDescription = mir_tstrdup(szDescription);
+ fcp->szDescription = mir_wstrdup(szDescription);
}
return true;
}
@@ -281,7 +281,7 @@ int CJabberProto::AddFeatures(LPCTSTR szFeatures) m_uEnabledFeatCapsDynamic |= fcp->jcbCap;
else
ret = false;
- szFeat += mir_tstrlen(szFeat) + 1;
+ szFeat += mir_wstrlen(szFeat) + 1;
}
lck.unlock();
@@ -306,7 +306,7 @@ int CJabberProto::RemoveFeatures(LPCTSTR szFeatures) else
ret = false; // indicate that there was an error removing at least one of the specified features
- szFeat += mir_tstrlen(szFeat) + 1;
+ szFeat += mir_wstrlen(szFeat) + 1;
}
lck.unlock();
@@ -328,25 +328,25 @@ LPTSTR CJabberProto::GetResourceFeatures(LPCTSTR jid) // calculate total necessary string length
for (i=0; g_JabberFeatCapPairs[i].szFeature; i++)
if (jcb & g_JabberFeatCapPairs[i].jcbCap)
- iLen += mir_tstrlen(g_JabberFeatCapPairs[i].szFeature) + 1;
+ iLen += mir_wstrlen(g_JabberFeatCapPairs[i].szFeature) + 1;
for (i=0; i < m_lstJabberFeatCapPairsDynamic.getCount(); i++)
if (jcb & m_lstJabberFeatCapPairsDynamic[i]->jcbCap)
- iLen += mir_tstrlen(m_lstJabberFeatCapPairsDynamic[i]->szFeature) + 1;
+ iLen += mir_wstrlen(m_lstJabberFeatCapPairsDynamic[i]->szFeature) + 1;
// allocate memory and fill it
LPTSTR str = (LPTSTR)mir_alloc(iLen * sizeof(wchar_t));
LPTSTR p = str;
for (i=0; g_JabberFeatCapPairs[i].szFeature; i++)
if (jcb & g_JabberFeatCapPairs[i].jcbCap) {
- mir_tstrcpy(p, g_JabberFeatCapPairs[i].szFeature);
- p += mir_tstrlen(g_JabberFeatCapPairs[i].szFeature) + 1;
+ mir_wstrcpy(p, g_JabberFeatCapPairs[i].szFeature);
+ p += mir_wstrlen(g_JabberFeatCapPairs[i].szFeature) + 1;
}
for (i=0; i < m_lstJabberFeatCapPairsDynamic.getCount(); i++)
if (jcb & m_lstJabberFeatCapPairsDynamic[i]->jcbCap) {
- mir_tstrcpy(p, m_lstJabberFeatCapPairsDynamic[i]->szFeature);
- p += mir_tstrlen(m_lstJabberFeatCapPairsDynamic[i]->szFeature) + 1;
+ mir_wstrcpy(p, m_lstJabberFeatCapPairsDynamic[i]->szFeature);
+ p += mir_wstrlen(m_lstJabberFeatCapPairsDynamic[i]->szFeature) + 1;
}
*p = 0; // extra zero terminator
diff --git a/protocols/JabberG/src/jabber_archive.cpp b/protocols/JabberG/src/jabber_archive.cpp index d0718ab3ca..863a19fb44 100644 --- a/protocols/JabberG/src/jabber_archive.cpp +++ b/protocols/JabberG/src/jabber_archive.cpp @@ -58,11 +58,11 @@ void CJabberProto::RetrieveMessageArchive(MCONTACT hContact, JABBER_LIST_ITEM *p void CJabberProto::OnIqResultGetCollectionList(HXML iqNode, CJabberIqInfo*)
{
const wchar_t *to = XmlGetAttrValue(iqNode, L"to");
- if (to == NULL || mir_tstrcmp(XmlGetAttrValue(iqNode, L"type"), L"result"))
+ if (to == NULL || mir_wstrcmp(XmlGetAttrValue(iqNode, L"type"), L"result"))
return;
HXML list = XmlGetChild(iqNode, "list");
- if (!list || mir_tstrcmp(XmlGetAttrValue(list, L"xmlns"), JABBER_FEAT_ARCHIVE))
+ if (!list || mir_wstrcmp(XmlGetAttrValue(list, L"xmlns"), JABBER_FEAT_ARCHIVE))
return;
for (int nodeIdx = 1;; nodeIdx++) {
@@ -221,11 +221,11 @@ BOOL IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO& dbei) void CJabberProto::OnIqResultGetCollection(HXML iqNode, CJabberIqInfo*)
{
- if (mir_tstrcmp(XmlGetAttrValue(iqNode, L"type"), L"result"))
+ if (mir_wstrcmp(XmlGetAttrValue(iqNode, L"type"), L"result"))
return;
HXML chatNode = XmlGetChild(iqNode, "chat");
- if (!chatNode || mir_tstrcmp(XmlGetAttrValue(chatNode, L"xmlns"), JABBER_FEAT_ARCHIVE))
+ if (!chatNode || mir_wstrcmp(XmlGetAttrValue(chatNode, L"xmlns"), JABBER_FEAT_ARCHIVE))
return;
const wchar_t* start = XmlGetAttrValue(chatNode, L"start");
@@ -249,9 +249,9 @@ void CJabberProto::OnIqResultGetCollection(HXML iqNode, CJabberIqInfo*) int from;
const wchar_t *itemName = XmlGetName(itemNode);
- if (!mir_tstrcmp(itemName, L"to"))
+ if (!mir_wstrcmp(itemName, L"to"))
from = DBEF_SENT;
- else if (!mir_tstrcmp(itemName, L"from"))
+ else if (!mir_wstrcmp(itemName, L"from"))
from = 0;
else
continue;
diff --git a/protocols/JabberG/src/jabber_bookmarks.cpp b/protocols/JabberG/src/jabber_bookmarks.cpp index f7915fe86b..b1cc884948 100644 --- a/protocols/JabberG/src/jabber_bookmarks.cpp +++ b/protocols/JabberG/src/jabber_bookmarks.cpp @@ -47,7 +47,7 @@ static INT_PTR CALLBACK JabberAddBookmarkDlgProc(HWND hwndDlg, UINT msg, WPARAM param->ppro->m_hwndJabberAddBookmark = hwndDlg;
TranslateDialogDefault(hwndDlg);
if (item = param->m_item) {
- if (!mir_tstrcmp(item->type, L"conference")) {
+ if (!mir_wstrcmp(item->type, L"conference")) {
if (!wcschr(item->jid, '@')) { //no room name - consider it is transport
CheckDlgButton(hwndDlg, IDC_AGENT_RADIO, BST_CHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_NICK), FALSE);
@@ -118,18 +118,18 @@ static INT_PTR CALLBACK JabberAddBookmarkDlgProc(HWND hwndDlg, UINT msg, WPARAM item = param->ppro->ListAdd(LIST_BOOKMARK, roomJID);
if (IsDlgButtonChecked(hwndDlg, IDC_URL_RADIO) == BST_CHECKED)
- replaceStrT(item->type, L"url");
+ replaceStrW(item->type, L"url");
else
- replaceStrT(item->type, L"conference");
+ replaceStrW(item->type, L"conference");
GetDlgItemText(hwndDlg, IDC_NICK, text, _countof(text));
- replaceStrT(item->nick, text);
+ replaceStrW(item->nick, text);
GetDlgItemText(hwndDlg, IDC_PASSWORD, text, _countof(text));
- replaceStrT(item->password, text);
+ replaceStrW(item->password, text);
GetDlgItemText(hwndDlg, IDC_NAME, text, _countof(text));
- replaceStrT(item->name, (text[0] == 0) ? roomJID : text);
+ replaceStrW(item->name, (text[0] == 0) ? roomJID : text);
item->bAutoJoin = IsDlgButtonChecked(hwndDlg, IDC_CHECK_BM_AUTOJOIN) == BST_CHECKED;
@@ -329,7 +329,7 @@ void CJabberDlgBookmarks::OpenBookmark() JABBER_LIST_ITEM *item = m_proto->ListGetItemPtr(LIST_BOOKMARK, address);
if (item == NULL) return;
- if (!mir_tstrcmpi(item->type, L"conference")) {
+ if (!mir_wstrcmpi(item->type, L"conference")) {
m_lvBookmarks.SetItemState(iItem, 0, LVIS_SELECTED); // Unselect the item
/* some hack for using bookmark to transport not under XEP-0048 */
@@ -344,7 +344,7 @@ void CJabberDlgBookmarks::OpenBookmark() if (item->nick && *item->nick)
m_proto->GroupchatJoinRoom(server, room, item->nick, item->password);
else
- m_proto->GroupchatJoinRoom(server, room, ptrT(JabberNickFromJID(m_proto->m_szJabberJID)), item->password);
+ m_proto->GroupchatJoinRoom(server, room, ptrW(JabberNickFromJID(m_proto->m_szJabberJID)), item->password);
}
}
else Utils_OpenUrlT(item->jid);
@@ -391,7 +391,7 @@ void CJabberDlgBookmarks::OnProtoRefresh(WPARAM, LPARAM) LISTFOREACH(i, m_proto, LIST_BOOKMARK)
{
if (item = m_proto->ListGetItemPtrFromIndex(i)) {
- int itemType = mir_tstrcmpi(item->type, L"conference") ? 1 : 0;
+ int itemType = mir_wstrcmpi(item->type, L"conference") ? 1 : 0;
int iItem = m_lvBookmarks.AddItem(item->name, itemType, (LPARAM)item->jid, itemType);
m_lvBookmarks.SetItem(iItem, 1, item->jid);
if (itemType == 0)
diff --git a/protocols/JabberG/src/jabber_byte.cpp b/protocols/JabberG/src/jabber_byte.cpp index c889f7099f..a940fee985 100644 --- a/protocols/JabberG/src/jabber_byte.cpp +++ b/protocols/JabberG/src/jabber_byte.cpp @@ -61,16 +61,16 @@ void CJabberProto::IqResultProxyDiscovery(HXML iqNode, CJabberIqInfo *pInfo) HXML queryNode = XmlGetChild(iqNode , "query");
if (queryNode) {
const wchar_t *queryXmlns = XmlGetAttrValue(queryNode, L"xmlns");
- if (queryXmlns && !mir_tstrcmp(queryXmlns, JABBER_FEAT_BYTESTREAMS)) {
+ if (queryXmlns && !mir_wstrcmp(queryXmlns, JABBER_FEAT_BYTESTREAMS)) {
HXML streamHostNode = XmlGetChild(queryNode , "streamhost");
if (streamHostNode) {
const wchar_t *streamJid = XmlGetAttrValue(streamHostNode, L"jid");
const wchar_t *streamHost = XmlGetAttrValue(streamHostNode, L"host");
const wchar_t *streamPort = XmlGetAttrValue(streamHostNode, L"port");
if (streamJid && streamHost && streamPort) {
- jbt->szProxyHost = mir_tstrdup(streamHost);
- jbt->szProxyJid = mir_tstrdup(streamJid);
- jbt->szProxyPort = mir_tstrdup(streamPort);
+ jbt->szProxyHost = mir_wstrdup(streamHost);
+ jbt->szProxyJid = mir_wstrdup(streamJid);
+ jbt->szProxyPort = mir_wstrdup(streamPort);
jbt->bProxyDiscovered = TRUE;
} } } } }
else if (pInfo->GetIqType() == JABBER_IQ_TYPE_ERROR)
@@ -94,7 +94,7 @@ void JabberByteSendConnection(HANDLE hConn, DWORD /*dwRemoteIP*/, void* extra) NETLIBCONNINFO connInfo = { sizeof(connInfo) };
CallService(MS_NETLIB_GETCONNECTIONINFO, (WPARAM)hConn, (LPARAM)&connInfo);
- mir_sntprintf(szPort, L"%u", connInfo.wPort);
+ mir_snwprintf(szPort, L"%u", connInfo.wPort);
ppro->debugLogA("bytestream_send_connection incoming connection accepted: %s", connInfo.szIpPort);
if ((item = ppro->ListGetItemPtr(LIST_BYTE, szPort)) == NULL) {
@@ -153,7 +153,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt) BOOL bDirect = m_options.BsDirect;
if (m_options.BsProxyManual) {
- ptrT proxyJid( getTStringA("BsProxyServer"));
+ ptrW proxyJid( getTStringA("BsProxyServer"));
if (proxyJid) {
jbt->bProxyDiscovered = FALSE;
jbt->szProxyHost = NULL;
@@ -209,7 +209,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt) if (localAddr == NULL)
localAddr = (char*)CallService(MS_NETLIB_ADDRESSTOSTRING, 1, nlb.dwExternalIP);
- mir_sntprintf(szPort, L"%d", nlb.wPort);
+ mir_snwprintf(szPort, L"%d", nlb.wPort);
JABBER_LIST_ITEM *item = ListAdd(LIST_BYTE, szPort);
item->jbt = jbt;
hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
@@ -258,7 +258,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt) return;
}
- if (jbt->bProxyDiscovered && !mir_tstrcmp(jbt->szProxyJid, jbt->szStreamhostUsed)) {
+ if (jbt->bProxyDiscovered && !mir_wstrcmp(jbt->szProxyJid, jbt->szStreamhostUsed)) {
// jabber proxy used
if (bDirect) {
SetEvent(jbt->hSendEvent);
@@ -300,12 +300,12 @@ void CJabberProto::ByteInitiateResult(HXML iqNode, CJabberIqInfo *pInfo) HXML queryNode = XmlGetChild(iqNode , "query");
if (queryNode) {
const wchar_t *queryXmlns = XmlGetAttrValue(queryNode, L"xmlns");
- if (queryXmlns && !mir_tstrcmp(queryXmlns, JABBER_FEAT_BYTESTREAMS)) {
+ if (queryXmlns && !mir_wstrcmp(queryXmlns, JABBER_FEAT_BYTESTREAMS)) {
HXML streamHostNode = XmlGetChild(queryNode , "streamhost-used");
if (streamHostNode) {
const wchar_t *streamJid = XmlGetAttrValue(streamHostNode, L"jid");
if (streamJid)
- jbt->szStreamhostUsed = mir_tstrdup(streamJid);
+ jbt->szStreamhostUsed = mir_wstrdup(streamJid);
} } } }
if (jbt->hProxyEvent)
@@ -364,7 +364,7 @@ int CJabberProto::ByteSendParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, char* b wchar_t *szInitiatorJid = JabberPrepareJid(jbt->srcJID);
wchar_t *szTargetJid = JabberPrepareJid(jbt->dstJID);
- mir_sntprintf(text, L"%s%s%s", jbt->sid, szInitiatorJid, szTargetJid);
+ mir_snwprintf(text, L"%s%s%s", jbt->sid, szInitiatorJid, szTargetJid);
mir_free(szInitiatorJid);
mir_free(szTargetJid);
@@ -407,13 +407,13 @@ void CJabberProto::IqResultStreamActivate(HXML iqNode, CJabberIqInfo*) int id = JabberGetPacketID(iqNode);
wchar_t listJid[JABBER_MAX_JID_LEN];
- mir_sntprintf(listJid, L"ftproxy_%d", id);
+ mir_snwprintf(listJid, L"ftproxy_%d", id);
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_FTIQID, listJid);
if (item == NULL)
return;
- if (!mir_tstrcmp(XmlGetAttrValue(iqNode, L"type"), L"result"))
+ if (!mir_wstrcmp(XmlGetAttrValue(iqNode, L"type"), L"result"))
item->jbt->bStreamActivated = TRUE;
if (item->jbt->hProxyEvent)
@@ -445,11 +445,11 @@ void CJabberProto::ByteSendViaProxy(JABBER_BYTE_TRANSFER *jbt) szHost = jbt->szProxyHost;
port = (WORD)_wtoi(szPort);
- replaceStrT(jbt->streamhostJID, jbt->szProxyJid);
+ replaceStrW(jbt->streamhostJID, jbt->szProxyJid);
NETLIBOPENCONNECTION nloc = { 0 };
nloc.cbSize = sizeof(nloc);
- nloc.szHost = mir_t2a(szHost);
+ nloc.szHost = mir_u2a(szHost);
nloc.wPort = port;
hConn = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)m_hNetlibUser, (LPARAM)&nloc);
mir_free((void*)nloc.szHost);
@@ -513,7 +513,7 @@ int CJabberProto::ByteSendProxyParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, ch wchar_t *szInitiatorJid = JabberPrepareJid(jbt->srcJID);
wchar_t *szTargetJid = JabberPrepareJid(jbt->dstJID);
- mir_sntprintf(text, L"%s%s%s", jbt->sid, szInitiatorJid, szTargetJid);
+ mir_snwprintf(text, L"%s%s%s", jbt->sid, szInitiatorJid, szTargetJid);
mir_free(szInitiatorJid);
mir_free(szTargetJid);
@@ -556,7 +556,7 @@ int CJabberProto::ByteSendProxyParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, ch int iqId = SerialNext();
wchar_t listJid[256];
- mir_sntprintf(listJid, L"ftproxy_%d", iqId);
+ mir_snwprintf(listJid, L"ftproxy_%d", iqId);
JABBER_LIST_ITEM *item = ListAdd(LIST_FTIQID, listJid);
item->jbt = jbt;
@@ -612,10 +612,10 @@ void __cdecl CJabberProto::ByteReceiveThread(JABBER_BYTE_TRANSFER *jbt) }
if (szId && from && to && sid && (n = XmlGetChild(queryNode, "streamhost")) != NULL) {
- jbt->iqId = mir_tstrdup(szId);
- jbt->srcJID = mir_tstrdup(from);
- jbt->dstJID = mir_tstrdup(to);
- jbt->sid = mir_tstrdup(sid);
+ jbt->iqId = mir_wstrdup(szId);
+ jbt->srcJID = mir_wstrdup(from);
+ jbt->dstJID = mir_wstrdup(to);
+ jbt->sid = mir_wstrdup(sid);
if ((buffer = (char*)mir_alloc(JABBER_NETWORK_BUFFER_SIZE))) {
for (i = 1; (n = XmlGetNthChild(queryNode, L"streamhost", i)) != NULL; i++) {
@@ -624,12 +624,12 @@ void __cdecl CJabberProto::ByteReceiveThread(JABBER_BYTE_TRANSFER *jbt) (str = XmlGetAttrValue(n, L"jid")) != NULL) {
port = (WORD)_wtoi(szPort);
- replaceStrT(jbt->streamhostJID, str);
+ replaceStrW(jbt->streamhostJID, str);
debugLog(L"bytestream_recv connecting to %s:%d", szHost, port);
NETLIBOPENCONNECTION nloc = { 0 };
nloc.cbSize = sizeof(nloc);
- nloc.szHost = mir_t2a(szHost);
+ nloc.szHost = mir_u2a(szHost);
nloc.wPort = port;
hConn = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)m_hNetlibUser, (LPARAM)&nloc);
mir_free((void*)nloc.szHost);
@@ -707,9 +707,9 @@ int CJabberProto::ByteReceiveParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, char wchar_t text[JABBER_MAX_JID_LEN * 2];
{
- ptrT szInitiatorJid(JabberPrepareJid(jbt->srcJID));
- ptrT szTargetJid(JabberPrepareJid(jbt->dstJID));
- mir_sntprintf(text, L"%s%s%s", jbt->sid, szInitiatorJid, szTargetJid);
+ ptrW szInitiatorJid(JabberPrepareJid(jbt->srcJID));
+ ptrW szTargetJid(JabberPrepareJid(jbt->dstJID));
+ mir_snwprintf(text, L"%s%s%s", jbt->sid, szInitiatorJid, szTargetJid);
}
T2Utf szAuthString(text);
diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp index 275e869901..f4457137c8 100644 --- a/protocols/JabberG/src/jabber_caps.cpp +++ b/protocols/JabberG/src/jabber_caps.cpp @@ -111,22 +111,22 @@ void CJabberProto::OnIqResultCapsDiscoInfoSI(HXML, CJabberIqInfo *pInfo) HXML xform;
for (int i = 1; (xform = XmlGetNthChild(query, L"x", i)) != NULL; i++) {
wchar_t *szFormTypeValue = XPath(xform, L"field[@var='FORM_TYPE']/value");
- if (szFormTypeValue && !mir_tstrcmp(szFormTypeValue, L"urn:xmpp:dataforms:softwareinfo")) {
+ if (szFormTypeValue && !mir_wstrcmp(szFormTypeValue, L"urn:xmpp:dataforms:softwareinfo")) {
wchar_t *szTmp = XPath(xform, L"field[@var='os']/value");
if (szTmp)
- r->m_tszOs = mir_tstrdup(szTmp);
+ r->m_tszOs = mir_wstrdup(szTmp);
szTmp = XPath(xform, L"field[@var='os_version']/value");
if (szTmp)
- r->m_tszOsVersion = mir_tstrdup(szTmp);
+ r->m_tszOsVersion = mir_wstrdup(szTmp);
szTmp = XPath(xform, L"field[@var='software']/value");
if (szTmp)
- r->m_tszSoftware = mir_tstrdup(szTmp);
+ r->m_tszSoftware = mir_wstrdup(szTmp);
szTmp = XPath(xform, L"field[@var='software_version']/value");
if (szTmp)
- r->m_tszSoftwareVersion = mir_tstrdup(szTmp);
+ r->m_tszSoftwareVersion = mir_wstrdup(szTmp);
szTmp = XPath(xform, L"field[@var='x-miranda-core-version']/value");
if (szTmp)
- r->m_tszXMirandaCoreVersion = mir_tstrdup(szTmp);
+ r->m_tszXMirandaCoreVersion = mir_wstrdup(szTmp);
JabberUserInfoUpdate(pInfo->GetHContact());
}
@@ -148,7 +148,7 @@ void CJabberProto::OnIqResultCapsDiscoInfo(HXML, CJabberIqInfo *pInfo) continue;
for (int j = 0; g_JabberFeatCapPairs[j].szFeature; j++) {
- if (!mir_tstrcmp(g_JabberFeatCapPairs[j].szFeature, featureName)) {
+ if (!mir_wstrcmp(g_JabberFeatCapPairs[j].szFeature, featureName)) {
jcbCaps |= g_JabberFeatCapPairs[j].jcbCap;
break;
}
@@ -201,7 +201,7 @@ JabberCapsBits CJabberProto::GetTotalJidCapabilites(const wchar_t *jid) if (item) {
for (int i = 0; i < item->arResources.getCount(); i++) {
wchar_t szFullJid[JABBER_MAX_JID_LEN];
- mir_sntprintf(szFullJid, L"%s/%s", szBareJid, item->arResources[i]->m_tszResourceName);
+ mir_snwprintf(szFullJid, L"%s/%s", szBareJid, item->arResources[i]->m_tszResourceName);
JabberCapsBits jcb = GetResourceCapabilites(szFullJid, FALSE);
if (!(jcb & JABBER_RESOURCE_CAPS_ERROR))
jcbToReturn |= jcb;
@@ -240,7 +240,7 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const wchar_t *jid, BOOL app r->m_dwDiscoInfoRequestTime = pInfo->GetRequestTime();
wchar_t queryNode[512];
- mir_sntprintf(queryNode, L"%s#%s", r->m_tszCapsNode, r->m_tszCapsVer);
+ mir_snwprintf(queryNode, L"%s#%s", r->m_tszCapsNode, r->m_tszCapsVer);
m_ThreadInfo->send(XmlNodeIq(pInfo) << XQUERY(JABBER_FEAT_DISCO_INFO) << XATTR(L"node", queryNode));
bRequestSent = TRUE;
@@ -251,7 +251,7 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const wchar_t *jid, BOOL app jcbCaps |= jcbMainCaps;
if (jcbMainCaps != JABBER_RESOURCE_CAPS_TIMEOUT && r->m_tszCapsExt) {
- wchar_t *caps = mir_tstrdup(r->m_tszCapsExt);
+ wchar_t *caps = mir_wstrdup(r->m_tszCapsExt);
wchar_t *token = wcstok(caps, L" ");
while (token) {
@@ -349,17 +349,17 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const wchar_t *jid, BOOL app JabberCapsBits jcbMainCaps = m_clientCapsManager.GetClientCaps(r->m_tszSoftware, r->m_tszSoftwareVersion);
if (jcbMainCaps == JABBER_RESOURCE_CAPS_ERROR) {
// Bombus hack:
- if (!mir_tstrcmp(r->m_tszSoftware, L"Bombus") || !mir_tstrcmp(r->m_tszSoftware, L"BombusMod")) {
+ if (!mir_wstrcmp(r->m_tszSoftware, L"Bombus") || !mir_wstrcmp(r->m_tszSoftware, L"BombusMod")) {
jcbMainCaps = JABBER_CAPS_SI | JABBER_CAPS_SI_FT | JABBER_CAPS_IBB | JABBER_CAPS_MESSAGE_EVENTS | JABBER_CAPS_MESSAGE_EVENTS_NO_DELIVERY | JABBER_CAPS_DATA_FORMS | JABBER_CAPS_LAST_ACTIVITY | JABBER_CAPS_VERSION | JABBER_CAPS_COMMANDS | JABBER_CAPS_VCARD_TEMP;
m_clientCapsManager.SetClientCaps(r->m_tszSoftware, r->m_tszSoftwareVersion, jcbMainCaps);
}
// Neos hack:
- else if (!mir_tstrcmp(r->m_tszSoftware, L"neos")) {
+ else if (!mir_wstrcmp(r->m_tszSoftware, L"neos")) {
jcbMainCaps = JABBER_CAPS_OOB | JABBER_CAPS_MESSAGE_EVENTS | JABBER_CAPS_MESSAGE_EVENTS_NO_DELIVERY | JABBER_CAPS_LAST_ACTIVITY | JABBER_CAPS_VERSION;
m_clientCapsManager.SetClientCaps(r->m_tszSoftware, r->m_tszSoftwareVersion, jcbMainCaps);
}
// sim hack:
- else if (!mir_tstrcmp(r->m_tszSoftware, L"sim")) {
+ else if (!mir_wstrcmp(r->m_tszSoftware, L"sim")) {
jcbMainCaps = JABBER_CAPS_OOB | JABBER_CAPS_VERSION | JABBER_CAPS_MESSAGE_EVENTS | JABBER_CAPS_MESSAGE_EVENTS_NO_DELIVERY;
m_clientCapsManager.SetClientCaps(r->m_tszSoftware, r->m_tszSoftwareVersion, jcbMainCaps);
}
@@ -390,7 +390,7 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const wchar_t *jid, BOOL app CJabberClientPartialCaps::CJabberClientPartialCaps(const wchar_t *szVer)
{
- m_szVer = mir_tstrdup(szVer);
+ m_szVer = mir_wstrdup(szVer);
m_jcbCaps = JABBER_RESOURCE_CAPS_UNINIT;
m_pNext = NULL;
m_nIqId = -1;
@@ -437,7 +437,7 @@ CJabberClientPartialCaps* CJabberClientCaps::FindByVersion(const wchar_t *szVer) CJabberClientPartialCaps *pCaps = m_pCaps;
while (pCaps) {
- if (!mir_tstrcmp(szVer, pCaps->GetVersion()))
+ if (!mir_wstrcmp(szVer, pCaps->GetVersion()))
break;
pCaps = pCaps->GetNext();
}
@@ -463,7 +463,7 @@ CJabberClientPartialCaps* CJabberClientCaps::FindById(int nIqId) CJabberClientCaps::CJabberClientCaps(const wchar_t *szNode)
{
- m_szNode = mir_tstrdup(szNode);
+ m_szNode = mir_wstrdup(szNode);
m_pCaps = NULL;
m_pNext= NULL;
}
@@ -536,7 +536,7 @@ CJabberClientCaps * CJabberClientCapsManager::FindClient(const wchar_t *szNode) CJabberClientCaps *pClient = m_pClients;
while (pClient) {
- if (!mir_tstrcmp(szNode, pClient->GetNode()))
+ if (!mir_wstrcmp(szNode, pClient->GetNode()))
break;
pClient = pClient->GetNext();
}
@@ -615,8 +615,8 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con continue;
wchar_t szExtCap[ 512 ];
- mir_sntprintf(szExtCap, L"%s#%s", JABBER_CAPS_MIRANDA_NODE, g_JabberFeatCapPairsExt[i].szFeature);
- if (!mir_tstrcmp(szNode, szExtCap)) {
+ mir_snwprintf(szExtCap, L"%s#%s", JABBER_CAPS_MIRANDA_NODE, g_JabberFeatCapPairsExt[i].szFeature);
+ if (!mir_wstrcmp(szNode, szExtCap)) {
jcb = g_JabberFeatCapPairsExt[i].jcbCap;
break;
}
@@ -625,8 +625,8 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con // check features registered through IJabberNetInterface::RegisterFeature() and IJabberNetInterface::AddFeatures()
for (i=0; i < ppro->m_lstJabberFeatCapPairsDynamic.getCount(); i++) {
wchar_t szExtCap[ 512 ];
- mir_sntprintf(szExtCap, L"%s#%s", JABBER_CAPS_MIRANDA_NODE, ppro->m_lstJabberFeatCapPairsDynamic[i]->szExt);
- if (!mir_tstrcmp(szNode, szExtCap)) {
+ mir_snwprintf(szExtCap, L"%s#%s", JABBER_CAPS_MIRANDA_NODE, ppro->m_lstJabberFeatCapPairsDynamic[i]->szExt);
+ if (!mir_wstrcmp(szNode, szExtCap)) {
jcb = ppro->m_lstJabberFeatCapPairsDynamic[i]->jcbCap;
break;
}
@@ -668,10 +668,10 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con if (ppro->m_options.ShowOSVersion) {
if (!GetOSDisplayString(szOsBuffer, _countof(szOsBuffer)))
- mir_tstrncpy(szOsBuffer, L"", _countof(szOsBuffer));
+ mir_wstrncpy(szOsBuffer, L"", _countof(szOsBuffer));
else {
wchar_t *szOsWindows = L"Microsoft Windows";
- size_t nOsWindowsLength = mir_tstrlen(szOsWindows);
+ size_t nOsWindowsLength = mir_wstrlen(szOsWindows);
if (!wcsnicmp(szOsBuffer, szOsWindows, nOsWindowsLength))
os += nOsWindowsLength + 1;
}
diff --git a/protocols/JabberG/src/jabber_captcha.cpp b/protocols/JabberG/src/jabber_captcha.cpp index 159b9c15a0..0de9eda1bb 100644 --- a/protocols/JabberG/src/jabber_captcha.cpp +++ b/protocols/JabberG/src/jabber_captcha.cpp @@ -158,7 +158,7 @@ bool CJabberProto::ProcessCaptcha(HXML node, HXML parentNode, ThreadData *info) param.w = bmp.bmWidth;
param.h = bmp.bmHeight;
int res = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CAPTCHAFORM), NULL, JabberCaptchaFormDlgProc, (LPARAM)¶m);
- if (mir_tstrcmp(param.Result, L"") == 0 || !res)
+ if (mir_wstrcmp(param.Result, L"") == 0 || !res)
sendCaptchaError(info, param.from, param.to, param.challenge);
else
sendCaptchaResult(param.Result, info, param.from, param.challenge, param.fromjid, param.sid);
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index c260b23348..4f3cf9534c 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -126,7 +126,7 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item) for (int i = 0; i < _countof(sttRoleItems); i++)
sttRoleItems[i].translate();
- ptrT szNick(JabberNickFromJID(item->jid));
+ ptrW szNick(JabberNickFromJID(item->jid));
GCSESSION gcw = { sizeof(GCSESSION) };
gcw.iType = GCW_CHATROOM;
@@ -141,22 +141,22 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item) if (JABBER_LIST_ITEM *bookmark = ListGetItemPtr(LIST_BOOKMARK, item->jid)) {
if (bookmark->name) {
- ptrT myHandle(db_get_tsa(si->hContact, "CList", "MyHandle"));
+ ptrW myHandle(db_get_tsa(si->hContact, "CList", "MyHandle"));
if (myHandle == NULL)
db_set_ts(si->hContact, "CList", "MyHandle", bookmark->name);
}
}
- ptrT tszNick(getTStringA(si->hContact, "MyNick"));
+ ptrW tszNick(getTStringA(si->hContact, "MyNick"));
if (tszNick != NULL) {
- if (!mir_tstrcmp(tszNick, szNick))
+ if (!mir_wstrcmp(tszNick, szNick))
delSetting(si->hContact, "MyNick");
else
setTString(si->hContact, "MyNick", item->nick);
}
else setTString(si->hContact, "MyNick", item->nick);
- ptrT passw(getTStringA(si->hContact, "Password"));
+ ptrW passw(getTStringA(si->hContact, "Password"));
if (lstrcmp_null(passw, item->password)) {
if (!item->password || !item->password[0])
delSetting(si->hContact, "Password");
@@ -265,7 +265,7 @@ void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const wchar_t szReason = TranslateT("user banned");
}
- ptrT myNick(mir_tstrdup(item->nick));
+ ptrW myNick(mir_wstrdup(item->nick));
if (myNick == NULL)
myNick = JabberNickFromJID(m_szJabberJID);
@@ -290,7 +290,7 @@ void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const wchar_t mir_cslock lck(m_csLists);
for (int i = 0; i < item->arResources.getCount(); i++) {
JABBER_RESOURCE_STATUS *JS = item->arResources[i];
- if (!mir_tstrcmp(resource, JS->m_tszResourceName)) {
+ if (!mir_wstrcmp(resource, JS->m_tszResourceName)) {
if (action != GC_EVENT_JOIN) {
switch (action) {
case 0:
@@ -301,7 +301,7 @@ void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const wchar_t gce.ptszText = TranslateT("Moderator");
}
gce.ptszStatus = TranslateTS(sttStatuses[JabberGcGetStatus(JS)]);
- gce.bIsMe = (mir_tstrcmp(nick, myNick) == 0);
+ gce.bIsMe = (mir_wstrcmp(nick, myNick) == 0);
statusToSet = JS->m_iStatus;
break;
}
@@ -331,14 +331,14 @@ void CJabberProto::GcQuit(JABBER_LIST_ITEM *item, int code, HXML reason) wchar_t *szMessage = NULL;
if (code != 307 && code != 301) {
- ptrT tszMessage(getTStringA("GcMsgQuit"));
+ ptrW tszMessage(getTStringA("GcMsgQuit"));
if (tszMessage != NULL)
szMessage = NEWWSTR_ALLOCA(tszMessage);
else
szMessage = TranslateTS(JABBER_GC_MSG_QUIT);
}
else {
- ptrT myNick(JabberNickFromJID(m_szJabberJID));
+ ptrW myNick(JabberNickFromJID(m_szJabberJID));
GcLogUpdateMemberStatus(item, myNick, myNick, NULL, GC_EVENT_KICK, reason);
}
@@ -353,7 +353,7 @@ void CJabberProto::GcQuit(JABBER_LIST_ITEM *item, int code, HXML reason) if (m_bJabberOnline) {
wchar_t szPresenceTo[JABBER_MAX_JID_LEN];
- mir_sntprintf(szPresenceTo, L"%s/%s", item->jid, item->nick);
+ mir_snwprintf(szPresenceTo, L"%s/%s", item->jid, item->nick);
m_ThreadInfo->send(
XmlNode(L"presence") << XATTR(L"to", szPresenceTo) << XATTR(L"type", L"unavailable")
@@ -513,9 +513,9 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam) pResourceStatus me(NULL), him(NULL);
for (int i = 0; i < item->arResources.getCount(); i++) {
JABBER_RESOURCE_STATUS *p = item->arResources[i];
- if (!mir_tstrcmp(p->m_tszResourceName, item->nick))
+ if (!mir_wstrcmp(p->m_tszResourceName, item->nick))
me = p;
- if (!mir_tstrcmp(p->m_tszResourceName, gcmi->pszUID))
+ if (!mir_wstrcmp(p->m_tszResourceName, gcmi->pszUID))
him = p;
}
@@ -537,7 +537,7 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam) wchar_t *bufPtr = url_buf;
for (wchar_t *p = wcsstr(ptszStatusMsg, L"http"); p && *p; p = wcsstr(p + 1, L"http")) {
if (!wcsncmp(p, L"http://", 7) || !wcsncmp(p, L"https://", 8)) {
- mir_tstrncpy(bufPtr, p, _countof(url_buf) - (bufPtr - url_buf));
+ mir_wstrncpy(bufPtr, p, _countof(url_buf) - (bufPtr - url_buf));
gc_item *pItem = sttFindGcMenuItem(gcmi, idx);
pItem->pszDesc = bufPtr;
pItem->uType = MENU_POPUPITEM;
@@ -602,7 +602,7 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam) }
if (him->m_tszRealJid && *him->m_tszRealJid) {
- mir_sntprintf(sttRJidBuf, TranslateT("Real &JID: %s"), him->m_tszRealJid);
+ mir_snwprintf(sttRJidBuf, TranslateT("Real &JID: %s"), him->m_tszRealJid);
if (wchar_t *tmp = wcschr(sttRJidBuf, '/')) *tmp = 0;
if (MCONTACT hContact = HContactFromJID(him->m_tszRealJid)) {
@@ -710,7 +710,7 @@ public: m_txtReason(this, IDC_REASON),
m_clc(this, IDC_CLIST)
{
- m_room = mir_tstrdup(room);
+ m_room = mir_wstrdup(room);
m_btnAddJid.OnClick = Callback(this, &CGroupchatInviteDlg::OnCommand_AddJid);
m_btnInvite.OnClick = Callback(this, &CGroupchatInviteDlg::OnCommand_Invite);
m_clc.OnNewContact =
@@ -755,17 +755,17 @@ public: int i;
for (i = 0; i < m_newJids.getCount(); i++)
- if (!mir_tstrcmp(m_newJids[i]->jid, buf))
+ if (!mir_wstrcmp(m_newJids[i]->jid, buf))
break;
if (i != m_newJids.getCount())
return;
JabberGcLogInviteDlgJidData *jidData = (JabberGcLogInviteDlgJidData *)mir_alloc(sizeof(JabberGcLogInviteDlgJidData));
- mir_tstrcpy(jidData->jid, buf);
+ mir_wstrcpy(jidData->jid, buf);
CLCINFOITEM cii = { 0 };
cii.cbSize = sizeof(cii);
cii.flags = CLCIIF_CHECKBOX;
- mir_sntprintf(buf, TranslateT("%s (not on roster)"), jidData->jid);
+ mir_snwprintf(buf, TranslateT("%s (not on roster)"), jidData->jid);
cii.pszText = buf;
jidData->hItem = SendDlgItemMessage(m_hwnd, IDC_CLIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii);
SendDlgItemMessage(m_hwnd, IDC_CLIST, CLM_SETCHECKMARK, jidData->hItem, 1);
@@ -776,7 +776,7 @@ public: {
if (!m_room) return;
- ptrT text(m_txtReason.GetText());
+ ptrW text(m_txtReason.GetText());
HWND hwndList = GetDlgItem(m_hwnd, IDC_CLIST);
// invite users from roster
@@ -786,7 +786,7 @@ public: if (int hItem = SendMessage(hwndList, CLM_FINDCONTACT, hContact, 0)) {
if (SendMessage(hwndList, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) {
- ptrT jid(m_proto->getTStringA(hContact, "jid"));
+ ptrW jid(m_proto->getTStringA(hContact, "jid"));
if (jid != NULL)
InviteUser(jid, text);
}
@@ -860,7 +860,7 @@ static INT_PTR CALLBACK sttUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam SendDlgItemMessage(hwndDlg, IDC_ICO_STATUS, STM_SETICON, (WPARAM)Skin_LoadProtoIcon(dat->ppro->m_szModuleName, dat->him->m_iStatus), 0);
wchar_t buf[256];
- mir_sntprintf(buf, TranslateT("%s from\n%s"), dat->him->m_tszResourceName, dat->item->jid);
+ mir_snwprintf(buf, TranslateT("%s from\n%s"), dat->him->m_tszResourceName, dat->item->jid);
SetDlgItemText(hwndDlg, IDC_HEADERBAR, buf);
SetDlgItemText(hwndDlg, IDC_TXT_NICK, dat->him->m_tszResourceName);
@@ -1010,17 +1010,17 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* switch (gch->dwData) {
case IDM_SLAP:
if (ppro->m_bJabberOnline) {
- ptrT szMessage(ppro->getTStringA("GcMsgSlap"));
+ ptrW szMessage(ppro->getTStringA("GcMsgSlap"));
if (szMessage == NULL)
- szMessage = mir_tstrdup(TranslateTS(JABBER_GC_MSG_SLAP));
+ szMessage = mir_wstrdup(TranslateTS(JABBER_GC_MSG_SLAP));
wchar_t buf[256];
// do not use snprintf to avoid possible problems with % symbol
if (wchar_t *p = wcsstr(szMessage, L"%s")) {
*p = 0;
- mir_sntprintf(buf, L"%s%s%s", szMessage, him->m_tszResourceName, p + 2);
+ mir_snwprintf(buf, L"%s%s%s", szMessage, him->m_tszResourceName, p + 2);
}
- else mir_tstrncpy(buf, szMessage, _countof(buf));
+ else mir_wstrncpy(buf, szMessage, _countof(buf));
UnEscapeChatTags(buf);
ppro->m_ThreadInfo->send(
@@ -1060,7 +1060,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* dwLastBanKickTime = GetTickCount();
szBuffer.Format(L"%s: ", me->m_tszResourceName);
szTitle.Format(TranslateT("Reason to kick %s"), him->m_tszResourceName);
- wchar_t *resourceName_copy = mir_tstrdup(him->m_tszResourceName); // copy resource name to prevent possible crash if user list rebuilds
+ wchar_t *resourceName_copy = mir_wstrdup(him->m_tszResourceName); // copy resource name to prevent possible crash if user list rebuilds
if (ppro->EnterString(szBuffer, szTitle, ESF_MULTILINE, "gcReason_"))
ppro->m_ThreadInfo->send(
XmlNodeIq(L"set", ppro->SerialNext(), item->jid) << XQUERY(JABBER_FEAT_MUC_ADMIN)
@@ -1279,7 +1279,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g if (ppro->EnterString(szBuffer, szTitle, ESF_COMBO, "gcNick_")) {
if (ppro->ListGetItemPtr(LIST_CHATROOM, gch->pDest->ptszID) != NULL) {
wchar_t text[1024];
- mir_sntprintf(text, L"%s/%s", gch->pDest->ptszID, szBuffer);
+ mir_snwprintf(text, L"%s/%s", gch->pDest->ptszID, szBuffer);
ppro->SendPresenceTo(ppro->m_iStatus == ID_STATUS_INVISIBLE ? ID_STATUS_ONLINE : ppro->m_iStatus, text, NULL);
}
}
@@ -1335,7 +1335,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g int idx = IDM_LINK0;
for (wchar_t *p = wcsstr(item->getTemp()->m_tszStatusMessage, L"http://"); p && *p; p = wcsstr(p + 1, L"http://")) {
if (idx == gch->dwData) {
- char *bufPtr, *url = mir_t2a(p);
+ char *bufPtr, *url = mir_u2a(p);
for (bufPtr = url; *bufPtr && !isspace(*bufPtr); ++bufPtr);
*bufPtr++ = 0;
Utils_OpenUrl(url);
@@ -1364,7 +1364,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g static void sttSendPrivateMessage(CJabberProto *ppro, JABBER_LIST_ITEM *item, const wchar_t *nick)
{
wchar_t szFullJid[JABBER_MAX_JID_LEN];
- mir_sntprintf(szFullJid, L"%s/%s", item->jid, nick);
+ mir_snwprintf(szFullJid, L"%s/%s", item->jid, nick);
MCONTACT hContact = ppro->DBCreateContact(szFullJid, NULL, true, false);
if (hContact != NULL) {
pResourceStatus r(item->findResource(nick));
@@ -1396,8 +1396,8 @@ int CJabberProto::JabberGcEventHook(WPARAM, LPARAM lParam) switch (gch->pDest->iType) {
case GC_USER_MESSAGE:
- if (gch->ptszText && mir_tstrlen(gch->ptszText) > 0) {
- rtrimt(gch->ptszText);
+ if (gch->ptszText && mir_wstrlen(gch->ptszText) > 0) {
+ rtrimw(gch->ptszText);
if (m_bJabberOnline) {
wchar_t tszID[100];
diff --git a/protocols/JabberG/src/jabber_console.cpp b/protocols/JabberG/src/jabber_console.cpp index 3070d0b223..28af8638a0 100644 --- a/protocols/JabberG/src/jabber_console.cpp +++ b/protocols/JabberG/src/jabber_console.cpp @@ -116,9 +116,9 @@ bool CJabberProto::RecursiveCheckFilter(HXML node, DWORD flags) bool CJabberProto::FilterXml(HXML node, DWORD flags)
{
- if (!m_filterInfo.msg && !mir_tstrcmp(XmlGetName(node), L"message")) return false;
- if (!m_filterInfo.presence && !mir_tstrcmp(XmlGetName(node), L"presence")) return false;
- if (!m_filterInfo.iq && !mir_tstrcmp(XmlGetName(node), L"iq")) return false;
+ if (!m_filterInfo.msg && !mir_wstrcmp(XmlGetName(node), L"message")) return false;
+ if (!m_filterInfo.presence && !mir_wstrcmp(XmlGetName(node), L"presence")) return false;
+ if (!m_filterInfo.iq && !mir_wstrcmp(XmlGetName(node), L"iq")) return false;
if (m_filterInfo.type == TFilterInfo::T_OFF) return true;
mir_cslock lck(m_filterInfo.csPatternLock);
@@ -346,9 +346,9 @@ void CJabberDlgConsole::OnInitDialog() m_proto->m_filterInfo.type = (TFilterInfo::Type)m_proto->getByte("consoleWnd_ftype", TFilterInfo::T_OFF);
*m_proto->m_filterInfo.pattern = 0;
- ptrT tszPattern( m_proto->getTStringA("consoleWnd_fpattern"));
+ ptrW tszPattern( m_proto->getTStringA("consoleWnd_fpattern"));
if (tszPattern != NULL)
- mir_tstrncpy(m_proto->m_filterInfo.pattern, tszPattern, _countof(m_proto->m_filterInfo.pattern));
+ mir_wstrncpy(m_proto->m_filterInfo.pattern, tszPattern, _countof(m_proto->m_filterInfo.pattern));
sttJabberConsoleRebuildStrings(m_proto, GetDlgItem(m_hwnd, IDC_CB_FILTER));
SetDlgItemText(m_hwnd, IDC_CB_FILTER, m_proto->m_filterInfo.pattern);
@@ -552,7 +552,7 @@ INT_PTR CJabberDlgConsole::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) if (len > _countof(m_proto->m_filterInfo.pattern)) {
wchar_t *buf = (wchar_t *)_alloca(len * sizeof(wchar_t));
SendDlgItemMessage(m_hwnd, IDC_CB_FILTER, CB_GETLBTEXT, idx, (LPARAM)buf);
- mir_tstrncpy(m_proto->m_filterInfo.pattern, buf, _countof(m_proto->m_filterInfo.pattern));
+ mir_wstrncpy(m_proto->m_filterInfo.pattern, buf, _countof(m_proto->m_filterInfo.pattern));
}
else SendDlgItemMessage(m_hwnd, IDC_CB_FILTER, CB_GETLBTEXT, idx, (LPARAM)m_proto->m_filterInfo.pattern);
}
diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp index e93545ca06..9f2d52f03e 100644 --- a/protocols/JabberG/src/jabber_disco.cpp +++ b/protocols/JabberG/src/jabber_disco.cpp @@ -262,7 +262,7 @@ void CJabberProto::OnIqResultServiceDiscoveryRootInfo(HXML iqNode, CJabberIqInfo if (query) {
HXML feature;
for (int i = 1; (feature = XmlGetNthChild(query, L"feature", i)) != NULL; i++) {
- if (!mir_tstrcmp(XmlGetAttrValue(feature, L"var"), (wchar_t *)pInfo->m_pUserData)) {
+ if (!mir_wstrcmp(XmlGetAttrValue(feature, L"var"), (wchar_t *)pInfo->m_pUserData)) {
CJabberSDNode *pNode = m_SDManager.AddPrimaryNode(pInfo->GetReceiver(), XmlGetAttrValue(iqNode, L"node"), NULL);
SendBothRequests(pNode, NULL);
break;
@@ -402,7 +402,7 @@ void CJabberProto::PerformBrowse(HWND hwndDlg) mir_cslockfull lck(m_SDManager.cs());
m_SDManager.RemoveAll();
- if (!mir_tstrcmp(szJid, _T(SD_FAKEJID_MYAGENTS))) {
+ if (!mir_wstrcmp(szJid, _T(SD_FAKEJID_MYAGENTS))) {
sttBrowseMode = SD_BROWSE_MYAGENTS;
JABBER_LIST_ITEM *item = NULL;
LISTFOREACH(i, this, LIST_ROSTER)
@@ -414,7 +414,7 @@ void CJabberProto::PerformBrowse(HWND hwndDlg) setByte(hContact, "IsTransport", TRUE);
if (m_lstTransports.getIndex(item->jid) == -1)
- m_lstTransports.insert(mir_tstrdup(item->jid));
+ m_lstTransports.insert(mir_wstrdup(item->jid));
CJabberSDNode *pNode = m_SDManager.AddPrimaryNode(item->jid, NULL, NULL);
SendBothRequests(pNode, NULL);
@@ -422,9 +422,9 @@ void CJabberProto::PerformBrowse(HWND hwndDlg) }
}
}
- else if (!mir_tstrcmp(szJid, _T(SD_FAKEJID_CONFERENCES))) {
+ else if (!mir_wstrcmp(szJid, _T(SD_FAKEJID_CONFERENCES))) {
sttBrowseMode = SD_BROWSE_CONFERENCES;
- wchar_t *szServerJid = mir_a2t(m_ThreadInfo->conn.server);
+ wchar_t *szServerJid = mir_a2u(m_ThreadInfo->conn.server);
CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultServiceDiscoveryRootItems, JABBER_IQ_TYPE_GET, szServerJid);
pInfo->m_pUserData = (void*)JABBER_FEAT_MUC;
pInfo->SetTimeout(30000);
@@ -433,9 +433,9 @@ void CJabberProto::PerformBrowse(HWND hwndDlg) m_ThreadInfo->send(iq);
mir_free(szServerJid);
}
- else if (!mir_tstrcmp(szJid, _T(SD_FAKEJID_AGENTS))) {
+ else if (!mir_wstrcmp(szJid, _T(SD_FAKEJID_AGENTS))) {
sttBrowseMode = SD_BROWSE_AGENTS;
- wchar_t *szServerJid = mir_a2t(m_ThreadInfo->conn.server);
+ wchar_t *szServerJid = mir_a2u(m_ThreadInfo->conn.server);
CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultServiceDiscoveryRootItems, JABBER_IQ_TYPE_GET, szServerJid);
pInfo->m_pUserData = (void*)L"jabber:iq:gateway";
pInfo->SetTimeout(30000);
@@ -444,27 +444,27 @@ void CJabberProto::PerformBrowse(HWND hwndDlg) m_ThreadInfo->send(iq);
mir_free(szServerJid);
}
- else if (!mir_tstrcmp(szJid, _T(SD_FAKEJID_FAVORITES))) {
+ else if (!mir_wstrcmp(szJid, _T(SD_FAKEJID_FAVORITES))) {
sttBrowseMode = SD_BROWSE_FAVORITES;
int count = getDword("discoWnd_favCount", 0);
for (int i = 0; i < count; i++) {
char setting[MAXMODULELABELLENGTH];
mir_snprintf(setting, "discoWnd_favName_%d", i);
- ptrT tszName(getTStringA(setting));
+ ptrW tszName(getTStringA(setting));
if (tszName == NULL)
continue;
mir_snprintf(setting, "discoWnd_favJID_%d", i);
- ptrT dbvJid(getTStringA(setting));
+ ptrW dbvJid(getTStringA(setting));
mir_snprintf(setting, "discoWnd_favNode_%d", i);
- ptrT dbvNode(getTStringA(setting));
+ ptrW dbvNode(getTStringA(setting));
CJabberSDNode *pNode = m_SDManager.AddPrimaryNode(dbvJid, dbvNode, tszName);
SendBothRequests(pNode, NULL);
}
}
else {
sttBrowseMode = SD_BROWSE_NORMAL;
- CJabberSDNode *pNode = m_SDManager.AddPrimaryNode(szJid, mir_tstrlen(szNode) ? szNode : NULL, NULL);
+ CJabberSDNode *pNode = m_SDManager.AddPrimaryNode(szJid, mir_wstrlen(szNode) ? szNode : NULL, NULL);
SendBothRequests(pNode, NULL);
}
lck.unlock();
@@ -518,8 +518,8 @@ void CJabberProto::ApplyNodeIcon(HTREELISTITEM hItem, CJabberSDNode *pNode) if (sttNodeIcons[i].category) {
CJabberSDIdentity *iIdentity;
for (iIdentity = pNode->GetFirstIdentity(); iIdentity; iIdentity = iIdentity->GetNext())
- if (!mir_tstrcmp(iIdentity->GetCategory(), sttNodeIcons[i].category) &&
- (!sttNodeIcons[i].type || !mir_tstrcmp(iIdentity->GetType(), sttNodeIcons[i].type))) {
+ if (!mir_wstrcmp(iIdentity->GetCategory(), sttNodeIcons[i].category) &&
+ (!sttNodeIcons[i].type || !mir_wstrcmp(iIdentity->GetType(), sttNodeIcons[i].type))) {
iIcon = sttNodeIcons[i].listIndex;
break;
}
@@ -529,7 +529,7 @@ void CJabberProto::ApplyNodeIcon(HTREELISTITEM hItem, CJabberSDNode *pNode) if (sttNodeIcons[i].feature) {
CJabberSDFeature *iFeature;
for (iFeature = pNode->GetFirstFeature(); iFeature; iFeature = iFeature->GetNext())
- if (!mir_tstrcmp(iFeature->GetVar(), sttNodeIcons[i].feature)) {
+ if (!mir_wstrcmp(iFeature->GetVar(), sttNodeIcons[i].feature)) {
iIcon = sttNodeIcons[i].listIndex;
break;
}
@@ -802,7 +802,7 @@ void CJabberDlgDiscovery::btnBookmarks_OnClick(CCtrlButton *) for (int i = 0; i < count; i++) {
char setting[MAXMODULELABELLENGTH];
mir_snprintf(setting, "discoWnd_favName_%d", i);
- ptrT tszName(m_proto->getTStringA(setting));
+ ptrW tszName(m_proto->getTStringA(setting));
if (tszName != NULL) {
HMENU hSubMenu = CreatePopupMenu();
AppendMenu(hSubMenu, MF_STRING, 100 + i * 10 + 0, TranslateT("Navigate"));
@@ -851,7 +851,7 @@ void CJabberDlgDiscovery::btnBookmarks_OnClick(CCtrlButton *) char setting[MAXMODULELABELLENGTH];
mir_snprintf(setting, "discoWnd_favJID_%d", res);
- ptrT dbv(m_proto->getTStringA(setting));
+ ptrW dbv(m_proto->getTStringA(setting));
if (dbv) SetDlgItemText(m_hwnd, IDC_COMBO_JID, dbv);
mir_snprintf(setting, "discoWnd_favNode_%d", res);
@@ -1250,7 +1250,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM bool bFeatureOk = !bFilterItems;
if (bFilterItems)
for (CJabberSDFeature *iFeature = pNode->GetFirstFeature(); iFeature; iFeature = iFeature->GetNext())
- if (!mir_tstrcmp(iFeature->GetVar(), items[i].feature)) {
+ if (!mir_wstrcmp(iFeature->GetVar(), items[i].feature)) {
bFeatureOk = true;
break;
}
@@ -1381,7 +1381,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM item = ListAdd(LIST_ROOM, pNode->GetJid());
if (item == NULL)
break;
- item->name = mir_tstrdup(pNode->GetName());
+ item->name = mir_wstrdup(pNode->GetName());
}
item->type = L"conference";
diff --git a/protocols/JabberG/src/jabber_disco.h b/protocols/JabberG/src/jabber_disco.h index 486d4c7289..ecc55393e6 100644 --- a/protocols/JabberG/src/jabber_disco.h +++ b/protocols/JabberG/src/jabber_disco.h @@ -43,9 +43,9 @@ protected: public:
CJabberSDIdentity(const wchar_t *szCategory, const wchar_t *szType, const wchar_t *szName)
{
- m_szCategory = mir_tstrdup(szCategory);
- m_szType = mir_tstrdup(szType);
- m_szName = mir_tstrdup(szName);
+ m_szCategory = mir_wstrdup(szCategory);
+ m_szType = mir_wstrdup(szType);
+ m_szName = mir_wstrdup(szName);
m_pNext = NULL;
}
~CJabberSDIdentity()
@@ -89,7 +89,7 @@ protected: public:
CJabberSDFeature(const wchar_t *szVar)
{
- m_szVar = szVar ? mir_tstrdup(szVar) : NULL;
+ m_szVar = szVar ? mir_wstrdup(szVar) : NULL;
m_pNext = NULL;
}
~CJabberSDFeature()
@@ -134,9 +134,9 @@ protected: public:
CJabberSDNode(const wchar_t *szJid = NULL, const wchar_t *szNode = NULL, const wchar_t *szName = NULL)
{
- m_szJid = mir_tstrdup(szJid);
- m_szNode = mir_tstrdup(szNode);
- m_szName = mir_tstrdup(szName);
+ m_szJid = mir_wstrdup(szJid);
+ m_szNode = mir_wstrdup(szNode);
+ m_szName = mir_wstrdup(szName);
m_pIdentities = NULL;
m_pFeatures = NULL;
m_pNext = NULL;
@@ -155,11 +155,11 @@ public: }
BOOL RemoveAll()
{
- replaceStrT(m_szJid, NULL);
- replaceStrT(m_szNode, NULL);
- replaceStrT(m_szName, NULL);
- replaceStrT(m_szInfoError, NULL);
- replaceStrT(m_szItemsError, NULL);
+ replaceStrW(m_szJid, NULL);
+ replaceStrW(m_szNode, NULL);
+ replaceStrW(m_szName, NULL);
+ replaceStrW(m_szInfoError, NULL);
+ replaceStrW(m_szItemsError, NULL);
if (m_pIdentities)
delete m_pIdentities;
m_pIdentities = NULL;
@@ -181,8 +181,8 @@ public: }
BOOL ResetInfo()
{
- replaceStrT(m_szInfoError, NULL);
- replaceStrT(m_szItemsError, NULL);
+ replaceStrW(m_szInfoError, NULL);
+ replaceStrW(m_szItemsError, NULL);
if (m_pIdentities)
delete m_pIdentities;
m_pIdentities = NULL;
@@ -229,7 +229,7 @@ public: }
BOOL SetJid(wchar_t *szJid)
{
- replaceStrT(m_szJid, szJid);
+ replaceStrW(m_szJid, szJid);
return TRUE;
}
wchar_t *GetJid()
@@ -238,7 +238,7 @@ public: }
BOOL SetNode(wchar_t *szNode)
{
- replaceStrT(m_szNode, szNode);
+ replaceStrW(m_szNode, szNode);
return TRUE;
}
wchar_t *GetNode()
@@ -335,13 +335,13 @@ public: BOOL SetItemsRequestErrorText(wchar_t *szError)
{
- replaceStrT(m_szItemsError, szError);
+ replaceStrW(m_szItemsError, szError);
return TRUE;
}
BOOL SetInfoRequestErrorText(wchar_t *szError)
{
- replaceStrT(m_szInfoError, szError);
+ replaceStrW(m_szInfoError, szError);
return TRUE;
}
diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp index 24580a5207..61aecd3a6b 100644 --- a/protocols/JabberG/src/jabber_events.cpp +++ b/protocols/JabberG/src/jabber_events.cpp @@ -36,7 +36,7 @@ int CJabberProto::OnContactDeleted(WPARAM hContact, LPARAM) if (!m_bJabberOnline) // should never happen
return 0;
- ptrT jid(getTStringA(hContact, isChatRoom(hContact) ? "ChatRoomID" : "jid"));
+ ptrW jid(getTStringA(hContact, isChatRoom(hContact) ? "ChatRoomID" : "jid"));
if (jid == NULL)
return 0;
@@ -45,7 +45,7 @@ int CJabberProto::OnContactDeleted(WPARAM hContact, LPARAM) wchar_t szStrippedJid[JABBER_MAX_JID_LEN];
JabberStripJid(m_ThreadInfo->fullJID, szStrippedJid, _countof(szStrippedJid));
wchar_t *szDog = wcschr(szStrippedJid, '@');
- if (szDog && mir_tstrcmpi(szDog + 1, jid))
+ if (szDog && mir_wstrcmpi(szDog + 1, jid))
m_ThreadInfo->send(XmlNodeIq(L"set", SerialNext(), jid) << XQUERY(JABBER_FEAT_REGISTER) << XCHILD(L"remove"));
}
@@ -63,24 +63,24 @@ static wchar_t* sttSettingToTchar(DBCONTACTWRITESETTING *cws) {
switch (cws->value.type) {
case DBVT_ASCIIZ:
- return mir_a2t(cws->value.pszVal);
+ return mir_a2u(cws->value.pszVal);
case DBVT_UTF8:
- return mir_utf8decodeT(cws->value.pszVal);
+ return mir_utf8decodeW(cws->value.pszVal);
case DBVT_WCHAR:
- return mir_u2t(cws->value.pwszVal);
+ return mir_wstrdup(cws->value.pwszVal);
}
return NULL;
}
void __cdecl CJabberProto::OnRenameGroup(DBCONTACTWRITESETTING *cws, MCONTACT hContact)
{
- JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, ptrT(getTStringA(hContact, "jid")));
+ JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, ptrW(getTStringA(hContact, "jid")));
if (item == NULL)
return;
- ptrT tszNick(db_get_tsa(hContact, "CList", "MyHandle"));
+ ptrW tszNick(db_get_tsa(hContact, "CList", "MyHandle"));
if (tszNick == NULL)
tszNick = getTStringA(hContact, "Nick");
if (tszNick == NULL)
@@ -96,7 +96,7 @@ void __cdecl CJabberProto::OnRenameGroup(DBCONTACTWRITESETTING *cws, MCONTACT hC }
else {
wchar_t *p = sttSettingToTchar(cws);
- if (cws->value.pszVal != NULL && mir_tstrcmp(p, item->group)) {
+ if (cws->value.pszVal != NULL && mir_wstrcmp(p, item->group)) {
debugLog(L"Group set to %s", p);
if (p)
AddContactToRoster(item->jid, tszNick, p);
@@ -107,7 +107,7 @@ void __cdecl CJabberProto::OnRenameGroup(DBCONTACTWRITESETTING *cws, MCONTACT hC void __cdecl CJabberProto::OnRenameContact(DBCONTACTWRITESETTING *cws, MCONTACT hContact)
{
- JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, ptrT( getTStringA(hContact, "jid")));
+ JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, ptrW( getTStringA(hContact, "jid")));
if (item == NULL)
return;
@@ -118,8 +118,8 @@ void __cdecl CJabberProto::OnRenameContact(DBCONTACTWRITESETTING *cws, MCONTACT return;
}
- ptrT newNick( sttSettingToTchar(cws));
- if (newNick && mir_tstrcmp(item->nick, newNick)) {
+ ptrW newNick( sttSettingToTchar(cws));
+ if (newNick && mir_wstrcmp(item->nick, newNick)) {
debugLog(L"Renaming contact %s: %s -> %s", item->jid, item->nick, newNick);
AddContactToRoster(item->jid, newNick, item->group);
}
@@ -130,12 +130,12 @@ void __cdecl CJabberProto::OnAddContactForever(DBCONTACTWRITESETTING *cws, MCONT if (cws->value.type != DBVT_DELETED && !(cws->value.type == DBVT_BYTE && cws->value.bVal == 0))
return;
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid == NULL)
return;
debugLog(L"Add %s permanently to list", jid);
- ptrT nick(db_get_tsa(hContact, "CList", "MyHandle"));
+ ptrW nick(db_get_tsa(hContact, "CList", "MyHandle"));
if (nick == NULL)
nick = getTStringA(hContact, "Nick");
if (nick == NULL)
@@ -143,10 +143,10 @@ void __cdecl CJabberProto::OnAddContactForever(DBCONTACTWRITESETTING *cws, MCONT if (nick == NULL)
return;
- AddContactToRoster(jid, nick, ptrT(db_get_tsa(hContact, "CList", "Group")));
+ AddContactToRoster(jid, nick, ptrW(db_get_tsa(hContact, "CList", "Group")));
XmlNode xPresence(L"presence"); xPresence << XATTR(L"to", LPCTSTR(jid)) << XATTR(L"type", L"subscribe");
- ptrT myNick(getTStringA(NULL, "Nick"));
+ ptrW myNick(getTStringA(NULL, "Nick"));
if (myNick != NULL)
xPresence << XCHILD(L"nick", LPCTSTR(myNick)) << XATTR(L"xmlns", JABBER_FEAT_NICK);
m_ThreadInfo->send(xPresence);
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp index a3e2c0776f..27eda280b2 100644 --- a/protocols/JabberG/src/jabber_file.cpp +++ b/protocols/JabberG/src/jabber_file.cpp @@ -118,7 +118,7 @@ int CJabberProto::FileReceiveParse(filetransfer *ft, char* buffer, int datalen) s++;
else
s = ft->httpPath;
- ft->std.tszCurrentFile = mir_tstrdup(s);
+ ft->std.tszCurrentFile = mir_wstrdup(s);
JabberHttpUrlDecode(ft->std.tszCurrentFile);
if (ft->create() == -1) {
ft->state = FT_ERROR;
@@ -179,7 +179,7 @@ void JabberFileServerConnection(JABBER_SOCKET hConnection, DWORD /*dwRemoteIP*/, CallService(MS_NETLIB_GETCONNECTIONINFO, (WPARAM)hConnection, (LPARAM)&connInfo);
wchar_t szPort[10];
- mir_sntprintf(szPort, L"%d", connInfo.wPort);
+ mir_snwprintf(szPort, L"%d", connInfo.wPort);
ppro->debugLogA("File server incoming connection accepted: %s", connInfo.szIpPort);
JABBER_LIST_ITEM *item = ppro->ListGetItemPtr(LIST_FILE, szPort);
@@ -260,7 +260,7 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft) ft->hFileEvent = hEvent;
wchar_t szPort[20];
- mir_sntprintf(szPort, L"%d", nlb.wPort);
+ mir_snwprintf(szPort, L"%d", nlb.wPort);
JABBER_LIST_ITEM *item = ListAdd(LIST_FILE, szPort);
item->ft = ft;
@@ -292,9 +292,9 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft) char szAddr[256];
mir_snprintf(szAddr, "http://%s:%d/%s", myAddr, nlb.wPort, pFileName);
- size_t len = mir_tstrlen(ptszResource) + mir_tstrlen(ft->jid) + 2;
+ size_t len = mir_wstrlen(ptszResource) + mir_wstrlen(ft->jid) + 2;
wchar_t *fulljid = (wchar_t *)alloca(sizeof(wchar_t) * len);
- mir_sntprintf(fulljid, len, L"%s/%s", ft->jid, ptszResource);
+ mir_snwprintf(fulljid, len, L"%s/%s", ft->jid, ptszResource);
XmlNodeIq iq(L"set", ft->szId, fulljid);
HXML query = iq << XQUERY(JABBER_FEAT_OOB);
@@ -366,7 +366,7 @@ int CJabberProto::FileSendParse(JABBER_SOCKET s, filetransfer *ft, char* buffer, for (t = str + 4; *t != '\0' && *t != ' '; t++);
*t = '\0';
for (t = str + 4; *t != '\0' && *t == '/'; t++);
- ft->httpPath = mir_a2t(t);
+ ft->httpPath = mir_a2u(t);
JabberHttpUrlDecode(ft->httpPath);
ft->state = FT_INITIALIZING;
debugLogA("Change to FT_INITIALIZING");
@@ -386,7 +386,7 @@ int CJabberProto::FileSendParse(JABBER_SOCKET s, filetransfer *ft, char* buffer, else
t = ft->std.ptszFiles[currentFile];
- if (ft->httpPath == NULL || mir_tstrcmp(ft->httpPath, t)) {
+ if (ft->httpPath == NULL || mir_wstrcmp(ft->httpPath, t)) {
if (ft->httpPath == NULL)
debugLogA("Requested file name does not matched (httpPath == NULL)");
else
@@ -501,8 +501,8 @@ int filetransfer::create() return fileId;
wchar_t filefull[MAX_PATH];
- mir_sntprintf(filefull, L"%s\\%s", std.tszWorkingDir, std.tszCurrentFile);
- replaceStrT(std.tszCurrentFile, filefull);
+ mir_snwprintf(filefull, L"%s\\%s", std.tszWorkingDir, std.tszCurrentFile);
+ replaceStrW(std.tszCurrentFile, filefull);
if (hWaitEvent != INVALID_HANDLE_VALUE)
CloseHandle(hWaitEvent);
diff --git a/protocols/JabberG/src/jabber_form.cpp b/protocols/JabberG/src/jabber_form.cpp index a74abfae40..ceabe55ba9 100644 --- a/protocols/JabberG/src/jabber_form.cpp +++ b/protocols/JabberG/src/jabber_form.cpp @@ -110,7 +110,7 @@ void JabberFormSetInstruction(HWND hwndForm, const wchar_t *text) {
if (!text) text = L"";
- size_t len = mir_tstrlen(text);
+ size_t len = mir_wstrlen(text);
size_t fixedLen = len;
for (int i = 1; i < len; i++)
if ((text[i - 1] == '\n') && (text[i] != '\r'))
@@ -142,7 +142,7 @@ void JabberFormSetInstruction(HWND hwndForm, const wchar_t *text) SetRect(&rcText, 0, 0, rcText.right - rcText.left, 0);
HDC hdcEdit = GetDC(GetDlgItem(hwndForm, IDC_INSTRUCTION));
HFONT hfntSave = (HFONT)SelectObject(hdcEdit, (HFONT)SendDlgItemMessage(hwndForm, IDC_INSTRUCTION, WM_GETFONT, 0, 0));
- DrawTextEx(hdcEdit, (wchar_t *)text, (int)mir_tstrlen(text), &rcText, DT_CALCRECT | DT_EDITCONTROL | DT_TOP | DT_WORDBREAK, NULL);
+ DrawTextEx(hdcEdit, (wchar_t *)text, (int)mir_wstrlen(text), &rcText, DT_CALCRECT | DT_EDITCONTROL | DT_TOP | DT_WORDBREAK, NULL);
SelectObject(hdcEdit, hfntSave);
ReleaseDC(GetDlgItem(hwndForm, IDC_INSTRUCTION), hdcEdit);
@@ -205,19 +205,19 @@ void JabberFormSetInstruction(HWND hwndForm, const wchar_t *text) static TJabberFormControlType JabberFormTypeNameToId(const wchar_t *type)
{
- if (!mir_tstrcmp(type, L"text-private"))
+ if (!mir_wstrcmp(type, L"text-private"))
return JFORM_CTYPE_TEXT_PRIVATE;
- if (!mir_tstrcmp(type, L"text-multi") || !mir_tstrcmp(type, L"jid-multi"))
+ if (!mir_wstrcmp(type, L"text-multi") || !mir_wstrcmp(type, L"jid-multi"))
return JFORM_CTYPE_TEXT_MULTI;
- if (!mir_tstrcmp(type, L"boolean"))
+ if (!mir_wstrcmp(type, L"boolean"))
return JFORM_CTYPE_BOOLEAN;
- if (!mir_tstrcmp(type, L"list-single"))
+ if (!mir_wstrcmp(type, L"list-single"))
return JFORM_CTYPE_LIST_SINGLE;
- if (!mir_tstrcmp(type, L"list-multi"))
+ if (!mir_wstrcmp(type, L"list-multi"))
return JFORM_CTYPE_LIST_MULTI;
- if (!mir_tstrcmp(type, L"fixed"))
+ if (!mir_wstrcmp(type, L"fixed"))
return JFORM_CTYPE_FIXED;
- if (!mir_tstrcmp(type, L"hidden"))
+ if (!mir_wstrcmp(type, L"hidden"))
return JFORM_CTYPE_HIDDEN;
return JFORM_CTYPE_TEXT_SINGLE;
@@ -323,7 +323,7 @@ TJabberFormControlInfo *JabberFormAppendControl(HWND hwndStatic, TJabberFormLayo WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX | BS_MULTILINE,
0, 0, 0, 0,
hwndStatic, (HMENU)layout_info->id, hInst, NULL);
- if (valueStr && !mir_tstrcmp(valueStr, L"1"))
+ if (valueStr && !mir_wstrcmp(valueStr, L"1"))
SendMessage(item->hCtrl, BM_SETCHECK, 1, 0);
++layout_info->id;
break;
@@ -440,7 +440,7 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp wchar_t *labelStr, *valueStr;
RECT frameRect;
- if (xNode == NULL || XmlGetName(xNode) == NULL || mir_tstrcmp(XmlGetName(xNode), L"x") || hwndStatic == NULL)
+ if (xNode == NULL || XmlGetName(xNode) == NULL || mir_wstrcmp(XmlGetName(xNode), L"x") || hwndStatic == NULL)
return;
GetClientRect(hwndStatic, &frameRect);
@@ -460,7 +460,7 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp if (!n)
break;
- if (mir_tstrcmp(XmlGetName(n), L"field"))
+ if (mir_wstrcmp(XmlGetName(n), L"field"))
continue;
varStr = XmlGetAttrValue(n, L"var");
@@ -468,24 +468,24 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp continue;
if ((label = XmlGetAttrValue(n, L"label")) != NULL)
- labelStr = mir_tstrdup(label);
+ labelStr = mir_wstrdup(label);
else
- labelStr = mir_tstrdup(varStr);
+ labelStr = mir_wstrdup(varStr);
TJabberFormControlType type = JabberFormTypeNameToId(typeName);
if ((v = XmlGetChild(n, "value")) != NULL) {
valueText = XmlGetText(v);
if (type != JFORM_CTYPE_TEXT_MULTI)
- valueStr = mir_tstrdup(valueText);
+ valueStr = mir_wstrdup(valueText);
else {
size_t size = 1;
for (int j = 0;; j++) {
v = XmlGetChild(n, j);
if (!v)
break;
- if (XmlGetName(v) && !mir_tstrcmp(XmlGetName(v), L"value") && XmlGetText(v))
- size += mir_tstrlen(XmlGetText(v)) + 2;
+ if (XmlGetName(v) && !mir_wstrcmp(XmlGetName(v), L"value") && XmlGetText(v))
+ size += mir_wstrlen(XmlGetText(v)) + 2;
}
valueStr = (wchar_t*)mir_alloc(sizeof(wchar_t)*size);
valueStr[0] = '\0';
@@ -493,10 +493,10 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp v = XmlGetChild(n, j);
if (!v)
break;
- if (XmlGetName(v) && !mir_tstrcmp(XmlGetName(v), L"value") && XmlGetText(v)) {
+ if (XmlGetName(v) && !mir_wstrcmp(XmlGetName(v), L"value") && XmlGetText(v)) {
if (valueStr[0])
- mir_tstrcat(valueStr, L"\r\n");
- mir_tstrcat(valueStr, XmlGetText(v));
+ mir_wstrcat(valueStr, L"\r\n");
+ mir_wstrcat(valueStr, XmlGetText(v));
}
}
}
@@ -514,7 +514,7 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp if (o == NULL)
break;
- if (mir_tstrcmp(XmlGetName(o), L"option"))
+ if (mir_wstrcmp(XmlGetName(o), L"option"))
continue;
if ((v = XmlGetChild(o, "value")) == NULL || XmlGetText(v) == NULL)
continue;
@@ -523,7 +523,7 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp if (str == NULL)
continue;
- bool selected = !mir_tstrcmp(valueText, XmlGetText(v));
+ bool selected = !mir_wstrcmp(valueText, XmlGetText(v));
JabberFormAddListItem(item, str, selected);
}
}
@@ -533,7 +533,7 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp if (o == NULL)
break;
- if (mir_tstrcmp(XmlGetName(o), L"option"))
+ if (mir_wstrcmp(XmlGetName(o), L"option"))
continue;
if ((v = XmlGetChild(o, "value")) == NULL || XmlGetText(v) == NULL)
continue;
@@ -547,7 +547,7 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp vs = XmlGetChild(n, k);
if (!vs)
break;
- if (!mir_tstrcmp(XmlGetName(vs), L"value") && !mir_tstrcmp(XmlGetText(vs), XmlGetText(v))) {
+ if (!mir_wstrcmp(XmlGetName(vs), L"value") && !mir_wstrcmp(XmlGetText(vs), XmlGetText(v))) {
selected = true;
break;
}
@@ -579,7 +579,7 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) const wchar_t *varName, *type, *fieldStr, *labelText, *str2;
wchar_t *p, *q, *str;
- if (xNode == NULL || XmlGetName(xNode) == NULL || mir_tstrcmp(XmlGetName(xNode), L"x") || hwndStatic == NULL)
+ if (xNode == NULL || XmlGetName(xNode) == NULL || mir_wstrcmp(XmlGetName(xNode), L"x") || hwndStatic == NULL)
return NULL;
hFrame = hwndStatic;
@@ -593,7 +593,7 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) break;
fieldStr = NULL;
- if (mir_tstrcmp(XmlGetName(n), L"field"))
+ if (mir_wstrcmp(XmlGetName(n), L"field"))
continue;
if ((varName = XmlGetAttrValue(n, L"var")) == NULL || (type = XmlGetAttrValue(n, L"type")) == NULL)
@@ -602,7 +602,7 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) hCtrl = GetDlgItem(hFrame, id);
HXML field = x << XCHILD(L"field") << XATTR(L"var", varName);
- if (!mir_tstrcmp(type, L"text-multi") || !mir_tstrcmp(type, L"jid-multi")) {
+ if (!mir_wstrcmp(type, L"text-multi") || !mir_wstrcmp(type, L"jid-multi")) {
len = GetWindowTextLength(GetDlgItem(hFrame, id));
str = (wchar_t*)mir_alloc(sizeof(wchar_t)*(len + 1));
GetDlgItemText(hFrame, id, str, len + 1);
@@ -616,13 +616,13 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) mir_free(str);
id++;
}
- else if (!mir_tstrcmp(type, L"boolean")) {
+ else if (!mir_wstrcmp(type, L"boolean")) {
wchar_t buf[10];
_itow(IsDlgButtonChecked(hFrame, id) == BST_CHECKED ? 1 : 0, buf, 10);
field << XCHILD(L"value", buf);
id++;
}
- else if (!mir_tstrcmp(type, L"list-single")) {
+ else if (!mir_wstrcmp(type, L"list-single")) {
len = GetWindowTextLength(GetDlgItem(hFrame, id));
str = (wchar_t*)mir_alloc(sizeof(wchar_t)*(len + 1));
GetDlgItemText(hFrame, id, str, len + 1);
@@ -632,11 +632,11 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) if (!o)
break;
- if (!mir_tstrcmp(XmlGetName(o), L"option")) {
+ if (!mir_wstrcmp(XmlGetName(o), L"option")) {
if ((v = XmlGetChild(o, "value")) != NULL && XmlGetText(v)) {
if ((str2 = XmlGetAttrValue(o, L"label")) == NULL)
str2 = XmlGetText(v);
- if (!mir_tstrcmp(str2, str))
+ if (!mir_wstrcmp(str2, str))
break;
}
}
@@ -648,7 +648,7 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) mir_free(str);
id++;
}
- else if (!mir_tstrcmp(type, L"list-multi")) {
+ else if (!mir_wstrcmp(type, L"list-multi")) {
int count = SendMessage(hCtrl, LB_GETCOUNT, 0, 0);
for (j = 0; j < count; j++) {
if (SendMessage(hCtrl, LB_GETSEL, j, 0) > 0) {
@@ -661,12 +661,12 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) if (!o)
break;
- if (XmlGetName(o) && !mir_tstrcmp(XmlGetName(o), L"option")) {
+ if (XmlGetName(o) && !mir_wstrcmp(XmlGetName(o), L"option")) {
if ((v = XmlGetChild(o, "value")) != NULL && XmlGetText(v)) {
if ((labelText = XmlGetAttrValue(o, L"label")) == NULL)
labelText = XmlGetText(v);
- if (!mir_tstrcmp(labelText, str))
+ if (!mir_wstrcmp(labelText, str))
field << XCHILD(L"value", XmlGetText(v));
}
}
@@ -677,7 +677,7 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) }
id++;
}
- else if (!mir_tstrcmp(type, L"fixed") || !mir_tstrcmp(type, L"hidden")) {
+ else if (!mir_wstrcmp(type, L"fixed") || !mir_wstrcmp(type, L"hidden")) {
v = XmlGetChild(n, "value");
if (v != NULL && XmlGetText(v) != NULL)
field << XCHILD(L"value", XmlGetText(v));
diff --git a/protocols/JabberG/src/jabber_frame.cpp b/protocols/JabberG/src/jabber_frame.cpp index c41f958c7b..e1da41f62c 100644 --- a/protocols/JabberG/src/jabber_frame.cpp +++ b/protocols/JabberG/src/jabber_frame.cpp @@ -59,7 +59,7 @@ public: void SetInfo(HANDLE hIcolibIcon, wchar_t *pszText)
{
mir_free(m_pszText);
- m_pszText = pszText ? mir_tstrdup(pszText) : NULL;
+ m_pszText = pszText ? mir_wstrdup(pszText) : NULL;
m_hIcolibIcon = hIcolibIcon;
}
@@ -83,7 +83,7 @@ CJabberInfoFrame::CJabberInfoFrame(CJabberProto *proto): frame.align = alBottom;
frame.height = 2 * SZ_FRAMEPADDING + GetSystemMetrics(SM_CYSMICON) + SZ_LINEPADDING; // compact height by default
frame.Flags = F_VISIBLE|F_LOCKED|F_NOBORDER|F_TCHAR;
- frame.tname = mir_a2t(proto->m_szModuleName);
+ frame.tname = mir_a2u(proto->m_szModuleName);
frame.TBtname = proto->m_tszUserName;
m_frameId = CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&frame, 0);
mir_free(frame.tname);
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp index a7142148d4..01ef6ac638 100644 --- a/protocols/JabberG/src/jabber_ft.cpp +++ b/protocols/JabberG/src/jabber_ft.cpp @@ -94,13 +94,13 @@ void CJabberProto::FtInitiate(wchar_t* jid, filetransfer *ft) sid[i] = (rand() % 10) + '0';
sid[8] = '\0';
if (ft->sid != NULL) mir_free(ft->sid);
- ft->sid = mir_tstrdup(sid);
+ ft->sid = mir_wstrdup(sid);
filename = ft->std.ptszFiles[ft->std.currentFileNumber];
if ((p = wcsrchr(filename, '\\')) != NULL)
filename = p + 1;
wchar_t tszJid[512];
- mir_sntprintf(tszJid, L"%s/%s", jid, rs);
+ mir_snwprintf(tszJid, L"%s/%s", jid, rs);
XmlNodeIq iq(AddIQ(&CJabberProto::OnFtSiResult, JABBER_IQ_TYPE_SET, tszJid, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_TO, -1, ft));
HXML si = iq << XCHILDNS(L"si", JABBER_FEAT_SI) << XATTR(L"id", sid)
@@ -140,13 +140,13 @@ void CJabberProto::OnFtSiResult(HXML iqNode, CJabberIqInfo *pInfo) if ((xNode = XmlGetChildByTag(featureNode, "x", "xmlns", JABBER_FEAT_DATA_FORMS)) != NULL) {
if ((fieldNode = XmlGetChildByTag(xNode, "field", "var", L"stream-method")) != NULL) {
if ((valueNode = XmlGetChild(fieldNode, "value")) != NULL && XmlGetText(valueNode) != NULL) {
- if ((bDirect || bProxy) && !mir_tstrcmp(XmlGetText(valueNode), JABBER_FEAT_BYTESTREAMS)) {
+ if ((bDirect || bProxy) && !mir_wstrcmp(XmlGetText(valueNode), JABBER_FEAT_BYTESTREAMS)) {
// Start Bytestream session
JABBER_BYTE_TRANSFER *jbt = new JABBER_BYTE_TRANSFER;
memset(jbt, 0, sizeof(JABBER_BYTE_TRANSFER));
- jbt->srcJID = mir_tstrdup(pInfo->m_szTo);
- jbt->dstJID = mir_tstrdup(pInfo->m_szFrom);
- jbt->sid = mir_tstrdup(ft->sid);
+ jbt->srcJID = mir_wstrdup(pInfo->m_szTo);
+ jbt->dstJID = mir_wstrdup(pInfo->m_szFrom);
+ jbt->sid = mir_wstrdup(ft->sid);
jbt->pfnSend = &CJabberProto::FtSend;
jbt->pfnFinal = &CJabberProto::FtSendFinal;
jbt->ft = ft;
@@ -154,12 +154,12 @@ void CJabberProto::OnFtSiResult(HXML iqNode, CJabberIqInfo *pInfo) ft->jbt = jbt;
ForkThread((MyThreadFunc)&CJabberProto::ByteSendThread, jbt);
}
- else if (!mir_tstrcmp(XmlGetText(valueNode), JABBER_FEAT_IBB)) {
+ else if (!mir_wstrcmp(XmlGetText(valueNode), JABBER_FEAT_IBB)) {
JABBER_IBB_TRANSFER *jibb = (JABBER_IBB_TRANSFER *)mir_alloc(sizeof(JABBER_IBB_TRANSFER));
memset(jibb, 0, sizeof(JABBER_IBB_TRANSFER));
- jibb->srcJID = mir_tstrdup(pInfo->m_szTo);
- jibb->dstJID = mir_tstrdup(pInfo->m_szFrom);
- jibb->sid = mir_tstrdup(ft->sid);
+ jibb->srcJID = mir_wstrdup(pInfo->m_szTo);
+ jibb->dstJID = mir_wstrdup(pInfo->m_szFrom);
+ jibb->sid = mir_wstrdup(ft->sid);
jibb->pfnSend = &CJabberProto::FtIbbSend;
jibb->pfnFinal = &CJabberProto::FtSendFinal;
jibb->ft = ft;
@@ -284,7 +284,7 @@ void CJabberProto::FtSendFinal(BOOL success, filetransfer *ft) else {
if (ft->std.currentFileNumber < ft->std.totalFiles - 1) {
ft->std.currentFileNumber++;
- replaceStrT(ft->std.tszCurrentFile, ft->std.ptszFiles[ft->std.currentFileNumber]);
+ replaceStrW(ft->std.tszCurrentFile, ft->std.ptszFiles[ft->std.currentFileNumber]);
ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_NEXTFILE, ft, 0);
FtInitiate(ft->jid, ft);
return;
@@ -307,7 +307,7 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode) if (!iqNode ||
(from = XmlGetAttrValue(iqNode, L"from")) == NULL ||
- (str = XmlGetAttrValue(iqNode, L"type")) == NULL || mir_tstrcmp(str, L"set") ||
+ (str = XmlGetAttrValue(iqNode, L"type")) == NULL || mir_wstrcmp(str, L"set") ||
(siNode = XmlGetChildByTag(iqNode, "si", "xmlns", JABBER_FEAT_SI)) == NULL)
return;
@@ -332,9 +332,9 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode) if (!optionNode)
break;
- if (!mir_tstrcmp(XmlGetName(optionNode), L"option")) {
+ if (!mir_wstrcmp(XmlGetName(optionNode), L"option")) {
if ((n = XmlGetChild(optionNode, "value")) != NULL && XmlGetText(n)) {
- if (!mir_tstrcmp(XmlGetText(n), JABBER_FEAT_BYTESTREAMS)) {
+ if (!mir_wstrcmp(XmlGetText(n), JABBER_FEAT_BYTESTREAMS)) {
ftType = FT_BYTESTREAM;
break;
}
@@ -350,9 +350,9 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode) if (!optionNode)
break;
- if (!mir_tstrcmp(XmlGetName(optionNode), L"option")) {
+ if (!mir_wstrcmp(XmlGetName(optionNode), L"option")) {
if ((n = XmlGetChild(optionNode, "value")) != NULL && XmlGetText(n)) {
- if (!mir_tstrcmp(XmlGetText(n), JABBER_FEAT_IBB)) {
+ if (!mir_wstrcmp(XmlGetText(n), JABBER_FEAT_IBB)) {
ftType = FT_IBB;
break;
}
@@ -365,13 +365,13 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode) // Found known stream mechanism
filetransfer *ft = new filetransfer(this);
ft->dwExpectedRecvFileSize = filesize;
- ft->jid = mir_tstrdup(from);
+ ft->jid = mir_wstrdup(from);
ft->std.hContact = HContactFromJID(from);
- ft->sid = mir_tstrdup(sid);
- ft->szId = mir_tstrdup(szId);
+ ft->sid = mir_wstrdup(sid);
+ ft->szId = mir_wstrdup(szId);
ft->type = ftType;
ft->std.totalFiles = 1;
- ft->std.tszCurrentFile = mir_tstrdup(filename);
+ ft->std.tszCurrentFile = mir_wstrdup(filename);
ft->std.totalBytes = ft->std.currentFileSize = filesize;
PROTORECVFILET pre = { 0 };
@@ -497,9 +497,9 @@ BOOL CJabberProto::FtHandleIbbRequest(HXML iqNode, BOOL bOpen) if (!item->jibb) {
JABBER_IBB_TRANSFER *jibb = (JABBER_IBB_TRANSFER *)mir_alloc(sizeof(JABBER_IBB_TRANSFER));
memset(jibb, 0, sizeof(JABBER_IBB_TRANSFER));
- jibb->srcJID = mir_tstrdup(from);
- jibb->dstJID = mir_tstrdup(to);
- jibb->sid = mir_tstrdup(sid);
+ jibb->srcJID = mir_wstrdup(from);
+ jibb->dstJID = mir_wstrdup(to);
+ jibb->sid = mir_wstrdup(sid);
jibb->pfnRecv = &CJabberProto::FtReceive;
jibb->pfnFinal = &CJabberProto::FtReceiveFinal;
jibb->ft = item->ft;
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index 9188846f5e..52bef54a38 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -33,7 +33,7 @@ int JabberGcGetStatus(JABBER_RESOURCE_STATUS *r); struct JabberGcRecentInfo
{
- ptrT m_room, m_server, m_nick, m_password;
+ ptrW m_room, m_server, m_nick, m_password;
CJabberProto *ppro;
JabberGcRecentInfo(CJabberProto *proto)
@@ -92,10 +92,10 @@ struct JabberGcRecentInfo void fillData(const wchar_t *room, const wchar_t *server, const wchar_t *nick = NULL, const wchar_t *password = NULL)
{
- m_room = mir_tstrdup(room);
- m_server = mir_tstrdup(server);
- m_nick = mir_tstrdup(nick);
- m_password = mir_tstrdup(password);
+ m_room = mir_wstrdup(room);
+ m_server = mir_wstrdup(server);
+ m_nick = mir_wstrdup(nick);
+ m_password = mir_wstrdup(password);
}
void fillData(const wchar_t *jid)
@@ -173,7 +173,7 @@ private: if (!str1 && str2) return FALSE;
if (!str2 && str1) return FALSE;
- return !mir_tstrcmp(str1, str2);
+ return !mir_wstrcmp(str1, str2);
}
};
@@ -185,16 +185,16 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleJoinGroupchat(WPARAM, LPARAM) INT_PTR __cdecl CJabberProto::OnJoinChat(WPARAM hContact, LPARAM)
{
- ptrT jid(getTStringA(hContact, "ChatRoomID"));
+ ptrW jid(getTStringA(hContact, "ChatRoomID"));
if (jid == NULL)
return 0;
- ptrT nick(getTStringA(hContact, "MyNick"));
+ ptrW nick(getTStringA(hContact, "MyNick"));
if (nick == NULL)
if ((nick = getTStringA("Nick")) == NULL)
return 0;
- ptrT password(getTStringA(hContact, "Password"));
+ ptrW password(getTStringA(hContact, "Password"));
if (getWord(hContact, "Status", 0) != ID_STATUS_ONLINE) {
wchar_t *p = wcschr(jid, '@');
@@ -209,7 +209,7 @@ INT_PTR __cdecl CJabberProto::OnJoinChat(WPARAM hContact, LPARAM) INT_PTR __cdecl CJabberProto::OnLeaveChat(WPARAM hContact, LPARAM)
{
- ptrT jid(getTStringA(hContact, "ChatRoomID"));
+ ptrW jid(getTStringA(hContact, "ChatRoomID"));
if (jid != NULL) {
if (getWord(hContact, "Status", 0) != ID_STATUS_OFFLINE) {
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_CHATROOM, jid);
@@ -246,12 +246,12 @@ void CJabberProto::GroupchatJoinRoom(const wchar_t *server, const wchar_t *room, }
wchar_t text[JABBER_MAX_JID_LEN + 1];
- mir_sntprintf(text, L"%s@%s/%s", room, server, nick);
+ mir_snwprintf(text, L"%s@%s/%s", room, server, nick);
JABBER_LIST_ITEM *item = ListAdd(LIST_CHATROOM, text);
item->bAutoJoin = autojoin;
- replaceStrT(item->nick, nick);
- replaceStrT(item->password, info.m_password);
+ replaceStrW(item->nick, nick);
+ replaceStrW(item->password, info.m_password);
int status = (m_iStatus == ID_STATUS_INVISIBLE) ? ID_STATUS_ONLINE : m_iStatus;
XmlNode x(L"x"); x << XATTR(L"xmlns", JABBER_FEAT_MUC);
@@ -277,8 +277,8 @@ static int sttRoomListAppend(HWND hwndList, RoomInfo::Overlay overlay, const wch {
RoomInfo *info = (RoomInfo *)mir_alloc(sizeof(RoomInfo));
info->overlay = overlay;
- info->line1 = line1 ? mir_tstrdup(line1) : 0;
- info->line2 = line2 ? mir_tstrdup(line2) : 0;
+ info->line1 = line1 ? mir_wstrdup(line1) : 0;
+ info->line2 = line2 ? mir_wstrdup(line2) : 0;
int id = SendMessage(hwndList, CB_ADDSTRING, 0, (LPARAM)name);
SendMessage(hwndList, CB_SETITEMDATA, id, (LPARAM)info);
@@ -403,7 +403,7 @@ protected: CJabberDlgGcJoin::CJabberDlgGcJoin(CJabberProto *proto, wchar_t *jid) :
CSuper(proto, IDD_GROUPCHAT_JOIN, NULL),
btnOk(this, IDOK),
- m_jid(mir_tstrdup(jid))
+ m_jid(mir_wstrdup(jid))
{
btnOk.OnClick = Callback(this, &CJabberDlgGcJoin::OnBtnOk);
}
@@ -439,7 +439,7 @@ void CJabberDlgGcJoin::OnInitDialog() delete pInfo;
}
- ptrT tszNick(m_proto->getTStringA("Nick"));
+ ptrW tszNick(m_proto->getTStringA("Nick"));
if (tszNick == NULL)
tszNick = JabberNickFromJID(m_proto->m_szJabberJID);
SetDlgItemText(m_hwnd, IDC_NICK, tszNick);
@@ -471,7 +471,7 @@ void CJabberDlgGcJoin::OnInitDialog() if (!info.loadRecent(i))
break;
- mir_sntprintf(jid, L"%s@%s (%s)", info.m_room, info.m_server, info.m_nick ? info.m_nick : TranslateT("<no nick>"));
+ mir_snwprintf(jid, L"%s@%s (%s)", info.m_room, info.m_server, info.m_nick ? info.m_nick : TranslateT("<no nick>"));
SetDlgItemText(m_hwnd, IDC_RECENT1 + i, jid);
}
sttJoinDlgShowRecentItems(m_hwnd, i);
@@ -652,7 +652,7 @@ INT_PTR CJabberDlgGcJoin::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) {
JABBER_LIST_ITEM *item = 0;
if (item = m_proto->ListGetItemPtrFromIndex(i))
- if (!mir_tstrcmp(item->type, L"conference"))
+ if (!mir_wstrcmp(item->type, L"conference"))
AppendMenu(hMenu, MF_STRING, (UINT_PTR)item, item->name);
}
AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);
@@ -728,7 +728,7 @@ struct JabberGroupchatChangeNicknameParam {
JabberGroupchatChangeNicknameParam(CJabberProto* ppro_, const wchar_t *jid_) :
ppro(ppro_),
- jid(mir_tstrdup(jid_))
+ jid(mir_wstrdup(jid_))
{}
~JabberGroupchatChangeNicknameParam()
@@ -753,7 +753,7 @@ static VOID CALLBACK JabberGroupchatChangeNickname(void* arg) szBuffer = item->nick;
if (param->ppro->EnterString(szBuffer, szTitle, ESF_COMBO, "gcNick_")) {
- replaceStrT(item->nick, szBuffer);
+ replaceStrW(item->nick, szBuffer);
param->ppro->SendPresenceTo(param->ppro->m_iStatus, CMString(FORMAT, L"%s/%s", item->jid, szBuffer), NULL);
}
}
@@ -785,10 +785,10 @@ void CJabberProto::RenameParticipantNick(JABBER_LIST_ITEM *item, const wchar_t * if (r == NULL)
return;
- r->m_tszResourceName = mir_tstrdup(newNick);
+ r->m_tszResourceName = mir_wstrdup(newNick);
- if (!mir_tstrcmp(item->nick, oldNick)) {
- replaceStrT(item->nick, newNick);
+ if (!mir_wstrcmp(item->nick, oldNick)) {
+ replaceStrW(item->nick, newNick);
MCONTACT hContact = HContactFromJID(item->jid);
if (hContact != NULL)
@@ -815,7 +815,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) {
const wchar_t *from;
- if (!node || !XmlGetName(node) || mir_tstrcmp(XmlGetName(node), L"presence")) return;
+ if (!node || !XmlGetName(node) || mir_wstrcmp(XmlGetName(node), L"presence")) return;
if ((from = XmlGetAttrValue(node, L"from")) == NULL) return;
const wchar_t *resource = wcschr(from, '/');
@@ -833,8 +833,8 @@ void CJabberProto::GroupchatProcessPresence(HXML node) const wchar_t *nick = cnick ? cnick : (r && r->m_tszNick ? r->m_tszNick : resource);
// process custom nick change
- if (cnick && r && r->m_tszNick && mir_tstrcmp(cnick, r->m_tszNick))
- r->m_tszNick = mir_tstrdup(cnick);
+ if (cnick && r && r->m_tszNick && mir_wstrcmp(cnick, r->m_tszNick))
+ r->m_tszNick = mir_wstrdup(cnick);
HXML xNode = XmlGetChildByTag(node, "x", "xmlns", JABBER_FEAT_MUC_USER);
HXML itemNode = XmlGetChild(xNode, "item");
@@ -842,8 +842,8 @@ void CJabberProto::GroupchatProcessPresence(HXML node) const wchar_t *type = XmlGetAttrValue(node, L"type");
// entering room or a usual room presence
- if (type == NULL || !mir_tstrcmp(type, L"available")) {
- if (ptrT(JabberNickFromJID(from)) == NULL)
+ if (type == NULL || !mir_wstrcmp(type, L"available")) {
+ if (ptrW(JabberNickFromJID(from)) == NULL)
return;
GcInit(item);
@@ -853,10 +853,10 @@ void CJabberProto::GroupchatProcessPresence(HXML node) int status = ID_STATUS_ONLINE;
LPCTSTR ptszShow = XmlGetText(XmlGetChild(node, "show"));
if (ptszShow) {
- if (!mir_tstrcmp(ptszShow, L"away")) status = ID_STATUS_AWAY;
- else if (!mir_tstrcmp(ptszShow, L"xa")) status = ID_STATUS_NA;
- else if (!mir_tstrcmp(ptszShow, L"dnd")) status = ID_STATUS_DND;
- else if (!mir_tstrcmp(ptszShow, L"chat")) status = ID_STATUS_FREECHAT;
+ if (!mir_wstrcmp(ptszShow, L"away")) status = ID_STATUS_AWAY;
+ else if (!mir_wstrcmp(ptszShow, L"xa")) status = ID_STATUS_NA;
+ else if (!mir_wstrcmp(ptszShow, L"dnd")) status = ID_STATUS_DND;
+ else if (!mir_wstrcmp(ptszShow, L"chat")) status = ID_STATUS_FREECHAT;
}
LPCTSTR str = XmlGetText(XmlGetChild(node, "status"));
@@ -881,16 +881,16 @@ void CJabberProto::GroupchatProcessPresence(HXML node) JABBER_GC_ROLE role = r->m_role;
if ((str = XmlGetAttrValue(itemNode, L"affiliation")) != NULL) {
- if (!mir_tstrcmp(str, L"owner")) affiliation = AFFILIATION_OWNER;
- else if (!mir_tstrcmp(str, L"admin")) affiliation = AFFILIATION_ADMIN;
- else if (!mir_tstrcmp(str, L"member")) affiliation = AFFILIATION_MEMBER;
- else if (!mir_tstrcmp(str, L"none")) affiliation = AFFILIATION_NONE;
- else if (!mir_tstrcmp(str, L"outcast")) affiliation = AFFILIATION_OUTCAST;
+ if (!mir_wstrcmp(str, L"owner")) affiliation = AFFILIATION_OWNER;
+ else if (!mir_wstrcmp(str, L"admin")) affiliation = AFFILIATION_ADMIN;
+ else if (!mir_wstrcmp(str, L"member")) affiliation = AFFILIATION_MEMBER;
+ else if (!mir_wstrcmp(str, L"none")) affiliation = AFFILIATION_NONE;
+ else if (!mir_wstrcmp(str, L"outcast")) affiliation = AFFILIATION_OUTCAST;
}
if ((str = XmlGetAttrValue(itemNode, L"role")) != NULL) {
- if (!mir_tstrcmp(str, L"moderator")) role = ROLE_MODERATOR;
- else if (!mir_tstrcmp(str, L"participant")) role = ROLE_PARTICIPANT;
- else if (!mir_tstrcmp(str, L"visitor")) role = ROLE_VISITOR;
+ if (!mir_wstrcmp(str, L"moderator")) role = ROLE_MODERATOR;
+ else if (!mir_wstrcmp(str, L"participant")) role = ROLE_PARTICIPANT;
+ else if (!mir_wstrcmp(str, L"visitor")) role = ROLE_VISITOR;
else role = ROLE_NONE;
}
@@ -911,7 +911,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) }
if (str = XmlGetAttrValue(itemNode, L"jid"))
- r->m_tszRealJid = mir_tstrdup(str);
+ r->m_tszRealJid = mir_wstrdup(str);
}
}
@@ -936,7 +936,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) // Check <created/>
if (bRoomCreated) {
HXML n = XmlGetChild(node, "created");
- if (n != NULL && (str = XmlGetAttrValue(n, L"xmlns")) != NULL && !mir_tstrcmp(str, JABBER_FEAT_MUC_OWNER))
+ if (n != NULL && (str = XmlGetAttrValue(n, L"xmlns")) != NULL && !mir_wstrcmp(str, JABBER_FEAT_MUC_OWNER))
// A new room just created by me
// Request room config
m_ThreadInfo->send(
@@ -946,7 +946,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) }
// leaving room
- else if (!mir_tstrcmp(type, L"unavailable")) {
+ else if (!mir_wstrcmp(type, L"unavailable")) {
const wchar_t *str = 0;
if (xNode != NULL && item->nick != NULL) {
HXML reasonNode = XmlGetChild(itemNode, "reason");
@@ -956,7 +956,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) if (iStatus == 301 && r != NULL)
GcLogShowInformation(item, r, INFO_BAN);
- if (!mir_tstrcmp(resource, item->nick)) {
+ if (!mir_wstrcmp(resource, item->nick)) {
switch (iStatus) {
case 301:
case 307:
@@ -994,17 +994,17 @@ void CJabberProto::GroupchatProcessPresence(HXML node) }
// processing room errors
- else if (!mir_tstrcmp(type, L"error")) {
+ else if (!mir_wstrcmp(type, L"error")) {
int errorCode = 0;
HXML errorNode = XmlGetChild(node, "error");
- ptrT str(JabberErrorMsg(errorNode, &errorCode));
+ ptrW str(JabberErrorMsg(errorNode, &errorCode));
if (errorCode == JABBER_ERROR_CONFLICT) {
- ptrT newNick(getTStringA("GcAltNick"));
+ ptrW newNick(getTStringA("GcAltNick"));
if (++item->iChatState == 1 && newNick != NULL && newNick[0] != 0) {
- replaceStrT(item->nick, newNick);
+ replaceStrW(item->nick, newNick);
wchar_t text[1024] = { 0 };
- mir_sntprintf(text, L"%s/%s", item->jid, newNick);
+ mir_snwprintf(text, L"%s/%s", item->jid, newNick);
SendPresenceTo(m_iStatus, text, NULL);
}
else {
@@ -1028,12 +1028,12 @@ void CJabberProto::GroupchatProcessMessage(HXML node) JABBER_LIST_ITEM *item;
CMString imgLink;
- if (!XmlGetName(node) || mir_tstrcmp(XmlGetName(node), L"message")) return;
+ if (!XmlGetName(node) || mir_wstrcmp(XmlGetName(node), L"message")) return;
if ((from = XmlGetAttrValue(node, L"from")) == NULL) return;
if ((item = ListGetItemPtr(LIST_CHATROOM, from)) == NULL) return;
if ((type = XmlGetAttrValue(node, L"type")) == NULL) return;
- if (!mir_tstrcmp(type, L"error"))
+ if (!mir_wstrcmp(type, L"error"))
return;
GCDEST gcd = { m_szModuleName, item->jid, 0 };
@@ -1064,7 +1064,7 @@ void CJabberProto::GroupchatProcessMessage(HXML node) resource = tmpnick;
}
}
- item->getTemp()->m_tszStatusMessage = mir_tstrdup(msgText);
+ item->getTemp()->m_tszStatusMessage = mir_wstrdup(msgText);
}
else {
imgLink = ExtractImage(node);
@@ -1079,7 +1079,7 @@ void CJabberProto::GroupchatProcessMessage(HXML node) if (resource == NULL)
gcd.iType = GC_EVENT_INFORMATION;
- else if (wcsncmp(msgText, L"/me ", 4) == 0 && mir_tstrlen(msgText) > 4) {
+ else if (wcsncmp(msgText, L"/me ", 4) == 0 && mir_wstrlen(msgText) > 4) {
msgText += 4;
gcd.iType = GC_EVENT_ACTION;
}
@@ -1115,7 +1115,7 @@ void CJabberProto::GroupchatProcessMessage(HXML node) gce.ptszNick = nick;
gce.time = msgTime;
gce.ptszText = tszText;
- gce.bIsMe = nick == NULL ? FALSE : (mir_tstrcmp(resource, item->nick) == 0);
+ gce.bIsMe = nick == NULL ? FALSE : (mir_wstrcmp(resource, item->nick) == 0);
if (!isHistory)
gce.dwFlags |= GCEF_ADDTOLOG;
@@ -1157,12 +1157,12 @@ public: CSuper::OnInitDialog();
wchar_t buf[256];
- mir_sntprintf(buf, TranslateT("Group chat invitation to\n%s"), m_roomJid);
+ mir_snwprintf(buf, TranslateT("Group chat invitation to\n%s"), m_roomJid);
SetDlgItemText(m_hwnd, IDC_HEADERBAR, buf);
SetDlgItemText(m_hwnd, IDC_FROM, m_from);
SetDlgItemText(m_hwnd, IDC_REASON, m_reason);
- SetDlgItemText(m_hwnd, IDC_NICK, ptrT(JabberNickFromJID(m_proto->m_szJabberJID)));
+ SetDlgItemText(m_hwnd, IDC_NICK, ptrW(JabberNickFromJID(m_proto->m_szJabberJID)));
Window_SetIcon_IcoLib(m_hwnd, g_GetIconHandle(IDI_GROUP));
@@ -1193,7 +1193,7 @@ void CJabberProto::GroupchatProcessInvite(const wchar_t *roomJid, const wchar_t return;
if (m_options.AutoAcceptMUC) {
- ptrT nick(getTStringA(HContactFromJID(m_szJabberJID), "MyNick"));
+ ptrW nick(getTStringA(HContactFromJID(m_szJabberJID), "MyNick"));
if (nick == NULL)
nick = getTStringA("Nick");
if (nick == NULL)
diff --git a/protocols/JabberG/src/jabber_ibb.cpp b/protocols/JabberG/src/jabber_ibb.cpp index f15b3f4776..91a1df8f61 100644 --- a/protocols/JabberG/src/jabber_ibb.cpp +++ b/protocols/JabberG/src/jabber_ibb.cpp @@ -46,11 +46,11 @@ void JabberIbbFreeJibb(JABBER_IBB_TRANSFER *jibb) BOOL CJabberProto::OnFtHandleIbbIq(HXML iqNode, CJabberIqInfo *pInfo)
{
- if (!mir_tstrcmp(pInfo->GetChildNodeName(), L"open"))
+ if (!mir_wstrcmp(pInfo->GetChildNodeName(), L"open"))
FtHandleIbbRequest(iqNode, TRUE);
- else if (!mir_tstrcmp(pInfo->GetChildNodeName(), L"close"))
+ else if (!mir_wstrcmp(pInfo->GetChildNodeName(), L"close"))
FtHandleIbbRequest(iqNode, FALSE);
- else if (!mir_tstrcmp(pInfo->GetChildNodeName(), L"data")) {
+ else if (!mir_wstrcmp(pInfo->GetChildNodeName(), L"data")) {
BOOL bOk = FALSE;
const wchar_t *sid = XmlGetAttrValue(pInfo->GetChildNode(), L"sid");
const wchar_t *seq = XmlGetAttrValue(pInfo->GetChildNode(), L"seq");
diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp index 6d85d38886..64aae7a25b 100644 --- a/protocols/JabberG/src/jabber_icolib.cpp +++ b/protocols/JabberG/src/jabber_icolib.cpp @@ -307,7 +307,7 @@ int CJabberProto::LoadAdvancedIcons(int iID) int first = -1;
HICON empty = Skin_LoadIcon(SKINICON_OTHER_MIRANDA);
- mir_sntprintf(Group, LPGENW("Status icons")L"/%s/%S %s", m_tszUserName, proto, TranslateT("transport"));
+ mir_snwprintf(Group, LPGENW("Status icons")L"/%s/%S %s", m_tszUserName, proto, TranslateT("transport"));
mir_snprintf(defFile, "proto_%s.dll", proto);
if (!hAdvancedStatusIcon)
hAdvancedStatusIcon = (HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0);
@@ -389,7 +389,7 @@ INT_PTR __cdecl CJabberProto::JGetAdvancedStatusIcon(WPARAM hContact, LPARAM) if (!getByte(hContact, "IsTransported", 0))
return -1;
- int iID = GetTransportProtoID(ptrT(getTStringA(hContact, "Transport")));
+ int iID = GetTransportProtoID(ptrW(getTStringA(hContact, "Transport")));
if (iID < 0)
return -1;
@@ -431,7 +431,7 @@ BOOL CJabberProto::DBCheckIsTransportedContact(const wchar_t *jid, MCONTACT hCon }
if (m_lstTransports.getIndex(domain) == -1 && isAgent) {
- m_lstTransports.insert(mir_tstrdup(domain));
+ m_lstTransports.insert(mir_wstrdup(domain));
setByte(hContact, "IsTransport", 1);
}
@@ -445,7 +445,7 @@ BOOL CJabberProto::DBCheckIsTransportedContact(const wchar_t *jid, MCONTACT hCon void CJabberProto::CheckAllContactsAreTransported()
{
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid)
DBCheckIsTransportedContact(jid, hContact);
}
diff --git a/protocols/JabberG/src/jabber_iq.cpp b/protocols/JabberG/src/jabber_iq.cpp index 60040145af..79db2a2232 100644 --- a/protocols/JabberG/src/jabber_iq.cpp +++ b/protocols/JabberG/src/jabber_iq.cpp @@ -248,9 +248,9 @@ bool CJabberIqManager::HandleIq(int nIqId, HXML pNode) return false;
int nIqType = JABBER_IQ_TYPE_FAIL;
- if (!mir_tstrcmpi(szType, L"result"))
+ if (!mir_wstrcmpi(szType, L"result"))
nIqType = JABBER_IQ_TYPE_RESULT;
- else if (!mir_tstrcmpi(szType, L"error"))
+ else if (!mir_wstrcmpi(szType, L"error"))
nIqType = JABBER_IQ_TYPE_ERROR;
else
return false;
@@ -300,9 +300,9 @@ bool CJabberIqManager::HandleIqPermanent(HXML pNode) CJabberIqInfo iqInfo;
iqInfo.m_nIqType = JABBER_IQ_TYPE_FAIL;
- if (!mir_tstrcmpi(szType, L"get"))
+ if (!mir_wstrcmpi(szType, L"get"))
iqInfo.m_nIqType = JABBER_IQ_TYPE_GET;
- else if (!mir_tstrcmpi(szType, L"set"))
+ else if (!mir_wstrcmpi(szType, L"set"))
iqInfo.m_nIqType = JABBER_IQ_TYPE_SET;
else
return FALSE;
@@ -317,8 +317,8 @@ bool CJabberIqManager::HandleIqPermanent(HXML pNode) const wchar_t *szTagName = XmlGetName(pFirstChild);
const wchar_t *szXmlns = XmlGetAttrValue(pFirstChild, L"xmlns");
- if ((!pInfo.m_szXmlns || (szXmlns && !mir_tstrcmp(pInfo.m_szXmlns, szXmlns))) &&
- (!pInfo.m_szTag || !mir_tstrcmp(pInfo.m_szTag, szTagName)))
+ if ((!pInfo.m_szXmlns || (szXmlns && !mir_wstrcmp(pInfo.m_szXmlns, szXmlns))) &&
+ (!pInfo.m_szTag || !mir_wstrcmp(pInfo.m_szTag, szTagName)))
{
// node suits handler criteria, call the handler
iqInfo.m_pChildNode = pFirstChild;
@@ -416,9 +416,9 @@ CJabberIqPermanentInfo* CJabberIqManager::AddPermanentHandler( CJabberIqPermanentInfo *pInfo = new CJabberIqPermanentInfo();
pInfo->m_pHandler = pHandler;
pInfo->m_nIqTypes = nIqTypes ? nIqTypes : JABBER_IQ_TYPE_ANY;
- pInfo->m_szXmlns = mir_tstrdup(szXmlns);
+ pInfo->m_szXmlns = mir_wstrdup(szXmlns);
pInfo->m_bAllowPartialNs = bAllowPartialNs;
- pInfo->m_szTag = mir_tstrdup(szTag);
+ pInfo->m_szTag = mir_wstrdup(szTag);
pInfo->m_dwParamsToParse = dwParamsToParse;
pInfo->m_pUserData = pUserData;
pInfo->m_pUserDataFree = pUserDataFree;
diff --git a/protocols/JabberG/src/jabber_iq.h b/protocols/JabberG/src/jabber_iq.h index 6d5b75d68a..a8110ea52c 100644 --- a/protocols/JabberG/src/jabber_iq.h +++ b/protocols/JabberG/src/jabber_iq.h @@ -81,7 +81,7 @@ public: { mir_free(m_szReceiver);
}
- __forceinline void SetReceiver(const wchar_t *szReceiver) { replaceStrT(m_szReceiver, szReceiver); }
+ __forceinline void SetReceiver(const wchar_t *szReceiver) { replaceStrW(m_szReceiver, szReceiver); }
__forceinline void SetParamsToParse(DWORD dwParamsToParse) { m_dwParamsToParse = dwParamsToParse; }
__forceinline void SetTimeout(DWORD dwTimeout) { m_dwTimeout = dwTimeout; }
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index 9a87819646..84e5c93ef8 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -44,7 +44,7 @@ BOOL CJabberProto::OnIqRequestVersion(HXML, CJabberIqInfo *pInfo) if (m_options.ShowOSVersion) {
wchar_t os[256] = { 0 };
if (!GetOSDisplayString(os, _countof(os)))
- mir_tstrncpy(os, L"Microsoft Windows", _countof(os));
+ mir_wstrncpy(os, L"Microsoft Windows", _countof(os));
query << XCHILD(L"os", os);
}
@@ -104,7 +104,7 @@ BOOL CJabberProto::OnIqRequestTime(HXML, CJabberIqInfo *pInfo) TimeZone_PrintDateTime(UTC_TIME_HANDLE, L"I", stime, _countof(stime), 0);
int nGmtOffset = GetGMTOffset();
- mir_sntprintf(szTZ, L"%+03d:%02d", nGmtOffset / 60, nGmtOffset % 60);
+ mir_snwprintf(szTZ, L"%+03d:%02d", nGmtOffset / 60, nGmtOffset % 60);
XmlNodeIq iq(L"result", pInfo);
HXML timeNode = iq << XCHILDNS(L"time", JABBER_FEAT_ENTITY_TIME);
@@ -125,7 +125,7 @@ BOOL CJabberProto::OnIqProcessIqOldTime(HXML, CJabberIqInfo *pInfo) _tzset();
time(<ime);
gmt = gmtime(<ime);
- mir_sntprintf(stime, L"%.4i%.2i%.2iT%.2i:%.2i:%.2i",
+ mir_snwprintf(stime, L"%.4i%.2i%.2iT%.2i:%.2i:%.2i",
gmt->tm_year + 1900, gmt->tm_mon + 1,
gmt->tm_mday, gmt->tm_hour, gmt->tm_min, gmt->tm_sec);
dtime = _wctime(<ime);
@@ -186,7 +186,7 @@ BOOL CJabberProto::OnSiRequest(HXML node, CJabberIqInfo *pInfo) {
const wchar_t *szProfile = XmlGetAttrValue(pInfo->GetChildNode(), L"profile");
- if (szProfile && !mir_tstrcmp(szProfile, JABBER_FEAT_SI_FT))
+ if (szProfile && !mir_wstrcmp(szProfile, JABBER_FEAT_SI_FT))
FtHandleSiRequest(node);
else {
XmlNodeIq iq(L"error", pInfo);
@@ -220,7 +220,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) pDelimiter = wcschr(szTo, '/');
if (pDelimiter) *pDelimiter = 0;
- BOOL bRetVal = mir_tstrcmp(szFrom, szTo) == 0;
+ BOOL bRetVal = mir_wstrcmp(szFrom, szTo) == 0;
mir_free(szFrom);
mir_free(szTo);
@@ -240,7 +240,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) if (!itemNode)
break;
- if (mir_tstrcmp(XmlGetName(itemNode), L"item") != 0)
+ if (mir_wstrcmp(XmlGetName(itemNode), L"item") != 0)
continue;
if ((jid = XmlGetAttrValue(itemNode, L"jid")) == NULL)
continue;
@@ -248,9 +248,9 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) continue;
// we will not add new account when subscription=remove
- if (!mir_tstrcmp(str, L"to") || !mir_tstrcmp(str, L"both") || !mir_tstrcmp(str, L"from") || !mir_tstrcmp(str, L"none")) {
+ if (!mir_wstrcmp(str, L"to") || !mir_wstrcmp(str, L"both") || !mir_wstrcmp(str, L"from") || !mir_wstrcmp(str, L"none")) {
const wchar_t *name = XmlGetAttrValue(itemNode, L"name");
- ptrT nick((name != NULL) ? mir_tstrdup(name) : JabberNickFromJID(jid));
+ ptrW nick((name != NULL) ? mir_wstrdup(name) : JabberNickFromJID(jid));
if (nick != NULL) {
MCONTACT hContact = HContactFromJID(jid, false);
if (hContact == NULL)
@@ -259,15 +259,15 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) setTString(hContact, "jid", jid);
JABBER_LIST_ITEM *item = ListAdd(LIST_ROSTER, jid, hContact);
- replaceStrT(item->nick, nick);
+ replaceStrW(item->nick, nick);
HXML groupNode = XmlGetChild(itemNode, "group");
- replaceStrT(item->group, XmlGetText(groupNode));
+ replaceStrW(item->group, XmlGetText(groupNode));
if (name != NULL) {
- ptrT tszNick(getTStringA(hContact, "Nick"));
+ ptrW tszNick(getTStringA(hContact, "Nick"));
if (tszNick != NULL) {
- if (mir_tstrcmp(nick, tszNick) != 0)
+ if (mir_wstrcmp(nick, tszNick) != 0)
db_set_ts(hContact, "CList", "MyHandle", nick);
else
db_unset(hContact, "CList", "MyHandle");
@@ -287,9 +287,9 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) }
if (JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, jid)) {
- if (!mir_tstrcmp(str, L"both")) item->subscription = SUB_BOTH;
- else if (!mir_tstrcmp(str, L"to")) item->subscription = SUB_TO;
- else if (!mir_tstrcmp(str, L"from")) item->subscription = SUB_FROM;
+ if (!mir_wstrcmp(str, L"both")) item->subscription = SUB_BOTH;
+ else if (!mir_wstrcmp(str, L"to")) item->subscription = SUB_TO;
+ else if (!mir_wstrcmp(str, L"from")) item->subscription = SUB_FROM;
else item->subscription = SUB_NONE;
debugLog(L"Roster push for jid=%s, set subscription to %s", jid, str);
@@ -298,7 +298,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) // subscription = remove is to remove from roster list
// but we will just set the contact to offline and not actually
// remove, so that history will be retained.
- if (!mir_tstrcmp(str, L"remove")) {
+ if (!mir_wstrcmp(str, L"remove")) {
if (hContact) {
SetContactOfflineStatus(hContact);
ListRemove(LIST_ROSTER, jid);
@@ -335,7 +335,7 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo) filetransfer *ft = new filetransfer(this);
ft->std.totalFiles = 1;
- ft->jid = mir_tstrdup(pInfo->GetFrom());
+ ft->jid = mir_wstrdup(pInfo->GetFrom());
ft->std.hContact = pInfo->GetHContact();
ft->type = FT_OOB;
ft->httpHostName = NULL;
@@ -355,7 +355,7 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo) ft->httpPort = (WORD)_wtoi(p + 1);
*p = '\0';
}
- ft->httpHostName = mir_t2a(text);
+ ft->httpHostName = mir_u2a(text);
}
}
}
@@ -376,7 +376,7 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo) str2++;
else
str2 = ft->httpPath;
- str2 = mir_tstrdup(str2);
+ str2 = mir_wstrdup(str2);
JabberHttpUrlDecode(str2);
PROTORECVFILET pre;
@@ -482,10 +482,10 @@ BOOL CJabberProto::OnIqHttpAuth(HXML node, CJabberIqInfo *pInfo) CJabberHttpAuthParams *pParams = (CJabberHttpAuthParams*)mir_calloc(sizeof(CJabberHttpAuthParams));
if (pParams) {
pParams->m_nType = CJabberHttpAuthParams::IQ;
- pParams->m_szFrom = mir_tstrdup(pInfo->GetFrom());
- pParams->m_szId = mir_tstrdup(szId);
- pParams->m_szMethod = mir_tstrdup(szMethod);
- pParams->m_szUrl = mir_tstrdup(szUrl);
+ pParams->m_szFrom = mir_wstrdup(pInfo->GetFrom());
+ pParams->m_szId = mir_wstrdup(szId);
+ pParams->m_szMethod = mir_wstrdup(szMethod);
+ pParams->m_szUrl = mir_wstrdup(szUrl);
AddClistHttpAuthEvent(pParams);
}
return TRUE;
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index de177c797d..caa0532da6 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -35,7 +35,7 @@ void CJabberProto::OnIqResultServerDiscoInfo(HXML iqNode, CJabberIqInfo*) return;
const wchar_t *type = XmlGetAttrValue(iqNode, L"type");
- if (mir_tstrcmp(type, L"result"))
+ if (mir_wstrcmp(type, L"result"))
return;
HXML query = XmlGetChildByTag(iqNode, "query", "xmlns", JABBER_FEAT_DISCO_INFO);
@@ -49,7 +49,7 @@ void CJabberProto::OnIqResultServerDiscoInfo(HXML iqNode, CJabberIqInfo*) XmlGetAttrValue(identity, L"type"),
XmlGetAttrValue(identity, L"name") };
- if (!mir_tstrcmp(tmp.category, L"pubsub") && !mir_tstrcmp(tmp.type, L"pep")) {
+ if (!mir_wstrcmp(tmp.category, L"pubsub") && !mir_wstrcmp(tmp.type, L"pep")) {
m_bPepSupported = true;
EnableMenuItems(true);
@@ -68,7 +68,7 @@ void CJabberProto::OnIqResultServerDiscoInfo(HXML iqNode, CJabberIqInfo*) continue;
for (int j = 0; g_JabberFeatCapPairs[j].szFeature; j++) {
- if (!mir_tstrcmp(g_JabberFeatCapPairs[j].szFeature, featureName)) {
+ if (!mir_wstrcmp(g_JabberFeatCapPairs[j].szFeature, featureName)) {
m_ThreadInfo->jabberServerCaps |= g_JabberFeatCapPairs[j].jcbCap;
break;
}
@@ -96,13 +96,13 @@ void CJabberProto::OnIqResultNestedRosterGroups(HXML iqNode, CJabberIqInfo *pInf return;
// is our default delimiter?
- if ((!szGroupDelimeter && bPrivateStorageSupport) || (szGroupDelimeter && mir_tstrcmp(szGroupDelimeter, L"\\")))
+ if ((!szGroupDelimeter && bPrivateStorageSupport) || (szGroupDelimeter && mir_wstrcmp(szGroupDelimeter, L"\\")))
m_ThreadInfo->send(
XmlNodeIq(L"set", SerialNext()) << XQUERY(JABBER_FEAT_PRIVATE_STORAGE)
<< XCHILD(L"roster", L"\\") << XATTR(L"xmlns", JABBER_FEAT_NESTED_ROSTER_GROUPS));
// roster request
- wchar_t *szUserData = mir_tstrdup(szGroupDelimeter ? szGroupDelimeter : L"\\");
+ wchar_t *szUserData = mir_wstrdup(szGroupDelimeter ? szGroupDelimeter : L"\\");
m_ThreadInfo->send(
XmlNodeIq( AddIQ(&CJabberProto::OnIqResultGetRoster, JABBER_IQ_TYPE_GET, NULL, 0, -1, (void*)szUserData))
<< XCHILDNS(L"query", JABBER_FEAT_IQ_ROSTER));
@@ -134,7 +134,7 @@ void CJabberProto::OnProcessLoginRq(ThreadData *info, DWORD rq) LISTFOREACH(i, this, LIST_BOOKMARK)
{
JABBER_LIST_ITEM *item = ListGetItemPtrFromIndex(i);
- if (item != NULL && !mir_tstrcmp(item->type, L"conference") && item->bAutoJoin)
+ if (item != NULL && !mir_wstrcmp(item->type, L"conference") && item->bAutoJoin)
ll.insert(item);
}
@@ -149,7 +149,7 @@ void CJabberProto::OnProcessLoginRq(ThreadData *info, DWORD rq) if (item->nick && item->nick[0])
GroupchatJoinRoom(server, p, item->nick, item->password, true);
else {
- ptrT nick(getTStringA(HContactFromJID(m_szJabberJID), "MyNick"));
+ ptrW nick(getTStringA(HContactFromJID(m_szJabberJID), "MyNick"));
if (nick == NULL)
nick = getTStringA("Nick");
if (nick == NULL)
@@ -219,7 +219,7 @@ void CJabberProto::OnIqResultGetAuth(HXML iqNode, CJabberIqInfo*) if ((type = XmlGetAttrValue(iqNode, L"type")) == NULL) return;
if ((queryNode = XmlGetChild(iqNode, "query")) == NULL) return;
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
XmlNodeIq iq(AddIQ(&CJabberProto::OnIqResultSetAuth, JABBER_IQ_TYPE_SET));
HXML query = iq << XQUERY(L"jabber:iq:auth");
query << XCHILD(L"username", m_ThreadInfo->conn.username);
@@ -243,11 +243,11 @@ void CJabberProto::OnIqResultGetAuth(HXML iqNode, CJabberIqInfo*) m_ThreadInfo->send(iq);
}
- else if (!mir_tstrcmp(type, L"error")) {
+ else if (!mir_wstrcmp(type, L"error")) {
m_ThreadInfo->send("</stream:stream>");
wchar_t text[128];
- mir_sntprintf(text, TranslateT("Authentication failed for %s."), m_ThreadInfo->conn.username);
+ mir_snwprintf(text, TranslateT("Authentication failed for %s."), m_ThreadInfo->conn.username);
MsgPopup(NULL, text, TranslateT("Jabber Authentication"));
JLoginFailed(LOGINERR_WRONGPASSWORD);
m_ThreadInfo = NULL; // To disallow auto reconnect
@@ -263,19 +263,19 @@ void CJabberProto::OnIqResultSetAuth(HXML iqNode, CJabberIqInfo*) debugLogA("<iq/> iqIdSetAuth");
if ((type = XmlGetAttrValue(iqNode, L"type")) == NULL) return;
- if (!mir_tstrcmp(type, L"result")) {
- ptrT tszNick(getTStringA("Nick"));
+ if (!mir_wstrcmp(type, L"result")) {
+ ptrW tszNick(getTStringA("Nick"));
if (tszNick == NULL)
setTString("Nick", m_ThreadInfo->conn.username);
OnLoggedIn();
}
// What to do if password error? etc...
- else if (!mir_tstrcmp(type, L"error")) {
+ else if (!mir_wstrcmp(type, L"error")) {
wchar_t text[128];
m_ThreadInfo->send("</stream:stream>");
- mir_sntprintf(text, TranslateT("Authentication failed for %s."), m_ThreadInfo->conn.username);
+ mir_snwprintf(text, TranslateT("Authentication failed for %s."), m_ThreadInfo->conn.username);
MsgPopup(NULL, text, TranslateT("Jabber Authentication"));
JLoginFailed(LOGINERR_WRONGPASSWORD);
m_ThreadInfo = NULL; // To disallow auto reconnect
@@ -318,7 +318,7 @@ void CJabberProto::OnIqResultSession(HXML, CJabberIqInfo *pInfo) void CJabberProto::GroupchatJoinByHContact(MCONTACT hContact, bool autojoin)
{
- ptrT roomjid(getTStringA(hContact, "ChatRoomID"));
+ ptrW roomjid(getTStringA(hContact, "ChatRoomID"));
if (roomjid == NULL)
return;
@@ -329,14 +329,14 @@ void CJabberProto::GroupchatJoinByHContact(MCONTACT hContact, bool autojoin) server[0] = 0; server++;
- ptrT nick(getTStringA(hContact, "MyNick"));
+ ptrW nick(getTStringA(hContact, "MyNick"));
if (nick == NULL) {
nick = JabberNickFromJID(m_szJabberJID);
if (nick == NULL)
return;
}
- GroupchatJoinRoom(server, room, nick, ptrT(getTStringA(hContact, "Password")), autojoin);
+ GroupchatJoinRoom(server, room, nick, ptrW(getTStringA(hContact, "Password")), autojoin);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -357,12 +357,12 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) return;
}
- if (mir_tstrcmp(XmlGetAttrValue(queryNode, L"xmlns"), JABBER_FEAT_IQ_ROSTER)) {
+ if (mir_wstrcmp(XmlGetAttrValue(queryNode, L"xmlns"), JABBER_FEAT_IQ_ROSTER)) {
mir_free(szGroupDelimeter);
return;
}
- if (!mir_tstrcmp(szGroupDelimeter, L"\\")) {
+ if (!mir_wstrcmp(szGroupDelimeter, L"\\")) {
mir_free(szGroupDelimeter);
szGroupDelimeter = NULL;
}
@@ -377,16 +377,16 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) if (!itemNode)
break;
- if (mir_tstrcmp(XmlGetName(itemNode), L"item"))
+ if (mir_wstrcmp(XmlGetName(itemNode), L"item"))
continue;
const wchar_t *str = XmlGetAttrValue(itemNode, L"subscription");
JABBER_SUBSCRIPTION sub;
if (str == NULL) sub = SUB_NONE;
- else if (!mir_tstrcmp(str, L"both")) sub = SUB_BOTH;
- else if (!mir_tstrcmp(str, L"to")) sub = SUB_TO;
- else if (!mir_tstrcmp(str, L"from")) sub = SUB_FROM;
+ else if (!mir_wstrcmp(str, L"both")) sub = SUB_BOTH;
+ else if (!mir_wstrcmp(str, L"to")) sub = SUB_TO;
+ else if (!mir_wstrcmp(str, L"from")) sub = SUB_FROM;
else sub = SUB_NONE;
const wchar_t *jid = XmlGetAttrValue(itemNode, L"jid");
@@ -396,7 +396,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) bIsTransport = true;
const wchar_t *name = XmlGetAttrValue(itemNode, L"name");
- wchar_t *nick = (name != NULL) ? mir_tstrdup(name) : JabberNickFromJID(jid);
+ wchar_t *nick = (name != NULL) ? mir_wstrdup(name) : JabberNickFromJID(jid);
if (nick == NULL)
continue;
@@ -410,26 +410,26 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) mir_free(item->nick); item->nick = nick;
HXML groupNode = XmlGetChild(itemNode, "group");
- replaceStrT(item->group, XmlGetText(groupNode));
+ replaceStrW(item->group, XmlGetText(groupNode));
// check group delimiters:
if (item->group && szGroupDelimeter) {
while (wchar_t *szPos = wcsstr(item->group, szGroupDelimeter)) {
*szPos = 0;
- szPos += mir_tstrlen(szGroupDelimeter);
- wchar_t *szNewGroup = (wchar_t *)mir_alloc(sizeof(wchar_t) * (mir_tstrlen(item->group) + mir_tstrlen(szPos) + 2));
- mir_tstrcpy(szNewGroup, item->group);
- mir_tstrcat(szNewGroup, L"\\");
- mir_tstrcat(szNewGroup, szPos);
+ szPos += mir_wstrlen(szGroupDelimeter);
+ wchar_t *szNewGroup = (wchar_t *)mir_alloc(sizeof(wchar_t) * (mir_wstrlen(item->group) + mir_wstrlen(szPos) + 2));
+ mir_wstrcpy(szNewGroup, item->group);
+ mir_wstrcat(szNewGroup, L"\\");
+ mir_wstrcat(szNewGroup, szPos);
mir_free(item->group);
item->group = szNewGroup;
}
}
if (name != NULL) {
- ptrT tszNick(getTStringA(hContact, "Nick"));
+ ptrW tszNick(getTStringA(hContact, "Nick"));
if (tszNick != NULL) {
- if (mir_tstrcmp(nick, tszNick) != 0)
+ if (mir_wstrcmp(nick, tszNick) != 0)
db_set_ts(hContact, "CList", "MyHandle", nick);
else
db_unset(hContact, "CList", "MyHandle");
@@ -461,9 +461,9 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) Clist_GroupCreate(0, item->group);
// Don't set group again if already correct, or Miranda may show wrong group count in some case
- ptrT tszGroup(db_get_tsa(hContact, "CList", "Group"));
+ ptrW tszGroup(db_get_tsa(hContact, "CList", "Group"));
if (tszGroup != NULL) {
- if (mir_tstrcmp(tszGroup, item->group))
+ if (mir_wstrcmp(tszGroup, item->group))
db_set_ts(hContact, "CList", "Group", item->group);
}
else db_set_ts(hContact, "CList", "Group", item->group);
@@ -492,7 +492,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) if (m_options.RosterSync == TRUE) {
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact;) {
MCONTACT hNext = db_find_next(hContact, m_szModuleName);
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid != NULL && !ListGetItemPtr(LIST_ROSTER, jid)) {
debugLog(L"Syncing roster: preparing to delete %s (hContact=0x%x)", jid, hContact);
CallService(MS_DB_CONTACT_DELETE, hContact, 0);
@@ -533,11 +533,11 @@ void CJabberProto::OnIqResultGetRegister(HXML iqNode, CJabberIqInfo*) if ((type = XmlGetAttrValue(iqNode, L"type")) == NULL) return;
if ((queryNode = XmlGetChild(iqNode, "query")) == NULL) return;
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
if (m_hwndAgentRegInput)
SendMessage(m_hwndAgentRegInput, WM_JABBER_REGINPUT_ACTIVATE, 1 /*success*/, (LPARAM)xmlCopyNode(iqNode));
}
- else if (!mir_tstrcmp(type, L"error")) {
+ else if (!mir_wstrcmp(type, L"error")) {
if (m_hwndAgentRegInput) {
HXML errorNode = XmlGetChild(iqNode, "error");
wchar_t *str = JabberErrorMsg(errorNode);
@@ -557,7 +557,7 @@ void CJabberProto::OnIqResultSetRegister(HXML iqNode, CJabberIqInfo*) if ((type = XmlGetAttrValue(iqNode, L"type")) == NULL) return;
if ((from = XmlGetAttrValue(iqNode, L"from")) == NULL) return;
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
MCONTACT hContact = HContactFromJID(from);
if (hContact != NULL)
setByte(hContact, "IsTransport", true);
@@ -565,7 +565,7 @@ void CJabberProto::OnIqResultSetRegister(HXML iqNode, CJabberIqInfo*) if (m_hwndRegProgress)
SendMessage(m_hwndRegProgress, WM_JABBER_REGDLG_UPDATE, 100, (LPARAM)TranslateT("Registration successful"));
}
- else if (!mir_tstrcmp(type, L"error")) {
+ else if (!mir_wstrcmp(type, L"error")) {
if (m_hwndRegProgress) {
HXML errorNode = XmlGetChild(iqNode, "error");
wchar_t *str = JabberErrorMsg(errorNode);
@@ -621,7 +621,7 @@ void CJabberProto::OnIqResultGetVcardPhoto(HXML n, MCONTACT hContact, bool &hasP debugLog(L"My picture saved to %s", szAvatarFileName);
}
else {
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid != NULL) {
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, jid);
if (item == NULL) {
@@ -631,9 +631,9 @@ void CJabberProto::OnIqResultGetVcardPhoto(HXML n, MCONTACT hContact, bool &hasP }
if (item != NULL) {
hasPhoto = true;
- if (item->photoFileName && mir_tstrcmp(item->photoFileName, szAvatarFileName))
+ if (item->photoFileName && mir_wstrcmp(item->photoFileName, szAvatarFileName))
DeleteFile(item->photoFileName);
- replaceStrT(item->photoFileName, szAvatarFileName);
+ replaceStrW(item->photoFileName, szAvatarFileName);
debugLog(L"Contact's picture saved to %s", szAvatarFileName);
OnIqResultGotAvatar(hContact, o, szPicType);
}
@@ -669,7 +669,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) m_nJabberSearchID = -1;
if ((vCardNode = XmlGetChild(iqNode, "vCard")) != NULL) {
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
PROTOSEARCHRESULT psr = { 0 };
psr.cbSize = sizeof(psr);
psr.flags = PSR_TCHAR;
@@ -681,14 +681,14 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)id, (LPARAM)&psr);
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
}
- else if (!mir_tstrcmp(type, L"error"))
+ else if (!mir_wstrcmp(type, L"error"))
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
}
else ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
return;
}
- size_t len = mir_tstrlen(m_szJabberJID);
+ size_t len = mir_wstrlen(m_szJabberJID);
if (!wcsnicmp(jid, m_szJabberJID, len) && (jid[len] == '/' || jid[len] == '\0')) {
hContact = NULL;
debugLogA("Vcard for myself");
@@ -699,13 +699,13 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) debugLogA("Other user's vcard");
}
- if (!mir_tstrcmp(type, L"error")) {
+ if (!mir_wstrcmp(type, L"error")) {
if ((hContact = HContactFromJID(jid)) != NULL)
ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_FAILED, (HANDLE)1, 0);
return;
}
- if (mir_tstrcmp(type, L"result"))
+ if (mir_wstrcmp(type, L"result"))
return;
bool hasFn = false, hasNick = false, hasGiven = false, hasFamily = false, hasMiddle = false,
@@ -723,19 +723,19 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) if (!n)
break;
if (XmlGetName(n) == NULL) continue;
- if (!mir_tstrcmp(XmlGetName(n), L"FN")) {
+ if (!mir_wstrcmp(XmlGetName(n), L"FN")) {
if (XmlGetText(n) != NULL) {
hasFn = true;
setTString(hContact, "FullName", XmlGetText(n));
}
}
- else if (!mir_tstrcmp(XmlGetName(n), L"NICKNAME")) {
+ else if (!mir_wstrcmp(XmlGetName(n), L"NICKNAME")) {
if (XmlGetText(n) != NULL) {
hasNick = true;
setTString(hContact, "Nick", XmlGetText(n));
}
}
- else if (!mir_tstrcmp(XmlGetName(n), L"N")) {
+ else if (!mir_wstrcmp(XmlGetName(n), L"N")) {
// First/Last name
if (!hasGiven && !hasFamily && !hasMiddle) {
if ((m = XmlGetChild(n, "GIVEN")) != NULL && XmlGetText(m) != NULL) {
@@ -752,7 +752,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) }
}
}
- else if (!mir_tstrcmp(XmlGetName(n), L"EMAIL")) {
+ else if (!mir_wstrcmp(XmlGetName(n), L"EMAIL")) {
// E-mail address(es)
if ((m = XmlGetChild(n, "USERID")) == NULL) // Some bad client put e-mail directly in <EMAIL/> instead of <USERID/>
m = n;
@@ -779,7 +779,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) nEmail++;
}
}
- else if (!mir_tstrcmp(XmlGetName(n), L"BDAY")) {
+ else if (!mir_wstrcmp(XmlGetName(n), L"BDAY")) {
// Birthday
if (!hasBday && XmlGetText(n) != NULL) {
if (hContact != NULL) {
@@ -804,7 +804,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) }
}
}
- else if (!mir_tstrcmp(XmlGetName(n), L"GENDER")) {
+ else if (!mir_wstrcmp(XmlGetName(n), L"GENDER")) {
// Gender
if (!hasGender && XmlGetText(n) != NULL) {
if (hContact != NULL) {
@@ -819,7 +819,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) }
}
}
- else if (!mir_tstrcmp(XmlGetName(n), L"ADR")) {
+ else if (!mir_wstrcmp(XmlGetName(n), L"ADR")) {
if (!hasHome && XmlGetChild(n, "HOME") != NULL) {
// Home address
wchar_t text[128];
@@ -828,9 +828,9 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) hasHomeStreet = true;
if (hContact != NULL) {
if ((o = XmlGetChild(n, "EXTADR")) != NULL && XmlGetText(o) != NULL)
- mir_sntprintf(text, L"%s\r\n%s", XmlGetText(m), XmlGetText(o));
+ mir_snwprintf(text, L"%s\r\n%s", XmlGetText(m), XmlGetText(o));
else if ((o = XmlGetChild(n, "EXTADD")) != NULL && XmlGetText(o) != NULL)
- mir_sntprintf(text, L"%s\r\n%s", XmlGetText(m), XmlGetText(o));
+ mir_snwprintf(text, L"%s\r\n%s", XmlGetText(m), XmlGetText(o));
else
wcsncpy_s(text, XmlGetText(m), _TRUNCATE);
text[_countof(text) - 1] = '\0';
@@ -875,9 +875,9 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) hasWorkStreet = true;
if (hContact != NULL) {
if ((o = XmlGetChild(n, "EXTADR")) != NULL && XmlGetText(o) != NULL)
- mir_sntprintf(text, L"%s\r\n%s", XmlGetText(m), XmlGetText(o));
+ mir_snwprintf(text, L"%s\r\n%s", XmlGetText(m), XmlGetText(o));
else if ((o = XmlGetChild(n, "EXTADD")) != NULL && XmlGetText(o) != NULL)
- mir_sntprintf(text, L"%s\r\n%s", XmlGetText(m), XmlGetText(o));
+ mir_snwprintf(text, L"%s\r\n%s", XmlGetText(m), XmlGetText(o));
else
wcsncpy_s(text, XmlGetText(m), _TRUNCATE);
text[_countof(text) - 1] = '\0';
@@ -914,7 +914,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) }
}
}
- else if (!mir_tstrcmp(XmlGetName(n), L"TEL")) {
+ else if (!mir_wstrcmp(XmlGetName(n), L"TEL")) {
// Telephone/Fax/Cellular
if ((m = XmlGetChild(n, "NUMBER")) != NULL && XmlGetText(m) != NULL) {
if (hContact != NULL) {
@@ -966,14 +966,14 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) }
}
}
- else if (!mir_tstrcmp(XmlGetName(n), L"URL")) {
+ else if (!mir_wstrcmp(XmlGetName(n), L"URL")) {
// Homepage
if (!hasUrl && XmlGetText(n) != NULL) {
hasUrl = true;
setTString(hContact, "Homepage", XmlGetText(n));
}
}
- else if (!mir_tstrcmp(XmlGetName(n), L"ORG")) {
+ else if (!mir_wstrcmp(XmlGetName(n), L"ORG")) {
if (!hasOrgname && !hasOrgunit) {
if ((m = XmlGetChild(n, "ORGNAME")) != NULL && XmlGetText(m) != NULL) {
hasOrgname = true;
@@ -985,19 +985,19 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) }
}
}
- else if (!mir_tstrcmp(XmlGetName(n), L"ROLE")) {
+ else if (!mir_wstrcmp(XmlGetName(n), L"ROLE")) {
if (!hasRole && XmlGetText(n) != NULL) {
hasRole = true;
setTString(hContact, "Role", XmlGetText(n));
}
}
- else if (!mir_tstrcmp(XmlGetName(n), L"TITLE")) {
+ else if (!mir_wstrcmp(XmlGetName(n), L"TITLE")) {
if (!hasTitle && XmlGetText(n) != NULL) {
hasTitle = true;
setTString(hContact, "CompanyPosition", XmlGetText(n));
}
}
- else if (!mir_tstrcmp(XmlGetName(n), L"DESC")) {
+ else if (!mir_wstrcmp(XmlGetName(n), L"DESC")) {
if (!hasDesc && XmlGetText(n) != NULL) {
hasDesc = true;
CMString tszMemo(XmlGetText(n));
@@ -1005,16 +1005,16 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) setTString(hContact, "About", tszMemo);
}
}
- else if (!mir_tstrcmp(XmlGetName(n), L"PHOTO"))
+ else if (!mir_wstrcmp(XmlGetName(n), L"PHOTO"))
OnIqResultGetVcardPhoto(n, hContact, hasPhoto);
}
}
if (hasFn && !hasNick) {
- ptrT nick(getTStringA(hContact, "Nick"));
- ptrT jidNick(JabberNickFromJID(jid));
- if (!nick || (jidNick && !mir_tstrcmpi(nick, jidNick)))
- setTString(hContact, "Nick", ptrT(getTStringA(hContact, "FullName")));
+ ptrW nick(getTStringA(hContact, "Nick"));
+ ptrW jidNick(JabberNickFromJID(jid));
+ if (!nick || (jidNick && !mir_wstrcmpi(nick, jidNick)))
+ setTString(hContact, "Nick", ptrW(getTStringA(hContact, "FullName")));
}
if (!hasFn)
delSetting(hContact, "FullName");
@@ -1125,7 +1125,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) debugLogA("Has no avatar");
delSetting(hContact, "AvatarHash");
- if (ptrT(getTStringA(hContact, "AvatarSaved")) != NULL) {
+ if (ptrW(getTStringA(hContact, "AvatarSaved")) != NULL) {
delSetting(hContact, "AvatarSaved");
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, NULL, NULL);
}
@@ -1159,7 +1159,7 @@ void CJabberProto::OnIqResultSetSearch(HXML iqNode, CJabberIqInfo*) if ((type = XmlGetAttrValue(iqNode, L"type")) == NULL) return;
if ((id = JabberGetPacketID(iqNode)) == -1) return;
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
if ((queryNode = XmlGetChild(iqNode, "query")) == NULL)
return;
@@ -1170,7 +1170,7 @@ void CJabberProto::OnIqResultSetSearch(HXML iqNode, CJabberIqInfo*) if (!itemNode)
break;
- if (!mir_tstrcmp(XmlGetName(itemNode), L"item")) {
+ if (!mir_wstrcmp(XmlGetName(itemNode), L"item")) {
if ((jid = XmlGetAttrValue(itemNode, L"jid")) != NULL) {
psr.id.w = (wchar_t*)jid;
debugLog(L"Result jid = %s", jid);
@@ -1198,7 +1198,7 @@ void CJabberProto::OnIqResultSetSearch(HXML iqNode, CJabberIqInfo*) ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
}
- else if (!mir_tstrcmp(type, L"error"))
+ else if (!mir_wstrcmp(type, L"error"))
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
}
@@ -1215,14 +1215,14 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode, CJabberIqInfo*) if (id == -1)
return;
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
if ((queryNode = XmlGetChild(iqNode, "query")) == NULL) return;
if ((queryNode = XmlGetChild(queryNode, "x")) == NULL) return;
for (int i = 0;; i++) {
HXML itemNode = XmlGetChild(queryNode, i);
if (!itemNode)
break;
- if (mir_tstrcmp(XmlGetName(itemNode), L"item"))
+ if (mir_wstrcmp(XmlGetName(itemNode), L"item"))
continue;
PROTOSEARCHRESULT psr = { 0 };
@@ -1234,7 +1234,7 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode, CJabberIqInfo*) if (!fieldNode)
break;
- if (mir_tstrcmp(XmlGetName(fieldNode), L"field"))
+ if (mir_wstrcmp(XmlGetName(fieldNode), L"field"))
continue;
const wchar_t *fieldName = XmlGetAttrValue(fieldNode, L"var");
@@ -1245,19 +1245,19 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode, CJabberIqInfo*) if (n == NULL)
continue;
- if (!mir_tstrcmp(fieldName, L"jid")) {
+ if (!mir_wstrcmp(fieldName, L"jid")) {
psr.id.w = (wchar_t*)XmlGetText(n);
debugLog(L"Result jid = %s", psr.id.w);
}
- else if (!mir_tstrcmp(fieldName, L"nickname"))
+ else if (!mir_wstrcmp(fieldName, L"nickname"))
psr.nick.w = (XmlGetText(n) != NULL) ? (wchar_t*)XmlGetText(n) : L"";
- else if (!mir_tstrcmp(fieldName, L"fn"))
+ else if (!mir_wstrcmp(fieldName, L"fn"))
psr.firstName.w = (XmlGetText(n) != NULL) ? (wchar_t*)XmlGetText(n) : L"";
- else if (!mir_tstrcmp(fieldName, L"given"))
+ else if (!mir_wstrcmp(fieldName, L"given"))
psr.firstName.w = (XmlGetText(n) != NULL) ? (wchar_t*)XmlGetText(n) : L"";
- else if (!mir_tstrcmp(fieldName, L"family"))
+ else if (!mir_wstrcmp(fieldName, L"family"))
psr.lastName.w = (XmlGetText(n) != NULL) ? (wchar_t*)XmlGetText(n) : L"";
- else if (!mir_tstrcmp(fieldName, L"email"))
+ else if (!mir_wstrcmp(fieldName, L"email"))
psr.email.w = (XmlGetText(n) != NULL) ? (wchar_t*)XmlGetText(n) : L"";
}
@@ -1266,7 +1266,7 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode, CJabberIqInfo*) ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
}
- else if (!mir_tstrcmp(type, L"error"))
+ else if (!mir_wstrcmp(type, L"error"))
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
}
@@ -1278,11 +1278,11 @@ void CJabberProto::OnIqResultSetPassword(HXML iqNode, CJabberIqInfo*) if (type == NULL)
return;
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
wcsncpy_s(m_ThreadInfo->conn.password, m_ThreadInfo->tszNewPassword, _TRUNCATE);
MessageBox(NULL, TranslateT("Password is successfully changed. Don't forget to update your password in the Jabber protocol option."), TranslateT("Change Password"), MB_OK | MB_ICONINFORMATION | MB_SETFOREGROUND);
}
- else if (!mir_tstrcmp(type, L"error"))
+ else if (!mir_wstrcmp(type, L"error"))
MessageBox(NULL, TranslateT("Password cannot be changed."), TranslateT("Change Password"), MB_OK | MB_ICONSTOP | MB_SETFOREGROUND);
}
@@ -1300,7 +1300,7 @@ void CJabberProto::OnIqResultGetVCardAvatar(HXML iqNode, CJabberIqInfo*) const wchar_t *type;
if ((type = XmlGetAttrValue(iqNode, L"type")) == NULL) return;
- if (mir_tstrcmp(type, L"result")) return;
+ if (mir_wstrcmp(type, L"result")) return;
HXML vCard = XmlGetChild(iqNode, "vCard");
if (vCard == NULL) return;
@@ -1309,7 +1309,7 @@ void CJabberProto::OnIqResultGetVCardAvatar(HXML iqNode, CJabberIqInfo*) if (XmlGetChildCount(vCard) == 0) {
delSetting(hContact, "AvatarHash");
- if (ptrT(getTStringA(hContact, "AvatarSaved")) != NULL) {
+ if (ptrW(getTStringA(hContact, "AvatarSaved")) != NULL) {
delSetting(hContact, "AvatarSaved");
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, NULL, NULL);
}
@@ -1339,11 +1339,11 @@ void CJabberProto::OnIqResultGetClientAvatar(HXML iqNode, CJabberIqInfo*) return;
HXML n = NULL;
- if ((type = XmlGetAttrValue(iqNode, L"type")) != NULL && !mir_tstrcmp(type, L"result")) {
+ if ((type = XmlGetAttrValue(iqNode, L"type")) != NULL && !mir_wstrcmp(type, L"result")) {
HXML queryNode = XmlGetChild(iqNode, "query");
if (queryNode != NULL) {
const wchar_t *xmlns = XmlGetAttrValue(queryNode, L"xmlns");
- if (!mir_tstrcmp(xmlns, JABBER_FEAT_AVATAR))
+ if (!mir_wstrcmp(xmlns, JABBER_FEAT_AVATAR))
n = XmlGetChild(queryNode, "data");
}
}
@@ -1354,7 +1354,7 @@ void CJabberProto::OnIqResultGetClientAvatar(HXML iqNode, CJabberIqInfo*) }
wchar_t szJid[JABBER_MAX_JID_LEN];
- mir_tstrncpy(szJid, from, _countof(szJid));
+ mir_wstrncpy(szJid, from, _countof(szJid));
wchar_t *res = wcschr(szJid, '/');
if (res != NULL)
*res = 0;
@@ -1379,11 +1379,11 @@ void CJabberProto::OnIqResultGetServerAvatar(HXML iqNode, CJabberIqInfo*) HXML n = NULL;
const wchar_t *type = XmlGetAttrValue(iqNode, L"type");
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
HXML queryNode = XmlGetChild(iqNode, "query");
if (queryNode != NULL) {
const wchar_t *xmlns = XmlGetAttrValue(queryNode, L"xmlns");
- if (!mir_tstrcmp(xmlns, JABBER_FEAT_SERVER_AVATAR))
+ if (!mir_wstrcmp(xmlns, JABBER_FEAT_SERVER_AVATAR))
n = XmlGetChild(queryNode, "data");
}
}
@@ -1394,7 +1394,7 @@ void CJabberProto::OnIqResultGetServerAvatar(HXML iqNode, CJabberIqInfo*) }
wchar_t szJid[JABBER_MAX_JID_LEN];
- mir_tstrncpy(szJid, from, _countof(szJid));
+ mir_wstrncpy(szJid, from, _countof(szJid));
wchar_t *res = wcschr(szJid, '/');
if (res != NULL)
*res = 0;
@@ -1414,10 +1414,10 @@ void CJabberProto::OnIqResultGotAvatar(MCONTACT hContact, HXML n, const wchar_t int pictureType;
if (mimeType != NULL) {
- if (!mir_tstrcmp(mimeType, L"image/jpeg")) pictureType = PA_FORMAT_JPEG;
- else if (!mir_tstrcmp(mimeType, L"image/png")) pictureType = PA_FORMAT_PNG;
- else if (!mir_tstrcmp(mimeType, L"image/gif")) pictureType = PA_FORMAT_GIF;
- else if (!mir_tstrcmp(mimeType, L"image/bmp")) pictureType = PA_FORMAT_BMP;
+ if (!mir_wstrcmp(mimeType, L"image/jpeg")) pictureType = PA_FORMAT_JPEG;
+ else if (!mir_wstrcmp(mimeType, L"image/png")) pictureType = PA_FORMAT_PNG;
+ else if (!mir_wstrcmp(mimeType, L"image/gif")) pictureType = PA_FORMAT_GIF;
+ else if (!mir_wstrcmp(mimeType, L"image/bmp")) pictureType = PA_FORMAT_BMP;
else {
LBL_ErrFormat:
debugLog(L"Invalid mime type specified for picture: %s", mimeType);
@@ -1474,7 +1474,7 @@ void CJabberProto::OnIqResultDiscoBookmarks(HXML iqNode, CJabberIqInfo*) return;
const wchar_t *jid;
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
if (m_ThreadInfo && !(m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVATE_STORAGE)) {
m_ThreadInfo->jabberServerCaps |= JABBER_CAPS_PRIVATE_STORAGE;
EnableMenuItems(true);
@@ -1486,23 +1486,23 @@ void CJabberProto::OnIqResultDiscoBookmarks(HXML iqNode, CJabberIqInfo*) HXML itemNode;
for (int i = 0; itemNode = XmlGetChild(storageNode, i); i++) {
if (LPCTSTR name = XmlGetName(itemNode)) {
- if (!mir_tstrcmp(name, L"conference") && (jid = XmlGetAttrValue(itemNode, L"jid"))) {
+ if (!mir_wstrcmp(name, L"conference") && (jid = XmlGetAttrValue(itemNode, L"jid"))) {
JABBER_LIST_ITEM *item = ListAdd(LIST_BOOKMARK, jid);
- item->name = mir_tstrdup(XmlGetAttrValue(itemNode, L"name"));
- item->type = mir_tstrdup(L"conference");
+ item->name = mir_wstrdup(XmlGetAttrValue(itemNode, L"name"));
+ item->type = mir_wstrdup(L"conference");
item->bUseResource = true;
- item->nick = mir_tstrdup(XPathT(itemNode, "nick"));
- item->password = mir_tstrdup(XPathT(itemNode, "password"));
+ item->nick = mir_wstrdup(XPathT(itemNode, "nick"));
+ item->password = mir_wstrdup(XPathT(itemNode, "password"));
const wchar_t *autoJ = XmlGetAttrValue(itemNode, L"autojoin");
if (autoJ != NULL)
- item->bAutoJoin = !mir_tstrcmp(autoJ, L"true") || !mir_tstrcmp(autoJ, L"1");
+ item->bAutoJoin = !mir_wstrcmp(autoJ, L"true") || !mir_wstrcmp(autoJ, L"1");
}
- else if (!mir_tstrcmp(name, L"url") && (jid = XmlGetAttrValue(itemNode, L"url"))) {
+ else if (!mir_wstrcmp(name, L"url") && (jid = XmlGetAttrValue(itemNode, L"url"))) {
JABBER_LIST_ITEM *item = ListAdd(LIST_BOOKMARK, jid);
item->bUseResource = true;
- item->name = mir_tstrdup(XmlGetAttrValue(itemNode, L"name"));
- item->type = mir_tstrdup(L"url");
+ item->name = mir_wstrdup(XmlGetAttrValue(itemNode, L"name"));
+ item->type = mir_wstrdup(L"url");
}
}
}
@@ -1512,7 +1512,7 @@ void CJabberProto::OnIqResultDiscoBookmarks(HXML iqNode, CJabberIqInfo*) OnProcessLoginRq(m_ThreadInfo, JABBER_LOGIN_BOOKMARKS);
}
}
- else if (!mir_tstrcmp(type, L"error")) {
+ else if (!mir_wstrcmp(type, L"error")) {
if (m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVATE_STORAGE) {
m_ThreadInfo->jabberServerCaps &= ~JABBER_CAPS_PRIVATE_STORAGE;
EnableMenuItems(true);
@@ -1532,7 +1532,7 @@ void CJabberProto::SetBookmarkRequest(XmlNodeIq& iq) if (item == NULL || item->jid == NULL)
continue;
- if (!mir_tstrcmp(item->type, L"conference")) {
+ if (!mir_wstrcmp(item->type, L"conference")) {
HXML itemNode = storage << XCHILD(L"conference") << XATTR(L"jid", item->jid);
if (item->name)
itemNode << XATTR(L"name", item->name);
@@ -1544,7 +1544,7 @@ void CJabberProto::SetBookmarkRequest(XmlNodeIq& iq) itemNode << XCHILD(L"password", item->password);
}
- if (!mir_tstrcmp(item->type, L"url")) {
+ if (!mir_wstrcmp(item->type, L"url")) {
HXML itemNode = storage << XCHILD(L"url") << XATTR(L"url", item->jid);
if (item->name)
itemNode << XATTR(L"name", item->name);
@@ -1563,10 +1563,10 @@ void CJabberProto::OnIqResultSetBookmarks(HXML iqNode, CJabberIqInfo*) if (type == NULL)
return;
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
UI_SAFE_NOTIFY(m_pDlgBookmarks, WM_JABBER_REFRESH);
}
- else if (!mir_tstrcmp(type, L"error")) {
+ else if (!mir_wstrcmp(type, L"error")) {
HXML errorNode = XmlGetChild(iqNode, "error");
wchar_t *str = JabberErrorMsg(errorNode);
MessageBox(NULL, str, TranslateT("Jabber Bookmarks Error"), MB_OK | MB_SETFOREGROUND);
@@ -1593,7 +1593,7 @@ void CJabberProto::OnIqResultLastActivity(HXML iqNode, CJabberIqInfo *pInfo) LPCTSTR szLastStatusMessage = XPathT(iqNode, "query[@xmlns='jabber:iq:last']");
if (szLastStatusMessage) // replace only if it exists
- r->m_tszStatusMessage = mir_tstrdup(szLastStatusMessage);
+ r->m_tszStatusMessage = mir_wstrdup(szLastStatusMessage);
}
r->m_dwIdleStartTime = lastActivity;
diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp index 1795ccbcfb..1904cb0cf7 100644 --- a/protocols/JabberG/src/jabber_iqid_muc.cpp +++ b/protocols/JabberG/src/jabber_iqid_muc.cpp @@ -49,17 +49,17 @@ void CJabberProto::OnIqResultGetMuc(HXML iqNode, CJabberIqInfo*) if (from == NULL)
return;
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
HXML queryNode = XmlGetChild(iqNode, L"query");
if (queryNode != NULL) {
LPCTSTR str = XmlGetAttrValue(queryNode, L"xmlns");
- if (!mir_tstrcmp(str, JABBER_FEAT_MUC_OWNER)) {
+ if (!mir_wstrcmp(str, JABBER_FEAT_MUC_OWNER)) {
HXML xNode = XmlGetChild(queryNode, L"x");
if (xNode != NULL) {
str = XmlGetAttrValue(xNode, L"xmlns");
- if (!mir_tstrcmp(str, JABBER_FEAT_DATA_FORMS))
+ if (!mir_wstrcmp(str, JABBER_FEAT_DATA_FORMS))
//LaunchForm(xNode);
- FormCreateDialog(xNode, L"Jabber Conference Room Configuration", &CJabberProto::SetMucConfig, mir_tstrdup(from));
+ FormCreateDialog(xNode, L"Jabber Conference Room Configuration", &CJabberProto::SetMucConfig, mir_wstrdup(from));
}
}
}
@@ -116,14 +116,14 @@ static void sttFillJidList(HWND hwndDlg) if (jidListInfo->type == MUC_BANLIST) {
LPCTSTR reason = XmlGetText(XmlGetChild(itemNode, L"reason"));
if (reason != NULL) {
- mir_sntprintf(tszItemText, L"%s (%s)", jid, reason);
+ mir_snwprintf(tszItemText, L"%s (%s)", jid, reason);
lvi.pszText = tszItemText;
}
}
else if (jidListInfo->type == MUC_VOICELIST || jidListInfo->type == MUC_MODERATORLIST) {
LPCTSTR nick = XmlGetAttrValue(itemNode, L"nick");
if (nick != NULL) {
- mir_sntprintf(tszItemText, L"%s (%s)", nick, jid);
+ mir_snwprintf(tszItemText, L"%s (%s)", nick, jid);
lvi.pszText = tszItemText;
}
}
@@ -131,7 +131,7 @@ static void sttFillJidList(HWND hwndDlg) if (filter && *filter && !JabberStrIStr(lvi.pszText, filter))
continue;
- lvi.lParam = (LPARAM)mir_tstrdup(jid);
+ lvi.lParam = (LPARAM)mir_wstrdup(jid);
ListView_InsertItem(hwndList, &lvi);
lvi.iItem++;
@@ -235,17 +235,17 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
// Populate displayed list from iqNode
- mir_tstrncpy(title, TranslateT("JID List"), _countof(title));
+ mir_wstrncpy(title, TranslateT("JID List"), _countof(title));
if ((dat = (JABBER_MUC_JIDLIST_INFO *)lParam) != NULL) {
HXML iqNode = dat->iqNode;
if (iqNode != NULL) {
LPCTSTR from = XmlGetAttrValue(iqNode, L"from");
if (from != NULL) {
- dat->roomJid = mir_tstrdup(from);
+ dat->roomJid = mir_wstrdup(from);
HXML queryNode = XmlGetChild(iqNode, L"query");
if (queryNode != NULL) {
- wchar_t *localFrom = mir_tstrdup(from);
- mir_sntprintf(title, TranslateT("%s, %d items (%s)"),
+ wchar_t *localFrom = mir_wstrdup(from);
+ mir_snwprintf(title, TranslateT("%s, %d items (%s)"),
(dat->type == MUC_VOICELIST) ? TranslateT("Voice List") :
(dat->type == MUC_MEMBERLIST) ? TranslateT("Member List") :
(dat->type == MUC_MODERATORLIST) ? TranslateT("Moderator List") :
@@ -345,7 +345,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w //delete
wchar_t msgText[128];
- mir_sntprintf(msgText, TranslateT("Removing %s?"), text);
+ mir_snwprintf(msgText, TranslateT("Removing %s?"), text);
if (MessageBox(hwndDlg, msgText, dat->type2str(), MB_YESNO | MB_SETFOREGROUND) == IDYES) {
dat->ppro->DeleteMucListItem(dat, (wchar_t*)lvi.lParam);
mir_free((void *)lvi.lParam);
@@ -484,7 +484,7 @@ void CJabberProto::OnIqResultMucGetJidList(HXML iqNode, JABBER_MUC_JIDLIST_TYPE if (type == NULL)
return;
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
JABBER_MUC_JIDLIST_INFO *jidListInfo = new JABBER_MUC_JIDLIST_INFO;
if (jidListInfo != NULL) {
jidListInfo->type = listType;
diff --git a/protocols/JabberG/src/jabber_libstr.cpp b/protocols/JabberG/src/jabber_libstr.cpp index 24b13f8478..8c8ce64065 100644 --- a/protocols/JabberG/src/jabber_libstr.cpp +++ b/protocols/JabberG/src/jabber_libstr.cpp @@ -29,5 +29,5 @@ int lstrcmp_null(const wchar_t *s1, const wchar_t *s2) if (!s1 && !s2) return 0;
if (!s1) return -1;
if (!s2) return 1;
- return mir_tstrcmp(s1, s2);
+ return mir_wstrcmp(s1, s2);
}
diff --git a/protocols/JabberG/src/jabber_list.cpp b/protocols/JabberG/src/jabber_list.cpp index 434bdd1028..1e4c95f77f 100644 --- a/protocols/JabberG/src/jabber_list.cpp +++ b/protocols/JabberG/src/jabber_list.cpp @@ -91,12 +91,12 @@ void CJabberProto::ListInit(void) {
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
if (isChatRoom(hContact)) {
- ptrT jid(getTStringA(hContact, "ChatRoomID"));
+ ptrW jid(getTStringA(hContact, "ChatRoomID"));
if (jid != NULL)
ListAdd(LIST_CHATROOM, jid, hContact);
}
else {
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid != NULL)
ListAdd(LIST_ROSTER, jid, hContact);
}
@@ -127,7 +127,7 @@ JABBER_LIST_ITEM* CJabberProto::ListAdd(JABBER_LIST list, const wchar_t *jid, MC return item;
}
- wchar_t *s = mir_tstrdup(jid);
+ wchar_t *s = mir_wstrdup(jid);
wchar_t *q = NULL;
// strip resource name if any
//fyr
@@ -244,7 +244,7 @@ pResourceStatus JABBER_LIST_ITEM::findResource(const wchar_t *resourceName) cons for (int i = 0; i < arResources.getCount(); i++) {
JABBER_RESOURCE_STATUS *r = arResources[i];
- if (!mir_tstrcmp(r->m_tszResourceName, resourceName))
+ if (!mir_wstrcmp(r->m_tszResourceName, resourceName))
return r;
}
@@ -282,7 +282,7 @@ bool CJabberProto::ListAddResource(JABBER_LIST list, const wchar_t *jid, int sta JABBER_RESOURCE_STATUS *r = LI->findResource(resource);
if (r != NULL) { // Already exists, update status and statusMessage
r->m_iStatus = status;
- r->m_tszStatusMessage = mir_tstrdup(statusMessage);
+ r->m_tszStatusMessage = mir_wstrdup(statusMessage);
r->m_iPriority = priority;
}
else { // Does not exist, add new resource
@@ -291,10 +291,10 @@ bool CJabberProto::ListAddResource(JABBER_LIST list, const wchar_t *jid, int sta r->m_iStatus = status;
r->m_affiliation = AFFILIATION_NONE;
r->m_role = ROLE_NONE;
- r->m_tszResourceName = mir_tstrdup(resource);
- r->m_tszNick = mir_tstrdup(nick);
+ r->m_tszResourceName = mir_wstrdup(resource);
+ r->m_tszNick = mir_wstrdup(nick);
if (statusMessage)
- r->m_tszStatusMessage = mir_tstrdup(statusMessage);
+ r->m_tszStatusMessage = mir_wstrdup(statusMessage);
r->m_iPriority = priority;
LI->arResources.insert(r);
}
@@ -303,7 +303,7 @@ bool CJabberProto::ListAddResource(JABBER_LIST list, const wchar_t *jid, int sta else {
JABBER_RESOURCE_STATUS *r = LI->getTemp();
r->m_iStatus = status;
- r->m_tszStatusMessage = mir_tstrdup(statusMessage);
+ r->m_tszStatusMessage = mir_wstrdup(statusMessage);
}
lck.unlock();
diff --git a/protocols/JabberG/src/jabber_list.h b/protocols/JabberG/src/jabber_list.h index 29f145422c..f3184582eb 100644 --- a/protocols/JabberG/src/jabber_list.h +++ b/protocols/JabberG/src/jabber_list.h @@ -85,29 +85,29 @@ public: void Release();
int m_iStatus;
- ptrT m_tszResourceName;
- ptrT m_tszStatusMessage;
+ ptrW m_tszResourceName;
+ ptrW m_tszStatusMessage;
int m_iPriority; // resource priority, -128..+127
time_t m_dwIdleStartTime;// XEP-0012 support
// groupchat support
JABBER_GC_AFFILIATION m_affiliation;
JABBER_GC_ROLE m_role;
- ptrT m_tszNick;
- ptrT m_tszRealJid; // real jid for jabber conferences
+ ptrW m_tszNick;
+ ptrW m_tszRealJid; // real jid for jabber conferences
// XEP-0115 support
- ptrT m_tszCapsNode;
- ptrT m_tszCapsVer;
- ptrT m_tszCapsExt;
+ ptrW m_tszCapsNode;
+ ptrW m_tszCapsVer;
+ ptrW m_tszCapsExt;
DWORD m_dwVersionRequestTime, m_dwDiscoInfoRequestTime;
JabberCapsBits m_jcbCachedCaps;
JabberCapsBits m_jcbManualDiscoveredCaps;
// XEP-232 support
- ptrT m_tszOs, m_tszOsVersion;
- ptrT m_tszSoftware, m_tszSoftwareVersion, m_tszXMirandaCoreVersion;
+ ptrW m_tszOs, m_tszOsVersion;
+ ptrW m_tszSoftware, m_tszSoftwareVersion, m_tszXMirandaCoreVersion;
// XEP-0085 gone event support
BOOL m_bMessageSessionActive;
@@ -221,7 +221,7 @@ struct JABBER_HTTP_AVATARS MCONTACT hContact;
JABBER_HTTP_AVATARS(const wchar_t *tUrl, MCONTACT thContact)
- : Url(mir_t2a(tUrl)), hContact(thContact) {}
+ : Url(mir_u2a(tUrl)), hContact(thContact) {}
~JABBER_HTTP_AVATARS() { mir_free(Url); }
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index 3df1e3989d..512ec95593 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -374,7 +374,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) bool bIsTransport = getBool(hContact, "IsTransport", false);
if ((bIsChatRoom == GCW_CHATROOM) || bIsChatRoom == 0) {
- if (ptrT(getTStringA(hContact, bIsChatRoom ? (char*)"ChatRoomID" : (char*)"jid")) != NULL) {
+ if (ptrW(getTStringA(hContact, bIsChatRoom ? (char*)"ChatRoomID" : (char*)"jid")) != NULL) {
Menu_ShowItem(g_hMenuConvert, TRUE);
Menu_ModifyItem(g_hMenuConvert, bIsChatRoom ? LPGENW("&Convert to Contact") : LPGENW("&Convert to Chat Room"));
}
@@ -388,7 +388,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) Menu_ModifyItem(g_hMenuDirectPresence[i + 1], NULL, Skin_LoadProtoIcon(m_szModuleName, PresenceModeArray[i].mode));
if (bIsChatRoom) {
- ptrT roomid(getTStringA(hContact, "ChatRoomID"));
+ ptrW roomid(getTStringA(hContact, "ChatRoomID"));
if (roomid != NULL) {
Menu_ShowItem(g_hMenuRosterAdd, FALSE);
@@ -406,7 +406,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) Menu_ShowItem(g_hMenuRefresh, TRUE);
}
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid == NULL)
return 0;
@@ -477,7 +477,7 @@ INT_PTR __cdecl CJabberProto::OnMenuConvertChatContact(WPARAM hContact, LPARAM) BYTE bIsChatRoom = isChatRoom(hContact);
const char *szSetting = (bIsChatRoom) ? "ChatRoomID" : "jid";
- ptrT jid(getTStringA(hContact, szSetting));
+ ptrW jid(getTStringA(hContact, szSetting));
if (jid != NULL) {
delSetting(hContact, szSetting);
setTString(hContact, szSetting, jid);
@@ -491,21 +491,21 @@ INT_PTR __cdecl CJabberProto::OnMenuRosterAdd(WPARAM hContact, LPARAM) if (!hContact)
return 0; // we do not add ourself to the roster. (buggy situation - should not happen)
- ptrT roomID(getTStringA(hContact, "ChatRoomID"));
+ ptrW roomID(getTStringA(hContact, "ChatRoomID"));
if (roomID == NULL)
return 0;
if (ListGetItemPtr(LIST_ROSTER, roomID) == NULL) {
- ptrT group(db_get_tsa(hContact, "CList", "Group"));
- ptrT nick(getTStringA(hContact, "Nick"));
+ ptrW group(db_get_tsa(hContact, "CList", "Group"));
+ ptrW nick(getTStringA(hContact, "Nick"));
AddContactToRoster(roomID, nick, group);
if (m_options.AddRoster2Bookmarks == TRUE) {
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_BOOKMARK, roomID);
if (item == NULL) {
item = new JABBER_LIST_ITEM();
- item->jid = mir_tstrdup(roomID);
- item->name = mir_tstrdup(nick);
+ item->jid = mir_wstrdup(roomID);
+ item->name = mir_wstrdup(nick);
item->nick = getTStringA(hContact, "MyNick");
AddEditBookmark(item);
delete item;
@@ -518,7 +518,7 @@ INT_PTR __cdecl CJabberProto::OnMenuRosterAdd(WPARAM hContact, LPARAM) INT_PTR __cdecl CJabberProto::OnMenuHandleRequestAuth(WPARAM hContact, LPARAM)
{
if (hContact != NULL && m_bJabberOnline) {
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid != NULL)
m_ThreadInfo->send(XmlNode(L"presence") << XATTR(L"to", jid) << XATTR(L"type", L"subscribe"));
}
@@ -528,7 +528,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleRequestAuth(WPARAM hContact, LPARAM) INT_PTR __cdecl CJabberProto::OnMenuHandleGrantAuth(WPARAM hContact, LPARAM)
{
if (hContact != NULL && m_bJabberOnline) {
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid != NULL)
m_ThreadInfo->send(XmlNode(L"presence") << XATTR(L"to", jid) << XATTR(L"type", L"subscribed"));
}
@@ -538,7 +538,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleGrantAuth(WPARAM hContact, LPARAM) INT_PTR __cdecl CJabberProto::OnMenuRevokeAuth(WPARAM hContact, LPARAM)
{
if (hContact != NULL && m_bJabberOnline) {
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid != NULL)
m_ThreadInfo->send(XmlNode(L"presence") << XATTR(L"to", jid) << XATTR(L"type", L"unsubscribed"));
}
@@ -550,7 +550,7 @@ INT_PTR __cdecl CJabberProto::OnMenuTransportLogin(WPARAM hContact, LPARAM) if (!getByte(hContact, "IsTransport", 0))
return 0;
- JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, ptrT(getTStringA(hContact, "jid")));
+ JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, ptrW(getTStringA(hContact, "jid")));
if (item != NULL) {
XmlNode p(L"presence"); XmlAddAttr(p, L"to", item->jid);
if (item->getTemp()->m_iStatus == ID_STATUS_ONLINE)
@@ -565,7 +565,7 @@ INT_PTR __cdecl CJabberProto::OnMenuTransportResolve(WPARAM hContact, LPARAM) if (!getByte(hContact, "IsTransport", 0))
return 0;
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid != NULL)
ResolveTransportNicks(jid);
return 0;
@@ -576,13 +576,13 @@ INT_PTR __cdecl CJabberProto::OnMenuBookmarkAdd(WPARAM hContact, LPARAM) if (!hContact)
return 0; // we do not add ourself to the roster. (buggy situation - should not happen)
- ptrT roomID(getTStringA(hContact, "ChatRoomID"));
+ ptrW roomID(getTStringA(hContact, "ChatRoomID"));
if (roomID == NULL)
return 0;
if (ListGetItemPtr(LIST_BOOKMARK, roomID) == NULL) {
JABBER_LIST_ITEM *item = new JABBER_LIST_ITEM();
- item->jid = mir_tstrdup(roomID);
+ item->jid = mir_wstrdup(roomID);
item->name = pcli->pfnGetContactDisplayName(hContact, 0);
item->type = L"conference";
item->nick = getTStringA(hContact, "MyNick");
@@ -723,11 +723,11 @@ void CJabberProto::MenuInit() mir_snprintf(srvFce, "/menuSetPriority/%d", steps[i]);
if (steps[i] > 0) {
- mir_sntprintf(szName, TranslateT("Increase priority by %d"), steps[i]);
+ mir_snwprintf(szName, TranslateT("Increase priority by %d"), steps[i]);
mi.hIcolibItem = GetIconHandle(IDI_ARROW_UP);
}
else {
- mir_sntprintf(szName, TranslateT("Decrease priority by %d"), -steps[i]);
+ mir_snwprintf(szName, TranslateT("Decrease priority by %d"), -steps[i]);
mi.hIcolibItem = GetIconHandle(IDI_ARROW_DOWN);
}
@@ -771,7 +771,7 @@ void CJabberProto::UpdatePriorityMenu(int priority) return;
wchar_t szName[128];
- mir_sntprintf(szName, TranslateT("Resource priority [%d]"), (int)priority);
+ mir_snwprintf(szName, TranslateT("Resource priority [%d]"), (int)priority);
Menu_ModifyItem(m_hMenuPriorityRoot, szName);
m_priorityMenuVal = priority;
@@ -941,7 +941,7 @@ int CJabberProto::OnProcessSrmmEvent(WPARAM, LPARAM lParam) hDialogsList = WindowList_Create();
WindowList_Add(hDialogsList, event->hwndWindow, event->hContact);
- ptrT jid(getTStringA(event->hContact, "jid"));
+ ptrW jid(getTStringA(event->hContact, "jid"));
if (jid != NULL) {
JABBER_LIST_ITEM *pItem = ListGetItemPtr(LIST_ROSTER, jid);
if (pItem && m_ThreadInfo && (m_ThreadInfo->jabberServerCaps & JABBER_CAPS_ARCHIVE_AUTO) && m_options.EnableMsgArchive)
@@ -991,14 +991,14 @@ int CJabberProto::OnProcessSrmmIconClick(WPARAM hContact, LPARAM lParam) if (!hContact)
return 0;
- JABBER_LIST_ITEM *LI = ListGetItemPtr(LIST_ROSTER, ptrT(getTStringA(hContact, "jid")));
+ JABBER_LIST_ITEM *LI = ListGetItemPtr(LIST_ROSTER, ptrW(getTStringA(hContact, "jid")));
if (LI == NULL)
return 0;
HMENU hMenu = CreatePopupMenu();
wchar_t buf[256];
- mir_sntprintf(buf, TranslateT("Last active (%s)"),
+ mir_snwprintf(buf, TranslateT("Last active (%s)"),
LI->m_pLastSeenResource ? LI->m_pLastSeenResource->m_tszResourceName : TranslateT("No activity yet, use server's choice"));
AppendMenu(hMenu, MF_STRING, MENUITEM_LASTSEEN, buf);
@@ -1041,7 +1041,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleResource(WPARAM hContact, LPARAM, LPAR if (!m_bJabberOnline || !hContact)
return 0;
- ptrT tszJid(getTStringA(hContact, "jid"));
+ ptrW tszJid(getTStringA(hContact, "jid"));
if (tszJid == NULL)
return 0;
@@ -1073,9 +1073,9 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleDirectPresence(WPARAM hContact, LPARAM return 0;
wchar_t *jid, text[1024];
- ptrT tszJid(getTStringA(hContact, "jid"));
+ ptrW tszJid(getTStringA(hContact, "jid"));
if (tszJid == NULL) {
- ptrT roomid(getTStringA(hContact, "ChatRoomID"));
+ ptrW roomid(getTStringA(hContact, "ChatRoomID"));
if (roomid == NULL)
return 0;
@@ -1083,7 +1083,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleDirectPresence(WPARAM hContact, LPARAM if (item == NULL)
return 0;
- mir_sntprintf(text, L"%s/%s", item->jid, item->nick);
+ mir_snwprintf(text, L"%s/%s", item->jid, item->nick);
jid = text;
}
else jid = tszJid;
diff --git a/protocols/JabberG/src/jabber_message_handlers.cpp b/protocols/JabberG/src/jabber_message_handlers.cpp index cb17a7fa13..b0ffaddade 100644 --- a/protocols/JabberG/src/jabber_message_handlers.cpp +++ b/protocols/JabberG/src/jabber_message_handlers.cpp @@ -36,7 +36,7 @@ BOOL CJabberProto::OnMessageError(HXML node, ThreadData*, CJabberMessageInfo* pI if (item != NULL) { // yes, it is
wchar_t *szErrText = JabberErrorMsg(pInfo->GetChildNode());
if (id != -1) {
- char *errText = mir_t2a(szErrText);
+ char *errText = mir_u2a(szErrText);
ProtoBroadcastAck(pInfo->GetHContact(), ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)id, (LPARAM)errText);
mir_free(errText);
}
@@ -44,9 +44,9 @@ BOOL CJabberProto::OnMessageError(HXML node, ThreadData*, CJabberMessageInfo* pI wchar_t buf[512];
HXML bodyNode = XmlGetChild(node, "body");
if (bodyNode)
- mir_sntprintf(buf, L"%s:\n%s\n%s", pInfo->GetFrom(), XmlGetText(bodyNode), szErrText);
+ mir_snwprintf(buf, L"%s:\n%s\n%s", pInfo->GetFrom(), XmlGetText(bodyNode), szErrText);
else
- mir_sntprintf(buf, L"%s:\n%s", pInfo->GetFrom(), szErrText);
+ mir_snwprintf(buf, L"%s:\n%s", pInfo->GetFrom(), szErrText);
MsgPopup(NULL, buf, TranslateT("Jabber Error"));
}
diff --git a/protocols/JabberG/src/jabber_message_manager.cpp b/protocols/JabberG/src/jabber_message_manager.cpp index c6253582ae..99b853bca9 100644 --- a/protocols/JabberG/src/jabber_message_manager.cpp +++ b/protocols/JabberG/src/jabber_message_manager.cpp @@ -59,15 +59,15 @@ bool CJabberMessageManager::HandleMessagePermanent(HXML node, ThreadData *pThrea LPCTSTR szType = XmlGetAttrValue(node, L"type");
if (szType) {
- if (!mir_tstrcmpi(szType, L"normal"))
+ if (!mir_wstrcmpi(szType, L"normal"))
messageInfo.m_nMessageType = JABBER_MESSAGE_TYPE_NORMAL;
- else if (!mir_tstrcmpi(szType, L"error"))
+ else if (!mir_wstrcmpi(szType, L"error"))
messageInfo.m_nMessageType = JABBER_MESSAGE_TYPE_ERROR;
- else if (!mir_tstrcmpi(szType, L"chat"))
+ else if (!mir_wstrcmpi(szType, L"chat"))
messageInfo.m_nMessageType = JABBER_MESSAGE_TYPE_CHAT;
- else if (!mir_tstrcmpi(szType, L"groupchat"))
+ else if (!mir_wstrcmpi(szType, L"groupchat"))
messageInfo.m_nMessageType = JABBER_MESSAGE_TYPE_GROUPCHAT;
- else if (!mir_tstrcmpi(szType, L"headline"))
+ else if (!mir_wstrcmpi(szType, L"headline"))
messageInfo.m_nMessageType = JABBER_MESSAGE_TYPE_HEADLINE;
else
return false;
@@ -82,7 +82,7 @@ bool CJabberMessageManager::HandleMessagePermanent(HXML node, ThreadData *pThrea LPCTSTR szTagName = XmlGetName(child);
LPCTSTR szXmlns = XmlGetAttrValue(child, L"xmlns");
- if ((!pInfo.m_szXmlns || (szXmlns && !mir_tstrcmp(pInfo.m_szXmlns, szXmlns))) && (!pInfo.m_szTag || !mir_tstrcmp(pInfo.m_szTag, szTagName))) {
+ if ((!pInfo.m_szXmlns || (szXmlns && !mir_wstrcmp(pInfo.m_szXmlns, szXmlns))) && (!pInfo.m_szTag || !mir_wstrcmp(pInfo.m_szTag, szTagName))) {
// node suits handler criteria, call the handler
messageInfo.m_hChildNode = child;
messageInfo.m_szChildTagName = szTagName;
@@ -125,9 +125,9 @@ CJabberMessagePermanentInfo* CJabberMessageManager::AddPermanentHandler( CJabberMessagePermanentInfo* pInfo = new CJabberMessagePermanentInfo();
pInfo->m_pHandler = pHandler;
pInfo->m_nMessageTypes = nMessageTypes ? nMessageTypes : JABBER_MESSAGE_TYPE_ANY;
- pInfo->m_szXmlns = mir_tstrdup(szXmlns);
+ pInfo->m_szXmlns = mir_wstrdup(szXmlns);
pInfo->m_bAllowPartialNs = bAllowPartialNs;
- pInfo->m_szTag = mir_tstrdup(szTag);
+ pInfo->m_szTag = mir_wstrdup(szTag);
pInfo->m_dwParamsToParse = dwParamsToParse;
pInfo->m_pUserData = pUserData;
pInfo->m_pUserDataFree = pUserDataFree;
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index 36d7eda517..ac90da7561 100644 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -156,7 +156,7 @@ BOOL CJabberProto::AddDbPresenceEvent(MCONTACT hContact, BYTE btEventType) void CJabberProto::GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen)
{
- int tPathLen = mir_sntprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
+ int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
DWORD dwAttributes = GetFileAttributes(pszDest);
if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
@@ -176,15 +176,15 @@ void CJabberProto::GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t db_free(&dbv);
}
else _i64toa((LONG_PTR)hContact, str, 10);
- mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, L"%S%s", JabberSha1(str, buf), szFileType);
+ mir_snwprintf(pszDest + tPathLen, MAX_PATH - tPathLen, L"%S%s", JabberSha1(str, buf), szFileType);
}
else if (m_ThreadInfo != NULL) {
- mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, L"%s@%S avatar%s",
+ mir_snwprintf(pszDest + tPathLen, MAX_PATH - tPathLen, L"%s@%S avatar%s",
m_ThreadInfo->conn.username, m_ThreadInfo->conn.server, szFileType);
}
else {
ptrA res1(getStringA("LoginName")), res2(getStringA("LoginServer"));
- mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, L"%S@%S avatar%s",
+ mir_snwprintf(pszDest + tPathLen, MAX_PATH - tPathLen, L"%S@%S avatar%s",
(res1) ? (LPSTR)res1 : "noname", (res2) ? (LPSTR)res2 : m_szModuleName, szFileType);
}
}
@@ -203,15 +203,15 @@ void CJabberProto::ResolveTransportNicks(const wchar_t *jid) if (!getByte(hContact, "IsTransported", 0))
continue;
- ptrT dbJid(getTStringA(hContact, "jid")); if (dbJid == NULL) continue;
- ptrT dbNick(getTStringA(hContact, "Nick")); if (dbNick == NULL) continue;
+ ptrW dbJid(getTStringA(hContact, "jid")); if (dbJid == NULL) continue;
+ ptrW dbNick(getTStringA(hContact, "Nick")); if (dbNick == NULL) continue;
wchar_t *p = wcschr(dbJid, '@');
if (p == NULL)
continue;
*p = 0;
- if (!mir_tstrcmp(jid, p + 1) && !mir_tstrcmp(dbJid, dbNick)) {
+ if (!mir_wstrcmp(jid, p + 1) && !mir_wstrcmp(dbJid, dbNick)) {
*p = '@';
m_ThreadInfo->resolveID = SendGetVcard(dbJid);
m_ThreadInfo->resolveContact = hContact;
@@ -379,15 +379,15 @@ void CJabberProto::UpdateMirVer(MCONTACT hContact, pResourceStatus &resource) if (!tszMirVer.IsEmpty())
setTString(hContact, "MirVer", tszMirVer);
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid == NULL)
return;
wchar_t szFullJid[JABBER_MAX_JID_LEN];
if (resource->m_tszResourceName && !wcschr(jid, '/'))
- mir_sntprintf(szFullJid, L"%s/%s", jid, resource->m_tszResourceName);
+ mir_snwprintf(szFullJid, L"%s/%s", jid, resource->m_tszResourceName);
else
- mir_tstrncpy(szFullJid, jid, _countof(szFullJid));
+ mir_wstrncpy(szFullJid, jid, _countof(szFullJid));
setTString(hContact, DBSETTING_DISPLAY_UID, szFullJid);
}
@@ -438,7 +438,7 @@ void CJabberProto::SetContactOfflineStatus(MCONTACT hContact) void CJabberProto::InitPopups(void)
{
wchar_t desc[256];
- mir_sntprintf(desc, L"%s %s", m_tszUserName, TranslateT("Errors"));
+ mir_snwprintf(desc, L"%s %s", m_tszUserName, TranslateT("Errors"));
char name[256];
mir_snprintf(name, "%s_%s", m_szModuleName, "Error");
diff --git a/protocols/JabberG/src/jabber_notes.cpp b/protocols/JabberG/src/jabber_notes.cpp index 58fd94594c..66f16d6f1a 100644 --- a/protocols/JabberG/src/jabber_notes.cpp +++ b/protocols/JabberG/src/jabber_notes.cpp @@ -35,10 +35,10 @@ static wchar_t* StrTrimCopy(wchar_t *str) {
if (!str) return 0;
while (*str && iswspace(*str)) ++str;
- if (!*str) return mir_tstrdup(str);
+ if (!*str) return mir_wstrdup(str);
- wchar_t *res = mir_tstrdup(str);
- for (wchar_t *p = res + mir_tstrlen(res) - 1; p >= res; --p) {
+ wchar_t *res = mir_wstrdup(str);
+ for (wchar_t *p = res + mir_wstrlen(res) - 1; p >= res; --p) {
if (iswspace(*p))
*p = 0;
else
@@ -85,8 +85,8 @@ void CNoteItem::SetData(wchar_t *title, wchar_t *from, wchar_t *text, wchar_t *t m_szFrom = StrTrimCopy(from);
const wchar_t *szTags = tags;
- wchar_t *p = m_szTags = (wchar_t *)mir_alloc((mir_tstrlen(szTags) + 2 /*for double zero*/) * sizeof(wchar_t));
- wchar_t *q = m_szTagsStr = (wchar_t *)mir_alloc((mir_tstrlen(szTags) + 1) * sizeof(wchar_t));
+ wchar_t *p = m_szTags = (wchar_t *)mir_alloc((mir_wstrlen(szTags) + 2 /*for double zero*/) * sizeof(wchar_t));
+ wchar_t *q = m_szTagsStr = (wchar_t *)mir_alloc((mir_wstrlen(szTags) + 1) * sizeof(wchar_t));
for (; szTags && *szTags; ++szTags) {
if (iswspace(*szTags))
continue;
@@ -108,8 +108,8 @@ bool CNoteItem::HasTag(const wchar_t *szTag) if (!szTag || !*szTag)
return true;
- for (wchar_t *p = m_szTags; p && *p; p = p + mir_tstrlen(p) + 1)
- if (!mir_tstrcmp(p, szTag))
+ for (wchar_t *p = m_szTags; p && *p; p = p + mir_wstrlen(p) + 1)
+ if (!mir_wstrcmp(p, szTag))
return true;
return false;
@@ -118,9 +118,9 @@ bool CNoteItem::HasTag(const wchar_t *szTag) int CNoteItem::cmp(const CNoteItem *p1, const CNoteItem *p2)
{
int ret = 0;
- if (ret = mir_tstrcmp(p1->m_szTitle, p2->m_szTitle)) return ret;
- if (ret = mir_tstrcmp(p1->m_szText, p2->m_szText)) return ret;
- if (ret = mir_tstrcmp(p1->m_szTagsStr, p2->m_szTagsStr)) return ret;
+ if (ret = mir_wstrcmp(p1->m_szTitle, p2->m_szTitle)) return ret;
+ if (ret = mir_wstrcmp(p1->m_szText, p2->m_szText)) return ret;
+ if (ret = mir_wstrcmp(p1->m_szTagsStr, p2->m_szTagsStr)) return ret;
if (p1 < p2) return -1;
if (p1 > p2) return 1;
return 0;
@@ -190,7 +190,7 @@ private: wchar_t *szTitle = m_txtTitle.GetText();
wchar_t *szText = m_txtText.GetText();
wchar_t *szTags = m_txtTags.GetText();
- wchar_t *szFrom = mir_tstrdup(m_pNote->GetFrom());
+ wchar_t *szFrom = mir_wstrdup(m_pNote->GetFrom());
m_pNote->SetData(szTitle, szFrom, szText, szTags);
mir_free(szTitle);
mir_free(szText);
@@ -375,7 +375,7 @@ public: SelectObject(hdc, m_hfntNormal);
if (pNote->GetFrom()) {
wchar_t buf[256];
- mir_sntprintf(buf, TranslateT("From: %s"), pNote->GetFrom());
+ mir_snwprintf(buf, TranslateT("From: %s"), pNote->GetFrom());
rc.top += DrawText(hdc, buf, -1, &rc, DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
}
rc.top += DrawText(hdc, pNote->GetText(), -1, &rc, DT_NOPREFIX | DT_WORDBREAK | DT_EXPANDTABS | DT_END_ELLIPSIS);
@@ -410,7 +410,7 @@ public: SelectObject(hdc, m_hfntNormal);
if (pNote->GetFrom()) {
wchar_t buf[256];
- mir_sntprintf(buf, TranslateT("From: %s"), pNote->GetFrom());
+ mir_snwprintf(buf, TranslateT("From: %s"), pNote->GetFrom());
rcTmp = rc;
DrawText(hdc, buf, -1, &rcTmp, DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS | DT_CALCRECT);
lps->itemHeight += rcTmp.bottom;
@@ -473,7 +473,7 @@ private: tvi.hInsertAfter = TVI_LAST;
tvi.itemex.mask = TVIF_TEXT | TVIF_PARAM;
tvi.itemex.pszText = (wchar_t *)tag;
- tvi.itemex.lParam = (LPARAM)mir_tstrdup(tag);
+ tvi.itemex.lParam = (LPARAM)mir_wstrdup(tag);
HTREEITEM hti = m_tvFilter.InsertItem(&tvi);
if (bSelect) m_tvFilter.SelectItem(hti);
}
@@ -483,14 +483,14 @@ private: LIST<wchar_t> tagSet(5, wcscmp);
for (int i = 0; i < m_proto->m_notes.getCount(); i++) {
wchar_t *tags = m_proto->m_notes[i].GetTags();
- for (wchar_t *tag = tags; tag && *tag; tag = tag + mir_tstrlen(tag) + 1)
+ for (wchar_t *tag = tags; tag && *tag; tag = tag + mir_wstrlen(tag) + 1)
if (!tagSet.find(tag))
tagSet.insert(tag);
}
bool selected = false;
for (int j = 0; j < tagSet.getCount(); ++j) {
- bool select = !mir_tstrcmp(szActiveTag, tagSet[j]);
+ bool select = !mir_wstrcmp(szActiveTag, tagSet[j]);
selected |= select;
InsertTag(htiRoot, tagSet[j], select);
}
@@ -505,7 +505,7 @@ private: tvi.mask = TVIF_HANDLE | TVIF_PARAM;
tvi.hItem = m_tvFilter.GetSelection();
m_tvFilter.GetItem(&tvi);
- wchar_t *szActiveTag = mir_tstrdup((wchar_t *)tvi.lParam);
+ wchar_t *szActiveTag = mir_wstrdup((wchar_t *)tvi.lParam);
m_tvFilter.DeleteAllItems();
@@ -727,7 +727,7 @@ void CJabberProto::ProcessOutgoingNote(CNoteItem *pNote, bool ok) }
wchar_t buf[1024];
- mir_sntprintf(buf, L"Incoming note: %s\n\n%s\nTags: %s",
+ mir_snwprintf(buf, L"Incoming note: %s\n\n%s\nTags: %s",
pNote->GetTitle(), pNote->GetText(), pNote->GetTagsStr());
JabberCapsBits jcb = GetResourceCapabilites(pNote->GetFrom(), TRUE);
@@ -815,7 +815,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleNotes(WPARAM, LPARAM) INT_PTR __cdecl CJabberProto::OnMenuSendNote(WPARAM wParam, LPARAM)
{
if (wParam) {
- CNoteItem *pItem = new CNoteItem(NULL, ptrT(getTStringA(wParam, "jid")));
+ CNoteItem *pItem = new CNoteItem(NULL, ptrW(getTStringA(wParam, "jid")));
CJabberDlgBase *pDlg = new CJabberDlgNoteItem(this, pItem, &CJabberProto::ProcessOutgoingNote);
pDlg->Show();
}
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index 828b0a9648..66fb8e5e49 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -243,7 +243,7 @@ protected: void OnInitDialog()
{
wchar_t text[256];
- mir_sntprintf(text, STR_FORMAT, TranslateT("Register"), m_regInfo->username, m_regInfo->server, m_regInfo->port);
+ mir_snwprintf(text, STR_FORMAT, TranslateT("Register"), m_regInfo->username, m_regInfo->server, m_regInfo->port);
SetDlgItemText(m_hwnd, IDC_REG_STATUS, text);
}
@@ -331,7 +331,7 @@ CCtrlEditJid::CCtrlEditJid(CDlgBase* dlg, int ctrlId): static void sttStoreJidFromUI(CJabberProto *ppro, CCtrlEdit &txtUsername, CCtrlCombo &cbServer)
{
- ppro->setTString("jid", CMString(FORMAT, L"%s@%s", ptrT(txtUsername.GetText()), ptrT(cbServer.GetText())));
+ ppro->setTString("jid", CMString(FORMAT, L"%s@%s", ptrW(txtUsername.GetText()), ptrW(cbServer.GetText())));
}
class CDlgOptAccount : public CJabberDlgBase
@@ -444,7 +444,7 @@ protected: if (GetComputerName(szCompName, &dwCompNameLength))
m_cbResource.AddString(szCompName);
- ptrT tszResource(m_proto->getTStringA("Resource"));
+ ptrW tszResource(m_proto->getTStringA("Resource"));
if (tszResource != NULL) {
if (CB_ERR == m_cbResource.FindString(tszResource, -1, true))
m_cbResource.AddString(tszResource);
@@ -454,7 +454,7 @@ protected: for (int i = 0; g_LanguageCodes[i].szCode; i++) {
int iItem = m_cbLocale.AddString(TranslateTS(g_LanguageCodes[i].szDescription), (LPARAM)g_LanguageCodes[i].szCode);
- if (!mir_tstrcmp(m_proto->m_tszSelectedLang, g_LanguageCodes[i].szCode))
+ if (!mir_wstrcmp(m_proto->m_tszSelectedLang, g_LanguageCodes[i].szCode))
m_cbLocale.SetCurSel(iItem);
}
@@ -483,7 +483,7 @@ protected: m_proto->m_savedPassword = NULL;
if (m_chkSavePassword.GetState() == BST_CHECKED)
- m_proto->setTString("Password", ptrT(m_txtPassword.GetText()));
+ m_proto->setTString("Password", ptrW(m_txtPassword.GetText()));
else
m_proto->delSetting("Password");
@@ -494,7 +494,7 @@ protected: m_proto->setTString("XmlLang", szLanguageCode);
mir_free(m_proto->m_tszSelectedLang);
- m_proto->m_tszSelectedLang = mir_tstrdup(szLanguageCode);
+ m_proto->m_tszSelectedLang = mir_wstrdup(szLanguageCode);
}
}
@@ -697,7 +697,7 @@ private: if (!n)
break;
- if (!mir_tstrcmp(XmlGetName(n), L"item"))
+ if (!mir_wstrcmp(XmlGetName(n), L"item"))
if (const wchar_t *jid = XmlGetAttrValue(n, L"jid"))
if (m_cbServer.FindString(jid, -1, true) == CB_ERR)
m_cbServer.AddString(jid);
@@ -729,7 +729,7 @@ private: NETLIBHTTPREQUEST *result = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)wnd->GetProto()->m_hNetlibUser, (LPARAM)&request);
if (result) {
if (result->resultCode == 200 && result->dataLength && result->pData) {
- wchar_t *buf = mir_a2t(result->pData);
+ wchar_t *buf = mir_a2u(result->pData);
XmlNode node(buf, NULL, NULL);
if (node) {
HXML queryNode = XmlGetChild(node, L"query");
@@ -1016,7 +1016,7 @@ void CJabberProto::_RosterHandleGetRequest(HXML node, CJabberIqInfo*) // now it is require to process whole contact list to add not in roster contacts
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
- ptrT tszJid(getTStringA(hContact, "jid"));
+ ptrW tszJid(getTStringA(hContact, "jid"));
if (tszJid == NULL)
continue;
@@ -1029,8 +1029,8 @@ void CJabberProto::_RosterHandleGetRequest(HXML node, CJabberIqInfo*) if (p) *p = 0;
}
if (ListView_FindItem(hList, -1, &lvfi) == -1) {
- ptrT tszName(db_get_tsa(hContact, "CList", "MyHandle"));
- ptrT tszGroup(db_get_tsa(hContact, "CList", "Group"));
+ ptrW tszName(db_get_tsa(hContact, "CList", "MyHandle"));
+ ptrW tszGroup(db_get_tsa(hContact, "CList", "Group"));
_RosterInsertListItem(hList, tszJid, tszName, tszGroup, NULL, FALSE);
}
}
@@ -1074,24 +1074,24 @@ void CJabberProto::_RosterHandleGetRequest(HXML node, CJabberIqInfo*) BOOL bPushed = itemRoster ? TRUE : FALSE;
if (!bPushed) {
const wchar_t *rosterName = XmlGetAttrValue(itemRoster, L"name");
- if ((rosterName != NULL || name[0] != 0) && mir_tstrcmpi(rosterName, name))
+ if ((rosterName != NULL || name[0] != 0) && mir_wstrcmpi(rosterName, name))
bPushed = TRUE;
if (!bPushed) {
rosterName = XmlGetAttrValue(itemRoster, L"subscription");
- if ((rosterName != NULL || subscr[0] != 0) && mir_tstrcmpi(rosterName, subscr))
+ if ((rosterName != NULL || subscr[0] != 0) && mir_wstrcmpi(rosterName, subscr))
bPushed = TRUE;
}
if (!bPushed) {
const wchar_t *rosterGroup = XmlGetText(XmlGetChild(itemRoster, "group"));
- if ((rosterGroup != NULL || group[0] != 0) && mir_tstrcmpi(rosterGroup, group))
+ if ((rosterGroup != NULL || group[0] != 0) && mir_wstrcmpi(rosterGroup, group))
bPushed = TRUE;
}
}
if (bPushed) {
HXML item = query << XCHILD(L"item");
- if (mir_tstrlen(group))
+ if (mir_wstrlen(group))
item << XCHILD(L"group", group);
- if (mir_tstrlen(name))
+ if (mir_wstrlen(name))
item << XATTR(L"name", name);
item << XATTR(L"jid", jid) << XATTR(L"subscription", subscr[0] ? subscr : L"none");
itemCount++;
@@ -1179,7 +1179,7 @@ void CJabberProto::_RosterExportToFile(HWND hwndDlg) wchar_t filename[MAX_PATH] = { 0 };
wchar_t filter[MAX_PATH];
- mir_sntprintf(filter, L"%s (*.xml)%c*.xml%c%c", TranslateT("XML for MS Excel (UTF-8 encoded)"), 0, 0, 0);
+ mir_snwprintf(filter, L"%s (*.xml)%c*.xml%c%c", TranslateT("XML for MS Excel (UTF-8 encoded)"), 0, 0, 0);
OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
@@ -1268,7 +1268,7 @@ void CJabberProto::_RosterImportFromFile(HWND hwndDlg) fclose(fp);
_RosterListClear(hwndDlg);
- wchar_t *newBuf = mir_utf8decodeT(buffer);
+ wchar_t *newBuf = mir_utf8decodeW(buffer);
mir_free(buffer);
int nBytesProcessed = 0;
@@ -1295,15 +1295,15 @@ void CJabberProto::_RosterImportFromFile(HWND hwndDlg) HXML Cell = XmlGetNthChild(Row, L"Cell", 1);
HXML Data = (Cell) ? XmlGetChild(Cell, "Data") : XmlNode();
if (Data) {
- if (!mir_tstrcmpi(XmlGetText(Data), L"+")) bAdd = TRUE;
- else if (mir_tstrcmpi(XmlGetText(Data), L"-")) continue;
+ if (!mir_wstrcmpi(XmlGetText(Data), L"+")) bAdd = TRUE;
+ else if (mir_wstrcmpi(XmlGetText(Data), L"-")) continue;
Cell = XmlGetNthChild(Row, L"Cell", 2);
if (Cell) Data = XmlGetChild(Cell, "Data");
else Data = NULL;
if (Data) {
jid = XmlGetText(Data);
- if (!jid || mir_tstrlen(jid) == 0) continue;
+ if (!jid || mir_wstrlen(jid) == 0) continue;
}
Cell = XmlGetNthChild(Row, L"Cell", 3);
@@ -1588,7 +1588,7 @@ protected: if (GetComputerName(szCompName, &dwCompNameLength))
m_cbResource.AddString(szCompName);
- ptrT tszResource(m_proto->getTStringA("Resource"));
+ ptrW tszResource(m_proto->getTStringA("Resource"));
if (tszResource != NULL) {
if (CB_ERR == m_cbResource.FindString(tszResource, -1, true))
m_cbResource.AddString(tszResource);
@@ -1666,7 +1666,7 @@ protected: m_txtManualHost.Enable();
m_txtPort.Enable();
- ptrT dbManualHost(m_proto->getTStringA("ManualHost"));
+ ptrW dbManualHost(m_proto->getTStringA("ManualHost"));
if (dbManualHost != NULL)
m_txtManualHost.SetText(dbManualHost);
@@ -1708,7 +1708,7 @@ protected: DWORD dwCompNameLength = MAX_COMPUTERNAME_LENGTH;
if (GetComputerName(szCompName, &dwCompNameLength)) {
m_cbResource.GetText(szResource, _countof(szResource));
- if (!mir_tstrcmp(szCompName, szResource))
+ if (!mir_wstrcmp(szCompName, szResource))
bUseHostnameAsResource = TRUE;
}
m_proto->m_options.HostNameAsResource = bUseHostnameAsResource;
@@ -2171,7 +2171,7 @@ void CJabberDlgAccMgrUI::RefreshServers(HXML node) if (!n)
break;
- if (!mir_tstrcmp(XmlGetName(n), L"item"))
+ if (!mir_wstrcmp(XmlGetName(n), L"item"))
if (const wchar_t *jid = XmlGetAttrValue(n, L"jid"))
if (m_cbServer.FindString(jid, -1, true) == CB_ERR)
m_cbServer.AddString(jid);
@@ -2199,7 +2199,7 @@ void CJabberDlgAccMgrUI::QueryServerListThread(void *arg) NETLIBHTTPREQUEST *result = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)wnd->GetProto()->m_hNetlibUser, (LPARAM)&request);
if (result && IsWindow(hwnd)) {
if ((result->resultCode == 200) && result->dataLength && result->pData) {
- wchar_t *ptszText = mir_a2t(result->pData);
+ wchar_t *ptszText = mir_a2u(result->pData);
XmlNode node(ptszText, NULL, NULL);
if (node) {
HXML queryNode = XmlGetChild(node, L"query");
@@ -2236,7 +2236,7 @@ INT_PTR __cdecl CJabberProto::OnMenuOptions(WPARAM, LPARAM) OPENOPTIONSDIALOG ood = { 0 };
ood.cbSize = sizeof(ood);
ood.pszGroup = "Network";
- ood.pszPage = mir_t2a(m_tszUserName);
+ ood.pszPage = mir_u2a(m_tszUserName);
ood.pszTab = "Account";
Options_Open(&ood);
@@ -2258,7 +2258,7 @@ int CJabberProto::OnModernOptInit(WPARAM, LPARAM) obj.hInstance = hInst;
obj.iSection = MODERNOPT_PAGE_ACCOUNTS;
obj.iType = MODERNOPT_TYPE_SUBSECTIONPAGE;
- obj.lptzSubsection = mir_a2t(m_szModuleName); // title!!!!!!!!!!!
+ obj.lptzSubsection = mir_a2u(m_szModuleName); // title!!!!!!!!!!!
obj.lpzTemplate = MAKEINTRESOURCEA(IDD_MODERNOPT);
obj.iBoldControls = iBoldControls;
obj.pfnDlgProc = JabberWizardDlgProc;
diff --git a/protocols/JabberG/src/jabber_opttree.cpp b/protocols/JabberG/src/jabber_opttree.cpp index e1b800afa2..97566fa22c 100644 --- a/protocols/JabberG/src/jabber_opttree.cpp +++ b/protocols/JabberG/src/jabber_opttree.cpp @@ -112,7 +112,7 @@ void CCtrlTreeOpts::OnInit() int sectionLevel = 0;
HTREEITEM hSection = NULL;
- mir_tstrcpy(itemName, m_options[i]->m_szOptionName);
+ mir_wstrcpy(itemName, m_options[i]->m_szOptionName);
sectionName = itemName;
while (sectionName) {
@@ -228,7 +228,7 @@ void CCtrlTreeOpts::ProcessItemClick(HTREEITEM hti) CCtrlTreeOpts::COptionsItem::COptionsItem(wchar_t *szOption, CMOption<BYTE> &option) :
m_option(&option), m_groupId(OPTTREE_CHECK), m_hItem(NULL)
{
- m_szOptionName = mir_tstrdup(szOption);
+ m_szOptionName = mir_wstrdup(szOption);
}
CCtrlTreeOpts::COptionsItem::~COptionsItem()
diff --git a/protocols/JabberG/src/jabber_password.cpp b/protocols/JabberG/src/jabber_password.cpp index 54d1b74bdd..456c9e5d5b 100644 --- a/protocols/JabberG/src/jabber_password.cpp +++ b/protocols/JabberG/src/jabber_password.cpp @@ -50,7 +50,7 @@ static INT_PTR CALLBACK JabberChangePasswordDlgProc(HWND hwndDlg, UINT msg, WPAR TranslateDialogDefault(hwndDlg);
if (ppro->m_bJabberOnline && ppro->m_ThreadInfo != NULL) {
wchar_t text[1024];
- mir_sntprintf(text, TranslateT("Set New Password for %s@%S"), ppro->m_ThreadInfo->conn.username, ppro->m_ThreadInfo->conn.server);
+ mir_snwprintf(text, TranslateT("Set New Password for %s@%S"), ppro->m_ThreadInfo->conn.username, ppro->m_ThreadInfo->conn.server);
SetWindowText(hwndDlg, text);
}
return TRUE;
@@ -61,16 +61,16 @@ static INT_PTR CALLBACK JabberChangePasswordDlgProc(HWND hwndDlg, UINT msg, WPAR wchar_t newPasswd[512], text[512];
GetDlgItemText(hwndDlg, IDC_NEWPASSWD, newPasswd, _countof(newPasswd));
GetDlgItemText(hwndDlg, IDC_NEWPASSWD2, text, _countof(text));
- if (mir_tstrcmp(newPasswd, text)) {
+ if (mir_wstrcmp(newPasswd, text)) {
MessageBox(hwndDlg, TranslateT("New password does not match."), TranslateT("Change Password"), MB_OK|MB_ICONSTOP|MB_SETFOREGROUND);
break;
}
GetDlgItemText(hwndDlg, IDC_OLDPASSWD, text, _countof(text));
- if (mir_tstrcmp(text, ppro->m_ThreadInfo->conn.password)) {
+ if (mir_wstrcmp(text, ppro->m_ThreadInfo->conn.password)) {
MessageBox(hwndDlg, TranslateT("Current password is incorrect."), TranslateT("Change Password"), MB_OK|MB_ICONSTOP|MB_SETFOREGROUND);
break;
}
- ppro->m_ThreadInfo->tszNewPassword = mir_tstrdup(newPasswd);
+ ppro->m_ThreadInfo->tszNewPassword = mir_wstrdup(newPasswd);
XmlNodeIq iq(ppro->AddIQ(&CJabberProto::OnIqResultSetPassword, JABBER_IQ_TYPE_SET, _A2T(ppro->m_ThreadInfo->conn.server)));
HXML q = iq << XQUERY(JABBER_FEAT_REGISTER);
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index ba3df4a5b0..8e9e009d1d 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -58,9 +58,9 @@ void CJabberProto::OnIqResultPrivacyListModify(HXML, CJabberIqInfo *pInfo) if (!pParam->m_dwCount) {
wchar_t szText[ 512 ];
if (!pParam->m_bAllOk)
- mir_sntprintf(szText, TranslateT("Error occurred while applying changes"));
+ mir_snwprintf(szText, TranslateT("Error occurred while applying changes"));
else
- mir_sntprintf(szText, TranslateT("Privacy lists successfully saved"));
+ mir_snwprintf(szText, TranslateT("Privacy lists successfully saved"));
if (m_pDlgPrivacyLists)
m_pDlgPrivacyLists->SetStatusText(szText);
// FIXME: enable apply button
@@ -77,7 +77,7 @@ void CJabberProto::OnIqResultPrivacyList(HXML iqNode, CJabberIqInfo*) if (type == NULL)
return;
- if ( mir_tstrcmp(type, L"result"))
+ if ( mir_wstrcmp(type, L"result"))
return;
HXML query = XmlGetChild(iqNode , "query");
@@ -104,11 +104,11 @@ void CJabberProto::OnIqResultPrivacyList(HXML iqNode, CJabberIqInfo*) const wchar_t *itemType = XmlGetAttrValue(item, L"type");
PrivacyListRuleType nItemType = Else;
if (itemType) {
- if (!mir_tstrcmpi(itemType, L"jid"))
+ if (!mir_wstrcmpi(itemType, L"jid"))
nItemType = Jid;
- else if (!mir_tstrcmpi(itemType, L"group"))
+ else if (!mir_wstrcmpi(itemType, L"group"))
nItemType = Group;
- else if (!mir_tstrcmpi(itemType, L"subscription"))
+ else if (!mir_wstrcmpi(itemType, L"subscription"))
nItemType = Subscription;
}
@@ -116,7 +116,7 @@ void CJabberProto::OnIqResultPrivacyList(HXML iqNode, CJabberIqInfo*) const wchar_t *itemAction = XmlGetAttrValue(item, L"action");
BOOL bAllow = TRUE;
- if (itemAction && !mir_tstrcmpi(itemAction, L"deny"))
+ if (itemAction && !mir_wstrcmpi(itemAction, L"deny"))
bAllow = FALSE;
const wchar_t *itemOrder = XmlGetAttrValue(item, L"order");
@@ -185,7 +185,7 @@ void CJabberProto::OnIqResultPrivacyListActive(HXML iqNode, CJabberIqInfo *pInfo CMString szText;
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
mir_cslock lck(m_privacyListManager.m_cs);
if (pList) {
m_privacyListManager.SetActiveListName(pList->GetListName());
@@ -222,18 +222,18 @@ void CJabberProto::OnIqResultPrivacyListDefault(HXML iqNode, CJabberIqInfo *pInf szText[0] = 0;
{
mir_cslock lck(m_privacyListManager.m_cs);
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
CPrivacyList *pList = (CPrivacyList *)pInfo->GetUserData();
if (pList) {
m_privacyListManager.SetDefaultListName(pList->GetListName());
- mir_sntprintf(szText, TranslateT("Privacy list %s set as default"), pList->GetListName());
+ mir_snwprintf(szText, TranslateT("Privacy list %s set as default"), pList->GetListName());
}
else {
m_privacyListManager.SetDefaultListName(NULL);
- mir_sntprintf(szText, TranslateT("Default privacy list successfully declined"));
+ mir_snwprintf(szText, TranslateT("Default privacy list successfully declined"));
}
}
- else mir_sntprintf(szText, TranslateT("Error occurred while setting default list"));
+ else mir_snwprintf(szText, TranslateT("Error occurred while setting default list"));
}
if (m_pDlgPrivacyLists) {
@@ -423,7 +423,7 @@ public: SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUES, CB_RESETCONTENT, 0, 0);
{
for (MCONTACT hContact = db_find_first(m_proto->m_szModuleName); hContact; hContact = db_find_next(hContact, m_proto->m_szModuleName)) {
- ptrT jid( m_proto->getTStringA(hContact, "jid"));
+ ptrW jid( m_proto->getTStringA(hContact, "jid"));
if (jid != NULL)
SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUES, CB_ADDSTRING, 0, jid);
}
@@ -633,7 +633,7 @@ protected: HANDLE hItem;
wchar_t *jid;
- static int cmp(const TJidData *p1, const TJidData *p2) { return mir_tstrcmp(p1->jid, p2->jid); }
+ static int cmp(const TJidData *p1, const TJidData *p2) { return mir_wstrcmp(p1->jid, p2->jid); }
};
HANDLE hItemDefault;
@@ -661,7 +661,7 @@ protected: {
TJidData *data = (TJidData *)mir_alloc(sizeof(TJidData));
data->hItem = hItem;
- data->jid = mir_tstrdup(jid);
+ data->jid = mir_wstrdup(jid);
newJids.insert(data);
}
@@ -949,7 +949,7 @@ BOOL CJabberDlgPrivacyLists::OnWmDrawItem(UINT, WPARAM, LPARAM lParam) for (i=0; i < _countof(drawItems); i++) {
SIZE sz = {0};
drawItems[i].text = TranslateTS(drawItems[i].textEng);
- GetTextExtentPoint32(lpdis->hDC, drawItems[i].text, (int)mir_tstrlen(drawItems[i].text), &sz);
+ GetTextExtentPoint32(lpdis->hDC, drawItems[i].text, (int)mir_wstrlen(drawItems[i].text), &sz);
totalWidth += sz.cx + 18 + 5; // 18 pixels for icon, 5 pixel spacing
}
@@ -991,16 +991,16 @@ void CJabberDlgPrivacyLists::ShowAdvancedList(CPrivacyList *pList) wchar_t szTypeValue[ 512 ];
switch (pRule->GetType()) {
case Jid:
- mir_sntprintf(szTypeValue, L"If Jabber ID is '%s' then", pRule->GetValue());
+ mir_snwprintf(szTypeValue, L"If Jabber ID is '%s' then", pRule->GetValue());
break;
case Group:
- mir_sntprintf(szTypeValue, L"If group is '%s' then", pRule->GetValue());
+ mir_snwprintf(szTypeValue, L"If group is '%s' then", pRule->GetValue());
break;
case Subscription:
- mir_sntprintf(szTypeValue, L"If subscription is '%s' then", pRule->GetValue());
+ mir_snwprintf(szTypeValue, L"If subscription is '%s' then", pRule->GetValue());
break;
case Else:
- mir_sntprintf(szTypeValue, L"Else");
+ mir_snwprintf(szTypeValue, L"Else");
break;
}
@@ -1011,29 +1011,29 @@ void CJabberDlgPrivacyLists::ShowAdvancedList(CPrivacyList *pList) if (!dwPackets)
dwPackets = JABBER_PL_RULE_TYPE_ALL;
if (dwPackets == JABBER_PL_RULE_TYPE_ALL)
- mir_tstrcpy(szPackets, L"all");
+ mir_wstrcpy(szPackets, L"all");
else {
if (dwPackets & JABBER_PL_RULE_TYPE_MESSAGE)
- mir_tstrcat(szPackets, L"messages");
+ mir_wstrcat(szPackets, L"messages");
if (dwPackets & JABBER_PL_RULE_TYPE_PRESENCE_IN) {
- if (mir_tstrlen(szPackets))
- mir_tstrcat(szPackets, L", ");
- mir_tstrcat(szPackets, L"presence-in");
+ if (mir_wstrlen(szPackets))
+ mir_wstrcat(szPackets, L", ");
+ mir_wstrcat(szPackets, L"presence-in");
}
if (dwPackets & JABBER_PL_RULE_TYPE_PRESENCE_OUT) {
- if (mir_tstrlen(szPackets))
- mir_tstrcat(szPackets, L", ");
- mir_tstrcat(szPackets, L"presence-out");
+ if (mir_wstrlen(szPackets))
+ mir_wstrcat(szPackets, L", ");
+ mir_wstrcat(szPackets, L"presence-out");
}
if (dwPackets & JABBER_PL_RULE_TYPE_IQ) {
- if (mir_tstrlen(szPackets))
- mir_tstrcat(szPackets, L", ");
- mir_tstrcat(szPackets, L"queries");
+ if (mir_wstrlen(szPackets))
+ mir_wstrcat(szPackets, L", ");
+ mir_wstrcat(szPackets, L"queries");
}
}
wchar_t szListItem[ 512 ];
- mir_sntprintf(szListItem, L"%s %s %s", szTypeValue, pRule->GetAction() ? L"allow" : L"deny", szPackets);
+ mir_snwprintf(szListItem, L"%s %s %s", szTypeValue, pRule->GetAction() ? L"allow" : L"deny", szPackets);
LRESULT nItemId = SendDlgItemMessage(m_hwnd, IDC_PL_RULES_LIST, LB_ADDSTRING, 0, (LPARAM)szListItem);
SendDlgItemMessage(m_hwnd, IDC_PL_RULES_LIST, LB_SETITEMDATA, nItemId, (LPARAM)pRule);
@@ -1056,7 +1056,7 @@ void CJabberDlgPrivacyLists::DrawNextRulePart(HDC hdc, COLORREF color, const wch 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;
}
@@ -1248,8 +1248,8 @@ void CJabberDlgPrivacyLists::DrawLists(LPDRAWITEMSTRUCT lpdis) szName = TranslateT("<none>");
}
else {
- if (!mir_tstrcmp(pList->GetListName(), szActive)) bActive = true;
- if (!mir_tstrcmp(pList->GetListName(), szDefault)) bDefault = true;
+ if (!mir_wstrcmp(pList->GetListName(), szActive)) bActive = true;
+ if (!mir_wstrcmp(pList->GetListName(), szDefault)) bDefault = true;
szName = pList->GetListName();
}
@@ -1385,10 +1385,10 @@ void CJabberDlgPrivacyLists::CListApplyList(HWND hwndList, CPrivacyList *pList) break;
case Subscription:
- if (!mir_tstrcmp(pRule->GetValue(), L"none")) hItem = clc_info.hItemSubNone;
- else if (!mir_tstrcmp(pRule->GetValue(), L"from")) hItem = clc_info.hItemSubFrom;
- else if (!mir_tstrcmp(pRule->GetValue(), L"to")) hItem = clc_info.hItemSubTo;
- else if (!mir_tstrcmp(pRule->GetValue(), L"both")) hItem = clc_info.hItemSubBoth;
+ if (!mir_wstrcmp(pRule->GetValue(), L"none")) hItem = clc_info.hItemSubNone;
+ else if (!mir_wstrcmp(pRule->GetValue(), L"from")) hItem = clc_info.hItemSubFrom;
+ else if (!mir_wstrcmp(pRule->GetValue(), L"to")) hItem = clc_info.hItemSubTo;
+ else if (!mir_wstrcmp(pRule->GetValue(), L"both")) hItem = clc_info.hItemSubBoth;
break;
case Else:
@@ -1462,7 +1462,7 @@ void CJabberDlgPrivacyLists::CListBuildList(HWND hwndList, CPrivacyList *pList) for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
hItem = m_clcClist.FindContact(hContact);
- ptrT jid( m_proto->getTStringA(hContact, "jid"));
+ ptrW jid( m_proto->getTStringA(hContact, "jid"));
if (jid == NULL)
if ((jid = m_proto->getTStringA(hContact, "ChatRoomID")) == NULL)
continue;
@@ -1837,7 +1837,7 @@ void CJabberDlgPrivacyLists::btnAddList_OnClick(CCtrlButton*) // FIXME: line length is hard coded in dialog procedure
CJabberDlgPrivacyAddList dlgPrivacyAddList(m_proto, m_hwnd);
int nRetVal = dlgPrivacyAddList.DoModal();
- if (nRetVal && mir_tstrlen(dlgPrivacyAddList.szLine)) {
+ if (nRetVal && mir_wstrlen(dlgPrivacyAddList.szLine)) {
mir_cslockfull lck(m_proto->m_privacyListManager.m_cs);
CPrivacyList *pList = m_proto->m_privacyListManager.FindList(dlgPrivacyAddList.szLine);
@@ -1870,8 +1870,8 @@ void CJabberDlgPrivacyLists::btnRemoveList_OnClick(CCtrlButton *) CPrivacyList *pList = GetSelectedList(m_hwnd);
if (pList) {
wchar_t *szListName = pList->GetListName();
- if ((m_proto->m_privacyListManager.GetActiveListName() && !mir_tstrcmp(szListName, m_proto->m_privacyListManager.GetActiveListName())) ||
- (m_proto->m_privacyListManager.GetDefaultListName() && !mir_tstrcmp(szListName, m_proto->m_privacyListManager.GetDefaultListName())))
+ if ((m_proto->m_privacyListManager.GetActiveListName() && !mir_wstrcmp(szListName, m_proto->m_privacyListManager.GetActiveListName())) ||
+ (m_proto->m_privacyListManager.GetDefaultListName() && !mir_wstrcmp(szListName, m_proto->m_privacyListManager.GetDefaultListName())))
{
lck.unlock();
MessageBox(m_hwnd, TranslateT("Can't remove active or default list"), TranslateT("Sorry"), MB_OK | MB_ICONSTOP);
@@ -2148,7 +2148,7 @@ void CJabberProto::BuildPrivacyListsMenu(bool bDeleteOld) mi.position++;
mi.hIcolibItem = Skin_GetIconHandle(
- mir_tstrcmp(m_privacyListManager.GetActiveListName(), pList->GetListName()) ? SKINICON_OTHER_SMALLDOT : SKINICON_OTHER_EMPTYBLOB);
+ mir_wstrcmp(m_privacyListManager.GetActiveListName(), pList->GetListName()) ? SKINICON_OTHER_SMALLDOT : SKINICON_OTHER_EMPTYBLOB);
mi.name.w = pList->GetListName();
m_hPrivacyMenuItems.insert(Menu_AddProtoMenuItem(&mi, m_szModuleName));
}
diff --git a/protocols/JabberG/src/jabber_privacy.h b/protocols/JabberG/src/jabber_privacy.h index 67b8ce7e33..fc04a1d96f 100644 --- a/protocols/JabberG/src/jabber_privacy.h +++ b/protocols/JabberG/src/jabber_privacy.h @@ -61,7 +61,7 @@ public: CPrivacyListRule(CJabberProto *ppro, PrivacyListRuleType type = Else, const wchar_t *szValue = L"", BOOL bAction = TRUE, DWORD dwOrder = 90, DWORD dwPackets = 0)
{
m_proto = ppro;
- m_szValue = mir_tstrdup(szValue);
+ m_szValue = mir_wstrdup(szValue);
m_nType = type;
m_bAction = bAction;
m_dwOrder = dwOrder;
@@ -109,7 +109,7 @@ public: }
__inline BOOL SetValue(wchar_t *szValue)
{
- replaceStrT(m_szValue, szValue);
+ replaceStrW(m_szValue, szValue);
return TRUE;
}
__inline DWORD GetPackets()
@@ -156,7 +156,7 @@ public: CPrivacyList(CJabberProto *ppro, wchar_t *szListName)
{
m_proto = ppro;
- m_szListName = mir_tstrdup(szListName);
+ m_szListName = mir_wstrdup(szListName);
m_pRules = NULL;
m_pNext = NULL;
m_bLoaded = FALSE;
@@ -344,11 +344,11 @@ public: };
void SetActiveListName(const wchar_t *szListName)
{
- replaceStrT(m_szActiveListName, szListName);
+ replaceStrW(m_szActiveListName, szListName);
}
void SetDefaultListName(const wchar_t *szListName)
{
- replaceStrT(m_szDefaultListName, szListName);
+ replaceStrW(m_szDefaultListName, szListName);
}
wchar_t* GetDefaultListName()
{
@@ -369,7 +369,7 @@ public: {
CPrivacyList *pList = m_pLists;
while (pList) {
- if (!mir_tstrcmp(pList->GetListName(), szListName))
+ if (!mir_wstrcmp(pList->GetListName(), szListName))
return pList;
pList = pList->GetNext();
}
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 2f847dd408..198a8231d0 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static int compareTransports(const wchar_t *p1, const wchar_t *p2)
{
- return mir_tstrcmpi(p1, p2);
+ return mir_wstrcmpi(p1, p2);
}
static int compareListItems(const JABBER_LIST_ITEM *p1, const JABBER_LIST_ITEM *p2)
@@ -44,12 +44,12 @@ static int compareListItems(const JABBER_LIST_ITEM *p1, const JABBER_LIST_ITEM * // resource must be used in the comparison
if ((p1->list == LIST_ROSTER && (p1->bUseResource == true || p2->bUseResource == true))
|| (p1->list == LIST_BOOKMARK) || (p1->list == LIST_VCARD_TEMP))
- return mir_tstrcmpi(p1->jid, p2->jid);
+ return mir_wstrcmpi(p1->jid, p2->jid);
wchar_t szp1[JABBER_MAX_JID_LEN], szp2[JABBER_MAX_JID_LEN];
JabberStripJid(p1->jid, szp1, _countof(szp1));
JabberStripJid(p2->jid, szp2, _countof(szp2));
- return mir_tstrcmpi(szp1, szp2);
+ return mir_wstrcmpi(szp1, szp2);
}
CJabberProto::CJabberProto(const char *aProtoName, const wchar_t *aUserName) :
@@ -147,7 +147,7 @@ CJabberProto::CJabberProto(const char *aProtoName, const wchar_t *aUserName) : db_set_resident(m_szModuleName, "Grant");
if ((m_tszSelectedLang = getTStringA("XmlLang")) == NULL)
- m_tszSelectedLang = mir_tstrdup(L"en");
+ m_tszSelectedLang = mir_wstrdup(L"en");
}
CJabberProto::~CJabberProto()
@@ -242,7 +242,7 @@ int CJabberProto::OnModulesLoadedEx(WPARAM, LPARAM) SetContactOfflineStatus(hContact);
if (getByte(hContact, "IsTransport", 0)) {
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid == NULL)
continue;
@@ -250,7 +250,7 @@ int CJabberProto::OnModulesLoadedEx(WPARAM, LPARAM) if (resourcepos != NULL)
*resourcepos = '\0';
- m_lstTransports.insert(mir_tstrdup(jid));
+ m_lstTransports.insert(mir_wstrdup(jid));
}
}
@@ -340,7 +340,7 @@ MCONTACT __cdecl CJabberProto::AddToListByEvent(int flags, int /*iContact*/, MEV char *lastName = firstName + mir_strlen(firstName) + 1;
char *jid = lastName + mir_strlen(lastName) + 1;
- wchar_t *newJid = (dbei.flags & DBEF_UTF) ? mir_utf8decodeT(jid) : mir_a2t(jid);
+ wchar_t *newJid = (dbei.flags & DBEF_UTF) ? mir_utf8decodeW(jid) : mir_a2u(jid);
MCONTACT hContact = (MCONTACT)AddToListByJID(newJid, flags);
mir_free(newJid);
return hContact;
@@ -373,7 +373,7 @@ int CJabberProto::Authorize(MEVENT hDbEvent) debugLog(L"Send 'authorization allowed' to %s", jid);
- wchar_t *newJid = (dbei.flags & DBEF_UTF) ? mir_utf8decodeT(jid) : mir_a2t(jid);
+ wchar_t *newJid = (dbei.flags & DBEF_UTF) ? mir_utf8decodeW(jid) : mir_a2u(jid);
m_ThreadInfo->send(XmlNode(L"presence") << XATTR(L"to", newJid) << XATTR(L"type", L"subscribed"));
@@ -429,7 +429,7 @@ int CJabberProto::AuthDeny(MEVENT hDbEvent, const wchar_t*) debugLogA("Send 'authorization denied' to %s", jid);
- ptrT newJid(dbei.flags & DBEF_UTF ? mir_utf8decodeT(jid) : mir_a2t(jid));
+ ptrW newJid(dbei.flags & DBEF_UTF ? mir_utf8decodeW(jid) : mir_a2u(jid));
m_ThreadInfo->send(XmlNode(L"presence") << XATTR(L"to", newJid) << XATTR(L"type", L"unsubscribed"));
return 0;
}
@@ -443,8 +443,8 @@ HANDLE __cdecl CJabberProto::FileAllow(MCONTACT /*hContact*/, HANDLE hTransfer, return 0;
filetransfer *ft = (filetransfer*)hTransfer;
- ft->std.tszWorkingDir = mir_tstrdup(szPath);
- size_t len = mir_tstrlen(ft->std.tszWorkingDir)-1;
+ ft->std.tszWorkingDir = mir_wstrdup(szPath);
+ size_t len = mir_wstrlen(ft->std.tszWorkingDir)-1;
if (ft->std.tszWorkingDir[len] == '/' || ft->std.tszWorkingDir[len] == '\\')
ft->std.tszWorkingDir[len] = 0;
@@ -528,7 +528,7 @@ int __cdecl CJabberProto::FileResume(HANDLE hTransfer, int *action, const wchar_ return 1;
if (*action == FILERESUME_RENAME)
- replaceStrT(ft->std.tszCurrentFile, *szFilename);
+ replaceStrW(ft->std.tszCurrentFile, *szFilename);
SetEvent(ft->hWaitEvent);
return 0;
@@ -593,10 +593,10 @@ int __cdecl CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/) item = ListGetItemPtr(LIST_ROSTER, jid);
if (item == NULL) {
- bool bHasResource = mir_tstrcmp(jid, szBareJid) != 0;
+ bool bHasResource = mir_wstrcmp(jid, szBareJid) != 0;
JABBER_LIST_ITEM *tmpItem = NULL;
if (bHasResource && (tmpItem = ListGetItemPtr(LIST_CHATROOM, szBareJid))) {
- pResourceStatus him(tmpItem->findResource(szBareJid+mir_tstrlen(szBareJid)+1));
+ pResourceStatus him(tmpItem->findResource(szBareJid+mir_wstrlen(szBareJid)+1));
if (him) {
item = ListAdd(LIST_VCARD_TEMP, jid, hContact);
ListAddResource(LIST_VCARD_TEMP, jid, him->m_iStatus, him->m_tszStatusMessage, him->m_iPriority);
@@ -610,7 +610,7 @@ int __cdecl CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/) for (int i = 0; i < item->arResources.getCount(); i++) {
pResourceStatus r(item->arResources[i]);
wchar_t tmp[JABBER_MAX_JID_LEN];
- mir_sntprintf(tmp, L"%s/%s", szBareJid, r->m_tszResourceName);
+ mir_snwprintf(tmp, L"%s/%s", szBareJid, r->m_tszResourceName);
if (r->m_jcbCachedCaps & JABBER_CAPS_DISCO_INFO) {
XmlNodeIq iq5(AddIQ(&CJabberProto::OnIqResultCapsDiscoInfoSI, JABBER_IQ_TYPE_GET, tmp, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_CHILD_TAG_NODE | JABBER_IQ_PARSE_HCONTACT));
@@ -624,7 +624,7 @@ int __cdecl CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/) m_ThreadInfo->send(iq4);
}
- if (!mir_tstrcmp(tmp, jid)) {
+ if (!mir_wstrcmp(tmp, jid)) {
XmlNodeIq iq3(AddIQ(&CJabberProto::OnIqResultLastActivity, JABBER_IQ_TYPE_GET, tmp, JABBER_IQ_PARSE_FROM));
iq3 << XQUERY(JABBER_FEAT_LAST_ACTIVITY);
m_ThreadInfo->send(iq3);
@@ -679,7 +679,7 @@ HANDLE __cdecl CJabberProto::SearchBasic(const wchar_t *szJid) return 0;
if (wcschr(szJid, '@') == NULL) {
- wchar_t *szServer = mir_a2t(m_ThreadInfo->conn.server);
+ wchar_t *szServer = mir_a2u(m_ThreadInfo->conn.server);
const wchar_t *p = wcsstr(szJid, szServer);
if (p == NULL) {
bool numericjid = true;
@@ -689,12 +689,12 @@ HANDLE __cdecl CJabberProto::SearchBasic(const wchar_t *szJid) mir_free(szServer);
szServer = getTStringA(NULL, "LoginServer");
if (szServer == NULL)
- szServer = mir_tstrdup(L"jabber.org");
- else if (numericjid && !mir_tstrcmpi(szServer, L"S.ms")) {
+ szServer = mir_wstrdup(L"jabber.org");
+ else if (numericjid && !mir_wstrcmpi(szServer, L"S.ms")) {
mir_free(szServer);
- szServer = mir_tstrdup(L"sms");
+ szServer = mir_wstrdup(L"sms");
}
- mir_sntprintf(jsb->jid, L"%s@%s", szJid, szServer);
+ mir_snwprintf(jsb->jid, L"%s@%s", szJid, szServer);
}
else wcsncpy_s(jsb->jid, szJid, _TRUNCATE);
mir_free(szServer);
@@ -802,7 +802,7 @@ int __cdecl CJabberProto::SendContacts(MCONTACT hContact, int, int nContacts, MC HXML x = m << XCHILDNS(L"x", JABBER_FEAT_ROSTER_EXCHANGE);
for (int i = 0; i < nContacts; i++) {
- ptrT jid(getTStringA(hContactsList[i], "jid"));
+ ptrW jid(getTStringA(hContactsList[i], "jid"));
if (jid != NULL)
x << XCHILD(L"item") << XATTR(L"action", L"add") << XATTR(L"jid", jid);
}
@@ -822,7 +822,7 @@ HANDLE __cdecl CJabberProto::SendFile(MCONTACT hContact, const wchar_t *szDescri if (getWord(hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE)
return 0;
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid == NULL)
return 0;
@@ -875,7 +875,7 @@ HANDLE __cdecl CJabberProto::SendFile(MCONTACT hContact, const wchar_t *szDescri if (_wstat64(ppszFiles[i], &statbuf))
debugLog(L"'%s' is an invalid filename", ppszFiles[i]);
else {
- ft->std.ptszFiles[j] = mir_tstrdup(ppszFiles[i]);
+ ft->std.ptszFiles[j] = mir_wstrdup(ppszFiles[i]);
ft->fileSize[j] = statbuf.st_size;
j++;
ft->std.totalBytes += statbuf.st_size;
@@ -886,9 +886,9 @@ HANDLE __cdecl CJabberProto::SendFile(MCONTACT hContact, const wchar_t *szDescri return NULL;
}
- ft->std.tszCurrentFile = mir_tstrdup(ppszFiles[0]);
- ft->szDescription = mir_tstrdup(szDescription);
- ft->jid = mir_tstrdup(jid);
+ ft->std.tszCurrentFile = mir_wstrdup(ppszFiles[0]);
+ ft->szDescription = mir_wstrdup(szDescription);
+ ft->jid = mir_wstrdup(jid);
if (jcb & JABBER_CAPS_SI_FT)
FtInitiate(item->jid, ft);
@@ -985,11 +985,11 @@ int __cdecl CJabberProto::SendMsg(MCONTACT hContact, int, const char* pszSrc) // if client knows nothing about delivery
!(jcb & (JABBER_CAPS_MESSAGE_EVENTS | JABBER_CAPS_MESSAGE_RECEIPTS)) ||
// if message sent to groupchat
- !mir_tstrcmp(msgType, L"groupchat") ||
+ !mir_wstrcmp(msgType, L"groupchat") ||
// if message delivery check disabled in settings
!m_options.MsgAck || !getByte(hContact, "MsgAck", TRUE))
{
- if (!mir_tstrcmp(msgType, L"groupchat"))
+ if (!mir_wstrcmp(msgType, L"groupchat"))
XmlAddAttr(m, L"to", szClientJid);
else {
id = SerialNext();
@@ -1031,7 +1031,7 @@ int __cdecl CJabberProto::SetApparentMode(MCONTACT hContact, int mode) if (!m_bJabberOnline)
return 0;
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid == NULL)
return 0;
@@ -1103,7 +1103,7 @@ void __cdecl CJabberProto::GetAwayMsgThread(void *param) MCONTACT hContact = (DWORD_PTR)param;
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid != NULL) {
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, jid);
if (item != NULL) {
@@ -1115,7 +1115,7 @@ void __cdecl CJabberProto::GetAwayMsgThread(void *param) JABBER_RESOURCE_STATUS *r = item->arResources[i];
if (r->m_tszStatusMessage) {
msgCount++;
- len += (mir_tstrlen(r->m_tszResourceName) + mir_tstrlen(r->m_tszStatusMessage) + 8);
+ len += (mir_wstrlen(r->m_tszResourceName) + mir_wstrlen(r->m_tszStatusMessage) + 8);
}
}
@@ -1124,13 +1124,13 @@ void __cdecl CJabberProto::GetAwayMsgThread(void *param) for (int i = 0; i < item->arResources.getCount(); i++) {
JABBER_RESOURCE_STATUS *r = item->arResources[i];
if (r->m_tszStatusMessage) {
- if (str[0] != '\0') mir_tstrcat(str, L"\r\n");
+ if (str[0] != '\0') mir_wstrcat(str, L"\r\n");
if (msgCount > 1) {
- mir_tstrcat(str, L"(");
- mir_tstrcat(str, r->m_tszResourceName);
- mir_tstrcat(str, L"): ");
+ mir_wstrcat(str, L"(");
+ mir_wstrcat(str, r->m_tszResourceName);
+ mir_wstrcat(str, L"): ");
}
- mir_tstrcat(str, r->m_tszStatusMessage);
+ mir_wstrcat(str, r->m_tszStatusMessage);
}
}
@@ -1197,11 +1197,11 @@ int __cdecl CJabberProto::SetAwayMsg(int status, const wchar_t *msg) return 1;
}
- if ((*szMsg == NULL && msg == NULL) || (*szMsg != NULL && msg != NULL && !mir_tstrcmp(*szMsg, msg)))
+ if ((*szMsg == NULL && msg == NULL) || (*szMsg != NULL && msg != NULL && !mir_wstrcmp(*szMsg, msg)))
return 0; // Message is the same, no update needed
// Update with the new mode message
- replaceStrT(*szMsg, msg);
+ replaceStrW(*szMsg, msg);
// Send a presence update if needed
lck.unlock();
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index d1ee6abe76..f0e36b64ff 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -675,7 +675,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface //---- jabber_thread.c ----------------------------------------------
- ptrT m_savedPassword;
+ ptrW m_savedPassword;
typedef struct {
bool isPlainAvailable;
diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp index c4bd0161b9..6cfb672dd0 100644 --- a/protocols/JabberG/src/jabber_rc.cpp +++ b/protocols/JabberG/src/jabber_rc.cpp @@ -71,7 +71,7 @@ BOOL CJabberAdhocManager::HandleItemsRequest(HXML, CJabberIqInfo *pInfo, const w if (!szNode || !m_pProto->m_options.EnableRemoteControl || !m_pProto->IsRcRequestAllowedByACL(pInfo))
return FALSE;
- if (!mir_tstrcmp(szNode, JABBER_FEAT_COMMANDS)) {
+ if (!mir_wstrcmp(szNode, JABBER_FEAT_COMMANDS)) {
XmlNodeIq iq(L"result", pInfo);
HXML resultQuery = iq << XQUERY(JABBER_FEAT_DISCO_ITEMS) << XATTR(L"node", JABBER_FEAT_COMMANDS);
{
@@ -102,7 +102,7 @@ BOOL CJabberAdhocManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, const wc return FALSE;
// FIXME: same code twice
- if (!mir_tstrcmp(szNode, JABBER_FEAT_COMMANDS)) {
+ if (!mir_wstrcmp(szNode, JABBER_FEAT_COMMANDS)) {
XmlNodeIq iq(L"result", pInfo);
HXML resultQuery = iq << XQUERY(JABBER_FEAT_DISCO_INFO) << XATTR(L"node", JABBER_FEAT_COMMANDS);
resultQuery << XCHILD(L"identity") << XATTR(L"name", L"Ad-hoc commands")
@@ -310,7 +310,7 @@ int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhoc // priority
wchar_t szPriority[ 256 ];
- mir_sntprintf(szPriority, L"%d", (int)getDword("Priority", 5));
+ mir_snwprintf(szPriority, L"%d", (int)getDword("Priority", 5));
xNode << XCHILD(L"field") << XATTR(L"label", TranslateT("Priority")) << XATTR(L"type", L"text-single")
<< XATTR(L"var", L"status-priority") << XCHILD(L"value", szPriority);
@@ -322,7 +322,7 @@ int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhoc fieldNode = xNode << XCHILD(L"field") << XATTR(L"label", TranslateT("Change global status"))
<< XATTR(L"type", L"boolean") << XATTR(L"var", L"status-global");
- ptrT tszStatusMsg((wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGT, status, 0));
+ ptrW tszStatusMsg((wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGT, status, 0));
if (tszStatusMsg)
fieldNode << XCHILD(L"value", tszStatusMsg);
@@ -346,13 +346,13 @@ int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhoc return JABBER_ADHOC_HANDLER_STATUS_CANCEL;
int status;
- if (!mir_tstrcmp(ptszValue, L"away")) status = ID_STATUS_AWAY;
- else if (!mir_tstrcmp(ptszValue, L"xa")) status = ID_STATUS_NA;
- else if (!mir_tstrcmp(ptszValue, L"dnd")) status = ID_STATUS_DND;
- else if (!mir_tstrcmp(ptszValue, L"chat")) status = ID_STATUS_FREECHAT;
- else if (!mir_tstrcmp(ptszValue, L"online")) status = ID_STATUS_ONLINE;
- else if (!mir_tstrcmp(ptszValue, L"invisible")) status = ID_STATUS_INVISIBLE;
- else if (!mir_tstrcmp(ptszValue, L"offline")) status = ID_STATUS_OFFLINE;
+ if (!mir_wstrcmp(ptszValue, L"away")) status = ID_STATUS_AWAY;
+ else if (!mir_wstrcmp(ptszValue, L"xa")) status = ID_STATUS_NA;
+ else if (!mir_wstrcmp(ptszValue, L"dnd")) status = ID_STATUS_DND;
+ else if (!mir_wstrcmp(ptszValue, L"chat")) status = ID_STATUS_FREECHAT;
+ else if (!mir_wstrcmp(ptszValue, L"online")) status = ID_STATUS_ONLINE;
+ else if (!mir_wstrcmp(ptszValue, L"invisible")) status = ID_STATUS_INVISIBLE;
+ else if (!mir_wstrcmp(ptszValue, L"offline")) status = ID_STATUS_OFFLINE;
else
return JABBER_ADHOC_HANDLER_STATUS_CANCEL;
@@ -414,12 +414,12 @@ int CJabberProto::AdhocOptionsHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe // Automatically Accept File Transfers
wchar_t szTmpBuff[ 1024 ];
- mir_sntprintf(szTmpBuff, L"%d", db_get_b(NULL, "SRFile", "AutoAccept", 0));
+ mir_snwprintf(szTmpBuff, L"%d", db_get_b(NULL, "SRFile", "AutoAccept", 0));
xNode << XCHILD(L"field") << XATTR(L"label", TranslateT("Automatically Accept File Transfers"))
<< XATTR(L"type", L"boolean") << XATTR(L"var", L"auto-files") << XCHILD(L"value", szTmpBuff);
// Use sounds
- mir_sntprintf(szTmpBuff, L"%d", db_get_b(NULL, "Skin", "UseSound", 0));
+ mir_snwprintf(szTmpBuff, L"%d", db_get_b(NULL, "Skin", "UseSound", 0));
xNode << XCHILD(L"field") << XATTR(L"label", TranslateT("Play sounds"))
<< XATTR(L"type", L"boolean") << XATTR(L"var", L"sounds") << XCHILD(L"value", szTmpBuff);
@@ -465,7 +465,7 @@ int CJabberProto::RcGetUnreadEventsCount() {
int nEventsSent = 0;
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
- ptrT jid( getTStringA(hContact, "jid"));
+ ptrW jid( getTStringA(hContact, "jid"));
if (jid == NULL) continue;
for (MEVENT hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) {
@@ -495,7 +495,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe if (pSession->GetStage() == 0) {
int nUnreadEvents = RcGetUnreadEventsCount();
if (!nUnreadEvents) {
- mir_sntprintf(szMsg, TranslateT("There is no messages to forward"));
+ mir_snwprintf(szMsg, TranslateT("There is no messages to forward"));
m_ThreadInfo->send(
XmlNodeIq(L"result", pInfo)
@@ -517,7 +517,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe xNode << XCHILD(L"title", TranslateT("Forward options"));
- mir_sntprintf(szMsg, TranslateT("%d message(s) to be forwarded"), nUnreadEvents);
+ mir_snwprintf(szMsg, TranslateT("%d message(s) to be forwarded"), nUnreadEvents);
xNode << XCHILD(L"instructions", szMsg);
xNode << XCHILD(L"field") << XATTR(L"type", L"hidden") << XATTR(L"var", L"FORM_TYPE")
@@ -551,7 +551,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe int nEventsSent = 0;
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
- ptrT tszJid( getTStringA(hContact, "jid"));
+ ptrW tszJid( getTStringA(hContact, "jid"));
if (tszJid == NULL)
continue;
@@ -569,7 +569,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe if (dbei.eventType != EVENTTYPE_MESSAGE || (dbei.flags & (DBEF_READ | DBEF_SENT)))
continue;
- ptrT szEventText( DbGetEventTextT(&dbei, CP_ACP));
+ ptrW szEventText( DbGetEventTextT(&dbei, CP_ACP));
if (szEventText == NULL)
continue;
@@ -582,8 +582,8 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe size_t cbBlob = mir_strlen((LPSTR)dbei.pBlob)+1;
if (cbBlob < dbei.cbBlob) { // rest of message contains a sender's resource
- ptrT szOResource( mir_utf8decodeT((LPSTR)dbei.pBlob + cbBlob+1));
- mir_sntprintf(szOFrom, L"%s/%s", tszJid, szOResource);
+ ptrW szOResource( mir_utf8decodeW((LPSTR)dbei.pBlob + cbBlob+1));
+ mir_snwprintf(szOFrom, L"%s/%s", tszJid, szOResource);
} else
wcsncpy_s(szOFrom, tszJid, _TRUNCATE);
@@ -593,7 +593,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe time_t ltime = (time_t)dbei.timestamp;
struct tm *gmt = gmtime(<ime);
wchar_t stime[512];
- mir_sntprintf(stime, L"%.4i-%.2i-%.2iT%.2i:%.2i:%.2iZ", gmt->tm_year + 1900, gmt->tm_mon + 1, gmt->tm_mday,
+ mir_snwprintf(stime, L"%.4i-%.2i-%.2iT%.2i:%.2i:%.2iZ", gmt->tm_year + 1900, gmt->tm_mon + 1, gmt->tm_mday,
gmt->tm_hour, gmt->tm_min, gmt->tm_sec);
msg << XCHILDNS(L"delay", L"urn:xmpp:delay") << XATTR(L"stamp", stime);
@@ -607,7 +607,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe }
}
- mir_sntprintf(szMsg, TranslateT("%d message(s) forwarded"), nEventsSent);
+ mir_snwprintf(szMsg, TranslateT("%d message(s) forwarded"), nEventsSent);
m_ThreadInfo->send(
XmlNodeIq(L"result", pInfo)
@@ -627,9 +627,9 @@ int CJabberProto::AdhocLockWSHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSes wchar_t szMsg[ 1024 ];
if (bOk)
- mir_sntprintf(szMsg, TranslateT("Workstation successfully locked"));
+ mir_snwprintf(szMsg, TranslateT("Workstation successfully locked"));
else
- mir_sntprintf(szMsg, TranslateT("Error %d occurred during workstation lock"), GetLastError());
+ mir_snwprintf(szMsg, TranslateT("Error %d occurred during workstation lock"), GetLastError());
m_ThreadInfo->send(
XmlNodeIq(L"result", pInfo)
@@ -709,7 +709,7 @@ int CJabberProto::AdhocLeaveGroupchatsHandler(HXML, CJabberIqInfo *pInfo, CJabbe if (!nChatsCount) {
wchar_t szMsg[ 1024 ];
- mir_sntprintf(szMsg, TranslateT("There is no group chats to leave"));
+ mir_snwprintf(szMsg, TranslateT("There is no group chats to leave"));
m_ThreadInfo->send(
XmlNodeIq(L"result", pInfo)
@@ -763,7 +763,7 @@ int CJabberProto::AdhocLeaveGroupchatsHandler(HXML, CJabberIqInfo *pInfo, CJabbe if (fieldNode) {
for (i=0; i < XmlGetChildCount(fieldNode); i++) {
HXML valueNode = XmlGetChild(fieldNode, i);
- if (valueNode && XmlGetName(valueNode) && XmlGetText(valueNode) && !mir_tstrcmp(XmlGetName(valueNode), L"value")) {
+ if (valueNode && XmlGetName(valueNode) && XmlGetText(valueNode) && !mir_wstrcmp(XmlGetName(valueNode), L"value")) {
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_CHATROOM, XmlGetText(valueNode));
if (item)
GcQuit(item, 0, NULL);
diff --git a/protocols/JabberG/src/jabber_rc.h b/protocols/JabberG/src/jabber_rc.h index aa5306e381..fd4a6664d9 100644 --- a/protocols/JabberG/src/jabber_rc.h +++ b/protocols/JabberG/src/jabber_rc.h @@ -112,9 +112,9 @@ public: CJabberAdhocNode(CJabberProto* pProto, wchar_t* szJid, wchar_t* szNode, wchar_t* szName, JABBER_ADHOC_HANDLER pHandler)
{
memset(this, 0, sizeof(CJabberAdhocNode));
- replaceStrT(m_szJid, szJid);
- replaceStrT(m_szNode, szNode);
- replaceStrT(m_szName, szName);
+ replaceStrW(m_szJid, szJid);
+ replaceStrW(m_szNode, szNode);
+ replaceStrW(m_szName, szName);
m_pHandler = pHandler;
m_pProto = pProto;
}
@@ -169,7 +169,7 @@ protected: {
CJabberAdhocSession* pSession = m_pSessions;
while (pSession) {
- if (!mir_tstrcmp(pSession->GetSessionId(), szSession))
+ if (!mir_wstrcmp(pSession->GetSessionId(), szSession))
return pSession;
pSession = pSession->GetNext();
}
@@ -192,7 +192,7 @@ protected: {
CJabberAdhocNode* pNode = m_pNodes;
while (pNode) {
- if (!mir_tstrcmp(pNode->GetNode(), szNode))
+ if (!mir_wstrcmp(pNode->GetNode(), szNode))
return pNode;
pNode = pNode->GetNext();
}
diff --git a/protocols/JabberG/src/jabber_search.cpp b/protocols/JabberG/src/jabber_search.cpp index c1d3795688..69f3c6f3ee 100644 --- a/protocols/JabberG/src/jabber_search.cpp +++ b/protocols/JabberG/src/jabber_search.cpp @@ -141,7 +141,7 @@ void CJabberProto::OnIqResultGetSearchFields(HXML iqNode, CJabberIqInfo*) if (type == NULL) return; - if (!mir_tstrcmp(type, L"result")) { + if (!mir_wstrcmp(type, L"result")) { HXML queryNode = XmlGetNthChild(iqNode, L"query", 1); HXML xNode = XmlGetChildByTag(queryNode, "x", "xmlns", JABBER_FEAT_DATA_FORMS); @@ -160,15 +160,15 @@ void CJabberProto::OnIqResultGetSearchFields(HXML iqNode, CJabberIqInfo*) if (!chNode) break; - if (!mir_tstrcmpi(XmlGetName(chNode), L"instructions") && XmlGetText(chNode)) + if (!mir_wstrcmpi(XmlGetName(chNode), L"instructions") && XmlGetText(chNode)) SetDlgItemText(searchHandleDlg, IDC_INSTRUCTIONS, TranslateTS(XmlGetText(chNode))); else if (XmlGetName(chNode)) { Data *MyData = (Data*)malloc(sizeof(Data)); memset(MyData, 0, sizeof(Data)); - MyData->Label = mir_tstrdup(XmlGetName(chNode)); - MyData->Var = mir_tstrdup(XmlGetName(chNode)); - MyData->defValue = mir_tstrdup(XmlGetText(chNode)); + MyData->Label = mir_wstrdup(XmlGetName(chNode)); + MyData->Var = mir_wstrdup(XmlGetName(chNode)); + MyData->defValue = mir_wstrdup(XmlGetText(chNode)); MyData->Order = Order; if (MyData->defValue) MyData->bReadOnly = TRUE; PostMessage(searchHandleDlg, WM_USER + 10, FALSE, (LPARAM)MyData); @@ -183,7 +183,7 @@ void CJabberProto::OnIqResultGetSearchFields(HXML iqNode, CJabberIqInfo*) PostMessage(searchHandleDlg, WM_USER + 10, 0, 0); ShowWindow(searchHandleDlg, SW_SHOW); } - else if (!mir_tstrcmp(type, L"error")) { + else if (!mir_wstrcmp(type, L"error")) { const wchar_t *code = NULL; const wchar_t *description = NULL; wchar_t buff[255]; @@ -192,7 +192,7 @@ void CJabberProto::OnIqResultGetSearchFields(HXML iqNode, CJabberIqInfo*) code = XmlGetAttrValue(errorNode, L"code"); description = XmlGetText(errorNode); } - mir_sntprintf(buff, TranslateT("Error %s %s\r\nPlease select other server"), code ? code : L"", description ? description : L""); + mir_snwprintf(buff, TranslateT("Error %s %s\r\nPlease select other server"), code ? code : L"", description ? description : L""); SetDlgItemText(searchHandleDlg, IDC_INSTRUCTIONS, buff); } else SetDlgItemText(searchHandleDlg, IDC_INSTRUCTIONS, TranslateT("Error: unknown reply received\r\nPlease select other server")); @@ -261,7 +261,7 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M wchar_t *var = ListOfFields[j]; wchar_t *value = pmUserData->operator [](var); Results.pszFields[j] = value ? value : (wchar_t *)L" "; - if (!mir_tstrcmpi(var, L"jid") && value) + if (!mir_wstrcmpi(var, L"jid") && value) Results.psr.id.w = value; } @@ -270,8 +270,8 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M nick = pmUserData->operator [](nickfields[k]); if (nick) { - if (mir_tstrcmpi(nick, Results.psr.id.w)) - mir_sntprintf(buff, L"%s (%s)", nick, Results.psr.id.w); + if (mir_wstrcmpi(nick, Results.psr.id.w)) + mir_snwprintf(buff, L"%s (%s)", nick, Results.psr.id.w); else wcsncpy_s(buff, nick, _TRUNCATE); @@ -293,7 +293,7 @@ void DestroyKey(wchar_t* key) wchar_t* CopyKey(wchar_t* key) { - return mir_tstrdup(key); + return mir_wstrdup(key); } //////////////////////////////////////////////////////////////////////////////// @@ -312,7 +312,7 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo*) return; } - if (!mir_tstrcmp(type, L"result")) { + if (!mir_wstrcmp(type, L"result")) { HXML queryNode = XmlGetNthChild(iqNode, L"query", 1); HXML xNode = XmlGetChildByTag(queryNode, "x", "xmlns", JABBER_FEAT_DATA_FORMS); if (xNode) { @@ -379,7 +379,7 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo*) } } } - else if (!mir_tstrcmp(type, L"error")) { + else if (!mir_wstrcmp(type, L"error")) { const wchar_t *code = NULL; const wchar_t *description = NULL; wchar_t buff[255]; @@ -389,7 +389,7 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo*) description = XmlGetText(errorNode); } - mir_sntprintf(buff, TranslateT("Error %s %s\r\nTry to specify more detailed"), code ? code : L"", description ? description : L""); + mir_snwprintf(buff, TranslateT("Error %s %s\r\nTry to specify more detailed"), code ? code : L"", description ? description : L""); ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0); if (searchHandleDlg) SetDlgItemText(searchHandleDlg, IDC_INSTRUCTIONS, buff); @@ -494,8 +494,8 @@ void CJabberProto::SearchDeleteFromRecent(const wchar_t *szAddr, bool deleteLast for (int i = 0; i < 10; i++) { char key[30]; mir_snprintf(key, "RecentlySearched_%d", i); - ptrT szValue(getTStringA(key)); - if (szValue == NULL || mir_tstrcmpi(szAddr, szValue)) + ptrW szValue(getTStringA(key)); + if (szValue == NULL || mir_wstrcmpi(szAddr, szValue)) continue; for (int j = i; j < 10; j++) { @@ -524,7 +524,7 @@ void CJabberProto::SearchAddToRecent(const wchar_t *szAddr, HWND hwndDialog) for (int j = 9; j > 0; j--) { mir_snprintf(key, "RecentlySearched_%d", j - 1); - ptrT szValue(getTStringA(key)); + ptrW szValue(getTStringA(key)); if (szValue != NULL) { mir_snprintf(key, "RecentlySearched_%d", j); setTString(NULL, key, szValue); @@ -564,7 +564,7 @@ static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPAR for (i = 0; i < 10; i++) { char key[30]; mir_snprintf(key, "RecentlySearched_%d", i); - ptrT szValue(dat->ppro->getTStringA(key)); + ptrW szValue(dat->ppro->getTStringA(key)); if (szValue != NULL) JabberSearchAddUrlToRecentCombo(hwndDlg, szValue); } @@ -714,8 +714,8 @@ static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPAR HWND __cdecl CJabberProto::CreateExtendedSearchUI(HWND parent) { if (parent && hInst) { - ptrT szServer(getTStringA("LoginServer")); - if (szServer == NULL || mir_tstrcmpi(szServer, L"S.ms")) + ptrW szServer(getTStringA("LoginServer")); + if (szServer == NULL || mir_wstrcmpi(szServer, L"S.ms")) return CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SEARCHUSER), parent, JabberSearchAdvancedDlgProc, (LPARAM)this); } diff --git a/protocols/JabberG/src/jabber_search.h b/protocols/JabberG/src/jabber_search.h index cf3f053728..34eee4d1bc 100644 --- a/protocols/JabberG/src/jabber_search.h +++ b/protocols/JabberG/src/jabber_search.h @@ -262,5 +262,5 @@ public: inline int TCharKeyCmp(wchar_t* a, wchar_t* b)
{
- return (int)(mir_tstrcmpi(a,b));
+ return (int)(mir_wstrcmpi(a,b));
}
diff --git a/protocols/JabberG/src/jabber_secur.cpp b/protocols/JabberG/src/jabber_secur.cpp index 447e15edd1..6508672e41 100644 --- a/protocols/JabberG/src/jabber_secur.cpp +++ b/protocols/JabberG/src/jabber_secur.cpp @@ -78,8 +78,8 @@ bool TNtlmAuth::getSpn(wchar_t* szSpn, size_t dwSpnLen) else return false;
if (szHostName && szHostName[0]) {
- wchar_t *szFullUserNameU = wcsupr(mir_tstrdup(szFullUserName));
- mir_sntprintf(szSpn, dwSpnLen, L"xmpp/%s/%s@%s", szHostName, szFullUserName, szFullUserNameU);
+ wchar_t *szFullUserNameU = wcsupr(mir_wstrdup(szFullUserName));
+ mir_snwprintf(szSpn, dwSpnLen, L"xmpp/%s/%s@%s", szHostName, szFullUserName, szFullUserNameU);
mir_free(szFullUserNameU);
}
else {
@@ -90,8 +90,8 @@ bool TNtlmAuth::getSpn(wchar_t* szSpn, size_t dwSpnLen) if (host && host->h_name)
connectHost = host->h_name;
- wchar_t *connectHostT = mir_a2t(connectHost);
- mir_sntprintf(szSpn, dwSpnLen, L"xmpp/%s@%s", connectHostT, wcsupr(szFullUserName));
+ wchar_t *connectHostT = mir_a2u(connectHost);
+ mir_snwprintf(szSpn, dwSpnLen, L"xmpp/%s@%s", connectHostT, wcsupr(szFullUserName));
mir_free(connectHostT);
}
@@ -116,7 +116,7 @@ char* TNtlmAuth::getChallenge(const wchar_t *challenge) if (!hProvider)
return NULL;
- ptrA text((!mir_tstrcmp(challenge, L"=")) ? mir_strdup("") : mir_t2a(challenge));
+ ptrA text((!mir_wstrcmp(challenge, L"=")) ? mir_strdup("") : mir_u2a(challenge));
if (info->conn.password[0] != 0)
return Netlib_NtlmCreateResponse2(hProvider, text, info->conn.username, info->conn.password, &complete);
@@ -261,7 +261,7 @@ char* TScramAuth::getChallenge(const wchar_t *challenge) if (snonce == NULL || salt == NULL || ind == -1)
return NULL;
- ptrA passw(mir_utf8encodeT(info->conn.password));
+ ptrA passw(mir_utf8encodeW(info->conn.password));
size_t passwLen = mir_strlen(passw);
BYTE saltedPassw[MIR_SHA1_HASH_SIZE];
diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp index 521d4eaa08..9d5553db8f 100644 --- a/protocols/JabberG/src/jabber_svc.cpp +++ b/protocols/JabberG/src/jabber_svc.cpp @@ -65,7 +65,7 @@ INT_PTR __cdecl CJabberProto::GetMyAwayMsg(WPARAM wParam, LPARAM lParam) }
if (szStatus)
- return (lParam & SGMA_UNICODE) ? (INT_PTR)mir_t2u(szStatus) : (INT_PTR)mir_t2a(szStatus);
+ return (lParam & SGMA_UNICODE) ? (INT_PTR)mir_wstrdup(szStatus) : (INT_PTR)mir_u2a(szStatus);
return 0;
}
@@ -144,7 +144,7 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam) }
if ((wParam & GAIF_FORCE) != 0 && pai->hContact != NULL && m_bJabberOnline) {
- ptrT tszJid( getTStringA(pai->hContact, "jid"));
+ ptrW tszJid( getTStringA(pai->hContact, "jid"));
if (tszJid != NULL) {
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, tszJid);
if (item != NULL) {
@@ -153,7 +153,7 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam) wchar_t szJid[JABBER_MAX_JID_LEN]; szJid[0] = 0;
if (item->arResources.getCount() != NULL && !isXVcard)
if (wchar_t *bestResName = ListGetBestClientResourceNamePtr(tszJid))
- mir_sntprintf(szJid, L"%s/%s", tszJid, bestResName);
+ mir_snwprintf(szJid, L"%s/%s", tszJid, bestResName);
if (szJid[0] == 0)
wcsncpy_s(szJid, tszJid, _TRUNCATE);
@@ -181,7 +181,7 @@ INT_PTR __cdecl CJabberProto::OnGetEventTextChatStates(WPARAM, LPARAM lParam) if (pdbEvent->dbei->cbBlob > 0) {
if (pdbEvent->dbei->pBlob[0] == JABBER_DB_EVENT_CHATSTATES_GONE) {
if (pdbEvent->datatype == DBVT_WCHAR)
- return (INT_PTR)mir_tstrdup(TranslateT("closed chat session"));
+ return (INT_PTR)mir_wstrdup(TranslateT("closed chat session"));
else if (pdbEvent->datatype == DBVT_ASCIIZ)
return (INT_PTR)mir_strdup(Translate("closed chat session"));
}
@@ -200,42 +200,42 @@ INT_PTR __cdecl CJabberProto::OnGetEventTextPresence(WPARAM, LPARAM lParam) switch (pdbEvent->dbei->pBlob[0]) {
case JABBER_DB_EVENT_PRESENCE_SUBSCRIBE:
if (pdbEvent->datatype == DBVT_WCHAR)
- return (INT_PTR)mir_tstrdup(TranslateT("sent subscription request"));
+ return (INT_PTR)mir_wstrdup(TranslateT("sent subscription request"));
else if (pdbEvent->datatype == DBVT_ASCIIZ)
return (INT_PTR)mir_strdup(Translate("sent subscription request"));
break;
case JABBER_DB_EVENT_PRESENCE_SUBSCRIBED:
if (pdbEvent->datatype == DBVT_WCHAR)
- return (INT_PTR)mir_tstrdup(TranslateT("approved subscription request"));
+ return (INT_PTR)mir_wstrdup(TranslateT("approved subscription request"));
else if (pdbEvent->datatype == DBVT_ASCIIZ)
return (INT_PTR)mir_strdup(Translate("approved subscription request"));
break;
case JABBER_DB_EVENT_PRESENCE_UNSUBSCRIBE:
if (pdbEvent->datatype == DBVT_WCHAR)
- return (INT_PTR)mir_tstrdup(TranslateT("declined subscription"));
+ return (INT_PTR)mir_wstrdup(TranslateT("declined subscription"));
else if (pdbEvent->datatype == DBVT_ASCIIZ)
return (INT_PTR)mir_strdup(Translate("declined subscription"));
break;
case JABBER_DB_EVENT_PRESENCE_UNSUBSCRIBED:
if (pdbEvent->datatype == DBVT_WCHAR)
- return (INT_PTR)mir_tstrdup(TranslateT("declined subscription"));
+ return (INT_PTR)mir_wstrdup(TranslateT("declined subscription"));
else if (pdbEvent->datatype == DBVT_ASCIIZ)
return (INT_PTR)mir_strdup(Translate("declined subscription"));
break;
case JABBER_DB_EVENT_PRESENCE_ERROR:
if (pdbEvent->datatype == DBVT_WCHAR)
- return (INT_PTR)mir_tstrdup(TranslateT("sent error presence"));
+ return (INT_PTR)mir_wstrdup(TranslateT("sent error presence"));
else if (pdbEvent->datatype == DBVT_ASCIIZ)
return (INT_PTR)mir_strdup(Translate("sent error presence"));
break;
default:
if (pdbEvent->datatype == DBVT_WCHAR)
- return (INT_PTR)mir_tstrdup(TranslateT("sent unknown presence type"));
+ return (INT_PTR)mir_wstrdup(TranslateT("sent unknown presence type"));
else if (pdbEvent->datatype == DBVT_ASCIIZ)
return (INT_PTR)mir_strdup(Translate("sent unknown presence type"));
break;
@@ -317,7 +317,7 @@ INT_PTR __cdecl CJabberProto::JabberSetAvatar(WPARAM, LPARAM lParam) INT_PTR __cdecl CJabberProto::JabberSetNickname(WPARAM wParam, LPARAM lParam)
{
- wchar_t *nickname = (wParam & SMNN_UNICODE) ? mir_u2t((WCHAR*)lParam) : mir_a2t((char*)lParam);
+ wchar_t *nickname = (wParam & SMNN_UNICODE) ? mir_wstrdup((WCHAR*)lParam) : mir_a2u((char*)lParam);
setTString("Nick", nickname);
SetServerVcard(FALSE, L"");
@@ -347,7 +347,7 @@ static void appendString(bool bIsTipper, const wchar_t *tszTitle, const wchar_t out.AppendFormat(L"<b>%s</b>\t%s", TranslateTS(tszTitle), tszValue);
else {
wchar_t *p = TranslateTS(tszTitle);
- out.AppendFormat(L"%s%s\t%s", p, mir_tstrlen(p) <= 7 ? L"\t" : L"", tszValue);
+ out.AppendFormat(L"%s%s\t%s", p, mir_wstrlen(p) <= 7 ? L"\t" : L"", tszValue);
}
}
@@ -398,7 +398,7 @@ INT_PTR __cdecl CJabberProto::JabberGCGetToolTipText(WPARAM wParam, LPARAM lPara if (info->m_tszRealJid)
appendString(bIsTipper, LPGENW("Real JID:"), info->m_tszRealJid, outBuf);
- return (outBuf.IsEmpty() ? NULL : (INT_PTR)mir_tstrdup(outBuf));
+ return (outBuf.IsEmpty() ? NULL : (INT_PTR)mir_wstrdup(outBuf));
}
// File Association Manager plugin support
@@ -434,7 +434,7 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam) *(szSecondParam++) = 0;
// no command or message command
- if (!szCommand || (szCommand && !mir_tstrcmpi(szCommand, L"message"))) {
+ if (!szCommand || (szCommand && !mir_wstrcmpi(szCommand, L"message"))) {
// message
if (!ServiceExists(MS_MSG_SENDMESSAGEW))
return 1;
@@ -461,7 +461,7 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam) return 0;
}
- if (!mir_tstrcmpi(szCommand, L"roster")) {
+ if (!mir_wstrcmpi(szCommand, L"roster")) {
if (!HContactFromJID(szJid)) {
PROTOSEARCHRESULT psr = { 0 };
psr.cbSize = sizeof(psr);
@@ -479,19 +479,19 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam) }
// chat join invitation
- if (!mir_tstrcmpi(szCommand, L"join")) {
+ if (!mir_wstrcmpi(szCommand, L"join")) {
GroupchatJoinRoomByJid(NULL, szJid);
return 0;
}
// service discovery request
- if (!mir_tstrcmpi(szCommand, L"disco")) {
+ if (!mir_wstrcmpi(szCommand, L"disco")) {
OnMenuHandleServiceDiscovery(0, (LPARAM)szJid);
return 0;
}
// ad-hoc commands
- if (!mir_tstrcmpi(szCommand, L"command")) {
+ if (!mir_wstrcmpi(szCommand, L"command")) {
if (szSecondParam) {
if (!wcsnicmp(szSecondParam, L"node=", 5)) {
szSecondParam += 5;
@@ -506,7 +506,7 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam) }
// send file
- if (!mir_tstrcmpi(szCommand, L"sendfile")) {
+ if (!mir_wstrcmpi(szCommand, L"sendfile")) {
MCONTACT hContact = HContactFromJID(szJid, false);
if (hContact == NULL)
hContact = DBCreateContact(szJid, szJid, true, true);
@@ -525,14 +525,14 @@ INT_PTR __cdecl CJabberProto::JabberSendNudge(WPARAM hContact, LPARAM) if (!m_bJabberOnline)
return 0;
- ptrT jid( getTStringA(hContact, "jid"));
+ ptrW jid( getTStringA(hContact, "jid"));
if (jid == NULL)
return 0;
wchar_t tszJid[JABBER_MAX_JID_LEN];
wchar_t *szResource = ListGetBestClientResourceNamePtr(jid);
if (szResource)
- mir_sntprintf(tszJid, L"%s/%s", jid, szResource);
+ mir_snwprintf(tszJid, L"%s/%s", jid, szResource);
else
wcsncpy_s(tszJid, jid, _TRUNCATE);
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 074476651f..bc3486fdf5 100755 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -77,7 +77,7 @@ static INT_PTR CALLBACK JabberPasswordDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
wchar_t text[512];
- mir_sntprintf(text, TranslateT("Enter password for %s"), param->ptszJid);
+ mir_snwprintf(text, TranslateT("Enter password for %s"), param->ptszJid);
SetDlgItemText(hwndDlg, IDC_JID, text);
CheckDlgButton(hwndDlg, IDC_SAVEPASSWORD, param->pro->getByte("SaveSessionPassword", 0) ? BST_CHECKED : BST_UNCHECKED);
@@ -217,7 +217,7 @@ void CJabberProto::xmlStreamInitializeNow(ThreadData *info) void CJabberProto::ServerThread(JABBER_CONN_DATA *pParam)
{
- ptrT tszValue;
+ ptrW tszValue;
ThreadData info(this, pParam);
@@ -248,7 +248,7 @@ void CJabberProto::ServerThread(JABBER_CONN_DATA *pParam) if ((tszValue = getTStringA("LoginName")) != NULL)
wcsncpy_s(info.conn.username, tszValue, _TRUNCATE);
- if (*rtrimt(info.conn.username) == '\0') {
+ if (*rtrimw(info.conn.username) == '\0') {
DWORD dwSize = _countof(info.conn.username);
if (GetUserName(info.conn.username, &dwSize))
setTString("LoginName", info.conn.username);
@@ -256,7 +256,7 @@ void CJabberProto::ServerThread(JABBER_CONN_DATA *pParam) info.conn.username[0] = 0;
}
- if (*rtrimt(info.conn.username) == '\0') {
+ if (*rtrimw(info.conn.username) == '\0') {
debugLogA("Thread ended, login name is not configured");
JLoginFailed(LOGINERR_BADUSERID);
@@ -279,17 +279,17 @@ LBL_FatalError: if (m_options.HostNameAsResource) {
DWORD dwCompNameLen = _countof(info.resource) - 1;
if (!GetComputerName(info.resource, &dwCompNameLen))
- mir_tstrcpy(info.resource, L"Miranda");
+ mir_wstrcpy(info.resource, L"Miranda");
}
else {
if ((tszValue = getTStringA("Resource")) != NULL)
wcsncpy_s(info.resource, tszValue, _TRUNCATE);
else
- mir_tstrcpy(info.resource, L"Miranda");
+ mir_wstrcpy(info.resource, L"Miranda");
}
wchar_t jidStr[512];
- mir_sntprintf(jidStr, L"%s@%S/%s", info.conn.username, info.conn.server, info.resource);
+ mir_snwprintf(jidStr, L"%s@%S/%s", info.conn.username, info.conn.server, info.resource);
wcsncpy_s(info.fullJID, jidStr, _TRUNCATE);
if (m_options.UseDomainLogin) // in the case of NTLM auth we have no need in password
@@ -298,7 +298,7 @@ LBL_FatalError: if (m_savedPassword != NULL)
wcsncpy_s(info.conn.password, m_savedPassword, _TRUNCATE);
else {
- mir_sntprintf(jidStr, L"%s@%S", info.conn.username, info.conn.server);
+ mir_snwprintf(jidStr, L"%s@%S", info.conn.username, info.conn.server);
JabberPasswordDlgParam param;
param.pro = this;
@@ -314,12 +314,12 @@ LBL_FatalError: goto LBL_FatalError;
}
- m_savedPassword = (param.saveOnlinePassword) ? mir_tstrdup(param.onlinePassword) : NULL;
+ m_savedPassword = (param.saveOnlinePassword) ? mir_wstrdup(param.onlinePassword) : NULL;
wcsncpy_s(info.conn.password, param.onlinePassword, _TRUNCATE);
}
}
else {
- ptrT tszPassw(getTStringA(NULL, "Password"));
+ ptrW tszPassw(getTStringA(NULL, "Password"));
if (tszPassw == NULL) {
JLoginFailed(LOGINERR_BADUSERID);
debugLogA("Thread ended, password is not configured");
@@ -390,9 +390,9 @@ LBL_FatalError: // User may change status to OFFLINE while we are connecting above
if (m_iDesiredStatus != ID_STATUS_OFFLINE || info.bIsReg) {
if (!info.bIsReg) {
- size_t len = mir_tstrlen(info.conn.username) + mir_strlen(info.conn.server) + 1;
+ size_t len = mir_wstrlen(info.conn.username) + mir_strlen(info.conn.server) + 1;
m_szJabberJID = (wchar_t*)mir_alloc(sizeof(wchar_t)*(len + 1));
- mir_sntprintf(m_szJabberJID, len + 1, L"%s@%S", info.conn.username, info.conn.server);
+ mir_snwprintf(m_szJabberJID, len + 1, L"%s@%S", info.conn.username, info.conn.server);
m_bSendKeepAlive = m_options.KeepAlive != 0;
setTString("jid", m_szJabberJID); // store jid in database
@@ -439,7 +439,7 @@ LBL_FatalError: recvRest:
info.buffer[datalen] = '\0';
- ptrT str(mir_utf8decodeW(info.buffer));
+ ptrW str(mir_utf8decodeW(info.buffer));
int bytesParsed = 0;
XmlNode root(str, &bytesParsed, tag);
@@ -569,13 +569,13 @@ void CJabberProto::PerformIqAuth(ThreadData *info) void CJabberProto::OnProcessStreamOpening(HXML node, ThreadData *info)
{
- if (mir_tstrcmp(XmlGetName(node), L"stream:stream"))
+ if (mir_wstrcmp(XmlGetName(node), L"stream:stream"))
return;
if (!info->bIsReg) {
const wchar_t *sid = XmlGetAttrValue(node, L"id");
if (sid != NULL)
- info->szStreamId = mir_t2a(sid);
+ info->szStreamId = mir_u2a(sid);
}
// old server - disable SASL then
@@ -654,7 +654,7 @@ void CJabberProto::PerformAuthentication(ThreadData *info) }
wchar_t text[1024];
- mir_sntprintf(text, TranslateT("Authentication failed for %s@%S."), info->conn.username, info->conn.server);
+ mir_snwprintf(text, TranslateT("Authentication failed for %s@%S."), info->conn.username, info->conn.server);
MsgPopup(NULL, text, TranslateT("Jabber Authentication"));
JLoginFailed(LOGINERR_WRONGPASSWORD);
info->send("</stream:stream>");
@@ -682,29 +682,29 @@ void CJabberProto::OnProcessFeatures(HXML node, ThreadData *info) if (!n)
break;
- if (!mir_tstrcmp(XmlGetName(n), L"starttls")) {
+ if (!mir_wstrcmp(XmlGetName(n), L"starttls")) {
if (!info->conn.useSSL && m_options.UseTLS) {
debugLogA("Requesting TLS");
info->send(XmlNode(XmlGetName(n)) << XATTR(L"xmlns", L"urn:ietf:params:xml:ns:xmpp-tls"));
return;
} }
- if (!mir_tstrcmp(XmlGetName(n), L"compression") && m_options.EnableZlib == TRUE) {
+ if (!mir_wstrcmp(XmlGetName(n), L"compression") && m_options.EnableZlib == TRUE) {
debugLogA("Server compression available");
for (int k = 0;; k++) {
HXML c = XmlGetChild(n, k);
if (!c)
break;
- if (!mir_tstrcmp(XmlGetName(c), L"method")) {
- if (!mir_tstrcmp(XmlGetText(c), L"zlib") && info->zlibInit() == TRUE) {
+ if (!mir_wstrcmp(XmlGetName(c), L"method")) {
+ if (!mir_wstrcmp(XmlGetText(c), L"zlib") && info->zlibInit() == TRUE) {
debugLogA("Requesting Zlib compression");
info->send(XmlNode(L"compress") << XATTR(L"xmlns", L"http://jabber.org/protocol/compress")
<< XCHILD(L"method", L"zlib"));
return;
} } } }
- if (!mir_tstrcmp(XmlGetName(n), L"mechanisms")) {
+ if (!mir_wstrcmp(XmlGetName(n), L"mechanisms")) {
m_AuthMechs.isPlainAvailable = false;
m_AuthMechs.isPlainOldAvailable = false;
m_AuthMechs.isMd5Available = false;
@@ -721,26 +721,26 @@ void CJabberProto::OnProcessFeatures(HXML node, ThreadData *info) if (!c)
break;
- if (!mir_tstrcmp(XmlGetName(c), L"mechanism")) {
+ if (!mir_wstrcmp(XmlGetName(c), L"mechanism")) {
LPCTSTR ptszMechanism = XmlGetText(c);
- if (!mir_tstrcmp(ptszMechanism, L"PLAIN")) m_AuthMechs.isPlainOldAvailable = m_AuthMechs.isPlainAvailable = true;
- else if (!mir_tstrcmp(ptszMechanism, L"DIGEST-MD5")) m_AuthMechs.isMd5Available = true;
- else if (!mir_tstrcmp(ptszMechanism, L"SCRAM-SHA-1")) m_AuthMechs.isScramAvailable = true;
- else if (!mir_tstrcmp(ptszMechanism, L"NTLM")) m_AuthMechs.isNtlmAvailable = true;
- else if (!mir_tstrcmp(ptszMechanism, L"GSS-SPNEGO")) m_AuthMechs.isSpnegoAvailable = true;
- else if (!mir_tstrcmp(ptszMechanism, L"GSSAPI")) m_AuthMechs.isKerberosAvailable = true;
+ if (!mir_wstrcmp(ptszMechanism, L"PLAIN")) m_AuthMechs.isPlainOldAvailable = m_AuthMechs.isPlainAvailable = true;
+ else if (!mir_wstrcmp(ptszMechanism, L"DIGEST-MD5")) m_AuthMechs.isMd5Available = true;
+ else if (!mir_wstrcmp(ptszMechanism, L"SCRAM-SHA-1")) m_AuthMechs.isScramAvailable = true;
+ else if (!mir_wstrcmp(ptszMechanism, L"NTLM")) m_AuthMechs.isNtlmAvailable = true;
+ else if (!mir_wstrcmp(ptszMechanism, L"GSS-SPNEGO")) m_AuthMechs.isSpnegoAvailable = true;
+ else if (!mir_wstrcmp(ptszMechanism, L"GSSAPI")) m_AuthMechs.isKerberosAvailable = true;
}
- else if (!mir_tstrcmp(XmlGetName(c), L"hostname")) {
+ else if (!mir_wstrcmp(XmlGetName(c), L"hostname")) {
const wchar_t *mech = XmlGetAttrValue(c, L"mechanism");
- if (mech && mir_tstrcmpi(mech, L"GSSAPI") == 0) {
- m_AuthMechs.m_gssapiHostName = mir_tstrdup(XmlGetText(c));
+ if (mech && mir_wstrcmpi(mech, L"GSSAPI") == 0) {
+ m_AuthMechs.m_gssapiHostName = mir_wstrdup(XmlGetText(c));
}
}
}
}
- else if (!mir_tstrcmp(XmlGetName(n), L"register")) isRegisterAvailable = true;
- else if (!mir_tstrcmp(XmlGetName(n), L"auth")) m_AuthMechs.isAuthAvailable = true;
- else if (!mir_tstrcmp(XmlGetName(n), L"session")) m_AuthMechs.isSessionAvailable = true;
+ else if (!mir_wstrcmp(XmlGetName(n), L"register")) isRegisterAvailable = true;
+ else if (!mir_wstrcmp(XmlGetName(n), L"auth")) m_AuthMechs.isAuthAvailable = true;
+ else if (!mir_wstrcmp(XmlGetName(n), L"session")) m_AuthMechs.isSessionAvailable = true;
}
if (areMechanismsDefined) {
@@ -773,7 +773,7 @@ void CJabberProto::OnProcessFailure(HXML node, ThreadData *info) const wchar_t *type;
//failure xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\"
if ((type = XmlGetAttrValue(node, L"xmlns")) == NULL) return;
- if (!mir_tstrcmp(type, L"urn:ietf:params:xml:ns:xmpp-sasl")) {
+ if (!mir_wstrcmp(type, L"urn:ietf:params:xml:ns:xmpp-sasl")) {
PerformAuthentication(info);
}
}
@@ -799,13 +799,13 @@ void CJabberProto::OnProcessError(HXML node, ThreadData *info) const wchar_t *name = XmlGetName(n);
const wchar_t *desc = XmlGetText(n);
if (desc)
- pos += mir_sntprintf(buff + pos, 1024 - pos, L"%s: %s\r\n", name, desc);
+ pos += mir_snwprintf(buff + pos, 1024 - pos, L"%s: %s\r\n", name, desc);
else
- pos += mir_sntprintf(buff + pos, 1024 - pos, L"%s\r\n", name);
+ pos += mir_snwprintf(buff + pos, 1024 - pos, L"%s\r\n", name);
- if (!mir_tstrcmp(name, L"conflict"))
+ if (!mir_wstrcmp(name, L"conflict"))
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_OTHERLOCATION);
- else if (!mir_tstrcmp(name, L"see-other-host")) {
+ else if (!mir_wstrcmp(name, L"see-other-host")) {
skipMsg = true;
}
}
@@ -823,14 +823,14 @@ void CJabberProto::OnProcessSuccess(HXML node, ThreadData *info) if ((type = XmlGetAttrValue(node, L"xmlns")) == NULL)
return;
- if (!mir_tstrcmp(type, L"urn:ietf:params:xml:ns:xmpp-sasl")) {
+ if (!mir_wstrcmp(type, L"urn:ietf:params:xml:ns:xmpp-sasl")) {
if (!info->auth->validateLogin(XmlGetText(node))) {
info->send("</stream:stream>");
return;
}
debugLogA("Success: Logged-in.");
- ptrT tszNick(getTStringA("Nick"));
+ ptrW tszNick(getTStringA("Nick"));
if (tszNick == NULL)
setTString("Nick", info->conn.username);
@@ -846,7 +846,7 @@ void CJabberProto::OnProcessChallenge(HXML node, ThreadData *info) return;
}
- if (mir_tstrcmp(XmlGetAttrValue(node, L"xmlns"), L"urn:ietf:params:xml:ns:xmpp-sasl"))
+ if (mir_wstrcmp(XmlGetAttrValue(node, L"xmlns"), L"urn:ietf:params:xml:ns:xmpp-sasl"))
return;
char* challenge = info->auth->getChallenge(XmlGetText(node));
@@ -858,34 +858,34 @@ void CJabberProto::OnProcessProtocol(HXML node, ThreadData *info) {
OnConsoleProcessXml(node, JCPF_IN);
- if (!mir_tstrcmp(XmlGetName(node), L"proceed"))
+ if (!mir_wstrcmp(XmlGetName(node), L"proceed"))
OnProcessProceed(node, info);
- else if (!mir_tstrcmp(XmlGetName(node), L"compressed"))
+ else if (!mir_wstrcmp(XmlGetName(node), L"compressed"))
OnProcessCompressed(node, info);
- else if (!mir_tstrcmp(XmlGetName(node), L"stream:features"))
+ else if (!mir_wstrcmp(XmlGetName(node), L"stream:features"))
OnProcessFeatures(node, info);
- else if (!mir_tstrcmp(XmlGetName(node), L"stream:stream"))
+ else if (!mir_wstrcmp(XmlGetName(node), L"stream:stream"))
OnProcessStreamOpening(node, info);
- else if (!mir_tstrcmp(XmlGetName(node), L"success"))
+ else if (!mir_wstrcmp(XmlGetName(node), L"success"))
OnProcessSuccess(node, info);
- else if (!mir_tstrcmp(XmlGetName(node), L"failure"))
+ else if (!mir_wstrcmp(XmlGetName(node), L"failure"))
OnProcessFailure(node, info);
- else if (!mir_tstrcmp(XmlGetName(node), L"stream:error"))
+ else if (!mir_wstrcmp(XmlGetName(node), L"stream:error"))
OnProcessError(node, info);
- else if (!mir_tstrcmp(XmlGetName(node), L"challenge"))
+ else if (!mir_wstrcmp(XmlGetName(node), L"challenge"))
OnProcessChallenge(node, info);
else if (!info->bIsReg) {
- if (!mir_tstrcmp(XmlGetName(node), L"message"))
+ if (!mir_wstrcmp(XmlGetName(node), L"message"))
OnProcessMessage(node, info);
- else if (!mir_tstrcmp(XmlGetName(node), L"presence"))
+ else if (!mir_wstrcmp(XmlGetName(node), L"presence"))
OnProcessPresence(node, info);
- else if (!mir_tstrcmp(XmlGetName(node), L"iq"))
+ else if (!mir_wstrcmp(XmlGetName(node), L"iq"))
OnProcessIq(node);
else
debugLogA("Invalid top-level tag (only <message/> <presence/> and <iq/> allowed)");
}
else {
- if (!mir_tstrcmp(XmlGetName(node), L"iq"))
+ if (!mir_wstrcmp(XmlGetName(node), L"iq"))
OnProcessRegIq(node, info);
else
debugLogA("Invalid top-level tag (only <iq/> allowed)");
@@ -895,10 +895,10 @@ void CJabberProto::OnProcessProtocol(HXML node, ThreadData *info) void CJabberProto::OnProcessProceed(HXML node, ThreadData *info)
{
const wchar_t *type;
- if ((type = XmlGetAttrValue(node, L"xmlns")) != NULL && !mir_tstrcmp(type, L"error"))
+ if ((type = XmlGetAttrValue(node, L"xmlns")) != NULL && !mir_wstrcmp(type, L"error"))
return;
- if (!mir_tstrcmp(type, L"urn:ietf:params:xml:ns:xmpp-tls")) {
+ if (!mir_wstrcmp(type, L"urn:ietf:params:xml:ns:xmpp-tls")) {
debugLogA("Starting TLS...");
char* gtlk = strstr(info->conn.manualHost, "google.com");
@@ -923,9 +923,9 @@ void CJabberProto::OnProcessCompressed(HXML node, ThreadData *info) debugLogA("Compression confirmed");
const wchar_t *type = XmlGetAttrValue(node, L"xmlns");
- if (type != NULL && !mir_tstrcmp(type, L"error"))
+ if (type != NULL && !mir_wstrcmp(type, L"error"))
return;
- if (mir_tstrcmp(type, L"http://jabber.org/protocol/compress"))
+ if (mir_wstrcmp(type, L"http://jabber.org/protocol/compress"))
return;
debugLogA("Starting Zlib stream compression...");
@@ -974,7 +974,7 @@ void CJabberProto::OnProcessPubsubEvent(HXML node) szLengthInTime[0] = 0;
if (szLength) {
int nLength = _wtoi(szLength);
- mir_sntprintf(szLengthInTime, L"%02d:%02d:%02d", nLength / 3600, (nLength / 60) % 60, nLength % 60);
+ mir_snwprintf(szLengthInTime, L"%02d:%02d:%02d", nLength / 3600, (nLength / 60) % 60, nLength % 60);
}
SetContactTune(hContact, szArtist, szLength ? szLengthInTime : NULL, szSource, szTitle, szTrack);
@@ -1006,7 +1006,7 @@ DWORD JabberGetLastContactMessageTime(MCONTACT hContact) MCONTACT CJabberProto::CreateTemporaryContact(const wchar_t *szJid, JABBER_LIST_ITEM* chatItem)
{
if (chatItem == NULL)
- return DBCreateContact(szJid, ptrT(JabberNickFromJID(szJid)), true, true);
+ return DBCreateContact(szJid, ptrW(JabberNickFromJID(szJid)), true, true);
const wchar_t *p = wcschr(szJid, '/');
if (p != NULL && p[1] != '\0')
@@ -1026,7 +1026,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) {
HXML xNode, n;
- if (!XmlGetName(node) || mir_tstrcmp(XmlGetName(node), L"message"))
+ if (!XmlGetName(node) || mir_wstrcmp(XmlGetName(node), L"message"))
return;
LPCTSTR from, type = XmlGetAttrValue(node, L"type");
@@ -1037,7 +1037,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) pResourceStatus pFromResource(ResourceInfoFromJID(from));
// Message receipts delivery request. Reply here, before a call to HandleMessagePermanent() to make sure message receipts are handled for external plugins too.
- if ((!type || mir_tstrcmpi(type, L"error")) && XmlGetChildByTag(node, "request", "xmlns", JABBER_FEAT_MESSAGE_RECEIPTS)) {
+ if ((!type || mir_wstrcmpi(type, L"error")) && XmlGetChildByTag(node, "request", "xmlns", JABBER_FEAT_MESSAGE_RECEIPTS)) {
info->send(
XmlNode(L"message") << XATTR(L"to", from) << XATTR(L"id", idStr)
<< XCHILDNS(L"received", JABBER_FEAT_MESSAGE_RECEIPTS) << XATTR(L"id", idStr));
@@ -1067,15 +1067,15 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) LPCTSTR ptszSubject = XmlGetText(XmlGetChild(node, "subject"));
if (ptszSubject && *ptszSubject) {
- size_t cbLen = (szMessage ? mir_tstrlen(szMessage) : 0) + mir_tstrlen(ptszSubject) + 128;
+ size_t cbLen = (szMessage ? mir_wstrlen(szMessage) : 0) + mir_wstrlen(ptszSubject) + 128;
wchar_t *szTmp = (wchar_t *)alloca(sizeof(wchar_t) * cbLen);
szTmp[0] = 0;
if (szMessage)
- mir_tstrcat(szTmp, L"Subject: ");
- mir_tstrcat(szTmp, ptszSubject);
+ mir_wstrcat(szTmp, L"Subject: ");
+ mir_wstrcat(szTmp, ptszSubject);
if (szMessage) {
- mir_tstrcat(szTmp, L"\r\n");
- mir_tstrcat(szTmp, szMessage);
+ mir_wstrcat(szTmp, L"\r\n");
+ mir_wstrcat(szTmp, szMessage);
}
szMessage = szTmp;
}
@@ -1085,9 +1085,9 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) if (addressNode) {
const wchar_t *szJid = XmlGetAttrValue(addressNode, L"jid");
if (szJid) {
- size_t cbLen = mir_tstrlen(szMessage) + 1000;
+ size_t cbLen = mir_wstrlen(szMessage) + 1000;
wchar_t *p = (wchar_t*)alloca(sizeof(wchar_t) * cbLen);
- mir_sntprintf(p, cbLen, TranslateT("Message redirected from: %s\r\n%s"), from, szMessage);
+ mir_snwprintf(p, cbLen, TranslateT("Message redirected from: %s\r\n%s"), from, szMessage);
szMessage = p;
from = szJid;
// rewrite hContact
@@ -1173,13 +1173,13 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) memset(pParams, 0, sizeof(CJabberHttpAuthParams));
pParams->m_nType = CJabberHttpAuthParams::MSG;
- pParams->m_szFrom = mir_tstrdup(from);
+ pParams->m_szFrom = mir_wstrdup(from);
LPCTSTR ptszThread = XmlGetText(XmlGetChild(node, "thread"));
if (ptszThread && *ptszThread)
- pParams->m_szThreadId = mir_tstrdup(ptszThread);
- pParams->m_szId = mir_tstrdup(szId);
- pParams->m_szMethod = mir_tstrdup(szMethod);
- pParams->m_szUrl = mir_tstrdup(szUrl);
+ pParams->m_szThreadId = mir_wstrdup(ptszThread);
+ pParams->m_szId = mir_wstrdup(szId);
+ pParams->m_szMethod = mir_wstrdup(szMethod);
+ pParams->m_szUrl = mir_wstrdup(szUrl);
AddClistHttpAuthEvent(pParams);
return;
@@ -1194,11 +1194,11 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) if (ptszXmlns == NULL)
continue;
- if (!mir_tstrcmp(ptszXmlns, JABBER_FEAT_MIRANDA_NOTES)) {
+ if (!mir_wstrcmp(ptszXmlns, JABBER_FEAT_MIRANDA_NOTES)) {
if (OnIncomingNote(from, XmlGetChild(xNode, "note")))
return;
}
- else if (!mir_tstrcmp(ptszXmlns, L"jabber:x:encrypted")) {
+ else if (!mir_wstrcmp(ptszXmlns, L"jabber:x:encrypted")) {
LPCTSTR ptszText = XmlGetText(xNode);
if (ptszText == NULL)
return;
@@ -1213,25 +1213,25 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) wchar_t *tempstring = nullptr;
if(!wcsstr(ptszText, prolog))
{
- len = mir_tstrlen(prolog) + mir_tstrlen(prolog_newline) + mir_tstrlen(ptszText) + mir_tstrlen(epilog) + 3;
+ len = mir_wstrlen(prolog) + mir_wstrlen(prolog_newline) + mir_wstrlen(ptszText) + mir_wstrlen(epilog) + 3;
tempstring = (wchar_t*)_alloca(sizeof(wchar_t)*len);
- mir_sntprintf(tempstring, len, L"%s%s%s%s", prolog, prolog_newline, ptszText, epilog);
+ mir_snwprintf(tempstring, len, L"%s%s%s%s", prolog, prolog_newline, ptszText, epilog);
}
else
{
- len = mir_tstrlen(ptszText) + 3;
+ len = mir_wstrlen(ptszText) + 3;
tempstring = (wchar_t*)_alloca(sizeof(wchar_t)*len);
- mir_sntprintf(tempstring, len, L"%s", ptszText);
+ mir_snwprintf(tempstring, len, L"%s", ptszText);
}
szMessage = tempstring;
}
- else if (!mir_tstrcmp(ptszXmlns, JABBER_FEAT_DELAY) && msgTime == 0) {
+ else if (!mir_wstrcmp(ptszXmlns, JABBER_FEAT_DELAY) && msgTime == 0) {
const wchar_t *ptszTimeStamp = XmlGetAttrValue(xNode, L"stamp");
if (ptszTimeStamp != NULL)
msgTime = JabberIsoToUnixTime(ptszTimeStamp);
}
- else if (!mir_tstrcmp(ptszXmlns, JABBER_FEAT_MESSAGE_EVENTS)) {
+ else if (!mir_wstrcmp(ptszXmlns, JABBER_FEAT_MESSAGE_EVENTS)) {
// set events support only if we discovered caps and if events not already set
JabberCapsBits jcbCaps = GetResourceCapabilites(from, TRUE);
@@ -1275,24 +1275,24 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) if (item != NULL && XmlGetChild(xNode, "composing") != NULL) {
if (item->messageEventIdStr)
mir_free(item->messageEventIdStr);
- item->messageEventIdStr = (idStr == NULL) ? NULL : mir_tstrdup(idStr);
+ item->messageEventIdStr = (idStr == NULL) ? NULL : mir_wstrdup(idStr);
}
}
}
- else if (!mir_tstrcmp(ptszXmlns, JABBER_FEAT_OOB2)) {
+ else if (!mir_wstrcmp(ptszXmlns, JABBER_FEAT_OOB2)) {
LPCTSTR ptszUrl = XmlGetText(XmlGetChild(xNode, "url"));
if (ptszUrl != NULL && *ptszUrl) {
- size_t cbLen = (szMessage ? mir_tstrlen(szMessage) : 0) + mir_tstrlen(ptszUrl) + 32;
+ size_t cbLen = (szMessage ? mir_wstrlen(szMessage) : 0) + mir_wstrlen(ptszUrl) + 32;
wchar_t *szTmp = (wchar_t *)alloca(sizeof(wchar_t)* cbLen);
- mir_tstrcpy(szTmp, ptszUrl);
+ mir_wstrcpy(szTmp, ptszUrl);
if (szMessage) {
- mir_tstrcat(szTmp, L"\r\n");
- mir_tstrcat(szTmp, szMessage);
+ mir_wstrcat(szTmp, L"\r\n");
+ mir_wstrcat(szTmp, szMessage);
}
szMessage = szTmp;
}
}
- else if (!mir_tstrcmp(ptszXmlns, JABBER_FEAT_MUC_USER)) {
+ else if (!mir_wstrcmp(ptszXmlns, JABBER_FEAT_MUC_USER)) {
HXML inviteNode = XmlGetChild(xNode, L"invite");
if (inviteNode != NULL) {
inviteFromJid = XmlGetAttrValue(inviteNode, L"from");
@@ -1304,7 +1304,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) invitePassword = XmlGetText(XmlGetChild(xNode, "password"));
}
}
- else if (!mir_tstrcmp(ptszXmlns, JABBER_FEAT_ROSTER_EXCHANGE) &&
+ else if (!mir_wstrcmp(ptszXmlns, JABBER_FEAT_ROSTER_EXCHANGE) &&
item != NULL && (item->subscription == SUB_BOTH || item->subscription == SUB_TO)) {
wchar_t chkJID[JABBER_MAX_JID_LEN] = L"@";
JabberStripJid(from, chkJID + 1, _countof(chkJID) - 1);
@@ -1318,12 +1318,12 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) const wchar_t *nick = XmlGetAttrValue(iNode, L"name");
const wchar_t *group = XmlGetText(XmlGetChild(iNode, L"group"));
if (action && jid && wcsstr(jid, chkJID)) {
- if (!mir_tstrcmp(action, L"add")) {
+ if (!mir_wstrcmp(action, L"add")) {
MCONTACT cc = DBCreateContact(jid, nick, false, false);
if (group)
db_set_ts(cc, "CList", "Group", group);
}
- else if (!mir_tstrcmp(action, L"delete")) {
+ else if (!mir_wstrcmp(action, L"delete")) {
MCONTACT cc = HContactFromJID(jid);
if (cc)
CallService(MS_DB_CONTACT_DELETE, cc, 0);
@@ -1331,7 +1331,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) }
}
}
- else if (!isChatRoomInvitation && !mir_tstrcmp(ptszXmlns, JABBER_FEAT_DIRECT_MUC_INVITE)) {
+ else if (!isChatRoomInvitation && !mir_wstrcmp(ptszXmlns, JABBER_FEAT_DIRECT_MUC_INVITE)) {
inviteRoomJid = XmlGetAttrValue(xNode, L"jid");
inviteFromJid = from;
if (inviteReason == NULL)
@@ -1422,9 +1422,9 @@ void CJabberProto::OnProcessPresenceCapabilites(HXML node) const wchar_t *szVer = XmlGetAttrValue(n, L"ver");
const wchar_t *szExt = XmlGetAttrValue(n, L"ext");
if (szNode && szVer) {
- r->m_tszCapsNode = mir_tstrdup(szNode);
- r->m_tszCapsVer = mir_tstrdup(szVer);
- r->m_tszCapsExt = mir_tstrdup(szExt);
+ r->m_tszCapsNode = mir_wstrdup(szNode);
+ r->m_tszCapsVer = mir_wstrdup(szVer);
+ r->m_tszCapsExt = mir_wstrdup(szExt);
MCONTACT hContact = HContactFromJID(from);
if (hContact)
UpdateMirVer(hContact, r);
@@ -1497,7 +1497,7 @@ void CJabberProto::UpdateJidDbSettings(const wchar_t *jid) void CJabberProto::OnProcessPresence(HXML node, ThreadData *info)
{
- if (!node || !XmlGetName(node) || mir_tstrcmp(XmlGetName(node), L"presence"))
+ if (!node || !XmlGetName(node) || mir_wstrcmp(XmlGetName(node), L"presence"))
return;
LPCTSTR from = XmlGetAttrValue(node, L"from");
@@ -1519,17 +1519,17 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) wchar_t szBareOurJid[JABBER_MAX_JID_LEN];
JabberStripJid(info->fullJID, szBareOurJid, _countof(szBareOurJid));
- if (!mir_tstrcmpi(szBareFrom, szBareOurJid))
+ if (!mir_wstrcmpi(szBareFrom, szBareOurJid))
bSelfPresence = true;
LPCTSTR type = XmlGetAttrValue(node, L"type");
- if (type == NULL || !mir_tstrcmp(type, L"available")) {
- ptrT nick(JabberNickFromJID(from));
+ if (type == NULL || !mir_wstrcmp(type, L"available")) {
+ ptrW nick(JabberNickFromJID(from));
if (nick == NULL)
return;
if ((hContact = HContactFromJID(from)) == NULL) {
- if (!mir_tstrcmpi(info->fullJID, from) || (!bSelfPresence && !ListGetItemPtr(LIST_ROSTER, from))) {
+ if (!mir_wstrcmpi(info->fullJID, from) || (!bSelfPresence && !ListGetItemPtr(LIST_ROSTER, from))) {
debugLog(L"SKIP Receive presence online from %s (who is not in my roster and not in list - skiping)", from);
return;
}
@@ -1543,10 +1543,10 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) int status = ID_STATUS_ONLINE;
if (HXML showNode = XmlGetChild(node, "show")) {
if (LPCTSTR show = XmlGetText(showNode)) {
- if (!mir_tstrcmp(show, L"away")) status = ID_STATUS_AWAY;
- else if (!mir_tstrcmp(show, L"xa")) status = ID_STATUS_NA;
- else if (!mir_tstrcmp(show, L"dnd")) status = ID_STATUS_DND;
- else if (!mir_tstrcmp(show, L"chat")) status = ID_STATUS_FREECHAT;
+ if (!mir_wstrcmp(show, L"away")) status = ID_STATUS_AWAY;
+ else if (!mir_wstrcmp(show, L"xa")) status = ID_STATUS_NA;
+ else if (!mir_wstrcmp(show, L"dnd")) status = ID_STATUS_DND;
+ else if (!mir_wstrcmp(show, L"chat")) status = ID_STATUS_FREECHAT;
}
}
@@ -1572,15 +1572,15 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) debugLogA("Avatar enabled");
for (int i = 1; (xNode = XmlGetNthChild(node, L"x", i)) != NULL; i++) {
- if (!mir_tstrcmp(XmlGetAttrValue(xNode, L"xmlns"), L"jabber:x:avatar")) {
+ if (!mir_wstrcmp(XmlGetAttrValue(xNode, L"xmlns"), L"jabber:x:avatar")) {
LPCTSTR ptszHash = XmlGetText(XmlGetChild(xNode, "hash"));
if (ptszHash != NULL) {
delSetting(hContact, "AvatarXVcard");
debugLogA("AvatarXVcard deleted");
setTString(hContact, "AvatarHash", ptszHash);
bHasAvatar = true;
- ptrT saved(getTStringA(hContact, "AvatarSaved"));
- if (saved == NULL || mir_tstrcmp(saved, ptszHash)) {
+ ptrW saved(getTStringA(hContact, "AvatarSaved"));
+ if (saved == NULL || mir_wstrcmp(saved, ptszHash)) {
debugLogA("Avatar was changed");
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, NULL);
}
@@ -1591,7 +1591,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) if (!bHasAvatar) { //no jabber:x:avatar. try vcard-temp:x:update
debugLogA("Not hasXAvatar");
for (int i = 1; (xNode = XmlGetNthChild(node, L"x", i)) != NULL; i++) {
- if (!mir_tstrcmp(XmlGetAttrValue(xNode, L"xmlns"), L"vcard-temp:x:update")) {
+ if (!mir_wstrcmp(XmlGetAttrValue(xNode, L"xmlns"), L"vcard-temp:x:update")) {
if ((xNode = XmlGetChild(xNode, "photo")) != NULL) {
LPCTSTR txt = XmlGetText(xNode);
if (txt != NULL && txt[0] != 0) {
@@ -1599,8 +1599,8 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) debugLogA("AvatarXVcard set");
setTString(hContact, "AvatarHash", txt);
bHasAvatar = true;
- ptrT saved(getTStringA(hContact, "AvatarSaved"));
- if (saved == NULL || mir_tstrcmp(saved, txt)) {
+ ptrW saved(getTStringA(hContact, "AvatarSaved"));
+ if (saved == NULL || mir_wstrcmp(saved, txt)) {
debugLogA("Avatar was changed. Using vcard-temp:x:update");
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, NULL);
}
@@ -1612,14 +1612,14 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) debugLogA("Has no avatar");
delSetting(hContact, "AvatarHash");
- if (ptrT(getTStringA(hContact, "AvatarSaved")) != NULL) {
+ if (ptrW(getTStringA(hContact, "AvatarSaved")) != NULL) {
delSetting(hContact, "AvatarSaved");
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, NULL, NULL);
} } }
return;
}
- if (!mir_tstrcmp(type, L"unavailable")) {
+ if (!mir_wstrcmp(type, L"unavailable")) {
hContact = HContactFromJID(from);
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, from);
if (item != NULL) {
@@ -1636,7 +1636,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) // set status only if no more available resources
if (!item->arResources.getCount()) {
item->getTemp()->m_iStatus = ID_STATUS_OFFLINE;
- item->getTemp()->m_tszStatusMessage = mir_tstrdup(XmlGetText(XmlGetChild(node, "status")));
+ item->getTemp()->m_tszStatusMessage = mir_wstrdup(XmlGetText(XmlGetChild(node, "status")));
}
}
else debugLog(L"SKIP Receive presence offline from %s (who is not in my roster)", from);
@@ -1650,17 +1650,17 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) return;
}
- if (!mir_tstrcmp(type, L"subscribe")) {
+ if (!mir_wstrcmp(type, L"subscribe")) {
if (hContact = HContactFromJID(from))
AddDbPresenceEvent(hContact, JABBER_DB_EVENT_PRESENCE_SUBSCRIBE);
- ptrT tszNick(JabberNickFromJID(from));
+ ptrW tszNick(JabberNickFromJID(from));
HXML xNick = XmlGetChildByTag(node, "nick", "xmlns", JABBER_FEAT_NICK);
if (xNick != NULL) {
LPCTSTR xszNick = XmlGetText(xNick);
if (xszNick != NULL && *xszNick) {
debugLog(L"Grabbed nick from presence: %s", xszNick);
- tszNick = mir_tstrdup(xszNick);
+ tszNick = mir_wstrdup(xszNick);
}
}
@@ -1690,19 +1690,19 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) return;
}
- if (!mir_tstrcmp(type, L"unsubscribe"))
+ if (!mir_wstrcmp(type, L"unsubscribe"))
if (hContact = HContactFromJID(from))
AddDbPresenceEvent(hContact, JABBER_DB_EVENT_PRESENCE_UNSUBSCRIBE);
- if (!mir_tstrcmp(type, L"unsubscribed"))
+ if (!mir_wstrcmp(type, L"unsubscribed"))
if (hContact = HContactFromJID(from))
AddDbPresenceEvent(hContact, JABBER_DB_EVENT_PRESENCE_UNSUBSCRIBED);
- if (!mir_tstrcmp(type, L"error"))
+ if (!mir_wstrcmp(type, L"error"))
if (hContact = HContactFromJID(from))
AddDbPresenceEvent(hContact, JABBER_DB_EVENT_PRESENCE_ERROR);
- if (!mir_tstrcmp(type, L"subscribed")) {
+ if (!mir_wstrcmp(type, L"subscribed")) {
if (hContact = HContactFromJID(from))
AddDbPresenceEvent(hContact, JABBER_DB_EVENT_PRESENCE_SUBSCRIBED);
@@ -1736,11 +1736,11 @@ void CJabberProto::OnIqResultVersion(HXML /*node*/, CJabberIqInfo *pInfo) if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT && queryNode) {
HXML n;
if ((n = XmlGetChild(queryNode, "name")) != NULL && XmlGetText(n))
- r->m_tszSoftware = mir_tstrdup(XmlGetText(n));
+ r->m_tszSoftware = mir_wstrdup(XmlGetText(n));
if ((n = XmlGetChild(queryNode, "version")) != NULL && XmlGetText(n))
- r->m_tszSoftwareVersion = mir_tstrdup(XmlGetText(n));
+ r->m_tszSoftwareVersion = mir_wstrdup(XmlGetText(n));
if ((n = XmlGetChild(queryNode, "os")) != NULL && XmlGetText(n))
- r->m_tszOs = mir_tstrdup(XmlGetText(n));
+ r->m_tszOs = mir_wstrdup(XmlGetText(n));
}
GetResourceCapabilites(pInfo->GetFrom(), TRUE);
@@ -1757,11 +1757,11 @@ BOOL CJabberProto::OnProcessJingle(HXML node) if (child) {
if ((type = XmlGetAttrValue(node, L"type")) == NULL) return FALSE;
- if ((!mir_tstrcmp(type, L"get") || !mir_tstrcmp(type, L"set"))) {
+ if ((!mir_wstrcmp(type, L"get") || !mir_wstrcmp(type, L"set"))) {
LPCTSTR szAction = XmlGetAttrValue(child, L"action");
LPCTSTR idStr = XmlGetAttrValue(node, L"id");
LPCTSTR from = XmlGetAttrValue(node, L"from");
- if (szAction && !mir_tstrcmp(szAction, L"session-initiate")) {
+ if (szAction && !mir_wstrcmp(szAction, L"session-initiate")) {
// if this is a Jingle 'session-initiate' and noone processed it yet, reply with "unsupported-applications"
m_ThreadInfo->send(XmlNodeIq(L"result", idStr, from));
@@ -1801,7 +1801,7 @@ void CJabberProto::OnProcessIq(HXML node) HXML queryNode;
const wchar_t *type, *xmlns;
- if (!XmlGetName(node) || mir_tstrcmp(XmlGetName(node), L"iq")) return;
+ if (!XmlGetName(node) || mir_wstrcmp(XmlGetName(node), L"iq")) return;
if ((type = XmlGetAttrValue(node, L"type")) == NULL) return;
int id = JabberGetPacketID(node);
@@ -1822,7 +1822,7 @@ void CJabberProto::OnProcessIq(HXML node) return;
// RECVED: <iq type='error'> ...
- if (!mir_tstrcmp(type, L"error")) {
+ if (!mir_wstrcmp(type, L"error")) {
wchar_t tszBuf[20];
_itow(id, tszBuf, 10);
@@ -1831,7 +1831,7 @@ void CJabberProto::OnProcessIq(HXML node) LISTFOREACH(i, this, LIST_FILE)
{
JABBER_LIST_ITEM *item = ListGetItemPtrFromIndex(i);
- if (item->ft != NULL && item->ft->state == FT_CONNECTING && !mir_tstrcmp(tszBuf, item->ft->szId)) {
+ if (item->ft != NULL && item->ft->state == FT_CONNECTING && !mir_wstrcmp(tszBuf, item->ft->szId)) {
debugLogA("Denying file sending request");
item->ft->state = FT_DENIED;
if (item->ft->hFileEvent != NULL)
@@ -1839,7 +1839,7 @@ void CJabberProto::OnProcessIq(HXML node) }
}
}
- else if ((!mir_tstrcmp(type, L"get") || !mir_tstrcmp(type, L"set"))) {
+ else if ((!mir_wstrcmp(type, L"get") || !mir_wstrcmp(type, L"set"))) {
XmlNodeIq iq(L"error", id, XmlGetAttrValue(node, L"from"));
HXML pFirstChild = XmlGetChild(node, 0);
@@ -1857,7 +1857,7 @@ void CJabberProto::SetRegConfig(HXML node, void *from) {
if (m_regInfo && from) {
wchar_t text[MAX_PATH];
- mir_sntprintf(text, L"%s@%S", m_regInfo->conn.username, m_regInfo->conn.server);
+ mir_snwprintf(text, L"%s@%S", m_regInfo->conn.username, m_regInfo->conn.server);
XmlNodeIq iq(L"set", SerialNext(), (wchar_t*)from);
iq << XATTR(L"from", text);
HXML query = iq << XQUERY(JABBER_FEAT_REGISTER);
@@ -1868,7 +1868,7 @@ void CJabberProto::SetRegConfig(HXML node, void *from) void CJabberProto::OnProcessRegIq(HXML node, ThreadData *info)
{
- if (!XmlGetName(node) || mir_tstrcmp(XmlGetName(node), L"iq")) return;
+ if (!XmlGetName(node) || mir_wstrcmp(XmlGetName(node), L"iq")) return;
LPCTSTR type = XmlGetAttrValue(node, L"type");
if (type == NULL)
return;
@@ -1879,17 +1879,17 @@ void CJabberProto::OnProcessRegIq(HXML node, ThreadData *info) if (from == NULL)
return;
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
HXML queryNode = XmlGetChild(node, L"query");
if (queryNode != NULL) {
LPCTSTR str = XmlGetAttrValue(queryNode, L"xmlns");
- if (!mir_tstrcmp(str, JABBER_FEAT_REGISTER)) {
+ if (!mir_wstrcmp(str, JABBER_FEAT_REGISTER)) {
HXML xNode = XmlGetChild(queryNode, L"x");
if (xNode != NULL) {
str = XmlGetAttrValue(xNode, L"xmlns");
- if (!mir_tstrcmp(str, JABBER_FEAT_DATA_FORMS)) {
+ if (!mir_wstrcmp(str, JABBER_FEAT_DATA_FORMS)) {
m_regInfo = info;
- FormCreateDialog(xNode, L"Jabber register new user", &CJabberProto::SetRegConfig, mir_tstrdup(from));
+ FormCreateDialog(xNode, L"Jabber register new user", &CJabberProto::SetRegConfig, mir_wstrdup(from));
return;
}
}
@@ -1917,7 +1917,7 @@ void CJabberProto::OnProcessRegIq(HXML node, ThreadData *info) }
}
- else if (!mir_tstrcmp(type, L"error")) {
+ else if (!mir_wstrcmp(type, L"error")) {
wchar_t *str = JabberErrorMsg(XmlGetChild(node, "error"));
SendMessage(info->conn.reg_hwndDlg, WM_JABBER_REGDLG_UPDATE, 100, (LPARAM)str);
mir_free(str);
diff --git a/protocols/JabberG/src/jabber_treelist.cpp b/protocols/JabberG/src/jabber_treelist.cpp index c3d2bdb878..2321ee9b3f 100644 --- a/protocols/JabberG/src/jabber_treelist.cpp +++ b/protocols/JabberG/src/jabber_treelist.cpp @@ -183,7 +183,7 @@ void TreeList_SetFilter(HWND hwnd, wchar_t *filter) TTreeList_Data *data = (TTreeList_Data *)sttTreeList_GeWindowData(hwnd);
if (data->filter) mir_free(data->filter);
data->filter = NULL;
- if (filter) data->filter = mir_tstrdup(filter);
+ if (filter) data->filter = mir_wstrdup(filter);
TreeList_Update(hwnd);
}
@@ -207,7 +207,7 @@ HTREELISTITEM TreeList_AddItem(HWND hwnd, HTREELISTITEM hParent, wchar_t *text, TTreeList_ItemInfo *item = new TTreeList_ItemInfo;
item->data = nodeDdata;
item->parent = hParent;
- item->text.insert(mir_tstrdup(text));
+ item->text.insert(mir_wstrdup(text));
item->flags |= TLIF_MODIFIED;
if (hParent->flags & TLIF_ROOT) {
item->flags |= TLIF_EXPANDED;
@@ -241,7 +241,7 @@ void TreeList_MakeFakeParent(HTREELISTITEM hItem, BOOL flag) void TreeList_AppendColumn(HTREELISTITEM hItem, wchar_t *text)
{
- hItem->text.insert(mir_tstrdup(text));
+ hItem->text.insert(mir_wstrdup(text));
hItem->flags |= TLIF_MODIFIED;
}
@@ -469,12 +469,12 @@ BOOL TreeList_ProcessMessage(HWND hwnd, UINT msg, WPARAM, LPARAM lparam, UINT id }
///////////////////////////////////////////////////////////////////////////
-static int sttTreeList_SortItems_Cmp0(const void *p1, const void *p2) { return mir_tstrcmp((*(HTREELISTITEM *)p1)->text[0], (*(HTREELISTITEM *)p2)->text[0]); }
-static int sttTreeList_SortItems_Cmp1(const void *p1, const void *p2) { return -mir_tstrcmp((*(HTREELISTITEM *)p1)->text[0], (*(HTREELISTITEM *)p2)->text[0]); }
-static int sttTreeList_SortItems_Cmp2(const void *p1, const void *p2) { return mir_tstrcmp((*(HTREELISTITEM *)p1)->text[1], (*(HTREELISTITEM *)p2)->text[1]); }
-static int sttTreeList_SortItems_Cmp3(const void *p1, const void *p2) { return -mir_tstrcmp((*(HTREELISTITEM *)p1)->text[1], (*(HTREELISTITEM *)p2)->text[1]); }
-static int sttTreeList_SortItems_Cmp4(const void *p1, const void *p2) { return mir_tstrcmp((*(HTREELISTITEM *)p1)->text[2], (*(HTREELISTITEM *)p2)->text[2]); }
-static int sttTreeList_SortItems_Cmp5(const void *p1, const void *p2) { return -mir_tstrcmp((*(HTREELISTITEM *)p1)->text[2], (*(HTREELISTITEM *)p2)->text[2]); }
+static int sttTreeList_SortItems_Cmp0(const void *p1, const void *p2) { return mir_wstrcmp((*(HTREELISTITEM *)p1)->text[0], (*(HTREELISTITEM *)p2)->text[0]); }
+static int sttTreeList_SortItems_Cmp1(const void *p1, const void *p2) { return -mir_wstrcmp((*(HTREELISTITEM *)p1)->text[0], (*(HTREELISTITEM *)p2)->text[0]); }
+static int sttTreeList_SortItems_Cmp2(const void *p1, const void *p2) { return mir_wstrcmp((*(HTREELISTITEM *)p1)->text[1], (*(HTREELISTITEM *)p2)->text[1]); }
+static int sttTreeList_SortItems_Cmp3(const void *p1, const void *p2) { return -mir_wstrcmp((*(HTREELISTITEM *)p1)->text[1], (*(HTREELISTITEM *)p2)->text[1]); }
+static int sttTreeList_SortItems_Cmp4(const void *p1, const void *p2) { return mir_wstrcmp((*(HTREELISTITEM *)p1)->text[2], (*(HTREELISTITEM *)p2)->text[2]); }
+static int sttTreeList_SortItems_Cmp5(const void *p1, const void *p2) { return -mir_wstrcmp((*(HTREELISTITEM *)p1)->text[2], (*(HTREELISTITEM *)p2)->text[2]); }
static void sttTreeList_SortItems(HTREELISTITEM hItem, LPARAM data)
{
diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp index 6b0907a7b3..4a0f6e0046 100644 --- a/protocols/JabberG/src/jabber_userinfo.cpp +++ b/protocols/JabberG/src/jabber_userinfo.cpp @@ -46,12 +46,12 @@ struct UserInfoStringBuf void append(wchar_t *str) { if (!str) return; - size_t length = mir_tstrlen(str); + size_t length = mir_wstrlen(str); if (size - offset < length + 1) { size += (length + STRINGBUF_INCREMENT); buf = (wchar_t *)mir_realloc(buf, size * sizeof(wchar_t)); } - mir_tstrcpy(buf + offset, str); + mir_wstrcpy(buf + offset, str); offset += length; } @@ -64,7 +64,7 @@ struct UserInfoStringBuf } void actualize() { - if (buf) offset = mir_tstrlen(buf); + if (buf) offset = mir_wstrlen(buf); } }; @@ -174,9 +174,9 @@ static HTREEITEM sttFillInfoLine(HWND hwndTree, HTREEITEM htiRoot, HICON hIcon, wchar_t buf[256]; if (title) - mir_sntprintf(buf, L"%s: %s", title, value); + mir_snwprintf(buf, L"%s: %s", title, value); else - mir_tstrncpy(buf, value, _countof(buf)); + mir_wstrncpy(buf, value, _countof(buf)); TVINSERTSTRUCT tvis = {0}; tvis.hParent = htiRoot; @@ -227,7 +227,7 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti HICON hIcon = NULL; if ( ServiceExists(MS_FP_GETCLIENTICONT)) { if (r->m_tszSoftware != NULL) { - mir_sntprintf(buf, L"%s %s", r->m_tszSoftware, r->m_tszSoftwareVersion); + mir_snwprintf(buf, L"%s %s", r->m_tszSoftware, r->m_tszSoftwareVersion); hIcon = Finger_GetClientIcon(buf, 0); } } @@ -251,25 +251,25 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti // Resource priority wchar_t szPriority[128]; - mir_sntprintf(szPriority, L"%d", (int)r->m_iPriority); + mir_snwprintf(szPriority, L"%d", (int)r->m_iPriority); sttFillInfoLine(hwndTree, htiResource, NULL, TranslateT("Resource priority"), szPriority, sttInfoLineId(resource, INFOLINE_PRIORITY)); // Idle if (r->m_dwIdleStartTime > 0) { - mir_tstrncpy(buf, _wctime(&r->m_dwIdleStartTime), _countof(buf)); - size_t len = mir_tstrlen(buf); + mir_wstrncpy(buf, _wctime(&r->m_dwIdleStartTime), _countof(buf)); + size_t len = mir_wstrlen(buf); if (len > 0) buf[len-1] = 0; } else if (!r->m_dwIdleStartTime) - mir_tstrncpy(buf, TranslateT("unknown"), _countof(buf)); + mir_wstrncpy(buf, TranslateT("unknown"), _countof(buf)); else - mir_tstrncpy(buf, TranslateT("<not specified>"), _countof(buf)); + mir_wstrncpy(buf, TranslateT("<not specified>"), _countof(buf)); sttFillInfoLine(hwndTree, htiResource, NULL, TranslateT("Idle since"), buf, sttInfoLineId(resource, INFOLINE_IDLE)); // caps - mir_sntprintf(buf, L"%s/%s", item->jid, r->m_tszResourceName); + mir_snwprintf(buf, L"%s/%s", item->jid, r->m_tszResourceName); JabberCapsBits jcb = ppro->GetResourceCapabilites(buf, TRUE); if (!(jcb & JABBER_RESOURCE_CAPS_ERROR)) { @@ -279,7 +279,7 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti if (jcb & g_JabberFeatCapPairs[i].jcbCap) { wchar_t szDescription[ 1024 ]; if (g_JabberFeatCapPairs[i].tszDescription) - mir_sntprintf(szDescription, L"%s (%s)", TranslateTS(g_JabberFeatCapPairs[i].tszDescription), g_JabberFeatCapPairs[i].szFeature); + mir_snwprintf(szDescription, L"%s (%s)", TranslateTS(g_JabberFeatCapPairs[i].tszDescription), g_JabberFeatCapPairs[i].szFeature); else wcsncpy_s(szDescription, g_JabberFeatCapPairs[i].szFeature, _TRUNCATE); sttFillInfoLine(hwndTree, htiCaps, NULL, NULL, szDescription, sttInfoLineId(resource, INFOLINE_CAPS, i)); @@ -289,7 +289,7 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti if (jcb & ppro->m_lstJabberFeatCapPairsDynamic[j]->jcbCap) { wchar_t szDescription[ 1024 ]; if (ppro->m_lstJabberFeatCapPairsDynamic[j]->szDescription) - mir_sntprintf(szDescription, L"%s (%s)", TranslateTS(ppro->m_lstJabberFeatCapPairsDynamic[j]->szDescription), ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature); + mir_snwprintf(szDescription, L"%s (%s)", TranslateTS(ppro->m_lstJabberFeatCapPairsDynamic[j]->szDescription), ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature); else wcsncpy_s(szDescription, ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature, _TRUNCATE); sttFillInfoLine(hwndTree, htiCaps, NULL, NULL, szDescription, sttInfoLineId(resource, INFOLINE_CAPS, i)); @@ -320,7 +320,7 @@ static void sttFillAdvStatusInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM ht if (szAdvStatusIcon && szAdvStatusTitle && *szAdvStatusTitle) { wchar_t szText[2048]; if (szAdvStatusText && *szAdvStatusText) - mir_sntprintf(szText, L"%s (%s)", TranslateTS(szAdvStatusTitle), szAdvStatusText); + mir_snwprintf(szText, L"%s (%s)", TranslateTS(szAdvStatusTitle), szAdvStatusText); else wcsncpy_s(szText, TranslateTS(szAdvStatusTitle), _TRUNCATE); sttFillInfoLine(hwndTree, htiRoot, IcoLib_GetIcon(szAdvStatusIcon), szTitle, szText, dwInfoLine); @@ -365,15 +365,15 @@ static void sttFillUserInfo(CJabberProto *ppro, HWND hwndTree, JABBER_LIST_ITEM // logoff JABBER_RESOURCE_STATUS *r = item->getTemp(); if (r->m_dwIdleStartTime > 0) { - mir_tstrncpy(buf, _wctime(&r->m_dwIdleStartTime), _countof(buf)); - size_t len = mir_tstrlen(buf); + mir_wstrncpy(buf, _wctime(&r->m_dwIdleStartTime), _countof(buf)); + size_t len = mir_wstrlen(buf); if (len > 0) buf[len-1] = 0; } else if (!r->m_dwIdleStartTime) - mir_tstrncpy(buf, TranslateT("unknown"), _countof(buf)); + mir_wstrncpy(buf, TranslateT("unknown"), _countof(buf)); else - mir_tstrncpy(buf, TranslateT("<not specified>"), _countof(buf)); + mir_wstrncpy(buf, TranslateT("<not specified>"), _countof(buf)); sttFillInfoLine(hwndTree, htiRoot, NULL, (item->jid && wcschr(item->jid, '@')) ? TranslateT("Last logoff time") : TranslateT("Uptime"), buf, @@ -384,9 +384,9 @@ static void sttFillUserInfo(CJabberProto *ppro, HWND hwndTree, JABBER_LIST_ITEM // activity if (item->m_pLastSeenResource) - mir_tstrncpy(buf, item->m_pLastSeenResource->m_tszResourceName, _countof(buf)); + mir_wstrncpy(buf, item->m_pLastSeenResource->m_tszResourceName, _countof(buf)); else - mir_tstrncpy(buf, TranslateT("<no information available>"), _countof(buf)); + mir_wstrncpy(buf, TranslateT("<no information available>"), _countof(buf)); sttFillInfoLine(hwndTree, htiRoot, NULL, TranslateT("Last active resource"), buf, sttInfoLineId(0, INFOLINE_LASTACTIVE)); @@ -470,7 +470,7 @@ static INT_PTR CALLBACK JabberUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa if (dat == NULL) break; if (dat->item == NULL) { - ptrT jid(dat->ppro->getTStringA(dat->hContact, "jid")); + ptrW jid(dat->ppro->getTStringA(dat->hContact, "jid")); if (jid == NULL) break; @@ -560,7 +560,7 @@ static INT_PTR CALLBACK JabberUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa case PSN_PARAMCHANGED: dat->ppro = (CJabberProto*)((PSHNOTIFY*)lParam)->lParam; if (dat->hContact != NULL) { - ptrT jid(dat->ppro->getTStringA(dat->hContact, "jid")); + ptrW jid(dat->ppro->getTStringA(dat->hContact, "jid")); if (jid != NULL) if (!(dat->item = dat->ppro->ListGetItemPtr(LIST_VCARD_TEMP, jid))) dat->item = dat->ppro->ListGetItemPtr(LIST_ROSTER, jid); @@ -642,7 +642,7 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP } ShowWindow(GetDlgItem(hwndDlg, IDC_SAVE), SW_HIDE); { - ptrT jid(photoInfo->ppro->getTStringA(photoInfo->hContact, "jid")); + ptrW jid(photoInfo->ppro->getTStringA(photoInfo->hContact, "jid")); if (jid != NULL) { JABBER_LIST_ITEM *item = photoInfo->ppro->ListGetItemPtr(LIST_VCARD_TEMP, jid); if (item == NULL) @@ -666,7 +666,7 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP case IDC_SAVE: static wchar_t szFilter[512]; - ptrT jid(photoInfo->ppro->getTStringA(photoInfo->hContact, "jid")); + ptrW jid(photoInfo->ppro->getTStringA(photoInfo->hContact, "jid")); if (jid == NULL) break; @@ -677,19 +677,19 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP switch (ProtoGetAvatarFileFormat(item->photoFileName)) { case PA_FORMAT_BMP: - mir_sntprintf(szFilter, L"BMP %s (*.bmp)%c*.BMP", TranslateT("format"), 0); + mir_snwprintf(szFilter, L"BMP %s (*.bmp)%c*.BMP", TranslateT("format"), 0); break; case PA_FORMAT_GIF: - mir_sntprintf(szFilter, L"GIF %s (*.gif)%c*.GIF", TranslateT("format"), 0); + mir_snwprintf(szFilter, L"GIF %s (*.gif)%c*.GIF", TranslateT("format"), 0); break; case PA_FORMAT_JPEG: - mir_sntprintf(szFilter, L"JPEG %s (*.jpg;*.jpeg)%c*.JPG;*.JPEG", TranslateT("format"), 0); + mir_snwprintf(szFilter, L"JPEG %s (*.jpg;*.jpeg)%c*.JPG;*.JPEG", TranslateT("format"), 0); break; default: - mir_sntprintf(szFilter, L"%s (*.*)%c*.*", TranslateT("Unknown format"), 0); + mir_snwprintf(szFilter, L"%s (*.*)%c*.*", TranslateT("Unknown format"), 0); } wchar_t szFileName[MAX_PATH]; szFileName[0] = '\0'; diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index 610790fe63..c607e10c26 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -69,13 +69,13 @@ MCONTACT CJabberProto::HContactFromJID(const wchar_t *jid, bool bStripResource) wchar_t* __stdcall JabberNickFromJID(const wchar_t *jid)
{
if (jid == NULL)
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
const wchar_t *p = wcschr(jid, '@');
if (p == NULL)
p = wcschr(jid, '/');
- return (p != NULL) ? mir_tstrndup(jid, p - jid) : mir_tstrdup(jid);
+ return (p != NULL) ? mir_wstrndup(jid, p - jid) : mir_wstrdup(jid);
}
pResourceStatus CJabberProto::ResourceInfoFromJID(const wchar_t *jid)
@@ -99,7 +99,7 @@ pResourceStatus CJabberProto::ResourceInfoFromJID(const wchar_t *jid) wchar_t* JabberPrepareJid(LPCTSTR jid)
{
if (jid == NULL) return NULL;
- wchar_t *szNewJid = mir_tstrdup(jid);
+ wchar_t *szNewJid = mir_wstrdup(jid);
if (!szNewJid) return NULL;
wchar_t *pDelimiter = wcschr(szNewJid, '/');
if (pDelimiter) *pDelimiter = 0;
@@ -156,7 +156,7 @@ wchar_t* __stdcall JabberStrFixLines(const wchar_t *str) if (*p == '\r' || *p == '\n')
++add;
- wchar_t *buf = (wchar_t *)mir_alloc((mir_tstrlen(str) + add + 1) * sizeof(wchar_t));
+ wchar_t *buf = (wchar_t *)mir_alloc((mir_wstrlen(str) + add + 1) * sizeof(wchar_t));
wchar_t *res = buf;
for (p = str; p && *p; ++p) {
@@ -258,7 +258,7 @@ wchar_t* __stdcall JabberErrorMsg(HXML errorNode, int* pErrorCode) if (errorNode == NULL) {
if (pErrorCode)
*pErrorCode = -1;
- mir_sntprintf(errorStr, 256, L"%s -1: %s", TranslateT("Error"), TranslateT("Unknown error message"));
+ mir_snwprintf(errorStr, 256, L"%s -1: %s", TranslateT("Error"), TranslateT("Unknown error message"));
return errorStr;
}
@@ -275,7 +275,7 @@ wchar_t* __stdcall JabberErrorMsg(HXML errorNode, int* pErrorCode) HXML c = XmlGetChild(errorNode, i);
if (c == NULL) break;
const wchar_t *attr = XmlGetAttrValue(c, L"xmlns");
- if (attr && !mir_tstrcmp(attr, L"urn:ietf:params:xml:ns:xmpp-stanzas")) {
+ if (attr && !mir_wstrcmp(attr, L"urn:ietf:params:xml:ns:xmpp-stanzas")) {
str = XmlGetName(c);
break;
}
@@ -283,9 +283,9 @@ wchar_t* __stdcall JabberErrorMsg(HXML errorNode, int* pErrorCode) }
if (str != NULL)
- mir_sntprintf(errorStr, 256, L"%s %d: %s\r\n%s", TranslateT("Error"), errorCode, TranslateTS(JabberErrorStr(errorCode)), str);
+ mir_snwprintf(errorStr, 256, L"%s %d: %s\r\n%s", TranslateT("Error"), errorCode, TranslateTS(JabberErrorStr(errorCode)), str);
else
- mir_sntprintf(errorStr, 256, L"%s %d: %s", TranslateT("Error"), errorCode, TranslateTS(JabberErrorStr(errorCode)));
+ mir_snwprintf(errorStr, 256, L"%s %d: %s", TranslateT("Error"), errorCode, TranslateTS(JabberErrorStr(errorCode)));
if (pErrorCode)
*pErrorCode = errorCode;
@@ -493,7 +493,7 @@ void CJabberProto::SendPresence(int status, bool bSendToAll) JABBER_LIST_ITEM *item = ListGetItemPtrFromIndex(i);
if (item != NULL && item->nick != NULL) {
wchar_t text[1024];
- mir_sntprintf(text, L"%s/%s", item->jid, item->nick);
+ mir_snwprintf(text, L"%s/%s", item->jid, item->nick);
SendPresenceTo(status == ID_STATUS_INVISIBLE ? ID_STATUS_ONLINE : status, text, NULL);
}
}
@@ -516,8 +516,8 @@ int __stdcall JabberGetPacketID(HXML n) wchar_t* __stdcall JabberId2string(int id)
{
wchar_t text[100];
- mir_sntprintf(text, _T(JABBER_IQID) L"%d", id);
- return mir_tstrdup(text);
+ mir_snwprintf(text, _T(JABBER_IQID) L"%d", id);
+ return mir_wstrdup(text);
}
///////////////////////////////////////////////////////////////////////////////
@@ -528,7 +528,7 @@ wchar_t* CJabberProto::GetClientJID(MCONTACT hContact, wchar_t *dest, size_t des if (hContact == NULL)
return NULL;
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
return GetClientJID(jid, dest, destLen);
}
@@ -543,7 +543,7 @@ wchar_t* CJabberProto::GetClientJID(const wchar_t *jid, wchar_t *dest, size_t de mir_cslock lck(m_csLists);
JABBER_LIST_ITEM *LI = ListGetItemPtr(LIST_ROSTER, jid);
if (LI != NULL) {
- if (LI->arResources.getCount() == 1 && !mir_tstrcmp(LI->arResources[0]->m_tszCapsNode, L"http://talk.google.com/xmpp/bot/caps")) {
+ if (LI->arResources.getCount() == 1 && !mir_wstrcmp(LI->arResources[0]->m_tszCapsNode, L"http://talk.google.com/xmpp/bot/caps")) {
if (p) *p = 0;
return dest;
}
@@ -551,7 +551,7 @@ wchar_t* CJabberProto::GetClientJID(const wchar_t *jid, wchar_t *dest, size_t de if (p == NULL) {
pResourceStatus r(LI->getBestResource());
if (r != NULL)
- mir_sntprintf(dest, destLen, L"%s/%s", jid, r->m_tszResourceName);
+ mir_snwprintf(dest, destLen, L"%s/%s", jid, r->m_tszResourceName);
}
}
@@ -582,10 +582,10 @@ wchar_t* __stdcall JabberStripJid(const wchar_t *jid, wchar_t *dest, size_t dest LPCTSTR __stdcall JabberGetPictureType(HXML node, const char *picBuf)
{
if (LPCTSTR ptszType = XmlGetText(XmlGetChild(node, "TYPE")))
- if (!mir_tstrcmp(ptszType, L"image/jpeg") ||
- !mir_tstrcmp(ptszType, L"image/png") ||
- !mir_tstrcmp(ptszType, L"image/gif") ||
- !mir_tstrcmp(ptszType, L"image/bmp"))
+ if (!mir_wstrcmp(ptszType, L"image/jpeg") ||
+ !mir_wstrcmp(ptszType, L"image/png") ||
+ !mir_wstrcmp(ptszType, L"image/gif") ||
+ !mir_wstrcmp(ptszType, L"image/bmp"))
return ptszType;
switch (ProtoGetBufferFormat(picBuf)) {
@@ -658,7 +658,7 @@ void CJabberProto::ComboLoadRecentStrings(HWND hwndDlg, UINT idcCombo, char *par for (int i = 0; i < recentCount; i++) {
char setting[MAXMODULELABELLENGTH];
mir_snprintf(setting, "%s%d", param, i);
- ptrT tszRecent(getTStringA(setting));
+ ptrW tszRecent(getTStringA(setting));
if (tszRecent != NULL)
SendDlgItemMessage(hwndDlg, idcCombo, CB_ADDSTRING, 0, tszRecent);
}
@@ -733,7 +733,7 @@ static VOID CALLBACK sttRebuildInfoFrameApcProc(void* param) if (hContact == NULL) continue;
char name[128];
- char *jid_copy = mir_t2a(item->jid);
+ char *jid_copy = mir_u2a(item->jid);
mir_snprintf(name, "$/Transports/%s", jid_copy);
ppro->m_pInfoFrame->CreateInfoItem(name, true, hContact);
ppro->m_pInfoFrame->UpdateInfoItem(name, ppro->GetIconHandle(IDI_TRANSPORTL), (wchar_t *)item->jid);
@@ -758,7 +758,7 @@ void CJabberProto::RebuildInfoFrame() wchar_t* time2str(time_t _time, wchar_t *buf, size_t bufLen)
{
struct tm* T = gmtime(&_time);
- mir_sntprintf(buf, bufLen, L"%04d-%02d-%02dT%02d:%02d:%02dZ",
+ mir_snwprintf(buf, bufLen, L"%04d-%02d-%02dT%02d:%02d:%02dZ",
T->tm_year + 1900, T->tm_mon + 1, T->tm_mday, T->tm_hour, T->tm_min, T->tm_sec);
return buf;
}
@@ -784,8 +784,8 @@ const wchar_t *JabberStrIStr(const wchar_t *str, const wchar_t *substr) wchar_t *str_up = NEWWSTR_ALLOCA(str);
wchar_t *substr_up = NEWWSTR_ALLOCA(substr);
- CharUpperBuff(str_up, (DWORD)mir_tstrlen(str_up));
- CharUpperBuff(substr_up, (DWORD)mir_tstrlen(substr_up));
+ CharUpperBuff(str_up, (DWORD)mir_wstrlen(str_up));
+ CharUpperBuff(substr_up, (DWORD)mir_wstrlen(substr_up));
wchar_t *p = wcsstr(str_up, substr_up);
return p ? (str + (p - str_up)) : NULL;
@@ -800,9 +800,9 @@ void JabberCopyText(HWND hwnd, const wchar_t *text) if (OpenClipboard(hwnd)) {
EmptyClipboard();
- HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t)*(mir_tstrlen(text) + 1));
+ HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t)*(mir_wstrlen(text) + 1));
wchar_t *s = (wchar_t *)GlobalLock(hMem);
- mir_tstrcpy(s, text);
+ mir_wstrcpy(s, text);
GlobalUnlock(hMem);
SetClipboardData(CF_UNICODETEXT, hMem);
CloseClipboard();
@@ -863,11 +863,11 @@ bool CJabberProto::IsMyOwnJID(LPCTSTR szJID) if (m_ThreadInfo == NULL)
return false;
- ptrT szFrom(JabberPrepareJid(szJID));
+ ptrW szFrom(JabberPrepareJid(szJID));
if (szFrom == NULL)
return false;
- ptrT szTo(JabberPrepareJid(m_ThreadInfo->fullJID));
+ ptrW szTo(JabberPrepareJid(m_ThreadInfo->fullJID));
if (szTo == NULL)
return false;
@@ -879,7 +879,7 @@ bool CJabberProto::IsMyOwnJID(LPCTSTR szJID) if (pDelimiter)
*pDelimiter = 0;
- return mir_tstrcmp(szFrom, szTo) == 0;
+ return mir_wstrcmp(szFrom, szTo) == 0;
}
void __cdecl CJabberProto::LoadHttpAvatars(void* param)
diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp index 6d1ae5d239..f48503739d 100644 --- a/protocols/JabberG/src/jabber_vcard.cpp +++ b/protocols/JabberG/src/jabber_vcard.cpp @@ -46,7 +46,7 @@ int CJabberProto::SendGetVcard(const wchar_t *jid) static void SetDialogField(CJabberProto *ppro, HWND hwndDlg, int nDlgItem, char* key, bool bTranslate = false)
{
- ptrT tszValue(ppro->getTStringA(key));
+ ptrW tszValue(ppro->getTStringA(key));
if (tszValue != NULL)
SetDlgItemText(hwndDlg, nDlgItem, (bTranslate) ? TranslateTS(tszValue) : tszValue);
else
@@ -126,7 +126,7 @@ static INT_PTR CALLBACK HomeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA TranslateDialogDefault(hwndDlg);
for (int i = 0; i < g_cbCountries; i++) {
if (g_countries[i].id != 0xFFFF && g_countries[i].id != 0) {
- wchar_t *country = mir_a2t(g_countries[i].szName);
+ wchar_t *country = mir_a2u(g_countries[i].szName);
SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_ADDSTRING, 0, (LPARAM)TranslateTS(country));
mir_free(country);
}
@@ -190,7 +190,7 @@ static INT_PTR CALLBACK WorkDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA TranslateDialogDefault(hwndDlg);
for (int i = 0; i < g_cbCountries; i++) {
if (g_countries[i].id != 0xFFFF && g_countries[i].id != 0) {
- wchar_t *country = mir_a2t(g_countries[i].szName);
+ wchar_t *country = mir_a2u(g_countries[i].szName);
SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_ADDSTRING, 0, (LPARAM)TranslateTS(country));
mir_free(country);
}
@@ -291,13 +291,13 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR dat->ppro->GetAvatarFileName(NULL, szAvatarFileName, _countof(szAvatarFileName));
if (_waccess(szAvatarFileName, 0) == 0) {
if (GetTempPath(_countof(szTempPath), szTempPath) <= 0)
- mir_tstrcpy(szTempPath, L".\\");
+ mir_wstrcpy(szTempPath, L".\\");
if (GetTempFileName(szTempPath, L"jab", 0, szTempFileName) > 0) {
dat->ppro->debugLog(L"Temp file = %s", szTempFileName);
if (CopyFile(szAvatarFileName, szTempFileName, FALSE) == TRUE) {
if ((dat->hBitmap = Bitmap_Load(szTempFileName)) != NULL) {
FIP->FI_Premultiply(dat->hBitmap);
- mir_tstrcpy(dat->ppro->m_szPhotoFileName, szTempFileName);
+ mir_wstrcpy(dat->ppro->m_szPhotoFileName, szTempFileName);
EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), TRUE);
}
else DeleteFile(szTempFileName);
@@ -355,7 +355,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR break;
}
if (GetTempPath(_countof(szTempPath), szTempPath) <= 0)
- mir_tstrcpy(szTempPath, L".\\");
+ mir_wstrcpy(szTempPath, L".\\");
if (GetTempFileName(szTempPath, L"jab", 0, szTempFileName) > 0) {
dat->ppro->debugLog(L"Temp file = %s", szTempFileName);
@@ -367,7 +367,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }
dat->hBitmap = hNewBitmap;
- mir_tstrcpy(dat->ppro->m_szPhotoFileName, szTempFileName);
+ mir_wstrcpy(dat->ppro->m_szPhotoFileName, szTempFileName);
dat->ppro->m_bPhotoChanged = TRUE;
EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), TRUE);
InvalidateRect(hwndDlg, NULL, TRUE);
@@ -730,10 +730,10 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP lvi.iItem = 0;
for (i=0;;i++) {
mir_snprintf(idstr, "e-mail%d", i);
- ptrT email( ppro->getTStringA(idstr));
+ ptrW email( ppro->getTStringA(idstr));
if (email == NULL) break;
- mir_sntprintf(number, L"%d", i+1);
+ mir_snwprintf(number, L"%d", i+1);
lvi.pszText = number;
lvi.lParam = (LPARAM)i;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_EMAILS), &lvi);
@@ -751,10 +751,10 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP lvi.iItem = 0;
for (i=0;;i++) {
mir_snprintf(idstr, "Phone%d", i);
- ptrT phone( ppro->getTStringA(idstr));
+ ptrW phone( ppro->getTStringA(idstr));
if (phone == NULL) break;
- mir_sntprintf(number, L"%d", i+1);
+ mir_snwprintf(number, L"%d", i+1);
lvi.pszText = number;
lvi.lParam = (LPARAM)i;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
@@ -958,7 +958,7 @@ void CJabberProto::SaveVcardToDB(HWND hwndPage, int iPage) setTString("ZIP", text);
{
int i = SendDlgItemMessage(hwndPage, IDC_COUNTRY, CB_GETCURSEL, 0, 0);
- wchar_t *country = mir_a2t((i) ? g_countries[i + 2].szName : g_countries[1].szName);
+ wchar_t *country = mir_a2u((i) ? g_countries[i + 2].szName : g_countries[1].szName);
setTString("Country", country);
mir_free(country);
}
@@ -984,7 +984,7 @@ void CJabberProto::SaveVcardToDB(HWND hwndPage, int iPage) setTString("CompanyZIP", text);
{
int i = SendDlgItemMessage(hwndPage, IDC_COUNTRY, CB_GETCURSEL, 0, 0);
- wchar_t *country = mir_a2t((i) ? g_countries[i + 2].szName : g_countries[1].szName);
+ wchar_t *country = mir_a2u((i) ? g_countries[i + 2].szName : g_countries[1].szName);
setTString("CompanyCountry", country);
mir_free(country);
}
@@ -1006,7 +1006,7 @@ void CJabberProto::AppendVcardFromDB(HXML n, char *tag, char *key) if (n == NULL || tag == NULL || key == NULL)
return;
- ptrT tszValue(getTStringA(key));
+ ptrW tszValue(getTStringA(key));
n << XCHILD(_A2T(tag), tszValue);
}
@@ -1033,7 +1033,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, wchar_t* szPhotoFileName) for (i = 0;; i++) {
mir_snprintf(idstr, "e-mail%d", i);
- ptrT email(getTStringA(idstr));
+ ptrW email(getTStringA(idstr));
if (email == NULL)
break;
@@ -1081,7 +1081,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, wchar_t* szPhotoFileName) for (i = 0;; i++) {
mir_snprintf(idstr, "Phone%d", i);
- ptrT phone(getTStringA(idstr));
+ ptrW phone(getTStringA(idstr));
if (phone == NULL)
break;
diff --git a/protocols/JabberG/src/jabber_ws.cpp b/protocols/JabberG/src/jabber_ws.cpp index 201b1fbbd4..739fd07362 100644 --- a/protocols/JabberG/src/jabber_ws.cpp +++ b/protocols/JabberG/src/jabber_ws.cpp @@ -29,7 +29,7 @@ BOOL CJabberProto::WsInit(void) m_lastTicks = ::GetTickCount();
wchar_t name[128];
- mir_sntprintf(name, TranslateT("%s connection"), m_tszUserName);
+ mir_snwprintf(name, TranslateT("%s connection"), m_tszUserName);
NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR; // | NUF_HTTPGATEWAY;
diff --git a/protocols/JabberG/src/jabber_xml.cpp b/protocols/JabberG/src/jabber_xml.cpp index 32b1b6194e..71f6697e2d 100644 --- a/protocols/JabberG/src/jabber_xml.cpp +++ b/protocols/JabberG/src/jabber_xml.cpp @@ -154,7 +154,7 @@ void __fastcall XmlAddAttr(HXML hXml, LPCTSTR pszName, unsigned __int64 value) void __fastcall XmlAddAttrID(HXML hXml, int id)
{
wchar_t text[100];
- mir_sntprintf(text, _T(JABBER_IQID) L"%d", id);
+ mir_snwprintf(text, _T(JABBER_IQID) L"%d", id);
XmlAddAttr(hXml, L"id", text);
}
@@ -218,7 +218,7 @@ HXML __fastcall XmlGetChild(HXML hXml, LPCTSTR key) HXML __fastcall XmlGetChild(HXML hXml, LPCSTR key)
{
- LPTSTR wszKey = mir_a2t(key);
+ LPTSTR wszKey = mir_a2u(key);
HXML result = xmlGetNthChild(hXml, wszKey, 0);
mir_free(wszKey);
return result;
@@ -231,7 +231,7 @@ HXML __fastcall XmlGetChildByTag(HXML hXml, LPCTSTR key, LPCTSTR attrName, LPCTS HXML __fastcall XmlGetChildByTag(HXML hXml, LPCSTR key, LPCSTR attrName, LPCTSTR attrValue)
{
- LPTSTR wszKey = mir_a2t(key), wszName = mir_a2t(attrName);
+ LPTSTR wszKey = mir_a2u(key), wszName = mir_a2u(attrName);
HXML result = xmlGetChildByAttrValue(hXml, wszKey, wszName, attrValue);
mir_free(wszKey), mir_free(wszName);
return result;
@@ -246,7 +246,7 @@ HXML __fastcall XmlGetNthChild(HXML hXml, LPCTSTR tag, int nth) {
int i, num;
- if (!hXml || tag == NULL || mir_tstrlen(tag) <= 0 || nth < 1)
+ if (!hXml || tag == NULL || mir_wstrlen(tag) <= 0 || nth < 1)
return NULL;
num = 1;
@@ -254,7 +254,7 @@ HXML __fastcall XmlGetNthChild(HXML hXml, LPCTSTR tag, int nth) HXML n = xmlGetChild(hXml, i);
if (!n)
break;
- if (!mir_tstrcmp(tag, XmlGetName(n))) {
+ if (!mir_wstrcmp(tag, XmlGetName(n))) {
if (num == nth)
return n;
@@ -281,20 +281,20 @@ void XPath::ProcessPath(LookupInfo &info, bool bCreate) if (!info.nodeName) return;
wchar_t *nodeName = (wchar_t *)alloca(sizeof(wchar_t) * (info.nodeName.length+1));
- mir_tstrncpy(nodeName, info.nodeName.p, info.nodeName.length+1);
+ mir_wstrncpy(nodeName, info.nodeName.p, info.nodeName.length+1);
if (info.attrName && info.attrValue) {
wchar_t *attrName = (wchar_t *)alloca(sizeof(wchar_t)* (info.attrName.length + 1));
- mir_tstrncpy(attrName, info.attrName.p, info.attrName.length + 1);
+ mir_wstrncpy(attrName, info.attrName.p, info.attrName.length + 1);
wchar_t *attrValue = (wchar_t *)alloca(sizeof(wchar_t)* (info.attrValue.length + 1));
- mir_tstrncpy(attrValue, info.attrValue.p, info.attrValue.length + 1);
+ mir_wstrncpy(attrValue, info.attrValue.p, info.attrValue.length + 1);
HXML hXml = XmlGetChildByTag(m_hXml, nodeName, attrName, attrValue);
m_hXml = (hXml || !bCreate) ? hXml : (m_hXml << XCHILD(nodeName) << XATTR(attrName, attrValue));
}
else if (info.nodeIndex) {
int idx = _wtoi(info.nodeIndex.p);
- m_hXml = mir_tstrcmp(nodeName, L"*") ? XmlGetNthChild(m_hXml, nodeName, idx) : XmlGetChild(m_hXml, idx - 1);
+ m_hXml = mir_wstrcmp(nodeName, L"*") ? XmlGetNthChild(m_hXml, nodeName, idx) : XmlGetChild(m_hXml, idx - 1);
}
else {
HXML hXml = XmlGetChild(m_hXml, nodeName);
diff --git a/protocols/JabberG/src/jabber_xml.h b/protocols/JabberG/src/jabber_xml.h index 739ba708db..0102cac006 100644 --- a/protocols/JabberG/src/jabber_xml.h +++ b/protocols/JabberG/src/jabber_xml.h @@ -258,11 +258,11 @@ public: }
__forceinline bool operator== (wchar_t *str)
{
- return !mir_tstrcmp((LPCTSTR)*this, str);
+ return !mir_wstrcmp((LPCTSTR)*this, str);
}
__forceinline bool operator!= (wchar_t *str)
{
- return mir_tstrcmp((LPCTSTR)*this, str) ? true : false;
+ return mir_wstrcmp((LPCTSTR)*this, str) ? true : false;
}
HXML operator[] (int idx)
{
@@ -359,7 +359,7 @@ public: va_list args;
va_start(args, path);
- mir_vsntprintf(m_buf, BUFSIZE, path, args);
+ mir_vsnwprintf(m_buf, BUFSIZE, path, args);
m_buf[BUFSIZE-1] = 0;
va_end(args);
}
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp index 4e0b3b521b..7a0c229662 100644 --- a/protocols/JabberG/src/jabber_xstatus.cpp +++ b/protocols/JabberG/src/jabber_xstatus.cpp @@ -68,7 +68,7 @@ void CJabberDlgPepBase::OnInitDialog() SetTimer(m_hwnd, 1, 1000, NULL);
wchar_t buf[128];
- mir_sntprintf(buf, TranslateT("OK (%d)"), m_time);
+ mir_snwprintf(buf, TranslateT("OK (%d)"), m_time);
m_btnOk.SetText(buf);
}
@@ -89,7 +89,7 @@ INT_PTR CJabberDlgPepBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) case WM_TIMER:
if (wParam == 1) {
wchar_t buf[128];
- mir_sntprintf(buf, TranslateT("OK (%d)"), --m_time);
+ mir_snwprintf(buf, TranslateT("OK (%d)"), --m_time);
m_btnOk.SetText(buf);
if (m_time < 0) {
@@ -285,7 +285,7 @@ void CJabberDlgPepSimple::cbModes_OnChange(CCtrlData *) if ((m_prevSelected >= 0) && (m_modes[m_cbModes.GetItemData(m_prevSelected)].m_id >= 0)) {
mir_snprintf(szSetting, "PepMsg_%s", m_modes[m_cbModes.GetItemData(m_prevSelected)].m_name);
- ptrT szDescr( m_proto->getTStringA(szSetting));
+ ptrW szDescr( m_proto->getTStringA(szSetting));
m_txtDescription.SetText((szDescr != NULL) ? szDescr : L"");
m_txtDescription.Enable(true);
}
@@ -341,20 +341,20 @@ BOOL CJabberDlgPepSimple::OnWmDrawItem(UINT, WPARAM, LPARAM lParam) if (mode->m_subitem) {
for (int i = lpdis->itemData; i >= 0; --i)
if (!m_modes[i].m_subitem) {
- mir_sntprintf(text, L"%s [%s]", m_modes[i].m_title, mode->m_title);
+ mir_snwprintf(text, L"%s [%s]", m_modes[i].m_title, mode->m_title);
break;
}
}
- else mir_tstrncpy(text, mode->m_title, _countof(text));
+ else mir_wstrncpy(text, mode->m_title, _countof(text));
DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 2, (lpdis->rcItem.top + lpdis->rcItem.bottom - 16) / 2, mode->m_hIcon, 16, 16, 0, NULL, DI_NORMAL);
- TextOut(lpdis->hDC, lpdis->rcItem.left + 23, (lpdis->rcItem.top + lpdis->rcItem.bottom - tm.tmHeight) / 2, text, (int)mir_tstrlen(text));
+ TextOut(lpdis->hDC, lpdis->rcItem.left + 23, (lpdis->rcItem.top + lpdis->rcItem.bottom - tm.tmHeight) / 2, text, (int)mir_wstrlen(text));
}
else {
wchar_t text[128];
- mir_sntprintf(text, L"...%s", mode->m_title);
+ mir_snwprintf(text, L"...%s", mode->m_title);
DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 23, (lpdis->rcItem.top + lpdis->rcItem.bottom - 16) / 2, mode->m_hIcon, 16, 16, 0, NULL, DI_NORMAL);
- TextOut(lpdis->hDC, lpdis->rcItem.left + 44, (lpdis->rcItem.top + lpdis->rcItem.bottom - tm.tmHeight) / 2, text, (int)mir_tstrlen(text));
+ TextOut(lpdis->hDC, lpdis->rcItem.left + 44, (lpdis->rcItem.top + lpdis->rcItem.bottom - tm.tmHeight) / 2, text, (int)mir_wstrlen(text));
}
return TRUE;
@@ -398,7 +398,7 @@ void CPepService::Publish() void CPepService::Retract()
{
- wchar_t *tempName = mir_a2t(m_name);
+ wchar_t *tempName = mir_a2u(m_name);
wcslwr(tempName);
m_proto->m_ThreadInfo->send(
@@ -489,7 +489,7 @@ bool CPepGuiService::LaunchSetGui(BYTE bQuiet) void CPepGuiService::UpdateMenuItem(HANDLE hIcolibIcon, wchar_t *text)
{
m_hIcolibItem = hIcolibIcon;
- replaceStrT(m_szText, text);
+ replaceStrW(m_szText, text);
if (m_hMenuItem)
Menu_ModifyItem(m_hMenuItem, m_szText ? m_szText : TranslateT("<advanced status slot>"), m_hIcolibItem, CMIF_KEEPUNTRANSLATED);
@@ -632,7 +632,7 @@ void CPepMood::ProcessItems(const wchar_t *from, HXML itemsNode) LPCTSTR moodType = NULL, moodText = NULL;
for (int i=0; n = XmlGetChild(moodNode, i); i++) {
- if (!mir_tstrcmp(XmlGetName(n), L"text"))
+ if (!mir_wstrcmp(XmlGetName(n), L"text"))
moodText = XmlGetText(n);
else
moodType = XmlGetName(n);
@@ -672,7 +672,7 @@ void CPepMood::SetMood(MCONTACT hContact, const wchar_t *szMood, const wchar_t * {
int mood = -1;
if (szMood) {
- char* p = mir_t2a(szMood);
+ char* p = mir_u2a(szMood);
for (int i = 1; i < _countof(g_arrMoods); i++)
if (!mir_strcmp(g_arrMoods[i].szTag, p)) {
@@ -688,16 +688,16 @@ void CPepMood::SetMood(MCONTACT hContact, const wchar_t *szMood, const wchar_t * if (!hContact) {
m_mode = mood;
- replaceStrT(m_text, szText);
+ replaceStrW(m_text, szText);
HANDLE hIcon;
wchar_t title[128];
if (mood >= 0) {
- mir_sntprintf(title, TranslateT("Mood: %s"), TranslateTS(g_arrMoods[mood].szName));
+ mir_snwprintf(title, TranslateT("Mood: %s"), TranslateTS(g_arrMoods[mood].szName));
hIcon = g_MoodIcons.GetIcolibHandle(g_arrMoods[mood].szTag);
}
else {
- mir_tstrcpy(title, TranslateT("Set mood..."));
+ mir_wstrcpy(title, TranslateT("Set mood..."));
hIcon = Skin_GetIconHandle(SKINICON_OTHER_SMALLDOT);
}
@@ -741,7 +741,7 @@ void CPepMood::ShowSetDialog(BYTE bQuiet) return;
m_mode = dlg.GetStatusMode();
- replaceStrT(m_text, dlg.GetStatusText());
+ replaceStrW(m_text, dlg.GetStatusText());
}
HANDLE hIcon;
@@ -865,7 +865,7 @@ static int ActivityCheck(LPCTSTR szFirstNode, LPCTSTR szSecondNode) {
if (!szFirstNode) return 0;
- char *s1 = mir_t2a(szFirstNode), *s2 = mir_t2a(szSecondNode);
+ char *s1 = mir_u2a(szFirstNode), *s2 = mir_u2a(szSecondNode);
int i = 0, nFirst = -1, nSecond = -1;
while (g_arrActivities[i].szFirst || g_arrActivities[i].szSecond) {
@@ -971,9 +971,9 @@ void ActivityBuildTitle(int id, wchar_t *buf, int size) if (szFirst) {
if (szSecond)
- mir_sntprintf(buf, size, L"%s [%s]", TranslateTS(szFirst), TranslateTS(szSecond));
+ mir_snwprintf(buf, size, L"%s [%s]", TranslateTS(szFirst), TranslateTS(szSecond));
else
- mir_tstrncpy(buf, TranslateTS(szFirst), size);
+ mir_wstrncpy(buf, TranslateTS(szFirst), size);
}
else *buf = 0;
}
@@ -1016,7 +1016,7 @@ void CPepActivity::ProcessItems(const wchar_t *from, HXML itemsNode) HXML n;
for (int i=0; n = XmlGetChild(actNode, i); i++) {
- if (mir_tstrcmp(XmlGetName(n), L"text")) {
+ if (mir_wstrcmp(XmlGetName(n), L"text")) {
szFirstNode = XmlGetName(n);
HXML secondNode = XmlGetChild(n, 0);
if (szFirstNode && secondNode && XmlGetName(secondNode))
@@ -1076,17 +1076,17 @@ void CPepActivity::SetActivity(MCONTACT hContact, LPCTSTR szFirst, LPCTSTR szSec if (!hContact) {
m_mode = activity;
- replaceStrT(m_text, szText);
+ replaceStrW(m_text, szText);
HANDLE hIcon;
wchar_t title[128];
if (activity >= 0) {
- mir_sntprintf(title, TranslateT("Activity: %s"), activityTitle);
+ mir_snwprintf(title, TranslateT("Activity: %s"), activityTitle);
hIcon = g_ActivityIcons.GetIcolibHandle(returnActivity(activity));
}
else {
- mir_tstrcpy(title, TranslateT("Set activity..."));
+ mir_wstrcpy(title, TranslateT("Set activity..."));
hIcon = Skin_GetIconHandle(SKINICON_OTHER_SMALLDOT);
}
@@ -1097,7 +1097,7 @@ void CPepActivity::SetActivity(MCONTACT hContact, LPCTSTR szFirst, LPCTSTR szSec else SetExtraIcon(hContact, activity < 0 ? NULL : returnActivity(activity));
if (activity >= 0) {
- wchar_t *p = mir_a2t(ActivityGetId(activity));
+ wchar_t *p = mir_a2u(ActivityGetId(activity));
m_proto->WriteAdvStatus(hContact, ADVSTATUS_ACTIVITY, p, g_ActivityIcons.GetIcolibName(returnActivity(activity)), activityTitle, szText);
mir_free(p);
}
@@ -1118,7 +1118,7 @@ void CPepActivity::ShowSetDialog(BYTE) m_mode = dlg.GetStatusMode();
if (m_mode >= 0) {
- replaceStrT(m_text, dlg.GetStatusText());
+ replaceStrW(m_text, dlg.GetStatusText());
Publish();
UpdateMenuItem(g_ActivityIcons.GetIcolibHandle(returnActivity(m_mode)), g_arrActivities[m_mode].szTitle);
@@ -1215,7 +1215,7 @@ void CJabberProto::SetContactTune(MCONTACT hContact, LPCTSTR szArtist, LPCTSTR s }
else {
szListeningTo = (wchar_t*)mir_alloc(2048 * sizeof(wchar_t));
- mir_sntprintf(szListeningTo, 2047, L"%s - %s", szTitle ? szTitle : L"", szArtist ? szArtist : L"");
+ mir_snwprintf(szListeningTo, 2047, L"%s - %s", szTitle ? szTitle : L"", szArtist ? szArtist : L"");
}
setTString(hContact, "ListeningTo", szListeningTo);
@@ -1232,7 +1232,7 @@ wchar_t* a2tf(const wchar_t *str, BOOL unicode) if (str == NULL)
return NULL;
- return (unicode) ? mir_tstrdup(str) : mir_a2t((char*)str);
+ return (unicode) ? mir_wstrdup(str) : mir_a2u((char*)str);
}
void overrideStr(wchar_t*& dest, const wchar_t *src, BOOL unicode, const wchar_t *def = NULL)
@@ -1245,7 +1245,7 @@ void overrideStr(wchar_t*& dest, const wchar_t *src, BOOL unicode, const wchar_t if (src != NULL)
dest = a2tf(src, unicode);
else if (def != NULL)
- dest = mir_tstrdup(def);
+ dest = mir_wstrdup(def);
}
INT_PTR __cdecl CJabberProto::OnSetListeningTo(WPARAM, LPARAM lParam)
@@ -1286,7 +1286,7 @@ INT_PTR __cdecl CJabberProto::OnSetListeningTo(WPARAM, LPARAM lParam) szTmp++;
}
}
- mir_sntprintf(szLengthInSec, L"%d", result);
+ mir_snwprintf(szLengthInSec, L"%d", result);
}
SendPepTune(szArtist, szLength ? szLengthInSec : NULL, szSource, szTitle, szTrack, NULL);
@@ -1365,7 +1365,7 @@ INT_PTR __cdecl CJabberProto::OnGetXStatusEx(WPARAM hContact, LPARAM lParam) else {
*pData->ptszName = 0;
if (pData->flags & CSSF_UNICODE) {
- ptrT title(ReadAdvStatusT(hContact, ADVSTATUS_MOOD, ADVSTATUS_VAL_TITLE));
+ ptrW title(ReadAdvStatusT(hContact, ADVSTATUS_MOOD, ADVSTATUS_VAL_TITLE));
if (title)
wcsncpy_s(pData->ptszName, STATUS_TITLE_MAX, title, _TRUNCATE);
}
@@ -1381,7 +1381,7 @@ INT_PTR __cdecl CJabberProto::OnGetXStatusEx(WPARAM hContact, LPARAM lParam) if (pData->flags & CSSF_MASK_MESSAGE) {
*pData->pszMessage = 0;
if (pData->flags & CSSF_UNICODE) {
- ptrT title(ReadAdvStatusT(hContact, ADVSTATUS_MOOD, ADVSTATUS_VAL_TEXT));
+ ptrW title(ReadAdvStatusT(hContact, ADVSTATUS_MOOD, ADVSTATUS_VAL_TEXT));
if (title)
wcsncpy_s(pData->ptszMessage, STATUS_TITLE_MAX, title, _TRUNCATE);
}
@@ -1505,15 +1505,15 @@ void g_XstatusIconsInit() wchar_t szFile[MAX_PATH];
GetModuleFileName(hInst, szFile, _countof(szFile));
if (wchar_t *p = wcsrchr(szFile, '\\'))
- mir_tstrcpy(p + 1, L"..\\Icons\\xstatus_jabber.dll");
+ mir_wstrcpy(p + 1, L"..\\Icons\\xstatus_jabber.dll");
wchar_t szSection[100];
- mir_tstrcpy(szSection, L"Protocols/Jabber/" LPGENW("Moods"));
+ mir_wstrcpy(szSection, L"Protocols/Jabber/" LPGENW("Moods"));
for (int i = 1; i < _countof(g_arrMoods); i++)
g_MoodIcons.RegisterIcon(g_arrMoods[i].szTag, szFile, -(200 + i), szSection, TranslateTS(g_arrMoods[i].szName));
- mir_tstrcpy(szSection, L"Protocols/Jabber/" LPGENW("Activities"));
+ mir_wstrcpy(szSection, L"Protocols/Jabber/" LPGENW("Activities"));
for (int k = 0; k < _countof(g_arrActivities); k++) {
if (g_arrActivities[k].szFirst)
g_ActivityIcons.RegisterIcon(g_arrActivities[k].szFirst, szFile, g_arrActivities[k].iconid, szSection, TranslateTS(g_arrActivities[k].szTitle));
diff --git a/protocols/JabberG/src/jabber_xstatus.h b/protocols/JabberG/src/jabber_xstatus.h index ccda5b0886..dae7929b38 100644 --- a/protocols/JabberG/src/jabber_xstatus.h +++ b/protocols/JabberG/src/jabber_xstatus.h @@ -114,7 +114,7 @@ public: CPepService *Find(wchar_t *node)
{
for (int i=0; i < getCount(); i++)
- if (!mir_tstrcmp((*this)[i].GetNode(), node))
+ if (!mir_wstrcmp((*this)[i].GetNode(), node))
return &((*this)[i]);
return NULL;
}
diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h index 56f199f509..f445c93799 100644 --- a/protocols/JabberG/src/stdafx.h +++ b/protocols/JabberG/src/stdafx.h @@ -403,7 +403,7 @@ struct ThreadData JABBER_CONN_DATA conn;
wchar_t resource[128];
wchar_t fullJID[JABBER_MAX_JID_LEN];
- ptrT tszNewPassword;
+ ptrW tszNewPassword;
class TJabberAuth *auth;
JabberCapsBits jabberServerCaps;
@@ -683,8 +683,8 @@ struct CJabberAdhocStartupParams CJabberAdhocStartupParams(CJabberProto *proto, wchar_t* szJid, wchar_t* szNode = NULL)
{
m_pProto = proto;
- m_szJid = mir_tstrdup(szJid);
- m_szNode = szNode ? mir_tstrdup(szNode) : NULL;
+ m_szJid = mir_wstrdup(szJid);
+ m_szNode = szNode ? mir_wstrdup(szNode) : NULL;
}
~CJabberAdhocStartupParams()
{
diff --git a/protocols/MRA/src/MraAdvancedSearch.cpp b/protocols/MRA/src/MraAdvancedSearch.cpp index fd0bd8ecb0..5ea4500c69 100644 --- a/protocols/MRA/src/MraAdvancedSearch.cpp +++ b/protocols/MRA/src/MraAdvancedSearch.cpp @@ -77,7 +77,7 @@ void InitComboBoxNumders(HWND hWndCombo, DWORD dwStart, DWORD dwEnd) for (DWORD i = dwStart; i <= dwEnd; i++) {
wchar_t szBuff[MAX_PATH];
- mir_sntprintf(szBuff, L"%lu", i);
+ mir_snwprintf(szBuff, L"%lu", i);
DWORD dwItem = SendMessage(hWndCombo, CB_ADDSTRING, 0, (LPARAM)szBuff);
SendMessage(hWndCombo, CB_SETITEMDATA, dwItem, i);
}
diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp index b7f7aac5b2..ca412ee5dc 100644 --- a/protocols/MRA/src/MraAvatars.cpp +++ b/protocols/MRA/src/MraAvatars.cpp @@ -56,7 +56,7 @@ DWORD CMraProto::MraAvatarsQueueInitialize(HANDLE *phAvatarsQueueHandle) MRA_AVATARS_QUEUE *pmraaqAvatarsQueue = new MRA_AVATARS_QUEUE();
wchar_t szBuffer[MAX_PATH];
- mir_sntprintf(szBuffer, L"%s %s", m_tszUserName, TranslateT("Avatars' plugin connections"));
+ mir_snwprintf(szBuffer, L"%s %s", m_tszUserName, TranslateT("Avatars' plugin connections"));
NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
@@ -232,7 +232,7 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter) break;
default:
- mir_sntprintf(szErrorText, TranslateT("Avatars: server return HTTP code: %lu"), dwResultCode);
+ mir_snwprintf(szErrorText, TranslateT("Avatars: server return HTTP code: %lu"), dwResultCode);
ShowFormattedErrorMessage(szErrorText, NO_ERROR);
break;
}
@@ -290,7 +290,7 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter) }
else {
dwErrorCode = GetLastError();
- mir_sntprintf(szErrorText, TranslateT("Avatars: can't open file %s, error"), wszFileName);
+ mir_snwprintf(szErrorText, TranslateT("Avatars: can't open file %s, error"), wszFileName);
ShowFormattedErrorMessage(szErrorText, dwErrorCode);
}
}
@@ -476,7 +476,7 @@ DWORD CMraProto::MraAvatarsGetFileName(HANDLE hQueue, MCONTACT hContact, DWORD d return ERROR_NOT_SUPPORTED;
wchar_t tszBase[MAX_PATH];
- mir_sntprintf(tszBase, L"%s\\%s\\", VARST(L"%miranda_avatarcache%"), m_tszUserName);
+ mir_snwprintf(tszBase, L"%s\\%s\\", VARST(L"%miranda_avatarcache%"), m_tszUserName);
res = tszBase;
// some path in buff and free space for file name is avaible
@@ -530,7 +530,7 @@ DWORD CMraProto::MraAvatarsQueueGetAvatar(HANDLE hQueue, DWORD dwFlags, MCONTACT // ôàéë ñ àâàòàðîì ñóùåñòâóåò è íå óñòàðåë/íå áûëî êîììàíäû îáíîâëÿòü(ïðîñòî çàïðîñ èìåíè)
if (lpszPath) {
if (db_get_b(NULL, MRA_AVT_SECT_NAME, "ReturnAbsolutePath", MRA_AVT_DEFAULT_RET_ABC_PATH))
- mir_tstrncpy(lpszPath, wszFileName, MAX_PATH);
+ mir_wstrncpy(lpszPath, wszFileName, MAX_PATH);
else
PathToRelativeT(wszFileName, lpszPath);
}
diff --git a/protocols/MRA/src/MraChat.cpp b/protocols/MRA/src/MraChat.cpp index 782cb3fe40..58b17b39f8 100644 --- a/protocols/MRA/src/MraChat.cpp +++ b/protocols/MRA/src/MraChat.cpp @@ -192,7 +192,7 @@ int CMraProto::MraChatGcEventHook(WPARAM, LPARAM lParam) if (!_stricmp(gch->pDest->pszModule, m_szModuleName)) {
switch (gch->pDest->iType) {
case GC_USER_MESSAGE:
- if (gch->ptszText && mir_tstrlen(gch->ptszText)) {
+ if (gch->ptszText && mir_wstrlen(gch->ptszText)) {
CMStringA szEmail = gch->pDest->ptszID;
MCONTACT hContact = MraHContactFromEmail(szEmail, FALSE, TRUE, NULL);
BOOL bSlowSend = getByte("SlowSend", MRA_DEFAULT_SLOW_SEND);
diff --git a/protocols/MRA/src/MraFilesQueue.cpp b/protocols/MRA/src/MraFilesQueue.cpp index bcb9aead3c..83234d5adf 100644 --- a/protocols/MRA/src/MraFilesQueue.cpp +++ b/protocols/MRA/src/MraFilesQueue.cpp @@ -563,7 +563,7 @@ HANDLE CMraProto::MraFilesQueueConnectIn(MRA_FILES_QUEUE_ITEM *dat) lpwszCurPos = lpwszFiles;
for (size_t i = 0; i < dat->dwFilesCount; i++) {
MRA_FILES_QUEUE_FILE &p = dat->pmfqfFiles[i];
- lpwszCurPos += mir_sntprintf(lpwszCurPos, (dwFilesSize - ((size_t)lpwszCurPos - (size_t)lpwszFiles)), L"%s;%I64u;",
+ lpwszCurPos += mir_snwprintf(lpwszCurPos, (dwFilesSize - ((size_t)lpwszCurPos - (size_t)lpwszFiles)), L"%s;%I64u;",
GetFileNameFromFullPathW(p.lpwszName, p.dwNameLen), p.dwSize);
}
dwFilesSize = (lpwszCurPos - lpwszFiles);// size in WCHARs
@@ -658,7 +658,7 @@ DWORD CMraProto::MraFilesQueueAddReceive(HANDLE hQueue, DWORD dwFlags, MCONTACT MRA_FILES_QUEUE_FILE &p = dat->pmfqfFiles[dat->dwFilesCount];
p.lpwszName = mir_wstrdup(wszCurrFile);
- p.dwNameLen = mir_tstrlen(p.lpwszName);
+ p.dwNameLen = mir_wstrlen(p.lpwszName);
p.dwSize = _wtoi(wszCurrSize);
dat->dwFilesTotalSize += p.dwSize;
dwFileNameTotalSize += p.dwNameLen * sizeof(wchar_t);
@@ -674,13 +674,13 @@ DWORD CMraProto::MraFilesQueueAddReceive(HANDLE hQueue, DWORD dwFlags, MCONTACT LPWSTR lpwszDelimiter = dat->pwszFilesList;
LPWSTR lpwszCurrentItem = dat->pwszDescription;
StrFormatByteSizeW(dat->dwFilesTotalSize, szBuff, _countof(szBuff));
- lpwszCurrentItem += mir_sntprintf(lpwszCurrentItem, ((dwMemSize - ((size_t)lpwszCurrentItem - (size_t)dat->pwszDescription)) / sizeof(WCHAR)), L"%I64u Files (%s)\r\n", dat->dwFilesCount, szBuff);
+ lpwszCurrentItem += mir_snwprintf(lpwszCurrentItem, ((dwMemSize - ((size_t)lpwszCurrentItem - (size_t)dat->pwszDescription)) / sizeof(WCHAR)), L"%I64u Files (%s)\r\n", dat->dwFilesCount, szBuff);
// description + filesnames
for (size_t i = 0; i < dat->dwFilesCount; i++) {
- lpwszDelimiter += mir_sntprintf(lpwszDelimiter, ((dwMemSize - ((size_t)lpwszDelimiter - (size_t)dat->pwszFilesList)) / sizeof(WCHAR)), L"%s", dat->pmfqfFiles[i].lpwszName);
+ lpwszDelimiter += mir_snwprintf(lpwszDelimiter, ((dwMemSize - ((size_t)lpwszDelimiter - (size_t)dat->pwszFilesList)) / sizeof(WCHAR)), L"%s", dat->pmfqfFiles[i].lpwszName);
StrFormatByteSizeW(dat->pmfqfFiles[i].dwSize, szBuff, _countof(szBuff));
- lpwszCurrentItem += mir_sntprintf(lpwszCurrentItem, ((dwMemSize - ((size_t)lpwszCurrentItem - (size_t)dat->pwszDescription)) / sizeof(WCHAR)), L"%s - %s\r\n", dat->pmfqfFiles[i].lpwszName, szBuff);
+ lpwszCurrentItem += mir_snwprintf(lpwszCurrentItem, ((dwMemSize - ((size_t)lpwszCurrentItem - (size_t)dat->pwszDescription)) / sizeof(WCHAR)), L"%s - %s\r\n", dat->pmfqfFiles[i].lpwszName, szBuff);
}
lpwszCurrentItem += MultiByteToWideChar(MRA_CODE_PAGE, 0, szAddresses, (int)szAddresses.GetLength(), lpwszCurrentItem, (int)((dwMemSize - ((size_t)lpwszCurrentItem - (size_t)dat->pwszDescription)) / sizeof(WCHAR)));
@@ -862,7 +862,7 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter) }
else {// err allocating file disk space
dwRetErrorCode = GetLastError();
- mir_sntprintf(szErrorText, TranslateT("Receive files: can't allocate disk space for file, size %lu bytes, error"), dat->pmfqfFiles[i].dwSize);
+ mir_snwprintf(szErrorText, TranslateT("Receive files: can't allocate disk space for file, size %lu bytes, error"), dat->pmfqfFiles[i].dwSize);
ShowFormattedErrorMessage(szErrorText, dwRetErrorCode);
}
CloseHandle(hFile);
@@ -875,7 +875,7 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter) }
else {// err on open file
dwRetErrorCode = GetLastError();
- mir_sntprintf(szErrorText, TranslateT("Receive files: can't open file %s, error"), wszFileName);
+ mir_snwprintf(szErrorText, TranslateT("Receive files: can't open file %s, error"), wszFileName);
ShowFormattedErrorMessage(szErrorText, dwRetErrorCode);
bFailed = TRUE;
break;
@@ -883,7 +883,7 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter) }
else {// err on send request for file
dwRetErrorCode = GetLastError();
- mir_sntprintf(szErrorText, TranslateT("Receive files: request for file %s not sent, error"), dat->pmfqfFiles[i].lpwszName);
+ mir_snwprintf(szErrorText, TranslateT("Receive files: request for file %s not sent, error"), dat->pmfqfFiles[i].lpwszName);
ShowFormattedErrorMessage(szErrorText, NO_ERROR);
bFailed = TRUE;
break;
@@ -1108,14 +1108,14 @@ void CMraProto::MraFilesQueueSendThreadProc(LPVOID lpParameter) }
else { // err on open file
dwRetErrorCode = GetLastError();
- mir_sntprintf(szErrorText, TranslateT("Send files: can't open file %s, error"), dat->pmfqfFiles[j].lpwszName);
+ mir_snwprintf(szErrorText, TranslateT("Send files: can't open file %s, error"), dat->pmfqfFiles[j].lpwszName);
ShowFormattedErrorMessage(szErrorText, dwRetErrorCode);
bFailed = TRUE;
break;
}
}
else {
- mir_sntprintf(szErrorText, TranslateT("Send files: requested file: %S - not found in send files list."), (((LPSTR)btBuff) + sizeof(MRA_FT_GET_FILE)));
+ mir_snwprintf(szErrorText, TranslateT("Send files: requested file: %S - not found in send files list."), (((LPSTR)btBuff) + sizeof(MRA_FT_GET_FILE)));
ShowFormattedErrorMessage(szErrorText, NO_ERROR);
bFailed = TRUE;
break;
diff --git a/protocols/MRA/src/MraPlaces.h b/protocols/MRA/src/MraPlaces.h index e58e27962b..100887c18a 100644 --- a/protocols/MRA/src/MraPlaces.h +++ b/protocols/MRA/src/MraPlaces.h @@ -41,7 +41,7 @@ typedef struct {
if (mrapPlaces[i].dwCityID == 0 && mrapPlaces[i].dwPlaceID == 0)
{
- mir_sntprintf(szBuff, L" {%ld, TEXT(\"%s\")}, ", mrapPlaces[i].dwCountryID, mrapPlaces[i].lpszData);
+ mir_snwprintf(szBuff, L" {%ld, TEXT(\"%s\")}, ", mrapPlaces[i].dwCountryID, mrapPlaces[i].lpszData);
DebugPrintCRLFW(szBuff);
}
}
@@ -53,7 +53,7 @@ typedef struct {
if (mrapPlaces[i].dwCityID && mrapPlaces[i].dwPlaceID == 0)
{
- mir_sntprintf(szBuff, L" {%ld, %ld, TEXT(\"%s\")}, ", mrapPlaces[i].dwCountryID, mrapPlaces[i].dwCityID, mrapPlaces[i].lpszData);
+ mir_snwprintf(szBuff, L" {%ld, %ld, TEXT(\"%s\")}, ", mrapPlaces[i].dwCountryID, mrapPlaces[i].dwCityID, mrapPlaces[i].lpszData);
DebugPrintCRLFW(szBuff);
}
}
diff --git a/protocols/MRA/src/MraPopUp.cpp b/protocols/MRA/src/MraPopUp.cpp index bad3861365..2f5bc21800 100644 --- a/protocols/MRA/src/MraPopUp.cpp +++ b/protocols/MRA/src/MraPopUp.cpp @@ -254,9 +254,9 @@ void CMraProto::MraPopupShowW(MCONTACT hContact, DWORD dwType, DWORD dwFlags, LP ppd.lchContact = hContact;
if (lpszTitle)
- mir_tstrncpy(ppd.lptzContactName, lpszTitle, MAX_CONTACTNAME);
+ mir_wstrncpy(ppd.lptzContactName, lpszTitle, MAX_CONTACTNAME);
if (lpszMessage)
- mir_tstrncpy(ppd.lptzText, lpszMessage, MAX_SECONDLINE);
+ mir_wstrncpy(ppd.lptzText, lpszMessage, MAX_SECONDLINE);
ppd.PluginWindowProc = MraPopupDlgProc;
ppd.PluginData = dat;
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index ac34d5dfd1..5ba003938d 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -36,7 +36,7 @@ CMraProto::CMraProto(const char* _module, const wchar_t* _displayName) : m_heNudgeReceived = CreateProtoEvent(PE_NUDGE);
wchar_t name[MAX_PATH];
- mir_sntprintf(name, TranslateT("%s connection"), m_tszUserName);
+ mir_snwprintf(name, TranslateT("%s connection"), m_tszUserName);
NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
@@ -172,7 +172,7 @@ MCONTACT CMraProto::AddToListByEvent(int, int, MEVENT hDbEvent) char *firstName = nick + mir_strlen(nick) + 1;
char *lastName = firstName + mir_strlen(firstName) + 1;
char *email = lastName + mir_strlen(lastName) + 1;
- return AddToListByEmail(ptrT(mir_utf8decodeT(email)), ptrT(mir_utf8decodeT(nick)), ptrT(mir_utf8decodeT(firstName)), ptrT(mir_utf8decodeT(lastName)), 0);
+ return AddToListByEmail(ptrW(mir_utf8decodeW(email)), ptrW(mir_utf8decodeW(nick)), ptrW(mir_utf8decodeW(firstName)), ptrW(mir_utf8decodeW(lastName)), 0);
}
}
return 0;
@@ -233,7 +233,7 @@ int CMraProto::AuthRecv(MCONTACT, PROTORECVEVENT* pre) HANDLE CMraProto::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t *szPath)
{
if (szPath != NULL)
- if (MraFilesQueueAccept(hFilesQueueHandle, (DWORD_PTR)hTransfer, szPath, mir_tstrlen(szPath)) == NO_ERROR)
+ if (MraFilesQueueAccept(hFilesQueueHandle, (DWORD_PTR)hTransfer, szPath, mir_wstrlen(szPath)) == NO_ERROR)
return hTransfer; // Success
return NULL;
@@ -392,7 +392,7 @@ int CMraProto::SendMsg(MCONTACT hContact, int, const char *lpszMessage) }
DWORD dwFlags = 0;
- CMStringW wszMessage(ptrW(mir_utf8decodeT(lpszMessage)));
+ CMStringW wszMessage(ptrW(mir_utf8decodeW(lpszMessage)));
if (wszMessage.IsEmpty()) {
ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, (LPARAM)"Cant allocate buffer for convert to unicode.");
return 0;
@@ -526,11 +526,11 @@ HANDLE CMraProto::GetAwayMsg(MCONTACT hContact) SYSTEMTIME tt = { 0 };
dwTime = getDword(hContact, DBSETTING_BLOGSTATUSTIME, 0);
if (dwTime && MakeLocalSystemTimeFromTime32(dwTime, &tt))
- mir_sntprintf(szTime, L"%04ld.%02ld.%02ld %02ld:%02ld: ", tt.wYear, tt.wMonth, tt.wDay, tt.wHour, tt.wMinute);
+ mir_snwprintf(szTime, L"%04ld.%02ld.%02ld %02ld:%02ld: ", tt.wYear, tt.wMonth, tt.wDay, tt.wHour, tt.wMinute);
else
szTime[0] = 0;
- mir_sntprintf(szStatusDesc, L"%s%s", szTime, szBlogStatus.c_str());
+ mir_snwprintf(szStatusDesc, L"%s%s", szTime, szBlogStatus.c_str());
iRet = GetTickCount();
ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)iRet, (LPARAM)szStatusDesc);
}
@@ -542,7 +542,7 @@ int CMraProto::SetAwayMsg(int iStatus, const wchar_t *msg) if (!m_bLoggedIn)
return 1;
- size_t dwStatusDescSize = mir_tstrlen(msg);
+ size_t dwStatusDescSize = mir_wstrlen(msg);
DWORD dwStatus = iStatus;
DWORD dwXStatus = m_iXStatus;
diff --git a/protocols/MRA/src/MraRTFMsg.cpp b/protocols/MRA/src/MraRTFMsg.cpp index ab7077f9d1..1f735924d2 100644 --- a/protocols/MRA/src/MraRTFMsg.cpp +++ b/protocols/MRA/src/MraRTFMsg.cpp @@ -210,7 +210,7 @@ DWORD CMraProto::MraConvertToRTFW(const CMStringW &wszMessage, CMStringA &szMess HDC hDC = GetDC(NULL);// kegl
lf.lfCharSet = MRA_DEFAULT_RTF_FONT_CHARSET;
lf.lfHeight = -MulDiv(MRA_DEFAULT_RTF_FONT_SIZE, GetDeviceCaps(hDC, LOGPIXELSY), 72);
- mir_tstrncpy(lf.lfFaceName, MRA_DEFAULT_RTF_FONT_NAME, LF_FACESIZE);
+ mir_wstrncpy(lf.lfFaceName, MRA_DEFAULT_RTF_FONT_NAME, LF_FACESIZE);
ReleaseDC(NULL, hDC);
}
dwFontSize = ((-lf.lfHeight)+(((-lf.lfHeight)+4)/8));
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 3f863a1ed5..60d4784a14 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -458,8 +458,8 @@ DWORD CMraProto::SetContactBasicInfoW(MCONTACT hContact, DWORD dwSetInfoFlags, D MraGroupItem *grp = m_groups.find((MraGroupItem*)&dwGroupID);
if (grp) {
- ptrT tszGroup(db_get_tsa(hContact, "CList", "Group"));
- if (mir_tstrcmp(tszGroup, grp->m_name))
+ ptrW tszGroup(db_get_tsa(hContact, "CList", "Group"));
+ if (mir_wstrcmp(tszGroup, grp->m_name))
db_set_ts(hContact, "CList", "Group", grp->m_name);
}
}
@@ -649,14 +649,14 @@ void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA & MCONTACT hContact = NULL;
wchar_t szMailBoxStatus[MAX_SECONDLINE];
- mir_sntprintf(szMailBoxStatus, TranslateT("Unread mail is available: %lu/%lu messages"), m_dwEmailMessagesUnread, dwEmailMessagesTotal);
+ mir_snwprintf(szMailBoxStatus, TranslateT("Unread mail is available: %lu/%lu messages"), m_dwEmailMessagesUnread, dwEmailMessagesTotal);
if (!pszFrom.IsEmpty() || !pszSubject.IsEmpty()) {
CMStringA szFrom, szSubject;
if (GetEMailFromString(szFrom, szEmail))
hContact = MraHContactFromEmail(szEmail, FALSE, TRUE, NULL);
- mir_sntprintf(szStatusText, TranslateT("From: %S\r\nSubject: %S\r\n%s"), pszFrom.c_str(), szSubject.c_str(), szMailBoxStatus);
+ mir_snwprintf(szStatusText, TranslateT("From: %S\r\nSubject: %S\r\n%s"), pszFrom.c_str(), szSubject.c_str(), szMailBoxStatus);
}
else wcsncpy_s(szStatusText, szMailBoxStatus, _TRUNCATE);
@@ -693,7 +693,7 @@ void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA & hWndEMailPopupStatus = NULL;
}
else {
- mir_sntprintf(szStatusText, TranslateT("No unread mail is available\r\nTotal messages: %lu"), dwEmailMessagesTotal);
+ mir_snwprintf(szStatusText, TranslateT("No unread mail is available\r\nTotal messages: %lu"), dwEmailMessagesTotal);
MraPopupShowFromAgentW(MRA_POPUP_TYPE_EMAIL_STATUS, (MRA_POPUP_ALLOW_ENTER), szStatusText);
}
}
@@ -878,7 +878,7 @@ void CMraProto::ShowFormattedErrorMessage(LPWSTR lpwszErrText, DWORD dwErrorCode else {
dwErrDescriptionSize = (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErrorCode, 0, szErrDescription, (_countof(szErrDescription) - sizeof(WCHAR)), NULL) - 2);
szErrDescription[dwErrDescriptionSize] = 0;
- mir_sntprintf(szErrorText, L"%s %lu: %s", TranslateTS(lpwszErrText), dwErrorCode, szErrDescription);
+ mir_snwprintf(szErrorText, L"%s %lu: %s", TranslateTS(lpwszErrText), dwErrorCode, szErrDescription);
}
MraPopupShowFromAgentW(MRA_POPUP_TYPE_ERROR, 0, szErrorText);
}
@@ -1020,7 +1020,7 @@ INT_PTR CALLBACK SetXStatusDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LP case WM_TIMER:
if (dat->dwCountdown != -1) {
wchar_t szBuff[MAX_PATH];
- mir_sntprintf(szBuff, TranslateT("Closing in %ld"), dat->dwCountdown--);
+ mir_snwprintf(szBuff, TranslateT("Closing in %ld"), dat->dwCountdown--);
SetDlgItemText(hWndDlg, IDOK, szBuff);
break;
}
@@ -1056,7 +1056,7 @@ INT_PTR CALLBACK SetXStatusDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LP dwBuffSize = GetDlgItemText(hWndDlg, IDC_XTITLE, szBuff, (STATUS_TITLE_MAX + 1));
if (dwBuffSize == 0) { // user delete all text
- mir_tstrncpy(szBuff, TranslateTS(lpcszXStatusNameDef[dat->dwXStatus]), STATUS_TITLE_MAX + 1);
+ mir_wstrncpy(szBuff, TranslateTS(lpcszXStatusNameDef[dat->dwXStatus]), STATUS_TITLE_MAX + 1);
dwBuffSize = (DWORD)mir_wstrlen(szBuff);
}
mir_snprintf(szValueName, "XStatus%dName", dat->dwXStatus);
@@ -1176,7 +1176,7 @@ INT_PTR CALLBACK SendReplyBlogStatusDlgProc(HWND hWndDlg, UINT message, WPARAM w size_t dwMessageSize = GetWindowTextLength(GetDlgItem(hWndDlg, IDC_MSG_TO_SEND));
EnableWindow(GetDlgItem(hWndDlg, IDOK), (int)dwMessageSize);
- mir_sntprintf(tszBuff, L"%d/%d", dwMessageSize, MICBLOG_STATUS_MAX);
+ mir_snwprintf(tszBuff, L"%d/%d", dwMessageSize, MICBLOG_STATUS_MAX);
SetDlgItemText(hWndDlg, IDC_STATIC_CHARS_COUNTER, tszBuff);
}
break;
@@ -1250,7 +1250,7 @@ DWORD FindFile(LPWSTR lpszFolder, DWORD dwFolderLen, LPWSTR lpszFileName, DWORD dwPathLen++;
}
szPath[dwPathLen] = 0;
- mir_tstrcat(szPath, L"*.*");
+ mir_wstrcat(szPath, L"*.*");
dwRetErrorCode = ERROR_FILE_NOT_FOUND;
prdsiItems[dwRecDeepCurPos].dwFileNameLen = 0;
@@ -1265,7 +1265,7 @@ DWORD FindFile(LPWSTR lpszFolder, DWORD dwFolderLen, LPWSTR lpszFileName, DWORD if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, L"..", 2) != CSTR_EQUAL) {
prdsiItems[dwRecDeepCurPos].dwFileNameLen = (int)mir_wstrlen(prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName) + 1;
memcpy((szPath + dwPathLen), prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, (prdsiItems[dwRecDeepCurPos].dwFileNameLen*sizeof(WCHAR)));
- mir_tstrcat(szPath, L"\\*.*");
+ mir_wstrcat(szPath, L"\\*.*");
dwPathLen += prdsiItems[dwRecDeepCurPos].dwFileNameLen;
dwRecDeepCurPos++;
diff --git a/protocols/MRA/src/Mra_menus.cpp b/protocols/MRA/src/Mra_menus.cpp index a0ac316017..f54ecfb595 100644 --- a/protocols/MRA/src/Mra_menus.cpp +++ b/protocols/MRA/src/Mra_menus.cpp @@ -282,7 +282,7 @@ int CMraProto::MraRebuildStatusMenu(WPARAM, LPARAM) HGENMENU hRoot;
{
wchar_t szItem[MAX_PATH + 64];
- mir_sntprintf(szItem, L"%s Custom Status", m_tszUserName);
+ mir_snwprintf(szItem, L"%s Custom Status", m_tszUserName);
CMenuItem mi;
mi.root = pcli->pfnGetProtocolMenu(m_szModuleName);
diff --git a/protocols/MRA/src/Mra_options.cpp b/protocols/MRA/src/Mra_options.cpp index 6247ef9249..1bd1a5694f 100644 --- a/protocols/MRA/src/Mra_options.cpp +++ b/protocols/MRA/src/Mra_options.cpp @@ -169,7 +169,7 @@ INT_PTR CALLBACK DlgProcOptsConnections(HWND hWndDlg, UINT msg, WPARAM wParam, L HDC hDC = GetDC(NULL);// kegl
lf.lfCharSet = MRA_DEFAULT_RTF_FONT_CHARSET;
lf.lfHeight = -MulDiv(MRA_DEFAULT_RTF_FONT_SIZE, GetDeviceCaps(hDC, LOGPIXELSY), 72);
- mir_tstrncpy(lf.lfFaceName, MRA_DEFAULT_RTF_FONT_NAME, LF_FACESIZE);
+ mir_wstrncpy(lf.lfFaceName, MRA_DEFAULT_RTF_FONT_NAME, LF_FACESIZE);
ReleaseDC(NULL, hDC);
}
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp index 283726a3d2..19d568e54c 100644 --- a/protocols/MRA/src/Mra_proto.cpp +++ b/protocols/MRA/src/Mra_proto.cpp @@ -653,7 +653,7 @@ bool CMraProto::CmdFileTransferAck(BinBuffer &buf) break;
default:// ## unknown error
wchar_t szBuff[1024];
- mir_sntprintf(szBuff, TranslateT("MRIM_CS_FILE_TRANSFER_ACK: unknown error, code: %lu"), dwAckType);
+ mir_snwprintf(szBuff, TranslateT("MRIM_CS_FILE_TRANSFER_ACK: unknown error, code: %lu"), dwAckType);
ShowFormattedErrorMessage(szBuff, NO_ERROR);
break;
}
@@ -721,7 +721,7 @@ bool CMraProto::CmdContactAck(int cmd, int seq, BinBuffer &buf) case CONTACT_OPER_SUCCESS:// ## äîáàâëåíèå ïðîèçâåäåíî óñïåøíî
if (cmd == MRIM_CS_ADD_CONTACT_ACK) {
DWORD dwFlags = SCBIF_ID | SCBIF_SERVER_FLAG, dwGroupID = 0;
- ptrT grpName(db_get_tsa(hContact, "CList", "Group"));
+ ptrW grpName(db_get_tsa(hContact, "CList", "Group"));
if (grpName) {
dwFlags |= SCBIF_GROUP_ID;
dwGroupID = MraMoveContactToGroup(hContact, -1, grpName);
@@ -750,7 +750,7 @@ bool CMraProto::CmdContactAck(int cmd, int seq, BinBuffer &buf) break;
default:// ## unknown error
wchar_t szBuff[1024];
- mir_sntprintf(szBuff, TranslateT("MRIM_CS_*_CONTACT_ACK: unknown server error, code: %lu"), dwTemp);
+ mir_snwprintf(szBuff, TranslateT("MRIM_CS_*_CONTACT_ACK: unknown server error, code: %lu"), dwTemp);
MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, 0, szBuff);
break;
}
@@ -1044,7 +1044,7 @@ bool CMraProto::CmdGame(BinBuffer &buf) break;
default:
wchar_t szBuff[1024];
- mir_sntprintf(szBuff, TranslateT("MRIM_CS_GAME: unknown internal game message code: %lu"), dwGameMsg);
+ mir_snwprintf(szBuff, TranslateT("MRIM_CS_GAME: unknown internal game message code: %lu"), dwGameMsg);
MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, 0, szBuff);
break;
}
@@ -1259,7 +1259,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf) }
else {
if (iGroupMode == 100) { // first start
- ptrT tszGroup(db_get_tsa(hContact, "CList", "Group"));
+ ptrW tszGroup(db_get_tsa(hContact, "CList", "Group"));
if (tszGroup)
dwGroupID = MraMoveContactToGroup(hContact, dwGroupID, tszGroup);
}
@@ -1351,7 +1351,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf) ShowFormattedErrorMessage(L"MRIM_CS_CONTACT_LIST2: internal server error", NO_ERROR);
else {
wchar_t szBuff[1024];
- mir_sntprintf(szBuff, TranslateT("MRIM_CS_CONTACT_LIST2: unknown server error, code: %lu"), dwTemp);
+ mir_snwprintf(szBuff, TranslateT("MRIM_CS_CONTACT_LIST2: unknown server error, code: %lu"), dwTemp);
MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, 0, szBuff);
}
}
diff --git a/protocols/MRA/src/Mra_svcs.cpp b/protocols/MRA/src/Mra_svcs.cpp index b5902ed4ae..c957ad89d5 100644 --- a/protocols/MRA/src/Mra_svcs.cpp +++ b/protocols/MRA/src/Mra_svcs.cpp @@ -310,7 +310,7 @@ INT_PTR CMraProto::MraSetListeningTo(WPARAM, LPARAM lParam) else if (pliInfo->dwFlags & LTI_UNICODE) {
CMStringW wszListeningTo;
if (ServiceExists(MS_LISTENINGTO_GETPARSEDTEXT))
- wszListeningTo = ptrT((LPWSTR)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%track%. %title% - %artist% - %player%", (LPARAM)pliInfo));
+ wszListeningTo = ptrW((LPWSTR)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%track%. %title% - %artist% - %player%", (LPARAM)pliInfo));
else
wszListeningTo.Format(L"%s. %s - %s - %s", pliInfo->ptszTrack ? pliInfo->ptszTrack : L"", pliInfo->ptszTitle ? pliInfo->ptszTitle : L"", pliInfo->ptszArtist ? pliInfo->ptszArtist : L"", pliInfo->ptszPlayer ? pliInfo->ptszPlayer : L"");
@@ -466,9 +466,9 @@ INT_PTR CMraProto::MraGetXStatusEx(WPARAM hContact, LPARAM lParam) return 1;
if (pData->flags & CSSF_UNICODE)
- mir_tstrncpy(pData->ptszName, lpcszXStatusNameDef[dwXStatus], (STATUS_TITLE_MAX + 1));
+ mir_wstrncpy(pData->ptszName, lpcszXStatusNameDef[dwXStatus], (STATUS_TITLE_MAX + 1));
else {
- size_t dwStatusTitleSize = mir_tstrlen(lpcszXStatusNameDef[dwXStatus]);
+ size_t dwStatusTitleSize = mir_wstrlen(lpcszXStatusNameDef[dwXStatus]);
if (dwStatusTitleSize > STATUS_TITLE_MAX)
dwStatusTitleSize = STATUS_TITLE_MAX;
@@ -625,7 +625,7 @@ INT_PTR CMraProto::MraGetMyAvatar(WPARAM wParam, LPARAM lParam) {
CMStringW wszFileName;
if (MraAvatarsGetFileName(hAvatarsQueueHandle, NULL, GetContactAvatarFormat(NULL, PA_FORMAT_DEFAULT), wszFileName) == NO_ERROR) {
- mir_tstrncpy((LPTSTR)wParam, wszFileName, (size_t)lParam);
+ mir_wstrncpy((LPTSTR)wParam, wszFileName, (size_t)lParam);
return 0;
}
return 1;
@@ -644,7 +644,7 @@ int CMraProto::OnGroupChanged(WPARAM hContact, LPARAM lParam) MraGroupItem *pGrp = NULL;
for (int i = 0; i < m_groups.getCount(); i++) {
MraGroupItem &p = m_groups[i];
- if (!mir_tstrcmp(p.m_name, cgc->pszOldName)) {
+ if (!mir_wstrcmp(p.m_name, cgc->pszOldName)) {
pGrp = &p;
break;
}
diff --git a/protocols/MSN/src/msn.cpp b/protocols/MSN/src/msn.cpp index 2f217da0b5..9fa392318d 100644 --- a/protocols/MSN/src/msn.cpp +++ b/protocols/MSN/src/msn.cpp @@ -61,7 +61,7 @@ int MSN_GCMenuHook(WPARAM wParam, LPARAM lParam); // Protocol instances
static int sttCompareProtocols(const CMsnProto *p1, const CMsnProto *p2)
{
- return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName);
+ return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName);
}
OBJLIST<CMsnProto> g_Instances(1, sttCompareProtocols);
diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index 995404ea9b..539280f125 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.cpp @@ -55,7 +55,7 @@ int CMsnProto::MSN_ChatInit(GCThreadData *info, const char *pszID, const char *p wchar_t szName[512];
InterlockedIncrement(&m_chatID);
if (*pszTopic) wcsncpy(szName, _A2T(pszTopic), _countof(szName));
- else mir_sntprintf(szName, L"%s %s%d",
+ else mir_snwprintf(szName, L"%s %s%d",
m_tszUserName, TranslateT("Chat #"), m_chatID);
GCSESSION gcw = { sizeof(gcw) };
@@ -123,7 +123,7 @@ void CMsnProto::MSN_ChatStart(ezxml_t xmli) info->mJoinedContacts.insert(gcu);
strncpy(gcu->WLID, mri, sizeof(gcu->WLID));
}
- mir_tstrcpy(gcu->role, _A2T(role));
+ mir_wstrcpy(gcu->role, _A2T(role));
if (pszCreator && !mir_strcmp(mri, pszCreator)) info->mCreator = gcu;
char* szEmail, *szNet;
@@ -186,10 +186,10 @@ void CMsnProto::MSN_GCProcessThreadActivity(ezxml_t xmli, const wchar_t *mChatID GCEVENT gce = { sizeof(gce), &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
gce.time = MsnTSToUnixtime(ezxml_txt(ezxml_child(xmli, "eventtime")));
- gce.ptszUID = initiator?mir_a2t(initiator->txt):NULL;
+ gce.ptszUID = initiator?mir_a2u(initiator->txt):NULL;
MCONTACT hContInitiator = MSN_HContactFromEmail(initiator->txt);
gce.ptszNick = GetContactNameT(hContInitiator);
- gce.ptszText = mir_a2t(ezxml_txt(ezxml_child(xmli, "value")));
+ gce.ptszText = mir_a2u(ezxml_txt(ezxml_child(xmli, "value")));
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
mir_free((wchar_t*)gce.ptszUID);
mir_free((wchar_t*)gce.ptszText);
@@ -244,7 +244,7 @@ void CMsnProto::MSN_GCProcessThreadActivity(ezxml_t xmli, const wchar_t *mChatID char *szEmail, *szNet;
parseWLID(NEWSTR_ALLOCA(pszTarget), &szNet, &szEmail, NULL);
gce.bIsMe = !mir_strcmpi(szEmail, GetMyUsername(atoi(szNet)));
- gce.ptszUID = mir_a2t(pszTarget);
+ gce.ptszUID = mir_a2u(pszTarget);
MCONTACT hContTarget = MSN_HContactFromEmail(pszTarget);
gce.ptszNick = GetContactNameT(hContTarget);
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
@@ -287,12 +287,12 @@ void CMsnProto::MSN_GCAddMessage(wchar_t *mChatID, MCONTACT hContact, char *emai GCDEST gcd = { m_szModuleName, mChatID, GC_EVENT_MESSAGE };
GCEVENT gce = { sizeof(gce), &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
- gce.ptszUID = mir_a2t(email);
+ gce.ptszUID = mir_a2u(email);
gce.ptszNick = GetContactNameT(hContact);
gce.time = ts;
gce.bIsMe = sentMsg;
- wchar_t* p = mir_utf8decodeT(msgBody);
+ wchar_t* p = mir_utf8decodeW(msgBody);
gce.ptszText = EscapeChatTags(p);
mir_free(p);
@@ -333,7 +333,7 @@ static void ChatInviteSend(HANDLE hItem, HWND hwndList, STRLIST &str, CMsnProto wchar_t buf[128] = L"";
SendMessage(hwndList, CLM_GETITEMTEXT, (WPARAM)hItem, (LPARAM)buf);
- if (buf[0]) str.insert(mir_t2a(buf));
+ if (buf[0]) str.insert(mir_u2a(buf));
}
else {
MsnContact *msc = ppro->Lists_Get((UINT_PTR)hItem);
@@ -502,7 +502,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) GCThreadData* thread = MSN_GetThreadByChatId(gch->pDest->ptszID);
if (thread) {
wchar_t* pszMsg = UnEscapeChatTags(NEWWSTR_ALLOCA(gch->ptszText));
- rtrimt(pszMsg); // remove the ending linebreak
+ rtrimw(pszMsg); // remove the ending linebreak
msnNsThread->sendMessage('N', thread->szEmail, thread->netId, UTF8(pszMsg), 0);
DBVARIANT dbv;
@@ -512,7 +512,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) GCEVENT gce = { sizeof(gce), &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = bError ? L"" : dbv.ptszVal;
- gce.ptszUID = mir_a2t(MyOptions.szEmail);
+ gce.ptszUID = mir_a2u(MyOptions.szEmail);
gce.time = time(NULL);
gce.ptszText = gch->ptszText;
gce.bIsMe = TRUE;
@@ -532,7 +532,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) case GC_USER_PRIVMESS:
{
- char *email = mir_t2a(gch->ptszUID);
+ char *email = mir_u2a(gch->ptszUID);
MCONTACT hContact = MSN_HContactFromEmail(email);
CallService(MS_MSG_SENDMESSAGE, hContact, 0);
mir_free(email);
@@ -574,7 +574,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) case 40:
const wchar_t *pszRole = MSN_GCGetRole(MSN_GetThreadByChatId(gch->pDest->ptszID), _T2A(gch->ptszUID));
- MSN_Promoteuser(gch, (pszRole && !mir_tstrcmp(pszRole, L"admin")) ? "user" : "admin");
+ MSN_Promoteuser(gch, (pszRole && !mir_wstrcmp(pszRole, L"admin")) ? "user" : "admin");
break;
}
break;
@@ -599,7 +599,7 @@ int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam) gcmi->Item = (gc_item*)Items;
}
else if (gcmi->Type == MENU_ON_NICKLIST) {
- char *email = mir_t2a(gcmi->pszUID);
+ char *email = mir_u2a(gcmi->pszUID);
if (!_stricmp(GetMyUsername(NETID_SKYPE), email)) {
static const struct gc_item Items[] =
{
@@ -620,13 +620,13 @@ int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam) { LPGENW("&Op user") , 40, MENU_ITEM, FALSE }
};
GCThreadData* thread = MSN_GetThreadByChatId(gcmi->pszID);
- if (thread && thread->mMe && mir_tstrcmpi(thread->mMe->role, L"admin")) {
+ if (thread && thread->mMe && mir_wstrcmpi(thread->mMe->role, L"admin")) {
Items[2].bDisabled = TRUE;
Items[3].bDisabled = TRUE;
}
else {
const wchar_t *pszRole = MSN_GCGetRole(thread, email);
- if (pszRole && !mir_tstrcmpi(pszRole, L"admin"))
+ if (pszRole && !mir_wstrcmpi(pszRole, L"admin"))
Items[3].pszDesc = LPGENW("&Deop user");
}
gcmi->nItems = _countof(Items);
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index b38a1c2680..2a37ab21e1 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -181,7 +181,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para }
msgBody = tHeader.readFromBuffer(msgBody);
if (!(email = NEWSTR_ALLOCA(tHeader["From"]))) return;
- mChatID = mir_a2t(tHeader["To"]);
+ mChatID = mir_a2u(tHeader["To"]);
if (wcsncmp(mChatID, L"19:", 3)) mChatID[0]=0; // NETID_THREAD
msgBody = tHeader.readFromBuffer(msgBody);
msgBody = tHeader.readFromBuffer(msgBody);
@@ -274,7 +274,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para psr[cnt] = (PROTOSEARCHRESULT*)mir_calloc(sizeof(PROTOSEARCHRESULT));
psr[cnt]->cbSize = sizeof(psr);
psr[cnt]->flags = PSR_TCHAR;
- psr[cnt]->id.w = psr[cnt]->nick.w = psr[cnt]->email.w = mir_a2t(wlid);
+ psr[cnt]->id.w = psr[cnt]->nick.w = psr[cnt]->email.w = mir_a2u(wlid);
cnt++;
}
}
@@ -513,20 +513,20 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli) }
if (!pszFile || !*pszFile) pszFile="file";
}
- ft->std.tszCurrentFile = mir_utf8decodeT(pszFile);
+ ft->std.tszCurrentFile = mir_utf8decodeW(pszFile);
ft->std.totalBytes = ft->std.currentFileSize = fileSize;
ft->std.totalFiles = 1;
ft->szInvcookie = (char*)mir_calloc(strlen(uri)+16);
sprintf(ft->szInvcookie, "%s/content/imgpsh", uri);
wchar_t tComment[40];
- mir_sntprintf(tComment, TranslateT("%I64u bytes"), ft->std.currentFileSize);
+ mir_snwprintf(tComment, TranslateT("%I64u bytes"), ft->std.currentFileSize);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.descr.w = (desc = ezxml_child(xmli, "Description"))?mir_utf8decodeT(desc->txt):tComment;
+ pre.descr.w = (desc = ezxml_child(xmli, "Description"))?mir_utf8decodeW(desc->txt):tComment;
pre.files.w = &ft->std.tszCurrentFile;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(ft->std.hContact, &pre);
@@ -569,7 +569,7 @@ void CMsnProto::MSN_ProcessYFind(char* buf, size_t len) const char *szNetId = ezxml_attr(cont, "t");
if (msnSearchId != NULL) {
if (szNetId != NULL) {
- ptrT szEmailT(mir_utf8decodeT(szEmail));
+ ptrW szEmailT(mir_utf8decodeW(szEmail));
PROTOSEARCHRESULT psr = { 0 };
psr.cbSize = sizeof(psr);
@@ -749,7 +749,7 @@ void CMsnProto::MSN_ProcessStatusMessage(ezxml_t xmli, const char* wlid) }
{
- ptrT tszStatus(mir_utf8decodeT(szStatMsg));
+ ptrW tszStatus(mir_utf8decodeW(szStatMsg));
if (szInst) MSN_SetMirVer(hContact, Lists_GetPlace(szEmail, szInst));
else {
MsnContact *cont = Lists_Get(hContact);
@@ -808,7 +808,7 @@ void CMsnProto::MSN_ProcessStatusMessage(ezxml_t xmli, const char* wlid) char *format = mir_strdup(parts[3]);
char *unknown = NULL;
if (ServiceExists(MS_LISTENINGTO_GETUNKNOWNTEXT))
- unknown = mir_utf8encodeT((wchar_t *)CallService(MS_LISTENINGTO_GETUNKNOWNTEXT, 0, 0));
+ unknown = mir_utf8encodeW((wchar_t *)CallService(MS_LISTENINGTO_GETUNKNOWNTEXT, 0, 0));
for (unsigned i = 4; i < pCount; i++) {
char part[16];
@@ -836,17 +836,17 @@ void CMsnProto::MSN_ProcessStatusMessage(ezxml_t xmli, const char* wlid) LISTENINGTOINFO lti = { 0 };
lti.cbSize = sizeof(LISTENINGTOINFO);
- lti.ptszTitle = mir_utf8decodeT(parts[4]);
- if (pCount > 5) lti.ptszArtist = mir_utf8decodeT(parts[5]);
- if (pCount > 6) lti.ptszAlbum = mir_utf8decodeT(parts[6]);
- if (pCount > 7) lti.ptszTrack = mir_utf8decodeT(parts[7]);
- if (pCount > 8) lti.ptszYear = mir_utf8decodeT(parts[8]);
- if (pCount > 9) lti.ptszGenre = mir_utf8decodeT(parts[9]);
- if (pCount > 10) lti.ptszLength = mir_utf8decodeT(parts[10]);
- if (pCount > 11) lti.ptszPlayer = mir_utf8decodeT(parts[11]);
- else lti.ptszPlayer = mir_utf8decodeT(parts[0]);
- if (pCount > 12) lti.ptszType = mir_utf8decodeT(parts[12]);
- else lti.ptszType = mir_utf8decodeT(parts[1]);
+ lti.ptszTitle = mir_utf8decodeW(parts[4]);
+ if (pCount > 5) lti.ptszArtist = mir_utf8decodeW(parts[5]);
+ if (pCount > 6) lti.ptszAlbum = mir_utf8decodeW(parts[6]);
+ if (pCount > 7) lti.ptszTrack = mir_utf8decodeW(parts[7]);
+ if (pCount > 8) lti.ptszYear = mir_utf8decodeW(parts[8]);
+ if (pCount > 9) lti.ptszGenre = mir_utf8decodeW(parts[9]);
+ if (pCount > 10) lti.ptszLength = mir_utf8decodeW(parts[10]);
+ if (pCount > 11) lti.ptszPlayer = mir_utf8decodeW(parts[11]);
+ else lti.ptszPlayer = mir_utf8decodeW(parts[0]);
+ if (pCount > 12) lti.ptszType = mir_utf8decodeW(parts[12]);
+ else lti.ptszType = mir_utf8decodeW(parts[1]);
wchar_t *cm = (wchar_t *)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%title% - %artist%", (LPARAM)<i);
setTString(hContact, "ListeningTo", cm);
@@ -898,7 +898,7 @@ void CMsnProto::MSN_ProcessNotificationMessage(char* buf, size_t len) SkinPlaySound(alertsoundname);
- wchar_t* alrt = mir_utf8decodeT(ezxml_txt(xmltxt));
+ wchar_t* alrt = mir_utf8decodeW(ezxml_txt(xmltxt));
MSN_ShowPopup(TranslateT("MSN Alert"), alrt, MSN_ALERT_POPUP | MSN_ALLOW_MSGBOX, fullurl);
mir_free(alrt);
}
@@ -1463,14 +1463,14 @@ void CMsnProto::MSN_InviteMessage(ThreadData* info, char* msgBody, char* email, ft->std.hContact = MSN_HContactFromEmail(email, nick, true, true);
mir_free(ft->std.tszCurrentFile);
- ft->std.tszCurrentFile = mir_utf8decodeT(Appfile);
+ ft->std.tszCurrentFile = mir_utf8decodeW(Appfile);
ft->std.totalBytes = ft->std.currentFileSize = _atoi64(Appfilesize);
ft->std.totalFiles = 1;
ft->szInvcookie = mir_strdup(Invcookie);
ft->p2p_dest = mir_strdup(email);
wchar_t tComment[40];
- mir_sntprintf(tComment, TranslateT("%I64u bytes"), ft->std.currentFileSize);
+ mir_snwprintf(tComment, TranslateT("%I64u bytes"), ft->std.currentFileSize);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
@@ -1536,8 +1536,8 @@ void CMsnProto::MSN_InviteMessage(ThreadData* info, char* msgBody, char* email, // netmeeting receive 1
if (Appname != NULL && !_stricmp(Appname, "NetMeeting")) {
- wchar_t text[512], *tszEmail = mir_a2t(email);
- mir_sntprintf(text, TranslateT("Accept NetMeeting request from %s?"), tszEmail);
+ wchar_t text[512], *tszEmail = mir_a2u(email);
+ mir_snwprintf(text, TranslateT("Accept NetMeeting request from %s?"), tszEmail);
mir_free(tszEmail);
if (MessageBox(NULL, text, TranslateT("MSN Protocol"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
@@ -1646,7 +1646,7 @@ void CMsnProto::MSN_CustomSmiley(const char* msgBody, char* email, char* nick, i wchar_t path[MAX_PATH];
MSN_GetCustomSmileyFileName(hContact, path, _countof(path), smileyName, iSmileyType);
- ft->std.tszCurrentFile = mir_tstrdup(path);
+ ft->std.tszCurrentFile = mir_wstrdup(path);
if (p2p_IsDlFileOk(ft))
delete ft;
@@ -1885,7 +1885,7 @@ LBL_InvalidCommand: GCEVENT gce = { sizeof(gce), &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = GetContactNameT(hContact);
- gce.ptszUID = mir_a2t(data.userEmail);
+ gce.ptszUID = mir_a2u(data.userEmail);
gce.time = time(NULL);
gce.bIsMe = FALSE;
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
@@ -2141,7 +2141,7 @@ LBL_InvalidCommand: GCEVENT gce = { sizeof(gce), &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = GetContactNameT(hContact);
- gce.ptszUID = mir_a2t(data.userEmail);
+ gce.ptszUID = mir_a2u(data.userEmail);
gce.ptszStatus = TranslateT("Others");
gce.time = time(NULL);
gce.bIsMe = FALSE;
diff --git a/protocols/MSN/src/msn_libstr.cpp b/protocols/MSN/src/msn_libstr.cpp index 9e0cd37318..e51ac49e88 100644 --- a/protocols/MSN/src/msn_libstr.cpp +++ b/protocols/MSN/src/msn_libstr.cpp @@ -27,7 +27,7 @@ static wchar_t* a2tf(const wchar_t* str, bool unicode) if (str == NULL)
return NULL;
- return unicode ? mir_tstrdup(str) : mir_a2t((char*)str);
+ return unicode ? mir_wstrdup(str) : mir_a2u((char*)str);
}
void overrideStr(wchar_t*& dest, const wchar_t* src, bool unicode, const wchar_t* def)
@@ -38,7 +38,7 @@ void overrideStr(wchar_t*& dest, const wchar_t* src, bool unicode, const wchar_t if (src != NULL)
dest = a2tf(src, unicode);
else if (def != NULL)
- dest = mir_tstrdup(def);
+ dest = mir_wstrdup(def);
}
char* arrayToHex(BYTE* data, size_t datasz)
@@ -305,11 +305,11 @@ wchar_t* EscapeChatTags(const wchar_t* pszText) nChars++;
if (nChars == 0)
- return mir_tstrdup(pszText);
+ return mir_wstrdup(pszText);
- wchar_t *pszNewText = (wchar_t*)mir_alloc(sizeof(wchar_t)*(mir_tstrlen(pszText) + 1 + nChars));
+ wchar_t *pszNewText = (wchar_t*)mir_alloc(sizeof(wchar_t)*(mir_wstrlen(pszText) + 1 + nChars));
if (pszNewText == NULL)
- return mir_tstrdup(pszText);
+ return mir_wstrdup(pszText);
const wchar_t *s = pszText;
wchar_t *d = pszNewText;
diff --git a/protocols/MSN/src/msn_lists.cpp b/protocols/MSN/src/msn_lists.cpp index 28126efa5d..acd43695cb 100644 --- a/protocols/MSN/src/msn_lists.cpp +++ b/protocols/MSN/src/msn_lists.cpp @@ -245,12 +245,12 @@ void CMsnProto::MSN_CleanupLists(void) int count = db_event_count(p.hContact);
if (count) {
wchar_t text[256];
- wchar_t *sze = mir_a2t(p.email);
- mir_sntprintf(text, TranslateT("Contact %s has been removed from the server.\nWould you like to keep it as \"Local Only\" contact to preserve history?"), sze);
+ wchar_t *sze = mir_a2u(p.email);
+ mir_snwprintf(text, TranslateT("Contact %s has been removed from the server.\nWould you like to keep it as \"Local Only\" contact to preserve history?"), sze);
mir_free(sze);
wchar_t title[128];
- mir_sntprintf(title, TranslateT("%s protocol"), m_tszUserName);
+ mir_snwprintf(title, TranslateT("%s protocol"), m_tszUserName);
if (MessageBox(NULL, text, title, MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND) == IDYES) {
MSN_AddUser(p.hContact, p.email, 0, LIST_LL);
diff --git a/protocols/MSN/src/msn_mail.cpp b/protocols/MSN/src/msn_mail.cpp index 27cb629258..2016dfc9b9 100644 --- a/protocols/MSN/src/msn_mail.cpp +++ b/protocols/MSN/src/msn_mail.cpp @@ -255,14 +255,14 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial) wchar_t* mimeSubjectW = tFileInfo.decode(Subject);
- mir_sntprintf(tBuffer2, TranslateT("Subject: %s"), mimeSubjectW);
+ mir_snwprintf(tBuffer2, TranslateT("Subject: %s"), mimeSubjectW);
wchar_t* msgtxt = _stricmp(From, Fromaddr) ?
TranslateT("Hotmail from %s (%S)") : TranslateT("Hotmail from %s");
- mir_sntprintf(tBuffer, msgtxt, mimeFromW, Fromaddr);
+ mir_snwprintf(tBuffer, msgtxt, mimeFromW, Fromaddr);
mir_free(mimeFromW);
mir_free(mimeSubjectW);
ShowPopup = true;
@@ -271,8 +271,8 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial) const char* MailData = tFileInfo["Mail-Data"];
if (MailData != NULL) processMailData((char*)MailData);
- mir_sntprintf(tBuffer, m_tszUserName);
- mir_sntprintf(tBuffer2, TranslateT("Unread mail is available: %d in Inbox and %d in other folders."), mUnreadMessages, mUnreadJunkEmails);
+ mir_snwprintf(tBuffer, m_tszUserName);
+ mir_snwprintf(tBuffer2, TranslateT("Unread mail is available: %d in Inbox and %d in other folders."), mUnreadMessages, mUnreadJunkEmails);
}
if (UnreadMessages == mUnreadMessages && UnreadJunkEmails == mUnreadJunkEmails && !isInitial)
@@ -385,10 +385,10 @@ void CMsnProto::displayEmailCount(MCONTACT hContact) ch = wcschr(ch + 1, '[');
} while (ch && !iswdigit(ch[1]));
if (ch) *ch = 0;
- rtrimt(name);
+ rtrimw(name);
wchar_t szNick[128];
- mir_sntprintf(szNick, getByte("DisableHotmailJunk", 0) ? L"%s [%d]" : L"%s [%d][%d]", name, mUnreadMessages, mUnreadJunkEmails);
+ mir_snwprintf(szNick, getByte("DisableHotmailJunk", 0) ? L"%s [%d]" : L"%s [%d][%d]", name, mUnreadMessages, mUnreadJunkEmails);
nickChg = true;
setTString(hContact, "Nick", szNick);
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index 3d76b63cde..5b6b1b1ec7 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -118,7 +118,7 @@ void CMsnProto::InitCustomFolders(void) if (InitCstFldRan) return;
wchar_t folder[MAX_PATH];
- mir_sntprintf(folder, L"%%miranda_avatarcache%%\\%S", m_szModuleName);
+ mir_snwprintf(folder, L"%%miranda_avatarcache%%\\%S", m_szModuleName);
hCustomSmileyFolder = FoldersRegisterCustomPathT(LPGEN("Custom Smileys"), m_szModuleName, folder, m_tszUserName);
InitCstFldRan = true;
@@ -170,7 +170,7 @@ char* MSN_GetAvatarHash(char* szContext, char** pszUrl) // MSN_GetAvatarFileName - gets a file name for an contact's avatar
void CMsnProto::MSN_GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen, const wchar_t *ext)
{
- size_t tPathLen = mir_sntprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
+ size_t tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
if (_waccess(pszDest, 0))
CreateDirectoryTreeT(pszDest);
@@ -181,8 +181,8 @@ void CMsnProto::MSN_GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_ if (getString(hContact, "PictContext", &dbv) == 0) {
char* szAvatarHash = MSN_GetAvatarHash(dbv.pszVal);
if (szAvatarHash != NULL) {
- wchar_t *sztAvatarHash = mir_a2t(szAvatarHash);
- tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s.", sztAvatarHash);
+ wchar_t *sztAvatarHash = mir_a2u(szAvatarHash);
+ tPathLen += mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s.", sztAvatarHash);
mir_free(sztAvatarHash);
mir_free(szAvatarHash);
}
@@ -196,13 +196,13 @@ void CMsnProto::MSN_GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_ pszDest[0] = 0;
}
else {
- wchar_t *sztModuleName = mir_a2t(m_szModuleName);
- tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s avatar.", sztModuleName);
+ wchar_t *sztModuleName = mir_a2u(m_szModuleName);
+ tPathLen += mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s avatar.", sztModuleName);
mir_free(sztModuleName);
}
if (ext == NULL) {
- mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"*");
+ mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"*");
bool found = false;
_wfinddata_t c_file;
@@ -210,7 +210,7 @@ void CMsnProto::MSN_GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_ if (hFile > -1L) {
do {
if (wcsrchr(c_file.name, '.')) {
- mir_sntprintf(pszDest + tPathLen2, cbLen - tPathLen2, L"\\%s", c_file.name);
+ mir_snwprintf(pszDest + tPathLen2, cbLen - tPathLen2, L"\\%s", c_file.name);
found = true;
}
} while (_wfindnext(hFile, &c_file) == 0);
@@ -221,7 +221,7 @@ void CMsnProto::MSN_GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_ }
else {
tPathLen--;
- mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, ext);
+ mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, ext);
}
}
@@ -319,14 +319,14 @@ void CMsnProto::MSN_GetCustomSmileyFileName(MCONTACT hContact, wchar_t* pszDest, wchar_t* path = (wchar_t*)alloca(cbLen * sizeof(wchar_t));
if (hCustomSmileyFolder == NULL || FoldersGetCustomPathT(hCustomSmileyFolder, path, (int)cbLen, L"")) {
wchar_t *tmpPath = Utils_ReplaceVarsT(L"%miranda_userdata%");
- wchar_t *tszModuleName = mir_a2t(m_szModuleName);
- tPathLen = mir_sntprintf(pszDest, cbLen, L"%s\\%s\\CustomSmiley", tmpPath, tszModuleName);
+ wchar_t *tszModuleName = mir_a2u(m_szModuleName);
+ tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%s\\CustomSmiley", tmpPath, tszModuleName);
mir_free(tszModuleName);
mir_free(tmpPath);
}
else {
- mir_tstrcpy(pszDest, path);
- tPathLen = mir_tstrlen(pszDest);
+ mir_wstrcpy(pszDest, path);
+ tPathLen = mir_wstrlen(pszDest);
}
if (hContact != NULL) {
@@ -337,12 +337,12 @@ void CMsnProto::MSN_GetCustomSmileyFileName(MCONTACT hContact, wchar_t* pszDest, _ui64tow((UINT_PTR)hContact, dbv.ptszVal, 10);
}
- tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s", dbv.ptszVal);
+ tPathLen += mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s", dbv.ptszVal);
db_free(&dbv);
}
else {
- wchar_t *tszModuleName = mir_a2t(m_szModuleName);
- tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s", tszModuleName);
+ wchar_t *tszModuleName = mir_a2u(m_szModuleName);
+ tPathLen += mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s", tszModuleName);
mir_free(tszModuleName);
}
@@ -356,8 +356,8 @@ void CMsnProto::MSN_GetCustomSmileyFileName(MCONTACT hContact, wchar_t* pszDest, if (!exist)
CreateDirectoryTreeT(pszDest);
- wchar_t *sztSmileyName = mir_a2t(SmileyName);
- mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s.%s", sztSmileyName,
+ wchar_t *sztSmileyName = mir_a2u(SmileyName);
+ mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s.%s", sztSmileyName,
type == MSN_APPID_CUSTOMSMILEY ? L"png" : L"gif");
mir_free(sztSmileyName);
}
@@ -791,7 +791,7 @@ void CMsnProto::MSN_SetServerStatus(int newStatus) wchar_t buf[128] = L"Miranda";
DWORD buflen = _countof(buf);
GetComputerName(buf, &buflen);
- szPlace = mir_utf8encodeT(buf);
+ szPlace = mir_utf8encodeW(buf);
}
char** msgptr = GetStatusMsgLoc(newStatus);
@@ -921,7 +921,7 @@ void CMsnProto::MSN_ShowError(const char* msgtext, ...) wchar_t *buf = Langpack_PcharToTchar(msgtext);
va_start(tArgs, msgtext);
- mir_vsntprintf(tBuffer, _countof(tBuffer), buf, tArgs);
+ mir_vsnwprintf(tBuffer, _countof(tBuffer), buf, tArgs);
va_end(tArgs);
mir_free(buf);
@@ -996,14 +996,14 @@ void CMsnProto::InitPopups(void) ppc.colorBack = RGB(173, 206, 247);
ppc.colorText = GetSysColor(COLOR_WINDOWTEXT);
ppc.iSeconds = 3;
- mir_sntprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Hotmail"));
+ mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Hotmail"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Hotmail");
hPopupHotmail = Popup_RegisterClass(&ppc);
ppc.colorBack = RGB(173, 206, 247);
ppc.colorText = GetSysColor(COLOR_WINDOWTEXT);
ppc.iSeconds = 3;
- mir_sntprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Notify"));
+ mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Notify"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Notify");
hPopupNotify = Popup_RegisterClass(&ppc);
@@ -1012,7 +1012,7 @@ void CMsnProto::InitPopups(void) ppc.colorText = RGB(255, 245, 225); //Yellow
ppc.iSeconds = 60;
- mir_sntprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Error"));
+ mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Error"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Error");
hPopupError = Popup_RegisterClass(&ppc);
}
@@ -1026,7 +1026,7 @@ void CALLBACK sttMainThreadCallback(void *param) if ((iserr && !pud->proto->MyOptions.ShowErrorsAsPopups) || !ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
if (pud->flags & MSN_ALLOW_MSGBOX) {
wchar_t szMsg[MAX_SECONDLINE + MAX_CONTACTNAME];
- mir_sntprintf(szMsg, L"%s:\n%s", pud->title, pud->text);
+ mir_snwprintf(szMsg, L"%s:\n%s", pud->title, pud->text);
int ret = MessageBox(NULL, szMsg, TranslateT("MSN Protocol"),
MB_YESNO | (iserr ? MB_ICONERROR : MB_ICONINFORMATION));
if (ret == IDYES)
@@ -1066,8 +1066,8 @@ void CMsnProto::MSN_ShowPopup(const wchar_t* nickname, const wchar_t* msg, int f PopupData *pud = (PopupData*)mir_calloc(sizeof(PopupData));
pud->flags = flags;
pud->url = mir_strdup(url);
- pud->title = mir_tstrdup(nickname);
- pud->text = mir_tstrdup(msg);
+ pud->title = mir_wstrdup(nickname);
+ pud->text = mir_wstrdup(msg);
pud->proto = this;
CallFunctionAsync(sttMainThreadCallback, pud);
@@ -1180,7 +1180,7 @@ int filetransfer::openNext(void) if (std.ptszFiles && std.ptszFiles[cf]) {
bCompleted = false;
- replaceStrT(std.tszCurrentFile, std.ptszFiles[cf]);
+ replaceStrW(std.tszCurrentFile, std.ptszFiles[cf]);
fileId = _wopen(std.tszCurrentFile, _O_BINARY | _O_RDONLY, _S_IREAD);
if (fileId != -1) {
std.currentFileSize = _filelengthi64(fileId);
diff --git a/protocols/MSN/src/msn_natdetect.cpp b/protocols/MSN/src/msn_natdetect.cpp index 30ecdbc16f..e468eebf2c 100644 --- a/protocols/MSN/src/msn_natdetect.cpp +++ b/protocols/MSN/src/msn_natdetect.cpp @@ -314,7 +314,7 @@ static bool IsIcfEnabled(void) wchar_t szFileName[MAX_PATH];
GetModuleFileName(NULL, szFileName, _countof(szFileName));
- wszFileName = mir_t2u(szFileName);
+ wszFileName = mir_wstrdup(szFileName);
// Allocate a BSTR for the process image file name.
fwBstrProcessImageFileName = SysAllocString(wszFileName);
diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp index 96437c9bef..38b32891a8 100644 --- a/protocols/MSN/src/msn_opts.cpp +++ b/protocols/MSN/src/msn_opts.cpp @@ -250,7 +250,7 @@ LBL_Continue: #ifdef OBSOLETE
GetDlgItemText(hwndDlg, IDC_HANDLE2, screenStr, _countof(screenStr));
if (!proto->getTString("Nick", &dbv)) {
- if (mir_tstrcmp(dbv.ptszVal, screenStr))
+ if (mir_wstrcmp(dbv.ptszVal, screenStr))
proto->MSN_SendNickname(screenStr);
db_free(&dbv);
}
diff --git a/protocols/MSN/src/msn_p2p.cpp b/protocols/MSN/src/msn_p2p.cpp index 632aede4bc..5bb5a9b610 100644 --- a/protocols/MSN/src/msn_p2p.cpp +++ b/protocols/MSN/src/msn_p2p.cpp @@ -259,8 +259,8 @@ void CMsnProto::p2p_savePicture2disk(filetransfer* ft) cont.hContact = ft->std.hContact;
cont.type = 1;
- wchar_t* pathcpy = mir_tstrdup(ft->std.tszCurrentFile);
- mir_tstrcpy(wcsrchr(pathcpy, '.') + 1, ext);
+ wchar_t* pathcpy = mir_wstrdup(ft->std.tszCurrentFile);
+ mir_wstrcpy(wcsrchr(pathcpy, '.') + 1, ext);
_wrename(ft->std.tszCurrentFile, pathcpy);
cont.path = pathcpy;
@@ -1184,7 +1184,7 @@ void CMsnProto::p2p_InitFileTransfer( }
else {
mir_free(ft->std.tszCurrentFile);
- ft->std.tszCurrentFile = mir_tstrdup(szFileName);
+ ft->std.tszCurrentFile = mir_wstrdup(szFileName);
// debugLogA("My avatar file opened for %s as %08p::%d", szEmail, ft, ft->fileId);
ft->std.totalBytes = ft->std.currentFileSize = _filelengthi64(ft->fileId);
ft->std.flags |= PFTS_SENDING;
@@ -1218,13 +1218,13 @@ void CMsnProto::p2p_InitFileTransfer( }
mir_free(ft->std.tszCurrentFile);
- ft->std.tszCurrentFile = mir_u2t(wszFileName);
+ ft->std.tszCurrentFile = mir_wstrdup(wszFileName);
ft->std.totalBytes = ft->std.currentFileSize = ((HFileContext*)szContext)->dwSize;
ft->std.totalFiles = 1;
wchar_t tComment[40];
- mir_sntprintf(tComment, TranslateT("%I64u bytes"), ft->std.currentFileSize);
+ mir_snwprintf(tComment, TranslateT("%I64u bytes"), ft->std.currentFileSize);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
@@ -2030,7 +2030,7 @@ void CMsnProto::p2p_invite(unsigned iAppID, filetransfer* ft, const char *wlid) else
pszFiles = ft->std.tszCurrentFile;
- wchar_t *fname = mir_t2u(pszFiles);
+ wchar_t *fname = mir_wstrdup(pszFiles);
wcsncpy(ctx->wszFileName, fname, MAX_PATH);
mir_free(fname);
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index 624c736f97..e9e6950beb 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -144,7 +144,7 @@ CMsnProto::CMsnProto(const char* aProtoName, const wchar_t* aUserName) : nlu1.ptszDescriptiveName = szBuffer;
mir_snprintf(szDbsettings, "%s_HTTPS", m_szModuleName);
- mir_sntprintf(szBuffer, TranslateT("%s plugin HTTPS connections"), m_tszUserName);
+ mir_snwprintf(szBuffer, TranslateT("%s plugin HTTPS connections"), m_tszUserName);
hNetlibUserHttps = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu1);
NETLIBUSER nlu = { 0 };
@@ -158,7 +158,7 @@ CMsnProto::CMsnProto(const char* aProtoName, const wchar_t* aUserName) : nlu.pfnHttpGatewayWrapSend = msn_httpGatewayWrapSend;
nlu.pfnHttpGatewayUnwrapRecv = msn_httpGatewayUnwrapRecv;
- mir_sntprintf(szBuffer, TranslateT("%s plugin connections"), m_tszUserName);
+ mir_snwprintf(szBuffer, TranslateT("%s plugin connections"), m_tszUserName);
m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
m_DisplayNameCache = NULL;
@@ -451,7 +451,7 @@ HANDLE __cdecl CMsnProto::SearchBasic(const wchar_t* id) {
if (!msnLoggedIn) return 0;
- wchar_t* email = mir_tstrdup(id);
+ wchar_t* email = mir_wstrdup(id);
ForkThread(&CMsnProto::MsnSearchAckThread, email);
return email;
@@ -492,8 +492,8 @@ void __cdecl CMsnProto::MsnFileAckThread(void* arg) filetransfer* ft = (filetransfer*)arg;
wchar_t filefull[MAX_PATH];
- mir_sntprintf(filefull, L"%s\\%s", ft->std.tszWorkingDir, ft->std.tszCurrentFile);
- replaceStrT(ft->std.tszCurrentFile, filefull);
+ mir_snwprintf(filefull, L"%s\\%s", ft->std.tszWorkingDir, ft->std.tszCurrentFile);
+ replaceStrW(ft->std.tszCurrentFile, filefull);
ResetEvent(ft->hResumeEvt);
if (ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_FILERESUME, ft, (LPARAM)&ft->std))
@@ -583,13 +583,13 @@ HANDLE __cdecl CMsnProto::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t* s return 0;
#endif
- if ((ft->std.tszWorkingDir = mir_tstrdup(szPath)) == NULL) {
+ if ((ft->std.tszWorkingDir = mir_wstrdup(szPath)) == NULL) {
wchar_t szCurrDir[MAX_PATH];
GetCurrentDirectory(_countof(szCurrDir), szCurrDir);
- ft->std.tszWorkingDir = mir_tstrdup(szCurrDir);
+ ft->std.tszWorkingDir = mir_wstrdup(szCurrDir);
}
else {
- size_t len = mir_tstrlen(ft->std.tszWorkingDir) - 1;
+ size_t len = mir_wstrlen(ft->std.tszWorkingDir) - 1;
if (ft->std.tszWorkingDir[len] == '\\')
ft->std.tszWorkingDir[len] = 0;
}
@@ -672,7 +672,7 @@ int __cdecl CMsnProto::FileResume(HANDLE hTransfer, int* action, const wchar_t** ft->bCanceled = true;
break;
case FILERESUME_RENAME:
- replaceStrT(ft->std.tszCurrentFile, *szFilename);
+ replaceStrW(ft->std.tszCurrentFile, *szFilename);
break;
case FILERESUME_OVERWRITE:
ft->std.currentFileProgress = 0;
@@ -701,7 +701,7 @@ int __cdecl CMsnProto::FileResume(HANDLE hTransfer, int* action, const wchar_t** break;
case FILERESUME_RENAME:
- replaceStrT(ft->std.tszCurrentFile, *szFilename);
+ replaceStrW(ft->std.tszCurrentFile, *szFilename);
default:
bool fcrt = ft->create() != -1;
@@ -829,7 +829,7 @@ int CMsnProto::RecvContacts(MCONTACT hContact, PROTORECVEVENT* pre) int i;
for (i = 0; i < pre->lParam; i++)
- dbei.cbBlob += int(mir_tstrlen(isrList[i]->nick.w) + 2 + mir_tstrlen(isrList[i]->id.w));
+ dbei.cbBlob += int(mir_wstrlen(isrList[i]->nick.w) + 2 + mir_wstrlen(isrList[i]->id.w));
dbei.pBlob = (PBYTE)_alloca(dbei.cbBlob);
for (i = 0, pCurBlob = dbei.pBlob; i < pre->lParam; i++) {
mir_strcpy((char*)pCurBlob, _T2A(isrList[i]->nick.w));
@@ -1054,7 +1054,7 @@ int __cdecl CMsnProto::SetAwayMsg(int status, const wchar_t* msg) return 1;
mir_free(*msgptr);
- char* buf = *msgptr = mir_utf8encodeT(msg);
+ char* buf = *msgptr = mir_utf8encodeW(msg);
if (buf && mir_strlen(buf) > 1859) {
buf[1859] = 0;
const int i = 1858;
diff --git a/protocols/MSN/src/msn_skypeab.cpp b/protocols/MSN/src/msn_skypeab.cpp index 034b75f52e..a0cd9ca76d 100644 --- a/protocols/MSN/src/msn_skypeab.cpp +++ b/protocols/MSN/src/msn_skypeab.cpp @@ -45,7 +45,7 @@ static wchar_t* get_json_str(JSONNode *item, const char *pszValue) {
if (JSONNode *node = json_get(item, pszValue)) {
wchar_t *ret = json_as_string(node);
- if (!mir_tstrcmp(ret, L"null")) {
+ if (!mir_wstrcmp(ret, L"null")) {
mir_free(ret);
return NULL;
}
@@ -79,14 +79,14 @@ bool CMsnProto::MSN_SKYABRefreshClist(void) JSONNode *items = json_as_array(root), *item;
for (size_t i = 0; i < json_size(items); i++) {
int lstId = LIST_FL;
- ptrT nick;
+ ptrW nick;
item = json_at(items, i);
if (item == NULL)
break;
- ptrA skypename(mir_t2a(ptrT(json_as_string(json_get(item, "skypename")))));
- ptrA pszNick(mir_t2a(ptrT(get_json_str(item, "fullname"))));
+ ptrA skypename(mir_u2a(ptrW(json_as_string(json_get(item, "skypename")))));
+ ptrA pszNick(mir_u2a(ptrW(get_json_str(item, "fullname"))));
char szWLId[128];
mir_snprintf(szWLId, sizeof(szWLId), "%d:%s", NETID_SKYPE, skypename);
MCONTACT hContact = MSN_HContactFromEmail(szWLId, pszNick, true, false);
@@ -137,8 +137,8 @@ bool CMsnProto::MSN_SKYABGetProfiles(const char *pszPOST) break;
node = json_get(item, "username");
- ptrA skypename(mir_t2a(ptrT(json_as_string(node))));
- ptrT value;
+ ptrA skypename(mir_u2a(ptrW(json_as_string(node))));
+ ptrW value;
char szWLId[128];
mir_snprintf(szWLId, sizeof(szWLId), "%d:%s", NETID_SKYPE, skypename);
MCONTACT hContact = MSN_HContactFromEmail(szWLId, skypename, false, false);
@@ -184,8 +184,8 @@ bool CMsnProto::MSN_SKYABGetProfile(const char *wlid) if (item == NULL)
return false;
- ptrA skypename(mir_t2a(ptrT(json_as_string(json_get(item, "username")))));
- ptrT value;
+ ptrA skypename(mir_u2a(ptrW(json_as_string(json_get(item, "username")))));
+ ptrW value;
char szWLId[128];
mir_snprintf(szWLId, sizeof(szWLId), "%d:%s", NETID_SKYPE, skypename);
MCONTACT hContact = MSN_HContactFromEmail(szWLId, skypename, false, false);
diff --git a/protocols/MSN/src/msn_srv.cpp b/protocols/MSN/src/msn_srv.cpp index 33f1a10da5..b854e48596 100644 --- a/protocols/MSN/src/msn_srv.cpp +++ b/protocols/MSN/src/msn_srv.cpp @@ -38,7 +38,7 @@ void CMsnProto::MSN_AddGroup(const char* grpName, const char *grpId, bool init) m_arGroups.insert(p);
if (init)
- Clist_GroupCreate(0, ptrT(mir_utf8decodeT(grpName)));
+ Clist_GroupCreate(0, ptrW(mir_utf8decodeW(grpName)));
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/MSN/src/msn_svcs.cpp b/protocols/MSN/src/msn_svcs.cpp index a0cc11efe2..4746906aca 100644 --- a/protocols/MSN/src/msn_svcs.cpp +++ b/protocols/MSN/src/msn_svcs.cpp @@ -81,7 +81,7 @@ INT_PTR CMsnProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) MSN_GetAvatarFileName(NULL, filename, _countof(filename), NULL);
pai->format = ProtoGetAvatarFormat(filename);
if (pai->format != PA_FORMAT_UNKNOWN)
- mir_tstrcpy(pai->filename, filename);
+ mir_wstrcpy(pai->filename, filename);
return pai->format == PA_FORMAT_UNKNOWN ? GAIR_NOAVATAR : GAIR_SUCCESS;
}
@@ -113,7 +113,7 @@ INT_PTR CMsnProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) mir_free(szAvatarHash);
}
}
- mir_tstrcpy(pai->filename, filename);
+ mir_wstrcpy(pai->filename, filename);
return GAIR_SUCCESS;
}
@@ -140,7 +140,7 @@ INT_PTR CMsnProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) ft->p2p_object = mir_strdup(szContext);
MSN_GetAvatarFileName(pai->hContact, filename, _countof(filename), L"unk");
- ft->std.tszCurrentFile = mir_tstrdup(filename);
+ ft->std.tszCurrentFile = mir_wstrdup(filename);
p2p_invite(MSN_APPID_AVATAR, ft, NULL);
}
@@ -216,7 +216,7 @@ INT_PTR CMsnProto::SetAvatar(WPARAM, LPARAM lParam) MSN_SetMyAvatar(fname, pData, dwPngSize);
StoreAvatarData* par = (StoreAvatarData*)mir_alloc(sizeof(StoreAvatarData));
- par->szName = mir_tstrdup(fname);
+ par->szName = mir_wstrdup(fname);
par->data = pData;
par->dataSize = dwPngSize;
par->szMimeType = "image/png";
@@ -301,15 +301,15 @@ INT_PTR CMsnProto::GetCurrentMedia(WPARAM, LPARAM lParam) if (cm == NULL || cm->cbSize != sizeof(LISTENINGTOINFO))
return -1;
- cm->ptszArtist = mir_tstrdup(msnCurrentMedia.ptszArtist);
- cm->ptszAlbum = mir_tstrdup(msnCurrentMedia.ptszAlbum);
- cm->ptszTitle = mir_tstrdup(msnCurrentMedia.ptszTitle);
- cm->ptszTrack = mir_tstrdup(msnCurrentMedia.ptszTrack);
- cm->ptszYear = mir_tstrdup(msnCurrentMedia.ptszYear);
- cm->ptszGenre = mir_tstrdup(msnCurrentMedia.ptszGenre);
- cm->ptszLength = mir_tstrdup(msnCurrentMedia.ptszLength);
- cm->ptszPlayer = mir_tstrdup(msnCurrentMedia.ptszPlayer);
- cm->ptszType = mir_tstrdup(msnCurrentMedia.ptszType);
+ cm->ptszArtist = mir_wstrdup(msnCurrentMedia.ptszArtist);
+ cm->ptszAlbum = mir_wstrdup(msnCurrentMedia.ptszAlbum);
+ cm->ptszTitle = mir_wstrdup(msnCurrentMedia.ptszTitle);
+ cm->ptszTrack = mir_wstrdup(msnCurrentMedia.ptszTrack);
+ cm->ptszYear = mir_wstrdup(msnCurrentMedia.ptszYear);
+ cm->ptszGenre = mir_wstrdup(msnCurrentMedia.ptszGenre);
+ cm->ptszLength = mir_wstrdup(msnCurrentMedia.ptszLength);
+ cm->ptszPlayer = mir_wstrdup(msnCurrentMedia.ptszPlayer);
+ cm->ptszType = mir_wstrdup(msnCurrentMedia.ptszType);
cm->dwFlags = msnCurrentMedia.dwFlags;
return 0;
@@ -360,7 +360,7 @@ INT_PTR CMsnProto::SetCurrentMedia(WPARAM, LPARAM lParam) text = (wchar_t *)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%title% - %artist%", (LPARAM)&msnCurrentMedia);
else {
text = (wchar_t *)mir_alloc(128 * sizeof(wchar_t));
- mir_sntprintf(text, 128, L"%s - %s", (msnCurrentMedia.ptszTitle ? msnCurrentMedia.ptszTitle : L""),
+ mir_snwprintf(text, 128, L"%s - %s", (msnCurrentMedia.ptszTitle ? msnCurrentMedia.ptszTitle : L""),
(msnCurrentMedia.ptszArtist ? msnCurrentMedia.ptszArtist : L""));
}
setTString("ListeningTo", text);
diff --git a/protocols/MSN/src/msn_threads.cpp b/protocols/MSN/src/msn_threads.cpp index ea171e6215..d3ec36dc86 100644 --- a/protocols/MSN/src/msn_threads.cpp +++ b/protocols/MSN/src/msn_threads.cpp @@ -385,13 +385,13 @@ ThreadData* CMsnProto::MSN_GetThreadByContact(const char* wlid, TInfoType type) GCThreadData* CMsnProto::MSN_GetThreadByChatId(const wchar_t* chatId)
{
- if (mir_tstrlen(chatId) == 0)
+ if (mir_wstrlen(chatId) == 0)
return NULL;
mir_cslock lck(m_csThreads);
for (int i = 0; i < m_arGCThreads.getCount(); i++) {
GCThreadData *T = m_arGCThreads[i];
- if (mir_tstrcmpi(T->mChatID, chatId) == 0)
+ if (mir_wstrcmpi(T->mChatID, chatId) == 0)
return T;
}
diff --git a/protocols/MSN/src/stdafx.h b/protocols/MSN/src/stdafx.h index 859023b6bc..3439a57fc0 100644 --- a/protocols/MSN/src/stdafx.h +++ b/protocols/MSN/src/stdafx.h @@ -1033,7 +1033,7 @@ struct InviteChatParam CMsnProto* ppro;
InviteChatParam(const wchar_t* id, MCONTACT hContact, CMsnProto* ppro)
- : id(mir_tstrdup(id)), hContact(hContact), ppro(ppro) {}
+ : id(mir_wstrdup(id)), hContact(hContact), ppro(ppro) {}
~InviteChatParam() {
mir_free(id);
diff --git a/protocols/MinecraftDynmap/src/chat.cpp b/protocols/MinecraftDynmap/src/chat.cpp index 4317adf91a..d41748bd84 100644 --- a/protocols/MinecraftDynmap/src/chat.cpp +++ b/protocols/MinecraftDynmap/src/chat.cpp @@ -27,8 +27,8 @@ void MinecraftDynmapProto::UpdateChat(const char *name, const char *message, con std::string smessage = message; utils::text::replace_all(&smessage, "%", "%%"); - ptrT tmessage(mir_a2t_cp(smessage.c_str(), CP_UTF8)); - ptrT tname(mir_a2t_cp(name, CP_UTF8)); + ptrW tmessage(mir_a2u_cp(smessage.c_str(), CP_UTF8)); + ptrW tname(mir_a2u_cp(name, CP_UTF8)); GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_MESSAGE }; GCEVENT gce = { sizeof(gce), &gcd }; @@ -37,7 +37,7 @@ void MinecraftDynmapProto::UpdateChat(const char *name, const char *message, con if (tname == NULL) { gcd.iType = GC_EVENT_INFORMATION; - tname = mir_tstrdup(TranslateT("Server")); + tname = mir_wstrdup(TranslateT("Server")); gce.bIsMe = false; } else gce.bIsMe = (m_nick == name); @@ -61,7 +61,7 @@ int MinecraftDynmapProto::OnChatEvent(WPARAM, LPARAM lParam) { case GC_USER_MESSAGE: { - std::string text = mir_t2a_cp(hook->ptszText,CP_UTF8); + std::string text = mir_u2a_cp(hook->ptszText,CP_UTF8); // replace %% back to %, because chat automatically does this to sent messages utils::text::replace_all(&text, "%%", "%"); @@ -88,7 +88,7 @@ int MinecraftDynmapProto::OnChatEvent(WPARAM, LPARAM lParam) void MinecraftDynmapProto::AddChatContact(const char *name) { - ptrT tname(mir_a2t_cp(name, CP_UTF8)); + ptrW tname(mir_a2u_cp(name, CP_UTF8)); GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_JOIN }; GCEVENT gce = { sizeof(gce), &gcd }; @@ -108,7 +108,7 @@ void MinecraftDynmapProto::AddChatContact(const char *name) void MinecraftDynmapProto::DeleteChatContact(const char *name) { - ptrT tname(mir_a2t_cp(name, CP_UTF8)); + ptrW tname(mir_a2u_cp(name, CP_UTF8)); GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_PART }; GCEVENT gce = { sizeof(gce), &gcd }; @@ -123,7 +123,7 @@ void MinecraftDynmapProto::DeleteChatContact(const char *name) INT_PTR MinecraftDynmapProto::OnJoinChat(WPARAM,LPARAM suppress) { - ptrT tszTitle(mir_a2t_cp(m_title.c_str(), CP_UTF8)); + ptrW tszTitle(mir_a2u_cp(m_title.c_str(), CP_UTF8)); // Create the group chat session GCSESSION gcw = {sizeof(gcw)}; @@ -155,7 +155,7 @@ INT_PTR MinecraftDynmapProto::OnJoinChat(WPARAM,LPARAM suppress) void MinecraftDynmapProto::SetTopic(const char *topic) { - ptrT ttopic(mir_a2t_cp(topic, CP_UTF8)); + ptrW ttopic(mir_a2u_cp(topic, CP_UTF8)); GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_TOPIC }; GCEVENT gce = { sizeof(gce), &gcd }; diff --git a/protocols/MinecraftDynmap/src/dialogs.cpp b/protocols/MinecraftDynmap/src/dialogs.cpp index 28c428e30b..3f8c6fc4c9 100644 --- a/protocols/MinecraftDynmap/src/dialogs.cpp +++ b/protocols/MinecraftDynmap/src/dialogs.cpp @@ -64,7 +64,7 @@ static BOOL StoreDBCheckState(MinecraftDynmapProto* ppro, HWND hwnd, int idCtrl, static void LoadDBText(MinecraftDynmapProto* ppro, HWND hwnd, int idCtrl, const char* szSetting) { - ptrT tstr(db_get_tsa(NULL, ppro->m_szModuleName, szSetting)); + ptrW tstr(db_get_tsa(NULL, ppro->m_szModuleName, szSetting)); if (tstr) SetDlgItemText(hwnd, idCtrl, tstr); } diff --git a/protocols/MinecraftDynmap/src/proto.cpp b/protocols/MinecraftDynmap/src/proto.cpp index 71c7932685..7d2c845e55 100644 --- a/protocols/MinecraftDynmap/src/proto.cpp +++ b/protocols/MinecraftDynmap/src/proto.cpp @@ -46,12 +46,12 @@ MinecraftDynmapProto::MinecraftDynmapProto(const char* proto_name, const wchar_t NETLIBUSER nlu = {sizeof(nlu)}; nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR; nlu.szSettingsModule = m_szModuleName; - mir_sntprintf(descr, TranslateT("%s server connection"), m_tszUserName); + mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName); nlu.ptszDescriptiveName = descr; m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); if (m_hNetlibUser == NULL) { wchar_t error[200]; - mir_sntprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName); + mir_snwprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName); MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR); } diff --git a/protocols/Omegle/src/chat.cpp b/protocols/Omegle/src/chat.cpp index b3db982704..73fc40ea11 100644 --- a/protocols/Omegle/src/chat.cpp +++ b/protocols/Omegle/src/chat.cpp @@ -37,7 +37,7 @@ void OmegleProto::UpdateChat(const wchar_t *name, const wchar_t *message, bool a name = TranslateT("Server");
gce.bIsMe = false;
}
- else gce.bIsMe = !mir_tstrcmp(name, this->facy.nick_);
+ else gce.bIsMe = !mir_wstrcmp(name, this->facy.nick_);
if (addtolog)
gce.dwFlags |= GCEF_ADDTOLOG;
@@ -58,7 +58,7 @@ int OmegleProto::OnChatEvent(WPARAM, LPARAM lParam) {
case GC_USER_MESSAGE:
{
- std::string text = mir_t2a_cp(hook->ptszText, CP_UTF8);
+ std::string text = mir_u2a_cp(hook->ptszText, CP_UTF8);
// replace %% back to %, because chat automatically does this to sent messages
utils::text::replace_all(&text, "%%", "%");
@@ -238,7 +238,7 @@ void OmegleProto::AddChatContact(const wchar_t *name) if (name == NULL)
gce.bIsMe = false;
else
- gce.bIsMe = mir_tstrcmp(name, this->facy.nick_);
+ gce.bIsMe = mir_wstrcmp(name, this->facy.nick_);
if (gce.bIsMe)
gce.ptszStatus = L"Admin";
@@ -259,7 +259,7 @@ void OmegleProto::DeleteChatContact(const wchar_t *name) if (name == NULL)
gce.bIsMe = false;
else
- gce.bIsMe = mir_tstrcmp(name, this->facy.nick_);
+ gce.bIsMe = mir_wstrcmp(name, this->facy.nick_);
CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
}
@@ -333,7 +333,7 @@ void OmegleProto::SetChatStatus(int status) // Load actual name from database
facy.nick_ = db_get_tsa(NULL, m_szModuleName, OMEGLE_KEY_NAME);
if (facy.nick_ == NULL) {
- facy.nick_ = mir_tstrdup(TranslateT("You"));
+ facy.nick_ = mir_wstrdup(TranslateT("You"));
db_set_ts(NULL, m_szModuleName, OMEGLE_KEY_NAME, facy.nick_);
}
diff --git a/protocols/Omegle/src/client.h b/protocols/Omegle/src/client.h index 2aae2017a8..925132bb82 100644 --- a/protocols/Omegle/src/client.h +++ b/protocols/Omegle/src/client.h @@ -69,7 +69,7 @@ public: std::string chat_id_;
std::string server_;
std::string question_;
- ptrT nick_;
+ ptrW nick_;
//int msgid_;
diff --git a/protocols/Omegle/src/communication.cpp b/protocols/Omegle/src/communication.cpp index 27370cb1f4..0e3abe9354 100644 --- a/protocols/Omegle/src/communication.cpp +++ b/protocols/Omegle/src/communication.cpp @@ -365,7 +365,7 @@ bool Omegle_client::start() char str[255]; mir_snprintf(str, Translate("Connected to server %s. There are %s users online now."), server_.c_str(), count.c_str()); - wchar_t *msg = mir_a2t(str); + wchar_t *msg = mir_a2u(str); parent->UpdateChat(NULL, msg); mir_free(msg); } @@ -374,7 +374,7 @@ bool Omegle_client::start() char str[255]; mir_snprintf(str, Translate("Connected to server %s."), server_.c_str()); - wchar_t *msg = mir_a2t(str); + wchar_t *msg = mir_a2u(str); parent->UpdateChat(NULL, msg); mir_free(msg); } @@ -505,14 +505,14 @@ bool Omegle_client::events() //data["timestamp"]; // e.g. 1445336566.0196209 // We got info about count of connected people there - ptrT count(json_as_string(json_get(data, "count"))); + ptrW count(json_as_string(json_get(data, "count"))); wchar_t strT[255]; - mir_sntprintf(strT, TranslateT("On whole Omegle are %s strangers online now."), count); + mir_snwprintf(strT, TranslateT("On whole Omegle are %s strangers online now."), count); parent->UpdateChat(NULL, strT); } else if (name == "serverMessage") { - ptrT message(json_as_string(json_at(item, 1))); + ptrW message(json_as_string(json_at(item, 1))); parent->UpdateChat(NULL, TranslateTS(message)); } else if (name == "connected") { @@ -536,7 +536,7 @@ bool Omegle_client::events() JSONNode *items = json_at(item, 1); size_t size = json_size(items); for (size_t i = 0; i < size; i++) { - likes += ptrT(json_as_string(json_at(items, i))); + likes += ptrW(json_as_string(json_at(items, i))); if (i < size - 1) likes += L", "; } @@ -545,7 +545,7 @@ bool Omegle_client::events() parent->SetTopic(likes.c_str()); } else if (name == "question") { - ptrT question(json_as_string(json_at(item, 1))); + ptrW question(json_as_string(json_at(item, 1))); parent->SetTopic(question); } else if (name == "typing" || name == "spyTyping") { @@ -556,8 +556,8 @@ bool Omegle_client::events() st.cbSize = sizeof(st); st.hIcon = IcoLib_GetIconByHandle(GetIconHandle("typing_on")); - ptrT who(name == "spyTyping" ? json_as_string(json_at(item, 1)) : mir_tstrdup(L"Stranger")); - mir_sntprintf(st.tszText, TranslateT("%s is typing."), TranslateTS(who)); + ptrW who(name == "spyTyping" ? json_as_string(json_at(item, 1)) : mir_wstrdup(L"Stranger")); + mir_snwprintf(st.tszText, TranslateT("%s is typing."), TranslateTS(who)); CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), (LPARAM)&st); } @@ -569,8 +569,8 @@ bool Omegle_client::events() st.cbSize = sizeof(st); st.hIcon = IcoLib_GetIconByHandle(GetIconHandle("typing_off")); - ptrT who(name == "spyTyping" ? json_as_string(json_at(item, 1)) : mir_tstrdup(L"Stranger")); - mir_sntprintf(st.tszText, TranslateT("%s stopped typing."), TranslateTS(who)); + ptrW who(name == "spyTyping" ? json_as_string(json_at(item, 1)) : mir_wstrdup(L"Stranger")); + mir_snwprintf(st.tszText, TranslateT("%s stopped typing."), TranslateTS(who)); CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), (LPARAM)&st); } @@ -581,7 +581,7 @@ bool Omegle_client::events() SkinPlaySound("StrangerMessage"); if (state_ == STATE_ACTIVE) { - ptrT msg(json_as_string(json_at(item, 1))); + ptrW msg(json_as_string(json_at(item, 1))); parent->UpdateChat(TranslateT("Stranger"), msg); } } @@ -592,8 +592,8 @@ bool Omegle_client::events() SkinPlaySound("StrangerMessage"); if (state_ == STATE_SPY) { - ptrT stranger(json_as_string(json_at(item, 1))); - ptrT msg(json_as_string(json_at(item, 2))); + ptrW stranger(json_as_string(json_at(item, 1))); + ptrW msg(json_as_string(json_at(item, 2))); parent->UpdateChat(stranger, msg); } } @@ -612,10 +612,10 @@ bool Omegle_client::events() else if (name == "spyDisconnected") { CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), NULL); - ptrT stranger(json_as_string(json_at(item, 1))); + ptrW stranger(json_as_string(json_at(item, 1))); wchar_t strT[255]; - mir_sntprintf(strT, TranslateT("%s disconnected."), TranslateTS(stranger)); + mir_snwprintf(strT, TranslateT("%s disconnected."), TranslateTS(stranger)); parent->UpdateChat(NULL, strT); // Stranger disconnected @@ -637,10 +637,10 @@ bool Omegle_client::events() parent->StopChat(false); } else if (name == "error") { - ptrT error(json_as_string(json_at(item, 1))); + ptrW error(json_as_string(json_at(item, 1))); wchar_t strT[255]; - mir_sntprintf(strT, TranslateT("Error: %s"), TranslateTS(error)); + mir_snwprintf(strT, TranslateT("Error: %s"), TranslateTS(error)); parent->UpdateChat(NULL, strT); } } diff --git a/protocols/Omegle/src/dialogs.cpp b/protocols/Omegle/src/dialogs.cpp index 9868c51c57..206f3af30e 100644 --- a/protocols/Omegle/src/dialogs.cpp +++ b/protocols/Omegle/src/dialogs.cpp @@ -38,7 +38,7 @@ static BOOL StoreDBCheckState(OmegleProto* ppro, HWND hwnd, int idCtrl, const ch static void LoadDBText(OmegleProto* ppro, HWND hwnd, int idCtrl, const char* szSetting)
{
- ptrT tstr(db_get_tsa(NULL, ppro->m_szModuleName, szSetting));
+ ptrW tstr(db_get_tsa(NULL, ppro->m_szModuleName, szSetting));
if (tstr)
SetDlgItemText(hwnd, idCtrl, tstr);
}
diff --git a/protocols/Omegle/src/main.cpp b/protocols/Omegle/src/main.cpp index 309d0fe897..f49306a5a5 100644 --- a/protocols/Omegle/src/main.cpp +++ b/protocols/Omegle/src/main.cpp @@ -49,7 +49,7 @@ PLUGININFOEX pluginInfo = { // Protocol instances
static int compare_protos(const OmegleProto *p1, const OmegleProto *p2)
{
- return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName);
+ return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName);
}
OBJLIST<OmegleProto> g_Instances(1, compare_protos);
diff --git a/protocols/Omegle/src/messages.cpp b/protocols/Omegle/src/messages.cpp index 2a8f16b95e..86eff3e5fd 100644 --- a/protocols/Omegle/src/messages.cpp +++ b/protocols/Omegle/src/messages.cpp @@ -34,7 +34,7 @@ void OmegleProto::SendMsgWorker(void *p) if (facy.state_ == STATE_ACTIVE && data.length() && facy.send_message(data)) { - wchar_t *msg = mir_a2t_cp(data.c_str(), CP_UTF8); + wchar_t *msg = mir_a2u_cp(data.c_str(), CP_UTF8); UpdateChat(facy.nick_, msg); mir_free(msg); } diff --git a/protocols/Omegle/src/proto.cpp b/protocols/Omegle/src/proto.cpp index aff30158c6..ee0b34a616 100644 --- a/protocols/Omegle/src/proto.cpp +++ b/protocols/Omegle/src/proto.cpp @@ -46,12 +46,12 @@ PROTO<OmegleProto>(proto_name, username) NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
nlu.szSettingsModule = m_szModuleName;
- mir_sntprintf(descr, TranslateT("%s server connection"), m_tszUserName);
+ mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName);
nlu.ptszDescriptiveName = descr;
m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
if (m_hNetlibUser == NULL) {
wchar_t error[200];
- mir_sntprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName);
+ mir_snwprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName);
MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR);
}
diff --git a/protocols/Sametime/src/conference.cpp b/protocols/Sametime/src/conference.cpp index 71c0528eb0..dcf7aa0b27 100644 --- a/protocols/Sametime/src/conference.cpp +++ b/protocols/Sametime/src/conference.cpp @@ -51,7 +51,7 @@ void mwServiceConf_on_invited(mwConference* conf, mwLoginInfo* inviter, const ch }
else {
proto->debugLog(L"mwServiceConf_on_invited() mwConference_reject");
- char* temp = mir_utf8encodeT(TranslateT("Your invitation has been rejected."));
+ char* temp = mir_utf8encodeW(TranslateT("Your invitation has been rejected."));
mwConference_reject(conf, 0, temp);
mir_free(temp);
}
@@ -108,8 +108,8 @@ void mwServiceConf_conf_opened(mwConference* conf, GList* members) CSametimeProto* proto = getProtoFromMwConference(conf);
proto->debugLog(L"mwServiceConf_conf_opened() start");
- wchar_t* tszConfId = mir_utf8decodeT(mwConference_getName(conf));
- wchar_t* tszConfTitle = mir_utf8decodeT(mwConference_getTitle(conf));
+ wchar_t* tszConfId = mir_utf8decodeW(mwConference_getName(conf));
+ wchar_t* tszConfTitle = mir_utf8decodeW(mwConference_getTitle(conf));
// create new chat session
GCSESSION gcs = { sizeof(gcs) };
@@ -141,8 +141,8 @@ void mwServiceConf_conf_opened(mwConference* conf, GList* members) for (;user; user=user->next) {
proto->debugLog(L"mwServiceConf_conf_opened() add user");
- wchar_t* tszUserName = mir_utf8decodeT(((mwLoginInfo*)user->data)->user_name);
- wchar_t* tszUserId = mir_utf8decodeT(((mwLoginInfo*)user->data)->login_id);
+ wchar_t* tszUserName = mir_utf8decodeW(((mwLoginInfo*)user->data)->user_name);
+ wchar_t* tszUserId = mir_utf8decodeW(((mwLoginInfo*)user->data)->login_id);
gce.ptszNick = tszUserName;
gce.ptszUID = tszUserId;
gce.bIsMe = (strcmp(((mwLoginInfo*)user->data)->login_id, proto->my_login_info->login_id) == 0);
@@ -173,7 +173,7 @@ void mwServiceConf_conf_closed(mwConference* conf, guint32 reason) CSametimeProto* proto = getProtoFromMwConference(conf);
proto->debugLog(L"mwServiceConf_conf_closed() start");
- wchar_t* tszConfId = mir_utf8decodeT(mwConference_getName(conf));
+ wchar_t* tszConfId = mir_utf8decodeW(mwConference_getName(conf));
GCDEST gcd = { proto->m_szModuleName };
gcd.ptszID = tszConfId;
@@ -208,9 +208,9 @@ void mwServiceConf_on_peer_joined(mwConference* conf, mwLoginInfo *user) mwSametimeList_free(user_list);
}
- ptrT tszConfId(mir_utf8decodeT(mwConference_getName(conf)));
- ptrT tszUserName(mir_utf8decodeT(user->user_name));
- ptrT tszUserId(mir_utf8decodeT(user->login_id));
+ ptrW tszConfId(mir_utf8decodeW(mwConference_getName(conf)));
+ ptrW tszUserName(mir_utf8decodeW(user->user_name));
+ ptrW tszUserId(mir_utf8decodeW(user->login_id));
// add user
GCDEST gcd = { proto->m_szModuleName };
@@ -237,9 +237,9 @@ void mwServiceConf_on_peer_parted(mwConference* conf, mwLoginInfo* user) CSametimeProto* proto = getProtoFromMwConference(conf);
proto->debugLog(L"mwServiceConf_on_peer_parted() start");
- ptrT tszConfId(mir_utf8decodeT(mwConference_getName(conf)));
- ptrT tszUserName(mir_utf8decodeT(user->user_name));
- ptrT tszUserId(mir_utf8decodeT(user->login_id));
+ ptrW tszConfId(mir_utf8decodeW(mwConference_getName(conf)));
+ ptrW tszUserName(mir_utf8decodeW(user->user_name));
+ ptrW tszUserId(mir_utf8decodeW(user->login_id));
// remove user
GCDEST gcd = { proto->m_szModuleName };
@@ -261,7 +261,7 @@ void mwServiceConf_on_text(mwConference* conf, mwLoginInfo* user, const char* wh CSametimeProto* proto = getProtoFromMwConference(conf);
proto->debugLog(L"mwServiceConf_on_text() start");
- wchar_t* tszConfId = mir_utf8decodeT(mwConference_getName(conf));
+ wchar_t* tszConfId = mir_utf8decodeW(mwConference_getName(conf));
GCDEST gcd = { proto->m_szModuleName };
gcd.ptszID = tszConfId;
@@ -270,9 +270,9 @@ void mwServiceConf_on_text(mwConference* conf, mwLoginInfo* user, const char* wh GCEVENT gce = { sizeof(gce), &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
- wchar_t* textT = mir_utf8decodeT(what);
- wchar_t* tszUserName = mir_utf8decodeT(user->user_name);
- wchar_t* tszUserId = mir_utf8decodeT(user->login_id);
+ wchar_t* textT = mir_utf8decodeW(what);
+ wchar_t* tszUserName = mir_utf8decodeW(user->user_name);
+ wchar_t* tszUserId = mir_utf8decodeW(user->login_id);
gce.ptszText = textT;
gce.ptszNick = tszUserName;
gce.ptszUID = tszUserId;
@@ -319,7 +319,7 @@ void CSametimeProto::TerminateConference(char* name) for (;conf;conf = conf->next) {
if (strcmp(name, mwConference_getName((mwConference*)conf->data)) == 0) {
- wchar_t* idt = mir_utf8decodeT(name);
+ wchar_t* idt = mir_utf8decodeW(name);
GCDEST gcd = {m_szModuleName, idt, GC_EVENT_CONTROL};
GCEVENT gce = { sizeof(gce), &gcd };
@@ -341,8 +341,8 @@ int CSametimeProto::GcEventHook(WPARAM wParam, LPARAM lParam) { GList *conferences = mwServiceConference_getConferences(service_conference);
for (GList *conf = conferences;conf;conf = conf->next) {
- wchar_t* tszConfId = mir_utf8decodeT(mwConference_getName((mwConference*)conf->data));
- if (mir_tstrcmp(gch->pDest->ptszID, tszConfId) == 0) {
+ wchar_t* tszConfId = mir_utf8decodeW(mwConference_getName((mwConference*)conf->data));
+ if (mir_wstrcmp(gch->pDest->ptszID, tszConfId) == 0) {
switch(gch->pDest->iType) {
case GC_USER_MESSAGE:
{
@@ -406,8 +406,8 @@ INT_PTR CSametimeProto::onMenuCreateChat(WPARAM wParam, LPARAM lParam) mwIdBlock idb;
if (my_login_info && GetAwareIdFromContact(hContact, &id_block)) {
wchar_t title[512];
- wchar_t* ts = mir_utf8decodeT(my_login_info->user_name);
- mir_sntprintf(title, TranslateT("%s's conference"), ts);
+ wchar_t* ts = mir_utf8decodeW(my_login_info->user_name);
+ mir_snwprintf(title, TranslateT("%s's conference"), ts);
mir_free(ts);
idb.user = id_block.user;
diff --git a/protocols/Sametime/src/files.cpp b/protocols/Sametime/src/files.cpp index 567520469a..c606e0587e 100644 --- a/protocols/Sametime/src/files.cpp +++ b/protocols/Sametime/src/files.cpp @@ -28,12 +28,12 @@ void mwFileTransfer_offered(mwFileTransfer* ft) proto->ProtoBroadcastAck(hContact, ACKTYPE_FILE, ACKRESULT_INITIALISING, (HANDLE)ft, 0);
- wchar_t* filenameT = mir_utf8decodeT(mwFileTransfer_getFileName(ft));
+ wchar_t* filenameT = mir_utf8decodeW(mwFileTransfer_getFileName(ft));
const char* message = mwFileTransfer_getMessage(ft);
wchar_t descriptionT[512];
if (message) {
- wchar_t* messageT = mir_utf8decodeT(message);
- mir_sntprintf(descriptionT, L"%s - %s", filenameT, messageT);
+ wchar_t* messageT = mir_utf8decodeW(message);
+ mir_snwprintf(descriptionT, L"%s - %s", filenameT, messageT);
mir_free(messageT);
} else
wcsncpy_s(descriptionT, filenameT, _TRUNCATE);
diff --git a/protocols/Sametime/src/messaging.cpp b/protocols/Sametime/src/messaging.cpp index a6092c0c21..ee7cc4d659 100644 --- a/protocols/Sametime/src/messaging.cpp +++ b/protocols/Sametime/src/messaging.cpp @@ -95,10 +95,10 @@ void mwIm_place_invite(struct mwConversation* conv, const char* message, const c ///TODO unimplemented
- wchar_t* tszMessage = mir_utf8decodeT(message);
+ wchar_t* tszMessage = mir_utf8decodeW(message);
wchar_t msg[512];
- mir_sntprintf(msg, TranslateT("SERVICE NOT IMPLEMENTED. %s"), tszMessage);
+ mir_snwprintf(msg, TranslateT("SERVICE NOT IMPLEMENTED. %s"), tszMessage);
proto->showPopup(msg, SAMETIME_POPUP_INFO);
mir_free(tszMessage);
diff --git a/protocols/Sametime/src/options.cpp b/protocols/Sametime/src/options.cpp index aa08112856..c848ee911b 100644 --- a/protocols/Sametime/src/options.cpp +++ b/protocols/Sametime/src/options.cpp @@ -103,20 +103,20 @@ static INT_PTR CALLBACK DlgProcOptNet(HWND hwndDlg, UINT msg, WPARAM wParam, LPA WORD client_ver = proto->GetClientVersion();
if (client_ver) {
wchar_t verbuf[100];
- mir_sntprintf(verbuf, TranslateT("Client protocol version: %03d.%03d"), (client_ver & 0xFF00) >> 8, client_ver & 0xFF);
+ mir_snwprintf(verbuf, TranslateT("Client protocol version: %03d.%03d"), (client_ver & 0xFF00) >> 8, client_ver & 0xFF);
SetDlgItemText(hwndDlg, IDC_ST_CLIENTVER, verbuf);
}
WORD server_ver = proto->GetServerVersion();
if (server_ver) {
wchar_t verbuf[100];
- mir_sntprintf(verbuf, TranslateT("Server protocol version: %03d.%03d"), (server_ver & 0xFF00) >> 8, server_ver & 0xFF);
+ mir_snwprintf(verbuf, TranslateT("Server protocol version: %03d.%03d"), (server_ver & 0xFF00) >> 8, server_ver & 0xFF);
SetDlgItemText(hwndDlg, IDC_ST_SERVERVER, verbuf);
}
- wchar_t *s = mir_utf8decodeT(proto->options.server_name); SetDlgItemText(hwndDlg, IDC_ED_SNAME, s); mir_free(s);
- s = mir_utf8decodeT(proto->options.id); SetDlgItemText(hwndDlg, IDC_ED_NAME, s); mir_free(s);
- s = mir_utf8decodeT(proto->options.pword); SetDlgItemText(hwndDlg, IDC_ED_PWORD, s); mir_free(s);
+ wchar_t *s = mir_utf8decodeW(proto->options.server_name); SetDlgItemText(hwndDlg, IDC_ED_SNAME, s); mir_free(s);
+ s = mir_utf8decodeW(proto->options.id); SetDlgItemText(hwndDlg, IDC_ED_NAME, s); mir_free(s);
+ s = mir_utf8decodeW(proto->options.pword); SetDlgItemText(hwndDlg, IDC_ED_PWORD, s); mir_free(s);
SetDlgItemInt(hwndDlg, IDC_ED_PORT, proto->options.port, FALSE);
CheckDlgButton(hwndDlg, IDC_CHK_GETSERVERCONTACTS, proto->options.get_server_contacts ? BST_CHECKED : BST_UNCHECKED);
diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp index ca84865901..aa3981f62b 100644 --- a/protocols/Sametime/src/sametime_proto.cpp +++ b/protocols/Sametime/src/sametime_proto.cpp @@ -15,7 +15,7 @@ CSametimeProto::CSametimeProto(const char* pszProtoName, const wchar_t* tszUserN {
// Register m_hNetlibUser user
wchar_t name[128];
- mir_sntprintf(name, TranslateT("%s connection"), m_tszUserName);
+ mir_snwprintf(name, TranslateT("%s connection"), m_tszUserName);
NETLIBUSER nlu = { 0 };
nlu.cbSize = sizeof(nlu);
nlu.flags = NUF_TCHAR | NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS;
@@ -86,7 +86,7 @@ MCONTACT CSametimeProto::AddToList(int flags, PROTOSEARCHRESULT* psr) HANDLE CSametimeProto::FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szPath)
{
debugLog(L"CSametimeProto::FileAllow() hContact=[%x], szPath=[%s]", hContact, szPath);
- char* szPathA = mir_t2a(szPath);
+ char* szPathA = mir_u2a(szPath);
HANDLE res = AcceptFileTransfer(hContact, hTransfer, szPathA);
mir_free(szPathA);
return res;
@@ -159,7 +159,7 @@ int CSametimeProto::GetInfo(MCONTACT hContact, int infoType) HANDLE CSametimeProto::SearchBasic(const wchar_t* id)
{
- debugLog(L"CSametimeProto::SearchBasic() id:len=[%d]", id == NULL ? -1 : mir_tstrlen(id));
+ debugLog(L"CSametimeProto::SearchBasic() id:len=[%d]", id == NULL ? -1 : mir_wstrlen(id));
return (HANDLE)SearchForUser(T2Utf(id), FALSE);
///TODO - add timeout (like at GGPROTO::searchthread)
}
@@ -168,7 +168,7 @@ HWND CSametimeProto::SearchAdvanced(HWND owner) {
wchar_t buf[512];
if (GetDlgItemText(owner, IDC_EDIT1, buf, _countof(buf))) {
- debugLog(L"CSametimeProto::SearchAdvanced() buf:len=[%d]", mir_tstrlen(buf));
+ debugLog(L"CSametimeProto::SearchAdvanced() buf:len=[%d]", mir_wstrlen(buf));
return (HWND)SearchForUser(T2Utf(buf), TRUE);
}
return NULL;
@@ -277,14 +277,14 @@ int CSametimeProto::RecvAwayMsg(MCONTACT hContact, int mode, PROTORECVEVENT* evt {
debugLog(L"CSametimeProto::RecvAwayMsg() hContact=[%x], mode=[%d]", hContact, mode);
- ptrT pszMsg(mir_utf8decodeT(evt->szMessage));
+ ptrW pszMsg(mir_utf8decodeW(evt->szMessage));
ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)evt->lParam, pszMsg);
return 0;
}
int CSametimeProto::SetAwayMsg(int iStatus, const wchar_t* msg)
{
- debugLog(L"CSametimeProto::SetAwayMsg() iStatus=[%d], msg:len=[%d]", iStatus, msg == NULL ? -1 : mir_tstrlen(msg));
+ debugLog(L"CSametimeProto::SetAwayMsg() iStatus=[%d], msg:len=[%d]", iStatus, msg == NULL ? -1 : mir_wstrlen(msg));
SetSessionAwayMessage(iStatus, msg);
return 0;
}
diff --git a/protocols/Sametime/src/sametime_session.cpp b/protocols/Sametime/src/sametime_session.cpp index 6fa0644c75..d9b8234596 100644 --- a/protocols/Sametime/src/sametime_session.cpp +++ b/protocols/Sametime/src/sametime_session.cpp @@ -137,7 +137,7 @@ void __cdecl SessionAdmin(struct mwSession* session, const char* text) {
CSametimeProto* proto = (CSametimeProto*)mwSession_getProperty(session, "PROTO_STRUCT_PTR");
proto->debugLog(L"SessionAdmin()");
- wchar_t* tt = mir_utf8decodeT(text);
+ wchar_t* tt = mir_utf8decodeW(text);
MessageBox(0, tt, TranslateT("Sametime administrator message"), MB_OK);
mir_free(tt);
}
@@ -149,9 +149,9 @@ void __cdecl SessionAnnounce(struct mwSession* session, struct mwLoginInfo* from wchar_t* stzFrom;
wchar_t* stzText;
wchar_t stzFromBuff[256];
- stzFrom = mir_utf8decodeT(from->user_name);
- stzText = mir_utf8decodeT(text);
- mir_sntprintf(stzFromBuff, TranslateT("Session announcement - from '%s'"), stzFrom);
+ stzFrom = mir_utf8decodeW(from->user_name);
+ stzText = mir_utf8decodeW(text);
+ mir_snwprintf(stzFromBuff, TranslateT("Session announcement - from '%s'"), stzFrom);
MessageBox(0, TranslateTS(stzText), stzFromBuff, MB_OK);
mir_free(stzText);
mir_free(stzFrom);
@@ -209,7 +209,7 @@ void __cdecl SessionSetUserStatus(struct mwSession* session) default:
wchar_t buff[512];
- mir_sntprintf(buff, TranslateT("Unknown user status: %d"), us.status);
+ mir_snwprintf(buff, TranslateT("Unknown user status: %d"), us.status);
proto->showPopup(buff, SAMETIME_POPUP_ERROR);
proto->debugLog(buff);
@@ -313,7 +313,7 @@ int CSametimeProto::SetIdle(bool idle) void CSametimeProto::SetSessionAwayMessage(int status, const wchar_t* msgT)
{
- debugLog(L"SetSessionAwayMessage() status=[%d], msgT:len=[%d]", status, msgT == NULL ? -1 : mir_tstrlen(msgT));
+ debugLog(L"SetSessionAwayMessage() status=[%d], msgT:len=[%d]", status, msgT == NULL ? -1 : mir_wstrlen(msgT));
T2Utf msg(msgT);
if (status == ID_STATUS_ONLINE)
diff --git a/protocols/Sametime/src/userlist.cpp b/protocols/Sametime/src/userlist.cpp index 4660b68c8f..4d65b377da 100644 --- a/protocols/Sametime/src/userlist.cpp +++ b/protocols/Sametime/src/userlist.cpp @@ -48,7 +48,7 @@ void CSametimeProto::AddGroup(const char* name, bool expanded) if (name && mir_strcmp(name, Translate("None")) == 0)
return;
- MGROUP hGroup = Clist_GroupCreate(NULL, ptrT(mir_utf8decodeT(name)));
+ MGROUP hGroup = Clist_GroupCreate(NULL, ptrW(mir_utf8decodeW(name)));
Clist_GroupSetExpanded(hGroup, expanded);
}
@@ -237,7 +237,7 @@ void CSametimeProto::ExportContactsToList(mwSametimeList* user_list) //group_open = (db_get_b(0, szProtoGroups, buff, 0) == 1);
- ptrT ptszGroup(mir_utf8decodeT(group_alias));
+ ptrW ptszGroup(mir_utf8decodeW(group_alias));
MGROUP hGroup = Clist_GroupExists(ptszGroup);
if (hGroup) {
DWORD expanded;
diff --git a/protocols/Sametime/src/utils.cpp b/protocols/Sametime/src/utils.cpp index 0e24204f8d..f876860fc0 100644 --- a/protocols/Sametime/src/utils.cpp +++ b/protocols/Sametime/src/utils.cpp @@ -41,7 +41,7 @@ void CSametimeProto::RegisterPopups() puc.pszName = szName;
mir_snprintf(szName, "%s_%s", m_szModuleName, "Notify");
- mir_sntprintf(szDescr, L"%s/%s", m_tszUserName, TranslateT("Notification"));
+ mir_snwprintf(szDescr, L"%s/%s", m_tszUserName, TranslateT("Notification"));
puc.hIcon = CopyIcon(LoadIconEx("notify", FALSE));
ReleaseIconEx("notify", FALSE);
puc.iSeconds = 8;
@@ -50,7 +50,7 @@ void CSametimeProto::RegisterPopups() hPopupNotify = Popup_RegisterClass(&puc);
mir_snprintf(szName, "%s_%s", m_szModuleName, "Error");
- mir_sntprintf(szDescr, L"%s/%s", m_tszUserName, TranslateT("Error"));
+ mir_snwprintf(szDescr, L"%s/%s", m_tszUserName, TranslateT("Error"));
puc.hIcon = CopyIcon(LoadIconEx("error", FALSE));
ReleaseIconEx("error", FALSE);
puc.iSeconds = 10;
@@ -131,8 +131,8 @@ void CSametimeProto::showPopup(const wchar_t* msg, SametimePopupEnum flag) PopupData *puData = (PopupData*)mir_calloc(sizeof(PopupData));
puData->flag = flag;
- puData->title = mir_tstrdup(m_tszUserName);
- puData->text = mir_tstrdup(msg);
+ puData->title = mir_wstrdup(m_tszUserName);
+ puData->text = mir_wstrdup(msg);
puData->proto = this;
CallFunctionAsync(sttMainThreadCallback, puData);
@@ -144,7 +144,7 @@ void CSametimeProto::showPopup(guint32 code) SametimePopupEnum flag = (rcDesc->type == mwReturnCodeError ? SAMETIME_POPUP_ERROR : SAMETIME_POPUP_INFO);
wchar_t buff[512];
- mir_sntprintf(buff, TranslateT("%s\n\nSametime error %S\n%s"), TranslateTS(_A2T(rcDesc->name)), rcDesc->codeString, TranslateTS(_A2T(rcDesc->description)));
+ mir_snwprintf(buff, TranslateT("%s\n\nSametime error %S\n%s"), TranslateTS(_A2T(rcDesc->name)), rcDesc->codeString, TranslateTS(_A2T(rcDesc->description)));
showPopup(buff, flag);
debugLog(buff);
diff --git a/protocols/SkypeWeb/src/skype_accounts.cpp b/protocols/SkypeWeb/src/skype_accounts.cpp index 2bc4d097d0..201d692982 100644 --- a/protocols/SkypeWeb/src/skype_accounts.cpp +++ b/protocols/SkypeWeb/src/skype_accounts.cpp @@ -21,7 +21,7 @@ LIST<CSkypeProto> CSkypeProto::Accounts(1, CSkypeProto::CompareAccounts); int CSkypeProto::CompareAccounts(const CSkypeProto *p1, const CSkypeProto *p2)
{
- return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName);
+ return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName);
}
CSkypeProto* CSkypeProto::InitAccount(const char *protoName, const wchar_t *userName)
diff --git a/protocols/SkypeWeb/src/skype_avatars.cpp b/protocols/SkypeWeb/src/skype_avatars.cpp index d2c766c4e1..0c780094ff 100644 --- a/protocols/SkypeWeb/src/skype_avatars.cpp +++ b/protocols/SkypeWeb/src/skype_avatars.cpp @@ -127,7 +127,7 @@ INT_PTR CSkypeProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam) void CSkypeProto::GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen)
{
- int tPathLen = mir_sntprintf(pszDest, cbLen, L"%s\\%s", VARST(L"%miranda_avatarcache%"), m_tszUserName);
+ int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%s", VARST(L"%miranda_avatarcache%"), m_tszUserName);
DWORD dwAttributes = GetFileAttributes(pszDest);
if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
@@ -139,12 +139,12 @@ void CSkypeProto::GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t CMStringA username(Contacts[hContact]);
username.Replace("live:", "__live_");
username.Replace("facebook:", "__facebook_");
- mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, L"%S%s", username.c_str(), szFileType);
+ mir_snwprintf(pszDest + tPathLen, MAX_PATH - tPathLen, L"%S%s", username.c_str(), szFileType);
}
void CSkypeProto::SetAvatarUrl(MCONTACT hContact, CMString &tszUrl)
{
- ptrT oldUrl(getTStringA(hContact, "AvatarUrl"));
+ ptrW oldUrl(getTStringA(hContact, "AvatarUrl"));
if (oldUrl != NULL)
if (tszUrl == oldUrl)
return;
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 282793848c..6916ad1c35 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -248,8 +248,8 @@ INT_PTR CSkypeProto::OnJoinChatRoom(WPARAM hContact, LPARAM) {
if (hContact)
{
- ptrT idT(getTStringA(hContact, "ChatRoomID"));
- ptrT nameT(getTStringA(hContact, "Nick"));
+ ptrW idT(getTStringA(hContact, "ChatRoomID"));
+ ptrW nameT(getTStringA(hContact, "Nick"));
StartChatRoom(idT, nameT != NULL ? nameT : idT);
}
return 0;
@@ -261,7 +261,7 @@ INT_PTR CSkypeProto::OnLeaveChatRoom(WPARAM hContact, LPARAM) return 1;
if (hContact && IDYES == MessageBox(NULL, TranslateT("This chat is going to be destroyed forever with all its contents. This action cannot be undone. Are you sure?"), TranslateT("Warning"), MB_YESNO | MB_ICONQUESTION))
{
- ptrT idT(getTStringA(hContact, "ChatRoomID"));
+ ptrW idT(getTStringA(hContact, "ChatRoomID"));
GCDEST gcd = { m_szModuleName, NULL, GC_EVENT_CONTROL };
gcd.ptszID = idT;
@@ -309,7 +309,7 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) ptrA xinitiator, xtarget, initiator;
//content = <addmember><eventtime>1429186229164</eventtime><initiator>8:initiator</initiator><target>8:user</target></addmember>
- HXML xml = xmlParseString(ptrT(mir_utf8decodeT(strContent.c_str())), 0, L"addmember");
+ HXML xml = xmlParseString(ptrW(mir_utf8decodeW(strContent.c_str())), 0, L"addmember");
if (xml == NULL)
return;
@@ -319,7 +319,7 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) if (xmlNode == NULL)
break;
- xtarget = mir_t2a(xmlGetText(xmlNode));
+ xtarget = mir_u2a(xmlGetText(xmlNode));
CMStringA target = ParseUrl(xtarget, "8:");
AddChatContact(_A2T(szConversationName), target, target, L"User");
@@ -331,13 +331,13 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) ptrA xinitiator, xtarget;
//content = <addmember><eventtime>1429186229164</eventtime><initiator>8:initiator</initiator><target>8:user</target></addmember>
- HXML xml = xmlParseString(ptrT(mir_utf8decodeT(strContent.c_str())), 0, L"deletemember");
+ HXML xml = xmlParseString(ptrW(mir_utf8decodeW(strContent.c_str())), 0, L"deletemember");
if (xml != NULL) {
HXML xmlNode = xmlGetChildByPath(xml, L"initiator", 0);
- xinitiator = node != NULL ? mir_t2a(xmlGetText(xmlNode)) : NULL;
+ xinitiator = node != NULL ? mir_u2a(xmlGetText(xmlNode)) : NULL;
xmlNode = xmlGetChildByPath(xml, L"target", 0);
- xtarget = xmlNode != NULL ? mir_t2a(xmlGetText(xmlNode)) : NULL;
+ xtarget = xmlNode != NULL ? mir_u2a(xmlGetText(xmlNode)) : NULL;
xmlDestroyNode(xml);
}
@@ -353,13 +353,13 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) {
//content=<topicupdate><eventtime>1429532702130</eventtime><initiator>8:user</initiator><value>test topic</value></topicupdate>
ptrA xinitiator, value;
- HXML xml = xmlParseString(ptrT(mir_utf8decodeT(strContent.c_str())), 0, L"topicupdate");
+ HXML xml = xmlParseString(ptrW(mir_utf8decodeW(strContent.c_str())), 0, L"topicupdate");
if (xml != NULL) {
HXML xmlNode = xmlGetChildByPath(xml, L"initiator", 0);
- xinitiator = xmlNode != NULL ? mir_t2a(xmlGetText(xmlNode)) : NULL;
+ xinitiator = xmlNode != NULL ? mir_u2a(xmlGetText(xmlNode)) : NULL;
xmlNode = xmlGetChildByPath(xml, L"value", 0);
- value = xmlNode != NULL ? mir_t2a(xmlGetText(xmlNode)) : NULL;
+ value = xmlNode != NULL ? mir_u2a(xmlGetText(xmlNode)) : NULL;
xmlDestroyNode(xml);
}
@@ -372,18 +372,18 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) {
//content=<roleupdate><eventtime>1429551258363</eventtime><initiator>8:user</initiator><target><id>8:user1</id><role>admin</role></target></roleupdate>
ptrA xinitiator, xId, xRole;
- HXML xml = xmlParseString(ptrT(mir_utf8decodeT(strContent.c_str())), 0, L"roleupdate");
+ HXML xml = xmlParseString(ptrW(mir_utf8decodeW(strContent.c_str())), 0, L"roleupdate");
if (xml != NULL) {
HXML xmlNode = xmlGetChildByPath(xml, L"initiator", 0);
- xinitiator = xmlNode != NULL ? mir_t2a(xmlGetText(xmlNode)) : NULL;
+ xinitiator = xmlNode != NULL ? mir_u2a(xmlGetText(xmlNode)) : NULL;
xmlNode = xmlGetChildByPath(xml, L"target", 0);
if (xmlNode != NULL)
{
HXML xmlId = xmlGetChildByPath(xmlNode, L"id", 0);
HXML xmlRole = xmlGetChildByPath(xmlNode, L"role", 0);
- xId = xmlId != NULL ? mir_t2a(xmlGetText(xmlId)) : NULL;
- xRole = xmlRole != NULL ? mir_t2a(xmlGetText(xmlRole)) : NULL;
+ xId = xmlId != NULL ? mir_u2a(xmlGetText(xmlId)) : NULL;
+ xRole = xmlRole != NULL ? mir_u2a(xmlGetText(xmlRole)) : NULL;
}
xmlDestroyNode(xml);
@@ -392,9 +392,9 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) GCDEST gcd = { m_szModuleName, _A2T(szConversationName), !mir_strcmpi(xRole, "Admin") ? GC_EVENT_ADDSTATUS : GC_EVENT_REMOVESTATUS };
GCEVENT gce = { sizeof(gce), &gcd };
- ptrT tszId(mir_a2t(id));
- ptrT tszRole(mir_a2t(xRole));
- ptrT tszInitiator(mir_a2t(initiator));
+ ptrW tszId(mir_a2u(id));
+ ptrW tszRole(mir_a2u(xRole));
+ ptrW tszInitiator(mir_a2u(initiator));
gce.pDest = &gcd;
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = tszId;
@@ -426,11 +426,11 @@ void CSkypeProto::OnSendChatMessage(const wchar_t *chat_id, const wchar_t * tszM return;
wchar_t *buf = NEWWSTR_ALLOCA(tszMessage);
- rtrimt(buf);
+ rtrimw(buf);
UnEscapeChatTags(buf);
- ptrA szChatId(mir_t2a(chat_id));
- ptrA szMessage(mir_utf8encodeT(buf));
+ ptrA szChatId(mir_u2a(chat_id));
+ ptrA szMessage(mir_utf8encodeW(buf));
if (strncmp(szMessage, "/me ", 4) == 0)
SendRequest(new SendChatActionRequest(szChatId, time(NULL), szMessage, li));
@@ -448,7 +448,7 @@ void CSkypeProto::AddMessageToChat(const wchar_t *chat_id, const wchar_t *from, gce.time = timestamp;
gce.ptszUID = from;
- CMString tszText(ptrT(mir_utf8decodeT(content)));
+ CMString tszText(ptrW(mir_utf8decodeW(content)));
tszText.Replace(L"%", L"%%");
if (!isAction)
@@ -468,7 +468,7 @@ void CSkypeProto::AddMessageToChat(const wchar_t *chat_id, const wchar_t *from, void CSkypeProto::OnGetChatInfo(const NETLIBHTTPREQUEST *response, void *p)
{
- ptrT topic((wchar_t*)p); // memory must be freed in any case
+ ptrW topic((wchar_t*)p); // memory must be freed in any case
if (response == NULL || response->pData == NULL)
return;
@@ -497,8 +497,8 @@ void CSkypeProto::OnGetChatInfo(const NETLIBHTTPREQUEST *response, void *p) void CSkypeProto::RenameChat(const char *chat_id, const char *name)
{
- ptrT tchat_id(mir_a2t(chat_id));
- ptrT tname(mir_utf8decodeT(name));
+ ptrW tchat_id(mir_a2u(chat_id));
+ ptrW tname(mir_utf8decodeW(name));
GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_CHANGESESSIONAME };
GCEVENT gce = { sizeof(gce), &gcd };
@@ -508,9 +508,9 @@ void CSkypeProto::RenameChat(const char *chat_id, const char *name) void CSkypeProto::ChangeChatTopic(const char *chat_id, const char *topic, const char *initiator)
{
- ptrT tchat_id(mir_a2t(chat_id));
- ptrT tname(mir_a2t(initiator));
- ptrT ttopic(mir_utf8decodeT(topic));
+ ptrW tchat_id(mir_a2u(chat_id));
+ ptrW tname(mir_a2u(initiator));
+ ptrW ttopic(mir_utf8decodeW(topic));
GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_TOPIC };
GCEVENT gce = { sizeof(gce), &gcd };
@@ -541,11 +541,11 @@ void CSkypeProto::AddChatContact(const wchar_t *tchat_id, const char *id, const if (IsChatContact(tchat_id, id))
return;
- ptrT tnick(mir_a2t_cp(name, CP_UTF8));
+ ptrW tnick(mir_a2u_cp(name, CP_UTF8));
if (wchar_t *tmp = db_get_tsa(FindChatRoom(_T2A(tchat_id)), "UsersNicks", id))
tnick = tmp;
- ptrT tid(mir_a2t(id));
+ ptrW tid(mir_a2u(id));
GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_JOIN };
GCEVENT gce = { sizeof(gce), &gcd };
@@ -565,9 +565,9 @@ void CSkypeProto::RemoveChatContact(const wchar_t *tchat_id, const char *id, con if (IsMe(id))
return;
- ptrT tnick(mir_a2t_cp(name, CP_UTF8));
- ptrT tid(mir_a2t(id));
- ptrT tinitiator(mir_a2t(initiator));
+ ptrW tnick(mir_a2u_cp(name, CP_UTF8));
+ ptrW tid(mir_a2u(id));
+ ptrW tinitiator(mir_a2u(initiator));
GCDEST gcd = { m_szModuleName, tchat_id, isKick ? GC_EVENT_KICK : GC_EVENT_PART };
GCEVENT gce = { sizeof(gce), &gcd };
@@ -661,5 +661,5 @@ CMString CSkypeProto::ChangeTopicForm() pForm.caption = caption;
pForm.ptszInitVal = NULL;
pForm.szModuleName = m_szModuleName;
- return (!EnterString(&pForm)) ? CMString() : CMString(ptrT(pForm.ptszResult));
+ return (!EnterString(&pForm)) ? CMString() : CMString(ptrW(pForm.ptszResult));
}
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp index c4aecd4825..bbe4765ca7 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -46,7 +46,7 @@ void CSkypeProto::SetAllContactsStatus(WORD status) void CSkypeProto::SetChatStatus(MCONTACT hContact, int iStatus)
{
- ptrT tszChatID(getTStringA(hContact, "ChatRoomID"));
+ ptrW tszChatID(getTStringA(hContact, "ChatRoomID"));
if (tszChatID == NULL)
return;
GCDEST gcd = { m_szModuleName, tszChatID, GC_EVENT_CONTROL };
diff --git a/protocols/SkypeWeb/src/skype_events.cpp b/protocols/SkypeWeb/src/skype_events.cpp index cd72da2f78..227661c944 100644 --- a/protocols/SkypeWeb/src/skype_events.cpp +++ b/protocols/SkypeWeb/src/skype_events.cpp @@ -57,10 +57,10 @@ INT_PTR CSkypeProto::GetEventText(WPARAM, LPARAM lParam) case SKYPE_DB_EVENT_TYPE_CALL_INFO:
{
- HXML xml = xmlParseString(ptrT(mir_utf8decodeT((char*)pEvent->dbei->pBlob)), 0, L"partlist");
+ HXML xml = xmlParseString(ptrW(mir_utf8decodeW((char*)pEvent->dbei->pBlob)), 0, L"partlist");
if (xml != NULL)
{
- ptrA type(mir_t2a(xmlGetAttrValue(xml, L"type")));
+ ptrA type(mir_u2a(xmlGetAttrValue(xml, L"type")));
bool bType = (!mir_strcmpi(type, "started")) ? 1 : 0;
time_t callDuration = 0;
@@ -106,7 +106,7 @@ INT_PTR CSkypeProto::GetEventText(WPARAM, LPARAM lParam) }
case SKYPE_DB_EVENT_TYPE_FILETRANSFER_INFO:
{
- HXML xml = xmlParseString(ptrT(mir_utf8decodeT((char*)pEvent->dbei->pBlob)), 0, L"files");
+ HXML xml = xmlParseString(ptrW(mir_utf8decodeW((char*)pEvent->dbei->pBlob)), 0, L"files");
if (xml != NULL)
{
for (int i = 0; i < xmlGetChildCount(xml); i++)
@@ -136,7 +136,7 @@ INT_PTR CSkypeProto::GetEventText(WPARAM, LPARAM lParam) case SKYPE_DB_EVENT_TYPE_MOJI:
case SKYPE_DB_EVENT_TYPE_URIOBJ:
{
- HXML xml = xmlParseString(ptrT(mir_utf8decodeT((char*)pEvent->dbei->pBlob)), 0, L"URIObject");
+ HXML xml = xmlParseString(ptrW(mir_utf8decodeW((char*)pEvent->dbei->pBlob)), 0, L"URIObject");
if (xml != NULL)
{
//szText.Append(_T2A(xmlGetText(xml)));
@@ -175,7 +175,7 @@ INT_PTR CSkypeProto::GetEventText(WPARAM, LPARAM lParam) {
case DBVT_TCHAR:
{
- return (INT_PTR)mir_a2t(szText);
+ return (INT_PTR)mir_a2u(szText);
}
case DBVT_ASCIIZ:
{
diff --git a/protocols/SkypeWeb/src/skype_files.cpp b/protocols/SkypeWeb/src/skype_files.cpp index 2a2941bdfd..aa26123f46 100644 --- a/protocols/SkypeWeb/src/skype_files.cpp +++ b/protocols/SkypeWeb/src/skype_files.cpp @@ -91,7 +91,7 @@ void CSkypeProto::OnASMObjectUploaded(const NETLIBHTTPREQUEST *response, void *a xmlAddAttr(xml, L"uri", CMStringW(FORMAT, L"https://api.asm.skype.com/v1/objects/%s", _A2T(fup->uid)));
xmlAddAttr(xml, L"url_thumbnail", CMStringW(FORMAT, L"https://api.asm.skype.com/v1/objects/%s/views/thumbnail", _A2T(fup->uid)));
- SendRequest(new SendMessageRequest(Contacts[fup->hContact], time(NULL), T2Utf(ptrT(xmlToString(xml, nullptr))), li, "RichText/Media_GenericFile"));
+ SendRequest(new SendMessageRequest(Contacts[fup->hContact], time(NULL), T2Utf(ptrW(xmlToString(xml, nullptr))), li, "RichText/Media_GenericFile"));
xmlDestroyNode(xml);
ProtoBroadcastAck(fup->hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, (HANDLE)fup);
delete fup;
diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index e2d820eb75..b2b668a1a8 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -233,13 +233,13 @@ void CSkypeProto::SendPresence(bool isLogin) ptrA epname;
if (!m_opts.bUseHostnameAsPlace && m_opts.wstrPlace && *m_opts.wstrPlace)
- epname = mir_utf8encodeT(m_opts.wstrPlace);
+ epname = mir_utf8encodeW(m_opts.wstrPlace);
else
{
wchar_t compName[MAX_COMPUTERNAME_LENGTH + 1];
DWORD size = _countof(compName);
GetComputerName(compName, &size);
- epname = mir_utf8encodeT(compName);
+ epname = mir_utf8encodeW(compName);
}
if (isLogin)
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 4d35393d12..f4a42e2f2b 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -275,7 +275,7 @@ void CSkypeProto::MarkMessagesRead(MCONTACT hContact, MEVENT hDbEvent) void CSkypeProto::ProcessContactRecv(MCONTACT hContact, time_t timestamp, const char *szContent, const char *szMessageId)
{
- HXML xmlNode = xmlParseString(mir_utf8decodeT(szContent), 0, L"contacts");
+ HXML xmlNode = xmlParseString(mir_utf8decodeW(szContent), 0, L"contacts");
if (xmlNode)
{
int nCount = 0;
@@ -296,8 +296,8 @@ void CSkypeProto::ProcessContactRecv(MCONTACT hContact, time_t timestamp, const psr[nCount] = (PROTOSEARCHRESULT*)mir_calloc(sizeof(PROTOSEARCHRESULT));
psr[nCount]->cbSize = sizeof(psr);
psr[nCount]->flags = PSR_TCHAR;
- psr[nCount]->id.w = mir_tstrdup(tszContactId);
- //psr[nCount]->nick.w = mir_tstrdup(tszContactName == NULL ? L"" : tszContactName);
+ psr[nCount]->id.w = mir_wstrdup(tszContactId);
+ //psr[nCount]->nick.w = mir_wstrdup(tszContactName == NULL ? L"" : tszContactName);
nCount++;
}
}
diff --git a/protocols/SkypeWeb/src/skype_mslogin.cpp b/protocols/SkypeWeb/src/skype_mslogin.cpp index 3992ab48b7..976cf98d77 100644 --- a/protocols/SkypeWeb/src/skype_mslogin.cpp +++ b/protocols/SkypeWeb/src/skype_mslogin.cpp @@ -93,7 +93,7 @@ void CSkypeProto::OnMSLoginSecond(const NETLIBHTTPREQUEST *response) CMStringA ppft(GetStringChunk(szContent, "sFT:'", "'"));
- ptrA code(mir_utf8encodeT(RunConfirmationCode()));
+ ptrA code(mir_utf8encodeW(RunConfirmationCode()));
SendRequest(new LoginMSRequest(url.c_str(), ptrA(getStringA(SKYPE_SETTINGS_ID)), szCookies.c_str(), ppft.c_str(), code), &CSkypeProto::OnMSLoginEnd);
return;
@@ -182,5 +182,5 @@ CMString CSkypeProto::RunConfirmationCode() pForm.caption = caption;
pForm.ptszInitVal = NULL;
pForm.szModuleName = m_szModuleName;
- return (!EnterString(&pForm)) ? CMString() : CMString(ptrT(pForm.ptszResult));
+ return (!EnterString(&pForm)) ? CMString() : CMString(ptrW(pForm.ptszResult));
}
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_options.cpp b/protocols/SkypeWeb/src/skype_options.cpp index 2026a509eb..dafd60ebf2 100644 --- a/protocols/SkypeWeb/src/skype_options.cpp +++ b/protocols/SkypeWeb/src/skype_options.cpp @@ -61,8 +61,8 @@ void CSkypeOptionsMain::OnApply() m_proto->delSetting("TokenExpiresIn");
m_proto->setString(SKYPE_SETTINGS_ID, szNewSkypename);
m_proto->setString("Password", szNewPassword);
- ptrT group(m_group.GetText());
- if (mir_tstrlen(group) > 0 && !Clist_GroupExists(group))
+ ptrW group(m_group.GetText());
+ if (mir_wstrlen(group) > 0 && !Clist_GroupExists(group))
Clist_GroupCreate(0, group);
}
diff --git a/protocols/SkypeWeb/src/skype_popups.cpp b/protocols/SkypeWeb/src/skype_popups.cpp index 65e5bb3487..6cc8c44cd6 100644 --- a/protocols/SkypeWeb/src/skype_popups.cpp +++ b/protocols/SkypeWeb/src/skype_popups.cpp @@ -7,7 +7,7 @@ void CSkypeProto::InitPopups() POPUPCLASS ppc = { sizeof(ppc) };
ppc.flags = PCF_TCHAR;
- mir_sntprintf(desc, L"%s %s", m_tszUserName, TranslateT("Notifications"));
+ mir_snwprintf(desc, L"%s %s", m_tszUserName, TranslateT("Notifications"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Notification");
ppc.ptszDescription = desc;
ppc.pszName = name;
@@ -17,7 +17,7 @@ void CSkypeProto::InitPopups() ppc.iSeconds = 5;
m_PopupClasses.insert(Popup_RegisterClass(&ppc));
- mir_sntprintf(desc, L"%s %s", m_tszUserName, TranslateT("Errors"));
+ mir_snwprintf(desc, L"%s %s", m_tszUserName, TranslateT("Errors"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Error");
ppc.ptszDescription = desc;
ppc.pszName = name;
@@ -27,7 +27,7 @@ void CSkypeProto::InitPopups() ppc.iSeconds = -1;
m_PopupClasses.insert(Popup_RegisterClass(&ppc));
- mir_sntprintf(desc, L"%s %s", m_tszUserName, TranslateT("Calls"));
+ mir_snwprintf(desc, L"%s %s", m_tszUserName, TranslateT("Calls"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Call");
ppc.ptszDescription = desc;
ppc.pszName = name;
diff --git a/protocols/SkypeWeb/src/skype_profile.cpp b/protocols/SkypeWeb/src/skype_profile.cpp index 2c4678a93a..ac9b4d6a9b 100644 --- a/protocols/SkypeWeb/src/skype_profile.cpp +++ b/protocols/SkypeWeb/src/skype_profile.cpp @@ -263,8 +263,8 @@ void CSkypeProto::UpdateProfileLastName(const JSONNode &root, MCONTACT hContact) void CSkypeProto::UpdateProfileDisplayName(const JSONNode &root, MCONTACT hContact)
{
- ptrT firstname(getTStringA(hContact, "FirstName"));
- ptrT lastname(getTStringA(hContact, "LastName"));
+ ptrW firstname(getTStringA(hContact, "FirstName"));
+ ptrW lastname(getTStringA(hContact, "LastName"));
if (firstname) {
CMString nick(firstname);
if (lastname)
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index cf003bdb17..b496e4c2d7 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -329,7 +329,7 @@ int CSkypeProto::RecvContacts(MCONTACT hContact, PROTORECVEVENT* pre) //if (GetMessageFromDb(hContact, szMessageId, pre->timestamp)) return 0;
for (i = 0; i < nCount; i++)
- cbBlob += int(/*mir_tstrlen(isrList[i]->nick.w)*/0 + 2 + mir_tstrlen(isrList[i]->id.w) + mir_strlen(szMessageId));
+ cbBlob += int(/*mir_wstrlen(isrList[i]->nick.w)*/0 + 2 + mir_wstrlen(isrList[i]->id.w) + mir_strlen(szMessageId));
pBlob = (PBYTE)mir_calloc(cbBlob);
diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp index 42fe0bf575..41d01665b8 100644 --- a/protocols/SkypeWeb/src/skype_utils.cpp +++ b/protocols/SkypeWeb/src/skype_utils.cpp @@ -507,7 +507,7 @@ INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) *(szSecondParam++) = 0;
// no command or message command
- if (!szCommand || (szCommand && !mir_tstrcmpi(szCommand, L"chat")))
+ if (!szCommand || (szCommand && !mir_wstrcmpi(szCommand, L"chat")))
{
if (szSecondParam)
{
@@ -523,22 +523,22 @@ INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, NULL);
return 0;
}
- else if (!mir_tstrcmpi(szCommand, L"call"))
+ else if (!mir_wstrcmpi(szCommand, L"call"))
{
MCONTACT hContact = AddContact(_T2A(szJid), true);
NotifyEventHooks(g_hCallEvent, (WPARAM)hContact, (LPARAM)0);
return 0;
}
- else if (!mir_tstrcmpi(szCommand, L"userinfo")){ return 0; }
- else if (!mir_tstrcmpi(szCommand, L"add"))
+ else if (!mir_wstrcmpi(szCommand, L"userinfo")){ return 0; }
+ else if (!mir_wstrcmpi(szCommand, L"add"))
{
MCONTACT hContact = FindContact(_T2A(szJid));
if (hContact == NULL)
{
PROTOSEARCHRESULT psr = { 0 };
psr.cbSize = sizeof(psr);
- psr.id.w = mir_tstrdup(szJid);
- psr.nick.w = mir_tstrdup(szJid);
+ psr.id.w = mir_wstrdup(szJid);
+ psr.nick.w = mir_wstrdup(szJid);
psr.flags = PSR_UNICODE;
ADDCONTACTSTRUCT acs = { 0 };
@@ -550,13 +550,13 @@ INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) }
return 0;
}
- if (!mir_tstrcmpi(szCommand, L"sendfile"))
+ if (!mir_wstrcmpi(szCommand, L"sendfile"))
{
MCONTACT hContact = AddContact(_T2A(szJid), true);
CallService(MS_FILE_SENDFILE, hContact, NULL);
return 1;
}
- if (!mir_tstrcmpi(szCommand, L"voicemail"))
+ if (!mir_wstrcmpi(szCommand, L"voicemail"))
{
return 1;
}
diff --git a/protocols/SkypeWeb/src/skype_utils.h b/protocols/SkypeWeb/src/skype_utils.h index 45e57d6311..497e1b99e1 100644 --- a/protocols/SkypeWeb/src/skype_utils.h +++ b/protocols/SkypeWeb/src/skype_utils.h @@ -89,15 +89,15 @@ public: };
struct CFileUploadParam : public MZeroedObject {
- ptrT tszFileName;
- ptrT tszDesc;
+ ptrW tszFileName;
+ ptrW tszDesc;
ptrA atr;
ptrA fname;
ptrA uid;
size_t size;
MCONTACT hContact;
- __forceinline CFileUploadParam(MCONTACT _hContact, const wchar_t* _desc, wchar_t** _files) : hContact(_hContact), tszDesc(mir_tstrdup(_desc)), tszFileName(mir_tstrdup(_files[0])) {};
+ __forceinline CFileUploadParam(MCONTACT _hContact, const wchar_t* _desc, wchar_t** _files) : hContact(_hContact), tszDesc(mir_wstrdup(_desc)), tszFileName(mir_wstrdup(_files[0])) {};
__forceinline bool IsAccess() { return ::_waccess(tszFileName, 0) == 0; }
};
diff --git a/protocols/Steam/src/steam_avatars.cpp b/protocols/Steam/src/steam_avatars.cpp index 8b852a8fed..0ebd7d1c8b 100644 --- a/protocols/Steam/src/steam_avatars.cpp +++ b/protocols/Steam/src/steam_avatars.cpp @@ -3,7 +3,7 @@ wchar_t* CSteamProto::GetAvatarFilePath(MCONTACT hContact)
{
wchar_t path[MAX_PATH];
- mir_sntprintf(path, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
+ mir_snwprintf(path, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
DWORD dwAttributes = GetFileAttributes(path);
if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
@@ -11,16 +11,16 @@ wchar_t* CSteamProto::GetAvatarFilePath(MCONTACT hContact) ptrA steamId(getStringA(hContact, "SteamID"));
if (steamId != NULL)
- mir_sntprintf(path, MAX_PATH, L"%s\\%s.jpg", path, _A2T(steamId));
+ mir_snwprintf(path, MAX_PATH, L"%s\\%s.jpg", path, _A2T(steamId));
else
return NULL;
- return mir_tstrdup(path);
+ return mir_wstrdup(path);
}
bool CSteamProto::GetDbAvatarInfo(PROTO_AVATAR_INFORMATION &pai)
{
- ptrT path(GetAvatarFilePath(pai.hContact));
+ ptrW path(GetAvatarFilePath(pai.hContact));
if (!path)
return false;
diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp index 3cbdb66c21..1477b2d19f 100644 --- a/protocols/Steam/src/steam_contacts.cpp +++ b/protocols/Steam/src/steam_contacts.cpp @@ -98,19 +98,19 @@ void CSteamProto::UpdateContact(MCONTACT hContact, JSONNode *data) { // set common data JSONNode *node = json_get(data, "personaname"); - setTString(hContact, "Nick", ptrT(json_as_string(node))); + setTString(hContact, "Nick", ptrW(json_as_string(node))); node = json_get(data, "profileurl"); - setString(hContact, "Homepage", _T2A(ptrT(json_as_string(node)))); + setString(hContact, "Homepage", _T2A(ptrW(json_as_string(node)))); node = json_get(data, "primaryclanid"); - setString(hContact, "PrimaryClanID", _T2A(ptrT(json_as_string(node)))); + setString(hContact, "PrimaryClanID", _T2A(ptrW(json_as_string(node)))); // set name node = json_get(data, "realname"); if (node != NULL) { - std::wstring realname = (wchar_t*)ptrT(json_as_string(node)); + std::wstring realname = (wchar_t*)ptrW(json_as_string(node)); if (!realname.empty()) { size_t pos = realname.find(L' ', 1); @@ -135,14 +135,14 @@ void CSteamProto::UpdateContact(MCONTACT hContact, JSONNode *data) // avatar bool biggerAvatars = getBool("UseBigAvatars", false); node = json_get(data, biggerAvatars ? "avatarfull" : "avatarmedium"); - std::string avatarUrl = (char*)_T2A(ptrT(json_as_string(node))); + std::string avatarUrl = (char*)_T2A(ptrW(json_as_string(node))); CheckAvatarChange(hContact, avatarUrl); // set country node = json_get(data, "loccountrycode"); if (node != NULL) { - const char *iso = ptrA(mir_u2a(ptrT(json_as_string(node)))); + const char *iso = ptrA(mir_u2a(ptrW(json_as_string(node)))); char *country = (char *)CallService(MS_UTILS_GETCOUNTRYBYISOCODE, (WPARAM)iso, 0); setString(hContact, "Country", country); } @@ -211,18 +211,18 @@ void CSteamProto::UpdateContact(MCONTACT hContact, JSONNode *data) // playing game node = json_get(data, "gameid"); - DWORD gameId = node ? atol(_T2A(ptrT(json_as_string(node)))) : 0; + DWORD gameId = node ? atol(_T2A(ptrW(json_as_string(node)))) : 0; node = json_get(data, "gameextrainfo"); - ptrT gameInfo(json_as_string(node)); + ptrW gameInfo(json_as_string(node)); if (gameId > 0 || gameInfo[0] != '\0') { node = json_get(data, "gameserverip"); - ptrT serverIP(json_as_string(node)); + ptrW serverIP(json_as_string(node)); node = json_get(data, "gameserversteamid"); - ptrT serverID (json_as_string(node)); + ptrW serverID (json_as_string(node)); setDword(hContact, "GameID", gameId); setString(hContact, "ServerIP", _T2A(serverIP)); @@ -264,9 +264,9 @@ void CSteamProto::ContactIsRemoved(MCONTACT hContact) setDword(hContact, "DeletedTS", ::time(NULL)); SetContactStatus(hContact, ID_STATUS_OFFLINE); - ptrT nick(getTStringA(hContact, "Nick")); + ptrW nick(getTStringA(hContact, "Nick")); wchar_t message[MAX_PATH]; - mir_sntprintf(message, MAX_PATH, TranslateT("%s has been removed from your contact list"), nick); + mir_snwprintf(message, MAX_PATH, TranslateT("%s has been removed from your contact list"), nick); ShowNotification(L"Steam", message); } @@ -282,9 +282,9 @@ void CSteamProto::ContactIsFriend(MCONTACT hContact) delSetting(hContact, "DeletedTS"); delSetting(hContact, "Grant"); - ptrT nick(getTStringA(hContact, "Nick")); + ptrW nick(getTStringA(hContact, "Nick")); wchar_t message[MAX_PATH]; - mir_sntprintf(message, MAX_PATH, TranslateT("%s is back in your contact list"), nick); + mir_snwprintf(message, MAX_PATH, TranslateT("%s is back in your contact list"), nick); ShowNotification(L"Steam", message); } @@ -401,7 +401,7 @@ void CSteamProto::ProcessContact(std::map<std::string, JSONNode*>::iterator *it, if (node == NULL) return; - ptrA relationship(mir_u2a(ptrT(json_as_string(node)))); + ptrA relationship(mir_u2a(ptrW(json_as_string(node)))); if (!lstrcmpiA(relationship, "friend")) { ContactIsFriend(hContact); @@ -444,7 +444,7 @@ void CSteamProto::OnGotFriendList(const HttpResponse *response) if (node == NULL) continue; - std::string steamId = (char*)_T2A(ptrT(json_as_string(node))); + std::string steamId = (char*)_T2A(ptrW(json_as_string(node))); friends.insert(std::make_pair(steamId, child)); } } @@ -529,7 +529,7 @@ void CSteamProto::OnGotBlockList(const HttpResponse *response) break; node = json_get(child, "steamid"); - ptrA steamId(mir_u2a(ptrT(json_as_string(node)))); + ptrA steamId(mir_u2a(ptrW(json_as_string(node)))); /*MCONTACT hContact = FindContact(steamId); if (!hContact) @@ -539,7 +539,7 @@ void CSteamProto::OnGotBlockList(const HttpResponse *response) }*/ node = json_get(child, "relationship"); - ptrA relationship(mir_u2a(ptrT(json_as_string(node)))); + ptrA relationship(mir_u2a(ptrW(json_as_string(node)))); if (!lstrcmpiA(relationship, "ignoredfriend")) { @@ -571,7 +571,7 @@ void CSteamProto::OnGotUserSummaries(const HttpResponse *response) break; node = json_get(item, "steamid"); - ptrA steamId(mir_u2a(ptrT(json_as_string(node)))); + ptrA steamId(mir_u2a(ptrW(json_as_string(node)))); MCONTACT hContact = NULL; if (!IsMe(steamId)) { @@ -676,7 +676,7 @@ void CSteamProto::OnAuthRequested(const HttpResponse *response, void *arg) if (nroot != NULL) { node = json_get(nroot, "steamid"); - ptrA steamId(mir_u2a(ptrT(json_as_string(node)))); + ptrA steamId(mir_u2a(ptrW(json_as_string(node)))); MCONTACT hContact = FindContact(steamId); if (!hContact) @@ -706,7 +706,7 @@ void CSteamProto::OnPendingApproved(const HttpResponse *response, void *arg) if (json_as_int(node) == 0) { node = json_get(root, "error_text"); - debugLogA("CSteamProto::OnPendingApproved: failed to approve pending from %s (%s)", (char*)arg, ptrA(mir_utf8encodeW(ptrT(json_as_string(node))))); + debugLogA("CSteamProto::OnPendingApproved: failed to approve pending from %s (%s)", (char*)arg, ptrA(mir_utf8encodeW(ptrW(json_as_string(node))))); } } @@ -726,7 +726,7 @@ void CSteamProto::OnPendingIgnoreded(const HttpResponse *response, void *arg) if (json_as_int(node) == 0) { node = json_get(root, "error_text"); - debugLogA("CSteamProto::OnPendingApproved: failed to ignore pending from %s (%s)", (char*)arg, ptrA(mir_utf8encodeW(ptrT(json_as_string(node))))); + debugLogA("CSteamProto::OnPendingApproved: failed to ignore pending from %s (%s)", (char*)arg, ptrA(mir_utf8encodeW(ptrW(json_as_string(node))))); } } @@ -763,25 +763,25 @@ void CSteamProto::OnSearchResults(const HttpResponse *response, void *arg) ssr.hdr.flags = PSR_TCHAR; node = json_get(child, "steamid"); - ssr.hdr.id.w = mir_tstrdup(ptrT(json_as_string(node))); + ssr.hdr.id.w = mir_wstrdup(ptrW(json_as_string(node))); node = json_get(child, "personaname"); - ssr.hdr.nick.w = mir_tstrdup(ptrT(json_as_string(node))); + ssr.hdr.nick.w = mir_wstrdup(ptrW(json_as_string(node))); node = json_get(child, "realname"); if (node != NULL) { - std::wstring realname = (wchar_t*)ptrT(json_as_string(node)); + std::wstring realname = (wchar_t*)ptrW(json_as_string(node)); if (!realname.empty()) { size_t pos = realname.find(' ', 1); if (pos != std::wstring::npos) { - ssr.hdr.firstName.w = mir_tstrdup(realname.substr(0, pos).c_str()); - ssr.hdr.lastName.w = mir_tstrdup(realname.substr(pos + 1).c_str()); + ssr.hdr.firstName.w = mir_wstrdup(realname.substr(0, pos).c_str()); + ssr.hdr.lastName.w = mir_wstrdup(realname.substr(pos + 1).c_str()); } else - ssr.hdr.firstName.w = mir_tstrdup(realname.c_str()); + ssr.hdr.firstName.w = mir_wstrdup(realname.c_str()); } } @@ -833,7 +833,7 @@ void CSteamProto::OnSearchByNameStarted(const HttpResponse *response, void *arg) if (node == NULL) continue; - std::string steamId = (char*)_T2A(ptrT(json_as_string(node))); + std::string steamId = (char*)_T2A(ptrW(json_as_string(node))); steamIds.append(steamId).append(","); } json_delete(nroot); diff --git a/protocols/Steam/src/steam_history.cpp b/protocols/Steam/src/steam_history.cpp index 8a16ee5bf3..61b9ae6019 100644 --- a/protocols/Steam/src/steam_history.cpp +++ b/protocols/Steam/src/steam_history.cpp @@ -28,13 +28,13 @@ void CSteamProto::OnGotConversations(const HttpResponse *response) JSONNode *session = json_at(nsessions, i); node = json_get(session, "accountid_friend"); - const char *who = AccountIdToSteamId(_wtoi64(ptrT(json_as_string(node)))); + const char *who = AccountIdToSteamId(_wtoi64(ptrW(json_as_string(node)))); node = json_get(session, "last_message"); - time_t lastMessageTS = _wtoi64(ptrT(json_as_string(node))); + time_t lastMessageTS = _wtoi64(ptrW(json_as_string(node))); /*node = json_get(session, "last_view"); - time_t last_view = _wtoi64(ptrT(json_as_string(node))); + time_t last_view = _wtoi64(ptrW(json_as_string(node))); node = json_get(session, "unread_message_count"); long unread_count = json_as_int(node);*/ @@ -79,14 +79,14 @@ void CSteamProto::OnGotHistoryMessages(const HttpResponse *response, void *arg) JSONNode *message = json_at(nmessages, i - 1); node = json_get(message, "accountid"); - const char *authorSteamId = AccountIdToSteamId(_wtoi64(ptrT(json_as_string(node)))); + const char *authorSteamId = AccountIdToSteamId(_wtoi64(ptrW(json_as_string(node)))); node = json_get(message, "message"); - ptrT text(json_as_string(node)); + ptrW text(json_as_string(node)); T2Utf szMessage(text); node = json_get(message, "timestamp"); - time_t timestamp = _wtoi64(ptrT(json_as_string(node))); + time_t timestamp = _wtoi64(ptrW(json_as_string(node))); // Ignore already existing messages if (timestamp <= m_lastMessageTS) diff --git a/protocols/Steam/src/steam_login.cpp b/protocols/Steam/src/steam_login.cpp index 15fb3d6483..8bf65f6f30 100644 --- a/protocols/Steam/src/steam_login.cpp +++ b/protocols/Steam/src/steam_login.cpp @@ -30,11 +30,11 @@ bool CSteamProto::Relogin() if (root != NULL) { JSONNode *node = json_get(root, "error"); - ptrT error(json_as_string(node)); - if (!mir_tstrcmpi(error, L"OK")) + ptrW error(json_as_string(node)); + if (!mir_wstrcmpi(error, L"OK")) { node = json_get(root, "umqid"); - setString("UMQID", ptrA(mir_u2a(ptrT(json_as_string(node))))); + setString("UMQID", ptrA(mir_u2a(ptrW(json_as_string(node))))); node = json_get(root, "message"); setDword("MessageID", json_as_int(node)); @@ -148,10 +148,10 @@ void CSteamProto::DeleteAuthSettings() void CSteamProto::OnAuthorizationError(const JSONNode &node) { std::string message = node["message"].as_string(); - ptrT messageT(mir_utf8decodeT(message.c_str())); + ptrW messageT(mir_utf8decodeW(message.c_str())); debugLogA("CSteamProto::OnAuthorizationError: %s", message.c_str()); - if (!mir_tstrcmpi(messageT, L"Incorrect login.")) + if (!mir_wstrcmpi(messageT, L"Incorrect login.")) { // We can't continue with incorrect login/password DeleteAuthSettings(); @@ -367,8 +367,8 @@ void CSteamProto::OnLoggedOn(const HttpResponse *response) JSONROOT root(response->pData); JSONNode *node = json_get(root, "error"); - ptrT error(json_as_string(node)); - if (mir_tstrcmpi(error, L"OK")) + ptrW error(json_as_string(node)); + if (mir_wstrcmpi(error, L"OK")) { // Probably expired TokenSecret HandleTokenExpired(); @@ -376,14 +376,14 @@ void CSteamProto::OnLoggedOn(const HttpResponse *response) } node = json_get(root, "umqid"); - setString("UMQID", ptrA(mir_u2a(ptrT(json_as_string(node))))); + setString("UMQID", ptrA(mir_u2a(ptrW(json_as_string(node))))); node = json_get(root, "message"); setDword("MessageID", json_as_int(node)); if (m_lastMessageTS <= 0) { node = json_get(root, "utc_timestamp"); - time_t timestamp = _wtoi64(ptrT(json_as_string(node))); + time_t timestamp = _wtoi64(ptrW(json_as_string(node))); setDword("LastMessageTS", timestamp); } diff --git a/protocols/Steam/src/steam_messages.cpp b/protocols/Steam/src/steam_messages.cpp index bfcde18b1d..d399f7ff47 100644 --- a/protocols/Steam/src/steam_messages.cpp +++ b/protocols/Steam/src/steam_messages.cpp @@ -38,8 +38,8 @@ void CSteamProto::OnMessageSent(const HttpResponse *response, void *arg) {
SendMessageParam *param = (SendMessageParam*)arg;
- ptrT error(mir_tstrdup(TranslateT("Unknown error")));
- ptrT steamId(getTStringA(param->hContact, "SteamID"));
+ ptrW error(mir_wstrdup(TranslateT("Unknown error")));
+ ptrW steamId(getTStringA(param->hContact, "SteamID"));
time_t timestamp = NULL;
if (ResponseHttpOk(response))
@@ -52,15 +52,15 @@ void CSteamProto::OnMessageSent(const HttpResponse *response, void *arg) node = json_get(root, "utc_timestamp");
if (node)
{
- timestamp = atol(ptrA(mir_t2a(ptrT(json_as_string(node)))));
+ timestamp = atol(ptrA(mir_u2a(ptrW(json_as_string(node)))));
if (timestamp > getDword("LastMessageTS", 0))
setDword("LastMessageTS", timestamp);
}
}
- if (mir_tstrcmpi(error, L"OK") != 0)
+ if (mir_wstrcmpi(error, L"OK") != 0)
{
- ptrA errorA(mir_t2a(error));
+ ptrA errorA(mir_u2a(error));
debugLogA("CSteamProto::OnMessageSent: failed to send message for %s (%s)", steamId, errorA);
ProtoBroadcastAck(param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, param->hMessage, (LPARAM)errorA);
}
diff --git a/protocols/Steam/src/steam_options.cpp b/protocols/Steam/src/steam_options.cpp index 00f933a804..cc62799a62 100644 --- a/protocols/Steam/src/steam_options.cpp +++ b/protocols/Steam/src/steam_options.cpp @@ -26,7 +26,7 @@ void CSteamOptionsMain::OnInitDialog() void CSteamOptionsMain::OnApply()
{
wchar_t *group = m_group.GetText();
- if (mir_tstrlen(group) > 0 && !Clist_GroupExists(group))
+ if (mir_wstrlen(group) > 0 && !Clist_GroupExists(group))
Clist_GroupCreate(0, group);
if (m_proto->IsOnline())
diff --git a/protocols/Steam/src/steam_polling.cpp b/protocols/Steam/src/steam_polling.cpp index 22896647d8..6774bb60ab 100644 --- a/protocols/Steam/src/steam_polling.cpp +++ b/protocols/Steam/src/steam_polling.cpp @@ -14,13 +14,13 @@ void CSteamProto::ParsePollData(JSONNode *data) break; node = json_get(item, "steamid_from"); - ptrA steamId(mir_t2a(ptrT(json_as_string(node)))); + ptrA steamId(mir_u2a(ptrW(json_as_string(node)))); node = json_get(item, "utc_timestamp"); - time_t timestamp = atol(ptrA(mir_t2a(ptrT(json_as_string(node))))); + time_t timestamp = atol(ptrA(mir_u2a(ptrW(json_as_string(node))))); node = json_get(item, "type"); - ptrT type(json_as_string(node)); + ptrW type(json_as_string(node)); if (!lstrcmpi(type, L"saytext") || !lstrcmpi(type, L"emote") || !lstrcmpi(type, L"my_saytext") || !lstrcmpi(type, L"my_emote")) { @@ -29,7 +29,7 @@ void CSteamProto::ParsePollData(JSONNode *data) continue; node = json_get(item, "text"); - ptrT text(json_as_string(node)); + ptrW text(json_as_string(node)); T2Utf szMessage(text); PROTORECVEVENT recv = { 0 }; @@ -61,7 +61,7 @@ void CSteamProto::ParsePollData(JSONNode *data) if (IsMe(steamId)) { node = json_get(item, "persona_name"); - setTString("Nick", ptrT(json_as_string(node))); + setTString("Nick", ptrW(json_as_string(node))); if (status == -1 || status == ID_STATUS_OFFLINE) continue; @@ -85,7 +85,7 @@ void CSteamProto::ParsePollData(JSONNode *data) SetContactStatus(hContact, status); node = json_get(item, "persona_name"); - setTString(hContact, "Nick", ptrT(json_as_string(node))); + setTString(hContact, "Nick", ptrW(json_as_string(node))); // todo: find difference between state changing and info changing steamIds.append(steamId).append(","); @@ -217,13 +217,13 @@ void CSteamProto::PollingThread(void*) { JSONNode *node = json_get(root, "error"); if (node) { - ptrT error(json_as_string(node)); + ptrW error(json_as_string(node)); if (!lstrcmpi(error, L"OK")) { // Remember last message timestamp node = json_get(root, "utc_timestamp"); - time_t timestamp = _wtoi64(ptrT(json_as_string(node))); + time_t timestamp = _wtoi64(ptrW(json_as_string(node))); if (timestamp > getDword("LastMessageTS", 0)) setDword("LastMessageTS", timestamp); diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index 9eadb0fb42..964225abcc 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -18,7 +18,7 @@ CSteamProto::CSteamProto(const char* protoName, const wchar_t* userName) GetModuleFileName(g_hInstance, filePath, MAX_PATH); wchar_t sectionName[100]; - mir_sntprintf(sectionName, L"%s/%s", LPGENW("Protocols"), MODULEW); + mir_snwprintf(sectionName, L"%s/%s", LPGENW("Protocols"), MODULEW); char settingName[100]; mir_snprintf(settingName, "%s_%s", MODULE, "main"); @@ -66,7 +66,7 @@ CSteamProto::CSteamProto(const char* protoName, const wchar_t* userName) // netlib support wchar_t name[128]; - mir_sntprintf(name, TranslateT("%s connection"), m_tszUserName); + mir_snwprintf(name, TranslateT("%s connection"), m_tszUserName); NETLIBUSER nlu = { sizeof(nlu) }; nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR; @@ -228,7 +228,7 @@ HANDLE CSteamProto::SearchBasic(const wchar_t* id) return 0; ptrA token(getStringA("TokenSecret")); - ptrA steamId(mir_t2a(id)); + ptrA steamId(mir_u2a(id)); PushRequest( new GetUserSummariesRequest(token, steamId), @@ -245,7 +245,7 @@ HANDLE CSteamProto::SearchByName(const wchar_t* nick, const wchar_t* firstName, // Combine all fields to single text wchar_t keywordsT[200]; - mir_sntprintf(keywordsT, L"%s %s %s", nick, firstName, lastName); + mir_snwprintf(keywordsT, L"%s %s %s", nick, firstName, lastName); ptrA token(getStringA("TokenSecret")); ptrA keywords(mir_utf8encodeW(keywordsT)); @@ -338,7 +338,7 @@ int CSteamProto::SetStatus(int new_status) } else { - ptrA username(mir_urlEncode(ptrA(mir_utf8encodeT(getTStringA("Username"))))); + ptrA username(mir_urlEncode(ptrA(mir_utf8encodeW(getTStringA("Username"))))); if (username == NULL || username[0] == '\0') { m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE; @@ -371,8 +371,8 @@ void __cdecl CSteamProto::GetAwayMsgThread(void *arg) // if contact has no status message, get xstatus message if (message.IsEmpty()) { - ptrT xStatusName(getTStringA(hContact, "XStatusName")); - ptrT xStatusMsg(getTStringA(hContact, "XStatusMsg")); + ptrW xStatusName(getTStringA(hContact, "XStatusName")); + ptrW xStatusMsg(getTStringA(hContact, "XStatusMsg")); if (xStatusName) message.AppendFormat(L"%s: %s", xStatusName, xStatusMsg); diff --git a/protocols/Steam/src/steam_utils.cpp b/protocols/Steam/src/steam_utils.cpp index 264afff378..0fb7f4474d 100644 --- a/protocols/Steam/src/steam_utils.cpp +++ b/protocols/Steam/src/steam_utils.cpp @@ -192,7 +192,7 @@ INT_PTR __cdecl CSteamProto::OnGetEventTextChatStates(WPARAM, LPARAM lParam) if (pdbEvent->dbei->cbBlob > 0) {
if (pdbEvent->dbei->pBlob[0] == STEAM_DB_EVENT_CHATSTATES_GONE) {
if (pdbEvent->datatype == DBVT_WCHAR)
- return (INT_PTR)mir_tstrdup(TranslateT("closed chat session"));
+ return (INT_PTR)mir_wstrdup(TranslateT("closed chat session"));
else if (pdbEvent->datatype == DBVT_ASCIIZ)
return (INT_PTR)mir_strdup(Translate("closed chat session"));
}
diff --git a/protocols/Steam/src/steam_xstatus.cpp b/protocols/Steam/src/steam_xstatus.cpp index 7a42c3f4e3..8f8cdd015c 100644 --- a/protocols/Steam/src/steam_xstatus.cpp +++ b/protocols/Steam/src/steam_xstatus.cpp @@ -44,24 +44,24 @@ INT_PTR CSteamProto::OnGetXStatusEx(WPARAM wParam, LPARAM lParam) if (status < 1) return 1; - ptrT title; + ptrW title; if (pData->flags & CSSF_DEFAULT_NAME) - title = mir_tstrdup(TranslateT("Playing")); + title = mir_wstrdup(TranslateT("Playing")); else title = getTStringA(hContact, "XStatusName"); if (pData->flags & CSSF_UNICODE) - mir_tstrncpy(pData->ptszName, title, STATUS_TITLE_MAX); + mir_wstrncpy(pData->ptszName, title, STATUS_TITLE_MAX); else mir_strncpy(pData->pszName, _T2A(title), STATUS_TITLE_MAX); } // fill status message member if (pData->flags & CSSF_MASK_MESSAGE) { - ptrT message(getTStringA(hContact, "XStatusMsg")); + ptrW message(getTStringA(hContact, "XStatusMsg")); if (pData->flags & CSSF_UNICODE) - mir_tstrncpy(pData->ptszMessage, message, STATUS_DESC_MAX); + mir_wstrncpy(pData->ptszMessage, message, STATUS_DESC_MAX); else mir_strncpy(pData->pszMessage, _T2A(message), STATUS_DESC_MAX); } diff --git a/protocols/Tlen/src/tlen_avatar.cpp b/protocols/Tlen/src/tlen_avatar.cpp index 78024a40d4..83bd751010 100644 --- a/protocols/Tlen/src/tlen_avatar.cpp +++ b/protocols/Tlen/src/tlen_avatar.cpp @@ -33,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void TlenGetAvatarFileName(TlenProtocol *proto, TLEN_LIST_ITEM *item, wchar_t* ptszDest, int cbLen) { - int tPathLen = mir_sntprintf(ptszDest, cbLen, TEXT("%s\\%S"), VARST(TEXT("%miranda_avatarcache%")), proto->m_szModuleName); + int tPathLen = mir_snwprintf(ptszDest, cbLen, TEXT("%s\\%S"), VARST(TEXT("%miranda_avatarcache%")), proto->m_szModuleName); if (_waccess(ptszDest, 0)) { int ret = CreateDirectoryTreeT(ptszDest); if (ret == 0) @@ -41,7 +41,7 @@ void TlenGetAvatarFileName(TlenProtocol *proto, TLEN_LIST_ITEM *item, wchar_t* p else { proto->debugLog(L"getAvatarFilename(): Can not create directory for avatar cache: %s. errno=%d: %s", ptszDest, errno, strerror(errno)); wchar_t buffer[512]; - mir_sntprintf(buffer, TranslateT("Cannot create avatars cache directory. ERROR: %d: %s\n%s"), errno, _wcserror(errno), ptszDest); + mir_snwprintf(buffer, TranslateT("Cannot create avatars cache directory. ERROR: %d: %s\n%s"), errno, _wcserror(errno), ptszDest); PUShowMessageT(buffer, SM_WARNING); } } @@ -58,9 +58,9 @@ void TlenGetAvatarFileName(TlenProtocol *proto, TLEN_LIST_ITEM *item, wchar_t* p const wchar_t *tszFileType = ProtoGetAvatarExtension(format); if (item != NULL) - mir_sntprintf(ptszDest + tPathLen, MAX_PATH - tPathLen, TEXT("%S%s"), ptrA(TlenSha1(item->jid)), tszFileType); + mir_snwprintf(ptszDest + tPathLen, MAX_PATH - tPathLen, TEXT("%S%s"), ptrA(TlenSha1(item->jid)), tszFileType); else - mir_sntprintf(ptszDest + tPathLen, MAX_PATH - tPathLen, TEXT("%S_avatar%s"), proto->m_szModuleName, tszFileType); + mir_snwprintf(ptszDest + tPathLen, MAX_PATH - tPathLen, TEXT("%S_avatar%s"), proto->m_szModuleName, tszFileType); } static void RemoveAvatar(TlenProtocol *proto, MCONTACT hContact) @@ -114,7 +114,7 @@ static void SetAvatar(TlenProtocol *proto, MCONTACT hContact, TLEN_LIST_ITEM *it } else { wchar_t buffer[128]; - mir_sntprintf(buffer, TranslateT("Cannot save new avatar file \"%s\" Error:\n\t%s (Error: %d)"), filename, _wcserror(errno), errno); + mir_snwprintf(buffer, TranslateT("Cannot save new avatar file \"%s\" Error:\n\t%s (Error: %d)"), filename, _wcserror(errno), errno); PUShowMessageT(buffer, SM_WARNING); proto->debugLog(buffer); return; diff --git a/protocols/Tlen/src/tlen_file.cpp b/protocols/Tlen/src/tlen_file.cpp index 48baafe6d1..dadf79e4b3 100644 --- a/protocols/Tlen/src/tlen_file.cpp +++ b/protocols/Tlen/src/tlen_file.cpp @@ -583,7 +583,7 @@ void TlenProcessF(XmlNode *node, ThreadData *info) }
if (szFilename[0] != '\0' && ft->iqId != NULL) {
- wchar_t* filenameT = mir_utf8decodeT((char*)szFilename);
+ wchar_t* filenameT = mir_utf8decodeW((char*)szFilename);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
diff --git a/protocols/Tlen/src/tlen_iqid.cpp b/protocols/Tlen/src/tlen_iqid.cpp index 364bca28c2..50d77a3c3b 100644 --- a/protocols/Tlen/src/tlen_iqid.cpp +++ b/protocols/Tlen/src/tlen_iqid.cpp @@ -429,38 +429,38 @@ void TlenIqResultSearch(TlenProtocol *proto, XmlNode *iqNode) mir_snprintf(jsr.jid, "%s@%s", jid, dbv.pszVal);
}
jsr.jid[sizeof(jsr.jid) - 1] = '\0';
- jsr.hdr.id.w = mir_a2t(jid);
+ jsr.hdr.id.w = mir_a2u(jid);
if ((n = TlenXmlGetChild(itemNode, "nick")) != NULL && n->text != NULL) {
char* buf = TlenTextDecode(n->text);
- jsr.hdr.nick.w = mir_a2t(buf);
+ jsr.hdr.nick.w = mir_a2u(buf);
mir_free(buf);
}
else {
- jsr.hdr.nick.w = mir_tstrdup(TEXT(""));
+ jsr.hdr.nick.w = mir_wstrdup(TEXT(""));
}
if ((n = TlenXmlGetChild(itemNode, "first")) != NULL && n->text != NULL) {
char* buf = TlenTextDecode(n->text);
- jsr.hdr.firstName.w = mir_a2t(buf);
+ jsr.hdr.firstName.w = mir_a2u(buf);
mir_free(buf);
}
else {
- jsr.hdr.firstName.w = mir_tstrdup(TEXT(""));
+ jsr.hdr.firstName.w = mir_wstrdup(TEXT(""));
}
if ((n = TlenXmlGetChild(itemNode, "last")) != NULL && n->text != NULL) {
char* buf = TlenTextDecode(n->text);
- jsr.hdr.lastName.w = mir_a2t(buf);
+ jsr.hdr.lastName.w = mir_a2u(buf);
mir_free(buf);
}
else {
- jsr.hdr.lastName.w = mir_tstrdup(TEXT(""));
+ jsr.hdr.lastName.w = mir_wstrdup(TEXT(""));
}
if ((n = TlenXmlGetChild(itemNode, "email")) != NULL && n->text != NULL) {
char* buf = TlenTextDecode(n->text);
- jsr.hdr.email.w = mir_a2t(buf);
+ jsr.hdr.email.w = mir_a2u(buf);
mir_free(buf);
}
else {
- jsr.hdr.email.w = mir_tstrdup(TEXT(""));
+ jsr.hdr.email.w = mir_wstrdup(TEXT(""));
}
ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)id, (LPARAM)&jsr);
diff --git a/protocols/Tlen/src/tlen_muc.cpp b/protocols/Tlen/src/tlen_muc.cpp index 24ab3ec60b..a2a0469ff6 100644 --- a/protocols/Tlen/src/tlen_muc.cpp +++ b/protocols/Tlen/src/tlen_muc.cpp @@ -73,9 +73,9 @@ static char *getDisplayName(TlenProtocol *proto, const char *id) mir_snprintf(jid, "%s@%s", id, dbv.pszVal);
db_free(&dbv);
if (((hContact = TlenHContactFromJID(proto, jid)) != NULL) || !mir_strcmp(id, proto->threadData->username)) {
- ptrT szName(Contact_GetInfo(CNF_DISPLAY, hContact, proto->m_szModuleName));
+ ptrW szName(Contact_GetInfo(CNF_DISPLAY, hContact, proto->m_szModuleName));
if (szName)
- return mir_t2a(szName);
+ return mir_u2a(szName);
}
}
return mir_strdup(id);
diff --git a/protocols/Tlen/src/tlen_opt.cpp b/protocols/Tlen/src/tlen_opt.cpp index abaaa4e584..2a855116dd 100644 --- a/protocols/Tlen/src/tlen_opt.cpp +++ b/protocols/Tlen/src/tlen_opt.cpp @@ -656,7 +656,7 @@ static INT_PTR CALLBACK TlenPopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, } else { delay=GetDlgItemInt(hwndDlg, IDC_DELAY, NULL, FALSE); } - mir_sntprintf(title, TranslateT("%S mail"), proto->m_szModuleName); + mir_snwprintf(title, TranslateT("%S mail"), proto->m_szModuleName); MailPopupPreview((DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORBKG,CPM_GETCOLOUR,0,0), (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORTXT,CPM_GETCOLOUR,0,0), title, diff --git a/protocols/Tlen/src/tlen_p2p_new.cpp b/protocols/Tlen/src/tlen_p2p_new.cpp index 5cc872a3bb..d091aaa825 100644 --- a/protocols/Tlen/src/tlen_p2p_new.cpp +++ b/protocols/Tlen/src/tlen_p2p_new.cpp @@ -260,7 +260,7 @@ void __cdecl TlenProcessP2P(XmlNode *node, ThreadData *info) { char fileInfo[128];
item->ft = ft;
mir_snprintf(fileInfo, "%s file(s), %s bytes", c, s);
- wchar_t* filenameT = mir_utf8decodeT((char*)fileInfo);
+ wchar_t* filenameT = mir_utf8decodeW((char*)fileInfo);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
diff --git a/protocols/Tlen/src/tlen_svc.cpp b/protocols/Tlen/src/tlen_svc.cpp index 91d4d18ee4..ee3759740c 100644 --- a/protocols/Tlen/src/tlen_svc.cpp +++ b/protocols/Tlen/src/tlen_svc.cpp @@ -91,7 +91,7 @@ HANDLE TlenProtocol::SearchBasic(const wchar_t* id) int iqId = 0;
if (!isOnline) return 0;
if (id == NULL) return 0;
- char* id_A = mir_t2a(id);
+ char* id_A = mir_u2a(id);
char *jid = TlenTextEncode(id_A);
if (jid != NULL) {
searchJID = mir_strdup(id_A);
@@ -111,7 +111,7 @@ HANDLE TlenProtocol::SearchByEmail(const wchar_t* email) if (!isOnline) return 0;
if (email == NULL) return 0;
- char* email_A = mir_t2a(email);
+ char* email_A = mir_u2a(email);
char *emailEnc = TlenTextEncode(email_A);
if (emailEnc != NULL) {
TlenResetSearchQuery(this);
@@ -127,9 +127,9 @@ HANDLE TlenProtocol::SearchByName(const wchar_t* nickT, const wchar_t* firstName {
if (!isOnline) return 0;
- char *nick = mir_t2a(nickT);
- char *firstName = mir_t2a(firstNameT);
- char *lastName = mir_t2a(lastNameT);
+ char *nick = mir_u2a(nickT);
+ char *firstName = mir_u2a(firstNameT);
+ char *lastName = mir_u2a(lastNameT);
char *p;
int iqId = 0;
@@ -418,7 +418,7 @@ int TlenProtocol::SetAwayMsg(int iStatus, const wchar_t* msg) char **szMsg;
char *newModeMsg;
- newModeMsg = mir_t2a(msg);
+ newModeMsg = mir_u2a(msg);
debugLogA("SetAwayMsg called, wParam=%d lParam=%s", iStatus, newModeMsg);
@@ -721,7 +721,7 @@ HANDLE TlenProtocol::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t* szPath if (!isOnline) return 0;
TLEN_FILE_TRANSFER *ft = (TLEN_FILE_TRANSFER *)hTransfer;
- ft->szSavePath = mir_strdup(mir_t2a(szPath)); //TODO convert to wchar_t*
+ ft->szSavePath = mir_strdup(mir_u2a(szPath)); //TODO convert to wchar_t*
TLEN_LIST_ITEM *item = TlenListAdd(this, LIST_FILE, ft->iqId);
if (item != NULL) {
item->ft = ft;
@@ -795,7 +795,7 @@ HANDLE TlenProtocol::SendFile(MCONTACT hContact, const wchar_t* szDescription, w ft->filesSize = (long *)mir_alloc(sizeof(long) * ft->fileCount);
ft->allFileTotalSize = 0;
for (i = j = 0; i < ft->fileCount; i++) {
- char* ppszFiles_i_A = mir_t2a(ppszFiles[i]);
+ char* ppszFiles_i_A = mir_u2a(ppszFiles[i]);
if (_stat(ppszFiles_i_A, &statbuf))
debugLogA("'%s' is an invalid filename", ppszFiles[i]);
else {
@@ -806,7 +806,7 @@ HANDLE TlenProtocol::SendFile(MCONTACT hContact, const wchar_t* szDescription, w mir_free(ppszFiles_i_A);
}
ft->fileCount = j;
- ft->szDescription = mir_t2a(szDescription);
+ ft->szDescription = mir_u2a(szDescription);
ft->hContact = hContact;
ft->currentFile = 0;
db_free(&dbv);
@@ -826,7 +826,7 @@ HANDLE TlenProtocol::SendFile(MCONTACT hContact, const wchar_t* szDescription, w }
else {
if (ft->fileCount == 1) {
- char* ppszFiles_0_A = mir_t2a(ppszFiles[0]);
+ char* ppszFiles_0_A = mir_u2a(ppszFiles[0]);
if ((p = strrchr(ppszFiles_0_A, '\\')) != NULL) {
p++;
}
@@ -926,7 +926,7 @@ int TlenProtocol::TlenDbSettingChanged(WPARAM wParam, LPARAM lParam) jid = dbv.pszVal;
if ((item = TlenListGetItemPtr(this, LIST_ROSTER, dbv.pszVal)) != NULL) {
if (cws->value.type == DBVT_DELETED) {
- newNick = mir_t2a(pcli->pfnGetContactDisplayName(hContact, GCDNF_NOMYHANDLE));
+ newNick = mir_u2a(pcli->pfnGetContactDisplayName(hContact, GCDNF_NOMYHANDLE));
}
else if (cws->value.pszVal != NULL) {
newNick = settingToChar(cws);
@@ -1092,7 +1092,7 @@ INT_PTR TlenProtocol::SetMyAvatar(WPARAM, LPARAM lParam) if (CopyFile(szFileName, tFileName, FALSE) == FALSE)
return 1;
- char* tFileNameA = mir_t2a(tFileName); //TODO - drop io.h
+ char* tFileNameA = mir_u2a(tFileName); //TODO - drop io.h
int fileIn = open(tFileNameA, O_RDWR | O_BINARY, S_IREAD | S_IWRITE);
if (fileIn != -1) {
long dwPngSize = filelength(fileIn);
diff --git a/protocols/Tlen/src/tlen_voice.cpp b/protocols/Tlen/src/tlen_voice.cpp index 0002d8c9c4..6dfb47e3f8 100644 --- a/protocols/Tlen/src/tlen_voice.cpp +++ b/protocols/Tlen/src/tlen_voice.cpp @@ -936,7 +936,7 @@ static char *getDisplayName(TlenProtocol *proto, const char *id) mir_snprintf(jid, "%s@%s", id, dbv.pszVal);
db_free(&dbv);
if ((hContact = TlenHContactFromJID(proto, jid)) != NULL)
- return mir_t2a(pcli->pfnGetContactDisplayName(hContact, 0));
+ return mir_u2a(pcli->pfnGetContactDisplayName(hContact, 0));
}
return mir_strdup(id);
}
diff --git a/protocols/Tlen/src/tlen_ws.cpp b/protocols/Tlen/src/tlen_ws.cpp index 88fbf0681e..ec0a691917 100644 --- a/protocols/Tlen/src/tlen_ws.cpp +++ b/protocols/Tlen/src/tlen_ws.cpp @@ -32,13 +32,13 @@ BOOL TlenWsInit(TlenProtocol *proto) nlu.cbSize = sizeof(nlu);
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR; // | NUF_HTTPGATEWAY;
- mir_sntprintf(name, TranslateT("%s connection"), proto->m_tszUserName);
+ mir_snwprintf(name, TranslateT("%s connection"), proto->m_tszUserName);
nlu.ptszDescriptiveName = name;
nlu.szSettingsModule = proto->m_szModuleName;
proto->m_hNetlibUser = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM) &nlu);
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_NOOPTIONS | NUF_TCHAR;
- mir_sntprintf(name, TranslateT("%s SOCKS connection"), proto->m_tszUserName);
+ mir_snwprintf(name, TranslateT("%s SOCKS connection"), proto->m_tszUserName);
nlu.ptszDescriptiveName = name;
proto->hFileNetlibUser = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM) &nlu);
nlus.cbSize = sizeof(nlus);
diff --git a/protocols/Tox/src/tox_accounts.cpp b/protocols/Tox/src/tox_accounts.cpp index 0c4cea1a40..dfdca9e4f7 100644 --- a/protocols/Tox/src/tox_accounts.cpp +++ b/protocols/Tox/src/tox_accounts.cpp @@ -4,7 +4,7 @@ LIST<CToxProto> CToxProto::Accounts(1, CToxProto::CompareAccounts); int CToxProto::CompareAccounts(const CToxProto *p1, const CToxProto *p2)
{
- return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName);
+ return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName);
}
CToxProto* CToxProto::InitAccount(const char *protoName, const wchar_t *userName)
@@ -44,12 +44,12 @@ int CToxProto::OnAccountRenamed(WPARAM, LPARAM) {
mir_cslock locker(profileLock);
- ptrT newPath(GetToxProfilePath());
+ ptrW newPath(GetToxProfilePath());
wchar_t oldPath[MAX_PATH];
- mir_sntprintf(oldPath, MAX_PATH, L"%s\\%s.tox", VARST(L"%miranda_userdata%"), accountName);
+ mir_snwprintf(oldPath, MAX_PATH, L"%s\\%s.tox", VARST(L"%miranda_userdata%"), accountName);
_wrename(oldPath, newPath);
mir_free(accountName);
- accountName = mir_tstrdup(m_tszUserName);
+ accountName = mir_wstrdup(m_tszUserName);
return 0;
}
diff --git a/protocols/Tox/src/tox_avatars.cpp b/protocols/Tox/src/tox_avatars.cpp index 252f9f6a18..ed0c482cda 100644 --- a/protocols/Tox/src/tox_avatars.cpp +++ b/protocols/Tox/src/tox_avatars.cpp @@ -3,21 +3,21 @@ wchar_t* CToxProto::GetAvatarFilePath(MCONTACT hContact)
{
wchar_t *path = (wchar_t*)mir_calloc(MAX_PATH * sizeof(wchar_t) + 1);
- mir_sntprintf(path, MAX_PATH, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
+ mir_snwprintf(path, MAX_PATH, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
DWORD dwAttributes = GetFileAttributes(path);
if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
CreateDirectoryTreeT(path);
- ptrT address(getTStringA(hContact, TOX_SETTINGS_ID));
+ ptrW address(getTStringA(hContact, TOX_SETTINGS_ID));
if (address == NULL) {
mir_free(path);
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
- if (hContact && mir_tstrlen(address) > TOX_PUBLIC_KEY_SIZE * 2)
+ if (hContact && mir_wstrlen(address) > TOX_PUBLIC_KEY_SIZE * 2)
address[TOX_PUBLIC_KEY_SIZE * 2] = 0;
- mir_sntprintf(path, MAX_PATH, L"%s\\%s.png", path, address);
+ mir_snwprintf(path, MAX_PATH, L"%s\\%s.png", path, address);
return path;
}
@@ -133,10 +133,10 @@ INT_PTR CToxProto::GetAvatarInfo(WPARAM, LPARAM lParam) ptrA address(getStringA(pai->hContact, TOX_SETTINGS_ID));
if (address != NULL)
{
- ptrT path(GetAvatarFilePath(pai->hContact));
+ ptrW path(GetAvatarFilePath(pai->hContact));
if (IsFileExists(path))
{
- mir_tstrncpy(pai->filename, path, _countof(pai->filename));
+ mir_wstrncpy(pai->filename, path, _countof(pai->filename));
pai->format = PA_FORMAT_PNG;
return GAIR_SUCCESS;
@@ -148,9 +148,9 @@ INT_PTR CToxProto::GetAvatarInfo(WPARAM, LPARAM lParam) INT_PTR CToxProto::GetMyAvatar(WPARAM wParam, LPARAM lParam)
{
- ptrT path(GetAvatarFilePath());
+ ptrW path(GetAvatarFilePath());
if (IsFileExists(path))
- mir_tstrncpy((wchar_t*)wParam, path, (int)lParam);
+ mir_wstrncpy((wchar_t*)wParam, path, (int)lParam);
return 0;
}
@@ -159,7 +159,7 @@ INT_PTR CToxProto::SetMyAvatar(WPARAM, LPARAM lParam) {
debugLogA(__FUNCTION__": setting avatar");
wchar_t *path = (wchar_t*)lParam;
- ptrT avatarPath(GetAvatarFilePath());
+ ptrW avatarPath(GetAvatarFilePath());
if (path != NULL)
{
debugLogA(__FUNCTION__": copy new avatar");
@@ -208,7 +208,7 @@ void CToxProto::OnGotFriendAvatarInfo(AvatarTransferParam *transfer) if (transfer->pfts.totalBytes == 0)
{
MCONTACT hConact = transfer->pfts.hContact;
- ptrT path(GetAvatarFilePath(hConact));
+ ptrW path(GetAvatarFilePath(hConact));
if (IsFileExists(path))
DeleteFile(path);
@@ -231,7 +231,7 @@ void CToxProto::OnGotFriendAvatarInfo(AvatarTransferParam *transfer) }
wchar_t path[MAX_PATH];
- mir_sntprintf(path, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
+ mir_snwprintf(path, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
OnFileAllow(transfer->pfts.hContact, transfer, path);
}
@@ -242,7 +242,7 @@ void CToxProto::OnGotFriendAvatarData(AvatarTransferParam *transfer) PROTO_AVATAR_INFORMATION ai = { 0 };
ai.format = PA_FORMAT_PNG;
ai.hContact = transfer->pfts.hContact;
- mir_tstrcpy(ai.filename, transfer->pfts.tszCurrentFile);
+ mir_wstrcpy(ai.filename, transfer->pfts.tszCurrentFile);
fclose(transfer->hFile);
transfer->hFile = NULL;
diff --git a/protocols/Tox/src/tox_chatrooms.cpp b/protocols/Tox/src/tox_chatrooms.cpp index f0a538fb5c..fde562fe83 100644 --- a/protocols/Tox/src/tox_chatrooms.cpp +++ b/protocols/Tox/src/tox_chatrooms.cpp @@ -29,7 +29,7 @@ MCONTACT CToxProto::AddChatRoom(int groupNumber) setWord(hContact, TOX_SETTINGS_CHAT_ID, groupNumber);
wchar_t title[MAX_PATH];
- mir_sntprintf(title, L"%s #%d", TranslateT("Group chat"), groupNumber);
+ mir_snwprintf(title, L"%s #%d", TranslateT("Group chat"), groupNumber);
setTString(hContact, "Nick", title);
DBVARIANT dbv;
@@ -67,7 +67,7 @@ void CToxProto::LoadChatRoomList(void*) {
uint8_t title[TOX_MAX_NAME_LENGTH] = { 0 };
tox_group_get_title(toxThread->Tox(), groupNumber, title, TOX_MAX_NAME_LENGTH);
- setWString(hContact, "Nick", ptrT(mir_utf8decodeT((char*)title)));
+ setWString(hContact, "Nick", ptrW(mir_utf8decodeW((char*)title)));
}
}
mir_free(groupChats);
diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp index a78d6e3b39..d3e094e0db 100644 --- a/protocols/Tox/src/tox_contacts.cpp +++ b/protocols/Tox/src/tox_contacts.cpp @@ -91,10 +91,10 @@ MCONTACT CToxProto::AddContact(const char *address, const char *nick, const char setString(hContact, TOX_SETTINGS_ID, address);
if (mir_strlen(nick))
- setTString(hContact, "Nick", ptrT(mir_utf8decodeT(nick)));
+ setTString(hContact, "Nick", ptrW(mir_utf8decodeW(nick)));
if (mir_strlen(dnsId))
- setTString(hContact, TOX_SETTINGS_DNS, ptrT(mir_utf8decodeT(dnsId)));
+ setTString(hContact, TOX_SETTINGS_DNS, ptrW(mir_utf8decodeW(dnsId)));
DBVARIANT dbv;
if (!getTString(TOX_SETTINGS_GROUP, &dbv))
@@ -149,7 +149,7 @@ void CToxProto::LoadFriendList(void*) TOX_ERR_FRIEND_QUERY getNameResult;
uint8_t nick[TOX_MAX_NAME_LENGTH] = { 0 };
if (tox_friend_get_name(toxThread->Tox(), friendNumber, nick, &getNameResult))
- setTString(hContact, "Nick", ptrT(mir_utf8decodeT((char*)nick)));
+ setTString(hContact, "Nick", ptrW(mir_utf8decodeW((char*)nick)));
else
debugLogA(__FUNCTION__": failed to get friend name (%d)", getNameResult);
@@ -188,7 +188,7 @@ INT_PTR CToxProto::OnRequestAuth(WPARAM hContact, LPARAM lParam) uint8_t nick[TOX_MAX_NAME_LENGTH] = { 0 };
TOX_ERR_FRIEND_QUERY errorFriendQuery;
if (tox_friend_get_name(toxThread->Tox(), friendNumber, nick, &errorFriendQuery))
- setTString(hContact, "Nick", ptrT(mir_utf8decodeT((char*)nick)));
+ setTString(hContact, "Nick", ptrW(mir_utf8decodeW((char*)nick)));
else
debugLogA(__FUNCTION__": failed to get friend name (%d)", errorFriendQuery);
@@ -291,7 +291,7 @@ void CToxProto::OnFriendNameChange(Tox*, uint32_t friendNumber, const uint8_t *n memcpy(rawName, name, length);
rawName[length] = 0;
- ptrT nickname(mir_utf8decodeW(rawName));
+ ptrW nickname(mir_utf8decodeW(rawName));
proto->setTString(hContact, "Nick", nickname);
}
}
@@ -306,7 +306,7 @@ void CToxProto::OnStatusMessageChanged(Tox*, uint32_t friendNumber, const uint8_ memcpy(rawMessage, message, length);
rawMessage[length] = 0;
- ptrT statusMessage(mir_utf8decodeT(rawMessage));
+ ptrW statusMessage(mir_utf8decodeW(rawMessage));
db_set_ts(hContact, "CList", "StatusMsg", statusMessage);
}
}
@@ -340,7 +340,7 @@ void CToxProto::OnConnectionStatusChanged(Tox*, uint32_t friendNumber, TOX_CONNE proto->ResumeIncomingTransfers(friendNumber);
// update avatar
- ptrT avatarPath(proto->GetAvatarFilePath());
+ ptrW avatarPath(proto->GetAvatarFilePath());
if (IsFileExists(avatarPath))
{
FILE *hFile = _wfopen(avatarPath, L"rb");
@@ -441,7 +441,7 @@ INT_PTR CToxProto::UserInfoProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar break;
}
- SetDlgItemText(hwnd, IDC_DNS_ID, ptrT(proto->getTStringA(hContact, TOX_SETTINGS_DNS)));
+ SetDlgItemText(hwnd, IDC_DNS_ID, ptrW(proto->getTStringA(hContact, TOX_SETTINGS_DNS)));
}
break;
diff --git a/protocols/Tox/src/tox_core.cpp b/protocols/Tox/src/tox_core.cpp index b535597a0e..108d9b0003 100644 --- a/protocols/Tox/src/tox_core.cpp +++ b/protocols/Tox/src/tox_core.cpp @@ -95,9 +95,9 @@ bool CToxProto::InitToxCore(CToxThread *toxThread) /*uint8_t nick[TOX_MAX_NAME_LENGTH] = { 0 };
tox_self_get_name(toxThread->Tox(), nick);
- setTString("Nick", ptrT(Utf8DecodeT((char*)nick)));*/
+ setTString("Nick", ptrW(Utf8DecodeT((char*)nick)));*/
- ptrA nick(mir_utf8encodeT(ptrT(getTStringA("Nick"))));
+ ptrA nick(mir_utf8encodeW(ptrW(getTStringA("Nick"))));
tox_self_set_name(toxThread->Tox(), (uint8_t*)(char*)nick, mir_strlen(nick), &error);
if (error != TOX_ERR_SET_INFO_OK)
{
@@ -107,9 +107,9 @@ bool CToxProto::InitToxCore(CToxThread *toxThread) /*uint8_t statusMessage[TOX_MAX_STATUS_MESSAGE_LENGTH] = { 0 };
tox_self_get_status_message(toxThread->Tox(), statusMessage);
- setTString("StatusMsg", ptrT(Utf8DecodeT((char*)statusMessage)));*/
+ setTString("StatusMsg", ptrW(Utf8DecodeT((char*)statusMessage)));*/
- ptrA statusMessage(mir_utf8encodeT(ptrT(getTStringA("StatusMsg"))));
+ ptrA statusMessage(mir_utf8encodeW(ptrW(getTStringA("StatusMsg"))));
tox_self_set_status_message(toxThread->Tox(), (uint8_t*)(char*)statusMessage, mir_strlen(statusMessage), &error);
if (error != TOX_ERR_SET_INFO_OK)
{
diff --git a/protocols/Tox/src/tox_messages.cpp b/protocols/Tox/src/tox_messages.cpp index c2c409c3e2..b1c6ef7d3d 100644 --- a/protocols/Tox/src/tox_messages.cpp +++ b/protocols/Tox/src/tox_messages.cpp @@ -159,7 +159,7 @@ void CToxProto::GetStatusMessageAsync(void* arg) return;
}
- ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)hContact, ptrT(mir_utf8decodeT(statusMessage)));
+ ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)hContact, ptrW(mir_utf8decodeW(statusMessage)));
}
/* TYPING */
diff --git a/protocols/Tox/src/tox_multimedia.cpp b/protocols/Tox/src/tox_multimedia.cpp index 1238ecfda7..0cf156dace 100644 --- a/protocols/Tox/src/tox_multimedia.cpp +++ b/protocols/Tox/src/tox_multimedia.cpp @@ -55,7 +55,7 @@ void CToxIncomingCall::OnInitDialog() from.SetText(nick);
wchar_t title[MAX_PATH];
- mir_sntprintf(title, TranslateT("Incoming call from %s"), nick);
+ mir_snwprintf(title, TranslateT("Incoming call from %s"), nick);
SetTitle(title);
SetIcon("audio_ring");
}
@@ -109,7 +109,7 @@ void CToxOutgoingCall::OnInitDialog() to.SetText(nick);
wchar_t title[MAX_PATH];
- mir_sntprintf(title, TranslateT("Outgoing call to %s"), nick);
+ mir_snwprintf(title, TranslateT("Outgoing call to %s"), nick);
SetTitle(title);
SetIcon("audio_end");
}
@@ -149,7 +149,7 @@ void CToxOutgoingCall::OnCall(CCtrlBase*) char *message = NULL;
wchar_t title[MAX_PATH];
if (GetWindowText(m_hwnd, title, _countof(title)))
- message = mir_utf8encodeT(title);
+ message = mir_utf8encodeW(title);
else
message = mir_utf8encode("Outgoing call");
m_proto->AddEventToDb(hContact, DB_EVENT_CALL, time(NULL), DBEF_UTF, (PBYTE)message, mir_strlen(message));
@@ -316,7 +316,7 @@ void CToxProto::OnFriendCall(ToxAV *toxAV, uint32_t friend_number, bool audio_en }
wchar_t message[MAX_PATH];
- mir_sntprintf(message, TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_snwprintf(message, TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
T2Utf szMessage(message);
PROTORECVEVENT recv = { 0 };
@@ -351,7 +351,7 @@ INT_PTR CToxProto::OnRecvAudioCall(WPARAM hContact, LPARAM lParam) cle.hIcon = IcoLib_GetIconByHandle(GetIconHandle(IDI_AUDIO_RING));
wchar_t szTooltip[MAX_PATH];
- mir_sntprintf(szTooltip, TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_snwprintf(szTooltip, TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
cle.ptszTooltip = szTooltip;
char szService[MAX_PATH];
@@ -400,7 +400,7 @@ INT_PTR CToxProto::OnAudioRing(WPARAM, LPARAM lParam) }
}
- char *message = mir_utf8encodeT(TranslateT("Call canceled"));
+ char *message = mir_utf8encodeW(TranslateT("Call canceled"));
proto->AddEventToDb(hContact, DB_EVENT_CALL, time(NULL), DBEF_UTF, (PBYTE)message, mir_strlen(message));
WindowList_Broadcast(proto->hAudioDialogs, WM_CALL_END, hContact, 0);
@@ -435,7 +435,7 @@ INT_PTR CToxProto::OnSendAudioCall(WPARAM hContact, LPARAM) return;
}
- char *message = mir_utf8encodeT(TranslateT("Call canceled"));
+ char *message = mir_utf8encodeW(TranslateT("Call canceled"));
proto->AddEventToDb(hContact, DB_EVENT_CALL, time(NULL), DBEF_UTF, (PBYTE)message, mir_strlen(message));
WindowList_Broadcast(proto->hAudioDialogs, WM_CALL_END, hContact, 0);
@@ -459,7 +459,7 @@ void CToxProto::OnAvCallTimeout(void*, int32_t callId, void *arg) return;
}
- char *message = mir_utf8encodeT(TranslateT("Call canceled"));
+ char *message = mir_utf8encodeW(TranslateT("Call canceled"));
proto->AddEventToDb(hContact, DB_EVENT_CALL, time(NULL), DBEF_UTF, (PBYTE)message, mir_strlen(message));
WindowList_Broadcast(proto->hAudioDialogs, WM_CALL_END, hContact, 0);
@@ -552,7 +552,7 @@ static void CALLBACK ToxShowDialogApcProc(void *arg) return;
}
- char *message = mir_utf8encodeT(TranslateT("Call started"));
+ char *message = mir_utf8encodeW(TranslateT("Call started"));
proto->AddEventToDb(hContact, DB_EVENT_CALL, time(NULL), DBEF_UTF, (PBYTE)message, mir_strlen(message));
@@ -583,7 +583,7 @@ void CToxProto::OnAvEnd(void*, int32_t callId, void *arg) return;
}
- char *message = mir_utf8encodeT(TranslateT("Call ended"));
+ char *message = mir_utf8encodeW(TranslateT("Call ended"));
proto->AddEventToDb(hContact, DB_EVENT_CALL, time(NULL), DBEF_UTF, (PBYTE)message, mir_strlen(message));
WindowList_Broadcast(proto->hAudioDialogs, WM_CALL_END, hContact, 0);
diff --git a/protocols/Tox/src/tox_netlib.cpp b/protocols/Tox/src/tox_netlib.cpp index c32e8059c8..82153c743a 100644 --- a/protocols/Tox/src/tox_netlib.cpp +++ b/protocols/Tox/src/tox_netlib.cpp @@ -3,7 +3,7 @@ void CToxProto::InitNetlib()
{
wchar_t name[128];
- mir_sntprintf(name, TranslateT("%s connection"), m_tszUserName);
+ mir_snwprintf(name, TranslateT("%s connection"), m_tszUserName);
NETLIBUSER nlu = {0};
nlu.cbSize = sizeof(nlu);
diff --git a/protocols/Tox/src/tox_network.cpp b/protocols/Tox/src/tox_network.cpp index 2f5b3dcddb..580fa31622 100644 --- a/protocols/Tox/src/tox_network.cpp +++ b/protocols/Tox/src/tox_network.cpp @@ -157,7 +157,7 @@ void CToxProto::UpdateNodes() if (lastUpdate <= getDword("NodesUpdate", 0))
return;
- ptrT path(mir_tstrdup((wchar_t*)VARST(_A2W(TOX_JSON_PATH))));
+ ptrW path(mir_wstrdup((wchar_t*)VARST(_A2W(TOX_JSON_PATH))));
if (!IsFileExists(path))
{
HANDLE hProfile = CreateFile(path, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp index 4b31e1cf61..96564f432e 100644 --- a/protocols/Tox/src/tox_options.cpp +++ b/protocols/Tox/src/tox_options.cpp @@ -26,7 +26,7 @@ void CToxOptionsMain::OnInitDialog() {
CToxDlgBase::OnInitDialog();
- ptrT profilePath(m_proto->GetToxProfilePath());
+ ptrW profilePath(m_proto->GetToxProfilePath());
if (CToxProto::IsFileExists(profilePath))
{
m_toxAddress.Enable();
@@ -67,7 +67,7 @@ void CToxOptionsMain::ProfileCreate_OnClick(CCtrlButton*) CToxThread toxThread(options);
tox_options_free(options);
- ptrT profilePath(m_proto->GetToxProfilePath());
+ ptrW profilePath(m_proto->GetToxProfilePath());
if (!m_proto->IsFileExists(profilePath))
{
HANDLE hProfile = CreateFile(profilePath, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
@@ -81,8 +81,8 @@ void CToxOptionsMain::ProfileCreate_OnClick(CCtrlButton*) if (m_proto->InitToxCore(&toxThread))
{
- ptrT group(m_group.GetText());
- if (mir_tstrlen(group) > 0 && Clist_GroupExists(group))
+ ptrW group(m_group.GetText());
+ if (mir_wstrlen(group) > 0 && Clist_GroupExists(group))
Clist_GroupCreate(0, group);
m_proto->UninitToxCore(&toxThread);
@@ -90,9 +90,9 @@ void CToxOptionsMain::ProfileCreate_OnClick(CCtrlButton*) m_toxAddress.Enable();
m_toxAddress.SetTextA(ptrA(m_proto->getStringA(TOX_SETTINGS_ID)));
- m_nickname.SetText(ptrT(m_proto->getTStringA("Nick")));
- m_password.SetText(ptrT(m_proto->getTStringA("Password")));
- m_group.SetText(ptrT(m_proto->getTStringA(TOX_SETTINGS_GROUP)));
+ m_nickname.SetText(ptrW(m_proto->getTStringA("Nick")));
+ m_password.SetText(ptrW(m_proto->getTStringA("Password")));
+ m_group.SetText(ptrW(m_proto->getTStringA(TOX_SETTINGS_GROUP)));
ShowWindow(m_profileCreate.GetHwnd(), FALSE);
ShowWindow(m_profileImport.GetHwnd(), FALSE);
@@ -105,7 +105,7 @@ void CToxOptionsMain::ProfileCreate_OnClick(CCtrlButton*) void CToxOptionsMain::ProfileImport_OnClick(CCtrlButton*)
{
wchar_t filter[MAX_PATH];
- mir_sntprintf(filter, L"%s(*.tox)%c*.tox%c%s(*.*)%c*.*%c%c",
+ mir_snwprintf(filter, L"%s(*.tox)%c*.tox%c%s(*.*)%c*.*%c%c",
TranslateT("Tox profile"), 0, 0, TranslateT("All files"), 0, 0, 0);
wchar_t profilePath[MAX_PATH] = { 0 };
@@ -123,8 +123,8 @@ void CToxOptionsMain::ProfileImport_OnClick(CCtrlButton*) if (!GetOpenFileName(&ofn))
return;
- ptrT defaultProfilePath(m_proto->GetToxProfilePath());
- if (mir_tstrcmpi(profilePath, defaultProfilePath) != 0)
+ ptrW defaultProfilePath(m_proto->GetToxProfilePath());
+ if (mir_wstrcmpi(profilePath, defaultProfilePath) != 0)
CopyFile(profilePath, defaultProfilePath, FALSE);
Tox_Options *options = NULL;
@@ -143,13 +143,13 @@ void CToxOptionsMain::ProfileImport_OnClick(CCtrlButton*) uint8_t nick[TOX_MAX_NAME_LENGTH] = { 0 };
tox_self_get_name(toxThread.Tox(), nick);
- ptrT nickname(Utf8DecodeT((char*)nick));
+ ptrW nickname(Utf8DecodeT((char*)nick));
m_proto->setTString("Nick", nickname);
m_nickname.SetText(nickname);
uint8_t statusMessage[TOX_MAX_STATUS_MESSAGE_LENGTH] = { 0 };
tox_self_get_status_message(toxThread.Tox(), statusMessage);
- m_proto->setTString("StatusMsg", ptrT(Utf8DecodeT((char*)statusMessage)));
+ m_proto->setTString("StatusMsg", ptrW(Utf8DecodeT((char*)statusMessage)));
ShowWindow(m_profileCreate.GetHwnd(), FALSE);
ShowWindow(m_profileImport.GetHwnd(), FALSE);
@@ -163,11 +163,11 @@ void CToxOptionsMain::ProfileImport_OnClick(CCtrlButton*) void CToxOptionsMain::ProfileExport_OnClick(CCtrlButton*)
{
wchar_t filter[MAX_PATH];
- mir_sntprintf(filter, L"%s(*.tox)%c*.tox%c%c",
+ mir_snwprintf(filter, L"%s(*.tox)%c*.tox%c%c",
TranslateT("Tox profile"), 0, 0, 0);
wchar_t profilePath[MAX_PATH];
- mir_tstrncpy(profilePath, L"tox_save.tox", _countof(profilePath));
+ mir_wstrncpy(profilePath, L"tox_save.tox", _countof(profilePath));
OPENFILENAME ofn = { sizeof(ofn) };
ofn.hwndOwner = m_hwnd;
@@ -182,20 +182,20 @@ void CToxOptionsMain::ProfileExport_OnClick(CCtrlButton*) if (!GetSaveFileName(&ofn))
return;
- ptrT defaultProfilePath(m_proto->GetToxProfilePath());
- if (mir_tstrcmpi(profilePath, defaultProfilePath) != 0)
+ ptrW defaultProfilePath(m_proto->GetToxProfilePath());
+ if (mir_wstrcmpi(profilePath, defaultProfilePath) != 0)
CopyFile(defaultProfilePath, profilePath, FALSE);
}
void CToxOptionsMain::OnApply()
{
- ptrT group(m_group.GetText());
- if (mir_tstrlen(group) > 0 && Clist_GroupExists(group))
+ ptrW group(m_group.GetText());
+ if (mir_wstrlen(group) > 0 && Clist_GroupExists(group))
Clist_GroupCreate(0, group);
if (m_proto->IsOnline())
{
- CallProtoService(m_proto->m_szModuleName, PS_SETMYNICKNAME, SMNN_TCHAR, (LPARAM)ptrT(m_nickname.GetText()));
+ CallProtoService(m_proto->m_szModuleName, PS_SETMYNICKNAME, SMNN_TCHAR, (LPARAM)ptrW(m_nickname.GetText()));
// todo: add checkbox
m_proto->setTString("Password", pass_ptrT(m_password.GetText()));
@@ -361,21 +361,21 @@ void CToxNodeEditor::OnInitDialog() void CToxNodeEditor::OnOk(CCtrlBase*)
{
- ptrT ipv4(m_ipv4.GetText());
+ ptrW ipv4(m_ipv4.GetText());
if (!ipv4)
{
MessageBox(m_hwnd, TranslateT("Enter IPv4"), TranslateT("Error"), MB_OK);
return;
}
- ptrT port(m_port.GetText());
+ ptrW port(m_port.GetText());
if (!port)
{
MessageBox(m_hwnd, TranslateT("Enter port"), TranslateT("Error"), MB_OK);
return;
}
- ptrT pubKey(m_pkey.GetText());
+ ptrW pubKey(m_pkey.GetText());
if (!pubKey)
{
MessageBox(m_hwnd, TranslateT("Enter public key"), TranslateT("Error"), MB_OK);
@@ -563,17 +563,17 @@ void CToxOptionsNodeList::ReloadNodeList() {
JSONNode node = nodes[i];
- ptrT ipv4(mir_utf8decodeT(node.at("ipv4").as_string().c_str()));
+ ptrW ipv4(mir_utf8decodeW(node.at("ipv4").as_string().c_str()));
iItem = m_nodes.AddItem(ipv4, -1, NULL, 0);
- ptrT ipv6(mir_utf8decodeT(node.at("ipv6").as_string().c_str()));
- if (mir_tstrcmp(ipv6, L"-"))
+ ptrW ipv6(mir_utf8decodeW(node.at("ipv6").as_string().c_str()));
+ if (mir_wstrcmp(ipv6, L"-"))
m_nodes.SetItem(iItem, 1, ipv6);
- ptrT port(mir_utf8decodeT(node.at("port").as_string().c_str()));
+ ptrW port(mir_utf8decodeW(node.at("port").as_string().c_str()));
m_nodes.SetItem(iItem, 2, port);
- ptrT pubKey(mir_utf8decodeT(node.at("public_key").as_string().c_str()));
+ ptrW pubKey(mir_utf8decodeW(node.at("public_key").as_string().c_str()));
m_nodes.SetItem(iItem, 3, pubKey);
}
}
@@ -586,7 +586,7 @@ void CToxOptionsNodeList::ReloadNodeList() for (int i = 0; i < nodeCount; i++)
{
mir_snprintf(setting, TOX_SETTINGS_NODE_IPV4, i);
- ptrT value(db_get_tsa(NULL, module, setting));
+ ptrW value(db_get_tsa(NULL, module, setting));
iItem = m_nodes.AddItem(value, -1, NULL, 1);
mir_snprintf(setting, TOX_SETTINGS_NODE_IPV6, i);
@@ -599,7 +599,7 @@ void CToxOptionsNodeList::ReloadNodeList() {
char portNum[10];
itoa(port, portNum, 10);
- m_nodes.SetItem(iItem, 2, mir_a2t(portNum));
+ m_nodes.SetItem(iItem, 2, mir_a2u(portNum));
}
mir_snprintf(setting, TOX_SETTINGS_NODE_PKEY, i);
diff --git a/protocols/Tox/src/tox_profile.cpp b/protocols/Tox/src/tox_profile.cpp index 32a024480d..16658bc7c6 100644 --- a/protocols/Tox/src/tox_profile.cpp +++ b/protocols/Tox/src/tox_profile.cpp @@ -12,7 +12,7 @@ wchar_t* CToxProto::GetToxProfilePath(const wchar_t *accountName) wchar_t *profilePath = (wchar_t*)mir_calloc(MAX_PATH * sizeof(wchar_t) + 1);
wchar_t profileRootPath[MAX_PATH];
FoldersGetCustomPathT(hProfileFolderPath, profileRootPath, _countof(profileRootPath), VARST(L"%miranda_userdata%"));
- mir_sntprintf(profilePath, MAX_PATH, L"%s\\%s.tox", profileRootPath, accountName);
+ mir_snwprintf(profilePath, MAX_PATH, L"%s\\%s.tox", profileRootPath, accountName);
return profilePath;
}
@@ -22,7 +22,7 @@ bool CToxProto::LoadToxProfile(Tox_Options *options) mir_cslock locker(profileLock);
- ptrT profilePath(GetToxProfilePath());
+ ptrW profilePath(GetToxProfilePath());
if (!IsFileExists(profilePath))
return false;
@@ -121,7 +121,7 @@ void CToxProto::SaveToxProfile(CToxThread *toxThread) size += TOX_PASS_ENCRYPTION_EXTRA_LENGTH;
}
- ptrT profilePath(GetToxProfilePath());
+ ptrW profilePath(GetToxProfilePath());
FILE *profile = _wfopen(profilePath, L"wb");
if (profile == NULL)
{
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp index cf8987757d..9ae714bd31 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -7,7 +7,7 @@ CToxProto::CToxProto(const char* protoName, const wchar_t* userName) {
InitNetlib();
- accountName = mir_tstrdup(userName);
+ accountName = mir_wstrdup(userName);
CreateProtoService(PS_CREATEACCMGRUI, &CToxProto::OnAccountManagerInit);
diff --git a/protocols/Tox/src/tox_services.cpp b/protocols/Tox/src/tox_services.cpp index 1b5ab155a6..1651bbc597 100644 --- a/protocols/Tox/src/tox_services.cpp +++ b/protocols/Tox/src/tox_services.cpp @@ -2,7 +2,7 @@ INT_PTR CToxProto::SetMyNickname(WPARAM wParam, LPARAM lParam)
{
- ptrT nickname((wParam & SMNN_UNICODE) ? mir_u2t((wchar_t*)lParam) : mir_a2t((char*)lParam));
+ ptrW nickname((wParam & SMNN_UNICODE) ? mir_wstrdup((wchar_t*)lParam) : mir_a2u((char*)lParam));
setTString("Nick", nickname);
if (IsOnline())
diff --git a/protocols/Tox/src/tox_transfer.cpp b/protocols/Tox/src/tox_transfer.cpp index d775117f70..5eaf69dffe 100644 --- a/protocols/Tox/src/tox_transfer.cpp +++ b/protocols/Tox/src/tox_transfer.cpp @@ -18,9 +18,9 @@ void CToxProto::OnFriendFile(Tox*, uint32_t friendNumber, uint32_t fileNumber, u {
Netlib_Logf(proto->m_hNetlibUser, __FUNCTION__": incoming avatar (%d) from (%d)", fileNumber, friendNumber);
- ptrT address(proto->getTStringA(hContact, TOX_SETTINGS_ID));
+ ptrW address(proto->getTStringA(hContact, TOX_SETTINGS_ID));
wchar_t avatarName[MAX_PATH];
- mir_sntprintf(avatarName, MAX_PATH, L"%s.png", address);
+ mir_snwprintf(avatarName, MAX_PATH, L"%s.png", address);
AvatarTransferParam *transfer = new AvatarTransferParam(friendNumber, fileNumber, avatarName, fileSize);
transfer->pfts.flags |= PFTS_RECEIVING;
@@ -45,7 +45,7 @@ void CToxProto::OnFriendFile(Tox*, uint32_t friendNumber, uint32_t fileNumber, u ptrA rawName((char*)mir_alloc(filenameLength + 1));
memcpy(rawName, fileName, filenameLength);
rawName[filenameLength] = 0;
- wchar_t *name = mir_utf8decodeT(rawName);
+ wchar_t *name = mir_utf8decodeW(rawName);
FileTransferParam *transfer = new FileTransferParam(friendNumber, fileNumber, name, fileSize);
transfer->pfts.flags |= PFTS_RECEIVING;
@@ -74,11 +74,11 @@ void CToxProto::OnFriendFile(Tox*, uint32_t friendNumber, uint32_t fileNumber, u HANDLE CToxProto::OnFileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t *tszPath)
{
FileTransferParam *transfer = (FileTransferParam*)hTransfer;
- transfer->pfts.tszWorkingDir = mir_tstrdup(tszPath);
+ transfer->pfts.tszWorkingDir = mir_wstrdup(tszPath);
// stupid fix
wchar_t fullPath[MAX_PATH];
- mir_sntprintf(fullPath, L"%s\\%s", transfer->pfts.tszWorkingDir, transfer->pfts.tszCurrentFile);
+ mir_snwprintf(fullPath, L"%s\\%s", transfer->pfts.tszWorkingDir, transfer->pfts.tszCurrentFile);
transfer->ChangeName(fullPath);
if (!ProtoBroadcastAck(hContact, ACKTYPE_FILE, ACKRESULT_FILERESUME, (HANDLE)transfer, (LPARAM)&transfer->pfts))
diff --git a/protocols/Tox/src/tox_transfer.h b/protocols/Tox/src/tox_transfer.h index 40f8faea75..af5b51d8cc 100644 --- a/protocols/Tox/src/tox_transfer.h +++ b/protocols/Tox/src/tox_transfer.h @@ -23,7 +23,7 @@ struct FileTransferParam pfts.hContact = NULL;
pfts.totalFiles = 1;
pfts.ptszFiles = (wchar_t**)mir_alloc(sizeof(wchar_t*)*(pfts.totalFiles + 1));
- pfts.ptszFiles[0] = pfts.tszCurrentFile = mir_tstrdup(fileName);
+ pfts.ptszFiles[0] = pfts.tszCurrentFile = mir_wstrdup(fileName);
pfts.ptszFiles[pfts.totalFiles] = NULL;
pfts.totalBytes = pfts.currentFileSize = fileSize;
pfts.totalProgress = pfts.currentFileProgress = 0;
@@ -42,7 +42,7 @@ struct FileTransferParam void ChangeName(const wchar_t *fileName)
{
- pfts.ptszFiles[0] = replaceStrT(pfts.tszCurrentFile, fileName);
+ pfts.ptszFiles[0] = replaceStrW(pfts.tszCurrentFile, fileName);
}
uint8_t GetDirection() const
diff --git a/protocols/Tox/src/tox_utils.cpp b/protocols/Tox/src/tox_utils.cpp index a8e89ac51b..009c32b867 100644 --- a/protocols/Tox/src/tox_utils.cpp +++ b/protocols/Tox/src/tox_utils.cpp @@ -150,7 +150,7 @@ MEVENT CToxProto::AddEventToDb(MCONTACT hContact, WORD type, DWORD timestamp, DW INT_PTR CToxProto::ParseToxUri(WPARAM, LPARAM lParam)
{
wchar_t *uri = (wchar_t*)lParam;
- if (mir_tstrlen(uri) <= 4)
+ if (mir_wstrlen(uri) <= 4)
return 1;
if (Accounts.getCount() == 0)
@@ -173,7 +173,7 @@ INT_PTR CToxProto::ParseToxUri(WPARAM, LPARAM lParam) PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_UTF8;
- psr.id.a = mir_t2a(&uri[4]);
+ psr.id.a = mir_u2a(&uri[4]);
ADDCONTACTSTRUCT acs = { HANDLE_SEARCHRESULT };
acs.szProto = proto->m_szModuleName;
diff --git a/protocols/Twitter/src/StringUtil.h b/protocols/Twitter/src/StringUtil.h index f1ebdb55e1..51a13123e8 100644 --- a/protocols/Twitter/src/StringUtil.h +++ b/protocols/Twitter/src/StringUtil.h @@ -44,7 +44,7 @@ inline std::wstring UTF8ToWide(const std::string& str) inline bool Compare(const wstring& one, const wstring& two, bool caseSensitive)
{
- return caseSensitive ? (one == two) : (mir_tstrcmpi(one.c_str(), two.c_str()) == 0);
+ return caseSensitive ? (one == two) : (mir_wstrcmpi(one.c_str(), two.c_str()) == 0);
}
#endif//_STRINGUTIL_H_INCLUDED_
diff --git a/protocols/Twitter/src/chat.cpp b/protocols/Twitter/src/chat.cpp index 940d34eee5..8a7d155f26 100644 --- a/protocols/Twitter/src/chat.cpp +++ b/protocols/Twitter/src/chat.cpp @@ -29,25 +29,25 @@ void TwitterProto::UpdateChat(const twitter_user &update) gce.pDest = &gcd;
gce.bIsMe = (update.username == twit_.get_username());
gce.dwFlags = GCEF_ADDTOLOG;
- gce.ptszUID = mir_a2t(update.username.c_str());
+ gce.ptszUID = mir_a2u(update.username.c_str());
//TODO: write code here to replace % with %% in update.status.text (which is a std::string)
std::string chatText = update.status.text;
replaceAll(chatText, "%", "%%");
- gce.ptszText = mir_a2t_cp(chatText.c_str(), CP_UTF8);
- //gce.ptszText = mir_a2t_cp(update.status.text.c_str(),CP_UTF8);
+ gce.ptszText = mir_a2u_cp(chatText.c_str(), CP_UTF8);
+ //gce.ptszText = mir_a2u_cp(update.status.text.c_str(),CP_UTF8);
gce.time = static_cast<DWORD>(update.status.time);
DBVARIANT nick;
MCONTACT hContact = UsernameToHContact(update.username.c_str());
if (hContact && !db_get_s(hContact, "CList", "MyHandle", &nick)) {
- gce.ptszNick = mir_a2t(nick.pszVal);
+ gce.ptszNick = mir_a2u(nick.pszVal);
db_free(&nick);
}
else
- gce.ptszNick = mir_a2t(update.username.c_str());
+ gce.ptszNick = mir_a2u(update.username.c_str());
CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
@@ -78,7 +78,7 @@ int TwitterProto::OnChatOutgoing(WPARAM, LPARAM lParam) case GC_USER_PRIVMESS:
{
- ptrA text(mir_t2a(hook->ptszUID));
+ ptrA text(mir_u2a(hook->ptszUID));
CallService(MS_MSG_SENDMESSAGE, WPARAM(UsernameToHContact(text)), 0);
}
break;
@@ -93,8 +93,8 @@ void TwitterProto::AddChatContact(const char *name, const char *nick) GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_JOIN };
GCEVENT gce = { sizeof(gce), &gcd };
gce.time = DWORD(time(0));
- gce.ptszNick = mir_a2t(nick ? nick : name);
- gce.ptszUID = mir_a2t(name);
+ gce.ptszNick = mir_a2u(nick ? nick : name);
+ gce.ptszUID = mir_a2u(name);
gce.ptszStatus = L"Normal";
CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
@@ -107,7 +107,7 @@ void TwitterProto::DeleteChatContact(const char *name) GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_PART };
GCEVENT gce = { sizeof(gce), &gcd };
gce.time = DWORD(time(0));
- gce.ptszNick = mir_a2t(name);
+ gce.ptszNick = mir_a2u(name);
gce.ptszUID = gce.ptszNick;
CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
diff --git a/protocols/Twitter/src/contacts.cpp b/protocols/Twitter/src/contacts.cpp index 880ba6974a..174046afdb 100644 --- a/protocols/Twitter/src/contacts.cpp +++ b/protocols/Twitter/src/contacts.cpp @@ -49,7 +49,7 @@ MCONTACT TwitterProto::AddToList(int, PROTOSEARCHRESULT *psr) if (m_iStatus != ID_STATUS_ONLINE)
return 0;
- ForkThread(&TwitterProto::AddToListWorker, mir_utf8encodeT(psr->nick.w));
+ ForkThread(&TwitterProto::AddToListWorker, mir_utf8encodeW(psr->nick.w));
return AddToClientList(_T2A(psr->nick.w), "");
}
@@ -127,8 +127,8 @@ void TwitterProto::DoSearch(void *pArg) if (found) {
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
- psr.nick.w = mir_a2t(info.username.c_str());
- psr.firstName.w = mir_a2t(info.real_name.c_str());
+ psr.nick.w = mir_a2u(info.username.c_str());
+ psr.firstName.w = mir_a2u(info.real_name.c_str());
ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr);
ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
diff --git a/protocols/Twitter/src/main.cpp b/protocols/Twitter/src/main.cpp index ccc9b20db5..dc5a40dc99 100644 --- a/protocols/Twitter/src/main.cpp +++ b/protocols/Twitter/src/main.cpp @@ -46,7 +46,7 @@ PLUGININFOEX pluginInfo = { static int compare_protos(const TwitterProto *p1, const TwitterProto *p2)
{
- return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName);
+ return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName);
}
OBJLIST<TwitterProto> g_Instances(1, compare_protos);
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index 5b58154808..c0f1e32b01 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -313,12 +313,12 @@ int TwitterProto::OnModulesLoaded(WPARAM, LPARAM) nlu.szSettingsModule = m_szModuleName;
// Create standard network connection
- mir_sntprintf(descr, TranslateT("%s server connection"), m_tszUserName);
+ mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName);
nlu.ptszDescriptiveName = descr;
m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
if (m_hNetlibUser == NULL) {
wchar_t error[200];
- mir_sntprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName);
+ mir_snwprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName);
MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR);
}
@@ -326,12 +326,12 @@ int TwitterProto::OnModulesLoaded(WPARAM, LPARAM) char module[512];
mir_snprintf(module, "%sAv", m_szModuleName);
nlu.szSettingsModule = module;
- mir_sntprintf(descr, TranslateT("%s avatar connection"), m_tszUserName);
+ mir_snwprintf(descr, TranslateT("%s avatar connection"), m_tszUserName);
nlu.ptszDescriptiveName = descr;
hAvatarNetlib_ = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
if (hAvatarNetlib_ == NULL) {
wchar_t error[200];
- mir_sntprintf(error, TranslateT("Unable to initialize Netlib for %s."), TranslateT("Twitter (avatars)"));
+ mir_snwprintf(error, TranslateT("Unable to initialize Netlib for %s."), TranslateT("Twitter (avatars)"));
MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR);
}
@@ -380,7 +380,7 @@ int TwitterProto::ShowPinDialog() void TwitterProto::ShowPopup(const wchar_t *text, int Error)
{
POPUPDATAT popup = {};
- mir_sntprintf(popup.lptzContactName, TranslateT("%s Protocol"), m_tszUserName);
+ mir_snwprintf(popup.lptzContactName, TranslateT("%s Protocol"), m_tszUserName);
wcsncpy_s(popup.lptzText, text, _TRUNCATE);
if (Error) {
@@ -398,7 +398,7 @@ void TwitterProto::ShowPopup(const wchar_t *text, int Error) void TwitterProto::ShowPopup(const char *text, int Error)
{
POPUPDATAT popup = {};
- mir_sntprintf(popup.lptzContactName, TranslateT("%s Protocol"), m_tszUserName);
+ mir_snwprintf(popup.lptzContactName, TranslateT("%s Protocol"), m_tszUserName);
mbcs_to_tcs(CP_UTF8, text, popup.lptzText, _countof(popup.lptzText));
if (Error) {
popup.iSeconds = -1;
@@ -422,7 +422,7 @@ void TwitterProto::SendTweetWorker(void *p) char *text = static_cast<char*>(p);
if (mir_strlen(mir_utf8decodeA(text)) > 140) { // looks like the chat max outgoing msg thing doesn't work, so i'll do it here.
wchar_t errorPopup[280];
- mir_sntprintf(errorPopup, TranslateT("Don't be crazy! Everyone knows the max tweet size is 140, and you're trying to fit %d chars in there?"), mir_strlen(text));
+ mir_snwprintf(errorPopup, TranslateT("Don't be crazy! Everyone knows the max tweet size is 140, and you're trying to fit %d chars in there?"), mir_strlen(text));
ShowPopup(errorPopup, 1);
return;
}
@@ -455,7 +455,7 @@ void TwitterProto::UpdateSettings() std::wstring TwitterProto::GetAvatarFolder()
{
wchar_t path[MAX_PATH];
- mir_sntprintf(path, L"%s\\%s", VARST(L"%miranda_avatarcache%"), m_tszUserName);
+ mir_snwprintf(path, L"%s\\%s", VARST(L"%miranda_avatarcache%"), m_tszUserName);
return path;
}
diff --git a/protocols/Twitter/src/ui.cpp b/protocols/Twitter/src/ui.cpp index b6e067dab7..e6e5dc2a5e 100644 --- a/protocols/Twitter/src/ui.cpp +++ b/protocols/Twitter/src/ui.cpp @@ -113,7 +113,7 @@ INT_PTR CALLBACK tweet_proc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara // Set window title
wchar_t title[512];
- mir_sntprintf(title, L"Send Tweet for %s", proto->m_tszUserName);
+ mir_snwprintf(title, L"Send Tweet for %s", proto->m_tszUserName);
SetWindowText(hwndDlg, title);
return true;
@@ -125,7 +125,7 @@ INT_PTR CALLBACK tweet_proc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara GetDlgItemText(hwndDlg, IDC_TWEETMSG, msg, _countof(msg));
ShowWindow(hwndDlg, SW_HIDE);
- char *narrow = mir_t2a_cp(msg, CP_UTF8);
+ char *narrow = mir_u2a_cp(msg, CP_UTF8);
proto->ForkThread(&TwitterProto::SendTweetWorker, narrow);
EndDialog(hwndDlg, wParam);
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 340a27c78e..31865ddd4a 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -152,7 +152,7 @@ wchar_t* CVkProto::GetUserStoredPassword() {
debugLogA("CVkProto::GetUserStoredPassword");
ptrA szRawPass(getStringA("Password"));
- return (szRawPass != NULL) ? mir_utf8decodeT(szRawPass) : NULL;
+ return (szRawPass != NULL) ? mir_utf8decodeW(szRawPass) : NULL;
}
void CVkProto::SetAllContactStatuses(int iStatus)
@@ -389,9 +389,9 @@ bool CVkProto::AutoFillForm(char *pBody, CMStringA &szAction, CMStringA& szResul CMStringA name = getAttr(pFieldBeg, "name");
CMStringA value = getAttr(pFieldBeg, "value");
if (name == "email")
- value = (char*)T2Utf(ptrT(getTStringA("Login")));
+ value = (char*)T2Utf(ptrW(getTStringA("Login")));
else if (name == "pass")
- value = (char*)T2Utf(ptrT(GetUserStoredPassword()));
+ value = (char*)T2Utf(ptrW(GetUserStoredPassword()));
else if (name == "captcha_key") {
char *pCaptchaBeg = strstr(pFormBeg, "<img id=\"captcha\"");
if (pCaptchaBeg != NULL)
@@ -421,7 +421,7 @@ CMString CVkProto::RunConfirmationCode() pForm.ptszInitVal = NULL;
pForm.szModuleName = m_szModuleName;
pForm.szDataPrefix = "confirmcode_";
- return (!EnterString(&pForm)) ? CMString() : CMString(ptrT(pForm.ptszResult));
+ return (!EnterString(&pForm)) ? CMString() : CMString(ptrW(pForm.ptszResult));
}
CMString CVkProto::RunRenameNick(LPCTSTR ptszOldName)
@@ -433,7 +433,7 @@ CMString CVkProto::RunRenameNick(LPCTSTR ptszOldName) pForm.ptszInitVal = ptszOldName;
pForm.szModuleName = m_szModuleName;
pForm.szDataPrefix = "renamenick_";
- return (!EnterString(&pForm)) ? CMString() : CMString(ptrT(pForm.ptszResult));
+ return (!EnterString(&pForm)) ? CMString() : CMString(ptrW(pForm.ptszResult));
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -504,7 +504,7 @@ void __cdecl CVkProto::DBAddAuthRequestThread(void *p) if (param->hContact == NULL || param->hContact == INVALID_CONTACT_ID || !IsOnline())
return;
- for (int i = 0; i < MAX_RETRIES && IsEmpty(ptrT(db_get_tsa(param->hContact, m_szModuleName, "Nick"))); i++) {
+ for (int i = 0; i < MAX_RETRIES && IsEmpty(ptrW(db_get_tsa(param->hContact, m_szModuleName, "Nick"))); i++) {
Sleep(1500);
if (!IsOnline())
@@ -519,9 +519,9 @@ void CVkProto::DBAddAuthRequest(const MCONTACT hContact, bool added) {
debugLogA("CVkProto::DBAddAuthRequest");
- T2Utf szNick(ptrT(db_get_tsa(hContact, m_szModuleName, "Nick")));
- T2Utf szFirstName(ptrT(db_get_tsa(hContact, m_szModuleName, "FirstName")));
- T2Utf szLastName(ptrT(db_get_tsa(hContact, m_szModuleName, "LastName")));
+ T2Utf szNick(ptrW(db_get_tsa(hContact, m_szModuleName, "Nick")));
+ T2Utf szFirstName(ptrW(db_get_tsa(hContact, m_szModuleName, "FirstName")));
+ T2Utf szLastName(ptrW(db_get_tsa(hContact, m_szModuleName, "LastName")));
//blob is: uin(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ)
//blob is: 0(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ)
@@ -589,7 +589,7 @@ void CVkProto::SetMirVer(MCONTACT hContact, int platform) return;
}
- CMString MirVer, OldMirVer(ptrT(db_get_tsa(hContact, m_szModuleName, "MirVer")));
+ CMString MirVer, OldMirVer(ptrW(db_get_tsa(hContact, m_szModuleName, "MirVer")));
bool bSetFlag = true;
switch (platform) {
@@ -685,7 +685,7 @@ void CVkProto::SetSrmmReadStatus(MCONTACT hContact) StatusTextData st = { 0 };
st.cbSize = sizeof(st);
st.hIcon = IcoLib_GetIconByHandle(GetIconHandle(IDI_READMSG));
- mir_sntprintf(st.tszText, TranslateT("Message read: %s"), ttime);
+ mir_snwprintf(st.tszText, TranslateT("Message read: %s"), ttime);
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st);
}
@@ -1245,7 +1245,7 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jn else {
MCONTACT hContact = FindUser(uid);
if (hContact || uid == m_msgId)
- tszNick = ptrT(db_get_tsa(hContact, m_szModuleName, "Nick"));
+ tszNick = ptrW(db_get_tsa(hContact, m_szModuleName, "Nick"));
else
tszNick = TranslateT("(Unknown contact)");
tszUrl.AppendFormat(L"https://vk.com/id%d", uid);
diff --git a/protocols/VKontakte/src/vk_avatars.cpp b/protocols/VKontakte/src/vk_avatars.cpp index a2ada3e6d0..7401f2a386 100644 --- a/protocols/VKontakte/src/vk_avatars.cpp +++ b/protocols/VKontakte/src/vk_avatars.cpp @@ -130,7 +130,7 @@ INT_PTR CVkProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam) void CVkProto::GetAvatarFileName(MCONTACT hContact, wchar_t *pszDest, size_t cbLen)
{
- int tPathLen = mir_sntprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
+ int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
DWORD dwAttributes = GetFileAttributes(pszDest);
if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
@@ -139,7 +139,7 @@ void CVkProto::GetAvatarFileName(MCONTACT hContact, wchar_t *pszDest, size_t cbL pszDest[tPathLen++] = '\\';
const wchar_t *szFileType = L".jpg";
- ptrT szUrl(getTStringA(hContact, "AvatarUrl"));
+ ptrW szUrl(getTStringA(hContact, "AvatarUrl"));
if (szUrl) {
wchar_t *p = wcsrchr(szUrl, '.');
if (p != NULL)
@@ -147,7 +147,7 @@ void CVkProto::GetAvatarFileName(MCONTACT hContact, wchar_t *pszDest, size_t cbL }
LONG id = getDword(hContact, "ID", -1);
- mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, L"%d%s", id, szFileType);
+ mir_snwprintf(pszDest + tPathLen, MAX_PATH - tPathLen, L"%d%s", id, szFileType);
}
void CVkProto::SetAvatarUrl(MCONTACT hContact, CMString &tszUrl)
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index 10726e6842..33add5f629 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -46,12 +46,12 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg) c = new CVkChatInfo(id);
if (jnDlg) {
tszTitle = jnDlg["title"].as_mstring();
- c->m_tszTopic = mir_tstrdup(!tszTitle.IsEmpty() ? tszTitle : L"");
+ c->m_tszTopic = mir_wstrdup(!tszTitle.IsEmpty() ? tszTitle : L"");
}
CMString sid;
sid.Format(L"%S_%d", m_szModuleName, id);
- c->m_tszId = mir_tstrdup(sid);
+ c->m_tszId = mir_wstrdup(sid);
GCSESSION gcw = { sizeof(gcw) };
gcw.iType = GCW_CHATROOM;
@@ -183,13 +183,13 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe bNew = cu->m_bUnknown;
cu->m_bDel = false;
- CMString tszNick(ptrT(db_get_tsa(cc->m_hContact, m_szModuleName, CMStringA(FORMAT, "nick%d", cu->m_uid))));
+ CMString tszNick(ptrW(db_get_tsa(cc->m_hContact, m_szModuleName, CMStringA(FORMAT, "nick%d", cu->m_uid))));
if (tszNick.IsEmpty()) {
CMString fName(jnUser["first_name"].as_mstring());
CMString lName(jnUser["last_name"].as_mstring());
tszNick = fName.Trim() + L" " + lName.Trim();
}
- cu->m_tszNick = mir_tstrdup(tszNick);
+ cu->m_tszNick = mir_wstrdup(tszNick);
cu->m_bUnknown = false;
if (bNew) {
@@ -217,7 +217,7 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe gce.ptszUID = tszId;
gce.dwFlags = GCEF_REMOVECONTACT | GCEF_NOTNOTIFY;
gce.time = time(NULL);
- gce.ptszNick = mir_tstrdup(CMString(FORMAT, L"%s (https://vk.com/id%s)", cu.m_tszNick, tszId));
+ gce.ptszNick = mir_wstrdup(CMString(FORMAT, L"%s (https://vk.com/id%s)", cu.m_tszNick, tszId));
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
cc->m_users.remove(i);
@@ -272,10 +272,10 @@ void CVkProto::SetChatTitle(CVkChatInfo *cc, LPCTSTR tszTopic) if (!cc)
return;
- if (mir_tstrcmp(cc->m_tszTopic, tszTopic) == 0)
+ if (mir_wstrcmp(cc->m_tszTopic, tszTopic) == 0)
return;
- cc->m_tszTopic = mir_tstrdup(tszTopic);
+ cc->m_tszTopic = mir_wstrdup(tszTopic);
setTString(cc->m_hContact, "Nick", tszTopic);
GCDEST gcd = { m_szModuleName, cc->m_tszId, GC_EVENT_CHANGESESSIONAME };
@@ -406,7 +406,7 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode & cm->m_uid = uid;
cm->m_date = msgTime;
- cm->m_tszBody = mir_tstrdup(tszBody);
+ cm->m_tszBody = mir_wstrdup(tszBody);
cm->m_bHistory = bIsHistory;
cm->m_bIsAction = bIsAction;
}
@@ -419,8 +419,8 @@ void CVkProto::AppendChatMessage(CVkChatInfo *cc, int uid, int msgTime, LPCTSTR CVkChatUser *cu = cc->m_users.find((CVkChatUser*)&uid);
if (cu == NULL) {
cc->m_users.insert(cu = new CVkChatUser(uid));
- CMString tszNick(ptrT(db_get_tsa(cc->m_hContact, m_szModuleName, CMStringA(FORMAT, "nick%d", cu->m_uid))));
- cu->m_tszNick = mir_tstrdup(tszNick.IsEmpty() ? (hContact ? ptrT(db_get_tsa(hContact, m_szModuleName, "Nick")) : TranslateT("Unknown")) : tszNick);
+ CMString tszNick(ptrW(db_get_tsa(cc->m_hContact, m_szModuleName, CMStringA(FORMAT, "nick%d", cu->m_uid))));
+ cu->m_tszNick = mir_wstrdup(tszNick.IsEmpty() ? (hContact ? ptrW(db_get_tsa(hContact, m_szModuleName, "Nick")) : TranslateT("Unknown")) : tszNick);
cu->m_bUnknown = true;
}
@@ -433,8 +433,8 @@ void CVkProto::AppendChatMessage(CVkChatInfo *cc, int uid, int msgTime, LPCTSTR gce.ptszUID = tszId;
gce.time = msgTime;
gce.dwFlags = (bIsHistory) ? GCEF_NOTNOTIFY : GCEF_ADDTOLOG;
- gce.ptszNick = cu->m_tszNick ? mir_tstrdup(cu->m_tszNick) : mir_tstrdup(hContact ? ptrT(db_get_tsa(hContact, m_szModuleName, "Nick")) : TranslateT("Unknown"));
- gce.ptszText = IsEmpty((wchar_t *)ptszBody) ? mir_tstrdup(L"...") : mir_tstrdup(ptszBody);
+ gce.ptszNick = cu->m_tszNick ? mir_wstrdup(cu->m_tszNick) : mir_wstrdup(hContact ? ptrW(db_get_tsa(hContact, m_szModuleName, "Nick")) : TranslateT("Unknown"));
+ gce.ptszText = IsEmpty((wchar_t *)ptszBody) ? mir_wstrdup(L"...") : mir_wstrdup(ptszBody);
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
StopChatContactTyping(cc->m_chatid, uid);
}
@@ -444,7 +444,7 @@ void CVkProto::AppendChatMessage(CVkChatInfo *cc, int uid, int msgTime, LPCTSTR CVkChatInfo* CVkProto::GetChatById(LPCTSTR ptszId)
{
for (int i = 0; i < m_chats.getCount(); i++)
- if (!mir_tstrcmp(m_chats[i].m_tszId, ptszId))
+ if (!mir_wstrcmp(m_chats[i].m_tszId, ptszId))
return &m_chats[i];
return NULL;
@@ -454,7 +454,7 @@ CVkChatInfo* CVkProto::GetChatById(LPCTSTR ptszId) void CVkProto::SetChatStatus(MCONTACT hContact, int iStatus)
{
- ptrT tszChatID(getTStringA(hContact, "ChatRoomID"));
+ ptrW tszChatID(getTStringA(hContact, "ChatRoomID"));
if (tszChatID == NULL)
return;
@@ -496,9 +496,9 @@ int CVkProto::OnChatEvent(WPARAM, LPARAM lParam) switch (gch->pDest->iType) {
case GC_USER_MESSAGE:
- if (IsOnline() && mir_tstrlen(gch->ptszText) > 0) {
- ptrT ptszBuf(mir_tstrdup(gch->ptszText));
- rtrimt(ptszBuf);
+ if (IsOnline() && mir_wstrlen(gch->ptszText) > 0) {
+ ptrW ptszBuf(mir_wstrdup(gch->ptszText));
+ rtrimw(ptszBuf);
UnEscapeChatTags(ptszBuf);
SendMsg(cc->m_hContact, 0, T2Utf(ptszBuf));
}
@@ -641,7 +641,7 @@ INT_PTR __cdecl CVkProto::OnLeaveChat(WPARAM hContact, LPARAM) if (!IsOnline())
return 1;
- ptrT tszChatID(getTStringA(hContact, "ChatRoomID"));
+ ptrW tszChatID(getTStringA(hContact, "ChatRoomID"));
if (tszChatID == NULL)
return 1;
@@ -695,7 +695,7 @@ void CVkProto::KickFromChat(int chat_id, int user_id, const JSONNode &jnMsg, con if (msg.IsEmpty()) {
msg = TranslateT("You've been kicked by ");
if (hContact != NULL)
- msg += ptrT(db_get_tsa(hContact, m_szModuleName, "Nick"));
+ msg += ptrW(db_get_tsa(hContact, m_szModuleName, "Nick"));
else
msg += TranslateT("(Unknown contact)");
}
@@ -799,15 +799,15 @@ void CVkProto::NickMenuHook(CVkChatInfo *cc, GCHOOK *gch) wchar_t tszId[20];
_itow(cu->m_uid, tszId, 10);
- gce.ptszNick = mir_tstrdup(cu->m_tszNick);
+ gce.ptszNick = mir_wstrdup(cu->m_tszNick);
gce.bIsMe = (cu->m_uid == m_myUserId);
gce.ptszUID = tszId;
- gce.ptszText = mir_tstrdup(tszNewNick);
+ gce.ptszText = mir_wstrdup(tszNewNick);
gce.dwFlags = GCEF_ADDTOLOG;
gce.time = time(NULL);
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
- cu->m_tszNick = mir_tstrdup(tszNewNick);
+ cu->m_tszNick = mir_wstrdup(tszNewNick);
setTString(cc->m_hContact, CMStringA(FORMAT, "nick%d", cu->m_uid), tszNewNick);
}
break;
@@ -901,7 +901,7 @@ void CVkProto::ChatContactTypingThread(void *p) StatusTextData st = { 0 };
st.cbSize = sizeof(st);
- mir_sntprintf(st.tszText, TranslateT("%s is typing a message..."), cu->m_tszNick);
+ mir_snwprintf(st.tszText, TranslateT("%s is typing a message..."), cu->m_tszNick);
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, (LPARAM)&st);
}
@@ -933,7 +933,7 @@ void CVkProto::StopChatContactTyping(int iChatId, int iUserId) StatusTextData st = { 0 };
st.cbSize = sizeof(st);
- mir_sntprintf(st.tszText, L" ");
+ mir_snwprintf(st.tszText, L" ");
// CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, NULL) clears statusbar very slowly.
// (1-10 sec(!!!) for me on tabSRMM O_o)
diff --git a/protocols/VKontakte/src/vk_dialogs.cpp b/protocols/VKontakte/src/vk_dialogs.cpp index 5c119b5d5b..b043e9c242 100644 --- a/protocols/VKontakte/src/vk_dialogs.cpp +++ b/protocols/VKontakte/src/vk_dialogs.cpp @@ -142,7 +142,7 @@ void CVkWallPostForm::On_btnShare_Click(CCtrlButton*) void CVkWallPostForm::On_edtValue_Change(CCtrlEdit*)
{
- m_btnShare.Enable(!IsEmpty(ptrT(m_edtMsg.GetText())) || !IsEmpty(ptrT(m_edtUrl.GetText())));
+ m_btnShare.Enable(!IsEmpty(ptrW(m_edtMsg.GetText())) || !IsEmpty(ptrW(m_edtUrl.GetText())));
}
////////////////////////////////// IDD_INVITE /////////////////////////////////////////////
@@ -213,7 +213,7 @@ void CVkGCCreateForm::btnOk_OnOk(CCtrlButton*) bool bRes = !szUIds.IsEmpty();
if (bRes)
- m_proto->CreateNewChat(szUIds, ptrT(m_edtTitle.GetText()));
+ m_proto->CreateNewChat(szUIds, ptrW(m_edtTitle.GetText()));
EndDialog(m_hwnd, bRes);
}
diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp index be5b0eed16..0ab7fdd00d 100644 --- a/protocols/VKontakte/src/vk_feed.cpp +++ b/protocols/VKontakte/src/vk_feed.cpp @@ -85,7 +85,7 @@ void CVkProto::AddCListEvent(bool bNews) cle.hContact = hContact;
cle.hDbEvent = NULL;
wchar_t toolTip[255];
- mir_sntprintf(toolTip, bNews ? TranslateT("New news") : TranslateT("New notifications"));
+ mir_snwprintf(toolTip, bNews ? TranslateT("New news") : TranslateT("New notifications"));
cle.ptszTooltip = toolTip;
pcli->pfnAddEvent(&cle);
}
@@ -541,7 +541,7 @@ CVKNewsItem* CVkProto::GetVkGroupInvates(const JSONNode &jnItem, OBJLIST<CVkUser LONG iGroupId = jnItem["id"].as_int();
CMString tszId(FORMAT, L"%d,", iGroupId);
- CMString tszIds(ptrT(db_get_tsa(NULL, m_szModuleName, "InviteGroupIds")));
+ CMString tszIds(ptrW(db_get_tsa(NULL, m_szModuleName, "InviteGroupIds")));
if (tszIds.Find(tszId, 0) != -1)
return NULL;
diff --git a/protocols/VKontakte/src/vk_files.cpp b/protocols/VKontakte/src/vk_files.cpp index 59738aab54..bcb06a7a29 100644 --- a/protocols/VKontakte/src/vk_files.cpp +++ b/protocols/VKontakte/src/vk_files.cpp @@ -351,7 +351,7 @@ void CVkProto::OnReciveUploadFile(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pR if (isChatRoom(fup->hContact)) {
- ptrT tszChatID(getTStringA(fup->hContact, "ChatRoomID"));
+ ptrW tszChatID(getTStringA(fup->hContact, "ChatRoomID"));
if (!tszChatID) {
SendFileFiled(fup, VKERR_INVALID_USER);
return;
diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp index ec6ed4100e..2d07963dad 100644 --- a/protocols/VKontakte/src/vk_history.cpp +++ b/protocols/VKontakte/src/vk_history.cpp @@ -188,7 +188,7 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque if (m_iLoadHistoryTask > 0)
m_iLoadHistoryTask--;
- ptrT ptszNick(db_get_tsa(param->hContact, m_szModuleName, "Nick"));
+ ptrW ptszNick(db_get_tsa(param->hContact, m_szModuleName, "Nick"));
CMString str(FORMAT, L"%s %s %s", TranslateT("Error loading message history from server"), TranslateT("for"), ptszNick);
MsgPopup(param->hContact, str, TranslateT("Error"), true);
@@ -280,7 +280,7 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque if (m_iLoadHistoryTask > 0)
m_iLoadHistoryTask--;
- ptrT ptszNick(db_get_tsa(param->hContact, m_szModuleName, "Nick"));
+ ptrW ptszNick(db_get_tsa(param->hContact, m_szModuleName, "Nick"));
CMString str(FORMAT, TranslateT("Loading messages for %s is completed"), ptszNick);
debugLog(L"CVkProto::OnReceiveHistoryMessages for %s m_iLoadHistoryTask=%d", ptszNick, m_iLoadHistoryTask);
diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp index aedf678894..b83e711ab1 100644 --- a/protocols/VKontakte/src/vk_options.cpp +++ b/protocols/VKontakte/src/vk_options.cpp @@ -54,7 +54,7 @@ void CVkAccMgrForm::OnInitDialog() void CVkAccMgrForm::OnApply()
{
pass_ptrT ptszNewPass(m_edtPassword.GetText());
- bool bPassChanged = mir_tstrcmp(m_ptszOldPass, ptszNewPass) != 0;
+ bool bPassChanged = mir_wstrcmp(m_ptszOldPass, ptszNewPass) != 0;
if (bPassChanged) {
T2Utf szRawPasswd(ptszNewPass);
m_proto->setString("Password", szRawPasswd);
@@ -62,8 +62,8 @@ void CVkAccMgrForm::OnApply() m_ptszOldPass = ptszNewPass;
}
- ptrT ptszNewLogin(m_edtLogin.GetText());
- if (bPassChanged || mir_tstrcmpi(m_ptszOldLogin, ptszNewLogin))
+ ptrW ptszNewLogin(m_edtLogin.GetText());
+ if (bPassChanged || mir_wstrcmpi(m_ptszOldLogin, ptszNewLogin))
m_proto->ClearAccessToken();
m_ptszOldLogin = ptszNewLogin;
}
@@ -182,7 +182,7 @@ void CVkOptionAccountForm::OnInitDialog() for (size_t i = 0; i < _countof(vkLangCodes); i++) {
int cur = m_cbxVKLang.AddString(TranslateTS(vkLangCodes[i].szDescription), (LPARAM)vkLangCodes[i].szCode);
- if (!mir_tstrcmpi(vkLangCodes[i].szCode, m_proto->m_vkOptions.ptszVKLang))
+ if (!mir_wstrcmpi(vkLangCodes[i].szCode, m_proto->m_vkOptions.ptszVKLang))
m_cbxVKLang.SetCurSel(cur);
}
@@ -194,14 +194,14 @@ void CVkOptionAccountForm::OnApply() m_proto->m_vkOptions.iMarkMessageReadOn = m_cbxMarkAsRead.GetItemData(m_cbxMarkAsRead.GetCurSel());
m_proto->m_vkOptions.ptszVKLang = (wchar_t *)m_cbxVKLang.GetItemData(m_cbxVKLang.GetCurSel());
- ptrT ptszGroupName(m_edtGroupName.GetText());
- if (mir_tstrcmp(m_ptszOldGroup, ptszGroupName)) {
+ ptrW ptszGroupName(m_edtGroupName.GetText());
+ if (mir_wstrcmp(m_ptszOldGroup, ptszGroupName)) {
Clist_GroupCreate(NULL, ptszGroupName);
m_ptszOldGroup = ptszGroupName;
}
pass_ptrT ptszNewPass(m_edtPassword.GetText());
- bool bPassChanged = mir_tstrcmp(m_ptszOldPass, ptszNewPass) != 0;
+ bool bPassChanged = mir_wstrcmp(m_ptszOldPass, ptszNewPass) != 0;
if (bPassChanged) {
T2Utf szRawPasswd(ptszNewPass);
m_proto->setString("Password", szRawPasswd);
@@ -209,8 +209,8 @@ void CVkOptionAccountForm::OnApply() m_ptszOldPass = ptszNewPass;
}
- ptrT ptszNewLogin(m_edtLogin.GetText());
- if (bPassChanged || mir_tstrcmpi(m_ptszOldLogin, ptszNewLogin))
+ ptrW ptszNewLogin(m_edtLogin.GetText());
+ if (bPassChanged || mir_wstrcmpi(m_ptszOldLogin, ptszNewLogin))
m_proto->ClearAccessToken();
m_ptszOldLogin = ptszNewLogin;
diff --git a/protocols/VKontakte/src/vk_options.h b/protocols/VKontakte/src/vk_options.h index ed5e35bc15..ddc9b42d09 100644 --- a/protocols/VKontakte/src/vk_options.h +++ b/protocols/VKontakte/src/vk_options.h @@ -31,7 +31,7 @@ class CVkAccMgrForm : public CVkDlgBase CCtrlHyperlink m_hlLink;
pass_ptrT m_ptszOldPass;
- ptrT m_ptszOldLogin;
+ ptrW m_ptszOldLogin;
public:
CVkAccMgrForm(CVkProto *proto, HWND hwndParent);
@@ -55,8 +55,8 @@ class CVkOptionAccountForm : public CVkDlgBase CCtrlCombo m_cbxMarkAsRead;
pass_ptrT m_ptszOldPass;
- ptrT m_ptszOldLogin;
- ptrT m_ptszOldGroup;
+ ptrW m_ptszOldLogin;
+ ptrW m_ptszOldGroup;
public:
CVkOptionAccountForm(CVkProto *proto);
diff --git a/protocols/VKontakte/src/vk_pollserver.cpp b/protocols/VKontakte/src/vk_pollserver.cpp index a18754ce83..372a73e92f 100644 --- a/protocols/VKontakte/src/vk_pollserver.cpp +++ b/protocols/VKontakte/src/vk_pollserver.cpp @@ -41,8 +41,8 @@ void CVkProto::OnReceivePollingInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest * itoa(jnResponse["ts"].as_int(), ts, 10);
m_pollingTs = mir_strdup(ts);
- m_pollingKey = mir_t2a(jnResponse["key"].as_mstring());
- m_pollingServer = mir_t2a(jnResponse["server"].as_mstring());
+ m_pollingKey = mir_u2a(jnResponse["key"].as_mstring());
+ m_pollingServer = mir_u2a(jnResponse["server"].as_mstring());
if (!m_hPollingThread) {
debugLogA("CVkProto::OnReceivePollingInfo m_hPollingThread is NULL");
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index a31f4658a2..8144f79aa2 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. static int sttCompareProtocols(const CVkProto *p1, const CVkProto *p2)
{
- return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName);
+ return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName);
}
static int sttCompareAsyncHttpRequest(const AsyncHttpRequest *p1, const AsyncHttpRequest *p2)
@@ -62,7 +62,7 @@ CVkProto::CVkProto(const char *szModuleName, const wchar_t *ptszUserName) : HookProtoEvent(ME_OPT_INITIALISE, &CVkProto::OnOptionsInit);
wchar_t descr[512];
- mir_sntprintf(descr, TranslateT("%s server connection"), m_tszUserName);
+ mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName);
NETLIBUSER nlu = {sizeof(nlu)};
nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
@@ -357,7 +357,7 @@ int CVkProto::OnPreBuildContactMenu(WPARAM hContact, LPARAM) {
LONG userID = getDword(hContact, "ID", -1);
bool bisFriend = (getBool(hContact, "Auth", true) == 0);
- bool bisBroadcast = !(IsEmpty(ptrT(db_get_tsa(hContact, m_szModuleName, "AudioUrl"))));
+ bool bisBroadcast = !(IsEmpty(ptrW(db_get_tsa(hContact, m_szModuleName, "AudioUrl"))));
Menu_ShowItem(m_hContactMenuItems[CMI_VISITPROFILE], userID != VK_FEED_USER);
Menu_ShowItem(m_hContactMenuItems[CMI_MARKMESSAGESASREAD], !isChatRoom(hContact) && userID != VK_FEED_USER);
Menu_ShowItem(m_hContactMenuItems[CMI_WALLPOST], !isChatRoom(hContact));
@@ -425,7 +425,7 @@ void CVkProto::InitPopups(void) ppc.PluginWindowProc = PopupDlgProc;
ppc.lParam = APF_RETURN_HWND;
- mir_sntprintf(desc, L"%s %s", m_tszUserName, TranslateT("Errors"));
+ mir_snwprintf(desc, L"%s %s", m_tszUserName, TranslateT("Errors"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Error");
ppc.ptszDescription = desc;
ppc.pszName = name;
@@ -435,7 +435,7 @@ void CVkProto::InitPopups(void) ppc.iSeconds = 60;
m_hPopupClassError = Popup_RegisterClass(&ppc);
- mir_sntprintf(desc, L"%s %s", m_tszUserName, TranslateT("Notification"));
+ mir_snwprintf(desc, L"%s %s", m_tszUserName, TranslateT("Notification"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Notification");
ppc.ptszDescription = desc;
ppc.pszName = name;
@@ -576,7 +576,7 @@ void CVkProto::OnReceiveAuthRequest(NETLIBHTTPREQUEST *reply, AsyncHttpRequest * setByte(param->hContact, "Auth", 0);
if (iRet == 2) {
CMString msg,
- tszNick(ptrT(db_get_tsa(param->hContact, m_szModuleName, "Nick")));
+ tszNick(ptrW(db_get_tsa(param->hContact, m_szModuleName, "Nick")));
if (tszNick.IsEmpty())
tszNick = TranslateT("(Unknown contact)");
msg.AppendFormat(TranslateT("User %s added as friend"), tszNick);
diff --git a/protocols/VKontakte/src/vk_search.cpp b/protocols/VKontakte/src/vk_search.cpp index c19c3610bf..f3004e3855 100644 --- a/protocols/VKontakte/src/vk_search.cpp +++ b/protocols/VKontakte/src/vk_search.cpp @@ -33,9 +33,9 @@ HANDLE CVkProto::SearchByName(const wchar_t *nick, const wchar_t *firstName, con {
PROTOSEARCHBYNAME *psr = new (PROTOSEARCHBYNAME);
- psr->pszFirstName = mir_tstrdup(firstName);
- psr->pszLastName = mir_tstrdup(lastName);
- psr->pszNick = mir_tstrdup(nick);
+ psr->pszFirstName = mir_wstrdup(firstName);
+ psr->pszLastName = mir_wstrdup(lastName);
+ psr->pszNick = mir_wstrdup(nick);
ForkThread(&CVkProto::SearchThread, (void *)psr);
return (HANDLE)1;
@@ -69,7 +69,7 @@ void __cdecl CVkProto::SearchThread(void *p) PROTOSEARCHBYNAME *pParam = (PROTOSEARCHBYNAME *)p;
wchar_t arg[200];
- mir_sntprintf(arg, L"%s %s %s", pParam->pszFirstName, pParam->pszNick, pParam->pszLastName);
+ mir_snwprintf(arg, L"%s %s %s", pParam->pszFirstName, pParam->pszNick, pParam->pszLastName);
debugLog(L"CVkProto::SearchThread %s", arg);
if (!IsOnline())
return;
@@ -126,10 +126,10 @@ void CVkProto::OnSearch(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) CMString Nick(jnRecord["nickname"].as_mstring());
CMString Domain(jnRecord["domain"].as_mstring());
- psr.id.w = mir_tstrdup(Id);
- psr.firstName.w = mir_tstrdup(FirstName);
- psr.lastName.w = mir_tstrdup(LastName);
- psr.nick.w = Nick.IsEmpty() ? mir_tstrdup(Domain) : mir_tstrdup(Nick);
+ psr.id.w = mir_wstrdup(Id);
+ psr.firstName.w = mir_wstrdup(FirstName);
+ psr.lastName.w = mir_wstrdup(LastName);
+ psr.nick.w = Nick.IsEmpty() ? mir_wstrdup(Domain) : mir_wstrdup(Nick);
bool filter = true;
if (pParam) {
@@ -184,11 +184,11 @@ void CVkProto::OnSearchByMail(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) CMString Nick(jnRecord["nickname"].as_mstring());
CMString Email(jnRecord["contact"].as_mstring());
- psr.id.w = mir_tstrdup(Id);
- psr.firstName.w = mir_tstrdup(FirstName);
- psr.lastName.w = mir_tstrdup(LastName);
- psr.nick.w = Nick.IsEmpty() ? mir_tstrdup(Email) : mir_tstrdup(Nick);
- psr.email.w = mir_tstrdup(Email);
+ psr.id.w = mir_wstrdup(Id);
+ psr.firstName.w = mir_wstrdup(FirstName);
+ psr.lastName.w = mir_wstrdup(LastName);
+ psr.nick.w = Nick.IsEmpty() ? mir_wstrdup(Email) : mir_wstrdup(Nick);
+ psr.email.w = mir_wstrdup(Email);
ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr);
}
diff --git a/protocols/VKontakte/src/vk_status.cpp b/protocols/VKontakte/src/vk_status.cpp index add498f486..9fc8aef944 100644 --- a/protocols/VKontakte/src/vk_status.cpp +++ b/protocols/VKontakte/src/vk_status.cpp @@ -69,8 +69,8 @@ void CVkProto::SetServerStatus(int iNewStatus) return;
int iOldStatus = m_iStatus;
- CMString oldStatusMsg(ptrT(db_get_tsa(NULL, m_szModuleName, "OldStatusMsg")));
- ptrT ptszListeningToMsg(db_get_tsa(NULL, m_szModuleName, "ListeningTo"));
+ CMString oldStatusMsg(ptrW(db_get_tsa(NULL, m_szModuleName, "OldStatusMsg")));
+ ptrW ptszListeningToMsg(db_get_tsa(NULL, m_szModuleName, "ListeningTo"));
if (iNewStatus == ID_STATUS_OFFLINE) {
m_bNeedSendOnline = false;
@@ -126,7 +126,7 @@ void CVkProto::OnReceiveStatusMsg(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pR OnReceiveStatus(reply, pReq);
- ptrT ptszOldStatusMsg(db_get_tsa(NULL, m_szModuleName, "OldStatusMsg"));
+ ptrW ptszOldStatusMsg(db_get_tsa(NULL, m_szModuleName, "OldStatusMsg"));
CMString tszOldStatusMsg(ptszOldStatusMsg);
ENTER_STRING pForm = { sizeof(pForm) };
@@ -139,7 +139,7 @@ void CVkProto::OnReceiveStatusMsg(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pR if (!EnterString(&pForm))
return;
- CMString tszNewStatusMsg(ptrT(pForm.ptszResult));
+ CMString tszNewStatusMsg(ptrW(pForm.ptszResult));
if (tszOldStatusMsg == tszNewStatusMsg)
return;
@@ -240,7 +240,7 @@ INT_PTR __cdecl CVkProto::SvcSetListeningTo(WPARAM, LPARAM lParam) db_unset(NULL, m_szModuleName, "ListeningTo");
else if (pliInfo->dwFlags & LTI_UNICODE) {
if (ServiceExists(MS_LISTENINGTO_GETPARSEDTEXT))
- tszListeningTo = ptrT((LPWSTR)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%artist% - %title%", (LPARAM)pliInfo));
+ tszListeningTo = ptrW((LPWSTR)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%artist% - %title%", (LPARAM)pliInfo));
else
tszListeningTo.Format(L"%s - %s",
pliInfo->ptszArtist ? pliInfo->ptszArtist : L"",
diff --git a/protocols/VKontakte/src/vk_struct.cpp b/protocols/VKontakte/src/vk_struct.cpp index a1d074a9ad..12bc8804d0 100644 --- a/protocols/VKontakte/src/vk_struct.cpp +++ b/protocols/VKontakte/src/vk_struct.cpp @@ -100,8 +100,8 @@ void AsyncHttpRequest::Redirect(NETLIBHTTPREQUEST *nhr) CVkFileUploadParam::CVkFileUploadParam(MCONTACT _hContact, const wchar_t *_desc, wchar_t **_files) :
hContact(_hContact),
- Desc(mir_tstrdup(_desc)),
- FileName(mir_tstrdup(_files[0])),
+ Desc(mir_wstrdup(_desc)),
+ FileName(mir_wstrdup(_files[0])),
atr(NULL),
fname(NULL),
filetype(typeInvalid)
diff --git a/protocols/VKontakte/src/vk_struct.h b/protocols/VKontakte/src/vk_struct.h index 86cee657fe..19e320eb67 100644 --- a/protocols/VKontakte/src/vk_struct.h +++ b/protocols/VKontakte/src/vk_struct.h @@ -141,7 +141,7 @@ struct CVkChatMessage : public MZeroedObject int m_mid, m_uid, m_date;
bool m_bHistory, m_bIsAction;
- ptrT m_tszBody;
+ ptrW m_tszBody;
};
struct CVkChatUser : public MZeroedObject
@@ -154,7 +154,7 @@ struct CVkChatUser : public MZeroedObject int m_uid;
bool m_bDel, m_bUnknown;
- ptrT m_tszNick;
+ ptrW m_tszNick;
};
struct CVkChatInfo : public MZeroedObject
@@ -170,7 +170,7 @@ struct CVkChatInfo : public MZeroedObject int m_chatid, m_admin_id;
bool m_bHistoryRead;
- ptrT m_tszTopic, m_tszId;
+ ptrW m_tszTopic, m_tszId;
MCONTACT m_hContact;
OBJLIST<CVkChatUser> m_users;
OBJLIST<CVkChatMessage> m_msgs;
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 185f52e583..ea600d8eb4 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -355,11 +355,11 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, bool self) setTString(hContact, "Phone", tszValue);
tszValue = jnItem["status"].as_mstring();
- CMString tszOldStatus(ptrT(db_get_tsa(hContact, hContact ? "CList" : m_szModuleName, "StatusMsg")));
+ CMString tszOldStatus(ptrW(db_get_tsa(hContact, hContact ? "CList" : m_szModuleName, "StatusMsg")));
if (tszValue != tszOldStatus)
db_set_ts(hContact, hContact ? "CList" : m_szModuleName, "StatusMsg", tszValue);
- CMString tszOldListeningTo(ptrT(db_get_tsa(hContact, m_szModuleName, "ListeningTo")));
+ CMString tszOldListeningTo(ptrW(db_get_tsa(hContact, m_szModuleName, "ListeningTo")));
const JSONNode &jnAudio = jnItem["status_audio"];
if (jnAudio) {
CMString tszListeningTo(FORMAT, L"%s - %s", jnAudio["artist"].as_mstring(), jnAudio["title"].as_mstring());
@@ -428,13 +428,13 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, bool self) for (int i = iInteres; iInteres > 0; i++) {
CMStringA InteresCat(FORMAT, "Interest%dCat", iInteres);
- ptrT ptszCat(db_get_tsa(hContact, m_szModuleName, InteresCat));
+ ptrW ptszCat(db_get_tsa(hContact, m_szModuleName, InteresCat));
if (!ptszCat)
break;
db_unset(hContact, m_szModuleName, InteresCat);
CMStringA InteresText(FORMAT, "Interest%dText", iInteres);
- ptrT ptszText(db_get_tsa(hContact, m_szModuleName, InteresText));
+ ptrW ptszText(db_get_tsa(hContact, m_szModuleName, InteresText));
if (!ptszText)
break;
db_unset(hContact, m_szModuleName, InteresText);
@@ -678,7 +678,7 @@ INT_PTR __cdecl CVkProto::SvcDeleteFriend(WPARAM hContact, LPARAM flag) if (!IsOnline() || userID == -1 || userID == VK_FEED_USER)
return 1;
- ptrT ptszNick(db_get_tsa(hContact, m_szModuleName, "Nick"));
+ ptrW ptszNick(db_get_tsa(hContact, m_szModuleName, "Nick"));
CMString ptszMsg;
if (flag == 0) {
ptszMsg.AppendFormat(TranslateT("Are you sure to delete %s from your friend list?"), IsEmpty(ptszNick) ? TranslateT("(Unknown contact)") : ptszNick);
@@ -699,7 +699,7 @@ void CVkProto::OnReceiveDeleteFriend(NETLIBHTTPREQUEST *reply, AsyncHttpRequest JSONNode jnRoot;
const JSONNode &jnResponse = CheckJsonResponse(pReq, reply, jnRoot);
if (jnResponse) {
- CMString tszNick(ptrT(db_get_tsa(param->hContact, m_szModuleName, "Nick")));
+ CMString tszNick(ptrW(db_get_tsa(param->hContact, m_szModuleName, "Nick")));
if (tszNick.IsEmpty())
tszNick = TranslateT("(Unknown contact)");
CMString msgformat, msg;
@@ -771,7 +771,7 @@ INT_PTR __cdecl CVkProto::SvcBanUser(WPARAM hContact, LPARAM) tszVarWarning += ".\n";
code += "return 1;";
- ptrT ptszNick(db_get_tsa(hContact, m_szModuleName, "Nick"));
+ ptrW ptszNick(db_get_tsa(hContact, m_szModuleName, "Nick"));
CMString ptszMsg(FORMAT, TranslateT("Are you sure to ban %s? %s%sContinue?"),
IsEmpty(ptszNick) ? TranslateT("(Unknown contact)") : ptszNick,
tszVarWarning.IsEmpty() ? L" " : TranslateT("\nIt will also"),
@@ -796,7 +796,7 @@ INT_PTR __cdecl CVkProto::SvcReportAbuse(WPARAM hContact, LPARAM) if (!IsOnline() || userID == -1 || userID == VK_FEED_USER)
return 1;
- CMString tszNick(ptrT(db_get_tsa(hContact, m_szModuleName, "Nick"))),
+ CMString tszNick(ptrW(db_get_tsa(hContact, m_szModuleName, "Nick"))),
ptszMsg(FORMAT, TranslateT("Are you sure to report abuse on %s?"), tszNick.IsEmpty() ? TranslateT("(Unknown contact)") : tszNick);
if (IDNO == MessageBox(NULL, ptszMsg, TranslateT("Attention!"), MB_ICONWARNING | MB_YESNO))
return 1;
@@ -812,7 +812,7 @@ INT_PTR __cdecl CVkProto::SvcOpenBroadcast(WPARAM hContact, LPARAM) {
debugLogA("CVkProto::SvcOpenBroadcast");
- CMString tszAudio(ptrT(db_get_tsa(hContact, m_szModuleName, "AudioUrl")));
+ CMString tszAudio(ptrW(db_get_tsa(hContact, m_szModuleName, "AudioUrl")));
if (!tszAudio.IsEmpty())
Utils_OpenUrlT(tszAudio);
@@ -823,14 +823,14 @@ INT_PTR __cdecl CVkProto::SvcVisitProfile(WPARAM hContact, LPARAM) {
debugLogA("CVkProto::SvcVisitProfile");
if (isChatRoom(hContact)) {
- ptrT tszHomepage(db_get_tsa(hContact, m_szModuleName, "Homepage"));
+ ptrW tszHomepage(db_get_tsa(hContact, m_szModuleName, "Homepage"));
if(!IsEmpty(tszHomepage))
Utils_OpenUrlT(tszHomepage);
return 0;
}
LONG userID = getDword(hContact, "ID", -1);
- ptrT tszDomain(db_get_tsa(hContact, m_szModuleName, "domain"));
+ ptrW tszDomain(db_get_tsa(hContact, m_szModuleName, "domain"));
CMString tszUrl("https://vk.com/");
if (tszDomain)
diff --git a/protocols/WhatsApp/src/avatars.cpp b/protocols/WhatsApp/src/avatars.cpp index e1839586e6..536602bcb2 100644 --- a/protocols/WhatsApp/src/avatars.cpp +++ b/protocols/WhatsApp/src/avatars.cpp @@ -102,8 +102,8 @@ int WhatsAppProto::InternalSetAvatar(MCONTACT hContact, const char *szJid, const wchar_t tszTempFile[MAX_PATH], tszMyFile[MAX_PATH];
if (hContact == NULL) {
- mir_sntprintf(tszMyFile, L"%s\\myavatar.jpg", m_tszAvatarFolder.c_str());
- mir_sntprintf(tszTempFile, L"%s\\myavatar.preview.jpg", m_tszAvatarFolder.c_str());
+ mir_snwprintf(tszMyFile, L"%s\\myavatar.jpg", m_tszAvatarFolder.c_str());
+ mir_snwprintf(tszTempFile, L"%s\\myavatar.preview.jpg", m_tszAvatarFolder.c_str());
}
else {
std::wstring tszContactAva = GetAvatarFileName(hContact);
diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp index f33a628461..26a46bec48 100644 --- a/protocols/WhatsApp/src/chat.cpp +++ b/protocols/WhatsApp/src/chat.cpp @@ -146,7 +146,7 @@ void WhatsAppProto::ChatLogMenuHook(WAChatInfo *pInfo, struct GCHOOK *gch) void WhatsAppProto::EditChatSubject(WAChatInfo *pInfo)
{
CMString title(FORMAT, TranslateT("Set new subject for %s"), pInfo->tszNick);
- ptrT tszOldValue(getTStringA(pInfo->hContact, WHATSAPP_KEY_NICK));
+ ptrW tszOldValue(getTStringA(pInfo->hContact, WHATSAPP_KEY_NICK));
ENTER_STRING es = { 0 };
es.cbSize = sizeof(es);
@@ -207,7 +207,7 @@ void WhatsAppProto::NickListMenuHook(WAChatInfo *pInfo, struct GCHOOK *gch) break;
case IDM_CPY_NICK:
- utils::copyText(pcli->hwndContactList, ptrT(GetChatUserNick(std::string((char*)_T2A(gch->ptszUID)))));
+ utils::copyText(pcli->hwndContactList, ptrW(GetChatUserNick(std::string((char*)_T2A(gch->ptszUID)))));
break;
case IDM_CPY_RJID:
@@ -253,7 +253,7 @@ void WhatsAppProto::KickChatUser(WAChatInfo *pInfo, const wchar_t *ptszJid) int WhatsAppProto::OnDeleteChat(WPARAM hContact, LPARAM)
{
if (isChatRoom(hContact) && isOnline()) {
- ptrT tszID(getTStringA(hContact, WHATSAPP_KEY_ID));
+ ptrW tszID(getTStringA(hContact, WHATSAPP_KEY_ID));
if (tszID)
m_pConnection->sendJoinLeaveGroup(_T2A(tszID), false);
}
@@ -333,12 +333,12 @@ wchar_t* WhatsAppProto::GetChatUserNick(const std::string &jid) wchar_t* tszNick;
if (m_szJid != jid) {
MCONTACT hContact = ContactIDToHContact(jid);
- tszNick = (hContact == 0) ? utils::removeA(str2t(jid)) : mir_tstrdup(pcli->pfnGetContactDisplayName(hContact, 0));
+ tszNick = (hContact == 0) ? utils::removeA(str2t(jid)) : mir_wstrdup(pcli->pfnGetContactDisplayName(hContact, 0));
}
else tszNick = str2t(m_szNick);
if (tszNick == NULL)
- tszNick = mir_tstrdup(TranslateT("Unknown user"));
+ tszNick = mir_wstrdup(TranslateT("Unknown user"));
return tszNick;
}
@@ -393,9 +393,9 @@ void WhatsAppProto::onGroupMessage(const FMessage &pMsg) msg += pMsg.media_url;
}
- ptrT tszText(str2t(msg));
- ptrT tszUID(str2t(pMsg.remote_resource));
- ptrT tszNick(GetChatUserNick(pMsg.remote_resource));
+ ptrW tszText(str2t(msg));
+ ptrW tszUID(str2t(pMsg.remote_resource));
+ ptrW tszNick(GetChatUserNick(pMsg.remote_resource));
GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_MESSAGE };
@@ -418,13 +418,13 @@ void WhatsAppProto::onGroupNewSubject(const std::string &gjid, const std::string if (pInfo == NULL)
return;
- ptrT tszText(str2t(newSubject));
- ptrT tszTextDb(getTStringA(pInfo->hContact, WHATSAPP_KEY_NICK));
- if (!mir_tstrcmp(tszText, tszTextDb)) // notify about subject change only if differs from the stored one
+ ptrW tszText(str2t(newSubject));
+ ptrW tszTextDb(getTStringA(pInfo->hContact, WHATSAPP_KEY_NICK));
+ if (!mir_wstrcmp(tszText, tszTextDb)) // notify about subject change only if differs from the stored one
return;
- ptrT tszUID(str2t(author));
- ptrT tszNick(GetChatUserNick(author));
+ ptrW tszUID(str2t(author));
+ ptrW tszNick(GetChatUserNick(author));
GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_TOPIC };
@@ -445,8 +445,8 @@ void WhatsAppProto::onGroupAddUser(const std::string &gjid, const std::string &u if (pInfo == NULL || !pInfo->bActive)
return;
- ptrT tszUID(str2t(ujid));
- ptrT tszNick(GetChatUserNick(ujid));
+ ptrW tszUID(str2t(ujid));
+ ptrW tszNick(GetChatUserNick(ujid));
GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_JOIN };
@@ -464,8 +464,8 @@ void WhatsAppProto::onGroupRemoveUser(const std::string &gjid, const std::string if (pInfo == NULL)
return;
- ptrT tszUID(str2t(ujid));
- ptrT tszNick(GetChatUserNick(ujid));
+ ptrW tszUID(str2t(ujid));
+ ptrW tszNick(GetChatUserNick(ujid));
GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_PART };
@@ -505,8 +505,8 @@ void WhatsAppProto::onGetParticipants(const std::string &gjid, const std::vector for (size_t i = 0; i < participants.size(); i++) {
std::string curr = participants[i];
- ptrT ujid(str2t(curr)), nick(GetChatUserNick(curr));
- bool bIsOwner = !mir_tstrcmp(ujid, pInfo->tszOwner);
+ ptrW ujid(str2t(curr)), nick(GetChatUserNick(curr));
+ bool bIsOwner = !mir_wstrcmp(ujid, pInfo->tszOwner);
GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_JOIN };
@@ -538,8 +538,8 @@ void WhatsAppProto::onGroupMessageReceived(const FMessage &msg) if (p == pInfo->m_unsentMsgs.end())
return;
- ptrT tszUID(str2t(m_szJid));
- ptrT tszNick(str2t(m_szNick));
+ ptrW tszUID(str2t(m_szJid));
+ ptrW tszNick(str2t(m_szNick));
GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_MESSAGE };
diff --git a/protocols/WhatsApp/src/contacts.cpp b/protocols/WhatsApp/src/contacts.cpp index 2c9f0c17e9..8026cc0912 100644 --- a/protocols/WhatsApp/src/contacts.cpp +++ b/protocols/WhatsApp/src/contacts.cpp @@ -21,7 +21,7 @@ MCONTACT WhatsAppProto::AddToContactList(const std::string &jid, const char *new if (oldName.compare(string(new_name)) != 0) {
db_set_utf(hContact, m_szModuleName, WHATSAPP_KEY_NICK, new_name);
- CMString tmp(FORMAT, TranslateT("is now known as '%s'"), ptrT(mir_utf8decodeT(new_name)));
+ CMString tmp(FORMAT, TranslateT("is now known as '%s'"), ptrW(mir_utf8decodeW(new_name)));
this->NotifyEvent(_A2T(oldName.c_str()), tmp, hContact, WHATSAPP_EVENT_OTHER);
}
}
@@ -74,8 +74,8 @@ void WhatsAppProto::SetAllContactStatuses(int status, bool reset_client) {
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
if (reset_client) {
- ptrT tszMirVer(getTStringA(hContact, "MirVer"));
- if (mir_tstrcmp(tszMirVer, L"WhatsApp"))
+ ptrW tszMirVer(getTStringA(hContact, "MirVer"));
+ if (mir_wstrcmp(tszMirVer, L"WhatsApp"))
setTString(hContact, "MirVer", L"WhatsApp");
db_set_ws(hContact, "CList", "StatusMsg", L"");
diff --git a/protocols/WhatsApp/src/dialogs.cpp b/protocols/WhatsApp/src/dialogs.cpp index 501a09151a..6a86685895 100644 --- a/protocols/WhatsApp/src/dialogs.cpp +++ b/protocols/WhatsApp/src/dialogs.cpp @@ -113,8 +113,8 @@ public: virtual void OnApply()
{
- ptrT tszGroup(m_group.GetText());
- if (mir_tstrcmp(m_proto->m_tszDefaultGroup, tszGroup))
+ ptrW tszGroup(m_group.GetText());
+ if (mir_wstrcmp(m_proto->m_tszDefaultGroup, tszGroup))
m_proto->m_tszDefaultGroup = tszGroup.detach();
if (m_proto->isOnline())
diff --git a/protocols/WhatsApp/src/main.cpp b/protocols/WhatsApp/src/main.cpp index f3e7513339..7cc94409ea 100644 --- a/protocols/WhatsApp/src/main.cpp +++ b/protocols/WhatsApp/src/main.cpp @@ -26,7 +26,7 @@ PLUGININFOEX pluginInfo = { static int compare_protos(const WhatsAppProto *p1, const WhatsAppProto *p2)
{
- return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName);
+ return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName);
}
OBJLIST<WhatsAppProto> g_Instances(1, compare_protos);
diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp index 56c0d3571e..e40588f0cc 100644 --- a/protocols/WhatsApp/src/proto.cpp +++ b/protocols/WhatsApp/src/proto.cpp @@ -33,7 +33,7 @@ WhatsAppProto::WhatsAppProto(const char *proto_name, const wchar_t *username) // Create standard network connection
wchar_t descr[512];
- mir_sntprintf(descr, TranslateT("%s server connection"), m_tszUserName);
+ mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName);
NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
@@ -42,7 +42,7 @@ WhatsAppProto::WhatsAppProto(const char *proto_name, const wchar_t *username) m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
if (m_hNetlibUser == NULL) {
wchar_t error[200];
- mir_sntprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName);
+ mir_snwprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName);
MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR);
}
@@ -54,7 +54,7 @@ WhatsAppProto::WhatsAppProto(const char *proto_name, const wchar_t *username) CreateDirectoryTreeT(m_tszAvatarFolder.c_str());
if (m_tszDefaultGroup == NULL)
- m_tszDefaultGroup = mir_tstrdup(L"WhatsApp");
+ m_tszDefaultGroup = mir_wstrdup(L"WhatsApp");
Clist_GroupCreate(0, m_tszDefaultGroup);
SetAllContactStatuses(ID_STATUS_OFFLINE, true);
@@ -368,8 +368,8 @@ LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa void WhatsAppProto::NotifyEvent(const string& title, const string& info, MCONTACT contact, DWORD flags, wchar_t* url)
{
- wchar_t *rawTitle = mir_a2t_cp(title.c_str(), CP_UTF8);
- wchar_t *rawInfo = mir_a2t_cp(info.c_str(), CP_UTF8);
+ wchar_t *rawTitle = mir_a2u_cp(title.c_str(), CP_UTF8);
+ wchar_t *rawInfo = mir_a2u_cp(info.c_str(), CP_UTF8);
NotifyEvent(rawTitle, rawInfo, contact, flags, url);
mir_free(rawTitle);
mir_free(rawInfo);
@@ -415,8 +415,8 @@ void WhatsAppProto::NotifyEvent(const wchar_t *title, const wchar_t *info, MCONT pd.lchIcon = IcoLib_GetIconByHandle(m_hProtoIcon); // TODO: Icon test
pd.PluginData = szUrl;
pd.PluginWindowProc = PopupDlgProc;
- mir_tstrcpy(pd.lptzContactName, title);
- mir_tstrcpy(pd.lptzText, info);
+ mir_wstrcpy(pd.lptzContactName, title);
+ mir_wstrcpy(pd.lptzText, info);
ret = PUAddPopupT(&pd);
if (ret == 0)
diff --git a/protocols/WhatsApp/src/proto.h b/protocols/WhatsApp/src/proto.h index 04a557f893..f885369ddf 100644 --- a/protocols/WhatsApp/src/proto.h +++ b/protocols/WhatsApp/src/proto.h @@ -14,7 +14,7 @@ struct WAChatInfo }
map<std::string, std::wstring> m_unsentMsgs;
- ptrT tszJid, tszNick, tszOwner;
+ ptrW tszJid, tszNick, tszOwner;
bool bActive;
MCONTACT hContact;
@@ -93,7 +93,7 @@ public: std::vector<string> m_szInviteJids;
map<std::string, WAChatInfo*> m_chats;
mir_cs m_csChats;
- ptrT m_tszDefaultGroup;
+ ptrW m_tszDefaultGroup;
void ChatLogMenuHook(WAChatInfo *pInfo, GCHOOK *gch);
void NickListMenuHook(WAChatInfo *pInfo, GCHOOK *gch);
diff --git a/protocols/WhatsApp/src/utils.cpp b/protocols/WhatsApp/src/utils.cpp index 71a33dc2fd..c131dda0f8 100644 --- a/protocols/WhatsApp/src/utils.cpp +++ b/protocols/WhatsApp/src/utils.cpp @@ -18,8 +18,8 @@ void utils::copyText(HWND hwnd, const wchar_t *text) return;
EmptyClipboard();
- HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t)*(mir_tstrlen(text) + 1));
- mir_tstrcpy((wchar_t*)GlobalLock(hMem), text);
+ HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t)*(mir_wstrlen(text) + 1));
+ mir_wstrcpy((wchar_t*)GlobalLock(hMem), text);
GlobalUnlock(hMem);
SetClipboardData(CF_UNICODETEXT, hMem);
CloseClipboard();
diff --git a/protocols/WhatsApp/src/utils.h b/protocols/WhatsApp/src/utils.h index 333860c1dd..eddd9fab45 100644 --- a/protocols/WhatsApp/src/utils.h +++ b/protocols/WhatsApp/src/utils.h @@ -28,7 +28,7 @@ public: std::string getLastErrorMsg();
__forceinline wchar_t* str2t(const std::string &str)
-{ return mir_utf8decodeT(str.c_str());
+{ return mir_utf8decodeW(str.c_str());
}
std::vector<std::string> split(const std::string &s, char delim);
diff --git a/protocols/Yahoo/src/avatar.cpp b/protocols/Yahoo/src/avatar.cpp index 34f68acc0a..93dbff7f38 100644 --- a/protocols/Yahoo/src/avatar.cpp +++ b/protocols/Yahoo/src/avatar.cpp @@ -596,17 +596,17 @@ void CYahooProto::request_avatar(const char* who) void CYahooProto::GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, int cbLen, int type)
{
- int tPathLen = mir_sntprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
+ int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
if (_waccess(pszDest, 0))
CreateDirectoryTreeT(pszDest);
if (hContact != NULL) {
int ck_sum = getDword(hContact, "PictCK", 0);
- tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%lX", ck_sum);
+ tPathLen += mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%lX", ck_sum);
}
else
- tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%S avatar", m_szModuleName);
+ tPathLen += mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%S avatar", m_szModuleName);
wcsncpy_s((pszDest + tPathLen), (cbLen - tPathLen), (type == 1 ? L".swf" : L".png"), _TRUNCATE);
}
@@ -750,7 +750,7 @@ INT_PTR __cdecl CYahooProto::GetMyAvatar(WPARAM wParam, LPARAM lParam) if (getDword("AvatarHash", 0)) {
if (!getTString("AvatarFile", &dbv)) {
if (_waccess(dbv.ptszVal, 0) == 0) {
- mir_tstrncpy(buffer, dbv.ptszVal, size - 1);
+ mir_wstrncpy(buffer, dbv.ptszVal, size - 1);
buffer[size - 1] = '\0';
ret = 0;
diff --git a/protocols/Yahoo/src/chat.cpp b/protocols/Yahoo/src/chat.cpp index ce59ae92f6..486286857d 100644 --- a/protocols/Yahoo/src/chat.cpp +++ b/protocols/Yahoo/src/chat.cpp @@ -41,7 +41,7 @@ struct InviteChatReqParam CYahooProto* ppro;
InviteChatReqParam(const char* room, const char* who, const char* msg, CYahooProto* ppro)
- : room(mir_strdup(room)), who(mir_strdup(who)), msg(mir_utf8decodeT(msg)), ppro(ppro) {}
+ : room(mir_strdup(room)), who(mir_strdup(who)), msg(mir_utf8decodeW(msg)), ppro(ppro) {}
~InviteChatReqParam()
{ mir_free(room); mir_free(who); mir_free(msg); }
@@ -52,9 +52,9 @@ INT_PTR CALLBACK InviteToChatDialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA void ext_yahoo_conf_userdecline(int id, const char*, const char *who, const char *room, const char *msg)
{
wchar_t info[1024];
- wchar_t *whot = mir_utf8decodeT(who);
- wchar_t *msgt = mir_utf8decodeT(msg);
- mir_sntprintf(info, TranslateT("%s denied invitation with message: %s"), whot, msgt ? msgt : L"");
+ wchar_t *whot = mir_utf8decodeW(who);
+ wchar_t *msgt = mir_utf8decodeW(msg);
+ mir_snwprintf(info, TranslateT("%s denied invitation with message: %s"), whot, msgt ? msgt : L"");
GETPROTOBYID(id)->ChatEvent(room, who, GC_EVENT_INFORMATION, info);
mir_free(msgt);
mir_free(whot);
@@ -98,7 +98,7 @@ void ext_yahoo_conf_userleave(int id, const char*, const char *who, const char * void ext_yahoo_conf_message(int id, const char*, const char *who, const char *room, const char *msg, int utf8)
{
- wchar_t *msgt = utf8 ? mir_utf8decodeT(msg) : mir_a2t(msg);
+ wchar_t *msgt = utf8 ? mir_utf8decodeW(msg) : mir_a2u(msg);
GETPROTOBYID(id)->ChatEvent(room, who, GC_EVENT_MESSAGE, msgt);
mir_free(msgt);
}
@@ -150,7 +150,7 @@ void CYahooProto::ChatRegister(void) void CYahooProto::ChatStart(const char* room)
{
- wchar_t* idt = mir_a2t(room);
+ wchar_t* idt = mir_a2u(room);
GCSESSION gcw = { sizeof(gcw) };
gcw.iType = GCW_CHATROOM;
@@ -178,7 +178,7 @@ void CYahooProto::ChatStart(const char* room) void CYahooProto::ChatLeave(const char* room)
{
- wchar_t* idt = mir_a2t(room);
+ wchar_t* idt = mir_a2u(room);
GCDEST gcd = { m_szModuleName, idt, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
@@ -197,8 +197,8 @@ void CYahooProto::ChatLeaveAll(void) void CYahooProto::ChatEvent(const char* room, const char* who, int evt, const wchar_t* msg)
{
- wchar_t* idt = mir_a2t(room);
- wchar_t* snt = mir_a2t(who);
+ wchar_t* idt = mir_a2u(room);
+ wchar_t* snt = mir_a2u(who);
MCONTACT hContact = getbuddyH(who);
wchar_t* nick = hContact ? (wchar_t*)pcli->pfnGetContactDisplayName(WPARAM(hContact), 0) : snt;
@@ -225,8 +225,8 @@ int __cdecl CYahooProto::OnGCEventHook(WPARAM, LPARAM lParam) if (mir_strcmp(gch->pDest->pszModule, m_szModuleName)) return 0;
- char *room = mir_t2a(gch->pDest->ptszID);
- char *who = mir_t2a(gch->ptszUID);
+ char *room = mir_u2a(gch->pDest->ptszID);
+ char *who = mir_u2a(gch->ptszUID);
switch (gch->pDest->iType) {
case GC_SESSION_TERMINATE:
@@ -310,7 +310,7 @@ int __cdecl CYahooProto::OnGCMenuHook(WPARAM, LPARAM lParam) gcmi->Item = (gc_item*)Items;
}
else if (gcmi->Type == MENU_ON_NICKLIST) {
- char* id = mir_t2a(gcmi->pszUID);
+ char* id = mir_u2a(gcmi->pszUID);
if (!_stricmp(m_yahoo_id, id)) {
static const gc_item Items[] =
{
@@ -359,7 +359,7 @@ static void clist_chat_invite_send(MCONTACT hItem, HWND hwndList, YList* &who, c wchar_t buf[128] = L"";
SendMessage(hwndList, CLM_GETITEMTEXT, (WPARAM)hItem, (LPARAM)buf);
- who = y_list_append(who, mir_t2a(buf));
+ who = y_list_append(who, mir_u2a(buf));
}
else {
DBVARIANT dbv;
diff --git a/protocols/Yahoo/src/file_transfer.cpp b/protocols/Yahoo/src/file_transfer.cpp index c0620894dd..50156ddd5d 100644 --- a/protocols/Yahoo/src/file_transfer.cpp +++ b/protocols/Yahoo/src/file_transfer.cpp @@ -60,7 +60,7 @@ static y_filetransfer* new_ft(CYahooProto* ppro, int id, MCONTACT hContact, cons for (YList *l = fs; l; l = l->next) {
yahoo_file_info *fi = (yahoo_file_info*)l->data;
- ft->pfts.ptszFiles[i++] = mir_utf8decodeT(fi->filename);
+ ft->pfts.ptszFiles[i++] = mir_utf8decodeW(fi->filename);
ft->pfts.totalBytes += fi->filesize;
}
@@ -297,7 +297,7 @@ static void dl_file(int id, INT_PTR fd, int error, const char*, unsigned long si *
* Don't rely on workingDir to be right, since it's not used to check if file exists.
*/
- mir_sntprintf(filefull, L"%s\\%s", sf->pfts.tszWorkingDir, sf->pfts.tszCurrentFile);
+ mir_snwprintf(filefull, L"%s\\%s", sf->pfts.tszWorkingDir, sf->pfts.tszCurrentFile);
FREE(sf->pfts.tszCurrentFile);
sf->pfts.tszCurrentFile = wcsdup(filefull);
@@ -721,7 +721,7 @@ HANDLE __cdecl CYahooProto::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t* //LOG(LOG_INFO, "[%s] Requesting file from %s", ft->cookie, ft->user);
ft->pfts.tszWorkingDir = wcsdup(szPath);
- size_t len = mir_tstrlen(ft->pfts.tszWorkingDir) - 1;
+ size_t len = mir_wstrlen(ft->pfts.tszWorkingDir) - 1;
if (ft->pfts.tszWorkingDir[len] == '\\')
ft->pfts.tszWorkingDir[len] = 0;
diff --git a/protocols/Yahoo/src/links.cpp b/protocols/Yahoo/src/links.cpp index c42f3ce9ad..1eaeadaf44 100644 --- a/protocols/Yahoo/src/links.cpp +++ b/protocols/Yahoo/src/links.cpp @@ -63,7 +63,7 @@ static char* get_buddy(wchar_t ** arg) *arg = tok ? tok + 1 : NULL;
- return mir_t2a(buf);
+ return mir_u2a(buf);
}
diff --git a/protocols/Yahoo/src/main.cpp b/protocols/Yahoo/src/main.cpp index 87d254bace..f7c04b8097 100644 --- a/protocols/Yahoo/src/main.cpp +++ b/protocols/Yahoo/src/main.cpp @@ -72,7 +72,7 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE hinst, DWORD /*fdwReason*/, LPVOID /*lp static int CompareProtos(const CYahooProto* p1, const CYahooProto* p2)
{
- return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName);
+ return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName);
}
LIST<CYahooProto> g_instances(1, CompareProtos);
diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index a2610c5f7b..56ad2d559e 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -67,7 +67,7 @@ int CYahooProto::OnModulesLoadedEx(WPARAM, LPARAM) HookProtoEvent(ME_CLIST_PREBUILDCONTACTMENU, &CYahooProto::OnPrebuildContactMenu);
wchar_t tModuleDescr[100];
- mir_sntprintf(tModuleDescr, TranslateT("%s plugin connections"), m_tszUserName);
+ mir_snwprintf(tModuleDescr, TranslateT("%s plugin connections"), m_tszUserName);
NETLIBUSER nlu = { 0 };
nlu.cbSize = sizeof(nlu);
@@ -541,7 +541,7 @@ HANDLE __cdecl CYahooProto::GetAwayMsg(MCONTACT hContact) int __cdecl CYahooProto::SetAwayMsg(int status, const wchar_t* msg)
{
- char *c = msg && msg[0] ? mir_utf8encodeT(msg) : NULL;
+ char *c = msg && msg[0] ? mir_utf8encodeW(msg) : NULL;
debugLogA("[YahooSetAwayMessage] Status: %S, Msg: %s", pcli->pfnGetStatusModeDescription(status, 0), (char*)c);
diff --git a/protocols/Yahoo/src/search.cpp b/protocols/Yahoo/src/search.cpp index d08a08df66..5b0427d2a4 100644 --- a/protocols/Yahoo/src/search.cpp +++ b/protocols/Yahoo/src/search.cpp @@ -24,7 +24,7 @@ void __cdecl CYahooProto::search_simplethread(void *snsearch) {
wchar_t *id = (wchar_t *)snsearch;
- if (mir_tstrlen(id) < 4) {
+ if (mir_wstrlen(id) < 4) {
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
MessageBoxA(NULL, "Please enter a valid ID to search for.", "Search", MB_OK);
return;
@@ -161,7 +161,7 @@ void __cdecl CYahooProto::searchadv_thread(void *pHWND) wchar_t searchid[128];
GetDlgItemText(hwndDlg, IDC_SEARCH_ID, searchid, _countof(searchid));
- if (mir_tstrlen(searchid) == 0) {
+ if (mir_wstrlen(searchid) == 0) {
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
MessageBoxA(NULL, "Please enter a valid ID to search for.", "Search", MB_OK);
return;
diff --git a/protocols/Yahoo/src/util.cpp b/protocols/Yahoo/src/util.cpp index 44584763b6..4e792b6162 100644 --- a/protocols/Yahoo/src/util.cpp +++ b/protocols/Yahoo/src/util.cpp @@ -112,8 +112,8 @@ int CYahooProto::ShowPopup(const wchar_t* nickname, const wchar_t* msg, const ch POPUPDATAT ppd = { 0 };
ppd.PluginWindowProc = PopupWindowProc;
- mir_tstrncpy(ppd.lptzContactName, nickname, _countof(ppd.lptzContactName));
- mir_tstrncpy(ppd.lptzText, msg, _countof(ppd.lptzText));
+ mir_wstrncpy(ppd.lptzContactName, nickname, _countof(ppd.lptzContactName));
+ mir_wstrncpy(ppd.lptzText, msg, _countof(ppd.lptzText));
if (szURL != NULL) {
ppd.lchIcon = LoadIconEx(!mir_strcmpi(szURL, "http://mail.yahoo.com") ? "mail" : "calendar");
diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp index b9aca199e2..ec97c1c3f1 100644 --- a/protocols/Yahoo/src/yahoo.cpp +++ b/protocols/Yahoo/src/yahoo.cpp @@ -217,8 +217,8 @@ void CYahooProto::AddBuddy(MCONTACT hContact, const char *group, const wchar_t * T2Utf u_msg(msg);
ptrA ident(getStringA(hContact, "MyIdentity"));
- ptrT fname(getTStringA(NULL, "FirstName"));
- ptrT lname(getTStringA(NULL, "LastName"));
+ ptrW fname(getTStringA(NULL, "FirstName"));
+ ptrW lname(getTStringA(NULL, "LastName"));
SetStringUtf(hContact, "YGroup", group);
@@ -529,7 +529,7 @@ void CYahooProto::ext_got_calendar(const char *url, int type, const char *msg, i {
LOG(("[ext_got_calendar] URL:%s type: %d msg: %s svc: %d", url, type, msg, svc));
- ptrT tszMsg(mir_utf8decodeT(msg));
+ ptrW tszMsg(mir_utf8decodeW(msg));
if (!ShowPopup(TranslateT("Calendar Reminder"), tszMsg, url))
ShowNotification(TranslateT("Calendar Reminder"), tszMsg, NIIF_INFO);
}
@@ -672,11 +672,11 @@ void CYahooProto::ext_rejected(const char *who, const char *msg) }
else LOG(("[ext_rejected] Buddy not on our buddy list"));
- ptrT tszWho(mir_utf8decodeT(who));
- ptrT tszMsg(mir_utf8decodeT(msg));
+ ptrW tszWho(mir_utf8decodeW(who));
+ ptrW tszMsg(mir_utf8decodeW(msg));
wchar_t buff[1024];
- mir_sntprintf(buff, TranslateT("%s has rejected your request and sent the following message:"), (wchar_t*)tszWho);
+ mir_snwprintf(buff, TranslateT("%s has rejected your request and sent the following message:"), (wchar_t*)tszWho);
MessageBox(NULL, tszMsg, buff, MB_OK | MB_ICONINFORMATION);
}
@@ -926,15 +926,15 @@ void CYahooProto::ext_mail_notify(const char *from, const char *subj, int cnt) wchar_t z[MAX_SECONDLINE], title[MAX_CONTACTNAME];
if (from == NULL) {
- mir_sntprintf(title, L"%s: %s", m_tszUserName, TranslateT("New Mail"));
- mir_sntprintf(z, TranslateT("You have %i unread messages"), cnt);
+ mir_snwprintf(title, L"%s: %s", m_tszUserName, TranslateT("New Mail"));
+ mir_snwprintf(z, TranslateT("You have %i unread messages"), cnt);
}
else {
- mir_sntprintf(title, TranslateT("New Mail (%i messages)"), cnt);
+ mir_snwprintf(title, TranslateT("New Mail (%i messages)"), cnt);
- ptrT tszFrom(mir_utf8decodeT(from));
- ptrT tszSubj(mir_utf8decodeT(subj));
- mir_sntprintf(z, TranslateT("From: %s\nSubject: %s"), (wchar_t*)tszFrom, (wchar_t*)tszSubj);
+ ptrW tszFrom(mir_utf8decodeW(from));
+ ptrW tszSubj(mir_utf8decodeW(subj));
+ mir_snwprintf(z, TranslateT("From: %s\nSubject: %s"), (wchar_t*)tszFrom, (wchar_t*)tszSubj);
}
if (!ShowPopup(title, z, "http://mail.yahoo.com"))
@@ -950,8 +950,8 @@ void CYahooProto::ext_system_message(const char *me, const char *who, const char {
LOG(("[ext_system_message] System Message to: %s from: %s msg: %s", me, who, msg));
- ptrT tszWho(mir_utf8decodeT(who));
- ptrT tszMsg(mir_utf8decodeT(msg));
+ ptrW tszWho(mir_utf8decodeW(who));
+ ptrW tszMsg(mir_utf8decodeW(msg));
ShowPopup((who != NULL) ? tszWho : TranslateT("Yahoo System Message"), tszMsg, NULL);
}
@@ -1010,7 +1010,7 @@ void CYahooProto::ext_got_ping(const char *errormsg) if (errormsg) {
LOG(("[ext_got_ping] Error msg: %s", errormsg));
- ptrT tszMsg(mir_utf8decodeT(errormsg));
+ ptrW tszMsg(mir_utf8decodeW(errormsg));
ShowError(TranslateT("Yahoo Ping Error"), tszMsg);
return;
}
@@ -1065,33 +1065,33 @@ void CYahooProto::ext_login_response(int succ, const char *url) }
if (succ == YAHOO_LOGIN_UNAME) {
- mir_sntprintf(buff, TranslateT("Could not log into Yahoo service - username not recognized. Please verify that your username is correctly typed."));
+ mir_snwprintf(buff, TranslateT("Could not log into Yahoo service - username not recognized. Please verify that your username is correctly typed."));
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_BADUSERID);
}
else if (succ == YAHOO_LOGIN_PASSWD) {
- mir_sntprintf(buff, TranslateT("Could not log into Yahoo service - password incorrect. Please verify that your username and password are correctly typed."));
+ mir_snwprintf(buff, TranslateT("Could not log into Yahoo service - password incorrect. Please verify that your username and password are correctly typed."));
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPASSWORD);
}
else if (succ == YAHOO_LOGIN_LOCK) {
- mir_sntprintf(buff, TranslateT("Could not log into Yahoo service. Your account has been locked.\nVisit %s to reactivate it."), _A2T(url));
+ mir_snwprintf(buff, TranslateT("Could not log into Yahoo service. Your account has been locked.\nVisit %s to reactivate it."), _A2T(url));
}
else if (succ == YAHOO_LOGIN_DUPL) {
- mir_sntprintf(buff, TranslateT("You have been logged out of the Yahoo service, possibly due to a duplicate login."));
+ mir_snwprintf(buff, TranslateT("You have been logged out of the Yahoo service, possibly due to a duplicate login."));
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_OTHERLOCATION);
}
else if (succ == YAHOO_LOGIN_LOGOFF) {
- //mir_sntprintf(buff, TranslateT("You have been logged out of the Yahoo service."));
+ //mir_snwprintf(buff, TranslateT("You have been logged out of the Yahoo service."));
//ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_OTHERLOCATION);
return; // we logged out.. so just sign-off..
}
else if (succ == -1) {
/// Can't Connect or got disconnected.
if (m_iStatus == ID_STATUS_CONNECTING)
- mir_sntprintf(buff, TranslateT("Could not connect to the Yahoo service. Check your server/port and proxy settings."));
+ mir_snwprintf(buff, TranslateT("Could not connect to the Yahoo service. Check your server/port and proxy settings."));
else
return;
}
- else mir_sntprintf(buff, TranslateT("Could not log in, unknown reason: %d."), succ);
+ else mir_snwprintf(buff, TranslateT("Could not log in, unknown reason: %d."), succ);
delSetting(YAHOO_PWTOKEN);
@@ -1110,35 +1110,35 @@ void CYahooProto::ext_login_response(int succ, const char *url) void CYahooProto::ext_error(const char *err, int fatal, int num)
{
- ptrT tszErr(mir_utf8decodeT(err));
+ ptrW tszErr(mir_utf8decodeW(err));
wchar_t buff[1024];
LOG(("[ext_error] Error: fatal: %d, num: %d, err: %s", fatal, num, err));
switch (num) {
case E_UNKNOWN:
- mir_sntprintf(buff, TranslateT("Unknown error %s"), (wchar_t*)tszErr);
+ mir_snwprintf(buff, TranslateT("Unknown error %s"), (wchar_t*)tszErr);
break;
case E_CUSTOM:
- mir_sntprintf(buff, TranslateT("Custom error %s"), (wchar_t*)tszErr);
+ mir_snwprintf(buff, TranslateT("Custom error %s"), (wchar_t*)tszErr);
break;
case E_CONFNOTAVAIL:
- mir_sntprintf(buff, TranslateT("%s is not available for the conference"), (wchar_t*)tszErr);
+ mir_snwprintf(buff, TranslateT("%s is not available for the conference"), (wchar_t*)tszErr);
break;
case E_IGNOREDUP:
- mir_sntprintf(buff, TranslateT("%s is already ignored"), (wchar_t*)tszErr);
+ mir_snwprintf(buff, TranslateT("%s is already ignored"), (wchar_t*)tszErr);
break;
case E_IGNORENONE:
- mir_sntprintf(buff, TranslateT("%s is not in the ignore list"), (wchar_t*)tszErr);
+ mir_snwprintf(buff, TranslateT("%s is not in the ignore list"), (wchar_t*)tszErr);
break;
case E_IGNORECONF:
- mir_sntprintf(buff, TranslateT("%s is in buddy list - cannot ignore"), (wchar_t*)tszErr);
+ mir_snwprintf(buff, TranslateT("%s is in buddy list - cannot ignore"), (wchar_t*)tszErr);
break;
case E_SYSTEM:
- mir_sntprintf(buff, TranslateT("System Error: %s"), (wchar_t*)tszErr);
+ mir_snwprintf(buff, TranslateT("System Error: %s"), (wchar_t*)tszErr);
break;
case E_CONNECTION:
- mir_sntprintf(buff, TranslateT("Server Connection Error: %s"), (wchar_t*)tszErr);
+ mir_snwprintf(buff, TranslateT("Server Connection Error: %s"), (wchar_t*)tszErr);
debugLogA("Error: %S", buff);
return;
}
diff --git a/src/core/stdauth/src/auth.cpp b/src/core/stdauth/src/auth.cpp index 191031062c..1548bb7b5f 100644 --- a/src/core/stdauth/src/auth.cpp +++ b/src/core/stdauth/src/auth.cpp @@ -65,14 +65,14 @@ static int AuthEventAdded(WPARAM, LPARAM lParam) cli.lParam = lParam;
cli.hDbEvent = hDbEvent;
- ptrT szUid(Contact_GetInfo(CNF_UNIQUEID, hContact));
+ ptrW szUid(Contact_GetInfo(CNF_UNIQUEID, hContact));
if (dbei.eventType == EVENTTYPE_AUTHREQUEST) {
SkinPlaySound("AuthRequest");
if (szUid)
- mir_sntprintf(szTooltip, TranslateT("%s requests authorization"), szUid);
+ mir_snwprintf(szTooltip, TranslateT("%s requests authorization"), szUid);
else
- mir_sntprintf(szTooltip, TranslateT("%u requests authorization"), *(PDWORD)dbei.pBlob);
+ mir_snwprintf(szTooltip, TranslateT("%u requests authorization"), *(PDWORD)dbei.pBlob);
cli.hIcon = Skin_LoadIcon(SKINICON_AUTH_REQUEST);
cli.pszService = MS_AUTH_SHOWREQUEST;
@@ -81,9 +81,9 @@ static int AuthEventAdded(WPARAM, LPARAM lParam) else if (dbei.eventType == EVENTTYPE_ADDED) {
SkinPlaySound("AddedEvent");
if (szUid)
- mir_sntprintf(szTooltip, TranslateT("%s added you to their contact list"), szUid);
+ mir_snwprintf(szTooltip, TranslateT("%s added you to their contact list"), szUid);
else
- mir_sntprintf(szTooltip, TranslateT("%u added you to their contact list"), *(PDWORD)dbei.pBlob);
+ mir_snwprintf(szTooltip, TranslateT("%u added you to their contact list"), *(PDWORD)dbei.pBlob);
cli.hIcon = Skin_LoadIcon(SKINICON_AUTH_ADD);
cli.pszService = MS_AUTH_SHOWADDED;
diff --git a/src/core/stdauth/src/authdialogs.cpp b/src/core/stdauth/src/authdialogs.cpp index 86f9db4ec4..fca48a396a 100644 --- a/src/core/stdauth/src/authdialogs.cpp +++ b/src/core/stdauth/src/authdialogs.cpp @@ -55,22 +55,22 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar PROTOACCOUNT* acc = Proto_GetAccount(dbei.szModule);
- wchar_t* lastT = dbei.flags & DBEF_UTF ? Utf8DecodeT(last) : mir_a2t(last);
- wchar_t* firstT = dbei.flags & DBEF_UTF ? Utf8DecodeT(first) : mir_a2t(first);
- wchar_t* nickT = dbei.flags & DBEF_UTF ? Utf8DecodeT(nick) : mir_a2t(nick);
- wchar_t* emailT = dbei.flags & DBEF_UTF ? Utf8DecodeT(email) : mir_a2t(email);
+ wchar_t* lastT = dbei.flags & DBEF_UTF ? Utf8DecodeT(last) : mir_a2u(last);
+ wchar_t* firstT = dbei.flags & DBEF_UTF ? Utf8DecodeT(first) : mir_a2u(first);
+ wchar_t* nickT = dbei.flags & DBEF_UTF ? Utf8DecodeT(nick) : mir_a2u(nick);
+ wchar_t* emailT = dbei.flags & DBEF_UTF ? Utf8DecodeT(email) : mir_a2u(email);
wchar_t name[128] = L"";
int off = 0;
if (firstT[0] && lastT[0])
- off = mir_sntprintf(name, L"%s %s", firstT, lastT);
+ off = mir_snwprintf(name, L"%s %s", firstT, lastT);
else if (firstT[0])
- off = mir_sntprintf(name, L"%s", firstT);
+ off = mir_snwprintf(name, L"%s", firstT);
else if (lastT[0])
- off = mir_sntprintf(name, L"%s", lastT);
+ off = mir_snwprintf(name, L"%s", lastT);
if (nickT[0]) {
if (off)
- mir_sntprintf(name + off, _countof(name) - off, L" (%s)", nickT);
+ mir_snwprintf(name + off, _countof(name) - off, L" (%s)", nickT);
else
wcsncpy_s(name, nickT, _TRUNCATE);
}
@@ -79,11 +79,11 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar wchar_t hdr[256];
if (uin && emailT[0])
- mir_sntprintf(hdr, TranslateT("%s added you to the contact list\n%u (%s) on %s"), name, uin, emailT, acc->tszAccountName);
+ mir_snwprintf(hdr, TranslateT("%s added you to the contact list\n%u (%s) on %s"), name, uin, emailT, acc->tszAccountName);
else if (uin)
- mir_sntprintf(hdr, TranslateT("%s added you to the contact list\n%u on %s"), name, uin, acc->tszAccountName);
+ mir_snwprintf(hdr, TranslateT("%s added you to the contact list\n%u on %s"), name, uin, acc->tszAccountName);
else
- mir_sntprintf(hdr, TranslateT("%s added you to the contact list\n%s on %s"), name, emailT[0] ? emailT : TranslateT("(Unknown)"), acc->tszAccountName);
+ mir_snwprintf(hdr, TranslateT("%s added you to the contact list\n%s on %s"), name, emailT[0] ? emailT : TranslateT("(Unknown)"), acc->tszAccountName);
SetDlgItemText(hwndDlg, IDC_HEADERBAR, hdr);
@@ -179,23 +179,23 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP PROTOACCOUNT *acc = Proto_GetAccount(dbei.szModule);
- ptrT lastT(dbei.flags & DBEF_UTF ? Utf8DecodeT(last) : mir_a2t(last));
- ptrT firstT(dbei.flags & DBEF_UTF ? Utf8DecodeT(first) : mir_a2t(first));
- ptrT nickT(dbei.flags & DBEF_UTF ? Utf8DecodeT(nick) : mir_a2t(nick));
- ptrT emailT(dbei.flags & DBEF_UTF ? Utf8DecodeT(email) : mir_a2t(email));
- ptrT reasonT(dbei.flags & DBEF_UTF ? Utf8DecodeT(reason) : mir_a2t(reason));
+ ptrW lastT(dbei.flags & DBEF_UTF ? Utf8DecodeT(last) : mir_a2u(last));
+ ptrW firstT(dbei.flags & DBEF_UTF ? Utf8DecodeT(first) : mir_a2u(first));
+ ptrW nickT(dbei.flags & DBEF_UTF ? Utf8DecodeT(nick) : mir_a2u(nick));
+ ptrW emailT(dbei.flags & DBEF_UTF ? Utf8DecodeT(email) : mir_a2u(email));
+ ptrW reasonT(dbei.flags & DBEF_UTF ? Utf8DecodeT(reason) : mir_a2u(reason));
wchar_t name[128] = L"";
int off = 0;
if (firstT[0] && lastT[0])
- off = mir_sntprintf(name, L"%s %s", (wchar_t*)firstT, (wchar_t*)lastT);
+ off = mir_snwprintf(name, L"%s %s", (wchar_t*)firstT, (wchar_t*)lastT);
else if (firstT[0])
- off = mir_sntprintf(name, L"%s", (wchar_t*)firstT);
+ off = mir_snwprintf(name, L"%s", (wchar_t*)firstT);
else if (lastT[0])
- off = mir_sntprintf(name, L"%s", (wchar_t*)lastT);
- if (mir_tstrlen(nickT)) {
+ off = mir_snwprintf(name, L"%s", (wchar_t*)lastT);
+ if (mir_wstrlen(nickT)) {
if (off)
- mir_sntprintf(name + off, _countof(name) - off, L" (%s)", (wchar_t*)nickT);
+ mir_snwprintf(name + off, _countof(name) - off, L" (%s)", (wchar_t*)nickT);
else
wcsncpy_s(name, nickT, _TRUNCATE);
}
@@ -204,11 +204,11 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP wchar_t hdr[256];
if (uin && emailT[0])
- mir_sntprintf(hdr, TranslateT("%s requested authorization\n%u (%s) on %s"), name, uin, (wchar_t*)emailT, acc->tszAccountName);
+ mir_snwprintf(hdr, TranslateT("%s requested authorization\n%u (%s) on %s"), name, uin, (wchar_t*)emailT, acc->tszAccountName);
else if (uin)
- mir_sntprintf(hdr, TranslateT("%s requested authorization\n%u on %s"), name, uin, acc->tszAccountName);
+ mir_snwprintf(hdr, TranslateT("%s requested authorization\n%u on %s"), name, uin, acc->tszAccountName);
else
- mir_sntprintf(hdr, TranslateT("%s requested authorization\n%s on %s"), name, emailT[0] ? (wchar_t*)emailT : TranslateT("(Unknown)"), acc->tszAccountName);
+ mir_snwprintf(hdr, TranslateT("%s requested authorization\n%s on %s"), name, emailT[0] ? (wchar_t*)emailT : TranslateT("(Unknown)"), acc->tszAccountName);
SetDlgItemText(hwndDlg, IDC_HEADERBAR, hdr);
SetDlgItemText(hwndDlg, IDC_REASON, reasonT);
diff --git a/src/core/stdautoaway/src/autoaway.cpp b/src/core/stdautoaway/src/autoaway.cpp index 2a490ba693..9add845204 100644 --- a/src/core/stdautoaway/src/autoaway.cpp +++ b/src/core/stdautoaway/src/autoaway.cpp @@ -38,7 +38,7 @@ static int AutoAwaySound(WPARAM, LPARAM) static void Proto_SetStatus(const char *szProto, unsigned status)
{
if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) {
- ptrT awayMsg((wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGW, status, (LPARAM)szProto));
+ ptrW awayMsg((wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGW, status, (LPARAM)szProto));
CallProtoService(szProto, PS_SETAWAYMSG, status, awayMsg);
}
diff --git a/src/core/stdaway/src/awaymsg.cpp b/src/core/stdaway/src/awaymsg.cpp index b51b6f4d7a..141dfc56c1 100644 --- a/src/core/stdaway/src/awaymsg.cpp +++ b/src/core/stdaway/src/awaymsg.cpp @@ -61,11 +61,11 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP wchar_t *status = pcli->pfnGetStatusModeDescription(dwStatus, 0);
GetWindowText(hwndDlg, format, _countof(format));
- mir_sntprintf(str, format, status, contactName);
+ mir_snwprintf(str, format, status, contactName);
SetWindowText(hwndDlg, str);
GetDlgItemText(hwndDlg, IDC_RETRIEVING, format, _countof(format));
- mir_sntprintf(str, format, status);
+ mir_snwprintf(str, format, status);
SetDlgItemText(hwndDlg, IDC_RETRIEVING, str);
Window_SetProtoIcon_IcoLib(hwndDlg, szProto, dwStatus);
@@ -141,7 +141,7 @@ static int AwayMsgPreBuildMenu(WPARAM hContact, LPARAM) if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGRECV) {
if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(status)) {
wchar_t str[128];
- mir_sntprintf(str, TranslateT("Re&ad %s message"), pcli->pfnGetStatusModeDescription(status, 0));
+ mir_snwprintf(str, TranslateT("Re&ad %s message"), pcli->pfnGetStatusModeDescription(status, 0));
Menu_ModifyItem(hAwayMsgMenuItem, str, Skin_LoadProtoIcon(szProto, status), CMIF_NOTOFFLINE);
return 0;
}
diff --git a/src/core/stdaway/src/sendmsg.cpp b/src/core/stdaway/src/sendmsg.cpp index a3f2968588..409e598a07 100644 --- a/src/core/stdaway/src/sendmsg.cpp +++ b/src/core/stdaway/src/sendmsg.cpp @@ -90,11 +90,11 @@ static wchar_t* GetAwayMessage(int statusMode, char *szProto) DBVARIANT dbv;
if ( GetStatusModeByte(statusMode, "UsePrev")) {
if ( db_get_ts(NULL, "SRAway", StatusModeToDbSetting(statusMode, "Msg"), &dbv))
- dbv.ptszVal = mir_tstrdup(GetDefaultMessage(statusMode));
+ dbv.ptszVal = mir_wstrdup(GetDefaultMessage(statusMode));
}
else {
if ( db_get_ts(NULL, "SRAway", StatusModeToDbSetting(statusMode, "Default"), &dbv))
- dbv.ptszVal = mir_tstrdup(GetDefaultMessage(statusMode));
+ dbv.ptszVal = mir_wstrdup(GetDefaultMessage(statusMode));
for (int i=0; dbv.ptszVal[i]; i++) {
if (dbv.ptszVal[i] != '%')
@@ -121,10 +121,10 @@ static wchar_t* GetAwayMessage(int statusMode, char *szProto) GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, substituteStr, _countof(substituteStr));
else continue;
- if (mir_tstrlen(substituteStr) > 6)
- dbv.ptszVal = (wchar_t*)mir_realloc(dbv.ptszVal, (mir_tstrlen(dbv.ptszVal) + 1 + mir_tstrlen(substituteStr) - 6) * sizeof(wchar_t));
- memmove(dbv.ptszVal + i + mir_tstrlen(substituteStr), dbv.ptszVal + i + 6, (mir_tstrlen(dbv.ptszVal) - i - 5) * sizeof(wchar_t));
- memcpy(dbv.ptszVal+i, substituteStr, mir_tstrlen(substituteStr) * sizeof(wchar_t));
+ if (mir_wstrlen(substituteStr) > 6)
+ dbv.ptszVal = (wchar_t*)mir_realloc(dbv.ptszVal, (mir_wstrlen(dbv.ptszVal) + 1 + mir_wstrlen(substituteStr) - 6) * sizeof(wchar_t));
+ memmove(dbv.ptszVal + i + mir_wstrlen(substituteStr), dbv.ptszVal + i + 6, (mir_wstrlen(dbv.ptszVal) - i - 5) * sizeof(wchar_t));
+ memcpy(dbv.ptszVal+i, substituteStr, mir_wstrlen(substituteStr) * sizeof(wchar_t));
}
}
return dbv.ptszVal;
@@ -226,7 +226,7 @@ static INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wPa {
wchar_t str[256], format[128];
GetWindowText(hwndDlg, format, _countof(format));
- mir_sntprintf(str, format, pcli->pfnGetStatusModeDescription(dat->statusMode, 0));
+ mir_snwprintf(str, format, pcli->pfnGetStatusModeDescription(dat->statusMode, 0));
SetWindowText(hwndDlg, str);
}
GetDlgItemText(hwndDlg, IDOK, dat->okButtonFormat, _countof(dat->okButtonFormat));
@@ -247,7 +247,7 @@ static INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wPa case WM_TIMER:
if (--dat->countdown >= 0) {
wchar_t str[64];
- mir_sntprintf(str, dat->okButtonFormat, dat->countdown);
+ mir_snwprintf(str, dat->okButtonFormat, dat->countdown);
SetDlgItemText(hwndDlg, IDOK, str);
}
else {
@@ -397,8 +397,8 @@ static INT_PTR CALLBACK DlgProcAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam DBVARIANT dbv;
if (db_get_ts(NULL, "SRAway", StatusModeToDbSetting(statusModes[i], "Default"), &dbv))
if (db_get_ts(NULL, "SRAway", StatusModeToDbSetting(statusModes[i], "Msg"), &dbv))
- dbv.ptszVal = mir_tstrdup(GetDefaultMessage(statusModes[i]));
- mir_tstrcpy(dat->info[j].msg, dbv.ptszVal);
+ dbv.ptszVal = mir_wstrdup(GetDefaultMessage(statusModes[i]));
+ mir_wstrcpy(dat->info[j].msg, dbv.ptszVal);
mir_free(dbv.ptszVal);
}
if (hLst)
diff --git a/src/core/stdchat/src/manager.cpp b/src/core/stdchat/src/manager.cpp index bc901042e8..069e2230a9 100644 --- a/src/core/stdchat/src/manager.cpp +++ b/src/core/stdchat/src/manager.cpp @@ -86,7 +86,7 @@ BOOL TabM_AddTab(const wchar_t *pszID, const char* pszModule) node = (TABLIST*)mir_alloc(sizeof(TABLIST));
memset(node, 0, sizeof(TABLIST));
- node->pszID = mir_tstrdup(pszID);
+ node->pszID = mir_wstrdup(pszID);
node->pszModule = mir_strdup(pszModule);
if (g_TabList == NULL) { // list is empty
diff --git a/src/core/stdchat/src/options.cpp b/src/core/stdchat/src/options.cpp index 5ce45f72ce..79ea5fc3d2 100644 --- a/src/core/stdchat/src/options.cpp +++ b/src/core/stdchat/src/options.cpp @@ -324,10 +324,10 @@ static void InitSetting(wchar_t** ppPointer, char* pszSetting, wchar_t* pszDefau {
DBVARIANT dbv;
if (!db_get_ts(NULL, CHAT_MODULE, pszSetting, &dbv)) {
- replaceStrT(*ppPointer, dbv.ptszVal);
+ replaceStrW(*ppPointer, dbv.ptszVal);
db_free(&dbv);
}
- else replaceStrT(*ppPointer, pszDefault);
+ else replaceStrW(*ppPointer, pszDefault);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -542,9 +542,9 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPITEMIDLIST idList = SHBrowseForFolder(&bi);
if (idList) {
SHGetPathFromIDList(idList, szDirectory);
- mir_tstrcat(szDirectory, L"\\");
+ mir_wstrcat(szDirectory, L"\\");
PathToRelativeT(szDirectory, szTemp);
- SetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, mir_tstrlen(szTemp) > 1 ? szTemp : L"Logs\\");
+ SetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, mir_wstrlen(szTemp) > 1 ? szTemp : L"Logs\\");
CoTaskMemFree(idList);
}
}
diff --git a/src/core/stdchat/src/tools.cpp b/src/core/stdchat/src/tools.cpp index 12731649f2..3568f75caf 100644 --- a/src/core/stdchat/src/tools.cpp +++ b/src/core/stdchat/src/tools.cpp @@ -51,9 +51,9 @@ bool LoadMessageFont(LOGFONT *lf, COLORREF *colour) DBVARIANT dbv;
if (db_get_ts(NULL, "SRMM", str, &dbv))
- mir_tstrcpy(lf->lfFaceName, L"Arial");
+ mir_wstrcpy(lf->lfFaceName, L"Arial");
else {
- mir_tstrncpy(lf->lfFaceName, dbv.ptszVal, _countof(lf->lfFaceName));
+ mir_wstrncpy(lf->lfFaceName, dbv.ptszVal, _countof(lf->lfFaceName));
db_free(&dbv);
}
mir_snprintf(str, "SRMFont%dSet", i);
@@ -135,7 +135,7 @@ UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO if (pszWordText && pszWordText[0]) {
wchar_t szMenuText[4096];
- mir_sntprintf(szMenuText, TranslateT("Look up '%s':"), pszWordText);
+ mir_snwprintf(szMenuText, TranslateT("Look up '%s':"), pszWordText);
ModifyMenu(*hMenu, 4, MF_STRING | MF_BYPOSITION, 4, szMenuText);
}
else ModifyMenu(*hMenu, 4, MF_STRING | MF_GRAYED | MF_BYPOSITION, 4, TranslateT("No word to look up"));
@@ -144,12 +144,12 @@ UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO else if (iIndex == 0) {
wchar_t szTemp[50];
if (pszWordText)
- mir_sntprintf(szTemp, TranslateT("&Message %s"), pszWordText);
+ mir_snwprintf(szTemp, TranslateT("&Message %s"), pszWordText);
else
- mir_tstrncpy(szTemp, TranslateT("&Message"), _countof(szTemp) - 1);
+ mir_wstrncpy(szTemp, TranslateT("&Message"), _countof(szTemp) - 1);
- if (mir_tstrlen(szTemp) > 40)
- mir_tstrcpy(szTemp + 40, L"...");
+ if (mir_wstrlen(szTemp) > 40)
+ mir_wstrcpy(szTemp + 40, L"...");
ModifyMenu(*hMenu, ID_MESS, MF_STRING | MF_BYCOMMAND, ID_MESS, szTemp);
gcmi.Type = MENU_ON_NICKLIST;
}
diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp index bf71ea9f90..b6b54681b8 100644 --- a/src/core/stdchat/src/window.cpp +++ b/src/core/stdchat/src/window.cpp @@ -390,10 +390,10 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, end++;
if (dat->szTabSave[0] == '\0')
- mir_tstrncpy(dat->szTabSave, pszText + start, end - start + 1);
+ mir_wstrncpy(dat->szTabSave, pszText + start, end - start + 1);
wchar_t *pszSelName = (wchar_t *)mir_alloc(sizeof(wchar_t)*(end - start + 1));
- mir_tstrncpy(pszSelName, pszText + start, end - start + 1);
+ mir_wstrncpy(pszSelName, pszText + start, end - start + 1);
wchar_t *pszName = pci->UM_FindUserAutoComplete(Parentsi->pUsers, dat->szTabSave, pszSelName);
if (pszName == NULL) {
@@ -996,7 +996,7 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, SESSION_INFO *si }
if (tszBuf[0] == 0)
- mir_sntprintf(tszBuf, L"%s: %s\r\n%s: %s\r\n%s: %s",
+ mir_snwprintf(tszBuf, L"%s: %s\r\n%s: %s\r\n%s: %s",
TranslateT("Nickname"), ui->pszNick,
TranslateT("Unique ID"), ui->pszUID,
TranslateT("Status"), pci->TM_WordToString(si->pStatuses, ui->Status));
@@ -1314,17 +1314,17 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar wchar_t szTemp[100];
switch (si->iType) {
case GCW_CHATROOM:
- mir_sntprintf(szTemp,
+ mir_snwprintf(szTemp,
(si->nUsersInNicklist == 1) ? TranslateT("%s: chat room (%u user)") : TranslateT("%s: chat room (%u users)"),
si->ptszName, si->nUsersInNicklist);
break;
case GCW_PRIVMESS:
- mir_sntprintf(szTemp,
+ mir_snwprintf(szTemp,
(si->nUsersInNicklist == 1) ? TranslateT("%s: message session") : TranslateT("%s: message session (%u users)"),
si->ptszName, si->nUsersInNicklist);
break;
case GCW_SERVER:
- mir_sntprintf(szTemp, L"%s: Server", si->ptszName);
+ mir_snwprintf(szTemp, L"%s: Server", si->ptszName);
break;
}
SetWindowText(hwndDlg, szTemp);
@@ -1605,9 +1605,9 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar int insertat;
wchar_t szTemp[30];
- mir_tstrncpy(szTemp, s1->ptszName, 21);
- if (mir_tstrlen(s1->ptszName) > 20)
- mir_tstrncpy(szTemp + 20, L"...", 4);
+ mir_wstrncpy(szTemp, s1->ptszName, 21);
+ if (mir_wstrlen(s1->ptszName) > 20)
+ mir_wstrncpy(szTemp + 20, L"...", 4);
tci.mask = TCIF_TEXT | TCIF_PARAM;
tci.pszText = szTemp;
@@ -1863,11 +1863,11 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar }
SetTextColor(dis->hDC, ui->iStatusEx == 0 ? g_Settings.crUserListColor : g_Settings.crUserListHeadingsColor);
- TextOut(dis->hDC, dis->rcItem.left + x_offset, dis->rcItem.top, ui->pszNick, (int)mir_tstrlen(ui->pszNick));
+ TextOut(dis->hDC, dis->rcItem.left + x_offset, dis->rcItem.top, ui->pszNick, (int)mir_wstrlen(ui->pszNick));
SelectObject(dis->hDC, hOldFont);
if (si->pAccPropServicesForNickList) {
- wchar_t *nick = mir_t2u(ui->pszNick);
+ wchar_t *nick = mir_wstrdup(ui->pszNick);
si->pAccPropServicesForNickList->SetHwndPropStr(GetDlgItem(hwndDlg, IDC_LIST), OBJID_CLIENT, dis->itemID + 1, PROPID_ACC_NAME, nick);
mir_free(nick);
}
@@ -2199,7 +2199,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar tr.lpstrText = pszWord;
long iRes = SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETTEXTRANGE, 0, (LPARAM)&tr);
if (iRes > 0)
- for (size_t iLen = mir_tstrlen(pszWord) - 1; wcschr(szTrimString, pszWord[iLen]); iLen--)
+ for (size_t iLen = mir_wstrlen(pszWord) - 1; wcschr(szTrimString, pszWord[iLen]); iLen--)
pszWord[iLen] = 0;
}
@@ -2298,8 +2298,8 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (!OpenClipboard(hwndDlg))
break;
EmptyClipboard();
- hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t)*(mir_tstrlen(tr.lpstrText) + 1));
- mir_tstrcpy((wchar_t*)GlobalLock(hData), tr.lpstrText);
+ hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t)*(mir_wstrlen(tr.lpstrText) + 1));
+ mir_wstrcpy((wchar_t*)GlobalLock(hData), tr.lpstrText);
GlobalUnlock(hData);
SetClipboardData(CF_UNICODETEXT, hData);
CloseClipboard();
@@ -2331,7 +2331,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar USERINFO *ui = pci->SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, item);
if (ui != NULL) {
static wchar_t ptszBuf[1024];
- mir_sntprintf(ptszBuf, L"%s: %s\r\n%s: %s\r\n%s: %s",
+ mir_snwprintf(ptszBuf, L"%s: %s\r\n%s: %s\r\n%s: %s",
TranslateT("Nickname"), ui->pszNick,
TranslateT("Unique ID"), ui->pszUID,
TranslateT("Status"), pci->TM_WordToString(parentdat->pStatuses, ui->Status));
@@ -2356,12 +2356,12 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (GetKeyState(VK_SHIFT) & 0x8000) {
LRESULT lResult = (LRESULT)SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETSEL, 0, 0);
int start = LOWORD(lResult);
- size_t dwNameLenMax = (mir_tstrlen(ui->pszUID) + 3);
+ size_t dwNameLenMax = (mir_wstrlen(ui->pszUID) + 3);
wchar_t* pszName = (wchar_t*)alloca(sizeof(wchar_t) * dwNameLenMax);
if (start == 0)
- mir_sntprintf(pszName, dwNameLenMax, L"%s: ", ui->pszUID);
+ mir_snwprintf(pszName, dwNameLenMax, L"%s: ", ui->pszUID);
else
- mir_sntprintf(pszName, dwNameLenMax, L"%s ", ui->pszUID);
+ mir_snwprintf(pszName, dwNameLenMax, L"%s ", ui->pszUID);
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)pszName);
PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
@@ -2388,7 +2388,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar pci->SM_AddCommand(si->ptszID, si->pszModule, pszRtf);
- CMString ptszText(ptrT(mir_utf8decodeT(pszRtf)));
+ CMString ptszText(ptrW(mir_utf8decodeW(pszRtf)));
pci->DoRtfToTags(ptszText, mi->nColorCount, mi->crColors);
ptszText.Trim();
ptszText.Replace(L"%", L"%%");
@@ -2450,11 +2450,11 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar wcsncpy_s(szName, (pInfo->ptszModDispName ? pInfo->ptszModDispName : _A2T(si->pszModule)), _TRUNCATE);
ValidateFilename(szName);
- mir_sntprintf(szFolder, L"%s\\%s", g_Settings.pszLogDir, szName);
- mir_sntprintf(szName, L"%s.log", si->ptszID);
+ mir_snwprintf(szFolder, L"%s\\%s", g_Settings.pszLogDir, szName);
+ mir_snwprintf(szName, L"%s.log", si->ptszID);
ValidateFilename(szName);
- mir_sntprintf(szFile, L"%s\\%s", szFolder, szName);
+ mir_snwprintf(szFile, L"%s\\%s", szFolder, szName);
ShellExecute(hwndDlg, L"open", szFile, NULL, NULL, SW_SHOW);
}
}
diff --git a/src/core/stdclist/src/clcpaint.cpp b/src/core/stdclist/src/clcpaint.cpp index cb679abd0e..c5f4539e17 100644 --- a/src/core/stdclist/src/clcpaint.cpp +++ b/src/core/stdclist/src/clcpaint.cpp @@ -313,7 +313,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) ChangeToFont(hdcMem, dat, FONTID_OFFLINE, &fontHeight);
else
ChangeToFont(hdcMem, dat, FONTID_CONTACTS, &fontHeight);
- GetTextExtentPoint32(hdcMem, cc->szText, (int)mir_tstrlen(cc->szText), &textSize);
+ GetTextExtentPoint32(hdcMem, cc->szText, (int)mir_wstrlen(cc->szText), &textSize);
width = textSize.cx;
wchar_t *ptszGroupCount = NULL;
@@ -322,7 +322,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) if (*ptszGroupCount) {
GetTextExtentPoint32(hdcMem, L" ", 1, &spaceSize);
ChangeToFont(hdcMem, dat, FONTID_GROUPCOUNTS, &fontHeight);
- GetTextExtentPoint32(hdcMem, ptszGroupCount, (int)mir_tstrlen(ptszGroupCount), &countsSize);
+ GetTextExtentPoint32(hdcMem, ptszGroupCount, (int)mir_wstrlen(ptszGroupCount), &countsSize);
width += spaceSize.cx + countsSize.cx;
}
}
@@ -409,7 +409,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) rc.left = dat->leftMargin + indent * dat->groupIndent;
rc.right = rc.left + ((clRect.right - rc.left - textSize.cx) >> 1) - 3;
DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT);
- TextOut(hdcMem, rc.right + 3, y + ((dat->rowHeight - fontHeight) >> 1), cc->szText, (int)mir_tstrlen(cc->szText));
+ TextOut(hdcMem, rc.right + 3, y + ((dat->rowHeight - fontHeight) >> 1), cc->szText, (int)mir_wstrlen(cc->szText));
rc.left = rc.right + 6 + textSize.cx;
rc.right = clRect.right;
DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT);
@@ -425,16 +425,16 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) if (rc.right < rc.left + 4)
rc.right = clRect.right + 1;
else
- TextOut(hdcMem, rc.right, rc.top + groupCountsFontTopShift, ptszGroupCount, (int)mir_tstrlen(ptszGroupCount));
+ TextOut(hdcMem, rc.right, rc.top + groupCountsFontTopShift, ptszGroupCount, (int)mir_wstrlen(ptszGroupCount));
ChangeToFont(hdcMem, dat, FONTID_GROUPS, &fontHeight);
if (selected)
SetTextColor(hdcMem, dat->selTextColour);
else if (hottrack)
SetHotTrackColour(hdcMem, dat);
rc.right--;
- ExtTextOut(hdcMem, rc.left, rc.top, ETO_CLIPPED, &rc, cc->szText, (int)mir_tstrlen(cc->szText), NULL);
+ ExtTextOut(hdcMem, rc.left, rc.top, ETO_CLIPPED, &rc, cc->szText, (int)mir_wstrlen(cc->szText), NULL);
}
- else TextOut(hdcMem, dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace, y + ((dat->rowHeight - fontHeight) >> 1), cc->szText, (int)mir_tstrlen(cc->szText));
+ else TextOut(hdcMem, dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace, y + ((dat->rowHeight - fontHeight) >> 1), cc->szText, (int)mir_wstrlen(cc->szText));
if (dat->exStyle & CLS_EX_LINEWITHGROUPS) {
rc.top = y + (dat->rowHeight >> 1);
@@ -456,7 +456,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) if (selected) {
if (cc->type != CLCIT_DIVIDER) {
- size_t qlen = mir_tstrlen(dat->szQuickSearch);
+ size_t qlen = mir_wstrlen(dat->szQuickSearch);
SetTextColor(hdcMem, dat->quickSearchColour);
RECT rc;
diff --git a/src/core/stdclist/src/contact.cpp b/src/core/stdclist/src/contact.cpp index 359419faa3..23163d83fc 100644 --- a/src/core/stdclist/src/contact.cpp +++ b/src/core/stdclist/src/contact.cpp @@ -93,5 +93,5 @@ int CompareContacts(const ClcContact* c1, const ClcContact* c2) nameb = pcli->pfnGetContactDisplayName(b, 0);
//otherwise just compare names
- return mir_tstrcmpi(namea, nameb);
+ return mir_wstrcmpi(namea, nameb);
}
diff --git a/src/core/stdcrypt/src/stdcrypt.h b/src/core/stdcrypt/src/stdcrypt.h index 420a0fbcc8..fc96dfbe3d 100644 --- a/src/core/stdcrypt/src/stdcrypt.h +++ b/src/core/stdcrypt/src/stdcrypt.h @@ -52,7 +52,7 @@ struct CStdCrypt : public MICryptoEngine, public MZeroedObject STDMETHODIMP_(BYTE*) encodeString(const char *src, size_t *cbResultLen);
STDMETHODIMP_(BYTE*) encodeBuffer(const void *src, size_t cbLen, size_t *cbResultLen);
- // result must be freed using mir_free or assigned to ptrA/ptrT
+ // result must be freed using mir_free or assigned to ptrA/ptrW
STDMETHODIMP_(char*) decodeString(const BYTE *pBuf, size_t bufLen, size_t *cbResultLen);
STDMETHODIMP_(void*) decodeBuffer(const BYTE *pBuf, size_t bufLen, size_t *cbResultLen);
};
diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp index 1886a29f1a..2d394b6ab0 100644 --- a/src/core/stdfile/src/file.cpp +++ b/src/core/stdfile/src/file.cpp @@ -62,7 +62,7 @@ static INT_PTR SendSpecificFiles(WPARAM hContact, LPARAM lParam) fsd.ppFiles = (const wchar_t**)alloca((count + 1) * sizeof(void*));
for (int i = 0; i < count; i++)
- fsd.ppFiles[i] = mir_a2t(ppFiles[i]);
+ fsd.ppFiles[i] = mir_a2u(ppFiles[i]);
fsd.ppFiles[count] = NULL;
HWND hWnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd);
@@ -83,7 +83,7 @@ static INT_PTR GetReceivedFilesFolder(WPARAM wParam, LPARAM lParam) {
wchar_t buf[MAX_PATH];
GetContactReceivedFilesDir(wParam, buf, MAX_PATH, TRUE);
- char* dir = mir_t2a(buf);
+ char* dir = mir_u2a(buf);
mir_strncpy((char*)lParam, dir, MAX_PATH);
mir_free(dir);
return 0;
@@ -108,7 +108,7 @@ void PushFileEvent(MCONTACT hContact, MEVENT hdbe, LPARAM lParam) SkinPlaySound("RecvFile");
wchar_t szTooltip[256];
- mir_sntprintf(szTooltip, TranslateT("File from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_snwprintf(szTooltip, TranslateT("File from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
cle.ptszTooltip = szTooltip;
cle.flags |= CLEF_TCHAR;
@@ -164,11 +164,11 @@ void GetSensiblyFormattedSize(__int64 size, wchar_t *szOut, int cchOut, int unit *unitsUsed = unitsOverride;
switch (unitsOverride) {
- case UNITS_BYTES: mir_sntprintf(szOut, cchOut, L"%u%s%s", (int)size, appendUnits ? L" " : L"", appendUnits ? TranslateT("bytes") : L""); break;
- case UNITS_KBPOINT1: mir_sntprintf(szOut, cchOut, L"%.1lf%s", size / 1024.0, appendUnits ? L" KB" : L""); break;
- case UNITS_KBPOINT0: mir_sntprintf(szOut, cchOut, L"%u%s", (int)(size / 1024), appendUnits ? L" KB" : L""); break;
- case UNITS_GBPOINT3: mir_sntprintf(szOut, cchOut, L"%.3f%s", (size >> 20) / 1024.0, appendUnits ? L" GB" : L""); break;
- default: mir_sntprintf(szOut, cchOut, L"%.2lf%s", size / 1048576.0, appendUnits ? L" MB" : L""); break;
+ case UNITS_BYTES: mir_snwprintf(szOut, cchOut, L"%u%s%s", (int)size, appendUnits ? L" " : L"", appendUnits ? TranslateT("bytes") : L""); break;
+ case UNITS_KBPOINT1: mir_snwprintf(szOut, cchOut, L"%.1lf%s", size / 1024.0, appendUnits ? L" KB" : L""); break;
+ case UNITS_KBPOINT0: mir_snwprintf(szOut, cchOut, L"%u%s", (int)(size / 1024), appendUnits ? L" KB" : L""); break;
+ case UNITS_GBPOINT3: mir_snwprintf(szOut, cchOut, L"%.3f%s", (size >> 20) / 1024.0, appendUnits ? L" GB" : L""); break;
+ default: mir_snwprintf(szOut, cchOut, L"%.2lf%s", size / 1048576.0, appendUnits ? L" MB" : L""); break;
}
}
diff --git a/src/core/stdfile/src/fileexistsdlg.cpp b/src/core/stdfile/src/fileexistsdlg.cpp index d0650fec8d..95e5e65f99 100644 --- a/src/core/stdfile/src/fileexistsdlg.cpp +++ b/src/core/stdfile/src/fileexistsdlg.cpp @@ -149,24 +149,24 @@ void __cdecl LoadIconsAndTypesThread(void* param) wchar_t *pszExtension = wcsrchr(pszFilename, '.');
if (pszExtension)
- mir_tstrncpy(szExtension, pszExtension + 1, _countof(szExtension));
+ mir_wstrncpy(szExtension, pszExtension + 1, _countof(szExtension));
else {
pszExtension = L".";
szExtension[0] = '\0';
}
CharUpper(szExtension);
if (fileInfo.szTypeName[0] == '\0')
- mir_sntprintf(fileInfo.szTypeName, TranslateT("%s file"), szExtension);
+ mir_snwprintf(fileInfo.szTypeName, TranslateT("%s file"), szExtension);
SetDlgItemText(info->hwndDlg, IDC_EXISTINGTYPE, fileInfo.szTypeName);
SetDlgItemText(info->hwndDlg, IDC_NEWTYPE, fileInfo.szTypeName);
SendDlgItemMessage(info->hwndDlg, IDC_EXISTINGICON, STM_SETICON, (WPARAM)fileInfo.hIcon, 0);
szIconFile[0] = '\0';
- if (!mir_tstrcmp(szExtension, L"EXE"))
+ if (!mir_wstrcmp(szExtension, L"EXE"))
SRFile_GetRegValue(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Icons", L"2", szIconFile, _countof(szIconFile));
else {
wchar_t szTypeName[MAX_PATH];
if (SRFile_GetRegValue(HKEY_CLASSES_ROOT, pszExtension, NULL, szTypeName, _countof(szTypeName))) {
- mir_tstrcat(szTypeName, L"\\DefaultIcon");
+ mir_wstrcat(szTypeName, L"\\DefaultIcon");
if (SRFile_GetRegValue(HKEY_CLASSES_ROOT, szTypeName, NULL, szIconFile, _countof(szIconFile))) {
if (wcsstr(szIconFile, L"%1"))
SRFile_GetRegValue(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Icons", L"0", szIconFile, _countof(szIconFile));
@@ -231,7 +231,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM loadiconsstartinfo *lisi = (loadiconsstartinfo*)mir_alloc(sizeof(loadiconsstartinfo));
lisi->hwndDlg = hwndDlg;
- lisi->szFilename = mir_tstrdup(fts->tszCurrentFile);
+ lisi->szFilename = mir_wstrdup(fts->tszCurrentFile);
//can be a little slow, so why not?
mir_forkthread(LoadIconsAndTypesThread, lisi);
SetFocus(hwndFocus);
@@ -250,7 +250,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case IDC_OPENFOLDER:
{
wchar_t szFile[MAX_PATH];
- mir_tstrncpy(szFile, fts->tszCurrentFile, _countof(szFile));
+ mir_wstrncpy(szFile, fts->tszCurrentFile, _countof(szFile));
wchar_t *pszLastBackslash = wcsrchr(szFile, '\\');
if (pszLastBackslash)
*pszLastBackslash = '\0';
@@ -283,15 +283,15 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM wchar_t filter[512], *pfilter;
wchar_t str[MAX_PATH];
- mir_tstrncpy(str, fts->tszCurrentFile, _countof(str));
+ mir_wstrncpy(str, fts->tszCurrentFile, _countof(str));
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
wcsncpy(filter, TranslateT("All files"),_countof(filter)-1);
- mir_tstrcat(filter, L" (*)");
- pfilter = filter + mir_tstrlen(filter) + 1;
- mir_tstrcpy(pfilter, L"*");
- pfilter = pfilter + mir_tstrlen(pfilter) + 1;
+ mir_wstrcat(filter, L" (*)");
+ pfilter = filter + mir_wstrlen(filter) + 1;
+ mir_wstrcpy(pfilter, L"*");
+ pfilter = pfilter + mir_wstrlen(pfilter) + 1;
*pfilter = '\0';
ofn.lpstrFilter = filter;
ofn.lpstrFile = str;
@@ -300,7 +300,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (!GetSaveFileName(&ofn))
return FALSE;
- pfr.szFilename = mir_tstrdup(str);
+ pfr.szFilename = mir_wstrdup(str);
pfr.action = FILERESUME_RENAME;
}
break;
@@ -319,7 +319,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM PROTOFILERESUME *pfrCopy = (PROTOFILERESUME*)mir_alloc(sizeof(pfr));
memcpy(pfrCopy, &pfr, sizeof(pfr));
- PostMessage((HWND)GetPropA(hwndDlg, "Miranda.ParentWnd"), M_FILEEXISTSDLGREPLY, (WPARAM)mir_tstrdup(fts->tszCurrentFile), (LPARAM)pfrCopy);
+ PostMessage((HWND)GetPropA(hwndDlg, "Miranda.ParentWnd"), M_FILEEXISTSDLGREPLY, (WPARAM)mir_wstrdup(fts->tszCurrentFile), (LPARAM)pfrCopy);
DestroyWindow(hwndDlg);
}
break;
diff --git a/src/core/stdfile/src/fileopts.cpp b/src/core/stdfile/src/fileopts.cpp index 30979c1294..93aca138ae 100644 --- a/src/core/stdfile/src/fileopts.cpp +++ b/src/core/stdfile/src/fileopts.cpp @@ -127,7 +127,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L if (iScanner >= _countof(virusScanners) || iScanner < 0) break;
str[0] = '\0';
if (SRFile_GetRegValue(HKEY_LOCAL_MACHINE, virusScanners[iScanner].szExeRegPath, virusScanners[iScanner].szExeRegValue, szScanExe, _countof(szScanExe)))
- mir_sntprintf(str, virusScanners[iScanner].szCommandLine, szScanExe);
+ mir_snwprintf(str, virusScanners[iScanner].szCommandLine, szScanExe);
SetDlgItemText(hwndDlg, IDC_SCANCMDLINE, str);
}
break;
@@ -180,7 +180,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L wchar_t *pszQuote = wcschr(str + 1, '"');
if (pszQuote)
*pszQuote = 0;
- memmove(str, str + 1, (mir_tstrlen(str) * sizeof(wchar_t)));
+ memmove(str, str + 1, (mir_wstrlen(str) * sizeof(wchar_t)));
}
else {
wchar_t *pszSpace = wcschr(str, ' ');
@@ -191,7 +191,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L if (wcschr(str, ' ') != NULL) {
memmove(str + 1, str, ((_countof(str) - 2) * sizeof(wchar_t)));
str[0] = '"';
- mir_tstrcat(str, L"\"");
+ mir_wstrcat(str, L"\"");
}
SetDlgItemText(hwndDlg, IDC_SCANCMDLINE, str);
break;
diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp index 6df563406d..06f182cd42 100644 --- a/src/core/stdfile/src/filerecvdlg.cpp +++ b/src/core/stdfile/src/filerecvdlg.cpp @@ -38,7 +38,7 @@ static void GetLowestExistingDirName(const wchar_t *szTestDir, wchar_t *szExisti DWORD dwAttributes;
wchar_t *pszLastBackslash;
- mir_tstrncpy(szExistingDir, szTestDir, cchExistingDir);
+ mir_wstrncpy(szExistingDir, szTestDir, cchExistingDir);
while ((dwAttributes = GetFileAttributes(szExistingDir)) != INVALID_FILE_ATTRIBUTES && !(dwAttributes&FILE_ATTRIBUTE_DIRECTORY)) {
pszLastBackslash = wcsrchr(szExistingDir, '\\');
if (pszLastBackslash == NULL) { *szExistingDir = '\0'; break; }
@@ -94,7 +94,7 @@ int BrowseForFolder(HWND hwnd, wchar_t *szPath) LPITEMIDLIST pidlResult = SHBrowseForFolder(&bi);
if (pidlResult) {
SHGetPathFromIDList(pidlResult, szPath);
- mir_tstrcat(szPath, L"\\");
+ mir_wstrcat(szPath, L"\\");
CoTaskMemFree(pidlResult);
}
return pidlResult != NULL;
@@ -116,31 +116,31 @@ static void patchDir(wchar_t *str, size_t strSize) mir_free(result);
}
- size_t len = mir_tstrlen(str);
+ size_t len = mir_wstrlen(str);
if (len + 1 < strSize && str[len - 1] != '\\')
- mir_tstrcpy(str + len, L"\\");
+ mir_wstrcpy(str + len, L"\\");
}
void GetContactReceivedFilesDir(MCONTACT hContact, wchar_t *szDir, int cchDir, BOOL patchVars)
{
wchar_t tszTemp[MAX_PATH];
- ptrT tszRecvPath(db_get_tsa(NULL, "SRFile", "RecvFilesDirAdv"));
+ ptrW tszRecvPath(db_get_tsa(NULL, "SRFile", "RecvFilesDirAdv"));
if (tszRecvPath)
wcsncpy_s(tszTemp, tszRecvPath, _TRUNCATE);
else
- mir_sntprintf(tszTemp, L"%%mydocuments%%\\%s\\%%userid%%", TranslateT("My received files"));
+ mir_snwprintf(tszTemp, L"%%mydocuments%%\\%s\\%%userid%%", TranslateT("My received files"));
if (hContact) {
hContact = db_mc_tryMeta(hContact);
REPLACEVARSARRAY rvaVarsToReplace[4];
rvaVarsToReplace[0].key.w = L"nick";
- rvaVarsToReplace[0].value.w = mir_tstrdup((wchar_t *)pcli->pfnGetContactDisplayName(hContact, 0));
+ rvaVarsToReplace[0].value.w = mir_wstrdup((wchar_t *)pcli->pfnGetContactDisplayName(hContact, 0));
rvaVarsToReplace[1].key.w = L"userid";
rvaVarsToReplace[1].value.w = GetContactID(hContact);
rvaVarsToReplace[2].key.w = L"proto";
- rvaVarsToReplace[2].value.w = mir_a2t(GetContactProto(hContact));
+ rvaVarsToReplace[2].value.w = mir_a2u(GetContactProto(hContact));
rvaVarsToReplace[3].key.w = NULL;
rvaVarsToReplace[3].value.w = NULL;
for (int i = 0; i < (_countof(rvaVarsToReplace) - 1); i++)
@@ -158,22 +158,22 @@ void GetContactReceivedFilesDir(MCONTACT hContact, wchar_t *szDir, int cchDir, B if (patchVars)
patchDir(tszTemp, _countof(tszTemp));
RemoveInvalidPathChars(tszTemp);
- mir_tstrncpy(szDir, tszTemp, cchDir);
+ mir_wstrncpy(szDir, tszTemp, cchDir);
}
void GetReceivedFilesDir(wchar_t *szDir, int cchDir)
{
wchar_t tszTemp[MAX_PATH];
- ptrT tszRecvPath(db_get_tsa(NULL, "SRFile", "RecvFilesDirAdv"));
+ ptrW tszRecvPath(db_get_tsa(NULL, "SRFile", "RecvFilesDirAdv"));
if (tszRecvPath)
wcsncpy_s(tszTemp, tszRecvPath, _TRUNCATE);
else
- mir_sntprintf(tszTemp, L"%%mydocuments%%\\%s\\%%userid%%", TranslateT("My received files"));
+ mir_snwprintf(tszTemp, L"%%mydocuments%%\\%s\\%%userid%%", TranslateT("My received files"));
patchDir(tszTemp, _countof(tszTemp));
RemoveInvalidPathChars(tszTemp);
- mir_tstrncpy(szDir, tszTemp, cchDir);
+ mir_wstrncpy(szDir, tszTemp, cchDir);
}
INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -231,13 +231,13 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l dat->fs = cle->lParam ? (HANDLE)cle->lParam : (HANDLE)*(PDWORD)dbei.pBlob;
char *str = (char*)dbei.pBlob + 4;
- ptrT ptszFileName(DbGetEventStringT(&dbei, str));
+ ptrW ptszFileName(DbGetEventStringT(&dbei, str));
SetDlgItemText(hwndDlg, IDC_FILENAMES, ptszFileName);
unsigned len = (unsigned)mir_strlen(str) + 1;
if (len + 4 < dbei.cbBlob) {
str += len;
- ptrT ptszDescription(DbGetEventStringT(&dbei, str));
+ ptrW ptszDescription(DbGetEventStringT(&dbei, str));
SetDlgItemText(hwndDlg, IDC_MSG, ptszDescription);
}
}
@@ -247,7 +247,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l TimeZone_PrintTimeStamp(NULL, dbei.timestamp, L"t d", datetimestr, _countof(datetimestr), 0);
SetDlgItemText(hwndDlg, IDC_DATE, datetimestr);
- ptrT info(Contact_GetInfo(CNF_UNIQUEID, dat->hContact));
+ ptrW info(Contact_GetInfo(CNF_UNIQUEID, dat->hContact));
SetDlgItemText(hwndDlg, IDC_NAME, (info) ? info : contactName);
if (db_get_b(dat->hContact, "CList", "NotOnList", 0)) {
@@ -307,7 +307,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l GetDlgItemText(hwndDlg, IDC_FILEDIR, szRecvDir, _countof(szRecvDir));
RemoveInvalidPathChars(szRecvDir);
GetContactReceivedFilesDir(NULL, szDefaultRecvDir, _countof(szDefaultRecvDir), TRUE);
- if (wcsnicmp(szRecvDir, szDefaultRecvDir, mir_tstrlen(szDefaultRecvDir))) {
+ if (wcsnicmp(szRecvDir, szDefaultRecvDir, mir_wstrlen(szDefaultRecvDir))) {
char idstr[32];
int i;
DBVARIANT dbv;
diff --git a/src/core/stdfile/src/filesenddlg.cpp b/src/core/stdfile/src/filesenddlg.cpp index 7d1c780807..4c6089c8c5 100644 --- a/src/core/stdfile/src/filesenddlg.cpp +++ b/src/core/stdfile/src/filesenddlg.cpp @@ -49,16 +49,16 @@ static void SetFileListAndSizeControls(HWND hwndDlg, FileDlgData *dat) if (i > 1) {
wchar_t szFormat[32];
if (fileCount && dirCount) {
- mir_sntprintf(szFormat, L"%s, %s", TranslateTS(fileCount == 1 ? L"%d file" : L"%d files"), TranslateTS(dirCount == 1 ? L"%d directory" : L"%d directories"));
- mir_sntprintf(str, szFormat, fileCount, dirCount);
+ mir_snwprintf(szFormat, L"%s, %s", TranslateTS(fileCount == 1 ? L"%d file" : L"%d files"), TranslateTS(dirCount == 1 ? L"%d directory" : L"%d directories"));
+ mir_snwprintf(str, szFormat, fileCount, dirCount);
}
else if (fileCount) {
- mir_tstrcpy(szFormat, TranslateT("%d files"));
- mir_sntprintf(str, szFormat, fileCount);
+ mir_wstrcpy(szFormat, TranslateT("%d files"));
+ mir_snwprintf(str, szFormat, fileCount);
}
else {
- mir_tstrcpy(szFormat, TranslateT("%d directories"));
- mir_sntprintf(str, szFormat, dirCount);
+ mir_wstrcpy(szFormat, TranslateT("%d directories"));
+ mir_snwprintf(str, szFormat, dirCount);
}
SetDlgItemText(hwndDlg, IDC_FILE, str);
}
@@ -87,12 +87,12 @@ static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const wchar_t *bu // NULL separated list of all files
// fileOffset is the offset to the first file.
- size_t fileOffset = mir_tstrlen(buf) + 1;
+ size_t fileOffset = mir_wstrlen(buf) + 1;
// Count number of files
pBuf = buf + fileOffset;
while (*pBuf) {
- pBuf += mir_tstrlen(pBuf) + 1;
+ pBuf += mir_wstrlen(pBuf) + 1;
nNumberOfFiles++;
}
@@ -105,13 +105,13 @@ static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const wchar_t *bu nTemp = 0;
while (*pBuf) {
// Allocate space for path+filename
- size_t cbFileNameLen = mir_tstrlen(pBuf);
+ size_t cbFileNameLen = mir_wstrlen(pBuf);
dat->files[nTemp] = (wchar_t*)mir_alloc(sizeof(wchar_t)*(fileOffset + cbFileNameLen + 1));
// Add path to filename and copy into array
memcpy(dat->files[nTemp], buf, (fileOffset - 1)*sizeof(wchar_t));
dat->files[nTemp][fileOffset - 1] = '\\';
- mir_tstrcpy(dat->files[nTemp] + fileOffset - (buf[fileOffset - 2] == '\\' ? 1 : 0), pBuf);
+ mir_wstrcpy(dat->files[nTemp] + fileOffset - (buf[fileOffset - 2] == '\\' ? 1 : 0), pBuf);
// Move pointers to next file...
pBuf += cbFileNameLen + 1;
@@ -125,7 +125,7 @@ static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const wchar_t *bu if ((dat->files = (wchar_t **)mir_alloc(2 * sizeof(wchar_t*))) == NULL) // Leaks when aborted
return;
- dat->files[0] = mir_tstrdup(buf);
+ dat->files[0] = mir_wstrdup(buf);
dat->files[1] = NULL;
}
@@ -146,11 +146,11 @@ void __cdecl ChooseFilesThread(void* param) }
wchar_t filter[128];
- mir_tstrcpy(filter, TranslateT("All files"));
- mir_tstrcat(filter, L" (*)");
- wchar_t *pfilter = filter + mir_tstrlen(filter) + 1;
- mir_tstrcpy(pfilter, L"*");
- pfilter = filter + mir_tstrlen(filter) + 1;
+ mir_wstrcpy(filter, TranslateT("All files"));
+ mir_wstrcat(filter, L" (*)");
+ wchar_t *pfilter = filter + mir_wstrlen(filter) + 1;
+ mir_wstrcpy(pfilter, L"*");
+ pfilter = filter + mir_wstrlen(filter) + 1;
pfilter[0] = '\0';
OPENFILENAME ofn = { 0 };
@@ -230,7 +230,7 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l for (totalCount = 0; fsd->ppFiles[totalCount]; totalCount++);
dat->files = (wchar_t**)mir_alloc(sizeof(wchar_t*)*(totalCount + 1)); // Leaks
for (i = 0; i < totalCount; i++)
- dat->files[i] = mir_tstrdup(fsd->ppFiles[i]);
+ dat->files[i] = mir_wstrdup(fsd->ppFiles[i]);
dat->files[totalCount] = NULL;
SetFileListAndSizeControls(hwndDlg, dat);
}
@@ -238,7 +238,7 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l wchar_t *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0);
SetDlgItemText(hwndDlg, IDC_TO, contactName);
- ptrT id(Contact_GetInfo(CNF_UNIQUEID, dat->hContact));
+ ptrW id(Contact_GetInfo(CNF_UNIQUEID, dat->hContact));
SetDlgItemText(hwndDlg, IDC_NAME, (id) ? id : contactName);
if (fsd->ppFiles == NULL) {
diff --git a/src/core/stdfile/src/filexferdlg.cpp b/src/core/stdfile/src/filexferdlg.cpp index 7be203e9bb..ed513f02bb 100644 --- a/src/core/stdfile/src/filexferdlg.cpp +++ b/src/core/stdfile/src/filexferdlg.cpp @@ -47,23 +47,23 @@ wchar_t* PFTS_StringToTchar(int flags, const wchar_t* s) if (flags & PFTS_UTF) return Utf8DecodeW((char*)s); if (flags & PFTS_UNICODE) - return mir_tstrdup(s); - return mir_a2t((char*)s); + return mir_wstrdup(s); + return mir_a2u((char*)s); } int PFTS_CompareWithTchar(PROTOFILETRANSFERSTATUS *ft, const wchar_t *s, wchar_t *r) { if (ft->flags & PFTS_UTF) { wchar_t *ts = Utf8DecodeW((char*)s); - int res = mir_tstrcmp(ts, r); + int res = mir_wstrcmp(ts, r); mir_free(ts); return res; } if (ft->flags & PFTS_UNICODE) - return mir_tstrcmp(s, r); + return mir_wstrcmp(s, r); - wchar_t *ts = mir_a2t((char*)s); - int res = mir_tstrcmp(ts, r); + wchar_t *ts = mir_a2u((char*)s); + int res = mir_wstrcmp(ts, r); mir_free(ts); return res; } @@ -102,10 +102,10 @@ static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info) wchar_t *pszReplace = wcsstr(dbv.ptszVal, L"%f"); wchar_t szCmdLine[768]; if (pszReplace) { - if (info->szFile[mir_tstrlen(info->szFile) - 1] == '\\') - info->szFile[mir_tstrlen(info->szFile) - 1] = '\0'; + if (info->szFile[mir_wstrlen(info->szFile) - 1] == '\\') + info->szFile[mir_wstrlen(info->szFile) - 1] = '\0'; *pszReplace = 0; - mir_sntprintf(szCmdLine, L"%s\"%s\"%s", dbv.ptszVal, info->szFile, pszReplace + 2); + mir_snwprintf(szCmdLine, L"%s\"%s\"%s", dbv.ptszVal, info->szFile, pszReplace + 2); } else wcsncpy_s(szCmdLine, dbv.ptszVal, _TRUNCATE); @@ -130,7 +130,7 @@ static void SetFilenameControls(HWND hwndDlg, FileDlgData *dat, PROTOFILETRANSFE SHFILEINFO shfi = { 0 }; if (fts->tszCurrentFile) { - fnbuf = mir_tstrdup(fts->tszCurrentFile); + fnbuf = mir_wstrdup(fts->tszCurrentFile); if ((fn = wcsrchr(fnbuf, '\\')) == NULL) fn = fnbuf; else fn++; @@ -139,7 +139,7 @@ static void SetFilenameControls(HWND hwndDlg, FileDlgData *dat, PROTOFILETRANSFE if (dat->hIcon) DestroyIcon(dat->hIcon); dat->hIcon = NULL; if (fn && (fts->totalFiles > 1)) { - mir_sntprintf(msg, L"%s: %s (%d %s %d)", + mir_snwprintf(msg, L"%s: %s (%d %s %d)", pcli->pfnGetContactDisplayName(fts->hContact, 0), fn, fts->currentFileNumber + 1, TranslateT("of"), fts->totalFiles); @@ -147,13 +147,13 @@ static void SetFilenameControls(HWND hwndDlg, FileDlgData *dat, PROTOFILETRANSFE dat->hIcon = shfi.hIcon; } else if (fn) { - mir_sntprintf(msg, L"%s: %s", pcli->pfnGetContactDisplayName(fts->hContact, 0), fn); + mir_snwprintf(msg, L"%s: %s", pcli->pfnGetContactDisplayName(fts->hContact, 0), fn); SHGetFileInfo(fn, FILE_ATTRIBUTE_NORMAL, &shfi, sizeof(shfi), SHGFI_USEFILEATTRIBUTES | SHGFI_ICON | SHGFI_SMALLICON); dat->hIcon = shfi.hIcon; } else { - mir_tstrncpy(msg, pcli->pfnGetContactDisplayName(fts->hContact, 0), _countof(msg)); + mir_wstrncpy(msg, pcli->pfnGetContactDisplayName(fts->hContact, 0), _countof(msg)); HICON hIcon = Skin_LoadIcon(SKINICON_OTHER_DOWNARROW); dat->hIcon = CopyIcon(hIcon); IcoLib_ReleaseIcon(hIcon, NULL); @@ -247,7 +247,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR else { //recv CreateDirectoryTreeT(dat->szSavePath); dat->fs = (HANDLE)ProtoChainSend(dat->hContact, PSS_FILEALLOW, (WPARAM)dat->fs, (LPARAM)dat->szSavePath); - dat->transferStatus.tszWorkingDir = mir_tstrdup(dat->szSavePath); + dat->transferStatus.tszWorkingDir = mir_wstrdup(dat->szSavePath); if (db_get_b(dat->hContact, "CList", "NotOnList", 0)) dat->resumeBehaviour = FILERESUME_ASK; else dat->resumeBehaviour = db_get_b(NULL, "SRFile", "IfExists", FILERESUME_ASK); SetFtStatus(hwndDlg, LPGENW("Waiting for connection..."), FTS_TEXT); @@ -308,7 +308,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR GetSensiblyFormattedSize((dat->bytesRecvedHistory[0] - dat->bytesRecvedHistory[dat->bytesRecvedHistorySize - 1]) / dat->bytesRecvedHistorySize, szSpeed, _countof(szSpeed), 0, 1, NULL); if (dat->bytesRecvedHistory[0] == dat->bytesRecvedHistory[dat->bytesRecvedHistorySize - 1]) - mir_tstrcpy(szTime, L"??:??:??"); + mir_wstrcpy(szTime, L"??:??:??"); else { li.QuadPart = BIGI(10000000)*(dat->transferStatus.currentFileSize - dat->transferStatus.currentFileProgress)*dat->bytesRecvedHistorySize / (dat->bytesRecvedHistory[0] - dat->bytesRecvedHistory[dat->bytesRecvedHistorySize - 1]); ft.dwHighDateTime = li.HighPart; ft.dwLowDateTime = li.LowPart; @@ -322,7 +322,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR GetTimeFormat(LOCALE_USER_DEFAULT, TIME_FORCE24HOURFORMAT | TIME_NOTIMEMARKER, &st, NULL, szTime, _countof(szTime)); } - mir_sntprintf(szDisplay, L"%s/%s (%s %s)", szSpeed, TranslateT("sec"), szTime, TranslateT("remaining")); + mir_snwprintf(szDisplay, L"%s/%s (%s %s)", szSpeed, TranslateT("sec"), szTime, TranslateT("remaining")); SetDlgItemText(hwndDlg, IDC_ALLSPEED, szDisplay); } break; @@ -414,7 +414,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR pszFilename++; if (pszFilename) { - size_t cbFileNameLen = mir_tstrlen(pszFilename); + size_t cbFileNameLen = mir_wstrlen(pszFilename); pszNewFileName = (wchar_t*)mir_alloc(cbFileNameLen * 2 * sizeof(wchar_t)); wchar_t *p = pszNewFileName; @@ -478,12 +478,12 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR { wchar_t *pszExtension, *pszFilename; if ((pszFilename = wcsrchr(szOriginalFilename, '\\')) == NULL) pszFilename = szOriginalFilename; - if ((pszExtension = wcsrchr(pszFilename + 1, '.')) == NULL) pszExtension = pszFilename + mir_tstrlen(pszFilename); + if ((pszExtension = wcsrchr(pszFilename + 1, '.')) == NULL) pszExtension = pszFilename + mir_wstrlen(pszFilename); if (pfr->szFilename) mir_free((wchar_t*)pfr->szFilename); - size_t size = (pszExtension - szOriginalFilename) + 21 + mir_tstrlen(pszExtension); + size_t size = (pszExtension - szOriginalFilename) + 21 + mir_wstrlen(pszExtension); pfr->szFilename = (wchar_t*)mir_alloc(sizeof(wchar_t)*size); for (int i = 1;; i++) { - mir_sntprintf((wchar_t*)pfr->szFilename, size, L"%.*s (%u)%s", pszExtension - szOriginalFilename, szOriginalFilename, i, pszExtension); + mir_snwprintf((wchar_t*)pfr->szFilename, size, L"%.*s (%u)%s", pszExtension - szOriginalFilename, szOriginalFilename, i, pszExtension); if (_waccess(pfr->szFilename, 0) != 0) break; } @@ -528,7 +528,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR virusscanthreadstartinfo *vstsi; vstsi = (struct virusscanthreadstartinfo*)mir_alloc(sizeof(struct virusscanthreadstartinfo)); vstsi->hwndReply = hwndDlg; - vstsi->szFile = mir_tstrdup(dat->files[dat->transferStatus.currentFileNumber]); + vstsi->szFile = mir_wstrdup(dat->files[dat->transferStatus.currentFileNumber]); vstsi->returnCode = dat->transferStatus.currentFileNumber; mir_forkthread((void(*)(void*))RunVirusScannerThread, vstsi); } @@ -554,7 +554,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR PROTOFILERESUME *pfr = (PROTOFILERESUME*)mir_alloc(sizeof(PROTOFILERESUME)); pfr->action = dat->resumeBehaviour; pfr->szFilename = NULL; - PostMessage(hwndDlg, M_FILEEXISTSDLGREPLY, (WPARAM)mir_tstrdup(fts->tszCurrentFile), (LPARAM)pfr); + PostMessage(hwndDlg, M_FILEEXISTSDLGREPLY, (WPARAM)mir_wstrdup(fts->tszCurrentFile), (LPARAM)pfr); } } SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, 1); @@ -596,17 +596,17 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR const unsigned long nextPos = fts->totalBytes ? (BIGI(100) * fts->totalProgress / fts->totalBytes) : 0; if (lastPos != nextPos || firstTime) { SendDlgItemMessage(hwndDlg, IDC_ALLFILESPROGRESS, PBM_SETPOS, nextPos, 0); - mir_sntprintf(str, L"%u%%", nextPos); + mir_snwprintf(str, L"%u%%", nextPos); SetDlgItemText(hwndDlg, IDC_ALLPRECENTS, str); } int units; GetSensiblyFormattedSize(fts->totalBytes, szSizeTotal, _countof(szSizeTotal), 0, 1, &units); GetSensiblyFormattedSize(fts->totalProgress, szSizeDone, _countof(szSizeDone), units, 0, NULL); - mir_sntprintf(str, L"%s/%s", szSizeDone, szSizeTotal); + mir_snwprintf(str, L"%s/%s", szSizeDone, szSizeTotal); str2[0] = 0; GetDlgItemText(hwndDlg, IDC_ALLTRANSFERRED, str2, _countof(str2)); - if (mir_tstrcmp(str, str2)) + if (mir_wstrcmp(str, str2)) SetDlgItemText(hwndDlg, IDC_ALLTRANSFERRED, str); } break; @@ -665,10 +665,10 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR mir_free(vstsi); vstsi = NULL; } - else vstsi->szFile = mir_tstrdup(dat->files[dat->transferStatus.currentFileNumber]); + else vstsi->szFile = mir_wstrdup(dat->files[dat->transferStatus.currentFileNumber]); } else { - vstsi->szFile = mir_tstrdup(dat->transferStatus.tszWorkingDir); + vstsi->szFile = mir_wstrdup(dat->transferStatus.tszWorkingDir); vstsi->returnCode = -1; } SetFtStatus(hwndDlg, LPGENW("Scanning for viruses..."), FTS_TEXT); diff --git a/src/core/stdhelp/src/about.cpp b/src/core/stdhelp/src/about.cpp index 5fca697ade..ea58985f7d 100644 --- a/src/core/stdhelp/src/about.cpp +++ b/src/core/stdhelp/src/about.cpp @@ -51,7 +51,7 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar CallService(MS_SYSTEM_GETVERSIONTEXT, _countof(productVersion), (LPARAM)productVersion);
wchar_t str[64];
- mir_sntprintf(str, STR_VERSION_FORMAT, productVersion);
+ mir_snwprintf(str, STR_VERSION_FORMAT, productVersion);
SetDlgItemText(hwndDlg, IDC_HEADERBAR, str);
}
ShowWindow(GetDlgItem(hwndDlg, IDC_CREDITSFILE), SW_HIDE);
@@ -69,7 +69,7 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar if (ResSize >=3 && pszMsgt[0] == '\xef' && pszMsgt[1] == '\xbb' && pszMsgt[2] == '\xbf')
ptszMsg = Utf8DecodeT(pszMsgt + 3);
else
- ptszMsg = mir_a2t_cp(pszMsgt, 1252);
+ ptszMsg = mir_a2u_cp(pszMsgt, 1252);
SetDlgItemText(hwndDlg, IDC_CREDITSFILE, ptszMsg);
UnlockResource(pszMsg);
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 79822ad339..0c68e5b22d 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -55,7 +55,7 @@ static void NotifyLocalWinEvent(MCONTACT hContact, HWND hwnd, unsigned int type) static int RTL_Detect(const wchar_t *ptszText)
{
- int iLen = (int)mir_tstrlen(ptszText);
+ int iLen = (int)mir_wstrlen(ptszText);
WORD *infoTypeC2 = (WORD*)alloca(sizeof(WORD)* (iLen + 2));
GetStringTypeEx(LOCALE_USER_DEFAULT, CT_CTYPE2, ptszText, iLen, infoTypeC2);
@@ -91,17 +91,17 @@ static void AddToFileList(wchar_t ***pppFiles, int *totalCount, const wchar_t* s {
*pppFiles = (wchar_t**)mir_realloc(*pppFiles, (++*totalCount + 1)*sizeof(wchar_t*));
(*pppFiles)[*totalCount] = NULL;
- (*pppFiles)[*totalCount - 1] = mir_tstrdup(szFilename);
+ (*pppFiles)[*totalCount - 1] = mir_wstrdup(szFilename);
if (GetFileAttributes(szFilename) & FILE_ATTRIBUTE_DIRECTORY) {
WIN32_FIND_DATA fd;
wchar_t szPath[MAX_PATH];
- mir_sntprintf(szPath, L"%s\\*", szFilename);
+ mir_snwprintf(szPath, L"%s\\*", szFilename);
HANDLE hFind = FindFirstFile(szPath, &fd);
if (hFind != INVALID_HANDLE_VALUE) {
do {
- if (!mir_tstrcmp(fd.cFileName, L".") || !mir_tstrcmp(fd.cFileName, L"..")) continue;
- mir_sntprintf(szPath, L"%s\\%s", szFilename, fd.cFileName);
+ if (!mir_wstrcmp(fd.cFileName, L".") || !mir_wstrcmp(fd.cFileName, L"..")) continue;
+ mir_snwprintf(szPath, L"%s\\%s", szFilename, fd.cFileName);
AddToFileList(pppFiles, totalCount, szPath);
}
while (FindNextFile(hFind, &fd));
@@ -122,7 +122,7 @@ static void UpdateReadChars(HWND hwndDlg, HWND hwndStatus) wchar_t buf[32];
int len = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE));
- mir_sntprintf(buf, L"%d", len);
+ mir_snwprintf(buf, L"%d", len);
SendMessage(hwndStatus, SB_SETTEXT, 1, (LPARAM)buf);
}
}
@@ -495,7 +495,7 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * HFONT hFont = (HFONT)SelectObject(hdc, (HFONT)SendDlgItemMessage(hwndDlg, IDOK, WM_GETFONT, 0, 0));
SIZE textSize;
- GetTextExtentPoint32(hdc, buf, (int)mir_tstrlen(buf), &textSize);
+ GetTextExtentPoint32(hdc, buf, (int)mir_wstrlen(buf), &textSize);
urc->rcItem.right = urc->rcItem.left + textSize.cx + 10;
if ((g_dat.flags&SMF_SHOWBTNS) && urc->rcItem.right > urc->dlgNewSize.cx - dat->nLabelRight)
urc->rcItem.right = urc->dlgNewSize.cx - dat->nLabelRight;
@@ -918,11 +918,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l case DM_USERNAMETOCLIP:
if (dat->hContact) {
- ptrT id(Contact_GetInfo(CNF_UNIQUEID, dat->hContact, dat->szProto));
+ ptrW id(Contact_GetInfo(CNF_UNIQUEID, dat->hContact, dat->szProto));
if (id != NULL && OpenClipboard(hwndDlg)) {
EmptyClipboard();
- HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, mir_tstrlen(id) * sizeof(wchar_t)+1);
- mir_tstrcpy((wchar_t*)GlobalLock(hData), id);
+ HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, mir_wstrlen(id) * sizeof(wchar_t)+1);
+ mir_wstrcpy((wchar_t*)GlobalLock(hData), id);
GlobalUnlock(hData);
SetClipboardData(CF_UNICODETEXT, hData);
CloseClipboard();
@@ -938,7 +938,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l wchar_t date[64], time[64], fmt[128];
TimeZone_PrintTimeStamp(NULL, dat->lastMessage, L"d", date, _countof(date), 0);
TimeZone_PrintTimeStamp(NULL, dat->lastMessage, L"t", time, _countof(time), 0);
- mir_sntprintf(fmt, TranslateT("Last message received on %s at %s."), date, time);
+ mir_snwprintf(fmt, TranslateT("Last message received on %s at %s."), date, time);
SendMessage(dat->hwndStatus, SB_SETTEXT, 0, (LPARAM)fmt);
}
else SendMessage(dat->hwndStatus, SB_SETTEXT, 0, (LPARAM)L"");
@@ -1007,14 +1007,14 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l dat->wStatus = db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
wchar_t *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0);
- ptrT id(Contact_GetInfo(CNF_DISPLAYUID, dat->hContact, dat->szProto));
+ ptrW id(Contact_GetInfo(CNF_DISPLAYUID, dat->hContact, dat->szProto));
SetDlgItemText(hwndDlg, IDC_NAME, (id) ? id : contactName);
wchar_t *szStatus = pcli->pfnGetStatusModeDescription(dat->szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE), 0);
if (statusIcon)
- mir_sntprintf(newtitle, L"%s - %s", contactName, TranslateT("Message session"));
+ mir_snwprintf(newtitle, L"%s - %s", contactName, TranslateT("Message session"));
else
- mir_sntprintf(newtitle, L"%s (%s): %s", contactName, szStatus, TranslateT("Message session"));
+ mir_snwprintf(newtitle, L"%s (%s): %s", contactName, szStatus, TranslateT("Message session"));
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)wParam;
if (!cws || (!mir_strcmp(cws->szModule, dat->szProto) && !mir_strcmp(cws->szSetting, "Status"))) {
@@ -1026,11 +1026,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l dat->wOldStatus = dat->wStatus;
}
else
- mir_tstrncpy(newtitle, TranslateT("Message session"), _countof(newtitle));
+ mir_wstrncpy(newtitle, TranslateT("Message session"), _countof(newtitle));
wchar_t oldtitle[256];
GetWindowText(hwndDlg, oldtitle, _countof(oldtitle));
- if (mir_tstrcmp(newtitle, oldtitle)) { //swt() flickers even if the title hasn't actually changed
+ if (mir_wstrcmp(newtitle, oldtitle)) { //swt() flickers even if the title hasn't actually changed
SetWindowText(hwndDlg, newtitle);
SendMessage(hwndDlg, WM_SIZE, 0, 0);
}
@@ -1258,7 +1258,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l wchar_t* szContactName = pcli->pfnGetContactDisplayName(dat->hContact, 0);
HICON hTyping = Skin_LoadIcon(SKINICON_OTHER_TYPING);
- mir_sntprintf(szBuf, TranslateT("%s is typing a message..."), szContactName);
+ mir_snwprintf(szBuf, TranslateT("%s is typing a message..."), szContactName);
dat->nTypeSecs--;
SendMessage(dat->hwndStatus, SB_SETTEXT, 0, (LPARAM)szBuf);
@@ -1346,9 +1346,9 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (!temp[0])
break;
- int sendId = SendMessageDirect(rtrimt(temp), dat->hContact, dat->szProto);
+ int sendId = SendMessageDirect(rtrimw(temp), dat->hContact, dat->szProto);
if (sendId) {
- dat->cmdList.insert(mir_tstrdup(temp));
+ dat->cmdList.insert(mir_wstrdup(temp));
dat->cmdListInd = -1;
if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON)
@@ -1546,8 +1546,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l case IDM_COPYLINK:
if (OpenClipboard(hwndDlg)) {
EmptyClipboard();
- HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, (mir_tstrlen(tr.lpstrText) + 1) * sizeof(wchar_t));
- mir_tstrcpy((wchar_t*)GlobalLock(hData), tr.lpstrText);
+ HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, (mir_wstrlen(tr.lpstrText) + 1) * sizeof(wchar_t));
+ mir_wstrcpy((wchar_t*)GlobalLock(hData), tr.lpstrText);
GlobalUnlock(hData);
SetClipboardData(CF_UNICODETEXT, hData);
CloseClipboard();
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index 62ab631a35..7096284dac 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -89,7 +89,7 @@ static void AppendToBufferWithRTF(CMStringA &buf, const wchar_t *line) int i, found = 0;
for (i = 0; i < _countof(bbcodes); ++i) {
if (line[1] == bbcodes[i][1]) {
- size_t lenb = mir_tstrlen(bbcodes[i]);
+ size_t lenb = mir_wstrlen(bbcodes[i]);
if (!wcsnicmp(line, bbcodes[i], lenb)) {
buf.Append(bbcodefmt[i]);
line += lenb - 1;
@@ -317,14 +317,14 @@ static char* CreateRTFFromDbEvent(SrmmWindowData *dat, MCONTACT hContact, MEVENT char* filename = (char*)dbei.pBlob + sizeof(DWORD);
char* descr = filename + mir_strlen(filename) + 1;
- ptrT ptszFileName(DbGetEventStringT(&dbei, filename));
+ ptrW ptszFileName(DbGetEventStringT(&dbei, filename));
buffer.AppendFormat(" %s ", SetToStyle(MSGFONTID_NOTICE));
AppendToBufferWithRTF(buffer, (dbei.flags & DBEF_SENT) ? TranslateT("File sent") : TranslateT("File received"));
buffer.Append(": ");
AppendToBufferWithRTF(buffer, ptszFileName);
if (*descr != 0) {
- ptrT ptszDescr(DbGetEventStringT(&dbei, descr));
+ ptrW ptszDescr(DbGetEventStringT(&dbei, descr));
buffer.Append(" (");
AppendToBufferWithRTF(buffer, ptszDescr);
buffer.Append(")");
diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp index 52bfb5f630..f5968b5cce 100644 --- a/src/core/stdmsg/src/msgoptions.cpp +++ b/src/core/stdmsg/src/msgoptions.cpp @@ -84,7 +84,7 @@ bool LoadMsgDlgFont(int i, LOGFONT* lf, COLORREF * colour) if (db_get_ts(NULL, SRMMMOD, str, &dbv))
wcsncpy(lf->lfFaceName, fontOptionsList[i].szDefFace, _countof(lf->lfFaceName)-1);
else {
- mir_tstrncpy(lf->lfFaceName, dbv.ptszVal, _countof(lf->lfFaceName));
+ mir_wstrncpy(lf->lfFaceName, dbv.ptszVal, _countof(lf->lfFaceName));
db_free(&dbv);
}
mir_snprintf(str, "SRMFont%dSet", i);
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 2b67cb4590..2737384610 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -89,7 +89,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam) }
wchar_t toolTip[256];
- mir_sntprintf(toolTip, TranslateT("Message from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_snwprintf(toolTip, TranslateT("Message from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
CLISTEVENT cle = {};
cle.hContact = hContact;
@@ -167,7 +167,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam) SendMessage(hwnd, DM_TYPING, 0, lParam);
else if (lParam && (g_dat.flags & SMF_SHOWTYPINGTRAY)) {
wchar_t szTip[256];
- mir_sntprintf(szTip, TranslateT("%s is typing a message"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_snwprintf(szTip, TranslateT("%s is typing a message"), pcli->pfnGetContactDisplayName(hContact, 0));
if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY) && !(g_dat.flags & SMF_SHOWTYPINGCLIST)) {
MIRANDASYSTRAYNOTIFY tn = { sizeof(tn) };
@@ -281,7 +281,7 @@ static void RestoreUnreadMessageAlerts(void) for (int i = 0; i < arEvents.getCount(); i++) {
MSavedEvent &e = arEvents[i];
- mir_sntprintf(toolTip, TranslateT("Message from %s"), pcli->pfnGetContactDisplayName(e.hContact, 0));
+ mir_snwprintf(toolTip, TranslateT("Message from %s"), pcli->pfnGetContactDisplayName(e.hContact, 0));
cle.hContact = e.hContact;
cle.hDbEvent = e.hEvent;
pcli->pfnAddEvent(&cle);
diff --git a/src/core/stdmsg/src/msgtimedout.cpp b/src/core/stdmsg/src/msgtimedout.cpp index 0f3d4ac508..2a39135e88 100644 --- a/src/core/stdmsg/src/msgtimedout.cpp +++ b/src/core/stdmsg/src/msgtimedout.cpp @@ -44,11 +44,11 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar if (!param->szMsg || !param->szMsg[0])
SetDlgItemText(hwndDlg, IDC_ERRORTEXT, TranslateT("An unknown error has occurred."));
else {
- ptrT ptszError(Langpack_PcharToTchar(param->szMsg));
+ ptrW ptszError(Langpack_PcharToTchar(param->szMsg));
SetDlgItemText(hwndDlg, IDC_ERRORTEXT, ptszError);
}
- SetDlgItemText(hwndDlg, IDC_MSGTEXT, ptrT(mir_utf8decodeT(item->szMsg)));
+ SetDlgItemText(hwndDlg, IDC_MSGTEXT, ptrW(mir_utf8decodeW(item->szMsg)));
HWND hwndParent = GetParent(hwndDlg);
if (hwndParent != NULL)
@@ -76,7 +76,7 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
- SendMessageDirect(ptrT(mir_utf8decodeT(item->szMsg)), item->hContact, GetContactProto(item->hContact));
+ SendMessageDirect(ptrW(mir_utf8decodeW(item->szMsg)), item->hContact, GetContactProto(item->hContact));
DestroyWindow(hwndDlg);
break;
diff --git a/src/core/stdssl/src/netlibssl.cpp b/src/core/stdssl/src/netlibssl.cpp index af0c2632e1..023aff9c1c 100644 --- a/src/core/stdssl/src/netlibssl.cpp +++ b/src/core/stdssl/src/netlibssl.cpp @@ -80,7 +80,7 @@ static void ReportSslError(SECURITY_STATUS scRet, int line, bool = false) }
wchar_t szMsgBuf2[512];
- mir_sntprintf(szMsgBuf2, L"SSL connection failure (%x %u): %s", scRet, line, szMsgBuf);
+ mir_snwprintf(szMsgBuf2, L"SSL connection failure (%x %u): %s", scRet, line, szMsgBuf);
char* szMsg = Utf8EncodeT(szMsgBuf2);
Netlib_Logf(NULL, szMsg);
diff --git a/src/core/stduihist/src/history.cpp b/src/core/stduihist/src/history.cpp index 88acd91328..193e730b19 100644 --- a/src/core/stduihist/src/history.cpp +++ b/src/core/stduihist/src/history.cpp @@ -55,7 +55,7 @@ static void GetUrlDescription(DBEVENTINFO *dbei, wchar_t* buf, int cbBuf) buf[ len ] = 0;
if (len < cbBuf-3)
- mir_tstrcat(buf, L"\r\n");
+ mir_wstrcat(buf, L"\r\n");
}
static void GetFileDescription(DBEVENTINFO *dbei, wchar_t* buf, int cbBuf)
@@ -68,7 +68,7 @@ static void GetFileDescription(DBEVENTINFO *dbei, wchar_t* buf, int cbBuf) buf[ len ] = 0;
if (len < cbBuf-3)
- mir_tstrcat(buf, L"\r\n");
+ mir_wstrcat(buf, L"\r\n");
}
static void GetObjectDescription(DBEVENTINFO *dbei, wchar_t* str, int cbStr)
@@ -117,7 +117,7 @@ static void GetObjectSummary(DBEVENTINFO *dbei, wchar_t* str, int cbStr) default:
DBEVENTTYPEDESCR* et = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
if (et && (et->flags & DETF_HISTORY)) {
- pszTmp = mir_a2t(et->descr);
+ pszTmp = mir_a2u(et->descr);
pszSrc = TranslateTS(pszTmp);
break;
}
@@ -165,7 +165,7 @@ static void FillHistoryThread(void* param) GetObjectSummary(&dbei, str, _countof(str));
if (str[0]) {
TimeZone_PrintTimeStamp(NULL, dbei.timestamp, L"d t", strdatetime, _countof(strdatetime), 0);
- mir_sntprintf(eventText, L"%s: %s", strdatetime, str);
+ mir_snwprintf(eventText, L"%s: %s", strdatetime, str);
i = SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)eventText);
SendMessage(hwndList, LB_SETITEMDATA, i, (LPARAM)hDbEvent);
}
@@ -208,7 +208,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP {
wchar_t* contactName, str[200];
contactName = pcli->pfnGetContactDisplayName(hContact, 0);
- mir_sntprintf(str, TranslateT("History for %s"), contactName);
+ mir_snwprintf(str, TranslateT("History for %s"), contactName);
SetWindowText(hwndDlg, str);
}
Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_OTHER_HISTORY);
@@ -319,7 +319,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP wchar_t str[1024];
GetObjectDescription(&dbei, str, _countof(str));
if (str[0]) {
- CharUpperBuff(str, (int)mir_tstrlen(str));
+ CharUpperBuff(str, (int)mir_wstrlen(str));
if (wcsstr(str, (const wchar_t*)lParam) != NULL) {
SendDlgItemMessage(hwndDlg, IDC_LIST, LB_SETCURSEL, index, 0);
SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_LIST, LBN_SELCHANGE), 0);
@@ -352,7 +352,7 @@ static INT_PTR CALLBACK DlgProcHistoryFind(HWND hwndDlg, UINT msg, WPARAM wParam wchar_t str[128];
HWND hwndParent = (HWND)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
GetDlgItemText(hwndDlg, IDC_FINDWHAT, str, _countof(str));
- CharUpperBuff(str, (int)mir_tstrlen(str));
+ CharUpperBuff(str, (int)mir_wstrlen(str));
SendMessage(hwndParent, DM_FINDNEXT, 0, (LPARAM)str);
return TRUE;
}
diff --git a/src/core/stduserinfo/src/contactinfo.cpp b/src/core/stduserinfo/src/contactinfo.cpp index a125be13ef..ca14e50201 100644 --- a/src/core/stduserinfo/src/contactinfo.cpp +++ b/src/core/stduserinfo/src/contactinfo.cpp @@ -197,11 +197,11 @@ static int IsOverEmail(HWND hwndDlg, wchar_t* szEmail, int cchEmail) SelectObject(hdc, hEmailFont);
SIZE textSize;
- GetTextExtentPoint32(hdc, szText, (int)mir_tstrlen(szText), &textSize);
+ GetTextExtentPoint32(hdc, szText, (int)mir_wstrlen(szText), &textSize);
ReleaseDC(hwndEmails, hdc);
if (hti.pt.x < rc.left + textSize.cx) {
if (szEmail && cchEmail)
- mir_tstrncpy(szEmail, szText, cchEmail);
+ mir_wstrncpy(szEmail, szText, cchEmail);
return 1;
}
return 0;
@@ -284,7 +284,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP break;
lvi.pszText = idstr2;
- mir_sntprintf(idstr2, L"%d", i + 2);
+ mir_snwprintf(idstr2, L"%d", i + 2);
}
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_EMAILS), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_EMAILS), lvi.iItem, 1, dbv.ptszVal);
@@ -298,7 +298,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (db_get_ts(hContact, "UserInfo", idstr, &dbv))
break;
lvi.pszText = idstr2;
- mir_sntprintf(idstr2, TranslateT("Custom %d"), i + 1);
+ mir_snwprintf(idstr2, TranslateT("Custom %d"), i + 1);
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_EMAILS), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_EMAILS), lvi.iItem, 1, dbv.ptszVal);
db_free(&dbv);
@@ -332,7 +332,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
if (mir_strlen(dbv.pszVal) > 4 && !mir_strcmp(dbv.pszVal + mir_strlen(dbv.pszVal) - 4, " SMS")) {
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 2, L"y");
- dbv.ptszVal[mir_tstrlen(dbv.ptszVal) - 4] = '\0';
+ dbv.ptszVal[mir_wstrlen(dbv.ptszVal) - 4] = '\0';
}
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal);
db_free(&dbv);
@@ -359,11 +359,11 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (db_get_ts(hContact, "UserInfo", idstr, &dbv))
break;
lvi.pszText = idstr2;
- mir_sntprintf(idstr2, TranslateT("Custom %d"), i + 1);
+ mir_snwprintf(idstr2, TranslateT("Custom %d"), i + 1);
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
- if (mir_tstrlen(dbv.ptszVal) > 4 && !mir_tstrcmp(dbv.ptszVal + mir_tstrlen(dbv.ptszVal) - 4, L" SMS")) {
+ if (mir_wstrlen(dbv.ptszVal) > 4 && !mir_wstrcmp(dbv.ptszVal + mir_wstrlen(dbv.ptszVal) - 4, L" SMS")) {
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 2, L"y");
- dbv.ptszVal[mir_tstrlen(dbv.ptszVal) - 4] = '\0';
+ dbv.ptszVal[mir_wstrlen(dbv.ptszVal) - 4] = '\0';
}
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal);
db_free(&dbv);
@@ -439,7 +439,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP wchar_t szEmail[256];
if (IsOverEmail(hwndDlg, szEmail, _countof(szEmail))) {
wchar_t szExec[264];
- mir_sntprintf(szExec, L"mailto:%s", szEmail);
+ mir_snwprintf(szExec, L"mailto:%s", szEmail);
ShellExecute(hwndDlg, L"open", szExec, NULL, NULL, SW_SHOW);
break;
}
diff --git a/src/core/stduserinfo/src/stdinfo.cpp b/src/core/stduserinfo/src/stdinfo.cpp index 100ea132d8..bd2420bdca 100644 --- a/src/core/stduserinfo/src/stdinfo.cpp +++ b/src/core/stduserinfo/src/stdinfo.cpp @@ -255,7 +255,7 @@ static INT_PTR CALLBACK SummaryDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_EMAIL))) {
wchar_t szExec[264], szEmail[256];
GetDlgItemText(hwndDlg, IDC_EMAIL, szEmail, _countof(szEmail));
- mir_sntprintf(szExec, L"mailto:%s", szEmail);
+ mir_snwprintf(szExec, L"mailto:%s", szEmail);
ShellExecute(hwndDlg, L"open", szExec, NULL, NULL, SW_SHOW);
}
break;
@@ -442,11 +442,11 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, lvi.iItem = 0;
for (int i = 0;; i++) {
mir_snprintf(idstr, "Past%d", i);
- ptrT tszColText(Proto_GetContactInfoSettingStr(proto_service, hContact, szProto, idstr));
+ ptrW tszColText(Proto_GetContactInfoSettingStr(proto_service, hContact, szProto, idstr));
if (tszColText == NULL)
break;
mir_snprintf(idstr, "Past%dText", i);
- ptrT tszText(db_get_tsa(hContact, szProto, idstr));
+ ptrW tszText(db_get_tsa(hContact, szProto, idstr));
if (tszText == NULL)
break;
@@ -459,11 +459,11 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, // affiliation
for (int i = 0;; i++) {
mir_snprintf(idstr, "Affiliation%d", i);
- ptrT tszColText(Proto_GetContactInfoSettingStr(proto_service, hContact, szProto, idstr));
+ ptrW tszColText(Proto_GetContactInfoSettingStr(proto_service, hContact, szProto, idstr));
if (tszColText == NULL)
break;
mir_snprintf(idstr, "Affiliation%dText", i);
- ptrT tszText(db_get_tsa(hContact, szProto, idstr));
+ ptrW tszText(db_get_tsa(hContact, szProto, idstr));
if (tszText == NULL)
break;
@@ -482,11 +482,11 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, lvi.iItem = 0;
for (int i = 0;; i++) {
mir_snprintf(idstr, "Interest%dCat", i);
- ptrT tszColText(Proto_GetContactInfoSettingStr(proto_service, hContact, szProto, idstr));
+ ptrW tszColText(Proto_GetContactInfoSettingStr(proto_service, hContact, szProto, idstr));
if (tszColText == NULL)
break;
mir_snprintf(idstr, "Interest%dText", i);
- ptrT tszText(db_get_tsa(hContact, szProto, idstr));
+ ptrW tszText(db_get_tsa(hContact, szProto, idstr));
if (tszText == NULL)
break;
@@ -543,12 +543,12 @@ static INT_PTR CALLBACK NotesDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf.lfQuality = DEFAULT_QUALITY;
lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
- mir_tstrcpy(lf.lfFaceName, L"Courier New");
+ mir_wstrcpy(lf.lfFaceName, L"Courier New");
lf.lfCharSet = DEFAULT_CHARSET;
HFONT hFont = CreateFontIndirect(&lf);
SendDlgItemMessage(hwndDlg, IDC_ABOUT, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
- ptrT szNotes(db_get_tsa(lParam, "UserInfo", "MyNotes"));
+ ptrW szNotes(db_get_tsa(lParam, "UserInfo", "MyNotes"));
if (szNotes != nullptr)
SetDlgItemText(hwndDlg, IDC_MYNOTES, szNotes);
}
diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp index 0de846052e..bcb7e20a39 100644 --- a/src/core/stduserinfo/src/userinfo.cpp +++ b/src/core/stduserinfo/src/userinfo.cpp @@ -78,18 +78,18 @@ static int PageSortProc(OPTIONSDIALOGPAGE *item1, OPTIONSDIALOGPAGE *item2) {
int res;
wchar_t *s1 = getTitle(item1), *s2 = getTitle(item2);
- if (!mir_tstrcmp(s1, TranslateT("Summary"))) return -1;
- if (!mir_tstrcmp(s2, TranslateT("Summary"))) return 1;
- if (res = mir_tstrcmp(s1, s2)) return res;
+ if (!mir_wstrcmp(s1, TranslateT("Summary"))) return -1;
+ if (!mir_wstrcmp(s2, TranslateT("Summary"))) return 1;
+ if (res = mir_wstrcmp(s1, s2)) return res;
s1 = getTab(item1), s2 = getTab(item2);
if (s1 && !s2) return -1;
if (!s1 && s2) return 1;
if (!s1 && !s2) return 0;
- if (s1 && !mir_tstrcmp(s1, TranslateT("General"))) return -1;
- if (s2 && !mir_tstrcmp(s2, TranslateT("General"))) return 1;
- return mir_tstrcmp(s1, s2);
+ if (s1 && !mir_wstrcmp(s1, TranslateT("General"))) return -1;
+ if (s2 && !mir_wstrcmp(s2, TranslateT("General"))) return 1;
+ return mir_wstrcmp(s1, s2);
}
static INT_PTR ShowDetailsDialogCommand(WPARAM wParam, LPARAM)
@@ -151,8 +151,8 @@ static INT_PTR AddDetailsPage(WPARAM wParam, LPARAM lParam) dst->pwszTab = (!(odp->flags & ODPF_USERINFOTAB) || !odp->pwszTab) ? NULL : mir_wstrdup(odp->pwszTab);
}
else {
- dst->pwszTitle = mir_a2t(odp->pszTitle);
- dst->pwszTab = (!(odp->flags & ODPF_USERINFOTAB) || !odp->pszTab) ? NULL : mir_a2t(odp->pszTab);
+ dst->pwszTitle = mir_a2u(odp->pszTitle);
+ dst->pwszTab = (!(odp->flags & ODPF_USERINFOTAB) || !odp->pszTab) ? NULL : mir_a2u(odp->pszTab);
}
dst->hLangpack = odp->hLangpack;
@@ -180,13 +180,13 @@ static void CreateDetailsTabs(HWND hwndDlg, DetailsData *dat, DetailsPageData *p TabCtrl_DeleteAllItems(hwndTab);
for (int i = 0; i < dat->pageCount; i++) {
DetailsPageData &odp = dat->opd[i];
- if (!odp.ptszTab || mir_tstrcmp(odp.ptszTitle, ppg->ptszTitle))
+ if (!odp.ptszTab || mir_wstrcmp(odp.ptszTitle, ppg->ptszTitle))
continue;
tie.pszText = TranslateTH(odp.hLangpack, odp.ptszTab);
tie.lParam = i;
TabCtrl_InsertItem(hwndTab, pages, &tie);
- if (!mir_tstrcmp(odp.ptszTab, ppg->ptszTab))
+ if (!mir_wstrcmp(odp.ptszTab, ppg->ptszTab))
sel = pages;
pages++;
}
@@ -255,7 +255,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP name = pcli->pfnGetContactDisplayName(dat->hContact, 0);
GetWindowText(hwndDlg, oldTitle, _countof(oldTitle));
- mir_sntprintf(newTitle, oldTitle, name);
+ mir_snwprintf(newTitle, oldTitle, name);
SetWindowText(hwndDlg, newTitle);
//////////////////////////////////////////////////////////////////////
@@ -293,7 +293,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP p.ptszTab = odp[i].pwszTab;
p.hLangpack = odp[i].hLangpack;
- if (i && p.ptszTab && !mir_tstrcmp(dat->opd[i - 1].ptszTitle, p.ptszTitle)) {
+ if (i && p.ptszTab && !mir_wstrcmp(dat->opd[i - 1].ptszTitle, p.ptszTitle)) {
p.hItem = dat->opd[i - 1].hItem;
continue;
}
@@ -307,7 +307,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP tvis.item.pszText = p.ptszTitle;
else
tvis.item.pszText = TranslateTH(p.hLangpack, p.ptszTitle);
- if (ptszLastTab && !mir_tstrcmp(tvis.item.pszText, ptszLastTab))
+ if (ptszLastTab && !mir_wstrcmp(tvis.item.pszText, ptszLastTab))
dat->currentPage = i;
p.hItem = TreeView_InsertItem(hwndTree, &tvis);
}
@@ -355,7 +355,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_TIMER:
wchar_t str[128];
- mir_sntprintf(str, L"%.*s%s%.*s", dat->updateAnimFrame % 10, L".........", dat->szUpdating, dat->updateAnimFrame % 10, L".........");
+ mir_snwprintf(str, L"%.*s%s%.*s", dat->updateAnimFrame % 10, L".........", dat->szUpdating, dat->updateAnimFrame % 10, L".........");
SetDlgItemText(hwndDlg, IDC_UPDATING, str);
if (++dat->updateAnimFrame == UPDATEANIMFRAMES)
dat->updateAnimFrame = 0;
diff --git a/src/core/stduseronline/src/useronline.cpp b/src/core/stduseronline/src/useronline.cpp index 6106fd64a4..9deeccecaf 100644 --- a/src/core/stduseronline/src/useronline.cpp +++ b/src/core/stduseronline/src/useronline.cpp @@ -58,7 +58,7 @@ static int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam) // only play the sound (or show event) if this event happens at least 10 secs after the proto went from offline
if (GetTickCount() - ticked > (1000*10)) {
wchar_t tooltip[256];
- mir_sntprintf(tooltip, TranslateT("%s is online"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_snwprintf(tooltip, TranslateT("%s is online"), pcli->pfnGetContactDisplayName(hContact, 0));
CLISTEVENT cle = {};
cle.flags = CLEF_ONLYAFEW | CLEF_TCHAR;
diff --git a/src/mir_app/src/BaseExtraIcon.cpp b/src/mir_app/src/BaseExtraIcon.cpp index 1aa6b40057..5b9ef3d930 100644 --- a/src/mir_app/src/BaseExtraIcon.cpp +++ b/src/mir_app/src/BaseExtraIcon.cpp @@ -28,7 +28,7 @@ BaseExtraIcon::BaseExtraIcon(int id, const char *name, const wchar_t *descriptio m_id(id),
m_OnClick(OnClick),
m_onClickParam(param),
- m_tszDescription(mir_tstrdup(description)),
+ m_tszDescription(mir_wstrdup(description)),
m_szDescIcon(mir_strdup(descIcon))
{
}
@@ -55,7 +55,7 @@ const wchar_t* BaseExtraIcon::getDescription() const void BaseExtraIcon::setDescription(const wchar_t *desc)
{
- m_tszDescription = mir_tstrdup(desc);
+ m_tszDescription = mir_wstrdup(desc);
}
const char* BaseExtraIcon::getDescIcon() const
diff --git a/src/mir_app/src/ExtraIcon.h b/src/mir_app/src/ExtraIcon.h index 7b701c11c9..00bee2dbfc 100644 --- a/src/mir_app/src/ExtraIcon.h +++ b/src/mir_app/src/ExtraIcon.h @@ -89,7 +89,7 @@ public: protected:
int m_id;
- ptrT m_tszDescription;
+ ptrW m_tszDescription;
ptrA m_szDescIcon;
MIRANDAHOOKPARAM m_OnClick;
LPARAM m_onClickParam;
@@ -170,7 +170,7 @@ public: virtual int ClistSetExtraIcon(MCONTACT hContact, HANDLE hImage);
protected:
- ptrT m_tszDescription;
+ ptrW m_tszDescription;
bool m_setValidExtraIcon;
bool m_insideApply;
diff --git a/src/mir_app/src/ExtraIconGroup.cpp b/src/mir_app/src/ExtraIconGroup.cpp index 6ed364f50b..7101175272 100644 --- a/src/mir_app/src/ExtraIconGroup.cpp +++ b/src/mir_app/src/ExtraIconGroup.cpp @@ -45,7 +45,7 @@ void ExtraIconGroup::addExtraIcon(BaseExtraIcon *extra) description += m_items[i]->getDescription();
}
- m_tszDescription = mir_tstrdup(description);
+ m_tszDescription = mir_wstrdup(description);
}
void ExtraIconGroup::rebuildIcons()
diff --git a/src/mir_app/src/FontOptions.cpp b/src/mir_app/src/FontOptions.cpp index ef20702b7a..30a6aa4d5e 100644 --- a/src/mir_app/src/FontOptions.cpp +++ b/src/mir_app/src/FontOptions.cpp @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static int sttCompareFont(const FontInternal* p1, const FontInternal* p2)
{
- int result = mir_tstrcmp(p1->group, p2->group);
+ int result = mir_wstrcmp(p1->group, p2->group);
if (result != 0)
return result;
@@ -38,14 +38,14 @@ static int sttCompareFont(const FontInternal* p1, const FontInternal* p2) if (result != 0)
return result;
- return mir_tstrcmp(p1->getName(), p2->getName());
+ return mir_wstrcmp(p1->getName(), p2->getName());
}
OBJLIST<FontInternal> font_id_list(20, sttCompareFont), font_id_list_w2(20, sttCompareFont), font_id_list_w3(20, sttCompareFont);
static int sttCompareColour(const ColourInternal* p1, const ColourInternal* p2)
{
- int result = mir_tstrcmp(p1->group, p2->group);
+ int result = mir_wstrcmp(p1->group, p2->group);
if (result != 0)
return result;
@@ -53,14 +53,14 @@ static int sttCompareColour(const ColourInternal* p1, const ColourInternal* p2) if (result != 0)
return result;
- return mir_tstrcmp(p1->getName(), p2->getName());
+ return mir_wstrcmp(p1->getName(), p2->getName());
}
OBJLIST<ColourInternal> colour_id_list(10, sttCompareColour), colour_id_list_w2(10, sttCompareColour), colour_id_list_w3(10, sttCompareColour);
static int sttCompareEffect(const EffectInternal* p1, const EffectInternal* p2)
{
- int result = mir_tstrcmp(p1->group, p2->group);
+ int result = mir_wstrcmp(p1->group, p2->group);
if (result != 0)
return result;
@@ -68,7 +68,7 @@ static int sttCompareEffect(const EffectInternal* p1, const EffectInternal* p2) if (result != 0)
return result;
- return mir_tstrcmp(p1->getName(), p2->getName());
+ return mir_wstrcmp(p1->getName(), p2->getName());
}
OBJLIST<EffectInternal> effect_id_list(10, sttCompareEffect), effect_id_list_w2(10, sttCompareEffect), effect_id_list_w3(10, sttCompareEffect);
@@ -261,12 +261,12 @@ static BOOL sttFsuiBindColourIdToFonts(HWND hwndList, const wchar_t *name, const if (itemData && itemData->font_id >= 0) {
FontInternal& F = font_id_list_w2[itemData->font_id];
- if (name && !mir_tstrcmp(F.name, name)) {
+ if (name && !mir_wstrcmp(F.name, name)) {
itemData->colour_id = colourId;
res = TRUE;
}
- if (backgroundGroup && backgroundName && !mir_tstrcmp(F.backgroundGroup, backgroundGroup) && !mir_tstrcmp(F.backgroundName, backgroundName)) {
+ if (backgroundGroup && backgroundName && !mir_wstrcmp(F.backgroundGroup, backgroundGroup) && !mir_wstrcmp(F.backgroundName, backgroundName)) {
itemData->colour_id = colourId;
res = TRUE;
}
@@ -283,7 +283,7 @@ static bool sttFsuiBindEffectIdToFonts(HWND hwndList, const wchar_t *name, int e if (itemData && itemData->font_id >= 0) {
FontInternal& F = font_id_list_w2[itemData->font_id];
- if (name && !mir_tstrcmp(F.name, name)) {
+ if (name && !mir_wstrcmp(F.name, name)) {
itemData->effect_id = effectId;
return true;
}
@@ -313,7 +313,7 @@ static HTREEITEM sttFindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const wc while (tvi.hItem) {
TreeView_GetItem(hwndTree, &tvi);
- if (!mir_tstrcmp(tvi.pszText, name))
+ if (!mir_wstrcmp(tvi.pszText, name))
return tvi.hItem;
tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
@@ -328,7 +328,7 @@ static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const wchar_t *groupNam int sectionLevel = 0;
HTREEITEM hSection = NULL;
- mir_tstrcpy(itemName, groupName);
+ mir_wstrcpy(itemName, groupName);
sectionName = itemName;
while (sectionName) {
@@ -347,8 +347,8 @@ static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const wchar_t *groupNam if (!hItem) {
TVINSERTSTRUCT tvis = { 0 };
TreeItem *treeItem = (TreeItem *)mir_alloc(sizeof(TreeItem));
- treeItem->groupName = sectionName ? NULL : mir_tstrdup(groupName);
- treeItem->paramName = mir_t2a(itemName);
+ treeItem->groupName = sectionName ? NULL : mir_wstrdup(groupName);
+ treeItem->paramName = mir_u2a(itemName);
tvis.hParent = hSection;
tvis.hInsertAfter = TVI_SORT;//TVI_LAST;
@@ -639,7 +639,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_ADDSTRING, (WPARAM)-1, (LPARAM)itemData);
}
- if (mir_tstrcmp(C.name, L"Background") == 0)
+ if (mir_wstrcmp(C.name, L"Background") == 0)
hBkgColourBrush = CreateSolidBrush(C.value);
}
}
@@ -711,7 +711,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, hoFont = (HFONT)SelectObject(hdc, (HFONT)SendDlgItemMessage(hwndDlg, mis->CtlID, WM_GETFONT, 0, 0));
SIZE fontSize;
- GetTextExtentPoint32(hdc, itemName, (int)mir_tstrlen(itemName), &fontSize);
+ GetTextExtentPoint32(hdc, itemName, (int)mir_wstrlen(itemName), &fontSize);
if (hoFont) SelectObject(hdc, hoFont);
if (hFont) DeleteObject(hFont);
ReleaseDC(GetDlgItem(hwndDlg, mis->CtlID), hdc);
@@ -828,7 +828,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, }
rc = dis->rcItem;
rc.left += FSUI_FONTLEFT;
- DrawTextWithEffect(dis->hDC, itemName, (int)mir_tstrlen(itemName), &rc, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_WORD_ELLIPSIS, pEffect);
+ DrawTextWithEffect(dis->hDC, itemName, (int)mir_wstrlen(itemName), &rc, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_WORD_ELLIPSIS, pEffect);
}
else {
RECT rc;
@@ -853,7 +853,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, rc = dis->rcItem;
rc.left += FSUI_FONTLEFT;
- DrawTextWithEffect(dis->hDC, itemName, (int)mir_tstrlen(itemName), &rc, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_WORD_ELLIPSIS, pEffect);
+ DrawTextWithEffect(dis->hDC, itemName, (int)mir_wstrlen(itemName), &rc, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_WORD_ELLIPSIS, pEffect);
}
if (hoFont) SelectObject(dis->hDC, hoFont);
if (hFont) DeleteObject(hFont);
@@ -1028,7 +1028,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, if (itemData->colour_id < 0) continue;
colour_id_list_w2[itemData->colour_id].value = SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_GETCOLOUR, 0, 0);
- if (mir_tstrcmp(colour_id_list_w2[itemData->colour_id].name, L"Background") == 0) {
+ if (mir_wstrcmp(colour_id_list_w2[itemData->colour_id].name, L"Background") == 0) {
if (hBkgColourBrush) DeleteObject(hBkgColourBrush);
hBkgColourBrush = CreateSolidBrush(colour_id_list_w2[itemData->colour_id].value);
}
@@ -1075,7 +1075,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, case IDC_BTN_EXPORT:
{
wchar_t fname_buff[MAX_PATH], filter[MAX_PATH];
- mir_sntprintf(filter, L"%s (*.ini)%c*.ini%c%s (*.txt)%c*.TXT%c%s (*.*)%c*.*%c", TranslateT("Configuration files"), 0, 0, TranslateT("Text files"), 0, 0, TranslateT("All files"), 0, 0);
+ mir_snwprintf(filter, L"%s (*.ini)%c*.ini%c%s (*.txt)%c*.TXT%c%s (*.*)%c*.*%c", TranslateT("Configuration files"), 0, 0, TranslateT("Text files"), 0, 0, TranslateT("All files"), 0, 0);
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
diff --git a/src/mir_app/src/IcoLib.h b/src/mir_app/src/IcoLib.h index 2d8932e406..5510e92996 100644 --- a/src/mir_app/src/IcoLib.h +++ b/src/mir_app/src/IcoLib.h @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct SectionItem : public MZeroedObject
{
- ptrT name;
+ ptrW name;
int flags, maxOrder, ref_count;
};
diff --git a/src/mir_app/src/addcontact.cpp b/src/mir_app/src/addcontact.cpp index e9a729541f..fb6380f9e7 100644 --- a/src/mir_app/src/addcontact.cpp +++ b/src/mir_app/src/addcontact.cpp @@ -27,12 +27,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static wchar_t* sttDecodeString(DWORD dwFlags, MAllStrings &src)
{
if (dwFlags & PSR_UNICODE)
- return mir_u2t(src.w);
+ return mir_wstrdup(src.w);
if (dwFlags & PSR_UTF8)
- return mir_utf8decodeT(src.a);
+ return mir_utf8decodeW(src.a);
- return mir_a2t(src.a);
+ return mir_a2u(src.a);
}
class CAddContactDlg : public CDlgBase
@@ -99,7 +99,7 @@ public: if (!isSet)
{
if (m_acs.handleType == HANDLE_EVENT)
- szName = mir_a2t(szUin);
+ szName = mir_a2u(szUin);
else
{
szName = sttDecodeString(m_acs.psr->flags, m_acs.psr->id);
@@ -120,11 +120,11 @@ public: m_acs.szProto = GetContactProto(m_acs.hContact);
int groupSel = 0;
- ptrT tszGroup(db_get_tsa(hContact, "CList", "Group"));
+ ptrW tszGroup(db_get_tsa(hContact, "CList", "Group"));
wchar_t *grpName;
for (int groupId = 1; (grpName = Clist_GroupGetName(groupId, NULL)) != NULL; groupId++) {
int id = m_group.AddString(grpName, groupId);
- if (!mir_tstrcmpi(tszGroup, grpName))
+ if (!mir_wstrcmpi(tszGroup, grpName))
groupSel = id;
}
@@ -198,8 +198,8 @@ public: if (hContact == NULL)
return;
- ptrT szHandle(m_myHandle.GetText());
- if (mir_tstrlen(szHandle))
+ ptrW szHandle(m_myHandle.GetText());
+ if (mir_wstrlen(szHandle))
db_set_ts(hContact, "CList", "MyHandle", szHandle);
int item = m_group.GetCurSel();
@@ -216,7 +216,7 @@ public: if (flags & PF4_NOCUSTOMAUTH)
ProtoChainSend(hContact, PSS_AUTHREQUEST, 0, 0);
else
- ProtoChainSend(hContact, PSS_AUTHREQUEST, 0, ptrT(m_authReq.GetText()));
+ ProtoChainSend(hContact, PSS_AUTHREQUEST, 0, ptrW(m_authReq.GetText()));
}
if (m_chkOpen.GetState())
diff --git a/src/mir_app/src/button.cpp b/src/mir_app/src/button.cpp index f687df9c8b..c020904f0d 100644 --- a/src/mir_app/src/button.cpp +++ b/src/mir_app/src/button.cpp @@ -205,7 +205,7 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint) SIZE sz;
wchar_t szText[MAX_PATH];
GetWindowText(ctl->hwnd, szText, _countof(szText));
- GetTextExtentPoint32(hdcMem, szText, (int)mir_tstrlen(szText), &sz);
+ GetTextExtentPoint32(hdcMem, szText, (int)mir_wstrlen(szText), &sz);
int xOffset = (rcClient.right - rcClient.left - sz.cx)/2;
int yOffset = (rcClient.bottom - rcClient.top - sz.cy)/2;
@@ -489,12 +489,10 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR ti.lpszText = mir_wstrdup(TranslateTS((WCHAR*)wParam));
else
ti.lpszText = Langpack_PcharToTchar((char*)wParam);
- if (bct->pAccPropServices) {
- wchar_t *tmpstr = mir_t2u(ti.lpszText);
- bct->pAccPropServices->SetHwndPropStr(bct->hwnd, OBJID_CLIENT,
- CHILDID_SELF, PROPID_ACC_DESCRIPTION, tmpstr);
- mir_free(tmpstr);
- }
+
+ if (bct->pAccPropServices)
+ bct->pAccPropServices->SetHwndPropStr(bct->hwnd, OBJID_CLIENT, CHILDID_SELF, PROPID_ACC_DESCRIPTION, ti.lpszText);
+
SendMessage(bct->hwndToolTips, TTM_ADDTOOL, 0, (LPARAM)&ti);
mir_free(ti.lpszText);
}
diff --git a/src/mir_app/src/chat_clist.cpp b/src/mir_app/src/chat_clist.cpp index 755904e390..ea92494bc7 100644 --- a/src/mir_app/src/chat_clist.cpp +++ b/src/mir_app/src/chat_clist.cpp @@ -25,11 +25,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. MCONTACT AddRoom(const char *pszModule, const wchar_t *pszRoom, const wchar_t *pszDisplayName, int iType)
{
wchar_t pszGroup[50]; *pszGroup = '\0';
- ptrT groupName(db_get_tsa(NULL, CHAT_MODULE, "AddToGroup"));
+ ptrW groupName(db_get_tsa(NULL, CHAT_MODULE, "AddToGroup"));
if (groupName)
wcsncpy_s(pszGroup, groupName, _TRUNCATE);
else
- mir_tstrcpy(pszGroup, L"Chat rooms");
+ mir_wstrcpy(pszGroup, L"Chat rooms");
if (pszGroup[0]) {
MGROUP hGroup = Clist_GroupExists(pszGroup);
@@ -43,8 +43,8 @@ MCONTACT AddRoom(const char *pszModule, const wchar_t *pszRoom, const wchar_t *p MCONTACT hContact = chatApi.FindRoom(pszModule, pszRoom);
if (hContact) { //contact exist, make sure it is in the right group
if (pszGroup[0]) {
- ptrT grpName(db_get_tsa(hContact, "CList", "Group"));
- if (!mir_tstrcmp(pszGroup, grpName))
+ ptrW grpName(db_get_tsa(hContact, "CList", "Group"));
+ if (!mir_wstrcmp(pszGroup, grpName))
db_set_ts(hContact, "CList", "Group", pszGroup);
}
@@ -110,7 +110,7 @@ int RoomDoubleclicked(WPARAM hContact, LPARAM) if (db_get_b(hContact, szProto, "ChatRoom", 0) == 0)
return 0;
- ptrT roomid(db_get_tsa(hContact, szProto, "ChatRoomID"));
+ ptrW roomid(db_get_tsa(hContact, szProto, "ChatRoomID"));
if (roomid == NULL)
return 0;
@@ -202,12 +202,12 @@ BOOL AddEvent(MCONTACT hContact, HICON hIcon, MEVENT hEvent, int type, wchar_t* {
wchar_t szBuf[4096];
- if (!fmt || !fmt[0] || mir_tstrlen(fmt) > 2000)
+ if (!fmt || !fmt[0] || mir_wstrlen(fmt) > 2000)
return FALSE;
va_list marker;
va_start(marker, fmt);
- mir_vsntprintf(szBuf, _countof(szBuf), fmt, marker);
+ mir_vsnwprintf(szBuf, _countof(szBuf), fmt, marker);
va_end(marker);
CLISTEVENT cle = {};
@@ -235,8 +235,8 @@ MCONTACT FindRoom(const char *pszModule, const wchar_t *pszRoom) if (!db_get_b(hContact, pszModule, "ChatRoom", 0))
continue;
- ptrT roomid(db_get_tsa(hContact, pszModule, "ChatRoomID"));
- if (roomid != NULL && !mir_tstrcmpi(roomid, pszRoom))
+ ptrW roomid(db_get_tsa(hContact, pszModule, "ChatRoomID"));
+ if (roomid != NULL && !mir_wstrcmpi(roomid, pszRoom))
return hContact;
}
diff --git a/src/mir_app/src/chat_log.cpp b/src/mir_app/src/chat_log.cpp index 590ceb0f9d..529d1b423a 100644 --- a/src/mir_app/src/chat_log.cpp +++ b/src/mir_app/src/chat_log.cpp @@ -111,7 +111,7 @@ static int Log_AppendRTF(LOGSTREAMDATA *streamData, BOOL simpleMode, char *&buff wchar_t* line = (wchar_t*)alloca(8001 * sizeof(wchar_t));
va_start(va, fmt);
- lineLen = mir_vsntprintf(line, 8000, fmt, va);
+ lineLen = mir_vsnwprintf(line, 8000, fmt, va);
if (lineLen < 0) lineLen = 8000;
line[lineLen] = 0;
va_end(va);
@@ -225,14 +225,14 @@ static void AddEventToBuffer(char *&buffer, size_t &bufferEnd, size_t &bufferAll wchar_t szTemp[512], szTemp2[512];
wchar_t* pszNick = NULL;
if (streamData->lin->ptszNick) {
- if (g_Settings->bLogLimitNames && mir_tstrlen(streamData->lin->ptszNick) > 20) {
- mir_tstrncpy(szTemp2, streamData->lin->ptszNick, 20);
- mir_tstrncpy(szTemp2 + 20, L"...", 4);
+ if (g_Settings->bLogLimitNames && mir_wstrlen(streamData->lin->ptszNick) > 20) {
+ mir_wstrncpy(szTemp2, streamData->lin->ptszNick, 20);
+ mir_wstrncpy(szTemp2 + 20, L"...", 4);
}
- else mir_tstrncpy(szTemp2, streamData->lin->ptszNick, 511);
+ else mir_wstrncpy(szTemp2, streamData->lin->ptszNick, 511);
if (streamData->lin->ptszUserInfo)
- mir_sntprintf(szTemp, L"%s (%s)", szTemp2, streamData->lin->ptszUserInfo);
+ mir_snwprintf(szTemp, L"%s (%s)", szTemp2, streamData->lin->ptszUserInfo);
else
wcsncpy_s(szTemp, szTemp2, _TRUNCATE);
pszNick = szTemp;
@@ -382,9 +382,9 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData) if (g_Settings->bShowTime) {
wchar_t szTimeStamp[30], szOldTimeStamp[30];
- mir_tstrncpy(szTimeStamp, MakeTimeStamp(g_Settings->pszTimeStamp, lin->time), 30);
- mir_tstrncpy(szOldTimeStamp, MakeTimeStamp(g_Settings->pszTimeStamp, streamData->si->LastTime), 30);
- if (!g_Settings->bShowTimeIfChanged || streamData->si->LastTime == 0 || mir_tstrcmp(szTimeStamp, szOldTimeStamp)) {
+ mir_wstrncpy(szTimeStamp, MakeTimeStamp(g_Settings->pszTimeStamp, lin->time), 30);
+ mir_wstrncpy(szOldTimeStamp, MakeTimeStamp(g_Settings->pszTimeStamp, streamData->si->LastTime), 30);
+ if (!g_Settings->bShowTimeIfChanged || streamData->si->LastTime == 0 || mir_wstrcmp(szTimeStamp, szOldTimeStamp)) {
streamData->si->LastTime = lin->time;
Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced, L"%s", szTimeStamp);
}
@@ -396,7 +396,7 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData) wchar_t pszTemp[300], *p1;
Log_Append(buffer, bufferEnd, bufferAlloced, "%s ", Log_SetStyle(lin->bIsMe ? 2 : 1));
- mir_tstrncpy(pszTemp, lin->bIsMe ? g_Settings->pszOutgoingNick : g_Settings->pszIncomingNick, 299);
+ mir_wstrncpy(pszTemp, lin->bIsMe ? g_Settings->pszOutgoingNick : g_Settings->pszIncomingNick, 299);
p1 = wcsstr(pszTemp, L"%n");
if (p1)
p1[1] = 's';
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp index 0e3a3bf276..f031dd24b3 100644 --- a/src/mir_app/src/chat_manager.cpp +++ b/src/mir_app/src/chat_manager.cpp @@ -33,7 +33,7 @@ MODULEINFO *m_ModList = 0; static void SetActiveSessionEx(SESSION_INFO *si)
{
if (si) {
- replaceStrT(chatApi.szActiveWndID, si->ptszID);
+ replaceStrW(chatApi.szActiveWndID, si->ptszID);
replaceStr(chatApi.szActiveWndModule, si->pszModule);
}
}
@@ -66,7 +66,7 @@ static SESSION_INFO* SM_AddSession(const wchar_t *pszID, const char *pszModule) return NULL;
SESSION_INFO *node = (SESSION_INFO*)mir_calloc(g_cbSession);
- node->ptszID = mir_tstrdup(pszID);
+ node->ptszID = mir_wstrdup(pszID);
node->pszModule = mir_strdup(pszModule);
if (chatApi.wndList == NULL) { // list is empty
@@ -122,7 +122,7 @@ static int SM_RemoveSession(const wchar_t *pszID, const char *pszModule, BOOL re SESSION_INFO *pTemp = chatApi.wndList, *pLast = NULL;
while (pTemp != NULL) {
// match
- if ((!pszID && pTemp->iType != GCW_SERVER || !mir_tstrcmpi(pTemp->ptszID, pszID)) && !mir_strcmpi(pTemp->pszModule, pszModule)) {
+ if ((!pszID && pTemp->iType != GCW_SERVER || !mir_wstrcmpi(pTemp->ptszID, pszID)) && !mir_strcmpi(pTemp->pszModule, pszModule)) {
DWORD dw = pTemp->dwItemData;
if (chatApi.OnRemoveSession)
@@ -162,7 +162,7 @@ static SESSION_INFO* SM_FindSession(const wchar_t *pszID, const char *pszModule) return NULL;
for (SESSION_INFO *si = chatApi.wndList; si != NULL; si = si->next)
- if (!mir_tstrcmpi(si->ptszID, pszID) && !mir_strcmpi(si->pszModule, pszModule))
+ if (!mir_wstrcmpi(si->ptszID, pszID) && !mir_strcmpi(si->pszModule, pszModule))
return si;
return NULL;
@@ -174,7 +174,7 @@ static BOOL SM_SetOffline(const wchar_t *pszID, const char *pszModule) return FALSE;
for (SESSION_INFO *si = chatApi.wndList; si != NULL; si = si->next) {
- if ((pszID && mir_tstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
+ if ((pszID && mir_wstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
continue;
chatApi.UM_RemoveAll(&si->pUsers);
@@ -196,7 +196,7 @@ static BOOL SM_SetStatusEx(const wchar_t *pszID, const char *pszModule, const wc return FALSE;
for (SESSION_INFO *si = chatApi.wndList; si != NULL; si = si->next) {
- if ((pszID && mir_tstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
+ if ((pszID && mir_wstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
continue;
chatApi.UM_SetStatusEx(si->pUsers, pszText, flags);
@@ -258,10 +258,10 @@ static BOOL SM_AddEvent(const wchar_t *pszID, const char *pszModule, GCEVENT *gc p->iEventCount += 1;
li->iType = gce->pDest->iType;
- li->ptszNick = mir_tstrdup(gce->ptszNick);
- li->ptszText = mir_tstrdup(gce->ptszText);
- li->ptszStatus = mir_tstrdup(gce->ptszStatus);
- li->ptszUserInfo = mir_tstrdup(gce->ptszUserInfo);
+ li->ptszNick = mir_wstrdup(gce->ptszNick);
+ li->ptszText = mir_wstrdup(gce->ptszText);
+ li->ptszStatus = mir_wstrdup(gce->ptszStatus);
+ li->ptszUserInfo = mir_wstrdup(gce->ptszUserInfo);
li->bIsMe = gce->bIsMe;
li->time = gce->time;
@@ -308,7 +308,7 @@ static BOOL SM_RemoveUser(const wchar_t *pszID, const char *pszModule, const wch return FALSE;
for (SESSION_INFO *si = chatApi.wndList; si != NULL; si = si->next) {
- if ((pszID && mir_tstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
+ if ((pszID && mir_wstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
continue;
USERINFO *ui = chatApi.UM_FindUser(si->pUsers, pszUID);
@@ -403,7 +403,7 @@ static LRESULT SM_SendMessage(const wchar_t *pszID, const char *pszModule, UINT return 0;
for (SESSION_INFO *si = chatApi.wndList; si != NULL; si = si->next) {
- if ((pszID && mir_tstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
+ if ((pszID && mir_wstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
continue;
if (si->hWnd) {
@@ -450,7 +450,7 @@ static BOOL SM_SetStatus(const wchar_t *pszID, const char *pszModule, int wStatu return FALSE;
for (SESSION_INFO *si = chatApi.wndList; si != NULL; si = si->next) {
- if ((pszID && mir_tstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
+ if ((pszID && mir_wstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
continue;
si->wStatus = wStatus;
@@ -476,7 +476,7 @@ static BOOL SM_SendUserMessage(const wchar_t *pszID, const char *pszModule, cons return FALSE;
for (SESSION_INFO *si = chatApi.wndList; si != NULL; si = si->next) {
- if ((pszID && mir_tstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
+ if ((pszID && mir_wstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
continue;
if (si->iType == GCW_CHATROOM || si->iType == GCW_PRIVMESS)
@@ -493,12 +493,12 @@ static BOOL SM_ChangeUID(const wchar_t *pszID, const char *pszModule, const wcha return FALSE;
for (SESSION_INFO *si = chatApi.wndList; si != NULL; si = si->next) {
- if ((pszID && mir_tstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
+ if ((pszID && mir_wstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
continue;
USERINFO *ui = chatApi.UM_FindUser(si->pUsers, pszUID);
if (ui)
- replaceStrT(ui->pszUID, pszNewUID);
+ replaceStrW(ui->pszUID, pszNewUID);
if (pszID)
return TRUE;
}
@@ -511,10 +511,10 @@ static BOOL SM_ChangeNick(const wchar_t *pszID, const char *pszModule, GCEVENT * return FALSE;
for (SESSION_INFO *si = chatApi.wndList; si != NULL; si = si->next) {
- if ((!pszID || !mir_tstrcmpi(si->ptszID, pszID)) && !mir_strcmpi(si->pszModule, pszModule)) {
+ if ((!pszID || !mir_wstrcmpi(si->ptszID, pszID)) && !mir_strcmpi(si->pszModule, pszModule)) {
USERINFO *ui = chatApi.UM_FindUser(si->pUsers, gce->ptszUID);
if (ui) {
- replaceStrT(ui->pszNick, gce->ptszText);
+ replaceStrW(ui->pszNick, gce->ptszText);
SM_MoveUser(si->ptszID, si->pszModule, ui->pszUID);
if (si->hWnd)
SendMessage(si->hWnd, GC_UPDATENICKLIST, 0, 0);
@@ -670,7 +670,7 @@ static char* SM_GetUsers(SESSION_INFO *si) char* p = NULL;
size_t alloced = 0;
do {
- size_t pLen = mir_strlen(p), nameLen = mir_tstrlen(utemp->pszUID);
+ size_t pLen = mir_strlen(p), nameLen = mir_wstrlen(utemp->pszUID);
if (pLen + nameLen + 2 > alloced)
p = (char*)mir_realloc(p, alloced += 4096);
@@ -795,7 +795,7 @@ static STATUSINFO* TM_AddStatus(STATUSINFO **ppStatusList, const wchar_t *pszSta if (!chatApi.TM_FindStatus(*ppStatusList, pszStatus)) {
STATUSINFO *node = (STATUSINFO*)mir_alloc(sizeof(STATUSINFO));
memset(node, 0, sizeof(STATUSINFO));
- replaceStrT(node->pszGroup, pszStatus);
+ replaceStrW(node->pszGroup, pszStatus);
node->hIcon = (HICON)(*iCount);
while ((INT_PTR)node->hIcon > STATUSICONCOUNT - 1)
node->hIcon--;
@@ -822,7 +822,7 @@ static STATUSINFO* TM_FindStatus(STATUSINFO *pStatusList, const wchar_t *pszStat return NULL;
for (STATUSINFO *pTemp = pStatusList; pTemp != NULL; pTemp = pTemp->next)
- if (mir_tstrcmpi(pTemp->pszGroup, pszStatus) == 0)
+ if (mir_wstrcmpi(pTemp->pszGroup, pszStatus) == 0)
return pTemp;
return 0;
@@ -834,7 +834,7 @@ static WORD TM_StringToWord(STATUSINFO *pStatusList, const wchar_t *pszStatus) return 0;
for (STATUSINFO *pTemp = pStatusList; pTemp != NULL; pTemp = pTemp->next) {
- if (mir_tstrcmpi(pTemp->pszGroup, pszStatus) == 0)
+ if (mir_wstrcmpi(pTemp->pszGroup, pszStatus) == 0)
return pTemp->Status;
if (pTemp->next == NULL)
@@ -893,12 +893,12 @@ static int UM_CompareItem(USERINFO *u1, const wchar_t *pszNick, WORD wStatus) if ((dw2 & 1) && !(dw1 & 1))
return 1;
if ((dw1 & 1) && (dw2 & 1))
- return mir_tstrcmpi(u1->pszNick, pszNick);
+ return mir_wstrcmpi(u1->pszNick, pszNick);
dw1 = dw1 >> 1;
dw2 = dw2 >> 1;
}
- return mir_tstrcmpi(u1->pszNick, pszNick);
+ return mir_wstrcmpi(u1->pszNick, pszNick);
}
static USERINFO* UM_SortUser(USERINFO **ppUserList, const wchar_t *pszUID)
@@ -907,7 +907,7 @@ static USERINFO* UM_SortUser(USERINFO **ppUserList, const wchar_t *pszUID) if (!ui || !pszUID)
return NULL;
- while (ui && mir_tstrcmpi(ui->pszUID, pszUID)) {
+ while (ui && mir_wstrcmpi(ui->pszUID, pszUID)) {
pLast = ui;
ui = ui->next;
}
@@ -960,7 +960,7 @@ USERINFO* UM_AddUser(STATUSINFO *pStatusList, USERINFO **ppUserList, const wchar // if (!UM_FindUser(*ppUserList, pszUI, wStatus)
USERINFO *node = (USERINFO*)mir_calloc(sizeof(USERINFO));
- replaceStrT(node->pszUID, pszUID);
+ replaceStrW(node->pszUID, pszUID);
if (*ppUserList == NULL) { // list is empty
*ppUserList = node;
@@ -986,7 +986,7 @@ static USERINFO* UM_FindUser(USERINFO *pUserList, const wchar_t *pszUID) return NULL;
for (USERINFO *ui = pUserList; ui != NULL; ui = ui->next)
- if (!mir_tstrcmpi(ui->pszUID, pszUID))
+ if (!mir_wstrcmpi(ui->pszUID, pszUID))
return ui;
return NULL;
@@ -1040,7 +1040,7 @@ static BOOL UM_SetStatusEx(USERINFO *pUserList, const wchar_t* pszText, int flag if (s) {
ui->iStatusEx = 0;
if (s == pszText || s[-1] == cDelimiter) {
- size_t len = mir_tstrlen(ui->pszUID);
+ size_t len = mir_wstrlen(ui->pszUID);
if (s[len] == cDelimiter || s[len] == '\0')
ui->iStatusEx = (!bOnlyMe || bSetStatus) ? 1 : 0;
}
@@ -1068,7 +1068,7 @@ static wchar_t* UM_FindUserAutoComplete(USERINFO *pUserList, const wchar_t* pszO wchar_t *pszName = NULL;
for (USERINFO *ui = pUserList; ui != NULL; ui = ui->next)
if (ui->pszNick && my_strstri(ui->pszNick, pszOriginal) == ui->pszNick)
- if (mir_tstrcmpi(ui->pszNick, pszCurrent) > 0 && (!pszName || mir_tstrcmpi(ui->pszNick, pszName) < 0))
+ if (mir_wstrcmpi(ui->pszNick, pszCurrent) > 0 && (!pszName || mir_wstrcmpi(ui->pszNick, pszName) < 0))
pszName = ui->pszNick;
return pszName;
@@ -1081,7 +1081,7 @@ static BOOL UM_RemoveUser(USERINFO **ppUserList, const wchar_t *pszUID) USERINFO *ui = *ppUserList, *pLast = NULL;
while (ui != NULL) {
- if (!mir_tstrcmpi(ui->pszUID, pszUID)) {
+ if (!mir_wstrcmpi(ui->pszUID, pszUID)) {
if (pLast == NULL)
*ppUserList = ui->next;
else
diff --git a/src/mir_app/src/chat_opts.cpp b/src/mir_app/src/chat_opts.cpp index 0acccfbd2c..969e01ebb6 100644 --- a/src/mir_app/src/chat_opts.cpp +++ b/src/mir_app/src/chat_opts.cpp @@ -120,9 +120,9 @@ void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour) lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
mir_snprintf(str, "Font%d", i);
- ptrT tszFace(db_get_tsa(NULL, CHATFONT_MODULE, str));
+ ptrW tszFace(db_get_tsa(NULL, CHATFONT_MODULE, str));
if (tszFace == NULL)
- mir_tstrcpy(lf->lfFaceName, FO.szDefFace);
+ mir_wstrcpy(lf->lfFaceName, FO.szDefFace);
else
wcsncpy_s(lf->lfFaceName, tszFace, _TRUNCATE);
}
@@ -193,10 +193,10 @@ static void InitSetting(wchar_t** ppPointer, char* pszSetting, wchar_t* pszDefau {
DBVARIANT dbv;
if (!db_get_ts(NULL, CHAT_MODULE, pszSetting, &dbv)) {
- replaceStrT(*ppPointer, dbv.ptszVal);
+ replaceStrW(*ppPointer, dbv.ptszVal);
db_free(&dbv);
}
- else replaceStrT(*ppPointer, pszDefault);
+ else replaceStrW(*ppPointer, pszDefault);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -313,7 +313,7 @@ int OptionsInit(void) LOGFONT lf;
LoadMsgDlgFont(18, &lf, NULL);
- mir_tstrcpy(lf.lfFaceName, L"MS Shell Dlg");
+ mir_wstrcpy(lf.lfFaceName, L"MS Shell Dlg");
lf.lfUnderline = lf.lfItalic = lf.lfStrikeOut = 0;
lf.lfHeight = -17;
lf.lfWeight = FW_BOLD;
diff --git a/src/mir_app/src/chat_rtf.cpp b/src/mir_app/src/chat_rtf.cpp index e2cf0addef..1b901c3cb4 100644 --- a/src/mir_app/src/chat_rtf.cpp +++ b/src/mir_app/src/chat_rtf.cpp @@ -116,7 +116,7 @@ int DoRtfToTags(CMString &pszText, int iNumColors, COLORREF *pColors) else if (!wcsncmp(p, L"\\highlight", 10)) { //background color wchar_t szTemp[20]; int iCol = _wtoi(p + 10); - mir_sntprintf(szTemp, L"%d", iCol); + mir_snwprintf(szTemp, L"%d", iCol); } else if (!wcsncmp(p, L"\\line", 5)) { // soft line break; res.AppendChar('\n'); diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp index 6a00cde117..dd1ad27d09 100644 --- a/src/mir_app/src/chat_svc.cpp +++ b/src/mir_app/src/chat_svc.cpp @@ -168,7 +168,7 @@ static INT_PTR Service_Register(WPARAM, LPARAM lParam) if (mi == NULL)
return GC_REGISTER_ERROR;
- mi->ptszModDispName = mir_tstrdup(gcr->ptszDispName);
+ mi->ptszModDispName = mir_wstrdup(gcr->ptszDispName);
mi->bBold = (gcr->dwFlags & GC_BOLD) != 0;
mi->bUnderline = (gcr->dwFlags & GC_UNDERLINE) != 0;
mi->bItalics = (gcr->dwFlags & GC_ITALICS) != 0;
@@ -231,8 +231,8 @@ static INT_PTR Service_NewChat(WPARAM, LPARAM lParam) si->wStatus = ID_STATUS_ONLINE;
si->iType = gcw->iType;
si->dwFlags = gcw->dwFlags;
- si->ptszName = mir_tstrdup(gcw->ptszName);
- si->ptszStatusbarText = mir_tstrdup(gcw->ptszStatusbarText);
+ si->ptszName = mir_wstrdup(gcw->ptszName);
+ si->ptszStatusbarText = mir_wstrdup(gcw->ptszStatusbarText);
si->iSplitterX = g_Settings->iSplitterX;
si->iSplitterY = g_Settings->iSplitterY;
si->iLogFilterFlags = db_get_dw(NULL, CHAT_MODULE, "FilterFlags", 0x03E0);
@@ -250,7 +250,7 @@ static INT_PTR Service_NewChat(WPARAM, LPARAM lParam) wchar_t szTemp[256];
if (si->iType == GCW_SERVER)
- mir_sntprintf(szTemp, L"Server: %s", si->ptszName);
+ mir_snwprintf(szTemp, L"Server: %s", si->ptszName);
else
wcsncpy_s(szTemp, si->ptszName, _TRUNCATE);
si->hContact = chatApi.AddRoom(gcw->pszModule, gcw->ptszID, szTemp, si->iType);
@@ -334,7 +334,7 @@ static int DoControl(GCEVENT *gce, WPARAM wp) else if (gce->pDest->iType == GC_EVENT_CHANGESESSIONAME && gce->ptszText) {
if (si = chatApi.SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule)) {
- replaceStrT(si->ptszName, gce->ptszText);
+ replaceStrW(si->ptszName, gce->ptszText);
if (si->hWnd)
SendMessage(si->hWnd, GC_UPDATETITLE, 0, 0);
if (chatApi.OnRenameSession)
@@ -356,7 +356,7 @@ static int DoControl(GCEVENT *gce, WPARAM wp) }
else if (gce->pDest->iType == GC_EVENT_SETSBTEXT) {
if (si = chatApi.SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule)) {
- replaceStrT(si->ptszStatusbarText, gce->ptszText);
+ replaceStrW(si->ptszStatusbarText, gce->ptszText);
if (si->ptszStatusbarText)
db_set_ts(si->hContact, si->pszModule, "StatusBar", si->ptszStatusbarText);
else
@@ -389,7 +389,7 @@ static void AddUser(GCEVENT *gce) USERINFO *ui = chatApi.SM_AddUser(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID, gce->ptszNick, status);
if (ui == NULL) return;
- ui->pszNick = mir_tstrdup(gce->ptszNick);
+ ui->pszNick = mir_wstrdup(gce->ptszNick);
if (gce->bIsMe)
si->pMe = ui;
ui->Status = status;
@@ -450,7 +450,7 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) case GC_EVENT_TOPIC:
if (SESSION_INFO *si = chatApi.SM_FindSession(gcd->ptszID, gcd->pszModule)) {
if (gce->ptszText) {
- replaceStrT(si->ptszTopic, RemoveFormatting(gce->ptszText));
+ replaceStrW(si->ptszTopic, RemoveFormatting(gce->ptszText));
db_set_ts(si->hContact, si->pszModule, "Topic", si->ptszTopic);
if (chatApi.OnSetTopic)
chatApi.OnSetTopic(si);
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp index 3e18186f85..33f7574dd2 100644 --- a/src/mir_app/src/chat_tools.cpp +++ b/src/mir_app/src/chat_tools.cpp @@ -44,7 +44,7 @@ wchar_t* RemoveFormatting(const wchar_t *pszWord) return NULL;
wchar_t *d = szTemp;
- size_t cbLen = mir_tstrlen(pszWord);
+ size_t cbLen = mir_wstrlen(pszWord);
if (cbLen > _countof(szTemp))
cbLen = _countof(szTemp)-1;
@@ -167,12 +167,12 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char *pszProtoNa {
static wchar_t szBuf[4 * 1024];
- if (!fmt || fmt[0] == 0 || mir_tstrlen(fmt) > 2000)
+ if (!fmt || fmt[0] == 0 || mir_wstrlen(fmt) > 2000)
return 0;
va_list marker;
va_start(marker, fmt);
- mir_vsntprintf(szBuf, 4096, fmt, marker);
+ mir_vsnwprintf(szBuf, 4096, fmt, marker);
va_end(marker);
POPUPDATAT pd = { 0 };
@@ -184,8 +184,8 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char *pszProtoNa pd.lchIcon = LoadIconEx("window", FALSE);
PROTOACCOUNT *pa = Proto_GetAccount(pszProtoName);
- mir_sntprintf(pd.lptzContactName, L"%s - %s", (pa == NULL) ? _A2T(pszProtoName) : pa->tszAccountName, cli.pfnGetContactDisplayName(hContact, 0));
- mir_tstrncpy(pd.lptzText, TranslateTS(szBuf), _countof(pd.lptzText));
+ mir_snwprintf(pd.lptzContactName, L"%s - %s", (pa == NULL) ? _A2T(pszProtoName) : pa->tszAccountName, cli.pfnGetContactDisplayName(hContact, 0));
+ mir_wstrncpy(pd.lptzText, TranslateTS(szBuf), _countof(pd.lptzText));
pd.iSeconds = g_Settings->iPopupTimeout;
if (g_Settings->iPopupStyle == 2) {
@@ -443,7 +443,7 @@ BOOL IsHighlighted(SESSION_INFO *si, GCEVENT *gce) p += _tcsspn(p, L" ");
// compare the words, using wildcards
- if (wildcmpit(p, tszToken))
+ if (wildcmpiw(p, tszToken))
return TRUE;
}
}
@@ -468,7 +468,7 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce) CreateDirectoryTreeT(tszFolder);
wchar_t szTime[100];
- mir_tstrncpy(szTime, chatApi.MakeTimeStamp(g_Settings->pszTimeStampLog, gce->time), 99);
+ mir_wstrncpy(szTime, chatApi.MakeTimeStamp(g_Settings->pszTimeStampLog, gce->time), 99);
FILE *hFile = _wfopen(si->pszLogFileName, L"ab+");
if (hFile == NULL)
@@ -479,14 +479,14 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce) if (bFileJustCreated)
fputws((const wchar_t*)"\377\376", hFile); //UTF-16 LE BOM == FF FE
if (gce->ptszNick) {
- if (g_Settings->bLogLimitNames && mir_tstrlen(gce->ptszNick) > 20) {
- mir_tstrncpy(szTemp2, gce->ptszNick, 20);
- mir_tstrncpy(szTemp2 + 20, L"...", 4);
+ if (g_Settings->bLogLimitNames && mir_wstrlen(gce->ptszNick) > 20) {
+ mir_wstrncpy(szTemp2, gce->ptszNick, 20);
+ mir_wstrncpy(szTemp2 + 20, L"...", 4);
}
- else mir_tstrncpy(szTemp2, gce->ptszNick, 511);
+ else mir_wstrncpy(szTemp2, gce->ptszNick, 511);
if (gce->ptszUserInfo)
- mir_sntprintf(szTemp, L"%s (%s)", szTemp2, gce->ptszUserInfo);
+ mir_snwprintf(szTemp, L"%s (%s)", szTemp2, gce->ptszUserInfo);
else
wcsncpy_s(szTemp, szTemp2, _TRUNCATE);
pszNick = szTemp;
@@ -496,52 +496,52 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce) case GC_EVENT_MESSAGE:
case GC_EVENT_MESSAGE | GC_EVENT_HIGHLIGHT:
p = '*';
- mir_sntprintf(szBuffer, L"%s: %s", gce->ptszNick, chatApi.RemoveFormatting(gce->ptszText));
+ mir_snwprintf(szBuffer, L"%s: %s", gce->ptszNick, chatApi.RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_ACTION:
case GC_EVENT_ACTION | GC_EVENT_HIGHLIGHT:
p = '*';
- mir_sntprintf(szBuffer, L"%s %s", gce->ptszNick, chatApi.RemoveFormatting(gce->ptszText));
+ mir_snwprintf(szBuffer, L"%s %s", gce->ptszNick, chatApi.RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_JOIN:
p = '>';
- mir_sntprintf(szBuffer, TranslateT("%s has joined"), pszNick);
+ mir_snwprintf(szBuffer, TranslateT("%s has joined"), pszNick);
break;
case GC_EVENT_PART:
p = '<';
if (!gce->ptszText)
- mir_sntprintf(szBuffer, TranslateT("%s has left"), pszNick);
+ mir_snwprintf(szBuffer, TranslateT("%s has left"), pszNick);
else
- mir_sntprintf(szBuffer, TranslateT("%s has left (%s)"), pszNick, chatApi.RemoveFormatting(gce->ptszText));
+ mir_snwprintf(szBuffer, TranslateT("%s has left (%s)"), pszNick, chatApi.RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_QUIT:
p = '<';
if (!gce->ptszText)
- mir_sntprintf(szBuffer, TranslateT("%s has disconnected"), pszNick);
+ mir_snwprintf(szBuffer, TranslateT("%s has disconnected"), pszNick);
else
- mir_sntprintf(szBuffer, TranslateT("%s has disconnected (%s)"), pszNick, chatApi.RemoveFormatting(gce->ptszText));
+ mir_snwprintf(szBuffer, TranslateT("%s has disconnected (%s)"), pszNick, chatApi.RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_NICK:
p = '^';
- mir_sntprintf(szBuffer, TranslateT("%s is now known as %s"), gce->ptszNick, gce->ptszText);
+ mir_snwprintf(szBuffer, TranslateT("%s is now known as %s"), gce->ptszNick, gce->ptszText);
break;
case GC_EVENT_KICK:
p = '~';
if (!gce->ptszText)
- mir_sntprintf(szBuffer, TranslateT("%s kicked %s"), gce->ptszStatus, gce->ptszNick);
+ mir_snwprintf(szBuffer, TranslateT("%s kicked %s"), gce->ptszStatus, gce->ptszNick);
else
- mir_sntprintf(szBuffer, TranslateT("%s kicked %s (%s)"), gce->ptszStatus, gce->ptszNick, chatApi.RemoveFormatting(gce->ptszText));
+ mir_snwprintf(szBuffer, TranslateT("%s kicked %s (%s)"), gce->ptszStatus, gce->ptszNick, chatApi.RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_NOTICE:
p = 'o';
- mir_sntprintf(szBuffer, TranslateT("Notice from %s: %s"), gce->ptszNick, chatApi.RemoveFormatting(gce->ptszText));
+ mir_snwprintf(szBuffer, TranslateT("Notice from %s: %s"), gce->ptszNick, chatApi.RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_TOPIC:
p = '#';
if (!gce->ptszNick)
- mir_sntprintf(szBuffer, TranslateT("The topic is '%s'"), chatApi.RemoveFormatting(gce->ptszText));
+ mir_snwprintf(szBuffer, TranslateT("The topic is '%s'"), chatApi.RemoveFormatting(gce->ptszText));
else
- mir_sntprintf(szBuffer, TranslateT("The topic is '%s' (set by %s)"), chatApi.RemoveFormatting(gce->ptszText), gce->ptszNick);
+ mir_snwprintf(szBuffer, TranslateT("The topic is '%s' (set by %s)"), chatApi.RemoveFormatting(gce->ptszText), gce->ptszNick);
break;
case GC_EVENT_INFORMATION:
p = '!';
@@ -549,20 +549,20 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce) break;
case GC_EVENT_ADDSTATUS:
p = '+';
- mir_sntprintf(szBuffer, TranslateT("%s enables '%s' status for %s"), gce->ptszText, gce->ptszStatus, gce->ptszNick);
+ mir_snwprintf(szBuffer, TranslateT("%s enables '%s' status for %s"), gce->ptszText, gce->ptszStatus, gce->ptszNick);
break;
case GC_EVENT_REMOVESTATUS:
p = '-';
- mir_sntprintf(szBuffer, TranslateT("%s disables '%s' status for %s"), gce->ptszText, gce->ptszStatus, gce->ptszNick);
+ mir_snwprintf(szBuffer, TranslateT("%s disables '%s' status for %s"), gce->ptszText, gce->ptszStatus, gce->ptszNick);
break;
}
// formatting strings don't need to be translatable - changing them via language pack would
// only screw up the log format.
if (p)
- mir_sntprintf(szLine, L"%s %c %s\r\n", szTime, p, szBuffer);
+ mir_snwprintf(szLine, L"%s %c %s\r\n", szTime, p, szBuffer);
else
- mir_sntprintf(szLine, L"%s %s\r\n", szTime, szBuffer);
+ mir_snwprintf(szLine, L"%s %s\r\n", szTime, szBuffer);
if (szLine[0]) {
fputws(szLine, hFile);
@@ -587,11 +587,11 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce) _wsplitpath(si->pszLogFileName, tszDrive, tszDir, tszName, tszExt);
wchar_t tszNewPath[_MAX_DRIVE + _MAX_DIR + _MAX_FNAME + _MAX_EXT + 20];
- mir_sntprintf(tszNewPath, L"%s%sarchived\\", tszDrive, tszDir);
+ mir_snwprintf(tszNewPath, L"%s%sarchived\\", tszDrive, tszDir);
CreateDirectoryTreeT(tszNewPath);
wchar_t tszNewName[_MAX_DRIVE + _MAX_DIR + _MAX_FNAME + _MAX_EXT + 20];
- mir_sntprintf(tszNewName, L"%s%s-%s%s", tszNewPath, tszName, tszTimestamp, tszExt);
+ mir_snwprintf(tszNewName, L"%s%s-%s%s", tszNewPath, tszName, tszTimestamp, tszExt);
fclose(hFile);
hFile = 0;
if (!PathFileExists(tszNewName))
@@ -614,12 +614,12 @@ BOOL DoEventHookAsync(HWND hwnd, const wchar_t *pszID, const char *pszModule, in GCDEST *gcd = (GCDEST*)mir_calloc(sizeof(GCDEST));
gcd->pszModule = mir_strdup(pszModule);
- gcd->ptszID = mir_tstrdup(pszID);
+ gcd->ptszID = mir_wstrdup(pszID);
gcd->iType = iType;
GCHOOK *gch = (GCHOOK*)mir_calloc(sizeof(GCHOOK));
- gch->ptszUID = mir_tstrdup(pszUID);
- gch->ptszText = mir_tstrdup(pszText);
+ gch->ptszUID = mir_wstrdup(pszUID);
+ gch->ptszText = mir_wstrdup(pszText);
gch->dwData = dwItem;
gch->pDest = gcd;
PostMessage(hwnd, GC_FIREHOOK, 0, (LPARAM)gch);
@@ -697,7 +697,7 @@ wchar_t* GetChatLogsFilename(SESSION_INFO *si, time_t tTime) // check whether relevant parts of the timestamp have changed and
// we have to reparse the filename
wchar_t *tszNow = chatApi.MakeTimeStamp(L"%a%d%m%Y", tTime); // once a day
- if (mir_tstrcmp(tszOldTimeStamp, tszNow)) {
+ if (mir_wstrcmp(tszOldTimeStamp, tszNow)) {
wcsncpy_s(tszOldTimeStamp, tszNow, _TRUNCATE);
*si->pszLogFileName = 0;
}
@@ -705,41 +705,41 @@ wchar_t* GetChatLogsFilename(SESSION_INFO *si, time_t tTime) if (si->pszLogFileName[0] == 0) {
REPLACEVARSARRAY rva[11];
rva[0].key.w = L"d";
- rva[0].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%#d", tTime));
+ rva[0].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%#d", tTime));
// day 01-31
rva[1].key.w = L"dd";
- rva[1].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%d", tTime));
+ rva[1].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%d", tTime));
// month 1-12
rva[2].key.w = L"m";
- rva[2].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%#m", tTime));
+ rva[2].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%#m", tTime));
// month 01-12
rva[3].key.w = L"mm";
- rva[3].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%m", tTime));
+ rva[3].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%m", tTime));
// month text short
rva[4].key.w = L"mon";
- rva[4].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%b", tTime));
+ rva[4].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%b", tTime));
// month text
rva[5].key.w = L"month";
- rva[5].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%B", tTime));
+ rva[5].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%B", tTime));
// year 01-99
rva[6].key.w = L"yy";
- rva[6].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%y", tTime));
+ rva[6].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%y", tTime));
// year 1901-9999
rva[7].key.w = L"yyyy";
- rva[7].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%Y", tTime));
+ rva[7].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%Y", tTime));
// weekday short
rva[8].key.w = L"wday";
- rva[8].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%a", tTime));
+ rva[8].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%a", tTime));
// weekday
rva[9].key.w = L"weekday";
- rva[9].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%A", tTime));
+ rva[9].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%A", tTime));
// end of array
rva[10].key.w = NULL;
rva[10].value.w = NULL;
wchar_t tszTemp[MAX_PATH], *ptszVarPath;
- if (g_Settings->pszLogDir[mir_tstrlen(g_Settings->pszLogDir) - 1] == '\\') {
- mir_sntprintf(tszTemp, L"%s%s", g_Settings->pszLogDir, L"%userid%.log");
+ if (g_Settings->pszLogDir[mir_wstrlen(g_Settings->pszLogDir) - 1] == '\\') {
+ mir_snwprintf(tszTemp, L"%s%s", g_Settings->pszLogDir, L"%userid%.log");
ptszVarPath = tszTemp;
}
else ptszVarPath = g_Settings->pszLogDir;
diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp index dbc1974660..d331cbbb51 100644 --- a/src/mir_app/src/clc.cpp +++ b/src/mir_app/src/clc.cpp @@ -406,9 +406,9 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam }
if (dbcws->value.type == DBVT_ASCIIZ)
- eq = !mir_tstrcmp(szFullName, _A2T(dbcws->value.pszVal+1));
+ eq = !mir_wstrcmp(szFullName, _A2T(dbcws->value.pszVal+1));
else
- eq = !mir_tstrcmp(szFullName, ptrT(mir_utf8decodeT(dbcws->value.pszVal + 1)));
+ eq = !mir_wstrcmp(szFullName, ptrW(mir_utf8decodeW(dbcws->value.pszVal + 1)));
if (eq && (contact->group->hideOffline != 0) == ((dbcws->value.pszVal[0] & GROUPF_HIDEOFFLINE) != 0))
break; //only expanded has changed: no action reqd
@@ -546,7 +546,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam if (!cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL))
break;
- mir_tstrncpy(contact->szText, cli.pfnGetContactDisplayName(wParam, 0), _countof(contact->szText));
+ mir_wstrncpy(contact->szText, cli.pfnGetContactDisplayName(wParam, 0), _countof(contact->szText));
dat->bNeedsResort = true;
SortClcByTimer(hwnd);
break;
@@ -557,7 +557,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam contact->proto = GetContactProto(wParam);
cli.pfnInvalidateDisplayNameCacheEntry(wParam);
- mir_tstrncpy(contact->szText, cli.pfnGetContactDisplayName(wParam, 0), _countof(contact->szText));
+ mir_wstrncpy(contact->szText, cli.pfnGetContactDisplayName(wParam, 0), _countof(contact->szText));
SortClcByTimer(hwnd);
break;
@@ -759,7 +759,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam if (wParam == 27) //escape
dat->szQuickSearch[0] = 0;
else if (wParam == '\b' && dat->szQuickSearch[0])
- dat->szQuickSearch[mir_tstrlen(dat->szQuickSearch) - 1] = '\0';
+ dat->szQuickSearch[mir_wstrlen(dat->szQuickSearch) - 1] = '\0';
else if (wParam < ' ')
break;
else if (wParam == ' ' && dat->szQuickSearch[0] == '\0' && GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_CHECKBOXES) {
@@ -784,11 +784,11 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam wchar_t szNew[2];
szNew[0] = (wchar_t)wParam;
szNew[1] = '\0';
- if (mir_tstrlen(dat->szQuickSearch) >= _countof(dat->szQuickSearch) - 1) {
+ if (mir_wstrlen(dat->szQuickSearch) >= _countof(dat->szQuickSearch) - 1) {
MessageBeep(MB_OK);
break;
}
- mir_tstrcat(dat->szQuickSearch, szNew);
+ mir_wstrcat(dat->szQuickSearch, szNew);
}
if (dat->bFilterSearch)
@@ -801,7 +801,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam dat->selection = index;
else {
MessageBeep(MB_OK);
- dat->szQuickSearch[mir_tstrlen(dat->szQuickSearch) - 1] = '\0';
+ dat->szQuickSearch[mir_wstrlen(dat->szQuickSearch) - 1] = '\0';
cli.pfnSaveStateAndRebuildList(hwnd, dat);
}
cli.pfnInvalidateRect(hwnd, NULL, FALSE);
@@ -1111,7 +1111,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam CallService(MS_CLIST_CONTACTCHANGEGROUP, (WPARAM)contacto->hContact, contactn->groupId);
else if (contacto->type == CLCIT_GROUP) { //dropee is a group
wchar_t szNewName[120];
- mir_sntprintf(szNewName, L"%s\\%s", Clist_GroupGetName(contactn->groupId, NULL), contacto->szText);
+ mir_snwprintf(szNewName, L"%s\\%s", Clist_GroupGetName(contactn->groupId, NULL), contacto->szText);
Clist_GroupRename(contacto->groupId, szNewName);
}
}
@@ -1150,7 +1150,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam break;
if (contact->type == CLCIT_GROUP) { //dropee is a group
wchar_t szNewName[120];
- mir_tstrncpy(szNewName, contact->szText, _countof(szNewName));
+ mir_wstrncpy(szNewName, contact->szText, _countof(szNewName));
Clist_GroupRename(contact->groupId, szNewName);
}
else if (contact->type == CLCIT_CONTACT) //dropee is a contact
diff --git a/src/mir_app/src/clcfiledrop.cpp b/src/mir_app/src/clcfiledrop.cpp index 8739ae5b86..77ece42958 100644 --- a/src/mir_app/src/clcfiledrop.cpp +++ b/src/mir_app/src/clcfiledrop.cpp @@ -147,7 +147,7 @@ HRESULT CDropTarget::DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL shortPt.y = pt.y;
hwnd = WindowFromPoint(shortPt);
GetClassName(hwnd, szWindowClass, _countof(szWindowClass));
- if (!mir_tstrcmp(szWindowClass, CLISTCONTROL_CLASSW)) {
+ if (!mir_wstrcmp(szWindowClass, CLISTCONTROL_CLASSW)) {
hwndCurrentDrag = hwnd;
ClcData *dat = (ClcData *) GetWindowLongPtr(hwndCurrentDrag, 0);
originalSelection = dat->selection;
@@ -176,20 +176,20 @@ static void AddToFileList(wchar_t ***pppFiles, int *totalCount, const wchar_t *s {
*pppFiles = (wchar_t **) mir_realloc(*pppFiles, (++*totalCount + 1) * sizeof(wchar_t *));
(*pppFiles)[*totalCount] = NULL;
- (*pppFiles)[*totalCount - 1] = mir_tstrdup(szFilename);
+ (*pppFiles)[*totalCount - 1] = mir_wstrdup(szFilename);
if (GetFileAttributes(szFilename) & FILE_ATTRIBUTE_DIRECTORY) {
WIN32_FIND_DATA fd;
HANDLE hFind;
wchar_t szPath[MAX_PATH];
- mir_tstrcpy(szPath, szFilename);
- mir_tstrcat(szPath, L"\\*");
+ mir_wstrcpy(szPath, szFilename);
+ mir_wstrcat(szPath, L"\\*");
if (hFind = FindFirstFile(szPath, &fd)) {
do {
- if (!mir_tstrcmp(fd.cFileName, L".") || !mir_tstrcmp(fd.cFileName, L".."))
+ if (!mir_wstrcmp(fd.cFileName, L".") || !mir_wstrcmp(fd.cFileName, L".."))
continue;
- mir_tstrcpy(szPath, szFilename);
- mir_tstrcat(szPath, L"\\");
- mir_tstrcat(szPath, fd.cFileName);
+ mir_wstrcpy(szPath, szFilename);
+ mir_wstrcat(szPath, L"\\");
+ mir_wstrcat(szPath, fd.cFileName);
AddToFileList(pppFiles, totalCount, szPath);
} while (FindNextFile(hFind, &fd));
FindClose(hFind);
diff --git a/src/mir_app/src/clcitems.cpp b/src/mir_app/src/clcitems.cpp index f21811c4f6..c8de95e416 100644 --- a/src/mir_app/src/clcitems.cpp +++ b/src/mir_app/src/clcitems.cpp @@ -63,7 +63,7 @@ ClcGroup* fnAddGroup(HWND hwnd, ClcData *dat, const wchar_t *szName, DWORD flags break; if (cc->type != CLCIT_GROUP) continue; - compareResult = mir_tstrcmp(pThisField, cc->szText); + compareResult = mir_wstrcmp(pThisField, cc->szText); if (compareResult == 0) { if (pNextField == NULL && flags != (DWORD)-1) { cc->groupId = (WORD)groupId; @@ -87,7 +87,7 @@ ClcGroup* fnAddGroup(HWND hwnd, ClcData *dat, const wchar_t *szName, DWORD flags ClcContact *cc = cli.pfnAddItemToGroup(group, i); cc->type = CLCIT_GROUP; - mir_tstrncpy(cc->szText, pThisField, _countof(cc->szText)); + mir_wstrncpy(cc->szText, pThisField, _countof(cc->szText)); cc->groupId = (WORD)(pNextField ? 0 : groupId); cc->group = new ClcGroup(10); cc->group->parent = group; @@ -107,7 +107,7 @@ ClcGroup* fnAddGroup(HWND hwnd, ClcData *dat, const wchar_t *szName, DWORD flags DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { ClcCacheEntry *cache = cli.pfnGetCacheEntry(hContact); - if (!mir_tstrcmp(cache->tszGroup, szName) && (style & CLS_SHOWHIDDEN || !cache->bIsHidden)) + if (!mir_wstrcmp(cache->tszGroup, szName) && (style & CLS_SHOWHIDDEN || !cache->bIsHidden)) group->totalMembers++; } } @@ -160,7 +160,7 @@ ClcContact* fnAddInfoItemToGroup(ClcGroup *group, int flags, const wchar_t *pszT cc->type = CLCIT_INFO; cc->flags = (BYTE)flags; cc->hContact = (MCONTACT)++iInfoItemUniqueHandle; - mir_tstrncpy(cc->szText, pszText, _countof(cc->szText)); + mir_wstrncpy(cc->szText, pszText, _countof(cc->szText)); return cc; } @@ -182,7 +182,7 @@ ClcContact* fnAddContactToGroup(ClcData *dat, ClcGroup *group, MCONTACT hContact char *szProto = GetContactProto(hContact); ClcCacheEntry *pce = cli.pfnGetCacheEntry(hContact); - replaceStrT(pce->tszGroup, NULL); + replaceStrW(pce->tszGroup, NULL); ClcContact *cc = cli.pfnAddItemToGroup(group, index + 1); cc->type = CLCIT_CONTACT; @@ -204,7 +204,7 @@ ClcContact* fnAddContactToGroup(ClcData *dat, ClcGroup *group, MCONTACT hContact DWORD idleMode = szProto != NULL ? db_get_dw(hContact, szProto, "IdleTS", 0) : 0; if (idleMode) cc->flags |= CONTACTF_IDLE; - mir_tstrncpy(cc->szText, cli.pfnGetContactDisplayName(hContact, 0), _countof(cc->szText)); + mir_wstrncpy(cc->szText, cli.pfnGetContactDisplayName(hContact, 0), _countof(cc->szText)); return cc; } @@ -224,7 +224,7 @@ void fnAddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTo int i; DWORD groupFlags; ClcGroup *group; - ptrT tszGroup(db_get_tsa(hContact, "CList", "Group")); + ptrW tszGroup(db_get_tsa(hContact, "CList", "Group")); if (tszGroup == NULL) group = &dat->list; else { @@ -239,7 +239,7 @@ void fnAddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTo if (szGroupName == NULL) return; - if (!mir_tstrcmp(szGroupName, tszGroup)) + if (!mir_wstrcmp(szGroupName, tszGroup)) break; } if (groupFlags & GROUPF_HIDEOFFLINE) @@ -250,10 +250,10 @@ void fnAddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTo if (szGroupName == NULL) return; - if (!mir_tstrcmp(szGroupName, tszGroup)) + if (!mir_wstrcmp(szGroupName, tszGroup)) break; - size_t len = mir_tstrlen(szGroupName); + size_t len = mir_wstrlen(szGroupName); if (!wcsncmp(szGroupName, tszGroup, len) && tszGroup[len] == '\\') cli.pfnAddGroup(hwnd, dat, szGroupName, groupFlags, i, 1); } @@ -322,7 +322,7 @@ void fnDeleteItemFromTree(HWND hwnd, MCONTACT hItem) ClcContact *cc = group->cl[i]; if (cc->type == CLCIT_GROUP) { - size_t len = mir_tstrlen(cc->szText); + size_t len = mir_wstrlen(cc->szText); if (!wcsncmp(cc->szText, dbv.ptszVal + nameOffset, len) && (dbv.ptszVal[nameOffset + len] == '\\' || dbv.ptszVal[nameOffset + len] == '\0')) { group->totalMembers--; @@ -365,7 +365,7 @@ void fnRebuildEntireList(HWND hwnd, ClcData *dat) ClcCacheEntry *pce = cli.pfnGetCacheEntry(hContact); ClcGroup *group; - ptrT tszGroupName(db_get_tsa(hContact, "CList", "Group")); + ptrW tszGroupName(db_get_tsa(hContact, "CList", "Group")); if (tszGroupName == NULL) group = &dat->list; else { @@ -460,7 +460,7 @@ static int __cdecl GroupSortProc(const void* p1, const void* p2) { ClcContact **contact1 = (ClcContact**)p1, **contact2 = (ClcContact**)p2; - return mir_tstrcmpi(contact1[0]->szText, contact2[0]->szText); + return mir_wstrcmpi(contact1[0]->szText, contact2[0]->szText); } static int __cdecl ContactSortProc(const void* p1, const void* p2) @@ -540,7 +540,7 @@ static void SortGroup(ClcData *dat, ClcGroup *group, int useInsertionSort) if (prevContactOnline) { ClcContact *cc = cli.pfnAddItemToGroup(group, i); cc->type = CLCIT_DIVIDER; - mir_tstrcpy(cc->szText, TranslateT("Offline")); + mir_wstrcpy(cc->szText, TranslateT("Offline")); } break; } diff --git a/src/mir_app/src/clcmsgs.cpp b/src/mir_app/src/clcmsgs.cpp index 8859699db4..2aeecf815d 100644 --- a/src/mir_app/src/clcmsgs.cpp +++ b/src/mir_app/src/clcmsgs.cpp @@ -171,14 +171,14 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar return dat->groupIndent;
case CLM_GETISEARCHSTRING:
- mir_tstrcpy((wchar_t*)lParam, dat->szQuickSearch);
- return mir_tstrlen(dat->szQuickSearch);
+ mir_wstrcpy((wchar_t*)lParam, dat->szQuickSearch);
+ return mir_wstrlen(dat->szQuickSearch);
case CLM_GETITEMTEXT:
if (!cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL))
return 0;
- mir_tstrcpy((wchar_t*)lParam, contact->szText);
- return mir_tstrlen(contact->szText);
+ mir_wstrcpy((wchar_t*)lParam, contact->szText);
+ return mir_wstrlen(contact->szText);
case CLM_GETITEMTYPE:
if (!cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL))
@@ -398,7 +398,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar case CLM_SETITEMTEXT:
if (!cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL))
break;
- mir_tstrncpy(contact->szText, (wchar_t*)lParam, _countof(contact->szText));
+ mir_wstrncpy(contact->szText, (wchar_t*)lParam, _countof(contact->szText));
cli.pfnSortCLC(hwnd, dat, 1);
cli.pfnInvalidateRect(hwnd, NULL, FALSE);
break;
diff --git a/src/mir_app/src/clcutils.cpp b/src/mir_app/src/clcutils.cpp index a01f99e3d0..e1814d1f37 100644 --- a/src/mir_app/src/clcutils.cpp +++ b/src/mir_app/src/clcutils.cpp @@ -63,7 +63,7 @@ wchar_t* fnGetGroupCountsText(ClcData *dat, ClcContact *contact) return L"";
static wchar_t szName[32];
- mir_sntprintf(szName, L"(%u/%u)", onlineCount, totalCount);
+ mir_snwprintf(szName, L"(%u/%u)", onlineCount, totalCount);
return szName;
}
@@ -168,7 +168,7 @@ int fnHitTest(HWND hwnd, ClcData *dat, int testx, int testy, ClcContact **contac HFONT hFont = (HFONT)SelectObject(hdc, dat->fontInfo[hitcontact->type == CLCIT_GROUP ? FONTID_GROUPS : FONTID_CONTACTS].hFont);
SIZE textSize;
- GetTextExtentPoint32(hdc, hitcontact->szText, (int)mir_tstrlen(hitcontact->szText), &textSize);
+ GetTextExtentPoint32(hdc, hitcontact->szText, (int)mir_wstrlen(hitcontact->szText), &textSize);
int width = textSize.cx;
if (hitcontact->type == CLCIT_GROUP) {
wchar_t *szCounts;
@@ -177,7 +177,7 @@ int fnHitTest(HWND hwnd, ClcData *dat, int testx, int testy, ClcContact **contac GetTextExtentPoint32(hdc, L" ", 1, &textSize);
width += textSize.cx;
SelectObject(hdc, dat->fontInfo[FONTID_GROUPCOUNTS].hFont);
- GetTextExtentPoint32(hdc, szCounts, (int)mir_tstrlen(szCounts), &textSize);
+ GetTextExtentPoint32(hdc, szCounts, (int)mir_wstrlen(szCounts), &textSize);
width += textSize.cx;
}
}
@@ -363,7 +363,7 @@ void fnDoSelectionDefaultAction(HWND hwnd, ClcData *dat) int fnFindRowByText(HWND hwnd, ClcData *dat, const wchar_t *text, int prefixOk)
{
ClcGroup *group = &dat->list;
- size_t testlen = mir_tstrlen(text);
+ size_t testlen = mir_wstrlen(text);
group->scanIndex = 0;
for (;;) {
@@ -382,7 +382,7 @@ int fnFindRowByText(HWND hwnd, ClcData *dat, const wchar_t *text, int prefixOk) wchar_t *lowered_text = CharLowerW(NEWWSTR_ALLOCA(text));
show = wcsstr(lowered_szText, lowered_text) != NULL;
}
- else show = ((prefixOk && !wcsnicmp(text, cc->szText, testlen)) || (!prefixOk && !mir_tstrcmpi(text, cc->szText)));
+ else show = ((prefixOk && !wcsnicmp(text, cc->szText, testlen)) || (!prefixOk && !mir_wstrcmpi(text, cc->szText)));
if (show) {
ClcGroup *contactGroup = group;
@@ -417,11 +417,11 @@ void fnEndRename(HWND, ClcData *dat, int save) ClcContact *contact;
if (cli.pfnGetRowByIndex(dat, dat->selection, &contact, NULL) != -1) {
- if (mir_tstrcmp(contact->szText, text) && !wcsstr(text, L"\\")) {
+ if (mir_wstrcmp(contact->szText, text) && !wcsstr(text, L"\\")) {
if (contact->type == CLCIT_GROUP) {
if (contact->group->parent && contact->group->parent->parent) {
wchar_t szFullName[256];
- mir_sntprintf(szFullName, L"%s\\%s",
+ mir_snwprintf(szFullName, L"%s\\%s",
Clist_GroupGetName(contact->group->parent->groupId, NULL), text);
Clist_GroupRename(contact->groupId, szFullName);
}
@@ -431,7 +431,7 @@ void fnEndRename(HWND, ClcData *dat, int save) else if (contact->type == CLCIT_CONTACT) {
cli.pfnInvalidateDisplayNameCacheEntry(contact->hContact);
wchar_t* otherName = cli.pfnGetContactDisplayName(contact->hContact, GCDNF_NOMYHANDLE);
- if (!text[0] || !mir_tstrcmp(otherName, text))
+ if (!text[0] || !mir_wstrcmp(otherName, text))
db_unset(contact->hContact, "CList", "MyHandle");
else
db_set_ts(contact->hContact, "CList", "MyHandle", text);
@@ -698,9 +698,9 @@ void fnGetFontSetting(int i, LOGFONT* lf, COLORREF* colour) char idstr[20];
mir_snprintf(idstr, "Font%dName", i);
- ptrT tszFace(db_get_tsa(NULL, "CLC", idstr));
+ ptrW tszFace(db_get_tsa(NULL, "CLC", idstr));
if (tszFace)
- mir_tstrcpy(lf->lfFaceName, tszFace);
+ mir_wstrcpy(lf->lfFaceName, tszFace);
mir_snprintf(idstr, "Font%dCol", i);
*colour = db_get_dw(NULL, "CLC", idstr, *colour);
@@ -769,7 +769,7 @@ void fnLoadClcOptions(HWND hwnd, ClcData *dat, BOOL bFirst) dat->hBmpBackground = NULL;
}
if (db_get_b(NULL, "CLC", "UseBitmap", CLCDEFAULT_USEBITMAP)) {
- ptrT tszBitmap(db_get_tsa(NULL, "CLC", "BkBitmap"));
+ ptrW tszBitmap(db_get_tsa(NULL, "CLC", "BkBitmap"));
if (tszBitmap)
dat->hBmpBackground = Bitmap_Load(tszBitmap);
}
diff --git a/src/mir_app/src/clistevents.cpp b/src/mir_app/src/clistevents.cpp index bf38e584ec..fa69655ebf 100644 --- a/src/mir_app/src/clistevents.cpp +++ b/src/mir_app/src/clistevents.cpp @@ -150,7 +150,7 @@ CListEvent* fnAddEvent(CLISTEVENT *cle) p->flashesDone = 12;
p->pszService = mir_strdup(g_cliEvents[i].pszService);
if (p->flags & CLEF_UNICODE)
- p->ptszTooltip = mir_tstrdup(p->ptszTooltip);
+ p->ptszTooltip = mir_wstrdup(p->ptszTooltip);
else
p->ptszTooltip = mir_a2u(p->pszTooltip); //if no flag defined it handled as unicode
if (g_cliEvents.getCount() == 1) {
diff --git a/src/mir_app/src/clistgroups.cpp b/src/mir_app/src/clistgroups.cpp index 2a5e5194ca..a9b1e0ab2f 100644 --- a/src/mir_app/src/clistgroups.cpp +++ b/src/mir_app/src/clistgroups.cpp @@ -29,7 +29,7 @@ struct CGroupInternal {
CGroupInternal(int _id, const wchar_t *_name) :
groupId(_id),
- groupName(mir_tstrdup(_name))
+ groupName(mir_wstrdup(_name))
{}
~CGroupInternal()
@@ -50,7 +50,7 @@ struct CGroupInternal /////////////////////////////////////////////////////////////////////////////////////////
static int CompareGrpByName(const CGroupInternal *p1, const CGroupInternal *p2)
-{ return mir_tstrcmp(p1->groupName+1, p2->groupName+1);
+{ return mir_wstrcmp(p1->groupName+1, p2->groupName+1);
}
static LIST<CGroupInternal> arByName(20, CompareGrpByName);
@@ -111,11 +111,11 @@ static INT_PTR CreateGroupInternal(MGROUP hParent, const wchar_t *ptszName) if (tmp == NULL)
return NULL;
- mir_sntprintf(newBaseName, L"%s\\%s", tmp->groupName+1, grpName);
+ mir_snwprintf(newBaseName, L"%s\\%s", tmp->groupName+1, grpName);
}
else wcsncpy_s(newBaseName, grpName, _TRUNCATE);
- mir_tstrncpy(newName + 1, newBaseName, _countof(newName) - 1);
+ mir_wstrncpy(newName + 1, newBaseName, _countof(newName) - 1);
if (ptszName) {
int id = GroupNameExists(newBaseName, -1);
if (id)
@@ -123,7 +123,7 @@ static INT_PTR CreateGroupInternal(MGROUP hParent, const wchar_t *ptszName) }
else {
for (int idCopy = 1; GroupNameExists(newName + 1, -1); idCopy++)
- mir_sntprintf(newName + 1, _countof(newName) - 1, L"%s (%d)", newBaseName, idCopy);
+ mir_snwprintf(newName + 1, _countof(newName) - 1, L"%s (%d)", newBaseName, idCopy);
}
int newId = arByIds.getCount();
@@ -185,7 +185,7 @@ MIR_APP_DLL(int) Clist_GroupDelete(MGROUP hGroup) if (db_get_b(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT)) {
wchar_t szQuestion[256 + 100];
- mir_sntprintf(szQuestion, TranslateT("Are you sure you want to delete group '%s'? This operation cannot be undone."), pGroup->groupName+1);
+ mir_snwprintf(szQuestion, TranslateT("Are you sure you want to delete group '%s'? This operation cannot be undone."), pGroup->groupName+1);
if (MessageBox(cli.hwndContactList, szQuestion, TranslateT("Delete group"), MB_YESNO | MB_ICONQUESTION) == IDNO)
return 1;
}
@@ -204,8 +204,8 @@ MIR_APP_DLL(int) Clist_GroupDelete(MGROUP hGroup) }
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- ptrT tszGroupName(db_get_tsa(hContact, "CList", "Group"));
- if (mir_tstrcmp(tszGroupName, pGroup->groupName+1))
+ ptrW tszGroupName(db_get_tsa(hContact, "CList", "Group"));
+ if (mir_wstrcmp(tszGroupName, pGroup->groupName+1))
continue;
CLISTGROUPCHANGE grpChg = { sizeof(grpChg), NULL, NULL };
@@ -238,15 +238,15 @@ MIR_APP_DLL(int) Clist_GroupDelete(MGROUP hGroup) // rename subgroups
wchar_t szNewName[256];
- size_t len = mir_tstrlen(pGroup->groupName+1);
+ size_t len = mir_wstrlen(pGroup->groupName+1);
for (int i = 0; i < arByIds.getCount(); i++) {
CGroupInternal *p = arByIds[i];
if (!wcsncmp(pGroup->groupName+1, p->groupName+1, len) && p->groupName[len+1] == '\\' && wcschr(p->groupName + len + 2, '\\') == NULL) {
if (szNewParent[0])
- mir_sntprintf(szNewName, L"%s\\%s", szNewParent, p->groupName + len + 2);
+ mir_snwprintf(szNewName, L"%s\\%s", szNewParent, p->groupName + len + 2);
else
- mir_tstrncpy(szNewName, p->groupName + len + 2, _countof(szNewName));
+ mir_wstrncpy(szNewName, p->groupName + len + 2, _countof(szNewName));
Clist_GroupRename(i + 1, szNewName);
}
}
@@ -331,22 +331,22 @@ static int RenameGroupWithMove(int groupId, const wchar_t *szName, int move) wchar_t str[256];
str[0] = pGroup->groupName[0];
- mir_tstrncpy(str + 1, szName, _countof(str) - 1);
+ mir_wstrncpy(str + 1, szName, _countof(str) - 1);
- pGroup->groupName = mir_tstrdup(str);
+ pGroup->groupName = mir_wstrdup(str);
pGroup->save();
// must rename setting in all child contacts too
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
ClcCacheEntry *cache = cli.pfnGetCacheEntry(hContact);
- if (!mir_tstrcmp(cache->tszGroup, oldName)) {
+ if (!mir_wstrcmp(cache->tszGroup, oldName)) {
db_set_ts(hContact, "CList", "Group", szName);
- replaceStrT(cache->tszGroup, szName);
+ replaceStrW(cache->tszGroup, szName);
}
}
// rename subgroups
- size_t len = mir_tstrlen(oldName);
+ size_t len = mir_wstrlen(oldName);
for (int i = 0; i < arByIds.getCount(); i++) {
if (i == groupId)
continue;
@@ -354,7 +354,7 @@ static int RenameGroupWithMove(int groupId, const wchar_t *szName, int move) CGroupInternal *p = arByIds[i];
if (!wcsncmp(p->groupName+1, oldName, len) && p->groupName[len+1] == '\\' && wcschr(p->groupName + len + 2, '\\') == NULL) {
wchar_t szNewName[256];
- mir_sntprintf(szNewName, L"%s\\%s", szName, p->groupName + len + 2);
+ mir_snwprintf(szNewName, L"%s\\%s", szName, p->groupName + len + 2);
RenameGroupWithMove(i, szNewName, 0); // luckily, child groups will never need reordering
}
}
@@ -367,7 +367,7 @@ static int RenameGroupWithMove(int groupId, const wchar_t *szName, int move) *pszLastBackslash = '\0';
for (int i = 0; i < arByIds.getCount(); i++) {
CGroupInternal *p = arByIds[i];
- if (!mir_tstrcmp(p->groupName+1, str)) {
+ if (!mir_wstrcmp(p->groupName+1, str)) {
if (i >= groupId)
Clist_GroupMoveBefore(groupId + 1, i + 2);
break;
@@ -442,11 +442,11 @@ MIR_APP_DLL(HMENU) Clist_GroupBuildMenu() do {
const wchar_t *pBackslash = wcschr(pNextField, '\\');
if (pBackslash == NULL) {
- mir_tstrncpy(szThisField, pNextField, _countof(szThisField));
+ mir_wstrncpy(szThisField, pNextField, _countof(szThisField));
pNextField = NULL;
}
else {
- mir_tstrncpy(szThisField, pNextField, min(_countof(szThisField), pBackslash - pNextField + 1));
+ mir_wstrncpy(szThisField, pNextField, min(_countof(szThisField), pBackslash - pNextField + 1));
pNextField = pBackslash + 1;
}
int compareResult = 1;
@@ -456,7 +456,7 @@ MIR_APP_DLL(HMENU) Clist_GroupBuildMenu() mii.cch = _countof(szThisMenuItem);
mii.dwTypeData = szThisMenuItem;
GetMenuItemInfo(hThisMenu, menuId, TRUE, &mii);
- compareResult = mir_tstrcmp(szThisField, szThisMenuItem);
+ compareResult = mir_wstrcmp(szThisField, szThisMenuItem);
if (compareResult == 0) {
if (pNextField == NULL) {
mii.fMask = MIIM_DATA;
@@ -512,7 +512,7 @@ int InitGroupServices(void) for (int i = 0;; i++) {
char str[32];
_itoa(i, str, 10);
- ptrT tszGroup(db_get_tsa(NULL, "CListGroups", str));
+ ptrW tszGroup(db_get_tsa(NULL, "CListGroups", str));
if (tszGroup == NULL)
break;
diff --git a/src/mir_app/src/clistmod.cpp b/src/mir_app/src/clistmod.cpp index 894ef43e35..f33faa939a 100644 --- a/src/mir_app/src/clistmod.cpp +++ b/src/mir_app/src/clistmod.cpp @@ -101,7 +101,7 @@ wchar_t* fnGetStatusModeDescription(int mode, int flags) default:
if (IsStatusConnecting(mode)) {
const wchar_t* connFmt = LPGENW("Connecting (attempt %d)");
- mir_sntprintf(szMode, (flags & GSMDF_UNTRANSLATED) ? connFmt : TranslateTS(connFmt), mode - ID_STATUS_CONNECTING + 1);
+ mir_snwprintf(szMode, (flags & GSMDF_UNTRANSLATED) ? connFmt : TranslateTS(connFmt), mode - ID_STATUS_CONNECTING + 1);
return szMode;
}
return NULL;
diff --git a/src/mir_app/src/clistsettings.cpp b/src/mir_app/src/clistsettings.cpp index 2130672307..b82bc7c746 100644 --- a/src/mir_app/src/clistsettings.cpp +++ b/src/mir_app/src/clistsettings.cpp @@ -57,7 +57,7 @@ void fnCheckCacheItem(ClcCacheEntry *p) if (p->tszGroup == NULL) {
p->tszGroup = db_get_tsa(p->hContact, "CList", "Group");
if (p->tszGroup == NULL)
- p->tszGroup = mir_tstrdup(L"");
+ p->tszGroup = mir_wstrdup(L"");
}
if (p->bIsHidden == -1)
@@ -66,8 +66,8 @@ void fnCheckCacheItem(ClcCacheEntry *p) void fnFreeCacheItem(ClcCacheEntry *p)
{
- replaceStrT(p->tszName, NULL);
- replaceStrT(p->tszGroup, NULL);
+ replaceStrW(p->tszName, NULL);
+ replaceStrW(p->tszGroup, NULL);
p->bIsHidden = -1;
}
@@ -114,17 +114,17 @@ wchar_t* fnGetContactDisplayName(MCONTACT hContact, int mode) return cacheEntry->tszName;
}
- ptrT tszDisplayName(Contact_GetInfo((mode == GCDNF_NOMYHANDLE) ? CNF_DISPLAYNC : CNF_DISPLAY, hContact));
+ ptrW tszDisplayName(Contact_GetInfo((mode == GCDNF_NOMYHANDLE) ? CNF_DISPLAYNC : CNF_DISPLAY, hContact));
if (tszDisplayName != NULL) {
if (cacheEntry != NULL)
- replaceStrT(cacheEntry->tszName, tszDisplayName);
+ replaceStrW(cacheEntry->tszName, tszDisplayName);
return tszDisplayName.detach();
}
ProtoChainSend(hContact, PSS_GETINFO, SGIF_MINIMAL, 0);
wchar_t *buffer = TranslateT("(Unknown contact)");
- return (cacheEntry == NULL) ? mir_tstrdup(buffer) : buffer;
+ return (cacheEntry == NULL) ? mir_wstrdup(buffer) : buffer;
}
int ContactAdded(WPARAM hContact, LPARAM)
@@ -157,15 +157,15 @@ static void Dbwcs2tstr(DBCONTACTWRITESETTING *cws, wchar_t* &pStr) break;
case DBVT_UTF8:
- pStr = mir_utf8decodeT(cws->value.pszVal);
+ pStr = mir_utf8decodeW(cws->value.pszVal);
break;
case DBVT_ASCIIZ:
- pStr = mir_a2t(cws->value.pszVal);
+ pStr = mir_a2u(cws->value.pszVal);
break;
case DBVT_WCHAR:
- pStr = mir_u2t(cws->value.ptszVal);
+ pStr = mir_wstrdup(cws->value.ptszVal);
break;
}
}
@@ -181,7 +181,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) if (!mir_strcmp(cws->szModule, szProto)) {
if (!strcmp(cws->szSetting, "UIN") || !strcmp(cws->szSetting, "Nick") || !strcmp(cws->szSetting, "FirstName") || !strcmp(cws->szSetting, "LastName") || !strcmp(cws->szSetting, "e-mail")) {
ClcCacheEntry *pdnce = cli.pfnGetCacheEntry(hContact);
- replaceStrT(pdnce->tszName, NULL);
+ replaceStrW(pdnce->tszName, NULL);
cli.pfnCheckCacheItem(pdnce);
}
else if (!strcmp(cws->szSetting, "Status")) {
@@ -196,7 +196,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) }
else if (!strcmp(cws->szSetting, "MyHandle")) {
ClcCacheEntry *pdnce = cli.pfnGetCacheEntry(hContact);
- replaceStrT(pdnce->tszName, NULL);
+ replaceStrW(pdnce->tszName, NULL);
cli.pfnCheckCacheItem(pdnce);
}
else if (!strcmp(cws->szSetting, "Group")) {
diff --git a/src/mir_app/src/clisttray.cpp b/src/mir_app/src/clisttray.cpp index dd6ea4cc32..aafe45ab1c 100644 --- a/src/mir_app/src/clisttray.cpp +++ b/src/mir_app/src/clisttray.cpp @@ -52,7 +52,7 @@ static wchar_t* sttGetXStatus(const char *szProto) cs.flags = CSSF_MASK_MESSAGE | CSSF_TCHAR;
cs.ptszMessage = tszStatus;
if (CallProtoServiceInt(NULL, szProto, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&cs) == 0)
- return mir_tstrdup(tszStatus);
+ return mir_wstrdup(tszStatus);
}
return NULL;
@@ -109,7 +109,7 @@ wchar_t* fnTrayIconMakeTooltip(const wchar_t *szPrefix, const char *szProto) if (hasTips()) {
tszTip.AppendFormat(L"<b>%-12.12s</b>\t%s", pa->tszAccountName, szStatus);
- ptrT ProtoXStatus(sttGetXStatus(pa->szModuleName));
+ ptrW ProtoXStatus(sttGetXStatus(pa->szModuleName));
if (ProtoXStatus != NULL) {
if (!tszTip.IsEmpty())
tszTip.AppendChar('\n');
@@ -124,28 +124,28 @@ wchar_t* fnTrayIconMakeTooltip(const wchar_t *szPrefix, const char *szProto) else {
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
if (pa != NULL) {
- ptrT ProtoXStatus(sttGetXStatus(szProto));
+ ptrW ProtoXStatus(sttGetXStatus(szProto));
wchar_t *szStatus = cli.pfnGetStatusModeDescription(CallProtoServiceInt(NULL, szProto, PS_GETSTATUS, 0, 0), 0);
if (szPrefix && szPrefix[0]) {
if (db_get_b(NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT)) {
if (hasTips()) {
if (ProtoXStatus != NULL)
- mir_sntprintf(cli.szTip, MAX_TIP_SIZE, L"%s%s<b>%-12.12s</b>\t%s%s%-24.24s", szPrefix, szSeparator, pa->tszAccountName, szStatus, szSeparator, ProtoXStatus);
+ mir_snwprintf(cli.szTip, MAX_TIP_SIZE, L"%s%s<b>%-12.12s</b>\t%s%s%-24.24s", szPrefix, szSeparator, pa->tszAccountName, szStatus, szSeparator, ProtoXStatus);
else
- mir_sntprintf(cli.szTip, MAX_TIP_SIZE, L"%s%s<b>%-12.12s</b>\t%s", szPrefix, szSeparator, pa->tszAccountName, szStatus);
+ mir_snwprintf(cli.szTip, MAX_TIP_SIZE, L"%s%s<b>%-12.12s</b>\t%s", szPrefix, szSeparator, pa->tszAccountName, szStatus);
}
- else mir_sntprintf(cli.szTip, MAX_TIP_SIZE, L"%s%s%s %s", szPrefix, szSeparator, pa->tszAccountName, szStatus);
+ else mir_snwprintf(cli.szTip, MAX_TIP_SIZE, L"%s%s%s %s", szPrefix, szSeparator, pa->tszAccountName, szStatus);
}
- else mir_tstrncpy(cli.szTip, szPrefix, MAX_TIP_SIZE);
+ else mir_wstrncpy(cli.szTip, szPrefix, MAX_TIP_SIZE);
}
else {
if (hasTips()) {
if (ProtoXStatus != NULL)
- mir_sntprintf(cli.szTip, MAX_TIP_SIZE, L"<b>%-12.12s</b>\t%s\n%-24.24s", pa->tszAccountName, szStatus, ProtoXStatus);
+ mir_snwprintf(cli.szTip, MAX_TIP_SIZE, L"<b>%-12.12s</b>\t%s\n%-24.24s", pa->tszAccountName, szStatus, ProtoXStatus);
else
- mir_sntprintf(cli.szTip, MAX_TIP_SIZE, L"<b>%-12.12s</b>\t%s", pa->tszAccountName, szStatus);
+ mir_snwprintf(cli.szTip, MAX_TIP_SIZE, L"<b>%-12.12s</b>\t%s", pa->tszAccountName, szStatus);
}
- else mir_sntprintf(cli.szTip, MAX_TIP_SIZE, L"%s %s", pa->tszAccountName, szStatus);
+ else mir_snwprintf(cli.szTip, MAX_TIP_SIZE, L"%s %s", pa->tszAccountName, szStatus);
}
}
}
@@ -180,8 +180,8 @@ int fnTrayIconAdd(HWND hwnd, const char *szProto, const char *szIconProto, int s cli.pfnTrayIconMakeTooltip(NULL, p.szProto);
if (!hasTips())
- mir_tstrncpy(nid.szTip, cli.szTip, _countof(nid.szTip));
- replaceStrT(p.ptszToolTip, cli.szTip);
+ mir_wstrncpy(nid.szTip, cli.szTip, _countof(nid.szTip));
+ replaceStrW(p.ptszToolTip, cli.szTip);
Shell_NotifyIcon(NIM_ADD, &nid);
p.isBase = 1;
@@ -335,9 +335,9 @@ int fnTrayIconUpdate(HICON hNewIcon, const wchar_t *szNewTip, const char *szPref nid.uID = cli.trayIcon[i].id;
cli.pfnTrayIconMakeTooltip(szNewTip, cli.trayIcon[i].szProto);
mir_free(cli.trayIcon[i].ptszToolTip);
- cli.trayIcon[i].ptszToolTip = mir_tstrdup(cli.szTip);
+ cli.trayIcon[i].ptszToolTip = mir_wstrdup(cli.szTip);
if (!hasTips())
- mir_tstrncpy(nid.szTip, cli.szTip, _countof(nid.szTip));
+ mir_wstrncpy(nid.szTip, cli.szTip, _countof(nid.szTip));
Shell_NotifyIcon(NIM_MODIFY, &nid);
if (cli.trayIconCount == 1)
@@ -357,9 +357,9 @@ int fnTrayIconUpdate(HICON hNewIcon, const wchar_t *szNewTip, const char *szPref cli.pfnTrayIconMakeTooltip(szNewTip, cli.trayIcon[i].szProto);
mir_free(cli.trayIcon[i].ptszToolTip);
- cli.trayIcon[i].ptszToolTip = mir_tstrdup(cli.szTip);
+ cli.trayIcon[i].ptszToolTip = mir_wstrdup(cli.szTip);
if (!hasTips())
- mir_tstrncpy(nid.szTip, cli.szTip, _countof(nid.szTip));
+ mir_wstrncpy(nid.szTip, cli.szTip, _countof(nid.szTip));
Shell_NotifyIcon(NIM_MODIFY, &nid);
if (cli.trayIconCount == 1)
diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp index 717849c38e..37a7fc8739 100644 --- a/src/mir_app/src/clui.cpp +++ b/src/mir_app/src/clui.cpp @@ -92,7 +92,7 @@ static int MenuItem_PreBuild(WPARAM, LPARAM) wchar_t cls[128];
HWND hwndClist = GetFocus();
GetClassName(hwndClist, cls, _countof(cls));
- hwndClist = (!mir_tstrcmp(CLISTCONTROL_CLASSW, cls)) ? hwndClist : cli.hwndContactList;
+ hwndClist = (!mir_wstrcmp(CLISTCONTROL_CLASSW, cls)) ? hwndClist : cli.hwndContactList;
HANDLE hItem = (HANDLE)SendMessage(hwndClist, CLM_GETSELECTION, 0, 0);
Menu_ShowItem(hRenameMenuItem, hItem != 0);
return 0;
@@ -104,7 +104,7 @@ static INT_PTR MenuItem_RenameContact(WPARAM, LPARAM) HWND hwndClist = GetFocus();
GetClassName(hwndClist, cls, _countof(cls));
// worst case scenario, the rename is sent to the main contact list
- hwndClist = (!mir_tstrcmp(CLISTCONTROL_CLASSW, cls)) ? hwndClist : cli.hwndContactList;
+ hwndClist = (!mir_wstrcmp(CLISTCONTROL_CLASSW, cls)) ? hwndClist : cli.hwndContactList;
HANDLE hItem = (HANDLE)SendMessage(hwndClist, CLM_GETSELECTION, 0, 0);
if (hItem) {
SetFocus(hwndClist);
@@ -127,7 +127,7 @@ static INT_PTR CALLBACK AskForConfirmationDlgProc(HWND hWnd, UINT msg, WPARAM wP wchar_t szFormat[256], szFinal[256];
GetDlgItemText(hWnd, IDC_TOPLINE, szFormat, _countof(szFormat));
- mir_sntprintf(szFinal, szFormat, cli.pfnGetContactDisplayName(lParam, 0));
+ mir_snwprintf(szFinal, szFormat, cli.pfnGetContactDisplayName(lParam, 0));
SetDlgItemText(hWnd, IDC_TOPLINE, szFinal);
}
SetFocus(GetDlgItem(hWnd, IDNO));
@@ -276,9 +276,9 @@ int LoadCLUIModule(void) RegisterClassEx(&wndclass);
if (db_get_ts(NULL, "CList", "TitleText", &dbv))
- mir_tstrncpy(titleText, _T(MIRANDANAME), _countof(titleText));
+ mir_wstrncpy(titleText, _T(MIRANDANAME), _countof(titleText));
else {
- mir_tstrncpy(titleText, dbv.ptszVal, _countof(titleText));
+ mir_wstrncpy(titleText, dbv.ptszVal, _countof(titleText));
db_free(&dbv);
}
@@ -412,7 +412,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (msg == uMsgProcessProfile) {
wchar_t profile[MAX_PATH];
if (GlobalGetAtomName((ATOM)wParam, profile, _countof(profile))) {
- int rc = mir_tstrcmpi(profile, VARST(L"%miranda_userdata%\\%miranda_profilename%.dat")) == 0;
+ int rc = mir_wstrcmpi(profile, VARST(L"%miranda_userdata%\\%miranda_profilename%.dat")) == 0;
ReplyMessage(rc);
if (rc) {
ShowWindow(hwnd, SW_RESTORE);
@@ -994,20 +994,20 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM PROTOACCOUNT *pa;
wchar_t tszName[64];
if ((pa = Proto_GetAccount(szProto)) != NULL)
- mir_sntprintf(tszName, L"%s ", pa->tszAccountName);
+ mir_snwprintf(tszName, L"%s ", pa->tszAccountName);
else
tszName[0] = 0;
- GetTextExtentPoint32(dis->hDC, tszName, (int)mir_tstrlen(tszName), &textSize);
- TextOut(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, tszName, (int)mir_tstrlen(tszName));
+ GetTextExtentPoint32(dis->hDC, tszName, (int)mir_wstrlen(tszName), &textSize);
+ TextOut(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, tszName, (int)mir_wstrlen(tszName));
x += textSize.cx;
}
if (showOpts & 4) {
wchar_t* szStatus = cli.pfnGetStatusModeDescription(status, 0);
if (!szStatus)
szStatus = L"";
- GetTextExtentPoint32(dis->hDC, szStatus, (int)mir_tstrlen(szStatus), &textSize);
- TextOut(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, szStatus, (int)mir_tstrlen(szStatus));
+ GetTextExtentPoint32(dis->hDC, szStatus, (int)mir_wstrlen(szStatus), &textSize);
+ TextOut(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, szStatus, (int)mir_wstrlen(szStatus));
}
}
else if (dis->CtlType == ODT_MENU) {
diff --git a/src/mir_app/src/cluiservices.cpp b/src/mir_app/src/cluiservices.cpp index 148a9bd5e7..07b02e9584 100644 --- a/src/mir_app/src/cluiservices.cpp +++ b/src/mir_app/src/cluiservices.cpp @@ -32,7 +32,7 @@ EXTERN_C MIR_APP_DLL(void) Clist_GroupAdded(MGROUP hGroup) wchar_t szFocusClass[64];
GetClassName(hwndFocus, szFocusClass, _countof(szFocusClass));
- if (!mir_tstrcmp(szFocusClass, CLISTCONTROL_CLASSW)) {
+ if (!mir_wstrcmp(szFocusClass, CLISTCONTROL_CLASSW)) {
HANDLE hItem = (HANDLE)SendMessage(hwndFocus, CLM_FINDGROUP, hGroup, 0);
if (hItem)
SendMessage(hwndFocus, CLM_EDITLABEL, (WPARAM)hItem, 0);
@@ -114,19 +114,19 @@ void fnCluiProtocolStatusChanged(int, const char*) wchar_t tszName[64];
PROTOACCOUNT *pa = Proto_GetAccount(cli.menuProtos[i].szProto);
if (pa)
- mir_sntprintf(tszName, L"%s ", pa->tszAccountName);
+ mir_snwprintf(tszName, L"%s ", pa->tszAccountName);
else
tszName[0] = 0;
- if (showOpts & 4 && mir_tstrlen(tszName) < _countof(tszName) - 1)
- mir_tstrcat(tszName, L" ");
- GetTextExtentPoint32(hdc, tszName, (int)mir_tstrlen(tszName), &textSize);
+ if (showOpts & 4 && mir_wstrlen(tszName) < _countof(tszName) - 1)
+ mir_wstrcat(tszName, L" ");
+ GetTextExtentPoint32(hdc, tszName, (int)mir_wstrlen(tszName), &textSize);
x += textSize.cx;
x += GetSystemMetrics(SM_CXBORDER) * 4; // The SB panel doesnt allocate enough room
}
if (showOpts & 4) {
wchar_t* modeDescr = cli.pfnGetStatusModeDescription(CallProtoServiceInt(NULL, cli.menuProtos[i].szProto, PS_GETSTATUS, 0, 0), 0);
- GetTextExtentPoint32(hdc, modeDescr, (int)mir_tstrlen(modeDescr), &textSize);
+ GetTextExtentPoint32(hdc, modeDescr, (int)mir_wstrlen(modeDescr), &textSize);
x += textSize.cx;
x += GetSystemMetrics(SM_CXBORDER) * 4; // The SB panel doesnt allocate enough room
}
diff --git a/src/mir_app/src/contacts.cpp b/src/mir_app/src/contacts.cpp index 07d319dd2d..f9e717d541 100644 --- a/src/mir_app/src/contacts.cpp +++ b/src/mir_app/src/contacts.cpp @@ -74,11 +74,11 @@ static wchar_t* ProcessDatabaseValueDefault(MCONTACT hContact, const char *szPro wchar_t buf[40];
switch (dbv.type) {
case DBVT_BYTE:
- return mir_tstrdup(_itow(dbv.bVal, buf, 10));
+ return mir_wstrdup(_itow(dbv.bVal, buf, 10));
case DBVT_WORD:
- return mir_tstrdup(_itow(dbv.wVal, buf, 10));
+ return mir_wstrdup(_itow(dbv.wVal, buf, 10));
case DBVT_DWORD:
- return mir_tstrdup(_itow(dbv.dVal, buf, 10));
+ return mir_wstrdup(_itow(dbv.dVal, buf, 10));
}
db_free(&dbv);
@@ -152,7 +152,7 @@ MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *s CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&countryCount, (LPARAM)&countries);
for (int i = 0; i < countryCount; i++)
if (countries[i].id == dbv.wVal)
- return mir_a2t(countries[i].szName);
+ return mir_a2u(countries[i].szName);
}
else {
db_free(&dbv);
@@ -181,7 +181,7 @@ MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *s if (db_mc_isMeta(hContact)) {
wchar_t buf[40];
_itow(hContact, buf, 10);
- return mir_tstrdup(buf);
+ return mir_wstrdup(buf);
}
uid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
@@ -261,7 +261,7 @@ MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *s break;
case 8:
- return mir_tstrdup(TranslateT("'(Unknown contact)'"));
+ return mir_wstrdup(TranslateT("'(Unknown contact)'"));
}
}
break;
diff --git a/src/mir_app/src/database.cpp b/src/mir_app/src/database.cpp index a0a9257b87..2331ee3159 100644 --- a/src/mir_app/src/database.cpp +++ b/src/mir_app/src/database.cpp @@ -56,7 +56,7 @@ static void fillProfileName(const wchar_t* ptszFileName) wcsncpy_s(g_shortProfileName, p, _TRUNCATE);
wchar_t *pos = wcsrchr(g_shortProfileName, '.');
- if (mir_tstrcmpi(pos, L".dat") == 0)
+ if (mir_wstrcmpi(pos, L".dat") == 0)
*pos = 0;
}
@@ -64,9 +64,9 @@ bool IsInsideRootDir(wchar_t* profiledir, bool exact) {
VARST pfd(L"%miranda_path%");
if (exact)
- return mir_tstrcmpi(profiledir, pfd) == 0;
+ return mir_wstrcmpi(profiledir, pfd) == 0;
- return wcsnicmp(profiledir, pfd, mir_tstrlen(pfd)) == 0;
+ return wcsnicmp(profiledir, pfd, mir_wstrlen(pfd)) == 0;
}
// returns 1 if the profile path was returned, without trailing slash
@@ -76,7 +76,7 @@ int getProfilePath(wchar_t *buf, size_t) GetPrivateProfileString(L"Database", L"ProfileDir", L"", profiledir, _countof(profiledir), mirandabootini);
if (profiledir[0] == 0)
- mir_tstrcpy(profiledir, L"%miranda_path%\\Profiles");
+ mir_wstrcpy(profiledir, L"%miranda_path%\\Profiles");
size_t len = PathToAbsoluteT(VARST(profiledir), buf);
@@ -89,8 +89,8 @@ int getProfilePath(wchar_t *buf, size_t) // returns 1 if *.dat spec is matched
int isValidProfileName(const wchar_t *name)
{
- size_t len = mir_tstrlen(name) - 4;
- return len > 0 && mir_tstrcmpi(&name[len], L".dat") == 0;
+ size_t len = mir_wstrlen(name) - 4;
+ return len > 0 && mir_wstrcmpi(&name[len], L".dat") == 0;
}
// returns 1 if the profile manager should be shown
@@ -103,7 +103,7 @@ static bool showProfileManager(void) // wanna show it?
GetPrivateProfileString(L"Database", L"ShowProfileMgr", L"never", Mgr, _countof(Mgr), mirandabootini);
- return (mir_tstrcmpi(Mgr, L"yes") == 0);
+ return (mir_wstrcmpi(Mgr, L"yes") == 0);
}
bool shouldAutoCreate(wchar_t *szProfile)
@@ -113,7 +113,7 @@ bool shouldAutoCreate(wchar_t *szProfile) wchar_t ac[32];
GetPrivateProfileString(L"Database", L"AutoCreate", L"", ac, _countof(ac), mirandabootini);
- return mir_tstrcmpi(ac, L"yes") == 0;
+ return mir_wstrcmpi(ac, L"yes") == 0;
}
static void getDefaultProfile(wchar_t *szProfile, size_t cch)
@@ -126,7 +126,7 @@ static void getDefaultProfile(wchar_t *szProfile, size_t cch) VARST res(defaultProfile);
if (res)
- mir_sntprintf(szProfile, cch, L"%s\\%s\\%s%s", g_profileDir, (wchar_t*)res, (wchar_t*)res, isValidProfileName(res) ? L"" : L".dat");
+ mir_snwprintf(szProfile, cch, L"%s\\%s\\%s%s", g_profileDir, (wchar_t*)res, (wchar_t*)res, isValidProfileName(res) ? L"" : L".dat");
else
szProfile[0] = 0;
}
@@ -139,17 +139,17 @@ static void loadProfileByShortName(const wchar_t* src, wchar_t *szProfile, size_ wchar_t *p = wcsrchr(buf, '\\'); if (p) ++p; else p = buf;
if (!isValidProfileName(buf) && *p)
- mir_tstrcat(buf, L".dat");
+ mir_wstrcat(buf, L".dat");
wchar_t profileName[MAX_PATH], newProfileDir[MAX_PATH];
wcsncpy_s(profileName, p, _TRUNCATE);
if (!isValidProfileName(profileName) && *p)
- mir_tstrcat(profileName, L".dat");
+ mir_wstrcat(profileName, L".dat");
wcsncpy_s(profileName, p, _TRUNCATE);
p = wcsrchr(profileName, '.'); if (p) *p = 0;
- mir_sntprintf(newProfileDir, cch, L"%s\\%s\\", g_profileDir, profileName);
+ mir_snwprintf(newProfileDir, cch, L"%s\\%s\\", g_profileDir, profileName);
PathToAbsoluteT(buf, szProfile, newProfileDir);
if (wcschr(buf, '\\')) {
@@ -157,7 +157,7 @@ static void loadProfileByShortName(const wchar_t* src, wchar_t *szProfile, size_ if (profileName[0]) {
p = wcsrchr(g_profileDir, '\\'); *p = 0;
p = wcsrchr(g_profileDir, '\\');
- if (p && mir_tstrcmpi(p + 1, profileName) == 0)
+ if (p && mir_wstrcmpi(p + 1, profileName) == 0)
*p = 0;
}
else szProfile[0] = 0;
@@ -186,7 +186,7 @@ static void moveProfileDirProfiles(wchar_t *profiledir, BOOL isRootDir = TRUE) if (isRootDir)
wcsncpy_s(pfd, VARST(L"%miranda_path%\\*.dat"), _TRUNCATE);
else
- mir_sntprintf(pfd, L"%s\\*.dat", profiledir);
+ mir_snwprintf(pfd, L"%s\\*.dat", profiledir);
WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile(pfd, &ffd);
@@ -194,22 +194,22 @@ static void moveProfileDirProfiles(wchar_t *profiledir, BOOL isRootDir = TRUE) wchar_t *c = wcsrchr(pfd, '\\'); if (c) *c = 0;
do {
wchar_t path[MAX_PATH], path2[MAX_PATH];
- wchar_t* profile = mir_tstrdup(ffd.cFileName);
+ wchar_t* profile = mir_wstrdup(ffd.cFileName);
c = wcsrchr(profile, '.'); if (c) *c = 0;
- mir_sntprintf(path, L"%s\\%s", pfd, ffd.cFileName);
- mir_sntprintf(path2, L"%s\\%s", profiledir, profile);
+ mir_snwprintf(path, L"%s\\%s", pfd, ffd.cFileName);
+ mir_snwprintf(path2, L"%s\\%s", profiledir, profile);
CreateDirectoryTreeT(path2);
- mir_sntprintf(path2, L"%s\\%s\\%s", profiledir, profile, ffd.cFileName);
+ mir_snwprintf(path2, L"%s\\%s\\%s", profiledir, profile, ffd.cFileName);
if (_waccess(path2, 0) == 0) {
wchar_t buf[512];
- mir_sntprintf(buf,
+ mir_snwprintf(buf,
TranslateT("Miranda is trying to upgrade your profile structure.\nIt cannot move profile %s to the new location %s\nBecause profile with this name already exists. Please resolve the issue manually."),
path, path2);
MessageBox(NULL, buf, L"Miranda NG", MB_ICONERROR | MB_OK);
}
else if (MoveFile(path, path2) == 0) {
wchar_t buf[512];
- mir_sntprintf(buf,
+ mir_snwprintf(buf,
TranslateT("Miranda is trying to upgrade your profile structure.\nIt cannot move profile %s to the new location %s automatically\nMost likely this is due to insufficient privileges. Please move profile manually."),
path, path2);
MessageBox(NULL, buf, L"Miranda NG", MB_ICONERROR | MB_OK);
@@ -240,18 +240,18 @@ static int getProfile1(wchar_t *szProfile, size_t cch, wchar_t *profiledir, BOOL if (bShowProfileManager || !reqfd) {
wchar_t searchspec[MAX_PATH];
- mir_sntprintf(searchspec, L"%s\\*.*", profiledir);
+ mir_snwprintf(searchspec, L"%s\\*.*", profiledir);
WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile(searchspec, &ffd);
if (hFind != INVALID_HANDLE_VALUE) {
do {
// make sure the first hit is actually a *.dat file
- if (!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || !mir_tstrcmp(ffd.cFileName, L".") || !mir_tstrcmp(ffd.cFileName, L".."))
+ if (!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || !mir_wstrcmp(ffd.cFileName, L".") || !mir_wstrcmp(ffd.cFileName, L".."))
continue;
wchar_t newProfile[MAX_PATH];
- mir_sntprintf(newProfile, L"%s\\%s\\%s.dat", profiledir, ffd.cFileName, ffd.cFileName);
+ mir_snwprintf(newProfile, L"%s\\%s\\%s.dat", profiledir, ffd.cFileName, ffd.cFileName);
if (_waccess(newProfile, 0) != 0)
continue;
@@ -286,7 +286,7 @@ static int getProfileAutoRun(wchar_t *szProfile) wchar_t Mgr[32];
GetPrivateProfileString(L"Database", L"ShowProfileMgr", L"", Mgr, _countof(Mgr), mirandabootini);
- if (mir_tstrcmpi(Mgr, L"never"))
+ if (mir_wstrcmpi(Mgr, L"never"))
return 0;
return fileExist(szProfile) || shouldAutoCreate(szProfile);
@@ -338,12 +338,12 @@ LBL_Show: char* makeFileName(const wchar_t* tszOriginalName)
{
char *szResult = NULL;
- char *szFileName = mir_t2a(tszOriginalName);
- wchar_t *tszFileName = mir_a2t(szFileName);
- if (mir_tstrcmp(tszOriginalName, tszFileName)) {
+ char *szFileName = mir_u2a(tszOriginalName);
+ wchar_t *tszFileName = mir_a2u(szFileName);
+ if (mir_wstrcmp(tszOriginalName, tszFileName)) {
wchar_t tszProfile[MAX_PATH];
if (GetShortPathName(tszOriginalName, tszProfile, MAX_PATH) != 0)
- szResult = mir_t2a(tszProfile);
+ szResult = mir_u2a(tszProfile);
}
if (!szResult)
@@ -454,7 +454,7 @@ static BOOL CALLBACK EnumMirandaWindows(HWND hwnd, LPARAM lParam) wchar_t classname[256];
ENUMMIRANDAWINDOW *x = (ENUMMIRANDAWINDOW *)lParam;
DWORD_PTR res = 0;
- if (GetClassName(hwnd, classname, _countof(classname)) && mir_tstrcmp(L"Miranda", classname) == 0) {
+ if (GetClassName(hwnd, classname, _countof(classname)) && mir_wstrcmp(L"Miranda", classname) == 0) {
if (SendMessageTimeout(hwnd, x->msg, (WPARAM)x->aPath, 0, SMTO_ABORTIFHUNG, 100, &res) && res) {
x->found++;
return FALSE;
diff --git a/src/mir_app/src/dbini.cpp b/src/mir_app/src/dbini.cpp index 77a42d8db6..b545aae71c 100644 --- a/src/mir_app/src/dbini.cpp +++ b/src/mir_app/src/dbini.cpp @@ -39,11 +39,11 @@ static INT_PTR CALLBACK InstallIniDlgProc(HWND hwndDlg, UINT message, WPARAM wPa const wchar_t *pszSecurityInfo;
GetPrivateProfileString(L"AutoExec", L"Warn", L"notsafe", szSecurity, _countof(szSecurity), mirandabootini);
- if (!mir_tstrcmpi(szSecurity, L"all"))
+ if (!mir_wstrcmpi(szSecurity, L"all"))
pszSecurityInfo = LPGENW("Security systems to prevent malicious changes are in place and you will be warned before every change that is made.");
- else if (!mir_tstrcmpi(szSecurity, L"onlyunsafe"))
+ else if (!mir_wstrcmpi(szSecurity, L"onlyunsafe"))
pszSecurityInfo = LPGENW("Security systems to prevent malicious changes are in place and you will be warned before changes that are known to be unsafe.");
- else if (!mir_tstrcmpi(szSecurity, L"none"))
+ else if (!mir_wstrcmpi(szSecurity, L"none"))
pszSecurityInfo = LPGENW("Security systems to prevent malicious changes have been disabled. You will receive no further warnings.");
else pszSecurityInfo = NULL;
if (pszSecurityInfo) SetDlgItemText(hwndDlg, IDC_SECURITYINFO, TranslateTS(pszSecurityInfo));
@@ -166,7 +166,7 @@ static INT_PTR CALLBACK IniImportDoneDlgProc(HWND hwndDlg, UINT message, WPARAM SHFILEOPSTRUCT shfo = { 0 };
shfo.wFunc = FO_DELETE;
shfo.pFrom = szIniPath;
- szIniPath[mir_tstrlen(szIniPath) + 1] = '\0';
+ szIniPath[mir_wstrlen(szIniPath) + 1] = '\0';
shfo.fFlags = FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT | FOF_ALLOWUNDO;
SHFileOperation(&shfo);
}
@@ -424,7 +424,7 @@ LBL_NewLine: break;
default:
wchar_t buf[250];
- mir_sntprintf(buf, TranslateT("Invalid setting type for '%s'. The first character of every value must be b, w, d, l, s, e, u, g, h or n."), _A2T(szName));
+ mir_snwprintf(buf, TranslateT("Invalid setting type for '%s'. The first character of every value must be b, w, d, l, s, e, u, g, h or n."), _A2T(szName));
MessageBox(NULL, buf, TranslateT("Install database settings"), MB_ICONWARNING | MB_OK);
break;
}
@@ -438,17 +438,17 @@ static void DoAutoExec(void) wchar_t buf[2048], szSecurity[11], szOverrideSecurityFilename[MAX_PATH], szOnCreateFilename[MAX_PATH];
GetPrivateProfileString(L"AutoExec", L"Use", L"prompt", szUse, _countof(szUse), mirandabootini);
- if (!mir_tstrcmpi(szUse, L"no")) return;
+ if (!mir_wstrcmpi(szUse, L"no")) return;
GetPrivateProfileString(L"AutoExec", L"Safe", L"CLC Icons CLUI CList SkinSounds", buf, _countof(buf), mirandabootini);
- ptrA szSafeSections(mir_t2a(buf));
+ ptrA szSafeSections(mir_u2a(buf));
GetPrivateProfileString(L"AutoExec", L"Unsafe", L"AIM Facebook GG ICQ IRC JABBER MRA MSN SKYPE Tlen TWITTER VKontakte XFire", buf, _countof(buf), mirandabootini);
- ptrA szUnsafeSections(mir_t2a(buf));
+ ptrA szUnsafeSections(mir_u2a(buf));
GetPrivateProfileString(L"AutoExec", L"Warn", L"notsafe", szSecurity, _countof(szSecurity), mirandabootini);
int secur = 0;
- if (!mir_tstrcmpi(szSecurity, L"none")) secur = 0;
- else if (!mir_tstrcmpi(szSecurity, L"notsafe")) secur = 1;
- else if (!mir_tstrcmpi(szSecurity, L"onlyunsafe")) secur = 2;
+ if (!mir_wstrcmpi(szSecurity, L"none")) secur = 0;
+ else if (!mir_wstrcmpi(szSecurity, L"notsafe")) secur = 1;
+ else if (!mir_wstrcmpi(szSecurity, L"onlyunsafe")) secur = 2;
GetPrivateProfileString(L"AutoExec", L"OverrideSecurityFilename", L"", szOverrideSecurityFilename, _countof(szOverrideSecurityFilename), mirandabootini);
GetPrivateProfileString(L"AutoExec", L"OnCreateFilename", L"", szOnCreateFilename, _countof(szOnCreateFilename), mirandabootini);
@@ -473,10 +473,10 @@ static void DoAutoExec(void) str2[1] = 0;
do {
- bool secFN = mir_tstrcmpi(fd.cFileName, szOverrideSecurityFilename) == 0;
+ bool secFN = mir_wstrcmpi(fd.cFileName, szOverrideSecurityFilename) == 0;
- mir_sntprintf(szIniPath, L"%s%s", szFindPath, fd.cFileName);
- if (!mir_tstrcmpi(szUse, L"prompt") && !secFN) {
+ mir_snwprintf(szIniPath, L"%s%s", szFindPath, fd.cFileName);
+ if (!mir_wstrcmpi(szUse, L"prompt") && !secFN) {
int result = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_INSTALLINI), NULL, InstallIniDlgProc, (LPARAM)szIniPath);
if (result == IDC_NOTOALL) break;
if (result == IDCANCEL) continue;
@@ -489,25 +489,25 @@ static void DoAutoExec(void) else {
wchar_t szOnCompletion[8];
GetPrivateProfileString(L"AutoExec", L"OnCompletion", L"recycle", szOnCompletion, _countof(szOnCompletion), mirandabootini);
- if (!mir_tstrcmpi(szOnCompletion, L"delete"))
+ if (!mir_wstrcmpi(szOnCompletion, L"delete"))
DeleteFile(szIniPath);
- else if (!mir_tstrcmpi(szOnCompletion, L"recycle")) {
+ else if (!mir_wstrcmpi(szOnCompletion, L"recycle")) {
SHFILEOPSTRUCT shfo = { 0 };
shfo.wFunc = FO_DELETE;
shfo.pFrom = szIniPath;
- szIniPath[mir_tstrlen(szIniPath) + 1] = 0;
+ szIniPath[mir_wstrlen(szIniPath) + 1] = 0;
shfo.fFlags = FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT | FOF_ALLOWUNDO;
SHFileOperation(&shfo);
}
- else if (!mir_tstrcmpi(szOnCompletion, L"rename")) {
+ else if (!mir_wstrcmpi(szOnCompletion, L"rename")) {
wchar_t szRenamePrefix[MAX_PATH], szNewPath[MAX_PATH];
GetPrivateProfileString(L"AutoExec", L"RenamePrefix", L"done_", szRenamePrefix, _countof(szRenamePrefix), mirandabootini);
- mir_tstrcpy(szNewPath, szFindPath);
- mir_tstrcat(szNewPath, szRenamePrefix);
- mir_tstrcat(szNewPath, fd.cFileName);
+ mir_wstrcpy(szNewPath, szFindPath);
+ mir_wstrcat(szNewPath, szRenamePrefix);
+ mir_wstrcat(szNewPath, fd.cFileName);
MoveFile(szIniPath, szNewPath);
}
- else if (!mir_tstrcmpi(szOnCompletion, L"ask"))
+ else if (!mir_wstrcmpi(szOnCompletion, L"ask"))
DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_INIIMPORTDONE), NULL, IniImportDoneDlgProc, (LPARAM)szIniPath);
}
}
@@ -525,7 +525,7 @@ static INT_PTR CheckIniImportNow(WPARAM, LPARAM) static INT_PTR ImportINI(WPARAM wParam, LPARAM)
{
- ptrT tszIniPath(mir_utf8decodeT((char*)wParam));
+ ptrW tszIniPath(mir_utf8decodeW((char*)wParam));
ProcessIniFile(tszIniPath, "", "", 0, 0);
return 0;
}
diff --git a/src/mir_app/src/dbutils.cpp b/src/mir_app/src/dbutils.cpp index 8408eaf2b8..8f63f74dbf 100644 --- a/src/mir_app/src/dbutils.cpp +++ b/src/mir_app/src/dbutils.cpp @@ -87,7 +87,7 @@ static wchar_t* getEventString(DBEVENTINFO *dbei, LPSTR &buf) {
LPSTR in = buf;
buf += mir_strlen(buf) + 1;
- return (dbei->flags & DBEF_UTF) ? Utf8DecodeT(in) : mir_a2t(in);
+ return (dbei->flags & DBEF_UTF) ? Utf8DecodeT(in) : mir_a2u(in);
}
static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam)
@@ -113,10 +113,10 @@ static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam) DWORD uin = *(DWORD*)dbei->pBlob;
MCONTACT hContact = (MCONTACT)*(DWORD*)(dbei->pBlob + sizeof(DWORD));
char *buf = LPSTR(dbei->pBlob) + sizeof(DWORD)*2;
- ptrT tszNick(getEventString(dbei, buf));
- ptrT tszFirst(getEventString(dbei, buf));
- ptrT tszLast(getEventString(dbei, buf));
- ptrT tszEmail(getEventString(dbei, buf));
+ ptrW tszNick(getEventString(dbei, buf));
+ ptrW tszFirst(getEventString(dbei, buf));
+ ptrW tszLast(getEventString(dbei, buf));
+ ptrW tszEmail(getEventString(dbei, buf));
CMString nick, text;
if (tszFirst || tszLast) {
@@ -137,13 +137,13 @@ static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam) nick = L"(" + nick + L")";
if (dbei->eventType == EVENTTYPE_AUTHREQUEST) {
- ptrT tszReason(getEventString(dbei, buf));
+ ptrW tszReason(getEventString(dbei, buf));
text.Format(TranslateT("Authorization request from %s%s: %s"),
(tszNick == NULL) ? cli.pfnGetContactDisplayName(hContact, 0) : tszNick, nick, tszReason);
}
else text.Format(TranslateT("You were added by %s%s"),
(tszNick == NULL) ? cli.pfnGetContactDisplayName(hContact, 0) : tszNick, nick);
- return (egt->datatype == DBVT_WCHAR) ? (INT_PTR)mir_tstrdup(text) : (INT_PTR)mir_t2a(text);
+ return (egt->datatype == DBVT_WCHAR) ? (INT_PTR)mir_wstrdup(text) : (INT_PTR)mir_u2a(text);
}
if (dbei->eventType == EVENTTYPE_CONTACTS) {
@@ -151,26 +151,26 @@ static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam) // blob is: [uin(ASCIIZ), nick(ASCIIZ)]*
char *buf = LPSTR(dbei->pBlob), *limit = LPSTR(dbei->pBlob) + dbei->cbBlob;
while (buf < limit) {
- ptrT tszUin(getEventString(dbei, buf));
- ptrT tszNick(getEventString(dbei, buf));
+ ptrW tszUin(getEventString(dbei, buf));
+ ptrW tszNick(getEventString(dbei, buf));
if (tszNick && *tszNick)
text.AppendFormat(L"\"%s\" ", tszNick);
if (tszUin && *tszUin)
text.AppendFormat(L"<%s>; ", tszUin);
}
- return (egt->datatype == DBVT_WCHAR) ? (INT_PTR)mir_tstrdup(text) : (INT_PTR)mir_t2a(text);
+ return (egt->datatype == DBVT_WCHAR) ? (INT_PTR)mir_wstrdup(text) : (INT_PTR)mir_u2a(text);
}
if (dbei->eventType == EVENTTYPE_FILE) {
char *buf = LPSTR(dbei->pBlob) + sizeof(DWORD);
- ptrT tszFileName(getEventString(dbei, buf));
- ptrT tszDescription(getEventString(dbei, buf));
- ptrT &ptszText = (mir_tstrlen(tszDescription) == 0) ? tszFileName : tszDescription;
+ ptrW tszFileName(getEventString(dbei, buf));
+ ptrW tszDescription(getEventString(dbei, buf));
+ ptrW &ptszText = (mir_wstrlen(tszDescription) == 0) ? tszFileName : tszDescription;
switch (egt->datatype) {
case DBVT_WCHAR:
return (INT_PTR)ptszText.detach();
case DBVT_ASCIIZ:
- return (INT_PTR)mir_t2a(ptszText);
+ return (INT_PTR)mir_u2a(ptszText);
}
return 0;
}
@@ -188,7 +188,7 @@ static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam) return (INT_PTR)msg;
}
- return (INT_PTR)mir_a2t_cp(str, egt->codepage);
+ return (INT_PTR)mir_a2u_cp(str, egt->codepage);
}
if (egt->datatype == DBVT_ASCIIZ) {
@@ -247,7 +247,7 @@ static INT_PTR DbEventGetStringT(WPARAM wParam, LPARAM lParam) if (dbei->flags & DBEF_UTF)
return (INT_PTR)Utf8DecodeW(string);
- return (INT_PTR)mir_a2t(string);
+ return (INT_PTR)mir_a2u(string);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -324,7 +324,7 @@ static INT_PTR GetProfileNameW(WPARAM wParam, LPARAM lParam) static INT_PTR SetDefaultProfile(WPARAM wParam, LPARAM)
{
extern wchar_t* g_defaultProfile;
- replaceStrT(g_defaultProfile, (wchar_t*)wParam);
+ replaceStrW(g_defaultProfile, (wchar_t*)wParam);
return 0;
}
diff --git a/src/mir_app/src/descbutton.cpp b/src/mir_app/src/descbutton.cpp index c45e5fc226..a8aefdae68 100644 --- a/src/mir_app/src/descbutton.cpp +++ b/src/mir_app/src/descbutton.cpp @@ -188,7 +188,7 @@ static LRESULT MDescButton_OnPaint(HWND hwndDlg, MDescButtonCtrl *dat) textRect.top = DBC_BORDER_SIZE;
textRect.bottom = dat->height - DBC_BORDER_SIZE;
DrawText(tempDC, dat->lpzTitle, -1, &textRect, DT_TOP | DT_LEFT | DT_END_ELLIPSIS);
- GetTextExtentPoint32(tempDC, dat->lpzTitle, (int)mir_tstrlen(dat->lpzTitle), &titleSize);
+ GetTextExtentPoint32(tempDC, dat->lpzTitle, (int)mir_wstrlen(dat->lpzTitle), &titleSize);
DeleteObject(SelectObject(tempDC, hOldFont));
}
@@ -200,7 +200,7 @@ static LRESULT MDescButton_OnPaint(HWND hwndDlg, MDescButtonCtrl *dat) textRect.top = DBC_BORDER_SIZE + titleSize.cy ? titleSize.cy + DBC_HSPACING : 0;
textRect.bottom = dat->height - DBC_BORDER_SIZE;
DrawText(tempDC, dat->lpzDescription, -1, &textRect, DT_TOP | DT_LEFT | DT_WORDBREAK | DT_END_ELLIPSIS);
- GetTextExtentPoint32(tempDC, dat->lpzTitle, (int)mir_tstrlen(dat->lpzTitle), &titleSize);
+ GetTextExtentPoint32(tempDC, dat->lpzTitle, (int)mir_wstrlen(dat->lpzTitle), &titleSize);
}
SelectObject(tempDC, hfntSave);
@@ -280,9 +280,9 @@ static LRESULT CALLBACK MDescButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wPara if (dat->lpzTitle)
mir_free(dat->lpzTitle);
if (wParam & MDBCF_UNICODE)
- dat->lpzTitle = mir_u2t((WCHAR *)lParam);
+ dat->lpzTitle = mir_wstrdup((WCHAR *)lParam);
else
- dat->lpzTitle = mir_a2t((char *)lParam);
+ dat->lpzTitle = mir_a2u((char *)lParam);
RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
return TRUE;
@@ -290,9 +290,9 @@ static LRESULT CALLBACK MDescButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wPara if (dat->lpzDescription)
mir_free(dat->lpzDescription);
if (wParam & MDBCF_UNICODE)
- dat->lpzDescription = mir_u2t((WCHAR *)lParam);
+ dat->lpzDescription = mir_wstrdup((WCHAR *)lParam);
else
- dat->lpzDescription = mir_a2t((char *)lParam);
+ dat->lpzDescription = mir_a2u((char *)lParam);
RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
return TRUE;
diff --git a/src/mir_app/src/encrypt.cpp b/src/mir_app/src/encrypt.cpp index 85a14a8259..2bdf9f0239 100644 --- a/src/mir_app/src/encrypt.cpp +++ b/src/mir_app/src/encrypt.cpp @@ -41,9 +41,9 @@ static INT_PTR srvRegister(WPARAM wParam, LPARAM lParam) CRYPTO_PROVIDER *pNew = new CRYPTO_PROVIDER(*p);
pNew->pszName = mir_strdup(p->pszName);
if (pNew->dwFlags & CPF_UNICODE)
- pNew->ptszDescr = mir_u2t(TranslateW_LP(p->pwszDescr, wParam));
+ pNew->ptszDescr = mir_wstrdup(TranslateW_LP(p->pwszDescr, wParam));
else
- pNew->ptszDescr = mir_a2t(TranslateA_LP(p->pszDescr, wParam));
+ pNew->ptszDescr = mir_a2u(TranslateA_LP(p->pszDescr, wParam));
arProviders.insert(pNew);
return 0;
}
diff --git a/src/mir_app/src/enterstring.cpp b/src/mir_app/src/enterstring.cpp index 884166c7a9..b68b24b661 100644 --- a/src/mir_app/src/enterstring.cpp +++ b/src/mir_app/src/enterstring.cpp @@ -57,7 +57,7 @@ static void ComboLoadRecentStrings(HWND hwndDlg, EnterStringFormParam *pForm) for (int i = 0; i < pForm->recentCount; i++) {
char setting[MAXMODULELABELLENGTH];
mir_snprintf(setting, "%s%d", pForm->szDataPrefix, i);
- ptrT tszRecent(db_get_tsa(NULL, pForm->szModuleName, setting));
+ ptrW tszRecent(db_get_tsa(NULL, pForm->szModuleName, setting));
if (tszRecent != NULL)
SendDlgItemMessage(hwndDlg, pForm->idcControl, CB_ADDSTRING, 0, tszRecent);
}
@@ -142,7 +142,7 @@ static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa if (params->timeout > 0) {
SetTimer(hwndDlg, 1001, 1000, NULL);
wchar_t buf[128];
- mir_sntprintf(buf, TranslateT("OK (%d)"), params->timeout);
+ mir_snwprintf(buf, TranslateT("OK (%d)"), params->timeout);
SetDlgItemText(hwndDlg, IDOK, buf);
}
@@ -161,7 +161,7 @@ static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa case 1001:
wchar_t buf[128];
- mir_sntprintf(buf, TranslateT("OK (%d)"), --params->timeout);
+ mir_snwprintf(buf, TranslateT("OK (%d)"), --params->timeout);
SetDlgItemText(hwndDlg, IDOK, buf);
if (params->timeout < 0) {
diff --git a/src/mir_app/src/extraicons.cpp b/src/mir_app/src/extraicons.cpp index 6acbca19fc..bcdeea5161 100644 --- a/src/mir_app/src/extraicons.cpp +++ b/src/mir_app/src/extraicons.cpp @@ -394,7 +394,7 @@ EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterCallback(const char *name, const if (GetExtraIconByName(name) != NULL)
return 0;
- ptrT tszDesc(mir_a2t(description));
+ ptrW tszDesc(mir_a2u(description));
wchar_t *desc = TranslateTH(_hLang, tszDesc);
int id = registeredExtraIcons.getCount() + 1;
@@ -409,7 +409,7 @@ EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterIcolib(const char *name, const ch if (IsEmpty(name) || IsEmpty(description))
return 0;
- ptrT tszDesc(mir_a2t(description));
+ ptrW tszDesc(mir_a2u(description));
wchar_t *desc = TranslateTH(_hLang, tszDesc);
BaseExtraIcon *extra = GetExtraIconByName(name);
@@ -418,7 +418,7 @@ EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterIcolib(const char *name, const ch return 0;
// Found one, now merge it
- if (mir_tstrcmpi(extra->getDescription(), desc)) {
+ if (mir_wstrcmpi(extra->getDescription(), desc)) {
CMString newDesc = extra->getDescription();
newDesc += L" / ";
newDesc += desc;
diff --git a/src/mir_app/src/filter.cpp b/src/mir_app/src/filter.cpp index f6d685fca3..0a41dd552f 100644 --- a/src/mir_app/src/filter.cpp +++ b/src/mir_app/src/filter.cpp @@ -62,7 +62,7 @@ void AddTreeViewNodes(HWND hWndDlg, PageHash key, HTREEITEM root) item.cchTextMax = _countof(title);
if (TreeView_GetItem(hWndDlg, &item))
- if (mir_tstrlen(title) > 0)
+ if (mir_wstrlen(title) > 0)
AddFilterString(key, title);
HTREEITEM child = root;
@@ -79,19 +79,19 @@ void AddDialogString(HWND hWndDlg, const PageHash key) {
wchar_t title[2048];
GetWindowText(hWndDlg, title, _countof(title));
- if (mir_tstrlen(title) > 0)
+ if (mir_wstrlen(title) > 0)
AddFilterString(key, title);
wchar_t szClass[64];
GetClassName(hWndDlg, szClass, _countof(szClass));
- if (mir_tstrcmpi(szClass, L"SysTreeView32") == 0) {
+ if (mir_wstrcmpi(szClass, L"SysTreeView32") == 0) {
HTREEITEM hItem = TreeView_GetRoot(hWndDlg);
AddTreeViewNodes(hWndDlg, key, hItem);
return;
}
- if (mir_tstrcmpi(szClass, L"listbox") == 0) {
+ if (mir_wstrcmpi(szClass, L"listbox") == 0) {
if (GetWindowStyle(hWndDlg) & LBS_HASSTRINGS) {
int count = ListBox_GetCount(hWndDlg);
for (int i=0; i < count; i++) {
@@ -99,7 +99,7 @@ void AddDialogString(HWND hWndDlg, const PageHash key) int res = ListBox_GetText(hWndDlg, i, title);
if (res != LB_ERR) {
title[_countof(title) - 1] = 0;
- if (mir_tstrlen(title) > 0)
+ if (mir_wstrlen(title) > 0)
AddFilterString(key, title);
}
}
@@ -107,19 +107,19 @@ void AddDialogString(HWND hWndDlg, const PageHash key) return;
}
- if (mir_tstrcmpi(szClass, L"SysListView32") == 0) {
+ if (mir_wstrcmpi(szClass, L"SysListView32") == 0) {
int count = ListView_GetItemCount(hWndDlg);
for (int i=0; i < count; i++) {
title[0] = 0; //safety
ListView_GetItemText(hWndDlg, i, 0, title, _countof(title));
- if (mir_tstrlen(title) > 0)
+ if (mir_wstrlen(title) > 0)
AddFilterString(key, title);
}
return;
}
- if (mir_tstrcmpi(szClass, L"combobox") == 0) {
+ if (mir_wstrcmpi(szClass, L"combobox") == 0) {
if (GetWindowStyle(hWndDlg) & CBS_HASSTRINGS) {
int count = ComboBox_GetCount(hWndDlg);
for (int i=0; i < count; i++) {
@@ -128,7 +128,7 @@ void AddDialogString(HWND hWndDlg, const PageHash key) if (res != CB_ERR) {
title[_countof(title) - 1] = 0;
- if (mir_tstrlen(title) > 0)
+ if (mir_wstrlen(title) > 0)
AddFilterString(key, title);
}
}
diff --git a/src/mir_app/src/filter.h b/src/mir_app/src/filter.h index 3c20fcfc69..559ccdb310 100644 --- a/src/mir_app/src/filter.h +++ b/src/mir_app/src/filter.h @@ -36,7 +36,7 @@ void GetDialogStrings(int enableKeywordFiltering, const PageHash key, wchar_t *p _inline wchar_t *_tcslwr_locale(wchar_t *buf)
{
- LCMapString(Langpack_GetDefaultLocale() , LCMAP_LOWERCASE, buf, (int)mir_tstrlen(buf), buf, (int)mir_tstrlen(buf));
+ LCMapString(Langpack_GetDefaultLocale() , LCMAP_LOWERCASE, buf, (int)mir_wstrlen(buf), buf, (int)mir_wstrlen(buf));
return buf;
}
@@ -45,7 +45,7 @@ class CPageKeywords {
PageHash _pageHashKey;
KeywordList _pageKeyWords;
- static int _KeyWordsSortFunc(const wchar_t* p1, const wchar_t* p2) { return mir_tstrcmp(p1, p2); };
+ static int _KeyWordsSortFunc(const wchar_t* p1, const wchar_t* p2) { return mir_wstrcmp(p1, p2); };
public:
CPageKeywords(PageHash pageHashKey) : _pageHashKey(pageHashKey), _pageKeyWords(1, _KeyWordsSortFunc) {};
@@ -57,7 +57,7 @@ public: void AddKeyWord(wchar_t *ptKeyWord)
{
- wchar_t *plwrWord = _tcslwr_locale(mir_tstrdup(ptKeyWord));
+ wchar_t *plwrWord = _tcslwr_locale(mir_wstrdup(ptKeyWord));
if (_pageKeyWords.getIndex(plwrWord) == -1)
_pageKeyWords.insert(plwrWord);
else
diff --git a/src/mir_app/src/findadd.cpp b/src/mir_app/src/findadd.cpp index a6c1f98520..cef250a96c 100644 --- a/src/mir_app/src/findadd.cpp +++ b/src/mir_app/src/findadd.cpp @@ -302,12 +302,12 @@ static void SetListItemText(HWND hwndList, int idx, int col, wchar_t *szText) static wchar_t* sttDecodeString(DWORD dwFlags, MAllStrings &src) { if (dwFlags & PSR_UNICODE) - return mir_u2t(src.w); + return mir_wstrdup(src.w); if (dwFlags & PSR_UTF8) - return mir_utf8decodeT(src.a); + return mir_utf8decodeW(src.a); - return mir_a2t(src.a); + return mir_a2u(src.a); } static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -350,7 +350,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP SelectObject(hdc, (HFONT)SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, WM_GETFONT, 0, 0)); SIZE textSize; - GetTextExtentPoint32(hdc, TranslateT("Searching"), (int)mir_tstrlen(TranslateT("Searching")), &textSize); + GetTextExtentPoint32(hdc, TranslateT("Searching"), (int)mir_wstrlen(TranslateT("Searching")), &textSize); int partWidth[3]; partWidth[0] = textSize.cx; @@ -364,7 +364,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP SetStatusBarSearchInfo(GetDlgItem(hwndDlg, IDC_STATUSBAR), dat); wchar_t *szProto = NULL; - ptrT tszLast(db_get_tsa(NULL, "FindAdd", "LastSearched")); + ptrW tszLast(db_get_tsa(NULL, "FindAdd", "LastSearched")); if (tszLast) szProto = NEWWSTR_ALLOCA(tszLast); @@ -387,7 +387,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP SelectObject(hdc, (HFONT)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, WM_GETFONT, 0, 0)); if (netProtoCount > 1) { cbei.pszText = TranslateT("All networks"); - GetTextExtentPoint32(hdc, cbei.pszText, (int)mir_tstrlen(cbei.pszText), &textSize); + GetTextExtentPoint32(hdc, cbei.pszText, (int)mir_wstrlen(cbei.pszText), &textSize); if (textSize.cx > cbwidth) cbwidth = textSize.cx; cbei.iImage = cbei.iSelectedImage = ImageList_AddIcon_IconLibLoaded(dat->himlComboIcons, SKINICON_OTHER_SEARCHALL); @@ -406,7 +406,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP continue; cbei.pszText = pa->tszAccountName; - GetTextExtentPoint32(hdc, cbei.pszText, (int)mir_tstrlen(cbei.pszText), &textSize); + GetTextExtentPoint32(hdc, cbei.pszText, (int)mir_wstrlen(cbei.pszText), &textSize); if (textSize.cx > cbwidth) cbwidth = textSize.cx; @@ -415,7 +415,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP DestroyIcon(hIcon); cbei.lParam = (LPARAM)pa->szModuleName; SendDlgItemMessageA(hwndDlg, IDC_PROTOLIST, CBEM_INSERTITEM, 0, (LPARAM)&cbei); - if (szProto && cbei.pszText && !mir_tstrcmp(szProto, pa->tszAccountName)) + if (szProto && cbei.pszText && !mir_wstrcmp(szProto, pa->tszAccountName)) index = cbei.iItem; cbei.iItem++; } @@ -689,7 +689,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP else if (IsDlgButtonChecked(hwndDlg, IDC_BYPROTOID)) { wchar_t str[256]; GetDlgItemText(hwndDlg, IDC_PROTOID, str, _countof(str)); - rtrimt(str); + rtrimw(str); if (str[0] == 0) MessageBox(hwndDlg, sttErrMsg, sttErrTitle, MB_ICONERROR | MB_OK); else @@ -698,7 +698,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP else if (IsDlgButtonChecked(hwndDlg, IDC_BYEMAIL)) { wchar_t str[256]; GetDlgItemText(hwndDlg, IDC_EMAIL, str, _countof(str)); - rtrimt(str); + rtrimw(str); if (str[0] == 0) MessageBox(hwndDlg, sttErrMsg, sttErrTitle, MB_ICONERROR | MB_OK); else @@ -760,7 +760,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP else { wchar_t str[256]; GetDlgItemText(hwndDlg, IDC_PROTOID, str, _countof(str)); - if (*rtrimt(str) == 0) + if (*rtrimw(str) == 0) break; PROTOSEARCHRESULT psr = { 0 }; diff --git a/src/mir_app/src/headerbar.cpp b/src/mir_app/src/headerbar.cpp index b8c8651ff2..b863f56770 100644 --- a/src/mir_app/src/headerbar.cpp +++ b/src/mir_app/src/headerbar.cpp @@ -208,17 +208,13 @@ static LRESULT MHeaderbar_OnPaint(HWND hwndDlg, MHeaderbarCtrl *mit) textRect.left = 50;
hOldFont = (HFONT)SelectObject(tempDC, hFntBold);
- wchar_t *szTitleW = mir_t2u(szTitle);
- drawThemeTextEx(hTheme, tempDC, WP_CAPTION, CS_ACTIVE, szTitleW, -1, DT_TOP | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP | DT_END_ELLIPSIS, &textRect, &dto);
- mir_free(szTitleW);
+ drawThemeTextEx(hTheme, tempDC, WP_CAPTION, CS_ACTIVE, szTitle, -1, DT_TOP | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP | DT_END_ELLIPSIS, &textRect, &dto);
if (szSubTitle) {
textRect.left = 66;
SelectObject(tempDC, hFont);
- wchar_t *szSubTitleW = mir_t2u(szSubTitle);
- drawThemeTextEx(hTheme, tempDC, WP_CAPTION, CS_ACTIVE, szSubTitleW, -1, DT_BOTTOM | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP | DT_END_ELLIPSIS, &textRect, &dto);
- mir_free(szSubTitleW);
+ drawThemeTextEx(hTheme, tempDC, WP_CAPTION, CS_ACTIVE, szSubTitle, -1, DT_BOTTOM | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP | DT_END_ELLIPSIS, &textRect, &dto);
}
CloseThemeData(hTheme);
}
diff --git a/src/mir_app/src/hotkey_opts.cpp b/src/mir_app/src/hotkey_opts.cpp index 22e7443376..cb02b5496e 100644 --- a/src/mir_app/src/hotkey_opts.cpp +++ b/src/mir_app/src/hotkey_opts.cpp @@ -101,7 +101,7 @@ static wchar_t* sttHokeyVkToName(WORD vkKey) void HotkeyToName(wchar_t *buf, int size, BYTE shift, BYTE key) { - mir_sntprintf(buf, size, L"%s%s%s%s%s", + mir_snwprintf(buf, size, L"%s%s%s%s%s", (shift & HOTKEYF_CONTROL) ? TranslateT("Ctrl + ") : L"", (shift & HOTKEYF_ALT) ? TranslateT("Alt + ") : L"", (shift & HOTKEYF_SHIFT) ? TranslateT("Shift + ") : L"", @@ -281,23 +281,23 @@ static int CALLBACK sttOptionsSortList(LPARAM lParam1, LPARAM lParam2, LPARAM lP item2 = (THotkeyItem *)lvi.lParam; if (!item1 && !item2) - return mir_tstrcmp(title1, title2); + return mir_wstrcmp(title1, title2); if (!item1 && item2) { - if (res = mir_tstrcmp(title1, item2->getSection())) + if (res = mir_wstrcmp(title1, item2->getSection())) return res; return -1; } if (!item2 && item1) { - if (res = mir_tstrcmp(item1->getSection(), title2)) + if (res = mir_wstrcmp(item1->getSection(), title2)) return res; return 1; } /* item1 != NULL && item2 != NULL */ - if (res = mir_tstrcmp(item1->getSection(), item2->getSection())) return res; - if (res = mir_tstrcmp(item1->getDescr(), item2->getDescr())) return res; + if (res = mir_wstrcmp(item1->getSection(), item2->getSection())) return res; + if (res = mir_wstrcmp(item1->getDescr(), item2->getDescr())) return res; if (!item1->rootHotkey && item2->rootHotkey) return -1; if (item1->rootHotkey && !item2->rootHotkey) return 1; return 0; @@ -311,8 +311,8 @@ static void sttOptionsAddHotkey(HWND hwndList, THotkeyItem *item) THotkeyItem *newItem = (THotkeyItem *)mir_alloc(sizeof(THotkeyItem)); newItem->pszName = NULL; newItem->pszService = item->pszService ? mir_strdup(item->pszService) : NULL; - newItem->ptszSection = mir_tstrdup(item->ptszSection); - newItem->ptszDescription = mir_tstrdup(item->ptszDescription); + newItem->ptszSection = mir_wstrdup(item->ptszSection); + newItem->ptszDescription = mir_wstrdup(item->ptszDescription); newItem->lParam = item->lParam; newItem->idHotkey = GlobalAddAtomA(buf); newItem->rootHotkey = item; @@ -393,7 +393,7 @@ static void sttBuildHotkeyList(HWND hwndList) if (item->OptDeleted) continue; - if (!i || mir_tstrcmp(item->ptszSection, hotkeys[i - 1]->ptszSection)) { + if (!i || mir_wstrcmp(item->ptszSection, hotkeys[i - 1]->ptszSection)) { lvi.mask = LVIF_TEXT | LVIF_PARAM; lvi.iItem = nItems++; lvi.iSubItem = 0; @@ -452,7 +452,7 @@ static void sttOptionsDrawTextChunk(HDC hdc, wchar_t *text, RECT *rc) DrawText(hdc, text, -1, rc, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_WORD_ELLIPSIS); SIZE sz; - GetTextExtentPoint32(hdc, text, (int)mir_tstrlen(text), &sz); + GetTextExtentPoint32(hdc, text, (int)mir_wstrlen(text), &sz); rc->left += sz.cx; } @@ -536,7 +536,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, lvi.iSubItem = 1; ListView_GetItem(hwndHotkey, &lvi); - szSetting = mir_t2a(lvi.pszText); + szSetting = mir_u2a(lvi.pszText); ListView_SetCheckState(hwndHotkey, lvi.iItem, db_get_b(NULL, DBMODULENAME "UI", szSetting, TRUE)); @@ -907,7 +907,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, ListView_GetItem(lpnmhdr->hwndFrom, &lvi2); item = (THotkeyItem*)lvi2.lParam; if (!item) continue; - if (!mir_tstrcmp(item->getSection(), buf)) { + if (!mir_wstrcmp(item->getSection(), buf)) { ListView_DeleteItem(lpnmhdr->hwndFrom, lvi2.iItem); --lvi2.iItem; --count; @@ -920,7 +920,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, for (int i = 0; i < hotkeys.getCount(); i++) { LVITEM lvi2 = { 0 }; item = hotkeys[i]; - if (item->OptDeleted || mir_tstrcmp(buf, item->getSection())) + if (item->OptDeleted || mir_wstrcmp(buf, item->getSection())) continue; lvi2.mask = LVIF_PARAM | LVIF_INDENT; diff --git a/src/mir_app/src/hotkeys.cpp b/src/mir_app/src/hotkeys.cpp index 9a1a844f89..7ecb0b1c3a 100644 --- a/src/mir_app/src/hotkeys.cpp +++ b/src/mir_app/src/hotkeys.cpp @@ -29,9 +29,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static int sttCompareHotkeys(const THotkeyItem *p1, const THotkeyItem *p2)
{
int res;
- if (res = mir_tstrcmp(p1->ptszSection, p2->ptszSection))
+ if (res = mir_wstrcmp(p1->ptszSection, p2->ptszSection))
return res;
- if (res = mir_tstrcmp(p1->ptszDescription, p2->ptszDescription))
+ if (res = mir_wstrcmp(p1->ptszDescription, p2->ptszDescription))
return res;
if (!p1->rootHotkey && p2->rootHotkey)
return -1;
@@ -138,8 +138,8 @@ static INT_PTR svcHotkeyRegister(WPARAM wParam, LPARAM lParam) THotkeyItem *p = (THotkeyItem*)mir_alloc(sizeof(THotkeyItem));
DWORD dwFlags = (desc->cbSize >= sizeof(HOTKEYDESC)) ? desc->dwFlags : 0;
if (dwFlags & HKD_UNICODE) {
- p->ptszSection = mir_tstrdup(desc->ptszSection);
- p->ptszDescription = mir_tstrdup(desc->ptszDescription);
+ p->ptszSection = mir_wstrdup(desc->ptszSection);
+ p->ptszDescription = mir_wstrdup(desc->ptszDescription);
}
else {
p->ptszSection = mir_a2u(desc->pszSection);
@@ -250,7 +250,7 @@ static INT_PTR svcHotkeyUnregister(WPARAM, LPARAM lParam) static INT_PTR svcHotkeyCheck(WPARAM wParam, LPARAM lParam)
{
MSG *msg = (MSG *)wParam;
- wchar_t *pszSection = mir_a2t((char *)lParam);
+ wchar_t *pszSection = mir_a2u((char *)lParam);
if ((msg->message == WM_KEYDOWN) || (msg->message == WM_SYSKEYDOWN)) {
int i;
@@ -264,7 +264,7 @@ static INT_PTR svcHotkeyCheck(WPARAM wParam, LPARAM lParam) for (i = 0; i < hotkeys.getCount(); i++) {
THotkeyItem *p = hotkeys[i];
- if ((p->type != HKT_MANUAL) || mir_tstrcmp(pszSection, p->ptszSection))
+ if ((p->type != HKT_MANUAL) || mir_wstrcmp(pszSection, p->ptszSection))
continue;
BYTE hkMod, hkVk;
diff --git a/src/mir_app/src/icolib.cpp b/src/mir_app/src/icolib.cpp index 45c2e33b27..d2f8f34e24 100644 --- a/src/mir_app/src/icolib.cpp +++ b/src/mir_app/src/icolib.cpp @@ -40,14 +40,14 @@ mir_cs csIconList; static int sttCompareSections(const SectionItem *p1, const SectionItem *p2)
{
- return mir_tstrcmp(p1->name, p2->name);
+ return mir_wstrcmp(p1->name, p2->name);
}
LIST<SectionItem> sectionList(20, sttCompareSections);
static int sttCompareIconSourceFiles(const IconSourceFile *p1, const IconSourceFile *p2)
{
- return mir_tstrcmpi(p1->file, p2->file);
+ return mir_wstrcmpi(p1->file, p2->file);
}
static LIST<IconSourceFile> iconSourceFileList(10, sttCompareIconSourceFiles);
@@ -336,7 +336,7 @@ IconSourceItem* GetIconSourceItemFromPath(const wchar_t *path, int cxIcon, int c return NULL;
wchar_t file[MAX_PATH];
- mir_tstrncpy(file, path, _countof(file));
+ mir_wstrncpy(file, path, _countof(file));
wchar_t *comma = wcsrchr(file, ',');
int n;
@@ -352,7 +352,7 @@ IconSourceItem* GetIconSourceItemFromPath(const wchar_t *path, int cxIcon, int c IconSourceItem* CreateStaticIconSourceItem(int cxIcon, int cyIcon)
{
wchar_t tszName[100];
- mir_sntprintf(tszName, L"*StaticIcon_%d", iStaticCount++);
+ mir_snwprintf(tszName, L"*StaticIcon_%d", iStaticCount++);
IconSourceItemKey key = { IconSourceFile_Get(tszName, false), 0, cxIcon, cyIcon };
IconSourceItem *newItem = new IconSourceItem(key);
@@ -390,7 +390,7 @@ static SectionItem* IcoLib_AddSection(wchar_t *sectionName, BOOL create_new) if (create_new) {
SectionItem *newItem = new SectionItem();
- newItem->name = mir_tstrdup(sectionName);
+ newItem->name = mir_wstrdup(sectionName);
sectionList.insert(newItem);
bNeedRebuild = TRUE;
return newItem;
@@ -476,11 +476,11 @@ MIR_APP_DLL(HANDLE) IcoLib_AddIcon(SKINICONDESC *sid, int _hLang) item->name = mir_strdup(sid->pszName);
if (sid->flags & SIDF_UNICODE) {
- item->description = mir_u2t(sid->description.w);
+ item->description = mir_wstrdup(sid->description.w);
item->section = IcoLib_AddSection(sid->section.w, TRUE);
}
else {
- item->description = mir_a2t(sid->description.a);
+ item->description = mir_a2u(sid->description.a);
item->section = IcoLib_AddSection(_A2T(sid->section.a), TRUE);
}
@@ -667,7 +667,7 @@ HICON IconItem_GetIcon(HANDLE hIcoLib, bool big) big = big && !item->cx;
IconSourceItem* &source = big ? item->source_big : item->source_small;
if (source == NULL) {
- ptrT tszCustomPath(db_get_tsa(NULL, "SkinIcons", item->name));
+ ptrW tszCustomPath(db_get_tsa(NULL, "SkinIcons", item->name));
if (tszCustomPath != NULL) {
wchar_t tszFullPath[MAX_PATH];
PathToAbsoluteT(tszCustomPath, tszFullPath);
diff --git a/src/mir_app/src/iconheader.cpp b/src/mir_app/src/iconheader.cpp index 48c1c97cb0..6ce4ad6c31 100644 --- a/src/mir_app/src/iconheader.cpp +++ b/src/mir_app/src/iconheader.cpp @@ -226,9 +226,7 @@ static void MIcoTab_DrawItem(HWND hwnd, HDC hdc, MIcoTabCtrl *dat, MIcoTab *tab, dto.dwFlags = DTT_COMPOSITED | DTT_GLOWSIZE;
dto.iGlowSize = 10;
HANDLE hTheme = OpenThemeData(hwnd, L"Window");
- wchar_t *tcsNameW = mir_t2u(tab->tcsName);
- drawThemeTextEx(hTheme, hdc, WP_CAPTION, CS_ACTIVE, tcsNameW, -1, DT_VCENTER | DT_CENTER | DT_END_ELLIPSIS, &textRect, &dto);
- mir_free(tcsNameW);
+ drawThemeTextEx(hTheme, hdc, WP_CAPTION, CS_ACTIVE, tab->tcsName, -1, DT_VCENTER | DT_CENTER | DT_END_ELLIPSIS, &textRect, &dto);
CloseThemeData(hTheme);
}
else DrawText(hdc, tab->tcsName, -1, &textRect, DT_VCENTER | DT_CENTER | DT_END_ELLIPSIS);
@@ -463,9 +461,9 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L pListMit->flag = pMit->flag;
pListMit->data = pMit->data;
if (pMit->flag & MITCF_UNICODE)
- pListMit->tcsName = mir_u2t(pMit->lpwzName);
+ pListMit->tcsName = mir_wstrdup(pMit->lpwzName);
else
- pListMit->tcsName = mir_a2t(pMit->lpzName);
+ pListMit->tcsName = mir_a2u(pMit->lpzName);
if (pMit->hIcon) {
if (pListMit->flag&MITCF_SHAREDICON)
pListMit->hIcon = pMit->hIcon;
diff --git a/src/mir_app/src/langpack.cpp b/src/mir_app/src/langpack.cpp index 020bc0e46f..3a17d94307 100644 --- a/src/mir_app/src/langpack.cpp +++ b/src/mir_app/src/langpack.cpp @@ -34,7 +34,7 @@ BOOL EnumLangpacks(ENUM_PACKS_CALLBACK callback, WPARAM wParam, LPARAM lParam) BOOL res = FALSE;
/* language folder */
- ptrT langpack(db_get_tsa(NULL, "Langpack", "Current"));
+ ptrW langpack(db_get_tsa(NULL, "Langpack", "Current"));
wchar_t tszFullPath[MAX_PATH];
PathToAbsoluteT(L"\\Languages\\langpack_*.txt", tszFullPath);
@@ -47,13 +47,13 @@ BOOL EnumLangpacks(ENUM_PACKS_CALLBACK callback, WPARAM wParam, LPARAM lParam) if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue;
/* get data */
PathToAbsoluteT(L"\\Languages\\", tszFullPath);
- mir_tstrcat(tszFullPath, wfd.cFileName);
+ mir_wstrcat(tszFullPath, wfd.cFileName);
LANGPACK_INFO pack;
if (!LoadLangPackDescr(tszFullPath, &pack)) {
pack.ftFileDate = wfd.ftLastWriteTime;
/* enabled? */
- if (langpack && !mir_tstrcmpi(langpack, wfd.cFileName)) {
+ if (langpack && !mir_wstrcmpi(langpack, wfd.cFileName)) {
if (!fPackFound) pack.flags |= LPF_ENABLED;
fPackFound = TRUE;
}
@@ -69,14 +69,14 @@ BOOL EnumLangpacks(ENUM_PACKS_CALLBACK callback, WPARAM wParam, LPARAM lParam) if (callback != NULL) {
LANGPACK_INFO pack;
pack.Locale = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT);
- mir_tstrcpy(pack.tszLanguage, L"English");
+ mir_wstrcpy(pack.tszLanguage, L"English");
pack.szAuthors = "Miranda NG Development Team";
pack.szAuthorEmail = "project-info@miranda-ng.org";
DWORD v = CallService(MS_SYSTEM_GETVERSION, 0, 0);
pack.szLastModifiedUsing.Format("%d.%d.%d", ((v >> 24) & 0xFF), ((v >> 16) & 0xFF), ((v >> 8) & 0xFF));
/* file date */
if (GetModuleFileName(NULL, pack.tszFullPath, _countof(pack.tszFullPath))) {
- mir_tstrcpy(pack.tszFileName, L"default");
+ mir_wstrcpy(pack.tszFileName, L"default");
HANDLE hFile = CreateFile(pack.tszFileName, 0, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
if (hFile != INVALID_HANDLE_VALUE) {
GetFileTime(hFile, NULL, NULL, &pack.ftFileDate);
diff --git a/src/mir_app/src/lpopts.cpp b/src/mir_app/src/lpopts.cpp index 6166ec692a..c8e7ed7602 100644 --- a/src/mir_app/src/lpopts.cpp +++ b/src/mir_app/src/lpopts.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static void SetDlgItemText_CP(HWND hwndDlg, int ctrlID, LPCSTR str)
{
- SetDlgItemText(hwndDlg, ctrlID, ptrT(mir_utf8decodeT(str)));
+ SetDlgItemText(hwndDlg, ctrlID, ptrW(mir_utf8decodeW(str)));
}
static void DisplayPackInfo(HWND hwndDlg, const LANGPACK_INFO *pack)
@@ -43,12 +43,12 @@ static void DisplayPackInfo(HWND hwndDlg, const LANGPACK_INFO *pack) /* add some note if its incompatible */
if (szLanguageName[0] && szContryName[0]) {
- mir_sntprintf(szLocaleName, L"%s (%s)", TranslateTS(szLanguageName), TranslateTS(szContryName));
+ mir_snwprintf(szLocaleName, L"%s (%s)", TranslateTS(szLanguageName), TranslateTS(szContryName));
if (!IsValidLocale(pack->Locale, LCID_INSTALLED)) {
wchar_t *pszIncompat;
pszIncompat = TranslateT("(incompatible)");
- szLocaleName[_countof(szLocaleName) - mir_tstrlen(pszIncompat) - 1] = 0;
- mir_tstrcat(mir_tstrcat(szLocaleName, L" "), pszIncompat);
+ szLocaleName[_countof(szLocaleName) - mir_wstrlen(pszIncompat) - 1] = 0;
+ mir_wstrcat(mir_wstrcat(szLocaleName, L" "), pszIncompat);
}
SetDlgItemText(hwndDlg, IDC_LANGLOCALE, szLocaleName);
}
@@ -77,7 +77,7 @@ static BOOL InsertPackItemEnumProc(LANGPACK_INFO *pack, WPARAM wParam, LPARAM) /* insert */
wchar_t tszName[512];
- mir_sntprintf(tszName, L"%s [%s]",
+ mir_snwprintf(tszName, L"%s [%s]",
TranslateTS(pack->tszLanguage),
pack->flags & LPF_DEFAULT ? TranslateT("built-in") : pack->tszFileName);
UINT message = pack->flags & LPF_DEFAULT ? CB_INSERTSTRING : CB_ADDSTRING;
@@ -167,7 +167,7 @@ INT_PTR CALLBACK DlgLangpackOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP LANGPACK_INFO *pack = (LANGPACK_INFO*)ComboBox_GetItemData(hwndList, i);
if (i == idx) {
db_set_ts(NULL, "Langpack", "Current", pack->tszFileName);
- mir_tstrcpy(tszPath, pack->tszFullPath);
+ mir_wstrcpy(tszPath, pack->tszFullPath);
pack->flags |= LPF_ENABLED;
}
else pack->flags &= ~LPF_ENABLED;
diff --git a/src/mir_app/src/menu_clist.cpp b/src/mir_app/src/menu_clist.cpp index 9d2109c4d3..894c323e3b 100644 --- a/src/mir_app/src/menu_clist.cpp +++ b/src/mir_app/src/menu_clist.cpp @@ -190,7 +190,7 @@ MIR_APP_DLL(HGENMENU) Menu_AddMainMenuItem(TMO_MenuItem *pmi) if (pmi->pszService)
name = pmi->pszService;
else if (pmi->flags & CMIF_UNICODE) {
- name = mir_t2a(pmi->name.w);
+ name = mir_u2a(pmi->name.w);
needFree = true;
}
else name = pmi->name.a;
@@ -381,7 +381,7 @@ MIR_APP_DLL(HGENMENU) Menu_AddStatusMenuItem(TMO_MenuItem *pmi, const char *pszP smep->hMenuItem = pimi;
char buf[MAX_PATH + 64];
- char *p = (pRoot) ? mir_t2a(pRoot->mi.name.w) : NULL;
+ char *p = (pRoot) ? mir_u2a(pRoot->mi.name.w) : NULL;
mir_snprintf(buf, "%s/%s", (p) ? p : "", pmi->pszService ? pmi->pszService : "");
mir_free(p);
@@ -584,7 +584,7 @@ INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM) if (bIsLocked) {
pimi->mi.flags |= CMIF_CHECKED;
if (cli.bDisplayLocked) {
- mir_sntprintf(buf, TranslateT("%s (locked)"), acc->tszAccountName);
+ mir_snwprintf(buf, TranslateT("%s (locked)"), acc->tszAccountName);
ptszName = buf;
}
else ptszName = acc->tszAccountName;
@@ -593,8 +593,8 @@ INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM) ptszName = acc->tszAccountName;
pimi->mi.flags &= ~CMIF_CHECKED;
}
- replaceStrT(pimi->mi.name.w, ptszName);
- replaceStrT(root->mi.name.w, ptszName);
+ replaceStrW(pimi->mi.name.w, ptszName);
+ replaceStrW(root->mi.name.w, ptszName);
if (cli.hwndStatus)
InvalidateRect(cli.hwndStatus, NULL, TRUE);
@@ -821,7 +821,7 @@ void RebuildMenuOrder(void) mi.hIcon = ic = (HICON)CallProtoServiceInt(NULL, pa->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
if (Proto_IsAccountLocked(pa) && cli.bDisplayLocked) {
- mir_sntprintf(tbuf, TranslateT("%s (locked)"), pa->tszAccountName);
+ mir_snwprintf(tbuf, TranslateT("%s (locked)"), pa->tszAccountName);
mi.name.w = tbuf;
}
else mi.name.w = pa->tszAccountName;
@@ -845,7 +845,7 @@ void RebuildMenuOrder(void) mi.flags |= CMIF_CHECKED;
if ((mi.flags & CMIF_CHECKED) && cli.bDisplayLocked) {
- mir_sntprintf(tbuf, TranslateT("%s (locked)"), pa->tszAccountName);
+ mir_snwprintf(tbuf, TranslateT("%s (locked)"), pa->tszAccountName);
mi.name.w = tbuf;
}
else mi.name.w = pa->tszAccountName;
@@ -928,7 +928,7 @@ void RebuildMenuOrder(void) wchar_t buf[256], hotkeyName[100];
WORD hotKey = GetHotkeyValue(statusHotkeys[j]);
HotkeyToName(hotkeyName, _countof(hotkeyName), HIBYTE(hotKey), LOBYTE(hotKey));
- mir_sntprintf(buf, L"%s\t%s", cli.pfnGetStatusModeDescription(statusModeList[j], 0), hotkeyName);
+ mir_snwprintf(buf, L"%s\t%s", cli.pfnGetStatusModeDescription(statusModeList[j], 0), hotkeyName);
mi.name.w = buf;
hStatusMainMenuHandles[j] = Menu_AddItem(hStatusMenuObject, &mi, smep);
@@ -958,7 +958,7 @@ static int sttRebuildHotkeys(WPARAM, LPARAM) wchar_t buf[256], hotkeyName[100];
WORD hotKey = GetHotkeyValue(statusHotkeys[j]);
HotkeyToName(hotkeyName, _countof(hotkeyName), HIBYTE(hotKey), LOBYTE(hotKey));
- mir_sntprintf(buf, L"%s\t%s", cli.pfnGetStatusModeDescription(statusModeList[j], 0), hotkeyName);
+ mir_snwprintf(buf, L"%s\t%s", cli.pfnGetStatusModeDescription(statusModeList[j], 0), hotkeyName);
Menu_ModifyItem(hStatusMainMenuHandles[j], buf);
hStatusMainMenuHandles[j]->hotKey = MAKELONG(HIBYTE(hotKey), LOBYTE(hotKey));
diff --git a/src/mir_app/src/menu_options.cpp b/src/mir_app/src/menu_options.cpp index 6d7ba2bc0f..a2acb5dfaa 100644 --- a/src/mir_app/src/menu_options.cpp +++ b/src/mir_app/src/menu_options.cpp @@ -40,8 +40,8 @@ struct MenuItemOptData : public MZeroedObject int pos; - ptrT name; - ptrT defname; + ptrW name; + ptrW defname; bool bShow; int id; @@ -91,7 +91,7 @@ class CGenMenuOptionsPage : public CDlgBase int visible = tvi.iImage != 0; wchar_t *ptszCustomName; - if (iod->name != NULL && iod->defname != NULL && mir_tstrcmp(iod->name, iod->defname) != 0) + if (iod->name != NULL && iod->defname != NULL && mir_wstrcmp(iod->name, iod->defname) != 0) ptszCustomName = iod->name; else ptszCustomName = L""; @@ -110,7 +110,7 @@ class CGenMenuOptionsPage : public CDlgBase runtimepos += 100; } - if (iod->name && !mir_tstrcmp(iod->name, STR_SEPARATOR) && tvi.iImage) + if (iod->name && !mir_wstrcmp(iod->name, STR_SEPARATOR) && tvi.iImage) runtimepos += SEPARATORPOSITIONINTERVAL; tvi.hItem = m_menuItems.GetNextSibling(tvi.hItem); @@ -170,8 +170,8 @@ class CGenMenuOptionsPage : public CDlgBase MenuItemOptData *PD = new MenuItemOptData(); PD->pimi = p; - PD->defname = mir_tstrdup(GetMenuItemText(p)); - PD->name = mir_tstrdup((bReread && p->ptszCustomName != NULL) ? p->ptszCustomName : PD->defname); + PD->defname = mir_wstrdup(GetMenuItemText(p)); + PD->name = mir_wstrdup((bReread && p->ptszCustomName != NULL) ? p->ptszCustomName : PD->defname); PD->bShow = (p->mi.flags & CMIF_HIDDEN) == 0; PD->pos = (bReread) ? p->mi.position : p->originalPosition; PD->id = p->iCommand; @@ -191,7 +191,7 @@ class CGenMenuOptionsPage : public CDlgBase if (i > 0 && PD->pos - lastpos >= SEPARATORPOSITIONINTERVAL) { MenuItemOptData *sep = new MenuItemOptData(); sep->id = -1; - sep->name = mir_tstrdup(STR_SEPARATOR); + sep->name = mir_wstrdup(STR_SEPARATOR); sep->pos = PD->pos - 1; tvis.item.lParam = (LPARAM)sep; @@ -364,7 +364,7 @@ public: MenuItemOptData *PD = new MenuItemOptData(); PD->id = -1; - PD->name = mir_tstrdup(STR_SEPARATOR); + PD->name = mir_wstrdup(STR_SEPARATOR); PD->pos = ((MenuItemOptData *)tvi.lParam)->pos - 1; TVINSERTSTRUCT tvis = { 0 }; @@ -401,7 +401,7 @@ public: MenuItemOptData *PD = new MenuItemOptData(); PD->id = -1; - PD->name = mir_tstrdup(pimi->mi.name.w); + PD->name = mir_wstrdup(pimi->mi.name.w); PD->pos = pimi->mi.position; PD->pimi = pimi; @@ -440,7 +440,7 @@ public: if (iod->name && wcsstr(iod->name, STR_SEPARATOR)) return; - iod->name = mir_tstrdup(iod->defname); + iod->name = mir_wstrdup(iod->defname); m_customName.SetText(iod->defname); tvi.mask = TVIF_TEXT; @@ -513,7 +513,7 @@ public: } m_btnInsMenu.Enable(iod->pimi->mi.root == NULL); - m_btnDefault.Enable(mir_tstrcmp(iod->name, iod->defname) != 0); + m_btnDefault.Enable(mir_wstrcmp(iod->name, iod->defname) != 0); m_btnSet.Enable(true); m_customName.Enable(true); } diff --git a/src/mir_app/src/menu_utils.cpp b/src/mir_app/src/menu_utils.cpp index 91cb530e13..838eb24344 100644 --- a/src/mir_app/src/menu_utils.cpp +++ b/src/mir_app/src/menu_utils.cpp @@ -343,7 +343,7 @@ MIR_APP_DLL(int) Menu_ModifyItem(HGENMENU hMenuItem, const wchar_t *ptszName, HA return -1;
if (ptszName != NULL)
- replaceStrT(pimi->mi.name.w, ptszName);
+ replaceStrW(pimi->mi.name.w, ptszName);
if (iFlags != -1) {
Menu_SetItemFlags(hMenuItem, true, iFlags);
@@ -550,7 +550,7 @@ MIR_APP_DLL(int) Menu_AddObject(LPCSTR szName, LPCSTR szDisplayName, LPCSTR szCh TIntMenuObject *p = new TIntMenuObject();
p->id = NextObjectId++;
p->pszName = mir_strdup(szName);
- p->ptszDisplayName = mir_a2t(szDisplayName);
+ p->ptszDisplayName = mir_a2u(szDisplayName);
p->CheckService = mir_strdup(szCheckService);
p->ExecService = mir_strdup(szExecService);
p->m_hMenuIcons = ImageList_Create(g_iIconSX, g_iIconSY, ILC_COLOR32 | ILC_MASK, 15, 100);
@@ -667,7 +667,7 @@ static int GetNextObjectMenuItemId() static int FindRoot(TMO_IntMenuItem *pimi, void *param)
{
if (pimi->mi.name.w != NULL)
- if (pimi->submenu.first && !mir_tstrcmp(pimi->mi.name.w, (wchar_t*)param))
+ if (pimi->submenu.first && !mir_wstrcmp(pimi->mi.name.w, (wchar_t*)param))
return TRUE;
return FALSE;
@@ -718,7 +718,7 @@ MIR_APP_DLL(HGENMENU) Menu_AddItem(int hMenuObject, TMO_MenuItem *pmi, void *pUs p->pUserData = pUserData;
if (pmi->flags & CMIF_UNICODE)
- p->mi.name.w = mir_tstrdup(pmi->name.w);
+ p->mi.name.w = mir_wstrdup(pmi->name.w);
else
p->mi.name.w = mir_a2u(pmi->name.a);
@@ -989,7 +989,7 @@ int Menu_LoadFromDatabase(TMO_IntMenuItem *pimi, void *szModule) bin2hex(&pimi->mi.uid, sizeof(pimi->mi.uid), menuItemName);
TIntMenuObject *pmo = pimi->parent;
- ptrT szValue(db_get_tsa(NULL, (char*)szModule, menuItemName));
+ ptrW szValue(db_get_tsa(NULL, (char*)szModule, menuItemName));
if (szValue == NULL)
return 0;
@@ -1005,7 +1005,7 @@ int Menu_LoadFromDatabase(TMO_IntMenuItem *pimi, void *szModule) case 0: bVisible = _wtoi(ptszToken); break;
case 1: pos = _wtoi(ptszToken); break;
case 2:
- hex2binT(ptszToken, &customRoot, sizeof(customRoot));
+ hex2binW(ptszToken, &customRoot, sizeof(customRoot));
if (customRoot == pimi->mi.uid) // prevent a loop
memset(&customRoot, 0, sizeof(customRoot));
break;
@@ -1026,7 +1026,7 @@ int Menu_LoadFromDatabase(TMO_IntMenuItem *pimi, void *szModule) else
pimi->mi.flags |= CMIF_HIDDEN;
- replaceStrT(pimi->ptszCustomName, tszCustomName[0] ? tszCustomName : NULL);
+ replaceStrW(pimi->ptszCustomName, tszCustomName[0] ? tszCustomName : NULL);
MUUID currentUid;
if (pimi->mi.root == NULL)
@@ -1128,7 +1128,7 @@ static HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem *pRootMenu, WPARAM #ifdef PUTPOSITIONSONMENU
if (GetKeyState(VK_CONTROL) & 0x8000) {
wchar_t str[256];
- mir_sntprintf(str, L"%s (%d, id %x)", mi->name.a, mi->position, mii.dwItemData);
+ mir_snwprintf(str, L"%s (%d, id %x)", mi->name.a, mi->position, mii.dwItemData);
mii.dwTypeData = str;
}
#endif
@@ -1142,7 +1142,7 @@ static HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem *pRootMenu, WPARAM #ifdef PUTPOSITIONSONMENU
if (GetKeyState(VK_CONTROL) & 0x8000) {
wchar_t str[256];
- mir_sntprintf(str, L"%s (%d, id %x)", mi->name.a, mi->position, mii.dwItemData);
+ mir_snwprintf(str, L"%s (%d, id %x)", mi->name.a, mi->position, mii.dwItemData);
mii.dwTypeData = str;
}
#endif
@@ -1221,7 +1221,7 @@ static int MO_RegisterIcon(TMO_IntMenuItem *pmi, void*) HICON hIcon = ImageList_GetIcon(pmi->parent->m_hMenuIcons, pmi->iconId, 0);
wchar_t sectionName[256];
- mir_sntprintf(sectionName, LPGENW("Menu icons") L"/%s", TranslateTS(pmi->parent->ptszDisplayName));
+ mir_snwprintf(sectionName, LPGENW("Menu icons") L"/%s", TranslateTS(pmi->parent->ptszDisplayName));
char iconame[256], uname[100];
bin2hex(&pmi->mi.uid, sizeof(pmi->mi.uid), uname);
@@ -1235,7 +1235,7 @@ static int MO_RegisterIcon(TMO_IntMenuItem *pmi, void*) if ((p = wcschr(p, '&')) == NULL)
break;
- memmove(p, p + 1, sizeof(wchar_t)*(mir_tstrlen(p + 1) + 1));
+ memmove(p, p + 1, sizeof(wchar_t)*(mir_wstrlen(p + 1) + 1));
if (*p == '\0')
p++;
}
diff --git a/src/mir_app/src/meta_addto.cpp b/src/mir_app/src/meta_addto.cpp index 19a59644f5..41e4d349d9 100644 --- a/src/mir_app/src/meta_addto.cpp +++ b/src/mir_app/src/meta_addto.cpp @@ -52,7 +52,7 @@ static int FillList(HWND list, BOOL sort) // get contact display name from clist
wchar_t *swzContactDisplayName = cli.pfnGetContactDisplayName(hMetaUser, 0);
// don't insert huge strings that we have to compare with later
- if (mir_tstrlen(swzContactDisplayName) > 1023)
+ if (mir_wstrlen(swzContactDisplayName) > 1023)
swzContactDisplayName[1024] = 0;
int pos = -1;
@@ -60,7 +60,7 @@ static int FillList(HWND list, BOOL sort) for (pos = 0; pos < i; pos++) {
wchar_t buff[1024];
SendMessage(list, LB_GETTEXT, pos, (LPARAM)buff);
- if (mir_tstrcmp(buff, swzContactDisplayName) > 0)
+ if (mir_wstrcmp(buff, swzContactDisplayName) > 0)
break;
}
}
@@ -154,7 +154,7 @@ static INT_PTR CALLBACK Meta_SelectDialogProc(HWND hwndDlg, UINT msg, WPARAM wPa // ... and set it to the Window title.
wchar_t buf[256];
- mir_sntprintf(buf, TranslateT("Adding %s..."), ptszCDN);
+ mir_snwprintf(buf, TranslateT("Adding %s..."), ptszCDN);
SetWindowText(hwndDlg, buf);
}
ShowWindow(hwndDlg, SW_SHOWNORMAL);
diff --git a/src/mir_app/src/meta_menu.cpp b/src/mir_app/src/meta_menu.cpp index 2f7693ae90..3929c057e8 100644 --- a/src/mir_app/src/meta_menu.cpp +++ b/src/mir_app/src/meta_menu.cpp @@ -49,7 +49,7 @@ static HGENMENU INT_PTR Meta_Convert(WPARAM wParam, LPARAM)
{
- ptrT tszGroup(db_get_tsa(wParam, "CList", "Group"));
+ ptrW tszGroup(db_get_tsa(wParam, "CList", "Group"));
// Create a new metacontact
MCONTACT hMetaContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
diff --git a/src/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp index 99d31ad899..ae59188348 100644 --- a/src/mir_app/src/meta_services.cpp +++ b/src/mir_app/src/meta_services.cpp @@ -380,7 +380,7 @@ int Meta_SettingChanged(WPARAM hContact, LPARAM lParam) mir_snprintf(buffer, "Nick%d", contact_number);
db_set(ccMeta->contactID, META_PROTO, buffer, &dcws->value);
- ptrT tszMyhandle(db_get_tsa(hContact, "CList", "MyHandle"));
+ ptrW tszMyhandle(db_get_tsa(hContact, "CList", "MyHandle"));
if (tszMyhandle == NULL) {
mir_snprintf(buffer, "CListName%d", contact_number);
db_set(ccMeta->contactID, META_PROTO, buffer, &dcws->value);
diff --git a/src/mir_app/src/meta_utils.cpp b/src/mir_app/src/meta_utils.cpp index ddf0937972..8ef0a9876f 100644 --- a/src/mir_app/src/meta_utils.cpp +++ b/src/mir_app/src/meta_utils.cpp @@ -40,7 +40,7 @@ POINT menuMousePoint; int Meta_SetNick(char *szProto)
{
- ptrT tszNick(Contact_GetInfo(CNF_DISPLAY, NULL, szProto));
+ ptrW tszNick(Contact_GetInfo(CNF_DISPLAY, NULL, szProto));
if (tszNick == NULL)
return 1;
@@ -431,7 +431,7 @@ int Meta_CopyContactNick(DBCachedContact *ccMeta, MCONTACT hContact) return 1;
if (options.clist_contact_name == CNNT_NICK) {
- ptrT tszNick(db_get_tsa(hContact, szProto, "Nick"));
+ ptrW tszNick(db_get_tsa(hContact, szProto, "Nick"));
if (tszNick) {
db_set_ts(ccMeta->contactID, META_PROTO, "Nick", tszNick);
return 0;
@@ -439,7 +439,7 @@ int Meta_CopyContactNick(DBCachedContact *ccMeta, MCONTACT hContact) }
else if (options.clist_contact_name == CNNT_DISPLAYNAME) {
wchar_t *name = cli.pfnGetContactDisplayName(hContact, 0);
- if (name && mir_tstrcmp(name, TranslateT("(Unknown contact)")) != 0) {
+ if (name && mir_wstrcmp(name, TranslateT("(Unknown contact)")) != 0) {
db_set_ts(ccMeta->contactID, META_PROTO, "Nick", name);
return 0;
}
diff --git a/src/mir_app/src/movetogroup.cpp b/src/mir_app/src/movetogroup.cpp index 318be7e4d9..541404e28b 100644 --- a/src/mir_app/src/movetogroup.cpp +++ b/src/mir_app/src/movetogroup.cpp @@ -35,7 +35,7 @@ struct GroupItemSort int position;
GroupItemSort(wchar_t* pname, int pos)
- : name(mir_tstrdup(pname)), position(pos)
+ : name(mir_wstrdup(pname)), position(pos)
{
}
@@ -51,9 +51,9 @@ static wchar_t* PrepareGroupName(wchar_t* str) {
wchar_t* p = wcschr(str, '&'), *d;
if (p == NULL)
- return mir_tstrdup(str);
+ return mir_wstrdup(str);
- d = p = (wchar_t*)mir_alloc(sizeof(wchar_t)*(2 * mir_tstrlen(str) + 1));
+ d = p = (wchar_t*)mir_alloc(sizeof(wchar_t)*(2 * mir_wstrlen(str) + 1));
while (*str) {
if (*str == '&')
*d++ = '&';
@@ -92,7 +92,7 @@ static int OnContactMenuBuild(WPARAM wParam, LPARAM) Menu_RemoveItem((HGENMENU)lphGroupsItems[i]);
lphGroupsItems.destroy();
- ptrT szContactGroup(db_get_tsa(wParam, "CList", "Group"));
+ ptrW szContactGroup(db_get_tsa(wParam, "CList", "Group"));
int pos = 1000;
@@ -115,7 +115,7 @@ static int OnContactMenuBuild(WPARAM wParam, LPARAM) }
for (int i = 0; i < groups.getCount(); i++) {
- bool checked = szContactGroup && !mir_tstrcmp(szContactGroup, groups[i].name);
+ bool checked = szContactGroup && !mir_wstrcmp(szContactGroup, groups[i].name);
AddGroupItem(hMoveToGroupItem, groups[i].name, ++pos, groups[i].position, checked);
}
diff --git a/src/mir_app/src/netlib.cpp b/src/mir_app/src/netlib.cpp index 44d7282648..0dab252161 100644 --- a/src/mir_app/src/netlib.cpp +++ b/src/mir_app/src/netlib.cpp @@ -160,7 +160,7 @@ static INT_PTR NetlibRegisterUser(WPARAM, LPARAM lParam) }
if (nlu->szDescriptiveName)
- thisUser->user.ptszDescriptiveName = (thisUser->user.flags&NUF_UNICODE ? mir_u2t((WCHAR*)nlu->ptszDescriptiveName) : mir_a2t(nlu->szDescriptiveName));
+ thisUser->user.ptszDescriptiveName = (thisUser->user.flags&NUF_UNICODE ? mir_wstrdup((WCHAR*)nlu->ptszDescriptiveName) : mir_a2u(nlu->szDescriptiveName));
if ((thisUser->user.szSettingsModule = mir_strdup(nlu->szSettingsModule)) == NULL
|| (nlu->szDescriptiveName && thisUser->user.ptszDescriptiveName == NULL)
diff --git a/src/mir_app/src/netlibhttp.cpp b/src/mir_app/src/netlibhttp.cpp index e641c08209..cc83510207 100644 --- a/src/mir_app/src/netlibhttp.cpp +++ b/src/mir_app/src/netlibhttp.cpp @@ -257,12 +257,12 @@ struct HttpSecurityContext }
if (m_hNtlmSecurity) {
- ptrT szLogin, szPassw;
+ ptrW szLogin, szPassw;
if (nlu->settings.useProxyAuth) {
mir_cslock lck(csNetlibUser);
- szLogin = mir_a2t(nlu->settings.szProxyAuthUser);
- szPassw = mir_a2t(nlu->settings.szProxyAuthPassword);
+ szLogin = mir_a2u(nlu->settings.szProxyAuthUser);
+ szPassw = mir_a2u(nlu->settings.szProxyAuthPassword);
}
szAuthHdr = NtlmCreateResponseFromChallenge(m_hNtlmSecurity, szChallenge, szLogin, szPassw, true, complete);
diff --git a/src/mir_app/src/netliblog.cpp b/src/mir_app/src/netliblog.cpp index 7afeb86917..7c78bf6561 100644 --- a/src/mir_app/src/netliblog.cpp +++ b/src/mir_app/src/netliblog.cpp @@ -64,8 +64,8 @@ static void InitLog() hLogger = NULL;
}
- ptrT szBuf(db_get_tsa(NULL, "Netlib", "File"));
- if (mir_tstrlen(szBuf)) {
+ ptrW szBuf(db_get_tsa(NULL, "Netlib", "File"));
+ if (mir_wstrlen(szBuf)) {
logOptions.tszUserFile = szBuf.get();
wchar_t path[MAX_PATH];
@@ -160,7 +160,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa GetWindowText(GetWindow((HWND)lParam, GW_HWNDPREV), str, _countof(str));
{
wchar_t filter[200];
- mir_sntprintf(filter, L"%s (*)%c*%c", TranslateT("All files"), 0, 0);
+ mir_snwprintf(filter, L"%s (*)%c*%c", TranslateT("All files"), 0, 0);
OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
@@ -185,7 +185,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa if (LOWORD(wParam) == IDC_RUNATSTARTBROWSE && wcschr(str, ' ') != NULL) {
memmove(str + 1, str, ((_countof(str) - 2) * sizeof(wchar_t)));
str[0] = '"';
- mir_tstrcat(str, L"\"");
+ mir_wstrcat(str, L"\"");
}
SetWindowText(GetWindow((HWND)lParam, GW_HWNDPREV), str);
}
@@ -206,11 +206,11 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa db_set_b(NULL, "Netlib", "ShowLogOptsAtStart", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWTHISDLGATSTART));
GetDlgItemText(hwndDlg, IDC_FILENAME, str, _countof(str));
- logOptions.tszUserFile = rtrimt(str);
+ logOptions.tszUserFile = rtrimw(str);
db_set_ts(NULL, "Netlib", "File", str);
GetDlgItemText(hwndDlg, IDC_PATH, str, _countof(str));
- logOptions.tszFile = rtrimt(str);
+ logOptions.tszFile = rtrimw(str);
db_set_b(NULL, "Netlib", "DumpRecv", logOptions.dumpRecv = IsDlgButtonChecked(hwndDlg, IDC_DUMPRECV));
db_set_b(NULL, "Netlib", "DumpSent", logOptions.dumpSent = IsDlgButtonChecked(hwndDlg, IDC_DUMPSENT));
@@ -515,7 +515,7 @@ void NetlibLogInit(void) if (db_get_b(NULL, "Netlib", "ShowLogOptsAtStart", 0))
NetlibLogShowOptions();
- ptrT szBuf(db_get_tsa(NULL, "Netlib", "RunAtStart"));
+ ptrW szBuf(db_get_tsa(NULL, "Netlib", "RunAtStart"));
if (szBuf) {
STARTUPINFO si = { sizeof(si) };
PROCESS_INFORMATION pi;
diff --git a/src/mir_app/src/netlibopts.cpp b/src/mir_app/src/netlibopts.cpp index ffdde641fd..3a3c3512a5 100644 --- a/src/mir_app/src/netlibopts.cpp +++ b/src/mir_app/src/netlibopts.cpp @@ -341,7 +341,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, wchar_t str[80];
{
int selectedProxyType = SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_GETCURSEL, 0, 0), 0);
- mir_sntprintf(str, TranslateT("(often %d)"), oftenProxyPorts[selectedProxyType]);
+ mir_snwprintf(str, TranslateT("(often %d)"), oftenProxyPorts[selectedProxyType]);
SetDlgItemText(hwndDlg, IDC_STOFTENPORT, str);
if (IsDlgButtonChecked(hwndDlg, IDC_USEPROXY) != BST_UNCHECKED) {
int enableAuth = 0, enableUser = 0, enablePass = 0, enableServer = 1;
diff --git a/src/mir_app/src/netlibsecurity.cpp b/src/mir_app/src/netlibsecurity.cpp index 981a2b4dcd..351e9525c7 100644 --- a/src/mir_app/src/netlibsecurity.cpp +++ b/src/mir_app/src/netlibsecurity.cpp @@ -77,9 +77,9 @@ HANDLE NetlibInitSecurityProvider(const wchar_t* szProvider, const wchar_t* szPr {
HANDLE hSecurity = NULL;
- if (mir_tstrcmpi(szProvider, L"Basic") == 0) {
+ if (mir_wstrcmpi(szProvider, L"Basic") == 0) {
NtlmHandleType* hNtlm = (NtlmHandleType*)mir_calloc(sizeof(NtlmHandleType));
- hNtlm->szProvider = mir_tstrdup(szProvider);
+ hNtlm->szProvider = mir_wstrdup(szProvider);
SecInvalidateHandle(&hNtlm->hClientContext);
SecInvalidateHandle(&hNtlm->hClientCredential);
ntlmCnt++;
@@ -90,7 +90,7 @@ HANDLE NetlibInitSecurityProvider(const wchar_t* szProvider, const wchar_t* szPr mir_cslock lck(csSec);
PSecPkgInfo ntlmSecurityPackageInfo;
- bool isGSSAPI = mir_tstrcmpi(szProvider, L"GSSAPI") == 0;
+ bool isGSSAPI = mir_wstrcmpi(szProvider, L"GSSAPI") == 0;
const wchar_t *szProviderC = isGSSAPI ? L"Kerberos" : szProvider;
SECURITY_STATUS sc = QuerySecurityPackageInfo((LPTSTR)szProviderC, &ntlmSecurityPackageInfo);
if (sc == SEC_E_OK) {
@@ -100,8 +100,8 @@ HANDLE NetlibInitSecurityProvider(const wchar_t* szProvider, const wchar_t* szPr hNtlm->cbMaxToken = ntlmSecurityPackageInfo->cbMaxToken;
FreeContextBuffer(ntlmSecurityPackageInfo);
- hNtlm->szProvider = mir_tstrdup(szProvider);
- hNtlm->szPrincipal = mir_tstrdup(szPrincipal ? szPrincipal : L"");
+ hNtlm->szProvider = mir_wstrdup(szProvider);
+ hNtlm->szPrincipal = mir_wstrdup(szPrincipal ? szPrincipal : L"");
SecInvalidateHandle(&hNtlm->hClientContext);
SecInvalidateHandle(&hNtlm->hClientCredential);
ntlmCnt++;
@@ -213,8 +213,8 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, char *szOutputToken;
NtlmHandleType* hNtlm = (NtlmHandleType*)hSecurity;
- if (mir_tstrcmpi(hNtlm->szProvider, L"Basic")) {
- bool isGSSAPI = mir_tstrcmpi(hNtlm->szProvider, L"GSSAPI") == 0;
+ if (mir_wstrcmpi(hNtlm->szProvider, L"Basic")) {
+ bool isGSSAPI = mir_wstrcmpi(hNtlm->szProvider, L"GSSAPI") == 0;
wchar_t *szProvider = isGSSAPI ? (wchar_t*)L"Kerberos" : hNtlm->szProvider;
bool hasChallenge = szChallenge != NULL && szChallenge[0] != '\0';
if (hasChallenge) {
@@ -251,12 +251,12 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, else domainLen /= sizeof(wchar_t);
if (domainLen) {
- size_t newLoginLen = mir_tstrlen(login) + domainLen + 1;
+ size_t newLoginLen = mir_wstrlen(login) + domainLen + 1;
wchar_t *newLogin = (wchar_t*)alloca(newLoginLen * sizeof(wchar_t));
wcsncpy(newLogin, domainName, domainLen);
newLogin[domainLen] = '\\';
- mir_tstrcpy(newLogin + domainLen + 1, login);
+ mir_wstrcpy(newLogin + domainLen + 1, login);
char* szChl = NtlmCreateResponseFromChallenge(hSecurity, NULL, newLogin, psw, http, complete);
mir_free(szChl);
@@ -280,23 +280,23 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, const wchar_t* loginName = login;
const wchar_t* domainName = wcschr(login, '\\');
size_t domainLen = 0;
- size_t loginLen = mir_tstrlen(loginName);
+ size_t loginLen = mir_wstrlen(loginName);
if (domainName != NULL) {
loginName = domainName + 1;
- loginLen = mir_tstrlen(loginName);
+ loginLen = mir_wstrlen(loginName);
domainLen = domainName - login;
domainName = login;
}
else if ((domainName = wcschr(login, '@')) != NULL) {
loginName = login;
loginLen = domainName - login;
- domainLen = mir_tstrlen(++domainName);
+ domainLen = mir_wstrlen(++domainName);
}
auth.User = (PWORD)loginName;
auth.UserLength = (ULONG)loginLen;
auth.Password = (PWORD)psw;
- auth.PasswordLength = (ULONG)mir_tstrlen(psw);
+ auth.PasswordLength = (ULONG)mir_wstrlen(psw);
auth.Domain = (PWORD)domainName;
auth.DomainLength = (ULONG)domainLen;
auth.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
@@ -341,8 +341,8 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, else {
if (!login || !psw) return NULL;
- char *szLogin = mir_t2a(login);
- char *szPassw = mir_t2a(psw);
+ char *szLogin = mir_u2a(login);
+ char *szPassw = mir_u2a(psw);
size_t authLen = mir_strlen(szLogin) + mir_strlen(szPassw) + 5;
char *szAuth = (char*)alloca(authLen);
@@ -361,7 +361,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, if (!http)
return szOutputToken;
- ptrA szProvider(mir_t2a(hNtlm->szProvider));
+ ptrA szProvider(mir_u2a(hNtlm->szProvider));
size_t resLen = mir_strlen(szOutputToken) + mir_strlen(szProvider) + 10;
char *result = (char*)mir_alloc(resLen);
mir_snprintf(result, resLen, "%s %s", szProvider, szOutputToken);
diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp index 1e1bb4c995..51edc215b1 100644 --- a/src/mir_app/src/newplugins.cpp +++ b/src/mir_app/src/newplugins.cpp @@ -35,7 +35,7 @@ extern bool bModulesLoadedFired; static int sttComparePluginsByName(const pluginEntry* p1, const pluginEntry* p2)
{
- return mir_tstrcmpi(p1->pluginname, p2->pluginname);
+ return mir_wstrcmpi(p1->pluginname, p2->pluginname);
}
LIST<pluginEntry>
@@ -373,7 +373,7 @@ int Plugin_UnloadDyn(pluginEntry *p) static int valid_library_name(wchar_t *name)
{
wchar_t *dot = wcsrchr(name, '.');
- if (dot != NULL && mir_tstrcmpi(dot + 1, L"dll") == 0)
+ if (dot != NULL && mir_wstrcmpi(dot + 1, L"dll") == 0)
if (dot[4] == 0)
return 1;
@@ -389,7 +389,7 @@ void enumPlugins(SCAN_PLUGINS_CALLBACK cb, WPARAM wParam, LPARAM lParam) // create the search filter
wchar_t search[MAX_PATH];
- mir_sntprintf(search, L"%s\\Plugins\\*.dll", exe);
+ mir_snwprintf(search, L"%s\\Plugins\\*.dll", exe);
// FFFN will return filenames for things like dot dll+ or dot dllx
WIN32_FIND_DATA ffd;
@@ -413,7 +413,7 @@ pluginEntry* OpenPlugin(wchar_t *tszFileName, wchar_t *dir, wchar_t *path) pluginList.insert(p);
wchar_t tszFullPath[MAX_PATH];
- mir_sntprintf(tszFullPath, L"%s\\%s\\%s", path, dir, tszFileName);
+ mir_snwprintf(tszFullPath, L"%s\\%s\\%s", path, dir, tszFileName);
// map dll into the memory and check its exports
bool bIsPlugin = false;
@@ -482,7 +482,7 @@ int isPluginOnWhiteList(const wchar_t* pluginname) int rc = db_get_b(NULL, PLUGINDISABLELIST, _strlwr(_T2A(pluginname)), 0);
if (rc != 0 && askAboutIgnoredPlugins) {
wchar_t buf[256];
- mir_sntprintf(buf, TranslateT("'%s' is disabled, re-enable?"), pluginname);
+ mir_snwprintf(buf, TranslateT("'%s' is disabled, re-enable?"), pluginname);
if (MessageBox(NULL, buf, TranslateT("Re-enable Miranda plugin?"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
SetPluginOnWhiteList(pluginname, 1);
rc = 0;
@@ -506,7 +506,7 @@ bool TryLoadPlugin(pluginEntry *p, bool bDynamic) if (!(p->pclass & PCLASS_BASICAPI)) {
BASIC_PLUGIN_INFO bpi;
- mir_sntprintf(tszFullPath, L"%s\\%s\\%s", exe, (p->pclass & PCLASS_CORE) ? L"Core" : L"Plugins", p->pluginname);
+ mir_snwprintf(tszFullPath, L"%s\\%s\\%s", exe, (p->pclass & PCLASS_CORE) ? L"Core" : L"Plugins", p->pluginname);
if (!checkAPI(tszFullPath, &bpi, mirandaVersion, CHECKAPI_NONE)) {
p->pclass |= PCLASS_FAILED;
return false;
@@ -565,7 +565,7 @@ bool LoadCorePlugin(MuuidReplacement &mr) GetModuleFileName(NULL, exe, _countof(exe));
wchar_t *p = wcsrchr(exe, '\\'); if (p) *p = 0;
- mir_sntprintf(tszPlugName, L"%s.dll", mr.stdplugname);
+ mir_snwprintf(tszPlugName, L"%s.dll", mr.stdplugname);
pluginEntry* pPlug = OpenPlugin(tszPlugName, L"Core", exe);
if (pPlug->pclass & PCLASS_FAILED) {
LBL_Error:
@@ -623,14 +623,14 @@ static pluginEntry* getCListModule(wchar_t *exe) if (!isPluginOnWhiteList(p->pluginname))
continue;
- mir_sntprintf(tszFullPath, L"%s\\Plugins\\%s", exe, p->pluginname);
+ mir_snwprintf(tszFullPath, L"%s\\Plugins\\%s", exe, p->pluginname);
if (loadClistModule(tszFullPath, p))
return p;
}
MuuidReplacement& stdClist = pluginDefault[10];
if (LoadCorePlugin(stdClist)) {
- mir_sntprintf(tszFullPath, L"%s\\Core\\%s.dll", exe, stdClist.stdplugname);
+ mir_snwprintf(tszFullPath, L"%s\\Core\\%s.dll", exe, stdClist.stdplugname);
if (loadClistModule(tszFullPath, stdClist.pImpl))
return stdClist.pImpl;
}
@@ -642,7 +642,7 @@ int UnloadPlugin(wchar_t* buf, int bufLen) {
for (int i = pluginList.getCount() - 1; i >= 0; i--) {
pluginEntry *p = pluginList[i];
- if (!mir_tstrcmpi(p->pluginname, buf)) {
+ if (!mir_wstrcmpi(p->pluginname, buf)) {
GetModuleFileName(p->bpi.hInst, buf, bufLen);
Plugin_Uninit(p);
return TRUE;
@@ -686,7 +686,7 @@ int LoadDefaultServiceModePlugin() if (param == NULL || *param == 0)
return SERVICE_CONTINUE;
- size_t cbLen = mir_tstrlen(param);
+ size_t cbLen = mir_wstrlen(param);
for (int i = 0; i < servicePlugins.getCount(); i++) {
pluginEntry *p = servicePlugins[i];
if (!wcsnicmp(p->pluginname, param, cbLen)) {
@@ -709,7 +709,7 @@ void EnsureCheckerLoaded(bool bEnable) {
for (int i = 0; i < pluginList.getCount(); i++) {
pluginEntry *p = pluginList[i];
- if (mir_tstrcmpi(p->pluginname, L"dbchecker.dll"))
+ if (mir_wstrcmpi(p->pluginname, L"dbchecker.dll"))
continue;
if (bEnable) {
@@ -789,7 +789,7 @@ int LoadNewPluginsModule(void) // if freeimage is present, load it to provide the basic core functions
if (plugin_freeimg != NULL) {
BASIC_PLUGIN_INFO bpi;
- mir_sntprintf(fullPath, L"%s\\Plugins\\%s", exe, plugin_freeimg->pluginname);
+ mir_snwprintf(fullPath, L"%s\\Plugins\\%s", exe, plugin_freeimg->pluginname);
if (checkAPI(fullPath, &bpi, mirandaVersion, CHECKAPI_NONE)) {
plugin_freeimg->bpi = bpi;
plugin_freeimg->pclass |= PCLASS_OK | PCLASS_BASICAPI;
@@ -838,12 +838,12 @@ static BOOL scanPluginsDir(WIN32_FIND_DATA *fd, wchar_t *path, WPARAM, LPARAM) {
pluginEntry *p = OpenPlugin(fd->cFileName, L"Plugins", path);
if (!(p->pclass & PCLASS_FAILED)) {
- if (plugin_freeimg == NULL && mir_tstrcmpi(fd->cFileName, L"advaimg.dll") == 0) {
+ if (plugin_freeimg == NULL && mir_wstrcmpi(fd->cFileName, L"advaimg.dll") == 0) {
plugin_freeimg = p;
p->pclass |= PCLASS_LAST;
}
- if (plugin_crshdmp == NULL && mir_tstrcmpi(fd->cFileName, L"crashdumper.dll") == 0) {
+ if (plugin_crshdmp == NULL && mir_wstrcmpi(fd->cFileName, L"crashdumper.dll") == 0) {
plugin_crshdmp = p;
p->pclass |= PCLASS_LAST;
}
diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp index f26424a933..556fb50687 100644 --- a/src/mir_app/src/options.cpp +++ b/src/mir_app/src/options.cpp @@ -92,19 +92,19 @@ struct OptionsPageData : public MZeroedObject hLangpack = src->hLangpack;
if (src->flags & ODPF_UNICODE)
- ptszTitle = mir_tstrdup(src->pwszTitle);
+ ptszTitle = mir_wstrdup(src->pwszTitle);
else
- ptszTitle = mir_a2t(src->pszTitle);
+ ptszTitle = mir_a2u(src->pszTitle);
if (src->flags & ODPF_UNICODE)
- ptszGroup = mir_tstrdup(src->pwszGroup);
+ ptszGroup = mir_wstrdup(src->pwszGroup);
else
- ptszGroup = mir_a2t(src->pszGroup);
+ ptszGroup = mir_a2u(src->pszGroup);
if (src->flags & ODPF_UNICODE)
- ptszTab = mir_tstrdup(src->pwszTab);
+ ptszTab = mir_wstrdup(src->pwszTab);
else
- ptszTab = mir_a2t(src->pszTab);
+ ptszTab = mir_a2u(src->pszTab);
}
~OptionsPageData()
@@ -164,7 +164,7 @@ HTREEITEM FindNamedTreeItemAtRoot(HWND hwndTree, const wchar_t* name) tvi.hItem = TreeView_GetRoot(hwndTree);
while (tvi.hItem != NULL) {
SendMessage(hwndTree, TVM_GETITEM, 0, (LPARAM)&tvi);
- if (!mir_tstrcmpi(str, name))
+ if (!mir_wstrcmpi(str, name))
return tvi.hItem;
tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
@@ -182,7 +182,7 @@ static HTREEITEM FindNamedTreeItemAtChildren(HWND hwndTree, HTREEITEM hItem, con tvi.hItem = TreeView_GetChild(hwndTree, hItem);
while (tvi.hItem != NULL) {
SendMessage(hwndTree, TVM_GETITEM, 0, (LPARAM)&tvi);
- if (!mir_tstrcmpi(str, name))
+ if (!mir_wstrcmpi(str, name))
return tvi.hItem;
tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
@@ -195,7 +195,7 @@ static BOOL CALLBACK BoldGroupTitlesEnumChildren(HWND hwnd, LPARAM lParam) wchar_t szClass[64];
GetClassName(hwnd, szClass, _countof(szClass));
- if (!mir_tstrcmp(szClass, L"Button") && (GetWindowLongPtr(hwnd, GWL_STYLE) & 0x0F) == BS_GROUPBOX)
+ if (!mir_wstrcmp(szClass, L"Button") && (GetWindowLongPtr(hwnd, GWL_STYLE) & 0x0F) == BS_GROUPBOX)
SendMessage(hwnd, WM_SETFONT, lParam, 0);
return TRUE;
}
@@ -299,9 +299,9 @@ static LRESULT CALLBACK OptionsFilterSubclassProc(HWND hWnd, UINT message, WPARA wchar_t buf[255];
if (bSearchState == 1 && FilterLoadProgress < 100 && FilterLoadProgress > 0)
- mir_sntprintf(buf, TranslateT("Loading... %d%%"), FilterLoadProgress);
+ mir_snwprintf(buf, TranslateT("Loading... %d%%"), FilterLoadProgress);
else
- mir_sntprintf(buf, TranslateT("Search"));
+ mir_snwprintf(buf, TranslateT("Search"));
bool bDrawnByTheme = false;
@@ -507,9 +507,9 @@ static void FillFilterCombo(HWND hDlg, OptionsDlgData* dat) wchar_t tszModuleName[MAX_PATH];
GetModuleFileName(inst, tszModuleName, _countof(tszModuleName));
- wchar_t *dllName = mir_a2t(GetPluginNameByInstance(inst));
- if (!dllName) dllName = mir_tstrdup(wcsrchr(tszModuleName, '\\'));
- if (!dllName) dllName = mir_tstrdup(tszModuleName);
+ wchar_t *dllName = mir_a2u(GetPluginNameByInstance(inst));
+ if (!dllName) dllName = mir_wstrdup(wcsrchr(tszModuleName, '\\'));
+ if (!dllName) dllName = mir_wstrdup(tszModuleName);
if (dllName) {
index = SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT)CB_ADDSTRING, 0, (LPARAM)dllName);
SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT)CB_SETITEMDATA, (WPARAM)index, (LPARAM)inst);
@@ -527,12 +527,12 @@ static void RebuildPageTree(HWND hdlg, OptionsDlgData *dat) // if filter string is set to all modules then make the filter string empty (this will return all modules)
BOOL bRemoveFocusFromFilter = FALSE;
- if (mir_tstrcmp(dat->szFilterString, ALL_MODULES_FILTER) == 0) {
+ if (mir_wstrcmp(dat->szFilterString, ALL_MODULES_FILTER) == 0) {
dat->szFilterString[0] = 0;
bRemoveFocusFromFilter = TRUE;
}
// if filter string is set to core modules replace it with the name of the executable (this will return all core modules)
- else if (mir_tstrcmp(dat->szFilterString, CORE_MODULES_FILTER) == 0) {
+ else if (mir_wstrcmp(dat->szFilterString, CORE_MODULES_FILTER) == 0) {
// replace string with process name - that will show core settings
wchar_t szFileName[300];
GetModuleFileName(g_hInst, szFileName, _countof(szFileName));
@@ -695,7 +695,7 @@ static BOOL IsInsideTab(HWND hdlg, OptionsDlgData *dat, int i) for (int j = 0; j < dat->arOpd.getCount() && pages < 2; j++) {
OptionsPageData* opd2 = dat->arOpd[j];
if (!CheckPageShow(hdlg, dat, j)) continue;
- if (mir_tstrcmp(opd2->ptszTitle, opd->ptszTitle) || mir_tstrcmp(opd2->ptszGroup, opd->ptszGroup))
+ if (mir_wstrcmp(opd2->ptszTitle, opd->ptszTitle) || mir_wstrcmp(opd2->ptszGroup, opd->ptszGroup))
continue;
pages++;
}
@@ -795,7 +795,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L dat->hPluginUnload = HookEventMessage(ME_SYSTEM_MODULEUNLOAD, hdlg, HM_MODULEUNLOAD);
dat->currentPage = -1;
- ptrT lastPage, lastGroup, lastTab;
+ ptrW lastPage, lastGroup, lastTab;
OPENOPTIONSDIALOG *ood = (OPENOPTIONSDIALOG*)psh->pStartPage;
if (ood->pszPage == NULL) {
lastPage = db_get_tsa(NULL, "Options", "LastPage");
@@ -803,17 +803,17 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L if (ood->pszGroup == NULL)
lastGroup = db_get_tsa(NULL, "Options", "LastGroup");
else
- lastGroup = mir_a2t(ood->pszGroup);
+ lastGroup = mir_a2u(ood->pszGroup);
}
else {
- lastPage = mir_a2t(ood->pszPage);
- lastGroup = mir_a2t(ood->pszGroup);
+ lastPage = mir_a2u(ood->pszPage);
+ lastGroup = mir_a2u(ood->pszGroup);
}
if (ood->pszTab == NULL)
lastTab = db_get_tsa(NULL, "Options", "LastTab");
else
- lastTab = mir_a2t(ood->pszTab);
+ lastTab = mir_a2u(ood->pszTab);
OPTIONSDIALOGPAGE *odp = (OPTIONSDIALOGPAGE*)psh->ppsp;
for (UINT i = 0; i < psh->nPages; i++, odp++) {
@@ -823,8 +823,8 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L else
dat->arOpd.insert(opd);
- if (!mir_tstrcmp(lastPage, odp->pwszTitle) && !mir_tstrcmp(lastGroup, odp->pwszGroup))
- if ((ood->pszTab == NULL && dat->currentPage == -1) || !mir_tstrcmp(lastTab, odp->pwszTab))
+ if (!mir_wstrcmp(lastPage, odp->pwszTitle) && !mir_wstrcmp(lastGroup, odp->pwszGroup))
+ if ((ood->pszTab == NULL && dat->currentPage == -1) || !mir_wstrcmp(lastTab, odp->pwszTab))
dat->currentPage = (int)i;
}
@@ -976,13 +976,13 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L continue;
OptionsPageData *p = dat->arOpd[i];
- if (mir_tstrcmp(opd->ptszTitle, p->ptszTitle) || mir_tstrcmp(opd->ptszGroup, p->ptszGroup))
+ if (mir_wstrcmp(opd->ptszTitle, p->ptszTitle) || mir_wstrcmp(opd->ptszGroup, p->ptszGroup))
continue;
tie.pszText = TranslateTH(p->hLangpack, p->ptszTab);
tie.lParam = i;
TabCtrl_InsertItem(hwndTab, pages, &tie);
- if (!mir_tstrcmp(opd->ptszTab, p->ptszTab))
+ if (!mir_wstrcmp(opd->ptszTab, p->ptszTab))
sel = pages;
pages++;
}
@@ -1148,11 +1148,11 @@ void OpenAccountOptions(PROTOACCOUNT *pa) return;
wchar_t tszTitle[100];
- mir_sntprintf(tszTitle, TranslateT("%s options"), pa->tszAccountName);
+ mir_snwprintf(tszTitle, TranslateT("%s options"), pa->tszAccountName);
OPENOPTIONSDIALOG ood = { sizeof(ood) };
ood.pszGroup = LPGEN("Network");
- ood.pszPage = mir_t2a(pa->tszAccountName);
+ ood.pszPage = mir_u2a(pa->tszAccountName);
PROPSHEETHEADER psh = { sizeof(psh) };
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW;
@@ -1172,10 +1172,10 @@ static void OpenOptionsNow(int _hLang, const char *pszGroup, const char *pszPage ShowWindow(hwndOptions, SW_RESTORE);
SetForegroundWindow(hwndOptions);
if (pszPage != NULL) {
- ptrT ptszPage(mir_a2t(pszPage));
+ ptrW ptszPage(mir_a2u(pszPage));
HTREEITEM hItem = NULL;
if (pszGroup != NULL) {
- ptrT ptszGroup(mir_a2t(pszGroup));
+ ptrW ptszGroup(mir_a2u(pszGroup));
hItem = FindNamedTreeItemAtRoot(GetDlgItem(hwndOptions, IDC_PAGETREE), TranslateTH(_hLang, ptszGroup));
if (hItem != NULL)
hItem = FindNamedTreeItemAtChildren(GetDlgItem(hwndOptions, IDC_PAGETREE), hItem, TranslateTH(_hLang, ptszPage));
@@ -1267,7 +1267,7 @@ static INT_PTR AddOptionsPage(WPARAM wParam, LPARAM lParam) if (odp->flags & ODPF_UNICODE)
dst->pwszGroup = mir_wstrdup(odp->pwszGroup);
else {
- dst->pwszGroup = mir_a2t(odp->pszGroup);
+ dst->pwszGroup = mir_a2u(odp->pszGroup);
dst->flags |= ODPF_UNICODE;
}
}
@@ -1276,7 +1276,7 @@ static INT_PTR AddOptionsPage(WPARAM wParam, LPARAM lParam) if (odp->flags & ODPF_UNICODE)
dst->pwszTab = mir_wstrdup(odp->pwszTab);
else {
- dst->pwszTab = mir_a2t(odp->pszTab);
+ dst->pwszTab = mir_a2u(odp->pszTab);
dst->flags |= ODPF_UNICODE;
}
}
diff --git a/src/mir_app/src/path.cpp b/src/mir_app/src/path.cpp index c7dd2d468d..cc1986da61 100644 --- a/src/mir_app/src/path.cpp +++ b/src/mir_app/src/path.cpp @@ -57,13 +57,13 @@ static __forceinline char *mir_a2x(const char*, const char *s) { return mir_strd static __forceinline char *GetContactNickX(const char*, MCONTACT hContact)
{
- return mir_t2a(cli.pfnGetContactDisplayName(hContact, 0));
+ return mir_u2a(cli.pfnGetContactDisplayName(hContact, 0));
}
static __forceinline char *GetContactIDX(const char*, MCONTACT hContact)
{
wchar_t *id = GetContactID(hContact);
- char* res = mir_t2a(id);
+ char* res = mir_u2a(id);
mir_free(id);
return res;
}
@@ -78,7 +78,7 @@ static __forceinline char *GetEnvironmentVariableX(const char *variable) static __forceinline char *GetProfileDirX(const char*)
{
- return mir_t2a(g_profileDir);
+ return mir_u2a(g_profileDir);
}
static __forceinline char *SHGetSpecialFolderPathX(int iCSIDL, char*)
@@ -109,7 +109,7 @@ static __forceinline char *GetUserNameX(const char*) static __forceinline char *GetProfileNameX(const char*)
{
- return mir_t2a(g_shortProfileName);
+ return mir_u2a(g_shortProfileName);
}
static __forceinline char* GetPathVarX(const char*, int code)
@@ -121,13 +121,13 @@ static __forceinline char* GetPathVarX(const char*, int code) if (hAvatarFolder != NULL)
wcsncpy_s(szFullPath, tszAvatarRoot, _TRUNCATE);
else
- mir_sntprintf(szFullPath, L"%s\\%s\\AvatarCache", g_profileDir, g_shortProfileName);
+ mir_snwprintf(szFullPath, L"%s\\%s\\AvatarCache", g_profileDir, g_shortProfileName);
break;
case 2:
- mir_sntprintf(szFullPath, L"%s\\%s\\Logs", g_profileDir, g_shortProfileName);
+ mir_snwprintf(szFullPath, L"%s\\%s\\Logs", g_profileDir, g_shortProfileName);
break;
case 3:
- mir_sntprintf(szFullPath, L"%s\\%s", g_profileDir, g_shortProfileName);
+ mir_snwprintf(szFullPath, L"%s\\%s", g_profileDir, g_shortProfileName);
break;
}
return makeFileName(szFullPath);
@@ -140,11 +140,11 @@ static __forceinline wchar_t* _xcscpy(wchar_t *s1, const wchar_t *s2) { return w static __forceinline wchar_t* _xcsncpy(wchar_t *s1, const wchar_t *s2, size_t n) { return wcsncpy(s1, s2, n); }
static __forceinline const wchar_t* _xstrselect(const wchar_t*, const char*, const wchar_t *s2) { return s2; }
static __forceinline wchar_t* _itox(wchar_t *, int a) { return _itow(a, (wchar_t *)mir_alloc(sizeof(wchar_t)*20), 10); }
-static __forceinline wchar_t* mir_a2x(const wchar_t *, const char *s) { return mir_a2t(s); }
+static __forceinline wchar_t* mir_a2x(const wchar_t *, const char *s) { return mir_a2u(s); }
static __forceinline wchar_t* GetContactNickX(const wchar_t*, MCONTACT hContact)
{
- return mir_tstrdup(cli.pfnGetContactDisplayName(hContact, 0));
+ return mir_wstrdup(cli.pfnGetContactDisplayName(hContact, 0));
}
static __forceinline wchar_t* GetContactIDX(const wchar_t*, MCONTACT hContact)
@@ -156,7 +156,7 @@ static __forceinline wchar_t* GetEnvironmentVariableX(const wchar_t *variable) {
wchar_t result[512];
if (GetEnvironmentVariable(variable, result, _countof(result)))
- return mir_tstrdup(result);
+ return mir_wstrdup(result);
return NULL;
}
@@ -164,13 +164,13 @@ static __forceinline wchar_t* SHGetSpecialFolderPathX(int iCSIDL, wchar_t*) {
wchar_t result[512];
if (SHGetSpecialFolderPath(NULL, result, iCSIDL, FALSE))
- return mir_tstrdup(result);
+ return mir_wstrdup(result);
return NULL;
}
static __forceinline wchar_t* GetProfileDirX(const wchar_t*)
{
- return mir_tstrdup(g_profileDir);
+ return mir_wstrdup(g_profileDir);
}
static __forceinline wchar_t* GetModulePathX(const wchar_t*, HMODULE hModule)
@@ -179,7 +179,7 @@ static __forceinline wchar_t* GetModulePathX(const wchar_t*, HMODULE hModule) GetModuleFileName(hModule, result, _countof(result));
wchar_t* str = wcsrchr(result, '\\');
if (str) *str = 0;
- return mir_tstrdup(result);
+ return mir_wstrdup(result);
}
static __forceinline wchar_t* GetUserNameX(const wchar_t*)
@@ -187,13 +187,13 @@ static __forceinline wchar_t* GetUserNameX(const wchar_t*) wchar_t result[128];
DWORD size = _countof(result);
if (GetUserName(result, &size))
- return mir_tstrdup(result);
+ return mir_wstrdup(result);
return NULL;
}
static __forceinline wchar_t* GetProfileNameX(const wchar_t*)
{
- return mir_tstrdup(g_shortProfileName);
+ return mir_wstrdup(g_shortProfileName);
}
static __forceinline wchar_t* GetPathVarX(const wchar_t*, int code)
@@ -205,16 +205,16 @@ static __forceinline wchar_t* GetPathVarX(const wchar_t*, int code) if (hAvatarFolder != NULL)
wcsncpy_s(szFullPath, tszAvatarRoot, _TRUNCATE);
else
- mir_sntprintf(szFullPath, L"%s\\%s\\AvatarCache", g_profileDir, g_shortProfileName);
+ mir_snwprintf(szFullPath, L"%s\\%s\\AvatarCache", g_profileDir, g_shortProfileName);
break;
case 2:
- mir_sntprintf(szFullPath, L"%s\\%s\\Logs", g_profileDir, g_shortProfileName);
+ mir_snwprintf(szFullPath, L"%s\\%s\\Logs", g_profileDir, g_shortProfileName);
break;
case 3:
- mir_sntprintf(szFullPath, L"%s\\%s", g_profileDir, g_shortProfileName);
+ mir_snwprintf(szFullPath, L"%s\\%s", g_profileDir, g_shortProfileName);
break;
}
- return mir_tstrdup(szFullPath);
+ return mir_wstrdup(szFullPath);
}
template<typename XCHAR>
@@ -364,7 +364,7 @@ MIR_APP_DLL(wchar_t*) Utils_ReplaceVarsW(const wchar_t *wszData, MCONTACT hConta static int OnFoldersChanged(WPARAM, LPARAM)
{
- mir_sntprintf(tszAvatarRoot, L"%s\\%s\\AvatarCache", g_profileDir, g_shortProfileName);
+ mir_snwprintf(tszAvatarRoot, L"%s\\%s\\AvatarCache", g_profileDir, g_shortProfileName);
wchar_t tmpVar[MAX_PATH];
if (!FoldersGetCustomPathT(hAvatarFolder, tmpVar, _countof(tmpVar), tszAvatarRoot))
@@ -374,7 +374,7 @@ static int OnFoldersChanged(WPARAM, LPARAM) void InitPathVar()
{
- mir_sntprintf(tszAvatarRoot, L"%s\\%s\\AvatarCache", g_profileDir, g_shortProfileName);
+ mir_snwprintf(tszAvatarRoot, L"%s\\%s\\AvatarCache", g_profileDir, g_shortProfileName);
if (hAvatarFolder = FoldersRegisterCustomPathT( LPGEN("Avatars"), LPGEN("Avatars root folder"), tszAvatarRoot)) {
wchar_t tmpVar[MAX_PATH];
if (!FoldersGetCustomPathT(hAvatarFolder, tmpVar, _countof(tmpVar), tszAvatarRoot))
diff --git a/src/mir_app/src/pluginopts.cpp b/src/mir_app/src/pluginopts.cpp index 757a0318c1..cc4e3132b5 100644 --- a/src/mir_app/src/pluginopts.cpp +++ b/src/mir_app/src/pluginopts.cpp @@ -53,7 +53,7 @@ struct PluginListItemData static int sttSortPlugins(const PluginListItemData *p1, const PluginListItemData *p2)
{
- return mir_tstrcmp(p1->fileName, p2->fileName);
+ return mir_wstrcmp(p1->fileName, p2->fileName);
}
static LIST<PluginListItemData> arPluginList(10, sttSortPlugins);
@@ -61,7 +61,7 @@ static LIST<PluginListItemData> arPluginList(10, sttSortPlugins); static BOOL dialogListPlugins(WIN32_FIND_DATA *fd, wchar_t *path, WPARAM, LPARAM lParam)
{
wchar_t buf[MAX_PATH];
- mir_sntprintf(buf, L"%s\\Plugins\\%s", path, fd->cFileName);
+ mir_snwprintf(buf, L"%s\\Plugins\\%s", path, fd->cFileName);
HINSTANCE hInst = GetModuleHandle(buf);
BASIC_PLUGIN_INFO pi;
@@ -121,7 +121,7 @@ static BOOL dialogListPlugins(WIN32_FIND_DATA *fd, wchar_t *path, WPARAM, LPARAM else
memset(&dat->uuid, 0, sizeof(dat->uuid));
- wchar_t *shortNameT = mir_a2t(pi.pluginInfo->shortName);
+ wchar_t *shortNameT = mir_a2u(pi.pluginInfo->shortName);
// column 3: plugin short name
if (shortNameT) {
ListView_SetItemText(hwndList, iRow, 2, shortNameT);
@@ -136,12 +136,12 @@ static BOOL dialogListPlugins(WIN32_FIND_DATA *fd, wchar_t *path, WPARAM, LPARAM void *pVerInfo = mir_alloc(verInfoSize);
GetFileVersionInfo(buf, 0, verInfoSize, pVerInfo);
VerQueryValue(pVerInfo, L"\\", (LPVOID*)&fi, &blockSize);
- mir_sntprintf(buf, L"%d.%d.%d.%d", HIWORD(fi->dwProductVersionMS),
+ mir_snwprintf(buf, L"%d.%d.%d.%d", HIWORD(fi->dwProductVersionMS),
LOWORD(fi->dwProductVersionMS), HIWORD(fi->dwProductVersionLS), LOWORD(fi->dwProductVersionLS));
mir_free(pVerInfo);
}
else
- mir_sntprintf(buf, L"%d.%d.%d.%d", HIBYTE(HIWORD(pi.pluginInfo->version)),
+ mir_snwprintf(buf, L"%d.%d.%d.%d", HIBYTE(HIWORD(pi.pluginInfo->version)),
LOBYTE(HIWORD(pi.pluginInfo->version)), HIBYTE(LOWORD(pi.pluginInfo->version)),
LOBYTE(LOWORD(pi.pluginInfo->version)));
@@ -299,15 +299,15 @@ static LRESULT CALLBACK PluginListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LP static int CALLBACK SortPlugins(WPARAM i1, LPARAM i2, LPARAM)
{
PluginListItemData *p1 = (PluginListItemData*)i1, *p2 = (PluginListItemData*)i2;
- return mir_tstrcmp(p1->fileName, p2->fileName);
+ return mir_wstrcmp(p1->fileName, p2->fileName);
}
static wchar_t *latin2t(const char *p)
{
if (p == NULL)
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
- return mir_a2t_cp(p, 1250);
+ return mir_a2u_cp(p, 1250);
}
INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -427,19 +427,19 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar ListView_GetItemText(hwndList, hdr->iItem, 2, buf, _countof(buf));
SetDlgItemText(hwndDlg, IDC_PLUGININFOFRAME, sel ? buf : L"");
- ptrT tszAuthor(latin2t(sel ? dat->author : NULL));
+ ptrW tszAuthor(latin2t(sel ? dat->author : NULL));
SetDlgItemText(hwndDlg, IDC_PLUGINAUTHOR, tszAuthor);
- ptrT tszEmail(latin2t(sel ? dat->authorEmail : NULL));
+ ptrW tszEmail(latin2t(sel ? dat->authorEmail : NULL));
SetDlgItemText(hwndDlg, IDC_PLUGINEMAIL, tszEmail);
- ptrT p(Langpack_PcharToTchar(dat->description));
+ ptrW p(Langpack_PcharToTchar(dat->description));
SetDlgItemText(hwndDlg, IDC_PLUGINLONGINFO, sel ? p.get() : L"");
- ptrT tszCopyright(latin2t(sel ? dat->copyright : NULL));
+ ptrW tszCopyright(latin2t(sel ? dat->copyright : NULL));
SetDlgItemText(hwndDlg, IDC_PLUGINCPYR, tszCopyright);
- ptrT tszUrl(latin2t(sel ? dat->homepage : NULL));
+ ptrW tszUrl(latin2t(sel ? dat->homepage : NULL));
SetDlgItemText(hwndDlg, IDC_PLUGINURL, tszUrl);
if (dat->uuid != miid_last) {
@@ -455,7 +455,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar if (hdr->hdr.code == PSN_APPLY) {
bool needRestart = false;
wchar_t bufRestart[1024];
- int bufLen = mir_sntprintf(bufRestart, L"%s\n", TranslateT("Miranda NG must be restarted to apply changes for these plugins:"));
+ int bufLen = mir_snwprintf(bufRestart, L"%s\n", TranslateT("Miranda NG must be restarted to apply changes for these plugins:"));
HWND hwndList = GetDlgItem(hwndDlg, IDC_PLUGLIST);
for (int iRow = 0; iRow != -1;) {
@@ -482,7 +482,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar ListView_SetItem(hwndList, &lvi);
}
else {
- bufLen += mir_sntprintf(bufRestart + bufLen, _countof(bufRestart) - bufLen, L" - %s\n", buf);
+ bufLen += mir_snwprintf(bufRestart + bufLen, _countof(bufRestart) - bufLen, L" - %s\n", buf);
needRestart = true;
}
}
@@ -495,7 +495,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar ListView_SetItem(hwndList, &lvi);
}
else {
- bufLen += mir_sntprintf(bufRestart + bufLen, _countof(bufRestart) - bufLen, L" - %s\n", buf);
+ bufLen += mir_snwprintf(bufRestart + bufLen, _countof(bufRestart) - bufLen, L" - %s\n", buf);
needRestart = true;
}
}
@@ -509,7 +509,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar ShowWindow(GetDlgItem(hwndDlg, IDC_RESTART), needRestart);
if (needRestart) {
- mir_sntprintf(bufRestart + bufLen, _countof(bufRestart) - bufLen, L"\n%s", TranslateT("Do you want to restart it now?"));
+ mir_snwprintf(bufRestart + bufLen, _countof(bufRestart) - bufLen, L"\n%s", TranslateT("Do you want to restart it now?"));
if (MessageBox(hwndDlg, bufRestart, L"Miranda NG", MB_ICONWARNING | MB_YESNO) == IDYES)
CallService(MS_SYSTEM_RESTART, 1, 0);
}
diff --git a/src/mir_app/src/profilemanager.cpp b/src/mir_app/src/profilemanager.cpp index 38465b5165..bac436b91a 100644 --- a/src/mir_app/src/profilemanager.cpp +++ b/src/mir_app/src/profilemanager.cpp @@ -46,7 +46,7 @@ static int findProfiles(wchar_t *szProfileDir, ENUMPROFILECALLBACK callback, LPA { // find in Miranda NG profile subfolders wchar_t searchspec[MAX_PATH]; - mir_sntprintf(searchspec, L"%s\\*.*", szProfileDir); + mir_snwprintf(searchspec, L"%s\\*.*", szProfileDir); WIN32_FIND_DATA ffd; HANDLE hFind = FindFirstFile(searchspec, &ffd); @@ -55,11 +55,11 @@ static int findProfiles(wchar_t *szProfileDir, ENUMPROFILECALLBACK callback, LPA do { // find all subfolders except "." and ".." - if ((ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && mir_tstrcmp(ffd.cFileName, L".") && mir_tstrcmp(ffd.cFileName, L"..")) { + if ((ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && mir_wstrcmp(ffd.cFileName, L".") && mir_wstrcmp(ffd.cFileName, L"..")) { wchar_t buf[MAX_PATH], profile[MAX_PATH]; - mir_sntprintf(buf, L"%s\\%s\\%s.dat", szProfileDir, ffd.cFileName, ffd.cFileName); + mir_snwprintf(buf, L"%s\\%s\\%s.dat", szProfileDir, ffd.cFileName, ffd.cFileName); if (_waccess(buf, 0) == 0) { - mir_sntprintf(profile, L"%s.dat", ffd.cFileName); + mir_snwprintf(profile, L"%s.dat", ffd.cFileName); if (!callback(buf, profile, lParam)) break; } @@ -95,7 +95,7 @@ class CCreateProfileDlg : public CDlgBase if (file) file++; if (_waccess(profile, 0) == 0) { // file already exists! - mir_sntprintf(buf, + mir_snwprintf(buf, TranslateT("The profile '%s' already exists. Do you want to move it to the Recycle Bin?\n\nWARNING: The profile will be deleted if Recycle Bin is disabled.\nWARNING: A profile may contain confidential information and should be properly deleted."), file); if (MessageBox(m_hwnd, buf, TranslateT("The profile already exists"), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2) != IDYES) @@ -106,9 +106,9 @@ class CCreateProfileDlg : public CDlgBase sf.wFunc = FO_DELETE; sf.pFrom = buf; sf.fFlags = FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT | FOF_ALLOWUNDO; - mir_sntprintf(buf, L"%s\0", profile); + mir_snwprintf(buf, L"%s\0", profile); if (SHFileOperation(&sf) != 0) { - mir_sntprintf(buf, TranslateT("Couldn't move '%s' to the Recycle Bin. Please select another profile name."), file); + mir_snwprintf(buf, TranslateT("Couldn't move '%s' to the Recycle Bin. Please select another profile name."), file); MessageBox(m_hwnd, buf, TranslateT("Problem moving profile"), MB_ICONINFORMATION | MB_OK); return 0; } @@ -117,7 +117,7 @@ class CCreateProfileDlg : public CDlgBase // ask the database to create the profile CreatePathToFileT(profile); if ((err = link->makeDatabase(profile)) != ERROR_SUCCESS) { - mir_sntprintf(buf, TranslateT("Unable to create the profile '%s', the error was %x"), file, err); + mir_snwprintf(buf, TranslateT("Unable to create the profile '%s', the error was %x"), file, err); MessageBox(m_hwnd, buf, TranslateT("Problem creating profile"), MB_ICONERROR | MB_OK); return 0; } @@ -212,12 +212,12 @@ public: if (curSel == -1 || !m_bFocused) return; // should never happen - ptrT szName(m_profileName.GetText()); - if (mir_tstrlen(szName) == 0) + ptrW szName(m_profileName.GetText()); + if (mir_wstrlen(szName) == 0) return; // profile placed in "profile_name" subfolder - mir_sntprintf(m_pd->ptszProfile, MAX_PATH, L"%s\\%s\\%s.dat", m_pd->ptszProfileDir, szName, szName); + mir_snwprintf(m_pd->ptszProfile, MAX_PATH, L"%s\\%s\\%s.dat", m_pd->ptszProfileDir, szName, szName); m_pd->newProfile = 1; m_pd->dblink = (DATABASELINK *)m_driverList.GetItemData(curSel); @@ -257,7 +257,7 @@ class CChooseProfileDlg : public CDlgBase bool bFileLocked = true; wchar_t *p = wcsrchr(profile, '.'); - mir_tstrcpy(sizeBuf, L"0 KB"); + mir_wstrcpy(sizeBuf, L"0 KB"); if (p != NULL) *p = 0; LVITEM item = { 0 }; @@ -268,12 +268,12 @@ class CChooseProfileDlg : public CDlgBase struct _stat statbuf; if (_wstat(tszFullPath, &statbuf) == 0) { if (statbuf.st_size > 1000000) { - mir_sntprintf(sizeBuf, L"%.3lf", (double)statbuf.st_size / 1048576.0); - mir_tstrcpy(sizeBuf + 5, L" MB"); + mir_snwprintf(sizeBuf, L"%.3lf", (double)statbuf.st_size / 1048576.0); + mir_wstrcpy(sizeBuf + 5, L" MB"); } else { - mir_sntprintf(sizeBuf, L"%.3lf", (double)statbuf.st_size / 1024.0); - mir_tstrcpy(sizeBuf + 5, L" KB"); + mir_snwprintf(sizeBuf, L"%.3lf", (double)statbuf.st_size / 1024.0); + mir_wstrcpy(sizeBuf + 5, L" KB"); } bFileLocked = !fileExist(tszFullPath); } @@ -293,7 +293,7 @@ class CChooseProfileDlg : public CDlgBase } int iItem = list.InsertItem(&item); - if (mir_tstrcmpi(ped->szProfile, tszFullPath) == 0) + if (mir_wstrcmpi(ped->szProfile, tszFullPath) == 0) list.SetItemState(iItem, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); list.SetItemText(iItem, 2, sizeBuf); @@ -323,7 +323,7 @@ class CChooseProfileDlg : public CDlgBase if (!m_profileList.GetItem(&item)) return; - mir_sntprintf(fullName, L"%s\\%s\\%s.dat", m_pd->ptszProfileDir, profile, profile); + mir_snwprintf(fullName, L"%s\\%s\\%s.dat", m_pd->ptszProfileDir, profile, profile); CallService(MS_DB_CHECKPROFILE, (WPARAM)fullName, item.iImage == 2); } @@ -342,11 +342,11 @@ class CChooseProfileDlg : public CDlgBase if (!m_profileList.GetItem(&item)) return; - mir_sntprintf(profilef, TranslateT("Are you sure you want to remove profile \"%s\"?"), profile); + mir_snwprintf(profilef, TranslateT("Are you sure you want to remove profile \"%s\"?"), profile); if (IDYES != MessageBox(NULL, profilef, L"Miranda NG", MB_YESNO | MB_TASKMODAL | MB_ICONWARNING)) return; - mir_sntprintf(profilef, L"%s\\%s%c", m_pd->ptszProfileDir, profile, 0); + mir_snwprintf(profilef, L"%s\\%s%c", m_pd->ptszProfileDir, profile, 0); SHFILEOPSTRUCT sf = { 0 }; sf.wFunc = FO_DELETE; @@ -387,9 +387,9 @@ class CChooseProfileDlg : public CDlgBase // profile is placed in "profile_name" subfolder wchar_t tmpPath[MAX_PATH]; - mir_sntprintf(tmpPath, L"%s\\%s.dat", m_pd->ptszProfileDir, profile); + mir_snwprintf(tmpPath, L"%s\\%s.dat", m_pd->ptszProfileDir, profile); if (_waccess(tmpPath, 2)) - mir_sntprintf(m_pd->ptszProfile, MAX_PATH, L"%s\\%s\\%s.dat", m_pd->ptszProfileDir, profile, profile); + mir_snwprintf(m_pd->ptszProfile, MAX_PATH, L"%s\\%s\\%s.dat", m_pd->ptszProfileDir, profile, profile); else wcsncpy_s(m_pd->ptszProfile, MAX_PATH, tmpPath, _TRUNCATE); } @@ -524,9 +524,9 @@ public: wchar_t profilename[MAX_PATH], tszFullPath[MAX_PATH]; struct _stat statbuf; m_profileList.GetItemText(pTip->iItem, 0, profilename, _countof(profilename)); - mir_sntprintf(tszFullPath, L"%s\\%s\\%s.dat", m_pd->ptszProfileDir, profilename, profilename); + mir_snwprintf(tszFullPath, L"%s\\%s\\%s.dat", m_pd->ptszProfileDir, profilename, profilename); _wstat(tszFullPath, &statbuf); - mir_sntprintf(pTip->pszText, pTip->cchTextMax, L"%s\n%s: %s\n%s: %s", tszFullPath, TranslateT("Created"), rtrimt(NEWWSTR_ALLOCA(_wctime(&statbuf.st_ctime))), TranslateT("Modified"), rtrimt(NEWWSTR_ALLOCA(_wctime(&statbuf.st_mtime)))); + mir_snwprintf(pTip->pszText, pTip->cchTextMax, L"%s\n%s: %s\n%s: %s", tszFullPath, TranslateT("Created"), rtrimw(NEWWSTR_ALLOCA(_wctime(&statbuf.st_ctime))), TranslateT("Modified"), rtrimw(NEWWSTR_ALLOCA(_wctime(&statbuf.st_mtime)))); } } diff --git a/src/mir_app/src/proto_accs.cpp b/src/mir_app/src/proto_accs.cpp index bb2ba40f79..c6fdab3704 100644 --- a/src/mir_app/src/proto_accs.cpp +++ b/src/mir_app/src/proto_accs.cpp @@ -52,7 +52,7 @@ static int EnumDbModules(const char *szModuleName, DWORD, LPARAM) pa->cbSize = sizeof(*pa);
pa->szModuleName = mir_strdup(szModuleName);
pa->szProtoName = szProtoName.detach();
- pa->tszAccountName = mir_a2t(szModuleName);
+ pa->tszAccountName = mir_a2u(szModuleName);
pa->bIsVisible = TRUE;
pa->bIsEnabled = FALSE;
pa->iOrder = accounts.getCount();
@@ -105,7 +105,7 @@ void LoadDbAccounts(void) }
if (!pa->tszAccountName)
- pa->tszAccountName = mir_a2t(szModuleName);
+ pa->tszAccountName = mir_a2u(szModuleName);
accounts.insert(pa);
}
diff --git a/src/mir_app/src/proto_internal.cpp b/src/mir_app/src/proto_internal.cpp index d64e64bd97..5e7cd8f76d 100644 --- a/src/mir_app/src/proto_internal.cpp +++ b/src/mir_app/src/proto_internal.cpp @@ -81,7 +81,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE if (m_iVersion > 1)
return (int)ProtoCallService(m_szModuleName, PSS_AUTHREQUEST, 0, (LPARAM)&ccs);
- ccs.lParam = (LPARAM)mir_t2a(szMessage);
+ ccs.lParam = (LPARAM)mir_u2a(szMessage);
int res = (int)ProtoCallService(m_szModuleName, PSS_AUTHREQUEST, 0, (LPARAM)&ccs);
mir_free((char*)ccs.lParam);
return res;
@@ -93,7 +93,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE if (m_iVersion > 1)
return (HANDLE)ProtoCallService(m_szModuleName, PSS_FILEALLOW, 0, (LPARAM)&ccs);
- ccs.lParam = (LPARAM)mir_t2a(szPath);
+ ccs.lParam = (LPARAM)mir_u2a(szPath);
HANDLE res = (HANDLE)ProtoCallService(m_szModuleName, PSS_FILEALLOW, 0, (LPARAM)&ccs);
mir_free((char*)ccs.lParam);
return res;
@@ -111,7 +111,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE if (m_iVersion > 1)
return (int)ProtoCallService(m_szModuleName, PSS_FILEDENY, 0, (LPARAM)&ccs);
- ccs.lParam = (LPARAM)mir_t2a(szReason);
+ ccs.lParam = (LPARAM)mir_u2a(szReason);
int res = (int)ProtoCallService(m_szModuleName, PSS_FILEDENY, 0, (LPARAM)&ccs);
mir_free((char*)ccs.lParam);
return res;
@@ -123,7 +123,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE if (m_iVersion > 1)
return (int)ProtoCallService(m_szModuleName, PS_FILERESUME, (WPARAM)hTransfer, (LPARAM)&pfr);
- pfr.szFilename = (wchar_t*)mir_t2a(pfr.szFilename);
+ pfr.szFilename = (wchar_t*)mir_u2a(pfr.szFilename);
int res = (int)ProtoCallService(m_szModuleName, PS_FILERESUME, (WPARAM)hTransfer, (LPARAM)&pfr);
mir_free((wchar_t*)*szFilename);
*action = pfr.action; *szFilename = (wchar_t*)pfr.szFilename;
@@ -165,9 +165,9 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE HANDLE __cdecl SearchByName(const wchar_t* nick, const wchar_t* firstName, const wchar_t* lastName)
{
PROTOSEARCHBYNAME psn;
- psn.pszNick = (wchar_t*)mir_t2a(nick);
- psn.pszFirstName = (wchar_t*)mir_t2a(firstName);
- psn.pszLastName = (wchar_t*)mir_t2a(lastName);
+ psn.pszNick = (wchar_t*)mir_u2a(nick);
+ psn.pszFirstName = (wchar_t*)mir_u2a(firstName);
+ psn.pszLastName = (wchar_t*)mir_u2a(lastName);
HANDLE res = (HANDLE)ProtoCallService(m_szModuleName, PS_SEARCHBYNAME, 0, (LPARAM)&psn);
mir_free(psn.pszNick);
mir_free(psn.pszFirstName);
@@ -223,7 +223,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE if (m_iVersion > 1)
return (HANDLE)ProtoCallService(m_szModuleName, PSS_FILE, 0, (LPARAM)&ccs);
- ccs.wParam = (WPARAM)mir_t2a(szDescription);
+ ccs.wParam = (WPARAM)mir_u2a(szDescription);
ccs.lParam = (LPARAM)Proto_FilesMatrixA(ppszFiles);
HANDLE res = (HANDLE)ProtoCallService(m_szModuleName, PSS_FILE, 0, (LPARAM)&ccs);
if (res == 0) FreeFilesMatrix((wchar_t***)&ccs.lParam);
@@ -291,7 +291,7 @@ PROTO_INTERFACE* AddDefaultAccount(const char *szProtoName) {
PROTO_INTERFACE* ppi = new DEFAULT_PROTO_INTERFACE;
ppi->m_szModuleName = mir_strdup(szProtoName);
- ppi->m_tszUserName = mir_a2t(szProtoName);
+ ppi->m_tszUserName = mir_a2u(szProtoName);
return ppi;
}
diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp index 751af269c0..f056270390 100644 --- a/src/mir_app/src/proto_opts.cpp +++ b/src/mir_app/src/proto_opts.cpp @@ -82,7 +82,7 @@ PROTOACCOUNT* Proto_CreateAccount(const char *szModuleName, const char *szBasePr }
else pa->szModuleName = mir_strdup(szModuleName);
- pa->tszAccountName = mir_tstrdup(tszAccountName);
+ pa->tszAccountName = mir_wstrdup(tszAccountName);
db_set_s(NULL, pa->szModuleName, "AM_BaseProto", szBaseProto);
accounts.insert(pa);
@@ -125,7 +125,7 @@ static bool OnCreateAccount(HWND hwndDlg) wchar_t tszAccName[256];
GetDlgItemText(hwndDlg, IDC_ACCNAME, tszAccName, _countof(tszAccName));
- rtrimt(tszAccName);
+ rtrimw(tszAccName);
if (tszAccName[0] == 0) {
MessageBox(hwndDlg, TranslateT("Account name must be filled."), TranslateT("Account error"), MB_ICONERROR | MB_OK);
return false;
@@ -143,13 +143,13 @@ static bool OnCreateAccount(HWND hwndDlg) if (param->action == PRAC_UPGRADED) {
BOOL oldProto = pa->bOldProto;
wchar_t szPlugin[MAX_PATH];
- mir_sntprintf(szPlugin, L"%s.dll", _A2T(pa->szProtoName));
+ mir_snwprintf(szPlugin, L"%s.dll", _A2T(pa->szProtoName));
int idx = accounts.getIndex(pa);
UnloadAccount(pa, false, false);
accounts.remove(idx);
if (oldProto && UnloadPlugin(szPlugin, _countof(szPlugin))) {
wchar_t szNewName[MAX_PATH];
- mir_sntprintf(szNewName, L"%s~", szPlugin);
+ mir_snwprintf(szNewName, L"%s~", szPlugin);
MoveFile(szPlugin, szNewName);
}
param->action = PRAC_ADDED;
@@ -165,7 +165,7 @@ static bool OnCreateAccount(HWND hwndDlg) pa = Proto_CreateAccount(buf, szBaseProto, tszAccName);
}
- else replaceStrT(pa->tszAccountName, tszAccName);
+ else replaceStrW(pa->tszAccountName, tszAccName);
WriteDbAccounts();
NotifyEventHooks(hAccListChanged, param->action, (LPARAM)pa);
@@ -202,9 +202,9 @@ static INT_PTR CALLBACK AccFormDlgProc(HWND hwndDlg, UINT message, WPARAM wParam wchar_t str[200];
if (param->action == PRAC_CHANGED) { // update
EnableWindow(GetDlgItem(hwndDlg, IDC_PROTOTYPECOMBO), FALSE);
- mir_sntprintf(str, L"%s: %s", TranslateT("Editing account"), param->pa->tszAccountName);
+ mir_snwprintf(str, L"%s: %s", TranslateT("Editing account"), param->pa->tszAccountName);
}
- else mir_sntprintf(str, L"%s: %s", TranslateT("Upgrading account"), param->pa->tszAccountName);
+ else mir_snwprintf(str, L"%s: %s", TranslateT("Upgrading account"), param->pa->tszAccountName);
SetWindowText(hwndDlg, str);
SetDlgItemText(hwndDlg, IDC_ACCNAME, param->pa->tszAccountName);
@@ -618,24 +618,24 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM if (lps->itemID == (unsigned)dat->iSelected) {
SelectObject(lps->hDC, dat->hfntText);
- mir_sntprintf(text, size, L"%s: %S", TranslateT("Protocol"), acc->szProtoName);
- length = (int)mir_tstrlen(text);
+ mir_snwprintf(text, size, L"%s: %S", TranslateT("Protocol"), acc->szProtoName);
+ length = (int)mir_wstrlen(text);
DrawText(lps->hDC, text, -1, &lps->rcItem, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
GetTextExtentPoint32(lps->hDC, text, length, &sz);
lps->rcItem.top += sz.cy + 2;
if (acc->ppro && Proto_IsProtocolLoaded(acc->szProtoName)) {
char *szIdName = (char *)acc->ppro->GetCaps(PFLAG_UNIQUEIDTEXT, 0);
- ptrT tszIdName(szIdName ? mir_a2t(szIdName) : mir_tstrdup(TranslateT("Account ID")));
- ptrT tszUniqueID(Contact_GetInfo(CNF_UNIQUEID, NULL, acc->szModuleName));
+ ptrW tszIdName(szIdName ? mir_a2u(szIdName) : mir_wstrdup(TranslateT("Account ID")));
+ ptrW tszUniqueID(Contact_GetInfo(CNF_UNIQUEID, NULL, acc->szModuleName));
if (tszUniqueID != NULL)
- mir_sntprintf(text, size, L"%s: %s", tszIdName, tszUniqueID);
+ mir_snwprintf(text, size, L"%s: %s", tszIdName, tszUniqueID);
else
- mir_sntprintf(text, size, L"%s: %s", tszIdName, TranslateT("<unknown>"));
+ mir_snwprintf(text, size, L"%s: %s", tszIdName, TranslateT("<unknown>"));
}
- else mir_sntprintf(text, size, TranslateT("Protocol is not loaded."));
+ else mir_snwprintf(text, size, TranslateT("Protocol is not loaded."));
- length = (int)mir_tstrlen(text);
+ length = (int)mir_wstrlen(text);
DrawText(lps->hDC, text, -1, &lps->rcItem, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
GetTextExtentPoint32(lps->hDC, text, length, &sz);
lps->rcItem.top += sz.cy + 2;
@@ -771,7 +771,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM DWORD dwStatus = CallProtoServiceInt(NULL, pa->szModuleName, PS_GETSTATUS, 0, 0);
if (dwStatus >= ID_STATUS_ONLINE) {
wchar_t buf[200];
- mir_sntprintf(buf, TranslateT("Account %s is being disabled"), pa->tszAccountName);
+ mir_snwprintf(buf, TranslateT("Account %s is being disabled"), pa->tszAccountName);
if (IDNO == ::MessageBox(hwndDlg,
TranslateT("Account is online. Disable account?"),
buf, MB_ICONWARNING | MB_DEFBUTTON2 | MB_YESNO)) {
@@ -831,7 +831,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM if (idx != -1) {
pa = (PROTOACCOUNT*)ListBox_GetItemData(hwndList, idx);
wchar_t buf[200];
- mir_sntprintf(buf, TranslateT("Account %s is being deleted"), pa->tszAccountName);
+ mir_snwprintf(buf, TranslateT("Account %s is being deleted"), pa->tszAccountName);
if (pa->bOldProto) {
MessageBox(hwndDlg, TranslateT("You need to disable plugin to delete this account"), buf, MB_ICONERROR | MB_OK);
break;
@@ -1021,7 +1021,7 @@ static int OnAccListChanged(WPARAM eventCode, LPARAM lParam) switch (eventCode) {
case PRAC_CHANGED:
if (pa->ppro) {
- replaceStrT(pa->ppro->m_tszUserName, pa->tszAccountName);
+ replaceStrW(pa->ppro->m_tszUserName, pa->tszAccountName);
pa->ppro->OnEvent(EV_PROTO_ONRENAME, 0, lParam);
if (pa->ppro->m_hMainMenuItem)
diff --git a/src/mir_app/src/proto_ui.cpp b/src/mir_app/src/proto_ui.cpp index 38ee85161b..b3c7f537eb 100644 --- a/src/mir_app/src/proto_ui.cpp +++ b/src/mir_app/src/proto_ui.cpp @@ -132,7 +132,7 @@ void CProtoIntDlgBase::UpdateProtoTitle(const wchar_t *szText) if (szText) {
curText = szText;
- curLength = (int)mir_tstrlen(curText);
+ curLength = (int)mir_wstrlen(curText);
}
else {
curLength = GetWindowTextLength(m_hwnd) + 1;
@@ -142,9 +142,9 @@ void CProtoIntDlgBase::UpdateProtoTitle(const wchar_t *szText) }
if (!wcsstr(curText, m_proto_interface->m_tszUserName)) {
- size_t length = curLength + mir_tstrlen(m_proto_interface->m_tszUserName) + 256;
+ size_t length = curLength + mir_wstrlen(m_proto_interface->m_tszUserName) + 256;
wchar_t *text = (wchar_t *)_alloca(length * sizeof(wchar_t));
- mir_sntprintf(text, length, L"%s [%s: %s]", curText, TranslateT("Account"), m_proto_interface->m_tszUserName);
+ mir_snwprintf(text, length, L"%s [%s: %s]", curText, TranslateT("Account"), m_proto_interface->m_tszUserName);
SetWindowText(m_hwnd, text);
}
}
@@ -155,7 +155,7 @@ void CProtoIntDlgBase::UpdateStatusBar() HDC hdc = GetDC(m_hwndStatus);
HFONT hFntSave = (HFONT)SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT));
- GetTextExtentPoint32(hdc, m_proto_interface->m_tszUserName, (int)mir_tstrlen(m_proto_interface->m_tszUserName), &sz);
+ GetTextExtentPoint32(hdc, m_proto_interface->m_tszUserName, (int)mir_wstrlen(m_proto_interface->m_tszUserName), &sz);
sz.cx += GetSystemMetrics(SM_CXSMICON) * 3;
SelectObject(hdc, hFntSave);
ReleaseDC(m_hwndStatus, hdc);
diff --git a/src/mir_app/src/proto_utils.cpp b/src/mir_app/src/proto_utils.cpp index e91ece4c7e..9689bc973b 100644 --- a/src/mir_app/src/proto_utils.cpp +++ b/src/mir_app/src/proto_utils.cpp @@ -84,7 +84,7 @@ MIR_APP_DLL(void) ProtoConstructor(PROTO_INTERFACE *pThis, LPCSTR pszModuleName, pThis->m_iStatus = pThis->m_iDesiredStatus = ID_STATUS_OFFLINE;
pThis->m_szModuleName = mir_strdup(pszModuleName);
pThis->m_hProtoIcon = IcoLib_IsManaged(Skin_LoadProtoIcon(pszModuleName, ID_STATUS_ONLINE));
- pThis->m_tszUserName = mir_tstrdup(ptszUserName);
+ pThis->m_tszUserName = mir_wstrdup(ptszUserName);
db_set_resident(pThis->m_szModuleName, "Status");
}
diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp index e06034833e..4f1f1cde42 100644 --- a/src/mir_app/src/protocols.cpp +++ b/src/mir_app/src/protocols.cpp @@ -127,7 +127,7 @@ MIR_APP_DLL(int) Proto_RegisterModule(PROTOCOLDESCRIPTOR *pd) pa->cbSize = sizeof(PROTOACCOUNT);
pa->szModuleName = mir_strdup(pd->szName);
pa->szProtoName = mir_strdup(pd->szName);
- pa->tszAccountName = mir_a2t(pd->szName);
+ pa->tszAccountName = mir_a2u(pd->szName);
pa->bIsVisible = pa->bIsEnabled = true;
pa->iOrder = accounts.getCount();
accounts.insert(pa);
@@ -244,7 +244,7 @@ static INT_PTR Proto_ContactIsTyping(WPARAM wParam, LPARAM lParam) void Proto_SetStatus(const char *szProto, unsigned status)
{
if (CallProtoServiceInt(NULL, szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) {
- ptrT tszAwayMsg((wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGT, status, (LPARAM)szProto));
+ ptrW tszAwayMsg((wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGT, status, (LPARAM)szProto));
CallProtoServiceInt(NULL, szProto, PS_SETAWAYMSG, status, tszAwayMsg);
}
CallProtoServiceInt(NULL, szProto, PS_SETSTATUS, status, 0);
diff --git a/src/mir_app/src/searchresults.cpp b/src/mir_app/src/searchresults.cpp index 8db9de005d..571712de7b 100644 --- a/src/mir_app/src/searchresults.cpp +++ b/src/mir_app/src/searchresults.cpp @@ -79,7 +79,7 @@ void LoadColumnSizes(HWND hwndResults, const char *szProto) INT_PTR ret = CallProtoServiceInt(NULL, szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0);
if (ret != CALLSERVICE_NOTFOUND) {
bNeedsFree = true;
- lvc.pszText = mir_a2t((char*)ret);
+ lvc.pszText = mir_a2u((char*)ret);
}
}
}
@@ -139,22 +139,22 @@ int CALLBACK SearchResultsCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lPa case COLUMNID_PROTO:
return mir_strcmp(lsr1->szProto, lsr2->szProto)*sortMultiplier;
case COLUMNID_HANDLE:
- return mir_tstrcmpi(lsr1->psr.id.w, lsr2->psr.id.w)*sortMultiplier;
+ return mir_wstrcmpi(lsr1->psr.id.w, lsr2->psr.id.w)*sortMultiplier;
case COLUMNID_NICK:
- return mir_tstrcmpi(lsr1->psr.nick.w, lsr2->psr.nick.w)*sortMultiplier;
+ return mir_wstrcmpi(lsr1->psr.nick.w, lsr2->psr.nick.w)*sortMultiplier;
case COLUMNID_FIRST:
- return mir_tstrcmpi(lsr1->psr.firstName.w, lsr2->psr.firstName.w)*sortMultiplier;
+ return mir_wstrcmpi(lsr1->psr.firstName.w, lsr2->psr.firstName.w)*sortMultiplier;
case COLUMNID_LAST:
- return mir_tstrcmpi(lsr1->psr.lastName.w, lsr2->psr.lastName.w)*sortMultiplier;
+ return mir_wstrcmpi(lsr1->psr.lastName.w, lsr2->psr.lastName.w)*sortMultiplier;
case COLUMNID_EMAIL:
- return mir_tstrcmpi(lsr1->psr.email.w, lsr2->psr.email.w)*sortMultiplier;
+ return mir_wstrcmpi(lsr1->psr.email.w, lsr2->psr.email.w)*sortMultiplier;
}
}
else {
wchar_t szText1[100], szText2[100];
ListView_GetItemText(hList, (int)lParam1, sortCol, szText1, _countof(szText1));
ListView_GetItemText(hList, (int)lParam2, sortCol, szText2, _countof(szText2));
- return mir_tstrcmpi(szText1, szText2)*sortMultiplier;
+ return mir_wstrcmpi(szText1, szText2)*sortMultiplier;
}
return 0;
}
@@ -184,12 +184,12 @@ static void BeginSearchFailed(void *arg) wchar_t buf[128];
if (arg != NULL) {
const wchar_t *protoName = (wchar_t*)arg;
- mir_sntprintf(buf,
+ mir_snwprintf(buf,
TranslateT("Could not start a search on '%s', there was a problem - is %s connected?"),
protoName, protoName);
mir_free((char*)arg);
}
- else mir_tstrncpy(buf, TranslateT("Could not search on any of the protocols, are you online?"), _countof(buf));
+ else mir_wstrncpy(buf, TranslateT("Could not search on any of the protocols, are you online?"), _countof(buf));
MessageBox(0, buf, TranslateT("Problem with search"), MB_OK | MB_ICONERROR);
}
@@ -231,7 +231,7 @@ int BeginSearch(HWND, struct FindAddDlgData *dat, const char *szProto, const cha if (dat->search[0].hProcess == NULL) {
// infuriatingly vague error message. fixme.
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
- mir_forkthread(BeginSearchFailed, mir_tstrdup(pa->tszAccountName));
+ mir_forkthread(BeginSearchFailed, mir_wstrdup(pa->tszAccountName));
mir_free(dat->search);
dat->search = NULL;
dat->searchCount = 0;
diff --git a/src/mir_app/src/services.cpp b/src/mir_app/src/services.cpp index 4453ce3c83..fc081a19ce 100644 --- a/src/mir_app/src/services.cpp +++ b/src/mir_app/src/services.cpp @@ -142,7 +142,7 @@ int GetFontSettingFromDB(char *settings_group, char *prefix, LOGFONT *lf, COLORR strncpy_s(idstr, prefix, _TRUNCATE);
int retval = 0;
- ptrT tszGroup(db_get_tsa(NULL, settings_group, idstr));
+ ptrW tszGroup(db_get_tsa(NULL, settings_group, idstr));
if (tszGroup != NULL)
wcsncpy_s(lf->lfFaceName, tszGroup, _TRUNCATE);
else
@@ -245,7 +245,7 @@ static int sttRegisterFontWorker(FontIDW *font_id, int _hLang) for (int i = 0; i < font_id_list.getCount(); i++) {
FontInternal& F = font_id_list[i];
- if (!mir_tstrcmp(F.group, font_id->group) && !mir_tstrcmp(F.name, font_id->name) && !(F.flags & FIDF_ALLOWREREGISTER))
+ if (!mir_wstrcmp(F.group, font_id->group) && !mir_wstrcmp(F.name, font_id->name) && !(F.flags & FIDF_ALLOWREREGISTER))
return 1;
}
@@ -258,10 +258,10 @@ static int sttRegisterFontWorker(FontIDW *font_id, int _hLang) memcpy(newItem, font_id, font_id->cbSize);
newItem->hLangpack = _hLang;
- if (!mir_tstrcmp(newItem->deffontsettings.szFace, L"MS Shell Dlg")) {
+ if (!mir_wstrcmp(newItem->deffontsettings.szFace, L"MS Shell Dlg")) {
LOGFONT lf;
SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, FALSE);
- mir_tstrncpy(newItem->deffontsettings.szFace, lf.lfFaceName, _countof(newItem->deffontsettings.szFace));
+ mir_wstrncpy(newItem->deffontsettings.szFace, lf.lfFaceName, _countof(newItem->deffontsettings.szFace));
if (!newItem->deffontsettings.size)
newItem->deffontsettings.size = lf.lfHeight;
}
@@ -353,7 +353,7 @@ static INT_PTR sttRegisterColourWorker(ColourIDW *colour_id, int _hLang) for (int i = 0; i < colour_id_list.getCount(); i++) {
ColourInternal& C = colour_id_list[i];
- if (!mir_tstrcmp(C.group, colour_id->group) && !mir_tstrcmp(C.name, colour_id->name))
+ if (!mir_wstrcmp(C.group, colour_id->group) && !mir_wstrcmp(C.name, colour_id->name))
return 1;
}
@@ -385,7 +385,7 @@ static INT_PTR sttGetColourWorker(ColourIDW *colour_id) {
for (int i = 0; i < colour_id_list.getCount(); i++) {
ColourInternal& C = colour_id_list[i];
- if (!mir_tstrcmp(C.group, colour_id->group) && !mir_tstrcmp(C.name, colour_id->name))
+ if (!mir_wstrcmp(C.group, colour_id->group) && !mir_wstrcmp(C.name, colour_id->name))
return db_get_dw(NULL, C.dbSettingsGroup, C.setting, C.defcolour);
}
@@ -445,7 +445,7 @@ static INT_PTR sttRegisterEffectWorker(EffectIDW *effect_id, int _hLang) for (int i = 0; i < effect_id_list.getCount(); i++) {
EffectInternal& E = effect_id_list[i];
- if (!mir_tstrcmp(E.group, effect_id->group) && !mir_tstrcmp(E.name, effect_id->name))
+ if (!mir_wstrcmp(E.group, effect_id->group) && !mir_wstrcmp(E.name, effect_id->name))
return 1;
}
diff --git a/src/mir_app/src/skin2opts.cpp b/src/mir_app/src/skin2opts.cpp index feb5795b0d..bfaf0c505e 100644 --- a/src/mir_app/src/skin2opts.cpp +++ b/src/mir_app/src/skin2opts.cpp @@ -49,7 +49,7 @@ static HICON ExtractIconFromPath(const wchar_t *path, int cxIcon, int cyIcon) if (!path)
return (HICON)NULL;
- mir_tstrncpy(file, path, _countof(file));
+ mir_wstrncpy(file, path, _countof(file));
comma = wcsrchr(file, ',');
if (!comma)
n = 0;
@@ -118,8 +118,8 @@ static void __fastcall MySetCursor(wchar_t* nCursor) static void LoadSectionIcons(wchar_t *filename, SectionItem* sectionActive)
{
wchar_t path[MAX_PATH];
- mir_sntprintf(path, L"%s,", filename);
- size_t suffIndx = mir_tstrlen(path);
+ mir_snwprintf(path, L"%s,", filename);
+ size_t suffIndx = mir_wstrlen(path);
mir_cslock lck(csIconList);
@@ -132,10 +132,10 @@ static void LoadSectionIcons(wchar_t *filename, SectionItem* sectionActive) if (!hIcon)
continue;
- replaceStrT(item->temp_file, NULL);
+ replaceStrW(item->temp_file, NULL);
SafeDestroyIcon(item->temp_icon);
- item->temp_file = mir_tstrdup(path);
+ item->temp_file = mir_wstrdup(path);
item->temp_icon = hIcon;
item->temp_reset = FALSE;
}
@@ -169,7 +169,7 @@ static void UndoChanges(int iconIndx, int cmd) if (!item->temp_file && !item->temp_icon && item->temp_reset && cmd == ID_CANCELCHANGE)
item->temp_reset = FALSE;
else {
- replaceStrT(item->temp_file, NULL);
+ replaceStrW(item->temp_file, NULL);
SafeDestroyIcon(item->temp_icon);
}
@@ -228,29 +228,29 @@ static wchar_t* OpenFileDlg(HWND hParent, const wchar_t* szFile, BOOL bAll) ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hParent;
- mir_tstrcpy(filter, TranslateT("Icon sets"));
+ mir_wstrcpy(filter, TranslateT("Icon sets"));
if (bAll)
- mir_tstrcat(filter, L" (*.dll;*.mir;*.icl;*.exe;*.ico)");
+ mir_wstrcat(filter, L" (*.dll;*.mir;*.icl;*.exe;*.ico)");
else
- mir_tstrcat(filter, L" (*.dll;*.mir)");
+ mir_wstrcat(filter, L" (*.dll;*.mir)");
- pfilter = filter + mir_tstrlen(filter) + 1;
+ pfilter = filter + mir_wstrlen(filter) + 1;
if (bAll)
- mir_tstrcpy(pfilter, L"*.DLL;*.MIR;*.ICL;*.EXE;*.ICO");
+ mir_wstrcpy(pfilter, L"*.DLL;*.MIR;*.ICL;*.EXE;*.ICO");
else
- mir_tstrcpy(pfilter, L"*.DLL;*.MIR");
-
- pfilter += mir_tstrlen(pfilter) + 1;
- mir_tstrcpy(pfilter, TranslateT("All files"));
- mir_tstrcat(pfilter, L" (*)");
- pfilter += mir_tstrlen(pfilter) + 1;
- mir_tstrcpy(pfilter, L"*");
- pfilter += mir_tstrlen(pfilter) + 1;
+ mir_wstrcpy(pfilter, L"*.DLL;*.MIR");
+
+ pfilter += mir_wstrlen(pfilter) + 1;
+ mir_wstrcpy(pfilter, TranslateT("All files"));
+ mir_wstrcat(pfilter, L" (*)");
+ pfilter += mir_wstrlen(pfilter) + 1;
+ mir_wstrcpy(pfilter, L"*");
+ pfilter += mir_wstrlen(pfilter) + 1;
*pfilter = '\0';
ofn.lpstrFilter = filter;
ofn.lpstrDefExt = L"dll";
- mir_tstrncpy(file, szFile, _countof(file));
+ mir_wstrncpy(file, szFile, _countof(file));
ofn.lpstrFile = file;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_DONTADDTORECENT;
ofn.nMaxFile = MAX_PATH * 2;
@@ -258,7 +258,7 @@ static wchar_t* OpenFileDlg(HWND hParent, const wchar_t* szFile, BOOL bAll) if (!GetOpenFileName(&ofn))
return NULL;
- return mir_tstrdup(file);
+ return mir_wstrdup(file);
}
//
@@ -322,7 +322,7 @@ static HTREEITEM FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const wchar while (tvi.hItem) {
TreeView_GetItem(hwndTree, &tvi);
- if (!mir_tstrcmp(tvi.pszText, name))
+ if (!mir_wstrcmp(tvi.pszText, name))
return tvi.hItem;
tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
@@ -418,7 +418,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lvi.iItem = 0;
int count = (int)_ExtractIconEx(filename, -1, 16, 16, NULL, LR_DEFAULTCOLOR);
for (int i = 0; i < count; lvi.iItem++, i++) {
- mir_sntprintf(caption, L"%d", i + 1);
+ mir_snwprintf(caption, L"%d", i + 1);
lvi.pszText = caption;
HICON hIcon = NULL;
@@ -520,7 +520,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lvi.mask = LVIF_PARAM;
lvi.iItem = dragItem; lvi.iSubItem = 0;
ListView_GetItem(hPreview, &lvi);
- mir_sntprintf(path, L"%s,%d", filename, (int)lvi.lParam);
+ mir_snwprintf(path, L"%s,%d", filename, (int)lvi.lParam);
SendMessage(hwndParent, DM_CHANGEICON, dropHiLite, (LPARAM)path);
ListView_SetItemState(GetDlgItem(hwndParent, IDC_PREVIEW), dropHiLite, 0, LVIS_DROPHILITED);
}
@@ -572,7 +572,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM static int CALLBACK DoSortIconsFunc(LPARAM lParam1, LPARAM lParam2, LPARAM)
{
- return mir_tstrcmpi(iconList[lParam1]->getDescr(), iconList[lParam2]->getDescr());
+ return mir_wstrcmpi(iconList[lParam1]->getDescr(), iconList[lParam2]->getDescr());
}
static int CALLBACK DoSortIconsFuncByOrder(LPARAM lParam1, LPARAM lParam2, LPARAM)
@@ -668,7 +668,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM int sectionLevel = 0;
hSection = NULL;
- mir_tstrcpy(itemName, sectionList[indx]->name);
+ mir_wstrcpy(itemName, sectionList[indx]->name);
sectionName = itemName;
while (sectionName) {
@@ -688,7 +688,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM TVINSERTSTRUCT tvis = { 0 };
TreeItem *treeItem = (TreeItem *)mir_alloc(sizeof(TreeItem));
treeItem->value = SECTIONPARAM_MAKE(indx, sectionLevel, sectionName ? 0 : SECTIONPARAM_HAVEPAGE);
- treeItem->paramName = mir_t2a(itemName);
+ treeItem->paramName = mir_u2a(itemName);
tvis.hParent = hSection;
tvis.hInsertAfter = TVI_SORT;
@@ -810,7 +810,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SafeDestroyIcon(item->temp_icon);
wchar_t *path = (wchar_t*)lParam;
- replaceStrT(item->temp_file, path);
+ replaceStrW(item->temp_file, path);
item->temp_icon = (HICON)ExtractIconFromPath(path, item->cx, item->cy);
item->temp_reset = FALSE;
}
@@ -934,7 +934,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (item->temp_file)
wcsncpy_s(pInfoTip->pszText, pInfoTip->cchTextMax, item->temp_file, _TRUNCATE);
else if (item->default_file)
- mir_sntprintf(pInfoTip->pszText, pInfoTip->cchTextMax, L"%s, %d", item->default_file->file, item->default_indx);
+ mir_snwprintf(pInfoTip->pszText, pInfoTip->cchTextMax, L"%s, %d", item->default_file->file, item->default_indx);
}
}
if (bNeedRebuild) {
@@ -981,7 +981,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM for (int indx = 0; indx < iconList.getCount(); indx++) {
IcolibItem *item = iconList[indx];
- replaceStrT(item->temp_file, NULL);
+ replaceStrW(item->temp_file, NULL);
SafeDestroyIcon(item->temp_icon);
}
}
diff --git a/src/mir_app/src/skinicons.cpp b/src/mir_app/src/skinicons.cpp index e50dba78e5..d653fb7aaf 100644 --- a/src/mir_app/src/skinicons.cpp +++ b/src/mir_app/src/skinicons.cpp @@ -278,7 +278,7 @@ MIR_APP_DLL(HICON) Skin_LoadProtoIcon(const char *szProto, int status, bool big) // Queried protocol isn't in list, adding
wchar_t tszSection[MAX_PATH];
- mir_sntprintf(tszSection, _T(PROTOCOLS_PREFIX)L"/%s", pa->tszAccountName);
+ mir_snwprintf(tszSection, _T(PROTOCOLS_PREFIX)L"/%s", pa->tszAccountName);
SKINICONDESC sid = { 0 };
sid.section.w = tszSection;
@@ -287,11 +287,11 @@ MIR_APP_DLL(HICON) Skin_LoadProtoIcon(const char *szProto, int status, bool big) str = wcsrchr(szPath, '\\');
if (str != NULL)
*str = 0;
- mir_sntprintf(szFullPath, L"%s\\Icons\\proto_%S.dll", szPath, pa->szProtoName);
+ mir_snwprintf(szFullPath, L"%s\\Icons\\proto_%S.dll", szPath, pa->szProtoName);
if (GetFileAttributes(szFullPath) != INVALID_FILE_ATTRIBUTES)
sid.defaultFile.w = szFullPath;
else {
- mir_sntprintf(szFullPath, L"%s\\Plugins\\%S.dll", szPath, szProto);
+ mir_snwprintf(szFullPath, L"%s\\Plugins\\%S.dll", szPath, szProto);
if (int(ExtractIconEx(szFullPath, statusIcons[statusIndx].resource_id, NULL, &hIcon, 1)) > 0) {
DestroyIcon(hIcon);
sid.defaultFile.w = szFullPath;
diff --git a/src/mir_app/src/sounds.cpp b/src/mir_app/src/sounds.cpp index acdf34d5b9..847b456494 100644 --- a/src/mir_app/src/sounds.cpp +++ b/src/mir_app/src/sounds.cpp @@ -85,14 +85,14 @@ static INT_PTR ServiceSkinAddNewSound(WPARAM wParam, LPARAM lParam) wchar_t* ptszDefaultFile;
if (ssd->dwFlags & SSDF_UNICODE) {
- item->ptszDescription = mir_tstrdup(ssd->ptszDescription);
- item->ptszSection = mir_tstrdup((ssd->pszSection != NULL) ? ssd->ptszSection : L"Other");
- ptszDefaultFile = mir_tstrdup(ssd->ptszDefaultFile);
+ item->ptszDescription = mir_wstrdup(ssd->ptszDescription);
+ item->ptszSection = mir_wstrdup((ssd->pszSection != NULL) ? ssd->ptszSection : L"Other");
+ ptszDefaultFile = mir_wstrdup(ssd->ptszDefaultFile);
}
else {
- item->ptszDescription = mir_a2t(ssd->pszDescription);
- item->ptszSection = mir_a2t((ssd->pszSection != NULL) ? ssd->pszSection : "Other");
- ptszDefaultFile = mir_a2t(ssd->pszDefaultFile);
+ item->ptszDescription = mir_a2u(ssd->pszDescription);
+ item->ptszSection = mir_a2u((ssd->pszSection != NULL) ? ssd->pszSection : "Other");
+ ptszDefaultFile = mir_a2u(ssd->pszDefaultFile);
}
if (ptszDefaultFile) {
@@ -307,9 +307,9 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM OPENFILENAME ofn;
memset(&ofn, 0, sizeof(ofn));
if (GetModuleHandle(L"bass_interface.dll"))
- mir_sntprintf(filter, L"%s (*.wav, *.mp3, *.ogg)%c*.wav;*.mp3;*.ogg%c%s (*)%c*%c", TranslateT("Sound files"), 0, 0, TranslateT("All files"), 0, 0);
+ mir_snwprintf(filter, L"%s (*.wav, *.mp3, *.ogg)%c*.wav;*.mp3;*.ogg%c%s (*)%c*%c", TranslateT("Sound files"), 0, 0, TranslateT("All files"), 0, 0);
else
- mir_sntprintf(filter, L"%s (*.wav)%c*.wav%c%s (*)%c*%c", TranslateT("WAV files"), 0, 0, TranslateT("All files"), 0, 0);
+ mir_snwprintf(filter, L"%s (*.wav)%c*.wav%c%s (*)%c*%c", TranslateT("WAV files"), 0, 0, TranslateT("All files"), 0, 0);
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = GetParent(hwndDlg);
ofn.hInstance = NULL;
@@ -331,7 +331,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break;
PathToRelativeT(str, strFull);
- snd.ptszTempFile = mir_tstrdup(strFull);
+ snd.ptszTempFile = mir_wstrdup(strFull);
SetDlgItemText(hwndDlg, IDC_LOCATION, strFull);
}
if (LOWORD(wParam) == IDC_GETMORE) {
@@ -388,7 +388,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SendMessage(hwndDlg, DM_HIDEPANE, 0, 0);
else {
wchar_t buf[256];
- mir_sntprintf(buf, L"%s: %s", arSounds[tvi.lParam].getSection(), arSounds[tvi.lParam].getDescr());
+ mir_snwprintf(buf, L"%s: %s", arSounds[tvi.lParam].getSection(), arSounds[tvi.lParam].getDescr());
SetDlgItemText(hwndDlg, IDC_NAMEVAL, buf);
if (arSounds[tvi.lParam].ptszTempFile)
SetDlgItemText(hwndDlg, IDC_LOCATION, arSounds[tvi.lParam].ptszTempFile);
diff --git a/src/mir_app/src/srmm_statusicon.cpp b/src/mir_app/src/srmm_statusicon.cpp index eeb76f9b13..bcf7a8a0b7 100644 --- a/src/mir_app/src/srmm_statusicon.cpp +++ b/src/mir_app/src/srmm_statusicon.cpp @@ -91,7 +91,7 @@ INT_PTR ModifyStatusIcon(WPARAM hContact, LPARAM lParam) mir_free(p->sid.szTooltip);
memcpy(&p->sid, sid, sizeof(p->sid));
p->sid.szModule = mir_strdup(sid->szModule);
- p->sid.tszTooltip = (sid->flags & MBF_UNICODE) ? mir_u2t(sid->wszTooltip) : mir_a2t(sid->szTooltip);
+ p->sid.tszTooltip = (sid->flags & MBF_UNICODE) ? mir_wstrdup(sid->wszTooltip) : mir_a2u(sid->szTooltip);
NotifyEventHooks(hHookIconsChanged, NULL, (LPARAM)p);
return 0;
@@ -110,7 +110,7 @@ INT_PTR ModifyStatusIcon(WPARAM hContact, LPARAM lParam) pc->hIconDisabled = sid->hIconDisabled;
mir_free(pc->tszTooltip);
- pc->tszTooltip = (sid->flags & MBF_UNICODE) ? mir_u2t(sid->wszTooltip) : mir_a2t(sid->szTooltip);
+ pc->tszTooltip = (sid->flags & MBF_UNICODE) ? mir_wstrdup(sid->wszTooltip) : mir_a2u(sid->szTooltip);
NotifyEventHooks(hHookIconsChanged, hContact, (LPARAM)p);
return 0;
@@ -131,9 +131,9 @@ static INT_PTR AddStatusIcon(WPARAM wParam, LPARAM lParam) p->hLangpack = (int)wParam;
p->sid.szModule = mir_strdup(sid->szModule);
if (sid->flags & MBF_UNICODE)
- p->sid.tszTooltip = mir_u2t(sid->wszTooltip);
+ p->sid.tszTooltip = mir_wstrdup(sid->wszTooltip);
else
- p->sid.tszTooltip = mir_a2t(sid->szTooltip);
+ p->sid.tszTooltip = mir_a2u(sid->szTooltip);
arIcons.insert(p);
NotifyEventHooks(hHookIconsChanged, NULL, (LPARAM)p);
diff --git a/src/mir_app/src/xmlParser.cpp b/src/mir_app/src/xmlParser.cpp index 9817e0fce5..945f809008 100644 --- a/src/mir_app/src/xmlParser.cpp +++ b/src/mir_app/src/xmlParser.cpp @@ -1199,7 +1199,7 @@ XMLAttribute *XMLNode::addAttribute_priv(int memoryIncrease, XMLSTR lpszName, XM wchar_t* p = wcschr(lpszName, ':'); if (p) - if (!mir_tstrcmp(p+1, d->lpszNS) || (d->pParent && !mir_tstrcmp(p+1, d->pParent->lpszNS))) + if (!mir_wstrcmp(p+1, d->lpszNS) || (d->pParent && !mir_wstrcmp(p+1, d->pParent->lpszNS))) *p = 0; return pAttr; diff --git a/src/mir_core/src/bitmaps.cpp b/src/mir_core/src/bitmaps.cpp index c7aab86736..5a06bb50ff 100644 --- a/src/mir_core/src/bitmaps.cpp +++ b/src/mir_core/src/bitmaps.cpp @@ -42,7 +42,7 @@ MIR_CORE_DLL(void) Bitmap_GetFilter(wchar_t *dest, size_t destLen) if (dest == NULL)
return;
- mir_sntprintf(dest, destLen,
+ mir_snwprintf(dest, destLen,
L"%s (*.bmp;*.jpg;*.gif;*.png)%c*.BMP;*.RLE;*.JPG;*.JPEG;*.GIF;*.PNG%c"
L"%s (*.bmp;*.rle)%c*.BMP;*.RLE%c"
L"%s (*.jpg;*.jpeg)%c*.JPG;*.JPEG%c"
diff --git a/src/mir_core/src/db.cpp b/src/mir_core/src/db.cpp index 84cf413aeb..0e028bb398 100644 --- a/src/mir_core/src/db.cpp +++ b/src/mir_core/src/db.cpp @@ -351,7 +351,7 @@ extern "C" MIR_CORE_DLL(void) db_setCurrent(MIDatabase *_db) currDb = _db;
// try to get the langpack's name from a profile
- ptrT langpack(db_get_tsa(NULL, "Langpack", "Current"));
+ ptrW langpack(db_get_tsa(NULL, "Langpack", "Current"));
if (langpack && langpack[0] != '\0')
LoadLangPack(langpack);
else
diff --git a/src/mir_core/src/hyperlink.cpp b/src/mir_core/src/hyperlink.cpp index 8c9390f4c7..dbebe701b9 100644 --- a/src/mir_core/src/hyperlink.cpp +++ b/src/mir_core/src/hyperlink.cpp @@ -172,7 +172,7 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA if (dat->hEnableFont != NULL) hPrevFont = (HFONT)SelectObject(hdc, dat->hEnableFont);
if (dat->hEnableFont == NULL || hPrevFont != NULL) { /* select failed? */
SIZE textSize;
- if (GetTextExtentPoint32(hdc, (wchar_t*)lParam, (int)mir_tstrlen((wchar_t*)lParam), &textSize)) {
+ if (GetTextExtentPoint32(hdc, (wchar_t*)lParam, (int)mir_wstrlen((wchar_t*)lParam), &textSize)) {
if (GetClientRect(hwnd, &rc)) {
dat->rcText.top = 0;
dat->rcText.bottom = dat->rcText.top + textSize.cy;
diff --git a/src/mir_core/src/langpack.cpp b/src/mir_core/src/langpack.cpp index 757345cefe..9c29fc24da 100644 --- a/src/mir_core/src/langpack.cpp +++ b/src/mir_core/src/langpack.cpp @@ -219,7 +219,7 @@ static void LoadLangPackFile(FILE *fp, char *line) wchar_t *p = wcsrchr(langPack.tszFullPath, '\\');
if (p)
*p = 0;
- mir_sntprintf(tszFileName, L"%s\\%S", langPack.tszFullPath, ltrim(line + 9));
+ mir_snwprintf(tszFileName, L"%s\\%S", langPack.tszFullPath, ltrim(line + 9));
if (p)
*p = '\\';
@@ -374,18 +374,18 @@ static int LoadLangDescr(LANGPACK_INFO &lpinfo, FILE *fp, char *line, int &start MIR_CORE_DLL(int) LoadLangPack(const wchar_t *ptszLangPack)
{
- if (ptszLangPack == NULL || !mir_tstrcmpi(ptszLangPack, L""))
+ if (ptszLangPack == NULL || !mir_wstrcmpi(ptszLangPack, L""))
return 1;
// ensure that a lang's name is a full file name
wchar_t tszFullPath[MAX_PATH];
if (!PathIsAbsoluteT(ptszLangPack))
- mir_sntprintf(tszFullPath, L"%s\\%s", g_tszRoot, ptszLangPack);
+ mir_snwprintf(tszFullPath, L"%s\\%s", g_tszRoot, ptszLangPack);
else
wcsncpy_s(tszFullPath, ptszLangPack, _TRUNCATE);
// this lang is already loaded? nothing to do then
- if (!mir_tstrcmp(tszFullPath, langPack.tszFullPath))
+ if (!mir_wstrcmp(tszFullPath, langPack.tszFullPath))
return 0;
// ok... loading a new langpack. remove the old one if needed
@@ -563,9 +563,9 @@ static BOOL CALLBACK TranslateDialogEnumProc(HWND hwnd, LPARAM lParam) wchar_t szClass[32];
GetClassName(hwnd, szClass, _countof(szClass));
- if (!mir_tstrcmpi(szClass, L"static") || !mir_tstrcmpi(szClass, L"hyperlink") || !mir_tstrcmpi(szClass, L"button") || !mir_tstrcmpi(szClass, L"MButtonClass") || !mir_tstrcmpi(szClass, L"MHeaderbarCtrl"))
+ if (!mir_wstrcmpi(szClass, L"static") || !mir_wstrcmpi(szClass, L"hyperlink") || !mir_wstrcmpi(szClass, L"button") || !mir_wstrcmpi(szClass, L"MButtonClass") || !mir_wstrcmpi(szClass, L"MHeaderbarCtrl"))
TranslateWindow(uuid, hwnd);
- else if (!mir_tstrcmpi(szClass, L"edit")) {
+ else if (!mir_wstrcmpi(szClass, L"edit")) {
if (GetWindowLongPtr(hwnd, GWL_STYLE) & ES_READONLY)
TranslateWindow(uuid, hwnd);
}
@@ -641,7 +641,7 @@ void GetDefaultLang() PathToAbsoluteT(L"\\mirandaboot.ini", tszPath);
GetPrivateProfileString(L"Language", L"DefaultLanguage", L"", tszLangName, _countof(tszLangName), tszPath);
if (tszLangName[0]) {
- if (!mir_tstrcmpi(tszLangName, L"default")) {
+ if (!mir_wstrcmpi(tszLangName, L"default")) {
db_set_ts(NULL, "Langpack", "Current", L"default");
return;
}
@@ -653,7 +653,7 @@ void GetDefaultLang() // try to load langpack that matches UserDefaultUILanguage
if (GetLocaleInfo(MAKELCID(GetUserDefaultUILanguage(), SORT_DEFAULT), LOCALE_SENGLANGUAGE, tszLangName, _countof(tszLangName))) {
- mir_sntprintf(tszPath, L"langpack_%s.txt", wcslwr(tszLangName));
+ mir_snwprintf(tszPath, L"langpack_%s.txt", wcslwr(tszLangName));
if (!LoadLangPack(tszPath)) {
db_set_ts(NULL, "Langpack", "Current", tszPath);
return;
@@ -661,7 +661,7 @@ void GetDefaultLang() }
// finally try to load first file
- mir_sntprintf(tszPath, L"%s\\langpack_*.txt", g_tszRoot);
+ mir_snwprintf(tszPath, L"%s\\langpack_*.txt", g_tszRoot);
WIN32_FIND_DATA fd;
HANDLE hFind = FindFirstFile(tszPath, &fd);
diff --git a/src/mir_core/src/logger.cpp b/src/mir_core/src/logger.cpp index 3711d26fa6..a2e526a6a2 100644 --- a/src/mir_core/src/logger.cpp +++ b/src/mir_core/src/logger.cpp @@ -30,8 +30,8 @@ struct Logger {
Logger(const char* pszName, const wchar_t *ptszDescr, const wchar_t *ptszFilename, unsigned options) :
m_name(mir_strdup(pszName)),
- m_descr(mir_tstrdup(ptszDescr)),
- m_fileName(mir_tstrdup(ptszFilename)),
+ m_descr(mir_wstrdup(ptszDescr)),
+ m_fileName(mir_wstrdup(ptszFilename)),
m_options(options),
m_signature(SECRET_SIGNATURE),
m_out(NULL),
@@ -47,7 +47,7 @@ struct Logger int m_signature;
ptrA m_name;
- ptrT m_fileName, m_descr;
+ ptrW m_fileName, m_descr;
FILE *m_out;
__int64 m_lastwrite;
unsigned m_options;
diff --git a/src/mir_core/src/miranda.cpp b/src/mir_core/src/miranda.cpp index 055244596f..c2b4208b54 100644 --- a/src/mir_core/src/miranda.cpp +++ b/src/mir_core/src/miranda.cpp @@ -58,9 +58,9 @@ static INT_PTR RestartMiranda(WPARAM wParam, LPARAM lParam) if (wParam) {
VARST profilename(L"%miranda_profilename%");
- mir_sntprintf(cmdLine, L"\"%s\" /restart:%d /profile=%s", mirandaPath, GetCurrentProcessId(), (wchar_t*)profilename);
+ mir_snwprintf(cmdLine, L"\"%s\" /restart:%d /profile=%s", mirandaPath, GetCurrentProcessId(), (wchar_t*)profilename);
}
- else mir_sntprintf(cmdLine, L"\"%s\" /restart:%d", mirandaPath, GetCurrentProcessId());
+ else mir_snwprintf(cmdLine, L"\"%s\" /restart:%d", mirandaPath, GetCurrentProcessId());
CallService("CloseAction", 0, 0);
diff --git a/src/mir_core/src/openurl.cpp b/src/mir_core/src/openurl.cpp index d75baaa2a3..93aab27ec2 100644 --- a/src/mir_core/src/openurl.cpp +++ b/src/mir_core/src/openurl.cpp @@ -32,7 +32,7 @@ struct TOpenUrlInfo newWindow(_bNew)
{}
- ptrT szUrl;
+ ptrW szUrl;
int newWindow;
};
@@ -56,7 +56,7 @@ static void OpenURLThread(void *arg) }
// check user defined browser for opening urls
- ptrT tszBrowser(db_get_tsa(NULL, "Miranda", "OpenUrlBrowser"));
+ ptrW tszBrowser(db_get_tsa(NULL, "Miranda", "OpenUrlBrowser"));
if (tszBrowser)
ShellExecute(NULL, L"open", tszBrowser, tszUrl, NULL, (hUrlInfo->newWindow) ? SW_NORMAL : SW_SHOWDEFAULT);
else
@@ -68,7 +68,7 @@ static void OpenURLThread(void *arg) MIR_CORE_DLL(void) Utils_OpenUrl(const char *pszUrl, bool bOpenInNewWindow)
{
if (pszUrl)
- mir_forkthread(OpenURLThread, new TOpenUrlInfo(mir_a2t(pszUrl), bOpenInNewWindow));
+ mir_forkthread(OpenURLThread, new TOpenUrlInfo(mir_a2u(pszUrl), bOpenInNewWindow));
}
MIR_CORE_DLL(void) Utils_OpenUrlW(const wchar_t *pszUrl, bool bOpenInNewWindow)
diff --git a/src/mir_core/src/path.cpp b/src/mir_core/src/path.cpp index 64d00da713..56aa054c85 100644 --- a/src/mir_core/src/path.cpp +++ b/src/mir_core/src/path.cpp @@ -156,7 +156,7 @@ MIR_CORE_DLL(int) PathToAbsoluteW(const WCHAR *pSrc, WCHAR *pOut, const WCHAR *b WCHAR buf[MAX_PATH];
if (pSrc[0] < ' ')
- return mir_sntprintf(pOut, MAX_PATH, L"%s", pSrc);
+ return mir_snwprintf(pOut, MAX_PATH, L"%s", pSrc);
if (PathIsAbsoluteW(pSrc))
return GetFullPathName(pSrc, MAX_PATH, pOut, NULL);
@@ -167,7 +167,7 @@ MIR_CORE_DLL(int) PathToAbsoluteW(const WCHAR *pSrc, WCHAR *pOut, const WCHAR *b if (pSrc[0] == '\\')
pSrc++;
- mir_sntprintf(buf, MAX_PATH, L"%s%s", base, pSrc);
+ mir_snwprintf(buf, MAX_PATH, L"%s%s", base, pSrc);
return GetFullPathName(buf, MAX_PATH, pOut, NULL);
}
diff --git a/src/mir_core/src/timezones.cpp b/src/mir_core/src/timezones.cpp index c832bd2d42..e8f0e05356 100644 --- a/src/mir_core/src/timezones.cpp +++ b/src/mir_core/src/timezones.cpp @@ -176,7 +176,7 @@ MIR_CORE_DLL(LPCTSTR) TimeZone_GetDescription(LPCTSTR TZname) for (int i = 0; i < g_timezonesBias.getCount(); i++) {
MIM_TIMEZONE *tz = g_timezonesBias[i];
- if (!mir_tstrcmp(tz->tszName, TZname))
+ if (!mir_wstrcmp(tz->tszName, TZname))
return tz->szDisplay;
}
return L"";
@@ -218,7 +218,7 @@ MIR_CORE_DLL(HANDLE) TimeZone_CreateByName(LPCTSTR tszName, DWORD dwFlags) if (tszName == NULL)
return (dwFlags & (TZF_DIFONLY | TZF_KNOWNONLY)) ? NULL : &myInfo.myTZ;
- if (mir_tstrcmp(myInfo.myTZ.tszName, tszName) == 0)
+ if (mir_wstrcmp(myInfo.myTZ.tszName, tszName) == 0)
return (dwFlags & TZF_DIFONLY) ? NULL : &myInfo.myTZ;
MIM_TIMEZONE tzsearch;
@@ -381,9 +381,9 @@ static const ListMessages* GetListMessages(HWND hWnd, DWORD dwFlags) if (!(dwFlags & (TZF_PLF_CB | TZF_PLF_LB))) {
wchar_t tszClassName[128];
GetClassName(hWnd, tszClassName, _countof(tszClassName));
- if (!mir_tstrcmpi(tszClassName, L"COMBOBOX"))
+ if (!mir_wstrcmpi(tszClassName, L"COMBOBOX"))
dwFlags |= TZF_PLF_CB;
- else if (!mir_tstrcmpi(tszClassName, L"LISTBOX"))
+ else if (!mir_wstrcmpi(tszClassName, L"LISTBOX"))
dwFlags |= TZF_PLF_LB;
}
if (dwFlags & TZF_PLF_CB)
@@ -405,7 +405,7 @@ MIR_CORE_DLL(int) TimeZone_SelectListItem(MCONTACT hContact, LPCSTR szModule, HW if (szModule == NULL) szModule = "UserInfo";
int iSelection = 0;
- ptrT tszName(db_get_tsa(hContact, szModule, "TzName"));
+ ptrW tszName(db_get_tsa(hContact, szModule, "TzName"));
if (tszName != NULL) {
unsigned hash = mir_hashstrT(tszName);
for (int i = 0; i < g_timezonesBias.getCount(); i++) {
@@ -506,9 +506,7 @@ void RecalculateTime(void) DYNAMIC_TIME_ZONE_INFORMATION dtzi;
if (pfnGetDynamicTimeZoneInformation && pfnGetDynamicTimeZoneInformation(&dtzi) != TIME_ZONE_ID_INVALID) {
- wchar_t *myTzKey = mir_u2t(dtzi.TimeZoneKeyName);
- wcsncpy_s(myInfo.myTZ.tszName, myTzKey, _TRUNCATE);
- mir_free(myTzKey);
+ wcsncpy_s(myInfo.myTZ.tszName, dtzi.TimeZoneKeyName, _TRUNCATE);
found = true;
}
@@ -563,7 +561,7 @@ void InitTimeZones(void) tz->tzi.DaylightDate = tzi.DaylightDate;
tz->tzi.DaylightBias = tzi.DaylightBias;
- mir_tstrcpy(tz->tszName, tszName);
+ mir_wstrcpy(tz->tszName, tszName);
tz->hash = mir_hashstrT(tszName);
tz->offset = INT_MIN;
diff --git a/src/mir_core/src/ui_utils.cpp b/src/mir_core/src/ui_utils.cpp index 03065d06d2..8de4a148e7 100644 --- a/src/mir_core/src/ui_utils.cpp +++ b/src/mir_core/src/ui_utils.cpp @@ -382,7 +382,7 @@ wchar_t* CCtrlCombo::GetItemText(int index, wchar_t *buf, int size) {
wchar_t *result = (wchar_t *)_alloca(sizeof(wchar_t) * (SendMessage(m_hwnd, CB_GETLBTEXTLEN, index, 0) + 1));
SendMessage(m_hwnd, CB_GETLBTEXT, index, (LPARAM)result);
- mir_tstrncpy(buf, result, size);
+ mir_wstrncpy(buf, result, size);
return buf;
}
@@ -468,7 +468,7 @@ wchar_t* CCtrlListBox::GetItemText(int index, wchar_t *buf, int size) {
wchar_t *result = (wchar_t *)_alloca(sizeof(wchar_t) * (SendMessage(m_hwnd, LB_GETTEXTLEN, index, 0) + 1));
SendMessage(m_hwnd, LB_GETTEXT, index, (LPARAM)result);
- mir_tstrncpy(buf, result, size);
+ mir_wstrncpy(buf, result, size);
return buf;
}
@@ -966,7 +966,7 @@ void CCtrlListView::AddGroup(int iGroupId, wchar_t *name) lvg.cbSize = sizeof(lvg);
lvg.mask = LVGF_HEADER | LVGF_GROUPID;
lvg.pszHeader = name;
- lvg.cchHeader = (int)mir_tstrlen(lvg.pszHeader);
+ lvg.cchHeader = (int)mir_wstrlen(lvg.pszHeader);
lvg.iGroupId = iGroupId;
InsertGroup(-1, &lvg);
}
@@ -1680,7 +1680,7 @@ HTREEITEM CCtrlTreeView::FindNamedItem(HTREEITEM hItem, const wchar_t *name) while (tvi.hItem) {
GetItem(&tvi);
- if (!mir_tstrcmp(tvi.pszText, name))
+ if (!mir_wstrcmp(tvi.pszText, name))
return tvi.hItem;
tvi.hItem = GetNextSibling(tvi.hItem);
@@ -2139,7 +2139,7 @@ void CCtrlPages::AddPage(wchar_t *ptszName, HICON hIcon, CDlgBase *pDlg) TPageInfo *info = new TPageInfo;
info->m_pDlg = pDlg;
info->m_hIcon = hIcon;
- info->m_ptszHeader = mir_tstrdup(ptszName);
+ info->m_ptszHeader = mir_wstrdup(ptszName);
m_pages.insert(info);
}
@@ -2372,7 +2372,7 @@ void CCtrlBase::SetTextA(const char *text) void CCtrlBase::SetInt(int value)
{
wchar_t buf[32] = { 0 };
- mir_sntprintf(buf, L"%d", value);
+ mir_snwprintf(buf, L"%d", value);
SetWindowText(m_hwnd, buf);
}
@@ -2469,7 +2469,7 @@ CDbLink::CDbLink(const char *szModule, const char *szSetting, BYTE type, wchar_t {
m_szModule = mir_strdup(szModule);
m_szSetting = mir_strdup(szSetting);
- m_szDefault = mir_tstrdup(szValue);
+ m_szDefault = mir_wstrdup(szValue);
dbv.type = DBVT_DELETED;
}
diff --git a/src/mir_core/src/winver.cpp b/src/mir_core/src/winver.cpp index cfbe338b81..8c7d73e98a 100644 --- a/src/mir_core/src/winver.cpp +++ b/src/mir_core/src/winver.cpp @@ -95,7 +95,7 @@ MIR_CORE_DLL(BOOL) IsWorkstationLocked(void) wchar_t tszName[100];
DWORD cbName;
- BOOL bLocked = (!GetUserObjectInformation(hDesk, UOI_NAME, tszName, _countof(tszName), &cbName) || mir_tstrcmpi(tszName, L"default") != 0);
+ BOOL bLocked = (!GetUserObjectInformation(hDesk, UOI_NAME, tszName, _countof(tszName), &cbName) || mir_wstrcmpi(tszName, L"default") != 0);
CloseDesktop(hDesk);
return bLocked;
}
@@ -395,7 +395,7 @@ MIR_CORE_DLL(BOOL) GetOSDisplayString(wchar_t *buf, size_t bufSize) // Include service pack (if any) and build number.
- if (mir_tstrlen(osvi.szCSDVersion) > 0) {
+ if (mir_wstrlen(osvi.szCSDVersion) > 0) {
ret.Append(L" ");
ret.Append(osvi.szCSDVersion);
}
@@ -408,6 +408,6 @@ MIR_CORE_DLL(BOOL) GetOSDisplayString(wchar_t *buf, size_t bufSize) ret.AppendFormat(L" (Wine %s)", _A2T(wine_get_version()));
}
- mir_tstrncpy(buf, ret, bufSize);
+ mir_wstrncpy(buf, ret, bufSize);
return TRUE;
}
diff --git a/utils/mir_buffer.h b/utils/mir_buffer.h index 25ea5a0516..3adc17fd4c 100644 --- a/utils/mir_buffer.h +++ b/utils/mir_buffer.h @@ -471,7 +471,7 @@ static void ReplaceVars(Buffer<wchar_t> *buffer, MCONTACT hContact, wchar_t **va { for(int k = 0; k < numVariables; k += 2) { - size_t len = mir_tstrlen(variables[k]); + size_t len = mir_wstrlen(variables[k]); if (foundLen == len + 2 && wcsncmp(&buffer->str[j]+1, variables[k], len) == 0) { buffer->replace(j, i + 1, variables[k + 1]); diff --git a/utils/mir_fonts.cpp b/utils/mir_fonts.cpp index 410f936fa3..cb0dba3571 100644 --- a/utils/mir_fonts.cpp +++ b/utils/mir_fonts.cpp @@ -12,10 +12,10 @@ int FontService_RegisterFont(const char *pszDbModule, const char *pszDbName, con fid.cbSize = sizeof(fid); mir_strncpy(fid.dbSettingsGroup, pszDbModule, sizeof(fid.dbSettingsGroup)); /* buffer safe */ mir_strncpy(fid.prefix, pszDbName, sizeof(fid.prefix)); /* buffer safe */ - mir_tstrncpy(fid.group, pszSection, _countof(fid.group)); /* buffer safe */ - mir_tstrncpy(fid.name, pszDescription, _countof(fid.name)); /* buffer safe */ - mir_tstrncpy(fid.backgroundGroup, pszBackgroundGroup, _countof(fid.backgroundGroup)); /* buffer safe */ - mir_tstrncpy(fid.backgroundName, pszBackgroundName, _countof(fid.backgroundName)); /* buffer safe */ + mir_wstrncpy(fid.group, pszSection, _countof(fid.group)); /* buffer safe */ + mir_wstrncpy(fid.name, pszDescription, _countof(fid.name)); /* buffer safe */ + mir_wstrncpy(fid.backgroundGroup, pszBackgroundGroup, _countof(fid.backgroundGroup)); /* buffer safe */ + mir_wstrncpy(fid.backgroundName, pszBackgroundName, _countof(fid.backgroundName)); /* buffer safe */ fid.flags = FIDF_ALLOWREREGISTER; if (bAllowEffects) fid.flags |= FIDF_ALLOWEFFECTS; fid.order = position; @@ -28,7 +28,7 @@ int FontService_RegisterFont(const char *pszDbModule, const char *pszDbName, con if (plfDefault->lfUnderline) fid.deffontsettings.style |= DBFONTF_UNDERLINE; if (plfDefault->lfStrikeOut) fid.deffontsettings.style |= DBFONTF_STRIKEOUT; fid.deffontsettings.charset = plfDefault->lfCharSet; - mir_tstrncpy(fid.deffontsettings.szFace, plfDefault->lfFaceName, _countof(fid.deffontsettings.szFace)); /* buffer safe */ + mir_wstrncpy(fid.deffontsettings.szFace, plfDefault->lfFaceName, _countof(fid.deffontsettings.szFace)); /* buffer safe */ } FontRegisterT(&fid); return 0; @@ -37,8 +37,8 @@ int FontService_RegisterFont(const char *pszDbModule, const char *pszDbName, con int FontService_GetFont(const wchar_t *pszSection, const wchar_t *pszDescription, COLORREF *pclr, LOGFONT *plf) { FontIDT fid = { 0 }; - mir_tstrncpy(fid.group, pszSection, _countof(fid.group)); /* buffer sfae */ - mir_tstrncpy(fid.name, pszDescription, _countof(fid.name)); /* buffer safe */ + mir_wstrncpy(fid.group, pszSection, _countof(fid.group)); /* buffer sfae */ + mir_wstrncpy(fid.name, pszDescription, _countof(fid.name)); /* buffer safe */ *pclr = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)plf); /* uses fallback font on error */ return (int)*pclr == -1; } @@ -50,8 +50,8 @@ int FontService_RegisterColor(const char *pszDbModule, const char *pszDbName, co cid.defcolour = clrDefault; mir_strncpy(cid.dbSettingsGroup, pszDbModule, sizeof(cid.dbSettingsGroup)); /* buffer safe */ mir_strncpy(cid.setting, pszDbName, sizeof(cid.setting)); /* buffer safe */ - mir_tstrncpy(cid.group, pszSection, _countof(cid.group)); /* buffer safe */ - mir_tstrncpy(cid.name, pszDescription, _countof(cid.name)); /* buffer safe */ + mir_wstrncpy(cid.group, pszSection, _countof(cid.group)); /* buffer safe */ + mir_wstrncpy(cid.name, pszDescription, _countof(cid.name)); /* buffer safe */ ColourRegisterT(&cid); return 0; } diff --git a/utils/mir_options.cpp b/utils/mir_options.cpp index 90bf27c3e8..dcba3e6b26 100644 --- a/utils/mir_options.cpp +++ b/utils/mir_options.cpp @@ -38,12 +38,12 @@ static wchar_t* MyDBGetContactSettingTString(MCONTACT hContact, char* module, ch out[0] = '\0'; if (!db_get_ts(hContact, module, setting, &dbv)) { - mir_tstrncpy(out, dbv.ptszVal, (int)len); + mir_wstrncpy(out, dbv.ptszVal, (int)len); db_free(&dbv); } else { if (def != NULL) - mir_tstrncpy(out, def, (int)len); + mir_wstrncpy(out, def, (int)len); } return out; @@ -55,7 +55,7 @@ static wchar_t dbPath[MAX_PATH] = { 0 }; // database profile path (read at star static int PathIsAbsolute(const wchar_t *path) { - if (!path || !(mir_tstrlen(path) > 2)) + if (!path || !(mir_wstrlen(path) > 2)) return 0; if ((path[1] == ':' && path[2] == '\\') || (path[0] == '\\' && path[1] == '\\')) return 1; @@ -65,33 +65,33 @@ static int PathIsAbsolute(const wchar_t *path) static void PathToRelative(wchar_t *pOut, size_t outSize, const wchar_t *pSrc) { if (!PathIsAbsolute(pSrc)) - mir_tstrncpy(pOut, pSrc, (int)outSize); + mir_wstrncpy(pOut, pSrc, (int)outSize); else { if (dbPath[0] == '\0') { char tmp[1024]; CallService(MS_DB_GETPROFILEPATH, _countof(tmp), (LPARAM)tmp); - mir_sntprintf(dbPath, L"%S\\", tmp); + mir_snwprintf(dbPath, L"%S\\", tmp); } - size_t len = mir_tstrlen(dbPath); + size_t len = mir_wstrlen(dbPath); if (!wcsnicmp(pSrc, dbPath, len)) len = 0; - mir_tstrncpy(pOut, pSrc + len, outSize); + mir_wstrncpy(pOut, pSrc + len, outSize); } } static void PathToAbsolute(wchar_t *pOut, size_t outSize, const wchar_t *pSrc) { if (PathIsAbsolute(pSrc) || !isalnum(pSrc[0])) - mir_tstrncpy(pOut, pSrc, (int)outSize); + mir_wstrncpy(pOut, pSrc, (int)outSize); else { if (dbPath[0] == '\0') { char tmp[1024]; CallService(MS_DB_GETPROFILEPATH, _countof(tmp), (LPARAM)tmp); - mir_sntprintf(dbPath, L"%S\\", tmp); + mir_snwprintf(dbPath, L"%S\\", tmp); } - mir_sntprintf(pOut, outSize, L"%s%s", dbPath, pSrc); + mir_snwprintf(pOut, outSize, L"%s%s", dbPath, pSrc); } } @@ -267,7 +267,7 @@ INT_PTR CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, cha int k; for (k = 0; k < count; k++) { wchar_t *id = (wchar_t *)SendDlgItemMessage(hwndDlg, ctrl->nID, CB_GETITEMDATA, (WPARAM)k, 0); - if (mir_tstrcmp(id, tmp) == 0) + if (mir_wstrcmp(id, tmp) == 0) break; } if (k < count) diff --git a/utils/mir_smileys.cpp b/utils/mir_smileys.cpp index 0bce208d26..64407a4ccf 100644 --- a/utils/mir_smileys.cpp +++ b/utils/mir_smileys.cpp @@ -131,7 +131,7 @@ int Smileys_DrawText(HDC hDC, LPCTSTR lpString, int nCount, LPRECT lpRect, UINT int ret; if (nCount < 0) - nCount = (int)mir_tstrlen(lpString); + nCount = (int)mir_wstrlen(lpString); // Get parse info if (parseInfo == NULL) |