Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buffer.wire_for doesn't cope with packed+repeated fields #61

Open
systemed opened this issue Dec 26, 2014 · 1 comment
Open

Buffer.wire_for doesn't cope with packed+repeated fields #61

systemed opened this issue Dec 26, 2014 · 1 comment

Comments

@systemed
Copy link

The wire type for packed, repeated fields is 2 (reference).

Currently, Buffer.wire_for parses the field type only, regardless of whether the field is packed+repeated. It'll therefore fail when decoding a packed+repeated field.

Quick fix is to add an extra line to Decode.decode in beefcake.rb:

      exp = Buffer.wire_for(fld.type)
      if fld.rule == :repeated && fld.opts[:packed] then exp = 2 end
@systemed
Copy link
Author

A similar fix also needs to be applied to Encode.encode which, again, currently encodes as 0 when it should encode as 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant