mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 05:58:33 +00:00
refactor(typval)!: remove distinction of binary and nonbinary strings
This is a breaking change which will make refactor of typval and shada code a lot easier. In particular, code that would use or check for v:msgpack_types.binary in the wild would be broken. This appears to be rarely used in existing plugins. Also some cases where v:msgpack_type.string would be used to represent a binary string of "string" type, we use a BLOB instead, which is vimscripts native type for binary blobs, and already was used for BIN formats when necessary. msgpackdump(msgpackparse(data)) no longer preserves the distinction of BIN and STR strings. This is very common behavior for language-specific msgpack bindings. Nvim uses msgpack as a tool to serialize its data. Nvim is not a tool to bit-perfectly manipulate arbitrary msgpack data out in the wild. The changed tests should indicate how behavior changes in various edge cases.
This commit is contained in:
@@ -219,12 +219,7 @@ bool nlua_pop_typval(lua_State *lstate, typval_T *ret_tv)
|
||||
if (cur.special) {
|
||||
list_T *const kv_pair = tv_list_alloc(2);
|
||||
|
||||
typval_T s_tv = decode_string(s, len, kTrue, false, false);
|
||||
if (s_tv.v_type == VAR_UNKNOWN) {
|
||||
ret = false;
|
||||
tv_list_unref(kv_pair);
|
||||
continue;
|
||||
}
|
||||
typval_T s_tv = decode_string(s, len, true, false);
|
||||
tv_list_append_owned_tv(kv_pair, s_tv);
|
||||
|
||||
// Value: not populated yet, need to create list item to push.
|
||||
@@ -280,10 +275,7 @@ bool nlua_pop_typval(lua_State *lstate, typval_T *ret_tv)
|
||||
case LUA_TSTRING: {
|
||||
size_t len;
|
||||
const char *s = lua_tolstring(lstate, -1, &len);
|
||||
*cur.tv = decode_string(s, len, kNone, true, false);
|
||||
if (cur.tv->v_type == VAR_UNKNOWN) {
|
||||
ret = false;
|
||||
}
|
||||
*cur.tv = decode_string(s, len, false, false);
|
||||
break;
|
||||
}
|
||||
case LUA_TNUMBER: {
|
||||
|
Reference in New Issue
Block a user