[vlc-commits] [Git][videolan/vlc][3.0.x] 2 commits: contrib: libdsm: fix UWP build
Steve Lhomme (@robUx4)
gitlab at videolan.org
Sat Nov 9 15:50:01 UTC 2024
Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC
Commits:
676a4763 by Steve Lhomme at 2024-11-09T15:05:19+00:00
contrib: libdsm: fix UWP build
Even though _CRT_RAND_S is defined a few lines above, rand_s is still not
defined properly.
Use the upstream patch that fixes this issue.
(cherry picked from commit df3a5954c3513aa7f4b675275d34063d09bf81f8)
- - - - -
075e8d69 by Steve Lhomme at 2024-11-09T15:05:19+00:00
contrib: libdsm: fix getpid usage in winstore builds
(cherry picked from commit 06cfac960b0491ec5d68df205cc2bce5578b3a10)
- - - - -
3 changed files:
- + contrib/src/libdsm/0001-Avoid-relying-on-implicit-function-declarations.patch
- + contrib/src/libdsm/0001-use-GetCurrentProcessId-for-the-process-ID-on-Window.patch
- contrib/src/libdsm/rules.mak
Changes:
=====================================
contrib/src/libdsm/0001-Avoid-relying-on-implicit-function-declarations.patch
=====================================
@@ -0,0 +1,51 @@
+From a95e2ee2056317383d885574464f64dcc5509ce4 Mon Sep 17 00:00:00 2001
+From: Johannes Kauffmann <johanneskauffmann at hotmail.com>
+Date: Wed, 7 Sep 2022 00:54:00 +0200
+Subject: [PATCH] Avoid relying on implicit function declarations
+
+smb_ntlm.c includes stdlib.h transitively via config.h -> compat.h.
+This means that defining _CRT_RAND_S in smb_ntlm.c (before including
+config.h itself) does not have the desired effect of pulling in the
+rand_s() function declaration.
+
+To fix this (and the Wimplicit-function-declaration warning, which has
+become an error in Clang 16), define _CRT_RAND_S before including
+stdlib.h.
+---
+ compat/compat.h | 4 ++++
+ src/smb_ntlm.c | 4 ----
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/compat/compat.h b/compat/compat.h
+index eadfae8..014298c 100644
+--- a/compat/compat.h
++++ b/compat/compat.h
+@@ -31,6 +31,10 @@
+ #ifndef BDSM_COMPAT_H
+ # define BDSM_COMPAT_H
+
++#ifdef _WIN32
++# define _CRT_RAND_S /* needed before including stdlib.h !!! */
++#endif
++
+ #include <stdlib.h>
+ #if !defined HAVE_STRLCPY && !defined HAVE_LIBBSD
+ size_t strlcpy(char *dst, const char *src, size_t siz);
+diff --git a/src/smb_ntlm.c b/src/smb_ntlm.c
+index 998afd3..c55d169 100644
+--- a/src/smb_ntlm.c
++++ b/src/smb_ntlm.c
+@@ -32,10 +32,6 @@
+ # include "config.h"
+ #endif
+
+-#ifdef _WIN32
+-# define _CRT_RAND_S
+-#endif
+-
+ #include <assert.h>
+ #include <ctype.h>
+ #include <wctype.h>
+--
+2.37.3.windows.1
+
=====================================
contrib/src/libdsm/0001-use-GetCurrentProcessId-for-the-process-ID-on-Window.patch
=====================================
@@ -0,0 +1,29 @@
+From 5cbbac2ca7b7f4a190582ab757a388fd28fc8a02 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Tue, 23 May 2023 09:57:47 +0200
+Subject: [PATCH] use GetCurrentProcessId for the process ID on Windows
+
+getpid is not available in UWP even though it's detected.
+---
+ src/smb_message.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/smb_message.c b/src/smb_message.c
+index d7717a6..d9b7d28 100644
+--- a/src/smb_message.c
++++ b/src/smb_message.c
+@@ -79,7 +79,11 @@ smb_message *smb_message_new(uint8_t cmd)
+ for (unsigned i = 0; i < 4; i++)
+ msg->packet->header.magic[i] = magic[i];
+ msg->packet->header.command = cmd;
++#ifdef _WIN32
++ msg->packet->header.pid = GetCurrentProcessId();
++#else
+ msg->packet->header.pid = getpid();
++#endif
+
+ return msg;
+ }
+--
+2.37.3.windows.1
+
=====================================
contrib/src/libdsm/rules.mak
=====================================
@@ -19,6 +19,8 @@ endif
libdsm: libdsm-$(LIBDSM_VERSION).tar.xz .sum-libdsm
$(UNPACK)
+ $(APPLY) $(SRC)/libdsm/0001-Avoid-relying-on-implicit-function-declarations.patch
+ $(APPLY) $(SRC)/libdsm/0001-use-GetCurrentProcessId-for-the-process-ID-on-Window.patch
$(MOVE)
DEPS_libdsm = libtasn1 iconv
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/db369b4534f3c1acac8da909eba9964e79dd1231...075e8d6968bf8b2e6118be90626da9918ec70296
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/db369b4534f3c1acac8da909eba9964e79dd1231...075e8d6968bf8b2e6118be90626da9918ec70296
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