Skip to content

Commit 53b38df

Browse files
restyled-commitswoody-apple
authored andcommitted
Restyled by whitespace
1 parent b041f16 commit 53b38df

File tree

3 files changed

+35
-35
lines changed

3 files changed

+35
-35
lines changed

src/darwin/Framework/CHIP/MTRDevice.mm

+7-7
Original file line numberDiff line numberDiff line change
@@ -3038,9 +3038,9 @@ - (BOOL)_attributeAffectsDeviceConfiguration:(MTRAttributePath *)attributePath
30383038
- (void)_removeClusters:(NSSet *)clusterPathsToRemove
30393039
{
30403040
os_unfair_lock_assert_owner(&self->_lock);
3041-
3041+
30423042
[_persistedClusters minusSet:clusterPathsToRemove];
3043-
3043+
30443044
for (MTRClusterPath * path in clusterPathsToRemove)
30453045
{
30463046
[_persistedClusterData removeObjectForKey:path];
@@ -3057,7 +3057,7 @@ - (void)_removeAttributes:(NSSet *)toBeRemovedAttributes fromCluster:(MTRCluster
30573057
return;
30583058
}
30593059
os_unfair_lock_assert_owner(&self->_lock);
3060-
3060+
30613061
for (NSNumber * attribute in toBeRemovedAttributes)
30623062
{
30633063
[self _removeCachedAttribute:attribute fromCluster:clusterPathToRemoveAttributesFrom];
@@ -3071,7 +3071,7 @@ - (void)_pruneOrphanedEndpointsAndClusters:(MTRAttributePath *)attributePath
30713071
attributeDataValue:(NSDictionary *)attributeDataValue
30723072
{
30733073
os_unfair_lock_assert_owner(&self->_lock);
3074-
3074+
30753075
NSNumber * rootEndpoint = @0;
30763076

30773077
if (_persistedClusters == nil || _persistedClusterData == nil || !previousValue.count) {
@@ -3081,7 +3081,7 @@ - (void)_pruneOrphanedEndpointsAndClusters:(MTRAttributePath *)attributePath
30813081
// If yes, we might need to prune any deleted endpoints, clusters or attributes from the storage and persisted cluster data.
30823082
if (attributePath.cluster.unsignedLongValue == MTRClusterIDTypeDescriptorID) {
30833083
if (attributePath.attribute.unsignedLongValue == MTRAttributeIDTypeClusterDescriptorAttributePartsListID && [attributePath.endpoint isEqualToNumber:rootEndpoint]) {
3084-
3084+
30853085
// If the parts list changed and one or more endpoints were removed, remove all the clusters in _persistedClusters, _persistedClusterData and _clusterDataToPersist for all those endpoints.
30863086
// Also remove it from the data store.
30873087
NSMutableSet * toBeRemovedEndpoints = [NSMutableSet setWithArray:[self arrayOfNumbersFromAttributeValue:previousValue]];
@@ -3101,7 +3101,7 @@ - (void)_pruneOrphanedEndpointsAndClusters:(MTRAttributePath *)attributePath
31013101
}
31023102
else if (attributePath.attribute.unsignedLongValue == MTRAttributeIDTypeClusterDescriptorAttributeServerListID)
31033103
{
3104-
3104+
31053105
// If the server list changed and clusters were removed, remove the clusters from the _persistedClusters, _persistedClusterData and _clusterDataToPersist for all those clusters.
31063106
// Also remove it from the data store.
31073107
NSMutableSet<NSNumber *> * toBeRemovedClusters = [NSMutableSet setWithArray:[self arrayOfNumbersFromAttributeValue:[self _dataValueWithoutDataVersion:previousValue]]];
@@ -3121,7 +3121,7 @@ - (void)_pruneOrphanedEndpointsAndClusters:(MTRAttributePath *)attributePath
31213121
}
31223122

31233123
if (attributePath.attribute.unsignedLongValue == MTRAttributeIDTypeGlobalAttributeAttributeListID) {
3124-
3124+
31253125
// If the attribute list changed and attributes were removed, remove the attributes from the _clusterDataToPersist for that cluster and endpoint.
31263126
// Clear out the _peristedClusterData and data store cluster data. Update the data storage with updated cluster data.
31273127
NSMutableSet<NSNumber *> * toBeRemovedAttributes = [NSMutableSet setWithArray:[self arrayOfNumbersFromAttributeValue:[self _cachedAttributeValueForPath:attributePath]]];

src/darwin/Framework/CHIP/MTRDeviceControllerDataStore.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ - (void)removeEndpointFromEndpointIndex:(NSNumber *)endpointID forNodeID:(NSNumb
458458
if (endpointIndex == nil) {
459459
return;
460460
}
461-
461+
462462
[endpointIndex removeObject:endpointID];
463463
BOOL success = [self _storeEndpointIndex:endpointIndex forNodeID:nodeID];
464464
if (!success)

src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m

+27-27
Original file line numberDiff line numberDiff line change
@@ -2327,7 +2327,7 @@ - (MTRDevice *)getMTRDevice:(NSNumber *)deviceID
23272327
XCTAssertTrue([controller isRunning]);
23282328

23292329
XCTAssertEqualObjects(controller.controllerNodeID, nodeID);
2330-
2330+
23312331
certificateIssuer.nextNodeID = deviceID;
23322332
[self commissionWithController:controller newNodeID:deviceID];
23332333

@@ -2339,10 +2339,10 @@ - (MTRDevice *)getMTRDevice:(NSNumber *)deviceID
23392339
{
23402340
// Initialize the endpoint array with endpoint 0.
23412341
NSMutableArray<NSNumber *> * endpoints = [NSMutableArray arrayWithObject:@0];
2342-
2342+
23432343
[endpoints addObjectsFromArray:[device arrayOfNumbersFromAttributeValue:[device _dataValueWithoutDataVersion:partsList]]];
23442344
return endpoints;
2345-
2345+
23462346
}
23472347

23482348
- (void)test011_testDataStorageUpdatesWhenRemovingEndpoints
@@ -2392,7 +2392,7 @@ - (void)test011_testDataStorageUpdatesWhenRemovingEndpoints
23922392
XCTAssertNotNil(dataVersionForPartsList);
23932393
XCTAssertNotNil(testClusterDataValueForPartsList);
23942394
testEndpoints = [self getEndpointArrayFromPartsList:testDataForPartsList forDevice:device];
2395-
2395+
23962396
// Make sure that the cluster data in the data storage is populated with cluster index and cluster data for endpoints 0, 1 and 2.
23972397
// We do not need to check _persistedClusterData here. _persistedClusterData will be paged in from storage when needed so
23982398
// just checking data storage should suffice here.
@@ -2404,7 +2404,7 @@ - (void)test011_testDataStorageUpdatesWhenRemovingEndpoints
24042404
[initialClusterIndex setObject:[controller.controllerDataStore _fetchClusterIndexForNodeID:deviceID endpointID:endpoint] forKey:endpoint];
24052405
}
24062406
XCTAssertNotNil(initialClusterIndex);
2407-
2407+
24082408
for (NSNumber * endpoint in testEndpoints) {
24092409
for (NSNumber * cluster in [initialClusterIndex objectForKey:endpoint]) {
24102410
XCTAssertNotNil([controller.controllerDataStore _fetchClusterDataForNodeID:deviceID endpointID:endpoint clusterID:cluster]);
@@ -2417,10 +2417,10 @@ - (void)test011_testDataStorageUpdatesWhenRemovingEndpoints
24172417
[device setDelegate:delegate queue:queue];
24182418

24192419
[self waitForExpectations:@[ subscriptionExpectation ] timeout:60];
2420-
2420+
24212421
// Inject a fake attribute report deleting endpoint 2 from the parts list at the root endpoint.
24222422
dataVersionForPartsList = [NSNumber numberWithUnsignedLongLong:(dataVersionForPartsList.unsignedLongLongValue + 1)];
2423-
2423+
24242424
// Delete the last endpoint from the attribute value in parts list.
24252425
NSNumber * toBeDeletedEndpoint = @2;
24262426
__block id endpointData =
@@ -2430,9 +2430,9 @@ - (void)test011_testDataStorageUpdatesWhenRemovingEndpoints
24302430
MTRValueKey : toBeDeletedEndpoint,
24312431
}
24322432
};
2433-
2433+
24342434
[testClusterDataValueForPartsList removeObject:endpointData];
2435-
2435+
24362436
NSArray<NSDictionary<NSString *, id> *> * attributeReport = @[ @{
24372437
MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:rootEndpoint clusterID:@(MTRClusterIDTypeDescriptorID) attributeID:@(MTRAttributeIDTypeClusterDescriptorAttributePartsListID)],
24382438
MTRDataKey : @ {
@@ -2447,7 +2447,7 @@ - (void)test011_testDataStorageUpdatesWhenRemovingEndpoints
24472447
delegate.onAttributeDataReceived = ^(NSArray<NSDictionary<NSString *, id> *> * attributeReport) {
24482448
attributeReportsReceived += attributeReport.count;
24492449
XCTAssert(attributeReportsReceived > 0);
2450-
2450+
24512451
for (NSDictionary<NSString *, id> * attributeDict in attributeReport) {
24522452
MTRAttributePath * attributePath = attributeDict[MTRAttributePathKey];
24532453
XCTAssertNotNil(attributePath);
@@ -2510,13 +2510,13 @@ - (void)test012_testDataStorageUpdatesWhenRemovingClusters
25102510
__auto_type queue = dispatch_get_main_queue();
25112511
__auto_type * delegate = [[MTRDeviceTestDelegate alloc] init];
25122512
__auto_type * controller = device.deviceController;
2513-
2513+
25142514
XCTestExpectation * subscriptionExpectation = [self expectationWithDescription:@"Subscription has been set up"];
2515-
2515+
25162516
__block unsigned attributeReportsReceived = 0;
25172517
__block NSNumber * dataVersionForServerList;
25182518
__block NSNumber * testEndpoint = @1;
2519-
2519+
25202520
// This test will do the following -
25212521
// 1. Get the data version and attribute value of the server list for endpoint 1 to inject a fake report. The attribute report will delete cluster ID - MTRClusterIDTypeIdentifyID.
25222522
// That should cause the cluster to be removed from cluster index and cluster data for that cluster to be removed from data storage.
@@ -2528,11 +2528,11 @@ - (void)test012_testDataStorageUpdatesWhenRemovingClusters
25282528
delegate.onAttributeDataReceived = ^(NSArray<NSDictionary<NSString *, id> *> * attributeReport) {
25292529
attributeReportsReceived += attributeReport.count;
25302530
XCTAssert(attributeReportsReceived > 0);
2531-
2531+
25322532
for (NSDictionary<NSString *, id> * attributeDict in attributeReport) {
25332533
MTRAttributePath * attributePath = attributeDict[MTRAttributePathKey];
25342534
XCTAssertNotNil(attributePath);
2535-
2535+
25362536
if ([attributePath.endpoint isEqualToNumber:testEndpoint] && attributePath.cluster.unsignedLongValue == MTRClusterIDTypeDescriptorID && attributePath.attribute.unsignedLongValue == MTRAttributeIDTypeClusterDescriptorAttributeServerListID) {
25372537
NSDictionary * data = attributeDict[MTRDataKey];
25382538
XCTAssertNotNil(data);
@@ -2543,7 +2543,7 @@ - (void)test012_testDataStorageUpdatesWhenRemovingClusters
25432543
}
25442544
}
25452545
};
2546-
2546+
25472547
__block NSMutableArray<NSNumber *> * initialClusterIndex = [[NSMutableArray alloc] init];
25482548
__block NSNumber * toBeDeletedCluster = @(MTRClusterIDTypeIdentifyID);
25492549
__block id identifyClusterData =
@@ -2553,11 +2553,11 @@ - (void)test012_testDataStorageUpdatesWhenRemovingClusters
25532553
MTRValueKey : toBeDeletedCluster,
25542554
}
25552555
};
2556-
2556+
25572557
delegate.onReportEnd = ^{
25582558
XCTAssertNotNil(dataVersionForServerList);
25592559
XCTAssertNotNil(testClusterDataValue);
2560-
2560+
25612561
// Make sure that the cluster data in the data storage has cluster ID - MTRClusterIDTypeIdentifyID in the cluster index for endpoint 1
25622562
// and cluster data for MTRClusterIDTypeIdentifyID exists
25632563
// We do not need to check _persistedClusterData here. _persistedClusterData will be paged in from storage when needed so
@@ -2571,15 +2571,15 @@ - (void)test012_testDataStorageUpdatesWhenRemovingClusters
25712571
});
25722572
[subscriptionExpectation fulfill];
25732573
};
2574-
2574+
25752575
[device setDelegate:delegate queue:queue];
2576-
2576+
25772577
[self waitForExpectations:@[ subscriptionExpectation ] timeout:60];
2578-
2578+
25792579
// Inject a fake attribute report after removing cluster ID - MTRClusterIDTypeIdentifyID from endpoint 1 to the server list.
25802580
dataVersionForServerList = [NSNumber numberWithUnsignedLongLong:(dataVersionForServerList.unsignedLongLongValue + 1)];
25812581
[testClusterDataValue removeObject:identifyClusterData];
2582-
2582+
25832583
NSArray<NSDictionary<NSString *, id> *> * attributeReport = @[ @{
25842584
MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:testEndpoint clusterID:@(MTRClusterIDTypeDescriptorID) attributeID:@(MTRAttributeIDTypeClusterDescriptorAttributeServerListID)],
25852585
MTRDataKey : @ {
@@ -2687,20 +2687,20 @@ - (void)test013_testDataStorageUpdatesWhenRemovingAttributes
26872687
XCTAssertNotNil(initialClusterIndex);
26882688

26892689
for (NSNumber * cluster in initialClusterIndex) {
2690-
2690+
26912691
// Make sure that the cluster data in the data storage is populated with cluster data for MTRClusterIDTypeIdentifyID cluster
26922692
// and has all attributes including attribute 1.
26932693
// We will be paged in the cluster data from storage to check the above.
26942694
MTRClusterPath * path = [MTRClusterPath clusterPathWithEndpointID:testEndpoint clusterID:cluster];
2695-
2695+
26962696
if ([cluster isEqualToNumber:@(MTRClusterIDTypeIdentifyID)]) {
26972697
MTRDeviceClusterData * data = [device _getClusterDataForPath:path];
26982698
XCTAssertNotNil(data);
26992699
XCTAssertNotNil(data.attributes);
2700-
2700+
27012701
NSDictionary * dict = [data.attributes objectForKey:@(MTRAttributeIDTypeGlobalAttributeAttributeListID)];
27022702
XCTAssertNotNil(dict);
2703-
2703+
27042704
NSMutableArray * persistedAttributes = [device arrayOfNumbersFromAttributeValue:dict];
27052705
NSMutableArray * testAttributes = [device arrayOfNumbersFromAttributeValue:@ { MTRTypeKey : MTRArrayValueType, MTRValueKey : testClusterDataValue }];
27062706
XCTAssertNotNil(persistedAttributes);
@@ -2741,7 +2741,7 @@ - (void)test013_testDataStorageUpdatesWhenRemovingAttributes
27412741
};
27422742

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

0 commit comments

Comments
 (0)