Commit Graph

5642 Commits

Author SHA1 Message Date
ZyX
494b1c9bee *: Make set_vim_var_\* functions have proper argument types 2016-04-18 02:48:20 +03:00
ZyX
9af400f979 eval: Treat [] and [""] as any other empty string 2016-04-18 02:48:20 +03:00
ZyX
af7ff808c7 eval: Fix overflow in error message in f_json_decode 2016-04-18 02:48:20 +03:00
ZyX
9709cf2cdb documentation: Update assert_{false,true}() and empty() documentation
Also removes a note regarding the performance of `empty(long_list)` vs
`len(long_list) == 0` because this has nothing to do with the actual state:
first checks that list is not NULL and pointer to its first element is also not
NULL, second gets length by comparing list with NULL and falls back to
`tv->vval.v_list->lv_len` if not. `len(long_list)` *may* still be *slightly*
slower, but the slow down has nothing to do with the length of the list, is
hardly noticeable and depends on how good compiler is at inlining and what
exactly have author of the plugin written (I mean `len(long_list) == 0` vs
`empty(long_list)` vs `!len(long_list)`).
2016-04-18 02:48:20 +03:00
ZyX
25bb08dad9 api: Add warnings about the returned value to \*del_var functions 2016-04-18 02:48:20 +03:00
ZyX
4f8b686435 documentation,functests: State that UTF-8-only support is intentional 2016-04-18 02:48:20 +03:00
ZyX
c129f6cfaf eval/decode: Accept \r as space character 2016-04-18 02:48:20 +03:00
ZyX
d06c2a1b18 eval/decode: Do not overflow when parsing -
Also makes if’s less nested.
2016-04-18 02:48:20 +03:00
ZyX
2b0d46195b eval/decode: Clarify meaning of some pointer arguments 2016-04-18 02:48:20 +03:00
ZyX
0c598774d8 eval/decode: Fix typo in internal error message 2016-04-18 02:48:20 +03:00
ZyX
515fea1ef0 eval/decode: Reject even more numbers
Rejects leading zeroes and numbers like 1.e+5 (decimal dot with missing number 
with signed exponent).
2016-04-18 02:48:20 +03:00
ZyX
69ce17878e *: Fix linter errors 2016-04-18 02:48:20 +03:00
ZyX
1bada1fde0 documentation: Update type() documentation 2016-04-18 02:48:20 +03:00
ZyX
82f249f829 message: Remove useless emsg* functions, leaving only emsgf 2016-04-18 02:48:20 +03:00
ZyX
9a56fcb2e8 eval/decode: Rewrite json_decode_string end as suggested by oni-link 2016-04-18 02:48:20 +03:00
ZyX
9c543f2e24 eval/decode: Reject more numbers, accept 1e5 2016-04-18 02:48:20 +03:00
ZyX
032ac502ff eval/decode: Do not loose high surrogates followed by high surrogates 2016-04-18 02:48:20 +03:00
ZyX
eb806c9620 eval/decode: Make sure that error messages do not cause overflow 2016-04-18 02:48:20 +03:00
ZyX
52c6cc2189 eval/decode: Make sure that parsing strings does not overflow 2016-04-18 02:48:20 +03:00
ZyX
224d7df630 eval/decode: Make sure that blank input does not crash Neovim 2016-04-18 02:48:20 +03:00
ZyX
394830631f eval/decode: Make sure that U+00C3 is parsed correctly 2016-04-18 02:48:20 +03:00
ZyX
b725f6b428 functests: Make sure that json functions are tested with C messages 2016-04-18 02:48:20 +03:00
ZyX
4eb5d05f01 eval/decode: Avoid overflow when parsing incomplete null/true/false
Note: second test does not crash or produce asan errors, even though it should.
2016-04-18 02:48:20 +03:00
ZyX
4a29995fe7 eval/decode: Rename brackets in error messages
U+007D is officially RIGHT CURLY BRACKET.
U+005D is officially RIGHT SQUARE BRACKET.
2016-04-18 02:48:20 +03:00
ZyX
1fc84ae2cd eval/decode: Record that obj may be freed 2016-04-18 02:48:20 +03:00
ZyX
4ff5d6e41c eval/decode: Also use VAR_UNLOCKED in old code 2016-04-18 02:48:20 +03:00
ZyX
54cc6d8025 eval: Remove assert expression
GCC on travis thinks that
1. It is not constant.
2. Left-hand operand of comma has no effect (-Werror=unused-variable).
2016-04-18 02:48:20 +03:00
ZyX
6a35f2ac8b eval: Do not break when VimVarIndex and vimvars order mismatches
Also makes sure that compiler will error out when new name is longer then 
vv_filler.
2016-04-18 02:48:20 +03:00
ZyX
942e0b338c encode: Handle incomplete surrogates like \uSURR\uOTHR properly 2016-04-18 02:48:20 +03:00
ZyX
406562ac6d encode: Fail to dump NaN and infinity
Thanks to vim/vim#654
2016-04-18 02:48:20 +03:00
ZyX
7cdd01983a api/documentation: Add a warning that nil may mean v:null 2016-04-18 02:48:20 +03:00
ZyX
2f67786796 eval: Rename json* functions to json_* 2016-04-18 02:48:20 +03:00
ZyX
f1ced96c28 api: Replace set_var(name, NIL) with del_var(name) 2016-04-18 02:47:13 +03:00
ZyX
af6603a6b4 eval/encode: Remove unneeded variable, add missing include 2016-04-18 02:47:13 +03:00
ZyX
4913a25dec eval/encode: Free memory just in case
After string_convert() with .vc_fail=true these blocks should never be entered 
because they indicate invalid unicode.
2016-04-18 02:47:13 +03:00
ZyX
209427e972 eval/encode: Reduce length of encode_list_write
Changes suggested by oni-link.
2016-04-18 02:47:13 +03:00
ZyX
f0bd4a1494 eval/encode: Fix invalid UTF-8 strings handling:
1. Do not allow reading past buffer end when creating error messages.
2. Fix surrogate pairs range, avoid magic constants.
2016-04-18 02:47:13 +03:00
ZyX
77776b09c6 eval/encode: Fix writing strings starting with NL to list
Error [found][1] by oni-link.

