# HG changeset patch # User William Astle # Date 1679005093 21600 # Node ID 33e37b3d98cfa8cdd6db764188f7283eba933476 # Parent 80b21c6b4a6bc035abcd0b099ca591cd93f8fd9e Don't build snprintf() emulation on modern enough MSVC MSVC 2015 and later have a C99 compliant snprintf() so don't build the emulation function for it if building on a modern enough version. diff -r 80b21c6b4a6b -r 33e37b3d98cf lwlib/lw_win.c --- a/lwlib/lw_win.c Thu Mar 16 16:03:20 2023 -0600 +++ b/lwlib/lw_win.c Thu Mar 16 16:18:13 2023 -0600 @@ -19,6 +19,8 @@ this program. If not, see . */ +#if defined(_MSC_VER) && _MSC_VER < 1900 + #include "lw_win.h" #include @@ -47,3 +49,5 @@ return count; } + +#endif // _MSC_VER < 1900 diff -r 80b21c6b4a6b -r 33e37b3d98cf lwlib/lw_win.h --- a/lwlib/lw_win.h Thu Mar 16 16:03:20 2023 -0600 +++ b/lwlib/lw_win.h Thu Mar 16 16:18:13 2023 -0600 @@ -21,6 +21,8 @@ #ifndef ___lw_win_h_seen___ #define ___lw_win_h_seen___ + +#ifdef _MSC_VER #include "lw_string.h" #include @@ -29,8 +31,14 @@ #define strncasecmp _strnicmp #define unlink _unlink + +#if _MSC_VER < 1900 +// For older Microsoft stuff without snprintf int c99_snprintf(char* str, size_t size, const char* format, ...); #define snprintf c99_snprintf +#endif + +#endif // _MSC_VER defined #endif /* ___lw_win_h_seen___ */