[Piglit] [PATCH 3/3] util: Fix `cannot convert from 'const char *' to 'char *'` MSVC error.
Jose Fonseca
jfonseca at vmware.com
Wed Dec 3 07:37:23 PST 2014
From: José Fonseca <jfonseca at vmware.com>
When in C++ mode, MSVC defines overloaded versions of standard names
that preserve constness. :-/
http://msdn.microsoft.com/en-us/library/b34ccac3.aspx
---
tests/util/piglit-util.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index 099075a..af9fb97 100755
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -211,7 +211,11 @@ strtod_inf(const char *nptr, char **endptr)
static inline char *
strchrnul(const char *s, int c)
{
+#if defined(_MSC_VER) && defined(__cplusplus)
+ char *t = strchr((char *)s, c);
+#else
char *t = strchr(s, c);
+#endif
return (t == NULL) ? ((char *) s + strlen(s)) : t;
}
--
2.1.0
More information about the Piglit
mailing list