[libxml2] Visual Studio 14 CTP defines snprintf()



commit 12fd65434037d50429587792ed2e7e98f2fb739b
Author: Francis Dupont <Francis Dupont fdupont fr>
Date:   Mon Oct 13 15:09:43 2014 +0800

    Visual Studio 14 CTP defines snprintf()
    
    For https://bugzilla.gnome.org/show_bug.cgi?id=737937
    
    Visual Studio 14 CTP (the VS which comes with Windows 10) defines snprintf().
    It could be seen as a good idea as snprintf() is part of the C99 standard but
    unfortunately libxml2 as many packages defines snprintf as _snprintf, the
    function to use for any previous versions of the Visual Studio runtime. More,
    to avoid hiding/shadowing snprintf() declaration in stdio.h is protected by an
    "#ifdef snprintf" followed by an "#error", so compilation fails.
    
    But the fix is easy: the corresponding C/C++ compiler defines _MSC_VER to 1900
    so it is enough to guard the snprintf define against it, cf. the attached patch
    for win32config.h (from 2.9.1 "latest" tarball).

 include/win32config.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/include/win32config.h b/include/win32config.h
index 286d4a4..40cf7df 100644
--- a/include/win32config.h
+++ b/include/win32config.h
@@ -97,7 +97,9 @@ static int isnan (double d) {
 
 #if defined(_MSC_VER)
 #define mkdir(p,m) _mkdir(p)
+#if _MSC_VER < 1900
 #define snprintf _snprintf
+#endif
 #if _MSC_VER < 1500
 #define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a)
 #endif


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