changeset 8293:367a7fed630b v7.4.1439

commit https://github.com/vim/vim/commit/f97ddbeb255c64a2b3d9db4b049278cd286070a6 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Feb 27 21:13:38 2016 +0100 patch 7.4.1439 Problem: Using uninitialzed variable. Solution: Initialize vc_type.
author Christian Brabandt <cb@256bit.org>
date Sat, 27 Feb 2016 21:15:05 +0100
parents 0b0ee287556a
children 7d7476de1d7b
files src/json.c src/version.c
diffstat 2 files changed, 18 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/json.c
+++ b/src/json.c
@@ -83,12 +83,15 @@ write_string(garray_T *gap, char_u *str)
 	vimconv_T   conv;
 	char_u	    *converted = NULL;
 
-	convert_setup(&conv, p_enc, (char_u*)"utf-8");
-	if (conv.vc_type != CONV_NONE)
-	    converted = res = string_convert(&conv, res, NULL);
-	convert_setup(&conv, NULL, NULL);
+	if (!enc_utf8)
+	{
+	    conv.vc_type = CONV_NONE;
+	    convert_setup(&conv, p_enc, (char_u*)"utf-8");
+	    if (conv.vc_type != CONV_NONE)
+		converted = res = string_convert(&conv, res, NULL);
+	    convert_setup(&conv, NULL, NULL);
+	}
 #endif
-
 	ga_append(gap, '"');
 	while (*res != NUL)
 	{
@@ -540,10 +543,14 @@ json_decode_string(js_read_T *reader, ty
 
     p = reader->js_buf + reader->js_used + 1; /* skip over " */
 #if defined(FEAT_MBYTE) && defined(USE_ICONV)
-    convert_setup(&conv, (char_u*)"utf-8", p_enc);
-    if (conv.vc_type != CONV_NONE)
-	converted = p = string_convert(&conv, p, NULL);
-    convert_setup(&conv, NULL, NULL);
+    if (!enc_utf8)
+    {
+	conv.vc_type = CONV_NONE;
+	convert_setup(&conv, (char_u*)"utf-8", p_enc);
+	if (conv.vc_type != CONV_NONE)
+	    converted = p = string_convert(&conv, p, NULL);
+	convert_setup(&conv, NULL, NULL);
+    }
 #endif
     while (*p != '"')
     {
--- a/src/version.c
+++ b/src/version.c
@@ -744,6 +744,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1439,
+/**/
     1438,
 /**/
     1437,