Misc: Fix various DebugTools Codacy complaints

This commit is contained in:
ty 2021-03-11 19:48:35 -05:00 committed by refractionpcsx2
parent 789c619169
commit e18ee42afc
5 changed files with 10 additions and 10 deletions

View File

@ -91,7 +91,7 @@ bool load_pcap()
len = GetDllDirectory(len, oldDllDir); len = GetDllDirectory(len, oldDllDir);
if (len == 0) if (len == 0)
{ {
delete oldDllDir; delete[] oldDllDir;
return false; return false;
} }
} }
@ -104,7 +104,7 @@ bool load_pcap()
//Reset DllDirectory //Reset DllDirectory
SetDllDirectory(oldDllDir); SetDllDirectory(oldDllDir);
delete oldDllDir; delete[] oldDllDir;
//Did we succeed? //Did we succeed?
if (hpcap == nullptr) if (hpcap == nullptr)

View File

@ -29,7 +29,7 @@ std::vector<EEThread> getEEThreads()
{ {
EEThread thread; EEThread thread;
EEInternalThread* internal = (EEInternalThread*) PSM(start+tid*sizeof(EEInternalThread)); EEInternalThread* internal = static_cast<EEInternalThread*>(PSM(start + tid * sizeof(EEInternalThread)));
if (internal->status != THS_BAD) if (internal->status != THS_BAD)
{ {
thread.tid = tid; thread.tid = tid;

View File

@ -457,6 +457,7 @@ void DisassemblyFunction::generateBranchLines()
if (opInfo.isBranch && !opInfo.isBranchToRegister && !opInfo.isLinkedBranch && inFunction) if (opInfo.isBranch && !opInfo.isBranchToRegister && !opInfo.isLinkedBranch && inFunction)
{ {
BranchLine line; BranchLine line;
line.laneIndex = 0;
if (opInfo.branchTarget < funcPos) if (opInfo.branchTarget < funcPos)
{ {
line.first = opInfo.branchTarget; line.first = opInfo.branchTarget;
@ -471,7 +472,7 @@ void DisassemblyFunction::generateBranchLines()
lines.push_back(line); lines.push_back(line);
} }
} }
std::sort(lines.begin(),lines.end()); std::sort(lines.begin(),lines.end());
for (size_t i = 0; i < lines.size(); i++) for (size_t i = 0; i < lines.size(); i++)
{ {
@ -748,7 +749,7 @@ void DisassemblyMacro::setMacroLi(u32 _immediate, u8 _rt)
numOpcodes = 2; numOpcodes = 2;
} }
void DisassemblyMacro::setMacroMemory(std::string _name, u32 _immediate, u8 _rt, int _dataSize) void DisassemblyMacro::setMacroMemory(const std::string& _name, u32 _immediate, u8 _rt, int _dataSize)
{ {
type = MACRO_MEMORYIMM; type = MACRO_MEMORYIMM;
name = _name; name = _name;
@ -1021,7 +1022,7 @@ void DisassemblyData::createLines()
} }
DisassemblyComment::DisassemblyComment(DebugInterface* _cpu, u32 _address, u32 _size, std::string _name, std::string _param) DisassemblyComment::DisassemblyComment(DebugInterface* _cpu, u32 _address, u32 _size, const std::string& _name, const std::string& _param)
: cpu(_cpu), address(_address), size(_size), name(_name), param(_param) : cpu(_cpu), address(_address), size(_size), name(_name), param(_param)
{ {

View File

@ -115,7 +115,7 @@ public:
virtual ~DisassemblyMacro() { }; virtual ~DisassemblyMacro() { };
void setMacroLi(u32 _immediate, u8 _rt); void setMacroLi(u32 _immediate, u8 _rt);
void setMacroMemory(std::string _name, u32 _immediate, u8 _rt, int _dataSize); void setMacroMemory(const std::string& _name, u32 _immediate, u8 _rt, int _dataSize);
virtual void recheck() { }; virtual void recheck() { };
virtual int getNumLines() { return 1; }; virtual int getNumLines() { return 1; };
@ -171,7 +171,7 @@ private:
class DisassemblyComment: public DisassemblyEntry class DisassemblyComment: public DisassemblyEntry
{ {
public: public:
DisassemblyComment(DebugInterface* _cpu, u32 _address, u32 _size, std::string name, std::string param); DisassemblyComment(DebugInterface* _cpu, u32 _address, u32 _size,const std::string& name, const std::string& param);
virtual ~DisassemblyComment() { }; virtual ~DisassemblyComment() { };
virtual void recheck() { }; virtual void recheck() { };

View File

@ -462,8 +462,6 @@ bool CMipsInstruction::parseOpcode(const tMipsOpcode& SourceOpcode, const char*
bool CMipsInstruction::LoadEncoding(const tMipsOpcode& SourceOpcode, const char* Line) bool CMipsInstruction::LoadEncoding(const tMipsOpcode& SourceOpcode, const char* Line)
{ {
int RetLen;
immediateType = MIPS_NOIMMEDIATE; immediateType = MIPS_NOIMMEDIATE;
registers.reset(); registers.reset();
@ -481,6 +479,7 @@ bool CMipsInstruction::LoadEncoding(const tMipsOpcode& SourceOpcode, const char*
if (!(*SourceEncoding == 0 && *Line == 0)) if (!(*SourceEncoding == 0 && *Line == 0))
{ {
int RetLen;
while (*SourceEncoding != 0) while (*SourceEncoding != 0)
{ {
while (*Line == ' ' || *Line == '\t') Line++; while (*Line == ' ' || *Line == '\t') Line++;