From 5ac7272f5d47031d284a9c4669ff2dbdad94c4f7 Mon Sep 17 00:00:00 2001 From: thekurtovic <40248206+thekurtovic@users.noreply.github.com> Date: Fri, 10 Jan 2025 10:15:29 -0500 Subject: [PATCH] change(NimBLEAddress): Prefer sizeof with parenthesis --- src/NimBLEAddress.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/NimBLEAddress.cpp b/src/NimBLEAddress.cpp index 2688665..16b1482 100644 --- a/src/NimBLEAddress.cpp +++ b/src/NimBLEAddress.cpp @@ -73,7 +73,7 @@ NimBLEAddress::NimBLEAddress(const std::string& addr, uint8_t type) { std::string mac{addr}; mac.erase(std::remove(mac.begin(), mac.end(), ':'), mac.end()); uint64_t address = std::stoull(mac, nullptr, 16); - memcpy(this->val, &address, sizeof this->val); + memcpy(this->val, &address, sizeof(this->val)); return; } @@ -102,7 +102,7 @@ NimBLEAddress::NimBLEAddress(const uint8_t address[BLE_DEV_ADDR_LEN], uint8_t ty * * BLE_ADDR_RANDOM (1) */ NimBLEAddress::NimBLEAddress(const uint64_t& address, uint8_t type) { - memcpy(this->val, &address, sizeof this->val); + memcpy(this->val, &address, sizeof(this->val)); this->type = type; } // NimBLEAddress @@ -205,7 +205,7 @@ bool NimBLEAddress::operator==(const NimBLEAddress& rhs) const { return false; } - return memcmp(rhs.val, this->val, sizeof this->val) == 0; + return memcmp(rhs.val, this->val, sizeof(this->val)) == 0; } // operator == /** @@ -238,7 +238,7 @@ NimBLEAddress::operator std::string() const { */ NimBLEAddress::operator uint64_t() const { uint64_t address = 0; - memcpy(&address, this->val, sizeof this->val); + memcpy(&address, this->val, sizeof(this->val)); return address; } // operator uint64_t