gweb: Fix issue with const return value from memchr
PATCH 3/5 gweb: Fix issue with const return value from memchr
When compiling with recent gcc and glibc-2.43 the --Wdiscarded-qualifiers warning occurs because with ISO C23, the function memchr that return pointers into their input arrays now have definitions as macros that return a pointer to a const-qualified type when the input argument is a pointer to a const-qualified type.
../gweb/gweb.c: In function 'decode_chunked':../gweb/gweb.c:1034:29: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
1034 | pos = memchr(ptr, '\n', len);
| ^../gweb/gweb.c: In function 'g_web_parser_feed_data': ../gweb/gweb.c:2922:29: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 2922 | pos = memchr(ptr, chr, length); | ^
--- gweb/gweb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
gweb/gweb.c +2 -2
@@ -1025,7 +1025,7 @@ static int decode_chunked(struct web_session *session,gsize counter;while (len >0 ) { -guint8 *pos; +const guint8 *pos;gsize count;char *str;
@@ -2917,7 +2917,7 @@ void g_web_parser_feed_data(GWebParser *parser,guint8 chr = parser->token_str[parser->token_pos];if (parser->token_pos ==0 ) { -guint8 *pos; +const guint8 *pos; pos =memchr (ptr, chr, length);if (!pos) {
Signature · 1 line
2.51.0