From a96da583faefaaad9c16db7f30c51f76dcb4d4a6 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 19 Dec 2025 22:10:18 -0800 Subject: [PATCH] util/blob: Fix const correctness warning in blob_read_string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix compiler error: ../src/util/blob.c:344:8: error: assigning to 'uint8_t *' from 'const void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] glibc now provides C23-style type-generic string functions. memchr returns const void * when passed a const void * argument. Update nul declaration to const since it's only used to find the null terminator position and calculate a size. Fixes: 1c9877327ea ("glsl: Add blob.c---a simple interface for serializing data") Signed-off-by: Vinson Lee Reviewed-by: Tapani Pälli (cherry picked from commit b40850b24a09cd96c9de8c642fb8e4cd4ae587f6) Part-of: --- .pick_status.json | 2 +- src/util/blob.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 09d2a441af2..da3796f6ea2 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -964,7 +964,7 @@ "description": "util/blob: Fix const correctness warning in blob_read_string", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "1c9877327ead37b7dd5a0ca3a8c7912e924328e5", "notes": null diff --git a/src/util/blob.c b/src/util/blob.c index 9fb30e30e96..fb583c94abf 100644 --- a/src/util/blob.c +++ b/src/util/blob.c @@ -330,7 +330,7 @@ blob_read_string(struct blob_reader *blob) { int size; char *ret; - uint8_t *nul; + const uint8_t *nul; /* If we're already at the end, then this is an overrun. */ if (blob->current >= blob->end) {