Skip to content

Commit

Permalink
Restyled by clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
restyled-commits authored and pankore committed Jun 28, 2023
1 parent bc50699 commit 71e79b3
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/platform/Ameba/AmebaOTAImageProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 71e79b3

Please sign in to comment.