Skip to content

Commit 5195baa

Browse files
committed
depends: fix miniupnpc snprintf usage on Windows
1 parent 3c2d440 commit 5195baa

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

depends/packages/miniupnpc.mk

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ $(package)_version=2.2.7
33
$(package)_download_path=https://miniupnp.tuxfamily.org/files/
44
$(package)_file_name=$(package)-$($(package)_version).tar.gz
55
$(package)_sha256_hash=b0c3a27056840fd0ec9328a5a9bac3dc5e0ec6d2e8733349cf577b0aa1e70ac1
6-
$(package)_patches=dont_leak_info.patch cmake_get_src_addr.patch
6+
$(package)_patches=dont_leak_info.patch cmake_get_src_addr.patch fix_windows_snprintf.patch
77
$(package)_build_subdir=build
88

99
define $(package)_set_vars
@@ -14,7 +14,8 @@ endef
1414

1515
define $(package)_preprocess_cmds
1616
patch -p1 < $($(package)_patch_dir)/dont_leak_info.patch && \
17-
patch -p1 < $($(package)_patch_dir)/cmake_get_src_addr.patch
17+
patch -p1 < $($(package)_patch_dir)/cmake_get_src_addr.patch && \
18+
patch -p1 < $($(package)_patch_dir)/fix_windows_snprintf.patch
1819
endef
1920

2021
define $(package)_config_cmds
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
commit a1e9de80ab99b4c956a6a4e21d3e0de6f7a1014d
2+
Author: Hennadii Stepanov <[email protected]>
3+
Date: Sat Apr 20 15:14:47 2024 +0100
4+
5+
Fix macro expression that guards `snprintf` for Windows
6+
7+
Otherwise, the `snprintf` is still wrongly emulated for the following
8+
cases:
9+
- mingw-w64 6.0.0 or new with ucrt
10+
- mingw-w64 8.0.0 or new with iso c ext
11+
12+
--- a/src/win32_snprintf.h
13+
+++ b/src/win32_snprintf.h
14+
@@ -23,9 +23,9 @@
15+
(defined(_MSC_VER) && _MSC_VER < 1900) /* Visual Studio older than 2015 */ || \
16+
(defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) && defined(__NO_ISOCEXT)) /* mingw32 without iso c ext */ || \
17+
(defined(__MINGW64_VERSION_MAJOR) && /* mingw-w64 not ... */ !( \
18+
- (defined (__USE_MINGW_ANSI_STDIO) && __USE_MINGW_ANSI_STDIO != 0)) /* ... with ansi stdio */ || \
19+
+ (defined (__USE_MINGW_ANSI_STDIO) && __USE_MINGW_ANSI_STDIO != 0) /* ... with ansi stdio */ || \
20+
(__MINGW64_VERSION_MAJOR >= 6 && defined(_UCRT)) /* ... at least 6.0.0 with ucrt */ || \
21+
- (__MINGW64_VERSION_MAJOR >= 8 && !defined(__NO_ISOCEXT)) /* ... at least 8.0.0 with iso c ext */ || \
22+
+ (__MINGW64_VERSION_MAJOR >= 8 && !defined(__NO_ISOCEXT))) /* ... at least 8.0.0 with iso c ext */ || \
23+
0) || \
24+
0)
25+

0 commit comments

Comments
 (0)