More int comparison sign mismatch compiler warning fixes.

This commit is contained in:
harry 2023-01-28 16:03:05 -05:00
parent 7a40075f3e
commit 7910da7805
14 changed files with 52 additions and 53 deletions

View File

@ -3180,7 +3180,7 @@ void LibavOptionsPage::initChannelLayoutSelect( const char *codec_name )
audioChanLayout->addItem( tr(layoutDesc), (unsigned long long)c->channel_layouts[i] );
if ( LIBAV::audio_st.chanLayout == c->channel_layouts[i] )
if ( static_cast<uint64_t>(LIBAV::audio_st.chanLayout) == c->channel_layouts[i] )
{
audioChanLayout->setCurrentIndex( audioChanLayout->count() - 1 );
formatOk = true;

View File

@ -945,9 +945,9 @@ int AviRiffViewerDialog::processChunk( AviRiffTreeItem *item )
sprintf( stmp, "%u", data.readU32(8) );
for (i=0; i<item->getSize(); i++)
for (i=0; i < static_cast<int>(item->getSize()); i++)
{
if ( i >= ( sizeof(stmp)-1 ) )
if ( i >= (static_cast<int>(sizeof(stmp))-1 ) )
{
i = sizeof(stmp)-1; break;
}

View File

@ -3190,7 +3190,7 @@ void QAsmView::setPC_placement( int mode, int ofs )
//----------------------------------------------------------------------------
void QAsmView::toggleBreakpoint(int line)
{
if ( line < asmEntry.size() )
if ( static_cast<size_t>(line) < asmEntry.size() )
{
int bpNum = isBreakpointAtLine(line);
@ -3230,15 +3230,15 @@ int QAsmView::isBreakpointAtAddr( int cpuAddr, int romAddr )
{
if ( watchpoint[i].endaddress )
{
if ( (romAddr >= watchpoint[i].address) &&
romAddr < watchpoint[i].endaddress )
if ( ( static_cast<unsigned int>(romAddr) >= watchpoint[i].address) &&
static_cast<unsigned int>(romAddr) < watchpoint[i].endaddress )
{
return i;
}
}
else
{
if (romAddr == watchpoint[i].address)
if ( static_cast<unsigned int>(romAddr) == watchpoint[i].address)
{
return i;
}
@ -3248,15 +3248,15 @@ int QAsmView::isBreakpointAtAddr( int cpuAddr, int romAddr )
{
if ( watchpoint[i].endaddress )
{
if ( (cpuAddr >= watchpoint[i].address) &&
cpuAddr < watchpoint[i].endaddress )
if ( ( static_cast<unsigned int>(cpuAddr) >= watchpoint[i].address) &&
static_cast<unsigned int>(cpuAddr) < watchpoint[i].endaddress )
{
return i;
}
}
else
{
if (cpuAddr == watchpoint[i].address)
if ( static_cast<unsigned int>(cpuAddr) == watchpoint[i].address)
{
return i;
}
@ -3268,7 +3268,7 @@ int QAsmView::isBreakpointAtAddr( int cpuAddr, int romAddr )
//----------------------------------------------------------------------------
int QAsmView::isBreakpointAtLine( int l )
{
if ( l < asmEntry.size() )
if ( static_cast<size_t>(l) < asmEntry.size() )
{
if ( asmEntry[l]->type == dbg_asm_entry_t::ASM_TEXT )
{
@ -3290,7 +3290,7 @@ void QAsmView::setBreakpointAtSelectedLine(void)
{
int addr = -1;
if ( (selAddrLine >= 0) && (selAddrLine < asmEntry.size()) )
if ( (selAddrLine >= 0) && (static_cast<size_t>(selAddrLine) < asmEntry.size()) )
{
if ( selAddrValue == asmEntry[ selAddrLine ]->addr )
{
@ -3311,7 +3311,7 @@ void QAsmView::setBreakpointAtSelectedLine(void)
//----------------------------------------------------------------------------
int QAsmView::getAsmAddrFromLine(int line)
{
if ( (line >= 0) && (line < asmEntry.size()) )
if ( (line >= 0) && (static_cast<size_t>(line) < asmEntry.size()) )
{
return asmEntry[line]->addr;
}
@ -3424,7 +3424,7 @@ int QAsmView::getAsmLineFromAddr(int addr)
}
// Don't stop on an symbol name or comment line, search for next assembly line
while ( (line < asmEntry.size()) && (asmEntry[line]->type != dbg_asm_entry_t::ASM_TEXT) )
while ( (static_cast<size_t>(line) < asmEntry.size()) && (asmEntry[line]->type != dbg_asm_entry_t::ASM_TEXT) )
{
line++;
}
@ -3546,7 +3546,7 @@ void QAsmView::updateAssemblyView(void)
{
uint8_t cdl_data;
instruction_addr = GetNesFileAddress(addr) - 16;
if ( (instruction_addr >= 0) && (instruction_addr < cdloggerdataSize) )
if ( (instruction_addr >= 0) && (static_cast<unsigned int>(instruction_addr) < cdloggerdataSize) )
{
cdl_data = cdloggerdata[instruction_addr] & 3;
if (cdl_data == 3)
@ -3746,7 +3746,7 @@ void QAsmView::updateAssemblyView(void)
a->line = asmEntry.size();
if ( maxLineLen < line.size() )
if ( static_cast<size_t>(maxLineLen) < line.size() )
{
maxLineLen = line.size();
}
@ -4368,7 +4368,7 @@ static int getGameDebugBreakpointFileName(std::string &filepath)
}
i++;
}
if ( (j >= 0) && (j < filepath.size()) )
if ( (j >= 0) && (static_cast<size_t>(j) < filepath.size()) )
{
filepath.erase(j);
}
@ -4954,7 +4954,7 @@ void QAsmView::gotoAddr( int addr )
//----------------------------------------------------------------------------
void QAsmView::gotoLine( int line )
{
if ( (line >= 0) && (line < asmEntry.size()) )
if ( (line >= 0) && (static_cast<size_t>(line) < asmEntry.size()) )
{
if ( curNavLoc.addr != asmEntry[line]->addr )
{ // Don't push back to back duplicates into the navigation history
@ -5021,7 +5021,7 @@ void QAsmView::navHistForward(void)
//----------------------------------------------------------------------------
void QAsmView::setSelAddrToLine( int line )
{
if ( (line >= 0) && (line < asmEntry.size()) )
if ( (line >= 0) && (static_cast<size_t>(line) < asmEntry.size()) )
{
int addr = asmEntry[line]->addr;
selAddrLine = line;
@ -5174,7 +5174,7 @@ bool QAsmView::event(QEvent *event)
line = lineOffset + c.y();
opcodeValid = (line < asmEntry.size()) && (asmEntry[line]->size > 0) &&
opcodeValid = (static_cast<size_t>(line) < asmEntry.size()) && (asmEntry[line]->size > 0) &&
(asmEntry[line]->type == dbg_asm_entry_t::ASM_TEXT);
showOpcodeDesc = (c.x() >= opcodeLinePos) && (c.x() < operandLinePos) && opcodeValid;
@ -5185,7 +5185,7 @@ bool QAsmView::event(QEvent *event)
{
size_t subStrLoc = asmEntry[line]->text.find( asmEntry[line]->sym.name, operandLinePos );
if ( (subStrLoc != std::string::npos) && (subStrLoc > operandLinePos) )
if ( (subStrLoc != std::string::npos) && (subStrLoc > static_cast<size_t>(operandLinePos)) )
{
//printf("Line:%i asmEntry DB Sym: %zi '%s'\n", line, subStrLoc, asmEntry[line]->sym.name.c_str() );
int symTextStart = subStrLoc;
@ -5199,7 +5199,7 @@ bool QAsmView::event(QEvent *event)
}
if ( opcodeValid && (c.x() > operandLinePos) &&
(c.x() < asmEntry[line]->text.size()) )
( static_cast<size_t>(c.x()) < asmEntry[line]->text.size()) )
{
i = c.x();
@ -5552,7 +5552,7 @@ void QAsmView::mouseMoveEvent(QMouseEvent * event)
//printf("c (%i,%i) : Line %i : %04X \n", c.x(), c.y(), line, asmEntry[line]->addr );
if ( line < asmEntry.size() )
if ( static_cast<size_t>(line) < asmEntry.size() )
{
int addr;
@ -5651,7 +5651,7 @@ void QAsmView::loadHighlightToClipboard(void)
}
hlgtXd = (hlgtXe - hlgtXs);
if ( hlgtXs < asmEntry[l]->text.size() )
if ( static_cast<size_t>(hlgtXs) < asmEntry[l]->text.size() )
{
s = asmEntry[l]->text.substr( hlgtXs, hlgtXd );
}
@ -5742,7 +5742,7 @@ void QAsmView::mousePressEvent(QMouseEvent * event)
selAddrType = 0;
selAddrText[0] = 0;
if ( line < asmEntry.size() )
if ( static_cast<size_t>(line) < asmEntry.size() )
{
int i,j, addr = -1, addrTextLoc = -1, selChar;
int symTextStart = -1, symTextEnd = -1;
@ -5753,7 +5753,7 @@ void QAsmView::mousePressEvent(QMouseEvent * event)
if ( asmEntry[line]->type == dbg_asm_entry_t::ASM_TEXT )
{
if ( selChar < (int)asmEntry[line]->text.size() )
if ( static_cast<size_t>(selChar) < asmEntry[line]->text.size() )
{
i = selChar;
@ -5761,7 +5761,7 @@ void QAsmView::mousePressEvent(QMouseEvent * event)
{
size_t subStrLoc = asmEntry[line]->text.find( asmEntry[line]->sym.name, operandLinePos );
if ( (subStrLoc != std::string::npos) && (subStrLoc > operandLinePos) )
if ( (subStrLoc != std::string::npos) && (subStrLoc > static_cast<size_t>(operandLinePos)) )
{
//printf("Line:%i asmEntry DB Sym: %zi '%s'\n", line, subStrLoc, asmEntry[line]->sym.name.c_str() );
symTextStart = subStrLoc;
@ -5980,7 +5980,7 @@ void QAsmView::contextMenuEvent(QContextMenuEvent *event)
ctxMenuAddr = -1;
if ( line < asmEntry.size() )
if ( static_cast<size_t>(line) < asmEntry.size() )
{
int addr, romAddr;
@ -6346,7 +6346,7 @@ void QAsmView::paintEvent(QPaintEvent *event)
lineIsPC = false;
}
if ( l < asmEntry.size() )
if ( static_cast<size_t>(l) < asmEntry.size() )
{
//if ( asmEntry[l]->type != dbg_asm_entry_t::ASM_TEXT )
//{
@ -6378,7 +6378,7 @@ void QAsmView::paintEvent(QPaintEvent *event)
if ( (selAddrLine == l) )
{ // Highlight ASM line for selected address.
if ( !txtHlgtSet && (selAddr == selAddrValue) &&
(asmEntry[l]->text.size() >= (selAddrChar + selAddrWidth) ) &&
(asmEntry[l]->text.size() >= static_cast<size_t>(selAddrChar + selAddrWidth) ) &&
( asmEntry[l]->text.compare( selAddrChar, selAddrWidth, selAddrText ) == 0 ) )
{
int ax;
@ -6433,7 +6433,7 @@ void QAsmView::paintEvent(QPaintEvent *event)
}
hlgtXd = (hlgtXe - hlgtXs);
if ( hlgtXs < asmEntry[l]->text.size() )
if ( static_cast<size_t>(hlgtXs) < asmEntry[l]->text.size() )
{
s = asmEntry[l]->text.substr( hlgtXs, hlgtXd );
}
@ -6465,7 +6465,7 @@ void QAsmView::paintEvent(QPaintEvent *event)
x = -pxLineXScroll;
l = lineOffset + row;
if ( l < asmEntry.size() )
if ( static_cast<size_t>(l) < asmEntry.size() )
{
if ( asmPC != NULL )
{

View File

@ -248,7 +248,7 @@ void FamilyKeyboardWidget::updateHardwareStatus(void)
//*********************************************************************************
int FamilyKeyboardWidget::getKeyAtPoint( QPoint p )
{
for (int i=0; i<NUM_KEYS; i++)
for (int i=0; i < static_cast<int>(NUM_KEYS); i++)
{
if ( key[i].rect.contains(p) )
{
@ -1029,7 +1029,7 @@ void FKBConfigDialog::keyTreeItemActivated(QTreeWidgetItem *item, int column)
//----------------------------------------------------------------------------
int FKBConfigDialog::getButtonIndexFromName( const char *buttonName )
{
for (int j=0; j<FamilyKeyboardWidget::NUM_KEYS; j++)
for (int j=0; j < static_cast<int>(FamilyKeyboardWidget::NUM_KEYS); j++)
{
if ( strcmp( buttonName, FamilyKeyBoardNames[j] ) == 0 )
{

View File

@ -433,7 +433,6 @@ void EncodeGG(char *str, int a, int v, int c)
//----------------------------------------------------------------------------
void GameGenieDialog_t::ListGGAddresses(void)
{
int i; //mbg merge 7/18/06 changed from int
int a = -1; int v = -1; int c = -1;
QTreeWidgetItem *item;
char str[32];
@ -460,7 +459,7 @@ void GameGenieDialog_t::ListGGAddresses(void)
if (a != -1 && v != -1)
{
for (i = 0; i < PRGsize[0]; i += 0x2000)
for (unsigned int i = 0; i < PRGsize[0]; i += 0x2000)
{
if (c == -1 || PRGptr[0][i + (a & 0x1FFF)] == c)
{

View File

@ -604,7 +604,7 @@ void GamePadConfDialog_t::loadMapList(void)
mapSel->addItem(tr("default"), 0);
n = 1;
for (qsizetype i = 0; i < fileList.size(); i++)
for (int i = 0; i < static_cast<int>(fileList.size()); i++)
{
size_t suffixIdx;
std::string fileName = fileList[i].toStdString();
@ -619,7 +619,7 @@ void GamePadConfDialog_t::loadMapList(void)
if (fileName.compare("default") == 0)
continue;
mapSel->addItem(tr(fileName.c_str()), (int)i + 1);
mapSel->addItem(tr(fileName.c_str()), i + 1);
if (mapName.compare(fileName) == 0)
{

View File

@ -733,7 +733,7 @@ int HexBookMarkManager_t::saveToFile(void)
return -1;
}
for (int i=0; i<v.size(); i++)
for (size_t i=0; i<v.size(); i++)
{
fprintf( fp, "%s:%08X:%s\n",
memViewNames[ v[i]->mode ], v[i]->addr, v[i]->desc );
@ -2455,9 +2455,9 @@ int QHexEdit::findPattern( std::vector <unsigned char> &varray, int dir )
return -1;
}
match = 1;
for (int i=0; i<varray.size(); i++)
for (size_t i=0; i<varray.size(); i++)
{
if ( (addr+i) >= mb.size() )
if ( (addr+i) >= static_cast<size_t>(mb.size()) )
{
match = 0; break;
}
@ -3273,7 +3273,7 @@ int QHexEdit::FreezeRam( const char *name, uint32_t a, uint8_t v, int c, int s,
// printf("$%04X:%02X %i: %s\n", a, v, s, name );
//}
if ( a == frzRamAddr )
if ( a == static_cast<uint32_t>(frzRamAddr) )
{
switch ( frzRamMode )
{

View File

@ -50,7 +50,7 @@ MovieOptionsDialog_t::MovieOptionsDialog_t(QWidget *parent)
QVBoxLayout *vbox1, *vbox2;
QPushButton *closeButton;
std::vector <std::string> aviDriverList;
int aviDriver;
int aviDriver=0;
setWindowTitle("Movie Options");
@ -146,7 +146,7 @@ MovieOptionsDialog_t::MovieOptionsDialog_t(QWidget *parent)
break;
}
if ( i == aviDriver )
if ( i == static_cast<size_t>(aviDriver) )
{
aviBackend->setCurrentIndex(i);
aviPageStack->setCurrentIndex(i);

View File

@ -1778,7 +1778,7 @@ void QRamSearchView::keyPressEvent(QKeyEvent *event)
selAddr = -1;
selLine++;
if (selLine >= actvSrchList.size())
if ( static_cast<size_t>(selLine) >= actvSrchList.size())
{
selLine = actvSrchList.size() - 1;
}

View File

@ -932,7 +932,7 @@ QMenuBar *TasEditorWindow::buildMenuBar(void)
actGroup->addAction(act);
patternMenu->addAction(act);
act->setChecked( taseditorConfig.currentPattern == i );
act->setChecked( static_cast<size_t>(taseditorConfig.currentPattern) == i );
}
// Help
@ -6388,7 +6388,7 @@ void QPianoRoll::paintEvent(QPaintEvent *event)
lineNum = lineOffset + row;
if ( lineNum >= currMovieData.records.size() )
if ( static_cast<size_t>(lineNum) >= currMovieData.records.size() )
{
break;
}

View File

@ -1657,7 +1657,7 @@ void QTraceLogView::calcTextSel(int x, int y)
selAddrValue = -1;
selAddrText[0] = 0;
if (x < lineText[y].size())
if ( static_cast<size_t>(x) < lineText[y].size())
{
int ax = x;

View File

@ -138,7 +138,7 @@ gwavi_t::write_chars(FILE *out, const char *s)
}
int
gwavi_t::write_chars_bin(FILE *out, const char *s, int count)
gwavi_t::write_chars_bin(FILE *out, const char *s, size_t count)
{
if (fwrite(s, 1, count, out) != count)
return -1;
@ -214,7 +214,7 @@ gwavi_t::read_short(FILE *in, int &n)
}
int
gwavi_t::read_chars_bin(FILE *in, char *s, int count)
gwavi_t::read_chars_bin(FILE *in, char *s, size_t count)
{
if (fread(s, 1, count, in) != count)
return -1;

View File

@ -297,7 +297,7 @@ class gwavi_t
int write_byte(FILE *fp, unsigned char n);
int write_short(FILE *fp, unsigned int n);
int write_chars(FILE *fp, const char *s);
int write_chars_bin(FILE *fp, const char *s, int count);
int write_chars_bin(FILE *fp, const char *s, size_t count);
int peak_chunk( FILE *fp, long int idx, char *fourcc, unsigned int *size );
int read_int(FILE *fp, int &n);
@ -305,7 +305,7 @@ class gwavi_t
int read_short(FILE *fp, int16_t &n);
int read_short(FILE *fp, int &n);
int read_ushort(FILE *fp, uint16_t &n);
int read_chars_bin(FILE *fp, char *s, int count);
int read_chars_bin(FILE *fp, char *s, size_t count);
unsigned int readList(int lvl);
unsigned int readChunk(const char *id, int lvl);
unsigned int readAviHeader(void);

View File

@ -303,7 +303,7 @@ FCEUD_RecvData(void *data,
size = recv(s_Socket, data, len, MSG_WAITALL);
#endif
if(size == len) {
if( static_cast<uint32>(size) == len) {
//unsigned long beefie;
FD_ZERO(&funfun);