*
* Changes that have been made include:
* - changed functions not used outside this file to "local"
- * - added minCompression parameter to deflateInit2
* - added Z_PACKET_FLUSH (see zlib.h for details)
* - added inflateIncomp
*
int noheader; /* suppress zlib header and adler32 */
Byte data_type; /* UNKNOWN, BINARY or ASCII */
Byte method; /* STORED (for zip only) or DEFLATED */
- int minCompr; /* min size decrease for Z_FLUSH_NOSTORE */
/* used by deflate.c: */
z_stream *strm;
int level;
{
- return deflateInit2 (strm, level, DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
- 0, 0);
+ return deflateInit2 (strm, level, DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, 0);
/* To do: ignore strm->next_in if we use it as window */
}
/* ========================================================================= */
-int deflateInit2 (strm, level, method, windowBits, memLevel,
- strategy, minCompression)
+int deflateInit2 (strm, level, method, windowBits, memLevel, strategy)
z_stream *strm;
int level;
int method;
int windowBits;
int memLevel;
int strategy;
- int minCompression;
{
deflate_state *s;
int noheader = 0;
s->level = level;
s->strategy = strategy;
s->method = (Byte)method;
- s->minCompr = minCompression;
s->blocks_in_packet = 0;
return deflateReset(strm);
} else
#endif /* STORED_FILE_OK */
- /* For Z_PACKET_FLUSH, if we don't achieve the required minimum
- * compression, and this block contains all the data since the last
- * time we used Z_PACKET_FLUSH, then just omit this block completely
- * from the output.
- */
- if (flush == Z_PACKET_FLUSH && s->blocks_in_packet == 1
- && opt_lenb > stored_len - s->minCompr) {
- s->blocks_in_packet = 0;
- /* output nothing */
- } else
-
#ifdef FORCE_STORED
if (buf != (char*)0) /* force stored block */
#else
/* output bytes */
#define WAVAIL (q<s->read?s->read-q-1:s->end-q)
#define LOADOUT {q=s->write;m=WAVAIL;}
-#define WRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=WAVAIL;}}
+#define ZWRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=WAVAIL;}}
#define FLUSH {UPDOUT r=inflate_flush(s,z,r); LOADOUT}
-#define NEEDOUT {if(m==0){WRAP if(m==0){FLUSH WRAP if(m==0) LEAVE}}r=Z_OK;}
+#define NEEDOUT {if(m==0){ZWRAP if(m==0){FLUSH ZWRAP if(m==0) LEAVE}}r=Z_OK;}
#define OUTBYTE(a) {*q++=(Byte)(a);m--;}
/* load local pointers */
#define LOAD {LOADIN LOADOUT}
n -= t;
z->total_out += t;
s->read = q; /* drag read pointer forward */
-/* WRAP */ /* expand WRAP macro by hand to handle s->read */
+/* ZWRAP */ /* expand ZWRAP macro by hand to handle s->read */
if (q == s->end) {
s->read = q = s->window;
m = WAVAIL;
/* build fixed tables only once--keep them here */
-local int fixed_lock = 0;
+#ifdef MULTI_THREADED
+local volatile int fixed_lock = 0;
+#endif
local int fixed_built = 0;
#define FIXEDH 530 /* number of hufts used by fixed tables */
local uInt fixed_left = FIXEDH;
inflate_huft * FAR *td; /* distance tree result */
{
/* build fixed tables if not built already--lock out other instances */
+#ifdef MULTI_THREADED
while (++fixed_lock > 1)
fixed_lock--;
+#endif
if (!fixed_built)
{
int k; /* temporary variable */
/* done */
fixed_built = 1;
}
+#ifdef MULTI_THREADED
fixed_lock--;
+#endif
*bl = fixed_bl;
*bd = fixed_bd;
*tl = fixed_tl;