Add MSVC snprintf fix to pcre2posix.c, which no longer includes

pcre2_internal.h.
This commit is contained in:
Philip.Hazel 2016-06-26 16:21:23 +00:00
parent d6bec3e2a5
commit f16f5395cd
2 changed files with 11 additions and 1 deletions

View File

@ -84,7 +84,9 @@ actually affect anything, by sheer luck.
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

View File

@ -58,6 +58,14 @@ previously been set. */
# 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. */