From a7f981671c9d05db6c5ebb68c7f58acd35d736ff Mon Sep 17 00:00:00 2001 From: Lipin Dmitriy Date: Tue, 24 May 2016 11:46:10 +0300 Subject: [PATCH] support (partial) for bin format family --- lua_cmsgpack.c | 3 +++ test.lua | 3 +++ 2 files changed, 6 insertions(+) diff --git a/lua_cmsgpack.c b/lua_cmsgpack.c index 90a388f..805b0c8 100644 --- a/lua_cmsgpack.c +++ b/lua_cmsgpack.c @@ -688,6 +688,7 @@ void mp_decode_to_lua_type(lua_State *L, mp_cur *c) { mp_cur_consume(c,9); } break; + case 0xc4: /* bin 8 */ case 0xd9: /* raw 8 */ mp_cur_need(c,2); { @@ -697,6 +698,7 @@ void mp_decode_to_lua_type(lua_State *L, mp_cur *c) { mp_cur_consume(c,2+l); } break; + case 0xc5: /* bin 16 */ case 0xda: /* raw 16 */ mp_cur_need(c,3); { @@ -706,6 +708,7 @@ void mp_decode_to_lua_type(lua_State *L, mp_cur *c) { mp_cur_consume(c,3+l); } break; + case 0xc6: /* bin 32 */ case 0xdb: /* raw 32 */ mp_cur_need(c,5); { diff --git a/test.lua b/test.lua index 77c4c23..1c6798e 100644 --- a/test.lua +++ b/test.lua @@ -381,6 +381,9 @@ test_pack_and_unpack("int64",-1099511627776,"d3ffffff0000000000") test_pack_and_unpack("raw8"," ","d921202020202020202020202020202020202020202020202020202020202020202020") test_pack_and_unpack("raw16"," ","da01012020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020") test_pack_and_unpack("array 16",{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},"dc001000000000000000000000000000000000") +test_unpack("bin8","c421202020202020202020202020202020202020202020202020202020202020202020"," ") +test_unpack("bin16","c501012020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020"," ") +test_unpack("bin32","c600000021202020202020202020202020202020202020202020202020202020202020202020"," ") -- Regression test for issue #4, cyclic references in tables. a = {x=nil,y=5}