Skip to content

Commit 90dc9a6

Browse files
Apply suggestions from code review
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
1 parent 90daf92 commit 90dc9a6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/app/clusters/scenes-server/SceneHandlerImpl.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ template <typename Type>
3737
typename app::NumericAttributeTraits<Type>::WorkingType
3838
ConvertDefaultValueToWorkingValue(const EmberAfDefaultAttributeValue & defaultValue)
3939
{
40-
if (sizeof(typename app::NumericAttributeTraits<Type>::WorkingType) <= 2)
40+
if constexpr (sizeof(typename app::NumericAttributeTraits<Type>::WorkingType) <= 2)
4141
{
4242
return static_cast<typename app::NumericAttributeTraits<Type>::WorkingType>(defaultValue.defaultValue);
4343
}
@@ -48,10 +48,10 @@ ConvertDefaultValueToWorkingValue(const EmberAfDefaultAttributeValue & defaultVa
4848
}
4949

5050
/// IsOnlyOneValuePopulated
51-
/// @brief Helper function to verify if only one value is populated in a given AttributeValuePairType
51+
/// @brief Helper function to verify that exactly one value is populated in a given AttributeValuePairType
5252
/// @param AttributeValuePairType & type AttributeValuePairType to verify
5353
/// @return bool true if only one value is populated, false otherwise
54-
bool IsOnlyOneValuePopulated(const AttributeValuePairType & type)
54+
bool IsExactlyOneValuePopulated(const AttributeValuePairType & type)
5555
{
5656
int count = 0;
5757
if (type.valueUnsigned8.HasValue())
@@ -80,7 +80,7 @@ bool IsOnlyOneValuePopulated(const AttributeValuePairType & type)
8080
/// @param[in] metadata EmberAfAttributeMetadata
8181
///
8282
template <typename Type>
83-
void CapAttributeID(typename app::NumericAttributeTraits<Type>::WorkingType & Value, const EmberAfAttributeMetadata * metadata)
83+
void CapAttributeValue(typename app::NumericAttributeTraits<Type>::WorkingType & value, const EmberAfAttributeMetadata * metadata)
8484
{
8585
using IntType = app::NumericAttributeTraits<Type>;
8686
using WorkingType = typename IntType::WorkingType;
@@ -89,7 +89,7 @@ void CapAttributeID(typename app::NumericAttributeTraits<Type>::WorkingType & Va
8989
WorkingType minValue;
9090
uint16_t bitWidth = static_cast<uint16_t>(emberAfAttributeSize(metadata) * 8);
9191

92-
// Min/Max Value capps for the OddSize integers
92+
// Min/Max Value caps for the OddSize integers
9393
if (metadata->IsSignedIntegerAttribute())
9494
{
9595
// We use emberAfAttributeSize for cases like INT24S, INT40S, INT48S, INT56S where numeric_limits<WorkingType>::max()

0 commit comments

Comments
 (0)