Visual C++ 14 provides snprintf().
authorHiroshi Inoue <h-inoue@dream.email.ne.jp>
Sun, 4 Jun 2017 04:53:34 +0000 (13:53 +0900)
committerHiroshi Inoue <h-inoue@dream.email.ne.jp>
Sun, 4 Jun 2017 04:53:34 +0000 (13:53 +0900)
misc.c
psqlodbc.h

diff --git a/misc.c b/misc.c
index 82d0696761b133f3be124dbb9e1714d0cce2737f..f359ceb782a2edcc3850147014ec8007954dfee3 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -203,6 +203,7 @@ snprintf_len(char *buf, size_t size, const char *format, ...)
  * and repeat.
  */
 #ifdef WIN32
+#if (_MSC_VER < 1900)  /* vc14 provieds snprintf() */
 static int
 posix_vsnprintf(char *str, size_t size, const char *format, va_list ap)
 {
@@ -248,7 +249,8 @@ posix_snprintf(char *buf, size_t size, const char *format, ...)
    va_end(arglist);
    return len;
 }
-#endif
+#endif /* _MSC_VER */
+#endif /* WIN32 */
 
 #ifndef    HAVE_STRLCAT
 size_t
index ff595157a0fd29c69db3e9370ab5b9f310fa6e84..4b4d7ac3d7f5ba03250de759fb1579ea86026ba0 100644 (file)
@@ -232,15 +232,17 @@ typedef double SDOUBLE;
 #define    FALSE   (BOOL)0
 #endif /* FALSE */
 #else
+#if (_MSC_VER < 1900) /* vc12 or under */
 #define snprintf posix_snprintf
 extern int posix_snprintf(char *buf, size_t size, const char *format, ...);
+#define vsnprintf _vsnprintf
+#endif /* _MSC_VER */
 
 #ifndef strdup
 #define strdup _strdup
 #endif /* strdup */
 #define strnicmp _strnicmp
 #define stricmp _stricmp
-#define vsnprintf _vsnprintf
 #endif /* WIN32 */
 
 #ifndef    SQL_ATTR_APP_ROW_DESC