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

Function gzputs

zlib/gzwrite.c:350–372  ·  view source on GitHub ↗

-- see zlib.h -- */

Source from the content-addressed store, hash-verified

348
349/* -- see zlib.h -- */
350int ZEXPORT gzputs(gzFile file, const char *s) {
351 z_size_t len, put;
352 gz_statep state;
353
354 /* get internal structure */
355 if (file == NULL)
356 return -1;
357 state = (gz_statep)file;
358
359 /* check that we're writing and that there's no (serious) error */
360 if (state->mode != GZ_WRITE || (state->err != Z_OK && !state->again))
361 return -1;
362 gz_error(state, Z_OK, NULL);
363
364 /* write string */
365 len = strlen(s);
366 if ((int)len < 0 || (unsigned)len != len) {
367 gz_error(state, Z_STREAM_ERROR, "string length does not fit in int");
368 return -1;
369 }
370 put = gz_write(state, s, len);
371 return len && put == 0 ? -1 : (int)put;
372}
373
374#if (((!defined(STDC) && !defined(Z_HAVE_STDARG_H)) || !defined(NO_vsnprintf)) && \
375 (defined(STDC) || defined(Z_HAVE_STDARG_H) || !defined(NO_snprintf))) || \

Callers 1

WriteBufferMethod · 0.85

Calls 2

gz_errorFunction · 0.85
gz_writeFunction · 0.85

Tested by

no test coverage detected