NOISSUE fix a bunch of compiler warnings

This commit is contained in:
Petr Mrázek 2017-05-21 20:20:37 +02:00
parent 572a6026b5
commit 8bd8be95f0
10 changed files with 22 additions and 27 deletions

View File

@ -44,7 +44,7 @@ QStringList splitArgs(QString args)
} }
else if (!inquotes.isNull()) else if (!inquotes.isNull())
{ {
if (cchar == 0x5C) if (cchar == '\\')
escape = true; escape = true;
else if (cchar == inquotes) else if (cchar == inquotes)
inquotes = 0; inquotes = 0;
@ -54,7 +54,7 @@ QStringList splitArgs(QString args)
} }
else else
{ {
if (cchar == 0x20) if (cchar == ' ')
{ {
if (!current.isEmpty()) if (!current.isEmpty())
{ {
@ -62,7 +62,7 @@ QStringList splitArgs(QString args)
current.clear(); current.clear();
} }
} }
else if (cchar == 0x22 || cchar == 0x27) else if (cchar == '"' || cchar == '\'')
inquotes = cchar; inquotes = cchar;
else else
current += cchar; current += cchar;

View File

@ -341,7 +341,6 @@ bool ModList::dropMimeData(const QMimeData* data, Qt::DropAction action, int, in
if (data->hasUrls()) if (data->hasUrls())
{ {
bool was_watching = is_watching; bool was_watching = is_watching;
bool added = false;
if (was_watching) if (was_watching)
{ {
stopWatching(); stopWatching();
@ -355,10 +354,8 @@ bool ModList::dropMimeData(const QMimeData* data, Qt::DropAction action, int, in
continue; continue;
} }
// TODO: implement not only copy, but also move // TODO: implement not only copy, but also move
if (installMod(url.toLocalFile())) // FIXME: handle errors here
{ installMod(url.toLocalFile());
added = true;
}
} }
if (was_watching) if (was_watching)
{ {

View File

@ -22,7 +22,7 @@ slots:
"2016-02-10T15:06:41+00:00", "2016-02-10T15:06:41+00:00",
"2016-02-04T15:28:02-05:33" "2016-02-04T15:28:02-05:33"
}; };
for(int i = 0; i < (sizeof(timestamps) / sizeof(const char *)); i++) for(unsigned i = 0; i < (sizeof(timestamps) / sizeof(const char *)); i++)
{ {
QTest::newRow(timestamps[i]) << QString(timestamps[i]); QTest::newRow(timestamps[i]) << QString(timestamps[i]);
} }

View File

@ -210,7 +210,8 @@ void ForgeXzDownload::decompressAndInstall()
if (b.out_pos == sizeof(out)) if (b.out_pos == sizeof(out))
{ {
if (pack200_file.write((char *)out, b.out_pos) != b.out_pos) auto wresult = pack200_file.write((char *)out, b.out_pos);
if (wresult < 0 || size_t(wresult) != b.out_pos)
{ {
// msg = "Write error\n"; // msg = "Write error\n";
xz_dec_end(s); xz_dec_end(s);
@ -230,7 +231,8 @@ void ForgeXzDownload::decompressAndInstall()
continue; continue;
} }
if (pack200_file.write((char *)out, b.out_pos) != b.out_pos) auto wresult = pack200_file.write((char *)out, b.out_pos);
if (wresult < 0 || size_t(wresult) != b.out_pos)
{ {
// write error // write error
pack200_file.close(); pack200_file.close();

View File

@ -158,7 +158,6 @@ void OneSixProfileStrategy::loadUserPatches()
// now add all the patches by user sort order // now add all the patches by user sort order
ProfileUtils::PatchOrder userOrder; ProfileUtils::PatchOrder userOrder;
ProfileUtils::readOverrideOrders(FS::PathCombine(m_instance->instanceRoot(), "order.json"), userOrder); ProfileUtils::readOverrideOrders(FS::PathCombine(m_instance->instanceRoot(), "order.json"), userOrder);
bool orderIsDirty = false;
for (auto uid : userOrder) for (auto uid : userOrder)
{ {
// ignore builtins // ignore builtins
@ -169,7 +168,6 @@ void OneSixProfileStrategy::loadUserPatches()
// ordering has a patch that is gone? // ordering has a patch that is gone?
if(!loadedPatches.contains(uid)) if(!loadedPatches.contains(uid))
{ {
orderIsDirty = true;
continue; continue;
} }
profile->appendPatch(loadedPatches.take(uid)); profile->appendPatch(loadedPatches.take(uid));

View File

@ -85,6 +85,7 @@ void Download::start()
case Job_InProgress: case Job_InProgress:
qDebug() << "Downloading " << m_url.toString(); qDebug() << "Downloading " << m_url.toString();
break; break;
case Job_Failed_Proceed: // this is meaningless in this context. We do need a sink.
case Job_NotStarted: case Job_NotStarted:
case Job_Failed: case Job_Failed:
emit failed(m_index_within_job); emit failed(m_index_within_job);

View File

@ -20,7 +20,7 @@ public:
{ {
return m_pasteID; return m_pasteID;
} }
uint32_t maxSize() int maxSize()
{ {
// 2MB for paste.ee - public // 2MB for paste.ee - public
if(m_key == "public") if(m_key == "public")

View File

@ -47,8 +47,6 @@ public:
enum Status enum Status
{ {
StartingUp, StartingUp,
UnwritableLog,
FailedShowError,
Failed, Failed,
Succeeded, Succeeded,
Initialized Initialized

View File

@ -407,7 +407,7 @@ void GroupView::paintEvent(QPaintEvent *event)
QPainter painter(this->viewport()); QPainter painter(this->viewport());
QStyleOptionViewItemV4 option(viewOptions()); QStyleOptionViewItem option(viewOptions());
option.widget = this; option.widget = this;
int wpWidth = viewport()->width(); int wpWidth = viewport()->width();
@ -437,8 +437,7 @@ void GroupView::paintEvent(QPaintEvent *event)
} }
Qt::ItemFlags flags = index.flags(); Qt::ItemFlags flags = index.flags();
option.rect = visualRect(index); option.rect = visualRect(index);
option.features |= option.features |= QStyleOptionViewItem::WrapText;
QStyleOptionViewItemV2::WrapText; // FIXME: what is the meaning of this anyway?
if (flags & Qt::ItemIsSelectable && selectionModel()->isSelected(index)) if (flags & Qt::ItemIsSelectable && selectionModel()->isSelected(index))
{ {
option.state |= selectionModel()->isSelected(index) ? QStyle::State_Selected option.state |= selectionModel()->isSelected(index) ? QStyle::State_Selected

View File

@ -52,7 +52,7 @@ ListViewDelegate::ListViewDelegate(QObject *parent) : QStyledItemDelegate(parent
{ {
} }
void drawSelectionRect(QPainter *painter, const QStyleOptionViewItemV4 &option, void drawSelectionRect(QPainter *painter, const QStyleOptionViewItem &option,
const QRect &rect) const QRect &rect)
{ {
if ((option.state & QStyle::State_Selected)) if ((option.state & QStyle::State_Selected))
@ -65,7 +65,7 @@ void drawSelectionRect(QPainter *painter, const QStyleOptionViewItemV4 &option,
} }
} }
void drawFocusRect(QPainter *painter, const QStyleOptionViewItemV4 &option, const QRect &rect) void drawFocusRect(QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect)
{ {
if (!(option.state & QStyle::State_HasFocus)) if (!(option.state & QStyle::State_HasFocus))
return; return;
@ -89,7 +89,7 @@ void drawFocusRect(QPainter *painter, const QStyleOptionViewItemV4 &option, cons
} }
// TODO this can be made a lot prettier // TODO this can be made a lot prettier
void drawProgressOverlay(QPainter *painter, const QStyleOptionViewItemV4 &option, void drawProgressOverlay(QPainter *painter, const QStyleOptionViewItem &option,
const int value, const int maximum) const int value, const int maximum)
{ {
if (maximum == 0 || value == maximum) if (maximum == 0 || value == maximum)
@ -109,7 +109,7 @@ void drawProgressOverlay(QPainter *painter, const QStyleOptionViewItemV4 &option
painter->restore(); painter->restore();
} }
void drawBadges(QPainter *painter, const QStyleOptionViewItemV4 &option, BaseInstance *instance, QIcon::Mode mode, QIcon::State state) void drawBadges(QPainter *painter, const QStyleOptionViewItem &option, BaseInstance *instance, QIcon::Mode mode, QIcon::State state)
{ {
QList<QString> pixmaps; QList<QString> pixmaps;
if (instance->isRunning()) if (instance->isRunning())
@ -156,7 +156,7 @@ void drawBadges(QPainter *painter, const QStyleOptionViewItemV4 &option, BaseIns
painter->translate(-option.rect.topLeft()); painter->translate(-option.rect.topLeft());
} }
static QSize viewItemTextSize(const QStyleOptionViewItemV4 *option) static QSize viewItemTextSize(const QStyleOptionViewItem *option)
{ {
QStyle *style = option->widget ? option->widget->style() : QApplication::style(); QStyle *style = option->widget ? option->widget->style() : QApplication::style();
QTextOption textOption; QTextOption textOption;
@ -177,7 +177,7 @@ static QSize viewItemTextSize(const QStyleOptionViewItemV4 *option)
void ListViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, void ListViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const const QModelIndex &index) const
{ {
QStyleOptionViewItemV4 opt = option; QStyleOptionViewItem opt = option;
initStyleOption(&opt, index); initStyleOption(&opt, index);
painter->save(); painter->save();
painter->setClipRect(opt.rect); painter->setClipRect(opt.rect);
@ -205,7 +205,7 @@ void ListViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
// FIXME: unused // FIXME: unused
// QSize textSize = viewItemTextSize ( &opt ); // QSize textSize = viewItemTextSize ( &opt );
QPalette::ColorGroup cg; QPalette::ColorGroup cg;
QStyleOptionViewItemV4 opt2(opt); QStyleOptionViewItem opt2(opt);
if ((opt.widget && opt.widget->isEnabled()) || (opt.state & QStyle::State_Enabled)) if ((opt.widget && opt.widget->isEnabled()) || (opt.state & QStyle::State_Enabled))
{ {
@ -323,7 +323,7 @@ void ListViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
QSize ListViewDelegate::sizeHint(const QStyleOptionViewItem &option, QSize ListViewDelegate::sizeHint(const QStyleOptionViewItem &option,
const QModelIndex &index) const const QModelIndex &index) const
{ {
QStyleOptionViewItemV4 opt = option; QStyleOptionViewItem opt = option;
initStyleOption(&opt, index); initStyleOption(&opt, index);
opt.features |= QStyleOptionViewItem::WrapText; opt.features |= QStyleOptionViewItem::WrapText;
opt.text = index.data().toString(); opt.text = index.data().toString();