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

Function gzwrite

extlibs/minizip/src/gzwrite.c:276–303  ·  view source on GitHub ↗

-- see zlib.h -- */

(file, buf, len)

Source from the content-addressed store, hash-verified

274
275/* -- see zlib.h -- */
276int ZEXPORT gzwrite(file, buf, len)
277gzFile file;
278voidpc buf;
279
280unsigned len;
281{
282 gz_statep state;
283
284 /* get internal structure */
285 if (file == NULL)
286 return 0;
287 state = (gz_statep)file;
288
289 /* check that we're writing and that there's no error */
290 if (state->mode != GZ_WRITE || state->err != Z_OK)
291 return 0;
292
293 /* since an int is returned, make sure len fits in one, otherwise return
294 with an error (this avoids a flaw in the interface) */
295 if ((int)len < 0)
296 {
297 gz_error(state, Z_DATA_ERROR, "requested length does not fit in int");
298 return 0;
299 }
300
301 /* write len bytes from buf (the return value will fit in an int) */
302 return (int)gz_write(state, buf, len);
303}
304
305/* -- see zlib.h -- */
306z_size_t ZEXPORT gzfwrite(buf, size, nitems, file)

Callers

nothing calls this directly

Calls 2

gz_errorFunction · 0.85
gz_writeFunction · 0.85

Tested by

no test coverage detected