From 2fdb6ddff6d045dfd8c8476c911bc552605c581b Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Sun, 15 Mar 2020 06:07:21 -0700 Subject: [PATCH] Fixed multimap support --- BeefySysLib/util/Dictionary.h | 15 ++++++++------- IDEHelper/WinDebugger.cpp | 12 ++++++++++-- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/BeefySysLib/util/Dictionary.h b/BeefySysLib/util/Dictionary.h index a358b5e7..cfd63c79 100644 --- a/BeefySysLib/util/Dictionary.h +++ b/BeefySysLib/util/Dictionary.h @@ -119,17 +119,18 @@ public: { int_cosize hashCode = (int_cosize)BeefHash()(key) & 0x7FFFFFFF; - while ((uintptr)mIdx < (uintptr)mDictionary->mCount) - { - if (mDictionary->mEntries[mIdx].mHashCode < 0) + while (mCurrentIdx >= 0) + { + mCurrentIdx = mDictionary->mEntries[mCurrentIdx].mNext; + if (mCurrentIdx < 0) break; - mCurrentIdx = mIdx; - mIdx++; - if ((mDictionary->mEntries[mCurrentIdx].mHashCode == hashCode) && - (mDictionary->mEntries[mCurrentIdx].mKey == key)) + ((*(TKey*)&mDictionary->mEntries[mCurrentIdx].mKey) == key)) + { + mIdx = mCurrentIdx; return true; + } } mIdx = mDictionary->mCount + 1; diff --git a/IDEHelper/WinDebugger.cpp b/IDEHelper/WinDebugger.cpp index 3fc44f1a..ebd0f688 100644 --- a/IDEHelper/WinDebugger.cpp +++ b/IDEHelper/WinDebugger.cpp @@ -853,8 +853,16 @@ void WinDebugger::ValidateBreakpoints() usedBreakpoints.Add(breakpoint->mAddr); WdBreakpoint* foundBreakpoint = NULL; - mBreakpointAddrMap.TryGetValue(breakpoint->mAddr, &foundBreakpoint); - BF_ASSERT(breakpoint == foundBreakpoint); + auto itr = mBreakpointAddrMap.Find(breakpoint->mAddr); + bool found = false; + while (itr != mBreakpointAddrMap.end()) + { + WdBreakpoint* foundBreakpoint = itr->mValue; + found |= foundBreakpoint == breakpoint; + itr.NextWithSameKey(breakpoint->mAddr); + } + + BF_ASSERT(found); } auto checkSibling = (WdBreakpoint*)breakpoint->mLinkedSibling;