From: Pali Rohár Date: Sun, 26 Dec 2021 23:47:53 +0000 (+0100) Subject: libpci: For MSVC < 19.00 define snprintf outside of endian section X-Git-Tag: v3.8.0~52 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=4e6fd387fe9444fb6872b1ab106a194c5edf3618;p=pciutils.git 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(). --- 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