[1]: https://github.com/neovim/neovim/pull/4131/files#r52239384
2016-04-18 02:47:13 +03:00
ZyX
c27395ddc8 eval: Fix QuickBuild failures
Compiler used by one VM in QuickBuild has found a number of false positives.
Everything is fine on travis.

List of failures:

From [QuickBuild][1], build [7429][2]:

    14:38:19,945 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval.c: In function ‘assert_bool’:
    14:38:19,945 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval.c:7551:40: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
    14:38:20,058 WARN  - cc1: all warnings being treated as errors

. This is not making much sense (7551:40 is `!=` in `{SpecialVarValue} !=
({bool}?{SpecialVarValue}:{SpecialVarValue})`), but this error is present.

---

Also fail from [build][3] [4930][4]:

    15:47:00,853 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval/encode.c: In function ‘encode_read_from_list’:
    15:47:00,853 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval/encode.c:258:30: error: conversion to ‘char’ from ‘int’ may alter its value [-Werror=conversion]

, pointing to `:` in `{char} = ({char} == {const} ? {const} : {char})` where
`{const}` is character constant like `'\n'`. I have no idea where exactly it saw
conversion, so simply casted everything to (char).

---

[Build][5] error:

    08:32:03,472 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval.c: In function ‘tv_equal’:
    08:32:03,472 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval.c:5077:1: error: control reaches end of non-void function [-Werror=return-type]

---

Build [4949][7]:

    11:28:00,578 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval.c: In function ‘f_type’:
    11:28:00,578 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval.c:16085:24: error: ‘n’ may be used uninitialized in this function [-Werror=uninitialized]
    11:28:00,581 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval.c: In function ‘f_empty’:
    11:28:00,581 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval.c:8505:24: error: ‘n’ may be used uninitialized in this function [-Werror=uninitialized]

[1]: http://neovim-qb.szakmeister.net/wicket/page?5-1.ILinkListener-content-buildTab-panel-masterStep-body-children-0-step-body-children-2-body-children-3-step-body-children-0-step-body-children-0-step-head-logLink
[2]: http://neovim-qb.szakmeister.net/build/4929
[3]: http://neovim-qb.szakmeister.net/build/4930
[4]: http://neovim-qb.szakmeister.net/wicket/page?1-1.ILinkListener-content-buildTab-panel-masterStep-body-children-0-step-body-children-1-body-children-3-step-body-children-0-step-body-children-0-step-head-logLink
[5]: http://neovim-qb.szakmeister.net/build/4948/step_status
[7]: http://neovim-qb.szakmeister.net/build/4949
2016-04-18 02:47:13 +03:00
ZyX
fa26eee85b version: Record that vim-7.4.1271 is kinda of there 2016-04-18 02:46:55 +03:00
ZyX
569e404622 eval/encode: Fix non-utf-8 &encoding handling, add tests 2016-04-18 02:46:34 +03:00
ZyX
7124329bd9 *: Fix memory leaks found by clang sanitizer 2016-04-18 02:46:34 +03:00
ZyX
d4106f6df3 shada: Make sure that NIL and EXT values can also be parsed back
Note: currently they are both *dumped*, but parsing them produces an error. This
is inappropriate: variables should either be skipped with error message when
dumping or should be read back properly.

It also appears that I did not have test for “has wrong variable value type”
error, so nothing got removed from errors_spec.
2016-04-18 02:46:34 +03:00
ZyX
0aa3e7b7ce eval: Port parts of 7.4.1267 that are not already present 2016-04-18 02:46:34 +03:00
ZyX
b7cb8f0597 eval: Make assert_true and assert_false accept v:true and v:false 2016-04-18 02:45:49 +03:00
ZyX
c91c0171dd *: Fix gcc warnings 2016-04-18 02:45:49 +03:00
ZyX
6cdf45e298 eval: Change dv_lock type to VarLockStatus 2016-04-18 02:45:49 +03:00
ZyX
f4ea114c67 eval/decode: Fix vim_str2nr invocation 2016-04-18 02:45:49 +03:00
ZyX
33778c36cc *: Fix linter errors 2016-04-18 02:45:49 +03:00
ZyX
6167ce6df2 eval: Remove v:none
To get v:none back just rever this commit. This will not make json*() functions
compatible with Vim though.
2016-04-18 02:45:49 +03:00