MCPcopy Create free account
hub / github.com/F-Stack/f-stack / gz_skip

Function gz_skip

freebsd/contrib/zlib/gzread.c:262–291  ·  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

260
261/* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */
262local int gz_skip(state, len)
263 gz_statep state;
264 z_off64_t len;
265{
266 unsigned n;
267
268 /* skip over len bytes or reach end-of-file, whichever comes first */
269 while (len)
270 /* skip over whatever is in output buffer */
271 if (state->x.have) {
272 n = GT_OFF(state->x.have) || (z_off64_t)state->x.have > len ?
273 (unsigned)len : state->x.have;
274 state->x.have -= n;
275 state->x.next += n;
276 state->x.pos += n;
277 len -= n;
278 }
279
280 /* output buffer empty -- return if we're at the end of the input */
281 else if (state->eof && state->strm.avail_in == 0)
282 break;
283
284 /* need more data to skip -- load up output buffer */
285 else {
286 /* get more output, looking for header if required */
287 if (gz_fetch(state) == -1)
288 return -1;
289 }
290 return 0;
291}
292
293/* Read len bytes into buf from file, or less than len up to the end of the
294 input. Return the number of bytes read. If zero is returned, either the

Callers 3

gz_readFunction · 0.70
gzungetcFunction · 0.70
gzread.cFile · 0.70

Calls 1

gz_fetchFunction · 0.70

Tested by

no test coverage detected