aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Pinon <[email protected]>2015-08-05 00:18:57 +0200
committerVincent Pinon <[email protected]>2015-08-05 00:28:27 +0200
commit4c073a215c532cad54d7c9bd2bd8a0739575db70 (patch)
tree609c12a7f0da4bbb4b6efab50fe94567ec4b1298
parent770fc2417b2c6db72ddbdd389e3be6b5cbc4a8df (diff)
fix clang scan-build warnings
-rw-r--r--src/bin/projectitemmodel.cpp2
-rw-r--r--src/doc/documentchecker.cpp1
-rw-r--r--src/effectstack/widgets/doubleparameterwidget.cpp2
-rw-r--r--src/effectstack/widgets/lumaliftgain.cpp1
-rw-r--r--src/lib/audio/audioEnvelope.cpp2
-rw-r--r--src/project/projectcommands.cpp27
-rw-r--r--src/renderer.cpp2
-rw-r--r--src/scopes/abstractscopewidget.cpp4
-rw-r--r--src/scopes/colorscopes/histogramgenerator.cpp43
-rw-r--r--src/utils/freesound.cpp2
10 files changed, 52 insertions, 34 deletions
diff --git a/src/bin/projectitemmodel.cpp b/src/bin/projectitemmodel.cpp
index 1706987..f5ffc5e 100644
--- a/src/bin/projectitemmodel.cpp
+++ b/src/bin/projectitemmodel.cpp
@@ -265,7 +265,7 @@ QMimeData* ProjectItemModel::mimeData(const QModelIndexList& indices) const
QStringList list;
for (int i = 0; i < indices.count(); i++) {
QModelIndex ix = indices.at(i);
- if (!ix.isValid() || !ix.column() == 0) continue;
+ if (!ix.isValid() || ix.column() != 0) continue;
AbstractProjectItem *item = static_cast<AbstractProjectItem*>(ix.internalPointer());
AbstractProjectItem::PROJECTITEMTYPE type = item->itemType();
if (type == AbstractProjectItem::ClipItem) {
diff --git a/src/doc/documentchecker.cpp b/src/doc/documentchecker.cpp
index db73c09..e0fba64 100644
--- a/src/doc/documentchecker.cpp
+++ b/src/doc/documentchecker.cpp
@@ -44,7 +44,6 @@ const int idRole = Qt::UserRole + 2;
const int statusRole = Qt::UserRole + 3;
const int typeRole = Qt::UserRole + 4;
const int typeOriginalResource = Qt::UserRole + 5;
-const int resetDurationRole = Qt::UserRole + 6;
const int CLIPMISSING = 0;
const int CLIPOK = 1;
diff --git a/src/effectstack/widgets/doubleparameterwidget.cpp b/src/effectstack/widgets/doubleparameterwidget.cpp
index 7ed8c42..0feed29 100644
--- a/src/effectstack/widgets/doubleparameterwidget.cpp
+++ b/src/effectstack/widgets/doubleparameterwidget.cpp
@@ -34,7 +34,7 @@ DoubleParameterWidget::DoubleParameterWidget(const QString &name, double value,
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
- m_dragVal = new DragValue(name, defaultValue, decimals, min, max, id, suffix, this);
+ m_dragVal = new DragValue(name, defaultValue, decimals, min, max, id, suffix, true, this);
layout->addWidget(m_dragVal, 0, 1);
if (!comment.isEmpty()) {
diff --git a/src/effectstack/widgets/lumaliftgain.cpp b/src/effectstack/widgets/lumaliftgain.cpp
index 37a2881..46698d0 100644
--- a/src/effectstack/widgets/lumaliftgain.cpp
+++ b/src/effectstack/widgets/lumaliftgain.cpp
@@ -29,7 +29,6 @@
#include <QDebug>
#include <KLocalizedString>
-static const double LIFT_FACTOR = 1.0;
static const double GAMMA_FACTOR = 2.0;
static const double GAIN_FACTOR = 4.0;
diff --git a/src/lib/audio/audioEnvelope.cpp b/src/lib/audio/audioEnvelope.cpp
index e61f8c2..c0d1938 100644
--- a/src/lib/audio/audioEnvelope.cpp
+++ b/src/lib/audio/audioEnvelope.cpp
@@ -99,7 +99,7 @@ void AudioEnvelope::loadEnvelope()
qint64 sum = 0;
for (int k = 0; k < samples; ++k) {
- sum += fabs(data[k]);
+ sum += abs(data[k]);
}
m_envelope[i] = sum;
diff --git a/src/project/projectcommands.cpp b/src/project/projectcommands.cpp
index a17013c..2bc1bc9 100644
--- a/src/project/projectcommands.cpp
+++ b/src/project/projectcommands.cpp
@@ -40,6 +40,13 @@ AddClipCutCommand::AddClipCutCommand(ProjectList *list, const QString &id, int i
// virtual
void AddClipCutCommand::undo()
{
+ Q_UNUSED(m_list)
+ Q_UNUSED(m_id)
+ Q_UNUSED(m_in)
+ Q_UNUSED(m_out)
+ Q_UNUSED(m_desc)
+ Q_UNUSED(m_newItem)
+ Q_UNUSED(m_remove)
/*if (m_remove)
m_list->addClipCut(m_id, m_in, m_out, m_desc, m_newItem);
else
@@ -69,6 +76,10 @@ AddFolderCommand::AddFolderCommand(ProjectList *view, const QString &folderName,
// virtual
void AddFolderCommand::undo()
{
+ Q_UNUSED(m_view)
+ Q_UNUSED(m_name)
+ Q_UNUSED(m_id)
+ Q_UNUSED(m_doIt)
/*if (m_doIt)
m_view->slotAddFolder(m_name, m_id, true);
else
@@ -98,14 +109,20 @@ EditClipCutCommand::EditClipCutCommand(ProjectList *list, const QString &id, con
// virtual
void EditClipCutCommand::undo()
{
+ Q_UNUSED(m_list)
+ Q_UNUSED(m_id)
+ Q_UNUSED(m_oldZone)
+ Q_UNUSED(m_newZone)
+ Q_UNUSED(m_oldComment)
+ Q_UNUSED(m_newComment)
+ Q_UNUSED(m_doIt)
//m_list->doUpdateClipCut(m_id, m_newZone, m_oldZone, m_oldComment);
}
// virtual
void EditClipCutCommand::redo()
{
/*if (m_doIt)
- m_list->doUpdateClipCut(m_id, m_oldZone, m_newZone, m_newComment);
- m_doIt = true;*/
+ m_list->doUpdateClipCut(m_id, m_oldZone, m_newZone, m_newComment); */
}
EditFolderCommand::EditFolderCommand(ProjectList *view, const QString &newfolderName, const QString &oldfolderName, const QString &clipId, bool doIt, QUndoCommand *parent) :
@@ -121,13 +138,17 @@ EditFolderCommand::EditFolderCommand(ProjectList *view, const QString &newfolder
// virtual
void EditFolderCommand::undo()
{
+ Q_UNUSED(m_view)
+ Q_UNUSED(m_name)
+ Q_UNUSED(m_oldname)
+ Q_UNUSED(m_id)
+ Q_UNUSED(m_doIt)
//m_view->slotAddFolder(m_oldname, m_id, false, true);
}
// virtual
void EditFolderCommand::redo()
{
//if (m_doIt) m_view->slotAddFolder(m_name, m_id, false, true);
- m_doIt = true;
}
AddMarkerCommand::AddMarkerCommand(ProjectClip *clip, QList <CommentedTime> &oldMarkers, QList <CommentedTime> &newMarkers, QUndoCommand * parent) :
diff --git a/src/renderer.cpp b/src/renderer.cpp
index 3c5ed5e..898f300 100644
--- a/src/renderer.cpp
+++ b/src/renderer.cpp
@@ -3389,6 +3389,7 @@ QList <TransitionInfo> Render::mltInsertTrack(int ix, const QString &name, bool
QList <TransitionInfo> transitionInfos;
// Track add / delete was only added recently in MLT (pre 0.9.8 release).
#if (LIBMLT_VERSION_INT < 0x0908)
+ Q_UNUSED(ix)
Q_UNUSED(name)
Q_UNUSED(videoTrack)
qDebug()<<"Track insertion requires a more recent MLT version";
@@ -3512,6 +3513,7 @@ void Render::mltDeleteTrack(int ix)
{
// Track add / delete was only added recently in MLT (pre 0.9.8 release).
#if (LIBMLT_VERSION_INT < 0x0908)
+ Q_UNUSED(ix)
qDebug()<<"Track insertion requires a more recent MLT version";
return;
#else
diff --git a/src/scopes/abstractscopewidget.cpp b/src/scopes/abstractscopewidget.cpp
index f4f1f3c..cfa8d00 100644
--- a/src/scopes/abstractscopewidget.cpp
+++ b/src/scopes/abstractscopewidget.cpp
@@ -362,9 +362,9 @@ void AbstractScopeWidget::mouseMoveEvent(QMouseEvent *event)
if (movement.manhattanLength() > m_rescaleMinDist) {
float diff = ((float) movement.y())/movement.x();
- if (abs(diff) > m_rescaleVerticalThreshold || movement.x() == 0) {
+ if (fabs(diff) > m_rescaleVerticalThreshold || movement.x() == 0) {
m_rescaleDirection = North;
- } else if (abs(diff) < 1/m_rescaleVerticalThreshold) {
+ } else if (fabs(diff) < 1/m_rescaleVerticalThreshold) {
m_rescaleDirection = East;
} else if (diff < 0) {
m_rescaleDirection = Northeast;
diff --git a/src/scopes/colorscopes/histogramgenerator.cpp b/src/scopes/colorscopes/histogramgenerator.cpp
index bfdc61a..0fd2590 100644
--- a/src/scopes/colorscopes/histogramgenerator.cpp
+++ b/src/scopes/colorscopes/histogramgenerator.cpp
@@ -46,36 +46,31 @@ QImage HistogramGenerator::calculateHistogram(const QSize &paradeSize, const QIm
const uint ww = paradeSize.width();
const uint wh = paradeSize.height();
const uint byteCount = iw*ih;
- const uint stepsize = image.depth() / 8 *accelFactor;
-
- const uchar *bits = image.bits();
// Read the stats from the input image
- for (uint i = 0; i < byteCount; i += stepsize) {
- QRgb *col = (QRgb *)bits;
-
- r[qRed(*col)]++;
- g[qGreen(*col)]++;
- b[qBlue(*col)]++;
- if (drawY) {
- // Use if branch to avoid expensive multiplication if Y disabled
- if (rec == HistogramGenerator::Rec_601) {
- y[(int)floor(.299*qRed(*col) + .587*qGreen(*col) + .114*qBlue(*col))]++;
- } else {
- y[(int)floor(.2125*qRed(*col) + .7154*qGreen(*col) + .0721*qBlue(*col))]++;
+ for (int Y = 0; Y < image.height(); ++Y) {
+ for (int X = 0; X < image.width(); X += accelFactor) {
+ QRgb col = image.pixel(X, Y);
+ r[qRed(col)]++;
+ g[qGreen(col)]++;
+ b[qBlue(col)]++;
+ if (drawY) {
+ // Use if branch to avoid expensive multiplication if Y disabled
+ if (rec == HistogramGenerator::Rec_601) {
+ y[(int)floor(.299*qRed(col) + .587*qGreen(col) + .114*qBlue(col))]++;
+ } else {
+ y[(int)floor(.2125*qRed(col) + .7154*qGreen(col) + .0721*qBlue(col))]++;
+ }
+ }
+ if (drawSum) {
+ // Use an if branch here because the sum takes more operations than rgb
+ s[qRed(col)]++;
+ s[qGreen(col)]++;
+ s[qBlue(col)]++;
}
}
- if (drawSum) {
- // Use an if branch here because the sum takes more operations than rgb
- s[qRed(*col)]++;
- s[qGreen(*col)]++;
- s[qBlue(*col)]++;
- }
-
- bits += stepsize;
}
-
const int nParts = (drawY ? 1 : 0) + (drawR ? 1 : 0) + (drawG ? 1 : 0) + (drawB ? 1 : 0) + (drawSum ? 1 : 0);
if (nParts == 0) {
// Nothing to draw
diff --git a/src/utils/freesound.cpp b/src/utils/freesound.cpp
index a5d695f..c738318 100644
--- a/src/utils/freesound.cpp
+++ b/src/utils/freesound.cpp
@@ -198,6 +198,8 @@ void FreeSound::slotParseResults(KJob* job)
}
emit gotMetaInfo(html);
emit gotMetaInfo(m_metaInfo);
+#else
+ Q_UNUSED(job)
#endif
}