MCPcopy Create free account
hub / github.com/MariaDB/server / gzwrite

Function gzwrite

zlib/gzwrite.c:255–277  ·  view source on GitHub ↗

-- see zlib.h -- */

Source from the content-addressed store, hash-verified

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

Callers 1

WriteBufferMethod · 0.85

Calls 2

gz_errorFunction · 0.85
gz_writeFunction · 0.85

Tested by

no test coverage detected