From: pdmef Date: Fri, 18 Mar 2005 17:09:47 +0000 (+0000) Subject: Rocco Rutte: X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=commitdiff_plain;h=841934011451205d8295ac955486f06c317fdf15 Rocco Rutte: drop strlen() in favour of mutt_strlen() git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@198 e385b8ad-14ed-0310-8656-cc95a2468c6d --- diff --git a/browser.c b/browser.c index ab296af..08323d3 100644 --- a/browser.c +++ b/browser.c @@ -479,7 +479,7 @@ static int examine_directory (MUTTMENU * menu, struct browser_state *state, if (!(data = (NNTP_DATA *) tmp->data)) continue; if (prefix && *prefix && strncmp (prefix, data->group, - strlen (prefix)) != 0) + mutt_strlen (prefix)) != 0) continue; if (!((regexec (Mask.rx, data->group, 0, NULL, 0) == 0) ^ Mask.not)) continue; @@ -914,7 +914,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, 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); diff --git a/buffy.c b/buffy.c index db7d964..da3c04e 100644 --- a/buffy.c +++ b/buffy.c @@ -551,7 +551,7 @@ int mutt_buffy_list (void) 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)) @@ -560,19 +560,19 @@ int mutt_buffy_list (void) 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) break; if (!first) - 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) { - /* 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--; } - 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) { diff --git a/charset.c b/charset.c index 0a9339f..e0f0a8a 100644 --- a/charset.c +++ b/charset.c @@ -331,7 +331,7 @@ size_t mutt_iconv (iconv_t cd, ICONV_CONST char **inbuf, size_t * inbytesleft, 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; @@ -351,7 +351,7 @@ size_t mutt_iconv (iconv_t cd, ICONV_CONST char **inbuf, size_t * inbytesleft, outrepl = "?"; iconv (cd, 0, 0, &ob, &obl); if (obl) { - int n = strlen (outrepl); + int n = mutt_strlen (outrepl); if (n > obl) { outrepl = "?"; @@ -402,7 +402,7 @@ int mutt_convert_string (char **ps, const char *from, const char *to, else outrepl = "?"; - len = strlen (s); + len = mutt_strlen (s); ib = s, ibl = len + 1; obl = MB_LEN_MAX * ibl; ob = buf = safe_malloc (obl + 1); diff --git a/commands.c b/commands.c index 5626cb8..7f2c75d 100644 --- a/commands.c +++ b/commands.c @@ -873,8 +873,8 @@ int mutt_update_list_file (char *filename, char *section, char *key, done++; break; } - 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')) @@ -943,7 +943,7 @@ void mutt_edit_content_type (HEADER * h, BODY * b, FILE * fp) size_t l; for (p = b->parameter; p; p = p->next) { - l = strlen (buf); + l = mutt_strlen (buf); rfc822_cat (tmp, sizeof (tmp), p->value, MimeSpecials); snprintf (buf + l, sizeof (buf) - l, "; %s=%s", p->attribute, tmp); diff --git a/complete.c b/complete.c index 8ff2dce..f21d9e8 100644 --- a/complete.c +++ b/complete.c @@ -206,14 +206,14 @@ int mutt_complete (char *s, size_t slen) /* 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)); } else buf[0] = 0; - 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)) - strfcpy (filepart + strlen (filepart), "/", - sizeof (filepart) - strlen (filepart)); + strfcpy (filepart + mutt_strlen (filepart), "/", + sizeof (filepart) - mutt_strlen (filepart)); init = 1; } } @@ -224,8 +224,8 @@ int mutt_complete (char *s, size_t slen) 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); diff --git a/compress.c b/compress.c index e49fdcd..928a919 100644 --- a/compress.c +++ b/compress.c @@ -125,7 +125,7 @@ static void set_path (CONTEXT * ctx) /* 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); } diff --git a/crypt-gpgme.c b/crypt-gpgme.c index 6b74774..f7343bc 100644 --- a/crypt-gpgme.c +++ b/crypt-gpgme.c @@ -144,7 +144,7 @@ static const char *crypt_keyid (crypt_key_t * k) 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; } @@ -1025,10 +1025,10 @@ static void show_fingerprint (gpgme_key_t key, STATE * state) 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__ */ - 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]; @@ -1293,7 +1293,7 @@ static int verify_one (BODY * sigbdy, STATE * s, 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); } @@ -1820,13 +1820,13 @@ void pgp_gpgme_application_handler (BODY * m, STATE * s) /* 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; - 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 @@ -2478,7 +2478,7 @@ static int print_dn_part (FILE * fp, struct dn_array_s *dn, const char *key) 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)); any = 1; } } @@ -2754,7 +2754,7 @@ static void print_key_info (gpgme_key_t key, FILE * fp) 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); @@ -2816,7 +2816,7 @@ static void print_key_info (gpgme_key_t key, FILE * 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); @@ -2862,7 +2862,7 @@ static void print_key_info (gpgme_key_t key, FILE * fp) s = subkey->keyid; putc ('\n', fp); - if (strlen (s) == 16) + if (mutt_strlen (s) == 16) s += 8; /* display only the short keyID */ fprintf (fp, "Subkey ....: 0x%s", s); if (subkey->revoked) { @@ -3214,7 +3214,7 @@ static LIST *crypt_add_string_to_hints (LIST * hints, const char *str) for (t = strtok (scratch, " ,.:\"()<>\n"); t; t = strtok (NULL, " ,.:\"()<>\n")) { - if (strlen (t) > 3) + if (mutt_strlen (t) > 3) hints = mutt_add_list (hints, t); } @@ -3919,9 +3919,9 @@ static int verify_sender (HEADER * h, gpgme_protocol_t protocol) 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) { - 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) diff --git a/curs_lib.c b/curs_lib.c index 01751f1..4eab988 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -213,7 +213,7 @@ int mutt_yesorno (const char *msg, int def) 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); diff --git a/dotlock.c b/dotlock.c index c076a4b..eb761ad 100644 --- a/dotlock.c +++ b/dotlock.c @@ -126,6 +126,10 @@ static int dotlock_lock (const char *); #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; @@ -449,7 +453,7 @@ static int dotlock_prepare (char *bn, size_t l, const char *f, int _fd) dirname = "."; } - if (strlen (basename) + 1 > l) + if (mutt_strlen (basename) + 1 > l) return -1; strfcpy (bn, basename, l); diff --git a/enter.c b/enter.c index e01fb30..10f0725 100644 --- a/enter.c +++ b/enter.c @@ -487,7 +487,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x, } else if (flags & M_COMMAND) { my_wcstombs (buf, buflen, state->wbuf, state->curpos); - i = strlen (buf); + i = mutt_strlen (buf); if (i && buf[i - 1] == '=' && mutt_var_value_complete (buf, buflen, i)) state->tabs = 0; diff --git a/from.c b/from.c index 0aa67f5..e63cac6 100644 --- a/from.c +++ b/from.c @@ -38,7 +38,7 @@ static int is_day_name (const char *s) { int i; - 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) diff --git a/gnupgparse.c b/gnupgparse.c index 099755d..48a70bc 100644 --- a/gnupgparse.c +++ b/gnupgparse.c @@ -92,7 +92,7 @@ static void fix_uid (char *uid) 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); diff --git a/handler.c b/handler.c index 9a90f6f..0617b25 100644 --- a/handler.c +++ b/handler.c @@ -238,7 +238,7 @@ void mutt_decode_quoted (STATE * s, long len, int istext, iconv_t cd) if (fgets (line, MIN ((ssize_t) sizeof (line), len + 1), s->fpin) == NULL) break; - linelen = strlen (line); + linelen = mutt_strlen (line); len -= linelen; /* @@ -940,7 +940,7 @@ static void text_plain_flowed_handler (BODY * a, STATE * s) 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; @@ -970,7 +970,7 @@ static void text_plain_flowed_handler (BODY * a, STATE * s) */ full = 0; - l = strlen (t + 1); + l = mutt_strlen (t + 1); t[0] = ' '; t[1] = '\0'; @@ -1123,7 +1123,7 @@ static void print_flowed_line (char *line, STATE * s, int ql) { int width; char *pos, *oldpos; - int len = strlen (line); + int len = mutt_strlen (line); int i; if (MaxLineLength > 0) { @@ -1147,7 +1147,7 @@ static void print_flowed_line (char *line, STATE * s, int 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); @@ -1230,24 +1230,24 @@ static void text_plain_flowed_handler (BODY * a, STATE * s) while (bytes > 0 && fgets (buf, sizeof (buf), s->fpin)) { /* fprintf(stderr,"read `%s'",buf); */ - bytes -= strlen (buf); + bytes -= mutt_strlen (buf); 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] == ' ') - 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'; - curline_len += strlen (buf); + curline_len += mutt_strlen (buf); safe_strncat (curline, curline_len, buf + newql, - strlen (buf + newql)); + mutt_strlen (buf + newql)); } else { if (first_line) { @@ -1258,11 +1258,11 @@ static void text_plain_flowed_handler (BODY * a, STATE * s) } 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'; - 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)); quotelevel = newql; } } diff --git a/hcache.c b/hcache.c index 058645f..e5227af 100644 --- a/hcache.c +++ b/hcache.c @@ -493,7 +493,7 @@ static const char *mutt_hcache_per_folder (const char *path, } MD5Init (&md5); - 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, diff --git a/lib.c b/lib.c index 8f88c74..1966fd6 100644 --- a/lib.c +++ b/lib.c @@ -138,7 +138,7 @@ char *safe_strdup (const char *s) if (!s || !*s) return 0; - l = strlen (s) + 1; + l = mutt_strlen (s) + 1; p = (char *) safe_malloc (l); memcpy (p, s, l); return (p); @@ -193,7 +193,7 @@ void mutt_str_adjust (char **p) { if (!p || !*p) return; - safe_realloc (p, strlen (*p) + 1); + safe_realloc (p, mutt_strlen (*p) + 1); } /* convert all characters in the string to lowercase */ @@ -307,7 +307,7 @@ int safe_symlink (const char *oldpath, const char *newpath) 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; @@ -550,7 +550,7 @@ char *mutt_substrdup (const char *begin, const char *end) if (end) len = end - begin; else - len = strlen (begin); + len = mutt_strlen (begin); p = safe_malloc (len + 1); memcpy (p, begin, len); @@ -664,7 +664,7 @@ char *mutt_concat_path (char *d, const char *dir, const char *fname, size_t l) { 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); diff --git a/menu.c b/menu.c index e88e8f4..ec49550 100644 --- a/menu.c +++ b/menu.c @@ -151,7 +151,7 @@ void menu_pad_string (char *s, size_t n) 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); diff --git a/mh.c b/mh.c index a26579e..aecbc8f 100644 --- a/mh.c +++ b/mh.c @@ -980,7 +980,7 @@ static void maildir_flags (char *dest, size_t destlen, HEADER * hdr) 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); } } diff --git a/mutt_libesmtp.c b/mutt_libesmtp.c index 23b69f9..26f424c 100644 --- a/mutt_libesmtp.c +++ b/mutt_libesmtp.c @@ -179,7 +179,7 @@ int mutt_invoke_libesmtp (ADDRESS * from, /* the sender */ /* 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)) diff --git a/mutt_sasl.c b/mutt_sasl.c index 6b856e4..c52865b 100644 --- a/mutt_sasl.c +++ b/mutt_sasl.c @@ -129,7 +129,7 @@ static int iptostring (const struct sockaddr *addr, socklen_t addrlen, 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); @@ -499,7 +499,7 @@ static int mutt_sasl_cb_authname (void *context, int id, const char **result, *result = account->user; if (len) - *len = strlen (*result); + *len = mutt_strlen (*result); return SASL_OK; } @@ -520,7 +520,7 @@ static int mutt_sasl_cb_pass (sasl_conn_t * conn, void *context, int id, 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; diff --git a/mutt_socket.c b/mutt_socket.c index 2a48665..90ae621 100644 --- a/mutt_socket.c +++ b/mutt_socket.c @@ -175,7 +175,7 @@ int mutt_socket_readln_d (char *buf, size_t buflen, CONNECTION * conn, dprint (dbg, (debugfile, "< %s\n", buf)); - /* number of bytes read, not strlen */ + /* number of bytes read, not mutt_strlen */ return i + 1; } diff --git a/mutt_ssl.c b/mutt_ssl.c index 7372e2b..f124b99 100644 --- a/mutt_ssl.c +++ b/mutt_ssl.c @@ -369,7 +369,7 @@ static char *x509_get_part (char *line, const char *ndx) c = strstr (line, ndx); if (c) { - c += strlen (ndx); + c += mutt_strlen (ndx); c2 = strchr (c, '/'); if (c2) *c2 = '\0'; diff --git a/mutt_ssl_nss.c b/mutt_ssl_nss.c index 0c3746a..9b1bf50 100644 --- a/mutt_ssl_nss.c +++ b/mutt_ssl_nss.c @@ -90,7 +90,7 @@ static void mutt_nss_pretty_time (int64 usecs) t.tm_yday = ex.tm_yday; strfcpy (timebuf, asctime (&t), sizeof (timebuf)); - timebuf[strlen (timebuf) - 1] = 0; + timebuf[mutt_strlen (timebuf) - 1] = 0; addstr (timebuf); } diff --git a/muttlib.c b/muttlib.c index 6b9258f..fbd2243 100644 --- a/muttlib.c +++ b/muttlib.c @@ -361,8 +361,8 @@ char *_mutt_expand_path (char *s, size_t slen, int rx) #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 @@ -494,7 +494,7 @@ char *mutt_gecos_name (char *dest, size_t destlen, struct passwd *pw) 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] == '&') { @@ -1235,7 +1235,7 @@ void state_prefix_putc (char c, STATE * s) if (s->flags & M_PENDINGPREFIX) { int i; - i = strlen (Quotebuf); + i = mutt_strlen (Quotebuf); Quotebuf[i++] = c; Quotebuf[i] = '\0'; if (i == sizeof (Quotebuf) - 1 || c == '\n') { diff --git a/newsrc.c b/newsrc.c index cfa48d1..10a539f 100644 --- a/newsrc.c +++ b/newsrc.c @@ -70,7 +70,7 @@ static int nntp_parse_newsrc_line (NNTP_SERVER * news, char *line) 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; @@ -201,7 +201,7 @@ static int nntp_parse_cacheindex (NNTP_SERVER * news) 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; @@ -224,7 +224,7 @@ static int nntp_parse_cacheindex (NNTP_SERVER * news) 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; @@ -339,7 +339,7 @@ NNTP_SERVER *mutt_select_newsserver (char *server) return NULL; } - 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'); @@ -508,8 +508,8 @@ static void nntp_create_newsrc_line (NNTP_DATA * data, char **buf, 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'; @@ -642,7 +642,7 @@ int mutt_newsrc_update (NNTP_SERVER * news) continue; nntp_create_newsrc_line (data, &buf, &line, &llen); dprint (2, (debugfile, "Added to newsrc: %s", line)); - line += strlen (line); + line += mutt_strlen (line); } /* newrc being fully rewritten */ if (news->newsrc && @@ -668,7 +668,7 @@ static FILE *mutt_mkname (char *s) 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 */ @@ -875,7 +875,7 @@ NNTP_DATA *mutt_newsgroup_subscribe (NNTP_SERVER * news, char *group) 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; diff --git a/nntp.c b/nntp.c index a809dad..efd887f 100644 --- a/nntp.c +++ b/nntp.c @@ -327,7 +327,7 @@ static int mutt_nntp_fetch (NNTP_DATA * nntp_data, char *query, char *msg, strfcpy (inbuf + lenbuf, p, sizeof (buf)); if (chunk >= sizeof (buf)) { - lenbuf += strlen (p); + lenbuf += mutt_strlen (p); } else { line++; @@ -822,7 +822,7 @@ int nntp_open_mailbox (CONTEXT * ctx) /* 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); @@ -1009,7 +1009,7 @@ int nntp_post (const char *msg) buf[0] = '.'; buf[1] = '\0'; while (fgets (buf + 1, sizeof (buf) - 2, f) != NULL) { - len = strlen (buf); + len = mutt_strlen (buf); if (buf[len - 1] == '\n') { buf[len - 1] = '\r'; buf[len] = '\n'; @@ -1023,7 +1023,7 @@ int nntp_post (const char *msg) } fclose (f); - 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) { @@ -1234,7 +1234,7 @@ static int add_group (char *buf, void *serv) 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; diff --git a/parse.c b/parse.c index 7bb0699..584d62b 100644 --- a/parse.c +++ b/parse.c @@ -42,7 +42,7 @@ static char *read_rfc822_line (FILE * f, char *line, size_t * linelen) return (line); } - buf += strlen (buf) - 1; + buf += mutt_strlen (buf) - 1; if (*buf == '\n') { /* we did get a full line. remove trailing space */ while (ISSPACE (*buf)) @@ -91,7 +91,7 @@ LIST *mutt_parse_references (char *s, int in_reply_to) new = NULL; if (*s == '<') { - n = strlen (s); + n = mutt_strlen (s); if (s[n - 1] != '>') { o = s; s = NULL; @@ -101,7 +101,7 @@ LIST *mutt_parse_references (char *s, int in_reply_to) new = safe_strdup (s); } else if (o) { - m = strlen (s); + m = mutt_strlen (s); if (s[m - 1] == '>') { new = safe_malloc (sizeof (char) * (n + m + 1)); strcpy (new, o); /* __STRCPY_CHECKED__ */ @@ -1253,7 +1253,7 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p, /* 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)) diff --git a/pgp.c b/pgp.c index ecb6815..444eefd 100644 --- a/pgp.c +++ b/pgp.c @@ -1006,7 +1006,7 @@ static short is_numerical_keyid (const char *s) /* or should we require the "0x"? */ if (strncmp (s, "0x", 2) == 0) s += 2; - if (strlen (s) % 8) + if (mutt_strlen (s) % 8) return 0; while (*s) if (strchr ("0123456789ABCDEFabcdef", *s++) == NULL) diff --git a/pgpkey.c b/pgpkey.c index b6e0795..8186d2a 100644 --- a/pgpkey.c +++ b/pgpkey.c @@ -758,7 +758,7 @@ static LIST *pgp_add_string_to_hints (LIST * hints, const char *str) for (t = strtok (scratch, " ,.:\"()<>\n"); t; t = strtok (NULL, " ,.:\"()<>\n")) { - if (strlen (t) > 3) + if (mutt_strlen (t) > 3) hints = mutt_add_list (hints, t); } diff --git a/pgpmicalg.c b/pgpmicalg.c index d01e5bf..44f8c18 100644 --- a/pgpmicalg.c +++ b/pgpmicalg.c @@ -104,7 +104,7 @@ static void pgp_dearmor (FILE * in, FILE * out) return; } - if ((end = ftell (in) - strlen (line)) < start) { + if ((end = ftell (in) - mutt_strlen (line)) < start) { dprint (1, (debugfile, "pgp_dearmor: end < start???\n")); return; } diff --git a/pgppubring.c b/pgppubring.c index b1c59ff..81d9c47 100644 --- a/pgppubring.c +++ b/pgppubring.c @@ -740,7 +740,7 @@ static void pgpring_find_candidates (char *ringfile, const char *hints[], 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); diff --git a/pop.c b/pop.c index f39f023..f23fa2f 100644 --- a/pop.c +++ b/pop.c @@ -509,7 +509,7 @@ void pop_fetch_mail (void) return; } - 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'); diff --git a/pop_auth.c b/pop_auth.c index 2583e18..785e1a9 100644 --- a/pop_auth.c +++ b/pop_auth.c @@ -87,7 +87,7 @@ static pop_auth_res_t pop_auth_sasl (POP_DATA * pop_data, const char *method) mutt_message _("Authenticating (SASL)..."); snprintf (buf, sizeof (buf), "AUTH %s", mech); - olen = strlen (buf); + olen = mutt_strlen (buf); /* looping protocol */ FOREVER { @@ -104,11 +104,11 @@ static pop_auth_res_t pop_auth_sasl (POP_DATA * pop_data, const char *method) #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) - && sasl_decode64 (inbuf, strlen (inbuf), buf, &len) != SASL_OK) + && sasl_decode64 (inbuf, mutt_strlen (inbuf), buf, &len) != SASL_OK) #endif { dprint (1, @@ -203,9 +203,9 @@ static pop_auth_res_t pop_auth_apop (POP_DATA * pop_data, const char *method) /* 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, - strlen (pop_data->conn->account.pass)); + mutt_strlen (pop_data->conn->account.pass)); MD5Final (digest, &mdContext); for (i = 0; i < sizeof (digest); i++) diff --git a/pop_lib.c b/pop_lib.c index 6b814fa..c5ec1d0 100644 --- a/pop_lib.c +++ b/pop_lib.c @@ -68,7 +68,7 @@ void pop_error (POP_DATA * pop_data, char *msg) c = c2; } - 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); } @@ -106,12 +106,12 @@ static int fetch_auth (char *line, void *data) 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, - 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__ */ @@ -446,7 +446,7 @@ int pop_fetch_data (POP_DATA * pop_data, char *query, char *msg, strfcpy (inbuf + lenbuf, p, sizeof (buf)); if (chunk >= sizeof (buf)) { - lenbuf += strlen (p); + lenbuf += mutt_strlen (p); } else { line++; diff --git a/regex.c b/regex.c index c6c9850..9db19c5 100644 --- a/regex.c +++ b/regex.c @@ -5385,7 +5385,7 @@ re_comp (s) /* 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); if (!ret) return NULL; @@ -5402,7 +5402,7 @@ int 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); @@ -5499,8 +5499,8 @@ int regcomp (preg, pattern, cflags) 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. */ @@ -5535,7 +5535,7 @@ int regexec (preg, string, nmatch, pmatch, eflags) 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; @@ -5604,7 +5604,7 @@ size_t regerror (errcode, preg, errbuf, errbuf_size) 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) { diff --git a/remailer.c b/remailer.c index 83cb556..ee5182e 100644 --- a/remailer.c +++ b/remailer.c @@ -230,7 +230,7 @@ static void mix_screen_coordinates (REMAILER ** type2_list, if (i) { c = - 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 { @@ -241,7 +241,7 @@ static void mix_screen_coordinates (REMAILER ** type2_list, 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; 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) { diff --git a/rfc2231.c b/rfc2231.c index cbdd19f..81ac735 100644 --- a/rfc2231.c +++ b/rfc2231.c @@ -266,7 +266,7 @@ static void rfc2231_join_continuations (PARAMETER ** head, 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__ */ @@ -311,10 +311,10 @@ int rfc2231_encode_string (char **pd) 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; - dlen = strlen (d); + dlen = mutt_strlen (d); } if (!mutt_is_us_ascii (charset)) @@ -327,9 +327,9 @@ int rfc2231_encode_string (char **pd) ++ext; if (encode) { - 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__ */ - t = e + strlen (e); + t = e + mutt_strlen (e); for (s = d, slen = dlen; slen; s++, slen--) if (*s < 0x20 || *s >= 0x7f || strchr (MimeSpecials, *s) || strchr ("*'%", *s)) { diff --git a/sendlib.c b/sendlib.c index 4c410cf..b5b4ff1 100644 --- a/sendlib.c +++ b/sendlib.c @@ -1787,11 +1787,11 @@ static void mutt_gen_localpart (char *buf, unsigned int len, char *fmt) 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 ()); - safe_strncat (buf, len, tmp, strlen (tmp)); + safe_strncat (buf, len, tmp, mutt_strlen (tmp)); break; case 'P': snprintf (tmp, sizeof (tmp), "%c", MsgIdPfx); @@ -1800,11 +1800,11 @@ static void mutt_gen_localpart (char *buf, unsigned int len, char *fmt) 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 ()); - 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); @@ -1812,11 +1812,11 @@ static void mutt_gen_localpart (char *buf, unsigned int len, char *fmt) 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); - 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 ;-) */ @@ -1853,7 +1853,7 @@ char *mutt_gen_msgid (void) 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); diff --git a/sidebar.c b/sidebar.c index 0f6c660..e5ec1c2 100644 --- a/sidebar.c +++ b/sidebar.c @@ -85,7 +85,7 @@ static char *shortened_hierarchy (char *box) int i, j; char *new_box; - for (i = 0; i < strlen (box); ++i) { + for (i = 0; i < mutt_strlen (box); ++i) { if (box[i] == '.') ++dots; else if (isupper (box[i])) @@ -94,9 +94,9 @@ static char *shortened_hierarchy (char *box) 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); new_box[0] = box[0]; - 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; @@ -130,10 +130,10 @@ char *make_sidebar_entry (char *box, int size, int new, int flagged) 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) { - box += strlen (ImapHomeNamespace) + 1; + box += mutt_strlen (ImapHomeNamespace) + 1; } } #endif @@ -146,7 +146,7 @@ char *make_sidebar_entry (char *box, int size, int new, int flagged) box = shortened_hierarchy (box); shortened = 1; } - i = strlen (box); + i = mutt_strlen (box); strncpy (entry, box, i < SidebarWidth - dlen ? i : SidebarWidth - dlen); if (new) { diff --git a/snprintf.c b/snprintf.c index 2a40c4f..0eac092 100644 --- a/snprintf.c +++ b/snprintf.c @@ -400,7 +400,7 @@ static void fmtstr (char *buffer, size_t * currlen, size_t maxlen, value = ""; } - for (strln = 0; value[strln]; ++strln); /* strlen */ + for (strln = 0; value[strln]; ++strln); /* mutt_strlen */ padlen = min - strln; if (padlen < 0) padlen = 0; @@ -687,7 +687,7 @@ int vsnprintf (char *str, size_t count, const char *fmt, va_list args) { str[0] = 0; dopr (str, count, fmt, args); - return (strlen (str)); + return (mutt_strlen (str)); } #endif /* !HAVE_VSNPRINTF */ @@ -715,7 +715,7 @@ int snprintf (va_alist) (void) vsnprintf (str, count, fmt, ap); VA_END; - return (strlen (str)); + return (mutt_strlen (str)); } #ifdef TEST_SNPRINTF diff --git a/strdup.c b/strdup.c index f154b88..79c26c5 100644 --- a/strdup.c +++ b/strdup.c @@ -19,9 +19,9 @@ char *strdup (const char *s) if (s == NULL) return NULL; - if ((d = malloc (strlen (s) + 1)) == NULL) /* __MEM_CHECKED__ */ + if ((d = malloc (mutt_strlen (s) + 1)) == NULL) /* __MEM_CHECKED__ */ return NULL; - memcpy (d, s, strlen (s) + 1); + memcpy (d, s, mutt_strlen (s) + 1); return d; } diff --git a/url.c b/url.c index 3d7a333..405ed23 100644 --- a/url.c +++ b/url.c @@ -170,7 +170,7 @@ int url_ciss_tostring (ciss_url_t * ciss, char *dest, size_t len, int flags) if (ciss->host) { safe_strcat (dest, len, "//"); - len -= (l = strlen (dest)); + len -= (l = mutt_strlen (dest)); dest += l; if (ciss->user) { @@ -179,7 +179,7 @@ int url_ciss_tostring (ciss_url_t * ciss, char *dest, size_t len, int flags) else snprintf (dest, len, "%s@", ciss->user); - len -= (l = strlen (dest)); + len -= (l = mutt_strlen (dest)); dest += l; } @@ -235,7 +235,7 @@ int url_parse_mailto (ENVELOPE * e, char **body, const char *src) mutt_str_replace (body, value); } else { - taglen = strlen (tag); + taglen = mutt_strlen (tag); /* mutt_parse_rfc822_line makes some assumptions */ snprintf (scratch, sizeof (scratch), "%s: %s", tag, value); scratch[taglen] = '\0';