cpplint: Get rid of some C-style castings

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/911/head
Gergely Nagy 4 years ago
parent 1f9f46d9f3
commit 24c3747ce6
No known key found for this signature in database
GPG Key ID: AC1E90BAC433F68F

@ -360,7 +360,7 @@ void VirtualLEDDriver::syncLeds() {
} }
void VirtualLEDDriver::setCrgbAt(uint8_t i, cRGB color) { void VirtualLEDDriver::setCrgbAt(uint8_t i, cRGB color) {
if ((int)i >= (int)led_count) { if (static_cast<int>(i) >= static_cast<int>(led_count)) {
log_error("Virtual::setCrgbAt: Index %d out of bounds\n", i); log_error("Virtual::setCrgbAt: Index %d out of bounds\n", i);
return; return;
} }
@ -368,7 +368,7 @@ void VirtualLEDDriver::setCrgbAt(uint8_t i, cRGB color) {
} }
cRGB VirtualLEDDriver::getCrgbAt(uint8_t i) const { cRGB VirtualLEDDriver::getCrgbAt(uint8_t i) const {
if ((int)i >= (int)led_count) { if (static_cast<int>(i) >= static_cast<int>(led_count)) {
log_error("Virtual::getCrgbAt: Index %d out of bounds\n", i); log_error("Virtual::getCrgbAt: Index %d out of bounds\n", i);
return CRGB(0, 0, 0); return CRGB(0, 0, 0);
} }

@ -85,7 +85,7 @@ class WS2812 {
bool modified_ = false; bool modified_ = false;
void sendArrayWithMask(uint8_t maskhi) { void sendArrayWithMask(uint8_t maskhi) {
uint8_t *data = (uint8_t *)leds_; uint8_t *data = reinterpret_cast<uint8_t *>(leds_);
uint16_t datalen = ledCount * sizeof(Color); uint16_t datalen = ledCount * sizeof(Color);
uint8_t curbyte, ctr, masklo; uint8_t curbyte, ctr, masklo;
uint8_t sreg_prev; uint8_t sreg_prev;

Loading…
Cancel
Save