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

Commit b62e242c authored by Pablo Ceballos's avatar Pablo Ceballos
Browse files

glgen: Better support for null arguments in JNI

- Modify the checks.spec file format to specify which argument is
  allowed to be null.
- Update the JniCodeEmitter to support passing null arguments for all
  pointer types as well as strings.
- Update the EGL/GLES checks.spec files and stub files to allow null
  arguments through the JNI layer where the spec allows it.

Bug 9321681

Change-Id: I7d8e7319b43da95993516aa3ac5318b971a1ff92
parent 6e209134
Loading
Loading
Loading
Loading
+7 −7
Original line number Original line Diff line number Diff line
eglInitialize check major 1 check minor 1
eglInitialize nullAllowed major nullAllowed minor check major 1 check minor 1
eglGetConfigs check configs config_size
eglGetConfigs nullAllowed configs check configs config_size
eglChooseConfig check configs config_size check num_config 1 sentinel attrib_list EGL_NONE
eglChooseConfig nullAllowed configs check configs config_size check num_config 1 sentinel attrib_list EGL_NONE
eglGetConfigAttrib check value 1
eglGetConfigAttrib check value 1
//STUB function: //eglCreateWindowSurface sentinel attrib_list EGL_NONE
//STUB function: //eglCreateWindowSurface nullAllowed attrib_list sentinel attrib_list EGL_NONE
eglCreatePbufferSurface sentinel attrib_list EGL_NONE
eglCreatePbufferSurface nullAllowed attrib_list sentinel attrib_list EGL_NONE
//unsupported: eglCreatePixmapSurface sentinel attrib_list EGL_NONE
//unsupported: eglCreatePixmapSurface nullAllowed attrib_list sentinel attrib_list EGL_NONE
eglCreatePixmapSurface unsupported
eglCreatePixmapSurface unsupported
eglCopyBuffers unsupported
eglCopyBuffers unsupported
eglQuerySurface check value 1
eglQuerySurface check value 1
eglCreatePbufferFromClientBuffer sentinel attrib_list EGL_NONE
//STUB function: eglCreatePbufferFromClientBuffer nullAllowed attrib_list sentinel attrib_list EGL_NONE
eglCreateContext sentinel attrib_list EGL_NONE
eglCreateContext sentinel attrib_list EGL_NONE
eglQueryContext check value 1
eglQueryContext check value 1
+9 −4
Original line number Original line Diff line number Diff line
@@ -19,7 +19,7 @@
# is not perfect but better than nothing.
# is not perfect but better than nothing.
#
#


glBufferData nullAllowed check data size
glBufferData nullAllowed data check data size
glBufferSubData check data size
glBufferSubData check data size
# glCompressedTexImage2D
# glCompressedTexImage2D
# glCompressedTexSubImage2D
# glCompressedTexSubImage2D
@@ -45,7 +45,7 @@ glGenRenderbuffers check renderbuffers n
glGenTextures check textures n
glGenTextures check textures n
// glGetActiveAttrib
// glGetActiveAttrib
// glGetActiveUniform
// glGetActiveUniform
glGetAttachedShaders nullAllowed check count 1 check shaders maxcount
glGetAttachedShaders nullAllowed count check count 1 check shaders maxcount
// glGetBooleanv
// glGetBooleanv
glGetBufferParameter check params 1
glGetBufferParameter check params 1
glGetClipPlanef check eqn 4
glGetClipPlanef check eqn 4
@@ -57,8 +57,10 @@ glGetFramebufferAttachmentParameterivOES check params 1
// glGetIntegerv
// glGetIntegerv
glGetLight ifcheck params 3 pname GL_SPOT_DIRECTION ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION
glGetLight ifcheck params 3 pname GL_SPOT_DIRECTION ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION
glGetMaterial ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION,GL_AMBIENT_AND_DIFFUSE
glGetMaterial ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION,GL_AMBIENT_AND_DIFFUSE
glGetProgramBinary nullAllowed length
// glGetProgramInfoLog
// glGetProgramInfoLog
glGetProgramiv check params 1
glGetProgramiv check params 1
glGetProgramResourceiv nullAllowed length
glGetRenderbufferParameteriv check params 1
glGetRenderbufferParameteriv check params 1
glGetRenderbufferParameterivOES check params 1
glGetRenderbufferParameterivOES check params 1
// glGetShaderInfoLog
// glGetShaderInfoLog
@@ -66,6 +68,7 @@ glGetShaderiv check params 1
glGetShaderPrecisionFormat check range 1 check precision 1
glGetShaderPrecisionFormat check range 1 check precision 1
// glGetShaderSource
// glGetShaderSource
// glGetString
// glGetString
glGetSynciv nullAllowed length
glGetTexEnv ifcheck params 4 pname GL_TEXTURE_ENV_COLOR
glGetTexEnv ifcheck params 4 pname GL_TEXTURE_ENV_COLOR
glGetTexGen ifcheck params 4 pname GL_OBJECT_PLANE,GL_EYE_PLANE
glGetTexGen ifcheck params 4 pname GL_OBJECT_PLANE,GL_EYE_PLANE
glGetTexParameter check params 1
glGetTexParameter check params 1
@@ -76,15 +79,17 @@ glLightModel ifcheck params 4 pname GL_LIGHT_MODEL_AMBIENT
glLoadMatrix check m 16
glLoadMatrix check m 16
glMaterial ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION,GL_AMBIENT_AND_DIFFUSE
glMaterial ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION,GL_AMBIENT_AND_DIFFUSE
glMultMatrix check m 16
glMultMatrix check m 16
glObjectLabelKHR nullAllowed label
glPointParameter check params 1
glPointParameter check params 1
glQueryMatrixxOES check mantissa 16 check exponent 16 return -1
glQueryMatrixxOES check mantissa 16 check exponent 16 return -1
# glReadPixels
# glReadPixels
glShaderBinary check binary length
glShaderBinary check binary length
// glShaderSource
// glShaderSource
glTexEnv ifcheck params 4 pname GL_TEXTURE_ENV_COLOR
glTexEnv ifcheck params 4 pname GL_TEXTURE_ENV_COLOR
glTexImage2D nullAllowed
glTexImage2D nullAllowed pixels
glTexImage3D nullAllowed pixels
glTexParameter check params 1
glTexParameter check params 1
glTexSubImage2D nullAllowed
glTexSubImage2D nullAllowed pixels
glUniform1 check v count
glUniform1 check v count
glUniform2 check v count*2
glUniform2 check v count*2
glUniform3 check v count*3
glUniform3 check v count*3
+3 −3
Original line number Original line Diff line number Diff line
@@ -19,9 +19,9 @@ glMaterial ifcheck params 1 pname GL_SHININESS ifcheck params 4 pname GL_AMBIENT
glMultMatrix check m 16
glMultMatrix check m 16
glPointParameter check params 1
glPointParameter check params 1
glTexEnv ifcheck params 1 pname GL_TEXTURE_ENV_MODE,GL_COMBINE_RGB,GL_COMBINE_ALPHA ifcheck params 4 pname GL_TEXTURE_ENV_COLOR
glTexEnv ifcheck params 1 pname GL_TEXTURE_ENV_MODE,GL_COMBINE_RGB,GL_COMBINE_ALPHA ifcheck params 4 pname GL_TEXTURE_ENV_COLOR
glTexImage2D nullAllowed
glTexImage2D nullAllowed pixels
glTexSubImage2D nullAllowed
glTexSubImage2D nullAllowed pixels
glBufferData nullAllowed check data size
glBufferData nullAllowed data check data size
glBufferSubData check data size
glBufferSubData check data size
glTexParameter check params 1
glTexParameter check params 1
glQueryMatrixxOES check mantissa 16 check exponent 16 return -1
glQueryMatrixxOES check mantissa 16 check exponent 16 return -1
+172 −59
Original line number Original line Diff line number Diff line
@@ -222,12 +222,13 @@ public class JniCodeEmitter {
        needsExit = true;
        needsExit = true;
    }
    }


    boolean isNullAllowed(CFunc cfunc) {
    boolean isNullAllowed(CFunc cfunc, String cname) {
        String[] checks = mChecker.getChecks(cfunc.getName());
        String[] checks = mChecker.getChecks(cfunc.getName());
        int index = 1;
        int index = 1;
        if (checks != null) {
        if (checks != null) {
            while (index < checks.length) {
            while (index < checks.length) {
                if (checks[index].equals("nullAllowed")) {
                if (checks[index].equals("nullAllowed") &&
                    checks[index + 1].equals(cname)) {
                    return true;
                    return true;
                } else {
                } else {
                    index = skipOneCheck(checks, index);
                    index = skipOneCheck(checks, index);
@@ -252,6 +253,22 @@ public class JniCodeEmitter {
        return false;
        return false;
    }
    }


    boolean hasCheckTest(CFunc cfunc, String cname) {
        String[] checks = mChecker.getChecks(cfunc.getName());
        int index = 1;
        if (checks != null) {
            while (index < checks.length) {
                if (checks[index].startsWith("check") &&
                    cname != null && cname.equals(checks[index + 1])) {
                    return true;
                } else {
                    index = skipOneCheck(checks, index);
                }
            }
        }
        return false;
    }

    boolean hasIfTest(CFunc cfunc) {
    boolean hasIfTest(CFunc cfunc) {
        String[] checks = mChecker.getChecks(cfunc.getName());
        String[] checks = mChecker.getChecks(cfunc.getName());
        int index = 1;
        int index = 1;
@@ -281,7 +298,7 @@ public class JniCodeEmitter {
        } else if (checks[index].equals("requires")) {
        } else if (checks[index].equals("requires")) {
            index += 2;
            index += 2;
        } else if (checks[index].equals("nullAllowed")) {
        } else if (checks[index].equals("nullAllowed")) {
            index += 1;
            index += 2;
        } else {
        } else {
            System.out.println("Error: unknown keyword \"" +
            System.out.println("Error: unknown keyword \"" +
                               checks[index] + "\"");
                               checks[index] + "\"");
@@ -469,6 +486,37 @@ public class JniCodeEmitter {
        }
        }
    }
    }


    void emitStringCheck(CFunc cfunc, String cname, PrintStream out, String iii) {

        String[] checks = mChecker.getChecks(cfunc.getName());

        int index = 1;
        if (checks != null) {
            while (index < checks.length) {
                if (checks[index].startsWith("check")) {
                    if (cname != null && !cname.equals(checks[index + 1])) {
                    index += 3;
                    continue;
                }
                    out.println(iii + "_stringlen = _env->GetStringUTFLength(" + cname + ");");
                    out.println(iii + "if (" + checks[index + 2] + " > _stringlen) {");
                    out.println(iii + indent + "_exception = 1;");
                    out.println(iii + indent +
                            "_exceptionType = \"java/lang/ArrayIndexOutOfBoundsException\";");
                    out.println(iii + indent +
                            "_exceptionMessage = \"length of " + cname + " is shorter than " +
                            checks[index + 2] + " argument\";");
                    out.println(iii + indent + "goto exit;");
                    out.println(iii + "}");
                    index += 3;
                    needsExit = true;
                } else {
                    index = skipOneCheck(checks, index);
                }
            }
        }
    }

    void emitLocalVariablesForSentinel(CFunc cfunc, PrintStream out) {
    void emitLocalVariablesForSentinel(CFunc cfunc, PrintStream out) {


        String[] checks = mChecker.getChecks(cfunc.getName());
        String[] checks = mChecker.getChecks(cfunc.getName());
@@ -1066,12 +1114,20 @@ public class JniCodeEmitter {


        // Emit local variable declaration for strings
        // Emit local variable declaration for strings
        if (stringArgs.size() > 0) {
        if (stringArgs.size() > 0) {
            boolean requiresStringLengthCheck = false;
            for (int i = 0; i < stringArgs.size(); i++) {
            for (int i = 0; i < stringArgs.size(); i++) {
                int idx = stringArgs.get(i).intValue();
                int idx = stringArgs.get(i).intValue();
                int cIndex = jfunc.getArgCIndex(idx);
                int cIndex = jfunc.getArgCIndex(idx);
                String cname = cfunc.getArgName(cIndex);
                String cname = cfunc.getArgName(cIndex);


                out.println(indent + "const char* _native" + cname + " = 0;");
                out.println(indent + "const char* _native" + cname + " = 0;");
                if (hasCheckTest(cfunc, cname)) {
                    requiresStringLengthCheck = true;
                }
            }

            if (requiresStringLengthCheck) {
                out.println(indent + "jsize _stringlen = 0;");
            }
            }


            out.println();
            out.println();
@@ -1084,8 +1140,15 @@ public class JniCodeEmitter {
                int cIndex = jfunc.getArgCIndex(idx);
                int cIndex = jfunc.getArgCIndex(idx);
                String cname = cfunc.getArgName(cIndex);
                String cname = cfunc.getArgName(cIndex);


                boolean nullAllowed = isNullAllowed(cfunc, cname);
                String nullAllowedIndent = nullAllowed ? indent : "";

                CType type = cfunc.getArgType(jfunc.getArgCIndex(idx));
                CType type = cfunc.getArgType(jfunc.getArgCIndex(idx));
                String decl = type.getDeclaration();
                String decl = type.getDeclaration();

                if (nullAllowed) {
                    out.println(indent + "if (" + cname + ") {");
                } else {
                    needsExit = true;
                    needsExit = true;
                    out.println(indent + "if (!" + cname + ") {");
                    out.println(indent + "if (!" + cname + ") {");
                    out.println(indent + indent + "_exception = 1;");
                    out.println(indent + indent + "_exception = 1;");
@@ -1095,8 +1158,16 @@ public class JniCodeEmitter {
                            "_exceptionMessage = \"" + cname + " == null\";");
                            "_exceptionMessage = \"" + cname + " == null\";");
                    out.println(indent + indent + "goto exit;");
                    out.println(indent + indent + "goto exit;");
                    out.println(indent + "}");
                    out.println(indent + "}");
                }


                out.println(indent + "_native" + cname + " = _env->GetStringUTFChars(" + cname + ", 0);");
                out.println(nullAllowedIndent + indent + "_native" + cname +
                        " = _env->GetStringUTFChars(" + cname + ", 0);");

                emitStringCheck(cfunc, cname, out, nullAllowedIndent + indent);

                if (nullAllowed) {
                    out.println(indent + "}");
                }
            }
            }


            out.println();
            out.println();
@@ -1115,85 +1186,126 @@ public class JniCodeEmitter {
                remaining = ((numArrays + numBuffers) <= 1) ? "_remaining" :
                remaining = ((numArrays + numBuffers) <= 1) ? "_remaining" :
                    "_" + cname + "Remaining";
                    "_" + cname + "Remaining";


                boolean nullAllowed = isNullAllowed(cfunc, cname);
                String nullAllowedIndent = nullAllowed ? indent : "";

                if (jfunc.getArgType(idx).isArray()
                if (jfunc.getArgType(idx).isArray()
                       && !jfunc.getArgType(idx).isEGLHandle()) {
                       && !jfunc.getArgType(idx).isEGLHandle()) {
                    needsExit = true;
                    needsExit = true;

                    if (nullAllowed) {
                        out.println(indent + "if (" + cname + "_ref) {");
                    }
                    else
                    {
                        out.println(indent + "if (!" + cname + "_ref) {");
                        out.println(indent + "if (!" + cname + "_ref) {");
                        out.println(indent + indent + "_exception = 1;");
                        out.println(indent + indent + "_exception = 1;");
                        out.println(indent + indent +
                        out.println(indent + indent +
                                "_exceptionType = \"java/lang/IllegalArgumentException\";");
                                "_exceptionType = " +
                                "\"java/lang/IllegalArgumentException\";");
                        out.println(indent + indent +
                        out.println(indent + indent +
                                "_exceptionMessage = \"" + cname +" == null\";");
                                "_exceptionMessage = \"" + cname +
                                " == null\";");
                        out.println(indent + indent + "goto exit;");
                        out.println(indent + indent + "goto exit;");
                        out.println(indent + "}");
                        out.println(indent + "}");
                    out.println(indent + "if (" + offset + " < 0) {");
                    }
                    out.println(indent + indent + "_exception = 1;");

                    out.println(indent + indent +
                    out.println(nullAllowedIndent + indent + "if (" + offset +
                                "_exceptionType = \"java/lang/IllegalArgumentException\";");
                            " < 0) {");
                    out.println(indent + indent +
                    out.println(nullAllowedIndent + indent + indent +
                            "_exception = 1;");
                    out.println(nullAllowedIndent + indent + indent +
                            "_exceptionType = " +
                            "\"java/lang/IllegalArgumentException\";");
                    out.println(nullAllowedIndent + indent + indent +
                            "_exceptionMessage = \"" + offset +" < 0\";");
                            "_exceptionMessage = \"" + offset +" < 0\";");
                    out.println(indent + indent + "goto exit;");
                    out.println(nullAllowedIndent + indent + indent +
                    out.println(indent + "}");
                            "goto exit;");
                    out.println(nullAllowedIndent + indent + "}");


                    out.println(indent + remaining + " = " +
                    out.println(nullAllowedIndent + indent + remaining + " = " +
                            (mUseCPlusPlus ? "_env" : "(*_env)") +
                            (mUseCPlusPlus ? "_env" : "(*_env)") +
                            "->GetArrayLength(" +
                            "->GetArrayLength(" +
                            (mUseCPlusPlus ? "" : "_env, ") +
                            (mUseCPlusPlus ? "" : "_env, ") +
                            cname + "_ref) - " + offset + ";");
                            cname + "_ref) - " + offset + ";");


                    emitNativeBoundsChecks(cfunc, cname, out, false,
                    emitNativeBoundsChecks(cfunc, cname, out, false,
                                           emitExceptionCheck,
                            emitExceptionCheck, offset, remaining,
                                           offset, remaining, "    ");
                            nullAllowedIndent + indent);


                    out.println(indent +
                    out.println(nullAllowedIndent + indent +
                                cname +
                                cname +
                                "_base = (" +
                                "_base = (" +
                                cfunc.getArgType(cIndex).getDeclaration() +
                                cfunc.getArgType(cIndex).getDeclaration() +
                                ")");
                                ")");
                    String arrayGetter = jfunc.getArgType(idx).getArrayGetterForPrimitiveArray();
                    String arrayGetter = jfunc.getArgType(idx).getArrayGetterForPrimitiveArray();
                    out.println(indent + "    " +
                    out.println(nullAllowedIndent + indent + "    " +
                                (mUseCPlusPlus ? "_env" : "(*_env)") +
                                (mUseCPlusPlus ? "_env" : "(*_env)") +
                                "->" + arrayGetter + "(" +
                                "->" + arrayGetter + "(" +
                                (mUseCPlusPlus ? "" : "_env, ") +
                                (mUseCPlusPlus ? "" : "_env, ") +
                                jfunc.getArgName(idx) +
                                jfunc.getArgName(idx) +
                                "_ref, (jboolean *)0);");
                                "_ref, (jboolean *)0);");
                    out.println(indent +
                    out.println(nullAllowedIndent + indent +
                                cname + " = " + cname + "_base + " + offset + ";");
                                cname + " = " + cname + "_base + " + offset + ";");


                    emitSentinelCheck(cfunc, cname, out, false,
                    emitSentinelCheck(cfunc, cname, out, false,
                                      emitExceptionCheck, offset,
                            emitExceptionCheck, offset, remaining,
                                      remaining, indent);
                            nullAllowedIndent + indent);

                    if (nullAllowed) {
                        out.println(indent + "}");
                    }

                    out.println();
                    out.println();
                } else if (jfunc.getArgType(idx).isArray()
                } else if (jfunc.getArgType(idx).isArray()
                              && jfunc.getArgType(idx).isEGLHandle()) {
                              && jfunc.getArgType(idx).isEGLHandle()) {
                    needsExit = true;
                    needsExit = true;

                    if (nullAllowed) {
                        out.println(indent + "if (" + cname + "_ref) {");
                    }
                    else
                    {
                        out.println(indent + "if (!" + cname + "_ref) {");
                        out.println(indent + "if (!" + cname + "_ref) {");
                        out.println(indent + indent + "_exception = 1;");
                        out.println(indent + indent + "_exception = 1;");
                    out.println(indent + indent +
                        out.println(indent + indent + "_exceptionType = " +
                                "_exceptionType = \"java/lang/IllegalArgumentException\";");
                                "\"java/lang/IllegalArgumentException\";");
                    out.println(indent + indent + "_exceptionMessage = \"" + cname +" == null\";");
                        out.println(indent + indent + "_exceptionMessage = \"" +
                    out.println(indent + indent + "goto exit;");
                                cname +" == null\";");
                    out.println(indent + "}");
                    out.println(indent + "if (" + offset + " < 0) {");
                    out.println(indent + indent + "_exception = 1;");
                    out.println(indent + indent +
                                "_exceptionType = \"java/lang/IllegalArgumentException\";");
                    out.println(indent + indent + "_exceptionMessage = \"" + offset +" < 0\";");
                        out.println(indent + indent + "goto exit;");
                        out.println(indent + indent + "goto exit;");
                        out.println(indent + "}");
                        out.println(indent + "}");
                    }

                    out.println(nullAllowedIndent + indent + "if (" + offset +
                            " < 0) {");
                    out.println(nullAllowedIndent + indent + indent +
                            "_exception = 1;");
                    out.println(nullAllowedIndent + indent + indent +
                            "_exceptionType = " +
                            "\"java/lang/IllegalArgumentException\";");
                    out.println(nullAllowedIndent + indent + indent +
                            "_exceptionMessage = \"" + offset +" < 0\";");
                    out.println(nullAllowedIndent + indent + indent +
                            "goto exit;");
                    out.println(nullAllowedIndent + indent + "}");


                    out.println(indent + remaining + " = " +
                    out.println(nullAllowedIndent + indent + remaining + " = " +
                                    (mUseCPlusPlus ? "_env" : "(*_env)") +
                                    (mUseCPlusPlus ? "_env" : "(*_env)") +
                                    "->GetArrayLength(" +
                                    "->GetArrayLength(" +
                                    (mUseCPlusPlus ? "" : "_env, ") +
                                    (mUseCPlusPlus ? "" : "_env, ") +
                                    cname + "_ref) - " + offset + ";");
                                    cname + "_ref) - " + offset + ";");
                    emitNativeBoundsChecks(cfunc, cname, out, false,
                    emitNativeBoundsChecks(cfunc, cname, out, false,
                                           emitExceptionCheck,
                            emitExceptionCheck, offset, remaining,
                                           offset, remaining, "    ");
                            nullAllowedIndent + indent);
                    out.println(indent +
                    out.println(nullAllowedIndent + indent +
                                jfunc.getArgName(idx) + " = new " +
                                jfunc.getArgName(idx) + " = new " +
                                cfunc.getArgType(cIndex).getBaseType() +
                                cfunc.getArgType(cIndex).getBaseType() +
                               "["+ remaining + "];");
                               "["+ remaining + "];");

                    if (nullAllowed) {
                        out.println(indent + "}");
                    }

                    out.println();
                    out.println();
                } else if (jfunc.getArgType(idx).isBuffer()) {
                } else if (jfunc.getArgType(idx).isBuffer()) {
                    String array = numBufferArgs <= 1 ? "_array" :
                    String array = numBufferArgs <= 1 ? "_array" :
@@ -1201,7 +1313,7 @@ public class JniCodeEmitter {
                    String bufferOffset = numBufferArgs <= 1 ? "_bufferOffset" :
                    String bufferOffset = numBufferArgs <= 1 ? "_bufferOffset" :
                        "_" + cfunc.getArgName(cIndex) + "BufferOffset";
                        "_" + cfunc.getArgName(cIndex) + "BufferOffset";


                    boolean nullAllowed = isNullAllowed(cfunc) || isPointerFunc;
                    nullAllowed = nullAllowed || isPointerFunc;
                    if (nullAllowed) {
                    if (nullAllowed) {
                        out.println(indent + "if (" + cname + "_buf) {");
                        out.println(indent + "if (" + cname + "_buf) {");
                        out.print(indent);
                        out.print(indent);
@@ -1254,7 +1366,8 @@ public class JniCodeEmitter {
                String array = numBufferArgs <= 1 ? "_array" :
                String array = numBufferArgs <= 1 ? "_array" :
                            "_" + cfunc.getArgName(cIndex) + "Array";
                            "_" + cfunc.getArgName(cIndex) + "Array";


                boolean nullAllowed = isNullAllowed(cfunc) || isPointerFunc;
                boolean nullAllowed = isNullAllowed(cfunc, cname) ||
                        isPointerFunc;
                if (nullAllowed) {
                if (nullAllowed) {
                    out.println(indent + "if (" + cname + "_buf && " + cname +" == NULL) {");
                    out.println(indent + "if (" + cname + "_buf && " + cname +" == NULL) {");
                } else {
                } else {
+23 −27
Original line number Original line Diff line number Diff line
@@ -13,12 +13,7 @@ android_eglCreatePbufferFromClientBuffer
    jint _remaining;
    jint _remaining;
    EGLint *attrib_list = (EGLint *) 0;
    EGLint *attrib_list = (EGLint *) 0;


    if (!attrib_list_ref) {
    if (attrib_list_ref) {
        _exception = 1;
        _exceptionType = "java/lang/IllegalArgumentException";
        _exceptionMessage = "attrib_list == null";
        goto exit;
    }
        if (offset < 0) {
        if (offset < 0) {
            _exception = 1;
            _exception = 1;
            _exceptionType = "java/lang/IllegalArgumentException";
            _exceptionType = "java/lang/IllegalArgumentException";
@@ -42,6 +37,7 @@ android_eglCreatePbufferFromClientBuffer
            _exceptionMessage = "attrib_list must contain EGL_NONE!";
            _exceptionMessage = "attrib_list must contain EGL_NONE!";
            goto exit;
            goto exit;
        }
        }
    }


    _returnValue = eglCreatePbufferFromClientBuffer(
    _returnValue = eglCreatePbufferFromClientBuffer(
        (EGLDisplay)dpy_native,
        (EGLDisplay)dpy_native,
Loading