msgpack 0.5.5-x86-mingw32 → 0.5.7-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA512:
3
+ data.tar.gz: d63d462c8ef2528eabc912b74929c88257bf29abf05486550138e5438fa5ebdd65f6310f48c6f01074ba0ca9e0764cbb3770be3221353e9bcf88288a13d29bfd
4
+ metadata.gz: 43d088ada9f7b4d4a06542011ed8b7f48d38bc375964f4b00427e1d5892f39d75d73d54cc00b2a500c91231534b028e8e0b131174564079038324d123200062d
5
+ SHA1:
6
+ data.tar.gz: 54d42d357f4519db1d77571ff573ab26690b52a1
7
+ metadata.gz: 6e126ffc9f166607c9d1513cb25197da0ba18ba9
data/ChangeLog CHANGED
@@ -1,4 +1,16 @@
1
1
 
2
+ 2013-10-12 version 0.5.7:
3
+
4
+ * Added deserialization support for the new MessagePack spec
5
+
6
+
7
+ 2013-09-23 version 0.5.6:
8
+
9
+ * Fixed "can't modify frozen String" exception in Unpacker with ruby 2.1.0-dev
10
+ * Getting work with Ruby v2.0 on Windows (Thank you @thegreendroid)
11
+ * Fixed EOFError handling in Unpacker
12
+
13
+
2
14
  2013-05-12 version 0.5.5:
3
15
 
4
16
  * Fixed SEGV problem in to_msgpack
@@ -17,6 +17,12 @@ Use RubyGems to install:
17
17
 
18
18
  gem install msgpack
19
19
 
20
+ or build msgpack-ruby and install:
21
+
22
+ bundle
23
+ rake
24
+ gem install --local pkg/msgpack
25
+
20
26
 
21
27
  = Use cases
22
28
 
