comparison src/json.c @ 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 6ae3fb4fe7c1
children 18fd94bd4eb8
comparison
equal deleted inserted replaced
8292:0b0ee287556a 8293:367a7fed630b
81 { 81 {
82 #if defined(FEAT_MBYTE) && defined(USE_ICONV) 82 #if defined(FEAT_MBYTE) && defined(USE_ICONV)
83 vimconv_T conv; 83 vimconv_T conv;
84 char_u *converted = NULL; 84 char_u *converted = NULL;
85 85
86 convert_setup(&conv, p_enc, (char_u*)"utf-8"); 86 if (!enc_utf8)
87 if (conv.vc_type != CONV_NONE) 87 {
88 converted = res = string_convert(&conv, res, NULL); 88 conv.vc_type = CONV_NONE;
89 convert_setup(&conv, NULL, NULL); 89 convert_setup(&conv, p_enc, (char_u*)"utf-8");
90 #endif 90 if (conv.vc_type != CONV_NONE)
91 91 converted = res = string_convert(&conv, res, NULL);
92 convert_setup(&conv, NULL, NULL);
93 }
94 #endif
92 ga_append(gap, '"'); 95 ga_append(gap, '"');
93 while (*res != NUL) 96 while (*res != NUL)
94 { 97 {
95 int c; 98 int c;
96 #ifdef FEAT_MBYTE 99 #ifdef FEAT_MBYTE
538 if (res != NULL) 541 if (res != NULL)
539 ga_init2(&ga, 1, 200); 542 ga_init2(&ga, 1, 200);
540 543
541 p = reader->js_buf + reader->js_used + 1; /* skip over " */ 544 p = reader->js_buf + reader->js_used + 1; /* skip over " */
542 #if defined(FEAT_MBYTE) && defined(USE_ICONV) 545 #if defined(FEAT_MBYTE) && defined(USE_ICONV)
543 convert_setup(&conv, (char_u*)"utf-8", p_enc); 546 if (!enc_utf8)
544 if (conv.vc_type != CONV_NONE) 547 {
545 converted = p = string_convert(&conv, p, NULL); 548 conv.vc_type = CONV_NONE;
546 convert_setup(&conv, NULL, NULL); 549 convert_setup(&conv, (char_u*)"utf-8", p_enc);
550 if (conv.vc_type != CONV_NONE)
551 converted = p = string_convert(&conv, p, NULL);
552 convert_setup(&conv, NULL, NULL);
553 }
547 #endif 554 #endif
548 while (*p != '"') 555 while (*p != '"')
549 { 556 {
550 if (*p == NUL || p[1] == NUL 557 if (*p == NUL || p[1] == NUL
551 #ifdef FEAT_MBYTE 558 #ifdef FEAT_MBYTE