Patch boost_assert to use stb_sprintf on platforms with no snprintf implementation

This commit is contained in:
刘皓 2025-06-23 18:15:11 -04:00
parent 3d044087e0
commit 08ad3e9f8f
No known key found for this signature in database
GPG key ID: 7901753DB465B711

View file

@ -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
{