From 26603f25f73142a45b5b964bb9bb2e59bc0908d4 Mon Sep 17 00:00:00 2001
From: Alexandre Julliard <julliard@winehq.org>
Date: Thu, 24 Feb 2011 13:11:53 +0100
Subject: [PATCH] msxml3: Include the system libxml headers before the Windows
 headers.

[Alexandre Rostovtsev <tetromino@gentoo.org>: backport to wine-1.2.3]
---
 dlls/msxml3/attribute.c     |    6 ++++++
 dlls/msxml3/bsc.c           |    6 ++++++
 dlls/msxml3/cdata.c         |    5 +++++
 dlls/msxml3/comment.c       |    5 +++++
 dlls/msxml3/dispex.c        |    5 +++++
 dlls/msxml3/docfrag.c       |    5 +++++
 dlls/msxml3/domdoc.c        |   11 +++++++++--
 dlls/msxml3/domimpl.c       |    5 +++++
 dlls/msxml3/element.c       |    5 +++++
 dlls/msxml3/entityref.c     |    5 +++++
 dlls/msxml3/factory.c       |    5 +++++
 dlls/msxml3/httprequest.c   |    6 ++++++
 dlls/msxml3/main.c          |   15 +++++++++++++++
 dlls/msxml3/msxml_private.h |   23 -----------------------
 dlls/msxml3/node.c          |   31 +++++++++++++++++++++++++++----
 dlls/msxml3/nodelist.c      |    5 +++++
 dlls/msxml3/nodemap.c       |    5 +++++
 dlls/msxml3/parseerror.c    |    5 +++++
 dlls/msxml3/pi.c            |    5 +++++
 dlls/msxml3/queryresult.c   |    9 +++++++--
 dlls/msxml3/regsvr.c        |    4 ++++
 dlls/msxml3/saxreader.c     |   10 +++++++---
 dlls/msxml3/schema.c        |   12 ++++++++++++
 dlls/msxml3/text.c          |    5 +++++
 dlls/msxml3/xmldoc.c        |    5 +++++
 dlls/msxml3/xmlelem.c       |    5 +++++
 26 files changed, 174 insertions(+), 34 deletions(-)

diff --git a/dlls/msxml3/attribute.c b/dlls/msxml3/attribute.c
index d78fa47..3df93d6 100644
--- a/dlls/msxml3/attribute.c
+++ b/dlls/msxml3/attribute.c
@@ -23,6 +23,12 @@
 #include "config.h"
 
 #include <stdarg.h>
+#ifdef HAVE_LIBXML2
+# include <libxml/parser.h>
+# include <libxml/xmlerror.h>
+# include <libxml/HTMLtree.h>
+#endif
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
diff --git a/dlls/msxml3/bsc.c b/dlls/msxml3/bsc.c
index b24e04c..01a09a5 100644
--- a/dlls/msxml3/bsc.c
+++ b/dlls/msxml3/bsc.c
@@ -23,6 +23,12 @@
 
 #include <stdarg.h>
 #include <assert.h>
+#ifdef HAVE_LIBXML2
+# include <libxml/parser.h>
+# include <libxml/xmlerror.h>
+# include <libxml/HTMLtree.h>
+#endif
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
diff --git a/dlls/msxml3/cdata.c b/dlls/msxml3/cdata.c
index 3fba66c..caf8cd8 100644
--- a/dlls/msxml3/cdata.c
+++ b/dlls/msxml3/cdata.c
@@ -23,6 +23,11 @@
 #include "config.h"
 
 #include <stdarg.h>
+#ifdef HAVE_LIBXML2
+# include <libxml/parser.h>
+# include <libxml/xmlerror.h>
+#endif
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
diff --git a/dlls/msxml3/comment.c b/dlls/msxml3/comment.c
index e74de07..1cabfa3 100644
--- a/dlls/msxml3/comment.c
+++ b/dlls/msxml3/comment.c
@@ -23,6 +23,11 @@
 #include "config.h"
 
 #include <stdarg.h>
+#ifdef HAVE_LIBXML2
+# include <libxml/parser.h>
+# include <libxml/xmlerror.h>
+#endif
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
diff --git a/dlls/msxml3/dispex.c b/dlls/msxml3/dispex.c
index 09b71fe..6b01b15 100644
--- a/dlls/msxml3/dispex.c
+++ b/dlls/msxml3/dispex.c
@@ -22,6 +22,11 @@
 
 #include <stdarg.h>
 #include <assert.h>
+#ifdef HAVE_LIBXML2
+# include <libxml/parser.h>
+# include <libxml/xmlerror.h>
+#endif
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
diff --git a/dlls/msxml3/docfrag.c b/dlls/msxml3/docfrag.c
index fff3f62..bebd252 100644
--- a/dlls/msxml3/docfrag.c
+++ b/dlls/msxml3/docfrag.c
@@ -23,6 +23,11 @@
 #include "config.h"
 
 #include <stdarg.h>
