From db07006f505719a83bf358028fbf9c2dfb5dd464 Mon Sep 17 00:00:00 2001 From: Domingo Alvarez Duarte <mingodad@gmail.com> Date: Sat, 29 Nov 2014 13:26:22 -0800 Subject: [PATCH] On ARM chars are unsigned This code didn't worked on ARM, changing the table and parameters to int seems to work fine on any platform. --- third_party/base64.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/third_party/base64.c b/third_party/base64.c index 49a4f2492d..fcfa61ffab 100644 --- a/third_party/base64.c +++ b/third_party/base64.c @@ -190,10 +190,10 @@ struct base64_decodestate char result; }; -static char -base64_decode_value(char value) +static int +base64_decode_value(int value) { - static const char decoding[] = { + static const int decoding[] = { 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -2, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, @@ -202,8 +202,8 @@ base64_decode_value(char value) 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51 }; - static const char decoding_size = sizeof(decoding); - int codepos = (signed char) value; + static const int decoding_size = sizeof(decoding); + int codepos = value; codepos -= 43; if (codepos < 0 || codepos > decoding_size) return -1; @@ -226,7 +226,7 @@ base64_decode_block(const char *in_base64, int in_len, const char *in_end = in_base64 + in_len; char *out_pos = out_bin; char *out_end = out_bin + out_len; - char fragment; + int fragment; *out_pos = state->result; -- GitLab