aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2004-06-14 12:13:12 +0000
committerDaniel Veillard <veillard@src.gnome.org>2004-06-14 12:13:12 +0000
commitfb382b89905d02caae2e5161a33553b930255915 (patch)
tree6d1c62171dd3d578315cdd613d50c9f91b32e990
parent306e33ce203398631f9ec9532b8d5151af8c2aa9 (diff)
downloadandroid_external_libxml2-fb382b89905d02caae2e5161a33553b930255915.tar.gz
android_external_libxml2-fb382b89905d02caae2e5161a33553b930255915.tar.bz2
android_external_libxml2-fb382b89905d02caae2e5161a33553b930255915.zip
patch from Igor for the default catalog path on Windows Daniel
* catalog.c: patch from Igor for the default catalog path on Windows Daniel
-rw-r--r--ChangeLog4
-rw-r--r--catalog.c99
-rw-r--r--config.h.in5
3 files changed, 45 insertions, 63 deletions
diff --git a/ChangeLog b/ChangeLog
index 555c026b..b5d7c054 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Mon Jun 14 14:11:52 CEST 2004 Daniel Veillard <daniel@veillard.com>
+
+ * catalog.c: patch from Igor for the default catalog path on Windows
+
Sat Jun 12 09:03:57 HKT 2004 William Brack <wbrack@mmm.com.hk>
* configure.in: apparently wasn't updated last time
diff --git a/catalog.c b/catalog.c
index 711761e7..b9f2840e 100644
--- a/catalog.c
+++ b/catalog.c
@@ -68,6 +68,13 @@
#define XML_SGML_DEFAULT_CATALOG "file:///etc/sgml/catalog"
#endif
+#if defined(_WIN32) && defined(_MSC_VER)
+#undef XML_XML_DEFAULT_CATALOG
+static char XML_XML_DEFAULT_CATALOG[256] = "file:///etc/xml/catalog";
+void* __stdcall GetModuleHandleA(const char*);
+unsigned long __stdcall GetModuleFileNameA(void*, char*, unsigned long);
+#endif
+
static int xmlExpandCatalog(xmlCatalogPtr catal, const char *filename);
/************************************************************************
@@ -2925,7 +2932,35 @@ xmlInitializeCatalog(void) {
catalogs = (const char *) getenv("XML_CATALOG_FILES");
if (catalogs == NULL)
+#if defined(_WIN32) && defined(_MSC_VER)
+ {
+ void* hmodule;
+ hmodule = GetModuleHandleA("libxml2.dll");
+ if (hmodule == NULL)
+ hmodule = GetModuleHandleA(NULL);
+ if (hmodule != NULL) {
+ char buf[256];
+ unsigned long len = GetModuleFileNameA(hmodule, buf, 255);
+ if (len != 0) {
+ char* p = &(buf[len]);
+ while (*p != '\\' && p > buf)
+ p--;
+ if (p != buf) {
+ xmlChar* uri;
+ strncpy(p, "\\..\\etc\\catalog", 255 - (p - buf));
+ uri = xmlCanonicPath(buf);
+ if (uri != NULL) {
+ strncpy(XML_XML_DEFAULT_CATALOG, uri, 255);
+ xmlFree(uri);
+ }
+ }
+ }
+ }
+ catalogs = XML_XML_DEFAULT_CATALOG;
+ }
+#else
catalogs = XML_XML_DEFAULT_CATALOG;
+#endif
catal = xmlCreateNewCatalog(XML_XML_CATALOG_TYPE,
xmlCatalogDefaultPrefer);
@@ -3509,37 +3544,7 @@ xmlCatalogLocalResolveURI(void *catalogs, const xmlChar *URI) {
*/
const xmlChar *
xmlCatalogGetSystem(const xmlChar *sysID) {
- xmlChar *ret;
- static xmlChar result[1000];
- static int msg = 0;
-
- if (!xmlCatalogInitialized)
- xmlInitializeCatalog();
-
- if (msg == 0) {
- xmlGenericError(xmlGenericErrorContext,
- "Use of deprecated xmlCatalogGetSystem() call\n");
- msg++;
- }
-
- if (sysID == NULL)
- return(NULL);
-
- /*
- * Check first the XML catalogs
- */
- if (xmlDefaultCatalog != NULL) {
- ret = xmlCatalogListXMLResolve(xmlDefaultCatalog->xml, NULL, sysID);
- if ((ret != NULL) && (ret != XML_CATAL_BREAK)) {
- snprintf((char *) result, sizeof(result) - 1, "%s", (char *) ret);
- result[sizeof(result) - 1] = 0;
- return(result);
- }
- }
-
- if (xmlDefaultCatalog != NULL)
- return(xmlCatalogGetSGMLSystem(xmlDefaultCatalog->sgml, sysID));
- return(NULL);
+ return xmlCatalogResolveSystem(sysID);
}
/**
@@ -3553,37 +3558,7 @@ xmlCatalogGetSystem(const xmlChar *sysID) {
*/
const xmlChar *
xmlCatalogGetPublic(const xmlChar *pubID) {
- xmlChar *ret;
- static xmlChar result[1000];
- static int msg = 0;
-
- if (!xmlCatalogInitialized)
- xmlInitializeCatalog();
-
- if (msg == 0) {
- xmlGenericError(xmlGenericErrorContext,
- "Use of deprecated xmlCatalogGetPublic() call\n");
- msg++;
- }
-
- if (pubID == NULL)
- return(NULL);
-
- /*
- * Check first the XML catalogs
- */
- if (xmlDefaultCatalog != NULL) {
- ret = xmlCatalogListXMLResolve(xmlDefaultCatalog->xml, pubID, NULL);
- if ((ret != NULL) && (ret != XML_CATAL_BREAK)) {
- snprintf((char *) result, sizeof(result) - 1, "%s", (char *) ret);
- result[sizeof(result) - 1] = 0;
- return(result);
- }
- }
-
- if (xmlDefaultCatalog != NULL)
- return(xmlCatalogGetSGMLPublic(xmlDefaultCatalog->sgml, pubID));
- return(NULL);
+ return xmlCatalogResolvePublic(pubID);
}
#endif /* LIBXML_CATALOG_ENABLED */
diff --git a/config.h.in b/config.h.in
index 915ef0c8..f54d0bf7 100644
--- a/config.h.in
+++ b/config.h.in
@@ -256,7 +256,7 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
-/* Define if compiler has function prototypes */
+/* Define to 1 if the C compiler supports function prototypes. */
#undef PROTOTYPES
/* Determine what socket length (socklen_t) data type is */
@@ -274,6 +274,9 @@
/* Using the Win32 Socket implementation */
#undef _WINSOCKAPI_
+/* Define like PROTOTYPES; this can be used by system headers. */
+#undef __PROTOTYPES
+
/* Win32 Std C name mangling work-around */
#undef snprintf