diff options
-rw-r--r-- | TAO/ChangeLog-98c | 36 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_array/any_op_cs.cpp | 10 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_enum/any_op_cs.cpp | 5 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp | 12 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp | 12 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp | 11 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp | 12 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp | 12 | ||||
-rw-r--r-- | TAO/docs/Options.html | 2 | ||||
-rw-r--r-- | TAO/tao/Any.cpp | 4 | ||||
-rw-r--r-- | TAO/tao/CurrentC.cpp | 5 | ||||
-rw-r--r-- | TAO/tao/IIOP_Object.cpp | 30 | ||||
-rw-r--r-- | TAO/tao/NVList.cpp | 14 | ||||
-rw-r--r-- | TAO/tao/POAC.cpp | 70 | ||||
-rw-r--r-- | TAO/tao/Server_Request.cpp | 54 | ||||
-rw-r--r-- | TAO/tao/append.cpp | 5 | ||||
-rw-r--r-- | TAO/tao/decode.cpp | 3 | ||||
-rw-r--r-- | TAO/tao/deep_copy.cpp | 3 | ||||
-rw-r--r-- | TAO/tao/deep_free.cpp | 3 | ||||
-rw-r--r-- | TAO/tao/encode.cpp | 9 | ||||
-rw-r--r-- | TAO/tao/skip.cpp | 3 |
21 files changed, 179 insertions, 136 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c index 7fb9fda7033..e1589138e14 100644 --- a/TAO/ChangeLog-98c +++ b/TAO/ChangeLog-98c @@ -1,3 +1,39 @@ +Wed Jul 22 10:07:17 1998 Carlos O'Ryan <coryan@cs.wustl.edu> + + * tao/Any.cpp: + * tao/CurrentC.cpp: + * tao/IIOP_Object.cpp: + * tao/NVList.cpp: + * tao/POAC.cpp: + * tao/Server_Request.cpp: + * tao/append.cpp: + * tao/decode.cpp: + * tao/deep_copy.cpp: + * tao/deep_free.cpp: + * tao/encode.cpp: + * tao/skip.cpp: + Callers to Any::type should be careful to release the + TypeCode_ptr it returns. + + * TAO_IDL/be/be_visitor_union/any_op_cs.cpp: + * TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp: + * TAO_IDL/be/be_visitor_interface/any_op_cs.cpp: + * TAO_IDL/be/be_visitor_exception/any_op_cs.cpp: + * TAO_IDL/be/be_visitor_enum/any_op_cs.cpp: + * TAO_IDL/be/be_visitor_array/any_op_cs.cpp: + * TAO_IDL/be/be_visitor_structure/any_op_cs.cpp: + The >>= was using Any::type() but not realeasing the memory that + method returns. We stick the result into a _var. I also added + a small optimization: for some types the >>= operator uses + replace() to change the contents of the Any (thus minimizing + future memory allocation and demarshalling), but it reused the + Any typecode, usually obtained from the wire; now we use the + global Typecode, in an attempt to free memory ASAP inside the + ORB. + + * docs/Options.html: + The info about the -ORBpoalock default value was wrong. + Wed Jul 22 08:56:34 1998 Aniruddha Gokhale <gokhale@mambo.cs.wustl.edu> * TAO_IDL/be_include/be_interface.h diff --git a/TAO/TAO_IDL/be/be_visitor_array/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_array/any_op_cs.cpp index 2a9c2fb903b..3a71d919239 100644 --- a/TAO/TAO_IDL/be/be_visitor_array/any_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_array/any_op_cs.cpp @@ -61,13 +61,14 @@ be_visitor_array_any_op_cs::visit_array (be_array *node) << "else // copy" << be_idt_nl << "_tao_any.replace (" << node->tc_name () << ", " << node->name () << "_dup (_tao_elem.ptr ()), 1, _tao_env);" << be_uidt_nl - << be_uidt_nl << "}" << be_nl; + << be_uidt_nl << "}\n" << be_nl; *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, " << node->name () << "_forany &_tao_elem)" << be_nl << "{" << be_idt_nl << "CORBA::Environment _tao_env;" << be_nl - << "if (!_tao_any.type ()->equal (" << node->tc_name () + << "CORBA::TypeCode_var type = _tao_any.type ();" << be_nl + << "if (!type->equal (" << node->tc_name () << ", _tao_env)) return 0; // not equal" << be_nl << "if (_tao_any.any_owns_data ())" << be_nl << "{" << be_idt_nl @@ -80,9 +81,8 @@ be_visitor_array_any_op_cs::visit_array (be_array *node) << ", _tao_elem_ptr, 0, _tao_env)" << be_nl << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl << "{" << be_idt_nl - << "((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), " - << "_tao_elem_ptr, 1, _tao_env);" - << be_nl + << "((CORBA::Any *)&_tao_any)->replace (" + << node->tc_name () << ", _tao_elem_ptr, 1, _tao_env);" << be_nl << " return 1;" << be_uidt_nl << "}" << be_nl << "else" << be_nl // decode failed diff --git a/TAO/TAO_IDL/be/be_visitor_enum/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_enum/any_op_cs.cpp index e24522eef1a..0f05d7e5c3e 100644 --- a/TAO/TAO_IDL/be/be_visitor_enum/any_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_enum/any_op_cs.cpp @@ -56,13 +56,14 @@ be_visitor_enum_any_op_cs::visit_enum (be_enum *node) << "CORBA::Environment _tao_env;" << be_nl << "_tao_any.replace (" << node->tc_name () << ", new " << node->name () << "(_tao_elem), 1, _tao_env);" << be_uidt_nl - << "}" << be_nl; + << "}\n" << be_nl; *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, " << node->name () << " &_tao_elem)" << be_nl << "{" << be_idt_nl << "CORBA::Environment _tao_env;" << be_nl - << "if (!_tao_any.type ()->equal (" << node->tc_name () + << "CORBA::TypeCode_var type = _tao_any.type ();" << be_nl + << "if (!type->equal (" << node->tc_name () << ", _tao_env)) return 0; // not equal" << be_nl << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());" << be_nl diff --git a/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp index 652f7c991d7..6d2850202c9 100644 --- a/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp @@ -57,7 +57,7 @@ be_visitor_exception_any_op_cs::visit_exception (be_exception *node) << "CORBA::Environment _tao_env;" << be_nl << "_tao_any.replace (" << node->tc_name () << ", new " << node->name () << "(_tao_elem), 1, _tao_env);" << be_uidt_nl - << "}" << be_nl; + << "}\n" << be_nl; *os << "void operator<<= (CORBA::Any &_tao_any, " << node->name () << " *_tao_elem) // non copying" << be_nl @@ -65,13 +65,14 @@ be_visitor_exception_any_op_cs::visit_exception (be_exception *node) << "CORBA::Environment _tao_env;" << be_nl << "_tao_any.replace (" << node->tc_name () << ", " << "_tao_elem, 1, _tao_env); // consume it" << be_uidt_nl - << "}" << be_nl; + << "}\n" << be_nl; *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, " << node->name () << " *&_tao_elem)" << be_nl << "{" << be_idt_nl << "CORBA::Environment _tao_env;" << be_nl - << "if (!_tao_any.type ()->equal (" << node->tc_name () + << "CORBA::TypeCode_var type = _tao_any.type ();" << be_nl + << "if (!type->equal (" << node->tc_name () << ", _tao_env)) return 0; // not equal" << be_nl << "if (_tao_any.any_owns_data ())" << be_nl << "{" << be_idt_nl @@ -83,9 +84,8 @@ be_visitor_exception_any_op_cs::visit_exception (be_exception *node) << ", _tao_elem, 0, _tao_env)" << be_nl << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl << "{" << be_idt_nl - << "((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), " - << "_tao_elem, 1, _tao_env);" - << be_nl + << "((CORBA::Any *)&_tao_any)->replace (" + << node->tc_name () << ", _tao_elem, 1, _tao_env);" << be_nl << " return 1;" << be_uidt_nl << "}" << be_nl << "else" << be_nl // decode failed diff --git a/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp index 0fd468600e8..f6b5520587c 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp @@ -62,7 +62,7 @@ be_visitor_interface_any_op_cs::visit_interface (be_interface *node) << "::_duplicate (_tao_elem);" << be_nl << "_tao_any.replace (" << node->tc_name () << ", " << "_tao_obj_ptr, 1, _tao_env);" << be_uidt_nl - << "}" << be_nl; + << "}\n" << be_nl; *os << "void operator<<= (CORBA::Any &_tao_any, " << node->name () << "_ptr *_tao_elem) // non copying" << be_nl @@ -70,14 +70,15 @@ be_visitor_interface_any_op_cs::visit_interface (be_interface *node) << "CORBA::Environment _tao_env;" << be_nl << "_tao_any.replace (" << node->tc_name () << ", " << "_tao_elem, 1, _tao_env); // consume it" << be_uidt_nl - << "}" << be_nl; + << "}\n" << be_nl; *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, " << node->name () << "_ptr &_tao_elem)" << be_nl << "{" << be_idt_nl << "CORBA::Environment _tao_env;" << be_nl << "_tao_elem = " << node->name () << "::_nil ();" << be_nl - << "if (!_tao_any.type ()->equal (" << node->tc_name () + << "CORBA::TypeCode_var type = _tao_any.type ();" << be_nl + << "if (!type->equal (" << node->tc_name () << ", _tao_env)) return 0; // not equal" << be_nl << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());" << be_nl @@ -92,9 +93,8 @@ be_visitor_interface_any_op_cs::visit_interface (be_interface *node) << "if (_tao_env.exception ()) return 0; // narrow failed" << be_nl << "CORBA::release (*_tao_obj_ptr);" << be_nl << "*_tao_obj_ptr = _tao_elem;" << be_nl - << "((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), " - << "_tao_obj_ptr, 1, _tao_env);" - << be_nl + << "((CORBA::Any *)&_tao_any)->replace (" + << node->tc_name () << ", _tao_obj_ptr, 1, _tao_env);" << be_nl << "if (_tao_env.exception ()) return 0; // narrow failed" << be_nl << "return 1;" << be_uidt_nl << "}" << be_nl diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp index 1533b67856c..a2985a8bb25 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp @@ -57,7 +57,7 @@ be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node) << "_tao_any.replace (" << node->tc_name () << ", new " << node->name () << "(_tao_elem), 1, _tao_env);" << " // copy the value" << be_uidt_nl - << "}" << be_nl; + << "}\n" << be_nl; *os << "void operator<<= (CORBA::Any &_tao_any, " << node->name () << " *_tao_elem) // non copying" << be_nl @@ -65,13 +65,14 @@ be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node) << "CORBA::Environment _tao_env;" << be_nl << "_tao_any.replace (" << node->tc_name () << ", " << "_tao_elem, 0, _tao_env);" << be_uidt_nl - << "}" << be_nl; + << "}\n" << be_nl; *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, " << node->name () << " *&_tao_elem)" << be_nl << "{" << be_idt_nl << "CORBA::Environment _tao_env;" << be_nl - << "if (!_tao_any.type ()->equal (" << node->tc_name () + << "CORBA::TypeCode_var type = _tao_any.type ();" << be_nl + << "if (!type->equal (" << node->tc_name () << ", _tao_env)) return 0; // not equal" << be_nl << "if (_tao_any.any_owns_data ())" << be_nl << "{" << be_idt_nl @@ -83,8 +84,8 @@ be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node) << ", _tao_elem, 0, _tao_env)" << be_nl << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl << "{" << be_idt_nl - << "((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), " - << "_tao_elem, 1, _tao_env);" + << "((CORBA::Any *)&_tao_any)->replace (" + << node->tc_name () << ", _tao_elem, 1, _tao_env);" << be_nl << " return 1;" << be_uidt_nl << "}" << be_nl diff --git a/TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp index 43078696baa..c1f5c82f0ff 100644 --- a/TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp @@ -58,7 +58,7 @@ be_visitor_structure_any_op_cs::visit_structure (be_structure *node) << "_tao_any.replace (" << node->tc_name () << ", new " << node->name () << "(_tao_elem), 1, _tao_env);" << " // copy the value" << be_uidt_nl - << "}" << be_nl; + << "}\n" << be_nl; *os << "void operator<<= (CORBA::Any &_tao_any, " << node->name () << " *_tao_elem) // non copying" << be_nl @@ -66,13 +66,14 @@ be_visitor_structure_any_op_cs::visit_structure (be_structure *node) << "CORBA::Environment _tao_env;" << be_nl << "_tao_any.replace (" << node->tc_name () << ", " << "_tao_elem, 1, _tao_env); // consume it" << be_uidt_nl - << "}" << be_nl; + << "}\n" << be_nl; *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, " << node->name () << " *&_tao_elem)" << be_nl << "{" << be_idt_nl << "CORBA::Environment _tao_env;" << be_nl - << "if (!_tao_any.type ()->equal (" << node->tc_name () + << "CORBA::TypeCode_var type = _tao_any.type ();" << be_nl + << "if (!type->equal (" << node->tc_name () << ", _tao_env)) return 0; // not equal" << be_nl << "if (_tao_any.any_owns_data ())" << be_nl << "{" << be_idt_nl @@ -84,9 +85,8 @@ be_visitor_structure_any_op_cs::visit_structure (be_structure *node) << ", _tao_elem, 0, _tao_env)" << be_nl << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl << "{" << be_idt_nl - << "((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), " - << "_tao_elem, 1, _tao_env);" - << be_nl + << "((CORBA::Any *)&_tao_any)->replace (" + << node->tc_name () << ", _tao_elem, 1, _tao_env);" << be_nl << " return 1;" << be_uidt_nl << "}" << be_nl << "else" << be_nl // decode failed diff --git a/TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp index 78e2fca68d3..ac5b5aeb2ab 100644 --- a/TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp @@ -56,7 +56,7 @@ be_visitor_union_any_op_cs::visit_union (be_union *node) << "CORBA::Environment _tao_env;" << be_nl << "_tao_any.replace (" << node->tc_name () << ", new " << node->name () << "(_tao_elem), 1, _tao_env);" << be_uidt_nl - << "}" << be_nl; + << "}\n" << be_nl; *os << "void operator<<= (CORBA::Any &_tao_any, " << node->name () << " *_tao_elem) // non copying" << be_nl @@ -64,13 +64,14 @@ be_visitor_union_any_op_cs::visit_union (be_union *node) << "CORBA::Environment _tao_env;" << be_nl << "_tao_any.replace (" << node->tc_name () << ", " << "_tao_elem, 1, _tao_env); // consume it" << be_uidt_nl - << "}" << be_nl; + << "}\n" << be_nl; *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, " << node->name () << " *&_tao_elem)" << be_nl << "{" << be_idt_nl << "CORBA::Environment _tao_env;" << be_nl - << "if (!_tao_any.type ()->equal (" << node->tc_name () + << "CORBA::TypeCode_var type = _tao_any.type ();" << be_nl + << "if (!type->equal (" << node->tc_name () << ", _tao_env)) return 0; // not equal" << be_nl << "if (_tao_any.any_owns_data ())" << be_nl << "{" << be_idt_nl @@ -82,9 +83,8 @@ be_visitor_union_any_op_cs::visit_union (be_union *node) << ", _tao_elem, 0, _tao_env)" << be_nl << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl << "{" << be_idt_nl - << "((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), " - << "_tao_elem, 1, _tao_env);" - << be_nl + << "((CORBA::Any *)&_tao_any)->replace (" + << node->tc_name () << ", _tao_elem, 1, _tao_env);" << be_nl << " return 1;" << be_uidt_nl << "}" << be_nl << "else" << be_nl // decode failed diff --git a/TAO/docs/Options.html b/TAO/docs/Options.html index e3ce4258306..fad9ef02e3d 100644 --- a/TAO/docs/Options.html +++ b/TAO/docs/Options.html @@ -236,7 +236,7 @@ POA accesses. Possible values for <em>lock type</em> are <code>thread</code>, which specifies that an inter-thread mutex is used to guarantee exclusive acccess, and <code>null</code>, which specifies that no locking be performed. The default is -<code>null</code>.</TD></TR> +<code>thread</code>.</TD></TR> <TR> <TD><CODE>-ORBcoltbllock</CODE> <EM>lock type</EM></TD> <TD><a name="-ORBtoltbllock"></a>Specify the type of lock to be used for diff --git a/TAO/tao/Any.cpp b/TAO/tao/Any.cpp index fd91bef79c1..6458363a2b0 100644 --- a/TAO/tao/Any.cpp +++ b/TAO/tao/Any.cpp @@ -29,8 +29,6 @@ // be manipulated concurrently when the underlying programming // environment is itself reentrant. // -// COM NOTE: Yes, this is a utility data type whose implementation is -// fully exposed. Factories for these are not normally used in C++. #include "tao/corba.h" @@ -651,7 +649,7 @@ void CORBA_Any::dump (const CORBA::Any any_value) { // Get the type. - CORBA::TypeCode_ptr type = any_value.type (); + CORBA::TypeCode_var type = any_value.type (); if (type == CORBA::_tc_null) ACE_DEBUG ((LM_DEBUG,"Null\n")); diff --git a/TAO/tao/CurrentC.cpp b/TAO/tao/CurrentC.cpp index 2105885d690..8bb90837831 100644 --- a/TAO/tao/CurrentC.cpp +++ b/TAO/tao/CurrentC.cpp @@ -87,7 +87,8 @@ CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA_Current_ptr &_tao_ { CORBA::Environment _tao_env; _tao_elem = CORBA_Current::_nil (); - if (!_tao_any.type ()->equal (CORBA::_tc_Current, _tao_env)) return 0; // not equal + CORBA::TypeCode_var type = _tao_any.type (); + if (!type->equal (CORBA::_tc_Current, _tao_env)) return 0; // not equal TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ()); CORBA::Object_ptr *_tao_obj_ptr; ACE_NEW_RETURN (_tao_obj_ptr, CORBA::Object_ptr, 0); @@ -98,7 +99,7 @@ CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA_Current_ptr &_tao_ if (_tao_env.exception ()) return 0; // narrow failed CORBA::release (*_tao_obj_ptr); *_tao_obj_ptr = _tao_elem; - ((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), _tao_obj_ptr, 1, _tao_env); + ((CORBA::Any *)&_tao_any)->replace (CORBA::_tc_Current, _tao_obj_ptr, 1, _tao_env); if (_tao_env.exception ()) return 0; // narrow failed return 1; } diff --git a/TAO/tao/IIOP_Object.cpp b/TAO/tao/IIOP_Object.cpp index 61a92af4561..5e4850bb377 100644 --- a/TAO/tao/IIOP_Object.cpp +++ b/TAO/tao/IIOP_Object.cpp @@ -718,8 +718,7 @@ IIOP_Object::do_dynamic_call (const char *opname, if (!(flags & CORBA::OUT_LIST_MEMORY)) { - CORBA::TypeCode_ptr tcp = - CORBA::TypeCode::_duplicate (result->value ()->type ()); + CORBA::TypeCode_var tcp = result->value ()->type (); size_t size = tcp->size (env); dexc (env, "do_dynamic_call, get result size"); @@ -727,7 +726,7 @@ IIOP_Object::do_dynamic_call (const char *opname, { void *ptr = new CORBA::Octet [size]; - result->value ()->replace (tcp, ptr, + result->value ()->replace (tcp.in (), ptr, CORBA::B_TRUE, env); dexc (env, "do_dynamic_call, set result mem"); } @@ -747,14 +746,14 @@ IIOP_Object::do_dynamic_call (const char *opname, begin = call.inp_stream ().rd_ptr (); // skip the parameter to get the ending position - retval = temp.skip (any->type (), env); + retval = temp.skip (any->type_, env); if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE) { end = temp.rd_ptr (); any->cdr_ = new ACE_Message_Block (end - begin); TAO_OutputCDR out (any->cdr_); - retval = out.append (any->type (), + retval = out.append (any->type_, &call.inp_stream (), env); if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE) { @@ -767,8 +766,8 @@ IIOP_Object::do_dynamic_call (const char *opname, { // the application had allocated the top level // storage. We simply retrieve the data - call.get_value (result->value ()->type (), - (void *) result->value ()->value_, env); + call.get_value (result->value ()->type_, + result->value ()->value_, env); } } @@ -787,8 +786,7 @@ IIOP_Object::do_dynamic_call (const char *opname, // memory for this parameter ... if (!(flags & CORBA::OUT_LIST_MEMORY)) { - CORBA::TypeCode_ptr tcp = - CORBA::TypeCode::_duplicate (value->value ()->type ()); + CORBA::TypeCode_var tcp = value->value ()->type (); size_t size = tcp->size (env); dexc (env, "do_dynamic_call, get param size"); @@ -796,7 +794,7 @@ IIOP_Object::do_dynamic_call (const char *opname, { CORBA::Octet *ptr = new CORBA::Octet [size]; - value->value ()->replace (tcp, ptr, + value->value ()->replace (tcp.in (), ptr, CORBA::B_TRUE, env); dexc (env, "do_dynamic_call, set result mem"); } @@ -815,14 +813,14 @@ IIOP_Object::do_dynamic_call (const char *opname, begin = call.inp_stream ().rd_ptr (); // skip the parameter to get the ending position - retval = temp.skip (any->type (), env); + retval = temp.skip (any->type_, env); if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE) { end = temp.rd_ptr (); any->cdr_ = new ACE_Message_Block (end - begin); TAO_OutputCDR out (any->cdr_); - retval = out.append (any->type (), + retval = out.append (any->type_, &call.inp_stream (), env); if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE) { @@ -835,7 +833,7 @@ IIOP_Object::do_dynamic_call (const char *opname, { // the application had allocated the top level // storage. We simply retrieve the data - call.get_value (any->type (), + call.get_value (any->type_, (void *) any->value_, env); } if (env.exception ()) @@ -888,12 +886,12 @@ IIOP_Object::put_params (TAO_GIOP_Invocation &call, { TAO_OutputCDR &cdr = call.out_stream (); TAO_InputCDR in (value->value ()->cdr_); - cdr.append (value->value ()->type (), &in, env); + cdr.append (value->value ()->type_, &in, env); } else { - call.put_param (value->value ()->type (), - (void *) value->value ()->value_, env); + call.put_param (value->value ()->type_, + value->value ()->value_, env); } if (env.exception ()) { diff --git a/TAO/tao/NVList.cpp b/TAO/tao/NVList.cpp index 6add0651dd3..7e0cd79723c 100644 --- a/TAO/tao/NVList.cpp +++ b/TAO/tao/NVList.cpp @@ -130,14 +130,12 @@ CORBA_NVList::add_value (const char *name, // place, and makes a "deep copy" of the data. nv->any_ = value; else - - // The normal behaviour for parameters is that the ORB "borrows" - // their memory for the duration of calls. - // - - nv->any_.replace (value.type (), - (void *) value.value_, - 0, env); + { + // The normal behavior for parameters is that the ORB + // "borrows" their memory for the duration of calls. + CORBA::TypeCode_var type = value.type (); + nv->any_.replace (type, value.value_, 0, env); + } return nv; } diff --git a/TAO/tao/POAC.cpp b/TAO/tao/POAC.cpp index 4d277308d11..14b0c38a580 100644 --- a/TAO/tao/POAC.cpp +++ b/TAO/tao/POAC.cpp @@ -111,7 +111,8 @@ void operator<<= (CORBA::Any &_tao_any, PortableServer::ForwardRequest *_tao_ele CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, PortableServer::ForwardRequest *&_tao_elem) { CORBA::Environment _tao_env; - if (!_tao_any.type ()->equal (PortableServer::_tc_ForwardRequest, _tao_env)) return 0; // not equal + CORBA::TypeCode_var type = _tao_any.type (); + if (!type->equal (PortableServer::_tc_ForwardRequest, _tao_env)) return 0; // not equal if (_tao_any.any_owns_data ()) { ACE_NEW_RETURN (_tao_elem, PortableServer::ForwardRequest, 0); @@ -119,7 +120,7 @@ CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, PortableServer::ForwardR if (stream.decode (PortableServer::_tc_ForwardRequest, _tao_elem, 0, _tao_env) == CORBA::TypeCode::TRAVERSE_CONTINUE) { - ((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), _tao_elem, 1, _tao_env); + ((CORBA::Any *)&_tao_any)->replace (PortableServer::_tc_ForwardRequest, _tao_elem, 1, _tao_env); return 1; } else @@ -929,7 +930,8 @@ void operator<<= (CORBA::Any &_tao_any, PortableServer::POAManager::AdapterInact CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, PortableServer::POAManager::AdapterInactive *&_tao_elem) { CORBA::Environment _tao_env; - if (!_tao_any.type ()->equal (PortableServer::POAManager::_tc_AdapterInactive, _tao_env)) return 0; // not equal + CORBA::TypeCode_var type = _tao_any.type (); + if (!type->equal (PortableServer::POAManager::_tc_AdapterInactive, _tao_env)) return 0; // not equal if (_tao_any.any_owns_data ()) { ACE_NEW_RETURN (_tao_elem, PortableServer::POAManager::AdapterInactive, 0); @@ -937,7 +939,7 @@ CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, PortableServer::POAManag if (stream.decode (PortableServer::POAManager::_tc_AdapterInactive, _tao_elem, 0, _tao_env) == CORBA::TypeCode::TRAVERSE_CONTINUE) { - ((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), _tao_elem, 1, _tao_env); + ((CORBA::Any *)&_tao_any)->replace (PortableServer::POAManager::_tc_AdapterInactive, _tao_elem, 1, _tao_env); return 1; } else @@ -1284,7 +1286,8 @@ void operator<<= (CORBA::Any &_tao_any, PortableServer::POA::AdapterAlreadyExist CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, PortableServer::POA::AdapterAlreadyExists *&_tao_elem) { CORBA::Environment _tao_env; - if (!_tao_any.type ()->equal (PortableServer::POA::_tc_AdapterAlreadyExists, _tao_env)) return 0; // not equal + CORBA::TypeCode_var type = _tao_any.type (); + if (!type->equal (PortableServer::POA::_tc_AdapterAlreadyExists, _tao_env)) return 0; // not equal if (_tao_any.any_owns_data ()) { ACE_NEW_RETURN (_tao_elem, PortableServer::POA::AdapterAlreadyExists, 0); @@ -1292,7 +1295,7 @@ CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, PortableServer::POA::Ada if (stream.decode (PortableServer::POA::_tc_AdapterAlreadyExists, _tao_elem, 0, _tao_env) == CORBA::TypeCode::TRAVERSE_CONTINUE) { - ((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), _tao_elem, 1, _tao_env); + ((CORBA::Any *)&_tao_any)->replace (PortableServer::POA::_tc_AdapterAlreadyExists, _tao_elem, 1, _tao_env); return 1; } else @@ -1371,7 +1374,8 @@ void operator<<= (CORBA::Any &_tao_any, PortableServer::POA::AdapterInactive *_t CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, PortableServer::POA::AdapterInactive *&_tao_elem) { CORBA::Environment _tao_env; - if (!_tao_any.type ()->equal (PortableServer::POA::_tc_AdapterInactive, _tao_env)) return 0; // not equal + CORBA::TypeCode_var type = _tao_any.type (); + if (!type->equal (PortableServer::POA::_tc_AdapterInactive, _tao_env)) return 0; // not equal if (_tao_any.any_owns_data ()) { ACE_NEW_RETURN (_tao_elem, PortableServer::POA::AdapterInactive, 0); @@ -1379,7 +1383,7 @@ CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, PortableServer::POA::Ada if (stream.decode (PortableServer::POA::_tc_AdapterInactive, _tao_elem, 0, _tao_env) == CORBA::TypeCode::TRAVERSE_CONTINUE) { - ((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), _tao_elem, 1, _tao_env); + ((CORBA::Any *)&_tao_any)->replace (PortableServer::POA::_tc_AdapterInactive, _tao_elem, 1, _tao_env); return 1; } else @@ -1458,7 +1462,8 @@ void operator<<= (CORBA::Any &_tao_any, PortableServer::POA::AdapterNonExistent CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, PortableServer::POA::AdapterNonExistent *&_tao_elem) { CORBA::Environment _tao_env; - if (!_tao_any.type ()->equal (PortableServer::POA::_tc_AdapterNonExistent, _tao_env)) return 0; // not equal + CORBA::TypeCode_var type = _tao_any.type (); + if (!type->equal (PortableServer::POA::_tc_AdapterNonExistent, _tao_env)) return 0; // not equal if (_tao_any.any_owns_data ()) { ACE_NEW_RETURN (_tao_elem, PortableServer::POA::AdapterNonExistent, 0); @@ -1466,7 +1471,7 @@ CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, PortableServer::POA::Ada if (stream.decode (PortableServer::POA::_tc_AdapterNonExistent, _tao_elem, 0, _tao_env) == CORBA::TypeCode::TRAVERSE_CONTINUE) { - ((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), _tao_elem, 1, _tao_env); + ((CORBA::Any *)&_tao_any)->replace (PortableServer::POA::_tc_AdapterNonExistent, _tao_elem, 1, _tao_env); return 1; } else @@ -1555,7 +1560,8 @@ void operator<<= (CORBA::Any &_tao_any, PortableServer::POA::InvalidPolicy *_tao CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, PortableServer::POA::InvalidPolicy *&_tao_elem) { CORBA::Environment _tao_env; - if (!_tao_any.type ()->equal (PortableServer::POA::_tc_InvalidPolicy, _tao_env)) return 0; // not equal + CORBA::TypeCode_var type = _tao_any.type (); + if (!type->equal (PortableServer::POA::_tc_InvalidPolicy, _tao_env)) return 0; // not equal if (_tao_any.any_owns_data ()) { ACE_NEW_RETURN (_tao_elem, PortableServer::POA::InvalidPolicy, 0); @@ -1563,7 +1569,7 @@ CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, PortableServer::POA::Inv if (stream.decode (PortableServer::POA::_tc_InvalidPolicy, _tao_elem, 0, _tao_env) == CORBA::TypeCode::TRAVERSE_CONTINUE) { - ((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), _tao_elem, 1, _tao_env); + ((CORBA::Any *)&_tao_any)->replace (PortableServer::POA::_tc_InvalidPolicy, _tao_elem, 1, _tao_env); return 1; } else @@ -1645,7 +1651,8 @@ void operator<<= (CORBA::Any &_tao_any, PortableServer::POA::NoServant *_tao_ele CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, PortableServer::POA::NoServant *&_tao_elem) { CORBA::Environment _tao_env; - if (!_tao_any.type ()->equal (PortableServer::POA::_tc_NoServant, _tao_env)) return 0; // not equal + CORBA::TypeCode_var type = _tao_any.type (); + if (!type->equal (PortableServer::POA::_tc_NoServant, _tao_env)) return 0; // not equal if (_tao_any.any_owns_data ()) { ACE_NEW_RETURN (_tao_elem, PortableServer::POA::NoServant, 0); @@ -1653,7 +1660,7 @@ CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, PortableServer::POA::NoS if (stream.decode (PortableServer::POA::_tc_NoServant, _tao_elem, 0, _tao_env) == CORBA::TypeCode::TRAVERSE_CONTINUE) { - ((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), _tao_elem, 1, _tao_env); + ((CORBA::Any *)&_tao_any)->replace (PortableServer::POA::_tc_NoServant, _tao_elem, 1, _tao_env); return 1; } else @@ -1733,7 +1740,8 @@ void operator<<= (CORBA::Any &_tao_any, PortableServer::POA::ObjectAlreadyActive CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, PortableServer::POA::ObjectAlreadyActive *&_tao_elem) { CORBA::Environment _tao_env; - if (!_tao_any.type ()->equal (PortableServer::POA::_tc_ObjectAlreadyActive, _tao_env)) return 0; // not equal + CORBA::TypeCode_var type = _tao_any.type (); + if (!type->equal (PortableServer::POA::_tc_ObjectAlreadyActive, _tao_env)) return 0; // not equal if (_tao_any.any_owns_data ()) { ACE_NEW_RETURN (_tao_elem, PortableServer::POA::ObjectAlreadyActive, 0); @@ -1741,7 +1749,7 @@ CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, PortableServer::POA::Obj if (stream.decode (PortableServer::POA::_tc_ObjectAlreadyActive, _tao_elem, 0, _tao_env) == CORBA::TypeCode::TRAVERSE_CONTINUE) { - ((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), _tao_elem, 1, _tao_env); + ((CORBA::Any *)&_tao_any)->replace (PortableServer::POA::_tc_ObjectAlreadyActive, _tao_elem, 1, _tao_env); return 1; } else @@ -1821,7 +1829,8 @@ void operator<<= (CORBA::Any &_tao_any, PortableServer::POA::ObjectNotActive *_t CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, PortableServer::POA::ObjectNotActive *&_tao_elem) { CORBA::Environment _tao_env; - if (!_tao_any.type ()->equal (PortableServer::POA::_tc_ObjectNotActive, _tao_env)) return 0; // not equal + CORBA::TypeCode_var type = _tao_any.type (); + if (!type->equal (PortableServer::POA::_tc_ObjectNotActive, _tao_env)) return 0; // not equal if (_tao_any.any_owns_data ()) { ACE_NEW_RETURN (_tao_elem, PortableServer::POA::ObjectNotActive, 0); @@ -1829,7 +1838,7 @@ CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, PortableServer::POA::Obj if (stream.decode (PortableServer::POA::_tc_ObjectNotActive, _tao_elem, 0, _tao_env) == CORBA::TypeCode::TRAVERSE_CONTINUE) { - ((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), _tao_elem, 1, _tao_env); + ((CORBA::Any *)&_tao_any)->replace (PortableServer::POA::_tc_ObjectNotActive, _tao_elem, 1, _tao_env); return 1; } else @@ -1909,7 +1918,8 @@ void operator<<= (CORBA::Any &_tao_any, PortableServer::POA::ServantAlreadyActiv CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, PortableServer::POA::ServantAlreadyActive *&_tao_elem) { CORBA::Environment _tao_env; - if (!_tao_any.type ()->equal (PortableServer::POA::_tc_ServantAlreadyActive, _tao_env)) return 0; // not equal + CORBA::TypeCode_var type = _tao_any.type (); + if (!type->equal (PortableServer::POA::_tc_ServantAlreadyActive, _tao_env)) return 0; // not equal if (_tao_any.any_owns_data ()) { ACE_NEW_RETURN (_tao_elem, PortableServer::POA::ServantAlreadyActive, 0); @@ -1917,7 +1927,7 @@ CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, PortableServer::POA::Ser if (stream.decode (PortableServer::POA::_tc_ServantAlreadyActive, _tao_elem, 0, _tao_env) == CORBA::TypeCode::TRAVERSE_CONTINUE) { - ((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), _tao_elem, 1, _tao_env); + ((CORBA::Any *)&_tao_any)->replace (PortableServer::POA::_tc_ServantAlreadyActive, _tao_elem, 1, _tao_env); return 1; } else @@ -1997,7 +2007,8 @@ void operator<<= (CORBA::Any &_tao_any, PortableServer::POA::ServantNotActive *_ CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, PortableServer::POA::ServantNotActive *&_tao_elem) { CORBA::Environment _tao_env; - if (!_tao_any.type ()->equal (PortableServer::POA::_tc_ServantNotActive, _tao_env)) return 0; // not equal + CORBA::TypeCode_var type = _tao_any.type (); + if (!type->equal (PortableServer::POA::_tc_ServantNotActive, _tao_env)) return 0; // not equal if (_tao_any.any_owns_data ()) { ACE_NEW_RETURN (_tao_elem, PortableServer::POA::ServantNotActive, 0); @@ -2005,7 +2016,7 @@ CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, PortableServer::POA::Ser if (stream.decode (PortableServer::POA::_tc_ServantNotActive, _tao_elem, 0, _tao_env) == CORBA::TypeCode::TRAVERSE_CONTINUE) { - ((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), _tao_elem, 1, _tao_env); + ((CORBA::Any *)&_tao_any)->replace (PortableServer::POA::_tc_ServantNotActive, _tao_elem, 1, _tao_env); return 1; } else @@ -2085,7 +2096,8 @@ void operator<<= (CORBA::Any &_tao_any, PortableServer::POA::WrongAdapter *_tao_ CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, PortableServer::POA::WrongAdapter *&_tao_elem) { CORBA::Environment _tao_env; - if (!_tao_any.type ()->equal (PortableServer::POA::_tc_WrongAdapter, _tao_env)) return 0; // not equal + CORBA::TypeCode_var type = _tao_any.type (); + if (!type->equal (PortableServer::POA::_tc_WrongAdapter, _tao_env)) return 0; // not equal if (_tao_any.any_owns_data ()) { ACE_NEW_RETURN (_tao_elem, PortableServer::POA::WrongAdapter, 0); @@ -2093,7 +2105,7 @@ CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, PortableServer::POA::Wro if (stream.decode (PortableServer::POA::_tc_WrongAdapter, _tao_elem, 0, _tao_env) == CORBA::TypeCode::TRAVERSE_CONTINUE) { - ((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), _tao_elem, 1, _tao_env); + ((CORBA::Any *)&_tao_any)->replace (PortableServer::POA::_tc_WrongAdapter, _tao_elem, 1, _tao_env); return 1; } else @@ -2173,7 +2185,8 @@ void operator<<= (CORBA::Any &_tao_any, PortableServer::POA::WrongPolicy *_tao_e CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, PortableServer::POA::WrongPolicy *&_tao_elem) { CORBA::Environment _tao_env; - if (!_tao_any.type ()->equal (PortableServer::POA::_tc_WrongPolicy, _tao_env)) return 0; // not equal + CORBA::TypeCode_var type = _tao_any.type (); + if (!type->equal (PortableServer::POA::_tc_WrongPolicy, _tao_env)) return 0; // not equal if (_tao_any.any_owns_data ()) { ACE_NEW_RETURN (_tao_elem, PortableServer::POA::WrongPolicy, 0); @@ -2181,7 +2194,7 @@ CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, PortableServer::POA::Wro if (stream.decode (PortableServer::POA::_tc_WrongPolicy, _tao_elem, 0, _tao_env) == CORBA::TypeCode::TRAVERSE_CONTINUE) { - ((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), _tao_elem, 1, _tao_env); + ((CORBA::Any *)&_tao_any)->replace (PortableServer::POA::_tc_WrongPolicy, _tao_elem, 1, _tao_env); return 1; } else @@ -2315,7 +2328,8 @@ void operator<<= (CORBA::Any &_tao_any, PortableServer::Current::NoContext *_tao CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, PortableServer::Current::NoContext *&_tao_elem) { CORBA::Environment _tao_env; - if (!_tao_any.type ()->equal (PortableServer::Current::_tc_NoContext, _tao_env)) return 0; // not equal + CORBA::TypeCode_var type = _tao_any.type (); + if (!type->equal (PortableServer::Current::_tc_NoContext, _tao_env)) return 0; // not equal if (_tao_any.any_owns_data ()) { ACE_NEW_RETURN (_tao_elem, PortableServer::Current::NoContext, 0); @@ -2323,7 +2337,7 @@ CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, PortableServer::Current: if (stream.decode (PortableServer::Current::_tc_NoContext, _tao_elem, 0, _tao_env) == CORBA::TypeCode::TRAVERSE_CONTINUE) { - ((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), _tao_elem, 1, _tao_env); + ((CORBA::Any *)&_tao_any)->replace (PortableServer::Current::_tc_NoContext, _tao_elem, 1, _tao_env); return 1; } else diff --git a/TAO/tao/Server_Request.cpp b/TAO/tao/Server_Request.cpp index fe7121c03c0..bf1e9893f77 100644 --- a/TAO/tao/Server_Request.cpp +++ b/TAO/tao/Server_Request.cpp @@ -194,7 +194,7 @@ IIOP_ServerRequest::arguments (CORBA::NVList_ptr &list, // This is exactly what the TAO IDL compiler generated skeletons do. CORBA::Any_ptr any = nv->value (); - CORBA::TypeCode_ptr tc = CORBA::TypeCode::_duplicate (any->type ()); + CORBA::TypeCode_var tc = any->type (); void *value; if (!any->value ()) @@ -204,27 +204,16 @@ IIOP_ServerRequest::arguments (CORBA::NVList_ptr &list, if (env.exception () != 0) return; - any->replace (tc, value, CORBA::B_TRUE, env); + any->replace (tc.in (), value, CORBA::B_TRUE, env); if (env.exception () != 0) return; - // Decrement the refcount of "tc". - // - // The earlier TypeCode::_duplicate is needed since - // Any::replace () releases the typecode inside the Any. - // Without the dup, the reference count can go to zero, and - // the typecode would then be deleted. - // - // This _release that the reference count is correct so the - // typecode can be deleted some other time. - - CORBA::release (tc); } else value = (void *)any->value (); // memory was already preallocated // Then just unmarshal the value. - (void) incoming_->decode (tc, value, 0, env); + (void) incoming_->decode (tc.in (), value, 0, env); if (env.exception () != 0) { const char* param_name = nv->name (); @@ -267,7 +256,10 @@ IIOP_ServerRequest::set_result (const CORBA::Any &value, else { this->retval_ = new CORBA::Any; - this->retval_->replace (value.type (), value.value (), 1, env); + // @@ TODO Does this work in all the cases? Shouldn't we use + // operator= or something similar? + CORBA::TypeCode_var type = value.type (); + this->retval_->replace (type, value.value (), 1, env); } } @@ -295,7 +287,10 @@ IIOP_ServerRequest::set_exception (const CORBA::Any &value, else { this->exception_ = new CORBA::Any; - this->exception_->replace (value.type (), value.value (), 1, env); + // @@ TODO Does this work in all the cases? Shouldn't we use + // operator= or something similar? + CORBA::TypeCode_var type = value.type (); + this->exception_->replace (type, value.value (), 1, env); // @@ This cast is not safe, but we haven't implemented the >>= // and <<= operators for base exceptions (yet). @@ -490,9 +485,6 @@ IIOP_ServerRequest::dsi_marshal (CORBA::Environment &env) // the language mapped one should be used for system exceptions. - CORBA::TypeCode_ptr tc; - const void *value; - // only if there wasn't any exception, we proceed if (this->exception_type_ == TAO_GIOP_NO_EXCEPTION && CORBA::is_nil (this->forward_location_.in ())) @@ -500,15 +492,17 @@ IIOP_ServerRequest::dsi_marshal (CORBA::Environment &env) // ... then send any return value ... if (this->retval_) { - tc = this->retval_->type (); - value = this->retval_->value (); - if (this->retval_->any_owns_data ()) + CORBA::TypeCode_var tc = this->retval_->type (); + void* value = ACE_const_cast(void*,this->retval_->value ()); + if (this->retval_->any_owns_data ()) { TAO_InputCDR cdr ((ACE_Message_Block *)value); - (void) this->outgoing_->append (tc, &cdr, env); + (void) this->outgoing_->append (tc.in (), &cdr, env); } else - (void) this->outgoing_->encode (tc, value, 0, env); + { + (void) this->outgoing_->encode (tc.in (), value, 0, env); + } } // ... Followed by "inout" and "out" parameters, left to right @@ -519,21 +513,19 @@ IIOP_ServerRequest::dsi_marshal (CORBA::Environment &env) i++) { CORBA::NamedValue_ptr nv = this->params_->item (i, env); - CORBA::Any_ptr any; - if (!(nv->flags () & (CORBA::ARG_INOUT|CORBA::ARG_OUT))) continue; - any = nv->value (); - tc = any->type (); - value = any->value (); + CORBA::Any_ptr any = nv->value (); + CORBA::TypeCode_var tc = any->type (); + void* value = ACE_const_cast(void*,any->value ()); if (any->any_owns_data ()) { TAO_InputCDR cdr ((ACE_Message_Block *)value); - (void) this->outgoing_->append (tc, &cdr, env); + (void) this->outgoing_->append (tc.in (), &cdr, env); } else - (void) this->outgoing_->encode (tc, value, 0, env); + (void) this->outgoing_->encode (tc.in (), value, 0, env); } } } diff --git a/TAO/tao/append.cpp b/TAO/tao/append.cpp index 58da462297c..794eefc8d39 100644 --- a/TAO/tao/append.cpp +++ b/TAO/tao/append.cpp @@ -376,8 +376,9 @@ TAO_Marshal_Union::append (CORBA::TypeCode_ptr tc, member_label = tc->member_label (i, env); if (env.exception () == 0) { + CORBA::TypeCode_var type = member_label->type (); // do the matching - switch (member_label->type ()->kind (env)) + switch (type->kind (env)) { case CORBA::tk_short: { @@ -416,7 +417,7 @@ TAO_Marshal_Union::append (CORBA::TypeCode_ptr tc, CORBA::Long l; TAO_InputCDR stream ((ACE_Message_Block *) member_label->value - ()); + ()); (void)stream.decode (discrim_tc, &l, 0, env); if (l == *(CORBA::Long *) &discrim_val) discrim_matched = CORBA::B_TRUE; diff --git a/TAO/tao/decode.cpp b/TAO/tao/decode.cpp index 3377da4e171..e5af500a7c8 100644 --- a/TAO/tao/decode.cpp +++ b/TAO/tao/decode.cpp @@ -896,7 +896,8 @@ TAO_Marshal_Union::decode (CORBA::TypeCode_ptr tc, if (env.exception () == 0) { // do the matching - switch (member_label->type ()->kind (env)) + CORBA::TypeCode_var type = member_label->type (); + switch (type->kind (env)) { case CORBA::tk_short: { diff --git a/TAO/tao/deep_copy.cpp b/TAO/tao/deep_copy.cpp index 1bfc1f1bf64..b3ac0cd7f6d 100644 --- a/TAO/tao/deep_copy.cpp +++ b/TAO/tao/deep_copy.cpp @@ -440,7 +440,8 @@ TAO_Marshal_Union::deep_copy (CORBA::TypeCode_ptr tc, CORBA::Boolean discrim_matched = CORBA::B_FALSE; // do the matching - switch (member_label->type ()->kind (env)) + CORBA::TypeCode_var type = member_label->type (); + switch (type->kind (env)) { case CORBA::tk_short: case CORBA::tk_ushort: diff --git a/TAO/tao/deep_free.cpp b/TAO/tao/deep_free.cpp index 01bd5598b4d..642feb321d2 100644 --- a/TAO/tao/deep_free.cpp +++ b/TAO/tao/deep_free.cpp @@ -333,7 +333,8 @@ TAO_Marshal_Union::deep_free (CORBA::TypeCode_ptr tc, if (env.exception () == 0) { // do the matching - switch (member_label->type ()->kind (env)) + CORBA::TypeCode_var type = member_label->type (); + switch (type->kind (env)) { case CORBA::tk_short: case CORBA::tk_ushort: diff --git a/TAO/tao/encode.cpp b/TAO/tao/encode.cpp index df7ebdae3f3..51ceb81d2c1 100644 --- a/TAO/tao/encode.cpp +++ b/TAO/tao/encode.cpp @@ -100,16 +100,14 @@ TAO_Marshal_Any::encode (CORBA::TypeCode_ptr, { CORBA::Any *any = (CORBA::Any *) data; - // Typecode of the element that makes the Any. - CORBA::TypeCode_ptr elem_tc; - TAO_OutputCDR *stream = (TAO_OutputCDR *) context; // Status of encode operation CORBA::TypeCode::traverse_status retval = CORBA::TypeCode::TRAVERSE_CONTINUE; - elem_tc = any->type (); + // Typecode of the element that makes the Any. + CORBA::TypeCode_ptr elem_tc = any->type_; // Encode the typecode description for the element. if (stream->encode (CORBA::_tc_TypeCode, &elem_tc, 0, env) @@ -531,7 +529,8 @@ TAO_Marshal_Union::encode (CORBA::TypeCode_ptr tc, if (env.exception () == 0) { // do the matching - switch (member_label->type ()->kind (env)) + CORBA::TypeCode_var type = member_label->type (); + switch (type->kind (env)) { case CORBA::tk_short: { diff --git a/TAO/tao/skip.cpp b/TAO/tao/skip.cpp index d03d699851c..3154464c619 100644 --- a/TAO/tao/skip.cpp +++ b/TAO/tao/skip.cpp @@ -429,7 +429,8 @@ TAO_Marshal_Union::skip (CORBA::TypeCode_ptr tc, if (env.exception () == 0) { // do the matching - switch (member_label->type ()->kind (env)) + CORBA::TypeCode_var type = member_label->type (); + switch (type->kind (env)) { case CORBA::tk_short: { |