From b01514d76aff5cfba8ca7963c6c38e23548c9cf1 Mon Sep 17 00:00:00 2001 From: subhransu mohanty Date: Mon, 24 Dec 2018 13:57:28 +0900 Subject: [PATCH] lottie: Fixed SVACE warning for uninitialized class member variable. Change-Id: I8c633cca49c05295499ef8ec640ec078bba369fd --- inc/lottieanimation.h | 8 ++++---- src/lottie/lottieanimation.cpp | 4 ++-- src/lottie/lottieitem.h | 31 +++++++++++++++---------------- src/lottie/lottiemodel.h | 20 ++++++++++---------- src/lottie/lottieparser.cpp | 4 ++-- src/vector/vbitmap.h | 2 +- src/vector/vbrush.h | 2 +- src/vector/vdebug.h | 4 ++-- src/vector/vdrawhelper.cpp | 2 +- src/vector/vdrawhelper.h | 12 ++++++------ 10 files changed, 44 insertions(+), 45 deletions(-) diff --git a/inc/lottieanimation.h b/inc/lottieanimation.h index 4586ac8..829ba1d 100644 --- a/inc/lottieanimation.h +++ b/inc/lottieanimation.h @@ -91,10 +91,10 @@ public: */ Surface() = default; private: - uint32_t *mBuffer; - size_t mWidth; - size_t mHeight; - size_t mBytesPerLine; + uint32_t *mBuffer{nullptr}; + size_t mWidth{0}; + size_t mHeight{0}; + size_t mBytesPerLine{0}; }; class LOT_EXPORT Animation { diff --git a/src/lottie/lottieanimation.cpp b/src/lottie/lottieanimation.cpp index 1f09922..fb5b495 100644 --- a/src/lottie/lottieanimation.cpp +++ b/src/lottie/lottieanimation.cpp @@ -90,8 +90,8 @@ struct RenderTask { RenderTask() { receiver = sender.get_future(); } std::promise sender; std::future receiver; - AnimationImpl *playerImpl; - size_t frameNo; + AnimationImpl *playerImpl{nullptr}; + size_t frameNo{0}; Surface surface; }; diff --git a/src/lottie/lottieitem.h b/src/lottie/lottieitem.h index 7a1a5a2..51ced32 100644 --- a/src/lottie/lottieitem.h +++ b/src/lottie/lottieitem.h @@ -93,7 +93,7 @@ protected: float mCombinedAlpha{0.0}; int mFrameNo{-1}; DirtyFlag mDirtyFlag{DirtyFlagBit::All}; - bool mStatic; + bool mStatic{false}; }; class LOTCompLayerItem: public LOTLayerItem @@ -109,7 +109,6 @@ protected: private: std::vector mLayersCNode; std::vector> mLayers; - int mLastFrame; }; class LOTSolidLayerItem: public LOTLayerItem @@ -333,10 +332,10 @@ protected: virtual void updateRenderNode(); inline float parentAlpha() const {return mParentAlpha;} public: - float mParentAlpha; + float mParentAlpha{1.0f}; VPath mPath; DirtyFlag mFlag; - int mFrameNo; + int mFrameNo{-1}; std::vector mPathItems; std::unique_ptr mDrawable; bool mStaticContent; @@ -353,7 +352,7 @@ protected: private: LOTFillData *mData; VColor mColor; - FillRule mFillRule; + FillRule mFillRule{FillRule::Winding}; }; class LOTGFillItem : public LOTPaintDataItem @@ -366,7 +365,7 @@ protected: private: LOTGFillData *mData; std::unique_ptr mGradient; - FillRule mFillRule; + FillRule mFillRule{FillRule::Winding}; }; class LOTStrokeItem : public LOTPaintDataItem @@ -378,13 +377,13 @@ protected: void updateRenderNode() final; private: LOTStrokeData *mData; - CapStyle mCap; - JoinStyle mJoin; - float mMiterLimit; + CapStyle mCap{CapStyle::Flat}; + JoinStyle mJoin{JoinStyle::Miter}; + float mMiterLimit{0}; VColor mColor; - float mWidth; + float mWidth{0}; float mDashArray[6]; - int mDashArraySize; + int mDashArraySize{0}; }; class LOTGStrokeItem : public LOTPaintDataItem @@ -397,13 +396,13 @@ protected: private: LOTGStrokeData *mData; std::unique_ptr mGradient; - CapStyle mCap; - JoinStyle mJoin; - float mMiterLimit; + CapStyle mCap{CapStyle::Flat}; + JoinStyle mJoin{JoinStyle::Miter}; + float mMiterLimit{0}; VColor mColor; - float mWidth; + float mWidth{0}; float mDashArray[6]; - int mDashArraySize; + int mDashArraySize{0}; }; diff --git a/src/lottie/lottiemodel.h b/src/lottie/lottiemodel.h index a939979..c9e0c23 100644 --- a/src/lottie/lottiemodel.h +++ b/src/lottie/lottiemodel.h @@ -260,7 +260,7 @@ public: } public: T mValue; - int mPropertyIndex; /* "ix" */ + int mPropertyIndex{0}; /* "ix" */ std::unique_ptr> mAnimInfo; }; @@ -354,13 +354,13 @@ public: MatteType mMatteType{MatteType::None}; VRect mBound; - LayerType mLayerType; //lottie layer type (solid/shape/precomp) + LayerType mLayerType{LayerType::Null}; //lottie layer type (solid/shape/precomp) int mParentId{-1}; // Lottie the id of the parent in the composition int mId{-1}; // Lottie the group id used for parenting. long mInFrame{0}; long mOutFrame{0}; long mStartFrame{0}; - LottieBlendMode mBlendMode; + LottieBlendMode mBlendMode{LottieBlendMode::Normal}; float mTimeStreatch{1.0f}; std::string mPreCompRefId; LOTAnimatable mTimeRemap; /* "tm" */ @@ -372,7 +372,7 @@ public: bool mRoot{false}; bool mAutoOrient{false}; std::vector> mMasks; - LOTCompositionData *mCompRef; + LOTCompositionData *mCompRef{nullptr}; }; class LOTCompositionData : public LOTData @@ -402,7 +402,7 @@ public: VSize mSize; long mStartFrame{0}; long mEndFrame{0}; - float mFrameRate; + float mFrameRate{60}; LottieBlendMode mBlendMode; std::shared_ptr mRootLayer; std::unordered_map mColor; /* "c" */ LOTAnimatable mOpacity{100}; /* "o" */ LOTAnimatable mWidth{0}; /* "w" */ - CapStyle mCapStyle; /* "lc" */ - JoinStyle mJoinStyle; /* "lj" */ + CapStyle mCapStyle{CapStyle::Flat}; /* "lc" */ + JoinStyle mJoinStyle{JoinStyle::Miter}; /* "lj" */ float mMeterLimit{0}; /* "ml" */ LOTDashProperty mDash; bool mEnabled{true}; /* "fillEnabled" */ @@ -579,7 +579,7 @@ public: private: void populate(VGradientStops &stops, int frameNo); public: - int mGradientType; /* "t" Linear=1 , Radial = 2*/ + int mGradientType{1}; /* "t" Linear=1 , Radial = 2*/ LOTAnimatable mStartPoint; /* "s" */ LOTAnimatable mEndPoint; /* "e" */ LOTAnimatable mHighlightLength{0}; /* "h" */ @@ -611,8 +611,8 @@ public: int getDashInfo(int frameNo, float *array) const; public: LOTAnimatable mWidth; /* "w" */ - CapStyle mCapStyle; /* "lc" */ - JoinStyle mJoinStyle; /* "lj" */ + CapStyle mCapStyle{CapStyle::Flat}; /* "lc" */ + JoinStyle mJoinStyle{JoinStyle::Miter}; /* "lj" */ float mMeterLimit{0}; /* "ml" */ LOTDashProperty mDash; }; diff --git a/src/lottie/lottieparser.cpp b/src/lottie/lottieparser.cpp index 91e9f39..3474691 100644 --- a/src/lottie/lottieparser.cpp +++ b/src/lottie/lottieparser.cpp @@ -250,8 +250,8 @@ public: protected: std::shared_ptr mComposition; - LOTCompositionData * compRef; - LOTLayerData * curLayerRef; + LOTCompositionData * compRef{nullptr}; + LOTLayerData * curLayerRef{nullptr}; std::vector> mLayersToUpdate; void SkipOut(int depth); }; diff --git a/src/vector/vbitmap.h b/src/vector/vbitmap.h index a5223d9..717e415 100644 --- a/src/vector/vbitmap.h +++ b/src/vector/vbitmap.h @@ -37,7 +37,7 @@ public: private: void detach(); void cleanUp(VBitmapData *x); - VBitmapData *d; + VBitmapData *d{nullptr}; }; V_END_NAMESPACE diff --git a/src/vector/vbrush.h b/src/vector/vbrush.h index 9a31715..46433df 100644 --- a/src/vector/vbrush.h +++ b/src/vector/vbrush.h @@ -65,7 +65,7 @@ public: public: VBrush::Type mType{Type::NoBrush}; VColor mColor; - const VGradient *mGradient; + const VGradient *mGradient{nullptr}; }; V_END_NAMESPACE diff --git a/src/vector/vdebug.h b/src/vector/vdebug.h index c1ae239..1b089e1 100644 --- a/src/vector/vdebug.h +++ b/src/vector/vdebug.h @@ -78,8 +78,8 @@ private: void stringify(std::ostream& os, char* start, char const* const end); private: - size_t m_bytes_used; - size_t m_buffer_size; + size_t m_bytes_used{0}; + size_t m_buffer_size{0}; std::unique_ptr m_heap_buffer; bool m_logAll; char m_stack_buffer[256 - sizeof(bool) - 2 * sizeof(size_t) - diff --git a/src/vector/vdrawhelper.cpp b/src/vector/vdrawhelper.cpp index 2deb2aa..d48ecda 100644 --- a/src/vector/vdrawhelper.cpp +++ b/src/vector/vdrawhelper.cpp @@ -10,7 +10,7 @@ public: inline CacheInfo(VGradientStops s) : stops(std::move(s)) {} uint32_t buffer32[VGradient::colorTableSize]; VGradientStops stops; - bool alpha; + bool alpha{true}; }; typedef std::unordered_multimap> diff --git a/src/vector/vdrawhelper.h b/src/vector/vdrawhelper.h index 51a068b..51d6db3 100644 --- a/src/vector/vdrawhelper.h +++ b/src/vector/vdrawhelper.h @@ -75,15 +75,15 @@ public: int bytesPerLine() const { return mBytesPerLine; } int bytesPerPixel() const { return mBytesPerPixel; } - VBitmap::Format mFormat; + VBitmap::Format mFormat{VBitmap::Format::ARGB32_Premultiplied}; VPainter::CompositionMode mCompositionMode; private: - int mWidth; - int mHeight; - int mBytesPerLine; - int mBytesPerPixel; - uchar *mBuffer; + int mWidth{0}; + int mHeight{0}; + int mBytesPerLine{0}; + int mBytesPerPixel{0}; + uchar *mBuffer{nullptr}; }; struct VGradientData { -- 2.34.1