From cbdbd60b353a2f9a1412a66c7fd84a31e834dcb3 Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Sun, 8 Dec 2019 00:42:23 -0500 Subject: [PATCH] [multiple] quiet clang compiler warnings --- src/configfile-glue.c | 2 +- src/mod_accesslog.c | 4 ++-- src/mod_evhost.c | 4 ++-- src/network.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/configfile-glue.c b/src/configfile-glue.c index 98500ab1..9f462c56 100644 --- a/src/configfile-glue.c +++ b/src/configfile-glue.c @@ -317,7 +317,7 @@ static void config_cond_result_trace(connection *con, const data_config *dc, int default: msg = "invalid cond_result_t"; break; } log_error(con->conf.errh, __FILE__, __LINE__, "%d (%s) result: %s", - dc->context_ndx, "uncached"+(cached ? 2 : 0), msg); + dc->context_ndx, &"uncached"[cached ? 2 : 0], msg); } static cond_result_t config_check_cond_nocache(connection *con, const data_config *dc, int debug_cond, cond_cache_t *cache); diff --git a/src/mod_accesslog.c b/src/mod_accesslog.c index 8456c41a..4fa139ae 100644 --- a/src/mod_accesslog.c +++ b/src/mod_accesslog.c @@ -259,9 +259,9 @@ static format_fields * accesslog_parse_format(const char * const format, const s * so 127 should be enough except for obscene custom usage */ size_t i, j, k = 0, start = 0; uint32_t used = 0; - const uint32_t sz = 127; + const uint32_t sz = 127;/* (sz+1 must match fptr[] num elts below) */ format_field *f; - format_field fptr[sz+1]; /* (128 elements takes 4k on stack in 64-bit) */ + format_field fptr[128]; /* (128 elements takes 4k on stack in 64-bit) */ memset(fptr, 0, sizeof(fptr)); if (0 != FIELD_UNSET) return NULL; diff --git a/src/mod_evhost.c b/src/mod_evhost.c index de993320..141bd608 100644 --- a/src/mod_evhost.c +++ b/src/mod_evhost.c @@ -78,9 +78,9 @@ static buffer * mod_evhost_parse_pattern_err(buffer *bptr) { static buffer * mod_evhost_parse_pattern(const char *ptr) { uint32_t used = 0; - const uint32_t sz = 127; + const uint32_t sz = 127;/* (sz+1 must match bptr[] num elts below) */ const char *pos; - buffer bptr[sz+1]; /* (128 elements takes 2k on stack in 64-bit) */ + buffer bptr[128]; /* (128 elements takes 2k on stack in 64-bit) */ memset(bptr, 0, sizeof(bptr)); for(pos=ptr;*ptr;ptr++) { diff --git a/src/network.c b/src/network.c index ea59a304..51062d76 100644 --- a/src/network.c +++ b/src/network.c @@ -114,10 +114,10 @@ static int network_host_parse_addr(server *srv, sock_addr *addr, socklen_t *addr } if (colon) { *colon++ = '\0'; - port = strtol(colon, NULL, 10); + port = (unsigned int)strtol(colon, NULL, 10); if (port == 0 || port > 65535) { log_error(srv->errh, __FILE__, __LINE__, - "port not set or out of range: %hd", port); + "port not set or out of range: %u", port); return -1; } }