[vlc-devel] commit: stream_ReadLine: bytes per char is either 1 or 2 ( Rémi Denis-Courmont )
git version control
git at videolan.org
Wed Feb 17 21:39:18 CET 2010
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Feb 17 22:25:06 2010 +0200| [fcead451d89ae2837684b32c7af6c28ef43a3e12] | committer: Rémi Denis-Courmont
stream_ReadLine: bytes per char is either 1 or 2
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fcead451d89ae2837684b32c7af6c28ef43a3e12
---
src/input/stream.c | 26 ++++++++++++--------------
1 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/src/input/stream.c b/src/input/stream.c
index b36590b..d068986 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -1573,20 +1573,18 @@ char *stream_ReadLine( stream_t *s )
const uint8_t *p = p_data;
const uint8_t *p_last = p + i_data - s->p_text->i_char_width;
- if( s->p_text->i_char_width == 2 )
+ assert( s->p_text->i_char_width == 2 );
+ if( s->p_text->b_little_endian == true)
{
- if( s->p_text->b_little_endian == true)
- {
- /* UTF-16LE: 0A 00 <LF> */
- while( p <= p_last && ( p[0] != 0x0A || p[1] != 0x00 ) )
- p += 2;
- }
- else
- {
- /* UTF-16BE: 00 0A <LF> */
- while( p <= p_last && ( p[1] != 0x0A || p[0] != 0x00 ) )
- p += 2;
- }
+ /* UTF-16LE: 0A 00 <LF> */
+ while( p <= p_last && ( p[0] != 0x0A || p[1] != 0x00 ) )
+ p += 2;
+ }
+ else
+ {
+ /* UTF-16BE: 00 0A <LF> */
+ while( p <= p_last && ( p[1] != 0x0A || p[0] != 0x00 ) )
+ p += 2;
}
if( p > p_last )
@@ -1595,7 +1593,7 @@ char *stream_ReadLine( stream_t *s )
}
else
{
- psz_eol = (char *)p + ( s->p_text->i_char_width - 1 );
+ psz_eol = (char *)p + 1;
}
}
More information about the vlc-devel
mailing list