From ad0f52fc2be6161f61fd95e4f12739c65661673a Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Mon, 23 Feb 2015 10:39:14 -0800 Subject: [PATCH] Fix pointer-to-int and int-to-pointer warnings. Change-Id: If534cbcf2c3e644270572cbf829ba9b5acab29e6 --- opengl/tools/glgen/stubs/egl/eglGetDisplay.cpp | 3 ++- opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.cpp | 2 +- .../glgen/stubs/gles11/glGetTransformFeedbackVarying.cpp | 6 +++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/opengl/tools/glgen/stubs/egl/eglGetDisplay.cpp b/opengl/tools/glgen/stubs/egl/eglGetDisplay.cpp index 003efd3e1..2abc9167d 100755 --- a/opengl/tools/glgen/stubs/egl/eglGetDisplay.cpp +++ b/opengl/tools/glgen/stubs/egl/eglGetDisplay.cpp @@ -14,7 +14,8 @@ static jobject android_eglGetDisplayInt (JNIEnv *_env, jobject _this, jint display_id) { - if ((EGLNativeDisplayType)display_id != EGL_DEFAULT_DISPLAY) { + if (static_cast(display_id) != + reinterpret_cast(EGL_DEFAULT_DISPLAY)) { jniThrowException(_env, "java/lang/UnsupportedOperationException", "eglGetDisplay"); return 0; } diff --git a/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.cpp b/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.cpp index 41df486f1..d84415215 100644 --- a/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.cpp +++ b/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.cpp @@ -32,7 +32,7 @@ android_glDrawElementsInstanced__IIIII (GLenum)mode, (GLsizei)count, (GLenum)type, - (GLvoid *)indicesOffset, + (GLvoid *)static_cast(indicesOffset), (GLsizei)instanceCount ); } diff --git a/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.cpp b/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.cpp index 0514fe980..a977693f3 100644 --- a/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.cpp +++ b/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.cpp @@ -157,7 +157,11 @@ android_glGetTransformFeedbackVarying__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuff (GLsizei *)length, (GLint *)size, (GLenum *)type, - (char *)name + // The cast below is incorrect. The driver will end up writing to the + // address specified by name, which will always crash the process since + // it is guaranteed to be in low memory. The additional static_cast + // suppresses the warning for now. http://b/19478262 + (char *)static_cast(name) ); if (_typeArray) { releasePointer(_env, _typeArray, type, JNI_TRUE);