In general, fill in pointers to structures, rather than return them.
authorSam Lantinga <slouken@libsdl.org>
Sat, 05 Aug 2006 22:34:23 +0000
changeset 196701e29c3e9a29
parent 1966 6472256c21eb
child 1968 9f589a1f74a5
In general, fill in pointers to structures, rather than return them.
include/SDL_audio.h
include/SDL_video.h
src/SDL_compat.c
src/video/SDL_video.c
src/video/cocoa/SDL_cocoakeyboard.h
test/common.c
test/testgl2.c
test/testvidinfo.c
     1.1 --- a/include/SDL_audio.h	Sat Aug 05 17:12:22 2006 +0000
     1.2 +++ b/include/SDL_audio.h	Sat Aug 05 22:34:23 2006 +0000
     1.3 @@ -237,7 +237,8 @@
     1.4   *  Must be a value between 0 and (number of audio devices-1).
     1.5   *  Only valid after a successfully initializing the audio subsystem.
     1.6   */
     1.7 -extern DECLSPEC const char *SDLCALL SDL_GetAudioDevice(int index, int iscapture);
     1.8 +extern DECLSPEC const char *SDLCALL SDL_GetAudioDevice(int index,
     1.9 +                                                       int iscapture);
    1.10  
    1.11  
    1.12  /*
    1.13 @@ -245,11 +246,14 @@
    1.14   *  equivalent to SDL_OpenAudio(). Returns 0 on error, a valid device ID
    1.15   *  on success.
    1.16   */
    1.17 -extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(
    1.18 -                                                const char * device,
    1.19 -                                                int iscapture,
    1.20 -                                                const SDL_AudioSpec * desired,
    1.21 -                                                SDL_AudioSpec * obtained);
    1.22 +extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(const char
    1.23 +                                                              *device,
    1.24 +                                                              int iscapture,
    1.25 +                                                              const
    1.26 +                                                              SDL_AudioSpec *
    1.27 +                                                              desired,
    1.28 +                                                              SDL_AudioSpec *
    1.29 +                                                              obtained);
    1.30  
    1.31  
    1.32  
    1.33 @@ -264,8 +268,8 @@
    1.34  } SDL_audiostatus;
    1.35  extern DECLSPEC SDL_audiostatus SDLCALL SDL_GetAudioStatus(void);
    1.36  
    1.37 -extern DECLSPEC SDL_audiostatus SDLCALL SDL_GetAudioDeviceStatus(
    1.38 -                                                        SDL_AudioDeviceID dev);
    1.39 +extern DECLSPEC SDL_audiostatus SDLCALL
    1.40 +SDL_GetAudioDeviceStatus(SDL_AudioDeviceID dev);
    1.41  
    1.42  /*
    1.43   * This function pauses and unpauses the audio callback processing.
    1.44 @@ -352,7 +356,8 @@
    1.45   *  using the format of audio device 1. Thus it can be used when no audio
    1.46   *  device is open at all.
    1.47   */
    1.48 -extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src,
    1.49 +extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst,
    1.50 +                                                const Uint8 * src,
    1.51                                                  SDL_AudioFormat format,
    1.52                                                  Uint32 len, int volume);
    1.53  
     2.1 --- a/include/SDL_video.h	Sat Aug 05 17:12:22 2006 +0000
     2.2 +++ b/include/SDL_video.h	Sat Aug 05 22:34:23 2006 +0000
     2.3 @@ -432,7 +432,7 @@
     2.4  extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(void);
     2.5  
     2.6  /**
     2.7 - * \fn const SDL_DisplayMode *SDL_GetDisplayMode(int index)
     2.8 + * \fn int SDL_GetDisplayMode(int index, SDL_DisplayMode *mode)
     2.9   *
    2.10   * \brief Retrieve information about a specific display mode.
    2.11   *
    2.12 @@ -444,23 +444,22 @@
    2.13   *
    2.14   * \sa SDL_GetNumDisplayModes()
    2.15   */
    2.16 -extern DECLSPEC const SDL_DisplayMode *SDLCALL SDL_GetDisplayMode(int index);
    2.17 +extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int index,
    2.18 +                                               SDL_DisplayMode * mode);
    2.19  
    2.20  /**
    2.21 - * \fn const SDL_DisplayMode *SDL_GetDesktopDisplayMode(void)
    2.22 + * \fn int SDL_GetDesktopDisplayMode(SDL_DisplayMode *mode)
    2.23   *
    2.24   * \brief Retrieve information about the desktop display mode for the current display.
    2.25   */
    2.26 -extern DECLSPEC const SDL_DisplayMode *SDLCALL
    2.27 -SDL_GetDesktopDisplayMode(void);
    2.28 +extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(SDL_DisplayMode * mode);
    2.29  
    2.30  /**
    2.31 - * \fn const SDL_DisplayMode *SDL_GetCurrentDisplayMode(void)
    2.32 + * \fn int SDL_GetCurrentDisplayMode(SDL_DisplayMode *mode)
    2.33   *
    2.34   * \brief Retrieve information about the current display mode.
    2.35   */
    2.36 -extern DECLSPEC const SDL_DisplayMode *SDLCALL
    2.37 -SDL_GetCurrentDisplayMode(void);
    2.38 +extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(SDL_DisplayMode * mode);
    2.39  
    2.40  /**
    2.41   * \fn SDL_DisplayMode *SDL_GetClosestDisplayMode(const SDL_DisplayMode *mode, SDL_DisplayMode *closest)
    2.42 @@ -499,13 +498,13 @@
    2.43                                                           * mode);
    2.44  
    2.45  /**
    2.46 - * \fn const SDL_DisplayMode *SDL_GetFullscreenDisplayMode(void)
    2.47 + * \fn int SDL_GetFullscreenDisplayMode(SDL_DisplayMode *mode)
    2.48   *
    2.49   * \brief Query the display mode used when a fullscreen window is visible
    2.50   *        on the currently selected display.
    2.51   */
    2.52 -extern DECLSPEC const SDL_DisplayMode *SDLCALL
    2.53 -SDL_GetFullscreenDisplayMode(void);
    2.54 +extern DECLSPEC int SDLCALL SDL_GetFullscreenDisplayMode(SDL_DisplayMode *
    2.55 +                                                         mode);
    2.56  
    2.57  /**
    2.58   * \fn int SDL_SetDisplayPalette(const SDL_Color *colors, int firstcolor, int ncolors)
     3.1 --- a/src/SDL_compat.c	Sat Aug 05 17:12:22 2006 +0000
     3.2 +++ b/src/SDL_compat.c	Sat Aug 05 22:34:23 2006 +0000
     3.3 @@ -65,14 +65,15 @@
     3.4  SDL_GetVideoInfo(void)
     3.5  {
     3.6      static SDL_VideoInfo info;
     3.7 +    SDL_DisplayMode mode;
     3.8  
     3.9      /* Memory leak, compatibility code, who cares? */
    3.10 -    if (!info.vfmt && SDL_GetDesktopDisplayMode()) {
    3.11 +    if (!info.vfmt && SDL_GetDesktopDisplayMode(&mode) == 0) {
    3.12          int bpp;
    3.13          Uint32 Rmask, Gmask, Bmask, Amask;
    3.14  
    3.15 -        SDL_PixelFormatEnumToMasks(SDL_GetDesktopDisplayMode()->format, &bpp,
    3.16 -                                   &Rmask, &Gmask, &Bmask, &Amask);
    3.17 +        SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask, &Bmask,
    3.18 +                                   &Amask);
    3.19          info.vfmt = SDL_AllocFormat(bpp, Rmask, Gmask, Bmask, Amask);
    3.20      }
    3.21      return &info;
    3.22 @@ -88,17 +89,20 @@
    3.23      }
    3.24  
    3.25      if (!(flags & SDL_FULLSCREEN)) {
    3.26 -        return SDL_BITSPERPIXEL(SDL_GetDesktopDisplayMode()->format);
    3.27 +        SDL_DisplayMode mode;
    3.28 +        SDL_GetDesktopDisplayMode(&mode);
    3.29 +        return SDL_BITSPERPIXEL(mode.format);
    3.30      }
    3.31  
    3.32      for (i = 0; i < SDL_GetNumDisplayModes(); ++i) {
    3.33 -        const SDL_DisplayMode *mode = SDL_GetDisplayMode(i);
    3.34 -        if (!mode->w || !mode->h || (width == mode->w && height == mode->h)) {
    3.35 -            if (!mode->format) {
    3.36 +        SDL_DisplayMode mode;
    3.37 +        SDL_GetDisplayMode(i, &mode);
    3.38 +        if (!mode.w || !mode.h || (width == mode.w && height == mode.h)) {
    3.39 +            if (!mode.format) {
    3.40                  return bpp;
    3.41              }
    3.42 -            if (SDL_BITSPERPIXEL(mode->format) >= (Uint32) bpp) {
    3.43 -                actual_bpp = SDL_BITSPERPIXEL(mode->format);
    3.44 +            if (SDL_BITSPERPIXEL(mode.format) >= (Uint32) bpp) {
    3.45 +                actual_bpp = SDL_BITSPERPIXEL(mode.format);
    3.46              }
    3.47          }
    3.48      }
    3.49 @@ -123,15 +127,16 @@
    3.50      nmodes = 0;
    3.51      modes = NULL;
    3.52      for (i = 0; i < SDL_GetNumDisplayModes(); ++i) {
    3.53 -        const SDL_DisplayMode *mode = SDL_GetDisplayMode(i);
    3.54 -        if (!mode->w || !mode->h) {
    3.55 +        SDL_DisplayMode mode;
    3.56 +        SDL_GetDisplayMode(i, &mode);
    3.57 +        if (!mode.w || !mode.h) {
    3.58              return (SDL_Rect **) (-1);
    3.59          }
    3.60 -        if (SDL_BITSPERPIXEL(mode->format) != format->BitsPerPixel) {
    3.61 +        if (SDL_BITSPERPIXEL(mode.format) != format->BitsPerPixel) {
    3.62              continue;
    3.63          }
    3.64 -        if (nmodes > 0 && modes[nmodes - 1]->w == mode->w
    3.65 -            && modes[nmodes - 1]->h == mode->h) {
    3.66 +        if (nmodes > 0 && modes[nmodes - 1]->w == mode.w
    3.67 +            && modes[nmodes - 1]->h == mode.h) {
    3.68              continue;
    3.69          }
    3.70  
    3.71 @@ -145,8 +150,8 @@
    3.72          }
    3.73          modes[nmodes]->x = 0;
    3.74          modes[nmodes]->y = 0;
    3.75 -        modes[nmodes]->w = mode->w;
    3.76 -        modes[nmodes]->h = mode->h;
    3.77 +        modes[nmodes]->w = mode.w;
    3.78 +        modes[nmodes]->h = mode.h;
    3.79          ++nmodes;
    3.80      }
    3.81      if (modes) {
    3.82 @@ -300,16 +305,17 @@
    3.83          }
    3.84      }
    3.85      if (center) {
    3.86 -        const SDL_DisplayMode *current = SDL_GetDesktopDisplayMode();
    3.87 -        *x = (current->w - w) / 2;
    3.88 -        *y = (current->h - h) / 2;
    3.89 +        SDL_DisplayMode mode;
    3.90 +        SDL_GetDesktopDisplayMode(&mode);
    3.91 +        *x = (mode.w - w) / 2;
    3.92 +        *y = (mode.h - h) / 2;
    3.93      }
    3.94  }
    3.95  
    3.96  SDL_Surface *
    3.97  SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags)
    3.98  {
    3.99 -    const SDL_DisplayMode *desktop_mode;
   3.100 +    SDL_DisplayMode desktop_mode;
   3.101      SDL_DisplayMode mode;
   3.102      int window_x = SDL_WINDOWPOS_UNDEFINED;
   3.103      int window_y = SDL_WINDOWPOS_UNDEFINED;
   3.104 @@ -390,8 +396,8 @@
   3.105      }
   3.106  
   3.107      /* Set up the desired display mode */
   3.108 -    desktop_mode = SDL_GetDesktopDisplayMode();
   3.109 -    desktop_format = desktop_mode->format;
   3.110 +    SDL_GetDesktopDisplayMode(&desktop_mode);
   3.111 +    desktop_format = desktop_mode.format;
   3.112      if (desktop_format && ((flags & SDL_ANYFORMAT)
   3.113                             || (bpp == SDL_BITSPERPIXEL(desktop_format)))) {
   3.114          desired_format = desktop_format;
     4.1 --- a/src/video/SDL_video.c	Sat Aug 05 17:12:22 2006 +0000
     4.2 +++ b/src/video/SDL_video.c	Sat Aug 05 22:34:23 2006 +0000
     4.3 @@ -422,33 +422,44 @@
     4.4      return 0;
     4.5  }
     4.6  
     4.7 -const SDL_DisplayMode *
     4.8 -SDL_GetDisplayMode(int index)
     4.9 +int
    4.10 +SDL_GetDisplayMode(int index, SDL_DisplayMode * mode)
    4.11  {
    4.12      if (index < 0 || index >= SDL_GetNumDisplayModes()) {
    4.13          SDL_SetError("index must be in the range of 0 - %d",
    4.14                       SDL_GetNumDisplayModes() - 1);
    4.15 -        return NULL;
    4.16 +        return -1;
    4.17      }
    4.18 -    return &SDL_CurrentDisplay.display_modes[index];
    4.19 +    if (mode) {
    4.20 +        *mode = SDL_CurrentDisplay.display_modes[index];
    4.21 +    }
    4.22 +    return 0;
    4.23  }
    4.24  
    4.25 -const SDL_DisplayMode *
    4.26 -SDL_GetDesktopDisplayMode(void)
    4.27 +int
    4.28 +SDL_GetDesktopDisplayMode(SDL_DisplayMode * mode)
    4.29  {
    4.30 -    if (_this) {
    4.31 -        return &SDL_CurrentDisplay.desktop_mode;
    4.32 +    if (!_this) {
    4.33 +        SDL_UninitializedVideo();
    4.34 +        return -1;
    4.35      }
    4.36 -    return NULL;
    4.37 +    if (mode) {
    4.38 +        *mode = SDL_CurrentDisplay.desktop_mode;
    4.39 +    }
    4.40 +    return 0;
    4.41  }
    4.42  
    4.43 -const SDL_DisplayMode *
    4.44 -SDL_GetCurrentDisplayMode(void)
    4.45 +int
    4.46 +SDL_GetCurrentDisplayMode(SDL_DisplayMode * mode)
    4.47  {
    4.48 -    if (_this) {
    4.49 -        return &SDL_CurrentDisplay.current_mode;
    4.50 +    if (!_this) {
    4.51 +        SDL_UninitializedVideo();
    4.52 +        return -1;
    4.53      }
    4.54 -    return NULL;
    4.55 +    if (mode) {
    4.56 +        *mode = SDL_CurrentDisplay.current_mode;
    4.57 +    }
    4.58 +    return 0;
    4.59  }
    4.60  
    4.61  SDL_DisplayMode *
    4.62 @@ -549,6 +560,7 @@
    4.63  {
    4.64      SDL_VideoDisplay *display;
    4.65      SDL_DisplayMode display_mode;
    4.66 +    SDL_DisplayMode current_mode;
    4.67      int i, ncolors;
    4.68  
    4.69      if (!_this) {
    4.70 @@ -556,10 +568,10 @@
    4.71          return -1;
    4.72      }
    4.73  
    4.74 +    display = &SDL_CurrentDisplay;
    4.75      if (!mode) {
    4.76 -        mode = SDL_GetDesktopDisplayMode();
    4.77 +        mode = &display->desktop_mode;
    4.78      }
    4.79 -    display = &SDL_CurrentDisplay;
    4.80      display_mode = *mode;
    4.81  
    4.82      /* Default to the current mode */
    4.83 @@ -584,9 +596,8 @@
    4.84      }
    4.85  
    4.86      /* See if there's anything left to do */
    4.87 -    if (SDL_memcmp
    4.88 -        (&display_mode, SDL_GetCurrentDisplayMode(),
    4.89 -         sizeof(display_mode)) == 0) {
    4.90 +    SDL_GetCurrentDisplayMode(&current_mode);
    4.91 +    if (SDL_memcmp(&display_mode, &current_mode, sizeof(display_mode)) == 0) {
    4.92          return 0;
    4.93      }
    4.94  
    4.95 @@ -659,13 +670,17 @@
    4.96      return 0;
    4.97  }
    4.98  
    4.99 -const SDL_DisplayMode *
   4.100 -SDL_GetFullscreenDisplayMode(void)
   4.101 +int
   4.102 +SDL_GetFullscreenDisplayMode(SDL_DisplayMode * mode)
   4.103  {
   4.104 -    if (_this) {
   4.105 -        return SDL_CurrentDisplay.fullscreen_mode;
   4.106 +    if (!_this) {
   4.107 +        SDL_UninitializedVideo();
   4.108 +        return -1;
   4.109      }
   4.110 -    return NULL;
   4.111 +    if (mode) {
   4.112 +        *mode = *SDL_CurrentDisplay.fullscreen_mode;
   4.113 +    }
   4.114 +    return 0;
   4.115  }
   4.116  
   4.117  int
     5.1 --- a/src/video/cocoa/SDL_cocoakeyboard.h	Sat Aug 05 17:12:22 2006 +0000
     5.2 +++ b/src/video/cocoa/SDL_cocoakeyboard.h	Sat Aug 05 22:34:23 2006 +0000
     5.3 @@ -25,7 +25,7 @@
     5.4  #define _SDL_cocoakeyboard_h
     5.5  
     5.6  extern void Cocoa_InitKeyboard(_THIS);
     5.7 -extern void Cocoa_HandleKeyEvent(_THIS, NSEvent *event);
     5.8 +extern void Cocoa_HandleKeyEvent(_THIS, NSEvent * event);
     5.9  extern void Cocoa_QuitKeyboard(_THIS);
    5.10  
    5.11  #endif /* _SDL_cocoakeyboard_h */
     6.1 --- a/test/common.c	Sat Aug 05 17:12:22 2006 +0000
     6.2 +++ b/test/common.c	Sat Aug 05 22:34:23 2006 +0000
     6.3 @@ -545,7 +545,7 @@
     6.4          }
     6.5  
     6.6          if (state->verbose & VERBOSE_MODES) {
     6.7 -            const SDL_DisplayMode *mode;
     6.8 +            SDL_DisplayMode mode;
     6.9              int bpp;
    6.10              Uint32 Rmask, Gmask, Bmask, Amask;
    6.11  
    6.12 @@ -555,12 +555,12 @@
    6.13                  fprintf(stderr, "Display %d:\n", i);
    6.14                  SDL_SelectVideoDisplay(i);
    6.15  
    6.16 -                mode = SDL_GetDesktopDisplayMode();
    6.17 -                SDL_PixelFormatEnumToMasks(mode->format, &bpp, &Rmask, &Gmask,
    6.18 +                SDL_GetDesktopDisplayMode(&mode);
    6.19 +                SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask,
    6.20                                             &Bmask, &Amask);
    6.21                  fprintf(stderr,
    6.22                          "  Current mode: %dx%d@%dHz, %d bits-per-pixel\n",
    6.23 -                        mode->w, mode->h, mode->refresh_rate, bpp);
    6.24 +                        mode.w, mode.h, mode.refresh_rate, bpp);
    6.25                  if (Rmask || Gmask || Bmask) {
    6.26                      fprintf(stderr, "      Red Mask = 0x%.8x\n", Rmask);
    6.27                      fprintf(stderr, "      Green Mask = 0x%.8x\n", Gmask);
    6.28 @@ -576,12 +576,12 @@
    6.29                  } else {
    6.30                      fprintf(stderr, "  Fullscreen video modes:\n");
    6.31                      for (j = 0; j < m; ++j) {
    6.32 -                        mode = SDL_GetDisplayMode(j);
    6.33 -                        SDL_PixelFormatEnumToMasks(mode->format, &bpp, &Rmask,
    6.34 +                        SDL_GetDisplayMode(j, &mode);
    6.35 +                        SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask,
    6.36                                                     &Gmask, &Bmask, &Amask);
    6.37                          fprintf(stderr,
    6.38                                  "    Mode %d: %dx%d@%dHz, %d bits-per-pixel\n",
    6.39 -                                j, mode->w, mode->h, mode->refresh_rate, bpp);
    6.40 +                                j, mode.w, mode.h, mode.refresh_rate, bpp);
    6.41                          if (Rmask || Gmask || Bmask) {
    6.42                              fprintf(stderr, "        Red Mask = 0x%.8x\n",
    6.43                                      Rmask);
     7.1 --- a/test/testgl2.c	Sat Aug 05 17:12:22 2006 +0000
     7.2 +++ b/test/testgl2.c	Sat Aug 05 22:34:23 2006 +0000
     7.3 @@ -165,6 +165,7 @@
     7.4      int fsaa, accel;
     7.5      int value;
     7.6      int i, done;
     7.7 +    SDL_DisplayMode mode;
     7.8      SDL_Event event;
     7.9      Uint32 then, now, frames;
    7.10  
    7.11 @@ -235,8 +236,8 @@
    7.12          SDL_GL_SetSwapInterval(0);
    7.13      }
    7.14  
    7.15 -    printf("Screen BPP: %d\n",
    7.16 -           SDL_BITSPERPIXEL(SDL_GetCurrentDisplayMode()->format));
    7.17 +    SDL_GetCurrentDisplayMode(&mode);
    7.18 +    printf("Screen BPP: %d\n", SDL_BITSPERPIXEL(mode.format));
    7.19      printf("\n");
    7.20      printf("Vendor     : %s\n", glGetString(GL_VENDOR));
    7.21      printf("Renderer   : %s\n", glGetString(GL_RENDERER));
     8.1 --- a/test/testvidinfo.c	Sat Aug 05 17:12:22 2006 +0000
     8.2 +++ b/test/testvidinfo.c	Sat Aug 05 22:34:23 2006 +0000
     8.3 @@ -419,7 +419,7 @@
     8.4      const SDL_VideoInfo *info;
     8.5      int i, d, n;
     8.6      const char *driver;
     8.7 -    const SDL_DisplayMode *mode;
     8.8 +    SDL_DisplayMode mode;
     8.9      int bpp;
    8.10      Uint32 Rmask, Gmask, Bmask, Amask;
    8.11      int nmodes;
    8.12 @@ -452,11 +452,11 @@
    8.13          printf("Display %d:\n", d);
    8.14          SDL_SelectVideoDisplay(d);
    8.15  
    8.16 -        mode = SDL_GetDesktopDisplayMode();
    8.17 -        SDL_PixelFormatEnumToMasks(mode->format, &bpp, &Rmask, &Gmask, &Bmask,
    8.18 +        SDL_GetDesktopDisplayMode(&mode);
    8.19 +        SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask, &Bmask,
    8.20                                     &Amask);
    8.21 -        printf("  Current mode: %dx%d@%dHz, %d bits-per-pixel\n", mode->w,
    8.22 -               mode->h, mode->refresh_rate, bpp);
    8.23 +        printf("  Current mode: %dx%d@%dHz, %d bits-per-pixel\n", mode.w,
    8.24 +               mode.h, mode.refresh_rate, bpp);
    8.25          if (Rmask || Gmask || Bmask) {
    8.26              printf("      Red Mask = 0x%.8x\n", Rmask);
    8.27              printf("      Green Mask = 0x%.8x\n", Gmask);
    8.28 @@ -472,11 +472,11 @@
    8.29          } else {
    8.30              printf("  Fullscreen video modes:\n");
    8.31              for (i = 0; i < nmodes; ++i) {
    8.32 -                mode = SDL_GetDisplayMode(i);
    8.33 -                SDL_PixelFormatEnumToMasks(mode->format, &bpp, &Rmask,
    8.34 +                SDL_GetDisplayMode(i, &mode);
    8.35 +                SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask,
    8.36                                             &Gmask, &Bmask, &Amask);
    8.37                  printf("    Mode %d: %dx%d@%dHz, %d bits-per-pixel\n", i,
    8.38 -                       mode->w, mode->h, mode->refresh_rate, bpp);
    8.39 +                       mode.w, mode.h, mode.refresh_rate, bpp);
    8.40                  if (Rmask || Gmask || Bmask) {
    8.41                      printf("        Red Mask = 0x%.8x\n", Rmask);
    8.42                      printf("        Green Mask = 0x%.8x\n", Gmask);