From a40fa7b34502bc66d06daaf712deacb47559ba11 Mon Sep 17 00:00:00 2001
From: Andreas Mohr <and@gmx.li>
Date: Sat, 20 Feb 2016 10:46:35 +0000
Subject: [PATCH] widget/input_complete.c: cleanup -Wcast-qual warning
input_complete.c:688:21: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
return strcmp (*(char **) a, *(char **) b);
^
input_complete.c:688:35: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
return strcmp (*(char **) a, *(char **) b);
^
input_complete.c:810:9: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
p = (char *) text;
^
input_complete.c:811:9: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
q = (char *) text + lc_start;
^
Signed-off-by: Andreas Mohr <and@gmx.li>
---
lib/widget/input_complete.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/widget/input_complete.c b/lib/widget/input_complete.c
index ccd4b81..1ad9df6 100644
a
|
b
|
command_completion_function (const char *_text, int state, input_complete_t flag |
685 | 685 | static int |
686 | 686 | match_compare (const void *a, const void *b) |
687 | 687 | { |
688 | | return strcmp (*(char **) a, *(char **) b); |
| 688 | return strcmp (*(char *const *) a, *(char *const *) b); |
689 | 689 | } |
690 | 690 | |
691 | 691 | /* --------------------------------------------------------------------------------------------- */ |
… |
… |
completion_matches (const char *text, CompletionFunction entry_function, input_c |
799 | 799 | static gboolean |
800 | 800 | check_is_cd (const char *text, int lc_start, input_complete_t flags) |
801 | 801 | { |
802 | | char *p, *q; |
| 802 | const char *p, *q; |
803 | 803 | |
804 | 804 | SHOW_C_CTX ("check_is_cd"); |
805 | 805 | |
… |
… |
check_is_cd (const char *text, int lc_start, input_complete_t flags) |
807 | 807 | return FALSE; |
808 | 808 | |
809 | 809 | /* Skip initial spaces */ |
810 | | p = (char *) text; |
811 | | q = (char *) text + lc_start; |
| 810 | p = text; |
| 811 | q = text + lc_start; |
812 | 812 | while (p < q && p[0] != '\0' && str_isspace (p)) |
813 | | str_next_char (&p); |
| 813 | str_cnext_char (&p); |
814 | 814 | |
815 | 815 | /* Check if the command is "cd" and the cursor is after it */ |
816 | 816 | return (p[0] == 'c' && p[1] == 'd' && str_isspace (p + 2) && p + 2 < q); |