Emscripten is too lame to support c89's offsetof macro.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5593 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
630678f6e3
commit
b4de288ca7
1 changed files with 3 additions and 3 deletions
|
@ -4971,7 +4971,7 @@ static struct pendingtextureinfo *Image_ReadKTXFile(unsigned int flags, const ch
|
|||
int mipnum;
|
||||
int face;
|
||||
int datasize;
|
||||
unsigned int w, h, d, f, l, browbytes,padbytes,y,x,rows;
|
||||
unsigned int *swap, w, h, d, f, l, browbytes,padbytes,y,x,rows;
|
||||
struct pendingtextureinfo *mips;
|
||||
int encoding = TF_INVALID;
|
||||
const qbyte *fileend = filedata + filesize;
|
||||
|
@ -4984,8 +4984,8 @@ static struct pendingtextureinfo *Image_ReadKTXFile(unsigned int flags, const ch
|
|||
header = *(const ktxheader_t*)filedata;
|
||||
if (header.endianness == 0x01020304)
|
||||
{ //swap the rest of the header.
|
||||
for (w = offsetof(ktxheader_t, endianness); w < sizeof(ktxheader_t); w+=sizeof(int))
|
||||
((int*)&header)[w/sizeof(int)] = LongSwap(((int*)&header)[w/sizeof(int)]);
|
||||
for (swap = &header.endianness; swap < (unsigned int*)(&header+1); swap++)
|
||||
*swap = LongSwap(*swap);
|
||||
}
|
||||
else if (header.endianness != 0x04030201)
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in a new issue