aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/msgpack_rpc/helpers.c7
-rw-r--r--src/nvim/os/win_defs.h7
-rw-r--r--test/functional/api/server_requests_spec.lua20
-rw-r--r--third-party/CMakeLists.txt2
4 files changed, 31 insertions, 5 deletions
diff --git a/src/nvim/msgpack_rpc/helpers.c b/src/nvim/msgpack_rpc/helpers.c
index a119c4653a..5ef81721d4 100644
--- a/src/nvim/msgpack_rpc/helpers.c
+++ b/src/nvim/msgpack_rpc/helpers.c
@@ -94,10 +94,9 @@ bool msgpack_rpc_to_string(msgpack_object *obj, String *arg)
FUNC_ATTR_NONNULL_ALL
{
if (obj->type == MSGPACK_OBJECT_BIN || obj->type == MSGPACK_OBJECT_STR) {
- if (obj->via.bin.ptr == NULL) {
- return false;
- }
- arg->data = xmemdupz(obj->via.bin.ptr, obj->via.bin.size);
+ arg->data = obj->via.bin.ptr != NULL
+ ? xmemdupz(obj->via.bin.ptr, obj->via.bin.size)
+ : NULL;
arg->size = obj->via.bin.size;
return true;
}
diff --git a/src/nvim/os/win_defs.h b/src/nvim/os/win_defs.h
index aad9672ba7..9f9e5e277c 100644
--- a/src/nvim/os/win_defs.h
+++ b/src/nvim/os/win_defs.h
@@ -3,6 +3,7 @@
#include <windows.h>
#include <sys/stat.h>
+#include <stdio.h>
#define TEMP_DIR_NAMES {"$TMP", "$TEMP", "$USERPROFILE", ""}
#define TEMP_FILE_PATH_MAXLEN _MAX_PATH
@@ -18,6 +19,12 @@
# ifndef restrict
# define restrict __restrict
# endif
+# ifndef STDOUT_FILENO
+# define STDOUT_FILENO _fileno(stdout)
+# endif
+# ifndef STDERR_FILENO
+# define STDERR_FILENO _fileno(stderr)
+# endif
# ifndef S_IXUSR
# define S_IXUSR S_IEXEC
# endif
diff --git a/test/functional/api/server_requests_spec.lua b/test/functional/api/server_requests_spec.lua
index a3ac864f79..16a4423535 100644
--- a/test/functional/api/server_requests_spec.lua
+++ b/test/functional/api/server_requests_spec.lua
@@ -32,6 +32,26 @@ describe('server -> client', function()
end)
end)
+ describe('empty string handling in arrays', function()
+ -- Because the msgpack encoding for an empty string was interpreted as an
+ -- error, msgpack arrays with an empty string looked like
+ -- [..., '', 0, ..., 0] after the conversion, regardless of the array
+ -- elements following the empty string.
+ it('works', function()
+ local function on_setup()
+ eq({1, 2, '', 3, 'asdf'}, eval('rpcrequest('..cid..', "nstring")'))
+ stop()
+ end
+
+ local function on_request(method, args)
+ -- No need to evaluate the args, we are only interested in
+ -- a response that contains an array with an empty string.
+ return {1, 2, '', 3, 'asdf'}
+ end
+ run(on_request, nil, on_setup)
+ end)
+ end)
+
describe('recursive call', function()
it('works', function()
local function on_setup()
diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt
index c7053e6a93..7f582d3199 100644
--- a/third-party/CMakeLists.txt
+++ b/third-party/CMakeLists.txt
@@ -77,7 +77,7 @@ set(LIBUV_SHA256 db5d46318e18330c696d954747036e1be8e2346411d4f30236d7e2f499f0cfa
set(MSGPACK_URL https://github.com/msgpack/msgpack-c/archive/cpp-1.0.0.tar.gz)
set(MSGPACK_SHA256 afda64ca445203bb7092372b822bae8b2539fdcebbfc3f753f393628c2bcfe7d)
-set(LUAJIT_URL http://luajit.org/download/LuaJIT-2.0.4.tar.gz)
+set(LUAJIT_URL https://github.com/neovim/deps/raw/master/src/LuaJIT-2.0.4.tar.gz)
set(LUAJIT_SHA256 620fa4eb12375021bef6e4f237cbd2dd5d49e56beb414bee052c746beef1807d)
set(LUAROCKS_URL https://github.com/keplerproject/luarocks/archive/5d8a16526573b36d5b22aa74866120c998466697.tar.gz)