Skip to content

Commit

Permalink
Update to make flash smaller with an odd workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
andreilitvin committed Oct 29, 2024
1 parent 68ce450 commit 9b04161
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib/core/TLVReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,11 @@ CHIP_ERROR TLVReader::ReadElement()
// length bytes (if present), and for elements that don't have a length (e.g. integers), the value bytes.
const uint8_t elemHeadBytes = static_cast<uint8_t>(1 + tagBytes + valOrLenBytes);

uint8_t stagingBuf[17] = {0}; // 17 = 1 control byte + 8 tag bytes + 8 length/value bytes
uint8_t stagingBuf[17];

// Odd workaround: clang-tidy claims garbage value otherwise as it does not
// understand that ReadData initializes stagingBuf
stagingBuf[1] = 0;

// Read to handle also if the head of the element overlaps the end of the input buffer.
// This reads the bytes into the staging buffer and arrange to parse them from there.
Expand Down

0 comments on commit 9b04161

Please sign in to comment.