[Mesa-dev] [PATCH 2/4] egl: Fix type errors in _eglParseSyncAttribList64()

Chad Versace chad.versace at intel.com
Fri Jul 8 22:44:19 UTC 2016


- The list elements have type EGLAttrib, not EGLint.
- The array index iterator should be size_t, not EGLint.
---
 src/egl/main/eglsync.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/egl/main/eglsync.c b/src/egl/main/eglsync.c
index 33625e9..48714d1 100644
--- a/src/egl/main/eglsync.c
+++ b/src/egl/main/eglsync.c
@@ -26,6 +26,7 @@
  **************************************************************************/
 
 
+#include <inttypes.h>
 #include <string.h>
 
 #include "eglsync.h"
@@ -69,14 +70,14 @@ _eglParseSyncAttribList(_EGLSync *sync, const EGLint *attrib_list)
 static EGLint
 _eglParseSyncAttribList64(_EGLSync *sync, const EGLAttrib *attrib_list)
 {
-   EGLint i, err = EGL_SUCCESS;
+   EGLint err = EGL_SUCCESS;
 
    if (!attrib_list)
       return EGL_SUCCESS;
 
-   for (i = 0; attrib_list[i] != EGL_NONE; i++) {
-      EGLint attr = attrib_list[i++];
-      EGLint val = attrib_list[i];
+   for (size_t i = 0; attrib_list[i] != EGL_NONE; i++) {
+      EGLAttrib attr = attrib_list[i++];
+      EGLAttrib val = attrib_list[i];
 
       switch (attr) {
       case EGL_CL_EVENT_HANDLE_KHR:
@@ -92,8 +93,8 @@ _eglParseSyncAttribList64(_EGLSync *sync, const EGLAttrib *attrib_list)
       }
 
       if (err != EGL_SUCCESS) {
-         _eglLog(_EGL_DEBUG, "bad sync attribute 0x%04x", attr);
-         break;
+         _eglLog(_EGL_DEBUG, "bad sync attribute 0x%" PRIxPTR, attr);
+         return err;
       }
    }
 
-- 
2.9.0.rc2



More information about the mesa-dev mailing list