aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancis Dupont <Francis.Dupont@fdupont.fr>2014-10-13 15:09:43 +0800
committerDaniel Veillard <veillard@redhat.com>2014-10-13 15:09:43 +0800
commit12fd65434037d50429587792ed2e7e98f2fb739b (patch)
treec3b2b9460ae5a5d423dd5343581adc3b6714de85
parent8854e4631844eac8dbae10cc32904f27d5268af7 (diff)
downloadandroid_external_libxml2-12fd65434037d50429587792ed2e7e98f2fb739b.tar.gz
android_external_libxml2-12fd65434037d50429587792ed2e7e98f2fb739b.tar.bz2
android_external_libxml2-12fd65434037d50429587792ed2e7e98f2fb739b.zip
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).
-rw-r--r--include/win32config.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/win32config.h b/include/win32config.h
index 286d4a4c..40cf7df8 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