msgpack 0.7.5 → 0.7.6

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
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ba9f040ee3d1216597e2beefef6251fa120b7a0
4
- data.tar.gz: c248b8969af05080d2e68c33d4bec95faa5867e8
3
+ metadata.gz: 8f31066b6f1e423eee182e7ea7be472797607bf3
4
+ data.tar.gz: aed0b52b3aaaba5b423c91c678853f71cf3145ec
5
5
  SHA512:
6
- metadata.gz: 82627fad314167164461fd41ddd01b9f46cad8261090d20c49b1789d80579ea5b1035ba3be8cb285bfd517d437ebc24b8de4763423e1afd33f192b7c59c1d714
7
- data.tar.gz: 4ce0ecaed760e8a94ea3514717729c476a79d0848b614823b109c0a9dfee60ae0b50d4655fbe8685b70c17fcaa8dc889a6accec3ce588f5597884032b2f7509c
6
+ metadata.gz: a1c7a45deda8a37da5d082cc753253b665974bd55415c28d46fb973f6c6f7c038cf526e9824fa1c94c4b4f13d802b26d82ad1ff6424dccfb2809822a9db81b1e
7
+ data.tar.gz: a075febabd943210c5388589daa4cd8a036c4f459f68fad0da055944cac065f37af5f92685efbf79306cca0cec64059884f9b7b38942ea681ea31d9e541bf564
data/ChangeLog CHANGED
@@ -1,3 +1,12 @@
1
+ 2016-05-10 version 0.7.6:
2
+
3
+ * Fix bug to raise IndexOutOfBoundsException for Bignum value with small int in JRuby
4
+
5
+ 2016-04-06 version 0.7.5:
6
+
7
+ * Improved support for i386/armel/armhf environments
8
+ * Fix bug for negative ext type id and some architectures (arm*)
9
+
1
10
  2016-01-08 version 0.7.4:
2
11
 
3
12
  * Improved compatibility of Packer between CRuby and JRuby about argument IO-ish object values.
@@ -3,6 +3,7 @@ package org.msgpack.jruby;
3
3
 
4
4
  import java.math.BigInteger;
5
5
  import java.nio.ByteBuffer;
6
+ import java.util.Arrays;
6
7
 
7
8
  import org.jruby.Ruby;
8
9
  import org.jruby.RubyObject;
@@ -124,14 +125,18 @@ public class Encoder {
124
125
  }
125
126
 
126
127
  private void appendBignum(RubyBignum object) {
127
- BigInteger value = ((RubyBignum) object).getBigIntegerValue();
128
- if (value.bitLength() > 64 || (value.bitLength() > 63 && value.signum() < 0)) {
129
- throw runtime.newArgumentError(String.format("Cannot pack big integer: %s", value));
128
+ BigInteger value = object.getBigIntegerValue();
129
+ if (value.compareTo(RubyBignum.LONG_MIN) < 0 || value.compareTo(RubyBignum.LONG_MAX) > 0) {
130
+ if (value.bitLength() > 64 || (value.bitLength() > 63 && value.signum() < 0)) {
131
+ throw runtime.newArgumentError(String.format("Cannot pack big integer: %s", value));
132
+ }
133
+ ensureRemainingCapacity(9);
134
+ buffer.put(value.signum() < 0 ? INT64 : UINT64);
135
+ byte[] b = value.toByteArray();
136
+ buffer.put(b, b.length - 8, 8);
137
+ } else {
138
+ appendInteger(object);
130
139
  }
131
- ensureRemainingCapacity(9);
132
- buffer.put(value.signum() < 0 ? INT64 : UINT64);
133
- byte[] b = value.toByteArray();
134
- buffer.put(b, b.length - 8, 8);
135
140
  }
136
141
 
137
142
  private void appendInteger(RubyInteger object) {
@@ -1,3 +1,3 @@
1
1
  module MessagePack
2
- VERSION = "0.7.5"
2
+ VERSION = "0.7.6"
3
3
  end
@@ -159,4 +159,13 @@ describe MessagePack do
159
159
  packed.should start_with("\xDA\x00\x20")
160
160
  end
161
161
  end
162
+
163
+ context 'when a Bignum has a small value' do
164
+ tests['numbers'].take(10).each do |desc, unpacked, packed|
165
+ it("encodes #{desc} to the smallest representation") do
166
+ bignum = (1 << 64).coerce(unpacked)[0]
167
+ MessagePack.pack(bignum).should eq(packed)
168
+ end
169
+ end
170
+ end
162
171
  end
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.7.5
4
+ version: 0.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-04-06 00:00:00.000000000 Z
13
+ date: 2016-05-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler