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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aa10f585162559fa1b74d9f406725745e96ac46b
4
- data.tar.gz: 017657dbecc96437ca9f28887e73df4d76d9df97
3
+ metadata.gz: 1df146ebd04eb15fc2d776b8dc7727da583ac8ba
4
+ data.tar.gz: 9ea0a0fadbc0f8d5bf4ae5b4cddb83263c12b51d
5
5
  SHA512:
6
- metadata.gz: 96631cb9c63b31649c309c1686ff5b26321e847ff0994c2a1bc007d54caa56e3fbe936bca7f56c809b812cd91d34bc94a9d84af582bb3d109a2310e5199d86ca
7
- data.tar.gz: e607e0fa90130e7e76847810ac100ba3de2692d20321f1e4e1601cda97bcd0e979aa62350ee1b1bd9a0ed0becac53882f0ce96bca45edec669507623a73c59a4
6
+ metadata.gz: dab13ac628ff6c896284702903b702549861e575cba274192802779387e7a2a64cd6126cb1d1fd722e3b5220982494419f2a77f249443807343689de6147ab2f
7
+ data.tar.gz: 1e5d034f65ec0ab257e0db1c30879bf29ac15519cda3fbf1b424417d504f5d70f8e8daac27b73fc566f3bc2d80fa65c5a0ae391a26155fa360c7042f310e3d6a
@@ -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
@@ -81,8 +81,8 @@ module AMQ
81
81
  when TYPE_BOOLEAN
82
82
  v, offset = TableValueDecoder.decode_boolean(data, offset)
83
83
  v
84
- when TYPE_SIGNED_8BIT then
85
- v, offset = TableValueDecoder.decode_short_short(data, offset)
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 TYPE_SIGNED_8BIT then
54
- v, offset = decode_short_short(data, 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
- def self.decode_short_short(data, offset)
178
- v = data.slice(offset, 1).unpack(PACK_INT8).first
179
- offset += 1
180
- [v, offset]
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
@@ -9,7 +9,7 @@ module AMQ
9
9
  TYPE_DECIMAL = 'D'.freeze
10
10
  TYPE_HASH = 'F'.freeze
11
11
  TYPE_ARRAY = 'A'.freeze
12
- TYPE_SIGNED_8BIT = 'b'.freeze
12
+ TYPE_BYTE = 'b'.freeze
13
13
  TYPE_64BIT_FLOAT = 'd'.freeze
14
14
  TYPE_32BIT_FLOAT = 'f'.freeze
15
15
  TYPE_SIGNED_64BIT = 'l'.freeze
@@ -1,5 +1,5 @@
1
1
  module AMQ
2
2
  module Protocol
3
- VERSION = "1.9.1"
3
+ VERSION = "1.9.2"
4
4
  end # Protocol
5
5
  end # AMQ
@@ -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.decode_short_short("\xC0",0).first
180
- output.should == -64
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.1
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-18 00:00:00.000000000 Z
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