mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-08-07 06:43:02 +03:00
minor warning cleanup (no change to logic) fixed return value for internal
* xmlschemas.c, xmlwriter.c, doc/examples/parse4.c, doc/examples/io2.c: minor warning cleanup (no change to logic) * xinclude: fixed return value for internal function xmlXIncludeLoadFallback (now always 0 or -1)
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
Sat Apr 17 22:42:13 HKT 2004 William Brack <wbrack@mmm.com.hk>
|
||||||
|
|
||||||
|
* xmlschemas.c, xmlwriter.c, doc/examples/parse4.c,
|
||||||
|
doc/examples/io2.c: minor warning cleanup (no change to logic)
|
||||||
|
* xinclude: fixed return value for internal function
|
||||||
|
xmlXIncludeLoadFallback (now always 0 or -1)
|
||||||
|
|
||||||
Sat Apr 17 21:32:32 HKT 2004 William Brack <wbrack@mmm.com.hk>
|
Sat Apr 17 21:32:32 HKT 2004 William Brack <wbrack@mmm.com.hk>
|
||||||
|
|
||||||
* valid.c: small enhancement to fix bug 139791
|
* valid.c: small enhancement to fix bug 139791
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
#include <libxml/parser.h>
|
#include <libxml/parser.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
main() {
|
main(void) {
|
||||||
|
|
||||||
xmlNodePtr n;
|
xmlNodePtr n;
|
||||||
xmlDocPtr doc;
|
xmlDocPtr doc;
|
||||||
|
@@ -43,7 +43,6 @@ static void
|
|||||||
example4Func(const char *filename) {
|
example4Func(const char *filename) {
|
||||||
xmlParserCtxtPtr ctxt;
|
xmlParserCtxtPtr ctxt;
|
||||||
char chars[4];
|
char chars[4];
|
||||||
int size = 4;
|
|
||||||
xmlDocPtr doc; /* the resulting document tree */
|
xmlDocPtr doc; /* the resulting document tree */
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
|
@@ -1816,8 +1816,10 @@ xmlXIncludeLoadFallback(xmlXIncludeCtxtPtr ctxt, xmlNodePtr fallback, int nr) {
|
|||||||
return (-1);
|
return (-1);
|
||||||
xmlXIncludeSetFlags(newctxt, ctxt->parseFlags);
|
xmlXIncludeSetFlags(newctxt, ctxt->parseFlags);
|
||||||
ret = xmlXIncludeDoProcess(newctxt, ctxt->doc, fallback->children);
|
ret = xmlXIncludeDoProcess(newctxt, ctxt->doc, fallback->children);
|
||||||
if ((ret >=0) && (ctxt->nbErrors > 0))
|
if (ctxt->nbErrors > 0)
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
else if (ret > 0)
|
||||||
|
ret = 0; /* xmlXIncludeDoProcess can return +ve number */
|
||||||
xmlXIncludeFreeContext(newctxt);
|
xmlXIncludeFreeContext(newctxt);
|
||||||
|
|
||||||
ctxt->incTab[nr]->inc = xmlCopyNodeList(fallback->children);
|
ctxt->incTab[nr]->inc = xmlCopyNodeList(fallback->children);
|
||||||
|
57
xmlschemas.c
57
xmlschemas.c
@@ -183,6 +183,12 @@ static int xmlSchemaValidateSimpleValue(xmlSchemaValidCtxtPtr ctxt,
|
|||||||
static int xmlSchemaParseInclude(xmlSchemaParserCtxtPtr ctxt,
|
static int xmlSchemaParseInclude(xmlSchemaParserCtxtPtr ctxt,
|
||||||
xmlSchemaPtr schema,
|
xmlSchemaPtr schema,
|
||||||
xmlNodePtr node);
|
xmlNodePtr node);
|
||||||
|
static int
|
||||||
|
xmlSchemaValidateSimpleValueInternal(xmlSchemaValidCtxtPtr ctxt,
|
||||||
|
xmlSchemaTypePtr type,
|
||||||
|
const xmlChar * value,
|
||||||
|
int fireErrors);
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Datatype error handlers *
|
* Datatype error handlers *
|
||||||
@@ -4409,7 +4415,8 @@ xmlSchemaParseUnionRefCheck(xmlSchemaTypePtr typeDecl,
|
|||||||
if (ns == NULL) {
|
if (ns == NULL) {
|
||||||
xmlSchemaPErr(ctxt, typeDecl->node, XML_SCHEMAP_PREFIX_UNDEFINED,
|
xmlSchemaPErr(ctxt, typeDecl->node, XML_SCHEMAP_PREFIX_UNDEFINED,
|
||||||
"Union %s: the namespace of member type %s is undefined\n",
|
"Union %s: the namespace of member type %s is undefined\n",
|
||||||
typeDecl->name, (const char *) tmp);
|
typeDecl->name, (const xmlChar *) tmp);
|
||||||
|
namespace = NULL;
|
||||||
} else {
|
} else {
|
||||||
namespace = xmlDictLookup(ctxt->dict, ns->href, -1);
|
namespace = xmlDictLookup(ctxt->dict, ns->href, -1);
|
||||||
}
|
}
|
||||||
@@ -4418,7 +4425,7 @@ xmlSchemaParseUnionRefCheck(xmlSchemaTypePtr typeDecl,
|
|||||||
if (subtype == NULL) {
|
if (subtype == NULL) {
|
||||||
xmlSchemaPErr(ctxt, typeDecl->node, XML_SCHEMAP_UNKNOWN_MEMBER_TYPE,
|
xmlSchemaPErr(ctxt, typeDecl->node, XML_SCHEMAP_UNKNOWN_MEMBER_TYPE,
|
||||||
"Union %s references an unknown member type >%s<\n",
|
"Union %s references an unknown member type >%s<\n",
|
||||||
typeDecl->name, (const char *) tmp);
|
typeDecl->name, (const xmlChar *) tmp);
|
||||||
}
|
}
|
||||||
xmlFree(tmp);
|
xmlFree(tmp);
|
||||||
cur = end;
|
cur = end;
|
||||||
@@ -5128,27 +5135,6 @@ xmlSchemaFacetTypeToString(xmlSchemaTypeType type)
|
|||||||
return ("Internal Error");
|
return ("Internal Error");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlSchemaValidateFacets:
|
|
||||||
* @ctxt: a schema validation context
|
|
||||||
* @base: the base type
|
|
||||||
* @facets: the list of facets to check
|
|
||||||
* @value: the lexical repr of the value to validate
|
|
||||||
* @val: the precomputed value
|
|
||||||
*
|
|
||||||
* Check a value against all facet conditions
|
|
||||||
*
|
|
||||||
* Returns 0 if the element is schemas valid, a positive error code
|
|
||||||
* number otherwise and -1 in case of internal or API error.
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
xmlSchemaValidateFacets(xmlSchemaValidCtxtPtr ctxt,
|
|
||||||
xmlSchemaTypePtr base,
|
|
||||||
xmlSchemaFacetPtr facets, const xmlChar * value)
|
|
||||||
{
|
|
||||||
return(xmlSchemaValidateFacetsInternal(ctxt, base, facets, value, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xmlSchemaValidateFacetsInternal:
|
* xmlSchemaValidateFacetsInternal:
|
||||||
* @ctxt: a schema validation context
|
* @ctxt: a schema validation context
|
||||||
@@ -5201,6 +5187,27 @@ xmlSchemaValidateFacetsInternal(xmlSchemaValidCtxtPtr ctxt,
|
|||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSchemaValidateFacets:
|
||||||
|
* @ctxt: a schema validation context
|
||||||
|
* @base: the base type
|
||||||
|
* @facets: the list of facets to check
|
||||||
|
* @value: the lexical repr of the value to validate
|
||||||
|
* @val: the precomputed value
|
||||||
|
*
|
||||||
|
* Check a value against all facet conditions
|
||||||
|
*
|
||||||
|
* Returns 0 if the element is schemas valid, a positive error code
|
||||||
|
* number otherwise and -1 in case of internal or API error.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
xmlSchemaValidateFacets(xmlSchemaValidCtxtPtr ctxt,
|
||||||
|
xmlSchemaTypePtr base,
|
||||||
|
xmlSchemaFacetPtr facets, const xmlChar * value)
|
||||||
|
{
|
||||||
|
return(xmlSchemaValidateFacetsInternal(ctxt, base, facets, value, 1));
|
||||||
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Simple type validation *
|
* Simple type validation *
|
||||||
@@ -5256,7 +5263,7 @@ xmlSchemaValidateSimpleValueUnion(xmlSchemaValidCtxtPtr ctxt,
|
|||||||
if (tmp != NULL)
|
if (tmp != NULL)
|
||||||
xmlFree(tmp);
|
xmlFree(tmp);
|
||||||
if (prefix != NULL)
|
if (prefix != NULL)
|
||||||
xmlFree(prefix);
|
xmlFree((void *)prefix);
|
||||||
ret = xmlSchemaValidateSimpleValueInternal(ctxt, subtype, value, 0);
|
ret = xmlSchemaValidateSimpleValueInternal(ctxt, subtype, value, 0);
|
||||||
if ((ret == 0) || (ret == -1)) {
|
if ((ret == 0) || (ret == -1)) {
|
||||||
return (ret);
|
return (ret);
|
||||||
@@ -6227,7 +6234,7 @@ static int
|
|||||||
xmlSchemaValidateAttributes(xmlSchemaValidCtxtPtr ctxt, xmlNodePtr elem,
|
xmlSchemaValidateAttributes(xmlSchemaValidCtxtPtr ctxt, xmlNodePtr elem,
|
||||||
xmlSchemaAttributePtr attributes)
|
xmlSchemaAttributePtr attributes)
|
||||||
{
|
{
|
||||||
int i, ret, count = 1;
|
int i, ret;
|
||||||
xmlAttrPtr attr;
|
xmlAttrPtr attr;
|
||||||
xmlChar *value;
|
xmlChar *value;
|
||||||
xmlSchemaAttributeGroupPtr group = NULL;
|
xmlSchemaAttributeGroupPtr group = NULL;
|
||||||
|
@@ -44,7 +44,7 @@ typedef enum {
|
|||||||
XML_TEXTWRITER_DTD_ENTY, /* entity */
|
XML_TEXTWRITER_DTD_ENTY, /* entity */
|
||||||
XML_TEXTWRITER_DTD_ENTY_TEXT,
|
XML_TEXTWRITER_DTD_ENTY_TEXT,
|
||||||
XML_TEXTWRITER_DTD_PENT, /* parameter entity */
|
XML_TEXTWRITER_DTD_PENT, /* parameter entity */
|
||||||
XML_TEXTWRITER_COMMENT,
|
XML_TEXTWRITER_COMMENT
|
||||||
} xmlTextWriterState;
|
} xmlTextWriterState;
|
||||||
|
|
||||||
typedef struct _xmlTextWriterStackEntry xmlTextWriterStackEntry;
|
typedef struct _xmlTextWriterStackEntry xmlTextWriterStackEntry;
|
||||||
@@ -1326,7 +1326,6 @@ xmlTextWriterWriteString(xmlTextWriterPtr writer, const xmlChar * content)
|
|||||||
switch (p->state) {
|
switch (p->state) {
|
||||||
case XML_TEXTWRITER_NAME:
|
case XML_TEXTWRITER_NAME:
|
||||||
case XML_TEXTWRITER_TEXT:
|
case XML_TEXTWRITER_TEXT:
|
||||||
encode:
|
|
||||||
buf = xmlEncodeSpecialChars(NULL, content);
|
buf = xmlEncodeSpecialChars(NULL, content);
|
||||||
break;
|
break;
|
||||||
case XML_TEXTWRITER_ATTRIBUTE:
|
case XML_TEXTWRITER_ATTRIBUTE:
|
||||||
@@ -1334,6 +1333,8 @@ xmlTextWriterWriteString(xmlTextWriterPtr writer, const xmlChar * content)
|
|||||||
xmlAttrSerializeTxtContent(writer->out->buffer, NULL,
|
xmlAttrSerializeTxtContent(writer->out->buffer, NULL,
|
||||||
NULL, content);
|
NULL, content);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3556,7 +3557,6 @@ xmlTextWriterEndDTDEntity(xmlTextWriterPtr writer)
|
|||||||
sum += count;
|
sum += count;
|
||||||
case XML_TEXTWRITER_DTD_ENTY:
|
case XML_TEXTWRITER_DTD_ENTY:
|
||||||
case XML_TEXTWRITER_DTD_PENT:
|
case XML_TEXTWRITER_DTD_PENT:
|
||||||
enddtd:
|
|
||||||
count = xmlOutputBufferWriteString(writer->out, ">");
|
count = xmlOutputBufferWriteString(writer->out, ">");
|
||||||
if (count < 0)
|
if (count < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
Reference in New Issue
Block a user