3 @@ -67,12 +67,12 @@ static void DumpString(const TString* s,
5 if (s==NULL || getstr(s)==NULL)
13 - size_t size=s->tsv.len+1; /* include trailing '\0' */
14 + unsigned int size=s->tsv.len+1; /* include trailing '\0' */
16 DumpBlock(getstr(s),size,D);
20 @@ -25,6 +25,7 @@ typedef struct {
27 #ifdef LUAC_TRUST_BINARIES
28 @@ -40,7 +41,6 @@ static void error(LoadState* S, const ch
32 -#define LoadMem(S,b,n,size) LoadBlock(S,b,(n)*(size))
33 #define LoadByte(S) (lu_byte)LoadChar(S)
34 #define LoadVar(S,x) LoadMem(S,&x,1,sizeof(x))
35 #define LoadVector(S,b,n,size) LoadMem(S,b,n,size)
36 @@ -51,6 +51,49 @@ static void LoadBlock(LoadState* S, void
37 IF (r!=0, "unexpected end");
40 +static void LoadMem (LoadState* S, void* b, int n, size_t size)
42 + LoadBlock(S,b,n*size);
54 + c=p[0]; p[0]=p[1]; p[1]=c;
61 + c=p[0]; p[0]=p[3]; p[3]=c;
62 + c=p[1]; p[1]=p[2]; p[2]=c;
69 + c=p[0]; p[0]=p[7]; p[7]=c;
70 + c=p[1]; p[1]=p[6]; p[6]=c;
71 + c=p[2]; p[2]=p[5]; p[5]=c;
72 + c=p[3]; p[3]=p[4]; p[4]=c;
83 static int LoadChar(LoadState* S)
86 @@ -82,7 +125,7 @@ static lua_Integer LoadInteger(LoadState
88 static TString* LoadString(LoadState* S)
95 @@ -196,6 +239,7 @@ static void LoadHeader(LoadState* S)
96 char s[LUAC_HEADERSIZE];
98 LoadBlock(S,s,LUAC_HEADERSIZE);
99 + S->swap=(s[6]!=h[6]); s[6]=h[6];
100 IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, "bad header");
103 @@ -230,7 +274,7 @@ void luaU_header (char* h)
104 *h++=(char)LUAC_FORMAT;
105 *h++=(char)*(char*)&x; /* endianness */
106 *h++=(char)sizeof(int);
107 - *h++=(char)sizeof(size_t);
108 + *h++=(char)sizeof(unsigned int);
109 *h++=(char)sizeof(Instruction);
110 *h++=(char)sizeof(lua_Number);