diff --git a/src/boards/121.cpp b/src/boards/121.cpp index aa4e5c2c..b2cd06bf 100644 --- a/src/boards/121.cpp +++ b/src/boards/121.cpp @@ -48,7 +48,7 @@ static void M121CW(uint32 A, uint8 V) { if (PRGsize[0] == CHRsize[0]) { // A9713 multigame extension hack! setchr1(A, V | ((EXPREGS[3] & 0x80) << 1)); } else { - if ((A & 0x1000) == ((MMC3_cmd & 0x80) << 5)) + if ((A & 0x1000) == static_cast((MMC3_cmd & 0x80) << 5)) setchr1(A, V | 0x100); else setchr1(A, V); diff --git a/src/boards/187.cpp b/src/boards/187.cpp index 6e5baa2e..cb559bcd 100644 --- a/src/boards/187.cpp +++ b/src/boards/187.cpp @@ -22,7 +22,7 @@ #include "mmc3.h" static void M187CW(uint32 A, uint8 V) { - if ((A & 0x1000) == ((MMC3_cmd & 0x80) << 5)) + if ((A & 0x1000) == static_cast((MMC3_cmd & 0x80) << 5)) setchr1(A, V | 0x100); else setchr1(A, V); diff --git a/src/cheat.cpp b/src/cheat.cpp index 3752f068..7ac99376 100644 --- a/src/cheat.cpp +++ b/src/cheat.cpp @@ -644,7 +644,7 @@ int FCEUI_ToggleCheat(uint32 which) int FCEUI_GlobalToggleCheat(int global_enabled) { - int _numsubcheats = numsubcheats; + unsigned int _numsubcheats = numsubcheats; globalCheatDisabled = !global_enabled; RebuildSubCheats(); return _numsubcheats != numsubcheats; diff --git a/src/debug.cpp b/src/debug.cpp index b02a1513..dc0085e9 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -642,7 +642,8 @@ uint16 StackNextIgnorePC = 0xFFFF; ///fires a breakpoint static void breakpoint(uint8 *opcode, uint16 A, int size) { - int i, j, romAddrPC; + int i, romAddrPC; + unsigned int j; uint8 brk_type; uint8 stackop=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 & WP_X) && (watchpoint[i].address == romAddrPC) ) + if ( (watchpoint[i].flags & WP_X) && (watchpoint[i].address == static_cast(romAddrPC)) ) { BREAKHIT(i); } @@ -840,7 +841,7 @@ static void breakpoint(uint8 *opcode, uint16 A, int size) { // Pushes to stack if (watchpoint[i].flags & WP_W) { - for (j = (X.S|0x0100); j < (StackAddrBackup|0x0100); j++) + for (j = (X.S|0x0100); j < (static_cast(StackAddrBackup)|0x0100); j++) { if (watchpoint[i].endaddress) { diff --git a/src/drivers/Qt/TasEditor/greenzone.cpp b/src/drivers/Qt/TasEditor/greenzone.cpp index d211f400..3ccf6364 100644 --- a/src/drivers/Qt/TasEditor/greenzone.cpp +++ b/src/drivers/Qt/TasEditor/greenzone.cpp @@ -420,7 +420,7 @@ bool GREENZONE::load(EMUFILE *is, unsigned int offset) // read LagLog lagLog.load(is); // read size - if (read32le(&size, is) && size <= currMovieData.getNumRecords()) + if (read32le(&size, is) && size <= static_cast(currMovieData.getNumRecords())) { greenzoneSize = size; savestates.resize(greenzoneSize); diff --git a/src/fceu.cpp b/src/fceu.cpp index fb9726b4..edd5c389 100644 --- a/src/fceu.cpp +++ b/src/fceu.cpp @@ -744,7 +744,7 @@ void FCEUI_Emulate(uint8 **pXBuf, int32 **SoundBuf, int32 *SoundBufSize, int ski { EmulationPaused = EMULATIONPAUSED_FA; } - if (frameAdvance_Delay_count < frameAdvanceDelayScaled) + if ( static_cast(frameAdvance_Delay_count) < frameAdvanceDelayScaled) { frameAdvance_Delay_count++; } diff --git a/src/ines.cpp b/src/ines.cpp index 0a2c7c73..de4fd481 100644 --- a/src/ines.cpp +++ b/src/ines.cpp @@ -394,7 +394,7 @@ static void CheckHInfo(uint64 partialmd5) { int32 tofix = 0, x, mask; 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]; if (info.md5lower != partialmd5) continue; @@ -403,7 +403,7 @@ static void CheckHInfo(uint64 partialmd5) { if (!info.params) break; std::vector 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 parts = tokenize_str(toks[j], "="); MasterRomInfoParams[parts[0]] = parts[1]; } @@ -978,7 +978,7 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode) { 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) { mappername = bmap[mappertest].name; break; diff --git a/src/input.cpp b/src/input.cpp index 2b5d9abe..3659bd75 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -989,12 +989,12 @@ struct EMUCMDTABLE FCEUI_CommandTable[]= #define NUM_EMU_CMDS (sizeof(FCEUI_CommandTable)/sizeof(FCEUI_CommandTable[0])) -static int execcmd, i; +static int execcmd; void FCEUI_HandleEmuCommands(TestCommandState* testfn) { bool taseditor = FCEUMOV_Mode(MOVIEMODE_TASEDITOR); - for(i=0; i(GGaddr) == Caddr) && (GGval == static_cast(Cval)) && (GGcomp == Ccompare) && (Ctype == 1)) { // Already Added, so consider it a success lua_pushboolean(L, true); return 1; @@ -789,7 +789,7 @@ static int emu_delgamegenie(lua_State *L) { 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(GGaddr) == Caddr) && (GGval == static_cast(Cval)) && (GGcomp == Ccompare) && (Ctype == 1)) { // Delete cheat code if (FCEUI_DelCheat(i)) { lua_pushboolean(L, true); @@ -1997,7 +1997,7 @@ static int memory_getregister(lua_State *L) { const char* qualifiedRegisterName = luaL_checkstring(L,1); 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]; int cpuNameLen = strlen(ctrm.cpuName); @@ -2031,7 +2031,7 @@ static int memory_setregister(lua_State *L) const char* qualifiedRegisterName = luaL_checkstring(L,1); unsigned long value = (unsigned long)(luaL_checkinteger(L,2)); 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]; int cpuNameLen = strlen(ctrm.cpuName); @@ -2247,7 +2247,7 @@ static void CallRegisteredLuaMemHook_LuaMatch(unsigned int address, int size, un #endif lua_settop(L, 0); 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); 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; 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)) { *colour = s_colorMapping[i].value; return true; diff --git a/src/movie.cpp b/src/movie.cpp index 2fa47125..9df0ffc1 100644 --- a/src/movie.cpp +++ b/src/movie.cpp @@ -693,7 +693,7 @@ bool LoadFM2(MovieData& movieData, EMUFILE* fp, int size, bool stopAfterHeader) { LoadFM2_binarychunk(movieData, fp, size); return true; - } else if (isnewline && movieData.loadFrameCount == movieData.records.size()) + } else if (isnewline && static_cast(movieData.loadFrameCount) == movieData.records.size()) // exit prematurely if loaded the specified amound of records return true; switch(state) @@ -994,7 +994,7 @@ bool MovieData::loadSaveramFrom(std::vector* buf) return false; } - if(currCartInfo->SaveGameLen[i] != len) + if(currCartInfo->SaveGameLen[i] != static_cast(len)) { FCEU_PrintError("movie battery load mismatch 3"); 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 (currFrameCounter == currMovieData.records.size()-1) + if ( static_cast(currFrameCounter) == currMovieData.records.size()-1) { if(FCEUD_PauseAfterPlayback()) { diff --git a/src/movie.h b/src/movie.h index 531f1dc6..3be3d8c4 100644 --- a/src/movie.h +++ b/src/movie.h @@ -214,7 +214,7 @@ public: //whether microphone is enabled bool microphone; - int getNumRecords() { return (int)records.size(); } + int getNumRecords() { return static_cast( records.size() ); } int RAMInitOption, RAMInitSeed;