[Piglit] [PATCH] vbo-map-unsync: Fix GCC int-to-pointer cast warnings.

Vinson Lee vlee at freedesktop.org
Sat Jan 5 01:08:17 PST 2013


This patch fixes these GCC warnings.

vbo-map-unsync.c:135:40: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
vbo-map-unsync.c:136:47: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
vbo-map-unsync.c:155:40: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
vbo-map-unsync.c:156:47: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
 tests/general/vbo-map-unsync.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tests/general/vbo-map-unsync.c b/tests/general/vbo-map-unsync.c
index 487db57..bda25a7 100644
--- a/tests/general/vbo-map-unsync.c
+++ b/tests/general/vbo-map-unsync.c
@@ -37,6 +37,7 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 	config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
 PIGLIT_GL_TEST_CONFIG_END
 
+#define BUFFER_OFFSET(i) ((char *)NULL + (i))
 
 static const struct {
 	GLfloat pos[3];
@@ -132,8 +133,8 @@ piglit_display(void)
 	glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
 
 	/* Draw first triangle: upper-right half of window */
-	glVertexPointer(3, GL_FLOAT, vstride, (void *) voffset1);
-	glColorPointer(4, GL_UNSIGNED_BYTE, vstride, (void *) coffset1);
+	glVertexPointer(3, GL_FLOAT, vstride, BUFFER_OFFSET(voffset1));
+	glColorPointer(4, GL_UNSIGNED_BYTE, vstride, BUFFER_OFFSET(coffset1));
 
 	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, NULL);
 
@@ -152,8 +153,8 @@ piglit_display(void)
 	glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
 
 	/* Draw second triangle: lower-left half of window */
-	glVertexPointer(3, GL_FLOAT, vstride, (void *) voffset2);
-	glColorPointer(4, GL_UNSIGNED_BYTE, vstride, (void *) coffset2);
+	glVertexPointer(3, GL_FLOAT, vstride, BUFFER_OFFSET(voffset2));
+	glColorPointer(4, GL_UNSIGNED_BYTE, vstride, BUFFER_OFFSET(coffset2));
 
 	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, NULL);
 
-- 
1.8.0



More information about the Piglit mailing list