Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix linter issues #2173

Merged
merged 4 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CPPLINT.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
set noparent
root=src
linelength=80
filter=-whitespace/indent_namespace
22 changes: 13 additions & 9 deletions examples/IRMQTTServer/IRMQTTServer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1659,11 +1659,13 @@ bool parseStringAndSendAirCon(IRsend *irsend, const decode_type_t irType,
stateSize = inputLength / 2; // Every two hex chars is a byte.
// Use at least the minimum size.
stateSize = std::max(stateSize,
(uint16_t) (kFujitsuAcStateLengthShort - 1));
static_cast<uint16_t>(kFujitsuAcStateLengthShort -
1));
// If we think it isn't a "short" message.
if (stateSize > kFujitsuAcStateLengthShort)
// Then it has to be at least the smaller version of the "normal" size.
stateSize = std::max(stateSize, (uint16_t) (kFujitsuAcStateLength - 1));
stateSize = std::max(stateSize,
static_cast<uint16_t>(kFujitsuAcStateLength - 1));
// Lastly, it should never exceed the maximum "normal" size.
stateSize = std::min(stateSize, kFujitsuAcStateLength);
break;
Expand All @@ -1675,12 +1677,12 @@ bool parseStringAndSendAirCon(IRsend *irsend, const decode_type_t irType,
stateSize = inputLength / 2; // Every two hex chars is a byte.
// Use at least the minimum size.
stateSize = std::max(stateSize,
(uint16_t) (kHitachiAc3MinStateLength));
static_cast<uint16_t>(kHitachiAc3MinStateLength));
// If we think it isn't a "short" message.
if (stateSize > kHitachiAc3MinStateLength)
// Then it probably the "normal" size.
stateSize = std::max(stateSize,
(uint16_t) (kHitachiAc3StateLength));
static_cast<uint16_t>(kHitachiAc3StateLength));
// Lastly, it should never exceed the maximum "normal" size.
stateSize = std::min(stateSize, kHitachiAc3StateLength);
break;
Expand All @@ -1691,7 +1693,7 @@ bool parseStringAndSendAirCon(IRsend *irsend, const decode_type_t irType,
// the correct length/byte size.
stateSize = inputLength / 2; // Every two hex chars is a byte.
// Use at least the minimum size.
stateSize = std::max(stateSize, (uint16_t) 3);
stateSize = std::max(stateSize, static_cast<uint16_t>(3));
// Cap the maximum size.
stateSize = std::min(stateSize, kStateSizeMax);
break;
Expand All @@ -1702,12 +1704,13 @@ bool parseStringAndSendAirCon(IRsend *irsend, const decode_type_t irType,
// the correct length/byte size.
stateSize = inputLength / 2; // Every two hex chars is a byte.
// Use at least the minimum size.
stateSize = std::max(stateSize, (uint16_t) (kSamsungAcStateLength));
stateSize = std::max(stateSize,
static_cast<uint16_t>(kSamsungAcStateLength));
// If we think it isn't a "normal" message.
if (stateSize > kSamsungAcStateLength)
// Then it probably the extended size.
stateSize = std::max(stateSize,
(uint16_t) (kSamsungAcExtendedStateLength));
stateSize = std::max(
stateSize, static_cast<uint16_t>(kSamsungAcExtendedStateLength));
// Lastly, it should never exceed the maximum "extended" size.
stateSize = std::min(stateSize, kSamsungAcExtendedStateLength);
break;
Expand Down Expand Up @@ -2671,7 +2674,8 @@ void receivingMQTT(String const topic_name, String const callback_str) {
switch (ircommand[0]) {
case kPauseChar:
{ // It's a pause. Everything after the 'P' should be a number.
int32_t msecs = std::min((int32_t) strtoul(ircommand + 1, NULL, 10),
int32_t msecs = std::min(static_cast<int32_t>(strtoul(ircommand + 1,
NULL, 10)),
kMaxPauseMs);
delay(msecs);
mqtt_client.publish(MqttAck.c_str(),
Expand Down
2 changes: 1 addition & 1 deletion examples/IRrecvDump/IRrecvDump.ino
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void dump(decode_results *results) {
Serial.print(results->rawbuf[i] * kRawTick, DEC);
} else {
Serial.print(", ");
Serial.print((uint32_t) results->rawbuf[i] * kRawTick, DEC);
Serial.print(static_cast<uint32_t>(results->rawbuf[i] * kRawTick), DEC);
}
}
Serial.println("};");
Expand Down
Loading
Loading