Re: [xml] win32\VC10\config.h and VS 2015



Now is an odd time to be writing snprintf fallbacks for older MSVC versions - I look forward to never building with such versions again!

Could be useful for some people of course, but it is a diminishing audience.

On Fri, Mar 11, 2016 at 1:24 PM, Nick Wellnhofer <wellnhofer aevum de> wrote:
On 07/03/2016 22:46, Bruce Dawson wrote:
The config.h file in win32\VC10 is incompatible with VS 2015 because VS 2015
provides an implementation of snprintf and prohibits using the preprocessor to
define it. Therefor an ifdef check is needed around that definition in
VC10\config.h. Here is a patch that is compatible with the change that we made
to Chromium's copy:


diff --git a/win32/VC10/config.h b/win32/VC10/config.h
index 8629944..891b57e 100644
--- a/win32/VC10/config.h
+++ b/win32/VC10/config.h
@@ -96,7 +96,9 @@ static int isnan (double d) {

  #if defined(_MSC_VER)
  #define mkdir(p,m) _mkdir(p)
+#if _MSC_VER < 1900 // Cannot define this in VS 2015 and above!
  #define snprintf _snprintf
+#endif
  #if _MSC_VER < 1500
  #define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a)
  #endif


It would be great to get that same patch in libxml2, and other developers will
need it if they use VC10\config.h.

If you're at it, can you implement a better snprintf fallback for older MSVC versions? Here's the change I made to libxslt:

https://git.gnome.org/browse/libxslt/commit/?id=e75b5da121cdc67cb2303b1e2b77d5dd1cdf2784

For background information see:

https://bugzilla.gnome.org/show_bug.cgi?id=756691
http://stackoverflow.com/a/8712996/1956010

Nick




--
Bruce Dawson


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]