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*/) ...@@ -223,7 +223,7 @@ void AbstractClipItem::resizeEnd(int posx, bool /*emitChange*/)
//kDebug() << "///////// COLLISION DETECTED!!!!!!!!!"; //kDebug() << "///////// COLLISION DETECTED!!!!!!!!!";
//kDebug() << "///////// CURRENT: " << startPos().frames(25) << "x" << endPos().frames(25) << ", RECT: " << rect() << "-" << pos(); //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(); //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) { if (fixItem == false || diff < m_info.cropDuration) {
fixItem = true; fixItem = true;
m_info.cropDuration = diff; m_info.cropDuration = diff;
......
...@@ -78,7 +78,7 @@ void AbstractGroupItem::setItemLocked(bool locked) ...@@ -78,7 +78,7 @@ void AbstractGroupItem::setItemLocked(bool locked)
setFlag(QGraphicsItem::ItemIsSelectable, !locked); setFlag(QGraphicsItem::ItemIsSelectable, !locked);
foreach (QGraphicsItem *child, childItems()) foreach (QGraphicsItem *child, childItems())
((AbstractClipItem *)child)->setItemLocked(locked); static_cast<AbstractClipItem*>(child)->setItemLocked(locked);
} }
bool AbstractGroupItem::isItemLocked() const bool AbstractGroupItem::isItemLocked() const
...@@ -318,19 +318,11 @@ QVariant AbstractGroupItem::itemChange(GraphicsItemChange change, const QVariant ...@@ -318,19 +318,11 @@ QVariant AbstractGroupItem::itemChange(GraphicsItemChange change, const QVariant
return pos(); return pos();
} }
AbstractClipItem *item = static_cast <AbstractClipItem *>(collision); AbstractClipItem *item = static_cast <AbstractClipItem *>(collision);
if (forwardMove) { // Determine best pos
// Moving forward, determine best pos QPainterPath clipPath;
QPainterPath clipPath; clipPath.addRect(item->sceneBoundingRect());
clipPath.addRect(item->sceneBoundingRect()); QPainterPath res = shape.intersected(clipPath);
QPainterPath res = shape.intersected(clipPath); offset = qMax(offset, (int)(res.boundingRect().width() + 0.5));
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));
}
} }
} }
if (offset > 0) { if (offset > 0) {
...@@ -383,19 +375,11 @@ QVariant AbstractGroupItem::itemChange(GraphicsItemChange change, const QVariant ...@@ -383,19 +375,11 @@ QVariant AbstractGroupItem::itemChange(GraphicsItemChange change, const QVariant
return pos(); return pos();
} }
AbstractClipItem *item = static_cast <AbstractClipItem *>(collision); AbstractClipItem *item = static_cast <AbstractClipItem *>(collision);
if (forwardMove) { // Determine best pos
// Moving forward, determine best pos QPainterPath clipPath;
QPainterPath clipPath; clipPath.addRect(item->sceneBoundingRect());
clipPath.addRect(item->sceneBoundingRect()); QPainterPath res = shape.intersected(clipPath);
QPainterPath res = shape.intersected(clipPath); offset = qMax(offset, (int)(res.boundingRect().width() + 0.5));
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));
}
} }
} }
if (offset > 0) { if (offset > 0) {
...@@ -426,13 +410,13 @@ void AbstractGroupItem::dropEvent(QGraphicsSceneDragDropEvent * event) ...@@ -426,13 +410,13 @@ void AbstractGroupItem::dropEvent(QGraphicsSceneDragDropEvent * event)
doc.setContent(effects, true); doc.setContent(effects, true);
QDomElement e = doc.documentElement(); QDomElement e = doc.documentElement();
e.setAttribute("kdenlive_ix", 0); e.setAttribute("kdenlive_ix", 0);
CustomTrackView *view = (CustomTrackView *) scene()->views()[0]; CustomTrackView *view = static_cast<CustomTrackView*>(scene()->views()[0]);
QPointF dropPos = event->scenePos(); QPointF dropPos = event->scenePos();
QList<QGraphicsItem *> selection = scene()->items(dropPos); QList<QGraphicsItem *> selection = scene()->items(dropPos);
AbstractClipItem *dropChild = NULL; AbstractClipItem *dropChild = NULL;
for (int i = 0; i < selection.count(); ++i) { for (int i = 0; i < selection.count(); ++i) {
if (selection.at(i)->type() == AVWidget) { if (selection.at(i)->type() == AVWidget) {
dropChild = (AbstractClipItem *) selection.at(i); dropChild = static_cast<AbstractClipItem*>(selection.at(i));
break; break;
} }
} }
......
...@@ -240,7 +240,7 @@ void ClipStabilize::slotUpdateParams() ...@@ -240,7 +240,7 @@ void ClipStabilize::slotUpdateParams()
QString name=w->objectName(); QString name=w->objectName();
if (!name.isEmpty() && m_ui_params.contains(name)){ if (!name.isEmpty() && m_ui_params.contains(name)){
if (m_ui_params[name]["type"]=="int" || m_ui_params[name]["type"]=="double"){ 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())); m_ui_params[name]["value"]=QString::number((double)(dbl->getValue()));
}else if (m_ui_params[name]["type"]=="bool"){ }else if (m_ui_params[name]["type"]=="bool"){
QCheckBox *ch=(QCheckBox*)w; QCheckBox *ch=(QCheckBox*)w;
......
...@@ -52,7 +52,7 @@ QImage RGBParadeGenerator::calculateRGBParade(const QSize &paradeSize, const QIm ...@@ -52,7 +52,7 @@ QImage RGBParadeGenerator::calculateRGBParade(const QSize &paradeSize, const QIm
QRgb *col; QRgb *col;
QPainter davinci(&parade); QPainter davinci(&parade);
double dx, dy; double dx;
const uint ww = paradeSize.width(); const uint ww = paradeSize.width();
const uint wh = paradeSize.height(); const uint wh = paradeSize.height();
...@@ -148,7 +148,7 @@ QImage RGBParadeGenerator::calculateRGBParade(const QSize &paradeSize, const QIm ...@@ -148,7 +148,7 @@ QImage RGBParadeGenerator::calculateRGBParade(const QSize &paradeSize, const QIm
if (drawAxis) { if (drawAxis) {
QRgb opx; QRgb opx;
for (uint i = 0; i <= 10; ++i) { 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++) { for (uint x = 0; x < ww-distRight; x++) {
opx = parade.pixel(x, dy); opx = parade.pixel(x, dy);
parade.setPixel(x,dy, qRgba(CHOP255(150+qRed(opx)), 255, parade.setPixel(x,dy, qRgba(CHOP255(150+qRed(opx)), 255,
......
...@@ -36,8 +36,8 @@ CustomTrackScene::~CustomTrackScene() ...@@ -36,8 +36,8 @@ CustomTrackScene::~CustomTrackScene()
double CustomTrackScene::getSnapPointForPos(double pos, bool doSnap) double CustomTrackScene::getSnapPointForPos(double pos, bool doSnap)
{ {
double maximumOffset;
if (doSnap) { if (doSnap) {
double maximumOffset;
if (m_scale.x() > 3) maximumOffset = 10 / m_scale.x(); if (m_scale.x() > 3) maximumOffset = 10 / m_scale.x();
else maximumOffset = 6 / m_scale.x(); else maximumOffset = 6 / m_scale.x();
for (int i = 0; i < m_snapPoints.size(); ++i) { for (int i = 0; i < m_snapPoints.size(); ++i) {
......
This diff is collapsed.
...@@ -620,10 +620,10 @@ void ParameterContainer::slotCollectAllParameters() ...@@ -620,10 +620,10 @@ void ParameterContainer::slotCollectAllParameters()
DoubleParameterWidget *doubleparam = (DoubleParameterWidget*)m_valueItems.value(paramName); DoubleParameterWidget *doubleparam = (DoubleParameterWidget*)m_valueItems.value(paramName);
setValue = locale.toString(doubleparam->getValue()); setValue = locale.toString(doubleparam->getValue());
} else if (type == "list") { } 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(); setValue = box->itemData(box->currentIndex()).toString();
} else if (type == "bool") { } 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" ; setValue = box->checkState() == Qt::Checked ? "1" : "0" ;
} else if (type == "color") { } else if (type == "color") {
ChooseColorWidget *choosecolor = ((ChooseColorWidget*)m_valueItems.value(paramName)); ChooseColorWidget *choosecolor = ((ChooseColorWidget*)m_valueItems.value(paramName));
...@@ -700,7 +700,7 @@ void ParameterContainer::slotCollectAllParameters() ...@@ -700,7 +700,7 @@ void ParameterContainer::slotCollectAllParameters()
setValue = widget->getSpline(); setValue = widget->getSpline();
#endif #endif
} else if (type == "wipe") { } else if (type == "wipe") {
Wipeval *wp = (Wipeval*)m_valueItems.value(paramName); Wipeval *wp = static_cast<Wipeval*>(m_valueItems.value(paramName));
wipeInfo info; wipeInfo info;
if (wp->start_left->isChecked()) if (wp->start_left->isChecked())
info.start = LEFT; info.start = LEFT;
...@@ -742,11 +742,11 @@ void ParameterContainer::slotCollectAllParameters() ...@@ -742,11 +742,11 @@ void ParameterContainer::slotCollectAllParameters()
else if (pa.hasAttribute("intimeline")) else if (pa.hasAttribute("intimeline"))
pa.setAttribute("intimeline", "0"); pa.setAttribute("intimeline", "0");
} else if (type == "url") { } 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(); setValue = req->url().path();
} else if (type == "keywords"){ } else if (type == "keywords"){
QLineEdit *line = ((Keywordval*)m_valueItems.value(paramName))->lineeditwidget; QLineEdit *line = static_cast<Keywordval*>(m_valueItems.value(paramName))->lineeditwidget;
QComboBox *combo = ((Keywordval*)m_valueItems.value(paramName))->comboboxwidget; QComboBox *combo = static_cast<Keywordval*>(m_valueItems.value(paramName))->comboboxwidget;
if(combo->currentIndex()) if(combo->currentIndex())
{ {
QString comboval = combo->itemData(combo->currentIndex()).toString(); QString comboval = combo->itemData(combo->currentIndex()).toString();
...@@ -755,7 +755,7 @@ void ParameterContainer::slotCollectAllParameters() ...@@ -755,7 +755,7 @@ void ParameterContainer::slotCollectAllParameters()
} }
setValue = line->text(); setValue = line->text();
} else if (type == "fontfamily") { } 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(); setValue = fontfamily->currentFont().family();
} }
if (!setValue.isNull()) if (!setValue.isNull())
......
...@@ -207,10 +207,10 @@ void JogShuttle::customEvent(QEvent* e) ...@@ -207,10 +207,10 @@ void JogShuttle::customEvent(QEvent* e)
QEvent::Type type = e->type(); QEvent::Type type = e->type();
if (type == MediaCtrlEvent::Key) { if (type == MediaCtrlEvent::Key) {
MediaCtrlEvent* mev = (MediaCtrlEvent*)e; MediaCtrlEvent* mev = static_cast<MediaCtrlEvent*>(e);
emit button(mev->value()); emit button(mev->value());
} else if (type == MediaCtrlEvent::Jog) { } else if (type == MediaCtrlEvent::Jog) {
MediaCtrlEvent* mev = (MediaCtrlEvent*)e; MediaCtrlEvent* mev = static_cast<MediaCtrlEvent*>(e);
int value = mev->value(); int value = mev->value();
if (value < 0) { if (value < 0) {
...@@ -219,7 +219,7 @@ void JogShuttle::customEvent(QEvent* e) ...@@ -219,7 +219,7 @@ void JogShuttle::customEvent(QEvent* e)
emit jogForward(); emit jogForward();
} }
} else if (type == MediaCtrlEvent::Shuttle) { } else if (type == MediaCtrlEvent::Shuttle) {
MediaCtrlEvent* mev = (MediaCtrlEvent*)e; MediaCtrlEvent* mev = static_cast<MediaCtrlEvent*>(e);
emit shuttlePos(mev->value()); emit shuttlePos(mev->value());
} }
} }
......
...@@ -276,8 +276,8 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap<QString, QString>& map ...@@ -276,8 +276,8 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap<QString, QString>& map
m_configSdl.kcfg_external_display->setEnabled(false); m_configSdl.kcfg_external_display->setEnabled(false);
} }
double dvgrabVersion = 0;
if (!KdenliveSettings::dvgrab_path().isEmpty()) { if (!KdenliveSettings::dvgrab_path().isEmpty()) {
double dvgrabVersion = 0;
QProcess *versionCheck = new QProcess; QProcess *versionCheck = new QProcess;
versionCheck->setProcessChannelMode(QProcess::MergedChannels); versionCheck->setProcessChannelMode(QProcess::MergedChannels);
versionCheck->start("dvgrab", QStringList() << "--version"); versionCheck->start("dvgrab", QStringList() << "--version");
......
...@@ -226,7 +226,6 @@ QImage KThumb::getFrame(Mlt::Frame *frame, int frameWidth, int displayWidth, int ...@@ -226,7 +226,6 @@ QImage KThumb::getFrame(Mlt::Frame *frame, int frameWidth, int displayWidth, int
//const uchar* imagedata = frame->get_image(format, ow, oh); //const uchar* imagedata = frame->get_image(format, ow, oh);
//QImage image(imagedata, ow, oh, QImage::Format_ARGB32_Premultiplied); //QImage image(imagedata, ow, oh, QImage::Format_ARGB32_Premultiplied);
if (!image.isNull()) { if (!image.isNull()) {
if (ow > (2 * displayWidth)) { if (ow > (2 * displayWidth)) {
// there was a scaling problem, do it manually // there was a scaling problem, do it manually
......
...@@ -165,7 +165,7 @@ int AudioEnvelope::startPos() const ...@@ -165,7 +165,7 @@ int AudioEnvelope::startPos() const
return m_startpos; return m_startpos;
} }
void AudioEnvelope::normalizeEnvelope(bool clampTo0) void AudioEnvelope::normalizeEnvelope(bool /*clampTo0*/)
{ {
if (m_envelope == NULL && !m_future.isRunning()) { if (m_envelope == NULL && !m_future.isRunning()) {
m_future = QtConcurrent::run(this, &AudioEnvelope::loadEnvelope); m_future = QtConcurrent::run(this, &AudioEnvelope::loadEnvelope);
......
...@@ -18,7 +18,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ...@@ -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 Some definitions that allow real or complex filtering
*/ */
#ifdef REAL_FASTFIR /*REAL_FASTFIR*/
#define MIN_FFT_LEN 2048 #define MIN_FFT_LEN 2048
#include "kiss_fftr.h" #include "kiss_fftr.h"
typedef kiss_fft_scalar kffsamp_t; typedef kiss_fft_scalar kffsamp_t;
...@@ -26,14 +26,6 @@ typedef kiss_fftr_cfg kfcfg_t; ...@@ -26,14 +26,6 @@ typedef kiss_fftr_cfg kfcfg_t;
#define FFT_ALLOC kiss_fftr_alloc #define FFT_ALLOC kiss_fftr_alloc
#define FFTFWD kiss_fftr #define FFTFWD kiss_fftr
#define FFTINV kiss_fftri #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; typedef struct kiss_fastfir_state *kiss_fastfir_cfg;
...@@ -78,7 +70,7 @@ kiss_fastfir_cfg kiss_fastfir_alloc( ...@@ -78,7 +70,7 @@ kiss_fastfir_cfg kiss_fastfir_alloc(
if (pnfft) if (pnfft)
nfft=*pnfft; nfft=*pnfft;
if (nfft<=0) { if (nfft==0) {
/* determine fft size as next power of two at least 2x /* determine fft size as next power of two at least 2x
the impulse response length*/ the impulse response length*/
i=n_imp_resp-1; i=n_imp_resp-1;
...@@ -86,19 +78,13 @@ kiss_fastfir_cfg kiss_fastfir_alloc( ...@@ -86,19 +78,13 @@ kiss_fastfir_cfg kiss_fastfir_alloc(
do{ do{
nfft<<=1; nfft<<=1;
}while (i>>=1); }while (i>>=1);
#ifdef MIN_FFT_LEN
if ( nfft < MIN_FFT_LEN ) if ( nfft < MIN_FFT_LEN )
nfft=MIN_FFT_LEN; nfft=MIN_FFT_LEN;
#endif
} }
if (pnfft) if (pnfft)
*pnfft = nfft; *pnfft = nfft;
#ifdef REAL_FASTFIR
n_freq_bins = nfft/2 + 1; n_freq_bins = nfft/2 + 1;
#else
n_freq_bins = nfft;
#endif
/*fftcfg*/ /*fftcfg*/
FFT_ALLOC (nfft, 0, NULL, &len_fftcfg); FFT_ALLOC (nfft, 0, NULL, &len_fftcfg);
memneeded += len_fftcfg; memneeded += len_fftcfg;
...@@ -244,7 +230,7 @@ size_t kiss_fastfir( ...@@ -244,7 +230,7 @@ size_t kiss_fastfir(
} }
} }
#ifdef FAST_FILT_UTIL /*FAST_FILT_UTIL*/
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/mman.h> #include <sys/mman.h>
...@@ -285,12 +271,12 @@ void direct_file_filter( ...@@ -285,12 +271,12 @@ void direct_file_filter(
do { do {
nread = fread (buf, sizeof (kffsamp_t), nbuf, fin); nread = fread (buf, sizeof (kffsamp_t), nbuf, fin);
if (nread <= 0) if (nread == 0)
break; break;
for (k = 0; k < nread; ++k) { for (k = 0; k < nread; ++k) {
tmph = imp_resp+nlag; tmph = imp_resp+nlag;
#ifdef REAL_FASTFIR /*REAL_FASTFIR*/
# ifdef USE_SIMD # ifdef USE_SIMD
outval = _mm_set1_ps(0); outval = _mm_set1_ps(0);
#else #else
...@@ -301,26 +287,6 @@ void direct_file_filter( ...@@ -301,26 +287,6 @@ void direct_file_filter(
for (tap = 0; tap < oldestlag; ++tap) for (tap = 0; tap < oldestlag; ++tap)
outval += circbuf[tap] * *tmph--; outval += circbuf[tap] * *tmph--;
outval += buf[k] * *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]; circbuf[oldestlag++] = buf[k];
buf[k] = outval; buf[k] = outval;
...@@ -463,6 +429,7 @@ int main(int argc,char**argv) ...@@ -463,6 +429,7 @@ int main(int argc,char**argv)
if (fout!=stdout) fclose(fout); if (fout!=stdout) fclose(fout);
if (fin!=stdin) fclose(fin); if (fin!=stdin) fclose(fin);
free(h);
return 0; return 0;
} }
#endif #endif
...@@ -137,7 +137,7 @@ void transform_signal(void) ...@@ -137,7 +137,7 @@ void transform_signal(void)
CHECKNULL( fbuf=(kiss_fft_cpx*)malloc(sizeof(kiss_fft_cpx)*nfreqs ) ); CHECKNULL( fbuf=(kiss_fft_cpx*)malloc(sizeof(kiss_fft_cpx)*nfreqs ) );
CHECKNULL( mag2buf=(float*)malloc(sizeof(float)*nfreqs ) ); CHECKNULL( mag2buf=(float*)malloc(sizeof(float)*nfreqs ) );
memset(mag2buf,0,sizeof(mag2buf)*nfreqs); memset(mag2buf,0,sizeof(float)*nfreqs);
while (1) { while (1) {
if (stereo) { if (stereo) {
...@@ -168,9 +168,11 @@ void transform_signal(void) ...@@ -168,9 +168,11 @@ void transform_signal(void)
mag2buf[i] += fbuf[i].r * fbuf[i].r + fbuf[i].i * fbuf[i].i; mag2buf[i] += fbuf[i].r * fbuf[i].r + fbuf[i].i * fbuf[i].i;
if (++avgctr == navg) { if (++avgctr == navg) {
float *new_vals;
avgctr=0; avgctr=0;
++nrows; ++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; float eps = 1;
for (i=0;i<nfreqs;++i) for (i=0;i<nfreqs;++i)
vals[(nrows - 1) * nfreqs + i] = 10 * log10 ( mag2buf[i] / navg + eps ); vals[(nrows - 1) * nfreqs + i] = 10 * log10 ( mag2buf[i] / navg + eps );
...@@ -188,7 +190,7 @@ void transform_signal(void) ...@@ -188,7 +190,7 @@ void transform_signal(void)
static static
void make_png(void) void make_png(void)
{ {
png_bytepp row_pointers=NULL; png_bytepp row_pointers=NULL, new_row_pointers;
rgb_t * row_data=NULL; rgb_t * row_data=NULL;
int i; int i;
int nfreqs = nfft/2+1; int nfreqs = nfft/2+1;
...@@ -208,6 +210,8 @@ void make_png(void) ...@@ -208,6 +210,8 @@ void make_png(void)
cpx2pixels(row_data, vals, nfreqs*nrows ); cpx2pixels(row_data, vals, nfreqs*nrows );
row_pointers = realloc(row_pointers, nrows*sizeof(png_bytep)); 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) { for (i=0;i<nrows;++i) {
row_pointers[i] = (png_bytep)(row_data + i*nfreqs); row_pointers[i] = (png_bytep)(row_data + i*nfreqs);
} }
......
...@@ -201,12 +201,10 @@ int media_ctrl_get_keys_count(struct media_ctrl *ctrl) ...@@ -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) void translate_contour_hid_event(struct media_ctrl *ctrl, struct input_event *ev, struct media_ctrl_event *me)
{ {
int lv, cv;
me->type = 0; me->type = 0;
if (ev->type == EV_REL) { if (ev->type == EV_REL) {
int cv;
/* First check the outer dial */ /* First check the outer dial */
if (ev->code == REL_WHEEL) { if (ev->code == REL_WHEEL) {
...@@ -227,6 +225,7 @@ void translate_contour_hid_event(struct media_ctrl *ctrl, struct input_event *ev ...@@ -227,6 +225,7 @@ void translate_contour_hid_event(struct media_ctrl *ctrl, struct input_event *ev
me->name = _shuttle_name; me->name = _shuttle_name;
} else if (ev->code == REL_DIAL) { } else if (ev->code == REL_DIAL) {
int lv;
if ( ctrl->lastval == -1 ) ctrl->lastval = ev->value; if ( ctrl->lastval == -1 ) ctrl->lastval = ev->value;
lv = ctrl->lastval; lv = ctrl->lastval;
......
...@@ -147,6 +147,7 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString & ...@@ -147,6 +147,7 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
m_projectList(NULL), m_projectList(NULL),
m_effectList(NULL), m_effectList(NULL),
m_effectStack(NULL), m_effectStack(NULL),
m_clipMonitor(NULL), m_clipMonitor(NULL),
m_projectMonitor(NULL), m_projectMonitor(NULL),
m_recMonitor(NULL), m_recMonitor(NULL),
...@@ -444,11 +445,11 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString & ...@@ -444,11 +445,11 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
/*ScriptingPart* sp = new ScriptingPart(this, QStringList()); /*ScriptingPart* sp = new ScriptingPart(this, QStringList());
guiFactory()->addClient(sp);*/ 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()); 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) if (saveLayout)
connect(saveLayout, SIGNAL(triggered(QAction*)), this, SLOT(slotSaveLayout(QAction*))); connect(saveLayout, SIGNAL(triggered(QAction*)), this, SLOT(slotSaveLayout(QAction*)));
...@@ -554,7 +555,7 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString & ...@@ -554,7 +555,7 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
m_timelineContextClipMenu->addAction(actionCollection()->action("paste_effects")); m_timelineContextClipMenu->addAction(actionCollection()->action("paste_effects"));
m_timelineContextClipMenu->addSeparator(); m_timelineContextClipMenu->addSeparator();
QMenu *markersMenu = (QMenu*)(factory()->container("marker_menu", this));