Beispiel #1
0
static void LoadHeader(LoadState* S)
{
 char h[LUAC_HEADERSIZE];
 char s[LUAC_HEADERSIZE];
 luaU_header(h);
 LoadBlock(S,s,LUAC_HEADERSIZE);
 IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, "bad header");
}
Beispiel #2
0
static void LoadHeader(LoadState* S)
{
 char h[LUAC_HEADERSIZE];
 char s[LUAC_HEADERSIZE];
 luaU_header(h, '=');
 LoadBlock(S,s,LUAC_HEADERSIZE);
 S->swap=(s[6]!=h[6]); s[6]=h[6];
 IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, "bad header");
}
Beispiel #3
0
static void LoadHeader(LoadState* S)
{
 char h[LUAC_HEADERSIZE];
 char s[LUAC_HEADERSIZE];
 luaU_header(h);
 if ( h[8] > SIZE_T_PRECOMPILED_CHUNK )
    h[8] = SIZE_T_PRECOMPILED_CHUNK;
 LoadBlock(S,s,LUAC_HEADERSIZE);
 IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, "bad header");
}
Beispiel #4
0
static void LoadHeader(LoadState* S)
{
 char h[LUAC_HEADERSIZE];
 char s[LUAC_HEADERSIZE];
 luaU_header(h);
 LoadBlock(S,s,LUAC_HEADERSIZE);
 S->flip = h[ENDIAN_OFFSET] != s[ENDIAN_OFFSET];
 s[ENDIAN_OFFSET] = h[ENDIAN_OFFSET];
 IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, "bad header");
}
Beispiel #5
0
static void LoadHeader(LoadState* S)
{
 char h[LUAC_HEADERSIZE];
 char s[LUAC_HEADERSIZE];
 luaU_header(h);
 LoadBlock(S,s,LUAC_HEADERSIZE);
#ifdef LUAC_SWAP_ON_LOAD
 S->swap=(s[6]!=h[6]); s[6]=h[6];
#endif
 IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, "bad header");
}
static void LoadHeader(LoadState* S)
{
 char h[LUAC_HEADERSIZE];
 char s[LUAC_HEADERSIZE];
 luaU_header(h);
 LoadBlock(S,s,LUAC_HEADERSIZE);
 if (memcmp(h,s,N0)==0) return;
 if (memcmp(h,s,N1)!=0) error(S,"not a");
 if (memcmp(h,s,N2)!=0) error(S,"version mismatch in");
 if (memcmp(h,s,N3)!=0) error(S,"incompatible"); else error(S,"corrupted");
}
Beispiel #7
0
static void LoadHeader(LoadState* S)
{
 lu_byte h[LUAC_HEADERSIZE];
 lu_byte s[LUAC_HEADERSIZE];
 luaU_header(h);
 memcpy(s,h,sizeof(char));			/* first char already read */
 LoadBlock(S,s+sizeof(char),LUAC_HEADERSIZE-sizeof(char));
 if (memcmp(h,s,N0)==0) return;
 if (memcmp(h,s,N1)!=0) error(S,"not a");
 if (memcmp(h,s,N2)!=0) error(S,"version mismatch in");
 if (memcmp(h,s,N3)!=0) error(S,"incompatible"); else error(S,"corrupted");
}
Beispiel #8
0
static void LoadHeader(LoadState* S)
{
 char h[LUAC_HEADERSIZE];
 char s[LUAC_HEADERSIZE];
 int intck = (((lua_Number)0.5)==0); /* 0=float, 1=int */
 luaU_header(h);
 LoadBlock(S,s,LUAC_HEADERSIZE);
 S->swap=(s[6]!=h[6]); s[6]=h[6]; /* Check if byte-swapping is needed  */
 S->numsize=h[10]=s[10]; /* length of lua_Number */
 S->toflt=(s[11]>intck); /* check if conversion from int lua_Number to flt is needed */
 if(S->toflt) s[11]=h[11];
 IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, "bad header");
}
Beispiel #9
0
static void LoadHeader(LoadState* S)
{
 char h[LUAC_HEADERSIZE];
 char s[LUAC_HEADERSIZE];

 LuaDumpConfig config;
 config.endianness = (luaU_getHostOrder() == WWS_LUA_LITTLE_ENDIAN) ? 1 : 0;
 config.sizeof_int = sizeof(int);
 config.sizeof_size_t = sizeof(size_t);
 config.sizeof_lua_Number = sizeof(lua_Number);

 luaU_header(h, &config);
 LoadBlock(S,s,LUAC_HEADERSIZE);
 IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, "bad header");
}
Beispiel #10
0
static void DumpHeader(DumpState* D)
{
    char h[LUAC_HEADERSIZE];
    luaU_header(h);
    DumpBlock(h,LUAC_HEADERSIZE,D);
}