[vlc-commits] subsdec: remove broken AppendWideChar()
Rémi Denis-Courmont
git at videolan.org
Sun Nov 13 12:12:06 CET 2016
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Nov 13 13:09:57 2016 +0200| [eac6a8ea09dd3e56e83cf87c2a8ba1d7df372e5d] | committer: Rémi Denis-Courmont
subsdec: remove broken AppendWideChar()
That function assumed that:
- wchar_t and wint_t are the same: not true on Linux-i386,
- the locale encodes characters as UTF-8: not true on Windows.
This replaces its only occurrence with AppendString() and an explicit
UTF-8 sequence.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=eac6a8ea09dd3e56e83cf87c2a8ba1d7df372e5d
---
modules/codec/subsdec.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/modules/codec/subsdec.c b/modules/codec/subsdec.c
index 08accc1..7aaec5d 100644
--- a/modules/codec/subsdec.c
+++ b/modules/codec/subsdec.c
@@ -477,16 +477,6 @@ static bool AppendCharacter( text_segment_t* p_segment, char c )
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 )
- return false;
- free( p_segment->psz_text );
- p_segment->psz_text = tmp;
- return true;
-}
-
static bool AppendString( text_segment_t* p_segment, const char* psz_str )
{
char* tmp;
@@ -1025,7 +1015,7 @@ static text_segment_t* ParseSubtitles( int *pi_align, const char *psz_subtitle )
}
else if( !strncasecmp( psz_subtitle, "\\h", 2 ) )
{
- if ( !AppendWideCharacter( p_segment, L'\u00A0' ) )
+ if ( !AppendString( p_segment, "\xC2\xA0" ) )
goto fail;
psz_subtitle += 2;
}
More information about the vlc-commits
mailing list