MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / gzfwrite

Function gzfwrite

extern/zlib/src/gzwrite.c:261–284  ·  view source on GitHub ↗

-- see zlib.h -- */

Source from the content-addressed store, hash-verified

259
260/* -- see zlib.h -- */
261z_size_t ZEXPORT gzfwrite(voidpc buf, z_size_t size, z_size_t nitems,
262 gzFile file) {
263 z_size_t len;
264 gz_statep state;
265
266 /* get internal structure */
267 if (file == NULL)
268 return 0;
269 state = (gz_statep)file;
270
271 /* check that we're writing and that there's no error */
272 if (state->mode != GZ_WRITE || state->err != Z_OK)
273 return 0;
274
275 /* compute bytes to read -- error on overflow */
276 len = nitems * size;
277 if (size && len / size != nitems) {
278 gz_error(state, Z_STREAM_ERROR, "request does not fit in a size_t");
279 return 0;
280 }
281
282 /* write len bytes to buf, return the number of full items written */
283 return len ? gz_write(state, buf, len) / size : 0;
284}
285
286/* -- see zlib.h -- */
287int ZEXPORT gzputc(gzFile file, int c) {

Callers

nothing calls this directly

Calls 2

gz_errorFunction · 0.85
gz_writeFunction · 0.85

Tested by

no test coverage detected