diff options
-rw-r--r-- | TAO/ChangeLog | 17 | ||||
-rw-r--r-- | TAO/tao/DomainC.cpp | 8 | ||||
-rw-r--r-- | TAO/tao/IFR_Client/IFR_Client_Adapter_Impl.cpp | 90 | ||||
-rw-r--r-- | TAO/tao/ORB.cpp | 28 |
4 files changed, 65 insertions, 78 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 46684267d00..d54bf5fa000 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,20 @@ +Wed Nov 19 19:43:15 2003 Jeff Parsons <j.parsons@vanderbilt.edu> + + * tao/DomainC.cpp: + + Cosmetic changes, to keep line lengths under 80 characters. + + * tao/ORB.cpp: + + Changed the exception thrown by create_operation_list() to + INTF_REPOS, since we are call IFR_Client in this function. + Also added .inout() to a couple uses of String_var. + + * tao/IFR_Client/IFR_Client_Adapter_Impl.cpp (create_operation_list): + + Plugged memory leak, made changes to conform to the ACE style + guidelines, and several other changes to clean up the code. + Wed Nov 19 19:24:50 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu> * tao/ORB.cpp: diff --git a/TAO/tao/DomainC.cpp b/TAO/tao/DomainC.cpp index a1c7e657eca..bc3c7a81f67 100644 --- a/TAO/tao/DomainC.cpp +++ b/TAO/tao/DomainC.cpp @@ -61,7 +61,9 @@ namespace CORBA ACE_TEMPLATE_SPECIALIZATION void -TAO::In_Object_Argument_T<CORBA::InterfaceDef_ptr>::interceptor_param (Dynamic::Parameter & p) +TAO::In_Object_Argument_T<CORBA::InterfaceDef_ptr>::interceptor_param ( + Dynamic::Parameter & p + ) { TAO_IFR_Client_Adapter *adapter = ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance ( @@ -74,7 +76,9 @@ TAO::In_Object_Argument_T<CORBA::InterfaceDef_ptr>::interceptor_param (Dynamic:: ACE_TEMPLATE_SPECIALIZATION CORBA::Boolean -TAO::In_Object_Argument_T<CORBA::InterfaceDef_ptr>::marshal (TAO_OutputCDR & cdr) +TAO::In_Object_Argument_T<CORBA::InterfaceDef_ptr>::marshal ( + TAO_OutputCDR & cdr + ) { TAO_IFR_Client_Adapter *adapter = ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance ( diff --git a/TAO/tao/IFR_Client/IFR_Client_Adapter_Impl.cpp b/TAO/tao/IFR_Client/IFR_Client_Adapter_Impl.cpp index 4c4336104d0..620aaebc449 100644 --- a/TAO/tao/IFR_Client/IFR_Client_Adapter_Impl.cpp +++ b/TAO/tao/IFR_Client/IFR_Client_Adapter_Impl.cpp @@ -2,10 +2,12 @@ #include "IFR_Client_Adapter_Impl.h" #include "IFR_ExtendedC.h" + #include "tao/ORB_Core.h" #include "tao/Invocation_Adapter.h" #include "tao/Stub.h" #include "tao/NVList.h" +#include "tao/Any_Unknown_IDL_Type.h" ACE_RCSID (IFR_Client, IFR_Client_Adapter_Impl, @@ -144,71 +146,37 @@ void TAO_IFR_Client_Adapter_Impl::create_operation_list ( CORBA::ORB_ptr orb, CORBA::OperationDef_ptr opDef, - CORBA::NVList_ptr& result + CORBA::NVList_ptr &result ACE_ENV_ARG_DECL ) { - // Create an empty NVList. - // - orb->create_list (0, result); - - // Get the parameters (if any) from the OperationDef, and for each - // parameter add a corresponding entry to the result. - // - CORBA::ParDescriptionSeq* params = opDef->params(); - CORBA::ULong paramCount = params->length(); - if (paramCount > 0) - { - for (CORBA::ULong i = 0; i < paramCount; i++) - { - CORBA::ParameterDescription* param = &((*params)[i]); - - // Get name. - // - char* name = CORBA::string_dup (param->name); - - // Create an any using the parameter's TypeCode. - // - CORBA::Any* value; - ACE_NEW_THROW_EX (value, - CORBA::Any (), - CORBA::NO_MEMORY ( - CORBA::SystemException::_tao_minor_code ( - TAO_DEFAULT_MINOR_CODE, - ENOMEM), - CORBA::COMPLETED_NO)); - ACE_CHECK; - - value->_tao_set_typecode ((param->type).in()); - - // Get mode. - // - CORBA::Flags flags; - switch (param->mode) - { - case CORBA::PARAM_IN: - flags = CORBA::ARG_IN; - break; - case CORBA::PARAM_OUT: - flags = CORBA::ARG_OUT; - break; - case CORBA::PARAM_INOUT: - flags = CORBA::ARG_INOUT; - break; - default: - // Shouldn't happen. - // - ACE_THROW (CORBA::INTERNAL()); - break; - } - - // Add an argument to the result list. The list takes ownership - // of name and value. - // - result->add_value_consume (name, value, flags); - } - } + // Create an empty NVList. + orb->create_list (0, + result + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + // Get the parameters (if any) from the OperationDef, and for each + // parameter add a corresponding entry to the result. + CORBA::ParDescriptionSeq_var params = + opDef->params (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + CORBA::ULong paramCount = params->length (); + + for (CORBA::ULong i = 0; i < paramCount; ++i) + { + CORBA::Any value; + TAO::Unknown_IDL_Type *unk = 0; + ACE_NEW (unk, + TAO::Unknown_IDL_Type (params[i].type.in ())); + value.replace (unk); + + // Add an argument to the NVList. + result->add_value (params[i].name.in (), + value, + params[i].mode); + } } // ********************************************************************* diff --git a/TAO/tao/ORB.cpp b/TAO/tao/ORB.cpp index 0862af6a8b5..6391baf2f16 100644 --- a/TAO/tao/ORB.cpp +++ b/TAO/tao/ORB.cpp @@ -326,9 +326,9 @@ CORBA::ORB::create_exception_list (CORBA::ExceptionList_ptr &list } void -CORBA::ORB::create_operation_list( CORBA::OperationDef_ptr opDef, - CORBA::NVList_ptr& result - ACE_ENV_ARG_DECL ) +CORBA::ORB::create_operation_list (CORBA::OperationDef_ptr opDef, + CORBA::NVList_ptr &result + ACE_ENV_ARG_DECL) { TAO_IFR_Client_Adapter *adapter = ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance ( @@ -337,20 +337,19 @@ CORBA::ORB::create_operation_list( CORBA::OperationDef_ptr opDef, if (adapter == 0) { - ACE_THROW (CORBA::NO_IMPLEMENT ( - CORBA::SystemException::_tao_minor_code ( - TAO_DEFAULT_MINOR_CODE, - ENOTSUP), - CORBA::COMPLETED_NO)); + ACE_THROW (CORBA::INTF_REPOS ()); } - adapter->create_operation_list(this, opDef, result ACE_ENV_ARG_PARAMETER); + adapter->create_operation_list (this, + opDef, + result + ACE_ENV_ARG_PARAMETER); } void CORBA::ORB::create_environment (CORBA::Environment_ptr &environment - ACE_ENV_ARG_DECL) + ACE_ENV_ARG_DECL) { ACE_NEW_THROW_EX (environment, CORBA::Environment (), @@ -1166,16 +1165,15 @@ CORBA::ORB::resolve_initial_references (const char *name, // Look for an environment variable called "<name>IOR". // CORBA::String_var ior_env_var_name = - CORBA::string_alloc (ACE_OS::strlen (name) + 3); + CORBA::string_alloc (ACE_OS::strlen (name) + 3); - ACE_OS::strcpy (ior_env_var_name, + ACE_OS::strcpy (ior_env_var_name.inout (), name); - ACE_OS::strcat (ior_env_var_name, + ACE_OS::strcat (ior_env_var_name.inout (), "IOR"); - ACE_CString service_ior = - ACE_OS::getenv (ior_env_var_name.in ()); + ACE_CString service_ior = ACE_OS::getenv (ior_env_var_name.in ()); if (ACE_OS::strcmp (service_ior.c_str (), "") != 0 ) { |