From a92576664b27e50045895e95fb43a9c001c44e3b Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Fri, 30 May 2025 10:31:09 +0200 Subject: [PATCH] Fix FT_CHECK compat with cibuildwheel. --- src/ft2font.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ft2font.h b/src/ft2font.h index e1ebdb934329..8db0239ed4fd 100644 --- a/src/ft2font.h +++ b/src/ft2font.h @@ -6,7 +6,6 @@ #ifndef MPL_FT2FONT_H #define MPL_FT2FONT_H -#include #include #include #include @@ -42,11 +41,12 @@ inline char const* ft_error_string(FT_Error error) { // No more than 16 hex digits + "0x" + null byte for a 64-bit int error. #define THROW_FT_ERROR(name, err) { \ + std::string path{__FILE__}; \ char buf[20] = {0}; \ - sprintf(buf, "%#04x", err); \ + snprintf(buf, sizeof buf, "%#04x", err); \ throw std::runtime_error{ \ name " (" \ - + std::filesystem::path(__FILE__).filename().string() \ + + path.substr(path.find_last_of("/\\") + 1) \ + " line " + std::to_string(__LINE__) + ") failed with error " \ + std::string{buf} + ": " + std::string{ft_error_string(err)}}; \ } (void)0