]> git.sesse.net Git - vlc/commitdiff
Remove UTF-32 hacks from stream.
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Sun, 31 Aug 2008 18:27:52 +0000 (21:27 +0300)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Sun, 31 Aug 2008 18:36:40 +0000 (21:36 +0300)
For a start, nobody uses UTF-32 for transmission/storage.
Then, we anyway have iconv() support in the subtitle support (where it
belongs IMHO), if you really wanted to use UTF-32.

src/input/stream.c

index 2b9c7933b6438789a7174bf8a52c627a5a58654a..94f638399e55137198cebf07d0b5282158f8b923 100644 (file)
@@ -1813,7 +1813,7 @@ static int AStreamSeekImmediate( stream_t *s, int64_t i_pos )
  */
 #define STREAM_PROBE_LINE 2048
 #define STREAM_LINE_MAX (2048*100)
-char * stream_ReadLine( stream_t *s )
+char *stream_ReadLine( stream_t *s )
 {
     char *p_line = NULL;
     int i_line = 0, i_read = 0;
@@ -1841,25 +1841,9 @@ char * stream_ReadLine( stream_t *s )
                 psz_encoding = strdup( "UTF-8" );
                 i_bom_size = 3;
             }
-            else if( p_data[0] == 0x00 && p_data[1] == 0x00 )
-            {
-                if( p_data[2] == 0xFE && p_data[3] == 0xFF )
-                {
-                    psz_encoding = strdup( "UTF-32BE" );
-                    s->i_char_width = 4;
-                    i_bom_size = 4;
-                }
-            }
             else if( p_data[0] == 0xFF && p_data[1] == 0xFE )
             {
-                if( p_data[2] == 0x00 && p_data[3] == 0x00 )
-                {
-                    psz_encoding = strdup( "UTF-32LE" );
-                    s->i_char_width = 4;
-                    s->b_little_endian = true;
-                    i_bom_size = 4;
-                }
-                else
+                if( p_data[2] || p_data[3] )
                 {
                     psz_encoding = strdup( "UTF-16LE" );
                     s->b_little_endian = true;
@@ -1942,23 +1926,6 @@ char * stream_ReadLine( stream_t *s )
                         p += 2;
                 }
             }
-            else if( s->i_char_width == 4 )
-            {
-                if( s->b_little_endian == true)
-                {
-                    /* UTF-32LE: 0A 00 00 00 <LF> */
-                    while( p <= p_last && ( p[0] != 0x0A || p[1] != 0x00 ||
-                           p[2] != 0x00 || p[3] != 0x00 ) )
-                        p += 4;
-                }
-                else
-                {
-                    /* UTF-32BE: 00 00 00 0A <LF> */
-                    while( p <= p_last && ( p[3] != 0x0A || p[2] != 0x00 ||
-                           p[1] != 0x00 || p[0] != 0x00 ) )
-                        p += 4;
-                }
-            }
 
             if( p > p_last )
             {