[PATCH 05 of 11] Changed script length code casts to work with -Wpedantic
Maxim Dounin
mdounin at mdounin.ru
Wed Aug 7 01:03:50 UTC 2024
# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1722992198 -10800
# Wed Aug 07 03:56:38 2024 +0300
# Node ID 098019656024089ed9d36bb06d89278305893f50
# Parent 0ad3dde839478e1cf715117b7544d5cef752d122
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.
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