[nginx] Changed script length code casts to work with -Wpedantic.
Maxim Dounin
mdounin at mdounin.ru
Mon Aug 12 03:37:05 UTC 2024
details: http://freenginx.org/hg/nginx/rev/098019656024
branches:
changeset: 9312:098019656024
user: Maxim Dounin <mdounin at mdounin.ru>
date: Wed Aug 07 03:56:38 2024 +0300
description:
Changed script length code casts to work with -Wpedantic.
Script length code casts though "void *", as introduced in
7271:9e25a5380a21 to silence -Wcast-function-type warnings, result
in "ISO C forbids conversion of function pointer to object pointer type"
warnings with -Wpedantic. Fix is to cast though uintptr_t instead.
diffstat:
src/http/modules/ngx_http_fastcgi_module.c | 4 ++--
src/http/modules/ngx_http_grpc_module.c | 2 +-
src/http/modules/ngx_http_proxy_module.c | 2 +-
src/http/modules/ngx_http_scgi_module.c | 4 ++--
src/http/modules/ngx_http_uwsgi_module.c | 4 ++--
src/http/ngx_http_script.c | 8 ++++----
src/stream/ngx_stream_script.c | 8 ++++----
7 files changed, 16 insertions(+), 16 deletions(-)
diffs (165 lines):
diff --git a/src/http/modules/ngx_http_fastcgi_module.c b/src/http/modules/ngx_http_fastcgi_module.c
--- a/src/http/modules/ngx_http_fastcgi_module.c
+++ b/src/http/modules/ngx_http_fastcgi_module.c
@@ -3436,7 +3436,7 @@ ngx_http_fastcgi_init_params(ngx_conf_t
return NGX_ERROR;
}
- copy->code = (ngx_http_script_code_pt) (void *)
+ copy->code = (ngx_http_script_code_pt) (uintptr_t)
ngx_http_script_copy_len_code;
copy->len = src[i].key.len;
@@ -3446,7 +3446,7 @@ ngx_http_fastcgi_init_params(ngx_conf_t
return NGX_ERROR;
}
- copy->code = (ngx_http_script_code_pt) (void *)
+ copy->code = (ngx_http_script_code_pt) (uintptr_t)
ngx_http_script_copy_len_code;
copy->len = src[i].skip_empty;
diff --git a/src/http/modules/ngx_http_grpc_module.c b/src/http/modules/ngx_http_grpc_module.c
--- a/src/http/modules/ngx_http_grpc_module.c
+++ b/src/http/modules/ngx_http_grpc_module.c
@@ -4677,7 +4677,7 @@ ngx_http_grpc_init_headers(ngx_conf_t *c
return NGX_ERROR;
}
- copy->code = (ngx_http_script_code_pt) (void *)
+ copy->code = (ngx_http_script_code_pt) (uintptr_t)
ngx_http_script_copy_len_code;
copy->len = src[i].key.len;
diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c
--- a/src/http/modules/ngx_http_proxy_module.c
+++ b/src/http/modules/ngx_http_proxy_module.c
@@ -4047,7 +4047,7 @@ ngx_http_proxy_init_headers(ngx_conf_t *
return NGX_ERROR;
}
- copy->code = (ngx_http_script_code_pt) (void *)
+ copy->code = (ngx_http_script_code_pt) (uintptr_t)
ngx_http_script_copy_len_code;
copy->len = src[i].key.len;
diff --git a/src/http/modules/ngx_http_scgi_module.c b/src/http/modules/ngx_http_scgi_module.c
--- a/src/http/modules/ngx_http_scgi_module.c
+++ b/src/http/modules/ngx_http_scgi_module.c
@@ -1820,7 +1820,7 @@ ngx_http_scgi_init_params(ngx_conf_t *cf
return NGX_ERROR;
}
- copy->code = (ngx_http_script_code_pt) (void *)
+ copy->code = (ngx_http_script_code_pt) (uintptr_t)
ngx_http_script_copy_len_code;
copy->len = src[i].key.len + 1;
@@ -1830,7 +1830,7 @@ ngx_http_scgi_init_params(ngx_conf_t *cf
return NGX_ERROR;
}
- copy->code = (ngx_http_script_code_pt) (void *)
+ copy->code = (ngx_http_script_code_pt) (uintptr_t)
ngx_http_script_copy_len_code;
copy->len = src[i].skip_empty;
diff --git a/src/http/modules/ngx_http_uwsgi_module.c b/src/http/modules/ngx_http_uwsgi_module.c
--- a/src/http/modules/ngx_http_uwsgi_module.c
+++ b/src/http/modules/ngx_http_uwsgi_module.c
@@ -2118,7 +2118,7 @@ ngx_http_uwsgi_init_params(ngx_conf_t *c
return NGX_ERROR;
}
- copy->code = (ngx_http_script_code_pt) (void *)
+ copy->code = (ngx_http_script_code_pt) (uintptr_t)
ngx_http_script_copy_len_code;
copy->len = src[i].key.len;
@@ -2128,7 +2128,7 @@ ngx_http_uwsgi_init_params(ngx_conf_t *c
return NGX_ERROR;
}
- copy->code = (ngx_http_script_code_pt) (void *)
+ copy->code = (ngx_http_script_code_pt) (uintptr_t)
ngx_http_script_copy_len_code;
copy->len = src[i].skip_empty;
diff --git a/src/http/ngx_http_script.c b/src/http/ngx_http_script.c
--- a/src/http/ngx_http_script.c
+++ b/src/http/ngx_http_script.c
@@ -822,7 +822,7 @@ ngx_http_script_add_copy_code(ngx_http_s
return NGX_ERROR;
}
- code->code = (ngx_http_script_code_pt) (void *)
+ code->code = (ngx_http_script_code_pt) (uintptr_t)
ngx_http_script_copy_len_code;
code->len = len;
@@ -912,7 +912,7 @@ ngx_http_script_add_var_code(ngx_http_sc
return NGX_ERROR;
}
- code->code = (ngx_http_script_code_pt) (void *)
+ code->code = (ngx_http_script_code_pt) (uintptr_t)
ngx_http_script_copy_var_len_code;
code->index = (uintptr_t) index;
@@ -1308,7 +1308,7 @@ ngx_http_script_add_capture_code(ngx_htt
return NGX_ERROR;
}
- code->code = (ngx_http_script_code_pt) (void *)
+ code->code = (ngx_http_script_code_pt) (uintptr_t)
ngx_http_script_copy_capture_len_code;
code->n = 2 * n;
@@ -1423,7 +1423,7 @@ ngx_http_script_add_full_name_code(ngx_h
return NGX_ERROR;
}
- code->code = (ngx_http_script_code_pt) (void *)
+ code->code = (ngx_http_script_code_pt) (uintptr_t)
ngx_http_script_full_name_len_code;
code->conf_prefix = sc->conf_prefix;
diff --git a/src/stream/ngx_stream_script.c b/src/stream/ngx_stream_script.c
--- a/src/stream/ngx_stream_script.c
+++ b/src/stream/ngx_stream_script.c
@@ -686,7 +686,7 @@ ngx_stream_script_add_copy_code(ngx_stre
return NGX_ERROR;
}
- code->code = (ngx_stream_script_code_pt) (void *)
+ code->code = (ngx_stream_script_code_pt) (uintptr_t)
ngx_stream_script_copy_len_code;
code->len = len;
@@ -777,7 +777,7 @@ ngx_stream_script_add_var_code(ngx_strea
return NGX_ERROR;
}
- code->code = (ngx_stream_script_code_pt) (void *)
+ code->code = (ngx_stream_script_code_pt) (uintptr_t)
ngx_stream_script_copy_var_len_code;
code->index = (uintptr_t) index;
@@ -867,7 +867,7 @@ ngx_stream_script_add_capture_code(ngx_s
return NGX_ERROR;
}
- code->code = (ngx_stream_script_code_pt) (void *)
+ code->code = (ngx_stream_script_code_pt) (uintptr_t)
ngx_stream_script_copy_capture_len_code;
code->n = 2 * n;
@@ -959,7 +959,7 @@ ngx_stream_script_add_full_name_code(ngx
return NGX_ERROR;
}
- code->code = (ngx_stream_script_code_pt) (void *)
+ code->code = (ngx_stream_script_code_pt) (uintptr_t)
ngx_stream_script_full_name_len_code;
code->conf_prefix = sc->conf_prefix;
More information about the nginx-devel
mailing list