Skip to content

Commit

Permalink
Merge branch 'amatsuda-⚠️'
Browse files Browse the repository at this point in the history
Seriously, emoji in branch names are cute but make it harder
to work with in various terminals.
  • Loading branch information
michaelklishin committed Jan 26, 2017
2 parents c292d82 + 4e26ff7 commit dd48b32
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 50 deletions.
7 changes: 4 additions & 3 deletions codegen/protocol.rb.pytemplate
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ module AMQ
result = [${klass.index}, 0].pack(PACK_UINT16_X2)
result += AMQ::Pack.pack_uint64_big_endian(body_size)
result += [flags].pack(PACK_UINT16)
result + pieces.join(EMPTY_STRING)
pieces_joined = pieces.join(EMPTY_STRING)
result.force_encoding(pieces_joined.encoding) + pieces_joined
end

# THIS DECODES ONLY FLAGS
Expand Down Expand Up @@ -235,7 +236,7 @@ module AMQ
% if (spec.type == "client" and method.accepted_by("client")) or (spec.type == "server" and method.accepted_by("server") or spec.type == "all"):
# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
% for line in helpers.genDecodeMethodDefinition(spec, method):
${line}
% endfor
Expand Down Expand Up @@ -285,7 +286,7 @@ module AMQ
% if "payload" in method.args() or "user_headers" in method.args():
frames = [MethodFrame.new(buffer, channel)]
% if "user_headers" in method.args():
properties, headers = self.split_headers(user_headers)
properties, _headers = self.split_headers(user_headers)
if properties.nil? or properties.empty?
raise RuntimeError.new("Properties can not be empty!")
end
Expand Down
78 changes: 39 additions & 39 deletions lib/amq/protocol/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class Start < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
version_major = data[offset, 1].unpack(PACK_CHAR).first
offset += 1
version_minor = data[offset, 1].unpack(PACK_CHAR).first
Expand Down Expand Up @@ -275,7 +275,7 @@ class Secure < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
length = data[offset, 4].unpack(PACK_UINT32).first
offset += 4
challenge = data[offset, length]
Expand Down Expand Up @@ -326,7 +326,7 @@ class Tune < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
channel_max = data[offset, 2].unpack(PACK_UINT16).first
offset += 2
frame_max = data[offset, 4].unpack(PACK_UINT32).first
Expand Down Expand Up @@ -412,7 +412,7 @@ class OpenOk < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
length = data[offset, 1].unpack(PACK_CHAR).first
offset += 1
known_hosts = data[offset, length]
Expand Down Expand Up @@ -440,7 +440,7 @@ class Close < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
reply_code = data[offset, 2].unpack(PACK_UINT16).first
offset += 2
length = data[offset, 1].unpack(PACK_CHAR).first
Expand Down Expand Up @@ -489,7 +489,7 @@ class CloseOk < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
self.new()
end

Expand Down Expand Up @@ -518,7 +518,7 @@ class Blocked < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
length = data[offset, 1].unpack(PACK_CHAR).first
offset += 1
reason = data[offset, length]
Expand Down Expand Up @@ -555,7 +555,7 @@ class Unblocked < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
self.new()
end

Expand Down Expand Up @@ -614,7 +614,7 @@ class OpenOk < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
length = data[offset, 4].unpack(PACK_UINT32).first
offset += 4
channel_id = data[offset, length]
Expand Down Expand Up @@ -642,7 +642,7 @@ class Flow < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
bit_buffer = data[offset, 1].unpack(PACK_CHAR).first
offset += 1
active = (bit_buffer & (1 << 0)) != 0
Expand Down Expand Up @@ -678,7 +678,7 @@ class FlowOk < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
bit_buffer = data[offset, 1].unpack(PACK_CHAR).first
offset += 1
active = (bit_buffer & (1 << 0)) != 0
Expand Down Expand Up @@ -714,7 +714,7 @@ class Close < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
reply_code = data[offset, 2].unpack(PACK_UINT16).first
offset += 2
length = data[offset, 1].unpack(PACK_CHAR).first
Expand Down Expand Up @@ -762,7 +762,7 @@ class CloseOk < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
self.new()
end

Expand Down Expand Up @@ -832,7 +832,7 @@ class DeclareOk < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
self.new()
end

Expand Down Expand Up @@ -882,7 +882,7 @@ class DeleteOk < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
self.new()
end

Expand Down Expand Up @@ -936,7 +936,7 @@ class BindOk < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
self.new()
end

Expand Down Expand Up @@ -990,7 +990,7 @@ class UnbindOk < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
self.new()
end

Expand Down Expand Up @@ -1052,7 +1052,7 @@ class DeclareOk < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
length = data[offset, 1].unpack(PACK_CHAR).first
offset += 1
queue = data[offset, length]
Expand Down Expand Up @@ -1118,7 +1118,7 @@ class BindOk < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
self.new()
end

