]> git.sesse.net Git - vlc/blobdiff - modules/misc/svg.c
macosx: Fix controller playlist toggling to use the contentRect and not the window...
[vlc] / modules / misc / svg.c
index 1eda410b6e054bcc5e09296d0db25e37bf807915..d601cd7ca4e1b35694b9b71c6dd190087950cef8 100644 (file)
@@ -29,7 +29,8 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_charset.h>
 #include <vlc_vout.h>
 #include <vlc_osd.h>
@@ -130,16 +131,12 @@ static int Create( vlc_object_t *p_this )
     /* 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;
     }
@@ -183,10 +180,8 @@ static char *svg_GetTemplate( vlc_object_t *p_this )
         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. */
@@ -206,15 +201,17 @@ static char *svg_GetTemplate( vlc_object_t *p_this )
                 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.
@@ -452,10 +449,7 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out,
 
     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;
@@ -468,7 +462,6 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out,
         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;
         }
@@ -483,7 +476,6 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out,
         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;
         }