Skip to content

Commit

Permalink
Ugh, more 64-bit cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Mar 31, 2006
1 parent ab73d84 commit 9a768f5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
12 changes: 8 additions & 4 deletions test/testplatform.c
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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 ) {
Expand Down
2 changes: 1 addition & 1 deletion test/testsem.c
Expand Up @@ -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));
Expand Down
9 changes: 1 addition & 8 deletions test/testtimer.c
Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down
6 changes: 3 additions & 3 deletions test/torturethread.c
Expand Up @@ -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);

Expand Down Expand Up @@ -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 ) {
Expand All @@ -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,
Expand Down

0 comments on commit 9a768f5

Please sign in to comment.