Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 36b285ea authored by Thomas Tafertshofer's avatar Thomas Tafertshofer
Browse files

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
parent 493c4feb
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1227,7 +1227,12 @@ public class JniCodeEmitter {
                String array = numBufferArgs <= 1 ? "_array" :
                            "_" + cfunc.getArgName(cIndex) + "Array";

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