]> git.sesse.net Git - vlc/blobdiff - modules/misc/svg.c
Promote lua_intf as the main module
[vlc] / modules / misc / svg.c
index a7380cbf4aa9df89e7480e543c2d82157e341c35..7c5ad64b8912b575280e0413673cea83d72c4e09 100644 (file)
@@ -31,7 +31,7 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_charset.h>
+#include <vlc_fs.h>
 #include <vlc_vout.h>
 #include <vlc_osd.h>
 #include <vlc_block.h>
@@ -158,7 +158,7 @@ static char *svg_GetTemplate( vlc_object_t *p_this )
     char *psz_template;
     FILE *file;
 
-    psz_filename = config_GetPsz( p_filter, "svg-template-file" );
+    psz_filename = var_InheritString( p_filter, "svg-template-file" );
     if( !psz_filename || (psz_filename[0] == 0) )
     {
         /* No filename. Use a default value. */
@@ -167,7 +167,7 @@ static char *svg_GetTemplate( vlc_object_t *p_this )
     else
     {
         /* Read the template */
-        file = utf8_fopen( psz_filename, "rt" );
+        file = vlc_fopen( psz_filename, "rt" );
         if( !file )
         {
             msg_Warn( p_this, "SVG template file %s does not exist.",
@@ -195,14 +195,13 @@ static char *svg_GetTemplate( vlc_object_t *p_this )
                 msg_Dbg( p_this, "reading %ld bytes from template %s",
                          (unsigned long)s.st_size, psz_filename );
 
-                psz_template = malloc( s.st_size + 42 );
+                psz_template = calloc( 1, s.st_size + 42 );
                 if( !psz_template )
                 {
                     fclose( file );
                     free( psz_filename );
                     return NULL;
                 }
-                memset( psz_template, 0, s.st_size + 1 );
                 if(! fread( psz_template, s.st_size, 1, file ) )
                 {
                     msg_Dbg( p_this, "No data read from template." );
@@ -403,7 +402,7 @@ static void svg_RenderPicture( filter_t *p_filter,
 
     if( !p_handle )
     {
-        msg_Err( p_filter, "Error creating SVG reader: %s", error->message );
+        msg_Err( p_filter, "Error creating SVG reader" );
         return;
     }
 
@@ -469,13 +468,12 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out,
         int length;
         char* psz_template = p_sys->psz_template;
         length = strlen( psz_string ) + strlen( psz_template ) + 42;
-        p_svg->psz_text = malloc( length + 1 );
+        p_svg->psz_text = calloc( 1, length + 1 );
         if( !p_svg->psz_text )
         {
             free( p_svg );
             return VLC_ENOMEM;
         }
-        memset( p_svg->psz_text, 0, length + 1 );
         snprintf( p_svg->psz_text, length, psz_template, psz_string );
     }
     p_svg->i_width = p_sys->i_width;