Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Boris Zbarsky <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Oct 12, 2023
1 parent be164e2 commit 81a52f8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
7 changes: 3 additions & 4 deletions src/app/clusters/scenes/ExtensionFieldSetsImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ CHIP_ERROR ExtensionFieldSetsImpl::Deserialize(TLV::TLVReader & reader, TLV::Tag
}
mFieldSetsCount = i;

// In the event of an OTA where the maximum number of cluster per scene has been reduced, the extension field set will be
// In the event of an OTA where the maximum number of clusters per scene has been reduced, the extension field set will be
// considered "corrupted" if we don't manage to load it all (if err == CHIP_NO_ERROR after the loop). We therefore return an
// error and this scene will have to be deleted. This is done because truncating an EFS doesn't garrantee the order of the
// clusters loaded, which might allow to load clusters that are no longer supported and loosing supported ones.
// error and this scene will have to be deleted. This is done because truncating an EFS doesn't guarantee the order of the
// clusters loaded, which might lead to loading clusters that are no longer supported and losing supported ones.
if (err != CHIP_END_OF_TLV)
{
if (err == CHIP_NO_ERROR)
Expand All @@ -75,7 +75,6 @@ CHIP_ERROR ExtensionFieldSetsImpl::Deserialize(TLV::TLVReader & reader, TLV::Tag

void ExtensionFieldSetsImpl::Clear()
{

for (uint8_t i = 0; i < mFieldSetsCount; i++)
{
mFieldSets[i].Clear();
Expand Down
3 changes: 2 additions & 1 deletion src/app/clusters/scenes/SceneTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ class SceneHandler : public IntrusiveListNodeBase<>
/// @param extensionFieldSet[in] ExtensionFieldSets provided by the AddScene Command, pre initialized
/// @param serialisedBytes[out] Buffer to fill from the ExtensionFieldSet in command
/// @return CHIP_NO_ERROR if successful, CHIP_ERROR value otherwise
/// @note Only gets called after the scene-cluster has previously verified that the endpoint,cluster valuer pair is supported by
/// @note Only gets called after the scene-cluster has previously verified that the endpoint,cluster pair is supported by

/// the handler. It is therefore the implementation's reponsibility to also implement the SupportsCluster method.
virtual CHIP_ERROR SerializeAdd(EndpointId endpoint,
const app::Clusters::Scenes::Structs::ExtensionFieldSet::DecodableType & extensionFieldSet,
Expand Down
4 changes: 0 additions & 4 deletions src/app/clusters/scenes/SceneTableImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,12 @@ class DefaultSceneHandlerImpl : public scenes::SceneHandler
mValueBuffer[pairCount][valueBytesCount] = value_iterator.GetValue();
valueBytesCount++;
}
// Check we could go through all bytes of the value
ReturnErrorOnFailure(value_iterator.GetStatus());

mAVPairs[pairCount].attributeValue = mValueBuffer[pairCount];
mAVPairs[pairCount].attributeValue.reduce_size(valueBytesCount);
pairCount++;
}
// Check we could go through all pairs in incomming command
ReturnErrorOnFailure(pair_iterator.GetStatus());

app::DataModel::List<app::Clusters::Scenes::Structs::AttributeValuePair::Type> attributeValueList;
Expand Down Expand Up @@ -149,14 +147,12 @@ class DefaultSceneHandlerImpl : public scenes::SceneHandler
mValueBuffer[pairCount][valueBytesCount] = value_iterator.GetValue();
valueBytesCount++;
}
// Check we could go through all bytes of the value
ReturnErrorOnFailure(value_iterator.GetStatus());

mAVPairs[pairCount].attributeValue = mValueBuffer[pairCount];
mAVPairs[pairCount].attributeValue.reduce_size(valueBytesCount);
pairCount++;
};
// Check we could go through all pairs stored in memory
ReturnErrorOnFailure(pair_iterator.GetStatus());

ReturnErrorOnFailure(reader.ExitContainer(outer));
Expand Down

0 comments on commit 81a52f8

Please sign in to comment.