summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2024-06-30 05:16:18 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2024-06-30 05:16:18 +0000
commit462792a6283a4bdc0e434794e1a118c146e02859 (patch)
tree9894171acb1faf299861dd3f1b145dd130384f17 /lib
parent6bc19abe996ab2f1fe640269ff0ed4926c3b8de9 (diff)
cast string literals with z_const char *
from upstream 2ba25b2ddab9aa939c321d087fcfca573a9cca55
Diffstat (limited to 'lib')
-rw-r--r--lib/libz/infback.c48
-rw-r--r--lib/libz/inffast.c14
-rw-r--r--lib/libz/inflate.c81
3 files changed, 72 insertions, 71 deletions
diff --git a/lib/libz/infback.c b/lib/libz/infback.c
index df53ef07847..2f884e73518 100644
--- a/lib/libz/infback.c
+++ b/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/lib/libz/inffast.c b/lib/libz/inffast.c
index 2884f748cdf..6493ed5057b 100644
--- a/lib/libz/inffast.c
+++ b/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/lib/libz/inflate.c b/lib/libz/inflate.c
index caac5d61911..008f508ff8b 100644
--- a/lib/libz/inflate.c
+++ b/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,8 +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 = (z_const char *)"invalid window size";
strm->msg = (char *)"invalid window size";
#endif
state->mode = BAD;
@@ -685,18 +686,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 +815,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 +881,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 +894,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 +939,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;
@@ -967,7 +968,7 @@ int ZEXPORT inflate(z_streamp strm, int flush) {
#ifdef SMALL
strm->msg = "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 +994,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 +1021,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 +1039,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 +1057,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 +1070,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 +1130,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 +1172,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 +1193,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 +1212,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 +1275,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 +1293,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;