From 06bd214af61e82da43a3317bdc889005748adf33 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 7 Oct 2024 11:11:12 -0700 Subject: [PATCH] Fixed warnings building on Android --- build-scripts/androidbuildlibs.sh | 2 +- src/SDL.c | 5 +++-- src/SDL_hashtable.c | 2 +- src/core/android/SDL_android.h | 1 + 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/build-scripts/androidbuildlibs.sh b/build-scripts/androidbuildlibs.sh index 0aa4aeaa66..a903f36eea 100755 --- a/build-scripts/androidbuildlibs.sh +++ b/build-scripts/androidbuildlibs.sh @@ -25,7 +25,7 @@ cd $srcdir build=build buildandroid=$build/android -platform=android-16 +platform=android-21 abi="arm64-v8a" # "armeabi-v7a arm64-v8a x86 x86_64" obj= lib= diff --git a/src/SDL.c b/src/SDL.c index c140ef36ca..edacc86db0 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -55,6 +55,9 @@ #include "video/SDL_surface_c.h" #include "video/SDL_video_c.h" #include "filesystem/SDL_filesystem_c.h" +#ifdef SDL_PLATFORM_ANDROID +#include "core/android/SDL_android.h" +#endif #define SDL_INIT_EVERYTHING ~0U @@ -711,7 +714,6 @@ const char *SDL_GetPlatform(void) bool SDL_IsTablet(void) { #ifdef SDL_PLATFORM_ANDROID - extern bool SDL_IsAndroidTablet(void); return SDL_IsAndroidTablet(); #elif defined(SDL_PLATFORM_IOS) extern bool SDL_IsIPad(void); @@ -724,7 +726,6 @@ bool SDL_IsTablet(void) bool SDL_IsTV(void) { #ifdef SDL_PLATFORM_ANDROID - extern bool SDL_IsAndroidTV(void); return SDL_IsAndroidTV(); #elif defined(SDL_PLATFORM_IOS) extern bool SDL_IsAppleTV(void); diff --git a/src/SDL_hashtable.c b/src/SDL_hashtable.c index a4828836c9..bb1a9aaf32 100644 --- a/src/SDL_hashtable.c +++ b/src/SDL_hashtable.c @@ -276,7 +276,7 @@ static bool maybe_resize(SDL_HashTable *restrict ht) } Uint32 max_load_factor = 217; // range: 0-255; 217 is roughly 85% - Uint32 resize_threshold = (max_load_factor * (Uint64)capacity) >> 8; + Uint32 resize_threshold = (Uint32)((max_load_factor * (Uint64)capacity) >> 8); if (ht->num_occupied_slots > resize_threshold) { return resize(ht, capacity * 2); diff --git a/src/core/android/SDL_android.h b/src/core/android/SDL_android.h index 4d810c99c4..4c3fb5fbe9 100644 --- a/src/core/android/SDL_android.h +++ b/src/core/android/SDL_android.h @@ -146,6 +146,7 @@ bool Android_JNI_OpenURL(const char *url); int SDL_GetAndroidSDKVersion(void); bool SDL_IsAndroidTablet(void); +bool SDL_IsAndroidTV(void); // File Dialogs bool Android_JNI_OpenFileDialog(SDL_DialogFileCallback callback, void* userdata,