aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java
diff options
context:
space:
mode:
authorWade Walker <[email protected]>2014-03-04 15:21:35 -0600
committerWade Walker <[email protected]>2014-03-04 15:21:35 -0600
commit86c868fcb78b53f02ad2bae1770e4db61b892678 (patch)
treeb1cc5d86954338f5449b39412f74115552495db5 /src/java/com/jogamp/gluegen/CMethodBindingEmitter.java
parent15ea21ea190a79a3740b66698103ef5b4f145e94 (diff)
Remove warnings in emitted C code.
Fix 1: Only emit "int * _offsetHandle = NULL" if it will be used, to avoid unused variable warning. Fix 2: Add "unsigned" to typecasts in C function calls when needed to avoid implicit typecast warning. This commit also adds a unit test for a method that uses an "unsigned char **" parameter, to mimic the JOCL clCreateProgramWithBinary() function that caused the typecast warnings.
Diffstat (limited to 'src/java/com/jogamp/gluegen/CMethodBindingEmitter.java')
-rw-r--r--src/java/com/jogamp/gluegen/CMethodBindingEmitter.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java
index d856767..39141f2 100644
--- a/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java
+++ b/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java
@@ -427,7 +427,8 @@ public class CMethodBindingEmitter extends FunctionEmitter {
writer.println(" jsize _tmpArrayLen;");
// Pointer to the data in the Buffer, taking the offset into account
- writer.println(" int * _offsetHandle = NULL;");
+ if(type.isNIOBufferArray())
+ writer.println(" int * _offsetHandle = NULL;");
emittedDataCopyTemps = true;
}
@@ -925,6 +926,15 @@ public class CMethodBindingEmitter extends FunctionEmitter {
if (isConstPtrPtr(cArgType)) {
writer.print("const ");
}
+
+ // if this is a pointer to an unsigned type, add unsigned to the name to avoid compiler warnings
+ if(cArgType.isPointer()) {
+ Type typeLast = ((PointerType)cArgType).getLastTargetType();
+ if(typeLast.isInt() && (((IntType)typeLast).isPrimitiveUnsigned())) {
+ writer.print("unsigned ");
+ }
+ }
+
writer.print(cArgType.getName());
writer.print(") ");
if (binding.getCArgumentType(i).isPointer() && javaArgType.isPrimitive()) {