[vlc-commits] stream_ReadLine: fix end of line detection on big-endian UTF-16

Pierre Ynard git at videolan.org
Thu Sep 17 06:16:05 CEST 2020


vlc/vlc-3.0 | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Thu Sep 17 06:09:06 2020 +0200| [40a42f6ad9d314d1027a9ec7351c60390be7bda9] | committer: 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).

(cherry picked from commit 1a954775549e23a8e1c3051157d14436d4055679)
Signed-off-by: Pierre Ynard <linkfanel at yahoo.fr>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=40a42f6ad9d314d1027a9ec7351c60390be7bda9
---

 src/input/stream.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/input/stream.c b/src/input/stream.c
index 07f3f886f7..a191a1de40 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -248,7 +248,7 @@ char *vlc_stream_ReadLine( stream_t *s )
         else
         {
             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 );
             psz_eol = NULL;
@@ -264,7 +264,7 @@ char *vlc_stream_ReadLine( stream_t *s )
 
             if( psz_eol == NULL )
             {   /* 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 )
                 {
                     if( U16_AT( p ) == eol )



More information about the vlc-commits mailing list