From 5fed98e0eed3d5dc9776c58a84f1f5af812ce45a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Thu, 17 Oct 2024 21:29:45 -0500 Subject: [PATCH] various: use mp_tprintf_buf wrapper to work around mingw garbage Look it up if you really care but basically z as a format specifier often doesn't work in mingw because reasons. Our CI was working by accident because of meson previously ignoring the CFLAGS variable. Use our wrapper instead for these places. --- misc/io_utils.c | 2 +- osdep/windows_utils.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/misc/io_utils.c b/misc/io_utils.c index fafed772cc..777e1c780c 100644 --- a/misc/io_utils.c +++ b/misc/io_utils.c @@ -45,7 +45,7 @@ int mp_mkostemps(char *template, int suffixlen, int flags) // not truly random; just a counter would be sufficient). size_t fuckmess = mp_rand_next(); char crap[7] = ""; - snprintf(crap, sizeof(crap), "%06zx", fuckmess); + mp_tprintf_buf(crap, sizeof(crap), "%06zx", fuckmess); memcpy(t, crap, 6); int res = open(template, O_RDWR | O_CREAT | O_EXCL | flags, 0600); diff --git a/osdep/windows_utils.c b/osdep/windows_utils.c index 91eef62cb8..2befea2d86 100644 --- a/osdep/windows_utils.c +++ b/osdep/windows_utils.c @@ -143,9 +143,9 @@ static char *fmtmsg_buf(char *buf, size_t buf_size, DWORD errorID) FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errorID, 0, buf, buf_size, NULL); if (!n && GetLastError() == ERROR_MORE_DATA) { - snprintf(buf, buf_size, - "", - buf_size); + mp_tprintf_buf(buf, buf_size, + "", + buf_size); } else { if (n > 0 && buf[n-1] == '\n') buf[n-1] = '\0';