diff --git a/dxx-changelog.txt b/dxx-changelog.txt index f01dbb89b..580b1fa67 100755 --- a/dxx-changelog.txt +++ b/dxx-changelog.txt @@ -3,6 +3,7 @@ D1X-Rebirth Changelog 20070207 -------- main/game.c: expanded help menu and fixed d1x help +iff/iff.c: amd64 fixes 20070206 -------- diff --git a/iff/iff.c b/iff/iff.c index 5c7176a48..fda8055c5 100755 --- a/iff/iff.c +++ b/iff/iff.c @@ -232,7 +232,7 @@ typedef struct fake_file { int length; } FFILE; -#define MAKE_SIG(a,b,c,d) (((long)(a)<<24)+((long)(b)<<16)+((c)<<8)+(d)) +#define MAKE_SIG(a,b,c,d) (((int32_t)(a)<<24)+((int32_t)(b)<<16)+((c)<<8)+(d)) #define form_sig MAKE_SIG('F','O','R','M') #define ilbm_sig MAKE_SIG('I','L','B','M') @@ -246,7 +246,7 @@ typedef struct fake_file { #define dlta_sig MAKE_SIG('D','L','T','A') #ifndef NDEBUG -//void printsig(long s) +//void printsig(int32_t s) //{ // char *t=(char *) &s; // @@ -255,8 +255,7 @@ typedef struct fake_file { //} #endif -#if 0 // adb: triggers bug in gcc 2.8.0/2.8.1 -long get_sig(FFILE *f) +int32_t get_sig(FFILE *f) { char s[4]; @@ -265,6 +264,7 @@ long get_sig(FFILE *f) // if ((s[1]=cfgetc(f))==EOF) return(EOF); // if ((s[0]=cfgetc(f))==EOF) return(EOF); +#ifndef WORDS_BIGENDIAN if (f->position>=f->length) return EOF; s[3] = f->data[f->position++]; if (f->position>=f->length) return EOF; @@ -273,12 +273,22 @@ long get_sig(FFILE *f) s[1] = f->data[f->position++]; if (f->position>=f->length) return EOF; s[0] = f->data[f->position++]; - - return(*((long *) s)); -} +#else + if (f->position>=f->length) return EOF; + s[0] = f->data[f->position++]; + if (f->position>=f->length) return EOF; + s[1] = f->data[f->position++]; + if (f->position>=f->length) return EOF; + s[2] = f->data[f->position++]; + if (f->position>=f->length) return EOF; + s[3] = f->data[f->position++]; #endif -int put_sig(long sig,FILE *f) + return(*((int32_t *) s)); +} + + +int put_sig(int32_t sig,FILE *f) { char *s = (char *) &sig;