changeset 1615:d5298e8f22b3

Ugh, more 64-bit cleanup
author Sam Lantinga <slouken@libsdl.org>
date Fri, 31 Mar 2006 06:27:47 +0000
parents 6162b8d921ce
children 9f836cec0521
files test/testplatform.c test/testsem.c test/testtimer.c test/torturethread.c
diffstat 4 files changed, 13 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/test/testplatform.c	Fri Mar 31 06:16:20 2006 +0000
+++ b/test/testplatform.c	Fri Mar 31 06:27:47 2006 +0000
@@ -21,26 +21,26 @@
 
 	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 @@
 	}
 #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 ) {
--- a/test/testsem.c	Fri Mar 31 06:16:20 2006 +0000
+++ b/test/testsem.c	Fri Mar 31 06:27:47 2006 +0000
@@ -15,7 +15,7 @@
 
 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));
--- a/test/testtimer.c	Fri Mar 31 06:16:20 2006 +0000
+++ b/test/testtimer.c	Fri Mar 31 06:27:47 2006 +0000
@@ -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 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;
 }
 
--- a/test/torturethread.c	Fri Mar 31 06:16:20 2006 +0000
+++ b/test/torturethread.c	Fri Mar 31 06:27:47 2006 +0000
@@ -31,7 +31,7 @@
 	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 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 @@
 	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,