From: Pierre Habouzit Date: Wed, 15 Aug 2007 22:59:29 +0000 (+0200) Subject: Hide useless public api X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=9e2951a515b7fe75d244f9388a2ac3f3e3e3a67a;p=apps%2Fmadmutt.git Hide useless public api Signed-off-by: Pierre Habouzit --- diff --git a/handler.c b/handler.c index d3a3773..11ff8a2 100644 --- a/handler.c +++ b/handler.c @@ -189,85 +189,6 @@ static void mutt_decode_quoted (STATE * s, long len, int istext, iconv_t cd) state_reset_prefix (s); } -void mutt_decode_base64 (STATE * s, long len, int istext, iconv_t cd) -{ - char buf[5]; - int c1, c2, c3, c4, ch, cr = 0, i; - char bufi[BUFI_SIZE]; - ssize_t l = 0; - - buf[4] = 0; - - if (istext) - state_set_prefix (s); - - while (len > 0) { - for (i = 0; i < 4 && len > 0; len--) { - if ((ch = fgetc (s->fpin)) == EOF) - break; - if (base64val(ch) >= 0 || ch == '=') - buf[i++] = ch; - } - if (i != 4) { - break; - } - - c1 = base64val(buf[0]); - c2 = base64val(buf[1]); - ch = (c1 << 2) | (c2 >> 4); - - if (cr && ch != '\n') - bufi[l++] = '\r'; - - cr = 0; - - if (istext && ch == '\r') - cr = 1; - else - bufi[l++] = ch; - - if (buf[2] == '=') - break; - c3 = base64val(buf[2]); - ch = ((c2 & 0xf) << 4) | (c3 >> 2); - - if (cr && ch != '\n') - bufi[l++] = '\r'; - - cr = 0; - - if (istext && ch == '\r') - cr = 1; - else - bufi[l++] = ch; - - if (buf[3] == '=') - break; - c4 = base64val(buf[3]); - ch = ((c3 & 0x3) << 6) | c4; - - if (cr && ch != '\n') - bufi[l++] = '\r'; - cr = 0; - - if (istext && ch == '\r') - cr = 1; - else - bufi[l++] = ch; - - if (l + 8 >= ssizeof (bufi)) - mutt_convert_to_state (cd, bufi, &l, s); - } - - if (cr) - bufi[l++] = '\r'; - - mutt_convert_to_state (cd, bufi, &l, s); - mutt_convert_to_state (cd, 0, 0, s); - - state_reset_prefix (s); -} - static unsigned char decode_byte(int ch) { return ch == 96 ? 0 : ch - 32; @@ -1236,6 +1157,85 @@ static int external_body_handler (BODY * b, STATE * s) return (0); } +static void mutt_decode_base64(STATE *s, long len, int istext, iconv_t cd) +{ + char buf[5]; + int c1, c2, c3, c4, ch, cr = 0, i; + char bufi[BUFI_SIZE]; + ssize_t l = 0; + + buf[4] = 0; + + if (istext) + state_set_prefix (s); + + while (len > 0) { + for (i = 0; i < 4 && len > 0; len--) { + if ((ch = fgetc (s->fpin)) == EOF) + break; + if (base64val(ch) >= 0 || ch == '=') + buf[i++] = ch; + } + if (i != 4) { + break; + } + + c1 = base64val(buf[0]); + c2 = base64val(buf[1]); + ch = (c1 << 2) | (c2 >> 4); + + if (cr && ch != '\n') + bufi[l++] = '\r'; + + cr = 0; + + if (istext && ch == '\r') + cr = 1; + else + bufi[l++] = ch; + + if (buf[2] == '=') + break; + c3 = base64val(buf[2]); + ch = ((c2 & 0xf) << 4) | (c3 >> 2); + + if (cr && ch != '\n') + bufi[l++] = '\r'; + + cr = 0; + + if (istext && ch == '\r') + cr = 1; + else + bufi[l++] = ch; + + if (buf[3] == '=') + break; + c4 = base64val(buf[3]); + ch = ((c3 & 0x3) << 6) | c4; + + if (cr && ch != '\n') + bufi[l++] = '\r'; + cr = 0; + + if (istext && ch == '\r') + cr = 1; + else + bufi[l++] = ch; + + if (l + 8 >= ssizeof (bufi)) + mutt_convert_to_state (cd, bufi, &l, s); + } + + if (cr) + bufi[l++] = '\r'; + + mutt_convert_to_state (cd, bufi, &l, s); + mutt_convert_to_state (cd, 0, 0, s); + + state_reset_prefix (s); +} + void mutt_decode_attachment (BODY * b, STATE * s) { int istext = mutt_is_text_part (b); diff --git a/handler.h b/handler.h index 3109da4..f723f99 100644 --- a/handler.h +++ b/handler.h @@ -13,6 +13,5 @@ int mutt_body_handler (BODY *, STATE *); void mutt_decode_attachment (BODY *, STATE *); -void mutt_decode_base64 (STATE * s, long len, int istext, iconv_t cd); #endif /* !_MUTT_HANDLER_H */