vlc | branch: master | Hugo Beauzée-Luyssen <[email protected]> | Wed Jul 22 
13:16:01 2015 +0200| [ff6e966215cf778ab2f3057a9e731c92bba7ce3c] | committer: 
Jean-Baptiste Kempf

subsdec: Fix unicode regression

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

 modules/codec/subsdec.c |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/modules/codec/subsdec.c b/modules/codec/subsdec.c
index 3d70255..a96bb6a 100644
--- a/modules/codec/subsdec.c
+++ b/modules/codec/subsdec.c
@@ -645,7 +645,17 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t 
*p_block )
     return p_spu;
 }
 
-static bool AppendCharacter( text_segment_t* p_segment, wchar_t c )
+static bool AppendCharacter( text_segment_t* p_segment, char c )
+{
+    char* tmp;
+    if ( asprintf( &tmp, "%s%c", p_segment->psz_text ? p_segment->psz_text : 
"", c ) < 0 )
+        return false;
+    free( p_segment->psz_text );
+    p_segment->psz_text = tmp;
+    return true;
+}
+
+static bool AppendWideCharacter( text_segment_t* p_segment, wchar_t c )
 {
     char* tmp;
     if ( asprintf( &tmp, "%s%lc", p_segment->psz_text ? p_segment->psz_text : 
"", c ) < 0 )
@@ -1154,7 +1164,7 @@ static text_segment_t* ParseSubtitles( int *pi_align, 
const char *psz_subtitle )
             }
             else if( !strncasecmp( psz_subtitle, "\\h", 2 ) )
             {
-                if ( !AppendCharacter( p_segment, L'\u00A0' ) )
+                if ( !AppendWideCharacter( p_segment, L'\u00A0' ) )
                     goto fail;
                 psz_subtitle += 2;
             }

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to