summaryrefslogtreecommitdiff
path: root/catalog.c
diff options
context:
space:
mode:
authorMike Hommey <mh@glandium.org>2004-07-06 12:57:17 +0000
committerMike Hommey <mh@glandium.org>2004-07-06 12:57:17 +0000
commitc14c53a3645d81281058d4bb4cff24fa8d6faf33 (patch)
tree29bccc2e7499af078a3d1cdcfb517a1dee891be5 /catalog.c
parentd4e028c96af89ade493b440d4f2de6b684c03a06 (diff)
downloadlibxml2-c14c53a3645d81281058d4bb4cff24fa8d6faf33.tar.gz
Load /tmp/tmp.DIvcnD/libxml2-2.6.11 intoupstream/2.6.11
packages/libxml2/branches/upstream/current.
Diffstat (limited to 'catalog.c')
-rw-r--r--catalog.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/catalog.c b/catalog.c
index 7c328f2..1ef78e7 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);
@@ -3510,7 +3545,7 @@ xmlCatalogLocalResolveURI(void *catalogs, const xmlChar *URI) {
const xmlChar *
xmlCatalogGetSystem(const xmlChar *sysID) {
xmlChar *ret;
- xmlChar result[1000];
+ static xmlChar result[1000];
static int msg = 0;
if (!xmlCatalogInitialized)
@@ -3554,7 +3589,7 @@ xmlCatalogGetSystem(const xmlChar *sysID) {
const xmlChar *
xmlCatalogGetPublic(const xmlChar *pubID) {
xmlChar *ret;
- xmlChar result[1000];
+ static xmlChar result[1000];
static int msg = 0;
if (!xmlCatalogInitialized)