From 4e6fd387fe9444fb6872b1ab106a194c5edf3618 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pali=20Roh=C3=A1r?= Date: Mon, 27 Dec 2021 00:47:53 +0100 Subject: [PATCH] libpci: For MSVC < 19.00 define snprintf outside of endian section snprintf() macro is not endian specific and therefore should be declared outside of the endian section. This also fixes snprintf() function for new MinGW-w64 toolchains where snprintf() is defined as wrapper around _snprintf() which do not return negative value on overflow. libpci would call MinGW-w64 patched snprintf() function and not broken system function _snprintf(). --- lib/sysdep.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sysdep.h b/lib/sysdep.h index 462fd35..1986d9f 100644 --- a/lib/sysdep.h +++ b/lib/sysdep.h @@ -23,6 +23,7 @@ typedef u16 word; #ifdef PCI_OS_WINDOWS #define strcasecmp _strcmpi #if defined(_MSC_VER) && _MSC_VER < 1900 +#define snprintf _snprintf #define vsnprintf _vsnprintf #endif #endif @@ -69,7 +70,6 @@ typedef u16 word; #define BIG_ENDIAN 4321 #define LITTLE_ENDIAN 1234 #define BYTE_ORDER LITTLE_ENDIAN - #define snprintf _snprintf #endif #endif -- 2.39.2