1 When loading a file, Lua may call the reader function again after it returned end of input.
3 Fetch from: http://www.lua.org/bugs.html#5.1.5-2
5 Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
8 ===================================================================
15 + if (z->eoz) return EOZ;
17 buff = z->reader(L, z->data, &size);
19 - if (buff == NULL || size == 0) return EOZ;
20 + if (buff == NULL || size == 0) {
21 + z->eoz = 1; /* avoid calling reader function next time */
26 return char2int(*(z->p++));
36 ===================================================================
41 void* data; /* additional data */
42 lua_State *L; /* Lua state (for reader) */
43 + int eoz; /* true if reader has no more data */