[vlc-commits] CC: simplify Eia608TextUtf8()
Rafaël Carré
git at videolan.org
Thu Oct 11 14:13:41 CEST 2012
vlc | branch: master | Rafaël Carré <funman at videolan.org> | Thu Oct 11 13:56:20 2012 +0200| [e14da610c6ec901bb3494bed8d2341087bda847a] | committer: Rafaël Carré
CC: simplify Eia608TextUtf8()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e14da610c6ec901bb3494bed8d2341087bda847a
---
modules/codec/cc.c | 23 +++++++----------------
1 file changed, 7 insertions(+), 16 deletions(-)
diff --git a/modules/codec/cc.c b/modules/codec/cc.c
index 637dd69..5d8e685 100644
--- a/modules/codec/cc.c
+++ b/modules/codec/cc.c
@@ -899,23 +899,14 @@ static void Eia608TextUtf8( char *psz_utf8, uint8_t c ) // Returns number of byt
#undef E2
#undef E1
- static const int i_c2utf8 = sizeof(c2utf8)/sizeof(*c2utf8);
- int i;
+ for( size_t i = 0; i < ARRAY_SIZE(c2utf8) ; i++ )
+ if( c2utf8[i].c == c ) {
+ strcpy( psz_utf8, c2utf8[i].utf8 );
+ return;
+ }
- for( i = 0; i < i_c2utf8; i++ )
- {
- if( c2utf8[i].c == c )
- break;
- }
- if( i >= i_c2utf8 )
- {
- psz_utf8[0] = c < 0x80 ? c : '?'; /* Normal : Unsupported */
- psz_utf8[1] = '\0';
- }
- else
- {
- strcpy( psz_utf8, c2utf8[i].utf8 );
- }
+ psz_utf8[0] = c < 0x80 ? c : '?'; /* Normal : Unsupported */
+ psz_utf8[1] = '\0';
}
static void Eia608Strlcat( char *d, const char *s, int i_max )
More information about the vlc-commits
mailing list