Fixed declaration-after-statement warning

This commit is contained in:
Sam Lantinga 2022-05-28 07:49:18 -07:00
parent d2c4d74dd0
commit fd2a2eea10

View file

@ -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);