From: José Fonseca Date: Wed, 1 Feb 2012 19:50:40 +0000 (+0000) Subject: Make attrib pair lists explicit. X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=ac2589fde46354dd224165f4d65f03b636c2d4b1;p=apitrace Make attrib pair lists explicit. --- diff --git a/glsize.hpp b/glsize.hpp index 1d1ce45..41ac515 100644 --- a/glsize.hpp +++ b/glsize.hpp @@ -744,18 +744,18 @@ __glClearBuffer_size(GLenum buffer) } /* - * 0 terminated integer/float attribute list. + * attribute list, terminated by the given terminator. */ template 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 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; diff --git a/specs/eglapi.py b/specs/eglapi.py index 0c221a6..fabe5bd 100644 --- a/specs/eglapi.py +++ b/specs/eglapi.py @@ -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")