summaryrefslogtreecommitdiff
path: root/TAO/tao/Any_Impl_T.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/tao/Any_Impl_T.cpp')
-rw-r--r--TAO/tao/Any_Impl_T.cpp30
1 files changed, 12 insertions, 18 deletions
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<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<T> *narrow_impl =
dynamic_cast <TAO::Any_Impl_T<T> *> (impl);
@@ -101,22 +99,18 @@ TAO::Any_Impl_T<T>::extract (const CORBA::Any & any,
auto_ptr<TAO::Any_Impl_T<T> > 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<TAO::Unknown_IDL_Type *> (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<T *> (replacement->value_);
const_cast<CORBA::Any &> (any).replace (replacement);