svg_loader SvgPath: Added corner case handling for flags of Arc
authorJunsuChoi <jsuya.choi@samsung.com>
Fri, 2 Jul 2021 02:14:56 +0000 (11:14 +0900)
committerJunsuChoi <jsuya.choi@samsung.com>
Wed, 7 Jul 2021 02:57:02 +0000 (11:57 +0900)
Moved the if statement to check if it is a float.

This patch is that reverts and fixes the reverted patch 55a5b9.

src/loaders/svg/tvgSvgPath.cpp

index d1bd3a6..a962cd2 100644 (file)
@@ -58,15 +58,17 @@ static bool _parseNumber(char** content, float* number)
 static bool _parseFlag(char** content, int* number)
 {
     char* end = NULL;
-    *number = strtol(*content, &end, 10);
-    //If the start of string is not number or a number was a float
-    if ((*content) == end || *end == '.') return false;
-    //If a flag has a different value than 0 or 1
-    if (*number != 0 && *number != 1) return false;
+    if (*(*content) != '0' && *(*content) != '1') return false;
+    *number = *(*content) - '0';
+    *content += 1;
+    end = *content;
+    if (end && *end == '.') return false;
     *content = _skipComma(end);
+
     return true;
 }
 
+
 void _pathAppendArcTo(Array<PathCommand>* cmds, Array<Point>* pts, Point* cur, Point* curCtl, float x, float y, float rx, float ry, float angle, bool largeArc, bool sweep)
 {
     float cxp, cyp, cx, cy;