From 1e78cc429f148aa200ae487bacb6d4a9b6b7c8d9 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 3 Aug 2023 21:16:24 +0200 Subject: CMethodBindingEmitter.emitBodyMapCToJNIType(..): Add proper intendation to NIO ByteBuffer generation (isNIOBuffer || isCompoundTypeWrapper) --- .../com/jogamp/gluegen/CMethodBindingEmitter.java | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src/java') diff --git a/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java index 9646774..ed883fb 100644 --- a/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java +++ b/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java @@ -1107,11 +1107,14 @@ public class CMethodBindingEmitter extends FunctionEmitter { unit.addTailCode(CCodeUnit.NewDirectByteBufferCopyUnitCode); } else if (javaType.isNIOBuffer() || javaType.isCompoundTypeWrapper()) { if( addLocalVar ) { - unit.emit(" "+javaType.jniTypeName()+" "+javaArgName+" = "); + unit.emitln(" "+javaType.jniTypeName()+" "+javaArgName+";"); } else { - unit.emit(" "+javaArgName+" = "); + unit.emitln(" "+javaArgName+";"); } - unit.emit("(NULL == "+cArgName+") ? NULL : (*env)->NewDirectByteBuffer(env, (void *)"+cArgName+", "); + unit.emitln(" if(NULL == "+cArgName+") {"); + unit.emitln(" "+javaArgName+" = NULL;"); + unit.emitln(" } else {"); + unit.emit (" "+javaArgName+" = (*env)->NewDirectByteBuffer(env, (void *)"+cArgName+", "); // See whether capacity has been specified if ( isReturnVal && returnValueCapacityExpression != null) { @@ -1168,13 +1171,14 @@ public class CMethodBindingEmitter extends FunctionEmitter { "value for function \"" + binding.getName() + "\". " + wmsg + " (sizeof(" + cType.getCName() + ")): " + binding); } } - unit.emitln(" /** "); - unit.emitln(" * mode: "+mode+", arg #"+argIdx); - unit.emitln(" * cType: "+cType.getDebugString()); - unit.emitln(" * cTargetType: "+cTargetType.getDebugString()); - unit.emitln(" * javaType: "+javaType.getDebugString()); - unit.emitln(" */"); + unit.emitln(" /** "); + unit.emitln(" * mode: "+mode+", arg #"+argIdx); + unit.emitln(" * cType: "+cType.getDebugString()); + unit.emitln(" * cTargetType: "+cTargetType.getDebugString()); + unit.emitln(" * javaType: "+javaType.getDebugString()); + unit.emitln(" */"); } + unit.emitln(" }"); } else if (javaType.isString()) { final boolean pascalString = javaType.isPascalStringVariant(); final String lenArgName; -- cgit v1.2.3