From c7cd88e1980887d41f320adeb8935bf035ffca7d Mon Sep 17 00:00:00 2001 From: Nav Date: Sat, 16 Jul 2022 19:12:45 +0100 Subject: [PATCH] Tidying --- .../VendorSpecific/EDBG/AVR/EdbgAvrIspInterface.cpp | 11 +++++++---- src/EventManager/Events/Events.hpp | 3 --- src/Helpers/ConditionVariableNotifier.cpp | 2 +- src/Helpers/DateTime.hpp | 6 +++--- .../HexViewerWidget/ByteItem.cpp | 6 ++++-- src/Targets/Microchip/AVR/AVR8/Avr8.cpp | 2 +- src/Targets/TargetRegister.hpp | 2 +- 7 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/EdbgAvrIspInterface.cpp b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/EdbgAvrIspInterface.cpp index 83e8f09b..0be651dd 100644 --- a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/EdbgAvrIspInterface.cpp +++ b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/EdbgAvrIspInterface.cpp @@ -79,7 +79,8 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr ); const auto& payload = response.getPayload(); - if (response.getStatusCode() != StatusCode::OK + if ( + response.getStatusCode() != StatusCode::OK || payload.size() < 4 || static_cast(payload[3]) != StatusCode::OK ) { @@ -97,10 +98,11 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr ); const auto& payload = response.getPayload(); - if (response.getStatusCode() != StatusCode::OK + if ( + response.getStatusCode() != StatusCode::OK || payload.size() < 4 || static_cast(payload[3]) != StatusCode::OK - ) { + ) { throw TargetOperationFailure( "Failed to read lock bit byte via ISP - response frame status code/size indicates a failure." ); @@ -129,7 +131,8 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr const auto& payload = response.getPayload(); - if (response.getStatusCode() != StatusCode::OK + if ( + response.getStatusCode() != StatusCode::OK || payload.size() < 4 || static_cast(payload[3]) != StatusCode::OK ) { diff --git a/src/EventManager/Events/Events.hpp b/src/EventManager/Events/Events.hpp index bcd71a28..7c3c1bd3 100644 --- a/src/EventManager/Events/Events.hpp +++ b/src/EventManager/Events/Events.hpp @@ -26,8 +26,5 @@ namespace Bloom::Events template using SharedEventPointer = std::shared_ptr; - template - using SharedEventPointerNonConst = std::shared_ptr; - using SharedGenericEventPointer = SharedEventPointer; } diff --git a/src/Helpers/ConditionVariableNotifier.cpp b/src/Helpers/ConditionVariableNotifier.cpp index 1e8cc546..3457ca2e 100644 --- a/src/Helpers/ConditionVariableNotifier.cpp +++ b/src/Helpers/ConditionVariableNotifier.cpp @@ -3,7 +3,7 @@ namespace Bloom { void ConditionVariableNotifier::notify() { - auto lock = std::unique_lock(this->mutex); + const auto lock = std::unique_lock(this->mutex); this->notified = true; this->conditionalVariable.notify_all(); } diff --git a/src/Helpers/DateTime.hpp b/src/Helpers/DateTime.hpp index c1f5c956..760c7743 100644 --- a/src/Helpers/DateTime.hpp +++ b/src/Helpers/DateTime.hpp @@ -19,7 +19,7 @@ namespace Bloom * @return */ static QDateTime currentDateTime() { - auto lock = std::unique_lock(DateTime::currentDateTimeMutex); + const auto lock = std::unique_lock(DateTime::systemClockMutex); return QDateTime::currentDateTime(); } @@ -32,11 +32,11 @@ namespace Bloom * @return */ static QString getTimeZoneAbbreviation(const QDateTime& dateTime) { - auto lock = std::unique_lock(DateTime::currentDateTimeMutex); + const auto lock = std::unique_lock(DateTime::systemClockMutex); return dateTime.timeZoneAbbreviation(); } private: - static inline std::mutex currentDateTimeMutex; + static inline std::mutex systemClockMutex; }; } diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItem.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItem.cpp index 5d925925..0a36870f 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItem.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItem.cpp @@ -167,15 +167,17 @@ namespace Bloom::Widgets } else { if (this->highlightedAddresses.contains(this->address)) { return &(disabledHighlightedBackgroundColor); + } - } else if ( + if ( this->settings.highlightStackMemory && this->currentStackPointer.has_value() && this->address > this->currentStackPointer ) { return &(disabledStackMemoryBackgroundColor); + } - } else if (this->settings.highlightFocusedMemory && this->focusedMemoryRegion != nullptr) { + if (this->settings.highlightFocusedMemory && this->focusedMemoryRegion != nullptr) { return &(disabledFocusedRegionBackgroundColor); } } diff --git a/src/Targets/Microchip/AVR/AVR8/Avr8.cpp b/src/Targets/Microchip/AVR/AVR8/Avr8.cpp index 8f9064a9..f2a75c8a 100644 --- a/src/Targets/Microchip/AVR/AVR8/Avr8.cpp +++ b/src/Targets/Microchip/AVR/AVR8/Avr8.cpp @@ -801,7 +801,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit * * The precautions described above may reduce the likelihood of Bloom bricking the connected target, but there * is still a chance that all of the checks pass, and we still brick the device. Now would be a good time to - * remind the user of liabilities in regards to Bloom and its contributors. + * remind the user of liabilities in regard to Bloom and its contributors. */ Logger::warning( "Updating the DWEN fuse bit is a potentially dangerous operation. Bloom is provided \"AS IS\", " diff --git a/src/Targets/TargetRegister.hpp b/src/Targets/TargetRegister.hpp index d9eda420..bfd94e37 100644 --- a/src/Targets/TargetRegister.hpp +++ b/src/Targets/TargetRegister.hpp @@ -30,7 +30,7 @@ namespace Bloom::Targets TargetRegisterType type = TargetRegisterType::OTHER; TargetMemoryType memoryType = TargetMemoryType::OTHER; - std::optional name = ""; + std::optional name; std::optional groupName; std::optional description;