From f523232e1f584d0f7b7aa703172801e3c93605ee Mon Sep 17 00:00:00 2001
From: Andreas Mohr <and@gmx.li>
Date: Fri, 19 Feb 2016 21:52:41 +0000
Subject: [PATCH] editor/syntax.c: cleanup -Wcast-qual warnings
syntax.c:266:14: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
for (p = (unsigned char *) text, q = p + strlen ((char *) p); p < q; p++, i++)
^
syntax.c:266:54: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
for (p = (unsigned char *) text, q = p + strlen ((char *) p); p < q; p++, i++)
^
syntax.c:298:39: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
if (j != 0 && strchr ((char *) p + 1, c) != NULL) /* c exists further down, so it will get matched later */
^
syntax.c:446:43: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
while (*(p = xx_strchr (edit, (unsigned char *) p + 1, c)) != '\0')
^
syntax.c:547:39: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
while (*(p = xx_strchr (edit, (unsigned char *) p + 1, c)) != '\0')
^
Signed-off-by: Andreas Mohr <and@gmx.li>
---
src/editor/syntax.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/editor/syntax.c b/src/editor/syntax.c
index 0e9bbee..6acfccb 100644
a
|
b
|
compare_word_to_right (const WEdit * edit, off_t i, const char *text, |
263 | 263 | if ((line_start != 0 && c != '\n') || (whole_left != NULL && strchr (whole_left, c) != NULL)) |
264 | 264 | return -1; |
265 | 265 | |
266 | | for (p = (unsigned char *) text, q = p + strlen ((char *) p); p < q; p++, i++) |
| 266 | for (p = (const unsigned char *) text, q = p + strlen ((const char *)p); p < q; p++, i++) |
267 | 267 | { |
268 | 268 | switch (*p) |
269 | 269 | { |
… |
… |
compare_word_to_right (const WEdit * edit, off_t i, const char *text, |
295 | 295 | if (*p == *text && p[1] == '\0') /* handle eg '+' and @+@ keywords properly */ |
296 | 296 | break; |
297 | 297 | } |
298 | | if (j != 0 && strchr ((char *) p + 1, c) != NULL) /* c exists further down, so it will get matched later */ |
| 298 | if (j != 0 && strchr ((const char *) p + 1, c) != NULL) /* c exists further down, so it will get matched later */ |
299 | 299 | break; |
300 | 300 | if (c == '\n' || c == '\t' || c == ' ' || |
301 | 301 | (whole_right != NULL && strchr (whole_right, c) == NULL)) |
… |
… |
apply_rules_going_right (WEdit * edit, off_t i) |
443 | 443 | p = r->keyword_first_chars; |
444 | 444 | |
445 | 445 | if (p != NULL) |
446 | | while (*(p = xx_strchr (edit, (unsigned char *) p + 1, c)) != '\0') |
| 446 | while (*(p = xx_strchr (edit, (const unsigned char *) p + 1, c)) != '\0') |
447 | 447 | { |
448 | 448 | syntax_keyword_t *k; |
449 | 449 | int count; |
… |
… |
apply_rules_going_right (WEdit * edit, off_t i) |
544 | 544 | r = CONTEXT_RULE (g_ptr_array_index (edit->rules, _rule.context)); |
545 | 545 | p = r->keyword_first_chars; |
546 | 546 | |
547 | | while (*(p = xx_strchr (edit, (unsigned char *) p + 1, c)) != '\0') |
| 547 | while (*(p = xx_strchr (edit, (const unsigned char *) p + 1, c)) != '\0') |
548 | 548 | { |
549 | 549 | syntax_keyword_t *k; |
550 | 550 | int count; |