]> git.cworth.org Git - apitrace/commitdiff
Make attrib pair lists explicit.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Wed, 1 Feb 2012 19:50:40 +0000 (19:50 +0000)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Wed, 1 Feb 2012 19:50:40 +0000 (19:50 +0000)
glsize.hpp
specs/eglapi.py

index 1d1ce45178126ea94964069fab1279eab88d5d06..41ac5154ba301e1337362c6e60d8d9e7b711d3bf 100644 (file)
@@ -744,18 +744,18 @@ __glClearBuffer_size(GLenum buffer)
 }
 
 /* 
- * 0 terminated integer/float attribute list.
+ * attribute list, terminated by the given terminator.
  */
 template<class T>
 static inline size_t
-__AttribList_size(const T *pAttribList)
+__AttribList_size(const T *pAttribList, const T terminator = 0)
 {
     size_t size = 0;
 
     if (pAttribList) {
         do {
             ++size;
-        } while (*pAttribList++);
+        } while (*pAttribList++ != terminator);
     }
 
     return size;
@@ -767,15 +767,16 @@ __AttribList_size(const T *pAttribList)
  */
 template<class T>
 static inline size_t
-__AttribList_size(const T *pAttribList, T terminator)
+__AttribPairList_size(const T *pAttribList, const T terminator = 0)
 {
     size_t size = 0;
 
     if (pAttribList) {
-        while (pAttribList[size] != terminator)
+        while (pAttribList[size] != terminator) {
             size += 2;
+        }
         // terminator also counts
-        size++;
+        ++size;
     }
 
     return size;
index 0c221a675f388a12d516416080f0aefac1a3f52d..fabe5bd2e5190925420882429c07910fb0a66347 100644 (file)
@@ -291,7 +291,7 @@ EGLuint64NV = Alias("EGLuint64NV", UInt64)
 
 eglapi = API("EGL")
 
-EGLAttribList = Array(Const(EGLattrib), "__AttribList_size(attrib_list, EGL_NONE)")
+EGLAttribList = Array(Const(EGLattrib), "__AttribPairList_size(attrib_list, EGL_NONE)")
 
 PROC = Opaque("__eglMustCastToProperFunctionPointerType")