aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2016-12-24 18:01:14 +0300
committerMaxim Dounin <mdounin@mdounin.ru>2016-12-24 18:01:14 +0300
commitc17009ee756bf16e702ed48ef667765c121e36d6 (patch)
treec8f74895ac97264625ba4c3ded5f1e4a931bf5e9 /src
parenta43b2c96b20aa675601c43785397aabd8335a891 (diff)
downloadnginx-c17009ee756bf16e702ed48ef667765c121e36d6.tar.gz
nginx-c17009ee756bf16e702ed48ef667765c121e36d6.zip
Win32: fixed some warnings reported by Borland C.
Most notably, warning W8012 (comparing signed and unsigned values) reported in multiple places where an unsigned value of small type (e.g., u_short) is promoted to an int and compared to an unsigned value. Warning W8072 (suspicious pointer arithmetic) disabled, it is reported when we increment base pointer in ngx_shm_alloc().
Diffstat (limited to 'src')
-rw-r--r--src/core/ngx_resolver.c10
-rw-r--r--src/http/modules/ngx_http_sub_filter_module.c4
-rw-r--r--src/http/ngx_http_file_cache.c6
-rw-r--r--src/mail/ngx_mail_smtp_module.c2
-rw-r--r--src/os/win32/ngx_win32_config.h3
5 files changed, 14 insertions, 11 deletions
diff --git a/src/core/ngx_resolver.c b/src/core/ngx_resolver.c
index f179b64aa..2065f75a0 100644
--- a/src/core/ngx_resolver.c
+++ b/src/core/ngx_resolver.c
@@ -780,7 +780,7 @@ ngx_resolve_name_locked(ngx_resolver_t *r, ngx_resolver_ctx_t *ctx,
#endif
if (rn->nsrvs) {
- for (i = 0; i < rn->nsrvs; i++) {
+ for (i = 0; i < (ngx_uint_t) rn->nsrvs; i++) {
if (rn->u.srvs[i].name.data) {
ngx_resolver_free_locked(r, rn->u.srvs[i].name.data);
}
@@ -2959,7 +2959,7 @@ ngx_resolver_resolve_srv_names(ngx_resolver_ctx_t *ctx, ngx_resolver_node_t *rn)
ngx_del_timer(ctx->event);
}
- for (i = 0; i < rn->nsrvs; i++) {
+ for (i = 0; i < (ngx_uint_t) rn->nsrvs; i++) {
srvs[i].name.data = ngx_resolver_alloc(r, rn->u.srvs[i].name.len);
if (srvs[i].name.data == NULL) {
goto failed;
@@ -4077,7 +4077,7 @@ ngx_resolver_free_node(ngx_resolver_t *r, ngx_resolver_node_t *rn)
#endif
if (rn->nsrvs) {
- for (i = 0; i < rn->nsrvs; i++) {
+ for (i = 0; i < (ngx_uint_t) rn->nsrvs; i++) {
if (rn->u.srvs[i].name.data) {
ngx_resolver_free_locked(r, rn->u.srvs[i].name.data);
}
@@ -4206,10 +4206,10 @@ ngx_resolver_export(ngx_resolver_t *r, ngx_resolver_node_t *rn,
d = 0;
}
- if (j == rn->naddrs) {
+ if (j == (ngx_uint_t) rn->naddrs) {
j = 0;
}
- } while (++i < rn->naddrs);
+ } while (++i < (ngx_uint_t) rn->naddrs);
}
#if (NGX_HAVE_INET6)
diff --git a/src/http/modules/ngx_http_sub_filter_module.c b/src/http/modules/ngx_http_sub_filter_module.c
index e8d1d801d..de58c6f13 100644
--- a/src/http/modules/ngx_http_sub_filter_module.c
+++ b/src/http/modules/ngx_http_sub_filter_module.c
@@ -645,7 +645,7 @@ ngx_http_sub_parse(ngx_http_request_t *r, ngx_http_sub_ctx_t *ctx,
start = offset - (ngx_int_t) tables->min_match_len + 1;
- i = ngx_max(tables->index[c], ctx->index);
+ i = ngx_max((ngx_uint_t) tables->index[c], ctx->index);
j = tables->index[c + 1];
while (i != j) {
@@ -978,7 +978,7 @@ ngx_http_sub_init_tables(ngx_http_sub_tables_t *tables,
}
c = match[i].match.data[tables->min_match_len - 1];
- while (ch <= c) {
+ while (ch <= (ngx_uint_t) c) {
tables->index[ch++] = (u_char) i;
}
}
diff --git a/src/http/ngx_http_file_cache.c b/src/http/ngx_http_file_cache.c
index 3c8ad7dab..a5a9300ac 100644
--- a/src/http/ngx_http_file_cache.c
+++ b/src/http/ngx_http_file_cache.c
@@ -553,7 +553,7 @@ ngx_http_file_cache_read(ngx_http_request_t *r, ngx_http_cache_t *c)
return NGX_DECLINED;
}
- if (h->crc32 != c->crc32 || h->header_start != c->header_start) {
+ if (h->crc32 != c->crc32 || (size_t) h->header_start != c->header_start) {
ngx_log_error(NGX_LOG_CRIT, r->connection->log, 0,
"cache file \"%s\" has md5 collision", c->file.name.data);
return NGX_DECLINED;
@@ -1495,8 +1495,8 @@ ngx_http_file_cache_update_header(ngx_http_request_t *r)
if (h.version != NGX_HTTP_CACHE_VERSION
|| h.last_modified != c->last_modified
|| h.crc32 != c->crc32
- || h.header_start != c->header_start
- || h.body_start != c->body_start)
+ || (size_t) h.header_start != c->header_start
+ || (size_t) h.body_start != c->body_start)
{
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http file cache \"%s\" content changed",
diff --git a/src/mail/ngx_mail_smtp_module.c b/src/mail/ngx_mail_smtp_module.c
index f03bd907e..3b5a2d8f3 100644
--- a/src/mail/ngx_mail_smtp_module.c
+++ b/src/mail/ngx_mail_smtp_module.c
@@ -280,7 +280,7 @@ ngx_mail_smtp_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
p = ngx_cpymem(p, conf->capability.data, conf->capability.len);
- p = ngx_cpymem(p, "250 STARTTLS" CRLF, sizeof("250 STARTTLS" CRLF) - 1);
+ ngx_memcpy(p, "250 STARTTLS" CRLF, sizeof("250 STARTTLS" CRLF) - 1);
p = conf->starttls_capability.data
+ (last - conf->capability.data) + 3;
diff --git a/src/os/win32/ngx_win32_config.h b/src/os/win32/ngx_win32_config.h
index ecdf6ad07..c5e26dcbd 100644
--- a/src/os/win32/ngx_win32_config.h
+++ b/src/os/win32/ngx_win32_config.h
@@ -119,6 +119,9 @@ typedef long time_t;
/* unreferenced formal parameter */
#pragma warn -8057
+/* suspicious pointer arithmetic */
+#pragma warn -8072
+
#endif