]> git.sesse.net Git - vlc/blobdiff - modules/video_filter/rss.c
rss: fix a memleak (double strdup) and ad a missing const.
[vlc] / modules / video_filter / rss.c
index c08083aa643b689a5f041ae33fa10731f7e86e0a..c663dd5ebe1411c25659067ff62d5c2f092e452c 100644 (file)
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 
-#include "vlc_filter.h"
-#include "vlc_block.h"
-#include "vlc_osd.h"
+#include <vlc_filter.h>
+#include <vlc_block.h>
+#include <vlc_osd.h>
 
-#include "vlc_block.h"
-#include "vlc_stream.h"
-#include "vlc_xml.h"
+#include <vlc_block.h>
+#include <vlc_stream.h>
+#include <vlc_xml.h>
 #include <vlc_charset.h>
 
-#include "vlc_image.h"
+#include <vlc_image.h>
 
 #include <time.h>
 
@@ -440,7 +439,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
         return NULL;
     }
 
-    fmt.i_chroma = VLC_FOURCC('T','E','X','T');
+    fmt.i_chroma = VLC_CODEC_TEXT;
 
     p_spu->p_region = subpicture_region_New( &fmt );
     if( !p_spu->p_region )
@@ -539,7 +538,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
 
         memset( &fmt_out, 0, sizeof(video_format_t) );
 
-        fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A');
+        fmt_out.i_chroma = VLC_CODEC_YUVA;
         fmt_out.i_aspect = VOUT_ASPECT_FACTOR;
         fmt_out.i_sar_num = fmt_out.i_sar_den = 1;
         fmt_out.i_width =
@@ -593,7 +592,7 @@ static picture_t *LoadImage( filter_t *p_filter, const char *psz_url )
     memset( &fmt_in, 0, sizeof(video_format_t) );
     memset( &fmt_out, 0, sizeof(video_format_t) );
 
-    fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A');
+    fmt_out.i_chroma = VLC_CODEC_YUVA;
     p_orig = image_ReadUrl( p_handler, psz_url, &fmt_in, &fmt_out );
 
     if( !p_orig )
@@ -603,7 +602,7 @@ static picture_t *LoadImage( filter_t *p_filter, const char *psz_url )
     else if( p_sys->p_style->i_font_size > 0 )
     {
 
-        fmt_in.i_chroma = VLC_FOURCC('Y','U','V','A');
+        fmt_in.i_chroma = VLC_CODEC_YUVA;
         fmt_in.i_height = p_orig->p[Y_PLANE].i_visible_lines;
         fmt_in.i_width = p_orig->p[Y_PLANE].i_visible_pitch;
         fmt_out.i_width = p_orig->p[Y_PLANE].i_visible_pitch
@@ -631,12 +630,12 @@ static picture_t *LoadImage( filter_t *p_filter, const char *psz_url )
  * remove all ' ' '\t' '\n' '\r' characters from the begining and end of the
  * string.
  ***************************************************************************/
-static char *removeWhiteChars( char *psz_src )
+static char *removeWhiteChars( const char *psz_src )
 {
-    char *psz_src2 = strdup( psz_src );
-    char *psz_clean = strdup( psz_src2 );
-    char *psz_clean2;
+    char *psz_src2,*psz_clean, *psz_clean2;
+    psz_src2 = psz_clean = strdup( psz_src );
     int i;
+
     while( ( *psz_clean == ' ' || *psz_clean == '\t'
            || *psz_clean == '\n' || *psz_clean == '\r' )
            && *psz_clean != '\0' )
@@ -718,6 +717,7 @@ static int FetchRSS( filter_t *p_filter)
         if( !p_stream )
         {
             msg_Err( p_filter, "Failed to open %s for reading", psz_feed );
+            xml_Delete( p_xml );
             return 1;
         }
 
@@ -725,6 +725,7 @@ static int FetchRSS( filter_t *p_filter)
         if( !p_xml_reader )
         {
             msg_Err( p_filter, "Failed to open %s for parsing", psz_feed );
+            xml_Delete( p_xml );
             return 1;
         }