Skip to content

Commit

Permalink
Merge pull request DOCGroup#2306 from mitza-oci/warnings
Browse files Browse the repository at this point in the history
Fixed some warnings

(cherry picked from commit 5997007)

# Conflicts:
#	TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp
  • Loading branch information
mitza-oci committed Dec 13, 2024
1 parent e30e2e9 commit ca8a80c
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 46 deletions.
2 changes: 1 addition & 1 deletion TAO/TAO_IDL/be/be_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2322,7 +2322,7 @@ be_interface::copy_ctor_helper (be_interface *derived,
{
// We can't call ourselves in a copy constructor, and
// abstract interfaces don't exist on the skeleton side.
if (derived == base || base->is_abstract ())
if (derived == base || base->is_abstract () || derived->nmembers () > 0)
{
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ TAO_IDL_Copy_Ctor_Worker::emit (be_interface *derived,
TAO_OutStream *os,
be_interface *base)
{
if (derived == base)
if (derived == base || derived->nmembers () > 0)
{
return 0;
}
Expand Down
24 changes: 18 additions & 6 deletions TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,17 @@ be_visitor_interface_ss::visit_interface (be_interface *node)

*os << full_skel_name << "::"
<< local_name_prefix << node_local_name
<< " (void)" << be_idt_nl;
<< " ()";

*os << ": TAO_ServantBase ()" << be_uidt_nl;
bool const init_bases = node->nmembers () == 0;
if (init_bases)
{
*os << be_idt_nl << ": TAO_ServantBase ()" << be_uidt_nl;
}
else
{
*os << be_nl;
}

// Default constructor body.
*os << "{" << be_idt_nl
Expand All @@ -121,11 +129,15 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
*os << full_skel_name << "::"
<< local_name_prefix << node_local_name << " ("
<< "const " << local_name_prefix
<< node_local_name << "& rhs)";
<< node_local_name << " &"
<< (init_bases ? "rhs" : "") << ")";

*os << be_idt_nl
<< ": TAO_Abstract_ServantBase (rhs)," << be_nl
<< " TAO_ServantBase (rhs)";
if (init_bases)
{
*os << be_idt_nl
<< ": TAO_Abstract_ServantBase (rhs)," << be_nl
<< " TAO_ServantBase (rhs)";
}

if (this->generate_copy_ctor (node, os) == -1)
{
Expand Down
43 changes: 24 additions & 19 deletions TAO/tao/Bounded_Array_Sequence_T.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,33 +94,38 @@ class bounded_array_sequence
namespace TAO
{
template <typename stream, typename T_array, typename T_slice, typename T_tag, CORBA::ULong MAX>
bool demarshal_sequence(stream & strm, TAO::bounded_array_sequence<T_array, T_slice, T_tag, MAX> & target) {
bool demarshal_sequence (stream &strm, TAO::bounded_array_sequence<T_array, T_slice, T_tag, MAX> &target) {
typedef typename TAO::bounded_array_sequence<T_array, T_slice, T_tag, MAX> sequence;
typedef TAO_Array_Forany_T<T_array, T_slice, T_tag> forany;
typedef TAO::Array_Traits<forany> array_traits;

::CORBA::ULong new_length = 0;
if (!(strm >> new_length)) {
return false;
}
if ((new_length > strm.length()) || (new_length > target.maximum ())) {
return false;
}
sequence tmp;
tmp.length(new_length);
typename sequence::value_type * buffer = tmp.get_buffer();
for(CORBA::ULong i = 0; i < new_length; ++i) {
forany tmp (array_traits::alloc ());
bool const _tao_marshal_flag = (strm >> tmp);
if (_tao_marshal_flag) {
array_traits::copy (buffer[i], tmp.in ());
if (!(strm >> new_length))
{
return false;
}
array_traits::free (tmp.inout ());
if (!_tao_marshal_flag) {
if ((new_length > strm.length ()) || (new_length > target.maximum ()))
{
return false;
}
}
tmp.swap(target);
sequence tmp;
tmp.length (new_length);
typename sequence::value_type *const buffer = tmp.get_buffer ();
for (CORBA::ULong i = 0; i < new_length; ++i)
{
forany wrapper (array_traits::alloc ());
bool const _tao_marshal_flag = strm >> wrapper;
if (_tao_marshal_flag)
{
array_traits::copy (buffer[i], wrapper.in ());
}
array_traits::free (wrapper.inout ());
if (!_tao_marshal_flag)
{
return false;
}
}
tmp.swap (target);
return true;
}

Expand Down
43 changes: 24 additions & 19 deletions TAO/tao/Unbounded_Array_Sequence_T.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,33 +96,38 @@ class unbounded_array_sequence
namespace TAO
{
template <typename stream, typename T_array, typename T_slice, typename T_tag>
bool demarshal_sequence(stream & strm, TAO::unbounded_array_sequence<T_array, T_slice, T_tag> & target) {
bool demarshal_sequence (stream &strm, TAO::unbounded_array_sequence<T_array, T_slice, T_tag> &target) {
typedef TAO::unbounded_array_sequence<T_array, T_slice, T_tag> sequence;
typedef TAO_Array_Forany_T <T_array, T_slice, T_tag> forany;
typedef TAO::Array_Traits<forany> array_traits;

::CORBA::ULong new_length = 0;
if (!(strm >> new_length)) {
return false;
}
if (new_length > strm.length()) {
return false;
}
sequence tmp(new_length);
tmp.length(new_length);
typename sequence::value_type * buffer = tmp.get_buffer();
for(CORBA::ULong i = 0; i < new_length; ++i) {
forany tmp (array_traits::alloc ());
bool const _tao_marshal_flag = (strm >> tmp);
if (_tao_marshal_flag) {
array_traits::copy (buffer[i], tmp.in ());
if (!(strm >> new_length))
{
return false;
}
array_traits::free (tmp.inout ());
if (!_tao_marshal_flag) {
if (new_length > strm.length ())
{
return false;
}
}
tmp.swap(target);
sequence tmp (new_length);
tmp.length (new_length);
typename sequence::value_type *const buffer = tmp.get_buffer ();
for (CORBA::ULong i = 0; i < new_length; ++i)
{
forany wrapper (array_traits::alloc ());
bool const _tao_marshal_flag = strm >> wrapper;
if (_tao_marshal_flag)
{
array_traits::copy (buffer[i], wrapper.in ());
}
array_traits::free (wrapper.inout ());
if (!_tao_marshal_flag)
{
return false;
}
}
tmp.swap (target);
return true;
}

Expand Down

0 comments on commit ca8a80c

Please sign in to comment.