mcabber/src/screen.c
changeset 1486 f83a51eaa5ed
parent 1485 0121b6f3047c
child 1487 f61ed2466f7c
--- a/mcabber/src/screen.c	Sun Apr 20 16:06:37 2008 +0200
+++ b/mcabber/src/screen.c	Sun Apr 20 16:56:43 2008 +0200
@@ -831,19 +831,19 @@
   6
 };
 
-static const char *gettprefix()
+static const char *gettprefix(void)
 {
   guint n = settings_opt_get_int("time_prefix");
   return timeprefixes[(n < 3 ? n : 0)];
 }
 
-static const char *getspectprefix()
+static const char *getspectprefix(void)
 {
   guint n = settings_opt_get_int("time_prefix");
   return spectimeprefixes[(n < 3 ? n : 0)];
 }
 
-static unsigned getprefixwidth()
+guint getprefixwidth(void)
 {
   guint n = settings_opt_get_int("time_prefix");
   return timepreflengths[(n < 3 ? n : 0)];
@@ -1052,7 +1052,8 @@
 static void scr_UpdateWindow(winbuf *win_entry)
 {
   int n;
-  int width, prefixwidth;
+  int width;
+  guint prefixwidth;
   char pref[96];
   hbb_line **lines, *line;
   GList *hbuf_head;
@@ -1060,6 +1061,7 @@
 
   width = getmaxx(win_entry->win);
   prefixwidth = getprefixwidth();
+  prefixwidth = MIN(prefixwidth, sizeof pref);
 
   // Should the window be empty?
   if (win_entry->bd->cleared) {
@@ -1112,7 +1114,7 @@
         wattrset(win_entry->win, get_color(color));
 
       // Generate the prefix area and display it
-      scr_line_prefix(line, pref, sizeof pref);
+      scr_line_prefix(line, pref, prefixwidth);
       wprintw(win_entry->win, pref);
 
       // Make sure we are at the right position