X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=glsize.hpp;h=d81cdf1fe6071db14ac6853b6d4a3a5fa3405d62;hb=b491d2958e2a8331f0f144de89626c284ae96121;hp=1d1ce45178126ea94964069fab1279eab88d5d06;hpb=335efb454aac9540ddf22c55ea09822f981b45ba;p=apitrace diff --git a/glsize.hpp b/glsize.hpp index 1d1ce45..d81cdf1 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 = static_cast(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 = static_cast(0)) { size_t size = 0; if (pAttribList) { - while (pAttribList[size] != terminator) + while (pAttribList[size] != terminator) { size += 2; + } // terminator also counts - size++; + ++size; } return size;