@@ -93,10 +99,30 @@ MessagePack for Ruby provides a buffer API so that you can read or write data by
93
99
  This {MessagePack::Buffer}[http://ruby.msgpack.org/MessagePack/Buffer.html] is backed with a fixed-length shared memory pool which is very fast for small data (<= 4KB),
94
100
  and has zero-copy capability which significantly affects performance to handle large binary data.
95
101
 
102
+ = How to build and run tests
103
+
104
+ Before building msgpack, you need to install bundler and dependencies.
105
+
106
+ gem install bundler
107
+ bundle install
108
+
109
+ Then, you can run the tasks as follows:
110
+
111
+ * Build
112
+
113
+ bundle exec rake build
114
+
115
+ * Run tests
116
+
117
+ bundle exec rake spec
118
+
119
+ * Generating docs
120
+
121
+ bundle exec rake doc
96
122
 
97
123
  = Copyright
98
124
 
99
- Author:: FURUHASHI Sadayuki <frsyuki@gmail.com>
100
- Copyright:: Copyright (c) 2008-2012 FURUHASHI Sadayuki
125
+ Author:: Sadayuki Furuhashi <frsyuki@gmail.com>
126
+ Copyright:: Copyright (c) 2008-2013 Sadayuki Furuhashi
101
127
  License:: Apache License, Version 2.0
102
128
 
data/Rakefile CHANGED
@@ -61,8 +61,9 @@ task :default => :build
61
61
  ## Ubuntu Ubuntu 10.04.1 LTS
62
62
  ##
63
63
  #
64
- ### install mingw32 cross compiler
64
+ ### install mingw32 cross compiler with w64 support
65
65
  # sudo apt-get install gcc-mingw32
66
+ # sudo apt-get install mingw-w64
66
67
  #
67
68
  ### install rbenv
68
69
  # git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
@@ -71,23 +72,30 @@ task :default => :build
71
72
  # exec $SHELL -l
72
73
  #
73
74
  ### install cross-compiled ruby 2.0.0
74
- # rbenv install 2.0.0-p0
75
+ # rbenv install 2.0.0-p247
76
+ # rbenv shell 2.0.0-p247
77
+ # gem update --system
75
78
  # gem install rake-compiler
76
- # rake-compiler cross-ruby VERSION=2.0.0-p0
79
+ # rake-compiler cross-ruby VERSION=2.0.0-p247
77
80
  #
78
81
  ### install cross-compiled ruby 1.9.3
79
82
  # rbenv install 1.9.3-p327
83
+ # rbenv shell 1.9.3-p327
84
+ # gem update --system
80
85
  # gem install rake-compiler
81
86
  # rake-compiler cross-ruby VERSION=1.9.3-p327
82
87
  #
83
88
  ### install cross-compiled ruby 1.8.7
84
- # rbenv install 1.8.7-p371
89
+ # rbenv install 1.8.7-p374
90
+ # rbenv shell 1.8.7-p374
91
+ # gem update --system
85
92
  # gem install rake-compiler
86
- # rake-compiler cross-ruby VERSION=1.8.7-p371
93
+ # rake-compiler cross-ruby VERSION=1.8.7-p374
87
94
  #
88
95
  ### build gem
89
- # rbenv shell 1.8.7-p371
90
- # gem install bundler && bundle
96
+ # rbenv shell 1.8.7-p374
97
+ # gem install bundler
98
+ # bundle
91
99
  # rake cross native gem RUBY_CC_VERSION=1.8.7:1.9.3:2.0.0
92
100
  #
93
101
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * MessagePack for Ruby
3
3
  *
4
- * Copyright (C) 2008-2012 FURUHASHI Sadayuki
4
+ * Copyright (C) 2008-2013 Sadayuki Furuhashi
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -165,6 +165,8 @@ size_t msgpack_buffer_read_to_string_nonblock(msgpack_buffer_t* b, VALUE string,
165
165
  #else
166
166
  rb_str_replace(string, s);
167
167
  #endif
168
+ /* here doesn't have to call ENCODING_SET because
169
+ * encoding of s is always ASCII-8BIT */
168
170
  _msgpack_buffer_consumed(b, length);
169
171
  return length;
170
172
  }
@@ -307,8 +309,8 @@ static inline void _msgpack_buffer_append_reference(msgpack_buffer_t* b, VALUE s
307
309
 
308
310
  _msgpack_buffer_add_new_chunk(b);
309
311
 
310
- char* data = RSTRING_PTR(string);
311
- size_t length = RSTRING_LEN(string);
312
+ char* data = RSTRING_PTR(mapped_string);
313
+ size_t length = RSTRING_LEN(mapped_string);
312
314
 
313
315
  b->tail.first = (char*) data;
314
316
  b->tail.last = (char*) data + length;
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * MessagePack for Ruby
3
3
  *
4
- * Copyright (C) 2008-2012 FURUHASHI Sadayuki
4
+ * Copyright (C) 2008-2013 Sadayuki Furuhashi
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -418,11 +418,11 @@ static inline VALUE _msgpack_buffer_refer_head_mapped_string(msgpack_buffer_t* b
418
418
  return rb_str_substr(b->head->mapped_string, offset, length);
419
419
  }
420
420
 
421
- static inline VALUE msgpack_buffer_read_top_as_string(msgpack_buffer_t* b, size_t length, bool frozen)
421
+ static inline VALUE msgpack_buffer_read_top_as_string(msgpack_buffer_t* b, size_t length, bool will_be_frozen)
422
422
  {
423
423
  #ifndef DISABLE_BUFFER_READ_REFERENCE_OPTIMIZE
424
424
  /* optimize */
425
- if(!frozen &&
425
+ if(!will_be_frozen &&
426
426
  b->head->mapped_string != NO_MAPPED_STRING &&
427
427
  length >= b->read_reference_threshold) {
428
428
  VALUE result = _msgpack_buffer_refer_head_mapped_string(b, length);
@@ -432,9 +432,6 @@ static inline VALUE msgpack_buffer_read_top_as_string(msgpack_buffer_t* b, size_
432
432
  #endif
433
433
 
434
434
  VALUE result = rb_str_new(b->read_buffer, length);
435
- if(frozen) {
436
- rb_obj_freeze(result);
437
- }
438
435
  _msgpack_buffer_consumed(b, length);
439
436
  return result;
440
437
  }
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * MessagePack for Ruby
3
3
  *
4
- * Copyright (C) 2008-2012 FURUHASHI Sadayuki
4
+ * Copyright (C) 2008-2013 Sadayuki Furuhashi
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * MessagePack for Ruby
3
3
  *
4
- * Copyright (C) 2008-2012 FURUHASHI Sadayuki
4
+ * Copyright (C) 2008-2013 Sadayuki Furuhashi
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * MessagePack for Ruby
3
3
  *
4
- * Copyright (C) 2008-2012 FURUHASHI Sadayuki
4
+ * Copyright (C) 2008-2013 Sadayuki Furuhashi
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * MessagePack for Ruby
3
3
  *
4
- * Copyright (C) 2008-2012 FURUHASHI Sadayuki
4
+ * Copyright (C) 2008-2013 Sadayuki Furuhashi
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * MessagePack for Ruby
3
3
  *
4
- * Copyright (C) 2008-2012 FURUHASHI Sadayuki
4
+ * Copyright (C) 2008-2013 Sadayuki Furuhashi
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * MessagePack for Ruby
3
3
  *
4
- * Copyright (C) 2008-2012 FURUHASHI Sadayuki
4
+ * Copyright (C) 2008-2013 Sadayuki Furuhashi
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * MessagePack for Ruby
3
3
  *
4
- * Copyright (C) 2008-2012 FURUHASHI Sadayuki
4
+ * Copyright (C) 2008-2013 Sadayuki Furuhashi
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * MessagePack for Ruby
3
3
  *
4
- * Copyright (C) 2008-2012 FURUHASHI Sadayuki
4
+ * Copyright (C) 2008-2013 Sadayuki Furuhashi
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * MessagePack for Ruby
3
3
  *
4
- * Copyright (C) 2008-2012 FURUHASHI Sadayuki
4
+ * Copyright (C) 2008-2013 Sadayuki Furuhashi
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * MessagePack for Ruby
3
3
  *
4
- * Copyright (C) 2008-2012 FURUHASHI Sadayuki
4
+ * Copyright (C) 2008-2013 Sadayuki Furuhashi
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * MessagePack for Ruby
3
3
  *
4
- * Copyright (C) 2008-2012 FURUHASHI Sadayuki
4
+ * Copyright (C) 2008-2013 Sadayuki Furuhashi
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * MessagePack for Ruby
3
3
  *
4
- * Copyright (C) 2008-2012 FURUHASHI Sadayuki
4
+ * Copyright (C) 2008-2013 Sadayuki Furuhashi
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * MessagePack for Ruby
3
3
  *
4
- * Copyright (C) 2008-2012 FURUHASHI Sadayuki
4
+ * Copyright (C) 2008-2013 Sadayuki Furuhashi
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * MessagePack for Ruby
3
3
  *
4
- * Copyright (C) 2008-2012 FURUHASHI Sadayuki
4
+ * Copyright (C) 2008-2013 Sadayuki Furuhashi
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * MessagePack for Ruby
3
3
  *
4
- * Copyright (C) 2008-2012 FURUHASHI Sadayuki
4
+ * Copyright (C) 2008-2013 Sadayuki Furuhashi
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * MessagePack for Ruby
3
3
  *
4
- * Copyright (C) 2008-2012 FURUHASHI Sadayuki
4
+ * Copyright (C) 2008-2013 Sadayuki Furuhashi
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -50,7 +50,7 @@ void msgpack_unpacker_static_destroy()
50
50
  #endif
51
51
  }
52
52
 
53
- #define HEAD_BYTE_REQUIRED 0xc6
53
+ #define HEAD_BYTE_REQUIRED 0xc1
54
54
 
55
55
  void msgpack_unpacker_init(msgpack_unpacker_t* uk)
56
56
  {
@@ -149,9 +149,8 @@ static inline int object_complete(msgpack_unpacker_t* uk, VALUE object)
149
149
 
150
150
  static inline int object_complete_string(msgpack_unpacker_t* uk, VALUE str)
151
151
  {
152
- // TODO ruby 2.0 has String#b method
153
152
  #ifdef COMPAT_HAVE_ENCODING
154
- //str_modifiable(str);
153
+ // TODO ruby 2.0 has String#b method
155
154
  ENCODING_SET(str, s_enc_utf8);
156
155
  #endif
157
156
  return object_complete(uk, str);
@@ -248,7 +247,7 @@ static int read_raw_body_cont(msgpack_unpacker_t* uk)
248
247
  return PRIMITIVE_OBJECT_COMPLETE;
249
248
  }
250
249
 
251
- static inline int read_raw_body_begin(msgpack_unpacker_t* uk)
250
+ static inline int read_raw_body_begin(msgpack_unpacker_t* uk, bool str)
252
251
  {
253
252
  /* assuming uk->reading_raw == Qnil */
254
253
 
@@ -257,9 +256,12 @@ static inline int read_raw_body_begin(msgpack_unpacker_t* uk)
257
256
  if(length <= msgpack_buffer_top_readable_size(UNPACKER_BUFFER_(uk))) {
258
257
  /* don't use zerocopy for hash keys but get a frozen string directly
259
258
  * because rb_hash_aset freezes keys and it causes copying */
260
- bool frozen = is_reading_map_key(uk);
261
- VALUE string = msgpack_buffer_read_top_as_string(UNPACKER_BUFFER_(uk), length, frozen);
259
+ bool will_freeze = is_reading_map_key(uk);
260
+ VALUE string = msgpack_buffer_read_top_as_string(UNPACKER_BUFFER_(uk), length, will_freeze);
262
261
  object_complete_string(uk, string);
262
+ if(will_freeze) {
263
+ rb_obj_freeze(string);
264
+ }
263
265
  uk->reading_raw_remaining = 0;
264
266
  return PRIMITIVE_OBJECT_COMPLETE;
265
267
  }
@@ -285,14 +287,14 @@ static int read_primitive(msgpack_unpacker_t* uk)
285
287
  SWITCH_RANGE(b, 0xe0, 0xff) // Negative Fixnum
286
288
  return object_complete(uk, INT2NUM((int8_t)b));
287
289
 
288
- SWITCH_RANGE(b, 0xa0, 0xbf) // FixRaw
290
+ SWITCH_RANGE(b, 0xa0, 0xbf) // FixRaw / fixstr
289
291
  int count = b & 0x1f;
290
292
  if(count == 0) {
291
293
  return object_complete_string(uk, rb_str_buf_new(0));
292
294
  }
293
295
  /* read_raw_body_begin sets uk->reading_raw */
294
296
  uk->reading_raw_remaining = count;
295
- return read_raw_body_begin(uk);
297
+ return read_raw_body_begin(uk, true);
296
298
 
297
299
  SWITCH_RANGE(b, 0x90, 0x9f) // FixArray
298
300
  int count = b & 0x0f;
@@ -321,12 +323,9 @@ static int read_primitive(msgpack_unpacker_t* uk)
321
323
  case 0xc3: // true
322
324
  return object_complete(uk, Qtrue);
323
325
 
324
- //case 0xc4:
325
- //case 0xc5:
326
- //case 0xc6:
327
- //case 0xc7:
328
- //case 0xc8:
329
- //case 0xc9:
326
+ //case 0xc7: // ext 8
327
+ //case 0xc8: // ext 16
328
+ //case 0xc9: // ext 32
330
329
 
331
330
  case 0xca: // float
332
331
  {
@@ -398,14 +397,61 @@ static int read_primitive(msgpack_unpacker_t* uk)
398
397
  return object_complete(uk, rb_ll2inum(i64));
399
398
  }
400
399
 
401
- //case 0xd4:
402
- //case 0xd5:
403
- //case 0xd6: // big integer 16
404
- //case 0xd7: // big integer 32
405
- //case 0xd8: // big float 16
406
- //case 0xd9: // big float 32
400
+ //case 0xd4: // fixext 1
401
+ //case 0xd5: // fixext 2
402
+ //case 0xd6: // fixext 4
403
+ //case 0xd7: // fixext 8
404
+ //case 0xd8: // fixext 16
405
+
406
+ case 0xd9: // raw 8 / str 8
407
+ {
408
+ READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 1);
409
+ uint8_t count = cb->u8;
410
+ if(count == 0) {
411
+ return object_complete_string(uk, rb_str_buf_new(0));
412
+ }
413
+ /* read_raw_body_begin sets uk->reading_raw */
414
+ uk->reading_raw_remaining = count;
415
+ return read_raw_body_begin(uk, true);
416
+ }
417
+
418
+ case 0xda: // raw 16 / str 16
419
+ {
420
+ READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 2);
421
+ uint16_t count = _msgpack_be16(cb->u16);
422
+ if(count == 0) {
423
+ return object_complete_string(uk, rb_str_buf_new(0));
424
+ }
425
+ /* read_raw_body_begin sets uk->reading_raw */
426
+ uk->reading_raw_remaining = count;
427
+ return read_raw_body_begin(uk, true);
428
+ }
429
+
430
+ case 0xdb: // raw 32 / str 16
431
+ {
432
+ READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 4);
433
+ uint32_t count = _msgpack_be32(cb->u32);
434
+ if(count == 0) {
435
+ return object_complete_string(uk, rb_str_buf_new(0));
436
+ }
437
+ /* read_raw_body_begin sets uk->reading_raw */
438
+ uk->reading_raw_remaining = count;
439
+ return read_raw_body_begin(uk, true);
440
+ }
441
+
442
+ case 0xc4: // bin 8
443
+ {
444
+ READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 1);
445
+ uint8_t count = cb->u8;
446
+ if(count == 0) {
447
+ return object_complete_string(uk, rb_str_buf_new(0));
448
+ }
449
+ /* read_raw_body_begin sets uk->reading_raw */
450
+ uk->reading_raw_remaining = count;
451
+ return read_raw_body_begin(uk, false);
452
+ }
407
453
 
408
- case 0xda: // raw 16
454
+ case 0xc5: // bin 16
409
455
  {
410
456
  READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 2);
411
457
  uint16_t count = _msgpack_be16(cb->u16);
@@ -414,10 +460,10 @@ static int read_primitive(msgpack_unpacker_t* uk)
414
460
  }
415
461
  /* read_raw_body_begin sets uk->reading_raw */
416
462
  uk->reading_raw_remaining = count;
417
- return read_raw_body_begin(uk);
463
+ return read_raw_body_begin(uk, false);
418
464
  }
