From 1001fdae14ae53acd1816aadc242e468bcf3672e Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Sat, 8 Oct 2022 20:33:59 -0230 Subject: [PATCH] Suggested fixes from clang-tidy. --- src/debugger/DebuggerParser.cxx | 4 ++-- src/debugger/TimerMap.cxx | 12 ++++++------ src/debugger/TimerMap.hxx | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/debugger/DebuggerParser.cxx b/src/debugger/DebuggerParser.cxx index d88558c38..c3055697f 100644 --- a/src/debugger/DebuggerParser.cxx +++ b/src/debugger/DebuggerParser.cxx @@ -2342,7 +2342,7 @@ void DebuggerParser::executeTimer() for(uInt32 i = 0; i < argCount; ++i) { - if(static_cast(args[i]) >= std::max(0x80u, romBankCount - 1)) + if(static_cast(args[i]) >= std::max(0x80U, romBankCount - 1)) { if(numAddrs == 2) { @@ -2367,7 +2367,7 @@ void DebuggerParser::executeTimer() } } - uInt32 idx; + uInt32 idx = 0; if(numAddrs < 2) { idx = debugger.m6502().addTimer(addr[0], bank[0], mirrors, anyBank); diff --git a/src/debugger/TimerMap.cxx b/src/debugger/TimerMap.cxx index 9c4d8b022..ae01126a2 100644 --- a/src/debugger/TimerMap.cxx +++ b/src/debugger/TimerMap.cxx @@ -84,8 +84,8 @@ uInt32 TimerMap::add(uInt16 addr, uInt8 bank, bool mirrors, bool anyBank) // complete a partial timer: Timer& tmPartial = myList[idx]; TimerPoint tpFrom = tmPartial.from; - bool oldMirrors = tmPartial.mirrors; - bool oldAnyBank = tmPartial.anyBank; + const bool oldMirrors = tmPartial.mirrors; + const bool oldAnyBank = tmPartial.anyBank; tmPartial.setTo(tp, mirrors, anyBank); toKey(tp, tmPartial.mirrors, tmPartial.anyBank); @@ -153,8 +153,8 @@ void TimerMap::clear() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TimerMap::reset() { - for(auto it = myList.begin(); it != myList.end(); ++it) - it->reset(); + for(auto& it: myList) + it.reset(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -163,7 +163,7 @@ void TimerMap::update(uInt16 addr, uInt8 bank, const uInt64 cycles) if((addr & ADDRESS_MASK) != addr) { // 13 bit timerpoint - TimerPoint tp(addr & ADDRESS_MASK, bank); + const TimerPoint tp(addr & ADDRESS_MASK, bank); // Find address in from and to maps const auto from = myFromMap.equal_range(tp); @@ -178,7 +178,7 @@ void TimerMap::update(uInt16 addr, uInt8 bank, const uInt64 cycles) } // 16 bit timerpoint - TimerPoint tp(addr, bank); + const TimerPoint tp(addr, bank); // Find address in from and to maps const auto from = myFromMap.equal_range(tp); diff --git a/src/debugger/TimerMap.hxx b/src/debugger/TimerMap.hxx index 159ed16e8..bd466dd95 100644 --- a/src/debugger/TimerMap.hxx +++ b/src/debugger/TimerMap.hxx @@ -207,7 +207,7 @@ class TimerMap const uInt64 cycles); private: - void toKey(TimerPoint& tp, bool mirrors, bool anyBank); + static void toKey(TimerPoint& tp, bool mirrors, bool anyBank); private: using TimerList = std::deque; // makes sure that the element pointers do NOT change