summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-11-30 18:51:36 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-11-30 18:51:36 +0000
commit688f55ba998c19304a29727c910504903f4cc49a (patch)
tree69121ebb6d02bcf9e670428b11813087fc7f1640 /protocols
parent4f0e30cdf56fbafdf955bbe8b93930bab9e39bd0 (diff)
lstr* replacements
git-svn-id: http://svn.miranda-ng.org/main/trunk@11176 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/EmLanProto/src/amdproto.cpp2
-rw-r--r--protocols/EmLanProto/src/mlan.cpp24
-rw-r--r--protocols/GTalkExt/src/avatar.cpp2
-rw-r--r--protocols/GTalkExt/src/handlers.cpp8
-rw-r--r--protocols/GTalkExt/src/inbox.cpp14
-rw-r--r--protocols/GTalkExt/src/notifications.cpp8
-rw-r--r--protocols/Gadu-Gadu/src/dialogs.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/image.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/sessions.cpp10
-rw-r--r--protocols/IRCG/src/commandmonitor.cpp34
-rw-r--r--protocols/IRCG/src/input.cpp72
-rw-r--r--protocols/IRCG/src/irc.h11
-rw-r--r--protocols/IRCG/src/irclib.cpp6
-rw-r--r--protocols/IRCG/src/irclib.h4
-rw-r--r--protocols/IRCG/src/ircproto.cpp28
-rw-r--r--protocols/IRCG/src/options.cpp30
-rw-r--r--protocols/IRCG/src/output.cpp2
-rw-r--r--protocols/IRCG/src/scripting.cpp8
-rw-r--r--protocols/IRCG/src/services.cpp40
-rw-r--r--protocols/IRCG/src/tools.cpp72
-rw-r--r--protocols/IRCG/src/ui_utils.cpp4
-rw-r--r--protocols/IRCG/src/userinfo.cpp8
-rw-r--r--protocols/IRCG/src/windows.cpp122
-rw-r--r--protocols/IcqOscarJ/src/icq_avatar.cpp4
-rw-r--r--protocols/IcqOscarJ/src/icq_filerequests.cpp13
-rw-r--r--protocols/IcqOscarJ/src/icqosc_svcs.cpp4
-rw-r--r--protocols/JabberG/src/jabber.cpp2
-rw-r--r--protocols/JabberG/src/jabber_api.cpp16
-rw-r--r--protocols/JabberG/src/jabber_caps.cpp2
-rw-r--r--protocols/JabberG/src/jabber_chat.cpp8
-rw-r--r--protocols/JabberG/src/jabber_console.cpp8
-rw-r--r--protocols/JabberG/src/jabber_file.cpp2
-rw-r--r--protocols/JabberG/src/jabber_form.cpp4
-rw-r--r--protocols/JabberG/src/jabber_frame.cpp14
-rw-r--r--protocols/JabberG/src/jabber_groupchat.cpp4
-rw-r--r--protocols/JabberG/src/jabber_icolib.cpp2
-rw-r--r--protocols/JabberG/src/jabber_iq_handlers.cpp6
-rw-r--r--protocols/JabberG/src/jabber_iqid.cpp4
-rw-r--r--protocols/JabberG/src/jabber_iqid_muc.cpp2
-rw-r--r--protocols/JabberG/src/jabber_misc.cpp2
-rw-r--r--protocols/JabberG/src/jabber_notes.cpp10
-rw-r--r--protocols/JabberG/src/jabber_opt.cpp6
-rw-r--r--protocols/JabberG/src/jabber_opttree.cpp2
-rw-r--r--protocols/JabberG/src/jabber_privacy.cpp6
-rw-r--r--protocols/JabberG/src/jabber_proto.cpp2
-rw-r--r--protocols/JabberG/src/jabber_rc.cpp2
-rw-r--r--protocols/JabberG/src/jabber_userinfo.cpp28
-rw-r--r--protocols/JabberG/src/jabber_util.cpp10
-rw-r--r--protocols/JabberG/src/jabber_xml.cpp6
-rw-r--r--protocols/JabberG/src/jabber_xstatus.cpp16
-rw-r--r--protocols/JabberG/src/ui_utils.cpp12
-rw-r--r--protocols/MRA/src/MraAvatars.cpp4
-rw-r--r--protocols/MRA/src/MraChat.cpp4
-rw-r--r--protocols/MRA/src/MraFilesQueue.cpp4
-rw-r--r--protocols/MRA/src/MraIcons.cpp2
-rw-r--r--protocols/MRA/src/MraPopUp.cpp4
-rw-r--r--protocols/MRA/src/MraProto.cpp18
-rw-r--r--protocols/MRA/src/MraRTFMsg.cpp2
-rw-r--r--protocols/MRA/src/MraSendCommand.cpp4
-rw-r--r--protocols/MRA/src/Mra_functions.cpp24
-rw-r--r--protocols/MRA/src/Mra_options.cpp2
-rw-r--r--protocols/MRA/src/Mra_svcs.cpp6
-rw-r--r--protocols/MSN/src/msn_commands.cpp2
-rw-r--r--protocols/MSN/src/msn_p2p.cpp2
-rw-r--r--protocols/SkypeClassic/src/skype.cpp10
-rw-r--r--protocols/SkypeClassic/src/skypeopt.cpp8
-rw-r--r--protocols/SkypeClassic/src/skypesvc.cpp2
-rw-r--r--protocols/SkypeClassic/src/utf8.cpp4
-rw-r--r--protocols/Twitter/src/proto.cpp2
-rw-r--r--protocols/VKontakte/src/vk_chats.cpp2
-rw-r--r--protocols/WhatsApp/src/proto.cpp4
-rw-r--r--protocols/Xfire/src/main.cpp6
-rw-r--r--protocols/Xfire/src/options.cpp2
-rw-r--r--protocols/Xfire/src/processbuddyinfo.cpp2
-rw-r--r--protocols/Xfire/src/tools.cpp4
-rw-r--r--protocols/Yahoo/src/avatar.cpp2
-rw-r--r--protocols/Yahoo/src/file_transfer.cpp8
-rw-r--r--protocols/Yahoo/src/im.cpp36
-rw-r--r--protocols/Yahoo/src/libyahoo2/config.h5
-rw-r--r--protocols/Yahoo/src/libyahoo2/libyahoo2.cpp20
-rw-r--r--protocols/Yahoo/src/proto.cpp34
-rw-r--r--protocols/Yahoo/src/search.cpp4
-rw-r--r--protocols/Yahoo/src/services.cpp37
-rw-r--r--protocols/Yahoo/src/user_info.cpp39
-rw-r--r--protocols/Yahoo/src/util.cpp4
-rw-r--r--protocols/Yahoo/src/yahoo.cpp44
86 files changed, 506 insertions, 561 deletions
diff --git a/protocols/EmLanProto/src/amdproto.cpp b/protocols/EmLanProto/src/amdproto.cpp
index 29e286a969..9f9675f0c7 100644
--- a/protocols/EmLanProto/src/amdproto.cpp
+++ b/protocols/EmLanProto/src/amdproto.cpp
@@ -81,7 +81,7 @@ static INT_PTR __cdecl EMPGetCaps(WPARAM wParam,LPARAM )
static INT_PTR __cdecl EMPGetName(WPARAM wParam,LPARAM lParam)
{
- lstrcpyn((char*)lParam, "EmLan", wParam);
+ mir_tstrncpy((char*)lParam, "EmLan", wParam);
return 0;
}
diff --git a/protocols/EmLanProto/src/mlan.cpp b/protocols/EmLanProto/src/mlan.cpp
index 945a6a16b7..267c17dca3 100644
--- a/protocols/EmLanProto/src/mlan.cpp
+++ b/protocols/EmLanProto/src/mlan.cpp
@@ -437,10 +437,10 @@ void CMLan::RecvMessageUrl(CCSDATA* ccs)
dbei.szModule = PROTONAME;
dbei.timestamp = pre->timestamp;
dbei.flags = pre->flags&PREF_CREATEREAD?DBEF_READ:0;
- dbei.cbBlob = lstrlen(pre->szMessage)+1;
+ dbei.cbBlob = mir_tstrlen(pre->szMessage)+1;
if (!lstrcmpA(ccs->szProtoService, PSR_URL))
{
- dbei.cbBlob += 2+lstrlen(pre->szMessage+dbei.cbBlob+1);
+ dbei.cbBlob += 2+mir_tstrlen(pre->szMessage+dbei.cbBlob+1);
}
dbei.pBlob = (PBYTE)pre->szMessage;
@@ -475,7 +475,7 @@ int CMLan::SendMessageUrl(CCSDATA* ccs, bool isUrl)
int len;
if (isUrl)
{
- len = lstrlen((char*)ccs->lParam);
+ len = mir_tstrlen((char*)ccs->lParam);
((char*)ccs->lParam)[len] = 1;
}
TDataHolder* hold = new TDataHolder(ccs, cid, isUrl?LEXT_SENDURL:LEXT_SENDMESSAGE, this);
@@ -545,10 +545,10 @@ void CMLan::SearchExt(TDataHolder* hold)
if (strcmp(hold->msg, cont->m_nick)==0 || strcmp(hold->msg, "*")==0)
{
char buf[MAX_HOSTNAME_LEN];
- lstrcpy(buf, cont->m_nick);
- int len = lstrlen(buf);
+ mir_tstrcpy(buf, cont->m_nick);
+ int len = mir_tstrlen(buf);
buf[len] = '@';
- lstrcpy(buf+len+1, inet_ntoa(cont->m_addr));
+ mir_tstrcpy(buf+len+1, inet_ntoa(cont->m_addr));
psr.hdr.nick = cont->m_nick;
psr.hdr.firstName="";
psr.hdr.lastName="";
@@ -662,7 +662,7 @@ u_char* CMLan::CreatePacket(TPacket& pak, int* pBufLen)
int nameLen;
if (pak.strName)
{
- nameLen = lstrlen(pak.strName);
+ nameLen = mir_tstrlen(pak.strName);
len += 1+1+nameLen+1;
}
@@ -672,9 +672,9 @@ u_char* CMLan::CreatePacket(TPacket& pak, int* pBufLen)
int mesLen = 0;
if (pak.strMessage)
{
- mesLen = lstrlen(pak.strMessage);
+ mesLen = mir_tstrlen(pak.strMessage);
if (pak.flIsUrl)
- mesLen += 1+lstrlen(pak.strMessage+mesLen+1);
+ mesLen += 1+mir_tstrlen(pak.strMessage+mesLen+1);
len += 3+1+4+mesLen+1;
}
@@ -687,7 +687,7 @@ u_char* CMLan::CreatePacket(TPacket& pak, int* pBufLen)
int awayLen = 0;
if (pak.strAwayMessage)
{
- awayLen = lstrlen(pak.strAwayMessage);
+ awayLen = mir_tstrlen(pak.strAwayMessage);
len += 3+1+4+awayLen+1;
}
@@ -863,9 +863,9 @@ void CMLan::LoadSettings()
}
if (!dbv.pszVal[0])
dbv.pszVal = "EmLan_User";
- lstrcpy(m_name, dbv.pszVal);
+ mir_tstrcpy(m_name, dbv.pszVal);
}
- m_nameLen = lstrlen(m_name);
+ m_nameLen = mir_tstrlen(m_name);
if (GetStatus()!=LM_LISTEN)
{
diff --git a/protocols/GTalkExt/src/avatar.cpp b/protocols/GTalkExt/src/avatar.cpp
index 574d865cac..4f3e848c4b 100644
--- a/protocols/GTalkExt/src/avatar.cpp
+++ b/protocols/GTalkExt/src/avatar.cpp
@@ -39,7 +39,7 @@ LPTSTR CreateAvaFile(HANDLE *hFile)
if (CallService(MS_DB_GETPROFILENAMET, (WPARAM)SIZEOF(name), (LPARAM)&name))
return NULL;
- for (int i = lstrlen(name); i >= 0; i--)
+ for (int i = mir_tstrlen(name); i >= 0; i--)
if ('.' == name[i]) {
name[i] = 0;
break;
diff --git a/protocols/GTalkExt/src/handlers.cpp b/protocols/GTalkExt/src/handlers.cpp
index 8c3817474f..af6f5bc8f8 100644
--- a/protocols/GTalkExt/src/handlers.cpp
+++ b/protocols/GTalkExt/src/handlers.cpp
@@ -45,18 +45,18 @@ GoogleTalkAcc* isGoogle(LPARAM lParam)
void FormatMessageUrl(LPCTSTR format, LPTSTR buf, LPCTSTR mailbox, LPCTSTR tid)
{
ULARGE_INTEGER iTid; iTid.QuadPart = _tstoi64(tid);
- int l = lstrlen(buf);
+ int l = mir_tstrlen(buf);
mir_sntprintf(buf, l, format, mailbox, iTid.HighPart, iTid.LowPart);
- assert(l >= lstrlen(buf));
+ assert(l >= mir_tstrlen(buf));
}
void MakeUrlHex(LPTSTR url, LPCTSTR tid)
{
ULARGE_INTEGER iTid; iTid.QuadPart = _tstoi64(tid);
LPTSTR tidInUrl = _tcsstr(url, tid);
- LPTSTR trail = tidInUrl + lstrlen(tid);
+ LPTSTR trail = tidInUrl + mir_tstrlen(tid);
wsprintf(tidInUrl, _T("%x%08x"), iTid.HighPart, iTid.LowPart); //!!!!!!!!!!!!
- wmemmove(tidInUrl + lstrlen(tidInUrl), trail, lstrlen(trail) + 1);
+ wmemmove(tidInUrl + mir_tstrlen(tidInUrl), trail, mir_tstrlen(trail) + 1);
}
LPTSTR ExtractJid(LPCTSTR jidWithRes)
diff --git a/protocols/GTalkExt/src/inbox.cpp b/protocols/GTalkExt/src/inbox.cpp
index 51a0cf5ddd..6ac9790478 100644
--- a/protocols/GTalkExt/src/inbox.cpp
+++ b/protocols/GTalkExt/src/inbox.cpp
@@ -60,7 +60,7 @@ LPSTR HttpPost(HANDLE hUser, LPSTR reqUrl, LPSTR reqParams)
nlhr.headers = (NETLIBHTTPHEADER*)&HEADER_URL_ENCODED;
nlhr.headersCount = 1;
nlhr.pData = reqParams;
- nlhr.dataLength = lstrlenA(reqParams);
+ nlhr.dataLength = mir_strlen(reqParams);
NETLIBHTTPREQUEST *pResp = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hUser, (LPARAM)&nlhr);
if (!pResp) return NULL;
@@ -78,7 +78,7 @@ LPSTR HttpPost(HANDLE hUser, LPSTR reqUrl, LPSTR reqParams)
LPSTR MakeRequest(HANDLE hUser, LPSTR reqUrl, LPSTR reqParamsFormat, LPSTR p1, LPSTR p2)
{
ptrA encodedP1( mir_urlEncode(p1)), encodedP2( mir_urlEncode(p2));
- size_t size = lstrlenA(reqParamsFormat) + 1 + lstrlenA(encodedP1) + lstrlenA(encodedP2);
+ size_t size = mir_strlen(reqParamsFormat) + 1 + mir_strlen(encodedP1) + mir_strlen(encodedP2);
LPSTR reqParams = (LPSTR)alloca(size);
mir_snprintf(reqParams, size, reqParamsFormat, encodedP1, encodedP2);
return HttpPost(hUser, reqUrl, reqParams);
@@ -93,11 +93,11 @@ LPSTR FindSid(LPSTR resp, LPSTR *LSID)
if (SID - 1 == *LSID) SID = strstr(SID + 1, SID_KEY_NAME);
if (!SID) return NULL;
- SID += lstrlenA(SID_KEY_NAME);
+ SID += mir_strlen(SID_KEY_NAME);
LPSTR term = strstr(SID, "\n");
if (term) term[0] = 0;
- *LSID += lstrlenA(LSID_KEY_NAME);
+ *LSID += mir_strlen(LSID_KEY_NAME);
term = strstr(*LSID, "\n");
if (term) term[0] = 0;
@@ -107,7 +107,7 @@ LPSTR FindSid(LPSTR resp, LPSTR *LSID)
void DoOpenUrl(LPSTR tokenResp, LPSTR url)
{
ptrA encodedUrl( mir_urlEncode(url)), encodedToken( mir_urlEncode(tokenResp));
- size_t size = lstrlenA(TOKEN_AUTH_URL) + 1 + lstrlenA(encodedToken) + lstrlenA(encodedUrl);
+ size_t size = mir_strlen(TOKEN_AUTH_URL) + 1 + mir_strlen(encodedToken) + mir_strlen(encodedUrl);
LPSTR composedUrl = (LPSTR)alloca(size);
mir_snprintf(composedUrl, size, TOKEN_AUTH_URL, encodedToken, encodedUrl);
CallService(MS_UTILS_OPENURL, 0, (LPARAM)composedUrl);
@@ -177,8 +177,8 @@ BOOL OpenUrlWithAuth(LPCSTR acc, LPCTSTR mailbox, LPCTSTR url)
int pwdLen = GetMailboxPwd(acc, mailbox, NULL, 0);
if (!pwdLen++) return FALSE;
- int urlLen = lstrlen(url) + 1;
- int mailboxLen = lstrlen(mailbox) + 1;
+ int urlLen = mir_tstrlen(url) + 1;
+ int mailboxLen = mir_tstrlen(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);
diff --git a/protocols/GTalkExt/src/notifications.cpp b/protocols/GTalkExt/src/notifications.cpp
index 20825d8d8f..5acef31604 100644
--- a/protocols/GTalkExt/src/notifications.cpp
+++ b/protocols/GTalkExt/src/notifications.cpp
@@ -177,7 +177,7 @@ MCONTACT SetupPseudocontact(LPCTSTR jid, LPCTSTR unreadCount, LPCSTR acc, LPCTST
// SetAvatar(hContact);
if (displayName == NULL) {
- TCHAR *tszTemp = (TCHAR*)alloca((lstrlen(jid) + lstrlen(unreadCount) + 3 + 1) * sizeof(TCHAR));
+ TCHAR *tszTemp = (TCHAR*)alloca((mir_tstrlen(jid) + mir_tstrlen(unreadCount) + 3 + 1) * sizeof(TCHAR));
FormatPseudocontactDisplayName(tszTemp, jid, unreadCount);
db_set_ts(hContact, CLIST_MODULE_NAME, CONTACT_DISPLAY_NAME_SETTING, tszTemp);
}
@@ -231,8 +231,8 @@ void ShowNotification(LPCSTR acc, POPUPDATAT *data, LPCTSTR jid, LPCTSTR url, LP
}
data->PluginWindowProc = PopupProc;
- int lurl = (lstrlen(url) + 1) * sizeof(TCHAR);
- int ljid = (lstrlen(jid) + 1) * sizeof(TCHAR);
+ int lurl = (mir_tstrlen(url) + 1) * sizeof(TCHAR);
+ int ljid = (mir_tstrlen(jid) + 1) * sizeof(TCHAR);
POPUP_DATA_HEADER *ppdh = (POPUP_DATA_HEADER*)malloc(sizeof(POPUP_DATA_HEADER) + lurl + ljid);
ppdh->MarkRead = FALSE;
@@ -272,7 +272,7 @@ void UnreadThreadNotification(LPCSTR acc, LPCTSTR jid, LPCTSTR url, LPCTSTR unre
mir_sntprintf(currSender, SENDER_COUNT * 100, _T(" %s <%s>\n"), mtn->senders[i].name, mtn->senders[i].addr);
else
mir_sntprintf(currSender, SENDER_COUNT * 100, _T(" %s\n"), mtn->senders[i].addr);
- currSender += lstrlen(currSender);
+ currSender += mir_tstrlen(currSender);
}
if ( ReadCheckbox(0, IDC_ADDSNIP, (DWORD)TlsGetValue(itlsSettings)))
diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp
index b0226022a6..8537427ddb 100644
--- a/protocols/Gadu-Gadu/src/dialogs.cpp
+++ b/protocols/Gadu-Gadu/src/dialogs.cpp
@@ -128,7 +128,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule
break;
default:
ptstr = str;
- lstrcpy(str, _T("???"));
+ mir_tstrcpy(str, _T("???"));
break;
}
}
diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp
index 6d0a6899f6..60d588e888 100644
--- a/protocols/Gadu-Gadu/src/image.cpp
+++ b/protocols/Gadu-Gadu/src/image.cpp
@@ -1025,7 +1025,7 @@ void* GGPROTO::img_loadpicture(gg_event* e, TCHAR *szFileName)
// Add missing file extension
const TCHAR *szImgType = gg_img_guessfileextension(dat->lpData);
if (*szImgType) {
- dat->lpszFileName = (TCHAR*)calloc(sizeof(TCHAR), lstrlen(tmpFileName) + lstrlen(szImgType) + 1);
+ dat->lpszFileName = (TCHAR*)calloc(sizeof(TCHAR), mir_tstrlen(tmpFileName) + mir_tstrlen(szImgType) + 1);
if (dat->lpszFileName != NULL) {
_tcscpy(dat->lpszFileName, tmpFileName);
_tcscat(dat->lpszFileName, szImgType);
diff --git a/protocols/Gadu-Gadu/src/sessions.cpp b/protocols/Gadu-Gadu/src/sessions.cpp
index 1fd3c49070..693c8f6b70 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, SIZEOF(szText));
hdc = GetDC(hList);
- GetTextExtentPoint32(hdc, szText, lstrlen(szText), &textSize);
+ GetTextExtentPoint32(hdc, szText, mir_tstrlen(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);
@@ -250,9 +250,9 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w
GetClientRect(hwndHeader, &rcHeader);
rc.top += rcHeader.bottom;
}
- GetTextExtentPoint32(nm->nmcd.hdc, szText, lstrlen(szText), &textSize);
+ GetTextExtentPoint32(nm->nmcd.hdc, szText, mir_tstrlen(szText), &textSize);
textPosX = rc.left + (((rc.right - rc.left) - textSize.cx) / 2);
- ExtTextOut(nm->nmcd.hdc, textPosX, rc.top + textSize.cy, ETO_OPAQUE, &rc, szText, lstrlen(szText), NULL);
+ ExtTextOut(nm->nmcd.hdc, textPosX, rc.top + textSize.cy, ETO_OPAQUE, &rc, szText, mir_tstrlen(szText), NULL);
}
// FALL THROUGH
@@ -332,9 +332,9 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w
ListView_GetItemText(hList, lvhti.iItem, 1, szIP, SIZEOF(szIP));
ListView_GetItemText(hList, lvhti.iItem, 2, szLoginTime, SIZEOF(szLoginTime));
mir_sntprintf(szText, SIZEOF(szText), _T("%s\t%s\t%s"), szClientName, szIP, szLoginTime);
- if ((hData = GlobalAlloc(GMEM_MOVEABLE, lstrlen(szText) + 1)) != NULL)
+ if ((hData = GlobalAlloc(GMEM_MOVEABLE, mir_tstrlen(szText) + 1)) != NULL)
{
- lstrcpy((TCHAR*)GlobalLock(hData), szText);
+ mir_tstrcpy((TCHAR*)GlobalLock(hData), szText);
GlobalUnlock(hData);
SetClipboardData(CF_TEXT, hData);
}
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp
index 8f39d5aefe..5bc6b89aa5 100644
--- a/protocols/IRCG/src/commandmonitor.cpp
+++ b/protocols/IRCG/src/commandmonitor.cpp
@@ -53,7 +53,7 @@ VOID CALLBACK TimerProc(HWND, UINT, UINT_PTR idEvent, DWORD)
if (ppro->m_forceVisible)
ppro->PostIrcMessage(_T("/MODE %s -i"), ppro->m_info.sNick.c_str());
- if (lstrlenA(ppro->m_myHost) == 0 && ppro->IsConnected())
+ if (mir_strlen(ppro->m_myHost) == 0 && ppro->IsConnected())
ppro->DoUserhostWithReason(2, (_T("S") + ppro->m_info.sNick).c_str(), true, _T("%s"), ppro->m_info.sNick.c_str());
}
@@ -240,7 +240,7 @@ void __cdecl CIrcProto::ResolveIPThread(LPVOID di)
{
mir_cslock lock(m_resolve);
- if (ipr != NULL && (ipr->iType == IP_AUTO && lstrlenA(m_myHost) == 0 || ipr->iType == IP_MANUAL)) {
+ if (ipr != NULL && (ipr->iType == IP_AUTO && mir_strlen(m_myHost) == 0 || ipr->iType == IP_MANUAL)) {
hostent* myhost = gethostbyname(ipr->sAddr.c_str());
if (myhost) {
IN_ADDR in;
@@ -275,7 +275,7 @@ bool CIrcProto::OnIrc_WELCOME(const CIrcMessage* pmsg)
CMString word = GetWord(pmsg->parameters[1].c_str(), i);
while (!word.IsEmpty()) {
if (_tcschr(word.c_str(), '!') && _tcschr(word.c_str(), '@')) {
- lstrcpyn(host, word.c_str(), SIZEOF(host));
+ mir_tstrncpy(host, word.c_str(), SIZEOF(host));
TCHAR* p1 = _tcschr(host, '@');
if (p1)
ForkThread(&CIrcProto::ResolveIPThread, new IPRESOLVE(_T2A(p1 + 1), IP_AUTO));
@@ -717,7 +717,7 @@ bool CIrcProto::OnIrc_PRIVMSG(const CIrcMessage* pmsg)
if (bIsChannel) {
if (!(pmsg->m_bIncoming && m_ignore && IsIgnored(pmsg->prefix.sNick, pmsg->prefix.sUser, pmsg->prefix.sHost, 'm'))) {
if (!pmsg->m_bIncoming)
- ReplaceString(mess, _T("%%"), _T("%"));
+ mess.Replace(_T("%%"), _T("%"));
DoEvent(GC_EVENT_MESSAGE, pmsg->parameters[0].c_str(), pmsg->m_bIncoming ? pmsg->prefix.sNick.c_str() : m_info.sNick.c_str(), mess.c_str(), NULL, NULL, NULL, true, pmsg->m_bIncoming ? false : true);
}
return true;
@@ -781,7 +781,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
if (mess.GetLength() > 1) {
mess.Delete(0, 1);
if (!pmsg->m_bIncoming)
- ReplaceString(mess, _T("%%"), _T("%"));
+ mess.Replace(_T("%%"), _T("%"));
DoEvent(GC_EVENT_ACTION, pmsg->parameters[0].c_str(), pmsg->m_bIncoming ? pmsg->prefix.sNick.c_str() : m_info.sNick.c_str(), mess.c_str(), NULL, NULL, NULL, true, pmsg->m_bIncoming ? false : true);
}
@@ -844,7 +844,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
else if (pmsg->m_bIncoming && command == _T("time")) {
TCHAR temp[300];
time_t tim = time(NULL);
- lstrcpyn(temp, _tctime(&tim), 25);
+ mir_tstrncpy(temp, _tctime(&tim), 25);
PostIrcMessage(_T("/NOTICE %s \001TIME %s\001"), pmsg->prefix.sNick.c_str(), temp);
mir_sntprintf(temp, SIZEOF(temp), TranslateT("CTCP TIME requested by %s"), pmsg->prefix.sNick.c_str());
@@ -1518,7 +1518,7 @@ bool CIrcProto::OnIrc_LIST(const CIrcMessage* pmsg)
TCHAR* save = temp;
if (find == temp && find2 != NULL && find + 8 >= find2) {
temp = _tcsstr(temp, _T("]"));
- if (lstrlen(temp) > 1) {
+ if (mir_tstrlen(temp) > 1) {
temp++;
temp[0] = '\0';
lvItem.iSubItem = 2;
@@ -1568,8 +1568,8 @@ bool CIrcProto::OnIrc_LISTEND(const CIrcMessage* pmsg)
if (m_noOfChannels > 0)
percent = (int)(m_channelNumber * 100) / m_noOfChannels;
if (percent < 70) {
- lstrcat(text, _T(" "));
- lstrcat(text, TranslateT("(probably truncated by server)"));
+ mir_tstrcat(text, _T(" "));
+ mir_tstrcat(text, TranslateT("(probably truncated by server)"));
}
SetDlgItemText(m_listDlg->GetHwnd(), IDC_TEXT, text);
}
@@ -1593,7 +1593,7 @@ bool CIrcProto::OnIrc_BANLIST(const CIrcMessage* pmsg)
S += _T(" - ( ");
time_t time = StrToInt(pmsg->parameters[4].c_str());
S += _tctime(&time);
- ReplaceString(S, _T("\n"), _T(" "));
+ S.Replace(_T("\n"), _T(" "));
S += _T(")");
}
}
@@ -1676,7 +1676,7 @@ bool CIrcProto::OnIrc_WHOIS_OTHER(const CIrcMessage* pmsg)
if (pmsg->m_bIncoming && m_whoisDlg && pmsg->parameters.getCount() > 2 && m_manualWhoisCount > 0) {
TCHAR temp[1024], temp2[1024];
m_whoisDlg->m_InfoOther.GetText(temp, 1000);
- lstrcat(temp, _T("%s\r\n"));
+ mir_tstrcat(temp, _T("%s\r\n"));
mir_sntprintf(temp2, 1020, temp, pmsg->parameters[2].c_str());
m_whoisDlg->m_InfoOther.SetText(temp2);
}
@@ -2016,7 +2016,7 @@ bool CIrcProto::OnIrc_WHO_REPLY(const CIrcMessage* pmsg)
m_whoReply.AppendFormat(_T("%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 (lstrcmpi(pmsg->parameters[5].c_str(), m_info.sNick.c_str()) == 0) {
TCHAR host[1024];
- lstrcpyn(host, pmsg->parameters[3].c_str(), 1024);
+ mir_tstrncpy(host, pmsg->parameters[3].c_str(), 1024);
ForkThread(&CIrcProto::ResolveIPThread, new IPRESOLVE(_T2A(host), IP_AUTO));
}
}
@@ -2187,8 +2187,8 @@ bool CIrcProto::OnIrc_SUPPORT(const CIrcMessage* pmsg)
TCHAR szAltPort[20];
if (pmsg->parameters.getCount() > 1 && _stscanf(pmsg->parameters[1].c_str(), lpszFmt, &szAltServer, &szAltPort) == 2) {
ShowMessage(pmsg);
- lstrcpynA(m_serverName, _T2A(szAltServer), 99);
- lstrcpynA(m_portStart, _T2A(szAltPort), 9);
+ mir_strncpy(m_serverName, _T2A(szAltServer), 99);
+ mir_strncpy(m_portStart, _T2A(szAltPort), 9);
m_noOfChannels = 0;
ConnectToServer();
@@ -2205,13 +2205,13 @@ bool CIrcProto::OnIrc_SUPPORT(const CIrcMessage* pmsg)
if (_tcsstr(temp, _T("CHANTYPES="))) {
TCHAR* p1 = _tcschr(temp, '=');
p1++;
- if (lstrlen(p1) > 0)
+ if (mir_tstrlen(p1) > 0)
sChannelPrefixes = p1;
}
if (_tcsstr(temp, _T("CHANMODES="))) {
TCHAR* p1 = _tcschr(temp, '=');
p1++;
- if (lstrlen(p1) > 0)
+ if (mir_tstrlen(p1) > 0)
sChannelModes = (char*)_T2A(p1);
}
if (_tcsstr(temp, _T("PREFIX="))) {
@@ -2390,7 +2390,7 @@ static void __cdecl AwayWarningThread(LPVOID)
int CIrcProto::DoPerform(const char* event)
{
- String sSetting = String("PERFORM:") + event;
+ CMStringA sSetting = CMStringA("PERFORM:") + event;
sSetting.MakeUpper();
DBVARIANT dbv;
diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp
index 29d5b4c14b..019ac57cb2 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)
{
TCHAR temp[30];
- lstrcpyn(temp, GetWord(text.c_str(), 0).c_str(), 29);
+ mir_tstrncpy(temp, GetWord(text.c_str(), 0).c_str(), 29);
CharLower(temp);
CMString command = temp;
CMString S = _T("");
@@ -56,7 +56,7 @@ void CIrcProto::FormatMsg(CMString& text)
}
}
- ReplaceString(sNewNick, NICKSUBSTITUTE, sNick4Perform.c_str());
+ sNewNick.Replace(NICKSUBSTITUTE, sNick4Perform.c_str());
S = GetWord(text.c_str(), 0) + _T(" ") + sNewNick;
}
}
@@ -68,8 +68,8 @@ void CIrcProto::FormatMsg(CMString& text)
static void AddCR(CMString& text)
{
- ReplaceString(text, _T("\n"), _T("\r\n"));
- ReplaceString(text, _T("\r\r"), _T("\r"));
+ text.Replace(_T("\n"), _T("\r\n"));
+ text.Replace(_T("\r\r"), _T("\r"));
}
CMString CIrcProto::DoAlias(const TCHAR *text, TCHAR *window)
@@ -89,16 +89,16 @@ CMString CIrcProto::DoAlias(const TCHAR *text, TCHAR *window)
Messageout += _T("\r\n");
TCHAR* line = new TCHAR[p2 - p1 + 1];
- lstrcpyn(line, p1, p2 - p1 + 1);
+ mir_tstrncpy(line, p1, p2 - p1 + 1);
TCHAR* test = line;
while (*test == ' ')
test++;
if (*test == '/') {
- lstrcpyn(line, GetWordAddress(line, 0), p2 - p1 + 1);
+ mir_tstrncpy(line, GetWordAddress(line, 0), p2 - p1 + 1);
CMString S = line;
delete[] line;
line = new TCHAR[S.GetLength() + 2];
- lstrcpyn(line, S.c_str(), S.GetLength() + 1);
+ mir_tstrncpy(line, S.c_str(), S.GetLength() + 1);
CMString alias(m_alias);
const TCHAR* p3 = _tcsstr(alias.c_str(), (GetWord(line, 0) + _T(" ")).c_str());
if (p3 != alias.c_str()) {
@@ -116,29 +116,29 @@ CMString CIrcProto::DoAlias(const TCHAR *text, TCHAR *window)
*(TCHAR*)p4 = 0;
CMString S = p3;
- ReplaceString(S, _T("##"), window);
- ReplaceString(S, _T("$?"), _T("%question"));
+ S.Replace(_T("##"), window);
+ S.Replace(_T("$?"), _T("%question"));
for (int index = 1; index < 8; index++) {
TCHAR str[5];
mir_sntprintf(str, SIZEOF(str), _T("#$%u"), index);
if (!GetWord(line, index).IsEmpty() && IsChannel(GetWord(line, index)))
- ReplaceString(S, str, GetWord(line, index).c_str());
+ S.Replace(str, GetWord(line, index).c_str());
else {
CMString S1 = _T("#");
S1 += GetWord(line, index);
- ReplaceString(S, str, S1.c_str());
+ S.Replace(str, S1.c_str());
}
}
for (int index2 = 1; index2 < 8; index2++) {
TCHAR str[5];
mir_sntprintf(str, SIZEOF(str), _T("$%u-"), index2);
- ReplaceString(S, str, GetWordAddress(line, index2));
+ S.Replace(str, GetWordAddress(line, index2));
}
for (int index3 = 1; index3 < 8; index3++) {
TCHAR str[5];
mir_sntprintf(str, SIZEOF(str), _T("$%u"), index3);
- ReplaceString(S, str, GetWord(line, index3).c_str());
+ S.Replace(str, GetWord(line, index3).c_str());
}
Messageout += GetWordAddress(S.c_str(), 1);
}
@@ -166,32 +166,32 @@ CMString CIrcProto::DoIdentifiers(CMString text, const TCHAR*)
TCHAR str[2];
GetLocalTime(&time);
- ReplaceString(text, _T("%mnick"), m_nick);
- ReplaceString(text, _T("%anick"), m_alternativeNick);
- ReplaceString(text, _T("%awaymsg"), m_statusMessage.c_str());
- ReplaceString(text, _T("%module"), _A2T(m_szModuleName));
- ReplaceString(text, _T("%name"), m_name);
- ReplaceString(text, _T("%newl"), _T("\r\n"));
- ReplaceString(text, _T("%network"), m_info.sNetwork.c_str());
- ReplaceString(text, _T("%me"), m_info.sNick.c_str());
+ text.Replace(_T("%mnick"), m_nick);
+ text.Replace(_T("%anick"), m_alternativeNick);
+ text.Replace(_T("%awaymsg"), m_statusMessage.c_str());
+ text.Replace(_T("%module"), _A2T(m_szModuleName));
+ text.Replace(_T("%name"), m_name);
+ text.Replace(_T("%newl"), _T("\r\n"));
+ text.Replace(_T("%network"), m_info.sNetwork.c_str());
+ text.Replace(_T("%me"), m_info.sNick.c_str());
char mirver[100];
CallService(MS_SYSTEM_GETVERSIONTEXT, SIZEOF(mirver), LPARAM(mirver));
- ReplaceString(text, _T("%mirver"), _A2T(mirver));
+ text.Replace(_T("%mirver"), _A2T(mirver));
- ReplaceString(text, _T("%version"), _T(__VERSION_STRING_DOTS));
+ text.Replace(_T("%version"), _T(__VERSION_STRING_DOTS));
str[0] = 3; str[1] = '\0';
- ReplaceString(text, _T("%color"), str);
+ text.Replace(_T("%color"), str);
str[0] = 2;
- ReplaceString(text, _T("%bold"), str);
+ text.Replace(_T("%bold"), str);
str[0] = 31;
- ReplaceString(text, _T("%underline"), str);
+ text.Replace(_T("%underline"), str);
str[0] = 22;
- ReplaceString(text, _T("%italics"), str);
+ text.Replace(_T("%italics"), str);
return text;
}
@@ -215,7 +215,7 @@ static void __stdcall sttSetTimerOff(void* _pro)
BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR* window, MCONTACT hContact)
{
TCHAR temp[30];
- lstrcpyn(temp, GetWord(text.c_str(), 0).c_str(), 29);
+ mir_tstrncpy(temp, GetWord(text.c_str(), 0).c_str(), 29);
CharLower(temp);
CMString command = temp;
CMString one = GetWord(text.c_str(), 1);
@@ -524,7 +524,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR* window, MCONTACT hConta
return true;
CMString S = _T("/ME ") + DoIdentifiers(GetWordAddress(text.c_str(), 1), window);
- ReplaceString(S, _T("%"), _T("%%"));
+ S.Replace(_T("%"), _T("%%"));
DoEvent(GC_EVENT_SENDMESSAGE, NULL, NULL, S.c_str(), NULL, NULL, NULL, FALSE, FALSE);
return true;
}
@@ -534,7 +534,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR* window, MCONTACT hConta
return true;
CMString S = DoIdentifiers(GetWordAddress(text.c_str(), 1), window);
- ReplaceString(S, _T("%"), _T("%%"));
+ S.Replace(_T("%"), _T("%%"));
DoEvent(GC_EVENT_SENDMESSAGE, NULL, NULL, S.c_str(), NULL, NULL, NULL, FALSE, FALSE);
return true;
}
@@ -793,7 +793,7 @@ static void __stdcall DoInputRequestAliasApcStub(void* _par)
bool CIrcProto::PostIrcMessage(const TCHAR* fmt, ...)
{
- if (!fmt || lstrlen(fmt) < 1 || lstrlen(fmt) > 4000)
+ if (!fmt || mir_tstrlen(fmt) < 1 || mir_tstrlen(fmt) > 4000)
return 0;
va_list marker;
@@ -814,17 +814,17 @@ bool CIrcProto::PostIrcMessageWnd(TCHAR* window, MCONTACT hContact, const TCHAR*
if (hContact)
bDCC = getByte(hContact, "DCC", 0);
- if (!IsConnected() && !bDCC || !szBuf || lstrlen(szBuf) < 1)
+ if (!IsConnected() && !bDCC || !szBuf || mir_tstrlen(szBuf) < 1)
return 0;
if (hContact && !getTString(hContact, "Nick", &dbv)) {
- lstrcpyn(windowname, dbv.ptszVal, 255);
+ mir_tstrncpy(windowname, dbv.ptszVal, 255);
db_free(&dbv);
}
else if (window)
- lstrcpyn(windowname, window, 255);
+ mir_tstrncpy(windowname, window, 255);
else
- lstrcpyn(windowname, SERVERWINDOW, 255);
+ mir_tstrncpy(windowname, SERVERWINDOW, 255);
if (lstrcmpi(window, SERVERWINDOW) != 0) {
TCHAR* p1 = _tcschr(windowname, ' ');
@@ -844,7 +844,7 @@ bool CIrcProto::PostIrcMessageWnd(TCHAR* window, MCONTACT hContact, const TCHAR*
return 1;
}
- ReplaceString(Message, _T("%newl"), _T("\r\n"));
+ Message.Replace(_T("%newl"), _T("\r\n"));
RemoveLinebreaks(Message);
}
diff --git a/protocols/IRCG/src/irc.h b/protocols/IRCG/src/irc.h
index b74ff0b710..68df80a0d8 100644
--- a/protocols/IRCG/src/irc.h
+++ b/protocols/IRCG/src/irc.h
@@ -98,7 +98,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define FILERESUME_CANCEL 11
struct CIrcProto;
-typedef CMStringA String;
// special service for tweaking performance, implemented in chat.dll
#define MS_GC_GETEVENTPTR "GChat/GetNewEventPtr"
@@ -121,7 +120,7 @@ struct IPRESOLVE // Contains info about the channels
~IPRESOLVE()
{}
- String sAddr;
+ CMStringA sAddr;
int iType;
};
@@ -158,7 +157,7 @@ struct PERFORM_INFO // Contains 'm_perform buffer' for different networks
~PERFORM_INFO()
{}
- String mSetting;
+ CMStringA mSetting;
CMString mText;
};
@@ -379,7 +378,7 @@ struct CIrcProto : public PROTO<CIrcProto>
CIgnorePrefsDlg* m_ignoreDlg;
int m_noOfChannels, m_manualWhoisCount;
- String sChannelModes, sUserModes;
+ CMStringA sChannelModes, sUserModes;
CMString sChannelPrefixes, sUserModePrefixes, WhoisAwayReply;
CDlgBase::CreateParam OptCreateAccount, OptCreateConn, OptCreateIgnore, OptCreateOther;
@@ -652,14 +651,12 @@ void ReleaseIconEx(HICON hIcon);
int __stdcall WCCmp(const TCHAR* wild, const TCHAR* string);
char* __stdcall IrcLoadFile(TCHAR * szPath);
CMString __stdcall GetWord(const TCHAR* text, int index);
-CMString& __stdcall ReplaceString (CMString& text, const TCHAR* replaceme, const TCHAR* newword);
const TCHAR* __stdcall GetWordAddress(const TCHAR* text, int index);
void __stdcall RemoveLinebreaks( CMString& Message );
TCHAR* __stdcall my_strstri(const TCHAR *s1, const TCHAR *s2) ;
TCHAR* __stdcall DoColorCodes (const TCHAR* text, bool bStrip, bool bReplacePercent);
-String& __stdcall ReplaceString (String& text, const char* replaceme, const char* newword);
-String __stdcall GetWord(const char* text, int index);
+CMStringA __stdcall GetWord(const char* text, int index);
#pragma comment(lib,"comctl32.lib")
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp
index cae41d4668..9cea32cdf6 100644
--- a/protocols/IRCG/src/irclib.cpp
+++ b/protocols/IRCG/src/irclib.cpp
@@ -279,7 +279,7 @@ int CIrcProto::NLSend(const unsigned char* buf, int cbBuf)
if (!con || !buf)
return 0;
if (m_scriptingEnabled && cbBuf == 0)
- cbBuf = lstrlenA((const char *)buf);
+ cbBuf = mir_strlen((const char *)buf);
return Netlib_Send(con, (const char*)buf, cbBuf, MSG_DUMPASTEXT);
}
@@ -702,7 +702,7 @@ unsigned long ConvertIPToInteger(char* IP)
IN_ADDR in;
IN_ADDR intemp;
- if (IP == 0 || lstrlenA(IP) == 0)
+ if (IP == 0 || mir_strlen(IP) == 0)
return 0;
intemp.S_un.S_addr = inet_addr(IP);
@@ -815,7 +815,7 @@ int CDccSession::NLReceive(const unsigned char* buf, int cbBuf)
int CDccSession::SendStuff(const TCHAR* fmt)
{
- String buf = _T2A(fmt, m_proto->getCodepage());
+ CMStringA buf = _T2A(fmt, m_proto->getCodepage());
return NLSend((const unsigned char*)buf.c_str(), buf.GetLength());
}
diff --git a/protocols/IRCG/src/irclib.h b/protocols/IRCG/src/irclib.h
index 4fc6c9bff5..043a83ca76 100644
--- a/protocols/IRCG/src/irclib.h
+++ b/protocols/IRCG/src/irclib.h
@@ -86,12 +86,12 @@ private :
struct CIrcSessionInfo
{
- String sServer;
+ CMStringA sServer;
CMString sServerName;
CMString sNick;
CMString sUserID;
CMString sFullName;
- String sPassword;
+ CMStringA sPassword;
CMString sIdentServerType;
CMString sNetwork;
bool bIdentServer;
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp
index 2cb0fda304..dfacc49281 100644
--- a/protocols/IRCG/src/ircproto.cpp
+++ b/protocols/IRCG/src/ircproto.cpp
@@ -166,11 +166,11 @@ static COLORREF crCols[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
static int sttCheckPerform(const char *szSetting, LPARAM lParam)
{
if (!_strnicmp(szSetting, "PERFORM:", 8)) {
- String s = szSetting;
+ CMStringA s = szSetting;
s.MakeUpper();
if (s != szSetting) {
- OBJLIST<String>* p = (OBJLIST<String>*)lParam;
- p->insert(new String(szSetting));
+ OBJLIST<CMStringA>* p = (OBJLIST<CMStringA>*)lParam;
+ p->insert(new CMStringA(szSetting));
}
}
return 0;
@@ -232,12 +232,12 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM)
while ((p1 = strstr(p2, "NETWORK: ")) != NULL) {
p1 += 9;
p2 = strchr(p1, '\n');
- String sNetwork(p1, int(p2 - p1 - 1));
+ CMStringA sNetwork(p1, int(p2 - p1 - 1));
sNetwork.MakeUpper();
p1 = p2;
p2 = strstr(++p1, "\nNETWORK: ");
if (!p2)
- p2 = p1 + lstrlenA(p1) - 1;
+ p2 = p1 + mir_strlen(p1) - 1;
if (p1 == p2)
break;
@@ -250,7 +250,7 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM)
mir_free(szLoadFileName);
if (!getByte("PerformConversionDone", 0)) {
- OBJLIST<String> performToConvert(10);
+ OBJLIST<CMStringA> performToConvert(10);
DBCONTACTENUMSETTINGS dbces = { 0 };
dbces.pfnEnumProc = sttCheckPerform;
dbces.lParam = (LPARAM)&performToConvert;
@@ -258,7 +258,7 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM)
CallService(MS_DB_CONTACT_ENUMSETTINGS, NULL, (LPARAM)&dbces);
for (int i = 0; i < performToConvert.getCount(); i++) {
- String s = performToConvert[i];
+ CMStringA s = performToConvert[i];
DBVARIANT dbv;
if (!getTString(s, &dbv)) {
db_unset(NULL, m_szModuleName, s);
@@ -278,16 +278,16 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM)
if (m_nick[0]) {
TCHAR szBuf[40];
- if (lstrlen(m_alternativeNick) == 0) {
+ if (mir_tstrlen(m_alternativeNick) == 0) {
mir_sntprintf(szBuf, SIZEOF(szBuf), _T("%s%u"), m_nick, rand() % 9999);
setTString("AlernativeNick", szBuf);
- lstrcpyn(m_alternativeNick, szBuf, 30);
+ mir_tstrncpy(m_alternativeNick, szBuf, 30);
}
- if (lstrlen(m_name) == 0) {
+ if (mir_tstrlen(m_name) == 0) {
mir_sntprintf(szBuf, SIZEOF(szBuf), _T("Miranda%u"), rand() % 9999);
setTString("Name", szBuf);
- lstrcpyn(m_name, szBuf, 200);
+ mir_tstrncpy(m_name, szBuf, 200);
}
}
@@ -532,7 +532,7 @@ HANDLE __cdecl CIrcProto::SearchBasic(const PROTOCHAR* szId)
if (m_iStatus != ID_STATUS_OFFLINE && m_iStatus != ID_STATUS_CONNECTING &&
szId && szId[0] && !IsChannel(szId)) {
AckBasicSearchParam* param = new AckBasicSearchParam;
- lstrcpyn(param->buf, szId, 50);
+ mir_tstrncpy(param->buf, szId, 50);
ForkThread(&CIrcProto::AckBasicSearch, param);
return (HANDLE)1;
}
@@ -685,7 +685,7 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const TCHAR*, TCHAR** ppsz
// need to make sure that %'s are doubled to avoid having chat interpret as color codes
CMString sFileCorrect = dci->sFile;
- ReplaceString(sFileCorrect, _T("%"), _T("%%"));
+ sFileCorrect.Replace(_T("%"), _T("%%"));
// is it an reverse filetransfer (receiver acts as server)
if (dci->bReverse) {
@@ -948,7 +948,7 @@ int __cdecl CIrcProto::SetAwayMsg(int status, const TCHAR* msg)
default:
CMString newStatus = msg;
- ReplaceString(newStatus, _T("\r\n"), _T(" "));
+ newStatus.Replace(_T("\r\n"), _T(" "));
if (m_statusMessage.IsEmpty() || msg == NULL || m_statusMessage != newStatus) {
if (msg == NULL || *msg == 0)
m_statusMessage = STR_AWAYMESSAGE;
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp
index ba57584a83..83e83cd725 100644
--- a/protocols/IRCG/src/options.cpp
+++ b/protocols/IRCG/src/options.cpp
@@ -76,7 +76,7 @@ void CIrcProto::ReadSettings(TDbSetting* sets, int count)
if (p->defStr == NULL)
*ptr = 0;
else
- lstrcpyn((TCHAR*)ptr, p->defStr, (int)p->size);
+ mir_tstrncpy((TCHAR*)ptr, p->defStr, (int)p->size);
}
else *(TCHAR**)ptr = mir_tstrdup(p->defStr);
}
@@ -133,14 +133,14 @@ static int sttServerEnum( const char* szSetting, LPARAM )
}
char* p2 = strchr(p1, ':');
pData->m_address = (char*)mir_alloc(p2 - p1 + 1);
- lstrcpynA(pData->m_address, p1, p2 - p1 + 1);
+ mir_strncpy(pData->m_address, p1, p2 - p1 + 1);
p1 = p2 + 1;
while (*p2 != 'G' && *p2 != '-')
p2++;
char* buf = (char*)alloca(p2 - p1 + 1);
- lstrcpynA(buf, p1, p2 - p1 + 1);
+ mir_strncpy(buf, p1, p2 - p1 + 1);
pData->m_portStart = atoi(buf);
if (*p2 == 'G')
@@ -149,14 +149,14 @@ static int sttServerEnum( const char* szSetting, LPARAM )
p1 = p2 + 1;
p2 = strchr(p1, 'G');
buf = (char*)alloca(p2 - p1 + 1);
- lstrcpynA(buf, p1, p2 - p1 + 1);
+ mir_strncpy(buf, p1, p2 - p1 + 1);
pData->m_portEnd = atoi(buf);
}
p1 = strchr(p2, ':') + 1;
p2 = strchr(p1, '\0');
pData->m_group = (char*)mir_alloc(p2 - p1 + 1);
- lstrcpynA(pData->m_group, p1, p2 - p1 + 1);
+ mir_strncpy(pData->m_group, p1, p2 - p1 + 1);
g_servers.insert(pData);
db_free(&dbv);
@@ -179,7 +179,7 @@ static void removeSpaces(TCHAR* p)
{
while (*p) {
if (*p == ' ')
- memmove(p, p + 1, sizeof(TCHAR)*lstrlen(p));
+ memmove(p, p + 1, sizeof(TCHAR)*mir_tstrlen(p));
p++;
}
}
@@ -762,9 +762,9 @@ void CConnectPrefsDlg::OnApply()
SERVER_INFO *pData = (SERVER_INFO*)m_serverCombo.GetItemData(i);
if (pData && (INT_PTR)pData != CB_ERR) {
if (m_enableServer.GetState())
- lstrcpyA(m_proto->m_network, pData->m_group);
+ mir_strcpy(m_proto->m_network, pData->m_group);
else
- lstrcpyA(m_proto->m_network, "");
+ mir_strcpy(m_proto->m_network, "");
m_proto->m_iSSL = pData->m_iSSL;
}
@@ -927,8 +927,8 @@ void CCtcpPrefsDlg::OnApply()
if (m_enableIP.GetState()) {
char szTemp[500];
m_ip.GetTextA(szTemp, sizeof(szTemp));
- lstrcpynA(m_proto->m_mySpecifiedHost, GetWord(szTemp, 0).c_str(), 499);
- if (lstrlenA(m_proto->m_mySpecifiedHost))
+ mir_strncpy(m_proto->m_mySpecifiedHost, GetWord(szTemp, 0).c_str(), 499);
+ if (mir_strlen(m_proto->m_mySpecifiedHost))
m_proto->ForkThread(&CIrcProto::ResolveIPThread, new IPRESOLVE(m_proto->m_mySpecifiedHost, IP_MANUAL));
}
else m_proto->m_mySpecifiedHost[0] = 0;
@@ -1193,7 +1193,7 @@ void COtherPrefsDlg::OnApply()
void COtherPrefsDlg::addPerformComboValue(int idx, const char* szValueName)
{
- String sSetting = String("PERFORM:") + szValueName;
+ CMStringA sSetting = CMStringA("PERFORM:") + szValueName;
sSetting.MakeUpper();
PERFORM_INFO* pPref;
@@ -1357,9 +1357,9 @@ void CIrcProto::InitIgnore(void)
pTemp--;
*++pTemp = 0;
- String mask = GetWord(p1, 0);
- String flags = GetWord(p1, 1);
- String network = GetWord(p1, 2);
+ CMStringA mask = GetWord(p1, 0);
+ CMStringA flags = GetWord(p1, 1);
+ CMStringA network = GetWord(p1, 2);
if (!mask.IsEmpty())
m_ignoreItems.insert(new CIrcIgnoreItem(getCodepage(), mask.c_str(), flags.c_str(), network.c_str()));
@@ -1892,7 +1892,7 @@ void InitServers()
if (serverFile) {
char* pszSvrs = (char*)LockResource(LoadResource(hInst, FindResource(hInst, MAKEINTRESOURCE(IDR_SERVERS), _T("TEXT"))));
if (pszSvrs)
- fwrite(pszSvrs, 1, lstrlenA(pszSvrs) + 1, serverFile);
+ fwrite(pszSvrs, 1, mir_strlen(pszSvrs) + 1, serverFile);
fclose(serverFile);
sttImportIni(szIniFile);
diff --git a/protocols/IRCG/src/output.cpp b/protocols/IRCG/src/output.cpp
index c67d884aaf..69a3c69335 100644
--- a/protocols/IRCG/src/output.cpp
+++ b/protocols/IRCG/src/output.cpp
@@ -134,7 +134,7 @@ BOOL CIrcProto::ShowMessage(const CIrcMessage* pmsg)
CMString mess = FormatOutput(pmsg);
if (!pmsg->m_bIncoming)
- ReplaceString(mess, _T("%%"), _T("%"));
+ mess.Replace(_T("%%"), _T("%"));
int iTemp = StrToInt(pmsg->sCommand.c_str());
diff --git a/protocols/IRCG/src/scripting.cpp b/protocols/IRCG/src/scripting.cpp
index 484a2b6739..3f2b63b4a6 100644
--- a/protocols/IRCG/src/scripting.cpp
+++ b/protocols/IRCG/src/scripting.cpp
@@ -39,9 +39,9 @@ INT_PTR __cdecl CIrcProto::Scripting_InsertRawOut( WPARAM, LPARAM lParam )
{
char* pszRaw = (char*)lParam;
if (m_scriptingEnabled && pszRaw && IsConnected()) {
- String S = pszRaw;
- ReplaceString(S, "%", "%%%%");
- NLSendNoScript((const unsigned char *)S.c_str(), lstrlenA(S.c_str()));
+ CMStringA S = pszRaw;
+ S.Replace("%", "%%%%");
+ NLSendNoScript((const unsigned char *)S.c_str(), (int)mir_strlen(S.c_str()));
return 0;
}
@@ -110,7 +110,7 @@ INT_PTR __cdecl CIrcProto::Scripting_InsertGuiOut(WPARAM, LPARAM lParam)
INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam)
{
if (m_scriptingEnabled && lparam) {
- String sString = (char*)lparam, sRequest;
+ CMStringA sString = (char*)lparam, sRequest;
CMString sOutput, sChannel;
int i = sString.Find("|");
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp
index 7579f1775e..b7a9f14381 100644
--- a/protocols/IRCG/src/services.cpp
+++ b/protocols/IRCG/src/services.cpp
@@ -328,7 +328,7 @@ INT_PTR __cdecl CIrcProto::OnMenuIgnore(WPARAM wp, LPARAM)
host = dbv1.pszVal;
if (host) {
- String S;
+ CMStringA S;
if (m_ignoreChannelDefault)
S = "+qnidcm";
else
@@ -421,47 +421,47 @@ static void DoChatFormatting(TCHAR* pszText)
switch (p1[1]) {
case 'B':
case 'b':
- lstrcpy(InsertThis, _T("\002"));
+ mir_tstrcpy(InsertThis, _T("\002"));
iRemoveChars = 2;
break;
case 'I':
case 'i':
- lstrcpy(InsertThis, _T("\026"));
+ mir_tstrcpy(InsertThis, _T("\026"));
iRemoveChars = 2;
break;
case 'U':
case 'u':
- lstrcpy(InsertThis, _T("\037"));
+ mir_tstrcpy(InsertThis, _T("\037"));
iRemoveChars = 2;
break;
case 'c':
{
- lstrcpy(InsertThis, _T("\003"));
+ mir_tstrcpy(InsertThis, _T("\003"));
iRemoveChars = 2;
TCHAR szTemp[3];
- lstrcpyn(szTemp, p1 + 2, 3);
+ mir_tstrncpy(szTemp, p1 + 2, 3);
iFG = _ttoi(szTemp);
}
break;
case 'C':
if (p1[2] == '%' && p1[3] == 'F') {
- lstrcpy(InsertThis, _T("\00399,99"));
+ mir_tstrcpy(InsertThis, _T("\00399,99"));
iRemoveChars = 4;
}
else {
- lstrcpy(InsertThis, _T("\00399"));
+ mir_tstrcpy(InsertThis, _T("\00399"));
iRemoveChars = 2;
}
iFG = -1;
break;
case 'f':
if (p1 - 3 >= pszText && p1[-3] == '\003')
- lstrcpy(InsertThis, _T(","));
+ mir_tstrcpy(InsertThis, _T(","));
else if (iFG >= 0)
mir_sntprintf(InsertThis, SIZEOF(InsertThis), _T("\003%u,"), iFG);
else
- lstrcpy(InsertThis, _T("\00399,"));
+ mir_tstrcpy(InsertThis, _T("\00399,"));
iRemoveChars = 2;
break;
@@ -470,12 +470,12 @@ static void DoChatFormatting(TCHAR* pszText)
if (iFG >= 0)
mir_sntprintf(InsertThis, SIZEOF(InsertThis), _T("\003%u,99"), iFG);
else
- lstrcpy(InsertThis, _T("\00399,99"));
+ mir_tstrcpy(InsertThis, _T("\00399,99"));
iRemoveChars = 2;
break;
case '%':
- lstrcpy(InsertThis, _T("%"));
+ mir_tstrcpy(InsertThis, _T("%"));
iRemoveChars = 2;
break;
@@ -484,10 +484,10 @@ static void DoChatFormatting(TCHAR* pszText)
break;
}
- MoveMemory(p1 + lstrlen(InsertThis), p1 + iRemoveChars, sizeof(TCHAR)*(lstrlen(p1) - iRemoveChars + 1));
- CopyMemory(p1, InsertThis, sizeof(TCHAR)*lstrlen(InsertThis));
- if (iRemoveChars || lstrlen(InsertThis))
- p1 += lstrlen(InsertThis);
+ MoveMemory(p1 + mir_tstrlen(InsertThis), p1 + iRemoveChars, sizeof(TCHAR)*(mir_tstrlen(p1) - iRemoveChars + 1));
+ CopyMemory(p1, InsertThis, sizeof(TCHAR)*mir_tstrlen(InsertThis));
+ if (iRemoveChars || mir_tstrlen(InsertThis))
+ p1 += mir_tstrlen(InsertThis);
else
p1++;
}
@@ -517,8 +517,8 @@ int __cdecl CIrcProto::GCEventHook(WPARAM wParam, LPARAM lParam)
case GC_USER_MESSAGE:
if (gch && gch->ptszText && *gch->ptszText) {
- TCHAR* pszText = new TCHAR[lstrlen(gch->ptszText) + 1000];
- lstrcpy(pszText, gch->ptszText);
+ TCHAR* pszText = new TCHAR[mir_tstrlen(gch->ptszText) + 1000];
+ mir_tstrcpy(pszText, gch->ptszText);
DoChatFormatting(pszText);
PostIrcMessageWnd(p1, NULL, pszText);
delete[]pszText;
@@ -877,8 +877,8 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam)
TCHAR stzChanName[100];
const TCHAR* temp = _tcschr(gcmi->pszID, ' ');
- int len = min(((temp == NULL) ? lstrlen(gcmi->pszID) : (int)(temp - gcmi->pszID + 1)), SIZEOF(stzChanName) - 1);
- lstrcpyn(stzChanName, gcmi->pszID, len);
+ size_t len = min(((temp == NULL) ? mir_tstrlen(gcmi->pszID) : (int)(temp - gcmi->pszID + 1)), SIZEOF(stzChanName) - 1);
+ mir_tstrncpy(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;
diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp
index 8046eebf0d..30c1e217f2 100644
--- a/protocols/IRCG/src/tools.cpp
+++ b/protocols/IRCG/src/tools.cpp
@@ -84,7 +84,7 @@ CMString __stdcall GetWord(const TCHAR* text, int index)
const TCHAR* __stdcall GetWordAddress(const TCHAR* text, int index)
{
- if (!text || !lstrlen(text))
+ if (!text || !mir_tstrlen(text))
return text;
const TCHAR* temp = text;
@@ -108,10 +108,10 @@ const TCHAR* __stdcall GetWordAddress(const TCHAR* text, int index)
return temp;
}
-void __stdcall RemoveLinebreaks(CMString& Message)
+void __stdcall RemoveLinebreaks(CMString &Message)
{
while (Message.Find(_T("\r\n\r\n"), 0) != -1)
- ReplaceString(Message, _T("\r\n\r\n"), _T("\r\n"));
+ Message.Replace(_T("\r\n\r\n"), _T("\r\n"));
if (Message.Find(_T("\r\n"), 0) == 0)
Message.Delete(0, 2);
@@ -120,34 +120,6 @@ void __stdcall RemoveLinebreaks(CMString& Message)
Message.Delete(Message.GetLength() - 2, 2);
}
-String& __stdcall ReplaceString(String& text, const char* replaceme, const char* newword)
-{
- if (!text.IsEmpty() && replaceme != NULL) {
- int i = 0;
- while ((i = text.Find(replaceme, i)) != -1) {
- text.Delete(i, lstrlenA(replaceme));
- text.Insert(i, newword);
- i = i + lstrlenA(newword);
- }
- }
-
- return text;
-}
-
-CMString& __stdcall ReplaceString(CMString& text, const TCHAR* replaceme, const TCHAR* newword)
-{
- if (!text.IsEmpty() && replaceme != NULL) {
- int i = 0;
- while ((i = text.Find(replaceme, i)) != -1) {
- text.Delete(i, lstrlen(replaceme));
- text.Insert(i, newword);
- i = i + lstrlen(newword);
- }
- }
-
- return text;
-}
-
char* __stdcall IrcLoadFile(TCHAR* szPath)
{
char * szContainer = NULL;
@@ -169,7 +141,7 @@ char* __stdcall IrcLoadFile(TCHAR* szPath)
int __stdcall WCCmp(const TCHAR* wild, const TCHAR* string)
{
- if (wild == NULL || !lstrlen(wild) || string == NULL || !lstrlen(string))
+ if (wild == NULL || !mir_tstrlen(wild) || string == NULL || !mir_tstrlen(string))
return 1;
const TCHAR *cp = NULL, *mp = NULL;
@@ -210,7 +182,7 @@ bool CIrcProto::IsChannel(const TCHAR* sName)
return (sChannelPrefixes.Find(sName[0]) != -1);
}
-String __stdcall GetWord(const char* text, int index)
+CMStringA __stdcall GetWord(const char* text, int index)
{
if (text && text[0]) {
char* p1 = (char*)text;
@@ -236,11 +208,11 @@ String __stdcall GetWord(const char* text, int index)
p2 = strchr(p1, '\0');
if (p1 != p2)
- return String(p1, p2 - p1 + 1);
+ return CMStringA(p1, p2 - p1 + 1);
}
}
- return String();
+ return CMStringA();
}
bool CIrcProto::IsChannel(const char* sName)
@@ -337,10 +309,10 @@ TCHAR* __stdcall DoColorCodes(const TCHAR* text, bool bStrip, bool bReplacePerce
// fix foreground index
if (text[1] > 47 && text[1] < 58 && text[1] != '\0')
- lstrcpyn(buf, text, 3);
+ mir_tstrncpy(buf, text, 3);
else
- lstrcpyn(buf, text, 2);
- text += lstrlen(buf);
+ mir_tstrncpy(buf, text, 2);
+ text += mir_tstrlen(buf);
iFG = _ttoi(buf);
// fix background color
@@ -348,10 +320,10 @@ TCHAR* __stdcall DoColorCodes(const TCHAR* text, bool bStrip, bool bReplacePerce
text++;
if (text[1] > 47 && text[1] < 58 && text[1] != '\0')
- lstrcpyn(buf, text, 3);
+ mir_tstrncpy(buf, text, 3);
else
- lstrcpyn(buf, text, 2);
- text += lstrlen(buf);
+ mir_tstrncpy(buf, text, 2);
+ text += mir_tstrlen(buf);
iBG = _ttoi(buf);
}
}
@@ -603,20 +575,20 @@ bool CIrcProto::AddWindowItemData(CMString window, const TCHAR* pszLimit, const
CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, window.c_str(), NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
if (wi) {
if (pszLimit) {
- wi->pszLimit = (TCHAR*)realloc(wi->pszLimit, sizeof(TCHAR)*(lstrlen(pszLimit) + 1));
- lstrcpy(wi->pszLimit, pszLimit);
+ wi->pszLimit = (TCHAR*)realloc(wi->pszLimit, sizeof(TCHAR)*(mir_tstrlen(pszLimit) + 1));
+ mir_tstrcpy(wi->pszLimit, pszLimit);
}
if (pszMode) {
- wi->pszMode = (TCHAR*)realloc(wi->pszMode, sizeof(TCHAR)*(lstrlen(pszMode) + 1));
- lstrcpy(wi->pszMode, pszMode);
+ wi->pszMode = (TCHAR*)realloc(wi->pszMode, sizeof(TCHAR)*(mir_tstrlen(pszMode) + 1));
+ mir_tstrcpy(wi->pszMode, pszMode);
}
if (pszPassword) {
- wi->pszPassword = (TCHAR*)realloc(wi->pszPassword, sizeof(TCHAR)*(lstrlen(pszPassword) + 1));
- lstrcpy(wi->pszPassword, pszPassword);
+ wi->pszPassword = (TCHAR*)realloc(wi->pszPassword, sizeof(TCHAR)*(mir_tstrlen(pszPassword) + 1));
+ mir_tstrcpy(wi->pszPassword, pszPassword);
}
if (pszTopic) {
- wi->pszTopic = (TCHAR*)realloc(wi->pszTopic, sizeof(TCHAR)*(lstrlen(pszTopic) + 1));
- lstrcpy(wi->pszTopic, pszTopic);
+ wi->pszTopic = (TCHAR*)realloc(wi->pszTopic, sizeof(TCHAR)*(mir_tstrlen(pszTopic) + 1));
+ mir_tstrcpy(wi->pszTopic, pszTopic);
}
SetChannelSBText(window, wi);
@@ -633,7 +605,7 @@ void CIrcProto::FindLocalIP(HANDLE con) // inspiration from jabber
struct sockaddr_in saddr;
int len = sizeof(saddr);
getsockname(socket, (struct sockaddr *) &saddr, &len);
- lstrcpynA(m_myLocalHost, inet_ntoa(saddr.sin_addr), 49);
+ mir_strncpy(m_myLocalHost, inet_ntoa(saddr.sin_addr), 49);
m_myLocalPort = ntohs(saddr.sin_port);
}
}
diff --git a/protocols/IRCG/src/ui_utils.cpp b/protocols/IRCG/src/ui_utils.cpp
index e02ab4ed5f..daaa364a14 100644
--- a/protocols/IRCG/src/ui_utils.cpp
+++ b/protocols/IRCG/src/ui_utils.cpp
@@ -314,7 +314,7 @@ TCHAR* CCtrlCombo::GetItemText(int index, TCHAR *buf, int size)
{
TCHAR *result = (TCHAR *)_alloca(sizeof(TCHAR) * (SendMessage(m_hwnd, CB_GETLBTEXTLEN, index, 0) + 1));
SendMessage(m_hwnd, CB_GETLBTEXT, index, (LPARAM)result);
- lstrcpyn(buf, result, size);
+ mir_tstrncpy(buf, result, size);
return buf;
}
@@ -402,7 +402,7 @@ TCHAR* CCtrlListBox::GetItemText(int index, TCHAR *buf, int size)
{
TCHAR *result = (TCHAR *)_alloca(sizeof(TCHAR) * (SendMessage(m_hwnd, LB_GETTEXTLEN, index, 0) + 1));
SendMessage(m_hwnd, LB_GETTEXT, index, (LPARAM)result);
- lstrcpyn(buf, result, size);
+ mir_tstrncpy(buf, result, size);
return buf;
}
diff --git a/protocols/IRCG/src/userinfo.cpp b/protocols/IRCG/src/userinfo.cpp
index 38ea133fb6..c5389d8607 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 += _T(" (");
S += dbv.ptszVal;
S += _T(")");
- if ((lstrlen(temp) < 4 && lstrlen(temp)) || !WCCmp(CharLower(temp), CharLower(dbv.ptszVal))) {
+ if ((mir_tstrlen(temp) < 4 && mir_tstrlen(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, SIZEOF(temp));
- if (lstrlen(GetWord(temp, 0).c_str()))
+ if (mir_tstrlen(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, SIZEOF(temp));
- if (lstrlen(GetWord(temp, 0).c_str()))
+ if (mir_tstrlen(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, SIZEOF(temp));
- if (lstrlen(GetWord(temp, 0).c_str()))
+ if (mir_tstrlen(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 52b9d32726..0e48fc7432 100644
--- a/protocols/IRCG/src/windows.cpp
+++ b/protocols/IRCG/src/windows.cpp
@@ -282,10 +282,10 @@ void CListDlg::OnInitDialog()
lvC.cx = COLUMNS_SIZES[index];
switch (index) {
- case 0: lstrcpy(szBuffer, TranslateT("Channel")); break;
- case 1: lstrcpy(szBuffer, _T("#")); break;
- case 2: lstrcpy(szBuffer, TranslateT("Mode")); break;
- case 3: lstrcpy(szBuffer, TranslateT("Topic")); break;
+ case 0: mir_tstrcpy(szBuffer, TranslateT("Channel")); break;
+ case 1: mir_tstrcpy(szBuffer, _T("#")); break;
+ case 2: mir_tstrcpy(szBuffer, TranslateT("Mode")); break;
+ case 3: mir_tstrcpy(szBuffer, TranslateT("Topic")); break;
}
lvC.pszText = szBuffer;
m_list.InsertColumn(index, &lvC);
@@ -433,7 +433,7 @@ static int CALLBACK ListViewSort(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSo
lvm.pszText = temp2;
param->pList->GetItem(&lvm);
if (param->iSubItem != 1) {
- if (lstrlen(temp1) != 0 && lstrlen(temp2) != 0)
+ if (mir_tstrlen(temp1) != 0 && mir_tstrlen(temp2) != 0)
return lstrcmpi(temp1, temp2);
return (*temp1 == 0) ? 1 : -1;
@@ -511,7 +511,7 @@ void CJoinDlg::OnInitDialog()
for (int i = 0; i < 20; i++) {
if (!GetWord(dbv.ptszVal, i).IsEmpty()) {
CMString S = GetWord(dbv.ptszVal, i);
- ReplaceString(S, _T("%newl"), _T(" "));
+ S.Replace(_T("%newl"), _T(" "));
SendDlgItemMessage(m_hwnd, IDC_ENICK, CB_ADDSTRING, 0, (LPARAM)S.c_str());
}
}
@@ -535,7 +535,7 @@ void CJoinDlg::OnOk(CCtrlButton*)
m_proto->PostIrcMessage(_T("/JOIN #%s"), szTemp);
CMString S = szTemp;
- ReplaceString(S, _T(" "), _T("%newl"));
+ S.Replace(_T(" "), _T("%newl"));
CMString SL = S;
DBVARIANT dbv;
@@ -626,7 +626,7 @@ void CQuickDlg::OnOk(CCtrlButton*)
int i = m_serverCombo.GetCurSel();
SERVER_INFO* pData = (SERVER_INFO*)m_serverCombo.GetItemData(i);
if (pData && (INT_PTR)pData != CB_ERR) {
- lstrcpyA(m_proto->m_network, pData->m_group);
+ mir_strcpy(m_proto->m_network, pData->m_group);
pData->m_iSSL = 0;
if (IsDlgButtonChecked(m_hwnd, IDC_SSL_ON))
pData->m_iSSL = 2;
@@ -761,7 +761,7 @@ void CQuestionDlg::OnOk(CCtrlButton*)
TCHAR* n = (TCHAR*)alloca(sizeof(TCHAR)*(j + 2));
GetDlgItemText(m_hwnd, IDC_HIDDENEDIT, n, j + 1);
CMString S(n);
- ReplaceString(S, text, l);
+ S.Replace(text, l);
m_proto->PostIrcMessageWnd(NULL, NULL, (TCHAR*)S.c_str());
delete[]m;
@@ -919,7 +919,7 @@ void CManagerDlg::OnClose()
CMString S1 = temp;
/* FIXME: What the hell does it mean!? GCC won't compile this on UNICODE */
#if !defined(__GNUC__) || !defined(UNICODE)
- ReplaceString(S1, _T(" "), _T("%¤"));
+ S1.Replace(_T(" "), _T("%¤"));
#endif
S += _T(" ") + S1;
}
@@ -945,16 +945,16 @@ void CManagerDlg::OnAdd(CCtrlButton*)
TCHAR temp[100];
TCHAR mode[3];
if (m_radio1.GetState()) {
- lstrcpy(mode, _T("+b"));
- lstrcpyn(temp, TranslateT("Add ban"), 100);
+ mir_tstrcpy(mode, _T("+b"));
+ mir_tstrncpy(temp, TranslateT("Add ban"), 100);
}
if (m_radio2.GetState()) {
- lstrcpy(mode, _T("+I"));
- lstrcpyn(temp, TranslateT("Add invite"), 100);
+ mir_tstrcpy(mode, _T("+I"));
+ mir_tstrncpy(temp, TranslateT("Add invite"), 100);
}
if (m_radio3.GetState()) {
- lstrcpy(mode, _T("+e"));
- lstrcpyn(temp, TranslateT("Add exception"), 100);
+ mir_tstrcpy(mode, _T("+e"));
+ mir_tstrncpy(temp, TranslateT("Add exception"), 100);
}
m_add.Disable();
@@ -987,16 +987,16 @@ void CManagerDlg::OnEdit(CCtrlButton*)
TCHAR temp[100];
TCHAR mode[3];
if (m_radio1.GetState()) {
- lstrcpy(mode, _T("b"));
- lstrcpyn(temp, TranslateT("Edit ban"), 100);
+ mir_tstrcpy(mode, _T("b"));
+ mir_tstrncpy(temp, TranslateT("Edit ban"), 100);
}
if (m_radio2.GetState()) {
- lstrcpy(mode, _T("I"));
- lstrcpyn(temp, TranslateT("Edit invite?"), 100);
+ mir_tstrcpy(mode, _T("I"));
+ mir_tstrncpy(temp, TranslateT("Edit invite?"), 100);
}
if (m_radio3.GetState()) {
- lstrcpy(mode, _T("e"));
- lstrcpyn(temp, TranslateT("Edit exception?"), 100);
+ mir_tstrcpy(mode, _T("e"));
+ mir_tstrncpy(temp, TranslateT("Edit exception?"), 100);
}
CQuestionDlg* dlg = new CQuestionDlg(m_proto, this);
@@ -1033,16 +1033,16 @@ void CManagerDlg::OnRemove(CCtrlButton*)
CMString user = GetWord(m, 0);
if (m_radio1.GetState()) {
- lstrcpy(mode, _T("-b"));
- lstrcpyn(temp, TranslateT("Remove ban?"), 100);
+ mir_tstrcpy(mode, _T("-b"));
+ mir_tstrncpy(temp, TranslateT("Remove ban?"), 100);
}
if (m_radio2.GetState()) {
- lstrcpy(mode, _T("-I"));
- lstrcpyn(temp, TranslateT("Remove invite?"), 100);
+ mir_tstrcpy(mode, _T("-I"));
+ mir_tstrncpy(temp, TranslateT("Remove invite?"), 100);
}
if (m_radio3.GetState()) {
- lstrcpy(mode, _T("-e"));
- lstrcpyn(temp, TranslateT("Remove exception?"), 100);
+ mir_tstrcpy(mode, _T("-e"));
+ mir_tstrncpy(temp, TranslateT("Remove exception?"), 100);
}
TCHAR window[256];
@@ -1090,58 +1090,58 @@ void CManagerDlg::OnApplyModes(CCtrlButton*)
CMString appendixremove = _T("");
if (wi->pszMode && _tcschr(wi->pszMode, 't')) {
if (!m_check1.GetState())
- lstrcat(toremove, _T("t"));
+ mir_tstrcat(toremove, _T("t"));
}
else if (m_check1.GetState())
- lstrcat(toadd, _T("t"));
+ mir_tstrcat(toadd, _T("t"));
if (wi->pszMode && _tcschr(wi->pszMode, 'n')) {
if (!m_check2.GetState())
- lstrcat(toremove, _T("n"));
+ mir_tstrcat(toremove, _T("n"));
}
else if (m_check2.GetState())
- lstrcat(toadd, _T("n"));
+ mir_tstrcat(toadd, _T("n"));
if (wi->pszMode && _tcschr(wi->pszMode, 'i')) {
if (!m_check3.GetState())
- lstrcat(toremove, _T("i"));
+ mir_tstrcat(toremove, _T("i"));
}
else if (m_check3.GetState())
- lstrcat(toadd, _T("i"));
+ mir_tstrcat(toadd, _T("i"));
if (wi->pszMode && _tcschr(wi->pszMode, 'm')) {
if (!m_check4.GetState())
- lstrcat(toremove, _T("m"));
+ mir_tstrcat(toremove, _T("m"));
}
else if (m_check4.GetState())
- lstrcat(toadd, _T("m"));
+ mir_tstrcat(toadd, _T("m"));
if (wi->pszMode && _tcschr(wi->pszMode, 'p')) {
if (!m_check7.GetState())
- lstrcat(toremove, _T("p"));
+ mir_tstrcat(toremove, _T("p"));
}
else if (m_check7.GetState())
- lstrcat(toadd, _T("p"));
+ mir_tstrcat(toadd, _T("p"));
if (wi->pszMode && _tcschr(wi->pszMode, 's')) {
if (!m_check8.GetState())
- lstrcat(toremove, _T("s"));
+ mir_tstrcat(toremove, _T("s"));
}
else if (m_check8.GetState())
- lstrcat(toadd, _T("s"));
+ mir_tstrcat(toadd, _T("s"));
if (wi->pszMode && _tcschr(wi->pszMode, 'c')) {
if (!m_check9.GetState())
- lstrcat(toremove, _T("c"));
+ mir_tstrcat(toremove, _T("c"));
}
else if (m_check9.GetState())
- lstrcat(toadd, _T("c"));
+ mir_tstrcat(toadd, _T("c"));
CMString Key = _T("");
CMString Limit = _T("");
if (wi->pszMode && wi->pszPassword && _tcschr(wi->pszMode, 'k')) {
if (!m_check5.GetState()) {
- lstrcat(toremove, _T("k"));
+ mir_tstrcat(toremove, _T("k"));
appendixremove += _T(" ") + CMString(wi->pszPassword);
}
else if (GetWindowTextLength(m_key.GetHwnd())) {
@@ -1149,15 +1149,15 @@ void CManagerDlg::OnApplyModes(CCtrlButton*)
m_key.GetText(temp, 14);
if (Key != temp) {
- lstrcat(toremove, _T("k"));
- lstrcat(toadd, _T("k"));
+ mir_tstrcat(toremove, _T("k"));
+ mir_tstrcat(toadd, _T("k"));
appendixadd += _T(" ") + CMString(temp);
appendixremove += _T(" ") + CMString(wi->pszPassword);
}
}
}
else if (m_check5.GetState() && GetWindowTextLength(m_key.GetHwnd())) {
- lstrcat(toadd, _T("k"));
+ mir_tstrcat(toadd, _T("k"));
appendixadd += _T(" ");
TCHAR temp[400];
@@ -1167,18 +1167,18 @@ void CManagerDlg::OnApplyModes(CCtrlButton*)
if (_tcschr(wi->pszMode, 'l')) {
if (!m_check6.GetState())
- lstrcat(toremove, _T("l"));
+ mir_tstrcat(toremove, _T("l"));
else if (GetWindowTextLength(GetDlgItem(m_hwnd, IDC_LIMIT))) {
TCHAR temp[15];
GetDlgItemText(m_hwnd, IDC_LIMIT, temp, SIZEOF(temp));
if (wi->pszLimit && lstrcmpi(wi->pszLimit, temp)) {
- lstrcat(toadd, _T("l"));
+ mir_tstrcat(toadd, _T("l"));
appendixadd += _T(" ") + CMString(temp);
}
}
}
else if (m_check6.GetState() && GetWindowTextLength(m_limit.GetHwnd())) {
- lstrcat(toadd, _T("l"));
+ mir_tstrcat(toadd, _T("l"));
appendixadd += _T(" ");
TCHAR temp[15];
@@ -1186,19 +1186,19 @@ void CManagerDlg::OnApplyModes(CCtrlButton*)
appendixadd += temp;
}
- if (lstrlen(toadd) || lstrlen(toremove)) {
+ if (mir_tstrlen(toadd) || mir_tstrlen(toremove)) {
TCHAR temp[500];
- lstrcpy(temp, _T("/mode "));
- lstrcat(temp, window);
- lstrcat(temp, _T(" "));
- if (lstrlen(toremove))
+ mir_tstrcpy(temp, _T("/mode "));
+ mir_tstrcat(temp, window);
+ mir_tstrcat(temp, _T(" "));
+ if (mir_tstrlen(toremove))
mir_sntprintf(temp, 499, _T("%s-%s"), temp, toremove);
- if (lstrlen(toadd))
+ if (mir_tstrlen(toadd))
mir_sntprintf(temp, 499, _T("%s+%s"), temp, toadd);
if (!appendixremove.IsEmpty())
- lstrcat(temp, appendixremove.c_str());
+ mir_tstrcat(temp, appendixremove.c_str());
if (!appendixadd.IsEmpty())
- lstrcat(temp, appendixadd.c_str());
+ mir_tstrcat(temp, appendixadd.c_str());
m_proto->PostIrcMessage(temp);
}
}
@@ -1249,11 +1249,11 @@ void CManagerDlg::ApplyQuestion()
GetDlgItemText(m_hwnd, IDC_CAPTION, window, SIZEOF(window));
TCHAR mode[3];
- lstrcpy(mode, _T("+b"));
+ mir_tstrcpy(mode, _T("+b"));
if (m_radio2.GetState())
- lstrcpy(mode, _T("+I"));
+ mir_tstrcpy(mode, _T("+I"));
if (m_radio3.GetState())
- lstrcpy(mode, _T("+e"));
+ mir_tstrcpy(mode, _T("+e"));
m_list.ResetContent();
m_radio1.Disable();
m_radio2.Disable();
@@ -1292,7 +1292,7 @@ void CManagerDlg::InitManager(int mode, const TCHAR* window)
if (!S.IsEmpty()) {
/* FIXME: What the hell does it mean!? GCC won't compile this on UNICODE */
#if !defined(__GNUC__) || !defined(UNICODE)
- ReplaceString(S, _T("%¤"), _T(" "));
+ S.Replace(_T("%¤"), _T(" "));
#endif
m_topic.SendMsg(CB_ADDSTRING, 0, (LPARAM)S.c_str());
}
diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp
index 048195df0b..1dbc41d834 100644
--- a/protocols/IcqOscarJ/src/icq_avatar.cpp
+++ b/protocols/IcqOscarJ/src/icq_avatar.cpp
@@ -1223,7 +1223,7 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, size_t wBufferLen
PROTO_AVATAR_INFORMATIONT ai = { sizeof(ai) };
ai.format = PA_FORMAT_JPEG; // this is for error only
ai.hContact = pCookieData->hContact;
- lstrcpyn(ai.filename, pCookieData->szFile, SIZEOF(ai.filename));
+ mir_tstrncpy(ai.filename, pCookieData->szFile, SIZEOF(ai.filename));
AddAvatarExt(PA_FORMAT_JPEG, ai.filename);
ppro->FreeCookie(pSnacHeader->dwRef);
@@ -1280,7 +1280,7 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, size_t wBufferLen
ppro->setByte(pCookieData->hContact, "AvatarType", (BYTE)dwPaFormat);
ai.format = dwPaFormat; // set the format
- lstrcpyn(ai.filename, tszImageFile, SIZEOF(ai.filename));
+ mir_tstrncpy(ai.filename, tszImageFile, SIZEOF(ai.filename));
int out = _topen(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 e66aedc990..b357356640 100644
--- a/protocols/IcqOscarJ/src/icq_filerequests.cpp
+++ b/protocols/IcqOscarJ/src/icq_filerequests.cpp
@@ -80,12 +80,10 @@ void CIcqProto::handleFileAck(PBYTE buf, size_t wLen, DWORD dwUin, DWORD dwCooki
unpackString(&buf, pszFileName, wFilenameLength);
pszFileName[wFilenameLength] = '\0';
}
- wLen = wLen - 2 - wFilenameLength;
+ wLen -= wFilenameLength+2;
- if (wLen >= 4) { // Total filesize
+ if (wLen >= 4)
unpackLEDWord(&buf, &dwFileSize);
- wLen -= 4;
- }
else
dwFileSize = 0;
@@ -111,7 +109,7 @@ filetransfer* CIcqProto::CreateFileTransfer(MCONTACT hContact, DWORD dwUin, int
// pszDescription points to a string with the reason
// buf points to the first data after the string
-void CIcqProto::handleFileRequest(PBYTE buf, size_t wLen, DWORD dwUin, DWORD dwCookie, DWORD dwID1, DWORD dwID2, char* pszDescription, int nVersion, BOOL bDC)
+void CIcqProto::handleFileRequest(PBYTE buf, size_t cbLen, DWORD dwUin, DWORD dwCookie, DWORD dwID1, DWORD dwID2, char* pszDescription, int nVersion, BOOL bDC)
{
BOOL bEmptyDesc = FALSE;
if (mir_strlen(pszDescription) == 0) {
@@ -121,7 +119,6 @@ void CIcqProto::handleFileRequest(PBYTE buf, size_t wLen, DWORD dwUin, DWORD dwC
// Empty port+pad
buf += 4;
- wLen -= 4;
// Filename
size_t wFilenameLength;
@@ -135,12 +132,9 @@ void CIcqProto::handleFileRequest(PBYTE buf, size_t wLen, DWORD dwUin, DWORD dwC
unpackString(&buf, pszFileName, wFilenameLength);
pszFileName[wFilenameLength] = '\0';
- wLen = wLen - 2 - wFilenameLength;
-
// Total filesize
DWORD dwFileSize;
unpackLEDWord(&buf, &dwFileSize);
- wLen -= 4;
int bAdded;
MCONTACT hContact = HContactFromUIN(dwUin, &bAdded);
@@ -183,7 +177,6 @@ void CIcqProto::handleDirectCancel(directconnect *dc, PBYTE buf, size_t wLen, WO
void CIcqProto::icq_CancelFileTransfer(MCONTACT hContact, filetransfer* ft)
{
DWORD dwCookie;
-
if (FindCookieByData(ft, &dwCookie, NULL))
FreeCookie(dwCookie); /* this bit stops a send that's waiting for acceptance */
diff --git a/protocols/IcqOscarJ/src/icqosc_svcs.cpp b/protocols/IcqOscarJ/src/icqosc_svcs.cpp
index 4e1f00b779..5c91037b7c 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);
- lstrcpyn(pai->filename, tszFile, SIZEOF(pai->filename)); // Avatar API does not support unicode :-(
+ mir_tstrncpy(pai->filename, tszFile, SIZEOF(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);
- lstrcpyn(pai->filename, tszFile, SIZEOF(pai->filename)); // Avatar API does not support unicode :-(
+ mir_tstrncpy(pai->filename, tszFile, SIZEOF(pai->filename)); // Avatar API does not support unicode :-(
db_free(&dbv);
diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp
index 3dfa48c3e9..77b373cada 100644
--- a/protocols/JabberG/src/jabber.cpp
+++ b/protocols/JabberG/src/jabber.cpp
@@ -133,7 +133,7 @@ static int OnModulesLoaded(WPARAM, LPARAM)
fontid.deffontsettings.charset = DEFAULT_CHARSET;
fontid.deffontsettings.colour = GetSysColor(COLOR_WINDOWTEXT);
fontid.deffontsettings.size = -11;
- lstrcpyn(fontid.deffontsettings.szFace, _T("MS Shell Dlg"), SIZEOF(fontid.deffontsettings.szFace));
+ mir_tstrncpy(fontid.deffontsettings.szFace, _T("MS Shell Dlg"), SIZEOF(fontid.deffontsettings.szFace));
fontid.deffontsettings.style = 0;
_tcsncpy_s(fontid.name, LPGENT("Frame title"), _TRUNCATE);
diff --git a/protocols/JabberG/src/jabber_api.cpp b/protocols/JabberG/src/jabber_api.cpp
index 208076acf3..4f662909cd 100644
--- a/protocols/JabberG/src/jabber_api.cpp
+++ b/protocols/JabberG/src/jabber_api.cpp
@@ -288,7 +288,7 @@ int CJabberProto::AddFeatures(LPCTSTR szFeatures)
m_uEnabledFeatCapsDynamic |= fcp->jcbCap;
else
ret = false;
- szFeat += lstrlen(szFeat) + 1;
+ szFeat += mir_tstrlen(szFeat) + 1;
}
lck.unlock();
@@ -313,7 +313,7 @@ int CJabberProto::RemoveFeatures(LPCTSTR szFeatures)
else
ret = false; // indicate that there was an error removing at least one of the specified features
- szFeat += lstrlen(szFeat) + 1;
+ szFeat += mir_tstrlen(szFeat) + 1;
}
lck.unlock();
@@ -335,25 +335,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 += lstrlen(g_JabberFeatCapPairs[i].szFeature) + 1;
+ iLen += mir_tstrlen(g_JabberFeatCapPairs[i].szFeature) + 1;
for (i=0; i < m_lstJabberFeatCapPairsDynamic.getCount(); i++)
if (jcb & m_lstJabberFeatCapPairsDynamic[i]->jcbCap)
- iLen += lstrlen(m_lstJabberFeatCapPairsDynamic[i]->szFeature) + 1;
+ iLen += mir_tstrlen(m_lstJabberFeatCapPairsDynamic[i]->szFeature) + 1;
// allocate memory and fill it
LPTSTR str = (LPTSTR)mir_alloc(iLen * sizeof(TCHAR));
LPTSTR p = str;
for (i=0; g_JabberFeatCapPairs[i].szFeature; i++)
if (jcb & g_JabberFeatCapPairs[i].jcbCap) {
- lstrcpy(p, g_JabberFeatCapPairs[i].szFeature);
- p += lstrlen(g_JabberFeatCapPairs[i].szFeature) + 1;
+ mir_tstrcpy(p, g_JabberFeatCapPairs[i].szFeature);
+ p += mir_tstrlen(g_JabberFeatCapPairs[i].szFeature) + 1;
}
for (i=0; i < m_lstJabberFeatCapPairsDynamic.getCount(); i++)
if (jcb & m_lstJabberFeatCapPairsDynamic[i]->jcbCap) {
- lstrcpy(p, m_lstJabberFeatCapPairsDynamic[i]->szFeature);
- p += lstrlen(m_lstJabberFeatCapPairsDynamic[i]->szFeature) + 1;
+ mir_tstrcpy(p, m_lstJabberFeatCapPairsDynamic[i]->szFeature);
+ p += mir_tstrlen(m_lstJabberFeatCapPairsDynamic[i]->szFeature) + 1;
}
*p = 0; // extra zero terminator
diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp
index 22eba675e1..f431ea4b53 100644
--- a/protocols/JabberG/src/jabber_caps.cpp
+++ b/protocols/JabberG/src/jabber_caps.cpp
@@ -668,7 +668,7 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con
if (ppro->m_options.ShowOSVersion) {
if (!GetOSDisplayString(szOsBuffer, SIZEOF(szOsBuffer)))
- lstrcpyn(szOsBuffer, _T(""), SIZEOF(szOsBuffer));
+ mir_tstrncpy(szOsBuffer, _T(""), SIZEOF(szOsBuffer));
else {
TCHAR *szOsWindows = _T("Microsoft Windows");
size_t nOsWindowsLength = _tcslen(szOsWindows);
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp
index 07edd9ae80..93b1fd047f 100644
--- a/protocols/JabberG/src/jabber_chat.cpp
+++ b/protocols/JabberG/src/jabber_chat.cpp
@@ -534,7 +534,7 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam)
if (ptszStatusMsg && *ptszStatusMsg) {
TCHAR *bufPtr = url_buf;
for (TCHAR *p = _tcsstr(ptszStatusMsg, _T("http://")); p && *p; p = _tcsstr(p+1, _T("http://"))) {
- lstrcpyn(bufPtr, p, SIZEOF(url_buf) - (bufPtr - url_buf));
+ mir_tstrncpy(bufPtr, p, SIZEOF(url_buf) - (bufPtr - url_buf));
gc_item *pItem = sttFindGcMenuItem(gcmi, idx);
pItem->pszDesc = bufPtr;
pItem->uType = MENU_POPUPITEM;
@@ -754,7 +754,7 @@ public:
return;
JabberGcLogInviteDlgJidData *jidData = (JabberGcLogInviteDlgJidData *)mir_alloc(sizeof(JabberGcLogInviteDlgJidData));
- lstrcpy(jidData->jid, buf);
+ mir_tstrcpy(jidData->jid, buf);
CLCINFOITEM cii = { 0 };
cii.cbSize = sizeof(cii);
cii.flags = CLCIIF_CHECKBOX;
@@ -1018,7 +1018,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK*
*p = 0;
mir_sntprintf(buf, SIZEOF(buf), _T("%s%s%s"), szMessage, him->m_tszResourceName, p + 2);
}
- else lstrcpyn(buf, szMessage, SIZEOF(buf));
+ else mir_tstrncpy(buf, szMessage, SIZEOF(buf));
UnEscapeChatTags(buf);
ppro->m_ThreadInfo->send(
@@ -1397,7 +1397,7 @@ int CJabberProto::JabberGcEventHook(WPARAM, LPARAM lParam)
switch (gch->pDest->iType) {
case GC_USER_MESSAGE:
- if (gch->ptszText && lstrlen(gch->ptszText) > 0) {
+ if (gch->ptszText && mir_tstrlen(gch->ptszText) > 0) {
rtrimt(gch->ptszText);
if (m_bJabberOnline) {
diff --git a/protocols/JabberG/src/jabber_console.cpp b/protocols/JabberG/src/jabber_console.cpp
index cfacaf7996..b8ff053815 100644
--- a/protocols/JabberG/src/jabber_console.cpp
+++ b/protocols/JabberG/src/jabber_console.cpp
@@ -154,12 +154,12 @@ static void sttAppendBufRaw(StringBuf *buf, const char *str)
{
if (!str) return;
- int length = lstrlenA(str);
+ int length = mir_strlen(str);
if (buf->size - buf->offset < length + 1) {
buf->size += (length + STRINGBUF_INCREMENT);
buf->buf = (char *)mir_realloc(buf->buf, buf->size);
}
- lstrcpyA(buf->buf + buf->offset, str);
+ mir_strcpy(buf->buf + buf->offset, str);
buf->offset += length;
}
@@ -354,7 +354,7 @@ void CJabberDlgConsole::OnInitDialog()
*m_proto->m_filterInfo.pattern = 0;
ptrT tszPattern( m_proto->getTStringA("consoleWnd_fpattern"));
if (tszPattern != NULL)
- lstrcpyn(m_proto->m_filterInfo.pattern, tszPattern, SIZEOF(m_proto->m_filterInfo.pattern));
+ mir_tstrncpy(m_proto->m_filterInfo.pattern, tszPattern, SIZEOF(m_proto->m_filterInfo.pattern));
sttJabberConsoleRebuildStrings(m_proto, GetDlgItem(m_hwnd, IDC_CB_FILTER));
SetWindowText(GetDlgItem(m_hwnd, IDC_CB_FILTER), m_proto->m_filterInfo.pattern);
@@ -559,7 +559,7 @@ INT_PTR CJabberDlgConsole::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
if (len > SIZEOF(m_proto->m_filterInfo.pattern)) {
TCHAR *buf = (TCHAR *)_alloca(len * sizeof(TCHAR));
SendDlgItemMessage(m_hwnd, IDC_CB_FILTER, CB_GETLBTEXT, idx, (LPARAM)buf);
- lstrcpyn(m_proto->m_filterInfo.pattern, buf, SIZEOF(m_proto->m_filterInfo.pattern));
+ mir_tstrncpy(m_proto->m_filterInfo.pattern, buf, SIZEOF(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_file.cpp b/protocols/JabberG/src/jabber_file.cpp
index 078cbcc98f..c9d6cdd7a1 100644
--- a/protocols/JabberG/src/jabber_file.cpp
+++ b/protocols/JabberG/src/jabber_file.cpp
@@ -298,7 +298,7 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft)
mir_free(pFileName);
- int len = lstrlen(ptszResource) + lstrlen(ft->jid) + 2;
+ int len = mir_tstrlen(ptszResource) + mir_tstrlen(ft->jid) + 2;
TCHAR *fulljid = (TCHAR *)alloca(sizeof(TCHAR) * len);
mir_sntprintf(fulljid, len, _T("%s/%s"), ft->jid, ptszResource);
diff --git a/protocols/JabberG/src/jabber_form.cpp b/protocols/JabberG/src/jabber_form.cpp
index 92e3e6f17f..1f639e7de6 100644
--- a/protocols/JabberG/src/jabber_form.cpp
+++ b/protocols/JabberG/src/jabber_form.cpp
@@ -116,7 +116,7 @@ void JabberFormSetInstruction(HWND hwndForm, const TCHAR *text)
{
if (!text) text = _T("");
- int len = lstrlen(text);
+ int len = mir_tstrlen(text);
int fixedLen = len;
for (int i = 1; i < len; i++)
if ((text[i - 1] == _T('\n')) && (text[i] != _T('\r')))
@@ -147,7 +147,7 @@ void JabberFormSetInstruction(HWND hwndForm, const TCHAR *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, (TCHAR *)text, lstrlen(text), &rcText,
+ DrawTextEx(hdcEdit, (TCHAR *)text, mir_tstrlen(text), &rcText,
DT_CALCRECT|DT_EDITCONTROL|DT_TOP|DT_WORDBREAK, NULL);
SelectObject(hdcEdit, hfntSave);
ReleaseDC(GetDlgItem(hwndForm, IDC_INSTRUCTION), hdcEdit);
diff --git a/protocols/JabberG/src/jabber_frame.cpp b/protocols/JabberG/src/jabber_frame.cpp
index 98e0448916..0703cb8e20 100644
--- a/protocols/JabberG/src/jabber_frame.cpp
+++ b/protocols/JabberG/src/jabber_frame.cpp
@@ -244,20 +244,20 @@ void CJabberInfoFrame::ReloadFonts()
FontIDT fontid = {0};
fontid.cbSize = sizeof(fontid);
- lstrcpyn(fontid.group, _T("Jabber"), SIZEOF(fontid.group));
- lstrcpyn(fontid.name, _T("Frame title"), SIZEOF(fontid.name));
+ mir_tstrncpy(fontid.group, _T("Jabber"), SIZEOF(fontid.group));
+ mir_tstrncpy(fontid.name, _T("Frame title"), SIZEOF(fontid.name));
m_clTitle = CallService(MS_FONT_GETT, (WPARAM)&fontid, (LPARAM)&lfFont);
DeleteObject(m_hfntTitle);
m_hfntTitle = CreateFontIndirect(&lfFont);
- lstrcpyn(fontid.name, _T("Frame text"), SIZEOF(fontid.name));
+ mir_tstrncpy(fontid.name, _T("Frame text"), SIZEOF(fontid.name));
m_clText = CallService(MS_FONT_GETT, (WPARAM)&fontid, (LPARAM)&lfFont);
DeleteObject(m_hfntText);
m_hfntText = CreateFontIndirect(&lfFont);
ColourIDT colourid = {0};
colourid.cbSize = sizeof(colourid);
- lstrcpyn(colourid.group, _T("Jabber"), SIZEOF(colourid.group));
- lstrcpyn(colourid.name, _T("Background"), SIZEOF(colourid.name));
+ mir_tstrncpy(colourid.group, _T("Jabber"), SIZEOF(colourid.group));
+ mir_tstrncpy(colourid.name, _T("Background"), SIZEOF(colourid.name));
m_clBack = CallService(MS_COLOUR_GETT, (WPARAM)&colourid, 0);
UpdateSize();
@@ -370,7 +370,7 @@ void CJabberInfoFrame::PaintCompact(HDC hdc)
}
RECT rcText; SetRect(&rcText, cx_icon + SZ_FRAMEPADDING + SZ_ICONSPACING, 0, rc.right - SZ_FRAMEPADDING, rc.bottom);
- DrawText(hdc, item.m_pszText, lstrlen(item.m_pszText), &rcText, DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS);
+ DrawText(hdc, item.m_pszText, mir_tstrlen(item.m_pszText), &rcText, DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS);
}
else {
if (item.m_hIcolibIcon) {
@@ -433,7 +433,7 @@ void CJabberInfoFrame::PaintNormal(HDC hdc)
SetTextColor(hdc, depth ? m_clText : m_clTitle);
RECT rcText; SetRect(&rcText, cx, cy, rc.right - SZ_FRAMEPADDING, cy + line_height);
- DrawText(hdc, item.m_pszText, lstrlen(item.m_pszText), &rcText, DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS);
+ DrawText(hdc, item.m_pszText, mir_tstrlen(item.m_pszText), &rcText, DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS);
RemoveTooltip(item.m_tooltipId);
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp
index 330f472c40..13a468bf2c 100644
--- a/protocols/JabberG/src/jabber_groupchat.cpp
+++ b/protocols/JabberG/src/jabber_groupchat.cpp
@@ -546,13 +546,13 @@ INT_PTR CJabberDlgGcJoin::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
rc.bottom -= (rc.bottom - rc.top) / 2;
rc.left += 20;
SetTextColor(lpdis->hDC, clLine1);
- DrawText(lpdis->hDC, info->line1, lstrlen(info->line1), &rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS);
+ DrawText(lpdis->hDC, info->line1, mir_tstrlen(info->line1), &rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS);
rc = lpdis->rcItem;
rc.top += (rc.bottom - rc.top) / 2;
rc.left += 20;
SetTextColor(lpdis->hDC, clLine2);
- DrawText(lpdis->hDC, info->line2, lstrlen(info->line2), &rc, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_WORD_ELLIPSIS);
+ DrawText(lpdis->hDC, info->line2, mir_tstrlen(info->line2), &rc, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_WORD_ELLIPSIS);
DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 1, lpdis->rcItem.top + 1, m_proto->LoadIconEx("group"), 16, 16, 0, NULL, DI_NORMAL);
switch (info->overlay) {
diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp
index e1d60fb20e..f22f8e0137 100644
--- a/protocols/JabberG/src/jabber_icolib.cpp
+++ b/protocols/JabberG/src/jabber_icolib.cpp
@@ -257,7 +257,7 @@ static HICON ExtractIconFromPath(const char *path, BOOL * needFree)
char file[MAX_PATH],fileFull[MAX_PATH];
int n;
HICON hIcon;
- lstrcpynA(file,path,sizeof(file));
+ mir_strncpy(file,path,sizeof(file));
comma=strrchr(file,',');
if (comma == NULL) n=0;
else {n=atoi(comma+1); *comma=0;}
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp
index 41e11c9f84..4685104f4e 100644
--- a/protocols/JabberG/src/jabber_iq_handlers.cpp
+++ b/protocols/JabberG/src/jabber_iq_handlers.cpp
@@ -116,8 +116,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD);
-#define StringCchCopy(x,y,z) lstrcpyn((x),(z),(y))
-#define StringCchCat(x,y,z) lstrcat((x),(z))
+#define StringCchCopy(x,y,z) mir_tstrncpy((x),(z),(y))
+#define StringCchCat(x,y,z) mir_tstrcat((x),(z))
// slightly modified sample from MSDN
BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE)
@@ -336,7 +336,7 @@ BOOL CJabberProto::OnIqRequestVersion(HXML, CJabberIqInfo *pInfo)
if (m_options.ShowOSVersion) {
TCHAR os[256] = {0};
if (!GetOSDisplayString(os, SIZEOF(os)))
- lstrcpyn(os, _T("Microsoft Windows"), SIZEOF(os));
+ mir_tstrncpy(os, _T("Microsoft Windows"), SIZEOF(os));
query << XCHILD(_T("os"), os);
}
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp
index 84232b04e0..b8737f75b7 100644
--- a/protocols/JabberG/src/jabber_iqid.cpp
+++ b/protocols/JabberG/src/jabber_iqid.cpp
@@ -1337,7 +1337,7 @@ void CJabberProto::OnIqResultGetClientAvatar(HXML iqNode, CJabberIqInfo*)
}
TCHAR szJid[JABBER_MAX_JID_LEN];
- lstrcpyn(szJid, from, SIZEOF(szJid));
+ mir_tstrncpy(szJid, from, SIZEOF(szJid));
TCHAR *res = _tcschr(szJid, _T('/'));
if (res != NULL)
*res = 0;
@@ -1377,7 +1377,7 @@ void CJabberProto::OnIqResultGetServerAvatar(HXML iqNode, CJabberIqInfo *pInfo)
}
TCHAR szJid[JABBER_MAX_JID_LEN];
- lstrcpyn(szJid, from, SIZEOF(szJid));
+ mir_tstrncpy(szJid, from, SIZEOF(szJid));
TCHAR *res = _tcschr(szJid, _T('/'));
if (res != NULL)
*res = 0;
diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp
index 3776b525be..5dce9f8939 100644
--- a/protocols/JabberG/src/jabber_iqid_muc.cpp
+++ b/protocols/JabberG/src/jabber_iqid_muc.cpp
@@ -250,7 +250,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) dat);
// Populate displayed list from iqNode
- lstrcpyn(title, TranslateT("JID List"), SIZEOF(title));
+ mir_tstrncpy(title, TranslateT("JID List"), SIZEOF(title));
if ((dat=(JABBER_MUC_JIDLIST_INFO *) lParam) != NULL) {
HXML iqNode = dat->iqNode;
if (iqNode != NULL) {
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp
index d5a0fc137e..f46c8ff619 100644
--- a/protocols/JabberG/src/jabber_misc.cpp
+++ b/protocols/JabberG/src/jabber_misc.cpp
@@ -411,7 +411,7 @@ void CJabberProto::UpdateMirVer(MCONTACT hContact, pResourceStatus &resource)
if (resource->m_tszResourceName && !_tcschr(jid, '/'))
mir_sntprintf(szFullJid, SIZEOF(szFullJid), _T("%s/%s"), jid, resource->m_tszResourceName);
else
- lstrcpyn(szFullJid, jid, SIZEOF(szFullJid));
+ mir_tstrncpy(szFullJid, jid, SIZEOF(szFullJid));
setTString(hContact, DBSETTING_DISPLAY_UID, szFullJid);
}
diff --git a/protocols/JabberG/src/jabber_notes.cpp b/protocols/JabberG/src/jabber_notes.cpp
index 101a9cfa00..c2c13b2549 100644
--- a/protocols/JabberG/src/jabber_notes.cpp
+++ b/protocols/JabberG/src/jabber_notes.cpp
@@ -38,7 +38,7 @@ static TCHAR *StrTrimCopy(TCHAR *str)
if (!*str) return mir_tstrdup(str);
TCHAR *res = mir_tstrdup(str);
- for (TCHAR *p = res + lstrlen(res) - 1; p >= res; --p) {
+ for (TCHAR *p = res + mir_tstrlen(res) - 1; p >= res; --p) {
if (_istspace(*p))
*p = 0;
else
@@ -85,8 +85,8 @@ void CNoteItem::SetData(TCHAR *title, TCHAR *from, TCHAR *text, TCHAR *tags)
m_szFrom = StrTrimCopy(from);
const TCHAR *szTags = tags;
- TCHAR *p = m_szTags = (TCHAR *)mir_alloc((lstrlen(szTags) + 2 /*for double zero*/) * sizeof(TCHAR));
- TCHAR *q = m_szTagsStr = (TCHAR *)mir_alloc((lstrlen(szTags) + 1) * sizeof(TCHAR));
+ TCHAR *p = m_szTags = (TCHAR *)mir_alloc((mir_tstrlen(szTags) + 2 /*for double zero*/) * sizeof(TCHAR));
+ TCHAR *q = m_szTagsStr = (TCHAR *)mir_alloc((mir_tstrlen(szTags) + 1) * sizeof(TCHAR));
for (; szTags && *szTags; ++szTags) {
if (_istspace(*szTags))
continue;
@@ -108,7 +108,7 @@ bool CNoteItem::HasTag(const TCHAR *szTag)
if (!szTag || !*szTag)
return true;
- for (TCHAR *p = m_szTags; p && *p; p = p + lstrlen(p) + 1)
+ for (TCHAR *p = m_szTags; p && *p; p = p + mir_tstrlen(p) + 1)
if (!lstrcmp(p, szTag))
return true;
@@ -479,7 +479,7 @@ private:
LIST<TCHAR> tagSet(5, _tcscmp);
for (int i = 0; i < m_proto->m_notes.getCount(); i++) {
TCHAR *tags = m_proto->m_notes[i].GetTags();
- for (TCHAR *tag = tags; tag && *tag; tag = tag + lstrlen(tag) + 1)
+ for (TCHAR *tag = tags; tag && *tag; tag = tag + mir_tstrlen(tag) + 1)
if (!tagSet.find(tag))
tagSet.insert(tag);
}
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp
index f4171a6eba..911bb861a5 100644
--- a/protocols/JabberG/src/jabber_opt.cpp
+++ b/protocols/JabberG/src/jabber_opt.cpp
@@ -334,7 +334,7 @@ static void sttStoreJidFromUI(CJabberProto *ppro, CCtrlEdit &txtUsername, CCtrlC
{
TCHAR *user = txtUsername.GetText();
TCHAR *server = cbServer.GetText();
- int len = lstrlen(user) + lstrlen(server) + 2;
+ int len = mir_tstrlen(user) + mir_tstrlen(server) + 2;
TCHAR *jid = (TCHAR *)mir_alloc(len * sizeof(TCHAR));
mir_sntprintf(jid, len, _T("%s@%s"), user, server);
ppro->setTString("jid", jid);
@@ -1327,7 +1327,7 @@ void CJabberProto::_RosterImportFromFile(HWND hwndDlg)
if (Data)
{
jid=xmlGetText(Data);
- if (!jid || lstrlen(jid)==0) continue;
+ if (!jid || mir_tstrlen(jid)==0) continue;
}
Cell=xmlGetNthChild(Row,_T("Cell"),3);
@@ -1654,7 +1654,7 @@ protected:
m_cbServer.GetTextA(server, SIZEOF(server));
ptrA dbManualServer( db_get_sa(NULL, m_proto->m_szModuleName, "ManualHost"));
if (dbManualServer != NULL)
- lstrcpynA(manualServer, dbManualServer, SIZEOF(manualServer));
+ mir_strncpy(manualServer, dbManualServer, SIZEOF(manualServer));
m_canregister = true;
if (!lstrcmpA(manualServer, "talk.google.com")) {
diff --git a/protocols/JabberG/src/jabber_opttree.cpp b/protocols/JabberG/src/jabber_opttree.cpp
index e177b0897b..46ec590355 100644
--- a/protocols/JabberG/src/jabber_opttree.cpp
+++ b/protocols/JabberG/src/jabber_opttree.cpp
@@ -122,7 +122,7 @@ void CCtrlTreeOpts::OnInit()
int sectionLevel = 0;
HTREEITEM hSection = NULL;
- lstrcpy(itemName, m_options[i]->m_szOptionName);
+ mir_tstrcpy(itemName, m_options[i]->m_szOptionName);
sectionName = itemName;
while (sectionName) {
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp
index baccb151a1..29e88cbf68 100644
--- a/protocols/JabberG/src/jabber_privacy.cpp
+++ b/protocols/JabberG/src/jabber_privacy.cpp
@@ -945,7 +945,7 @@ BOOL CJabberDlgPrivacyLists::OnWmDrawItem(UINT, WPARAM, LPARAM lParam)
for (i=0; i < SIZEOF(drawItems); i++) {
SIZE sz = {0};
drawItems[i].text = TranslateTS(drawItems[i].textEng);
- GetTextExtentPoint32(lpdis->hDC, drawItems[i].text, lstrlen(drawItems[i].text), &sz);
+ GetTextExtentPoint32(lpdis->hDC, drawItems[i].text, mir_tstrlen(drawItems[i].text), &sz);
totalWidth += sz.cx + 18 + 5; // 18 pixels for icon, 5 pixel spacing
}
@@ -1049,10 +1049,10 @@ void CJabberDlgPrivacyLists::ShowAdvancedList(CPrivacyList *pList)
void CJabberDlgPrivacyLists::DrawNextRulePart(HDC hdc, COLORREF color, const TCHAR *text, RECT *rc)
{
SetTextColor(hdc, color);
- DrawText(hdc, text, lstrlen(text), rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS);
+ DrawText(hdc, text, mir_tstrlen(text), rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS);
SIZE sz;
- GetTextExtentPoint32(hdc, text, lstrlen(text), &sz);
+ GetTextExtentPoint32(hdc, text, mir_tstrlen(text), &sz);
rc->left += sz.cx;
}
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index ca211ac890..723e73e4c1 100644
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -843,7 +843,7 @@ int __cdecl CJabberProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *evt)
{
ptrA szResUtf(mir_utf8encodeT((LPCTSTR)evt->lParam));
evt->pCustomData = szResUtf;
- evt->cbCustomDataSize = lstrlenA(szResUtf);
+ evt->cbCustomDataSize = mir_strlen(szResUtf);
Proto_RecvMessage(hContact, evt);
return 0;
}
diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp
index 0946ac6b76..2ce34e50d0 100644
--- a/protocols/JabberG/src/jabber_rc.cpp
+++ b/protocols/JabberG/src/jabber_rc.cpp
@@ -247,7 +247,7 @@ static char *StatusModeToDbSetting(int status,const char *suffix)
case ID_STATUS_IDLE: prefix="Idl"; break;
default: return NULL;
}
- lstrcpyA(str,prefix); lstrcatA(str,suffix);
+ mir_strcpy(str,prefix); mir_strcat(str,suffix);
return str;
}
diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp
index cc320b01c0..dad25263b6 100644
--- a/protocols/JabberG/src/jabber_userinfo.cpp
+++ b/protocols/JabberG/src/jabber_userinfo.cpp
@@ -47,12 +47,12 @@ struct UserInfoStringBuf
void append(TCHAR *str) {
if (!str) return;
- int length = lstrlen(str);
+ int length = mir_tstrlen(str);
if (size - offset < length + 1) {
size += (length + STRINGBUF_INCREMENT);
buf = (TCHAR *)mir_realloc(buf, size * sizeof(TCHAR));
}
- lstrcpy(buf + offset, str);
+ mir_tstrcpy(buf + offset, str);
offset += length;
}
@@ -65,7 +65,7 @@ struct UserInfoStringBuf
}
void actualize() {
- if (buf) offset = lstrlen(buf);
+ if (buf) offset = mir_tstrlen(buf);
}
};
@@ -177,7 +177,7 @@ static HTREEITEM sttFillInfoLine(HWND hwndTree, HTREEITEM htiRoot, HICON hIcon,
if (title)
mir_sntprintf(buf, SIZEOF(buf), _T("%s: %s"), title, value);
else
- lstrcpyn(buf, value, SIZEOF(buf));
+ mir_tstrncpy(buf, value, SIZEOF(buf));
TVINSERTSTRUCT tvis = {0};
tvis.hParent = htiRoot;
@@ -257,14 +257,14 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti
// Idle
if (r->m_dwIdleStartTime > 0) {
- lstrcpyn(buf, _tctime(&r->m_dwIdleStartTime), SIZEOF(buf));
- int len = lstrlen(buf);
+ mir_tstrncpy(buf, _tctime(&r->m_dwIdleStartTime), SIZEOF(buf));
+ int len = mir_tstrlen(buf);
if (len > 0) buf[len-1] = 0;
}
else if (!r->m_dwIdleStartTime)
- lstrcpyn(buf, TranslateT("unknown"), SIZEOF(buf));
+ mir_tstrncpy(buf, TranslateT("unknown"), SIZEOF(buf));
else
- lstrcpyn(buf, TranslateT("<not specified>"), SIZEOF(buf));
+ mir_tstrncpy(buf, TranslateT("<not specified>"), SIZEOF(buf));
sttFillInfoLine(hwndTree, htiResource, NULL, TranslateT("Idle since"), buf, sttInfoLineId(resource, INFOLINE_IDLE));
@@ -365,14 +365,14 @@ static void sttFillUserInfo(CJabberProto *ppro, HWND hwndTree, JABBER_LIST_ITEM
// logoff
JABBER_RESOURCE_STATUS *r = item->getTemp();
if (r->m_dwIdleStartTime > 0) {
- lstrcpyn(buf, _tctime(&r->m_dwIdleStartTime), SIZEOF(buf));
- int len = lstrlen(buf);
+ mir_tstrncpy(buf, _tctime(&r->m_dwIdleStartTime), SIZEOF(buf));
+ int len = mir_tstrlen(buf);
if (len > 0) buf[len-1] = 0;
}
else if (!r->m_dwIdleStartTime)
- lstrcpyn(buf, TranslateT("unknown"), SIZEOF(buf));
+ mir_tstrncpy(buf, TranslateT("unknown"), SIZEOF(buf));
else
- lstrcpyn(buf, TranslateT("<not specified>"), SIZEOF(buf));
+ mir_tstrncpy(buf, TranslateT("<not specified>"), SIZEOF(buf));
sttFillInfoLine(hwndTree, htiRoot, NULL,
(item->jid && _tcschr(item->jid, _T('@'))) ? TranslateT("Last logoff time") : TranslateT("Uptime"), buf,
@@ -383,9 +383,9 @@ static void sttFillUserInfo(CJabberProto *ppro, HWND hwndTree, JABBER_LIST_ITEM
// activity
if (item->m_pLastSeenResource)
- lstrcpyn(buf, item->m_pLastSeenResource->m_tszResourceName, SIZEOF(buf));
+ mir_tstrncpy(buf, item->m_pLastSeenResource->m_tszResourceName, SIZEOF(buf));
else
- lstrcpyn(buf, TranslateT("<no information available>"), SIZEOF(buf));
+ mir_tstrncpy(buf, TranslateT("<no information available>"), SIZEOF(buf));
sttFillInfoLine(hwndTree, htiRoot, NULL, TranslateT("Last active resource"), buf,
sttInfoLineId(0, INFOLINE_LASTACTIVE));
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp
index f430aabe00..ced02ad99c 100644
--- a/protocols/JabberG/src/jabber_util.cpp
+++ b/protocols/JabberG/src/jabber_util.cpp
@@ -306,7 +306,7 @@ TCHAR* __stdcall JabberStrFixLines(const TCHAR *str)
if (*p == _T('\r') || *p == _T('\n'))
++add;
- TCHAR *buf = (TCHAR *)mir_alloc((lstrlen(str) + add + 1) * sizeof(TCHAR));
+ TCHAR *buf = (TCHAR *)mir_alloc((mir_tstrlen(str) + add + 1) * sizeof(TCHAR));
TCHAR *res = buf;
for (p = str; p && *p; ++p) {
@@ -986,8 +986,8 @@ const TCHAR *JabberStrIStr(const TCHAR *str, const TCHAR *substr)
TCHAR *str_up = NEWTSTR_ALLOCA(str);
TCHAR *substr_up = NEWTSTR_ALLOCA(substr);
- CharUpperBuff(str_up, lstrlen(str_up));
- CharUpperBuff(substr_up, lstrlen(substr_up));
+ CharUpperBuff(str_up, mir_tstrlen(str_up));
+ CharUpperBuff(substr_up, mir_tstrlen(substr_up));
TCHAR *p = _tcsstr(str_up, substr_up);
return p ? (str + (p - str_up)) : NULL;
@@ -1002,9 +1002,9 @@ void JabberCopyText(HWND hwnd, const TCHAR *text)
OpenClipboard(hwnd);
EmptyClipboard();
- HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR)*(lstrlen(text) + 1));
+ HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR)*(mir_tstrlen(text) + 1));
TCHAR *s = (TCHAR *)GlobalLock(hMem);
- lstrcpy(s, text);
+ mir_tstrcpy(s, text);
GlobalUnlock(hMem);
SetClipboardData(CF_UNICODETEXT, hMem);
CloseClipboard();
diff --git a/protocols/JabberG/src/jabber_xml.cpp b/protocols/JabberG/src/jabber_xml.cpp
index 33dc3eba4a..4ed2769df8 100644
--- a/protocols/JabberG/src/jabber_xml.cpp
+++ b/protocols/JabberG/src/jabber_xml.cpp
@@ -281,13 +281,13 @@ void XPath::ProcessPath(LookupInfo &info, bool bCreate)
if (!info.nodeName) return;
TCHAR *nodeName = (TCHAR *)alloca(sizeof(TCHAR) * (info.nodeName.length+1));
- lstrcpyn(nodeName, info.nodeName.p, info.nodeName.length+1);
+ mir_tstrncpy(nodeName, info.nodeName.p, info.nodeName.length+1);
if (info.attrName && info.attrValue) {
TCHAR *attrName = (TCHAR *)alloca(sizeof(TCHAR)* (info.attrName.length + 1));
- lstrcpyn(attrName, info.attrName.p, info.attrName.length + 1);
+ mir_tstrncpy(attrName, info.attrName.p, info.attrName.length + 1);
TCHAR *attrValue = (TCHAR *)alloca(sizeof(TCHAR)* (info.attrValue.length + 1));
- lstrcpyn(attrValue, info.attrValue.p, info.attrValue.length + 1);
+ mir_tstrncpy(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));
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp
index 20b4175b2a..fe209b5ef8 100644
--- a/protocols/JabberG/src/jabber_xstatus.cpp
+++ b/protocols/JabberG/src/jabber_xstatus.cpp
@@ -343,16 +343,16 @@ BOOL CJabberDlgPepSimple::OnWmDrawItem(UINT, WPARAM, LPARAM lParam)
break;
}
}
- else lstrcpyn(text, mode->m_title, SIZEOF(text));
+ else mir_tstrncpy(text, mode->m_title, SIZEOF(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, lstrlen(text));
+ TextOut(lpdis->hDC, lpdis->rcItem.left + 23, (lpdis->rcItem.top+lpdis->rcItem.bottom-tm.tmHeight)/2, text, mir_tstrlen(text));
}
else {
TCHAR text[128];
mir_sntprintf(text, SIZEOF(text), _T("...%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, lstrlen(text));
+ TextOut(lpdis->hDC, lpdis->rcItem.left + 44, (lpdis->rcItem.top+lpdis->rcItem.bottom-tm.tmHeight)/2, text, mir_tstrlen(text));
}
return TRUE;
@@ -702,7 +702,7 @@ void CPepMood::SetMood(MCONTACT hContact, const TCHAR *szMood, const TCHAR *szTe
m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/mood", g_MoodIcons.GetIcolibHandle(g_arrMoods[mood].szTag), TranslateTS(g_arrMoods[mood].szName));
}
else {
- lstrcpy(title, LPGENT("Set mood..."));
+ mir_tstrcpy(title, LPGENT("Set mood..."));
m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/mood", LoadSkinnedIconHandle(SKINICON_OTHER_SMALLDOT), TranslateT("Set mood..."));
}
}
@@ -974,7 +974,7 @@ void ActivityBuildTitle(int id, TCHAR *buf, int size)
if (szSecond)
mir_sntprintf(buf, size, _T("%s [%s]"), TranslateTS(szFirst), TranslateTS(szSecond));
else
- lstrcpyn(buf, TranslateTS(szFirst), size);
+ mir_tstrncpy(buf, TranslateTS(szFirst), size);
}
else *buf = 0;
}
@@ -1088,7 +1088,7 @@ void CPepActivity::SetActivity(MCONTACT hContact, LPCTSTR szFirst, LPCTSTR szSec
m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/activity", g_ActivityIcons.GetIcolibHandle(returnActivity(activity)), activityTitle);
}
else {
- lstrcpy(title, LPGENT("Set activity..."));
+ mir_tstrcpy(title, LPGENT("Set activity..."));
m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/activity", LoadSkinnedIconHandle(SKINICON_OTHER_SMALLDOT), TranslateT("Set activity..."));
}
}
@@ -1354,9 +1354,9 @@ INT_PTR __cdecl CJabberProto::OnGetXStatusEx(WPARAM hContact, LPARAM lParam)
return 1;
if (pData->flags & CSSF_UNICODE)
- lstrcpynW(pData->pwszName, g_arrMoods[dwXStatus].szName, (STATUS_TITLE_MAX + 1));
+ mir_wstrncpy(pData->pwszName, g_arrMoods[dwXStatus].szName, (STATUS_TITLE_MAX + 1));
else {
- size_t dwStatusTitleSize = lstrlenW(g_arrMoods[dwXStatus].szName);
+ size_t dwStatusTitleSize = mir_wstrlen(g_arrMoods[dwXStatus].szName);
if (dwStatusTitleSize > STATUS_TITLE_MAX)
dwStatusTitleSize = STATUS_TITLE_MAX;
diff --git a/protocols/JabberG/src/ui_utils.cpp b/protocols/JabberG/src/ui_utils.cpp
index 56db0d4827..696986e637 100644
--- a/protocols/JabberG/src/ui_utils.cpp
+++ b/protocols/JabberG/src/ui_utils.cpp
@@ -299,7 +299,7 @@ TCHAR* CCtrlCombo::GetItemText(int index, TCHAR *buf, int size)
{
TCHAR *result = (TCHAR *)_alloca(sizeof(TCHAR) * (SendMessage(m_hwnd, CB_GETLBTEXTLEN, index, 0) + 1));
SendMessage(m_hwnd, CB_GETLBTEXT, index, (LPARAM)result);
- lstrcpyn(buf, result, size);
+ mir_tstrncpy(buf, result, size);
return buf;
}
@@ -386,7 +386,7 @@ TCHAR* CCtrlListBox::GetItemText(int index, TCHAR *buf, int size)
{
TCHAR *result = (TCHAR *)_alloca(sizeof(TCHAR) * (SendMessage(m_hwnd, LB_GETTEXTLEN, index, 0) + 1));
SendMessage(m_hwnd, LB_GETTEXT, index, (LPARAM)result);
- lstrcpyn(buf, result, size);
+ mir_tstrncpy(buf, result, size);
return buf;
}
@@ -853,7 +853,7 @@ void CCtrlListView::AddGroup(int iGroupId, TCHAR *name)
lvg.cbSize = sizeof(lvg);
lvg.mask = LVGF_HEADER | LVGF_GROUPID;
lvg.pszHeader = name;
- lvg.cchHeader = lstrlen(lvg.pszHeader);
+ lvg.cchHeader = mir_tstrlen(lvg.pszHeader);
lvg.iGroupId = iGroupId;
InsertGroup(-1, &lvg);
}
@@ -2316,7 +2316,7 @@ void CProtoIntDlgBase::UpdateProtoTitle(const TCHAR *szText)
if (szText) {
curText = szText;
- curLength = lstrlen(curText);
+ curLength = mir_tstrlen(curText);
}
else {
curLength = GetWindowTextLength(m_hwnd) + 1;
@@ -2326,7 +2326,7 @@ void CProtoIntDlgBase::UpdateProtoTitle(const TCHAR *szText)
}
if (!_tcsstr(curText, m_proto_interface->m_tszUserName)) {
- int length = curLength + lstrlen(m_proto_interface->m_tszUserName) + 256;
+ int length = curLength + mir_tstrlen(m_proto_interface->m_tszUserName) + 256;
TCHAR *text = (TCHAR *)_alloca(length * sizeof(TCHAR));
mir_sntprintf(text, length, _T("%s [%s: %s]"), curText, TranslateT("Account"), m_proto_interface->m_tszUserName);
SetWindowText(m_hwnd, text);
@@ -2339,7 +2339,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, lstrlen(m_proto_interface->m_tszUserName), &sz);
+ GetTextExtentPoint32(hdc, m_proto_interface->m_tszUserName, mir_tstrlen(m_proto_interface->m_tszUserName), &sz);
sz.cx += GetSystemMetrics(SM_CXSMICON) * 3;
SelectObject(hdc, hFntSave);
ReleaseDC(m_hwndStatus, hdc);
diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp
index 440ba67102..0ddab4b217 100644
--- a/protocols/MRA/src/MraAvatars.cpp
+++ b/protocols/MRA/src/MraAvatars.cpp
@@ -332,7 +332,7 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter)
pai.hContact = pmraaqiAvatarsQueueItem->hContact;
pai.format = dwAvatarFormat;
if (db_get_b(NULL, MRA_AVT_SECT_NAME, "ReturnAbsolutePath", MRA_AVT_DEFAULT_RET_ABC_PATH))
- lstrcpyn(pai.filename, wszFileName, SIZEOF(pai.filename));
+ mir_tstrncpy(pai.filename, wszFileName, SIZEOF(pai.filename));
else
PathToRelativeT(wszFileName, pai.filename);
@@ -551,7 +551,7 @@ DWORD CMraProto::MraAvatarsQueueGetAvatar(HANDLE hAvatarsQueueHandle, DWORD dwFl
// ôàéë ñ àâàòàðîì ñóùåñòâóåò è íå óñòàðåë/íå áûëî êîììàíäû îáíîâëÿòü(ïðîñòî çàïðîñ èìåíè)
if (lpszPath) {
if (db_get_b(NULL, MRA_AVT_SECT_NAME, "ReturnAbsolutePath", MRA_AVT_DEFAULT_RET_ABC_PATH))
- lstrcpyn(lpszPath, wszFileName, MAX_PATH);
+ mir_tstrncpy(lpszPath, wszFileName, MAX_PATH);
else
PathToRelativeT(wszFileName, lpszPath);
}
diff --git a/protocols/MRA/src/MraChat.cpp b/protocols/MRA/src/MraChat.cpp
index 69be898335..3dd6251320 100644
--- a/protocols/MRA/src/MraChat.cpp
+++ b/protocols/MRA/src/MraChat.cpp
@@ -192,8 +192,8 @@ int CMraProto::MraChatGcEventHook(WPARAM, LPARAM lParam)
if (!_stricmp(gch->pDest->pszModule, m_szModuleName)) {
switch (gch->pDest->iType) {
case GC_USER_MESSAGE:
- if (gch->ptszText && lstrlen(gch->ptszText)) {
- size_t dwMessageSize = lstrlenW(gch->ptszText);
+ if (gch->ptszText && mir_tstrlen(gch->ptszText)) {
+ size_t dwMessageSize = 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 eaca08cc52..10b0678a9b 100644
--- a/protocols/MRA/src/MraFilesQueue.cpp
+++ b/protocols/MRA/src/MraFilesQueue.cpp
@@ -662,7 +662,7 @@ DWORD CMraProto::MraFilesQueueAddReceive(HANDLE hFilesQueueHandle, DWORD dwFlags
MRA_FILES_QUEUE_FILE &p = dat->pmfqfFiles[dat->dwFilesCount];
p.lpwszName = mir_wstrdup(wszCurrFile);
- p.dwNameLen = lstrlen(p.lpwszName);
+ p.dwNameLen = mir_tstrlen(p.lpwszName);
p.dwSize = _wtoi(wszCurrSize);
dat->dwFilesTotalSize += p.dwSize;
dwFileNameTotalSize += p.dwNameLen * sizeof(TCHAR);
@@ -946,7 +946,7 @@ DWORD CMraProto::MraFilesQueueAddSend(HANDLE hFilesQueueHandle, DWORD dwFlags, M
}
else p.dwSize = 0;
- p.dwNameLen = lstrlenW(plpwszFiles[i]);
+ p.dwNameLen = mir_wstrlen(plpwszFiles[i]);
p.lpwszName = mir_wstrdup(plpwszFiles[i]);
}
diff --git a/protocols/MRA/src/MraIcons.cpp b/protocols/MRA/src/MraIcons.cpp
index a36c6f9d35..0b6c61130d 100644
--- a/protocols/MRA/src/MraIcons.cpp
+++ b/protocols/MRA/src/MraIcons.cpp
@@ -79,7 +79,7 @@ void InitXStatusIcons()
LPWSTR lpwszFileName;
g_dwMirWorkDirPathLen = GetFullPathName(szBuff, MAX_FILEPATH, g_szMirWorkDirPath, &lpwszFileName);
if (g_dwMirWorkDirPathLen) {
- g_dwMirWorkDirPathLen -= lstrlenW(lpwszFileName);
+ g_dwMirWorkDirPathLen -= mir_wstrlen(lpwszFileName);
g_szMirWorkDirPath[g_dwMirWorkDirPathLen] = 0;
// load xstatus icons lib
diff --git a/protocols/MRA/src/MraPopUp.cpp b/protocols/MRA/src/MraPopUp.cpp
index 87bac3d0a1..805cd75e62 100644
--- a/protocols/MRA/src/MraPopUp.cpp
+++ b/protocols/MRA/src/MraPopUp.cpp
@@ -256,9 +256,9 @@ void CMraProto::MraPopupShowW(MCONTACT hContact, DWORD dwType, DWORD dwFlags, LP
ppd.lchContact = hContact;
if (lpszTitle)
- lstrcpyn(ppd.lptzContactName, lpszTitle, MAX_CONTACTNAME);
+ mir_tstrncpy(ppd.lptzContactName, lpszTitle, MAX_CONTACTNAME);
if (lpszMessage)
- lstrcpyn(ppd.lptzText, lpszMessage, MAX_SECONDLINE);
+ mir_tstrncpy(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 6ddfb6704c..97324fdd53 100644
--- a/protocols/MRA/src/MraProto.cpp
+++ b/protocols/MRA/src/MraProto.cpp
@@ -205,9 +205,9 @@ int CMraProto::Authorize(HANDLE hDBEvent)
if (strcmp(dbei.szModule, m_szModuleName)) return 1;
LPSTR lpszNick = (LPSTR)(dbei.pBlob + sizeof(DWORD) * 2);
- LPSTR lpszFirstName = lpszNick + lstrlenA(lpszNick) + 1;
- LPSTR lpszLastName = lpszFirstName + lstrlenA(lpszFirstName) + 1;
- MraAuthorize(CMStringA(lpszLastName + lstrlenA(lpszLastName) + 1));
+ LPSTR lpszFirstName = lpszNick + mir_strlen(lpszNick) + 1;
+ LPSTR lpszLastName = lpszFirstName + mir_strlen(lpszFirstName) + 1;
+ MraAuthorize(CMStringA(lpszLastName + mir_strlen(lpszLastName) + 1));
return 0;
}
@@ -225,9 +225,9 @@ int CMraProto::AuthDeny(HANDLE hDBEvent, const TCHAR* szReason)
if (strcmp(dbei.szModule, m_szModuleName)) return 1;
LPSTR lpszNick = (LPSTR)(dbei.pBlob + sizeof(DWORD) * 2);
- LPSTR lpszFirstName = lpszNick + lstrlenA(lpszNick) + 1;
- LPSTR lpszLastName = lpszFirstName + lstrlenA(lpszFirstName) + 1;
- LPSTR szEmail = lpszLastName + lstrlenA(lpszLastName) + 1;
+ LPSTR lpszFirstName = lpszNick + mir_strlen(lpszNick) + 1;
+ LPSTR lpszLastName = lpszFirstName + mir_strlen(lpszFirstName) + 1;
+ LPSTR szEmail = lpszLastName + mir_strlen(lpszLastName) + 1;
MraMessage(FALSE, NULL, 0, 0, szEmail, szReason, NULL, 0);
return 0;
@@ -249,7 +249,7 @@ int CMraProto::AuthRequest(MCONTACT hContact, const TCHAR *lptszMessage)
HANDLE CMraProto::FileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR *szPath)
{
if (szPath != NULL)
- if (MraFilesQueueAccept(hFilesQueueHandle, (DWORD)hTransfer, szPath, lstrlen(szPath)) == NO_ERROR)
+ if (MraFilesQueueAccept(hFilesQueueHandle, (DWORD)hTransfer, szPath, mir_tstrlen(szPath)) == NO_ERROR)
return hTransfer; // Success
return NULL;
@@ -421,7 +421,7 @@ int CMraProto::SendMsg(MCONTACT hContact, int flags, const char *lpszMessage)
int iRet = 0;
if (flags & PREF_UNICODE)
- lpwszMessage = (LPWSTR)(lpszMessage + lstrlenA(lpszMessage) + 1);
+ lpwszMessage = (LPWSTR)(lpszMessage + mir_strlen(lpszMessage) + 1);
else if (flags & PREF_UTF)
lpwszMessage = mir_utf8decodeT(lpszMessage);
else
@@ -576,7 +576,7 @@ int CMraProto::SetAwayMsg(int m_iStatus, const TCHAR* msg)
if (!m_bLoggedIn)
return 1;
- size_t dwStatusDescSize = lstrlen(msg);
+ size_t dwStatusDescSize = mir_tstrlen(msg);
DWORD dwStatus = m_iStatus;
DWORD dwXStatus = m_iXStatus;
diff --git a/protocols/MRA/src/MraRTFMsg.cpp b/protocols/MRA/src/MraRTFMsg.cpp
index 03401631c6..89e21c867a 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);
- lstrcpyn(lf.lfFaceName, MRA_DEFAULT_RTF_FONT_NAME, LF_FACESIZE);
+ mir_tstrncpy(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/MraSendCommand.cpp b/protocols/MRA/src/MraSendCommand.cpp
index 220d9a2c96..b25fb0033c 100644
--- a/protocols/MRA/src/MraSendCommand.cpp
+++ b/protocols/MRA/src/MraSendCommand.cpp
@@ -110,7 +110,7 @@ DWORD CMraProto::MraMessage(BOOL bAddToQueue, MCONTACT hContact, DWORD dwAckType
DWORD dwRTFDataSize = buf.Len();
if ( compress2((LPBYTE)lpbRTFData, &dwRTFDataSize, buf.Data(), buf.Len(), Z_BEST_COMPRESSION) == Z_OK) {
lpszMessageRTF = mir_base64_encode((LPBYTE)lpbRTFData, dwRTFDataSize);
- dwMessageRTFSize = lstrlenA(lpszMessageRTF);
+ dwMessageRTFSize = mir_strlen(lpszMessageRTF);
}
}
// standart message
@@ -130,7 +130,7 @@ DWORD CMraProto::MraMessage(BOOL bAddToQueue, MCONTACT hContact, DWORD dwAckType
DWORD dwRTFDataSize = lpbRTFData.GetLength();
if ( compress2((LPBYTE)(LPCSTR)lpbRTFData, &dwRTFDataSize, buf.Data(), buf.Len(), Z_BEST_COMPRESSION) == Z_OK) {
lpszMessageRTF = mir_base64_encode((LPBYTE)(LPCSTR)lpbRTFData, dwRTFDataSize);
- dwMessageRTFSize = lstrlenA(lpszMessageRTF);
+ dwMessageRTFSize = mir_strlen(lpszMessageRTF);
}
}
}
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp
index a9af00ed8c..0a460c7cf2 100644
--- a/protocols/MRA/src/Mra_functions.cpp
+++ b/protocols/MRA/src/Mra_functions.cpp
@@ -215,7 +215,7 @@ bool DB_GetStaticStringW(MCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszValueN
size_t dwReadedStringLen;
DBVARIANT dbv = { 0 };
if (db_get_ws(hContact, lpszModule, lpszValueName, &dbv) == 0) {
- dwReadedStringLen = lstrlenW(dbv.pwszVal);
+ dwReadedStringLen = mir_wstrlen(dbv.pwszVal);
if (lpwszRetBuff && (dwRetBuffSize > dwReadedStringLen)) {
memmove(lpwszRetBuff, dbv.pszVal, (dwReadedStringLen*sizeof(WCHAR)));//include null terminated
(*((WCHAR*)(lpwszRetBuff + dwReadedStringLen))) = 0;
@@ -641,8 +641,8 @@ void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA &
if (m_dwEmailMessagesUnread) {
CMStringA szEmail;
MCONTACT hContact = NULL;
- TCHAR szMailBoxStatus[MAX_SECONDLINE];
+ TCHAR szMailBoxStatus[MAX_SECONDLINE];
mir_sntprintf(szMailBoxStatus, SIZEOF(szMailBoxStatus), TranslateT("Unread mail is available: %lu/%lu messages"), m_dwEmailMessagesUnread, dwEmailMessagesTotal);
if (!pszFrom.IsEmpty() || !pszSubject.IsEmpty()) {
@@ -652,7 +652,7 @@ void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA &
mir_sntprintf(szStatusText, SIZEOF(szStatusText), TranslateT("From: %S\r\nSubject: %S\r\n%s"), pszFrom.c_str(), szSubject.c_str(), szMailBoxStatus);
}
- else lstrcpyn(szStatusText, szMailBoxStatus, SIZEOF(szStatusText));
+ else _tcsncpy_s(szStatusText, szMailBoxStatus, _TRUNCATE);
if (bTrayIconNewMailNotify) {
char szServiceFunction[MAX_PATH], *pszServiceFunctionName;
@@ -763,7 +763,7 @@ bool IsEMailMR(const CMStringA &szEmail)
{
if (szEmail) {
for (int i = 0; lpcszMailRuDomains[i]; i++) {
- int dwDomainLen = lstrlenA(lpcszMailRuDomains[i]);
+ int dwDomainLen = mir_strlen(lpcszMailRuDomains[i]);
if (dwDomainLen < szEmail.GetLength())
if (!_stricmp(lpcszMailRuDomains[i], szEmail.c_str() + szEmail.GetLength() - dwDomainLen))
if (szEmail[szEmail.GetLength() - dwDomainLen - 1] == '@')
@@ -1050,8 +1050,8 @@ 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
- lstrcpyn(szBuff, TranslateTS(lpcszXStatusNameDef[dat->dwXStatus]), (STATUS_TITLE_MAX + 1));
- dwBuffSize = lstrlenW(szBuff);
+ mir_tstrncpy(szBuff, TranslateTS(lpcszXStatusNameDef[dat->dwXStatus]), STATUS_TITLE_MAX + 1);
+ dwBuffSize = mir_wstrlen(szBuff);
}
mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%dName", dat->dwXStatus);
dat->ppro->mraSetStringExW(NULL, szValueName, szBuff);
@@ -1231,8 +1231,8 @@ DWORD FindFile(LPWSTR lpszFolder, DWORD dwFolderLen, LPWSTR lpszFileName, DWORD
DWORD dwPathLen, dwRecDeepAllocated, dwRecDeepCurPos, dwFilePathLen;
RECURSION_DATA_STACK_ITEM *prdsiItems;
- if (dwFolderLen == -1) dwFolderLen = lstrlenW(lpszFolder);
- if (dwFileNameLen == -1) dwFileNameLen = lstrlenW(lpszFileName);
+ if (dwFolderLen == -1) dwFolderLen = mir_wstrlen(lpszFolder);
+ if (dwFileNameLen == -1) dwFileNameLen = mir_wstrlen(lpszFileName);
dwRecDeepCurPos = 0;
dwRecDeepAllocated = RECURSION_DATA_STACK_ITEMS_MIN;
@@ -1245,7 +1245,7 @@ DWORD FindFile(LPWSTR lpszFolder, DWORD dwFolderLen, LPWSTR lpszFileName, DWORD
dwPathLen++;
}
szPath[dwPathLen] = 0;
- lstrcat(szPath, _T("*.*"));
+ mir_tstrcat(szPath, _T("*.*"));
prdsiItems[dwRecDeepCurPos].dwFileNameLen = 0;
prdsiItems[dwRecDeepCurPos].hFind = FindFirstFileEx(szPath, FindExInfoStandard, &prdsiItems[dwRecDeepCurPos].w32fdFindFileData, FindExSearchNameMatch, NULL, 0);
@@ -1258,9 +1258,9 @@ DWORD FindFile(LPWSTR lpszFolder, DWORD dwFolderLen, LPWSTR lpszFileName, DWORD
if (prdsiItems[dwRecDeepCurPos].w32fdFindFileData.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) {// folder
if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, _T("."), 1) != CSTR_EQUAL)
if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, _T(".."), 2) != CSTR_EQUAL) {
- prdsiItems[dwRecDeepCurPos].dwFileNameLen = (lstrlenW(prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName) + 1);
+ prdsiItems[dwRecDeepCurPos].dwFileNameLen = (mir_wstrlen(prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName) + 1);
memmove((szPath + dwPathLen), prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, (prdsiItems[dwRecDeepCurPos].dwFileNameLen*sizeof(WCHAR)));
- lstrcat(szPath, _T("\\*.*"));
+ mir_tstrcat(szPath, _T("\\*.*"));
dwPathLen += prdsiItems[dwRecDeepCurPos].dwFileNameLen;
dwRecDeepCurPos++;
@@ -1278,7 +1278,7 @@ DWORD FindFile(LPWSTR lpszFolder, DWORD dwFolderLen, LPWSTR lpszFileName, DWORD
}
else {// file
if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, lpszFileName, dwFileNameLen) == CSTR_EQUAL) {
- prdsiItems[dwRecDeepCurPos].dwFileNameLen = lstrlenW(prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName);
+ prdsiItems[dwRecDeepCurPos].dwFileNameLen = mir_wstrlen(prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName);
memmove((szPath + dwPathLen), prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, ((prdsiItems[dwRecDeepCurPos].dwFileNameLen + 1)*sizeof(WCHAR)));
dwFilePathLen = (dwPathLen + prdsiItems[dwRecDeepCurPos].dwFileNameLen);
diff --git a/protocols/MRA/src/Mra_options.cpp b/protocols/MRA/src/Mra_options.cpp
index 9498b1ceca..fa15c971d3 100644
--- a/protocols/MRA/src/Mra_options.cpp
+++ b/protocols/MRA/src/Mra_options.cpp
@@ -168,7 +168,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);
- lstrcpyn(lf.lfFaceName, MRA_DEFAULT_RTF_FONT_NAME, LF_FACESIZE);
+ mir_tstrncpy(lf.lfFaceName, MRA_DEFAULT_RTF_FONT_NAME, LF_FACESIZE);
ReleaseDC(NULL, hDC);
}
diff --git a/protocols/MRA/src/Mra_svcs.cpp b/protocols/MRA/src/Mra_svcs.cpp
index 28d8d05590..f114c956fe 100644
--- a/protocols/MRA/src/Mra_svcs.cpp
+++ b/protocols/MRA/src/Mra_svcs.cpp
@@ -466,9 +466,9 @@ INT_PTR CMraProto::MraGetXStatusEx(WPARAM hContact, LPARAM lParam)
return 1;
if (pData->flags & CSSF_UNICODE)
- lstrcpyn(pData->ptszName, lpcszXStatusNameDef[dwXStatus], (STATUS_TITLE_MAX + 1));
+ mir_tstrncpy(pData->ptszName, lpcszXStatusNameDef[dwXStatus], (STATUS_TITLE_MAX + 1));
else {
- size_t dwStatusTitleSize = lstrlen(lpcszXStatusNameDef[dwXStatus]);
+ size_t dwStatusTitleSize = mir_tstrlen(lpcszXStatusNameDef[dwXStatus]);
if (dwStatusTitleSize > STATUS_TITLE_MAX)
dwStatusTitleSize = STATUS_TITLE_MAX;
@@ -631,7 +631,7 @@ INT_PTR CMraProto::MraGetMyAvatar(WPARAM wParam, LPARAM lParam)
{
CMStringW wszFileName;
if (MraAvatarsGetFileName(hAvatarsQueueHandle, NULL, GetContactAvatarFormat(NULL, PA_FORMAT_DEFAULT), wszFileName) == NO_ERROR) {
- lstrcpyn((LPTSTR)wParam, wszFileName, (size_t)lParam);
+ mir_tstrncpy((LPTSTR)wParam, wszFileName, (size_t)lParam);
return 0;
}
return 1;
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp
index c3bfaf9ee6..4c5b24369e 100644
--- a/protocols/MSN/src/msn_commands.cpp
+++ b/protocols/MSN/src/msn_commands.cpp
@@ -292,7 +292,7 @@ void CMsnProto::MSN_CustomSmiley(const char* msgBody, char* email, char* nick, i
size_t slen = strlen(lastsml);
ptrA buf(mir_base64_encode((PBYTE)lastsml, (unsigned)slen));
ptrA smileyName(mir_urlEncode(buf));
- int rlen = lstrlenA(buf);
+ int rlen = mir_strlen(buf);
TCHAR path[MAX_PATH];
MSN_GetCustomSmileyFileName(hContact, path, SIZEOF(path), smileyName, iSmileyType);
diff --git a/protocols/MSN/src/msn_p2p.cpp b/protocols/MSN/src/msn_p2p.cpp
index ffe25feeb1..f9703ad446 100644
--- a/protocols/MSN/src/msn_p2p.cpp
+++ b/protocols/MSN/src/msn_p2p.cpp
@@ -2129,7 +2129,7 @@ void CMsnProto::p2p_invite(unsigned iAppID, filetransfer* ft, const char *wlid)
ft->p2p_sessionid = MSN_GenRandom();
ptrA szContextEnc(mir_base64_encode((PBYTE)pContext, (unsigned)cbContext));
- int cbContextEnc = lstrlenA(szContextEnc);
+ int cbContextEnc = mir_strlen(szContextEnc);
MimeHeaders chdrs(10);
chdrs.addString("EUF-GUID", szAppID);
diff --git a/protocols/SkypeClassic/src/skype.cpp b/protocols/SkypeClassic/src/skype.cpp
index 52d08a6a45..8fc3c11d8e 100644
--- a/protocols/SkypeClassic/src/skype.cpp
+++ b/protocols/SkypeClassic/src/skype.cpp
@@ -214,12 +214,12 @@ int ShowMessage(int iconID, TCHAR *lpzText, int mustShow) {
MessagePopup.iSeconds = popupTimeSec;
MessagePopup.PluginData = (void *)1;
- lstrcpy(MessagePopup.lptzText, lpzText);
+ mir_tstrcpy(MessagePopup.lptzText, lpzText);
#ifdef _UNICODE
mbstowcs(MessagePopup.lptzContactName, SKYPE_PROTONAME, strlen(SKYPE_PROTONAME) + 1);
#else
- lstrcpy(MessagePopup.lptzContactName, SKYPE_PROTONAME);
+ mir_tstrcpy(MessagePopup.lptzContactName, SKYPE_PROTONAME);
#endif
if (showPopup)
@@ -1548,9 +1548,9 @@ void RingThread(char *szSkypeMsg) {
InCallPopup.PluginWindowProc = InCallPopUpProc;
InCallPopup.PluginData = (void *)1;
- lstrcpyn(InCallPopup.lptzText, TranslateT("Incoming Skype Call"), MAX_SECONDLINE);
+ mir_tstrncpy(InCallPopup.lptzText, TranslateT("Incoming Skype Call"), MAX_SECONDLINE);
- lstrcpyn(InCallPopup.lptzContactName, lpzContactName, MAX_CONTACTNAME);
+ mir_tstrncpy(InCallPopup.lptzContactName, lpzContactName, MAX_CONTACTNAME);
if (showPopup)
CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&InCallPopup, 0);
@@ -2477,7 +2477,7 @@ INT_PTR SkypeGetAvatarInfo(WPARAM wParam, LPARAM lParam)
{
if (!db_get_s(NULL, SKYPE_PROTONAME, "AvatarFile", &dbv))
{
- lstrcpynA(AI->filename, dbv.pszVal, sizeof(AI->filename));
+ mir_strncpy(AI->filename, dbv.pszVal, sizeof(AI->filename));
db_free(&dbv);
return GAIR_SUCCESS;
}
diff --git a/protocols/SkypeClassic/src/skypeopt.cpp b/protocols/SkypeClassic/src/skypeopt.cpp
index f260107b2c..3caea3d09f 100644
--- a/protocols/SkypeClassic/src/skypeopt.cpp
+++ b/protocols/SkypeClassic/src/skypeopt.cpp
@@ -169,9 +169,9 @@ INT_PTR CALLBACK OptPopupDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
InCallPopup.iSeconds = popupTimeSec;
InCallPopup.PluginData = (void *)1;
- lstrcpy(InCallPopup.lptzText, TranslateT("Incoming Skype Call"));
+ mir_tstrcpy(InCallPopup.lptzText, TranslateT("Incoming Skype Call"));
- lstrcpy(InCallPopup.lptzContactName, lpzContactName);
+ mir_tstrcpy(InCallPopup.lptzContactName, lpzContactName);
CallService(MS_POPUP_ADDPOPUPT,(WPARAM)&InCallPopup,0);
@@ -186,9 +186,9 @@ INT_PTR CALLBACK OptPopupDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
ErrorPopup.iSeconds = popupTimeSecErr;
ErrorPopup.PluginData = (void *)1;
- lstrcpy(ErrorPopup.lptzText, TranslateT("Preview Error Message"));
+ mir_tstrcpy(ErrorPopup.lptzText, TranslateT("Preview Error Message"));
- lstrcpy(ErrorPopup.lptzContactName, _T("Error Message"));
+ mir_tstrcpy(ErrorPopup.lptzContactName, _T("Error Message"));
CallService(MS_POPUP_ADDPOPUPT,(WPARAM)&ErrorPopup,0);
diff --git a/protocols/SkypeClassic/src/skypesvc.cpp b/protocols/SkypeClassic/src/skypesvc.cpp
index b7ed84be4d..e5b1dc2c8e 100644
--- a/protocols/SkypeClassic/src/skypesvc.cpp
+++ b/protocols/SkypeClassic/src/skypesvc.cpp
@@ -168,7 +168,7 @@ INT_PTR SkypeGetAvatar(WPARAM wParam,LPARAM lParam)
{
DBVARIANT dbv;
if (!db_get_s(NULL,SKYPE_PROTONAME, "AvatarFile", &dbv)){
- lstrcpynA((char*)wParam, dbv.pszVal, (int)lParam);
+ mir_strncpy((char*)wParam, dbv.pszVal, (int)lParam);
db_free(&dbv);
}
return 0;
diff --git a/protocols/SkypeClassic/src/utf8.cpp b/protocols/SkypeClassic/src/utf8.cpp
index 8ae746e871..32a77231b3 100644
--- a/protocols/SkypeClassic/src/utf8.cpp
+++ b/protocols/SkypeClassic/src/utf8.cpp
@@ -287,7 +287,7 @@ static int convert_string(const char *fromcode, const char *tocode,
size_t fromlen;
char *s;
- fromlen = lstrlen(from);
+ fromlen = mir_tstrlen(from);
ret = convert_buffer(fromcode, tocode, from, fromlen, to, 0);
if (ret == -2)
return -1;
@@ -297,7 +297,7 @@ static int convert_string(const char *fromcode, const char *tocode,
s = malloc(fromlen + 1);
if (!s)
return -1;
- lstrcpy(s, from);
+ mir_tstrcpy(s, from);
*to = s;
for (; *s; s++)
if (*s & ~0x7f)
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp
index 83f5982c81..b2e333978f 100644
--- a/protocols/Twitter/src/proto.cpp
+++ b/protocols/Twitter/src/proto.cpp
@@ -228,7 +228,7 @@ INT_PTR TwitterProto::SvcCreateAccMgrUI(WPARAM,LPARAM lParam)
INT_PTR TwitterProto::GetName(WPARAM wParam,LPARAM lParam)
{
- lstrcpynA(reinterpret_cast<char*>(lParam), m_szModuleName, (int)wParam);
+ mir_strncpy(reinterpret_cast<char*>(lParam), m_szModuleName, (int)wParam);
return 0;
}
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp
index 79762394ca..f55c97edde 100644
--- a/protocols/VKontakte/src/vk_chats.cpp
+++ b/protocols/VKontakte/src/vk_chats.cpp
@@ -359,7 +359,7 @@ int CVkProto::OnChatEvent(WPARAM, LPARAM lParam)
switch (gch->pDest->iType) {
case GC_USER_MESSAGE:
- if (IsOnline() && lstrlen(gch->ptszText) > 0) {
+ if (IsOnline() && mir_tstrlen(gch->ptszText) > 0) {
TCHAR *buf = NEWTSTR_ALLOCA(gch->ptszText);
rtrimt(buf);
UnEscapeChatTags(buf);
diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp
index ad6f2f9d92..59e43defdd 100644
--- a/protocols/WhatsApp/src/proto.cpp
+++ b/protocols/WhatsApp/src/proto.cpp
@@ -361,8 +361,8 @@ void WhatsAppProto::NotifyEvent(const TCHAR *title, const TCHAR *info, MCONTACT
pd.lchIcon = Skin_GetIconByHandle(m_hProtoIcon); // TODO: Icon test
pd.PluginData = szUrl;
pd.PluginWindowProc = (WNDPROC)PopupDlgProc;
- lstrcpy(pd.lptzContactName, title);
- lstrcpy(pd.lptzText, info);
+ mir_tstrcpy(pd.lptzContactName, title);
+ mir_tstrcpy(pd.lptzText, info);
ret = PUAddPopupT(&pd);
if (ret == 0)
diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp
index df4a9686e3..92b3599b51 100644
--- a/protocols/Xfire/src/main.cpp
+++ b/protocols/Xfire/src/main.cpp
@@ -1410,7 +1410,7 @@ INT_PTR GetCaps(WPARAM wParam, LPARAM lParam)
//=======================================================
INT_PTR GetName(WPARAM wParam, LPARAM lParam)
{
- lstrcpynA((char*)lParam, "XFire", wParam);
+ mir_strncpy((char*)lParam, "XFire", wParam);
return 0;
}
@@ -1802,7 +1802,7 @@ void SetAvatar(LPVOID lparam)
AI.cbSize = sizeof(AI);
AI.format = av.type;
AI.hContact = xsa->hContact;
- lstrcpy(AI.filename, _A2T(av.file));
+ mir_tstrcpy(AI.filename, _A2T(av.file));
ProtoBroadcastAck(protocolname, xsa->hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&AI, 0);
}
@@ -3048,7 +3048,7 @@ INT_PTR BasicSearch(WPARAM wParam, LPARAM lParam) {
if (myClient != NULL)
if (myClient->client->connected)
{
- lstrcpynA(buf, (const char *)lParam, 50);
+ mir_strncpy(buf, (const char *)lParam, 50);
mir_forkthread(AckBasicSearch, &buf);
return 1;
}
diff --git a/protocols/Xfire/src/options.cpp b/protocols/Xfire/src/options.cpp
index e3daffe50d..f7ee82d0ad 100644
--- a/protocols/Xfire/src/options.cpp
+++ b/protocols/Xfire/src/options.cpp
@@ -270,7 +270,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
db_free(&dbv);
//den login lowercasen
- int size = lstrlenA(login);
+ int size = mir_strlen(login);
BOOL mustlowercase = FALSE;
for (int i = 0; i < size; i++)
{
diff --git a/protocols/Xfire/src/processbuddyinfo.cpp b/protocols/Xfire/src/processbuddyinfo.cpp
index 68a5994d34..4d92a63f51 100644
--- a/protocols/Xfire/src/processbuddyinfo.cpp
+++ b/protocols/Xfire/src/processbuddyinfo.cpp
@@ -94,7 +94,7 @@ void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo, MCONTACT hcontact, c
AI.cbSize = sizeof(AI);
AI.format = type;
AI.hContact = hcontact;
- lstrcpy(AI.filename, _A2T(filename));
+ mir_tstrcpy(AI.filename, _A2T(filename));
ProtoBroadcastAck(protocolname, hcontact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&AI, 0);
}
else //eigenen avatar setzen
diff --git a/protocols/Xfire/src/tools.cpp b/protocols/Xfire/src/tools.cpp
index 42d8299505..5c42c159b1 100644
--- a/protocols/Xfire/src/tools.cpp
+++ b/protocols/Xfire/src/tools.cpp
@@ -100,8 +100,8 @@ int displayPopup(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType, HICON h
bIconsNotLoaded = FALSE;
}
- lstrcpyn(ppd.lptzContactName, _A2T(lpCaption), SIZEOF(ppd.lptzContactName));
- lstrcpyn(ppd.lptzText, _A2T(lpText), SIZEOF(ppd.lptzText));
+ mir_tstrncpy(ppd.lptzContactName, _A2T(lpCaption), SIZEOF(ppd.lptzContactName));
+ mir_tstrncpy(ppd.lptzText, _A2T(lpText), SIZEOF(ppd.lptzText));
if ((uType & MB_ICONMASK) == MB_ICONSTOP) {
ppd.lchIcon = hicError;
diff --git a/protocols/Yahoo/src/avatar.cpp b/protocols/Yahoo/src/avatar.cpp
index 5e2f99ceca..1acdb1fe5f 100644
--- a/protocols/Yahoo/src/avatar.cpp
+++ b/protocols/Yahoo/src/avatar.cpp
@@ -764,7 +764,7 @@ INT_PTR __cdecl CYahooProto::GetMyAvatar(WPARAM wParam, LPARAM lParam)
if (getDword("AvatarHash", 0)) {
if (!getTString("AvatarFile", &dbv)) {
if (_taccess(dbv.ptszVal, 0) == 0) {
- lstrcpyn(buffer, dbv.ptszVal, size-1);
+ mir_tstrncpy(buffer, dbv.ptszVal, size-1);
buffer[size-1] = '\0';
ret = 0;
diff --git a/protocols/Yahoo/src/file_transfer.cpp b/protocols/Yahoo/src/file_transfer.cpp
index 9d477785de..1cfe32740f 100644
--- a/protocols/Yahoo/src/file_transfer.cpp
+++ b/protocols/Yahoo/src/file_transfer.cpp
@@ -486,7 +486,7 @@ void CYahooProto::ext_got_file(const char *me, const char *who, const char *url,
ZeroMemory(fn, 1024);
if (fname != NULL)
- lstrcpynA(fn, fname, 1024);
+ mir_strncpy(fn, fname, 1024);
else {
char *start, *end;
@@ -498,9 +498,9 @@ void CYahooProto::ext_got_file(const char *me, const char *who, const char *url,
end = ( char* )strrchr(url, '?');
if (start && *start && end) {
- lstrcpynA(fn, start, end-start+1);
+ mir_strncpy(fn, start, end-start+1);
} else
- lstrcpyA(fn, "filename.ext");
+ mir_strcpy(fn, "filename.ext");
}
yahoo_file_info *fi = y_new(struct yahoo_file_info,1);
@@ -557,7 +557,7 @@ void CYahooProto::ext_got_files(const char *me, const char *who, const char *ft_
struct yahoo_file_info *fi = (struct yahoo_file_info *) f->data;
mir_snprintf(z, 1024, "%s (%lu)\r\n", fi->filename, fi->filesize);
- lstrcatA(fn, z);
+ mir_strcat(fn, z);
fc++;
}
diff --git a/protocols/Yahoo/src/im.cpp b/protocols/Yahoo/src/im.cpp
index 31e47510ec..03f45a3f37 100644
--- a/protocols/Yahoo/src/im.cpp
+++ b/protocols/Yahoo/src/im.cpp
@@ -1,9 +1,9 @@
/*
* $Id: im.cpp 12307 2010-08-11 21:49:46Z Michael.Kunz@s2005.TU-Chemnitz.de $
*
- * myYahoo Miranda Plugin
+ * myYahoo Miranda Plugin
*
- * Authors: Gennady Feldman (aka Gena01)
+ * Authors: Gennady Feldman (aka Gena01)
* Laurent Marechal (aka Peorth)
*
* This code is under GPL and is based on AIM, MSN and Miranda source code.
@@ -22,20 +22,20 @@
void CYahooProto::send_msg(const char *id, int protocol, const char *msg, int utf8)
{
LOG(("[send_msg] Who: %s: protocol: %d Msg: '%s', utf: %d", id, protocol, msg, utf8));
-
+
int buddy_icon = (getDword("AvatarHash", 0) != 0) ? 2: 0;
yahoo_send_im(m_id, NULL, id, protocol, msg, utf8, buddy_icon);
}
-void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, const char *msg,
- long tm, int stat, int utf8, int buddy_icon,
+void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, const char *msg,
+ long tm, int stat, int utf8, int buddy_icon,
const char *seqn, int sendn)
{
char *umsg;
const char *c = msg;
int oidx = 0;
- LOG(("YAHOO_GOT_IM id:%s %s: %s (len: %d) tm:%lu stat:%i utf8:%i buddy_icon: %i", me, who, msg, lstrlenA(msg), tm, stat, utf8, buddy_icon));
+ LOG(("YAHOO_GOT_IM id:%s %s: %s (len: %d) tm:%lu stat:%i utf8:%i buddy_icon: %i", me, who, msg, mir_strlen(msg), tm, stat, utf8, buddy_icon));
if (stat == 2) {
char z[1024];
@@ -68,7 +68,7 @@ void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, cons
}
// make a bigger buffer for \n -> \r\n conversion (x2)
- umsg = (char *) alloca(lstrlenA(msg) * 2 + 1);
+ umsg = (char *) alloca(mir_strlen(msg) * 2 + 1);
while ( *c != '\0') {
// Strip the font tag
@@ -76,19 +76,19 @@ void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, cons
// strip the fade tag
!_strnicmp(c, "<FADE ",6) || !_strnicmp(c,"</FADE>",7) ||
// strip the alternate colors tag
- !_strnicmp(c, "<ALT ",5) || !_strnicmp(c, "</ALT>",6)) {
- while ((*c++ != '>') && (*c != '\0'));
+ !_strnicmp(c, "<ALT ",5) || !_strnicmp(c, "</ALT>",6)) {
+ while ((*c++ != '>') && (*c != '\0'));
} else
// strip ANSI color combination
- if ((*c == 0x1b) && (*(c+1) == '[')) {
- while ((*c++ != 'm') && (*c != '\0'));
+ if ((*c == 0x1b) && (*(c+1) == '[')) {
+ while ((*c++ != 'm') && (*c != '\0'));
} else
if (*c != '\0') {
umsg[oidx++] = *c;
/* Adding \r to \r\n conversion */
- if (*c == '\r' && *(c + 1) != '\n')
+ if (*c == '\r' && *(c + 1) != '\n')
umsg[oidx++] = '\n';
c++;
@@ -115,16 +115,16 @@ void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, cons
DBEVENTINFO dbei = { sizeof (dbei) };
dbei.pBlob = (BYTE*)&dummy;
dbei.cbBlob = 2;
- if (!db_event_get(hEvent, &dbei))
+ if (!db_event_get(hEvent, &dbei))
// got that event, if newer than ts then reset to current time
if ((DWORD)tm < dbei.timestamp) tm = (long)time(NULL);
}
pre.timestamp = (DWORD)time(NULL);
-
+
if ((DWORD)tm < pre.timestamp)
pre.timestamp = tm;
-
+
}
else pre.timestamp = (DWORD)time(NULL);
@@ -146,7 +146,7 @@ void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, cons
if (buddy_icon != 2)
reset_avatar(hContact);
else if (getDword(hContact, "PictCK", 0) == 0) /* request the buddy image */
- request_avatar(who);
+ request_avatar(who);
}
////////////////////////////////////////////////////////////////////////////////////////
@@ -180,13 +180,13 @@ int __cdecl CYahooProto::SendMsg(MCONTACT hContact, int flags, const char* pszSr
ptrA msg;
if (flags & PREF_UNICODE) /* convert to utf8 */
- msg = mir_utf8encodeW((wchar_t*)&pszSrc[strlen(pszSrc) + 1]);
+ msg = mir_utf8encodeW((wchar_t*)&pszSrc[mir_strlen(pszSrc) + 1]);
else if (flags & PREF_UTF)
msg = mir_strdup(pszSrc);
else
msg = mir_utf8encode(pszSrc);
- if (lstrlenA(msg) > 800) {
+ if (mir_strlen(msg) > 800) {
ForkThread(&CYahooProto::im_sendackfail_longmsg, (void*)hContact);
return 1;
}
diff --git a/protocols/Yahoo/src/libyahoo2/config.h b/protocols/Yahoo/src/libyahoo2/config.h
index 5de1dbc82d..4b776e5447 100644
--- a/protocols/Yahoo/src/libyahoo2/config.h
+++ b/protocols/Yahoo/src/libyahoo2/config.h
@@ -25,11 +25,6 @@
#include <windows.h>
#include <stdio.h>
-#define strlen lstrlenA
-#define strcat lstrcatA
-#define strcmp lstrcmpA
-#define strcpy lstrcpyA
-
#ifdef _MSC_VER
#define strncasecmp strnicmp
diff --git a/protocols/Yahoo/src/libyahoo2/libyahoo2.cpp b/protocols/Yahoo/src/libyahoo2/libyahoo2.cpp
index aa365d8631..dbad69d900 100644
--- a/protocols/Yahoo/src/libyahoo2/libyahoo2.cpp
+++ b/protocols/Yahoo/src/libyahoo2/libyahoo2.cpp
@@ -901,34 +901,34 @@ static void yahoo_packet_dump(unsigned char *data, int len)
for (i = 0; i < len; i++) {
if ((i % 8 == 0) && i)
//YAHOO_CALLBACK(ext_yahoo_log)(" ");
- lstrcatA(z, " ");
+ mir_strcat(z, " ");
if ((i % 16 == 0) && i)
- lstrcatA(z, "\n");
+ mir_strcat(z, "\n");
wsprintfA(t, "%02x ", data[i]);
- lstrcatA(z, t);
+ mir_strcat(z, t);
}
- lstrcatA(z, "\n");
+ mir_strcat(z, "\n");
YAHOO_CALLBACK(ext_yahoo_log)(z);
z[0]='\0';
for (i = 0; i < len; i++) {
if ((i % 8 == 0) && i)
//YAHOO_CALLBACK(ext_yahoo_log)(" ");
- lstrcatA(z, " ");
+ mir_strcat(z, " ");
if ((i % 16 == 0) && i)
//YAHOO_CALLBACK(ext_yahoo_log)("\n");
- lstrcatA(z, "\n");
+ mir_strcat(z, "\n");
if (isprint(data[i])) {
//YAHOO_CALLBACK(ext_yahoo_log)(" %c ", data[i]);
wsprintfA(t, " %c ", data[i]);
- lstrcatA(z, t);
+ mir_strcat(z, t);
} else
//YAHOO_CALLBACK(ext_yahoo_log)(" . ");
- lstrcatA(z, " . ");
+ mir_strcat(z, " . ");
}
//YAHOO_CALLBACK(ext_yahoo_log)("\n");
- lstrcatA(z, "\n");
+ mir_strcat(z, "\n");
YAHOO_CALLBACK(ext_yahoo_log)(z);
}
}
@@ -1347,7 +1347,7 @@ char *yahoo_decode(const char *t)
int i, k;
n = y;
- end = t + lstrlenA(t);
+ end = t + mir_strlen(t);
for (p = t; p < end; p++, n++) {
if (*p == '\\') {
diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp
index d192490718..74d562df93 100644
--- a/protocols/Yahoo/src/proto.cpp
+++ b/protocols/Yahoo/src/proto.cpp
@@ -433,8 +433,8 @@ int __cdecl CYahooProto::SetStatus(int iNewStatus)
* Load Yahoo ID from the database.
*/
if (!getString(YAHOO_LOGINID, &dbv)) {
- if (lstrlenA(dbv.pszVal) > 0)
- lstrcpynA(m_yahoo_id, dbv.pszVal, 255);
+ if (mir_strlen(dbv.pszVal) > 0)
+ mir_strncpy(m_yahoo_id, dbv.pszVal, 255);
else
err++;
db_free(&dbv);
@@ -445,11 +445,11 @@ int __cdecl CYahooProto::SetStatus(int iNewStatus)
}
if (err)
- lstrcpynA(errmsg, Translate("Please enter your Yahoo ID in Options/Network/Yahoo"), 80);
+ mir_strncpy(errmsg, Translate("Please enter your Yahoo ID in Options/Network/Yahoo"), 80);
else {
if (!getString(YAHOO_PASSWORD, &dbv)) {
- if (lstrlenA(dbv.pszVal) > 0)
- lstrcpynA(m_password, dbv.pszVal, 255);
+ if (mir_strlen(dbv.pszVal) > 0)
+ mir_strncpy(m_password, dbv.pszVal, 255);
else
err++;
@@ -461,7 +461,7 @@ int __cdecl CYahooProto::SetStatus(int iNewStatus)
}
if (err)
- lstrcpynA(errmsg, Translate("Please enter your Yahoo password in Options/Network/Yahoo"), 80);
+ mir_strncpy(errmsg, Translate("Please enter your Yahoo password in Options/Network/Yahoo"), 80);
}
if (err != 0) {
@@ -477,7 +477,7 @@ int __cdecl CYahooProto::SetStatus(int iNewStatus)
FREE(m_pw_token); // No Token yet.
if (!getString(YAHOO_PWTOKEN, &dbv)) {
- if (lstrlenA(dbv.pszVal) > 0)
+ if (mir_strlen(dbv.pszVal) > 0)
m_pw_token = strdup(dbv.pszVal);
db_free(&dbv);
@@ -527,7 +527,7 @@ void __cdecl CYahooProto::get_status_thread(void *param)
}
if (!db_get_s(hContact, "CList", "StatusMsg", &dbv)) {
- if (lstrlenA(dbv.pszVal) >= 1)
+ if (mir_strlen(dbv.pszVal) >= 1)
sm = strdup(dbv.pszVal);
db_free(&dbv);
@@ -540,34 +540,34 @@ void __cdecl CYahooProto::get_status_thread(void *param)
l = 0;
if (gm)
- l += lstrlenA(gm) + 3;
+ l += mir_strlen(gm) + 3;
- l += lstrlenA(sm) + 1;
+ l += mir_strlen(sm) + 1;
fm = (char *)malloc(l);
fm[0] = '\0';
- if (gm && lstrlenA(gm) > 0) {
+ if (gm && mir_strlen(gm) > 0) {
/* BAH YAHOO SUCKS! WHAT A PAIN!
find first carriage return add status message then add the rest */
char *c = strchr(gm, '\r');
if (c != NULL) {
- lstrcpynA(fm, gm, c - gm + 1);
+ mir_strncpy(fm, gm, c - gm + 1);
fm[c - gm + 1] = '\0';
}
else
- lstrcpyA(fm, gm);
+ mir_strcpy(fm, gm);
if (sm) {
- lstrcatA(fm, ": ");
- lstrcatA(fm, sm);
+ mir_strcat(fm, ": ");
+ mir_strcat(fm, sm);
}
if (c != NULL)
- lstrcatA(fm, c);
+ mir_strcat(fm, c);
}
else if (sm) {
- lstrcatA(fm, sm);
+ mir_strcat(fm, sm);
}
FREE(sm);
diff --git a/protocols/Yahoo/src/search.cpp b/protocols/Yahoo/src/search.cpp
index 065539b674..020c9c34b3 100644
--- a/protocols/Yahoo/src/search.cpp
+++ b/protocols/Yahoo/src/search.cpp
@@ -24,7 +24,7 @@ void __cdecl CYahooProto::search_simplethread(void *snsearch)
{
TCHAR *id = (TCHAR *) snsearch;
- if (lstrlen(id) < 4) {
+ if (mir_tstrlen(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;
@@ -167,7 +167,7 @@ void __cdecl CYahooProto::searchadv_thread(void *pHWND)
TCHAR searchid[128];
GetDlgItemText(hwndDlg, IDC_SEARCH_ID, searchid, SIZEOF(searchid));
- if (lstrlen(searchid) == 0) {
+ if (mir_tstrlen(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/services.cpp b/protocols/Yahoo/src/services.cpp
index f2b179c870..108c893eb1 100644
--- a/protocols/Yahoo/src/services.cpp
+++ b/protocols/Yahoo/src/services.cpp
@@ -127,7 +127,7 @@ static INT_PTR CALLBACK DlgProcSetCustStat(HWND hwndDlg, UINT msg, WPARAM wParam
if ( !ppro->getString(YAHOO_CUSTSTATDB, &dbv)) {
SetDlgItemTextA(hwndDlg, IDC_CUSTSTAT, dbv. pszVal );
- EnableWindow( GetDlgItem(hwndDlg, IDOK ), lstrlenA(dbv.pszVal) > 0);
+ EnableWindow( GetDlgItem(hwndDlg, IDOK ), mir_strlen(dbv.pszVal) > 0);
db_free(&dbv);
}
else {
@@ -366,8 +366,8 @@ INT_PTR __cdecl CYahooProto::GetUnreadEmailCount(WPARAM wParam, LPARAM lParam)
void CYahooProto::MenuMainInit( void )
{
char servicefunction[ 100 ];
- lstrcpyA( servicefunction, m_szModuleName);
- char* tDest = servicefunction + lstrlenA( servicefunction );
+ mir_strcpy( servicefunction, m_szModuleName);
+ char* tDest = servicefunction + mir_strlen( servicefunction );
CLISTMENUITEM mi = { sizeof(mi) };
mi.pszService = servicefunction;
@@ -391,7 +391,7 @@ void CYahooProto::MenuMainInit( void )
mi.hParentMenu = hRoot;
// Show custom status menu
- lstrcpyA( tDest, YAHOO_SET_CUST_STAT );
+ mir_strcpy( tDest, YAHOO_SET_CUST_STAT );
CreateProtoService(YAHOO_SET_CUST_STAT, &CYahooProto::SetCustomStatCommand);
mi.position = 290000;
@@ -401,7 +401,7 @@ void CYahooProto::MenuMainInit( void )
menuItemsAll[0] = Menu_AddProtoMenuItem(&mi);
// Edit My profile
- lstrcpyA( tDest, YAHOO_EDIT_MY_PROFILE );
+ mir_strcpy( tDest, YAHOO_EDIT_MY_PROFILE );
CreateProtoService(YAHOO_EDIT_MY_PROFILE, &CYahooProto::OnEditMyProfile);
mi.position = 290005;
@@ -410,7 +410,7 @@ void CYahooProto::MenuMainInit( void )
menuItemsAll[1] = Menu_AddProtoMenuItem(&mi);
// Show My profile
- lstrcpyA( tDest, YAHOO_SHOW_MY_PROFILE );
+ mir_strcpy( tDest, YAHOO_SHOW_MY_PROFILE );
CreateProtoService(YAHOO_SHOW_MY_PROFILE, &CYahooProto::OnShowMyProfileCommand);
mi.position = 290006;
@@ -419,7 +419,7 @@ void CYahooProto::MenuMainInit( void )
menuItemsAll[2] = Menu_AddProtoMenuItem(&mi);
// Show Yahoo mail
- strcpy( tDest, YAHOO_YAHOO_MAIL );
+ mir_strcpy( tDest, YAHOO_YAHOO_MAIL );
CreateProtoService(YAHOO_YAHOO_MAIL, &CYahooProto::OnGotoMailboxCommand);
mi.position = 290010;
@@ -428,7 +428,7 @@ void CYahooProto::MenuMainInit( void )
menuItemsAll[3] = Menu_AddProtoMenuItem(&mi);
// Show Address Book
- strcpy(tDest, YAHOO_AB);
+ mir_strcpy(tDest, YAHOO_AB);
CreateProtoService(YAHOO_AB, &CYahooProto::OnABCommand);
mi.position = 290015;
@@ -437,45 +437,34 @@ void CYahooProto::MenuMainInit( void )
menuItemsAll[4] = Menu_AddProtoMenuItem(&mi);
// Show Calendar
- strcpy( tDest, YAHOO_CALENDAR );
+ mir_strcpy( tDest, YAHOO_CALENDAR );
CreateProtoService(YAHOO_CALENDAR, &CYahooProto::OnCalendarCommand);
mi.position = 290017;
mi.icolibItem = GetIconHandle( IDI_CALENDAR );
mi.pszName = LPGEN("&Calendar");
menuItemsAll[5] = Menu_AddProtoMenuItem(&mi);
- strcpy( tDest, "/JoinChatRoom");
+ mir_strcpy( tDest, "/JoinChatRoom");
CreateProtoService("/JoinChatRoom", &CYahooProto::CreateConference);
mi.position = 290018;
mi.icolibItem = GetIconHandle(IDI_YAHOO);
mi.pszName = LPGEN("Create Conference");
menuItemsAll[6] = Menu_AddProtoMenuItem(&mi);
-
-
- // Show Refresh
- /*strcpy( tDest, YAHOO_REFRESH );
- CreateProtoService(YAHOO_REFRESH, &CYahooProto::OnRefreshCommand);
-
- mi.position = 500090015;
- mi.icolibItem = GetIconHandle( IDI_REFRESH );
- mi.pszName = LPGEN("&Refresh");
- menuItemsAll[7] = Menu_AddProtoMenuItem(&mi);
- */
}
void CYahooProto::MenuContactInit( void )
{
char servicefunction[ 100 ];
- lstrcpyA( servicefunction, m_szModuleName);
- char* tDest = servicefunction + lstrlenA( servicefunction );
+ mir_strcpy( servicefunction, m_szModuleName);
+ char* tDest = servicefunction + mir_strlen( servicefunction );
CLISTMENUITEM mi = { sizeof(mi) };
mi.pszService = servicefunction;
mi.pszContactOwner = m_szModuleName;
// Show Profile
- strcpy( tDest, YAHOO_SHOW_PROFILE );
+ mir_strcpy( tDest, YAHOO_SHOW_PROFILE );
CreateProtoService(YAHOO_SHOW_PROFILE, &CYahooProto::OnShowProfileCommand );
mi.position = -2000006000;
diff --git a/protocols/Yahoo/src/user_info.cpp b/protocols/Yahoo/src/user_info.cpp
index 85f26616c7..40a035284c 100644
--- a/protocols/Yahoo/src/user_info.cpp
+++ b/protocols/Yahoo/src/user_info.cpp
@@ -1,9 +1,9 @@
/*
* $Id: proto.cpp 9802 2009-05-18 03:03:48Z gena01 $
*
- * myYahoo Miranda Plugin
+ * myYahoo Miranda Plugin
*
- * Authors: Gennady Feldman (aka Gena01)
+ * Authors: Gennady Feldman (aka Gena01)
* Laurent Marechal (aka Peorth)
*
* This code is under GPL and is based on AIM, MSN and Miranda source code.
@@ -30,7 +30,7 @@ static INT_PTR CALLBACK YahooUserInfoDlgProc( HWND hwndDlg, UINT msg, WPARAM wPa
//SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadSkinnedIcon(SKINICON_OTHER_USERDETAILS));
-
+
break;
case WM_NOTIFY:
@@ -61,39 +61,39 @@ static INT_PTR CALLBACK YahooUserInfoDlgProc( HWND hwndDlg, UINT msg, WPARAM wPa
if (hContact) {
DBVARIANT dbv;
char z[128];
-
+
if (ppro->getString( hContact, YAHOO_LOGINID, &dbv) == 0) {
- strcpy(z, dbv.pszVal);
+ mir_strcpy(z, dbv.pszVal);
db_free(&dbv);
} else {
- strcpy(z, "???");
+ mir_strcpy(z, "???");
}
-
+
SetDlgItemTextA(hwndDlg, IDC_SEARCH_ID, z);
-
+
if (ppro->getString( hContact, "Transport", &dbv) == 0) {
- strcpy(z, dbv.pszVal);
+ mir_strcpy(z, dbv.pszVal);
db_free(&dbv);
} else {
- strcpy(z, "Yahoo");
+ mir_strcpy(z, "Yahoo");
}
-
+
SetDlgItemTextA(hwndDlg, IDC_SEARCH_PROTOCOL, z);
-
+
if (ppro->getString( hContact, "MirVer", &dbv) == 0) {
- strcpy(z, dbv.pszVal);
+ mir_strcpy(z, dbv.pszVal);
db_free(&dbv);
} else {
- strcpy(z, "???");
+ mir_strcpy(z, "???");
}
-
+
SetDlgItemTextA(hwndDlg, IDC_NFO_CLIENT, z);
-
+
} else {
}
}
break;
- }
+ }
}
break;
@@ -102,7 +102,7 @@ static INT_PTR CALLBACK YahooUserInfoDlgProc( HWND hwndDlg, UINT msg, WPARAM wPa
break;
case WM_DESTROY:
-
+
break;
}
return FALSE;
@@ -125,7 +125,6 @@ int __cdecl CYahooProto::OnUserInfoInit( WPARAM wParam, LPARAM lParam )
odp.pszTemplate = MAKEINTRESOURCEA( IDD_USER_INFO );
odp.ptszTitle = m_tszUserName;
UserInfo_AddPage(wParam, &odp);
- }
+ }
return 0;
}
-
diff --git a/protocols/Yahoo/src/util.cpp b/protocols/Yahoo/src/util.cpp
index e806efb274..46e84b09c6 100644
--- a/protocols/Yahoo/src/util.cpp
+++ b/protocols/Yahoo/src/util.cpp
@@ -111,8 +111,8 @@ int CYahooProto::ShowPopup(const TCHAR* nickname, const TCHAR* msg, const char *
POPUPDATAT ppd = { 0 };
ppd.PluginWindowProc = PopupWindowProc;
- lstrcpyn(ppd.lptzContactName, nickname, SIZEOF(ppd.lptzContactName));
- lstrcpyn(ppd.lptzText, msg, SIZEOF(ppd.lptzText));
+ mir_tstrncpy(ppd.lptzContactName, nickname, SIZEOF(ppd.lptzContactName));
+ mir_tstrncpy(ppd.lptzText, msg, SIZEOF(ppd.lptzText));
if (szURL != NULL) {
ppd.lchIcon = LoadIconEx( !lstrcmpiA(szURL, "http://mail.yahoo.com") ? "mail" : "calendar");
diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp
index 7ecf6dc61f..67a150e60a 100644
--- a/protocols/Yahoo/src/yahoo.cpp
+++ b/protocols/Yahoo/src/yahoo.cpp
@@ -324,7 +324,7 @@ MCONTACT CYahooProto::add_buddy(const char *yahoo_id, const char *yahoo_name, in
setString( hContact, YAHOO_LOGINID, yid );
Set_Protocol( hContact, protocol );
- if (lstrlenA(yahoo_name) > 0)
+ if (mir_strlen(yahoo_name) > 0)
SetStringUtf( hContact, "Nick", yahoo_name );
else
SetStringUtf( hContact, "Nick", yahoo_id );
@@ -820,16 +820,16 @@ void CYahooProto::ext_contact_added(const char *myid, const char *who, const cha
pre.flags = PREF_UTF;
pre.timestamp = time(NULL);
- pre.lParam = sizeof(DWORD)+sizeof(HANDLE)+lstrlenA(who)+lstrlenA(nick)+5;
+ pre.lParam = sizeof(DWORD)+sizeof(HANDLE)+mir_strlen(who)+mir_strlen(nick)+5;
if (fname != NULL)
- pre.lParam += lstrlenA(fname);
+ pre.lParam += mir_strlen(fname);
if (lname != NULL)
- pre.lParam += lstrlenA(lname);
+ pre.lParam += mir_strlen(lname);
if (msg != NULL)
- pre.lParam += lstrlenA(msg);
+ pre.lParam += mir_strlen(msg);
pCurBlob = (PBYTE)malloc(pre.lParam);
pre.szMessage = (char *)pCurBlob;
@@ -843,24 +843,24 @@ void CYahooProto::ext_contact_added(const char *myid, const char *who, const cha
pCurBlob += sizeof(DWORD);
// NICK
- lstrcpyA((char*)pCurBlob, nick);
+ mir_strcpy((char*)pCurBlob, nick);
- pCurBlob+=lstrlenA((char *)pCurBlob)+1;
+ pCurBlob+=mir_strlen((char *)pCurBlob)+1;
// FIRST
- lstrcpyA((char*)pCurBlob, (fname != NULL) ? fname : "");
- pCurBlob+=lstrlenA((char *)pCurBlob)+1;
+ mir_strcpy((char*)pCurBlob, (fname != NULL) ? fname : "");
+ pCurBlob+=mir_strlen((char *)pCurBlob)+1;
// LAST
- lstrcpyA((char*)pCurBlob, (lname != NULL) ? lname : "");
- pCurBlob+=lstrlenA((char *)pCurBlob)+1;
+ mir_strcpy((char*)pCurBlob, (lname != NULL) ? lname : "");
+ pCurBlob+=mir_strlen((char *)pCurBlob)+1;
// E-mail
- lstrcpyA((char*)pCurBlob,who);
- pCurBlob+=lstrlenA((char *)pCurBlob)+1;
+ mir_strcpy((char*)pCurBlob,who);
+ pCurBlob+=mir_strlen((char *)pCurBlob)+1;
// Reason
- lstrcpyA((char*)pCurBlob, (msg != NULL) ? msg : "");
+ mir_strcpy((char*)pCurBlob, (msg != NULL) ? msg : "");
ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre);
}
@@ -929,7 +929,7 @@ void CYahooProto::ext_game_notify(const char *me, const char *who, int stat, con
* [17:18:38 YAHOO] [ext_yahoo_game_notify] id: 1, me: xxxxx, who: rrrrr,
* stat: 2, msg: 1 ygamesa 2
*/
- z = (char *) _alloca(lstrlenA(l) + 50);
+ z = (char *) _alloca(mir_strlen(l) + 50);
z[0]='\0';
do{
@@ -950,16 +950,16 @@ void CYahooProto::ext_game_notify(const char *me, const char *who, int stat, con
if (c != NULL) {
(*c) = '\0';
- lstrcatA(z, l);
- lstrcatA(z, "\r\n");
+ mir_strcat(z, l);
+ mir_strcat(z, "\r\n");
l = c + 1;
} else {
- lstrcatA(z, l);
+ mir_strcat(z, l);
}
} while (c != NULL);
- lstrcatA(z, "\r\n\r\nhttp://games.yahoo.com/games/");
- lstrcatA(z, u);
+ mir_strcat(z, "\r\n\r\nhttp://games.yahoo.com/games/");
+ mir_strcat(z, u);
c = strchr(z, 0x09);
(*c) = '\0';
}
@@ -1557,8 +1557,8 @@ void CYahooProto::ext_login(enum yahoo_status login_mode)
}
}
- lstrcpynA(fthost,getByte("YahooJapan",0)?"filetransfer.msg.yahoo.co.jp":"filetransfer.msg.yahoo.com" , sizeof(fthost));
- lstrcpynA(login_host,getByte("YahooJapan",0)?"login.yahoo.co.jp":"login.yahoo.com" , sizeof(login_host));
+ mir_strncpy(fthost,getByte("YahooJapan",0)?"filetransfer.msg.yahoo.co.jp":"filetransfer.msg.yahoo.com" , sizeof(fthost));
+ mir_strncpy(login_host,getByte("YahooJapan",0)?"login.yahoo.co.jp":"login.yahoo.com" , sizeof(login_host));
port = getWord(NULL, YAHOO_LOGINPORT, YAHOO_DEFAULT_PORT);
#ifdef HTTP_GATEWAY