summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2024-01-21 07:35:29 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2024-01-21 07:35:29 +0000
commit76e97a5037f148bfe48ce784a3d65e91e70220b0 (patch)
tree941f0f7f253c8573372773463d45eb3c68ab8e43 /sys
parent2aeae0e9c27925f8d78765bc0de33c57b0ce21a3 (diff)
sync with userland
Diffstat (limited to 'sys')
-rw-r--r--sys/lib/libz/deflate.c10
-rw-r--r--sys/lib/libz/deflate.h2
-rw-r--r--sys/lib/libz/trees.c2
-rw-r--r--sys/lib/libz/zlib.h4
-rw-r--r--sys/lib/libz/zutil.h25
5 files changed, 10 insertions, 33 deletions
diff --git a/sys/lib/libz/deflate.c b/sys/lib/libz/deflate.c
index 4e1decbfd87..cfd1f00c417 100644
--- a/sys/lib/libz/deflate.c
+++ b/sys/lib/libz/deflate.c
@@ -489,11 +489,7 @@ int ZEXPORT deflateInit2_(z_streamp strm, int level, int method,
* symbols from which it is being constructed.
*/
-#ifdef LIT_MEM
- s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 5);
-#else
- s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4);
-#endif
+ s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, LIT_BUFS);
s->pending_buf_size = (ulg)s->lit_bufsize * 4;
if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
@@ -1306,7 +1302,7 @@ int ZEXPORT deflateCopy(z_streamp dest, z_streamp source) {
ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
- ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4);
+ ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, LIT_BUFS);
if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
ds->pending_buf == Z_NULL) {
@@ -1317,7 +1313,7 @@ int ZEXPORT deflateCopy(z_streamp dest, z_streamp source) {
zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));
zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos));
zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos));
- zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
+ zmemcpy(ds->pending_buf, ss->pending_buf, ds->lit_bufsize * LIT_BUFS);
ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
#ifdef LIT_MEM
diff --git a/sys/lib/libz/deflate.h b/sys/lib/libz/deflate.h
index eb28c625ab2..0c95a0a3386 100644
--- a/sys/lib/libz/deflate.h
+++ b/sys/lib/libz/deflate.h
@@ -220,9 +220,11 @@ typedef struct internal_state {
*/
#ifdef LIT_MEM
+# define LIT_BUFS 5
ushf *d_buf; /* buffer for distances */
uchf *l_buf; /* buffer for literals/lengths */
#else
+# define LIT_BUFS 4
uchf *sym_buf; /* buffer for distances and literals/lengths */
#endif
diff --git a/sys/lib/libz/trees.c b/sys/lib/libz/trees.c
index 6bbbb21c377..670316689a1 100644
--- a/sys/lib/libz/trees.c
+++ b/sys/lib/libz/trees.c
@@ -936,7 +936,7 @@ local void compress_block(deflate_state *s, const ct_data *ltree,
/* Check for no overlay of pending_buf on needed symbols */
#ifdef LIT_MEM
- Assert(s->pending < (s->lit_bufsize << 1) + sx, "pendingBuf overflow");
+ Assert(s->pending < 2 * (s->lit_bufsize + sx), "pendingBuf overflow");
#else
Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow");
#endif
diff --git a/sys/lib/libz/zlib.h b/sys/lib/libz/zlib.h
index 4d077ae2097..b29af2ad007 100644
--- a/sys/lib/libz/zlib.h
+++ b/sys/lib/libz/zlib.h
@@ -1758,14 +1758,14 @@ ZEXTERN uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2);
seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
- len2.
+ len2. len2 must be non-negative.
*/
/*
ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2);
Return the operator corresponding to length len2, to be used with
- crc32_combine_op().
+ crc32_combine_op(). len2 must be non-negative.
*/
ZEXTERN uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op);
diff --git a/sys/lib/libz/zutil.h b/sys/lib/libz/zutil.h
index 72902a8a468..b0860149c59 100644
--- a/sys/lib/libz/zutil.h
+++ b/sys/lib/libz/zutil.h
@@ -72,7 +72,7 @@ typedef unsigned long ulg;
extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
/* (size given to avoid silly warnings with Visual C++) */
-#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
+#define ERR_MSG(err) z_errmsg[(err) < -6 || (err) > 2 ? 9 : 2 - (err)]
#define ERR_RETURN(strm,err) \
return (strm->msg = ERR_MSG(err), (err))
@@ -153,17 +153,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
# endif
#endif
-#if defined(MACOS) || defined(TARGET_OS_MAC)
+#if defined(MACOS)
# define OS_CODE 7
-# ifndef Z_SOLO
-# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
-# include <unix.h> /* for fdopen */
-# else
-# ifndef fdopen
-# define fdopen(fd,mode) NULL /* No fdopen() */
-# endif
-# endif
-# endif
#endif
#ifdef __acorn
@@ -186,18 +177,6 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
# define OS_CODE 19
#endif
-#if defined(_BEOS_) || defined(RISCOS)
-# define fdopen(fd,mode) NULL /* No fdopen() */
-#endif
-
-#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
-# if defined(_WIN32_WCE)
-# define fdopen(fd,mode) NULL /* No fdopen() */
-# else
-# define fdopen(fd,type) _fdopen(fd,type)
-# endif
-#endif
-
#if defined(__BORLANDC__) && !defined(MSDOS)
#pragma warn -8004
#pragma warn -8008