From 36b7014b2055b303b34e6a753f96da988406c2de Mon Sep 17 00:00:00 2001 From: Hans Hinrichsen Date: Wed, 6 Jan 2016 08:58:53 -0600 Subject: [PATCH] Visual Studio 2015 Changes snprintf shouldn't be defined in a macro in VS2015 and above due to its C99 changes --- cat/test/test.h | 2 +- cpio/cpio_windows.h | 6 ++++-- cpio/test/test.h | 2 +- libarchive/archive_write_set_format_warc.c | 2 +- libarchive/test/test.h | 2 +- tar/test/test.h | 2 +- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/cat/test/test.h b/cat/test/test.h index 68473851c..89b593108 100644 --- a/cat/test/test.h +++ b/cat/test/test.h @@ -92,7 +92,7 @@ #endif /* Visual Studio */ -#ifdef _MSC_VER +#if defined(_MSC_VER) && _MSC_VER < 1900 #define snprintf sprintf_s #endif diff --git a/cpio/cpio_windows.h b/cpio/cpio_windows.h index d8576b316..970a63df6 100644 --- a/cpio/cpio_windows.h +++ b/cpio/cpio_windows.h @@ -36,8 +36,10 @@ #define getpwnam(name) NULL #define getpwuid(id) NULL -#ifdef _MSC_VER -#define snprintf sprintf_s +#if defined(_MSC_VER) + #if _MSC_VER < 1900 + #define snprintf sprintf_s + #endif // _MSC_VER < 1900 #define strdup _strdup #define open _open #define read _read diff --git a/cpio/test/test.h b/cpio/test/test.h index 9898be65c..5a39c686c 100644 --- a/cpio/test/test.h +++ b/cpio/test/test.h @@ -90,7 +90,7 @@ #endif /* Visual Studio */ -#ifdef _MSC_VER +#if defined(_MSC_VER) && _MSC_VER < 1900 #define snprintf sprintf_s #endif diff --git a/libarchive/archive_write_set_format_warc.c b/libarchive/archive_write_set_format_warc.c index 923041ec4..ea66929a9 100644 --- a/libarchive/archive_write_set_format_warc.c +++ b/libarchive/archive_write_set_format_warc.c @@ -402,7 +402,7 @@ _popul_ehdr(struct archive_string *tgt, size_t tsz, warc_essential_hdr_t hdr) * handle the minimum number following '%'. * So we have to use snprintf function here instead * of archive_string_snprintf function. */ -#if defined(_WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) && !( defined(_MSC_VER) && _MSC_VER >= 1900) #define snprintf _snprintf #endif snprintf( diff --git a/libarchive/test/test.h b/libarchive/test/test.h index f80565bc1..bde7c1d77 100644 --- a/libarchive/test/test.h +++ b/libarchive/test/test.h @@ -89,7 +89,7 @@ #endif /* Visual Studio */ -#ifdef _MSC_VER +#if defined(_MSC_VER) && _MSC_VER < 1900 #define snprintf sprintf_s #endif diff --git a/tar/test/test.h b/tar/test/test.h index 68473851c..89b593108 100644 --- a/tar/test/test.h +++ b/tar/test/test.h @@ -92,7 +92,7 @@ #endif /* Visual Studio */ -#ifdef _MSC_VER +#if defined(_MSC_VER) && _MSC_VER < 1900 #define snprintf sprintf_s #endif -- 2.47.2