msgpack 0.3.6-mswin32 → 0.3.7-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/unpack.c +45 -25
- data/lib/1.8/msgpack.so +0 -0
- data/lib/1.9/msgpack.so +0 -0
- data/{ext → lib}/msgpack.rb +0 -0
- data/test/test_helper.rb +1 -1
- metadata +7 -7
- data/ext/1.8/msgpack.so +0 -0
- data/ext/1.9/msgpack.so +0 -0
data/ext/unpack.c
CHANGED
@@ -220,15 +220,18 @@ static VALUE MessagePack_Unpacker_initialize(int argc, VALUE *argv, VALUE self)
|
|
220
220
|
}
|
221
221
|
|
222
222
|
|
223
|
-
static VALUE
|
223
|
+
static VALUE MessagePack_Unpacker_execute_do(VALUE argv)
|
224
224
|
{
|
225
|
-
VALUE
|
226
|
-
VALUE data = ((VALUE*)args)[1];
|
225
|
+
VALUE* args = (VALUE*)argv;
|
227
226
|
|
227
|
+
VALUE self = args[0];
|
228
228
|
UNPACKER(self, mp);
|
229
|
-
|
229
|
+
|
230
|
+
VALUE data = args[1];
|
231
|
+
|
232
|
+
size_t from = (unsigned long)args[2];
|
230
233
|
char* dptr = RSTRING_PTR(data);
|
231
|
-
|
234
|
+
size_t dlen = (unsigned long)args[3];
|
232
235
|
int ret;
|
233
236
|
|
234
237
|
if(from >= dlen) {
|
@@ -236,7 +239,7 @@ static VALUE MessagePack_Unpacker_execute_impl(VALUE args)
|
|
236
239
|
}
|
237
240
|
|
238
241
|
mp->user.source = data;
|
239
|
-
ret = template_execute(mp, dptr,
|
242
|
+
ret = template_execute(mp, dptr, dlen, &from);
|
240
243
|
mp->user.source = Qnil;
|
241
244
|
|
242
245
|
if(ret < 0) {
|
@@ -260,22 +263,32 @@ static VALUE MessagePack_Unpacker_execute_rescue(VALUE nouse)
|
|
260
263
|
#endif
|
261
264
|
}
|
262
265
|
|
263
|
-
static VALUE
|
264
|
-
|
266
|
+
static inline VALUE MessagePack_Unpacker_execute_impl(VALUE self, VALUE data,
|
267
|
+
unsigned long off, unsigned long dlen)
|
265
268
|
{
|
266
269
|
// FIXME execute実行中はmp->topが更新されないのでGC markが機能しない
|
267
270
|
rb_gc_disable();
|
268
|
-
VALUE args[4] = {self, data, off,
|
269
|
-
VALUE ret = rb_rescue(
|
271
|
+
VALUE args[4] = {self, data, (VALUE)off, (VALUE)dlen};
|
272
|
+
VALUE ret = rb_rescue(MessagePack_Unpacker_execute_do, (VALUE)args,
|
270
273
|
MessagePack_Unpacker_execute_rescue, Qnil);
|
271
274
|
rb_gc_enable();
|
275
|
+
|
272
276
|
return ret;
|
273
277
|
}
|
274
278
|
|
279
|
+
static VALUE MessagePack_Unpacker_execute_limit(VALUE self, VALUE data,
|
280
|
+
VALUE off, VALUE limit)
|
281
|
+
{
|
282
|
+
CHECK_STRING_TYPE(data);
|
283
|
+
return MessagePack_Unpacker_execute_impl(self, data,
|
284
|
+
NUM2ULONG(off), NUM2ULONG(limit));
|
285
|
+
}
|
286
|
+
|
275
287
|
static VALUE MessagePack_Unpacker_execute(VALUE self, VALUE data, VALUE off)
|
276
288
|
{
|
277
|
-
|
278
|
-
|
289
|
+
CHECK_STRING_TYPE(data);
|
290
|
+
return MessagePack_Unpacker_execute_impl(self, data,
|
291
|
+
NUM2ULONG(off), RSTRING_LEN(data));
|
279
292
|
}
|
280
293
|
|
281
294
|
static VALUE MessagePack_Unpacker_finished_p(VALUE self)
|
@@ -379,18 +392,20 @@ static VALUE MessagePack_Unpacker_each(VALUE self)
|
|
379
392
|
}
|
380
393
|
|
381
394
|
|
382
|
-
static VALUE
|
395
|
+
static VALUE MessagePack_unpack_do(VALUE argv)
|
383
396
|
{
|
384
|
-
|
385
|
-
|
397
|
+
VALUE* args = (VALUE*)argv;
|
398
|
+
|
399
|
+
msgpack_unpack_t* mp = (msgpack_unpack_t*)args[0];
|
400
|
+
VALUE data = args[1];
|
386
401
|
|
387
402
|
size_t from = 0;
|
388
403
|
char* dptr = RSTRING_PTR(data);
|
389
|
-
|
404
|
+
size_t dlen = (unsigned long)args[2];
|
390
405
|
int ret;
|
391
406
|
|
392
407
|
mp->user.source = data;
|
393
|
-
ret = template_execute(mp, dptr,
|
408
|
+
ret = template_execute(mp, dptr, dlen, &from);
|
394
409
|
mp->user.source = Qnil;
|
395
410
|
|
396
411
|
if(ret < 0) {
|
@@ -405,7 +420,7 @@ static VALUE MessagePack_unpack_impl(VALUE args)
|
|
405
420
|
}
|
406
421
|
}
|
407
422
|
|
408
|
-
static VALUE MessagePack_unpack_rescue(VALUE
|
423
|
+
static VALUE MessagePack_unpack_rescue(VALUE nouse)
|
409
424
|
{
|
410
425
|
rb_gc_enable();
|
411
426
|
#ifdef RUBY_VM
|
@@ -415,29 +430,34 @@ static VALUE MessagePack_unpack_rescue(VALUE args)
|
|
415
430
|
#endif
|
416
431
|
}
|
417
432
|
|
418
|
-
static VALUE
|
433
|
+
static inline VALUE MessagePack_unpack_impl(VALUE self, VALUE data, unsigned long dlen)
|
419
434
|
{
|
420
|
-
CHECK_STRING_TYPE(data);
|
421
|
-
|
422
435
|
msgpack_unpack_t mp;
|
423
436
|
template_init(&mp);
|
424
437
|
init_stack(&mp);
|
425
438
|
unpack_user u = {0, Qnil, 0, 0, Qnil, Qnil, Qnil};
|
426
439
|
mp.user = u;
|
427
440
|
|
441
|
+
// FIXME execute実行中はmp->topが更新されないのでGC markが機能しない
|
428
442
|
rb_gc_disable();
|
429
|
-
VALUE args[3] = {(VALUE)&mp, data,
|
430
|
-
VALUE ret = rb_rescue(
|
443
|
+
VALUE args[3] = {(VALUE)&mp, data, (VALUE)dlen};
|
444
|
+
VALUE ret = rb_rescue(MessagePack_unpack_do, (VALUE)args,
|
431
445
|
MessagePack_unpack_rescue, Qnil);
|
432
446
|
rb_gc_enable();
|
433
447
|
|
434
448
|
return ret;
|
435
449
|
}
|
436
450
|
|
451
|
+
static VALUE MessagePack_unpack_limit(VALUE self, VALUE data, VALUE limit)
|
452
|
+
{
|
453
|
+
CHECK_STRING_TYPE(data);
|
454
|
+
return MessagePack_unpack_impl(self, data, NUM2ULONG(limit));
|
455
|
+
}
|
456
|
+
|
437
457
|
static VALUE MessagePack_unpack(VALUE self, VALUE data)
|
438
458
|
{
|
439
|
-
|
440
|
-
|
459
|
+
CHECK_STRING_TYPE(data);
|
460
|
+
return MessagePack_unpack_impl(self, data, RSTRING_LEN(data));
|
441
461
|
}
|
442
462
|
|
443
463
|
|
data/lib/1.8/msgpack.so
ADDED
Binary file
|
data/lib/1.9/msgpack.so
ADDED
Binary file
|
data/{ext → lib}/msgpack.rb
RENAMED
File without changes
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -4,8 +4,8 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
segments:
|
5
5
|
- 0
|
6
6
|
- 3
|
7
|
-
-
|
8
|
-
version: 0.3.
|
7
|
+
- 7
|
8
|
+
version: 0.3.7
|
9
9
|
platform: mswin32
|
10
10
|
authors:
|
11
11
|
- FURUHASHI Sadayuki
|
@@ -13,7 +13,7 @@ autorequire:
|
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
15
|
|
16
|
-
date: 2010-04-
|
16
|
+
date: 2010-04-06 00:00:00 +09:00
|
17
17
|
default_executable:
|
18
18
|
dependencies: []
|
19
19
|
|
@@ -31,15 +31,15 @@ files:
|
|
31
31
|
- AUTHORS
|
32
32
|
- ChangeLog
|
33
33
|
- README
|
34
|
-
- ext/1.8/msgpack.so
|
35
|
-
- ext/1.9/msgpack.so
|
36
34
|
- ext/extconf.rb
|
37
|
-
- ext/msgpack.rb
|
38
35
|
- ext/pack.c
|
39
36
|
- ext/pack.h
|
40
37
|
- ext/rbinit.c
|
41
38
|
- ext/unpack.c
|
42
39
|
- ext/unpack.h
|
40
|
+
- lib/1.8/msgpack.so
|
41
|
+
- lib/1.9/msgpack.so
|
42
|
+
- lib/msgpack.rb
|
43
43
|
- msgpack/pack_define.h
|
44
44
|
- msgpack/pack_template.h
|
45
45
|
- msgpack/sysdep.h
|
@@ -55,7 +55,7 @@ post_install_message:
|
|
55
55
|
rdoc_options: []
|
56
56
|
|
57
57
|
require_paths:
|
58
|
-
-
|
58
|
+
- lib
|
59
59
|
required_ruby_version: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
61
|
- - ">="
|
data/ext/1.8/msgpack.so
DELETED
Binary file
|
data/ext/1.9/msgpack.so
DELETED
Binary file
|