Code cleanups, warning fixes

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5326 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
NeoBrainX 2010-04-11 11:16:57 +00:00
parent 58f7de09dd
commit a4515490ce
18 changed files with 60 additions and 60 deletions

View File

@ -27,10 +27,8 @@
namespace ActionReplay namespace ActionReplay
{ {
extern int total;
extern const char *filter;
void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry> &ops); void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry> &ops);
} //namespace } //namespace
#endif //_ARDECRYPT_H_ #endif //_ARDECRYPT_H_

View File

@ -20,7 +20,7 @@
// Will never be able to support some AR codes - specifically those that patch the running // Will never be able to support some AR codes - specifically those that patch the running
// Action Replay engine itself - yes they do exist!!! // Action Replay engine itself - yes they do exist!!!
// Action Replay actually is a small virtual machine with a limited number of commands. // Action Replay actually is a small virtual machine with a limited number of commands.
// It probably is Turning complete - but what does that matter when AR codes can write // It probably is Turing complete - but what does that matter when AR codes can write
// actual PowerPC code... // actual PowerPC code...
// ----------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------

View File

@ -38,7 +38,7 @@ CDolLoader::CDolLoader(const char* _szFilename)
fclose(pStream); fclose(pStream);
m_bInit = Initialize(tmpBuffer, (u32)size); m_bInit = Initialize(tmpBuffer, (u32)size);
delete [] tmpBuffer; delete[] tmpBuffer;
} }
bool CDolLoader::Initialize(u8* _pBuffer, u32 _Size) bool CDolLoader::Initialize(u8* _pBuffer, u32 _Size)

View File

@ -37,7 +37,7 @@ bool CBoot::IsElfWii(const char *filename)
ElfReader reader(mem); ElfReader reader(mem);
// TODO: Find a more reliable way to distinguish. // TODO: Find a more reliable way to distinguish.
bool isWii = reader.GetEntryPoint() >= 0x80004000; bool isWii = reader.GetEntryPoint() >= 0x80004000;
delete [] mem; delete[] mem;
return isWii; return isWii;
} }
@ -66,7 +66,7 @@ bool CBoot::Boot_ELF(const char *filename)
} }
PC = reader.GetEntryPoint(); PC = reader.GetEntryPoint();
delete []mem; delete[] mem;
return true; return true;
} }

View File

@ -42,7 +42,7 @@ CDump::~CDump(void)
{ {
if (m_pData != NULL) if (m_pData != NULL)
{ {
delete [] m_pData; delete[] m_pData;
m_pData = NULL; m_pData = NULL;
} }
} }

View File

@ -58,7 +58,7 @@ public:
for (size_t num=0; num<m_dolheader.textSize[i]; num++) for (size_t num=0; num<m_dolheader.textSize[i]; num++)
CMemory::Write_U8(pTemp[num], m_dolheader.textAddress[i] + num); CMemory::Write_U8(pTemp[num], m_dolheader.textAddress[i] + num);
delete [] pTemp; delete[] pTemp;
} }
} }
@ -75,7 +75,7 @@ public:
for (size_t num=0; num<m_dolheader.dataSize[i]; num++) for (size_t num=0; num<m_dolheader.dataSize[i]; num++)
CMemory::Write_U8(pTemp[num], m_dolheader.dataAddress[i] + num); CMemory::Write_U8(pTemp[num], m_dolheader.dataAddress[i] + num);
delete [] pTemp; delete[] pTemp;
} }
} }

View File

