[Piglit] [Bug 103248] piglit-util.h:308:8: error: cannot initialize a variable of type 'char *' with an rvalue of type 'const char *'

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu Oct 12 22:48:03 UTC 2017


https://bugs.freedesktop.org/show_bug.cgi?id=103248

--- Comment #4 from Vinson Lee <vlee at freedesktop.org> ---
(In reply to Brian Paul from comment #3)
> How about this?
> 
> 	return (t == NULL) ? ((char *) s + strlen(s)) : (char *) t;

Yes, the combined two changes fixes the build error for me.

diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index c4e7818088a7..3d2fd7e0c575 100644
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -305,9 +305,9 @@ strtol_hex(const char *nptr, char **endptr)
 static inline char *
 strchrnul(const char *s, int c)
 {
-       char *t = strchr(s, c);
+       const char *t = strchr(s, c);

-       return (t == NULL) ? ((char *) s + strlen(s)) : t;
+       return (t == NULL) ? ((char *) s + strlen(s)) : (char *) t;
 }
 #endif

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20171012/50cad82c/attachment-0001.html>


More information about the Piglit mailing list