diff --git a/msgpack.codec.js b/msgpack.codec.js index cd8ab88..de878fd 100644 --- a/msgpack.codec.js +++ b/msgpack.codec.js @@ -343,18 +343,7 @@ function decode() { // @return Mix: case 0xde: num += (buf[++_idx] << 8) + buf[++_idx]; case 0x80: hash = {}; while (num--) { - // make key/value pair - size = buf[++_idx] - 0xa0; - - for (ary = [], i = _idx, iz = i + size; i < iz; ) { - c = buf[++i]; // lead byte - ary.push(c < 0x80 ? c : // ASCII(0x00 ~ 0x7f) - c < 0xe0 ? ((c & 0x1f) << 6 | (buf[++i] & 0x3f)) : - ((c & 0x0f) << 12 | (buf[++i] & 0x3f) << 6 - | (buf[++i] & 0x3f))); - } - _idx = i; - hash[_toString.apply(null, ary)] = decode(); + hash[decode()] = decode(); } return hash; // 0xdd: array32, 0xdc: array16, 0x90: array diff --git a/msgpack.js b/msgpack.js index 46ed0cb..5947574 100644 --- a/msgpack.js +++ b/msgpack.js @@ -358,18 +358,7 @@ function decode() { // @return Mix: case 0xde: num += (buf[++_idx] << 8) + buf[++_idx]; case 0x80: hash = {}; while (num--) { - // make key/value pair - size = buf[++_idx] - 0xa0; - - for (ary = [], i = _idx, iz = i + size; i < iz; ) { - c = buf[++i]; // lead byte - ary.push(c < 0x80 ? c : // ASCII(0x00 ~ 0x7f) - c < 0xe0 ? ((c & 0x1f) << 6 | (buf[++i] & 0x3f)) : - ((c & 0x0f) << 12 | (buf[++i] & 0x3f) << 6 - | (buf[++i] & 0x3f))); - } - _idx = i; - hash[_toString.apply(null, ary)] = decode(); + hash[decode()] = decode(); } return hash; // 0xdd: array32, 0xdc: array16, 0x90: array