X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=base64.c;h=9fdf0377afe51c48d89553d02ee2b84c7b9c5f19;hp=df55689ded9e882a6987c7b6cefb2adfc5adb7c5;hb=7d29626ce4e1fa932c6349c7253e6f774df069fc;hpb=81884ccb464c69a8dba9de1b97af261a8a02b2c7 diff --git a/base64.c b/base64.c index df55689..9fdf037 100644 --- a/base64.c +++ b/base64.c @@ -39,22 +39,20 @@ * */ -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include +#include #include "mutt.h" -#include "mime.h" /* raw bytes to null-terminated base 64 string */ -void mutt_to_base64 (unsigned char *out, const unsigned char *in, size_t len, - size_t olen) +void mutt_to_base64 (unsigned char *out, const unsigned char *in, ssize_t len, + ssize_t olen) { while (len >= 3 && olen > 10) { - *out++ = B64Chars[in[0] >> 2]; - *out++ = B64Chars[((in[0] << 4) & 0x30) | (in[1] >> 4)]; - *out++ = B64Chars[((in[1] << 2) & 0x3c) | (in[2] >> 6)]; - *out++ = B64Chars[in[2] & 0x3f]; + *out++ = __m_b64chars[in[0] >> 2]; + *out++ = __m_b64chars[((in[0] << 4) & 0x30) | (in[1] >> 4)]; + *out++ = __m_b64chars[((in[1] << 2) & 0x3c) | (in[2] >> 6)]; + *out++ = __m_b64chars[in[2] & 0x3f]; olen -= 4; len -= 3; in += 3; @@ -64,12 +62,12 @@ void mutt_to_base64 (unsigned char *out, const unsigned char *in, size_t len, if (len > 0 && olen > 4) { unsigned char fragment; - *out++ = B64Chars[in[0] >> 2]; + *out++ = __m_b64chars[in[0] >> 2]; fragment = (in[0] << 4) & 0x30; if (len > 1) fragment |= in[1] >> 4; - *out++ = B64Chars[fragment]; - *out++ = (len < 2) ? '=' : B64Chars[(in[1] << 2) & 0x3c]; + *out++ = __m_b64chars[fragment]; + *out++ = (len < 2) ? '=' : __m_b64chars[(in[1] << 2) & 0x3c]; *out++ = '='; } *out = '\0';