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 * |
868 | 868 | sort_box (dir_sort_options_t * op, const panel_field_t * sort_field) |
869 | 869 | { |
870 | 870 | const char **sort_orders_names; |
871 | | gsize sort_names_num, i; |
| 871 | gsize i; |
| 872 | gsize sort_names_num = 0; |
872 | 873 | int sort_idx = 0; |
873 | 874 | const panel_field_t *result = NULL; |
874 | 875 | |
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) |
1034 | 1034 | { |
1035 | 1035 | fish_fh_data_t *fish = (fish_fh_data_t *) fh->data; |
1036 | 1036 | struct vfs_s_super *super = FH_SUPER; |
1037 | | char buffer[BUF_8K]; |
1038 | | ssize_t n; |
| 1037 | off_t n; |
1039 | 1038 | |
1040 | 1039 | vfs_print_message ("%s", _("Aborting transfer...")); |
1041 | 1040 | |
1042 | 1041 | do |
1043 | 1042 | { |
1044 | | n = MIN ((off_t) sizeof (buffer), (fish->total - fish->got)); |
| 1043 | n = fish->total - fish->got; |
1045 | 1044 | if (n != 0) |
1046 | 1045 | { |
1047 | | n = read (SUP->sockr, buffer, n); |
| 1046 | n = lseek (SUP->sockr, n, SEEK_CUR); |
1048 | 1047 | if (n < 0) |
1049 | 1048 | return; |
1050 | 1049 | fish->got += n; |
diff --git a/src/viewer/actions_cmd.c b/src/viewer/actions_cmd.c
index 2e970d1..22807f0 100644
a
|
b
|
static cb_ret_t |
220 | 220 | mcview_handle_editkey (WView * view, int key) |
221 | 221 | { |
222 | 222 | struct hexedit_change_node *node; |
223 | | int byte_val; |
| 223 | int byte_val = -1; |
224 | 224 | |
225 | 225 | /* Has there been a change at this position? */ |
226 | 226 | node = view->change_list; |
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 |
339 | 339 | nroff_state = NROFF_START; |
340 | 340 | for (; current.cc_offset < limit; current = next) |
341 | 341 | { |
342 | | int c, nextc; |
| 342 | int c; |
| 343 | int nextc = -1; |
343 | 344 | |
344 | 345 | if (!mcview_get_byte (view, current.cc_offset, &c)) |
345 | 346 | break; |