* Preamble
*****************************************************************************/
-#include <vlc/vlc.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
#include <vlc_charset.h>
#include <vlc_vout.h>
#include <vlc_osd.h>
set_category( SUBCAT_INPUT_SCODEC );
set_capability( "text renderer", 99 );
add_shortcut( "svg" );
- add_string( "svg-template-file", "", NULL, TEMPLATE_TEXT, TEMPLATE_LONGTEXT, VLC_TRUE );
+ add_string( "svg-template-file", "", NULL, TEMPLATE_TEXT, TEMPLATE_LONGTEXT, true );
set_callbacks( Create, Destroy );
vlc_module_end();
/* Allocate structure */
p_sys = malloc( sizeof( filter_sys_t ) );
if( !p_sys )
- {
- msg_Err( p_filter, "out of memory" );
return VLC_ENOMEM;
- }
/* Initialize psz_template */
p_sys->psz_template = svg_GetTemplate( p_this );
if( !p_sys->psz_template )
{
- msg_Err( p_filter, "out of memory" );
free( p_sys );
return VLC_ENOMEM;
}
else
{
struct stat s;
- int i_ret;
- i_ret = utf8_stat( psz_filename, &s );
- if( i_ret )
+ if( fstat( fileno( file ), &s ) )
{
/* Problem accessing file information. Should not
happen as we could open it. */
psz_template = malloc( ( s.st_size + 42 ) * sizeof( char ) );
if( !psz_template )
{
- msg_Err( p_filter, "out of memory" );
+ fclose( file );
+ free( psz_filename );
return NULL;
}
memset( psz_template, 0, s.st_size + 1 );
fread( psz_template, s.st_size, 1, file );
- fclose( file );
}
+ fclose( file );
}
}
+ free( psz_filename );
if( !psz_template )
{
/* Either there was no file, or there was an error.
p_svg = ( svg_rendition_t * )malloc( sizeof( svg_rendition_t ) );
if( !p_svg )
- {
- msg_Err( p_filter, "out of memory" );
return VLC_ENOMEM;
- }
p_region_out->i_x = p_region_in->i_x;
p_region_out->i_y = p_region_in->i_y;
p_svg->psz_text = strdup( psz_string );
if( !p_svg->psz_text )
{
- msg_Err( p_filter, "out of memory" );
free( p_svg );
return VLC_ENOMEM;
}
p_svg->psz_text = malloc( ( length + 1 ) * sizeof( char ) );
if( !p_svg->psz_text )
{
- msg_Err( p_filter, "out of memory" );
free( p_svg );
return VLC_ENOMEM;
}
static void FreeString( svg_rendition_t *p_svg )
{
- if( p_svg->psz_text )
- free( p_svg->psz_text );
+ free( p_svg->psz_text );
/* p_svg->p_rendition is a GdkPixbuf, and its allocation is
managed through ref. counting */
if( p_svg->p_rendition )