Skip to content

Commit adb54cf

Browse files
restyled-commitswoody-apple
authored andcommitted
Restyled by clang-format
1 parent 53b38df commit adb54cf

File tree

3 files changed

+12
-29
lines changed

3 files changed

+12
-29
lines changed

src/darwin/Framework/CHIP/MTRDevice.mm

+4-9
Original file line numberDiff line numberDiff line change
@@ -3041,8 +3041,7 @@ - (void)_removeClusters:(NSSet *)clusterPathsToRemove
30413041

30423042
[_persistedClusters minusSet:clusterPathsToRemove];
30433043

3044-
for (MTRClusterPath * path in clusterPathsToRemove)
3045-
{
3044+
for (MTRClusterPath * path in clusterPathsToRemove) {
30463045
[_persistedClusterData removeObjectForKey:path];
30473046
[_persistedClusters removeObject:path];
30483047
[_clusterDataToPersist removeObjectForKey:path];
@@ -3052,14 +3051,12 @@ - (void)_removeClusters:(NSSet *)clusterPathsToRemove
30523051

30533052
- (void)_removeAttributes:(NSSet *)toBeRemovedAttributes fromCluster:(MTRClusterPath *)clusterPathToRemoveAttributesFrom
30543053
{
3055-
if (toBeRemovedAttributes == nil || clusterPathToRemoveAttributesFrom == nil)
3056-
{
3054+
if (toBeRemovedAttributes == nil || clusterPathToRemoveAttributesFrom == nil) {
30573055
return;
30583056
}
30593057
os_unfair_lock_assert_owner(&self->_lock);
30603058

3061-
for (NSNumber * attribute in toBeRemovedAttributes)
3062-
{
3059+
for (NSNumber * attribute in toBeRemovedAttributes) {
30633060
[self _removeCachedAttribute:attribute fromCluster:clusterPathToRemoveAttributesFrom];
30643061
}
30653062
[_persistedClusterData removeObjectForKey:clusterPathToRemoveAttributesFrom];
@@ -3098,9 +3095,7 @@ - (void)_pruneOrphanedEndpointsAndClusters:(MTRAttributePath *)attributePath
30983095
[self _removeClusters:[clusterPathsToRemove copy]];
30993096
[self.deviceController.controllerDataStore removeEndpointFromEndpointIndex:endpoint forNodeID:self.nodeID];
31003097
}
3101-
}
3102-
else if (attributePath.attribute.unsignedLongValue == MTRAttributeIDTypeClusterDescriptorAttributeServerListID)
3103-
{
3098+
} else if (attributePath.attribute.unsignedLongValue == MTRAttributeIDTypeClusterDescriptorAttributeServerListID) {
31043099

31053100
// If the server list changed and clusters were removed, remove the clusters from the _persistedClusters, _persistedClusterData and _clusterDataToPersist for all those clusters.
31063101
// Also remove it from the data store.

src/darwin/Framework/CHIP/MTRDeviceControllerDataStore.mm

+3-7
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,6 @@ - (BOOL)_storeEndpointIndex:(NSArray<NSNumber *> *)endpointIndex forNodeID:(NSNu
446446
return [self _storeAttributeCacheValue:endpointIndex forKey:[self _endpointIndexKeyForNodeID:nodeID]];
447447
}
448448

449-
450449
- (void)removeEndpointFromEndpointIndex:(NSNumber *)endpointID forNodeID:(NSNumber *)nodeID
451450
{
452451
if (!endpointID || !nodeID) {
@@ -461,8 +460,7 @@ - (void)removeEndpointFromEndpointIndex:(NSNumber *)endpointID forNodeID:(NSNumb
461460

462461
[endpointIndex removeObject:endpointID];
463462
BOOL success = [self _storeEndpointIndex:endpointIndex forNodeID:nodeID];
464-
if (!success)
465-
{
463+
if (!success) {
466464
MTR_LOG_ERROR("removeEndpointFromEndpointIndex: _storeEndpointIndex for node 0x%016llX", nodeID.unsignedLongLongValue);
467465
}
468466
});
@@ -745,12 +743,10 @@ - (void)clearStoredClusterDataForNodeID:(NSNumber *)nodeID endpointID:(NSNumber
745743
- (void)removeAttributes:(NSSet<NSNumber *> *)attributes fromCluster:(MTRClusterPath *)path forNodeID:(NSNumber *)nodeID
746744
{
747745
MTRDeviceClusterData * clusterData = [self getStoredClusterDataForNodeID:nodeID endpointID:path.endpoint clusterID:path.cluster];
748-
if (clusterData == nil)
749-
{
746+
if (clusterData == nil) {
750747
return;
751748
}
752-
for (NSNumber * attribute in attributes)
753-
{
749+
for (NSNumber * attribute in attributes) {
754750
[clusterData removeValueForAttribute:attribute];
755751
}
756752
[self _storeClusterData:clusterData forNodeID:nodeID endpointID:path.endpoint clusterID:path.cluster];

src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m

+5-13
Original file line numberDiff line numberDiff line change
@@ -2342,7 +2342,6 @@ - (MTRDevice *)getMTRDevice:(NSNumber *)deviceID
23422342

23432343
[endpoints addObjectsFromArray:[device arrayOfNumbersFromAttributeValue:[device _dataValueWithoutDataVersion:partsList]]];
23442344
return endpoints;
2345-
23462345
}
23472346

23482347
- (void)test011_testDataStorageUpdatesWhenRemovingEndpoints
@@ -2385,7 +2384,7 @@ - (void)test011_testDataStorageUpdatesWhenRemovingEndpoints
23852384
}
23862385
};
23872386

2388-
__block NSMutableDictionary<NSNumber * , NSArray<NSNumber *> *> * initialClusterIndex = [[NSMutableDictionary alloc] init];
2387+
__block NSMutableDictionary<NSNumber *, NSArray<NSNumber *> *> * initialClusterIndex = [[NSMutableDictionary alloc] init];
23892388
__block NSMutableArray * testEndpoints;
23902389

23912390
delegate.onReportEnd = ^{
@@ -2399,8 +2398,7 @@ - (void)test011_testDataStorageUpdatesWhenRemovingEndpoints
23992398
dispatch_sync(self->_storageQueue, ^{
24002399
XCTAssertTrue([[controller.controllerDataStore _fetchEndpointIndexForNodeID:deviceID] isEqualToArray:testEndpoints]);
24012400
// Populate the initialClusterIndex to use as a reference for all cluster paths later.
2402-
for (NSNumber * endpoint in testEndpoints)
2403-
{
2401+
for (NSNumber * endpoint in testEndpoints) {
24042402
[initialClusterIndex setObject:[controller.controllerDataStore _fetchClusterIndexForNodeID:deviceID endpointID:endpoint] forKey:endpoint];
24052403
}
24062404
XCTAssertNotNil(initialClusterIndex);
@@ -2605,12 +2603,9 @@ - (void)test012_testDataStorageUpdatesWhenRemovingClusters
26052603
dispatch_sync(self->_storageQueue, ^{
26062604
XCTAssertFalse([[controller.controllerDataStore _fetchClusterIndexForNodeID:deviceID endpointID:testEndpoint] containsObject:toBeDeletedCluster]);
26072605
for (NSNumber * cluster in initialClusterIndex) {
2608-
if ([cluster isEqualToNumber:toBeDeletedCluster])
2609-
{
2606+
if ([cluster isEqualToNumber:toBeDeletedCluster]) {
26102607
XCTAssertNil([controller.controllerDataStore _fetchClusterDataForNodeID:deviceID endpointID:testEndpoint clusterID:cluster]);
2611-
}
2612-
else
2613-
{
2608+
} else {
26142609
XCTAssertNotNil([controller.controllerDataStore _fetchClusterDataForNodeID:deviceID endpointID:testEndpoint clusterID:cluster]);
26152610
}
26162611
}
@@ -2682,7 +2677,6 @@ - (void)test013_testDataStorageUpdatesWhenRemovingAttributes
26822677
XCTAssertNotNil(testClusterDataValue);
26832678

26842679
dispatch_sync(self->_storageQueue, ^{
2685-
26862680
initialClusterIndex = [[controller.controllerDataStore _fetchClusterIndexForNodeID:deviceID endpointID:testEndpoint] mutableCopy];
26872681
XCTAssertNotNil(initialClusterIndex);
26882682

@@ -2693,7 +2687,7 @@ - (void)test013_testDataStorageUpdatesWhenRemovingAttributes
26932687
// We will be paged in the cluster data from storage to check the above.
26942688
MTRClusterPath * path = [MTRClusterPath clusterPathWithEndpointID:testEndpoint clusterID:cluster];
26952689

2696-
if ([cluster isEqualToNumber:@(MTRClusterIDTypeIdentifyID)]) {
2690+
if ([cluster isEqualToNumber:@(MTRClusterIDTypeIdentifyID)]) {
26972691
MTRDeviceClusterData * data = [device _getClusterDataForPath:path];
26982692
XCTAssertNotNil(data);
26992693
XCTAssertNotNil(data.attributes);
@@ -2709,7 +2703,6 @@ - (void)test013_testDataStorageUpdatesWhenRemovingAttributes
27092703
}
27102704
}
27112705
}
2712-
27132706
});
27142707

27152708
[subscriptionExpectation fulfill];
@@ -2741,7 +2734,6 @@ - (void)test013_testDataStorageUpdatesWhenRemovingAttributes
27412734
};
27422735

27432736
delegate.onReportEnd = ^{
2744-
27452737
// Make sure that the cluster data in the data storage is populated with cluster data for MTRClusterIDTypeIdentifyID cluster
27462738
// and has all attributes except attribute 1 which was deleted.
27472739
// We will be paged in the cluster data from storage to check the above.

0 commit comments

Comments
 (0)