summaryrefslogtreecommitdiff
path: root/src/json.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-01-24 15:05:32 +0100
committerBram Moolenaar <Bram@vim.org>2016-01-24 15:05:32 +0100
commit6039c7f05376f0e470cf62bf2757e653aea357f3 (patch)
treeab4cbced0c4d4ac6c48cdacd4d2472b8b615077f /src/json.c
parent17a13437c9414a8693369a97f3be2fc8ad48c12e (diff)
downloadvim-git-6039c7f05376f0e470cf62bf2757e653aea357f3.tar.gz
patch 7.4.1164v7.4.1164
Problem: No tests for comparing special variables. Error in jsondecode() not reported. test_json does not work Japanse system. Solution: Set scriptencoding. (Ken Takata) Add a few more tests. Add error.
Diffstat (limited to 'src/json.c')
-rw-r--r--src/json.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/json.c b/src/json.c
index accb6cf85..e4473830a 100644
--- a/src/json.c
+++ b/src/json.c
@@ -220,7 +220,7 @@ json_decode_array(js_read_T *reader, typval_T *res)
listitem_T *li;
if (rettv_list_alloc(res) == FAIL)
- goto fail;
+ goto failsilent;
++reader->js_used; /* consume the '[' */
while (TRUE)
@@ -253,6 +253,8 @@ json_decode_array(js_read_T *reader, typval_T *res)
goto fail;
}
fail:
+ EMSG(_(e_invarg));
+failsilent:
res->v_type = VAR_SPECIAL;
res->vval.v_number = VVAL_NONE;
}
@@ -268,7 +270,7 @@ json_decode_object(js_read_T *reader, typval_T *res)
char_u *key;
if (rettv_dict_alloc(res) == FAIL)
- goto fail;
+ goto failsilent;
++reader->js_used; /* consume the '{' */
while (TRUE)
@@ -293,7 +295,7 @@ json_decode_object(js_read_T *reader, typval_T *res)
if (key != NULL)
EMSG(_(e_emptykey));
clear_tv(&tvkey);
- goto fail;
+ goto failsilent;
}
json_skip_white(reader);
@@ -329,6 +331,8 @@ json_decode_object(js_read_T *reader, typval_T *res)
goto fail;
}
fail:
+ EMSG(_(e_invarg));
+failsilent:
res->v_type = VAR_SPECIAL;
res->vval.v_number = VVAL_NONE;
}