+#ifdef HAVE_LIBXML2
+# include <libxml/parser.h>
+# include <libxml/xmlerror.h>
+#endif
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c
index 0007503..e6a61e4 100644
--- a/dlls/msxml3/domdoc.c
+++ b/dlls/msxml3/domdoc.c
@@ -25,6 +25,15 @@
 
 #include <stdarg.h>
 #include <assert.h>
+#ifdef HAVE_LIBXML2
+# include <libxml/parser.h>
+# include <libxml/xmlerror.h>
+# include <libxml/xpathInternals.h>
+# include <libxml/xmlsave.h>
+# include <libxml/SAX2.h>
+# include <libxml/parserInternals.h>
+#endif
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
@@ -47,8 +56,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msxml);
 
 #ifdef HAVE_LIBXML2
 
-#include <libxml/xmlsave.h>
-
 /* not defined in older versions */
 #define XML_SAVE_FORMAT     1
 #define XML_SAVE_NO_DECL    2
diff --git a/dlls/msxml3/domimpl.c b/dlls/msxml3/domimpl.c
index dd518a1..c6794ac 100644
--- a/dlls/msxml3/domimpl.c
+++ b/dlls/msxml3/domimpl.c
@@ -23,6 +23,11 @@
 #include "config.h"
 
 #include <stdarg.h>
+#ifdef HAVE_LIBXML2
+# include <libxml/parser.h>
+# include <libxml/xmlerror.h>
+#endif
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
diff --git a/dlls/msxml3/element.c b/dlls/msxml3/element.c
index 617c008..1b5c693 100644
--- a/dlls/msxml3/element.c
+++ b/dlls/msxml3/element.c
@@ -23,6 +23,11 @@
 #include "config.h"
 
 #include <stdarg.h>
+#ifdef HAVE_LIBXML2
+# include <libxml/parser.h>
+# include <libxml/xmlerror.h>
+#endif
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
diff --git a/dlls/msxml3/entityref.c b/dlls/msxml3/entityref.c
index db46193..1baea6e 100644
--- a/dlls/msxml3/entityref.c
+++ b/dlls/msxml3/entityref.c
@@ -23,6 +23,11 @@
 #include "config.h"
 
 #include <stdarg.h>
+#ifdef HAVE_LIBXML2
+# include <libxml/parser.h>
+# include <libxml/xmlerror.h>
+#endif
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
diff --git a/dlls/msxml3/factory.c b/dlls/msxml3/factory.c
index 3fd229c..45df9f0 100644
--- a/dlls/msxml3/factory.c
+++ b/dlls/msxml3/factory.c
@@ -24,6 +24,11 @@
 #include "config.h"
 
 #include <stdarg.h>
+#ifdef HAVE_LIBXML2
+# include <libxml/parser.h>
+# include <libxml/xmlerror.h>
+#endif
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
diff --git a/dlls/msxml3/httprequest.c b/dlls/msxml3/httprequest.c
index 4585484..be1a5f7 100644
--- a/dlls/msxml3/httprequest.c
+++ b/dlls/msxml3/httprequest.c
@@ -22,6 +22,12 @@
 #include "config.h"
 
 #include <stdarg.h>
+#ifdef HAVE_LIBXML2
+# include <libxml/parser.h>
+# include <libxml/xmlerror.h>
+# include <libxml/encoding.h>
+#endif
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
diff --git a/dlls/msxml3/main.c b/dlls/msxml3/main.c
index 60b0cbd..47a89b1 100644
--- a/dlls/msxml3/main.c
+++ b/dlls/msxml3/main.c
@@ -25,6 +25,21 @@
 #define COBJMACROS
 
 #include <stdarg.h>
+#ifdef HAVE_LIBXML2
+# include <libxml/parser.h>
+# include <libxml/xmlerror.h>
+# ifdef SONAME_LIBXSLT
+#  ifdef HAVE_LIBXSLT_PATTERN_H
+#   include <libxslt/pattern.h>
+#  endif
+#  ifdef HAVE_LIBXSLT_TRANSFORM_H
+#   include <libxslt/transform.h>
+#  endif
+#  include <libxslt/xsltutils.h>
+#  include <libxslt/xsltInternals.h>
+# endif
+#endif
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
diff --git a/dlls/msxml3/msxml_private.h b/dlls/msxml3/msxml_private.h
index e0279f1..e1fbb59 100644
--- a/dlls/msxml3/msxml_private.h
+++ b/dlls/msxml3/msxml_private.h
@@ -102,10 +102,6 @@ BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
 
 #ifdef HAVE_LIBXML2
 
