[PATCH] CORBA::ORBit - Passing of Object type to Naming Service
- From: Sreeji K Das <bksys vsnl com>
- To: orbit-list gnome org
- Cc: otaylor redhat com
- Subject: [PATCH] CORBA::ORBit - Passing of Object type to Naming Service
- Date: Thu, 22 Mar 2001 12:46:58 +0530 (IST)
Hi all,
I had been trying to use Naming Service from CORBA::ORBit. But whenever I
call the method
void bind(in Name n, in Object obj)
I used to get exception "Attempt to marshall unknown object type".
I found it was because of the check in put_objref() in marshal.c. I'm
attaching a patch to get around this problem. After this patch, I'm able
to use Naming Service from Perl. I've also tested with a couple of other
programs passing different objects & looks like no problem.
Anyway I don't really know the entire code & so dunno whether it'd affect
somewhere else. Looks like it won't. Owen, can u verify & put it in the
next release ? [This's the first time ever I'm submitting a patch. I've
simply done a diff -u of marshal.c]
Rgds.
Sreeji
--- CORBA-ORBit-0.4.3/marshal.c Thu Mar 22 12:35:46 2001
+++ CORBA-ORBit-0.4.3/marshal.new.c Thu Mar 22 12:34:38 2001
@@ -414,27 +414,45 @@
put_objref (GIOPSendBuffer *buf, CORBA_TypeCode tc, SV *sv)
{
CORBA_Object obj;
- PORBitIfaceInfo *info = porbit_find_interface_description (tc->repo_id);
+ PORBitIfaceInfo *info;
- if (!info)
- croak ("Attempt to marshall unknown object type");
-
- if (!SvOK(sv))
- obj = CORBA_OBJECT_NIL;
- else {
- /* FIXME: This check isn't right at all if the object
- * is of an unknown type. (Or if the type we have
- * for the object is not the most derived type.)
- * We should call the server side ISA and then
- * downcast in this case?
- */
- if (!sv_derived_from (sv, info->pkg)) {
- warn ("Value is not a %s", info->pkg);
- return CORBA_FALSE;
- }
+ if (tc->repo_id[0] != NULL)
+ {
+ info = porbit_find_interface_description (tc->repo_id);
- obj = (CORBA_Object)SvIV((SV*)SvRV(sv));
- }
+ if (!info)
+ croak ("Attempt to marshall unknown object type");
+
+ if (!SvOK(sv))
+ obj = CORBA_OBJECT_NIL;
+ else {
+ /* FIXME: This check isn't right at all if the object
+ * is of an unknown type. (Or if the type we have
+ * for the object is not the most derived type.)
+ * We should call the server side ISA and then
+ * downcast in this case?
+ */
+ if (!sv_derived_from (sv, info->pkg)) {
+ warn ("Value is not a %s", info->pkg);
+ return CORBA_FALSE;
+ }
+
+ obj = (CORBA_Object)SvIV((SV*)SvRV(sv));
+ }
+ }
+ else
+ {
+ # We simply check whether SV is an object. Is that right ? - Sreeji
+ if (!SvOK(sv))
+ obj = CORBA_OBJECT_NIL;
+ else {
+ if (!sv_isobject (sv)) {
+ warn ("Value is not an Object Reference");
+ return CORBA_FALSE;
+ }
+ obj = (CORBA_Object)SvIV((SV*)SvRV(sv));
+ }
+ }
ORBit_marshal_object (buf, obj);
return CORBA_TRUE;
@@ -702,3 +720,4 @@
return CORBA_FALSE;
}
}
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]