dmi_writer_put_bytes_at

Synopsis

#include <opendmi/writer.h>

bool dmi_writer_put_bytes_at(
        dmi_writer_t *writer,
        const void   *ptr,
        size_t        offset,
        size_t        length);

Description

The dmi_writer_put_bytes_at function writes length bytes at ptr at offset from the beginning of the range. The writer cursor is not modified.

The data grows if the bytes are written past its end, and the ones between the end and offset are made up as zeros, the way the ones which are padded over are.

Parameters

writer

Writer to write to.

ptr

Data to write.

offset

Byte offset from the beginning of the range.

length

Number of bytes to write.

Return value

true on success, false if the bytes do not fit into the range, or on error.

Errors

DMI_ERROR_ARGUMENT_NULL

ptr is nullptr, while length is not zero.

DMI_ERROR_OUT_OF_MEMORY

Buffer of the writer cannot grow.