From fd546ff21d08c228e33ee30243caeb3534c0cb59 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 5 Aug 2016 10:47:45 -0700 Subject: [PATCH] Fix some type comparison warnings. --- Core/HLE/sceNetAdhoc.cpp | 2 +- Core/HLE/scePsmf.cpp | 2 +- Core/MIPS/IR/IRInterpreter.cpp | 2 +- UI/CwCheatScreen.cpp | 2 +- ext/native/file/chunk_file.cpp | 2 +- ext/native/gfx_es2/draw_buffer.cpp | 2 +- ext/native/net/sinks.cpp | 6 +++--- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Core/HLE/sceNetAdhoc.cpp b/Core/HLE/sceNetAdhoc.cpp index 5c7c5c55d4..b18e81c208 100644 --- a/Core/HLE/sceNetAdhoc.cpp +++ b/Core/HLE/sceNetAdhoc.cpp @@ -712,7 +712,7 @@ int sceNetAdhocPollSocket(u32 socketStructAddr, int count, int timeout, int nonb if (timeout == 0) timeout = 1; int affectedsockets = 0; - if (count > FD_SETSIZE) count = FD_SETSIZE; // return affectedsockets; + if (count > (int)FD_SETSIZE) count = FD_SETSIZE; // return affectedsockets; // Acquire Network Lock //acquireNetworkLock(); diff --git a/Core/HLE/scePsmf.cpp b/Core/HLE/scePsmf.cpp index 45945a4357..9b3796701c 100644 --- a/Core/HLE/scePsmf.cpp +++ b/Core/HLE/scePsmf.cpp @@ -834,7 +834,7 @@ static u32 scePsmfGetCurrentStreamType(u32 psmfStruct, u32 typeAddr, u32 channel if (!psmf) { return hleLogError(ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf"); } - if (psmf->currentStreamNum == ERROR_PSMF_NOT_INITIALIZED) { + if (psmf->currentStreamNum == (int)ERROR_PSMF_NOT_INITIALIZED) { return hleLogError(ME, ERROR_PSMF_NOT_INITIALIZED, "no stream set"); } if (!Memory::IsValidAddress(typeAddr) || !Memory::IsValidAddress(channelAddr)) { diff --git a/Core/MIPS/IR/IRInterpreter.cpp b/Core/MIPS/IR/IRInterpreter.cpp index aca01aaee8..e0f04eceed 100644 --- a/Core/MIPS/IR/IRInterpreter.cpp +++ b/Core/MIPS/IR/IRInterpreter.cpp @@ -377,7 +377,7 @@ u32 IRInterpret(MIPSState *mips, const IRInst *inst, const u32 *constPool, int c break; case IROp::FCmovVfpuCC: - if (((mips->vfpuCtrl[VFPU_CTRL_CC] >> (inst->src2 & 0xf)) & 1) == (inst->src2 >> 7)) { + if (((mips->vfpuCtrl[VFPU_CTRL_CC] >> (inst->src2 & 0xf)) & 1) == ((u32)inst->src2 >> 7)) { mips->f[inst->dest] = mips->f[inst->src1]; } break; diff --git a/UI/CwCheatScreen.cpp b/UI/CwCheatScreen.cpp index ecb1f35010..2647f20ad9 100644 --- a/UI/CwCheatScreen.cpp +++ b/UI/CwCheatScreen.cpp @@ -56,7 +56,7 @@ void CwCheatScreen::CreateCodeList() { std::size_t lslash = gamePath_.find_last_of("/"); std::size_t lastdot = gamePath_.find_last_of("."); std::string extension = gamePath_.substr(lastdot + 1); - for (int i = 0; i < extension.size(); i++) { + for (size_t i = 0; i < extension.size(); i++) { extension[i] = tolower(extension[i]); } if ((extension != "iso" && extension != "cso" && extension != "pbp") || gameTitle == "") { diff --git a/ext/native/file/chunk_file.cpp b/ext/native/file/chunk_file.cpp index 4026208c21..94e700538a 100644 --- a/ext/native/file/chunk_file.cpp +++ b/ext/native/file/chunk_file.cpp @@ -169,7 +169,7 @@ void ChunkFile::readData(void *what, int count) { if (fastMode) { memcpy(what, data + pos, count); } else { - if (fread(what, 1, count, file) != count) { + if (fread(what, 1, count, file) != (size_t)count) { ELOG("Failed to read complete %d bytes", count); } } diff --git a/ext/native/gfx_es2/draw_buffer.cpp b/ext/native/gfx_es2/draw_buffer.cpp index dad19e0dbc..ff1cd4c3f1 100644 --- a/ext/native/gfx_es2/draw_buffer.cpp +++ b/ext/native/gfx_es2/draw_buffer.cpp @@ -347,7 +347,7 @@ protected: float AtlasWordWrapper::MeasureWidth(const char *str, size_t bytes) { float w = 0.0f; - for (UTF8 utf(str); utf.byteIndex() < bytes; ) { + for (UTF8 utf(str); utf.byteIndex() < (int)bytes; ) { const AtlasChar *ch = atlasfont_.getChar(utf.next()); if (!ch) ch = atlasfont_.getChar('?'); diff --git a/ext/native/net/sinks.cpp b/ext/native/net/sinks.cpp index ef9d8743e6..39339c87b4 100644 --- a/ext/native/net/sinks.cpp +++ b/ext/native/net/sinks.cpp @@ -268,13 +268,13 @@ bool OutputSink::Printf(const char *fmt, ...) { bool success = true; int result = vsnprintf(buf_ + write_, avail, fmt, args); - if (result >= avail) { + if (result >= (int)avail) { // There wasn't enough space. Let's use a buffer instead. // This could be caused by wraparound. char temp[BUFFER_SIZE]; result = vsnprintf(temp, BUFFER_SIZE, fmt, args); - if (result < BUFFER_SIZE && result > 0) { + if ((size_t)result < BUFFER_SIZE && result > 0) { // In case it did return the null terminator. if (temp[result - 1] == '\0') { result--; @@ -289,7 +289,7 @@ bool OutputSink::Printf(const char *fmt, ...) { va_end(backup); // Okay, did we actually write? - if (result >= avail) { + if (result >= (int)avail) { // This means the result string was too big for the buffer. ELOG("Not enough space to format output."); return false;