[vlc-commits] [Git][videolan/vlc][master] 2 commits: contrib: gnutls: Backport a patch to avoid -Wint-conversion errors

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Aug 18 05:15:46 UTC 2022



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
ef1d4f3d by Martin Storsjö at 2022-08-18T04:41:23+00:00
contrib: gnutls: Backport a patch to avoid -Wint-conversion errors

Clang 15 made "incompatible pointer to integer conversion" an error
instead of a plain warning. This fixes errors like these:

system/keys-win.c:257:13: error: incompatible pointer to integer conversion initializing 'HCRYPTHASH' (aka 'unsigned long') with an expression of type 'void *' [-Wint-conversion]
        HCRYPTHASH hHash = NULL;
                   ^       ~~~~

This backports
https://gitlab.com/gnutls/gnutls/-/commit/88d79b964d88730e316919d6ccd17ca0fe9b3244.

- - - - -
d4ab7715 by Martin Storsjö at 2022-08-18T04:41:23+00:00
contrib: libplacebo: Backport a patch to avoid -Wint-conversion errors

Clang 15 made "incompatible pointer to integer conversion" an error
instead of a plain warning. This fixes errors like these:

../src/vulkan/gpu_pass.c:208:59: error: incompatible integer to pointer conversion passing 'VkPipeline' (aka 'unsigned long long') to parameter of type 'const void *' [-Wint-conversion]
        vk_dev_callback(vk, (vk_cb) destroy_pipeline, vk, *out_pipe);
                                                          ^~~~~~~~~
../src/vulkan/command.h:36:52: note: passing argument to parameter 'arg' here
                     const void *priv, const void *arg);
                                                   ^
../src/vulkan/gpu_pass.c:209:19: error: incompatible pointer to integer conversion assigning to 'VkPipeline' (aka 'unsigned long long') from 'void *' [-Wint-conversion]
        *out_pipe = NULL;
                  ^ ~~~~

This backports
https://code.videolan.org/videolan/libplacebo/-/commit/1d3ff4d4091a8c91cecdf3f1892ed0d1e1bf01cc.

- - - - -


4 changed files:

- + contrib/src/gnutls/0001-windows-Avoid-Wint-conversion-errors.patch
- contrib/src/gnutls/rules.mak
- + contrib/src/libplacebo/0001-Fix-incompatible-pointer-integer-conversion-errors-o.patch
- contrib/src/libplacebo/rules.mak


Changes:

