From c6d6bcbcaceaa229944f380437a28af3a84f1dcd Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Fri, 8 Jul 2005 16:02:53 +0000 Subject: Fixed Windows port after changes to GlueGen to include array offsets. Ported all demos to new API. Temporarily added back in GLU entry points taking primitive arrays as the underlying APIs (in particular, glTexImage2D) do not yet support non-direct Buffers. Changed C code generation to only add in array offset if array is non-null. Fixed bug in GLU tesselator demo's vertex callback. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JSR-231@318 232f8b59-042b-4e1e-8c03-345bb8c30851 --- src/net/java/games/gluegen/CMethodBindingEmitter.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/net/java/games/gluegen/CMethodBindingEmitter.java') diff --git a/src/net/java/games/gluegen/CMethodBindingEmitter.java b/src/net/java/games/gluegen/CMethodBindingEmitter.java index 0c41d3aa2..5cf2833d9 100644 --- a/src/net/java/games/gluegen/CMethodBindingEmitter.java +++ b/src/net/java/games/gluegen/CMethodBindingEmitter.java @@ -702,9 +702,19 @@ public class CMethodBindingEmitter extends FunctionEmitter } // end of data copy if (EMIT_NULL_CHECKS) { - writer.println(" }"); - } + writer.print(" }"); + if (needsDataCopy) { + writer.println(); + } else { + // Zero out array offset in the case of a null pointer + // being passed down to prevent construction of arbitrary + // pointers + writer.println(" else {"); + writer.println(" " + binding.getArgumentName(i) + "_offset = 0;"); + writer.println(" }"); + } + } } else if (javaArgType.isString()) { if (emittingPrimitiveArrayCritical) { continue; -- cgit v1.2.3