changeset 547:33e37b3d98cf

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.
author William Astle <lost@l-w.ca>
date Thu, 16 Mar 2023 16:18:13 -0600
parents 80b21c6b4a6b
children cde1a5a48636
files lwlib/lw_win.c lwlib/lw_win.h
diffstat 2 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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 <http://www.gnu.org/licenses/>.
 */
 
+#if defined(_MSC_VER) && _MSC_VER < 1900
+
 #include "lw_win.h"
 
 #include <stdio.h>
@@ -47,3 +49,5 @@
 
 	return count;
 }
+
+#endif // _MSC_VER < 1900
--- 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 <string.h>
@@ -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___ */