Grow a blob and return contiguous storage for the newly added bytes.

Synopsis

Declared in <bdlbb_blobutil.h>

static
char*
getContiguousDataBuffer(
    Blob* blob,
    int addLength,
    BlobBufferFactory* factory);

Description

Obtain contiguous storage for at least the specified addLength bytes in the specified blob at position blob‐>length(), and then grow blob‐>length() by addLength. If, upon entry, such storage does not exist in blob, first trim the final data buffer, if any, and insert a new buffer obtained from the specified factory. Return a pointer to the beginning of the storage obtained. The behavior of this function is undefined unless 0 < addLength, and factory‐>allocate(), if called, yields a block of memory of a size at least as large as addLength.

Return Value

pointer to the beginning of the contiguous storage obtained

Parameters

Name

Description

blob

blob to grow

addLength

number of bytes by which to grow blob

factory

factory used to allocate a new buffer when needed

Created with MrDocs