MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / luaZ_read

Function luaZ_read

extlibs/lua/src/lzio.c:48–67  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

Callers 1

loadBlockFunction · 0.85

Calls 1

luaZ_fillFunction · 0.85

Tested by

no test coverage detected