From 12d791a6288704affa1627dd54fbf14bda77eb12 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Sun, 5 May 2013 23:22:57 -0500 Subject: [PATCH] Fix some of the compiler warnings that have appeared recently. --- Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.cpp | 5 ++--- Source/Core/Core/Src/State.cpp | 8 +++++--- Source/Core/Core/Src/State.h | 2 -- Source/Core/DolphinWX/Src/FrameTools.cpp | 4 ++-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.cpp b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.cpp index f7387154b2..e28d5a32ae 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.cpp +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.cpp @@ -66,9 +66,8 @@ void CUCode_AX::LoadResamplingCoefficients() WARN_LOG(DSPHLE, "Loading polyphase resampling coeffs from %s", filename.c_str()); - FILE* fp = fopen(filename.c_str(), "rb"); - fread(m_coeffs, 1, 0x1000, fp); - fclose(fp); + File::IOFile fp(filename, "rb"); + fp.ReadBytes(m_coeffs, 0x1000); for (u32 i = 0; i < 0x800; ++i) m_coeffs[i] = Common::swap16(m_coeffs[i]); diff --git a/Source/Core/Core/Src/State.cpp b/Source/Core/Core/Src/State.cpp index 09653ac9ad..40a48b4841 100644 --- a/Source/Core/Core/Src/State.cpp +++ b/Source/Core/Core/Src/State.cpp @@ -157,7 +157,7 @@ void VerifyBuffer(std::vector& buffer) // return state number not in map int GetEmptySlot(std::map m) { - for (int i = 1; i <= NUM_STATES; i++) + for (int i = 1; i <= (int)NUM_STATES; i++) { bool found = false; for (std::map::iterator it = m.begin(); it != m.end(); it++) @@ -173,12 +173,14 @@ int GetEmptySlot(std::map m) return -1; } +static std::string MakeStateFilename(int number); + // read state timestamps std::map GetSavedStates() { StateHeader header; std::map m; - for (int i = 1; i <= NUM_STATES; i++) + for (int i = 1; i <= (int)NUM_STATES; i++) { if (File::Exists(MakeStateFilename(i))) { @@ -570,7 +572,7 @@ void LoadLastSaved(int i) { std::map savedStates = GetSavedStates(); - if (i > savedStates.size()) + if (i > (int)savedStates.size()) Core::DisplayMessage("State doesn't exist", 2000); else { diff --git a/Source/Core/Core/Src/State.h b/Source/Core/Core/Src/State.h index 14e77bae5c..302e25d617 100644 --- a/Source/Core/Core/Src/State.h +++ b/Source/Core/Core/Src/State.h @@ -49,8 +49,6 @@ void SaveToBuffer(std::vector& buffer); void LoadFromBuffer(std::vector& buffer); void VerifyBuffer(std::vector& buffer); -static std::string MakeStateFilename(int number); - void LoadLastSaved(int i = 1); void SaveFirstSaved(); void UndoSaveState(); diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index e183669c86..c6d542bf85 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -159,14 +159,14 @@ void CFrame::CreateMenu() loadMenu->Append(IDM_UNDOLOADSTATE, GetMenuLabel(HK_UNDO_LOAD_STATE)); loadMenu->AppendSeparator(); - for (int i = 1; i <= State::NUM_STATES; i++) + for (unsigned int i = 1; i <= State::NUM_STATES; i++) { loadMenu->Append(IDM_LOADSLOT1 + i - 1, GetMenuLabel(HK_LOAD_STATE_SLOT_1 + i - 1)); saveMenu->Append(IDM_SAVESLOT1 + i - 1, GetMenuLabel(HK_SAVE_STATE_SLOT_1 + i - 1)); } loadMenu->AppendSeparator(); - for (int i = 1; i <= State::NUM_STATES; i++) + for (unsigned int i = 1; i <= State::NUM_STATES; i++) loadMenu->Append(IDM_LOADLAST1 + i - 1, GetMenuLabel(HK_LOAD_LAST_STATE_1 + i - 1)); m_MenuBar->Append(emulationMenu, _("&Emulation"));