Update VS2012 solution - add missing files; fix some static analysis warnings
authorAndreas Schiffler <aschiffler@ferzkopp.net>
Sat, 01 Dec 2012 23:30:53 -0800
changeset 6719 c250f633c040
parent 6718 918ba414168b
child 6720 5d20f1296bca
Update VS2012 solution - add missing files; fix some static analysis warnings
VisualC/SDL/SDL_VS2012.vcxproj
src/main/windows/SDL_windows_main.c
src/test/SDL_test_fuzzer.c
src/test/SDL_test_log.c
test/automated/surface/surface.c
--- a/VisualC/SDL/SDL_VS2012.vcxproj	Sat Dec 01 14:48:30 2012 -0800
+++ b/VisualC/SDL/SDL_VS2012.vcxproj	Sat Dec 01 23:30:53 2012 -0800
@@ -255,6 +255,7 @@
     <ClInclude Include="..\..\include\SDL_types.h" />
     <ClInclude Include="..\..\include\SDL_version.h" />
     <ClInclude Include="..\..\include\SDL_video.h" />
+    <ClInclude Include="..\..\include\SDL_gamecontroller.h" />
     <ClInclude Include="..\..\src\core\windows\SDL_windows.h" />
     <ClInclude Include="..\..\src\events\blank_cursor.h" />
     <ClInclude Include="..\..\src\events\default_cursor.h" />
@@ -445,6 +446,7 @@
     <ClCompile Include="..\..\src\video\windows\SDL_windowsvideo.c" />
     <ClCompile Include="..\..\src\video\windows\SDL_windowswindow.c" />
     <ClCompile Include="..\..\src\events\SDL_windowevents.c" />
+    <ClCompile Include="..\..\src\joystick\SDL_gamecontroller.c" />
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="..\..\src\main\windows\version.rc" />
--- a/src/main/windows/SDL_windows_main.c	Sat Dec 01 14:48:30 2012 -0800
+++ b/src/main/windows/SDL_windows_main.c	Sat Dec 01 23:30:53 2012 -0800
@@ -27,7 +27,7 @@
     char *last = NULL;
 
     while (*arg) {
-        if (*arg == '"' && *last == '\\') {
+        if (*arg == '"' && (last != NULL && *last == '\\')) {
             char *c_curr = arg;
             char *c_last = last;
 
--- a/src/test/SDL_test_fuzzer.c	Sat Dec 01 14:48:30 2012 -0800
+++ b/src/test/SDL_test_fuzzer.c	Sat Dec 01 23:30:53 2012 -0800
@@ -263,7 +263,7 @@
 	size = SDLTest_GenerateUnsignedBoundaryValues(maxValue,
 				(Uint64) boundary1, (Uint64) boundary2,
 				validDomain, buffer);
-	if (size == 0) {
+	if (buffer == NULL || size == 0) {
 		return 0;
 	}
 
@@ -291,7 +291,7 @@
 	size = SDLTest_GenerateUnsignedBoundaryValues(maxValue,
 				(Uint64) boundary1, (Uint64) boundary2,
 				validDomain, buffer);
-	if(size == 0) {
+	if (buffer == NULL || size == 0) {
 		return 0;
 	}
 
@@ -319,7 +319,7 @@
 	size = SDLTest_GenerateUnsignedBoundaryValues(maxValue,
 				(Uint64) boundary1, (Uint64) boundary2,
 				validDomain, buffer);
-	if(size == 0) {
+	if (buffer == NULL || size == 0) {
 		return 0;
 	}
 
@@ -347,7 +347,7 @@
 	size = SDLTest_GenerateUnsignedBoundaryValues(maxValue,
 				(Uint64) boundary1, (Uint64) boundary2,
 				validDomain, buffer);
-	if(size == 0) {
+	if (buffer == NULL || size == 0) {
 		return 0;
 	}
 
@@ -467,7 +467,7 @@
 	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 @@
 	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 @@
 	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 @@
 	size = SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
 				(Sint64) boundary1, (Sint64) boundary2,
 				validDomain, buffer);
-	if(size == 0) {
+	if (buffer == NULL || size == 0) {
 		return LLONG_MIN;
 	}
 
--- a/src/test/SDL_test_log.c	Sat Dec 01 14:48:30 2012 -0800
+++ b/src/test/SDL_test_log.c	Sat Dec 01 23:30:53 2012 -0800
@@ -31,6 +31,8 @@
 #include "SDL_config.h"
 
 #include <stdarg.h> /* va_list */
+#include <stdio.h>
+#include <string.h>
 #include <time.h>
 
 #include "SDL_test.h"
--- a/test/automated/surface/surface.c	Sat Dec 01 14:48:30 2012 -0800
+++ b/test/automated/surface/surface.c	Sat Dec 01 23:30:53 2012 -0800
@@ -212,7 +212,7 @@
 /**
  * @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 @@
    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 @@
    SDL_Surface *face;
    int i, j, ni, nj;
    int mode;
+   SDL_BlendMode bMode;
 
    SDL_ATbegin( "Blit Blending Tests" );
 
@@ -353,11 +354,11 @@
 
          /* 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;