MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / checkHeader

Function checkHeader

lib/lua/src/lundump.c:292–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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