RE: "any within struct" ORBit decoding problem



The alignment fix that was posted only fixed the
receive side. I've been testing with sending
and receiving sequence<any> types between ORBit
and OmniORB on Solaris. The enclosed patch fixes
both send and receive (patch is against
released 0.5.12).

The first couple of chunks of the patch
fix unrelated compilation problems with ORBit on
non-gcc compilers (I'm testing with Sun's compilers
on Solaris) (invalid pointer arithmetic on void*
types, and using dynamic initializers where static
are required).

The last two chunks of the patch fix the
specific interoperability issue with
typecode marshalling/demarshalling alignment.

I'm using latest orbit-perl out of CVS with
ORBit 0.5.12, and have some patches for that
too, which I will post later to orbit-perl.

A few questions:

* Why isn't there a more recent release of orbit-perl? The
  CVS version is way ahead and fixes many problems.
* Is anyone working on moving the Perl binding to ORBit2?
* Can ORBit2 be used in a strictly single-threaded environment?

	-Huw

>On Tue, 17 Jul 2001, Alex Hornby wrote:
>> I haven't seen any followups to this alignment fix. Anyone interested?
>> I can put it in patch form if that would help.
>  
>        I'd be most interested in a patch if you have one ... also, more  
>tellingly - a regression test against ORBit2 would be lovely :-) [ I 
>assume the problem is in both ORBit-stable and ORBit2 ? ].
>  
>        Thanks,
>  
>                Michael.
diff -c -r ORBit-0.5.12.orig/src/orb/corba_any.c ORBit-0.5.12/src/orb/corba_any.c
*** ORBit-0.5.12.orig/src/orb/corba_any.c	Tue Oct 23 17:44:03 2001
--- ORBit-0.5.12/src/orb/corba_any.c	Mon Dec 31 08:25:39 2001
***************
*** 189,195 ****
  /*	    *val = ALIGN_ADDRESS(*val, ALIGNOF_CORBA_UNION); */
  
  	    *val = ALIGN_ADDRESS(*val, ORBit_find_alignment(tc));
! 	    max_size = ORBit_gather_alloc_info(tc) - (*val - newval);
  
  	    newval = ((char *)*val) + max_size;
  	    ORBit_marshal_value(buf, val, utc, mi);
--- 189,195 ----
  /*	    *val = ALIGN_ADDRESS(*val, ALIGNOF_CORBA_UNION); */
  
  	    *val = ALIGN_ADDRESS(*val, ORBit_find_alignment(tc));
! 	    max_size = ORBit_gather_alloc_info(tc) - ((guchar *)*val - (guchar *)newval);
  
  	    newval = ((char *)*val) + max_size;
  	    ORBit_marshal_value(buf, val, utc, mi);
diff -c -r ORBit-0.5.12.orig/src/orb/orb.c ORBit-0.5.12/src/orb/orb.c
*** ORBit-0.5.12.orig/src/orb/orb.c	Wed Oct  3 15:51:21 2001
--- ORBit-0.5.12/src/orb/orb.c	Mon Dec 31 08:25:39 2001
***************
*** 1037,1044 ****
  	else if(!strcmp(identifier, "RootPOA")) {
  		if(CORBA_Object_is_nil(orb->root_poa, ev)) {
  			CORBA_Policy policybuf[1];
! 			CORBA_PolicyList policies  = {1,1,policybuf,CORBA_FALSE};
  			PortableServer_POAManager poa_mgr;
  			/* The only non-default policy used by the RootPOA is IMPLICIT ACTIVATION */ 
  			policies._buffer[0]= (CORBA_Policy)
  				PortableServer_POA_create_implicit_activation_policy(NULL,
--- 1037,1045 ----
  	else if(!strcmp(identifier, "RootPOA")) {
  		if(CORBA_Object_is_nil(orb->root_poa, ev)) {
  			CORBA_Policy policybuf[1];
! 			CORBA_PolicyList policies  = {1,1,0,CORBA_FALSE};
  			PortableServer_POAManager poa_mgr;
+ 			policies._buffer = policybuf;
  			/* The only non-default policy used by the RootPOA is IMPLICIT ACTIVATION */ 
  			policies._buffer[0]= (CORBA_Policy)
  				PortableServer_POA_create_implicit_activation_policy(NULL,
diff -c -r ORBit-0.5.12.orig/src/orb/orbit_typecode.c ORBit-0.5.12/src/orb/orbit_typecode.c
*** ORBit-0.5.12.orig/src/orb/orbit_typecode.c	Thu Nov  1 18:53:30 2001
--- ORBit-0.5.12/src/orb/orbit_typecode.c	Tue Jan  1 22:00:16 2002
***************
*** 133,138 ****
--- 132,138 ----
  	for(l=ctx.prior_tcs;l;l=l->next)
  		g_free(l->data);
  	g_slist_free(ctx.prior_tcs);
+ 	giop_message_buffer_do_alignment(GIOP_MESSAGE_BUFFER(buf), 4);
  	giop_send_buffer_append_mem_indirect(buf,
  					     codec->buffer,
  					     codec->wptr);
***************
*** 146,151 ****
--- 146,152 ----
  	GSList* l;
  
  	CDR_codec_init_static(codec);
+ 	buf->cur = ALIGN_ADDRESS(buf->cur, 4);
  	codec->buffer=buf->cur;
  	codec->release_buffer=CORBA_FALSE;
  	codec->readonly=CORBA_TRUE;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]