msgpack 0.5.10-x86-mingw32 → 0.5.12-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 4a77a8aff4a33fedfd33fab9177e13a870480bf4
4
- data.tar.gz: e2a6e9ec90461653923bd0b3a021961c31990008
5
- SHA512:
6
- metadata.gz: da6167ec828f7741b6ed1eb802ee3337290a3db1e069a10f5c0c031e01339ae3cc3a4dfe4d8db625ee39064d19b4a86deb2a5ecef912bef55a1ed824ae28db23
7
- data.tar.gz: c85904ad05d66565a9c4857b03ec880596260d4578f8591d7cfb1b7825ef66f724c097a86c6813580be0aa61f355afb0e3d359f00f8f8de6408b7dfcf703e994
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0d89cc8aeefbce6468c2ddbd690bb2ccb4e5213b
4
+ data.tar.gz: 44a0cfdf2427fc3c6d52f30cc740cb8d80e9f8e9
5
+ SHA512:
6
+ metadata.gz: cf586cd027ce0da5948cac89665853ff8a408c14dd225d1399f5dbbc53343241eb8bee54971c3486374da73e9a1a7861cf9b08a3572431ddd7ded41a2060ce93
7
+ data.tar.gz: 5e7679948efc387bd4511c80b490e6a743ae5e87701aec36d9ff2f9307ea34a09ca41651a60dc7f762b5ad9914ccd9ea3d93251708723e6113aa88d698dde0ea
@@ -8,6 +8,7 @@ rvm:
8
8
  - ruby-head
9
9
  - rbx-2
10
10
  - jruby-19mode
11
+ - jruby-head
11
12
 
12
13
  os:
13
14
  - linux
@@ -23,3 +24,4 @@ gemfile:
23
24
  matrix:
24
25
  allow_failures:
25
26
  - rvm: ruby-head
27
+ - rvm: jruby-head
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
data/LICENSE ADDED
@@ -0,0 +1,177 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,23 @@
1
+ require 'viiite'
2
+ require 'msgpack'
3
+
4
+ data = { 'hello' => 'world', 'nested' => ['structure', {value: 42}] }
5
+ data_sym = { hello: 'world', nested: ['structure', {value: 42}] }
6
+
7
+ data = MessagePack.pack(:hello => 'world', :nested => ['structure', {:value => 42}])
8
+
9
+ Viiite.bench do |b|
10
+ b.range_over([10_000, 100_000, 1000_000], :runs) do |runs|
11
+ b.report(:strings) do
12
+ runs.times do
13
+ MessagePack.pack(data)
14
+ end
15
+ end
16
+
17
+ b.report(:symbols) do
18
+ runs.times do
19
+ MessagePack.pack(data_sym)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,33 @@
1
+ require 'viiite'
2
+ require 'msgpack'
3
+
4
+ data_plain = { 'message' => '127.0.0.1 - - [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 "http://www.example.com/start.html" "Mozilla/4.08 [en] (Win98; I ;Nav)"' }
5
+ data_structure = {
6
+ 'remote_host' => '127.0.0.1',
7
+ 'remote_user' => '-',
8
+ 'date' => '10/Oct/2000:13:55:36 -0700',
9
+ 'request' => 'GET /apache_pb.gif HTTP/1.0',
10
+ 'method' => 'GET',
11
+ 'path' => '/apache_pb.gif',
12
+ 'protocol' => 'HTTP/1.0',
13
+ 'status' => 200,
14
+ 'bytes' => 2326,
15
+ 'referer' => 'http://www.example.com/start.html',
16
+ 'agent' => 'Mozilla/4.08 [en] (Win98; I ;Nav)',
17
+ }
18
+
19
+ Viiite.bench do |b|
20
+ b.range_over([10_000, 100_000, 1000_000], :runs) do |runs|
21
+ b.report(:plain) do
22
+ runs.times do
23
+ MessagePack.pack(data_plain)
24
+ end
25
+ end
26
+
27
+ b.report(:structure) do
28
+ runs.times do
29
+ MessagePack.pack(data_structure)
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,65 @@
1
+ # viiite report --regroup bench,threads bench/pack_log_long.rb
2
+
3
+ require 'viiite'
4
+ require 'msgpack'
5
+
6
+ data_plain = { 'message' => '127.0.0.1 - - [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 "http://www.example.com/start.html" "Mozilla/4.08 [en] (Win98; I ;Nav)"' }
7
+ data_structure = {
8
+ 'remote_host' => '127.0.0.1',
9
+ 'remote_user' => '-',
10
+ 'date' => '10/Oct/2000:13:55:36 -0700',
11
+ 'request' => 'GET /apache_pb.gif HTTP/1.0',
12
+ 'method' => 'GET',
13
+ 'path' => '/apache_pb.gif',
14
+ 'protocol' => 'HTTP/1.0',
15
+ 'status' => 200,
16
+ 'bytes' => 2326,
17
+ 'referer' => 'http://www.example.com/start.html',
18
+ 'agent' => 'Mozilla/4.08 [en] (Win98; I ;Nav)',
19
+ }
20
+
21
+ seconds = 3600 # 1 hour
22
+
23
+ Viiite.bench do |b|
24
+ b.range_over([1, 2, 4, 8, 16], :threads) do |threads|
25
+ b.report(:plain) do
26
+ ths = []
27
+ end_at = Time.now + seconds
28
+ threads.times do
29
+ t = Thread.new do
30
+ packs = 0
31
+ while Time.now < end_at
32
+ 10000.times do
33
+ MessagePack.pack(data_plain)
34
+ end
35
+ packs += 10000
36
+ end
37
+ packs
38
+ end
39
+ ths.push t
40
+ end
41
+ sum = ths.reduce(0){|r,t| r + t.value }
42
+ puts "MessagePack.pack, plain, #{threads} threads: #{sum} times, #{sum / seconds} times/second."
43
+ end
44
+
45
+ b.report(:structure) do
46
+ ths = []
47
+ end_at = Time.now + seconds
48
+ threads.times do
49
+ t = Thread.new do
50
+ packs = 0
51
+ while Time.now < end_at
52
+ 10000.times do
53
+ MessagePack.pack(data_structure)
54
+ end
55
+ packs += 10000
56
+ end
57
+ packs
58
+ end
59
+ ths.push t
60
+ end
61
+ sum = ths.reduce(0){|r,t| r + t.value }
62
+ puts "MessagePack.pack, structured, #{threads} threads: #{sum} times, #{sum / seconds} times/second."
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,14 @@
1
+ #!/bin/sh
2
+
3
+ # prerequisites
4
+ # $ rbenv shell 2.2.1 (or jruby-x.x.x or ...)
5
+ # $ rake install
6
+
7
+ echo "pack"
8
+ viiite report --regroup bench,runs bench/pack.rb
9
+ echo "unpack"
10
+ viiite report --regroup bench,runs bench/unpack.rb
11
+ echo "pack log"
12
+ viiite report --regroup bench,runs bench/pack_log.rb
13
+ echo "unpack log"
14
+ viiite report --regroup bench,runs bench/unpack_log.rb
@@ -0,0 +1,35 @@
1
+ #!/bin/sh
2
+
3
+ # prerequisites
4
+ # $ sudo apt-get install sysstat
5
+ # $ rbenv shell 2.2.1 (or jruby-x.x.x or ...)
6
+ # $ rake install
7
+
8
+ # 60 * 600 : 60*60 * 5[threads] * 2[bench]
9
+
10
+ ruby -v
11
+
12
+ echo "pack log long"
13
+ viiite report --regroup bench,threads bench/pack_log_long.rb &
14
+ sar -o pack_log_long.sar -r 60 600 > /dev/null 2>&1 &
15
+
16
+ declare -i i=0
17
+ while [ $i -lt 600 ]; do
18
+ ps auxww | grep ruby | grep -v grep | awk '{print $5,$6;}' >> pack_log_long.mem.txt
19
+ i=i+1
20
+ sleep 60
21
+ done
22
+
23
+ sleep 120 # cool down
24
+
25
+ echo "unpack log long"
26
+ viiite report --regroup bench,threads bench/unpack_log_long.rb &
27
+ sar -o unpack_log_long.sar -r 60 600 > /dev/null 2>&1 &
28
+
29
+ i=0
30
+ while [ $i -lt 600 ]; do
31
+ ps auxww | grep ruby | grep -v grep | awk '{print $5,$6;}' >> pack_log_long.mem.txt
32
+ i=i+1
33
+ sleep 60
34
+ done
35
+
@@ -0,0 +1,21 @@
1
+ require 'viiite'
2
+ require 'msgpack'
3
+
4
+ data = MessagePack.pack(:hello => 'world', :nested => ['structure', {:value => 42}])
5
+
6
+ Viiite.bench do |b|
7
+ b.range_over([10_000, 100_000, 1000_000], :runs) do |runs|
8
+ b.report(:strings) do
9
+ runs.times do
10
+ MessagePack.unpack(data)
11
+ end
12
+ end
13
+
14
+ b.report(:symbols) do
15
+ options = {:symbolize_keys => true}
16
+ runs.times do
17
+ MessagePack.unpack(data, options)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,34 @@
1
+ require 'viiite'
2
+ require 'msgpack'
3
+
4
+ data_plain = MessagePack.pack({ 'message' => '127.0.0.1 - - [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 "http://www.example.com/start.html" "Mozilla/4.08 [en] (Win98; I ;Nav)"' })
5
+
6
+ data_structure = MessagePack.pack({
7
+ 'remote_host' => '127.0.0.1',
8
+ 'remote_user' => '-',
9
+ 'date' => '10/Oct/2000:13:55:36 -0700',
10
+ 'request' => 'GET /apache_pb.gif HTTP/1.0',
11
+ 'method' => 'GET',
12
+ 'path' => '/apache_pb.gif',
13
+ 'protocol' => 'HTTP/1.0',
14
+ 'status' => 200,
15
+ 'bytes' => 2326,
16
+ 'referer' => 'http://www.example.com/start.html',
17
+ 'agent' => 'Mozilla/4.08 [en] (Win98; I ;Nav)',
18
+ })
19
+
20
+ Viiite.bench do |b|
21
+ b.range_over([10_000, 100_000, 1000_000], :runs) do |runs|
22
+ b.report(:plain) do
23
+ runs.times do
24
+ MessagePack.unpack(data_plain)
25
+ end
26
+ end
27
+
28
+ b.report(:structure) do
29
+ runs.times do
30
+ MessagePack.unpack(data_structure)
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,67 @@
1
+ # viiite report --regroup bench,threads bench/pack_log_long.rb
2
+
3
+ require 'viiite'
4
+ require 'msgpack'
5
+
6
+ data_plain = MessagePack.pack({
7
+ 'message' => '127.0.0.1 - - [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 "http://www.example.com/start.html" "Mozilla/4.08 [en] (Win98; I ;Nav)"'
8
+ })
9
+ data_structure = MessagePack.pack({
10
+ 'remote_host' => '127.0.0.1',
11
+ 'remote_user' => '-',
12
+ 'date' => '10/Oct/2000:13:55:36 -0700',
13
+ 'request' => 'GET /apache_pb.gif HTTP/1.0',
14
+ 'method' => 'GET',
15
+ 'path' => '/apache_pb.gif',
16
+ 'protocol' => 'HTTP/1.0',
17
+ 'status' => 200,
18
+ 'bytes' => 2326,
19
+ 'referer' => 'http://www.example.com/start.html',
20
+ 'agent' => 'Mozilla/4.08 [en] (Win98; I ;Nav)',
21
+ })
22
+
23
+ seconds = 3600 # 1 hour
24
+
25
+ Viiite.bench do |b|
26
+ b.range_over([1, 2, 4, 8, 16], :threads) do |threads|
27
+ b.report(:plain) do
28
+ ths = []
29
+ end_at = Time.now + seconds
30
+ threads.times do
31
+ t = Thread.new do
32
+ packs = 0
33
+ while Time.now < end_at
34
+ 10000.times do
35
+ MessagePack.unpack(data_plain)
36
+ end
37
+ packs += 10000
38
+ end
39
+ packs
40
+ end
41
+ ths.push t
42
+ end
43
+ sum = ths.reduce(0){|r,t| r + t.value }
44
+ puts "MessagePack.unpack, plain, #{threads} threads: #{sum} times, #{sum / seconds} times/second."
45
+ end
46
+
47
+ b.report(:structure) do
48
+ ths = []
49
+ end_at = Time.now + seconds
50
+ threads.times do
51
+ t = Thread.new do
52
+ packs = 0
53
+ while Time.now < end_at
54
+ 10000.times do
55
+ MessagePack.unpack(data_structure)
56
+ end
57
+ packs += 10000
58
+ end
59
+ packs
60
+ end
61
+ ths.push t
62
+ end
63
+ sum = ths.reduce(0){|r,t| r + t.value }
64
+ puts "MessagePack.unpack, structured, #{threads} threads: #{sum} times, #{sum / seconds} times/second."
65
+ end
66
+ end
67
+ end
@@ -192,7 +192,7 @@ public class Encoder {
192
192
  Encoding encoding = object.getEncoding();
193
193
  boolean binary = encoding == binaryEncoding;
194
194
  if (encoding != utf8Encoding && encoding != binaryEncoding) {
195
- object = (RubyString) ((RubyString) object).encode(runtime.getCurrentContext(), RubyEncoding.newEncoding(runtime, utf8Encoding));
195
+ object = (RubyString) ((RubyString) object).encode(runtime.getCurrentContext(), runtime.getEncodingService().getEncoding(utf8Encoding));
196
196
  }
197
197
  ByteList bytes = object.getByteList();
198
198
  int length = bytes.length();
@@ -96,16 +96,10 @@ public class MessagePackLibrary implements Library {
96
96
  @JRubyMethod(module = true, required = 1, optional = 1, alias = {"load"})
97
97
  public static IRubyObject unpack(ThreadContext ctx, IRubyObject recv, IRubyObject[] args) {
98
98
  Decoder decoder = new Decoder(ctx.getRuntime(), args[0].asString().getBytes());
99
- if (args.length > 1) {
100
- if (args[args.length - 1] instanceof RubyHash) {
101
- Ruby runtime = ctx.getRuntime();
102
- IRubyObject symbolizeKeys = ((RubyHash) args[args.length - 1]).fastARef((IRubyObject) runtime.getSymbolTable().getSymbol("symbolize_keys"));
103
- if (symbolizeKeys instanceof RubyNil || symbolizeKeys instanceof RubyBoolean.False) {
104
- decoder.symbolizeKeys(false);
105
- } else {
106
- decoder.symbolizeKeys(true);
107
- }
108
- }
99
+ if (args.length > 1 && !args[args.length - 1].isNil()) {
100
+ RubyHash hash = args[args.length - 1].convertToHash();
101
+ IRubyObject symbolizeKeys = hash.fastARef(ctx.getRuntime().newSymbol("symbolize_keys"));
102
+ decoder.symbolizeKeys(symbolizeKeys != null && symbolizeKeys.isTrue());
109
103
  }
110
104
  return decoder.next();
111
105
  }
@@ -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.12"
3
3
  end
@@ -122,6 +122,12 @@ describe MessagePack do
122
122
  unpacked.should == {:hello => 'world', :nested => ['object', {:structure => true}]}
123
123
  end
124
124
 
125
+ it 'does not symbolize keys even if other options are present' do
126
+ packed = MessagePack.pack({'hello' => 'world', 'nested' => ['object', {'structure' => true}]})
127
+ unpacked = MessagePack.unpack(packed, :other_option => false)
128
+ unpacked.should == {'hello' => 'world', 'nested' => ['object', {'structure' => true}]}
129
+ end
130
+
125
131
  it 'can unpack strings with a specified encoding', :encodings do
126
132
  packed = MessagePack.pack({utf8enc('hello') => utf8enc('world')})
127
133
  unpacked = MessagePack.unpack(packed)
@@ -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,94 +1,125 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: msgpack
3
- version: !ruby/object:Gem::Version
4
- version: 0.5.10
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.12
5
5
  platform: x86-mingw32
6
- authors:
6
+ authors:
7
7
  - Sadayuki Furuhashi
8
8
  - Theo Hultberg
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2015-01-09 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- version_requirements: &id001 !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ~>
19
- - !ruby/object:Gem::Version
20
- version: "1.0"
21
- prerelease: false
22
- type: :development
23
- requirement: *id001
12
+ date: 2015-05-20 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
24
15
  name: bundler
25
- - !ruby/object:Gem::Dependency
26
- version_requirements: &id002 !ruby/object:Gem::Requirement
27
- requirements:
28
- - - ~>
29
- - !ruby/object:Gem::Version
30
- version: 0.9.2
31
- prerelease: false
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '1.0'
32
21
  type: :development
33
- requirement: *id002
34
- name: rake
35
- - !ruby/object:Gem::Dependency
36
- version_requirements: &id003 !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ~>
39
- - !ruby/object:Gem::Version
40
- version: 0.8.3
41
22
  prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '1.0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rake
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: 0.9.2
42
35
  type: :development
43
- requirement: *id003
44
- name: rake-compiler
45
- - !ruby/object:Gem::Dependency
46
- version_requirements: &id004 !ruby/object:Gem::Requirement
47
- requirements:
48
- - - ~>
49
- - !ruby/object:Gem::Version
50
- version: "2.11"
51
36
  prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: 0.9.2
42
+ - !ruby/object:Gem::Dependency
43
+ name: rake-compiler
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: 0.8.3
52
49
  type: :development
53
- requirement: *id004
54
- name: rspec
55
- - !ruby/object:Gem::Dependency
56
- version_requirements: &id005 !ruby/object:Gem::Requirement
57
- requirements:
58
- - - ~>
59
- - !ruby/object:Gem::Version
60
- version: "1.7"
61
50
  prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: 0.8.3
56
+ - !ruby/object:Gem::Dependency
57
+ name: rspec
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '2.11'
62
63
  type: :development
63
- requirement: *id005
64
- name: json
65
- - !ruby/object:Gem::Dependency
66
- version_requirements: &id006 !ruby/object:Gem::Requirement
67
- requirements:
68
- - - ~>
69
- - !ruby/object:Gem::Version
70
- version: 0.8.2
71
64
  prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '2.11'
70
+ - !ruby/object:Gem::Dependency
71
+ name: json
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '1.7'
72
77
  type: :development
73
- requirement: *id006
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '1.7'
84
+ - !ruby/object:Gem::Dependency
74
85
  name: yard
75
- 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.
76
- email:
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: 0.8.2
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: 0.8.2
98
+ description: MessagePack is a binary-based efficient object serialization library.
99
+ It enables to exchange structured objects between many languages like JSON. But
100
+ unlike JSON, it is very fast and small.
101
+ email:
77
102
  - frsyuki@gmail.com
78
103
  - theo@iconara.net
79
104
  executables: []
80
-
81
105
  extensions: []
82
-
83
106
  extra_rdoc_files: []
84
-
85
- files:
86
- - .gitignore
87
- - .travis.yml
107
+ files:
108
+ - ".gitignore"
109
+ - ".travis.yml"
88
110
  - ChangeLog
89
111
  - Gemfile
112
+ - LICENSE
90
113
  - README.rdoc
91
114
  - Rakefile
115
+ - bench/pack.rb
116
+ - bench/pack_log.rb
117
+ - bench/pack_log_long.rb
118
+ - bench/run.sh
119
+ - bench/run_long.sh
120
+ - bench/unpack.rb
121
+ - bench/unpack_log.rb
122
+ - bench/unpack_log_long.rb
92
123
  - doclib/msgpack.rb
93
124
  - doclib/msgpack/buffer.rb
94
125
  - doclib/msgpack/core_ext.rb
@@ -126,9 +157,7 @@ files:
126
157
  - ext/msgpack/unpacker_class.c
127
158
  - ext/msgpack/unpacker_class.h
128
159
  - lib/msgpack.rb
129
- - lib/msgpack/1.8/msgpack.so
130
- - lib/msgpack/1.9/msgpack.so
131
- - lib/msgpack/2.0/msgpack.so
160
+ - lib/msgpack/msgpack.so
132
161
  - lib/msgpack/version.rb
133
162
  - msgpack.gemspec
134
163
  - msgpack.org.md
@@ -152,30 +181,27 @@ files:
152
181
  - spec/spec_helper.rb
153
182
  - spec/unpack_spec.rb
154
183
  homepage: http://msgpack.org/
155
- licenses:
184
+ licenses:
156
185
  - Apache 2.0
157
186
  metadata: {}
158
-
159
187
  post_install_message:
160
188
  rdoc_options: []
161
-
162
- require_paths:
189
+ require_paths:
163
190
  - lib
164
- required_ruby_version: !ruby/object:Gem::Requirement
165
- requirements:
166
- - &id007
167
- - ">="
168
- - !ruby/object:Gem::Version
169
- version: "0"
170
- required_rubygems_version: !ruby/object:Gem::Requirement
171
- requirements:
172
- - *id007
191
+ required_ruby_version: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - ">="
194
+ - !ruby/object:Gem::Version
195
+ version: '0'
196
+ required_rubygems_version: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - ">="
199
+ - !ruby/object:Gem::Version
200
+ version: '0'
173
201
  requirements: []
174
-
175
202
  rubyforge_project: msgpack
176
- rubygems_version: 2.4.2
203
+ rubygems_version: 2.4.5
177
204
  signing_key:
178
205
  specification_version: 4
179
206
  summary: MessagePack, a binary-based efficient data interchange format.
180
207
  test_files: []
181
-