More int comparison sign mismatch compiler warning fixes.

This commit is contained in:
harry 2023-01-28 20:24:17 -05:00
parent 213f4e2579
commit 7c3c3caf93
11 changed files with 25 additions and 24 deletions

View File

@ -48,7 +48,7 @@ static void M121CW(uint32 A, uint8 V) {
if (PRGsize[0] == CHRsize[0]) { // A9713 multigame extension hack! if (PRGsize[0] == CHRsize[0]) { // A9713 multigame extension hack!
setchr1(A, V | ((EXPREGS[3] & 0x80) << 1)); setchr1(A, V | ((EXPREGS[3] & 0x80) << 1));
} else { } else {
if ((A & 0x1000) == ((MMC3_cmd & 0x80) << 5)) if ((A & 0x1000) == static_cast<uint32>((MMC3_cmd & 0x80) << 5))
setchr1(A, V | 0x100); setchr1(A, V | 0x100);
else else
setchr1(A, V); setchr1(A, V);

View File

@ -22,7 +22,7 @@
#include "mmc3.h" #include "mmc3.h"
static void M187CW(uint32 A, uint8 V) { static void M187CW(uint32 A, uint8 V) {
if ((A & 0x1000) == ((MMC3_cmd & 0x80) << 5)) if ((A & 0x1000) == static_cast<uint32>((MMC3_cmd & 0x80) << 5))
setchr1(A, V | 0x100); setchr1(A, V | 0x100);
else else
setchr1(A, V); setchr1(A, V);

View File

@ -644,7 +644,7 @@ int FCEUI_ToggleCheat(uint32 which)
int FCEUI_GlobalToggleCheat(int global_enabled) int FCEUI_GlobalToggleCheat(int global_enabled)
{ {
int _numsubcheats = numsubcheats; unsigned int _numsubcheats = numsubcheats;
globalCheatDisabled = !global_enabled; globalCheatDisabled = !global_enabled;
RebuildSubCheats(); RebuildSubCheats();
return _numsubcheats != numsubcheats; return _numsubcheats != numsubcheats;

View File

@ -642,7 +642,8 @@ uint16 StackNextIgnorePC = 0xFFFF;
///fires a breakpoint ///fires a breakpoint
static void breakpoint(uint8 *opcode, uint16 A, int size) { static void breakpoint(uint8 *opcode, uint16 A, int size) {
int i, j, romAddrPC; int i, romAddrPC;
unsigned int j;
uint8 brk_type; uint8 brk_type;
uint8 stackop=0; uint8 stackop=0;
uint8 stackopstartaddr=0,stackopendaddr=0; uint8 stackopstartaddr=0,stackopendaddr=0;
@ -783,7 +784,7 @@ static void breakpoint(uint8 *opcode, uint16 A, int size) {
{ {
if (watchpoint[i].flags & BT_R) if (watchpoint[i].flags & BT_R)
{ {
if ( (watchpoint[i].flags & WP_X) && (watchpoint[i].address == romAddrPC) ) if ( (watchpoint[i].flags & WP_X) && (watchpoint[i].address == static_cast<unsigned int>(romAddrPC)) )
{ {
BREAKHIT(i); BREAKHIT(i);
} }
@ -840,7 +841,7 @@ static void breakpoint(uint8 *opcode, uint16 A, int size) {
// Pushes to stack // Pushes to stack
if (watchpoint[i].flags & WP_W) if (watchpoint[i].flags & WP_W)
{ {
for (j = (X.S|0x0100); j < (StackAddrBackup|0x0100); j++) for (j = (X.S|0x0100); j < (static_cast<unsigned int>(StackAddrBackup)|0x0100); j++)
{ {
if (watchpoint[i].endaddress) if (watchpoint[i].endaddress)
{ {

View File

@ -420,7 +420,7 @@ bool GREENZONE::load(EMUFILE *is, unsigned int offset)
// read LagLog // read LagLog
lagLog.load(is); lagLog.load(is);
// read size // read size
if (read32le(&size, is) && size <= currMovieData.getNumRecords()) if (read32le(&size, is) && size <= static_cast<unsigned int>(currMovieData.getNumRecords()))
{ {
greenzoneSize = size; greenzoneSize = size;
savestates.resize(greenzoneSize); savestates.resize(greenzoneSize);

View File

@ -744,7 +744,7 @@ void FCEUI_Emulate(uint8 **pXBuf, int32 **SoundBuf, int32 *SoundBufSize, int ski
{ {
EmulationPaused = EMULATIONPAUSED_FA; EmulationPaused = EMULATIONPAUSED_FA;
} }
if (frameAdvance_Delay_count < frameAdvanceDelayScaled) if ( static_cast<unsigned int>(frameAdvance_Delay_count) < frameAdvanceDelayScaled)
{ {
frameAdvance_Delay_count++; frameAdvance_Delay_count++;
} }

View File

@ -394,7 +394,7 @@ static void CheckHInfo(uint64 partialmd5) {
int32 tofix = 0, x, mask; int32 tofix = 0, x, mask;
MasterRomInfo = NULL; MasterRomInfo = NULL;
for (int i = 0; i < ARRAY_SIZE(sMasterRomInfo); i++) { for (size_t i = 0; i < ARRAY_SIZE(sMasterRomInfo); i++) {
const TMasterRomInfo& info = sMasterRomInfo[i]; const TMasterRomInfo& info = sMasterRomInfo[i];
if (info.md5lower != partialmd5) if (info.md5lower != partialmd5)
continue; continue;
@ -403,7 +403,7 @@ static void CheckHInfo(uint64 partialmd5) {
if (!info.params) break; if (!info.params) break;
std::vector<std::string> toks = tokenize_str(info.params, ","); std::vector<std::string> toks = tokenize_str(info.params, ",");
for (int j = 0; j < (int)toks.size(); j++) { for (size_t j = 0; j < toks.size(); j++) {
std::vector<std::string> parts = tokenize_str(toks[j], "="); std::vector<std::string> parts = tokenize_str(toks[j], "=");
MasterRomInfoParams[parts[0]] = parts[1]; MasterRomInfoParams[parts[0]] = parts[1];
} }
@ -978,7 +978,7 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode) {
FCEU_printf("\n"); FCEU_printf("\n");
} }
for (int mappertest = 0; mappertest < (sizeof bmap / sizeof bmap[0]) - 1; mappertest++) { for (size_t mappertest = 0; mappertest < (sizeof bmap / sizeof bmap[0]) - 1; mappertest++) {
if (bmap[mappertest].number == MapperNo) { if (bmap[mappertest].number == MapperNo) {
mappername = bmap[mappertest].name; mappername = bmap[mappertest].name;
break; break;

View File

@ -989,12 +989,12 @@ struct EMUCMDTABLE FCEUI_CommandTable[]=
#define NUM_EMU_CMDS (sizeof(FCEUI_CommandTable)/sizeof(FCEUI_CommandTable[0])) #define NUM_EMU_CMDS (sizeof(FCEUI_CommandTable)/sizeof(FCEUI_CommandTable[0]))
static int execcmd, i; static int execcmd;
void FCEUI_HandleEmuCommands(TestCommandState* testfn) void FCEUI_HandleEmuCommands(TestCommandState* testfn)
{ {
bool taseditor = FCEUMOV_Mode(MOVIEMODE_TASEDITOR); bool taseditor = FCEUMOV_Mode(MOVIEMODE_TASEDITOR);
for(i=0; i<NUM_EMU_CMDS; ++i) for(size_t i=0; i<NUM_EMU_CMDS; ++i)
{ {
int new_state; int new_state;
int old_state = FCEUI_CommandTable[i].state; int old_state = FCEUI_CommandTable[i].state;
@ -1418,7 +1418,7 @@ static void TaseditorCommand(void)
**/ **/
EMUCMDTABLE* GetEmuCommandById(int cmd) EMUCMDTABLE* GetEmuCommandById(int cmd)
{ {
for (i = 0; i<NUM_EMU_CMDS; ++i) for (size_t i = 0; i<NUM_EMU_CMDS; ++i)
{ {
if (FCEUI_CommandTable[i].cmd == cmd) if (FCEUI_CommandTable[i].cmd == cmd)
return &FCEUI_CommandTable[i]; return &FCEUI_CommandTable[i];

View File

@ -746,7 +746,7 @@ static int emu_addgamegenie(lua_State *L) {
while (FCEUI_GetCheat(i,NULL,&Caddr,&Cval,&Ccompare,NULL,&Ctype)) { while (FCEUI_GetCheat(i,NULL,&Caddr,&Cval,&Ccompare,NULL,&Ctype)) {
if ((GGaddr == Caddr) && (GGval == Cval) && (GGcomp == Ccompare) && (Ctype == 1)) { if ((static_cast<uint32>(GGaddr) == Caddr) && (GGval == static_cast<int>(Cval)) && (GGcomp == Ccompare) && (Ctype == 1)) {
// Already Added, so consider it a success // Already Added, so consider it a success
lua_pushboolean(L, true); lua_pushboolean(L, true);
return 1; return 1;
@ -789,7 +789,7 @@ static int emu_delgamegenie(lua_State *L) {
while (FCEUI_GetCheat(i,&Cname,&Caddr,&Cval,&Ccompare,NULL,&Ctype)) { while (FCEUI_GetCheat(i,&Cname,&Caddr,&Cval,&Ccompare,NULL,&Ctype)) {
if ((Cname == msg) && (GGaddr == Caddr) && (GGval == Cval) && (GGcomp == Ccompare) && (Ctype == 1)) { if ((Cname == msg) && (static_cast<uint32>(GGaddr) == Caddr) && (GGval == static_cast<int>(Cval)) && (GGcomp == Ccompare) && (Ctype == 1)) {
// Delete cheat code // Delete cheat code
if (FCEUI_DelCheat(i)) { if (FCEUI_DelCheat(i)) {
lua_pushboolean(L, true); lua_pushboolean(L, true);
@ -1997,7 +1997,7 @@ static int memory_getregister(lua_State *L)
{ {
const char* qualifiedRegisterName = luaL_checkstring(L,1); const char* qualifiedRegisterName = luaL_checkstring(L,1);
lua_settop(L,0); lua_settop(L,0);
for(int cpu = 0; cpu < sizeof(cpuToRegisterMaps)/sizeof(*cpuToRegisterMaps); cpu++) for(size_t cpu = 0; cpu < sizeof(cpuToRegisterMaps)/sizeof(*cpuToRegisterMaps); cpu++)
{ {
cpuToRegisterMap ctrm = cpuToRegisterMaps[cpu]; cpuToRegisterMap ctrm = cpuToRegisterMaps[cpu];
int cpuNameLen = strlen(ctrm.cpuName); int cpuNameLen = strlen(ctrm.cpuName);
@ -2031,7 +2031,7 @@ static int memory_setregister(lua_State *L)
const char* qualifiedRegisterName = luaL_checkstring(L,1); const char* qualifiedRegisterName = luaL_checkstring(L,1);
unsigned long value = (unsigned long)(luaL_checkinteger(L,2)); unsigned long value = (unsigned long)(luaL_checkinteger(L,2));
lua_settop(L,0); lua_settop(L,0);
for(int cpu = 0; cpu < sizeof(cpuToRegisterMaps)/sizeof(*cpuToRegisterMaps); cpu++) for(size_t cpu = 0; cpu < sizeof(cpuToRegisterMaps)/sizeof(*cpuToRegisterMaps); cpu++)
{ {
cpuToRegisterMap ctrm = cpuToRegisterMaps[cpu]; cpuToRegisterMap ctrm = cpuToRegisterMaps[cpu];
int cpuNameLen = strlen(ctrm.cpuName); int cpuNameLen = strlen(ctrm.cpuName);
@ -2247,7 +2247,7 @@ static void CallRegisteredLuaMemHook_LuaMatch(unsigned int address, int size, un
#endif #endif
lua_settop(L, 0); lua_settop(L, 0);
lua_getfield(L, LUA_REGISTRYINDEX, luaMemHookTypeStrings[hookType]); lua_getfield(L, LUA_REGISTRYINDEX, luaMemHookTypeStrings[hookType]);
for(int i = address; i != address+size; i++) for(unsigned int i = address; i != address+size; i++)
{ {
lua_rawgeti(L, -1, i); lua_rawgeti(L, -1, i);
if (lua_isfunction(L, -1)) if (lua_isfunction(L, -1))
@ -3854,7 +3854,7 @@ static inline bool str2colour(uint32 *colour, lua_State *L, const char *str) {
*colour = ((rand()*255/RAND_MAX) << 8) | ((rand()*255/RAND_MAX) << 16) | ((rand()*255/RAND_MAX) << 24) | 0xFF; *colour = ((rand()*255/RAND_MAX) << 8) | ((rand()*255/RAND_MAX) << 16) | ((rand()*255/RAND_MAX) << 24) | 0xFF;
return true; return true;
} }
for(int i = 0; i < sizeof(s_colorMapping)/sizeof(*s_colorMapping); i++) { for(size_t i = 0; i < sizeof(s_colorMapping)/sizeof(*s_colorMapping); i++) {
if(!stricmp(str,s_colorMapping[i].name)) { if(!stricmp(str,s_colorMapping[i].name)) {
*colour = s_colorMapping[i].value; *colour = s_colorMapping[i].value;
return true; return true;

View File

@ -693,7 +693,7 @@ bool LoadFM2(MovieData& movieData, EMUFILE* fp, int size, bool stopAfterHeader)
{ {
LoadFM2_binarychunk(movieData, fp, size); LoadFM2_binarychunk(movieData, fp, size);
return true; return true;
} else if (isnewline && movieData.loadFrameCount == movieData.records.size()) } else if (isnewline && static_cast<size_t>(movieData.loadFrameCount) == movieData.records.size())
// exit prematurely if loaded the specified amound of records // exit prematurely if loaded the specified amound of records
return true; return true;
switch(state) switch(state)
@ -994,7 +994,7 @@ bool MovieData::loadSaveramFrom(std::vector<uint8>* buf)
return false; return false;
} }
if(currCartInfo->SaveGameLen[i] != len) if(currCartInfo->SaveGameLen[i] != static_cast<unsigned int>(len))
{ {
FCEU_PrintError("movie battery load mismatch 3"); FCEU_PrintError("movie battery load mismatch 3");
return false; return false;
@ -1267,7 +1267,7 @@ void FCEUMOV_AddInputState()
} }
//if we are on the last frame, then pause the emulator if the player requested it //if we are on the last frame, then pause the emulator if the player requested it
if (currFrameCounter == currMovieData.records.size()-1) if ( static_cast<size_t>(currFrameCounter) == currMovieData.records.size()-1)
{ {
if(FCEUD_PauseAfterPlayback()) if(FCEUD_PauseAfterPlayback())
{ {

View File

@ -214,7 +214,7 @@ public:
//whether microphone is enabled //whether microphone is enabled
bool microphone; bool microphone;
int getNumRecords() { return (int)records.size(); } int getNumRecords() { return static_cast<int>( records.size() ); }
int RAMInitOption, RAMInitSeed; int RAMInitOption, RAMInitSeed;