Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-782

Perl code for writing containers doesn't count length of write*Begin or write*End

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.2
    • 0.4
    • Perl - Compiler
    • None
    • Debian Linux 5.0 (stable), Perl 5.10.0.

    • Patch Available

    Description

      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();
      }

      Attachments

        1. perl_write_container.patch
          2 kB
          Conrad Hughes

        Activity

          People

            conrad Conrad Hughes
            conrad Conrad Hughes
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 0.5h
                0.5h
                Remaining:
                Remaining Estimate - 0.5h
                0.5h
                Logged:
                Time Spent - Not Specified
                Not Specified