[Kdenlive-devel] [PATCH kdenlive 00/27] cppcheck fixes
Mikko Rapeli
mikko.rapeli at iki.fi
Sun Aug 28 10:24:40 UTC 2011
While waiting for proxy clips to be generated, I decided to run cppcheck
on kdenlive and fix most of the issues found. I used cppcheck version
1.49-1 available on Debian unstable.
Patches were created in one bunch but I tried to separate them in git
so that each change would still compile. I have not tested this though.
As for testing, I have used these patches to preview and do small changes
in a few old projects I have. I will run these while editing a bigger
project from now on. Obviously I'm biased but kdenlive seems a bit
snappier with these patches.
Remaining cppcheck warning are:
kdenlive-git/build$ cppcheck -I ../src -I /usr/include -I thumbnailer -I plugins/sampleplugin/ -I renderer/ -I src/cmake_bindir/ -I ../src/kiss_fft --enable=all -v --force . 2> ../cppcheck_log.txt
kdenlive-git/build$ cat ../cppcheck_log.txt | sort | uniq -c
2 [src/cmake_bindir/moc_abstractclipitem.cpp:75]: (style) Variable '_v' is assigned a value that is never used
3 [../src/jogshuttle.h:32]: (style) The class 'ShuttleThread 'does not have a constructor but it has attributes. The attributes are not initialized which may cause bugs or undefined behavior.
1 [/usr/include/kconfiggroup.h:39] -> [/usr/include/ksharedconfig.h:110]: (style) Typedef 'KSharedConfigPtr' hides typedef with same name
20 [/usr/include/kglobal.h:42] -> [/usr/include/kconfiggroup.h:39]: (style) Typedef 'KSharedConfigPtr' hides typedef with same name
19 [/usr/include/ksharedconfig.h:110] -> [/usr/include/kglobal.h:42]: (style) Typedef 'KSharedConfigPtr' hides typedef with same name
Original warnings are attached down below.
Perhaps next step would be to include cppcheck and possibly other checks
to kdenlive build process, at least as a separate test target.
Mikko Rapeli (27):
const parameters as reference
const parameter as reference
const parameters as reference
const parameters as reference
const parameter as reference and end file with new line
const parameters as reference
const parameters as reference
const parameters as reference
const parameters as reference
initialize variables in constructor
const parameters as reference
const parameters as reference
const parameter as reference
const parameters as reference
const parameter as reference
const parameter as reference
const parameters as reference
const parameter as reference
const parameter as reference
cont parameter as reference
const parameter as reference
const parameter as reference
const parameter as reference
const parameter as reference
const parameter as reference
const parameter as reference
const parameter as reference
src/abstractclipitem.cpp | 6 +++---
src/abstractclipitem.h | 6 +++---
src/abstractscopewidget.cpp | 2 +-
src/abstractscopewidget.h | 2 +-
src/audioscopes/audiospectrum.cpp | 2 +-
src/audioscopes/audiospectrum.h | 2 +-
src/audioscopes/spectrogram.cpp | 2 +-
src/audioscopes/spectrogram.h | 2 +-
src/clipmanager.cpp | 16 ++++++++--------
src/clipmanager.h | 16 ++++++++--------
src/customtrackview.cpp | 28 ++++++++++++++--------------
src/customtrackview.h | 30 +++++++++++++++---------------
src/databackup/backupwidget.cpp | 4 ++--
src/databackup/backupwidget.h | 2 +-
src/definitions.h | 12 ++++++------
src/docclipbase.cpp | 4 ++--
src/docclipbase.h | 8 ++++----
src/dvdwizardchapters.cpp | 2 +-
src/dvdwizardchapters.h | 2 +-
src/dvdwizardmenu.h | 4 +++-
src/dvdwizardvob.cpp | 4 ++--
src/dvdwizardvob.h | 4 ++--
src/effectslist.cpp | 2 +-
src/effectslist.h | 2 +-
src/effectstackedit.cpp | 2 +-
src/effectstackedit.h | 4 ++--
src/effectstackview.cpp | 4 ++--
src/effectstackview.h | 2 +-
src/geometryval.cpp | 2 +-
src/geometryval.h | 2 +-
src/guide.cpp | 2 +-
src/guide.h | 2 +-
src/kdenlivedoc.cpp | 14 +++++++-------
src/kdenlivedoc.h | 18 +++++++++---------
src/mainwindow.cpp | 4 ++--
src/mltdevicecapture.cpp | 2 +-
src/mltdevicecapture.h | 4 ++--
src/monitor.cpp | 2 +-
src/monitor.h | 2 +-
src/monitormanager.cpp | 2 +-
src/monitormanager.h | 2 +-
src/projectlist.cpp | 4 ++--
src/recmonitor.cpp | 4 ++--
src/recmonitor.h | 4 ++--
src/renderer.cpp | 10 +++++-----
src/renderer.h | 18 +++++++++---------
src/renderwidget.cpp | 2 +-
src/renderwidget.h | 2 +-
src/stopmotion/capturehandler.h | 2 +-
src/stopmotion/stopmotion.cpp | 10 +++++-----
src/stopmotion/stopmotion.h | 6 +++---
src/timecode.cpp | 4 ++--
src/timecode.h | 4 ++--
src/titlewidget.cpp | 2 +-
src/titlewidget.h | 2 +-
src/transition.cpp | 2 +-
src/transition.h | 2 +-
57 files changed, 157 insertions(+), 155 deletions(-)
----------- original cppcheck warnings ------------------
kdenlive-git/build$ cppcheck -I ../src -I /usr/include -I thumbnailer -I plugins/sampleplugin/ -I renderer/ -I src/cmake_bindir/ -I ../src/kiss_fft --enable=all -v --force . > ../cppcheck_log.txt-orig 2>&1
kdenlive-git/build$ grep "^\[" ../cppcheck_log.txt-orig | sort | uniq -c
3 [../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++.
3 [../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++.
3 [../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++.
1 [../src/abstractscopewidget.h:187]: (performance) Parameter 'movement' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/audioscopes/audiospectrum.h:59]: (performance) Parameter 'movement' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/audioscopes/spectrogram.h:55]: (performance) Parameter 'movement' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/clipmanager.h:73]: (performance) Parameter 'group' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/clipmanager.h:73]: (performance) Parameter 'url' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/clipmanager.h:80]: (performance) Parameter 'group' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/clipmanager.h:81]: (performance) Parameter 'group' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/clipmanager.h:81]: (performance) Parameter 'titleName' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/clipmanager.h:81]: (performance) Parameter 'xml' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/clipmanager.h:82]: (performance) Parameter 'group' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/clipmanager.h:82]: (performance) Parameter 'path' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/clipmanager.h:83]: (performance) Parameter 'group' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/clipmanager.h:83]: (performance) Parameter 'name' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/clipmanager.h:84]: (performance) Parameter 'color' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/clipmanager.h:84]: (performance) Parameter 'group' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/clipmanager.h:84]: (performance) Parameter 'name' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/clipmanager.h:85]: (performance) Parameter 'duration' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/clipmanager.h:85]: (performance) Parameter 'name' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/clipmanager.h:85]: (performance) Parameter 'path' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/clipmanager.h:88]: (performance) Parameter 'group' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [src/cmake_bindir/moc_abstractclipitem.cpp:75]: (style) Variable '_v' is assigned a value that is never used
1 [src/cmake_bindir/moc_customtrackview.cpp:399]: (performance) Parameter '_t1' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [src/cmake_bindir/moc_docclipbase.cpp:160]: (performance) Parameter '_t1' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [src/cmake_bindir/moc_docclipbase.cpp:167]: (performance) Parameter '_t1' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [src/cmake_bindir/moc_docclipbase.cpp:167]: (performance) Parameter '_t2' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [src/cmake_bindir/moc_effectstackedit.cpp:112]: (performance) Parameter '_t1' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [src/cmake_bindir/moc_effectstackedit.cpp:112]: (performance) Parameter '_t2' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [src/cmake_bindir/moc_mltdevicecapture.cpp:119]: (performance) Parameter '_t1' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [src/cmake_bindir/moc_stopmotion.cpp:313]: (performance) Parameter '_t1' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/customtrackview.h:120]: (performance) Parameter 'duration' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/customtrackview.h:120]: (performance) Parameter 'offset' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/customtrackview.h:212]: (performance) Parameter 'pos' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/customtrackview.h:221]: (performance) Parameter 'oldPos' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/customtrackview.h:221]: (performance) Parameter 'pos' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/customtrackview.h:234]: (performance) Parameter 'id' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/customtrackview.h:234]: (performance) Parameter 'name' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/customtrackview.h:360]: (performance) Parameter 'pos' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/customtrackview.h:63]: (performance) Parameter 'end' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/customtrackview.h:63]: (performance) Parameter 'start' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/customtrackview.h:64]: (performance) Parameter 'offset' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/customtrackview.h:66]: (performance) Parameter 'end' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/customtrackview.h:66]: (performance) Parameter 'start' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/customtrackview.h:67]: (performance) Parameter 'end' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/customtrackview.h:67]: (performance) Parameter 'start' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/customtrackview.h:72]: (performance) Parameter 'comment' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/customtrackview.h:98]: (performance) Parameter 'keyframes' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/customtrackview.h:98]: (performance) Parameter 'pos' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/databackup/backupwidget.h:40]: (performance) Parameter 'projectId' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
4 [../src/definitions.h:104]: (performance) Parameter 'name' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
4 [../src/definitions.h:104]: (performance) Parameter 'value' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
4 [../src/definitions.h:111]: (performance) Parameter 'value' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
4 [../src/definitions.h:127]: (performance) Parameter 'name' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
4 [../src/definitions.h:132]: (performance) Parameter 'name' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
4 [../src/definitions.h:142]: (performance) Parameter 'name' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
20 [../src/definitions.h:155]: (performance) Parameter 'time' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/docclipbase.h:251]: (performance) Parameter 'url' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/docclipbase.h:281]: (performance) Parameter 'id' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/docclipbase.h:283]: (performance) Parameter 'id' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/docclipbase.h:283]: (performance) Parameter 'proxyPath' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/docclipbase.h:79]: (performance) Parameter 'prop' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
3 [../src/dvdwizardchapters.h:42]: (performance) Parameter 'chapters' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
3 [../src/dvdwizardchapters.h:42]: (performance) Parameter 'durations' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
3 [../src/dvdwizardchapters.h:42]: (performance) Parameter 'movies' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
3 [../src/dvdwizardmenu.h:39]: (warning) Member variable 'DvdScene::m_height' is not initialized in the constructor.
3 [../src/dvdwizardmenu.h:39]: (warning) Member variable 'DvdScene::m_width' is not initialized in the constructor.
3 [../src/dvdwizardvob.h:52]: (performance) Parameter 'profile' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
3 [../src/dvdwizardvob.h:55]: (performance) Parameter 'path' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
20 [../src/effectslist.h:61]: (performance) Parameter 'original' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/effectstackedit.h:90]: (performance) Parameter 'd' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/geometryval.h:44]: (performance) Parameter 'profile' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/guide.h:39]: (performance) Parameter 'newPos' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
3 [../src/jogshuttle.h:32]: (style) The class 'ShuttleThread 'does not have a constructor but it has attributes. The attributes are not initialized which may cause bugs or undefined behavior.
2 [../src/kdenlivedoc.h:116]: (performance) Parameter 'expandedFolders' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/kdenlivedoc.h:118]: (performance) Parameter 'expandedFolders' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/kdenlivedoc.h:211]: (performance) Parameter 'name' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/kdenlivedoc.h:211]: (performance) Parameter 'path' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/kdenlivedoc.h:212]: (performance) Parameter 'duration' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/kdenlivedoc.h:243]: (performance) Parameter 'path' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/kdenlivedoc.h:55]: (performance) Parameter 'tracks' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/kdenlivedoc.h:86]: (performance) Parameter 'group' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/kdenlivedoc.h:86]: (performance) Parameter 'url' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/kdenlivedoc.h:87]: (performance) Parameter 'group' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/kdenlivedoc.h:91]: (performance) Parameter 'id' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/mltdevicecapture.h:92]: (performance) Parameter 'tag' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/monitor.h:117]: (performance) Parameter 'profile' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/monitormanager.h:50]: (performance) Parameter 'name' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/recmonitor.h:108]: (performance) Parameter 'txt' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/recmonitor.h:136]: (performance) Parameter 'currentProjectFolder' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/renderer.h:173]: (performance) Parameter 'profileName' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
8 [../src/renderer.h:195]: (performance) Parameter 'duration' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
8 [../src/renderer.h:195]: (performance) Parameter 'timeOffset' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
8 [../src/renderer.h:196]: (performance) Parameter 'pos' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/renderer.h:319]: (performance) Parameter 'profileName' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/renderer.h:397]: (performance) Parameter 'xml' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/renderwidget.h:119]: (performance) Parameter 'path' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/stopmotion/stopmotion.h:155]: (performance) Parameter 'resource' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/stopmotion/stopmotion.h:155]: (performance) Parameter 'service' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/stopmotion/stopmotion.h:228]: (performance) Parameter 'path' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/timecode.h:53]: (performance) Parameter 'duration' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/timecode.h:54]: (performance) Parameter 'duration' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [../src/titlewidget.h:227]: (performance) Parameter 'text' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
2 [../src/transition.h:44]: (performance) Parameter 'info' is passed as a value. It could be passed as a (const) reference which is usually faster and recommended in C++.
1 [/usr/include/kconfiggroup.h:39] -> [/usr/include/ksharedconfig.h:110]: (style) Typedef 'KSharedConfigPtr' hides typedef with same name
20 [/usr/include/kglobal.h:42] -> [/usr/include/kconfiggroup.h:39]: (style) Typedef 'KSharedConfigPtr' hides typedef with same name
19 [/usr/include/ksharedconfig.h:110] -> [/usr/include/kglobal.h:42]: (style) Typedef 'KSharedConfigPtr' hides typedef with same name
More information about the Kdenlive
mailing list