MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / luaZ_read

Function luaZ_read

third-party/lua-5.2.4/src/lzio.c:46–65  ·  view source on GitHub ↗

--------------------------------------------------------------- read --- */

Source from the content-addressed store, hash-verified

44
45/* --------------------------------------------------------------- read --- */
46size_t luaZ_read (ZIO *z, void *b, size_t n) {
47 while (n) {
48 size_t m;
49 if (z->n == 0) { /* no bytes in buffer? */
50 if (luaZ_fill(z) == EOZ) /* try to read more */
51 return n; /* no more input; return number of missing bytes */
52 else {
53 z->n++; /* luaZ_fill consumed first byte; put it back */
54 z->p--;
55 }
56 }
57 m = (n <= z->n) ? n : z->n; /* min. between n and z->n */
58 memcpy(b, z->p, m);
59 z->n -= m;
60 z->p += m;
61 b = (char *)b + m;
62 n -= m;
63 }
64 return 0;
65}
66
67/* ------------------------------------------------------------------------ */
68char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n) {

Callers 1

LoadBlockFunction · 0.70

Calls 1

luaZ_fillFunction · 0.70

Tested by

no test coverage detected