gio: Remove unused function
[platform/upstream/gstreamer.git] / gst-libs / gst / rtsp / gstrtspbase64.c
1 /* GStreamer
2  * Copyright (C) <2007> Mike Smith <msmith@xiph.org>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 /**
21  * SECTION:gstrtspbase64
22  * @short_description: Helper functions to handle Base64
23  *
24  * Last reviewed on 2007-07-24 (0.10.14)
25  */
26
27 #ifdef HAVE_CONFIG_H
28 #include "config.h"
29 #endif
30
31 #include <string.h>
32
33 #include "gstrtspbase64.h"
34
35 /**
36  * gst_rtsp_base64_encode:
37  * @data: the binary data to encode
38  * @len: the length of @data
39  *
40  * Encode a sequence of binary data into its Base-64 stringified representation.
41  *
42  * Deprecated: Use g_base64_encode()
43  *
44  * Returns: a newly allocated, zero-terminated Base-64 encoded string
45  * representing @data.
46  */
47 /* This isn't efficient, but it doesn't need to be */
48 #ifndef GST_REMOVE_DEPRECATED
49 gchar *
50 gst_rtsp_base64_encode (const gchar * data, gsize len)
51 {
52   return g_base64_encode ((const guchar *) data, len);
53 }
54 #endif
55
56 /**
57  * gst_rtsp_base64_decode_ip:
58  * @data: the base64 encoded data
59  * @len: location for output length or NULL
60  *
61  * Decode the base64 string pointed to by @data in-place. When @len is not #NULL
62  * it will contain the length of the decoded data.
63  */
64 /* FIXME: Deprecate this once we depend on GLib 2.20 and
65  * use g_base64_decode_inplace then.
66  */
67 void
68 gst_rtsp_base64_decode_ip (gchar * data, gsize * len)
69 {
70   gint input_length, output_length, state = 0;
71   guint save = 0;
72
73   g_return_if_fail (data != NULL);
74
75   input_length = strlen (data);
76
77   g_return_if_fail (input_length > 1);
78
79   output_length =
80       g_base64_decode_step (data, input_length, (guchar *) data, &state, &save);
81
82   if (len)
83     *len = output_length;
84 }