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

Function gz_skip

extlibs/minizip/src/gzread.c:287–318  ·  view source on GitHub ↗

Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */

(state, len)

Source from the content-addressed store, hash-verified

285
286/* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */
287local int gz_skip(state, len)
288gz_statep state;
289z_off64_t len;
290{
291 unsigned n;
292
293 /* skip over len bytes or reach end-of-file, whichever comes first */
294 while (len)
295 /* skip over whatever is in output buffer */
296 if (state->x.have)
297 {
298 n = GT_OFF(state->x.have) || (z_off64_t)state->x.have > len ?
299 (unsigned)len : state->x.have;
300 state->x.have -= n;
301 state->x.next += n;
302 state->x.pos += n;
303 len -= n;
304 }
305
306 /* output buffer empty -- return if we're at the end of the input */
307 else if (state->eof && state->strm.avail_in == 0)
308 break;
309
310 /* need more data to skip -- load up output buffer */
311 else
312 {
313 /* get more output, looking for header if required */
314 if (gz_fetch(state) == -1)
315 return -1;
316 }
317 return 0;
318}
319
320/* Read len bytes into buf from file, or less than len up to the end of the
321 input. Return the number of bytes read. If zero is returned, either the

Callers 3

gz_readFunction · 0.85
gzungetcFunction · 0.85
gzread.cFile · 0.85

Calls 1

gz_fetchFunction · 0.85

Tested by

no test coverage detected