msgpack 0.5.10 → 0.5.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NjBhYjJiYTBhZjk5OGY0ZDdjYmFiOWE3ZDc5ZTQ0MDgzYTU4N2M3ZQ==
4
+ YmU2YTk2ZGQ2NTEzN2ZjZjVlZTU4MjExZTUyNTMzNjdjNGNkYTM4Mw==
5
5
  data.tar.gz: !binary |-
6
- ODI0N2FmMjRjOTU4ZGUyNDliMTc2OWRkNWE5ZDI0YzYzM2Y4MTQ4Yw==
6
+ YmQ2ZGQ4NjEyMWZlODk2NzE0NzkwY2YxZThkY2E3MDVmNGY2NzRjZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YzBlNTc4N2Y5YjgzNjU2ODVjODY2NDgwYjc3YTViZDlmMGU1YzFiNjExODc2
10
- YWJhZTNhODU0MjAxMWE1MThjOWU2NGUyZjZhMmVkNDQ0ZWY5NzlmNzE4M2Rl
11
- NTgyNzVmMDU2MTJlOTM4YzA0ODJhM2JhYWJhYjg3YzNiNGM0ZTM=
9
+ NmZjODQxMjA4MDM3NjFmM2RiMDQ4YTZlMjYyNGI5MmM3NWI5NzQyMTZmODll
10
+ NjA3MGJlODFhYTg5YTNlYTA4YTM1MTQxNDRhMTg5ZjUxYTA0NjUwNGE4MjU4
11
+ YTk1N2M2ZWZmMDQ2OWNjODFlZGNmZjBkY2E5OGYwOGQyN2IwMWY=
12
12
  data.tar.gz: !binary |-
13
- NzA5MGJjNGM0NGZiMjM2NTU3M2I5Y2I4NzUxYjA3ZDUyNjNlY2JhMmRjOWM1
14
- MmJjNWNiMGQ0MTUwNjM5ZmVhMjMwYTQ0ZjNiZjg0ZjZjNDAxNTFlNjJkN2Yz
15
- NjBlMWIxZjY0Yjg5MThlNjgzYzU2OGQyMjljN2E2NGUzN2ViZjE=
13
+ NzcwODU2ZjViYTYyMGUxOWU2Y2E4Yjc2YzVhMGQ1ZjIzYmMwY2Q4NTVkYTI3
14
+ YzdiOGQ3M2IzZGI3ZmRhYjIyZjdjMDI3NjZkYTEzZjY2YmVmNWM4NDQ5NjFk
15
+ NThkMGEyZTMwMmUyOThjYzdkOWY5NDE1Yzg0ZTNhMWU5NjZjYjA=
data/ChangeLog CHANGED
@@ -1,4 +1,14 @@
1
1
 
2
+ 2015-02-04 version 0.5.11:
3
+
4
+ * Fixed Encoding::CompatibilityError error when serializing a long string
5
+ longer than write_reference_threshold (5KB by default) and whose encoding
6
+ is not ASCII-8BIT.
7
+ * Fix read_(map|array)_header (@funny-falcon++).
8
+ * Internally, rename msgpack_unpacker_{init,reset,destroy} functions
9
+ so that we can load msgpack-c in the same process (@miihael++)
10
+
11
+
2
12
  2015-01-09 version 0.5.10:
3
13
 
4
14
  * Merged msgpack-jruby by @iconara. JRuby can run `require 'msgpack'` to use
@@ -332,7 +332,19 @@ void _msgpack_buffer_append_long_string(msgpack_buffer_t* b, VALUE string)
332
332
 
