diff options
author | Edward Welbourne <edward.welbourne@theqtcompany.com> | 2016-05-20 13:57:59 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2016-05-31 11:14:44 +0000 |
commit | 415572bb872af5d30943ab396d1f89de918ca54b (patch) | |
tree | 3d3e4244c9f5f4fb54484400baf6105d4f8b47a3 /src/svg | |
parent | 600ae02bce34b5cd56c1ddc99553bf661ae96b1a (diff) | |
download | qtsvg-415572bb872af5d30943ab396d1f89de918ca54b.tar.gz |
QSvgAnimate{Color,Transform}: initialize all members.
Coverity (CIDs 22640, 22316) complained that some members weren't
initialized. Although setters are provided for these members, we have
no guarantee that they're called, so initialize to sensible values.
Chose indefinite repeat (repeat count -1) rather than single-shot.
In the process, discovered each class's m_to was used only in the
constructor (my initial change removed even this use, leading to a
compiler warning, as error, on OSX); so removed from both classes.
Change-Id: Ibb88a6190f2d740f57c67c1d5ee8a7b03129c510
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/svg')
-rw-r--r-- | src/svg/qsvgstyle.cpp | 21 | ||||
-rw-r--r-- | src/svg/qsvgstyle_p.h | 4 |
2 files changed, 17 insertions, 8 deletions
diff --git a/src/svg/qsvgstyle.cpp b/src/svg/qsvgstyle.cpp index e3fc79f..3cf88e0 100644 --- a/src/svg/qsvgstyle.cpp +++ b/src/svg/qsvgstyle.cpp @@ -629,10 +629,16 @@ void QSvgStyle::revert(QPainter *p, QSvgExtraStates &states) QSvgAnimateTransform::QSvgAnimateTransform(int startMs, int endMs, int byMs ) : QSvgStyleProperty(), - m_from(startMs), m_to(endMs), - m_type(Empty), m_additive(Replace), m_count(0), m_finished(false), m_transformApplied(false) + m_from(startMs), + m_totalRunningTime(endMs - startMs), + m_type(Empty), + m_additive(Replace), + m_count(0), + m_finished(false), + m_freeze(false), + m_repeatCount(-1.), + m_transformApplied(false) { - m_totalRunningTime = m_to - m_from; Q_UNUSED(byMs); } @@ -801,10 +807,13 @@ void QSvgAnimateTransform::setRepeatCount(qreal repeatCount) QSvgAnimateColor::QSvgAnimateColor(int startMs, int endMs, int byMs) : QSvgStyleProperty(), - m_from(startMs), m_to(endMs), - m_finished(false) + m_from(startMs), + m_totalRunningTime(endMs - startMs), + m_fill(false), + m_finished(false), + m_freeze(false), + m_repeatCount(-1.) { - m_totalRunningTime = m_to - m_from; Q_UNUSED(byMs); } diff --git a/src/svg/qsvgstyle_p.h b/src/svg/qsvgstyle_p.h index 53b9871..1c9537f 100644 --- a/src/svg/qsvgstyle_p.h +++ b/src/svg/qsvgstyle_p.h @@ -680,7 +680,7 @@ public: protected: void resolveMatrix(const QSvgNode *node); private: - qreal m_from, m_to; + qreal m_from; qreal m_totalRunningTime; TransformType m_type; Additive m_additive; @@ -706,7 +706,7 @@ public: virtual void revert(QPainter *p, QSvgExtraStates &states); virtual Type type() const; private: - qreal m_from, m_to; + qreal m_from; qreal m_totalRunningTime; QList<QColor> m_colors; QBrush m_oldBrush; |