From da43aca116a2e6df4cab432d156cf01f71ad4292 Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Mon, 19 Feb 2024 03:09:53 +0100 Subject: [PATCH] Fix a few compilation warnings in the GUI --- src/gui/Src/BasicView/AbstractStdTable.h | 2 +- src/gui/Src/BasicView/AbstractTableView.cpp | 4 ++-- src/gui/Src/BasicView/HexDump.cpp | 2 +- src/gui/Src/BasicView/StdTableSearchList.cpp | 2 +- src/gui/Src/Gui/CPUSideBar.cpp | 10 +++++----- src/gui/Src/Gui/WatchView.cpp | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/gui/Src/BasicView/AbstractStdTable.h b/src/gui/Src/BasicView/AbstractStdTable.h index e20c12c2..61cf403c 100644 --- a/src/gui/Src/BasicView/AbstractStdTable.h +++ b/src/gui/Src/BasicView/AbstractStdTable.h @@ -139,7 +139,7 @@ protected: QColor mTracedSelectedAddressBackgroundColor; bool bCipBase = false; QString mHighlightText; - int mMinimumHighlightColumn = 0; + duint mMinimumHighlightColumn = 0; int mAddressColumn = -1; bool bAddressLabel = true; diff --git a/src/gui/Src/BasicView/AbstractTableView.cpp b/src/gui/Src/BasicView/AbstractTableView.cpp index 8940139f..57e25004 100644 --- a/src/gui/Src/BasicView/AbstractTableView.cpp +++ b/src/gui/Src/BasicView/AbstractTableView.cpp @@ -1147,7 +1147,7 @@ void AbstractTableView::deleteAllColumns() void AbstractTableView::setColTitle(duint col, const QString & title) { - if(mColumnList.size() > 0 && col < mColumnList.size()) + if(mColumnList.size() > 0 && col < (duint)mColumnList.size()) { Column column = mColumnList.takeAt(col); column.title = title; @@ -1157,7 +1157,7 @@ void AbstractTableView::setColTitle(duint col, const QString & title) QString AbstractTableView::getColTitle(duint col) const { - if(mColumnList.size() > 0 && col < mColumnList.size()) + if(mColumnList.size() > 0 && col < (duint)mColumnList.size()) return mColumnList[col].title; return QString(); } diff --git a/src/gui/Src/BasicView/HexDump.cpp b/src/gui/Src/BasicView/HexDump.cpp index 23110790..cd8d19b7 100644 --- a/src/gui/Src/BasicView/HexDump.cpp +++ b/src/gui/Src/BasicView/HexDump.cpp @@ -698,7 +698,7 @@ QString HexDump::paintContent(QPainter* painter, duint row, duint col, int x, in void HexDump::printSelected(QPainter* painter, duint row, duint col, int x, int y, int w, int h) { - if(col > 0 && col <= mDescriptor.size()) + if(col > 0 && col <= (duint)mDescriptor.size()) { ColumnDescriptor curDescriptor = mDescriptor.at(col - 1); auto bytePerRowCount = getBytePerRowCount(); diff --git a/src/gui/Src/BasicView/StdTableSearchList.cpp b/src/gui/Src/BasicView/StdTableSearchList.cpp index c60a6f8a..ca778a7a 100644 --- a/src/gui/Src/BasicView/StdTableSearchList.cpp +++ b/src/gui/Src/BasicView/StdTableSearchList.cpp @@ -13,7 +13,7 @@ void StdTableSearchList::filter(const QString & filter, FilterType type, duint s if(rowMatchesFilter(filter, type, i, startColumn)) { mSearchList->setRowCount(j + 1); - for(int k = 0; k < columns; k++) + for(duint k = 0; k < columns; k++) { mSearchList->setCellContent(j, k, mList->getCellContent(i, k)); mSearchList->setCellUserdata(j, k, mList->getCellUserdata(i, k)); diff --git a/src/gui/Src/Gui/CPUSideBar.cpp b/src/gui/Src/Gui/CPUSideBar.cpp index ac5fb1d0..e569971d 100644 --- a/src/gui/Src/Gui/CPUSideBar.cpp +++ b/src/gui/Src/Gui/CPUSideBar.cpp @@ -217,7 +217,7 @@ void CPUSideBar::paintEvent(QPaintEvent* event) for(duint line = 0; line < mViewableRows; line++) { - if(line >= mInstrBuffer->size()) //at the end of the page it will crash otherwise + if(line >= (duint)mInstrBuffer->size()) //at the end of the page it will crash otherwise break; const Instruction_t & instr = mInstrBuffer->at(line); @@ -817,7 +817,7 @@ void CPUSideBar::AllocateJumpOffsets(std::vector & jumpLines, std::vec unsigned int maxJmpOffset = 0; if(jmp.line < jmp.destLine) { - for(int j = jmp.line; j <= jmp.destLine && j < mViewableRows; j++) + for(int j = jmp.line; j <= jmp.destLine && (duint)j < mViewableRows; j++) { if(numLines[j] > maxJmpOffset) maxJmpOffset = numLines[j]; @@ -834,7 +834,7 @@ void CPUSideBar::AllocateJumpOffsets(std::vector & jumpLines, std::vec jmp.jumpOffset = maxJmpOffset + 1; if(jmp.line < jmp.destLine) { - for(int j = jmp.line; j <= jmp.destLine && j < mViewableRows; j++) + for(int j = jmp.line; j <= jmp.destLine && (duint)j < mViewableRows; j++) numLines[j] = jmp.jumpOffset; } else @@ -842,9 +842,9 @@ void CPUSideBar::AllocateJumpOffsets(std::vector & jumpLines, std::vec for(int j = jmp.line; j >= jmp.destLine && j >= 0; j--) numLines[j] = jmp.jumpOffset; } - if(jmp.line >= 0 && jmp.line < mViewableRows) + if(jmp.line >= 0 && (duint)jmp.line < mViewableRows) numLines[jmp.line + mViewableRows] = jmp.jumpOffset; - if(jmp.destLine >= 0 && jmp.destLine < mViewableRows) + if(jmp.destLine >= 0 && (duint)jmp.destLine < mViewableRows) numLines[jmp.destLine + mViewableRows] = jmp.jumpOffset; } // set label arrows according to jump offsets diff --git a/src/gui/Src/Gui/WatchView.cpp b/src/gui/Src/Gui/WatchView.cpp index ce4cea8b..4f32cdbc 100644 --- a/src/gui/Src/Gui/WatchView.cpp +++ b/src/gui/Src/Gui/WatchView.cpp @@ -33,7 +33,7 @@ void WatchView::updateWatch() BridgeList WatchList; DbgGetWatchList(&WatchList); setRowCount(WatchList.Count()); - if(getInitialSelection() >= WatchList.Count() && WatchList.Count() > 0) + if(getInitialSelection() >= (duint)WatchList.Count() && WatchList.Count() > 0) setSingleSelection(WatchList.Count() - 1); for(int i = 0; i < WatchList.Count(); i++) { @@ -232,7 +232,7 @@ void WatchView::modifyWatchSlot() BridgeList WatchList; DbgGetWatchList(&WatchList); auto sel = getInitialSelection(); - if(sel > WatchList.Count()) + if(sel > (duint)WatchList.Count()) return; WordEditDialog modifyDialog(this); modifyDialog.setup(tr("Modify \"%1\"").arg(QString(WatchList[sel].WatchName)), WatchList[sel].value, sizeof(duint));