From 46724ba3a9c0acef6eb6c0a5f81f7ce1dc855322 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 17 May 2004 01:56:12 +0000 Subject: [PATCH] fix warnings --- stepmania/src/RageSurface_Load_PNG.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/stepmania/src/RageSurface_Load_PNG.cpp b/stepmania/src/RageSurface_Load_PNG.cpp index e904649514..569b1021ea 100644 --- a/stepmania/src/RageSurface_Load_PNG.cpp +++ b/stepmania/src/RageSurface_Load_PNG.cpp @@ -134,6 +134,8 @@ static SDL_Surface *RageSurface_Load_PNG( RageFile *f, const char *fn, char erro case PNG_COLOR_TYPE_RGB_ALPHA: type = RGBA; break; + default: + FAIL_M(ssprintf( "%i", color_type) ); } if( color_type == PNG_COLOR_TYPE_GRAY ) @@ -193,13 +195,16 @@ static SDL_Surface *RageSurface_Load_PNG( RageFile *f, const char *fn, char erro break; case RGBX: case RGBA: - int r = SDL_SwapBE32( 0xFF000000 ); - int g = SDL_SwapBE32( 0x00FF0000 ); - int b = SDL_SwapBE32( 0x0000FF00 ); - int a = SDL_SwapBE32( type == RGBA? 0x000000FF:0x00000000 ); - ASSERT( surf ); - surf = SDL_CreateRGBSurfaceSane( SDL_SWSURFACE, width, height, 32, r, g, b, a ); + surf = SDL_CreateRGBSurfaceSane( SDL_SWSURFACE, width, height, 32, + SDL_SwapBE32( 0xFF000000 ), + SDL_SwapBE32( 0x00FF0000 ), + SDL_SwapBE32( 0x0000FF00 ), + SDL_SwapBE32( type == RGBA? 0x000000FF:0x00000000 ) ); + break; + default: + FAIL_M(ssprintf( "%i", type) ); } + ASSERT( surf ); /* alloca to prevent memleaks if libpng longjmps us */ png_byte **row_pointers = (png_byte **) alloca( sizeof(png_byte*) * height );