~ubuntu-branches/ubuntu/vivid/glib2.0/vivid-proposed

1.2.21 by Sebastien Bacher
Import upstream version 2.12.12
1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
<html>
3
<head>
1.3.1 by Sebastian Dröge
Import upstream version 2.17.0
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
1.66.9 by Emilio Pozuelo Monfort
Import upstream version 2.39.4
5
<title>GLib Reference Manual: Base64 Encoding</title>
1.65.1 by Iain Lane
Import upstream version 2.37.0
6
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
1.3.2 by Sebastian Dröge
Import upstream version 2.17.2
7
<link rel="home" href="index.html" title="GLib Reference Manual">
1.2.21 by Sebastien Bacher
Import upstream version 2.12.12
8
<link rel="up" href="glib-utilities.html" title="GLib Utilities">
9
<link rel="prev" href="glib-Unicode-Manipulation.html" title="Unicode Manipulation">
1.2.31 by Sebastien Bacher
Import upstream version 2.15.0
10
<link rel="next" href="glib-Data-Checksums.html" title="Data Checksums">
1.67.3 by Iain Lane
Import upstream version 2.43.3
11
<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
1.2.21 by Sebastien Bacher
Import upstream version 2.12.12
12
<link rel="stylesheet" href="style.css" type="text/css">
13
</head>
14
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
1.66.16 by Iain Lane
Import upstream version 2.41.2
15
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
16
<td width="100%" align="left" class="shortcuts">
1.66.16 by Iain Lane
Import upstream version 2.41.2
17
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
18
                  <a href="#glib-Base64-Encoding.description" class="shortcut">Description</a></span>