@ -170,7 +170,7 @@ void CEXIMemoryCard::Flush(bool exiting)
CEXIMemoryCard::~CEXIMemoryCard() CEXIMemoryCard::~CEXIMemoryCard()
{ {
Flush(true); Flush(true);
delete [] memory_card_content; delete[] memory_card_content;
memory_card_content = NULL; memory_card_content = NULL;
if(flushThread) if(flushThread)
{ {

View File

@ -108,10 +108,10 @@ void Write16(const u16 _iValue, const u32 _iAddress)
void Write32(const u32 _iValue, const u32 _iAddress) void Write32(const u32 _iValue, const u32 _iAddress)
{ {
#ifdef _DEBUG //#ifdef _DEBUG
float floatvalue = *(float*)&_iValue; // float floatvalue = *(float*)&_iValue;
// LOG(GPFIFO, "GPFIFO #%x: 0x%08x / %f",ProcessorInterface::Fifo_CPUWritePointer+m_gatherPipeCount, _iValue, floatvalue); // LOG(GPFIFO, "GPFIFO #%x: 0x%08x / %f",ProcessorInterface::Fifo_CPUWritePointer+m_gatherPipeCount, _iValue, floatvalue);
#endif //#endif
*(u32*)(&m_gatherPipe[m_gatherPipeCount]) = Common::swap32(_iValue); *(u32*)(&m_gatherPipe[m_gatherPipeCount]) = Common::swap32(_iValue);
m_gatherPipeCount += 4; m_gatherPipeCount += 4;
CheckGatherPipe(); CheckGatherPipe();

View File

@ -299,7 +299,7 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
Addr += 9; // owner attribs, permission Addr += 9; // owner attribs, permission
u8 Attribs = Memory::Read_U8(Addr); u8 Attribs = Memory::Read_U8(Addr);
INFO_LOG(WII_IPC_FILEIO, "FS: CREATE_DIR %s", DirName.c_str()); INFO_LOG(WII_IPC_FILEIO, "FS: CREATE_DIR %s, OwnerID %#x, GroupID %#x, Attributes %#x", DirName.c_str(), OwnerID, GroupID, Attribs);
DirName += DIR_SEP; DirName += DIR_SEP;
File::CreateFullPath(DirName.c_str()); File::CreateFullPath(DirName.c_str());

View File

@ -366,7 +366,7 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInS
rwFail = 1; rwFail = 1;
} }
delete [] buffer; delete[] buffer;
} }
} }
Memory::Write_U32(0x900, _BufferOut); Memory::Write_U32(0x900, _BufferOut);
@ -401,7 +401,7 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInS
rwFail = 1; rwFail = 1;
} }
delete [] buffer; delete[] buffer;
} }
} }
Memory::Write_U32(0x900, _BufferOut); Memory::Write_U32(0x900, _BufferOut);

View File

@ -165,7 +165,7 @@ void print_trace(const char * msg)
size = backtrace(array, 100); size = backtrace(array, 100);
strings = backtrace_symbols(array, size); strings = backtrace_symbols(array, size);
printf("%s Obtained %u stack frames.\n", msg, size); printf("%s Obtained %u stack frames.\n", msg, (unsigned int)size);
for (i = 0; i < size; i++) for (i = 0; i < size; i++)
printf("--> %s\n", strings[i]); printf("--> %s\n", strings[i]);
free(strings); free(strings);

View File

