[
https://issues.apache.org/jira/browse/THRIFT-332?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Bryan Duxbury updated THRIFT-332:
---------------------------------
Attachment: thrift-332-v4.patch
bq. lib/rb/lib/thrift/transport.rb.orig is in the patch
I couldn't find this svn added anywhere. Maybe I fixed it already.
bq. I'm getting a failure I don't see in trunk: ...
I figured it out. The spec was mimicking a generated class incompletely.
bq. In write_double: ...
Yeah, this is the correct behavior. Compact Protocol defines little-endian
doubles on the wire.
bq. The 5 defines at the top also show up in binary_protocol_accelerated. Could
we move them into a .h?
Done. Added macros.h, both binary and compact share macros from there now.
bq. Is this going to hook into the native protocol hooks you wrote?
Ideally, yes. I ran into some weirdness trying to do that, and rather than
debug it then, I just wanted to get a patch on JIRA. I will take another look
at it though.
bq. I guess this is a general issue, but do we have a way to test both the
native and non-native bindings?
Yeah, I struggle with this issue too. Basically all you can do is comment out
the require of thrift_native in spec_helper.rb. I don't know if there's a
better way to go about it. We could have two "separate" protocol classes like
the binary protocol /accelerated stuff, but we still have struct.c and
memory_buffer.c in the mix, which cannot be separated.
bq. In rb_thrift_compact_proto_read_message_begin, the max length of buf for
PROTOCOL_ID is 51 and for VERSION is 50(string.gsub('%d', '4294967296').length
is 49 + 1 for zero termination). Make sure to null out the last byte, or
rb_str_new2 could include garbage.
I *think* I fixed this problem in this patch by actually reading the docs for
sprintf. Double check me, though - I am definitely not a c string master.
bq. Do you need the memcpy in rb_thrift_compact_proto_read_double? Can you just
cast instead?
Casting definitely did not work. I got rid of the memcpy though with an
explicit little-endian transform instead. This should be appropriately
cross-architecture.
> Compact Protocol in Ruby
> ------------------------
>
> Key: THRIFT-332
> URL: https://issues.apache.org/jira/browse/THRIFT-332
> Project: Thrift
> Issue Type: Sub-task
> Components: Library (Ruby)
> Reporter: Bryan Duxbury
> Assignee: Bryan Duxbury
> Priority: Trivial
> Attachments: thrift-332-v2.patch, thrift-332-v3.patch,
> thrift-332-v4.patch, thrift-332.patch
>
>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.