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 mipnum;
|
||||||
int face;
|
int face;
|
||||||
int datasize;
|
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;
|
struct pendingtextureinfo *mips;
|
||||||
int encoding = TF_INVALID;
|
int encoding = TF_INVALID;
|
||||||
const qbyte *fileend = filedata + filesize;
|
const qbyte *fileend = filedata + filesize;
|
||||||
|
@ -4984,8 +4984,8 @@ static struct pendingtextureinfo *Image_ReadKTXFile(unsigned int flags, const ch
|
||||||
header = *(const ktxheader_t*)filedata;
|
header = *(const ktxheader_t*)filedata;
|
||||||
if (header.endianness == 0x01020304)
|
if (header.endianness == 0x01020304)
|
||||||
{ //swap the rest of the header.
|
{ //swap the rest of the header.
|
||||||
for (w = offsetof(ktxheader_t, endianness); w < sizeof(ktxheader_t); w+=sizeof(int))
|
for (swap = &header.endianness; swap < (unsigned int*)(&header+1); swap++)
|
||||||
((int*)&header)[w/sizeof(int)] = LongSwap(((int*)&header)[w/sizeof(int)]);
|
*swap = LongSwap(*swap);
|
||||||
}
|
}
|
||||||
else if (header.endianness != 0x04030201)
|
else if (header.endianness != 0x04030201)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in a new issue