fixed the main issues reported by Peter Breitenlohner cleanup speedup
* catalog.c: fixed the main issues reported by Peter Breitenlohner
* parser.c: cleanup
* valid.c: speedup patch from Petr Pajas
Daniel
diff --git a/ChangeLog b/ChangeLog
index 6ad4dbe..9350361 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Wed Feb 25 11:36:06 CET 2004 Daniel Veillard <daniel@veillard.com>
+
+ * catalog.c: fixed the main issues reported by Peter Breitenlohner
+ * parser.c: cleanup
+ * valid.c: speedup patch from Petr Pajas
+
Wed Feb 25 16:07:14 HKT 2004 William Brack <wbrack@mmm.com.hk>
* xpath.c: fixed a memory leak (xmlXPathLangFunction) reported
diff --git a/catalog.c b/catalog.c
index df21927..86df2eb 100644
--- a/catalog.c
+++ b/catalog.c
@@ -749,7 +749,7 @@
urn += sizeof(XML_URN_PUBID) - 1;
while (*urn != 0) {
- if (i > sizeof(result) - 3)
+ if (i > sizeof(result) - 4)
break;
if (*urn == '+') {
result[i++] = ' ';
@@ -763,21 +763,21 @@
result[i++] = ':';
urn++;
} else if (*urn == '%') {
- if ((urn[1] == '2') && (urn[1] == 'B'))
+ if ((urn[1] == '2') && (urn[2] == 'B'))
result[i++] = '+';
- else if ((urn[1] == '3') && (urn[1] == 'A'))
+ else if ((urn[1] == '3') && (urn[2] == 'A'))
result[i++] = ':';
- else if ((urn[1] == '2') && (urn[1] == 'F'))
+ else if ((urn[1] == '2') && (urn[2] == 'F'))
result[i++] = '/';
- else if ((urn[1] == '3') && (urn[1] == 'B'))
+ else if ((urn[1] == '3') && (urn[2] == 'B'))
result[i++] = ';';
- else if ((urn[1] == '2') && (urn[1] == '7'))
+ else if ((urn[1] == '2') && (urn[2] == '7'))
result[i++] = '\'';
- else if ((urn[1] == '3') && (urn[1] == 'F'))
+ else if ((urn[1] == '3') && (urn[2] == 'F'))
result[i++] = '?';
- else if ((urn[1] == '2') && (urn[1] == '3'))
+ else if ((urn[1] == '2') && (urn[2] == '3'))
result[i++] = '#';
- else if ((urn[1] == '2') && (urn[1] == '5'))
+ else if ((urn[1] == '2') && (urn[2] == '5'))
result[i++] = '%';
else {
result[i++] = *urn;
@@ -1887,7 +1887,7 @@
else if (xmlStrEqual(pubID, urnID))
ret = xmlCatalogListXMLResolve(catal, pubID, NULL);
else {
- ret = xmlCatalogListXMLResolve(catal, pubID, NULL);
+ ret = xmlCatalogListXMLResolve(catal, pubID, urnID);
}
if (urnID != NULL)
xmlFree(urnID);
@@ -2383,7 +2383,7 @@
*
* Try to lookup the catalog local reference for a system ID
*
- * Returns the system ID if found or NULL otherwise.
+ * Returns the local resource if found or NULL otherwise.
*/
static const xmlChar *
xmlCatalogGetSGMLSystem(xmlHashTablePtr catal, const xmlChar *sysID) {
@@ -2664,13 +2664,16 @@
return (NULL);
if (xmlDebugCatalogs) {
- if (pubID != NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "Resolve: pubID %s\n", pubID);
- } else {
- xmlGenericError(xmlGenericErrorContext,
- "Resolve: sysID %s\n", sysID);
- }
+ if ((pubID != NULL) && (sysID != NULL)) {
+ xmlGenericError(xmlGenericErrorContext,
+ "Resolve: pubID %s sysID %s\n", pubID, sysID);
+ } else if (pubID != NULL) {
+ xmlGenericError(xmlGenericErrorContext,
+ "Resolve: pubID %s\n", pubID);
+ } else {
+ xmlGenericError(xmlGenericErrorContext,
+ "Resolve: sysID %s\n", sysID);
+ }
}
if (catal->type == XML_XML_CATALOG_TYPE) {
@@ -3434,13 +3437,16 @@
return(NULL);
if (xmlDebugCatalogs) {
- if (pubID != NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "Local resolve: pubID %s\n", pubID);
- } else {
- xmlGenericError(xmlGenericErrorContext,
- "Local resolve: sysID %s\n", sysID);
- }
+ if ((pubID != NULL) && (sysID != NULL)) {
+ xmlGenericError(xmlGenericErrorContext,
+ "Local Resolve: pubID %s sysID %s\n", pubID, sysID);
+ } else if (pubID != NULL) {
+ xmlGenericError(xmlGenericErrorContext,
+ "Local Resolve: pubID %s\n", pubID);
+ } else {
+ xmlGenericError(xmlGenericErrorContext,
+ "Local Resolve: sysID %s\n", sysID);
+ }
}
catal = (xmlCatalogEntryPtr) catalogs;
diff --git a/parser.c b/parser.c
index f566517..cf2e251 100644
--- a/parser.c
+++ b/parser.c
@@ -3143,11 +3143,6 @@
return;
}
get_more:
-#if 0
- while (((*in >= 0x20) && (*in != '<') && (*in != ']') &&
- (*in != '&') && (*in <= 0x7F)) || (*in == 0x09))
- in++;
-#endif
while (((*in > ']') && (*in <= 0x7F)) ||
((*in > '&') && (*in < '<')) ||
((*in > '<') && (*in < ']')) ||
diff --git a/valid.c b/valid.c
index 33a2a9a..22e41e6 100644
--- a/valid.c
+++ b/valid.c
@@ -2715,6 +2715,19 @@
}
/**
+ * xmlDummyCompare
+ * @data0: Value supplied by the user
+ * @data1: Value supplied by the user
+ *
+ * Do nothing, return 0. Used to create unordered lists.
+ */
+static int
+xmlDummyCompare(const void *data0, const void *data1)
+{
+ return (0);
+}
+
+/**
* xmlAddRef:
* @ctxt: the validation context
* @doc: pointer to the document
@@ -2784,7 +2797,7 @@
*/
if (NULL == (ref_list = xmlHashLookup(table, value))) {
- if (NULL == (ref_list = xmlListCreate(xmlFreeRef, NULL))) {
+ if (NULL == (ref_list = xmlListCreate(xmlFreeRef, xmlDummyCompare))) {
xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR,
"xmlAddRef: Reference list creation failed!\n",
NULL);