Commit bd9d3bba authored by Vincent PINON's avatar Vincent PINON

Cppcheck fixs

Conflicts:
	src/kthumb.cpp
	src/mainwindow.cpp
	src/mltdevicecapture.cpp
	src/renderer.cpp
parent 56acd924
......@@ -223,7 +223,7 @@ void AbstractClipItem::resizeEnd(int posx, bool /*emitChange*/)
//kDebug() << "///////// COLLISION DETECTED!!!!!!!!!";
//kDebug() << "///////// CURRENT: " << startPos().frames(25) << "x" << endPos().frames(25) << ", RECT: " << rect() << "-" << pos();
//kDebug() << "///////// COLLISION: " << ((AbstractClipItem *)item)->startPos().frames(25) << "x" << ((AbstractClipItem *)item)->endPos().frames(25) << ", RECT: " << ((AbstractClipItem *)item)->rect() << "-" << item->pos();
GenTime diff = ((AbstractClipItem *)item)->startPos() - startPos();
GenTime diff = static_cast<AbstractClipItem*>(item)->startPos() - startPos();
if (fixItem == false || diff < m_info.cropDuration) {
fixItem = true;
m_info.cropDuration = diff;
......
......@@ -78,7 +78,7 @@ void AbstractGroupItem::setItemLocked(bool locked)
setFlag(QGraphicsItem::ItemIsSelectable, !locked);
foreach (QGraphicsItem *child, childItems())
((AbstractClipItem *)child)->setItemLocked(locked);
static_cast<AbstractClipItem*>(child)->setItemLocked(locked);
}
bool AbstractGroupItem::isItemLocked() const
......@@ -318,19 +318,11 @@ QVariant AbstractGroupItem::itemChange(GraphicsItemChange change, const QVariant
return pos();
}
AbstractClipItem *item = static_cast <AbstractClipItem *>(collision);
if (forwardMove) {
// Moving forward, determine best pos
QPainterPath clipPath;
clipPath.addRect(item->sceneBoundingRect());
QPainterPath res = shape.intersected(clipPath);
offset = qMax(offset, (int)(res.boundingRect().width() + 0.5));
} else {
// Moving backward, determine best pos
QPainterPath clipPath;
clipPath.addRect(item->sceneBoundingRect());
QPainterPath res = shape.intersected(clipPath);
offset = qMax(offset, (int)(res.boundingRect().width() + 0.5));
}
// Determine best pos
QPainterPath clipPath;
clipPath.addRect(item->sceneBoundingRect());
QPainterPath res = shape.intersected(clipPath);
offset = qMax(offset, (int)(res.boundingRect().width() + 0.5));
}
}
if (offset > 0) {
......@@ -383,19 +375,11 @@ QVariant AbstractGroupItem::itemChange(GraphicsItemChange change, const QVariant
return pos();
}
AbstractClipItem *item = static_cast <AbstractClipItem *>(collision);
if (forwardMove) {
// Moving forward, determine best pos
QPainterPath clipPath;
clipPath.addRect(item->sceneBoundingRect());
QPainterPath res = shape.intersected(clipPath);
offset = qMax(offset, (int)(res.boundingRect().width() + 0.5));
} else {
// Moving backward, determine best pos
QPainterPath clipPath;
clipPath.addRect(item->sceneBoundingRect());
QPainterPath res = shape.intersected(clipPath);
offset = qMax(offset, (int)(res.boundingRect().width() + 0.5));
}
// Determine best pos
QPainterPath clipPath;
clipPath.addRect(item->sceneBoundingRect());
QPainterPath res = shape.intersected(clipPath);
offset = qMax(offset, (int)(res.boundingRect().width() + 0.5));
}
}
if (offset > 0) {
......@@ -426,13 +410,13 @@ void AbstractGroupItem::dropEvent(QGraphicsSceneDragDropEvent * event)
doc.setContent(effects, true);
QDomElement e = doc.documentElement();
e.setAttribute("kdenlive_ix", 0);
CustomTrackView *view = (CustomTrackView *) scene()->views()[0];
CustomTrackView *view = static_cast<CustomTrackView*>(scene()->views()[0]);
QPointF dropPos = event->scenePos();
QList<QGraphicsItem *> selection = scene()->items(dropPos);
AbstractClipItem *dropChild = NULL;
for (int i = 0; i < selection.count(); ++i) {
if (selection.at(i)->type() == AVWidget) {
dropChild = (AbstractClipItem *) selection.at(i);
dropChild = static_cast<AbstractClipItem*>(selection.at(i));
break;
}
}
......
......@@ -240,7 +240,7 @@ void ClipStabilize::slotUpdateParams()
QString name=w->objectName();
if (!name.isEmpty() && m_ui_params.contains(name)){
if (m_ui_params[name]["type"]=="int" || m_ui_params[name]["type"]=="double"){
DoubleParameterWidget *dbl=(DoubleParameterWidget*)w;
DoubleParameterWidget *dbl=static_cast<DoubleParameterWidget*>(w);
m_ui_params[name]["value"]=QString::number((double)(dbl->getValue()));
}else if (m_ui_params[name]["type"]=="bool"){
QCheckBox *ch=(QCheckBox*)w;
......
......@@ -52,7 +52,7 @@ QImage RGBParadeGenerator::calculateRGBParade(const QSize &paradeSize, const QIm
QRgb *col;
QPainter davinci(&parade);
double dx, dy;
double dx;
const uint ww = paradeSize.width();
const uint wh = paradeSize.height();
......@@ -148,7 +148,7 @@ QImage RGBParadeGenerator::calculateRGBParade(const QSize &paradeSize, const QIm
if (drawAxis) {
QRgb opx;
for (uint i = 0; i <= 10; ++i) {
dy = (float)i/10 * (partH-1);
double dy = (float)i/10 * (partH-1);
for (uint x = 0; x < ww-distRight; x++) {
opx = parade.pixel(x, dy);
parade.setPixel(x,dy, qRgba(CHOP255(150+qRed(opx)), 255,
......
......@@ -36,8 +36,8 @@ CustomTrackScene::~CustomTrackScene()
double CustomTrackScene::getSnapPointForPos(double pos, bool doSnap)
{
double maximumOffset;
if (doSnap) {
double maximumOffset;
if (m_scale.x() > 3) maximumOffset = 10 / m_scale.x();
else maximumOffset = 6 / m_scale.x();
for (int i = 0; i < m_snapPoints.size(); ++i) {
......
This diff is collapsed.
......@@ -620,10 +620,10 @@ void ParameterContainer::slotCollectAllParameters()
DoubleParameterWidget *doubleparam = (DoubleParameterWidget*)m_valueItems.value(paramName);
setValue = locale.toString(doubleparam->getValue());
} else if (type == "list") {
KComboBox *box = ((Listval*)m_valueItems.value(paramName))->list;
KComboBox *box = static_cast<Listval*>(m_valueItems.value(paramName))->list;
setValue = box->itemData(box->currentIndex()).toString();
} else if (type == "bool") {
QCheckBox *box = ((Boolval*)m_valueItems.value(paramName))->checkBox;
QCheckBox *box = static_cast<Boolval*>(m_valueItems.value(paramName))->checkBox;
setValue = box->checkState() == Qt::Checked ? "1" : "0" ;
} else if (type == "color") {
ChooseColorWidget *choosecolor = ((ChooseColorWidget*)m_valueItems.value(paramName));
......@@ -700,7 +700,7 @@ void ParameterContainer::slotCollectAllParameters()
setValue = widget->getSpline();
#endif
} else if (type == "wipe") {
Wipeval *wp = (Wipeval*)m_valueItems.value(paramName);
Wipeval *wp = static_cast<Wipeval*>(m_valueItems.value(paramName));
wipeInfo info;
if (wp->start_left->isChecked())
info.start = LEFT;
......@@ -742,11 +742,11 @@ void ParameterContainer::slotCollectAllParameters()
else if (pa.hasAttribute("intimeline"))
pa.setAttribute("intimeline", "0");
} else if (type == "url") {
KUrlRequester *req = ((Urlval*)m_valueItems.value(paramName))->urlwidget;
KUrlRequester *req = static_cast<Urlval*>(m_valueItems.value(paramName))->urlwidget;
setValue = req->url().path();
} else if (type == "keywords"){
QLineEdit *line = ((Keywordval*)m_valueItems.value(paramName))->lineeditwidget;
QComboBox *combo = ((Keywordval*)m_valueItems.value(paramName))->comboboxwidget;
QLineEdit *line = static_cast<Keywordval*>(m_valueItems.value(paramName))->lineeditwidget;
QComboBox *combo = static_cast<Keywordval*>(m_valueItems.value(paramName))->comboboxwidget;
if(combo->currentIndex())
{
QString comboval = combo->itemData(combo->currentIndex()).toString();
......@@ -755,7 +755,7 @@ void ParameterContainer::slotCollectAllParameters()
}
setValue = line->text();
} else if (type == "fontfamily") {
QFontComboBox* fontfamily = ((Fontval*)m_valueItems.value(paramName))->fontfamilywidget;
QFontComboBox* fontfamily = static_cast<Fontval*>(m_valueItems.value(paramName))->fontfamilywidget;
setValue = fontfamily->currentFont().family();
}
if (!setValue.isNull())
......
......@@ -207,10 +207,10 @@ void JogShuttle::customEvent(QEvent* e)
QEvent::Type type = e->type();
if (type == MediaCtrlEvent::Key) {
MediaCtrlEvent* mev = (MediaCtrlEvent*)e;
MediaCtrlEvent* mev = static_cast<MediaCtrlEvent*>(e);
emit button(mev->value());
} else if (type == MediaCtrlEvent::Jog) {
MediaCtrlEvent* mev = (MediaCtrlEvent*)e;
MediaCtrlEvent* mev = static_cast<MediaCtrlEvent*>(e);
int value = mev->value();
if (value < 0) {
......@@ -219,7 +219,7 @@ void JogShuttle::customEvent(QEvent* e)
emit jogForward();
}
} else if (type == MediaCtrlEvent::Shuttle) {
MediaCtrlEvent* mev = (MediaCtrlEvent*)e;
MediaCtrlEvent* mev = static_cast<MediaCtrlEvent*>(e);
emit shuttlePos(mev->value());
}
}
......
......@@ -276,8 +276,8 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap<QString, QString>& map
m_configSdl.kcfg_external_display->setEnabled(false);
}
double dvgrabVersion = 0;
if (!KdenliveSettings::dvgrab_path().isEmpty()) {
double dvgrabVersion = 0;
QProcess *versionCheck = new QProcess;
versionCheck->setProcessChannelMode(QProcess::MergedChannels);
versionCheck->start("dvgrab", QStringList() << "--version");
......
......@@ -226,7 +226,6 @@ QImage KThumb::getFrame(Mlt::Frame *frame, int frameWidth, int displayWidth, int
//const uchar* imagedata = frame->get_image(format, ow, oh);
//QImage image(imagedata, ow, oh, QImage::Format_ARGB32_Premultiplied);
if (!image.isNull()) {
if (ow > (2 * displayWidth)) {
// there was a scaling problem, do it manually
......
......@@ -165,7 +165,7 @@ int AudioEnvelope::startPos() const
return m_startpos;
}
void AudioEnvelope::normalizeEnvelope(bool clampTo0)
void AudioEnvelope::normalizeEnvelope(bool /*clampTo0*/)
{
if (m_envelope == NULL && !m_future.isRunning()) {
m_future = QtConcurrent::run(this, &AudioEnvelope::loadEnvelope);
......
......@@ -18,7 +18,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
/*
Some definitions that allow real or complex filtering
*/
#ifdef REAL_FASTFIR
/*REAL_FASTFIR*/
#define MIN_FFT_LEN 2048
#include "kiss_fftr.h"
typedef kiss_fft_scalar kffsamp_t;
......@@ -26,14 +26,6 @@ typedef kiss_fftr_cfg kfcfg_t;
#define FFT_ALLOC kiss_fftr_alloc
#define FFTFWD kiss_fftr
#define FFTINV kiss_fftri
#else
#define MIN_FFT_LEN 1024
typedef kiss_fft_cpx kffsamp_t;
typedef kiss_fft_cfg kfcfg_t;
#define FFT_ALLOC kiss_fft_alloc
#define FFTFWD kiss_fft
#define FFTINV kiss_fft
#endif
typedef struct kiss_fastfir_state *kiss_fastfir_cfg;
......@@ -78,7 +70,7 @@ kiss_fastfir_cfg kiss_fastfir_alloc(
if (pnfft)
nfft=*pnfft;
if (nfft<=0) {
if (nfft==0) {
/* determine fft size as next power of two at least 2x
the impulse response length*/
i=n_imp_resp-1;
......@@ -86,19 +78,13 @@ kiss_fastfir_cfg kiss_fastfir_alloc(
do{
nfft<<=1;
}while (i>>=1);
#ifdef MIN_FFT_LEN
if ( nfft < MIN_FFT_LEN )
nfft=MIN_FFT_LEN;
#endif
}
if (pnfft)
*pnfft = nfft;
#ifdef REAL_FASTFIR
n_freq_bins = nfft/2 + 1;
#else
n_freq_bins = nfft;
#endif
/*fftcfg*/
FFT_ALLOC (nfft, 0, NULL, &len_fftcfg);
memneeded += len_fftcfg;
......@@ -244,7 +230,7 @@ size_t kiss_fastfir(
}
}
#ifdef FAST_FILT_UTIL
/*FAST_FILT_UTIL*/
#include <unistd.h>
#include <sys/types.h>
#include <sys/mman.h>
......@@ -285,12 +271,12 @@ void direct_file_filter(
do {
nread = fread (buf, sizeof (kffsamp_t), nbuf, fin);
if (nread <= 0)
if (nread == 0)
break;
for (k = 0; k < nread; ++k) {
tmph = imp_resp+nlag;
#ifdef REAL_FASTFIR
/*REAL_FASTFIR*/
# ifdef USE_SIMD
outval = _mm_set1_ps(0);
#else
......@@ -301,26 +287,6 @@ void direct_file_filter(
for (tap = 0; tap < oldestlag; ++tap)
outval += circbuf[tap] * *tmph--;
outval += buf[k] * *tmph;
#else
# ifdef USE_SIMD
outval.r = outval.i = _mm_set1_ps(0);
#else
outval.r = outval.i = 0;
#endif
for (tap = oldestlag; tap < nlag; ++tap){
C_MUL(tmp,circbuf[tap],*tmph);
--tmph;
C_ADDTO(outval,tmp);
}
for (tap = 0; tap < oldestlag; ++tap) {
C_MUL(tmp,circbuf[tap],*tmph);
--tmph;
C_ADDTO(outval,tmp);
}
C_MUL(tmp,buf[k],*tmph);
C_ADDTO(outval,tmp);
#endif
circbuf[oldestlag++] = buf[k];
buf[k] = outval;
......@@ -463,6 +429,7 @@ int main(int argc,char**argv)
if (fout!=stdout) fclose(fout);
if (fin!=stdin) fclose(fin);
free(h);
return 0;
}
#endif
......@@ -137,7 +137,7 @@ void transform_signal(void)
CHECKNULL( fbuf=(kiss_fft_cpx*)malloc(sizeof(kiss_fft_cpx)*nfreqs ) );
CHECKNULL( mag2buf=(float*)malloc(sizeof(float)*nfreqs ) );
memset(mag2buf,0,sizeof(mag2buf)*nfreqs);
memset(mag2buf,0,sizeof(float)*nfreqs);
while (1) {
if (stereo) {
......@@ -168,9 +168,11 @@ void transform_signal(void)
mag2buf[i] += fbuf[i].r * fbuf[i].r + fbuf[i].i * fbuf[i].i;
if (++avgctr == navg) {
float *new_vals;
avgctr=0;
++nrows;
vals = (float*)realloc(vals,sizeof(float)*nrows*nfreqs);
new_vals = (float*)realloc(vals,sizeof(float)*nrows*nfreqs);
if(new_vals == NULL) return; else vals=new_vals;
float eps = 1;
for (i=0;i<nfreqs;++i)
vals[(nrows - 1) * nfreqs + i] = 10 * log10 ( mag2buf[i] / navg + eps );
......@@ -188,7 +190,7 @@ void transform_signal(void)
static
void make_png(void)
{
png_bytepp row_pointers=NULL;
png_bytepp row_pointers=NULL, new_row_pointers;
rgb_t * row_data=NULL;
int i;
int nfreqs = nfft/2+1;
......@@ -208,6 +210,8 @@ void make_png(void)
cpx2pixels(row_data, vals, nfreqs*nrows );
row_pointers = realloc(row_pointers, nrows*sizeof(png_bytep));
if(new_row_pointers == NULL) return; else row_pointers=new_row_pointers;
for (i=0;i<nrows;++i) {
row_pointers[i] = (png_bytep)(row_data + i*nfreqs);
}
......
......@@ -201,12 +201,10 @@ int media_ctrl_get_keys_count(struct media_ctrl *ctrl)
void translate_contour_hid_event(struct media_ctrl *ctrl, struct input_event *ev, struct media_ctrl_event *me)
{
int lv, cv;
me->type = 0;
if (ev->type == EV_REL) {
int cv;
/* First check the outer dial */
if (ev->code == REL_WHEEL) {
......@@ -227,6 +225,7 @@ void translate_contour_hid_event(struct media_ctrl *ctrl, struct input_event *ev
me->name = _shuttle_name;
} else if (ev->code == REL_DIAL) {
int lv;
if ( ctrl->lastval == -1 ) ctrl->lastval = ev->value;
lv = ctrl->lastval;
......
......@@ -147,6 +147,7 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
m_projectList(NULL),
m_effectList(NULL),
m_effectStack(NULL),
m_clipMonitor(NULL),
m_projectMonitor(NULL),
m_recMonitor(NULL),
......@@ -444,11 +445,11 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
/*ScriptingPart* sp = new ScriptingPart(this, QStringList());
guiFactory()->addClient(sp);*/
QMenu *trackMenu = (QMenu*)(factory()->container("track_menu", this));
QMenu *trackMenu = static_cast<QMenu*>(factory()->container("track_menu", this));
if (trackMenu) trackMenu->addActions(m_tracksActionCollection->actions());
QMenu *saveLayout = (QMenu*)(factory()->container("layout_save_as", this));
QMenu *saveLayout = static_cast<QMenu*>(factory()->container("layout_save_as", this));
if (saveLayout)
connect(saveLayout, SIGNAL(triggered(QAction*)), this, SLOT(slotSaveLayout(QAction*)));
......@@ -554,7 +555,7 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
m_timelineContextClipMenu->addAction(actionCollection()->action("paste_effects"));
m_timelineContextClipMenu->addSeparator();
QMenu *markersMenu = (QMenu*)(factory()->container("marker_menu", this));
QMenu *markersMenu = static_cast<QMenu*>(factory()->container("marker_menu", this));
m_timelineContextClipMenu->addMenu(markersMenu);
m_timelineContextClipMenu->addSeparator();
m_timelineContextClipMenu->addMenu(m_transitionsMenu);
......@@ -1807,7 +1808,7 @@ void MainWindow::setStatusBarStyleSheet(const QPalette &p)
void MainWindow::loadLayouts()
{
QMenu *saveLayout = (QMenu*)(factory()->container("layout_save_as", this));
QMenu *saveLayout = static_cast<QMenu*>(factory()->container("layout_save_as", this));
if (m_loadLayout == NULL || saveLayout == NULL) return;
KSharedConfigPtr config = KGlobal::config();
KConfigGroup layoutGroup(config, "Layouts");
......@@ -3946,7 +3947,7 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{
if (m_findActivated) {
if (event->type() == QEvent::ShortcutOverride) {
QKeyEvent* ke = (QKeyEvent*) event;
QKeyEvent* ke = static_cast<QKeyEvent*>(event);
if (ke->text().trimmed().isEmpty()) return false;
ke->accept();
return true;
......
......@@ -277,8 +277,8 @@ void ProjectListView::dropEvent(QDropEvent *event)
foreach(QTreeWidgetItem *it, list) {
// TODO allow dragging of folders ?
if (it->type() == ProjectClipType) {
if (it->parent()) clone = (ProjectItem*) it->parent()->takeChild(it->parent()->indexOfChild(it));
else clone = (ProjectItem*) takeTopLevelItem(indexOfTopLevelItem(it));
if (it->parent()) clone = static_cast<ProjectItem*>(it->parent()->takeChild(it->parent()->indexOfChild(it)));
else clone = static_cast<ProjectItem*>(takeTopLevelItem(indexOfTopLevelItem(it)));
if (clone && item) {
item->addChild(clone);
QMap <QString, QString> props;
......
......@@ -61,7 +61,7 @@ static void kdenlive_callback(void* /*ptr*/, int level, const char* fmt, va_list
}
//static
//static
void Render::consumer_frame_show(mlt_consumer, Render * self, mlt_frame frame_ptr)
{
// detect if the producer has finished playing. Is there a better way to do it?
......@@ -2875,7 +2875,6 @@ bool Render::addFilterToService(Mlt::Service service, EffectsParameterList param
params.removeParam("max");
params.removeParam("factor");
params.removeParam("offset");
int offset = 0;
// Special case, only one keyframe, means we want a constant value
if (keyFrames.count() == 1) {
Mlt::Filter *filter = new Mlt::Filter(*m_mltProfile, qstrdup(tag.toUtf8().constData()));
......@@ -2900,6 +2899,7 @@ bool Render::addFilterToService(Mlt::Service service, EffectsParameterList param
} else for (int i = 0; i < keyFrames.size() - 1; ++i) {
Mlt::Filter *filter = new Mlt::Filter(*m_mltProfile, qstrdup(tag.toUtf8().constData()));
if (filter && filter->is_valid()) {
int offset = 0;
filter->set("kdenlive_id", qstrdup(params.paramValue("id").toUtf8().constData()));
int x1 = keyFrames.at(i).section(':', 0, 0).toInt() + offset;
double y1 = keyFrames.at(i).section(':', 1, 1).toDouble();
......
......@@ -420,8 +420,8 @@ void AbstractScopeWidget::slotHUDRenderingFinished(uint mseconds, uint oldFactor
m_semaphoreHUD.release(1);
this->update();
int accel;
if (m_aRealtime->isChecked()) {
int accel;
accel = calculateAccelFactorHUD(mseconds, oldFactor);
if (m_accelFactorHUD < 1) {
accel = 1;
......@@ -454,8 +454,8 @@ void AbstractScopeWidget::slotScopeRenderingFinished(uint mseconds, uint oldFact
this->update();
// Calculate the acceleration factor hint to get «realtime» updates.
int accel;
if (m_aRealtime->isChecked()) {
int accel;
accel = calculateAccelFactorScope(mseconds, oldFactor);
if (accel < 1) {
// If mseconds happens to be 0.
......@@ -487,8 +487,8 @@ void AbstractScopeWidget::slotBackgroundRenderingFinished(uint mseconds, uint ol
m_semaphoreBackground.release(1);
this->update();
int accel;
if (m_aRealtime->isChecked()) {
int accel;
accel = calculateAccelFactorBackground(mseconds, oldFactor);
if (m_accelFactorBackground < 1) {
accel = 1;
......
......@@ -365,7 +365,6 @@ QImage Spectrogram::renderAudioScope(uint, const QVector<int16_t> &audioFrame, c
const uint h = m_innerScopeRect.height();
const uint leftDist = m_innerScopeRect.left() - m_scopeRect.left();
const uint topDist = m_innerScopeRect.top() - m_scopeRect.top();
float val;
uint windowSize;
uint y;
bool completeRedraw = true;
......@@ -390,7 +389,7 @@ QImage Spectrogram::renderAudioScope(uint, const QVector<int16_t> &audioFrame, c
QVector<float> dbMap;
uint right;
for (QList<QVector<float> >::iterator it = m_fftHistory.begin(); it != m_fftHistory.end(); it++) {
for (QList<QVector<float> >::iterator it = m_fftHistory.begin(); it != m_fftHistory.end(); ++it) {
windowSize = (*it).size();
......@@ -399,6 +398,7 @@ QImage Spectrogram::renderAudioScope(uint, const QVector<int16_t> &audioFrame, c
dbMap = FFTTools::interpolatePeakPreserving((*it), m_innerScopeRect.width(), 0, right, -180);
for (int i = 0; i < dbMap.size(); ++i) {
float val;
val = dbMap[i];
peak = val > m_dBmax;
......@@ -430,7 +430,7 @@ QImage Spectrogram::renderAudioScope(uint, const QVector<int16_t> &audioFrame, c
qDebug() << "Rendered " << y-topDist << "lines from " << m_fftHistory.size() << " available samples in " << start.elapsed() << " ms"
<< (completeRedraw ? "" : " (re-used old image)");
uint storedBytes = 0;
for (QList< QVector<float> >::iterator it = m_fftHistory.begin(); it != m_fftHistory.end(); it++) {
for (QList< QVector<float> >::iterator it = m_fftHistory.begin(); it != m_fftHistory.end(); ++it) {
storedBytes += (*it).size() * sizeof((*it)[0]);
}
qDebug() << QString("Total storage used: %1 kB").arg((double)storedBytes/1000, 0, 'f', 2);
......
......@@ -149,10 +149,10 @@ QDomDocument TitleDocument::xml(QGraphicsRectItem* startv, QGraphicsRectItem* en
break;
case 3:
e.setAttribute("type", "QGraphicsRectItem");
content.setAttribute("rect", rectFToString(((QGraphicsRectItem*)item)->rect().normalized()));
content.setAttribute("pencolor", colorToString(((QGraphicsRectItem*)item)->pen().color()));
content.setAttribute("penwidth", ((QGraphicsRectItem*)item)->pen().width());
content.setAttribute("brushcolor", colorToString(((QGraphicsRectItem*)item)->brush().color()));
content.setAttribute("rect", rectFToString(static_cast<QGraphicsRectItem*>(item)->rect().normalized()));
content.setAttribute("pencolor", colorToString(static_cast<QGraphicsRectItem*>(item)->pen().color()));
content.setAttribute("penwidth", static_cast<QGraphicsRectItem*>(item)->pen().width());
content.setAttribute("brushcolor", colorToString(static_cast<QGraphicsRectItem*>(item)->brush().color()));
break;
case 8:
e.setAttribute("type", "QGraphicsTextItem");
......@@ -277,7 +277,7 @@ QColor TitleDocument::getBackgroundColor() const
QList<QGraphicsItem *> items = m_scene->items();
for (int i = 0; i < items.size(); ++i) {
if (items.at(i)->zValue() == -1100) {
color = ((QGraphicsRectItem *)items.at(i))->brush().color();
color = static_cast<QGraphicsRectItem*>(items.at(i))->brush().color();
return color;
}
}
......@@ -509,7 +509,7 @@ int TitleDocument::loadFromXml(const QDomDocument& doc, QGraphicsRectItem* start
QList<QGraphicsItem *> items = m_scene->items();
for (int i = 0; i < items.size(); ++i) {
if (items.at(i)->zValue() == -1100) {
((QGraphicsRectItem *)items.at(i))->setBrush(QBrush(color));
static_cast<QGraphicsRectItem*>(items.at(i))->setBrush(QBrush(color));
break;
}
}
......
......@@ -238,11 +238,11 @@ QVariant Transition::itemChange(GraphicsItemChange change, const QVariant &value
items.removeAll(this);
bool forwardMove = newPos.x() > pos().x();
int offset = 0;
if (!items.isEmpty()) {
for (int i = 0; i < items.count(); ++i) {
if (!items.at(i)->isEnabled()) continue;
if (items.at(i)->type() == type()) {
int offset = 0;
// Collision!
QPointF otherPos = items.at(i)->pos();
if ((int) otherPos.y() != (int) pos().y()) {
......
......@@ -64,7 +64,7 @@ QStringList V4lCaptureHandler::getDeviceName(const QString &input)
}
else {
devName = strdup((char*) cap.card);
if(!cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) {
if(!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) {
// Device cannot capture
captureEnabled = 0;
}
......
......@@ -306,12 +306,10 @@ void KisCurveWidget::paintEvent(QPaintEvent *)
x, wHeight - d->m_curve.value(1.0) * wHeight));
// Drawing curve handles.
double curveX;
double curveY;
if (!d->m_readOnlyMode) {
for (int i = 0; i < d->m_curve.points().count(); ++i) {
curveX = d->m_curve.points().at(i).x();
curveY = d->m_curve.points().at(i).y();
double curveX = d->m_curve.points().at(i).x();
double curveY = d->m_curve.points().at(i).y();