Function

GLibbase64_decode_step

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

Parameters

in 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 gsize
 

Max length of in data to decode.

out 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 gint*
 

Saved state between steps, initialize to 0

 The argument will be modified by the function.
 The called function takes ownership of the data, and is responsible for freeing it.
save guint*
 

Saved state between steps, initialize to 0

 The argument will be modified by the function.
 The called function takes ownership of the data, and is responsible for freeing it.

Return value

Returns: gsize
 

The number of bytes of output that was written.