Debian Codegraph @

lib/libdvbv5/descriptors/desc_network_name.c

raw
1 /*
2 * Copyright (c) 2011-2012 - Mauro Carvalho Chehab
3 * Copyright (c) 2012 - Andre Roth <[email protected]>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published by
7 * the Free Software Foundation version 2.1 of the License.
8 *
9 * This program 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
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18 *
19 */
20
21 #include <libdvbv5/desc_network_name.h>
22 #include <libdvbv5/dvb-fe.h>
23 #include <parse_string.h>
24
25 #if __GNUC__ >= 9
26 #pragma GCC diagnostic ignored "-Waddress-of-packed-member"
27 #endif
28
29 int dvb_desc_network_name_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, struct dvb_desc *desc)
30 {
31 struct dvb_desc_network_name *net = (struct dvb_desc_network_name *) desc;
32 uint8_t len;
33
34 len = desc->length;
35 net->network_name = NULL;
36 net->network_name_emph = NULL;
37 dvb_parse_string(parms, &net->network_name, &net->network_name_emph, buf, len);
38 buf += len;
39 return 0;
40 }
41
42 void dvb_desc_network_name_print(struct dvb_v5_fe_parms *parms, const struct dvb_desc *desc)
43 {
44 const struct dvb_desc_network_name *net = (const struct dvb_desc_network_name *) desc;
45
46 dvb_loginfo("| network name: '%s'", net->network_name);
47 }
48
49 void dvb_desc_network_name_free(struct dvb_desc *desc)
50 {
51 const struct dvb_desc_network_name *net = (const struct dvb_desc_network_name *) desc;
52
53 free(net->network_name);
54 free(net->network_name_emph);
55 }