Qt: More warning fixes

This commit is contained in:
Vicki Pfau 2020-08-01 23:05:05 -07:00
parent b9acc05292
commit 639c0bf0e9
9 changed files with 14 additions and 21 deletions

View File

@ -130,8 +130,6 @@ void AssetTile::setFlip(bool h, bool v) {
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);

View File

@ -144,8 +144,8 @@ QImage AssetView::compositeObj(const ObjInfo& objInfo) {
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 @@ bool AssetView::lookupObjGBA(int id, struct ObjInfo* info) {
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 @@ bool AssetView::lookupObjGB(int id, struct ObjInfo* info) {
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)) {

View File

@ -42,11 +42,10 @@ QVariant CheatsModel::data(const QModelIndex& index, int role) const {
}
}
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 @@ QVariant CheatsModel::data(const QModelIndex& index, int role) const {
}
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 @@ Qt::ItemFlags CheatsModel::flags(const QModelIndex& index) const {
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 @@ mCheatSet* CheatsModel::itemAt(const QModelIndex& index) {
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();

View File

@ -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;
}

View File

@ -51,7 +51,7 @@ public:
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; }

View File

@ -96,6 +96,7 @@ void DisplayQt::paintEvent(QPaintEvent*) {
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()) {

View File

@ -42,8 +42,8 @@ protected:
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;

View File

@ -30,7 +30,7 @@ public:
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; }

View File

@ -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 @@ QModelIndex ShortcutModel::parent(const QModelIndex& index) const {
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 @@ void ShortcutModel::addRowNamed(const QString& name) {
endInsertRows();
}
void ShortcutModel::clearMenu(const QString& name) {
void ShortcutModel::clearMenu(const QString&) {
// TODO
beginResetModel();
endResetModel();