[vlc-devel] commit: Remove UTF-32 hacks from stream. ( Rémi Denis-Courmont )

Derk-Jan Hartman hartman at videolan.org
Mon Sep 1 11:30:33 CEST 2008


On 31 aug 2008, at 20:33, git version control wrote:
> vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com>  
> | Sun Aug 31 21:27:52 2008 +0300|  
> [32f3116178b58222e28d258312141149d5b8573e] | committer: Rémi Denis- 
> Courmont
>
> Remove UTF-32 hacks from stream.
>
> 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.

Just as a thought... We could consider leaving the byte checks in  
place and sounding off a warning in case we DO see the 32 BOM. Then at  
least we know what happens in such a case, and we won't have to wonder  
what bug we are hunting if it does ever occur.

DJ

>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=32f3116178b58222e28d258312141149d5b8573e
> ---
>
> src/input/stream.c |   37 ++-----------------------------------
> 1 files changed, 2 insertions(+), 35 deletions(-)
>
> diff --git a/src/input/stream.c b/src/input/stream.c
> index 2b9c793..94f6383 100644
> --- a/src/input/stream.c
> +++ b/src/input/stream.c
> @@ -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 )
>             {
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel




More information about the vlc-devel mailing list