From a5d84370afeabc277136bb8ccd035807cef644a4 Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Wed, 2 Dec 2020 17:32:58 +0900 Subject: [PATCH] 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. Change-Id: I7e8a0b02dd22858d2150ec711abc3ba890d9c884 --- src/loaders/svg/tvgSvgLoader.cpp | 13 +++++++++---- src/loaders/svg/tvgXmlParser.cpp | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/loaders/svg/tvgSvgLoader.cpp b/src/loaders/svg/tvgSvgLoader.cpp index a4ebdfd..d6dc59d 100644 --- a/src/loaders/svg/tvgSvgLoader.cpp +++ b/src/loaders/svg/tvgSvgLoader.cpp @@ -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; diff --git a/src/loaders/svg/tvgXmlParser.cpp b/src/loaders/svg/tvgXmlParser.cpp index 473de62..e6e1aef 100644 --- a/src/loaders/svg/tvgXmlParser.cpp +++ b/src/loaders/svg/tvgXmlParser.cpp @@ -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; } -- 2.7.4