Expand Down Expand Up @@ -1167,7 +1167,7 @@ class PurgeOk < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
message_count = data[offset, 4].unpack(PACK_UINT32).first
offset += 4
self.new(message_count)
Expand Down Expand Up @@ -1222,7 +1222,7 @@ class DeleteOk < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
message_count = data[offset, 4].unpack(PACK_UINT32).first
offset += 4
self.new(message_count)
Expand Down Expand Up @@ -1277,7 +1277,7 @@ class UnbindOk < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
self.new()
end

Expand Down Expand Up @@ -1561,7 +1561,7 @@ class QosOk < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
self.new()
end

Expand Down Expand Up @@ -1616,7 +1616,7 @@ class ConsumeOk < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
length = data[offset, 1].unpack(PACK_CHAR).first
offset += 1
consumer_tag = data[offset, length]
Expand Down Expand Up @@ -1644,7 +1644,7 @@ class Cancel < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
length = data[offset, 1].unpack(PACK_CHAR).first
offset += 1
consumer_tag = data[offset, length]
Expand Down Expand Up @@ -1687,7 +1687,7 @@ class CancelOk < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
length = data[offset, 1].unpack(PACK_CHAR).first
offset += 1
consumer_tag = data[offset, length]
Expand Down Expand Up @@ -1733,7 +1733,7 @@ def self.encode(channel, payload, user_headers, exchange, routing_key, mandatory
bit_buffer = bit_buffer | (1 << 1) if immediate
buffer << [bit_buffer].pack(PACK_CHAR)
frames = [MethodFrame.new(buffer, channel)]
properties, headers = self.split_headers(user_headers)
properties, _headers = self.split_headers(user_headers)
if properties.nil? or properties.empty?
raise RuntimeError.new("Properties can not be empty!")
end
Expand All @@ -1753,7 +1753,7 @@ class Return < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
reply_code = data[offset, 2].unpack(PACK_UINT16).first
offset += 2
length = data[offset, 1].unpack(PACK_CHAR).first
Expand Down Expand Up @@ -1794,7 +1794,7 @@ class Deliver < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
length = data[offset, 1].unpack(PACK_CHAR).first
offset += 1
consumer_tag = data[offset, length]
Expand Down Expand Up @@ -1866,7 +1866,7 @@ class GetOk < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
delivery_tag = AMQ::Pack.unpack_uint64_big_endian(data[offset, 8]).first
offset += 8
bit_buffer = data[offset, 1].unpack(PACK_CHAR).first
Expand Down Expand Up @@ -1909,7 +1909,7 @@ class GetEmpty < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
length = data[offset, 1].unpack(PACK_CHAR).first
offset += 1
cluster_id = data[offset, length]
Expand Down Expand Up @@ -1937,7 +1937,7 @@ class Ack < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
delivery_tag = AMQ::Pack.unpack_uint64_big_endian(data[offset, 8]).first
offset += 8
bit_buffer = data[offset, 1].unpack(PACK_CHAR).first
Expand Down Expand Up @@ -2047,7 +2047,7 @@ class RecoverOk < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
self.new()
end

Expand All @@ -2069,7 +2069,7 @@ class Nack < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
delivery_tag = AMQ::Pack.unpack_uint64_big_endian(data[offset, 8]).first
offset += 8
bit_buffer = data[offset, 1].unpack(PACK_CHAR).first
Expand Down Expand Up @@ -2140,7 +2140,7 @@ class SelectOk < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
self.new()
end

Expand Down Expand Up @@ -2182,7 +2182,7 @@ class CommitOk < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
self.new()
end

Expand Down Expand Up @@ -2224,7 +2224,7 @@ class RollbackOk < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
self.new()
end

Expand Down Expand Up @@ -2254,7 +2254,7 @@ class Select < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
bit_buffer = data[offset, 1].unpack(PACK_CHAR).first
offset += 1
nowait = (bit_buffer & (1 << 0)) != 0
Expand Down Expand Up @@ -2290,7 +2290,7 @@ class SelectOk < Protocol::Method

# @return
def self.decode(data)
offset = 0
offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
self.new()
end

Expand Down
1 change: 0 additions & 1 deletion lib/amq/protocol/table.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# encoding: binary

require "amq/protocol/client"
require "amq/protocol/type_constants"
require "amq/protocol/table_value_encoder"
require "amq/protocol/table_value_decoder"
Expand Down
2 changes: 0 additions & 2 deletions lib/amq/protocol/table_value_decoder.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# encoding: binary

require "amq/endianness"
require "amq/protocol/client"
require "amq/protocol/type_constants"
require "amq/protocol/table"
require "amq/protocol/float_32bit"

module AMQ
Expand Down
Loading

0 comments on commit dd48b32

Please sign in to comment.