Function

FwupdPluginversion_parse_from_format

since: 1.8.2

Declaration [src]

gchar*
fu_version_parse_from_format (
  const gchar* version,
  FwupdVersionFormat fmt
)

Description [src]

Returns a dotted decimal version string from a version string using fmt. The supported formats are:

  • Dotted decimal, e.g. 1.2.3
  • Base 16, a hex number with a 0x prefix, e.g. 0x10203
  • Base 10, a string containing just [0-9], e.g. 66051
  • Date in YYYYMMDD format, e.g. 20150915

Anything with a . or that doesn’t match [0-9] or 0x[a-f,0-9] is considered a string and returned without modification.

Available since: 1.8.2

Parameters

version

Type: const gchar*

A version number.

The argument can be NULL.
The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.
fmt

Type: FwupdVersionFormat

A version format, e.g. FWUPD_VERSION_FORMAT_TRIPLET.

Return value

Type: gchar*

A version number, e.g. 1.0.3, or NULL on error.

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