diff test/testvidinfo.c @ 1967:01e29c3e9a29

In general, fill in pointers to structures, rather than return them.
author Sam Lantinga <slouken@libsdl.org>
date Sat, 05 Aug 2006 22:34:23 +0000
parents c121d94672cb
children 929e7dd10031
line wrap: on
line diff
--- a/test/testvidinfo.c	Sat Aug 05 17:12:22 2006 +0000
+++ b/test/testvidinfo.c	Sat Aug 05 22:34:23 2006 +0000
@@ -419,7 +419,7 @@
     const SDL_VideoInfo *info;
     int i, d, n;
     const char *driver;
-    const SDL_DisplayMode *mode;
+    SDL_DisplayMode mode;
     int bpp;
     Uint32 Rmask, Gmask, Bmask, Amask;
     int nmodes;
@@ -452,11 +452,11 @@
         printf("Display %d:\n", d);
         SDL_SelectVideoDisplay(d);
 
-        mode = SDL_GetDesktopDisplayMode();
-        SDL_PixelFormatEnumToMasks(mode->format, &bpp, &Rmask, &Gmask, &Bmask,
+        SDL_GetDesktopDisplayMode(&mode);
+        SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask, &Bmask,
                                    &Amask);
-        printf("  Current mode: %dx%d@%dHz, %d bits-per-pixel\n", mode->w,
-               mode->h, mode->refresh_rate, bpp);
+        printf("  Current mode: %dx%d@%dHz, %d bits-per-pixel\n", mode.w,
+               mode.h, mode.refresh_rate, bpp);
         if (Rmask || Gmask || Bmask) {
             printf("      Red Mask = 0x%.8x\n", Rmask);
             printf("      Green Mask = 0x%.8x\n", Gmask);
@@ -472,11 +472,11 @@
         } else {
             printf("  Fullscreen video modes:\n");
             for (i = 0; i < nmodes; ++i) {
-                mode = SDL_GetDisplayMode(i);
-                SDL_PixelFormatEnumToMasks(mode->format, &bpp, &Rmask,
+                SDL_GetDisplayMode(i, &mode);
+                SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask,
                                            &Gmask, &Bmask, &Amask);
                 printf("    Mode %d: %dx%d@%dHz, %d bits-per-pixel\n", i,
-                       mode->w, mode->h, mode->refresh_rate, bpp);
+                       mode.w, mode.h, mode.refresh_rate, bpp);
                 if (Rmask || Gmask || Bmask) {
                     printf("        Red Mask = 0x%.8x\n", Rmask);
                     printf("        Green Mask = 0x%.8x\n", Gmask);