changeset 1686:393c05fba337

Use G_GNUC_PRINTF to check scr_LogPrint arguments And some minor fixes, revealed by that.
author Myhailo Danylenko <isbear@ukrpost.net>
date Sun, 31 Jan 2010 16:08:50 +0200
parents 1342df44c814
children fc67e1c7a5d4
files mcabber/mcabber/commands.c mcabber/mcabber/logprint.h mcabber/mcabber/screen.c
diffstat 3 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/mcabber/commands.c	Tue Feb 02 22:44:18 2010 +0100
+++ b/mcabber/mcabber/commands.c	Sun Jan 31 16:08:50 2010 +0200
@@ -3345,7 +3345,8 @@
     for (p = evidlst; p; p = g_slist_next(p)) {
       if (evs_callback(p->data, action,
                        (const char*)(paramlst+2)) == -1) {
-        scr_LogPrint(LPRINT_NORMAL, "Event %s not found.", p->data);
+        scr_LogPrint(LPRINT_NORMAL, "Event %s not found.",
+                     (const char *)p->data);
       }
     }
     g_slist_free(evidlst);
--- a/mcabber/mcabber/logprint.h	Tue Feb 02 22:44:18 2010 +0100
+++ b/mcabber/mcabber/logprint.h	Sun Jan 31 16:08:50 2010 +0200
@@ -1,6 +1,8 @@
 #ifndef __MCABBER_LOGPRINT_H__
 #define __MCABBER_LOGPRINT_H__ 1
 
+#include <glib.h>
+
 // Flags for scr_LogPrint()
 #define LPRINT_NORMAL   1U  // Display in log window
 #define LPRINT_LOG      2U  // Log to file (if enabled)
@@ -11,7 +13,7 @@
 #define LPRINT_LOGNORM  (LPRINT_NORMAL|LPRINT_LOG)
 
 void scr_print_logwindow(const char *string);
-void scr_LogPrint(unsigned int flag, const char *fmt, ...);
+void scr_LogPrint(unsigned int flag, const char *fmt, ...) G_GNUC_PRINTF (2, 3);
 
 void scr_DoUpdate(void);
 
--- a/mcabber/mcabber/screen.c	Tue Feb 02 22:44:18 2010 +0100
+++ b/mcabber/mcabber/screen.c	Sun Jan 31 16:08:50 2010 +0200
@@ -2756,7 +2756,7 @@
   if (!win_entry) return;
 
   if (pc < 0 || pc > 100) {
-    scr_LogPrint(LPRINT_NORMAL, "Bad % value");
+    scr_LogPrint(LPRINT_NORMAL, "Bad %% value");
     return;
   }
 
@@ -2829,7 +2829,7 @@
 
   head = g_list_first(win_entry->bd->hbuf);
 
-  scr_LogPrint(LPRINT_NORMAL, " %s  (%u/%u)", key,
+  scr_LogPrint(LPRINT_NORMAL, " %s  (%u/%u)", (const char *) key,
                g_list_length(head), hbuf_get_blocks_number(head));
 }