codegen/protocol.rb.pytemplate in amq-protocol-2.0.1 vs codegen/protocol.rb.pytemplate in amq-protocol-2.1.0

- old
+ new

@@ -112,11 +112,11 @@ # Otherwise String#slice on 1.9 will operate with code points, # and we need bytes. MK. body.force_encoding("ASCII-8BIT") if RUBY_VERSION.to_f >= 1.9 array = Array.new - while body + while body && !body.empty? payload, body = body[0, limit], body[limit, body.length - limit] array << BodyFrame.new(payload, channel) end array @@ -165,11 +165,12 @@ # result = [${klass.index}, 0, body_size, flags].pack('n2Qn') 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 DECODE_PROPERTIES = { % for f in klass.fields: @@ -233,11 +234,11 @@ @packed_indexes = [${klass.index}, ${method.index}].pack(PACK_UINT16_X2).freeze % 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 % if (method.klass.name == "connection" or method.klass.name == "channel") and method.name == "close": self.new(${', '.join([f.ruby_name for f in method.arguments])}) @@ -283,10 +284,10 @@ ${line} % endfor % 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 properties_payload = Basic.encode_properties(payload.bytesize, properties) frames << HeaderFrame.new(properties_payload, channel)