From 832edb0a8f5c0f95dc1fdb1e55dba2a07355aa3c Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 5 Apr 2013 20:29:20 -0700 Subject: [PATCH] Fix some x64 type conversion warnings. --- Core/Debugger/SymbolMap.cpp | 2 +- Core/Font/PGF.cpp | 10 +++++----- Core/HLE/sceFont.cpp | 8 ++++---- Core/HLE/sceKernelMutex.cpp | 4 ++-- Core/HLE/sceMpeg.cpp | 2 +- GPU/GPUCommon.cpp | 2 +- UI/MenuScreens.cpp | 4 ++-- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Core/Debugger/SymbolMap.cpp b/Core/Debugger/SymbolMap.cpp index e364788e8d..1fcb3a2357 100644 --- a/Core/Debugger/SymbolMap.cpp +++ b/Core/Debugger/SymbolMap.cpp @@ -122,7 +122,7 @@ void SymbolMap::AddSymbol(const char *symbolname, unsigned int vaddress, size_t strncpy(e.name, symbolname, 127); e.name[127] = '\0'; e.vaddress = vaddress; - e.size = size; + e.size = (u32)size; e.type = st; entries.push_back(e); } diff --git a/Core/Font/PGF.cpp b/Core/Font/PGF.cpp index 7b28dc0b6f..9af5e65f9d 100644 --- a/Core/Font/PGF.cpp +++ b/Core/Font/PGF.cpp @@ -41,10 +41,10 @@ static int getBits(int numBits, const u8 *buf, size_t pos) { return v; } -static std::vector getTable(const u8 *buf, int bpe, int length) { +static std::vector getTable(const u8 *buf, int bpe, size_t length) { std::vector vec; vec.resize(length); - for (int i = 0; i < length; i++) { + for (size_t i = 0; i < length; i++) { vec[i] = getBits(bpe, buf, bpe * i); } return vec; @@ -72,10 +72,10 @@ void PGF::DoState(PointerWrap &p) { } if (fontDataSize) { fontData = new u8[fontDataSize]; - p.DoArray(fontData, fontDataSize); + p.DoArray(fontData, (int)fontDataSize); } } else if (fontDataSize) { - p.DoArray(fontData, fontDataSize); + p.DoArray(fontData, (int)fontDataSize); } p.Do(fileName); @@ -179,7 +179,7 @@ void PGF::ReadPtr(const u8 *ptr, size_t dataSize) { } // PGF Fontdata. - u32 fontDataOffset = uptr - startPtr; + u32 fontDataOffset = (u32)(uptr - startPtr); fontDataSize = dataSize - fontDataOffset; fontData = new u8[fontDataSize]; diff --git a/Core/HLE/sceFont.cpp b/Core/HLE/sceFont.cpp index 12bf74fe01..c75ff4a778 100644 --- a/Core/HLE/sceFont.cpp +++ b/Core/HLE/sceFont.cpp @@ -308,7 +308,7 @@ public: fonts_.resize(params_.numFonts); isfontopen_.resize(params_.numFonts); for (size_t i = 0; i < fonts_.size(); i++) { - u32 addr = allocatedAddr + 4 + i * 4; + u32 addr = allocatedAddr + 4 + (u32)i * 4; isfontopen_[i] = 0; fonts_[i] = addr; } @@ -502,7 +502,7 @@ Font *GetOptimumFont(const PGFFontStyle &requestedStyle, Font *optimumFont, Font int GetInternalFontIndex(Font *font) { for (size_t i = 0; i < internalFonts.size(); i++) { if (internalFonts[i] == font) - return i; + return (int)i; } return -1; } @@ -713,7 +713,7 @@ int sceFontFindFont(u32 libHandlePtr, u32 fontStylePtr, u32 errorCodePtr) { for (size_t i = 0; i < internalFonts.size(); i++) { if (internalFonts[i]->MatchesStyle(style, false)) { Memory::Write_U32(0, errorCodePtr); - return i; + return (int)i; } } return -1; @@ -866,7 +866,7 @@ int sceFontGetNumFontList(u32 fontLibHandle, u32 errorCodePtr) { INFO_LOG(HLE, "sceFontGetNumFontList(%08x, %08x)", fontLibHandle, errorCodePtr); if (Memory::IsValidAddress(errorCodePtr)) Memory::Write_U32(0, errorCodePtr); - return internalFonts.size(); + return (int)internalFonts.size(); } int sceFontSetResolution(u32 fontLibHandle, float hRes, float vRes) { diff --git a/Core/HLE/sceKernelMutex.cpp b/Core/HLE/sceKernelMutex.cpp index af60794e61..961a1e6267 100644 --- a/Core/HLE/sceKernelMutex.cpp +++ b/Core/HLE/sceKernelMutex.cpp @@ -686,7 +686,7 @@ int sceKernelReferMutexStatus(SceUID id, u32 infoAddr) if (Memory::Read_U32(infoAddr) != 0) { // Refresh and write - m->nm.numWaitThreads = m->waitingThreads.size(); + m->nm.numWaitThreads = (int) m->waitingThreads.size(); Memory::WriteStruct(infoAddr, &m->nm); } return 0; @@ -1133,7 +1133,7 @@ int __KernelReferLwMutexStatus(SceUID uid, u32 infoPtr) // Refresh and write m->nm.currentCount = workarea->lockLevel; m->nm.lockThread = workarea->lockThread == 0 ? -1 : workarea->lockThread; - m->nm.numWaitThreads = m->waitingThreads.size(); + m->nm.numWaitThreads = (int) m->waitingThreads.size(); Memory::WriteStruct(infoPtr, &m->nm); } return 0; diff --git a/Core/HLE/sceMpeg.cpp b/Core/HLE/sceMpeg.cpp index 1289e9cb74..9986606d42 100644 --- a/Core/HLE/sceMpeg.cpp +++ b/Core/HLE/sceMpeg.cpp @@ -1700,7 +1700,7 @@ int sceMp3GetInfoToAddStreamData(u32 mp3, u32 dstPtr, u32 towritePtr, u32 srcpos if(Memory::IsValidAddress(towritePtr)) Memory::Write_U32(ctx->mp3BufSize, towritePtr); if(Memory::IsValidAddress(srcposPtr)) - Memory::Write_U32(ctx->mp3StreamPosition, srcposPtr); + Memory::Write_U32((u32)ctx->mp3StreamPosition, srcposPtr); return 0; } diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index 613a73fb9d..ef03985088 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -574,7 +574,7 @@ void GPUCommon::DoState(PointerWrap &p) { int currentID = 0; if (currentList != NULL) { ptrdiff_t off = currentList - &dls[0]; - currentID = off / sizeof(DisplayList); + currentID = (int) (off / sizeof(DisplayList)); } p.Do(currentID); if (currentID == 0) { diff --git a/UI/MenuScreens.cpp b/UI/MenuScreens.cpp index e976fa23bc..f096bbc8d5 100644 --- a/UI/MenuScreens.cpp +++ b/UI/MenuScreens.cpp @@ -269,11 +269,11 @@ void MenuScreen::render() { GameInfo *ginfo = g_gameInfoCache.GetInfo(g_Config.recentIsos[i], false); if (ginfo) { - if (UITextureButton(ctx, GEN_ID_LOOP(i), vlinear2, 144, 80, ginfo->iconTexture, ALIGN_LEFT)) { + if (UITextureButton(ctx, (int)GEN_ID_LOOP(i), vlinear2, 144, 80, ginfo->iconTexture, ALIGN_LEFT)) { screenManager()->switchScreen(new EmuScreen(g_Config.recentIsos[i])); } } else { - if (UIButton(GEN_ID_LOOP(i), vlinear2, recentW, filename.c_str(), ALIGN_LEFT)) { + if (UIButton((int)GEN_ID_LOOP(i), vlinear2, recentW, filename.c_str(), ALIGN_LEFT)) { screenManager()->switchScreen(new EmuScreen(g_Config.recentIsos[i])); } }