From 9218fd9d7e2a7976b34683c60cb94f7fda42141a Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Sat, 28 Oct 2006 20:54:04 +0200 Subject: [PATCH] force our cflags in subdirs as well. more consts, less warnings. --- compose.c | 2 +- imap/Makefile.am | 2 ++ imap/auth.c | 2 +- imap/auth_login.c | 44 ++++++++++++++++++++++---------------------- imap/command.c | 2 +- imap/message.c | 14 +++++++------- intl/Makefile.in | 1 + lib/Makefile.am | 2 ++ nntp/Makefile.am | 2 ++ nntp/nntp.c | 4 ++-- pop/Makefile.am | 2 ++ pop/pop.h | 6 +++--- pop/pop_lib.c | 6 +++--- 13 files changed, 49 insertions(+), 40 deletions(-) diff --git a/compose.c b/compose.c index e7d2886..8af5084 100644 --- a/compose.c +++ b/compose.c @@ -708,7 +708,7 @@ int mutt_compose_menu (HEADER * msg, /* structure for new message */ if (str_cmp ("builtin", Editor) != 0 && (op == OP_COMPOSE_EDIT_HEADERS || (op == OP_COMPOSE_EDIT_MESSAGE && option (OPTEDITHDRS)))) { - char *tag = NULL, *err = NULL; + const char *tag = NULL, *err = NULL; mutt_env_to_local (msg->env); mutt_edit_headers (NONULL (Editor), msg->content->filename, msg, diff --git a/imap/Makefile.am b/imap/Makefile.am index 586e27b..4dbf7db 100644 --- a/imap/Makefile.am +++ b/imap/Makefile.am @@ -23,3 +23,5 @@ noinst_HEADERS = auth.h imap_private.h message.h mx_imap.h libimap_a_SOURCES = auth.c auth_login.c browse.c command.c imap.c imap.h mx_imap.h \ message.c utf7.c util.c mx_imap.c $(AUTHENTICATORS) $(GSSSOURCES) + +-include ../cflags.mk diff --git a/imap/auth.c b/imap/auth.c index 23473e1..7c6293d 100644 --- a/imap/auth.c +++ b/imap/auth.c @@ -39,7 +39,7 @@ static imap_auth_t imap_authenticators[] = { #endif {imap_auth_login, "login"}, - {NULL} + {NULL, NULL} }; /* imap_authenticate: Attempt to authenticate using either user-specified diff --git a/imap/auth_login.c b/imap/auth_login.c index bffa005..3216c3b 100644 --- a/imap/auth_login.c +++ b/imap/auth_login.c @@ -21,36 +21,36 @@ #include "auth.h" /* imap_auth_login: Plain LOGIN support */ -imap_auth_res_t imap_auth_login (IMAP_DATA * idata, const char *method) +imap_auth_res_t imap_auth_login(IMAP_DATA *idata, const char *method) { - char q_user[SHORT_STRING], q_pass[SHORT_STRING]; - char buf[STRING]; - int rc; + char q_user[SHORT_STRING], q_pass[SHORT_STRING]; + char buf[STRING]; + int rc; - if (mutt_bit_isset (idata->capabilities, LOGINDISABLED)) { - mutt_message _("LOGIN disabled on this server."); + if (mutt_bit_isset (idata->capabilities, LOGINDISABLED)) { + mutt_message _("LOGIN disabled on this server."); - return IMAP_AUTH_UNAVAIL; - } + return IMAP_AUTH_UNAVAIL; + } - if (mutt_account_getlogin (&idata->conn->account)) - return IMAP_AUTH_FAILURE; - if (mutt_account_getpass (&idata->conn->account)) - return IMAP_AUTH_FAILURE; + if (mutt_account_getlogin (&idata->conn->account)) + return IMAP_AUTH_FAILURE; + if (mutt_account_getpass (&idata->conn->account)) + return IMAP_AUTH_FAILURE; - mutt_message _("Logging in..."); + mutt_message _("Logging in..."); - imap_quote_string (q_user, sizeof (q_user), idata->conn->account.login); - imap_quote_string (q_pass, sizeof (q_pass), idata->conn->account.pass); + imap_quote_string(q_user, sizeof(q_user), idata->conn->account.login); + imap_quote_string(q_pass, sizeof(q_pass), idata->conn->account.pass); - snprintf (buf, sizeof (buf), "LOGIN %s %s", q_user, q_pass); - rc = imap_exec (idata, buf, IMAP_CMD_FAIL_OK | IMAP_CMD_PASS); + snprintf(buf, sizeof(buf), "LOGIN %s %s", q_user, q_pass); + rc = imap_exec(idata, buf, IMAP_CMD_FAIL_OK | IMAP_CMD_PASS); - if (!rc) - return IMAP_AUTH_SUCCESS; + if (!rc) + return IMAP_AUTH_SUCCESS; - mutt_error _("Login failed."); + mutt_error _("Login failed."); - mutt_sleep (2); - return IMAP_AUTH_FAILURE; + mutt_sleep (2); + return IMAP_AUTH_FAILURE; } diff --git a/imap/command.c b/imap/command.c index 2039e54..a28ae7a 100644 --- a/imap/command.c +++ b/imap/command.c @@ -42,7 +42,7 @@ static void cmd_parse_fetch (IMAP_DATA * idata, char *s); static void cmd_parse_myrights (IMAP_DATA * idata, char *s); static void cmd_parse_search (IMAP_DATA* idata, char* s); -static char *Capabilities[] = { +static const char *Capabilities[] = { "IMAP4", "IMAP4rev1", "STATUS", diff --git a/imap/message.c b/imap/message.c index bc75ed5..949f5d9 100644 --- a/imap/message.c +++ b/imap/message.c @@ -48,7 +48,7 @@ static int msg_has_flag (LIST * flag_list, const char *flag); static int msg_parse_fetch (IMAP_HEADER * h, char *s); static char *msg_parse_flags (IMAP_HEADER * h, char *s); -#if USE_HCACHE +#ifdef USE_HCACHE static int msg_fetch_header_fetch (CONTEXT * ctx, IMAP_HEADER * h, char *buf, FILE * fp); static size_t imap_hcache_keylen (const char *fn); @@ -73,7 +73,7 @@ int imap_read_headers (IMAP_DATA * idata, int msgbegin, int msgend) const char *want_headers = "DATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES CONTENT-TYPE CONTENT-DESCRIPTION IN-REPLY-TO REPLY-TO LINES LIST-POST X-LABEL"; -#if USE_HCACHE +#ifdef USE_HCACHE void *hc = NULL; unsigned long *uid_validity = NULL; char uid_buf[64]; @@ -116,7 +116,7 @@ int imap_read_headers (IMAP_DATA * idata, int msgbegin, int msgend) idata->reopen &= ~IMAP_NEWMAIL_PENDING; idata->newMailCount = 0; -#if USE_HCACHE +#ifdef USE_HCACHE if ((hc = mutt_hcache_open (HeaderCache, ctx->path))) { snprintf (buf, sizeof (buf), @@ -270,7 +270,7 @@ int imap_read_headers (IMAP_DATA * idata, int msgbegin, int msgend) /* content built as a side-effect of mutt_read_rfc822_header */ ctx->hdrs[msgno]->content->length = h.content_length; -#if USE_HCACHE +#ifdef USE_HCACHE sprintf (uid_buf, "/%u", h.data->uid); mutt_hcache_store (hc, uid_buf, ctx->hdrs[msgno], idata->uid_validity, &imap_hcache_keylen); @@ -284,7 +284,7 @@ int imap_read_headers (IMAP_DATA * idata, int msgbegin, int msgend) if ((mfhrc < -1) || ((rc != IMAP_CMD_CONTINUE) && (rc != IMAP_CMD_OK))) { imap_free_header_data ((void *)&h.data); fclose (fp); -#if USE_HCACHE +#ifdef USE_HCACHE mutt_hcache_close (hc); #endif /* USE_HCACHE */ return -1; @@ -300,7 +300,7 @@ int imap_read_headers (IMAP_DATA * idata, int msgbegin, int msgend) } } -#if USE_HCACHE +#ifdef USE_HCACHE mutt_hcache_close (hc); #endif /* USE_HCACHE */ @@ -890,7 +890,7 @@ static int msg_fetch_header (CONTEXT * ctx, IMAP_HEADER * h, char *buf, return rc; } -#if USE_HCACHE +#ifdef USE_HCACHE static size_t imap_hcache_keylen (const char *fn) { return str_len (fn); diff --git a/intl/Makefile.in b/intl/Makefile.in index b5435b0..74cfd9e 100644 --- a/intl/Makefile.in +++ b/intl/Makefile.in @@ -491,3 +491,4 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status # Tell versions [3.59,3.63) of GNU make not to export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: +-include ../cflags.mk diff --git a/lib/Makefile.am b/lib/Makefile.am index 5c0d961..9354a37 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -11,3 +11,5 @@ noinst_HEADERS = mem.h str.h exit.h intl.h list.h rx.h debug.h libsane_a_SOURCES = mem.c exit.c str.c list.c rx.h debug.h \ mem.h exit.h str.h list.h rx.c debug.c intl.h + +-include ../cflags.mk diff --git a/nntp/Makefile.am b/nntp/Makefile.am index 97e7ad6..8f3d7da 100644 --- a/nntp/Makefile.am +++ b/nntp/Makefile.am @@ -11,3 +11,5 @@ noinst_HEADERS = nntp.h mx_nntp.h libnntp_a_SOURCES = nntp.h mx_nntp.h \ nntp.c mx_nntp.c newsrc.c + +-include ../cflags.mk diff --git a/nntp/nntp.c b/nntp/nntp.c index 526dd30..391d66e 100644 --- a/nntp/nntp.c +++ b/nntp/nntp.c @@ -323,7 +323,7 @@ static int mutt_nntp_query (NNTP_DATA * data, char *line, size_t linelen) * -2 - invalid command or execution error, * -3 - error in funct(*line, *data). */ -static int mutt_nntp_fetch (NNTP_DATA * nntp_data, char *query, char *msg, +static int mutt_nntp_fetch (NNTP_DATA * nntp_data, const char *query, char *msg, progress_t* bar, int (*funct) (char *, void *), void *data, int tagged) { @@ -519,7 +519,7 @@ static int parse_description (char *line, void *n) #undef news } -static void nntp_get_desc (NNTP_DATA * data, char *mask, char *msg, progress_t* bar) +static void nntp_get_desc (NNTP_DATA * data, const char *mask, char *msg, progress_t* bar) { char buf[STRING]; diff --git a/pop/Makefile.am b/pop/Makefile.am index ac8f5ce..48cb078 100644 --- a/pop/Makefile.am +++ b/pop/Makefile.am @@ -10,3 +10,5 @@ noinst_LIBRARIES = libpop.a noinst_HEADERS = pop.h mx_pop.h libpop_a_SOURCES = pop.c pop_auth.c pop_lib.c pop.h mx_pop.h mx_pop.c + +-include ../cflags.mk diff --git a/pop/pop.h b/pop/pop.h index bbafe1f..fe49b4b 100644 --- a/pop/pop.h +++ b/pop/pop.h @@ -95,9 +95,9 @@ void pop_apop_timestamp (POP_DATA *, char *); int pop_parse_path (const char *, ACCOUNT *); int pop_connect (POP_DATA *); pop_query_status pop_open_connection (POP_DATA *); -pop_query_status pop_query_d (POP_DATA *, char *, size_t, char *); -pop_query_status pop_fetch_data (POP_DATA *, char *, progress_t*, int (*funct) (char *, void *), - void *); +pop_query_status pop_query_d (POP_DATA *, char *, size_t, const char *); +pop_query_status pop_fetch_data (POP_DATA *, const char *, progress_t*, + int (*funct) (char *, void *), void *); pop_query_status pop_reconnect (CONTEXT *); void pop_logout (CONTEXT *); void pop_error (POP_DATA *, char *); diff --git a/pop/pop_lib.c b/pop/pop_lib.c index fe30c11..4aa3409 100644 --- a/pop/pop_lib.c +++ b/pop/pop_lib.c @@ -386,7 +386,7 @@ void pop_logout (CONTEXT * ctx) * -1 - conection lost, * -2 - invalid command or execution error. */ -pop_query_status pop_query_d (POP_DATA * pop_data, char *buf, size_t buflen, char *msg) +pop_query_status pop_query_d (POP_DATA * pop_data, char *buf, size_t buflen, const char *msg) { int dbg = M_SOCK_LOG_CMD; char *c; @@ -428,7 +428,7 @@ pop_query_status pop_query_d (POP_DATA * pop_data, char *buf, size_t buflen, cha * -2 - invalid command or execution error, * -3 - error in funct(*line, *data) */ -pop_query_status pop_fetch_data (POP_DATA * pop_data, char *query, progress_t* bar, +pop_query_status pop_fetch_data (POP_DATA * pop_data, const char *query, progress_t* bar, int (*funct) (char *, void *), void *data) { char buf[LONG_STRING]; @@ -528,7 +528,7 @@ pop_query_status pop_reconnect (CONTEXT * ctx) for (i = 0; i < ctx->msgcount; i++) ctx->hdrs[i]->refno = -1; - ret = pop_fetch_data (pop_data, "UIDL\r\n", &bar, check_uidl, ctx); + ret = pop_fetch_data(pop_data, "UIDL\r\n", &bar, check_uidl, ctx); if (ret == PQ_ERR) { mutt_error ("%s", pop_data->err_msg); mutt_sleep (2); -- 2.20.1