Commit 1a954775 authored by Pierre Ynard's avatar Pierre Ynard

stream_ReadLine: fix end of line detection on big-endian UTF-16

Lines would be split on non-breaking spaces (0x00A0) instead of line
feeds (0x000A).
parent f263178f
Pipeline #22388 passed with stages
in 34 minutes and 47 seconds
...@@ -263,7 +263,7 @@ char *vlc_stream_ReadLine( stream_t *s ) ...@@ -263,7 +263,7 @@ char *vlc_stream_ReadLine( stream_t *s )
else else
{ {
const uint8_t *p_last = p_data + i_data - priv->text.char_width; const uint8_t *p_last = p_data + i_data - priv->text.char_width;
uint16_t eol = priv->text.little_endian ? 0x0A00 : 0x00A0; uint16_t eol = priv->text.little_endian ? 0x0A00 : 0x000A;
assert( priv->text.char_width == 2 ); assert( priv->text.char_width == 2 );
psz_eol = NULL; psz_eol = NULL;
...@@ -279,7 +279,7 @@ char *vlc_stream_ReadLine( stream_t *s ) ...@@ -279,7 +279,7 @@ char *vlc_stream_ReadLine( stream_t *s )
if( psz_eol == NULL ) if( psz_eol == NULL )
{ /* UTF-16: 000D <CR> */ { /* UTF-16: 000D <CR> */
eol = priv->text.little_endian ? 0x0D00 : 0x00D0; eol = priv->text.little_endian ? 0x0D00 : 0x000D;
for( const uint8_t *p = p_data; p <= p_last; p += 2 ) for( const uint8_t *p = p_data; p <= p_last; p += 2 )
{ {
if( U16_AT( p ) == eol ) if( U16_AT( p ) == eol )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment