wayland: Fixed C99-style variable declaration inside for-loop.
authorRyan C. Gordon <icculus@icculus.org>
Wed, 19 Jun 2019 00:52:34 -0400
changeset 1288932d98e72ed94
parent 12888 3dd2f2634e46
child 12890 dd47d4ea431e
wayland: Fixed C99-style variable declaration inside for-loop.
src/video/wayland/SDL_waylandwindow.c
     1.1 --- a/src/video/wayland/SDL_waylandwindow.c	Tue Jun 18 21:50:57 2019 -0700
     1.2 +++ b/src/video/wayland/SDL_waylandwindow.c	Wed Jun 19 00:52:34 2019 -0400
     1.3 @@ -345,6 +345,7 @@
     1.4  static void
     1.5  update_scale_factor(SDL_WindowData *window) {
     1.6     float old_factor = window->scale_factor, new_factor = 0.0;
     1.7 +   int i;
     1.8  
     1.9     if (!(window->sdlwindow->flags & SDL_WINDOW_ALLOW_HIGHDPI)) {
    1.10         return;
    1.11 @@ -358,7 +359,7 @@
    1.12         new_factor = ((SDL_WaylandOutputData*)(wl_output_get_user_data(window->sdlwindow->fullscreen_mode.driverdata)))->scale_factor;
    1.13     }
    1.14  
    1.15 -   for (int i = 0; i < window->num_outputs; i++) {
    1.16 +   for (i = 0; i < window->num_outputs; i++) {
    1.17         float factor = ((SDL_WaylandOutputData*)(wl_output_get_user_data(window->outputs[i])))->scale_factor;
    1.18         if (factor > new_factor) {
    1.19             new_factor = factor;
    1.20 @@ -388,10 +389,11 @@
    1.21  handle_surface_leave(void *data, struct wl_surface *surface,
    1.22          struct wl_output *output) {
    1.23      SDL_WindowData *window = data;
    1.24 +    int i;
    1.25  
    1.26      if (window->num_outputs > 1) {
    1.27         struct wl_output **new_outputs = SDL_malloc((window->num_outputs - 1) * sizeof *window->outputs), **iter = new_outputs;
    1.28 -       for (int i=0; i < window->num_outputs; i++) {
    1.29 +       for (i=0; i < window->num_outputs; i++) {
    1.30             if (window->outputs[i] != output) {
    1.31                 *iter = window->outputs[i];
    1.32                 iter++;
    1.33 @@ -640,7 +642,8 @@
    1.34      data->scale_factor = 1.0;
    1.35  
    1.36      if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
    1.37 -        for (int i=0; i < SDL_GetVideoDevice()->num_displays; i++) {
    1.38 +        int i;
    1.39 +        for (i=0; i < SDL_GetVideoDevice()->num_displays; i++) {
    1.40              float scale = ((SDL_WaylandOutputData*)SDL_GetVideoDevice()->displays[i].driverdata)->scale_factor;
    1.41              if (scale > data->scale_factor) {
    1.42                  data->scale_factor = scale;