From dd64cf00b8fb01d6868a695aea4493555344a243 Mon Sep 17 00:00:00 2001 From: parsons Date: Mon, 7 Feb 2005 01:48:36 +0000 Subject: ChangeLogTag: Sun Feb 6 19:46:23 2005 Jeff Parsons --- TAO/ChangeLog | 50 +++++ .../IFR_Service/ifr_adding_visitor_union.cpp | 4 +- TAO/orbsvcs/orbsvcs/ETCL/ETCL_Constraint.cpp | 24 ++- TAO/orbsvcs/orbsvcs/IFRService/ConstantDef_i.cpp | 25 ++- TAO/orbsvcs/orbsvcs/IFRService/Container_i.cpp | 62 ++++-- TAO/orbsvcs/orbsvcs/IFRService/UnionDef_i.cpp | 4 +- .../orbsvcs/Log/Log_Constraint_Visitors.cpp | 5 +- TAO/orbsvcs/orbsvcs/Log/PersistStore.cpp | 7 +- .../orbsvcs/Notify/Notify_Constraint_Visitors.cpp | 9 +- .../tests/InterfaceRepo/IFR_Test/Admin_Client.cpp | 17 +- TAO/tao/Any.cpp | 15 +- TAO/tao/Any.h | 1 - TAO/tao/Any_Array_Impl_T.cpp | 28 ++- TAO/tao/Any_Basic_Impl.cpp | 34 ++-- TAO/tao/Any_Basic_Impl_T.cpp | 23 ++- TAO/tao/Any_Dual_Impl_T.cpp | 30 ++- TAO/tao/Any_Impl.cpp | 24 +-- TAO/tao/Any_Impl.h | 11 +- TAO/tao/Any_Impl_T.cpp | 30 ++- TAO/tao/Any_Special_Impl_T.cpp | 28 ++- TAO/tao/Any_SystemException.cpp | 30 ++- TAO/tao/Any_Unknown_IDL_Type.cpp | 151 ++++---------- TAO/tao/Any_Unknown_IDL_Type.h | 19 +- TAO/tao/CDR_Encaps_Codec.cpp | 147 ++++---------- TAO/tao/DynamicAny/DynAny_i.cpp | 5 +- TAO/tao/DynamicAny/DynArray_i.cpp | 107 +++++----- TAO/tao/DynamicAny/DynCommon.cpp | 4 +- TAO/tao/DynamicAny/DynEnum_i.cpp | 101 +++++----- TAO/tao/DynamicAny/DynSequence_i.cpp | 114 +++++------ TAO/tao/DynamicAny/DynStruct_i.cpp | 108 +++++----- TAO/tao/DynamicAny/DynUnion_i.cpp | 217 +++++++++++---------- TAO/tao/DynamicInterface/DII_Invocation.cpp | 5 +- TAO/tao/TypeCodeFactory/TypeCodeFactory_i.cpp | 57 +++++- TAO/tao/Typecode.cpp | 4 +- TAO/tao/append.cpp | 41 ++-- TAO/tao/skip.cpp | 41 ++-- TAO/tests/DynAny_Test/analyzer.cpp | 6 +- TAO/tests/DynAny_Test/test_dynsequence.cpp | 15 +- TAO/tests/Param_Test/except.cpp | 2 +- TAO/tests/Param_Test/small_union.cpp | 4 +- 40 files changed, 751 insertions(+), 858 deletions(-) diff --git a/TAO/ChangeLog b/TAO/ChangeLog index cc3cd075d60..bb0dff0b853 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,53 @@ +Sun Feb 6 19:46:23 2005 Jeff Parsons + + * orbsvcs/IFR_Service/ifr_adding_visitor_union.cpp: + * orbsvcs/orbsvcs/ETCL/ETCL_Constraint.cpp: + * orbsvcs/orbsvcs/IFRService/ConstantDef_i.cpp: + * orbsvcs/orbsvcs/IFRService/Container_i.cpp: + * orbsvcs/orbsvcs/IFRService/UnionDef_i.cpp: + * orbsvcs/orbsvcs/Log/Log_Constraint_Visitors.cpp: + * orbsvcs/orbsvcs/Log/PersistStore.cpp: + * orbsvcs/orbsvcs/Notify/Notify_Constraint_Visitors.cpp: + * orbsvcs/tests/InterfaceRepo/IFR_Test/Admin_Client.cpp: + * tao/Any.cpp: + * tao/Any.h: + * tao/Any_Array_Impl_T.cpp: + * tao/Any_Basic_Impl.cpp: + * tao/Any_Basic_Impl_T.cpp: + * tao/Any_Dual_Impl_T.cpp: + * tao/Any_Impl.cpp: + * tao/Any_Impl.h: + * tao/Any_Impl_T.cpp: + * tao/Any_Special_Impl_T.cpp: + * tao/Any_SystemException.cpp: + * tao/Any_Unknown_IDL_Type.cpp: + * tao/Any_Unknown_IDL_Type.h: + * tao/CDR_Encaps_Codec.cpp: + * tao/Typecode.cpp: + * tao/append.cpp: + * tao/skip.cpp: + * tao/DynamicAny/DynAny_i.cpp: + * tao/DynamicAny/DynArray_i.cpp: + * tao/DynamicAny/DynCommon.cpp: + * tao/DynamicAny/DynEnum_i.cpp: + * tao/DynamicAny/DynSequence_i.cpp: + * tao/DynamicAny/DynStruct_i.cpp: + * tao/DynamicAny/DynUnion_i.cpp: + * tao/DynamicInterface/DII_Invocation.cpp: + * tao/TypeCodeFactory/TypeCodeFactory_i.cpp: + * tests/DynAny_Test/analyzer.cpp: + * tests/DynAny_Test/test_dynsequence.cpp: + * tests/Param_Test/except.cpp: + * tests/Param_Test/small_union.cpp: + + Changed implementation of class TAO::Any_Unknown_IDL_Type to + have a TAO_InputCDR member instead of ACE_Message_Block*. + This change not only makes usage of codeset translators + easier during Any extraction (which was the original + impetus for opening up this issue) but also cleans up + some of the alignment and memory management code formerly + needed when handling this subclass of TAO::Any_Impl. + Sat Feb 5 21:12:12 UTC 2005 Johnny Willemsen * tao/Messaging/diffs/Messaging_RT_Policy.diff: diff --git a/TAO/orbsvcs/IFR_Service/ifr_adding_visitor_union.cpp b/TAO/orbsvcs/IFR_Service/ifr_adding_visitor_union.cpp index 04d82d630f3..a93742537ab 100644 --- a/TAO/orbsvcs/IFR_Service/ifr_adding_visitor_union.cpp +++ b/TAO/orbsvcs/IFR_Service/ifr_adding_visitor_union.cpp @@ -166,12 +166,12 @@ ifr_adding_visitor_union::visit_scope (UTL_Scope *node) { TAO_OutputCDR cdr; cdr.write_ulong (ev->u.ulval); + TAO_InputCDR in_cdr (cdr); TAO::Unknown_IDL_Type *unk = 0; ACE_NEW_RETURN (unk, TAO::Unknown_IDL_Type ( this->disc_tc_.in (), - cdr.begin (), - TAO_ENCAP_BYTE_ORDER + in_cdr ), -1); this->members_[index].label.replace (unk); diff --git a/TAO/orbsvcs/orbsvcs/ETCL/ETCL_Constraint.cpp b/TAO/orbsvcs/orbsvcs/ETCL/ETCL_Constraint.cpp index e210c0b90dc..2a04884b7f0 100644 --- a/TAO/orbsvcs/orbsvcs/ETCL/ETCL_Constraint.cpp +++ b/TAO/orbsvcs/orbsvcs/ETCL/ETCL_Constraint.cpp @@ -5,7 +5,7 @@ #include "ETCL_Constraint_Visitor.h" #include "ETCL_y.h" -#include "tao/Any.h" +#include "tao/Any_Unknown_IDL_Type.h" #include "tao/Managed_Types.h" #include "tao/Environment.h" #include "tao/CDR.h" @@ -88,9 +88,25 @@ TAO_ETCL_Literal_Constraint::TAO_ETCL_Literal_Constraint (CORBA::Any * any) } else if (corba_type == CORBA::tk_enum) { - TAO_InputCDR cdr (any_ref._tao_get_cdr (), - any_ref._tao_byte_order ()); - (void) cdr.read_ulong (this->op_.uinteger_); + TAO::Any_Impl *impl = any->impl (); + + if (impl->encoded ()) + { + TAO::Unknown_IDL_Type *unk = + dynamic_cast (impl); + + // We don't want unk's rd_ptr to move, in case we are shared by + // another Any, so we use this to copy the state, not the buffer. + TAO_InputCDR for_reading (unk->_tao_get_cdr ()); + for_reading.read_ulong (this->op_.uinteger_); + } + else + { + TAO_OutputCDR out; + impl->marshal_value (out); + TAO_InputCDR in (out); + in.read_ulong (this->op_.uinteger_); + } } else { diff --git a/TAO/orbsvcs/orbsvcs/IFRService/ConstantDef_i.cpp b/TAO/orbsvcs/orbsvcs/IFRService/ConstantDef_i.cpp index 4b7fd023a1e..25464717f07 100644 --- a/TAO/orbsvcs/orbsvcs/IFRService/ConstantDef_i.cpp +++ b/TAO/orbsvcs/orbsvcs/IFRService/ConstantDef_i.cpp @@ -210,6 +210,7 @@ TAO_ConstantDef_i::value_i (ACE_ENV_SINGLE_ARG_DECL) ACE_Message_Block mb (data, length); mb.length (length); + TAO_InputCDR in_cdr (&mb); CORBA::Any *retval = 0; ACE_NEW_THROW_EX (retval, @@ -220,8 +221,7 @@ TAO_ConstantDef_i::value_i (ACE_ENV_SINGLE_ARG_DECL) TAO::Unknown_IDL_Type *impl = 0; ACE_NEW_THROW_EX (impl, TAO::Unknown_IDL_Type (tc.in (), - &mb, - TAO_ENCAP_BYTE_ORDER), + in_cdr), CORBA::NO_MEMORY ()); ACE_CHECK_RETURN (0); @@ -249,7 +249,8 @@ TAO_ConstantDef_i::value_i (const CORBA::Any &value ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - CORBA::TypeCode_var my_tc = this->type_i (ACE_ENV_SINGLE_ARG_PARAMETER); + CORBA::TypeCode_var my_tc = + this->type_i (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; CORBA::TypeCode_var val_tc = value.type (); @@ -259,7 +260,23 @@ TAO_ConstantDef_i::value_i (const CORBA::Any &value return; } - ACE_Message_Block *mb = value._tao_get_cdr (); + ACE_Message_Block *mb = 0; + TAO::Any_Impl *impl = value.impl (); + + if (impl->encoded ()) + { + TAO::Unknown_IDL_Type *unk = + dynamic_cast (impl); + + mb = unk->_tao_get_cdr ().steal_contents (); + } + else + { + TAO_OutputCDR out; + impl->marshal_value (out); + TAO_InputCDR in (out); + mb = in.steal_contents (); + } CORBA::TCKind kind = val_tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; diff --git a/TAO/orbsvcs/orbsvcs/IFRService/Container_i.cpp b/TAO/orbsvcs/orbsvcs/IFRService/Container_i.cpp index 719264cfddf..e19643e31d2 100644 --- a/TAO/orbsvcs/orbsvcs/IFRService/Container_i.cpp +++ b/TAO/orbsvcs/orbsvcs/IFRService/Container_i.cpp @@ -9,7 +9,7 @@ #include "tao/IFR_Client/IFR_ComponentsC.h" -#include "tao/CDR.h" +#include "tao/Any_Unknown_IDL_Type.h" #include "ace/Auto_Ptr.h" #include "ace/SString.h" @@ -821,7 +821,24 @@ TAO_Container_i::create_constant_i (const char *id, type_path); // Store the value. - ACE_Message_Block *mb = value._tao_get_cdr (); + ACE_Message_Block *mb = 0; + TAO::Any_Impl *impl = value.impl (); + + if (impl->encoded ()) + { + TAO::Unknown_IDL_Type *unk = + dynamic_cast (impl); + + mb = unk->_tao_get_cdr ().steal_contents (); + } + else + { + TAO_OutputCDR out; + impl->marshal_value (out); + TAO_InputCDR in (out); + mb = in.steal_contents (); + } + CORBA::TypeCode_var val_tc = value.type (); CORBA::TCKind kind = val_tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER); @@ -2247,9 +2264,6 @@ TAO_Container_i::store_label (ACE_Configuration_Section_Key key, CORBA::TCKind kind = tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; - TAO_InputCDR cdr (value._tao_get_cdr (), - value._tao_byte_order ()); - u_int result = 0; int default_label = 0; @@ -2261,49 +2275,49 @@ TAO_Container_i::store_label (ACE_Configuration_Section_Key key, case CORBA::tk_char: { CORBA::Char x; - cdr.read_char (x); + value >>= CORBA::Any::to_char (x); result = static_cast (x); break; } case CORBA::tk_wchar: { CORBA::WChar x; - cdr.read_wchar (x); + value >>= CORBA::Any::to_wchar (x); result = static_cast (x); break; } case CORBA::tk_boolean: { CORBA::Boolean x; - cdr.read_boolean (x); + value >>= CORBA::Any::to_boolean (x); result = static_cast (x); break; } case CORBA::tk_short: { CORBA::Short x; - cdr.read_short (x); + value >>= x; result = static_cast (x); break; } case CORBA::tk_ushort: { CORBA::UShort x; - cdr.read_ushort (x); + value >>= x; result = static_cast (x); break; } case CORBA::tk_long: { CORBA::Long x; - cdr.read_long (x); + value >>= x; result = static_cast (x); break; } case CORBA::tk_ulong: { CORBA::ULong x; - cdr.read_ulong (x); + value >>= x; result = static_cast (x); break; } @@ -2311,7 +2325,7 @@ TAO_Container_i::store_label (ACE_Configuration_Section_Key key, case CORBA::tk_longlong: { CORBA::LongLong x; - cdr.read_longlong (x); + value >>= x; // We could lose data here. result = static_cast (x); break; @@ -2320,7 +2334,7 @@ TAO_Container_i::store_label (ACE_Configuration_Section_Key key, case CORBA::tk_ulonglong: { CORBA::ULongLong x; - cdr.read_ulonglong (x); + value >>= x; // We could lose data here. result = static_cast (x); break; @@ -2328,7 +2342,25 @@ TAO_Container_i::store_label (ACE_Configuration_Section_Key key, case CORBA::tk_enum: { CORBA::ULong x; - cdr.read_ulong (x); + TAO::Any_Impl *impl = value.impl (); + TAO_InputCDR in (static_cast (0)); + + if (impl->encoded ()) + { + TAO::Unknown_IDL_Type *unk = + dynamic_cast (impl); + + in = unk->_tao_get_cdr (); + } + else + { + TAO_OutputCDR out; + impl->marshal_value (out); + TAO_InputCDR tmp (out); + in = tmp; + } + + in.read_ulong (x); result = static_cast (x); break; } diff --git a/TAO/orbsvcs/orbsvcs/IFRService/UnionDef_i.cpp b/TAO/orbsvcs/orbsvcs/IFRService/UnionDef_i.cpp index e67cd8103c0..68d57c03519 100644 --- a/TAO/orbsvcs/orbsvcs/IFRService/UnionDef_i.cpp +++ b/TAO/orbsvcs/orbsvcs/IFRService/UnionDef_i.cpp @@ -461,11 +461,11 @@ TAO_UnionDef_i::fetch_label (const ACE_Configuration_Section_Key member_key, { TAO_OutputCDR cdr; cdr.write_ulong (static_cast (value)); + TAO_InputCDR in_cdr (cdr); TAO::Unknown_IDL_Type *impl = 0; ACE_NEW (impl, TAO::Unknown_IDL_Type (tc.in (), - cdr.begin (), - TAO_ENCAP_BYTE_ORDER)); + in_cdr)); member.label.replace (impl); break; } diff --git a/TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Visitors.cpp b/TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Visitors.cpp index 5d16694f851..7e2f0363c72 100644 --- a/TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Visitors.cpp +++ b/TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Visitors.cpp @@ -193,13 +193,12 @@ TAO_Log_Constraint_Visitor::visit_union_pos ( { TAO_OutputCDR cdr; cdr.write_ulong ((CORBA::ULong) disc_val); - + TAO_InputCDR in_cdr (cdr); TAO::Unknown_IDL_Type *unk = 0; ACE_NEW_RETURN (unk, TAO::Unknown_IDL_Type ( disc_tc.in (), - cdr.begin (), - TAO_ENCAP_BYTE_ORDER + in_cdr ), -1); diff --git a/TAO/orbsvcs/orbsvcs/Log/PersistStore.cpp b/TAO/orbsvcs/orbsvcs/Log/PersistStore.cpp index e244de1c530..3f1b92bedaa 100644 --- a/TAO/orbsvcs/orbsvcs/Log/PersistStore.cpp +++ b/TAO/orbsvcs/orbsvcs/Log/PersistStore.cpp @@ -204,10 +204,9 @@ TAO_PersistStore::retrieve (DsLogAdmin::RecordId id, DsLogAdmin::LogRecord &rec) TAO::Unknown_IDL_Type *unk = 0; ACE_NEW_RETURN (unk, - TAO::Unknown_IDL_Type (tc.in (), - &mb2, - data.byte_order), - -1); + TAO::Unknown_IDL_Type (tc.in (), + TAO_InputCDR (&mb2)), + -1); rec.info.replace (unk); retval = 1; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Visitors.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Visitors.cpp index b3d90edc3e6..16b3f160ed2 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Visitors.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Visitors.cpp @@ -240,14 +240,11 @@ TAO_Notify_Constraint_Visitor::visit_union_pos ( { TAO_OutputCDR cdr; cdr.write_ulong ((CORBA::ULong) disc_val); - + TAO_InputCDR in_cdr (cdr); TAO::Unknown_IDL_Type *unk = 0; ACE_NEW_RETURN (unk, - TAO::Unknown_IDL_Type ( - disc_tc.in (), - cdr.begin (), - TAO_ENCAP_BYTE_ORDER - ), + TAO::Unknown_IDL_Type (disc_tc.in (), + in_cdr), -1); disc_any.replace (unk); diff --git a/TAO/orbsvcs/tests/InterfaceRepo/IFR_Test/Admin_Client.cpp b/TAO/orbsvcs/tests/InterfaceRepo/IFR_Test/Admin_Client.cpp index a690008474e..0988b016e72 100644 --- a/TAO/orbsvcs/tests/InterfaceRepo/IFR_Test/Admin_Client.cpp +++ b/TAO/orbsvcs/tests/InterfaceRepo/IFR_Test/Admin_Client.cpp @@ -1500,11 +1500,11 @@ Admin_Client::union_test (ACE_ENV_SINGLE_ARG_DECL) ACE_CHECK; TAO_OutputCDR maker2; maker2.write_ulong (3); // THREE + TAO_InputCDR maker2_in (maker2); TAO::Unknown_IDL_Type *impl2 = 0; ACE_NEW (impl2, TAO::Unknown_IDL_Type (d_type.in (), - maker2.begin (), - TAO_ENCAP_BYTE_ORDER)); + maker2_in)); CORBA::Any any2; any2.replace (impl2); u_members[0].label = any2; @@ -1532,11 +1532,11 @@ Admin_Client::union_test (ACE_ENV_SINGLE_ARG_DECL) TAO_OutputCDR maker1; maker1.write_ulong (0); // ZERO + TAO_InputCDR maker1_in (maker1); TAO::Unknown_IDL_Type *impl1 = 0; ACE_NEW (impl1, TAO::Unknown_IDL_Type (d_type.in (), - maker1.begin (), - TAO_ENCAP_BYTE_ORDER)); + maker1_in)); CORBA::Any any1; any1.replace (impl1); u_members[2].label = any1; @@ -1628,14 +1628,19 @@ Admin_Client::union_test (ACE_ENV_SINGLE_ARG_DECL) ACE_ENV_ARG_PARAMETER); ACE_CHECK; - TAO_InputCDR cdr (label->_tao_get_cdr ()); + TAO_InputCDR cdr (static_cast (0)); CORBA::ULong val; + + TAO::Any_Impl *impl = label->impl (); + TAO_OutputCDR out; + impl->marshal_value (out); + TAO_InputCDR in (out); // If we're at the default index, it's in the label as octet 0, // so just assign the slot value to val. if (i != (CORBA::ULong) slot) { - cdr.read_ulong (val); + in.read_ulong (val); tmp = d_members[val]; } diff --git a/TAO/tao/Any.cpp b/TAO/tao/Any.cpp index 0a1d56b8ba4..c688e1b4cb6 100644 --- a/TAO/tao/Any.cpp +++ b/TAO/tao/Any.cpp @@ -123,17 +123,6 @@ CORBA::Any::_tao_set_typecode (const CORBA::TypeCode_ptr tc) } } -ACE_Message_Block * -CORBA::Any::_tao_get_cdr (void) const -{ - if (this->impl_ != 0) - { - return this->impl_->_tao_get_cdr (); - } - - return 0; -} - int CORBA::Any::_tao_byte_order (void) const { @@ -307,9 +296,7 @@ operator>> (TAO_InputCDR &cdr, CORBA::Any &any) { TAO::Unknown_IDL_Type *impl = 0; ACE_NEW_RETURN (impl, - TAO::Unknown_IDL_Type (tc.in (), - 0, - cdr.byte_order ()), + TAO::Unknown_IDL_Type (tc.in ()), 0); any.replace (impl); diff --git a/TAO/tao/Any.h b/TAO/tao/Any.h index 3ce2ba28b44..7095dce85d2 100644 --- a/TAO/tao/Any.h +++ b/TAO/tao/Any.h @@ -161,7 +161,6 @@ namespace CORBA /// TAO extension. void _tao_set_typecode (const CORBA::TypeCode_ptr); - ACE_Message_Block *_tao_get_cdr (void) const; int _tao_byte_order (void) const; /// @deprecated diff --git a/TAO/tao/Any_Array_Impl_T.cpp b/TAO/tao/Any_Array_Impl_T.cpp index 49acebc0e43..b048bd3e3f5 100644 --- a/TAO/tao/Any_Array_Impl_T.cpp +++ b/TAO/tao/Any_Array_Impl_T.cpp @@ -78,9 +78,7 @@ TAO::Any_Array_Impl_T::extract (const CORBA::Any & any, TAO::Any_Impl *impl = any.impl (); - ACE_Message_Block *mb = impl->_tao_get_cdr (); - - if (mb == 0) + if (!impl->encoded ()) { TAO::Any_Array_Impl_T *narrow_impl = dynamic_cast *> (impl); @@ -106,22 +104,18 @@ TAO::Any_Array_Impl_T::extract (const CORBA::Any & any, replacement ); - TAO_InputCDR cdr (mb->data_block (), - ACE_Message_Block::DONT_DELETE, - mb->rd_ptr () - mb->base (), - mb->wr_ptr () - mb->base (), - impl->_tao_byte_order (), - TAO_DEF_GIOP_MAJOR, - TAO_DEF_GIOP_MINOR); - - impl->assign_translator (any_tc, - &cdr - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + // We know this will work since the unencoded case is covered above. + TAO::Unknown_IDL_Type *unk = + dynamic_cast (impl); + + // We don't want the rd_ptr of unk to move, in case it is + // shared by another Any. This copies the state, not the buffer. + TAO_InputCDR for_reading (unk->_tao_get_cdr ()); - CORBA::Boolean result = replacement->demarshal_value (cdr); + CORBA::Boolean good_decode = + replacement->demarshal_value (for_reading); - if (result == 1) + if (good_decode) { _tao_elem = reinterpret_cast (replacement->value_); const_cast (any).replace (replacement); diff --git a/TAO/tao/Any_Basic_Impl.cpp b/TAO/tao/Any_Basic_Impl.cpp index 07be1954975..d19fdc9ced8 100644 --- a/TAO/tao/Any_Basic_Impl.cpp +++ b/TAO/tao/Any_Basic_Impl.cpp @@ -2,7 +2,7 @@ #include "tao/Any_Basic_Impl.h" #include "tao/Typecode.h" -#include "tao/Any.h" +#include "tao/Any_Unknown_IDL_Type.h" #include "tao/CDR.h" #include "tao/SystemException.h" @@ -106,9 +106,7 @@ namespace TAO TAO::Any_Impl *impl = any.impl (); - ACE_Message_Block *mb = impl->_tao_get_cdr (); - - if (mb == 0) + if (!impl->encoded ()) { TAO::Any_Basic_Impl *narrow_impl = dynamic_cast (impl); @@ -128,30 +126,28 @@ namespace TAO auto_ptr replacement_safety (replacement); - TAO_InputCDR cdr (mb->data_block (), - ACE_Message_Block::DONT_DELETE, - mb->rd_ptr () - mb->base (), - mb->wr_ptr () - mb->base (), - impl->_tao_byte_order (), - TAO_DEF_GIOP_MAJOR, - TAO_DEF_GIOP_MINOR); + // We know this will work since the unencoded case is covered above. + TAO::Unknown_IDL_Type *unk = + dynamic_cast (impl); // Get the kind of the type where we are extracting in ie. the // aliased type if there are any. Passing the aliased kind // will not help. - CORBA::TCKind tck = - tc->kind (); - + CORBA::TCKind tck = tc->kind (); + + // We don't want the rd_ptr of unk to move, in case it is + // shared by another Any. This copies the state, not the buffer. + TAO_InputCDR for_reading (unk->_tao_get_cdr ()); - CORBA::Boolean result = - replacement->demarshal_value (cdr, - (CORBA::Long) tck); + CORBA::Boolean good_decode = + replacement->demarshal_value (for_reading, + static_cast (tck)); - if (result == 1) + if (good_decode) { Any_Basic_Impl::assign_value (_tao_elem, replacement, - tck); + tck); const_cast (any).replace (replacement); replacement_safety.release (); return 1; diff --git a/TAO/tao/Any_Basic_Impl_T.cpp b/TAO/tao/Any_Basic_Impl_T.cpp index bdf128e52af..82336a5dfe0 100644 --- a/TAO/tao/Any_Basic_Impl_T.cpp +++ b/TAO/tao/Any_Basic_Impl_T.cpp @@ -69,9 +69,7 @@ TAO::Any_Basic_Impl_T::extract (const CORBA::Any & any, TAO::Any_Impl *impl = any.impl (); - ACE_Message_Block *mb = impl->_tao_get_cdr (); - - if (mb == 0) + if (!impl->encoded ()) { TAO::Any_Basic_Impl_T *narrow_impl = dynamic_cast *> (impl); @@ -90,17 +88,18 @@ TAO::Any_Basic_Impl_T::extract (const CORBA::Any & any, auto_ptr > replacement_safety (replacement); - TAO_InputCDR cdr (mb->data_block (), - ACE_Message_Block::DONT_DELETE, - mb->rd_ptr () - mb->base (), - mb->wr_ptr () - mb->base (), - impl->_tao_byte_order (), - TAO_DEF_GIOP_MAJOR, - TAO_DEF_GIOP_MINOR); + // We know this will work since the unencoded case is covered above. + TAO::Unknown_IDL_Type *unk = + dynamic_cast (impl); + + // We don't want the rd_ptr of unk to move, in case it is + // shared by another Any. This copies the state, not the buffer. + TAO_InputCDR for_reading (unk->_tao_get_cdr ()); - CORBA::Boolean result = replacement->demarshal_value (cdr); + CORBA::Boolean good_decode = + replacement->demarshal_value (for_reading); - if (result == 1) + if (good_decode) { _tao_elem = replacement->value_; const_cast (any).replace (replacement); diff --git a/TAO/tao/Any_Dual_Impl_T.cpp b/TAO/tao/Any_Dual_Impl_T.cpp index 2e453f93ede..be0ac30c674 100644 --- a/TAO/tao/Any_Dual_Impl_T.cpp +++ b/TAO/tao/Any_Dual_Impl_T.cpp @@ -4,7 +4,7 @@ #define TAO_ANY_DUAL_IMPL_T_C #include "tao/Any_Dual_Impl_T.h" -#include "tao/Any.h" +#include "tao/Any_Unknown_IDL_Type.h" #include "tao/Marshal.h" #include "tao/CORBA_String.h" #include "tao/Environment.h" @@ -116,9 +116,7 @@ TAO::Any_Dual_Impl_T::extract (const CORBA::Any & any, TAO::Any_Impl *impl = any.impl (); - ACE_Message_Block *mb = impl->_tao_get_cdr (); - - if (mb == 0) + if (!impl->encoded ()) { TAO::Any_Dual_Impl_T *narrow_impl = dynamic_cast *> (impl); @@ -145,22 +143,18 @@ TAO::Any_Dual_Impl_T::extract (const CORBA::Any & any, auto_ptr > replacement_safety (replacement); - TAO_InputCDR cdr (mb->data_block (), - ACE_Message_Block::DONT_DELETE, - mb->rd_ptr () - mb->base (), - mb->wr_ptr () - mb->base (), - impl->_tao_byte_order (), - TAO_DEF_GIOP_MAJOR, - TAO_DEF_GIOP_MINOR); - - impl->assign_translator (any_tc, - &cdr - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + // We know this will work since the unencoded case is covered above. + TAO::Unknown_IDL_Type *unk = + dynamic_cast (impl); + + // We don't want the rd_ptr of unk to move, in case it is + // shared by another Any. This copies the state, not the buffer. + TAO_InputCDR for_reading (unk->_tao_get_cdr ()); - CORBA::Boolean result = replacement->demarshal_value (cdr); + CORBA::Boolean good_decode = + replacement->demarshal_value (for_reading); - if (result == 1) + if (good_decode) { _tao_elem = replacement->value_; const_cast (any).replace (replacement); diff --git a/TAO/tao/Any_Impl.cpp b/TAO/tao/Any_Impl.cpp index 2a139aeeebc..8a81a18a9df 100644 --- a/TAO/tao/Any_Impl.cpp +++ b/TAO/tao/Any_Impl.cpp @@ -16,9 +16,11 @@ ACE_RCSID (tao, TAO::Any_Impl::Any_Impl (_tao_destructor destructor, - CORBA::TypeCode_ptr tc) + CORBA::TypeCode_ptr tc, + bool encoded) : value_destructor_ (destructor) , type_ (CORBA::TypeCode::_duplicate (tc)) + , encoded_ (encoded) , mutex_ () , refcount_ (1) { @@ -72,12 +74,6 @@ TAO::Any_Impl::type (CORBA::TypeCode_ptr tc) this->type_ = CORBA::TypeCode::_duplicate (tc); } -ACE_Message_Block * -TAO::Any_Impl::_tao_get_cdr (void) const -{ - return 0; -} - int TAO::Any_Impl::_tao_byte_order (void) const { @@ -134,13 +130,6 @@ TAO::Any_Impl::_tao_decode (TAO_InputCDR & ACE_THROW (CORBA::NO_IMPLEMENT ()); } -void -TAO::Any_Impl::assign_translator (CORBA::TypeCode_ptr, - TAO_InputCDR * - ACE_ENV_ARG_DECL_NOT_USED) -{ -} - CORBA::Boolean TAO::Any_Impl::to_object (CORBA::Object_ptr &) const { @@ -158,3 +147,10 @@ TAO::Any_Impl::to_abstract_base (CORBA::AbstractBase_ptr &) const { return 0; } + +bool +TAO::Any_Impl::encoded (void) const +{ + return this->encoded_; +} + diff --git a/TAO/tao/Any_Impl.h b/TAO/tao/Any_Impl.h index eeb417a8fc5..4802a25e6aa 100644 --- a/TAO/tao/Any_Impl.h +++ b/TAO/tao/Any_Impl.h @@ -77,7 +77,6 @@ namespace TAO CORBA::TypeCode_ptr _tao_get_typecode (void) const; void type (CORBA::TypeCode_ptr); - virtual ACE_Message_Block *_tao_get_cdr (void) const; virtual int _tao_byte_order (void) const; virtual void _add_ref (void); @@ -90,21 +89,21 @@ namespace TAO virtual void _tao_decode (TAO_InputCDR & ACE_ENV_ARG_DECL); - virtual void assign_translator (CORBA::TypeCode_ptr, - TAO_InputCDR * - ACE_ENV_ARG_DECL); - virtual CORBA::Boolean to_object (CORBA::Object_ptr &) const; virtual CORBA::Boolean to_value (CORBA::ValueBase *&) const; virtual CORBA::Boolean to_abstract_base (CORBA::AbstractBase_ptr &) const; + + bool encoded (void) const; protected: Any_Impl (_tao_destructor, - CORBA::TypeCode_ptr); + CORBA::TypeCode_ptr, + bool encoded = false); virtual ~Any_Impl (void); TAO::Any_Impl::_tao_destructor value_destructor_; CORBA::TypeCode_ptr type_; + bool encoded_; private: /// Lock for the refcount diff --git a/TAO/tao/Any_Impl_T.cpp b/TAO/tao/Any_Impl_T.cpp index 7f432b92c30..dce88148265 100644 --- a/TAO/tao/Any_Impl_T.cpp +++ b/TAO/tao/Any_Impl_T.cpp @@ -4,7 +4,7 @@ #define TAO_ANY_IMPL_T_C #include "tao/Any_Impl_T.h" -#include "tao/Any.h" +#include "tao/Any_Unknown_IDL_Type.h" #include "tao/Marshal.h" #include "tao/CDR.h" #include "tao/Environment.h" @@ -76,9 +76,7 @@ TAO::Any_Impl_T::extract (const CORBA::Any & any, TAO::Any_Impl *impl = any.impl (); - ACE_Message_Block *mb = impl->_tao_get_cdr (); - - if (mb == 0) + if (!impl->encoded ()) { TAO::Any_Impl_T *narrow_impl = dynamic_cast *> (impl); @@ -101,22 +99,18 @@ TAO::Any_Impl_T::extract (const CORBA::Any & any, auto_ptr > replacement_safety (replacement); - TAO_InputCDR cdr (mb->data_block (), - ACE_Message_Block::DONT_DELETE, - mb->rd_ptr () - mb->base (), - mb->wr_ptr () - mb->base (), - impl->_tao_byte_order (), - TAO_DEF_GIOP_MAJOR, - TAO_DEF_GIOP_MINOR); - - impl->assign_translator (any_tc, - &cdr - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + // We know this will work since the unencoded case is covered above. + TAO::Unknown_IDL_Type *unk = + dynamic_cast (impl); + + // We don't want the rd_ptr of unk to move, in case it is + // shared by another Any. This copies the state, not the buffer. + TAO_InputCDR for_reading (unk->_tao_get_cdr ()); - CORBA::Boolean result = replacement->demarshal_value (cdr); + CORBA::Boolean good_decode = + replacement->demarshal_value (for_reading); - if (result == 1) + if (good_decode) { _tao_elem = const_cast (replacement->value_); const_cast (any).replace (replacement); diff --git a/TAO/tao/Any_Special_Impl_T.cpp b/TAO/tao/Any_Special_Impl_T.cpp index 181ce7aed94..3090904cc30 100644 --- a/TAO/tao/Any_Special_Impl_T.cpp +++ b/TAO/tao/Any_Special_Impl_T.cpp @@ -121,12 +121,10 @@ TAO::Any_Special_Impl_T::extract (const CORBA::Any & any, TAO::Any_Impl *impl = any.impl (); - ACE_Message_Block *mb = impl->_tao_get_cdr (); - typedef TAO::Any_Special_Impl_T BOUNDED_TSTRING_ANY_IMPL; - if (mb == 0) + if (!impl->encoded ()) { TAO::Any_Special_Impl_T *narrow_impl = dynamic_cast (impl); @@ -151,23 +149,19 @@ TAO::Any_Special_Impl_T::extract (const CORBA::Any & any, auto_ptr > replacement_safety ( replacement ); + + // We know this will work since the unencoded case is covered above. + TAO::Unknown_IDL_Type *unk = + dynamic_cast (impl); - TAO_InputCDR cdr (mb->data_block (), - ACE_Message_Block::DONT_DELETE, - mb->rd_ptr () - mb->base (), - mb->wr_ptr () - mb->base (), - impl->_tao_byte_order (), - TAO_DEF_GIOP_MAJOR, - TAO_DEF_GIOP_MINOR); - - impl->assign_translator (tc, - &cdr - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + // We don't want the rd_ptr of unk to move, in case it is + // shared by another Any. This copies the state, not the buffer. + TAO_InputCDR for_reading (unk->_tao_get_cdr ()); - CORBA::Boolean result = replacement->demarshal_value (cdr); + CORBA::Boolean good_decode = + replacement->demarshal_value (for_reading); - if (result == 1) + if (good_decode) { _tao_elem = replacement->value_; const_cast (any).replace (replacement); diff --git a/TAO/tao/Any_SystemException.cpp b/TAO/tao/Any_SystemException.cpp index 0f5794c2225..ea168a4f405 100644 --- a/TAO/tao/Any_SystemException.cpp +++ b/TAO/tao/Any_SystemException.cpp @@ -1,7 +1,7 @@ // $Id$ #include "Any_SystemException.h" -#include "Any.h" +#include "Any_Unknown_IDL_Type.h" #include "CDR.h" #include "Exception.h" #include "Environment.h" @@ -100,9 +100,7 @@ TAO::Any_SystemException::extract (const CORBA::Any & any, TAO::Any_Impl *impl = any.impl (); - ACE_Message_Block *mb = impl->_tao_get_cdr (); - - if (mb == 0) + if (!impl->encoded ()) { TAO::Any_SystemException *narrow_impl = dynamic_cast (impl); @@ -127,22 +125,18 @@ TAO::Any_SystemException::extract (const CORBA::Any & any, auto_ptr replacement_safety (replacement); - TAO_InputCDR cdr (mb->data_block (), - ACE_Message_Block::DONT_DELETE, - mb->rd_ptr () - mb->base (), - mb->wr_ptr () - mb->base (), - impl->_tao_byte_order (), - TAO_DEF_GIOP_MAJOR, - TAO_DEF_GIOP_MINOR); - - impl->assign_translator (any_tc, - &cdr - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + // We know this will work since the unencoded case is covered above. + TAO::Unknown_IDL_Type *unk = + dynamic_cast (impl); + + // We don't want the rd_ptr of unk to move, in case it is + // shared by another Any. This copies the state, not the buffer. + TAO_InputCDR for_reading (unk->_tao_get_cdr ()); - CORBA::Boolean result = replacement->demarshal_value (cdr); + CORBA::Boolean good_decode = + replacement->demarshal_value (for_reading); - if (result == 1) + if (good_decode) { _tao_elem = replacement->value_; const_cast (any).replace (replacement); diff --git a/TAO/tao/Any_Unknown_IDL_Type.cpp b/TAO/tao/Any_Unknown_IDL_Type.cpp index 65b61162a2a..b6f9432f8f4 100644 --- a/TAO/tao/Any_Unknown_IDL_Type.cpp +++ b/TAO/tao/Any_Unknown_IDL_Type.cpp @@ -6,62 +6,37 @@ #include "tao/SystemException.h" #include "tao/Marshal.h" #include "tao/Typecode.h" -#include "tao/CDR.h" #include "ace/Dynamic_Service.h" #include "ace/OS_NS_string.h" - ACE_RCSID (tao, Any_Unknown_IDL_Type, "$Id$") - - + TAO::Unknown_IDL_Type::Unknown_IDL_Type ( CORBA::TypeCode_ptr tc, - const ACE_Message_Block *mb, - int byte_order, - ACE_Char_Codeset_Translator *ctrans, - ACE_WChar_Codeset_Translator *wtrans + TAO_InputCDR &cdr ) - : TAO::Any_Impl (0, tc), - cdr_ (0), - byte_order_ (byte_order), - char_translator_ (ctrans), - wchar_translator_ (wtrans) + : TAO::Any_Impl (0, tc, true), + cdr_ (static_cast (0)) { - if (mb != 0) + ACE_TRY_NEW_ENV + { + this->_tao_decode (cdr ACE_ENV_ARG_PARAMETER); + } + ACE_CATCH (CORBA::Exception, ex) { - ACE_NEW (this->cdr_, - ACE_Message_Block (*mb, - ACE_CDR::MAX_ALIGNMENT)); - - // Align the base pointer assuming that the incoming stream is also - // aligned the way we are aligned - char *start = - ACE_ptr_align_binary (mb->base (), - ACE_CDR::MAX_ALIGNMENT); - - size_t newrdpos = - mb->rd_ptr() - start; - - size_t newwrpos = - mb->wr_ptr() - start; - - if (newwrpos <= this->cdr_->space ()) - { - // Notice that ACE_Message_Block::duplicate may leave the - // wr_ptr() with a higher value than what we actually want. - this->cdr_->rd_ptr (newrdpos); - this->cdr_->wr_ptr (newwrpos); - } - else - { - ACE_ERROR ((LM_ERROR, - "TAO(%P|%t) - Unknown_IDL_Type::Unknown_IDL_Type " - "Couldn't align read and write pointers \n")); - } } + ACE_ENDTRY; +} + +TAO::Unknown_IDL_Type::Unknown_IDL_Type ( + CORBA::TypeCode_ptr tc + ) + : TAO::Any_Impl (0, tc, true), + cdr_ (static_cast (0)) +{ } TAO::Unknown_IDL_Type::~Unknown_IDL_Type (void) @@ -73,12 +48,13 @@ TAO::Unknown_IDL_Type::marshal_value (TAO_OutputCDR &cdr) { ACE_TRY_NEW_ENV { - TAO_InputCDR input (this->cdr_, - this->byte_order_); - + // We don't want the rd_ptr to move, in case we are shared by + // another Any, so we use this to copy the state, not the buffer. + TAO_InputCDR for_reading (this->cdr_); + TAO::traverse_status status = TAO_Marshal_Object::perform_append (this->type_, - &input, + &for_reading, &cdr ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; @@ -100,18 +76,17 @@ TAO::Unknown_IDL_Type::marshal_value (TAO_OutputCDR &cdr) const void * TAO::Unknown_IDL_Type::value (void) const { - return this->cdr_; + return this->cdr_.start (); } void TAO::Unknown_IDL_Type::free_value (void) { CORBA::release (this->type_); - delete this->cdr_; } -ACE_Message_Block * -TAO::Unknown_IDL_Type::_tao_get_cdr (void) const +TAO_InputCDR & +TAO::Unknown_IDL_Type::_tao_get_cdr (void) { return this->cdr_; } @@ -119,7 +94,7 @@ TAO::Unknown_IDL_Type::_tao_get_cdr (void) const int TAO::Unknown_IDL_Type::_tao_byte_order (void) const { - return this->byte_order_; + return this->cdr_.byte_order (); } void TAO::Unknown_IDL_Type::_tao_decode (TAO_InputCDR &cdr @@ -155,51 +130,28 @@ TAO::Unknown_IDL_Type::_tao_decode (TAO_InputCDR &cdr // space in the message block. size_t size = end - begin; - ACE_Message_Block::release (this->cdr_); - ACE_NEW (this->cdr_, + ACE_Message_Block *new_mb = 0; + ACE_NEW (new_mb, ACE_Message_Block (size + 2 * ACE_CDR::MAX_ALIGNMENT)); - ACE_CDR::mb_align (this->cdr_); + ACE_CDR::mb_align (new_mb); ptrdiff_t offset = ptrdiff_t (begin) % ACE_CDR::MAX_ALIGNMENT; if (offset < 0) - offset += ACE_CDR::MAX_ALIGNMENT; + { + offset += ACE_CDR::MAX_ALIGNMENT; + } - this->cdr_->rd_ptr (offset); - this->cdr_->wr_ptr (offset + size); + new_mb->rd_ptr (offset); + new_mb->wr_ptr (offset + size); - ACE_OS::memcpy (this->cdr_->rd_ptr (), + ACE_OS::memcpy (new_mb->rd_ptr (), begin, size); - this->byte_order_ = cdr.byte_order (); - - // Get character translators. - this->char_translator_ = cdr.char_translator(); - this->wchar_translator_ = cdr.wchar_translator(); -} - -void -TAO::Unknown_IDL_Type::assign_translator (CORBA::TypeCode_ptr tc, - TAO_InputCDR *cdr - ACE_ENV_ARG_DECL) -{ - CORBA::TCKind kind = tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - switch (kind) - { - case CORBA::tk_string: - case CORBA::tk_char: - cdr->char_translator (this->char_translator_); - break; - case CORBA::tk_wstring: - case CORBA::tk_wchar: - cdr->wchar_translator(this->wchar_translator_); - break; - default: - break; - } + this->cdr_.reset (new_mb, cdr.byte_order ()); + this->cdr_.char_translator (cdr.char_translator ()); + this->cdr_.wchar_translator (cdr.wchar_translator ()); } CORBA::Boolean @@ -228,13 +180,7 @@ TAO::Unknown_IDL_Type::to_object (CORBA::Object_ptr &obj) const return 0; } - TAO_InputCDR stream (this->cdr_, - this->byte_order_, - TAO_DEF_GIOP_MAJOR, - TAO_DEF_GIOP_MINOR, - 0); - - return stream >> obj; + return this->cdr_ >> obj; } ACE_CATCH (CORBA::Exception, ex) { @@ -270,12 +216,6 @@ TAO::Unknown_IDL_Type::to_value (CORBA::ValueBase *&val) const return 0; } - TAO_InputCDR stream (this->cdr_, - this->byte_order_, - TAO_DEF_GIOP_MAJOR, - TAO_DEF_GIOP_MINOR, - 0); - TAO_Valuetype_Adapter *adapter = ACE_Dynamic_Service::instance ( TAO_ORB_Core::valuetype_adapter_name () @@ -287,8 +227,7 @@ TAO::Unknown_IDL_Type::to_value (CORBA::ValueBase *&val) const 0); } - return adapter->stream_to_value (stream, - val); + return adapter->stream_to_value (this->cdr_, val); } ACE_CATCH (CORBA::Exception, ex) { @@ -324,12 +263,6 @@ TAO::Unknown_IDL_Type::to_abstract_base (CORBA::AbstractBase_ptr &obj) const return 0; } - TAO_InputCDR stream (this->cdr_, - this->byte_order_, - TAO_DEF_GIOP_MAJOR, - TAO_DEF_GIOP_MINOR, - TAO_ORB_Core_instance ()); - TAO_Valuetype_Adapter *adapter = ACE_Dynamic_Service::instance ( TAO_ORB_Core::valuetype_adapter_name () @@ -341,7 +274,7 @@ TAO::Unknown_IDL_Type::to_abstract_base (CORBA::AbstractBase_ptr &obj) const 0); } - return adapter->stream_to_abstract_base (stream, + return adapter->stream_to_abstract_base (this->cdr_, obj); } ACE_CATCH (CORBA::Exception, ex) diff --git a/TAO/tao/Any_Unknown_IDL_Type.h b/TAO/tao/Any_Unknown_IDL_Type.h index 720a7f30332..c764dc367e0 100644 --- a/TAO/tao/Any_Unknown_IDL_Type.h +++ b/TAO/tao/Any_Unknown_IDL_Type.h @@ -15,6 +15,7 @@ #include /**/ "ace/pre.h" #include "tao/Any_Impl.h" +#include "tao/CDR.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -36,34 +37,28 @@ namespace TAO { public: Unknown_IDL_Type (CORBA::TypeCode_ptr, - const ACE_Message_Block *mb = 0, - int byte_order = TAO_ENCAP_BYTE_ORDER, - ACE_Char_Codeset_Translator *ctrans = 0, - ACE_WChar_Codeset_Translator *wtrans = 0); + TAO_InputCDR &cdr); + + Unknown_IDL_Type (CORBA::TypeCode_ptr); + virtual ~Unknown_IDL_Type (void); virtual CORBA::Boolean marshal_value (TAO_OutputCDR &); virtual const void *value (void) const; virtual void free_value (void); - virtual ACE_Message_Block *_tao_get_cdr (void) const; + virtual TAO_InputCDR &_tao_get_cdr (void); virtual int _tao_byte_order (void) const; virtual void _tao_decode (TAO_InputCDR & ACE_ENV_ARG_DECL); - virtual void assign_translator (CORBA::TypeCode_ptr, - TAO_InputCDR * - ACE_ENV_ARG_DECL); virtual CORBA::Boolean to_object (CORBA::Object_ptr &) const; virtual CORBA::Boolean to_value (CORBA::ValueBase *&) const; virtual CORBA::Boolean to_abstract_base (CORBA::AbstractBase_ptr &) const; private: - ACE_Message_Block *cdr_; - int byte_order_; - ACE_Char_Codeset_Translator *char_translator_; - ACE_WChar_Codeset_Translator *wchar_translator_; + mutable TAO_InputCDR cdr_; }; } diff --git a/TAO/tao/CDR_Encaps_Codec.cpp b/TAO/tao/CDR_Encaps_Codec.cpp index 5ddf15c3c91..09534d58f03 100644 --- a/TAO/tao/CDR_Encaps_Codec.cpp +++ b/TAO/tao/CDR_Encaps_Codec.cpp @@ -169,43 +169,27 @@ TAO_CDR_Encaps_Codec::encode_value (const CORBA::Any & data if ((cdr << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))) { - ACE_Message_Block * mb = data._tao_get_cdr (); - - auto_ptr safe_mb; - - if (mb == 0) + TAO::Any_Impl *impl = data.impl (); + + if (impl->encoded ()) { - ACE_Message_Block * tmp; - - ACE_NEW_THROW_EX (tmp, - ACE_Message_Block, - CORBA::NO_MEMORY ()); + TAO::Unknown_IDL_Type *unk = + dynamic_cast (impl); + + // We don't want unk's rd_ptr to move, in case we are shared by + // another Any, so we use this to copy the state, not the buffer. + TAO_InputCDR for_reading (unk->_tao_get_cdr ()); + + TAO_Marshal_Object::perform_append (data._tao_get_typecode (), + &for_reading, + &cdr + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); - - ACE_AUTO_PTR_RESET (safe_mb, - tmp, - ACE_Message_Block); - - mb = tmp; - - TAO_OutputCDR out; - CORBA::Any any (data); - any.impl ()->marshal_value (out); - - ACE_CDR::consolidate (mb, out.begin ()); } - - TAO_InputCDR input (mb, - data._tao_byte_order (), - this->major_, - this->minor_, - this->orb_core_); - - TAO_Marshal_Object::perform_append (data._tao_get_typecode (), - &input, - &cdr - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); + else + { + impl->marshal_value (cdr); + } // TAO extension: replace the contents of the octet sequence with // the CDR stream. @@ -299,84 +283,27 @@ TAO_CDR_Encaps_Codec::decode_value (const CORBA::OctetSeq & data, { cdr.reset_byte_order (static_cast (byte_order)); - // @@ (JP) The following code depends on the fact that - // TAO_InputCDR does not contain chained message blocks, - // otherwise and could be part of - // different buffers! - - // This will be the start of a new message block. - char *begin = cdr.rd_ptr (); - - // Skip over the next argument. - TAO::traverse_status status = - TAO_Marshal_Object::perform_skip (tc, - &cdr - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); // @@ Should we throw a - // IOP::Codec::TypeMismatch exception - // here if this fails? + CORBA::Any * any = 0; + ACE_NEW_THROW_EX (any, + CORBA::Any, + CORBA::NO_MEMORY ( + CORBA::SystemException::_tao_minor_code ( + 0, + ENOMEM + ), + CORBA::COMPLETED_NO + )); + ACE_CHECK_RETURN (0); - if (status == TAO::TRAVERSE_CONTINUE) - { - // This will be the end of the new message block. - char *end = cdr.rd_ptr (); - size_t size = end - begin; - - // @@ I added the following check, but I'm not sure if it is - // a valid check. Can someone verify this? - // -Ossama - - // If the unaligned buffer size is not equal to the octet - // sequence length (minus the "byte order byte") then the - // TypeCode does not correspond to the data in the CDR - // encapsulation. However, even if they do match it is - // still uncertain if the TypeCode corresponds to the data - // in the octet sequence. With this test, it is only - // possible to determine if the TypeCode does *not* match - // the data, not if it does match. - if (size != sequence_length - 1) - { - ACE_THROW_RETURN (IOP::Codec::TypeMismatch (), - 0); - } - - ptrdiff_t offset = - ptrdiff_t (begin) % ACE_CDR::MAX_ALIGNMENT; - if (offset < 0) - offset += ACE_CDR::MAX_ALIGNMENT; - - mb.rd_ptr (offset); - mb.wr_ptr (offset + size); - - CORBA::Any * any = 0; - ACE_NEW_THROW_EX (any, - CORBA::Any, - CORBA::NO_MEMORY ( - CORBA::SystemException::_tao_minor_code ( - 0, - ENOMEM - ), - CORBA::COMPLETED_NO - )); - ACE_CHECK_RETURN (0); + CORBA::Any_var safe_any = any; - CORBA::Any_var safe_any = any; - - // Stick it into the Any. - TAO::Unknown_IDL_Type *unk = 0; - ACE_NEW_RETURN (unk, - TAO::Unknown_IDL_Type (tc, - &mb, - cdr.byte_order ()), - 0); - any->replace (unk); - return safe_any._retn (); - } - else - { - ACE_THROW_RETURN (IOP::Codec::TypeMismatch (), - 0); - } + // Stick it into the Any. + TAO::Unknown_IDL_Type *unk = 0; + ACE_NEW_RETURN (unk, + TAO::Unknown_IDL_Type (tc, cdr), + 0); + any->replace (unk); + return safe_any._retn (); } ACE_THROW_RETURN (IOP::Codec::FormatMismatch (), diff --git a/TAO/tao/DynamicAny/DynAny_i.cpp b/TAO/tao/DynamicAny/DynAny_i.cpp index 6a4e58536ea..9610c1ac243 100644 --- a/TAO/tao/DynamicAny/DynAny_i.cpp +++ b/TAO/tao/DynamicAny/DynAny_i.cpp @@ -117,11 +117,10 @@ TAO_DynAny_i::set_to_default_value (CORBA::TypeCode_ptr tc { TAO_OutputCDR stream; stream << CORBA::Object::_nil (); + TAO_InputCDR in (stream); TAO::Unknown_IDL_Type *unk = 0; ACE_NEW (unk, - TAO::Unknown_IDL_Type (tc, - stream.begin (), - TAO_ENCAP_BYTE_ORDER)); + TAO::Unknown_IDL_Type (tc, in)); this->any_.replace (unk); break; } diff --git a/TAO/tao/DynamicAny/DynArray_i.cpp b/TAO/tao/DynamicAny/DynArray_i.cpp index e04bebb7421..e1393c8a740 100644 --- a/TAO/tao/DynamicAny/DynArray_i.cpp +++ b/TAO/tao/DynamicAny/DynArray_i.cpp @@ -57,26 +57,23 @@ TAO_DynArray_i::init (const CORBA::Any & any this->init_common (); - // Get the CDR stream of the argument. - ACE_Message_Block* mb = any._tao_get_cdr (); - bool type_known = false; + // Get the CDR stream of the Any, if there isn't one, make one. + TAO::Any_Impl *impl = any.impl (); + TAO_OutputCDR out; + TAO_InputCDR cdr (static_cast (0)); - if (mb == 0) + if (impl->encoded ()) { - ACE_NEW (mb, - ACE_Message_Block); - TAO_OutputCDR out; - any.impl ()->marshal_value (out); - ACE_CDR::consolidate (mb, out.begin ()); - type_known = true; + TAO::Unknown_IDL_Type *unk = + dynamic_cast (impl); + + cdr = unk->_tao_get_cdr (); } - - TAO_InputCDR cdr (mb, - any._tao_byte_order ()); - - if (type_known) + else { - mb->release (); + impl->marshal_value (out); + TAO_InputCDR tmp_in (out); + cdr = tmp_in; } CORBA::TypeCode_var field_tc = @@ -86,12 +83,11 @@ TAO_DynArray_i::init (const CORBA::Any & any for (CORBA::ULong i = 0; i < numfields; ++i) { CORBA::Any field_any; - TAO::Unknown_IDL_Type *unk = 0; - ACE_NEW (unk, + TAO::Unknown_IDL_Type *field_unk = 0; + ACE_NEW (field_unk, TAO::Unknown_IDL_Type (field_tc.in (), - cdr.start (), - cdr.byte_order ())); - field_any.replace (unk); + TAO_InputCDR (cdr))); + field_any.replace (field_unk); // This recursive step will call the correct constructor // based on the type of field_any. @@ -419,26 +415,23 @@ TAO_DynArray_i::from_any (const CORBA::Any& any if (equivalent) { - // Get the CDR stream of the argument. - ACE_Message_Block* mb = any._tao_get_cdr (); - bool type_known = false; + // Get the CDR stream of the Any,if there isn't one, make one. + TAO::Any_Impl *impl = any.impl (); + TAO_OutputCDR out; + TAO_InputCDR cdr (static_cast (0)); - if (mb == 0) + if (impl->encoded ()) { - ACE_NEW (mb, - ACE_Message_Block); - TAO_OutputCDR out; - any.impl ()->marshal_value (out); - ACE_CDR::consolidate (mb, out.begin ()); - type_known = true; + TAO::Unknown_IDL_Type *unk = + dynamic_cast (impl); + + cdr = unk->_tao_get_cdr (); } - - TAO_InputCDR cdr (mb, - any._tao_byte_order ()); - - if (type_known) + else { - mb->release (); + impl->marshal_value (out); + TAO_InputCDR tmp_in (out); + cdr = tmp_in; } CORBA::ULong length = ACE_static_cast (CORBA::ULong, @@ -459,12 +452,11 @@ TAO_DynArray_i::from_any (const CORBA::Any& any for (CORBA::ULong i = 0; i < arg_length; ++i) { CORBA::Any field_any; - TAO::Unknown_IDL_Type *unk = 0; - ACE_NEW (unk, + TAO::Unknown_IDL_Type *field_unk = 0; + ACE_NEW (field_unk, TAO::Unknown_IDL_Type (field_tc.in (), - cdr.start (), - cdr.byte_order ())); - field_any.replace (unk); + TAO_InputCDR (cdr))); + field_any.replace (field_unk); this->da_members_[i]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; @@ -517,26 +509,22 @@ TAO_DynArray_i::to_any (ACE_ENV_SINGLE_ARG_DECL) this->da_members_[i]->to_any (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (0); - ACE_Message_Block* field_mb = field_any->_tao_get_cdr (); + TAO::Any_Impl *field_impl = field_any->impl (); + TAO_OutputCDR field_out; + TAO_InputCDR field_cdr (static_cast (0)); - if (field_mb == 0) + if (field_impl->encoded ()) { - ACE_NEW_THROW_EX (field_mb, - ACE_Message_Block, - CORBA::NO_MEMORY ()); - TAO_OutputCDR out; - field_any->impl ()->marshal_value (out); - ACE_CDR::consolidate (field_mb, out.begin ()); - type_known = true; + TAO::Unknown_IDL_Type *field_unk = + dynamic_cast (field_impl); + + field_cdr = field_unk->_tao_get_cdr (); } - - TAO_InputCDR field_cdr (field_mb, - field_any->_tao_byte_order ()); - - if (type_known) + else { - field_mb->release (); - type_known = false; + field_impl->marshal_value (field_out); + TAO_InputCDR tmp_in (field_out); + field_cdr = tmp_in; } (void) TAO_Marshal_Object::perform_append (field_tc.in (), @@ -557,8 +545,7 @@ TAO_DynArray_i::to_any (ACE_ENV_SINGLE_ARG_DECL) TAO::Unknown_IDL_Type *unk = 0; ACE_NEW_THROW_EX (unk, TAO::Unknown_IDL_Type (this->type_.in (), - in_cdr.start (), - in_cdr.byte_order ()), + in_cdr), CORBA::NO_MEMORY ()); ACE_CHECK_RETURN (0); diff --git a/TAO/tao/DynamicAny/DynCommon.cpp b/TAO/tao/DynamicAny/DynCommon.cpp index 8d4a7414cf4..7b08240452a 100644 --- a/TAO/tao/DynamicAny/DynCommon.cpp +++ b/TAO/tao/DynamicAny/DynCommon.cpp @@ -513,11 +513,11 @@ TAO_DynCommon::insert_reference (CORBA::Object_ptr value value->marshal (cdr); } + TAO_InputCDR in (cdr); TAO::Unknown_IDL_Type *unk = 0; ACE_NEW (unk, TAO::Unknown_IDL_Type (this->type_.in (), - cdr.begin (), - TAO_ENCAP_BYTE_ORDER)); + in)); this->any_.replace (unk); } else diff --git a/TAO/tao/DynamicAny/DynEnum_i.cpp b/TAO/tao/DynamicAny/DynEnum_i.cpp index 38d1b5ac127..8e2b7314d18 100644 --- a/TAO/tao/DynamicAny/DynEnum_i.cpp +++ b/TAO/tao/DynamicAny/DynEnum_i.cpp @@ -50,28 +50,26 @@ TAO_DynEnum_i::init (const CORBA::Any &any this->type_ = tc; - ACE_Message_Block *mb = any._tao_get_cdr (); - bool type_known = false; + TAO::Any_Impl *impl = any.impl (); - if (mb == 0) + if (impl->encoded ()) { - ACE_NEW (mb, - ACE_Message_Block); - TAO_OutputCDR out; - any.impl ()->marshal_value (out); - ACE_CDR::consolidate (mb, out.begin ()); - type_known = true; + TAO::Unknown_IDL_Type *unk = + dynamic_cast (impl); + + // We don't want unk's rd_ptr to move, in case we are shared by + // another Any, so we use this to copy the state, not the buffer. + TAO_InputCDR for_reading (unk->_tao_get_cdr ()); + for_reading.read_ulong (this->value_); } - - TAO_InputCDR cdr (mb, - any._tao_byte_order ()); - - if (type_known) + else { - mb->release (); + TAO_OutputCDR out; + impl->marshal_value (out); + TAO_InputCDR in (out); + in.read_ulong (this->value_); } - cdr.read_ulong (this->value_); this->init_common (); } @@ -212,29 +210,26 @@ TAO_DynEnum_i::from_any (const CORBA::Any& any if (kind == CORBA::tk_enum) { - // Get the CDR stream of the argument. - ACE_Message_Block* mb = any._tao_get_cdr (); - bool type_known = false; + // Get the CDR stream of the Any, if there isn't one, make one. + TAO::Any_Impl *impl = any.impl (); - if (mb == 0) + if (impl->encoded ()) { - ACE_NEW (mb, - ACE_Message_Block); - TAO_OutputCDR out; - any.impl ()->marshal_value (out); - ACE_CDR::consolidate (mb, out.begin ()); - type_known = true; + TAO::Unknown_IDL_Type *unk = + dynamic_cast (impl); + + // We don't want unk's rd_ptr to move, in case we are shared by + // another Any, so we use this to copy the state, not the buffer. + TAO_InputCDR for_reading (unk->_tao_get_cdr ()); + for_reading.read_ulong (this->value_); } - - TAO_InputCDR cdr (mb, - any._tao_byte_order ()); - - if (type_known) + else { - mb->release (); + TAO_OutputCDR out; + impl->marshal_value (out); + TAO_InputCDR in (out); + in.read_ulong (this->value_); } - - cdr.read_ulong (this->value_); } else { @@ -258,11 +253,11 @@ TAO_DynEnum_i::to_any (ACE_ENV_SINGLE_ARG_DECL) CORBA::NO_MEMORY ()); ACE_CHECK_RETURN (0); + TAO_InputCDR in_cdr (out_cdr); TAO::Unknown_IDL_Type *unk = 0; ACE_NEW_THROW_EX (unk, TAO::Unknown_IDL_Type (this->type_.in (), - out_cdr.begin (), - TAO_ENCAP_BYTE_ORDER), + in_cdr), CORBA::NO_MEMORY ()); ACE_CHECK_RETURN (0); @@ -292,31 +287,27 @@ TAO_DynEnum_i::equal (DynamicAny::DynAny_ptr rhs CORBA::Any_var any = rhs->to_any (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (0); - ACE_Message_Block *mb = any->_tao_get_cdr (); - bool type_known = false; + TAO::Any_Impl *impl = any->impl (); + CORBA::ULong value; - if (mb == 0) + if (impl->encoded ()) { - ACE_NEW_RETURN (mb, - ACE_Message_Block, - 0); - TAO_OutputCDR out; - any->impl ()->marshal_value (out); - ACE_CDR::consolidate (mb, out.begin ()); - type_known = true; + TAO::Unknown_IDL_Type *unk = + dynamic_cast (impl); + + // We don't want unk's rd_ptr to move, in case we are shared by + // another Any, so we use this to copy the state, not the buffer. + TAO_InputCDR for_reading (unk->_tao_get_cdr ()); + for_reading.read_ulong (value); } - - TAO_InputCDR cdr (mb, - any->_tao_byte_order ()); - - if (type_known) + else { - mb->release (); + TAO_OutputCDR out; + impl->marshal_value (out); + TAO_InputCDR in (out); + in.read_ulong (value); } - CORBA::ULong value; - cdr.read_ulong (value); - return value == this->value_; } diff --git a/TAO/tao/DynamicAny/DynSequence_i.cpp b/TAO/tao/DynamicAny/DynSequence_i.cpp index 51a19b0a495..dfd9843f310 100644 --- a/TAO/tao/DynamicAny/DynSequence_i.cpp +++ b/TAO/tao/DynamicAny/DynSequence_i.cpp @@ -50,30 +50,26 @@ TAO_DynSequence_i::init (const CORBA::Any& any this->type_ = tc; - // Get the CDR stream of the argument. - ACE_Message_Block *mb = any._tao_get_cdr (); - bool type_known = false; + // Get the CDR stream of the Any, if there isn't one, make one. + TAO::Any_Impl *impl = any.impl (); + CORBA::ULong length; + TAO_OutputCDR out; + TAO_InputCDR cdr (static_cast (0)); - if (mb == 0) + if (impl->encoded ()) { - ACE_NEW (mb, - ACE_Message_Block); - TAO_OutputCDR out; - any.impl ()->marshal_value (out); - ACE_CDR::consolidate (mb, out.begin ()); - type_known = true; + TAO::Unknown_IDL_Type *unk = + dynamic_cast (impl); + + cdr = unk->_tao_get_cdr (); } - - TAO_InputCDR cdr (mb, - any._tao_byte_order ()); - - if (type_known) + else { - mb->release (); + impl->marshal_value (out); + TAO_InputCDR tmp_in (out); + cdr = tmp_in; } - CORBA::ULong length; - // If the any is a sequence, first 4 bytes of cdr hold the // length. cdr.read_ulong (length); @@ -91,12 +87,11 @@ TAO_DynSequence_i::init (const CORBA::Any& any for (CORBA::ULong i = 0; i < length; ++i) { CORBA::Any field_any; - TAO::Unknown_IDL_Type *unk = 0; - ACE_NEW (unk, + TAO::Unknown_IDL_Type *field_unk = 0; + ACE_NEW (field_unk, TAO::Unknown_IDL_Type (field_tc.in (), - cdr.start (), - cdr.byte_order ())); - field_any.replace (unk); + TAO_InputCDR (cdr))); + field_any.replace (field_unk); // This recursive step will call the correct constructor // based on the type of field_any. @@ -565,28 +560,26 @@ TAO_DynSequence_i::from_any (const CORBA::Any & any if (equivalent) { - // Get the CDR stream of the argument. - ACE_Message_Block *mb = any._tao_get_cdr (); - bool type_known = false; + // Get the CDR stream of the Any, if there isn't one, make one. + TAO::Any_Impl *impl = any.impl (); + TAO_OutputCDR out; + TAO_InputCDR cdr (static_cast (0)); - if (mb == 0) + if (impl->encoded ()) { - ACE_NEW (mb, - ACE_Message_Block); - TAO_OutputCDR out; - any.impl ()->marshal_value (out); - ACE_CDR::consolidate (mb, out.begin ()); - type_known = true; + TAO::Unknown_IDL_Type *unk = + dynamic_cast (impl); + + cdr = unk->_tao_get_cdr (); } - - TAO_InputCDR cdr (mb, - any._tao_byte_order ()); - - if (type_known) + else { - mb->release (); + impl->marshal_value (out); + TAO_InputCDR tmp_in (out); + cdr = tmp_in; } + CORBA::ULong arg_length; // If the any is a sequence, first 4 bytes of cdr hold the @@ -606,12 +599,11 @@ TAO_DynSequence_i::from_any (const CORBA::Any & any for (CORBA::ULong i = 0; i < arg_length; ++i) { CORBA::Any field_any; - TAO::Unknown_IDL_Type *unk = 0; - ACE_NEW (unk, + TAO::Unknown_IDL_Type *field_unk = 0; + ACE_NEW (field_unk, TAO::Unknown_IDL_Type (field_tc.in (), - cdr.start (), - cdr.byte_order ())); - field_any.replace (unk); + TAO_InputCDR (cdr))); + field_any.replace (field_unk); if (i < this->component_count_) { @@ -668,15 +660,12 @@ TAO_DynSequence_i::to_any (ACE_ENV_SINGLE_ARG_DECL) } TAO_OutputCDR out_cdr; - out_cdr.write_ulong (this->component_count_); CORBA::TypeCode_var field_tc = this->get_element_type (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (0); - bool type_known = false; - for (CORBA::ULong i = 0; i < this->component_count_; ++i) { // Recursive step @@ -684,26 +673,22 @@ TAO_DynSequence_i::to_any (ACE_ENV_SINGLE_ARG_DECL) this->da_members_[i]->to_any (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (0); - ACE_Message_Block *field_mb = field_any->_tao_get_cdr (); + TAO::Any_Impl *field_impl = field_any->impl (); + TAO_OutputCDR field_out; + TAO_InputCDR field_cdr (static_cast (0)); - if (field_mb == 0) + if (field_impl->encoded ()) { - ACE_NEW_RETURN (field_mb, - ACE_Message_Block, - 0); - TAO_OutputCDR out; - field_any->impl ()->marshal_value (out); - ACE_CDR::consolidate (field_mb, out.begin ()); - type_known = true; + TAO::Unknown_IDL_Type *field_unk = + dynamic_cast (field_impl); + + field_cdr = field_unk->_tao_get_cdr (); } - - TAO_InputCDR field_cdr (field_mb, - field_any->_tao_byte_order ()); - - if (type_known) + else { - field_mb->release (); - type_known = false; + field_impl->marshal_value (field_out); + TAO_InputCDR tmp_in (field_out); + field_cdr = tmp_in; } (void) TAO_Marshal_Object::perform_append (field_tc.in (), @@ -724,8 +709,7 @@ TAO_DynSequence_i::to_any (ACE_ENV_SINGLE_ARG_DECL) TAO::Unknown_IDL_Type *unk = 0; ACE_NEW_THROW_EX (unk, TAO::Unknown_IDL_Type (this->type_.in (), - in_cdr.start (), - in_cdr.byte_order ()), + in_cdr), CORBA::NO_MEMORY ()); ACE_CHECK_RETURN (0); diff --git a/TAO/tao/DynamicAny/DynStruct_i.cpp b/TAO/tao/DynamicAny/DynStruct_i.cpp index ee75bf1e13b..2cd93ecb739 100644 --- a/TAO/tao/DynamicAny/DynStruct_i.cpp +++ b/TAO/tao/DynamicAny/DynStruct_i.cpp @@ -86,26 +86,23 @@ TAO_DynStruct_i::set_from_any (const CORBA::Any & any this->init_common (); - // Get the CDR stream of the argument. - ACE_Message_Block *mb = any._tao_get_cdr (); - bool type_known = false; + // Get the CDR stream of the Any, if there isn't one, make one. + TAO::Any_Impl *impl = any.impl (); + TAO_OutputCDR out; + TAO_InputCDR in (static_cast (0)); + TAO::Unknown_IDL_Type *unk = 0; - if (mb == 0) + if (impl->encoded ()) { - ACE_NEW (mb, - ACE_Message_Block); - TAO_OutputCDR out; - any.impl ()->marshal_value (out); - ACE_CDR::consolidate (mb, out.begin ()); - type_known = true; + unk = dynamic_cast (impl); + + in = unk->_tao_get_cdr (); } - - TAO_InputCDR cdr (mb, - any._tao_byte_order ()); - - if (type_known) + else { - mb->release (); + impl->marshal_value (out); + TAO_InputCDR tmp_in (out); + in = tmp_in; } // If we have an exception type, unmarshal the repository ID. @@ -116,7 +113,7 @@ TAO_DynStruct_i::set_from_any (const CORBA::Any & any if (kind == CORBA::tk_except) { CORBA::String_var str; - cdr >> str.out (); + in >> str.out (); } for (CORBA::ULong i = 0; i < numfields; i++) @@ -127,11 +124,9 @@ TAO_DynStruct_i::set_from_any (const CORBA::Any & any ACE_CHECK; CORBA::Any field_any; - TAO::Unknown_IDL_Type *unk = 0; ACE_NEW (unk, TAO::Unknown_IDL_Type (field_tc.in (), - cdr.start (), - cdr.byte_order ())); + TAO_InputCDR (in))); field_any.replace (unk); // This recursive step will call the correct constructor @@ -143,7 +138,7 @@ TAO_DynStruct_i::set_from_any (const CORBA::Any & any // Move to the next field in the CDR stream. (void) TAO_Marshal_Object::perform_skip (field_tc.in (), - &cdr + &in ACE_ENV_ARG_PARAMETER); ACE_CHECK; } @@ -543,26 +538,23 @@ TAO_DynStruct_i::from_any (const CORBA::Any & any if (equivalent) { - // Get the CDR stream of the argument. - ACE_Message_Block* mb = any._tao_get_cdr (); - bool type_known = false; + // Get the CDR stream of the Any, if there isn't one, make one. + TAO::Any_Impl *impl = any.impl (); + TAO_OutputCDR out; + TAO_InputCDR in (static_cast (0)); + TAO::Unknown_IDL_Type *unk = 0; - if (mb == 0) + if (impl->encoded ()) { - ACE_NEW (mb, - ACE_Message_Block); - TAO_OutputCDR out; - any.impl ()->marshal_value (out); - ACE_CDR::consolidate (mb, out.begin ()); - type_known = true; + unk = dynamic_cast (impl); + + in = unk->_tao_get_cdr (); } - - TAO_InputCDR cdr (mb, - any._tao_byte_order ()); - - if (type_known) + else { - mb->release (); + impl->marshal_value (out); + TAO_InputCDR tmp_in (out); + in = tmp_in; } // If we have an exception type, unmarshal the repository ID. @@ -574,7 +566,7 @@ TAO_DynStruct_i::from_any (const CORBA::Any & any if (kind == CORBA::tk_except) { CORBA::String_var str; - cdr >> str.out (); + in >> str.out (); } CORBA::TypeCode_var field_tc; @@ -592,8 +584,7 @@ TAO_DynStruct_i::from_any (const CORBA::Any & any TAO::Unknown_IDL_Type *unk = 0; ACE_NEW (unk, TAO::Unknown_IDL_Type (field_tc.in (), - cdr.start (), - cdr.byte_order ())); + TAO_InputCDR (in))); field_any.replace (unk); this->da_members_[i]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); @@ -606,7 +597,7 @@ TAO_DynStruct_i::from_any (const CORBA::Any & any // Move to the next field in the CDR stream. (void) TAO_Marshal_Object::perform_skip (field_tc.in (), - &cdr + &in ACE_ENV_ARG_PARAMETER); ACE_CHECK; } @@ -644,6 +635,9 @@ TAO_DynStruct_i::to_any (ACE_ENV_SINGLE_ARG_DECL) } bool type_known = false; + TAO::Any_Impl *field_impl = 0; + TAO::Unknown_IDL_Type *field_unk = 0; + TAO_InputCDR field_in_cdr (static_cast (0)); for (CORBA::ULong i = 0; i < this->component_count_; ++i) { @@ -656,30 +650,25 @@ TAO_DynStruct_i::to_any (ACE_ENV_SINGLE_ARG_DECL) this->da_members_[i]->to_any (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (0); - ACE_Message_Block *field_mb = field_any->_tao_get_cdr (); + TAO_OutputCDR field_out_cdr; + field_impl = field_any->impl (); - if (field_mb == 0) + if (field_impl->encoded ()) { - ACE_NEW_RETURN (field_mb, - ACE_Message_Block, - 0); - TAO_OutputCDR out; - field_any->impl ()->marshal_value (out); - ACE_CDR::consolidate (field_mb, out.begin ()); - type_known = true; + field_unk = + dynamic_cast (field_impl); + + field_in_cdr = field_unk->_tao_get_cdr (); } - - TAO_InputCDR field_cdr (field_mb, - field_any->_tao_byte_order ()); - - if (type_known) + else { - field_mb->release (); - type_known = false; + field_impl->marshal_value (field_out_cdr); + TAO_InputCDR tmp (field_out_cdr); + field_in_cdr = tmp; } (void) TAO_Marshal_Object::perform_append (field_tc.in (), - &field_cdr, + &field_in_cdr, &out_cdr ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); @@ -696,8 +685,7 @@ TAO_DynStruct_i::to_any (ACE_ENV_SINGLE_ARG_DECL) TAO::Unknown_IDL_Type *unk = 0; ACE_NEW_THROW_EX (unk, TAO::Unknown_IDL_Type (this->type_.in (), - in_cdr.start (), - in_cdr.byte_order ()), + in_cdr), CORBA::NO_MEMORY ()); ACE_CHECK_RETURN (0); diff --git a/TAO/tao/DynamicAny/DynUnion_i.cpp b/TAO/tao/DynamicAny/DynUnion_i.cpp index 9eee9336906..110b182c6ef 100644 --- a/TAO/tao/DynamicAny/DynUnion_i.cpp +++ b/TAO/tao/DynamicAny/DynUnion_i.cpp @@ -138,38 +138,36 @@ TAO_DynUnion_i::set_from_any (const CORBA::Any & any, ACE_ENV_ARG_PARAMETER); ACE_CHECK; - // Get the CDR stream of the argument. - ACE_Message_Block* mb = any._tao_get_cdr (); - bool type_known = false; - - if (mb == 0) - { - ACE_NEW (mb, - ACE_Message_Block); - TAO_OutputCDR out; - any.impl ()->marshal_value (out); - ACE_CDR::consolidate (mb, out.begin ()); - type_known = true; - } - - TAO_InputCDR cdr (mb, - any._tao_byte_order ()); - - if (type_known) - { - mb->release (); - } - CORBA::TypeCode_var disc_tc = tc->discriminator_type (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; CORBA::Any disc_any; TAO::Unknown_IDL_Type *unk = 0; + + // Get a CDR stream - if the Any doesn't have one, make one. + TAO::Any_Impl *impl = any.impl (); + TAO_OutputCDR out; + TAO_InputCDR in (static_cast (0)); + + if (impl->encoded ()) + { + TAO::Unknown_IDL_Type *tmp = + dynamic_cast (impl); + + in = tmp->_tao_get_cdr (); + } + else + { + impl->marshal_value (out); + TAO_InputCDR tmp_in (out); + in = tmp_in; + } + ACE_NEW (unk, - TAO::Unknown_IDL_Type (disc_tc.in (), - cdr.start (), - cdr.byte_order ())); + TAO::Unknown_IDL_Type (disc_tc.in (), + TAO_InputCDR (in))); + disc_any.replace (unk); // Need this here because we might have been called from init(). @@ -187,7 +185,7 @@ TAO_DynUnion_i::set_from_any (const CORBA::Any & any, // Move to the next field in the CDR stream. (void) TAO_Marshal_Object::perform_skip (disc_tc.in (), - &cdr + &in ACE_ENV_ARG_PARAMETER); ACE_CHECK; @@ -207,7 +205,7 @@ TAO_DynUnion_i::set_from_any (const CORBA::Any & any, for (i = 0; i < count; ++i) { CORBA::Any_var label_any = tc->member_label (i - ACE_ENV_ARG_PARAMETER); + ACE_ENV_ARG_PARAMETER); ACE_CHECK; match = this->label_match (label_any.in (), @@ -239,8 +237,7 @@ TAO_DynUnion_i::set_from_any (const CORBA::Any & any, TAO::Unknown_IDL_Type *unk = 0; ACE_NEW (unk, TAO::Unknown_IDL_Type (member_tc.in (), - cdr.start (), - cdr.byte_order ())); + in)); member_any.replace (unk); this->member_ = @@ -283,8 +280,7 @@ TAO_DynUnion_i::set_from_any (const CORBA::Any & any, TAO::Unknown_IDL_Type *unk = 0; ACE_NEW (unk, TAO::Unknown_IDL_Type (default_tc.in (), - cdr.start (), - cdr.byte_order ())); + in)); default_any.replace (unk); this->member_ = @@ -776,73 +772,65 @@ TAO_DynUnion_i::to_any (ACE_ENV_SINGLE_ARG_DECL) this->discriminator_->to_any (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (0); - ACE_Message_Block *disc_mb = disc_any->_tao_get_cdr (); - bool type_known = false; + TAO::Any_Impl *disc_any_impl = disc_any->impl (); + TAO_OutputCDR disc_out_cdr; + TAO_InputCDR disc_in_cdr (static_cast (0)); - if (disc_mb == 0) + if (disc_any_impl->encoded ()) { - ACE_NEW_RETURN (disc_mb, - ACE_Message_Block, - 0); - TAO_OutputCDR out; - disc_any->impl ()->marshal_value (out); - ACE_CDR::consolidate (disc_mb, out.begin ()); - type_known = true; + TAO::Unknown_IDL_Type *disc_unk = + dynamic_cast (disc_any_impl); + + disc_in_cdr = disc_unk->_tao_get_cdr (); } - - TAO_InputCDR disc_cdr (disc_mb, - disc_any->_tao_byte_order ()); - - if (type_known) + else { - disc_mb->release (); - type_known = false; + disc_any_impl->marshal_value (disc_out_cdr); + TAO_InputCDR disc_tmp_in_cdr (disc_out_cdr); + disc_in_cdr = disc_tmp_in_cdr; } (void) TAO_Marshal_Object::perform_append (disc_tc.in (), - &disc_cdr, + &disc_in_cdr, &out_cdr ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); // Add the member to the CDR stream unless it has no active member. if (this->has_no_active_member () == 0) - { - CORBA::TypeCode_var member_tc = - this->member_->type (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - CORBA::Any_var member_any = - this->member_->to_any (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - ACE_Message_Block *member_mb = member_any->_tao_get_cdr (); - - if (member_mb == 0) - { - ACE_NEW_RETURN (member_mb, - ACE_Message_Block, - 0); - TAO_OutputCDR out; - member_any->impl ()->marshal_value (out); - ACE_CDR::consolidate (member_mb, out.begin ()); - type_known = true; - } - - TAO_InputCDR member_cdr (member_mb, - member_any->_tao_byte_order ()); - - if (type_known) - { - member_mb->release (); - } - - (void) TAO_Marshal_Object::perform_append (member_tc.in (), - &member_cdr, - &out_cdr - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - } + { + CORBA::TypeCode_var member_tc = + this->member_->type (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + CORBA::Any_var member_any = + this->member_->to_any (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + TAO::Any_Impl *member_any_impl = member_any->impl (); + TAO_OutputCDR member_out_cdr; + TAO_InputCDR member_in_cdr (static_cast (0)); + + if (member_any_impl->encoded ()) + { + TAO::Unknown_IDL_Type *member_unk = + dynamic_cast (member_any_impl); + + member_in_cdr = member_unk->_tao_get_cdr (); + } + else + { + member_any_impl->marshal_value (member_out_cdr); + TAO_InputCDR member_tmp_in_cdr (member_out_cdr); + member_in_cdr = member_tmp_in_cdr; + } + + (void) TAO_Marshal_Object::perform_append (member_tc.in (), + &member_in_cdr, + &out_cdr + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + } // Make the Any. TAO_InputCDR in_cdr (out_cdr); @@ -856,8 +844,7 @@ TAO_DynUnion_i::to_any (ACE_ENV_SINGLE_ARG_DECL) TAO::Unknown_IDL_Type *unk = 0; ACE_NEW_THROW_EX (unk, TAO::Unknown_IDL_Type (this->type_.in (), - in_cdr.start (), - in_cdr.byte_order ()), + in_cdr), CORBA::NO_MEMORY ()); ACE_CHECK_RETURN (0); @@ -1085,33 +1072,47 @@ TAO_DynUnion_i::label_match (const CORBA::Any &my_any, { CORBA::ULong my_val; CORBA::ULong other_val; - ACE_Message_Block *mb = my_any._tao_get_cdr (); - bool type_known = false; + + TAO::Any_Impl *my_impl = my_any.impl (); - if (mb == 0) + if (my_impl->encoded ()) { - ACE_NEW_RETURN (mb, - ACE_Message_Block, - 0); - TAO_OutputCDR out; - my_any.impl ()->marshal_value (out); - ACE_CDR::consolidate (mb, out.begin ()); - type_known = true; + TAO::Unknown_IDL_Type *my_unk = + dynamic_cast (my_impl); + + // We don't want unk's rd_ptr to move, in case we are shared by + // another Any, so we use this to copy the state, not the buffer. + TAO_InputCDR for_reading (my_unk->_tao_get_cdr ()); + for_reading.read_ulong (my_val); } - - TAO_InputCDR my_cdr (mb, - my_any._tao_byte_order ()); - - if (type_known) + else { - mb->release (); + TAO_OutputCDR my_out; + my_impl->marshal_value (my_out); + TAO_InputCDR my_in (my_out); + my_in.read_ulong (my_val); } - my_cdr.read_ulong (my_val); - mb = other_any._tao_get_cdr (); - TAO_InputCDR other_cdr (mb, - other_any._tao_byte_order ()); - other_cdr.read_ulong (other_val); + TAO::Any_Impl *other_impl = other_any.impl (); + + if (other_impl->encoded ()) + { + TAO::Unknown_IDL_Type *other_unk = + dynamic_cast (other_impl); + + // We don't want unk's rd_ptr to move, in case we are shared by + // another Any, so we use this to copy the state, not the buffer. + TAO_InputCDR for_reading (other_unk->_tao_get_cdr ()); + for_reading.read_ulong (other_val); + } + else + { + TAO_OutputCDR other_out; + other_impl->marshal_value (other_out); + TAO_InputCDR other_in (other_out); + other_in.read_ulong (other_val); + } + return my_val == other_val; } // Cannot happen - we've covered all the legal discriminator types. diff --git a/TAO/tao/DynamicInterface/DII_Invocation.cpp b/TAO/tao/DynamicInterface/DII_Invocation.cpp index 4e96ad4bff2..d0ebbf90dd9 100644 --- a/TAO/tao/DynamicInterface/DII_Invocation.cpp +++ b/TAO/tao/DynamicInterface/DII_Invocation.cpp @@ -106,8 +106,6 @@ namespace TAO cdr.start ()->length (), 0); - - // Pull the exception ID out of the marshaling buffer. if (tmp_stream.read_string (buf.inout ()) == 0) { @@ -138,8 +136,7 @@ namespace TAO ACE_NEW_RETURN (unk, TAO::Unknown_IDL_Type ( tc.in (), - cdr.start (), - cdr.byte_order () + cdr ), TAO_INVOKE_FAILURE); diff --git a/TAO/tao/TypeCodeFactory/TypeCodeFactory_i.cpp b/TAO/tao/TypeCodeFactory/TypeCodeFactory_i.cpp index 25b9fbebe51..d5c7725b71d 100644 --- a/TAO/tao/TypeCodeFactory/TypeCodeFactory_i.cpp +++ b/TAO/tao/TypeCodeFactory/TypeCodeFactory_i.cpp @@ -6,7 +6,7 @@ #include "tao/Marshal.h" #include "tao/ORB_Constants.h" #include "tao/CDR.h" -#include "tao/Any_Impl.h" +#include "tao/Any_Unknown_IDL_Type.h" #include "tao/SystemException.h" #include "ace/SString.h" @@ -255,7 +255,8 @@ TAO_TypeCodeFactory_i::create_union_tc ( } } - CORBA::TCKind kind = discriminator_type->kind (ACE_ENV_SINGLE_ARG_PARAMETER); + CORBA::TCKind kind = + discriminator_type->kind (ACE_ENV_SINGLE_ARG_PARAMETER); if (index == raw_default_index) { @@ -270,7 +271,7 @@ TAO_TypeCodeFactory_i::create_union_tc ( CORBA::Boolean good_label = members[index].label.impl ()->marshal_value (cdr); - if (good_label == 0) + if (!good_label) { return CORBA::TypeCode::_nil (); } @@ -771,9 +772,28 @@ TAO_TypeCodeFactory_i::compute_default_label ( #endif /* ACE_LACKS_LONGLONG_T */ case CORBA::tk_enum: { - TAO_InputCDR cdr (members[i].label._tao_get_cdr (), - members[i].label._tao_byte_order ()); - cdr.read_ulong (u.enum_val); + TAO::Any_Impl *impl = members[i].label.impl (); + TAO_InputCDR for_reading (static_cast (0)); + + if (impl->encoded ()) + { + TAO::Unknown_IDL_Type *unk = + dynamic_cast (impl); + + // We don't want unk's rd_ptr to move, in case + // we are shared by another Any, so we use this + // to copy the state, not the buffer. + for_reading = unk->_tao_get_cdr (); + } + else + { + TAO_OutputCDR out; + impl->marshal_value (out); + TAO_InputCDR tmp (out); + for_reading = tmp; + } + + for_reading.read_ulong (u.enum_val); if (u.enum_val == dv.enum_val) { @@ -1426,9 +1446,28 @@ TAO_TypeCodeFactory_i::unique_label_values (const CORBA::UnionMemberSeq &members break; case CORBA::tk_enum: { - TAO_InputCDR cdr (members[i].label._tao_get_cdr (), - members[i].label._tao_byte_order ()); - cdr.read_ulong (s.enum_val); + TAO::Any_Impl *impl = members[i].label.impl (); + TAO_InputCDR for_reading (static_cast (0)); + + if (impl->encoded ()) + { + TAO::Unknown_IDL_Type *unk = + dynamic_cast (impl); + + // We don't want unk's rd_ptr to move, in case + // we are shared by another Any, so we use this + // to copy the state, not the buffer. + for_reading = unk->_tao_get_cdr (); + } + else + { + TAO_OutputCDR out; + impl->marshal_value (out); + TAO_InputCDR tmp (out); + for_reading = tmp; + } + + for_reading.read_ulong (s.enum_val); if (checker.insert (s.enum_val) != 0) { diff --git a/TAO/tao/Typecode.cpp b/TAO/tao/Typecode.cpp index a0a6764916c..680ae5f94b6 100644 --- a/TAO/tao/Typecode.cpp +++ b/TAO/tao/Typecode.cpp @@ -2813,10 +2813,10 @@ CORBA::TypeCode::private_member_label (CORBA::ULong n } TAO::Unknown_IDL_Type *impl = 0; + TAO_InputCDR in (out); ACE_NEW_THROW_EX (impl, TAO::Unknown_IDL_Type (label_tc, - out.begin (), - ACE_CDR_BYTE_ORDER), + in), CORBA::NO_MEMORY ()); ACE_CHECK_RETURN (0); diff --git a/TAO/tao/append.cpp b/TAO/tao/append.cpp index 3111bc36f50..9f90343bd48 100644 --- a/TAO/tao/append.cpp +++ b/TAO/tao/append.cpp @@ -25,7 +25,7 @@ #include "tao/ORB_Core.h" #include "tao/Typecode.h" #include "tao/Marshal.h" -#include "tao/Any_Impl.h" +#include "tao/Any_Unknown_IDL_Type.h" #include "tao/CDR.h" #include "tao/SystemException.h" @@ -556,34 +556,27 @@ TAO_Marshal_Union::append (CORBA::TypeCode_ptr tc, case CORBA::tk_enum: { - ACE_Message_Block *mb = any->_tao_get_cdr (); CORBA::ULong d; - bool type_known = false; + TAO::Any_Impl *impl = any->impl (); - if (mb == 0) + if (impl->encoded ()) { - ACE_NEW_RETURN (mb, - ACE_Message_Block, - TAO::TRAVERSE_STOP); - TAO_OutputCDR out; - any->impl ()->marshal_value (out); - ACE_CDR::consolidate (mb, out.begin ()); - type_known = true; + TAO::Unknown_IDL_Type *unk = + dynamic_cast (impl); + + // We don't want unk's rd_ptr to move, in case + // we are shared by another Any, so we use this + // to copy the state, not the buffer. + TAO_InputCDR for_reading (unk->_tao_get_cdr ()); + + for_reading.read_ulong (d); } - - TAO_InputCDR cdr (mb->data_block (), - ACE_Message_Block::DONT_DELETE, - mb->rd_ptr () - mb->base (), - mb->wr_ptr () - mb->base (), - any->_tao_byte_order (), - TAO_DEF_GIOP_MAJOR, - TAO_DEF_GIOP_MINOR); - - cdr.read_ulong (d); - - if (type_known) + else { - mb->release (); + TAO_OutputCDR out; + impl->marshal_value (out); + TAO_InputCDR cdr (out); + cdr.read_ulong (d); } if (d == enum_v) diff --git a/TAO/tao/skip.cpp b/TAO/tao/skip.cpp index 15108839291..bf9ed47dac2 100644 --- a/TAO/tao/skip.cpp +++ b/TAO/tao/skip.cpp @@ -24,7 +24,7 @@ #include "Valuetype_Adapter.h" #include "ORB_Core.h" #include "Typecode.h" -#include "Any_Impl.h" +#include "Any_Unknown_IDL_Type.h" #include "tao/CDR.h" #include "SystemException.h" @@ -500,34 +500,27 @@ TAO_Marshal_Union::skip (CORBA::TypeCode_ptr tc, case CORBA::tk_enum: { - ACE_Message_Block *mb = any->_tao_get_cdr (); CORBA::ULong d; - bool type_known = false; + TAO::Any_Impl *impl = any->impl (); - if (mb == 0) + if (impl->encoded ()) { - ACE_NEW_RETURN (mb, - ACE_Message_Block, - TAO::TRAVERSE_STOP); - TAO_OutputCDR out; - any->impl ()->marshal_value (out); - ACE_CDR::consolidate (mb, out.begin ()); - type_known = true; + TAO::Unknown_IDL_Type *unk = + dynamic_cast (impl); + + // We don't want unk's rd_ptr to move, in case + // we are shared by another Any, so we use this + // to copy the state, not the buffer. + TAO_InputCDR for_reading (unk->_tao_get_cdr ()); + + for_reading.read_ulong (d); } - - TAO_InputCDR cdr (mb->data_block (), - ACE_Message_Block::DONT_DELETE, - mb->rd_ptr () - mb->base (), - mb->wr_ptr () - mb->base (), - any->_tao_byte_order (), - TAO_DEF_GIOP_MAJOR, - TAO_DEF_GIOP_MINOR); - - cdr.read_ulong (d); - - if (type_known) + else { - mb->release (); + TAO_OutputCDR out; + impl->marshal_value (out); + TAO_InputCDR cdr (out); + cdr.read_ulong (d); } if (d == enum_v) diff --git a/TAO/tests/DynAny_Test/analyzer.cpp b/TAO/tests/DynAny_Test/analyzer.cpp index c0a52a3fc30..3ff7ec43ff3 100644 --- a/TAO/tests/DynAny_Test/analyzer.cpp +++ b/TAO/tests/DynAny_Test/analyzer.cpp @@ -22,7 +22,9 @@ ACE_DEBUG ((LM_DEBUG, str , b)); \ } break; -DynAnyAnalyzer::DynAnyAnalyzer(CORBA::ORB_ptr orb, DynamicAny::DynAnyFactory_ptr dynany_factory, int debug) +DynAnyAnalyzer::DynAnyAnalyzer (CORBA::ORB_ptr orb, + DynamicAny::DynAnyFactory_ptr dynany_factory, + int debug) : orb_ (CORBA::ORB::_duplicate(orb)), dynany_factory_ (DynamicAny::DynAnyFactory::_duplicate(dynany_factory)), level_ (0), @@ -30,7 +32,7 @@ DynAnyAnalyzer::DynAnyAnalyzer(CORBA::ORB_ptr orb, DynamicAny::DynAnyFactory_ptr { } -void DynAnyAnalyzer::tab(int t) +void DynAnyAnalyzer::tab (int t) { if (debug_) { diff --git a/TAO/tests/DynAny_Test/test_dynsequence.cpp b/TAO/tests/DynAny_Test/test_dynsequence.cpp index 94d1d20aae7..57f58e40bc4 100644 --- a/TAO/tests/DynAny_Test/test_dynsequence.cpp +++ b/TAO/tests/DynAny_Test/test_dynsequence.cpp @@ -73,11 +73,13 @@ Test_DynSequence::run_test (void) -1); } - DynAnyAnalyzer analyzer(this->orb_.in(), dynany_factory.in(), debug_); + DynAnyAnalyzer analyzer (this->orb_.in (), + dynany_factory.in (), + debug_); DynAnyTests::SeqShort shortseq1; - shortseq1.length(2); + shortseq1.length (2); shortseq1[0] = 2; shortseq1[1] = -2; @@ -85,14 +87,14 @@ Test_DynSequence::run_test (void) any <<= shortseq1; DynamicAny::DynAny_var shortdany = - dynany_factory->create_dyn_any(any ACE_ENV_ARG_PARAMETER); + dynany_factory->create_dyn_any (any ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - analyzer.analyze(shortdany.in() ACE_ENV_ARG_PARAMETER); + analyzer.analyze(shortdany.in () ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; CORBA::Any_var any3; - any3 = shortdany->to_any(ACE_ENV_SINGLE_ARG_PARAMETER); + any3 = shortdany->to_any (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; ts[0] = data.m_string2; @@ -118,7 +120,8 @@ Test_DynSequence::run_test (void) fa1->seek (1 ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - CORBA::String_var out_str1 = fa1->get_string (ACE_ENV_SINGLE_ARG_PARAMETER); + CORBA::String_var out_str1 = + fa1->get_string (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; if (!ACE_OS::strcmp (out_str1.in (), data.m_string1)) diff --git a/TAO/tests/Param_Test/except.cpp b/TAO/tests/Param_Test/except.cpp index c910bfcf0f2..b2ee727d323 100644 --- a/TAO/tests/Param_Test/except.cpp +++ b/TAO/tests/Param_Test/except.cpp @@ -114,7 +114,7 @@ Test_Exception::dii_req_invoke (CORBA::Request_ptr req "unexpected (but known) user exception\n"); // Since 'BadBoy' is not in the exception list the DII request, - // it should not be caught explicityly. See comment below. + // it should not be caught explicitly. See comment below. this->inout_ = this->in_ * 5; this->out_ = this->in_ * 5; this->ret_ = this->in_ * 5; diff --git a/TAO/tests/Param_Test/small_union.cpp b/TAO/tests/Param_Test/small_union.cpp index d1065cb4f29..81a771b66ea 100644 --- a/TAO/tests/Param_Test/small_union.cpp +++ b/TAO/tests/Param_Test/small_union.cpp @@ -48,7 +48,7 @@ Test_Small_Union::opname (void) const void Test_Small_Union::dii_req_invoke (CORBA::Request *req - ACE_ENV_ARG_DECL) + ACE_ENV_ARG_DECL) { req->add_in_arg ("s1") <<= this->in_; req->add_inout_arg ("s2") <<= this->inout_; @@ -78,7 +78,7 @@ Test_Small_Union::dii_req_invoke (CORBA::Request *req int Test_Small_Union::init_parameters (Param_Test_ptr objref - ACE_ENV_ARG_DECL) + ACE_ENV_ARG_DECL) { ACE_TRY { -- cgit v1.2.1