msgpack 0.6.2-x86-mingw32 → 0.7.0dev1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +33 -0
- data/README.rdoc +2 -6
- data/Rakefile +9 -0
- data/appveyor.yml +18 -0
- data/doclib/msgpack/error.rb +6 -1
- data/doclib/msgpack/extension_value.rb +9 -0
- data/doclib/msgpack/factory.rb +68 -0
- data/doclib/msgpack/packer.rb +38 -0
- data/doclib/msgpack/unpacker.rb +39 -2
- data/ext/java/org/msgpack/jruby/Buffer.java +4 -0
- data/ext/java/org/msgpack/jruby/Decoder.java +44 -0
- data/ext/java/org/msgpack/jruby/Encoder.java +46 -4
- data/ext/java/org/msgpack/jruby/ExtensionValue.java +55 -60
- data/ext/java/org/msgpack/jruby/MessagePackLibrary.java +18 -5
- data/ext/java/org/msgpack/jruby/Packer.java +17 -4
- data/ext/java/org/msgpack/jruby/Unpacker.java +59 -2
- data/ext/msgpack/buffer_class.c +2 -2
- data/ext/msgpack/buffer_class.h +1 -1
- data/ext/msgpack/compat.h +12 -0
- data/ext/msgpack/core_ext.c +15 -0
- data/ext/msgpack/extconf.rb +4 -1
- data/ext/msgpack/extension_value_class.c +34 -0
- data/ext/msgpack/extension_value_class.h +31 -0
- data/ext/msgpack/factory_class.c +213 -0
- data/ext/msgpack/factory_class.h +35 -0
- data/ext/msgpack/packer.c +14 -7
- data/ext/msgpack/packer.h +46 -8
- data/ext/msgpack/packer_class.c +92 -45
- data/ext/msgpack/packer_class.h +4 -2
- data/ext/msgpack/packer_ext_registry.c +87 -0
- data/ext/msgpack/packer_ext_registry.h +101 -0
- data/ext/msgpack/rbinit.c +4 -0
- data/ext/msgpack/unpacker.c +128 -23
- data/ext/msgpack/unpacker.h +11 -0
- data/ext/msgpack/unpacker_class.c +117 -38
- data/ext/msgpack/unpacker_class.h +4 -2
- data/ext/msgpack/unpacker_ext_registry.c +68 -0
- data/ext/msgpack/unpacker_ext_registry.h +62 -0
- data/lib/msgpack.rb +4 -0
- data/lib/msgpack/factory.rb +60 -0
- data/lib/msgpack/packer.rb +28 -0
- data/lib/msgpack/unpacker.rb +28 -0
- data/lib/msgpack/version.rb +1 -1
- data/msgpack.gemspec +4 -3
- data/spec/cruby/buffer_io_spec.rb +2 -3
- data/spec/cruby/buffer_spec.rb +1 -3
- data/spec/cruby/unpacker_spec.rb +14 -2
- data/spec/ext_value_spec.rb +99 -0
- data/spec/exttypes.rb +51 -0
- data/spec/factory_spec.rb +236 -0
- data/spec/jruby/msgpack/unpacker_spec.rb +25 -0
- data/spec/{jruby/msgpack_spec.rb → msgpack_spec.rb} +1 -1
- data/spec/pack_spec.rb +0 -6
- data/spec/packer_spec.rb +95 -0
- data/spec/spec_helper.rb +12 -1
- data/spec/unpack_spec.rb +1 -4
- data/spec/unpacker_spec.rb +133 -0
- metadata +50 -15
- data/Dockerfile +0 -55
data/ext/msgpack/packer_class.h
CHANGED
@@ -24,9 +24,11 @@ extern VALUE cMessagePack_Packer;
|
|
24
24
|
|
25
25
|
void MessagePack_Packer_module_init(VALUE mMessagePack);
|
26
26
|
|
27
|
-
VALUE
|
27
|
+
VALUE MessagePack_Packer_alloc(VALUE klass);
|
28
|
+
|
29
|
+
VALUE MessagePack_Packer_initialize(int argc, VALUE* argv, VALUE self);
|
28
30
|
|
29
|
-
|
31
|
+
VALUE MessagePack_pack(int argc, VALUE* argv);
|
30
32
|
|
31
33
|
#endif
|
32
34
|
|
@@ -0,0 +1,87 @@
|
|
1
|
+
/*
|
2
|
+
* MessagePack for Ruby
|
3
|
+
*
|
4
|
+
* Copyright (C) 2008-2015 Sadayuki Furuhashi
|
5
|
+
*
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
* you may not use this file except in compliance with the License.
|
8
|
+
* You may obtain a copy of the License at
|
9
|
+
*
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
*
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
* See the License for the specific language governing permissions and
|
16
|
+
* limitations under the License.
|
17
|
+
*/
|
18
|
+
|
19
|
+
#include "packer_ext_registry.h"
|
20
|
+
|
21
|
+
static ID s_call;
|
22
|
+
|
23
|
+
void msgpack_packer_ext_registry_static_init()
|
24
|
+
{
|
25
|
+
s_call = rb_intern("call");
|
26
|
+
}
|
27
|
+
|
28
|
+
void msgpack_packer_ext_registry_static_destroy()
|
29
|
+
{ }
|
30
|
+
|
31
|
+
void msgpack_packer_ext_registry_init(msgpack_packer_ext_registry_t* pkrg)
|
32
|
+
{
|
33
|
+
pkrg->hash = rb_hash_new();
|
34
|
+
pkrg->cache = rb_hash_new();
|
35
|
+
}
|
36
|
+
|
37
|
+
void msgpack_packer_ext_registry_mark(msgpack_packer_ext_registry_t* pkrg)
|
38
|
+
{
|
39
|
+
rb_gc_mark(pkrg->hash);
|
40
|
+
rb_gc_mark(pkrg->cache);
|
41
|
+
}
|
42
|
+
|
43
|
+
void msgpack_packer_ext_registry_dup(msgpack_packer_ext_registry_t* src,
|
44
|
+
msgpack_packer_ext_registry_t* dst)
|
45
|
+
{
|
46
|
+
#ifdef HAVE_RB_HASH_DUP
|
47
|
+
dst->hash = rb_hash_dup(src->hash);
|
48
|
+
dst->cache = rb_hash_dup(src->cache);
|
49
|
+
#else
|
50
|
+
dst->hash = rb_funcall(src->hash, rb_intern("dup"), 0);
|
51
|
+
dst->cache = rb_funcall(src->cache, rb_intern("dup"), 0);
|
52
|
+
#endif
|
53
|
+
}
|
54
|
+
|
55
|
+
#ifndef HAVE_RB_HASH_CLEAR
|
56
|
+
|
57
|
+
static int
|
58
|
+
__rb_hash_clear_clear_i(key, value, dummy)
|
59
|
+
VALUE key, value, dummy;
|
60
|
+
{
|
61
|
+
return ST_DELETE;
|
62
|
+
}
|
63
|
+
|
64
|
+
#endif
|
65
|
+
|
66
|
+
VALUE msgpack_packer_ext_registry_put(msgpack_packer_ext_registry_t* pkrg,
|
67
|
+
VALUE ext_class, int ext_type, VALUE proc, VALUE arg)
|
68
|
+
{
|
69
|
+
VALUE e = rb_ary_new3(3, INT2FIX(ext_type), proc, arg);
|
70
|
+
/* clear lookup cache not to miss added type */
|
71
|
+
#ifdef HAVE_RB_HASH_CLEAR
|
72
|
+
rb_hash_clear(pkrg->cache);
|
73
|
+
#else
|
74
|
+
if(FIX2INT(rb_funcall(pkrg->cache, rb_intern("size"), 0)) > 0) {
|
75
|
+
rb_hash_foreach(pkrg->cache, __rb_hash_clear_clear_i, 0);
|
76
|
+
}
|
77
|
+
#endif
|
78
|
+
return rb_hash_aset(pkrg->hash, ext_class, e);
|
79
|
+
}
|
80
|
+
|
81
|
+
VALUE msgpack_packer_ext_registry_call(msgpack_packer_ext_registry_t* pkrg,
|
82
|
+
VALUE proc, VALUE ext_value)
|
83
|
+
{
|
84
|
+
VALUE string = rb_funcall(proc, s_call, 1, ext_value);
|
85
|
+
StringValue(string);
|
86
|
+
return string;
|
87
|
+
}
|
@@ -0,0 +1,101 @@
|
|
1
|
+
/*
|
2
|
+
* MessagePack for Ruby
|
3
|
+
*
|
4
|
+
* Copyright (C) 2008-2015 Sadayuki Furuhashi
|
5
|
+
*
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
* you may not use this file except in compliance with the License.
|
8
|
+
* You may obtain a copy of the License at
|
9
|
+
*
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
*
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
* See the License for the specific language governing permissions and
|
16
|
+
* limitations under the License.
|
17
|
+
*/
|
18
|
+
#ifndef MSGPACK_RUBY_UNPACKER_PACKER_EXT_REGISTRY_H__
|
19
|
+
#define MSGPACK_RUBY_UNPACKER_PACKER_EXT_REGISTRY_H__
|
20
|
+
|
21
|
+
#include "compat.h"
|
22
|
+
#include "ruby.h"
|
23
|
+
|
24
|
+
struct msgpack_packer_ext_registry_t;
|
25
|
+
typedef struct msgpack_packer_ext_registry_t msgpack_packer_ext_registry_t;
|
26
|
+
|
27
|
+
struct msgpack_packer_ext_registry_t {
|
28
|
+
VALUE hash;
|
29
|
+
/*
|
30
|
+
* lookup cache for subclasses of registered classes
|
31
|
+
*/
|
32
|
+
VALUE cache;
|
33
|
+
};
|
34
|
+
|
35
|
+
void msgpack_packer_ext_registry_static_init();
|
36
|
+
|
37
|
+
void msgpack_packer_ext_registry_static_destroy();
|
38
|
+
|
39
|
+
void msgpack_packer_ext_registry_init(msgpack_packer_ext_registry_t* pkrg);
|
40
|
+
|
41
|
+
static inline void msgpack_packer_ext_registry_destroy(msgpack_packer_ext_registry_t* pkrg)
|
42
|
+
{ }
|
43
|
+
|
44
|
+
void msgpack_packer_ext_registry_mark(msgpack_packer_ext_registry_t* pkrg);
|
45
|
+
|
46
|
+
void msgpack_packer_ext_registry_dup(msgpack_packer_ext_registry_t* src,
|
47
|
+
msgpack_packer_ext_registry_t* dst);
|
48
|
+
|
49
|
+
VALUE msgpack_packer_ext_registry_put(msgpack_packer_ext_registry_t* pkrg,
|
50
|
+
VALUE ext_class, int ext_type, VALUE proc, VALUE arg);
|
51
|
+
|
52
|
+
static int msgpack_packer_ext_find_inherited(VALUE key, VALUE value, VALUE arg)
|
53
|
+
{
|
54
|
+
VALUE *args = (VALUE *) arg;
|
55
|
+
if(key == Qundef) {
|
56
|
+
return ST_CONTINUE;
|
57
|
+
}
|
58
|
+
if(rb_class_inherited_p(args[0], key) == Qtrue) {
|
59
|
+
args[1] = key;
|
60
|
+
return ST_STOP;
|
61
|
+
}
|
62
|
+
return ST_CONTINUE;
|
63
|
+
}
|
64
|
+
|
65
|
+
|
66
|
+
static inline VALUE msgpack_packer_ext_registry_lookup(msgpack_packer_ext_registry_t* pkrg,
|
67
|
+
VALUE ext_class, int* ext_type_result)
|
68
|
+
{
|
69
|
+
VALUE e = rb_hash_lookup(pkrg->hash, ext_class);
|
70
|
+
if(e != Qnil) {
|
71
|
+
*ext_type_result = FIX2INT(rb_ary_entry(e, 0));
|
72
|
+
return rb_ary_entry(e, 1);
|
73
|
+
}
|
74
|
+
|
75
|
+
VALUE c = rb_hash_lookup(pkrg->cache, ext_class);
|
76
|
+
if(c != Qnil) {
|
77
|
+
*ext_type_result = FIX2INT(rb_ary_entry(c, 0));
|
78
|
+
return rb_ary_entry(c, 1);
|
79
|
+
}
|
80
|
+
|
81
|
+
/*
|
82
|
+
* check all keys whether it is super class of ext_class, or not
|
83
|
+
*/
|
84
|
+
VALUE args[2];
|
85
|
+
args[0] = ext_class;
|
86
|
+
args[1] = Qnil;
|
87
|
+
rb_hash_foreach(pkrg->hash, msgpack_packer_ext_find_inherited, (VALUE) args);
|
88
|
+
|
89
|
+
VALUE hit = args[1];
|
90
|
+
if(hit != Qnil) {
|
91
|
+
rb_hash_aset(pkrg->cache, ext_class, hit);
|
92
|
+
return hit;
|
93
|
+
}
|
94
|
+
|
95
|
+
return Qnil;
|
96
|
+
}
|
97
|
+
|
98
|
+
VALUE msgpack_packer_ext_registry_call(msgpack_packer_ext_registry_t* pkrg,
|
99
|
+
VALUE proc, VALUE ext_value);
|
100
|
+
|
101
|
+
#endif
|
data/ext/msgpack/rbinit.c
CHANGED
@@ -19,6 +19,8 @@
|
|
19
19
|
#include "buffer_class.h"
|
20
20
|
#include "packer_class.h"
|
21
21
|
#include "unpacker_class.h"
|
22
|
+
#include "factory_class.h"
|
23
|
+
#include "extension_value_class.h"
|
22
24
|
#include "core_ext.h"
|
23
25
|
|
24
26
|
void Init_msgpack(void)
|
@@ -28,6 +30,8 @@ void Init_msgpack(void)
|
|
28
30
|
MessagePack_Buffer_module_init(mMessagePack);
|
29
31
|
MessagePack_Packer_module_init(mMessagePack);
|
30
32
|
MessagePack_Unpacker_module_init(mMessagePack);
|
33
|
+
MessagePack_Factory_module_init(mMessagePack);
|
34
|
+
MessagePack_ExtensionValue_module_init(mMessagePack);
|
31
35
|
MessagePack_core_ext_module_init();
|
32
36
|
}
|
33
37
|
|
data/ext/msgpack/unpacker.c
CHANGED
@@ -18,12 +18,18 @@
|
|
18
18
|
|
19
19
|
#include "unpacker.h"
|
20
20
|
#include "rmem.h"
|
21
|
+
#include "extension_value_class.h"
|
21
22
|
|
22
23
|
#if !defined(DISABLE_RMEM) && !defined(DISABLE_UNPACKER_STACK_RMEM) && \
|
23
24
|
MSGPACK_UNPACKER_STACK_CAPACITY * MSGPACK_UNPACKER_STACK_SIZE <= MSGPACK_RMEM_PAGE_SIZE
|
24
25
|
#define UNPACKER_STACK_RMEM
|
25
26
|
#endif
|
26
27
|
|
28
|
+
static int RAW_TYPE_STRING = 256;
|
29
|
+
static int RAW_TYPE_BINARY = 257;
|
30
|
+
|
31
|
+
static ID s_call;
|
32
|
+
|
27
33
|
#ifdef UNPACKER_STACK_RMEM
|
28
34
|
static msgpack_rmem_t s_stack_rmem;
|
29
35
|
#endif
|
@@ -33,6 +39,8 @@ void msgpack_unpacker_static_init()
|
|
33
39
|
#ifdef UNPACKER_STACK_RMEM
|
34
40
|
msgpack_rmem_init(&s_stack_rmem);
|
35
41
|
#endif
|
42
|
+
|
43
|
+
s_call = rb_intern("call");
|
36
44
|
}
|
37
45
|
|
38
46
|
void msgpack_unpacker_static_destroy()
|
@@ -150,12 +158,31 @@ static inline int object_complete_string(msgpack_unpacker_t* uk, VALUE str)
|
|
150
158
|
static inline int object_complete_binary(msgpack_unpacker_t* uk, VALUE str)
|
151
159
|
{
|
152
160
|
#ifdef COMPAT_HAVE_ENCODING
|
153
|
-
// TODO ruby 2.0 has String#b method
|
154
161
|
ENCODING_SET(str, msgpack_rb_encindex_ascii8bit);
|
155
162
|
#endif
|
156
163
|
return object_complete(uk, str);
|
157
164
|
}
|
158
165
|
|
166
|
+
static inline int object_complete_ext(msgpack_unpacker_t* uk, int ext_type, VALUE str)
|
167
|
+
{
|
168
|
+
#ifdef COMPAT_HAVE_ENCODING
|
169
|
+
ENCODING_SET(str, msgpack_rb_encindex_ascii8bit);
|
170
|
+
#endif
|
171
|
+
|
172
|
+
VALUE proc = msgpack_unpacker_ext_registry_lookup(&uk->ext_registry, ext_type);
|
173
|
+
if(proc != Qnil) {
|
174
|
+
VALUE obj = rb_funcall(proc, s_call, 1, str);
|
175
|
+
return object_complete(uk, obj);
|
176
|
+
}
|
177
|
+
|
178
|
+
if(uk->allow_unknown_ext) {
|
179
|
+
VALUE obj = MessagePack_ExtensionValue_new(ext_type, str);
|
180
|
+
return object_complete(uk, obj);
|
181
|
+
}
|
182
|
+
|
183
|
+
return PRIMITIVE_UNEXPECTED_EXT_TYPE;
|
184
|
+
}
|
185
|
+
|
159
186
|
/* stack funcs */
|
160
187
|
static inline msgpack_unpacker_stack_t* _msgpack_unpacker_stack_top(msgpack_unpacker_t* uk)
|
161
188
|
{
|
@@ -242,12 +269,19 @@ static int read_raw_body_cont(msgpack_unpacker_t* uk)
|
|
242
269
|
uk->reading_raw_remaining = length = length - n;
|
243
270
|
} while(length > 0);
|
244
271
|
|
245
|
-
|
272
|
+
int ret;
|
273
|
+
if(uk->reading_raw_type == RAW_TYPE_STRING) {
|
274
|
+
ret = object_complete_string(uk, uk->reading_raw);
|
275
|
+
} else if(uk->reading_raw_type == RAW_TYPE_BINARY) {
|
276
|
+
ret = object_complete_binary(uk, uk->reading_raw);
|
277
|
+
} else {
|
278
|
+
ret = object_complete_ext(uk, uk->reading_raw_type, uk->reading_raw);
|
279
|
+
}
|
246
280
|
uk->reading_raw = Qnil;
|
247
|
-
return
|
281
|
+
return ret;
|
248
282
|
}
|
249
283
|
|
250
|
-
static inline int read_raw_body_begin(msgpack_unpacker_t* uk,
|
284
|
+
static inline int read_raw_body_begin(msgpack_unpacker_t* uk, int raw_type)
|
251
285
|
{
|
252
286
|
/* assuming uk->reading_raw == Qnil */
|
253
287
|
|
@@ -258,18 +292,22 @@ static inline int read_raw_body_begin(msgpack_unpacker_t* uk, bool str)
|
|
258
292
|
* because rb_hash_aset freezes keys and it causes copying */
|
259
293
|
bool will_freeze = is_reading_map_key(uk);
|
260
294
|
VALUE string = msgpack_buffer_read_top_as_string(UNPACKER_BUFFER_(uk), length, will_freeze);
|
261
|
-
|
262
|
-
|
295
|
+
int ret;
|
296
|
+
if(raw_type == RAW_TYPE_STRING) {
|
297
|
+
ret = object_complete_string(uk, string);
|
298
|
+
} else if(raw_type == RAW_TYPE_BINARY) {
|
299
|
+
ret = object_complete_binary(uk, string);
|
263
300
|
} else {
|
264
|
-
|
301
|
+
ret = object_complete_ext(uk, raw_type, string);
|
265
302
|
}
|
266
303
|
if(will_freeze) {
|
267
304
|
rb_obj_freeze(string);
|
268
305
|
}
|
269
306
|
uk->reading_raw_remaining = 0;
|
270
|
-
return
|
307
|
+
return ret;
|
271
308
|
}
|
272
309
|
|
310
|
+
uk->reading_raw_type = raw_type;
|
273
311
|
return read_raw_body_cont(uk);
|
274
312
|
}
|
275
313
|
|
@@ -298,7 +336,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
298
336
|
}
|
299
337
|
/* read_raw_body_begin sets uk->reading_raw */
|
300
338
|
uk->reading_raw_remaining = count;
|
301
|
-
return read_raw_body_begin(uk,
|
339
|
+
return read_raw_body_begin(uk, RAW_TYPE_STRING);
|
302
340
|
|
303
341
|
SWITCH_RANGE(b, 0x90, 0x9f) // FixArray
|
304
342
|
int count = b & 0x0f;
|
@@ -327,9 +365,41 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
327
365
|
case 0xc3: // true
|
328
366
|
return object_complete(uk, Qtrue);
|
329
367
|
|
330
|
-
|
331
|
-
|
332
|
-
|
368
|
+
case 0xc7: // ext 8
|
369
|
+
{
|
370
|
+
READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 2);
|
371
|
+
uint8_t length = cb->u8;
|
372
|
+
int ext_type = cb->buffer[1];
|
373
|
+
if(length == 0) {
|
374
|
+
return object_complete_ext(uk, ext_type, rb_str_buf_new(0));
|
375
|
+
}
|
376
|
+
uk->reading_raw_remaining = length;
|
377
|
+
return read_raw_body_begin(uk, ext_type);
|
378
|
+
}
|
379
|
+
|
380
|
+
case 0xc8: // ext 16
|
381
|
+
{
|
382
|
+
READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 3);
|
383
|
+
uint16_t length = cb->u16;
|
384
|
+
int ext_type = cb->buffer[2];
|
385
|
+
if(length == 0) {
|
386
|
+
return object_complete_ext(uk, ext_type, rb_str_buf_new(0));
|
387
|
+
}
|
388
|
+
uk->reading_raw_remaining = length;
|
389
|
+
return read_raw_body_begin(uk, ext_type);
|
390
|
+
}
|
391
|
+
|
392
|
+
case 0xc9: // ext 32
|
393
|
+
{
|
394
|
+
READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 5);
|
395
|
+
uint32_t length = cb->u32;
|
396
|
+
int ext_type = cb->buffer[4];
|
397
|
+
if(length == 0) {
|
398
|
+
return object_complete_ext(uk, ext_type, rb_str_buf_new(0));
|
399
|
+
}
|
400
|
+
uk->reading_raw_remaining = length;
|
401
|
+
return read_raw_body_begin(uk, ext_type);
|
402
|
+
}
|
333
403
|
|
334
404
|
case 0xca: // float
|
335
405
|
{
|
@@ -401,11 +471,46 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
401
471
|
return object_complete(uk, rb_ll2inum(i64));
|
402
472
|
}
|
403
473
|
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
474
|
+
case 0xd4: // fixext 1
|
475
|
+
{
|
476
|
+
READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 1);
|
477
|
+
int ext_type = cb->i8;
|
478
|
+
uk->reading_raw_remaining = 1;
|
479
|
+
return read_raw_body_begin(uk, ext_type);
|
480
|
+
}
|
481
|
+
|
482
|
+
case 0xd5: // fixext 2
|
483
|
+
{
|
484
|
+
READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 1);
|
485
|
+
int ext_type = cb->i8;
|
486
|
+
uk->reading_raw_remaining = 2;
|
487
|
+
return read_raw_body_begin(uk, ext_type);
|
488
|
+
}
|
489
|
+
|
490
|
+
case 0xd6: // fixext 4
|
491
|
+
{
|
492
|
+
READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 1);
|
493
|
+
int ext_type = cb->i8;
|
494
|
+
uk->reading_raw_remaining = 4;
|
495
|
+
return read_raw_body_begin(uk, ext_type);
|
496
|
+
}
|
497
|
+
|
498
|
+
case 0xd7: // fixext 8
|
499
|
+
{
|
500
|
+
READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 1);
|
501
|
+
int ext_type = cb->i8;
|
502
|
+
uk->reading_raw_remaining = 8;
|
503
|
+
return read_raw_body_begin(uk, ext_type);
|
504
|
+
}
|
505
|
+
|
506
|
+
case 0xd8: // fixext 16
|
507
|
+
{
|
508
|
+
READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 1);
|
509
|
+
int ext_type = cb->i8;
|
510
|
+
uk->reading_raw_remaining = 16;
|
511
|
+
return read_raw_body_begin(uk, ext_type);
|
512
|
+
}
|
513
|
+
|
409
514
|
|
410
515
|
case 0xd9: // raw 8 / str 8
|
411
516
|
{
|
@@ -416,7 +521,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
416
521
|
}
|
417
522
|
/* read_raw_body_begin sets uk->reading_raw */
|
418
523
|
uk->reading_raw_remaining = count;
|
419
|
-
return read_raw_body_begin(uk,
|
524
|
+
return read_raw_body_begin(uk, RAW_TYPE_STRING);
|
420
525
|
}
|
421
526
|
|
422
527
|
case 0xda: // raw 16 / str 16
|
@@ -428,7 +533,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
428
533
|
}
|
429
534
|
/* read_raw_body_begin sets uk->reading_raw */
|
430
535
|
uk->reading_raw_remaining = count;
|
431
|
-
return read_raw_body_begin(uk,
|
536
|
+
return read_raw_body_begin(uk, RAW_TYPE_STRING);
|
432
537
|
}
|
433
538
|
|
434
539
|
case 0xdb: // raw 32 / str 32
|
@@ -440,7 +545,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
440
545
|
}
|
441
546
|
/* read_raw_body_begin sets uk->reading_raw */
|
442
547
|
uk->reading_raw_remaining = count;
|
443
|
-
return read_raw_body_begin(uk,
|
548
|
+
return read_raw_body_begin(uk, RAW_TYPE_STRING);
|
444
549
|
}
|
445
550
|
|
446
551
|
case 0xc4: // bin 8
|
@@ -452,7 +557,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
452
557
|
}
|
453
558
|
/* read_raw_body_begin sets uk->reading_raw */
|
454
559
|
uk->reading_raw_remaining = count;
|
455
|
-
return read_raw_body_begin(uk,
|
560
|
+
return read_raw_body_begin(uk, RAW_TYPE_BINARY);
|
456
561
|
}
|
457
562
|
|
458
563
|
case 0xc5: // bin 16
|
@@ -464,7 +569,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
464
569
|
}
|
465
570
|
/* read_raw_body_begin sets uk->reading_raw */
|
466
571
|
uk->reading_raw_remaining = count;
|
467
|
-
return read_raw_body_begin(uk,
|
572
|
+
return read_raw_body_begin(uk, RAW_TYPE_BINARY);
|
468
573
|
}
|
469
574
|
|
470
575
|
case 0xc6: // bin 32
|
@@ -476,7 +581,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
476
581
|
}
|
477
582
|
/* read_raw_body_begin sets uk->reading_raw */
|
478
583
|
uk->reading_raw_remaining = count;
|
479
|
-
return read_raw_body_begin(uk,
|
584
|
+
return read_raw_body_begin(uk, RAW_TYPE_BINARY);
|
480
585
|
}
|
481
586
|
|
482
587
|
case 0xdc: // array 16
|