<refentry id="gmime-gmime-encodings">
<refmeta>
<refentrytitle role="top_of_page" id="gmime-gmime-encodings.top_of_page">gmime-encodings</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>
  GMIME Library
</refmiscinfo>
</refmeta>
<refnamediv>
<refname>gmime-encodings</refname>
<refpurpose>MIME encoding functions</refpurpose>
</refnamediv>

<refsynopsisdiv id="gmime-gmime-encodings.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>enum                <link linkend="GMimeContentEncoding">GMimeContentEncoding</link>;
<link linkend="GMimeContentEncoding"><returnvalue>GMimeContentEncoding</returnvalue></link>  <link linkend="g-mime-content-encoding-from-string">g_mime_content_encoding_from_string</link>
                                                        (<parameter>const <link linkend="char"><type>char</type></link> *str</parameter>);
const <link linkend="char"><returnvalue>char</returnvalue></link> *        <link linkend="g-mime-content-encoding-to-string">g_mime_content_encoding_to_string</link>   (<parameter><link linkend="GMimeContentEncoding"><type>GMimeContentEncoding</type></link> encoding</parameter>);
enum                <link linkend="GMimeEncodingConstraint">GMimeEncodingConstraint</link>;
                    <link linkend="GMimeEncoding">GMimeEncoding</link>;
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="g-mime-encoding-init-encode">g_mime_encoding_init_encode</link>         (<parameter><link linkend="GMimeEncoding"><type>GMimeEncoding</type></link> *state</parameter>,
                                                         <parameter><link linkend="GMimeContentEncoding"><type>GMimeContentEncoding</type></link> encoding</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="g-mime-encoding-init-decode">g_mime_encoding_init_decode</link>         (<parameter><link linkend="GMimeEncoding"><type>GMimeEncoding</type></link> *state</parameter>,
                                                         <parameter><link linkend="GMimeContentEncoding"><type>GMimeContentEncoding</type></link> encoding</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="g-mime-encoding-reset">g_mime_encoding_reset</link>               (<parameter><link linkend="GMimeEncoding"><type>GMimeEncoding</type></link> *state</parameter>);
<link linkend="size-t"><returnvalue>size_t</returnvalue></link>              <link linkend="g-mime-encoding-outlen">g_mime_encoding_outlen</link>              (<parameter><link linkend="GMimeEncoding"><type>GMimeEncoding</type></link> *state</parameter>,
                                                         <parameter><link linkend="size-t"><type>size_t</type></link> inlen</parameter>);
<link linkend="size-t"><returnvalue>size_t</returnvalue></link>              <link linkend="g-mime-encoding-step">g_mime_encoding_step</link>                (<parameter><link linkend="GMimeEncoding"><type>GMimeEncoding</type></link> *state</parameter>,
                                                         <parameter>const <link linkend="char"><type>char</type></link> *inbuf</parameter>,
                                                         <parameter><link linkend="size-t"><type>size_t</type></link> inlen</parameter>,
                                                         <parameter><link linkend="char"><type>char</type></link> *outbuf</parameter>);
<link linkend="size-t"><returnvalue>size_t</returnvalue></link>              <link linkend="g-mime-encoding-flush">g_mime_encoding_flush</link>               (<parameter><link linkend="GMimeEncoding"><type>GMimeEncoding</type></link> *state</parameter>,
                                                         <parameter>const <link linkend="char"><type>char</type></link> *inbuf</parameter>,
                                                         <parameter><link linkend="size-t"><type>size_t</type></link> inlen</parameter>,
                                                         <parameter><link linkend="char"><type>char</type></link> *outbuf</parameter>);
#define             <link linkend="GMIME-BASE64-ENCODE-LEN:CAPS">GMIME_BASE64_ENCODE_LEN</link>             (x)
<link linkend="size-t"><returnvalue>size_t</returnvalue></link>              <link linkend="g-mime-encoding-base64-decode-step">g_mime_encoding_base64_decode_step</link>  (<parameter>unsigned <link linkend="char"><type>char</type></link> *inbuf</parameter>,
                                                         <parameter><link linkend="size-t"><type>size_t</type></link> inlen</parameter>,
                                                         <parameter>unsigned <link linkend="char"><type>char</type></link> *outbuf</parameter>,
                                                         <parameter><link linkend="int"><type>int</type></link> *state</parameter>,
                                                         <parameter><link linkend="guint32"><type>guint32</type></link> *save</parameter>);
<link linkend="size-t"><returnvalue>size_t</returnvalue></link>              <link linkend="g-mime-encoding-base64-encode-step">g_mime_encoding_base64_encode_step</link>  (<parameter>unsigned <link linkend="char"><type>char</type></link> *inbuf</parameter>,
                                                         <parameter><link linkend="size-t"><type>size_t</type></link> inlen</parameter>,
                                                         <parameter>unsigned <link linkend="char"><type>char</type></link> *outbuf</parameter>,
                                                         <parameter><link linkend="int"><type>int</type></link> *state</parameter>,
                                                         <parameter><link linkend="guint32"><type>guint32</type></link> *save</parameter>);
<link linkend="size-t"><returnvalue>size_t</returnvalue></link>              <link linkend="g-mime-encoding-base64-encode-close">g_mime_encoding_base64_encode_close</link> (<parameter>unsigned <link linkend="char"><type>char</type></link> *inbuf</parameter>,
                                                         <parameter><link linkend="size-t"><type>size_t</type></link> inlen</parameter>,
                                                         <parameter>unsigned <link linkend="char"><type>char</type></link> *outbuf</parameter>,
                                                         <parameter><link linkend="int"><type>int</type></link> *state</parameter>,
                                                         <parameter><link linkend="guint32"><type>guint32</type></link> *save</parameter>);
#define             <link linkend="GMIME-UUDECODE-STATE-INIT:CAPS">GMIME_UUDECODE_STATE_INIT</link>
#define             <link linkend="GMIME-UUDECODE-STATE-BEGIN:CAPS">GMIME_UUDECODE_STATE_BEGIN</link>
#define             <link linkend="GMIME-UUDECODE-STATE-END:CAPS">GMIME_UUDECODE_STATE_END</link>
#define             <link linkend="GMIME-UUENCODE-LEN:CAPS">GMIME_UUENCODE_LEN</link>                  (x)
<link linkend="size-t"><returnvalue>size_t</returnvalue></link>              <link linkend="g-mime-encoding-uudecode-step">g_mime_encoding_uudecode_step</link>       (<parameter>unsigned <link linkend="char"><type>char</type></link> *inbuf</parameter>,
                                                         <parameter><link linkend="size-t"><type>size_t</type></link> inlen</parameter>,
                                                         <parameter>unsigned <link linkend="char"><type>char</type></link> *outbuf</parameter>,
                                                         <parameter><link linkend="int"><type>int</type></link> *state</parameter>,
                                                         <parameter><link linkend="guint32"><type>guint32</type></link> *save</parameter>);
<link linkend="size-t"><returnvalue>size_t</returnvalue></link>              <link linkend="g-mime-encoding-uuencode-step">g_mime_encoding_uuencode_step</link>       (<parameter>unsigned <link linkend="char"><type>char</type></link> *inbuf</parameter>,
                                                         <parameter><link linkend="size-t"><type>size_t</type></link> inlen</parameter>,
                                                         <parameter>unsigned <link linkend="char"><type>char</type></link> *outbuf</parameter>,
                                                         <parameter>unsigned <link linkend="char"><type>char</type></link> *uubuf</parameter>,
                                                         <parameter><link linkend="int"><type>int</type></link> *state</parameter>,
                                                         <parameter><link linkend="guint32"><type>guint32</type></link> *save</parameter>);
<link linkend="size-t"><returnvalue>size_t</returnvalue></link>              <link linkend="g-mime-encoding-uuencode-close">g_mime_encoding_uuencode_close</link>      (<parameter>unsigned <link linkend="char"><type>char</type></link> *inbuf</parameter>,
                                                         <parameter><link linkend="size-t"><type>size_t</type></link> inlen</parameter>,
                                                         <parameter>unsigned <link linkend="char"><type>char</type></link> *outbuf</parameter>,
                                                         <parameter>unsigned <link linkend="char"><type>char</type></link> *uubuf</parameter>,
                                                         <parameter><link linkend="int"><type>int</type></link> *state</parameter>,
                                                         <parameter><link linkend="guint32"><type>guint32</type></link> *save</parameter>);
#define             <link linkend="GMIME-QP-ENCODE-LEN:CAPS">GMIME_QP_ENCODE_LEN</link>                 (x)
<link linkend="size-t"><returnvalue>size_t</returnvalue></link>              <link linkend="g-mime-encoding-quoted-decode-step">g_mime_encoding_quoted_decode_step</link>  (<parameter>unsigned <link linkend="char"><type>char</type></link> *inbuf</parameter>,
                                                         <parameter><link linkend="size-t"><type>size_t</type></link> inlen</parameter>,
                                                         <parameter>unsigned <link linkend="char"><type>char</type></link> *outbuf</parameter>,
                                                         <parameter><link linkend="int"><type>int</type></link> *state</parameter>,
                                                         <parameter><link linkend="guint32"><type>guint32</type></link> *save</parameter>);
<link linkend="size-t"><returnvalue>size_t</returnvalue></link>              <link linkend="g-mime-encoding-quoted-encode-step">g_mime_encoding_quoted_encode_step</link>  (<parameter>unsigned <link linkend="char"><type>char</type></link> *inbuf</parameter>,
                                                         <parameter><link linkend="size-t"><type>size_t</type></link> inlen</parameter>,
                                                         <parameter>unsigned <link linkend="char"><type>char</type></link> *outbuf</parameter>,
                                                         <parameter><link linkend="int"><type>int</type></link> *state</parameter>,
                                                         <parameter><link linkend="guint32"><type>guint32</type></link> *save</parameter>);
<link linkend="size-t"><returnvalue>size_t</returnvalue></link>              <link linkend="g-mime-encoding-quoted-encode-close">g_mime_encoding_quoted_encode_close</link> (<parameter>unsigned <link linkend="char"><type>char</type></link> *inbuf</parameter>,
                                                         <parameter><link linkend="size-t"><type>size_t</type></link> inlen</parameter>,
                                                         <parameter>unsigned <link linkend="char"><type>char</type></link> *outbuf</parameter>,
                                                         <parameter><link linkend="int"><type>int</type></link> *state</parameter>,
                                                         <parameter><link linkend="guint32"><type>guint32</type></link> *save</parameter>);
</synopsis>
</refsynopsisdiv>

<refsect1 id="gmime-gmime-encodings.description" role="desc">
<title role="desc.title">Description</title>
<para>
Utility functions to encode or decode MIME
Content-Transfer-Encodings.
</para>
</refsect1>
<refsect1 id="gmime-gmime-encodings.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="GMimeContentEncoding" role="enum">
<title>enum GMimeContentEncoding</title>
<indexterm zone="GMimeContentEncoding"><primary>GMimeContentEncoding</primary></indexterm>
<programlisting>typedef enum {
	GMIME_CONTENT_ENCODING_DEFAULT,
	GMIME_CONTENT_ENCODING_7BIT,
	GMIME_CONTENT_ENCODING_8BIT,
	GMIME_CONTENT_ENCODING_BINARY,
	GMIME_CONTENT_ENCODING_BASE64,
	GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE,
	GMIME_CONTENT_ENCODING_UUENCODE
} GMimeContentEncoding;
</programlisting>
<para>
A Content-Transfer-Encoding enumeration.
</para><variablelist role="enum">
<varlistentry id="GMIME-CONTENT-ENCODING-DEFAULT:CAPS" role="constant">
<term><literal>GMIME_CONTENT_ENCODING_DEFAULT</literal></term>
<listitem><simpara>Default transfer encoding.
</simpara></listitem>
</varlistentry>
<varlistentry id="GMIME-CONTENT-ENCODING-7BIT:CAPS" role="constant">
<term><literal>GMIME_CONTENT_ENCODING_7BIT</literal></term>
<listitem><simpara>7bit text transfer encoding.
</simpara></listitem>
</varlistentry>
<varlistentry id="GMIME-CONTENT-ENCODING-8BIT:CAPS" role="constant">
<term><literal>GMIME_CONTENT_ENCODING_8BIT</literal></term>
<listitem><simpara>8bit text transfer encoding.
</simpara></listitem>
</varlistentry>
<varlistentry id="GMIME-CONTENT-ENCODING-BINARY:CAPS" role="constant">
<term><literal>GMIME_CONTENT_ENCODING_BINARY</literal></term>
<listitem><simpara>Binary transfer encoding.
</simpara></listitem>
</varlistentry>
<varlistentry id="GMIME-CONTENT-ENCODING-BASE64:CAPS" role="constant">
<term><literal>GMIME_CONTENT_ENCODING_BASE64</literal></term>
<listitem><simpara>Base64 transfer encoding.
</simpara></listitem>
</varlistentry>
<varlistentry id="GMIME-CONTENT-ENCODING-QUOTEDPRINTABLE:CAPS" role="constant">
<term><literal>GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE</literal></term>
<listitem><simpara>Quoted-printable transfer encoding.
</simpara></listitem>
</varlistentry>
<varlistentry id="GMIME-CONTENT-ENCODING-UUENCODE:CAPS" role="constant">
<term><literal>GMIME_CONTENT_ENCODING_UUENCODE</literal></term>
<listitem><simpara>Uuencode transfer encoding.
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-content-encoding-from-string" role="function">
<title>g_mime_content_encoding_from_string ()</title>
<indexterm zone="g-mime-content-encoding-from-string"><primary>g_mime_content_encoding_from_string</primary></indexterm>
<programlisting><link linkend="GMimeContentEncoding"><returnvalue>GMimeContentEncoding</returnvalue></link>  g_mime_content_encoding_from_string
                                                        (<parameter>const <link linkend="char"><type>char</type></link> *str</parameter>);</programlisting>
<para>
Gets the appropriate <link linkend="GMimeContentEncoding"><type>GMimeContentEncoding</type></link> enumeration value based
on the input string.
</para><variablelist role="params">
<varlistentry><term><parameter>str</parameter>&#160;:</term>
<listitem><simpara>string representing a Content-Transfer-Encoding value
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the <link linkend="GMimeContentEncoding"><type>GMimeContentEncoding</type></link> specified by <parameter>str</parameter> or
<link linkend="GMIME-CONTENT-ENCODING-DEFAULT:CAPS"><type>GMIME_CONTENT_ENCODING_DEFAULT</type></link> on error.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-content-encoding-to-string" role="function">
<title>g_mime_content_encoding_to_string ()</title>
<indexterm zone="g-mime-content-encoding-to-string"><primary>g_mime_content_encoding_to_string</primary></indexterm>
<programlisting>const <link linkend="char"><returnvalue>char</returnvalue></link> *        g_mime_content_encoding_to_string   (<parameter><link linkend="GMimeContentEncoding"><type>GMimeContentEncoding</type></link> encoding</parameter>);</programlisting>
<para>
Gets the string value of the content encoding.
</para><variablelist role="params">
<varlistentry><term><parameter>encoding</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GMimeContentEncoding"><type>GMimeContentEncoding</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the encoding type as a string or <link linkend="NULL:CAPS"><literal>NULL</literal></link> on error. Available
values for the encoding are: <link linkend="GMIME-CONTENT-ENCODING-DEFAULT:CAPS"><type>GMIME_CONTENT_ENCODING_DEFAULT</type></link>,
<link linkend="GMIME-CONTENT-ENCODING-7BIT:CAPS"><type>GMIME_CONTENT_ENCODING_7BIT</type></link>, <link linkend="GMIME-CONTENT-ENCODING-8BIT:CAPS"><type>GMIME_CONTENT_ENCODING_8BIT</type></link>,
<link linkend="GMIME-CONTENT-ENCODING-BINARY:CAPS"><type>GMIME_CONTENT_ENCODING_BINARY</type></link>, <link linkend="GMIME-CONTENT-ENCODING-BASE64:CAPS"><type>GMIME_CONTENT_ENCODING_BASE64</type></link>,
<link linkend="GMIME-CONTENT-ENCODING-QUOTEDPRINTABLE:CAPS"><type>GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE</type></link> and
<link linkend="GMIME-CONTENT-ENCODING-UUENCODE:CAPS"><type>GMIME_CONTENT_ENCODING_UUENCODE</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="GMimeEncodingConstraint" role="enum">
<title>enum GMimeEncodingConstraint</title>
<indexterm zone="GMimeEncodingConstraint"><primary>GMimeEncodingConstraint</primary></indexterm>
<programlisting>typedef enum {
	GMIME_ENCODING_CONSTRAINT_7BIT,
	GMIME_ENCODING_CONSTRAINT_8BIT,
	GMIME_ENCODING_CONSTRAINT_BINARY
} GMimeEncodingConstraint;
</programlisting>
<para>
Used with functions like <link linkend="g-mime-filter-best-encoding"><function>g_mime_filter_best_encoding()</function></link> and
<link linkend="g-mime-object-encode"><function>g_mime_object_encode()</function></link> as the 'constraint' argument. These values
provide a means of letting the filter know what the encoding
constraints are for the stream.
</para><variablelist role="enum">
<varlistentry id="GMIME-ENCODING-CONSTRAINT-7BIT:CAPS" role="constant">
<term><literal>GMIME_ENCODING_CONSTRAINT_7BIT</literal></term>
<listitem><simpara>The stream data must fit within the 7bit ASCII range.
</simpara></listitem>
</varlistentry>
<varlistentry id="GMIME-ENCODING-CONSTRAINT-8BIT:CAPS" role="constant">
<term><literal>GMIME_ENCODING_CONSTRAINT_8BIT</literal></term>
<listitem><simpara>The stream data may have bytes with the high bit set, but no null bytes.
</simpara></listitem>
</varlistentry>
<varlistentry id="GMIME-ENCODING-CONSTRAINT-BINARY:CAPS" role="constant">
<term><literal>GMIME_ENCODING_CONSTRAINT_BINARY</literal></term>
<listitem><simpara>The stream may contain any binary data.
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="GMimeEncoding" role="struct">
<title>GMimeEncoding</title>
<indexterm zone="GMimeEncoding"><primary>GMimeEncoding</primary></indexterm>
<programlisting>typedef struct {
	GMimeContentEncoding encoding;
	unsigned char uubuf[60];
	gboolean encode;
	guint32 save;
	int state;
} GMimeEncoding;
</programlisting>
<para>
A context used for encoding or decoding data.
</para><variablelist role="struct">
<varlistentry><term><link linkend="GMimeContentEncoding"><type>GMimeContentEncoding</type></link>&#160;<structfield id="GMimeEncoding.encoding">encoding</structfield>;</term>
<listitem><simpara>the type of encoding
</simpara></listitem>
</varlistentry>
<varlistentry><term>unsigned&#160;<link linkend="char"><type>char</type></link>&#160;<structfield id="GMimeEncoding.uubuf">uubuf</structfield>[60];</term>
<listitem><simpara>a temporary buffer needed when uuencoding data
</simpara></listitem>
</varlistentry>
<varlistentry><term><link linkend="gboolean"><type>gboolean</type></link>&#160;<structfield id="GMimeEncoding.encode">encode</structfield>;</term>
<listitem><simpara><link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if encoding or <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> if decoding
</simpara></listitem>
</varlistentry>
<varlistentry><term><link linkend="guint32"><type>guint32</type></link>&#160;<structfield id="GMimeEncoding.save">save</structfield>;</term>
<listitem><simpara>saved bytes from the previous step
</simpara></listitem>
</varlistentry>
<varlistentry><term><link linkend="int"><type>int</type></link>&#160;<structfield id="GMimeEncoding.state">state</structfield>;</term>
<listitem><simpara>current encder/decoder state
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-encoding-init-encode" role="function">
<title>g_mime_encoding_init_encode ()</title>
<indexterm zone="g-mime-encoding-init-encode"><primary>g_mime_encoding_init_encode</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                g_mime_encoding_init_encode         (<parameter><link linkend="GMimeEncoding"><type>GMimeEncoding</type></link> *state</parameter>,
                                                         <parameter><link linkend="GMimeContentEncoding"><type>GMimeContentEncoding</type></link> encoding</parameter>);</programlisting>
<para>
Initializes a <link linkend="GMimeEncoding"><type>GMimeEncoding</type></link> state machine for encoding to
<parameter>encoding</parameter>.
</para><variablelist role="params">
<varlistentry><term><parameter>state</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GMimeEncoding"><type>GMimeEncoding</type></link> to initialize
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>encoding</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GMimeContentEncoding"><type>GMimeContentEncoding</type></link> to use
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-encoding-init-decode" role="function">
<title>g_mime_encoding_init_decode ()</title>
<indexterm zone="g-mime-encoding-init-decode"><primary>g_mime_encoding_init_decode</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                g_mime_encoding_init_decode         (<parameter><link linkend="GMimeEncoding"><type>GMimeEncoding</type></link> *state</parameter>,
                                                         <parameter><link linkend="GMimeContentEncoding"><type>GMimeContentEncoding</type></link> encoding</parameter>);</programlisting>
<para>
Initializes a <link linkend="GMimeEncoding"><type>GMimeEncoding</type></link> state machine for decoding from
<parameter>encoding</parameter>.
</para><variablelist role="params">
<varlistentry><term><parameter>state</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GMimeEncoding"><type>GMimeEncoding</type></link> to initialize
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>encoding</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GMimeContentEncoding"><type>GMimeContentEncoding</type></link> to use
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-encoding-reset" role="function">
<title>g_mime_encoding_reset ()</title>
<indexterm zone="g-mime-encoding-reset"><primary>g_mime_encoding_reset</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                g_mime_encoding_reset               (<parameter><link linkend="GMimeEncoding"><type>GMimeEncoding</type></link> *state</parameter>);</programlisting>
<para>
Resets the state of the <link linkend="GMimeEncoding"><type>GMimeEncoding</type></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>state</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GMimeEncoding"><type>GMimeEncoding</type></link> to reset
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-encoding-outlen" role="function">
<title>g_mime_encoding_outlen ()</title>
<indexterm zone="g-mime-encoding-outlen"><primary>g_mime_encoding_outlen</primary></indexterm>
<programlisting><link linkend="size-t"><returnvalue>size_t</returnvalue></link>              g_mime_encoding_outlen              (<parameter><link linkend="GMimeEncoding"><type>GMimeEncoding</type></link> *state</parameter>,
                                                         <parameter><link linkend="size-t"><type>size_t</type></link> inlen</parameter>);</programlisting>
<para>
Given the input length, <parameter>inlen</parameter>, calculate the needed output length
to perform an encoding or decoding step.
</para><variablelist role="params">
<varlistentry><term><parameter>state</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GMimeEncoding"><type>GMimeEncoding</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>inlen</parameter>&#160;:</term>
<listitem><simpara>an input length
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the maximum number of bytes needed to encode or decode a
buffer of <parameter>inlen</parameter> bytes.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-encoding-step" role="function">
<title>g_mime_encoding_step ()</title>
<indexterm zone="g-mime-encoding-step"><primary>g_mime_encoding_step</primary></indexterm>
<programlisting><link linkend="size-t"><returnvalue>size_t</returnvalue></link>              g_mime_encoding_step                (<parameter><link linkend="GMimeEncoding"><type>GMimeEncoding</type></link> *state</parameter>,
                                                         <parameter>const <link linkend="char"><type>char</type></link> *inbuf</parameter>,
                                                         <parameter><link linkend="size-t"><type>size_t</type></link> inlen</parameter>,
                                                         <parameter><link linkend="char"><type>char</type></link> *outbuf</parameter>);</programlisting>
<para>
Incrementally encodes or decodes (depending on <parameter>state</parameter>) an input
stream by 'stepping' through a block of input at a time.
</para>
<para>
You should make sure <parameter>outbuf</parameter> is large enough by calling
<link linkend="g-mime-encoding-outlen"><function>g_mime_encoding_outlen()</function></link> to find out how large <parameter>outbuf</parameter> might need
to be.
</para><variablelist role="params">
<varlistentry><term><parameter>state</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GMimeEncoding"><type>GMimeEncoding</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>inbuf</parameter>&#160;:</term>
<listitem><simpara>an input buffer to encode or decode
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>inlen</parameter>&#160;:</term>
<listitem><simpara>input buffer length
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>outbuf</parameter>&#160;:</term>
<listitem><simpara>an output buffer
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the number of bytes written to <parameter>outbuf</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-encoding-flush" role="function">
<title>g_mime_encoding_flush ()</title>
<indexterm zone="g-mime-encoding-flush"><primary>g_mime_encoding_flush</primary></indexterm>
<programlisting><link linkend="size-t"><returnvalue>size_t</returnvalue></link>              g_mime_encoding_flush               (<parameter><link linkend="GMimeEncoding"><type>GMimeEncoding</type></link> *state</parameter>,
                                                         <parameter>const <link linkend="char"><type>char</type></link> *inbuf</parameter>,
                                                         <parameter><link linkend="size-t"><type>size_t</type></link> inlen</parameter>,
                                                         <parameter><link linkend="char"><type>char</type></link> *outbuf</parameter>);</programlisting>
<para>
Completes the incremental encode or decode of the input stream (see
<link linkend="g-mime-encoding-step"><function>g_mime_encoding_step()</function></link> for details).
</para><variablelist role="params">
<varlistentry><term><parameter>state</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GMimeEncoding"><type>GMimeEncoding</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>inbuf</parameter>&#160;:</term>
<listitem><simpara>an input buffer to encode or decode
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>inlen</parameter>&#160;:</term>
<listitem><simpara>input buffer length
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>outbuf</parameter>&#160;:</term>
<listitem><simpara>an output buffer
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the number of bytes written to <parameter>outbuf</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="GMIME-BASE64-ENCODE-LEN:CAPS" role="macro">
<title>GMIME_BASE64_ENCODE_LEN()</title>
<indexterm zone="GMIME-BASE64-ENCODE-LEN:CAPS"><primary>GMIME_BASE64_ENCODE_LEN</primary></indexterm>
<programlisting>#define GMIME_BASE64_ENCODE_LEN(x) ((size_t) (((((x) + 2) / 57) * 77) + 77))
</programlisting>
<para>
Calculates the maximum number of bytes needed to base64 encode the
full input buffer of length <parameter>x</parameter>.
</para><variablelist role="params">
<varlistentry><term><parameter>x</parameter>&#160;:</term>
<listitem><simpara>Length of the input data to encode
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the number of output bytes needed to base64 encode an input
buffer of size <parameter>x</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-encoding-base64-decode-step" role="function">
<title>g_mime_encoding_base64_decode_step ()</title>
<indexterm zone="g-mime-encoding-base64-decode-step"><primary>g_mime_encoding_base64_decode_step</primary></indexterm>
<programlisting><link linkend="size-t"><returnvalue>size_t</returnvalue></link>              g_mime_encoding_base64_decode_step  (<parameter>unsigned <link linkend="char"><type>char</type></link> *inbuf</parameter>,
                                                         <parameter><link linkend="size-t"><type>size_t</type></link> inlen</parameter>,
                                                         <parameter>unsigned <link linkend="char"><type>char</type></link> *outbuf</parameter>,
                                                         <parameter><link linkend="int"><type>int</type></link> *state</parameter>,
                                                         <parameter><link linkend="guint32"><type>guint32</type></link> *save</parameter>);</programlisting>
<para>
Decodes a chunk of base64 encoded data.
</para><variablelist role="params">
<varlistentry><term><parameter>inbuf</parameter>&#160;:</term>
<listitem><simpara>input buffer
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>inlen</parameter>&#160;:</term>
<listitem><simpara>input buffer length
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>outbuf</parameter>&#160;:</term>
<listitem><simpara>output buffer
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>state</parameter>&#160;:</term>
<listitem><simpara>holds the number of bits that are stored in <parameter>save</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>save</parameter>&#160;:</term>
<listitem><simpara>leftover bits that have not yet been decoded
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the number of bytes decoded (which have been dumped in
<parameter>outbuf</parameter>).
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-encoding-base64-encode-step" role="function">
<title>g_mime_encoding_base64_encode_step ()</title>
<indexterm zone="g-mime-encoding-base64-encode-step"><primary>g_mime_encoding_base64_encode_step</primary></indexterm>
<programlisting><link linkend="size-t"><returnvalue>size_t</returnvalue></link>              g_mime_encoding_base64_encode_step  (<parameter>unsigned <link linkend="char"><type>char</type></link> *inbuf</parameter>,
                                                         <parameter><link linkend="size-t"><type>size_t</type></link> inlen</parameter>,
                                                         <parameter>unsigned <link linkend="char"><type>char</type></link> *outbuf</parameter>,
                                                         <parameter><link linkend="int"><type>int</type></link> *state</parameter>,
                                                         <parameter><link linkend="guint32"><type>guint32</type></link> *save</parameter>);</programlisting>
<para>
Base64 encodes a chunk of data. Performs an 'encode step', only
encodes blocks of 3 characters to the output at a time, saves
left-over state in state and save (initialise to 0 on first
invocation).
</para><variablelist role="params">
<varlistentry><term><parameter>inbuf</parameter>&#160;:</term>
<listitem><simpara>input buffer
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>inlen</parameter>&#160;:</term>
<listitem><simpara>input buffer length
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>outbuf</parameter>&#160;:</term>
<listitem><simpara>output buffer
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>state</parameter>&#160;:</term>
<listitem><simpara>holds the number of bits that are stored in <parameter>save</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>save</parameter>&#160;:</term>
<listitem><simpara>leftover bits that have not yet been encoded
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the number of bytes encoded.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-encoding-base64-encode-close" role="function">
<title>g_mime_encoding_base64_encode_close ()</title>
<indexterm zone="g-mime-encoding-base64-encode-close"><primary>g_mime_encoding_base64_encode_close</primary></indexterm>
<programlisting><link linkend="size-t"><returnvalue>size_t</returnvalue></link>              g_mime_encoding_base64_encode_close (<parameter>unsigned <link linkend="char"><type>char</type></link> *inbuf</parameter>,
                                                         <parameter><link linkend="size-t"><type>size_t</type></link> inlen</parameter>,
                                                         <parameter>unsigned <link linkend="char"><type>char</type></link> *outbuf</parameter>,
                                                         <parameter><link linkend="int"><type>int</type></link> *state</parameter>,
                                                         <parameter><link linkend="guint32"><type>guint32</type></link> *save</parameter>);</programlisting>
<para>
Base64 encodes the input stream to the output stream. Call this
when finished encoding data with <link linkend="g-mime-encoding-base64-encode-step"><function>g_mime_encoding_base64_encode_step()</function></link>
to flush off the last little bit.
</para><variablelist role="params">
<varlistentry><term><parameter>inbuf</parameter>&#160;:</term>
<listitem><simpara>input buffer
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>inlen</parameter>&#160;:</term>
<listitem><simpara>input buffer length
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>outbuf</parameter>&#160;:</term>
<listitem><simpara>output buffer
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>state</parameter>&#160;:</term>
<listitem><simpara>holds the number of bits that are stored in <parameter>save</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>save</parameter>&#160;:</term>
<listitem><simpara>leftover bits that have not yet been encoded
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the number of bytes encoded.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="GMIME-UUDECODE-STATE-INIT:CAPS" role="macro">
<title>GMIME_UUDECODE_STATE_INIT</title>
<indexterm zone="GMIME-UUDECODE-STATE-INIT:CAPS"><primary>GMIME_UUDECODE_STATE_INIT</primary></indexterm>
<programlisting>#define GMIME_UUDECODE_STATE_INIT   (0)
</programlisting>
<para>
Initial state for the <link linkend="g-mime-encoding-uudecode-step"><function>g_mime_encoding_uudecode_step()</function></link> function.
</para></refsect2>
<refsect2 id="GMIME-UUDECODE-STATE-BEGIN:CAPS" role="macro">
<title>GMIME_UUDECODE_STATE_BEGIN</title>
<indexterm zone="GMIME-UUDECODE-STATE-BEGIN:CAPS"><primary>GMIME_UUDECODE_STATE_BEGIN</primary></indexterm>
<programlisting>#define GMIME_UUDECODE_STATE_BEGIN  (1 &lt;&lt; 16)
</programlisting>
<para>
State for the <link linkend="g-mime-encoding-uudecode-step"><function>g_mime_encoding_uudecode_step()</function></link> function, denoting that
the 'begin' line has been found.
</para></refsect2>
<refsect2 id="GMIME-UUDECODE-STATE-END:CAPS" role="macro">
<title>GMIME_UUDECODE_STATE_END</title>
<indexterm zone="GMIME-UUDECODE-STATE-END:CAPS"><primary>GMIME_UUDECODE_STATE_END</primary></indexterm>
<programlisting>#define GMIME_UUDECODE_STATE_END    (1 &lt;&lt; 17)
</programlisting>
<para>
State for the <link linkend="g-mime-encoding-uudecode-step"><function>g_mime_encoding_uudecode_step()</function></link> function, denoting that
the end of the UU encoded block has been found.
</para></refsect2>
<refsect2 id="GMIME-UUENCODE-LEN:CAPS" role="macro">
<title>GMIME_UUENCODE_LEN()</title>
<indexterm zone="GMIME-UUENCODE-LEN:CAPS"><primary>GMIME_UUENCODE_LEN</primary></indexterm>
<programlisting>#define GMIME_UUENCODE_LEN(x)      ((size_t) (((((x) + 2) / 45) * 62) + 64))
</programlisting>
<para>
Calculates the maximum number of bytes needed to uuencode the full
input buffer of length <parameter>x</parameter>.
</para><variablelist role="params">
<varlistentry><term><parameter>x</parameter>&#160;:</term>
<listitem><simpara>Length of the input data to encode
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the number of output bytes needed to uuencode an input
buffer of size <parameter>x</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-encoding-uudecode-step" role="function">
<title>g_mime_encoding_uudecode_step ()</title>
<indexterm zone="g-mime-encoding-uudecode-step"><primary>g_mime_encoding_uudecode_step</primary></indexterm>
<programlisting><link linkend="size-t"><returnvalue>size_t</returnvalue></link>              g_mime_encoding_uudecode_step       (<parameter>unsigned <link linkend="char"><type>char</type></link> *inbuf</parameter>,
                                                         <parameter><link linkend="size-t"><type>size_t</type></link> inlen</parameter>,
                                                         <parameter>unsigned <link linkend="char"><type>char</type></link> *outbuf</parameter>,
                                                         <parameter><link linkend="int"><type>int</type></link> *state</parameter>,
                                                         <parameter><link linkend="guint32"><type>guint32</type></link> *save</parameter>);</programlisting>
<para>
Uudecodes a chunk of data. Performs a 'decode step' on a chunk of
uuencoded data. Assumes the "begin mode filename" line has
been stripped off.
</para><variablelist role="params">
<varlistentry><term><parameter>inbuf</parameter>&#160;:</term>
<listitem><simpara>input buffer
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>inlen</parameter>&#160;:</term>
<listitem><simpara>input buffer length
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>outbuf</parameter>&#160;:</term>
<listitem><simpara>output buffer
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>state</parameter>&#160;:</term>
<listitem><simpara>holds the number of bits that are stored in <parameter>save</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>save</parameter>&#160;:</term>
<listitem><simpara>leftover bits that have not yet been decoded
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the number of bytes decoded.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-encoding-uuencode-step" role="function">
<title>g_mime_encoding_uuencode_step ()</title>
<indexterm zone="g-mime-encoding-uuencode-step"><primary>g_mime_encoding_uuencode_step</primary></indexterm>
<programlisting><link linkend="size-t"><returnvalue>size_t</returnvalue></link>              g_mime_encoding_uuencode_step       (<parameter>unsigned <link linkend="char"><type>char</type></link> *inbuf</parameter>,
                                                         <parameter><link linkend="size-t"><type>size_t</type></link> inlen</parameter>,
                                                         <parameter>unsigned <link linkend="char"><type>char</type></link> *outbuf</parameter>,
                                                         <parameter>unsigned <link linkend="char"><type>char</type></link> *uubuf</parameter>,
                                                         <parameter><link linkend="int"><type>int</type></link> *state</parameter>,
                                                         <parameter><link linkend="guint32"><type>guint32</type></link> *save</parameter>);</programlisting>
<para>
Uuencodes a chunk of data. Performs an 'encode step', only encodes
blocks of 45 characters to the output at a time, saves left-over
state in <parameter>uubuf</parameter>, <parameter>state</parameter> and <parameter>save</parameter> (initialize to 0 on first
invocation).
</para><variablelist role="params">
<varlistentry><term><parameter>inbuf</parameter>&#160;:</term>
<listitem><simpara>input buffer
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>inlen</parameter>&#160;:</term>
<listitem><simpara>input buffer length
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>outbuf</parameter>&#160;:</term>
<listitem><simpara>output stream
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>uubuf</parameter>&#160;:</term>
<listitem><simpara>temporary buffer of 60 bytes
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>state</parameter>&#160;:</term>
<listitem><simpara>holds the number of bits that are stored in <parameter>save</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>save</parameter>&#160;:</term>
<listitem><simpara>leftover bits that have not yet been encoded
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the number of bytes encoded.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-encoding-uuencode-close" role="function">
<title>g_mime_encoding_uuencode_close ()</title>
<indexterm zone="g-mime-encoding-uuencode-close"><primary>g_mime_encoding_uuencode_close</primary></indexterm>
<programlisting><link linkend="size-t"><returnvalue>size_t</returnvalue></link>              g_mime_encoding_uuencode_close      (<parameter>unsigned <link linkend="char"><type>char</type></link> *inbuf</parameter>,
                                                         <parameter><link linkend="size-t"><type>size_t</type></link> inlen</parameter>,
                                                         <parameter>unsigned <link linkend="char"><type>char</type></link> *outbuf</parameter>,
                                                         <parameter>unsigned <link linkend="char"><type>char</type></link> *uubuf</parameter>,
                                                         <parameter><link linkend="int"><type>int</type></link> *state</parameter>,
                                                         <parameter><link linkend="guint32"><type>guint32</type></link> *save</parameter>);</programlisting>
<para>
Uuencodes a chunk of data. Call this when finished encoding data
with <link linkend="g-mime-encoding-uuencode-step"><function>g_mime_encoding_uuencode_step()</function></link> to flush off the last little bit.
</para><variablelist role="params">
<varlistentry><term><parameter>inbuf</parameter>&#160;:</term>
<listitem><simpara>input buffer
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>inlen</parameter>&#160;:</term>
<listitem><simpara>input buffer length
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>outbuf</parameter>&#160;:</term>
<listitem><simpara>output buffer
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>uubuf</parameter>&#160;:</term>
<listitem><simpara>temporary buffer of 60 bytes
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>state</parameter>&#160;:</term>
<listitem><simpara>holds the number of bits that are stored in <parameter>save</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>save</parameter>&#160;:</term>
<listitem><simpara>leftover bits that have not yet been encoded
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the number of bytes encoded.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="GMIME-QP-ENCODE-LEN:CAPS" role="macro">
<title>GMIME_QP_ENCODE_LEN()</title>
<indexterm zone="GMIME-QP-ENCODE-LEN:CAPS"><primary>GMIME_QP_ENCODE_LEN</primary></indexterm>
<programlisting>#define GMIME_QP_ENCODE_LEN(x)     ((size_t) ((((x) / 24) * 74) + 74))
</programlisting>
<para>
Calculates the maximum number of bytes needed to encode the full
input buffer of length <parameter>x</parameter> using the quoted-printable encoding.
</para><variablelist role="params">
<varlistentry><term><parameter>x</parameter>&#160;:</term>
<listitem><simpara>Length of the input data to encode
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the number of output bytes needed to encode an input buffer
of size <parameter>x</parameter> using the quoted-printable encoding.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-encoding-quoted-decode-step" role="function">
<title>g_mime_encoding_quoted_decode_step ()</title>
<indexterm zone="g-mime-encoding-quoted-decode-step"><primary>g_mime_encoding_quoted_decode_step</primary></indexterm>
<programlisting><link linkend="size-t"><returnvalue>size_t</returnvalue></link>              g_mime_encoding_quoted_decode_step  (<parameter>unsigned <link linkend="char"><type>char</type></link> *inbuf</parameter>,
                                                         <parameter><link linkend="size-t"><type>size_t</type></link> inlen</parameter>,
                                                         <parameter>unsigned <link linkend="char"><type>char</type></link> *outbuf</parameter>,
                                                         <parameter><link linkend="int"><type>int</type></link> *state</parameter>,
                                                         <parameter><link linkend="guint32"><type>guint32</type></link> *save</parameter>);</programlisting>
<para>
Decodes a block of quoted-printable encoded data. Performs a
'decode step' on a chunk of QP encoded data.
</para><variablelist role="params">
<varlistentry><term><parameter>inbuf</parameter>&#160;:</term>
<listitem><simpara>input buffer
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>inlen</parameter>&#160;:</term>
<listitem><simpara>input buffer length
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>outbuf</parameter>&#160;:</term>
<listitem><simpara>output buffer
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>state</parameter>&#160;:</term>
<listitem><simpara>holds the number of bits that are stored in <parameter>save</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>save</parameter>&#160;:</term>
<listitem><simpara>leftover bits that have not yet been decoded
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the number of bytes decoded.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-encoding-quoted-encode-step" role="function">
<title>g_mime_encoding_quoted_encode_step ()</title>
<indexterm zone="g-mime-encoding-quoted-encode-step"><primary>g_mime_encoding_quoted_encode_step</primary></indexterm>
<programlisting><link linkend="size-t"><returnvalue>size_t</returnvalue></link>              g_mime_encoding_quoted_encode_step  (<parameter>unsigned <link linkend="char"><type>char</type></link> *inbuf</parameter>,
                                                         <parameter><link linkend="size-t"><type>size_t</type></link> inlen</parameter>,
                                                         <parameter>unsigned <link linkend="char"><type>char</type></link> *outbuf</parameter>,
                                                         <parameter><link linkend="int"><type>int</type></link> *state</parameter>,
                                                         <parameter><link linkend="guint32"><type>guint32</type></link> *save</parameter>);</programlisting>
<para>
Quoted-printable encodes a block of text. Performs an 'encode
step', saves left-over state in state and save (initialise to -1 on
first invocation).
</para><variablelist role="params">
<varlistentry><term><parameter>inbuf</parameter>&#160;:</term>
<listitem><simpara>input buffer
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>inlen</parameter>&#160;:</term>
<listitem><simpara>input buffer length
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>outbuf</parameter>&#160;:</term>
<listitem><simpara>output buffer
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>state</parameter>&#160;:</term>
<listitem><simpara>holds the number of bits that are stored in <parameter>save</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>save</parameter>&#160;:</term>
<listitem><simpara>leftover bits that have not yet been encoded
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the number of bytes encoded.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-encoding-quoted-encode-close" role="function">
<title>g_mime_encoding_quoted_encode_close ()</title>
<indexterm zone="g-mime-encoding-quoted-encode-close"><primary>g_mime_encoding_quoted_encode_close</primary></indexterm>
<programlisting><link linkend="size-t"><returnvalue>size_t</returnvalue></link>              g_mime_encoding_quoted_encode_close (<parameter>unsigned <link linkend="char"><type>char</type></link> *inbuf</parameter>,
                                                         <parameter><link linkend="size-t"><type>size_t</type></link> inlen</parameter>,
                                                         <parameter>unsigned <link linkend="char"><type>char</type></link> *outbuf</parameter>,
                                                         <parameter><link linkend="int"><type>int</type></link> *state</parameter>,
                                                         <parameter><link linkend="guint32"><type>guint32</type></link> *save</parameter>);</programlisting>
<para>
Quoted-printable encodes a block of text. Call this when finished
encoding data with <link linkend="g-mime-encoding-quoted-encode-step"><function>g_mime_encoding_quoted_encode_step()</function></link> to flush off
the last little bit.
</para><variablelist role="params">
<varlistentry><term><parameter>inbuf</parameter>&#160;:</term>
<listitem><simpara>input buffer
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>inlen</parameter>&#160;:</term>
<listitem><simpara>input buffer length
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>outbuf</parameter>&#160;:</term>
<listitem><simpara>output buffer
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>state</parameter>&#160;:</term>
<listitem><simpara>holds the number of bits that are stored in <parameter>save</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>save</parameter>&#160;:</term>
<listitem><simpara>leftover bits that have not yet been encoded
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the number of bytes encoded.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>

</refentry>