=====================================
contrib/src/gnutls/0001-windows-Avoid-Wint-conversion-errors.patch
=====================================
@@ -0,0 +1,60 @@
+From 88d79b964d88730e316919d6ccd17ca0fe9b3244 Mon Sep 17 00:00:00 2001
+From: Martin Storsjo <martin at martin.st>
+Date: Mon, 15 Aug 2022 23:50:16 +0300
+Subject: [PATCH] windows: Avoid -Wint-conversion errors
+
+Clang 15 made "incompatible pointer to integer conversion" an error
+instead of a plain warning. This fixes errors like these:
+
+system/keys-win.c:257:13: error: incompatible pointer to integer conversion initializing 'HCRYPTHASH' (aka 'unsigned long') with an expression of type 'void *' [-Wint-conversion]
+        HCRYPTHASH hHash = NULL;
+                   ^       ~~~~
+
+Signed-off-by: Martin Storsjo <martin at martin.st>
+---
+ lib/system/keys-win.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/lib/system/keys-win.c b/lib/system/keys-win.c
+index 4463c3b2d7..a0fffe249e 100644
+--- a/lib/system/keys-win.c
++++ b/lib/system/keys-win.c
+@@ -254,7 +254,7 @@ int capi_sign(gnutls_privkey_t key, void *userdata,
+ {
+ 	priv_st *priv = (priv_st *) userdata;
+ 	ALG_ID Algid;
+-	HCRYPTHASH hHash = NULL;
++	HCRYPTHASH hHash = 0;
+ 	uint8_t digest[MAX_HASH_SIZE];
+ 	unsigned int digest_size;
+ 	gnutls_digest_algorithm_t algo;
+@@ -441,7 +441,7 @@ static
+ int privkey_import_capi(gnutls_privkey_t pkey, const char *url, 
+ 		priv_st *priv, CRYPT_KEY_PROV_INFO *kpi)
+ {
+-	HCRYPTPROV hCryptProv = NULL;
++	HCRYPTPROV hCryptProv = 0;
+ 	int ret, enc_too = 0;
+ 	DWORD i, dwErrCode = 0;
+ 
+@@ -702,7 +702,7 @@ int privkey_import_ncrypt(gnutls_privkey_t pkey, const char *url,
+ 		priv_st *priv, CRYPT_KEY_PROV_INFO *kpi, NCRYPT_PROV_HANDLE *sctx)
+ {
+ 	SECURITY_STATUS r;
+-	NCRYPT_KEY_HANDLE nc = NULL;
++	NCRYPT_KEY_HANDLE nc = 0;
+ 	int ret, enc_too = 0;
+ 	WCHAR algo_str[64];
+ 	DWORD algo_str_size = 0;
+@@ -786,7 +786,7 @@ int _gnutls_privkey_import_system_url(gnutls_privkey_t pkey, const char *url)
+ 	const CERT_CONTEXT *cert = NULL;
+ 	CRYPT_HASH_BLOB blob;
+ 	CRYPT_KEY_PROV_INFO *kpi = NULL;
+-	NCRYPT_PROV_HANDLE sctx = NULL;
++	NCRYPT_PROV_HANDLE sctx = 0;
+ 	DWORD kpi_size;
+ 	SECURITY_STATUS r;
+ 	int ret;
+-- 
+2.25.1
+


=====================================
contrib/src/gnutls/rules.mak
=====================================
@@ -45,6 +45,8 @@ ifdef HAVE_ANDROID
 	$(APPLY) $(SRC)/gnutls/gnutls-fix-aarch64-compilation-appleos.patch
 endif
 
+	$(APPLY) $(SRC)/gnutls/0001-windows-Avoid-Wint-conversion-errors.patch
+
 	$(UPDATE_AUTOCONFIG)
 	$(MOVE)
 


=====================================
contrib/src/libplacebo/0001-Fix-incompatible-pointer-integer-conversion-errors-o.patch
=====================================
@@ -0,0 +1,76 @@
+From 1d3ff4d4091a8c91cecdf3f1892ed0d1e1bf01cc Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin at martin.st>
+Date: Sat, 23 Jul 2022 23:49:37 +0300
+Subject: [PATCH] Fix incompatible pointer/integer conversion errors on 32 bit
+
+Clang 15 made "incompatible pointer to integer conversion" an error
+instead of a plain warning. This fixes errors like these:
+
+../src/vulkan/gpu_pass.c:208:59: error: incompatible integer to pointer conversion passing 'VkPipeline' (aka 'unsigned long long') to parameter of type 'const void *' [-Wint-conversion]
+        vk_dev_callback(vk, (vk_cb) destroy_pipeline, vk, *out_pipe);
+                                                          ^~~~~~~~~
+../src/vulkan/command.h:36:52: note: passing argument to parameter 'arg' here
+                     const void *priv, const void *arg);
+                                                   ^
+../src/vulkan/gpu_pass.c:209:19: error: incompatible pointer to integer conversion assigning to 'VkPipeline' (aka 'unsigned long long') from 'void *' [-Wint-conversion]
+        *out_pipe = NULL;
+                  ^ ~~~~
+---
+ src/vulkan/gpu_pass.c  | 6 +++---
+ src/vulkan/malloc.c    | 2 +-
+ src/vulkan/swapchain.c | 2 +-
+ 3 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/vulkan/gpu_pass.c b/src/vulkan/gpu_pass.c
+index 2fd7819..4b80f94 100644
+--- a/src/vulkan/gpu_pass.c
++++ b/src/vulkan/gpu_pass.c
+@@ -191,8 +191,8 @@ static VkResult vk_recreate_pipelines(struct vk_ctx *vk, pl_pass pass,
+     // The old pipeline might still be in use, so we have to destroy it
+     // asynchronously with a device idle callback
+     if (*out_pipe) {
+-        vk_dev_callback(vk, (vk_cb) destroy_pipeline, vk, *out_pipe);
+-        *out_pipe = NULL;
++        vk_dev_callback(vk, (vk_cb) destroy_pipeline, vk, (void*)(uintptr_t)*out_pipe);
++        *out_pipe = VK_NULL_HANDLE;
+     }
+ 
+     VkPipelineCreateFlags flags = 0;
+@@ -612,7 +612,7 @@ no_descriptors: ;
+ 
+     // Create the graphics/compute pipeline
+     VkPipeline *pipe = has_spec ? &pass_vk->base : &pass_vk->pipe;
+-    VK(vk_recreate_pipelines(vk, pass, has_spec, NULL, pipe));
++    VK(vk_recreate_pipelines(vk, pass, has_spec, VK_NULL_HANDLE, pipe));
+     pl_log_cpu_time(gpu->log, after_compilation, clock(), "creating pipeline");
+ 
+     if (!has_spec) {
+diff --git a/src/vulkan/malloc.c b/src/vulkan/malloc.c
+index 3f5fea8..6981f11 100644
+--- a/src/vulkan/malloc.c
++++ b/src/vulkan/malloc.c
+@@ -864,7 +864,7 @@ static bool vk_malloc_import(struct vk_malloc *ma, struct vk_memslice *out,
+         goto error;
+     }
+ 
+-    VkDeviceMemory vkmem = NULL;
++    VkDeviceMemory vkmem = VK_NULL_HANDLE;
+     VK(vk->AllocateMemory(vk->dev, &ainfo, PL_VK_ALLOC, &vkmem));
+ 
+     slab = pl_alloc_ptr(NULL, slab);
+diff --git a/src/vulkan/swapchain.c b/src/vulkan/swapchain.c
+index 6bdd73b..f294378 100644
+--- a/src/vulkan/swapchain.c
++++ b/src/vulkan/swapchain.c
+@@ -597,7 +597,7 @@ static bool vk_sw_recreate(pl_swapchain sw, int w, int h)
+ 
+     // If needed, allocate some more semaphores
+     while (num_images > p->sems.num) {
+-        VkSemaphore sem_in = NULL, sem_out = NULL;
++        VkSemaphore sem_in = VK_NULL_HANDLE, sem_out = VK_NULL_HANDLE;
+         static const VkSemaphoreCreateInfo seminfo = {
+             .sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO,
+         };
+-- 
+2.25.1
+


=====================================
contrib/src/libplacebo/rules.mak
=====================================
@@ -40,6 +40,7 @@ libplacebo: $(PLACEBO_ARCHIVE) .sum-libplacebo
 ifdef HAVE_ANDROID
 	$(APPLY) $(SRC)/libplacebo/fix-android-build.patch
 endif
+	$(APPLY) $(SRC)/libplacebo/0001-Fix-incompatible-pointer-integer-conversion-errors-o.patch
 	$(MOVE)
 
 .libplacebo: libplacebo crossfile.meson



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/452d9f86cfa20b3495b76665af4b6967ad68eac9...d4ab7715de249f61cf7abb38bab4d07c3d7f9f23

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/452d9f86cfa20b3495b76665af4b6967ad68eac9...d4ab7715de249f61cf7abb38bab4d07c3d7f9f23
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list