Mesa (main): egl: fix in expected type

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Jun 19 19:56:17 UTC 2021


Module: Mesa
Branch: main
Commit: b4d90b1182acb3365789755a618ef14cc7e53fa6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b4d90b1182acb3365789755a618ef14cc7e53fa6

Author: Eleni Maria Stea <elene.mst at gmail.com>
Date:   Thu Jun 10 14:09:02 2021 +0300

egl: fix in expected type

Function mincore expects a pointer of type char* but we use an unsigned
char* instead generating signedness related warnings.

v2: Made the fix FreeBSD specific because the type is unsigned char* for
Linux and char* for FreeBSD. (Adam Jackson)

v3: We'd rather cast the param to (void*) to avoid warnings in all
systems (Adam Jackson)

Signed-off-by: Eleni Maria Stea <elene.mst at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11298>

---

 src/egl/main/eglglobals.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/egl/main/eglglobals.c b/src/egl/main/eglglobals.c
index dd2b07c0da4..e0e9044a924 100644
--- a/src/egl/main/eglglobals.c
+++ b/src/egl/main/eglglobals.c
@@ -147,7 +147,10 @@ _eglPointerIsDereferencable(void *p)
    /* align addr to page_size */
    addr &= ~(page_size - 1);
 
-   if (mincore((void *) addr, page_size, &valid) < 0) {
+   /* mincore expects &valid to be unsigned char* on Linux but char* on BSD:
+    * we cast pointers to void, to fix type mismatch warnings in all systems
+    */
+   if (mincore((void *) addr, page_size, (void*)&valid) < 0) {
       return EGL_FALSE;
    }
 



More information about the mesa-commit mailing list