Fix some 64-bit type conversion warnings.

This commit is contained in:
Unknown W. Brackets 2013-01-19 13:48:20 -08:00
parent f53ec2bef6
commit 140fd171ef
17 changed files with 58 additions and 60 deletions

View File

@ -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");

View File

@ -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;

View File

@ -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; j<numSigs; j++)
for (size_t j=0; j<numSigs; j++)
fprintf(f, "%08x\t%08x\t%08x\t%s\n", sigs[j].inst, sigs[j].size, sigs[j].hash, sigs[j].name);
fseek(f,0,SEEK_SET);
fprintf(f,"%08x",numSigs);
fclose(f);
u32 last = 0xc0d3babe;
for (int i=0; i<numSigs; i++)
{
for (size_t i=0; i<numSigs; i++)
{
if (sigs[i].inst != last)
{
sigmap.insert(Sigmap::value_type(sigs[i].inst, &sigs[i]));
last = sigs[i].inst;
}
}
}
//#2: Scan/hash the memory and locate functions
char temp[256];

View File

@ -76,9 +76,9 @@ void PSPDialog::UpdateFade()
if(fadeTimer < FADE_TIME)
{
if(fadeIn)
fadeValue = fadeTimer / FADE_TIME * 255;
fadeValue = (u32) (fadeTimer / FADE_TIME * 255);
else
fadeValue = 255 - fadeTimer / FADE_TIME * 255;
fadeValue = 255 - (u32) (fadeTimer / FADE_TIME * 255);
}
else
{

View File

@ -227,7 +227,7 @@ int PSPOskDialog::Update()
Memory::Write_U16(value, oskData.outtextPtr + (2 * i));
}
oskData.outtextlength = inputChars.size();
oskData.outtextlength = (int) inputChars.size();
oskParams.base.result= 0;
oskData.result = PSP_UTILITY_OSK_RESULT_CHANGED;
Memory::WriteStruct(oskParams.SceUtilityOskDataPtr, &oskData);

View File

@ -51,7 +51,7 @@ namespace
if (handle == 0)
return false;
int result = pspFileSystem.ReadFile(handle, data, dataSize);
size_t result = pspFileSystem.ReadFile(handle, data, dataSize);
pspFileSystem.CloseFile(handle);
if(readSize)
*readSize = result;
@ -59,13 +59,13 @@ namespace
return result != 0;
}
bool WritePSPFile(std::string filename, u8 *data, int dataSize)
bool WritePSPFile(std::string filename, u8 *data, SceSize dataSize)
{
u32 handle = pspFileSystem.OpenFile(filename, (FileAccess)(FILEACCESS_WRITE | FILEACCESS_CREATE));
if (handle == 0)
return false;
int result = pspFileSystem.WriteFile(handle, data, dataSize);
size_t result = pspFileSystem.WriteFile(handle, data, dataSize);
pspFileSystem.CloseFile(handle);
return result != 0;
@ -225,7 +225,7 @@ bool SavedataParam::Save(SceUtilitySavedataParam* param, int saveId)
if(param->dataBuf != 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;
}

View File

@ -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;

View File

@ -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)
{

View File

@ -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;

View File

@ -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()

View File

@ -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) {

View File

@ -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<NativeMbx>(infoAddr, &m->nmb);
}

View File

@ -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;

View File

@ -617,8 +617,8 @@ void sceKernelReferMsgPipeStatus()
MsgPipe *m = kernelObjects.Get<MsgPipe>(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);
}

View File

@ -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";

View File

@ -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() {

View File

@ -138,7 +138,7 @@ void TextureCache_InvalidateAll(bool force) {
}
int TextureCache_NumLoadedTextures() {
return cache.size();
return (int)cache.size();
}