Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
49a0cf38
Commit
49a0cf38
authored
Aug 19, 2009
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xspf: factorize and set to NULL only when needed.
parent
3172fde5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
23 deletions
+21
-23
modules/demux/playlist/xspf.c
modules/demux/playlist/xspf.c
+21
-23
No files found.
modules/demux/playlist/xspf.c
View file @
49a0cf38
...
@@ -158,6 +158,7 @@ static bool parse_playlist_node COMPLEX_INTERFACE
...
@@ -158,6 +158,7 @@ static bool parse_playlist_node COMPLEX_INTERFACE
char
*
psz_value
=
NULL
;
char
*
psz_value
=
NULL
;
bool
b_version_found
=
false
;
bool
b_version_found
=
false
;
int
i_node
;
int
i_node
;
bool
b_ret
=
false
;
xml_elem_hnd_t
*
p_handler
=
NULL
;
xml_elem_hnd_t
*
p_handler
=
NULL
;
xml_elem_hnd_t
pl_elements
[]
=
xml_elem_hnd_t
pl_elements
[]
=
...
@@ -186,9 +187,7 @@ static bool parse_playlist_node COMPLEX_INTERFACE
...
@@ -186,9 +187,7 @@ static bool parse_playlist_node COMPLEX_INTERFACE
if
(
!
psz_name
||
!
psz_value
)
if
(
!
psz_name
||
!
psz_value
)
{
{
msg_Err
(
p_demux
,
"invalid xml stream @ <playlist>"
);
msg_Err
(
p_demux
,
"invalid xml stream @ <playlist>"
);
free
(
psz_name
);
goto
end
;
free
(
psz_value
);
return
false
;
}
}
/* attribute: version */
/* attribute: version */
if
(
!
strcmp
(
psz_name
,
"version"
)
)
if
(
!
strcmp
(
psz_name
,
"version"
)
)
...
@@ -208,13 +207,16 @@ static bool parse_playlist_node COMPLEX_INTERFACE
...
@@ -208,13 +207,16 @@ static bool parse_playlist_node COMPLEX_INTERFACE
else
else
msg_Warn
(
p_demux
,
"invalid <playlist> attribute:
\"
%s
\"
"
,
psz_name
);
msg_Warn
(
p_demux
,
"invalid <playlist> attribute:
\"
%s
\"
"
,
psz_name
);
FREE_ATT
();
free
(
psz_name
);
free
(
psz_value
);
}
}
/* attribute version is mandatory !!! */
/* attribute version is mandatory !!! */
if
(
!
b_version_found
)
if
(
!
b_version_found
)
msg_Warn
(
p_demux
,
"<playlist> requires
\"
version
\"
attribute"
);
msg_Warn
(
p_demux
,
"<playlist> requires
\"
version
\"
attribute"
);
/* parse the child elements - we only take care of <trackList> */
/* parse the child elements - we only take care of <trackList> */
psz_name
=
NULL
;
psz_value
=
NULL
;
while
(
xml_ReaderRead
(
p_xml_reader
)
==
1
)
while
(
xml_ReaderRead
(
p_xml_reader
)
==
1
)
{
{
i_node
=
xml_ReaderNodeType
(
p_xml_reader
);
i_node
=
xml_ReaderNodeType
(
p_xml_reader
);
...
@@ -228,8 +230,7 @@ static bool parse_playlist_node COMPLEX_INTERFACE
...
@@ -228,8 +230,7 @@ static bool parse_playlist_node COMPLEX_INTERFACE
if
(
!
psz_name
||
!*
psz_name
)
if
(
!
psz_name
||
!*
psz_name
)
{
{
msg_Err
(
p_demux
,
"invalid xml stream"
);
msg_Err
(
p_demux
,
"invalid xml stream"
);
FREE_ATT
();
goto
end
;
return
false
;
}
}
/* choose handler */
/* choose handler */
for
(
p_handler
=
pl_elements
;
for
(
p_handler
=
pl_elements
;
...
@@ -238,24 +239,22 @@ static bool parse_playlist_node COMPLEX_INTERFACE
...
@@ -238,24 +239,22 @@ static bool parse_playlist_node COMPLEX_INTERFACE
if
(
!
p_handler
->
name
)
if
(
!
p_handler
->
name
)
{
{
msg_Err
(
p_demux
,
"unexpected element <%s>"
,
psz_name
);
msg_Err
(
p_demux
,
"unexpected element <%s>"
,
psz_name
);
FREE_ATT
();
goto
end
;
return
false
;
}
}
FREE_NAME
();
FREE_NAME
();
/* complex content is parsed in a separate function */
/* complex content is parsed in a separate function */
if
(
p_handler
->
type
==
COMPLEX_CONTENT
)
if
(
p_handler
->
type
==
COMPLEX_CONTENT
)
{
{
FREE_VALUE
();
if
(
p_handler
->
pf_handler
.
cmplx
(
p_demux
,
if
(
p_handler
->
pf_handler
.
cmplx
(
p_demux
,
p_input_item
,
p_input_item
,
p_xml_reader
,
p_xml_reader
,
p_handler
->
name
)
)
p_handler
->
name
)
)
{
{
p_handler
=
NULL
;
p_handler
=
NULL
;
FREE_ATT
();
}
}
else
else
{
{
FREE_ATT
();
return
false
;
return
false
;
}
}
}
}
...
@@ -263,13 +262,12 @@ static bool parse_playlist_node COMPLEX_INTERFACE
...
@@ -263,13 +262,12 @@ static bool parse_playlist_node COMPLEX_INTERFACE
case
XML_READER_TEXT
:
case
XML_READER_TEXT
:
/* simple element content */
/* simple element content */
FREE_ATT
(
);
free
(
psz_value
);
psz_value
=
xml_ReaderValue
(
p_xml_reader
);
psz_value
=
xml_ReaderValue
(
p_xml_reader
);
if
(
!
psz_value
)
if
(
!
psz_value
)
{
{
msg_Err
(
p_demux
,
"invalid xml stream"
);
msg_Err
(
p_demux
,
"invalid xml stream"
);
FREE_ATT
();
goto
end
;
return
false
;
}
}
break
;
break
;
...
@@ -279,14 +277,13 @@ static bool parse_playlist_node COMPLEX_INTERFACE
...
@@ -279,14 +277,13 @@ static bool parse_playlist_node COMPLEX_INTERFACE
if
(
!
psz_name
)
if
(
!
psz_name
)
{
{
msg_Err
(
p_demux
,
"invalid xml stream"
);
msg_Err
(
p_demux
,
"invalid xml stream"
);
FREE_ATT
();
goto
end
;
return
false
;
}
}
/* leave if the current parent node <playlist> is terminated */
/* leave if the current parent node <playlist> is terminated */
if
(
!
strcmp
(
psz_name
,
psz_element
)
)
if
(
!
strcmp
(
psz_name
,
psz_element
)
)
{
{
FREE_ATT
()
;
b_ret
=
true
;
return
true
;
goto
end
;
}
}
/* there MUST have been a start tag for that element name */
/* there MUST have been a start tag for that element name */
if
(
!
p_handler
||
!
p_handler
->
name
if
(
!
p_handler
||
!
p_handler
->
name
...
@@ -294,8 +291,7 @@ static bool parse_playlist_node COMPLEX_INTERFACE
...
@@ -294,8 +291,7 @@ static bool parse_playlist_node COMPLEX_INTERFACE
{
{
msg_Err
(
p_demux
,
"there's no open element left for <%s>"
,
msg_Err
(
p_demux
,
"there's no open element left for <%s>"
,
psz_name
);
psz_name
);
FREE_ATT
();
goto
end
;
return
false
;
}
}
if
(
p_handler
->
pf_handler
.
smpl
)
if
(
p_handler
->
pf_handler
.
smpl
)
...
@@ -310,12 +306,14 @@ static bool parse_playlist_node COMPLEX_INTERFACE
...
@@ -310,12 +306,14 @@ static bool parse_playlist_node COMPLEX_INTERFACE
default:
default:
/* unknown/unexpected xml node */
/* unknown/unexpected xml node */
msg_Err
(
p_demux
,
"unexpected xml node %i"
,
i_node
);
msg_Err
(
p_demux
,
"unexpected xml node %i"
,
i_node
);
FREE_ATT
();
goto
end
;
return
false
;
}
}
FREE_NAME
();
}
}
return
false
;
end:
free
(
psz_name
);
free
(
psz_value
);
return
b_ret
;
}
}
/**
/**
...
...
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