More fixes to compile under Visual C++
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404223
This commit is contained in:
parent
ccfc72055c
commit
224c8b5bec
6 changed files with 52 additions and 14 deletions
|
@ -242,7 +242,7 @@ int SDL_ATvassert( int condition, const char *msg, ... )
|
|||
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 );
|
||||
|
@ -281,6 +281,31 @@ int SDL_ATprintErr( const char *msg, ... )
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @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.
|
||||
*/
|
||||
|
|
|
@ -136,8 +136,7 @@ int SDL_ATprintErr( const char *msg, ... );
|
|||
* @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.
|
||||
*
|
||||
|
|
|
@ -42,7 +42,7 @@ int surface_compare( SDL_Surface *sur, const SurfaceImage_t *img, int allowable_
|
|||
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 @@ int surface_compare( SDL_Surface *sur, const SurfaceImage_t *img, int allowable_
|
|||
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];
|
||||
|
|
|
@ -55,8 +55,6 @@ static int render_testBlitBlend (void);
|
|||
*/
|
||||
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 @@ int test_render (void)
|
|||
/*
|
||||
* 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 @@ int test_render (void)
|
|||
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 @@ int test_render (void)
|
|||
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 @@ int test_render (void)
|
|||
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 );
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ static int rwops_testGeneric( SDL_RWops *rw, int write )
|
|||
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. */
|
||||
|
|
|
@ -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 @@ static void parse_options( int argc, char *argv[] );
|
|||
/**
|
||||
* @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 @@ static void print_usage( const char *name )
|
|||
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 @@ static void parse_options( int argc, char *argv[] )
|
|||
}
|
||||
}
|
||||
#endif /* NO_GETOPT_LONG */
|
||||
#endif /* NO_GETOPT */
|
||||
|
||||
/**
|
||||
* @brief Main entry point.
|
||||
|
@ -283,7 +299,7 @@ int main( int argc, char *argv[] )
|
|||
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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue