Skip to content

Commit

Permalink
fix improper encoding of packed info
Browse files Browse the repository at this point in the history
  • Loading branch information
bmizerany committed Jan 21, 2011
1 parent b4c5140 commit 86c2675
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/beefcake.rb
Expand Up @@ -72,7 +72,7 @@ def encode(buf = Buffer.new)
fields.values.sort.each do |fld|
if fld.opts[:packed]
bytes = encode!(Buffer.new, fld, 0)
buf.append_info(Buffer.wire_for(fld.type), fld.fn)
buf.append_info(fld.fn, Buffer.wire_for(fld.type))
buf.append_uint64(bytes.length)
buf << bytes
else
Expand Down
2 changes: 1 addition & 1 deletion test/message_test.rb
Expand Up @@ -184,7 +184,7 @@ def test_encode_packed_repeated_field
buf = Beefcake::Buffer.new

# Varint
buf.append_info(0, 1)
buf.append_info(1, 0)

# Give size in bytes
buf.append_uint64 5
Expand Down

0 comments on commit 86c2675

Please sign in to comment.