X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=rfc2047.c;h=c67085800aa6dd3f73942a6304b16c854b12aadd;hp=ebf29e0f4229d8bcff3064788d46f50866e3f731;hb=841934011451205d8295ac955486f06c317fdf15;hpb=01a3f4d932ddfc7f4a58f820d343f4a6f3b0f824 diff --git a/rfc2047.c b/rfc2047.c index ebf29e0..c670858 100644 --- a/rfc2047.c +++ b/rfc2047.c @@ -33,7 +33,7 @@ #endif #define ENCWORD_LEN_MAX 75 -#define ENCWORD_LEN_MIN 9 /* strlen ("=?.?.?.?=") */ +#define ENCWORD_LEN_MIN 9 /* mutt_strlen ("=?.?.?.?=") */ #define HSPACE(x) ((x) == '\0' || (x) == ' ' || (x) == '\t') @@ -91,7 +91,7 @@ char *mutt_choose_charset (const char *fromcode, const char *charsets, q = strchr (p, ':'); - n = q ? q - p : strlen (p); + n = q ? q - p : mutt_strlen (p); if (!n || /* Assume that we never need more than 12 characters of @@ -144,7 +144,7 @@ static size_t b_encoder (char *s, ICONV_CONST char *d, size_t dlen, char *s0 = s; memcpy (s, "=?", 2), s += 2; - memcpy (s, tocode, strlen (tocode)), s += strlen (tocode); + memcpy (s, tocode, mutt_strlen (tocode)), s += mutt_strlen (tocode); memcpy (s, "?B?", 3), s += 3; for (;;) { if (!dlen) @@ -182,7 +182,7 @@ static size_t q_encoder (char *s, ICONV_CONST char *d, size_t dlen, char *s0 = s; memcpy (s, "=?", 2), s += 2; - memcpy (s, tocode, strlen (tocode)), s += strlen (tocode); + memcpy (s, tocode, mutt_strlen (tocode)), s += mutt_strlen (tocode); memcpy (s, "?Q?", 3), s += 3; while (dlen--) { unsigned char c = *d++; @@ -224,7 +224,7 @@ static size_t try_block (ICONV_CONST char *d, size_t dlen, if (fromcode) { cd = mutt_iconv_open (tocode, fromcode, 0); assert (cd != (iconv_t) (-1)); - ib = d, ibl = dlen, ob = buf1, obl = sizeof (buf1) - strlen (tocode); + ib = d, ibl = dlen, ob = buf1, obl = sizeof (buf1) - mutt_strlen (tocode); if (iconv (cd, &ib, &ibl, &ob, &obl) == (size_t) (-1) || iconv (cd, 0, 0, &ob, &obl) == (size_t) (-1)) { assert (errno == E2BIG); @@ -235,8 +235,8 @@ static size_t try_block (ICONV_CONST char *d, size_t dlen, iconv_close (cd); } else { - if (dlen > sizeof (buf1) - strlen (tocode)) - return sizeof (buf1) - strlen (tocode) + 1; + if (dlen > sizeof (buf1) - mutt_strlen (tocode)) + return sizeof (buf1) - mutt_strlen (tocode) + 1; memcpy (buf1, d, dlen); ob = buf1 + dlen; } @@ -251,7 +251,7 @@ static size_t try_block (ICONV_CONST char *d, size_t dlen, ++count; } - len = ENCWORD_LEN_MIN - 2 + strlen (tocode); + len = ENCWORD_LEN_MIN - 2 + mutt_strlen (tocode); len_b = len + (((ob - buf1) + 2) / 3) * 4; len_q = len + (ob - buf1) + 2 * count; @@ -290,7 +290,7 @@ static size_t encode_block (char *s, char *d, size_t dlen, if (fromcode) { cd = mutt_iconv_open (tocode, fromcode, 0); assert (cd != (iconv_t) (-1)); - ib = d, ibl = dlen, ob = buf1, obl = sizeof (buf1) - strlen (tocode); + ib = d, ibl = dlen, ob = buf1, obl = sizeof (buf1) - mutt_strlen (tocode); n1 = iconv (cd, &ib, &ibl, &ob, &obl); n2 = iconv (cd, 0, 0, &ob, &obl); assert (n1 != (size_t) (-1) && n2 != (size_t) (-1)); @@ -477,15 +477,15 @@ static int rfc2047_encode (ICONV_CONST char *d, size_t dlen, int col, /* Add to output buffer. */ #define LINEBREAK "\n\t" - if (bufpos + wlen + strlen (LINEBREAK) > buflen) { - buflen = bufpos + wlen + strlen (LINEBREAK); + if (bufpos + wlen + mutt_strlen (LINEBREAK) > buflen) { + buflen = bufpos + wlen + mutt_strlen (LINEBREAK); safe_realloc (&buf, buflen); } r = encode_block (buf + bufpos, t, n, icode, tocode, encoder); assert (r == wlen); bufpos += wlen; - memcpy (buf + bufpos, LINEBREAK, strlen (LINEBREAK)); - bufpos += strlen (LINEBREAK); + memcpy (buf + bufpos, LINEBREAK, mutt_strlen (LINEBREAK)); + bufpos += mutt_strlen (LINEBREAK); #undef LINEBREAK col = 1; @@ -524,7 +524,7 @@ void _rfc2047_encode_string (char **pd, int encode_specials, int col) if (!charsets || !*charsets) charsets = "UTF-8"; - rfc2047_encode (*pd, strlen (*pd), col, + rfc2047_encode (*pd, mutt_strlen (*pd), col, Charset, charsets, &e, &elen, encode_specials ? RFC822Specials : NULL); @@ -535,7 +535,7 @@ void _rfc2047_encode_string (char **pd, int encode_specials, int col) void rfc2047_encode_adrlist (ADDRESS * addr, const char *tag) { ADDRESS *ptr = addr; - int col = tag ? strlen (tag) + 2 : 32; + int col = tag ? mutt_strlen (tag) + 2 : 32; while (ptr) { if (ptr->personal) @@ -556,7 +556,7 @@ static int rfc2047_decode_word (char *d, const char *s, size_t len) int enc = 0, count = 0; char *charset = NULL; - pd = d0 = safe_malloc (strlen (s)); + pd = d0 = safe_malloc (mutt_strlen (s)); for (pp = s; (pp1 = strchr (pp, '?')); pp = pp1 + 1) { count++; @@ -712,7 +712,7 @@ void rfc2047_decode (char **pd) if (!s || !*s) return; - dlen = 4 * strlen (s); /* should be enough */ + dlen = 4 * mutt_strlen (s); /* should be enough */ d = d0 = safe_malloc (dlen + 1); while (*s && dlen > 0) {