Re: show_dir crashes on more than 200 columns



Hi,

On Wed, 2004-11-03 at 15:55, Jindrich Novy wrote:
> The widget.cols is IMHO the best solution since we're not wasting any
> memory. Corrected patch attached.

Guys, please take care with introducing unnecessary white space. There
is some of this in the above mentioned patch, fixed in attached patch.

Leonard.

-- 
mount -t life -o ro /dev/dna /genetic/research

--- mc-4.6.1-20041103/src/screen.c.jn	2004-09-24 17:05:28.000000000 +0200
+++ mc-4.6.1-20041103/src/screen.c	2004-11-03 15:45:15.887242808 +0100
@@ -728,7 +728,7 @@ mini_info_separator (WPanel *panel)
 static void
 show_dir (WPanel *panel)
 {
-    char tmp[200];
+    char *tmp;
 
     set_colors (panel);
     draw_double_box (panel->widget.parent,
@@ -750,9 +750,14 @@ show_dir (WPanel *panel)
 
     widget_move (&panel->widget, 0, 3);
 
+    tmp = g_malloc (panel->widget.cols + 1);
+    tmp[panel->widget.cols] = '\0';
+
     trim (strip_home_and_password (panel->cwd), tmp,
-	  max (panel->widget.cols - 7, 0));
+	  min (max (panel->widget.cols - 7, 0), panel->widget.cols) );
+
     addstr (tmp);
+    g_free (tmp);
     widget_move (&panel->widget, 0, 1);
     addstr ("<");
     widget_move (&panel->widget, 0, panel->widget.cols - 2);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]