From 6ce4601cef72a630f7b53c98c5b0683ccc509986 Mon Sep 17 00:00:00 2001
From: Andreas Mohr <and@gmx.li>
Date: Sat, 20 Feb 2016 14:18:26 +0000
Subject: [PATCH] filemanager/panel.c: cleanup -Wcast-qual warning
In file included from ../../lib/widget.h:18:0,
from panel.c:53:
panel.c: In function 'panel_lines':
../../lib/widget/widget-common.h:13:20: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
#define WIDGET(x) ((Widget *)(x))
^
panel.c:409:13: note: in expansion of macro 'WIDGET'
return (WIDGET (p)->lines - 3 - (panels_options.show_mini_info ? 2 : 0));
^
panel.c: In function 'display_total_marked_size':
../../lib/widget/widget-common.h:13:20: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
#define WIDGET(x) ((Widget *)(x))
^
panel.c:1070:17: note: in expansion of macro 'WIDGET'
Widget *w = WIDGET (panel);
^
panel.c:1094:11: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
buf = (char *) str_trunc (buf, cols - 4);
^
In file included from ../../lib/widget.h:18:0,
from panel.c:53:
panel.c: In function 'mini_info_separator':
../../lib/widget/widget-common.h:13:20: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
#define WIDGET(x) ((Widget *)(x))
^
panel.c:1116:21: note: in expansion of macro 'WIDGET'
Widget *w = WIDGET (panel);
^
panel.c: In function 'show_free_space':
../../lib/widget/widget-common.h:13:20: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
#define WIDGET(x) ((Widget *)(x))
^
panel.c:1159:21: note: in expansion of macro 'WIDGET'
Widget *w = WIDGET (panel);
^
panel.c: In function 'show_dir':
../../lib/widget/widget-common.h:13:20: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
#define WIDGET(x) ((Widget *)(x))
^
panel.c:1260:17: note: in expansion of macro 'WIDGET'
Widget *w = WIDGET (panel);
^
panel.c: In function 'panel_paint_sort_info':
../../lib/widget/widget-common.h:13:20: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
#define WIDGET(x) ((Widget *)(x))
^
../../lib/widget/widget-common.h:15:44: note: in expansion of macro 'WIDGET'
#define widget_move(w, _y, _x) tty_gotoyx (WIDGET(w)->y + (_y), WIDGET(w)->x + (_x))
^
panel.c:1524:9: note: in expansion of macro 'widget_move'
widget_move (panel, 1, 1);
^
../../lib/widget/widget-common.h:13:20: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
#define WIDGET(x) ((Widget *)(x))
^
../../lib/widget/widget-common.h:15:65: note: in expansion of macro 'WIDGET'
#define widget_move(w, _y, _x) tty_gotoyx (WIDGET(w)->y + (_y), WIDGET(w)->x + (_x))
^
panel.c:1524:9: note: in expansion of macro 'widget_move'
widget_move (panel, 1, 1);
^
panel.c: In function 'panel_print_header':
../../lib/widget/widget-common.h:13:20: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
#define WIDGET(x) ((Widget *)(x))
^
panel.c:1558:17: note: in expansion of macro 'WIDGET'
Widget *w = WIDGET (panel);
^
panel.c: In function 'panel_get_sortable_fields':
panel.c:4879:12: warning: to be safe all intermediate pointers in cast from 'char **' to 'const char **' must be 'const' qualified [-Wcast-qual]
return (const char **) ret;
^
panel.c: In function 'panel_get_user_possible_fields':
panel.c:4967:12: warning: to be safe all intermediate pointers in cast from 'char **' to 'const char **' must be 'const' qualified [-Wcast-qual]
return (const char **) ret;
^
Signed-off-by: Andreas Mohr <and@gmx.li>
---
src/filemanager/panel.c | 25 +++++++++++++------------
src/filemanager/panel.h | 4 ++--
2 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c
index 1fce969..1509b73 100644
a
|
b
|
static int |
406 | 406 | panel_lines (const WPanel * p) |
407 | 407 | { |
408 | 408 | /* 3 lines are: top frame, column header, botton frame */ |
409 | | return (WIDGET (p)->lines - 3 - (panels_options.show_mini_info ? 2 : 0)); |
| 409 | return (CWIDGET (p)->lines - 3 - (panels_options.show_mini_info ? 2 : 0)); |
410 | 410 | } |
411 | 411 | |
412 | 412 | /* --------------------------------------------------------------------------------------------- */ |
… |
… |
paint_dir (WPanel * panel) |
1067 | 1067 | static void |
1068 | 1068 | display_total_marked_size (const WPanel * panel, int y, int x, gboolean size_only) |
1069 | 1069 | { |
1070 | | Widget *w = WIDGET (panel); |
| 1070 | const Widget *w = CWIDGET (panel); |
1071 | 1071 | |
1072 | | char buffer[BUF_SMALL], b_bytes[BUF_SMALL], *buf; |
| 1072 | char buffer[BUF_SMALL], b_bytes[BUF_SMALL]; |
| 1073 | const char *buf; |
1073 | 1074 | int cols; |
1074 | 1075 | |
1075 | 1076 | if (panel->marked <= 0) |
… |
… |
display_total_marked_size (const WPanel * panel, int y, int x, gboolean size_onl |
1091 | 1092 | b_bytes, panel->marked); |
1092 | 1093 | |
1093 | 1094 | /* don't forget spaces around buffer content */ |
1094 | | buf = (char *) str_trunc (buf, cols - 4); |
| 1095 | buf = str_trunc (buf, cols - 4); |
1095 | 1096 | |
1096 | 1097 | if (x < 0) |
1097 | 1098 | /* center in panel */ |
… |
… |
mini_info_separator (const WPanel * panel) |
1113 | 1114 | { |
1114 | 1115 | if (panels_options.show_mini_info) |
1115 | 1116 | { |
1116 | | Widget *w = WIDGET (panel); |
| 1117 | const Widget *w = CWIDGET (panel); |
1117 | 1118 | int y; |
1118 | 1119 | |
1119 | 1120 | y = panel_lines (panel) + 2; |
… |
… |
show_free_space (const WPanel * panel) |
1156 | 1157 | |
1157 | 1158 | if (myfs_stats.avail != 0 || myfs_stats.total != 0) |
1158 | 1159 | { |
1159 | | Widget *w = WIDGET (panel); |
| 1160 | const Widget *w = CWIDGET (panel); |
1160 | 1161 | char buffer1[6], buffer2[6], tmp[BUF_SMALL]; |
1161 | 1162 | |
1162 | 1163 | size_trunc_len (buffer1, sizeof (buffer1) - 1, myfs_stats.avail, 1, |
… |
… |
panel_get_encoding_info_str (const WPanel * panel) |
1257 | 1258 | static void |
1258 | 1259 | show_dir (const WPanel * panel) |
1259 | 1260 | { |
1260 | | Widget *w = WIDGET (panel); |
| 1261 | const Widget *w = CWIDGET (panel); |
1261 | 1262 | |
1262 | 1263 | gchar *tmp; |
1263 | 1264 | |
… |
… |
panel_get_title_without_hotkey (const char *title) |
1555 | 1556 | static void |
1556 | 1557 | panel_print_header (const WPanel * panel) |
1557 | 1558 | { |
1558 | | Widget *w = WIDGET (panel); |
| 1559 | const Widget *w = CWIDGET (panel); |
1559 | 1560 | |
1560 | 1561 | int y, x; |
1561 | 1562 | int i; |
… |
… |
panel_get_num_of_sortable_fields (void) |
4855 | 4856 | |
4856 | 4857 | /* --------------------------------------------------------------------------------------------- */ |
4857 | 4858 | |
4858 | | const char ** |
| 4859 | char ** |
4859 | 4860 | panel_get_sortable_fields (gsize * array_size) |
4860 | 4861 | { |
4861 | 4862 | char **ret; |
… |
… |
panel_get_sortable_fields (gsize * array_size) |
4876 | 4877 | if (panel_fields[i].is_user_choice) |
4877 | 4878 | ret[lc_index++] = g_strdup (_(panel_fields[i].title_hotkey)); |
4878 | 4879 | |
4879 | | return (const char **) ret; |
| 4880 | return ret; |
4880 | 4881 | } |
4881 | 4882 | |
4882 | 4883 | /* --------------------------------------------------------------------------------------------- */ |
… |
… |
panel_get_num_of_user_possible_fields (void) |
4943 | 4944 | |
4944 | 4945 | /* --------------------------------------------------------------------------------------------- */ |
4945 | 4946 | |
4946 | | const char ** |
| 4947 | char ** |
4947 | 4948 | panel_get_user_possible_fields (gsize * array_size) |
4948 | 4949 | { |
4949 | 4950 | char **ret; |
… |
… |
panel_get_user_possible_fields (gsize * array_size) |
4964 | 4965 | if (panel_fields[i].use_in_user_format) |
4965 | 4966 | ret[lc_index++] = g_strdup (_(panel_fields[i].title_hotkey)); |
4966 | 4967 | |
4967 | | return (const char **) ret; |
| 4968 | return ret; |
4968 | 4969 | } |
4969 | 4970 | |
4970 | 4971 | /* --------------------------------------------------------------------------------------------- */ |
diff --git a/src/filemanager/panel.h b/src/filemanager/panel.h
index 4f3cd0d..d3f792e 100644
a
|
b
|
void do_file_mark (WPanel * panel, int idx, int val); |
180 | 180 | gboolean do_panel_cd (WPanel * panel, const vfs_path_t * new_dir_vpath, enum cd_enum cd_type); |
181 | 181 | |
182 | 182 | gsize panel_get_num_of_sortable_fields (void); |
183 | | const char **panel_get_sortable_fields (gsize *); |
| 183 | char **panel_get_sortable_fields (gsize *); |
184 | 184 | const panel_field_t *panel_get_field_by_id (const char *); |
185 | 185 | const panel_field_t *panel_get_field_by_title (const char *); |
186 | 186 | const panel_field_t *panel_get_field_by_title_hotkey (const char *); |
187 | 187 | gsize panel_get_num_of_user_possible_fields (void); |
188 | | const char **panel_get_user_possible_fields (gsize *); |
| 188 | char **panel_get_user_possible_fields (gsize *); |
189 | 189 | void panel_set_cwd (WPanel * panel, const vfs_path_t * vpath); |
190 | 190 | void panel_set_lwd (WPanel * panel, const vfs_path_t * vpath); |
191 | 191 | |