8000 Fix FT_CHECK compat with cibuildwheel. (#30123) · matplotlib/matplotlib@335e6b4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 335e6b4

Browse files
authored
Fix FT_CHECK compat with cibuildwheel. (#30123)
1 parent 2918b73 commit 335e6b4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ft2font.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#ifndef MPL_FT2FONT_H
77
#define MPL_FT2FONT_H
88

9-
#include <filesystem>
109
#include <set>
1110
#include <string>
1211
#include <string_view>
@@ -42,11 +41,12 @@ inline char const* ft_error_string(FT_Error error) {
4241

4342
// No more than 16 hex digits + "0x" + null byte for a 64-bit int error.
4443
#define THROW_FT_ERROR(name, err) { \
44+
std::string path{__FILE__}; \
4545
char buf[20] = {0}; \
46-
sprintf(buf, "%#04x", err); \
46+
snprintf(buf, sizeof buf, "%#04x", err); \
4747
throw std::runtime_error{ \
4848
name " (" \
49-
+ std::filesystem::path(__FILE__).filename().string() \
49+
+ path.substr(path.find_last_of("/\\") + 1) \
5050
+ " line " + std::to_string(__LINE__) + ") failed with error " \
5151
+ std::string{buf} + ": " + std::string{ft_error_string(err)}}; \
5252
} (void)0

0 commit comments

Comments
 (0)
0