diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2003-03-03 22:37:30 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2003-03-03 22:37:30 +0000 |
commit | 3a74aa69057f80ccf772cb9e67692857d8ecffb8 (patch) | |
tree | 0974aa05fba1138d58dd066728d03f8271b9f0ba | |
parent | a340e4d525686bc5e71274b1171dba74aef98fd2 (diff) | |
download | ATCD-3a74aa69057f80ccf772cb9e67692857d8ecffb8.tar.gz |
ChangeLogTag:Mon Mar 3 14:36:53 2003 Ossama Othman <ossama@uci.edu>
-rw-r--r-- | TAO/ChangeLog | 36 | ||||
-rw-r--r-- | TAO/tao/Exception.cpp | 79 | ||||
-rw-r--r-- | TAO/tao/Exception.h | 12 |
3 files changed, 86 insertions, 41 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index ab10ff01ca5..09abbde2cd0 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,39 @@ +Mon Mar 3 14:36:53 2003 Ossama Othman <ossama@uci.edu> + + * tao/Exception.h: + * tao/Exception.cpp: + + Uninlined SystemException subclass constructors. There was no + real advantage to inlining them. Inlining them only served to + increase footprint. + + (operator<<=, operator>>=): + + Placed the definitions of these Any insertion and extraction + operators in the CORBA namespace. Fixes "unresolved symbol" + link-time errors when using these operators. + + (_info, _tao_get_omg_exception_description): + + Improved const-correctness. Variables that are really constants + are now marked as such. + + (make_standard_typecode): + + Improved exception-safety. Manage memory using a + CORBA::String_var instead of the raw + CORBA::string_{alloc,release} functions. + +Mon Mar 3 11:46:59 2003 Ossama Othman <ossama@uci.edu> + + * tao/DynamicInterface/Request.h: + + Explicitly qualify the TAO_Dynamic_Adapter_Impl friend + declaration with a global scope qualifier in an attempt to work + around a problem where some compilers assume that the friend + declaration refers to a class in the local scope or current + namespace. + Mon Mar 3 15:42:35 2003 Jeff Parsons <j.parsons@vanderbilt.edu> * tao/DynamicAny/DynStruct_i.cpp (get_members): diff --git a/TAO/tao/Exception.cpp b/TAO/tao/Exception.cpp index 0097570e9bd..8f87164baa7 100644 --- a/TAO/tao/Exception.cpp +++ b/TAO/tao/Exception.cpp @@ -398,7 +398,7 @@ CORBA::SystemException::_tao_print_system_exception (FILE *) const ACE_CString CORBA::SystemException::_info (void) const { - // @@ there are a other few "user exceptions" in the CORBA scope, + // @@ there are a few other "user exceptions" in the CORBA scope, // they're not all standard/system exceptions ... really need to // either compare exhaustively against all those IDs (yeech) or // (preferably) to represent the exception type directly in the @@ -408,8 +408,7 @@ CORBA::SystemException::_info (void) const info += this->_rep_id (); info += "'\n"; - CORBA::ULong VMCID = - this->minor () & 0xFFFFF000u; + const CORBA::ULong VMCID = this->minor () & 0xFFFFF000u; if (VMCID == TAO_DEFAULT_MINOR_CODE) { @@ -898,11 +897,13 @@ TAO_Exceptions::make_unknown_user_typecode (CORBA::TypeCode_ptr &tcp const char *name = "UnknownUserException"; const char *field_name = "exception"; - CORBA::Boolean result = stream.write_octet (TAO_ENCAP_BYTE_ORDER) == 0 - || stream.write_string (interface_id) == 0 - || stream.write_string (name) == 0 - || stream.write_ulong (1L) == 0 - || stream.write_string (field_name) == 0; + const CORBA::Boolean result = + (stream.write_octet (TAO_ENCAP_BYTE_ORDER) == 0 + || stream.write_string (interface_id) == 0 + || stream.write_string (name) == 0 + || stream.write_ulong (1L) == 0 + || stream.write_string (field_name) == 0); + if (result) ACE_THROW (CORBA::INITIALIZE ()); @@ -970,6 +971,8 @@ TAO_Exceptions::make_standard_typecode (CORBA::TypeCode_ptr &tcp, + ACE_OS_String::strlen (name) + sizeof suffix); + CORBA::String_var safe_full_id = full_id; + ACE_OS_String::strcpy (full_id, prefix); ACE_OS_String::strcat (full_id, name); ACE_OS_String::strcat (full_id, suffix); @@ -982,7 +985,7 @@ TAO_Exceptions::make_standard_typecode (CORBA::TypeCode_ptr &tcp, result = result || !(stream << CORBA::_tc_ulong); - CORBA::string_free (full_id); // No longer need the string + (void) safe_full_id.out (); // No longer need the string result = result || stream.write_string (completed) == 0; result = result || !(stream << TC_completion_status); @@ -1066,8 +1069,8 @@ TAO_Exceptions::make_standard_typecode (CORBA::TypeCode_ptr &tcp, #define TAO_TC_BUF_LEN 256 #define TAO_SYSTEM_EXCEPTION(name) \ - static CORBA::Long tc_buf_##name[TAO_TC_BUF_LEN / sizeof (CORBA::Long)]; \ - CORBA::TypeCode_ptr CORBA::_tc_##name = 0; + static CORBA::Long tc_buf_CORBA_ ## name[TAO_TC_BUF_LEN / sizeof (CORBA::Long)]; \ + CORBA::TypeCode_ptr CORBA::_tc_ ## name = 0; STANDARD_EXCEPTION_LIST #undef TAO_SYSTEM_EXCEPTION @@ -1090,8 +1093,8 @@ TAO_Exceptions::init (ACE_ENV_SINGLE_ARG_DECL) #define TAO_SYSTEM_EXCEPTION(name) \ TAO_Exceptions::make_standard_typecode (CORBA::_tc_ ## name, \ #name, \ - (char*) tc_buf_##name, \ - sizeof (tc_buf_##name) \ + (char*) tc_buf_CORBA_ ## name, \ + sizeof (tc_buf_CORBA_ ## name) \ ACE_ENV_ARG_PARAMETER); \ ACE_CHECK; STANDARD_EXCEPTION_LIST @@ -1111,7 +1114,7 @@ TAO_Exceptions::create_system_exception (const char *id { \ const char* xid = "IDL:omg.org/CORBA/" #name ":1.0"; \ if (ACE_OS_String::strcmp (id, xid) == 0) \ - return new CORBA:: name; \ + return new CORBA::name; \ } STANDARD_EXCEPTION_LIST #undef TAO_SYSTEM_EXCEPTION @@ -1175,6 +1178,14 @@ CORBA::name ::name (void) \ TAO_DEFAULT_MINOR_CODE, \ CORBA::COMPLETED_NO) \ { \ +} \ +\ +CORBA::name ::name (CORBA::ULong code, CORBA::CompletionStatus completed) \ + : CORBA::SystemException ("IDL:omg.org/CORBA/" #name ":1.0", \ + #name, \ + code, \ + completed) \ +{ \ } STANDARD_EXCEPTION_LIST #undef TAO_SYSTEM_EXCEPTION @@ -1235,7 +1246,8 @@ tao_insert_for_insertion_system_exception (CORBA::Any &any, } #define TAO_SYSTEM_EXCEPTION(name) \ -void operator<<= (CORBA::Any &any, const CORBA::name &ex) \ +void \ +CORBA::operator<<= (CORBA::Any &any, const CORBA::name &ex) \ { \ tao_insert_for_insertion_system_exception (any, ex, \ "\tCORBA::Any insertion (non-copy) of CORBA::" #name "\n" \ @@ -1275,7 +1287,8 @@ tao_insert_system_exception (CORBA::Any &any, } #define TAO_SYSTEM_EXCEPTION(name) \ -void operator<<= (CORBA::Any &any, CORBA::name *ex) \ +void \ +CORBA::operator<<= (CORBA::Any &any, CORBA::name *ex) \ { \ tao_insert_system_exception (any, ex, \ CORBA::name ::_tao_any_destructor, \ @@ -1287,7 +1300,7 @@ STANDARD_EXCEPTION_LIST #undef TAO_SYSTEM_EXCEPTION #define TAO_SYSTEM_EXCEPTION(name) \ -static CORBA::SystemException* _tao_allocator_##name (void) \ +static CORBA::SystemException* _tao_allocator_CORBA_ ## name (void) \ { \ return new CORBA::name; \ } @@ -1354,24 +1367,26 @@ tao_insert_in_extractor_system_exception ( } #define TAO_SYSTEM_EXCEPTION(name) \ -CORBA::Boolean operator>>= (const CORBA::Any &any, \ - const CORBA::name *&ex) \ +CORBA::Boolean \ +CORBA::operator>>= (const CORBA::Any &any, \ + const CORBA::name *&ex) \ { \ ex = 0; \ CORBA::SystemException *tmp; \ - if (tao_insert_in_extractor_system_exception (any, \ - tmp, \ - _tao_allocator_##name, \ - CORBA::_tc_##name, \ - CORBA::name ::_tao_any_destructor, \ - "IDL:omg.org/CORBA/" #name ":1.0", \ - "\tCORBA::Any extraction of CORBA::" #name "\n") == 0) \ - { \ - ex = 0; \ - return 0; \ - } \ - ex = (CORBA::name*)tmp; \ - return 1; \ + if (tao_insert_in_extractor_system_exception ( \ + any, \ + tmp, \ + _tao_allocator_CORBA_ ## name, \ + CORBA::_tc_ ## name, \ + CORBA::name ::_tao_any_destructor, \ + "IDL:omg.org/CORBA/" #name ":1.0", \ + "\tCORBA::Any extraction of CORBA::" #name "\n") == 0) \ + { \ + ex = 0; \ + return 0; \ + } \ + ex = (CORBA::name *) tmp; \ + return 1; \ } STANDARD_EXCEPTION_LIST diff --git a/TAO/tao/Exception.h b/TAO/tao/Exception.h index 07ce956e5d4..3f8d257b635 100644 --- a/TAO/tao/Exception.h +++ b/TAO/tao/Exception.h @@ -34,7 +34,6 @@ #include "ace/CORBA_macros.h" #include "ace/SString.h" - class TAO_OutputCDR; class TAO_InputCDR; @@ -146,7 +145,7 @@ namespace CORBA * @brief User exceptions are those defined by application developers * using OMG-IDL. */ - class TAO_Export UserException : public CORBA::Exception + class TAO_Export UserException : public Exception { public: @@ -275,17 +274,12 @@ namespace CORBA // inside the ORB. All minor codes should be symbolically catalogued. #define TAO_SYSTEM_EXCEPTION(name) \ - class TAO_Export name : public CORBA::SystemException \ + class TAO_Export name : public SystemException \ { \ public: \ name (void); \ name (CORBA::ULong code, \ - CORBA::CompletionStatus completed) \ - : CORBA::SystemException ("IDL:omg.org/CORBA/" #name ":1.0", \ - #name, \ - code, \ - completed) \ - { } \ + CORBA::CompletionStatus completed); \ static name * _downcast (CORBA::Exception* exception); \ virtual int _is_a (const char* type_id) const; \ virtual void _raise (void); \ |