Mercurial > sdl-ios-xcode
changeset 3482:78db4f7ae2f3
More fixes to compile under Visual C++
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 22 Nov 2009 07:00:26 +0000 |
parents | c32c53fca10d |
children | a54df8e52333 |
files | test/automated/SDL_at.c test/automated/SDL_at.h test/automated/common/common.c test/automated/render/render.c test/automated/rwops/rwops.c test/automated/testsdl.c |
diffstat | 6 files changed, 52 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/test/automated/SDL_at.c Sun Nov 22 06:42:58 2009 +0000 +++ b/test/automated/SDL_at.c Sun Nov 22 07:00:26 2009 +0000 @@ -242,7 +242,7 @@ if (!condition) { /* Get message. */ va_start( args, msg ); - vsnprintf( buf, sizeof(buf), msg, args ); + SDL_vsnprintf( buf, sizeof(buf), msg, args ); va_end( args ); /* Failed message. */ SDL_ATassertFailed( buf ); @@ -282,6 +282,31 @@ /** + * @brief Displays a message. + */ +int SDL_ATprint( const char *msg, ... ) +{ + va_list ap; + int ret; + + /* Only print if not quiet. */ + if (at_quiet) + return 0; + + /* Make sure there is something to print. */ + if (msg == NULL) + return 0; + else { + va_start(ap, msg); + ret = vfprintf( stdout, msg, ap ); + va_end(ap); + } + + return ret; +} + + +/** * @brief Displays a verbose message. */ int SDL_ATprintVerbose( int level, const char *msg, ... )
--- a/test/automated/SDL_at.h Sun Nov 22 06:42:58 2009 +0000 +++ b/test/automated/SDL_at.h Sun Nov 22 07:00:26 2009 +0000 @@ -136,8 +136,7 @@ * @param msg printf formatted string to display. * @return Number of character printed. */ -#define SDL_ATprint(msg, args...) \ - SDL_ATprintVerbose( 0, msg, ## args) +int SDL_ATprint( const char *msg, ... ); /** * @brief Prints some verbose text. *
--- a/test/automated/common/common.c Sun Nov 22 06:42:58 2009 +0000 +++ b/test/automated/common/common.c Sun Nov 22 07:00:26 2009 +0000 @@ -42,7 +42,7 @@ case 2: case 3: ret += 1; - printf("%d BPP not supported yet.\n",bpp); + /*printf("%d BPP not supported yet.\n",bpp);*/ break; case 4: @@ -86,9 +86,9 @@ if (bpp == 4) { for (j=0; j<sur->h; j++) { for (i=0; i<sur->w; i++) { + Uint8 R, G, B, A; p = (Uint8 *)sur->pixels + j * sur->pitch + i * bpp; pd = (Uint8 *)img->pixel_data + (j*img->width + i) * img->bytes_per_pixel; - Uint8 R, G, B, A; R = pd[0]; G = pd[1];
--- a/test/automated/render/render.c Sun Nov 22 06:42:58 2009 +0000 +++ b/test/automated/render/render.c Sun Nov 22 07:00:26 2009 +0000 @@ -55,8 +55,6 @@ */ static int render_compare( const char *msg, const SurfaceImage_t *s, int allowable_error ) { - (void) msg; - (void) s; int ret; Uint8 pix[4*80*60]; SDL_Surface *testsur; @@ -1005,7 +1003,7 @@ /* * Initialize testsuite. */ - snprintf( msg, sizeof(msg) , "Rendering with %s driver", driver ); + SDL_snprintf( msg, sizeof(msg) , "Rendering with %s driver", driver ); SDL_ATinit( msg ); /* @@ -1018,7 +1016,7 @@ goto err_cleanup; /* Check to see if it's the one we want. */ str = SDL_GetCurrentVideoDriver(); - if (SDL_ATassert( "SDL_GetCurrentVideoDriver", strcmp(driver,str)==0)) + if (SDL_ATassert( "SDL_GetCurrentVideoDriver", SDL_strcmp(driver,str)==0)) goto err_cleanup; /* Create window. */ wid = SDL_CreateWindow( msg, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, @@ -1027,7 +1025,7 @@ goto err_cleanup; /* Check title. */ str = SDL_GetWindowTitle( wid ); - if (SDL_ATassert( "SDL_GetWindowTitle", strcmp(msg,str)==0)) + if (SDL_ATassert( "SDL_GetWindowTitle", SDL_strcmp(msg,str)==0)) goto err_cleanup; /* Get renderers. */ nr = SDL_GetNumRenderDrivers(); @@ -1051,7 +1049,7 @@ goto err_cleanup; /* Set testcase name. */ - snprintf( msg, sizeof(msg), "Renderer %s", renderer.name ); + SDL_snprintf( msg, sizeof(msg), "Renderer %s", renderer.name ); SDL_ATprintVerbose( 1, " %d) %s\n", j+1, renderer.name ); SDL_ATbegin( msg );
--- a/test/automated/rwops/rwops.c Sun Nov 22 06:42:58 2009 +0000 +++ b/test/automated/rwops/rwops.c Sun Nov 22 07:00:26 2009 +0000 @@ -100,7 +100,7 @@ if (SDL_ATassert( "Reading with SDL_RWread", i == sizeof(hello_world)-1 )) return 1; if (SDL_ATassert( "Memory read does not match memory written", - memcmp( buf, hello_world, sizeof(hello_world)-1 ) == 0 )) + SDL_memcmp( buf, hello_world, sizeof(hello_world)-1 ) == 0 )) return 1; /* More seek tests. */
--- a/test/automated/testsdl.c Sun Nov 22 06:42:58 2009 +0000 +++ b/test/automated/testsdl.c Sun Nov 22 07:00:26 2009 +0000 @@ -16,17 +16,21 @@ #include "render/render.h" #include "audio/audio.h" +#if defined(WIN32) +#define NO_GETOPT +#endif #if defined(__QNXNTO__) #define NO_GETOPT_LONG 1 #endif /* __QNXNTO__ */ #include <stdio.h> /* printf */ #include <stdlib.h> /* exit */ +#ifndef NO_GETOPT #include <unistd.h> /* getopt */ -#include <string.h> /* strcmp */ #if !defined(NO_GETOPT_LONG) #include <getopt.h> /* getopt_long */ #endif /* !NO_GETOPT_LONG */ +#endif /* !NO_GETOPT */ /* @@ -51,6 +55,11 @@ /** * @brief Displays program usage. */ +#ifdef NO_GETOPT +static void print_usage( const char *name ) +{ +} +#else #if !defined(NO_GETOPT_LONG) static void print_usage( const char *name ) { @@ -84,10 +93,16 @@ printf(" -h, display this message and exit\n"); } #endif /* NO_GETOPT_LONG */ +#endif /* NO_GETOPT */ /** * @brief Handles the options. */ +#ifdef NO_GETOPT +static void parse_options( int argc, char *argv[] ) +{ +} +#else #if !defined(NO_GETOPT_LONG) static void parse_options( int argc, char *argv[] ) { @@ -239,6 +254,7 @@ } } #endif /* NO_GETOPT_LONG */ +#endif /* NO_GETOPT */ /** * @brief Main entry point. @@ -283,7 +299,7 @@ ver.major, ver.minor, ver.patch, rev ); SDL_ATprintErr( "System is running %s and is %s endian\n", SDL_GetPlatform(), -#ifdef SDL_LIL_ENDIAN +#if SDL_BYTEORDER == SDL_LIL_ENDIAN "little" #else "big"