More PortAudio removal.
[metze/wireshark/wip.git] / epan / tvbuff_base64.c
1 /* tvbuff_base64.c
2  * Base-64 tvbuff implementation (based on real tvb)
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * SPDX-License-Identifier: GPL-2.0-or-later
9  */
10
11 #include "config.h"
12
13 #include <glib.h>
14
15 #include <epan/tvbuff.h>
16 #include <wsutil/base64.h>
17
18 tvbuff_t *
19 base64_to_tvb(tvbuff_t *parent, const char *base64)
20 {
21   tvbuff_t *tvb;
22   char *data = g_strdup(base64);
23   gint len;
24
25   len = (gint) ws_base64_decode_inplace(data);
26   tvb = tvb_new_child_real_data(parent, (const guint8 *)data, len, len);
27
28   tvb_set_free_cb(tvb, g_free);
29
30   return tvb;
31 }
32
33 /*
34  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
35  *
36  * Local Variables:
37  * c-basic-offset: 2
38  * tab-width: 8
39  * indent-tabs-mode: nil
40  * End:
41  *
42  * ex: set shiftwidth=2 tabstop=8 expandtab:
43  * :indentSize=2:tabSize=8:noTabs=true:
44  */