/pidgin/main: e7949b2aa31a: Gadu-Gadu: fix log printing for win32
Tomasz Wasilczyk
twasilczyk at pidgin.im
Mon Nov 24 10:12:10 EST 2014
Changeset: e7949b2aa31ae0f3a49053b31ed715d593b33366
Author: Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date: 2014-11-24 16:12 +0100
Branch: release-2.x.y
URL: https://hg.pidgin.im/pidgin/main/rev/e7949b2aa31a
Description:
Gadu-Gadu: fix log printing for win32
diffstat:
libpurple/protocols/gg/gg.c | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diffs (38 lines):
diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c
--- a/libpurple/protocols/gg/gg.c
+++ b/libpurple/protocols/gg/gg.c
@@ -2365,13 +2365,20 @@ static PurplePluginInfo info = {
NULL
};
-static void purple_gg_debug_handler(int level, const char * format, va_list args) {
+static void
+purple_gg_debug_handler(int level, const char * format, va_list args)
+{
PurpleDebugLevel purple_level;
- char *msg = g_strdup_vprintf(format, args);
+ char msgbuff[1000];
+ int ret;
- if (!msg) {
+ /* Don't use glib's printf family, since it might not support
+ * system-specific formatting modifiers (like %Iu for size on win32). */
+ ret = vsnprintf(msgbuff, sizeof(msgbuff) / sizeof(char), format, args);
+
+ if (ret <= 0) {
purple_debug_fatal("gg",
- "failed to vprintf the following message: %s",
+ "failed to printf the following message: %s",
format ? format : "(null)\n");
return;
@@ -2392,8 +2399,7 @@ static void purple_gg_debug_handler(int
break;
}
- purple_debug(purple_level, "gg", "%s", msg);
- g_free(msg);
+ purple_debug(purple_level, "gg", "%s", msgbuff);
}
static void init_plugin(PurplePlugin *plugin)
More information about the Commits
mailing list