1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Do not override snprintf in VS 2015 and newer

MSVC preprocessor triggers #error in <stdio.h> if redefined

From MS doc:
Beginning with the UCRT in Visual Studio 2015 and Windows 10, snprintf is
no longer identical to _snprintf. The snprintf function behavior is now C99
standard compliant.

Closes #2255
This commit is contained in:
nnposter
2021-04-16 02:33:39 +00:00
parent 4b46fa7097
commit 004c8627c1
2 changed files with 5 additions and 3 deletions

View File

@@ -269,8 +269,10 @@ int strlcpy(char *, const char *, int);
#ifndef HAVE_STRSEP
char *strsep(char **, const char *);
#endif
#define snprintf _snprintf
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#endif
/* Without this, Windows will give us all sorts of crap about using functions
like strcpy() even if they are done safely */

View File

@@ -292,7 +292,7 @@ extern "C" int vsnprintf (char *, size_t, const char *, va_list);
#define putenv _putenv
#define tzset _tzset
#if !defined(__GNUC__)
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#endif