MCPcopy Create free account
hub / github.com/Kitware/VTK / gzwrite

Function gzwrite

ThirdParty/zlib/vtkzlib/gzwrite.c:237–258  ·  view source on GitHub ↗

-- see zlib.h -- */

Source from the content-addressed store, hash-verified

235
236/* -- see zlib.h -- */
237int ZEXPORT gzwrite(gzFile file, voidpc buf, unsigned len) {
238 gz_statep state;
239
240 /* get internal structure */
241 if (file == NULL)
242 return 0;
243 state = (gz_statep)file;
244
245 /* check that we're writing and that there's no error */
246 if (state->mode != GZ_WRITE || state->err != Z_OK)
247 return 0;
248
249 /* since an int is returned, make sure len fits in one, otherwise return
250 with an error (this avoids a flaw in the interface) */
251 if ((int)len < 0) {
252 gz_error(state, Z_DATA_ERROR, "requested length does not fit in int");
253 return 0;
254 }
255
256 /* write len bytes from buf (the return value will fit in an int) */
257 return (int)gz_write(state, buf, len);
258}
259
260/* -- see zlib.h -- */
261z_size_t ZEXPORT gzfwrite(voidpc buf, z_size_t size, z_size_t nitems,

Callers 2

RequestDataMethod · 0.85
xmlGzfileWriteFunction · 0.85

Calls 2

gz_errorFunction · 0.85
gz_writeFunction · 0.85

Tested by

no test coverage detected