aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorLwisce Zeng <Lwisce.Zeng@garmin.com>2024-04-01 15:55:13 +0800
committerMark Adler <madler@alumni.caltech.edu>2024-04-01 11:49:05 -0700
commit2ba25b2ddab9aa939c321d087fcfca573a9cca55 (patch)
treebe7fc649f72cf901225a4a3e6d3c53c6e82d8f41 /examples
parentc5e87dcdef72abfb599579bb1b8176948be979c9 (diff)
downloadzlib-2ba25b2ddab9aa939c321d087fcfca573a9cca55.tar.gz
zlib-2ba25b2ddab9aa939c321d087fcfca573a9cca55.tar.bz2
zlib-2ba25b2ddab9aa939c321d087fcfca573a9cca55.zip
Use z_const for setting msg to literal strings.
Diffstat (limited to 'examples')
-rw-r--r--examples/gun.c18
1 files changed, 9 insertions, 9 deletions
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;