summaryrefslogtreecommitdiffstats
path: root/opengl
diff options
context:
space:
mode:
authorThomas Tafertshofer <tafertth@google.com>2012-07-23 16:52:32 -0700
committerThomas Tafertshofer <tafertth@google.com>2012-07-23 17:06:52 -0700
commit36b285eac98cccdb9394c14ae2e6ace9f3d90966 (patch)
treef1efc4591f8419259a528806738ad01c6f9f3e57 /opengl
parent493c4feb753760408a33a5bef29c0f9c0ea4fc3b (diff)
downloadframeworks_native-36b285eac98cccdb9394c14ae2e6ace9f3d90966.zip
frameworks_native-36b285eac98cccdb9394c14ae2e6ace9f3d90966.tar.gz
frameworks_native-36b285eac98cccdb9394c14ae2e6ace9f3d90966.tar.bz2
Fixed bug in opengl es binding generation
This fixes the glgen code generation for methods which have a buffer arg that can be NULL. Bug: 6845189 Change-Id: I5fb745b806601e5665f97bfd15fd865cd9c241ed
Diffstat (limited to 'opengl')
-rw-r--r--opengl/tools/glgen/src/JniCodeEmitter.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/opengl/tools/glgen/src/JniCodeEmitter.java b/opengl/tools/glgen/src/JniCodeEmitter.java
index 726dc61..774f40c 100644
--- a/opengl/tools/glgen/src/JniCodeEmitter.java
+++ b/opengl/tools/glgen/src/JniCodeEmitter.java
@@ -1227,7 +1227,12 @@ public class JniCodeEmitter {
String array = numBufferArgs <= 1 ? "_array" :
"_" + cfunc.getArgName(cIndex) + "Array";
- out.println(indent + "if (" + cname +" == NULL) {");
+ boolean nullAllowed = isNullAllowed(cfunc) || isPointerFunc;
+ if (nullAllowed) {
+ out.println(indent + "if (" + cname + "_buf && " + cname +" == NULL) {");
+ } else {
+ out.println(indent + "if (" + cname +" == NULL) {");
+ }
out.println(indent + indent + "char * _" + cname + "Base = (char *)_env->GetPrimitiveArrayCritical(" + array + ", (jboolean *) 0);");
out.println(indent + indent + cname + " = (" +cfunc.getArgType(cIndex).getDeclaration() +") (_" + cname + "Base + " + bufferOffset + ");");
out.println(indent + "}");