summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
01a3f4d)
drop strlen() in favour of mutt_strlen()
git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@198
e385b8ad-14ed-0310-8656-
cc95a2468c6d
42 files changed:
if (!(data = (NNTP_DATA *) tmp->data))
continue;
if (prefix && *prefix && strncmp (prefix, data->group,
if (!(data = (NNTP_DATA *) tmp->data))
continue;
if (prefix && *prefix && strncmp (prefix, data->group,
+ mutt_strlen (prefix)) != 0)
continue;
if (!((regexec (Mask.rx, data->group, 0, NULL, 0) == 0) ^ Mask.not))
continue;
continue;
if (!((regexec (Mask.rx, data->group, 0, NULL, 0) == 0) ^ Mask.not))
continue;
strfcpy (LastDir, state.entry[menu->current].name,
sizeof (LastDir));
/* tack on delimiter here */
strfcpy (LastDir, state.entry[menu->current].name,
sizeof (LastDir));
/* tack on delimiter here */
- n = strlen (LastDir) + 1;
+ n = mutt_strlen (LastDir) + 1;
/* special case "" needs no delimiter */
url_parse_ciss (&url, state.entry[menu->current].name);
/* special case "" needs no delimiter */
url_parse_ciss (&url, state.entry[menu->current].name);
pos = 0;
first = 1;
buffylist[0] = 0;
pos = 0;
first = 1;
buffylist[0] = 0;
- pos += strlen (strncat (buffylist, _("New mail in "), sizeof (buffylist) - 1 - pos)); /* __STRNCAT_CHECKED__ */
+ pos += mutt_strlen (strncat (buffylist, _("New mail in "), sizeof (buffylist) - 1 - pos)); /* __STRNCAT_CHECKED__ */
for (tmp = Incoming; tmp; tmp = tmp->next) {
/* Is there new mail in this mailbox? */
if (tmp->new <= 0 || (have_unnotified && tmp->notified))
for (tmp = Incoming; tmp; tmp = tmp->next) {
/* Is there new mail in this mailbox? */
if (tmp->new <= 0 || (have_unnotified && tmp->notified))
strfcpy (path, tmp->path, sizeof (path));
mutt_pretty_mailbox (path);
strfcpy (path, tmp->path, sizeof (path));
mutt_pretty_mailbox (path);
- if (!first && pos + strlen (path) >= COLS - 7)
+ if (!first && pos + mutt_strlen (path) >= COLS - 7)
- pos += strlen (strncat (buffylist + pos, ", ", sizeof (buffylist) - 1 - pos)); /* __STRNCAT_CHECKED__ */
+ pos += mutt_strlen (strncat (buffylist + pos, ", ", sizeof (buffylist) - 1 - pos)); /* __STRNCAT_CHECKED__ */
/* Prepend an asterisk to mailboxes not already notified */
if (!tmp->notified) {
/* Prepend an asterisk to mailboxes not already notified */
if (!tmp->notified) {
- /* pos += strlen (strncat(buffylist + pos, "*", sizeof(buffylist)-1-pos)); __STRNCAT_CHECKED__ */
+ /* pos += mutt_strlen (strncat(buffylist + pos, "*", sizeof(buffylist)-1-pos)); __STRNCAT_CHECKED__ */
tmp->notified = 1;
BuffyNotify--;
}
tmp->notified = 1;
BuffyNotify--;
}
- pos += strlen (strncat (buffylist + pos, path, sizeof (buffylist) - 1 - pos)); /* __STRNCAT_CHECKED__ */
+ pos += mutt_strlen (strncat (buffylist + pos, path, sizeof (buffylist) - 1 - pos)); /* __STRNCAT_CHECKED__ */
first = 0;
}
if (!first && tmp) {
first = 0;
}
if (!first && tmp) {
for (t = inrepls; *t; t++) {
ICONV_CONST char *ib1 = *t;
for (t = inrepls; *t; t++) {
ICONV_CONST char *ib1 = *t;
- size_t ibl1 = strlen (*t);
+ size_t ibl1 = mutt_strlen (*t);
char *ob1 = ob;
size_t obl1 = obl;
char *ob1 = ob;
size_t obl1 = obl;
outrepl = "?";
iconv (cd, 0, 0, &ob, &obl);
if (obl) {
outrepl = "?";
iconv (cd, 0, 0, &ob, &obl);
if (obl) {
- int n = strlen (outrepl);
+ int n = mutt_strlen (outrepl);
if (n > obl) {
outrepl = "?";
if (n > obl) {
outrepl = "?";
ib = s, ibl = len + 1;
obl = MB_LEN_MAX * ibl;
ob = buf = safe_malloc (obl + 1);
ib = s, ibl = len + 1;
obl = MB_LEN_MAX * ibl;
ob = buf = safe_malloc (obl + 1);
- else if (key && !strncmp (buf, key, strlen (key)) &&
- (!*key || buf[strlen (key)] == ' ')) {
+ else if (key && !strncmp (buf, key, mutt_strlen (key)) &&
+ (!*key || buf[mutt_strlen (key)] == ' ')) {
c = buf;
ext = 0;
while (*c && (*c != '\r') && (*c != '\n'))
c = buf;
ext = 0;
while (*c && (*c != '\r') && (*c != '\n'))
size_t l;
for (p = b->parameter; p; p = p->next) {
size_t l;
for (p = b->parameter; p; p = p->next) {
rfc822_cat (tmp, sizeof (tmp), p->value, MimeSpecials);
snprintf (buf + l, sizeof (buf) - l, "; %s=%s", p->attribute, tmp);
rfc822_cat (tmp, sizeof (tmp), p->value, MimeSpecials);
snprintf (buf + l, sizeof (buf) - l, "; %s=%s", p->attribute, tmp);
/* check to see if it is a directory */
if (dirpart[0]) {
strfcpy (buf, exp_dirpart, sizeof (buf));
/* check to see if it is a directory */
if (dirpart[0]) {
strfcpy (buf, exp_dirpart, sizeof (buf));
- strfcpy (buf + strlen (buf), "/", sizeof (buf) - strlen (buf));
+ strfcpy (buf + mutt_strlen (buf), "/", sizeof (buf) - mutt_strlen (buf));
- strfcpy (buf + strlen (buf), filepart, sizeof (buf) - strlen (buf));
+ strfcpy (buf + mutt_strlen (buf), filepart, sizeof (buf) - mutt_strlen (buf));
if (stat (buf, &st) != -1 && (st.st_mode & S_IFDIR))
if (stat (buf, &st) != -1 && (st.st_mode & S_IFDIR))
- strfcpy (filepart + strlen (filepart), "/",
- sizeof (filepart) - strlen (filepart));
+ strfcpy (filepart + mutt_strlen (filepart), "/",
+ sizeof (filepart) - mutt_strlen (filepart));
strfcpy (s, dirpart, slen);
if (mutt_strcmp ("/", dirpart) != 0 && dirpart[0] != '='
&& dirpart[0] != '+')
strfcpy (s, dirpart, slen);
if (mutt_strcmp ("/", dirpart) != 0 && dirpart[0] != '='
&& dirpart[0] != '+')
- strfcpy (s + strlen (s), "/", slen - strlen (s));
- strfcpy (s + strlen (s), filepart, slen - strlen (s));
+ strfcpy (s + mutt_strlen (s), "/", slen - mutt_strlen (s));
+ strfcpy (s + mutt_strlen (s), filepart, slen - mutt_strlen (s));
}
else
strfcpy (s, filepart, slen);
}
else
strfcpy (s, filepart, slen);
/* Uncompress to /tmp */
mutt_mktemp (tmppath);
/* Uncompress to /tmp */
mutt_mktemp (tmppath);
- ctx->path = safe_malloc (strlen (tmppath) + 1);
+ ctx->path = safe_malloc (mutt_strlen (tmppath) + 1);
strcpy (ctx->path, tmppath);
}
strcpy (ctx->path, tmppath);
}
if (k->kobj && k->kobj->subkeys) {
s = k->kobj->subkeys->keyid;
if (k->kobj && k->kobj->subkeys) {
s = k->kobj->subkeys->keyid;
- if ((!option (OPTPGPLONGIDS)) && (strlen (s) == 16))
+ if ((!option (OPTPGPLONGIDS)) && (mutt_strlen (s) == 16))
/* Return only the short keyID. */
s += 8;
}
/* Return only the short keyID. */
s += 8;
}
return;
is_pgp = (key->protocol == GPGME_PROTOCOL_OpenPGP);
return;
is_pgp = (key->protocol == GPGME_PROTOCOL_OpenPGP);
- buf = safe_malloc (strlen (prefix) + strlen (s) * 4 + 2);
+ buf = safe_malloc (mutt_strlen (prefix) + mutt_strlen (s) * 4 + 2);
strcpy (buf, prefix); /* __STRCPY_CHECKED__ */
strcpy (buf, prefix); /* __STRCPY_CHECKED__ */
- p = buf + strlen (buf);
- if (is_pgp && strlen (s) == 40) { /* PGP v4 style formatted. */
+ p = buf + mutt_strlen (buf);
+ if (is_pgp && mutt_strlen (s) == 40) { /* PGP v4 style formatted. */
for (i = 0; *s && s[1] && s[2] && s[3] && s[4]; s += 4, i++) {
*p++ = s[0];
*p++ = s[1];
for (i = 0; *s && s[1] && s[2] && s[3] && s[4]; s += 4, i++) {
*p++ = s[0];
*p++ = s[1];
if (notation->value) {
state_attach_puts (notation->value, s);
if (!(*notation->value
if (notation->value) {
state_attach_puts (notation->value, s);
if (!(*notation->value
- && (notation->value[strlen (notation->value) - 1] ==
+ && (notation->value[mutt_strlen (notation->value) - 1] ==
'\n')))
state_attach_puts ("\n", s);
}
'\n')))
state_attach_puts ("\n", s);
}
/* Copy PGP material to an data container */
armored_data = create_gpgme_data ();
/* Copy PGP material to an data container */
armored_data = create_gpgme_data ();
- gpgme_data_write (armored_data, buf, strlen (buf));
+ gpgme_data_write (armored_data, buf, mutt_strlen (buf));
while (bytes > 0 && fgets (buf, sizeof (buf) - 1, s->fpin) != NULL) {
offset = ftell (s->fpin);
bytes -= (offset - last_pos); /* don't rely on mutt_strlen(buf) */
last_pos = offset;
while (bytes > 0 && fgets (buf, sizeof (buf) - 1, s->fpin) != NULL) {
offset = ftell (s->fpin);
bytes -= (offset - last_pos); /* don't rely on mutt_strlen(buf) */
last_pos = offset;
- gpgme_data_write (armored_data, buf, strlen (buf));
+ gpgme_data_write (armored_data, buf, mutt_strlen (buf));
if ((needpass && !mutt_strcmp ("-----END PGP MESSAGE-----\n", buf))
|| (!needpass
if ((needpass && !mutt_strcmp ("-----END PGP MESSAGE-----\n", buf))
|| (!needpass
if (!strcmp (dn->key, key)) {
if (any)
fputs (" + ", fp);
if (!strcmp (dn->key, key)) {
if (any)
fputs (" + ", fp);
- print_utf8 (fp, dn->value, strlen (dn->value));
+ print_utf8 (fp, dn->value, mutt_strlen (dn->value));
putc (' ', fp);
}
if (is_pgp)
putc (' ', fp);
}
if (is_pgp)
- print_utf8 (fp, s, strlen (s));
+ print_utf8 (fp, s, mutt_strlen (s));
else
parse_and_print_user_id (fp, s);
putc ('\n', fp);
else
parse_and_print_user_id (fp, s);
putc ('\n', fp);
if (key->subkeys) {
s = key->subkeys->fpr;
fputs (_("Fingerprint: "), fp);
if (key->subkeys) {
s = key->subkeys->fpr;
fputs (_("Fingerprint: "), fp);
- if (is_pgp && strlen (s) == 40) {
+ if (is_pgp && mutt_strlen (s) == 40) {
for (i = 0; *s && s[1] && s[2] && s[3] && s[4]; s += 4, i++) {
putc (*s, fp);
putc (s[1], fp);
for (i = 0; *s && s[1] && s[2] && s[3] && s[4]; s += 4, i++) {
putc (*s, fp);
putc (s[1], fp);
s = subkey->keyid;
putc ('\n', fp);
s = subkey->keyid;
putc ('\n', fp);
+ if (mutt_strlen (s) == 16)
s += 8; /* display only the short keyID */
fprintf (fp, "Subkey ....: 0x%s", s);
if (subkey->revoked) {
s += 8; /* display only the short keyID */
fprintf (fp, "Subkey ....: 0x%s", s);
if (subkey->revoked) {
for (t = strtok (scratch, " ,.:\"()<>\n"); t;
t = strtok (NULL, " ,.:\"()<>\n")) {
for (t = strtok (scratch, " ,.:\"()<>\n"); t;
t = strtok (NULL, " ,.:\"()<>\n")) {
+ if (mutt_strlen (t) > 3)
hints = mutt_add_list (hints, t);
}
hints = mutt_add_list (hints, t);
}
int sender_length = 0;
int uid_length = 0;
int sender_length = 0;
int uid_length = 0;
- sender_length = strlen (sender->mailbox);
+ sender_length = mutt_strlen (sender->mailbox);
for (uid = key->uids; uid && ret; uid = uid->next) {
for (uid = key->uids; uid && ret; uid = uid->next) {
- uid_length = strlen (uid->email);
+ uid_length = mutt_strlen (uid->email);
if (1 && (uid->email[0] == '<')
&& (uid->email[uid_length - 1] == '>')
&& (uid_length == sender_length + 2)
if (1 && (uid->email[0] == '<')
&& (uid->email[uid_length - 1] == '>')
&& (uid_length == sender_length + 2)
answer_string = safe_malloc (COLS + 1);
snprintf (answer_string, COLS + 1, " ([%s]/%s): ", def == M_YES ? yes : no,
def == M_YES ? no : yes);
answer_string = safe_malloc (COLS + 1);
snprintf (answer_string, COLS + 1, " ([%s]/%s): ", def == M_YES ? yes : no,
def == M_YES ? no : yes);
- answer_string_len = strlen (answer_string);
+ answer_string_len = mutt_strlen (answer_string);
printw ("%.*s%s", COLS - answer_string_len, msg, answer_string);
FREE (&answer_string);
printw ("%.*s%s", COLS - answer_string_len, msg, answer_string);
FREE (&answer_string);
#define check_flags(a) if (a & DL_FL_ACTIONS) usage (argv[0])
#define check_flags(a) if (a & DL_FL_ACTIONS) usage (argv[0])
+size_t mutt_strlen (const char* s) {
+ return (s ? strlen (s) : 0);
+}
+
int main (int argc, char **argv)
{
int i;
int main (int argc, char **argv)
{
int i;
- if (strlen (basename) + 1 > l)
+ if (mutt_strlen (basename) + 1 > l)
return -1;
strfcpy (bn, basename, l);
return -1;
strfcpy (bn, basename, l);
}
else if (flags & M_COMMAND) {
my_wcstombs (buf, buflen, state->wbuf, state->curpos);
}
else if (flags & M_COMMAND) {
my_wcstombs (buf, buflen, state->wbuf, state->curpos);
if (i && buf[i - 1] == '=' &&
mutt_var_value_complete (buf, buflen, i))
state->tabs = 0;
if (i && buf[i - 1] == '=' &&
mutt_var_value_complete (buf, buflen, i))
state->tabs = 0;
- if ((strlen (s) < 3) || !*(s + 3) || !ISSPACE (*(s + 3)))
+ if ((mutt_strlen (s) < 3) || !*(s + 3) || !ISSPACE (*(s + 3)))
return 0;
for (i = 0; i < 7; i++)
if (mutt_strncasecmp (s, Weekdays[i], 3) == 0)
return 0;
for (i = 0; i < 7; i++)
if (mutt_strncasecmp (s, Weekdays[i], 3) == 0)
memcpy (uid, buf, ob - buf);
uid[ob - buf] = '\0';
}
memcpy (uid, buf, ob - buf);
uid[ob - buf] = '\0';
}
- else if (ob - buf == n && (buf[n] = 0, strlen (buf) < n))
+ else if (ob - buf == n && (buf[n] = 0, mutt_strlen (buf) < n))
memcpy (uid, buf, n);
}
FREE (&buf);
memcpy (uid, buf, n);
}
FREE (&buf);
if (fgets (line, MIN ((ssize_t) sizeof (line), len + 1), s->fpin) == NULL)
break;
if (fgets (line, MIN ((ssize_t) sizeof (line), len + 1), s->fpin) == NULL)
break;
- linelen = strlen (line);
+ linelen = mutt_strlen (line);
fprintf (stderr, "flowed_max = %d\n", flowed_max);
while (bytes > 0 && fgets (line, sizeof (line), s->fpin)) {
fprintf (stderr, "flowed_max = %d\n", flowed_max);
while (bytes > 0 && fgets (line, sizeof (line), s->fpin)) {
- bytes -= strlen (line);
+ bytes -= mutt_strlen (line);
tail = NULL;
last_full = full;
tail = NULL;
last_full = full;
+ l = mutt_strlen (t + 1);
{
int width;
char *pos, *oldpos;
{
int width;
char *pos, *oldpos;
- int len = strlen (line);
+ int len = mutt_strlen (line);
int i;
if (MaxLineLength > 0) {
int i;
if (MaxLineLength > 0) {
/* fprintf(stderr,"print_flowed_line will print `%s' with ql = %d\n",line,ql); */
/* fprintf(stderr,"print_flowed_line will print `%s' with ql = %d\n",line,ql); */
- if (strlen (line) == 0) {
+ if (mutt_strlen (line) == 0) {
if (option (OPTQUOTEEMPTY)) {
if (s->prefix)
state_puts(s->prefix,s);
if (option (OPTQUOTEEMPTY)) {
if (s->prefix)
state_puts(s->prefix,s);
while (bytes > 0 && fgets (buf, sizeof (buf), s->fpin)) {
/* fprintf(stderr,"read `%s'",buf); */
while (bytes > 0 && fgets (buf, sizeof (buf), s->fpin)) {
/* fprintf(stderr,"read `%s'",buf); */
+ bytes -= mutt_strlen (buf);
newql = get_quote_level (buf);
if ((t = strrchr (buf, '\n')) || (t = strrchr (buf, '\r'))) {
*t = '\0';
newql = get_quote_level (buf);
if ((t = strrchr (buf, '\n')) || (t = strrchr (buf, '\r'))) {
*t = '\0';
- if (strlen (curline) > 0 && curline[strlen (curline) - 1] == ' '
+ if (mutt_strlen (curline) > 0 && curline[mutt_strlen (curline) - 1] == ' '
&& newql == quotelevel
&& strcmp (curline + quotelevel, "-- ") != 0) {
if (buf[newql] == ' ')
&& newql == quotelevel
&& strcmp (curline + quotelevel, "-- ") != 0) {
if (buf[newql] == ' ')
- curline[strlen (curline) - 1] = '\0';
+ curline[mutt_strlen (curline) - 1] = '\0';
- curline = realloc (curline, curline_len + strlen (buf));
+ curline = realloc (curline, curline_len + mutt_strlen (buf));
if (curline_len == 1)
*curline = '\0';
if (curline_len == 1)
*curline = '\0';
- curline_len += strlen (buf);
+ curline_len += mutt_strlen (buf);
safe_strncat (curline, curline_len, buf + newql,
safe_strncat (curline, curline_len, buf + newql,
+ mutt_strlen (buf + newql));
}
else {
if (first_line) {
}
else {
if (first_line) {
}
FREE (&curline);
curline_len = 1;
}
FREE (&curline);
curline_len = 1;
- curline = realloc (curline, curline_len + strlen (buf));
+ curline = realloc (curline, curline_len + mutt_strlen (buf));
if (curline_len == 1)
*curline = '\0';
if (curline_len == 1)
*curline = '\0';
- curline_len += strlen (buf);
- safe_strncat (curline, curline_len, buf, strlen (buf));
+ curline_len += mutt_strlen (buf);
+ safe_strncat (curline, curline_len, buf, mutt_strlen (buf));
- MD5Update (&md5, (unsigned char *) folder, strlen (folder));
+ MD5Update (&md5, (unsigned char *) folder, mutt_strlen (folder));
MD5Final (md5sum, &md5);
ret = snprintf (mutt_hcache_per_folder_path, _POSIX_PATH_MAX,
MD5Final (md5sum, &md5);
ret = snprintf (mutt_hcache_per_folder_path, _POSIX_PATH_MAX,
+ l = mutt_strlen (s) + 1;
p = (char *) safe_malloc (l);
memcpy (p, s, l);
return (p);
p = (char *) safe_malloc (l);
memcpy (p, s, l);
return (p);
- safe_realloc (p, strlen (*p) + 1);
+ safe_realloc (p, mutt_strlen (*p) + 1);
}
/* convert all characters in the string to lowercase */
}
/* convert all characters in the string to lowercase */
char abs_oldpath[_POSIX_PATH_MAX];
if ((getcwd (abs_oldpath, sizeof abs_oldpath) == NULL) ||
char abs_oldpath[_POSIX_PATH_MAX];
if ((getcwd (abs_oldpath, sizeof abs_oldpath) == NULL) ||
- (strlen (abs_oldpath) + 1 + strlen (oldpath) + 1 >
+ (mutt_strlen (abs_oldpath) + 1 + mutt_strlen (oldpath) + 1 >
sizeof abs_oldpath))
return -1;
sizeof abs_oldpath))
return -1;
if (end)
len = end - begin;
else
if (end)
len = end - begin;
else
+ len = mutt_strlen (begin);
p = safe_malloc (len + 1);
memcpy (p, begin, len);
p = safe_malloc (len + 1);
memcpy (p, begin, len);
{
const char *fmt = "%s/%s";
{
const char *fmt = "%s/%s";
- if (!*fname || (*dir && dir[strlen (dir) - 1] == '/'))
+ if (!*fname || (*dir && dir[mutt_strlen (dir) - 1] == '/'))
fmt = "%s%s";
snprintf (d, l, fmt, dir, fname);
fmt = "%s%s";
snprintf (d, l, fmt, dir, fname);
cols = COLS - shift - SidebarWidth;
else
cols = COLS - shift;
cols = COLS - shift - SidebarWidth;
else
cols = COLS - shift;
- mutt_format_string (tmpbuf, n, cols, cols, 0, ' ', s, strlen (s), 1);
+ mutt_format_string (tmpbuf, n, cols, cols, 0, ' ', s, mutt_strlen (s), 1);
tmpbuf[n - 1] = 0;
snprintf (s, n, "%s", tmpbuf); /* overkill */
FREE (&tmpbuf);
tmpbuf[n - 1] = 0;
snprintf (s, n, "%s", tmpbuf); /* overkill */
FREE (&tmpbuf);
hdr->read ? "S" : "", hdr->deleted ? "T" : "",
NONULL (hdr->maildir_flags));
if (hdr->maildir_flags)
hdr->read ? "S" : "", hdr->deleted ? "T" : "",
NONULL (hdr->maildir_flags));
if (hdr->maildir_flags)
- qsort (tmp, strlen (tmp), 1, ch_compar);
+ qsort (tmp, mutt_strlen (tmp), 1, ch_compar);
snprintf (dest, destlen, ":2,%s", tmp);
}
}
snprintf (dest, destlen, ":2,%s", tmp);
}
}
/* Create hostname:port string and tell libesmtp */
/* len = SmtpHost len + colon + max port (65536 => 5 chars) + terminator */
/* Create hostname:port string and tell libesmtp */
/* len = SmtpHost len + colon + max port (65536 => 5 chars) + terminator */
- hostportlen = strlen (SmtpHost) + 7;
+ hostportlen = mutt_strlen (SmtpHost) + 7;
hostportstr = safe_malloc (hostportlen);
snprintf (hostportstr, hostportlen, "%s:%d", SmtpHost, SmtpPort);
if (!smtp_set_server (session, hostportstr))
hostportstr = safe_malloc (hostportlen);
snprintf (hostportstr, hostportlen, "%s:%d", SmtpHost, SmtpPort);
if (!smtp_set_server (session, hostportstr))
if (ret)
return getnameinfo_err (ret);
if (ret)
return getnameinfo_err (ret);
- if (outlen < strlen (hbuf) + strlen (pbuf) + 2)
+ if (outlen < mutt_strlen (hbuf) + mutt_strlen (pbuf) + 2)
return SASL_BUFOVER;
snprintf (out, outlen, "%s;%s", hbuf, pbuf);
return SASL_BUFOVER;
snprintf (out, outlen, "%s;%s", hbuf, pbuf);
*result = account->user;
if (len)
*result = account->user;
if (len)
- *len = strlen (*result);
+ *len = mutt_strlen (*result);
if (mutt_account_getpass (account))
return SASL_FAIL;
if (mutt_account_getpass (account))
return SASL_FAIL;
- len = strlen (account->pass);
+ len = mutt_strlen (account->pass);
*psecret = (sasl_secret_t *) safe_malloc (sizeof (sasl_secret_t) + len);
(*psecret)->len = len;
*psecret = (sasl_secret_t *) safe_malloc (sizeof (sasl_secret_t) + len);
(*psecret)->len = len;
dprint (dbg, (debugfile, "< %s\n", buf));
dprint (dbg, (debugfile, "< %s\n", buf));
- /* number of bytes read, not strlen */
+ /* number of bytes read, not mutt_strlen */
c = strstr (line, ndx);
if (c) {
c = strstr (line, ndx);
if (c) {
+ c += mutt_strlen (ndx);
c2 = strchr (c, '/');
if (c2)
*c2 = '\0';
c2 = strchr (c, '/');
if (c2)
*c2 = '\0';
t.tm_yday = ex.tm_yday;
strfcpy (timebuf, asctime (&t), sizeof (timebuf));
t.tm_yday = ex.tm_yday;
strfcpy (timebuf, asctime (&t), sizeof (timebuf));
- timebuf[strlen (timebuf) - 1] = 0;
+ timebuf[mutt_strlen (timebuf) - 1] = 0;
#ifdef USE_IMAP
/* if folder = {host} or imap[s]://host/: don't append slash */
if (mx_is_imap (NONULL (Maildir)) &&
#ifdef USE_IMAP
/* if folder = {host} or imap[s]://host/: don't append slash */
if (mx_is_imap (NONULL (Maildir)) &&
- (Maildir[strlen (Maildir) - 1] == '}' ||
- Maildir[strlen (Maildir) - 1] == '/'))
+ (Maildir[mutt_strlen (Maildir) - 1] == '}' ||
+ Maildir[mutt_strlen (Maildir) - 1] == '/'))
strfcpy (p, NONULL (Maildir), sizeof (p));
else
#endif
strfcpy (p, NONULL (Maildir), sizeof (p));
else
#endif
else
strfcpy (dest, pw->pw_gecos, destlen);
else
strfcpy (dest, pw->pw_gecos, destlen);
- pwnl = strlen (pw->pw_name);
+ pwnl = mutt_strlen (pw->pw_name);
for (idx = 0; dest[idx]; idx++) {
if (dest[idx] == '&') {
for (idx = 0; dest[idx]; idx++) {
if (dest[idx] == '&') {
if (s->flags & M_PENDINGPREFIX) {
int i;
if (s->flags & M_PENDINGPREFIX) {
int i;
+ i = mutt_strlen (Quotebuf);
Quotebuf[i++] = c;
Quotebuf[i] = '\0';
if (i == sizeof (Quotebuf) - 1 || c == '\n') {
Quotebuf[i++] = c;
Quotebuf[i] = '\0';
if (i == sizeof (Quotebuf) - 1 || c == '\n') {
strfcpy (group, line, len);
if ((data = (NNTP_DATA *) hash_find (news->newsgroups, group)) == NULL) {
data =
strfcpy (group, line, len);
if ((data = (NNTP_DATA *) hash_find (news->newsgroups, group)) == NULL) {
data =
- (NNTP_DATA *) safe_calloc (1, sizeof (NNTP_DATA) + strlen (group) + 1);
+ (NNTP_DATA *) safe_calloc (1, sizeof (NNTP_DATA) + mutt_strlen (group) + 1);
data->group = (char *) data + sizeof (NNTP_DATA);
strcpy (data->group, group);
data->nserv = news;
data->group = (char *) data + sizeof (NNTP_DATA);
strcpy (data->group, group);
data->nserv = news;
return 0;
rewind (index);
while (fgets (buf, sizeof (buf), index)) {
return 0;
rewind (index);
while (fgets (buf, sizeof (buf), index)) {
- buf[strlen (buf) - 1] = 0; /* strip ending '\n' */
+ buf[mutt_strlen (buf) - 1] = 0; /* strip ending '\n' */
if (!mutt_strncmp (buf, "#: ", 3) &&
!mutt_strcasecmp (buf + 3, news->conn->account.host))
break;
if (!mutt_strncmp (buf, "#: ", 3) &&
!mutt_strcasecmp (buf + 3, news->conn->account.host))
break;
if ((data = (NNTP_DATA *) hash_find (news->newsgroups, buf)) == NULL) {
data =
(NNTP_DATA *) safe_calloc (1,
if ((data = (NNTP_DATA *) hash_find (news->newsgroups, buf)) == NULL) {
data =
(NNTP_DATA *) safe_calloc (1,
- sizeof (NNTP_DATA) + strlen (buf) + 1);
+ sizeof (NNTP_DATA) + mutt_strlen (buf) + 1);
data->group = (char *) data + sizeof (NNTP_DATA);
strcpy (data->group, buf);
data->nserv = news;
data->group = (char *) data + sizeof (NNTP_DATA);
strcpy (data->group, buf);
data->nserv = news;
- buf = p = safe_calloc (strlen (server) + 10, sizeof (char));
+ buf = p = safe_calloc (mutt_strlen (server) + 10, sizeof (char));
if (url_check_scheme (server) == U_UNKNOWN) {
strcpy (buf, "nntp://");
p = strchr (buf, '\0');
if (url_check_scheme (server) == U_UNKNOWN) {
strcpy (buf, "nntp://");
p = strchr (buf, '\0');
line = *buf + (*pline - line);
}
strcpy (line, data->group);
line = *buf + (*pline - line);
}
strcpy (line, data->group);
- len -= strlen (line) + 1;
- line += strlen (line);
+ len -= mutt_strlen (line) + 1;
+ line += mutt_strlen (line);
*line++ = data->subscribed ? ':' : '!';
*line++ = ' ';
*line = '\0';
*line++ = data->subscribed ? ':' : '!';
*line++ = ' ';
*line = '\0';
continue;
nntp_create_newsrc_line (data, &buf, &line, &llen);
dprint (2, (debugfile, "Added to newsrc: %s", line));
continue;
nntp_create_newsrc_line (data, &buf, &line, &llen);
dprint (2, (debugfile, "Added to newsrc: %s", line));
+ line += mutt_strlen (line);
}
/* newrc being fully rewritten */
if (news->newsrc &&
}
/* newrc being fully rewritten */
if (news->newsrc &&
return fp;
nntp_cache_expand (buf, "cache-XXXXXX");
return fp;
nntp_cache_expand (buf, "cache-XXXXXX");
- pc = buf + strlen (buf) - 12; /* positioning to "cache-XXXXXX" */
+ pc = buf + mutt_strlen (buf) - 12; /* positioning to "cache-XXXXXX" */
if ((fd = mkstemp (buf)) == -1)
return NULL;
strcpy (s, pc); /* generated name */
if ((fd = mkstemp (buf)) == -1)
return NULL;
strcpy (s, pc); /* generated name */
return NULL;
if (!(data = (NNTP_DATA *) hash_find (news->newsgroups, group))) {
data =
return NULL;
if (!(data = (NNTP_DATA *) hash_find (news->newsgroups, group))) {
data =
- (NNTP_DATA *) safe_calloc (1, sizeof (NNTP_DATA) + strlen (group) + 1);
+ (NNTP_DATA *) safe_calloc (1, sizeof (NNTP_DATA) + mutt_strlen (group) + 1);
data->group = (char *) data + sizeof (NNTP_DATA);
strcpy (data->group, group);
data->nserv = news;
data->group = (char *) data + sizeof (NNTP_DATA);
strcpy (data->group, group);
data->nserv = news;
strfcpy (inbuf + lenbuf, p, sizeof (buf));
if (chunk >= sizeof (buf)) {
strfcpy (inbuf + lenbuf, p, sizeof (buf));
if (chunk >= sizeof (buf)) {
+ lenbuf += mutt_strlen (p);
/* create NNTP-specific state struct if nof found in list */
if ((nntp_data = (NNTP_DATA *) hash_find (serv->newsgroups, buf)) == NULL) {
/* create NNTP-specific state struct if nof found in list */
if ((nntp_data = (NNTP_DATA *) hash_find (serv->newsgroups, buf)) == NULL) {
- nntp_data = safe_calloc (1, sizeof (NNTP_DATA) + strlen (buf) + 1);
+ nntp_data = safe_calloc (1, sizeof (NNTP_DATA) + mutt_strlen (buf) + 1);
nntp_data->group = (char *) nntp_data + sizeof (NNTP_DATA);
strcpy (nntp_data->group, buf);
hash_insert (serv->newsgroups, nntp_data->group, nntp_data, 0);
nntp_data->group = (char *) nntp_data + sizeof (NNTP_DATA);
strcpy (nntp_data->group, buf);
hash_insert (serv->newsgroups, nntp_data->group, nntp_data, 0);
buf[0] = '.';
buf[1] = '\0';
while (fgets (buf + 1, sizeof (buf) - 2, f) != NULL) {
buf[0] = '.';
buf[1] = '\0';
while (fgets (buf + 1, sizeof (buf) - 2, f) != NULL) {
+ len = mutt_strlen (buf);
if (buf[len - 1] == '\n') {
buf[len - 1] = '\r';
buf[len] = '\n';
if (buf[len - 1] == '\n') {
buf[len - 1] = '\r';
buf[len] = '\n';
- if (buf[strlen (buf) - 1] != '\n')
+ if (buf[mutt_strlen (buf) - 1] != '\n')
mutt_socket_write_d (nntp_data->nserv->conn, "\r\n", M_SOCK_LOG_HDR);
mutt_socket_write_d (nntp_data->nserv->conn, ".\r\n", M_SOCK_LOG_HDR);
if (mutt_socket_readln (buf, sizeof (buf), nntp_data->nserv->conn) < 0) {
mutt_socket_write_d (nntp_data->nserv->conn, "\r\n", M_SOCK_LOG_HDR);
mutt_socket_write_d (nntp_data->nserv->conn, ".\r\n", M_SOCK_LOG_HDR);
if (mutt_socket_readln (buf, sizeof (buf), nntp_data->nserv->conn) < 0) {
return 0;
if ((nntp_data = (NNTP_DATA *) hash_find (s->newsgroups, group)) == NULL) {
n++;
return 0;
if ((nntp_data = (NNTP_DATA *) hash_find (s->newsgroups, group)) == NULL) {
n++;
- nntp_data = safe_calloc (1, sizeof (NNTP_DATA) + strlen (group) + 1);
+ nntp_data = safe_calloc (1, sizeof (NNTP_DATA) + mutt_strlen (group) + 1);
nntp_data->group = (char *) nntp_data + sizeof (NNTP_DATA);
strcpy (nntp_data->group, group);
nntp_data->nserv = s;
nntp_data->group = (char *) nntp_data + sizeof (NNTP_DATA);
strcpy (nntp_data->group, group);
nntp_data->nserv = s;
- buf += strlen (buf) - 1;
+ buf += mutt_strlen (buf) - 1;
if (*buf == '\n') {
/* we did get a full line. remove trailing space */
while (ISSPACE (*buf))
if (*buf == '\n') {
/* we did get a full line. remove trailing space */
while (ISSPACE (*buf))
new = NULL;
if (*s == '<') {
new = NULL;
if (*s == '<') {
if (s[n - 1] != '>') {
o = s;
s = NULL;
if (s[n - 1] != '>') {
o = s;
s = NULL;
new = safe_strdup (s);
}
else if (o) {
new = safe_strdup (s);
}
else if (o) {
if (s[m - 1] == '>') {
new = safe_malloc (sizeof (char) * (n + m + 1));
strcpy (new, o); /* __STRCPY_CHECKED__ */
if (s[m - 1] == '>') {
new = safe_malloc (sizeof (char) * (n + m + 1));
strcpy (new, o); /* __STRCPY_CHECKED__ */
/* Keep track of the user-defined headers */
if (!matched && user_hdrs) {
/* restore the original line */
/* Keep track of the user-defined headers */
if (!matched && user_hdrs) {
/* restore the original line */
- line[strlen (line)] = ':';
+ line[mutt_strlen (line)] = ':';
if (weed && option (OPTWEED) && mutt_matches_ignore (line, Ignore)
&& !mutt_matches_ignore (line, UnIgnore))
if (weed && option (OPTWEED) && mutt_matches_ignore (line, Ignore)
&& !mutt_matches_ignore (line, UnIgnore))
/* or should we require the "0x"? */
if (strncmp (s, "0x", 2) == 0)
s += 2;
/* or should we require the "0x"? */
if (strncmp (s, "0x", 2) == 0)
s += 2;
+ if (mutt_strlen (s) % 8)
return 0;
while (*s)
if (strchr ("0123456789ABCDEFabcdef", *s++) == NULL)
return 0;
while (*s)
if (strchr ("0123456789ABCDEFabcdef", *s++) == NULL)
for (t = strtok (scratch, " ,.:\"()<>\n"); t;
t = strtok (NULL, " ,.:\"()<>\n")) {
for (t = strtok (scratch, " ,.:\"()<>\n"); t;
t = strtok (NULL, " ,.:\"()<>\n")) {
+ if (mutt_strlen (t) > 3)
hints = mutt_add_list (hints, t);
}
hints = mutt_add_list (hints, t);
}
- if ((end = ftell (in) - strlen (line)) < start) {
+ if ((end = ftell (in) - mutt_strlen (line)) < start) {
dprint (1, (debugfile, "pgp_dearmor: end < start???\n"));
return;
}
dprint (1, (debugfile, "pgp_dearmor: end < start???\n"));
return;
}
char *error_buf;
size_t error_buf_len;
char *error_buf;
size_t error_buf_len;
- error_buf_len = sizeof ("fopen: ") - 1 + strlen (ringfile) + 1;
+ error_buf_len = sizeof ("fopen: ") - 1 + mutt_strlen (ringfile) + 1;
error_buf = safe_malloc (error_buf_len);
snprintf (error_buf, error_buf_len, "fopen: %s", ringfile);
perror (error_buf);
error_buf = safe_malloc (error_buf_len);
snprintf (error_buf, error_buf_len, "fopen: %s", ringfile);
perror (error_buf);
- url = p = safe_calloc (strlen (PopHost) + 7, sizeof (char));
+ url = p = safe_calloc (mutt_strlen (PopHost) + 7, sizeof (char));
if (url_check_scheme (PopHost) == U_UNKNOWN) {
strcpy (url, "pop://"); /* __STRCPY_CHECKED__ */
p = strchr (url, '\0');
if (url_check_scheme (PopHost) == U_UNKNOWN) {
strcpy (url, "pop://"); /* __STRCPY_CHECKED__ */
p = strchr (url, '\0');
mutt_message _("Authenticating (SASL)...");
snprintf (buf, sizeof (buf), "AUTH %s", mech);
mutt_message _("Authenticating (SASL)...");
snprintf (buf, sizeof (buf), "AUTH %s", mech);
+ olen = mutt_strlen (buf);
/* looping protocol */
FOREVER {
/* looping protocol */
FOREVER {
#ifdef USE_SASL2
if (!mutt_strncmp (inbuf, "+ ", 2)
#ifdef USE_SASL2
if (!mutt_strncmp (inbuf, "+ ", 2)
- && sasl_decode64 (inbuf, strlen (inbuf), buf, LONG_STRING - 1,
+ && sasl_decode64 (inbuf, mutt_strlen (inbuf), buf, LONG_STRING - 1,
&len) != SASL_OK)
#else
if (!mutt_strncmp (inbuf, "+ ", 2)
&len) != SASL_OK)
#else
if (!mutt_strncmp (inbuf, "+ ", 2)
- && sasl_decode64 (inbuf, strlen (inbuf), buf, &len) != SASL_OK)
+ && sasl_decode64 (inbuf, mutt_strlen (inbuf), buf, &len) != SASL_OK)
/* Compute the authentication hash to send to the server */
MD5Init (&mdContext);
MD5Update (&mdContext, (unsigned char *) pop_data->timestamp,
/* Compute the authentication hash to send to the server */
MD5Init (&mdContext);
MD5Update (&mdContext, (unsigned char *) pop_data->timestamp,
- strlen (pop_data->timestamp));
+ mutt_strlen (pop_data->timestamp));
MD5Update (&mdContext, (unsigned char *) pop_data->conn->account.pass,
MD5Update (&mdContext, (unsigned char *) pop_data->conn->account.pass,
- strlen (pop_data->conn->account.pass));
+ mutt_strlen (pop_data->conn->account.pass));
MD5Final (digest, &mdContext);
for (i = 0; i < sizeof (digest); i++)
MD5Final (digest, &mdContext);
for (i = 0; i < sizeof (digest); i++)
- strfcpy (t, c, sizeof (pop_data->err_msg) - strlen (pop_data->err_msg));
+ strfcpy (t, c, sizeof (pop_data->err_msg) - mutt_strlen (pop_data->err_msg));
mutt_remove_trailing_ws (pop_data->err_msg);
}
mutt_remove_trailing_ws (pop_data->err_msg);
}
POP_DATA *pop_data = (POP_DATA *) data;
if (!pop_data->auth_list) {
POP_DATA *pop_data = (POP_DATA *) data;
if (!pop_data->auth_list) {
- pop_data->auth_list = safe_malloc (strlen (line) + 1);
+ pop_data->auth_list = safe_malloc (mutt_strlen (line) + 1);
*pop_data->auth_list = '\0';
}
else {
safe_realloc (&pop_data->auth_list,
*pop_data->auth_list = '\0';
}
else {
safe_realloc (&pop_data->auth_list,
- strlen (pop_data->auth_list) + strlen (line) + 2);
+ mutt_strlen (pop_data->auth_list) + mutt_strlen (line) + 2);
strcat (pop_data->auth_list, " "); /* __STRCAT_CHECKED__ */
}
strcat (pop_data->auth_list, line); /* __STRCAT_CHECKED__ */
strcat (pop_data->auth_list, " "); /* __STRCAT_CHECKED__ */
}
strcat (pop_data->auth_list, line); /* __STRCAT_CHECKED__ */
strfcpy (inbuf + lenbuf, p, sizeof (buf));
if (chunk >= sizeof (buf)) {
strfcpy (inbuf + lenbuf, p, sizeof (buf));
if (chunk >= sizeof (buf)) {
+ lenbuf += mutt_strlen (p);
/* Match anchors at newlines. */
re_comp_buf.newline_anchor = 1;
/* Match anchors at newlines. */
re_comp_buf.newline_anchor = 1;
- ret = regex_compile (s, strlen (s), re_syntax_options, &re_comp_buf);
+ ret = regex_compile (s, mutt_strlen (s), re_syntax_options, &re_comp_buf);
re_exec (s)
const char *s;
{
re_exec (s)
const char *s;
{
- const int len = strlen (s);
+ const int len = mutt_strlen (s);
return
0 <= re_search (&re_comp_buf, s, len, 0, len, (struct re_registers *) 0);
return
0 <= re_search (&re_comp_buf, s, len, 0, len, (struct re_registers *) 0);
preg->no_sub = !!(cflags & REG_NOSUB);
/* POSIX says a null character in the pattern terminates it, so we
preg->no_sub = !!(cflags & REG_NOSUB);
/* POSIX says a null character in the pattern terminates it, so we
- can use strlen here in compiling the pattern. */
- ret = regex_compile (pattern, strlen (pattern), syntax, preg);
+ can use mutt_strlen here in compiling the pattern. */
+ ret = regex_compile (pattern, mutt_strlen (pattern), syntax, preg);
/* POSIX doesn't distinguish between an unmatched open-group and an
unmatched close-group: both are REG_EPAREN. */
/* POSIX doesn't distinguish between an unmatched open-group and an
unmatched close-group: both are REG_EPAREN. */
int ret;
struct re_registers regs;
regex_t private_preg;
int ret;
struct re_registers regs;
regex_t private_preg;
- int len = strlen (string);
+ int len = mutt_strlen (string);
boolean want_reg_info = !preg->no_sub && nmatch > 0;
private_preg = *preg;
boolean want_reg_info = !preg->no_sub && nmatch > 0;
private_preg = *preg;
msg = gettext (re_error_msgid[errcode]);
msg = gettext (re_error_msgid[errcode]);
- msg_size = strlen (msg) + 1; /* Includes the null. */
+ msg_size = mutt_strlen (msg) + 1; /* Includes the null. */
if (errbuf_size != 0) {
if (msg_size > errbuf_size) {
if (errbuf_size != 0) {
if (msg_size > errbuf_size) {
- coords[i - 1].c + strlen (type2_list[chain->ch[i - 1]]->shortname) + 2;
+ coords[i - 1].c + mutt_strlen (type2_list[chain->ch[i - 1]]->shortname) + 2;
r = coords[i - 1].r;
}
else {
r = coords[i - 1].r;
}
else {
for (; i < chain->cl; i++) {
oc = c;
for (; i < chain->cl; i++) {
oc = c;
- c += strlen (type2_list[chain->ch[i]]->shortname) + 2;
+ c += mutt_strlen (type2_list[chain->ch[i]]->shortname) + 2;
if (c >= COLS) {
oc = c = MIX_HOFFSET;
if (c >= COLS) {
oc = c = MIX_HOFFSET;
#endif
#define ENCWORD_LEN_MAX 75
#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')
#define HSPACE(x) ((x) == '\0' || (x) == ' ' || (x) == '\t')
- 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
if (!n ||
/* Assume that we never need more than 12 characters of
char *s0 = s;
memcpy (s, "=?", 2), s += 2;
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)
memcpy (s, "?B?", 3), s += 3;
for (;;) {
if (!dlen)
char *s0 = s;
memcpy (s, "=?", 2), s += 2;
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++;
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));
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);
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 {
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;
}
memcpy (buf1, d, dlen);
ob = buf1 + dlen;
}
- 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;
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));
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));
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"
/* 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;
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;
#undef LINEBREAK
col = 1;
if (!charsets || !*charsets)
charsets = "UTF-8";
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);
Charset, charsets, &e, &elen,
encode_specials ? RFC822Specials : NULL);
void rfc2047_encode_adrlist (ADDRESS * addr, const char *tag)
{
ADDRESS *ptr = addr;
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)
while (ptr) {
if (ptr->personal)
int enc = 0, count = 0;
char *charset = NULL;
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++;
for (pp = s; (pp1 = strchr (pp, '?')); pp = pp1 + 1) {
count++;
- 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) {
d = d0 = safe_malloc (dlen + 1);
while (*s && dlen > 0) {
if (encoded && par->encoded)
rfc2231_decode_one (par->value, valp);
if (encoded && par->encoded)
rfc2231_decode_one (par->value, valp);
- vl = strlen (par->value);
+ vl = mutt_strlen (par->value);
safe_realloc (&value, l + vl + 1);
strcpy (value + l, par->value); /* __STRCPY_CHECKED__ */
safe_realloc (&value, l + vl + 1);
strcpy (value + l, par->value); /* __STRCPY_CHECKED__ */
if (!Charset || !SendCharset ||
!(charset = mutt_choose_charset (Charset, SendCharset,
if (!Charset || !SendCharset ||
!(charset = mutt_choose_charset (Charset, SendCharset,
- *pd, strlen (*pd), &d, &dlen))) {
+ *pd, mutt_strlen (*pd), &d, &dlen))) {
charset = safe_strdup (Charset ? Charset : "unknown-8bit");
d = *pd;
charset = safe_strdup (Charset ? Charset : "unknown-8bit");
d = *pd;
+ dlen = mutt_strlen (d);
}
if (!mutt_is_us_ascii (charset))
}
if (!mutt_is_us_ascii (charset))
- e = safe_malloc (dlen + 2 * ext + strlen (charset) + 3);
+ e = safe_malloc (dlen + 2 * ext + mutt_strlen (charset) + 3);
sprintf (e, "%s''", charset); /* __SPRINTF_CHECKED__ */
sprintf (e, "%s''", charset); /* __SPRINTF_CHECKED__ */
+ t = e + mutt_strlen (e);
for (s = d, slen = dlen; slen; s++, slen--)
if (*s < 0x20 || *s >= 0x7f ||
strchr (MimeSpecials, *s) || strchr ("*'%", *s)) {
for (s = d, slen = dlen; slen; s++, slen--)
if (*s < 0x20 || *s >= 0x7f ||
strchr (MimeSpecials, *s) || strchr ("*'%", *s)) {
break;
case 'O':
snprintf (tmp, sizeof (tmp), "%lo", (unsigned long) now);
break;
case 'O':
snprintf (tmp, sizeof (tmp), "%lo", (unsigned long) now);
- safe_strncat (buf, len, tmp, strlen (tmp));
+ safe_strncat (buf, len, tmp, mutt_strlen (tmp));
break;
case 'p':
snprintf (tmp, sizeof (tmp), "%u", (unsigned int) getpid ());
break;
case 'p':
snprintf (tmp, sizeof (tmp), "%u", (unsigned int) getpid ());
- safe_strncat (buf, len, tmp, strlen (tmp));
+ safe_strncat (buf, len, tmp, mutt_strlen (tmp));
break;
case 'P':
snprintf (tmp, sizeof (tmp), "%c", MsgIdPfx);
break;
case 'P':
snprintf (tmp, sizeof (tmp), "%c", MsgIdPfx);
break;
case 'r':
snprintf (tmp, sizeof (tmp), "%u", (unsigned int) rand ());
break;
case 'r':
snprintf (tmp, sizeof (tmp), "%u", (unsigned int) rand ());
- safe_strncat (buf, len, tmp, strlen (tmp));
+ safe_strncat (buf, len, tmp, mutt_strlen (tmp));
break;
case 'R':
snprintf (tmp, sizeof (tmp), "%x", (unsigned int) rand ());
break;
case 'R':
snprintf (tmp, sizeof (tmp), "%x", (unsigned int) rand ());
- safe_strncat (buf, len, tmp, strlen (tmp));
+ safe_strncat (buf, len, tmp, mutt_strlen (tmp));
break;
case 's':
snprintf (tmp, sizeof (tmp), "%02d", tm->tm_sec);
break;
case 's':
snprintf (tmp, sizeof (tmp), "%02d", tm->tm_sec);
break;
case 'T':
snprintf (tmp, sizeof (tmp), "%u", (unsigned int) now);
break;
case 'T':
snprintf (tmp, sizeof (tmp), "%u", (unsigned int) now);
- safe_strncat (buf, len, tmp, strlen (tmp));
+ safe_strncat (buf, len, tmp, mutt_strlen (tmp));
break;
case 'X':
snprintf (tmp, sizeof (tmp), "%x", (unsigned int) now);
break;
case 'X':
snprintf (tmp, sizeof (tmp), "%x", (unsigned int) now);
- safe_strncat (buf, len, tmp, strlen (tmp));
+ safe_strncat (buf, len, tmp, mutt_strlen (tmp));
break;
case 'Y':
snprintf (tmp, sizeof (tmp), "%04d", tm->tm_year + 1900); /* this will break in the year 10000 ;-) */
break;
case 'Y':
snprintf (tmp, sizeof (tmp), "%04d", tm->tm_year + 1900); /* this will break in the year 10000 ;-) */
if (!(fqdn = mutt_fqdn (0)))
fqdn = NONULL (Hostname);
if (!(fqdn = mutt_fqdn (0)))
fqdn = NONULL (Hostname);
- localpart_length = sizeof (buf) - strlen (fqdn) - 4; /* the 4 characters are '<', '@', '>' and '\0' */
+ localpart_length = sizeof (buf) - mutt_strlen (fqdn) - 4; /* the 4 characters are '<', '@', '>' and '\0' */
mutt_gen_localpart (localpart, localpart_length, MsgIdFormat);
mutt_gen_localpart (localpart, localpart_length, MsgIdFormat);
- for (i = 0; i < strlen (box); ++i) {
+ for (i = 0; i < mutt_strlen (box); ++i) {
if (box[i] == '.')
++dots;
else if (isupper (box[i]))
if (box[i] == '.')
++dots;
else if (isupper (box[i]))
last_dot = strrchr (box, '.');
if (last_dot) {
++last_dot;
last_dot = strrchr (box, '.');
if (last_dot) {
++last_dot;
- new_box = safe_malloc (strlen (last_dot) + 2 * dots + 1);
+ new_box = safe_malloc (mutt_strlen (last_dot) + 2 * dots + 1);
- for (i = 1, j = 1; i < strlen (box); ++i) {
+ for (i = 1, j = 1; i < mutt_strlen (box); ++i) {
if (box[i] == '.') {
new_box[j++] = '.';
new_box[j] = 0;
if (box[i] == '.') {
new_box[j++] = '.';
new_box[j] = 0;
entry[SidebarWidth] = 0;
for (; i < SidebarWidth; entry[i++] = ' ');
#if USE_IMAP
entry[SidebarWidth] = 0;
for (; i < SidebarWidth; entry[i++] = ' ');
#if USE_IMAP
- if (ImapHomeNamespace && strlen (ImapHomeNamespace) > 0) {
- if (strncmp (box, ImapHomeNamespace, strlen (ImapHomeNamespace)) == 0
+ if (ImapHomeNamespace && mutt_strlen (ImapHomeNamespace) > 0) {
+ if (strncmp (box, ImapHomeNamespace, mutt_strlen (ImapHomeNamespace)) == 0
&& strcmp (box, ImapHomeNamespace) != 0) {
&& strcmp (box, ImapHomeNamespace) != 0) {
- box += strlen (ImapHomeNamespace) + 1;
+ box += mutt_strlen (ImapHomeNamespace) + 1;
box = shortened_hierarchy (box);
shortened = 1;
}
box = shortened_hierarchy (box);
shortened = 1;
}
strncpy (entry, box, i < SidebarWidth - dlen ? i : SidebarWidth - dlen);
if (new) {
strncpy (entry, box, i < SidebarWidth - dlen ? i : SidebarWidth - dlen);
if (new) {
- for (strln = 0; value[strln]; ++strln); /* strlen */
+ for (strln = 0; value[strln]; ++strln); /* mutt_strlen */
padlen = min - strln;
if (padlen < 0)
padlen = 0;
padlen = min - strln;
if (padlen < 0)
padlen = 0;
{
str[0] = 0;
dopr (str, count, fmt, args);
{
str[0] = 0;
dopr (str, count, fmt, args);
+ return (mutt_strlen (str));
}
#endif /* !HAVE_VSNPRINTF */
}
#endif /* !HAVE_VSNPRINTF */
(void) vsnprintf (str, count, fmt, ap);
VA_END;
(void) vsnprintf (str, count, fmt, ap);
VA_END;
+ return (mutt_strlen (str));
if (s == NULL)
return NULL;
if (s == NULL)
return NULL;
- if ((d = malloc (strlen (s) + 1)) == NULL) /* __MEM_CHECKED__ */
+ if ((d = malloc (mutt_strlen (s) + 1)) == NULL) /* __MEM_CHECKED__ */
- memcpy (d, s, strlen (s) + 1);
+ memcpy (d, s, mutt_strlen (s) + 1);
if (ciss->host) {
safe_strcat (dest, len, "//");
if (ciss->host) {
safe_strcat (dest, len, "//");
- len -= (l = strlen (dest));
+ len -= (l = mutt_strlen (dest));
dest += l;
if (ciss->user) {
dest += l;
if (ciss->user) {
else
snprintf (dest, len, "%s@", ciss->user);
else
snprintf (dest, len, "%s@", ciss->user);
- len -= (l = strlen (dest));
+ len -= (l = mutt_strlen (dest));
mutt_str_replace (body, value);
}
else {
mutt_str_replace (body, value);
}
else {
+ taglen = mutt_strlen (tag);
/* mutt_parse_rfc822_line makes some assumptions */
snprintf (scratch, sizeof (scratch), "%s: %s", tag, value);
scratch[taglen] = '\0';
/* mutt_parse_rfc822_line makes some assumptions */
snprintf (scratch, sizeof (scratch), "%s: %s", tag, value);
scratch[taglen] = '\0';