Function

FwupdPluginbytes_get_data_safe

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 GBytes*
 

Data blob.

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

Location to return size of byte data.

 The argument will be set by the function.
 The argument can be NULL.
 The called function takes ownership of the data, and is responsible for freeing it.
error GError **
  The return location for a GError*, or NULL.

Return value

Returns: const guint8*
 

A pointer to the byte data, or NULL.

 The data is owned by the called function.