dmi_reader_ref_bytes

Synopsis

#include <opendmi/reader.h>

bool dmi_reader_ref_bytes(
        dmi_reader_t      *reader,
        size_t             length,
        const dmi_data_t **ptr);

Description

The dmi_reader_ref_bytes function refers to length bytes at the current position and advances the cursor, the way reading them does.

The bytes belong to the buffer being read and stay valid for as long as it holds them, which is how the binary members of the decoded structures refer to the data in place rather than holding a copy of it.

Parameters

reader

Reader to read from.

length

Number of bytes to refer to, may be zero.

ptr

Pointer to the bytes, set to nullptr if length is zero.

Return value

true on success, false if there are fewer than length bytes remaining in the range, or on error.

Errors

The error is raised against the context of the buffer being read.

DMI_ERROR_ARGUMENT_NULL

ptr is nullptr.