333
333
  if(b->io != Qnil) {
334
334
  msgpack_buffer_flush(b);
335
+ #ifdef COMPAT_HAVE_ENCODING
336
+ if (ENCODING_GET(string) == s_enc_ascii8bit) {
337
+ rb_funcall(b->io, b->io_write_all_method, 1, string);
338
+ } else if(!STR_DUP_LIKELY_DOES_COPY(string)) {
339
+ VALUE s = rb_str_dup(string);
340
+ ENCODING_SET(s, s_enc_ascii8bit);
341
+ rb_funcall(b->io, b->io_write_all_method, 1, s);
342
+ } else {
343
+ msgpack_buffer_append(b, RSTRING_PTR(string), length);
344
+ }
345
+ #else
335
346
  rb_funcall(b->io, b->io_write_all_method, 1, string);
347
+ #endif
336
348
 
337
349
  } else if(!STR_DUP_LIKELY_DOES_COPY(string)) {
338
350
  _msgpack_buffer_append_reference(b, string);
@@ -52,7 +52,7 @@ void msgpack_unpacker_static_destroy()
52
52
 
53
53
  #define HEAD_BYTE_REQUIRED 0xc1
54
54
 
55
- void msgpack_unpacker_init(msgpack_unpacker_t* uk)
55
+ void _msgpack_unpacker_init(msgpack_unpacker_t* uk)
56
56
  {
57
57
  memset(uk, 0, sizeof(msgpack_unpacker_t));
58
58
 
@@ -73,7 +73,7 @@ void msgpack_unpacker_init(msgpack_unpacker_t* uk)
73
73
  uk->stack_capacity = MSGPACK_UNPACKER_STACK_CAPACITY;
74
74
  }
75
75
 
76
- void msgpack_unpacker_destroy(msgpack_unpacker_t* uk)
76
+ void _msgpack_unpacker_destroy(msgpack_unpacker_t* uk)
77
77
  {
78
78
  #ifdef UNPACKER_STACK_RMEM
79
79
  msgpack_rmem_free(&s_stack_rmem, uk->stack);
@@ -101,7 +101,7 @@ void msgpack_unpacker_mark(msgpack_unpacker_t* uk)
101
101
  rb_gc_mark(uk->buffer_ref);
102
102
  }
103
103
 
104
- void msgpack_unpacker_reset(msgpack_unpacker_t* uk)
104
+ void _msgpack_unpacker_reset(msgpack_unpacker_t* uk)
105
105
  {
106
106
  msgpack_buffer_clear(UNPACKER_BUFFER_(uk));
107
107
 
@@ -532,7 +532,7 @@ int msgpack_unpacker_read_array_header(msgpack_unpacker_t* uk, uint32_t* result_
532
532
  return b;
533
533
  }
534
534
 
535
- if(0x90 < b && b < 0x9f) {
535
+ if(0x90 <= b && b <= 0x9f) {
536
536
  *result_size = b & 0x0f;
537
537
 
538
538
  } else if(b == 0xdc) {
@@ -560,7 +560,7 @@ int msgpack_unpacker_read_map_header(msgpack_unpacker_t* uk, uint32_t* result_si
560
560
  return b;
561
561
  }
562
562
 
563
- if(0x80 < b && b < 0x8f) {
563
+ if(0x80 <= b && b <= 0x8f) {
564
564
  *result_size = b & 0x0f;
565
565
 
566
566
  } else if(b == 0xde) {
@@ -78,13 +78,13 @@ void msgpack_unpacker_static_init();
78
78
 
79
79
  void msgpack_unpacker_static_destroy();
80
80
 
81
- void msgpack_unpacker_init(msgpack_unpacker_t* uk);
81
+ void _msgpack_unpacker_init(msgpack_unpacker_t* uk);
82
82
 
83
- void msgpack_unpacker_destroy(msgpack_unpacker_t* uk);
83
+ void _msgpack_unpacker_destroy(msgpack_unpacker_t* uk);
84
84
 
85
85
  void msgpack_unpacker_mark(msgpack_unpacker_t* uk);
86
86
 
87
- void msgpack_unpacker_reset(msgpack_unpacker_t* uk);
87
+ void _msgpack_unpacker_reset(msgpack_unpacker_t* uk);
88
88
 
89
89
  static inline void msgpack_unpacker_set_symbolized_keys(msgpack_unpacker_t* uk, bool enable)
90
90
  {
@@ -42,14 +42,14 @@ static void Unpacker_free(msgpack_unpacker_t* uk)
42
42
  if(uk == NULL) {
43
43
  return;
44
44
  }
45
- msgpack_unpacker_destroy(uk);
45
+ _msgpack_unpacker_destroy(uk);
46
46
  free(uk);
47
47
  }
48
48
 
49
49
  static VALUE Unpacker_alloc(VALUE klass)
50
50
  {
51
51
  msgpack_unpacker_t* uk = ALLOC_N(msgpack_unpacker_t, 1);
52
- msgpack_unpacker_init(uk);
52
+ _msgpack_unpacker_init(uk);
53
53
 
54
54
  VALUE self = Data_Wrap_Struct(klass, msgpack_unpacker_mark, Unpacker_free, uk);
55
55
 
@@ -292,7 +292,7 @@ static VALUE Unpacker_reset(VALUE self)
292
292
  {
293
293
  UNPACKER(self, uk);
294
294
 
295
- msgpack_unpacker_reset(uk);
295
+ _msgpack_unpacker_reset(uk);
296
296
 
297
297
  return Qnil;
298
298
  }
@@ -318,7 +318,7 @@ VALUE MessagePack_unpack(int argc, VALUE* argv)
318
318
 
319
319
  VALUE self = Unpacker_alloc(cMessagePack_Unpacker);
320
320
  UNPACKER(self, uk);
321
- //msgpack_unpacker_reset(s_unpacker);
321
+ //_msgpack_unpacker_reset(s_unpacker);
322
322
  //msgpack_buffer_reset_io(UNPACKER_BUFFER_(s_unpacker));
323
323
 
324
324
  /* prefer reference than copying; see MessagePack_Unpacker_module_init */
@@ -1,3 +1,3 @@
1
1
  module MessagePack
2
- VERSION = "0.5.10"
2
+ VERSION = "0.5.11"
3
3
  end
@@ -23,9 +23,6 @@ describe MessagePack do
23
23
  end
24
24
 
25
25
  it "msgpack str 8 type" do
26
- if /java/ =~ RUBY_PLATFORM
27
- skip "str 8 type is not supported in JRuby (incompatibility)"
28
- end
29
26
  MessagePack.unpack([0xd9, 0x00].pack('C*')).should == ""
30
27
  MessagePack.unpack([0xd9, 0x01].pack('C*') + 'a').should == "a"
31
28
  MessagePack.unpack([0xd9, 0x02].pack('C*') + 'aa').should == "aa"
@@ -44,27 +41,18 @@ describe MessagePack do
44
41
  end
45
42
 
46
43
  it "msgpack bin 8 type" do
47
- if /java/ =~ RUBY_PLATFORM
48
- skip "bin 8 type is not supported in JRuby (incompatibility)"
49
- end
50
44
  MessagePack.unpack([0xc4, 0x00].pack('C*')).should == ""
51
45
  MessagePack.unpack([0xc4, 0x01].pack('C*') + 'a').should == "a"
52
46
  MessagePack.unpack([0xc4, 0x02].pack('C*') + 'aa').should == "aa"
53
47
  end
54
48
 
55
49
  it "msgpack bin 16 type" do
56
- if /java/ =~ RUBY_PLATFORM
57
- skip "bin 16 type is not supported in JRuby (incompatibility)"
58
- end
59
50
  MessagePack.unpack([0xc5, 0x00, 0x00].pack('C*')).should == ""
60
51
  MessagePack.unpack([0xc5, 0x00, 0x01].pack('C*') + 'a').should == "a"
61
52
  MessagePack.unpack([0xc5, 0x00, 0x02].pack('C*') + 'aa').should == "aa"
62
53
  end
63
54
 
64
55
  it "msgpack bin 32 type" do
65
- if /java/ =~ RUBY_PLATFORM
66
- skip "bin 32 type is not supported in JRuby (incompatibility)"
67
- end
68
56
  MessagePack.unpack([0xc6, 0x00, 0x00, 0x00, 0x00].pack('C*')).should == ""
69
57
  MessagePack.unpack([0xc6, 0x00, 0x00, 0x00, 0x01].pack('C*') + 'a').should == "a"
70
58
  MessagePack.unpack([0xc6, 0x00, 0x00, 0x00, 0x02].pack('C*') + 'aa').should == "aa"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: msgpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.10
4
+ version: 0.5.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-01-09 00:00:00.000000000 Z
12
+ date: 2015-02-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler