mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +00:00
lottie: fixed a compiler warning:
error: storing the address of local variable 'context' in '*this.LottieParser::context' [-Werror=dangling-pointer=] 1255 | this->context = &context; issue: https://github.com/thorvg/thorvg/issues/2051
This commit is contained in:
parent
93209232c3
commit
211f0dc9b6
2 changed files with 4 additions and 10 deletions
|
@ -252,7 +252,7 @@ void LottieParser::getValue(ColorStop& color)
|
|||
{
|
||||
if (peekType() == kArrayType) enterArray();
|
||||
|
||||
color.input = new Array<float>(context->gradient->colorStops.count);
|
||||
color.input = new Array<float>(context.gradient->colorStops.count);
|
||||
|
||||
while (nextArrayValue()) color.input->push(getFloat());
|
||||
}
|
||||
|
@ -700,7 +700,7 @@ LottieRoundedCorner* LottieParser::parseRoundedCorner()
|
|||
|
||||
void LottieParser::parseGradient(LottieGradient* gradient, const char* key)
|
||||
{
|
||||
context->gradient = gradient;
|
||||
context.gradient = gradient;
|
||||
|
||||
if (!strcmp(key, "t")) gradient->id = getInt();
|
||||
else if (!strcmp(key, "o")) parseProperty<LottieProperty::Type::Opacity>(gradient->opacity, gradient);
|
||||
|
@ -1132,7 +1132,7 @@ LottieLayer* LottieParser::parseLayer()
|
|||
if (!layer) return nullptr;
|
||||
|
||||
layer->comp = comp;
|
||||
context->layer = layer;
|
||||
context.layer = layer;
|
||||
|
||||
auto ddd = false;
|
||||
|
||||
|
@ -1253,8 +1253,6 @@ bool LottieParser::parse(LottieSlot* slot)
|
|||
{
|
||||
enterObject();
|
||||
|
||||
LottieParser::Context context;
|
||||
this->context = &context;
|
||||
LottieObject* obj = nullptr; //slot object
|
||||
|
||||
switch (slot->type) {
|
||||
|
@ -1303,10 +1301,6 @@ bool LottieParser::parse()
|
|||
|
||||
Array<LottieGlyph*> glyphes;
|
||||
|
||||
//assign parsing context
|
||||
LottieParser::Context context;
|
||||
this->context = &context;
|
||||
|
||||
while (auto key = nextObjectKey()) {
|
||||
if (!strcmp(key, "v")) comp->version = getStringCopy();
|
||||
else if (!strcmp(key, "fr")) comp->frameRate = getFloat();
|
||||
|
|
|
@ -110,7 +110,7 @@ private:
|
|||
struct Context {
|
||||
LottieLayer* layer = nullptr;
|
||||
LottieGradient* gradient = nullptr;
|
||||
} *context;
|
||||
} context;
|
||||
};
|
||||
|
||||
#endif //_TVG_LOTTIE_PARSER_H_
|
Loading…
Add table
Reference in a new issue