1
0
mirror of https://github.com/madler/zlib.git synced 2026-10-24 02:48:53 +03:00

Clean up the use of switch cases.

This commit is contained in:
Mark Adler
2026-02-10 18:24:49 -08:00
parent 5a153ade3f
commit fb8dd62f77
4 changed files with 10 additions and 8 deletions

View File

@@ -267,6 +267,10 @@ local int gz_fetch(gz_statep state) {
strm->next_out = state->out;
if (gz_decomp(state) == -1)
return -1;
break;
default:
gz_error(state, Z_STREAM_ERROR, "state corrupt");
return -1;
}
} while (state->x.have == 0 && (!state->eof || strm->avail_in));
return 0;

View File

@@ -252,7 +252,7 @@ int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc,
state->last ? " (last)" : ""));
state->mode = TABLE;
break;
case 3:
default:
strm->msg = (z_const char *)"invalid block type";
state->mode = BAD;
}

View File

@@ -738,7 +738,7 @@ int ZEXPORT inflate(z_streamp strm, int flush) {
state->last ? " (last)" : ""));
state->mode = TABLE;
break;
case 3:
default:
strm->msg = (z_const char *)"invalid block type";
state->mode = BAD;
}

View File

@@ -57,9 +57,9 @@ int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens,
unsigned mask; /* mask for low root bits */
code here; /* table entry for duplication */
code FAR *next; /* next available space in table */
const unsigned short FAR *base; /* base value table to use */
const unsigned short FAR *extra; /* extra bits table to use */
unsigned match; /* use base and extra for symbol >= match */
const unsigned short FAR *base = NULL; /* base value table to use */
const unsigned short FAR *extra = NULL; /* extra bits table to use */
unsigned match = 0; /* use base and extra for symbol >= match */
unsigned short count[MAXBITS+1]; /* number of codes of each length */
unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
static const unsigned short lbase[31] = { /* Length codes 257..285 base */
@@ -185,7 +185,6 @@ int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens,
/* set up for code type */
switch (type) {
case CODES:
base = extra = work; /* dummy value--not used */
match = 20;
break;
case LENS:
@@ -193,10 +192,9 @@ int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens,
extra = lext;
match = 257;
break;
default: /* DISTS */
case DISTS:
base = dbase;
extra = dext;
match = 0;
}
/* initialize state for loop */