# define base_decode_context base32_decode_context
# define base_decode_ctx_init base32_decode_ctx_init
# define base_decode_ctx base32_decode_ctx
-# define isbase isbase32
+# define isubase isubase32
#elif BASE_TYPE == 64
# define BASE_LENGTH BASE64_LENGTH
# define REQUIRED_PADDING base64_required_padding
# define base_decode_context base64_decode_context
# define base_decode_ctx_init base64_decode_ctx_init
# define base_decode_ctx base64_decode_ctx
-# define isbase isbase64
+# define isubase isubase64
#elif BASE_TYPE == 42
static int (*base_length) (int i);
static int (*required_padding) (int i);
-static bool (*isbase) (char ch);
+static bool (*isubase) (unsigned char ch);
static void (*base_encode) (char const *restrict in, idx_t inlen,
char *restrict out, idx_t outlen);
}
static bool
-isbase64url (char ch)
+isubase64url (unsigned char ch)
{
return (ch == '-' || ch == '_'
- || (ch != '+' && ch != '/' && isbase64 (ch)));
+ || (ch != '+' && ch != '/' && isubase64 (ch)));
}
static void
inline static bool
-isbase32hex (char ch)
+isubase32hex (unsigned char ch)
{
return ('0' <= ch && ch <= '9') || ('A' <= ch && ch <= 'V');
}
char *p = ctx->inbuf;
while (i--)
{
- if (isbase32hex (*in))
- *p = base32_hex_to_norm[ (int)*in - 0x30];
+ if (isubase32hex (*in))
+ *p = base32_hex_to_norm[*in - 0x30];
else
*p = *in;
++p;
}
static bool
-isbase16 (char ch)
+isubase16 (unsigned char ch)
{
- return isxdigit (to_uchar (ch));
+ return isxdigit (ch);
}
static int
}
static bool
-isz85 (char ch)
+isuz85 (unsigned char ch)
{
return c_isalnum (ch) || strchr (".-:+=^!/*?&<>()[]{}@%$#", ch) != nullptr;
}
inline static bool
-isbase2 (char ch)
+isubase2 (unsigned char ch)
{
return ch == '0' || ch == '1';
}
continue;
}
- if (!isbase2 (*in))
+ if (!isubase2 (*in))
return false;
bool bit = (*in == '1');
continue;
}
- if (!isbase2 (*in))
+ if (!isubase2 (*in))
return false;
bool bit = (*in == '1');
{
for (idx_t i = 0; n > 0 && i < n;)
{
- if (isbase (inbuf[sum + i]) || inbuf[sum + i] == '=')
+ if (isubase (inbuf[sum + i]) || inbuf[sum + i] == '=')
i++;
else
memmove (inbuf + sum + i, inbuf + sum + i + 1, --n - i);
case BASE64_OPTION:
base_length = base64_length_wrapper;
required_padding = base64_required_padding;
- isbase = isbase64;
+ isubase = isubase64;
base_encode = base64_encode;
base_decode_ctx_init = base64_decode_ctx_init_wrapper;
base_decode_ctx = base64_decode_ctx_wrapper;
case BASE64URL_OPTION:
base_length = base64_length_wrapper;
required_padding = base64_required_padding;
- isbase = isbase64url;
+ isubase = isubase64url;
base_encode = base64url_encode;
base_decode_ctx_init = base64url_decode_ctx_init_wrapper;
base_decode_ctx = base64url_decode_ctx_wrapper;
case BASE32_OPTION:
base_length = base32_length_wrapper;
required_padding = base32_required_padding;
- isbase = isbase32;
+ isubase = isubase32;
base_encode = base32_encode;
base_decode_ctx_init = base32_decode_ctx_init_wrapper;
base_decode_ctx = base32_decode_ctx_wrapper;
case BASE32HEX_OPTION:
base_length = base32_length_wrapper;
required_padding = base32_required_padding;
- isbase = isbase32hex;
+ isubase = isubase32hex;
base_encode = base32hex_encode;
base_decode_ctx_init = base32hex_decode_ctx_init_wrapper;
base_decode_ctx = base32hex_decode_ctx_wrapper;
case BASE16_OPTION:
base_length = base16_length;
required_padding = no_required_padding;
- isbase = isbase16;
+ isubase = isubase16;
base_encode = base16_encode;
base_decode_ctx_init = base16_decode_ctx_init;
base_decode_ctx = base16_decode_ctx;
case BASE2MSBF_OPTION:
base_length = base2_length;
required_padding = no_required_padding;
- isbase = isbase2;
+ isubase = isubase2;
base_encode = base2msbf_encode;
base_decode_ctx_init = base2_decode_ctx_init;
base_decode_ctx = base2msbf_decode_ctx;
case BASE2LSBF_OPTION:
base_length = base2_length;
required_padding = no_required_padding;
- isbase = isbase2;
+ isubase = isubase2;
base_encode = base2lsbf_encode;
base_decode_ctx_init = base2_decode_ctx_init;
base_decode_ctx = base2lsbf_decode_ctx;
case Z85_OPTION:
base_length = z85_length;
required_padding = no_required_padding;
- isbase = isz85;
+ isubase = isuz85;
base_encode = z85_encode;
base_decode_ctx_init = z85_decode_ctx_init;
base_decode_ctx = z85_decode_ctx;