@@ -1576,7 +1576,12 @@ void t_yarp_generator::generate_deserialize_container(std::ostringstream& f_cpp_
15761576{
15771577 THRIFT_DEBUG_COMMENT (f_cpp_);
15781578
1579- if (ttype->is_map ()) {
1579+ if (ttype->is_map ())
1580+ {
1581+ // Begin scope of _csize
1582+ f_cpp_ << indent_cpp () << " {\n " ;
1583+ indent_up_cpp ();
1584+
15801585 f_cpp_ << indent_cpp () << " size_t _csize;\n " ;
15811586 // kttpe and vtype available
15821587 f_cpp_ << indent_cpp () << " yarp::os::idl::WireState _ktype;\n " ;
@@ -1595,7 +1600,16 @@ void t_yarp_generator::generate_deserialize_container(std::ostringstream& f_cpp_
15951600 // Read container end
15961601 f_cpp_ << indent_cpp () << " reader.readMapEnd();\n " ;
15971602
1598- } else if (ttype->is_set ()) {
1603+ // End scope of _csize
1604+ indent_down_cpp ();
1605+ f_cpp_ << indent_cpp () << " }\n " ;
1606+ }
1607+ else if (ttype->is_set ())
1608+ {
1609+ // Begin scope of _csize
1610+ f_cpp_ << indent_cpp () << " {\n " ;
1611+ indent_up_cpp ();
1612+
15991613 f_cpp_ << indent_cpp () << " size_t _csize;\n " ;
16001614 f_cpp_ << indent_cpp () << " yarp::os::idl::WireState _etype;\n " ;
16011615 f_cpp_ << indent_cpp () << " reader.readSetBegin(_etype, _csize);\n " ;
@@ -1612,11 +1626,20 @@ void t_yarp_generator::generate_deserialize_container(std::ostringstream& f_cpp_
16121626 // Read container end
16131627 f_cpp_ << indent_cpp () << " reader.readSetEnd();\n " ;
16141628
1615- } else if (ttype->is_list ()) {
1629+ // End scope of _csize
1630+ indent_down_cpp ();
1631+ f_cpp_ << indent_cpp () << " }\n " ;
1632+ }
1633+ else if (ttype->is_list ())
1634+ {
16161635 t_container* tcontainer = static_cast <t_container*>(ttype);
16171636 auto * elem_type = static_cast <t_list*>(ttype)->get_elem_type ();
16181637 bool use_push = tcontainer->has_cpp_name () || (static_cast <t_base_type*>(elem_type)->get_base () == t_base_type::TYPE_BOOL );
16191638
1639+ // Begin scope of _csize
1640+ f_cpp_ << indent_cpp () << " {\n " ;
1641+ indent_up_cpp ();
1642+
16201643 f_cpp_ << indent_cpp () << " size_t _csize;\n " ;
16211644 f_cpp_ << indent_cpp () << " yarp::os::idl::WireState _etype;\n " ;
16221645 f_cpp_ << indent_cpp () << " reader.readListBegin(_etype, _csize);\n " ;
@@ -1671,6 +1694,10 @@ void t_yarp_generator::generate_deserialize_container(std::ostringstream& f_cpp_
16711694
16721695 // Read container end
16731696 f_cpp_ << indent_cpp () << " reader.readListEnd();\n " ;
1697+
1698+ // End scope of _csize
1699+ indent_down_cpp ();
1700+ f_cpp_ << indent_cpp () << " }\n " ;
16741701 }
16751702}
16761703
0 commit comments