pike.git
/
src
/
modules
/
Gz
/
zlibmod.c
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/modules/Gz/zlibmod.c:1:
/*\ ||| This file a part of Pike, and is copyright by Fredrik Hubinette ||| Pike is distributed as GPL (General Public License) ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h"
-
RCSID("$Id: zlibmod.c,v 1.
16
1997/11/11 03:
12
:
04
grubba Exp $");
+
RCSID("$Id: zlibmod.c,v 1.
17
1997/11/11 03:
56
:
25
grubba Exp $");
#include "zlib_machine.h" #if !defined(HAVE_LIBZ) && !defined(HAVE_LIBGZ) #undef HAVE_ZLIB_H #endif #ifdef HAVE_ZLIB_H #include "interpret.h"
pike.git/src/modules/Gz/zlibmod.c:30:
struct zipper { struct z_stream_s gz; #ifdef _REENTRANT DEFINE_MUTEX(lock); #endif /* _REENTRANT */ }; #define BUF 32768
+
#define MAX_BUF (64*BUF)
#define THIS ((struct zipper *)(fp->current_storage)) static void gz_deflate_create(INT32 args) { int level=Z_DEFAULT_COMPRESSION; if(THIS->gz.state) { /* mt_lock(& THIS->lock); */
pike.git/src/modules/Gz/zlibmod.c:99:
THREADS_DISALLOW(); if(!this->gz.state) { fail=Z_STREAM_ERROR; }else{ do { char *loc; int ret; loc=low_make_buf_space(BUF,buf);
-
THREADS_ALLOW();
+
this->gz.next_out=(Bytef *)loc; this->gz.avail_out=BUF;
-
+
while (1) {
+
THREADS_ALLOW();
ret=deflate(& this->gz, flush); THREADS_DISALLOW();
-
+
if ((ret != Z_BUF_ERROR) || (this->gz.avail_out > MAX_BUF)) {
+
break;
+
}
+
low_make_buf_space(BUF, buf);
+
this->gz.avail_out += BUF;
+
}
low_make_buf_space(-this->gz.avail_out,buf); if(ret != Z_OK) { fail=ret; break; } } while(!this->gz.avail_out || flush==Z_FINISH || this->gz.avail_in); } mt_unlock(& this->lock);