[
https://issues.apache.org/jira/browse/THRIFT-782?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Conrad Hughes updated THRIFT-782:
---------------------------------
Attachment: perl_write_container.patch
Patch adding "$xfer +=" to relevant lines of
t_perl_generator::generate_serialize_container().
> Perl code for writing containers doesn't count length of write*Begin or
> write*End
> ---------------------------------------------------------------------------------
>
> Key: THRIFT-782
> URL: https://issues.apache.org/jira/browse/THRIFT-782
> Project: Thrift
> Issue Type: Bug
> Components: Compiler (Perl)
> Affects Versions: 0.2
> Environment: Debian Linux 5.0 (stable), Perl 5.10.0.
> Reporter: Conrad Hughes
> Priority: Minor
> Attachments: perl_write_container.patch
>
> Original Estimate: 0.5h
> Remaining Estimate: 0.5h
>
> The Perl code generator creates code for containers which doesn't count the
> length of their begin and end data, with the result that calling write on
> anything involving a map returns a length that's 6 bytes shorter than the
> actual amount written. The fix seems pretty obvious, adding {{$xfer +=}} to
> the relevant lines in {{t_perl_generator::generate_serialize_container()}}.
> Here's an example of *current* generated code for example - note the lack of
> {{$xfer +=}} before {{$output->writeMapBegin}} or {{...End}}:
> if (defined $self->{fname}) {
> $xfer += $output->writeFieldBegin('fname', TType::MAP, 3);
> {
> $output->writeMapBegin(TType::STRING, TType::STRING, scalar(keys
> %{$self->{fname}}));
> {
> while( my ($kiter7,$viter8) = each %{$self->{fname}})
> {
> $xfer += $output->writeString($kiter7);
> $xfer += $output->writeString($viter8);
> }
> }
> $output->writeMapEnd();
> }
> $xfer += $output->writeFieldEnd();
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.