aboutsummaryrefslogtreecommitdiffstats
path: root/api/direct_bt/DBTManager.hpp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-05-27 05:38:20 +0200
committerSven Gothel <[email protected]>2020-05-27 05:38:20 +0200
commitfb45588b7a4813dd5e3a2b1a9af55f6799d1de19 (patch)
tree9d56902613195dfde21d0c2f9fbd190488d13842 /api/direct_bt/DBTManager.hpp
parente5b36988d1df433dd3f2cc1c9b6da06628e7ee3c (diff)
Fixating certain enums -> 'enum class' (localizing enum scope avoiding duplicates)
Localizing enum scope avoiding duplicates also helps fixating type safety. This is especially important for short enums w/o a type prefix. +++ Fixes: - MgmtEvent::getSpecialized(..): Reading actual uint16_t Opcode instead of just peeking uint8_t! (Duh!) - MgmtEvent* *string* ops: Converting uint16_t Opcode instead of uint8_t to string.
Diffstat (limited to 'api/direct_bt/DBTManager.hpp')
-rw-r--r--api/direct_bt/DBTManager.hpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/api/direct_bt/DBTManager.hpp b/api/direct_bt/DBTManager.hpp
index a0a8bae3..76642c78 100644
--- a/api/direct_bt/DBTManager.hpp
+++ b/api/direct_bt/DBTManager.hpp
@@ -122,11 +122,11 @@ namespace direct_bt {
volatile bool mgmtReaderShallStop;
/** One MgmtAdapterEventCallbackList per event type, allowing multiple callbacks to be invoked for each event */
- std::array<MgmtAdapterEventCallbackList, MgmtEvent::Opcode::MGMT_EVENT_TYPE_COUNT> mgmtAdapterEventCallbackLists;
+ std::array<MgmtAdapterEventCallbackList, static_cast<uint16_t>(MgmtEvent::Opcode::MGMT_EVENT_TYPE_COUNT)> mgmtAdapterEventCallbackLists;
std::recursive_mutex mtx_callbackLists;
inline void checkMgmtEventCallbackListsIndex(const MgmtEvent::Opcode opc) const {
- if( opc >= mgmtAdapterEventCallbackLists.size() ) {
- throw IndexOutOfBoundsException(opc, 1, mgmtAdapterEventCallbackLists.size(), E_FILE_LINE);
+ if( static_cast<uint16_t>(opc) >= mgmtAdapterEventCallbackLists.size() ) {
+ throw IndexOutOfBoundsException(static_cast<uint16_t>(opc), 1, mgmtAdapterEventCallbackLists.size(), E_FILE_LINE);
}
}