9875750593
Just use jniThrowException instead. Note that it would be trivial to throw seemingly more appropriate exceptions (NullPointerException and OutOfMemoryException in particular), but I'm only attempting to preserve existing behavior here. I also found shadowing bugs in some of the special-case functions, which would previously always have leaked memory. This also moves an accidental change to a generated file (ActivityThread -> AppGlobals) into the generator, so it won't be overwritten in future. Change-Id: Iab570310b568cb406c60dd0e2b8211f8a36ae590
20 lines
660 B
C++
20 lines
660 B
C++
#include <stdlib.h>
|
|
|
|
/* void glGetShaderInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
|
|
static jstring android_glGetShaderInfoLog(JNIEnv *_env, jobject, jint shader) {
|
|
GLint infoLen = 0;
|
|
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
|
|
if (!infoLen) {
|
|
return _env->NewStringUTF("");
|
|
}
|
|
char* buf = (char*) malloc(infoLen);
|
|
if (buf == NULL) {
|
|
jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
|
|
return NULL;
|
|
}
|
|
glGetShaderInfoLog(shader, infoLen, NULL, buf);
|
|
jstring result = _env->NewStringUTF(buf);
|
|
free(buf);
|
|
return result;
|
|
}
|