mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-15 04:24:28 +00:00
lottie/parser: clean up the exception handling mechanisms.
Since the parser has become stable enough, remove the exceptions and instead rely on parser error handling.
This commit is contained in:
parent
b0540929e5
commit
6b63c85404
1 changed files with 7 additions and 22 deletions
|
@ -187,18 +187,11 @@ void LottieParser::getValue(PathSet& path)
|
||||||
|
|
||||||
enterObject();
|
enterObject();
|
||||||
while (auto key = nextObjectKey()) {
|
while (auto key = nextObjectKey()) {
|
||||||
if (!strcmp(key, "i")) {
|
if (!strcmp(key, "i")) getValue(ins);
|
||||||
getValue(ins);
|
else if (!strcmp(key, "o")) getValue(outs);
|
||||||
} else if (!strcmp(key, "o")) {
|
else if (!strcmp(key, "v")) getValue(pts);
|
||||||
getValue(outs);
|
else if (!strcmp(key, "c")) closed = getBool();
|
||||||
} else if (!strcmp(key, "v")) {
|
else skip(key);
|
||||||
getValue(pts);
|
|
||||||
} else if (!strcmp(key, "c")) {
|
|
||||||
closed = getBool();
|
|
||||||
} else {
|
|
||||||
Error();
|
|
||||||
skip(key);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//exit properly from the array
|
//exit properly from the array
|
||||||
|
@ -284,10 +277,8 @@ void LottieParser::getValue(uint8_t& val)
|
||||||
if (nextArrayValue()) val = (uint8_t)(getFloat() * 2.55f);
|
if (nextArrayValue()) val = (uint8_t)(getFloat() * 2.55f);
|
||||||
//discard rest
|
//discard rest
|
||||||
while (nextArrayValue()) getFloat();
|
while (nextArrayValue()) getFloat();
|
||||||
} else if (peekType() == kNumberType) {
|
|
||||||
val = (uint8_t)(getFloat() * 2.55f);
|
|
||||||
} else {
|
} else {
|
||||||
Error();
|
val = (uint8_t)(getFloat() * 2.55f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,10 +290,8 @@ void LottieParser::getValue(float& val)
|
||||||
if (nextArrayValue()) val = getFloat();
|
if (nextArrayValue()) val = getFloat();
|
||||||
//discard rest
|
//discard rest
|
||||||
while (nextArrayValue()) getFloat();
|
while (nextArrayValue()) getFloat();
|
||||||
} else if (peekType() == kNumberType) {
|
|
||||||
val = getFloat();
|
|
||||||
} else {
|
} else {
|
||||||
Error();
|
val = getFloat();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -627,10 +616,6 @@ LottieSolidStroke* LottieParser::parseSolidStroke()
|
||||||
enterArray();
|
enterArray();
|
||||||
while (nextArrayValue()) parseKeyFrame(path);
|
while (nextArrayValue()) parseKeyFrame(path);
|
||||||
} else {
|
} else {
|
||||||
if (path.frames) {
|
|
||||||
Error();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
getValue(path.value);
|
getValue(path.value);
|
||||||
}
|
}
|
||||||
} else skip(key);
|
} else skip(key);
|
||||||
|
|
Loading…
Add table
Reference in a new issue