diff options
author | James McCoy <jamessan@jamessan.com> | 2016-10-30 23:44:36 -0400 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2016-11-02 10:06:27 -0400 |
commit | 37e64d79cc12ceded903a490c0d6edaa60950fc6 (patch) | |
tree | fefbc3a0cffa98fd4fafe7f149b919d08b84cbda /src/nvim/api/private/helpers.c | |
parent | 87ff2682d7856c508311eeab5bd65c2505fc61d3 (diff) | |
download | rneovim-37e64d79cc12ceded903a490c0d6edaa60950fc6.tar.gz rneovim-37e64d79cc12ceded903a490c0d6edaa60950fc6.tar.bz2 rneovim-37e64d79cc12ceded903a490c0d6edaa60950fc6.zip |
object_to_vim: Fix buffer/window/tabpage conversion on BE systems
Since data.integer is a different (larger) integer type than
data.{buffer,window,tabpage}, we cannot abuse the union by using
data.integer to access the value for all 4 types. Instead, remove the
{buffer,window,tabpage} members and always use the integer member.
In order to accomodate this, perform distinct validation and coercion
between the Integer type and Buffer/Window/Tabpage types in
object_to_vim, msgpack_rpc helpers, and gendispatch.lua.
Diffstat (limited to 'src/nvim/api/private/helpers.c')
-rw-r--r-- | src/nvim/api/private/helpers.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c index 208c3b53c8..8c6eb4c0df 100644 --- a/src/nvim/api/private/helpers.c +++ b/src/nvim/api/private/helpers.c @@ -616,13 +616,13 @@ bool object_to_vim(Object obj, typval_T *tv, Error *err) case kObjectTypeWindow: case kObjectTypeTabpage: case kObjectTypeInteger: - if (obj.data.integer > INT_MAX || obj.data.integer < INT_MIN) { + if (obj.data.integer > VARNUMBER_MAX || obj.data.integer < VARNUMBER_MIN) { api_set_error(err, Validation, _("Integer value outside range")); return false; } tv->v_type = VAR_NUMBER; - tv->vval.v_number = (int)obj.data.integer; + tv->vval.v_number = (varnumber_T)obj.data.integer; break; case kObjectTypeFloat: |