From 7aea2bdc026e2ba25140b74b26c17b18810b951c Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Fri, 7 Oct 2005 02:51:12 +0000 Subject: [PATCH] Fix compiler warnings on AMD64 Linux. src/gline.c (gline_alternate_target): Typecast format field precision argument. src/helpfile.c (helpfile_eval_identifier): Likewise. (helpfile_eval_atomicexpr): Likewise. (helpfile_eval_expr): Likewise. (helpfile_eval_condition): Likewise. src/log.c (log_audit): Change typecast used to make types compatible. src/main.c (set_item_rlimit): Use long instead of int as contained value. src/sendmail.c (send_flowed_text): Typecast format field precision argument. git-archimport-id: srvx@srvx.net--2005-srvx/srvx--devo--1.3--patch-27 --- ChangeLog | 27 +++++++++++++++++++++++++++ src/gline.c | 4 ++-- src/helpfile.c | 10 +++++----- src/log.c | 2 +- src/main.c | 5 +++-- src/sendmail.c | 2 +- 6 files changed, 39 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 92a822f..1adaa85 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,33 @@ # arch-tag: automatic-ChangeLog--srvx@srvx.net--2005-srvx/srvx--devo--1.3 # +2005-10-07 02:51:12 GMT Michael Poole patch-27 + + Summary: + Fix compiler warnings on AMD64 Linux. + Revision: + srvx--devo--1.3--patch-27 + + src/gline.c (gline_alternate_target): Typecast format field precision + argument. + + src/helpfile.c (helpfile_eval_identifier): Likewise. + (helpfile_eval_atomicexpr): Likewise. + (helpfile_eval_expr): Likewise. + (helpfile_eval_condition): Likewise. + + src/log.c (log_audit): Change typecast used to make types compatible. + + src/main.c (set_item_rlimit): Use long instead of int as contained value. + + src/sendmail.c (send_flowed_text): Typecast format field precision + argument. + + modified files: + ChangeLog src/gline.c src/helpfile.c src/log.c src/main.c + src/sendmail.c + + 2005-08-14 01:34:04 GMT Michael Poole patch-26 Summary: diff --git a/src/gline.c b/src/gline.c index ae8600c..8071f37 100644 --- a/src/gline.c +++ b/src/gline.c @@ -186,13 +186,13 @@ gline_alternate_target(const char *target) if (inet_aton(hostname+1, &in) && (he = gethostbyaddr((char*)&in, sizeof(in), AF_INET))) { res = malloc((hostname - target) + 2 + strlen(he->h_name)); - sprintf(res, "%.*s@%s", hostname - target, target, he->h_name); + sprintf(res, "%.*s@%s", (int)(hostname - target), target, he->h_name); return res; } else return NULL; } else if (getipbyname(hostname+1, &ip)) { res = malloc((hostname - target) + 18); - sprintf(res, "%.*s@%lu.%lu.%lu.%lu", hostname - target, target, ip & 255, (ip >> 8) & 255, (ip >> 16) & 255, (ip >> 24) & 255); + sprintf(res, "%.*s@%lu.%lu.%lu.%lu", (int)(hostname - target), target, ip & 255, (ip >> 8) & 255, (ip >> 16) & 255, (ip >> 24) & 255); return res; } else return NULL; diff --git a/src/helpfile.c b/src/helpfile.c index e5aca29..27fc614 100644 --- a/src/helpfile.c +++ b/src/helpfile.c @@ -806,7 +806,7 @@ helpfile_eval_identifier(const char *start, const char **end) *end = start + 5; return 0; } else { - log_module(MAIN_LOG, LOG_FATAL, "Unexpected helpfile identifier '%.*s'.", *end-start, start); + log_module(MAIN_LOG, LOG_FATAL, "Unexpected helpfile identifier '%.*s'.", (int)(*end-start), start); return -1; } } @@ -838,7 +838,7 @@ helpfile_eval_atomicexpr(const char *start, const char **end) while (isspace(*sep) && (sep < *end)) sep++; if ((sep == *end) || (sep[0] != ')')) { - log_module(MAIN_LOG, LOG_FATAL, "Expected close parenthesis at '%.*s'.", *end-sep, sep); + log_module(MAIN_LOG, LOG_FATAL, "Expected close parenthesis at '%.*s'.", (int)(*end-sep), sep); return -1; } @@ -875,7 +875,7 @@ helpfile_eval_expr(const char *start, const char **end) sep += len; } if (op == OP_INVALID) { - log_module(MAIN_LOG, LOG_FATAL, "Unrecognized helpfile operator at '%.*s'.", *end-sep, sep); + log_module(MAIN_LOG, LOG_FATAL, "Unrecognized helpfile operator at '%.*s'.", (int)(*end-sep), sep); return -1; } @@ -889,7 +889,7 @@ helpfile_eval_expr(const char *start, const char **end) while (isspace(*sep2) && (sep2 < *end)) sep2++; if (sep2 != *end) { - log_module(MAIN_LOG, LOG_FATAL, "Trailing garbage in helpfile expression: '%.*s'.", *end-sep2, sep2); + log_module(MAIN_LOG, LOG_FATAL, "Trailing garbage in helpfile expression: '%.*s'.", (int)(*end-sep2), sep2); return -1; } @@ -916,7 +916,7 @@ helpfile_eval_condition(const char *start, const char **end) for (term = start; isalnum(*term) && (term < *end); ++term) ; if (term != start) { if ((term + 2 >= *end) || (term[0] != ':') || (term[1] != ' ')) { - log_module(MAIN_LOG, LOG_FATAL, "In helpfile condition '%.*s' expected prefix to end with ': '.", *end-start, start); + log_module(MAIN_LOG, LOG_FATAL, "In helpfile condition '%.*s' expected prefix to end with ': '.", (int)(*end-start), start); return -1; } start = term + 2; diff --git a/src/log.c b/src/log.c index ef64835..11ec27f 100644 --- a/src/log.c +++ b/src/log.c @@ -527,7 +527,7 @@ log_audit(struct log_type *type, enum log_severity sev, struct userNode *user, s /* remove old elements from the linked list */ while (type->log_count > type->max_count) log_type_free_oldest(type); - while (type->log_oldest && (type->log_oldest->time + type->max_age < (unsigned long)now)) + while (type->log_oldest && (type->log_oldest->time + (time_t)type->max_age < now)) log_type_free_oldest(type); if (type->log_oldest) type->log_oldest->prev = 0; diff --git a/src/main.c b/src/main.c index cd461c5..7c6e2cd 100644 --- a/src/main.c +++ b/src/main.c @@ -565,12 +565,13 @@ conf_globals(void) static int set_item_rlimit(const char *name, void *data, void *extra) { - int rsrc, found; + long rsrc; + int found; struct record_data *rd = data; struct rlimit rlim; const char *str; - rsrc = (int)dict_find(extra, name, &found); + rsrc = (long)dict_find(extra, name, &found); if (!found) { log_module(MAIN_LOG, LOG_ERROR, "Invalid rlimit \"%s\" in rlimits section.", name); return 0; diff --git a/src/sendmail.c b/src/sendmail.c index 63fe69b..63bb548 100644 --- a/src/sendmail.c +++ b/src/sendmail.c @@ -83,7 +83,7 @@ send_flowed_text(FILE *where, const char *para) break; } else if (eol && (eol < para + (80 - shift))) { /* Newline inside paragraph, no need to wrap. */ - fprintf(where, "%.*s\n", eol - para, para); + fprintf(where, "%.*s\n", (int)(eol - para), para); para = eol + 1; } else { int pos; -- 2.20.1