From c3839a53e56108ee576bb32e956aff747bdfe7c5 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 7 Sep 2013 22:31:22 -0700 Subject: [PATCH] Fix some minor warnings. --- Common/KeyMap.cpp | 12 ++++++------ Core/Config.cpp | 7 +++---- Core/HLE/sceDisplay.cpp | 2 +- Core/HLE/sceNetAdhoc.cpp | 6 +++--- Core/MIPS/x86/CompBranch.cpp | 4 ++-- GPU/GLES/TransformPipeline.cpp | 7 +------ GPU/Software/Lighting.cpp | 4 ++-- GPU/Software/Rasterizer.cpp | 10 ++++++++++ 8 files changed, 28 insertions(+), 24 deletions(-) diff --git a/Common/KeyMap.cpp b/Common/KeyMap.cpp index f875b1127a..7d067301fd 100644 --- a/Common/KeyMap.cpp +++ b/Common/KeyMap.cpp @@ -230,8 +230,8 @@ void UpdateConfirmCancelKeys() { }; // If they're not already bound, add them in. - for(int i = 0; i < ARRAY_SIZE(hardcodedConfirmKeys); i++) { - if(std::find(confirmKeys.begin(), confirmKeys.end(), hardcodedConfirmKeys[i]) == confirmKeys.end()) + for (size_t i = 0; i < ARRAY_SIZE(hardcodedConfirmKeys); i++) { + if (std::find(confirmKeys.begin(), confirmKeys.end(), hardcodedConfirmKeys[i]) == confirmKeys.end()) confirmKeys.push_back(hardcodedConfirmKeys[i]); } @@ -240,8 +240,8 @@ void UpdateConfirmCancelKeys() { NKCODE_BACK, }; - for(int i = 0; i < ARRAY_SIZE(hardcodedCancelKeys); i++) { - if(std::find(cancelKeys.begin(), cancelKeys.end(), hardcodedCancelKeys[i]) == cancelKeys.end()) + for (size_t i = 0; i < ARRAY_SIZE(hardcodedCancelKeys); i++) { + if (std::find(cancelKeys.begin(), cancelKeys.end(), hardcodedCancelKeys[i]) == cancelKeys.end()) cancelKeys.push_back(hardcodedCancelKeys[i]); } @@ -700,7 +700,7 @@ void LoadFromIni(IniFile &file) { } IniFile::Section *controls = file.GetOrCreateSection("ControlMapping"); - for (int i = 0; i < ARRAY_SIZE(psp_button_names); i++) { + for (size_t i = 0; i < ARRAY_SIZE(psp_button_names); i++) { std::string value; controls->Get(psp_button_names[i].name.c_str(), &value, ""); @@ -728,7 +728,7 @@ void LoadFromIni(IniFile &file) { void SaveToIni(IniFile &file) { IniFile::Section *controls = file.GetOrCreateSection("ControlMapping"); - for (int i = 0; i < ARRAY_SIZE(psp_button_names); i++) { + for (size_t i = 0; i < ARRAY_SIZE(psp_button_names); i++) { std::vector keys; KeyFromPspButton(psp_button_names[i].key, &keys); diff --git a/Core/Config.cpp b/Core/Config.cpp index 352238d289..9acb8480cd 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -278,13 +278,12 @@ void Config::Save() { IniFile::Section *recent = iniFile.GetOrCreateSection("Recent"); recent->Set("MaxRecent", iMaxRecent); - for (int i = 0; i < iMaxRecent; i++) { + for (int i = 0; i < iMaxRecent; i++) { char keyName[64]; sprintf(keyName,"FileName%d",i); - if (i < recentIsos.size()) { + if (i < (int)recentIsos.size()) { recent->Set(keyName, recentIsos[i]); - } - else { + } else { recent->Delete(keyName); // delete the nonexisting FileName } } diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index 4bcbee08eb..f66ca0b251 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -50,7 +50,7 @@ struct WaitVBlankInfo { WaitVBlankInfo(u32 tid) : threadID(tid), vcountUnblock(1) {} WaitVBlankInfo(u32 tid, int vcount) : threadID(tid), vcountUnblock(vcount) {} - u32 threadID; + SceUID threadID; // Number of vcounts to block for. int vcountUnblock; diff --git a/Core/HLE/sceNetAdhoc.cpp b/Core/HLE/sceNetAdhoc.cpp index 7686b874a0..370a235712 100644 --- a/Core/HLE/sceNetAdhoc.cpp +++ b/Core/HLE/sceNetAdhoc.cpp @@ -194,7 +194,7 @@ int sceNetAdhocSetSocketAlert(int id, int flag) { } int sceNetAdhocPollSocket(u32 socketStructAddr, int count, int timeout, int nonblock) { - ERROR_LOG(SCENET, "UNIMPL sceNetAdhocPollSocket(%08x, %i, %i, %i)", count, timeout, nonblock); + ERROR_LOG(SCENET, "UNIMPL sceNetAdhocPollSocket(%08x, %i, %i, %i)", socketStructAddr, count, timeout, nonblock); return -1; } @@ -345,7 +345,7 @@ int sceNetAdhocGetPtpStat(int structSize, u32 structAddr) { } int sceNetAdhocPtpOpen(const char *srcmac, int srcport, const char *dstmac, int dstport, int bufsize, int retryDelay, int retryCount, int unknown) { - ERROR_LOG(SCENET, "UNIMPL sceNetAdhocPtpOpen(%s : %i, %s : %i, %i, %i, %i)", srcmac, srcport, dstmac, dstport, bufsize, retryDelay, retryCount, unknown); + ERROR_LOG(SCENET, "UNIMPL sceNetAdhocPtpOpen(%s : %i, %s : %i, %i, %i, %i, %08x)", srcmac, srcport, dstmac, dstport, bufsize, retryDelay, retryCount, unknown); return 0; } @@ -444,7 +444,7 @@ int sceNetAdhocMatchingCreate(int mode, int maxPeers, int port, int bufSize, int } int sceNetAdhocMatchingStart(int matchingId, int evthPri, int evthStack, int inthPri, int inthStack, int optLen, u32 optDataAddr) { - ERROR_LOG(SCENET, "UNIMPL sceNetAdhocMatchingStart(%i, %i, %i, %i, %i, %i, %i, %i, %08x)", matchingId, evthPri, evthStack, inthPri, inthStack, optLen, optDataAddr); + ERROR_LOG(SCENET, "UNIMPL sceNetAdhocMatchingStart(%i, %i, %i, %i, %i, %i, %08x)", matchingId, evthPri, evthStack, inthPri, inthStack, optLen, optDataAddr); return -1; } diff --git a/Core/MIPS/x86/CompBranch.cpp b/Core/MIPS/x86/CompBranch.cpp index bd92beb4d6..1434a5954e 100644 --- a/Core/MIPS/x86/CompBranch.cpp +++ b/Core/MIPS/x86/CompBranch.cpp @@ -156,7 +156,7 @@ void Jit::BranchRSRTComp(MIPSOpcode op, Gen::CCFlags cc, bool likely) { case CC_E: skipBranch = rsImm == rtImm; break; case CC_NE: skipBranch = rsImm != rtImm; break; - default: _dbg_assert_msg_(JIT, false, "Bad cc flag in BranchRSRTComp()."); + default: skipBranch = false; _dbg_assert_msg_(JIT, false, "Bad cc flag in BranchRSRTComp()."); } if (skipBranch) @@ -256,7 +256,7 @@ void Jit::BranchRSZeroComp(MIPSOpcode op, Gen::CCFlags cc, bool andLink, bool li case CC_GE: skipBranch = imm >= 0; break; case CC_L: skipBranch = imm < 0; break; case CC_LE: skipBranch = imm <= 0; break; - default: _dbg_assert_msg_(JIT, false, "Bad cc flag in BranchRSZeroComp()."); + default: skipBranch = false; _dbg_assert_msg_(JIT, false, "Bad cc flag in BranchRSZeroComp()."); } if (skipBranch) diff --git a/GPU/GLES/TransformPipeline.cpp b/GPU/GLES/TransformPipeline.cpp index 3d399b3d26..2073ee4b4e 100644 --- a/GPU/GLES/TransformPipeline.cpp +++ b/GPU/GLES/TransformPipeline.cpp @@ -839,13 +839,8 @@ void TransformDrawEngine::SubmitPrim(void *verts, void *inds, GEPrimitiveType pr if (!indexGen.PrimCompatible(prevPrim_, prim) || numDrawCalls >= MAX_DEFERRED_DRAW_CALLS) Flush(); + // TODO: Is this the right thing to do? if (prim == GE_PRIM_KEEP_PREVIOUS) { - switch(prevPrim_) { - case GE_PRIM_LINE_STRIP: - case GE_PRIM_TRIANGLE_STRIP: - case GE_PRIM_TRIANGLE_FAN: - break; - } prim = prevPrim_; } prevPrim_ = prim; diff --git a/GPU/Software/Lighting.cpp b/GPU/Software/Lighting.cpp index a1dd12e8d7..b4ac37a8e8 100644 --- a/GPU/Software/Lighting.cpp +++ b/GPU/Software/Lighting.cpp @@ -39,10 +39,10 @@ void Process(VertexData& vertex) Vec3 L = Vec3(getFloat24(gstate.lpos[3*light]&0xFFFFFF), getFloat24(gstate.lpos[3*light+1]&0xFFFFFF),getFloat24(gstate.lpos[3*light+2]&0xFFFFFF)); float diffuse_factor = Dot(L,vertex.worldnormal) / L.Length() / vertex.worldnormal.Length(); - if (gstate.getUVLS0() == light) + if (gstate.getUVLS0() == (int)light) vertex.texturecoords.s() = (diffuse_factor + 1.f) / 2.f; - if (gstate.getUVLS1() == light) + if (gstate.getUVLS1() == (int)light) vertex.texturecoords.t() = (diffuse_factor + 1.f) / 2.f; } } diff --git a/GPU/Software/Rasterizer.cpp b/GPU/Software/Rasterizer.cpp index b31fbd29ca..5f354ced68 100644 --- a/GPU/Software/Rasterizer.cpp +++ b/GPU/Software/Rasterizer.cpp @@ -237,6 +237,9 @@ static inline u32 GetPixelColor(int x, int y) case GE_FORMAT_8888: return *(u32*)&fb[4*x + 4*y*gstate.FrameBufStride()]; + + case GE_FORMAT_INVALID: + _dbg_assert_msg_(G3D, false, "Software: invalid framebuf format."); } return 0; } @@ -259,6 +262,9 @@ static inline void SetPixelColor(int x, int y, u32 value) case GE_FORMAT_8888: *(u32*)&fb[4*x + 4*y*gstate.FrameBufStride()] = value; break; + + case GE_FORMAT_INVALID: + _dbg_assert_msg_(G3D, false, "Software: invalid framebuf format."); } } @@ -481,6 +487,10 @@ static inline bool ColorTestPassed(Vec3 color) case GE_COMP_NOTEQUAL: return c != ref; + + default: + ERROR_LOG_REPORT(G3D, "Software: Invalid colortest function: %d", gstate.getColorTestFunction()); + break; } return true; }