Skip to content

Commit

Permalink
Fix comments and naming for Darwin invoke responses validation. (#37460)
Browse files Browse the repository at this point in the history
Some typos crept in, and the function argument name was sub-optimal.
  • Loading branch information
bzbarsky-apple authored Feb 7, 2025
1 parent 333e921 commit 841df09
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/darwin/Framework/CHIP/MTRDeviceDataValidation.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ MTR_EXTERN MTR_TESTABLE BOOL MTREventReportIsWellFormed(NSArray<MTRDeviceRespons
// objects in the right places.
MTR_EXTERN MTR_TESTABLE BOOL MTRInvokeResponseIsWellFormed(NSArray<MTRDeviceResponseValueDictionary> * response);

// Returns whether the provided invoke reponses actually has the right sorts of
// objects in the right places. This differes from
// MTRInvokeResponseIsWellFormed in not enforcing that there is only one response.
MTR_EXTERN MTR_TESTABLE BOOL MTRInvokeResponsesAreWellFormed(NSArray<MTRDeviceResponseValueDictionary> * response);
// Returns whether the provided invoke responses actually have the right sorts of objects in the
// right places. This differs from MTRInvokeResponseIsWellFormed in not enforcing that there is
// only one response.
MTR_EXTERN MTR_TESTABLE BOOL MTRInvokeResponsesAreWellFormed(NSArray<MTRDeviceResponseValueDictionary> * responses);

NS_ASSUME_NONNULL_END
8 changes: 4 additions & 4 deletions src/darwin/Framework/CHIP/MTRDeviceDataValidation.mm
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,14 @@ BOOL MTRInvokeResponseIsWellFormed(NSArray<MTRDeviceResponseValueDictionary> * r
return YES;
}

BOOL MTRInvokeResponsesAreWellFormed(NSArray<MTRDeviceResponseValueDictionary> * response)
BOOL MTRInvokeResponsesAreWellFormed(NSArray<MTRDeviceResponseValueDictionary> * responses)
{
if (!MTR_SAFE_CAST(response, NSArray)) {
MTR_LOG_ERROR("Invoke response is not an array: %@", response);
if (!MTR_SAFE_CAST(responses, NSArray)) {
MTR_LOG_ERROR("Invoke responses are not an array: %@", responses);
return NO;
}

for (MTRDeviceResponseValueDictionary responseValue in response) {
for (MTRDeviceResponseValueDictionary responseValue in responses) {
// Each entry must be a dictionary that has MTRCommandPathKey.

if (!MTR_SAFE_CAST(responseValue, NSDictionary) || !MTR_SAFE_CAST(responseValue[MTRCommandPathKey], MTRCommandPath)) {
Expand Down

0 comments on commit 841df09

Please sign in to comment.