diff options
Diffstat (limited to 'opengl/tools/glgen/stubs/gles11')
-rw-r--r-- | opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp | 49 | ||||
-rw-r--r-- | opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp | 52 | ||||
-rw-r--r-- | opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp | 52 | ||||
-rw-r--r-- | opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp | 52 | ||||
-rw-r--r-- | opengl/tools/glgen/stubs/gles11/GLES20cHeader.cpp | 52 | ||||
-rw-r--r-- | opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.cpp | 34 | ||||
-rw-r--r-- | opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.cpp | 34 | ||||
-rw-r--r-- | opengl/tools/glgen/stubs/gles11/glGetString.cpp | 12 | ||||
-rw-r--r-- | opengl/tools/glgen/stubs/gles11/glShaderSource.cpp | 2 |
9 files changed, 103 insertions, 236 deletions
diff --git a/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp index 294d1ce..5d418d7 100644 --- a/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp +++ b/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp @@ -1,21 +1,23 @@ ** ** Copyright 2009, The Android Open Source Project ** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at ** -** http://www.apache.org/licenses/LICENSE-2.0 +** http://www.apache.org/licenses/LICENSE-2.0 ** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and ** limitations under the License. */ // This source file is automatically generated +#include "jni.h" +#include "JNIHelp.h" #include <android_runtime/AndroidRuntime.h> #include <utils/misc.h> @@ -27,10 +29,6 @@ static int initialized = 0; static jclass nioAccessClass; static jclass bufferClass; -static jclass OOMEClass; -static jclass UOEClass; -static jclass IAEClass; -static jclass AIOOBEClass; static jmethodID getBasePointerID; static jmethodID getBaseArrayID; static jmethodID getBaseArrayOffsetID; @@ -41,7 +39,7 @@ static jfieldID elementSizeShiftID; /* Cache method IDs each time the class is loaded. */ static void -nativeClassInitBuffer(JNIEnv *_env) +nativeClassInit(JNIEnv *_env, jclass glImplClass) { jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); @@ -63,26 +61,6 @@ nativeClassInitBuffer(JNIEnv *_env) } -static void -nativeClassInit(JNIEnv *_env, jclass glImplClass) -{ - nativeClassInitBuffer(_env); - - jclass IAEClassLocal = - _env->FindClass("java/lang/IllegalArgumentException"); - jclass OOMEClassLocal = - _env->FindClass("java/lang/OutOfMemoryError"); - jclass UOEClassLocal = - _env->FindClass("java/lang/UnsupportedOperationException"); - jclass AIOOBEClassLocal = - _env->FindClass("java/lang/ArrayIndexOutOfBoundsException"); - - IAEClass = (jclass) _env->NewGlobalRef(IAEClassLocal); - OOMEClass = (jclass) _env->NewGlobalRef(OOMEClassLocal); - UOEClass = (jclass) _env->NewGlobalRef(UOEClassLocal); - AIOOBEClass = (jclass) _env->NewGlobalRef(AIOOBEClassLocal); -} - static void * getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) { @@ -103,13 +81,13 @@ getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) *array = NULL; return (void *) (jint) pointer; } - + *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, getBaseArrayID, buffer); offset = _env->CallStaticIntMethod(nioAccessClass, getBaseArrayOffsetID, buffer); data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); - + return (void *) ((char *) data + offset); } @@ -122,4 +100,3 @@ releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) } // -------------------------------------------------------------------------- - diff --git a/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp index e1c09f4..35a3c33 100644 --- a/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp +++ b/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp @@ -1,21 +1,23 @@ ** ** Copyright 2009, The Android Open Source Project ** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at ** -** http://www.apache.org/licenses/LICENSE-2.0 +** http://www.apache.org/licenses/LICENSE-2.0 ** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and ** limitations under the License. */ // This source file is automatically generated +#include "jni.h" +#include "JNIHelp.h" #include <android_runtime/AndroidRuntime.h> #include <utils/misc.h> @@ -40,10 +42,6 @@ static int initialized = 0; static jclass nioAccessClass; static jclass bufferClass; -static jclass OOMEClass; -static jclass UOEClass; -static jclass IAEClass; -static jclass AIOOBEClass; static jmethodID getBasePointerID; static jmethodID getBaseArrayID; static jmethodID getBaseArrayOffsetID; @@ -54,7 +52,7 @@ static jfieldID elementSizeShiftID; /* Cache method IDs each time the class is loaded. */ static void -nativeClassInitBuffer(JNIEnv *_env) +nativeClassInit(JNIEnv *_env, jclass glImplClass) { jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); @@ -75,26 +73,6 @@ nativeClassInitBuffer(JNIEnv *_env) _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); } -static void -nativeClassInit(JNIEnv *_env, jclass glImplClass) -{ - nativeClassInitBuffer(_env); - - jclass IAEClassLocal = - _env->FindClass("java/lang/IllegalArgumentException"); - jclass OOMEClassLocal = - _env->FindClass("java/lang/OutOfMemoryError"); - jclass UOEClassLocal = - _env->FindClass("java/lang/UnsupportedOperationException"); - jclass AIOOBEClassLocal = - _env->FindClass("java/lang/ArrayIndexOutOfBoundsException"); - - IAEClass = (jclass) _env->NewGlobalRef(IAEClassLocal); - OOMEClass = (jclass) _env->NewGlobalRef(OOMEClassLocal); - UOEClass = (jclass) _env->NewGlobalRef(UOEClassLocal); - AIOOBEClass = (jclass) _env->NewGlobalRef(AIOOBEClassLocal); -} - static void * getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) { @@ -115,13 +93,13 @@ getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) *array = NULL; return (void *) (jint) pointer; } - + *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, getBaseArrayID, buffer); offset = _env->CallStaticIntMethod(nioAccessClass, getBaseArrayOffsetID, buffer); data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); - + return (void *) ((char *) data + offset); } @@ -140,7 +118,8 @@ getDirectBufferPointer(JNIEnv *_env, jobject buffer) { jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); buf += position << elementSizeShift; } else { - _env->ThrowNew(IAEClass, "Must use a native order direct Buffer"); + jniThrowException(_env, "java/lang/IllegalArgumentException", + "Must use a native order direct Buffer"); } return (void*) buf; } @@ -153,4 +132,3 @@ getNumCompressedTextureFormats() { } // -------------------------------------------------------------------------- - diff --git a/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp index 2548b32..9b29a44 100644 --- a/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp +++ b/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp @@ -1,21 +1,23 @@ ** ** Copyright 2009, The Android Open Source Project ** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at ** -** http://www.apache.org/licenses/LICENSE-2.0 +** http://www.apache.org/licenses/LICENSE-2.0 ** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and ** limitations under the License. */ // This source file is automatically generated +#include "jni.h" +#include "JNIHelp.h" #include <android_runtime/AndroidRuntime.h> #include <utils/misc.h> @@ -36,10 +38,6 @@ static int initialized = 0; static jclass nioAccessClass; static jclass bufferClass; -static jclass OOMEClass; -static jclass UOEClass; -static jclass IAEClass; -static jclass AIOOBEClass; static jmethodID getBasePointerID; static jmethodID getBaseArrayID; static jmethodID getBaseArrayOffsetID; @@ -50,7 +48,7 @@ static jfieldID elementSizeShiftID; /* Cache method IDs each time the class is loaded. */ static void -nativeClassInitBuffer(JNIEnv *_env) +nativeClassInit(JNIEnv *_env, jclass glImplClass) { jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); @@ -72,26 +70,6 @@ nativeClassInitBuffer(JNIEnv *_env) } -static void -nativeClassInit(JNIEnv *_env, jclass glImplClass) -{ - nativeClassInitBuffer(_env); - - jclass IAEClassLocal = - _env->FindClass("java/lang/IllegalArgumentException"); - jclass OOMEClassLocal = - _env->FindClass("java/lang/OutOfMemoryError"); - jclass UOEClassLocal = - _env->FindClass("java/lang/UnsupportedOperationException"); - jclass AIOOBEClassLocal = - _env->FindClass("java/lang/ArrayIndexOutOfBoundsException"); - - IAEClass = (jclass) _env->NewGlobalRef(IAEClassLocal); - OOMEClass = (jclass) _env->NewGlobalRef(OOMEClassLocal); - UOEClass = (jclass) _env->NewGlobalRef(UOEClassLocal); - AIOOBEClass = (jclass) _env->NewGlobalRef(AIOOBEClassLocal); -} - static void * getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) { @@ -112,13 +90,13 @@ getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) *array = NULL; return (void *) (jint) pointer; } - + *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, getBaseArrayID, buffer); offset = _env->CallStaticIntMethod(nioAccessClass, getBaseArrayOffsetID, buffer); data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); - + return (void *) ((char *) data + offset); } @@ -138,9 +116,9 @@ getDirectBufferPointer(JNIEnv *_env, jobject buffer) { jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); buf += position << elementSizeShift; } else { - _env->ThrowNew(IAEClass, "Must use a native order direct Buffer"); + jniThrowException(_env, "java/lang/IllegalArgumentException", + "Must use a native order direct Buffer"); } return (void*) buf; } // -------------------------------------------------------------------------- - diff --git a/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp index 4c297f7..823079f 100644 --- a/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp +++ b/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp @@ -1,21 +1,23 @@ ** ** Copyright 2009, The Android Open Source Project ** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at ** -** http://www.apache.org/licenses/LICENSE-2.0 +** http://www.apache.org/licenses/LICENSE-2.0 ** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and ** limitations under the License. */ // This source file is automatically generated +#include "jni.h" +#include "JNIHelp.h" #include <android_runtime/AndroidRuntime.h> #include <utils/misc.h> @@ -34,10 +36,6 @@ static int initialized = 0; static jclass nioAccessClass; static jclass bufferClass; -static jclass OOMEClass; -static jclass UOEClass; -static jclass IAEClass; -static jclass AIOOBEClass; static jmethodID getBasePointerID; static jmethodID getBaseArrayID; static jmethodID getBaseArrayOffsetID; @@ -48,7 +46,7 @@ static jfieldID elementSizeShiftID; /* Cache method IDs each time the class is loaded. */ static void -nativeClassInitBuffer(JNIEnv *_env) +nativeClassInit(JNIEnv *_env, jclass glImplClass) { jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); @@ -70,26 +68,6 @@ nativeClassInitBuffer(JNIEnv *_env) } -static void -nativeClassInit(JNIEnv *_env, jclass glImplClass) -{ - nativeClassInitBuffer(_env); - - jclass IAEClassLocal = - _env->FindClass("java/lang/IllegalArgumentException"); - jclass OOMEClassLocal = - _env->FindClass("java/lang/OutOfMemoryError"); - jclass UOEClassLocal = - _env->FindClass("java/lang/UnsupportedOperationException"); - jclass AIOOBEClassLocal = - _env->FindClass("java/lang/ArrayIndexOutOfBoundsException"); - - IAEClass = (jclass) _env->NewGlobalRef(IAEClassLocal); - OOMEClass = (jclass) _env->NewGlobalRef(OOMEClassLocal); - UOEClass = (jclass) _env->NewGlobalRef(UOEClassLocal); - AIOOBEClass = (jclass) _env->NewGlobalRef(AIOOBEClassLocal); -} - static void * getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) { @@ -110,13 +88,13 @@ getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) *array = NULL; return (void *) (jint) pointer; } - + *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, getBaseArrayID, buffer); offset = _env->CallStaticIntMethod(nioAccessClass, getBaseArrayOffsetID, buffer); data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); - + return (void *) ((char *) data + offset); } @@ -136,10 +114,10 @@ getDirectBufferPointer(JNIEnv *_env, jobject buffer) { jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); buf += position << elementSizeShift; } else { - _env->ThrowNew(IAEClass, "Must use a native order direct Buffer"); + jniThrowException(_env, "java/lang/IllegalArgumentException", + "Must use a native order direct Buffer"); } return (void*) buf; } // -------------------------------------------------------------------------- - diff --git a/opengl/tools/glgen/stubs/gles11/GLES20cHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES20cHeader.cpp index e451e9a..13a2577 100644 --- a/opengl/tools/glgen/stubs/gles11/GLES20cHeader.cpp +++ b/opengl/tools/glgen/stubs/gles11/GLES20cHeader.cpp @@ -1,21 +1,23 @@ ** ** Copyright 2009, The Android Open Source Project ** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at ** -** http://www.apache.org/licenses/LICENSE-2.0 +** http://www.apache.org/licenses/LICENSE-2.0 ** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and ** limitations under the License. */ // This source file is automatically generated +#include "jni.h" +#include "JNIHelp.h" #include <android_runtime/AndroidRuntime.h> #include <utils/misc.h> @@ -27,10 +29,6 @@ static int initialized = 0; static jclass nioAccessClass; static jclass bufferClass; -static jclass OOMEClass; -static jclass UOEClass; -static jclass IAEClass; -static jclass AIOOBEClass; static jmethodID getBasePointerID; static jmethodID getBaseArrayID; static jmethodID getBaseArrayOffsetID; @@ -41,7 +39,7 @@ static jfieldID elementSizeShiftID; /* Cache method IDs each time the class is loaded. */ static void -nativeClassInitBuffer(JNIEnv *_env) +nativeClassInit(JNIEnv *_env, jclass glImplClass) { jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); @@ -63,26 +61,6 @@ nativeClassInitBuffer(JNIEnv *_env) } -static void -nativeClassInit(JNIEnv *_env, jclass glImplClass) -{ - nativeClassInitBuffer(_env); - - jclass IAEClassLocal = - _env->FindClass("java/lang/IllegalArgumentException"); - jclass OOMEClassLocal = - _env->FindClass("java/lang/OutOfMemoryError"); - jclass UOEClassLocal = - _env->FindClass("java/lang/UnsupportedOperationException"); - jclass AIOOBEClassLocal = - _env->FindClass("java/lang/ArrayIndexOutOfBoundsException"); - - IAEClass = (jclass) _env->NewGlobalRef(IAEClassLocal); - OOMEClass = (jclass) _env->NewGlobalRef(OOMEClassLocal); - UOEClass = (jclass) _env->NewGlobalRef(UOEClassLocal); - AIOOBEClass = (jclass) _env->NewGlobalRef(AIOOBEClassLocal); -} - static void * getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) { @@ -103,13 +81,13 @@ getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) *array = NULL; return (void *) (jint) pointer; } - + *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, getBaseArrayID, buffer); offset = _env->CallStaticIntMethod(nioAccessClass, getBaseArrayOffsetID, buffer); data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); - + return (void *) ((char *) data + offset); } @@ -129,7 +107,8 @@ getDirectBufferPointer(JNIEnv *_env, jobject buffer) { jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); buf += position << elementSizeShift; } else { - _env->ThrowNew(IAEClass, "Must use a native order direct Buffer"); + jniThrowException(_env, "java/lang/IllegalArgumentException", + "Must use a native order direct Buffer"); } return (void*) buf; } @@ -147,4 +126,3 @@ static void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type, } // -------------------------------------------------------------------------- - diff --git a/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.cpp b/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.cpp index d92f515..ce6ab24 100644 --- a/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.cpp +++ b/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.cpp @@ -1,27 +1,19 @@ -#include <string.h> +#include <stdlib.h> /* void glGetProgramInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */ -static -jstring -android_glGetProgramInfoLog (JNIEnv *_env, jobject _this, jint shader) { +static jstring android_glGetProgramInfoLog(JNIEnv *_env, jobject, jint shader) { GLint infoLen = 0; - jstring _result = 0; - char* buf = 0; glGetProgramiv(shader, GL_INFO_LOG_LENGTH, &infoLen); - if (infoLen) { - char* buf = (char*) malloc(infoLen); - if (buf == 0) { - _env->ThrowNew(IAEClass, "out of memory"); - goto exit; - } - glGetProgramInfoLog(shader, infoLen, NULL, buf); - _result = _env->NewStringUTF(buf); - } else { - _result = _env->NewStringUTF(""); + if (!infoLen) { + return _env->NewStringUTF(""); } -exit: - if (buf) { - free(buf); + char* buf = (char*) malloc(infoLen); + if (buf == NULL) { + jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); + return NULL; } - return _result; -}
\ No newline at end of file + glGetProgramInfoLog(shader, infoLen, NULL, buf); + jstring result = _env->NewStringUTF(buf); + free(buf); + return result; +} diff --git a/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.cpp b/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.cpp index 5441d66..dd656b6 100644 --- a/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.cpp +++ b/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.cpp @@ -1,27 +1,19 @@ -#include <string.h> +#include <stdlib.h> /* void glGetShaderInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */ -static -jstring -android_glGetShaderInfoLog (JNIEnv *_env, jobject _this, jint shader) { +static jstring android_glGetShaderInfoLog(JNIEnv *_env, jobject, jint shader) { GLint infoLen = 0; - jstring _result = 0; - char* buf = 0; glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen); - if (infoLen) { - char* buf = (char*) malloc(infoLen); - if (buf == 0) { - _env->ThrowNew(IAEClass, "out of memory"); - goto exit; - } - glGetShaderInfoLog(shader, infoLen, NULL, buf); - _result = _env->NewStringUTF(buf); - } else { - _result = _env->NewStringUTF(""); + if (!infoLen) { + return _env->NewStringUTF(""); } -exit: - if (buf) { - free(buf); + char* buf = (char*) malloc(infoLen); + if (buf == NULL) { + jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); + return NULL; } - return _result; -}
\ No newline at end of file + glGetShaderInfoLog(shader, infoLen, NULL, buf); + jstring result = _env->NewStringUTF(buf); + free(buf); + return result; +} diff --git a/opengl/tools/glgen/stubs/gles11/glGetString.cpp b/opengl/tools/glgen/stubs/gles11/glGetString.cpp index a400859..239fe4a 100644 --- a/opengl/tools/glgen/stubs/gles11/glGetString.cpp +++ b/opengl/tools/glgen/stubs/gles11/glGetString.cpp @@ -1,11 +1,5 @@ -#include <string.h>
-
/* const GLubyte * glGetString ( GLenum name ) */
-static
-jstring
-android_glGetString
- (JNIEnv *_env, jobject _this, jint name) {
- const char * chars = (const char *)glGetString((GLenum)name);
- jstring output = _env->NewStringUTF(chars);
- return output;
+static jstring android_glGetString(JNIEnv* _env, jobject, jint name) {
+ const char* chars = (const char*) glGetString((GLenum) name);
+ return _env->NewStringUTF(chars);
}
diff --git a/opengl/tools/glgen/stubs/gles11/glShaderSource.cpp b/opengl/tools/glgen/stubs/gles11/glShaderSource.cpp index c274108..125fd0f 100644 --- a/opengl/tools/glgen/stubs/gles11/glShaderSource.cpp +++ b/opengl/tools/glgen/stubs/gles11/glShaderSource.cpp @@ -6,7 +6,7 @@ android_glShaderSource (JNIEnv *_env, jobject _this, jint shader, jstring string) { if (!string) { - _env->ThrowNew(IAEClass, "string == null"); + jniThrowException(_env, "java/lang/IllegalArgumentException", "string == null"); return; } |