Function

FwupdPluginbytes_get_data_safe

since: 1.6.0

Declaration [src]

const guint8*
fu_bytes_get_data_safe (
  GBytes* bytes,
  gsize* bufsz,
  GError** error
)

Description [src]

Get the byte data in the GBytes. This data should not be modified. This function will always return the same pointer for a given GBytes.

If the size of bytes is zero, then NULL is returned and the error is set, which differs in behavior to that of g_bytes_get_data().

This may be useful when calling g_mapped_file_new() on a zero-length file.

Available since: 1.6.0

Parameters

bytes

Type: GBytes

Data blob.

The data is owned by the caller of the function.
bufsz

Type: gsize*

Location to return size of byte data.

The argument will be set by the function.
The argument can be NULL.
error

Type: GError **

The return location for a recoverable error.

The argument can be NULL.
If the return location is not NULL, then you must initialize it to a NULL GError*.
The argument will left initialized to NULL by the function if there are no errors.
In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.

Return value

Type: const guint8*

A pointer to the byte data, or NULL.

The data is owned by the called function.