@ -386,15 +386,15 @@ void Jit64::SingleStep()
#endif #endif
} }
void Jit64::Trace(PPCAnalyst::CodeBuffer *code_buffer, u32 em_address) void Jit64::Trace(PPCAnalyst::CodeBuffer *code_buf, u32 em_address)
{ {
char reg[50] = "";
char regs[500] = ""; char regs[500] = "";
char fregs[750] = ""; char fregs[750] = "";
#ifdef JIT_LOG_GPR #ifdef JIT_LOG_GPR
for (int i = 0; i < 32; i++) for (int i = 0; i < 32; i++)
{ {
char reg[50];
sprintf(reg, "r%02d: %08x ", i, PowerPC::ppcState.gpr[i]); sprintf(reg, "r%02d: %08x ", i, PowerPC::ppcState.gpr[i]);
strncat(regs, reg, 500); strncat(regs, reg, 500);
} }
@ -403,11 +403,12 @@ void Jit64::Trace(PPCAnalyst::CodeBuffer *code_buffer, u32 em_address)
#ifdef JIT_LOG_FPR #ifdef JIT_LOG_FPR
for (int i = 0; i < 32; i++) for (int i = 0; i < 32; i++)
{ {
char reg[50];
sprintf(reg, "f%02d: %016x ", i, riPS0(i)); sprintf(reg, "f%02d: %016x ", i, riPS0(i));
strncat(fregs, reg, 750); strncat(fregs, reg, 750);
} }
#endif #endif
const PPCAnalyst::CodeOp &op = code_buffer->codebuffer[0]; const PPCAnalyst::CodeOp &op = code_buf->codebuffer[0];
char ppcInst[256]; char ppcInst[256];
DisassembleGekko(op.inst.hex, em_address, ppcInst, 256); DisassembleGekko(op.inst.hex, em_address, ppcInst, 256);
@ -442,13 +443,13 @@ void STACKALIGN Jit64::Jit(u32 em_address)
} }
const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buffer, JitBlock *b) const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBlock *b)
{ {
int blockSize = code_buffer->GetSize(); int blockSize = code_buf->GetSize();
#ifdef JIT_SINGLESTEP #ifdef JIT_SINGLESTEP
blockSize = 1; blockSize = 1;
Trace(code_buffer, em_address); Trace(code_buf, em_address);
#endif #endif
if (em_address == 0) if (em_address == 0)
@ -464,9 +465,9 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buffer, JitB
//Analyze the block, collect all instructions it is made of (including inlining, //Analyze the block, collect all instructions it is made of (including inlining,
//if that is enabled), reorder instructions for optimal performance, and join joinable instructions. //if that is enabled), reorder instructions for optimal performance, and join joinable instructions.
u32 nextPC = PPCAnalyst::Flatten(em_address, &size, &js.st, &js.gpa, &js.fpa, code_buffer, blockSize); u32 nextPC = PPCAnalyst::Flatten(em_address, &size, &js.st, &js.gpa, &js.fpa, code_buf, blockSize);
PPCAnalyst::CodeOp *ops = code_buffer->codebuffer; PPCAnalyst::CodeOp *ops = code_buf->codebuffer;
const u8 *start = AlignCode4(); //TODO: Test if this or AlignCode16 make a difference from GetCodePtr const u8 *start = AlignCode4(); //TODO: Test if this or AlignCode16 make a difference from GetCodePtr
b->checkedEntry = start; b->checkedEntry = start;
@ -591,7 +592,7 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buffer, JitB
b->originalSize = size; b->originalSize = size;
#ifdef JIT_LOG_X86 #ifdef JIT_LOG_X86
LogGeneratedX86(size, code_buffer, normalEntry, b); LogGeneratedX86(size, code_buf, normalEntry, b);
#endif #endif
return normalEntry; return normalEntry;

View File

@ -363,28 +363,29 @@ void JitIL::SingleStep()
#endif #endif
} }
void JitIL::Trace(PPCAnalyst::CodeBuffer *code_buffer, u32 em_address) void JitIL::Trace(PPCAnalyst::CodeBuffer *code_buf, u32 em_address)
{ {
char reg[50] = "";
char regs[500] = ""; char regs[500] = "";
char fregs[750] = ""; char fregs[750] = "";
#ifdef JIT_LOG_GPR #ifdef JIT_LOG_GPR
for (int i = 0; i < 32; i++) for (unsigned int i = 0; i < 32; i++)
{ {
char reg[50];
sprintf(reg, "r%02d: %08x ", i, PowerPC::ppcState.gpr[i]); sprintf(reg, "r%02d: %08x ", i, PowerPC::ppcState.gpr[i]);
strncat(regs, reg, 500); strncat(regs, reg, 500);
} }
#endif #endif
#ifdef JIT_LOG_FPR #ifdef JIT_LOG_FPR
for (int i = 0; i < 32; i++) for (unsigned int i = 0; i < 32; i++)
{ {
char reg[50];
sprintf(reg, "f%02d: %016x ", i, riPS0(i)); sprintf(reg, "f%02d: %016x ", i, riPS0(i));
strncat(fregs, reg, 750); strncat(fregs, reg, 750);
} }
#endif #endif
const PPCAnalyst::CodeOp &op = code_buffer->codebuffer[0]; const PPCAnalyst::CodeOp &op = code_buf->codebuffer[0];
char ppcInst[256]; char ppcInst[256];
DisassembleGekko(op.inst.hex, em_address, ppcInst, 256); DisassembleGekko(op.inst.hex, em_address, ppcInst, 256);
@ -418,13 +419,13 @@ void STACKALIGN JitIL::Jit(u32 em_address)
blocks.FinalizeBlock(block_num, jo.enableBlocklink, DoJit(em_address, &code_buffer, b)); blocks.FinalizeBlock(block_num, jo.enableBlocklink, DoJit(em_address, &code_buffer, b));
} }
const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buffer, JitBlock *b) const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBlock *b)
{ {
int blockSize = code_buffer->GetSize(); int blockSize = code_buf->GetSize();
#ifdef JIT_SINGLESTEP #ifdef JIT_SINGLESTEP
blockSize = 1; blockSize = 1;
Trace(code_buffer, em_address); Trace(code_buf, em_address);
#endif #endif
if (em_address == 0) if (em_address == 0)
@ -439,8 +440,8 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buffer, JitB
//Analyze the block, collect all instructions it is made of (including inlining, //Analyze the block, collect all instructions it is made of (including inlining,
//if that is enabled), reorder instructions for optimal performance, and join joinable instructions. //if that is enabled), reorder instructions for optimal performance, and join joinable instructions.
b->exitAddress[0] = PPCAnalyst::Flatten(em_address, &size, &js.st, &js.gpa, &js.fpa, code_buffer, blockSize); b->exitAddress[0] = PPCAnalyst::Flatten(em_address, &size, &js.st, &js.gpa, &js.fpa, code_buf, blockSize);
PPCAnalyst::CodeOp *ops = code_buffer->codebuffer; PPCAnalyst::CodeOp *ops = code_buf->codebuffer;
const u8 *start = AlignCode4(); //TODO: Test if this or AlignCode16 make a difference from GetCodePtr const u8 *start = AlignCode4(); //TODO: Test if this or AlignCode16 make a difference from GetCodePtr
b->checkedEntry = start; b->checkedEntry = start;
@ -510,7 +511,7 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buffer, JitB
b->originalSize = size; b->originalSize = size;
#ifdef JIT_LOG_X86 #ifdef JIT_LOG_X86
LogGeneratedX86(size, code_buffer, normalEntry, b); LogGeneratedX86(size, code_buf, normalEntry, b);
#endif #endif
return normalEntry; return normalEntry;

View File

@ -107,17 +107,17 @@ bool JitBlock::ContainsAddress(u32 em_address)
void JitBlockCache::Shutdown() void JitBlockCache::Shutdown()
{ {
delete [] blocks; delete[] blocks;
delete [] blockCodePointers; delete[] blockCodePointers;
#ifdef JIT_UNLIMITED_ICACHE #ifdef JIT_UNLIMITED_ICACHE
if (iCache != 0) if (iCache != 0)
delete [] iCache; delete[] iCache;
iCache = 0; iCache = 0;
if (iCacheEx != 0) if (iCacheEx != 0)
delete [] iCacheEx; delete[] iCacheEx;
iCacheEx = 0; iCacheEx = 0;
if (iCacheVMEM != 0) if (iCacheVMEM != 0)
delete [] iCacheVMEM; delete[] iCacheVMEM;
iCacheVMEM = 0; iCacheVMEM = 0;
#endif #endif
blocks = 0; blocks = 0;

View File

@ -53,7 +53,7 @@ CodeBuffer::CodeBuffer(int size)
CodeBuffer::~CodeBuffer() CodeBuffer::~CodeBuffer()
{ {
delete [] codebuffer; delete[] codebuffer;
} }
void AnalyzeFunction2(Symbol &func); void AnalyzeFunction2(Symbol &func);

View File

@ -139,7 +139,7 @@ void SaveBufferStateCallback(u64 userdata, int cyclesLate)
sz = (size_t)ptr; sz = (size_t)ptr;
if (*cur_buffer) if (*cur_buffer)
delete [] (*cur_buffer); delete[] (*cur_buffer);
*cur_buffer = new u8[sz]; *cur_buffer = new u8[sz];
ptr = *cur_buffer; ptr = *cur_buffer;
@ -174,7 +174,7 @@ THREAD_RETURN CompressAndDumpState(void *pArgs)
if (f == NULL) if (f == NULL)
{ {
Core::DisplayMessage("Could not save state", 2000); Core::DisplayMessage("Could not save state", 2000);
delete []buffer; delete[] buffer;
return 0; return 0;
} }
@ -213,7 +213,7 @@ THREAD_RETURN CompressAndDumpState(void *pArgs)
} }
fclose(f); fclose(f);
delete []buffer; delete[] buffer;
Core::DisplayMessage(StringFromFormat("Saved State to %s", Core::DisplayMessage(StringFromFormat("Saved State to %s",
filename.c_str()).c_str(), 2000); filename.c_str()).c_str(), 2000);
@ -322,7 +322,7 @@ void LoadStateCallback(u64 userdata, int cyclesLate)
PanicAlert("Internal LZO Error - decompression failed (%d) (%d, %d) \n" PanicAlert("Internal LZO Error - decompression failed (%d) (%d, %d) \n"
"Try loading the state again", res, i, new_len); "Try loading the state again", res, i, new_len);
fclose(f); fclose(f);
delete [] buffer; delete[] buffer;
return; return;
} }
@ -353,7 +353,7 @@ void LoadStateCallback(u64 userdata, int cyclesLate)
else else
Core::DisplayMessage("Unable to Load : Can't load state from other revisions !", 4000); Core::DisplayMessage("Unable to Load : Can't load state from other revisions !", 4000);
delete [] buffer; delete[] buffer;
} }
void State_Init() void State_Init()

