Ticket #2538: unused_file_label_width.patch

File unused_file_label_width.patch, 1.8 KB (added by pavlinux, 13 years ago)

Too big buffer size

  • src/viewer/display.c

     src/viewer/display.c |   10 +++++-----
     1 files changed, 5 insertions(+), 5 deletions(-)
    
    diff --git a/src/viewer/display.c b/src/viewer/display.c
    index bf02049..24c9ef4 100644
    a b mcview_set_buttonbar (mcview_t * view) 
    126126} 
    127127 
    128128/* --------------------------------------------------------------------------------------------- */ 
     129#define BUF_TRUNC_LEN 5 /* The length of the line displays the file size */ 
    129130 
    130131static void 
    131132mcview_display_status (mcview_t * view) 
    mcview_display_status (mcview_t * view) 
    134135    const screen_dimen left = view->status_area.left; 
    135136    const screen_dimen width = view->status_area.width; 
    136137    const screen_dimen height = view->status_area.height; 
    137     const char *file_label; 
    138     screen_dimen file_label_width; 
     138    const char *file_label;     
    139139 
    140140    if (height < 1) 
    141141        return; 
    mcview_display_status (mcview_t * view) 
    145145    tty_draw_hline (-1, -1, ' ', width); 
    146146 
    147147    file_label = view->filename ? view->filename : view->command ? view->command : ""; 
    148     file_label_width = str_term_width1 (file_label) - 2; 
     148     
    149149    if (width > 40) 
    150150    { 
    151         char buffer[BUF_TINY]; 
     151        char buffer[BUF_TRUNC_LEN + 1]; 
    152152        widget_move (view, top, width - 32); 
    153153        if (view->hex_mode) 
    154154            tty_printf ("0x%08" PRIxMAX, (uintmax_t) view->hex_cursor); 
    155155        else 
    156156        { 
    157             size_trunc_len (buffer, 5, mcview_get_filesize (view), 0, panels_options.kilobyte_si); 
     157            size_trunc_len (buffer, BUF_TRUNC_LEN, mcview_get_filesize (view), 0, panels_options.kilobyte_si); 
    158158            tty_printf ("%9" PRIuMAX "/%s%s %s", (uintmax_t) view->dpy_end, 
    159159                        buffer, mcview_may_still_grow (view) ? "+" : " ", 
    160160#ifdef HAVE_CHARSET