419
465
 
420
- case 0xdb: // raw 32
466
+ case 0xc6: // bin 32
421
467
  {
422
468
  READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 4);
423
469
  uint32_t count = _msgpack_be32(cb->u32);
@@ -426,7 +472,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
426
472
  }
427
473
  /* read_raw_body_begin sets uk->reading_raw */
428
474
  uk->reading_raw_remaining = count;
429
- return read_raw_body_begin(uk);
475
+ return read_raw_body_begin(uk, false);
430
476
  }
431
477
 
432
478
  case 0xdc: // array 16
@@ -662,8 +708,14 @@ int msgpack_unpacker_peek_next_object_type(msgpack_unpacker_t* uk)
662
708
  case 0xd3: // signed int 64
663
709
  return TYPE_INTEGER;
664
710
 
665
- case 0xda: // raw 16
666
- case 0xdb: // raw 32
711
+ case 0xd9: // raw 8 / str 8
712
+ case 0xda: // raw 16 / str 16
713
+ case 0xdb: // raw 32 / str 32
714
+ return TYPE_RAW;
715
+
716
+ case 0xc4: // bin 8
717
+ case 0xc5: // bin 16
718
+ case 0xc6: // bin 32
667
719
  return TYPE_RAW;
668
720
 
669
721
  case 0xdc: // array 16
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * MessagePack for Ruby
3
3
  *
