Skip to content

Commit 5ac7272

Browse files
thekurtovich2zero
authored andcommitted
change(NimBLEAddress): Prefer sizeof with parenthesis
1 parent 4d8ab46 commit 5ac7272

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/NimBLEAddress.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ NimBLEAddress::NimBLEAddress(const std::string& addr, uint8_t type) {
7373
std::string mac{addr};
7474
mac.erase(std::remove(mac.begin(), mac.end(), ':'), mac.end());
7575
uint64_t address = std::stoull(mac, nullptr, 16);
76-
memcpy(this->val, &address, sizeof this->val);
76+
memcpy(this->val, &address, sizeof(this->val));
7777
return;
7878
}
7979

@@ -102,7 +102,7 @@ NimBLEAddress::NimBLEAddress(const uint8_t address[BLE_DEV_ADDR_LEN], uint8_t ty
102102
* * BLE_ADDR_RANDOM (1)
103103
*/
104104
NimBLEAddress::NimBLEAddress(const uint64_t& address, uint8_t type) {
105-
memcpy(this->val, &address, sizeof this->val);
105+
memcpy(this->val, &address, sizeof(this->val));
106106
this->type = type;
107107
} // NimBLEAddress
108108

@@ -205,7 +205,7 @@ bool NimBLEAddress::operator==(const NimBLEAddress& rhs) const {
205205
return false;
206206
}
207207

208-
return memcmp(rhs.val, this->val, sizeof this->val) == 0;
208+
return memcmp(rhs.val, this->val, sizeof(this->val)) == 0;
209209
} // operator ==
210210

211211
/**
@@ -238,7 +238,7 @@ NimBLEAddress::operator std::string() const {
238238
*/
239239
NimBLEAddress::operator uint64_t() const {
240240
uint64_t address = 0;
241-
memcpy(&address, this->val, sizeof this->val);
241+
memcpy(&address, this->val, sizeof(this->val));
242242
return address;
243243
} // operator uint64_t
244244

0 commit comments

Comments
 (0)