diff options
| author | hrydgard <hrydgard@gmail.com> | 2008-09-14 09:12:19 +0000 |
|---|---|---|
| committer | hrydgard <hrydgard@gmail.com> | 2008-09-14 09:12:19 +0000 |
| commit | a56fcd4e981802f82b2dfadd125061d49ef8b104 (patch) | |
| tree | 459b53d2e1ff8c9fcf2deec75635c45333dc58c3 /Source/Core | |
| parent | 0ba3948c427c2588d1b1bb143183738da9662bae (diff) | |
Fixed some valgrind warnings.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@523 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Common/Src/StringUtil.cpp | 5 | ||||
| -rw-r--r-- | Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp | 13 | ||||
| -rw-r--r-- | Source/Core/Core/Src/HW/HW.cpp | 4 | ||||
| -rw-r--r-- | Source/Core/DebuggerWX/src/CodeView.cpp | 13 | ||||
| -rw-r--r-- | Source/Core/DebuggerWX/src/MemoryView.cpp | 10 |
5 files changed, 35 insertions, 10 deletions
diff --git a/Source/Core/Common/Src/StringUtil.cpp b/Source/Core/Common/Src/StringUtil.cpp index 590b20fc4a..638c301f24 100644 --- a/Source/Core/Common/Src/StringUtil.cpp +++ b/Source/Core/Common/Src/StringUtil.cpp @@ -165,6 +165,11 @@ void StringFromFormatV(std::string* out, const char* format, va_list args) delete [] buf;
buf = new char[newSize + 1];
writtenCount = vsnprintf(buf, newSize, format, args);
+ // ARGH! vsnprintf does no longer return -1 on truncation in newer libc!
+ // WORKAROUND! let's fake the old behaviour (even though it's less efficient).
+ // TODO: figure out why the fix causes an invalid read in strlen called from vsnprintf :(
+ if (writtenCount >= (int)newSize)
+ writtenCount = -1;
newSize *= 2;
}
diff --git a/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp b/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp index 3e885c34a1..73be2a4385 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp +++ b/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp @@ -46,6 +46,14 @@ CEXIMemoryCard::CEXIMemoryCard(const std::string& _rName, const std::string& _rF cards[_card_index] = this;
et_this_card = CoreTiming::RegisterEvent(_rName.c_str(), FlushCallback);
+ interruptSwitch = 0;
+ m_bInterruptSet = 0;
+ command = 0;
+ status = MC_STATUS_BUSY | MC_STATUS_UNLOCKED | MC_STATUS_READY;
+ m_uPosition = 0;
+ memset(programming_buffer, 0, sizeof(programming_buffer));
+ formatDelay = 0;
+
nintendo_card_id = 0x00000010; // 16MBit nintendo card
card_id = 0xc221;
/* nintendo_card_id = 0x00000510; // 16MBit "bigben" card
@@ -71,11 +79,6 @@ CEXIMemoryCard::CEXIMemoryCard(const std::string& _rName, const std::string& _rF Core::DisplayMessage(StringFromFormat("Wrote memory card contents to %s", m_strFilename.c_str()), 4000);
}
- formatDelay = 0;
- interruptSwitch = 0;
- m_bInterruptSet = 0;
-
- status = MC_STATUS_BUSY | MC_STATUS_UNLOCKED | MC_STATUS_READY;
}
void CEXIMemoryCard::Flush(bool exiting)
diff --git a/Source/Core/Core/Src/HW/HW.cpp b/Source/Core/Core/Src/HW/HW.cpp index 2089e41f6a..4cd1faf586 100644 --- a/Source/Core/Core/Src/HW/HW.cpp +++ b/Source/Core/Core/Src/HW/HW.cpp @@ -40,8 +40,6 @@ #include "../State.h"
#include "../PowerPC/PPCAnalyst.h"
-#define CURVERSION 0x0001
-
namespace HW
{
void Init()
@@ -49,7 +47,7 @@ namespace HW CoreTiming::Init();
PPCAnalyst::Init();
- Thunk_Init(); // not really hw, but this way we know it's inited first :P
+ Thunk_Init(); // not really hw, but this way we know it's inited early :P
State_Init();
// Init the whole Hardware
diff --git a/Source/Core/DebuggerWX/src/CodeView.cpp b/Source/Core/DebuggerWX/src/CodeView.cpp index 26e0d10a8e..c7bafae1e1 100644 --- a/Source/Core/DebuggerWX/src/CodeView.cpp +++ b/Source/Core/DebuggerWX/src/CodeView.cpp @@ -59,11 +59,22 @@ BEGIN_EVENT_TABLE(CCodeView, wxControl) END_EVENT_TABLE()
CCodeView::CCodeView(DebugInterface* debuginterface, wxWindow* parent, wxWindowID Id, const wxSize& Size)
- : wxControl(parent, Id, wxDefaultPosition, Size), debugger(debuginterface)
+ : wxControl(parent, Id, wxDefaultPosition, Size),
+ debugger(debuginterface),
+ rowHeight(13),
+ selection(0),
+ oldSelection(0),
+ selectionChanged(false),
+ selecting(false),
+ hasFocus(false),
+ showHex(false),
+ lx(-1),
+ ly(-1)
{
rowHeight = 13;
align = debuginterface->getInstructionSize(0);
curAddress = debuginterface->getPC();
+ selection = 0;
}
diff --git a/Source/Core/DebuggerWX/src/MemoryView.cpp b/Source/Core/DebuggerWX/src/MemoryView.cpp index d6ffd0a9b0..a492d64027 100644 --- a/Source/Core/DebuggerWX/src/MemoryView.cpp +++ b/Source/Core/DebuggerWX/src/MemoryView.cpp @@ -46,7 +46,15 @@ EVT_MENU(-1, CMemoryView::OnPopupMenu) END_EVENT_TABLE()
CMemoryView::CMemoryView(DebugInterface* debuginterface, wxWindow* parent, wxWindowID Id, const wxSize& Size)
- : wxControl(parent, Id, wxDefaultPosition, Size), debugger(debuginterface)
+ : wxControl(parent, Id, wxDefaultPosition, Size),
+ debugger(debuginterface),
+ rowHeight(13),
+ selection(0),
+ oldSelection(0),
+ selectionChanged(false),
+ selecting(false),
+ hasFocus(false),
+ showHex(false)
{
rowHeight = 13;
align = debuginterface->getInstructionSize(0);
|
