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
18 lines
549 B
C++
18 lines
549 B
C++
|
|
/* void glShaderSource ( GLuint shader, GLsizei count, const GLchar ** string, const GLint * length ) */
|
|
static
|
|
void
|
|
android_glShaderSource
|
|
(JNIEnv *_env, jobject _this, jint shader, jstring string) {
|
|
|
|
if (!string) {
|
|
jniThrowException(_env, "java/lang/IllegalArgumentException", "string == null");
|
|
return;
|
|
}
|
|
|
|
const char* nativeString = _env->GetStringUTFChars(string, 0);
|
|
const char* strings[] = {nativeString};
|
|
glShaderSource(shader, 1, strings, 0);
|
|
_env->ReleaseStringUTFChars(string, nativeString);
|
|
}
|