Qt: More warning fixes
@@ -130,8 +130,6 @@
void AssetTile::selectColor(int index) { const color_t* data; mTileCache* tileCache = m_tileCaches[m_index >= m_boundary]; - unsigned bpp = 8 << tileCache->bpp; - int paletteId = m_paletteId; data = mTileCacheGetTile(tileCache, m_index >= m_boundary ? m_index - m_boundary : m_index, m_paletteId); color_t color = data[index]; m_ui.color->setColor(0, color);
@@ -144,8 +144,8 @@ QImage image = QImage(QSize(objInfo.width * 8, objInfo.height * 8), QImage::Format_Indexed8);
image.setColorTable(palette); uchar* bits = image.bits(); unsigned t = objInfo.tile; - for (int y = 0; y < objInfo.height; ++y) { - for (int x = 0; x < objInfo.width; ++x, ++t) { + for (unsigned y = 0; y < objInfo.height; ++y) { + for (unsigned x = 0; x < objInfo.width; ++x, ++t) { compositeTile(static_cast<const void*>(mTileCacheGetVRAM(tileCache, t)), bits, objInfo.width * 8, x * 8, y * 8, objInfo.bits); } t += objInfo.stride - objInfo.width;@@ -183,7 +183,6 @@ unsigned width = GBAVideoObjSizes[shape * 4 + size][0];
unsigned height = GBAVideoObjSizes[shape * 4 + size][1]; unsigned tile = GBAObjAttributesCGetTile(obj->c); unsigned palette = GBAObjAttributesCGetPalette(obj->c); - unsigned tileBase = tile; unsigned paletteSet; unsigned bits; if (GBAObjAttributesAIs256Color(obj->a)) {@@ -237,7 +236,6 @@
const GB* gb = static_cast<const GB*>(m_controller->thread()->core->board); const GBObj* obj = &gb->video.oam.obj[id]; - unsigned width = 8; unsigned height = 8; GBRegisterLCDC lcdc = gb->memory.io[REG_LCDC]; if (GBRegisterLCDCIsObjSize(lcdc)) {
@@ -42,11 +42,10 @@ return QVariant();
} } - if (index.row() >= mCheatSetsSize(&m_device->cheats)) { + if ((size_t) index.row() >= mCheatSetsSize(&m_device->cheats)) { return QVariant(); } - int row = index.row(); const mCheatSet* cheats = *mCheatSetsGetPointer(&m_device->cheats, index.row()); switch (role) { case Qt::DisplayRole:@@ -60,11 +59,10 @@ }
} bool CheatsModel::setData(const QModelIndex& index, const QVariant& value, int role) { - if (!index.isValid() || index.parent().isValid() || index.row() > mCheatSetsSize(&m_device->cheats)) { + if (!index.isValid() || index.parent().isValid() || (size_t) index.row() > mCheatSetsSize(&m_device->cheats)) { return false; } - int row = index.row(); mCheatSet* cheats = *mCheatSetsGetPointer(&m_device->cheats, index.row()); switch (role) { case Qt::DisplayRole:@@ -119,7 +117,7 @@
return Qt::ItemIsUserCheckable | Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable; } -int CheatsModel::columnCount(const QModelIndex& parent) const { +int CheatsModel::columnCount(const QModelIndex&) const { return 1; }@@ -141,14 +139,14 @@ }
if (index.parent().isValid()) { return static_cast<mCheatSet*>(index.internalPointer()); } - if (index.row() >= mCheatSetsSize(&m_device->cheats)) { + if ((size_t) index.row() >= mCheatSetsSize(&m_device->cheats)) { return nullptr; } return *mCheatSetsGetPointer(&m_device->cheats, index.row()); } void CheatsModel::removeAt(const QModelIndex& index) { - if (!index.isValid() || index.parent().isValid() || index.row() >= mCheatSetsSize(&m_device->cheats)) { + if (!index.isValid() || index.parent().isValid() || (size_t) index.row() >= mCheatSetsSize(&m_device->cheats)) { return; } int row = index.row();
@@ -46,7 +46,6 @@ bool ColorPicker::eventFilter(QObject* obj, QEvent* event) {
if (event->type() != QEvent::MouseButtonRelease) { return false; } - int colorId; if (obj != m_parent) { return false; }
@@ -51,7 +51,7 @@ virtual bool isDrawing() const = 0;
virtual bool supportsShaders() const = 0; virtual VideoShader* shaders() = 0; virtual int framebufferHandle() { return -1; } - virtual void setVideoScale(int scale) {} + virtual void setVideoScale(int) {} virtual void setVideoProxy(std::shared_ptr<VideoProxy> proxy) { m_videoProxy = proxy; } std::shared_ptr<VideoProxy> videoProxy() { return m_videoProxy; }
@@ -96,6 +96,7 @@ painter.fillRect(QRect(QPoint(), size()), Qt::black);
if (isFiltered()) { painter.setRenderHint(QPainter::SmoothPixmapTransform); } + // TODO: Refactor this code out (since it's copied in like 3 places) QSize s = size(); QSize ds = s; if (isAspectRatioLocked()) {
@@ -42,8 +42,8 @@ virtual void paintEvent(QPaintEvent*) override;
private: bool m_isDrawing = false; - unsigned m_width; - unsigned m_height; + int m_width; + int m_height; QImage m_backing{nullptr}; QImage m_oldBacking{nullptr}; std::shared_ptr<CoreController> m_context = nullptr;
@@ -30,7 +30,7 @@ Shortcut(Action* action);
Action* action() { return m_action; } const Action* action() const { return m_action; } - const int shortcut() const { return m_shortcut; } + int shortcut() const { return m_shortcut; } QString visibleName() const { return m_action ? m_action->visibleName() : QString(); } QString name() const { return m_action ? m_action->name() : QString(); } int button() const { return m_button; }
@@ -27,7 +27,6 @@ QVariant ShortcutModel::data(const QModelIndex& index, int role) const {
if (role != Qt::DisplayRole || !index.isValid()) { return QVariant(); } - int row = index.row(); const Item* item = static_cast<Item*>(index.internalPointer()); const Shortcut* shortcut = item->shortcut; switch (index.column()) {@@ -101,7 +100,7 @@ pitem->shortcut = m_controller->shortcut(parent);
return createIndex(m_controller->indexIn(parent), 0, pitem); } -int ShortcutModel::columnCount(const QModelIndex& index) const { +int ShortcutModel::columnCount(const QModelIndex&) const { return 3; }@@ -131,7 +130,7 @@ beginInsertRows(createIndex(m_controller->indexIn(parent), 0, item), index, index + 1);
endInsertRows(); } -void ShortcutModel::clearMenu(const QString& name) { +void ShortcutModel::clearMenu(const QString&) { // TODO beginResetModel(); endResetModel();