From James Turner, "Converting the loops to forward versions fixed the issue. The problem is size_t is unsigned; at the limit condition it doesn’t go negative but wraps around to 0xffffffffffffffff …. and boom."

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14480 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2014-11-19 09:33:53 +00:00
parent f40df07ec7
commit 5ab861cd04

View File

@@ -204,12 +204,10 @@ bool isSizedInternalFormat(GLint internalFormat)
{
const size_t formatsCount = sizeof(sizedInternalFormats) / sizeof(sizedInternalFormats[0]);
size_t i = 0;
while(i < formatsCount)
for (size_t i=0; i < formatsCount; ++i)
{
if((GLenum)internalFormat == sizedInternalFormats[i].sizedInternalFormat)
return true;
++i;
}
return false;
@@ -219,12 +217,10 @@ GLenum assumeSizedInternalFormat(GLint internalFormat, GLenum type)
{
const size_t formatsCount = sizeof(sizedInternalFormats) / sizeof(sizedInternalFormats[0]);
size_t i = formatsCount;
while(i >= 0)
for (size_t i=0; i < formatsCount; ++i)
{
if(internalFormat == sizedInternalFormats[i].internalFormat && type == sizedInternalFormats[i].type)
return sizedInternalFormats[i].sizedInternalFormat;
--i;
}
return 0;
@@ -234,12 +230,10 @@ bool isCompressedInternalFormatSupportedByTexStorrage(GLint internalFormat)
{
const size_t formatsCount = sizeof(compressedInternalFormats) / sizeof(compressedInternalFormats[0]);
size_t i = 0;
while(i < formatsCount)
for (size_t i=0; i < formatsCount; ++i)
{
if((GLenum)internalFormat == compressedInternalFormats[i].sizedInternalFormat)
return true;
++i;
}
return false;