4
- * Copyright (C) 2008-2012 FURUHASHI Sadayuki
4
+ * Copyright (C) 2008-2013 Sadayuki Furuhashi
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * MessagePack for Ruby
3
3
  *
4
- * Copyright (C) 2008-2012 FURUHASHI Sadayuki
4
+ * Copyright (C) 2008-2013 Sadayuki Furuhashi
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -260,12 +260,12 @@ static VALUE Unpacker_each(VALUE self)
260
260
  #endif
261
261
 
262
262
  if(msgpack_buffer_has_io(UNPACKER_BUFFER_(uk))) {
263
- return Unpacker_each_impl(self);
264
- } else {
265
263
  /* rescue EOFError only if io is set */
266
264
  return rb_rescue2(Unpacker_each_impl, self,
267
265
  Unpacker_rescue_EOFError, self,
268
266
  rb_eEOFError, NULL);
267
+ } else {
268
+ return Unpacker_each_impl(self);
269
269
  }
270
270
  }
271
271
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * MessagePack for Ruby
3
3
  *
4
- * Copyright (C) 2008-2012 FURUHASHI Sadayuki
4
+ * Copyright (C) 2008-2013 Sadayuki Furuhashi
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -3,7 +3,6 @@ require File.join(here, 'msgpack', 'version')
3
3
  begin
4
4
  m = /(\d+.\d+)/.match(RUBY_VERSION)
5
5
  ver = m[1]
6
- ver = '1.9' if ver == '2.0'
7
6
  require File.join(here, 'msgpack', ver, 'msgpack')
8
7
  rescue LoadError
9
8
  require File.join(here, 'msgpack', 'msgpack')
@@ -1,3 +1,3 @@
1
1
  module MessagePack
2
- VERSION = "0.5.5"
2
+ VERSION = "0.5.7"
3
3
  end
@@ -6,8 +6,9 @@ Gem::Specification.new do |s|
6
6
  s.version = MessagePack::VERSION
7
7
  s.summary = "MessagePack, a binary-based efficient data interchange format."
8
8
  s.description = %q{MessagePack is a binary-based efficient object serialization library. It enables to exchange structured objects between many languages like JSON. But unlike JSON, it is very fast and small.}
9
- s.author = "FURUHASHI Sadayuki"
9
+ s.author = "Sadayuki Furuhashi"
10
10
  s.email = "frsyuki@gmail.com"
11
+ s.license = "Apache 2.0"
11
12
  s.homepage = "http://msgpack.org/"
12
13
  s.rubyforge_project = "msgpack"
13
14
  s.has_rdoc = false
@@ -138,6 +138,20 @@ describe Unpacker do
138
138
  unpacker.buffer.object_id.should == o1
139
139
  end
140
140
 
141
+ it 'frozen short strings' do
142
+ raw = sample_object.to_msgpack.to_s.force_encoding('UTF-8')
143
+ lambda {
144
+ unpacker.feed_each(raw.freeze) { }
145
+ }.should_not raise_error
146
+ end
147
+
148
+ it 'frozen long strings' do
149
+ raw = (sample_object.to_msgpack.to_s * 10240).force_encoding('UTF-8')
150
+ lambda {
151
+ unpacker.feed_each(raw.freeze) { }
152
+ }.should_not raise_error
153
+ end
154
+
141
155
  it 'read raises level stack too deep error' do
142
156
  512.times { packer.write_array_header(1) }
143
157
  packer.write(nil)
@@ -159,14 +173,14 @@ describe Unpacker do
159
173
  end
160
174
 
161
175
  it 'read raises invalid byte error' do
162
- unpacker.feed("\xc6")
176
+ unpacker.feed("\xc1")
163
177
  lambda {
164
178
  unpacker.read
165
179
  }.should raise_error(MessagePack::MalformedFormatError)
166
180
  end
167
181
 
168
182
  it 'skip raises invalid byte error' do
169
- unpacker.feed("\xc6")
183
+ unpacker.feed("\xc1")
170
184
  lambda {
171
185
  unpacker.skip
172
186
  }.should raise_error(MessagePack::MalformedFormatError)
@@ -215,5 +229,41 @@ describe Unpacker do
215
229
 
216
230
  parsed.should == true
217
231
  end
232
+
233
+ it "msgpack str 8 type" do
234
+ MessagePack.unpack([0xd9, 0x00].pack('C*')).should == ""
235
+ MessagePack.unpack([0xd9, 0x01].pack('C*') + 'a').should == "a"
236
+ MessagePack.unpack([0xd9, 0x02].pack('C*') + 'aa').should == "aa"
237
+ end
238
+
239
+ it "msgpack str 16 type" do
240
+ MessagePack.unpack([0xda, 0x00, 0x00].pack('C*')).should == ""
241
+ MessagePack.unpack([0xda, 0x00, 0x01].pack('C*') + 'a').should == "a"
242
+ MessagePack.unpack([0xda, 0x00, 0x02].pack('C*') + 'aa').should == "aa"
243
+ end
244
+
245
+ it "msgpack str 32 type" do
246
+ MessagePack.unpack([0xdb, 0x00, 0x00, 0x00, 0x00].pack('C*')).should == ""
247
+ MessagePack.unpack([0xdb, 0x00, 0x00, 0x00, 0x01].pack('C*') + 'a').should == "a"
248
+ MessagePack.unpack([0xdb, 0x00, 0x00, 0x00, 0x02].pack('C*') + 'aa').should == "aa"
249
+ end
250
+
251
+ it "msgpack bin 8 type" do
252
+ MessagePack.unpack([0xc4, 0x00].pack('C*')).should == ""
253
+ MessagePack.unpack([0xc4, 0x01].pack('C*') + 'a').should == "a"
254
+ MessagePack.unpack([0xc4, 0x02].pack('C*') + 'aa').should == "aa"
255
+ end
256
+
257
+ it "msgpack bin 16 type" do
258
+ MessagePack.unpack([0xc5, 0x00, 0x00].pack('C*')).should == ""
259
+ MessagePack.unpack([0xc5, 0x00, 0x01].pack('C*') + 'a').should == "a"
260
+ MessagePack.unpack([0xc5, 0x00, 0x02].pack('C*') + 'aa').should == "aa"
261
+ end
262
+
263
+ it "msgpack bin 32 type" do
264
+ MessagePack.unpack([0xc6, 0x00, 0x00, 0x00, 0x00].pack('C*')).should == ""
265
+ MessagePack.unpack([0xc6, 0x00, 0x00, 0x00, 0x01].pack('C*') + 'a').should == "a"
266
+ MessagePack.unpack([0xc6, 0x00, 0x00, 0x00, 0x02].pack('C*') + 'aa').should == "aa"
267
+ end
218
268
  end
219
269
 
metadata CHANGED
@@ -1,116 +1,76 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: msgpack
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
5
- prerelease:
6
- segments:
7
- - 0
8
- - 5
9
- - 5
10
- version: 0.5.5
4
+ version: 0.5.7
11
5
  platform: x86-mingw32
12
6
  authors:
13
- - FURUHASHI Sadayuki
7
+ - Sadayuki Furuhashi
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
11
 
18
- date: 2013-05-13 00:00:00 +09:00
19
- default_executable:
12
+ date: 2013-11-13 00:00:00 Z
20
13
  dependencies:
21
14
  - !ruby/object:Gem::Dependency
22
15
  type: :development
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
16
+ version_requirements: &id001 !ruby/object:Gem::Requirement
25
17
  requirements:
26
18
  - - ~>
27
19
  - !ruby/object:Gem::Version
28
- hash: 15
29
- segments:
30
- - 1
31
- - 0
32
20
  version: "1.0"
33
21
  name: bundler
34
- version_requirements: *id001
35
22
  prerelease: false
23
+ requirement: *id001
36
24
  - !ruby/object:Gem::Dependency
37
25
  type: :development
38
- requirement: &id002 !ruby/object:Gem::Requirement
39
- none: false
26
+ version_requirements: &id002 !ruby/object:Gem::Requirement
40
27
  requirements:
41
28
  - - ~>
42
29
  - !ruby/object:Gem::Version
43
- hash: 63
44
- segments:
45
- - 0
46
- - 9
47
- - 2
48
30
  version: 0.9.2
49
31
  name: rake
50
- version_requirements: *id002
51
32
  prerelease: false
33
+ requirement: *id002
52
34
  - !ruby/object:Gem::Dependency
53
35
  type: :development
54
- requirement: &id003 !ruby/object:Gem::Requirement
55
- none: false
36
+ version_requirements: &id003 !ruby/object:Gem::Requirement
56
37
  requirements:
57
38
  - - ~>
58
39
  - !ruby/object:Gem::Version
59
- hash: 57
60
- segments:
61
- - 0
62
- - 8
63
- - 3
64
40
  version: 0.8.3
65
41
  name: rake-compiler
66
- version_requirements: *id003
67
42
  prerelease: false
43
+ requirement: *id003
68
44
  - !ruby/object:Gem::Dependency
69
45
  type: :development
70
- requirement: &id004 !ruby/object:Gem::Requirement
71
- none: false
46
+ version_requirements: &id004 !ruby/object:Gem::Requirement
72
47
  requirements:
73
48
  - - ~>
74
49
  - !ruby/object:Gem::Version
75
- hash: 21
76
- segments:
77
- - 2
78
- - 11
79
50
  version: "2.11"
80
51
  name: rspec
81
- version_requirements: *id004
82
52
  prerelease: false
53
+ requirement: *id004
83
54
  - !ruby/object:Gem::Dependency
84
55
  type: :development
85
- requirement: &id005 !ruby/object:Gem::Requirement
86
- none: false
56
+ version_requirements: &id005 !ruby/object:Gem::Requirement
87
57
  requirements:
88
58
  - - ~>
89
59
  - !ruby/object:Gem::Version
90
- hash: 1
91
- segments:
92
- - 1
93
- - 7
94
60
  version: "1.7"
95
61
  name: json
96
- version_requirements: *id005
97
62
  prerelease: false
63
+ requirement: *id005
98
64
  - !ruby/object:Gem::Dependency
99
65
  type: :development
100
- requirement: &id006 !ruby/object:Gem::Requirement
101
- none: false
66
+ version_requirements: &id006 !ruby/object:Gem::Requirement
102
67
  requirements:
103
68
  - - ~>
104
69
  - !ruby/object:Gem::Version
105
- hash: 59
106
- segments:
107
- - 0
108
- - 8
109
- - 2
110
70
  version: 0.8.2
111
71
  name: yard
112
- version_requirements: *id006
113
72
  prerelease: false
73
+ requirement: *id006
114
74
  description: MessagePack is a binary-based efficient object serialization library. It enables to exchange structured objects between many languages like JSON. But unlike JSON, it is very fast and small.
115
75
  email: frsyuki@gmail.com
116
76
  executables: []
@@ -170,9 +130,10 @@ files:
170
130
  - lib/msgpack/1.8/msgpack.so
171
131
  - lib/msgpack/1.9/msgpack.so
172
132
  - lib/msgpack/2.0/msgpack.so
173
- has_rdoc: true
174
133
  homepage: http://msgpack.org/
175
- licenses: []
134
+ licenses:
135
+ - Apache 2.0
136
+ metadata: {}
176
137
 
177
138
  post_install_message:
178
139
  rdoc_options: []
@@ -180,29 +141,20 @@ rdoc_options: []
180
141
  require_paths:
181
142
  - lib
182
143
  required_ruby_version: !ruby/object:Gem::Requirement
183
- none: false
184
144
  requirements:
185
- - - ">="
145
+ - &id007
146
+ - ">="
186
147
  - !ruby/object:Gem::Version
187
- hash: 3
188
- segments:
189
- - 0
190
148
  version: "0"
191
149
  required_rubygems_version: !ruby/object:Gem::Requirement
192
- none: false
193
150
  requirements:
194
- - - ">="
195
- - !ruby/object:Gem::Version
196
- hash: 3
197
- segments:
198
- - 0
199
- version: "0"
151
+ - *id007
200
152
  requirements: []
201
153
 
202
154
  rubyforge_project: msgpack
203
- rubygems_version: 1.6.2
155
+ rubygems_version: 2.1.11
204
156
  signing_key:
205
- specification_version: 3
157
+ specification_version: 4
206
158
  summary: MessagePack, a binary-based efficient data interchange format.
207
159
  test_files: []
208
160