Skip to content

Commit

Permalink
Remove CONFIG_TLV_TRUNCATE. (#29233)
Browse files Browse the repository at this point in the history
It's not used right now, and it silently truncates the data being encoded, so
should not be used.

Fixes #29218
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Oct 18, 2023
1 parent de27b17 commit a77777f
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions src/lib/core/TLVWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,6 @@ CHIP_ERROR TLVWriter::VPutStringF(Tag tag, const char * fmt, va_list ap)
size_t skipLen;
size_t writtenBytes;
#elif CONFIG_HAVE_VCBPRINTF
#elif CONFIG_TLV_TRUNCATE
size_t maxLen;
#else
char * tmpBuf;
#endif
Expand All @@ -324,17 +322,6 @@ CHIP_ERROR TLVWriter::VPutStringF(Tag tag, const char * fmt, va_list ap)
else
lenFieldSize = kTLVFieldSize_4Byte;

#if !(CONFIG_HAVE_VCBPRINTF) && !(CONFIG_HAVE_VSNPRINTF_EX) && CONFIG_TLV_TRUNCATE
// no facilities for splitting the stream across multiple buffers,
// just write however much fits in the current buffer.
// assume conservative tag length at this time (8 bytes)
maxLen = mRemainingLen -
(1 + 8 + (1 << static_cast<uint8_t>(lenFieldSize)) +
1); // 1 : control byte, 8 : tag length, stringLen + 1 for null termination
if (maxLen < dataLen)
dataLen = maxLen;
#endif

// write length.
err = WriteElementHead(
static_cast<TLVElementType>(static_cast<uint8_t>(kTLVType_UTF8String) | static_cast<uint8_t>(lenFieldSize)), tag, dataLen);
Expand Down

0 comments on commit a77777f

Please sign in to comment.