Skip to content

Commit cd56b18

Browse files
committed
base64: fix for unsigned chars (e.g. ARM).
``` ccan/ccan/base64/base64.c:34:10: error: result of comparison of constant 255 with expression of type 'int8_t' (aka 'signed char') is always false [-Werror,-Wtautological-constant-out-of-range-compare] if (ret == (char)0xff) { ~~~ ^ ~~~~~~~~~~ ccan/ccan/base64/base64.c:44:57: error: result of comparison of constant 255 with expression of type 'const signed char' is always true [-Werror,-Wtautological-constant-out-of-range-compare] return (maps->decode_map[(const unsigned char)b64char] != (char)0xff); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~ ``` Reported-by: Christian Decker Signed-off-by: Rusty Russell <[email protected]>
1 parent 3beff01 commit cd56b18

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ccan/base64/base64.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static int8_t sixbit_from_b64(const base64_maps_t *maps,
3131
int8_t ret;
3232

3333
ret = maps->decode_map[(unsigned char)b64letter];
34-
if (ret == (char)0xff) {
34+
if (ret == '\xff') {
3535
errno = EDOM;
3636
return -1;
3737
}
@@ -41,7 +41,7 @@ static int8_t sixbit_from_b64(const base64_maps_t *maps,
4141

4242
bool base64_char_in_alphabet(const base64_maps_t *maps, const char b64char)
4343
{
44-
return (maps->decode_map[(const unsigned char)b64char] != (char)0xff);
44+
return (maps->decode_map[(const unsigned char)b64char] != '\xff');
4545
}
4646

4747
void base64_init_maps(base64_maps_t *dest, const char src[64])

0 commit comments

Comments
 (0)