diff --git a/src/platform/Ameba/AmebaOTAImageProcessor.cpp b/src/platform/Ameba/AmebaOTAImageProcessor.cpp index 6c1b79c96c2192..57aeb2205a5473 100644 --- a/src/platform/Ameba/AmebaOTAImageProcessor.cpp +++ b/src/platform/Ameba/AmebaOTAImageProcessor.cpp @@ -179,19 +179,20 @@ void AmebaOTAImageProcessor::HandleProcessBlock(intptr_t context) return; } - ByteSpan block = imageProcessor->mBlock; - CHIP_ERROR error = imageProcessor->ProcessHeader(block); // process matter ota header - uint8_t remainHeader = matter_ota_get_total_header_size() - matter_ota_get_current_header_size(); // size of ameba header received - uint16_t writeLength = block.size(); // length of actual data to write to flash, excluding header - uint8_t *writePointer = (uint8_t*) block.data(); // pointer to the actual data to write to flash, excluding header - + ByteSpan block = imageProcessor->mBlock; + CHIP_ERROR error = imageProcessor->ProcessHeader(block); // process matter ota header + uint8_t remainHeader = + matter_ota_get_total_header_size() - matter_ota_get_current_header_size(); // size of ameba header received + uint16_t writeLength = block.size(); // length of actual data to write to flash, excluding header + uint8_t * writePointer = (uint8_t *) block.data(); // pointer to the actual data to write to flash, excluding header // 1. Check if 32-bytes Ameba header has already been received if (remainHeader > 0) { if (block.size() >= remainHeader) { - if (AmebaUtils::MapError(matter_ota_store_header((uint8_t*) block.data(), remainHeader), AmebaErrorType::kFlashError) != CHIP_NO_ERROR) + if (AmebaUtils::MapError(matter_ota_store_header((uint8_t *) block.data(), remainHeader), + AmebaErrorType::kFlashError) != CHIP_NO_ERROR) { ChipLogError(SoftwareUpdate, "Failed to store OTA header"); return; @@ -201,7 +202,8 @@ void AmebaOTAImageProcessor::HandleProcessBlock(intptr_t context) } else { - if (AmebaUtils::MapError(matter_ota_store_header((uint8_t*) block.data(), block.size()), AmebaErrorType::kFlashError) != CHIP_NO_ERROR) + if (AmebaUtils::MapError(matter_ota_store_header((uint8_t *) block.data(), block.size()), + AmebaErrorType::kFlashError) != CHIP_NO_ERROR) { ChipLogError(SoftwareUpdate, "Failed to store OTA header"); return;