Fix some ignored error / shadowing warnings.

This commit is contained in:
Unknown W. Brackets 2012-12-21 16:07:42 -08:00
parent 217bdc275e
commit ec753a3575
7 changed files with 27 additions and 23 deletions

View File

@ -40,7 +40,7 @@ void MemCheck::Action(u32 iValue, u32 addr, bool write, int size, u32 pc)
if (bLog)
{
char temp[256];
printf(temp,"CHK %08x %s%i at %08x (%s), PC=%08x (%s)",iValue,write?"Write":"Read",size*8,addr,symbolMap.GetDescription(addr),pc,symbolMap.GetDescription(pc));
sprintf(temp,"CHK %08x %s%i at %08x (%s), PC=%08x (%s)",iValue,write?"Write":"Read",size*8,addr,symbolMap.GetDescription(addr),pc,symbolMap.GetDescription(pc));
ERROR_LOG(MEMMAP,"%s",temp);
}
if (bBreak)

View File

@ -144,10 +144,9 @@ bool SymbolMap::LoadSymbolMap(const char *filename)
{
char line[512],temp[256];
fgets(line,511,f);
if (strlen(line)<4)
if (strlen(line) < 4 || sscanf(line, "%s", temp) != 1)
continue;
sscanf(line,"%s",temp);
if (strcmp(temp,"UNUSED")==0) continue;
if (strcmp(temp,".text")==0) {started=true;continue;};
if (strcmp(temp,".init")==0) {started=true;continue;};
@ -233,7 +232,7 @@ int SymbolMap::GetSymbolNum(unsigned int address, SymbolType symmask)
}
char temp[256];
char descriptionTemp[256];
char *SymbolMap::GetDescription(unsigned int address)
{
@ -244,8 +243,8 @@ char *SymbolMap::GetDescription(unsigned int address)
return entries[fun].name;
else
{
sprintf(temp, "(%08x)", address);
return temp;
sprintf(descriptionTemp, "(%08x)", address);
return descriptionTemp;
}
//}
//else
@ -438,11 +437,12 @@ void SymbolMap::UseFuncSignaturesFile(const char *filename, u32 maxAddress)
//#1: Read the signature file and put them in a fast data structure
FILE *f = fopen(filename, "r");
int count;
fscanf(f,"%08x\n",&count);
u32 inst,size,hash;
if (fscanf(f, "%08x\n", &count) != 1)
count = 0;
char name[256];
for (int a=0; a<count; a++)
{
u32 inst, size, hash;
if (fscanf(f,"%08x\t%08x\t%08x\t%s\n",&inst,&size,&hash,name)!=EOF)
sigs[numSigs++]=Sig(inst,size,hash,name);
else

View File

@ -183,11 +183,11 @@ size_t DirectoryFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size)
EntryMap::iterator iter = entries.find(handle);
if (iter != entries.end())
{
size_t bytesRead;
size_t bytesRead;
#ifdef _WIN32
::ReadFile(iter->second.hFile, (LPVOID)pointer, (DWORD)size, (LPDWORD)&bytesRead, 0);
#else
bytesRead = fread(pointer, 1, size, iter->second.hFile);
bytesRead = fread(pointer, 1, size, iter->second.hFile);
#endif
return bytesRead;
}

View File

@ -29,11 +29,13 @@ static bool parseLBN(std::string filename, u32 *sectorStart, u32 *readSize)
{
if (filename.substr(0, 8) != "/sce_lbn")
return false;
std::string yo = filename;
std::string prev = filename;
filename.erase(0, 10);
sscanf(filename.c_str(), "%08x", sectorStart);
if (sscanf(filename.c_str(), "%08x", sectorStart) != 1)
WARN_LOG(FILESYS, "Invalid LBN reference: %s", prev.c_str());
filename.erase(0, filename.find("_size") + 7);
sscanf(filename.c_str(), "%08x", readSize);
if (sscanf(filename.c_str(), "%08x", readSize) != 1)
WARN_LOG(FILESYS, "Incomplete LBN reference: %s", prev.c_str());
return true;
}
@ -393,6 +395,8 @@ size_t ISOFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size)
}
else
{
_dbg_assert_msg_(HLE, e.file != 0, "Expecting non-raw fd to have a tree entry.");
//clamp read length
if ((s64)e.seekPos > e.file->size - (s64)size)
{

View File

@ -270,12 +270,12 @@ void KernelObjectPool::List()
if (pool[i])
{
pool[i]->GetQuickInfo(buffer,256);
INFO_LOG(HLE, "KO %i: %s \"%s\": %s", i + handleOffset, pool[i]->GetTypeName(), pool[i]->GetName(), buffer);
}
else
{
strcpy(buffer,"WTF? Zero Pointer");
}
INFO_LOG(HLE, "KO %i: %s \"%s\": %s", i + handleOffset, pool[i]->GetTypeName(), pool[i]->GetName(), buffer);
}
}
}

View File

@ -448,13 +448,13 @@ bool __KernelLoadPBP(const char *filename, std::string *error_string)
in.seekg(offsets[5]);
//in.read((char*)&id,4);
{
u8 *temp = new u8[1024*1024*8];
in.read((char*)temp, 1024*1024*8);
Module *module = __KernelLoadELFFromPtr(temp, PSP_GetDefaultLoadAddress(), error_string);
u8 *elftemp = new u8[1024*1024*8];
in.read((char*)elftemp, 1024*1024*8);
Module *module = __KernelLoadELFFromPtr(elftemp, PSP_GetDefaultLoadAddress(), error_string);
if (!module)
return false;
mipsr4k.pc = module->nm.entry_addr;
delete [] temp;
delete [] elftemp;
}
in.close();
return true;
@ -612,7 +612,7 @@ u32 sceKernelLoadModule(const char *name, u32 flags)
// TODO: Use position to decide whether to load high or low
if (PARAM(2))
{
SceKernelLMOption *lmoption = (SceKernelLMOption *)Memory::GetPointer(PARAM(2));
lmoption = (SceKernelLMOption *)Memory::GetPointer(PARAM(2));
}

View File

@ -301,13 +301,13 @@ namespace MIPSAnalyst
{
if (addr >= furthestBranch)
{
u32 target = GetSureBranchTarget(addr);
if (target != INVALIDTARGET && target < addr)
u32 sureTarget = GetSureBranchTarget(addr);
if (sureTarget != INVALIDTARGET && sureTarget < addr)
{
end = true;
}
target = GetJumpTarget(addr);
if (target != INVALIDTARGET && target < addr && ((op&0xFC000000)==0x08000000))
sureTarget = GetJumpTarget(addr);
if (sureTarget != INVALIDTARGET && sureTarget < addr && ((op&0xFC000000)==0x08000000))
{
end = true;
}