diff options
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/AimOscar/src/popup.cpp | 2 | ||||
-rw-r--r-- | protocols/FacebookRM/src/proto.cpp | 2 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/image.cpp | 2 | ||||
-rw-r--r-- | protocols/IRCG/src/options.cpp | 4 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_chat.cpp | 10 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_disco.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_rc.cpp | 4 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_svc.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_userinfo.cpp | 6 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_functions.cpp | 2 | ||||
-rw-r--r-- | protocols/Sametime/src/files.cpp | 4 | ||||
-rw-r--r-- | protocols/Twitter/src/proto.cpp | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/misc.cpp | 6 | ||||
-rw-r--r-- | protocols/Yahoo/src/avatar.cpp | 6 |
14 files changed, 29 insertions, 25 deletions
diff --git a/protocols/AimOscar/src/popup.cpp b/protocols/AimOscar/src/popup.cpp index 107908da51..c561994451 100644 --- a/protocols/AimOscar/src/popup.cpp +++ b/protocols/AimOscar/src/popup.cpp @@ -80,7 +80,7 @@ void CAimProto::ShowPopup(const char* msg, int flags, char* url) }
TCHAR *msgt = (flags & TCHAR_POPUP) ? mir_tstrdup((TCHAR*)msg) : mir_a2t(msg);
- mir_sntprintf(ppd.lptzText, SIZEOF(ppd.lptzText), _T("%s"), TranslateTS(msgt));
+ _tcsncpy_s(ppd.lptzText, TranslateTS(msgt), _TRUNCATE);
mir_free(msgt);
if (!ServiceExists(MS_POPUP_ADDPOPUPT))
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index a5443be932..8d76eb94f7 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -427,7 +427,7 @@ int FacebookProto::OnEvent(PROTOEVENTTYPE event, WPARAM wParam, LPARAM lParam) INT_PTR FacebookProto::SvcCreateAccMgrUI(WPARAM wParam, LPARAM lParam) { - return (int)CreateDialogParam(g_hInstance,MAKEINTRESOURCE(IDD_FACEBOOKACCOUNT), + return (INT_PTR)CreateDialogParam(g_hInstance,MAKEINTRESOURCE(IDD_FACEBOOKACCOUNT), (HWND)lParam, FBAccountProc, (LPARAM)this); } diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp index 213e24b51e..fd7ef6e2ab 100644 --- a/protocols/Gadu-Gadu/src/image.cpp +++ b/protocols/Gadu-Gadu/src/image.cpp @@ -836,7 +836,7 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) mir_sntprintf(szPath + tPathLen, MAX_PATH - tPathLen, _T("\\%s"), dat->lpszFileName);
if ((pImgext = gg_img_hasextension(szPath)) == NULL)
pImgext = szPath + _tcslen(szPath);
- mir_sntprintf(imgext, SIZEOF(imgext), _T("%s"), pImgext);
+ _tcsncpy_s(imgext, pImgext, _TRUNCATE);
for (i = 1; ; ++i)
{
if ((res = gg_img_isexists(szPath, dat)) != -1) break;
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index 85097b5146..5fa543c8d1 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -712,7 +712,7 @@ void CConnectPrefsDlg::OnApply() m_nick.GetText(m_proto->m_nick, SIZEOF(m_proto->m_nick));
removeSpaces(m_proto->m_nick);
- mir_sntprintf(m_proto->m_pNick, SIZEOF(m_proto->m_pNick), _T("%s"), m_proto->m_nick);
+ _tcsncpy_s(m_proto->m_pNick, m_proto->m_nick, _TRUNCATE);
m_nick2.GetText(m_proto->m_alternativeNick, SIZEOF(m_proto->m_alternativeNick));
removeSpaces(m_proto->m_alternativeNick);
m_userID.GetText(m_proto->m_userID, SIZEOF(m_proto->m_userID));
@@ -1815,7 +1815,7 @@ struct CDlgAccMgrUI : public CProtoDlgBase<CIrcProto> m_nick.GetText(m_proto->m_nick, SIZEOF(m_proto->m_nick));
removeSpaces(m_proto->m_nick);
- mir_sntprintf(m_proto->m_pNick, 30, _T("%s"), m_proto->m_nick);
+ _tcsncpy_s(m_proto->m_pNick, m_proto->m_nick, _TRUNCATE);
m_nick2.GetText(m_proto->m_alternativeNick, SIZEOF(m_proto->m_alternativeNick));
removeSpaces(m_proto->m_alternativeNick);
m_userID.GetText(m_proto->m_userID, SIZEOF(m_proto->m_userID));
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index 4692566bef..529d78dbfb 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -1202,8 +1202,9 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* MCONTACT hContact;
JABBER_SEARCH_RESULT jsr = { 0 };
jsr.hdr.cbSize = sizeof(JABBER_SEARCH_RESULT);
- mir_sntprintf(jsr.jid, SIZEOF(jsr.jid), _T("%s"), him->m_tszRealJid);
- if (TCHAR *tmp = _tcschr(jsr.jid, _T('/'))) *tmp = 0;
+ _tcsncpy_s(jsr.jid, him->m_tszRealJid, _TRUNCATE);
+ if (TCHAR *tmp = _tcschr(jsr.jid, _T('/')))
+ *tmp = 0;
JABBER_LIST_ITEM *item = ppro->ListAdd(LIST_VCARD_TEMP, jsr.jid);
ppro->ListAddResource(LIST_VCARD_TEMP, jsr.jid, him->m_iStatus, him->m_tszStatusMessage, him->m_iPriority);
@@ -1218,8 +1219,9 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* JABBER_SEARCH_RESULT jsr = { 0 };
jsr.hdr.cbSize = sizeof(JABBER_SEARCH_RESULT);
jsr.hdr.flags = PSR_TCHAR;
- mir_sntprintf(jsr.jid, SIZEOF(jsr.jid), _T("%s"), him->m_tszRealJid);
- if (TCHAR *tmp = _tcschr(jsr.jid, _T('/'))) *tmp = 0;
+ _tcsncpy_s(jsr.jid, him->m_tszRealJid, _TRUNCATE);
+ if (TCHAR *tmp = _tcschr(jsr.jid, _T('/')))
+ *tmp = 0;
jsr.hdr.nick = jsr.jid;
ADDCONTACTSTRUCT acs = { 0 };
diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp index 66b60174bc..4c21802990 100644 --- a/protocols/JabberG/src/jabber_disco.cpp +++ b/protocols/JabberG/src/jabber_disco.cpp @@ -1412,7 +1412,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM MCONTACT hContact = HContactFromJID(pNode->GetJid());
if (!hContact) {
JABBER_SEARCH_RESULT jsr={0};
- mir_sntprintf(jsr.jid, SIZEOF(jsr.jid), _T("%s"), jid);
+ _tcsncpy_s(jsr.jid, jid, _TRUNCATE);
jsr.hdr.cbSize = sizeof(JABBER_SEARCH_RESULT);
hContact = (MCONTACT)CallProtoService(m_szModuleName, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&jsr);
}
diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp index 2ce34e50d0..9267f68a48 100644 --- a/protocols/JabberG/src/jabber_rc.cpp +++ b/protocols/JabberG/src/jabber_rc.cpp @@ -584,8 +584,8 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe if (cbBlob < dbei.cbBlob) { // rest of message contains a sender's resource
ptrT szOResource( mir_utf8decodeT((LPSTR)dbei.pBlob + cbBlob+1));
mir_sntprintf(szOFrom, SIZEOF(szOFrom), _T("%s/%s"), tszJid, szOResource);
- }
- else mir_sntprintf(szOFrom, SIZEOF(szOFrom), _T("%s"), tszJid);
+ } else
+ _tcsncpy_s(szOFrom, tszJid, _TRUNCATE);
addressesNode << XCHILD(_T("address")) << XATTR(_T("type"), _T("ofrom")) << XATTR(_T("jid"), szOFrom);
addressesNode << XCHILD(_T("address")) << XATTR(_T("type"), _T("oto")) << XATTR(_T("jid"), m_ThreadInfo->fullJID);
diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp index f35fcbda5b..e4176528e4 100644 --- a/protocols/JabberG/src/jabber_svc.cpp +++ b/protocols/JabberG/src/jabber_svc.cpp @@ -536,7 +536,7 @@ INT_PTR __cdecl CJabberProto::JabberSendNudge(WPARAM hContact, LPARAM) if (szResource)
mir_sntprintf(tszJid, SIZEOF(tszJid), _T("%s/%s"), jid, szResource);
else
- mir_sntprintf(tszJid, SIZEOF(tszJid), _T("%s"), jid);
+ _tcsncpy_s(tszJid, jid, _TRUNCATE);
JabberCapsBits jcb = GetResourceCapabilites(tszJid, FALSE);
m_ThreadInfo->send(
diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp index a6a550ea7f..21a511149b 100644 --- a/protocols/JabberG/src/jabber_userinfo.cpp +++ b/protocols/JabberG/src/jabber_userinfo.cpp @@ -281,7 +281,7 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti if (g_JabberFeatCapPairs[i].tszDescription) mir_sntprintf(szDescription, SIZEOF(szDescription), _T("%s (%s)"), TranslateTS(g_JabberFeatCapPairs[i].tszDescription), g_JabberFeatCapPairs[i].szFeature); else - mir_sntprintf(szDescription, SIZEOF(szDescription), _T("%s"), g_JabberFeatCapPairs[i].szFeature); + _tcsncpy_s(szDescription, g_JabberFeatCapPairs[i].szFeature, _TRUNCATE); sttFillInfoLine(hwndTree, htiCaps, NULL, NULL, szDescription, sttInfoLineId(resource, INFOLINE_CAPS, i)); } @@ -291,7 +291,7 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti if (ppro->m_lstJabberFeatCapPairsDynamic[j]->szDescription) mir_sntprintf(szDescription, SIZEOF(szDescription), _T("%s (%s)"), TranslateTS(ppro->m_lstJabberFeatCapPairsDynamic[j]->szDescription), ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature); else - mir_sntprintf(szDescription, SIZEOF(szDescription), _T("%s"), ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature); + _tcsncpy_s(szDescription, ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature, _TRUNCATE); sttFillInfoLine(hwndTree, htiCaps, NULL, NULL, szDescription, sttInfoLineId(resource, INFOLINE_CAPS, i)); } } @@ -322,7 +322,7 @@ static void sttFillAdvStatusInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM ht if (szAdvStatusText && *szAdvStatusText) mir_sntprintf(szText, 2047, _T("%s (%s)"), TranslateTS(szAdvStatusTitle), szAdvStatusText); else - mir_sntprintf(szText, 2047, _T("%s"), TranslateTS(szAdvStatusTitle)); + _tcsncpy_s(szText, TranslateTS(szAdvStatusTitle), _TRUNCATE); sttFillInfoLine(hwndTree, htiRoot, Skin_GetIcon(szAdvStatusIcon), szTitle, szText, dwInfoLine); } diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 1db43cfae1..a0244d2a66 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -872,7 +872,7 @@ void CMraProto::ShowFormattedErrorMessage(LPWSTR lpwszErrText, DWORD dwErrorCode size_t dwErrDescriptionSize;
if (dwErrorCode == NO_ERROR)
- mir_sntprintf(szErrorText, SIZEOF(szErrorText), _T("%s"), TranslateTS(lpwszErrText));
+ _tcsncpy_s(szErrorText, TranslateTS(lpwszErrText), _TRUNCATE);
else {
dwErrDescriptionSize = (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErrorCode, 0, szErrDescription, (SIZEOF(szErrDescription) - sizeof(WCHAR)), NULL) - 2);
szErrDescription[dwErrDescriptionSize] = 0;
diff --git a/protocols/Sametime/src/files.cpp b/protocols/Sametime/src/files.cpp index 29f3a0a077..f890a3f19e 100644 --- a/protocols/Sametime/src/files.cpp +++ b/protocols/Sametime/src/files.cpp @@ -35,8 +35,8 @@ void mwFileTransfer_offered(mwFileTransfer* ft) { TCHAR* messageT = mir_utf8decodeT(message);
mir_sntprintf(descriptionT, SIZEOF(descriptionT), _T("%s - %s"), filenameT, messageT);
mir_free(messageT);
- }
- else mir_sntprintf(descriptionT, SIZEOF(descriptionT), _T("%s"), filenameT);
+ } else
+ _tcsncpy_s(descriptionT, filenameT, _TRUNCATE);
PROTORECVFILET pre = {0};
pre.flags = PREF_TCHAR;
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index b2e333978f..f00c08e7af 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -223,7 +223,7 @@ int TwitterProto::OnEvent(PROTOEVENTTYPE event,WPARAM wParam,LPARAM lParam) INT_PTR TwitterProto::SvcCreateAccMgrUI(WPARAM,LPARAM lParam)
{
- return (int)CreateDialogParam(g_hInstance,MAKEINTRESOURCE(IDD_TWITTERACCOUNT),(HWND)lParam, first_run_dialog, (LPARAM)this );
+ return (INT_PTR)CreateDialogParam(g_hInstance,MAKEINTRESOURCE(IDD_TWITTERACCOUNT),(HWND)lParam, first_run_dialog, (LPARAM)this );
}
INT_PTR TwitterProto::GetName(WPARAM wParam,LPARAM lParam)
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 2bf4fc1aa8..d2201f680f 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -538,10 +538,12 @@ void CVkProto::SetMirVer(MCONTACT hContact, int platform) bool tlstrstr(TCHAR* _s1, TCHAR* _s2)
{
TCHAR s1[1024], s2[1024];
- mir_sntprintf(s1, SIZEOF(s1), _T("%s"), _s1);
- mir_sntprintf(s2, SIZEOF(s2), _T("%s"), _s2);
+
+ _tcsncpy_s(s1, _s1, _TRUNCATE);
CharLowerBuff(s1, SIZEOF(s1));
+ _tcsncpy_s(s2, _s2, _TRUNCATE);
CharLowerBuff(s2, SIZEOF(s2));
+
return _tcsstr(s1, s2) != NULL;
}
diff --git a/protocols/Yahoo/src/avatar.cpp b/protocols/Yahoo/src/avatar.cpp index 7bff4a98e8..f698adb092 100644 --- a/protocols/Yahoo/src/avatar.cpp +++ b/protocols/Yahoo/src/avatar.cpp @@ -616,10 +616,10 @@ void CYahooProto::GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, int cbLen if (hContact != NULL) {
int ck_sum = getDword(hContact, "PictCK", 0);
tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, _T("\\%lX"), ck_sum);
- }
- else tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, _T("\\%S avatar"), m_szModuleName);
+ } else
+ tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, _T("\\%S avatar"), m_szModuleName);
- mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, _T("%s"), type == 1 ? _T(".swf") : _T(".png"));
+ _tcsncpy_s((pszDest + tPathLen), (cbLen - tPathLen), (type == 1 ? _T(".swf") : _T(".png")), _TRUNCATE);
}
INT_PTR __cdecl CYahooProto::GetAvatarInfo(WPARAM wParam,LPARAM lParam)
|