Clean up gcc/g++ compiler warnings that have accumulated.

This commit is contained in:
Glenn Rice 2012-12-10 00:40:28 -06:00
commit e85438cba0
42 changed files with 82 additions and 106 deletions

View file

@ -285,7 +285,6 @@ bool RunCode(const ARCode &arcode)
// used for conditional codes
int skip_count = 0;
u32 addr_last = 0;
u32 val_last = 0;
current_code = &arcode;
@ -394,7 +393,6 @@ bool RunCode(const ARCode &arcode)
{
LogInfo("ZCode: Memory Copy");
doMemoryCopy = true;
addr_last = addr;
val_last = data;
}
else

View file

@ -119,7 +119,7 @@ int RegisterEvent(const char *name, TimedCallback callback)
// check for existing type with same name.
// we want event type names to remain unique so that we can use them for serialization.
for (int i = 0; i < event_types.size(); ++i)
for (unsigned int i = 0; i < event_types.size(); ++i)
{
if (!strcmp(name, event_types[i].name))
{
@ -188,7 +188,7 @@ void EventDoState(PointerWrap &p, BaseEvent* ev)
if (p.GetMode() == PointerWrap::MODE_READ)
{
bool foundMatch = false;
for (int i = 0; i < event_types.size(); ++i)
for (unsigned int i = 0; i < event_types.size(); ++i)
{
if (!strcmp(name.c_str(), event_types[i].name))
{

View file

@ -220,8 +220,8 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit)
for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) {
if (cache.regs[i].loc.GetSimpleReg() !=
regs[i].loc.GetSimpleReg() &&
xregs[cache.regs[i].loc.GetSimpleReg()].guest_reg ==
DSP_REG_NONE) {
xregs[cache.regs[i].loc.GetSimpleReg()].guest_reg == DSP_REG_NONE)
{
movToHostReg(i,
cache.regs[i].loc.GetSimpleReg(),
true);

View file

@ -171,7 +171,7 @@ bool InstallCodeHandler()
Memory::Write_U8(1, 0x80001807);
// Invalidate the icache
for (int i = 0; i < data.length(); i += 32)
for (unsigned int i = 0; i < data.length(); i += 32)
{
PowerPC::ppcState.iCache.Invalidate(0x80001800 + i);
}

View file

@ -42,8 +42,6 @@ void LoadCodes(const IniFile& inifile, std::vector<GeckoCode>& gcodes)
std::istringstream ss(*lines_iter);
int read_state = 0;
switch ((*lines_iter)[0])
{
@ -61,7 +59,6 @@ void LoadCodes(const IniFile& inifile, std::vector<GeckoCode>& gcodes)
gcode.name = StripSpaces(gcode.name);
// read the code creator name
std::getline(ss, gcode.creator, ']');
read_state = 0;
break;
// notes

View file

@ -354,9 +354,6 @@ unsigned int Callback_GetStreaming(short* _pDestBuffer, unsigned int _numSamples
static s16 l1 = 0;
static s16 l2 = 0;
static s16 r1 = 0;
static s16 r2 = 0;
if ( frac >= 0x10000 || frac == 0)
{
@ -364,9 +361,6 @@ unsigned int Callback_GetStreaming(short* _pDestBuffer, unsigned int _numSamples
l1 = l2; //current
l2 = pcm[pos * 2]; //next
r1 = r2; //current
r2 = pcm[pos * 2 + 1]; //next
}
pcm_l = ((l1 << 16) + (l2 - l1) * (u16)frac) >> 16;

View file

@ -281,7 +281,7 @@ bool CUCode_AX::AXTask(u32& _uMail)
u32 Addr__AXOutSBuffer_1;
u32 Addr__AXOutSBuffer_2;
u32 Addr__A;
u32 Addr__12;
//u32 Addr__12;
u32 Addr__4_1;
u32 Addr__4_2;
//u32 Addr__4_3;
@ -429,7 +429,7 @@ bool CUCode_AX::AXTask(u32& _uMail)
break;
case 0x0012:
Addr__12 = HLEMemory_Read_U16(uAddress);
//Addr__12 = HLEMemory_Read_U16(uAddress);
uAddress += 2;
break;

View file

@ -159,8 +159,8 @@ void CUCode_AXWii::Update(int cycles)
bool CUCode_AXWii::AXTask(u32& _uMail)
{
u32 uAddress = _uMail;
u32 Addr__AXStudio;
u32 Addr__AXOutSBuffer;
//u32 Addr__AXStudio;
//u32 Addr__AXOutSBuffer;
bool bExecuteList = true;
/*
@ -178,7 +178,7 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
switch (iCommand)
{
case 0x0000:
Addr__AXStudio = HLEMemory_Read_U32(uAddress);
//Addr__AXStudio = HLEMemory_Read_U32(uAddress);
uAddress += 4;
break;
@ -209,7 +209,7 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
break;
case 0x0007: // AXLIST_SBUFFER
Addr__AXOutSBuffer = HLEMemory_Read_U32(uAddress);
//Addr__AXOutSBuffer = HLEMemory_Read_U32(uAddress);
uAddress += 10;
break;

View file

@ -265,7 +265,7 @@ bool GCMemcard::Save()
mcdFile.WriteBytes(&dir_backup, BLOCK_SIZE);
mcdFile.WriteBytes(&bat, BLOCK_SIZE);
mcdFile.WriteBytes(&bat_backup, BLOCK_SIZE);
for (int i = 0; i < maxBlock - MC_FST_BLOCKS; ++i)
for (unsigned int i = 0; i < maxBlock - MC_FST_BLOCKS; ++i)
{
mcdFile.WriteBytes(mc_data_blocks[i].block, BLOCK_SIZE);
}
@ -587,7 +587,7 @@ u16 GCMemcard::BlockAlloc::NextFreeBlock(u16 StartingBlock) const
for (u16 i = StartingBlock; i < BAT_SIZE; ++i)
if (Map[i-MC_FST_BLOCKS] == 0)
return i;
for (u16 i = 0; i < StartingBlock; ++i)
for (u16 i = MC_FST_BLOCKS; i < StartingBlock; ++i)
if (Map[i-MC_FST_BLOCKS] == 0)
return i;
}
@ -609,7 +609,7 @@ bool GCMemcard::BlockAlloc::ClearBlocks(u16 FirstBlock, u16 BlockCount)
{
return false;
}
for (int i = 0; i < length; ++i)
for (unsigned int i = 0; i < length; ++i)
Map[blocks.at(i)-MC_FST_BLOCKS] = 0;
FreeBlocks = BE16(BE16(FreeBlocks) + BlockCount);
@ -625,7 +625,7 @@ u32 GCMemcard::GetSaveData(u8 index, std::vector<GCMBlock> & Blocks) const
u16 block = DEntry_FirstBlock(index);
u16 BlockCount = DEntry_BlockCount(index);
u16 memcardSize = BE16(hdr.SizeMb) * MBIT_TO_BLOCKS;
//u16 memcardSize = BE16(hdr.SizeMb) * MBIT_TO_BLOCKS;
if ((block == 0xFFFF) || (BlockCount == 0xFFFF))
{
@ -669,12 +669,10 @@ u32 GCMemcard::ImportFile(DEntry& direntry, std::vector<GCMBlock> &saveBlocks)
Directory UpdatedDir = *CurrentDir;
// find first free dir entry
int index = -1;
for (int i=0; i < DIRLEN; i++)
{
if (BE32(UpdatedDir.Dir[i].Gamecode) == 0xFFFFFFFF)
{
index = i;
UpdatedDir.Dir[i] = direntry;
*(u16*)&UpdatedDir.Dir[i].FirstBlock = BE16(firstBlock);
UpdatedDir.Dir[i].CopyCounter = UpdatedDir.Dir[i].CopyCounter+1;
@ -887,7 +885,7 @@ u32 GCMemcard::ImportGciInternal(FILE* gcih, const char *inputFile, const std::s
std::vector<GCMBlock> saveData;
saveData.reserve(size);
for (int i = 0; i < size; ++i)
for (unsigned int i = 0; i < size; ++i)
{
GCMBlock b;
gci.ReadBytes(b.block, BLOCK_SIZE);
@ -1000,7 +998,7 @@ u32 GCMemcard::ExportGci(u8 index, const char *fileName, const std::string &dire
return NOMEMCARD;
}
gci.Seek(DENTRY_SIZE + offset, SEEK_SET);
for (int i = 0; i < size; ++i)
for (unsigned int i = 0; i < size; ++i)
{
gci.WriteBytes(saveData[i].block, BLOCK_SIZE);
}

View file

@ -656,8 +656,10 @@ u8 *GetPointer(const u32 _Address)
case 0x9:
case 0xd:
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
{
if ((_Address & 0xfffffff) < EXRAM_SIZE)
return m_pPhysicalEXRAM + (_Address & EXRAM_MASK);
}
else
break;

View file

@ -262,7 +262,6 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* _pBuffer, int _iLength)
{
int cmd = *jvs_io++;
int unknown = 0;
DEBUG_LOG(AMBASEBOARDDEBUG, "JVS IO, node=%d, cmd=%02x", node, cmd);
switch (cmd)
@ -362,10 +361,7 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* _pBuffer, int _iLength)
}
case 0xf0:
if (*jvs_io++ == 0xD9)
{
ERROR_LOG(AMBASEBOARDDEBUG, "JVS RESET");
} else
unknown = 1;
msg.addData(1);
d10_1 |= 1;

View file

@ -621,7 +621,7 @@ void Wiimote::DoState(PointerWrap& p)
//Do 'm_read_requests' queue
{
u32 size;
u32 size = 0;
if (p.mode == PointerWrap::MODE_READ)
{
//clear

View file

@ -512,8 +512,6 @@ void StateChange(EMUSTATE_CHANGE newState)
// TODO: disable/enable auto reporting, maybe
}
#define ARRAYSIZE(_arr) (sizeof(_arr)/(sizeof(_arr[0])))
bool IsValidBluetoothName(const char* name) {
static const char* kValidWiiRemoteBluetoothNames[] = {
"Nintendo RVL-CNT-01",

View file

@ -321,7 +321,7 @@ void ExecuteCommand(u32 _Address)
bool CmdSuccess = false;
ECommandType Command = static_cast<ECommandType>(Memory::Read_U32(_Address));
volatile int DeviceID = Memory::Read_U32(_Address + 8);
volatile u32 DeviceID = Memory::Read_U32(_Address + 8);
IWII_IPC_HLE_Device* pDevice = (DeviceID >= 0 && DeviceID < IPC_MAX_FDS) ? g_FdMap[DeviceID] : NULL;

View file

@ -183,8 +183,8 @@ void CWII_IPC_HLE_Device_FileIO::CloseFile()
bool CWII_IPC_HLE_Device_FileIO::Seek(u32 _CommandAddress)
{
u32 ReturnValue = FS_RESULT_FATAL;
const s32 SeekPosition = Memory::Read_U32(_CommandAddress + 0xC);
const s32 Mode = Memory::Read_U32(_CommandAddress + 0x10);
const u32 SeekPosition = Memory::Read_U32(_CommandAddress + 0xC);
const u32 Mode = Memory::Read_U32(_CommandAddress + 0x10);
if (OpenFile())
@ -205,7 +205,7 @@ bool CWII_IPC_HLE_Device_FileIO::Seek(u32 _CommandAddress)
}
case 1:
{
s32 wantedPos = SeekPosition+m_SeekPos;
u32 wantedPos = SeekPosition+m_SeekPos;
if (wantedPos >=0 && wantedPos <= fileSize)
{
m_SeekPos = wantedPos;
@ -215,7 +215,7 @@ bool CWII_IPC_HLE_Device_FileIO::Seek(u32 _CommandAddress)
}
case 2:
{
s32 wantedPos = fileSize+m_SeekPos;
u64 wantedPos = fileSize+m_SeekPos;
if (wantedPos >=0 && wantedPos <= fileSize)
{
m_SeekPos = wantedPos;

View file

@ -789,7 +789,8 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
{
static CWII_IPC_HLE_Device_usb_oh1_57e_305* s_Usb = GetUsbPointer();
bool* wiiMoteConnected = new bool[s_Usb->m_WiiMotes.size()];
for(int i = 0; i < s_Usb->m_WiiMotes.size(); i++) wiiMoteConnected[i] = s_Usb->m_WiiMotes[i].IsConnected();
for(unsigned int i = 0; i < s_Usb->m_WiiMotes.size();
i++) wiiMoteConnected[i] = s_Usb->m_WiiMotes[i].IsConnected();
std::string tContentFile(m_ContentFile.c_str());
WII_IPC_HLE_Interface::Reset(true);

View file

@ -285,7 +285,7 @@ bool CWII_IPC_HLE_Device_net_ncd_manage::IOCtlV(u32 _CommandAddress)
{
int x = 0;
int tmpaddress[6];
for (int i = 0; i < SConfig::GetInstance().m_WirelessMac.length() && x < 6; i++)
for (unsigned int i = 0; i < SConfig::GetInstance().m_WirelessMac.length() && x < 6; i++)
{
if (SConfig::GetInstance().m_WirelessMac[i] == ':' || SConfig::GetInstance().m_WirelessMac[i] == '-')
continue;

View file

@ -1467,9 +1467,9 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteLinkPolicy(u8* _Input)
DEBUG_LOG(WII_IPC_WIIMOTE, " ConnectionHandle: 0x%04x", pLinkPolicy->con_handle);
DEBUG_LOG(WII_IPC_WIIMOTE, " Policy: 0x%04x", pLinkPolicy->settings);
hci_write_link_policy_settings_rp Reply;
Reply.status = 0x00;
Reply.con_handle = pLinkPolicy->con_handle;
//hci_write_link_policy_settings_rp Reply;
//Reply.status = 0x00;
//Reply.con_handle = pLinkPolicy->con_handle;
SendEventCommandStatus(HCI_CMD_WRITE_LINK_POLICY_SETTINGS);
@ -1878,4 +1878,4 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::LOG_LinkKey(const u8* _pLinkKey)
, _pLinkKey[0], _pLinkKey[1], _pLinkKey[2], _pLinkKey[3], _pLinkKey[4], _pLinkKey[5], _pLinkKey[6], _pLinkKey[7]
, _pLinkKey[8], _pLinkKey[9], _pLinkKey[10], _pLinkKey[11], _pLinkKey[12], _pLinkKey[13], _pLinkKey[14], _pLinkKey[15]);
}
}

View file

@ -663,19 +663,19 @@ void ReadHeader()
}
videoBackend.resize(ARRAYSIZE(tmpHeader.videoBackend));
for (int i = 0; i < ARRAYSIZE(tmpHeader.videoBackend);i++)
for (unsigned int i = 0; i < ARRAYSIZE(tmpHeader.videoBackend);i++)
{
videoBackend[i] = tmpHeader.videoBackend[i];
}
g_discChange.resize(ARRAYSIZE(tmpHeader.discChange));
for (int i = 0; i < ARRAYSIZE(tmpHeader.discChange);i++)
for (unsigned int i = 0; i < ARRAYSIZE(tmpHeader.discChange);i++)
{
g_discChange[i] = tmpHeader.discChange[i];
}
author.resize(ARRAYSIZE(tmpHeader.author));
for (int i = 0; i < ARRAYSIZE(tmpHeader.author);i++)
for (unsigned int i = 0; i < ARRAYSIZE(tmpHeader.author);i++)
{
author[i] = tmpHeader.author[i];
}

View file

@ -1097,7 +1097,7 @@ void Jit64::mulli(UGeckoInstruction inst)
gpr.BindToRegister(d, (d == a), true);
if (imm == 0)
XOR(32, gpr.R(d), gpr.R(d));
else if(imm == -1)
else if(imm == (u32)-1)
{
if (d != a)
MOV(32, gpr.R(d), gpr.R(a));
@ -1147,7 +1147,7 @@ void Jit64::mullwx(UGeckoInstruction inst)
int src = gpr.R(a).IsImm() ? b : a;
if (imm == 0)
XOR(32, gpr.R(d), gpr.R(d));
else if(imm == -1)
else if(imm == (u32)-1)
{
if (d != src)
MOV(32, gpr.R(d), gpr.R(src));
@ -1263,7 +1263,7 @@ void Jit64::divwux(UGeckoInstruction inst)
while(!(divisor & (1 << shift)))
shift--;
if (divisor == (1 << shift))
if (divisor == (u32)(1 << shift))
{
gpr.Lock(a, b, d);
gpr.BindToRegister(d, d == a, true);
@ -1387,7 +1387,7 @@ void Jit64::divwx(UGeckoInstruction inst)
if (gpr.R(a).IsImm() && gpr.R(b).IsImm())
{
s32 i = (s32)gpr.R(a).offset, j = (s32)gpr.R(b).offset;
if( j == 0 || i == 0x80000000 && j == -1)
if( j == 0 || (i == (s32)0x80000000 && j == -1))
{
gpr.SetImmediate32(d, (i >> 31) ^ j);
if (inst.OE)

View file

@ -472,10 +472,10 @@ static OpArg regBuildMemAddress(RegInfo& RI, InstLoc I, InstLoc AI,
#else
// 64-bit
if (Profiled) {
RI.Jit->LEA(32, EAX, M((void*)addr));
RI.Jit->LEA(32, EAX, M((void*)(u64)addr));
return MComplex(RBX, EAX, SCALE_1, 0);
}
return M((void*)addr);
return M((void*)(u64)addr);
#endif
}
}

View file

@ -71,7 +71,7 @@ static Common::Event g_compressAndDumpStateSyncEvent;
static std::thread g_save_thread;
// Don't forget to increase this after doing changes on the savestate system
static const int STATE_VERSION = 10;
static const u32 STATE_VERSION = 10;
struct StateHeader
{