From: Richard Russon Date: Mon, 10 Dec 2018 16:23:53 +0000 (+0000) Subject: add consts X-Git-Tag: 2019-10-25~448 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ad048c4598d3c24437f8e031f46e30bfeba83b19;p=neomutt add consts --- diff --git a/curs_lib.c b/curs_lib.c index 06e69463c..cfc011108 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -289,7 +289,7 @@ int mutt_get_field_full(const char *field, char *buf, size_t buflen, * @retval 0 Selection made * @retval -1 Aborted */ -int mutt_get_field_unbuffered(char *msg, char *buf, size_t buflen, int flags) +int mutt_get_field_unbuffered(const char *msg, char *buf, size_t buflen, int flags) { int rc; diff --git a/curs_lib.h b/curs_lib.h index 15173c1eb..999a13951 100644 --- a/curs_lib.h +++ b/curs_lib.h @@ -58,7 +58,7 @@ void mutt_format_s_tree(char *buf, size_t buflen, const char *prec, cons void mutt_getch_timeout(int delay); struct Event mutt_getch(void); int mutt_get_field_full(const char *field, char *buf, size_t buflen, int complete, bool multiple, char ***files, int *numfiles); -int mutt_get_field_unbuffered(char *msg, char *buf, size_t buflen, int flags); +int mutt_get_field_unbuffered(const char *msg, char *buf, size_t buflen, int flags); int mutt_multi_choice(const char *prompt, const char *letters); void mutt_need_hard_redraw(void); void mutt_paddstr(int n, const char *s); diff --git a/email/parse.c b/email/parse.c index 204ec593d..473785b25 100644 --- a/email/parse.c +++ b/email/parse.c @@ -226,7 +226,7 @@ static void parse_references(struct ListHead *head, char *s) * @param s Language string * @param ct Body of the email */ -static void parse_content_language(char *s, struct Body *ct) +static void parse_content_language(const char *s, struct Body *ct) { if (!s || !ct) return; @@ -390,7 +390,7 @@ int mutt_check_encoding(const char *c) * * e.g. parse a string "inline" and set #DISP_INLINE. */ -void mutt_parse_content_type(char *s, struct Body *ct) +void mutt_parse_content_type(const char *s, struct Body *ct) { FREE(&ct->subtype); mutt_param_free(&ct->parameter); diff --git a/email/parse.h b/email/parse.h index 90b4c75c2..ec2615f16 100644 --- a/email/parse.h +++ b/email/parse.h @@ -35,7 +35,7 @@ int mutt_check_mime_type(const char *s); char * mutt_extract_message_id(const char *s, const char **saveptr); bool mutt_is_message_type(int type, const char *subtype); bool mutt_matches_ignore(const char *s); -void mutt_parse_content_type(char *s, struct Body *ct); +void mutt_parse_content_type(const char *s, struct Body *ct); struct Body * mutt_parse_multipart(FILE *fp, const char *boundary, LOFF_T end_off, bool digest); void mutt_parse_part(FILE *fp, struct Body *b); struct Body * mutt_read_mime_header(FILE *fp, bool digest); diff --git a/email/tags.c b/email/tags.c index ef6eabb0b..f72765039 100644 --- a/email/tags.c +++ b/email/tags.c @@ -49,7 +49,7 @@ struct Hash *TagTransforms; /**< Lookup table of alternative tag names */ * Return a new allocated string containing tags separated by space */ static char *driver_tags_getter(struct TagHead *head, bool show_hidden, - bool show_transformed, char *filter) + bool show_transformed, const char *filter) { if (!head) return NULL; @@ -174,7 +174,7 @@ char *driver_tags_get_with_hidden(struct TagHead *head) * Return a new allocated string containing all tags separated by space even * the hiddens. */ -char *driver_tags_get_transformed_for(char *name, struct TagHead *head) +char *driver_tags_get_transformed_for(const char *name, struct TagHead *head) { return driver_tags_getter(head, true, true, name); } diff --git a/email/tags.h b/email/tags.h index 25a144e4e..c29778556 100644 --- a/email/tags.h +++ b/email/tags.h @@ -49,7 +49,7 @@ STAILQ_HEAD(TagHead, TagNode); void driver_tags_free(struct TagHead *head); char *driver_tags_get(struct TagHead *head); char *driver_tags_get_transformed(struct TagHead *head); -char *driver_tags_get_transformed_for(char *name, struct TagHead *head); +char *driver_tags_get_transformed_for(const char *name, struct TagHead *head); char *driver_tags_get_with_hidden(struct TagHead *head); bool driver_tags_replace(struct TagHead *head, char *tags); diff --git a/mutt/charset.c b/mutt/charset.c index bd8ae23a2..daed6dd71 100644 --- a/mutt/charset.c +++ b/mutt/charset.c @@ -984,7 +984,7 @@ void mutt_ch_set_charset(const char *charset) * @retval ptr Best performing charset * @retval NULL None could be found */ -char *mutt_ch_choose(const char *fromcode, const char *charsets, char *u, +char *mutt_ch_choose(const char *fromcode, const char *charsets, const char *u, size_t ulen, char **d, size_t *dlen) { char *e = NULL, *tocode = NULL; diff --git a/mutt/charset.h b/mutt/charset.h index abb605b01..5fbe72d5f 100644 --- a/mutt/charset.h +++ b/mutt/charset.h @@ -86,7 +86,7 @@ void mutt_ch_canonical_charset(char *buf, size_t buflen, const char const char * mutt_ch_charset_lookup(const char *chs); int mutt_ch_check(const char *s, size_t slen, const char *from, const char *to); bool mutt_ch_check_charset(const char *cs, bool strict); -char * mutt_ch_choose(const char *fromcode, const char *charsets, char *u, size_t ulen, char **d, size_t *dlen); +char * mutt_ch_choose(const char *fromcode, const char *charsets, const char *u, size_t ulen, char **d, size_t *dlen); bool mutt_ch_chscmp(const char *cs1, const char *cs2); int mutt_ch_convert_nonmime_string(char **ps); int mutt_ch_convert_string(char **ps, const char *from, const char *to, int flags); diff --git a/mutt/date.c b/mutt/date.c index e09680b5a..c517cd976 100644 --- a/mutt/date.c +++ b/mutt/date.c @@ -636,7 +636,7 @@ int mutt_date_make_tls(char *buf, size_t buflen, time_t timestamp) * @retval num Unix time * @retval 0 Error */ -time_t mutt_date_parse_imap(char *s) +time_t mutt_date_parse_imap(const char *s) { struct tm t; time_t tz; diff --git a/mutt/date.h b/mutt/date.h index e40420b67..1c47ce06c 100644 --- a/mutt/date.h +++ b/mutt/date.h @@ -47,6 +47,6 @@ time_t mutt_date_make_time(struct tm *t, int local); int mutt_date_make_tls(char *buf, size_t buflen, time_t timestamp); void mutt_date_normalize_time(struct tm *tm); time_t mutt_date_parse_date(const char *s, struct Tz *tz_out); -time_t mutt_date_parse_imap(char *s); +time_t mutt_date_parse_imap(const char *s); #endif /* MUTT_LIB_DATE_H */ diff --git a/mutt/file.c b/mutt/file.c index a5373ead9..ab187a644 100644 --- a/mutt/file.c +++ b/mutt/file.c @@ -1237,7 +1237,7 @@ void mutt_file_unlink_empty(const char *path) * @note on access(2) use No dangling symlink problems here due to * mutt_file_fopen(). */ -int mutt_file_rename(char *oldfile, char *newfile) +int mutt_file_rename(const char *oldfile, const char *newfile) { FILE *ofp = NULL, *nfp = NULL; diff --git a/mutt/file.h b/mutt/file.h index 02d09b976..7cb6519b6 100644 --- a/mutt/file.h +++ b/mutt/file.h @@ -105,7 +105,7 @@ int mutt_file_open(const char *path, int flags); size_t mutt_file_quote_filename(const char *filename, char *buf, size_t buflen); char * mutt_file_read_keyword(const char *file, char *buf, size_t buflen); char * mutt_file_read_line(char *line, size_t *size, FILE *fp, int *line_num, int flags); -int mutt_file_rename(char *oldfile, char *newfile); +int mutt_file_rename(const char *oldfile, const char *newfile); int mutt_file_rmtree(const char *path); int mutt_file_safe_rename(const char *src, const char *target); void mutt_file_sanitize_filename(char *f, bool slash); diff --git a/mutt/history.c b/mutt/history.c index ae88e58f9..724bd6340 100644 --- a/mutt/history.c +++ b/mutt/history.c @@ -410,7 +410,7 @@ static void remove_history_dups(enum HistoryClass hclass, const char *str) * @param[out] matches All the matching lines * @retval num Matches found */ -int mutt_hist_search(char *search_buf, enum HistoryClass hclass, char **matches) +int mutt_hist_search(const char *search_buf, enum HistoryClass hclass, char **matches) { struct History *h = get_history(hclass); int match_count = 0, cur; diff --git a/mutt/history.h b/mutt/history.h index b001cd562..89f654a01 100644 --- a/mutt/history.h +++ b/mutt/history.h @@ -59,6 +59,6 @@ char *mutt_hist_prev(enum HistoryClass hclass); void mutt_hist_read_file(void); void mutt_hist_reset_state(enum HistoryClass hclass); void mutt_hist_save_scratch(enum HistoryClass hclass, const char *str); -int mutt_hist_search(char *search_buf, enum HistoryClass hclass, char **matches); +int mutt_hist_search(const char *search_buf, enum HistoryClass hclass, char **matches); #endif /* MUTT_LIB_HISTORY_H */ diff --git a/rfc1524.c b/rfc1524.c index 7394fc6e8..af6de0ab7 100644 --- a/rfc1524.c +++ b/rfc1524.c @@ -69,7 +69,7 @@ bool MailcapSanitize; ///< Config: Restrict the possible characters in mailcap e * %n is the integer number of sub-parts in the multipart * %F is "content-type filename" repeated for each sub-part */ -int rfc1524_expand_command(struct Body *a, char *filename, char *type, char *command, int clen) +int rfc1524_expand_command(struct Body *a, const char *filename, const char *type, char *command, int clen) { int x = 0, y = 0; int needspipe = true; @@ -501,7 +501,7 @@ int rfc1524_mailcap_lookup(struct Body *a, char *type, * for a "%s". If none is found, the nametemplate is used as the template for * newfile. The first path component of the nametemplate and oldfile are ignored. */ -int rfc1524_expand_filename(char *nametemplate, char *oldfile, char *newfile, size_t nflen) +int rfc1524_expand_filename(const char *nametemplate, const char *oldfile, char *newfile, size_t nflen) { int i, j, k, ps; char *s = NULL; diff --git a/rfc1524.h b/rfc1524.h index 58e6ba5f9..c81ca14a6 100644 --- a/rfc1524.h +++ b/rfc1524.h @@ -51,8 +51,8 @@ struct Rfc1524MailcapEntry struct Rfc1524MailcapEntry *rfc1524_new_entry(void); void rfc1524_free_entry(struct Rfc1524MailcapEntry **entry); -int rfc1524_expand_command(struct Body *a, char *filename, char *type, char *command, int clen); -int rfc1524_expand_filename(char *nametemplate, char *oldfile, char *newfile, size_t nflen); +int rfc1524_expand_command(struct Body *a, const char *filename, const char *type, char *command, int clen); +int rfc1524_expand_filename(const char *nametemplate, const char *oldfile, char *newfile, size_t nflen); int rfc1524_mailcap_lookup(struct Body *a, char *type, struct Rfc1524MailcapEntry *entry, int opt); #endif /* MUTT_RFC1524_H */ diff --git a/send.c b/send.c index 10b9f18aa..c3cf180f9 100644 --- a/send.c +++ b/send.c @@ -1527,7 +1527,7 @@ static bool search_attach_keyword(char *filename) * @retval -1 Message was aborted or an error occurred * @retval 1 Message was postponed */ -int ci_send_message(int flags, struct Email *msg, char *tempfile, +int ci_send_message(int flags, struct Email *msg, const char *tempfile, struct Context *ctx, struct Email *cur) { char buf[LONG_STRING]; diff --git a/send.h b/send.h index 0d2102c87..50e3d067a 100644 --- a/send.h +++ b/send.h @@ -94,7 +94,7 @@ extern bool UseFrom; #define SEND_TO_SENDER (1 << 12) #define SEND_NEWS (1 << 13) -int ci_send_message(int flags, struct Email *msg, char *tempfile, struct Context *ctx, struct Email *cur); +int ci_send_message(int flags, struct Email *msg, const char *tempfile, struct Context *ctx, struct Email *cur); void mutt_add_to_reference_headers(struct Envelope *env, struct Envelope *curenv); struct Address *mutt_default_from(void); void mutt_encode_descriptions(struct Body *b, bool recurse);