amq-protocol 1.9.1 → 1.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog.md +10 -0
- data/lib/amq/protocol/table.rb +2 -2
- data/lib/amq/protocol/table_value_decoder.rb +10 -6
- data/lib/amq/protocol/type_constants.rb +1 -1
- data/lib/amq/protocol/version.rb +1 -1
- data/spec/amq/protocol/table_spec.rb +2 -2
- data/spec/amq/protocol/value_decoder_spec.rb +17 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1df146ebd04eb15fc2d776b8dc7727da583ac8ba
|
4
|
+
data.tar.gz: 9ea0a0fadbc0f8d5bf4ae5b4cddb83263c12b51d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dab13ac628ff6c896284702903b702549861e575cba274192802779387e7a2a64cd6126cb1d1fd722e3b5220982494419f2a77f249443807343689de6147ab2f
|
7
|
+
data.tar.gz: 1e5d034f65ec0ab257e0db1c30879bf29ac15519cda3fbf1b424417d504f5d70f8e8daac27b73fc566f3bc2d80fa65c5a0ae391a26155fa360c7042f310e3d6a
|
data/ChangeLog.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## Changes between 1.9.x and 1.10.0
|
2
|
+
|
3
|
+
### Signed 16 Bit Integer Decoding
|
4
|
+
|
5
|
+
Signed 16 bit integers are now decoded correctly.
|
6
|
+
|
7
|
+
Contributed by Benjamin Conlan.
|
8
|
+
|
9
|
+
|
10
|
+
|
1
11
|
## Changes between 1.8.0 and 1.9.0
|
2
12
|
|
3
13
|
### Performance Improvements in AMQ::BitSet
|
data/lib/amq/protocol/table.rb
CHANGED
@@ -81,8 +81,8 @@ module AMQ
|
|
81
81
|
when TYPE_BOOLEAN
|
82
82
|
v, offset = TableValueDecoder.decode_boolean(data, offset)
|
83
83
|
v
|
84
|
-
|
85
|
-
v, offset = TableValueDecoder.
|
84
|
+
when TYPE_BYTE then
|
85
|
+
v, offset = TableValueDecoder.decode_byte(data, offset)
|
86
86
|
v
|
87
87
|
when TYPE_SIGNED_16BIT then
|
88
88
|
v, offset = TableValueDecoder.decode_short(data, offset)
|
@@ -50,8 +50,8 @@ module AMQ
|
|
50
50
|
when TYPE_BOOLEAN
|
51
51
|
v, offset = decode_boolean(data, offset)
|
52
52
|
v
|
53
|
-
when
|
54
|
-
v, offset =
|
53
|
+
when TYPE_BYTE then
|
54
|
+
v, offset = decode_byte(data, offset)
|
55
55
|
v
|
56
56
|
when TYPE_SIGNED_16BIT then
|
57
57
|
v, offset = decode_short(data, offset)
|
@@ -174,12 +174,16 @@ module AMQ
|
|
174
174
|
end # self.decode_hash(data, offset)
|
175
175
|
|
176
176
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
177
|
+
# Decodes/Converts a byte value from the data at the provided offset.
|
178
|
+
#
|
179
|
+
# @param [Array] data - A big-endian ordered array of bytes.
|
180
|
+
# @param [Fixnum] offset - The offset which bytes the byte is consumed.
|
181
|
+
# @return [Array] - The Fixnum value and new offset pair.
|
182
|
+
def self.decode_byte(data, offset)
|
183
|
+
[data.slice(offset, 1).unpack(PACK_CHAR).first, offset += 1]
|
181
184
|
end
|
182
185
|
|
186
|
+
|
183
187
|
def self.decode_short(data, offset)
|
184
188
|
v = AMQ::Hacks.unpack_int16_big_endian(data.slice(offset, 2)).first
|
185
189
|
offset += 2
|
data/lib/amq/protocol/version.rb
CHANGED
@@ -176,8 +176,8 @@ module AMQ
|
|
176
176
|
end
|
177
177
|
|
178
178
|
it 'is capable of decoding 8bit signed integers' do
|
179
|
-
output = TableValueDecoder.
|
180
|
-
output.should ==
|
179
|
+
output = TableValueDecoder.decode_byte("\xC0",0).first
|
180
|
+
output.should == 192
|
181
181
|
end
|
182
182
|
|
183
183
|
it 'is capable of decoding 16bit signed integers' do
|
@@ -67,6 +67,23 @@ module AMQ
|
|
67
67
|
value, offset = described_class.decode_32bit_float(data, 1)
|
68
68
|
value.should == 10.0
|
69
69
|
end
|
70
|
+
|
71
|
+
context "8bit/byte decoding" do
|
72
|
+
let(:examples) {
|
73
|
+
{
|
74
|
+
0x00 => "\x00",
|
75
|
+
0x01 => "\x01",
|
76
|
+
0x10 => "\x10",
|
77
|
+
255 => "\xFF" # not -1
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
it "is capable of decoding byte values" do
|
82
|
+
examples.each do |key, value|
|
83
|
+
described_class.decode_byte(value, 0).first.should == key
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
70
87
|
end
|
71
88
|
end
|
72
89
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amq-protocol
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jakub Stastny
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-12-
|
14
|
+
date: 2013-12-20 00:00:00.000000000 Z
|
15
15
|
dependencies: []
|
16
16
|
description: |2
|
17
17
|
amq-protocol is an AMQP 0.9.1 serialization library for Ruby. It is not an
|