From ac2589fde46354dd224165f4d65f03b636c2d4b1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Wed, 1 Feb 2012 19:50:40 +0000 Subject: [PATCH] Make attrib pair lists explicit. --- glsize.hpp | 13 +++++++------ specs/eglapi.py | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) 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") -- 2.43.0