ソースを参照

Fixed warnings building on Android

Sam Lantinga 6 ヶ月 前
コミット
06bd214af6
4 ファイル変更6 行追加4 行削除
  1. 1 1
      build-scripts/androidbuildlibs.sh
  2. 3 2
      src/SDL.c
  3. 1 1
      src/SDL_hashtable.c
  4. 1 0
      src/core/android/SDL_android.h

+ 1 - 1
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=

+ 3 - 2
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);

+ 1 - 1
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);

+ 1 - 0
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,