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

Function gzfwrite

freebsd/contrib/zlib/gzwrite.c:277–304  ·  view source on GitHub ↗

-- see zlib.h -- */

(buf, size, nitems, file)

Source from the content-addressed store, hash-verified

275
276/* -- see zlib.h -- */
277z_size_t ZEXPORT gzfwrite(buf, size, nitems, file)
278 voidpc buf;
279 z_size_t size;
280 z_size_t nitems;
281 gzFile file;
282{
283 z_size_t len;
284 gz_statep state;
285
286 /* get internal structure */
287 if (file == NULL)
288 return 0;
289 state = (gz_statep)file;
290
291 /* check that we're writing and that there's no error */
292 if (state->mode != GZ_WRITE || state->err != Z_OK)
293 return 0;
294
295 /* compute bytes to read -- error on overflow */
296 len = nitems * size;
297 if (size && len / size != nitems) {
298 gz_error(state, Z_STREAM_ERROR, "request does not fit in a size_t");
299 return 0;
300 }
301
302 /* write len bytes to buf, return the number of full items written */
303 return len ? gz_write(state, buf, len) / size : 0;
304}
305
306/* -- see zlib.h -- */
307int ZEXPORT gzputc(file, c)

Callers

nothing calls this directly

Calls 2

gz_errorFunction · 0.70
gz_writeFunction · 0.70

Tested by

no test coverage detected