diff --git a/lib/inc/datalogging/scrutiny_datalogger_raw_encoder.hpp b/lib/inc/datalogging/scrutiny_datalogger_raw_encoder.hpp index 97c8d15..316c2d3 100644 --- a/lib/inc/datalogging/scrutiny_datalogger_raw_encoder.hpp +++ b/lib/inc/datalogging/scrutiny_datalogger_raw_encoder.hpp @@ -70,7 +70,7 @@ namespace scrutiny inline void set_timebase(Timebase const *const timebase) { m_timebase = timebase; } inline datalogging::buffer_size_t get_entry_write_counter(void) const { return m_entry_write_counter; } inline datalogging::buffer_size_t get_data_write_counter(void) const { return m_entry_write_counter * m_entry_size; } - inline datalogging::EncodingType::eEncodingType get_encoding(void) const { return ENCODING; } + static inline datalogging::EncodingType::eEncodingType get_encoding(void) { return ENCODING; } inline datalogging::buffer_size_t get_read_cursor(void) const { return m_first_valid_entry_index * m_entry_size; } inline datalogging::buffer_size_t get_write_cursor(void) const { return m_next_entry_write_index * m_entry_size; } inline bool error(void) const { return m_error; } diff --git a/lib/inc/protocol/scrutiny_comm_handler.hpp b/lib/inc/protocol/scrutiny_comm_handler.hpp index e169500..8f60ce1 100644 --- a/lib/inc/protocol/scrutiny_comm_handler.hpp +++ b/lib/inc/protocol/scrutiny_comm_handler.hpp @@ -68,7 +68,7 @@ namespace scrutiny /// @brief Tells if the Request object has a CRC that matches its payload content. /// @param req The request to check /// @return True if the CRC is valid. False otherwise - bool check_crc(Request const *const req) const; + static bool check_crc(Request const *const req); // Writes the CRC property of the response based on the payload content. void add_crc(Response *const response) const; @@ -137,7 +137,7 @@ namespace scrutiny protected: void process_active_request(void); bool received_discover_request(void); - bool received_connect_request(void); + bool received_connect_request(void) const; class RxFSMState { diff --git a/lib/src/protocol/scrutiny_comm_handler.cpp b/lib/src/protocol/scrutiny_comm_handler.cpp index 41c1a6b..b837418 100644 --- a/lib/src/protocol/scrutiny_comm_handler.cpp +++ b/lib/src/protocol/scrutiny_comm_handler.cpp @@ -417,7 +417,7 @@ namespace scrutiny } // Check if the last request received is a valid "Comm Discover request". - bool CommHandler::received_connect_request(void) + bool CommHandler::received_connect_request(void) const { if (m_active_request.command_id != static_cast(CommandId::CommControl)) { @@ -471,7 +471,7 @@ namespace scrutiny return m_nbytes_to_send - m_nbytes_sent; } - bool CommHandler::check_crc(Request const *const req) const + bool CommHandler::check_crc(Request const *const req) { uint32_t crc = 0; uint8_t header_data[4]; diff --git a/lib/src/scrutiny_tools.cpp b/lib/src/scrutiny_tools.cpp index aee28ff..ce0e1fe 100644 --- a/lib/src/scrutiny_tools.cpp +++ b/lib/src/scrutiny_tools.cpp @@ -15,29 +15,29 @@ namespace scrutiny { namespace tools { - VariableTypeSize::eVariableTypeSize get_required_type_size(uint_fast8_t const newsize) + VariableTypeSize::eVariableTypeSize get_required_type_size(uint_fast8_t const size) { - if (newsize <= 1) + if (size <= 1) { return VariableTypeSize::_8; } - else if (newsize <= 2) + else if (size <= 2) { return VariableTypeSize::_16; } - else if (newsize <= 4) + else if (size <= 4) { return VariableTypeSize::_32; } - else if (newsize <= 8) + else if (size <= 8) { return VariableTypeSize::_64; } - else if (newsize <= 16) + else if (size <= 16) { return VariableTypeSize::_128; } - else if (newsize <= 32) + else if (size <= 32) { return VariableTypeSize::_256; } diff --git a/scripts/static_analysis.sh b/scripts/static_analysis.sh index 2928fb7..320a677 100755 --- a/scripts/static_analysis.sh +++ b/scripts/static_analysis.sh @@ -14,6 +14,7 @@ CPPCHECK_ARGS="-I $LIB_ROOT/inc $LIB_ROOT \ --suppress=preprocessorErrorDirective --suppress=unmatchedSuppression --inline-suppr + --inconclusive -DSCRUTINY_STATIC_ANALYSIS" PLATFORMS="unix32 unix64 win32A win32W win64 avr8 elbrus-e1cp pic8 pic8-enhanced pic16 mips32 native"