You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by br...@apache.org on 2010/08/06 00:28:13 UTC

svn commit: r982812 - /incubator/thrift/trunk/compiler/cpp/src/generate/t_perl_generator.cc

Author: bryanduxbury
Date: Thu Aug  5 22:28:13 2010
New Revision: 982812

URL: http://svn.apache.org/viewvc?rev=982812&view=rev
Log:
THRIFT-782. perl: Perl code for writing containers doesn't count length of write*Begin or write*End

This patch adds appropriate accounting of the start and end bytes when writing out container types.
Patch: Conrad Hughes

Modified:
    incubator/thrift/trunk/compiler/cpp/src/generate/t_perl_generator.cc

Modified: incubator/thrift/trunk/compiler/cpp/src/generate/t_perl_generator.cc
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/generate/t_perl_generator.cc?rev=982812&r1=982811&r2=982812&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/generate/t_perl_generator.cc (original)
+++ incubator/thrift/trunk/compiler/cpp/src/generate/t_perl_generator.cc Thu Aug  5 22:28:13 2010
@@ -1576,20 +1576,20 @@ void t_perl_generator::generate_serializ
 
   if (ttype->is_map()) {
     indent(out) <<
-      "$output->writeMapBegin(" <<
+      "$xfer += $output->writeMapBegin(" <<
       type_to_enum(((t_map*)ttype)->get_key_type()) << ", " <<
       type_to_enum(((t_map*)ttype)->get_val_type()) << ", " <<
       "scalar(keys %{$" << prefix << "}));" << endl;
   } else if (ttype->is_set()) {
     indent(out) <<
-      "$output->writeSetBegin(" <<
+      "$xfer += $output->writeSetBegin(" <<
       type_to_enum(((t_set*)ttype)->get_elem_type()) << ", " <<
       "scalar(@{$" << prefix << "}));" << endl;
 
   } else if (ttype->is_list()) {
 
     indent(out) <<
-      "$output->writeListBegin(" <<
+      "$xfer += $output->writeListBegin(" <<
       type_to_enum(((t_list*)ttype)->get_elem_type()) << ", " <<
       "scalar(@{$" << prefix << "}));" << endl;
 
@@ -1629,13 +1629,13 @@ void t_perl_generator::generate_serializ
 
   if (ttype->is_map()) {
     indent(out) <<
-      "$output->writeMapEnd();" << endl;
+      "$xfer += $output->writeMapEnd();" << endl;
   } else if (ttype->is_set()) {
     indent(out) <<
-      "$output->writeSetEnd();" << endl;
+      "$xfer += $output->writeSetEnd();" << endl;
   } else if (ttype->is_list()) {
     indent(out) <<
-      "$output->writeListEnd();" << endl;
+      "$xfer += $output->writeListEnd();" << endl;
   }
 
   scope_down(out);