From 5ab861cd042ca1ca5e8656927b9c8a8e4945d411 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 19 Nov 2014 09:33:53 +0000 Subject: [PATCH] =?UTF-8?q?From=20James=20Turner,=20"Converting=20the=20lo?= =?UTF-8?q?ops=20to=20forward=20versions=20fixed=20the=20issue.=20The=20pr?= =?UTF-8?q?oblem=20is=20size=5Ft=20is=20unsigned;=20at=20the=20limit=20con?= =?UTF-8?q?dition=20it=20doesn=E2=80=99t=20go=20negative=20but=20wraps=20a?= =?UTF-8?q?round=20to=200xffffffffffffffff=20=E2=80=A6.=20and=20boom."?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14480 16af8721-9629-0410-8352-f15c8da7e697 --- src/osg/Texture.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/osg/Texture.cpp b/src/osg/Texture.cpp index 7ce8db4c0..8ae79b685 100644 --- a/src/osg/Texture.cpp +++ b/src/osg/Texture.cpp @@ -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;