You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Bryan Duxbury (JIRA)" <ji...@apache.org> on 2010/08/06 00:31:24 UTC

[jira] Closed: (THRIFT-782) Perl code for writing containers doesn't count length of write*Begin or write*End

     [ https://issues.apache.org/jira/browse/THRIFT-782?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Duxbury closed THRIFT-782.
--------------------------------

    Fix Version/s: 0.4
       Resolution: Fixed

This patch looks good to me. I just committed this. Thank for the patch, Conrad!

> 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
>             Fix For: 0.4
>
>         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.