summaryrefslogtreecommitdiff
path: root/protocols/Tlen
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-08-16 10:57:40 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-08-16 10:57:40 +0000
commit30ee89a6764a8d38a078374c6ed5de70635b42c0 (patch)
tree464bbd4c8e32200107d42c5f95b13134edf42888 /protocols/Tlen
parente3c401f192327347151a70596a6b0b493bc762b1 (diff)
rest or mir_*printf in protocols
git-svn-id: http://svn.miranda-ng.org/main/trunk@5715 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tlen')
-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
6 files changed, 28 insertions, 27 deletions
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++) {