#define _Z_UTIL_H
+#include "../rsync.h"
#include "zlib.h"
#ifndef local
/* The minimum and maximum match lengths */
/* functions */
-
-#if defined(KERNEL) || defined(_KERNEL)
-# define zmemcpy(d, s, n) bcopy((s), (d), (n))
-# define zmemzero bzero
-#else
-#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
-# define HAVE_MEMCPY
-#endif
-#ifdef HAVE_MEMCPY
-# define zmemcpy memcpy
-# define zmemzero(dest, len) memset(dest, 0, len)
-#else
- extern void zmemcpy OF((Bytef* dest, Bytef* source, uInt len));
- extern void zmemzero OF((Bytef* dest, uInt len));
-#endif
-#endif
+#define zmemcpy(d, s, n) bcopy((s), (d), (n))
+#define zmemzero bzero
/* Diagnostic functions */
#ifdef DEBUG_ZLIB
/* From: deflate.c,v 1.8 1995/05/03 17:27:08 jloup Exp */
-local char zlib_copyright[] = " deflate Copyright 1995 Jean-loup Gailly ";
+char zlib_copyright[] = " deflate Copyright 1995 Jean-loup Gailly ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
local int longest_match OF((deflate_state *s, IPos cur_match));
local void putShortMSB OF((deflate_state *s, uInt b));
local void flush_pending OF((z_stream *strm));
-local int read_buf OF((z_stream *strm, charf *buf, unsigned size));
+local int zread_buf OF((z_stream *strm, charf *buf, unsigned size));
#ifdef ASMV
void match_init OF((void)); /* asm code initialization */
#endif
* Read a new buffer from the current input stream, update the adler32
* and total number of bytes read.
*/
-local int read_buf(strm, buf, size)
+local int zread_buf(strm, buf, size)
z_stream *strm;
charf *buf;
unsigned size;
*/
Assert(more >= 2, "more < 2");
- n = read_buf(s->strm, (charf *)s->window + s->strstart + s->lookahead,
+ n = zread_buf(s->strm, (charf *)s->window + s->strstart + s->lookahead,
more);
s->lookahead += n;
#endif /* DEBUG_ZLIB */
-#define MAX(a,b) (a >= b ? a : b)
/* the arguments must not have side effects */
/* ===========================================================================
CHECK2, /* two check bytes to go */
CHECK1, /* one check byte to go */
DONE, /* finished check, done */
- BAD} /* got an error--stay here */
+ ZBAD} /* got an error--stay here */
mode; /* current inflate mode */
/* mode dependent information */
uLong was; /* computed check value */
uLong need; /* stream check value */
} check; /* if CHECK, check values to compare */
- uInt marker; /* if BAD, inflateSync's marker bytes count */
+ uInt marker; /* if ZBAD, inflateSync's marker bytes count */
} sub; /* submode */
/* mode independent information */
NEEDBYTE
if (((z->state->sub.method = NEXTBYTE) & 0xf) != DEFLATED)
{
- z->state->mode = BAD;
+ z->state->mode = ZBAD;
z->msg = "unknown compression method";
z->state->sub.marker = 5; /* can't try inflateSync */
break;
}
if ((z->state->sub.method >> 4) + 8 > z->state->wbits)
{
- z->state->mode = BAD;
+ z->state->mode = ZBAD;
z->msg = "invalid window size";
z->state->sub.marker = 5; /* can't try inflateSync */
break;
NEEDBYTE
if ((b = NEXTBYTE) & 0x20)
{
- z->state->mode = BAD;
+ z->state->mode = ZBAD;
z->msg = "invalid reserved bit";
z->state->sub.marker = 5; /* can't try inflateSync */
break;
}
if (((z->state->sub.method << 8) + b) % 31)
{
- z->state->mode = BAD;
+ z->state->mode = ZBAD;
z->msg = "incorrect header check";
z->state->sub.marker = 5; /* can't try inflateSync */
break;
r = inflate_packet_flush(z->state->blocks);
if (r == Z_DATA_ERROR)
{
- z->state->mode = BAD;
+ z->state->mode = ZBAD;
z->state->sub.marker = 0; /* can try inflateSync */
break;
}
if (z->state->sub.check.was != z->state->sub.check.need)
{
- z->state->mode = BAD;
+ z->state->mode = ZBAD;
z->msg = "incorrect data check";
z->state->sub.marker = 5; /* can't try inflateSync */
break;
z->state->mode = DONE;
case DONE:
return Z_STREAM_END;
- case BAD:
+ case ZBAD:
return Z_DATA_ERROR;
default:
return Z_STREAM_ERROR;
empty:
if (f != Z_PACKET_FLUSH)
return r;
- z->state->mode = BAD;
+ z->state->mode = ZBAD;
z->state->sub.marker = 0; /* can try inflateSync */
return Z_DATA_ERROR;
}
/* set up */
if (z == Z_NULL || z->state == Z_NULL)
return Z_STREAM_ERROR;
- if (z->state->mode != BAD)
+ if (z->state->mode != ZBAD)
{
- z->state->mode = BAD;
+ z->state->mode = ZBAD;
z->state->sub.marker = 0;
}
if ((n = z->avail_in) == 0)