From 688ac22f746f785c27ac99ac86aa85a3035a3638 Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Fri, 1 Dec 2006 01:41:02 +0100 Subject: [PATCH] more documentation. Signed-off-by: Pierre Habouzit --- account.c | 4 +-- alias.c | 6 ++-- apidoc/.gitignore | 1 + apidoc/doxygen.cfg.in | 6 ++-- attach.c | 2 +- browser.c | 10 +++---- charset.c | 16 +++++----- commands.c | 8 ++--- compose.c | 6 ++-- copy.c | 8 ++--- globals.h | 2 +- handler.c | 2 +- help.c | 6 ++-- imap/auth_login.c | 2 +- imap/browse.c | 2 +- imap/message.c | 2 +- imap/util.c | 6 ++-- init.c | 2 +- keymap.c | 4 +-- lib-crypt/crypt-gpgme.c | 10 +++---- lib-crypt/pgp.c | 2 +- lib-crypt/pgpinvoke.c | 2 +- lib-crypt/pgpkey.c | 6 ++-- lib-lib/str.c | 29 ++++++++++++++++-- lib-lib/str.h | 47 ++++++++++++++++++++++------- lib-mime/rfc1524.c | 2 +- lib-mime/rfc2047.c | 2 +- lib-mime/rfc822parse.c | 6 ++-- lib-mx/compress.c | 2 +- lib-mx/mx.c | 8 ++--- lib-sys/mutt_ssl.c | 24 +++++++-------- lib-sys/mutt_ssl_gnutls.c | 62 +++++++++++++++++++-------------------- lib-ui/color.c | 2 +- lib-ui/curs_lib.c | 2 +- lib-ui/curs_main.c | 2 +- lib-ui/curses.h | 2 +- lib-ui/hdrline.c | 4 +-- lib-ui/menu.c | 4 +-- lib-ui/query.c | 4 +-- lib-ui/sidebar.c | 6 ++-- lib-ui/status.c | 2 +- mutt_sasl.c | 4 +-- muttlib.c | 4 +-- nntp/newsrc.c | 2 +- nntp/nntp.c | 4 +-- pager.c | 4 +-- pop/pop.c | 2 +- postpone.c | 2 +- recvattach.c | 10 +++---- recvcmd.c | 4 +-- remailer.c | 2 +- sendlib.c | 12 ++++---- state.c | 2 +- 53 files changed, 213 insertions(+), 164 deletions(-) diff --git a/account.c b/account.c index 7838827..17234fb 100644 --- a/account.c +++ b/account.c @@ -124,7 +124,7 @@ void mutt_account_tourl (ACCOUNT * account, ciss_url_t * url) /* mutt_account_getuser: retrieve username into ACCOUNT, if necessary */ int mutt_account_getuser (ACCOUNT * account) { - char prompt[SHORT_STRING]; + char prompt[STRING]; /* already set */ if (account->flags & M_ACCT_USER) @@ -177,7 +177,7 @@ int mutt_account_getlogin (ACCOUNT* account) /* mutt_account_getpass: fetch password into ACCOUNT, if neccessary */ int mutt_account_getpass (ACCOUNT * account) { - char prompt[SHORT_STRING]; + char prompt[STRING]; if (account->flags & M_ACCT_PASS) return 0; diff --git a/alias.c b/alias.c index c511fd7..84eda4d 100644 --- a/alias.c +++ b/alias.c @@ -197,7 +197,7 @@ static void write_safe_address(FILE *fp, const char *s) void mutt_create_alias(ENVELOPE *cur, address_t *iadr) { - char buf[LONG_STRING], prompt[SHORT_STRING]; + char buf[LONG_STRING], prompt[STRING]; address_t *adr = iadr; alias_t *new; FILE *rc; @@ -485,7 +485,7 @@ static const format_t *alias_format_str (char *dest, size_t destlen, char op, const char *elsestring __attribute__ ((unused)), unsigned long data, format_flag flags __attribute__ ((unused))) { - char tmp[SHORT_STRING], adr[SHORT_STRING]; + char tmp[STRING], adr[STRING]; alias_t *alias = (alias_t *) data; switch (op) { @@ -572,7 +572,7 @@ void mutt_alias_menu (char *buf, size_t buflen, alias_t * aliases) int t = -1; int i, done = 0; int op; - char helpstr[SHORT_STRING]; + char helpstr[STRING]; int omax; diff --git a/apidoc/.gitignore b/apidoc/.gitignore index 7a5b131..fd9e632 100644 --- a/apidoc/.gitignore +++ b/apidoc/.gitignore @@ -1,3 +1,4 @@ doxygen.cfg html latex +man diff --git a/apidoc/doxygen.cfg.in b/apidoc/doxygen.cfg.in index dcdc632..9c328db 100644 --- a/apidoc/doxygen.cfg.in +++ b/apidoc/doxygen.cfg.in @@ -238,7 +238,7 @@ EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. -EXTRACT_STATIC = NO +EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. @@ -387,7 +387,7 @@ SHOW_USED_FILES = NO # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. -SHOW_DIRECTORIES = NO +SHOW_DIRECTORIES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from the @@ -557,7 +557,7 @@ FILTER_SOURCE_FILES = NO # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. -SOURCE_BROWSER = NO +SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. diff --git a/attach.c b/attach.c index 8077ecf..99b1aa9 100644 --- a/attach.c +++ b/attach.c @@ -320,7 +320,7 @@ void mutt_check_lookup_list (BODY * b, char *type, int len) int mutt_is_autoview (BODY * b, const char *type) { string_list_t *t = AutoViewList; - char _type[SHORT_STRING]; + char _type[STRING]; int i; if (!type) diff --git a/browser.c b/browser.c index 43b1b34..fd92753 100644 --- a/browser.c +++ b/browser.c @@ -151,7 +151,7 @@ static const char *folder_format_str (char *dest, ssize_t destlen, char op, const char *elsestring, unsigned long data, format_flag flags) { - char fn[SHORT_STRING], tmp[SHORT_STRING], permission[11], date[16]; + char fn[STRING], tmp[STRING], permission[11], date[16]; const char *t_fmt; time_t tnow; FOLDER *folder = (FOLDER *) data; @@ -316,7 +316,7 @@ static const char *newsgroup_format_str (char *dest, ssize_t destlen, char op, unsigned long data, format_flag flags) { - char fn[SHORT_STRING], tmp[SHORT_STRING]; + char fn[STRING], tmp[STRING]; FOLDER *folder = (FOLDER *) data; switch (op) { @@ -480,7 +480,7 @@ static int examine_directory (MUTTMENU * menu, struct browser_state *state, struct stat s; DIR *dp; struct dirent *de; - char buffer[_POSIX_PATH_MAX + SHORT_STRING]; + char buffer[_POSIX_PATH_MAX + STRING]; int i = -1; while (stat (d, &s) == -1) { @@ -717,7 +717,7 @@ void _mutt_select_file (char *f, ssize_t flen, int flags, char ***files, { char buf[_POSIX_PATH_MAX]; char prefix[_POSIX_PATH_MAX] = ""; - char helpstr[SHORT_STRING]; + char helpstr[STRING]; char title[STRING]; struct browser_state state; MUTTMENU *menu; @@ -1054,7 +1054,7 @@ void _mutt_select_file (char *f, ssize_t flen, int flags, char ***files, if (!state.entry[menu->current].imap) mutt_error (_("Delete is only supported for IMAP mailboxes")); else { - char msg[SHORT_STRING]; + char msg[STRING]; IMAP_MBOX mx; int nentry = menu->current; diff --git a/charset.c b/charset.c index 89d5d74..11441e4 100644 --- a/charset.c +++ b/charset.c @@ -50,8 +50,8 @@ wchar_t CharsetReplacement = '?'; void charset_initialize(void) { #ifdef HAVE_LANGINFO_CODESET - char buff[SHORT_STRING]; - char buff2[SHORT_STRING]; + char buff[STRING]; + char buff2[STRING]; m_strcpy(buff, sizeof(buff), nl_langinfo(CODESET)); charset_canonicalize(buff2, sizeof(buff2), buff); @@ -77,7 +77,7 @@ void charset_initialize(void) void charset_canonicalize(char *dest, ssize_t dlen, const char *name) { const struct cset_pair *cp; - char scratch[SHORT_STRING]; + char scratch[STRING]; const char *p; int i = 0; @@ -106,7 +106,7 @@ void charset_canonicalize(char *dest, ssize_t dlen, const char *name) /* XXX: MC: UGLY return of local static */ const char *charset_getfirst(const char *charset) { - static char fcharset[SHORT_STRING]; + static char fcharset[STRING]; const char *p; if (m_strisempty(charset)) @@ -119,14 +119,14 @@ const char *charset_getfirst(const char *charset) int charset_is_utf8(const char *s) { - char buf[SHORT_STRING]; + char buf[STRING]; charset_canonicalize(buf, sizeof(buf), s); return !m_strcmp(buf, "utf-8"); } int charset_is_us_ascii(const char *s) { - char buf[SHORT_STRING]; + char buf[STRING]; charset_canonicalize(buf, sizeof(buf), s); return !m_strcmp(buf, "us-ascii"); } @@ -139,8 +139,8 @@ int charset_is_us_ascii(const char *s) /* Like iconv_open, but canonicalises the charsets */ iconv_t mutt_iconv_open(const char *tocode, const char *fromcode, int flags) { - char tocode1[SHORT_STRING]; - char fromcode1[SHORT_STRING]; + char tocode1[STRING]; + char fromcode1[STRING]; const char *tmp; iconv_t cd; diff --git a/commands.c b/commands.c index 82bc240..6f9a0d3 100644 --- a/commands.c +++ b/commands.c @@ -207,7 +207,7 @@ int mutt_display_message (HEADER * cur) void ci_bounce_message (HEADER * h, int *redraw) { - char prompt[SHORT_STRING]; + char prompt[STRING]; char buf[HUGE_STRING] = { 0 }; address_t *adr = NULL; char *err = NULL; @@ -534,7 +534,7 @@ void mutt_shell_escape (void) void mutt_enter_command (void) { BUFFER err, token; - char buffer[LONG_STRING], errbuf[SHORT_STRING]; + char buffer[LONG_STRING], errbuf[STRING]; int r; buffer[0] = 0; @@ -560,7 +560,7 @@ void mutt_enter_command (void) void mutt_display_address (ENVELOPE * env) { const char *pfx = NULL; - char buf[SHORT_STRING]; + char buf[STRING]; address_t *adr = NULL; adr = mutt_get_address(env, &pfx); @@ -641,7 +641,7 @@ int mutt_save_message (HEADER * h, int delete, int decode, int decrypt, int *redraw) { int i, need_buffy_cleanup; int need_passphrase = 0, app = 0; - char prompt[SHORT_STRING], buf[_POSIX_PATH_MAX]; + char prompt[STRING], buf[_POSIX_PATH_MAX]; CONTEXT ctx; struct stat st; struct utimbuf ut; diff --git a/compose.c b/compose.c index 630c6c9..ec7ac1b 100644 --- a/compose.c +++ b/compose.c @@ -201,7 +201,7 @@ static int check_attachments (ATTACHPTR ** idx, short idxlen) { int i, r; struct stat st; - char pretty[_POSIX_PATH_MAX], msg[_POSIX_PATH_MAX + SHORT_STRING]; + char pretty[_POSIX_PATH_MAX], msg[_POSIX_PATH_MAX + STRING]; for (i = 0; i < idxlen; i++) { m_strcpy(pretty, sizeof(pretty), idx[i]->content->filename); @@ -414,7 +414,7 @@ static const char *compose_format_str (char *buf, ssize_t buflen, char op, const char *elsestring, unsigned long data, format_flag flags) { - char fmt[SHORT_STRING], tmp[SHORT_STRING]; + char fmt[STRING], tmp[STRING]; int optional = (flags & M_FORMAT_OPTIONAL); MUTTMENU *menu = (MUTTMENU *) data; @@ -476,7 +476,7 @@ int mutt_compose_menu (HEADER * msg, /* structure for new message */ ssize_t fcclen, HEADER * cur __attribute__ ((unused))) { /* current message */ - char helpstr[SHORT_STRING]; + char helpstr[STRING]; char buf[LONG_STRING]; char fname[_POSIX_PATH_MAX]; MUTTMENU *menu; diff --git a/copy.c b/copy.c index 3a8cdfb..55a3f4f 100644 --- a/copy.c +++ b/copy.c @@ -318,7 +318,7 @@ int mutt_copy_header (FILE * in, HEADER * h, FILE * out, int flags, const char *prefix) { - char buffer[SHORT_STRING]; + char buffer[STRING]; if (h->env) flags |= (h->env->irt_changed ? CH_UPDATE_IRT : 0) | @@ -329,7 +329,7 @@ mutt_copy_header (FILE * in, HEADER * h, FILE * out, int flags, return (-1); if (flags & CH_TXTPLAIN) { - char chsbuf[SHORT_STRING]; + char chsbuf[STRING]; fputs ("MIME-Version: 1.0\n", out); fputs ("Content-Transfer-Encoding: 8bit\n", out); @@ -494,7 +494,7 @@ int _mutt_copy_message (FILE * fpout, FILE * fpin, HEADER * hdr, BODY * body, int flags, int chflags) { - char prefix[SHORT_STRING]; + char prefix[STRING]; STATE s; off_t new_offset = -1; int rc = 0; @@ -514,7 +514,7 @@ _mutt_copy_message (FILE * fpout, FILE * fpin, HEADER * hdr, BODY * body, else if (hdr->attach_del && (chflags & CH_UPDATE_LEN)) { int new_lines; off_t new_length = body->length; - char date[SHORT_STRING]; + char date[STRING]; mutt_make_date (date, sizeof (date)); date[5] = date[m_strlen(date) - 1] = '\"'; diff --git a/globals.h b/globals.h index d2292e3..3e4e9f8 100644 --- a/globals.h +++ b/globals.h @@ -19,7 +19,7 @@ WHERE CONTEXT *Context; WHERE char Errorbuf[STRING]; WHERE char AttachmentMarker[STRING]; -WHERE char Quotebuf[SHORT_STRING]; +WHERE char Quotebuf[STRING]; WHERE char *MuttDotlock; diff --git a/handler.c b/handler.c index 3d52250..27bfb08 100644 --- a/handler.c +++ b/handler.c @@ -277,7 +277,7 @@ static unsigned char decode_byte(int ch) static void mutt_decode_uuencoded (STATE * s, long len, int istext, iconv_t cd) { - char tmps[SHORT_STRING]; + char tmps[STRING]; char linelen, c, l, out; char *pt; char bufi[BUFI_SIZE]; diff --git a/help.c b/help.c index 407b7a4..1162b23 100644 --- a/help.c +++ b/help.c @@ -41,7 +41,7 @@ static struct binding_t *help_lookupFunction (int op, int menu) void mutt_make_help (char *d, ssize_t dlen, char *txt, int menu, int op) { - char buf[SHORT_STRING]; + char buf[STRING]; if (km_expand_key (buf, sizeof (buf), km_find_func (menu, op)) || km_expand_key (buf, sizeof (buf), km_find_func (MENU_GENERIC, op))) @@ -226,7 +226,7 @@ static void dump_menu (FILE * f, int menu) { struct keymap_t *map; struct binding_t *b; - char buf[SHORT_STRING]; + char buf[STRING]; /* browse through the keymap table */ for (map = Keymaps[menu]; map; map = map->next) { @@ -273,7 +273,7 @@ static void dump_unbound (FILE * f, void mutt_help (int menu) { char tmp[_POSIX_PATH_MAX]; - char buf[SHORT_STRING]; + char buf[STRING]; const char *desc; FILE *f; struct binding_t *funcs; diff --git a/imap/auth_login.c b/imap/auth_login.c index cb3f5bb..023c654 100644 --- a/imap/auth_login.c +++ b/imap/auth_login.c @@ -18,7 +18,7 @@ /* imap_auth_login: Plain LOGIN support */ imap_auth_res_t imap_auth_login(IMAP_DATA *idata, const char *method __attribute__ ((unused))) { - char q_user[SHORT_STRING], q_pass[SHORT_STRING]; + char q_user[STRING], q_pass[STRING]; char buf[STRING]; int rc; diff --git a/imap/browse.c b/imap/browse.c index a3807b6..4f4bee0 100644 --- a/imap/browse.c +++ b/imap/browse.c @@ -276,7 +276,7 @@ int imap_mailbox_rename (const char *mailbox) IMAP_DATA *idata; IMAP_MBOX mx; char buf[LONG_STRING]; - char newname[SHORT_STRING]; + char newname[STRING]; if (imap_parse_path (mailbox, &mx) < 0) { return -1; diff --git a/imap/message.c b/imap/message.c index a2debe7..bbd7f7b 100644 --- a/imap/message.c +++ b/imap/message.c @@ -969,7 +969,7 @@ static int msg_has_flag (string_list_t * flag_list, const char *flag) /* msg_parse_fetch: handle headers returned from header fetch */ static int msg_parse_fetch (IMAP_HEADER * h, char *s) { - char tmp[SHORT_STRING]; + char tmp[STRING]; char *ptmp; if (!s) diff --git a/imap/util.c b/imap/util.c index fb4c503..3f14b78 100644 --- a/imap/util.c +++ b/imap/util.c @@ -408,12 +408,12 @@ void imap_unmunge_mbox_name (char *s) /* imap_wordcasecmp: find word a in word list b */ int imap_wordcasecmp (const char *a, const char *b) { - char tmp[SHORT_STRING]; + char tmp[STRING]; char *s = (char *) b; int i; - tmp[SHORT_STRING - 1] = 0; - for (i = 0; i < SHORT_STRING - 2; i++, s++) { + tmp[STRING - 1] = 0; + for (i = 0; i < STRING - 2; i++, s++) { if (!*s || ISSPACE (*s)) { tmp[i] = 0; break; diff --git a/init.c b/init.c index 572663c..e40c937 100644 --- a/init.c +++ b/init.c @@ -2405,7 +2405,7 @@ int mutt_query_variables (string_list_t * queries) static int mutt_execute_commands (string_list_t * p) { BUFFER err, token; - char errstr[SHORT_STRING]; + char errstr[STRING]; p_clear(&err, 1); err.data = errstr; diff --git a/keymap.c b/keymap.c index 2c5bebe..5c9b9a6 100644 --- a/keymap.c +++ b/keymap.c @@ -113,7 +113,7 @@ static int parse_keycode (const char *s) static int parsekeys (const char *str, keycode_t * d, int max) { int n, len = max; - char buff[SHORT_STRING]; + char buff[STRING]; char c; char *s, *t; @@ -596,7 +596,7 @@ void km_init (void) void km_error_key (int menu) { - char buf[SHORT_STRING]; + char buf[STRING]; struct keymap_t *key; if (!(key = km_find_func (menu, OP_HELP))) diff --git a/lib-crypt/crypt-gpgme.c b/lib-crypt/crypt-gpgme.c index 9790164..e295042 100644 --- a/lib-crypt/crypt-gpgme.c +++ b/lib-crypt/crypt-gpgme.c @@ -2150,7 +2150,7 @@ crypt_entry_fmt (char *dest, ssize_t destlen, char op, case '[': { const char *cp; - char buf2[SHORT_STRING], *p; + char buf2[STRING], *p; int do_locales; struct tm *tm; ssize_t len; @@ -2701,7 +2701,7 @@ static void print_key_info (gpgme_key_t key, FILE * fp) const char *s = NULL, *s2 = NULL; time_t tt = 0; struct tm *tm; - char shortbuf[SHORT_STRING]; + char shortbuf[STRING]; unsigned long aval = 0; const char *delim; int is_pgp = 0; @@ -3203,7 +3203,7 @@ static crypt_key_t *crypt_select_key (crypt_key_t * keys, crypt_key_t **key_table; MUTTMENU *menu; int i, done = 0; - char helpstr[SHORT_STRING], buf[LONG_STRING]; + char helpstr[STRING], buf[LONG_STRING]; crypt_key_t *k; int (*f) (const void *, const void *); int menu_to_use = 0; @@ -3563,7 +3563,7 @@ static crypt_key_t *crypt_ask_for_key (char *tag, unsigned int app, int *forced_valid) { crypt_key_t *key; - char resp[SHORT_STRING]; + char resp[STRING]; struct crypt_cache *l = NULL; int dummy; @@ -3755,7 +3755,7 @@ void smime_gpgme_init (void) static int gpgme_send_menu (HEADER * msg, int *redraw, int is_smime) { crypt_key_t *p; - char input_signas[SHORT_STRING]; + char input_signas[STRING]; int choice; if (msg->security & APPLICATION_PGP) diff --git a/lib-crypt/pgp.c b/lib-crypt/pgp.c index c58664c..08b8509 100644 --- a/lib-crypt/pgp.c +++ b/lib-crypt/pgp.c @@ -1386,7 +1386,7 @@ BODY *pgp_traditional_encryptsign (BODY * a, int flags, char *keylist) int pgp_send_menu (HEADER * msg, int *redraw) { pgp_key_t p; - char input_signas[SHORT_STRING]; + char input_signas[STRING]; char prompt[LONG_STRING]; diff --git a/lib-crypt/pgpinvoke.c b/lib-crypt/pgpinvoke.c index 551024a..10878d3 100644 --- a/lib-crypt/pgpinvoke.c +++ b/lib-crypt/pgpinvoke.c @@ -231,7 +231,7 @@ pid_t pgp_invoke_traditional (FILE ** pgpin, FILE ** pgpout, FILE ** pgperr, void pgp_invoke_import (const char *fname) { - char _fname[_POSIX_PATH_MAX + SHORT_STRING]; + char _fname[_POSIX_PATH_MAX + STRING]; char cmd[HUGE_STRING]; struct pgp_command_context cctx; diff --git a/lib-crypt/pgpkey.c b/lib-crypt/pgpkey.c index 033c0e8..e5d1796 100644 --- a/lib-crypt/pgpkey.c +++ b/lib-crypt/pgpkey.c @@ -125,7 +125,7 @@ pgp_entry_fmt (char *dest, ssize_t destlen, char op, { const char *cp; - char buf2[SHORT_STRING], *p; + char buf2[STRING], *p; int do_locales; struct tm *tm; ssize_t len; @@ -406,7 +406,7 @@ static pgp_key_t pgp_select_key (pgp_key_t keys, address_t * p, const char *s) pgp_uid_t **KeyTable; MUTTMENU *menu; int i, done = 0; - char helpstr[SHORT_STRING], buf[LONG_STRING], tmpbuf[STRING]; + char helpstr[STRING], buf[LONG_STRING], tmpbuf[STRING]; char cmd[LONG_STRING], tempfile[_POSIX_PATH_MAX]; FILE *fp, *devnull; pid_t thepid; @@ -617,7 +617,7 @@ pgp_key_t pgp_ask_for_key (char *tag, char *whatfor, short abilities, pgp_ring_t keyring) { pgp_key_t key; - char resp[SHORT_STRING]; + char resp[STRING]; struct pgp_cache *l = NULL; mutt_clear_error (); diff --git a/lib-lib/str.c b/lib-lib/str.c index 7b57305..e4616e6 100644 --- a/lib-lib/str.c +++ b/lib-lib/str.c @@ -17,8 +17,17 @@ * Copyright © 2006 Pierre Habouzit */ +/** \addtogroup mutt_strings */ +/*@{*/ + +/** \file str.c + * \brief Madmutt string API module implementation. + * \author Pierre Habouzit + */ + #include "lib-lib.h" +#ifndef _DOXYGEN_SKIP_ME #define XX 255 unsigned char const __m_strdigits[128] = { XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, @@ -66,13 +75,25 @@ char const __m_b36chars_upper[36] = { 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }; +#endif - +/** \brief safe strcpy. + * + * Copies at most n-1 characters from \c src into \c dst, always + * adding a final \c '\\0' in \c dst. + * + * \param[in] dst destination buffer. + * \param[in] n size of the buffer. Negative sizes are allowed. + * \param[in] src source string. + * + * \return \c src \e length. If this value is \>= \c n then the copy was + * truncated. + */ ssize_t m_strcpy(char *dst, ssize_t n, const char *src) { ssize_t len = m_strlen(src); - if (dst && n > 0) { + if (n > 0) { ssize_t dlen = MIN(n - 1, len); memcpy(dst, src, dlen); dst[dlen] = '\0'; @@ -85,7 +106,7 @@ ssize_t m_strncpy(char *dst, ssize_t n, const char *src, ssize_t l) { ssize_t len = MIN(m_strlen(src), l); - if (dst && n > 0) { + if (n > 0) { ssize_t dlen = MIN(n - 1, len); memcpy(dst, src, dlen); dst[dlen] = '\0'; @@ -178,3 +199,5 @@ int ascii_strncasecmp (const char *a, const char *b, ssize_t n) return 0; } + +/*@}*/ diff --git a/lib-lib/str.h b/lib-lib/str.h index 51eeba4..345c16c 100644 --- a/lib-lib/str.h +++ b/lib-lib/str.h @@ -24,12 +24,9 @@ #ifndef MUTT_LIB_LIB_STR_H #define MUTT_LIB_LIB_STR_H -/** \file str.h. - * \brief Madmutt string API. +/** \defgroup mutt_strings Madmutt string API * - * \author Pierre Habouzit - * - * This header contains the prefered string API to be used in Madmutt. + * This module contains the prefered string API to be used in Madmutt. * * Those function reimplement many usual calls (strlen, strcpy, strcat, …) * It's intended to provide a uniform and consistent API to deal with usual C @@ -40,14 +37,19 @@ * stupid semantics à la strncpy. * - function try to always work on buffers with its size (including the * ending \c '\\0') to prevent buffer overflows. - * - string and buffers sizes are ssize_t, negative values are allowed and + * - string and buffers sizes are \c ssize_t, negative values are allowed and * supported. * - functions use a à la sprintf semantics (for those that produce strings) * meaning that they all return the len that could have fit in the buffer * if it would have been big enough. We never try to reallocate the * buffers, it's up to the caller if it's needed. */ +/*@{*/ +/** \file str.h + * \brief Madmutt string API header. + * \author Pierre Habouzit + */ #define HUGE_STRING 5120 /**< \brief Huge buffers */ #define LONG_STRING 1024 /**< \brief Long buffers */ @@ -57,12 +59,30 @@ with emtpy strings */ #define ISSPACE(c) isspace((unsigned char)c) /**< \brief safe isspace */ - +/** \brief Convert ascii digits into ints. + * + * Convert ascii digits into its integer value in base 36. + * Non convertible values are converted to 255. + * + * Translating a digit \c c into its numerical value in base \c x is just doing: + * \code + * return (c & ~127) && __m_strdigits[c] < x ? __m_strdigits[c] : -1; + * \endcode + */ extern unsigned char const __m_strdigits[128]; +/** \brief Convert an ascii base64 digit into ints. + * + * Convert an a char base64 digit into its int value. + * Used by base64val(). Unlike #__m_strdigits, the invalid values are set to + * -1 instead of 255. + */ extern signed char const __m_b64digits[128]; -extern char const __m_b64chars[64]; +/** \brief Convert ints from 0–64 into the corresponding base64 digit. */ +extern char const __m_b64chars[64]; +/** \brief Convert ints from 0–36 into a base36 lowercase digit. */ extern char const __m_b36chars_lower[36]; +/** \brief Convert ints from 0–36 into a base36 uppercase digit. */ extern char const __m_b36chars_upper[36]; /****************************************************************************/ @@ -162,8 +182,11 @@ static inline ssize_t m_strputc(char *dst, ssize_t n, int c) { return 1; } -ssize_t m_strcpy(char *dst, ssize_t n, const char *src); -ssize_t m_strncpy(char *dst, ssize_t n, const char *src, ssize_t l); +ssize_t m_strcpy(char *dst, ssize_t n, const char *src) + __attribute__((nonnull(1))); + +ssize_t m_strncpy(char *dst, ssize_t n, const char *src, ssize_t l) + __attribute__((nonnull(1))); static inline ssize_t m_strcat(char *dst, ssize_t n, const char *src) { ssize_t dlen = m_strnlen(dst, n - 1); @@ -201,7 +224,8 @@ static inline char *vskipspaces(const char *s) { return (char *)skipspaces(s); } -char *m_strrtrim(char *s); +char *m_strrtrim(char *s) + __attribute__((nonnull(1))); /****************************************************************************/ /* search */ @@ -215,4 +239,5 @@ m_stristr(const char *haystack, const char *needle) { return m_stristrn(haystack, needle, m_strlen(needle)); } +/*@}*/ #endif /* MUTT_LIB_LIB_STR_H */ diff --git a/lib-mime/rfc1524.c b/lib-mime/rfc1524.c index 8705ace..5b6eb50 100644 --- a/lib-mime/rfc1524.c +++ b/lib-mime/rfc1524.c @@ -374,7 +374,7 @@ int rfc1524_mailcap_lookup (BODY * a, char *type, rfc1524_entry * entry, return 0; } - mutt_check_lookup_list (a, type, SHORT_STRING); + mutt_check_lookup_list (a, type, STRING); while (!found && *curr) { x = 0; diff --git a/lib-mime/rfc2047.c b/lib-mime/rfc2047.c index a4d3b19..7e45ce6 100644 --- a/lib-mime/rfc2047.c +++ b/lib-mime/rfc2047.c @@ -100,7 +100,7 @@ char *mutt_choose_charset(const char *fromcode, const char *charsets, const char *p = charsets; while (*p) { - char cset[SHORT_STRING]; + char cset[STRING]; const char *q; char *s; ssize_t slen, n; diff --git a/lib-mime/rfc822parse.c b/lib-mime/rfc822parse.c index 3897114..6aaae2f 100644 --- a/lib-mime/rfc822parse.c +++ b/lib-mime/rfc822parse.c @@ -300,7 +300,7 @@ void mutt_parse_content_type(char *s, BODY *ct) * field, so we can attempt to convert the type to BODY here. */ switch (ct->type) { - char buffer[SHORT_STRING]; + char buffer[STRING]; case TYPETEXT: ct->subtype = m_strdup("plain"); @@ -608,7 +608,7 @@ uncomment_timezone(char *buf, size_t buflen, const char *tz) time_t mutt_parse_date(const char *s, HEADER *h) { int zhours = 0, zminutes = 0, zoccident = 0; - char scratch[SHORT_STRING]; + char scratch[STRING]; struct tm tm; int count = 0; char *p; @@ -625,7 +625,7 @@ time_t mutt_parse_date(const char *s, HEADER *h) p_clear(&tm, 1); while ((p = strtok (p, " \t")) != NULL) { - char tzstr[SHORT_STRING]; + char tzstr[STRING]; const char *ptz; switch (count) { diff --git a/lib-mx/compress.c b/lib-mx/compress.c index e89d438..52978ac 100644 --- a/lib-mx/compress.c +++ b/lib-mx/compress.c @@ -142,7 +142,7 @@ static const char *compresshook_format_str (char *dest, ssize_t destlen, unsigned long data, format_flag flags __attribute__ ((unused))) { - char tmp[SHORT_STRING]; + char tmp[STRING]; CONTEXT *ctx = (CONTEXT *) data; diff --git a/lib-mx/mx.c b/lib-mx/mx.c index 1caefe5..96dab2c 100644 --- a/lib-mx/mx.c +++ b/lib-mx/mx.c @@ -61,8 +61,8 @@ static mx_t const *mxfmts[] = { static int invoke_dotlock (const char *path, int flags, int retry) { char cmd[LONG_STRING + _POSIX_PATH_MAX]; - char f[SHORT_STRING + _POSIX_PATH_MAX]; - char r[SHORT_STRING]; + char f[STRING + _POSIX_PATH_MAX]; + char r[STRING]; if (flags & DL_FL_RETRY) snprintf (r, sizeof (r), "-r %d ", retry ? MAXLOCKATTEMPT : 0); @@ -644,7 +644,7 @@ static int _mx_close_mailbox (CONTEXT * ctx, int *index_hint) int isSpool = 0; CONTEXT f; char mbox[_POSIX_PATH_MAX]; - char buf[SHORT_STRING]; + char buf[STRING]; if (!ctx) return 0; @@ -960,7 +960,7 @@ static int _mx_sync_mailbox (CONTEXT * ctx, int *index_hint) } if (ctx->deleted) { - char buf[SHORT_STRING]; + char buf[STRING]; snprintf (buf, sizeof (buf), ctx->deleted == 1 ? _("Purge %d deleted message?") : diff --git a/lib-sys/mutt_ssl.c b/lib-sys/mutt_ssl.c index 5d7c551..99998bb 100644 --- a/lib-sys/mutt_ssl.c +++ b/lib-sys/mutt_ssl.c @@ -395,7 +395,7 @@ static int tls_close (CONNECTION * conn) static char *x509_get_part (char *line, const char *ndx) { - static char ret[SHORT_STRING]; + static char ret[STRING]; char *c, *c2; m_strcpy(ret, sizeof(ret), _("Unknown")); @@ -525,8 +525,8 @@ static int check_certificate_by_digest (X509 * peercert) static int ssl_check_certificate (sslsockdata * data) { char *part[] = { "/CN=", "/Email=", "/O=", "/OU=", "/L=", "/ST=", "/C=" }; - char helpstr[SHORT_STRING]; - char buf[SHORT_STRING]; + char helpstr[STRING]; + char buf[STRING]; MUTTMENU *menu; int done, row, i; FILE *fp; @@ -551,42 +551,42 @@ static int ssl_check_certificate (sslsockdata * data) menu->max = 19; menu->dialog = p_new(char *, menu->max); for (i = 0; i < menu->max; i++) - menu->dialog[i] = p_new(char, SHORT_STRING); + menu->dialog[i] = p_new(char, STRING); row = 0; - m_strcpy(menu->dialog[row], SHORT_STRING, + m_strcpy(menu->dialog[row], STRING, _("This certificate belongs to:")); row++; name = X509_NAME_oneline (X509_get_subject_name (data->cert), buf, sizeof (buf)); for (i = 0; i < 5; i++) { c = x509_get_part (name, part[i]); - snprintf (menu->dialog[row++], SHORT_STRING, " %s", c); + snprintf (menu->dialog[row++], STRING, " %s", c); } row++; - m_strcpy(menu->dialog[row], SHORT_STRING, + m_strcpy(menu->dialog[row], STRING, _("This certificate was issued by:")); row++; name = X509_NAME_oneline (X509_get_issuer_name (data->cert), buf, sizeof (buf)); for (i = 0; i < 5; i++) { c = x509_get_part (name, part[i]); - snprintf (menu->dialog[row++], SHORT_STRING, " %s", c); + snprintf (menu->dialog[row++], STRING, " %s", c); } row++; - snprintf (menu->dialog[row++], SHORT_STRING, "%s", + snprintf (menu->dialog[row++], STRING, "%s", _("This certificate is valid")); - snprintf (menu->dialog[row++], SHORT_STRING, _(" from %s"), + snprintf (menu->dialog[row++], STRING, _(" from %s"), asn1time_to_string (X509_get_notBefore (data->cert))); - snprintf (menu->dialog[row++], SHORT_STRING, _(" to %s"), + snprintf (menu->dialog[row++], STRING, _(" to %s"), asn1time_to_string (X509_get_notAfter (data->cert))); row++; buf[0] = '\0'; x509_fingerprint (buf, sizeof (buf), data->cert); - snprintf (menu->dialog[row++], SHORT_STRING, _("Fingerprint: %s"), buf); + snprintf (menu->dialog[row++], STRING, _("Fingerprint: %s"), buf); menu->title = _("SSL Certificate check"); diff --git a/lib-sys/mutt_ssl_gnutls.c b/lib-sys/mutt_ssl_gnutls.c index 1fff26d..9c155ea 100644 --- a/lib-sys/mutt_ssl_gnutls.c +++ b/lib-sys/mutt_ssl_gnutls.c @@ -431,17 +431,17 @@ static int tls_check_certificate (CONNECTION * conn) { tlssockdata *data = conn->sockdata; gnutls_session state = data->state; - char helpstr[SHORT_STRING]; - char buf[SHORT_STRING]; - char fpbuf[SHORT_STRING]; + char helpstr[STRING]; + char buf[STRING]; + char fpbuf[STRING]; ssize_t buflen; - char dn_common_name[SHORT_STRING]; - char dn_email[SHORT_STRING]; - char dn_organization[SHORT_STRING]; - char dn_organizational_unit[SHORT_STRING]; - char dn_locality[SHORT_STRING]; - char dn_province[SHORT_STRING]; - char dn_country[SHORT_STRING]; + char dn_common_name[STRING]; + char dn_email[STRING]; + char dn_organization[STRING]; + char dn_organizational_unit[STRING]; + char dn_locality[STRING]; + char dn_province[STRING]; + char dn_country[STRING]; MUTTMENU *menu; int done, row, i, ret; FILE *fp; @@ -574,10 +574,10 @@ static int tls_check_certificate (CONNECTION * conn) menu->max = 25; menu->dialog = p_new(char*, menu->max); for (i = 0; i < menu->max; i++) - menu->dialog[i] = p_new(char, SHORT_STRING); + menu->dialog[i] = p_new(char, STRING); row = 0; - m_strcpy(menu->dialog[row], SHORT_STRING, + m_strcpy(menu->dialog[row], STRING, _("This certificate belongs to:")); row++; @@ -613,16 +613,16 @@ static int tls_check_certificate (CONNECTION * conn) dn_country, (size_t *)&buflen) != 0) dn_country[0] = '\0'; - snprintf (menu->dialog[row++], SHORT_STRING, " %s %s", dn_common_name, + snprintf (menu->dialog[row++], STRING, " %s %s", dn_common_name, dn_email); - snprintf (menu->dialog[row++], SHORT_STRING, " %s", dn_organization); - snprintf (menu->dialog[row++], SHORT_STRING, " %s", + snprintf (menu->dialog[row++], STRING, " %s", dn_organization); + snprintf (menu->dialog[row++], STRING, " %s", dn_organizational_unit); - snprintf (menu->dialog[row++], SHORT_STRING, " %s %s %s", dn_locality, + snprintf (menu->dialog[row++], STRING, " %s %s %s", dn_locality, dn_province, dn_country); row++; - m_strcpy(menu->dialog[row], SHORT_STRING, + m_strcpy(menu->dialog[row], STRING, _("This certificate was issued by:")); row++; @@ -658,58 +658,58 @@ static int tls_check_certificate (CONNECTION * conn) (cert, GNUTLS_OID_X520_COUNTRY_NAME, 0, 0, dn_country, (size_t *)&buflen) != 0) dn_country[0] = '\0'; - snprintf (menu->dialog[row++], SHORT_STRING, " %s %s", dn_common_name, + snprintf (menu->dialog[row++], STRING, " %s %s", dn_common_name, dn_email); - snprintf (menu->dialog[row++], SHORT_STRING, " %s", dn_organization); - snprintf (menu->dialog[row++], SHORT_STRING, " %s", + snprintf (menu->dialog[row++], STRING, " %s", dn_organization); + snprintf (menu->dialog[row++], STRING, " %s", dn_organizational_unit); - snprintf (menu->dialog[row++], SHORT_STRING, " %s %s %s", dn_locality, + snprintf (menu->dialog[row++], STRING, " %s %s %s", dn_locality, dn_province, dn_country); row++; - snprintf (menu->dialog[row++], SHORT_STRING, + snprintf (menu->dialog[row++], STRING, _("This certificate is valid")); t = gnutls_x509_crt_get_activation_time (cert); - snprintf (menu->dialog[row++], SHORT_STRING, _(" from %s"), + snprintf (menu->dialog[row++], STRING, _(" from %s"), tls_make_date (t, datestr, 30)); t = gnutls_x509_crt_get_expiration_time (cert); - snprintf (menu->dialog[row++], SHORT_STRING, _(" to %s"), + snprintf (menu->dialog[row++], STRING, _(" to %s"), tls_make_date (t, datestr, 30)); fpbuf[0] = '\0'; tls_fingerprint (GNUTLS_DIG_SHA, fpbuf, sizeof (fpbuf), &cert_list[0]); - snprintf (menu->dialog[row++], SHORT_STRING, _("SHA1 Fingerprint: %s"), + snprintf (menu->dialog[row++], STRING, _("SHA1 Fingerprint: %s"), fpbuf); fpbuf[0] = '\0'; tls_fingerprint (GNUTLS_DIG_MD5, fpbuf, sizeof (fpbuf), &cert_list[0]); - snprintf (menu->dialog[row++], SHORT_STRING, _("MD5 Fingerprint: %s"), + snprintf (menu->dialog[row++], STRING, _("MD5 Fingerprint: %s"), fpbuf); if (certerr_notyetvalid) { row++; - m_strcpy(menu->dialog[row], SHORT_STRING, + m_strcpy(menu->dialog[row], STRING, _("WARNING: Server certificate is not yet valid")); } if (certerr_expired) { row++; - m_strcpy(menu->dialog[row], SHORT_STRING, + m_strcpy(menu->dialog[row], STRING, _("WARNING: Server certificate has expired")); } if (certerr_revoked) { row++; - m_strcpy(menu->dialog[row], SHORT_STRING, + m_strcpy(menu->dialog[row], STRING, _("WARNING: Server certificate has been revoked")); } if (certerr_hostname) { row++; - m_strcpy(menu->dialog[row], SHORT_STRING, + m_strcpy(menu->dialog[row], STRING, _("WARNING: Server hostname does not match certificate")); } if (certerr_signernotca) { row++; - m_strcpy(menu->dialog[row], SHORT_STRING, + m_strcpy(menu->dialog[row], STRING, _("WARNING: Signer of server certificate is not a CA")); } diff --git a/lib-ui/color.c b/lib-ui/color.c index a9ee64a..afb84a5 100644 --- a/lib-ui/color.c +++ b/lib-ui/color.c @@ -183,7 +183,7 @@ int mutt_alloc_color (int fg, int bg) int i; #if defined (USE_SLANG_CURSES) - char fgc[SHORT_STRING], bgc[SHORT_STRING]; + char fgc[STRING], bgc[STRING]; #endif /* check to see if this color is already allocated to save space */ diff --git a/lib-ui/curs_lib.c b/lib-ui/curs_lib.c index 81a817b..510eccf 100644 --- a/lib-ui/curs_lib.c +++ b/lib-ui/curs_lib.c @@ -279,7 +279,7 @@ void mutt_curses_error (const char *fmt, ...) } void mutt_progress_bar (progress_t* progress, long pos) { - char posstr[SHORT_STRING]; + char posstr[STRING]; if (!pos) { if (!NetInc) diff --git a/lib-ui/curs_main.c b/lib-ui/curs_main.c index f74a23e..f9e7c33 100644 --- a/lib-ui/curs_main.c +++ b/lib-ui/curs_main.c @@ -386,7 +386,7 @@ struct mapping_t IndexNewsHelp[] = { */ int mutt_index_menu (void) { - char buf[LONG_STRING], helpstr[SHORT_STRING]; + char buf[LONG_STRING], helpstr[STRING]; int flags; int op = OP_NULL; int done = 0; /* controls when to exit the "event" loop */ diff --git a/lib-ui/curses.h b/lib-ui/curses.h index 0e7b670..cb2eb56 100644 --- a/lib-ui/curses.h +++ b/lib-ui/curses.h @@ -142,7 +142,7 @@ typedef struct { const char* msg; long pos; long size; - char sizestr[SHORT_STRING]; + char sizestr[STRING]; } progress_t; void mutt_progress_bar (progress_t* progress, long pos); diff --git a/lib-ui/hdrline.c b/lib-ui/hdrline.c index f3e138b..09e77da 100644 --- a/lib-ui/hdrline.c +++ b/lib-ui/hdrline.c @@ -222,7 +222,7 @@ static const char *hdr_format_str (char *dest, struct hdr_format_info *hfi = (struct hdr_format_info *) data; HEADER *hdr, *htmp; CONTEXT *ctx; - char fmt[SHORT_STRING], buf2[SHORT_STRING], ch, *p; + char fmt[STRING], buf2[STRING], ch, *p; int do_locales, i; int optional = (flags & M_FORMAT_OPTIONAL); int threads = ((Sort & SORT_MASK) == SORT_THREADS); @@ -438,7 +438,7 @@ static const char *hdr_format_str (char *dest, int j = 0; for (i = 0; hdr->env->from && hdr->env->from->personal && - hdr->env->from->personal[i] && j < SHORT_STRING - 1; i++) { + hdr->env->from->personal[i] && j < STRING - 1; i++) { if (isalpha ((int) hdr->env->from->personal[i])) { if (!iflag) { buf2[j++] = hdr->env->from->personal[i]; diff --git a/lib-ui/menu.c b/lib-ui/menu.c index aa1501a..79fe3ec 100644 --- a/lib-ui/menu.c +++ b/lib-ui/menu.c @@ -397,7 +397,7 @@ void menu_check_recenter (MUTTMENU * menu) void menu_jump (MUTTMENU * menu) { int n; - char buf[SHORT_STRING]; + char buf[STRING]; if (menu->max) { mutt_ungetch (LastKey, 0); @@ -667,7 +667,7 @@ static int menu_search (MUTTMENU * menu, int op) int r; int searchDir; regex_t re; - char buf[SHORT_STRING]; + char buf[STRING]; if (op != OP_SEARCH_NEXT && op != OP_SEARCH_OPPOSITE) { m_strcpy(buf, sizeof(buf), NONULL(menu->searchBuf)); diff --git a/lib-ui/query.c b/lib-ui/query.c index 99631bf..3ba0e98 100644 --- a/lib-ui/query.c +++ b/lib-ui/query.c @@ -159,7 +159,7 @@ static int query_search (MUTTMENU * m, regex_t * re, int n) static void query_entry (char *s, ssize_t slen, MUTTMENU * m, int num) { ENTRY *table = (ENTRY *) m->data; - char buf2[SHORT_STRING], buf[SHORT_STRING] = ""; + char buf2[STRING], buf[STRING] = ""; /* need a query format ... hard coded constants are not good */ while (FirstColumn + SecondColumn > 70) { @@ -250,7 +250,7 @@ static void query_menu (char *buf, ssize_t buflen, QUERY * results, int retbuf) QUERY *queryp = NULL; int i, done = 0; int op; - char helpstr[SHORT_STRING]; + char helpstr[STRING]; char title[STRING]; snprintf (title, sizeof (title), _("Query")); /* FIXME */ diff --git a/lib-ui/sidebar.c b/lib-ui/sidebar.c index 6ccff9f..3a17817 100644 --- a/lib-ui/sidebar.c +++ b/lib-ui/sidebar.c @@ -96,7 +96,7 @@ static const char* sidebar_number_format (char* dest, ssize_t destlen, char op, const char* src, const char* fmt, const char* ifstr, const char* elstr, unsigned long data, format_flag flags) { - char tmp[SHORT_STRING]; + char tmp[STRING]; BUFFY* b = Incoming.arr[data]; int opt = flags & M_FORMAT_OPTIONAL; int c = Context && !m_strcmp(Context->path, b->path); @@ -186,7 +186,7 @@ int sidebar_need_count (void) { static int make_sidebar_entry (char* sbox, int idx, ssize_t len) { int shortened = 0, lencnt = 0; - char no[SHORT_STRING], entry[SHORT_STRING]; + char no[STRING], entry[STRING]; int l = m_strlen(ImapHomeNamespace); int l_m = m_strlen(Maildir); @@ -322,7 +322,7 @@ int sidebar_draw (void) { i = 0,line; BUFFY *tmp; ssize_t delim_len = m_strlen(SidebarDelim); - char blank[SHORT_STRING]; + char blank[STRING]; known_lines=last_line-first_line; diff --git a/lib-ui/status.c b/lib-ui/status.c index b19bf24..b2b3835 100644 --- a/lib-ui/status.c +++ b/lib-ui/status.c @@ -52,7 +52,7 @@ static const char *status_format_str (char *buf, ssize_t buflen, char op, const char *elsestring, unsigned long data, format_flag flags) { - char fmt[SHORT_STRING], tmp[SHORT_STRING]; + char fmt[STRING], tmp[STRING]; const char *cp, *p; int count, optional = (flags & M_FORMAT_OPTIONAL); MUTTMENU *menu = (MUTTMENU *) data; diff --git a/mutt_sasl.c b/mutt_sasl.c index b25db27..e32af34 100644 --- a/mutt_sasl.c +++ b/mutt_sasl.c @@ -186,8 +186,8 @@ int mutt_sasl_client_new (CONNECTION * conn, sasl_conn_t ** saslconn) int mutt_sasl_interact (sasl_interact_t * interaction) { - char prompt[SHORT_STRING]; - char resp[SHORT_STRING]; + char prompt[STRING]; + char resp[STRING]; while (interaction->id != SASL_CB_LIST_END) { snprintf (prompt, sizeof (prompt), "%s: ", interaction->prompt); diff --git a/muttlib.c b/muttlib.c index 9afd5cd..1f8ab30 100644 --- a/muttlib.c +++ b/muttlib.c @@ -335,8 +335,8 @@ void mutt_FormatString (char *dest, /* output buffer */ unsigned long data, /* callback data */ format_flag flags) { /* callback flags */ - char prefix[SHORT_STRING], buf[LONG_STRING], *cp, *wptr = dest, ch; - char ifstring[SHORT_STRING], elsestring[SHORT_STRING]; + char prefix[STRING], buf[LONG_STRING], *cp, *wptr = dest, ch; + char ifstring[STRING], elsestring[STRING]; ssize_t wlen, wid, count, col, len; prefix[0] = '\0'; diff --git a/nntp/newsrc.c b/nntp/newsrc.c index 68e14fc..178594e 100644 --- a/nntp/newsrc.c +++ b/nntp/newsrc.c @@ -242,7 +242,7 @@ const char *nntp_format_str (char *dest, ssize_t destlen, char op, const char *ifstring, const char *elsestring, unsigned long data, format_flag flags) { - char fn[SHORT_STRING], tmp[SHORT_STRING]; + char fn[STRING], tmp[STRING]; switch (op) { case 's': diff --git a/nntp/nntp.c b/nntp/nntp.c index 35a1b1b..afe5c9e 100644 --- a/nntp/nntp.c +++ b/nntp/nntp.c @@ -233,7 +233,7 @@ static int nntp_open_connection (NNTP_SERVER * serv) static int nntp_reconnect (NNTP_SERVER * serv) { - char buf[SHORT_STRING]; + char buf[STRING]; mutt_socket_close (serv->conn); @@ -1357,7 +1357,7 @@ int nntp_get_cache_all (NNTP_SERVER * serv) /* Load list of all newsgroups from active */ int nntp_get_active (NNTP_SERVER * serv) { - char msg[SHORT_STRING]; + char msg[STRING]; NNTP_DATA nntp_data; string_list_t *tmp; diff --git a/pager.c b/pager.c index 05e2c3e..a25490c 100644 --- a/pager.c +++ b/pager.c @@ -1348,8 +1348,8 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) { static char searchbuf[STRING]; char buffer[LONG_STRING]; - char helpstr[SHORT_STRING * 2]; - char tmphelp[SHORT_STRING * 2]; + char helpstr[STRING * 2]; + char tmphelp[STRING * 2]; int maxLine, lastLine = 0; struct line_t *lineInfo; struct q_class_t *QuoteList = NULL; diff --git a/pop/pop.c b/pop/pop.c index a40e2f8..9b53409 100644 --- a/pop/pop.c +++ b/pop/pop.c @@ -490,7 +490,7 @@ static int pop_check_mailbox (CONTEXT * ctx, void pop_fetch_mail (void) { char buffer[LONG_STRING]; - char msgbuf[SHORT_STRING]; + char msgbuf[STRING]; char *url, *p; int i, delanswer, last = 0, msgs, bytes, rset = 0; pop_query_status ret; diff --git a/postpone.c b/postpone.c index 4a08b97..635abd2 100644 --- a/postpone.c +++ b/postpone.c @@ -142,7 +142,7 @@ static HEADER *select_msg (void) { MUTTMENU *menu; int i, done = 0, r = -1; - char helpstr[SHORT_STRING]; + char helpstr[STRING]; short orig_sort; menu = mutt_new_menu (); diff --git a/recvattach.c b/recvattach.c index 90ed28b..1e0af26 100644 --- a/recvattach.c +++ b/recvattach.c @@ -149,8 +149,8 @@ const char *mutt_attach_fmt (char *dest, unsigned long data, format_flag flags) { char fmt[16]; - char tmp[SHORT_STRING]; - char charset[SHORT_STRING]; + char tmp[STRING]; + char charset[STRING]; ATTACHPTR *aptr = (ATTACHPTR *) data; int optional = (flags & M_FORMAT_OPTIONAL); ssize_t l; @@ -187,7 +187,7 @@ const char *mutt_attach_fmt (char *dest, } if (mutt_is_message_type(aptr->content) && MsgFmt && aptr->content->hdr) { - char s[SHORT_STRING]; + char s[STRING]; _mutt_make_string (s, sizeof (s), MsgFmt, NULL, aptr->content->hdr, M_FORMAT_FORCESUBJ | M_FORMAT_MAKEPRINT | @@ -565,7 +565,7 @@ pipe_attachment_list (char *command, FILE * fp, int tag, BODY * top, void mutt_pipe_attachment_list (FILE * fp, int tag, BODY * top, int afilter) { STATE state; - char buf[SHORT_STRING]; + char buf[STRING]; pid_t thepid; if (fp) @@ -808,7 +808,7 @@ void mutt_view_attachments (HEADER * hdr) int secured = 0; int need_secured = 0; - char helpstr[SHORT_STRING]; + char helpstr[STRING]; MUTTMENU *menu; BODY *cur = NULL; MESSAGE *msg; diff --git a/recvcmd.c b/recvcmd.c index 289b580..bf965a0 100644 --- a/recvcmd.c +++ b/recvcmd.c @@ -294,7 +294,7 @@ static void include_header (int quote, FILE * ifp, HEADER * hdr, FILE * ofp, char *_prefix) { int chflags = CH_DECODE; - char prefix[SHORT_STRING]; + char prefix[STRING]; if (option (OPTWEED)) chflags |= CH_WEED | CH_REORDER; @@ -811,7 +811,7 @@ void mutt_attach_reply (FILE * fp, HEADER * hdr, char tmpbody[_POSIX_PATH_MAX]; FILE *tmpfp; - char prefix[SHORT_STRING]; + char prefix[STRING]; int rc; #ifdef USE_NNTP diff --git a/remailer.c b/remailer.c index b17ec82..7d1dceb 100644 --- a/remailer.c +++ b/remailer.c @@ -457,7 +457,7 @@ void mix_make_chain (string_list_t ** chainp, int *redraw) struct coord *coords = NULL; MUTTMENU *menu; - char helpstr[SHORT_STRING]; + char helpstr[STRING]; short loop = 1; int op; diff --git a/sendlib.c b/sendlib.c index b8ece6d..e863656 100644 --- a/sendlib.c +++ b/sendlib.c @@ -339,8 +339,8 @@ int mutt_write_mime_header (BODY * a, FILE * f) int mutt_write_mime_body (BODY * a, FILE * f) { const char *p; - char boundary[SHORT_STRING]; - char send_charset[SHORT_STRING]; + char boundary[STRING]; + char send_charset[STRING]; FILE *fpin; BODY *t; fgetconv_t *fc; @@ -1018,7 +1018,7 @@ static void transform_to_7bit (BODY * a, FILE * fpin) /* determine which Content-Transfer-Encoding to use */ static void mutt_set_encoding (BODY * b, CONTENT * info) { - char send_charset[SHORT_STRING]; + char send_charset[STRING]; if (b->type == TYPETEXT) { char *chsname = @@ -1650,8 +1650,8 @@ static void mutt_gen_localpart(char *buf, unsigned int len, const char *fmt) static char *mutt_gen_msgid (void) { - char buf[SHORT_STRING]; - char localpart[SHORT_STRING]; + char buf[STRING]; + char localpart[STRING]; const char *fqdn; if (!(fqdn = mutt_fqdn(0))) @@ -2021,7 +2021,7 @@ static int _mutt_bounce_message (FILE * fp, HEADER * h, address_t * to, { int i, ret = 0; FILE *f; - char date[SHORT_STRING], tempfile[_POSIX_PATH_MAX]; + char date[STRING], tempfile[_POSIX_PATH_MAX]; MESSAGE *msg = NULL; if (!h) { diff --git a/state.c b/state.c index eb0a9c7..4e74a7e 100644 --- a/state.c +++ b/state.c @@ -69,7 +69,7 @@ void state_prefix_putc (char c, STATE * s) Quotebuf[i++] = c; Quotebuf[i] = '\0'; if (i == sizeof (Quotebuf) - 1 || c == '\n') { - char buf[2 * SHORT_STRING]; + char buf[2 * STRING]; int j = 0, offset = 0; regmatch_t pmatch[1]; -- 2.20.1