Mercurial > vim
comparison src/json.c @ 8655:1eb302bf2475 v7.4.1617
commit https://github.com/vim/vim/commit/ba61ac0d61f46de7d29c64bb0de6d25c2e378be0
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Mar 20 16:40:37 2016 +0100
patch 7.4.1617
Problem: When a JSON message is split it isn't decoded.
Solution: Wait a short time for the rest of the message to arrive.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 20 Mar 2016 16:45:04 +0100 |
parents | c337c813c64d |
children | 7038ec89d1fd |
comparison
equal
deleted
inserted
replaced
8654:12ff4422343e | 8655:1eb302bf2475 |
---|---|
875 } | 875 } |
876 | 876 |
877 /* | 877 /* |
878 * Decode the JSON from "reader" and store the result in "res". | 878 * Decode the JSON from "reader" and store the result in "res". |
879 * "options" can be JSON_JS or zero; | 879 * "options" can be JSON_JS or zero; |
880 * Return FAIL if the message has a decoding error or the message is | 880 * Return FAIL for a decoding error. |
881 * truncated. Consumes the message anyway. | 881 * Return MAYBE for an incomplete message. |
882 * Consumes the message anyway. | |
882 */ | 883 */ |
883 int | 884 int |
884 json_decode(js_read_T *reader, typval_T *res, int options) | 885 json_decode(js_read_T *reader, typval_T *res, int options) |
885 { | 886 { |
886 int ret; | 887 int ret; |
889 reader->js_end = reader->js_buf + STRLEN(reader->js_buf); | 890 reader->js_end = reader->js_buf + STRLEN(reader->js_buf); |
890 json_skip_white(reader); | 891 json_skip_white(reader); |
891 ret = json_decode_item(reader, res, options); | 892 ret = json_decode_item(reader, res, options); |
892 json_skip_white(reader); | 893 json_skip_white(reader); |
893 | 894 |
894 return ret == OK ? OK : FAIL; | 895 return ret; |
895 } | 896 } |
896 | 897 |
897 /* | 898 /* |
898 * Decode the JSON from "reader" to find the end of the message. | 899 * Decode the JSON from "reader" to find the end of the message. |
899 * "options" can be JSON_JS or zero; | 900 * "options" can be JSON_JS or zero; |