Commit f2c984cf authored by Vincent Pinon's avatar Vincent Pinon

fix more GCC warnings

parent 5e6740b3
......@@ -144,7 +144,7 @@ int KThumb::imageVariance(const QImage &image)
pivot[i] = bits[2 * i];
avg += pivot.at(i);
}
if (STEPS != 0u) {
if (STEPS != 0) {
avg = avg / STEPS;
}
// Second Step: calculate delta (average?)
......@@ -152,7 +152,7 @@ int KThumb::imageVariance(const QImage &image)
int curdelta = abs(int(avg - pivot.at(i)));
delta += curdelta;
}
if (STEPS != 0u) {
if (STEPS != 0) {
return delta / STEPS;
}
return 0;
......
......@@ -1130,7 +1130,7 @@ void Monitor::slotZoneEnd()
void Monitor::slotRewind(double speed)
{
slotActivateMonitor();
if (speed == 0) {
if (abs(speed) < 0.001) {
double currentspeed = m_glMonitor->playSpeed();
if (currentspeed >= 0) {
speed = -1;
......@@ -1156,7 +1156,7 @@ void Monitor::slotRewind(double speed)
void Monitor::slotForward(double speed)
{
slotActivateMonitor();
if (speed == 0) {
if (abs(speed) < 0.001) {
double currentspeed = m_glMonitor->playSpeed();
if (currentspeed <= 0) {
speed = 1;
......@@ -1326,6 +1326,7 @@ void Monitor::updateClipProducer(Mlt::Producer *prod)
void Monitor::updateClipProducer(const QString &playlist)
{
Q_UNUSED(playlist)
// TODO
// Mlt::Producer *prod = new Mlt::Producer(*m_glMonitor->profile(), playlist.toUtf8().constData());
// m_glMonitor->setProducer(prod, isActive(), render->seekFramePosition());
......
......@@ -230,7 +230,7 @@ void TemporaryData::updateDataInfo()
const QFileInfoList fList = preview.entryInfoList();
KIO::filesize_t size = 0;
for (const QFileInfo &info : fList) {
size += info.size();
size += (uint)info.size();
}
gotProxySize(size);
}
......
......@@ -912,7 +912,7 @@ void Render::showAudio(Mlt::Frame &frame)
// Data format: [ c00 c10 c01 c11 c02 c12 c03 c13 ... c0{samples-1} c1{samples-1} for 2 channels.
// So the vector is of size samples*channels.
audioShortVector sampleVector(samples * num_channels);
memcpy(sampleVector.data(), data, (unsigned) samples * num_channels * sizeof(qint16));
memcpy(sampleVector.data(), data, (unsigned) (samples * num_channels) * sizeof(qint16));
if (samples > 0) {
emit audioSamplesSignal(sampleVector, freq, num_channels, samples);
......
......@@ -65,7 +65,7 @@ TimecodeDisplay::TimecodeDisplay(const Timecode &t, QWidget *parent)
setTimeCodeFormat(KdenliveSettings::frametimecode(), true);
setValue(m_minimum);
setMinimumWidth(fm.width(QStringLiteral("88:88:88:88")) + contentsMargins().right() + contentsMargins().left() + frameSize().width() -
lineEdit()->contentsRect().width() + QStyle::PM_SpinBoxFrameWidth + 6);
lineEdit()->contentsRect().width() + (int)QStyle::PM_SpinBoxFrameWidth + 6);
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Maximum);
setAccelerated(true);
......
......@@ -419,7 +419,6 @@ int TimelineModel::suggestClipMove(int clipId, int trackId, int position, int sn
continue;
}
if (trackPosition.contains(clipTrack)) {
int in = getItemPosition(current_clipId);
if (after) {
// keep only last clip position for track
int out = getItemPosition(current_clipId) + getItemPlaytime(current_clipId);
......@@ -727,6 +726,7 @@ bool TimelineModel::requestGroupMove(int clipId, int groupId, int delta_track, i
bool TimelineModel::requestGroupMove(int clipId, int groupId, int delta_track, int delta_pos, bool updateView, bool finalMove, Fun &undo, Fun &redo)
{
Q_UNUSED(clipId)
#ifdef LOGGING
m_logFile << "timeline->requestGroupMove(" << clipId << "," << groupId << " ," << delta_track << ", " << delta_pos << ", "
<< (updateView ? "true" : "false") << " ); " << std::endl;
......
......@@ -553,10 +553,8 @@ void PreviewManager::slotRemoveInvalidUndo(int ix)
void PreviewManager::invalidatePreview(int startFrame, int endFrame)
{
int chunkSize = KdenliveSettings::timelinechunks();
int start = startFrame / chunkSize;
int end = lrintf(endFrame / chunkSize);
start *= chunkSize;
end *= chunkSize;
int start = startFrame - startFrame % chunkSize;
int end = endFrame - endFrame % chunkSize + chunkSize;
qSort(m_renderedChunks);
m_previewGatherTimer.stop();
......
......@@ -283,7 +283,7 @@ void MyTextItem::blurShadow(QImage &result, int radius)
p += bpl;
for (int j = r1; j < r2; j++, p += bpl)
for (int i = i1; i <= i2; i++) {
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
p[i] = (uchar)((rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4);
}
}
......@@ -296,7 +296,7 @@ void MyTextItem::blurShadow(QImage &result, int radius)
p += 4;
for (int j = c1; j < c2; j++, p += 4)
for (int i = i1; i <= i2; i++) {
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
p[i] = (uchar)((rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4);
}
}
......@@ -309,7 +309,7 @@ void MyTextItem::blurShadow(QImage &result, int radius)
p -= bpl;
for (int j = r1; j < r2; j++, p -= bpl)
for (int i = i1; i <= i2; i++) {
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
p[i] = (uchar)((rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4);
}
}
......@@ -322,7 +322,7 @@ void MyTextItem::blurShadow(QImage &result, int radius)
p -= 4;
for (int j = c1; j < c2; j++, p -= 4)
for (int i = i1; i <= i2; i++) {
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
p[i] = (uchar)((rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4);
}
}
}
......
......@@ -254,7 +254,7 @@ QDomDocument TitleDocument::xml(QGraphicsRectItem *startv, QGraphicsRectItem *en
if (t->data(OriginYTop).toInt() == AxisInverted) {
content.setAttribute(QStringLiteral("kdenlive-axis-y-inverted"), t->data(OriginYTop).toInt());
}
if (t->textWidth() != -1) {
if (t->textWidth() > 0) {
content.setAttribute(QStringLiteral("alignment"), (int)t->alignment());
}
......@@ -323,7 +323,7 @@ QColor TitleDocument::getBackgroundColor() const
if (m_scene) {
QList<QGraphicsItem *> items = m_scene->items();
for (int i = 0; i < items.size(); ++i) {
if (items.at(i)->zValue() == -1100) {
if ((int)items.at(i)->zValue() == -1100) {
color = static_cast<QGraphicsRectItem *>(items.at(i))->brush().color();
return color;
}
......@@ -612,7 +612,7 @@ int TitleDocument::loadFromXml(const QDomDocument &doc, QGraphicsRectItem *start
// color.setAlpha(itemNode.attributes().namedItem("alpha").nodeValue().toInt());
QList<QGraphicsItem *> sceneItems = m_scene->items();
for (int j = 0; j < sceneItems.size(); ++j) {
if (sceneItems.at(j)->zValue() == -1100) {
if ((int)sceneItems.at(j)->zValue() == -1100) {
static_cast<QGraphicsRectItem *>(sceneItems.at(j))->setBrush(QBrush(color));
break;
}
......
......@@ -1101,7 +1101,7 @@ void TitleWidget::selectionChanged()
int firstZindex = l.at(0)->zValue();
allEqual = true;
for (int i = 0; i < l.size(); ++i) {
if (l[i]->zValue() != firstZindex) {
if ((int)l[i]->zValue() != firstZindex) {
allEqual = false;
break;
}
......@@ -2249,7 +2249,7 @@ void TitleWidget::deleteAnimInfoText()
void TitleWidget::slotKeepAspect(bool keep)
{
if (m_endViewport->zValue() == 1100) {
if ((int)m_endViewport->zValue() == 1100) {
m_endViewport->setData(0, keep ? m_frameWidth : QVariant());
m_endViewport->setData(1, keep ? m_frameHeight : QVariant());
} else {
......@@ -2260,7 +2260,7 @@ void TitleWidget::slotKeepAspect(bool keep)
void TitleWidget::slotResize50()
{
if (m_endViewport->zValue() == 1100) {
if ((int)m_endViewport->zValue() == 1100) {
m_endViewport->setRect(0, 0, m_frameWidth / 2, m_frameHeight / 2);
} else {
m_startViewport->setRect(0, 0, m_frameWidth / 2, m_frameHeight / 2);
......@@ -2269,7 +2269,7 @@ void TitleWidget::slotResize50()
void TitleWidget::slotResize100()
{
if (m_endViewport->zValue() == 1100) {
if ((int)m_endViewport->zValue() == 1100) {
m_endViewport->setRect(0, 0, m_frameWidth, m_frameHeight);
} else {
m_startViewport->setRect(0, 0, m_frameWidth, m_frameHeight);
......@@ -2278,7 +2278,7 @@ void TitleWidget::slotResize100()
void TitleWidget::slotResize200()
{
if (m_endViewport->zValue() == 1100) {
if ((int)m_endViewport->zValue() == 1100) {
m_endViewport->setRect(0, 0, m_frameWidth * 2, m_frameHeight * 2);
} else {
m_startViewport->setRect(0, 0, m_frameWidth * 2, m_frameHeight * 2);
......
......@@ -35,10 +35,10 @@ static QColor stringToColor(QString strColor)
if (strColor.length() == 10) {
// 0xRRGGBBAA
intval = strColor.toUInt(&ok, 16);
color.setRgb((intval >> 24) & 0xff, // r
color.setRgb((int)((intval >> 24) & 0xff), // r
(intval >> 16) & 0xff, // g
(intval >> 8) & 0xff, // b
(intval)&0xff); // a
intval & 0xff); // a
} else {
// 0xRRGGBB, 0xRGB
color.setNamedColor(strColor.replace(0, 2, QLatin1Char('#')));
......@@ -48,10 +48,10 @@ static QColor stringToColor(QString strColor)
// #AARRGGBB
strColor = strColor.replace('#', QLatin1String("0x"));
intval = strColor.toUInt(&ok, 16);
color.setRgb((intval >> 16) & 0x00ff, // r
(intval >> 8) & 0x00ff, // g
(intval)&0x00ff, // b
(intval >> 24) & 0x00ff); // a
color.setRgb((intval >> 16) & 0xff, // r
(intval >> 8) & 0xff, // g
intval&0xff, // b
(int)((intval >> 24) & 0xff)); // a
} else if (strColor.length() == 8) {
// 0xRRGGBB
strColor = strColor.replace('#', QLatin1String("0x"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment