From e424c28f869269f5a22c22ef017230346b22847a Mon Sep 17 00:00:00 2001 From: Xerxes Rånby Date: Wed, 8 Jul 2015 22:06:32 +0200 Subject: BUG 1166: Fix JavaEmitter JVMUtil_NewDirectByteBufferCopy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prevents jlong to jint truncation when capacity is passed from jni to java. com.jogamp.common.nio.Buffers newDirectByteBuffer and the underlying java.nio.ByteBuffer allocateDirect only work with capacitys of int size. Signed-off-by: Xerxes Rånby --- src/java/com/jogamp/gluegen/JavaEmitter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/java/com/jogamp/gluegen/JavaEmitter.java b/src/java/com/jogamp/gluegen/JavaEmitter.java index 60cd3f4..1952a43 100644 --- a/src/java/com/jogamp/gluegen/JavaEmitter.java +++ b/src/java/com/jogamp/gluegen/JavaEmitter.java @@ -2501,7 +2501,7 @@ public class JavaEmitter implements GlueEmitter { if (getConfig().emitImpl()) { cWriter.println("#include "); cWriter.println(); - cWriter.println("static jobject JVMUtil_NewDirectByteBufferCopy(JNIEnv *env, void * source_address, jlong capacity); /* forward decl. */"); + cWriter.println("static jobject JVMUtil_NewDirectByteBufferCopy(JNIEnv *env, void * source_address, jint capacity); /* forward decl. */"); cWriter.println(); } for (final String code : cfg.customCCode()) { @@ -2549,7 +2549,7 @@ public class JavaEmitter implements GlueEmitter { " return JNI_TRUE;\n"+ "}\n"+ "\n"+ - "static jobject JVMUtil_NewDirectByteBufferCopy(JNIEnv *env, void * source_address, jlong capacity) {\n"+ + "static jobject JVMUtil_NewDirectByteBufferCopy(JNIEnv *env, void * source_address, jint capacity) {\n"+ " jobject jbyteBuffer;\n"+ " void * byteBufferPtr;\n"+ "\n"+ -- cgit v1.2.3