summaryrefslogtreecommitdiff
path: root/TAO/tao
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1998-03-21 21:07:13 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1998-03-21 21:07:13 +0000
commite6b729e10c3753a4c7b208352f1217a80698ce72 (patch)
treea58339cb1e06e5a66d469460f74a5e29f6b9e270 /TAO/tao
parent4a71eb085dc7066f6c73ec7d29e614b40a6bd09b (diff)
downloadATCD-e6b729e10c3753a4c7b208352f1217a80698ce72.tar.gz
*** empty log message ***
Diffstat (limited to 'TAO/tao')
-rw-r--r--TAO/tao/decode.cpp644
-rw-r--r--TAO/tao/deep_copy.cpp290
-rw-r--r--TAO/tao/deep_free.cpp2
-rw-r--r--TAO/tao/default_client.cpp15
-rw-r--r--TAO/tao/default_client.h5
-rw-r--r--TAO/tao/default_server.cpp153
-rw-r--r--TAO/tao/default_server.h2
-rw-r--r--TAO/tao/encode.cpp2
-rw-r--r--TAO/tao/except.cpp209
-rw-r--r--TAO/tao/except.h83
-rw-r--r--TAO/tao/except.i83
-rw-r--r--TAO/tao/giop.cpp9
-rw-r--r--TAO/tao/giop.h158
13 files changed, 943 insertions, 712 deletions
diff --git a/TAO/tao/decode.cpp b/TAO/tao/decode.cpp
index b14b244e790..ef21e5677f5 100644
--- a/TAO/tao/decode.cpp
+++ b/TAO/tao/decode.cpp
@@ -341,11 +341,10 @@ TAO_Marshal_TypeCode::decode (CORBA::TypeCode_ptr,
break;
// Indirected typecodes, illegal at "top level" but we
- // allow unmarshaling of them here because we use the
- // same code to read "off the wire" (where they're
- // illegal) and to read out of an encapsulation
- // stream. We distinguish the case where this is
- // legal as described above.
+ // allow unmarshaling of them here because we use the same
+ // code to read "off the wire" (where they're illegal) and
+ // to read out of an encapsulation stream. We distinguish
+ // the case where this is legal as described above.
case ~0:
{
if (parent_typecode == 0)
@@ -473,15 +472,14 @@ TAO_Marshal_TypeCode::decode (CORBA::TypeCode_ptr,
}
} // end of switch
}
- else // bad kind_ value to be decoded
- {
- env.exception (new CORBA::BAD_TYPECODE (CORBA::COMPLETED_NO));
- dmsg ("TAO_Marshal_TypeCode: Bad kind_ value in CDR stream");
- return CORBA::TypeCode::TRAVERSE_STOP;
- }
+ else // bad kind_ value to be decoded
+ {
+ env.exception (new CORBA::BAD_TYPECODE (CORBA::COMPLETED_NO));
+ dmsg ("TAO_Marshal_TypeCode: Bad kind_ value in CDR stream");
+ return CORBA::TypeCode::TRAVERSE_STOP;
}
-
}
+
if (continue_decoding == CORBA::B_TRUE)
return CORBA::TypeCode::TRAVERSE_CONTINUE;
else
@@ -492,7 +490,8 @@ TAO_Marshal_TypeCode::decode (CORBA::TypeCode_ptr,
}
}
-// encode Principal
+// Encode Principal.
+
CORBA::TypeCode::traverse_status
TAO_Marshal_Principal::decode (CORBA::TypeCode_ptr,
const void *data,
@@ -501,7 +500,10 @@ TAO_Marshal_Principal::decode (CORBA::TypeCode_ptr,
CORBA::Environment &env)
{
CORBA::Boolean continue_decoding = CORBA::B_TRUE;
- CDR *stream = (CDR *) context; // context is the CDR stream
+
+ // Context is the CDR stream.
+ CDR *stream = (CDR *) context;
+
CORBA::Principal_ptr *pp = (CORBA::Principal_ptr *) data;
CORBA::ULong len;
@@ -510,9 +512,13 @@ TAO_Marshal_Principal::decode (CORBA::TypeCode_ptr,
*pp = 0; // null principal
else
{
- // allocate storage for Principal and its buffer
- *pp = new CORBA::Principal;
- (*pp)->id.buffer = new CORBA::Octet [ (size_t) len];
+ // Allocate storage for Principal and its buffer.
+ ACE_NEW_RETURN (*pp,
+ CORBA::Principal,
+ CORBA::TypeCode::TRAVERSE_CONTINUE);
+ ACE_NEW_RETURN ((*pp)->id.buffer,
+ CORBA::Octet [(size_t) len],
+ CORBA::TypeCode::TRAVERSE_CONTINUE);
(*pp)->id.maximum = (*pp)->id.length = len;
for (u_int i = 0;
@@ -531,7 +537,7 @@ TAO_Marshal_Principal::decode (CORBA::TypeCode_ptr,
}
}
-// decode obj ref
+// Decode obj ref.
CORBA::TypeCode::traverse_status
TAO_Marshal_ObjRef::decode (CORBA::TypeCode_ptr,
const void *data, // where the result will go
@@ -540,7 +546,9 @@ TAO_Marshal_ObjRef::decode (CORBA::TypeCode_ptr,
CORBA::Environment &env)
{
CORBA::Boolean continue_decoding = CORBA::B_TRUE;
- CDR *stream = (CDR *) context; // context is the CDR stream
+
+ // Context is the CDR stream.
+ CDR *stream = (CDR *) context;
CORBA::TypeCode::traverse_status retval = CORBA::TypeCode::TRAVERSE_CONTINUE;
CORBA::String type_hint;
@@ -572,98 +580,100 @@ TAO_Marshal_ObjRef::decode (CORBA::TypeCode_ptr,
type_hint = 0;
}
else
- {
- while (profiles-- != 0 && continue_decoding)
- {
- CORBA::ULong tmp;
-
- // get the profile ID tag
- stream->get_ulong (tmp);
-
- if (tmp != TAO_IOP_TAG_INTERNET_IOP || objdata != 0)
- {
- continue_decoding = stream->skip_string ();
- continue;
- }
-
- // OK, we've got an IIOP profile. It's going to be
- // encapsulated ProfileData. Create a new decoding stream
- // and context for it, and tell the "parent" stream that
- // this data isn't part of it any more.
-
- // ProfileData is encoded as a sequence of octet. So first get the
- // length of the sequence
- char* buf;
- continue_decoding = stream->get_encapsulation (buf, tmp);
- assert (continue_decoding == CORBA::B_TRUE);
-
- // Create the decoding stream from the encapsulation in
- // the buffer, and skip the encapsulation.
- CDR str;
-
- str.setup_encapsulation (ACE_reinterpret_cast(char*,buf), tmp);
-
- // @@ (CJC) Does IIOP_Object duplicate 'type_hint' below so that
- // we can safely free it? It does now!
- objdata = new IIOP_Object (type_hint);
-
- // @@ (coryan) The IIOP_Object created here has a String_var
- // member to keep the string, this member is constructed
- // using type_hint, at that time a plain (char*). Hence the
- // string is *not* copied and it cannot be released, so the
- // following line is commented out:
- // CORBA::string_free (type_hint);
-
- IIOP::Profile *profile = &objdata->profile;
-
- // Read and verify major, minor versions, ignoring IIOP
- // profiles whose versions we don't understand.
- //
- // XXX this doesn't actually go back and skip the whole
- // encapsulation...
- if (! (str.get_octet (profile->iiop_version.major)
- && profile->iiop_version.major == IIOP::MY_MAJOR
- && str.get_octet (profile->iiop_version.minor)
- && profile->iiop_version.minor <= IIOP::MY_MINOR))
- {
- dmsg2 ("detected new v%d.%d IIOP profile",
- profile->iiop_version.major,
- profile->iiop_version.minor);
- objdata->type_id = (const char *) 0;
- objdata->Release ();
- objdata = 0;
- continue;
- }
+ while (profiles-- != 0 && continue_decoding)
+ {
+ CORBA::ULong tmp;
+
+ // get the profile ID tag
+ stream->get_ulong (tmp);
+
+ if (tmp != TAO_IOP_TAG_INTERNET_IOP || objdata != 0)
+ {
+ continue_decoding = stream->skip_string ();
+ continue;
+ }
+
+ // OK, we've got an IIOP profile. It's going to be
+ // encapsulated ProfileData. Create a new decoding stream and
+ // context for it, and tell the "parent" stream that this data
+ // isn't part of it any more.
+
+ // ProfileData is encoded as a sequence of octet. So first get
+ // the length of the sequence.
+ char* buf;
+ continue_decoding = stream->get_encapsulation (buf, tmp);
+ assert (continue_decoding == CORBA::B_TRUE);
+
+ // Create the decoding stream from the encapsulation in the
+ // buffer, and skip the encapsulation.
+ CDR str;
+
+ str.setup_encapsulation (ACE_reinterpret_cast(char*,buf), tmp);
+
+ // @@ (CJC) Does IIOP_Object duplicate 'type_hint' below so
+ // that we can safely free it? It does now!
+ ACE_NEW_RETURN (objdata,
+ IIOP_Object (type_hint),
+ CORBA::TypeCode::TRAVERSE_STOP);
+
+ // @@ (coryan) The IIOP_Object created here has a String_var
+ // member to keep the string, this member is constructed using
+ // type_hint, at that time a plain (char*). Hence the string
+ // is *not* copied and it cannot be released, so the following
+ // line is commented out: CORBA::string_free (type_hint);
+
+ IIOP::Profile *profile = &objdata->profile;
+
+ // Read and verify major, minor versions, ignoring IIOP
+ // profiles whose versions we don't understand.
+ //
+ // XXX this doesn't actually go back and skip the whole
+ // encapsulation...
+ if (!(str.get_octet (profile->iiop_version.major)
+ && profile->iiop_version.major == IIOP::MY_MAJOR
+ && str.get_octet (profile->iiop_version.minor)
+ && profile->iiop_version.minor <= IIOP::MY_MINOR))
+ {
+ dmsg2 ("detected new v%d.%d IIOP profile",
+ profile->iiop_version.major,
+ profile->iiop_version.minor);
+ objdata->type_id = (const char *) 0;
+ objdata->Release ();
+ objdata = 0;
+ continue;
+ }
+
+ // Get host and port
+ if (str.decode (CORBA::_tc_string,
+ &profile->host,
+ 0,
+ env) != CORBA::TypeCode::TRAVERSE_CONTINUE
+ || !str.get_ushort (profile->port))
+ {
+ env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE));
+ dmsg ("error decoding IIOP host/port");
+ objdata->Release ();
+ return CORBA::TypeCode::TRAVERSE_STOP;
+ }
- // Get host and port
- if (str.decode (CORBA::_tc_string, &profile->host, 0, env)
- != CORBA::TypeCode::TRAVERSE_CONTINUE
- || !str.get_ushort (profile->port))
- {
- env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE));
- dmsg ("error decoding IIOP host/port");
- objdata->Release ();
- return CORBA::TypeCode::TRAVERSE_STOP;
- }
+ profile->object_addr (0);
- profile->object_addr (0);
+ // ... and object key.
- // ... and object key
+ continue_decoding = str.decode (&TC_opaque,
+ &profile->object_key,
+ 0,
+ env) == CORBA::TypeCode::TRAVERSE_CONTINUE;
- continue_decoding = str.decode (&TC_opaque,
- &profile->object_key,
- 0,
- env) == CORBA::TypeCode::TRAVERSE_CONTINUE;
+ if (str.length () != 0)
+ {
+ env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE));
+ dmsg ("extra data at end of IIOP profile data");
+ objdata->Release ();
+ return CORBA::TypeCode::TRAVERSE_STOP;
+ }
+ }
- if (str.length () != 0)
- {
- env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE));
- dmsg ("extra data at end of IIOP profile data");
- objdata->Release ();
- return CORBA::TypeCode::TRAVERSE_STOP;
- }
- }
- }
if (objdata == 0)
{
env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE));
@@ -675,7 +685,12 @@ TAO_Marshal_ObjRef::decode (CORBA::TypeCode_ptr,
{
// Create a new CORBA_Object and give it the IIOP_Object just
// created.
- CORBA_Object *corba_proxy = new CORBA_Object (objdata);
+ CORBA_Object *corba_proxy;
+
+ ACE_NEW_RETURN (corba_proxy,
+ CORBA_Object (objdata),
+ CORBA::TypeCode::TRAVERSE_CONTINUE);
+
if (corba_proxy)
*(CORBA_Object **)data = corba_proxy;
else
@@ -692,7 +707,7 @@ TAO_Marshal_ObjRef::decode (CORBA::TypeCode_ptr,
}
}
-// decode structs
+// Decode structs.
CORBA::TypeCode::traverse_status
TAO_Marshal_Struct::decode (CORBA::TypeCode_ptr tc,
const void *data,
@@ -701,104 +716,110 @@ TAO_Marshal_Struct::decode (CORBA::TypeCode_ptr tc,
CORBA::Environment &env)
{
CDR *stream = (CDR *) context;
- CORBA::TypeCode::traverse_status retval = CORBA::TypeCode::TRAVERSE_CONTINUE;
+ CORBA::TypeCode::traverse_status retval =
+ CORBA::TypeCode::TRAVERSE_CONTINUE;
CORBA::Boolean continue_decoding = CORBA::B_TRUE;
CORBA::TypeCode_ptr param;
CORBA::Long size, alignment, align_offset;
void *start_addr = (void *)data;
- // number of fields in the struct
+ // Number of fields in the struct.
int member_count = tc->member_count (env);
if (env.exception () == 0)
- {
- for (int i = 0; i < member_count
- && retval == CORBA::TypeCode::TRAVERSE_CONTINUE
- && continue_decoding == CORBA::B_TRUE;
- i++)
- {
- param = tc->member_type (i, env);
- if (env.exception () == 0)
- {
- size = param->size (env);
- if (env.exception () == 0)
- {
- alignment = param->alignment (env);
- if (env.exception () == 0)
- {
- align_offset =
- (ptr_arith_t) ptr_align_binary (data, alignment)
- - (ptr_arith_t) data
- + (ptr_arith_t) ptr_align_binary (start_addr, alignment)
- - (ptr_arith_t) start_addr;
- // if both the start_addr and data are not aligned as per
- // the alignment, we do not add the offset
- data = (const void *) ((ptr_arith_t) data +
- ((align_offset == alignment) ?
- 0 : align_offset));
- switch (param->kind_)
- {
- case CORBA::tk_null:
- case CORBA::tk_void:
- break;
- case CORBA::tk_short:
- case CORBA::tk_ushort:
- continue_decoding = stream->get_short (*(CORBA::Short *) data);
- break;
- case CORBA::tk_long:
- case CORBA::tk_ulong:
- case CORBA::tk_float:
- case CORBA::tk_enum:
- continue_decoding = stream->get_long (*(CORBA::Long *) data);
- break;
- case CORBA::tk_double:
- case CORBA::tk_longlong:
- case CORBA::tk_ulonglong:
- continue_decoding = stream->get_longlong (*(CORBA::LongLong *) data);
- break;
- case CORBA::tk_boolean:
- continue_decoding = stream->get_boolean (*(CORBA::Boolean *) data);
- break;
- case CORBA::tk_char:
- case CORBA::tk_octet:
- continue_decoding = stream->get_char (*(CORBA::Char *) data);
- break;
- case CORBA::tk_longdouble:
- continue_decoding = stream->get_longdouble (*(CORBA::LongDouble *) data);
- break;
- case CORBA::tk_wchar:
- continue_decoding = stream->get_wchar (*(CORBA::WChar *) data);
- break;
- case CORBA::tk_string:
- case CORBA::tk_wstring:
- case CORBA::tk_any:
- case CORBA::tk_TypeCode:
- case CORBA::tk_Principal:
- case CORBA::tk_objref:
- case CORBA::tk_struct:
- case CORBA::tk_union:
- case CORBA::tk_sequence:
- case CORBA::tk_array:
- case CORBA::tk_alias:
- case CORBA::tk_except:
- retval = stream->decode (param, data, 0, env);
- break;
- default:
- break;
- }
- data = (char *) data + size;
- }
- else
- return CORBA::TypeCode::TRAVERSE_STOP;
- }
- else
- return CORBA::TypeCode::TRAVERSE_STOP;
- }
- else
- return CORBA::TypeCode::TRAVERSE_STOP;
- }
- }
+ for (int i = 0; i < member_count
+ && retval == CORBA::TypeCode::TRAVERSE_CONTINUE
+ && continue_decoding == CORBA::B_TRUE;
+ i++)
+ {
+ param = tc->member_type (i, env);
+ if (env.exception () == 0)
+ {
+ size = param->size (env);
+ if (env.exception () == 0)
+ {
+ alignment = param->alignment (env);
+ if (env.exception () == 0)
+ {
+ align_offset =
+ (ptr_arith_t) ptr_align_binary (data, alignment)
+ - (ptr_arith_t) data
+ + (ptr_arith_t) ptr_align_binary (start_addr, alignment)
+ - (ptr_arith_t) start_addr;
+ // if both the start_addr and data are not aligned as per
+ // the alignment, we do not add the offset
+ data = (const void *) ((ptr_arith_t) data +
+ ((align_offset == alignment) ?
+ 0 : align_offset));
+ switch (param->kind_)
+ {
+ case CORBA::tk_null:
+ case CORBA::tk_void:
+ break;
+ case CORBA::tk_short:
+ case CORBA::tk_ushort:
+ continue_decoding =
+ stream->get_short (*(CORBA::Short *) data);
+ break;
+ case CORBA::tk_long:
+ case CORBA::tk_ulong:
+ case CORBA::tk_float:
+ case CORBA::tk_enum:
+ continue_decoding =
+ stream->get_long (*(CORBA::Long *) data);
+ break;
+ case CORBA::tk_double:
+ case CORBA::tk_longlong:
+ case CORBA::tk_ulonglong:
+ continue_decoding =
+ stream->get_longlong (*(CORBA::LongLong *) data);
+ break;
+ case CORBA::tk_boolean:
+ continue_decoding =
+ stream->get_boolean (*(CORBA::Boolean *) data);
+ break;
+ case CORBA::tk_char:
+ case CORBA::tk_octet:
+ continue_decoding =
+ stream->get_char (*(CORBA::Char *) data);
+ break;
+ case CORBA::tk_longdouble:
+ continue_decoding =
+ stream->get_longdouble (*(CORBA::LongDouble *) data);
+ break;
+ case CORBA::tk_wchar:
+ continue_decoding =
+ stream->get_wchar (*(CORBA::WChar *) data);
+ break;
+ case CORBA::tk_string:
+ case CORBA::tk_wstring:
+ case CORBA::tk_any:
+ case CORBA::tk_TypeCode:
+ case CORBA::tk_Principal:
+ case CORBA::tk_objref:
+ case CORBA::tk_struct:
+ case CORBA::tk_union:
+ case CORBA::tk_sequence:
+ case CORBA::tk_array:
+ case CORBA::tk_alias:
+ case CORBA::tk_except:
+ retval = stream->decode (param, data, 0, env);
+ break;
+ default:
+ break;
+ }
+ data = (char *) data + size;
+ }
+ else
+ return CORBA::TypeCode::TRAVERSE_STOP;
+ }
+ else
+ return CORBA::TypeCode::TRAVERSE_STOP;
+ }
+ else
+ return CORBA::TypeCode::TRAVERSE_STOP;
+ }
else
return CORBA::TypeCode::TRAVERSE_STOP;
@@ -813,7 +834,7 @@ TAO_Marshal_Struct::decode (CORBA::TypeCode_ptr tc,
}
}
-// encode unions
+// Encode unions.
CORBA::TypeCode::traverse_status
TAO_Marshal_Union::decode (CORBA::TypeCode_ptr tc,
const void *data,
@@ -821,8 +842,11 @@ TAO_Marshal_Union::decode (CORBA::TypeCode_ptr tc,
void *context,
CORBA::Environment &env)
{
- CDR *stream = (CDR *) context; // context is the CDR stream
- CORBA::TypeCode::traverse_status retval = CORBA::TypeCode::TRAVERSE_CONTINUE;
+ // Context is the CDR stream.
+ CDR *stream = (CDR *) context;
+
+ CORBA::TypeCode::traverse_status retval =
+ CORBA::TypeCode::TRAVERSE_CONTINUE;
CORBA::TypeCode_ptr discrim_tc;
CORBA::TypeCode_ptr member_tc;
@@ -978,7 +1002,8 @@ TAO_Marshal_String::decode (CORBA::TypeCode_ptr,
CORBA::Environment &env)
{
CORBA::Boolean continue_decoding = CORBA::B_TRUE;
- CDR *stream = (CDR *) context; // context is the CDR stream
+ // Context is the CDR stream.
+ CDR *stream = (CDR *) context;
CORBA::ULong len = 0;
CORBA::String str;
@@ -993,11 +1018,12 @@ TAO_Marshal_String::decode (CORBA::TypeCode_ptr,
continue_decoding = stream->get_ulong (len);
if (len != 0)
{
- // note that the encoded length is 1 more than the length of the string
- // because it also accounts for the terminating NULL character
+ // Note that the encoded length is 1 more than the length of the
+ // string because it also accounts for the terminating NULL
+ // character.
str = (*(char **) data) = CORBA::string_alloc (len - 1);
- // only allocate the string *after* the length was validated.
+ // Only allocate the string *after* the length was validated.
#if 0
while (continue_decoding != CORBA::B_FALSE && len-- != 0)
@@ -1018,7 +1044,8 @@ TAO_Marshal_String::decode (CORBA::TypeCode_ptr,
}
}
-// decode sequence
+// Decode sequence.
+
CORBA::TypeCode::traverse_status
TAO_Marshal_Sequence::decode (CORBA::TypeCode_ptr tc,
const void *data,
@@ -1029,12 +1056,14 @@ TAO_Marshal_Sequence::decode (CORBA::TypeCode_ptr tc,
CORBA::Boolean continue_decoding = CORBA::B_TRUE;
CDR *stream = (CDR *) context;
TAO_Base_Sequence *seq = (TAO_Base_Sequence *)data;
-
+ // Return status.
CORBA::TypeCode::traverse_status retval =
- CORBA::TypeCode::TRAVERSE_CONTINUE; // return status
- CORBA::TypeCode_ptr tc2; // typecode of the element
- size_t size; // size of element
- CORBA::ULong bounds;
+ CORBA::TypeCode::TRAVERSE_CONTINUE;
+ // Typecode of the element.
+ CORBA::TypeCode_ptr tc2;
+ // Size of element.
+ size_t size;
+ CORBA::ULong bounds;
char *value;
// First unmarshal the sequence length ... we trust it to be right
@@ -1048,10 +1077,10 @@ TAO_Marshal_Sequence::decode (CORBA::TypeCode_ptr tc,
if (continue_decoding)
{
- // no point decoding an empty sequence
+ // No point decoding an empty sequence.
if (seq->length_ > 0)
{
- // get element typecode
+ // Get element typecode.
tc2 = tc->content_type (env);
if (env.exception () == 0)
@@ -1065,10 +1094,9 @@ TAO_Marshal_Sequence::decode (CORBA::TypeCode_ptr tc,
// Allocate the buffer using the virtual
// _allocate_buffer method, hence the right
// constructors are invoked and size for the array
- // is OK.
- // @@ Who will free this memory?
- // (coryan): the sequence will release it, since its
- // release_ field is 1.
+ // is OK. @@ Who will free this memory? (coryan):
+ // the sequence will release it, since its release_
+ // field is 1.
seq->_allocate_buffer (bounds);
value = (char *) seq->buffer_;
@@ -1096,23 +1124,25 @@ TAO_Marshal_Sequence::decode (CORBA::TypeCode_ptr tc,
// For primitives, compute the size only once
while (bounds-- && continue_decoding == CORBA::B_TRUE)
{
- continue_decoding = stream->get_long (*(CORBA::Long *) value);
+ continue_decoding =
+ stream->get_long (*(CORBA::Long *) value);
value += size;
}
- // CORBA::release (tc2);
- if (continue_decoding == CORBA::B_TRUE)
- return CORBA::TypeCode::TRAVERSE_CONTINUE;
- break;
+ // CORBA::release (tc2);
+ if (continue_decoding == CORBA::B_TRUE)
+ return CORBA::TypeCode::TRAVERSE_CONTINUE;
+ break;
case CORBA::tk_double:
case CORBA::tk_longlong:
case CORBA::tk_ulonglong:
// For primitives, compute the size only once
while (bounds-- && continue_decoding == CORBA::B_TRUE)
{
- continue_decoding = stream->get_longlong (*(CORBA::LongLong *) value);
+ continue_decoding =
+ stream->get_longlong (*(CORBA::LongLong *) value);
value += size;
}
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
if (continue_decoding == CORBA::B_TRUE)
return CORBA::TypeCode::TRAVERSE_CONTINUE;
break;
@@ -1120,10 +1150,11 @@ TAO_Marshal_Sequence::decode (CORBA::TypeCode_ptr tc,
// For primitives, compute the size only once
while (bounds-- && continue_decoding == CORBA::B_TRUE)
{
- continue_decoding = stream->get_boolean (*(CORBA::Boolean *) value);
+ continue_decoding =
+ stream->get_boolean (*(CORBA::Boolean *) value);
value += size;
}
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
if (continue_decoding == CORBA::B_TRUE)
return CORBA::TypeCode::TRAVERSE_CONTINUE;
break;
@@ -1132,10 +1163,11 @@ TAO_Marshal_Sequence::decode (CORBA::TypeCode_ptr tc,
// For primitives, compute the size only once
while (bounds-- && continue_decoding == CORBA::B_TRUE)
{
- continue_decoding = stream->get_char (*(CORBA::Char *) value);
+ continue_decoding =
+ stream->get_char (*(CORBA::Char *) value);
value += size;
}
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
if (continue_decoding == CORBA::B_TRUE)
return CORBA::TypeCode::TRAVERSE_CONTINUE;
break;
@@ -1143,10 +1175,11 @@ TAO_Marshal_Sequence::decode (CORBA::TypeCode_ptr tc,
// For primitives, compute the size only once
while (bounds-- && continue_decoding == CORBA::B_TRUE)
{
- continue_decoding = stream->get_longdouble (*(CORBA::LongDouble *) value);
+ continue_decoding =
+ stream->get_longdouble (*(CORBA::LongDouble *) value);
value += size;
}
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
if (continue_decoding == CORBA::B_TRUE)
return CORBA::TypeCode::TRAVERSE_CONTINUE;
break;
@@ -1154,10 +1187,11 @@ TAO_Marshal_Sequence::decode (CORBA::TypeCode_ptr tc,
// For primitives, compute the size only once
while (bounds-- && continue_decoding == CORBA::B_TRUE)
{
- continue_decoding = stream->get_wchar (*(CORBA::WChar *) value);
+ continue_decoding =
+ stream->get_wchar (*(CORBA::WChar *) value);
value += size;
}
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
if (continue_decoding == CORBA::B_TRUE)
return CORBA::TypeCode::TRAVERSE_CONTINUE;
break;
@@ -1165,11 +1199,12 @@ TAO_Marshal_Sequence::decode (CORBA::TypeCode_ptr tc,
// For primitives, compute the size only once
while (bounds-- && continue_decoding == CORBA::B_TRUE)
{
- continue_decoding = stream->get_long (*(CORBA::Long *) value);
+ continue_decoding =
+ stream->get_long (*(CORBA::Long *) value);
value += size;
}
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
if (continue_decoding == CORBA::B_TRUE)
return CORBA::TypeCode::TRAVERSE_CONTINUE;
break;
@@ -1186,14 +1221,14 @@ TAO_Marshal_Sequence::decode (CORBA::TypeCode_ptr tc,
case CORBA::tk_array:
case CORBA::tk_alias:
case CORBA::tk_except:
- // For those aggregate types whose size is constant, we
- // compute it only once
+ // For those aggregate types whose size is
+ // constant, we compute it only once.
while (bounds-- && retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
retval = stream->decode (tc2, value, 0, env);
value += size;
}
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
return CORBA::TypeCode::TRAVERSE_CONTINUE;
break;
@@ -1212,7 +1247,8 @@ TAO_Marshal_Sequence::decode (CORBA::TypeCode_ptr tc,
return CORBA::TypeCode::TRAVERSE_STOP;
}
-// decode array
+// Decode array.
+
CORBA::TypeCode::traverse_status
TAO_Marshal_Array::decode (CORBA::TypeCode_ptr tc,
const void *data,
@@ -1222,10 +1258,16 @@ TAO_Marshal_Array::decode (CORBA::TypeCode_ptr tc,
{
CORBA::Boolean continue_decoding = CORBA::B_TRUE;
CDR *stream = (CDR *) context;
+
+ // Return status.
CORBA::TypeCode::traverse_status retval =
- CORBA::TypeCode::TRAVERSE_CONTINUE; // return status
- CORBA::TypeCode_ptr tc2; // typecode of the element
- size_t size; // size of element
+ CORBA::TypeCode::TRAVERSE_CONTINUE;
+
+ // Typecode of the element.
+ CORBA::TypeCode_ptr tc2;
+
+ // Size of element.
+ size_t size;
CORBA::ULong bounds;
char *value = (char *) data;
@@ -1248,13 +1290,15 @@ TAO_Marshal_Array::decode (CORBA::TypeCode_ptr tc,
return CORBA::TypeCode::TRAVERSE_CONTINUE;
case CORBA::tk_short:
case CORBA::tk_ushort:
+
// For primitives, compute the size only once
while (bounds-- && continue_decoding == CORBA::B_TRUE)
{
- continue_decoding = stream->get_short (*(CORBA::Short *) value);
+ continue_decoding =
+ stream->get_short (*(CORBA::Short *) value);
value += size;
}
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
if (continue_decoding == CORBA::B_TRUE)
return CORBA::TypeCode::TRAVERSE_CONTINUE;
break;
@@ -1264,10 +1308,11 @@ TAO_Marshal_Array::decode (CORBA::TypeCode_ptr tc,
// For primitives, compute the size only once
while (bounds-- && continue_decoding == CORBA::B_TRUE)
{
- continue_decoding = stream->get_long (*(CORBA::Long *) value);
+ continue_decoding =
+ stream->get_long (*(CORBA::Long *) value);
value += size;
}
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
if (continue_decoding == CORBA::B_TRUE)
return CORBA::TypeCode::TRAVERSE_CONTINUE;
break;
@@ -1277,10 +1322,11 @@ TAO_Marshal_Array::decode (CORBA::TypeCode_ptr tc,
// For primitives, compute the size only once
while (bounds-- && continue_decoding == CORBA::B_TRUE)
{
- continue_decoding = stream->get_longlong (*(CORBA::LongLong *) value);
+ continue_decoding =
+ stream->get_longlong (*(CORBA::LongLong *) value);
value += size;
}
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
if (continue_decoding == CORBA::B_TRUE)
return CORBA::TypeCode::TRAVERSE_CONTINUE;
break;
@@ -1288,10 +1334,11 @@ TAO_Marshal_Array::decode (CORBA::TypeCode_ptr tc,
// For primitives, compute the size only once
while (bounds-- && continue_decoding == CORBA::B_TRUE)
{
- continue_decoding = stream->get_boolean (*(CORBA::Boolean *) value);
+ continue_decoding =
+ stream->get_boolean (*(CORBA::Boolean *) value);
value += size;
}
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
if (continue_decoding == CORBA::B_TRUE)
return CORBA::TypeCode::TRAVERSE_CONTINUE;
break;
@@ -1300,10 +1347,11 @@ TAO_Marshal_Array::decode (CORBA::TypeCode_ptr tc,
// For primitives, compute the size only once
while (bounds-- && continue_decoding == CORBA::B_TRUE)
{
- continue_decoding = stream->get_char (*(CORBA::Char *) value);
+ continue_decoding =
+ stream->get_char (*(CORBA::Char *) value);
value += size;
}
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
if (continue_decoding == CORBA::B_TRUE)
return CORBA::TypeCode::TRAVERSE_CONTINUE;
break;
@@ -1311,10 +1359,11 @@ TAO_Marshal_Array::decode (CORBA::TypeCode_ptr tc,
// For primitives, compute the size only once
while (bounds-- && continue_decoding == CORBA::B_TRUE)
{
- continue_decoding = stream->get_longdouble (*(CORBA::LongDouble *) value);
+ continue_decoding =
+ stream->get_longdouble (*(CORBA::LongDouble *) value);
value += size;
}
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
if (continue_decoding == CORBA::B_TRUE)
return CORBA::TypeCode::TRAVERSE_CONTINUE;
break;
@@ -1322,10 +1371,11 @@ TAO_Marshal_Array::decode (CORBA::TypeCode_ptr tc,
// For primitives, compute the size only once
while (bounds-- && continue_decoding == CORBA::B_TRUE)
{
- continue_decoding = stream->get_wchar (*(CORBA::WChar *) value);
+ continue_decoding =
+ stream->get_wchar (*(CORBA::WChar *) value);
value += size;
}
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
if (continue_decoding == CORBA::B_TRUE)
return CORBA::TypeCode::TRAVERSE_CONTINUE;
break;
@@ -1333,10 +1383,11 @@ TAO_Marshal_Array::decode (CORBA::TypeCode_ptr tc,
// For primitives, compute the size only once
while (bounds-- && continue_decoding == CORBA::B_TRUE)
{
- continue_decoding = stream->get_long (*(CORBA::Long *) value);
+ continue_decoding =
+ stream->get_long (*(CORBA::Long *) value);
value += size;
}
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
if (continue_decoding == CORBA::B_TRUE)
return CORBA::TypeCode::TRAVERSE_CONTINUE;
break;
@@ -1360,7 +1411,7 @@ TAO_Marshal_Array::decode (CORBA::TypeCode_ptr tc,
retval = stream->decode (tc2, value, 0, env);
value += size;
}
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
return CORBA::TypeCode::TRAVERSE_CONTINUE;
break;
@@ -1376,7 +1427,7 @@ TAO_Marshal_Array::decode (CORBA::TypeCode_ptr tc,
return CORBA::TypeCode::TRAVERSE_STOP;
}
-// decode alias
+// Decode alias.
CORBA::TypeCode::traverse_status
TAO_Marshal_Alias::decode (CORBA::TypeCode_ptr tc,
const void *data,
@@ -1384,18 +1435,23 @@ TAO_Marshal_Alias::decode (CORBA::TypeCode_ptr tc,
void *context,
CORBA::Environment &env)
{
- CORBA::TypeCode_ptr tc2; // typecode of the aliased type
+ // Typecode of the aliased type.
+ CORBA::TypeCode_ptr tc2;
CORBA::Boolean continue_decoding = CORBA::B_TRUE;
- CDR *stream = (CDR *) context; // context is the CDR stream
- CORBA::TypeCode::traverse_status retval =
- CORBA::TypeCode::TRAVERSE_CONTINUE; // status of decode operation
+
+ // Context is the CDR stream.
+ CDR *stream = (CDR *) context;
+
+ // Status of decode operation.
+ CORBA::TypeCode::traverse_status retval =
+ CORBA::TypeCode::TRAVERSE_CONTINUE;
char *value = (char *) data;
tc2 = tc->content_type (env);
if (env.exception () == 0)
{
- // switch on the data type and handle the cases for primitives here for
- // efficiency rather than calling
+ // Switch on the data type and handle the cases for primitives
+ // here for efficiency rather than calling.
switch (tc2->kind_)
{
case CORBA::tk_null:
@@ -1403,31 +1459,38 @@ TAO_Marshal_Alias::decode (CORBA::TypeCode_ptr tc,
break;
case CORBA::tk_short:
case CORBA::tk_ushort:
- continue_decoding = stream->get_short (*(CORBA::Short *) value);
+ continue_decoding =
+ stream->get_short (*(CORBA::Short *) value);
break;
case CORBA::tk_long:
case CORBA::tk_ulong:
case CORBA::tk_float:
case CORBA::tk_enum:
- continue_decoding = stream->get_long (*(CORBA::Long *) value);
+ continue_decoding =
+ stream->get_long (*(CORBA::Long *) value);
break;
case CORBA::tk_double:
case CORBA::tk_longlong:
case CORBA::tk_ulonglong:
- continue_decoding = stream->get_longlong (*(CORBA::LongLong *) value);
+ continue_decoding =
+ stream->get_longlong (*(CORBA::LongLong *) value);
break;
case CORBA::tk_boolean:
- continue_decoding = stream->get_boolean (*(CORBA::Boolean *) value);
+ continue_decoding =
+ stream->get_boolean (*(CORBA::Boolean *) value);
break;
case CORBA::tk_char:
case CORBA::tk_octet:
- continue_decoding = stream->get_char (*(CORBA::Char *) value);
+ continue_decoding =
+ stream->get_char (*(CORBA::Char *) value);
break;
case CORBA::tk_longdouble:
- continue_decoding = stream->get_longdouble (*(CORBA::LongDouble *) value);
+ continue_decoding =
+ stream->get_longdouble (*(CORBA::LongDouble *) value);
break;
case CORBA::tk_wchar:
- continue_decoding = stream->get_wchar (*(CORBA::WChar *) value);
+ continue_decoding =
+ stream->get_wchar (*(CORBA::WChar *) value);
break;
case CORBA::tk_string:
case CORBA::tk_wstring:
@@ -1460,29 +1523,30 @@ TAO_Marshal_Alias::decode (CORBA::TypeCode_ptr tc,
}
}
-// decode exception For exceptions, the "hidden" type ID near the
+// Decode exception For exceptions, the "hidden" type ID near the
// front of the on-wire representation was previously unmarshaled and
// mapped to the "tc" typcode we're using to traverse the memory ...
// at the same time its vtable, refcount, and other state was
// established.
//
-// NOTE: This is asymmetric with respect to encoding exceptions.
+// NOTE: This is asymmetric with respect to encoding exceptions.
CORBA::TypeCode::traverse_status
TAO_Marshal_Except::decode (CORBA::TypeCode_ptr tc,
const void *data,
const void *,
void *context,
- CORBA::Environment &env)
+ CORBA::Environment &env)
{
CDR *stream = (CDR *) context;
- CORBA::TypeCode::traverse_status retval = CORBA::TypeCode::TRAVERSE_CONTINUE;
+ CORBA::TypeCode::traverse_status retval =
+ CORBA::TypeCode::TRAVERSE_CONTINUE;
CORBA::Boolean continue_decoding = CORBA::B_TRUE;
CORBA::TypeCode_ptr param;
CORBA::Long size, alignment;
data = (char *) data + sizeof (CORBA::Exception);
- // number of fields in the struct
+ // Number of fields in the struct.
int member_count = tc->member_count (env);
if (env.exception () == 0)
{
@@ -1507,31 +1571,38 @@ TAO_Marshal_Except::decode (CORBA::TypeCode_ptr tc,
break;
case CORBA::tk_short:
case CORBA::tk_ushort:
- continue_decoding = stream->get_short (*(CORBA::Short *) data);
+ continue_decoding =
+ stream->get_short (*(CORBA::Short *) data);
break;
case CORBA::tk_long:
case CORBA::tk_ulong:
case CORBA::tk_float:
case CORBA::tk_enum:
- continue_decoding = stream->get_long (*(CORBA::Long *) data);
+ continue_decoding =
+ stream->get_long (*(CORBA::Long *) data);
break;
case CORBA::tk_double:
case CORBA::tk_longlong:
case CORBA::tk_ulonglong:
- continue_decoding = stream->get_longlong (*(CORBA::LongLong *) data);
+ continue_decoding =
+ stream->get_longlong (*(CORBA::LongLong *) data);
break;
case CORBA::tk_boolean:
- continue_decoding = stream->get_boolean (*(CORBA::Boolean *) data);
+ continue_decoding =
+ stream->get_boolean (*(CORBA::Boolean *) data);
break;
case CORBA::tk_char:
case CORBA::tk_octet:
- continue_decoding = stream->get_char (*(CORBA::Char *) data);
+ continue_decoding =
+ stream->get_char (*(CORBA::Char *) data);
break;
case CORBA::tk_longdouble:
- continue_decoding = stream->get_longdouble (*(CORBA::LongDouble *) data);
+ continue_decoding =
+ stream->get_longdouble (*(CORBA::LongDouble *) data);
break;
case CORBA::tk_wchar:
- continue_decoding = stream->get_wchar (*(CORBA::WChar *) data);
+ continue_decoding =
+ stream->get_wchar (*(CORBA::WChar *) data);
break;
case CORBA::tk_any:
case CORBA::tk_TypeCode:
@@ -1599,7 +1670,10 @@ TAO_Marshal_WString::decode (CORBA::TypeCode_ptr,
continue_decoding = stream->get_ulong (len);
- *((CORBA::WChar **) data) = str = new CORBA::WChar [(size_t) (len)];
+ ACE_NEW_RETURN (str,
+ CORBA::WChar [(size_t) (len)],
+ CORBA::TypeCode::TRAVERSE_CONTINUE);
+ *((CORBA::WChar **) data) = str;
if (len != 0)
while (continue_decoding != CORBA::B_FALSE && len--)
@@ -1609,7 +1683,7 @@ TAO_Marshal_WString::decode (CORBA::TypeCode_ptr,
}
if (continue_decoding == CORBA::B_TRUE)
- return CORBA::TypeCode::TRAVERSE_CONTINUE;
+ return CORBA::TypeCode::TRAVERSE_CONTINUE;
else
{
env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE));
diff --git a/TAO/tao/deep_copy.cpp b/TAO/tao/deep_copy.cpp
index 00b199cf777..0f77c2fe7ff 100644
--- a/TAO/tao/deep_copy.cpp
+++ b/TAO/tao/deep_copy.cpp
@@ -12,7 +12,6 @@
// traverse to interpret the data types. This version defines a static method
// "deep_copy" on each class and avoids calling traverse.
//
-//
// Helper routine for "Any" copy constructor ...
//
// "Deep Copy" from source to dest. Memory is always there to be
@@ -40,7 +39,8 @@ DEEP_COPY (CORBA::TypeCode_ptr param,
const void *dest,
CORBA::Environment &env)
{
- CORBA::TypeCode::traverse_status retval = CORBA::TypeCode::TRAVERSE_CONTINUE;
+ CORBA::TypeCode::traverse_status retval =
+ CORBA::TypeCode::TRAVERSE_CONTINUE;
switch (param->kind_)
{
@@ -198,9 +198,15 @@ TAO_Marshal_Principal::deep_copy (CORBA::TypeCode_ptr tc,
{
if (tc)
{
- CORBA::Principal_ptr src = *(CORBA::Principal_ptr *) source;
- CORBA::Principal_ptr dst = *(CORBA::Principal_ptr *) dest = new CORBA::Principal;
-
+ CORBA::Principal_ptr src =
+ *(CORBA::Principal_ptr *) source;
+
+ ACE_NEW_RETURN (*(CORBA::Principal_ptr *) dest,
+ CORBA::Principal,
+ CORBA::TypeCode::TRAVERSE_STOP);
+
+ CORBA::Principal_ptr dst = *(CORBA::Principal_ptr *) dest;
+
if (dst)
{
// Principals are just opaque IDs ... copy them
@@ -209,7 +215,9 @@ TAO_Marshal_Principal::deep_copy (CORBA::TypeCode_ptr tc,
if (dst->id.length > 0)
{
- dst->id.buffer = new CORBA::Octet [(u_int) dst->id.length];
+ ACE_NEW_RETURN (dst->id.buffer,
+ CORBA::Octet [(u_int) dst->id.length],
+ CORBA::TypeCode::TRAVERSE_STOP);
if (dst->id.buffer)
{
ACE_OS::memcpy (dst->id.buffer,
@@ -239,13 +247,14 @@ TAO_Marshal_Principal::deep_copy (CORBA::TypeCode_ptr tc,
}
else
{
- env.exception (new CORBA::BAD_TYPECODE (CORBA::COMPLETED_MAYBE) );
+ env.exception (new CORBA::BAD_TYPECODE (CORBA::COMPLETED_MAYBE) );
dmsg ("TAO_Marshal_Primitive::deep_copy detected error");
return CORBA::TypeCode::TRAVERSE_STOP;
}
}
-// deep_copy structs
+// Deep_copy structs.
+
CORBA::TypeCode::traverse_status
TAO_Marshal_Struct::deep_copy (CORBA::TypeCode_ptr tc,
const void *source,
@@ -262,22 +271,23 @@ TAO_Marshal_Struct::deep_copy (CORBA::TypeCode_ptr tc,
CORBA::TypeCode::traverse_status retval =
CORBA::TypeCode::TRAVERSE_CONTINUE;
- for (int i = 0; i < member_count
- && retval == CORBA::TypeCode::TRAVERSE_CONTINUE;
+ for (int i = 0;
+ i < member_count && retval == CORBA::TypeCode::TRAVERSE_CONTINUE;
i++)
{
- // get the typecode for the ith field
- CORBA::TypeCode_ptr param = tc->member_type (i, env);
+ // Get the typecode for the ith field.
+ CORBA::TypeCode_ptr param =
+ tc->member_type (i, env);
if (env.exception () == 0)
{
- // get the size of the field
+ // Get the size of the field.
CORBA::Long size = param->size (env);
if (env.exception () == 0)
{
// get the alignment of the field
-#if defined(TAO_NEEDS_UNUSED_VARIABLES)
+#if defined (TAO_NEEDS_UNUSED_VARIABLES)
CORBA::Long alignment = param->alignment (env);
-#endif
+#endif /* TAO_NEEDS_UNUSED_VARIABLES */
if (env.exception () == 0)
{
switch (param->kind_)
@@ -287,31 +297,38 @@ TAO_Marshal_Struct::deep_copy (CORBA::TypeCode_ptr tc,
break;
case CORBA::tk_short:
case CORBA::tk_ushort:
- *(CORBA::Short *) dest = *(CORBA::Short *) source;
+ *(CORBA::Short *) dest =
+ *(CORBA::Short *) source;
break;
case CORBA::tk_long:
case CORBA::tk_ulong:
case CORBA::tk_float:
case CORBA::tk_enum:
- *(CORBA::Long *) dest = *(CORBA::Long *) source;
+ *(CORBA::Long *) dest =
+ *(CORBA::Long *) source;
break;
case CORBA::tk_double:
case CORBA::tk_longlong:
case CORBA::tk_ulonglong:
- *(CORBA::LongLong *) dest = *(CORBA::LongLong *) source;
+ *(CORBA::LongLong *) dest =
+ *(CORBA::LongLong *) source;
break;
case CORBA::tk_boolean:
- *(CORBA::Boolean *) dest = *(CORBA::Boolean *) source;
+ *(CORBA::Boolean *) dest =
+ *(CORBA::Boolean *) source;
break;
case CORBA::tk_char:
case CORBA::tk_octet:
- *(CORBA::Char *) dest = *(CORBA::Char *) source;
+ *(CORBA::Char *) dest =
+ *(CORBA::Char *) source;
break;
case CORBA::tk_longdouble:
- *(CORBA::LongDouble *) dest = *(CORBA::LongDouble *) source;
+ *(CORBA::LongDouble *) dest =
+ *(CORBA::LongDouble *) source;
break;
case CORBA::tk_wchar:
- *(CORBA::WChar *) dest = *(CORBA::WChar *) source;
+ *(CORBA::WChar *) dest =
+ *(CORBA::WChar *) source;
break;
case CORBA::tk_any:
retval = TAO_Marshal_Any::deep_copy (param, source, dest, env);
@@ -396,9 +413,10 @@ TAO_Marshal_Struct::deep_copy (CORBA::TypeCode_ptr tc,
}
}
-// deep_copy for union
+// Deep_copy for union.
+
CORBA::TypeCode::traverse_status
-TAO_Marshal_Union::deep_copy (CORBA::TypeCode_ptr tc,
+TAO_Marshal_Union::deep_copy (CORBA::TypeCode_ptr tc,
const void *data,
const void *data2,
CORBA::Environment &env)
@@ -408,7 +426,7 @@ TAO_Marshal_Union::deep_copy (CORBA::TypeCode_ptr tc,
// Get the discriminator type.
if (env.exception () == 0)
{
- // deep_copy the discriminator value
+ // deep_copy the discriminator value.
CORBA::TypeCode::traverse_status retval =
DEEP_COPY (discrim_tc, data, data2, env);
@@ -421,25 +439,31 @@ TAO_Marshal_Union::deep_copy (CORBA::TypeCode_ptr tc,
{
CORBA::TypeCode_ptr default_tc = 0;
- const void *discrim_val = data; // save the pointer to the discriminator
- // value
+ // Save the pointer to the discriminator.
+ const void *discrim_val = data;
+
+ // value
// move the pointer to point to the actual value
data = (char *) data + discrim_size_with_pad;
data2 = (char *) data2 + discrim_size_with_pad;
- // now get ready to marshal the actual union value
+
+ // Now get ready to marshal the actual union value.
+
CORBA::Long default_index = tc->default_index (env);
if (env.exception () == 0)
{
int member_count = tc->member_count (env);
if (env.exception () == 0)
{
- // check which label value matches with the discriminator
- // value. Accordingly, marshal the corresponding
- // member_type. If none match, check if default exists
- // and marshal accordingly. Otherwise it is an error.
+ // check which label value matches with the
+ // discriminator value. Accordingly, marshal the
+ // corresponding member_type. If none match,
+ // check if default exists and marshal
+ // accordingly. Otherwise it is an error.
for (int i = 0; member_count-- != 0; i++)
{
- CORBA::Any_ptr member_label = tc->member_label (i, env);
+ CORBA::Any_ptr member_label =
+ tc->member_label (i, env);
if (env.exception () == 0)
{
CORBA::Boolean discrim_matched = CORBA::B_FALSE;
@@ -543,24 +567,34 @@ TAO_Marshal_Union::deep_copy (CORBA::TypeCode_ptr tc,
}
}
-// deep_copy for Sequence
+// Deep_copy for Sequence.
+
CORBA::TypeCode::traverse_status
TAO_Marshal_Sequence::deep_copy (CORBA::TypeCode_ptr tc,
const void *source,
const void *dest,
CORBA::Environment &env)
{
+ // Return status.
CORBA::TypeCode::traverse_status retval =
- CORBA::TypeCode::TRAVERSE_CONTINUE; // return status
- CORBA::TypeCode_ptr tc2; // typecode of the element
- size_t size; // size of element
- CORBA::ULong bounds;
- char *value1, *value2;
- CORBA::OctetSeq *src, *dst;
- CDR stream; // used only to access the marshal_object factory
+ CORBA::TypeCode::TRAVERSE_CONTINUE;
+
+ // Typecode of the element.
+ CORBA::TypeCode_ptr tc2;
- // Rely on binary format of sequences -- all are the same
- // except for the type pointed to by "buffer"
+ // Size of element.
+ size_t size;
+ CORBA::ULong bounds;
+ char *value1;
+ char *value2;
+ CORBA::OctetSeq *src;
+ CORBA::OctetSeq *dst;
+
+ // Used only to access the marshal_object factory.
+ CDR stream;
+
+ // Rely on binary format of sequences -- all are the same except for
+ // the type pointed to by "buffer."
if (tc)
{
@@ -570,18 +604,18 @@ TAO_Marshal_Sequence::deep_copy (CORBA::TypeCode_ptr tc,
assert (src->length <= UINT_MAX);
dst->length = dst->maximum = src->length;
- // get element typecode
+ // Get element typecode.
tc2 = tc->content_type (env);
if (env.exception () == 0)
{
- // get the size of the element
+ // Get the size of the element.
size = tc2->size (env);
if (env.exception () == 0)
{
- // compute the length of the sequence
+ // Compute the length of the sequence.
bounds = src->length;
- // allocate a buffer to hold the sequence
+ // Allocate a buffer to hold the sequence.
dst->buffer = new CORBA::Octet [size *(size_t) src->maximum];
if (dst->buffer)
{
@@ -592,7 +626,7 @@ TAO_Marshal_Sequence::deep_copy (CORBA::TypeCode_ptr tc,
{
case CORBA::tk_null:
case CORBA::tk_void:
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
return CORBA::TypeCode::TRAVERSE_CONTINUE;
case CORBA::tk_short:
case CORBA::tk_ushort:
@@ -617,7 +651,8 @@ TAO_Marshal_Sequence::deep_copy (CORBA::TypeCode_ptr tc,
case CORBA::tk_any:
while (bounds-- && retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
- retval = TAO_Marshal_Any::deep_copy (tc2, source, dest, env);
+ retval =
+ TAO_Marshal_Any::deep_copy (tc2, source, dest, env);
value1 = (char *) value1 + size;
value2 = (char *) value2 + size;
}
@@ -625,7 +660,8 @@ TAO_Marshal_Sequence::deep_copy (CORBA::TypeCode_ptr tc,
case CORBA::tk_TypeCode:
while (bounds-- && retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
- retval = TAO_Marshal_TypeCode::deep_copy (tc2, source, dest, env);
+ retval =
+ TAO_Marshal_TypeCode::deep_copy (tc2, source, dest, env);
value1 = (char *) value1 + size;
value2 = (char *) value2 + size;
}
@@ -633,7 +669,8 @@ TAO_Marshal_Sequence::deep_copy (CORBA::TypeCode_ptr tc,
case CORBA::tk_Principal:
while (bounds-- && retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
- retval = TAO_Marshal_Principal::deep_copy (tc2, source, dest, env);
+ retval =
+ TAO_Marshal_Principal::deep_copy (tc2, source, dest, env);
value1 = (char *) value1 + size;
value2 = (char *) value2 + size;
}
@@ -641,7 +678,8 @@ TAO_Marshal_Sequence::deep_copy (CORBA::TypeCode_ptr tc,
case CORBA::tk_objref:
while (bounds-- && retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
- retval = TAO_Marshal_ObjRef::deep_copy (tc2, source, dest, env);
+ retval =
+ TAO_Marshal_ObjRef::deep_copy (tc2, source, dest, env);
value1 = (char *) value1 + size;
value2 = (char *) value2 + size;
}
@@ -649,7 +687,8 @@ TAO_Marshal_Sequence::deep_copy (CORBA::TypeCode_ptr tc,
case CORBA::tk_struct:
while (bounds-- && retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
- retval = TAO_Marshal_Struct::deep_copy (tc2, source, dest, env);
+ retval =
+ TAO_Marshal_Struct::deep_copy (tc2, source, dest, env);
value1 = (char *) value1 + size;
value2 = (char *) value2 + size;
}
@@ -657,7 +696,8 @@ TAO_Marshal_Sequence::deep_copy (CORBA::TypeCode_ptr tc,
case CORBA::tk_union:
while (bounds-- && retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
- retval = TAO_Marshal_Union::deep_copy (tc2, source, dest, env);
+ retval =
+ TAO_Marshal_Union::deep_copy (tc2, source, dest, env);
value1 = (char *) value1 + size;
value2 = (char *) value2 + size;
}
@@ -665,16 +705,19 @@ TAO_Marshal_Sequence::deep_copy (CORBA::TypeCode_ptr tc,
case CORBA::tk_string:
while (bounds-- && retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
- retval = TAO_Marshal_Any::deep_copy (tc2, source, dest, env);
+ retval =
+ TAO_Marshal_Any::deep_copy (tc2, source, dest, env);
value1 = (char *) value1 + size;
value2 = (char *) value2 + size;
}
- retval = TAO_Marshal_String::deep_copy (tc2, source, dest, env);
+ retval =
+ TAO_Marshal_String::deep_copy (tc2, source, dest, env);
break;
case CORBA::tk_sequence:
while (bounds-- && retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
- retval = TAO_Marshal_Sequence::deep_copy (tc2, source, dest, env);
+ retval =
+ TAO_Marshal_Sequence::deep_copy (tc2, source, dest, env);
value1 = (char *) value1 + size;
value2 = (char *) value2 + size;
}
@@ -682,7 +725,8 @@ TAO_Marshal_Sequence::deep_copy (CORBA::TypeCode_ptr tc,
case CORBA::tk_array:
while (bounds-- && retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
- retval = TAO_Marshal_Array::deep_copy (tc2, source, dest, env);
+ retval =
+ TAO_Marshal_Array::deep_copy (tc2, source, dest, env);
value1 = (char *) value1 + size;
value2 = (char *) value2 + size;
}
@@ -690,7 +734,8 @@ TAO_Marshal_Sequence::deep_copy (CORBA::TypeCode_ptr tc,
case CORBA::tk_alias:
while (bounds-- && retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
- retval = TAO_Marshal_Alias::deep_copy (tc2, source, dest, env);
+ retval =
+ TAO_Marshal_Alias::deep_copy (tc2, source, dest, env);
value1 = (char *) value1 + size;
value2 = (char *) value2 + size;
}
@@ -698,7 +743,8 @@ TAO_Marshal_Sequence::deep_copy (CORBA::TypeCode_ptr tc,
case CORBA::tk_except:
while (bounds-- && retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
- retval = TAO_Marshal_Except::deep_copy (tc2, source, dest, env);
+ retval =
+ TAO_Marshal_Except::deep_copy (tc2, source, dest, env);
value1 = (char *) value1 + size;
value2 = (char *) value2 + size;
}
@@ -706,7 +752,8 @@ TAO_Marshal_Sequence::deep_copy (CORBA::TypeCode_ptr tc,
case CORBA::tk_wstring:
while (bounds-- && retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
- retval = TAO_Marshal_WString::deep_copy (tc2, source, dest, env);
+ retval =
+ TAO_Marshal_WString::deep_copy (tc2, source, dest, env);
value1 = (char *) value1 + size;
value2 = (char *) value2 + size;
}
@@ -715,7 +762,7 @@ TAO_Marshal_Sequence::deep_copy (CORBA::TypeCode_ptr tc,
retval = CORBA::TypeCode::TRAVERSE_STOP;
break;
} // end of switch
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
return CORBA::TypeCode::TRAVERSE_CONTINUE;
else
@@ -729,7 +776,7 @@ TAO_Marshal_Sequence::deep_copy (CORBA::TypeCode_ptr tc,
else
{
// error exit
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
env.exception (new CORBA::NO_MEMORY (CORBA::COMPLETED_MAYBE));
dmsg ("marshaling TAO_Marshal_Sequence::deep_copy detected error");
return CORBA::TypeCode::TRAVERSE_STOP;
@@ -737,7 +784,7 @@ TAO_Marshal_Sequence::deep_copy (CORBA::TypeCode_ptr tc,
}
else // exception computing size
{
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
dmsg ("marshaling TAO_Marshal_Sequence::deep_copy detected error");
return CORBA::TypeCode::TRAVERSE_STOP;
}
@@ -756,22 +803,30 @@ TAO_Marshal_Sequence::deep_copy (CORBA::TypeCode_ptr tc,
}
}
-// deep_copy for Array
+// Deep_copy for Array.
+
CORBA::TypeCode::traverse_status
TAO_Marshal_Array::deep_copy (CORBA::TypeCode_ptr tc,
const void *source,
const void *dest,
CORBA::Environment &env)
{
+ // Return status.
CORBA::TypeCode::traverse_status retval =
- CORBA::TypeCode::TRAVERSE_CONTINUE; // return status
- CORBA::TypeCode_ptr tc2; // typecode of the element
- size_t size; // size of element
+ CORBA::TypeCode::TRAVERSE_CONTINUE;
+
+ // Typecode of the element.
+ CORBA::TypeCode_ptr tc2;
+
+ // Size of element.
+ size_t size;
CORBA::ULong bounds;
- CDR stream; // used only to access the marshal_object factory
- // Rely on binary format of sequences -- all are the same
- // except for the type pointed to by "buffer"
+ // Used only to access the marshal_object factory.
+ CDR stream;
+
+ // Rely on binary format of sequences -- all are the same except for
+ // the type pointed to by "buffer".
if (tc)
{
@@ -782,7 +837,7 @@ TAO_Marshal_Array::deep_copy (CORBA::TypeCode_ptr tc,
tc2 = tc->content_type (env);
if (env.exception () == 0)
{
- // get the size of the element type
+ // Get the size of the element type.
size = tc2->size (env);
if (env.exception () == 0)
{
@@ -790,7 +845,7 @@ TAO_Marshal_Array::deep_copy (CORBA::TypeCode_ptr tc,
{
case CORBA::tk_null:
case CORBA::tk_void:
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
return CORBA::TypeCode::TRAVERSE_CONTINUE;
case CORBA::tk_short:
case CORBA::tk_ushort:
@@ -806,15 +861,19 @@ TAO_Marshal_Array::deep_copy (CORBA::TypeCode_ptr tc,
case CORBA::tk_longdouble:
case CORBA::tk_wchar:
case CORBA::tk_enum:
- // just do a memcpy rather than copying each element
- ACE_OS::memcpy ((char *) dest, (char *) source, size*bounds);
- // CORBA::release (tc2);
+ // Just do a memcpy rather than copying each
+ // element.
+ ACE_OS::memcpy ((char *) dest,
+ (char *) source,
+ size*bounds);
+ // CORBA::release (tc2);
return CORBA::TypeCode::TRAVERSE_CONTINUE;
// handle all aggregate types here
case CORBA::tk_any:
while (bounds-- && retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
- retval = TAO_Marshal_Any::deep_copy (tc2, source, dest, env);
+ retval =
+ TAO_Marshal_Any::deep_copy (tc2, source, dest, env);
source = (char *) source + size;
dest = (char *) dest + size;
}
@@ -822,7 +881,8 @@ TAO_Marshal_Array::deep_copy (CORBA::TypeCode_ptr tc,
case CORBA::tk_TypeCode:
while (bounds-- && retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
- retval = TAO_Marshal_TypeCode::deep_copy (tc2, source, dest, env);
+ retval =
+ TAO_Marshal_TypeCode::deep_copy (tc2, source, dest, env);
source = (char *) source + size;
dest = (char *) dest + size;
}
@@ -830,7 +890,8 @@ TAO_Marshal_Array::deep_copy (CORBA::TypeCode_ptr tc,
case CORBA::tk_Principal:
while (bounds-- && retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
- retval = TAO_Marshal_Principal::deep_copy (tc2, source, dest, env);
+ retval =
+ TAO_Marshal_Principal::deep_copy (tc2, source, dest, env);
source = (char *) source + size;
dest = (char *) dest + size;
}
@@ -838,7 +899,8 @@ TAO_Marshal_Array::deep_copy (CORBA::TypeCode_ptr tc,
case CORBA::tk_objref:
while (bounds-- && retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
- retval = TAO_Marshal_ObjRef::deep_copy (tc2, source, dest, env);
+ retval =
+ TAO_Marshal_ObjRef::deep_copy (tc2, source, dest, env);
source = (char *) source + size;
dest = (char *) dest + size;
}
@@ -846,7 +908,8 @@ TAO_Marshal_Array::deep_copy (CORBA::TypeCode_ptr tc,
case CORBA::tk_struct:
while (bounds-- && retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
- retval = TAO_Marshal_Struct::deep_copy (tc2, source, dest, env);
+ retval =
+ TAO_Marshal_Struct::deep_copy (tc2, source, dest, env);
source = (char *) source + size;
dest = (char *) dest + size;
}
@@ -854,7 +917,8 @@ TAO_Marshal_Array::deep_copy (CORBA::TypeCode_ptr tc,
case CORBA::tk_union:
while (bounds-- && retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
- retval = TAO_Marshal_Union::deep_copy (tc2, source, dest, env);
+ retval =
+ TAO_Marshal_Union::deep_copy (tc2, source, dest, env);
source = (char *) source + size;
dest = (char *) dest + size;
}
@@ -862,16 +926,19 @@ TAO_Marshal_Array::deep_copy (CORBA::TypeCode_ptr tc,
case CORBA::tk_string:
while (bounds-- && retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
- retval = TAO_Marshal_Any::deep_copy (tc2, source, dest, env);
+ retval =
+ TAO_Marshal_Any::deep_copy (tc2, source, dest, env);
source = (char *) source + size;
dest = (char *) dest + size;
}
- retval = TAO_Marshal_String::deep_copy (tc2, source, dest, env);
+ retval =
+ TAO_Marshal_String::deep_copy (tc2, source, dest, env);
break;
case CORBA::tk_sequence:
while (bounds-- && retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
- retval = TAO_Marshal_Sequence::deep_copy (tc2, source, dest, env);
+ retval =
+ TAO_Marshal_Sequence::deep_copy (tc2, source, dest, env);
source = (char *) source + size;
dest = (char *) dest + size;
}
@@ -879,7 +946,8 @@ TAO_Marshal_Array::deep_copy (CORBA::TypeCode_ptr tc,
case CORBA::tk_array:
while (bounds-- && retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
- retval = TAO_Marshal_Array::deep_copy (tc2, source, dest, env);
+ retval =
+ TAO_Marshal_Array::deep_copy (tc2, source, dest, env);
source = (char *) source + size;
dest = (char *) dest + size;
}
@@ -887,7 +955,8 @@ TAO_Marshal_Array::deep_copy (CORBA::TypeCode_ptr tc,
case CORBA::tk_alias:
while (bounds-- && retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
- retval = TAO_Marshal_Alias::deep_copy (tc2, source, dest, env);
+ retval =
+ TAO_Marshal_Alias::deep_copy (tc2, source, dest, env);
source = (char *) source + size;
dest = (char *) dest + size;
}
@@ -895,7 +964,8 @@ TAO_Marshal_Array::deep_copy (CORBA::TypeCode_ptr tc,
case CORBA::tk_except:
while (bounds-- && retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
- retval = TAO_Marshal_Except::deep_copy (tc2, source, dest, env);
+ retval =
+ TAO_Marshal_Except::deep_copy (tc2, source, dest, env);
source = (char *) source + size;
dest = (char *) dest + size;
}
@@ -903,7 +973,8 @@ TAO_Marshal_Array::deep_copy (CORBA::TypeCode_ptr tc,
case CORBA::tk_wstring:
while (bounds-- && retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
- retval = TAO_Marshal_WString::deep_copy (tc2, source, dest, env);
+ retval =
+ TAO_Marshal_WString::deep_copy (tc2, source, dest, env);
source = (char *) source + size;
dest = (char *) dest + size;
}
@@ -912,7 +983,7 @@ TAO_Marshal_Array::deep_copy (CORBA::TypeCode_ptr tc,
retval = CORBA::TypeCode::TRAVERSE_STOP;
break;
} // end of switch
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
return CORBA::TypeCode::TRAVERSE_CONTINUE;
else
@@ -924,7 +995,7 @@ TAO_Marshal_Array::deep_copy (CORBA::TypeCode_ptr tc,
}
} // no exception computing size
else
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
return CORBA::TypeCode::TRAVERSE_STOP;
} // no exception computing content type
else
@@ -948,59 +1019,62 @@ TAO_Marshal_Alias::deep_copy (CORBA::TypeCode_ptr tc,
const void *dest,
CORBA::Environment &env)
{
- CORBA::TypeCode_ptr tc2; // typecode of the aliased type
- CDR stream; // to access the marshal object
- CORBA::TypeCode::traverse_status retval =
- CORBA::TypeCode::TRAVERSE_CONTINUE; // status of deep_copy operation
+ // Typecode of the aliased type.
+ CORBA::TypeCode_ptr tc2;
+ // To access the marshal object.
+ CDR stream;
+ // Status of deep_copy operation.
+ CORBA::TypeCode::traverse_status retval =
+ CORBA::TypeCode::TRAVERSE_CONTINUE;
if (tc)
{
- // get element type
+ // Get element type.
tc2 = tc->content_type (env);
if (env.exception () == 0)
{
- // switch on the data type and handle the cases for primitives here for
- // efficiency
+ // Switch on the data type and handle the cases for
+ // primitives here for efficiency.
switch (tc2->kind_)
{
case CORBA::tk_null:
case CORBA::tk_void:
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
return CORBA::TypeCode::TRAVERSE_CONTINUE;
case CORBA::tk_short:
case CORBA::tk_ushort:
*(CORBA::Short *) dest = *(CORBA::Short *) source;
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
return CORBA::TypeCode::TRAVERSE_CONTINUE;
case CORBA::tk_long:
case CORBA::tk_ulong:
case CORBA::tk_float:
case CORBA::tk_enum:
*(CORBA::Long *) dest = *(CORBA::Long *) source;
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
return CORBA::TypeCode::TRAVERSE_CONTINUE;
case CORBA::tk_double:
case CORBA::tk_longlong:
case CORBA::tk_ulonglong:
*(CORBA::LongLong *) dest = *(CORBA::LongLong *) source;
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
return CORBA::TypeCode::TRAVERSE_CONTINUE;
case CORBA::tk_boolean:
*(CORBA::Boolean *) dest = *(CORBA::Boolean *) source;
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
return CORBA::TypeCode::TRAVERSE_CONTINUE;
case CORBA::tk_char:
case CORBA::tk_octet:
*(CORBA::Char *) dest = *(CORBA::Char *) source;
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
return CORBA::TypeCode::TRAVERSE_CONTINUE;
case CORBA::tk_longdouble:
*(CORBA::LongDouble *) dest = *(CORBA::LongDouble *) source;
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
return CORBA::TypeCode::TRAVERSE_CONTINUE;
case CORBA::tk_wchar:
*(CORBA::WChar *) dest = *(CORBA::WChar *) source;
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
return CORBA::TypeCode::TRAVERSE_CONTINUE;
case CORBA::tk_any:
retval = TAO_Marshal_Any::deep_copy (tc2, source, dest, env);
@@ -1042,7 +1116,7 @@ TAO_Marshal_Alias::deep_copy (CORBA::TypeCode_ptr tc,
// anything else is an error
retval = CORBA::TypeCode::TRAVERSE_STOP;
}
- // CORBA::release (tc2);
+ // CORBA::release (tc2);
if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
return CORBA::TypeCode::TRAVERSE_CONTINUE;
else
@@ -1080,7 +1154,7 @@ TAO_Marshal_Except::deep_copy (CORBA::TypeCode_ptr tc,
{
// Exceptions in memory have a "hidden" typecode up front, used
// to ensure that memory is appropriately freed and to hold the
- // exception ID. We just copy that typecode
+ // exception ID. We just copy that typecode.
*(CORBA::TypeCode_ptr *) dest = *(CORBA::TypeCode_ptr *) source;
(void) (*(CORBA::TypeCode_ptr *) dest)->AddRef ();
diff --git a/TAO/tao/deep_free.cpp b/TAO/tao/deep_free.cpp
index aa11c0e481d..fedbb7e5edf 100644
--- a/TAO/tao/deep_free.cpp
+++ b/TAO/tao/deep_free.cpp
@@ -19,8 +19,6 @@
// types don't hold any memory. For a few, it calls other deep_free methods
// to free the memory
//
-
-//
// = AUTHOR
// Copyright 1994-1995 by Sun Microsystems Inc.
// and
diff --git a/TAO/tao/default_client.cpp b/TAO/tao/default_client.cpp
index 7f7c5513cd8..6fa4cd19eeb 100644
--- a/TAO/tao/default_client.cpp
+++ b/TAO/tao/default_client.cpp
@@ -1,18 +1,3 @@
-// ============================================================================
-//
-// = LIBRARY
-// TAO
-//
-// = FILENAME
-// default_client.cpp
-//
-// = AUTHOR
-// Chris Cleeland
-//
-// = VERSION
-// $Id$
-// ============================================================================
-
#include "tao/default_client.h"
#include "tao/orb_core.h"
diff --git a/TAO/tao/default_client.h b/TAO/tao/default_client.h
index 27b3980e792..c69fd00fe5b 100644
--- a/TAO/tao/default_client.h
+++ b/TAO/tao/default_client.h
@@ -1,4 +1,5 @@
// This may look like C, but it's really -*- C++ -*-
+// $Id$
// ============================================================================
//
@@ -11,8 +12,6 @@
// = AUTHOR
// Chris Cleeland
//
-// = VERSION
-// $Id$
// ============================================================================
#if !defined (TAO_DEFAULT_CLIENT_H)
@@ -21,12 +20,12 @@
#include "tao/corba.h"
class TAO_Default_Client_Strategy_Factory : public TAO_Client_Strategy_Factory
+{
// = TITLE
// This is the "default" client strategy factor for TAO. It
// includes strategies that are configured through command-line
// options so that everything operates as if there were no
// dynamically-linkable strategies.
-{
public:
// = Initialization and termination methods.
TAO_Default_Client_Strategy_Factory (void);
diff --git a/TAO/tao/default_server.cpp b/TAO/tao/default_server.cpp
index 78c11b4413b..bc79fd94df3 100644
--- a/TAO/tao/default_server.cpp
+++ b/TAO/tao/default_server.cpp
@@ -1,15 +1,3 @@
-// ============================================================================
-//
-// = FILENAME
-// default_server.cpp
-//
-// = AUTHOR
-// Chris Cleeland
-//
-// = VERSION
-// $Id$
-// ============================================================================
-
#include "tao/default_server.h"
#include "tao/orb_core.h"
@@ -200,78 +188,77 @@ TAO_Default_Server_Strategy_Factory::parse_args (int argc, char *argv[])
ACE_TRACE ("TAO_Default_Server_Strategy_Factory::parse_args");
int curarg;
+
for (curarg = 0; curarg < argc && argv[curarg]; curarg++)
- {
- if (ACE_OS::strcmp (argv[curarg], "-ORBconcurrency") == 0)
- {
- curarg++;
- if (curarg < argc)
- {
- char *name = argv[curarg];
-
- if (ACE_OS::strcasecmp (name, "reactive") == 0)
- this->concurrency_strategy_ = &reactive_strategy_;
- else if (ACE_OS::strcasecmp (name, "thread-per-connection") == 0)
- this->concurrency_strategy_ = &threaded_strategy_;
- }
- }
- else if (ACE_OS::strcmp (argv[curarg], "-ORBtablesize") == 0)
- {
- curarg++;
- if (curarg < argc)
- this->object_table_size_ = ACE_OS::strtoul (argv[curarg], 0, 10);
- }
- else if (ACE_OS::strcmp (argv[curarg], "-ORBdemuxstrategy") == 0)
- {
- curarg++;
- if (curarg < argc)
- {
- char *name = argv[curarg];
-
- if (ACE_OS::strcasecmp (name, "dynamic") == 0)
- this->object_lookup_strategy_ = TAO_DYNAMIC_HASH;
- else if (ACE_OS::strcasecmp (name, "linear") == 0)
- this->object_lookup_strategy_ = TAO_LINEAR;
- else if (ACE_OS::strcasecmp (name, "active") == 0)
- this->object_lookup_strategy_ = TAO_ACTIVE_DEMUX;
- else if (ACE_OS::strcasecmp (name, "user") == 0)
- this->object_lookup_strategy_ = TAO_USER_DEFINED;
- }
- }
- else if (ACE_OS::strcmp (argv[curarg], "-ORBpoalock") == 0)
- {
- curarg++;
- if (curarg < argc)
- {
- char *name = argv[curarg];
-
- if (ACE_OS::strcasecmp (name, "thread") == 0)
- this->poa_lock_type_ = TAO_THREAD_LOCK;
- else if (ACE_OS::strcasecmp (name, "null") == 0)
- this->poa_lock_type_ = TAO_NULL_LOCK;
- }
- }
- else if (ACE_OS::strcmp (argv[curarg], "-ORBpoamgrlock") == 0)
- {
- curarg++;
- if (curarg < argc)
- {
- char *name = argv[curarg];
-
- if (ACE_OS::strcasecmp (name, "thread") == 0)
- this->poa_mgr_lock_type_ = TAO_THREAD_LOCK;
- else if (ACE_OS::strcasecmp (name, "null") == 0)
- this->poa_mgr_lock_type_ = TAO_NULL_LOCK;
- }
- }
- else if (ACE_OS::strcmp (argv[curarg], "-ORBthreadflags") == 0)
- {
- curarg++;
-
- if (curarg < argc)
- this->tokenize (argv[curarg]);
- }
- }
+ if (ACE_OS::strcmp (argv[curarg], "-ORBconcurrency") == 0)
+ {
+ curarg++;
+ if (curarg < argc)
+ {
+ char *name = argv[curarg];
+
+ if (ACE_OS::strcasecmp (name, "reactive") == 0)
+ this->concurrency_strategy_ = &reactive_strategy_;
+ else if (ACE_OS::strcasecmp (name, "thread-per-connection") == 0)
+ this->concurrency_strategy_ = &threaded_strategy_;
+ }
+ }
+ else if (ACE_OS::strcmp (argv[curarg], "-ORBtablesize") == 0)
+ {
+ curarg++;
+ if (curarg < argc)
+ this->object_table_size_ = ACE_OS::strtoul (argv[curarg], 0, 10);
+ }
+ else if (ACE_OS::strcmp (argv[curarg], "-ORBdemuxstrategy") == 0)
+ {
+ curarg++;
+ if (curarg < argc)
+ {
+ char *name = argv[curarg];
+
+ if (ACE_OS::strcasecmp (name, "dynamic") == 0)
+ this->object_lookup_strategy_ = TAO_DYNAMIC_HASH;
+ else if (ACE_OS::strcasecmp (name, "linear") == 0)
+ this->object_lookup_strategy_ = TAO_LINEAR;
+ else if (ACE_OS::strcasecmp (name, "active") == 0)
+ this->object_lookup_strategy_ = TAO_ACTIVE_DEMUX;
+ else if (ACE_OS::strcasecmp (name, "user") == 0)
+ this->object_lookup_strategy_ = TAO_USER_DEFINED;
+ }
+ }
+ else if (ACE_OS::strcmp (argv[curarg], "-ORBpoalock") == 0)
+ {
+ curarg++;
+ if (curarg < argc)
+ {
+ char *name = argv[curarg];
+
+ if (ACE_OS::strcasecmp (name, "thread") == 0)
+ this->poa_lock_type_ = TAO_THREAD_LOCK;
+ else if (ACE_OS::strcasecmp (name, "null") == 0)
+ this->poa_lock_type_ = TAO_NULL_LOCK;
+ }
+ }
+ else if (ACE_OS::strcmp (argv[curarg], "-ORBpoamgrlock") == 0)
+ {
+ curarg++;
+ if (curarg < argc)
+ {
+ char *name = argv[curarg];
+
+ if (ACE_OS::strcasecmp (name, "thread") == 0)
+ this->poa_mgr_lock_type_ = TAO_THREAD_LOCK;
+ else if (ACE_OS::strcasecmp (name, "null") == 0)
+ this->poa_mgr_lock_type_ = TAO_NULL_LOCK;
+ }
+ }
+ else if (ACE_OS::strcmp (argv[curarg], "-ORBthreadflags") == 0)
+ {
+ curarg++;
+
+ if (curarg < argc)
+ this->tokenize (argv[curarg]);
+ }
return 0;
}
diff --git a/TAO/tao/default_server.h b/TAO/tao/default_server.h
index 60c79c4e52a..63533771c0e 100644
--- a/TAO/tao/default_server.h
+++ b/TAO/tao/default_server.h
@@ -22,11 +22,11 @@
#include "tao/strategy_T.h"
class TAO_Default_Server_Strategy_Factory : public TAO_Server_Strategy_Factory
+{
// = TITLE
// This is the default strategy factory for CORBA servers. It
// allows developers to choose strategies via argument flags.
// This design gives substantial freedom for experimentation.
-{
public:
// = Initialization and termination methods.
TAO_Default_Server_Strategy_Factory (void);
diff --git a/TAO/tao/encode.cpp b/TAO/tao/encode.cpp
index c901ac09006..1f2ecda2695 100644
--- a/TAO/tao/encode.cpp
+++ b/TAO/tao/encode.cpp
@@ -1,5 +1,5 @@
// $Id$
-//
+
// ============================================================================
//
// = LIBRARY
diff --git a/TAO/tao/except.cpp b/TAO/tao/except.cpp
index 9b9b2cec3b7..5f94b188a48 100644
--- a/TAO/tao/except.cpp
+++ b/TAO/tao/except.cpp
@@ -1,17 +1,20 @@
-//
-// $Id$
-//
-// @(#)except.cpp 1.11 95/11/04
+// $id: except.cpp,v 1.29 1998/03/16 17:19:58 coryan Exp $
+
+// @(#)except.cpp 1.11 95/11/04
// Copyright 1994-1995 by Sun Microsystems Inc.
// All Rights Reserved
//
-// ORB: Exception handling support
+// ORB: Exception handling support
//
// THREADING NOTE: calling thread handles mutual exclusion policy
// on all of these data structures.
#include "tao/corba.h"
+#if !defined (__ACE_INLINE__)
+#include "execpt.i"
+#endif /* __ACE_INLINE__ */
+
CORBA_Exception::CORBA_Exception (CORBA::TypeCode_ptr tc)
: type_ (tc),
refcount_ (0)
@@ -21,7 +24,7 @@ CORBA_Exception::CORBA_Exception (CORBA::TypeCode_ptr tc)
assert (type_ != 0);
}
-CORBA_Exception::CORBA_Exception (const CORBA_Exception &src)
+CORBA_Exception::CORBA_Exception (const CORBA_Exception &src)
: type_ (src.type_),
refcount_ (0)
{
@@ -87,13 +90,11 @@ CORBA_Exception::AddRef (void)
CORBA::ULong
CORBA_Exception::Release (void)
{
- {
- refcount_--;
- if (refcount_ != 0)
- return refcount_;
- }
+ refcount_--;
+ if (refcount_ != 0)
+ return refcount_;
- // CORBA::TypeCode_ptr tc = type_->_duplicate ();
+ // CORBA::TypeCode_ptr tc = type_->_duplicate ();
CORBA::Any free_it_all (type_, this, CORBA::B_TRUE);
@@ -116,22 +117,22 @@ CORBA_UserException::~CORBA_UserException (void)
int
CORBA_UserException::_is_a (const char* interface_id) const
{
- return ((ACE_OS::strcmp (interface_id,
- "IDL:CORBA/UserException:1.0") == 0)
- || CORBA_Exception::_is_a (interface_id));
+ return ACE_OS::strcmp (interface_id,
+ "IDL:CORBA/UserException:1.0") == 0
+ || CORBA_Exception::_is_a (interface_id);
}
CORBA_UserException*
CORBA_UserException::_narrow (CORBA_Exception* exception)
{
if (exception->_is_a ("IDL:CORBA/UserException:1.0"))
- return ACE_dynamic_cast (CORBA_UserException*,exception);
+ return ACE_dynamic_cast (CORBA_UserException *, exception);
return 0;
}
CORBA_SystemException::CORBA_SystemException (CORBA::TypeCode_ptr tc,
- CORBA::ULong code,
- CORBA::CompletionStatus completed)
+ CORBA::ULong code,
+ CORBA::CompletionStatus completed)
: CORBA_Exception (tc),
_minor (code),
_completed (completed)
@@ -145,9 +146,9 @@ CORBA_SystemException::~CORBA_SystemException (void)
int
CORBA_SystemException::_is_a (const char* interface_id) const
{
- return ((ACE_OS::strcmp (interface_id,
- "IDL:CORBA/SystemException:1.0") == 0)
- || CORBA_Exception::_is_a (interface_id));
+ return ACE_OS::strcmp (interface_id,
+ "IDL:CORBA/SystemException:1.0") == 0
+ || CORBA_Exception::_is_a (interface_id);
}
CORBA_SystemException*
@@ -158,10 +159,13 @@ CORBA_SystemException::_narrow (CORBA_Exception* exception)
return 0;
}
-#define NUM_SYS_EXCEPTIONS 26 // update correctly!
-#define TC_BUFLEN 160 // preallocated tc buffer
+// update correctly!
+static const int NUM_SYS_EXCEPTIONS = 26;
+
+// Preallocated tc buffer.
+static const int TC_BUFLEN = 160;
-static CORBA::TypeCode_ptr sys_exceptions [NUM_SYS_EXCEPTIONS];
+static CORBA::TypeCode_ptr sys_exceptions[NUM_SYS_EXCEPTIONS];
CORBA::ExceptionList __system_exceptions;
// Make the TypeCode for a standard exception ... note that "buffer"
@@ -172,68 +176,74 @@ CORBA::ExceptionList __system_exceptions;
static void
make_standard_typecode (CORBA::TypeCode_ptr tcp,
- const char *name,
- char *buffer,
- size_t buflen,
- CORBA::Environment &env)
+ const char *name,
+ char *buffer,
+ size_t buflen,
+ CORBA::Environment &env)
{
static const char *minor = "minor";
static const char *completion = "completion";
static const CORBA::ULong oc_completion_status [] =
{
- TAO_ENCAP_BYTE_ORDER, // byte order flag, tricky
- 0, 0, // type ID omitted
- 3, // three members
- 0, 0, // ... whose names are all omitted
+ TAO_ENCAP_BYTE_ORDER, // byte order flag, tricky
+ 0, 0, // type ID omitted
+ 3, // three members
+ 0, 0, // ... whose names are all omitted
0, 0,
0, 0
};
static CORBA::TypeCode
tc_completion_status (CORBA::tk_enum,
- sizeof oc_completion_status,
- (char *) &oc_completion_status,
- CORBA::B_FALSE);
+ sizeof oc_completion_status,
+ (char *) &oc_completion_status,
+ CORBA::B_FALSE);
- static const CORBA::TypeCode_ptr completion_status = &tc_completion_status;
+ static const CORBA::TypeCode_ptr completion_status =
+ &tc_completion_status;
- // Create a CDR stream ... juggle the alignment here a bit, we
- // know it's good enough for the typecode.
+ // Create a CDR stream ... juggle the alignment here a bit, we know
+ // it's good enough for the typecode.
CDR stream (buffer, buflen);
// into CDR stream, stuff (in order):
- // - byte order flag [4 bytes]
- // - exception ID [27 + N bytes]
- // - exception name [4 + N bytes ]
- // - number of members (2) [4 bytes ]
- // - foreach member, { name string, typecode } [~40 bytes]
-
- char full_id [100], *strptr = (char *) &full_id;
-
- (void) ACE_OS::sprintf (full_id, "IDL:omg.org/CORBA/%s:1.0", name);
- assert (strlen (full_id) <= sizeof full_id);
+ // - byte order flag [4 bytes]
+ // - exception ID [27 + N bytes]
+ // - exception name [4 + N bytes ]
+ // - number of members (2) [4 bytes ]
+ // - foreach member, { name string, typecode } [~40 bytes]
+
+ char full_id[100];
+ char *strptr = full_id;
+
+ (void) ACE_OS::sprintf (full_id,
+ "IDL:omg.org/CORBA/%s:1.0",
+ name);
+ // @@ Should this really be an assert or should we deal with it via
+ // exceptions?
+ assert (ACE_OS::strlen (full_id) <= sizeof full_id);
if (stream.put_byte (TAO_ENCAP_BYTE_ORDER) != CORBA::B_TRUE
|| stream.encode (CORBA::_tc_string,
- &strptr, 0,
- env) != CORBA::TypeCode::TRAVERSE_CONTINUE
+ &strptr, 0,
+ env) != CORBA::TypeCode::TRAVERSE_CONTINUE
|| stream.encode (CORBA::_tc_string,
- &name, 0,
- env) != CORBA::TypeCode::TRAVERSE_CONTINUE
+ &name, 0,
+ env) != CORBA::TypeCode::TRAVERSE_CONTINUE
|| stream.put_ulong (2L) != CORBA::B_TRUE
|| stream.encode (CORBA::_tc_string,
- &minor, 0,
- env) != CORBA::TypeCode::TRAVERSE_CONTINUE
+ &minor, 0,
+ env) != CORBA::TypeCode::TRAVERSE_CONTINUE
|| stream.encode (CORBA::_tc_TypeCode,
- &CORBA::_tc_ulong, 0,
- env) != CORBA::TypeCode::TRAVERSE_CONTINUE
+ &CORBA::_tc_ulong, 0,
+ env) != CORBA::TypeCode::TRAVERSE_CONTINUE
|| stream.encode (CORBA::_tc_string,
- &completion, 0,
- env) != CORBA::TypeCode::TRAVERSE_CONTINUE
+ &completion, 0,
+ env) != CORBA::TypeCode::TRAVERSE_CONTINUE
|| stream.encode (CORBA::_tc_TypeCode,
- &completion_status, 0,
- env) != CORBA::TypeCode::TRAVERSE_CONTINUE) {
+ &completion_status, 0,
+ env) != CORBA::TypeCode::TRAVERSE_CONTINUE) {
env.exception (new CORBA_INITIALIZE (CORBA::COMPLETED_NO));
return;
}
@@ -245,9 +255,9 @@ make_standard_typecode (CORBA::TypeCode_ptr tcp,
sys_exceptions [__system_exceptions.length++] =
new (tcp) CORBA::TypeCode (CORBA::tk_except,
- stream.length (),
- stream.buffer (),
- CORBA::B_FALSE);
+ stream.length (),
+ stream.buffer (),
+ CORBA::B_FALSE);
assert (tcp->length_ <= TC_BUFLEN);
return;
@@ -258,7 +268,7 @@ make_standard_typecode (CORBA::TypeCode_ptr tcp,
// using the routine above. (It's just too painful to init these
// typecodes statically in all cases!)
-#define STANDARD_EXCEPTION_LIST \
+#define STANDARD_EXCEPTION_LIST \
TAO_SYSTEM_EXCEPTION (UNKNOWN) \
TAO_SYSTEM_EXCEPTION (BAD_PARAM) \
TAO_SYSTEM_EXCEPTION (NO_MEMORY) \
@@ -292,12 +302,12 @@ make_standard_typecode (CORBA::TypeCode_ptr tcp,
// XXX this actually doesn't guarantee "natural" alignment, but
// it works that way in most systems.
-#define TAO_SYSTEM_EXCEPTION(name) \
+#define TAO_SYSTEM_EXCEPTION(name) \
static CORBA::Long tc_buf_ ## name [TC_BUFLEN / sizeof (long)]; \
static CORBA::TypeCode tc_std_ ## name (CORBA::tk_except); \
CORBA::TypeCode_ptr CORBA::_tc_ ## name = &tc_std_ ## name;
STANDARD_EXCEPTION_LIST
-#undef TAO_SYSTEM_EXCEPTION
+#undef TAO_SYSTEM_EXCEPTION
// Runtime initialization of all standard exception typecodes. Called
// from CORBA::ORB::init ().
@@ -312,14 +322,14 @@ __TC_init_standard_exceptions (CORBA::Environment &env)
__system_exceptions.buffer = &sys_exceptions [0];
// Initialize the typecodes.
-#define TAO_SYSTEM_EXCEPTION(name) \
+#define TAO_SYSTEM_EXCEPTION(name) \
if (env.exception () == 0) \
- make_standard_typecode (&tc_std_ ## name, #name, \
- (char *) tc_buf_ ## name, \
- sizeof tc_buf_ ## name, env);
+ make_standard_typecode (&tc_std_ ## name, #name, \
+ (char *) tc_buf_ ## name, \
+ sizeof tc_buf_ ## name, env);
STANDARD_EXCEPTION_LIST
-#undef TAO_SYSTEM_EXCEPTION
+#undef TAO_SYSTEM_EXCEPTION
}
#define TAO_SYSTEM_EXCEPTION(name) \
@@ -327,7 +337,7 @@ int \
CORBA_##name ::_is_a (const char* interface_id) const \
{ \
return ((ACE_OS::strcmp (interface_id, "IDL:CORBA/" #name "1.0")==0) \
- || CORBA_SystemException::_is_a (interface_id)); \
+ || CORBA_SystemException::_is_a (interface_id)); \
}
STANDARD_EXCEPTION_LIST
#undef TAO_SYSTEM_EXCEPTION
@@ -343,15 +353,15 @@ CORBA_##name ::_narrow (CORBA_Exception* exception) \
STANDARD_EXCEPTION_LIST
#undef TAO_SYSTEM_EXCEPTION
-#undef STANDARD_EXCEPTION_LIST
+#undef STANDARD_EXCEPTION_LIST
// Static initialization of the two user-defined exceptions that
// are part of the ORB.
static char tc_buf_Bounds [] =
{
- 0, 0, 0, 0, // big endian, padded
- 0, 0, 0, 38, // strlen (id) + 1
+ 0, 0, 0, 0, // big endian, padded
+ 0, 0, 0, 38, // strlen (id) + 1
'I', 'D', 'L', ':',
'o', 'm', 'g', '.',
'o', 'r', 'g', '/',
@@ -362,20 +372,20 @@ static char tc_buf_Bounds [] =
'o', 'u', 'n', 'd',
's', ':', '1', '.',
'0', '\0', 0, 0,
- 0, 0, 0, 0 // no members to this typecode
+ 0, 0, 0, 0 // no members to this typecode
};
static CORBA::TypeCode tc_std_Bounds (CORBA::tk_except,
- sizeof tc_buf_Bounds,
- tc_buf_Bounds,
- CORBA::B_FALSE);
+ sizeof tc_buf_Bounds,
+ tc_buf_Bounds,
+ CORBA::B_FALSE);
CORBA::TypeCode_ptr CORBA::_tc_Bounds = &tc_std_Bounds;
static char tc_buf_BadKind [] =
{
- 0, 0, 0, 0, // big endian, padded
- 0, 0, 0, 39, // strlen (id) + 1
+ 0, 0, 0, 0, // big endian, padded
+ 0, 0, 0, 39, // strlen (id) + 1
'I', 'D', 'L', ':',
'o', 'm', 'g', '.',
'o', 'r', 'g', '/',
@@ -386,13 +396,13 @@ static char tc_buf_BadKind [] =
'a', 'd', 'K', 'i',
'n', 'd', ':', '1',
'.', '0', '\0', 0,
- 0, 0, 0, 0 // no members to this typecode
+ 0, 0, 0, 0 // no members to this typecode
};
static CORBA::TypeCode tc_std_BadKind (CORBA::tk_except,
- sizeof tc_buf_BadKind,
- tc_buf_BadKind,
- CORBA::B_FALSE);
+ sizeof tc_buf_BadKind,
+ tc_buf_BadKind,
+ CORBA::B_FALSE);
CORBA::TypeCode_ptr CORBA::_tc_BadKind = &tc_std_BadKind;
// Convenience -- say if the exception is a system exception or not.
@@ -414,15 +424,15 @@ CORBA::Environment::exception_type (void) const
if (ACE_OS::strncmp (id, sysex_prefix, sizeof sysex_prefix - 1) == 0
&& ACE_OS::strncmp (id + sizeof sysex_prefix - 1,
- typecode_extra, sizeof typecode_extra - 1) != 0)
+ typecode_extra, sizeof typecode_extra - 1) != 0)
return CORBA::SYSTEM_EXCEPTION;
return CORBA::USER_EXCEPTION;
}
-// Diagnostic utility routine: describe the exception onto
-// the standard I/O stream passed as a parameter.
-//
+// Diagnostic utility routine: describe the exception onto the
+// standard I/O stream passed as a parameter.
+
void
CORBA::Environment::print_exception (const char *info,
FILE *) const
@@ -431,14 +441,15 @@ CORBA::Environment::print_exception (const char *info,
ACE_DEBUG ((LM_ERROR, "(%P|%t) EXCEPTION, %s\n", info));
- // XXX get rid of this logic, and rely on some member function
- // on Exception to say if it's user or system exception.
+ // XXX get rid of this logic, and rely on some member function on
+ // Exception to say if it's user or system exception.
if (ACE_OS::strncmp ((char *) id, "IDL:omg.org/CORBA/", 10) == 0
&& ACE_OS::strncmp ((char *) id, "IDL:omg.org/CORBA/TypeCode/", 19) != 0)
{
- // XXX this should be a QueryInterface call instead
- CORBA::SystemException *x2 = (CORBA::SystemException *) this->_exception;
+ // XXX this should be a QueryInterface call instead.
+ CORBA::SystemException *x2 =
+ (CORBA::SystemException *) this->_exception;
// XXX there are a other few "user exceptions" in the CORBA
// scope, they're not all standard/system exceptions ... really
@@ -446,10 +457,12 @@ CORBA::Environment::print_exception (const char *info,
// (yeech) or (preferably) to represent the exception type
// directly in the exception value so it can be queried.
- ACE_DEBUG ((LM_ERROR, "(%P|%t) system exception, ID '%s'\n", id));
ACE_DEBUG ((LM_ERROR,
- "(%P|%t) minor code = %x, completed = %s\n",
- x2->minor (),
+ "(%P|%t) system exception, ID '%s'\n",
+ id));
+ ACE_DEBUG ((LM_ERROR,
+ "(%P|%t) minor code = %x, completed = %s\n",
+ x2->minor (),
(x2->completion () == CORBA::COMPLETED_YES) ? "YES" :
(x2->completion () == CORBA::COMPLETED_NO) ? "NO" :
(x2->completion () == CORBA::COMPLETED_MAYBE) ? "MAYBE" :
@@ -459,5 +472,7 @@ CORBA::Environment::print_exception (const char *info,
// XXX we can use the exception's typecode to dump all the data
// held within it ...
- ACE_DEBUG ((LM_ERROR, "(%P|%t) user exception, ID '%s'\n", id));
+ ACE_DEBUG ((LM_ERROR,
+ "(%P|%t) user exception, ID '%s'\n",
+ id));
}
diff --git a/TAO/tao/except.h b/TAO/tao/except.h
index ef12b1199c0..dfcc8b86b99 100644
--- a/TAO/tao/except.h
+++ b/TAO/tao/except.h
@@ -20,6 +20,7 @@
# define TAO_EXCEPT_H
class TAO_Export CORBA_Exception
+{
// = TITLE
// CORBA2-specified exception hierarchy.
//
@@ -29,18 +30,14 @@ class TAO_Export CORBA_Exception
// OMG-IDL compiler and available through the Interface
// Repositories. Think of it as a "globally scoped" name
// distinguishing each exception.
-{
public:
CORBA_Exception (const CORBA_Exception &src);
CORBA_Exception &operator = (const CORBA_Exception &src);
- // Inlined here for efficiency and simplicity
- void *operator new (size_t, const void *p)
- { return (void *) p; }
- void *operator new (size_t s)
- { return ::operator new (s); }
- void operator delete (void *p)
- { ::operator delete (p); }
+ // = Memory allocators.
+ void *operator new (size_t, const void *p);
+ void *operator new (size_t s);
+ void operator delete (void *p);
const char *_id (void) const;
TAO_CONST CORBA::TypeCode_ptr _type (void) const;
@@ -48,10 +45,9 @@ class TAO_Export CORBA_Exception
// = To implement the narrow method.
virtual int _is_a (const char* repository_id) const;
- // = Methods required for COM IUnknown support
-
- CORBA::ULong AddRef (void);
- CORBA::ULong Release (void);
+ // = Methods required for memory management support.
+ CORBA::ULong AddRef (void);
+ CORBA::ULong Release (void);
CORBA_Exception (CORBA::TypeCode_ptr type);
virtual ~CORBA_Exception (void);
@@ -66,29 +62,29 @@ private:
};
class TAO_Export CORBA_UserException : public CORBA_Exception
+{
// = TITLE
// User exceptions are those defined by application developers
// using OMG-IDL.
-{
public:
CORBA_UserException (CORBA::TypeCode_ptr tc);
~CORBA_UserException (void);
- virtual int _is_a (const char* interface_id) const;
- static CORBA_UserException* _narrow (CORBA_Exception* exception);
+ virtual int _is_a (const char *interface_id) const;
+ static CORBA_UserException *_narrow (CORBA_Exception *exception);
protected:
// Copy and assignment operators.
+ // @@ Andy, should these be added here?
};
class TAO_Export CORBA_SystemException : public CORBA_Exception
+{
// = TITLE
// System exceptions are those defined in the CORBA spec; OMG-IDL
// defines these.
-{
public:
- // 94-9-14 also sez: public copy constructor
- // and assignment operator.
+ // = 94-9-14 sez: public copy constructor and assignment operator.
CORBA_SystemException (CORBA::TypeCode_ptr tc,
CORBA::ULong code,
@@ -96,16 +92,15 @@ public:
~CORBA_SystemException (void);
- CORBA::ULong minor (void) const { return _minor; }
- void minor (CORBA::ULong m) { _minor = m; }
+ CORBA::ULong minor (void) const;
+ void minor (CORBA::ULong m);
- CORBA::CompletionStatus completion (void) const { return _completed; }
+ CORBA::CompletionStatus completion (void) const;
- void completion (CORBA::CompletionStatus c)
- { _completed = c; }
+ void completion (CORBA::CompletionStatus c);
- virtual int _is_a (const char* type_id) const;
- static CORBA_SystemException * _narrow (CORBA_Exception* exception);
+ virtual int _is_a (const char *type_id) const;
+ static CORBA_SystemException *_narrow (CORBA_Exception* exception);
private:
CORBA::ULong _minor;
@@ -155,45 +150,32 @@ TAO_SYSTEM_EXCEPTION(BAD_CONTEXT);
TAO_SYSTEM_EXCEPTION(OBJ_ADAPTER);
TAO_SYSTEM_EXCEPTION(DATA_CONVERSION);
-#undef TAO_SYSTEM_EXCEPTION
+#undef TAO_SYSTEM_EXCEPTION
class TAO_Export CORBA_Environment
-{
// = TITLE
// A CORBA_Environment is a way to automagically ensure that
// exception data is freed -- the "var" class for Exceptions. It
// adds just a bit of convenience function support, helping classify
// exceptions as well as reducing memory leakage.
+{
public:
- CORBA_Environment (void) : _exception (0) { }
- ~CORBA_Environment (void) { clear (); }
+ // = Initialization and termination methods.
+ CORBA_Environment (void);
+ ~CORBA_Environment (void);
- CORBA::Exception_ptr exception (void) const { return _exception; }
+ CORBA::Exception_ptr exception (void) const;
// Return the exception. Caller must call AddRef() in order to keep
// the ptr.
- void exception (CORBA::Exception *ex)
- // Set the exception to <ex>, taking a reference on it.
- {
- if (ex != _exception)
- {
- clear ();
- _exception = ex;
- _exception->AddRef ();
- }
- }
+ void exception (CORBA::Exception *ex);
+ // Set the exception to <ex>, taking a reference on it.
CORBA::ExceptionType exception_type (void) const;
TAO_CONST CORBA::String exception_id (void) const;
- void clear (void)
- {
- if (_exception)
- {
- _exception->Release ();
- _exception = 0; // XXX
- }
- }
+ void clear (void);
+ // Clear the exception.
void print_exception (const char *info,
FILE *f=stdout) const;
@@ -201,10 +183,15 @@ public:
private:
CORBA::Exception_ptr _exception;
+ // Pointer to the exception object contained in the environment.
// = These are not provided.
CORBA_Environment (const CORBA_Environment &src);
CORBA_Environment &operator = (const CORBA_Environment &src);
};
+#if defined (__ACE_INLINE__)
+#include "Except.i"
+#endif /* __ACE_INLINE__ */
+
#endif /* TAO_EXCEPT_H */
diff --git a/TAO/tao/except.i b/TAO/tao/except.i
new file mode 100644
index 00000000000..e6217f2206d
--- /dev/null
+++ b/TAO/tao/except.i
@@ -0,0 +1,83 @@
+// This may look like C, but it's really -*- C++ -*-
+
+ACE_INLINE void *
+CORBA_Exception::operator new (size_t,
+ const void *p)
+{
+ return (void *) p;
+}
+
+ACE_INLINE void *
+CORBA_Exception::operator new (size_t s)
+{
+ return ::operator new (s);
+}
+
+ACE_INLINE void
+CORBA_Exception::operator delete (void *p)
+{
+ ::operator delete (p);
+}
+
+ACE_INLINE CORBA::ULong
+CORBA_SystemException::minor (void) const
+{
+ return _minor;
+}
+
+ACE_INLINE void
+CORBA_SystemException::minor (CORBA::ULong m)
+{
+ _minor = m;
+}
+
+ACE_INLINE CORBA::CompletionStatus
+CORBA_SystemException::completion (void) const
+{
+ return _completed;
+}
+
+ACE_INLINE void
+CORBA_SystemException::completion (CORBA::CompletionStatus c)
+{
+ _completed = c;
+}
+
+ACE_INLINE
+CORBA_Environment::CORBA_Environment (void)
+ : _exception (0)
+{
+}
+
+ACE_INLINE void
+CORBA_Environment::clear (void)
+{
+ if (_exception)
+ {
+ _exception->Release ();
+ _exception = 0; // XXX
+ }
+}
+
+ACE_INLINE
+CORBA_Environment::~CORBA_Environment (void)
+{
+ this->clear ();
+}
+
+ACE_INLINE
+CORBA::Exception_ptr CORBA_Exception::exception (void) const
+{
+ return _exception;
+}
+
+ACE_INLINE void
+CORBA::Exception::exception (CORBA::Exception *ex)
+{
+ if (ex != _exception)
+ {
+ this->clear ();
+ _exception = ex;
+ _exception->AddRef ();
+ }
+}
diff --git a/TAO/tao/giop.cpp b/TAO/tao/giop.cpp
index 3d5dc41e51f..46716ce71b4 100644
--- a/TAO/tao/giop.cpp
+++ b/TAO/tao/giop.cpp
@@ -1,5 +1,5 @@
// $Id$
-//
+
// @(#)giop.cpp 1.10 95/09/21
// Copyright 1994-1995 by Sun Microsystems Inc.
// All Rights Reserved
@@ -66,7 +66,9 @@ dump_msg (const char *label,
if (TAO_debug_level >= 2)
{
ACE_DEBUG ((LM_DEBUG, "%s GIOP v%c.%c msg, %d data bytes, %s endian, %s\n",
- label, digits[ptr[4]], digits[ptr[5]],
+ label,
+ digits[ptr[4]],
+ digits[ptr[5]],
len - TAO_GIOP_HEADER_LEN,
(ptr[6] == TAO_ENCAP_BYTE_ORDER) ? "my" : "other",
(ptr[7] <= TAO_GIOP_MessageError) ? names [ptr[7]] : "UNKNOWN TYPE"));
@@ -98,7 +100,7 @@ TAO_GIOP::send_request (TAO_SVC_HANDLER *handler,
// networking infrastructure (e.g. IPSEC).
*(CORBA::Long *) (buf + 8) =
- (CORBA::Long) (buflen - TAO_GIOP_HEADER_LEN);
+ (CORBA::Long) (buflen - TAO_GIOP_HEADER_LEN);
// Strictly speaking, should not need to loop here because the
// socket never gets set to a nonblocking mode ... some Linux
@@ -261,6 +263,7 @@ read_buffer (ACE_SOCK_Stream &peer,
{
int bytes_read = 0;
bytes_read = peer.recv_n (buf, len);
+
if (bytes_read == -1 && errno == ECONNRESET)
{
// We got a connection reset (TCP RSET) from the other side,
diff --git a/TAO/tao/giop.h b/TAO/tao/giop.h
index 45472a9b1b1..8e7a1f37a0f 100644
--- a/TAO/tao/giop.h
+++ b/TAO/tao/giop.h
@@ -36,41 +36,45 @@
// namespace TAO_IOP
-// Assigned Protocol/Profile tag values. ORB protcols may be
-// uniquely identified by tags such as these. This allows each
-// ORB's own objref profiles to be interchanged using IORs.
+// Assigned Protocol/Profile tag values. ORB protcols may be uniquely
+// identified by tags such as these. This allows each ORB's own
+// objref profiles to be interchanged using IORs.
//
// Email to tag-request@omg.org to allocate tags.
typedef CORBA::ULong TAO_IOP_Profile_ID;
enum
{
- TAO_IOP_TAG_INTERNET_IOP = 0, // IIOP
+ TAO_IOP_TAG_INTERNET_IOP = 0, // IIOP
TAO_IOP_TAG_MULTIPLE_COMPONENTS = 1, // DCE-CIOP
-
- // This is a subset of the list of other profile tags.
- TAO_IOP_TAG_ONC_IOP = 0x4f4e4300 // ONC IOP
+ // = This is a subset of the list of other profile tags.
+ TAO_IOP_TAG_ONC_IOP = 0x4f4e4300 // ONC IOP
};
-struct TAO_IOP_Tagged_Profile
-// One per protocol.
+class TAO_IOP_Tagged_Profile
{
+ // = TITLE
+ // One per protocol.
+public:
TAO_IOP_Profile_ID tag;
TAO_opaque profile_data;
};
-typedef TAO_Unbounded_Sequence<TAO_IOP_Tagged_Profile> TAO_IOP_Tagged_Profile_Sequence;
+typedef TAO_Unbounded_Sequence<TAO_IOP_Tagged_Profile>
+ TAO_IOP_Tagged_Profile_Sequence;
-struct TAO_IOP_IOR
+class TAO_IOP_IOR
+{
// = TITLE
- // InteroperableObjectReference
+ // InteroperableObjectReference
//
// = DESCRIPTION
- // ... a set of protocol-specific protocol profiles, plus a type ID.
- // Only one object is denoted by all of this information. It's OK
- // to delete all profiles except the one for the single protocol
- // actually being used.
-{
+ // ... a set of protocol-specific protocol profiles, plus a type
+ // ID. Only one object is denoted by all of this information.
+ // It's OK to delete all profiles except the one for the single
+ // protocol actually being used.
+
+public:
char *type_id;
TAO_IOP_Tagged_Profile_Sequence profiles;
};
@@ -83,9 +87,10 @@ struct TAO_IOP_IOR
typedef CORBA::ULong TAO_IOP_ComponentId;
enum
- // = DESCRIPTION
- // These are all defined by DCE-CIOP in OMG TC document 95-3-10.
{
+ // = DESCRIPTION
+ // These are all defined by DCE-CIOP in OMG TC document 95-3-10.
+
TAO_IOP_TAG_DCE_STRING_BINDING = 100,// string binding handle
TAO_IOP_TAG_DCE_BINDING_NAME = 101, // CDS/GDS/... name
TAO_IOP_TAG_DCE_NO_PIPES = 102, // no component data
@@ -94,21 +99,24 @@ enum
TAO_IOP_TAG_LOCATION_POLICY = 12 // octet/enum
};
-struct TAO_IOP_TaggedComponent
- // = DESCRIPTION
- // One way to represent multicomponent profiles, e.g. as done by the
- // DCE-CIOP protocol. One of these gets encapsulated in
- // Tagged_Profile::profile_data. TAG_MULTIPLE_COMPONENTS may be used
- // to represent protocol profiles structured in that way, but
- // protocol-specific tags facilitate simpler scanning of IORs since
- // you can be assured that each profile only has data used within a
- // single ORB protocol.
+class TAO_IOP_TaggedComponent
{
+ // = DESCRIPTION
+ // One way to represent multicomponent profiles, e.g. as done by
+ // the DCE-CIOP protocol. One of these gets encapsulated in
+ // Tagged_Profile::profile_data. TAG_MULTIPLE_COMPONENTS may be
+ // used to represent protocol profiles structured in that way, but
+ // protocol-specific tags facilitate simpler scanning of IORs
+ // since you can be assured that each profile only has data used
+ // within a single ORB protocol.
+public:
+
TAO_IOP_ComponentId tag;
TAO_opaque component_data;
};
-typedef TAO_Unbounded_Sequence<TAO_IOP_TaggedComponent> TAO_IOP_MultipleComponentProfile;
+typedef TAO_Unbounded_Sequence<TAO_IOP_TaggedComponent>
+ TAO_IOP_MultipleComponentProfile;
// namespace TAO_GIOP
@@ -119,19 +127,21 @@ struct TAO_Version
};
enum
- // = DESCRIPTION
- // GIOP protocol version 1.0 information.
{
+ // = DESCRIPTION
+ // GIOP protocol version 1.0 information.
+
MY_MAJOR = 1,
MY_MINOR = 0
};
enum TAO_GIOP_MsgType
- // = DESCRIPTION
- // All GIOP messages include a header and message type.
{
- // Not really a message type, but needed to bring that information
- // back somehow
+ // = DESCRIPTION
+ // All GIOP messages include a header and message type. Not
+ // really a message type, but needed to bring that information
+ // back somehow
+
TAO_GIOP_EndOfFile = -1, // "discovered" by either
TAO_GIOP_Request = 0, // sent by client
TAO_GIOP_Reply = 1, // by server
@@ -142,8 +152,12 @@ enum TAO_GIOP_MsgType
TAO_GIOP_MessageError = 6 // by both
};
-struct TAO_GIOP_MessageHeader
+class TAO_GIOP_MessageHeader
{
+ // = TITLE
+ // This is the header sent with ever GIOP request!
+
+public:
CORBA::Char magic [4]; // "GIOP"
TAO_Version giop_version;
CORBA::Octet byte_order; // 0 = big, 1 = little
@@ -151,51 +165,52 @@ struct TAO_GIOP_MessageHeader
CORBA::ULong message_size; // in byte_order!
};
-// defined by GIOP 1.0 protocol
-// @@ Is this portable? The structure above could have some padding on
-// machines with absurd padding requirements (like 8 byte boundaries);
-// hence the size of it may not match th size of the header on the
-// wire.
+// defined by GIOP 1.0 protocol @@ Is this portable? The structure
+// above could have some padding on machines with absurd padding
+// requirements (like 8 byte boundaries); hence the size of it may not
+// match th size of the header on the wire.
#define TAO_GIOP_HEADER_LEN sizeof (TAO_GIOP_MessageHeader)
-// Support for Implicit ORB Service Context
+// Support for Implicit ORB Service Context.
typedef CORBA::ULong TAO_GIOP_ServiceID;
enum
- // = TITLE
- // Values for TAO_GIOP_ServiceID
{
+ // = TITLE
+ // Values for TAO_GIOP_ServiceID.
+
TAO_GIOP_TransactionService = 0
// More service IDs may be defined by OMG.
-
// This is where our RIOP service ID will be defined...
};
-struct TAO_GIOP_ServiceContext
+class TAO_GIOP_ServiceContext
{
+ // = TITLE
+ // Sent for service context entries in the GIOP request header.
+public:
TAO_GIOP_ServiceID context_id;
TAO_opaque context_data;
};
-typedef TAO_Unbounded_Sequence<TAO_GIOP_ServiceContext> TAO_GIOP_ServiceContextList;
+typedef TAO_Unbounded_Sequence<TAO_GIOP_ServiceContext>
+ TAO_GIOP_ServiceContextList;
extern CORBA::TypeCode TC_ServiceContextList;
// = Request, Reply headers
class TAO_Export TAO_GIOP_RequestHeader
+{
// = TITLE
// This class embodies the header of a GIOP request.
- //
- // = NOTES
- // This used to be a <struct>, which is why everything is public.
-{
public:
TAO_GIOP_RequestHeader (void);
// Constructor.
- CORBA::Boolean init (CDR &msg, CORBA::Environment& env);
+ CORBA::Boolean init (CDR &msg,
+ CORBA::Environment& env);
// Initialize the header from the values found in <msg>.
//private:
@@ -233,34 +248,40 @@ enum TAO_GIOP_ReplyStatusType
// @@ More info
};
-struct TAO_GIOP_ReplyHeader
+class TAO_GIOP_ReplyHeader
{
+ // = TITLE
+ // This class embodies the header of a GIOP reply.
+public:
TAO_GIOP_ServiceContextList service_info;
// Information
CORBA::ULong request_id;
- // Unique identifier of the request for which this is a reply
+ // Unique identifier of the request for which this is a reply.
TAO_GIOP_ReplyStatusType reply_status;
- // Status of the reply (see above enum)
+ // Status of the reply (see above enum).
};
-struct TAO_GIOP_CancelRequestHeader
- // = DESCRIPTION
- // Cancellation -- applies both to Requests and LocateRequests.
+class TAO_GIOP_CancelRequestHeader
{
+ // = TITLE
+ // Cancellation -- applies both to Requests and LocateRequests.
+public:
CORBA::ULong request_id;
// Unique identifier of the request being cancelled
};
-struct TAO_GIOP_LocateRequestHeader
- // = DESCRIPTION
- // Location service support
+class TAO_GIOP_LocateRequestHeader
{
+ // = TITLE
+ // Location service support
+public:
TAO_GIOP_LocateRequestHeader (void);
// Constructor
- CORBA::Boolean init (CDR &msg, CORBA::Environment& env);
+ CORBA::Boolean init (CDR &msg,
+ CORBA::Environment& env);
// Initialize the header from the values found in <msg>.
CORBA::ULong request_id;
@@ -274,21 +295,25 @@ enum TAO_GIOP_LocateStatusType
TAO_GIOP_OBJECT_FORWARD
};
-struct TAO_GIOP_LocateReplyHeader
+class TAO_GIOP_LocateReplyHeader
{
+ // = TITLE
+ // Location reply.
+public:
CORBA::ULong request_id;
TAO_GIOP_LocateStatusType locate_status;
};
class TAO_Export TAO_GIOP_Invocation
+{
// = TITLE
// Invocation: Sends a Request, optionally reads associated Reply.
// Uses transport info passed in, doesn't locate anything.
//
// = NOTES
// This should maybe be moved into its own file (invoke.h?)
-{
public:
+ // = Initialization and termination methods.
TAO_GIOP_Invocation (IIOP_Object *data,
const char *operation,
CORBA::Boolean is_roundtrip);
@@ -296,9 +321,10 @@ public:
~TAO_GIOP_Invocation (void);
void start (CORBA::Environment &env);
- // <start> goes beyond initialising data structures, and makes
- // calls that may fail -- and thus throw exceptions.
+ // <start> goes beyond initialising data structures, and makes calls
+ // that may fail -- and thus throw exceptions.
+ // @@ Andy, can you please document the following methods.
void put_param (CORBA::TypeCode_ptr tc,
void *value,
CORBA::Environment &env);