From 57b4013306c18a1c510d00845a9915bea0bcf525 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 18 May 2010 22:23:11 +0200 Subject: client: use sprintf() on WIN32 On mingw32, snprintf() expects a 64 bit integer instead of a "long int" for "%li" - this is not consistent with our expectation, so we're using plain sprintf(). --- src/client_write.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/client_write.c') diff --git a/src/client_write.c b/src/client_write.c index e0974150b..543cdbb6c 100644 --- a/src/client_write.c +++ b/src/client_write.c @@ -243,6 +243,7 @@ void client_puts(struct client *client, const char *s) void client_vprintf(struct client *client, const char *fmt, va_list args) { +#ifndef G_OS_WIN32 va_list tmp; int length; char *buffer; @@ -259,6 +260,18 @@ void client_vprintf(struct client *client, const char *fmt, va_list args) vsnprintf(buffer, length + 1, fmt, args); client_write(client, buffer, length); g_free(buffer); +#else + /* On mingw32, snprintf() expects a 64 bit integer instead of + a "long int" for "%li". This is not consistent with our + expectation, so we're using plain sprintf() here, hoping + the static buffer is large enough. Sorry for this hack, + but WIN32 development is so painful, I'm not in the mood to + do it properly now. */ + + static char buffer[4096]; + vsprintf(buffer, fmt, args); + client_write(client, buffer, strlen(buffer)); +#endif } G_GNUC_PRINTF(2, 3) void client_printf(struct client *client, const char *fmt, ...) -- cgit v1.2.3