From 6533cd79d18336ce599a6f51b00342a49f3fb4ee Mon Sep 17 00:00:00 2001 From: Andreas Schiffler Date: Sat, 1 Dec 2012 23:30:53 -0800 Subject: [PATCH] Update VS2012 solution - add missing files; fix some static analysis warnings --- VisualC/SDL/SDL_VS2012.vcxproj | 2 ++ src/main/windows/SDL_windows_main.c | 2 +- src/test/SDL_test_fuzzer.c | 16 ++++++++-------- src/test/SDL_test_log.c | 2 ++ test/automated/surface/surface.c | 15 ++++++++------- 5 files changed, 21 insertions(+), 16 deletions(-) diff --git a/VisualC/SDL/SDL_VS2012.vcxproj b/VisualC/SDL/SDL_VS2012.vcxproj index 7bf207adf..55852fe22 100644 --- a/VisualC/SDL/SDL_VS2012.vcxproj +++ b/VisualC/SDL/SDL_VS2012.vcxproj @@ -255,6 +255,7 @@ + @@ -445,6 +446,7 @@ + diff --git a/src/main/windows/SDL_windows_main.c b/src/main/windows/SDL_windows_main.c index 52ea60f5c..f4f78f68c 100644 --- a/src/main/windows/SDL_windows_main.c +++ b/src/main/windows/SDL_windows_main.c @@ -27,7 +27,7 @@ UnEscapeQuotes(char *arg) char *last = NULL; while (*arg) { - if (*arg == '"' && *last == '\\') { + if (*arg == '"' && (last != NULL && *last == '\\')) { char *c_curr = arg; char *c_last = last; diff --git a/src/test/SDL_test_fuzzer.c b/src/test/SDL_test_fuzzer.c index c0c19f42d..a25a8c260 100644 --- a/src/test/SDL_test_fuzzer.c +++ b/src/test/SDL_test_fuzzer.c @@ -263,7 +263,7 @@ SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool vali size = SDLTest_GenerateUnsignedBoundaryValues(maxValue, (Uint64) boundary1, (Uint64) boundary2, validDomain, buffer); - if (size == 0) { + if (buffer == NULL || size == 0) { return 0; } @@ -291,7 +291,7 @@ SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL_bool v size = SDLTest_GenerateUnsignedBoundaryValues(maxValue, (Uint64) boundary1, (Uint64) boundary2, validDomain, buffer); - if(size == 0) { + if (buffer == NULL || size == 0) { return 0; } @@ -319,7 +319,7 @@ SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL_bool v size = SDLTest_GenerateUnsignedBoundaryValues(maxValue, (Uint64) boundary1, (Uint64) boundary2, validDomain, buffer); - if(size == 0) { + if (buffer == NULL || size == 0) { return 0; } @@ -347,7 +347,7 @@ SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool v size = SDLTest_GenerateUnsignedBoundaryValues(maxValue, (Uint64) boundary1, (Uint64) boundary2, validDomain, buffer); - if(size == 0) { + if (buffer == NULL || size == 0) { return 0; } @@ -467,7 +467,7 @@ SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool vali size = SDLTest_GenerateSignedBoundaryValues(minValue, maxValue, (Sint64) boundary1, (Sint64) boundary2, validDomain, buffer); - if(size == 0) { + if (buffer == NULL || size == 0) { return CHAR_MIN; } @@ -495,7 +495,7 @@ SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL_bool v size = SDLTest_GenerateSignedBoundaryValues(minValue, maxValue, (Sint64) boundary1, (Sint64) boundary2, validDomain, buffer); - if(size == 0) { + if (buffer == NULL || size == 0) { return SHRT_MIN; } @@ -524,7 +524,7 @@ SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL_bool v size = SDLTest_GenerateSignedBoundaryValues(minValue, maxValue, (Sint64) boundary1, (Sint64) boundary2, validDomain, buffer); - if(size == 0) { + if (buffer == NULL || size == 0) { return INT_MIN; } @@ -553,7 +553,7 @@ SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool v size = SDLTest_GenerateSignedBoundaryValues(minValue, maxValue, (Sint64) boundary1, (Sint64) boundary2, validDomain, buffer); - if(size == 0) { + if (buffer == NULL || size == 0) { return LLONG_MIN; } diff --git a/src/test/SDL_test_log.c b/src/test/SDL_test_log.c index 5c7ca731b..0c38c44f1 100644 --- a/src/test/SDL_test_log.c +++ b/src/test/SDL_test_log.c @@ -31,6 +31,8 @@ #include "SDL_config.h" #include /* va_list */ +#include +#include #include #include "SDL_test.h" diff --git a/test/automated/surface/surface.c b/test/automated/surface/surface.c index 9ea82b987..f7eb2ee48 100755 --- a/test/automated/surface/surface.c +++ b/test/automated/surface/surface.c @@ -212,7 +212,7 @@ static void surface_testBlit( SDL_Surface *testsur ) /** * @brief Tests a blend mode. */ -static int surface_testBlitBlendMode( SDL_Surface *testsur, SDL_Surface *face, int mode ) +static int surface_testBlitBlendMode( SDL_Surface *testsur, SDL_Surface *face, SDL_BlendMode bMode ) { int ret; int i, j, ni, nj; @@ -236,7 +236,7 @@ static int surface_testBlitBlendMode( SDL_Surface *testsur, SDL_Surface *face, i for (j=0; j <= nj; j+=4) { for (i=0; i <= ni; i+=4) { /* Set blend mode. */ - ret = SDL_SetSurfaceBlendMode( face, mode ); + ret = SDL_SetSurfaceBlendMode( face, bMode ); if (SDL_ATassert( "SDL_SetSurfaceBlendMode", ret == 0)) return 1; @@ -263,6 +263,7 @@ static void surface_testBlitBlend( SDL_Surface *testsur ) SDL_Surface *face; int i, j, ni, nj; int mode; + SDL_BlendMode bMode; SDL_ATbegin( "Blit Blending Tests" ); @@ -353,11 +354,11 @@ static void surface_testBlitBlend( SDL_Surface *testsur ) /* Crazy blending mode magic. */ mode = (i/4*j/4) % 4; - if (mode==0) mode = SDL_BLENDMODE_NONE; - else if (mode==1) mode = SDL_BLENDMODE_BLEND; - else if (mode==2) mode = SDL_BLENDMODE_ADD; - else if (mode==3) mode = SDL_BLENDMODE_MOD; - ret = SDL_SetSurfaceBlendMode( face, mode ); + if (mode==0) bMode = SDL_BLENDMODE_NONE; + else if (mode==1) bMode = SDL_BLENDMODE_BLEND; + else if (mode==2) bMode = SDL_BLENDMODE_ADD; + else if (mode==3) bMode = SDL_BLENDMODE_MOD; + ret = SDL_SetSurfaceBlendMode( face, bMode ); if (SDL_ATassert( "SDL_SetSurfaceBlendMode", ret == 0)) return;