-#ifdef HAVE_LIBXML_PARSER_H
-#include <libxml/parser.h>
-#endif
-
 /* constructors */
 extern IUnknown         *create_domdoc( xmlNodePtr document );
 extern IUnknown         *create_xmldoc( void );
@@ -184,25 +180,6 @@ static inline BSTR bstr_from_xmlChar(const xmlChar *str)
 
 #endif
 
-void* libxslt_handle;
-#ifdef SONAME_LIBXSLT
-# ifdef HAVE_LIBXSLT_PATTERN_H
-#  include <libxslt/pattern.h>
-# endif
-# ifdef HAVE_LIBXSLT_TRANSFORM_H
-#  include <libxslt/transform.h>
-# endif
-# include <libxslt/xsltutils.h>
-# include <libxslt/xsltInternals.h>
-
-# define MAKE_FUNCPTR(f) extern typeof(f) * p##f
-MAKE_FUNCPTR(xsltApplyStylesheet);
-MAKE_FUNCPTR(xsltCleanupGlobals);
-MAKE_FUNCPTR(xsltFreeStylesheet);
-MAKE_FUNCPTR(xsltParseStylesheetDoc);
-# undef MAKE_FUNCPTR
-#endif
-
 extern IXMLDOMParseError *create_parseError( LONG code, BSTR url, BSTR reason, BSTR srcText,
                                              LONG line, LONG linepos, LONG filepos );
 extern HRESULT DOMDocument_create( IUnknown *pUnkOuter, LPVOID *ppObj );
diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c
index bbdcb5d..2980566 100644
--- a/dlls/msxml3/node.c
+++ b/dlls/msxml3/node.c
@@ -24,6 +24,23 @@
 
 #include <stdarg.h>
 #include <assert.h>
+
+#ifdef HAVE_LIBXML2
+# include <libxml/parser.h>
+# include <libxml/xmlerror.h>
+# include <libxml/HTMLtree.h>
+# ifdef SONAME_LIBXSLT
+#  ifdef HAVE_LIBXSLT_PATTERN_H
+#   include <libxslt/pattern.h>
+#  endif
+#  ifdef HAVE_LIBXSLT_TRANSFORM_H
+#   include <libxslt/transform.h>
+#  endif
+#  include <libxslt/xsltutils.h>
+#  include <libxslt/xsltInternals.h>
+# endif
+#endif
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
@@ -33,16 +50,22 @@
 
 #include "msxml_private.h"
 
-#ifdef HAVE_LIBXML2
-# include <libxml/HTMLtree.h>
-#endif
-
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
 
 #ifdef HAVE_LIBXML2
 
+#ifdef SONAME_LIBXSLT
+extern void* libxslt_handle;
+# define MAKE_FUNCPTR(f) extern typeof(f) * p##f
+MAKE_FUNCPTR(xsltApplyStylesheet);
+MAKE_FUNCPTR(xsltCleanupGlobals);
+MAKE_FUNCPTR(xsltFreeStylesheet);
+MAKE_FUNCPTR(xsltParseStylesheetDoc);
+# undef MAKE_FUNCPTR
+#endif
+
 static const WCHAR szBinBase64[]  = {'b','i','n','.','b','a','s','e','6','4',0};
 static const WCHAR szString[]     = {'s','t','r','i','n','g',0};
 static const WCHAR szNumber[]     = {'n','u','m','b','e','r',0};
diff --git a/dlls/msxml3/nodelist.c b/dlls/msxml3/nodelist.c
index f643c5e..4b2bba9 100644
--- a/dlls/msxml3/nodelist.c
+++ b/dlls/msxml3/nodelist.c
@@ -23,6 +23,11 @@
 #include "config.h"
 
 #include <stdarg.h>
+#ifdef HAVE_LIBXML2
+# include <libxml/parser.h>
+# include <libxml/xmlerror.h>
+#endif
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
diff --git a/dlls/msxml3/nodemap.c b/dlls/msxml3/nodemap.c
index 7d23ec8..d3d9c38 100644
--- a/dlls/msxml3/nodemap.c
+++ b/dlls/msxml3/nodemap.c
@@ -23,6 +23,11 @@
 #define COBJMACROS
 
 #include <stdarg.h>
+#ifdef HAVE_LIBXML2
+# include <libxml/parser.h>
+# include <libxml/xmlerror.h>
+#endif
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
diff --git a/dlls/msxml3/parseerror.c b/dlls/msxml3/parseerror.c
index 4b0dc57..89f14ca 100644
--- a/dlls/msxml3/parseerror.c
+++ b/dlls/msxml3/parseerror.c
@@ -25,6 +25,11 @@
 
 #include <stdarg.h>
 #include <assert.h>
+#ifdef HAVE_LIBXML2
+# include <libxml/parser.h>
+# include <libxml/xmlerror.h>
+#endif
+
 #include "windef.h"
 #include "winbase.h"
 #include "winerror.h"
