Commit f8e3db04 authored by Daniel Veillard's avatar Daniel Veillard

Big space and tab cleanup

Remove all space before tabs and space and tabs at end of lines.
parent 429d3a0a
......@@ -53,7 +53,7 @@ docbEncodeEntities(unsigned char *out ATTRIBUTE_UNUSED,
/**
* docbParseDocument:
* @ctxt: an SGML parser context
*
*
* parse an SGML document (and build a tree if using the standard SAX
* interface).
*
......@@ -163,12 +163,12 @@ docbCreatePushParserCtxt(docbSAXHandlerPtr sax ATTRIBUTE_UNUSED,
* @cur: a pointer to an array of xmlChar
* @encoding: a free form C string describing the SGML document encoding, or NULL
* @sax: the SAX handler block
* @userData: if using SAX, this pointer will be provided on callbacks.
* @userData: if using SAX, this pointer will be provided on callbacks.
*
* parse an SGML in-memory document and build a tree.
* It use the given SAX function block to handle the parsing callback.
* If sax is NULL, fallback to the default DOM tree building routines.
*
*
* Returns the resulting document tree
*/
......@@ -196,7 +196,7 @@ docbSAXParseDoc(xmlChar * cur ATTRIBUTE_UNUSED,
* @encoding: a free form C string describing the SGML document encoding, or NULL
*
* parse an SGML in-memory document and build a tree.
*
*
* Returns the resulting document tree
*/
......@@ -221,7 +221,7 @@ docbParseDoc(xmlChar * cur ATTRIBUTE_UNUSED,
* @filename: the filename
* @encoding: the SGML document encoding, or NULL
*
* Create a parser context for a file content.
* Create a parser context for a file content.
* Automatic support for ZLIB/Compress compressed document is provided
* by default if found at compile-time.
*
......@@ -247,7 +247,7 @@ docbCreateFileParserCtxt(const char *filename ATTRIBUTE_UNUSED,
* @filename: the filename
* @encoding: a free form C string describing the SGML document encoding, or NULL
* @sax: the SAX handler block
* @userData: if using SAX, this pointer will be provided on callbacks.
* @userData: if using SAX, this pointer will be provided on callbacks.
*
* parse an SGML file and build a tree. Automatic support for ZLIB/Compress
* compressed document is provided by default if found at compile-time.
......
......@@ -5162,13 +5162,13 @@ htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first,
* @stop: Array of chars, which stop the lookup.
* @stopLen: Length of stop-Array
*
* Try to find if any char of the stop-Array is available in the input
* Try to find if any char of the stop-Array is available in the input
* stream.
* This function has a side effect of (possibly) incrementing ctxt->checkIndex
* to avoid rescanning sequences of bytes, it DOES change the state of the
* parser, do not use liberally.
*
* Returns the index to the current parsing point if a stopChar
* Returns the index to the current parsing point if a stopChar
* is available, -1 otherwise.
*/
static int
......
......@@ -34,14 +34,14 @@
/************************************************************************
* *
* Getting/Setting encoding meta tags *
* Getting/Setting encoding meta tags *
* *
************************************************************************/
/**
* htmlGetMetaEncoding:
* @doc: the document
*
*
* Encoding definition lookup in the Meta tags
*
* Returns the current encoding as flagged in the HTML source
......@@ -128,17 +128,17 @@ found_meta:
found_content:
encoding = xmlStrstr(content, BAD_CAST"charset=");
if (encoding == NULL)
if (encoding == NULL)
encoding = xmlStrstr(content, BAD_CAST"Charset=");
if (encoding == NULL)
if (encoding == NULL)
encoding = xmlStrstr(content, BAD_CAST"CHARSET=");
if (encoding != NULL) {
encoding += 8;
} else {
encoding = xmlStrstr(content, BAD_CAST"charset =");
if (encoding == NULL)
if (encoding == NULL)
encoding = xmlStrstr(content, BAD_CAST"Charset =");
if (encoding == NULL)
if (encoding == NULL)
encoding = xmlStrstr(content, BAD_CAST"CHARSET =");
if (encoding != NULL)
encoding += 9;
......@@ -316,7 +316,7 @@ static const char* htmlBooleanAttrs[] = {
* @name: the name of the attribute to check
*
* Determine if a given attribute is a boolean attribute.
*
*
* returns: false if the attribute is not boolean, true otherwise.
*/
int
......@@ -340,7 +340,7 @@ xmlOutputBufferPtr
xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder);
/************************************************************************
* *
* Output error handlers *
* Output error handlers *
* *
************************************************************************/
/**
......@@ -389,7 +389,7 @@ htmlSaveErr(int code, xmlNodePtr node, const char *extra)
/************************************************************************
* *
* Dumping HTML tree content to a simple buffer *
* Dumping HTML tree content to a simple buffer *
* *
************************************************************************/
......@@ -512,7 +512,7 @@ htmlNodeDumpFileFormat(FILE *out, xmlDocPtr doc,
if (handler == NULL)
handler = xmlFindCharEncodingHandler("ascii");
/*
/*
* save the content to a temp buffer.
*/
buf = xmlOutputBufferCreateFile(out, handler);
......@@ -634,7 +634,7 @@ htmlDocDumpMemory(xmlDocPtr cur, xmlChar**mem, int *size) {
/************************************************************************
* *
* Dumping HTML tree content to an I/O output buffer *
* Dumping HTML tree content to an I/O output buffer *
* *
************************************************************************/
......@@ -645,7 +645,7 @@ void xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur);
* @buf: the HTML buffer output
* @doc: the document
* @encoding: the encoding string
*
*
* TODO: check whether encoding is needed
*
* Dump the HTML document DTD, if any.
......@@ -667,7 +667,7 @@ htmlDtdDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
if (cur->SystemID != NULL) {
xmlOutputBufferWriteString(buf, " ");
xmlBufWriteQuotedString(buf->buffer, cur->SystemID);
}
}
} else if (cur->SystemID != NULL) {
xmlOutputBufferWriteString(buf, " SYSTEM ");
xmlBufWriteQuotedString(buf->buffer, cur->SystemID);
......@@ -1123,7 +1123,7 @@ htmlSaveFile(const char *filename, xmlDocPtr cur) {
if ((cur == NULL) || (filename == NULL))
return(-1);
xmlInitParser();
encoding = (const char *) htmlGetMetaEncoding(cur);
......@@ -1154,7 +1154,7 @@ htmlSaveFile(const char *filename, xmlDocPtr cur) {
if (handler == NULL)
handler = xmlFindCharEncodingHandler("ascii");
/*
/*
* save the content to a temp buffer.
*/
buf = xmlOutputBufferCreateFilename(filename, handler, cur->compression);
......@@ -1174,7 +1174,7 @@ htmlSaveFile(const char *filename, xmlDocPtr cur) {
* @encoding: the document encoding
*
* Dump an HTML document to a file using a given encoding.
*
*
* returns: the number of byte written or -1 in case of failure.
*/
int
......@@ -1218,7 +1218,7 @@ htmlSaveFileFormat(const char *filename, xmlDocPtr cur,
if (handler == NULL)
handler = xmlFindCharEncodingHandler("ascii");
/*
/*
* save the content to a temp buffer.
*/
buf = xmlOutputBufferCreateFilename(filename, handler, 0);
......@@ -1238,7 +1238,7 @@ htmlSaveFileFormat(const char *filename, xmlDocPtr cur,
*
* Dump an HTML document to a file using a given encoding
* and formatting returns/spaces are added.
*
*
* returns: the number of byte written or -1 in case of failure.
*/
int
......
......@@ -41,7 +41,7 @@
void
initxmlDefaultSAXHandler(xmlSAXHandlerV1 *hdlr, int warning)
{
if(hdlr->initialized == 1)
return;
......
......@@ -45,7 +45,7 @@
*> values "system" and "public". I have made the default be "system" to
*> match yours.
*/
#define TODO \
#define TODO \
xmlGenericError(xmlGenericErrorContext, \
"Unimplemented block at %s:%d\n", \
__FILE__, __LINE__);
......@@ -143,7 +143,7 @@ xmlFatalErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
if (ctxt != NULL)
ctxt->errNo = error;
__xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error,
XML_ERR_FATAL, NULL, 0,
XML_ERR_FATAL, NULL, 0,
(const char *) str1, (const char *) str2,
NULL, 0, 0, msg, str1, str2);
if (ctxt != NULL) {
......@@ -174,7 +174,7 @@ xmlWarnMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
if (ctxt != NULL)
ctxt->errNo = error;
__xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error,
XML_ERR_WARNING, NULL, 0,
XML_ERR_WARNING, NULL, 0,
(const char *) str1, NULL,
NULL, 0, 0, msg, str1);
}
......@@ -199,7 +199,7 @@ xmlNsErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
if (ctxt != NULL)
ctxt->errNo = error;
__xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_NAMESPACE, error,
XML_ERR_ERROR, NULL, 0,
XML_ERR_ERROR, NULL, 0,
(const char *) str1, (const char *) str2,
NULL, 0, 0, msg, str1, str2);
}
......@@ -223,7 +223,7 @@ xmlNsWarnMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
if (ctxt != NULL)
ctxt->errNo = error;
__xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_NAMESPACE, error,
XML_ERR_WARNING, NULL, 0,
XML_ERR_WARNING, NULL, 0,
(const char *) str1, (const char *) str2,
NULL, 0, 0, msg, str1, str2);
}
......@@ -257,7 +257,7 @@ xmlSAX2GetSystemId(void *ctx)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
if ((ctx == NULL) || (ctxt->input == NULL)) return(NULL);
return((const xmlChar *) ctxt->input->filename);
return((const xmlChar *) ctxt->input->filename);
}
/**
......@@ -372,7 +372,7 @@ xmlSAX2InternalSubset(void *ctx, const xmlChar *name,
xmlFreeDtd(dtd);
ctxt->myDoc->intSubset = NULL;
}
ctxt->myDoc->intSubset =
ctxt->myDoc->intSubset =
xmlCreateIntSubset(ctxt->myDoc, name, ExternalID, SystemID);
if (ctxt->myDoc->intSubset == NULL)
xmlSAX2ErrMemory(ctxt, "xmlSAX2InternalSubset");
......@@ -638,8 +638,8 @@ xmlSAX2GetParameterEntity(void *ctx, const xmlChar *name)
/**
* xmlSAX2EntityDecl:
* @ctx: the user data (XML parser context)
* @name: the entity name
* @type: the entity type
* @name: the entity name
* @type: the entity type
* @publicId: The public ID of the entity
* @systemId: The system ID of the entity
* @content: the entity value (without processing).
......@@ -674,7 +674,7 @@ xmlSAX2EntityDecl(void *ctx, const xmlChar *name, int type,
base = ctxt->input->filename;
if (base == NULL)
base = ctxt->directory;
URI = xmlBuildURI(systemId, (const xmlChar *) base);
ent->URI = URI;
}
......@@ -683,7 +683,7 @@ xmlSAX2EntityDecl(void *ctx, const xmlChar *name, int type,
systemId, content);
if ((ent == NULL) && (ctxt->pedantic) &&
(ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
ctxt->sax->warning(ctxt->userData,
ctxt->sax->warning(ctxt->userData,
"Entity(%s) already defined in the external subset\n", name);
if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) {
xmlChar *URI;
......@@ -693,7 +693,7 @@ xmlSAX2EntityDecl(void *ctx, const xmlChar *name, int type,
base = ctxt->input->filename;
if (base == NULL)
base = ctxt->directory;
URI = xmlBuildURI(systemId, (const xmlChar *) base);
ent->URI = URI;
}
......@@ -708,8 +708,8 @@ xmlSAX2EntityDecl(void *ctx, const xmlChar *name, int type,
* xmlSAX2AttributeDecl:
* @ctx: the user data (XML parser context)
* @elem: the name of the element
* @fullname: the attribute name
* @type: the attribute type
* @fullname: the attribute name
* @type: the attribute type
* @def: the type of default value
* @defaultValue: the attribute default value
* @tree: the tree of enumerated value set
......@@ -752,7 +752,7 @@ xmlSAX2AttributeDecl(void *ctx, const xmlChar *elem, const xmlChar *fullname,
(xmlAttributeDefault) def, defaultValue, tree);
else if (ctxt->inSubset == 2)
attr = xmlAddAttributeDecl(&ctxt->vctxt, ctxt->myDoc->extSubset, elem,
name, prefix, (xmlAttributeType) type,
name, prefix, (xmlAttributeType) type,
(xmlAttributeDefault) def, defaultValue, tree);
else {
xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR,
......@@ -778,8 +778,8 @@ xmlSAX2AttributeDecl(void *ctx, const xmlChar *elem, const xmlChar *fullname,
/**
* xmlSAX2ElementDecl:
* @ctx: the user data (XML parser context)
* @name: the element name
* @type: the element type
* @name: the element name
* @type: the element type
* @content: the element value tree
*
* An element definition has been parsed
......@@ -900,7 +900,7 @@ xmlSAX2UnparsedEntityDecl(void *ctx, const xmlChar *name,
publicId, systemId, notationName);
if ((ent == NULL) && (ctxt->pedantic) &&
(ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
ctxt->sax->warning(ctxt->userData,
ctxt->sax->warning(ctxt->userData,
"Entity(%s) already defined in the internal subset\n", name);
if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) {
xmlChar *URI;
......@@ -910,7 +910,7 @@ xmlSAX2UnparsedEntityDecl(void *ctx, const xmlChar *name,
base = ctxt->input->filename;
if (base == NULL)
base = ctxt->directory;
URI = xmlBuildURI(systemId, (const xmlChar *) base);
ent->URI = URI;
}
......@@ -920,7 +920,7 @@ xmlSAX2UnparsedEntityDecl(void *ctx, const xmlChar *name,
publicId, systemId, notationName);
if ((ent == NULL) && (ctxt->pedantic) &&
(ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
ctxt->sax->warning(ctxt->userData,
ctxt->sax->warning(ctxt->userData,
"Entity(%s) already defined in the external subset\n", name);
if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) {
xmlChar *URI;
......@@ -930,7 +930,7 @@ xmlSAX2UnparsedEntityDecl(void *ctx, const xmlChar *name,
base = ctxt->input->filename;
if (base == NULL)
base = ctxt->directory;
URI = xmlBuildURI(systemId, (const xmlChar *) base);
ent->URI = URI;
}
......@@ -1174,12 +1174,12 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
uri = xmlParseURI((const char *)val);
if (uri == NULL) {
if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
ctxt->sax->warning(ctxt->userData,
ctxt->sax->warning(ctxt->userData,
"xmlns: %s not a valid URI\n", val);
} else {
if (uri->scheme == NULL) {
if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
ctxt->sax->warning(ctxt->userData,
ctxt->sax->warning(ctxt->userData,
"xmlns: URI %s is not absolute\n", val);
}
xmlFreeURI(uri);
......@@ -1199,7 +1199,7 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
ctxt->valid &= xmlValidateOneNamespace(&ctxt->vctxt, ctxt->myDoc,
ctxt->node, prefix, nsret, val);
#endif /* LIBXML_VALID_ENABLED */
if (name != NULL)
if (name != NULL)
xmlFree(name);
if (nval != NULL)
xmlFree(nval);
......@@ -1221,7 +1221,7 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
if (val == NULL) {
xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement");
xmlFree(ns);
if (name != NULL)
if (name != NULL)
xmlFree(name);
return;
}
......@@ -1262,7 +1262,7 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
ctxt->valid &= xmlValidateOneNamespace(&ctxt->vctxt, ctxt->myDoc,
ctxt->node, prefix, nsret, value);
#endif /* LIBXML_VALID_ENABLED */
if (name != NULL)
if (name != NULL)
xmlFree(name);
if (nval != NULL)
xmlFree(nval);
......@@ -1328,7 +1328,7 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
#ifdef LIBXML_VALID_ENABLED
if ((!ctxt->html) && ctxt->validate && ctxt->wellFormed &&
ctxt->myDoc && ctxt->myDoc->intSubset) {
/*
* If we don't substitute entities, the validation should be
* done on a value with replaced entities anyway.
......@@ -1340,7 +1340,7 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
val = xmlStringDecodeEntities(ctxt, value, XML_SUBSTITUTE_REF,
0,0,0);
ctxt->depth--;
if (val == NULL)
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt,
ctxt->myDoc, ctxt->node, ret, value);
......@@ -1397,7 +1397,7 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
error:
if (nval != NULL)
xmlFree(nval);
if (ns != NULL)
if (ns != NULL)
xmlFree(ns);
}
......@@ -1496,7 +1496,7 @@ process_external_subset:
* - this is a namespace prefix
* - the user required for completion in the tree
* like XSLT
* - there isn't already an attribute definition
* - there isn't already an attribute definition
* in the internal subset overriding it.
*/
if (((attr->prefix != NULL) &&
......@@ -1585,17 +1585,17 @@ xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
/*
* First check on validity:
*/
if (ctxt->validate && (ctxt->myDoc->extSubset == NULL) &&
if (ctxt->validate && (ctxt->myDoc->extSubset == NULL) &&
((ctxt->myDoc->intSubset == NULL) ||
((ctxt->myDoc->intSubset->notations == NULL) &&
((ctxt->myDoc->intSubset->notations == NULL) &&
(ctxt->myDoc->intSubset->elements == NULL) &&
(ctxt->myDoc->intSubset->attributes == NULL) &&
(ctxt->myDoc->intSubset->attributes == NULL) &&
(ctxt->myDoc->intSubset->entities == NULL)))) {
xmlErrValid(ctxt, XML_ERR_NO_DTD,
"Validation failed: no DTD found !", NULL, NULL);
ctxt->validate = 0;
}
/*
* Split the full name into a namespace prefix and the tag name
......@@ -1783,7 +1783,7 @@ xmlSAX2EndElement(void *ctx, const xmlChar *name ATTRIBUTE_UNUSED)
else
xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2EndElement(%s)\n", name);
#endif
/* Capture end position and add node */
if (cur != NULL && ctxt->record_info) {
ctxt->nodeInfo->end_pos = ctxt->input->cur - ctxt->input->base;
......@@ -1800,7 +1800,7 @@ xmlSAX2EndElement(void *ctx, const xmlChar *name ATTRIBUTE_UNUSED)
cur);
#endif /* LIBXML_VALID_ENABLED */
/*
* end of parsing of this node.
*/
......@@ -1816,7 +1816,7 @@ xmlSAX2EndElement(void *ctx, const xmlChar *name ATTRIBUTE_UNUSED)
* @ctxt: the parser context
* @str: the input string
* @len: the string length
*
*
* Callback for a text node
*
* Returns the newly allocated string or NULL if not needed or error
......@@ -1905,7 +1905,7 @@ skip:
* @ctxt: the parser context
* @str: the input string
* @len: the string length
*
*
* Remove the entities from an attribute value
*
* Returns the newly allocated string or NULL if not needed or error
......@@ -1971,7 +1971,7 @@ xmlSAX2AttributeNs(xmlParserCtxtPtr ctxt,
memset(ret, 0, sizeof(xmlAttr));
ret->type = XML_ATTRIBUTE_NODE;
ret->parent = ctxt->node;
ret->parent = ctxt->node;
ret->doc = ctxt->myDoc;
ret->ns = namespace;
......@@ -1995,7 +1995,7 @@ xmlSAX2AttributeNs(xmlParserCtxtPtr ctxt,
xmlRegisterNodeDefaultValue((xmlNodePtr)ret);
} else {
if (ctxt->dictNames)
ret = xmlNewNsPropEatName(ctxt->node, namespace,
ret = xmlNewNsPropEatName(ctxt->node, namespace,
(xmlChar *) localname, NULL);
else
ret = xmlNewNsProp(ctxt->node, namespace, localname, NULL);
......@@ -2081,7 +2081,7 @@ xmlSAX2AttributeNs(xmlParserCtxtPtr ctxt,
xmlChar *nvalnorm;
xmlChar fn[50];
xmlChar *fullname;
fullname = xmlBuildQName(localname, prefix, fn, 50);
if (fullname != NULL) {
ctxt->vctxt.valid = 1;
......@@ -2196,11 +2196,11 @@ xmlSAX2StartElementNs(void *ctx,
/*
* First check on validity:
*/
if (ctxt->validate && (ctxt->myDoc->extSubset == NULL) &&
if (ctxt->validate && (ctxt->myDoc->extSubset == NULL) &&
((ctxt->myDoc->intSubset == NULL) ||
((ctxt->myDoc->intSubset->notations == NULL) &&
((ctxt->myDoc->intSubset->notations == NULL) &&
(ctxt->myDoc->intSubset->elements == NULL) &&
(ctxt->myDoc->intSubset->attributes == NULL) &&
(ctxt->myDoc->intSubset->attributes == NULL) &&
(ctxt->myDoc->intSubset->entities == NULL)))) {
xmlErrValid(ctxt, XML_ERR_NO_DTD,
"Validation failed: no DTD found !", NULL, NULL);
......@@ -2247,12 +2247,12 @@ xmlSAX2StartElementNs(void *ctx,
xmlRegisterNodeDefaultValue(ret);
} else {
if (ctxt->dictNames)
ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL,
ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL,
(xmlChar *) localname, NULL);
else if (lname == NULL)
ret = xmlNewDocNode(ctxt->myDoc, NULL, localname, NULL);
else
ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL,
ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL,
(xmlChar *) lname, NULL);
if (ret == NULL) {
xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs");
......@@ -2457,7 +2457,7 @@ xmlSAX2EndElementNs(void *ctx,
* @ctx: the user data (XML parser context)
* @name: The entity name
*
* called when an entity xmlSAX2Reference is detected.
* called when an entity xmlSAX2Reference is detected.
*/
void
xmlSAX2Reference(void *ctx, const xmlChar *name)
......@@ -2562,7 +2562,7 @@ xmlSAX2Characters(void *ctx, const xmlChar *ch, int len)
xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters: huge text node");
return;
}
if ((size_t)ctxt->nodelen > SIZE_T_MAX - (size_t)len ||
if ((size_t)ctxt->nodelen > SIZE_T_MAX - (size_t)len ||
(size_t)ctxt->nodemem + (size_t)len > SIZE_T_MAX / 2) {
xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters overflow prevented");
return;
......
This diff is collapsed.
/**
* catalog.c: set of generic Catalog related routines
* catalog.c: set of generic Catalog related routines
*
* Reference: SGML Open Technical Resolution TR9401:1997.
* http://www.jclark.com/sp/catalog.htm
......@@ -62,7 +62,7 @@
*> values "system" and "public". I have made the default be "system" to
*> match yours.
*/
#define TODO \
#define TODO \
xmlGenericError(xmlGenericErrorContext, \
"Unimplemented block at %s:%d\n", \
__FILE__, __LINE__);
......@@ -208,7 +208,7 @@ static int xmlCatalogInitialized = 0;
/************************************************************************
* *
* Catalog error handlers *
* Catalog error handlers *
* *
************************************************************************/
......@@ -261,9 +261,9 @@ xmlCatalogErr(xmlCatalogEntryPtr catal, xmlNodePtr node, int error,
* @name: name of the entry
* @value: value of the entry
* @prefer: the PUBLIC vs. SYSTEM current preference value
* @group: for members of a group, the group entry
* @group: for members of a group, the group entry
*
* create a new Catalog entry, this type is shared both by XML and
* create a new Catalog entry, this type is shared both by XML and
* SGML catalogs, but the acceptable types values differs.
*
* Returns the xmlCatalogEntryPtr or NULL in case of error
......@@ -401,7 +401,7 @@ xmlFreeCatalogHashEntryList(xmlCatalogEntryPtr catal) {
* @type: type of catalog
* @prefer: the PUBLIC vs. SYSTEM current preference value
*
* create a new Catalog, this type is shared both by XML and
* create a new Catalog, this type is shared both by XML and
* SGML catalogs, but the acceptable types values differs.
*
* Returns the xmlCatalogPtr or NULL in case of error
......@@ -569,7 +569,7 @@ static void xmlDumpXMLCatalogNode(xmlCatalogEntryPtr catal, xmlNodePtr catalog,
xns = xmlSearchNsByHref(doc, node, XML_XML_NAMESPACE);
if (xns != NULL)
xmlSetNsProp(node, xns, BAD_CAST "base",
cur->value);
cur->value);
}
switch (cur->prefer) {
case XML_CATA_PREFER_NONE:
......@@ -687,7 +687,7 @@ BAD_CAST "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd");
xmlAddChild((xmlNodePtr) doc, catalog);
xmlDumpXMLCatalogNode(catal, catalog, doc, ns, NULL);
/*
* reserialize it
*/
......@@ -824,7 +824,7 @@ xmlCatalogUnWrapURN(const xmlChar *urn) {
if (xmlStrncmp(urn, BAD_CAST XML_URN_PUBID, sizeof(XML_URN_PUBID) - 1))
return(NULL);
urn += sizeof(XML_URN_PUBID) - 1;
while (*urn != 0) {
if (i > sizeof(result) - 4)
break;
......@@ -937,7 +937,7 @@ xmlParseCatalogFile(const char *filename) {
ctxt->myDoc = NULL;
}
xmlFreeParserCtxt(ctxt);
return(ret);
}
......@@ -1327,7 +1327,7 @@ xmlParseXMLCatalogNodeList(xmlNodePtr cur, xmlCatalogPrefer prefer,
*
* Parses the catalog file to extract the XML tree and then analyze the
* tree to build a list of Catalog entries corresponding to this catalog
*
*
* Returns the resulting Catalog entries list
*/
static xmlCatalogEntryPtr
......@@ -1395,14 +1395,14 @@ xmlParseXMLCatalogFile(xmlCatalogPrefer prefer, const xmlChar *filename) {
* @catal: an existing but incomplete catalog entry
*
* Fetch and parse the subcatalog referenced by an entry
*
*
* Returns 0 in case of success, -1 otherwise
*/
static int
xmlFetchXMLCatalogFile(xmlCatalogEntryPtr catal) {
xmlCatalogEntryPtr doc;
if (catal == NULL)
if (catal == NULL)
return(-1);
if (catal->URL == NULL)
return(-1);
......@@ -1494,7 +1494,7 @@ xmlAddXMLCatalog(xmlCatalogEntryPtr catal, const xmlChar *type,
xmlCatalogEntryType typ;
int doregister = 0;
if ((catal == NULL) ||
if ((catal == NULL) ||
((catal->type != XML_CATA_CATALOG) &&
(catal->type != XML_CATA_BROKEN_CATALOG)))
return(-1);
......@@ -1570,7 +1570,7 @@ xmlDelXMLCatalog(xmlCatalogEntryPtr catal, const xmlChar *value) {
xmlCatalogEntryPtr cur;
int ret = 0;
if ((catal == NULL) ||
if ((catal == NULL) ||
((catal->type != XML_CATA_CATALOG) &&
(catal->type != XML_CATA_BROKEN_CATALOG)))
return(-1);
......@@ -1785,7 +1785,7 @@ xmlCatalogXMLResolve(xmlCatalogEntryPtr catal, const xmlChar *pubID,
}
if (nbList < MAX_DELEGATE)
delegates[nbList++] = cur->URL;
if (cur->children == NULL) {
xmlFetchXMLCatalogFile(cur);
}
......@@ -1998,7 +1998,7 @@ xmlCatalogListXMLResolve(xmlCatalogEntryPtr catal, const xmlChar *pubID,
xmlChar *ret = NULL;
xmlChar *urnID = NULL;
xmlChar *normid;
if (catal == NULL)
return(NULL);
if ((pubID == NULL) && (sysID == NULL))
......@@ -2007,7 +2007,7 @@ xmlCatalogListXMLResolve(xmlCatalogEntryPtr catal, const xmlChar *pubID,
normid = xmlCatalogNormalizePublic(pubID);
if (normid != NULL)
pubID = (*normid != 0 ? normid : NULL);
if (!xmlStrncmp(pubID, BAD_CAST XML_URN_PUBID, sizeof(XML_URN_PUBID) - 1)) {
urnID = xmlCatalogUnWrapURN(pubID);
if (xmlDebugCatalogs) {
......@@ -2087,7 +2087,7 @@ static xmlChar *
xmlCatalogListXMLResolveURI(xmlCatalogEntryPtr catal, const xmlChar *URI) {
xmlChar *ret = NULL;
xmlChar *urnID = NULL;
if (catal == NULL)