Skip to content

Commit

Permalink
restyle
Browse files Browse the repository at this point in the history
  • Loading branch information
joonhaengHeo committed Apr 17, 2023
1 parent 40eca60 commit f855ea5
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/darwin/Framework/CHIP/MTRBaseDevice.mm
Original file line number Diff line number Diff line change
Expand Up @@ -789,11 +789,13 @@ CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const
, mBufferedReadAdapter(*this)
{
if (aAttributePathParamsList != nullptr) {
mAttributePathParamsList = Platform::MakeMemoryUnique<app::AttributePathParams>(aAttributePathParamsSize, sizeof(AttributePathParams));
memcpy(mAttributePathParamsList.get(), aAttributePathParamsList, aAttributePathParamsSize * sizeof(AttributePathParams));
mAttributePathParamsList
= Platform::MakeMemoryUnique<app::AttributePathParams>(aAttributePathParamsSize, sizeof(AttributePathParams));
memcpy(
mAttributePathParamsList.get(), aAttributePathParamsList, aAttributePathParamsSize * sizeof(AttributePathParams));
mAttributePathParamsSize = aAttributePathParamsSize;
}

if (aEventPathParamsList != nullptr) {
mEventPathParamsList = Platform::MakeMemoryUnique<app::EventPathParams>(aEventPathParamsSize, sizeof(EventPathParams));
memcpy(mEventPathParamsList.get(), aEventPathParamsList, aEventPathParamsSize * sizeof(EventPathParams));
Expand Down Expand Up @@ -1003,13 +1005,13 @@ - (void)readAttributePaths:(NSArray<MTRAttributeRequestPath *> * _Nullable)attri
}
};

Platform::MemoryUniquePtr<AttributePathParams> attributePathParamsList = nullptr;
Platform::MemoryUniquePtr<EventPathParams> eventPathParamsList = nullptr;
Platform::MemoryUniquePtr<AttributePathParams> attributePathParamsList = nullptr;
Platform::MemoryUniquePtr<EventPathParams> eventPathParamsList = nullptr;

if (attributes != nil) {
size_t count = 0;
attributePathParamsList
= Platform::MakeMemoryUnique<AttributePathParams>([attributes count], sizeof(AttributePathParams));
= Platform::MakeMemoryUnique<AttributePathParams>([attributes count], sizeof(AttributePathParams));
VerifyOrReturnError(attributePathParamsList != nullptr, CHIP_ERROR_NO_MEMORY);
for (MTRAttributeRequestPath * attribute in attributes) {
[attribute convertToAttributePathParams:attributePathParamsList.get()[count++]];
Expand All @@ -1018,8 +1020,7 @@ - (void)readAttributePaths:(NSArray<MTRAttributeRequestPath *> * _Nullable)attri

if (events != nil) {
size_t count = 0;
eventPathParamsList
= Platform::MakeMemoryUnique<EventPathParams>([events count], sizeof(EventPathParams));
eventPathParamsList = Platform::MakeMemoryUnique<EventPathParams>([events count], sizeof(EventPathParams));
VerifyOrReturnError(eventPathParamsList != nullptr, CHIP_ERROR_NO_MEMORY);
for (MTREventRequestPath * event in events) {
[event convertToEventPathParams:eventPathParamsList.get()[count++]];
Expand All @@ -1036,7 +1037,8 @@ - (void)readAttributePaths:(NSArray<MTRAttributeRequestPath *> * _Nullable)attri
readParams.mpEventPathParamsList = eventPathParamsList.get();
readParams.mEventPathParamsListSize = [eventPaths count];

auto onDone = [resultArray, interactionStatus, bridge, successCb, failureCb](BufferedReadClientCallback<MTRDataValueDictionaryDecodableType> * callback) {
auto onDone = [resultArray, interactionStatus, bridge, successCb, failureCb](
BufferedReadClientCallback<MTRDataValueDictionaryDecodableType> * callback) {
if (*interactionStatus != CHIP_NO_ERROR) {
// Failure
failureCb(bridge, *interactionStatus);
Expand Down

0 comments on commit f855ea5

Please sign in to comment.