mesa: Deal with size differences between GLuint and GLhandleARB in GetAttachedObjectsARB
authorJeremy Huddleston Sequoia <jeremyhu@apple.com>
Thu, 21 Jan 2016 01:10:54 +0000 (17:10 -0800)
committerJeremy Huddleston Sequoia <jeremyhu@apple.com>
Thu, 21 Jan 2016 17:18:06 +0000 (09:18 -0800)
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Nicolai Hähnle <nhaehnle@gmail.com>
src/mesa/main/shaderapi.c

index a988f41697bb1b16e743d282cdd4339f4d4cd15a..5854369a28c7e0dce169742d89b4fdcacc25ec85 100644 (file)
@@ -1374,10 +1374,26 @@ _mesa_DetachShader(GLuint program, GLuint shader)
 
 void GLAPIENTRY
 _mesa_GetAttachedObjectsARB(GLhandleARB container, GLsizei maxCount,
-                            GLsizei * count, GLhandleARB * obj)
+                            GLsizei * count, GLhandleARB * objARB)
 {
+   int i;
+   GLuint *obj;
+
    GET_CURRENT_CONTEXT(ctx);
+
+   obj = calloc(maxCount, sizeof(GLuint));
+   if (!obj) {
+      _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetAttachedObjectsARB");
+      return;
+   }
+
    get_attached_shaders(ctx, container, maxCount, count, obj);
+
+   for (i = 0 ; i < *count; i++) {
+      objARB[i] = (GLhandleARB)obj[i];
+   }
+
+   free(obj);
 }