[Mesa-dev] [PATCH v2] mesa: Deal with size differences between GLuint and GLhandleARB in GetAttachedObjectsARB

Jeremy Huddleston Sequoia jeremyhu at apple.com
Thu Jan 21 08:48:46 PST 2016


Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
CC: Nicolai Hähnle <nhaehnle at gmail.com>
CC: Matt Turner <mattst88 at gmail.com>
---
 src/mesa/main/shaderapi.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index a988f41..7a0d19a 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -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, "glShaderSourceARB");
+      return;
+   }
+
    get_attached_shaders(ctx, container, maxCount, count, obj);
+
+   for (i = 0 ; i < *count; i++) {
+      objARB[i] = (GLhandleARB)obj[i];
+   }
+
+   free(obj);
 }
 
 
-- 
2.7.0



More information about the mesa-dev mailing list