Skip to content

Commit 106ef6f

Browse files
committed
up
1 parent ff72c95 commit 106ef6f

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

msgpack/pack_template.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -704,22 +704,18 @@ msgpack_pack_inline_func(_array)(msgpack_pack_user x, unsigned int n)
704704
* Map
705705
*/
706706

707-
msgpack_pack_inline_func(_map)(msgpack_pack_user x, unsigned int l)
707+
msgpack_pack_inline_func(_map)(msgpack_pack_user x, unsigned int n)
708708
{
709-
if(l < 32) {
710-
unsigned char d = 0xa0 | l;
709+
if(n < 16) {
710+
unsigned char d = 0x80 | n;
711711
msgpack_pack_append_buffer(x, &TAKE8_8(d), 1);
712-
} else if (l < 256) {
713-
unsigned char buf[2];
714-
buf[0] = 0xd9; buf[1] = (uint8_t)l;
715-
msgpack_pack_append_buffer(x, buf, 2);
716-
} else if(l < 65536) {
712+
} else if(n < 65536) {
717713
unsigned char buf[3];
718-
buf[0] = 0xda; _msgpack_store16(&buf[1], (uint16_t)l);
714+
buf[0] = 0xde; _msgpack_store16(&buf[1], (uint16_t)n);
719715
msgpack_pack_append_buffer(x, buf, 3);
720716
} else {
721717
unsigned char buf[5];
722-
buf[0] = 0xdb; _msgpack_store32(&buf[1], (uint32_t)l);
718+
buf[0] = 0xdf; _msgpack_store32(&buf[1], (uint32_t)n);
723719
msgpack_pack_append_buffer(x, buf, 5);
724720
}
725721
}
@@ -734,6 +730,10 @@ msgpack_pack_inline_func(_raw)(msgpack_pack_user x, size_t l)
734730
if(l < 32) {
735731
unsigned char d = 0xa0 | l;
736732
msgpack_pack_append_buffer(x, &TAKE8_8(d), 1);
733+
} else if (l < 256) {
734+
unsigned char buf[2];
735+
buf[0] = 0xd9; buf[1] = (uint8_t)l;
736+
msgpack_pack_append_buffer(x, buf, 2);
737737
} else if(l < 65536) {
738738
unsigned char buf[3];
739739
buf[0] = 0xda; _msgpack_store16(&buf[1], (uint16_t)l);

0 commit comments

Comments
 (0)