Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions src/lib/support/BufferWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,28 +87,8 @@ class BufferWriter
uint8_t * Buffer() { return mBuf; }
const uint8_t * Buffer() const { return mBuf; }

BufferWriter & Format(const char * format, ...) ENFORCE_FORMAT(2, 3)
{
va_list args;
va_start(args, format);
VFormat(format, args);
va_end(args);
return *this;
}

void Reset() { mNeeded = 0; }

/// Since this uses vsnprintf internally, on overflow
/// this will write one less byte that strictly can be
/// written (since null terminator will be in the binary data)
BufferWriter & VFormat(const char * format, va_list args) ENFORCE_FORMAT(2, 0);

/// Assume a specific size for the buffer instead of mSize
///
/// This is to allow avoiding off-by-one overflow truncation
/// when we know the underlying buffer size is larger.
BufferWriter & VFormatWithSize(size_t size, const char * format, va_list args) ENFORCE_FORMAT(3, 0);

protected:
uint8_t * mBuf;
size_t mSize;
Expand Down
Loading