[vlc-devel] [PATCH 2/3] stream_ReadLine: don't set inconsistent encoding parameters on error

Pierre Ynard linkfanel at yahoo.fr
Tue Sep 29 14:10:47 CEST 2020


diff --git a/src/input/stream.c b/src/input/stream.c
index 05ea1a7..2d9f4f9 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -210,6 +210,7 @@ char *vlc_stream_ReadLine( stream_t *s )
         if( i_pos == 0 && i_data >= 2 )
         {
             const char *psz_encoding = NULL;
+            bool little_endian = false;
 
             if( unlikely(priv->text.conv != (vlc_iconv_t)-1) )
             {   /* seek back to beginning? reset */
@@ -220,7 +221,7 @@ char *vlc_stream_ReadLine( stream_t *s )
             if( !memcmp( p_data, "\xFF\xFE", 2 ) )
             {
                 psz_encoding = "UTF-16LE";
-                priv->text.little_endian = true;
+                little_endian = true;
             }
             else if( !memcmp( p_data, "\xFE\xFF", 2 ) )
             {
@@ -238,6 +239,7 @@ char *vlc_stream_ReadLine( stream_t *s )
                     goto error;
                 }
                 priv->text.char_width = 2;
+                priv->text.little_endian = little_endian;
             }
         }
 
-- 
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