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

Function gzwrite

freebsd/contrib/zlib/gzwrite.c:249–274  ·  view source on GitHub ↗

-- see zlib.h -- */

(file, buf, len)

Source from the content-addressed store, hash-verified

247
248/* -- see zlib.h -- */
249int ZEXPORT gzwrite(file, buf, len)
250 gzFile file;
251 voidpc buf;
252 unsigned len;
253{
254 gz_statep state;
255
256 /* get internal structure */
257 if (file == NULL)
258 return 0;
259 state = (gz_statep)file;
260
261 /* check that we're writing and that there's no error */
262 if (state->mode != GZ_WRITE || state->err != Z_OK)
263 return 0;
264
265 /* since an int is returned, make sure len fits in one, otherwise return
266 with an error (this avoids a flaw in the interface) */
267 if ((int)len < 0) {
268 gz_error(state, Z_DATA_ERROR, "requested length does not fit in int");
269 return 0;
270 }
271
272 /* write len bytes from buf (the return value will fit in an int) */
273 return (int)gz_write(state, buf, len);
274}
275
276/* -- see zlib.h -- */
277z_size_t ZEXPORT gzfwrite(buf, size, nitems, file)

Callers 1

write_mapFunction · 0.50

Calls 2

gz_errorFunction · 0.70
gz_writeFunction · 0.70

Tested by 1

write_mapFunction · 0.40