From 08ad3e9f8f52f0719e0cfc0e50b1a3e91b2d7553 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=9A=93?= Date: Mon, 23 Jun 2025 18:15:11 -0400 Subject: [PATCH] Patch boost_assert to use stb_sprintf on platforms with no snprintf implementation --- .../packagefiles/boost_assert-snprintf.patch | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/subprojects/packagefiles/boost_assert-snprintf.patch b/subprojects/packagefiles/boost_assert-snprintf.patch index ce99b6a3..a9778cbe 100644 --- a/subprojects/packagefiles/boost_assert-snprintf.patch +++ b/subprojects/packagefiles/boost_assert-snprintf.patch @@ -1,13 +1,20 @@ -# Makes Boost use `sprintf` instead of `snprintf` on platforms with no `snprintf` support. +# Polyfills `std::snprintf` on platforms where it isn't provided by the C++ standard library. --- a/include/boost/assert/source_location.hpp +++ b/include/boost/assert/source_location.hpp -@@ -76,7 +76,7 @@ public: +@@ -76,11 +76,11 @@ public: # pragma warning( disable: 4996 ) #endif -#if ( defined(_MSC_VER) && _MSC_VER < 1900 ) || ( defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) ) -+#if ( defined(_MSC_VER) && _MSC_VER < 1900 ) || ( defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) ) || defined(MKXPZ_NO_SNPRINTF) - # define BOOST_ASSERT_SNPRINTF(buffer, format, arg) std::sprintf(buffer, format, arg) - #else +-# define BOOST_ASSERT_SNPRINTF(buffer, format, arg) std::sprintf(buffer, format, arg) +-#else ++ ++ ++#include "../../../../../src/mkxp-polyfill.h" # define BOOST_ASSERT_SNPRINTF(buffer, format, arg) std::snprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), format, arg) +-#endif ++ + + std::string to_string() const + {