-- see zlib.h -- */
| 235 | |
| 236 | /* -- see zlib.h -- */ |
| 237 | int 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 -- */ |
| 261 | z_size_t ZEXPORT gzfwrite(voidpc buf, z_size_t size, z_size_t nitems, |
no test coverage detected