aboutsummaryrefslogtreecommitdiffstats
path: root/src/client_write.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-05-18 22:23:11 +0200
committerMax Kellermann <max@duempel.org>2010-05-19 13:12:37 +0200
commit57b4013306c18a1c510d00845a9915bea0bcf525 (patch)
tree885aef43346525954bcbadb402e099989ce1931c /src/client_write.c
parentfc5a7a877434017ac8361243a4153aa4f906ea22 (diff)
downloadmpd-57b4013306c18a1c510d00845a9915bea0bcf525.tar.gz
mpd-57b4013306c18a1c510d00845a9915bea0bcf525.tar.xz
mpd-57b4013306c18a1c510d00845a9915bea0bcf525.zip
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().
Diffstat (limited to 'src/client_write.c')
-rw-r--r--src/client_write.c13
1 files changed, 13 insertions, 0 deletions
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, ...)