Browse Source

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()
Sam Lantinga 8 years ago
parent
commit
22161480ee
1 changed files with 5 additions and 3 deletions
  1. 5 3
      src/video/android/SDL_androidvideo.c

+ 5 - 3
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;