MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / checkHeader

Function checkHeader

3rd/lua-5.4.3/src/lundump.c:290–305  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288#define checksize(S,t) fchecksize(S,sizeof(t),#t)
289
290static void checkHeader (LoadState *S) {
291 /* skip 1st char (already read and checked) */
292 checkliteral(S, &LUA_SIGNATURE[1], "not a binary chunk");
293 if (loadByte(S) != LUAC_VERSION)
294 error(S, "version mismatch");
295 if (loadByte(S) != LUAC_FORMAT)
296 error(S, "format mismatch");
297 checkliteral(S, LUAC_DATA, "corrupted chunk");
298 checksize(S, Instruction);
299 checksize(S, lua_Integer);
300 checksize(S, lua_Number);
301 if (loadInteger(S) != LUAC_INT)
302 error(S, "integer format mismatch");
303 if (loadNumber(S) != LUAC_NUM)
304 error(S, "float format mismatch");
305}
306
307
308/*

Callers 1

luaU_undumpFunction · 0.85

Calls 5

checkliteralFunction · 0.85
loadByteFunction · 0.85
loadIntegerFunction · 0.85
loadNumberFunction · 0.85
errorFunction · 0.70

Tested by

no test coverage detected