commit 842ead6563f8bc04f562ed32fa56834045f5377d Author: Xerxes Rånby Date: Wed Jul 8 15:33:56 2015 +0200 Bug 1166: Fix JavaEmitter: JVMUtil_NewDirectByteBufferCopy Pass jlong capacity as jint to newDirectByteBuffer to prevent typecast truncation of capacity information while crossing jni -> java. Signed-off-by: Xerxes Rånby diff --git a/src/java/com/jogamp/gluegen/JavaEmitter.java b/src/java/com/jogamp/gluegen/JavaEmitter.java index 60cd3f4..c434824 100644 --- a/src/java/com/jogamp/gluegen/JavaEmitter.java +++ b/src/java/com/jogamp/gluegen/JavaEmitter.java @@ -2558,7 +2558,8 @@ public class JavaEmitter implements GlueEmitter { " (*env)->FatalError(env, \"initializeImpl() not called\");\n"+ " return NULL;\n"+ " }\n"+ - " jbyteBuffer = (*env)->CallStaticObjectMethod(env, clazzBuffers, cstrBuffersNew, capacity);\n"+ + " jint intcapacity = capacity;\n" + + " jbyteBuffer = (*env)->CallStaticObjectMethod(env, clazzBuffers, cstrBuffersNew, intcapacity);\n"+ " byteBufferPtr = (*env)->GetDirectBufferAddress(env, jbyteBuffer);\n"+ " memcpy(byteBufferPtr, source_address, capacity);\n"+ " return jbyteBuffer;\n"+