Function

FwupdPluginsize_from_uint64

since: 2.1.2

Declaration [src]

gboolean
fu_size_from_uint64 (
  guint64 value,
  gsize* out,
  GError** error
)

Description [src]

Safely converts a 64-bit unsigned integer to a #gsize value, ensuring the value fits within the platform’s #gsize range. On 32-bit platforms where #gsize is 32 bits, this prevents silent truncation that could lead to security vulnerabilities.

Available since: 2.1.2

Parameters

value

Type: guint64

A 64-bit unsigned integer.

out

Type: gsize*

Output location for the converted value.

The argument will be set by the function.
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: gboolean

TRUE if the conversion was successful, FALSE if the value exceeds #G_MAXSIZE.