[Kdenlive-devel] [PATCH kdenlive 01/27] const parameters as reference

Mikko Rapeli mikko.rapeli at iki.fi
Sun Aug 28 10:24:41 UTC 2011


Found by cppcheck:

[../src/abstractclipitem.h:45]: (performance) Parameter 'info' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
[../src/abstractclipitem.h:52]: (performance) Parameter 'pos' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
[../src/abstractclipitem.h:53]: (performance) Parameter 'pos' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
---
 src/abstractclipitem.cpp |    6 +++---
 src/abstractclipitem.h   |    6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/abstractclipitem.cpp b/src/abstractclipitem.cpp
index 030ec84..1dd8862 100644
--- a/src/abstractclipitem.cpp
+++ b/src/abstractclipitem.cpp
@@ -29,7 +29,7 @@
 #include <QToolTip>
 #include <QGraphicsSceneMouseEvent>
 
-AbstractClipItem::AbstractClipItem(const ItemInfo info, const QRectF& rect, double fps) :
+AbstractClipItem::AbstractClipItem(const ItemInfo &info, const QRectF& rect, double fps) :
         QObject(),
         QGraphicsRectItem(rect),
         m_info(info),
@@ -395,7 +395,7 @@ double AbstractClipItem::selectedKeyFrameValue() const
     return m_keyframes.value(m_selectedKeyframe);
 }
 
-void AbstractClipItem::updateKeyFramePos(const GenTime pos, const double value)
+void AbstractClipItem::updateKeyFramePos(const GenTime &pos, const double value)
 {
     if (!m_keyframes.contains(m_editedKeyframe))
         return;
@@ -437,7 +437,7 @@ int AbstractClipItem::keyFrameNumber() const
     return m_keyframes.count();
 }
 
-int AbstractClipItem::addKeyFrame(const GenTime pos, const double value)
+int AbstractClipItem::addKeyFrame(const GenTime &pos, const double value)
 {
     QRectF br = sceneBoundingRect();
     double maxh = 100.0 / br.height() / m_keyframeFactor;
diff --git a/src/abstractclipitem.h b/src/abstractclipitem.h
index ff59dec..c621c8c 100644
--- a/src/abstractclipitem.h
+++ b/src/abstractclipitem.h
@@ -42,15 +42,15 @@ class AbstractClipItem : public QObject, public QGraphicsRectItem
 #endif
 
 public:
-    AbstractClipItem(const ItemInfo info, const QRectF& rect, double fps);
+    AbstractClipItem(const ItemInfo &info, const QRectF& rect, double fps);
     virtual ~ AbstractClipItem();
     void updateSelectedKeyFrame();
 
     /** @brief Move the selected keyframe (does not influence the effect, only the display in timeline).
     * @param pos new Position
     * @param value new Value */
-    void updateKeyFramePos(const GenTime pos, const double value);
-    int addKeyFrame(const GenTime pos, const double value);
+    void updateKeyFramePos(const GenTime &pos, const double value);
+    int addKeyFrame(const GenTime &pos, const double value);
     bool hasKeyFrames() const;
     int editedKeyFramePos() const;
     int selectedKeyFramePos() const;
-- 
1.7.5.4





More information about the Kdenlive mailing list