View File

@ -53,17 +53,17 @@ void MemoryCheckDlg::CreateGUIControls()
m_pWriteFlag = new wxCheckBox(this, ID_WRITE_FLAG, wxT("Write"), wxPoint(336,16), wxSize(57,17), 0, wxDefaultValidator, wxT("WxCheckBox1")); m_pWriteFlag = new wxCheckBox(this, ID_WRITE_FLAG, wxT("Write"), wxPoint(336,16), wxSize(57,17), 0, wxDefaultValidator, wxT("WxCheckBox1"));
wxStaticBox* WxStaticBox2 = new wxStaticBox(this, ID_WXSTATICBOX2, wxT("Break On"), wxPoint(328,0), wxSize(73,57)); new wxStaticBox(this, ID_WXSTATICBOX2, wxT("Break On"), wxPoint(328,0), wxSize(73,57));
wxStaticText* WxStaticText2 = new wxStaticText(this, ID_WXSTATICTEXT2, wxT("End"), wxPoint(168,24), wxDefaultSize, 0, wxT("WxStaticText2")); new wxStaticText(this, ID_WXSTATICTEXT2, wxT("End"), wxPoint(168,24), wxDefaultSize, 0, wxT("WxStaticText2"));
wxStaticText* WxStaticText1 = new wxStaticText(this, ID_WXSTATICTEXT1, wxT("Start"), wxPoint(8,24), wxDefaultSize, 0, wxT("WxStaticText1")); new wxStaticText(this, ID_WXSTATICTEXT1, wxT("Start"), wxPoint(8,24), wxDefaultSize, 0, wxT("WxStaticText1"));
m_pEditStartAddress = new wxTextCtrl(this, ID_EDIT_START_ADDR, wxT("80000000"), wxPoint(40,24), wxSize(109,20), 0, wxDefaultValidator, wxT("WxEdit1")); m_pEditStartAddress = new wxTextCtrl(this, ID_EDIT_START_ADDR, wxT("80000000"), wxPoint(40,24), wxSize(109,20), 0, wxDefaultValidator, wxT("WxEdit1"));
m_pEditEndAddress = new wxTextCtrl(this, ID_EDIT_END_ADDRESS, wxT("80000000"), wxPoint(200,24), wxSize(109,20), 0, wxDefaultValidator, wxT("WxEdit2")); m_pEditEndAddress = new wxTextCtrl(this, ID_EDIT_END_ADDRESS, wxT("80000000"), wxPoint(200,24), wxSize(109,20), 0, wxDefaultValidator, wxT("WxEdit2"));
wxStaticBox* WxStaticBox1 = new wxStaticBox(this, ID_WXSTATICBOX1, wxT("Address Range"), wxPoint(0,0), wxSize(321,57)); new wxStaticBox(this, ID_WXSTATICBOX1, wxT("Address Range"), wxPoint(0,0), wxSize(321,57));
} }
void MemoryCheckDlg::OnClose(wxCloseEvent& /*event*/) void MemoryCheckDlg::OnClose(wxCloseEvent& /*event*/)

