Revision: 534
http://www.exim.org/viewvc/pcre2?view=rev&revision=534
Author: ph10
Date: 2016-06-26 17:21:23 +0100 (Sun, 26 Jun 2016)
Log Message:
-----------
Add MSVC snprintf fix to pcre2posix.c, which no longer includes
pcre2_internal.h.
Modified Paths:
--------------
code/trunk/ChangeLog
code/trunk/src/pcre2posix.c
Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog 2016-06-24 09:07:15 UTC (rev 533)
+++ code/trunk/ChangeLog 2016-06-26 16:21:23 UTC (rev 534)
@@ -84,7 +84,9 @@
18. Two minor fixes for MSVC compilation: (a) removal of apparently incorrect
"const" qualifiers in pcre2test and (b) defining snprintf as _snprintf for
-older MSVC compilers.
+older MSVC compilers. This has been done both in src/pcre2_internal.h for most
+of the library, and also in src/pcre2posix.c, which no longer includes
+pcre2_internal.h (see 24 below).
19. Applied Chris Wilson's patch (Bugzilla #1681) to CMakeLists.txt for MSVC
static compilation. Subsequently applied Chris Wilson's second patch, putting
Modified: code/trunk/src/pcre2posix.c
===================================================================
--- code/trunk/src/pcre2posix.c 2016-06-24 09:07:15 UTC (rev 533)
+++ code/trunk/src/pcre2posix.c 2016-06-26 16:21:23 UTC (rev 534)
@@ -58,7 +58,15 @@
# define PCRE2POSIX_EXP_DEFN __declspec(dllexport)
#endif
+/* Older versions of MSVC lack snprintf(). This define allows for
+warning/error-free compilation and testing with MSVC compilers back to at least
+MSVC 10/2010. Except for VC6 (which is missing some fundamentals and fails). */
+#if defined(_MSC_VER) && (_MSC_VER < 1900)
+#define snprintf _snprintf
+#endif
+
+
/* Compile-time error numbers start at this value. It should probably never be
changed. This #define is a copy of the one in pcre2_internal.h. */