Commit ad10f794 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

XML: return node (element name or text value) as const

This simplifies memory handling in most cases.
parent d4546731
...@@ -70,8 +70,7 @@ struct xml_reader_t ...@@ -70,8 +70,7 @@ struct xml_reader_t
stream_t *p_stream; stream_t *p_stream;
module_t *p_module; module_t *p_module;
int (*pf_next_node) ( xml_reader_t * ); int (*pf_next_node) ( xml_reader_t *, const char ** );
char * (*pf_name) ( xml_reader_t * );
char * (*pf_value) ( xml_reader_t * ); char * (*pf_value) ( xml_reader_t * );
const char *(*pf_next_attr) ( xml_reader_t * ); const char *(*pf_next_attr) ( xml_reader_t * );
...@@ -83,14 +82,9 @@ VLC_EXPORT( xml_reader_t *, xml_ReaderCreate, (vlc_object_t *, stream_t *) LIBVL ...@@ -83,14 +82,9 @@ VLC_EXPORT( xml_reader_t *, xml_ReaderCreate, (vlc_object_t *, stream_t *) LIBVL
VLC_EXPORT( void, xml_ReaderDelete, (xml_reader_t *) ); VLC_EXPORT( void, xml_ReaderDelete, (xml_reader_t *) );
VLC_EXPORT( xml_reader_t *, xml_ReaderReset, (xml_reader_t *, stream_t *) LIBVLC_USED ); VLC_EXPORT( xml_reader_t *, xml_ReaderReset, (xml_reader_t *, stream_t *) LIBVLC_USED );
static inline int xml_ReaderNextNode( xml_reader_t *reader ) static inline int xml_ReaderNextNode( xml_reader_t *reader, const char **pval )
{ {
return reader->pf_next_node( reader ); return reader->pf_next_node( reader, pval );
}
static inline char *xml_ReaderName( xml_reader_t *reader )
{
return reader->pf_name( reader );
} }
static inline char *xml_ReaderValue( xml_reader_t *reader ) static inline char *xml_ReaderValue( xml_reader_t *reader )
......
...@@ -528,37 +528,29 @@ static int ParseImageAttachments( decoder_t *p_dec ) ...@@ -528,37 +528,29 @@ static int ParseImageAttachments( decoder_t *p_dec )
static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader ) static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader )
{ {
decoder_sys_t *p_sys = p_dec->p_sys; decoder_sys_t *p_sys = p_dec->p_sys;
char *psz_node; const char *node;
ssa_style_t *p_ssa_style = NULL; ssa_style_t *p_ssa_style = NULL;
int i_style_level = 0; int i_style_level = 0;
int i_metadata_level = 0; int i_metadata_level = 0;
int type; int type;
while( (type = xml_ReaderNextNode( p_xml_reader )) > 0 ) while( (type = xml_ReaderNextNode( p_xml_reader, &node )) > 0 )
{ {
switch( type ) switch( type )
{ {
case XML_READER_ENDELEM: case XML_READER_ENDELEM:
psz_node = xml_ReaderName( p_xml_reader );
if( !psz_node )
break;
switch (i_style_level) switch (i_style_level)
{ {
case 0: case 0:
if( !strcasecmp( "metadata", psz_node ) && (i_metadata_level == 1) ) if( !strcasecmp( "metadata", node ) && (i_metadata_level == 1) )
{
i_metadata_level--; i_metadata_level--;
}
break; break;
case 1: case 1:
if( !strcasecmp( "styles", psz_node ) ) if( !strcasecmp( "styles", node ) )
{
i_style_level--; i_style_level--;
}
break; break;
case 2: case 2:
if( !strcasecmp( "style", psz_node ) ) if( !strcasecmp( "style", node ) )
{ {
TAB_APPEND( p_sys->i_ssa_styles, p_sys->pp_ssa_styles, p_ssa_style ); TAB_APPEND( p_sys->i_ssa_styles, p_sys->pp_ssa_styles, p_ssa_style );
...@@ -567,20 +559,12 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader ) ...@@ -567,20 +559,12 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader )
} }
break; break;
} }
free( psz_node );
break; break;
case XML_READER_STARTELEM:
psz_node = xml_ReaderName( p_xml_reader );
if( !psz_node ) case XML_READER_STARTELEM:
break; if( !strcasecmp( "metadata", node ) && (i_style_level == 0) )
if( !strcasecmp( "metadata", psz_node ) && (i_style_level == 0) )
{
i_metadata_level++; i_metadata_level++;
} else if( !strcasecmp( "resolution", node ) &&
else if( !strcasecmp( "resolution", psz_node ) &&
( i_metadata_level == 1) ) ( i_metadata_level == 1) )
{ {
const char *attr; const char *attr;
...@@ -597,27 +581,23 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader ) ...@@ -597,27 +581,23 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader )
free( psz_value ); free( psz_value );
} }
} }
else if( !strcasecmp( "styles", psz_node ) && (i_style_level == 0) ) else if( !strcasecmp( "styles", node ) && (i_style_level == 0) )
{ {
i_style_level++; i_style_level++;
} }
else if( !strcasecmp( "style", psz_node ) && (i_style_level == 1) ) else if( !strcasecmp( "style", node ) && (i_style_level == 1) )
{ {
i_style_level++; i_style_level++;
p_ssa_style = calloc( 1, sizeof(ssa_style_t) ); p_ssa_style = calloc( 1, sizeof(ssa_style_t) );
if( !p_ssa_style ) if( unlikely(!p_ssa_style) )
{
free( psz_node );
return; return;
}
/* All styles are supposed to default to Default, and then /* All styles are supposed to default to Default, and then
* one or more settings are over-ridden. * one or more settings are over-ridden.
* At the moment this only effects styles defined AFTER * At the moment this only effects styles defined AFTER
* Default in the XML * Default in the XML
*/ */
int i; for( int i = 0; i < p_sys->i_ssa_styles; i++ )
for( i = 0; i < p_sys->i_ssa_styles; i++ )
{ {
if( !strcasecmp( p_sys->pp_ssa_styles[i]->psz_stylename, "Default" ) ) if( !strcasecmp( p_sys->pp_ssa_styles[i]->psz_stylename, "Default" ) )
{ {
...@@ -646,7 +626,7 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader ) ...@@ -646,7 +626,7 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader )
free( psz_value ); free( psz_value );
} }
} }
else if( !strcasecmp( "fontstyle", psz_node ) && (i_style_level == 2) ) else if( !strcasecmp( "fontstyle", node ) && (i_style_level == 2) )
{ {
const char *attr; const char *attr;
while( (attr = xml_ReaderNextAttr( p_xml_reader )) ) while( (attr = xml_ReaderNextAttr( p_xml_reader )) )
...@@ -749,7 +729,7 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader ) ...@@ -749,7 +729,7 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader )
free( psz_value ); free( psz_value );
} }
} }
else if( !strcasecmp( "position", psz_node ) && (i_style_level == 2) ) else if( !strcasecmp( "position", node ) && (i_style_level == 2) )
{ {
const char *attr; const char *attr;
while( (attr = xml_ReaderNextAttr( p_xml_reader )) ) while( (attr = xml_ReaderNextAttr( p_xml_reader )) )
...@@ -808,8 +788,6 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader ) ...@@ -808,8 +788,6 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader )
free( psz_value ); free( psz_value );
} }
} }
free( psz_node );
break; break;
} }
} }
...@@ -991,16 +969,13 @@ static void ParseUSFHeader( decoder_t *p_dec ) ...@@ -991,16 +969,13 @@ static void ParseUSFHeader( decoder_t *p_dec )
p_xml_reader = xml_ReaderCreate( p_dec, p_sub ); p_xml_reader = xml_ReaderCreate( p_dec, p_sub );
if( likely(p_xml_reader) ) if( likely(p_xml_reader) )
{ {
/* Look for Root Node */ const char *node;
if( xml_ReaderNextNode( p_xml_reader ) == XML_READER_STARTELEM )
{
char *psz_node = xml_ReaderName( p_xml_reader );
if( !strcasecmp( "usfsubtitles", psz_node ) ) /* Look for Root Node */
ParseUSFHeaderTags( p_dec, p_xml_reader ); if( xml_ReaderNextNode( p_xml_reader, &node ) == XML_READER_STARTELEM
&& !strcasecmp( "usfsubtitles", node ) )
ParseUSFHeaderTags( p_dec, p_xml_reader );
free( psz_node );
}
xml_ReaderDelete( p_xml_reader ); xml_ReaderDelete( p_xml_reader );
} }
stream_Delete( p_sub ); stream_Delete( p_sub );
......
...@@ -73,6 +73,7 @@ static int Demux( demux_t *p_demux ) ...@@ -73,6 +73,7 @@ static int Demux( demux_t *p_demux )
xml_reader_t *p_xml_reader = NULL; xml_reader_t *p_xml_reader = NULL;
char *psz_elname = NULL; char *psz_elname = NULL;
const char *node;
input_item_t *p_input; input_item_t *p_input;
char *psz_mrl = NULL, *psz_title = NULL, *psz_genre = NULL; char *psz_mrl = NULL, *psz_title = NULL, *psz_genre = NULL;
char *psz_now = NULL, *psz_listeners = NULL, *psz_bitrate = NULL; char *psz_now = NULL, *psz_listeners = NULL, *psz_bitrate = NULL;
...@@ -84,42 +85,38 @@ static int Demux( demux_t *p_demux ) ...@@ -84,42 +85,38 @@ static int Demux( demux_t *p_demux )
p_xml_reader = xml_ReaderCreate( p_demux, p_demux->s ); p_xml_reader = xml_ReaderCreate( p_demux, p_demux->s );
if( !p_xml_reader ) if( !p_xml_reader )
goto end; return -1;
/* xml */ /* xml */
/* check root node */ /* check root node */
if( xml_ReaderNextNode( p_xml_reader ) != XML_READER_STARTELEM ) if( xml_ReaderNextNode( p_xml_reader, &node ) != XML_READER_STARTELEM )
{ {
msg_Err( p_demux, "invalid file (no root node)" ); msg_Err( p_demux, "invalid file (no root node)" );
goto end; goto end;
} }
if( ( psz_elname = xml_ReaderName( p_xml_reader ) ) == NULL || if( strcmp( node, "WinampXML" ) )
strcmp( psz_elname, "WinampXML" ) )
{ {
msg_Err( p_demux, "invalid root node: %s", psz_elname ); msg_Err( p_demux, "invalid root node: %s", node );
goto end; goto end;
} }
FREENULL( psz_elname );
/* root node should not have any attributes, and should only /* root node should not have any attributes, and should only
* contain the "playlist node */ * contain the "playlist node */
/* Skip until 1st child node */ /* Skip until 1st child node */
while( (i_ret = xml_ReaderNextNode( p_xml_reader )) != XML_READER_STARTELEM ) while( (i_ret = xml_ReaderNextNode( p_xml_reader, &node )) != XML_READER_STARTELEM )
if( i_ret <= 0 ) if( i_ret <= 0 )
{ {
msg_Err( p_demux, "invalid file (no child node)" ); msg_Err( p_demux, "invalid file (no child node)" );
goto end; goto end;
} }
if( ( psz_elname = xml_ReaderName( p_xml_reader ) ) == NULL || if( strcmp( node, "playlist" ) )
strcmp( psz_elname, "playlist" ) )
{ {
msg_Err( p_demux, "invalid child node %s", psz_elname ); msg_Err( p_demux, "invalid child node %s", node );
goto end; goto end;
} }
FREENULL( psz_elname );
// Read the attributes // Read the attributes
const char *attr; const char *attr;
...@@ -144,7 +141,7 @@ static int Demux( demux_t *p_demux ) ...@@ -144,7 +141,7 @@ static int Demux( demux_t *p_demux )
p_subitems = input_item_node_Create( p_current_input ); p_subitems = input_item_node_Create( p_current_input );
while( (i_ret = xml_ReaderNextNode( p_xml_reader )) > 0 ) while( (i_ret = xml_ReaderNextNode( p_xml_reader, &node )) > 0 )
{ {
// Get the node type // Get the node type
switch( i_ret ) switch( i_ret )
...@@ -153,8 +150,8 @@ static int Demux( demux_t *p_demux ) ...@@ -153,8 +150,8 @@ static int Demux( demux_t *p_demux )
{ {
// Read the element name // Read the element name
free( psz_elname ); free( psz_elname );
psz_elname = xml_ReaderName( p_xml_reader ); psz_elname = strdup( node );
if( !psz_elname ) if( unlikely(!psz_elname) )
goto end; goto end;
// Read the attributes // Read the attributes
...@@ -180,55 +177,41 @@ static int Demux( demux_t *p_demux ) ...@@ -180,55 +177,41 @@ static int Demux( demux_t *p_demux )
} }
break; break;
} }
case XML_READER_TEXT: case XML_READER_TEXT:
{ {
char *psz_text = xml_ReaderValue( p_xml_reader ); char **p;
if( IsWhitespace( psz_text ) )
{ if( psz_elname == NULL )
free( psz_text ); break;
if( IsWhitespace( node ) )
break; break;
}
if( !strcmp( psz_elname, "Name" ) ) if( !strcmp( psz_elname, "Name" ) )
{ p = &psz_title;
psz_title = psz_text;
}
else if( !strcmp( psz_elname, "Genre" ) ) else if( !strcmp( psz_elname, "Genre" ) )
{ p = &psz_genre;
psz_genre = psz_text;
}
else if( !strcmp( psz_elname, "Nowplaying" ) ) else if( !strcmp( psz_elname, "Nowplaying" ) )
{ p = &psz_now;
psz_now = psz_text;
}
else if( !strcmp( psz_elname, "Listeners" ) ) else if( !strcmp( psz_elname, "Listeners" ) )
{ p = &psz_listeners;
psz_listeners = psz_text;
}
else if( !strcmp( psz_elname, "Bitrate" ) ) else if( !strcmp( psz_elname, "Bitrate" ) )
{ p = &psz_bitrate;
psz_bitrate = psz_text;
}
else if( !strcmp( psz_elname, "" ) )
{
free( psz_text );
}
else else
{ {
msg_Warn( p_demux, "unexpected text in element '%s'", msg_Warn( p_demux, "unexpected text in element <%s>",
psz_elname ); psz_elname );
free( psz_text ); break;
} }
free( *p );
*p = strdup( node );
break; break;
} }
// End element // End element
case XML_READER_ENDELEM: case XML_READER_ENDELEM:
{ {
// Read the element name // Read the element name
free( psz_elname ); if( !strcmp( node, "entry" ) )
psz_elname = xml_ReaderName( p_xml_reader );
if( !psz_elname )
goto end;
if( !strcmp( psz_elname, "entry" ) )
{ {
p_input = input_item_New( p_demux, psz_mrl, psz_title ); p_input = input_item_New( p_demux, psz_mrl, psz_title );
if( psz_now ) if( psz_now )
...@@ -249,9 +232,7 @@ static int Demux( demux_t *p_demux ) ...@@ -249,9 +232,7 @@ static int Demux( demux_t *p_demux )
FREENULL( psz_listeners ); FREENULL( psz_listeners );
FREENULL( psz_now ); FREENULL( psz_now );
} }
free( psz_elname ); FREENULL( psz_elname );
psz_elname = strdup( "" );
break; break;
} }
} }
......
...@@ -68,7 +68,7 @@ void Close_iTML( vlc_object_t *p_this ) ...@@ -68,7 +68,7 @@ void Close_iTML( vlc_object_t *p_this )
int Demux( demux_t *p_demux ) int Demux( demux_t *p_demux )
{ {
xml_reader_t *p_xml_reader; xml_reader_t *p_xml_reader;
char *psz_name = NULL; const char *node;
input_item_t *p_current_input = GetCurrentItem(p_demux); input_item_t *p_current_input = GetCurrentItem(p_demux);
p_demux->p_sys->i_ntracks = 0; p_demux->p_sys->i_ntracks = 0;
...@@ -82,19 +82,19 @@ int Demux( demux_t *p_demux ) ...@@ -82,19 +82,19 @@ int Demux( demux_t *p_demux )
int type; int type;
do do
{ {
type = xml_ReaderNextNode( p_xml_reader ); type = xml_ReaderNextNode( p_xml_reader, &node );
if( type <= 0 ) if( type <= 0 )
{ {
msg_Err( p_demux, "can't read xml stream" ); msg_Err( p_demux, "can't read xml stream" );
goto end; goto end;
} }
} while( type != XML_READER_STARTELEM ); }
while( type != XML_READER_STARTELEM );
/* checking root node name */ /* checking root node name */
psz_name = xml_ReaderName( p_xml_reader ); if( strcmp( node, "plist" ) )
if( !psz_name || strcmp( psz_name, "plist" ) )
{ {
msg_Err( p_demux, "invalid root node name: %s", psz_name ); msg_Err( p_demux, "invalid root node <%s>", node );
goto end; goto end;
} }
...@@ -108,7 +108,6 @@ int Demux( demux_t *p_demux ) ...@@ -108,7 +108,6 @@ int Demux( demux_t *p_demux )
vlc_gc_decref(p_current_input); vlc_gc_decref(p_current_input);
end: end:
free( psz_name );
if( p_xml_reader ) if( p_xml_reader )
xml_ReaderDelete( p_xml_reader ); xml_ReaderDelete( p_xml_reader );
...@@ -177,34 +176,32 @@ static bool parse_dict( demux_t *p_demux, input_item_node_t *p_input_node, ...@@ -177,34 +176,32 @@ static bool parse_dict( demux_t *p_demux, input_item_node_t *p_input_node,
const char *psz_element, xml_elem_hnd_t *p_handlers ) const char *psz_element, xml_elem_hnd_t *p_handlers )
{ {
int i_node; int i_node;
char *psz_name = NULL; const char *node;
char *psz_value = NULL; char *psz_value = NULL;
char *psz_key = NULL; char *psz_key = NULL;
xml_elem_hnd_t *p_handler = NULL; xml_elem_hnd_t *p_handler = NULL;
bool b_ret = false; bool b_ret = false;
while( (i_node = xml_ReaderNextNode( p_xml_reader )) > 0 ) while( (i_node = xml_ReaderNextNode( p_xml_reader, &node )) > 0 )
{ {
switch( i_node ) switch( i_node )
{ {
/* element start tag */
case XML_READER_STARTELEM: case XML_READER_STARTELEM:
/* element start tag */ if( !*node )
psz_name = xml_ReaderName( p_xml_reader );
if( !psz_name || !*psz_name )
{ {
msg_Err( p_demux, "invalid xml stream" ); msg_Err( p_demux, "invalid XML stream" );
goto end; goto end;
} }
/* choose handler */ /* choose handler */
for( p_handler = p_handlers; for( p_handler = p_handlers;
p_handler->name && strcmp( psz_name, p_handler->name ); p_handler->name && strcmp( node, p_handler->name );
p_handler++ ); p_handler++ );
if( !p_handler->name ) if( !p_handler->name )
{ {
msg_Err( p_demux, "unexpected element <%s>", psz_name ); msg_Err( p_demux, "unexpected element <%s>", node );
goto end; goto end;
} }
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 )
{ {
...@@ -220,37 +217,28 @@ static bool parse_dict( demux_t *p_demux, input_item_node_t *p_input_node, ...@@ -220,37 +217,28 @@ static bool parse_dict( demux_t *p_demux, input_item_node_t *p_input_node,
} }
break; break;
/* simple element content */
case XML_READER_TEXT: case XML_READER_TEXT:
/* simple element content */
free( psz_value ); free( psz_value );
psz_value = xml_ReaderValue( p_xml_reader ); psz_value = strdup( node );
if( !psz_value ) if( unlikely(!psz_value) )
{
msg_Err( p_demux, "invalid xml stream" );
goto end; goto end;
}
break; break;
/* element end tag */
case XML_READER_ENDELEM: case XML_READER_ENDELEM:
/* element end tag */
psz_name = xml_ReaderName( p_xml_reader );
if( !psz_name )
{
msg_Err( p_demux, "invalid xml stream" );
goto end;
}
/* leave if the current parent node <track> is terminated */ /* leave if the current parent node <track> is terminated */
if( !strcmp( psz_name, psz_element ) ) if( !strcmp( node, psz_element ) )
{ {
b_ret = true; b_ret = true;
goto end; 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
|| strcmp( p_handler->name, psz_name ) ) || strcmp( p_handler->name, node ) )
{ {
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 ); node );
goto end; goto end;
} }
/* special case: key */ /* special case: key */
...@@ -268,12 +256,10 @@ static bool parse_dict( demux_t *p_demux, input_item_node_t *p_input_node, ...@@ -268,12 +256,10 @@ static bool parse_dict( demux_t *p_demux, input_item_node_t *p_input_node,
p_handler = NULL; p_handler = NULL;
break; break;
} }
FREE_NAME();
} }
msg_Err( p_demux, "unexpected end of XML data" ); msg_Err( p_demux, "unexpected end of XML data" );
end: end:
free( psz_name );
free( psz_value ); free( psz_value );
free( psz_key ); free( psz_key );
return b_ret; return b_ret;
...@@ -461,24 +447,11 @@ static bool skip_element( demux_t *p_demux, input_item_node_t *p_input_node, ...@@ -461,24 +447,11 @@ static bool skip_element( demux_t *p_demux, input_item_node_t *p_input_node,
{ {
VLC_UNUSED(p_demux); VLC_UNUSED(p_input_node); VLC_UNUSED(p_demux); VLC_UNUSED(p_input_node);
VLC_UNUSED(p_track); VLC_UNUSED(p_handlers); VLC_UNUSED(p_track); VLC_UNUSED(p_handlers);
char *psz_endname; const char *node;
int type; int type;
while( (type = xml_ReaderNextNode( p_xml_reader )) > 0 ) while( (type = xml_ReaderNextNode( p_xml_reader, &node )) > 0 )
{ if( type == XML_READER_ENDELEM && !strcmp( psz_element, node ) )
if( type == XML_READER_ENDELEM ) return true;
{
psz_endname = xml_ReaderName( p_xml_reader );
if( !psz_endname )
return false;
if( !strcmp( psz_element, psz_endname ) )
{
free( psz_endname );
return true;
}
else
free( psz_endname );
}
}
return false; return false;
} }
...@@ -26,11 +26,10 @@ ...@@ -26,11 +26,10 @@
*/ */
/* defines */ /* defines */
#define FREE_NAME() FREENULL( psz_name )
#define FREE_VALUE() FREENULL( psz_value ) #define FREE_VALUE() FREENULL( psz_value )
#define FREE_KEY() FREENULL( psz_key ) #define FREE_KEY() FREENULL( psz_key )
#define FREE_ATT() do{ FREE_NAME();FREE_VALUE(); }while(0) #define FREE_ATT() FREE_VALUE()
#define FREE_ATT_KEY() do{ FREE_NAME();FREE_VALUE();FREE_KEY();} while(0) #define FREE_ATT_KEY() do{ FREE_VALUE();FREE_KEY();} while(0)
#define UNKNOWN_CONTENT 0 #define UNKNOWN_CONTENT 0
#define SIMPLE_CONTENT 1 #define SIMPLE_CONTENT 1
......
...@@ -86,6 +86,7 @@ static int Demux( demux_t *p_demux ) ...@@ -86,6 +86,7 @@ static int Demux( demux_t *p_demux )
char *psz_item_subtitle = NULL; char *psz_item_subtitle = NULL;
char *psz_item_summary = NULL; char *psz_item_summary = NULL;
char *psz_art_url = NULL; char *psz_art_url = NULL;
const char *node;
int i_type; int i_type;
input_item_t *p_input; input_item_t *p_input;
input_item_node_t *p_subitems = NULL; input_item_node_t *p_subitems = NULL;
...@@ -98,42 +99,35 @@ static int Demux( demux_t *p_demux ) ...@@ -98,42 +99,35 @@ static int Demux( demux_t *p_demux )
/* xml */ /* xml */
/* check root node */ /* check root node */
if( xml_ReaderNextNode( p_xml_reader ) != XML_READER_STARTELEM if( xml_ReaderNextNode( p_xml_reader, &node ) != XML_READER_STARTELEM )
|| ( psz_elname = xml_ReaderName( p_xml_reader ) ) == NULL)
{