diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-03-12 16:18:58 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-03-12 16:18:58 +0000 |
commit | 414715263a41b8525f0371e9851cfc470171b0d5 (patch) | |
tree | bf1c5cdcd20e3d61ed9d590adfaef8b5fce061df /TAO/tao/StringSeqC.cpp | |
parent | d918dcf7a60a0a69c33de11f3b8259b2065d2e38 (diff) | |
download | ATCD-414715263a41b8525f0371e9851cfc470171b0d5.tar.gz |
ChangeLogTag: Wed Mar 12 09:49:00 2003 Jeff Parsons <j.parsons@vanderbilt.edu>
Diffstat (limited to 'TAO/tao/StringSeqC.cpp')
-rw-r--r-- | TAO/tao/StringSeqC.cpp | 560 |
1 files changed, 315 insertions, 245 deletions
diff --git a/TAO/tao/StringSeqC.cpp b/TAO/tao/StringSeqC.cpp index 5b6394831e9..80cfaca1bed 100644 --- a/TAO/tao/StringSeqC.cpp +++ b/TAO/tao/StringSeqC.cpp @@ -19,6 +19,10 @@ // Information about TAO is available at: // http://www.cs.wustl.edu/~schmidt/TAO.html +// TAO_IDL - Generated from +// W:\ACE_wrappers\TAO\TAO_IDL\be\be_codegen.cpp:314 + + #include "StringSeqC.h" #if defined (__BORLANDC__) @@ -29,344 +33,369 @@ #include "StringSeqC.i" #endif /* !defined INLINE */ -#include "Any.h" -#include "CDR.h" -#include "Typecode.h" +#include "Any_T.h" #if !defined (_CORBA_STRINGSEQ_CS_) #define _CORBA_STRINGSEQ_CS_ +// TAO_IDL - Generated from +// W:\ACE_wrappers\TAO\TAO_IDL\be\be_visitor_sequence/sequence_cs.cpp:250 + // ************************************************************* // CORBA::StringSeq // ************************************************************* CORBA::StringSeq::StringSeq (void) {} -CORBA::StringSeq::StringSeq (CORBA::ULong max) // uses max size - : + +CORBA::StringSeq::StringSeq (CORBA::ULong max) + : + #if !defined (TAO_USE_SEQUENCE_TEMPLATES) - TAO_Unbounded_String_Sequence +TAO_Unbounded_String_Sequence #else /* TAO_USE_SEQUENCE_TEMPLATES */ - TAO_Unbounded_String_Sequence -#endif /* !TAO_USE_SEQUENCE_TEMPLATES */ +TAO_Unbounded_String_Sequence + +#endif /* !TAO_USE_SEQUENCE_TEMPLATES */ (max) {} -CORBA::StringSeq::StringSeq (CORBA::ULong max, CORBA::ULong length, char * *buffer, CORBA::Boolean release) - : + +CORBA::StringSeq::StringSeq ( + CORBA::ULong max, + CORBA::ULong length, + char * *buffer, + CORBA::Boolean release + ) + : + #if !defined (TAO_USE_SEQUENCE_TEMPLATES) - TAO_Unbounded_String_Sequence +TAO_Unbounded_String_Sequence #else /* TAO_USE_SEQUENCE_TEMPLATES */ - TAO_Unbounded_String_Sequence -#endif /* !TAO_USE_SEQUENCE_TEMPLATES */ +TAO_Unbounded_String_Sequence + +#endif /* !TAO_USE_SEQUENCE_TEMPLATES */ (max, length, buffer, release) {} -CORBA::StringSeq::StringSeq (const CORBA::StringSeq &seq) // copy ctor - : + +CORBA::StringSeq::StringSeq (const StringSeq &seq) + : + #if !defined (TAO_USE_SEQUENCE_TEMPLATES) - TAO_Unbounded_String_Sequence +TAO_Unbounded_String_Sequence #else /* TAO_USE_SEQUENCE_TEMPLATES */ - TAO_Unbounded_String_Sequence -#endif /* !TAO_USE_SEQUENCE_TEMPLATES */ +TAO_Unbounded_String_Sequence + +#endif /* !TAO_USE_SEQUENCE_TEMPLATES */ (seq) {} + CORBA::StringSeq::~StringSeq (void) // dtor {} -void CORBA::StringSeq::_tao_any_destructor (void *x) + +void CORBA::StringSeq::_tao_any_destructor (void *_tao_void_pointer) { - CORBA::StringSeq *tmp = ACE_static_cast (CORBA::StringSeq*,x); + StringSeq *tmp = ACE_static_cast (StringSeq*, _tao_void_pointer); delete tmp; } - #endif /* end #if !defined */ +// TAO_IDL - Generated from +// W:\ACE_wrappers\TAO\TAO_IDL\be\be_visitor_typecode/typecode_defn.cpp:284 + static const CORBA::Long _oc_CORBA_StringSeq[] = { - TAO_ENCAP_BYTE_ORDER, // byte order - 32, ACE_NTOHL (0x49444c3a), ACE_NTOHL (0x6f6d672e), ACE_NTOHL (0x6f72672f), ACE_NTOHL (0x434f5242), ACE_NTOHL (0x412f5374), ACE_NTOHL (0x72696e67), ACE_NTOHL (0x5365713a), ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/StringSeq:1.0 - 10, ACE_NTOHL (0x53747269), ACE_NTOHL (0x6e675365), ACE_NTOHL (0x71000000), // name = StringSeq - CORBA::tk_sequence, // typecode kind + TAO_ENCAP_BYTE_ORDER, // byte order + 32, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x6f6d672e), + ACE_NTOHL (0x6f72672f), + ACE_NTOHL (0x434f5242), + ACE_NTOHL (0x412f5374), + ACE_NTOHL (0x72696e67), + ACE_NTOHL (0x5365713a), + ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/StringSeq:1.0 + 10, + ACE_NTOHL (0x53747269), + ACE_NTOHL (0x6e675365), + ACE_NTOHL (0x71000000), // name = StringSeq + CORBA::tk_sequence, // typecode kind 16, // encapsulation length TAO_ENCAP_BYTE_ORDER, // byte order - CORBA::tk_string, + CORBA::tk_string, 0U, // string length 0U, }; -static CORBA::TypeCode _tc_TAO_tc_CORBA_StringSeq (CORBA::tk_alias, sizeof (_oc_CORBA_StringSeq), (char *) &_oc_CORBA_StringSeq, 0, sizeof (CORBA::StringSeq)); + +static CORBA::TypeCode _tc_TAO_tc_CORBA_StringSeq ( + CORBA::tk_alias, + sizeof (_oc_CORBA_StringSeq), + (char *) &_oc_CORBA_StringSeq, + 0, + sizeof (CORBA::StringSeq) + ); + TAO_NAMESPACE_TYPE (CORBA::TypeCode_ptr) TAO_NAMESPACE_BEGIN (CORBA) -TAO_NAMESPACE_DEFINE (CORBA::TypeCode_ptr, _tc_StringSeq, &_tc_TAO_tc_CORBA_StringSeq) +TAO_NAMESPACE_DEFINE ( + ::CORBA::TypeCode_ptr, + _tc_StringSeq, + &_tc_TAO_tc_CORBA_StringSeq + ) TAO_NAMESPACE_END #if !defined (_CORBA_WSTRINGSEQ_CS_) #define _CORBA_WSTRINGSEQ_CS_ +// TAO_IDL - Generated from +// W:\ACE_wrappers\TAO\TAO_IDL\be\be_visitor_sequence/sequence_cs.cpp:250 + // ************************************************************* // CORBA::WStringSeq // ************************************************************* CORBA::WStringSeq::WStringSeq (void) {} -CORBA::WStringSeq::WStringSeq (CORBA::ULong max) // uses max size - : + +CORBA::WStringSeq::WStringSeq (CORBA::ULong max) + : + #if !defined (TAO_USE_SEQUENCE_TEMPLATES) - TAO_Unbounded_WString_Sequence +TAO_Unbounded_WString_Sequence #else /* TAO_USE_SEQUENCE_TEMPLATES */ - TAO_Unbounded_WString_Sequence -#endif /* !TAO_USE_SEQUENCE_TEMPLATES */ +TAO_Unbounded_WString_Sequence + +#endif /* !TAO_USE_SEQUENCE_TEMPLATES */ (max) {} -CORBA::WStringSeq::WStringSeq (CORBA::ULong max, CORBA::ULong length, CORBA::WChar * *buffer, CORBA::Boolean release) - : + +CORBA::WStringSeq::WStringSeq ( + CORBA::ULong max, + CORBA::ULong length, + CORBA::WChar * *buffer, + CORBA::Boolean release + ) + : + #if !defined (TAO_USE_SEQUENCE_TEMPLATES) - TAO_Unbounded_WString_Sequence +TAO_Unbounded_WString_Sequence #else /* TAO_USE_SEQUENCE_TEMPLATES */ - TAO_Unbounded_WString_Sequence -#endif /* !TAO_USE_SEQUENCE_TEMPLATES */ +TAO_Unbounded_WString_Sequence + +#endif /* !TAO_USE_SEQUENCE_TEMPLATES */ (max, length, buffer, release) {} -CORBA::WStringSeq::WStringSeq (const CORBA::WStringSeq &seq) // copy ctor - : + +CORBA::WStringSeq::WStringSeq (const WStringSeq &seq) + : + #if !defined (TAO_USE_SEQUENCE_TEMPLATES) - TAO_Unbounded_WString_Sequence +TAO_Unbounded_WString_Sequence #else /* TAO_USE_SEQUENCE_TEMPLATES */ - TAO_Unbounded_WString_Sequence -#endif /* !TAO_USE_SEQUENCE_TEMPLATES */ +TAO_Unbounded_WString_Sequence + +#endif /* !TAO_USE_SEQUENCE_TEMPLATES */ (seq) {} + CORBA::WStringSeq::~WStringSeq (void) // dtor {} -void CORBA::WStringSeq::_tao_any_destructor (void *x) + +void CORBA::WStringSeq::_tao_any_destructor (void *_tao_void_pointer) { - CORBA::WStringSeq *tmp = ACE_static_cast (CORBA::WStringSeq*,x); + WStringSeq *tmp = ACE_static_cast (WStringSeq*, _tao_void_pointer); delete tmp; } - #endif /* end #if !defined */ +// TAO_IDL - Generated from +// W:\ACE_wrappers\TAO\TAO_IDL\be\be_visitor_typecode/typecode_defn.cpp:284 + static const CORBA::Long _oc_CORBA_WStringSeq[] = { - TAO_ENCAP_BYTE_ORDER, // byte order - 33, ACE_NTOHL (0x49444c3a), ACE_NTOHL (0x6f6d672e), ACE_NTOHL (0x6f72672f), ACE_NTOHL (0x434f5242), ACE_NTOHL (0x412f5753), ACE_NTOHL (0x7472696e), ACE_NTOHL (0x67536571), ACE_NTOHL (0x3a312e30), ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/WStringSeq:1.0 - 11, ACE_NTOHL (0x57537472), ACE_NTOHL (0x696e6753), ACE_NTOHL (0x65710000), // name = WStringSeq - CORBA::tk_sequence, // typecode kind + TAO_ENCAP_BYTE_ORDER, // byte order + 33, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x6f6d672e), + ACE_NTOHL (0x6f72672f), + ACE_NTOHL (0x434f5242), + ACE_NTOHL (0x412f5753), + ACE_NTOHL (0x7472696e), + ACE_NTOHL (0x67536571), + ACE_NTOHL (0x3a312e30), + ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/WStringSeq:1.0 + 11, + ACE_NTOHL (0x57537472), + ACE_NTOHL (0x696e6753), + ACE_NTOHL (0x65710000), // name = WStringSeq + CORBA::tk_sequence, // typecode kind 16, // encapsulation length TAO_ENCAP_BYTE_ORDER, // byte order - CORBA::tk_wstring, + CORBA::tk_wstring, 0U, // string length 0U, }; -static CORBA::TypeCode _tc_TAO_tc_CORBA_WStringSeq (CORBA::tk_alias, sizeof (_oc_CORBA_WStringSeq), (char *) &_oc_CORBA_WStringSeq, 0, sizeof (CORBA::WStringSeq)); + +static CORBA::TypeCode _tc_TAO_tc_CORBA_WStringSeq ( + CORBA::tk_alias, + sizeof (_oc_CORBA_WStringSeq), + (char *) &_oc_CORBA_WStringSeq, + 0, + sizeof (CORBA::WStringSeq) + ); + TAO_NAMESPACE_TYPE (CORBA::TypeCode_ptr) TAO_NAMESPACE_BEGIN (CORBA) -TAO_NAMESPACE_DEFINE (CORBA::TypeCode_ptr, _tc_WStringSeq, &_tc_TAO_tc_CORBA_WStringSeq) +TAO_NAMESPACE_DEFINE ( + ::CORBA::TypeCode_ptr, + _tc_WStringSeq, + &_tc_TAO_tc_CORBA_WStringSeq + ) TAO_NAMESPACE_END +// TAO_IDL - Generated from +// W:\ACE_wrappers\TAO\TAO_IDL\be\be_visitor_sequence/any_op_cs.cpp:54 + +// Copying insertion. void operator<<= ( CORBA::Any &_tao_any, const CORBA::StringSeq &_tao_elem - ) // copying + ) { - TAO_OutputCDR stream; - if (stream << _tao_elem) - { - _tao_any._tao_replace ( - CORBA::_tc_StringSeq, - TAO_ENCAP_BYTE_ORDER, - stream.begin () - ); - } + TAO::Any_Dual_Impl_T<CORBA::StringSeq>::insert_copy ( + _tao_any, + CORBA::StringSeq::_tao_any_destructor, + CORBA::_tc_StringSeq, + _tao_elem + ); } -void operator<<= (CORBA::Any &_tao_any, CORBA::StringSeq *_tao_elem) // non copying +// Non-copying insertion. +void operator<<= ( + CORBA::Any &_tao_any, + CORBA::StringSeq *_tao_elem + ) { - TAO_OutputCDR stream; - stream << *_tao_elem; - _tao_any._tao_replace ( + TAO::Any_Dual_Impl_T<CORBA::StringSeq>::insert ( + _tao_any, + CORBA::StringSeq::_tao_any_destructor, CORBA::_tc_StringSeq, - TAO_ENCAP_BYTE_ORDER, - stream.begin (), - 1, - _tao_elem, - CORBA::StringSeq::_tao_any_destructor + _tao_elem ); } -CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA::StringSeq *&_tao_elem) +// Extraction to non-const pointer (deprecated). +CORBA::Boolean operator>>= ( + const CORBA::Any &_tao_any, + CORBA::StringSeq *&_tao_elem + ) { - return _tao_any >>= ACE_const_cast( - const CORBA::StringSeq*&, + return _tao_any >>= ACE_const_cast ( + const CORBA::StringSeq *&, _tao_elem ); } -CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, const CORBA::StringSeq *&_tao_elem) +// Extraction to const pointer. +CORBA::Boolean operator>>= ( + const CORBA::Any &_tao_any, + const CORBA::StringSeq *&_tao_elem + ) { - _tao_elem = 0; - ACE_TRY_NEW_ENV - { - CORBA::TypeCode_var type = _tao_any.type (); - CORBA::Boolean result = - type->equivalent (CORBA::_tc_StringSeq ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (!result) - { - return 0; - } - - if (_tao_any.any_owns_data ()) - { - _tao_elem = ACE_static_cast( - const CORBA::StringSeq*, - _tao_any.value () - ); - return 1; - } - else - { - CORBA::StringSeq *tmp; - ACE_NEW_RETURN (tmp, CORBA::StringSeq, 0); - TAO_InputCDR stream ( - _tao_any._tao_get_cdr (), - _tao_any._tao_byte_order () - ); - if (stream >> *tmp) - { - ((CORBA::Any *)&_tao_any)->_tao_replace ( - CORBA::_tc_StringSeq, - 1, - ACE_static_cast (void *, tmp), - CORBA::StringSeq::_tao_any_destructor - ); - _tao_elem = tmp; - return 1; - } - else - { - delete tmp; - } - } - } - ACE_CATCHANY - { - } - ACE_ENDTRY; - return 0; + return + TAO::Any_Dual_Impl_T<CORBA::StringSeq>::extract ( + _tao_any, + CORBA::StringSeq::_tao_any_destructor, + CORBA::_tc_StringSeq, + _tao_elem + ); } +// TAO_IDL - Generated from +// W:\ACE_wrappers\TAO\TAO_IDL\be\be_visitor_sequence/any_op_cs.cpp:54 + +// Copying insertion. void operator<<= ( CORBA::Any &_tao_any, const CORBA::WStringSeq &_tao_elem - ) // copying + ) { - TAO_OutputCDR stream; - if (stream << _tao_elem) - { - _tao_any._tao_replace ( - CORBA::_tc_WStringSeq, - TAO_ENCAP_BYTE_ORDER, - stream.begin () - ); - } + TAO::Any_Dual_Impl_T<CORBA::WStringSeq>::insert_copy ( + _tao_any, + CORBA::WStringSeq::_tao_any_destructor, + CORBA::_tc_WStringSeq, + _tao_elem + ); } -void operator<<= (CORBA::Any &_tao_any, CORBA::WStringSeq *_tao_elem) // non copying +// Non-copying insertion. +void operator<<= ( + CORBA::Any &_tao_any, + CORBA::WStringSeq *_tao_elem + ) { - TAO_OutputCDR stream; - stream << *_tao_elem; - _tao_any._tao_replace ( + TAO::Any_Dual_Impl_T<CORBA::WStringSeq>::insert ( + _tao_any, + CORBA::WStringSeq::_tao_any_destructor, CORBA::_tc_WStringSeq, - TAO_ENCAP_BYTE_ORDER, - stream.begin (), - 1, - _tao_elem, - CORBA::WStringSeq::_tao_any_destructor + _tao_elem ); } -CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA::WStringSeq *&_tao_elem) +// Extraction to non-const pointer (deprecated). +CORBA::Boolean operator>>= ( + const CORBA::Any &_tao_any, + CORBA::WStringSeq *&_tao_elem + ) { - return _tao_any >>= ACE_const_cast( - const CORBA::WStringSeq*&, + return _tao_any >>= ACE_const_cast ( + const CORBA::WStringSeq *&, _tao_elem ); } -CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, const CORBA::WStringSeq *&_tao_elem) +// Extraction to const pointer. +CORBA::Boolean operator>>= ( + const CORBA::Any &_tao_any, + const CORBA::WStringSeq *&_tao_elem + ) { - _tao_elem = 0; - ACE_TRY_NEW_ENV - { - CORBA::TypeCode_var type = _tao_any.type (); - CORBA::Boolean result = - type->equivalent (CORBA::_tc_WStringSeq ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (!result) - { - return 0; - } - - if (_tao_any.any_owns_data ()) - { - _tao_elem = ACE_static_cast( - const CORBA::WStringSeq*, - _tao_any.value () - ); - return 1; - } - else - { - CORBA::WStringSeq *tmp; - ACE_NEW_RETURN (tmp, CORBA::WStringSeq, 0); - TAO_InputCDR stream ( - _tao_any._tao_get_cdr (), - _tao_any._tao_byte_order () - ); - if (stream >> *tmp) - { - ((CORBA::Any *)&_tao_any)->_tao_replace ( - CORBA::_tc_WStringSeq, - 1, - ACE_static_cast (void *, tmp), - CORBA::WStringSeq::_tao_any_destructor - ); - _tao_elem = tmp; - return 1; - } - else - { - delete tmp; - } - } - } - ACE_CATCHANY - { - } - ACE_ENDTRY; - return 0; + return + TAO::Any_Dual_Impl_T<CORBA::WStringSeq>::extract ( + _tao_any, + CORBA::WStringSeq::_tao_any_destructor, + CORBA::_tc_WStringSeq, + _tao_elem + ); } +// TAO_IDL - Generated from +// W:\ACE_wrappers\TAO\TAO_IDL\be\be_visitor_sequence/cdr_op_cs.cpp:125 + CORBA::Boolean operator<< ( TAO_OutputCDR &strm, const CORBA::StringSeq &_tao_sequence ) { - if (strm << _tao_sequence.length ()) - { - // encode all elements - CORBA::Boolean _tao_marshal_flag = 1; - for (CORBA::ULong i = 0; i < _tao_sequence.length () && _tao_marshal_flag; i++) + CORBA::ULong _tao_seq_len = _tao_sequence.length (); + + if (strm << _tao_seq_len) { - _tao_marshal_flag = (strm << _tao_sequence[i].in ()); + // Encode all elements. + CORBA::Boolean _tao_marshal_flag = 1; + + for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) + { + _tao_marshal_flag = (strm << _tao_sequence[i].in ()); + } + + return _tao_marshal_flag; } - return _tao_marshal_flag; - } - return 0; // error + + return 0; } CORBA::Boolean operator>> ( @@ -375,40 +404,64 @@ CORBA::Boolean operator>> ( ) { CORBA::ULong _tao_seq_len; + if (strm >> _tao_seq_len) - { - // set the length of the sequence - _tao_sequence.length (_tao_seq_len); - // If length is 0 we return true. - if (0 >= _tao_seq_len) - return 1; - // retrieve all the elements - CORBA::Boolean _tao_marshal_flag = 1; - for (CORBA::ULong i = 0; i < _tao_sequence.length () && _tao_marshal_flag; i++) { - _tao_marshal_flag = (strm >> _tao_sequence[i].out ()); + // Add a check to the length of the sequence + // to make sure it does not exceed the length + // of the stream. (See bug 58.) + if (_tao_seq_len > strm.length ()) + { + return 0; + } + + // Set the length of the sequence. + _tao_sequence.length (_tao_seq_len); + + // If length is 0 we return true. + if (0 >= _tao_seq_len) + { + return 1; + } + + // Retrieve all the elements. + CORBA::Boolean _tao_marshal_flag = 1; + + for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) + { + _tao_marshal_flag = (strm >> _tao_sequence[i].out ()); + } + + return _tao_marshal_flag; } - return _tao_marshal_flag; - } - return 0; // error + + return 0; } +// TAO_IDL - Generated from +// W:\ACE_wrappers\TAO\TAO_IDL\be\be_visitor_sequence/cdr_op_cs.cpp:125 + CORBA::Boolean operator<< ( TAO_OutputCDR &strm, const CORBA::WStringSeq &_tao_sequence ) { - if (strm << _tao_sequence.length ()) - { - // encode all elements - CORBA::Boolean _tao_marshal_flag = 1; - for (CORBA::ULong i = 0; i < _tao_sequence.length () && _tao_marshal_flag; i++) + CORBA::ULong _tao_seq_len = _tao_sequence.length (); + + if (strm << _tao_seq_len) { - _tao_marshal_flag = (strm << _tao_sequence[i].in ()); + // Encode all elements. + CORBA::Boolean _tao_marshal_flag = 1; + + for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) + { + _tao_marshal_flag = (strm << _tao_sequence[i].in ()); + } + + return _tao_marshal_flag; } - return _tao_marshal_flag; - } - return 0; // error + + return 0; } CORBA::Boolean operator>> ( @@ -417,20 +470,37 @@ CORBA::Boolean operator>> ( ) { CORBA::ULong _tao_seq_len; + if (strm >> _tao_seq_len) - { - // set the length of the sequence - _tao_sequence.length (_tao_seq_len); - // If length is 0 we return true. - if (0 >= _tao_seq_len) - return 1; - // retrieve all the elements - CORBA::Boolean _tao_marshal_flag = 1; - for (CORBA::ULong i = 0; i < _tao_sequence.length () && _tao_marshal_flag; i++) { - _tao_marshal_flag = (strm >> _tao_sequence[i].out ()); + // Add a check to the length of the sequence + // to make sure it does not exceed the length + // of the stream. (See bug 58.) + if (_tao_seq_len > strm.length ()) + { + return 0; + } + + // Set the length of the sequence. + _tao_sequence.length (_tao_seq_len); + + // If length is 0 we return true. + if (0 >= _tao_seq_len) + { + return 1; + } + + // Retrieve all the elements. + CORBA::Boolean _tao_marshal_flag = 1; + + for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) + { + _tao_marshal_flag = (strm >> _tao_sequence[i].out ()); + } + + return _tao_marshal_flag; } - return _tao_marshal_flag; - } - return 0; // error + + return 0; } + |