CORBA_TypeCode trouble



Hi guys,

there's a little problem with CORBA_any's and CORBA_TypeCodes:

In <orbit/orb-core/corba-typecode-type.h>, there is:

====
typedef struct CORBA_TypeCode_struct *CORBA_TypeCode;
====

So a `CORBA_TypeCode' is already a pointer to the typecode struct,
especially are TC_CORBA_long etc. all pointers.

But now look at the following example:

====
   CORBA_any any = { TC_CORBA_TypeCode, TC_CORBA_long, FALSE };
   CORBA_TypeCode newtc;
   CORBA_any *newany;

   dyn = (DynamicAny_DynStruct)
         DynamicAny_DynAnyFactory_create_dyn_any
         guile_corba_dynany_factory, &any, &ev);

   newany = DynamicAny_DynAny_to_any ((DynamicAny_DynAny) dyn, &ev);
   newtc = newany->_value;
====

This is supposed to work, isn't it ?

At the moment, this will dump core unless you change it to (note that
now `oldtc' is a pointer to a pointer):

====
   CORBA_TypeCode *oldtc = &TC_CORBA_long;
   CORBA_any any = { TC_CORBA_TypeCode, oldtc, FALSE };
   CORBA_TypeCode newtc;
   CORBA_any *newany;

   dyn = (DynamicAny_DynStruct)
         DynamicAny_DynAnyFactory_create_dyn_any
         guile_corba_dynany_factory, &any, &ev);

   newany = DynamicAny_DynAny_to_any ((DynamicAny_DynAny) dyn, &ev);
   newtc = * (CORBA_TypeCode *) newany->_value;
====

There are also problems with casting CORBA_TypeCode to CORBA_Object.

-- 
Martin Baulig
martin gnome org (private)
baulig suse de (work)




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