1.66.9 by Emilio Pozuelo Monfort
Import upstream version 2.39.4
19
</td>
20
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
21
<td><a accesskey="u" href="glib-utilities.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
22
<td><a accesskey="p" href="glib-Unicode-Manipulation.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
23
<td><a accesskey="n" href="glib-Data-Checksums.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
24
</tr></table>
1.59.10 by Sebastien Bacher
Import upstream version 2.27.93
25
<div class="refentry">
1.2.21 by Sebastien Bacher
Import upstream version 2.12.12
26
<a name="glib-Base64-Encoding"></a><div class="titlepage"></div>
27
<div class="refnamediv"><table width="100%"><tr>
28
<td valign="top">
1.3.1 by Sebastian Dröge
Import upstream version 2.17.0
29
<h2><span class="refentrytitle"><a name="glib-Base64-Encoding.top_of_page"></a>Base64 Encoding</span></h2>
30
<p>Base64 Encoding — encodes and decodes data in Base64 format</p>
1.2.21 by Sebastien Bacher
Import upstream version 2.12.12
31
</td>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
32
<td class="gallery_image" valign="top" align="right"></td>
1.2.21 by Sebastien Bacher
Import upstream version 2.12.12
33
</tr></table></div>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
34
<div class="refsect1">
35
<a name="glib-Base64-Encoding.functions"></a><h2>Functions</h2>
36
<div class="informaltable"><table width="100%" border="0">
37
<colgroup>
38
<col width="150px" class="functions_return">
39
<col class="functions_name">
40
</colgroup>
41
<tbody>
42
<tr>
43
<td class="function_type">
44
<a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a>
45
</td>
46
<td class="function_name">
47
<a class="link" href="glib-Base64-Encoding.html#g-base64-encode-step" title="g_base64_encode_step ()">g_base64_encode_step</a> <span class="c_punctuation">()</span>
48
</td>
49
</tr>
50
<tr>
51
<td class="function_type">
52
<a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a>
53
</td>
54
<td class="function_name">
55
<a class="link" href="glib-Base64-Encoding.html#g-base64-encode-close" title="g_base64_encode_close ()">g_base64_encode_close</a> <span class="c_punctuation">()</span>
56
</td>
57
</tr>
58
<tr>
59
<td class="function_type">
60
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
61
</td>
62
<td class="function_name">
63
<a class="link" href="glib-Base64-Encoding.html#g-base64-encode" title="g_base64_encode ()">g_base64_encode</a> <span class="c_punctuation">()</span>
64
</td>
65
</tr>
66
<tr>
67
<td class="function_type">
68
<a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a>
69
</td>
70
<td class="function_name">
71
<a class="link" href="glib-Base64-Encoding.html#g-base64-decode-step" title="g_base64_decode_step ()">g_base64_decode_step</a> <span class="c_punctuation">()</span>
72
</td>
73
</tr>
74
<tr>
75
<td class="function_type">
76
<a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="returnvalue">guchar</span></a> *
77
</td>
78
<td class="function_name">
79
<a class="link" href="glib-Base64-Encoding.html#g-base64-decode" title="g_base64_decode ()">g_base64_decode</a> <span class="c_punctuation">()</span>
80
</td>
81
</tr>
82
<tr>
83
<td class="function_type">
84
<a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="returnvalue">guchar</span></a> *
85
</td>
86
<td class="function_name">
87
<a class="link" href="glib-Base64-Encoding.html#g-base64-decode-inplace" title="g_base64_decode_inplace ()">g_base64_decode_inplace</a> <span class="c_punctuation">()</span>
88
</td>
89
</tr>
90
</tbody>
91
</table></div>
92
</div>
93
<div class="refsect1">
94
<a name="glib-Base64-Encoding.includes"></a><h2>Includes</h2>
95
<pre class="synopsis">#include &lt;glib.h&gt;
1.2.21 by Sebastien Bacher
Import upstream version 2.12.12
96
</pre>
97
</div>
1.59.10 by Sebastien Bacher
Import upstream version 2.27.93
98
<div class="refsect1">
1.3.1 by Sebastian Dröge
Import upstream version 2.17.0
99
<a name="glib-Base64-Encoding.description"></a><h2>Description</h2>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
100
<p>Base64 is an encoding that allows a sequence of arbitrary bytes to be
1.2.51 by Martin Pitt
Import upstream version 2.21.5
101
encoded as a sequence of printable ASCII characters. For the definition
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
102
of Base64, see 
103
<a class="ulink" href="http://www.ietf.org/rfc/rfc1421.txt" target="_top">RFC 1421</a>
104
or
105
<a class="ulink" href="http://www.ietf.org/rfc/rfc2045.txt" target="_top">RFC 2045</a>.
106
Base64 is most commonly used as a MIME transfer encoding
1.66.9 by Emilio Pozuelo Monfort
Import upstream version 2.39.4
107
for email.</p>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
108
<p>GLib supports incremental encoding using <a class="link" href="glib-Base64-Encoding.html#g-base64-encode-step" title="g_base64_encode_step ()"><code class="function">g_base64_encode_step()</code></a> and
109
<a class="link" href="glib-Base64-Encoding.html#g-base64-encode-close" title="g_base64_encode_close ()"><code class="function">g_base64_encode_close()</code></a>. Incremental decoding can be done with
110
<a class="link" href="glib-Base64-Encoding.html#g-base64-decode-step" title="g_base64_decode_step ()"><code class="function">g_base64_decode_step()</code></a>. To encode or decode data in one go, use
111
<a class="link" href="glib-Base64-Encoding.html#g-base64-encode" title="g_base64_encode ()"><code class="function">g_base64_encode()</code></a> or <a class="link" href="glib-Base64-Encoding.html#g-base64-decode" title="g_base64_decode ()"><code class="function">g_base64_decode()</code></a>. To avoid memory allocation when
112
decoding, you can use <a class="link" href="glib-Base64-Encoding.html#g-base64-decode-inplace" title="g_base64_decode_inplace ()"><code class="function">g_base64_decode_inplace()</code></a>.</p>
113
<p>Support for Base64 encoding has been added in GLib 2.12.</p>
1.2.21 by Sebastien Bacher
Import upstream version 2.12.12
114
</div>
1.59.10 by Sebastien Bacher
Import upstream version 2.27.93
115
<div class="refsect1">
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
116
<a name="glib-Base64-Encoding.functions_details"></a><h2>Functions</h2>
1.59.10 by Sebastien Bacher
Import upstream version 2.27.93
117
<div class="refsect2">
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
118
<a name="g-base64-encode-step"></a><h3>g_base64_encode_step ()</h3>
119
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a>
120
g_base64_encode_step (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="type">guchar</span></a> *in</code></em>,
121
                      <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> len</code></em>,
122
                      <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> break_lines</code></em>,
123
                      <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *out</code></em>,
124
                      <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> *state</code></em>,
125
                      <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> *save</code></em>);</pre>
