diff options
author | Sven Gothel <[email protected]> | 2023-08-03 21:16:24 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-08-03 21:16:24 +0200 |
commit | 1e78cc429f148aa200ae487bacb6d4a9b6b7c8d9 (patch) | |
tree | d57264f74383821b356fa23504685694526829a7 | |
parent | 915726afa64f210fe34b1c1c869d357849c448c4 (diff) |
CMethodBindingEmitter.emitBodyMapCToJNIType(..): Add proper intendation to NIO ByteBuffer generation (isNIOBuffer || isCompoundTypeWrapper)
-rw-r--r-- | src/java/com/jogamp/gluegen/CMethodBindingEmitter.java | 22 |
1 files changed, 13 insertions, 9 deletions
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; |