* libxslt/extensions.c: applied another patch from Joel Reed
Daniel
+Sun Jan 16 00:09:11 CET 2005 Daniel Veillard <daniel@veillard.com>
+
+ * libxslt/extensions.c: applied another patch from Joel Reed
+
Sat Jan 15 13:54:28 CET 2005 Daniel Veillard <daniel@veillard.com>
* tests/plugins/plugin.* tests/Makefile.am libxslt/extensions.c
Sat Jan 15 13:54:28 CET 2005 Daniel Veillard <daniel@veillard.com>
* tests/plugins/plugin.* tests/Makefile.am libxslt/extensions.c
xmlModulePtr m;
exsltRegisterFunction regfunc;
xmlChar *ext_name;
xmlModulePtr m;
exsltRegisterFunction regfunc;
xmlChar *ext_name;
- xmlChar module_filename[PATH_MAX];
+ char module_filename[PATH_MAX];
const xmlChar *ext_directory = NULL;
const xmlChar *protocol = NULL;
xmlChar *i, *regfunc_name;
const xmlChar *ext_directory = NULL;
const xmlChar *protocol = NULL;
xmlChar *i, *regfunc_name;
}
/* transform extension namespace into a module name */
}
/* transform extension namespace into a module name */
- protocol = xmlStrstr(URI, "://");
+ protocol = xmlStrstr(URI, BAD_CAST "://");
if (protocol == NULL) {
ext_name = xmlStrdup(URI);
} else {
if (protocol == NULL) {
ext_name = xmlStrdup(URI);
} else {
*i = '\0';
/* determine module directory */
*i = '\0';
/* determine module directory */
- ext_directory = getenv(BAD_CAST "LIBXSLT_PLUGINS_PATH");
+ ext_directory = (xmlChar *) getenv("LIBXSLT_PLUGINS_PATH");
+
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+ xsltGenericDebug(xsltGenericDebugContext,
+ "LIBXSLT_PLUGINS_PATH is %s\n", ext_directory);
+#endif
+
if (NULL == ext_directory)
if (NULL == ext_directory)
- ext_directory = LIBXSLT_DEFAULT_PLUGINS_PATH();
+ ext_directory = BAD_CAST LIBXSLT_DEFAULT_PLUGINS_PATH();
if (NULL == ext_directory)
return (-1);
/* build the module filename, and confirm the module exists */
if (NULL == ext_directory)
return (-1);
/* build the module filename, and confirm the module exists */
- xmlStrPrintf(module_filename, sizeof(module_filename), "%s/%s%s",
+ xmlStrPrintf((xmlChar *) module_filename, sizeof(module_filename),
+ BAD_CAST "%s/%s%s",
ext_directory, ext_name, LIBXML_MODULE_EXTENSION);
ext_directory, ext_name, LIBXML_MODULE_EXTENSION);
+
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+ xsltGenericDebug(xsltGenericDebugContext,
+ "Attempting to load plugin: %s for URI: %s\n",
+ module_filename, URI);
+#endif
+
if (1 != xmlCheckFilename(module_filename)) {
if (1 != xmlCheckFilename(module_filename)) {
+
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+ xsltGenericDebug(xsltGenericDebugContext,
+ "xmlCheckFilename failed for plugin: %s\n", module_filename);
+#endif
+
xmlFree(ext_name);
return (-1);
}
xmlFree(ext_name);
return (-1);
}
/* attempt to open the module */
m = xmlModuleOpen(module_filename, 0);
if (NULL == m) {
/* attempt to open the module */
m = xmlModuleOpen(module_filename, 0);
if (NULL == m) {
+
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+ xsltGenericDebug(xsltGenericDebugContext,
+ "xmlModuleOpen failed for plugin: %s\n", module_filename);
+#endif
+
xmlFree(ext_name);
return (-1);
}
/* construct initialization func name */
regfunc_name = xmlStrdup(ext_name);
xmlFree(ext_name);
return (-1);
}
/* construct initialization func name */
regfunc_name = xmlStrdup(ext_name);
- regfunc_name = xmlStrcat(regfunc_name, "_init");
+ regfunc_name = xmlStrcat(regfunc_name, BAD_CAST "_init");
- rc = xmlModuleSymbol(m, regfunc_name, (void **) ®func);
+ rc = xmlModuleSymbol(m, (const char *) regfunc_name, (void **) ®func);
if (0 == rc) {
/* call the module's init function */
(*regfunc) ();
if (0 == rc) {
/* call the module's init function */
(*regfunc) ();
/* register this module in our hash */
xmlHashAddEntry(xsltModuleHash, URI, (void *) m);
} else {
/* register this module in our hash */
xmlHashAddEntry(xsltModuleHash, URI, (void *) m);
} else {
+
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+ xsltGenericDebug(xsltGenericDebugContext,
+ "xmlModuleSymbol failed for plugin: %s, regfunc: %s\n",
+ module_filename, regfunc_name);
+#endif
+
/* if regfunc not found unload the module immediately */
xmlModuleClose(m);
}
/* if regfunc not found unload the module immediately */
xmlModuleClose(m);
}