diff options
Diffstat (limited to 'src/string.c')
-rw-r--r-- | src/string.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/string.c b/src/string.c index cde82134..0869bc23 100644 --- a/src/string.c +++ b/src/string.c @@ -170,7 +170,11 @@ static const char b64_unmap[] = "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"; -static inline uint8_t unmap(const uint8_t in) { return b64_unmap[in] - 47; } +static inline uint8_t +unmap(const uint8_t in) +{ + return (uint8_t)(b64_unmap[in] - 47); +} /** Decode 4 base64 characters to 3 raw bytes. @@ -181,7 +185,7 @@ decode_chunk(const uint8_t in[4], uint8_t out[3]) out[0] = (uint8_t)(((unmap(in[0]) << 2)) | unmap(in[1]) >> 4); out[1] = (uint8_t)(((unmap(in[1]) << 4) & 0xF0) | unmap(in[2]) >> 2); out[2] = (uint8_t)(((unmap(in[2]) << 6) & 0xC0) | unmap(in[3])); - return 1 + (in[2] != '=') + ((in[2] != '=') && (in[3] != '=')); + return 1u + (in[2] != '=') + ((in[2] != '=') && (in[3] != '=')); } void* |