[xslt] libxml2-2.6.7/catalog.c -- various inconsistencies



Hi Daniel,

1. in order to better understand the XML catalog handling I had a look at the
source code in catalog.c. In doing so I noticed several inconsistencies,
ranging from (I think) a bug to typos in the embedded docu.

1.1 xmlCatalogUnWrapURN l.765
	    if ((urn[1] == '2') && (urn[1] == 'B'))
this can't possibly work and certainly should be
	    if ((urn[1] == '2') && (urn[2] == 'B'))
                                        ^
same for the other 7 cases

1.2 xmlCatalogListXMLResolve l.1885
	if (pubID == NULL)
	    ret = xmlCatalogListXMLResolve(catal, urnID, NULL);
	else if (xmlStrEqual(pubID, urnID))
	    ret = xmlCatalogListXMLResolve(catal, pubID, NULL);
	else {
	    ret = xmlCatalogListXMLResolve(catal, pubID, NULL);
this doesn't make much sense and probably should read
	if (pubID == NULL)
	    ret = xmlCatalogListXMLResolve(catal, urnID, NULL);
	else if (xmlStrEqual(pubID, urnID))
	    ret = xmlCatalogListXMLResolve(catal, pubID, NULL);
	else {
	    ret = xmlCatalogListXMLResolve(catal, pubID, urnID);
                                                         ^^^^^

1.3 xmlCatalogListXMLResolve l.1902
		ret = xmlCatalogXMLResolve(catal->children, pubID, sysID);
shouldn't this be
		ret = xmlCatalogListXMLResolve(catal->children, pubID, sysID);
? depends on whether catal->children can be a list of children or is always
just one child

1.4 xmlACatalogResolve l.2667
    if (xmlDebugCatalogs) {
        if (pubID != NULL) {
            xmlGenericError(xmlGenericErrorContext,
                            "Resolve: pubID %s\n", pubID);
        } else {
            xmlGenericError(xmlGenericErrorContext,
                            "Resolve: sysID %s\n", sysID);
        }
    }
I think this should be replaced by
    if (xmlDebugCatalogs) {
        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);
        }
    }
or equivalent, because xmlCatalogListXMLResolve and xmlCatalogSGMLResolve
will resolve either pubID or sysID.

1.5 xmlCatalogLocalResolve l.3436
ditto

1.6 various typos in the embedded docu

xmlCatalogGetSGMLSystem l.2382
 * @sysId:  the public ID string
                ^^^^^^
 * Returns the system ID if found or NULL otherwise.
               ^^^^^^^^^
what do all these *Resolve routines return? Please clarify

xmlACatalogResolveSystem l.2579
xmlCatalogResolveSystem l.3063
same as above

xmlCatalogGetSystem l.3499
 * Try to lookup the system ID associated to a public ID
                     ?????????                 ^^^^^^^^^

xmlFreeCatalog l.395
 * @catal:  a Catalog entry
                     ^^^^^^

xmlCatalogDumpEntry l.420
 * @entry:  the
                ^^^^^^^^^

several places:
whereas the functions consistently use pubID and sysID, the docu refers to
them in some places as pubId and sysId.

2. I think you should handle the generation of xml2Conf.sh in the same way
as xsltConf.sh, i.e. via a sed script in the Makefile instead of configure
substitutions. Otherwise the resulting xml2Conf.sh may refer to unexpanded
variables (e.g. XML2_LIBDIR="-L${libdir}")

regards
Peter Breitenlohner <peb@mppmu.mpg.de>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]