diff src/json.c @ 19193:9f98957582d6 v8.2.0155

patch 8.2.0155: warnings from MinGW compiler; tests fail without +float Commit: https://github.com/vim/vim/commit/a5d5953d59730d9bf9c00a727c4aeb56f6ffc944 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 26 21:42:03 2020 +0100 patch 8.2.0155: warnings from MinGW compiler; tests fail without +float Problem: Warnings from MinGW compiler. (John Marriott) Json test fails when building without +float feature. Solution: Init variables. Fix Json parsing. Skip a few tests that require the +float feature.
author Bram Moolenaar <Bram@vim.org>
date Sun, 26 Jan 2020 21:45:03 +0100
parents 94eda51ba9ba
children e7b4fff348dd
line wrap: on
line diff
--- a/src/json.c
+++ b/src/json.c
@@ -761,9 +761,9 @@ json_decode_item(js_read_T *reader, typv
 		    break;
 
 		default:
-		    if (VIM_ISDIGIT(*p) || (*p == '-' && VIM_ISDIGIT(p[1])))
+		    if (VIM_ISDIGIT(*p) || (*p == '-'
+					&& (VIM_ISDIGIT(p[1]) || p[1] == NUL)))
 		    {
-#ifdef FEAT_FLOAT
 			char_u  *sp = p;
 
 			if (*sp == '-')
@@ -782,6 +782,7 @@ json_decode_item(js_read_T *reader, typv
 			    }
 			}
 			sp = skipdigits(sp);
+#ifdef FEAT_FLOAT
 			if (*sp == '.' || *sp == 'e' || *sp == 'E')
 			{
 			    if (cur_item == NULL)
@@ -889,7 +890,8 @@ json_decode_item(js_read_T *reader, typv
 		    }
 #endif
 		    // check for truncated name
-		    len = (int)(reader->js_end - (reader->js_buf + reader->js_used));
+		    len = (int)(reader->js_end
+					 - (reader->js_buf + reader->js_used));
 		    if (
 			    (len < 5 && STRNICMP((char *)p, "false", len) == 0)
 #ifdef FEAT_FLOAT