aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/msgpack_rpc.c
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-05-16 14:46:33 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-05-17 08:05:44 -0300
commit45e5a18f3a8c44c5ecf54956d1a8248e1bf6f3e3 (patch)
treeb510dad99a7d8bcb167053fec7d9e3bf28aeff89 /src/nvim/os/msgpack_rpc.c
parent76a2fb5667461a8b7fa1abfb5a2c7381ced3f519 (diff)
downloadrneovim-45e5a18f3a8c44c5ecf54956d1a8248e1bf6f3e3.tar.gz
rneovim-45e5a18f3a8c44c5ecf54956d1a8248e1bf6f3e3.tar.bz2
rneovim-45e5a18f3a8c44c5ecf54956d1a8248e1bf6f3e3.zip
Enable -Wconversion for API files and fix errors
Diffstat (limited to 'src/nvim/os/msgpack_rpc.c')
-rw-r--r--src/nvim/os/msgpack_rpc.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/nvim/os/msgpack_rpc.c b/src/nvim/os/msgpack_rpc.c
index ec9969f8f1..45832070b1 100644
--- a/src/nvim/os/msgpack_rpc.c
+++ b/src/nvim/os/msgpack_rpc.c
@@ -36,7 +36,7 @@ void msgpack_rpc_call(msgpack_object *req, msgpack_packer *res)
}
// Set the response id, which is the same as the request
- msgpack_pack_int(res, req->via.array.ptr[1].via.u64);
+ msgpack_pack_uint64(res, req->via.array.ptr[1].via.u64);
if (req->via.array.ptr[0].type != MSGPACK_OBJECT_POSITIVE_INTEGER) {
msgpack_rpc_error("Message type must be an integer", res);
@@ -81,10 +81,9 @@ bool msgpack_rpc_to_boolean(msgpack_object *obj, Boolean *arg)
bool msgpack_rpc_to_integer(msgpack_object *obj, Integer *arg)
{
-
if (obj->type == MSGPACK_OBJECT_POSITIVE_INTEGER
&& obj->via.u64 <= INT64_MAX) {
- *arg = obj->via.u64;
+ *arg = (int64_t)obj->via.u64;
return true;
}
@@ -177,18 +176,10 @@ bool msgpack_rpc_to_stringarray(msgpack_object *obj, StringArray *arg)
bool msgpack_rpc_to_position(msgpack_object *obj, Position *arg)
{
- // positions are represented by integer arrays of size 2
- if (obj->type != MSGPACK_OBJECT_ARRAY
- || obj->via.array.size != 2
- || obj->via.array.ptr[0].type != MSGPACK_OBJECT_POSITIVE_INTEGER
- || obj->via.array.ptr[1].type != MSGPACK_OBJECT_POSITIVE_INTEGER) {
- return false;
- }
-
- arg->row = obj->via.array.ptr[0].via.u64;
- arg->col = obj->via.array.ptr[1].via.u64;
-
- return true;
+ return obj->type == MSGPACK_OBJECT_ARRAY
+ && obj->via.array.size == 2
+ && msgpack_rpc_to_integer(obj->via.array.ptr, &arg->row)
+ && msgpack_rpc_to_integer(obj->via.array.ptr + 1, &arg->col);
}