diff --git a/dlls/msxml3/pi.c b/dlls/msxml3/pi.c
index 0baefe4..3ebc1bf 100644
--- a/dlls/msxml3/pi.c
+++ b/dlls/msxml3/pi.c
@@ -23,6 +23,11 @@
 #include "config.h"
 
 #include <stdarg.h>
+#ifdef HAVE_LIBXML2
+# include <libxml/parser.h>
+# include <libxml/xmlerror.h>
+#endif
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
diff --git a/dlls/msxml3/queryresult.c b/dlls/msxml3/queryresult.c
index 2c6f23e..8613b20 100644
--- a/dlls/msxml3/queryresult.c
+++ b/dlls/msxml3/queryresult.c
@@ -24,6 +24,13 @@
 #include "config.h"
 
 #include <stdarg.h>
+#ifdef HAVE_LIBXML2
+# include <libxml/parser.h>
+# include <libxml/xmlerror.h>
+# include <libxml/xpath.h>
+# include <libxml/xpathInternals.h>
+#endif
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
@@ -48,8 +55,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msxml);
 
 #ifdef HAVE_LIBXML2
 
-#include <libxml/xpath.h>
-
 typedef struct _queryresult
 {
     DispatchEx dispex;
diff --git a/dlls/msxml3/regsvr.c b/dlls/msxml3/regsvr.c
index 415e5af..864d61e 100644
--- a/dlls/msxml3/regsvr.c
+++ b/dlls/msxml3/regsvr.c
@@ -24,6 +24,10 @@
 
 #include <stdarg.h>
 #include <string.h>
+#ifdef HAVE_LIBXML2
+# include <libxml/parser.h>
+# include <libxml/xmlerror.h>
+#endif
 
 #define COBJMACROS
 
diff --git a/dlls/msxml3/saxreader.c b/dlls/msxml3/saxreader.c
index eca9f1d..f2d340e 100644
--- a/dlls/msxml3/saxreader.c
+++ b/dlls/msxml3/saxreader.c
@@ -24,6 +24,13 @@
 
 #include <stdarg.h>
 #include <assert.h>
+#ifdef HAVE_LIBXML2
+# include <libxml/parser.h>
+# include <libxml/xmlerror.h>
+# include <libxml/SAX2.h>
+# include <libxml/parserInternals.h>
+#endif
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
@@ -43,9 +50,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msxml);
 
 #ifdef HAVE_LIBXML2
 
-#include <libxml/SAX2.h>
-#include <libxml/parserInternals.h>
-
 typedef struct _saxreader
 {
     const struct IVBSAXXMLReaderVtbl *lpVBSAXXMLReaderVtbl;
diff --git a/dlls/msxml3/schema.c b/dlls/msxml3/schema.c
index 72d7854..c1465c0 100644
--- a/dlls/msxml3/schema.c
+++ b/dlls/msxml3/schema.c
@@ -23,6 +23,18 @@
 #include "config.h"
 
 #include <stdarg.h>
+#ifdef HAVE_LIBXML2
+# include <libxml/parser.h>
+# include <libxml/xmlerror.h>
+# include <libxml/tree.h>
+# include <libxml/xmlschemas.h>
+# include <libxml/schemasInternals.h>
+# include <libxml/hash.h>
+# include <libxml/parser.h>
+# include <libxml/parserInternals.h>
+# include <libxml/xmlIO.h>
+#endif
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
diff --git a/dlls/msxml3/text.c b/dlls/msxml3/text.c
index fdcb06b..72b2ffd 100644
--- a/dlls/msxml3/text.c
+++ b/dlls/msxml3/text.c
@@ -24,6 +24,11 @@
 #include "config.h"
 
 #include <stdarg.h>
+#ifdef HAVE_LIBXML2
+# include <libxml/parser.h>
+# include <libxml/xmlerror.h>
+#endif
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
diff --git a/dlls/msxml3/xmldoc.c b/dlls/msxml3/xmldoc.c
index d1a010f..0d1006e 100644
--- a/dlls/msxml3/xmldoc.c
+++ b/dlls/msxml3/xmldoc.c
@@ -23,6 +23,11 @@
 #include "config.h"
 
 #include <stdarg.h>
+#ifdef HAVE_LIBXML2
+# include <libxml/parser.h>
+# include <libxml/xmlerror.h>
+#endif
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
diff --git a/dlls/msxml3/xmlelem.c b/dlls/msxml3/xmlelem.c
index a71b18b..a818d14 100644
--- a/dlls/msxml3/xmlelem.c
+++ b/dlls/msxml3/xmlelem.c
@@ -23,6 +23,11 @@
 #include "config.h"
 
 #include <stdarg.h>
+#ifdef HAVE_LIBXML2
+# include <libxml/parser.h>
+# include <libxml/xmlerror.h>
+#endif
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
-- 
1.7.8.3

