/*
+ * Copyright notice from original mutt:
* Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
* Copyright (C) 2000-2001 Edmund Grimley Evans <edmundo@rano.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ *
+ * This file is part of mutt-ng, see http://www.muttng.org/.
+ * It's licensed under the GNU General Public License,
+ * please see the file GPL in the top level source directory.
*/
#if HAVE_CONFIG_H
#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')
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
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)
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++;
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);
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;
}
++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;
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));
/* 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;
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);
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)
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++;
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) {