xine-lib 1.2.13-20230125hg15249
Functions | Variables
stree.c File Reference
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <xine/stree.h>

Functions

size_t xine_string_unpercent (char *s)
 
size_t xine_string_unbackslash (char *s)
 
size_t xine_string_unampersand (char *s)
 
static int _xine_stree_node_new (xine_stree_t **root, uint32_t *have, uint32_t *used, uint32_t parent)
 
static uint8_t * _xine_stree_get_string (uint8_t **p, uint8_t **q, const uint8_t *tab)
 
static xine_stree_t_xine_stree_load_xml (char *buf)
 
static xine_stree_t_xine_stree_load_json (char *buf)
 
static xine_stree_t_xine_stree_load_url (char *buf)
 
xine_stree_txine_stree_load (char *buf, xine_stree_mode_t *mode)
 
void xine_stree_dump (const xine_stree_t *tree, const char *buf, uint32_t base)
 
uint32_t xine_stree_find (const xine_stree_t *tree, const char *buf, const char *path, uint32_t base, int case_sens)
 
void xine_stree_delete (xine_stree_t **tree)
 

Variables

static const uint8_t _tab_unhex [256]
 
static const uint8_t _tab_xml [256]
 
static const uint8_t _tab_json1 [256]
 
static const uint8_t _tab_json2 [256]
 
static const uint8_t _tab_url [256]
 
static const uint8_t _tab_key [256]
 

Function Documentation

◆ _xine_stree_get_string()

static uint8_t * _xine_stree_get_string ( uint8_t ** p,
uint8_t ** q,
const uint8_t * tab )
static

◆ _xine_stree_load_json()

static xine_stree_t * _xine_stree_load_json ( char * buf)
static

◆ _xine_stree_load_url()

static xine_stree_t * _xine_stree_load_url ( char * buf)
static

◆ _xine_stree_load_xml()

static xine_stree_t * _xine_stree_load_xml ( char * buf)
static

◆ _xine_stree_node_new()

static int _xine_stree_node_new ( xine_stree_t ** root,
uint32_t * have,
uint32_t * used,
uint32_t parent )
static

◆ xine_stree_delete()

void xine_stree_delete ( xine_stree_t ** tree)

References NULL.

Referenced by mpd_input_dispose(), and mpd_input_load_manifest().

◆ xine_stree_dump()

void xine_stree_dump ( const xine_stree_t * tree,
const char * buf,
uint32_t base )

◆ xine_stree_find()

uint32_t xine_stree_find ( const xine_stree_t * tree,
const char * buf,
const char * path,
uint32_t base,
int case_sens )

path is a dot separated list of parts. part is a key, a zero based index number in square brackets, or both. the special key "[]" refers to xml tag content text. "foo.[][0]" will also be available as "foo".

References _tab_key, _tab_xml, xine_stree_t::first_child, xine_stree_t::key, xine_stree_t::next, v, and z.

Referenced by mpd_input_load_manifest(), and mpd_stree_find().

◆ xine_stree_load()

xine_stree_t * xine_stree_load ( char * buf,
xine_stree_mode_t * mode )

buf will be reused (modified) to hold the strings referenced by xine_stree_t. XINE_STREE_AUTO will update mode.

References _tab_xml, _xine_stree_load_json(), _xine_stree_load_url(), _xine_stree_load_xml(), mode(), NULL, XINE_STREE_AUTO, XINE_STREE_JSON, XINE_STREE_LAST, XINE_STREE_URL, and XINE_STREE_XML.

Referenced by mpd_input_load_manifest().

◆ xine_string_unampersand()

size_t xine_string_unampersand ( char * s)

"&amp;" -> "&" "&lt;" -> "<" "&gt;" -> ">" "&quot;" -> "\"" "&#xd575;" -> "핵" return new strlen ().

References _tab_unhex, v, and z.

Referenced by _xine_stree_load_xml().

◆ xine_string_unbackslash()

size_t xine_string_unbackslash ( char * s)

"\n" -> <newline> "\070" -> "8" "\x37" -> "7" "\ud575" -> "핵" "\cG" -> <bell> (^G) return new strlen ().

References _tab_unhex, v, and z.

Referenced by _xine_stree_load_json().

◆ xine_string_unpercent()

size_t xine_string_unpercent ( char * s)

"%3a" -> ":" etc. return new strlen ().

References _tab_unhex, v, and z.

Referenced by _xine_stree_load_url().

Variable Documentation

◆ _tab_json1

const uint8_t _tab_json1[256]
static
Initial value:
= {
['\r'] = 1,
['\n'] = 1,
['\t'] = 1,
[' '] = 1,
['\"'] = 2,
['\''] = 4,
['{'] = 8,
['['] = 8,
[']'] = 16,
['}'] = 16,
[','] = 32,
[':'] = 32,
['\\'] = 64,
[0] = 128
}

Referenced by _xine_stree_load_json().

◆ _tab_json2

const uint8_t _tab_json2[256]
static
Initial value:
= {
['/'] = 1,
['*'] = 2,
['\n'] = 4,
[0] = 128
}

Referenced by _xine_stree_load_json().

◆ _tab_key

const uint8_t _tab_key[256]
static
Initial value:
= {
['.'] = 1,
['['] = 2,
['0'] = 4,
['1'] = 4,
['2'] = 4,
['3'] = 4,
['4'] = 4,
['5'] = 4,
['6'] = 4,
['7'] = 4,
['8'] = 4,
['9'] = 4,
['\t'] = 8,
[' '] = 8,
['\0'] = 128
}

Referenced by xine_stree_find().

◆ _tab_unhex

const uint8_t _tab_unhex[256]
static
Initial value:
= {
128,128,128,128,128,128,128,128,128,192,128,128,128,128,128,128,
128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
192,128,128,128,128,128,128,128,128,128,128,128,128,192,128,128,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,192,128,128,128,128,128,
128, 10, 11, 12, 13, 14, 15,128,128,128,128,128,128,128,128,128,
128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
128, 10, 11, 12, 13, 14, 15,161,162,163,164,165,166,167,168,169,
170,171,172,173,174,175,176,177,178,179,180,128,128,128,128,128,
128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128
}

Referenced by xine_string_unampersand(), xine_string_unbackslash(), and xine_string_unpercent().

◆ _tab_url

const uint8_t _tab_url[256]
static
Initial value:
= {
['?'] = 1,
['#'] = 2,
['&'] = 4,
['='] = 8,
['\\'] = 64,
[0] = 128
}

Referenced by _xine_stree_load_url().

◆ _tab_xml

const uint8_t _tab_xml[256]
static
Initial value:
= {
['\r'] = 1,
['\n'] = 1,
['\t'] = 1,
[' '] = 1,
['\"'] = 2,
['\''] = 4,
['<'] = 8,
['>'] = 16,
['='] = 32,
['\\'] = 64,
[0] = 128
}

Referenced by _xine_stree_load_xml(), xine_stree_find(), and xine_stree_load().