Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
buffer fixes found via cppcheck/tetsuo--
  • Loading branch information
booto committed Jun 18, 2013
1 parent c57a90c commit a518a1c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
14 changes: 7 additions & 7 deletions Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda_Voice.cpp
Expand Up @@ -214,7 +214,6 @@ void CUCode_Zelda::RenderVoice_PCM8(ZeldaVoicePB &PB, s16 *_Buffer, int _Size)
template <typename T>
void PrintObject(const T &Obj)
{
char byte[2] = {0};
std::stringstream ss;
u8 *o = (u8 *)&Obj;

Expand All @@ -223,16 +222,17 @@ void PrintObject(const T &Obj)
CompileTimeAssert<sizeof(ZeldaVoicePB) == 0x180> ensure_zpb_size_correct;
(void)ensure_zpb_size_correct;

ss << std::hex;
for (size_t i = 0; i < sizeof(T); i++)
{
if((i > 0) && ((i & 1) == 0))
ss << " ";

sprintf(byte, "%02X", Common::swap16(o[i]));
ss << byte;
if((i & 1) == 0)
ss << ' ';
ss.width(2);
ss.fill('0');
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());
}

void CUCode_Zelda::RenderVoice_AFC(ZeldaVoicePB &PB, s16 *_Buffer, int _Size)
Expand Down
14 changes: 8 additions & 6 deletions Source/Core/Core/Src/PowerPC/JitCommon/JitBase.cpp
Expand Up @@ -2,6 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.

#include <sstream>

#include "JitBase.h"
#include "PowerPCDisasm.h"
#include "disasm.h"
Expand Down Expand Up @@ -54,14 +56,14 @@ void LogGeneratedX86(int size, PPCAnalyst::CodeBuffer *code_buffer, const u8 *no

if (b->codeSize <= 250)
{
char x86code[500] = "";
std::stringstream ss;
ss << std::hex;
for (u8 i = 0; i <= b->codeSize; i++)
{
char opcHex[2] = "";
u8 opc = *(normalEntry + i);
sprintf(opcHex, "%02x", opc);
strncat(x86code, opcHex, 2);
ss.width(2);
ss.fill('0');
ss << (u32)*(normalEntry + i);
}
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());
}
}

0 comments on commit a518a1c

Please sign in to comment.