diff options
author | Lwisce Zeng <Lwisce.Zeng@garmin.com> | 2024-04-01 15:55:13 +0800 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2024-04-01 11:49:05 -0700 |
commit | 2ba25b2ddab9aa939c321d087fcfca573a9cca55 (patch) | |
tree | be7fc649f72cf901225a4a3e6d3c53c6e82d8f41 | |
parent | c5e87dcdef72abfb599579bb1b8176948be979c9 (diff) | |
download | zlib-2ba25b2ddab9aa939c321d087fcfca573a9cca55.tar.gz zlib-2ba25b2ddab9aa939c321d087fcfca573a9cca55.tar.bz2 zlib-2ba25b2ddab9aa939c321d087fcfca573a9cca55.zip |
Use z_const for setting msg to literal strings.
Diffstat (limited to '')
-rw-r--r-- | contrib/infback9/infback9.c | 24 | ||||
-rw-r--r-- | examples/gun.c | 18 | ||||
-rw-r--r-- | infback.c | 24 | ||||
-rw-r--r-- | inffast.c | 8 | ||||
-rw-r--r-- | inflate.c | 42 |
5 files changed, 58 insertions, 58 deletions
diff --git a/contrib/infback9/infback9.c b/contrib/infback9/infback9.c index 742a392..4ac4c3d 100644 --- a/contrib/infback9/infback9.c +++ b/contrib/infback9/infback9.c | |||
@@ -293,7 +293,7 @@ int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc, | |||
293 | mode = TABLE; | 293 | mode = TABLE; |
294 | break; | 294 | break; |
295 | case 3: | 295 | case 3: |
296 | strm->msg = (char *)"invalid block type"; | 296 | strm->msg = (z_const char *)"invalid block type"; |
297 | mode = BAD; | 297 | mode = BAD; |
298 | } | 298 | } |
299 | DROPBITS(2); | 299 | DROPBITS(2); |
@@ -304,7 +304,7 @@ int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc, | |||
304 | BYTEBITS(); /* go to byte boundary */ | 304 | BYTEBITS(); /* go to byte boundary */ |
305 | NEEDBITS(32); | 305 | NEEDBITS(32); |
306 | if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { | 306 | if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { |
307 | strm->msg = (char *)"invalid stored block lengths"; | 307 | strm->msg = (z_const char *)"invalid stored block lengths"; |
308 | mode = BAD; | 308 | mode = BAD; |
309 | break; | 309 | break; |
310 | } | 310 | } |
@@ -341,7 +341,7 @@ int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc, | |||
341 | state->ncode = BITS(4) + 4; | 341 | state->ncode = BITS(4) + 4; |
342 | DROPBITS(4); | 342 | DROPBITS(4); |
343 | if (state->nlen > 286) { | 343 | if (state->nlen > 286) { |
344 | strm->msg = (char *)"too many length symbols"; | 344 | strm->msg = (z_const char *)"too many length symbols"; |
345 | mode = BAD; | 345 | mode = BAD; |
346 | break; | 346 | break; |
347 | } | 347 | } |
@@ -362,7 +362,7 @@ int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc, | |||
362 | ret = inflate_table9(CODES, state->lens, 19, &(state->next), | 362 | ret = inflate_table9(CODES, state->lens, 19, &(state->next), |
363 | &(lenbits), state->work); | 363 | &(lenbits), state->work); |
364 | if (ret) { | 364 | if (ret) { |
365 | strm->msg = (char *)"invalid code lengths set"; | 365 | strm->msg = (z_const char *)"invalid code lengths set"; |
366 | mode = BAD; | 366 | mode = BAD; |
367 | break; | 367 | break; |
368 | } | 368 | } |
@@ -386,7 +386,7 @@ int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc, | |||
386 | NEEDBITS(here.bits + 2); | 386 | NEEDBITS(here.bits + 2); |
387 | DROPBITS(here.bits); | 387 | DROPBITS(here.bits); |
388 | if (state->have == 0) { | 388 | if (state->have == 0) { |
389 | strm->msg = (char *)"invalid bit length repeat"; | 389 | strm->msg = (z_const char *)"invalid bit length repeat"; |
390 | mode = BAD; | 390 | mode = BAD; |
391 | break; | 391 | break; |
392 | } | 392 | } |
@@ -409,7 +409,7 @@ int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc, | |||
409 | DROPBITS(7); | 409 | DROPBITS(7); |
410 | } | 410 | } |
411 | if (state->have + copy > state->nlen + state->ndist) { | 411 | if (state->have + copy > state->nlen + state->ndist) { |
412 | strm->msg = (char *)"invalid bit length repeat"; | 412 | strm->msg = (z_const char *)"invalid bit length repeat"; |
413 | mode = BAD; | 413 | mode = BAD; |
414 | break; | 414 | break; |
415 | } | 415 | } |
@@ -423,7 +423,7 @@ int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc, | |||
423 | 423 | ||
424 | /* check for end-of-block code (better have one) */ | 424 | /* check for end-of-block code (better have one) */ |
425 | if (state->lens[256] == 0) { | 425 | if (state->lens[256] == 0) { |
426 | strm->msg = (char *)"invalid code -- missing end-of-block"; | 426 | strm->msg = (z_const char *)"invalid code -- missing end-of-block"; |
427 | mode = BAD; | 427 | mode = BAD; |
428 | break; | 428 | break; |
429 | } | 429 | } |
@@ -437,7 +437,7 @@ int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc, | |||
437 | ret = inflate_table9(LENS, state->lens, state->nlen, | 437 | ret = inflate_table9(LENS, state->lens, state->nlen, |
438 | &(state->next), &(lenbits), state->work); | 438 | &(state->next), &(lenbits), state->work); |
439 | if (ret) { | 439 | if (ret) { |
440 | strm->msg = (char *)"invalid literal/lengths set"; | 440 | strm->msg = (z_const char *)"invalid literal/lengths set"; |
441 | mode = BAD; | 441 | mode = BAD; |
442 | break; | 442 | break; |
443 | } | 443 | } |
@@ -447,7 +447,7 @@ int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc, | |||
447 | state->ndist, &(state->next), &(distbits), | 447 | state->ndist, &(state->next), &(distbits), |
448 | state->work); | 448 | state->work); |
449 | if (ret) { | 449 | if (ret) { |
450 | strm->msg = (char *)"invalid distances set"; | 450 | strm->msg = (z_const char *)"invalid distances set"; |
451 | mode = BAD; | 451 | mode = BAD; |
452 | break; | 452 | break; |
453 | } | 453 | } |
@@ -495,7 +495,7 @@ int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc, | |||
495 | 495 | ||
496 | /* invalid code */ | 496 | /* invalid code */ |
497 | if (here.op & 64) { | 497 | if (here.op & 64) { |
498 | strm->msg = (char *)"invalid literal/length code"; | 498 | strm->msg = (z_const char *)"invalid literal/length code"; |
499 | mode = BAD; | 499 | mode = BAD; |
500 | break; | 500 | break; |
501 | } | 501 | } |
@@ -527,7 +527,7 @@ int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc, | |||
527 | } | 527 | } |
528 | DROPBITS(here.bits); | 528 | DROPBITS(here.bits); |
529 | if (here.op & 64) { | 529 | if (here.op & 64) { |
530 | strm->msg = (char *)"invalid distance code"; | 530 | strm->msg = (z_const char *)"invalid distance code"; |
531 | mode = BAD; | 531 | mode = BAD; |
532 | break; | 532 | break; |
533 | } | 533 | } |
@@ -541,7 +541,7 @@ int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc, | |||
541 | DROPBITS(extra); | 541 | DROPBITS(extra); |
542 | } | 542 | } |
543 | if (offset > WSIZE - (wrap ? 0: left)) { | 543 | if (offset > WSIZE - (wrap ? 0: left)) { |
544 | strm->msg = (char *)"invalid distance too far back"; | 544 | strm->msg = (z_const char *)"invalid distance too far back"; |
545 | mode = BAD; | 545 | mode = BAD; |
546 | break; | 546 | break; |
547 | } | 547 | } |
diff --git a/examples/gun.c b/examples/gun.c index bea5497..dbd181c 100644 --- a/examples/gun.c +++ b/examples/gun.c | |||
@@ -227,12 +227,12 @@ local int lunpipe(unsigned have, z_const unsigned char *next, struct ind *indp, | |||
227 | if (last == -1) | 227 | if (last == -1) |
228 | return Z_BUF_ERROR; | 228 | return Z_BUF_ERROR; |
229 | if (flags & 0x60) { | 229 | if (flags & 0x60) { |
230 | strm->msg = (char *)"unknown lzw flags set"; | 230 | strm->msg = (z_const char *)"unknown lzw flags set"; |
231 | return Z_DATA_ERROR; | 231 | return Z_DATA_ERROR; |
232 | } | 232 | } |
233 | max = flags & 0x1f; | 233 | max = flags & 0x1f; |
234 | if (max < 9 || max > 16) { | 234 | if (max < 9 || max > 16) { |
235 | strm->msg = (char *)"lzw bits out of range"; | 235 | strm->msg = (z_const char *)"lzw bits out of range"; |
236 | return Z_DATA_ERROR; | 236 | return Z_DATA_ERROR; |
237 | } | 237 | } |
238 | if (max == 9) /* 9 doesn't really mean 9 */ | 238 | if (max == 9) /* 9 doesn't really mean 9 */ |
@@ -252,7 +252,7 @@ local int lunpipe(unsigned have, z_const unsigned char *next, struct ind *indp, | |||
252 | if (NEXT() == -1) /* missing a bit */ | 252 | if (NEXT() == -1) /* missing a bit */ |
253 | return Z_BUF_ERROR; | 253 | return Z_BUF_ERROR; |
254 | if (last & 1) { /* code must be < 256 */ | 254 | if (last & 1) { /* code must be < 256 */ |
255 | strm->msg = (char *)"invalid lzw code"; | 255 | strm->msg = (z_const char *)"invalid lzw code"; |
256 | return Z_DATA_ERROR; | 256 | return Z_DATA_ERROR; |
257 | } | 257 | } |
258 | rem = (unsigned)last >> 1; /* remaining 7 bits */ | 258 | rem = (unsigned)last >> 1; /* remaining 7 bits */ |
@@ -319,7 +319,7 @@ local int lunpipe(unsigned have, z_const unsigned char *next, struct ind *indp, | |||
319 | to detect random or corrupted input after a compress header. | 319 | to detect random or corrupted input after a compress header. |
320 | In any case, the prev > end check must be retained. */ | 320 | In any case, the prev > end check must be retained. */ |
321 | if (code != end + 1 || prev > end) { | 321 | if (code != end + 1 || prev > end) { |
322 | strm->msg = (char *)"invalid lzw code"; | 322 | strm->msg = (z_const char *)"invalid lzw code"; |
323 | return Z_DATA_ERROR; | 323 | return Z_DATA_ERROR; |
324 | } | 324 | } |
325 | match[stack++] = (unsigned char)final; | 325 | match[stack++] = (unsigned char)final; |
@@ -404,7 +404,7 @@ local int gunpipe(z_stream *strm, int infile, int outfile) | |||
404 | break; /* empty gzip stream is ok */ | 404 | break; /* empty gzip stream is ok */ |
405 | } | 405 | } |
406 | if (last != 31 || (NEXT() != 139 && last != 157)) { | 406 | if (last != 31 || (NEXT() != 139 && last != 157)) { |
407 | strm->msg = (char *)"incorrect header check"; | 407 | strm->msg = (z_const char *)"incorrect header check"; |
408 | ret = first ? Z_DATA_ERROR : Z_ERRNO; | 408 | ret = first ? Z_DATA_ERROR : Z_ERRNO; |
409 | break; /* not a gzip or compress header */ | 409 | break; /* not a gzip or compress header */ |
410 | } | 410 | } |
@@ -420,7 +420,7 @@ local int gunpipe(z_stream *strm, int infile, int outfile) | |||
420 | ret = Z_BUF_ERROR; | 420 | ret = Z_BUF_ERROR; |
421 | if (NEXT() != 8) { /* only deflate method allowed */ | 421 | if (NEXT() != 8) { /* only deflate method allowed */ |
422 | if (last == -1) break; | 422 | if (last == -1) break; |
423 | strm->msg = (char *)"unknown compression method"; | 423 | strm->msg = (z_const char *)"unknown compression method"; |
424 | ret = Z_DATA_ERROR; | 424 | ret = Z_DATA_ERROR; |
425 | break; | 425 | break; |
426 | } | 426 | } |
@@ -433,7 +433,7 @@ local int gunpipe(z_stream *strm, int infile, int outfile) | |||
433 | NEXT(); | 433 | NEXT(); |
434 | if (last == -1) break; | 434 | if (last == -1) break; |
435 | if (flags & 0xe0) { | 435 | if (flags & 0xe0) { |
436 | strm->msg = (char *)"unknown header flags set"; | 436 | strm->msg = (z_const char *)"unknown header flags set"; |
437 | ret = Z_DATA_ERROR; | 437 | ret = Z_DATA_ERROR; |
438 | break; | 438 | break; |
439 | } | 439 | } |
@@ -486,7 +486,7 @@ local int gunpipe(z_stream *strm, int infile, int outfile) | |||
486 | NEXT() != (int)((outd.crc >> 24) & 0xff)) { | 486 | NEXT() != (int)((outd.crc >> 24) & 0xff)) { |
487 | /* crc error */ | 487 | /* crc error */ |
488 | if (last != -1) { | 488 | if (last != -1) { |
489 | strm->msg = (char *)"incorrect data check"; | 489 | strm->msg = (z_const char *)"incorrect data check"; |
490 | ret = Z_DATA_ERROR; | 490 | ret = Z_DATA_ERROR; |
491 | } | 491 | } |
492 | break; | 492 | break; |
@@ -497,7 +497,7 @@ local int gunpipe(z_stream *strm, int infile, int outfile) | |||
497 | NEXT() != (int)((outd.total >> 24) & 0xff)) { | 497 | NEXT() != (int)((outd.total >> 24) & 0xff)) { |
498 | /* length error */ | 498 | /* length error */ |
499 | if (last != -1) { | 499 | if (last != -1) { |
500 | strm->msg = (char *)"incorrect length check"; | 500 | strm->msg = (z_const char *)"incorrect length check"; |
501 | ret = Z_DATA_ERROR; | 501 | ret = Z_DATA_ERROR; |
502 | } | 502 | } |
503 | break; | 503 | break; |
@@ -304,7 +304,7 @@ int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc, | |||
304 | state->mode = TABLE; | 304 | state->mode = TABLE; |
305 | break; | 305 | break; |
306 | case 3: | 306 | case 3: |
307 | strm->msg = (char *)"invalid block type"; | 307 | strm->msg = (z_const char *)"invalid block type"; |
308 | state->mode = BAD; | 308 | state->mode = BAD; |
309 | } | 309 | } |
310 | DROPBITS(2); | 310 | DROPBITS(2); |
@@ -315,7 +315,7 @@ int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc, | |||
315 | BYTEBITS(); /* go to byte boundary */ | 315 | BYTEBITS(); /* go to byte boundary */ |
316 | NEEDBITS(32); | 316 | NEEDBITS(32); |
317 | if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { | 317 | if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { |
318 | strm->msg = (char *)"invalid stored block lengths"; | 318 | strm->msg = (z_const char *)"invalid stored block lengths"; |
319 | state->mode = BAD; | 319 | state->mode = BAD; |
320 | break; | 320 | break; |
321 | } | 321 | } |
@@ -353,7 +353,7 @@ int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc, | |||
353 | DROPBITS(4); | 353 | DROPBITS(4); |
354 | #ifndef PKZIP_BUG_WORKAROUND | 354 | #ifndef PKZIP_BUG_WORKAROUND |
355 | if (state->nlen > 286 || state->ndist > 30) { | 355 | if (state->nlen > 286 || state->ndist > 30) { |
356 | strm->msg = (char *)"too many length or distance symbols"; | 356 | strm->msg = (z_const char *)"too many length or distance symbols"; |
357 | state->mode = BAD; | 357 | state->mode = BAD; |
358 | break; | 358 | break; |
359 | } | 359 | } |
@@ -375,7 +375,7 @@ int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc, | |||
375 | ret = inflate_table(CODES, state->lens, 19, &(state->next), | 375 | ret = inflate_table(CODES, state->lens, 19, &(state->next), |
376 | &(state->lenbits), state->work); | 376 | &(state->lenbits), state->work); |
377 | if (ret) { | 377 | if (ret) { |
378 | strm->msg = (char *)"invalid code lengths set"; | 378 | strm->msg = (z_const char *)"invalid code lengths set"; |
379 | state->mode = BAD; | 379 | state->mode = BAD; |
380 | break; | 380 | break; |
381 | } | 381 | } |
@@ -398,7 +398,7 @@ int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc, | |||
398 | NEEDBITS(here.bits + 2); | 398 | NEEDBITS(here.bits + 2); |
399 | DROPBITS(here.bits); | 399 | DROPBITS(here.bits); |
400 | if (state->have == 0) { | 400 | if (state->have == 0) { |
401 | strm->msg = (char *)"invalid bit length repeat"; | 401 | strm->msg = (z_const char *)"invalid bit length repeat"; |
402 | state->mode = BAD; | 402 | state->mode = BAD; |
403 | break; | 403 | break; |
404 | } | 404 | } |
@@ -421,7 +421,7 @@ int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc, | |||
421 | DROPBITS(7); | 421 | DROPBITS(7); |
422 | } | 422 | } |
423 | if (state->have + copy > state->nlen + state->ndist) { | 423 | if (state->have + copy > state->nlen + state->ndist) { |
424 | strm->msg = (char *)"invalid bit length repeat"; | 424 | strm->msg = (z_const char *)"invalid bit length repeat"; |
425 | state->mode = BAD; | 425 | state->mode = BAD; |
426 | break; | 426 | break; |
427 | } | 427 | } |
@@ -435,7 +435,7 @@ int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc, | |||
435 | 435 | ||
436 | /* check for end-of-block code (better have one) */ | 436 | /* check for end-of-block code (better have one) */ |
437 | if (state->lens[256] == 0) { | 437 | if (state->lens[256] == 0) { |
438 | strm->msg = (char *)"invalid code -- missing end-of-block"; | 438 | strm->msg = (z_const char *)"invalid code -- missing end-of-block"; |
439 | state->mode = BAD; | 439 | state->mode = BAD; |
440 | break; | 440 | break; |
441 | } | 441 | } |
@@ -449,7 +449,7 @@ int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc, | |||
449 | ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), | 449 | ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), |
450 | &(state->lenbits), state->work); | 450 | &(state->lenbits), state->work); |
451 | if (ret) { | 451 | if (ret) { |
452 | strm->msg = (char *)"invalid literal/lengths set"; | 452 | strm->msg = (z_const char *)"invalid literal/lengths set"; |
453 | state->mode = BAD; | 453 | state->mode = BAD; |
454 | break; | 454 | break; |
455 | } | 455 | } |
@@ -458,7 +458,7 @@ int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc, | |||
458 | ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, | 458 | ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, |
459 | &(state->next), &(state->distbits), state->work); | 459 | &(state->next), &(state->distbits), state->work); |
460 | if (ret) { | 460 | if (ret) { |
461 | strm->msg = (char *)"invalid distances set"; | 461 | strm->msg = (z_const char *)"invalid distances set"; |
462 | state->mode = BAD; | 462 | state->mode = BAD; |
463 | break; | 463 | break; |
464 | } | 464 | } |
@@ -517,7 +517,7 @@ int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc, | |||
517 | 517 | ||
518 | /* invalid code */ | 518 | /* invalid code */ |
519 | if (here.op & 64) { | 519 | if (here.op & 64) { |
520 | strm->msg = (char *)"invalid literal/length code"; | 520 | strm->msg = (z_const char *)"invalid literal/length code"; |
521 | state->mode = BAD; | 521 | state->mode = BAD; |
522 | break; | 522 | break; |
523 | } | 523 | } |
@@ -549,7 +549,7 @@ int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc, | |||
549 | } | 549 | } |
550 | DROPBITS(here.bits); | 550 | DROPBITS(here.bits); |
551 | if (here.op & 64) { | 551 | if (here.op & 64) { |
552 | strm->msg = (char *)"invalid distance code"; | 552 | strm->msg = (z_const char *)"invalid distance code"; |
553 | state->mode = BAD; | 553 | state->mode = BAD; |
554 | break; | 554 | break; |
555 | } | 555 | } |
@@ -564,7 +564,7 @@ int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc, | |||
564 | } | 564 | } |
565 | if (state->offset > state->wsize - (state->whave < state->wsize ? | 565 | if (state->offset > state->wsize - (state->whave < state->wsize ? |
566 | left : 0)) { | 566 | left : 0)) { |
567 | strm->msg = (char *)"invalid distance too far back"; | 567 | strm->msg = (z_const char *)"invalid distance too far back"; |
568 | state->mode = BAD; | 568 | state->mode = BAD; |
569 | break; | 569 | break; |
570 | } | 570 | } |
@@ -155,7 +155,7 @@ void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) { | |||
155 | dist += (unsigned)hold & ((1U << op) - 1); | 155 | dist += (unsigned)hold & ((1U << op) - 1); |
156 | #ifdef INFLATE_STRICT | 156 | #ifdef INFLATE_STRICT |
157 | if (dist > dmax) { | 157 | if (dist > dmax) { |
158 | strm->msg = (char *)"invalid distance too far back"; | 158 | strm->msg = (z_const char *)"invalid distance too far back"; |
159 | state->mode = BAD; | 159 | state->mode = BAD; |
160 | break; | 160 | break; |
161 | } | 161 | } |
@@ -169,7 +169,7 @@ void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) { | |||
169 | if (op > whave) { | 169 | if (op > whave) { |
170 | if (state->sane) { | 170 | if (state->sane) { |
171 | strm->msg = | 171 | strm->msg = |
172 | (char *)"invalid distance too far back"; | 172 | (z_const char *)"invalid distance too far back"; |
173 | state->mode = BAD; | 173 | state->mode = BAD; |
174 | break; | 174 | break; |
175 | } | 175 | } |
@@ -265,7 +265,7 @@ void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) { | |||
265 | goto dodist; | 265 | goto dodist; |
266 | } | 266 | } |
267 | else { | 267 | else { |
268 | strm->msg = (char *)"invalid distance code"; | 268 | strm->msg = (z_const char *)"invalid distance code"; |
269 | state->mode = BAD; | 269 | state->mode = BAD; |
270 | break; | 270 | break; |
271 | } | 271 | } |
@@ -280,7 +280,7 @@ void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) { | |||
280 | break; | 280 | break; |
281 | } | 281 | } |
282 | else { | 282 | else { |
283 | strm->msg = (char *)"invalid literal/length code"; | 283 | strm->msg = (z_const char *)"invalid literal/length code"; |
284 | state->mode = BAD; | 284 | state->mode = BAD; |
285 | break; | 285 | break; |
286 | } | 286 | } |
@@ -642,12 +642,12 @@ int ZEXPORT inflate(z_streamp strm, int flush) { | |||
642 | if ( | 642 | if ( |
643 | #endif | 643 | #endif |
644 | ((BITS(8) << 8) + (hold >> 8)) % 31) { | 644 | ((BITS(8) << 8) + (hold >> 8)) % 31) { |
645 | strm->msg = (char *)"incorrect header check"; | 645 | strm->msg = (z_const char *)"incorrect header check"; |
646 | state->mode = BAD; | 646 | state->mode = BAD; |
647 | break; | 647 | break; |
648 | } | 648 | } |
649 | if (BITS(4) != Z_DEFLATED) { | 649 | if (BITS(4) != Z_DEFLATED) { |
650 | strm->msg = (char *)"unknown compression method"; | 650 | strm->msg = (z_const char *)"unknown compression method"; |
651 | state->mode = BAD; | 651 | state->mode = BAD; |
652 | break; | 652 | break; |
653 | } | 653 | } |
@@ -656,7 +656,7 @@ int ZEXPORT inflate(z_streamp strm, int flush) { | |||
656 | if (state->wbits == 0) | 656 | if (state->wbits == 0) |
657 | state->wbits = len; | 657 | state->wbits = len; |
658 | if (len > 15 || len > state->wbits) { | 658 | if (len > 15 || len > state->wbits) { |
659 | strm->msg = (char *)"invalid window size"; | 659 | strm->msg = (z_const char *)"invalid window size"; |
660 | state->mode = BAD; | 660 | state->mode = BAD; |
661 | break; | 661 | break; |
662 | } | 662 | } |
@@ -672,12 +672,12 @@ int ZEXPORT inflate(z_streamp strm, int flush) { | |||
672 | NEEDBITS(16); | 672 | NEEDBITS(16); |
673 | state->flags = (int)(hold); | 673 | state->flags = (int)(hold); |
674 | if ((state->flags & 0xff) != Z_DEFLATED) { | 674 | if ((state->flags & 0xff) != Z_DEFLATED) { |
675 | strm->msg = (char *)"unknown compression method"; | 675 | strm->msg = (z_const char *)"unknown compression method"; |
676 | state->mode = BAD; | 676 | state->mode = BAD; |
677 | break; | 677 | break; |
678 | } | 678 | } |
679 | if (state->flags & 0xe000) { | 679 | if (state->flags & 0xe000) { |
680 | strm->msg = (char *)"unknown header flags set"; | 680 | strm->msg = (z_const char *)"unknown header flags set"; |
681 | state->mode = BAD; | 681 | state->mode = BAD; |
682 | break; | 682 | break; |
683 | } | 683 | } |
@@ -793,7 +793,7 @@ int ZEXPORT inflate(z_streamp strm, int flush) { | |||
793 | if (state->flags & 0x0200) { | 793 | if (state->flags & 0x0200) { |
794 | NEEDBITS(16); | 794 | NEEDBITS(16); |
795 | if ((state->wrap & 4) && hold != (state->check & 0xffff)) { | 795 | if ((state->wrap & 4) && hold != (state->check & 0xffff)) { |
796 | strm->msg = (char *)"header crc mismatch"; | 796 | strm->msg = (z_const char *)"header crc mismatch"; |
797 | state->mode = BAD; | 797 | state->mode = BAD; |
798 | break; | 798 | break; |
799 | } | 799 | } |
@@ -855,7 +855,7 @@ int ZEXPORT inflate(z_streamp strm, int flush) { | |||
855 | state->mode = TABLE; | 855 | state->mode = TABLE; |
856 | break; | 856 | break; |
857 | case 3: | 857 | case 3: |
858 | strm->msg = (char *)"invalid block type"; | 858 | strm->msg = (z_const char *)"invalid block type"; |
859 | state->mode = BAD; | 859 | state->mode = BAD; |
860 | } | 860 | } |
861 | DROPBITS(2); | 861 | DROPBITS(2); |
@@ -864,7 +864,7 @@ int ZEXPORT inflate(z_streamp strm, int flush) { | |||
864 | BYTEBITS(); /* go to byte boundary */ | 864 | BYTEBITS(); /* go to byte boundary */ |
865 | NEEDBITS(32); | 865 | NEEDBITS(32); |
866 | if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { | 866 | if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { |
867 | strm->msg = (char *)"invalid stored block lengths"; | 867 | strm->msg = (z_const char *)"invalid stored block lengths"; |
868 | state->mode = BAD; | 868 | state->mode = BAD; |
869 | break; | 869 | break; |
870 | } | 870 | } |
@@ -905,7 +905,7 @@ int ZEXPORT inflate(z_streamp strm, int flush) { | |||
905 | DROPBITS(4); | 905 | DROPBITS(4); |
906 | #ifndef PKZIP_BUG_WORKAROUND | 906 | #ifndef PKZIP_BUG_WORKAROUND |
907 | if (state->nlen > 286 || state->ndist > 30) { | 907 | if (state->nlen > 286 || state->ndist > 30) { |
908 | strm->msg = (char *)"too many length or distance symbols"; | 908 | strm->msg = (z_const char *)"too many length or distance symbols"; |
909 | state->mode = BAD; | 909 | state->mode = BAD; |
910 | break; | 910 | break; |
911 | } | 911 | } |
@@ -928,7 +928,7 @@ int ZEXPORT inflate(z_streamp strm, int flush) { | |||
928 | ret = inflate_table(CODES, state->lens, 19, &(state->next), | 928 | ret = inflate_table(CODES, state->lens, 19, &(state->next), |
929 | &(state->lenbits), state->work); | 929 | &(state->lenbits), state->work); |
930 | if (ret) { | 930 | if (ret) { |
931 | strm->msg = (char *)"invalid code lengths set"; | 931 | strm->msg = (z_const char *)"invalid code lengths set"; |
932 | state->mode = BAD; | 932 | state->mode = BAD; |
933 | break; | 933 | break; |
934 | } | 934 | } |
@@ -952,7 +952,7 @@ int ZEXPORT inflate(z_streamp strm, int flush) { | |||
952 | NEEDBITS(here.bits + 2); | 952 | NEEDBITS(here.bits + 2); |
953 | DROPBITS(here.bits); | 953 | DROPBITS(here.bits); |
954 | if (state->have == 0) { | 954 | if (state->have == 0) { |
955 | strm->msg = (char *)"invalid bit length repeat"; | 955 | strm->msg = (z_const char *)"invalid bit length repeat"; |
956 | state->mode = BAD; | 956 | state->mode = BAD; |
957 | break; | 957 | break; |
958 | } | 958 | } |
@@ -975,7 +975,7 @@ int ZEXPORT inflate(z_streamp strm, int flush) { | |||
975 | DROPBITS(7); | 975 | DROPBITS(7); |
976 | } | 976 | } |
977 | if (state->have + copy > state->nlen + state->ndist) { | 977 | if (state->have + copy > state->nlen + state->ndist) { |
978 | strm->msg = (char *)"invalid bit length repeat"; | 978 | strm->msg = (z_const char *)"invalid bit length repeat"; |
979 | state->mode = BAD; | 979 | state->mode = BAD; |
980 | break; | 980 | break; |
981 | } | 981 | } |
@@ -989,7 +989,7 @@ int ZEXPORT inflate(z_streamp strm, int flush) { | |||
989 | 989 | ||
990 | /* check for end-of-block code (better have one) */ | 990 | /* check for end-of-block code (better have one) */ |
991 | if (state->lens[256] == 0) { | 991 | if (state->lens[256] == 0) { |
992 | strm->msg = (char *)"invalid code -- missing end-of-block"; | 992 | strm->msg = (z_const char *)"invalid code -- missing end-of-block"; |
993 | state->mode = BAD; | 993 | state->mode = BAD; |
994 | break; | 994 | break; |
995 | } | 995 | } |
@@ -1003,7 +1003,7 @@ int ZEXPORT inflate(z_streamp strm, int flush) { | |||
1003 | ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), | 1003 | ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), |
1004 | &(state->lenbits), state->work); | 1004 | &(state->lenbits), state->work); |
1005 | if (ret) { | 1005 | if (ret) { |
1006 | strm->msg = (char *)"invalid literal/lengths set"; | 1006 | strm->msg = (z_const char *)"invalid literal/lengths set"; |
1007 | state->mode = BAD; | 1007 | state->mode = BAD; |
1008 | break; | 1008 | break; |
1009 | } | 1009 | } |
@@ -1012,7 +1012,7 @@ int ZEXPORT inflate(z_streamp strm, int flush) { | |||
1012 | ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, | 1012 | ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, |
1013 | &(state->next), &(state->distbits), state->work); | 1013 | &(state->next), &(state->distbits), state->work); |
1014 | if (ret) { | 1014 | if (ret) { |
1015 | strm->msg = (char *)"invalid distances set"; | 1015 | strm->msg = (z_const char *)"invalid distances set"; |
1016 | state->mode = BAD; | 1016 | state->mode = BAD; |
1017 | break; | 1017 | break; |
1018 | } | 1018 | } |
@@ -1066,7 +1066,7 @@ int ZEXPORT inflate(z_streamp strm, int flush) { | |||
1066 | break; | 1066 | break; |
1067 | } | 1067 | } |
1068 | if (here.op & 64) { | 1068 | if (here.op & 64) { |
1069 | strm->msg = (char *)"invalid literal/length code"; | 1069 | strm->msg = (z_const char *)"invalid literal/length code"; |
1070 | state->mode = BAD; | 1070 | state->mode = BAD; |
1071 | break; | 1071 | break; |
1072 | } | 1072 | } |
@@ -1104,7 +1104,7 @@ int ZEXPORT inflate(z_streamp strm, int flush) { | |||
1104 | DROPBITS(here.bits); | 1104 | DROPBITS(here.bits); |
1105 | state->back += here.bits; | 1105 | state->back += here.bits; |
1106 | if (here.op & 64) { | 1106 | if (here.op & 64) { |
1107 | strm->msg = (char *)"invalid distance code"; | 1107 | strm->msg = (z_const char *)"invalid distance code"; |
1108 | state->mode = BAD; | 1108 | state->mode = BAD; |
1109 | break; | 1109 | break; |
1110 | } | 1110 | } |
@@ -1121,7 +1121,7 @@ int ZEXPORT inflate(z_streamp strm, int flush) { | |||
1121 | } | 1121 | } |
1122 | #ifdef INFLATE_STRICT | 1122 | #ifdef INFLATE_STRICT |
1123 | if (state->offset > state->dmax) { | 1123 | if (state->offset > state->dmax) { |
1124 | strm->msg = (char *)"invalid distance too far back"; | 1124 | strm->msg = (z_const char *)"invalid distance too far back"; |
1125 | state->mode = BAD; | 1125 | state->mode = BAD; |
1126 | break; | 1126 | break; |
1127 | } | 1127 | } |
@@ -1136,7 +1136,7 @@ int ZEXPORT inflate(z_streamp strm, int flush) { | |||
1136 | copy = state->offset - copy; | 1136 | copy = state->offset - copy; |
1137 | if (copy > state->whave) { | 1137 | if (copy > state->whave) { |
1138 | if (state->sane) { | 1138 | if (state->sane) { |
1139 | strm->msg = (char *)"invalid distance too far back"; | 1139 | strm->msg = (z_const char *)"invalid distance too far back"; |
1140 | state->mode = BAD; | 1140 | state->mode = BAD; |
1141 | break; | 1141 | break; |
1142 | } | 1142 | } |
@@ -1195,7 +1195,7 @@ int ZEXPORT inflate(z_streamp strm, int flush) { | |||
1195 | state->flags ? hold : | 1195 | state->flags ? hold : |
1196 | #endif | 1196 | #endif |
1197 | ZSWAP32(hold)) != state->check) { | 1197 | ZSWAP32(hold)) != state->check) { |
1198 | strm->msg = (char *)"incorrect data check"; | 1198 | strm->msg = (z_const char *)"incorrect data check"; |
1199 | state->mode = BAD; | 1199 | state->mode = BAD; |
1200 | break; | 1200 | break; |
1201 | } | 1201 | } |
@@ -1209,7 +1209,7 @@ int ZEXPORT inflate(z_streamp strm, int flush) { | |||
1209 | if (state->wrap && state->flags) { | 1209 | if (state->wrap && state->flags) { |
1210 | NEEDBITS(32); | 1210 | NEEDBITS(32); |
1211 | if ((state->wrap & 4) && hold != (state->total & 0xffffffff)) { | 1211 | if ((state->wrap & 4) && hold != (state->total & 0xffffffff)) { |
1212 | strm->msg = (char *)"incorrect length check"; | 1212 | strm->msg = (z_const char *)"incorrect length check"; |
1213 | state->mode = BAD; | 1213 | state->mode = BAD; |
1214 | break; | 1214 | break; |
1215 | } | 1215 | } |