From 864c802da99c33658e86c8c3659dcaa6eb2708d5 Mon Sep 17 00:00:00 2001
From: Andreas Mohr <and@gmx.li>
Date: Sat, 20 Feb 2016 15:23:57 +0000
Subject: [PATCH] filemanager/find.c: cleanup -Wcast-qual warning
find.c:775:75: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
*start_dir = in_start->buffer[0] != '\0' ? in_start->buffer : (char *) ".";
^
find.c: In function 'push_directory':
find.c:829:36: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
g_queue_push_head (&dir_queue, (void *) dir);
^
find.c: In function 'find_rotate_dash':
../../lib/widget/widget-common.h:13:20: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
#define WIDGET(x) ((Widget *)(x))
^
find.c:1202:23: note: in expansion of macro 'WIDGET'
const Widget *w = WIDGET (h);
^
find.c: In function 'find_calc_button_locations':
../../lib/widget/widget-common.h:13:20: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
#define WIDGET(x) ((Widget *)(x))
^
find.c:1432:22: note: in expansion of macro 'WIDGET'
const int cols = WIDGET (h)->cols;
^
find.c: In function 'find_relocate_buttons':
../../lib/widget/widget-common.h:13:20: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
#define WIDGET(x) ((Widget *)(x))
^
find.c:1463:30: note: in expansion of macro 'WIDGET'
fbuts[i].button->x = WIDGET (h)->x + fbuts[i].x;
^
find.c: In function 'do_find':
find.c:1679:20: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
find_pattern = (char *) pattern;
^
Signed-off-by: Andreas Mohr <and@gmx.li>
---
src/filemanager/find.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/filemanager/find.c b/src/filemanager/find.c
index e0956d0..4a3eccf 100644
a
|
b
|
find_parameters (char **start_dir, ssize_t * start_dir_len, |
772 | 772 | |
773 | 773 | *content = (options.content_use && in_with->buffer[0] != '\0') |
774 | 774 | ? g_strdup (in_with->buffer) : NULL; |
775 | | *start_dir = in_start->buffer[0] != '\0' ? in_start->buffer : (char *) "."; |
| 775 | *start_dir = in_start->buffer[0] != '\0' ? g_strdup (in_start->buffer) : g_strdup ("."); |
776 | 776 | *pattern = g_strdup (in_name->buffer); |
777 | 777 | if (in_start_dir != INPUT_LAST_TEXT) |
778 | 778 | g_free (in_start_dir); |
779 | | in_start_dir = g_strdup (*start_dir); |
| 779 | in_start_dir = *start_dir; |
780 | 780 | |
781 | 781 | s = tilde_expand (*start_dir); |
782 | 782 | canonicalize_pathname (s); |
… |
… |
find_parameters (char **start_dir, ssize_t * start_dir_len, |
824 | 824 | /* --------------------------------------------------------------------------------------------- */ |
825 | 825 | |
826 | 826 | static inline void |
827 | | push_directory (const vfs_path_t * dir) |
| 827 | push_directory (vfs_path_t * dir) |
828 | 828 | { |
829 | 829 | g_queue_push_head (&dir_queue, (void *) dir); |
830 | 830 | } |
… |
… |
find_rotate_dash (const WDialog * h, gboolean show) |
1199 | 1199 | { |
1200 | 1200 | static size_t pos = 0; |
1201 | 1201 | static const char rotating_dash[4] = "|/-\\"; |
1202 | | const Widget *w = WIDGET (h); |
| 1202 | const Widget *w = CWIDGET (h); |
1203 | 1203 | |
1204 | 1204 | if (!verbose) |
1205 | 1205 | return; |
… |
… |
view_edit_currently_selected_file (gboolean unparsed_view, gboolean edit) |
1429 | 1429 | static void |
1430 | 1430 | find_calc_button_locations (const WDialog * h, gboolean all_buttons) |
1431 | 1431 | { |
1432 | | const int cols = WIDGET (h)->cols; |
| 1432 | const int cols = CWIDGET (h)->cols; |
1433 | 1433 | |
1434 | 1434 | int l1, l2; |
1435 | 1435 | |
… |
… |
find_relocate_buttons (const WDialog * h, gboolean all_buttons) |
1460 | 1460 | find_calc_button_locations (h, all_buttons); |
1461 | 1461 | |
1462 | 1462 | for (i = 0; i < fbuts_num; i++) |
1463 | | fbuts[i].button->x = WIDGET (h)->x + fbuts[i].x; |
| 1463 | fbuts[i].button->x = CWIDGET (h)->x + fbuts[i].x; |
1464 | 1464 | } |
1465 | 1465 | |
1466 | 1466 | /* --------------------------------------------------------------------------------------------- */ |
… |
… |
do_find (const char *start_dir, ssize_t start_dir_len, const char *ignore_dirs, |
1675 | 1675 | |
1676 | 1676 | setup_gui (); |
1677 | 1677 | |
1678 | | /* FIXME: Need to cleanup this, this ought to be passed non-globaly */ |
1679 | | find_pattern = (char *) pattern; |
| 1678 | find_pattern = g_strdup (pattern); |
1680 | 1679 | |
1681 | 1680 | content_pattern = NULL; |
1682 | 1681 | if (options.content_use && content != NULL && str_is_valid_string (content)) |
… |
… |
do_find (const char *start_dir, ssize_t start_dir_len, const char *ignore_dirs, |
1790 | 1789 | } |
1791 | 1790 | } |
1792 | 1791 | |
| 1792 | g_free (find_pattern); |
1793 | 1793 | g_free (content_pattern); |
1794 | 1794 | kill_gui (); |
1795 | 1795 | do_search (NULL); /* force do_search to release resources */ |