[vlc-devel] commit: Use resolve_xml_special_chars where appropriate. (Laurent Aimar )

git version control git at videolan.org
Tue Sep 23 00:01:59 CEST 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Tue Sep 23 00:04:18 2008 +0200| [252c882286e56574f7984bf23ad8b456fc3d9805] | committer: Laurent Aimar 

Use resolve_xml_special_chars where appropriate.

(noticed by Antoine Cellerier)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=252c882286e56574f7984bf23ad8b456fc3d9805
---

 modules/misc/freetype.c      |    1 +
 modules/misc/quartztext.c    |    1 +
 modules/misc/text_renderer.h |   35 +----------------------------------
 3 files changed, 3 insertions(+), 34 deletions(-)

diff --git a/modules/misc/freetype.c b/modules/misc/freetype.c
index f27fefe..0ea7f34 100644
--- a/modules/misc/freetype.c
+++ b/modules/misc/freetype.c
@@ -40,6 +40,7 @@
 #include <vlc_stream.h>
 #include <vlc_xml.h>
 #include <vlc_input.h>
+#include <vlc_strings.h>
 
 #include <math.h>
 #include <errno.h>
diff --git a/modules/misc/quartztext.c b/modules/misc/quartztext.c
index 9521efa..147ed3a 100644
--- a/modules/misc/quartztext.c
+++ b/modules/misc/quartztext.c
@@ -38,6 +38,7 @@
 #include <vlc_stream.h>
 #include <vlc_xml.h>
 #include <vlc_input.h>
+#include <vlc_strings.h>
 
 #include <math.h>
 
diff --git a/modules/misc/text_renderer.h b/modules/misc/text_renderer.h
index 5b6e075..fa5d098 100644
--- a/modules/misc/text_renderer.h
+++ b/modules/misc/text_renderer.h
@@ -494,39 +494,6 @@ static void HandleWhiteSpace( char *psz_node )
 }
 
 /* */
-static void HandleMarkup( char *psz_node )
-{
-    static const struct
-    {
-        const char *psz_pattern;
-        char i_char;
-    } p_replace[] = {
-        { "<",   '<' },
-        { ">",   '>' },
-        { "&",  '&' },
-        { """, '"' },
-        /* This one will always match */
-        { "&",      '&' }
-    };
-
-    char *s = psz_node;
-    while( ( s = strchr( s, '&' ) ) != NULL )
-    {
-        size_t i_size;
-        int i;
-        for( i = 0; ; i++ )
-        {
-            i_size = strlen(p_replace[i].psz_pattern);
-            if( !strncmp( s, p_replace[i].psz_pattern, i_size ) )
-                break;
-        }
-        if( i_size > 1 )
-            memmove( &s[1], &s[i_size],
-                     strlen( s ) - i_size + 1 );
-        *s++ = p_replace[i].i_char;
-    }
-}
-
 static int ProcessNodes( filter_t *p_filter,
                          xml_reader_t *p_xml_reader,
                          text_style_t *p_font_style,
@@ -654,7 +621,7 @@ static int ProcessNodes( filter_t *p_filter,
                 {
                     /* */
                     HandleWhiteSpace( psz_node );
-                    HandleMarkup( psz_node );
+                    resolve_xml_special_chars( psz_node );
 
                     SetupLine( p_filter, psz_node, &psz_text,
                                pi_runs, ppi_run_lengths, ppp_styles,




More information about the vlc-devel mailing list