Commit 22161480eea1d73197bdd0f47d51fa6ddf36fea9

Sam Lantinga 2017-03-14T07:22:08

Compile fix for android. "ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]" Moving some variable declarations to the top of Android_SetScreenResolution()

diff --git a/src/video/android/SDL_androidvideo.c b/src/video/android/SDL_androidvideo.c
index 854605a..e5e70f9 100644
--- a/src/video/android/SDL_androidvideo.c
+++ b/src/video/android/SDL_androidvideo.c
@@ -193,6 +193,8 @@ Android_VideoQuit(_THIS)
 void
 Android_SetScreenResolution(int width, int height, Uint32 format, float rate)
 {
+	SDL_VideoDevice* device;
+	SDL_VideoDisplay *display;
     Android_ScreenWidth = width;
     Android_ScreenHeight = height;
     Android_ScreenFormat = format;
@@ -204,10 +206,10 @@ Android_SetScreenResolution(int width, int height, Uint32 format, float rate)
       example happen when the Activity enters or exists immersive mode,
       which can happen after VideoInit().
     */
-    SDL_VideoDevice* device = SDL_GetVideoDevice();
+    device = SDL_GetVideoDevice();
     if (device && device->num_displays > 0)
     {
-        SDL_VideoDisplay* display = &device->displays[0];
+        display = &device->displays[0];
         display->desktop_mode.format = Android_ScreenFormat;
         display->desktop_mode.w = Android_ScreenWidth;
         display->desktop_mode.h = Android_ScreenHeight;
@@ -219,7 +221,7 @@ Android_SetScreenResolution(int width, int height, Uint32 format, float rate)
 
         /* Force the current mode to match the resize otherwise the SDL_WINDOWEVENT_RESTORED event
          * will fall back to the old mode */
-        SDL_VideoDisplay *display = SDL_GetDisplayForWindow(Android_Window);
+        display = SDL_GetDisplayForWindow(Android_Window);
 
         display->current_mode.format = format;
         display->current_mode.w = width;