Skip to content

Commit 7c3c3ca

Browse files
committed
More int comparison sign mismatch compiler warning fixes.
1 parent 213f4e2 commit 7c3c3ca

File tree

11 files changed

+25
-24
lines changed

11 files changed

+25
-24
lines changed

src/boards/121.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static void M121CW(uint32 A, uint8 V) {
4848
if (PRGsize[0] == CHRsize[0]) { // A9713 multigame extension hack!
4949
setchr1(A, V | ((EXPREGS[3] & 0x80) << 1));
5050
} else {
51-
if ((A & 0x1000) == ((MMC3_cmd & 0x80) << 5))
51+
if ((A & 0x1000) == static_cast<uint32>((MMC3_cmd & 0x80) << 5))
5252
setchr1(A, V | 0x100);
5353
else
5454
setchr1(A, V);

src/boards/187.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include "mmc3.h"
2323

2424
static void M187CW(uint32 A, uint8 V) {
25-
if ((A & 0x1000) == ((MMC3_cmd & 0x80) << 5))
25+
if ((A & 0x1000) == static_cast<uint32>((MMC3_cmd & 0x80) << 5))
2626
setchr1(A, V | 0x100);
2727
else
2828
setchr1(A, V);

src/cheat.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ int FCEUI_ToggleCheat(uint32 which)
644644

645645
int FCEUI_GlobalToggleCheat(int global_enabled)
646646
{
647-
int _numsubcheats = numsubcheats;
647+
unsigned int _numsubcheats = numsubcheats;
648648
globalCheatDisabled = !global_enabled;
649649
RebuildSubCheats();
650650
return _numsubcheats != numsubcheats;

src/debug.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,8 @@ uint16 StackNextIgnorePC = 0xFFFF;
642642

643643
///fires a breakpoint
644644
static void breakpoint(uint8 *opcode, uint16 A, int size) {
645-
int i, j, romAddrPC;
645+
int i, romAddrPC;
646+
unsigned int j;
646647
uint8 brk_type;
647648
uint8 stackop=0;
648649
uint8 stackopstartaddr=0,stackopendaddr=0;
@@ -783,7 +784,7 @@ static void breakpoint(uint8 *opcode, uint16 A, int size) {
783784
{
784785
if (watchpoint[i].flags & BT_R)
785786
{
786-
if ( (watchpoint[i].flags & WP_X) && (watchpoint[i].address == romAddrPC) )
787+
if ( (watchpoint[i].flags & WP_X) && (watchpoint[i].address == static_cast<unsigned int>(romAddrPC)) )
787788
{
788789
BREAKHIT(i);
789790
}
@@ -840,7 +841,7 @@ static void breakpoint(uint8 *opcode, uint16 A, int size) {
840841
// Pushes to stack
841842
if (watchpoint[i].flags & WP_W)
842843
{
843-
for (j = (X.S|0x0100); j < (StackAddrBackup|0x0100); j++)
844+
for (j = (X.S|0x0100); j < (static_cast<unsigned int>(StackAddrBackup)|0x0100); j++)
844845
{
845846
if (watchpoint[i].endaddress)
846847
{

src/drivers/Qt/TasEditor/greenzone.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ bool GREENZONE::load(EMUFILE *is, unsigned int offset)
420420
// read LagLog
421421
lagLog.load(is);
422422
// read size
423-
if (read32le(&size, is) && size <= currMovieData.getNumRecords())
423+
if (read32le(&size, is) && size <= static_cast<unsigned int>(currMovieData.getNumRecords()))
424424
{
425425
greenzoneSize = size;
426426
savestates.resize(greenzoneSize);

src/fceu.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ void FCEUI_Emulate(uint8 **pXBuf, int32 **SoundBuf, int32 *SoundBufSize, int ski
744744
{
745745
EmulationPaused = EMULATIONPAUSED_FA;
746746
}
747-
if (frameAdvance_Delay_count < frameAdvanceDelayScaled)
747+
if ( static_cast<unsigned int>(frameAdvance_Delay_count) < frameAdvanceDelayScaled)
748748
{
749749
frameAdvance_Delay_count++;
750750
}

src/ines.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ static void CheckHInfo(uint64 partialmd5) {
394394
int32 tofix = 0, x, mask;
395395

396396
MasterRomInfo = NULL;
397-
for (int i = 0; i < ARRAY_SIZE(sMasterRomInfo); i++) {
397+
for (size_t i = 0; i < ARRAY_SIZE(sMasterRomInfo); i++) {
398398
const TMasterRomInfo& info = sMasterRomInfo[i];
399399
if (info.md5lower != partialmd5)
400400
continue;
@@ -403,7 +403,7 @@ static void CheckHInfo(uint64 partialmd5) {
403403
if (!info.params) break;
404404

405405
std::vector<std::string> toks = tokenize_str(info.params, ",");
406-
for (int j = 0; j < (int)toks.size(); j++) {
406+
for (size_t j = 0; j < toks.size(); j++) {
407407
std::vector<std::string> parts = tokenize_str(toks[j], "=");
408408
MasterRomInfoParams[parts[0]] = parts[1];
409409
}
@@ -978,7 +978,7 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode) {
978978
FCEU_printf("\n");
979979
}
980980

981-
for (int mappertest = 0; mappertest < (sizeof bmap / sizeof bmap[0]) - 1; mappertest++) {
981+
for (size_t mappertest = 0; mappertest < (sizeof bmap / sizeof bmap[0]) - 1; mappertest++) {
982982
if (bmap[mappertest].number == MapperNo) {
983983
mappername = bmap[mappertest].name;
984984
break;

src/input.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -989,12 +989,12 @@ struct EMUCMDTABLE FCEUI_CommandTable[]=
989989

990990
#define NUM_EMU_CMDS (sizeof(FCEUI_CommandTable)/sizeof(FCEUI_CommandTable[0]))
991991

992-
static int execcmd, i;
992+
static int execcmd;
993993

994994
void FCEUI_HandleEmuCommands(TestCommandState* testfn)
995995
{
996996
bool taseditor = FCEUMOV_Mode(MOVIEMODE_TASEDITOR);
997-
for(i=0; i<NUM_EMU_CMDS; ++i)
997+
for(size_t i=0; i<NUM_EMU_CMDS; ++i)
998998
{
999999
int new_state;
10001000
int old_state = FCEUI_CommandTable[i].state;
@@ -1418,7 +1418,7 @@ static void TaseditorCommand(void)
14181418
**/
14191419
EMUCMDTABLE* GetEmuCommandById(int cmd)
14201420
{
1421-
for (i = 0; i<NUM_EMU_CMDS; ++i)
1421+
for (size_t i = 0; i<NUM_EMU_CMDS; ++i)
14221422
{
14231423
if (FCEUI_CommandTable[i].cmd == cmd)
14241424
return &FCEUI_CommandTable[i];

src/lua-engine.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ static int emu_addgamegenie(lua_State *L) {
746746

747747
while (FCEUI_GetCheat(i,NULL,&Caddr,&Cval,&Ccompare,NULL,&Ctype)) {
748748

749-
if ((GGaddr == Caddr) && (GGval == Cval) && (GGcomp == Ccompare) && (Ctype == 1)) {
749+
if ((static_cast<uint32>(GGaddr) == Caddr) && (GGval == static_cast<int>(Cval)) && (GGcomp == Ccompare) && (Ctype == 1)) {
750750
// Already Added, so consider it a success
751751
lua_pushboolean(L, true);
752752
return 1;
@@ -789,7 +789,7 @@ static int emu_delgamegenie(lua_State *L) {
789789

790790
while (FCEUI_GetCheat(i,&Cname,&Caddr,&Cval,&Ccompare,NULL,&Ctype)) {
791791

792-
if ((Cname == msg) && (GGaddr == Caddr) && (GGval == Cval) && (GGcomp == Ccompare) && (Ctype == 1)) {
792+
if ((Cname == msg) && (static_cast<uint32>(GGaddr) == Caddr) && (GGval == static_cast<int>(Cval)) && (GGcomp == Ccompare) && (Ctype == 1)) {
793793
// Delete cheat code
794794
if (FCEUI_DelCheat(i)) {
795795
lua_pushboolean(L, true);
@@ -1997,7 +1997,7 @@ static int memory_getregister(lua_State *L)
19971997
{
19981998
const char* qualifiedRegisterName = luaL_checkstring(L,1);
19991999
lua_settop(L,0);
2000-
for(int cpu = 0; cpu < sizeof(cpuToRegisterMaps)/sizeof(*cpuToRegisterMaps); cpu++)
2000+
for(size_t cpu = 0; cpu < sizeof(cpuToRegisterMaps)/sizeof(*cpuToRegisterMaps); cpu++)
20012001
{
20022002
cpuToRegisterMap ctrm = cpuToRegisterMaps[cpu];
20032003
int cpuNameLen = strlen(ctrm.cpuName);
@@ -2031,7 +2031,7 @@ static int memory_setregister(lua_State *L)
20312031
const char* qualifiedRegisterName = luaL_checkstring(L,1);
20322032
unsigned long value = (unsigned long)(luaL_checkinteger(L,2));
20332033
lua_settop(L,0);
2034-
for(int cpu = 0; cpu < sizeof(cpuToRegisterMaps)/sizeof(*cpuToRegisterMaps); cpu++)
2034+
for(size_t cpu = 0; cpu < sizeof(cpuToRegisterMaps)/sizeof(*cpuToRegisterMaps); cpu++)
20352035
{
20362036
cpuToRegisterMap ctrm = cpuToRegisterMaps[cpu];
20372037
int cpuNameLen = strlen(ctrm.cpuName);
@@ -2247,7 +2247,7 @@ static void CallRegisteredLuaMemHook_LuaMatch(unsigned int address, int size, un
22472247
#endif
22482248
lua_settop(L, 0);
22492249
lua_getfield(L, LUA_REGISTRYINDEX, luaMemHookTypeStrings[hookType]);
2250-
for(int i = address; i != address+size; i++)
2250+
for(unsigned int i = address; i != address+size; i++)
22512251
{
22522252
lua_rawgeti(L, -1, i);
22532253
if (lua_isfunction(L, -1))
@@ -3854,7 +3854,7 @@ static inline bool str2colour(uint32 *colour, lua_State *L, const char *str) {
38543854
*colour = ((rand()*255/RAND_MAX) << 8) | ((rand()*255/RAND_MAX) << 16) | ((rand()*255/RAND_MAX) << 24) | 0xFF;
38553855
return true;
38563856
}
3857-
for(int i = 0; i < sizeof(s_colorMapping)/sizeof(*s_colorMapping); i++) {
3857+
for(size_t i = 0; i < sizeof(s_colorMapping)/sizeof(*s_colorMapping); i++) {
38583858
if(!stricmp(str,s_colorMapping[i].name)) {
38593859
*colour = s_colorMapping[i].value;
38603860
return true;

src/movie.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ bool LoadFM2(MovieData& movieData, EMUFILE* fp, int size, bool stopAfterHeader)
693693
{
694694
LoadFM2_binarychunk(movieData, fp, size);
695695
return true;
696-
} else if (isnewline && movieData.loadFrameCount == movieData.records.size())
696+
} else if (isnewline && static_cast<size_t>(movieData.loadFrameCount) == movieData.records.size())
697697
// exit prematurely if loaded the specified amound of records
698698
return true;
699699
switch(state)
@@ -994,7 +994,7 @@ bool MovieData::loadSaveramFrom(std::vector<uint8>* buf)
994994
return false;
995995
}
996996

997-
if(currCartInfo->SaveGameLen[i] != len)
997+
if(currCartInfo->SaveGameLen[i] != static_cast<unsigned int>(len))
998998
{
999999
FCEU_PrintError("movie battery load mismatch 3");
10001000
return false;
@@ -1267,7 +1267,7 @@ void FCEUMOV_AddInputState()
12671267
}
12681268

12691269
//if we are on the last frame, then pause the emulator if the player requested it
1270-
if (currFrameCounter == currMovieData.records.size()-1)
1270+
if ( static_cast<size_t>(currFrameCounter) == currMovieData.records.size()-1)
12711271
{
12721272
if(FCEUD_PauseAfterPlayback())
12731273
{

src/movie.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ class MovieData
214214
//whether microphone is enabled
215215
bool microphone;
216216

217-
int getNumRecords() { return (int)records.size(); }
217+
int getNumRecords() { return static_cast<int>( records.size() ); }
218218

219219
int RAMInitOption, RAMInitSeed;
220220

0 commit comments

Comments
 (0)