mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-02 11:00:27 +01:00
util/u_printf: Fix const correctness in util_printf_next_spec_pos
Fix compiler error:
../src/util/u_printf.c:75:13: error: initializing 'char *' with an
expression of type 'const char *' discards qualifiers
[-Werror,-Wincompatible-pointer-types-discards-qualifiers]
75 | char *spec_pos = strpbrk(str_found, "cdieEfFgGaAosuxXp%");
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
glibc now provides C23-style type-generic string functions. strpbrk
returns const char * when passed a const char * argument. Update
spec_pos declaration to match.
Fixes: 6d263ff5a3 ("util: Convert util/u_printf.cpp to util/u_printf.c")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
(cherry picked from commit c576d64801)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39117>
This commit is contained in:
parent
b8f5e721f0
commit
283cb22720
2 changed files with 2 additions and 2 deletions
|
|
@ -844,7 +844,7 @@
|
|||
"description": "util/u_printf: Fix const correctness in util_printf_next_spec_pos",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "6d263ff5a3ec3352bd5e0b1750d38b173d50a1dc",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ size_t util_printf_next_spec_pos(const char *str, size_t pos)
|
|||
continue;
|
||||
}
|
||||
|
||||
char *spec_pos = strpbrk(str_found, "cdieEfFgGaAosuxXp%");
|
||||
const char *spec_pos = strpbrk(str_found, "cdieEfFgGaAosuxXp%");
|
||||
if (spec_pos == NULL) {
|
||||
return -1;
|
||||
} else if (*spec_pos == '%') {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue