diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-07-06 20:58:23 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-07-06 20:58:23 +0000 |
commit | bada8f9a822adc80e74b4d9b2a5984faaf1d7af7 (patch) | |
tree | e4a27ad446af8ad66d6b8d34b1f3ff07b87e5d6e /TAO/tao/decode.cpp | |
parent | 45fcad8e27a22e74b25eb917504dca6bac845af7 (diff) | |
download | ATCD-bada8f9a822adc80e74b4d9b2a5984faaf1d7af7.tar.gz |
ChangeLogTag:Mon Jul 6 15:46:35 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
Diffstat (limited to 'TAO/tao/decode.cpp')
-rw-r--r-- | TAO/tao/decode.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/TAO/tao/decode.cpp b/TAO/tao/decode.cpp index c0acae85692..120fb2eef9e 100644 --- a/TAO/tao/decode.cpp +++ b/TAO/tao/decode.cpp @@ -308,14 +308,42 @@ TAO_Marshal_TypeCode::decode (CORBA::TypeCode_ptr, { // bounded string. Create a TypeCode. If it is does not // have a parent, then the application must free it. + + // allocate a new TypeCode +#if 1 + // This may produce a memory leak, because + // callers are sloppy about removing this + // objects. + CORBA::Long _oc_bounded_string [] = + {TAO_ENCAP_BYTE_ORDER, 0}; + // Bounded string. Save the bounds + _oc_bounded_string [1] = (CORBA::Long) bound; + *tcp = new CORBA::TypeCode (ACE_static_cast(CORBA::TCKind, kind), + 8, + ACE_reinterpret_cast(char*,_oc_bounded_string), + CORBA::B_FALSE, 0); +#elif 0 + // This one fails because we are passing the + // parent but the buffer (_oc_bounded_string) is + // not pointing to the parent CDR stream + // (hence no sharing) and the length is wrong + // (should be 8 not bounds). CORBA::Long _oc_bounded_string [] = {TAO_ENCAP_BYTE_ORDER, 0}; // Bounded string. Save the bounds _oc_bounded_string [1] = (CORBA::Long) bound; - // allocate a new TypeCode *tcp = new CORBA::TypeCode ((CORBA::TCKind) kind, bound, (char *) &_oc_bounded_string, CORBA::B_FALSE, parent); +#else + // This depends on the fact that <stream> is + // actually pointing to the parent CDR stream, + // it is untested. + *tcp = new CORBA::TypeCode ((CORBA::TCKind) kind, + 8, + stream->rd_ptr () - 8, + CORBA::B_FALSE, parent); +#endif } } } |