svg_loader Loader,XmlParser: String that has not been parsed returns false

Existing parser functions always return true.
Parser function's return value was not being properly used.
So, add a return to check whether it is parsed or not.
This commit is contained in:
JunsuChoi 2020-12-02 17:32:58 +09:00 committed by Hermet Park
parent ee1522a446
commit d3020b7bbe
2 changed files with 10 additions and 5 deletions

View file

@ -923,7 +923,7 @@ static bool _parseStyleAttr(void* data, const char* key, const char* value)
}
}
return true;
return false;
}
/* parse g node
@ -1593,7 +1593,7 @@ static bool _attrParseUseNode(void* data, const char* key, const char* value)
} else if (!strcmp(key, "clip-path")) {
_handleClipPathAttr(loader, node, value);
} else {
_attrParseGNode(data, key, value);
return _attrParseGNode(data, key, value);
}
return true;
}
@ -1784,6 +1784,8 @@ static bool _attrParseRadialGradientNode(void* data, const char* key, const char
grad->ref = _idFromHref(value);
} else if (!strcmp(key, "gradientUnits") && !strcmp(value, "userSpaceOnUse")) {
grad->userSpace = true;
} else {
return false;
}
return true;
@ -1835,8 +1837,9 @@ static bool _attrParseStops(void* data, const char* key, const char* value)
} else if (!strcmp(key, "stop-color")) {
_toColor(value, &stop->r, &stop->g, &stop->b, nullptr);
} else if (!strcmp(key, "style")) {
simpleXmlParseW3CAttribute(value,
_attrParseStops, data);
simpleXmlParseW3CAttribute(value, _attrParseStops, data);
} else {
return false;
}
return true;
@ -1940,6 +1943,8 @@ static bool _attrParseLinearGradientNode(void* data, const char* key, const char
grad->userSpace = true;
} else if (!strcmp(key, "gradientTransform")) {
grad->transform = _parseTransformationMatrix(value);
} else {
return false;
}
return true;

View file

@ -152,7 +152,7 @@ bool simpleXmlParseAttributes(const char* buf, unsigned bufLength, simpleXMLAttr
memcpy(tval, value, valueEnd - value);
tval[valueEnd - value] = '\0';
if (!func((void*)data, tmpBuf, tval)) return false;
func((void*)data, tmpBuf, tval);
itr = valueEnd + 1;
}