summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Gadu-Gadu/src/gg.h2
-rw-r--r--protocols/IRCG/src/MString.cpp82
-rw-r--r--protocols/IRCG/src/MString.h11
-rw-r--r--protocols/JabberG/src/MString.cpp86
-rw-r--r--protocols/JabberG/src/MString.h11
-rw-r--r--protocols/JabberG/src/jabber_xml.h4
-rw-r--r--protocols/MSN/src/ezxml.c38
-rw-r--r--protocols/Tlen/src/jabber_svc.cpp20
-rw-r--r--protocols/Tlen/src/jabber_util.cpp17
-rw-r--r--protocols/Tlen/src/tlen_avatar.cpp2
-rw-r--r--protocols/Tlen/src/tlen_file.cpp8
-rw-r--r--protocols/Tlen/src/tlen_p2p_new.cpp2
-rw-r--r--protocols/Tlen/src/tlen_p2p_old.cpp6
-rw-r--r--protocols/Twitter/src/oauth.cpp4
-rw-r--r--protocols/WhatsApp/src/WhatsAPI++/utilities.cpp2
-rw-r--r--protocols/Xfire/src/SHA1.cpp8
-rw-r--r--protocols/Xfire/src/Xfire_base.cpp28
-rw-r--r--protocols/Xfire/src/Xfire_icon_mng.cpp2
-rw-r--r--protocols/Xfire/src/Xfire_voicechat.cpp2
-rw-r--r--protocols/Xfire/src/addgamedialog.cpp16
-rw-r--r--protocols/Xfire/src/all_statusmsg.cpp2
-rw-r--r--protocols/Xfire/src/buddylist.cpp2
-rw-r--r--protocols/Xfire/src/clientloginpacket.cpp2
-rw-r--r--protocols/Xfire/src/iniupdater.cpp4
-rw-r--r--protocols/Xfire/src/main.cpp10
-rw-r--r--protocols/Xfire/src/processbuddyinfo.cpp6
-rw-r--r--protocols/Xfire/src/tools.cpp4
-rw-r--r--protocols/Xfire/src/userdetails.cpp16
-rw-r--r--protocols/Xfire/src/variables.cpp4
-rw-r--r--protocols/Yahoo/src/services.cpp8
-rw-r--r--protocols/Yahoo/src/yahoo.cpp2
-rw-r--r--protocols/Yahoo/src/yahoo.h6
32 files changed, 127 insertions, 290 deletions
diff --git a/protocols/Gadu-Gadu/src/gg.h b/protocols/Gadu-Gadu/src/gg.h
index c6ca392ece..4114ea917c 100644
--- a/protocols/Gadu-Gadu/src/gg.h
+++ b/protocols/Gadu-Gadu/src/gg.h
@@ -88,8 +88,6 @@
// Visual C++ extras
#ifdef _MSC_VER
-#define vsnprintf _vsnprintf
-#define snprintf _snprintf
#define GGINLINE
#else
#define GGINLINE inline
diff --git a/protocols/IRCG/src/MString.cpp b/protocols/IRCG/src/MString.cpp
index 70016e427e..bde089d9ac 100644
--- a/protocols/IRCG/src/MString.cpp
+++ b/protocols/IRCG/src/MString.cpp
@@ -6,7 +6,7 @@
CNilMStringData CMBaseString::m_nil;
-CMStringData* CMBaseString::Allocate( int nChars, int nCharSize )
+CMStringData* CMBaseString::Allocate(int nChars, int nCharSize)
{
CMStringData* pData;
nChars++; // nil char
@@ -75,7 +75,7 @@ bool CMStringData::IsShared() const
void CMStringData::Lock()
{
nRefs--; // Locked buffers can't be shared, so no interlocked operation necessary
- if ( nRefs == 0 )
+ if (nRefs == 0)
nRefs = -1;
}
@@ -107,67 +107,14 @@ CNilMStringData::CNilMStringData()
/////////////////////////////////////////////////////////////////////////////////////////
// ChTraitsCRT<wchar_t>
-#if _MSC_VER < 1400
-static HINSTANCE hCrt = NULL;
-
-typedef int ( __cdecl *_vscprintf_func )( LPCSTR pszFormat, va_list args );
-static _vscprintf_func _vscprintf_ptr = NULL;
-
-typedef int ( __cdecl *_vscwprintf_func )( LPCWSTR pszFormat, va_list args );
-static _vscwprintf_func _vscwprintf_ptr = NULL;
-
-typedef int ( __cdecl *_vsnprintf_func )( char*, size_t, const char*, va_list );
-static _vsnprintf_func _vsnprintf_ptr = NULL;
-
-typedef int ( __cdecl *_vsnwprintf_func )( wchar_t *, size_t, const wchar_t *, va_list );
-static _vsnwprintf_func _vsnwprintf_ptr = NULL;
-
-typedef int ( __cdecl *vswprintf_func )( wchar_t *, size_t, const wchar_t *, va_list );
-static vswprintf_func vswprintf_ptr = NULL;
-
-typedef int ( __cdecl *vsprintf_func )( char*, size_t, const char*, va_list );
-static vsprintf_func vsprintf_ptr = NULL;
-
-static void checkCrt( void )
-{
- if ( hCrt == NULL ) {
- hCrt = GetModuleHandleA( "msvcrt.dll" );
- _vscprintf_ptr = (_vscprintf_func)GetProcAddress( hCrt, "_vscprintf" );
- _vscwprintf_ptr = (_vscwprintf_func)GetProcAddress( hCrt, "_vscwprintf" );
- _vsnprintf_ptr = (_vsnprintf_func)GetProcAddress( hCrt, "_vsnprintf" );
- _vsnwprintf_ptr = (_vsnwprintf_func)GetProcAddress( hCrt, "_vsnwprintf" );
- vswprintf_ptr = (vswprintf_func)GetProcAddress( hCrt, "vswprintf" );
- vsprintf_ptr = (vsprintf_func)GetProcAddress( hCrt, "vsprintf" );
-} }
-#endif
-
int __stdcall ChTraitsCRT<wchar_t>::GetFormattedLength( LPCWSTR pszFormat, va_list args )
{
- #if _MSC_VER < 1400
- checkCrt();
-
- if ( _vscwprintf_ptr != NULL )
- return _vscwprintf_ptr( pszFormat, args );
-
- WCHAR buf[ 4000 ];
- return vswprintf_ptr( buf, SIZEOF(buf), pszFormat, args );
- #else
- return _vscwprintf( pszFormat, args );
- #endif
+ return _vscwprintf(pszFormat, args);
}
int __stdcall ChTraitsCRT<wchar_t>::Format( LPWSTR pszBuffer, size_t nLength, LPCWSTR pszFormat, va_list args)
{
- #if _MSC_VER < 1400
- checkCrt();
-
- if ( _vsnwprintf_ptr != NULL )
- return _vsnwprintf_ptr( pszBuffer, nLength, pszFormat, args );
-
- return vswprintf_ptr( pszBuffer, nLength, pszFormat, args );
- #else
- return _vsnwprintf( pszBuffer, nLength, pszFormat, args );
- #endif
+ return _vsnwprintf(pszBuffer, nLength, pszFormat, args);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -175,27 +122,10 @@ int __stdcall ChTraitsCRT<wchar_t>::Format( LPWSTR pszBuffer, size_t nLength, LP
int __stdcall ChTraitsCRT<char>::GetFormattedLength( LPCSTR pszFormat, va_list args )
{
- #if _MSC_VER < 1400
- checkCrt();
-
- if ( _vscprintf_ptr != NULL )
- return _vscprintf_ptr( pszFormat, args );
-
- char buf[4000];
- return vsprintf_ptr( buf, sizeof(buf), pszFormat, args );
- #else
- return _vscprintf( pszFormat, args );
- #endif
+ return _vscprintf(pszFormat, args);
}
int __stdcall ChTraitsCRT<char>::Format( LPSTR pszBuffer, size_t nlength, LPCSTR pszFormat, va_list args )
{
- #if _MSC_VER < 1400
- checkCrt();
-
- return _vsnprintf( pszBuffer, nlength, pszFormat, args );
- #else
- return vsprintf_s( pszBuffer, nlength, pszFormat, args );
- #endif
+ return vsprintf_s(pszBuffer, nlength, pszFormat, args);
}
-
diff --git a/protocols/IRCG/src/MString.h b/protocols/IRCG/src/MString.h
index 7cc16ff4a3..c7291ca393 100644
--- a/protocols/IRCG/src/MString.h
+++ b/protocols/IRCG/src/MString.h
@@ -727,15 +727,6 @@ public:
static int __stdcall GetFormattedLength( LPCSTR pszFormat, va_list args );
- static int __stdcall Format( LPSTR pszBuffer, LPCSTR pszFormat, va_list args )
- {
-#pragma warning (push)
-#pragma warning(disable : 4996)
- return vsprintf( pszBuffer, pszFormat, args );
-#pragma warning (pop)
-
- }
-
static int __stdcall Format( LPSTR pszBuffer, size_t nlength, LPCSTR pszFormat, va_list args );
static int __stdcall GetBaseTypeLength( LPCSTR pszSrc )
@@ -979,7 +970,7 @@ public:
{
#pragma warning (push)
#pragma warning(disable : 4996)
- return vswprintf( pszBuffer, pszFormat, args );
+ return vswprintf( pszBuffer, pszFormat, args ); //!!!!!!!!!!!
#pragma warning (pop)
}
diff --git a/protocols/JabberG/src/MString.cpp b/protocols/JabberG/src/MString.cpp
index 2e11348425..f5772c5f5b 100644
--- a/protocols/JabberG/src/MString.cpp
+++ b/protocols/JabberG/src/MString.cpp
@@ -107,95 +107,25 @@ CNilMStringData::CNilMStringData()
/////////////////////////////////////////////////////////////////////////////////////////
// ChTraitsCRT<wchar_t>
-#if _MSC_VER < 1400
-static HINSTANCE hCrt = NULL;
-
-typedef int (__cdecl *_vscprintf_func)(LPCSTR pszFormat, va_list args);
-static _vscprintf_func _vscprintf_ptr = NULL;
-
-typedef int (__cdecl *_vscwprintf_func)(LPCWSTR pszFormat, va_list args);
-static _vscwprintf_func _vscwprintf_ptr = NULL;
-
-typedef int (__cdecl *_vsnprintf_func)(char*, size_t, const char*, va_list);
-static _vsnprintf_func _vsnprintf_ptr = NULL;
-
-typedef int (__cdecl *_vsnwprintf_func)(wchar_t *, size_t, const wchar_t *, va_list);
-static _vsnwprintf_func _vsnwprintf_ptr = NULL;
-
-typedef int (__cdecl *vswprintf_func)(wchar_t *, size_t, const wchar_t *, va_list);
-static vswprintf_func vswprintf_ptr = NULL;
-
-typedef int (__cdecl *vsprintf_func)(char*, size_t, const char*, va_list);
-static vsprintf_func vsprintf_ptr = NULL;
-
-static void checkCrt(void)
-{
- if (hCrt == NULL) {
- hCrt = GetModuleHandleA("msvcrt.dll");
- _vscprintf_ptr = (_vscprintf_func)GetProcAddress(hCrt, "_vscprintf");
- _vscwprintf_ptr = (_vscwprintf_func)GetProcAddress(hCrt, "_vscwprintf");
- _vsnprintf_ptr = (_vsnprintf_func)GetProcAddress(hCrt, "_vsnprintf");
- _vsnwprintf_ptr = (_vsnwprintf_func)GetProcAddress(hCrt, "_vsnwprintf");
- vswprintf_ptr = (vswprintf_func)GetProcAddress(hCrt, "vswprintf");
- vsprintf_ptr = (vsprintf_func)GetProcAddress(hCrt, "vsprintf");
-} }
-#endif
-
-int __stdcall ChTraitsCRT<wchar_t>::GetFormattedLength(LPCWSTR pszFormat, va_list args)
+int __stdcall ChTraitsCRT<wchar_t>::GetFormattedLength( LPCWSTR pszFormat, va_list args )
{
- #if _MSC_VER < 1400
- checkCrt();
-
- if (_vscwprintf_ptr != NULL)
- return _vscwprintf_ptr(pszFormat, args);
-
- WCHAR buf[ 4000 ];
- return vswprintf_ptr(buf, SIZEOF(buf), pszFormat, args);
- #else
- return _vscwprintf(pszFormat, args);
- #endif
+ return _vscwprintf(pszFormat, args);
}
-int __stdcall ChTraitsCRT<wchar_t>::Format(LPWSTR pszBuffer, size_t nLength, LPCWSTR pszFormat, va_list args)
+int __stdcall ChTraitsCRT<wchar_t>::Format( LPWSTR pszBuffer, size_t nLength, LPCWSTR pszFormat, va_list args)
{
- #if _MSC_VER < 1400
- checkCrt();
-
- if (_vsnwprintf_ptr != NULL)
- return _vsnwprintf_ptr(pszBuffer, nLength, pszFormat, args);
-
- return vswprintf_ptr(pszBuffer, nLength, pszFormat, args);
- #else
- return _vsnwprintf(pszBuffer, nLength, pszFormat, args);
- #endif
+ return _vsnwprintf(pszBuffer, nLength, pszFormat, args);
}
/////////////////////////////////////////////////////////////////////////////////////////
// ChTraitsCRT<char>
-int __stdcall ChTraitsCRT<char>::GetFormattedLength(LPCSTR pszFormat, va_list args)
+int __stdcall ChTraitsCRT<char>::GetFormattedLength( LPCSTR pszFormat, va_list args )
{
- #if _MSC_VER < 1400
- checkCrt();
-
- if (_vscprintf_ptr != NULL)
- return _vscprintf_ptr(pszFormat, args);
-
- char buf[4000];
- return vsprintf_ptr(buf, sizeof(buf), pszFormat, args);
- #else
- return _vscprintf(pszFormat, args);
- #endif
+ return _vscprintf(pszFormat, args);
}
-int __stdcall ChTraitsCRT<char>::Format(LPSTR pszBuffer, size_t nlength, LPCSTR pszFormat, va_list args)
+int __stdcall ChTraitsCRT<char>::Format( LPSTR pszBuffer, size_t nlength, LPCSTR pszFormat, va_list args )
{
- #if _MSC_VER < 1400
- checkCrt();
-
- return _vsnprintf(pszBuffer, nlength, pszFormat, args);
- #else
- return vsprintf_s(pszBuffer, nlength, pszFormat, args);
- #endif
+ return vsprintf_s(pszBuffer, nlength, pszFormat, args);
}
-
diff --git a/protocols/JabberG/src/MString.h b/protocols/JabberG/src/MString.h
index eef6a9a4f3..b524296373 100644
--- a/protocols/JabberG/src/MString.h
+++ b/protocols/JabberG/src/MString.h
@@ -727,15 +727,6 @@ public:
static int __stdcall GetFormattedLength(LPCSTR pszFormat, va_list args);
- static int __stdcall Format(LPSTR pszBuffer, LPCSTR pszFormat, va_list args)
- {
-#pragma warning (push)
-#pragma warning(disable : 4996)
- return vsprintf(pszBuffer, pszFormat, args);
-#pragma warning (pop)
-
- }
-
static int __stdcall Format(LPSTR pszBuffer, size_t nlength, LPCSTR pszFormat, va_list args);
static int __stdcall GetBaseTypeLength(LPCSTR pszSrc)
@@ -979,7 +970,7 @@ public:
{
#pragma warning (push)
#pragma warning(disable : 4996)
- return vswprintf(pszBuffer, pszFormat, args);
+ return vswprintf(pszBuffer, pszFormat, args); //!!!!!!!!!
#pragma warning (pop)
}
diff --git a/protocols/JabberG/src/jabber_xml.h b/protocols/JabberG/src/jabber_xml.h
index 3622707db5..e591e5d852 100644
--- a/protocols/JabberG/src/jabber_xml.h
+++ b/protocols/JabberG/src/jabber_xml.h
@@ -358,7 +358,7 @@ public:
va_list args;
va_start(args, path);
- _vsntprintf(m_buf, BUFSIZE, path, args);
+ mir_vsntprintf(m_buf, BUFSIZE, path, args);
m_buf[BUFSIZE-1] = 0;
va_end(args);
}
@@ -370,7 +370,7 @@ public:
va_list args;
va_start(args, path);
- _vsnprintf(buf, BUFSIZE, path, args);
+ mir_vsnprintf(buf, BUFSIZE, path, args);
buf[BUFSIZE-1] = 0;
MultiByteToWideChar(CP_ACP, 0, buf, -1, m_buf, BUFSIZE);
va_end(args);
diff --git a/protocols/MSN/src/ezxml.c b/protocols/MSN/src/ezxml.c
index a910c1e905..9e166afa6f 100644
--- a/protocols/MSN/src/ezxml.c
+++ b/protocols/MSN/src/ezxml.c
@@ -147,10 +147,10 @@ ezxml_t ezxml_err(ezxml_root_t root, char *s, const char *err, ...)
char *t, fmt[EZXML_ERRL];
for (t = root->s; t < s; t++) if (*t == '\n') line++;
- _snprintf(fmt, EZXML_ERRL, "[error near line %d]: %s", line, err);
+ mir_snprintf(fmt, EZXML_ERRL, "[error near line %d]: %s", line, err);
va_start(ap, err);
- _vsnprintf(root->err, EZXML_ERRL, fmt, ap);
+ mir_vsnprintf(root->err, EZXML_ERRL, fmt, ap);
va_end(ap);
return &root->xml;
@@ -639,13 +639,13 @@ char *ezxml_ampencode(const char *s, size_t len, char **dst, size_t *dlen,
switch (*s) {
case '\0': return *dst;
- case '&': *dlen += sprintf(*dst + *dlen, "&amp;"); break;
- case '<': *dlen += sprintf(*dst + *dlen, "&lt;"); break;
- case '>': *dlen += sprintf(*dst + *dlen, "&gt;"); break;
- case '"': *dlen += sprintf(*dst + *dlen, (a) ? "&quot;" : "\""); break;
-// case '\n': *dlen += sprintf(*dst + *dlen, (a) ? "&#xA;" : "\n"); break;
- case '\t': *dlen += sprintf(*dst + *dlen, (a) ? "&#x9;" : "\t"); break;
-// case '\r': *dlen += sprintf(*dst + *dlen, "&#xD;"); break;
+ case '&': *dlen += sprintf(*dst + *dlen, "&amp;"); break; //!!!!!!!!!!!!!!
+ case '<': *dlen += sprintf(*dst + *dlen, "&lt;"); break; //!!!!!!!!!!!!!!
+ case '>': *dlen += sprintf(*dst + *dlen, "&gt;"); break; //!!!!!!!!!!!!!!
+ case '"': *dlen += sprintf(*dst + *dlen, (a) ? "&quot;" : "\""); break; //!!!!!!!!!!!!!!
+// case '\n': *dlen += sprintf(*dst + *dlen, (a) ? "&#xA;" : "\n"); break; //!!!!!!!!!!!!!!
+ case '\t': *dlen += sprintf(*dst + *dlen, (a) ? "&#x9;" : "\t"); break; //!!!!!!!!!!!!!!
+// case '\r': *dlen += sprintf(*dst + *dlen, "&#xD;"); break; //!!!!!!!!!!!!!!
default: (*dst)[(*dlen)++] = *s;
}
}
@@ -668,15 +668,15 @@ char *ezxml_toxml_r(ezxml_t xml, char **s, size_t *len, size_t *max,
while (*len + strlen(xml->name) + 4 > *max) // reallocate s
*s = realloc(*s, *max += EZXML_BUFSIZE);
- *len += sprintf(*s + *len, "<%s", xml->name); // open tag
+ *len += sprintf(*s + *len, "<%s", xml->name); // open tag //!!!!!!!!!!!!!!
for (i = 0; xml->attr[i]; i += 2) { // tag attributes
if (ezxml_attr(xml, xml->attr[i]) != xml->attr[i + 1]) continue;
while (*len + strlen(xml->attr[i]) + 7 > *max) // reallocate s
*s = realloc(*s, *max += EZXML_BUFSIZE);
- *len += sprintf(*s + *len, " %s=\"", xml->attr[i]);
+ *len += sprintf(*s + *len, " %s=\"", xml->attr[i]); //!!!!!!!!!!!!!!
ezxml_ampencode(xml->attr[i + 1], SIZE_MAX, s, len, max, 1);
- *len += sprintf(*s + *len, "\"");
+ *len += sprintf(*s + *len, "\""); //!!!!!!!!!!!!!!
}
for (i = 0; attr[i] && strcmp(attr[i][0], xml->name); i++);
@@ -686,15 +686,15 @@ char *ezxml_toxml_r(ezxml_t xml, char **s, size_t *len, size_t *max,
while (*len + strlen(attr[i][j]) + 7 > *max) // reallocate s
*s = realloc(*s, *max += EZXML_BUFSIZE);
- *len += sprintf(*s + *len, " %s=\"", attr[i][j]);
+ *len += sprintf(*s + *len, " %s=\"", attr[i][j]); //!!!!!!!!!!!!!!
ezxml_ampencode(attr[i][j + 1], SIZE_MAX, s, len, max, 1);
- *len += sprintf(*s + *len, "\"");
+ *len += sprintf(*s + *len, "\""); //!!!!!!!!!!!!!!
}
if (xml->attr != EZXML_NIL && xml->child == NULL && xml->txt[0] == 0)
- *len += sprintf(*s + *len, "/>");
+ *len += sprintf(*s + *len, "/>"); //!!!!!!!!!!!!!!
else
{
- *len += sprintf(*s + *len, ">");
+ *len += sprintf(*s + *len, ">"); //!!!!!!!!!!!!!!
*s = (xml->child) ? ezxml_toxml_r(xml->child, s, len, max, 0, attr) //child
: ezxml_ampencode(xml->txt, SIZE_MAX, s, len, max, 0); //data
@@ -702,7 +702,7 @@ char *ezxml_toxml_r(ezxml_t xml, char **s, size_t *len, size_t *max,
while (*len + strlen(xml->name) + 4 > *max) // reallocate s
*s = realloc(*s, *max += EZXML_BUFSIZE);
- *len += sprintf(*s + *len, "</%s>", xml->name); // close tag
+ *len += sprintf(*s + *len, "</%s>", xml->name); // close tag //!!!!!!!!!!!!!!
}
while (txt[off] && off < xml->off) off++; // make sure off is within bounds
@@ -732,7 +732,7 @@ char *ezxml_toxml(ezxml_t xml, int addhdr)
if (root->pi[i][k][j - 1] == '>') continue; // not pre-root
while (len + strlen(t = root->pi[i][0]) + strlen(n) + 7 > max)
s = realloc(s, max += EZXML_BUFSIZE);
- len += sprintf(s + len, "<?%s%s%s?>\n", t, *n ? " " : "", n);
+ len += sprintf(s + len, "<?%s%s%s?>\n", t, *n ? " " : "", n); //!!!!!!!!!!!!!!
}
}
@@ -747,7 +747,7 @@ char *ezxml_toxml(ezxml_t xml, int addhdr)
if (root->pi[i][k][j - 1] == '<') continue; // not post-root
while (len + strlen(t = root->pi[i][0]) + strlen(n) + 7 > max)
s = realloc(s, max += EZXML_BUFSIZE);
- len += sprintf(s + len, "\n<?%s%s%s?>", t, *n ? " " : "", n);
+ len += sprintf(s + len, "\n<?%s%s%s?>", t, *n ? " " : "", n); //!!!!!!!!!!!!!!
}
}
return realloc(s, len + 1);
diff --git a/protocols/Tlen/src/jabber_svc.cpp b/protocols/Tlen/src/jabber_svc.cpp
index 43886efe9a..9f8110f01d 100644
--- a/protocols/Tlen/src/jabber_svc.cpp
+++ b/protocols/Tlen/src/jabber_svc.cpp
@@ -831,7 +831,7 @@ HANDLE __cdecl TlenProtocol::SendFile(HANDLE hContact, const PROTOCHAR* szDescri
db_free(&dbv);
id = JabberSerialNext(this);
- _snprintf(idStr, sizeof(idStr), "%d", id);
+ mir_snprintf(idStr, sizeof(idStr), "%d", id);
if ((item=JabberListAdd(this, LIST_FILE, idStr)) != NULL) {
ft->iqId = mir_strdup(idStr);
nick = JabberNickFromJID(ft->jid);
@@ -1237,28 +1237,28 @@ void TlenInitServicesVTbl(TlenProtocol *proto) {
char s[128];
- sprintf(s, "%s%s", proto->m_szModuleName, PS_GETNAME);
+ mir_snprintf(s, SIZEOF(s), "%s%s", proto->m_szModuleName, PS_GETNAME);
CreateServiceFunction_Ex(s, proto, TlenGetName);
- sprintf(s, "%s%s", proto->m_szModuleName, PS_GETAVATARINFO);
+ mir_snprintf(s, SIZEOF(s), "%s%s", proto->m_szModuleName, PS_GETAVATARINFO);
CreateServiceFunction_Ex(s, proto, TlenGetAvatarInfo);
- sprintf(s, "%s%s", proto->m_szModuleName, PS_SEND_NUDGE);
+ mir_snprintf(s, SIZEOF(s), "%s%s", proto->m_szModuleName, PS_SEND_NUDGE);
CreateServiceFunction_Ex(s, proto, TlenSendAlert);
- sprintf(s, "%s%s", proto->m_szModuleName, PS_GETAVATARCAPS);
+ mir_snprintf(s, SIZEOF(s), "%s%s", proto->m_szModuleName, PS_GETAVATARCAPS);
CreateServiceFunction_Ex(s, proto, TlenGetAvatarCaps);
- sprintf(s, "%s%s", proto->m_szModuleName, PS_SETMYAVATART);
+ mir_snprintf(s, SIZEOF(s), "%s%s", proto->m_szModuleName, PS_SETMYAVATART);
CreateServiceFunction_Ex(s, proto, TlenSetMyAvatar);
- sprintf(s, "%s%s", proto->m_szModuleName, PS_GETMYAVATART);
+ mir_snprintf(s, SIZEOF(s), "%s%s", proto->m_szModuleName, PS_GETMYAVATART);
CreateServiceFunction_Ex(s, proto, TlenGetMyAvatar);
- sprintf(s, "%s%s", proto->m_szModuleName, PS_GETSTATUS);
+ mir_snprintf(s, SIZEOF(s), "%s%s", proto->m_szModuleName, PS_GETSTATUS);
CreateServiceFunction_Ex(s, proto, TlenGetStatus);
- sprintf(s, "%s%s", proto->m_szModuleName, PS_CREATEACCMGRUI);
+ mir_snprintf(s, SIZEOF(s), "%s%s", proto->m_szModuleName, PS_CREATEACCMGRUI);
CreateServiceFunction_Ex(s, proto, TlenAccMgrUI);
}
@@ -1272,7 +1272,7 @@ TlenProtocol::TlenProtocol( const char *aProtoName, const TCHAR *aUserName) :
InitializeCriticalSection(&csSend);
char text[_MAX_PATH];
- sprintf(text, "%s/%s", m_szModuleName, "Nudge");
+ mir_snprintf(text, SIZEOF(text), "%s/%s", m_szModuleName, "Nudge");
hTlenNudge = CreateProtoEvent(text);
HookEventObj_Ex(ME_SYSTEM_MODULESLOADED, this, TlenSystemModulesLoaded);
diff --git a/protocols/Tlen/src/jabber_util.cpp b/protocols/Tlen/src/jabber_util.cpp
index a219a5a573..a05c16d87a 100644
--- a/protocols/Tlen/src/jabber_util.cpp
+++ b/protocols/Tlen/src/jabber_util.cpp
@@ -103,7 +103,7 @@ void JabberLog(TlenProtocol *proto, const char *fmt, ...)
va_start(vararg, fmt);
str = (char *) mir_alloc(strsize=2048);
- while (_vsnprintf(str, strsize, fmt, vararg) == -1)
+ while (mir_vsnprintf(str, strsize, fmt, vararg) == -1)
str = (char *) mir_realloc(str, strsize+=2048);
va_end(vararg);
@@ -111,8 +111,9 @@ void JabberLog(TlenProtocol *proto, const char *fmt, ...)
for (p=str; *p != '\0'; p++)
if (*p == '\n' || *p == '\r')
extra++;
- text = (char *) mir_alloc(strlen("TLEN")+2+strlen(str)+2+extra);
- sprintf(text, "[%s]", "TLEN");
+ size_t size = strlen("TLEN") + 2 + strlen(str) + 2 + extra;
+ text = (char *) mir_alloc(size);
+ mir_snprintf(text, size, "[%s]", "TLEN");
for (p=str,q=text+strlen(text); *p != '\0'; p++,q++) {
if (*p == '\r') {
*q = '\\';
@@ -152,7 +153,7 @@ int JabberSend(TlenProtocol *proto, const char *fmt, ...)
va_start(vararg,fmt);
size = 512;
str = (char *) mir_alloc(size);
- while (_vsnprintf(str, size, fmt, vararg) == -1) {
+ while (mir_vsnprintf(str, size, fmt, vararg) == -1) {
size += 512;
str = (char *) mir_realloc(str, size);
}
@@ -263,7 +264,7 @@ char *JabberSha1(char *str)
mir_sha1_finish( &sha, (BYTE* )digest );
if ((result=(char *)mir_alloc(41)) == NULL)
return NULL;
- sprintf(result, "%08x%08x%08x%08x%08x", (int)htonl(digest[0]), (int)htonl(digest[1]), (int)htonl(digest[2]), (int)htonl(digest[3]), (int)htonl(digest[4]));
+ sprintf(result, "%08x%08x%08x%08x%08x", (int)htonl(digest[0]), (int)htonl(digest[1]), (int)htonl(digest[2]), (int)htonl(digest[3]), (int)htonl(digest[4])); //!!!!!!!!!!!
return result;
}
@@ -303,7 +304,7 @@ char *TlenPasswordHash(const char *str)
magic1 &= 0x7fffffff;
magic2 &= 0x7fffffff;
res = (char *) mir_alloc(17);
- sprintf(res, "%08x%08x", magic1, magic2);
+ sprintf(res, "%08x%08x", magic1, magic2); //!!!!!!!!!!!
return res;
}
@@ -329,7 +330,7 @@ char *TlenUrlEncode(const char *str)
case 0x9f: c = (unsigned char) 0xbc; break;
default: c = (unsigned char) *p; break;
}
- sprintf(q, "%%%02X", c);
+ sprintf(q, "%%%02X", c); //!!!!!!!!!!!
q += 2;
}
else {
@@ -606,7 +607,7 @@ void JabberStringAppend(char **str, int *sizeAlloced, const char *fmt, ...)
p = *str + len;
va_start(vararg, fmt);
- while (_vsnprintf(p, size, fmt, vararg) == -1) {
+ while (mir_vsnprintf(p, size, fmt, vararg) == -1) {
size += 2048;
(*sizeAlloced) += 2048;
*str = (char *) mir_realloc(*str, *sizeAlloced);
diff --git a/protocols/Tlen/src/tlen_avatar.cpp b/protocols/Tlen/src/tlen_avatar.cpp
index 28f3953061..340be5869c 100644
--- a/protocols/Tlen/src/tlen_avatar.cpp
+++ b/protocols/Tlen/src/tlen_avatar.cpp
@@ -82,7 +82,7 @@ static void SetAvatar(TlenProtocol *proto, HANDLE hContact, JABBER_LIST_ITEM *it
mir_md5_append( &ctx, ( BYTE* )data, len);
mir_md5_finish( &ctx, ( BYTE* )digest );
- sprintf( md5, "%08x%08x%08x%08x", (int)htonl(digest[0]), (int)htonl(digest[1]), (int)htonl(digest[2]), (int)htonl(digest[3]));
+ sprintf( md5, "%08x%08x%08x%08x", (int)htonl(digest[0]), (int)htonl(digest[1]), (int)htonl(digest[2]), (int)htonl(digest[3])); //!!!!!!!!!!!!!!
if (item != NULL) {
char *hash = item->avatarHash;
item->avatarFormat = format;
diff --git a/protocols/Tlen/src/tlen_file.cpp b/protocols/Tlen/src/tlen_file.cpp
index 856b852292..d45b2b014f 100644
--- a/protocols/Tlen/src/tlen_file.cpp
+++ b/protocols/Tlen/src/tlen_file.cpp
@@ -278,7 +278,7 @@ static void TlenFileSendParse(TLEN_FILE_TRANSFER *ft)
t++;
else
t = ft->files[i];
- _snprintf(filename, sizeof(filename)-1, t);
+ mir_snprintf(filename, sizeof(filename)-1, t);
TlenP2PPacketPackBuffer(packet, filename, sizeof(filename));
}
TlenP2PPacketSend(ft->s, packet);
@@ -574,9 +574,9 @@ void TlenProcessF(XmlNode *node, ThreadData *info)
if ((from=JabberXmlGetAttrValue(node, "f")) != NULL) {
if (strchr(from, '@') == NULL) {
- _snprintf(jid, sizeof(jid), "%s@%s", from, info->server);
+ mir_snprintf(jid, sizeof(jid), "%s@%s", from, info->server);
} else {
- _snprintf(jid, sizeof(jid), "%s", from);
+ mir_snprintf(jid, sizeof(jid), "%s", from);
}
if ((e=JabberXmlGetAttrValue(node, "e")) != NULL) {
@@ -601,7 +601,7 @@ void TlenProcessF(XmlNode *node, ThreadData *info)
}
}
else if (numFiles > 1) {
- _snprintf(szFilename, sizeof(szFilename), Translate("%d Files"), numFiles);
+ mir_snprintf(szFilename, sizeof(szFilename), Translate("%d Files"), numFiles);
}
}
diff --git a/protocols/Tlen/src/tlen_p2p_new.cpp b/protocols/Tlen/src/tlen_p2p_new.cpp
index c4582f72b2..70ec288959 100644
--- a/protocols/Tlen/src/tlen_p2p_new.cpp
+++ b/protocols/Tlen/src/tlen_p2p_new.cpp
@@ -36,7 +36,7 @@ static void logInfo(const char *filename, const char *fmt, ...) {
GetLocalTime(&time);
va_start(vararg, fmt);
str = (char *) mir_alloc(strsize=2048);
- while (_vsnprintf(str, strsize, fmt, vararg) == -1)
+ while (mir_vsnprintf(str, strsize, fmt, vararg) == -1)
str = (char *) realloc(str, strsize+=2048);
va_end(vararg);
fprintf(flog,"%04d-%02d-%02d %02d:%02d:%02d,%03d [%s]",time.wYear,time.wMonth,time.wDay,time.wHour,time.wMinute,time.wSecond,time.wMilliseconds, "INFO");
diff --git a/protocols/Tlen/src/tlen_p2p_old.cpp b/protocols/Tlen/src/tlen_p2p_old.cpp
index 308079097c..da6217abbc 100644
--- a/protocols/Tlen/src/tlen_p2p_old.cpp
+++ b/protocols/Tlen/src/tlen_p2p_old.cpp
@@ -164,7 +164,7 @@ void TlenP2PEstablishOutgoingConnection(TLEN_FILE_TRANSFER *ft, BOOL sendAck)
TlenP2PPacketSetType(packet, TLEN_FILE_PACKET_CONNECTION_REQUEST);
TlenP2PPacketPackDword(packet, 1);
TlenP2PPacketPackDword(packet, (DWORD) atoi(ft->iqId));
- _snprintf(str, sizeof(str), "%08X%s%d", atoi(ft->iqId), proto->threadData->username, atoi(ft->iqId));
+ mir_snprintf(str, sizeof(str), "%08X%s%d", atoi(ft->iqId), proto->threadData->username, atoi(ft->iqId));
hash = TlenSha1(str, (int)strlen(str));
TlenP2PPacketPackBuffer(packet, hash, 20);
mir_free(hash);
@@ -208,12 +208,12 @@ TLEN_FILE_TRANSFER* TlenP2PEstablishIncomingConnection(TlenProtocol *proto, JABB
i = 0;
while ((i=JabberListFindNext(proto, list, i)) >= 0) {
if ((item=JabberListGetItemPtrFromIndex(proto, i)) != NULL) {
- _snprintf(str, sizeof(str), "%d", iqId);
+ mir_snprintf(str, sizeof(str), "%d", iqId);
if (!strcmp(item->ft->iqId, str)) {
char *hash, *nick;
int j;
nick = JabberNickFromJID(item->ft->jid);
- _snprintf(str, sizeof(str), "%08X%s%d", iqId, nick, iqId);
+ mir_snprintf(str, sizeof(str), "%08X%s%d", iqId, nick, iqId);
mir_free(nick);
hash = TlenSha1(str, (int)strlen(str));
for (j=0;j<20;j++) {
diff --git a/protocols/Twitter/src/oauth.cpp b/protocols/Twitter/src/oauth.cpp
index 7a9a761bb6..a0ff221cd2 100644
--- a/protocols/Twitter/src/oauth.cpp
+++ b/protocols/Twitter/src/oauth.cpp
@@ -329,7 +329,7 @@ wstring mir_twitter::OAuthNormalizeUrl( const wstring& url )
if(Compare(brokenURL[L"scheme"], L"http", false) && !(Compare(brokenURL[L"port"], L"80", false)) ||
(Compare(brokenURL[L"scheme"], L"https", false) && !(Compare(brokenURL[L"port"], L"443", false))))
{
- swprintf_s(port, SIZEOF(port), L":%s", brokenURL[L"port"]);
+ mir_snwprintf(port, SIZEOF(port), L":%s", brokenURL[L"port"]);
}
// InternetCrackUrl includes ? and # elements in the path,
@@ -411,7 +411,7 @@ wstring mir_twitter::OAuthCreateTimestamp()
_ASSERTE(ret != -1);
wchar_t buf[100] = {};
- swprintf_s(buf, SIZEOF(buf), L"%I64u", utcNow);
+ mir_snwprintf(buf, SIZEOF(buf), L"%I64u", utcNow);
return buf;
}
diff --git a/protocols/WhatsApp/src/WhatsAPI++/utilities.cpp b/protocols/WhatsApp/src/WhatsAPI++/utilities.cpp
index 7b7af160e7..0ec6e7e962 100644
--- a/protocols/WhatsApp/src/WhatsAPI++/utilities.cpp
+++ b/protocols/WhatsApp/src/WhatsAPI++/utilities.cpp
@@ -1,3 +1,5 @@
+#define _CRT_SECURE_NO_WARNINGS
+
#include "utilities.h"
#include <iostream>
#include <cstdio>
diff --git a/protocols/Xfire/src/SHA1.cpp b/protocols/Xfire/src/SHA1.cpp
index f296b563cd..cd0fe75149 100644
--- a/protocols/Xfire/src/SHA1.cpp
+++ b/protocols/Xfire/src/SHA1.cpp
@@ -232,23 +232,23 @@ void CSHA1::ReportHash(char *szReport, unsigned char uReportType)
if(uReportType == REPORT_HEX)
{
- sprintf(szTemp, "%02X", m_digest[0]);
+ mir_snprintf(szTemp, SIZEOF(szTemp), "%02X", m_digest[0]);
strcat(szReport, szTemp);
for(i = 1; i < 20; i++)
{
- sprintf(szTemp, " %02X", m_digest[i]);
+ mir_snprintf(szTemp, SIZEOF(szTemp), " %02X", m_digest[i]);
strcat(szReport, szTemp);
}
}
else if(uReportType == REPORT_DIGIT)
{
- sprintf(szTemp, "%u", m_digest[0]);
+ mir_snprintf(szTemp, SIZEOF(szTemp), "%u", m_digest[0]);
strcat(szReport, szTemp);
for(i = 1; i < 20; i++)
{
- sprintf(szTemp, " %u", m_digest[i]);
+ mir_snprintf(szTemp, SIZEOF(szTemp), " %u", m_digest[i]);
strcat(szReport, szTemp);
}
}
diff --git a/protocols/Xfire/src/Xfire_base.cpp b/protocols/Xfire/src/Xfire_base.cpp
index a2923968da..13f7c49afa 100644
--- a/protocols/Xfire/src/Xfire_base.cpp
+++ b/protocols/Xfire/src/Xfire_base.cpp
@@ -173,7 +173,7 @@ void Xfire_base::writeStringtoDB(char*name,unsigned int dbid,int id,char*val)
return;
//wert aus der dblesen
- sprintf_s(temp,128,"%s_%i_%i",name,dbid,id);
+ mir_snprintf(temp, 128, "%s_%i_%i", name, dbid, id);
db_set_s(NULL, protocolname, temp,val);
}
@@ -185,7 +185,7 @@ void Xfire_base::writeStringtoDB(char*name,unsigned int dbid,char*val)
return;
//wert aus der dblesen
- sprintf_s(temp,128,"%s_%i",name,dbid);
+ mir_snprintf(temp, 128, "%s_%i", name, dbid);
db_set_s(NULL, protocolname, temp,val);
}
@@ -197,7 +197,7 @@ void Xfire_base::writeUtf8StringtoDB(char*name,unsigned int dbid,int id,char*val
return;
//wert aus der dblesen
- sprintf_s(temp,128,"%s_%i_%i",name,dbid,id);
+ mir_snprintf(temp, 128, "%s_%i_%i", name, dbid, id);
db_set_utf(NULL, protocolname, temp,val);
}
@@ -209,7 +209,7 @@ void Xfire_base::writeUtf8StringtoDB(char*name,unsigned int dbid,char*val)
return;
//wert aus der dblesen
- sprintf_s(temp,128,"%s_%i",name,dbid);
+ mir_snprintf(temp, 128, "%s_%i", name, dbid);
db_set_utf(NULL, protocolname, temp,val);
}
@@ -222,7 +222,7 @@ void Xfire_base::writeBytetoDB(char*name,unsigned int dbid,int val)
return;
//wert aus der dblesen
- sprintf_s(temp,128,"%s_%i",name,dbid);
+ mir_snprintf(temp, 128, "%s_%i", name, dbid);
db_set_b(NULL, protocolname, temp, val);
}
@@ -234,7 +234,7 @@ void Xfire_base::writeWordtoDB(char*name,unsigned int dbid,int val)
return;
//wert aus der dblesen
- sprintf_s(temp,128,"%s_%i",name,dbid);
+ mir_snprintf(temp, 128, "%s_%i", name, dbid);
db_set_w(NULL, protocolname, temp, val);
}
@@ -247,7 +247,7 @@ unsigned char Xfire_base::readBytefromDB(char*name,unsigned int dbid,int default
return 0;
//wert aus der dblesen
- sprintf_s(temp,128,"%s_%i",name,dbid);
+ mir_snprintf(temp, 128, "%s_%i", name, dbid);
return db_get_b(NULL, protocolname, temp, defaultval);
}
@@ -259,7 +259,7 @@ unsigned int Xfire_base::readWordfromDB(char*name,unsigned int dbid,int defaultv
return 0;
//wert aus der dblesen
- sprintf_s(temp,128,"%s_%i",name,dbid);
+ mir_snprintf(temp, 128, "%s_%i", name, dbid);
return db_get_w(NULL, protocolname, temp, defaultval);
}
@@ -271,7 +271,7 @@ BOOL Xfire_base::removeDBEntry(char*name,unsigned int dbid)
return 0;
//wert aus der dblesen
- sprintf_s(temp,128,"%s_%i",name,dbid);
+ mir_snprintf(temp, 128, "%s_%i", name, dbid);
//eintrag entfernen
if(!db_get(NULL, protocolname, temp,&dbv))
@@ -292,7 +292,7 @@ BOOL Xfire_base::removeDBEntry(char*name,unsigned int dbid,int id)
return 0;
//wert aus der dblesen
- sprintf_s(temp,128,"%s_%i_%i",name,dbid,id);
+ mir_snprintf(temp, 128, "%s_%i_%i", name, dbid, id);
//eintrag entfernen
if(!db_get(NULL, protocolname, temp,&dbv))
@@ -463,7 +463,7 @@ BOOL Xfire_base::getIniValue(unsigned int gameid,unsigned int subid,const char*
return FALSE; //kein pfad bug?!?!
if(subid==0) {
- sprintf_s(idstring,15,"%d",gameid);
+ mir_snprintf(idstring, 15, "%d", gameid);
if(xfire_GetPrivateProfileString(idstring, valname, "", out, sizeofout, path))
return TRUE;
@@ -471,7 +471,7 @@ BOOL Xfire_base::getIniValue(unsigned int gameid,unsigned int subid,const char*
subid++;
}
- sprintf_s(idstring,15,"%d_%d",gameid,subid);
+ mir_snprintf(idstring, 15, "%d_%d", gameid, subid);
if(xfire_GetPrivateProfileString(idstring, valname, "", out, sizeofout, path))
return TRUE;
@@ -506,9 +506,9 @@ BOOL Xfire_base::getGamename(unsigned int gameid,char* out,int outsize){
//customnamen laden, wenn vorhanden
DBVARIANT dbv;
char dbstr[80]="";
- sprintf_s(dbstr,XFIRE_MAXSIZEOFGAMENAME,"customgamename_%d",gameid);
+ mir_snprintf(dbstr, XFIRE_MAXSIZEOFGAMENAME, "customgamename_%d", gameid);
if(!db_get(NULL,protocolname,dbstr,&dbv)) {
- sprintf_s(out,outsize,"%s",dbv.pszVal);
+ mir_snprintf(out, outsize, "%s", dbv.pszVal);
db_free(&dbv);
return TRUE;
}
diff --git a/protocols/Xfire/src/Xfire_icon_mng.cpp b/protocols/Xfire/src/Xfire_icon_mng.cpp
index 0a583a6998..14abababea 100644
--- a/protocols/Xfire/src/Xfire_icon_mng.cpp
+++ b/protocols/Xfire/src/Xfire_icon_mng.cpp
@@ -137,7 +137,7 @@ Xfire_icon_cache Xfire_icon_mng::LoadGameIcon(unsigned int gameid) {
if(hIconDll) {
char resourcename[255]="";
//kurznamen des spiels uppercasen und .ICO anhängen
- sprintf_s(resourcename,255,"XF_%s.ICO",shortname);
+ mir_snprintf(resourcename,255,"XF_%s.ICO",shortname);
Xfire_base::strtoupper(resourcename);
//versuche die resource zufinden
diff --git a/protocols/Xfire/src/Xfire_voicechat.cpp b/protocols/Xfire/src/Xfire_voicechat.cpp
index d14ae6f9d5..7a3ce804d2 100644
--- a/protocols/Xfire/src/Xfire_voicechat.cpp
+++ b/protocols/Xfire/src/Xfire_voicechat.cpp
@@ -165,7 +165,7 @@ void Xfire_voicechat::writeToDatabase(SendGameStatus2Packet* packet) {
return;
}
//ip speichern
- sprintf_s(temp,32,"%d.%d.%d.%d:%d",(unsigned char)packet->ip[3],(unsigned char)packet->ip[2],(unsigned char)packet->ip[1],(unsigned char)packet->ip[0],packet->port);
+ mir_snprintf(temp,32,"%d.%d.%d.%d:%d",(unsigned char)packet->ip[3],(unsigned char)packet->ip[2],(unsigned char)packet->ip[1],(unsigned char)packet->ip[0],packet->port);
db_set_s(NULL, protocolname, "VServerIP", temp);
//namen jeh nach id schreiben
switch(packet->gameid) {
diff --git a/protocols/Xfire/src/addgamedialog.cpp b/protocols/Xfire/src/addgamedialog.cpp
index 541d5eca30..0ea63d9219 100644
--- a/protocols/Xfire/src/addgamedialog.cpp
+++ b/protocols/Xfire/src/addgamedialog.cpp
@@ -144,12 +144,12 @@ static void FillGameList( LPVOID hwndDlg ) {
if(z2!=zahlbuffer2)
{
listentry.gameid=MAKELONG(gameid,atoi(zahlbuffer2));
- sprintf_s(gameidtemp,10,"%d_%d",gameid,atoi(zahlbuffer2));
+ mir_snprintf(gameidtemp,10,"%d_%d",gameid,atoi(zahlbuffer2));
}
else
{
listentry.gameid=gameid;
- sprintf_s(gameidtemp,10,"%d",gameid);
+ mir_snprintf(gameidtemp,10,"%d",gameid);
}
@@ -265,7 +265,7 @@ BOOL OpenFileDialog(HWND hwndDlg,OPENFILENAME*ofn,char*exe) {
//kein backslash dann normal ret als exenamen verwenden
if((int)exename==1) exename=exe;
//filterstring aufbauen
- sprintf(szFilter,"%s|%s|%s|*.*|",exename,exename,Translate("All Files"));
+ mir_snprintf(szFilter, SIZEOF(szFilter), "%s|%s|%s|*.*|", exename, exename, Translate("All Files"));
//umbruch in 0 wandeln
unsigned int sizeFilter=strlen(szFilter);
for(unsigned int i=0;i<sizeFilter;i++)
@@ -345,13 +345,13 @@ INT_PTR CALLBACK DlgAddGameProc (HWND hwndDlg,
int gameid2=HIWORD(gameids);
if(gameid2!=0)
- sprintf_s(gameidtemp,10,"%d_%d",gameid1,gameid2);
+ mir_snprintf(gameidtemp,10,"%d_%d",gameid1,gameid2);
else
- sprintf_s(gameidtemp,10,"%d",gameid1);
+ mir_snprintf(gameidtemp,10,"%d",gameid1);
//spielnamen holen
if(xfire_GetPrivateProfileString(gameidtemp, "LongName", "", ret, 512, inipath)) {
- sprintf_s(gameidtemp,10,"%d",gameid1);
+ mir_snprintf(gameidtemp,10,"%d",gameid1);
//einige felder vorbelegen
SetDlgItemText(hPage,IDC_ADD_NAME,ret);
@@ -389,9 +389,9 @@ INT_PTR CALLBACK DlgAddGameProc (HWND hwndDlg,
char ret[512];
if(gameid2!=0)
- sprintf_s(gameidtemp,10,"%d_%d",gameid1,gameid2);
+ mir_snprintf(gameidtemp,10,"%d_%d",gameid1,gameid2);
else
- sprintf_s(gameidtemp,10,"%d",gameid1);
+ mir_snprintf(gameidtemp,10,"%d",gameid1);
//neuen gameeintrag anlegen
Xfire_game* newgame=new Xfire_game();
diff --git a/protocols/Xfire/src/all_statusmsg.cpp b/protocols/Xfire/src/all_statusmsg.cpp
index b033b4e3bb..62661afdf4 100644
--- a/protocols/Xfire/src/all_statusmsg.cpp
+++ b/protocols/Xfire/src/all_statusmsg.cpp
@@ -64,7 +64,7 @@ BOOL BackupStatusMsg() {
XFireLog("Get Status of %s ...",temp[i]->szModuleName);
char ttemp[128]="";
- sprintf_s(ttemp,128,"%s%s",temp[i]->szModuleName,PS_SETAWAYMSG);
+ mir_snprintf(ttemp,128,"%s%s",temp[i]->szModuleName,PS_SETAWAYMSG);
//xfire wird geskipped, offline prots und invs prots auch, und locked status prots auch
if(!temp[i]->bIsEnabled||statusid==ID_STATUS_INVISIBLE||statusid==ID_STATUS_OFFLINE||!lstrcmpiA( temp[i]->szModuleName, protocolname )||!ServiceExists(ttemp)||db_get_b(NULL,temp[i]->szModuleName,"LockMainStatus",0)==1)
diff --git a/protocols/Xfire/src/buddylist.cpp b/protocols/Xfire/src/buddylist.cpp
index d2ae949d7a..6106834065 100644
--- a/protocols/Xfire/src/buddylist.cpp
+++ b/protocols/Xfire/src/buddylist.cpp
@@ -146,7 +146,7 @@ namespace xfirelib {
/* ## buddies im miranda verarbietn */
char temp[255];
char * dummy;
- sprintf_s(temp,255,"Clan_%d",entry->clanid);
+ mir_snprintf(temp,255,"Clan_%d",entry->clanid);
DBVARIANT dbv;
if(!db_get(NULL,protocolname,temp,&dbv))
diff --git a/protocols/Xfire/src/clientloginpacket.cpp b/protocols/Xfire/src/clientloginpacket.cpp
index 30a28cc7eb..1746b9fdf8 100644
--- a/protocols/Xfire/src/clientloginpacket.cpp
+++ b/protocols/Xfire/src/clientloginpacket.cpp
@@ -111,7 +111,7 @@ void ClientLoginPacket::hashSha1(const char *string, unsigned char *sha){
result[0] = 0;
char szTemp[16];
for(int i = 0 ; i < 20 ; i++) {
- sprintf(szTemp, "%02x", temp[i]);
+ mir_snprintf(szTemp, SIZEOF(szTemp), "%02x", temp[i]);
strcat(result,szTemp);
}
memcpy(sha,result,40);
diff --git a/protocols/Xfire/src/iniupdater.cpp b/protocols/Xfire/src/iniupdater.cpp
index cc835332a4..dd82e010e8 100644
--- a/protocols/Xfire/src/iniupdater.cpp
+++ b/protocols/Xfire/src/iniupdater.cpp
@@ -61,7 +61,7 @@ void UpdateMyXFireIni(LPVOID dummy) {
strcat(file2,"xfire_games.ini");
strcat(file3,"xfire_games.old");
- sprintf_s(request,1024,"%s%d",INI_URLREQUEST,getfilesize(file2));
+ mir_snprintf(request,1024,"%s%d",INI_URLREQUEST,getfilesize(file2));
if(CheckWWWContent(request))
{
@@ -101,7 +101,7 @@ void UpdateMyIcons(LPVOID dummy) {
strcat(file2,"icons.dll");
strcat(file3,"icons.old");
- sprintf_s(request,1024,"%s%d",ICO_URLREQUEST,getfilesize(file2));
+ mir_snprintf(request,1024,"%s%d",ICO_URLREQUEST,getfilesize(file2));
if(CheckWWWContent(request))
{
diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp
index 17891ac6ec..f2d80d8d1e 100644
--- a/protocols/Xfire/src/main.cpp
+++ b/protocols/Xfire/src/main.cpp
@@ -491,7 +491,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) {
char temp[255];
char * dummy;
ClanBuddyListNamesPacket *clan = (ClanBuddyListNamesPacket*)content;
- sprintf(temp,"Clan_%d",clan->clanid);
+ mir_snprintf(temp, SIZEOF(temp), "Clan_%d", clan->clanid);
DBVARIANT dbv;
if(!db_get(NULL,protocolname,temp,&dbv))
@@ -2389,7 +2389,7 @@ void gamedetectiont(LPVOID lparam)
if(packet->ip[3]!=0)
{
- sprintf(temp,"%d.%d.%d.%d:%d",(unsigned char)packet->ip[3],(unsigned char)packet->ip[2],(unsigned char)packet->ip[1],(unsigned char)packet->ip[0],packet->port);
+ mir_snprintf(temp, SIZEOF(temp), "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1], (unsigned char)packet->ip[0],packet->port);
db_set_s(NULL, protocolname, "VServerIP", temp);
db_set_s(NULL, protocolname, "currentvoicename", "Teamspeak");
}
@@ -2429,7 +2429,7 @@ void gamedetectiont(LPVOID lparam)
db_set_w(NULL,protocolname,"currentvoice",vid);
- sprintf(temp,"%d.%d.%d.%d:%d",(unsigned char)packet->ip[3],(unsigned char)packet->ip[2],(unsigned char)packet->ip[1],(unsigned char)packet->ip[0],packet->port);
+ mir_snprintf(temp, SIZEOF(temp), "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1],(unsigned char)packet->ip[0],packet->port);
db_set_s(NULL, protocolname, "VServerIP", temp);
if(myClient!=NULL)
@@ -2469,7 +2469,7 @@ void gamedetectiont(LPVOID lparam)
packet->gameid=vid;
db_set_w(NULL,protocolname,"currentvoice",vid);
- sprintf(temp,"%d.%d.%d.%d:%d",(unsigned char)packet->ip[3],(unsigned char)packet->ip[2],(unsigned char)packet->ip[1],(unsigned char)packet->ip[0],packet->port);
+ mir_snprintf(temp, SIZEOF(temp), "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1],(unsigned char)packet->ip[0],packet->port);
db_set_s(NULL, protocolname, "VServerIP", temp);
if(myClient!=NULL)
@@ -3586,7 +3586,7 @@ int IconLibChanged(WPARAM wParam, LPARAM lParam) {
//ImageList_ReplaceIcon(hAdvancedStatusIcon,(int)icocache[i].handle,icocache[i].hicon);
HANDLE before=icocache[i].handle;
icocache[i].handle=(HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)icocache[i].hicon, 0);
- sprintf(temp,"before: %d after: %d",before,icocache[i].handle);
+ mir_snprintf(temp, SIZEOF(temp), "before: %d after: %d", before, icocache[i].handle);
MessageBoxA(NULL,temp,temp,0);
DrawIcon(GetDC(NULL),x,0,(HICON)CallService(MS_SKIN2_GETICONBYHANDLE,0,(LPARAM)icocache[i].handle));
x+=32;
diff --git a/protocols/Xfire/src/processbuddyinfo.cpp b/protocols/Xfire/src/processbuddyinfo.cpp
index 32ac9d9808..b23d51b531 100644
--- a/protocols/Xfire/src/processbuddyinfo.cpp
+++ b/protocols/Xfire/src/processbuddyinfo.cpp
@@ -58,7 +58,7 @@ void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo,HANDLE hcontact,char*
strcat(filename,".gif");
type=PA_FORMAT_GIF;
- sprintf(temp,"/xfire/xf/images/avatars/gallery/default/%03d.gif",buddyinfo->avatarid);
+ mir_snprintf(temp, SIZEOF(temp), "/xfire/xf/images/avatars/gallery/default/%03d.gif", buddyinfo->avatarid);
dl=GetWWWContent("media.xfire.com",temp,filename,FALSE);
break;
@@ -67,7 +67,7 @@ void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo,HANDLE hcontact,char*
strcat(filename,".jpg");
type=PA_FORMAT_JPEG;
- sprintf(temp,"/avatar/100/%s.jpg?%d",username,buddyinfo->avatarid);
+ mir_snprintf(temp, SIZEOF(temp), "/avatar/100/%s.jpg?%d", username, buddyinfo->avatarid);
dl=GetWWWContent("screenshot.xfire.com",temp,filename,FALSE);
break;
@@ -75,7 +75,7 @@ void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo,HANDLE hcontact,char*
type=PA_FORMAT_GIF;
strcat(filename,"xfire.gif");
- sprintf(temp,"/xfire/xf/images/avatars/gallery/default/xfire.gif",buddyinfo->avatarid);
+ mir_snprintf(temp, SIZEOF(temp), "/xfire/xf/images/avatars/gallery/default/xfire.gif", buddyinfo->avatarid);
dl=GetWWWContent("media.xfire.com",temp,filename,TRUE);
break;
diff --git a/protocols/Xfire/src/tools.cpp b/protocols/Xfire/src/tools.cpp
index 9cfbb44662..e662defe91 100644
--- a/protocols/Xfire/src/tools.cpp
+++ b/protocols/Xfire/src/tools.cpp
@@ -42,9 +42,9 @@ extern HANDLE hNetlib;
for(int i=0;i<size;i++)
{
if(i%16==0&&i!=0)
- sprintf(buffer,"%s\n%02x ",buffer,buf[i]);
+ mir_snprintf(buffer, SIZEOF(buffer), "%s\n%02x ", buffer, buf[i]);
else
- sprintf(buffer,"%s%02x ",buffer,buf[i]);
+ mir_snprintf(buffer, SIZEOF(buffer), "%s%02x ", buffer, buf[i]);
}
return buffer;
diff --git a/protocols/Xfire/src/userdetails.cpp b/protocols/Xfire/src/userdetails.cpp
index e571dedc6a..0873545bd2 100644
--- a/protocols/Xfire/src/userdetails.cpp
+++ b/protocols/Xfire/src/userdetails.cpp
@@ -68,7 +68,7 @@ void SetItemTxt(HWND hwndDlg,int feldid,char*feld,HANDLE hcontact,int type)
if(type==1)
{
char temp[255];
- sprintf(temp,"%i",dbv.wVal);
+ mir_snprintf(temp, SIZEOF(temp), "%i", dbv.wVal);
SetDlgItemText(hwndDlg,feldid,temp);
}
else
@@ -98,7 +98,7 @@ static int GetIPPortUDetails(HANDLE wParam,char* feld1,char* feld2)
if(db_get_s((HANDLE)wParam, protocolname, feld1,&dbv))
return 0;
- sprintf(temp,"%s:%d",dbv.pszVal,db_get_w((HANDLE)wParam, protocolname, feld2, -1));
+ mir_snprintf(temp, SIZEOF(temp), "%s:%d", dbv.pszVal, db_get_w((HANDLE)wParam, protocolname, feld2, -1));
db_free(&dbv);
@@ -390,30 +390,30 @@ static INT_PTR CALLBACK DlgProcUserDetails(HWND hwndDlg, UINT msg, WPARAM wParam
char game[512]="";
if(!db_get(hContact,"ContactPhoto","File",&dbv))
{
- snprintf(img,256,"<img src=\"%s\">",dbv.pszVal);
+ mir_snprintf(img,256,"<img src=\"%s\">",dbv.pszVal);
db_free(&dbv);
}
if(!db_get(hContact,protocolname,"Username",&dbv))
{
- snprintf(username,256,"<b>Username:</b> %s<br>",dbv.pszVal);
+ mir_snprintf(username,256,"<b>Username:</b> %s<br>",dbv.pszVal);
db_free(&dbv);
}
if(!db_get(hContact,protocolname,"Nick",&dbv))
{
- snprintf(nick,256,"<b>Nick:</b> %s<br>",dbv.pszVal);
+ mir_snprintf(nick,256,"<b>Nick:</b> %s<br>",dbv.pszVal);
db_free(&dbv);
}
if(!db_get(hContact,protocolname,"XStatusMsg",&dbv))
{
- snprintf(status,256,"<b>Status:</b> %s<br>",dbv.pszVal);
+ mir_snprintf(status,256,"<b>Status:</b> %s<br>",dbv.pszVal);
db_free(&dbv);
}
if(!db_get(hContact,protocolname,"RGame",&dbv))
{
- snprintf(game,512,"<fieldset style='border:1px solid #0091d5;background-color:#0d2c3e;margin-bottom:8px;'><legend>Spiel</legend><table><tr><td valign=top style='font-family:Arial;font-size:11px;color:#fff;'><b><u>%s</u></b></td></tr></table></fieldset>",dbv.pszVal);
+ mir_snprintf(game,512,"<fieldset style='border:1px solid #0091d5;background-color:#0d2c3e;margin-bottom:8px;'><legend>Spiel</legend><table><tr><td valign=top style='font-family:Arial;font-size:11px;color:#fff;'><b><u>%s</u></b></td></tr></table></fieldset>",dbv.pszVal);
db_free(&dbv);
}
- snprintf(profil,2056,"mshtml:<div style='position:absolute;top:0;left:0;border:1px solid #0091d5;background-color:#000;padding:6px;width:334px;height:249px'><table><tr><td valign=top>%s</td><td valign=top style='font-family:Arial;font-size:11px;color:#fff;'>%s%s%s</td></tr><tr><td valign=top colspan=\"2\" style='font-family:Arial;font-size:11px;color:#fff;'>%s%s</td></tr></table></div>",img,username,nick,status,game);
+ mir_snprintf(profil,2056,"mshtml:<div style='position:absolute;top:0;left:0;border:1px solid #0091d5;background-color:#000;padding:6px;width:334px;height:249px'><table><tr><td valign=top>%s</td><td valign=top style='font-family:Arial;font-size:11px;color:#fff;'>%s%s%s</td></tr><tr><td valign=top colspan=\"2\" style='font-family:Arial;font-size:11px;color:#fff;'>%s%s</td></tr></table></div>",img,username,nick,status,game);
HWND hWnd = ::CreateWindow("AtlAxWin", profil,
WS_CHILD|WS_VISIBLE, 0, 0, 334, 249, hwndDlg, NULL,
::GetModuleHandle(NULL), NULL);
diff --git a/protocols/Xfire/src/variables.cpp b/protocols/Xfire/src/variables.cpp
index 34c1dec6f2..f23a47966c 100644
--- a/protocols/Xfire/src/variables.cpp
+++ b/protocols/Xfire/src/variables.cpp
@@ -114,7 +114,7 @@ char* Varxfireserverip(ARGUMENTSINFO *ai) {
DBVARIANT dbv3;
if(!db_get(ai->fi->hContact,protocolname, "ServerIP",&dbv3))
{
- sprintf(temp,"%s:%d",dbv3.pszVal,db_get_w(ai->fi->hContact,protocolname, "Port",0));
+ mir_snprintf(temp, SIZEOF(temp), "%s:%d", dbv3.pszVal, db_get_w(ai->fi->hContact, protocolname, "Port", 0));
db_free(&dbv3);
return mir_strdup(temp);
}
@@ -141,7 +141,7 @@ char* Varxfirevoiceip(ARGUMENTSINFO *ai) {
DBVARIANT dbv3;
if(!db_get(ai->fi->hContact,protocolname, "VServerIP",&dbv3))
{
- sprintf(temp,"%s:%d",dbv3.pszVal,db_get_w(ai->fi->hContact,protocolname, "VPort",0));
+ mir_snprintf(temp, SIZEOF(temp), "%s:%d", dbv3.pszVal, db_get_w(ai->fi->hContact, protocolname, "VPort", 0));
db_free(&dbv3);
return mir_strdup(temp);
}
diff --git a/protocols/Yahoo/src/services.cpp b/protocols/Yahoo/src/services.cpp
index d8fdc1883a..2f88106ea1 100644
--- a/protocols/Yahoo/src/services.cpp
+++ b/protocols/Yahoo/src/services.cpp
@@ -227,7 +227,7 @@ void CYahooProto::OpenURL(const char *url, int autoLogin)
y = yahoo_urlencode(yahoo_get_cookie(m_id, "y"));
t = yahoo_urlencode(yahoo_get_cookie(m_id, "t"));
u = yahoo_urlencode(url);
- _snprintf( tUrl, sizeof( tUrl ),
+ mir_snprintf(tUrl, sizeof(tUrl),
"http://msg.edit.yahoo.com/config/reset_cookies?&.y=Y=%s&.t=T=%s&.ver=2&.done=http%%3a//us.rd.yahoo.com/messenger/client/%%3f%s",
y, t, u);
@@ -235,7 +235,7 @@ void CYahooProto::OpenURL(const char *url, int autoLogin)
FREE(t);
FREE(u);
} else {
- _snprintf( tUrl, sizeof( tUrl ), url );
+ mir_snprintf(tUrl, sizeof(tUrl), url);
}
DebugLog("[YahooOpenURL] url: %s Final URL: %s", url, tUrl);
@@ -261,7 +261,7 @@ INT_PTR __cdecl CYahooProto::OnShowProfileCommand( WPARAM wParam, LPARAM lParam
if (getString((HANDLE)wParam, YAHOO_LOGINID, &dbv))
return 0;
- _snprintf( tUrl, sizeof( tUrl ), "http://profiles.yahoo.com/%s", dbv.pszVal );
+ mir_snprintf(tUrl, sizeof(tUrl), "http://profiles.yahoo.com/%s", dbv.pszVal);
db_free(&dbv);
OpenURL(tUrl, 0);
@@ -287,7 +287,7 @@ INT_PTR __cdecl CYahooProto::OnShowMyProfileCommand( WPARAM wParam, LPARAM lPara
}
char tUrl[ 4096 ];
- _snprintf( tUrl, sizeof( tUrl ), "http://profiles.yahoo.com/%s", dbv.pszVal );
+ mir_snprintf(tUrl, sizeof(tUrl), "http://profiles.yahoo.com/%s", dbv.pszVal);
db_free(&dbv);
OpenURL(tUrl, 0);
diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp
index 71b9359b99..21d36e7b91 100644
--- a/protocols/Yahoo/src/yahoo.cpp
+++ b/protocols/Yahoo/src/yahoo.cpp
@@ -1043,7 +1043,7 @@ void ext_yahoo_got_cookies(int id)
//wsprintfA(z, "Cookie: %s; C=%s; Y=%s; T=%s", Bcookie, yahoo_get_cookie(id, "c"), yahoo_get_cookie(id, "y"), yahoo_get_cookie(id, "t"));
//wsprintfA(z, "Cookie: %s; Y=%s", Bcookie, yahoo_get_cookie(id, "y"), yahoo_get_cookie(id, "t"));
- wsprintfA(z, "Cookie: Y=%s; T=%s", yahoo_get_cookie(id, "y"), yahoo_get_cookie(id, "t"));
+ mir_snprintf(z, SIZEOF(z), "Cookie: Y=%s; T=%s", yahoo_get_cookie(id, "y"), yahoo_get_cookie(id, "t"));
LOG(("Our Cookie: '%s'", z));
CallService(MS_NETLIB_SETSTICKYHEADERS, (WPARAM)hnuMain, (LPARAM)z);*/
diff --git a/protocols/Yahoo/src/yahoo.h b/protocols/Yahoo/src/yahoo.h
index 5c17ed2f5a..ac60c1cc1c 100644
--- a/protocols/Yahoo/src/yahoo.h
+++ b/protocols/Yahoo/src/yahoo.h
@@ -13,12 +13,6 @@
#ifndef _YAHOO_YAHOO_H_
#define _YAHOO_YAHOO_H_
-#define MIRANDA_VER 0x0A00
-
-#ifdef _MSC_VER
- #define snprintf _snprintf
-#endif
-
#include <windows.h>
#include <shlwapi.h>