Fix some minor bugs pointed out by PVS Studio (thanks!)

This commit is contained in:
Henrik Rydgard
2012-03-03 20:07:20 +01:00
parent ee09def802
commit f5d4fe0bfe
7 changed files with 7 additions and 7 deletions

View File

@ -387,7 +387,7 @@ bool SysConf::SaveToFile(const char *filename)
}
else if (i->type == Type_SmallArray)
{
const u8 len = i->dataLength;
const u8 len = (u8)(i->dataLength);
f.WriteArray(&len, 1);
}

View File

@ -109,7 +109,7 @@ CEXIIPL::CEXIIPL() :
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHLE_BS2)
{
// Copy header
memcpy(m_pIPL, m_bNTSC ? iplverNTSC : iplverPAL, sizeof(m_bNTSC ? iplverNTSC : iplverPAL));
memcpy(m_pIPL, m_bNTSC ? iplverNTSC : iplverPAL, m_bNTSC ? sizeof(iplverNTSC) : sizeof(iplverPAL));
// Load fonts
LoadFileToIPL((File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + FONT_SJIS), 0x1aff00);

View File

@ -1212,7 +1212,7 @@ void IRBuilder::simplifyCommutative(unsigned Opcode, InstLoc& Op1, InstLoc& Op2)
}
bool IRBuilder::maskedValueIsZero(InstLoc Op1, InstLoc Op2) const {
return (~ComputeKnownZeroBits(Op1) & ~ComputeKnownZeroBits(Op1)) == 0;
return (~ComputeKnownZeroBits(Op1) & ~ComputeKnownZeroBits(Op2)) == 0;
}
// Returns I' if I == (0 - I')

View File

@ -299,7 +299,7 @@ u32 Flatten(u32 address, int *realsize, BlockStats *st, BlockRegStats *gpa,
merged_addresses[0] = address;
size_of_merged_addresses = 1;
memset(st, 0, sizeof(st));
memset(st, 0, sizeof(*st));
// Disabled the following optimization in preference of FAST_ICACHE
//UGeckoInstruction previnst = Memory::Read_Opcode_JIT_LC(address - 4);

View File

@ -158,7 +158,7 @@ void GetPixelShaderId(PIXELSHADERUID *uid, DSTALPHA_MODE dstAlphaMode, u32 compo
}
u32* ptr = &uid->values[2];
for (int i = 0; i < bpmem.genMode.numtevstages+1; ++i)
for (unsigned int i = 0; i < bpmem.genMode.numtevstages+1; ++i)
{
StageHash(i, ptr);
ptr += 4; // max: ptr = &uid->values[66]