diff options
Diffstat (limited to 'TAO/tao/CodecFactory/CDR_Encaps_Codec.cpp')
-rw-r--r-- | TAO/tao/CodecFactory/CDR_Encaps_Codec.cpp | 52 |
1 files changed, 17 insertions, 35 deletions
diff --git a/TAO/tao/CodecFactory/CDR_Encaps_Codec.cpp b/TAO/tao/CodecFactory/CDR_Encaps_Codec.cpp index e1913041383..6caf233bb55 100644 --- a/TAO/tao/CodecFactory/CDR_Encaps_Codec.cpp +++ b/TAO/tao/CodecFactory/CDR_Encaps_Codec.cpp @@ -16,6 +16,7 @@ #include "ace/Auto_Ptr.h" #include "ace/OS_NS_string.h" +#include "ace/CORBA_macros.h" ACE_RCSID (CodecFactory, @@ -43,13 +44,9 @@ TAO_CDR_Encaps_Codec::~TAO_CDR_Encaps_Codec (void) } CORBA::OctetSeq * -TAO_CDR_Encaps_Codec::encode (const CORBA::Any & data - ) - ACE_THROW_SPEC ((CORBA::SystemException, - IOP::Codec::InvalidTypeForEncoding)) +TAO_CDR_Encaps_Codec::encode (const CORBA::Any & data) { - this->check_type_for_encoding (data - ); + this->check_type_for_encoding (data); // ---------------------------------------------------------------- @@ -101,14 +98,11 @@ TAO_CDR_Encaps_Codec::encode (const CORBA::Any & data return safe_octet_seq._retn (); } - ACE_THROW_RETURN (CORBA::MARSHAL (), 0); + throw ::CORBA::MARSHAL (); } CORBA::Any * -TAO_CDR_Encaps_Codec::decode (const CORBA::OctetSeq & data - ) - ACE_THROW_SPEC ((CORBA::SystemException, - IOP::Codec::FormatMismatch)) +TAO_CDR_Encaps_Codec::decode (const CORBA::OctetSeq & data) { // @todo How do we check for a format mismatch so that we can throw // a IOP::Codec::FormatMismatch exception? @@ -164,18 +158,13 @@ TAO_CDR_Encaps_Codec::decode (const CORBA::OctetSeq & data return safe_any._retn (); } - ACE_THROW_RETURN (IOP::Codec::FormatMismatch (), - 0); + throw IOP::Codec::FormatMismatch (); } CORBA::OctetSeq * -TAO_CDR_Encaps_Codec::encode_value (const CORBA::Any & data - ) - ACE_THROW_SPEC ((CORBA::SystemException, - IOP::Codec::InvalidTypeForEncoding)) +TAO_CDR_Encaps_Codec::encode_value (const CORBA::Any & data) { - this->check_type_for_encoding (data - ); + this->check_type_for_encoding (data); // ---------------------------------------------------------------- TAO_OutputCDR cdr ((size_t) 0, // size @@ -202,17 +191,19 @@ TAO_CDR_Encaps_Codec::encode_value (const CORBA::Any & data if (impl->encoded ()) { - TAO::Unknown_IDL_Type *unk = + TAO::Unknown_IDL_Type * const unk = dynamic_cast<TAO::Unknown_IDL_Type *> (impl); + if (!unk) + throw ::CORBA::INTERNAL (); + // 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 - ); + &cdr); } else { @@ -252,17 +243,12 @@ TAO_CDR_Encaps_Codec::encode_value (const CORBA::Any & data return safe_octet_seq._retn (); } - ACE_THROW_RETURN (CORBA::MARSHAL (), - 0); + throw ::CORBA::MARSHAL (); } CORBA::Any * TAO_CDR_Encaps_Codec::decode_value (const CORBA::OctetSeq & data, - CORBA::TypeCode_ptr tc - ) - ACE_THROW_SPEC ((CORBA::SystemException, - IOP::Codec::FormatMismatch, - IOP::Codec::TypeMismatch)) + CORBA::TypeCode_ptr tc) { // The ACE_CDR::mb_align() call can shift the rd_ptr by up // to ACE_CDR::MAX_ALIGNMENT-1 bytes. Similarly, the offset @@ -339,15 +325,11 @@ TAO_CDR_Encaps_Codec::decode_value (const CORBA::OctetSeq & data, return safe_any._retn (); } - ACE_THROW_RETURN (IOP::Codec::FormatMismatch (), - 0); + throw IOP::Codec::FormatMismatch (); } void -TAO_CDR_Encaps_Codec::check_type_for_encoding ( - const CORBA::Any & data - - ) +TAO_CDR_Encaps_Codec::check_type_for_encoding (const CORBA::Any & data) { // @@ TODO: Are there any other conditions we need to check? |