-- see zlib.h -- */
| 348 | |
| 349 | /* -- see zlib.h -- */ |
| 350 | int 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))) || \ |
no test coverage detected