78 unsigned have, put, max = ((unsigned)-1 >> 2) + 1;
82 if (state->size == 0 &&
gz_init(state) == -1)
87 while (strm->avail_in) {
88 put = strm->avail_in > max ? max : strm->avail_in;
89 writ = write(state->fd, strm->next_in, put);
94 strm->avail_in -= (unsigned)writ;
95 strm->next_in += writ;
103 if (strm->avail_in == 0)
114 if (strm->avail_out == 0 || (flush !=
Z_NO_FLUSH &&
116 while (strm->next_out > state->x.next) {
117 put = strm->next_out - state->x.next > (int)max ? max :
118 (unsigned)(strm->next_out - state->x.next);
119 writ = write(state->fd, state->x.next, put);
124 state->x.next += writ;
126 if (strm->avail_out == 0) {
127 strm->avail_out = state->size;
128 strm->next_out = state->out;
129 state->x.next = state->out;
134 have = strm->avail_out;
138 "internal error: deflate stream corrupt");
141 have -= strm->avail_out;
477int ZEXPORTVA
gzprintf(file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
478 a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
481 int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
482 a11, a12, a13, a14, a15, a16, a17, a18, a19, a20;
493 strm = &(state->strm);
496 if (
sizeof(
int) !=
sizeof(
void *))
504 if (state->size == 0 &&
gz_init(state) == -1)
510 if (
gz_zero(state, state->skip) == -1)
517 if (strm->avail_in == 0)
518 strm->next_in = state->in;
519 next = (
char *)(strm->next_in + strm->avail_in);
520 next[state->size - 1] = 0;
522# ifdef HAS_sprintf_void
523 sprintf(next, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12,
524 a13, a14, a15, a16, a17, a18, a19, a20);
525 for (len = 0; len < size; len++)
529 len = sprintf(next, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11,
530 a12, a13, a14, a15, a16, a17, a18, a19, a20);
533# ifdef HAS_snprintf_void
534 snprintf(next, state->size, format, a1, a2, a3, a4, a5, a6, a7, a8, a9,
535 a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
538 len = snprintf(next, state->size, format, a1, a2, a3, a4, a5, a6, a7, a8,
539 a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
544 if (len == 0 || len >= state->size || next[state->size - 1] != 0)
548 strm->avail_in += len;
550 if (strm->avail_in >= state->size) {
551 left = strm->avail_in - state->size;
552 strm->avail_in = state->size;
555 memmove(state->in, state->in + state->size, left);
556 strm->next_in = state->in;
557 strm->avail_in = left;
int ZEXPORTVA gzprintf(gzFile file, const char *format, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, int a10, int a11, int a12, int a13, int a14, int a15, int a16, int a17, int a18, int a19, int a20)