diff options
author | George Hazan <george.hazan@gmail.com> | 2014-11-30 18:51:36 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-11-30 18:51:36 +0000 |
commit | 688f55ba998c19304a29727c910504903f4cc49a (patch) | |
tree | 69121ebb6d02bcf9e670428b11813087fc7f1640 /protocols/JabberG | |
parent | 4f0e30cdf56fbafdf955bbe8b93930bab9e39bd0 (diff) |
lstr* replacements
git-svn-id: http://svn.miranda-ng.org/main/trunk@11176 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG')
25 files changed, 88 insertions, 88 deletions
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);
|