From 4101b57d2b360c95113119da4221b7210c15eca8 Mon Sep 17 00:00:00 2001
From: Andreas Mohr <and@gmx.li>
Date: Sat, 20 Feb 2016 17:12:37 +0000
Subject: [PATCH] strutil/strutilutf8.c: cleanup some -Wcast-qual warnings
strutilutf8.c: In function 'str_utf8_vfs_convert_to':
strutilutf8.c:430:39: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
result = str_nconvert (coder, (char *) string, size, buffer);
^
strutilutf8.c: In function 'str_utf8_search_first':
strutilutf8.c:996:30: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
fold_text = (case_sen) ? (char *) text : g_utf8_casefold (text, -1);
^
strutilutf8.c: In function 'str_utf8_search_last':
strutilutf8.c:1040:30: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
fold_text = (case_sen) ? (char *) text : g_utf8_casefold (text, -1);
^
Signed-off-by: Andreas Mohr <and@gmx.li>
---
lib/strutil/strutilutf8.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/lib/strutil/strutilutf8.c b/lib/strutil/strutilutf8.c
index 8ec754d..aea7ecc 100644
a
|
b
|
str_utf8_vfs_convert_to (GIConv coder, const char *string, int size, GString * b |
427 | 427 | if (coder == str_cnv_not_convert) |
428 | 428 | g_string_append_len (buffer, string, size); |
429 | 429 | else |
430 | | result = str_nconvert (coder, (char *) string, size, buffer); |
| 430 | result = str_nconvert (coder, string, size, buffer); |
431 | 431 | |
432 | 432 | return result; |
433 | 433 | } |
… |
… |
str_utf8_search_first (const char *text, const char *search, int case_sen) |
993 | 993 | const char *result = NULL; |
994 | 994 | const char *m; |
995 | 995 | |
996 | | fold_text = (case_sen) ? (char *) text : g_utf8_casefold (text, -1); |
| 996 | fold_text = (case_sen) ? g_strdup (text) : g_utf8_casefold (text, -1); |
997 | 997 | deco_text = g_utf8_normalize (fold_text, -1, G_NORMALIZE_ALL); |
998 | 998 | |
999 | 999 | match = deco_text; |
… |
… |
str_utf8_search_first (const char *text, const char *search, int case_sen) |
1020 | 1020 | while (match != NULL && result == NULL); |
1021 | 1021 | |
1022 | 1022 | g_free (deco_text); |
1023 | | if (!case_sen) |
1024 | | g_free (fold_text); |
| 1023 | g_free (fold_text); |
1025 | 1024 | |
1026 | 1025 | return result; |
1027 | 1026 | } |
… |
… |
str_utf8_search_last (const char *text, const char *search, int case_sen) |
1037 | 1036 | const char *result = NULL; |
1038 | 1037 | const char *m; |
1039 | 1038 | |
1040 | | fold_text = (case_sen) ? (char *) text : g_utf8_casefold (text, -1); |
| 1039 | fold_text = (case_sen) ? g_strdup (text) : g_utf8_casefold (text, -1); |
1041 | 1040 | deco_text = g_utf8_normalize (fold_text, -1, G_NORMALIZE_ALL); |
1042 | 1041 | |
1043 | 1042 | do |
… |
… |
str_utf8_search_last (const char *text, const char *search, int case_sen) |
1063 | 1062 | while (match != NULL && result == NULL); |
1064 | 1063 | |
1065 | 1064 | g_free (deco_text); |
1066 | | if (!case_sen) |
1067 | | g_free (fold_text); |
| 1065 | g_free (fold_text); |
1068 | 1066 | |
1069 | 1067 | return result; |
1070 | 1068 | } |