File fix-global-catalog-access.diff of Package mingw32-libxml2

--- catalog.c.orig	2014-02-25 00:59:47.687987162 +0100
+++ catalog.c	2014-02-25 01:18:29.660844315 +0100
@@ -76,7 +76,7 @@
 #define XML_SGML_DEFAULT_CATALOG "file:///etc/sgml/catalog"
 #endif
 
-#if defined(_WIN32) && defined(_MSC_VER)
+#if defined(_WIN32)
 #undef XML_XML_DEFAULT_CATALOG
 static char XML_XML_DEFAULT_CATALOG[256] = "file:///etc/xml/catalog";
 #if defined(_WIN32_WCE)
@@ -84,8 +84,7 @@
 #define GetModuleHandleA GetModuleHandle
 #define GetModuleFileNameA GetModuleFileName
 #else
-void* __stdcall GetModuleHandleA(const char*);
-unsigned long __stdcall GetModuleFileNameA(void*, char*, unsigned long);
+#include <windows.h>
 #endif
 #endif
 
@@ -3113,10 +3112,12 @@
 
 	catalogs = (const char *) getenv("XML_CATALOG_FILES");
 	if (catalogs == NULL)
-#if defined(_WIN32) && defined(_MSC_VER)
+#if defined(_WIN32)
     {
-		void* hmodule;
-		hmodule = GetModuleHandleA("libxml2.dll");
+		HMODULE hmodule = NULL;
+		GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | 
+			GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
+			(LPCSTR) &xmlInitializeCatalog, &hmodule);
 		if (hmodule == NULL)
 			hmodule = GetModuleHandleA(NULL);
 		if (hmodule != NULL) {
@@ -3128,7 +3129,7 @@
 					p--;
 				if (p != buf) {
 					xmlChar* uri;
-					strncpy(p, "\\..\\etc\\catalog", 255 - (p - buf));
+					strncpy(p, "\\..\\etc\\xml\\catalog", 255 - (p - buf));
 					uri = xmlCanonicPath(buf);
 					if (uri != NULL) {
 						strncpy(XML_XML_DEFAULT_CATALOG, uri, 255);
openSUSE Build Service is sponsored by