diff test/common.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 a788656ca29a
children 5d3724f64f2b
line wrap: on
line diff
--- a/test/common.c	Sat Aug 05 17:12:22 2006 +0000
+++ b/test/common.c	Sat Aug 05 22:34:23 2006 +0000
@@ -545,7 +545,7 @@
         }
 
         if (state->verbose & VERBOSE_MODES) {
-            const SDL_DisplayMode *mode;
+            SDL_DisplayMode mode;
             int bpp;
             Uint32 Rmask, Gmask, Bmask, Amask;
 
@@ -555,12 +555,12 @@
                 fprintf(stderr, "Display %d:\n", i);
                 SDL_SelectVideoDisplay(i);
 
-                mode = SDL_GetDesktopDisplayMode();
-                SDL_PixelFormatEnumToMasks(mode->format, &bpp, &Rmask, &Gmask,
+                SDL_GetDesktopDisplayMode(&mode);
+                SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask,
                                            &Bmask, &Amask);
                 fprintf(stderr,
                         "  Current mode: %dx%d@%dHz, %d bits-per-pixel\n",
-                        mode->w, mode->h, mode->refresh_rate, bpp);
+                        mode.w, mode.h, mode.refresh_rate, bpp);
                 if (Rmask || Gmask || Bmask) {
                     fprintf(stderr, "      Red Mask = 0x%.8x\n", Rmask);
                     fprintf(stderr, "      Green Mask = 0x%.8x\n", Gmask);
@@ -576,12 +576,12 @@
                 } else {
                     fprintf(stderr, "  Fullscreen video modes:\n");
                     for (j = 0; j < m; ++j) {
-                        mode = SDL_GetDisplayMode(j);
-                        SDL_PixelFormatEnumToMasks(mode->format, &bpp, &Rmask,
+                        SDL_GetDisplayMode(j, &mode);
+                        SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask,
                                                    &Gmask, &Bmask, &Amask);
                         fprintf(stderr,
                                 "    Mode %d: %dx%d@%dHz, %d bits-per-pixel\n",
-                                j, mode->w, mode->h, mode->refresh_rate, bpp);
+                                j, mode.w, mode.h, mode.refresh_rate, bpp);
                         if (Rmask || Gmask || Bmask) {
                             fprintf(stderr, "        Red Mask = 0x%.8x\n",
                                     Rmask);