Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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()
  • Loading branch information
slouken committed Mar 14, 2017
1 parent 6814f5d commit 2216148
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/video/android/SDL_androidvideo.c
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 2216148

Please sign in to comment.