# include "config.h"
#endif
-#include <vlc/vlc.h>
+#include <vlc_common.h>
#include <vlc_plugin.h>
#include "vlc_xml.h"
#include <ctype.h>
#include <stdarg.h>
+#include <assert.h>
+
#undef XTAG_DEBUG
typedef struct _XList
static void Close( vlc_object_t * );
vlc_module_begin();
- set_description( _("Simple XML Parser") );
+ set_description( N_("Simple XML Parser") );
set_capability( "xml", 5 );
set_callbacks( Open, Close );
vlc_module_end();
/* Open and read file */
p_buffer = malloc( i_buffer );
- if( p_buffer == NULL ) {
- msg_Err( p_xml, "out of memory" );
+ if( p_buffer == NULL )
return NULL;
- }
while( ( i_size = stream_Read( s, &p_buffer[i_pos], 2048 ) ) == 2048 )
{
p_new = realloc( p_buffer, i_buffer );
if( !p_new )
{
- msg_Err( p_xml, "out of memory" );
free( p_buffer );
return NULL;
}
{
psz_name = xtag_get_name( p_reader->p_sys->p_curtag );
#ifdef XTAG_DEBUG
- printf( "TAG: %s\n", psz_name );
+ fprintf( stderr, "TAG: %s\n", psz_name );
#endif
}
else
if( p_reader->p_sys->p_curtag->pcdata )
{
#ifdef XTAG_DEBUG
- printf( "%s\n", p_reader->p_sys->p_curtag->pcdata );
+ fprintf( stderr, "%s\n", p_reader->p_sys->p_curtag->pcdata );
#endif
return strdup( p_reader->p_sys->p_curtag->pcdata );
}
if( !p_reader->p_sys->p_curattr ) return 0;
#ifdef XTAG_DEBUG
- printf( "%s=%s\n", ((XAttribute *)p_reader->p_sys->p_curattr->data)->name,
+ fprintf( stderr, "%s=%s\n", ((XAttribute *)p_reader->p_sys->p_curattr->data)->name,
((XAttribute *)p_reader->p_sys->p_curattr->data)->value );
#endif
if( !xtag_assert_and_pass( parser, X_EQUAL ) )
{
#ifdef XTAG_DEBUG
- printf( "xtag: attr failed EQUAL on <%s>\n", name );
+ fprintf( stderr, "xtag: attr failed EQUAL on <%s>\n", name );
#endif
goto err_free_name;
}
if( value == NULL )
{
#ifdef XTAG_DEBUG
- printf ("Got NULL quoted attribute value\n");
+ fprintf (stderr, "Got NULL quoted attribute value\n");
#endif
goto err_free_name;
}
if( name == NULL ) return NULL;
#ifdef XTAG_DEBUG
- printf ("<%s ...\n", name);
+ fprintf (stderr, "<%s ...\n", name);
#endif
tag = malloc( sizeof(*tag) );
if( strcmp( name, tag->name ) )
{
#ifdef XTAG_DEBUG
- printf ("got %s expected %s\n", name, tag->name);
+ fprintf (stderr, "got %s expected %s\n", name, tag->name);
#endif
parser->valid = false;
}
else if( n == 0 )
{
#ifdef XTAG_DEBUG
- printf ("empty buffer");
+ fprintf (stderr, "empty buffer\n");
#endif
return NULL;
}
if( !parser.valid )
{
#ifdef XTAG_DEBUG
- printf ("invalid file");
+ fprintf (stderr, "invalid file\n");
#endif
xtag_free( tag );
return NULL;