buffer fixes found via cppcheck/tetsuo--
This commit is contained in:
parent
c57a90c5b5
commit
a518a1cbdc
|
@ -214,7 +214,6 @@ clear_buffer:
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void PrintObject(const T &Obj)
|
void PrintObject(const T &Obj)
|
||||||
{
|
{
|
||||||
char byte[2] = {0};
|
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
u8 *o = (u8 *)&Obj;
|
u8 *o = (u8 *)&Obj;
|
||||||
|
|
||||||
|
@ -223,13 +222,14 @@ void PrintObject(const T &Obj)
|
||||||
CompileTimeAssert<sizeof(ZeldaVoicePB) == 0x180> ensure_zpb_size_correct;
|
CompileTimeAssert<sizeof(ZeldaVoicePB) == 0x180> ensure_zpb_size_correct;
|
||||||
(void)ensure_zpb_size_correct;
|
(void)ensure_zpb_size_correct;
|
||||||
|
|
||||||
|
ss << std::hex;
|
||||||
for (size_t i = 0; i < sizeof(T); i++)
|
for (size_t i = 0; i < sizeof(T); i++)
|
||||||
{
|
{
|
||||||
if((i > 0) && ((i & 1) == 0))
|
if((i & 1) == 0)
|
||||||
ss << " ";
|
ss << ' ';
|
||||||
|
ss.width(2);
|
||||||
sprintf(byte, "%02X", Common::swap16(o[i]));
|
ss.fill('0');
|
||||||
ss << byte;
|
ss << Common::swap16(o[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_LOG(DSPHLE, "AFC PB:%s", ss.str().c_str());
|
DEBUG_LOG(DSPHLE, "AFC PB:%s", ss.str().c_str());
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
// Licensed under GPLv2
|
// Licensed under GPLv2
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
#include "JitBase.h"
|
#include "JitBase.h"
|
||||||
#include "PowerPCDisasm.h"
|
#include "PowerPCDisasm.h"
|
||||||
#include "disasm.h"
|
#include "disasm.h"
|
||||||
|
@ -54,14 +56,14 @@ void LogGeneratedX86(int size, PPCAnalyst::CodeBuffer *code_buffer, const u8 *no
|
||||||
|
|
||||||
if (b->codeSize <= 250)
|
if (b->codeSize <= 250)
|
||||||
{
|
{
|
||||||
char x86code[500] = "";
|
std::stringstream ss;
|
||||||
|
ss << std::hex;
|
||||||
for (u8 i = 0; i <= b->codeSize; i++)
|
for (u8 i = 0; i <= b->codeSize; i++)
|
||||||
{
|
{
|
||||||
char opcHex[2] = "";
|
ss.width(2);
|
||||||
u8 opc = *(normalEntry + i);
|
ss.fill('0');
|
||||||
sprintf(opcHex, "%02x", opc);
|
ss << (u32)*(normalEntry + i);
|
||||||
strncat(x86code, opcHex, 2);
|
|
||||||
}
|
}
|
||||||
DEBUG_LOG(DYNA_REC,"IR_X86 bin: %s\n\n\n", x86code);
|
DEBUG_LOG(DYNA_REC,"IR_X86 bin: %s\n\n\n", ss.str().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue