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 <bzbarsky@apple.com>
  • Loading branch information
anush-apple and bzbarsky-apple authored Aug 23, 2024
1 parent 7ba72a6 commit 0a89d13
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/darwin/Framework/CHIP/MTRDeviceController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ - (void)addRunAssertion
// Only take an assertion if running
if ([self isRunning]) {
++_keepRunningAssertionCounter;
MTR_LOG("%@ Adding keep running assertion, total %lu", self, (unsigned long) _keepRunningAssertionCounter);
MTR_LOG("%@ Adding keep running assertion, total %lu", self, static_cast<unsigned long>(_keepRunningAssertionCounter));
}
}

Expand All @@ -362,7 +362,7 @@ - (void)removeRunAssertion;

if (_keepRunningAssertionCounter > 0) {
--_keepRunningAssertionCounter;
MTR_LOG("%@ Removing keep running assertion, total %lu", self, (unsigned long) _keepRunningAssertionCounter);
MTR_LOG("%@ Removing keep running assertion, total %lu", self, static_cast<unsigned long>(_keepRunningAssertionCounter));

if ([self isRunning] && _keepRunningAssertionCounter == 0 && _shutdownPending) {
MTR_LOG("%@ All assertions removed and shutdown is pending, shutting down", self);
Expand All @@ -382,7 +382,7 @@ - (void)shutdown
std::lock_guard lock(_assertionLock);

if (_keepRunningAssertionCounter > 0) {
MTR_LOG("%@ Pending shutdown since %lu assertions are present", self, (unsigned long) _keepRunningAssertionCounter);
MTR_LOG("%@ Pending shutdown since %lu assertions are present", self, static_cast<unsigned long>(_keepRunningAssertionCounter));
_shutdownPending = YES;
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,7 @@ - (void)operationalInstanceAdded:(chip::PeerId &)operationalID
}
}

- (nullable MTRDeviceController *)_findControllerMatchingParams:(MTRDeviceControllerParameters *)parameters
- (nullable MTRDeviceController *)_findControllerWithPendingShutdownMatchingParams:(MTRDeviceControllerParameters *)parameters
{
std::lock_guard lock(_controllersLock);
for (MTRDeviceController * controller in _controllers) {
Expand All @@ -1152,7 +1152,7 @@ - (nullable MTRDeviceController *)initializeController:(MTRDeviceController *)co
{
[self _assertCurrentQueueIsNotMatterQueue];

// If there is a controller already running with matching parameters, re-use it
// If there is a controller already running with matching parameters that is conceptually shut down from the API consumer's viewpoint, re-use it.
MTRDeviceController * existingController = [self _findControllerMatchingParams:parameters];
if (existingController) {
return existingController;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ + (nullable NSNumber *)fabricIDFromNOC:(MTRCertificateDERBytes)noc
return fabricID;
}

+ (NSData *)publicKeyFromCertificate:(MTRCertificateDERBytes)certificate
+ (nullable NSData *)publicKeyFromCertificate:(MTRCertificateDERBytes)certificate
{
Crypto::P256PublicKey pubKey;
if (ExtractPubkeyFromX509Cert(AsByteSpan(certificate), pubKey) != CHIP_NO_ERROR) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ NS_ASSUME_NONNULL_BEGIN

+ (nullable NSNumber *)nodeIDFromNOC:(MTRCertificateDERBytes)noc;
+ (nullable NSNumber *)fabricIDFromNOC:(MTRCertificateDERBytes)noc;
+ (NSData *)publicKeyFromCertificate:(MTRCertificateDERBytes)certificate;
+ (nullable NSData *)publicKeyFromCertificate:(MTRCertificateDERBytes)certificate;

@end

Expand Down

0 comments on commit 0a89d13

Please sign in to comment.