diff --git a/Source/Core/Core/Src/Boot/Boot_DOL.cpp b/Source/Core/Core/Src/Boot/Boot_DOL.cpp index bec0322f91..039001c3ea 100644 --- a/Source/Core/Core/Src/Boot/Boot_DOL.cpp +++ b/Source/Core/Core/Src/Boot/Boot_DOL.cpp @@ -34,7 +34,7 @@ CDolLoader::CDolLoader(const char* _szFilename) u8* tmpBuffer = new u8[(size_t)size]; FILE* pStream = fopen(_szFilename, "rb"); - fread(tmpBuffer, size, 1, pStream); + fread(tmpBuffer, size_t(size), 1, pStream); fclose(pStream); m_bInit = Initialize(tmpBuffer, (u32)size); diff --git a/Source/Core/DiscIO/Src/FileHandlerARC.cpp b/Source/Core/DiscIO/Src/FileHandlerARC.cpp index b87590de05..7c10f375f9 100644 --- a/Source/Core/DiscIO/Src/FileHandlerARC.cpp +++ b/Source/Core/DiscIO/Src/FileHandlerARC.cpp @@ -35,7 +35,7 @@ CARCFile::CARCFile(const std::string& _rFilename) if (pReader != NULL) { u64 FileSize = pReader->GetDataSize(); - m_pBuffer = new u8[FileSize]; + m_pBuffer = new u8[unsigned int(FileSize)]; pReader->Read(0, FileSize, m_pBuffer); delete pReader; diff --git a/Source/Core/DiscIO/Src/NANDContentLoader.cpp b/Source/Core/DiscIO/Src/NANDContentLoader.cpp index 6e7a9ed578..44045f5d6e 100644 --- a/Source/Core/DiscIO/Src/NANDContentLoader.cpp +++ b/Source/Core/DiscIO/Src/NANDContentLoader.cpp @@ -106,8 +106,8 @@ bool CNANDContentLoader::CreateFromDirectory(const std::string& _rPath) return false; } u64 Size = File::GetSize(TMDFileName.c_str()); - u8* pTMD = new u8[Size]; - fread(pTMD, Size, 1, pTMDFile); + u8* pTMD = new u8[unsigned int(Size)]; + fread(pTMD, size_t(Size), 1, pTMDFile); fclose(pTMDFile); ////// @@ -135,11 +135,11 @@ bool CNANDContentLoader::CreateFromDirectory(const std::string& _rPath) if (pFile != NULL) { u64 Size = File::GetSize(szFilename); - rContent.m_pData = new u8[Size]; + rContent.m_pData = new u8[unsigned int(Size)]; _dbg_assert_msg_(BOOT, rContent.m_Size==Size, "TMDLoader: Filesize doesnt fit (%s %i)", szFilename, i); - fread(rContent.m_pData, Size, 1, pFile); + fread(rContent.m_pData, size_t(Size), 1, pFile); fclose(pFile); } else { ERROR_LOG(DISCIO, "CreateFromDirectory: error opening %s", diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index 23a1d57aca..28fc58ac0a 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -581,7 +581,7 @@ static void WriteStage(char *&p, int n, u32 texture_mask) int texcoord = bpmem.tevorders[n/2].getTexCoord(n&1); int texfun = xfregs.texcoords[texcoord].texmtxinfo.projection; - bool bHasTexCoord = texcoord < bpmem.genMode.numtexgens; + bool bHasTexCoord = unsigned int(texcoord) < bpmem.genMode.numtexgens; bool bHasIndStage = bpmem.tevind[n].IsActive() && bpmem.tevind[n].bt < bpmem.genMode.numindstages; // HACK to handle cases where the tex gen is not enabled diff --git a/Source/Plugins/Plugin_Wiimote/Src/Config.cpp b/Source/Plugins/Plugin_Wiimote/Src/Config.cpp index 81bc22f121..fc931c86b0 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/Config.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/Config.cpp @@ -170,7 +170,7 @@ void Config::Load(bool ChangePad) /* Prevent a crash from illegal access to joyinfo that will only have values for the current amount of connected PadMapping */ - if(WiiMoteEmu::PadMapping[i].ID >= WiiMoteEmu::joyinfo.size()) continue; + if(unsigned int(WiiMoteEmu::PadMapping[i].ID) >= WiiMoteEmu::joyinfo.size()) continue; // Create a section name SectionName = WiiMoteEmu::joyinfo[WiiMoteEmu::PadMapping[i].ID].Name; @@ -313,7 +313,7 @@ void Config::Save(int Slot) /* Save joypad specific settings. Check for "PadMapping[i].ID < SDL_NumJoysticks()" to avoid reading a joyinfo that does't exist */ - if(WiiMoteEmu::PadMapping[i].ID >= WiiMoteEmu::joyinfo.size()) continue; + if(unsigned int(WiiMoteEmu::PadMapping[i].ID) >= WiiMoteEmu::joyinfo.size()) continue; // Create a new section name after the joypad name SectionName = WiiMoteEmu::joyinfo[WiiMoteEmu::PadMapping[i].ID].Name; diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp index 84f2c64fbb..0364a352c6 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp @@ -264,13 +264,13 @@ void LoadRecordedMovements() VRecording.at(i).IRBytes = TmpIRBytes; SRecording Tmp; - for (int j = 0, k = 0, l = 0; j < TmpMovement.length(); j+=13) + for (int j = 0, k = 0, l = 0; unsigned int(j) < TmpMovement.length(); j+=13) { // Skip blank savings if (TmpMovement.length() < 3) continue; // Avoid going to far, this can only happen with modified ini files, but we check for it anyway - if (TmpMovement.length() < j + 12) continue; + if (TmpMovement.length() < unsigned int(j + 12)) continue; // Skip old style recordings if (TmpMovement.substr(j, 1) != "-" && TmpMovement.substr(j, 1) != "+") continue; @@ -290,7 +290,7 @@ void LoadRecordedMovements() if (TmpIRBytes == 0) for(int i = 0; i < 12; i++) Tmp.IR[i] = 0; for(int ii = 0; ii < TmpIRBytes; ii++) { - if(TmpIR.length() < (k + i + TmpIRBytes)) continue; // Safety check + if(TmpIR.length() < unsigned int((k + i + TmpIRBytes))) continue; // Safety check std::string TmpStr = TmpIR.substr(k + ii*2, 2); u32 TmpU32; AsciiToHex(TmpStr.c_str(), TmpU32); @@ -526,7 +526,7 @@ void Shutdown(void) vector elements or any bad devices */ for (int i = 0; i < 1; i++) { - if (PadMapping[i].enabled && joyinfo.size() > PadMapping[i].ID) + if (PadMapping[i].enabled && joyinfo.size() > unsigned int(PadMapping[i].ID)) if (joyinfo.at(PadMapping[i].ID).Good) { Console::Print("ShutDown: %i\n", PadState[i].joy); @@ -731,7 +731,7 @@ void Update() || g_Config.Nunchuck.Type == g_Config.Nunchuck.ANALOG1 || g_Config.Nunchuck.Type == g_Config.Nunchuck.ANALOG2 || g_Config.ClassicController.LType == g_Config.ClassicController.ANALOG1 || g_Config.ClassicController.LType == g_Config.ClassicController.ANALOG2 || g_Config.ClassicController.RType == g_Config.ClassicController.ANALOG1 || g_Config.ClassicController.RType == g_Config.ClassicController.ANALOG2) - && NumGoodPads > 0 && joyinfo.size() > PadMapping[0].ID) + && NumGoodPads > 0 && joyinfo.size() > unsigned int(PadMapping[0].ID)) { const int Page = 0; WiiMoteEmu::GetJoyState(PadState[Page], PadMapping[Page], Page, joyinfo[PadMapping[Page].ID].NumButtons); diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuPad.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuPad.cpp index e95fd95593..54f4d9ff80 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuPad.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuPad.cpp @@ -65,7 +65,7 @@ bool Search_Devices(std::vector &_joyinfo, int &_N // Update the PadState[].joy handle for (int i = 0; i < 1; i++) { - if (PadMapping[i].enabled && joyinfo.size() > PadMapping[i].ID) + if (PadMapping[i].enabled && joyinfo.size() > unsigned int (PadMapping[i].ID)) if(joyinfo.at(PadMapping[i].ID).Good) PadState[i].joy = SDL_JoystickOpen(PadMapping[i].ID); } diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/Config.cpp b/Source/Plugins/Plugin_nJoy_SDL/Src/Config.cpp index ac7bc06c4a..ca033d5a0e 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/Config.cpp +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/Config.cpp @@ -141,7 +141,7 @@ void Config::Save(int Slot) { /* Save joypad specific settings. Check for "PadMapping[i].ID < SDL_NumJoysticks()" to avoid reading a joyinfo that does't exist */ - if(PadMapping[i].ID >= joyinfo.size()) continue; + if(unsigned int(PadMapping[i].ID) >= joyinfo.size()) continue; // Create a new section name after the joypad name SectionName = joyinfo[PadMapping[i].ID].Name; @@ -234,7 +234,7 @@ void Config::Load(bool ChangePad, bool ChangeSaveByID) { /* Prevent a crash from illegal access to joyinfo that will only have values for the current amount of connected pads */ - if(PadMapping[i].ID >= joyinfo.size()) continue; + if(unsigned int(PadMapping[i].ID) >= joyinfo.size()) continue; // Create a section name SectionName = joyinfo[PadMapping[i].ID].Name; diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigAdvanced.cpp b/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigAdvanced.cpp index d6da989723..ee64a7e99f 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigAdvanced.cpp +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigAdvanced.cpp @@ -256,7 +256,7 @@ void ConfigBox::Update() is not update when the emulator is paused. */ if (g_Config.bCheckFocus || IsFocus()) // && !g_EmulatorRunning) { - for (int i = 0; i < joyinfo.size(); i++) + for (int i = 0; unsigned int(i) < joyinfo.size(); i++) InputCommon::GetJoyState(PadState[i], PadMapping[i], i, joyinfo[PadMapping[i].ID].NumButtons); } diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.cpp b/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.cpp index 2e10179e18..fc050836c8 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.cpp +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.cpp @@ -386,7 +386,7 @@ void ConfigBox::SetButtonTextAll(int id, char text[128]) for (int i = 0; i < 4; i++) { // Safety check to avoid crash - if(joyinfo.size() > PadMapping[i].ID) + if(joyinfo.size() > unsigned int(PadMapping[i].ID)) if (joyinfo[PadMapping[i].ID].Name == joyinfo[PadMapping[notebookpage].ID].Name) SetButtonText(id, text, i); }; @@ -397,7 +397,7 @@ void ConfigBox::SaveButtonMappingAll(int Slot) for (int i = 0; i < 4; i++) { // This can occur when no gamepad is detected - if(joyinfo.size() > PadMapping[i].ID) + if(joyinfo.size() > unsigned int(PadMapping[i].ID)) if (joyinfo[PadMapping[i].ID].Name == joyinfo[PadMapping[Slot].ID].Name) SaveButtonMapping(i, false, Slot); } @@ -414,7 +414,7 @@ void ConfigBox::UpdateGUIAll(int Slot) for (int i = 0; i < 4; i++) { // Safety check to avoid crash - if(joyinfo.size() > PadMapping[i].ID) + if(joyinfo.size() > unsigned int(PadMapping[i].ID)) if (joyinfo[PadMapping[i].ID].Name == joyinfo[PadMapping[Slot].ID].Name) UpdateGUI(i); } @@ -660,7 +660,7 @@ void ConfigBox::CreateGUIControls() wxArrayString arrayStringFor_Joyname; // The string array if(NumGoodPads > 0) { - for(int x = 0; x < joyinfo.size(); x++) + for(int x = 0; unsigned int(x) < joyinfo.size(); x++) { arrayStringFor_Joyname.Add(wxString::FromAscii(joyinfo[x].Name.c_str())); } diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp index f9bdaa08a6..3d82eee97b 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp @@ -304,7 +304,7 @@ void Shutdown() vector elements or any bad devices */ for (int i = 0; i < 4; i++) { - if (PadMapping[i].enabled && joyinfo.size() > PadMapping[i].ID) + if (PadMapping[i].enabled && joyinfo.size() > unsigned int(PadMapping[i].ID)) if (joyinfo.at(PadMapping[i].ID).Good) if(SDL_JoystickOpened(PadMapping[i].ID)) { @@ -610,7 +610,7 @@ bool Search_Devices(std::vector &_joyinfo, int &_N // Update the PadState[].joy handle for (int i = 0; i < 4; i++) { - if (PadMapping[i].enabled && joyinfo.size() > PadMapping[i].ID) + if (PadMapping[i].enabled && joyinfo.size() > unsigned int(PadMapping[i].ID)) if(joyinfo.at(PadMapping[i].ID).Good) PadState[i].joy = SDL_JoystickOpen(PadMapping[i].ID); }