From 22161480eea1d73197bdd0f47d51fa6ddf36fea9 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 14 Mar 2017 07:22:08 -0700 Subject: [PATCH] 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() --- src/video/android/SDL_androidvideo.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/video/android/SDL_androidvideo.c b/src/video/android/SDL_androidvideo.c index 854605aa0..e5e70f9bf 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;