psqlodbc.git / summary / log / commit / refs
commit e50db92a4f62573050ea3ee1c6908067948d3604
Author: Hiroshi Inoue <h-inoue@dream.email.ne.jp>
Date: Sun Jun 04 04:53:34 2017 +0000
Visual C++ 14 provides snprintf().
misc.c | 4 +++-
psqlodbc.h | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/misc.c b/misc.c
index 82d06967..f359ceb7 100644
--- 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
diff --git a/psqlodbc.h b/psqlodbc.h
index ff595157..4b4d7ac3 100644
--- a/psqlodbc.h
+++ b/psqlodbc.h
@@ -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
[parent: 55972afef0d2]