- From: Rodney Dawes <dobey ximian com>
- To: michael ximian com
- Subject: ORBit endian issues suck :-)
- Date: 06 Feb 2002 16:08:49 -0500
So, This breaks:
2001-10-03 Michael Meeks <michael@ximian.com>
* src/IIOP/giop-msg-buffer.c (giop_dump_recv, dump): add
improved debugging infastructure.
(giop_recv_message_buffer_use): add debugging.
(giop_recv_reply_decode_message): re-hash debugging,
add > 128 error msgs.
* src/orb/orbit_object.c (ORBit_demarshal_profile): accept
IOP_TAG_MULTIPLE_COMPONENTS silently, ditto for TAG_GENERIC_IOP,
and return NULL not a duff struct.
(ORBit_free_profile, ORBit_marshal_profile): silence.
(ORBit_demarshal_IOR): tolerate / silently ignore unknown
profiles without whacking them on the profile list, as done by
ORBit_demarshal_object.
(ORBit_demarshal_profile):
* src/orb/orb.c (ORBit_emit_profile): silence.
* src/orb/iop.h (IOP_TAG_GENERIC_IOP): add.
---------------------------------------------------------------------------
And this works:
2001-05-30 Michael Meeks <michael@ximian.com>
* src/orb/dynany.c (dynany_sequence_realloc_to): fix
bug overrunning sequence.
Also, attached is the diff between the src/orb/ directories for these
two versions, via cvs export. Hope you can figure it out quickly ;-)
-- dobey
diff -uNr ORBit-2001-05-30/src/orb/Makefile.am ORBit-2001-10-03/src/orb/Makefile.am
--- ORBit-2001-05-30/src/orb/Makefile.am Sun Jan 28 17:17:50 2001
+++ ORBit-2001-10-03/src/orb/Makefile.am Wed Sep 19 13:09:01 2001
@@ -1,7 +1,5 @@
## Process this file with automake to produce Makefile.in
-libORBitincludedir = $(includedir)/ORBit
-
INCLUDES =-I.. -I$(top_srcdir)/src @GLIB_CFLAGS@ \
-DORBit_SYSRC=\"$(sysconfdir)/orbitrc\" \
-I$(top_builddir)/src/ORBitutil \
@@ -13,7 +11,7 @@
lib_LTLIBRARIES = libORBit.la
-libORBitincludedir = $(includedir)/orb
+libORBitincludedir = $(includedir)/orbit-1.0/orb
EXTRA_DIST=orbit.h.in
@@ -119,5 +117,3 @@
dist-hook:
cd $(distdir); rm -f $(BUILT_SOURCES)
-
-CFLAGS=-g -O0
\ No newline at end of file
diff -uNr ORBit-2001-05-30/src/orb/allocators.c ORBit-2001-10-03/src/orb/allocators.c
--- ORBit-2001-05-30/src/orb/allocators.c Fri Mar 16 03:32:06 2001
+++ ORBit-2001-10-03/src/orb/allocators.c Mon Oct 1 10:21:38 2001
@@ -84,7 +84,7 @@
#endif
block->free = freefunc;
block->func_data = func_data;
- block->free_marker= FREE_MARKER_IS_ALLOCATED;
+ block->u.free_marker= FREE_MARKER_IS_ALLOCATED;
return MEMINFO_TO_PTR(block);
}
@@ -116,7 +116,7 @@
/* This block has not been allocated by CORBA_alloc. Instead
* it is memory in the receive buffer, that has been used in
* demarshalling. Let's just return. */
- if (block->free_marker != FREE_MARKER_IS_ALLOCATED)
+ if (block->u.free_marker != FREE_MARKER_IS_ALLOCATED)
return;
#ifdef ORBIT_DEBUG
diff -uNr ORBit-2001-05-30/src/orb/allocators.h ORBit-2001-10-03/src/orb/allocators.h
--- ORBit-2001-05-30/src/orb/allocators.h Fri Mar 16 03:32:06 2001
+++ ORBit-2001-10-03/src/orb/allocators.h Mon Oct 1 10:21:38 2001
@@ -33,10 +33,8 @@
gpointer func_data,
CORBA_boolean ignore);
-/* Please make sure this structure's size is divisible by 8, at least. */
typedef struct {
gulong magic;
- gulong unused;
/* If this routine returns FALSE, it indicates that it already free'd
the memory block itself */
@@ -56,7 +54,10 @@
* swapped endianess, so using 0xffff0000 is a plan to
* disaster.
*/
- CORBA_unsigned_long free_marker;
+ union {
+ CORBA_unsigned_long free_marker;
+ double align_me_properly;
+ } u;
} ORBit_mem_info;
gpointer ORBit_alloc(size_t block_size,
diff -uNr ORBit-2001-05-30/src/orb/corba_any.c ORBit-2001-10-03/src/orb/corba_any.c
--- ORBit-2001-05-30/src/orb/corba_any.c Fri Mar 9 04:25:08 2001
+++ ORBit-2001-10-03/src/orb/corba_any.c Tue Sep 11 18:25:38 2001
@@ -178,16 +178,23 @@
find out which value we want to use */
{
CORBA_TypeCode utc;
+ int i;
+ guint max_size = 0;
+ gpointer newval;
- *val = ALIGN_ADDRESS(*val, ALIGNOF_CORBA_STRUCT);
+ *val = newval = ALIGN_ADDRESS(*val, ALIGNOF_CORBA_STRUCT);
- utc = ORBit_get_union_tag(tc, val, TRUE);
-
- *val = ALIGN_ADDRESS(*val, ALIGNOF_CORBA_STRUCT);
+ utc = ORBit_get_union_tag(tc, val, FALSE);
ORBit_marshal_value(buf, val, tc->discriminator, mi);
+/* *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);
+ *val = newval;
}
break;
case CORBA_tk_wstring:
diff -uNr ORBit-2001-05-30/src/orb/dynany.c ORBit-2001-10-03/src/orb/dynany.c
--- ORBit-2001-05-30/src/orb/dynany.c Tue May 29 19:22:07 2001
+++ ORBit-2001-10-03/src/orb/dynany.c Tue Sep 11 18:25:38 2001
@@ -1787,7 +1787,7 @@
TC_any
};
-static const struct CORBA_TypeCode_struct
+const struct CORBA_TypeCode_struct
TC_CORBA_sequence_DynamicAny_DynAny_AnySeq_struct = {
{{(ORBit_RootObject_Interface *) & ORBit_TypeCode_epv, TRUE, -1},
ORBIT_PSEUDO_TYPECODE},
@@ -1834,7 +1834,7 @@
TC_Object
};
-static const struct CORBA_TypeCode_struct
+const struct CORBA_TypeCode_struct
TC_CORBA_sequence_DynamicAny_DynAny_DynAnySeq_struct = {
{{(ORBit_RootObject_Interface *) & ORBit_TypeCode_epv, TRUE, -1},
ORBIT_PSEUDO_TYPECODE},
diff -uNr ORBit-2001-05-30/src/orb/iop.h ORBit-2001-10-03/src/orb/iop.h
--- ORBit-2001-05-30/src/orb/iop.h Sun Oct 4 12:36:48 1998
+++ ORBit-2001-10-03/src/orb/iop.h Tue Oct 2 03:19:19 2001
@@ -39,6 +39,7 @@
#define IOP_TAG_INTERNET_IOP 0
#define IOP_TAG_MULTIPLE_COMPONENTS 1
+#define IOP_TAG_GENERIC_IOP 0x4f425400
#define IOP_TAG_ORBIT_SPECIFIC 0xbadfaecal
typedef struct IOP_TaggedProfile {
diff -uNr ORBit-2001-05-30/src/orb/orb.c ORBit-2001-10-03/src/orb/orb.c
--- ORBit-2001-05-30/src/orb/orb.c Sun May 13 03:36:28 2001
+++ ORBit-2001-10-03/src/orb/orb.c Tue Oct 2 03:19:19 2001
@@ -24,6 +24,8 @@
*
*/
+#undef PROFILE_DEBUG
+
#define o_return_val_if_fail(expr, val) if(!(expr)) { CORBA_exception_set_system(ev, ex_CORBA_BAD_PARAM, CORBA_COMPLETED_NO); return (val); }
#define o_return_if_fail(expr) if(!(expr)) { CORBA_exception_set_system(ev, ex_CORBA_BAD_PARAM, CORBA_COMPLETED_NO); return; }
@@ -402,12 +404,11 @@
ORBIT_ROOT_OBJECT(orb)->refs = 1;
- if(orb_id_opt!=NULL) {
- if(!ORBit_ORBid_setup(orb, orb_id_opt))
- goto error;
- g_free(orb_id_opt);
- } else if(orb_identifier!=NULL) {
+ if(orb_identifier!=NULL && *orb_identifier!='\0') {
if(!ORBit_ORBid_setup(orb, orb_identifier))
+ goto error;
+ } else if(orb_id_opt!=NULL) {
+ if(!ORBit_ORBid_setup(orb, orb_id_opt))
goto error;
} else {
orb->orb_identifier=g_strdup("orbit-local-orb");
@@ -622,7 +623,9 @@
break;
default:
- g_warning("Skipping tag %d", profile->profile_type);
+#ifdef PROFILE_DEBUG
+ g_warning("Unknown tag %d", profile->profile_type);
+#endif
break;
}
}
@@ -929,7 +932,9 @@
profiles=g_slist_append(profiles, object_info);
break;
default:
+#ifdef PROFILE_DEBUG
g_warning("Unknown tag 0x%x", tag);
+#endif
/* Skip it */
if(!CDR_get_ulong(codec, &misclen))
@@ -1021,6 +1026,8 @@
g_return_val_if_fail(ev, CORBA_OBJECT_NIL);
o_return_val_if_fail(orb, CORBA_OBJECT_NIL);
+ CORBA_exception_free(ev);
+
if(!strcmp(identifier, "ImplementationRepository"))
return CORBA_Object_duplicate(orb->imr, ev);
else if(!strcmp(identifier, "InterfaceRepository"))
@@ -1036,7 +1043,7 @@
policies._buffer[0]= (CORBA_Policy)
PortableServer_POA_create_implicit_activation_policy(NULL,
PortableServer_IMPLICIT_ACTIVATION,
- ev);
+ ev);
/* Create a poa manager */
poa_mgr = ORBit_POAManager_new();
poa_mgr->orb = orb;
diff -uNr ORBit-2001-05-30/src/orb/orbit_object.c ORBit-2001-10-03/src/orb/orbit_object.c
--- ORBit-2001-05-30/src/orb/orbit_object.c Thu Jan 18 15:16:44 2001
+++ ORBit-2001-10-03/src/orb/orbit_object.c Tue Oct 2 03:19:19 2001
@@ -29,6 +29,8 @@
*
*/
+#undef PROFILE_DEBUG
+
#include <string.h>
#include "config.h"
#include "../IIOP/iiop-endianP.h"
@@ -141,7 +143,9 @@
} else if(info->profile_type == IOP_TAG_ORBIT_SPECIFIC) {
g_free(info->tag.orbitinfo.unix_sock_path);
} else {
+#ifdef PROFILE_DEBUG
g_warning("ORBit_free_profile asked to free type %d", info->profile_type);
+#endif
}
g_free(info); /* Check its safe to free the item within a foreach func */
@@ -293,13 +297,16 @@
return(object_info);
break;
- case IOP_TAG_MULTIPLE_COMPONENTS:
default:
+ g_warning("Unknown IOP profile");
+
+ case IOP_TAG_GENERIC_IOP:
+ case IOP_TAG_MULTIPLE_COMPONENTS:
+ /* FIXME: IOP_TAG_MULTIPLE_COMPONENTS needs implementing */
GET_ATOM(subpart_len);
- g_warning("IOP_TAG_MULTIPLE_COMPONENTS decoding needs finishing");
- object_info->profile_type = IOP_TAG_MULTIPLE_COMPONENTS;
recv_buffer->cur = ((guchar *)recv_buffer->cur) + subpart_len;
- return(object_info);
+ g_free (object_info);
+ return NULL;
break;
case IOP_TAG_ORBIT_SPECIFIC:
@@ -372,11 +379,8 @@
ALIGNFOR(CORBA_unsigned_long);
GET_ATOM(profile_id);
object_info=ORBit_demarshal_profile(recv_buffer, profile_id);
- if(object_info==NULL) {
- goto error_exit;
- } else {
+ if (object_info)
profiles=g_slist_append(profiles, object_info);
- }
}
return(profiles);
@@ -453,7 +457,7 @@
g_assert(info);
g_assert(send_buffer);
- if(info->profile_type == IOP_TAG_INTERNET_IOP) {
+ if (info->profile_type == IOP_TAG_INTERNET_IOP) {
giop_message_buffer_append_mem(GIOP_MESSAGE_BUFFER(send_buffer),
&ioptag, sizeof(ioptag));
@@ -476,7 +480,7 @@
&len, sizeof(len));
giop_send_buffer_append_mem_indirect(send_buffer,
codec->buffer, codec->wptr);
- } else if(info->profile_type==IOP_TAG_ORBIT_SPECIFIC) {
+ } else if (info->profile_type==IOP_TAG_ORBIT_SPECIFIC) {
giop_message_buffer_append_mem_a(GIOP_MESSAGE_BUFFER(send_buffer),
&orbittag, sizeof(orbittag));
CDR_codec_init_static(codec);
@@ -498,7 +502,9 @@
giop_send_buffer_append_mem_indirect(send_buffer,
codec->buffer, codec->wptr);
} else {
+#ifdef PROFILE_DEBUG
g_warning("ORBit_marshal_profile ask to marshal type %d\n", info->profile_type);
+#endif
}
}
diff -uNr ORBit-2001-05-30/src/orb/orbit_poa.c ORBit-2001-10-03/src/orb/orbit_poa.c
--- ORBit-2001-05-30/src/orb/orbit_poa.c Fri Jan 19 07:48:07 2001
+++ ORBit-2001-10-03/src/orb/orbit_poa.c Thu Jun 14 20:34:27 2001
@@ -450,6 +450,11 @@
if(!servant) {
switch(poa->request_processing) {
+ case PortableServer_USE_ACTIVE_OBJECT_MAP_ONLY:
+ obj_impl = g_hash_table_lookup(poa->active_object_map, oid);
+ if(obj_impl)
+ servant = obj_impl->servant;
+ break;
case PortableServer_USE_SERVANT_MANAGER:
servant = ORBit_POA_ServantManager_use_servant(poa,
recv_buffer,
diff -uNr ORBit-2001-05-30/src/orb/poa.c ORBit-2001-10-03/src/orb/poa.c
--- ORBit-2001-05-30/src/orb/poa.c Fri Mar 9 04:25:08 2001
+++ ORBit-2001-10-03/src/orb/poa.c Tue Sep 11 18:25:39 2001
@@ -827,6 +827,9 @@
CORBA_FALSE,
CORBA_FALSE,
ev);
+ } else {
+ PortableServer_ServantBase *serv = oldobj->servant;
+ serv->_private = NULL;
}
CORBA_free(oldobj->object_id);