From c4c93401be7b23a288d09341e876b8f67a2f795c Mon Sep 17 00:00:00 2001 From: Karsten Sperling Date: Thu, 16 Jan 2025 07:31:36 +1300 Subject: [PATCH] Address further review comments --- src/controller/AutoCommissioner.cpp | 2 +- src/darwin/Framework/CHIP/MTRDeviceType.mm | 2 +- src/darwin/Framework/CHIP/MTREndpointInfo.mm | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/controller/AutoCommissioner.cpp b/src/controller/AutoCommissioner.cpp index bf9d3eb76264d9..d156d3058272d2 100644 --- a/src/controller/AutoCommissioner.cpp +++ b/src/controller/AutoCommissioner.cpp @@ -241,7 +241,7 @@ CHIP_ERROR AutoCommissioner::SetCommissioningParameters(const CommissioningParam // We can't reallocate mExtraReadPaths yet as this would free the old buffer, // and the caller might be passing a sub-span of the old paths. decltype(mExtraReadPaths) oldReadPaths(std::move(mExtraReadPaths)); - VerifyOrReturnError(mExtraReadPaths.Alloc(extraReadPaths.size()).Get() != nullptr, CHIP_ERROR_NO_MEMORY); + VerifyOrReturnError(mExtraReadPaths.Alloc(extraReadPaths.size()), CHIP_ERROR_NO_MEMORY); memcpy(mExtraReadPaths.Get(), extraReadPaths.data(), extraReadPaths.size() * sizeof(ReadPath)); } diff --git a/src/darwin/Framework/CHIP/MTRDeviceType.mm b/src/darwin/Framework/CHIP/MTRDeviceType.mm index 998a23e3cdb74a..4cea1d33b9c8dc 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceType.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceType.mm @@ -45,7 +45,7 @@ - (NSNumber *)id - (NSString *)name { - return const_cast(_meta->name); + return _meta->name; } - (BOOL)isUtility diff --git a/src/darwin/Framework/CHIP/MTREndpointInfo.mm b/src/darwin/Framework/CHIP/MTREndpointInfo.mm index a99950a1a6cf50..c92b525ed99234 100644 --- a/src/darwin/Framework/CHIP/MTREndpointInfo.mm +++ b/src/darwin/Framework/CHIP/MTREndpointInfo.mm @@ -164,6 +164,7 @@ + (BOOL)populateChildrenForEndpoints:(NSDictionary * deviceTypeList = MTRDecodeAttributeValue(path, *cache, &err); if (!deviceTypeList) { MTR_LOG_ERROR("Ignoring invalid DeviceTypeList for endpoint %u: %" CHIP_ERROR_FORMAT, path.mEndpointId, err.Format()); + // proceed with deviceTypeList == nil, equivalent to an empty list } NSMutableArray * deviceTypes = [[NSMutableArray alloc] initWithCapacity:deviceTypeList.count];