Ticket #3547: mc-3547-cleanup-gcc-link-time-optimization-warnings.patch

File mc-3547-cleanup-gcc-link-time-optimization-warnings.patch, 3.5 KB (added by and, 6 years ago)

please double test fish section [read() replaced by lseek()]

  • src/filemanager/boxes.c

    From 5df661ee89a3363c4b9e5bd92b98ae2aad6b41fb Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Sun, 13 Dec 2015 11:49:36 +0000
    Subject: [PATCH] cleanup gcc link time optimization warnings
    
    coord_cache.c: In function 'mcview_ccache_lookup.constprop':
    coord_cache.c:374:31: error: 'nextc' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    coord_cache.c:342:16: note: 'nextc' was declared here
    boxes.c: In function 'sort_box':
    boxes.c:877:5: error: 'sort_names_num' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    boxes.c:871:11: note: 'sort_names_num' was declared here
    actions_cmd.c: In function 'mcview_callback':
    actions_cmd.c:252:42: error: 'byte_val' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    actions_cmd.c:223:9: note: 'byte_val' was declared here
    In function '__read_alias',
        inlined from 'fish_linear_abort.isra.0' at fish.c:1047:15:
    /usr/include/bits/unistd.h:39:9: error: call to '__read_chk_warn' declared with attribute warning: read called with bigger length than size of the destination buffer [-Werror]
      return __read_chk (__fd, __buf, __nbytes, __bos0 (__buf));
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     src/filemanager/boxes.c  | 3 ++-
     src/vfs/fish/fish.c      | 7 +++----
     src/viewer/actions_cmd.c | 2 +-
     src/viewer/coord_cache.c | 3 ++-
     4 files changed, 8 insertions(+), 7 deletions(-)
    
    diff --git a/src/filemanager/boxes.c b/src/filemanager/boxes.c
    index 6874426..f0cd61e 100644
    a b const panel_field_t * 
    868868sort_box (dir_sort_options_t * op, const panel_field_t * sort_field) 
    869869{ 
    870870    const char **sort_orders_names; 
    871     gsize sort_names_num, i; 
     871    gsize i; 
     872    gsize sort_names_num = 0; 
    872873    int sort_idx = 0; 
    873874    const panel_field_t *result = NULL; 
    874875 
  • src/vfs/fish/fish.c

    diff --git a/src/vfs/fish/fish.c b/src/vfs/fish/fish.c
    index 1172f31..f54f406 100644
    a b fish_linear_abort (struct vfs_class *me, vfs_file_handler_t * fh) 
    10341034{ 
    10351035    fish_fh_data_t *fish = (fish_fh_data_t *) fh->data; 
    10361036    struct vfs_s_super *super = FH_SUPER; 
    1037     char buffer[BUF_8K]; 
    1038     ssize_t n; 
     1037    off_t n; 
    10391038 
    10401039    vfs_print_message ("%s", _("Aborting transfer...")); 
    10411040 
    10421041    do 
    10431042    { 
    1044         n = MIN ((off_t) sizeof (buffer), (fish->total - fish->got)); 
     1043        n = fish->total - fish->got; 
    10451044        if (n != 0) 
    10461045        { 
    1047             n = read (SUP->sockr, buffer, n); 
     1046            n = lseek (SUP->sockr, n, SEEK_CUR); 
    10481047            if (n < 0) 
    10491048                return; 
    10501049            fish->got += n; 
  • src/viewer/actions_cmd.c

    diff --git a/src/viewer/actions_cmd.c b/src/viewer/actions_cmd.c
    index 2e970d1..22807f0 100644
    a b static cb_ret_t 
    220220mcview_handle_editkey (WView * view, int key) 
    221221{ 
    222222    struct hexedit_change_node *node; 
    223     int byte_val; 
     223    int byte_val = -1; 
    224224 
    225225    /* Has there been a change at this position? */ 
    226226    node = view->change_list; 
  • src/viewer/coord_cache.c

    diff --git a/src/viewer/coord_cache.c b/src/viewer/coord_cache.c
    index 665e58a..a920eb8 100644
    a b mcview_ccache_lookup (WView * view, coord_cache_entry_t * coord, enum ccache_typ 
    339339    nroff_state = NROFF_START; 
    340340    for (; current.cc_offset < limit; current = next) 
    341341    { 
    342         int c, nextc; 
     342        int c; 
     343        int nextc = -1; 
    343344 
    344345        if (!mcview_get_byte (view, current.cc_offset, &c)) 
    345346            break;