[omniORB] Sequence length operation
jnye@micro-optics.com
jnye@micro-optics.com
Tue, 12 Jun 2001 10:44:52 -0300
Patrick,
Sure, that check should obviously be added -- oversight.
Cheers,
Jason.
-----Original Message-----
From: Patrick Decat [mailto:pdecat@lfvie.generali.fr]
Sent: Tuesday, June 12, 2001 10:39 AM
To: jnye@micro-optics.com; omniorb-list@uk.research.att.com
Subject: Re: [omniORB] Sequence length operation
Hi,
in your implementation, nothing enforces that pd_max * 2 is at least equal
or greater than the length you take as a parameter.
Greetings,
Patrick.
----- Original Message -----
From: <jnye@micro-optics.com>
To: <omniorb-list@uk.research.att.com>
Sent: Tuesday, June 12, 2001 3:27 PM
Subject: [omniORB] Sequence length operation
[...]
>
> Here is an implementation I propose:
> inline void length(_CORBA_ULong length)
> {
> if (length > pd_max)
> {
> *** _CORBA_ULong pd_max_tmp = pd_max * 2; ***
> *** ElemT* newbuf = new ElemT[pd_max_tmp]; ***
> if( !newbuf ) _CORBA_new_operator_return_null();
> for( unsigned long i = 0; i < pd_len; i++ )
> newbuf[i] = pd_buf[i];
> *** pd_max = pd_max_tmp; ***
> if( pd_rel && pd_buf ) delete[] pd_buf;
> else pd_rel = 1;
> pd_buf = newbuf;
> }
> pd_len = length;
> }
>
> Just a suggestion...
>
> Cheers,
> Jason.
>