From b7bd9dc5d9133c38fd38adf21cf3926becc43658 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Sat, 31 Oct 2009 09:12:31 +0000 Subject: [PATCH] fix bug with ascii memview: make '\0' be ' ' instead of string end. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4487 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DebuggerUICommon/Src/MemoryView.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/Core/DebuggerUICommon/Src/MemoryView.cpp b/Source/Core/DebuggerUICommon/Src/MemoryView.cpp index 8f861580f9..5648207daa 100644 --- a/Source/Core/DebuggerUICommon/Src/MemoryView.cpp +++ b/Source/Core/DebuggerUICommon/Src/MemoryView.cpp @@ -340,9 +340,11 @@ void CMemoryView::OnPaint(wxPaintEvent& event) } else if (viewAsType == VIEWAS_ASCII) { - sprintf(dis, "%c%c%c%c", - (mem_data&0xff000000)>>24, (mem_data&0xff0000)>>16, - (mem_data&0xff00)>>8, mem_data&0xff); + char a[4] = {(mem_data&0xff000000)>>24, (mem_data&0xff0000)>>16, (mem_data&0xff00)>>8, mem_data&0xff}; + for (size_t i = 0; i < 4; i++) + if (a[i] == '\0') + a[i] = ' '; + sprintf(dis, "%c%c%c%c", a[0], a[1], a[2], a[3]); } else sprintf(dis, "INVALID VIEWAS TYPE");