diff --git a/Common/ChunkFile.h b/Common/ChunkFile.h index 261ac37965..f758726b72 100644 --- a/Common/ChunkFile.h +++ b/Common/ChunkFile.h @@ -479,7 +479,7 @@ public: u8 *compressed_buffer = new u8[comp_len]; snappy_compress((const char *)buffer, sz, (char *)compressed_buffer, &comp_len); delete [] buffer; - header.ExpectedSize = comp_len; + header.ExpectedSize = (int)comp_len; if (!pFile.WriteArray(&header, 1)) { ERROR_LOG(COMMON,"ChunkReader: Failed writing header"); diff --git a/Common/StringUtil.cpp b/Common/StringUtil.cpp index 189b82e158..4c8662d2e0 100644 --- a/Common/StringUtil.cpp +++ b/Common/StringUtil.cpp @@ -250,8 +250,8 @@ std::string ReplaceAll(std::string result, const std::string& src, const std::st { while(1) { - const int pos = result.find(src); - if (pos == -1) break; + const size_t pos = result.find(src); + if (pos == result.npos) break; result.replace(pos, src.size(), dest); } return result; @@ -297,7 +297,7 @@ std::string UriDecode(const std::string & sSrc) // for future extension" const unsigned char * pSrc = (const unsigned char *)sSrc.c_str(); - const int SRC_LEN = sSrc.length(); + const size_t SRC_LEN = sSrc.length(); const unsigned char * const SRC_END = pSrc + SRC_LEN; const unsigned char * const SRC_LAST_DEC = SRC_END - 2; // last decodable '%' @@ -359,7 +359,7 @@ std::string UriEncode(const std::string & sSrc) { const char DEC2HEX[16 + 1] = "0123456789ABCDEF"; const unsigned char * pSrc = (const unsigned char *)sSrc.c_str(); - const int SRC_LEN = sSrc.length(); + const size_t SRC_LEN = sSrc.length(); unsigned char * const pStart = new unsigned char[SRC_LEN * 3]; unsigned char * pEnd = pStart; const unsigned char * const SRC_END = pSrc + SRC_LEN; diff --git a/Core/Debugger/SymbolMap.cpp b/Core/Debugger/SymbolMap.cpp index b2badb0b4c..81761819f3 100644 --- a/Core/Debugger/SymbolMap.cpp +++ b/Core/Debugger/SymbolMap.cpp @@ -207,7 +207,7 @@ void SymbolMap::SaveSymbolMap(const char *filename) int SymbolMap::GetSymbolNum(unsigned int address, SymbolType symmask) { - int start=0; + size_t start=0; for (size_t i = 0; i < entries.size(); i++) { @@ -216,8 +216,6 @@ int SymbolMap::GetSymbolNum(unsigned int address, SymbolType symmask) else break; } - - if (start<0) start=0; for (size_t i = 0; i < entries.size(); i++) { @@ -227,7 +225,7 @@ int SymbolMap::GetSymbolNum(unsigned int address, SymbolType symmask) if (address < addr+entries[i].size) { if (entries[i].type & symmask) - return i; + return (int) i; else return -1; } @@ -358,7 +356,7 @@ int SymbolMap::FindSymbol(const char *name) { for (size_t i = 0; i < entries.size(); i++) if (strcmp(entries[i].name,name)==0) - return i; + return (int) i; return -1; } @@ -450,27 +448,27 @@ void SymbolMap::UseFuncSignaturesFile(const char *filename, u32 maxAddress) else break; } - int numSigs = sigs.size(); + size_t numSigs = sigs.size(); fclose(f); std::sort(sigs.begin(), sigs.end()); f = fopen("C:\\mojs.txt", "w"); fprintf(f,"00000000\n"); - for (int j=0; jdataBuf != 0) // Can launch save without save data in mode 13 { std::string filePath = dirPath+"/"+GetFileName(param); - int saveSize = param->dataSize; + SceSize saveSize = param->dataSize; if(saveSize == 0 || saveSize > param->dataBufSize) saveSize = param->dataBufSize; // fallback, should never use this INFO_LOG(HLE,"Saving file with size %u in %s",saveSize,filePath.c_str()); @@ -305,7 +305,7 @@ bool SavedataParam::Save(SceUtilitySavedataParam* param, int saveId) u8 *sfoData; size_t sfoSize; sfoFile.WriteSFO(&sfoData,&sfoSize); - WritePSPFile(sfopath, sfoData, sfoSize); + WritePSPFile(sfopath, sfoData, (SceSize)sfoSize); delete[] sfoData; // SAVE ICON0 @@ -341,7 +341,7 @@ bool SavedataParam::Save(SceUtilitySavedataParam* param, int saveId) // Save Encryption Data { EncryptFileInfo encryptInfo; - int dataSize = sizeof(encryptInfo); // version + key + sdkVersion + SceSize dataSize = sizeof(encryptInfo); // version + key + sdkVersion memset(&encryptInfo,0,dataSize); encryptInfo.fileVersion = 1; @@ -380,7 +380,7 @@ bool SavedataParam::Load(SceUtilitySavedataParam *param, int saveId) ERROR_LOG(HLE,"Error reading file %s",filePath.c_str()); return false; } - param->dataSize = readSize; + param->dataSize = (SceSize)readSize; // copy back save name in request strncpy(param->saveName,GetSaveDirName(param, saveId).c_str(),20); @@ -455,8 +455,8 @@ bool SavedataParam::GetSizes(SceUtilitySavedataParam *param) Memory::Write_U32((u32)(MemoryStick_FreeSpace() / MemoryStick_SectorSize()),param->msFree+4); // Free cluster Memory::Write_U32((u32)(MemoryStick_FreeSpace() / 0x400),param->msFree+8); // Free space (in KB) std::string spaceTxt = SavedataParam::GetSpaceText((int)MemoryStick_FreeSpace()); - Memory::Memset(param->msFree+12,0,spaceTxt.size()+1); - Memory::Memcpy(param->msFree+12,spaceTxt.c_str(),spaceTxt.size()); // Text representing free space + Memory::Memset(param->msFree+12,0,(u32)spaceTxt.size()+1); + Memory::Memcpy(param->msFree+12,spaceTxt.c_str(),(u32)spaceTxt.size()); // Text representing free space } if (Memory::IsValidAddress(param->msData)) { @@ -495,12 +495,12 @@ bool SavedataParam::GetSizes(SceUtilitySavedataParam *param) Memory::Write_U32(total_size / (u32)MemoryStick_SectorSize(),param->utilityData); // num cluster Memory::Write_U32(total_size / 0x400,param->utilityData+4); // save size in KB std::string spaceTxt = SavedataParam::GetSpaceText(total_size); - Memory::Memset(param->utilityData+8,0,spaceTxt.size()+1); - Memory::Memcpy(param->utilityData+8,spaceTxt.c_str(),spaceTxt.size()); // save size in text + Memory::Memset(param->utilityData+8,0,(u32)spaceTxt.size()+1); + Memory::Memcpy(param->utilityData+8,spaceTxt.c_str(),(u32)spaceTxt.size()); // save size in text Memory::Write_U32(total_size / 0x400,param->utilityData+16); // save size in KB spaceTxt = SavedataParam::GetSpaceText(total_size); - Memory::Memset(param->utilityData+20,0,spaceTxt.size()+1); - Memory::Memcpy(param->utilityData+20,spaceTxt.c_str(),spaceTxt.size()); // save size in text + Memory::Memset(param->utilityData+20,0,(u32)spaceTxt.size()+1); + Memory::Memcpy(param->utilityData+20,spaceTxt.c_str(),(u32)spaceTxt.size()); // save size in text } return ret; @@ -532,7 +532,7 @@ bool SavedataParam::GetList(SceUtilitySavedataParam *param) } } - for (size_t i = 0; i < validDir.size(); i++) + for (u32 i = 0; i < (u32)validDir.size(); i++) { u32 baseAddr = outputBuffer + (i*72); Memory::Write_U32(0x11FF,baseAddr + 0); // mode @@ -545,11 +545,11 @@ bool SavedataParam::GetList(SceUtilitySavedataParam *param) // folder name without gamename (max 20 u8) std::string outName = validDir[i].name.substr(GetGameName(param).size()); Memory::Memset(baseAddr + 52,0,20); - Memory::Memcpy(baseAddr + 52, outName.c_str(), outName.size()); + Memory::Memcpy(baseAddr + 52, outName.c_str(), (u32)outName.size()); } } // Save num of folder found - Memory::Write_U32(validDir.size(),param->idListAddr+4); + Memory::Write_U32((u32)validDir.size(), param->idListAddr + 4); } return true; } @@ -695,7 +695,7 @@ int SavedataParam::SetPspParam(SceUtilitySavedataParam *param) // We have a png to show PspUtilitySavedataFileData newData; Memory::ReadStruct(param->newData, &newData); - CreatePNGIcon(Memory::GetPointer(newData.buf),newData.size,saveDataList[realCount]); + CreatePNGIcon(Memory::GetPointer(newData.buf), (int)newData.size, saveDataList[realCount]); } DEBUG_LOG(HLE,"Don't Exist"); realCount++; @@ -739,7 +739,7 @@ int SavedataParam::SetPspParam(SceUtilitySavedataParam *param) // We have a png to show PspUtilitySavedataFileData newData; Memory::ReadStruct(param->newData, &newData); - CreatePNGIcon(Memory::GetPointer(newData.buf),newData.size,saveDataList[0]); + CreatePNGIcon(Memory::GetPointer(newData.buf), (int)newData.size, saveDataList[0]); } DEBUG_LOG(HLE,"Don't Exist"); } @@ -798,7 +798,7 @@ void SavedataParam::SetFileInfo(int idx, PSPFileInfo &info, std::string saveName { u8 *textureDataPNG = new u8[(size_t)info2.size]; ReadPSPFile(fileDataPath2, textureDataPNG, info2.size, NULL); - CreatePNGIcon(textureDataPNG, info2.size, saveDataList[idx]); + CreatePNGIcon(textureDataPNG, (int)info2.size, saveDataList[idx]); delete[] textureDataPNG; } diff --git a/Core/ELF/ParamSFO.cpp b/Core/ELF/ParamSFO.cpp index bfba51a6cd..ec8fdfcda3 100644 --- a/Core/ELF/ParamSFO.cpp +++ b/Core/ELF/ParamSFO.cpp @@ -159,7 +159,7 @@ bool ParamSFOData::WriteSFO(u8 **paramsfo, size_t *size) while((key_size%4)) key_size++; header.key_table_start = sizeof(Header) + header.index_table_entries * sizeof(IndexTable); - header.data_table_start = header.key_table_start + key_size; + header.data_table_start = header.key_table_start + (u32)key_size; total_size += sizeof(IndexTable) * header.index_table_entries; total_size += key_size; @@ -201,7 +201,7 @@ bool ParamSFOData::WriteSFO(u8 **paramsfo, size_t *size) else if (it->second.type == VT_UTF8) { index_ptr->param_fmt = 0x0204; - index_ptr->param_len = it->second.s_value.size()+1; + index_ptr->param_len = (u32)it->second.s_value.size()+1; memcpy(data_ptr,it->second.s_value.c_str(),index_ptr->param_len); data_ptr[index_ptr->param_len] = 0; diff --git a/Core/FileSystems/BlockDevices.cpp b/Core/FileSystems/BlockDevices.cpp index 2af43646f0..c413209c0c 100644 --- a/Core/FileSystems/BlockDevices.cpp +++ b/Core/FileSystems/BlockDevices.cpp @@ -105,10 +105,10 @@ CISOFileBlockDevice::CISOFileBlockDevice(std::string _filename) } indexShift = hdr.align; u64 totalSize = hdr.total_bytes; - numBlocks = (int)(totalSize / blockSize); + numBlocks = (u32)(totalSize / blockSize); DEBUG_LOG(LOADER, "hdrSize=%i numBlocks=%i align=%i", hdrSize, numBlocks, indexShift); - int indexSize = numBlocks + 1; + u32 indexSize = numBlocks + 1; index = new u32[indexSize]; if(fread(index, sizeof(u32), indexSize, f) != indexSize) @@ -137,7 +137,7 @@ bool CISOFileBlockDevice::ReadBlock(int blockNumber, u8 *outPtr) u32 compressedReadSize = idx2 - idx; fseek(f, compressedReadPos, SEEK_SET); - size_t readSize = fread(inbuffer, 1, compressedReadSize, f); + u32 readSize = (u32)fread(inbuffer, 1, compressedReadSize, f); if (plain) { diff --git a/Core/FileSystems/BlockDevices.h b/Core/FileSystems/BlockDevices.h index 48faa59cad..68c4652596 100644 --- a/Core/FileSystems/BlockDevices.h +++ b/Core/FileSystems/BlockDevices.h @@ -32,7 +32,7 @@ public: virtual ~BlockDevice() {} virtual bool ReadBlock(int blockNumber, u8 *outPtr) = 0; int GetBlockSize() const { return 2048;} // forced, it cannot be changed by subclasses - virtual int GetNumBlocks() = 0; + virtual u32 GetNumBlocks() = 0; }; @@ -42,7 +42,7 @@ public: CISOFileBlockDevice(std::string _filename); ~CISOFileBlockDevice(); bool ReadBlock(int blockNumber, u8 *outPtr); - int GetNumBlocks() { return numBlocks;} + u32 GetNumBlocks() { return numBlocks;} private: std::string filename; @@ -50,7 +50,7 @@ private: u32 *index; int indexShift; u32 blockSize; - int numBlocks; + u32 numBlocks; }; @@ -60,7 +60,7 @@ public: FileBlockDevice(std::string _filename); ~FileBlockDevice(); bool ReadBlock(int blockNumber, u8 *outPtr); - int GetNumBlocks() {return (int)(filesize / GetBlockSize());} + u32 GetNumBlocks() {return (u32)(filesize / GetBlockSize());} private: std::string filename; diff --git a/Core/HLE/sceAudio.cpp b/Core/HLE/sceAudio.cpp index 0bd420577d..9ce7f2cf89 100644 --- a/Core/HLE/sceAudio.cpp +++ b/Core/HLE/sceAudio.cpp @@ -309,7 +309,7 @@ u32 sceAudioOutput2ChangeLength(u32 sampleCount) u32 sceAudioOutput2GetRestSample() { DEBUG_LOG(HLE,"UNTESTED sceAudioOutput2GetRestSample()"); - return chans[0].sampleQueue.size() * 2; + return (u32) chans[0].sampleQueue.size() * 2; } u32 sceAudioOutput2Release() diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index bde8ada673..bd8d39574a 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -934,7 +934,7 @@ public: p.Do(index); // TODO: Is this the right way for it to wake up? - int count = listing.size(); + int count = (int) listing.size(); p.Do(count); listing.resize(count); for (int i = 0; i < count; ++i) { diff --git a/Core/HLE/sceKernelMbx.cpp b/Core/HLE/sceKernelMbx.cpp index 3e54d11621..a720c710dd 100644 --- a/Core/HLE/sceKernelMbx.cpp +++ b/Core/HLE/sceKernelMbx.cpp @@ -517,7 +517,7 @@ int sceKernelCancelReceiveMbx(SceUID id, u32 numWaitingThreadsAddr) return error; } - u32 count = m->waitingThreads.size(); + u32 count = (u32) m->waitingThreads.size(); DEBUG_LOG(HLE, "sceKernelCancelReceiveMbx(%i, %08x): cancelling %d threads", id, numWaitingThreadsAddr, count); bool wokeThreads = false; @@ -553,7 +553,7 @@ int sceKernelReferMbxStatus(SceUID id, u32 infoAddr) // For whatever reason, it won't write if the size (first member) is 0. if (Memory::Read_U32(infoAddr) != 0) { - m->nmb.numWaitThreads = m->waitingThreads.size(); + m->nmb.numWaitThreads = (int) m->waitingThreads.size(); Memory::WriteStruct(infoAddr, &m->nmb); } diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index 1af606d958..83ef5d59ff 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -911,8 +911,8 @@ u32 sceKernelLoadModuleByID(u32 id, u32 flags, u32 lmoptionPtr) if (lmoptionPtr) { lmoption = (SceKernelLMOption *)Memory::GetPointer(lmoptionPtr); } - u32 pos = pspFileSystem.SeekFile(handle, 0, FILEMOVE_CURRENT); - u32 size = pspFileSystem.SeekFile(handle, 0, FILEMOVE_END); + u32 pos = (u32) pspFileSystem.SeekFile(handle, 0, FILEMOVE_CURRENT); + size_t size = pspFileSystem.SeekFile(handle, 0, FILEMOVE_END); std::string error_string; pspFileSystem.SeekFile(handle, pos, FILEMOVE_BEGIN); Module *module = 0; diff --git a/Core/HLE/sceKernelMsgPipe.cpp b/Core/HLE/sceKernelMsgPipe.cpp index 2f820a3a3a..68ef9d6cad 100644 --- a/Core/HLE/sceKernelMsgPipe.cpp +++ b/Core/HLE/sceKernelMsgPipe.cpp @@ -617,8 +617,8 @@ void sceKernelReferMsgPipeStatus() MsgPipe *m = kernelObjects.Get(uid, error); if (m) { - m->nmp.numSendWaitThreads = m->sendWaitingThreads.size(); - m->nmp.numReceiveWaitThreads = m->receiveWaitingThreads.size(); + m->nmp.numSendWaitThreads = (int) m->sendWaitingThreads.size(); + m->nmp.numReceiveWaitThreads = (int) m->receiveWaitingThreads.size(); Memory::WriteStruct(msgPipeStatusAddr, &m->nmp); RETURN(0); } diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index c23fd232a9..619e1c6603 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -196,7 +196,7 @@ public: int registerActionType(ActionCreator creator) { types_.push_back(creator); - return types_.size() - 1; + return (int) types_.size() - 1; } void restoreActionType(int actionType, ActionCreator creator) { @@ -897,9 +897,9 @@ u32 sceKernelGetThreadmanIdList(u32 type, u32 readBufPtr, u32 readBufSize, u32 i for (size_t i = 0; i < std::min((size_t)readBufSize, threadqueue.size()); i++) { - Memory::Write_U32(threadqueue[i], readBufPtr + i * 4); + Memory::Write_U32(threadqueue[i], readBufPtr + (u32)i * 4); } - Memory::Write_U32(threadqueue.size(), idCountPtr); + Memory::Write_U32((u32)threadqueue.size(), idCountPtr); return 0; } @@ -2283,7 +2283,7 @@ void __KernelCallAddress(Thread *thread, u32 entryPoint, Action *afterAction, bo for (size_t i = 0; i < args.size(); i++) { call->args[i] = args[i]; } - call->numArgs = args.size(); + call->numArgs = (int) args.size(); call->doAfter = afterAction; call->tag = "callAddress"; diff --git a/GPU/GLES/DisplayListInterpreter.cpp b/GPU/GLES/DisplayListInterpreter.cpp index af2186ade7..caeaf363bc 100644 --- a/GPU/GLES/DisplayListInterpreter.cpp +++ b/GPU/GLES/DisplayListInterpreter.cpp @@ -1127,7 +1127,7 @@ void GLES_GPU::UpdateStats() { gpuStats.numFragmentShaders = shaderManager_->NumFragmentShaders(); gpuStats.numShaders = shaderManager_->NumPrograms(); gpuStats.numTextures = TextureCache_NumLoadedTextures(); - gpuStats.numFBOs = vfbs_.size(); + gpuStats.numFBOs = (int)vfbs_.size(); } void GLES_GPU::DoBlockTransfer() { diff --git a/GPU/GLES/TextureCache.cpp b/GPU/GLES/TextureCache.cpp index 3f592cd98c..3cfad971df 100644 --- a/GPU/GLES/TextureCache.cpp +++ b/GPU/GLES/TextureCache.cpp @@ -138,7 +138,7 @@ void TextureCache_InvalidateAll(bool force) { } int TextureCache_NumLoadedTextures() { - return cache.size(); + return (int)cache.size(); }