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
This commit is contained in:
Thomas Tafertshofer 2012-07-23 16:52:32 -07:00
parent 493c4feb75
commit 36b285eac9

View File

@ -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 + "}");