[vlc-commits] stream_ReadLine: don't set inconsistent encoding parameters on error

Pierre Ynard git at videolan.org
Sat Oct 3 12:07:43 CEST 2020


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Sat Oct  3 12:02:38 2020 +0200| [f21515fc1851d50900433ccd6998338ea35f5e2d] | committer: Pierre Ynard

stream_ReadLine: don't set inconsistent encoding parameters on error

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

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

diff --git a/src/input/stream.c b/src/input/stream.c
index b26283e267..b7196894ea 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;
             }
         }
 



More information about the vlc-commits mailing list