From 9a768f57fba30855c4dffe0fcd0d36f76acd5354 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 31 Mar 2006 06:27:47 +0000 Subject: [PATCH] Ugh, more 64-bit cleanup --- test/testplatform.c | 12 ++++++++---- test/testsem.c | 2 +- test/testtimer.c | 9 +-------- test/torturethread.c | 6 +++--- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/test/testplatform.c b/test/testplatform.c index d67991b3b..5adca474f 100644 --- a/test/testplatform.c +++ b/test/testplatform.c @@ -21,26 +21,26 @@ int TestTypes(SDL_bool verbose) if ( badsize(sizeof(Uint8), 1) ) { if ( verbose ) - printf("sizeof(Uint8) != 1, instead = %d\n", + printf("sizeof(Uint8) != 1, instead = %ul\n", sizeof(Uint8)); ++error; } if ( badsize(sizeof(Uint16), 2) ) { if ( verbose ) - printf("sizeof(Uint16) != 2, instead = %d\n", + printf("sizeof(Uint16) != 2, instead = %ul\n", sizeof(Uint16)); ++error; } if ( badsize(sizeof(Uint32), 4) ) { if ( verbose ) - printf("sizeof(Uint32) != 4, instead = %d\n", + printf("sizeof(Uint32) != 4, instead = %ul\n", sizeof(Uint32)); ++error; } #ifdef SDL_HAS_64BIT_TYPE if ( badsize(sizeof(Uint64), 8) ) { if ( verbose ) - printf("sizeof(Uint64) != 8, instead = %d\n", + printf("sizeof(Uint64) != 8, instead = %ul\n", sizeof(Uint64)); ++error; } @@ -110,7 +110,11 @@ int TestEndian(SDL_bool verbose) } #ifdef SDL_HAS_64BIT_TYPE if ( verbose ) { +#ifdef _MSC_VER + printf("Value 64 = 0x%I64X, swapped = 0x%I64X\n", value64, SDL_Swap64(value64)); +#else printf("Value 64 = 0x%llX, swapped = 0x%llX\n", value64, SDL_Swap64(value64)); +#endif } if ( SDL_Swap64(value64) != swapped64 ) { if ( verbose ) { diff --git a/test/testsem.c b/test/testsem.c index f0a985991..699038985 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -15,7 +15,7 @@ int alive = 1; int ThreadFunc(void *data) { - uintptr_t threadnum = (uintptr_t)data; + int threadnum = (int)(uintptr_t)data; while ( alive ) { SDL_SemWait(sem); fprintf(stderr, "Thread number %d has got the semaphore (value = %d)!\n", threadnum, SDL_SemValue(sem)); diff --git a/test/testtimer.c b/test/testtimer.c index 10894d79d..b00577f38 100644 --- a/test/testtimer.c +++ b/test/testtimer.c @@ -12,13 +12,6 @@ static int ticks = 0; -/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ -static void quit(int rc) -{ - SDL_Quit(); - exit(rc); -} - static Uint32 ticktock(Uint32 interval) { ++ticks; @@ -27,7 +20,7 @@ static Uint32 ticktock(Uint32 interval) static Uint32 callback(Uint32 interval, void *param) { - printf("Timer %d : param = %d\n", interval, (uintptr_t)param); + printf("Timer %d : param = %d\n", interval, (int)(uintptr_t)param); return interval; } diff --git a/test/torturethread.c b/test/torturethread.c index d85b48f0e..997ae0b63 100644 --- a/test/torturethread.c +++ b/test/torturethread.c @@ -31,7 +31,7 @@ int ThreadFunc(void *data) { SDL_Thread *sub_threads[NUMTHREADS]; int flags[NUMTHREADS]; int i; - uintptr_t tid = (uintptr_t)data; + int tid = (int)(uintptr_t)data; fprintf(stderr, "Creating Thread %d\n", tid); @@ -59,7 +59,7 @@ int ThreadFunc(void *data) { int main(int argc, char *argv[]) { SDL_Thread *threads[NUMTHREADS]; - uintptr_t i; + int i; /* Load the SDL library */ if ( SDL_Init(0) < 0 ) { @@ -70,7 +70,7 @@ int main(int argc, char *argv[]) signal(SIGSEGV, SIG_DFL); for(i = 0; i < NUMTHREADS; i++) { time_for_threads_to_die[i] = 0; - threads[i] = SDL_CreateThread(ThreadFunc, (void *) i); + threads[i] = SDL_CreateThread(ThreadFunc, (void *)(uintptr_t)i); if ( threads[i] == NULL ) { fprintf(stderr,