126
<p>Incrementally encode a sequence of binary data into its Base-64 stringified
1.12.3 by Sebastian Dröge
Import upstream version 2.25.16
127
representation. By calling this function multiple times you can convert
1.66.9 by Emilio Pozuelo Monfort
Import upstream version 2.39.4
128
data in chunks to avoid having to have the full encoded data in memory.</p>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
129
<p>When all of the data has been converted you must call
130
<a class="link" href="glib-Base64-Encoding.html#g-base64-encode-close" title="g_base64_encode_close ()"><code class="function">g_base64_encode_close()</code></a> to flush the saved state.</p>
131
<p>The output buffer must be large enough to fit all the data that will
1.2.21 by Sebastien Bacher
Import upstream version 2.12.12
132
be written to it. Due to the way base64 encodes you will need
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
133
at least: (<em class="parameter"><code>len</code></em>
134
 / 3 + 1) * 4 + 4 bytes (+ 4 may be needed in case of
1.2.44 by Sebastian Dröge
Import upstream version 2.20.0
135
non-zero state). If you enable line-breaking you will need at least:
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
136
((<em class="parameter"><code>len</code></em>
137
 / 3 + 1) * 4 + 4) / 72 + 1 bytes of extra space.</p>
138
<p><em class="parameter"><code>break_lines</code></em>
139
 is typically used when putting base64-encoded data in emails.
