mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-08-01 10:06:59 +03:00
Remove useless comparisons
Found by lgtm.com
This commit is contained in:
@ -1251,8 +1251,7 @@ xmlNanoFTPConnectTo(const char *server, int port) {
|
|||||||
xmlNanoFTPFreeCtxt(ctxt);
|
xmlNanoFTPFreeCtxt(ctxt);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
if (port != 0)
|
ctxt->port = port;
|
||||||
ctxt->port = port;
|
|
||||||
res = xmlNanoFTPConnect(ctxt);
|
res = xmlNanoFTPConnect(ctxt);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
xmlNanoFTPFreeCtxt(ctxt);
|
xmlNanoFTPFreeCtxt(ctxt);
|
||||||
|
1
parser.c
1
parser.c
@ -3912,7 +3912,6 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
|
|||||||
"AttValue length too long\n");
|
"AttValue length too long\n");
|
||||||
goto mem_error;
|
goto mem_error;
|
||||||
}
|
}
|
||||||
if (c == 0) break;
|
|
||||||
if (c == '&') {
|
if (c == '&') {
|
||||||
in_space = 0;
|
in_space = 0;
|
||||||
if (NXT(1) == '#') {
|
if (NXT(1) == '#') {
|
||||||
|
41
valid.c
41
valid.c
@ -5919,28 +5919,27 @@ xmlValidatePushCData(xmlValidCtxtPtr ctxt, const xmlChar *data, int len) {
|
|||||||
break;
|
break;
|
||||||
case XML_ELEMENT_TYPE_MIXED:
|
case XML_ELEMENT_TYPE_MIXED:
|
||||||
break;
|
break;
|
||||||
case XML_ELEMENT_TYPE_ELEMENT:
|
case XML_ELEMENT_TYPE_ELEMENT: {
|
||||||
if (len > 0) {
|
int i;
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0;i < len;i++) {
|
for (i = 0;i < len;i++) {
|
||||||
if (!IS_BLANK_CH(data[i])) {
|
if (!IS_BLANK_CH(data[i])) {
|
||||||
xmlErrValidNode(ctxt, state->node,
|
xmlErrValidNode(ctxt, state->node,
|
||||||
XML_DTD_CONTENT_MODEL,
|
XML_DTD_CONTENT_MODEL,
|
||||||
"Element %s content does not follow the DTD, Text not allowed\n",
|
"Element %s content does not follow the DTD, Text not allowed\n",
|
||||||
state->node->name, NULL, NULL);
|
state->node->name, NULL, NULL);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* TODO:
|
* TODO:
|
||||||
* VC: Standalone Document Declaration
|
* VC: Standalone Document Declaration
|
||||||
* element types with element content, if white space
|
* element types with element content, if white space
|
||||||
* occurs directly within any instance of those types.
|
* occurs directly within any instance of those types.
|
||||||
*/
|
*/
|
||||||
}
|
break;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6055,7 +6055,7 @@ xmlAutomataNewOnceTrans2(xmlAutomataPtr am, xmlAutomataStatePtr from,
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
if (min < 1)
|
if (min < 1)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
if ((max < min) || (max < 1))
|
if (max < min)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
atom = xmlRegNewAtom(am, XML_REGEXP_STRING);
|
atom = xmlRegNewAtom(am, XML_REGEXP_STRING);
|
||||||
if (atom == NULL)
|
if (atom == NULL)
|
||||||
@ -6134,7 +6134,7 @@ xmlAutomataNewOnceTrans(xmlAutomataPtr am, xmlAutomataStatePtr from,
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
if (min < 1)
|
if (min < 1)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
if ((max < min) || (max < 1))
|
if (max < min)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
atom = xmlRegNewAtom(am, XML_REGEXP_STRING);
|
atom = xmlRegNewAtom(am, XML_REGEXP_STRING);
|
||||||
if (atom == NULL)
|
if (atom == NULL)
|
||||||
|
187
xmlschemas.c
187
xmlschemas.c
@ -24184,7 +24184,7 @@ xmlSchemaValidateFacets(xmlSchemaAbstractCtxtPtr actxt,
|
|||||||
unsigned long length,
|
unsigned long length,
|
||||||
int fireErrors)
|
int fireErrors)
|
||||||
{
|
{
|
||||||
int ret, error = 0;
|
int ret, error = 0, found;
|
||||||
|
|
||||||
xmlSchemaTypePtr tmpType;
|
xmlSchemaTypePtr tmpType;
|
||||||
xmlSchemaFacetLinkPtr facetLink;
|
xmlSchemaFacetLinkPtr facetLink;
|
||||||
@ -24308,103 +24308,98 @@ WXS_IS_LIST:
|
|||||||
}
|
}
|
||||||
|
|
||||||
pattern_and_enum:
|
pattern_and_enum:
|
||||||
if (error >= 0) {
|
found = 0;
|
||||||
int found = 0;
|
/*
|
||||||
/*
|
* Process enumerations. Facet values are in the value space
|
||||||
* Process enumerations. Facet values are in the value space
|
* of the defining type's base type. This seems to be a bug in the
|
||||||
* of the defining type's base type. This seems to be a bug in the
|
* XML Schema 1.0 spec. Use the whitespace type of the base type.
|
||||||
* XML Schema 1.0 spec. Use the whitespace type of the base type.
|
* Only the first set of enumerations in the ancestor-or-self axis
|
||||||
* Only the first set of enumerations in the ancestor-or-self axis
|
* is used for validation.
|
||||||
* is used for validation.
|
*/
|
||||||
*/
|
ret = 0;
|
||||||
ret = 0;
|
tmpType = type;
|
||||||
tmpType = type;
|
do {
|
||||||
do {
|
for (facet = tmpType->facets; facet != NULL; facet = facet->next) {
|
||||||
for (facet = tmpType->facets; facet != NULL; facet = facet->next) {
|
if (facet->type != XML_SCHEMA_FACET_ENUMERATION)
|
||||||
if (facet->type != XML_SCHEMA_FACET_ENUMERATION)
|
continue;
|
||||||
continue;
|
found = 1;
|
||||||
found = 1;
|
ret = xmlSchemaAreValuesEqual(facet->val, val);
|
||||||
ret = xmlSchemaAreValuesEqual(facet->val, val);
|
if (ret == 1)
|
||||||
if (ret == 1)
|
break;
|
||||||
break;
|
else if (ret < 0) {
|
||||||
else if (ret < 0) {
|
AERROR_INT("xmlSchemaValidateFacets",
|
||||||
AERROR_INT("xmlSchemaValidateFacets",
|
"validating against an enumeration facet");
|
||||||
"validating against an enumeration facet");
|
return (-1);
|
||||||
return (-1);
|
}
|
||||||
}
|
}
|
||||||
}
|
if (ret != 0)
|
||||||
if (ret != 0)
|
break;
|
||||||
break;
|
/*
|
||||||
/*
|
* Break on the first set of enumerations. Any additional
|
||||||
* Break on the first set of enumerations. Any additional
|
* enumerations which might be existent on the ancestors
|
||||||
* enumerations which might be existent on the ancestors
|
* of the current type are restricted by this set; thus
|
||||||
* of the current type are restricted by this set; thus
|
* *must* *not* be taken into account.
|
||||||
* *must* *not* be taken into account.
|
*/
|
||||||
*/
|
if (found)
|
||||||
if (found)
|
break;
|
||||||
break;
|
tmpType = tmpType->baseType;
|
||||||
tmpType = tmpType->baseType;
|
} while ((tmpType != NULL) &&
|
||||||
} while ((tmpType != NULL) &&
|
(tmpType->type != XML_SCHEMA_TYPE_BASIC));
|
||||||
(tmpType->type != XML_SCHEMA_TYPE_BASIC));
|
if (found && (ret == 0)) {
|
||||||
if (found && (ret == 0)) {
|
ret = XML_SCHEMAV_CVC_ENUMERATION_VALID;
|
||||||
ret = XML_SCHEMAV_CVC_ENUMERATION_VALID;
|
if (fireErrors) {
|
||||||
if (fireErrors) {
|
xmlSchemaFacetErr(actxt, ret, node,
|
||||||
xmlSchemaFacetErr(actxt, ret, node,
|
value, 0, type, NULL, NULL, NULL, NULL);
|
||||||
value, 0, type, NULL, NULL, NULL, NULL);
|
} else
|
||||||
} else
|
return (ret);
|
||||||
return (ret);
|
if (error == 0)
|
||||||
if (error == 0)
|
error = ret;
|
||||||
error = ret;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error >= 0) {
|
/*
|
||||||
int found;
|
* Process patters. Pattern facets are ORed at type level
|
||||||
/*
|
* and ANDed if derived. Walk the base type axis.
|
||||||
* Process patters. Pattern facets are ORed at type level
|
*/
|
||||||
* and ANDed if derived. Walk the base type axis.
|
tmpType = type;
|
||||||
*/
|
facet = NULL;
|
||||||
tmpType = type;
|
do {
|
||||||
facet = NULL;
|
found = 0;
|
||||||
do {
|
for (facetLink = tmpType->facetSet; facetLink != NULL;
|
||||||
found = 0;
|
facetLink = facetLink->next) {
|
||||||
for (facetLink = tmpType->facetSet; facetLink != NULL;
|
if (facetLink->facet->type != XML_SCHEMA_FACET_PATTERN)
|
||||||
facetLink = facetLink->next) {
|
continue;
|
||||||
if (facetLink->facet->type != XML_SCHEMA_FACET_PATTERN)
|
found = 1;
|
||||||
continue;
|
/*
|
||||||
found = 1;
|
* NOTE that for patterns, @value needs to be the
|
||||||
/*
|
* normalized value.
|
||||||
* NOTE that for patterns, @value needs to be the
|
*/
|
||||||
* normalized value.
|
ret = xmlRegexpExec(facetLink->facet->regexp, value);
|
||||||
*/
|
if (ret == 1)
|
||||||
ret = xmlRegexpExec(facetLink->facet->regexp, value);
|
break;
|
||||||
if (ret == 1)
|
else if (ret < 0) {
|
||||||
break;
|
AERROR_INT("xmlSchemaValidateFacets",
|
||||||
else if (ret < 0) {
|
"validating against a pattern facet");
|
||||||
AERROR_INT("xmlSchemaValidateFacets",
|
return (-1);
|
||||||
"validating against a pattern facet");
|
} else {
|
||||||
return (-1);
|
/*
|
||||||
} else {
|
* Save the last non-validating facet.
|
||||||
/*
|
*/
|
||||||
* Save the last non-validating facet.
|
facet = facetLink->facet;
|
||||||
*/
|
}
|
||||||
facet = facetLink->facet;
|
}
|
||||||
}
|
if (found && (ret != 1)) {
|
||||||
}
|
ret = XML_SCHEMAV_CVC_PATTERN_VALID;
|
||||||
if (found && (ret != 1)) {
|
if (fireErrors) {
|
||||||
ret = XML_SCHEMAV_CVC_PATTERN_VALID;
|
xmlSchemaFacetErr(actxt, ret, node,
|
||||||
if (fireErrors) {
|
value, 0, type, facet, NULL, NULL, NULL);
|
||||||
xmlSchemaFacetErr(actxt, ret, node,
|
} else
|
||||||
value, 0, type, facet, NULL, NULL, NULL);
|
return (ret);
|
||||||
} else
|
if (error == 0)
|
||||||
return (ret);
|
error = ret;
|
||||||
if (error == 0)
|
break;
|
||||||
error = ret;
|
}
|
||||||
break;
|
tmpType = tmpType->baseType;
|
||||||
}
|
} while ((tmpType != NULL) && (tmpType->type != XML_SCHEMA_TYPE_BASIC));
|
||||||
tmpType = tmpType->baseType;
|
|
||||||
} while ((tmpType != NULL) && (tmpType->type != XML_SCHEMA_TYPE_BASIC));
|
|
||||||
}
|
|
||||||
|
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user