Ugh, more 64-bit cleanup
authorSam Lantinga <slouken@libsdl.org>
Fri, 31 Mar 2006 06:27:47 +0000
changeset 1615d5298e8f22b3
parent 1614 6162b8d921ce
child 1616 9f836cec0521
Ugh, more 64-bit cleanup
test/testplatform.c
test/testsem.c
test/testtimer.c
test/torturethread.c
     1.1 --- a/test/testplatform.c	Fri Mar 31 06:16:20 2006 +0000
     1.2 +++ b/test/testplatform.c	Fri Mar 31 06:27:47 2006 +0000
     1.3 @@ -21,26 +21,26 @@
     1.4  
     1.5  	if ( badsize(sizeof(Uint8), 1) ) {
     1.6  		if ( verbose )
     1.7 -			printf("sizeof(Uint8) != 1, instead = %d\n",
     1.8 +			printf("sizeof(Uint8) != 1, instead = %ul\n",
     1.9  								sizeof(Uint8));
    1.10  		++error;
    1.11  	}
    1.12  	if ( badsize(sizeof(Uint16), 2) ) {
    1.13  		if ( verbose )
    1.14 -			printf("sizeof(Uint16) != 2, instead = %d\n",
    1.15 +			printf("sizeof(Uint16) != 2, instead = %ul\n",
    1.16  								sizeof(Uint16));
    1.17  		++error;
    1.18  	}
    1.19  	if ( badsize(sizeof(Uint32), 4) ) {
    1.20  		if ( verbose )
    1.21 -			printf("sizeof(Uint32) != 4, instead = %d\n",
    1.22 +			printf("sizeof(Uint32) != 4, instead = %ul\n",
    1.23  								sizeof(Uint32));
    1.24  		++error;
    1.25  	}
    1.26  #ifdef SDL_HAS_64BIT_TYPE
    1.27  	if ( badsize(sizeof(Uint64), 8) ) {
    1.28  		if ( verbose )
    1.29 -			printf("sizeof(Uint64) != 8, instead = %d\n",
    1.30 +			printf("sizeof(Uint64) != 8, instead = %ul\n",
    1.31  								sizeof(Uint64));
    1.32  		++error;
    1.33  	}
    1.34 @@ -110,7 +110,11 @@
    1.35  	}
    1.36  #ifdef SDL_HAS_64BIT_TYPE
    1.37  	if ( verbose ) {
    1.38 +#ifdef _MSC_VER
    1.39 +		printf("Value 64 = 0x%I64X, swapped = 0x%I64X\n", value64, SDL_Swap64(value64));
    1.40 +#else
    1.41  		printf("Value 64 = 0x%llX, swapped = 0x%llX\n", value64, SDL_Swap64(value64));
    1.42 +#endif
    1.43  	}
    1.44  	if ( SDL_Swap64(value64) != swapped64 ) {
    1.45  		if ( verbose ) {
     2.1 --- a/test/testsem.c	Fri Mar 31 06:16:20 2006 +0000
     2.2 +++ b/test/testsem.c	Fri Mar 31 06:27:47 2006 +0000
     2.3 @@ -15,7 +15,7 @@
     2.4  
     2.5  int ThreadFunc(void *data)
     2.6  {
     2.7 -	uintptr_t threadnum = (uintptr_t)data;
     2.8 +	int threadnum = (int)(uintptr_t)data;
     2.9  	while ( alive ) {
    2.10  		SDL_SemWait(sem);
    2.11  		fprintf(stderr, "Thread number %d has got the semaphore (value = %d)!\n", threadnum, SDL_SemValue(sem));
     3.1 --- a/test/testtimer.c	Fri Mar 31 06:16:20 2006 +0000
     3.2 +++ b/test/testtimer.c	Fri Mar 31 06:27:47 2006 +0000
     3.3 @@ -12,13 +12,6 @@
     3.4  
     3.5  static int ticks = 0;
     3.6  
     3.7 -/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
     3.8 -static void quit(int rc)
     3.9 -{
    3.10 -	SDL_Quit();
    3.11 -	exit(rc);
    3.12 -}
    3.13 -
    3.14  static Uint32 ticktock(Uint32 interval)
    3.15  {
    3.16  	++ticks;
    3.17 @@ -27,7 +20,7 @@
    3.18  
    3.19  static Uint32 callback(Uint32 interval, void *param)
    3.20  {
    3.21 -  printf("Timer %d : param = %d\n", interval, (uintptr_t)param);
    3.22 +  printf("Timer %d : param = %d\n", interval, (int)(uintptr_t)param);
    3.23    return interval;
    3.24  }
    3.25  
     4.1 --- a/test/torturethread.c	Fri Mar 31 06:16:20 2006 +0000
     4.2 +++ b/test/torturethread.c	Fri Mar 31 06:27:47 2006 +0000
     4.3 @@ -31,7 +31,7 @@
     4.4  	SDL_Thread *sub_threads[NUMTHREADS];
     4.5  	int flags[NUMTHREADS];
     4.6  	int i;
     4.7 -	uintptr_t tid = (uintptr_t)data;
     4.8 +	int tid = (int)(uintptr_t)data;
     4.9  
    4.10  	fprintf(stderr, "Creating Thread %d\n", tid);
    4.11  
    4.12 @@ -59,7 +59,7 @@
    4.13  int main(int argc, char *argv[])
    4.14  {
    4.15  	SDL_Thread *threads[NUMTHREADS];
    4.16 -	uintptr_t i;
    4.17 +	int i;
    4.18  
    4.19  	/* Load the SDL library */
    4.20  	if ( SDL_Init(0) < 0 ) {
    4.21 @@ -70,7 +70,7 @@
    4.22  	signal(SIGSEGV, SIG_DFL);
    4.23  	for(i = 0; i < NUMTHREADS; i++) {
    4.24  		time_for_threads_to_die[i] = 0;
    4.25 -		threads[i] = SDL_CreateThread(ThreadFunc, (void *) i);
    4.26 +		threads[i] = SDL_CreateThread(ThreadFunc, (void *)(uintptr_t)i);
    4.27  	
    4.28  		if ( threads[i] == NULL ) {
    4.29  			fprintf(stderr,