1.12.3 by Sebastian Dröge
Import upstream version 2.25.16
140
It breaks the lines at 72 columns instead of putting all of the text on
1.10.6 by Sebastian Dröge
Import upstream version 2.25.1
141
the same line. This avoids problems with long lines in the email system.
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
142
Note however that it breaks the lines with <code class="literal">LF</code> characters, not
143
<code class="literal">CR LF</code> sequences, so the result cannot be passed directly to SMTP
144
or certain other protocols.</p>
145
<div class="refsect3">
1.66.16 by Iain Lane
Import upstream version 2.41.2
146
<a name="id-1.5.5.6.2.8"></a><h4>Parameters</h4>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
147
<div class="informaltable"><table width="100%" border="0">
1.62.13 by Josselin Mouette
Import upstream version 2.33.12+really2.32.4
148
<colgroup>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
149
<col width="150px" class="parameters_name">
150
<col class="parameters_description">
151
<col width="200px" class="parameters_annotations">
1.62.13 by Josselin Mouette
Import upstream version 2.33.12+really2.32.4
152
</colgroup>
1.2.21 by Sebastien Bacher
Import upstream version 2.12.12
153
<tbody>
154
<tr>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
155
<td class="parameter_name"><p>in</p></td>
156
<td class="parameter_description"><p> the binary data to encode. </p></td>
157
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=len][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span></td>
158
</tr>
159
<tr>
160
<td class="parameter_name"><p>len</p></td>
161
<td class="parameter_description"><p>the length of <em class="parameter"><code>in</code></em>
162
</p></td>
163
<td class="parameter_annotations"> </td>
164
</tr>
165
<tr>
166
<td class="parameter_name"><p>break_lines</p></td>
167
<td class="parameter_description"><p>whether to break long lines</p></td>
168
<td class="parameter_annotations"> </td>
169
</tr>
170
<tr>
171
<td class="parameter_name"><p>out</p></td>
172
<td class="parameter_description"><p> pointer to destination buffer. </p></td>
173
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym>][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span></td>
174
</tr>
175
<tr>
176
<td class="parameter_name"><p>state</p></td>
177
<td class="parameter_description"><p> Saved state between steps, initialize to 0. </p></td>
178
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for input and for returning results. Default is transfer full."><span class="acronym">inout</span></acronym>]</span></td>
179
</tr>
180
<tr>
181
<td class="parameter_name"><p>save</p></td>
182
<td class="parameter_description"><p> Saved state between steps, initialize to 0. </p></td>
183
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for input and for returning results. Default is transfer full."><span class="acronym">inout</span></acronym>]</span></td>
1.2.21 by Sebastien Bacher
Import upstream version 2.12.12
184
</tr>
185
</tbody>
186
</table></div>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
187
</div>
188
<div class="refsect3">
1.66.16 by Iain Lane
Import upstream version 2.41.2
189
<a name="id-1.5.5.6.2.9"></a><h4>Returns</h4>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
190
<p> The number of bytes of output that was written</p>
191
<p></p>
192
</div>
1.3.10 by Sebastien Bacher
Import upstream version 2.19.2
193
<p class="since">Since 2.12</p>
1.2.21 by Sebastien Bacher
Import upstream version 2.12.12
194
</div>
195
<hr>
1.59.10 by Sebastien Bacher
Import upstream version 2.27.93
196
<div class="refsect2">
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
197
<a name="g-base64-encode-close"></a><h3>g_base64_encode_close ()</h3>
198
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a>
199
g_base64_encode_close (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> break_lines</code></em>,
200
                       <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *out</code></em>,
201
                       <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> *state</code></em>,
202
                       <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> *save</code></em>);</pre>
203
<p>Flush the status from a sequence of calls to <a class="link" href="glib-Base64-Encoding.html#g-base64-encode-step" title="g_base64_encode_step ()"><code class="function">g_base64_encode_step()</code></a>.</p>
204
<p>The output buffer must be large enough to fit all the data that will
1.10.3 by Sebastian Dröge
Import upstream version 2.23.4
205
be written to it. It will need up to 4 bytes, or up to 5 bytes if
1.66.9 by Emilio Pozuelo Monfort
Import upstream version 2.39.4
206
line-breaking is enabled.</p>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
207
<div class="refsect3">
1.66.16 by Iain Lane
Import upstream version 2.41.2
208
<a name="id-1.5.5.6.3.6"></a><h4>Parameters</h4>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
209
<div class="informaltable"><table width="100%" border="0">
1.62.13 by Josselin Mouette
Import upstream version 2.33.12+really2.32.4
210
<colgroup>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
211
<col width="150px" class="parameters_name">
212
<col class="parameters_description">
213
<col width="200px" class="parameters_annotations">
1.62.13 by Josselin Mouette
Import upstream version 2.33.12+really2.32.4
214
</colgroup>
1.2.21 by Sebastien Bacher
Import upstream version 2.12.12
215
<tbody>
216
<tr>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
217
<td class="parameter_name"><p>break_lines</p></td>
218
<td class="parameter_description"><p>whether to break long lines</p></td>
219
<td class="parameter_annotations"> </td>
220
</tr>
221
<tr>
222
<td class="parameter_name"><p>out</p></td>
223
<td class="parameter_description"><p> pointer to destination buffer. </p></td>
224
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym>][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span></td>
225
</tr>
226
<tr>
227
<td class="parameter_name"><p>state</p></td>
228
<td class="parameter_description"><p> Saved state from <a class="link" href="glib-Base64-Encoding.html#g-base64-encode-step" title="g_base64_encode_step ()"><code class="function">g_base64_encode_step()</code></a>. </p></td>
229
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for input and for returning results. Default is transfer full."><span class="acronym">inout</span></acronym>]</span></td>
230
</tr>
231
<tr>
232
<td class="parameter_name"><p>save</p></td>
233
<td class="parameter_description"><p> Saved state from <a class="link" href="glib-Base64-Encoding.html#g-base64-encode-step" title="g_base64_encode_step ()"><code class="function">g_base64_encode_step()</code></a>. </p></td>
234
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for input and for returning results. Default is transfer full."><span class="acronym">inout</span></acronym>]</span></td>
1.2.21 by Sebastien Bacher
Import upstream version 2.12.12
235
</tr>
236
</tbody>
237
</table></div>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
238
</div>
239
<div class="refsect3">
1.66.16 by Iain Lane
Import upstream version 2.41.2
240
<a name="id-1.5.5.6.3.7"></a><h4>Returns</h4>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
241
<p> The number of bytes of output that was written</p>
242
<p></p>
243
</div>
1.3.10 by Sebastien Bacher
Import upstream version 2.19.2
244
<p class="since">Since 2.12</p>
1.2.21 by Sebastien Bacher
Import upstream version 2.12.12
245
</div>
246
<hr>
1.59.10 by Sebastien Bacher
Import upstream version 2.27.93
247
<div class="refsect2">
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
248
<a name="g-base64-encode"></a><h3>g_base64_encode ()</h3>
249
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
250
g_base64_encode (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="type">guchar</span></a> *data</code></em>,
251
                 <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> len</code></em>);</pre>
252
<p>Encode a sequence of binary data into its Base-64 stringified
1.66.9 by Emilio Pozuelo Monfort
Import upstream version 2.39.4
253
representation.</p>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
254
<div class="refsect3">
1.66.16 by Iain Lane
Import upstream version 2.41.2
255
<a name="id-1.5.5.6.4.5"></a><h4>Parameters</h4>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
256
<div class="informaltable"><table width="100%" border="0">
1.62.13 by Josselin Mouette
Import upstream version 2.33.12+really2.32.4
257
<colgroup>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
258
<col width="150px" class="parameters_name">
259
<col class="parameters_description">
260
<col width="200px" class="parameters_annotations">
1.62.13 by Josselin Mouette
Import upstream version 2.33.12+really2.32.4
261
</colgroup>
1.2.21 by Sebastien Bacher
Import upstream version 2.12.12
262
<tbody>
263
<tr>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
264
<td class="parameter_name"><p>data</p></td>
265
<td class="parameter_description"><p> the binary data to encode. </p></td>
266
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=len][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span></td>
267
</tr>
268
<tr>
269
<td class="parameter_name"><p>len</p></td>
270
<td class="parameter_description"><p>the length of <em class="parameter"><code>data</code></em>
271
</p></td>
272
<td class="parameter_annotations"> </td>
1.2.21 by Sebastien Bacher
Import upstream version 2.12.12
273
</tr>
274
</tbody>
275
</table></div>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
276
</div>
277
<div class="refsect3">
1.66.16 by Iain Lane
Import upstream version 2.41.2
278
<a name="id-1.5.5.6.4.6"></a><h4>Returns</h4>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
279
<p> a newly allocated, zero-terminated Base-64
280
encoded string representing <em class="parameter"><code>data</code></em>
281
. The returned string must
282
be freed with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a>. </p>
283
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
284
</div>
1.3.10 by Sebastien Bacher
Import upstream version 2.19.2
285
<p class="since">Since 2.12</p>
1.2.21 by Sebastien Bacher
Import upstream version 2.12.12
286
</div>
287
<hr>
1.59.10 by Sebastien Bacher
Import upstream version 2.27.93
288
<div class="refsect2">
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
289
<a name="g-base64-decode-step"></a><h3>g_base64_decode_step ()</h3>
290
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a>
291
g_base64_decode_step (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *in</code></em>,
292
                      <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> len</code></em>,
293
                      <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="type">guchar</span></a> *out</code></em>,
294
                      <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> *state</code></em>,
295
                      <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> *save</code></em>);</pre>
296
<p>Incrementally decode a sequence of binary data from its Base-64 stringified
1.12.3 by Sebastian Dröge
Import upstream version 2.25.16
297
representation. By calling this function multiple times you can convert
1.66.9 by Emilio Pozuelo Monfort
Import upstream version 2.39.4
298
data in chunks to avoid having to have the full encoded data in memory.</p>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
299
<p>The output buffer must be large enough to fit all the data that will
1.2.21 by Sebastien Bacher
Import upstream version 2.12.12
300
be written to it. Since base64 encodes 3 bytes in 4 chars you need
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
301
at least: (<em class="parameter"><code>len</code></em>
302
 / 4) * 3 + 3 bytes (+ 3 may be needed in case of non-zero
1.66.9 by Emilio Pozuelo Monfort
Import upstream version 2.39.4
303
state).</p>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
304
<div class="refsect3">
1.66.16 by Iain Lane
Import upstream version 2.41.2
305
<a name="id-1.5.5.6.5.6"></a><h4>Parameters</h4>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
306
<div class="informaltable"><table width="100%" border="0">
1.62.13 by Josselin Mouette
Import upstream version 2.33.12+really2.32.4
307
<colgroup>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
308
<col width="150px" class="parameters_name">
309
<col class="parameters_description">
310
<col width="200px" class="parameters_annotations">
1.62.13 by Josselin Mouette
Import upstream version 2.33.12+really2.32.4
311
</colgroup>
1.2.21 by Sebastien Bacher
Import upstream version 2.12.12
312
<tbody>
313
<tr>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
314
<td class="parameter_name"><p>in</p></td>
315
<td class="parameter_description"><p> binary input data. </p></td>
316
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=len][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span></td>
317
</tr>
318
<tr>
319
<td class="parameter_name"><p>len</p></td>
320
<td class="parameter_description"><p>max length of <em class="parameter"><code>in</code></em>
321
data to decode</p></td>
322
<td class="parameter_annotations"> </td>
323
</tr>
324
<tr>
325
<td class="parameter_name"><p>out</p></td>
326
<td class="parameter_description"><p> output buffer. </p></td>
327
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym>][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span></td>
328
</tr>
329
<tr>
330
<td class="parameter_name"><p>state</p></td>
331
<td class="parameter_description"><p> Saved state between steps, initialize to 0. </p></td>
332
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for input and for returning results. Default is transfer full."><span class="acronym">inout</span></acronym>]</span></td>
333
</tr>
334
<tr>
335
<td class="parameter_name"><p>save</p></td>
336
<td class="parameter_description"><p> Saved state between steps, initialize to 0. </p></td>
337
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for input and for returning results. Default is transfer full."><span class="acronym">inout</span></acronym>]</span></td>
1.2.21 by Sebastien Bacher
Import upstream version 2.12.12
338
</tr>
339
</tbody>
340
</table></div>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
341
</div>
342
<div class="refsect3">
1.66.16 by Iain Lane
Import upstream version 2.41.2
343
<a name="id-1.5.5.6.5.7"></a><h4>Returns</h4>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
344
<p> The number of bytes of output that was written</p>
345
<p></p>
346
</div>
1.3.10 by Sebastien Bacher
Import upstream version 2.19.2
347
<p class="since">Since 2.12</p>
1.2.21 by Sebastien Bacher
Import upstream version 2.12.12
348
</div>
349
<hr>
1.59.10 by Sebastien Bacher
Import upstream version 2.27.93
350
<div class="refsect2">
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
351
<a name="g-base64-decode"></a><h3>g_base64_decode ()</h3>
352
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="returnvalue">guchar</span></a> *
353
g_base64_decode (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *text</code></em>,
354
                 <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> *out_len</code></em>);</pre>
355
<p>Decode a sequence of Base-64 encoded text into binary data.  Note
1.63.17 by Emilio Pozuelo Monfort
Import upstream version 2.35.9
356
that the returned binary data is not necessarily zero-terminated,
1.66.9 by Emilio Pozuelo Monfort
Import upstream version 2.39.4
357
so it should not be used as a character string.</p>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
358
<div class="refsect3">
1.66.16 by Iain Lane
Import upstream version 2.41.2
359
<a name="id-1.5.5.6.6.5"></a><h4>Parameters</h4>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
360
<div class="informaltable"><table width="100%" border="0">
1.62.13 by Josselin Mouette
Import upstream version 2.33.12+really2.32.4
361
<colgroup>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
362
<col width="150px" class="parameters_name">
363
<col class="parameters_description">
364
<col width="200px" class="parameters_annotations">
1.62.13 by Josselin Mouette
Import upstream version 2.33.12+really2.32.4
365
</colgroup>
1.2.21 by Sebastien Bacher
Import upstream version 2.12.12
366
<tbody>
367
<tr>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
368
<td class="parameter_name"><p>text</p></td>
369
<td class="parameter_description"><p>zero-terminated string with base64 text to decode</p></td>
370
<td class="parameter_annotations"> </td>
371
</tr>
372
<tr>
373
<td class="parameter_name"><p>out_len</p></td>
374
<td class="parameter_description"><p> The length of the decoded data is written here. </p></td>
375
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
1.2.21 by Sebastien Bacher
Import upstream version 2.12.12
376
</tr>
377
</tbody>
378
</table></div>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
379
</div>
380
<div class="refsect3">
1.66.16 by Iain Lane
Import upstream version 2.41.2
381
<a name="id-1.5.5.6.6.6"></a><h4>Returns</h4>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
382
<p>              newly allocated buffer containing the binary data
383
that <em class="parameter"><code>text</code></em>
384
represents. The returned buffer must
385
be freed with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a>. </p>
386
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>][<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=out_len][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span></p>
387
</div>
1.3.10 by Sebastien Bacher
Import upstream version 2.19.2
388
<p class="since">Since 2.12</p>
1.4.1 by Gustavo Noronha Silva
Import upstream version 2.18.4
389
</div>
1.3.13 by Sebastien Bacher
Import upstream version 2.19.5
390
<hr>
1.59.10 by Sebastien Bacher
Import upstream version 2.27.93
391
<div class="refsect2">
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
392
<a name="g-base64-decode-inplace"></a><h3>g_base64_decode_inplace ()</h3>
393
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="returnvalue">guchar</span></a> *
394
g_base64_decode_inplace (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *text</code></em>,
395
                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> *out_len</code></em>);</pre>
396
<p>Decode a sequence of Base-64 encoded text into binary data
1.66.9 by Emilio Pozuelo Monfort
Import upstream version 2.39.4
397
by overwriting the input data.</p>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
398
<div class="refsect3">
1.66.16 by Iain Lane
Import upstream version 2.41.2
399
<a name="id-1.5.5.6.7.5"></a><h4>Parameters</h4>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
400
<div class="informaltable"><table width="100%" border="0">
1.62.13 by Josselin Mouette
Import upstream version 2.33.12+really2.32.4
401
<colgroup>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
402
<col width="150px" class="parameters_name">
403
<col class="parameters_description">
404
<col width="200px" class="parameters_annotations">
1.62.13 by Josselin Mouette
Import upstream version 2.33.12+really2.32.4
405
</colgroup>
1.3.13 by Sebastien Bacher
Import upstream version 2.19.5
406
<tbody>
407
<tr>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
408
<td class="parameter_name"><p>text</p></td>
409
<td class="parameter_description"><p> zero-terminated
410
string with base64 text to decode. </p></td>
411
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for input and for returning results. Default is transfer full."><span class="acronym">inout</span></acronym>][<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=out_len][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span></td>
412
</tr>
413
<tr>
414
<td class="parameter_name"><p>out_len</p></td>
415
<td class="parameter_description"><p> The length of the decoded data is written here. </p></td>
416
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for input and for returning results. Default is transfer full."><span class="acronym">inout</span></acronym>]</span></td>
1.3.13 by Sebastien Bacher
Import upstream version 2.19.5
417
</tr>
418
</tbody>
419
</table></div>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
420
</div>
421
<div class="refsect3">
1.66.16 by Iain Lane
Import upstream version 2.41.2
422
<a name="id-1.5.5.6.7.6"></a><h4>Returns</h4>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
423
<p> The binary data that <em class="parameter"><code>text</code></em>
424
responds. This pointer
425
is the same as the input <em class="parameter"><code>text</code></em>
426
. </p>
427
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
428
</div>
1.3.13 by Sebastien Bacher
Import upstream version 2.19.5
429
<p class="since">Since 2.20</p>
430
</div>
1.4.1 by Gustavo Noronha Silva
Import upstream version 2.18.4
431
</div>
1.66.10 by Andreas Henriksson
Import upstream version 2.39.90
432
<div class="refsect1">
433
<a name="glib-Base64-Encoding.other_details"></a><h2>Types and Values</h2>
434
</div>
1.3.1 by Sebastian Dröge
Import upstream version 2.17.0
435
</div>
436
<div class="footer">
1.2.30 by Loic Minier
Import upstream version 2.14.4
437
<hr>
1.67.3 by Iain Lane
Import upstream version 2.43.3
438
          Generated by GTK-Doc V1.21</div>
1.2.21 by Sebastien Bacher
Import upstream version 2.12.12
439
</body>
1.10.5 by Sebastian Dröge
Import upstream version 2.23.6
440
</html>