1
0
mirror of https://git.zap.org.au/git/trader.git synced 2024-06-09 19:20:43 +00:00

Avoid a Clang warning about a comparison that is always false

Rewrite a check that unscramble_table[] is of the right size as an
assertion, which prevents Clang from issuing a warning that the "result
of comparison of constant 256 with expression of type 'const unsigned
char' is always false".

Oh for the day that C11's _Static_assert can be used amongst all
compilers!  But perhaps Gnulib's assert-h module can be used instead...
This commit is contained in:
John Zaitseff 2018-08-08 13:50:15 +10:00
parent 0a1e837c4d
commit 097c9b0e5b

View File

@ -868,13 +868,13 @@ ssize_t b64decode (const void *restrict in, size_t inlen,
assert(u_in != NULL);
assert(u_out != NULL);
assert(outlen > 0);
assert(UNSCRAMBLE_TABLE_SIZE == UCHAR_MAX + 1);
count = 0;
n = 1;
for (size_t i = 0; i < inlen && *u_in != '\0'; i++, u_in++) {
int v = *u_in > UNSCRAMBLE_TABLE_SIZE ?
UNSCRAMBLE_INVALID : unscramble_table[*u_in];
int v = unscramble_table[*u_in];
switch (v) {
case UNSCRAMBLE_INVALID: