Add new snprintf/vsnprintf implementation. This should fix the compability

problems between Win32 (with its broken implementation) and the standard
stdio API.  Also fixed a bug in debug output where long messages got
truncated to 1023 chars, and in xmpp_stanza_to_text where long stanzas
got truncated by one character.
This commit is contained in:
Jack Moffitt
2006-01-21 00:26:40 +00:00
parent 9a06adc267
commit c52d0aaa28
7 changed files with 875 additions and 35 deletions

View File

@@ -21,10 +21,6 @@
#include "strophe.h"
#include "common.h"
#ifdef _WIN32
#define snprintf _snprintf
#endif
static void _log_open_tag(xmpp_conn_t * const conn,
const XML_Char **attr)
{
@@ -33,20 +29,20 @@ static void _log_open_tag(xmpp_conn_t * const conn,
int i;
pos = 0;
len = snprintf(buf, 4096, "<stream:stream");
len = xmpp_snprintf(buf, 4096, "<stream:stream");
if (len < 0) return;
pos += len;
for (i = 0; attr[i]; i += 2) {
len = snprintf(&buf[pos], 4096 - pos, " %s=\"%s\"",
attr[i], attr[i+1]);
len = xmpp_snprintf(&buf[pos], 4096 - pos, " %s=\"%s\"",
attr[i], attr[i+1]);
if (len < 0) return;
pos += len;
}
len = snprintf(&buf[pos], 4096 - pos, ">");
len = xmpp_snprintf(&buf[pos], 4096 - pos, ">");
if (len < 0) return;
xmpp_debug(conn->ctx, "xmpp", "RECV: %s", buf);