From b6038a5d9ca657d520988dd1dacbff532e04105e Mon Sep 17 00:00:00 2001 From: Andreas Schiffler Date: Wed, 15 Sep 2010 22:15:47 -0700 Subject: [PATCH] - added directx include path to VS2008 solution - updated shape vcproj and add it to VS2008 solution - minor changes (i.e. typecasting) to get rid of compiler warnings in VS --- VisualC/SDL/SDL_VS2008.vcproj | 2 +- VisualC/SDL_VS2008.sln | 12 ++++++++++++ VisualC/tests/testshape/testshape.vcproj | 15 +++++++-------- src/audio/SDL_audio.c | 2 +- test/automated/rwops/TestSupportRWops_Generic.c | 4 ++++ test/graywin.c | 2 +- test/testdraw2.c | 2 +- test/testfile.c | 3 +++ test/testgl.c | 2 +- test/testoverlay.c | 16 ++++++++-------- test/testoverlay2.c | 12 ++++++------ test/testsprite.c | 6 +++--- test/testsprite2.c | 3 ++- 13 files changed, 50 insertions(+), 31 deletions(-) diff --git a/VisualC/SDL/SDL_VS2008.vcproj b/VisualC/SDL/SDL_VS2008.vcproj index 898da7c28..3951aa69b 100644 --- a/VisualC/SDL/SDL_VS2008.vcproj +++ b/VisualC/SDL/SDL_VS2008.vcproj @@ -52,7 +52,7 @@ - @@ -169,6 +169,8 @@ GenerateDebugInformation="true" ProgramDatabaseFile=".\Debug/testshape.pdb" SubSystem="2" + RandomizedBaseAddress="1" + DataExecutionPrevention="0" /> - diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index 1261926f4..b55fee325 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -339,7 +339,7 @@ SDL_RunAudio(void *devicep) /* For streaming when the buffer sizes don't match up */ Uint8 *istream; - int istream_len; + int istream_len = 0; /* Perform any thread setup */ device->threadid = SDL_ThreadID(); diff --git a/test/automated/rwops/TestSupportRWops_Generic.c b/test/automated/rwops/TestSupportRWops_Generic.c index 32d76470d..969e0612c 100644 --- a/test/automated/rwops/TestSupportRWops_Generic.c +++ b/test/automated/rwops/TestSupportRWops_Generic.c @@ -1,6 +1,10 @@ /* Generic implementation for file opening routines. * Customizations for specific platforms should go in alternative files. */ + +// quiet win32 compiler warnings +#define _CRT_SECURE_NO_WARNINGS + #include #include "SDL.h" diff --git a/test/graywin.c b/test/graywin.c index 8872f82c9..75a99e5d8 100644 --- a/test/graywin.c +++ b/test/graywin.c @@ -25,7 +25,7 @@ DrawBox(SDL_Surface * screen, int X, int Y, int width, int height) /* Seed the random number generator */ if (seeded == 0) { - srand(time(NULL)); + srand((unsigned int)time(NULL)); seeded = 1; } diff --git a/test/testdraw2.c b/test/testdraw2.c index 437397a0e..d4755be69 100644 --- a/test/testdraw2.c +++ b/test/testdraw2.c @@ -234,7 +234,7 @@ main(int argc, char *argv[]) SDL_RenderClear(); } - srand(time(NULL)); + srand((unsigned int)time(NULL)); /* Main render loop */ frames = 0; diff --git a/test/testfile.c b/test/testfile.c index 424429353..0480e9f9b 100644 --- a/test/testfile.c +++ b/test/testfile.c @@ -1,6 +1,9 @@ /* sanity tests on SDL_rwops.c (usefull for alternative implementations of stdio rwops) */ +// quiet win32 compiler warnings +#define _CRT_NONSTDC_NO_WARNINGS + #include #ifndef _MSC_VER diff --git a/test/testgl.c b/test/testgl.c index ccdf48584..dd315e869 100644 --- a/test/testgl.c +++ b/test/testgl.c @@ -654,7 +654,7 @@ RunGLTest(int argc, char *argv[], fprintf(stderr, "testgl: OpenGL error: %d\n", gl_error); } - sdl_error = SDL_GetError(); + sdl_error = (char *)SDL_GetError(); if (sdl_error[0] != '\0') { fprintf(stderr, "testgl: SDL error '%s'\n", sdl_error); diff --git a/test/testoverlay.c b/test/testoverlay.c index bc0ad4066..8613970be 100644 --- a/test/testoverlay.c +++ b/test/testoverlay.c @@ -38,23 +38,23 @@ RGBtoYUV(Uint8 * rgb, int *yuv, int monochrome, int luminance) { if (monochrome) { #if 1 /* these are the two formulas that I found on the FourCC site... */ - yuv[0] = 0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]; + yuv[0] = (int)(0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]); yuv[1] = 128; yuv[2] = 128; #else - yuv[0] = (0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16; + yuv[0] = (int)((0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16); yuv[1] = 128; yuv[2] = 128; #endif } else { #if 1 /* these are the two formulas that I found on the FourCC site... */ - yuv[0] = 0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]; - yuv[1] = (rgb[2] - yuv[0]) * 0.565 + 128; - yuv[2] = (rgb[0] - yuv[0]) * 0.713 + 128; + yuv[0] = (int)(0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]); + yuv[1] = (int)((rgb[2] - yuv[0]) * 0.565 + 128); + yuv[2] = (int)((rgb[0] - yuv[0]) * 0.713 + 128); #else - yuv[0] = (0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16; - yuv[1] = 128 - (0.148 * rgb[0]) - (0.291 * rgb[1]) + (0.439 * rgb[2]); - yuv[2] = 128 + (0.439 * rgb[0]) - (0.368 * rgb[1]) - (0.071 * rgb[2]); + yuv[0] = (int)((0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16); + yuv[1] = (int)(128 - (0.148 * rgb[0]) - (0.291 * rgb[1]) + (0.439 * rgb[2])); + yuv[2] = (int)(128 + (0.439 * rgb[0]) - (0.368 * rgb[1]) - (0.071 * rgb[2])); #endif } diff --git a/test/testoverlay2.c b/test/testoverlay2.c index 33b5f1ce6..9db55335a 100644 --- a/test/testoverlay2.c +++ b/test/testoverlay2.c @@ -144,19 +144,19 @@ RGBtoYUV(Uint8 * rgb, int *yuv, int monochrome, int luminance) { if (monochrome) { #if 1 /* these are the two formulas that I found on the FourCC site... */ - yuv[0] = 0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]; + yuv[0] = (int)(0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]); yuv[1] = 128; yuv[2] = 128; #else - yuv[0] = (0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16; + yuv[0] = (int)(0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16; yuv[1] = 128; yuv[2] = 128; #endif } else { #if 1 /* these are the two formulas that I found on the FourCC site... */ - yuv[0] = 0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]; - yuv[1] = (rgb[2] - yuv[0]) * 0.565 + 128; - yuv[2] = (rgb[0] - yuv[0]) * 0.713 + 128; + yuv[0] = (int)(0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]); + yuv[1] = (int)((rgb[2] - yuv[0]) * 0.565 + 128); + yuv[2] = (int)((rgb[0] - yuv[0]) * 0.713 + 128); #else yuv[0] = (0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16; yuv[1] = 128 - (0.148 * rgb[0]) - (0.291 * rgb[1]) + (0.439 * rgb[2]); @@ -606,7 +606,7 @@ main(int argc, char **argv) } if ((!paused) || (resized)) { - if (((SDL_GetTicks() - lastftick) > fpsdelay) || (resized)) { + if (((SDL_GetTicks() - lastftick) > (Uint32)fpsdelay) || (resized)) { lastftick = SDL_GetTicks(); switch (overlay_format) { diff --git a/test/testsprite.c b/test/testsprite.c index 6a740724b..f9008fd79 100644 --- a/test/testsprite.c +++ b/test/testsprite.c @@ -100,7 +100,7 @@ MoveSprites(SDL_Surface * screen, Uint32 background) Uint32 color = SDL_MapRGB(screen->format, 255, 0, 0); SDL_Rect r; r.x = - (sin((float) t * 2 * 3.1459) + 1.0) / 2.0 * (screen->w - 20); + (int)((sin((float) t * 2 * 3.1459) + 1.0) / 2.0 * (screen->w - 20)); r.y = 0; r.w = 20; r.h = screen->h; @@ -141,7 +141,7 @@ FastestFlags(Uint32 flags, int width, int height, int bpp) /* Direct hardware blitting without double-buffering causes really bad flickering. */ - if (info->video_mem * 1024 > (height * width * bpp / 8)) { + if (info->video_mem * 1024 > (Uint32)(height * width * bpp / 8)) { flags |= SDL_DOUBLEBUF; } else { flags &= ~SDL_HWSURFACE; @@ -236,7 +236,7 @@ main(int argc, char *argv[]) sprite_rects += numsprites; sprite_w = sprite->w; sprite_h = sprite->h; - srand(time(NULL)); + srand((unsigned int)time(NULL)); for (i = 0; i < numsprites; ++i) { positions[i].x = rand() % (screen->w - sprite_w); positions[i].y = rand() % (screen->h - sprite_h); diff --git a/test/testsprite2.c b/test/testsprite2.c index 10c201fe4..cc38c4520 100644 --- a/test/testsprite2.c +++ b/test/testsprite2.c @@ -315,7 +315,7 @@ main(int argc, char *argv[]) fprintf(stderr, "Out of memory!\n"); quit(2); } - srand(time(NULL)); + srand((unsigned int)time(NULL)); if (scaleMode != SDL_TEXTURESCALEMODE_NONE) { sprite_w += sprite_w / 2; sprite_h += sprite_h / 2; @@ -368,6 +368,7 @@ main(int argc, char *argv[]) printf("%2.2f frames per second\n", fps); } quit(0); + return 0; } /* vi: set ts=4 sw=4 expandtab: */