- int status;
-
- *decoded_len = 0x800;
- *decoded = emalloc_rel(*decoded_len);
-
- s->stream.avail_in = 0;
- s->stream.next_in = NULL;
- s->stream.avail_out = *decoded_len;
- s->stream.next_out = (Bytef *) *decoded;
-
- switch (status = inflate(&s->stream, Z_SYNC_FLUSH))
- {
- case Z_OK:
- case Z_STREAM_END:
- *decoded_len = 0x800 - s->stream.avail_out;
- *decoded = erealloc_rel(*decoded, *decoded_len + 1);
- (*decoded)[*decoded_len] = '\0';
- return SUCCESS;
- break;
- }
-
- STR_SET(*decoded, NULL);
- *decoded_len = 0;
- http_error_ex(HE_WARNING, HTTP_E_ENCODING, "Failed to flush inflate stream: %s", zError(status));
- return FAILURE;