mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2025-01-15 22:12:08 +01:00
change(NimBLEAddress): Prefer sizeof with parenthesis
This commit is contained in:
parent
4d8ab46e56
commit
5ac7272f5d
1 changed files with 4 additions and 4 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue