From 96d53ff49c308769efbf708e1e65819077cb7af6 Mon Sep 17 00:00:00 2001 From: nion Date: Sun, 17 Jul 2005 11:45:15 +0000 Subject: [PATCH] Nico Golde: - migrated safe_strlen to mutt_strlen - migrated safe_strcmp to mutt_strcmp git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@330 e385b8ad-14ed-0310-8656-cc95a2468c6d --- account.c | 6 ++-- alias.c | 8 ++--- ascii.h | 2 +- attach.c | 10 +++---- browser.c | 16 +++++----- buffy.c | 14 ++++----- charset.c | 12 ++++---- color.c | 6 ++-- commands.c | 10 +++---- complete.c | 22 +++++++------- compose.c | 8 ++--- compress.c | 2 +- copy.c | 22 +++++++------- crypt-gpgme.c | 62 +++++++++++++++++++------------------- crypt.c | 2 +- curs_lib.c | 18 +++++------ dotlock.c | 4 +-- edit.c | 16 +++++----- enter.c | 2 +- from.c | 2 +- gnupgparse.c | 12 ++++---- handler.c | 48 +++++++++++++++--------------- hash.c | 6 ++-- hcache.c | 24 +++++++-------- hdrline.c | 4 +-- help.c | 14 ++++----- history.c | 2 +- hook.c | 6 ++-- imap/auth_cram.c | 6 ++-- imap/auth_gss.c | 4 +-- imap/auth_sasl.c | 4 +-- imap/browse.c | 24 +++++++-------- imap/command.c | 4 +-- imap/imap.c | 10 +++---- imap/message.c | 4 +-- imap/utf7.c | 4 +-- imap/util.c | 6 ++-- init.c | 76 +++++++++++++++++++++++------------------------ keymap.c | 12 ++++---- lib.c | 4 +-- lib/rx.c | 4 +-- lib/str.c | 16 +++++----- lib/str.h | 4 +-- main.c | 2 +- mbox.c | 30 +++++++++---------- menu.c | 4 +-- mh.c | 30 +++++++++---------- mutt_idna.c | 6 ++-- mutt_libesmtp.c | 2 +- mutt_sasl.c | 8 ++--- mutt_socket.c | 6 ++-- mutt_ssl.c | 2 +- mutt_ssl_gnutls.c | 4 +-- mutt_ssl_nss.c | 2 +- muttlib.c | 36 +++++++++++----------- mx.c | 4 +-- nntp/newsrc.c | 24 +++++++-------- nntp/nntp.c | 14 ++++----- pager.c | 4 +-- parse.c | 14 ++++----- pattern.c | 8 ++--- pgp.c | 36 +++++++++++----------- pgpkey.c | 2 +- pgpmicalg.c | 2 +- pgppubring.c | 2 +- pop/pop.c | 2 +- pop/pop_lib.c | 2 +- query.c | 6 ++-- recvattach.c | 2 +- remailer.c | 6 ++-- rfc1524.c | 8 ++--- rfc2047.c | 40 ++++++++++++------------- rfc2231.c | 14 ++++----- rfc822.c | 12 ++++---- score.c | 6 ++-- send.c | 16 +++++----- sendlib.c | 34 ++++++++++----------- sidebar.c | 22 +++++++------- smime.c | 28 ++++++++--------- snprintf.c | 10 +++---- sort.c | 4 +-- status.c | 2 +- thread.c | 10 +++---- url.c | 6 ++-- 84 files changed, 507 insertions(+), 507 deletions(-) diff --git a/account.c b/account.c index ca7a729..aff9d3a 100644 --- a/account.c +++ b/account.c @@ -54,11 +54,11 @@ int mutt_account_match (const ACCOUNT * a1, const ACCOUNT * a2) #endif if (a1->flags & a2->flags & M_ACCT_USER) - return (!safe_strcmp (a1->user, a2->user)); + return (!mutt_strcmp (a1->user, a2->user)); if (a1->flags & M_ACCT_USER) - return (!safe_strcmp (a1->user, user)); + return (!mutt_strcmp (a1->user, user)); if (a2->flags & M_ACCT_USER) - return (!safe_strcmp (a2->user, user)); + return (!mutt_strcmp (a2->user, user)); return 1; } diff --git a/alias.c b/alias.c index cfcd456..8835fa9 100644 --- a/alias.c +++ b/alias.c @@ -49,7 +49,7 @@ static ADDRESS *mutt_expand_aliases_r (ADDRESS * a, LIST ** expn) if (t) { i = 0; for (u = *expn; u; u = u->next) { - if (safe_strcmp (a->mailbox, u->data) == 0) { /* alias already found */ + if (mutt_strcmp (a->mailbox, u->data) == 0) { /* alias already found */ debug_print(1, ("loop in alias found for '%s'\n", a->mailbox)); i = 1; break; @@ -392,7 +392,7 @@ int mutt_alias_complete (char *s, size_t buflen) if (a->name && strstr (a->name, s) == a->name) { if (!bestname[0]) /* init */ strfcpy (bestname, a->name, - min (safe_strlen (a->name) + 1, sizeof (bestname))); + min (mutt_strlen (a->name) + 1, sizeof (bestname))); else { for (i = 0; a->name[i] && a->name[i] == bestname[i]; i++); bestname[i] = 0; @@ -402,9 +402,9 @@ int mutt_alias_complete (char *s, size_t buflen) } if (bestname[0] != 0) { - if (safe_strcmp (bestname, s) != 0) { + if (mutt_strcmp (bestname, s) != 0) { /* we are adding something to the completion */ - strfcpy (s, bestname, safe_strlen (bestname) + 1); + strfcpy (s, bestname, mutt_strlen (bestname) + 1); return 1; } diff --git a/ascii.h b/ascii.h index 4074ca3..0fcec5c 100644 --- a/ascii.h +++ b/ascii.h @@ -22,7 +22,7 @@ int ascii_tolower (int c); int ascii_strcasecmp (const char *a, const char *b); int ascii_strncasecmp (const char *a, const char *b, int n); -#define ascii_strcmp(a,b) safe_strcmp(a,b) +#define ascii_strcmp(a,b) mutt_strcmp(a,b) #define ascii_strncmp(a,b,c) safe_strncmp(a,b,c) #endif diff --git a/attach.c b/attach.c index 725fa96..a2809ce 100644 --- a/attach.c +++ b/attach.c @@ -272,7 +272,7 @@ static int is_mmnoask (const char *buf) int lng; if ((p = getenv ("MM_NOASK")) != NULL && *p) { - if (safe_strcmp (p, "1") == 0) + if (mutt_strcmp (p, "1") == 0) return (1); strfcpy (tmp, p, sizeof (tmp)); @@ -290,7 +290,7 @@ static int is_mmnoask (const char *buf) } } else { - lng = safe_strlen (p); + lng = mutt_strlen (p); if (buf[lng] == '/' && safe_strncasecmp (buf, p, lng) == 0) return (1); } @@ -308,7 +308,7 @@ void mutt_check_lookup_list (BODY * b, char *type, int len) int i; for (; t; t = t->next) { - i = safe_strlen (t->data) - 1; + i = mutt_strlen (t->data) - 1; if ((i > 0 && t->data[i - 1] == '/' && t->data[i] == '*' && ascii_strncasecmp (type, t->data, i) == 0) || ascii_strcasecmp (type, t->data) == 0) { @@ -359,7 +359,7 @@ int mutt_is_autoview (BODY * b, const char *type) } for (; t; t = t->next) { - i = safe_strlen (t->data) - 1; + i = mutt_strlen (t->data) - 1; if ((i > 0 && t->data[i - 1] == '/' && t->data[i] == '*' && ascii_strncasecmp (type, t->data, i) == 0) || ascii_strcasecmp (type, t->data) == 0) @@ -428,7 +428,7 @@ int mutt_view_attachment (FILE * fp, BODY * a, int flag, HEADER * hdr, if (rfc1524_expand_filename (entry->nametemplate, fname, tempfile, sizeof (tempfile))) { - if (fp == NULL && safe_strcmp (tempfile, a->filename)) { + if (fp == NULL && mutt_strcmp (tempfile, a->filename)) { /* send case: the file is already there */ if (safe_symlink (a->filename, tempfile) == -1) { if (mutt_yesorno (_("Can't match nametemplate, continue?"), M_YES) diff --git a/browser.c b/browser.c index 7c860de..1692548 100644 --- a/browser.c +++ b/browser.c @@ -485,7 +485,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, - safe_strlen (prefix)) != 0) + mutt_strlen (prefix)) != 0) continue; if (!((regexec (Mask.rx, data->group, 0, NULL, 0) == 0) ^ Mask.not)) continue; @@ -530,11 +530,11 @@ static int examine_directory (MUTTMENU * menu, struct browser_state *state, init_state (state, menu); while ((de = readdir (dp)) != NULL) { - if (safe_strcmp (de->d_name, ".") == 0) + if (mutt_strcmp (de->d_name, ".") == 0) continue; /* we don't need . */ if (prefix && *prefix - && safe_strncmp (prefix, de->d_name, safe_strlen (prefix)) != 0) + && safe_strncmp (prefix, de->d_name, mutt_strlen (prefix)) != 0) continue; if (!((regexec (Mask.rx, de->d_name, 0, NULL, 0) == 0) ^ Mask.not)) continue; @@ -775,7 +775,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, } else { #endif - for (i = safe_strlen (f) - 1; i > 0 && f[i] != '/'; i--); + for (i = mutt_strlen (f) - 1; i > 0 && f[i] != '/'; i--); if (i > 0) { if (f[0] == '/') { if (i > sizeof (LastDir) - 1) @@ -891,8 +891,8 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, /* save the old directory */ strfcpy (OldLastDir, LastDir, sizeof (OldLastDir)); - if (safe_strcmp (state.entry[menu->current].name, "..") == 0) { - if (safe_strcmp ("..", LastDir + safe_strlen (LastDir) - 2) == 0) + if (mutt_strcmp (state.entry[menu->current].name, "..") == 0) { + if (mutt_strcmp ("..", LastDir + mutt_strlen (LastDir) - 2) == 0) strcat (LastDir, "/.."); /* __STRCAT_CHECKED__ */ else { char *p = strrchr (LastDir + 1, '/'); @@ -920,7 +920,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 = safe_strlen (LastDir) + 1; + n = mutt_strlen (LastDir) + 1; /* special case "" needs no delimiter */ url_parse_ciss (&url, state.entry[menu->current].name); @@ -1125,7 +1125,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, #endif { /* add '/' at the end of the directory name if not already there */ - int len = safe_strlen (LastDir); + int len = mutt_strlen (LastDir); if (len && LastDir[len - 1] != '/' && sizeof (buf) > len) buf[len] = '/'; diff --git a/buffy.c b/buffy.c index 7c8555a..f4718fe 100644 --- a/buffy.c +++ b/buffy.c @@ -71,13 +71,13 @@ static int fseek_last_message (FILE * f) * reads will be on block boundaries, which might increase efficiency. */ while ((pos -= bytes_read) >= 0) { /* we save in the buffer at the end the first 7 chars from the last read */ - strncpy (buffer + BUFSIZ, buffer, 5 + 2); /* 2 == 2 * safe_strlen(CRLF) */ + strncpy (buffer + BUFSIZ, buffer, 5 + 2); /* 2 == 2 * mutt_strlen(CRLF) */ fseek (f, pos, SEEK_SET); bytes_read = fread (buffer, sizeof (char), bytes_read, f); if (bytes_read == -1) return -1; for (i = bytes_read; --i >= 0;) - if (!safe_strncmp (buffer + i, "\n\nFrom ", safe_strlen ("\n\nFrom "))) { /* found it - go to the beginning of the From */ + if (!safe_strncmp (buffer + i, "\n\nFrom ", mutt_strlen ("\n\nFrom "))) { /* found it - go to the beginning of the From */ fseek (f, pos + i + 2, SEEK_SET); return 0; } @@ -511,7 +511,7 @@ int buffy_list (void) pos = 0; first = 1; buffylist[0] = 0; - pos += safe_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__ */ if (Incoming) { for (i = 0; i < Incoming->length; i++) { tmp = (BUFFY*) Incoming->data[i]; @@ -522,19 +522,19 @@ int buffy_list (void) strfcpy (path, tmp->path, sizeof (path)); mutt_pretty_mailbox (path); - if (!first && pos + safe_strlen (path) >= COLS - 7) + if (!first && pos + mutt_strlen (path) >= COLS - 7) break; if (!first) - pos += safe_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 += safe_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 += safe_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; } } diff --git a/charset.c b/charset.c index 4bae308..fbf8a69 100644 --- a/charset.c +++ b/charset.c @@ -335,7 +335,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 = safe_strlen (*t); + size_t ibl1 = mutt_strlen (*t); char *ob1 = ob; size_t obl1 = obl; @@ -355,7 +355,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 = safe_strlen (outrepl); + int n = mutt_strlen (outrepl); if (n > obl) { outrepl = "?"; @@ -406,7 +406,7 @@ int mutt_convert_string (char **ps, const char *from, const char *to, else outrepl = "?"; - len = safe_strlen (s); + len = mutt_strlen (s); ib = s, ibl = len + 1; obl = MB_LEN_MAX * ibl; ob = buf = safe_malloc (obl + 1); @@ -561,7 +561,7 @@ char *mutt_get_first_charset (const char *charset) const char *c, *c1; c = charset; - if (!safe_strlen (c)) + if (!mutt_strlen (c)) return "us-ascii"; if (!(c1 = strchr (c, ':'))) return charset; @@ -611,14 +611,14 @@ int mutt_convert_nonmime_string (char **ps) char *s; char *fromcode; size_t m, n; - size_t ulen = safe_strlen (*ps); + size_t ulen = mutt_strlen (*ps); size_t slen; if (!u || !*u) return 0; c1 = strchr (c, ':'); - n = c1 ? c1 - c : safe_strlen (c); + n = c1 ? c1 - c : mutt_strlen (c); if (!n) continue; fromcode = safe_malloc (n + 1); diff --git a/color.c b/color.c index 9270516..6266e67 100644 --- a/color.c +++ b/color.c @@ -399,7 +399,7 @@ _mutt_parse_uncolor (BUFFER * buf, BUFFER * s, unsigned long data, do { mutt_extract_token (buf, s, 0); - if (!safe_strcmp ("*", buf->data)) { + if (!mutt_strcmp ("*", buf->data)) { for (tmp = ColorIndexList; tmp;) { if (!do_cache) do_cache = 1; @@ -412,7 +412,7 @@ _mutt_parse_uncolor (BUFFER * buf, BUFFER * s, unsigned long data, else { for (last = NULL, tmp = ColorIndexList; tmp; last = tmp, tmp = tmp->next) { - if (!safe_strcmp (buf->data, tmp->pattern)) { + if (!mutt_strcmp (buf->data, tmp->pattern)) { if (!do_cache) do_cache = 1; debug_print (1, ("Freeing pattern \"%s\" from ColorIndexList\n", tmp->pattern)); @@ -454,7 +454,7 @@ add_pattern (COLOR_LINE ** top, const char *s, int sensitive, while (tmp) { if (sensitive) { - if (safe_strcmp (s, tmp->pattern) == 0) + if (mutt_strcmp (s, tmp->pattern) == 0) break; } else { diff --git a/commands.c b/commands.c index 0ddfabb..c17c0ce 100644 --- a/commands.c +++ b/commands.c @@ -92,7 +92,7 @@ int mutt_display_message (HEADER * cur) } } - if (!Pager || safe_strcmp (Pager, "builtin") == 0) + if (!Pager || mutt_strcmp (Pager, "builtin") == 0) builtin = 1; else { mutt_make_string (buf, sizeof (buf), NONULL (PagerFmt), Context, cur); @@ -736,7 +736,7 @@ int mutt_save_message (HEADER * h, int delete, /* This is an undocumented feature of ELM pointed out to me by Felix von * Leitner */ - if (safe_strcmp (buf, ".") == 0) + if (mutt_strcmp (buf, ".") == 0) strfcpy (buf, LastSaveFolder, sizeof (buf)); else strfcpy (LastSaveFolder, buf, sizeof (LastSaveFolder)); @@ -889,8 +889,8 @@ int mutt_update_list_file (char *filename, char *section, char *key, done++; break; } - else if (key && !strncmp (buf, key, safe_strlen (key)) && - (!*key || buf[safe_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')) @@ -959,7 +959,7 @@ void mutt_edit_content_type (HEADER * h, BODY * b, FILE * fp) size_t l; for (p = b->parameter; p; p = p->next) { - l = safe_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 77cc117..2c0f14e 100644 --- a/complete.c +++ b/complete.c @@ -60,7 +60,7 @@ int mutt_complete (char *s, size_t slen) * special case to handle when there is no filepart yet. * find the first subscribed newsgroup */ - if ((len = safe_strlen (filepart)) == 0) { + if ((len = mutt_strlen (filepart)) == 0) { for (; l; l = l->next) { NNTP_DATA *data = (NNTP_DATA *) l->data; @@ -176,10 +176,10 @@ int mutt_complete (char *s, size_t slen) * special case to handle when there is no filepart yet. find the first * file/directory which is not ``.'' or ``..'' */ - if ((len = safe_strlen (filepart)) == 0) { + if ((len = mutt_strlen (filepart)) == 0) { while ((de = readdir (dirp)) != NULL) { - if (safe_strcmp (".", de->d_name) != 0 - && safe_strcmp ("..", de->d_name) != 0) { + if (mutt_strcmp (".", de->d_name) != 0 + && mutt_strcmp ("..", de->d_name) != 0) { strfcpy (filepart, de->d_name, sizeof (filepart)); init++; break; @@ -207,14 +207,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 + safe_strlen (buf), "/", sizeof (buf) - safe_strlen (buf)); + strfcpy (buf + mutt_strlen (buf), "/", sizeof (buf) - mutt_strlen (buf)); } else buf[0] = 0; - strfcpy (buf + safe_strlen (buf), filepart, sizeof (buf) - safe_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 + safe_strlen (filepart), "/", - sizeof (filepart) - safe_strlen (filepart)); + strfcpy (filepart + mutt_strlen (filepart), "/", + sizeof (filepart) - mutt_strlen (filepart)); init = 1; } } @@ -223,10 +223,10 @@ int mutt_complete (char *s, size_t slen) if (dirpart[0]) { strfcpy (s, dirpart, slen); - if (safe_strcmp ("/", dirpart) != 0 && dirpart[0] != '=' + if (mutt_strcmp ("/", dirpart) != 0 && dirpart[0] != '=' && dirpart[0] != '+') - strfcpy (s + safe_strlen (s), "/", slen - safe_strlen (s)); - strfcpy (s + safe_strlen (s), filepart, slen - safe_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/compose.c b/compose.c index 9dc603d..377d60e 100644 --- a/compose.c +++ b/compose.c @@ -221,14 +221,14 @@ static void redraw_mix_line (LIST * chain) if (t && t[0] == '0' && t[1] == '\0') t = ""; - if (c + safe_strlen (t) + 2 >= COLS - SidebarWidth) + if (c + mutt_strlen (t) + 2 >= COLS - SidebarWidth) break; addstr (NONULL (t)); if (chain->next) addstr (", "); - c += safe_strlen (t) + 2; + c += mutt_strlen (t) + 2; } } #endif /* MIXMASTER */ @@ -694,7 +694,7 @@ int mutt_compose_menu (HEADER * msg, /* structure for new message */ mutt_message_hook (NULL, msg, M_SEND2HOOK); break; case OP_COMPOSE_EDIT_MESSAGE: - if (Editor && (safe_strcmp ("builtin", Editor) != 0) + if (Editor && (mutt_strcmp ("builtin", Editor) != 0) && !option (OPTEDITHDRS)) { mutt_edit_file (Editor, msg->content->filename); mutt_update_encoding (msg->content); @@ -704,7 +704,7 @@ int mutt_compose_menu (HEADER * msg, /* structure for new message */ } /* fall through */ case OP_COMPOSE_EDIT_HEADERS: - if (safe_strcmp ("builtin", Editor) != 0 && + if (mutt_strcmp ("builtin", Editor) != 0 && (op == OP_COMPOSE_EDIT_HEADERS || (op == OP_COMPOSE_EDIT_MESSAGE && option (OPTEDITHDRS)))) { char *tag = NULL, *err = NULL; diff --git a/compress.c b/compress.c index 79ead4e..7362c55 100644 --- a/compress.c +++ b/compress.c @@ -130,7 +130,7 @@ static void set_path (CONTEXT * ctx) /* Uncompress to /tmp */ mutt_mktemp (tmppath); - ctx->path = safe_malloc (safe_strlen (tmppath) + 1); + ctx->path = safe_malloc (mutt_strlen (tmppath) + 1); strcpy (ctx->path, tmppath); } diff --git a/copy.c b/copy.c index 87f41c6..e4bb6c4 100644 --- a/copy.c +++ b/copy.c @@ -146,8 +146,8 @@ mutt_copy_hdr (FILE * in, FILE * out, long off_start, long off_end, int flags, if (!headers[x]) headers[x] = this_one; else { - safe_realloc (&headers[x], safe_strlen (headers[x]) + - safe_strlen (this_one) + sizeof (char)); + safe_realloc (&headers[x], mutt_strlen (headers[x]) + + mutt_strlen (this_one) + sizeof (char)); strcat (headers[x], this_one); /* __STRCAT_CHECKED__ */ FREE (&this_one); } @@ -198,7 +198,7 @@ mutt_copy_hdr (FILE * in, FILE * out, long off_start, long off_end, int flags, /* Find x -- the array entry where this header is to be saved */ if (flags & CH_REORDER) { for (t = HeaderOrderList, x = 0; (t); t = t->next, x++) { - if (!ascii_strncasecmp (buf, t->data, safe_strlen (t->data))) { + if (!ascii_strncasecmp (buf, t->data, mutt_strlen (t->data))) { debug_print (2, ("Reorder: %s matches %s\n", t->data, buf)); break; } @@ -214,7 +214,7 @@ mutt_copy_hdr (FILE * in, FILE * out, long off_start, long off_end, int flags, this_one = safe_strdup (buf); else { safe_realloc (&this_one, - safe_strlen (this_one) + safe_strlen (buf) + + mutt_strlen (this_one) + mutt_strlen (buf) + sizeof (char)); strcat (this_one, buf); /* __STRCAT_CHECKED__ */ } @@ -231,8 +231,8 @@ mutt_copy_hdr (FILE * in, FILE * out, long off_start, long off_end, int flags, if (!headers[x]) headers[x] = this_one; else { - safe_realloc (&headers[x], safe_strlen (headers[x]) + - safe_strlen (this_one) + sizeof (char)); + safe_realloc (&headers[x], mutt_strlen (headers[x]) + + mutt_strlen (this_one) + sizeof (char)); strcat (headers[x], this_one); /* __STRCAT_CHECKED__ */ FREE (&this_one); } @@ -520,12 +520,12 @@ _mutt_copy_message (FILE * fpout, FILE * fpin, HEADER * hdr, BODY * body, char date[SHORT_STRING]; mutt_make_date (date, sizeof (date)); - date[5] = date[safe_strlen (date) - 1] = '\"'; + date[5] = date[mutt_strlen (date) - 1] = '\"'; /* Count the number of lines and bytes to be deleted */ fseek (fpin, body->offset, SEEK_SET); new_lines = hdr->lines - - count_delete_lines (fpin, body, &new_length, safe_strlen (date)); + count_delete_lines (fpin, body, &new_length, mutt_strlen (date)); /* Copy the headers */ if (mutt_copy_header (fpin, hdr, fpout, @@ -804,7 +804,7 @@ static void format_address_header (char **h, ADDRESS * a) int l, linelen, buflen, count; - linelen = safe_strlen (*h); + linelen = mutt_strlen (*h); buflen = linelen + 3; @@ -817,7 +817,7 @@ static void format_address_header (char **h, ADDRESS * a) rfc822_write_address (buf, sizeof (buf), a, 0); a->next = tmp; - l = safe_strlen (buf); + l = mutt_strlen (buf); if (count && linelen + l > 74) { strcpy (cbuf, "\n\t"); /* __STRCPY_CHECKED__ */ linelen = l + 8; @@ -835,7 +835,7 @@ static void format_address_header (char **h, ADDRESS * a) strcpy (c2buf, ","); /* __STRCPY_CHECKED__ */ } - buflen += l + safe_strlen (cbuf) + safe_strlen (c2buf); + buflen += l + mutt_strlen (cbuf) + mutt_strlen (c2buf); safe_realloc (h, buflen); strcat (*h, cbuf); /* __STRCAT_CHECKED__ */ strcat (*h, buf); /* __STRCAT_CHECKED__ */ diff --git a/crypt-gpgme.c b/crypt-gpgme.c index e3dd337..a147693 100644 --- a/crypt-gpgme.c +++ b/crypt-gpgme.c @@ -149,7 +149,7 @@ static const char *crypt_keyid (crypt_key_t * k) if (k->kobj && k->kobj->subkeys) { s = k->kobj->subkeys->keyid; - if ((!option (OPTPGPLONGIDS)) && (safe_strlen (s) == 16)) + if ((!option (OPTPGPLONGIDS)) && (mutt_strlen (s) == 16)) /* Return only the short keyID. */ s += 8; } @@ -1003,7 +1003,7 @@ static int show_sig_summary (unsigned long sum, state_attach_puts (": ", s); if (t0) state_attach_puts (t0, s); - if (t1 && !(t0 && !safe_strcmp (t0, t1))) { + if (t1 && !(t0 && !mutt_strcmp (t0, t1))) { if (t0) state_attach_puts (",", s); state_attach_puts (t1, s); @@ -1030,10 +1030,10 @@ static void show_fingerprint (gpgme_key_t key, STATE * state) return; is_pgp = (key->protocol == GPGME_PROTOCOL_OpenPGP); - buf = safe_malloc (safe_strlen (prefix) + safe_strlen (s) * 4 + 2); + buf = safe_malloc (mutt_strlen (prefix) + mutt_strlen (s) * 4 + 2); strcpy (buf, prefix); /* __STRCPY_CHECKED__ */ - p = buf + safe_strlen (buf); - if (is_pgp && safe_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]; @@ -1298,7 +1298,7 @@ static int verify_one (BODY * sigbdy, STATE * s, if (notation->value) { state_attach_puts (notation->value, s); if (!(*notation->value - && (notation->value[safe_strlen (notation->value) - 1] == + && (notation->value[mutt_strlen (notation->value) - 1] == '\n'))) state_attach_puts ("\n", s); } @@ -1657,9 +1657,9 @@ static int pgp_check_traditional_one_body (FILE * fp, BODY * b, while (fgets (buf, sizeof (buf), tfp)) { if (!safe_strncmp ("-----BEGIN PGP ", buf, 15)) { - if (!safe_strcmp ("MESSAGE-----\n", buf + 15)) + if (!mutt_strcmp ("MESSAGE-----\n", buf + 15)) enc = 1; - else if (!safe_strcmp ("SIGNED MESSAGE-----\n", buf + 15)) + else if (!mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15)) sgn = 1; } } @@ -1738,7 +1738,7 @@ static void copy_clearsigned (gpgme_data_t data, STATE * s, char *charset) continue; } - if (!safe_strcmp (buf, "-----BEGIN PGP SIGNATURE-----\n")) + if (!mutt_strcmp (buf, "-----BEGIN PGP SIGNATURE-----\n")) break; if (armor_header) { @@ -1795,21 +1795,21 @@ void pgp_gpgme_application_handler (BODY * m, STATE * s) break; offset = ftell (s->fpin); - bytes -= (offset - last_pos); /* don't rely on safe_strlen(buf) */ + bytes -= (offset - last_pos); /* don't rely on mutt_strlen(buf) */ last_pos = offset; if (!safe_strncmp ("-----BEGIN PGP ", buf, 15)) { clearsign = 0; start_pos = last_pos; - if (!safe_strcmp ("MESSAGE-----\n", buf + 15)) + if (!mutt_strcmp ("MESSAGE-----\n", buf + 15)) needpass = 1; - else if (!safe_strcmp ("SIGNED MESSAGE-----\n", buf + 15)) { + else if (!mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15)) { clearsign = 1; needpass = 0; } else if (!option (OPTDONTHANDLEPGPKEYS) && - !safe_strcmp ("PUBLIC KEY BLOCK-----\n", buf + 15)) { + !mutt_strcmp ("PUBLIC KEY BLOCK-----\n", buf + 15)) { needpass = 0; pgp_keyblock = 1; } @@ -1825,18 +1825,18 @@ 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, safe_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 safe_strlen(buf) */ + bytes -= (offset - last_pos); /* don't rely on mutt_strlen(buf) */ last_pos = offset; - gpgme_data_write (armored_data, buf, safe_strlen (buf)); + gpgme_data_write (armored_data, buf, mutt_strlen (buf)); - if ((needpass && !safe_strcmp ("-----END PGP MESSAGE-----\n", buf)) + if ((needpass && !mutt_strcmp ("-----END PGP MESSAGE-----\n", buf)) || (!needpass - && (!safe_strcmp ("-----END PGP SIGNATURE-----\n", buf) - || !safe_strcmp ("-----END PGP PUBLIC KEY BLOCK-----\n", + && (!mutt_strcmp ("-----END PGP SIGNATURE-----\n", buf) + || !mutt_strcmp ("-----END PGP PUBLIC KEY BLOCK-----\n", buf)))) break; } @@ -2480,10 +2480,10 @@ static int print_dn_part (FILE * fp, struct dn_array_s *dn, const char *key) int any = 0; for (; dn->key; dn++) { - if (!safe_strcmp (dn->key, key)) { + if (!mutt_strcmp (dn->key, key)) { if (any) fputs (" + ", fp); - print_utf8 (fp, dn->value, safe_strlen (dn->value)); + print_utf8 (fp, dn->value, mutt_strlen (dn->value)); any = 1; } } @@ -2506,7 +2506,7 @@ static void print_dn_parts (FILE * fp, struct dn_array_s *dn) /* now print the rest without any specific ordering */ for (; dn->key; dn++) { for (i = 0; stdpart[i]; i++) { - if (!safe_strcmp (dn->key, stdpart[i])) + if (!mutt_strcmp (dn->key, stdpart[i])) break; } if (!stdpart[i]) { @@ -2759,7 +2759,7 @@ static void print_key_info (gpgme_key_t key, FILE * fp) putc (' ', fp); } if (is_pgp) - print_utf8 (fp, s, safe_strlen (s)); + print_utf8 (fp, s, mutt_strlen (s)); else parse_and_print_user_id (fp, s); putc ('\n', fp); @@ -2821,7 +2821,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 && safe_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); @@ -2867,7 +2867,7 @@ static void print_key_info (gpgme_key_t key, FILE * fp) s = subkey->keyid; putc ('\n', fp); - if (safe_strlen (s) == 16) + if (mutt_strlen (s) == 16) s += 8; /* display only the short keyID */ fprintf (fp, "Subkey ....: 0x%s", s); if (subkey->revoked) { @@ -2980,7 +2980,7 @@ static void verify_key (crypt_key_t * key) k = key->kobj; gpgme_key_ref (k); - while ((s = k->chain_id) && k->subkeys && safe_strcmp (s, k->subkeys->fpr)) { + while ((s = k->chain_id) && k->subkeys && mutt_strcmp (s, k->subkeys->fpr)) { putc ('\n', fp); err = gpgme_op_keylist_start (listctx, s, 0); gpgme_key_release (k); @@ -3219,7 +3219,7 @@ static LIST *crypt_add_string_to_hints (LIST * hints, const char *str) for (t = strtok (scratch, " ,.:\"()<>\n"); t; t = strtok (NULL, " ,.:\"()<>\n")) { - if (safe_strlen (t) > 3) + if (mutt_strlen (t) > 3) hints = mutt_add_list (hints, t); } @@ -3765,12 +3765,12 @@ static char *find_keys (ADDRESS * to, ADDRESS * cc, ADDRESS * bcc, *r_application &= ~APPLICATION_SMIME; #endif - keylist_size += safe_strlen (s) + 4 + 1; + keylist_size += mutt_strlen (s) + 4 + 1; safe_realloc (&keylist, keylist_size); sprintf (keylist + keylist_used, "%s0x%s%s", /* __SPRINTF_CHECKED__ */ keylist_used ? " " : "", s, forced_valid ? "!" : ""); } - keylist_used = safe_strlen (keylist); + keylist_used = mutt_strlen (keylist); crypt_free_key (&key); rfc822_free_address (&addr); @@ -3920,9 +3920,9 @@ static int verify_sender (HEADER * h, gpgme_protocol_t protocol) int sender_length = 0; int uid_length = 0; - sender_length = safe_strlen (sender->mailbox); + sender_length = mutt_strlen (sender->mailbox); for (uid = key->uids; uid && ret; uid = uid->next) { - uid_length = safe_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/crypt.c b/crypt.c index fbe984a..128aaa9 100644 --- a/crypt.c +++ b/crypt.c @@ -386,7 +386,7 @@ int mutt_is_application_smime (BODY * m) /* no .p7c, .p10 support yet. */ - len = safe_strlen (t) - 4; + len = mutt_strlen (t) - 4; if (len > 0 && *(t + len) == '.') { len++; if (!ascii_strcasecmp ((t + len), "p7m")) diff --git a/curs_lib.c b/curs_lib.c index dc53a27..9f77340 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -144,7 +144,7 @@ int mutt_get_password (char *msg, char *buf, size_t buflen) CLEARLINE (LINES - 1); addstr (msg); set_option (OPTUNBUFFEREDINPUT); - rc = mutt_enter_string (buf, buflen, LINES - 1, safe_strlen (msg), M_PASS); + rc = mutt_enter_string (buf, buflen, LINES - 1, mutt_strlen (msg), M_PASS); unset_option (OPTUNBUFFEREDINPUT); CLEARLINE (LINES - 1); return (rc); @@ -218,7 +218,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 = safe_strlen (answer_string); + answer_string_len = mutt_strlen (answer_string); printw ("%.*s%s", COLS - answer_string_len, msg, answer_string); FREE (&answer_string); @@ -403,7 +403,7 @@ int mutt_do_pager (const char *banner, { int rc; - if (!Pager || safe_strcmp (Pager, "builtin") == 0) + if (!Pager || mutt_strcmp (Pager, "builtin") == 0) rc = mutt_pager (banner, tempfile, do_color, info); else { char cmd[STRING]; @@ -448,7 +448,7 @@ int _mutt_enter_fname (const char *prompt, char *buf, size_t blen, *redraw = REDRAW_FULL; } else { - char *pc = safe_malloc (safe_strlen (prompt) + 3); + char *pc = safe_malloc (mutt_strlen (prompt) + 3); sprintf (pc, "%s: ", prompt); /* __SPRINTF_CHECKED__ */ mutt_ungetch (ch.op ? 0 : ch.ch, ch.op ? ch.op : 0); @@ -528,7 +528,7 @@ int mutt_multi_choice (char *prompt, char *letters) } else if (ch.ch <= '9' && ch.ch > '0') { choice = ch.ch - '0'; - if (choice <= safe_strlen (letters)) + if (choice <= mutt_strlen (letters)) break; } } @@ -648,7 +648,7 @@ static void mutt_format_s_x (char *dest, } mutt_format_string (dest, destlen, min_width, max_width, - right_justify, ' ', s, safe_strlen (s), arboreal); + right_justify, ' ', s, mutt_strlen (s), arboreal); } void mutt_format_s (char *dest, @@ -673,7 +673,7 @@ void mutt_paddstr (int n, const char *s) wchar_t wc; int w; size_t k; - size_t len = safe_strlen (s); + size_t len = mutt_strlen (s); mbstate_t mbstate; memset (&mbstate, 0, sizeof (mbstate)); @@ -697,7 +697,7 @@ void mutt_paddstr (int n, const char *s) } /* - * mutt_strwidth is like safe_strlen except that it returns the width + * mutt_strwidth is like mutt_strlen except that it returns the width * refering to the number of characters cells. */ @@ -711,7 +711,7 @@ int mutt_strwidth (const char *s) if (!s) return 0; - n = safe_strlen (s); + n = mutt_strlen (s); memset (&mbstate, 0, sizeof (mbstate)); for (w = 0; n && (k = mbrtowc (&wc, s, n, &mbstate)); s += k, n -= k) { diff --git a/dotlock.c b/dotlock.c index 4dea196..eb761ad 100644 --- a/dotlock.c +++ b/dotlock.c @@ -126,7 +126,7 @@ static int dotlock_lock (const char *); #define check_flags(a) if (a & DL_FL_ACTIONS) usage (argv[0]) -size_t safe_strlen (const char* s) { +size_t mutt_strlen (const char* s) { return (s ? strlen (s) : 0); } @@ -453,7 +453,7 @@ static int dotlock_prepare (char *bn, size_t l, const char *f, int _fd) dirname = "."; } - if (safe_strlen (basename) + 1 > l) + if (mutt_strlen (basename) + 1 > l) return -1; strfcpy (bn, basename, l); diff --git a/edit.c b/edit.c index b9ffe18..d3818f6 100644 --- a/edit.c +++ b/edit.c @@ -63,7 +63,7 @@ static char **be_snarf_data (FILE * f, char **buf, int *bufmax, int *buflen, tmp[sizeof (tmp) - 1] = 0; if (prefix) { strfcpy (tmp, NONULL (Prefix), sizeof (tmp)); - tmplen = safe_strlen (tmp); + tmplen = mutt_strlen (tmp); p = tmp + tmplen; tmplen = sizeof (tmp) - tmplen; } @@ -72,7 +72,7 @@ static char **be_snarf_data (FILE * f, char **buf, int *bufmax, int *buflen, while (bytes > 0) { if (fgets (p, tmplen - 1, f) == NULL) break; - bytes -= safe_strlen (p); + bytes -= mutt_strlen (p); if (*bufmax == *buflen) safe_realloc (&buf, sizeof (char *) * (*bufmax += 25)); buf[(*buflen)++] = safe_strdup (tmp); @@ -316,7 +316,7 @@ int mutt_builtin_editor (const char *path, HEADER * msg, HEADER * cur) if (EscChar && tmp[0] == EscChar[0] && tmp[1] != EscChar[0]) { /* remove trailing whitespace from the line */ - p = tmp + safe_strlen (tmp) - 1; + p = tmp + mutt_strlen (tmp) - 1; while (p >= tmp && ISSPACE (*p)) *p-- = 0; @@ -345,9 +345,9 @@ int mutt_builtin_editor (const char *path, HEADER * msg, HEADER * cur) if (Context) { if (!*p && cur) { /* include the current message */ - p = tmp + safe_strlen (tmp) + 1; - snprintf (tmp + safe_strlen (tmp), - sizeof (tmp) - safe_strlen (tmp), " %d", + p = tmp + mutt_strlen (tmp) + 1; + snprintf (tmp + mutt_strlen (tmp), + sizeof (tmp) - mutt_strlen (tmp), " %d", cur->msgno + 1); } buf = be_include_messages (p, buf, &bufmax, &buflen, @@ -389,7 +389,7 @@ int mutt_builtin_editor (const char *path, HEADER * msg, HEADER * cur) if (buflen) { buflen--; strfcpy (tmp, buf[buflen], sizeof (tmp)); - tmp[safe_strlen (tmp) - 1] = 0; + tmp[mutt_strlen (tmp) - 1] = 0; FREE (&buf[buflen]); buf[buflen] = NULL; continue; @@ -433,7 +433,7 @@ int mutt_builtin_editor (const char *path, HEADER * msg, HEADER * cur) break; } } - else if (safe_strcmp (".", tmp) == 0) + else if (mutt_strcmp (".", tmp) == 0) done = 1; else { safe_strcat (tmp, sizeof (tmp), "\n"); diff --git a/enter.c b/enter.c index 3084644..65a61fc 100644 --- a/enter.c +++ b/enter.c @@ -490,7 +490,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 = safe_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 e3d2ad3..e89f409 100644 --- a/from.c +++ b/from.c @@ -43,7 +43,7 @@ static int is_day_name (const char *s) { int i; - if ((safe_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 (safe_strncasecmp (s, Weekdays[i], 3) == 0) diff --git a/gnupgparse.c b/gnupgparse.c index 30e73e2..c0ed056 100644 --- a/gnupgparse.c +++ b/gnupgparse.c @@ -96,7 +96,7 @@ static void fix_uid (char *uid) memcpy (uid, buf, ob - buf); uid[ob - buf] = '\0'; } - else if (ob - buf == n && (buf[n] = 0, safe_strlen (buf) < n)) + else if (ob - buf == n && (buf[n] = 0, mutt_strlen (buf) < n)) memcpy (uid, buf, n); } FREE (&buf); @@ -130,13 +130,13 @@ static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k) { debug_print (2, ("record type: %s\n", p)); - if (!safe_strcmp (p, "pub")); - else if (!safe_strcmp (p, "sub")) + if (!mutt_strcmp (p, "pub")); + else if (!mutt_strcmp (p, "sub")) *is_subkey = 1; - else if (!safe_strcmp (p, "sec")); - else if (!safe_strcmp (p, "ssb")) + else if (!mutt_strcmp (p, "sec")); + else if (!mutt_strcmp (p, "ssb")) *is_subkey = 1; - else if (!safe_strcmp (p, "uid")) + else if (!mutt_strcmp (p, "uid")) is_uid = 1; else return NULL; diff --git a/handler.c b/handler.c index 08d854c..a6a085c 100644 --- a/handler.c +++ b/handler.c @@ -242,7 +242,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 = safe_strlen (line); + linelen = mutt_strlen (line); len -= linelen; /* @@ -369,14 +369,14 @@ void mutt_decode_uuencoded (STATE * s, long len, int istext, iconv_t cd) while (len > 0) { if ((fgets (tmps, sizeof (tmps), s->fpin)) == NULL) return; - len -= safe_strlen (tmps); + len -= mutt_strlen (tmps); if ((!safe_strncmp (tmps, "begin", 5)) && ISSPACE (tmps[5])) break; } while (len > 0) { if ((fgets (tmps, sizeof (tmps), s->fpin)) == NULL) return; - len -= safe_strlen (tmps); + len -= mutt_strlen (tmps); if (!safe_strncmp (tmps, "end", 3)) break; pt = tmps; @@ -517,7 +517,7 @@ static void enriched_wrap (struct enriched_state *stte) stte->indent_len = 0; if (stte->s->prefix) { state_puts (stte->s->prefix, stte->s); - stte->indent_len += safe_strlen (stte->s->prefix); + stte->indent_len += mutt_strlen (stte->s->prefix); } if (stte->tag_level[RICH_EXCERPT]) { @@ -525,11 +525,11 @@ static void enriched_wrap (struct enriched_state *stte) while (x) { if (stte->s->prefix) { state_puts (stte->s->prefix, stte->s); - stte->indent_len += safe_strlen (stte->s->prefix); + stte->indent_len += mutt_strlen (stte->s->prefix); } else { state_puts ("> ", stte->s); - stte->indent_len += safe_strlen ("> "); + stte->indent_len += mutt_strlen ("> "); } x--; } @@ -631,7 +631,7 @@ static void enriched_puts (char *s, struct enriched_state *stte) { char *c; - if (stte->buff_len < stte->buff_used + safe_strlen (s)) { + if (stte->buff_len < stte->buff_used + mutt_strlen (s)) { stte->buff_len += LONG_STRING; safe_realloc (&stte->buffer, stte->buff_len + 1); } @@ -735,7 +735,7 @@ void text_enriched_handler (BODY * a, STATE * s) if (s->prefix) { state_puts (s->prefix, s); - stte.indent_len += safe_strlen (s->prefix); + stte.indent_len += mutt_strlen (s->prefix); } while (state != DONE) { @@ -865,7 +865,7 @@ static void flowed_stuff (STATE * s, char *cont, int level) * some text on the line which looks like it's quoted, turn off * ANSI colors, so quote coloring doesn't affect this line. */ - if (*cont && !level && !safe_strcmp (Pager, "builtin") + if (*cont && !level && !mutt_strcmp (Pager, "builtin") && flowed_maybe_quoted (cont)) state_puts ("\033[0m", s); } @@ -943,7 +943,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 -= safe_strlen (line); + bytes -= mutt_strlen (line); tail = NULL; last_full = full; @@ -973,7 +973,7 @@ static void text_plain_flowed_handler (BODY * a, STATE * s) */ full = 0; - l = safe_strlen (t + 1); + l = mutt_strlen (t + 1); t[0] = ' '; t[1] = '\0'; @@ -1032,7 +1032,7 @@ static void text_plain_flowed_handler (BODY * a, STATE * s) retry_wrap: l = flowed_visual_strlen (cont, quoted + i_add + add + col); - rl = safe_strlen (cont); + rl = mutt_strlen (cont); if (quoted + i_add + add + col + l > flowed_max) { actually_wrap = 1; @@ -1126,7 +1126,7 @@ static void print_flowed_line (char *line, STATE * s, int ql) { int width; char *pos, *oldpos; - int len = safe_strlen (line); + int len = mutt_strlen (line); int i; if (MaxLineLength > 0) { @@ -1150,7 +1150,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 (safe_strlen (line) == 0) { + if (mutt_strlen (line) == 0) { if (option (OPTQUOTEEMPTY)) { if (s->prefix) state_puts(s->prefix,s); @@ -1233,24 +1233,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 -= safe_strlen (buf); + bytes -= mutt_strlen (buf); newql = get_quote_level (buf); if ((t = strrchr (buf, '\n')) || (t = strrchr (buf, '\r'))) { *t = '\0'; - if (safe_strlen (curline) > 0 && curline[safe_strlen (curline) - 1] == ' ' + if (mutt_strlen (curline) > 0 && curline[mutt_strlen (curline) - 1] == ' ' && newql == quotelevel && strcmp (curline + quotelevel, "-- ") != 0) { if (buf[newql] == ' ') - curline[safe_strlen (curline) - 1] = '\0'; + curline[mutt_strlen (curline) - 1] = '\0'; - curline = realloc (curline, curline_len + safe_strlen (buf)); + curline = realloc (curline, curline_len + mutt_strlen (buf)); if (curline_len == 1) *curline = '\0'; - curline_len += safe_strlen (buf); + curline_len += mutt_strlen (buf); safe_strncat (curline, curline_len, buf + newql, - safe_strlen (buf + newql)); + mutt_strlen (buf + newql)); } else { if (first_line) { @@ -1261,11 +1261,11 @@ static void text_plain_flowed_handler (BODY * a, STATE * s) } FREE (&curline); curline_len = 1; - curline = realloc (curline, curline_len + safe_strlen (buf)); + curline = realloc (curline, curline_len + mutt_strlen (buf)); if (curline_len == 1) *curline = '\0'; - curline_len += safe_strlen (buf); - safe_strncat (curline, curline_len, buf, safe_strlen (buf)); + curline_len += mutt_strlen (buf); + safe_strncat (curline, curline_len, buf, mutt_strlen (buf)); quotelevel = newql; } } @@ -1329,7 +1329,7 @@ static void alternative_handler (BODY * a, STATE * s) } else { wild = 1; - btlen = safe_strlen (t->data); + btlen = mutt_strlen (t->data); } if (a && a->parts) diff --git a/hash.c b/hash.c index 63775bb..77fc7e8 100644 --- a/hash.c +++ b/hash.c @@ -97,7 +97,7 @@ int hash_insert (HASH * table, const char *key, void *data, int allow_dup) int r; for (tmp = table->table[h], last = NULL; tmp; last = tmp, tmp = tmp->next) { - r = safe_strcmp (tmp->key, key); + r = mutt_strcmp (tmp->key, key); if (r == 0) { FREE (&ptr); return (-1); @@ -120,7 +120,7 @@ void *hash_find_hash (const HASH * table, int hash, const char *key) struct hash_elem *ptr = table->table[hash]; for (; ptr; ptr = ptr->next) { - if (safe_strcmp (key, ptr->key) == 0) + if (mutt_strcmp (key, ptr->key) == 0) return (ptr->data); } return NULL; @@ -137,7 +137,7 @@ void hash_delete_hash (HASH * table, int hash, const char *key, * required for the case where we have multiple entries with the same * key */ - if ((data == ptr->data) || (!data && safe_strcmp (ptr->key, key) == 0)) { + if ((data == ptr->data) || (!data && mutt_strcmp (ptr->key, key) == 0)) { *last = ptr->next; if (destroy) destroy (ptr->data); diff --git a/hcache.c b/hcache.c index 9541f65..f6e0d8d 100644 --- a/hcache.c +++ b/hcache.c @@ -125,7 +125,7 @@ static unsigned char *dump_char (char *c, unsigned char *d, int *off) return d; } - size = safe_strlen (c) + 1; + size = mutt_strlen (c) + 1; d = dump_int (size, d, off); lazy_realloc (&d, *off + size); memcpy (d + *off, c, size); @@ -447,35 +447,35 @@ static int generate_crc32 () crc = crc32 (crc, (unsigned char const *) "sithglan@stud.uni-erlangen.de[sithglan]|hcache.c|20041108231548|29613", - safe_strlen + mutt_strlen ("sithglan@stud.uni-erlangen.de[sithglan]|hcache.c|20041108231548|29613")); #if HAVE_LANGINFO_CODESET - crc = crc32 (crc, (unsigned char const *) Charset, safe_strlen (Charset)); + crc = crc32 (crc, (unsigned char const *) Charset, mutt_strlen (Charset)); crc = crc32 (crc, (unsigned char const *) "HAVE_LANGINFO_CODESET", - safe_strlen ("HAVE_LANGINFO_CODESET")); + mutt_strlen ("HAVE_LANGINFO_CODESET")); #endif #ifdef USE_POP crc = - crc32 (crc, (unsigned char const *) "USE_POP", safe_strlen ("USE_POP")); + crc32 (crc, (unsigned char const *) "USE_POP", mutt_strlen ("USE_POP")); #endif #ifdef MIXMASTER crc = crc32 (crc, (unsigned char const *) "MIXMASTER", - safe_strlen ("MIXMASTER")); + mutt_strlen ("MIXMASTER")); #endif #ifdef USE_IMAP crc = - crc32 (crc, (unsigned char const *) "USE_IMAP", safe_strlen ("USE_IMAP")); + crc32 (crc, (unsigned char const *) "USE_IMAP", mutt_strlen ("USE_IMAP")); #endif #ifdef USE_NNTP crc = - crc32 (crc, (unsigned char const *) "USE_NNTP", safe_strlen ("USE_NNTP")); + crc32 (crc, (unsigned char const *) "USE_NNTP", mutt_strlen ("USE_NNTP")); #endif return crc; } @@ -514,7 +514,7 @@ static const char *mutt_hcache_per_folder (const char *path, } MD5Init (&md5); - MD5Update (&md5, (unsigned char *) folder, safe_strlen (folder)); + MD5Update (&md5, (unsigned char *) folder, mutt_strlen (folder)); MD5Final (md5sum, &md5); ret = snprintf (mutt_hcache_per_folder_path, _POSIX_PATH_MAX, @@ -785,7 +785,7 @@ void *mutt_hcache_fetch (void *db, const char *filename, } strncpy (path, h->folder, sizeof (path)); - strncat (path, filename, sizeof (path) - safe_strlen (path)); + strncat (path, filename, sizeof (path) - mutt_strlen (path)); key.dptr = path; key.dsize = keylen (path); @@ -815,7 +815,7 @@ mutt_hcache_store (void *db, const char *filename, HEADER * header, } strncpy (path, h->folder, sizeof (path)); - strncat (path, filename, sizeof (path) - safe_strlen (path)); + strncat (path, filename, sizeof (path) - mutt_strlen (path)); key.dptr = path; key.dsize = keylen (path); @@ -842,7 +842,7 @@ mutt_hcache_delete (void *db, const char *filename, } strncpy (path, h->folder, sizeof (path)); - strncat (path, filename, sizeof (path) - safe_strlen (path)); + strncat (path, filename, sizeof (path) - mutt_strlen (path)); key.dptr = path; key.dsize = keylen (path); diff --git a/hdrline.c b/hdrline.c index 7d023d9..f6ad7f7 100644 --- a/hdrline.c +++ b/hdrline.c @@ -587,7 +587,7 @@ static const char *hdr_format_str (char *dest, snprintf (dest, destlen, fmt, (Tochars && ((i = mutt_user_is_recipient (hdr))) < - safe_strlen (Tochars)) ? Tochars[i] : ' '); + mutt_strlen (Tochars)) ? Tochars[i] : ' '); break; case 'u': @@ -659,7 +659,7 @@ static const char *hdr_format_str (char *dest, ((i = mutt_user_is_recipient (hdr)) < - safe_strlen (Tochars)) ? + mutt_strlen (Tochars)) ? Tochars[i] : ' '))); mutt_format_s (dest, destlen, prefix, buf2); break; diff --git a/help.c b/help.c index d061743..0cc3b74 100644 --- a/help.c +++ b/help.c @@ -71,7 +71,7 @@ char *mutt_compile_help (char *buf, size_t buflen, int menu, buflen -= 2; } mutt_make_help (pbuf, buflen, _(items[i].name), menu, items[i].value); - len = safe_strlen (pbuf); + len = mutt_strlen (pbuf); pbuf += len; buflen -= len; } @@ -84,7 +84,7 @@ static int print_macro (FILE * f, int maxwidth, const char **macro) wchar_t wc; int w; size_t k; - size_t len = safe_strlen (*macro); + size_t len = mutt_strlen (*macro); mbstate_t mbstate1, mbstate2; memset (&mbstate1, 0, sizeof (mbstate1)); @@ -167,18 +167,18 @@ static void format_line (FILE * f, int ismacro, else { col_a = COLS > 83 ? (COLS - 32) >> 2 : 12; col_b = COLS > 49 ? (COLS - 10) >> 1 : 19; - col = pad (f, safe_strlen (t1), col_a); + col = pad (f, mutt_strlen (t1), col_a); } if (ismacro > 0) { - if (!safe_strcmp (Pager, "builtin")) + if (!mutt_strcmp (Pager, "builtin")) fputs ("_\010", f); fputs ("M ", f); col += 2; if (!split) { col += print_macro (f, col_b - col - 4, &t2); - if (safe_strlen (t2) > col_b - col) + if (mutt_strlen (t2) > col_b - col) t2 = "..."; } } @@ -201,7 +201,7 @@ static void format_line (FILE * f, int ismacro, SKIPWS (t3); /* FIXME: this is completely wrong */ - if ((n = safe_strlen (t3)) > COLS - col) { + if ((n = mutt_strlen (t3)) > COLS - col) { n = COLS - col; for (col_a = n; col_a > 0 && t3[col_a] != ' '; col_a--); if (col_a) @@ -212,7 +212,7 @@ static void format_line (FILE * f, int ismacro, print_macro (f, n, &t3); if (*t3) { - if (safe_strcmp (Pager, "builtin")) { + if (mutt_strcmp (Pager, "builtin")) { fputc ('\n', f); n = 0; } diff --git a/history.c b/history.c index bfbe60f..ba01d51 100644 --- a/history.c +++ b/history.c @@ -70,7 +70,7 @@ void mutt_history_add (history_class_t hclass, const char *s) prev = h->last - 1; if (prev < 0) prev = HistSize - 1; - if (!h->hist[prev] || safe_strcmp (h->hist[prev], s) != 0) { + if (!h->hist[prev] || mutt_strcmp (h->hist[prev], s) != 0) { str_replace (&h->hist[h->last++], s); if (h->last > HistSize - 1) h->last = 0; diff --git a/hook.c b/hook.c index d574bc6..b77be18 100644 --- a/hook.c +++ b/hook.c @@ -121,14 +121,14 @@ int mutt_parse_hook (BUFFER * buf, BUFFER * s, unsigned long data, /* check to make sure that a matching hook doesn't already exist */ for (ptr = Hooks; ptr; ptr = ptr->next) { if (ptr->type == data && - ptr->rx.not == not && !safe_strcmp (pattern.data, ptr->rx.pattern)) { + ptr->rx.not == not && !mutt_strcmp (pattern.data, ptr->rx.pattern)) { if (data & (M_FOLDERHOOK | M_SENDHOOK | M_SEND2HOOK | M_MESSAGEHOOK | M_ACCOUNTHOOK | M_REPLYHOOK)) { /* these hooks allow multiple commands with the same * pattern, so if we've already seen this pattern/command pair, just * ignore it instead of creating a duplicate */ - if (!safe_strcmp (ptr->command, command.data)) { + if (!mutt_strcmp (ptr->command, command.data)) { FREE (&command.data); FREE (&pattern.data); return 0; @@ -240,7 +240,7 @@ int mutt_parse_unhook (BUFFER * buf, BUFFER * s, unsigned long data, { while (MoreArgs (s)) { mutt_extract_token (buf, s, 0); - if (safe_strcmp ("*", buf->data) == 0) { + if (mutt_strcmp ("*", buf->data) == 0) { if (current_hook_type) { snprintf (err->data, err->dsize, _("unhook: Can't do unhook * from within a hook.")); diff --git a/imap/auth_cram.c b/imap/auth_cram.c index de56860..3f3d8ff 100644 --- a/imap/auth_cram.c +++ b/imap/auth_cram.c @@ -101,7 +101,7 @@ imap_auth_res_t imap_auth_cram_md5 (IMAP_DATA * idata, const char *method) */ mutt_to_base64 ((unsigned char *) ibuf, (unsigned char *) obuf, - safe_strlen (obuf), sizeof (ibuf) - 2); + mutt_strlen (obuf), sizeof (ibuf) - 2); safe_strcat (ibuf, sizeof (ibuf), "\r\n"); mutt_socket_write (idata->conn, ibuf); @@ -134,8 +134,8 @@ static void hmac_md5 (const char *password, char *challenge, unsigned int secret_len, chal_len; int i; - secret_len = safe_strlen (password); - chal_len = safe_strlen (challenge); + secret_len = mutt_strlen (password); + chal_len = mutt_strlen (challenge); /* passwords longer than MD5_BLOCK_LEN bytes are substituted with their MD5 * digests */ diff --git a/imap/auth_gss.c b/imap/auth_gss.c index bfe6c2f..ab99d0d 100644 --- a/imap/auth_gss.c +++ b/imap/auth_gss.c @@ -60,7 +60,7 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA * idata, const char *method) /* get an IMAP service ticket for the server */ snprintf (buf1, sizeof (buf1), "imap@%s", idata->conn->account.host); request_buf.value = buf1; - request_buf.length = safe_strlen (buf1) + 1; + request_buf.length = mutt_strlen (buf1) + 1; maj_stat = gss_import_name (&min_stat, &request_buf, gss_nt_service_name, &target_name); if (maj_stat != GSS_S_COMPLETE) { @@ -202,7 +202,7 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA * idata, const char *method) /* server decides if principal can log in as user */ strncpy (buf1 + 4, idata->conn->account.user, sizeof (buf1) - 4); request_buf.value = buf1; - request_buf.length = 4 + safe_strlen (idata->conn->account.user) + 1; + request_buf.length = 4 + mutt_strlen (idata->conn->account.user) + 1; maj_stat = gss_wrap (&min_stat, context, 0, GSS_C_QOP_DEFAULT, &request_buf, &cflags, &send_token); if (maj_stat != GSS_S_COMPLETE) { diff --git a/imap/auth_sasl.c b/imap/auth_sasl.c index 075e4b5..21af375 100644 --- a/imap/auth_sasl.c +++ b/imap/auth_sasl.c @@ -129,10 +129,10 @@ imap_auth_res_t imap_auth_sasl (IMAP_DATA * idata, const char *method) if (irc == IMAP_CMD_RESPOND) { #ifdef USE_SASL2 if (sasl_decode64 - (idata->cmd.buf + 2, safe_strlen (idata->cmd.buf + 2), buf, + (idata->cmd.buf + 2, mutt_strlen (idata->cmd.buf + 2), buf, LONG_STRING - 1, #else - if (sasl_decode64 (idata->cmd.buf + 2, safe_strlen (idata->cmd.buf + 2), buf, + if (sasl_decode64 (idata->cmd.buf + 2, mutt_strlen (idata->cmd.buf + 2), buf, #endif &len) != SASL_OK) { debug_print (1, ("error base64-decoding server response.\n")); diff --git a/imap/browse.c b/imap/browse.c index e5d009f..85e55e0 100644 --- a/imap/browse.c +++ b/imap/browse.c @@ -98,7 +98,7 @@ int imap_browse (char *path, struct browser_state *state) imap_unquote_string (buf); /* As kludgy as it gets */ mbox[sizeof (mbox) - 1] = '\0'; strncpy (mbox, buf, sizeof (mbox) - 1); - n = safe_strlen (mbox); + n = mutt_strlen (mbox); debug_print (3, ("mbox: %s\n", mbox)); @@ -116,7 +116,7 @@ int imap_browse (char *path, struct browser_state *state) imap_unmunge_mbox_name (cur_folder); if (!noinferiors && cur_folder[0] && - (n = safe_strlen (mbox)) < LONG_STRING - 1) { + (n = mutt_strlen (mbox)) < LONG_STRING - 1) { mbox[n++] = idata->delim; mbox[n] = '\0'; } @@ -253,7 +253,7 @@ int imap_mailbox_create (const char *folder) strfcpy (buf, NONULL (mx.mbox), sizeof (buf)); /* append a delimiter if necessary */ - n = safe_strlen (buf); + n = mutt_strlen (buf); if (n && (n < sizeof (buf) - 1) && (buf[n - 1] != idata->delim)) { buf[n++] = idata->delim; buf[n] = '\0'; @@ -262,7 +262,7 @@ int imap_mailbox_create (const char *folder) if (mutt_get_field (_("Create mailbox: "), buf, sizeof (buf), M_FILE) < 0) goto fail; - if (!safe_strlen (buf)) { + if (!mutt_strlen (buf)) { mutt_error (_("Mailbox must have a name.")); mutt_sleep (1); goto fail; @@ -305,7 +305,7 @@ int imap_mailbox_rename (const char *mailbox) if (mutt_get_field (buf, newname, sizeof (newname), M_FILE) < 0) goto fail; - if (!safe_strlen (newname)) { + if (!mutt_strlen (newname)) { mutt_error (_("Mailbox must have a name.")); mutt_sleep (1); goto fail; @@ -356,7 +356,7 @@ static int browse_add_list_result (IMAP_DATA * idata, const char *cmd, if (isparent) noselect = 1; /* prune current folder from output */ - if (isparent || safe_strncmp (name, mx.mbox, safe_strlen (name))) + if (isparent || safe_strncmp (name, mx.mbox, mutt_strlen (name))) imap_add_folder (idata->delim, name, noselect, noinferiors, state, isparent); } @@ -394,8 +394,8 @@ static void imap_add_folder (char delim, char *folder, int noselect, if (isparent) strfcpy (relpath, "../", sizeof (relpath)); /* strip current folder from target, to render a relative path */ - else if (!safe_strncmp (mx.mbox, folder, safe_strlen (mx.mbox))) - strfcpy (relpath, folder + safe_strlen (mx.mbox), sizeof (relpath)); + else if (!safe_strncmp (mx.mbox, folder, mutt_strlen (mx.mbox))) + strfcpy (relpath, folder + mutt_strlen (mx.mbox), sizeof (relpath)); else strfcpy (relpath, folder, sizeof (relpath)); @@ -411,9 +411,9 @@ static void imap_add_folder (char delim, char *folder, int noselect, (state->entry)[state->entrylen].name = safe_strdup (tmp); /* mark desc with delim in browser if it can have subfolders */ - if (!isparent && !noinferiors && safe_strlen (relpath) < sizeof (relpath) - 1) { - relpath[safe_strlen (relpath) + 1] = '\0'; - relpath[safe_strlen (relpath)] = delim; + if (!isparent && !noinferiors && mutt_strlen (relpath) < sizeof (relpath) - 1) { + relpath[mutt_strlen (relpath) + 1] = '\0'; + relpath[mutt_strlen (relpath)] = delim; } (state->entry)[state->entrylen].desc = safe_strdup (relpath); @@ -432,7 +432,7 @@ static void imap_add_folder (char delim, char *folder, int noselect, static int compare_names (struct folder_file *a, struct folder_file *b) { - return safe_strcmp (a->name, b->name); + return mutt_strcmp (a->name, b->name); } static int browse_get_namespace (IMAP_DATA * idata, char *nsbuf, int nsblen, diff --git a/imap/command.c b/imap/command.c index 0a52ca4..ec6b5a7 100644 --- a/imap/command.c +++ b/imap/command.c @@ -70,7 +70,7 @@ int imap_cmd_start (IMAP_DATA * idata, const char *cmd) cmd_make_sequence (idata); /* seq, space, cmd, \r\n\0 */ - outlen = safe_strlen (idata->cmd.seq) + safe_strlen (cmd) + 4; + outlen = mutt_strlen (idata->cmd.seq) + mutt_strlen (cmd) + 4; out = (char *) safe_malloc (outlen); snprintf (out, outlen, "%s %s\r\n", idata->cmd.seq, cmd); @@ -176,7 +176,7 @@ int imap_exec (IMAP_DATA * idata, const char *cmd, int flags) /* create sequence for command */ cmd_make_sequence (idata); /* seq, space, cmd, \r\n\0 */ - outlen = safe_strlen (idata->cmd.seq) + safe_strlen (cmd) + 4; + outlen = mutt_strlen (idata->cmd.seq) + mutt_strlen (cmd) + 4; out = (char *) safe_malloc (outlen); snprintf (out, outlen, "%s %s\r\n", idata->cmd.seq, cmd); diff --git a/imap/imap.c b/imap/imap.c index 90eae14..adebf53 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -1176,7 +1176,7 @@ int imap_mailbox_check (char *path, int new) * command on a mailbox that you have selected */ - if (safe_strcmp (mbox_unquoted, idata->mailbox) == 0 + if (mutt_strcmp (mbox_unquoted, idata->mailbox) == 0 || (ascii_strcasecmp (mbox_unquoted, "INBOX") == 0 && safe_strcasecmp (mbox_unquoted, idata->mailbox) == 0)) { strfcpy (buf, "NOOP", sizeof (buf)); @@ -1203,8 +1203,8 @@ int imap_mailbox_check (char *path, int new) /* The mailbox name may or may not be quoted here. We could try to * munge the server response and compare with quoted (or vise versa) * but it is probably more efficient to just strncmp against both. */ - if (safe_strncmp (mbox_unquoted, s, safe_strlen (mbox_unquoted)) == 0 - || safe_strncmp (mbox, s, safe_strlen (mbox)) == 0) { + if (safe_strncmp (mbox_unquoted, s, mutt_strlen (mbox_unquoted)) == 0 + || safe_strncmp (mbox, s, mutt_strlen (mbox)) == 0) { s = imap_next_word (s); s = imap_next_word (s); if (isdigit ((unsigned char) *s)) { @@ -1392,14 +1392,14 @@ int imap_complete (char *dest, size_t dlen, char *path) /* if the folder isn't selectable, append delimiter to force browse * to enter it on second tab. */ if (noselect) { - clen = safe_strlen (list_word); + clen = mutt_strlen (list_word); list_word[clen++] = delim; list_word[clen] = '\0'; } /* copy in first word */ if (!completions) { strfcpy (completion, list_word, sizeof (completion)); - matchlen = safe_strlen (completion); + matchlen = mutt_strlen (completion); completions++; continue; } diff --git a/imap/message.c b/imap/message.c index 264e65b..0f2e13a 100644 --- a/imap/message.c +++ b/imap/message.c @@ -898,7 +898,7 @@ static int msg_fetch_header (CONTEXT * ctx, IMAP_HEADER * h, char *buf, #if USE_HCACHE static size_t imap_hcache_keylen (const char *fn) { - return safe_strlen (fn); + return mutt_strlen (fn); } /* msg_fetch_header: import IMAP FETCH response into an IMAP_HEADER. @@ -954,7 +954,7 @@ static int msg_has_flag (LIST * flag_list, const char *flag) flag_list = flag_list->next; while (flag_list) { - if (!ascii_strncasecmp (flag_list->data, flag, safe_strlen (flag_list->data))) + if (!ascii_strncasecmp (flag_list->data, flag, mutt_strlen (flag_list->data))) return 1; flag_list = flag_list->next; diff --git a/imap/utf7.c b/imap/utf7.c index 3fa10c7..bc5571a 100644 --- a/imap/utf7.c +++ b/imap/utf7.c @@ -235,7 +235,7 @@ void imap_utf7_encode (char **s) char *t = safe_strdup (*s); if (!mutt_convert_string (&t, Charset, "UTF-8", 0)) - utf8_to_utf7 (t, safe_strlen (t), s, 0); + utf8_to_utf7 (t, mutt_strlen (t), s, 0); FREE (&t); } } @@ -243,7 +243,7 @@ void imap_utf7_encode (char **s) void imap_utf7_decode (char **s) { if (Charset) { - char *t = utf7_to_utf8 (*s, safe_strlen (*s), 0, 0); + char *t = utf7_to_utf8 (*s, mutt_strlen (*s), 0, 0); if (t && !mutt_convert_string (&t, "UTF-8", Charset, 0)) { FREE (s); diff --git a/imap/util.c b/imap/util.c index 2893f4f..9c69ebf 100644 --- a/imap/util.c +++ b/imap/util.c @@ -135,10 +135,10 @@ void imap_pretty_mailbox (char *path) if (imap_parse_path (path, &target) < 0) return; - tlen = safe_strlen (target.mbox); + tlen = mutt_strlen (target.mbox); /* check whether we can do '=' substitution */ if (mx_get_magic (Maildir) == M_IMAP && !imap_parse_path (Maildir, &home)) { - hlen = safe_strlen (home.mbox); + hlen = mutt_strlen (home.mbox); if (tlen && mutt_account_match (&home.account, &target.account) && !safe_strncmp (home.mbox, target.mbox, hlen)) { if (!hlen) @@ -446,7 +446,7 @@ void imap_unmunge_mbox_name (char *s) buf = safe_strdup (s); if (buf) { imap_utf7_decode (&buf); - strncpy (s, buf, safe_strlen (s)); + strncpy (s, buf, mutt_strlen (s)); } FREE (&buf); diff --git a/init.c b/init.c index eab1c57..6e0d902 100644 --- a/init.c +++ b/init.c @@ -123,7 +123,7 @@ int mutt_option_index (char *s) int i; for (i = 0; MuttVars[i].option; i++) - if (safe_strcmp (s, MuttVars[i].option) == 0) { + if (mutt_strcmp (s, MuttVars[i].option) == 0) { if (MuttVars[i].type == DT_SYN) syn_add (mutt_option_index ((char *) MuttVars[i].data), i); return (MuttVars[i].type == @@ -259,8 +259,8 @@ int mutt_extract_token (BUFFER * dest, BUFFER * tok, int flags) FREE (&expn.data); } else if (expn.data) { - expnlen = safe_strlen (expn.data); - tok->dsize = expnlen + safe_strlen (tok->dptr) + 1; + expnlen = mutt_strlen (expn.data); + tok->dsize = expnlen + mutt_strlen (tok->dptr) + 1; ptr = safe_malloc (tok->dsize); memcpy (ptr, expn.data, expnlen); strcpy (ptr + expnlen, tok->dptr); /* __STRCPY_CHECKED__ */ @@ -428,7 +428,7 @@ static int remove_from_spam_list (SPAM_LIST ** list, const char *pat) /* Being first is a special case. */ spam = *list; - if (spam->rx && !safe_strcmp (spam->rx->pattern, pat)) { + if (spam->rx && !mutt_strcmp (spam->rx->pattern, pat)) { *list = spam->next; rx_free (&spam->rx); FREE(&spam->template); @@ -438,7 +438,7 @@ static int remove_from_spam_list (SPAM_LIST ** list, const char *pat) prev = spam; for (spam = prev->next; spam;) { - if (!safe_strcmp (spam->rx->pattern, pat)) { + if (!mutt_strcmp (spam->rx->pattern, pat)) { prev->next = spam->next; rx_free (&spam->rx); FREE(spam->template); @@ -458,7 +458,7 @@ static void remove_from_list (LIST ** l, const char *str) { LIST *p, *last = NULL; - if (safe_strcmp ("*", str) == 0) + if (mutt_strcmp ("*", str) == 0) mutt_free_list (l); /* ``unCMD *'' means delete all current entries */ else { p = *l; @@ -484,7 +484,7 @@ static int remove_from_rx_list (list2_t** l, const char *str) { int i = 0; - if (safe_strcmp ("*", str) == 0) { + if (mutt_strcmp ("*", str) == 0) { list_del (l, rx_free); return (0); } @@ -517,8 +517,8 @@ static int parse_ifdef (BUFFER * tmp, BUFFER * s, unsigned long data, continue; for (j = 0; b[j].name; j++) - if (!ascii_strncasecmp (tmp->data, b[j].name, safe_strlen (tmp->data)) - && (safe_strlen (b[j].name) == safe_strlen (tmp->data))) { + if (!ascii_strncasecmp (tmp->data, b[j].name, mutt_strlen (tmp->data)) + && (mutt_strlen (b[j].name) == mutt_strlen (tmp->data))) { res = 1; break; } @@ -528,13 +528,13 @@ static int parse_ifdef (BUFFER * tmp, BUFFER * s, unsigned long data, char *p = NULL; i = 0; - j = safe_strlen (tmp->data); + j = mutt_strlen (tmp->data); /* need at least input of 'feature_X' */ if (j >= 7) { p = tmp->data + 7; j -= 7; while (Features[i].name) { - if (safe_strlen (Features[i].name) == j && + if (mutt_strlen (Features[i].name) == j && ascii_strncasecmp (Features[i].name, p, j)) { res = 1; break; @@ -640,7 +640,7 @@ static int parse_unalternates (BUFFER * buf, BUFFER * s, unsigned long data, mutt_extract_token (buf, s, 0); remove_from_rx_list (&Alternates, buf->data); - if (safe_strcmp (buf->data, "*") && + if (mutt_strcmp (buf->data, "*") && add_to_rx_list (&UnAlternates, buf->data, REG_ICASE, err) != 0) return -1; @@ -696,7 +696,7 @@ static int parse_spam_list (BUFFER * buf, BUFFER * s, unsigned long data, /* nospam only ever has one parameter. */ /* "*" is a special case. */ - if (!safe_strcmp (buf->data, "*")) { + if (!mutt_strcmp (buf->data, "*")) { mutt_free_spam_list (&SpamList); list_del (&NoSpamList, rx_free); return 0; @@ -726,7 +726,7 @@ static int parse_unlist (BUFFER * buf, BUFFER * s, unsigned long data, /* * Check for deletion of entire list */ - if (safe_strcmp (buf->data, "*") == 0) { + if (mutt_strcmp (buf->data, "*") == 0) { mutt_free_list ((LIST **) data); break; } @@ -760,7 +760,7 @@ static int parse_unlists (BUFFER * buf, BUFFER * s, unsigned long data, remove_from_rx_list (&SubscribedLists, buf->data); remove_from_rx_list (&MailLists, buf->data); - if (safe_strcmp (buf->data, "*") && + if (mutt_strcmp (buf->data, "*") && add_to_rx_list (&UnMailLists, buf->data, REG_ICASE, err) != 0) return -1; } @@ -794,7 +794,7 @@ static int parse_unsubscribe (BUFFER * buf, BUFFER * s, unsigned long data, mutt_extract_token (buf, s, 0); remove_from_rx_list (&SubscribedLists, buf->data); - if (safe_strcmp (buf->data, "*") && + if (mutt_strcmp (buf->data, "*") && add_to_rx_list (&UnSubscribedLists, buf->data, REG_ICASE, err) != 0) return -1; } @@ -811,7 +811,7 @@ static int parse_unalias (BUFFER * buf, BUFFER * s, unsigned long data, do { mutt_extract_token (buf, s, 0); - if (safe_strcmp ("*", buf->data) == 0) { + if (mutt_strcmp ("*", buf->data) == 0) { if (CurrentMenu == MENU_ALIAS) { for (tmp = Aliases; tmp; tmp = tmp->next) tmp->del = 1; @@ -922,13 +922,13 @@ parse_unmy_hdr (BUFFER * buf, BUFFER * s, unsigned long data, BUFFER * err) do { mutt_extract_token (buf, s, 0); - if (safe_strcmp ("*", buf->data) == 0) + if (mutt_strcmp ("*", buf->data) == 0) mutt_free_list (&UserHeader); else { tmp = UserHeader; last = NULL; - l = safe_strlen (buf->data); + l = mutt_strlen (buf->data); if (buf->data[l - 1] == ':') l--; @@ -1106,9 +1106,9 @@ static void mutt_restore_default (struct option_t *p) char *s = (char *) p->init; pp->rx = safe_calloc (1, sizeof (regex_t)); - if (safe_strcmp (p->option, "mask") != 0) + if (mutt_strcmp (p->option, "mask") != 0) flags |= mutt_which_case ((const char *) p->init); - if (safe_strcmp (p->option, "mask") == 0 && *s == '!') { + if (mutt_strcmp (p->option, "mask") == 0 && *s == '!') { s++; pp->not = 1; } @@ -1175,7 +1175,7 @@ static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data, mutt_extract_token (tmp, s, M_TOKEN_EQUAL); if ((idx = mutt_option_index (tmp->data)) == -1 && - !(reset && !safe_strcmp ("all", tmp->data))) { + !(reset && !mutt_strcmp ("all", tmp->data))) { snprintf (err->data, err->dsize, _("%s: unknown variable"), tmp->data); return (-1); } @@ -1192,7 +1192,7 @@ static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data, return (-1); } - if (!safe_strcmp ("all", tmp->data)) { + if (!mutt_strcmp ("all", tmp->data)) { for (idx = 0; MuttVars[idx].option; idx++) mutt_restore_default (&MuttVars[idx]); return 0; @@ -1276,7 +1276,7 @@ static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data, } else if (DTYPE (MuttVars[idx].type) == DT_STR) { *((char **) MuttVars[idx].data) = safe_strdup (tmp->data); - if (safe_strcmp (MuttVars[idx].option, "charset") == 0) + if (mutt_strcmp (MuttVars[idx].option, "charset") == 0) mutt_set_charset (Charset); } else { @@ -1298,7 +1298,7 @@ static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data, } if (option (OPTATTACHMSG) - && !safe_strcmp (MuttVars[idx].option, "reply_regexp")) { + && !mutt_strcmp (MuttVars[idx].option, "reply_regexp")) { snprintf (err->data, err->dsize, "Operation not permitted when in attach-message mode."); r = -1; @@ -1310,15 +1310,15 @@ static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data, /* copy the value of the string */ mutt_extract_token (tmp, s, 0); - if (!ptr->pattern || safe_strcmp (ptr->pattern, tmp->data) != 0) { + if (!ptr->pattern || mutt_strcmp (ptr->pattern, tmp->data) != 0) { int not = 0; /* $mask is case-sensitive */ - if (safe_strcmp (MuttVars[idx].option, "mask") != 0) + if (mutt_strcmp (MuttVars[idx].option, "mask") != 0) flags |= mutt_which_case (tmp->data); p = tmp->data; - if (safe_strcmp (MuttVars[idx].option, "mask") == 0) { + if (mutt_strcmp (MuttVars[idx].option, "mask") == 0) { if (*p == '!') { not = 1; p++; @@ -1347,7 +1347,7 @@ static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data, /* $reply_regexp and $alterantes require special treatment */ if (Context && Context->msgcount && - safe_strcmp (MuttVars[idx].option, "reply_regexp") == 0) { + mutt_strcmp (MuttVars[idx].option, "reply_regexp") == 0) { regmatch_t pmatch[1]; int i; @@ -1423,12 +1423,12 @@ static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data, *ptr = (short) val; /* these ones need a sanity check */ - if (safe_strcmp (MuttVars[idx].option, "history") == 0) { + if (mutt_strcmp (MuttVars[idx].option, "history") == 0) { if (*ptr < 0) *ptr = 0; mutt_init_history (); } - else if (safe_strcmp (MuttVars[idx].option, "pager_index_lines") == 0) { + else if (mutt_strcmp (MuttVars[idx].option, "pager_index_lines") == 0) { if (*ptr < 0) *ptr = 0; } @@ -1649,7 +1649,7 @@ int mutt_parse_rc_line ( /* const */ char *line, BUFFER * token, BUFFER * err) memset (&expn, 0, sizeof (expn)); expn.data = expn.dptr = line; - expn.dsize = safe_strlen (line); + expn.dsize = mutt_strlen (line); *err->data = 0; @@ -1663,7 +1663,7 @@ int mutt_parse_rc_line ( /* const */ char *line, BUFFER * token, BUFFER * err) } mutt_extract_token (token, &expn, 0); for (i = 0; Commands[i].name; i++) { - if (!safe_strcmp (token->data, Commands[i].name)) { + if (!mutt_strcmp (token->data, Commands[i].name)) { if (Commands[i].func (token, &expn, Commands[i].data, err) != 0) goto finish; break; @@ -1771,8 +1771,8 @@ int mutt_command_complete (char *buffer, size_t len, int pos, int numtabs) /* loop through all the possible prefixes (no, inv, ...) */ if (!safe_strncmp (buffer, "set", 3)) { for (num = 0; prefixes[num]; num++) { - if (!safe_strncmp (pt, prefixes[num], safe_strlen (prefixes[num]))) { - pt += safe_strlen (prefixes[num]); + if (!safe_strncmp (pt, prefixes[num], mutt_strlen (prefixes[num]))) { + pt += mutt_strlen (prefixes[num]); break; } } @@ -1882,7 +1882,7 @@ int mutt_var_value_complete (char *buffer, size_t len, int pos) strfcpy (var, pt, sizeof (var)); /* ignore the trailing '=' when comparing */ - var[safe_strlen (var) - 1] = 0; + var[mutt_strlen (var) - 1] = 0; if ((idx = mutt_option_index (var)) == -1) return 0; /* no such variable. */ else { @@ -2100,7 +2100,7 @@ void mutt_init (int skip_sys_rc, LIST * commands) else #endif /* DOMAIN */ if (*DOMAIN != '@') { - Fqdn = safe_malloc (safe_strlen (DOMAIN) + safe_strlen (Hostname) + 2); + Fqdn = safe_malloc (mutt_strlen (DOMAIN) + mutt_strlen (Hostname) + 2); sprintf (Fqdn, "%s.%s", NONULL (Hostname), DOMAIN); /* __SPRINTF_CHECKED__ */ } else @@ -2169,7 +2169,7 @@ void mutt_init (int skip_sys_rc, LIST * commands) memset (&buf, 0, sizeof (buf)); buf.data = buf.dptr = buffer; - buf.dsize = safe_strlen (buffer); + buf.dsize = mutt_strlen (buffer); memset (&token, 0, sizeof (token)); parse_my_hdr (&token, &buf, 0, &err); diff --git a/keymap.c b/keymap.c index 3944aab..6f71eda 100644 --- a/keymap.c +++ b/keymap.c @@ -247,7 +247,7 @@ static int get_op (struct binding_t *bindings, const char *start, size_t len) for (i = 0; bindings[i].name; i++) { if (!ascii_strncasecmp (start, bindings[i].name, len) && - safe_strlen (bindings[i].name) == len) + mutt_strlen (bindings[i].name) == len) return bindings[i].op; } @@ -269,7 +269,7 @@ static char *get_func (struct binding_t *bindings, int op) static void push_string (char *s) { - char *pp, *p = s + safe_strlen (s) - 1; + char *pp, *p = s + mutt_strlen (s) - 1; size_t l; int i, op = OP_NULL; @@ -488,7 +488,7 @@ int km_expand_key (char *s, size_t len, struct keymap_t *map) FOREVER { strfcpy (s, km_keyname (map->keys[p]), len); - len -= (l = safe_strlen (s)); + len -= (l = mutt_strlen (s)); if (++p >= map->len || !len) return (1); @@ -717,7 +717,7 @@ try_bind (char *key, int menu, char *func, struct binding_t *bindings) int i; for (i = 0; bindings[i].name; i++) - if (safe_strcmp (func, bindings[i].name) == 0) { + if (mutt_strcmp (func, bindings[i].name) == 0) { km_bindkey (key, menu, bindings[i].op); return (0); } @@ -880,9 +880,9 @@ int mutt_parse_exec (BUFFER * buf, BUFFER * s, unsigned long data, && CurrentMenu != MENU_PAGER) bindings = OpGeneric; - ops[nops] = get_op (bindings, function, safe_strlen (function)); + ops[nops] = get_op (bindings, function, mutt_strlen (function)); if (ops[nops] == OP_NULL && CurrentMenu != MENU_PAGER) - ops[nops] = get_op (OpGeneric, function, safe_strlen (function)); + ops[nops] = get_op (OpGeneric, function, mutt_strlen (function)); if (ops[nops] == OP_NULL) { mutt_flushinp (); diff --git a/lib.c b/lib.c index e730022..a81ecda 100644 --- a/lib.c +++ b/lib.c @@ -155,7 +155,7 @@ int safe_symlink (const char *oldpath, const char *newpath) char abs_oldpath[_POSIX_PATH_MAX]; if ((getcwd (abs_oldpath, sizeof abs_oldpath) == NULL) || - (safe_strlen (abs_oldpath) + 1 + safe_strlen (oldpath) + 1 > + (mutt_strlen (abs_oldpath) + 1 + mutt_strlen (oldpath) + 1 > sizeof abs_oldpath)) return -1; @@ -416,7 +416,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[safe_strlen (dir) - 1] == '/')) + if (!*fname || (*dir && dir[mutt_strlen (dir) - 1] == '/')) fmt = "%s%s"; snprintf (d, l, fmt, dir, fname); diff --git a/lib/rx.c b/lib/rx.c index 0158f16..168a3fe 100644 --- a/lib/rx.c +++ b/lib/rx.c @@ -32,7 +32,7 @@ void rx_free (rx_t** p) { } int rx_compare (const rx_t* r1, const rx_t* r2) { - return (safe_strcmp (r1->pattern, r2->pattern)); + return (mutt_strcmp (r1->pattern, r2->pattern)); } int rx_list_match (list2_t* l, const char* pat) { @@ -50,7 +50,7 @@ int rx_lookup (list2_t* l, const char* pat) { if (!pat || !*pat || list_empty(l)) return (-1); for (i = 0; i < l->length; i++) - if (safe_strcmp (((rx_t*) l->data[i])->pattern, pat) == 0) + if (mutt_strcmp (((rx_t*) l->data[i])->pattern, pat) == 0) return (i); return (-1); } diff --git a/lib/str.c b/lib/str.c index a9a9beb..0db2b6e 100644 --- a/lib/str.c +++ b/lib/str.c @@ -23,7 +23,7 @@ char *safe_strdup (const char *s) if (!s || !*s) return 0; - l = safe_strlen (s) + 1; + l = mutt_strlen (s) + 1; p = (char *) safe_malloc (l); memcpy (p, s, l); return (p); @@ -67,7 +67,7 @@ char *safe_strncat (char *d, size_t l, const char *s, size_t sl) return p; } -int safe_strcmp (const char *a, const char *b) +int mutt_strcmp (const char *a, const char *b) { return strcmp (NONULL (a), NONULL (b)); } @@ -87,7 +87,7 @@ int safe_strncasecmp (const char *a, const char *b, size_t l) return strncasecmp (NONULL (a), NONULL (b), l); } -size_t safe_strlen (const char *a) +size_t mutt_strlen (const char *a) { return a ? strlen (a) : 0; } @@ -107,7 +107,7 @@ void str_adjust (char **p) { if (!p || !*p) return; - safe_realloc (p, safe_strlen (*p) + 1); + safe_realloc (p, mutt_strlen (*p) + 1); } /* convert all characters in the string to lowercase */ @@ -146,7 +146,7 @@ char *str_substrdup (const char *begin, const char *end) if (end) len = end - begin; else - len = safe_strlen (begin); + len = mutt_strlen (begin); p = safe_malloc (len + 1); memcpy (p, begin, len); @@ -176,9 +176,9 @@ const char *str_isstr (const char *haystack, const char *needle) } int str_eq (const char* s1, const char* s2) { - int l = safe_strlen (s1); + int l = mutt_strlen (s1); - if (l != safe_strlen (s2)) + if (l != mutt_strlen (s2)) return (0); return (safe_strncmp (s1, s2, l) == 0); } @@ -191,6 +191,6 @@ char* str_skip_initws (char* s) { void str_skip_trailws (char *s) { char *p; - for (p = s + safe_strlen (s) - 1; p >= s && ISSPACE (*p); p--) + for (p = s + mutt_strlen (s) - 1; p >= s && ISSPACE (*p); p--) *p = 0; } diff --git a/lib/str.h b/lib/str.h index 6c05b15..2adf38d 100644 --- a/lib/str.h +++ b/lib/str.h @@ -45,12 +45,12 @@ char *safe_strdup (const char*); char *safe_strcat (char*, size_t, const char*); char *safe_strncat (char*, size_t, const char*, size_t); -int safe_strcmp (const char*, const char*); +int mutt_strcmp (const char*, const char*); int safe_strcasecmp (const char*, const char*); int safe_strncmp (const char*, const char*, size_t); int safe_strncasecmp (const char*, const char*, size_t); int safe_strcoll (const char*, const char*); -size_t safe_strlen (const char*); +size_t mutt_strlen (const char*); /* * tools diff --git a/main.c b/main.c index 78f6621..659d764 100644 --- a/main.c +++ b/main.c @@ -792,7 +792,7 @@ int main (int argc, char **argv) if (infile || bodytext) { if (infile) { - if (safe_strcmp ("-", infile) == 0) + if (mutt_strcmp ("-", infile) == 0) fin = stdin; else { char path[_POSIX_PATH_MAX]; diff --git a/mbox.c b/mbox.c index 5c00fea..3cdd76e 100644 --- a/mbox.c +++ b/mbox.c @@ -126,7 +126,7 @@ static int mmdf_parse_mailbox (CONTEXT * ctx) if (fgets (buf, sizeof (buf) - 1, ctx->fp) == NULL) break; - if (safe_strcmp (buf, MMDF_SEP) == 0) { + if (mutt_strcmp (buf, MMDF_SEP) == 0) { loc = ftell (ctx->fp); count++; @@ -170,7 +170,7 @@ static int mmdf_parse_mailbox (CONTEXT * ctx) if (0 < tmploc && tmploc < ctx->size) { if (fseek (ctx->fp, tmploc, SEEK_SET) != 0 || fgets (buf, sizeof (buf) - 1, ctx->fp) == NULL || - safe_strcmp (MMDF_SEP, buf) != 0) { + mutt_strcmp (MMDF_SEP, buf) != 0) { if (fseek (ctx->fp, loc, SEEK_SET) != 0) debug_print (1, ("fseek() failed\n")); hdr->content->length = -1; @@ -189,7 +189,7 @@ static int mmdf_parse_mailbox (CONTEXT * ctx) if (fgets (buf, sizeof (buf) - 1, ctx->fp) == NULL) break; lines++; - } while (safe_strcmp (buf, MMDF_SEP) != 0); + } while (mutt_strcmp (buf, MMDF_SEP) != 0); hdr->lines = lines; hdr->content->length = loc - hdr->content->offset; @@ -421,8 +421,8 @@ static int mbox_open_mailbox (CONTEXT * ctx) static int strict_addrcmp (const ADDRESS * a, const ADDRESS * b) { while (a && b) { - if (safe_strcmp (a->mailbox, b->mailbox) || - safe_strcmp (a->personal, b->personal)) + if (mutt_strcmp (a->mailbox, b->mailbox) || + mutt_strcmp (a->personal, b->personal)) return (0); a = a->next; @@ -437,7 +437,7 @@ static int strict_addrcmp (const ADDRESS * a, const ADDRESS * b) static int strict_cmp_lists (const LIST * a, const LIST * b) { while (a && b) { - if (safe_strcmp (a->data, b->data)) + if (mutt_strcmp (a->data, b->data)) return (0); a = a->next; @@ -452,8 +452,8 @@ static int strict_cmp_lists (const LIST * a, const LIST * b) static int strict_cmp_envelopes (const ENVELOPE * e1, const ENVELOPE * e2) { if (e1 && e2) { - if (safe_strcmp (e1->message_id, e2->message_id) || - safe_strcmp (e1->subject, e2->subject) || + if (mutt_strcmp (e1->message_id, e2->message_id) || + mutt_strcmp (e1->subject, e2->subject) || !strict_cmp_lists (e1->references, e2->references) || !strict_addrcmp (e1->from, e2->from) || !strict_addrcmp (e1->sender, e2->sender) || @@ -476,8 +476,8 @@ static int strict_cmp_envelopes (const ENVELOPE * e1, const ENVELOPE * e2) static int strict_cmp_parameters (const PARAMETER * p1, const PARAMETER * p2) { while (p1 && p2) { - if (safe_strcmp (p1->attribute, p2->attribute) || - safe_strcmp (p1->value, p2->value)) + if (mutt_strcmp (p1->attribute, p2->attribute) || + mutt_strcmp (p1->value, p2->value)) return (0); p1 = p1->next; @@ -493,8 +493,8 @@ static int strict_cmp_bodies (const BODY * b1, const BODY * b2) { if (b1->type != b2->type || b1->encoding != b2->encoding || - safe_strcmp (b1->subtype, b2->subtype) || - safe_strcmp (b1->description, b2->description) || + mutt_strcmp (b1->subtype, b2->subtype) || + mutt_strcmp (b1->description, b2->description) || !strict_cmp_parameters (b1->parameter, b2->parameter) || b1->length != b2->length) return (0); @@ -578,7 +578,7 @@ static int _mbox_check_mailbox (CONTEXT * ctx, int *index_hint) debug_print (1, ("fseek() failed\n")); if (fgets (buffer, sizeof (buffer), ctx->fp) != NULL) { if ((ctx->magic == M_MBOX && safe_strncmp ("From ", buffer, 5) == 0) - || (ctx->magic == M_MMDF && safe_strcmp (MMDF_SEP, buffer) == 0)) { + || (ctx->magic == M_MMDF && mutt_strcmp (MMDF_SEP, buffer) == 0)) { if (fseek (ctx->fp, ctx->size, SEEK_SET) != 0) debug_print (1, ("fseek() failed\n")); if (ctx->magic == M_MBOX) @@ -860,7 +860,7 @@ static int _mbox_sync_mailbox (CONTEXT * ctx, int unused, int *index_hint) /* do a sanity check to make sure the mailbox looks ok */ fgets (buf, sizeof (buf), ctx->fp) == NULL || (ctx->magic == M_MBOX && safe_strncmp ("From ", buf, 5) != 0) || - (ctx->magic == M_MMDF && safe_strcmp (MMDF_SEP, buf) != 0)) { + (ctx->magic == M_MMDF && mutt_strcmp (MMDF_SEP, buf) != 0)) { debug_print (1, ("message not in expected position.\n")); debug_print (1, ("LINE: %s\n", buf)); i = -1; @@ -1208,7 +1208,7 @@ int mbox_is_magic (const char* path, struct stat* st) { fgets (tmp, sizeof (tmp), f); if (safe_strncmp ("From ", tmp, 5) == 0) magic = M_MBOX; - else if (safe_strcmp (MMDF_SEP, tmp) == 0) + else if (mutt_strcmp (MMDF_SEP, tmp) == 0) magic = M_MMDF; safe_fclose (&f); #ifndef BUFFY_SIZE diff --git a/menu.c b/menu.c index 97f1bed..ab3ce23 100644 --- a/menu.c +++ b/menu.c @@ -38,7 +38,7 @@ static void print_enriched_string (int attr, unsigned char *s, int do_color) { wchar_t wc; size_t k; - size_t n = safe_strlen ((char *) s); + size_t n = mutt_strlen ((char *) s); mbstate_t mbstate; memset (&mbstate, 0, sizeof (mbstate)); @@ -157,7 +157,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, safe_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 1bcf9c1..2770b8e 100644 --- a/mh.c +++ b/mh.c @@ -157,11 +157,11 @@ static void mh_read_sequences (struct mh_sequences *mhs, const char *path) if (!(t = strtok (buff, " \t:"))) continue; - if (!safe_strcmp (t, MhUnseen)) + if (!mutt_strcmp (t, MhUnseen)) f = MH_SEQ_UNSEEN; - else if (!safe_strcmp (t, MhFlagged)) + else if (!mutt_strcmp (t, MhFlagged)) f = MH_SEQ_FLAGGED; - else if (!safe_strcmp (t, MhReplied)) + else if (!mutt_strcmp (t, MhReplied)) f = MH_SEQ_REPLIED; else /* unknown sequence */ continue; @@ -304,11 +304,11 @@ void mh_update_sequences (CONTEXT * ctx) /* first, copy unknown sequences */ if ((ofp = fopen (sequences, "r"))) { while ((buff = mutt_read_line (buff, &s, ofp, &l))) { - if (!safe_strncmp (buff, seq_unseen, safe_strlen (seq_unseen))) + if (!safe_strncmp (buff, seq_unseen, mutt_strlen (seq_unseen))) continue; - if (!safe_strncmp (buff, seq_flagged, safe_strlen (seq_flagged))) + if (!safe_strncmp (buff, seq_flagged, mutt_strlen (seq_flagged))) continue; - if (!safe_strncmp (buff, seq_replied, safe_strlen (seq_replied))) + if (!safe_strncmp (buff, seq_replied, mutt_strlen (seq_replied))) continue; fprintf (nfp, "%s\n", buff); @@ -395,17 +395,17 @@ static void mh_sequences_add_one (CONTEXT * ctx, int n, short unseen, snprintf (sequences, sizeof (sequences), "%s/.mh_sequences", ctx->path); if ((ofp = fopen (sequences, "r"))) { while ((buff = mutt_read_line (buff, &sz, ofp, &line))) { - if (unseen && !strncmp (buff, seq_unseen, safe_strlen (seq_unseen))) { + if (unseen && !strncmp (buff, seq_unseen, mutt_strlen (seq_unseen))) { fprintf (nfp, "%s %d\n", buff, n); unseen_done = 1; } else if (flagged - && !strncmp (buff, seq_flagged, safe_strlen (seq_flagged))) { + && !strncmp (buff, seq_flagged, mutt_strlen (seq_flagged))) { fprintf (nfp, "%s %d\n", buff, n); flagged_done = 1; } else if (replied - && !strncmp (buff, seq_replied, safe_strlen (seq_replied))) { + && !strncmp (buff, seq_replied, mutt_strlen (seq_replied))) { fprintf (nfp, "%s %d\n", buff, n); replied_done = 1; } @@ -683,7 +683,7 @@ static int maildir_parse_dir (CONTEXT * ctx, struct maildir ***last, if (subdir) { snprintf (buf, sizeof (buf), "%s/%s", ctx->path, subdir); - is_old = (safe_strcmp ("cur", subdir) == 0); + is_old = (mutt_strcmp ("cur", subdir) == 0); } else strfcpy (buf, ctx->path, sizeof (buf)); @@ -835,7 +835,7 @@ static size_t maildir_hcache_keylen (const char *fn) { const char *p = strchr (fn, ':'); - return p ? (size_t) (p - fn) : safe_strlen (fn); + return p ? (size_t) (p - fn) : mutt_strlen (fn); } #endif @@ -1001,7 +1001,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, safe_strlen (tmp), 1, ch_compar); + qsort (tmp, mutt_strlen (tmp), 1, ch_compar); snprintf (dest, destlen, ":2,%s", tmp); } } @@ -1356,7 +1356,7 @@ static int maildir_sync_message (CONTEXT * ctx, int msgno) snprintf (fullpath, sizeof (fullpath), "%s/%s", ctx->path, partpath); snprintf (oldpath, sizeof (oldpath), "%s/%s", ctx->path, h->path); - if (safe_strcmp (fullpath, oldpath) == 0) { + if (mutt_strcmp (fullpath, oldpath) == 0) { /* message hasn't really changed */ return 0; } @@ -1621,7 +1621,7 @@ static int maildir_check_mailbox (CONTEXT * ctx, int *index_hint, int unused) /* check to see if the message has moved to a different * subdirectory. If so, update the associated filename. */ - if (safe_strcmp (ctx->hdrs[i]->path, p->h->path)) + if (mutt_strcmp (ctx->hdrs[i]->path, p->h->path)) str_replace (&ctx->hdrs[i]->path, p->h->path); /* if the user hasn't modified the flags on this message, update @@ -1806,7 +1806,7 @@ FILE *_maildir_open_find_message (const char *folder, const char *unique, while ((de = readdir (dp))) { maildir_canon_filename (tunique, de->d_name, sizeof (tunique)); - if (!safe_strcmp (tunique, unique)) { + if (!mutt_strcmp (tunique, unique)) { snprintf (fname, sizeof (fname), "%s/%s/%s", folder, subfolder, de->d_name); fp = fopen (fname, "r"); /* __FOPEN_CHECKED__ */ diff --git a/mutt_idna.c b/mutt_idna.c index 75bee92..2665f9c 100644 --- a/mutt_idna.c +++ b/mutt_idna.c @@ -155,7 +155,7 @@ int mutt_addrlist_to_idna (ADDRESS * a, char **err) *err = safe_strdup (domain); } else { - safe_realloc (&a->mailbox, safe_strlen (user) + safe_strlen (tmp) + 2); + safe_realloc (&a->mailbox, mutt_strlen (user) + mutt_strlen (tmp) + 2); sprintf (a->mailbox, "%s@%s", NONULL (user), NONULL (tmp)); /* __SPRINTF_CHECKED__ */ } @@ -182,7 +182,7 @@ int mutt_addrlist_to_local (ADDRESS * a) continue; if (mutt_idna_to_local (domain, &tmp, 0) == 0) { - safe_realloc (&a->mailbox, safe_strlen (user) + safe_strlen (tmp) + 2); + safe_realloc (&a->mailbox, mutt_strlen (user) + mutt_strlen (tmp) + 2); sprintf (a->mailbox, "%s@%s", NONULL (user), NONULL (tmp)); /* __SPRINTF_CHECKED__ */ } @@ -216,7 +216,7 @@ const char *mutt_addr_for_display (ADDRESS * a) return a->mailbox; } - safe_realloc (&buff, safe_strlen (tmp) + safe_strlen (user) + 2); + safe_realloc (&buff, mutt_strlen (tmp) + mutt_strlen (user) + 2); sprintf (buff, "%s@%s", NONULL (user), NONULL (tmp)); /* __SPRINTF_CHECKED__ */ FREE (&tmp); FREE (&user); diff --git a/mutt_libesmtp.c b/mutt_libesmtp.c index a9c2151..fd2a05a 100644 --- a/mutt_libesmtp.c +++ b/mutt_libesmtp.c @@ -187,7 +187,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 = safe_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 d78a7eb..5c661c7 100644 --- a/mutt_sasl.c +++ b/mutt_sasl.c @@ -123,7 +123,7 @@ static int iptostring (const struct sockaddr *addr, socklen_t addrlen, if (ret) return getnameinfo_err (ret); - if (outlen < safe_strlen (hbuf) + safe_strlen (pbuf) + 2) + if (outlen < mutt_strlen (hbuf) + mutt_strlen (pbuf) + 2) return SASL_BUFOVER; snprintf (out, outlen, "%s;%s", hbuf, pbuf); @@ -367,7 +367,7 @@ int mutt_sasl_interact (sasl_interact_t * interaction) if (mutt_get_field (prompt, resp, sizeof (resp), 0)) return SASL_FAIL; - interaction->len = safe_strlen (resp) + 1; + interaction->len = mutt_strlen (resp) + 1; interaction->result = safe_malloc (interaction->len); memcpy (interaction->result, resp, interaction->len); @@ -471,7 +471,7 @@ static int mutt_sasl_cb_authname (void *context, int id, const char **result, } if (len) - *len = safe_strlen (*result); + *len = mutt_strlen (*result); return SASL_OK; } @@ -491,7 +491,7 @@ static int mutt_sasl_cb_pass (sasl_conn_t * conn, void *context, int id, if (mutt_account_getpass (account)) return SASL_FAIL; - len = safe_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 2cdbf25..4c3baaa 100644 --- a/mutt_socket.c +++ b/mutt_socket.c @@ -103,7 +103,7 @@ int mutt_socket_write_d (CONNECTION * conn, const char *buf, int dbg) return -1; } - len = safe_strlen (buf); + len = mutt_strlen (buf); if ((rc = conn->conn_write (conn, buf, len)) < 0) { debug_print (1, ("error writing, closing socket\n")); mutt_socket_close (conn); @@ -169,7 +169,7 @@ int mutt_socket_readln_d (char *buf, size_t buflen, CONNECTION * conn, debug_print (dbg, ("< %s\n", buf)); - /* number of bytes read, not safe_strlen */ + /* number of bytes read, not mutt_strlen */ return i + 1; } @@ -270,7 +270,7 @@ static int socket_preconnect (void) int rc; int save_errno; - if (safe_strlen (Preconnect)) { + if (mutt_strlen (Preconnect)) { debug_print (2, ("Executing preconnect: %s\n", Preconnect)); rc = mutt_system (Preconnect); debug_print (2, ("Preconnect result: %d\n", rc)); diff --git a/mutt_ssl.c b/mutt_ssl.c index 0cf05f7..83b735b 100644 --- a/mutt_ssl.c +++ b/mutt_ssl.c @@ -374,7 +374,7 @@ static char *x509_get_part (char *line, const char *ndx) c = strstr (line, ndx); if (c) { - c += safe_strlen (ndx); + c += mutt_strlen (ndx); c2 = strchr (c, '/'); if (c2) *c2 = '\0'; diff --git a/mutt_ssl_gnutls.c b/mutt_ssl_gnutls.c index e160bd6..7b6cb09 100644 --- a/mutt_ssl_gnutls.c +++ b/mutt_ssl_gnutls.c @@ -412,8 +412,8 @@ static int tls_check_stored_hostname (const gnutls_datum * cert, if (regexec (&preg, linestr, 3, pmatch, 0) == 0) { linestr[pmatch[1].rm_eo] = '\0'; linestr[pmatch[2].rm_eo] = '\0'; - if (safe_strcmp (linestr + pmatch[1].rm_so, hostname) == 0 && - safe_strcmp (linestr + pmatch[2].rm_so, buf) == 0) { + if (mutt_strcmp (linestr + pmatch[1].rm_so, hostname) == 0 && + mutt_strcmp (linestr + pmatch[2].rm_so, buf) == 0) { regfree (&preg); FREE(&linestr); fclose (fp); diff --git a/mutt_ssl_nss.c b/mutt_ssl_nss.c index f13dd49..863f969 100644 --- a/mutt_ssl_nss.c +++ b/mutt_ssl_nss.c @@ -93,7 +93,7 @@ static void mutt_nss_pretty_time (int64 usecs) t.tm_yday = ex.tm_yday; strfcpy (timebuf, asctime (&t), sizeof (timebuf)); - timebuf[safe_strlen (timebuf) - 1] = 0; + timebuf[mutt_strlen (timebuf) - 1] = 0; addstr (timebuf); } diff --git a/muttlib.c b/muttlib.c index 0b0530a..234efd2 100644 --- a/muttlib.c +++ b/muttlib.c @@ -86,7 +86,7 @@ void mutt_adv_mktemp (char *s, size_t l) mktemp (s); if (period != NULL) { *period = '.'; - sl = safe_strlen (s); + sl = mutt_strlen (s); strfcpy (s + sl, period, l - sl); } } @@ -276,7 +276,7 @@ void mutt_free_header (HEADER ** h) int mutt_matches_ignore (const char *s, LIST * t) { for (; t; t = t->next) { - if (!ascii_strncasecmp (s, t->data, safe_strlen (t->data)) + if (!ascii_strncasecmp (s, t->data, mutt_strlen (t->data)) || *t->data == '*') return 1; } @@ -364,7 +364,7 @@ char *_mutt_expand_path (char *s, size_t slen, int rx) #ifdef USE_IMAP /* if folder = imap[s]://host/: don't append slash */ if (imap_is_magic (NONULL (Maildir), NULL) == M_IMAP && - Maildir[safe_strlen (Maildir) - 1] == '/') + Maildir[mutt_strlen (Maildir) - 1] == '/') strfcpy (p, NONULL (Maildir), sizeof (p)); else #endif @@ -489,7 +489,7 @@ char *mutt_gecos_name (char *dest, size_t destlen, struct passwd *pw) else strfcpy (dest, pw->pw_gecos, destlen); - pwnl = safe_strlen (pw->pw_name); + pwnl = mutt_strlen (pw->pw_name); for (idx = 0; dest[idx]; idx++) { if (dest[idx] == '&') { @@ -701,15 +701,15 @@ void mutt_pretty_mailbox (char *s) } *q = 0; - if (safe_strncmp (s, Maildir, (len = safe_strlen (Maildir))) == 0 && + if (safe_strncmp (s, Maildir, (len = mutt_strlen (Maildir))) == 0 && s[len] == '/') { *s++ = '='; - memmove (s, s + len, safe_strlen (s + len) + 1); + memmove (s, s + len, mutt_strlen (s + len) + 1); } - else if (safe_strncmp (s, Homedir, (len = safe_strlen (Homedir))) == 0 && + else if (safe_strncmp (s, Homedir, (len = mutt_strlen (Homedir))) == 0 && s[len] == '/') { *s++ = '~'; - memmove (s, s + len - 1, safe_strlen (s + len - 1) + 1); + memmove (s, s + len - 1, mutt_strlen (s + len - 1) + 1); } } @@ -749,7 +749,7 @@ void mutt_expand_fmt (char *dest, size_t destlen, const char *fmt, size_t slen; int found = 0; - slen = safe_strlen (src); + slen = mutt_strlen (src); destlen--; for (p = fmt, d = dest; destlen && *p; p++) { @@ -901,7 +901,7 @@ int mutt_skipchars (const char *s, const char *c) ret++; s++; } - return (safe_strlen (p)); + return (mutt_strlen (p)); } void mutt_FormatString (char *dest, /* output buffer */ @@ -1001,7 +1001,7 @@ void mutt_FormatString (char *dest, /* output buffer */ if (count > col) { count -= col; /* how many columns left on this line */ mutt_FormatString (buf, sizeof (buf), src, callback, data, flags); - wid = safe_strlen (buf); + wid = mutt_strlen (buf); if (count > wid) { count -= wid; /* how many chars to pad */ memset (wptr, ch, count); @@ -1059,7 +1059,7 @@ void mutt_FormatString (char *dest, /* output buffer */ *p = '_'; } - if ((len = safe_strlen (buf)) + wlen > destlen) + if ((len = mutt_strlen (buf)) + wlen > destlen) len = (destlen - wlen > 0) ? (destlen - wlen) : 0; memcpy (wptr, buf, len); @@ -1130,7 +1130,7 @@ FILE *mutt_open_read (const char *path, pid_t * thepid) FILE *f; struct stat s; - int len = safe_strlen (path); + int len = mutt_strlen (path); if (path[len - 1] == '|') { /* read from a pipe */ @@ -1188,7 +1188,7 @@ int mutt_save_confirm (const char *s, struct stat *st) } if (option (OPTCONFIRMAPPEND) && - (!TrashPath || (safe_strcmp (s, TrashPath) != 0))) + (!TrashPath || (mutt_strcmp (s, TrashPath) != 0))) /* if we're appending to the trash, there's no point in asking */ { snprintf (tmp, sizeof (tmp), _("Append messages to %s?"), s); @@ -1231,7 +1231,7 @@ void state_prefix_putc (char c, STATE * s) if (s->flags & M_PENDINGPREFIX) { int i; - i = safe_strlen (Quotebuf); + i = mutt_strlen (Quotebuf); Quotebuf[i++] = c; Quotebuf[i] = '\0'; if (i == sizeof (Quotebuf) - 1 || c == '\n') { @@ -1285,7 +1285,7 @@ int state_printf (STATE * s, const char *fmt, ...) void state_mark_attach (STATE * s) { - if ((s->flags & M_DISPLAY) && !safe_strcmp (Pager, "builtin")) + if ((s->flags & M_DISPLAY) && !mutt_strcmp (Pager, "builtin")) state_puts (AttachmentMarker, s); } @@ -1353,14 +1353,14 @@ BUFFER *mutt_buffer_from (BUFFER * b, char *seed) b = mutt_buffer_init (b); b->data = safe_strdup (seed); - b->dsize = safe_strlen (seed); + b->dsize = mutt_strlen (seed); b->dptr = (char *) b->data + b->dsize; return b; } void mutt_buffer_addstr (BUFFER * buf, const char *s) { - mutt_buffer_add (buf, s, safe_strlen (s)); + mutt_buffer_add (buf, s, mutt_strlen (s)); } void mutt_buffer_addch (BUFFER * buf, char c) diff --git a/mx.c b/mx.c index 321ebcb..05a4032 100644 --- a/mx.c +++ b/mx.c @@ -73,7 +73,7 @@ static list2_t* MailboxFormats = NULL; #define MX_COMMAND(idx,cmd) ((mx_t*) MailboxFormats->data[idx])->cmd #define MX_IDX(idx) (idx >= 0 && idx < MailboxFormats->length) -#define mutt_is_spool(s) (safe_strcmp (Spoolfile, s) == 0) +#define mutt_is_spool(s) (mutt_strcmp (Spoolfile, s) == 0) #ifdef USE_DOTLOCK /* parameters: @@ -342,7 +342,7 @@ void mx_unlink_empty (const char *path) int mx_get_magic (const char *path) { int i = 0; - if (safe_strlen (path) == 0) + if (mutt_strlen (path) == 0) return (-1); if ((i = mx_get_idx (path)) >= 0) return (MX_COMMAND(i,type)); diff --git a/nntp/newsrc.c b/nntp/newsrc.c index 0978381..4dadc20 100644 --- a/nntp/newsrc.c +++ b/nntp/newsrc.c @@ -74,7 +74,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) + safe_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; @@ -205,7 +205,7 @@ static int nntp_parse_cacheindex (NNTP_SERVER * news) return 0; rewind (index); while (fgets (buf, sizeof (buf), index)) { - buf[safe_strlen (buf) - 1] = 0; /* strip ending '\n' */ + buf[mutt_strlen (buf) - 1] = 0; /* strip ending '\n' */ if (!safe_strncmp (buf, "#: ", 3) && !safe_strcasecmp (buf + 3, news->conn->account.host)) break; @@ -217,10 +217,10 @@ static int nntp_parse_cacheindex (NNTP_SERVER * news) if (!*cp) continue; cp[0] = 0; - if (!safe_strcmp (buf, "#:")) + if (!mutt_strcmp (buf, "#:")) break; sscanf (cp + 1, "%s %d %d", file, &l, &m); - if (!safe_strcmp (buf, "ALL")) { + if (!mutt_strcmp (buf, "ALL")) { news->cache = safe_strdup (file); news->newgroups_time = m; } @@ -228,7 +228,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) + safe_strlen (buf) + 1); + sizeof (NNTP_DATA) + mutt_strlen (buf) + 1); data->group = (char *) data + sizeof (NNTP_DATA); strcpy (data->group, buf); data->nserv = news; @@ -343,7 +343,7 @@ NNTP_SERVER *mutt_select_newsserver (char *server) return NULL; } - buf = p = safe_calloc (safe_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'); @@ -512,8 +512,8 @@ static void nntp_create_newsrc_line (NNTP_DATA * data, char **buf, line = *buf + (*pline - line); } strcpy (line, data->group); - len -= safe_strlen (line) + 1; - line += safe_strlen (line); + len -= mutt_strlen (line) + 1; + line += mutt_strlen (line); *line++ = data->subscribed ? ':' : '!'; *line++ = ' '; *line = '\0'; @@ -646,7 +646,7 @@ int mutt_newsrc_update (NNTP_SERVER * news) continue; nntp_create_newsrc_line (data, &buf, &line, &llen); debug_print (2, ("Added to newsrc: %s\n", line)); - line += safe_strlen (line); + line += mutt_strlen (line); } /* newrc being fully rewritten */ if (news->newsrc && @@ -672,7 +672,7 @@ static FILE *mutt_mkname (char *s) return fp; nntp_cache_expand (buf, "cache-XXXXXX"); - pc = buf + safe_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 */ @@ -879,7 +879,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) + safe_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; @@ -972,7 +972,7 @@ void nntp_buffy (char *s) if (data && data->subscribed && data->unread) { if (Context && Context->magic == M_NNTP && - !safe_strcmp (data->group, ((NNTP_DATA *) Context->data)->group)) { + !mutt_strcmp (data->group, ((NNTP_DATA *) Context->data)->group)) { unsigned int i, unread = 0; for (i = 0; i < Context->msgcount; i++) diff --git a/nntp/nntp.c b/nntp/nntp.c index 2b5494f..a0fd012 100644 --- a/nntp/nntp.c +++ b/nntp/nntp.c @@ -321,7 +321,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 += safe_strlen (p); + lenbuf += mutt_strlen (p); } else { line++; @@ -388,7 +388,7 @@ static void nntp_parse_xref (CONTEXT * ctx, char *group, char *xref, *colon = '\0'; colon++; nntp_get_status (ctx, h, p, atoi (colon)); - if (h && h->article_num == 0 && safe_strcmp (group, b) == 0) + if (h && h->article_num == 0 && mutt_strcmp (group, b) == 0) h->article_num = atoi (colon); } } @@ -460,7 +460,7 @@ static int parse_description (char *line, void *n) d++; debug_print (2, ("group: %s, desc: %s\n", line, d)); if ((data = (NNTP_DATA *) hash_find (news->newsgroups, line)) != NULL && - safe_strcmp (d, data->desc)) { + mutt_strcmp (d, data->desc)) { FREE (&data->desc); data->desc = safe_strdup (d); } @@ -814,7 +814,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) + safe_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); @@ -999,7 +999,7 @@ int nntp_post (const char *msg) buf[0] = '.'; buf[1] = '\0'; while (fgets (buf + 1, sizeof (buf) - 2, f) != NULL) { - len = safe_strlen (buf); + len = mutt_strlen (buf); if (buf[len - 1] == '\n') { buf[len - 1] = '\r'; buf[len] = '\n'; @@ -1013,7 +1013,7 @@ int nntp_post (const char *msg) } fclose (f); - if (buf[safe_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) { @@ -1224,7 +1224,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) + safe_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/pager.c b/pager.c index 4a935c3..2c831cc 100644 --- a/pager.c +++ b/pager.c @@ -681,8 +681,8 @@ resolve_types (char *buf, char *raw, struct line_t *lineInfo, int n, int last, else if (check_attachment_marker ((char *) raw) == 0) lineInfo[n].type = MT_COLOR_ATTACHMENT; #endif - else if (safe_strcmp ("-- \n", buf) == 0 - || safe_strcmp ("-- \r\n", buf) == 0) { + else if (mutt_strcmp ("-- \n", buf) == 0 + || mutt_strcmp ("-- \r\n", buf) == 0) { i = n + 1; lineInfo[n].type = MT_COLOR_SIGNATURE; diff --git a/parse.c b/parse.c index d18ef59..ee8d70f 100644 --- a/parse.c +++ b/parse.c @@ -47,7 +47,7 @@ static char *read_rfc822_line (FILE * f, char *line, size_t * linelen) return (line); } - buf += safe_strlen (buf) - 1; + buf += mutt_strlen (buf) - 1; if (*buf == '\n') { /* we did get a full line. remove trailing space */ while (ISSPACE (*buf)) @@ -96,7 +96,7 @@ LIST *mutt_parse_references (char *s, int in_reply_to) new = NULL; if (*s == '<') { - n = safe_strlen (s); + n = mutt_strlen (s); if (s[n - 1] != '>') { o = s; s = NULL; @@ -106,7 +106,7 @@ LIST *mutt_parse_references (char *s, int in_reply_to) new = safe_strdup (s); } else if (o) { - m = safe_strlen (s); + m = mutt_strlen (s); if (s[m - 1] == '>') { new = safe_malloc (sizeof (char) * (n + m + 1)); strcpy (new, o); /* __STRCPY_CHECKED__ */ @@ -582,9 +582,9 @@ BODY *mutt_parse_multipart (FILE * fp, const char *boundary, long end_off, return (NULL); } - blen = safe_strlen (boundary); + blen = mutt_strlen (boundary); while (ftell (fp) < end_off && fgets (buffer, LONG_STRING, fp) != NULL) { - len = safe_strlen (buffer); + len = mutt_strlen (buffer); crlf = (len > 1 && buffer[len - 2] == '\r') ? 1 : 0; @@ -605,7 +605,7 @@ BODY *mutt_parse_multipart (FILE * fp, const char *boundary, long end_off, buffer[i] = 0; /* Check for the end boundary */ - if (safe_strcmp (buffer + blen + 2, "--") == 0) { + if (mutt_strcmp (buffer + blen + 2, "--") == 0) { final = 1; break; /* done parsing */ } @@ -1246,7 +1246,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[safe_strlen (line)] = ':'; + line[mutt_strlen (line)] = ':'; if (weed && option (OPTWEED) && mutt_matches_ignore (line, Ignore) && !mutt_matches_ignore (line, UnIgnore)) diff --git a/pattern.c b/pattern.c index 5e521c6..7d70868 100644 --- a/pattern.c +++ b/pattern.c @@ -204,7 +204,7 @@ msg_search (CONTEXT * ctx, regex_t * rx, char *buf, size_t blen, int op, match = 1; break; } - lng -= safe_strlen (buf); + lng -= mutt_strlen (buf); } mx_close_message (&msg); @@ -667,7 +667,7 @@ pattern_t *mutt_pattern_comp ( /* const */ char *s, int flags, BUFFER * err) memset (&ps, 0, sizeof (ps)); ps.dptr = s; - ps.dsize = safe_strlen (s); + ps.dsize = mutt_strlen (s); while (*ps.dptr) { SKIPWS (ps.dptr); @@ -1098,7 +1098,7 @@ void mutt_check_simple (char *s, size_t len, const char *simple) if (!strchr (s, '~')) { /* yup, so spoof a real request */ /* convert old tokens into the new format */ - if (ascii_strcasecmp ("all", s) == 0 || !safe_strcmp ("^", s) || !safe_strcmp (".", s)) /* ~A is more efficient */ + if (ascii_strcasecmp ("all", s) == 0 || !mutt_strcmp ("^", s) || !mutt_strcmp (".", s)) /* ~A is more efficient */ strfcpy (s, "~A", len); else if (ascii_strcasecmp ("del", s) == 0) strfcpy (s, "~D", len); @@ -1256,7 +1256,7 @@ int mutt_search_command (int cur, int op) strfcpy (temp, buf, sizeof (temp)); mutt_check_simple (temp, sizeof (temp), NONULL (SimpleSearch)); - if (!SearchPattern || safe_strcmp (temp, LastSearchExpn)) { + if (!SearchPattern || mutt_strcmp (temp, LastSearchExpn)) { set_option (OPTSEARCHINVALID); strfcpy (LastSearch, buf, sizeof (LastSearch)); mutt_message _("Compiling search pattern..."); diff --git a/pgp.c b/pgp.c index acca75d..062ee27 100644 --- a/pgp.c +++ b/pgp.c @@ -195,7 +195,7 @@ static void pgp_copy_clearsigned (FILE * fpin, STATE * s, char *charset) continue; } - if (safe_strcmp (buf, "-----BEGIN PGP SIGNATURE-----\n") == 0) + if (mutt_strcmp (buf, "-----BEGIN PGP SIGNATURE-----\n") == 0) break; if (armor_header) { @@ -251,21 +251,21 @@ void pgp_application_pgp_handler (BODY * m, STATE * s) break; offset = ftell (s->fpin); - bytes -= (offset - last_pos); /* don't rely on safe_strlen(buf) */ + bytes -= (offset - last_pos); /* don't rely on mutt_strlen(buf) */ last_pos = offset; if (safe_strncmp ("-----BEGIN PGP ", buf, 15) == 0) { clearsign = 0; start_pos = last_pos; - if (safe_strcmp ("MESSAGE-----\n", buf + 15) == 0) + if (mutt_strcmp ("MESSAGE-----\n", buf + 15) == 0) needpass = 1; - else if (safe_strcmp ("SIGNED MESSAGE-----\n", buf + 15) == 0) { + else if (mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15) == 0) { clearsign = 1; needpass = 0; } else if (!option (OPTDONTHANDLEPGPKEYS) && - safe_strcmp ("PUBLIC KEY BLOCK-----\n", buf + 15) == 0) { + mutt_strcmp ("PUBLIC KEY BLOCK-----\n", buf + 15) == 0) { needpass = 0; pgp_keyblock = 1; } @@ -289,16 +289,16 @@ void pgp_application_pgp_handler (BODY * m, STATE * s) fputs (buf, tmpfp); while (bytes > 0 && fgets (buf, sizeof (buf) - 1, s->fpin) != NULL) { offset = ftell (s->fpin); - bytes -= (offset - last_pos); /* don't rely on safe_strlen(buf) */ + bytes -= (offset - last_pos); /* don't rely on mutt_strlen(buf) */ last_pos = offset; fputs (buf, tmpfp); if ((needpass - && safe_strcmp ("-----END PGP MESSAGE-----\n", buf) == 0) + && mutt_strcmp ("-----END PGP MESSAGE-----\n", buf) == 0) || (!needpass - && (safe_strcmp ("-----END PGP SIGNATURE-----\n", buf) == 0 - || safe_strcmp ("-----END PGP PUBLIC KEY BLOCK-----\n", + && (mutt_strcmp ("-----END PGP SIGNATURE-----\n", buf) == 0 + || mutt_strcmp ("-----END PGP PUBLIC KEY BLOCK-----\n", buf) == 0))) break; } @@ -464,11 +464,11 @@ static int pgp_check_traditional_one_body (FILE * fp, BODY * b, while (fgets (buf, sizeof (buf), tfp)) { if (safe_strncmp ("-----BEGIN PGP ", buf, 15) == 0) { - if (safe_strcmp ("MESSAGE-----\n", buf + 15) == 0) + if (mutt_strcmp ("MESSAGE-----\n", buf + 15) == 0) enc = 1; - else if (safe_strcmp ("SIGNED MESSAGE-----\n", buf + 15) == 0) + else if (mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15) == 0) sgn = 1; - else if (safe_strcmp ("PUBLIC KEY BLOCK-----\n", buf + 15) == 0) + else if (mutt_strcmp ("PUBLIC KEY BLOCK-----\n", buf + 15) == 0) key = 1; } } @@ -737,7 +737,7 @@ BODY *pgp_decrypt_part (BODY * a, STATE * s, FILE * fpout, BODY * p) * read_mime_header has a hard time parsing the message. */ while (fgets (buf, sizeof (buf) - 1, pgpout) != NULL) { - len = safe_strlen (buf); + len = mutt_strlen (buf); if (len > 1 && buf[len - 2] == '\r') strcpy (buf + len - 2, "\n"); /* __STRCPY_CHECKED__ */ fputs (buf, fpout); @@ -935,9 +935,9 @@ BODY *pgp_sign_message (BODY * a) * recommended for future releases of PGP. */ while (fgets (buffer, sizeof (buffer) - 1, pgpout) != NULL) { - if (safe_strcmp ("-----BEGIN PGP MESSAGE-----\n", buffer) == 0) + if (mutt_strcmp ("-----BEGIN PGP MESSAGE-----\n", buffer) == 0) fputs ("-----BEGIN PGP SIGNATURE-----\n", fp); - else if (safe_strcmp ("-----END PGP MESSAGE-----\n", buffer) == 0) + else if (mutt_strcmp ("-----END PGP MESSAGE-----\n", buffer) == 0) fputs ("-----END PGP SIGNATURE-----\n", fp); else fputs (buffer, fp); @@ -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 (safe_strlen (s) % 8) + if (mutt_strlen (s) % 8) return 0; while (*s) if (strchr ("0123456789ABCDEFabcdef", *s++) == NULL) @@ -1114,11 +1114,11 @@ char *pgp_findKeys (ADDRESS * to, ADDRESS * cc, ADDRESS * bcc) keyID = pgp_keyid (key); bypass_selection: - keylist_size += safe_strlen (keyID) + 4; + keylist_size += mutt_strlen (keyID) + 4; safe_realloc (&keylist, keylist_size); sprintf (keylist + keylist_used, "%s0x%s", keylist_used ? " " : "", /* __SPRINTF_CHECKED__ */ keyID); - keylist_used = safe_strlen (keylist); + keylist_used = mutt_strlen (keylist); pgp_free_key (&key); rfc822_free_address (&addr); diff --git a/pgpkey.c b/pgpkey.c index 42dc0ff..8bf2534 100644 --- a/pgpkey.c +++ b/pgpkey.c @@ -763,7 +763,7 @@ static LIST *pgp_add_string_to_hints (LIST * hints, const char *str) for (t = strtok (scratch, " ,.:\"()<>\n"); t; t = strtok (NULL, " ,.:\"()<>\n")) { - if (safe_strlen (t) > 3) + if (mutt_strlen (t) > 3) hints = mutt_add_list (hints, t); } diff --git a/pgpmicalg.c b/pgpmicalg.c index 80f7c38..6d2df9e 100644 --- a/pgpmicalg.c +++ b/pgpmicalg.c @@ -105,7 +105,7 @@ static void pgp_dearmor (FILE * in, FILE * out) return; } - if ((end = ftell (in) - safe_strlen (line)) < start) { + if ((end = ftell (in) - mutt_strlen (line)) < start) { debug_print (1, ("end < start???\n")); return; } diff --git a/pgppubring.c b/pgppubring.c index e5f729e..6207502 100644 --- a/pgppubring.c +++ b/pgppubring.c @@ -743,7 +743,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 + safe_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/pop.c b/pop/pop.c index f29240a..ab5b739 100644 --- a/pop/pop.c +++ b/pop/pop.c @@ -124,7 +124,7 @@ static int fetch_uidl (char *line, void *data) sscanf (line, "%d %s", &index, line); for (i = 0; i < ctx->msgcount; i++) - if (!safe_strcmp (line, ctx->hdrs[i]->data)) + if (!mutt_strcmp (line, ctx->hdrs[i]->data)) break; if (i == ctx->msgcount) { diff --git a/pop/pop_lib.c b/pop/pop_lib.c index 637d01b..2880de5 100644 --- a/pop/pop_lib.c +++ b/pop/pop_lib.c @@ -484,7 +484,7 @@ static int check_uidl (char *line, void *data) sscanf (line, "%u %s", &index, line); for (i = 0; i < ctx->msgcount; i++) { - if (!safe_strcmp (ctx->hdrs[i]->data, line)) { + if (!mutt_strcmp (ctx->hdrs[i]->data, line)) { ctx->hdrs[i]->refno = index; break; } diff --git a/query.c b/query.c index 5c5d0a3..35dbf2b 100644 --- a/query.c +++ b/query.c @@ -185,7 +185,7 @@ static void query_entry (char *s, size_t slen, MUTTMENU * m, int num) mutt_format_string (buf2, sizeof (buf2), FirstColumn + 2, FirstColumn + 2, 0, ' ', table[num].data->name, - safe_strlen (table[num].data->name), 0); + mutt_strlen (table[num].data->name), 0); snprintf (s, slen, " %c %3d %s %-*.*s %s", table[num].tagged ? '*' : ' ', @@ -444,7 +444,7 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf) mutt_addrlist_to_local (tmpa); tagged = 1; rfc822_write_address (buf, buflen, tmpa, 0); - curpos = safe_strlen (buf); + curpos = mutt_strlen (buf); rfc822_free_address (&tmpa); } else if (curpos + 2 < buflen) { @@ -454,7 +454,7 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf) strcat (buf, ", "); /* __STRCAT_CHECKED__ */ rfc822_write_address ((char *) buf + curpos + 1, buflen - curpos - 1, tmpa, 0); - curpos = safe_strlen (buf); + curpos = mutt_strlen (buf); rfc822_free_address (&tmpa); } } diff --git a/recvattach.c b/recvattach.c index 6c49fa6..36f4a3e 100644 --- a/recvattach.c +++ b/recvattach.c @@ -95,7 +95,7 @@ void mutt_update_tree (ATTACHPTR ** idx, short idxlen) } if (idx[x]->tree) { - if (safe_strcmp (idx[x]->tree, buf) != 0) + if (mutt_strcmp (idx[x]->tree, buf) != 0) str_replace (&idx[x]->tree, buf); } else diff --git a/remailer.c b/remailer.c index 3239993..68de837 100644 --- a/remailer.c +++ b/remailer.c @@ -234,7 +234,7 @@ static void mix_screen_coordinates (REMAILER ** type2_list, if (i) { c = - coords[i - 1].c + safe_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 { @@ -245,7 +245,7 @@ static void mix_screen_coordinates (REMAILER ** type2_list, for (; i < chain->cl; i++) { oc = c; - c += safe_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; @@ -431,7 +431,7 @@ static int mix_chain_add (MIXCHAIN * chain, const char *s, if (chain->cl >= MAXMIXES) return -1; - if (!safe_strcmp (s, "0") || !ascii_strcasecmp (s, "")) { + if (!mutt_strcmp (s, "0") || !ascii_strcasecmp (s, "")) { chain->ch[chain->cl++] = 0; return 0; } diff --git a/rfc1524.c b/rfc1524.c index 4247b05..220beeb 100644 --- a/rfc1524.c +++ b/rfc1524.c @@ -194,7 +194,7 @@ static int rfc1524_mailcap_parse (BODY * a, /* check type */ ch = get_field (buf); if (ascii_strcasecmp (buf, type) && (ascii_strncasecmp (buf, type, btlen) || (buf[btlen] != 0 && /* implicit wild */ - safe_strcmp (buf + btlen, "/*")))) /* wildsubtype */ + mutt_strcmp (buf + btlen, "/*")))) /* wildsubtype */ continue; /* next field is the viewcommand */ @@ -265,7 +265,7 @@ static int rfc1524_mailcap_parse (BODY * a, if (get_field_text (field + 4, &test_command, type, filename, line) && test_command) { - len = safe_strlen (test_command) + STRING; + len = mutt_strlen (test_command) + STRING; safe_realloc (&test_command, len); rfc1524_expand_command (a, a->filename, type, test_command, len); if (mutt_system (test_command)) { @@ -473,8 +473,8 @@ int rfc1524_expand_filename (char *nametemplate, rmatch = 1; - for (r = 0, j = safe_strlen (oldfile) - 1, k = - safe_strlen (nametemplate) - 1; + for (r = 0, j = mutt_strlen (oldfile) - 1, k = + mutt_strlen (nametemplate) - 1; j >= (lmatch ? i : 0) && k >= i + 2; j--, k--) { if (nametemplate[k] != oldfile[j]) { rmatch = 0; diff --git a/rfc2047.c b/rfc2047.c index 209330e..c8c1bea 100644 --- a/rfc2047.c +++ b/rfc2047.c @@ -36,7 +36,7 @@ #endif #define ENCWORD_LEN_MAX 75 -#define ENCWORD_LEN_MIN 9 /* safe_strlen ("=?.?.?.?=") */ +#define ENCWORD_LEN_MIN 9 /* mutt_strlen ("=?.?.?.?=") */ #define HSPACE(x) ((x) == '\0' || (x) == ' ' || (x) == '\t') @@ -94,7 +94,7 @@ char *mutt_choose_charset (const char *fromcode, const char *charsets, q = strchr (p, ':'); - n = q ? q - p : safe_strlen (p); + n = q ? q - p : mutt_strlen (p); if (!n || /* Assume that we never need more than 12 characters of @@ -147,7 +147,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, safe_strlen (tocode)), s += safe_strlen (tocode); + memcpy (s, tocode, mutt_strlen (tocode)), s += mutt_strlen (tocode); memcpy (s, "?B?", 3), s += 3; for (;;) { if (!dlen) @@ -185,7 +185,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, safe_strlen (tocode)), s += safe_strlen (tocode); + memcpy (s, tocode, mutt_strlen (tocode)), s += mutt_strlen (tocode); memcpy (s, "?Q?", 3), s += 3; while (dlen--) { unsigned char c = *d++; @@ -227,7 +227,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) - safe_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); @@ -238,8 +238,8 @@ static size_t try_block (ICONV_CONST char *d, size_t dlen, iconv_close (cd); } else { - if (dlen > sizeof (buf1) - safe_strlen (tocode)) - return sizeof (buf1) - safe_strlen (tocode) + 1; + if (dlen > sizeof (buf1) - mutt_strlen (tocode)) + return sizeof (buf1) - mutt_strlen (tocode) + 1; memcpy (buf1, d, dlen); ob = buf1 + dlen; } @@ -254,7 +254,7 @@ static size_t try_block (ICONV_CONST char *d, size_t dlen, ++count; } - len = ENCWORD_LEN_MIN - 2 + safe_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; @@ -293,7 +293,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) - safe_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)); @@ -480,15 +480,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 + safe_strlen (LINEBREAK) > buflen) { - buflen = bufpos + wlen + safe_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, safe_strlen (LINEBREAK)); - bufpos += safe_strlen (LINEBREAK); + memcpy (buf + bufpos, LINEBREAK, mutt_strlen (LINEBREAK)); + bufpos += mutt_strlen (LINEBREAK); #undef LINEBREAK col = 1; @@ -527,7 +527,7 @@ void _rfc2047_encode_string (char **pd, int encode_specials, int col) if (!charsets || !*charsets) charsets = "UTF-8"; - rfc2047_encode (*pd, safe_strlen (*pd), col, + rfc2047_encode (*pd, mutt_strlen (*pd), col, Charset, charsets, &e, &elen, encode_specials ? RFC822Specials : NULL); @@ -538,7 +538,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 ? safe_strlen (tag) + 2 : 32; + int col = tag ? mutt_strlen (tag) + 2 : 32; while (ptr) { if (ptr->personal) @@ -555,7 +555,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 (safe_strlen (s)); + pd = d0 = safe_malloc (mutt_strlen (s)); for (pp = s; (pp1 = strchr (pp, '?')); pp = pp1 + 1) { count++; @@ -711,14 +711,14 @@ void rfc2047_decode (char **pd) if (!s || !*s) return; - dlen = 4 * safe_strlen (s); /* should be enough */ + dlen = 4 * mutt_strlen (s); /* should be enough */ d = d0 = safe_malloc (dlen + 1); while (*s && dlen > 0) { if (!(p = find_encoded_word (s, &q))) { /* no encoded words */ if (!option (OPTSTRICTMIME)) { - n = safe_strlen (s); + n = mutt_strlen (s); if (found_encoded && (m = lwslen (s, n)) != 0) { if (m != n) *d = ' ', d++, dlen--; @@ -731,7 +731,7 @@ void rfc2047_decode (char **pd) t = safe_malloc (n + 1); strfcpy (t, s, n + 1); if (mutt_convert_nonmime_string (&t) == 0) { - tlen = safe_strlen (t); + tlen = mutt_strlen (t); strncpy (d, t, tlen); d += tlen; } @@ -781,7 +781,7 @@ void rfc2047_decode (char **pd) rfc2047_decode_word (d, p, dlen); found_encoded = 1; s = q; - n = safe_strlen (d); + n = mutt_strlen (d); dlen -= n; d += n; } diff --git a/rfc2231.c b/rfc2231.c index 3c0f097..0fcc857 100644 --- a/rfc2231.c +++ b/rfc2231.c @@ -230,7 +230,7 @@ static void rfc2231_list_insert (struct rfc2231_parameter **list, q = p; p = p->next; - c = safe_strcmp (par->value, q->value); + c = mutt_strcmp (par->value, q->value); if ((c > 0) || (c == 0 && par->index >= q->index)) break; } @@ -269,7 +269,7 @@ static void rfc2231_join_continuations (PARAMETER ** head, if (encoded && par->encoded) rfc2231_decode_one (par->value, valp); - vl = safe_strlen (par->value); + vl = mutt_strlen (par->value); safe_realloc (&value, l + vl + 1); strcpy (value + l, par->value); /* __STRCPY_CHECKED__ */ @@ -279,7 +279,7 @@ static void rfc2231_join_continuations (PARAMETER ** head, rfc2231_free_parameter (&par); if ((par = q)) valp = par->value; - } while (par && !safe_strcmp (par->attribute, attribute)); + } while (par && !mutt_strcmp (par->attribute, attribute)); if (value) { if (encoded) @@ -314,10 +314,10 @@ int rfc2231_encode_string (char **pd) if (!Charset || !SendCharset || !(charset = mutt_choose_charset (Charset, SendCharset, - *pd, safe_strlen (*pd), &d, &dlen))) { + *pd, mutt_strlen (*pd), &d, &dlen))) { charset = safe_strdup (Charset ? Charset : "unknown-8bit"); d = *pd; - dlen = safe_strlen (d); + dlen = mutt_strlen (d); } if (!mutt_is_us_ascii (charset)) @@ -330,9 +330,9 @@ int rfc2231_encode_string (char **pd) ++ext; if (encode) { - e = safe_malloc (dlen + 2 * ext + safe_strlen (charset) + 3); + e = safe_malloc (dlen + 2 * ext + mutt_strlen (charset) + 3); sprintf (e, "%s''", charset); /* __SPRINTF_CHECKED__ */ - t = e + safe_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/rfc822.c b/rfc822.c index 64b1606..19fb086 100644 --- a/rfc822.c +++ b/rfc822.c @@ -446,7 +446,7 @@ void rfc822_qualify (ADDRESS * addr, const char *host) for (; addr; addr = addr->next) if (!addr->group && addr->mailbox && strchr (addr->mailbox, '@') == NULL) { - p = safe_malloc (safe_strlen (addr->mailbox) + safe_strlen (host) + 2); + p = safe_malloc (mutt_strlen (addr->mailbox) + mutt_strlen (host) + 2); sprintf (p, "%s@%s", addr->mailbox, host); /* __SPRINTF_CHECKED__ */ FREE (&addr->mailbox); addr->mailbox = p; @@ -516,7 +516,7 @@ void rfc822_write_address_single (char *buf, size_t buflen, ADDRESS * addr, if (!buflen) goto done; strfcpy (pbuf, addr->personal, buflen); - len = safe_strlen (pbuf); + len = mutt_strlen (pbuf); pbuf += len; buflen -= len; } @@ -539,11 +539,11 @@ void rfc822_write_address_single (char *buf, size_t buflen, ADDRESS * addr, goto done; if (ascii_strcmp (addr->mailbox, "@") && !display) { strfcpy (pbuf, addr->mailbox, buflen); - len = safe_strlen (pbuf); + len = mutt_strlen (pbuf); } else if (ascii_strcmp (addr->mailbox, "@") && display) { strfcpy (pbuf, mutt_addr_for_display (addr), buflen); - len = safe_strlen (pbuf); + len = mutt_strlen (pbuf); } else { *pbuf = '\0'; @@ -587,7 +587,7 @@ void rfc822_write_address (char *buf, size_t buflen, ADDRESS * addr, int display) { char *pbuf = buf; - size_t len = safe_strlen (buf); + size_t len = mutt_strlen (buf); buflen--; /* save room for the terminal nul */ @@ -614,7 +614,7 @@ void rfc822_write_address (char *buf, size_t buflen, ADDRESS * addr, /* this should be safe since we always have at least 1 char passed into the above call, which means `pbuf' should always be nul terminated */ - len = safe_strlen (pbuf); + len = mutt_strlen (pbuf); pbuf += len; buflen -= len; diff --git a/score.c b/score.c index 40dbd46..fba01f8 100644 --- a/score.c +++ b/score.c @@ -78,7 +78,7 @@ int mutt_parse_score (BUFFER * buf, BUFFER * s, unsigned long data, /* look for an existing entry and update the value, else add it to the end of the list */ for (ptr = Score, last = NULL; ptr; last = ptr, ptr = ptr->next) - if (safe_strcmp (pattern, ptr->str) == 0) + if (mutt_strcmp (pattern, ptr->str) == 0) break; if (!ptr) { if ((pat = mutt_pattern_comp (pattern, 0, err)) == NULL) { @@ -135,7 +135,7 @@ int mutt_parse_unscore (BUFFER * buf, BUFFER * s, unsigned long data, while (MoreArgs (s)) { mutt_extract_token (buf, s, 0); - if (!safe_strcmp ("*", buf->data)) { + if (!mutt_strcmp ("*", buf->data)) { for (tmp = Score; tmp;) { last = tmp; tmp = tmp->next; @@ -146,7 +146,7 @@ int mutt_parse_unscore (BUFFER * buf, BUFFER * s, unsigned long data, } else { for (tmp = Score; tmp; last = tmp, tmp = tmp->next) { - if (!safe_strcmp (buf->data, tmp->str)) { + if (!mutt_strcmp (buf->data, tmp->str)) { if (last) last->next = tmp->next; else diff --git a/send.c b/send.c index d789804..d777335 100644 --- a/send.c +++ b/send.c @@ -660,7 +660,7 @@ void mutt_make_misc_reply_headers (ENVELOPE * env, CONTEXT * ctx, */ if (curenv->real_subj) { FREE (&env->subject); - env->subject = safe_malloc (safe_strlen (curenv->real_subj) + 5); + env->subject = safe_malloc (mutt_strlen (curenv->real_subj) + 5); sprintf (env->subject, "Re: %s", curenv->real_subj); /* __SPRINTF_CHECKED__ */ } else if (!env->subject) @@ -996,7 +996,7 @@ ADDRESS *mutt_default_from (void) else if (option (OPTUSEDOMAIN)) { adr = rfc822_new_address (); adr->mailbox = - safe_malloc (safe_strlen (Username) + safe_strlen (fqdn) + 2); + safe_malloc (mutt_strlen (Username) + mutt_strlen (fqdn) + 2); sprintf (adr->mailbox, "%s@%s", NONULL (Username), NONULL (fqdn)); /* __SPRINTF_CHECKED__ */ } else { @@ -1314,7 +1314,7 @@ int ci_send_message (int flags, /* send mode */ if (option (OPTSIGONTOP) && (!(flags & (SENDMAILX | SENDKEY)) && Editor - && safe_strcmp (Editor, "builtin") != 0)) + && mutt_strcmp (Editor, "builtin") != 0)) append_signature (tempfp); /* include replies/forwarded messages, unless we are given a template */ @@ -1324,7 +1324,7 @@ int ci_send_message (int flags, /* send mode */ if (!option (OPTSIGONTOP) && (!(flags & (SENDMAILX | SENDKEY)) && Editor - && safe_strcmp (Editor, "builtin") != 0)) + && mutt_strcmp (Editor, "builtin") != 0)) append_signature (tempfp); /* @@ -1437,7 +1437,7 @@ int ci_send_message (int flags, /* send mode */ /* If the this isn't a text message, look for a mailcap edit command */ if (mutt_needs_mailcap (msg->content)) mutt_edit_attachment (msg->content); - else if (!Editor || safe_strcmp ("builtin", Editor) == 0) + else if (!Editor || mutt_strcmp ("builtin", Editor) == 0) mutt_builtin_editor (msg->content->filename, msg, cur); else if (option (OPTEDITHDRS)) { mutt_env_to_local (msg->env); @@ -1665,7 +1665,7 @@ int ci_send_message (int flags, /* send mode */ fcc[0] = '\0'; #endif - if (*fcc && safe_strcmp ("/dev/null", fcc) != 0) { + if (*fcc && mutt_strcmp ("/dev/null", fcc) != 0) { BODY *tmpbody = msg->content; BODY *save_sig = NULL; BODY *save_parts = NULL; @@ -1676,8 +1676,8 @@ int ci_send_message (int flags, /* send mode */ /* check to see if the user wants copies of all attachments */ if (!option (OPTFCCATTACH) && msg->content->type == TYPEMULTIPART) { if (WithCrypto - && (safe_strcmp (msg->content->subtype, "encrypted") == 0 || - safe_strcmp (msg->content->subtype, "signed") == 0)) { + && (mutt_strcmp (msg->content->subtype, "encrypted") == 0 || + mutt_strcmp (msg->content->subtype, "signed") == 0)) { if (clear_content->type == TYPEMULTIPART) { if (!(msg->security & ENCRYPT) && (msg->security & SIGN)) { /* save initial signature and attachments */ diff --git a/sendlib.c b/sendlib.c index cade3dc..2707257 100644 --- a/sendlib.c +++ b/sendlib.c @@ -362,7 +362,7 @@ int mutt_write_mime_header (BODY * a, FILE * f) fprintf (f, "Content-Type: %s/%s", TYPE (a), a->subtype); if (a->parameter) { - len = 25 + safe_strlen (a->subtype); /* approximate len. of content-type */ + len = 25 + mutt_strlen (a->subtype); /* approximate len. of content-type */ for (p = a->parameter; p; p = p->next) { char *tmp; @@ -388,7 +388,7 @@ int mutt_write_mime_header (BODY * a, FILE * f) FREE (&tmp); - tmplen = safe_strlen (buffer) + safe_strlen (p->attribute) + 1; + tmplen = mutt_strlen (buffer) + mutt_strlen (p->attribute) + 1; if (len + tmplen + 2 > 76) { fputs ("\n\t", f); @@ -479,7 +479,7 @@ int mutt_write_mime_body (BODY * a, FILE * f) /* This is pretty gross, but it's the best solution for now... */ if ((WithCrypto & APPLICATION_PGP) && a->type == TYPEAPPLICATION - && safe_strcmp (a->subtype, "pgp-encrypted") == 0) { + && mutt_strcmp (a->subtype, "pgp-encrypted") == 0) { fputs ("Version: 1\n", f); return 0; } @@ -958,7 +958,7 @@ int mutt_lookup_mime_type (BODY * att, const char *path) type = TYPEOTHER; cur_sze = 0; - szf = safe_strlen (path); + szf = mutt_strlen (path); for (count = 0; count < 3; count++) { /* @@ -998,7 +998,7 @@ int mutt_lookup_mime_type (BODY * att, const char *path) /* cycle through the file extensions */ while ((p = strtok (p, " \t\n"))) { - sze = safe_strlen (p); + sze = mutt_strlen (p); if ((sze > cur_sze) && (szf >= sze) && (safe_strcasecmp (path + szf - sze, p) == 0 || ascii_strcasecmp (path + szf - sze, p) == 0) && (szf == sze @@ -1465,7 +1465,7 @@ void mutt_write_address_list (ADDRESS * adr, FILE * fp, int linelen, adr->next = NULL; buf[0] = 0; rfc822_write_address (buf, sizeof (buf), adr, display); - len = safe_strlen (buf); + len = mutt_strlen (buf); if (count && linelen + len > 74) { fputs ("\n\t", fp); linelen = len + 8; /* tab is usually about 8 spaces... */ @@ -1709,7 +1709,7 @@ static void encode_headers (LIST * h) rfc2047_encode_string (&tmp); safe_realloc (&h->data, - safe_strlen (h->data) + 2 + safe_strlen (tmp) + 1); + mutt_strlen (h->data) + 2 + mutt_strlen (tmp) + 1); sprintf (h->data + i, ": %s", NONULL (tmp)); /* __SPRINTF_CHECKED__ */ @@ -1783,11 +1783,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, safe_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, safe_strlen (tmp)); + safe_strncat (buf, len, tmp, mutt_strlen (tmp)); break; case 'P': snprintf (tmp, sizeof (tmp), "%c", MsgIdPfx); @@ -1796,11 +1796,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, safe_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, safe_strlen (tmp)); + safe_strncat (buf, len, tmp, mutt_strlen (tmp)); break; case 's': snprintf (tmp, sizeof (tmp), "%02d", tm->tm_sec); @@ -1808,11 +1808,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, safe_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, safe_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 ;-) */ @@ -1845,7 +1845,7 @@ char *mutt_gen_msgid (void) if (!(fqdn = mutt_fqdn (0))) fqdn = NONULL (Hostname); - localpart_length = sizeof (buf) - safe_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); @@ -2170,9 +2170,9 @@ int mutt_invoke_mta (ADDRESS * from, /* the sender */ string. */ char *mutt_append_string (char *a, const char *b) { - size_t la = safe_strlen (a); + size_t la = mutt_strlen (a); - safe_realloc (&a, la + safe_strlen (b) + 1); + safe_realloc (&a, la + mutt_strlen (b) + 1); strcpy (a + la, b); /* __STRCPY_CHECKED__ */ return (a); } @@ -2200,7 +2200,7 @@ char *mutt_quote_string (const char *s) char *r, *pr; size_t rlen; - rlen = safe_strlen (s) + 3; + rlen = mutt_strlen (s) + 3; pr = r = (char *) safe_malloc (rlen); *pr++ = '"'; while (*s) { diff --git a/sidebar.c b/sidebar.c index c75b54f..00145ee 100644 --- a/sidebar.c +++ b/sidebar.c @@ -64,7 +64,7 @@ static char *shortened_hierarchy (char *box, int maxlen) { int dots = 0; char *last_dot = NULL; - int i, j, len = safe_strlen (box); + int i, j, len = mutt_strlen (box); char *new_box; if (!SidebarBoundary || !*SidebarBoundary) @@ -85,7 +85,7 @@ static char *shortened_hierarchy (char *box, int maxlen) if (strchr (SidebarBoundary, box[i])) { new_box[j++] = box[i]; new_box[j] = 0; - if (&box[i + 1] != last_dot || j + safe_strlen (last_dot) > maxlen) { + if (&box[i + 1] != last_dot || j + mutt_strlen (last_dot) > maxlen) { new_box[j++] = box[i + 1]; new_box[j] = 0; } else { @@ -155,7 +155,7 @@ int make_sidebar_entry (char* box, int idx, size_t len) int shortened = 0, lencnt = 0; char no[SHORT_STRING], entry[SHORT_STRING]; #if USE_IMAP - int l = safe_strlen (ImapHomeNamespace); + int l = mutt_strlen (ImapHomeNamespace); #endif if (SidebarWidth > COLS) @@ -170,24 +170,24 @@ int make_sidebar_entry (char* box, int idx, size_t len) mutt_FormatString (no, len, NONULL (SidebarNumberFormat), sidebar_number_format, idx, M_FORMAT_OPTIONAL); - lencnt = safe_strlen (no); + lencnt = mutt_strlen (no); memset (&entry, ' ', sizeof (entry)); #if USE_IMAP if (l > 0 && safe_strncmp (box, ImapHomeNamespace, l) == 0 && - safe_strlen (box) > l) + mutt_strlen (box) > l) box += l + 1; else #endif box = basename (box); - if (option (OPTSHORTENHIERARCHY) && safe_strlen (box) > len-lencnt-1) { + if (option (OPTSHORTENHIERARCHY) && mutt_strlen (box) > len-lencnt-1) { box = shortened_hierarchy (box, len-lencnt-1); shortened = 1; } snprintf (entry, len-lencnt, "%s", box); - entry[safe_strlen (entry)] = ' '; + entry[mutt_strlen (entry)] = ' '; strncpy (entry + (len - lencnt), no, lencnt); addnstr (entry, len); @@ -237,7 +237,7 @@ int sidebar_draw (int menu) int lines = option (OPTHELP) ? 1 : 0, draw_devider = 1, i = 0; BUFFY *tmp; - short delim_len = safe_strlen (SidebarDelim); + short delim_len = mutt_strlen (SidebarDelim); char blank[SHORT_STRING]; /* initialize first time */ @@ -266,7 +266,7 @@ int sidebar_draw (int menu) } if (SidebarWidth > 0 && option (OPTMBOXPANE) - && safe_strlen (SidebarDelim) >= SidebarWidth) { + && mutt_strlen (SidebarDelim) >= SidebarWidth) { mutt_error (_("Value for sidebar_delim is too long. Disabling sidebar.")); sleep (2); unset_option (OPTMBOXPANE); @@ -285,9 +285,9 @@ int sidebar_draw (int menu) move (lines, SidebarWidth - delim_len); if (option (OPTASCIICHARS)) addstr (NONULL (SidebarDelim)); - else if (!option (OPTASCIICHARS) && !safe_strcmp (SidebarDelim, "|")) + else if (!option (OPTASCIICHARS) && !mutt_strcmp (SidebarDelim, "|")) addch (ACS_VLINE); - else if ((Charset_is_utf8) && !safe_strcmp (SidebarDelim, "|")) + else if ((Charset_is_utf8) && !mutt_strcmp (SidebarDelim, "|")) addstr ("\342\224\202"); else addstr (NONULL (SidebarDelim)); diff --git a/smime.c b/smime.c index 6928585..aac48f4 100644 --- a/smime.c +++ b/smime.c @@ -486,8 +486,8 @@ char *smime_get_field_from_db (char *mailbox, char *query, short public, if (!mailbox && !query) return (NULL); - addr_len = mailbox ? safe_strlen (mailbox) : 0; - query_len = query ? safe_strlen (query) : 0; + addr_len = mailbox ? mutt_strlen (mailbox) : 0; + query_len = query ? mutt_strlen (query) : 0; *key = '\0'; @@ -646,7 +646,7 @@ void _smime_getkeys (char *mailbox) if (k) { /* the key used last time. */ if (*SmimeKeyToUse && - !safe_strcasecmp (k, SmimeKeyToUse + safe_strlen (SmimeKeys) + 1)) { + !safe_strcasecmp (k, SmimeKeyToUse + mutt_strlen (SmimeKeys) + 1)) { FREE (&k); return; } @@ -668,7 +668,7 @@ void _smime_getkeys (char *mailbox) if (*SmimeKeyToUse) { if (!safe_strcasecmp (SmimeDefaultKey, - SmimeKeyToUse + safe_strlen (SmimeKeys) + 1)) + SmimeKeyToUse + mutt_strlen (SmimeKeys) + 1)) return; smime_void_passphrase (); @@ -770,10 +770,10 @@ char *smime_findKeys (ADDRESS * to, ADDRESS * cc, ADDRESS * bcc) return NULL; } - keylist_size += safe_strlen (keyID) + 2; + keylist_size += mutt_strlen (keyID) + 2; safe_realloc (&keylist, keylist_size); sprintf (keylist + keylist_used, "%s\n", keyID); /* __SPRINTF_CHECKED__ */ - keylist_used = safe_strlen (keylist); + keylist_used = mutt_strlen (keylist); rfc822_free_address (&addr); @@ -830,8 +830,8 @@ static int smime_handle_cert_email (char *certificate, char *mailbox, while ((fgets (email, sizeof (email), fpout))) { - *(email + safe_strlen (email) - 1) = '\0'; - if (safe_strncasecmp (email, mailbox, safe_strlen (mailbox)) == 0) + *(email + mutt_strlen (email) - 1) = '\0'; + if (safe_strncasecmp (email, mailbox, mutt_strlen (mailbox)) == 0) ret = 1; ret = ret < 0 ? 0 : ret; @@ -857,9 +857,9 @@ static int smime_handle_cert_email (char *certificate, char *mailbox, rewind (fpout); while ((fgets (email, sizeof (email), fpout))) { - *(email + safe_strlen (email) - 1) = '\0'; - (*buffer)[count] = safe_calloc (1, safe_strlen (email) + 1); - strncpy ((*buffer)[count], email, safe_strlen (email)); + *(email + mutt_strlen (email) - 1) = '\0'; + (*buffer)[count] = safe_calloc (1, mutt_strlen (email) + 1); + strncpy ((*buffer)[count], email, mutt_strlen (email)); count++; } } @@ -1239,7 +1239,7 @@ BODY *smime_build_smime_entity (BODY * a, char *certlist) *certfile = '\0'; while (1) { - int off = safe_strlen (certfile); + int off = mutt_strlen (certfile); while (*++cert_end && *cert_end != '\n'); if (!*cert_end) @@ -1727,7 +1727,7 @@ static BODY *smime_handle_entity (BODY * m, STATE * s, FILE * outFile) } } while (fgets (buf, sizeof (buf) - 1, smimeout) != NULL) { - len = safe_strlen (buf); + len = mutt_strlen (buf); if (len > 1 && buf[len - 2] == '\r') { buf[len - 2] = '\n'; buf[len - 1] = '\0'; @@ -1915,7 +1915,7 @@ int smime_send_menu (HEADER * msg, int *redraw) case 4: /* sign (a)s */ if ((p = smime_ask_for_key (_("Sign as: "), NULL, 0))) { - p[safe_strlen (p) - 1] = '\0'; + p[mutt_strlen (p) - 1] = '\0'; str_replace (&SmimeDefaultKey, p); msg->security |= SIGN; diff --git a/snprintf.c b/snprintf.c index 2ec459b..036d904 100644 --- a/snprintf.c +++ b/snprintf.c @@ -402,7 +402,7 @@ static void fmtstr (char *buffer, size_t * currlen, size_t maxlen, value = ""; } - for (strln = 0; value[strln]; ++strln); /* safe_strlen */ + for (strln = 0; value[strln]; ++strln); /* mutt_strlen */ padlen = min - strln; if (padlen < 0) padlen = 0; @@ -689,7 +689,7 @@ int vsnprintf (char *str, size_t count, const char *fmt, va_list args) { str[0] = 0; dopr (str, count, fmt, args); - return (safe_strlen (str)); + return (mutt_strlen (str)); } #endif /* !HAVE_VSNPRINTF */ @@ -717,7 +717,7 @@ int snprintf (va_alist) (void) vsnprintf (str, count, fmt, ap); VA_END; - return (safe_strlen (str)); + return (mutt_strlen (str)); } #ifdef TEST_SNPRINTF @@ -768,7 +768,7 @@ int main (void) for (y = 0; fp_nums[y] != 0; y++) { snprintf (buf1, sizeof (buf1), fp_fmt[x], fp_nums[y]); sprintf (buf2, fp_fmt[x], fp_nums[y]); - if (safe_strcmp (buf1, buf2)) { + if (mutt_strcmp (buf1, buf2)) { printf ("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf = %s\n", /* __SPRINTF_CHECKED__ */ fp_fmt[x], buf1, buf2); fail++; @@ -780,7 +780,7 @@ int main (void) for (y = 0; int_nums[y] != 0; y++) { snprintf (buf1, sizeof (buf1), int_fmt[x], int_nums[y]); sprintf (buf2, int_fmt[x], int_nums[y]); - if (safe_strcmp (buf1, buf2)) { + if (mutt_strcmp (buf1, buf2)) { printf ("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf = %s\n", /* __SPRINTF_CHECKED__ */ int_fmt[x], buf1, buf2); fail++; diff --git a/sort.c b/sort.c index 20bc777..6235cc6 100644 --- a/sort.c +++ b/sort.c @@ -213,13 +213,13 @@ int compare_spam (const void *a, const void *b) /* If either aptr or bptr is equal to data, there is no numeric */ /* value for that spam attribute. In this case, compare lexically. */ if ((aptr == (*ppa)->env->spam->data) || (bptr == (*ppb)->env->spam->data)) - return (SORTCODE (safe_strcmp (aptr, bptr))); + return (SORTCODE (mutt_strcmp (aptr, bptr))); /* Otherwise, we have numeric value for both attrs. If these values */ /* are equal, then we first fall back upon string comparison, then */ /* upon auxiliary sort. */ if (result == 0) { - result = safe_strcmp (aptr, bptr); + result = mutt_strcmp (aptr, bptr); if (result == 0) AUXSORT (result, a, b); } diff --git a/status.c b/status.c index 64b6017..a6ba54b 100644 --- a/status.c +++ b/status.c @@ -241,7 +241,7 @@ static const char *status_format_str (char *buf, size_t buflen, char op, if (!StChars) buf[0] = 0; - else if (i >= safe_strlen (StChars)) + else if (i >= mutt_strlen (StChars)) buf[0] = StChars[0]; else buf[0] = StChars[i]; diff --git a/thread.c b/thread.c index 814e00e..e019533 100644 --- a/thread.c +++ b/thread.c @@ -338,7 +338,7 @@ static LIST *make_subject_list (THREAD * cur, time_t * dateptr) ((env->real_subj != env->subject) || (!option (OPTSORTRE)))) { for (curlist = subjects, oldlist = NULL; curlist; oldlist = curlist, curlist = curlist->next) { - rc = safe_strcmp (env->real_subj, curlist->data); + rc = mutt_strcmp (env->real_subj, curlist->data); if (rc >= 0) break; } @@ -398,7 +398,7 @@ static THREAD *find_subject (CONTEXT * ctx, THREAD * cur) (last->message->received < tmp->message->received) : (last->message->date_sent < tmp->message->date_sent))) && tmp->message->env->real_subj && - safe_strcmp (subjects->data, tmp->message->env->real_subj) == 0) + mutt_strcmp (subjects->data, tmp->message->env->real_subj) == 0) last = tmp; /* best match so far */ } @@ -471,7 +471,7 @@ static void pseudo_threads (CONTEXT * ctx) * parent, since otherwise they rightly belong to the message * we're attaching. */ if (tmp == cur - || !safe_strcmp (tmp->message->env->real_subj, + || !mutt_strcmp (tmp->message->env->real_subj, parent->message->env->real_subj)) { tmp->message->subject_changed = 0; @@ -669,7 +669,7 @@ static void check_subjects (CONTEXT * ctx, int init) if (!tmp) cur->subject_changed = 1; else if (cur->env->real_subj && tmp->message->env->real_subj) - cur->subject_changed = safe_strcmp (cur->env->real_subj, + cur->subject_changed = mutt_strcmp (cur->env->real_subj, tmp->message->env-> real_subj) ? 1 : 0; else @@ -821,7 +821,7 @@ void mutt_sort_threads (CONTEXT * ctx, int init) if (!cur->env->references) ref = ref->next; else { - if (safe_strcmp (ref->data, cur->env->references->data)) + if (mutt_strcmp (ref->data, cur->env->references->data)) ref = cur->env->references; else ref = cur->env->references->next; diff --git a/url.c b/url.c index d9cc4de..35cb0c1 100644 --- a/url.c +++ b/url.c @@ -172,7 +172,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 = safe_strlen (dest)); + len -= (l = mutt_strlen (dest)); dest += l; if (ciss->user) { @@ -181,7 +181,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 = safe_strlen (dest)); + len -= (l = mutt_strlen (dest)); dest += l; } @@ -238,7 +238,7 @@ int url_parse_mailto (ENVELOPE * e, char **body, const char *src) } else { #define SAFEPFX (option (OPTSTRICTMAILTO) ? "" : "X-Mailto-") - taglen = safe_strlen (tag) + safe_strlen (SAFEPFX); + taglen = mutt_strlen (tag) + mutt_strlen (SAFEPFX); /* mutt_parse_rfc822_line makes some assumptions */ snprintf (scratch, sizeof (scratch), "%s%s: %s", SAFEPFX, tag, value); #undef SAVEPFX -- 2.20.1