# HG changeset patch # User Matti Hamalainen # Date 1400983394 -10800 # Node ID ea44e1d9eb7c4aa9bb88bb1227551f22c79ab6b0 # Parent 09fad777f3709823661199bc91bf86f038cb7571 Cleanups. diff -r 09fad777f370 -r ea44e1d9eb7c pwplib/sdl.c --- a/pwplib/sdl.c Sat Dec 21 07:28:31 2013 +0200 +++ b/pwplib/sdl.c Sun May 25 05:03:14 2014 +0300 @@ -69,23 +69,25 @@ SDL_Flip(pwp_SDL.screen); } -static void rast2rgb(int n, int muller, int *r, int *g, int *b) +static void rast2rgb(const int n, const int muller, int *r, int *g, int *b) { - int fg = n & 15, bg = (n >> 4) & 15; - static const char rgb[16 * 3] = { 0, 0, 0, - 0, 0, 9, - 0, 9, 0, - 0, 9, 9, - 9, 0, 0, - 9, 0, 9, - 9, 9, 0, - 9, 9, 9, - 6, 6, 6, - 0, 0, 15, - 0, 15, 0, - 0, 15, 15, - 15, 0, 0, - 15, 0, 15, + const int fg = n & 15, bg = (n >> 4) & 15; + static const char rgb[16 * 3] = + { + 0, 0 , 0, + 0, 0 , 9, + 0, 9 , 0, + 0, 9 , 9, + 9, 0 , 0, + 9, 0 , 9, + 9, 9 , 0, + 9, 9 , 9, + 6, 6 , 6, + 0, 0 , 15, + 0, 15, 0, + 0, 15, 15, + 15, 0 , 0, + 15, 0 , 15, 15, 15, 0, 15, 15, 15 }; @@ -104,7 +106,8 @@ pwp_SDL.width = pwplib.setup[SETUP_XRES]; pwp_SDL.height = pwplib.setup[SETUP_YRES]; - if (pwp_SDL.width < 8 || pwp_SDL.height < 16) { + if (pwp_SDL.width < 8 || pwp_SDL.height < 16) + { pwpwrite("* invalid xres or yres (%d x %d)\n", pwp_SDL.width, pwp_SDL.height); return 0; } @@ -116,7 +119,8 @@ /* Initialize a indexed / paletted video surface */ pwp_SDL.screen = SDL_SetVideoMode(pwp_SDL.width, pwp_SDL.height, 8, pwp_SDL.vflags); - if (pwp_SDL.screen == NULL) { + if (pwp_SDL.screen == NULL) + { pwpwrite("* SDL could not initialize video surface/mode.\n"); return 0; }