Skip to contentSkip to conversation

modetest: fix discards 'const' qualifier from pointer target type

PATCH New Rudi Heitbaum 1 participant 1 message Apr 2

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 modetest: fix discards 'const' qualifier from pointer target type

Since glibc-2.43:

For ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr, strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr 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.

fixes:
tests/modetest/modetest.c: In function 'parse_connector':
tests/modetest/modetest.c:1997:22: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
1997 | endp = strpbrk(p, ",@:");
| ^

---
 tests/modetest/modetest.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
tests/modetest/modetest.c +6 -4
index 24c0e2dc..3c0a8803 100644
@@ -1974,7 +1974,8 @@ static int parse_connector(struct pipe_arg *pipe, const char *arg)
 	unsigned int len;
 	unsigned int i;
 	const char *p;
-	char *endp;
+	const char *endp;
+	char *endp_tok;
 
 	pipe->vrefresh = 0;
 	pipe->crtc_id = (uint32_t)-1;
@@ -2012,7 +2013,8 @@ static int parse_connector(struct pipe_arg *pipe, const char *arg)
 		return -1;
 	if (*endp == '@') {
 		arg = endp + 1;
-		pipe->crtc_id = strtoul(arg, &endp, 10);
+		pipe->crtc_id = strtoul(arg, &endp_tok, 10);
+		endp = endp_tok;
 	}
 	if (*endp != ':')
 		return -1;
@@ -2028,8 +2030,8 @@ static int parse_connector(struct pipe_arg *pipe, const char *arg)
 	pipe->mode_str[len] = '\0';
 
 	if (*p == '-') {
-		pipe->vrefresh = strtof(p + 1, &endp);
-		p = endp;
+		pipe->vrefresh = strtof(p + 1, &endp_tok);
+		p = endp_tok;
 	}
 
 	if (*p == '@') {
Signature · 1 line
2.53.0