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

Function gzfwrite

extlibs/minizip/src/gzwrite.c:306–335  ·  view source on GitHub ↗

-- see zlib.h -- */

(buf, size, nitems, file)

Source from the content-addressed store, hash-verified

304
305/* -- see zlib.h -- */
306z_size_t ZEXPORT gzfwrite(buf, size, nitems, file)
307voidpc buf;
308z_size_t size;
309z_size_t nitems;
310
311gzFile file;
312{
313 z_size_t len;
314 gz_statep state;
315
316 /* get internal structure */
317 if (file == NULL)
318 return 0;
319 state = (gz_statep)file;
320
321 /* check that we're writing and that there's no error */
322 if (state->mode != GZ_WRITE || state->err != Z_OK)
323 return 0;
324
325 /* compute bytes to read -- error on overflow */
326 len = nitems * size;
327 if (size && len / size != nitems)
328 {
329 gz_error(state, Z_STREAM_ERROR, "request does not fit in a size_t");
330 return 0;
331 }
332
333 /* write len bytes to buf, return the number of full items written */
334 return len ? gz_write(state, buf, len) / size : 0;
335}
336
337/* -- see zlib.h -- */
338int ZEXPORT gzputc(file, c)

Callers

nothing calls this directly

Calls 2

gz_errorFunction · 0.85
gz_writeFunction · 0.85

Tested by

no test coverage detected