View File

@ -141,9 +141,9 @@ void ClientSide::OnClientData(unsigned char data)
m_data_received = true; m_data_received = true;
#ifdef NET_DEBUG #ifdef NET_DEBUG
char sent[64]; char msgbuf[64];
sprintf(sent, "Received Values: 0x%08x : 0x%08x \n", m_netvalues[0][0], m_netvalues[0][1]); sprintf(msgbuf, "Received Values: 0x%08x : 0x%08x \n", m_netvalues[0][0], m_netvalues[0][1]);
Event->AppendText(wxString::FromAscii(sent)); Event->AppendText(wxString::FromAscii(msgbuf));
#endif #endif
break; break;
} }
@ -276,9 +276,9 @@ void ServerSide::OnServerData(int sock, unsigned char data)
m_data_received = true; m_data_received = true;
#ifdef NET_DEBUG #ifdef NET_DEBUG
char sent[64]; char msgbuf[64];
sprintf(sent, "Received Values: 0x%08x : 0x%08x \n", m_netvalues[sock][0], m_netvalues[sock][1]); sprintf(msgbuf, "Received Values: 0x%08x : 0x%08x \n", m_netvalues[sock][0], m_netvalues[sock][1]);
Event->AppendText(wxString::FromAscii(sent)); Event->AppendText(wxString::FromAscii(msgbuf));
#endif #endif
break; break;
} }