Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Icecast-Server
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
93
Issues
93
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
External Wiki
External Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xiph.Org
Icecast-Server
Commits
2a4ed046
Commit
2a4ed046
authored
Oct 07, 2020
by
Philipp Schafft
🦁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Feature: Handle <max_listeners> and <authenticator> nicer
parent
02e9c048
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
3 deletions
+28
-3
src/xml2json.c
src/xml2json.c
+28
-3
No files found.
src/xml2json.c
View file @
2a4ed046
...
...
@@ -218,13 +218,14 @@ static void render_node_legacyresponse(json_renderer_t *renderer, xmlDocPtr doc,
static
int
handle_simple_child
(
json_renderer_t
*
renderer
,
xmlDocPtr
doc
,
xmlNodePtr
node
,
xmlNodePtr
parent
,
struct
xml2json_cache
*
cache
,
xmlNodePtr
child
,
const
char
*
number_keys
[],
const
char
*
boolean_keys
[])
{
if
(
child
->
type
==
XML_ELEMENT_NODE
&&
child
->
name
)
{
const
char
*
childname
=
(
const
char
*
)
child
->
name
;
size_t
i
;
for
(
i
=
0
;
number_keys
[
i
];
i
++
)
{
if
(
strcmp
(
(
const
char
*
)
child
->
name
,
number_keys
[
i
])
==
0
)
{
if
(
strcmp
(
child
name
,
number_keys
[
i
])
==
0
)
{
xmlChar
*
value
=
xmlNodeListGetString
(
doc
,
child
->
xmlChildrenNode
,
1
);
if
(
value
)
{
json_renderer_write_key
(
renderer
,
(
const
char
*
)
child
->
name
,
JSON_RENDERER_FLAGS_NONE
);
json_renderer_write_key
(
renderer
,
child
name
,
JSON_RENDERER_FLAGS_NONE
);
json_renderer_write_int
(
renderer
,
strtoll
((
const
char
*
)
value
,
NULL
,
10
));
xmlFree
(
value
);
return
1
;
...
...
@@ -233,12 +234,36 @@ static int handle_simple_child(json_renderer_t *renderer, xmlDocPtr doc, xmlNode
}
for
(
i
=
0
;
boolean_keys
[
i
];
i
++
)
{
if
(
strcmp
(
(
const
char
*
)
child
->
name
,
boolean_keys
[
i
])
==
0
)
{
if
(
strcmp
(
child
name
,
boolean_keys
[
i
])
==
0
)
{
handle_booleanchildnode
(
renderer
,
doc
,
child
,
node
,
cache
);
return
1
;
}
}
if
(
strcmp
(
childname
,
"max_listeners"
)
==
0
)
{
xmlChar
*
value
=
xmlNodeListGetString
(
doc
,
child
->
xmlChildrenNode
,
1
);
if
(
value
)
{
json_renderer_write_key
(
renderer
,
childname
,
JSON_RENDERER_FLAGS_NONE
);
if
(
strcmp
((
const
char
*
)
value
,
"unlimited"
)
==
0
)
{
json_renderer_write_null
(
renderer
);
}
else
{
json_renderer_write_int
(
renderer
,
strtoll
((
const
char
*
)
value
,
NULL
,
10
));
}
xmlFree
(
value
);
return
1
;
}
}
if
(
strcmp
(
childname
,
"authenticator"
)
==
0
)
{
xmlChar
*
value
=
xmlNodeListGetString
(
doc
,
child
->
xmlChildrenNode
,
1
);
if
(
value
)
{
json_renderer_write_key
(
renderer
,
childname
,
JSON_RENDERER_FLAGS_NONE
);
json_renderer_write_boolean
(
renderer
,
strlen
((
const
char
*
)
value
));
xmlFree
(
value
);
return
1
;
}
}
if
(
child
->
xmlChildrenNode
&&
!
child
->
xmlChildrenNode
->
next
&&
child
->
xmlChildrenNode
->
type
==
XML_TEXT_NODE
)
{
handle_textchildnode
(
renderer
,
doc
,
child
,
node
,
cache
);
return
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment