[Pcre-svn] [503] code/trunk: Define snprintf as _snprintf fo…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [503] code/trunk: Define snprintf as _snprintf for older MSVC compilers.
Revision: 503
          http://www.exim.org/viewvc/pcre2?view=rev&revision=503
Author:   ph10
Date:     2016-02-29 18:31:30 +0000 (Mon, 29 Feb 2016)
Log Message:
-----------
Define snprintf as _snprintf for older MSVC compilers.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/src/pcre2_internal.h


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2016-02-29 17:43:01 UTC (rev 502)
+++ code/trunk/ChangeLog    2016-02-29 18:31:30 UTC (rev 503)
@@ -82,7 +82,11 @@
 17. Fixed typo ("&&" for "&") in pcre2_study(). Fortunately, this could not 
 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.

+
Version 10.21 12-January-2016
-----------------------------


Modified: code/trunk/src/pcre2_internal.h
===================================================================
--- code/trunk/src/pcre2_internal.h    2016-02-29 17:43:01 UTC (rev 502)
+++ code/trunk/src/pcre2_internal.h    2016-02-29 18:31:30 UTC (rev 503)
@@ -73,6 +73,14 @@
 #include <valgrind/memcheck.h>
 #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
+
/* When compiling a DLL for Windows, the exported symbols have to be declared
using some MS magic. I found some useful information on this web page:
http://msdn2.microsoft.com/en-us/library/y4h7bcy6(VS.80).aspx. According to the