diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2005-12-01 00:59:51 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2005-12-01 00:59:51 +0000 |
commit | 6b25193b9266fd1759845d65dcf41f3d5e3a0d3c (patch) | |
tree | 081f7f5c2eb521c868384647f4b9b8605d6a3fd4 | |
parent | 0e31e02aef4fe44b1196d0bf6e351250d9d8f68c (diff) |
try removing need for the uintptr_t casts
-rw-r--r-- | src/mesa/main/bufferobj.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index a1d4c0190a..03aec367c4 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -433,6 +433,7 @@ _mesa_validate_pbo_access(GLuint dimensions, GLenum format, GLenum type, const GLvoid *ptr) { GLvoid *start, *end; + const GLubyte *sizeAddr; /* buffer size, cast to a pointer */ ASSERT(pack->BufferObj->Name != 0); @@ -449,11 +450,13 @@ _mesa_validate_pbo_access(GLuint dimensions, format, type, depth-1, height-1, width); - if ((const GLubyte *) start > (const GLubyte *)(uintptr_t) pack->BufferObj->Size) { + sizeAddr = ((const GLubyte *) 0) + pack->BufferObj->Size; + + if ((const GLubyte *) start > sizeAddr) { /* This will catch negative values / wrap-around */ return GL_FALSE; } - if ((const GLubyte *) end > (const GLubyte *)(uintptr_t) pack->BufferObj->Size) { + if ((const GLubyte *) end > sizeAddr) { /* Image read goes beyond end of buffer */ return GL_FALSE; } |