22 state->in = (
unsigned char *)
malloc(state->want);
23 if (state->in ==
NULL) {
31 state->out = (
unsigned char *)
malloc(state->want);
32 if (state->out ==
NULL) {
53 state->size = state->want;
57 strm->avail_out = state->size;
58 strm->next_out = state->out;
59 state->x.next = strm->next_out;
79 if (state->size == 0 &&
gz_init(state) == -1)
84 got =
write(state->fd, strm->next_in, strm->avail_in);
85 if (got < 0 || (
unsigned)got != strm->avail_in) {
98 if (strm->avail_out == 0 || (flush !=
Z_NO_FLUSH &&
100 have = (unsigned)(strm->next_out - state->x.next);
101 if (have && ((got =
write(state->fd, state->x.next, have)) < 0 ||
102 (
unsigned)got != have)) {
106 if (strm->avail_out == 0) {
107 strm->avail_out = state->size;
108 strm->next_out = state->out;
110 state->x.next = strm->next_out;
114 have = strm->avail_out;
118 "internal error: deflate stream corrupt");
121 have -= strm->avail_out;
149 (
unsigned)
len : state->size;
151 memset(state->in, 0, n);
155 strm->next_in = state->in;
178 strm = &(state->strm);
196 if (state->size == 0 &&
gz_init(state) == -1)
202 if (
gz_zero(state, state->skip) == -1)
212 if (strm->avail_in == 0)
213 strm->next_in = state->in;
214 have = (unsigned)((strm->next_in + strm->avail_in) - state->in);
215 copy = state->size -
have;
218 memcpy(state->in + have, buf, copy);
219 strm->avail_in += copy;
220 state->x.pos += copy;
221 buf = (
const char *)buf + copy;
233 strm->avail_in =
len;
250 unsigned char buf[1];
258 strm = &(state->strm);
267 if (
gz_zero(state, state->skip) == -1)
274 if (strm->avail_in == 0)
275 strm->next_in = state->in;
276 have = (unsigned)((strm->next_in + strm->avail_in) - state->in);
277 if (have < state->
size) {
287 if (
gzwrite(file, buf, 1) != 1)
301 len = (unsigned)strlen(str);
303 return ret == 0 && len != 0 ? -1 : ret;
306 #if defined(STDC) || defined(Z_HAVE_STDARG_H) 320 strm = &(state->strm);
327 if (state->size == 0 &&
gz_init(state) == -1)
333 if (
gz_zero(state, state->skip) == -1)
342 size = (
int)(state->size);
343 state->in[size - 1] = 0;
345 # ifdef HAS_vsprintf_void 346 (
void)vsprintf((
char *)(state->in), format, va);
347 for (len = 0; len <
size; len++)
348 if (state->in[len] == 0)
break;
350 len = vsprintf((
char *)(state->in), format, va);
353 # ifdef HAS_vsnprintf_void 354 (
void)vsnprintf((
char *)(state->in), size, format, va);
355 len = strlen((
char *)(state->in));
357 len = vsnprintf((
char *)(state->in), size, format, va);
366 strm->avail_in = (unsigned)len;
367 strm->next_in = state->in;
377 va_start(va, format);
378 ret = gzvprintf(file, format, va);
386 int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
387 a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
390 int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
391 a11, a12, a13, a14, a15, a16, a17, a18, a19, a20;
401 strm = &(state->strm);
404 if (
sizeof(
int) !=
sizeof(
void *))
412 if (state->size == 0 &&
gz_init(state) == -1)
418 if (
gz_zero(state, state->skip) == -1)
427 size = (
int)(state->size);
428 state->in[size - 1] = 0;
430 # ifdef HAS_sprintf_void 431 sprintf((
char *)(state->in), format, a1, a2, a3, a4, a5, a6, a7, a8,
432 a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
433 for (len = 0; len <
size; len++)
434 if (state->in[len] == 0)
break;
436 len = sprintf((
char *)(state->in), format, a1, a2, a3, a4, a5, a6, a7, a8,
437 a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
440 # ifdef HAS_snprintf_void 441 snprintf((
char *)(state->in), size, format, a1, a2, a3, a4, a5, a6, a7, a8,
442 a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
443 len = strlen((
char *)(state->in));
445 len = snprintf((
char *)(state->in), size, format, a1, a2, a3, a4, a5, a6,
446 a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18,
456 strm->avail_in = (unsigned)len;
457 strm->next_in = state->in;
487 if (
gz_zero(state, state->skip) == -1)
509 strm = &(state->strm);
516 if (level == state->level && strategy == state->strategy)
522 if (
gz_zero(state, state->skip) == -1)
533 state->level =
level;
557 if (
gz_zero(state, state->skip) == -1)
565 if (!state->direct) {
573 if (
close(state->fd) == -1)
int ZEXPORT deflateParams(z_streamp strm, int level, int strategy)
int write(int fd, const char *buf, int nbytes)
int ZEXPORT gzsetparams(gzFile file, int level, int strategy)
typedef void(APIENTRY *GLDEBUGPROCARB)(GLenum source
int ZEXPORT deflateEnd(z_streamp strm)
int ZEXPORT gzwrite(gzFile file, voidpc buf, unsigned len)
GLenum GLuint GLenum GLsizei const GLchar * buf
local int gz_init(gz_statep state)
int ZEXPORT gzputc(gzFile file, int c)
void ZLIB_INTERNAL gz_error(gz_statep state, int err, const char *msg)
local int gz_zero(gz_statep state, z_off64_t len)
int ZEXPORT gzclose_w(gzFile file)
int ZEXPORT gzputs(gzFile file, const char *str)
local int gz_comp(gz_statep state, int flush)
int ZEXPORT deflate(z_streamp strm, int flush)
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)
if(!abbox) return FT_THROW(Invalid_Argument)
local int gz_init OF((gz_statep))
#define deflateInit2(strm, level, method, windowBits, memLevel, strategy)
int ZEXPORT gzflush(gzFile file, int flush)
int ZEXPORT deflateReset(z_streamp strm)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
#define zstrerror(errnum)