TypeCode operations



Okay, I copied the TypeCode operations from ORBit STABLE, and apart from
having to modify CORBA_TypeCode_member_label(), everything seems okay.

Two things:

First, I'd like someone to check the included code to see that I'm
generating the CORBA_any correctly, and not causing any memory leaks or
other errors. I'm specifically worried about the call to
ORBit_RootObject_duplicate() to copy the TypeCode for the CORBA_any, and
the assumption that the caller owns the returned CORBA_any. If these two
things are correct, then I'm confident that the code is right.

If the caller doesn't own the returned CORBA_any, then I don't know how
to implement this method and someone else will have to help me.

Second, someone in charge needs to tell me if these TypeCode operations
are wanted on the HEAD branch, or if I should restrict them to the cpp
branch.

Also, I've noticed that the tests don't include tests for any of these
TypeCode operations, just for CORBA_TypeCode_equal() and
CORBA_TypeCode_equivalent(). Should tests for these be added?

The code for the CORBA_TypeCode_member_label() method that I'd like
reviewed follows. The important bit is the second half, after the call
to CORBA_any__alloc().

CORBA_any *CORBA_TypeCode_member_label(CORBA_TypeCode obj, CORBA_unsigned_long index, CORBA_Environment *ev)
{
	CORBA_any *retval = NULL;

	if (obj->kind != CORBA_tk_union) {
		bad_kind (ev);
		return NULL;
	}
	if (index > obj->sub_parts) {
		bounds_error (ev);
		return NULL;
	}
	retval = CORBA_any__alloc();
	if (retval == NULL) {
		CORBA_exception_set_system (ev, ex_CORBA_NO_MEMORY,
									CORBA_COMPLETED_NO);
	} else {
		retval->_type = ORBit_RootObject_duplicate(obj->subtypes[index]);
		retval->_value =
			ORBit_copy_value(obj->sublabels[index], retval->_type);
		retval->_release = CORBA_TRUE;
	}

	return retval;
}
-- 
Sam "Eddie" Couter  |  mailto:scouter@bigpond.net.au
Debian Developer    |  mailto:eddie@debian.org
                    |  jabber:sam@jabber.topic.com.au
OpenPGP fingerprint:  A46B 9BB5 3148 7BEA 1F05  5BD5 8530 03AE DE89 C75C

PGP signature



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