[omniORB] proposed patch for Any handling of octet sequences

Renzo Tomaselli renzo.tomaselli@tecnotp.it
Mon, 3 Jan 2000 17:30:32 -0600


This is a multi-part message in MIME format.

------=_NextPart_000_0031_01BF5610.3C4BCF90
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Hi OmniORB developers,
    I attached a proposed patch for tcParser.cc (related to ver. 2.8). While
being simple, this patch would quite speed-up insertion/extraction of octet
sequences to/from anys (see my previous message on this issue a few weeks
ago).
The way it works now is definitely a no-go (e.g. handling such sequences
byte-by-byte) for graphics applications or other applications needing to
handle large byte blocks through anys.
A similar patch should be applied to tcParser::calculateItemSize() and
tcParser::appendItem() as well.
Thanks,
                                             Renzo Tomaselli
---------------------------------------------------------------------------
TecnoTP s.n.c. Special Information System Design
Maso Pelauchi I38050 Ronchi Valsugana,  Trento TN  ITALY
Tel. +39 0461 773164      Fax. +39 0461 771514
e-mail: renzo.tomaselli@tecnotp.it
---------------------------------------------------------------------------


------=_NextPart_000_0031_01BF5610.3C4BCF90
Content-Type: application/octet-stream;
	name="tcParser-patch.cc"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="tcParser-patch.cc"

// tcParser.cc

void
tcParser::appendItem(TypeCode_base* tc, tcDescriptor& tcdata)
{
...

  case CORBA::tk_sequence:
    {
      CORBA::ULong max =3D =
tcdata.p_sequence.getElementCount(&tcdata.p_sequence);
      TypeCode_base* tctmp =3D tc->NP_content_type();

      // Save the length of the sequence.
      max >>=3D pd_mbuf;

      // Save the sequence data.

      if (tctmp->NP_kind() =3D=3D CORBA::tk_octet)			// NEW !
	memcpy(pd_mbuf, tcdata.p_sequence.opq_seq, max);	// NEW !
      else {
        for (CORBA::ULong i=3D0; i < max; i++)
	  {
	    tcDescriptor desc;

	    // Get a descriptor for the sequence element.
	    if( !tcdata.p_sequence.getElementDesc(&tcdata.p_sequence, i, desc) =
)
	      throw omniORB::fatalException(__FILE__,__LINE__,
	        "tcParser::appendItem() - failed to get sequence descriptor");

	    // Append the element to the mbuf.
	    appendItem(tctmp, desc);
	  }
      }
      break;
    }


------=_NextPart_000_0031_01BF5610.3C4BCF90--