Function

AppStreamComposebuild_component_global_id

since: 0.13.0

Declaration [src]

gchar*
asc_build_component_global_id (
  const gchar* component_id,
  const gchar* checksum,
  GError** error
)

Description [src]

Builds a global component ID from a component-id and a checksum (usually Blake3) generated from the component data.

The global-id is used as a global, unique identifier for a component. (while the component-ID is local, e.g. for one source). Its primary usecase is to identify a media directory on the filesystem which is associated with this component.

Since the result is used to construct filesystem paths, this function will refuse to build a global ID unless every segment it is made of - the pieces of the component-ID as well as checksum - is safe to use as a directory name. The error that is set in that case names the offending piece, and is meant to be shown to whoever wrote the metadata.

Available since: 0.13.0

Parameters

component_id

Type: const gchar*

An AppStream component ID.

The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.
checksum

Type: const gchar*

A checksum as string generated from the component’s combined metadata.

The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.
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 be 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: gchar*

The new global ID, or NULL on error.

The caller of the function takes ownership of the data, and is responsible for freeing it.
The return value can be NULL.
The value is a NUL terminated UTF-8 string.