Function

GLibbase64_decode_step

since: 2.12

Declaration

gsize
g_base64_decode_step (
  const gchar* in,
  gsize len,
  guchar* out,
  gint* state,
  guint* save
)

Description

Incrementally decode a sequence of binary data from its Base-64 stringified representation. By calling this function multiple times you can convert data in chunks to avoid having to have the full encoded data in memory.

The output buffer must be large enough to fit all the data that will be written to it. Since base64 encodes 3 bytes in 4 chars you need at least: (len / 4) * 3 + 3 bytes (+ 3 may be needed in case of non-zero state).

Available since: 2.12

This function is not directly available to language bindings.

Parameters

in

Type: An array of guint8

Binary input data.

The length of the array is specified in the len argument.
The data is owned by the caller of the function.
len

Type: gsize

Max length of in data to decode.

out

Type: An array of guint8

Output buffer.

The argument will be set by the function.
The data is owned by the caller of the function.
state

Type: gint*

Saved state between steps, initialize to 0

The argument will be modified by the function.
save

Type: guint*

Saved state between steps, initialize to 0

The argument will be modified by the function.

Return value

Type: gsize

The number of bytes of output that was written.