From 107a49c0c236940da7d3bd0f57da4bc1e2a34cb4 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Fri, 8 Jan 2021 09:33:36 +0100 Subject: host: Update code base using clang-tidy The checks from the new clang-tidy file are applied to the source tree using: $ find . -name "*.cpp" | sort -u | xargs \ --max-procs 8 --max-args 1 clang-tidy --format-style=file \ --fix -p /path/to/compile_commands.json --- host/lib/types/device_addr.cpp | 2 +- host/lib/types/mac_addr.cpp | 2 +- host/lib/types/serial.cpp | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'host/lib/types') diff --git a/host/lib/types/device_addr.cpp b/host/lib/types/device_addr.cpp index d5e9ce0d4..01dd46f5c 100644 --- a/host/lib/types/device_addr.cpp +++ b/host/lib/types/device_addr.cpp @@ -29,7 +29,7 @@ static std::string trim(const std::string& in) device_addr_t::device_addr_t(const std::string& args) { for (const std::string& pair : tokenizer(args, arg_delim)) { - if (trim(pair) == "") + if (trim(pair).empty()) continue; std::vector toks; for (const std::string& tok : tokenizer(pair, pair_delim)) { diff --git a/host/lib/types/mac_addr.cpp b/host/lib/types/mac_addr.cpp index a2f3dec3a..4a9972f1c 100644 --- a/host/lib/types/mac_addr.cpp +++ b/host/lib/types/mac_addr.cpp @@ -60,7 +60,7 @@ std::string mac_addr_t::to_string(void) const { std::string addr = ""; for (uint8_t byte : this->to_bytes()) { - addr += str(boost::format("%s%02x") % ((addr == "") ? "" : ":") % int(byte)); + addr += str(boost::format("%s%02x") % ((addr.empty()) ? "" : ":") % int(byte)); } return addr; } diff --git a/host/lib/types/serial.cpp b/host/lib/types/serial.cpp index e146b4c6c..67272e62e 100644 --- a/host/lib/types/serial.cpp +++ b/host/lib/types/serial.cpp @@ -63,17 +63,17 @@ struct eeprom16_impl : i2c_iface } i2c_iface* _internal; - byte_vector_t read_i2c(uint16_t addr, size_t num_bytes) + byte_vector_t read_i2c(uint16_t addr, size_t num_bytes) override { return _internal->read_i2c(addr, num_bytes); } - void write_i2c(uint16_t addr, const byte_vector_t& bytes) + void write_i2c(uint16_t addr, const byte_vector_t& bytes) override { return _internal->write_i2c(addr, bytes); } - byte_vector_t read_eeprom(uint16_t addr, uint16_t offset, size_t num_bytes) + byte_vector_t read_eeprom(uint16_t addr, uint16_t offset, size_t num_bytes) override { byte_vector_t cmd = { narrow_cast(offset >> 8), narrow_cast(offset & 0xff)}; @@ -81,7 +81,7 @@ struct eeprom16_impl : i2c_iface return this->read_i2c(addr, num_bytes); } - void write_eeprom(uint16_t addr, uint16_t offset, const byte_vector_t& bytes) + void write_eeprom(uint16_t addr, uint16_t offset, const byte_vector_t& bytes) override { for (uint16_t i = 0; i < bytes.size(); i++) { // write a byte at a time, its easy that way -- cgit v1.2.3