From fd2a2eea108347237af35a3bc39f076d2c129417 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 28 May 2022 07:49:18 -0700 Subject: [PATCH] Fixed declaration-after-statement warning --- src/core/android/SDL_android.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index dba9e5f87..3c4112a0e 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c @@ -511,9 +511,10 @@ register_methods(JNIEnv *env, const char *classname, JNINativeMethod *methods, i /* Library init */ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { - mJavaVM = vm; JNIEnv *env = NULL; + mJavaVM = vm; + if ((*mJavaVM)->GetEnv(mJavaVM, (void **)&env, JNI_VERSION_1_4) != JNI_OK) { __android_log_print(ANDROID_LOG_ERROR, "SDL", "Failed to get JNI Env"); return JNI_VERSION_1_4; @@ -2553,6 +2554,7 @@ SDL_bool Android_JNI_SetRelativeMouseEnabled(SDL_bool enabled) SDL_bool Android_JNI_RequestPermission(const char *permission) { JNIEnv *env = Android_JNI_GetEnv(); + jstring jpermission; const int requestCode = 1; /* Wait for any pending request on another thread */ @@ -2561,7 +2563,7 @@ SDL_bool Android_JNI_RequestPermission(const char *permission) } SDL_AtomicSet(&bPermissionRequestPending, SDL_TRUE); - jstring jpermission = (*env)->NewStringUTF(env, permission); + jpermission = (*env)->NewStringUTF(env, permission); (*env)->CallStaticVoidMethod(env, mActivityClass, midRequestPermission, jpermission, requestCode); (*env)->DeleteLocalRef(env, jpermission);