diff --git a/src/app/clusters/scenes/SceneTableImpl.h b/src/app/clusters/scenes/SceneTableImpl.h index 11d83b14a5239d..c136d4f630c124 100644 --- a/src/app/clusters/scenes/SceneTableImpl.h +++ b/src/app/clusters/scenes/SceneTableImpl.h @@ -59,8 +59,7 @@ class DefaultSceneHandlerImpl : public scenes::SceneHandler // Verify size of list ReturnErrorOnFailure(extensionFieldSet.attributeValueList.ComputeSize(&pairTotal)); - VerifyOrReturnError(pairTotal <= Span(mAVPairs).size(), - CHIP_ERROR_BUFFER_TOO_SMALL); + VerifyOrReturnError(pairTotal <= ArraySize(mAVPairs), CHIP_ERROR_BUFFER_TOO_SMALL); auto pair_iterator = extensionFieldSet.attributeValueList.begin(); while (pair_iterator.Next()) @@ -71,7 +70,7 @@ class DefaultSceneHandlerImpl : public scenes::SceneHandler uint8_t valueBytesCount = 0; ReturnErrorOnFailure(aVPair.attributeValue.ComputeSize(&valueBytesTotal)); - VerifyOrReturnError(valueBytesTotal <= Span(mValueBuffer[0]).size(), CHIP_ERROR_BUFFER_TOO_SMALL); + VerifyOrReturnError(valueBytesTotal <= ArraySize(mValueBuffer[0]), CHIP_ERROR_BUFFER_TOO_SMALL); auto value_iterator = aVPair.attributeValue.begin(); while (value_iterator.Next()) @@ -128,8 +127,7 @@ class DefaultSceneHandlerImpl : public scenes::SceneHandler // Verify size of list ReturnErrorOnFailure(attributeValueList.ComputeSize(&pairTotal)); - VerifyOrReturnError(pairTotal <= Span(mAVPairs).size(), - CHIP_ERROR_BUFFER_TOO_SMALL); + VerifyOrReturnError(pairTotal <= ArraySize(mAVPairs), CHIP_ERROR_BUFFER_TOO_SMALL); auto pair_iterator = attributeValueList.begin(); while (pair_iterator.Next()) @@ -141,7 +139,7 @@ class DefaultSceneHandlerImpl : public scenes::SceneHandler // Verify size of attribute value ReturnErrorOnFailure(decodePair.attributeValue.ComputeSize(&valueBytesTotal)); - VerifyOrReturnError(valueBytesTotal <= Span(mValueBuffer[0]).size(), CHIP_ERROR_BUFFER_TOO_SMALL); + VerifyOrReturnError(valueBytesTotal <= ArraySize(mValueBuffer[0]), CHIP_ERROR_BUFFER_TOO_SMALL); auto value_iterator = decodePair.attributeValue.begin(); while (value_iterator.Next())