From fb9b015228f7ecb1179e6f095135f306e545d46d Mon Sep 17 00:00:00 2001 From: tb Date: Sun, 30 Jun 2024 05:18:14 +0000 Subject: [PATCH] sync with base --- sys/lib/libz/infback.c | 48 ++++++++++++------------ sys/lib/libz/inffast.c | 14 +++---- sys/lib/libz/inflate.c | 84 +++++++++++++++++++++--------------------- sys/lib/libz/zlib.h | 10 ++--- 4 files changed, 78 insertions(+), 78 deletions(-) diff --git a/sys/lib/libz/infback.c b/sys/lib/libz/infback.c index 4fb0e13058e..d930af9128e 100644 --- a/sys/lib/libz/infback.c +++ b/sys/lib/libz/infback.c @@ -305,9 +305,9 @@ int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc, break; case 3: #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"invalid block type"; + strm->msg = (z_const char *)"invalid block type"; #endif state->mode = BAD; } @@ -320,9 +320,9 @@ int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc, NEEDBITS(32); if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"invalid stored block lengths"; + strm->msg = (z_const char *)"invalid stored block lengths"; #endif state->mode = BAD; break; @@ -362,9 +362,9 @@ int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc, #ifndef PKZIP_BUG_WORKAROUND if (state->nlen > 286 || state->ndist > 30) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"too many length or distance symbols"; + strm->msg = (z_const char *)"too many length or distance symbols"; #endif state->mode = BAD; break; @@ -388,9 +388,9 @@ int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc, &(state->lenbits), state->work); if (ret) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"invalid code lengths set"; + strm->msg = (z_const char *)"invalid code lengths set"; #endif state->mode = BAD; break; @@ -415,9 +415,9 @@ int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc, DROPBITS(here.bits); if (state->have == 0) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"invalid bit length repeat"; + strm->msg = (z_const char *)"invalid bit length repeat"; #endif state->mode = BAD; break; @@ -442,9 +442,9 @@ int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc, } if (state->have + copy > state->nlen + state->ndist) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"invalid bit length repeat"; + strm->msg = (z_const char *)"invalid bit length repeat"; #endif state->mode = BAD; break; @@ -460,9 +460,9 @@ int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc, /* check for end-of-block code (better have one) */ if (state->lens[256] == 0) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"invalid code -- missing end-of-block"; + strm->msg = (z_const char *)"invalid code -- missing end-of-block"; #endif state->mode = BAD; break; @@ -478,9 +478,9 @@ int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc, &(state->lenbits), state->work); if (ret) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"invalid literal/lengths set"; + strm->msg = (z_const char *)"invalid literal/lengths set"; #endif state->mode = BAD; break; @@ -491,9 +491,9 @@ int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc, &(state->next), &(state->distbits), state->work); if (ret) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"invalid distances set"; + strm->msg = (z_const char *)"invalid distances set"; #endif state->mode = BAD; break; @@ -556,9 +556,9 @@ int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc, /* invalid code */ if (here.op & 64) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"invalid literal/length code"; + strm->msg = (z_const char *)"invalid literal/length code"; #endif state->mode = BAD; break; @@ -592,9 +592,9 @@ int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc, DROPBITS(here.bits); if (here.op & 64) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"invalid distance code"; + strm->msg = (z_const char *)"invalid distance code"; #endif state->mode = BAD; break; @@ -611,9 +611,9 @@ int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc, if (state->offset > state->wsize - (state->whave < state->wsize ? left : 0)) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"invalid distance too far back"; + strm->msg = (z_const char *)"invalid distance too far back"; #endif state->mode = BAD; break; diff --git a/sys/lib/libz/inffast.c b/sys/lib/libz/inffast.c index 2884f748cdf..6493ed5057b 100644 --- a/sys/lib/libz/inffast.c +++ b/sys/lib/libz/inffast.c @@ -155,7 +155,7 @@ void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) { dist += (unsigned)hold & ((1U << op) - 1); #ifdef INFLATE_STRICT if (dist > dmax) { - strm->msg = (char *)"invalid distance too far back"; + strm->msg = (z_const char *)"invalid distance too far back"; state->mode = BAD; break; } @@ -169,10 +169,10 @@ void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) { if (op > whave) { if (state->sane) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else strm->msg = - (char *)"invalid distance too far back"; + (z_const char *)"invalid distance too far back"; #endif state->mode = BAD; break; @@ -270,9 +270,9 @@ void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) { } else { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"invalid distance code"; + strm->msg = (z_const char *)"invalid distance code"; #endif state->mode = BAD; break; @@ -289,9 +289,9 @@ void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) { } else { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"invalid literal/length code"; + strm->msg = (z_const char *)"invalid literal/length code"; #endif state->mode = BAD; break; diff --git a/sys/lib/libz/inflate.c b/sys/lib/libz/inflate.c index 869deb702f0..cb741c6faa7 100644 --- a/sys/lib/libz/inflate.c +++ b/sys/lib/libz/inflate.c @@ -643,18 +643,18 @@ int ZEXPORT inflate(z_streamp strm, int flush) { #endif ((BITS(8) << 8) + (hold >> 8)) % 31) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"incorrect header check"; + strm->msg = (z_const char *)"incorrect header check"; #endif state->mode = BAD; break; } if (BITS(4) != Z_DEFLATED) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"unknown compression method"; + strm->msg = (z_const char *)"unknown compression method"; #endif state->mode = BAD; break; @@ -665,9 +665,9 @@ int ZEXPORT inflate(z_streamp strm, int flush) { state->wbits = len; if (len > 15 || len > state->wbits) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"invalid window size"; + strm->msg = (z_const char *)"invalid window size"; #endif state->mode = BAD; break; @@ -685,18 +685,18 @@ int ZEXPORT inflate(z_streamp strm, int flush) { state->flags = (int)(hold); if ((state->flags & 0xff) != Z_DEFLATED) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"unknown compression method"; + strm->msg = (z_const char *)"unknown compression method"; #endif state->mode = BAD; break; } if (state->flags & 0xe000) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"unknown header flags set"; + strm->msg = (z_const char *)"unknown header flags set"; #endif state->mode = BAD; break; @@ -814,9 +814,9 @@ int ZEXPORT inflate(z_streamp strm, int flush) { NEEDBITS(16); if ((state->wrap & 4) && hold != (state->check & 0xffff)) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"header crc mismatch"; + strm->msg = (z_const char *)"header crc mismatch"; #endif state->mode = BAD; break; @@ -880,9 +880,9 @@ int ZEXPORT inflate(z_streamp strm, int flush) { break; case 3: #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"invalid block type"; + strm->msg = (z_const char *)"invalid block type"; #endif state->mode = BAD; } @@ -893,9 +893,9 @@ int ZEXPORT inflate(z_streamp strm, int flush) { NEEDBITS(32); if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"invalid stored block lengths"; + strm->msg = (z_const char *)"invalid stored block lengths"; #endif state->mode = BAD; break; @@ -938,9 +938,9 @@ int ZEXPORT inflate(z_streamp strm, int flush) { #ifndef PKZIP_BUG_WORKAROUND if (state->nlen > 286 || state->ndist > 30) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"too many length or distance symbols"; + strm->msg = (z_const char *)"too many length or distance symbols"; #endif state->mode = BAD; break; @@ -965,9 +965,9 @@ int ZEXPORT inflate(z_streamp strm, int flush) { &(state->lenbits), state->work); if (ret) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"invalid code lengths set"; + strm->msg = (z_const char *)"invalid code lengths set"; #endif state->mode = BAD; break; @@ -993,9 +993,9 @@ int ZEXPORT inflate(z_streamp strm, int flush) { DROPBITS(here.bits); if (state->have == 0) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"invalid bit length repeat"; + strm->msg = (z_const char *)"invalid bit length repeat"; #endif state->mode = BAD; break; @@ -1020,9 +1020,9 @@ int ZEXPORT inflate(z_streamp strm, int flush) { } if (state->have + copy > state->nlen + state->ndist) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"invalid bit length repeat"; + strm->msg = (z_const char *)"invalid bit length repeat"; #endif state->mode = BAD; break; @@ -1038,9 +1038,9 @@ int ZEXPORT inflate(z_streamp strm, int flush) { /* check for end-of-block code (better have one) */ if (state->lens[256] == 0) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"invalid code -- missing end-of-block"; + strm->msg = (z_const char *)"invalid code -- missing end-of-block"; #endif state->mode = BAD; break; @@ -1056,9 +1056,9 @@ int ZEXPORT inflate(z_streamp strm, int flush) { &(state->lenbits), state->work); if (ret) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"invalid literal/lengths set"; + strm->msg = (z_const char *)"invalid literal/lengths set"; #endif state->mode = BAD; break; @@ -1069,9 +1069,9 @@ int ZEXPORT inflate(z_streamp strm, int flush) { &(state->next), &(state->distbits), state->work); if (ret) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"invalid distances set"; + strm->msg = (z_const char *)"invalid distances set"; #endif state->mode = BAD; break; @@ -1129,9 +1129,9 @@ int ZEXPORT inflate(z_streamp strm, int flush) { } if (here.op & 64) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"invalid literal/length code"; + strm->msg = (z_const char *)"invalid literal/length code"; #endif state->mode = BAD; break; @@ -1171,9 +1171,9 @@ int ZEXPORT inflate(z_streamp strm, int flush) { state->back += here.bits; if (here.op & 64) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"invalid distance code"; + strm->msg = (z_const char *)"invalid distance code"; #endif state->mode = BAD; break; @@ -1192,9 +1192,9 @@ int ZEXPORT inflate(z_streamp strm, int flush) { #ifdef INFLATE_STRICT if (state->offset > state->dmax) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"invalid distance too far back"; + strm->msg = (z_const char *)"invalid distance too far back"; #endif state->mode = BAD; break; @@ -1211,9 +1211,9 @@ int ZEXPORT inflate(z_streamp strm, int flush) { if (copy > state->whave) { if (state->sane) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"invalid distance too far back"; + strm->msg = (z_const char *)"invalid distance too far back"; #endif state->mode = BAD; break; @@ -1274,9 +1274,9 @@ int ZEXPORT inflate(z_streamp strm, int flush) { #endif ZSWAP32(hold)) != state->check) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"incorrect data check"; + strm->msg = (z_const char *)"incorrect data check"; #endif state->mode = BAD; break; @@ -1292,9 +1292,9 @@ int ZEXPORT inflate(z_streamp strm, int flush) { NEEDBITS(32); if ((state->wrap & 4) && hold != (state->total & 0xffffffff)) { #ifdef SMALL - strm->msg = "error"; + strm->msg = (z_const char *)"error"; #else - strm->msg = (char *)"incorrect length check"; + strm->msg = (z_const char *)"incorrect length check"; #endif state->mode = BAD; break; diff --git a/sys/lib/libz/zlib.h b/sys/lib/libz/zlib.h index 493d5202188..5322a85f58a 100644 --- a/sys/lib/libz/zlib.h +++ b/sys/lib/libz/zlib.h @@ -597,11 +597,11 @@ ZEXTERN int ZEXPORT deflateInit2(z_streamp strm, Z_RLE is almost as fast as Z_HUFFMAN_ONLY, but should give better compression for PNG image data than Huffman only. The degree of string matching from most to none is: Z_DEFAULT_STRATEGY, Z_FILTERED, Z_RLE, then - Z_HUFFMAN. The strategy parameter affects the compression ratio but never - the correctness of the compressed output, even if it is not set optimally - for the given data. Z_FIXED uses the default string matching, but prevents - the use of dynamic Huffman codes, allowing for a simpler decoder for special - applications. + Z_HUFFMAN_ONLY. The strategy parameter affects the compression ratio but + never the correctness of the compressed output, even if it is not set + optimally for the given data. Z_FIXED uses the default string matching, but + prevents the use of dynamic Huffman codes, allowing for a simpler decoder + for special applications. deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid -- 2.20.1