mirror of
https://github.com/strophe/libstrophe.git
synced 2026-07-24 22:36:21 +00:00
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:
12
src/parser.c
12
src/parser.c
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user