| 21 | |
| 22 | |
| 23 | int luaZ_fill (ZIO *z) { |
| 24 | size_t size; |
| 25 | lua_State *L = z->L; |
| 26 | const char *buff; |
| 27 | lua_unlock(L); |
| 28 | buff = z->reader(L, z->data, &size); |
| 29 | lua_lock(L); |
| 30 | if (buff == NULL || size == 0) |
| 31 | return EOZ; |
| 32 | z->n = size - 1; /* discount char being returned */ |
| 33 | z->p = buff; |
| 34 | return cast_uchar(*(z->p++)); |
| 35 | } |
| 36 | |
| 37 | |
| 38 | void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) { |