diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-09-13 19:32:06 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-13 19:32:06 -0700 |
commit | 9cf8cf605d85ec043d4e39f73ac42c7482c6f901 (patch) | |
tree | b0a8ec8985c5bdfb1882ee847ff64b42c98d3e0a /src/nvim/spellfile.c | |
parent | 427cf16e44d047c14e0ca1b95eb09fc8b8eb2f3d (diff) | |
parent | 6aae0e7c943267d2109ae20ec5086791c3b94a5e (diff) | |
download | rneovim-9cf8cf605d85ec043d4e39f73ac42c7482c6f901.tar.gz rneovim-9cf8cf605d85ec043d4e39f73ac42c7482c6f901.tar.bz2 rneovim-9cf8cf605d85ec043d4e39f73ac42c7482c6f901.zip |
Merge #11015 from justinmk/getdigits
getdigits: introduce `strict`, `def` parameters
Diffstat (limited to 'src/nvim/spellfile.c')
-rw-r--r-- | src/nvim/spellfile.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c index 405e390589..01daafa09e 100644 --- a/src/nvim/spellfile.c +++ b/src/nvim/spellfile.c @@ -1833,24 +1833,30 @@ int spell_check_msm(void) if (!ascii_isdigit(*p)) return FAIL; // block count = (value * 1024) / SBLOCKSIZE (but avoid overflow) - start = (getdigits_long(&p) * 10) / (SBLOCKSIZE / 102); - if (*p != ',') + start = (getdigits_long(&p, true, 0) * 10) / (SBLOCKSIZE / 102); + if (*p != ',') { return FAIL; - ++p; - if (!ascii_isdigit(*p)) + } + p++; + if (!ascii_isdigit(*p)) { return FAIL; - incr = (getdigits_long(&p) * 102) / (SBLOCKSIZE / 10); - if (*p != ',') + } + incr = (getdigits_long(&p, true, 0) * 102) / (SBLOCKSIZE / 10); + if (*p != ',') { return FAIL; - ++p; - if (!ascii_isdigit(*p)) + } + p++; + if (!ascii_isdigit(*p)) { return FAIL; - added = getdigits_long(&p) * 1024; - if (*p != NUL) + } + added = getdigits_long(&p, true, 0) * 1024; + if (*p != NUL) { return FAIL; + } - if (start == 0 || incr == 0 || added == 0 || incr > start) + if (start == 0 || incr == 0 || added == 0 || incr > start) { return FAIL; + } compress_start = start; compress_inc = incr; @@ -2787,7 +2793,7 @@ static unsigned get_affitem(int flagtype, char_u **pp) ++*pp; // always advance, avoid getting stuck return 0; } - res = getdigits_int(pp); + res = getdigits_int(pp, true, 0); } else { res = mb_ptr2char_adv((const char_u **)pp); if (flagtype == AFT_LONG || (flagtype == AFT_CAPLONG @@ -2906,7 +2912,7 @@ static bool flag_in_afflist(int flagtype, char_u *afflist, unsigned flag) case AFT_NUM: for (p = afflist; *p != NUL; ) { - int digits = getdigits_int(&p); + int digits = getdigits_int(&p, true, 0); assert(digits >= 0); n = (unsigned int)digits; if (n == flag) |