diff --git a/src/IRrecv.cpp b/src/IRrecv.cpp index f8496feb3..3cd88b377 100644 --- a/src/IRrecv.cpp +++ b/src/IRrecv.cpp @@ -1220,7 +1220,8 @@ uint32_t IRrecv::ticksLow(const uint32_t usecs, const uint8_t tolerance, const uint16_t delta) { // max() used to ensure the result can't drop below 0 before the cast. return (static_cast(std::max( - static_cast(usecs * (1.0 - _validTolerance(tolerance) / 100.0) - delta), + static_cast(usecs * (1.0 - _validTolerance(tolerance) / 100.0) - + delta), static_cast(0)))); } diff --git a/src/ir_Haier.cpp b/src/ir_Haier.cpp index 069cb154a..c18846942 100644 --- a/src/ir_Haier.cpp +++ b/src/ir_Haier.cpp @@ -743,7 +743,7 @@ void IRHaierAC176::setTemp(const uint8_t degree, const bool fahrenheit) { /// The unit of temperature is specified by UseFahrenheit value. /// @return The current setting for temperature. uint8_t IRHaierAC176::getTemp(void) const { - if (!_.UseFahrenheit) + if (!_.UseFahrenheit) return _.Temp + kHaierAcYrw02MinTempC; uint8_t degree = _.Temp*2 + kHaierAcYrw02MinTempF + _.ExtraDegreeF; // The way of coding the temperature in degree Fahrenheit is diff --git a/src/ir_Panasonic.cpp b/src/ir_Panasonic.cpp index a9426e450..37241570c 100644 --- a/src/ir_Panasonic.cpp +++ b/src/ir_Panasonic.cpp @@ -89,8 +89,7 @@ void IRsend::sendPanasonic64(const uint64_t data, const uint16_t nbits, void IRsend::sendPanasonic(const uint16_t address, const uint32_t data, const uint16_t nbits, const uint16_t repeat) { sendPanasonic64(static_cast(address) << 32 | - static_cast(data), - nbits, repeat); + static_cast(data), nbits, repeat); } /// Calculate the raw Panasonic data based on device, subdevice, & function. diff --git a/src/ir_RC5_RC6.cpp b/src/ir_RC5_RC6.cpp index 1e0c75b3f..c47303aa2 100644 --- a/src/ir_RC5_RC6.cpp +++ b/src/ir_RC5_RC6.cpp @@ -129,7 +129,7 @@ uint16_t IRsend::encodeRC5X(const uint8_t address, const uint8_t command, // The 2nd start/field bit (MSB of the return value) is the value of the 7th // command bit. bool s2 = (command >> 6) & 1; - return ((uint16_t)s2 << (kRC5XBits - 1)) | + return (static_cast(s2) << (kRC5XBits - 1)) | encodeRC5(address, command, key_released); } @@ -174,7 +174,8 @@ uint64_t IRsend::encodeRC6(const uint32_t address, const uint8_t command, case kRC6Mode0Bits: return ((address & 0xFFF) << 8) | (command & 0xFF); case kRC6_36Bits: - return ((uint64_t)(address & 0xFFFFFFF) << 8) | (command & 0xFF); + return (static_cast(address & 0xFFFFFFF) << 8) | + (command & 0xFF); default: return 0; } @@ -360,7 +361,7 @@ bool IRrecv::decodeRC5(decode_results *results, uint16_t offset, results->repeat = false; if (is_rc5x) { results->decode_type = RC5X; - results->command |= ((uint32_t)is_rc5x) << 6; + results->command |= (static_cast(is_rc5x)) << 6; } else { results->decode_type = RC5; actual_bits--; // RC5 doesn't count the field bit as data. diff --git a/src/ir_Sanyo.cpp b/src/ir_Sanyo.cpp index 4b99d0492..6c939e18d 100644 --- a/src/ir_Sanyo.cpp +++ b/src/ir_Sanyo.cpp @@ -892,7 +892,8 @@ uint16_t IRSanyoAc88::getClock(void) const { /// Set the current clock time. /// @param[in] mins_since_midnight The time as nr. of minutes past midnight. void IRSanyoAc88::setClock(const uint16_t mins_since_midnight) { - uint16_t mins = std::min(mins_since_midnight, (uint16_t)(23 * 60 + 59)); + uint16_t mins = std::min(mins_since_midnight, + static_cast(23 * 60 + 59)); _.ClockMins = mins % 60; _.ClockHrs = mins / 60; _.ClockSecs = 0; diff --git a/src/ir_Sharp.cpp b/src/ir_Sharp.cpp index d184c9301..984551ee0 100644 --- a/src/ir_Sharp.cpp +++ b/src/ir_Sharp.cpp @@ -35,9 +35,11 @@ const uint16_t kSharpGapTicks = 1677; const uint16_t kSharpGap = kSharpGapTicks * kSharpTick; // Address(5) + Command(8) + Expansion(1) + Check(1) const uint64_t kSharpToggleMask = - ((uint64_t)1 << (kSharpBits - kSharpAddressBits)) - 1; -const uint64_t kSharpAddressMask = ((uint64_t)1 << kSharpAddressBits) - 1; -const uint64_t kSharpCommandMask = ((uint64_t)1 << kSharpCommandBits) - 1; + (static_cast(1) << (kSharpBits - kSharpAddressBits)) - 1; +const uint64_t kSharpAddressMask = (static_cast(1) << + kSharpAddressBits) - 1; +const uint64_t kSharpCommandMask = (static_cast(1) << + kSharpCommandBits) - 1; using irutils::addBoolToString; using irutils::addFanToString; diff --git a/src/ir_Xmp.cpp b/src/ir_Xmp.cpp index ac62e272a..a60bcdbbb 100644 --- a/src/ir_Xmp.cpp +++ b/src/ir_Xmp.cpp @@ -126,8 +126,8 @@ void IRsend::sendXmp(const uint64_t data, const uint16_t nbits, uint64_t send_data = data; for (uint16_t r = 0; r <= repeat; r++) { uint16_t bits_so_far = kXmpWordSize; - for (uint64_t mask = static_cast(kXmpMaxWordValue) << (nbits - - kXmpWordSize); + for (uint64_t mask = static_cast(kXmpMaxWordValue) << + (nbits - kXmpWordSize); mask; mask >>= kXmpWordSize) { uint8_t word = (send_data & mask) >> (nbits - bits_so_far); diff --git a/test/ir_Argo_test.cpp b/test/ir_Argo_test.cpp index 8aaef5a3f..0a83ef50e 100644 --- a/test/ir_Argo_test.cpp +++ b/test/ir_Argo_test.cpp @@ -4,7 +4,9 @@ #include #include #include +#include #include +#include #include #include #include "ir_Argo.h" diff --git a/test/ir_Gorenje_test.cpp b/test/ir_Gorenje_test.cpp index 5877aac6d..dc803ffdd 100644 --- a/test/ir_Gorenje_test.cpp +++ b/test/ir_Gorenje_test.cpp @@ -1,5 +1,6 @@ // Copyright 2022 Mateusz Bronk (mbronk) +#include #include #include "IRac.h" #include "IRsend.h"