Skip to content

Commit 100dcd3

Browse files
restyled-commitsnivi-apple
authored andcommitted
Restyled by clang-format
1 parent 4663c46 commit 100dcd3

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
@@ -2751,8 +2751,7 @@ - (void)_removeClusters:(NSSet *)clusterPathsToRemove
27512751

27522752
[_persistedClusters minusSet:clusterPathsToRemove];
27532753

2754-
for (MTRClusterPath * path in clusterPathsToRemove)
2755-
{
2754+
for (MTRClusterPath * path in clusterPathsToRemove) {
27562755
[_persistedClusterData removeObjectForKey:path];
27572756
[_persistedClusters removeObject:path];
27582757
[_clusterDataToPersist removeObjectForKey:path];
@@ -2762,14 +2761,12 @@ - (void)_removeClusters:(NSSet *)clusterPathsToRemove
27622761

27632762
- (void)_removeAttributes:(NSSet *)toBeRemovedAttributes fromCluster:(MTRClusterPath *)clusterPathToRemoveAttributesFrom
27642763
{
2765-
if (toBeRemovedAttributes == nil || clusterPathToRemoveAttributesFrom == nil)
2766-
{
2764+
if (toBeRemovedAttributes == nil || clusterPathToRemoveAttributesFrom == nil) {
27672765
return;
27682766
}
27692767
os_unfair_lock_assert_owner(&self->_lock);
27702768

2771-
for (NSNumber * attribute in toBeRemovedAttributes)
2772-
{
2769+
for (NSNumber * attribute in toBeRemovedAttributes) {
27732770
[self _removeCachedAttribute:attribute fromCluster:clusterPathToRemoveAttributesFrom];
27742771
}
27752772
[_persistedClusterData removeObjectForKey:clusterPathToRemoveAttributesFrom];
@@ -2808,9 +2805,7 @@ - (void)_pruneOrphanedEndpointsAndClusters:(MTRAttributePath *)attributePath
28082805
[self _removeClusters:[clusterPathsToRemove copy]];
28092806
[self.deviceController.controllerDataStore removeEndpointFromEndpointIndex:endpoint forNodeID:self.nodeID];
28102807
}
2811-
}
2812-
else if (attributePath.attribute.unsignedLongValue == MTRAttributeIDTypeClusterDescriptorAttributeServerListID)
2813-
{
2808+
} else if (attributePath.attribute.unsignedLongValue == MTRAttributeIDTypeClusterDescriptorAttributeServerListID) {
28142809

28152810
// If the server list changed and clusters were removed, remove the clusters from the _persistedClusters, _persistedClusterData and _clusterDataToPersist for all those clusters.
28162811
// 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
@@ -2222,7 +2222,6 @@ - (MTRDevice *)getMTRDevice:(NSNumber *)deviceID
22222222

22232223
[endpoints addObjectsFromArray:[device arrayOfNumbersFromAttributeValue:[device _dataValueWithoutDataVersion:partsList]]];
22242224
return endpoints;
2225-
22262225
}
22272226

22282227
- (void)test011_testDataStorageUpdatesWhenRemovingEndpoints
@@ -2265,7 +2264,7 @@ - (void)test011_testDataStorageUpdatesWhenRemovingEndpoints
22652264
}
22662265
};
22672266

2268-
__block NSMutableDictionary<NSNumber * , NSArray<NSNumber *> *> * initialClusterIndex = [[NSMutableDictionary alloc] init];
2267+
__block NSMutableDictionary<NSNumber *, NSArray<NSNumber *> *> * initialClusterIndex = [[NSMutableDictionary alloc] init];
22692268
__block NSMutableArray * testEndpoints;
22702269

22712270
delegate.onReportEnd = ^{
@@ -2279,8 +2278,7 @@ - (void)test011_testDataStorageUpdatesWhenRemovingEndpoints
22792278
dispatch_sync(self->_storageQueue, ^{
22802279
XCTAssertTrue([[controller.controllerDataStore _fetchEndpointIndexForNodeID:deviceID] isEqualToArray:testEndpoints]);
22812280
// Populate the initialClusterIndex to use as a reference for all cluster paths later.
2282-
for (NSNumber * endpoint in testEndpoints)
2283-
{
2281+
for (NSNumber * endpoint in testEndpoints) {
22842282
[initialClusterIndex setObject:[controller.controllerDataStore _fetchClusterIndexForNodeID:deviceID endpointID:endpoint] forKey:endpoint];
22852283
}
22862284
XCTAssertNotNil(initialClusterIndex);
@@ -2485,12 +2483,9 @@ - (void)test012_testDataStorageUpdatesWhenRemovingClusters
24852483
dispatch_sync(self->_storageQueue, ^{
24862484
XCTAssertFalse([[controller.controllerDataStore _fetchClusterIndexForNodeID:deviceID endpointID:testEndpoint] containsObject:toBeDeletedCluster]);
24872485
for (NSNumber * cluster in initialClusterIndex) {
2488-
if ([cluster isEqualToNumber:toBeDeletedCluster])
2489-
{
2486+
if ([cluster isEqualToNumber:toBeDeletedCluster]) {
24902487
XCTAssertNil([controller.controllerDataStore _fetchClusterDataForNodeID:deviceID endpointID:testEndpoint clusterID:cluster]);
2491-
}
2492-
else
2493-
{
2488+
} else {
24942489
XCTAssertNotNil([controller.controllerDataStore _fetchClusterDataForNodeID:deviceID endpointID:testEndpoint clusterID:cluster]);
24952490
}
24962491
}
@@ -2562,7 +2557,6 @@ - (void)test013_testDataStorageUpdatesWhenRemovingAttributes
25622557
XCTAssertNotNil(testClusterDataValue);
25632558

25642559
dispatch_sync(self->_storageQueue, ^{
2565-
25662560
initialClusterIndex = [[controller.controllerDataStore _fetchClusterIndexForNodeID:deviceID endpointID:testEndpoint] mutableCopy];
25672561
XCTAssertNotNil(initialClusterIndex);
25682562

@@ -2573,7 +2567,7 @@ - (void)test013_testDataStorageUpdatesWhenRemovingAttributes
25732567
// We will be paged in the cluster data from storage to check the above.
25742568
MTRClusterPath * path = [MTRClusterPath clusterPathWithEndpointID:testEndpoint clusterID:cluster];
25752569

2576-
if ([cluster isEqualToNumber:@(MTRClusterIDTypeIdentifyID)]) {
2570+
if ([cluster isEqualToNumber:@(MTRClusterIDTypeIdentifyID)]) {
25772571
MTRDeviceClusterData * data = [device _getClusterDataForPath:path];
25782572
XCTAssertNotNil(data);
25792573
XCTAssertNotNil(data.attributes);
@@ -2589,7 +2583,6 @@ - (void)test013_testDataStorageUpdatesWhenRemovingAttributes
25892583
}
25902584
}
25912585
}
2592-
25932586
});
25942587

25952588
[subscriptionExpectation fulfill];
@@ -2621,7 +2614,6 @@ - (void)test013_testDataStorageUpdatesWhenRemovingAttributes
26212614
};
26222615

26232616
delegate.onReportEnd = ^{
2624-
26252617
// Make sure that the cluster data in the data storage is populated with cluster data for MTRClusterIDTypeIdentifyID cluster
26262618
// and has all attributes except attribute 1 which was deleted.
26272619
// We will be paged in the cluster data from storage to check the above.

0 commit comments

Comments
 (0)