From: kramm Date: Wed, 9 Jan 2002 11:20:13 +0000 (+0000) Subject: big endian fixes. X-Git-Tag: release-0-2-2~51 X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=commitdiff_plain;h=6fdc94bc2b31b689c508e83d80a1ece74be1e474;hp=14581c9e70e3050a01b464407dddd6e028e94572 big endian fixes. --- diff --git a/src/swfextract.c b/src/swfextract.c index 1e1f204..62b6168 100644 --- a/src/swfextract.c +++ b/src/swfextract.c @@ -152,9 +152,9 @@ char * tagused; void idcallback(void*data) { - if(!(used[*(U16*)data]&1)) { + if(!(used[SWAP16(*(U16*)data)]&1)) { changed = 1; - used[*(U16*)data] |= 1; + used[SWAP16(*(U16*)data)] |= 1; } } @@ -395,7 +395,7 @@ void handlejpeg(TAG*tag) { char name[80]; FILE*fi; - sprintf(name, "pic%d.jpeg", *(U16*)tag->data); + sprintf(name, "pic%d.jpeg", SWAP16(*(U16*)tag->data)); /* swf jpeg images have two streams, which both start with ff d8 and end with ff d9. The following code handles sorting the middle bytes out, so that one stream remains */ @@ -417,7 +417,7 @@ void handlejpeg(TAG*tag) fclose(fi); } if(tag->id == ST_DEFINEBITSJPEG3 && tag->len>6) { - U32 end = *(U32*)&tag->data[2]+6; + U32 end = SWAP32(*(U32*)&tag->data[2])+6; int pos = findjpegboundary(&tag->data[6], tag->len-6); if(pos<0) return;