mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Prefer use of __MINGW_PRINTF/SCANF_FORMAT if available.
Mingw headers sometimes like to define alternative scanf/printf format attributes depending on whether they're using clang, UCRT, MINGW_ANSI_STDIO, or the microsoft version of printf/scanf. This change attempts to use the right one on the given platform. This is an attempt to fix part of #40355.
This commit is contained in:
@@ -8,9 +8,9 @@
|
||||
* \brief Compatibility wrappers around snprintf and its friends
|
||||
**/
|
||||
|
||||
#include "lib/cc/torint.h"
|
||||
#include "lib/string/printf.h"
|
||||
#include "lib/err/torerr.h"
|
||||
#include "lib/cc/torint.h"
|
||||
#include "lib/malloc/malloc.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -45,7 +45,7 @@ tor_vsnprintf(char *str, size_t size, const char *format, va_list args)
|
||||
return -1; /* no place for the NUL */
|
||||
if (size > SIZE_T_CEILING)
|
||||
return -1;
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && !defined(HAVE_VSNPRINTF)
|
||||
r = _vsnprintf(str, size, format, args);
|
||||
#else
|
||||
r = vsnprintf(str, size, format, args);
|
||||
|
||||
Reference in New Issue
Block a user