[vlc-devel] [PATCH 1/5] stream_ReadLine: fix end of line detection on big-endian UTF-16

Pierre Ynard linkfanel at yahoo.fr
Sun Sep 6 04:35:28 CEST 2020


Lines would be split on non-breaking spaces (0x00A0) instead of line
feeds (0x000A).


diff --git a/src/input/stream.c b/src/input/stream.c
index 35c5a04..b26283e 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -263,7 +263,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;
@@ -279,7 +279,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 )
-- 
Pierre Ynard
"Une âme dans un corps, c'est comme un dessin sur une feuille de papier."


More information about the vlc-devel mailing list