summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TAO/tao/any.i9
-rw-r--r--TAO/tao/arg_shifter.cpp4
-rw-r--r--TAO/tao/arg_shifter.h13
-rw-r--r--TAO/tao/client_factory.cpp15
-rw-r--r--TAO/tao/client_factory.h1
-rw-r--r--TAO/tao/client_factory.i8
-rw-r--r--TAO/tao/connect.h17
-rw-r--r--TAO/tao/corbacom.i25
-rw-r--r--TAO/tao/debug.cpp120
-rw-r--r--TAO/tao/debug.h35
-rw-r--r--TAO/tao/decode.cpp384
11 files changed, 334 insertions, 297 deletions
diff --git a/TAO/tao/any.i b/TAO/tao/any.i
index 39bee9ceacf..2b4e36a6afd 100644
--- a/TAO/tao/any.i
+++ b/TAO/tao/any.i
@@ -18,7 +18,7 @@ CORBA_Any::operator delete (void *p)
::operator delete (p);
}
-// insertion from special types
+// Insertion from special types.
// @@ Andy, please take a look at this method and make sure it's what
// you intended. I couldn't find it defined anywhere. --cjc
@@ -121,7 +121,9 @@ CORBA_Any::to_char::to_char (CORBA::Char &c)
}
ACE_INLINE
-CORBA_Any::from_string::from_string (char *s, CORBA::ULong b, CORBA::Boolean nocopy)
+CORBA_Any::from_string::from_string (char *s,
+ CORBA::ULong b,
+ CORBA::Boolean nocopy)
: val_ (s),
bound_ (b),
nocopy_ (nocopy)
@@ -129,7 +131,8 @@ CORBA_Any::from_string::from_string (char *s, CORBA::ULong b, CORBA::Boolean noc
}
ACE_INLINE
-CORBA_Any::to_string::to_string (char *&s, CORBA::ULong b)
+CORBA_Any::to_string::to_string (char *&s,
+ CORBA::ULong b)
: val_ (s),
bound_ (b)
{
diff --git a/TAO/tao/arg_shifter.cpp b/TAO/tao/arg_shifter.cpp
index 0b9d1f8170d..c142a9344c6 100644
--- a/TAO/tao/arg_shifter.cpp
+++ b/TAO/tao/arg_shifter.cpp
@@ -106,8 +106,8 @@ Arg_Shifter::is_option_next (void) const
int
Arg_Shifter::is_parameter_next (void) const
{
- return this->is_anything_left () &&
- this->temp_[this->current_index_][0] != '-';
+ return this->is_anything_left ()
+ && this->temp_[this->current_index_][0] != '-';
}
int
diff --git a/TAO/tao/arg_shifter.h b/TAO/tao/arg_shifter.h
index 4b1017828fa..faf2fb1d7a4 100644
--- a/TAO/tao/arg_shifter.h
+++ b/TAO/tao/arg_shifter.h
@@ -19,9 +19,10 @@
#define TAO_ARG_SHIFTER_H
class Arg_Shifter
+{
// = TITLE
- // Happy ADT to shift known args to the back of the argv vector,
- // so deeper levels of argument parsing can locate the yet
+ // This ADT shifts known args to the back of the argv vector, so
+ // deeper levels of argument parsing can locate the yet
// unprocessed arguments at the beginning of the vector.
//
// = DESCRIPTION
@@ -32,12 +33,10 @@ class Arg_Shifter
// arguments in the temp vector, Arg_Shifter has placed all the
// unknown arguments in their original order at the front of
// argv.
-{
public:
-
Arg_Shifter (int &argc, char **argv, char **temp = 0);
- // Sumbit to the Arg_Shifter the vector over which to iterate, also
- // providing the temporary array if the client doesn't want the
+ // Initialize the Arg_Shifter to the vector over which to iterate,
+ // also providing the temporary array if the client doesn't want the
// arg_shifter to dynamically allocate its own. If internal dynamic
// allocation fails, the Arg_Shifter will set all the indices to the
// end of the vector, forbidding iteration. Following iteration over
@@ -46,7 +45,7 @@ public:
~Arg_Shifter (void);
- char* get_current (void) const;
+ char *get_current (void) const;
// Get the current head of the vector.
int consume_arg (int number = 1);
diff --git a/TAO/tao/client_factory.cpp b/TAO/tao/client_factory.cpp
index a15184198a4..e0d1e534498 100644
--- a/TAO/tao/client_factory.cpp
+++ b/TAO/tao/client_factory.cpp
@@ -1,18 +1,3 @@
-// ============================================================================
-//
-// = LIBRARY
-// TAO
-//
-// = FILENAME
-// client_factory.cpp
-//
-// = AUTHOR
-// Chris Cleeland
-//
-// = VERSION
-// $Id$
-// ============================================================================
-
#include "tao/corba.h"
TAO_Client_Strategy_Factory::TAO_Client_Strategy_Factory (void)
diff --git a/TAO/tao/client_factory.h b/TAO/tao/client_factory.h
index c4007d427fb..b9834fbdeda 100644
--- a/TAO/tao/client_factory.h
+++ b/TAO/tao/client_factory.h
@@ -1,4 +1,5 @@
// This may look like C, but it's really -*- C++ -*-
+// $Id$
// ============================================================================
//
diff --git a/TAO/tao/client_factory.i b/TAO/tao/client_factory.i
index 3ea29ff2ca3..e69de29bb2d 100644
--- a/TAO/tao/client_factory.i
+++ b/TAO/tao/client_factory.i
@@ -1,8 +0,0 @@
-#if 0
-ACE_INLINE TAO_CONNECTOR *
-TAO_Client_Strategy_Factory::connector (void)
-{
- return 0;
-}
-#endif /* 0 */
-
diff --git a/TAO/tao/connect.h b/TAO/tao/connect.h
index e08dc3aeb9f..17b5515b069 100644
--- a/TAO/tao/connect.h
+++ b/TAO/tao/connect.h
@@ -1,4 +1,5 @@
// This may look like C, but it's really -*- C++ -*-
+// $Id$
#if !defined (TAO_CONNECT_H)
# define TAO_CONNECT_H
@@ -30,10 +31,10 @@ typedef ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>
TAO_SVC_HANDLER;
class TAO_Client_Connection_Handler : public TAO_SVC_HANDLER
+{
// = TITLE
// <Svc_Handler> used on the client side and returned by the
// <TAO_CONNECTOR>.
-{
public:
// = Intialization method.
TAO_Client_Connection_Handler (ACE_Thread_Manager * = 0);
@@ -76,9 +77,10 @@ private:
};
class TAO_Server_Connection_Handler : public TAO_SVC_HANDLER
+{
// = TITLE
// Handles requests on a single connection in a server.
-{
+
public:
TAO_Server_Connection_Handler (ACE_Thread_Manager *t = ACE_Thread_Manager::instance ());
// Constructor.
@@ -99,8 +101,8 @@ public:
enum RequestStatus
{
Error = -1,
- Request, // A CORBA Request was received
- LocateRequest // A CORBA LocateRequest was received
+ Request, // A CORBA Request was received
+ LocateRequest // A CORBA LocateRequest was received
};
virtual RequestStatus recv_request (CDR &msg, CORBA::Environment &env);
@@ -143,13 +145,16 @@ protected:
// Reads a message from the <peer()>, dispatching and servicing it
// appropriately.
- virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask);
+ virtual int handle_close (ACE_HANDLE,
+ ACE_Reactor_Mask);
// Perform appropriate closing of the connection.
TAO_OA_Parameters *params_;
+ // Pointer to the object adapter parameters.
};
-typedef ACE_Strategy_Acceptor<TAO_Server_Connection_Handler, ACE_SOCK_ACCEPTOR>
+typedef ACE_Strategy_Acceptor<TAO_Server_Connection_Handler,
+ ACE_SOCK_ACCEPTOR>
TAO_ACCEPTOR;
#endif /* TAO_CONNECT_H */
diff --git a/TAO/tao/corbacom.i b/TAO/tao/corbacom.i
index 5de6980238c..1e4518cccfb 100644
--- a/TAO/tao/corbacom.i
+++ b/TAO/tao/corbacom.i
@@ -1,27 +1,11 @@
// This may look like C, but it's really -*- C++ -*-
-// ============================================================================
-//
-// = LIBRARY
-// TAO
-//
-// = FILENAME
-// corbacom.i
-//
-// = DESCRIPTION
-// CORBA C/C++/COM mapping for Win32
-//
-// = AUTHOR
-// Copyright 1994-1995 by Sun Microsystems Inc.
-//
-// ============================================================================
-
// String utility support
ACE_INLINE TAO_Export CORBA::String
CORBA::string_alloc (CORBA::ULong len)
{
- // allocate 1 + strlen to accomodate the null terminating character
+ // Allocate 1 + strlen to accomodate the null terminating character.
return new CORBA::Char[size_t (len + 1)];
}
@@ -63,8 +47,7 @@ CORBA::String_var::String_var (char *p)
{
// NOTE: According to the CORBA spec this string must *not* be
// copied, but it is non-compliant to use it/release it in the
- // calling code.
- // argument is consumed. p should never be NULL
+ // calling code. argument is consumed. p should never be NULL
}
ACE_INLINE
@@ -82,14 +65,14 @@ CORBA::String_var::String_var (const CORBA::String_var& r)
ACE_INLINE CORBA::Char &
CORBA::String_var::operator[] (CORBA::ULong index)
{
- // we need to verify bounds else raise some exception
+ // We need to verify bounds else raise some exception.
return this->ptr_[index];
}
ACE_INLINE CORBA::Char
CORBA::String_var::operator[] (CORBA::ULong index) const
{
- // we need to verify bounds else raise some exception
+ // We need to verify bounds else raise some exception.
return this->ptr_[index];
}
diff --git a/TAO/tao/debug.cpp b/TAO/tao/debug.cpp
index 13d5bb461d7..f9358f257f3 100644
--- a/TAO/tao/debug.cpp
+++ b/TAO/tao/debug.cpp
@@ -1,5 +1,6 @@
// $Id$
// @ (#)debug.cpp 1.3 95/10/02
+
// Copyright 1994-1995 by Sun Microsystems Inc.
// All Rights Reserved
//
@@ -10,7 +11,7 @@
// part of process initialization. They are treated as immutable
// values through all of this debuging package.
//
-// XXX on Windows, make it always use OutputDebugString () instead of stdio
+// XXX on Windows, make it always use OutputDebugString () instead of stdio.
#include "tao/corba.h"
@@ -20,12 +21,14 @@
# define funlockfile(f)
#endif /* ! ACE_HAS_PTHREADS && ! ACE_HAS_DCE_DRAFT4_THREADS */
-u_int TAO_Export TAO_debug_level = 0;
-char * TAO_Export TAO_debug_filter = "l";
+u_int TAO_Export TAO_debug_level = 0;
+char *TAO_Export TAO_debug_filter = "l";
static FILE *debug_stream = stderr;
-// Dummy function to get rid of "'debug_stream' defined but not used" warning
+// Dummy function to get rid of "'debug_stream' defined but not used"
+// warning.
+
FILE *
use_debug_stream_to_get_rid_of_warning (void)
{
@@ -39,7 +42,7 @@ use_debug_stream_to_get_rid_of_warning (void)
// same functionality ... this could be modified to use that routine
// where it's available.
-#if defined (DEBUG) && defined (HAVE_VPRINTF)
+#if defined (DEBUG) && defined (HAVE_VPRINTF)
// Support for prefixing debug messages with process ID and, if
// threaded, the thread ID. This lets messages from different sources
@@ -81,16 +84,15 @@ static void
setup (void)
{
if (my_pid == 0)
- {
- my_pid = ACE_OS::getpid ();
- // other setup goes here
- }
+ my_pid = ACE_OS::getpid ();
+
+// Any other setup goes here.
}
#define emit_prefix(stream) fprintf (stream, "p%ld: ", (long) my_pid)
#endif /* !ACE_HAS_PTHREADS */
-#elif defined (_WIN32)
+#elif defined (_WIN32)
// Not all implementations of Win32 have threads, but in any case this
// code doesn't yet support Win32 threads.
@@ -100,13 +102,12 @@ setup (void)
{
if (my_pid == 0)
my_pid = GetCurrentProcessId ();
- // other setup goes here
+ // Any other setup goes here.
}
#define emit_prefix(stream) fprintf (stream, "p%ld: ", my_pid)
#else
-
# error "unknown OS platform"
#endif /* OS-specific initialization */
@@ -137,14 +138,18 @@ dmsg_filter (const char *_FAR categories,
switch (*cp)
{ // standard categories
- case 'l': ACE_OS::fprintf (debug_stream, " (LEAK) "); break;
+ case 'l':
+ ACE_OS::fprintf (debug_stream, " (LEAK) ");
+ break;
}
va_start (ap, fmt);
vfprintf (debug_stream, fmt, ap);
va_end (ap);
+
if (strchr (fmt, '\n') == 0)
ACE_OS::fprintf (debug_stream, "\n");
+
funlockfile (debug_stream);
#if defined (_WIN32)
@@ -199,22 +204,28 @@ dmsg_v (const char *_FAR fmt,
}
void TAO_Export
-_dmsg_x (CORBA::Environment _FAR &env,
+_dmsg_x (CORBA::Environment _FAR &env,
const char *_FAR info)
{
- const CORBA::Exception *ex = env.exception ();
+ const CORBA::Exception *ex = env.exception ();
setup ();
flockfile (debug_stream);
emit_prefix (debug_stream);
- ACE_OS::fprintf (debug_stream, "exception '%s' at '%s'\n", ex->_id (), info);
+ ACE_OS::fprintf (debug_stream,
+ "exception '%s' at '%s'\n",
+ ex->_id (),
+ info);
+
if (env.exception_type () == CORBA::SYSTEM_EXCEPTION)
{
CORBA::SystemException *sysex = (CORBA::SystemException *) ex;
emit_prefix (debug_stream);
- ACE_OS::fprintf (debug_stream, "minor %#lx, completion %#lx\n",
- sysex->minor (), (long) sysex->completion ());
+ ACE_OS::fprintf (debug_stream,
+ "minor %#lx, completion %#lx\n",
+ sysex->minor (),
+ (long) sysex->completion ());
}
funlockfile (debug_stream);
@@ -231,12 +242,17 @@ dmsg_opaque (char *_FAR label,
setup ();
flockfile (debug_stream);
emit_prefix (debug_stream);
- ACE_OS::fprintf (debug_stream, "%s ", label);
+ ACE_OS::fprintf (debug_stream,
+ "%s ",
+ label);
if (len == 0 || !buffer)
- ACE_OS::fprintf (debug_stream, " (empty)");
+ ACE_OS::fprintf (debug_stream,
+ " (empty)");
else if (len > UINT_MAX)
- ACE_OS::fprintf (debug_stream, "Oversized opaque data: %ld bytes", len);
+ ACE_OS::fprintf (debug_stream,
+ "Oversized opaque data: %ld bytes",
+ len);
else
{
u_int i;
@@ -248,25 +264,36 @@ dmsg_opaque (char *_FAR label,
if (i < len)
{
if (len >= 20)
- ACE_OS::fprintf (debug_stream, "%ld bytes binary data", len);
+ ACE_OS::fprintf (debug_stream,
+ "%ld bytes binary data",
+ len);
else
{
- ACE_OS::fprintf (debug_stream, "binary data {%2X", buffer [0]);
+ ACE_OS::fprintf (debug_stream,
+ "binary data {%2X", buffer [0]);
for (i = 1; i < len; i++)
- ACE_OS::fprintf (debug_stream, ", %2x", buffer [i]);
- ACE_OS::fprintf (debug_stream, "}");
+ ACE_OS::fprintf (debug_stream,
+ ", %2x",
+ buffer [i]);
+ ACE_OS::fprintf (debug_stream,
+ "}");
}
}
else
{
if (len >= 50)
- ACE_OS::fprintf (debug_stream, "%ld bytes string data", len);
+ ACE_OS::fprintf (debug_stream,
+ "%ld bytes string data",
+ len);
else
- ACE_OS::fprintf (debug_stream, "string data { \"%.*s\" }",
- (int) len, buffer);
+ ACE_OS::fprintf (debug_stream,
+ "string data { \"%.*s\" }",
+ (int) len,
+ buffer);
}
}
- ACE_OS::fprintf (debug_stream, "\n");
+ ACE_OS::fprintf (debug_stream,
+ "\n");
funlockfile (debug_stream);
#if defined (_WIN32)
@@ -283,10 +310,13 @@ dmsg_opaque_full (char *_FAR label,
flockfile (debug_stream);
emit_prefix (debug_stream);
- ACE_OS::fprintf (debug_stream, "%s ", label);
+ ACE_OS::fprintf (debug_stream,
+ "%s ",
+ label);
if (len == 0 || !buffer)
- ACE_OS::fprintf (debug_stream, " (empty)");
+ ACE_OS::fprintf (debug_stream,
+ " (empty)");
else
{
u_int i;
@@ -294,30 +324,40 @@ dmsg_opaque_full (char *_FAR label,
for (i = 0; i < len; i++)
{
if (i == 0)
- ACE_OS::fprintf (debug_stream, "\nhex: ");
+ ACE_OS::fprintf (debug_stream,
+ "\nhex: ");
else if ((i % 32) == 0)
- ACE_OS::fprintf (debug_stream, "\n ");
+ ACE_OS::fprintf (debug_stream,
+ "\n ");
else if ((i % 4) == 0)
- ACE_OS::fprintf (debug_stream, " ");
- ACE_OS::fprintf (debug_stream, "%02x", buffer[i]);
+ ACE_OS::fprintf (debug_stream,
+ " ");
+ ACE_OS::fprintf (debug_stream,
+ "%02x",
+ buffer[i]);
}
for (i = 0; i < len; i++)
{
if (i == 0)
- ACE_OS::fprintf (debug_stream, "\nchars: ");
+ ACE_OS::fprintf (debug_stream,
+ "\nchars: ");
else if ((i % 32) == 0)
- ACE_OS::fprintf (debug_stream, "\n ");
+ ACE_OS::fprintf (debug_stream,
+ "\n ");
else if ((i % 4) == 0)
- ACE_OS::fprintf (debug_stream, " ");
+ ACE_OS::fprintf (debug_stream,
+ " ");
ACE_OS::fprintf (debug_stream, "%c ",
(isprint (buffer[i]) ? buffer[i] : '?'));
}
- ACE_OS::fprintf (debug_stream, "\n");
+ ACE_OS::fprintf (debug_stream,
+ "\n");
}
- ACE_OS::fprintf (debug_stream, "\n");
+ ACE_OS::fprintf (debug_stream,
+ "\n");
funlockfile (debug_stream);
#if defined (_WIN32)
diff --git a/TAO/tao/debug.h b/TAO/tao/debug.h
index 83b4e55c726..7f9ff844a62 100644
--- a/TAO/tao/debug.h
+++ b/TAO/tao/debug.h
@@ -55,20 +55,20 @@ extern char * TAO_Export TAO_debug_filter;
// dump socket error indication, if any, with ID tag
#if defined (_WINSOCKAPI_)
-#define dsockerr(s) { if (TAO_debug_level) dmsg_v ("%s: winsock error %d", \
- s, WSAGetLastError()); }
+#define dsockerr(s) { if (TAO_debug_level) dmsg_v ("%s: winsock error %d", \
+ s, WSAGetLastError()); }
#else
#define dsockerr(s) dperror(s)
#endif /* _WINSOCKAPI_ */
#else /* !DEBUG */
-#define dmsg(s) { }
-#define dmsg1(s,a1) { }
-#define dmsg2(s,a1,a2) { }
+#define dmsg(s) { }
+#define dmsg1(s,a1) { }
+#define dmsg2(s,a1,a2) { }
-#define dexc(env, s) { }
-#define dperror(s) { }
-#define dsockerr(s) { }
+#define dexc(env, s) { }
+#define dperror(s) { }
+#define dsockerr(s) { }
#endif /* DEBUG */
// These don't compile out; you must #ifdef them. This is done
@@ -83,25 +83,28 @@ extern char * TAO_Export TAO_debug_filter;
// message is then printed. Assign thosee characters as needed.
extern void TAO_Export dmsg_filter (const char *_FAR filter,
- const char *_FAR fmt, ...);
+ const char *_FAR fmt,
+ ...);
// Filter according to TAO_debug_level instead of category. (For
// speed, test against TAO_debug_level directly.)
extern void TAO_Export dmsg_filter (u_int level,
- const char *_FAR fmt, ...);
+ const char *_FAR fmt,
+ ...);
// General varargs debug message printer, no filtering
-extern void TAO_Export dmsg_v (const char *_FAR fmt, ...);
+extern void TAO_Export dmsg_v (const char *_FAR fmt,
+ ...);
extern void TAO_Export _dmsg_x (CORBA_Environment _FAR &env,
- const char *_FAR info);
+ const char *_FAR info);
extern void TAO_Export dmsg_opaque (char *_FAR label,
- u_char *_FAR buffer,
- u_long len);
+ u_char *_FAR buffer,
+ u_long len);
extern void TAO_Export dmsg_opaque_full (char *_FAR label,
- const u_char *_FAR buffer,
- u_long len);
+ const u_char *_FAR buffer,
+ u_long len);
#endif /* DEBUG */
#endif /* TAO_DEBUG_H */
diff --git a/TAO/tao/decode.cpp b/TAO/tao/decode.cpp
index 8a4277506e7..b14b244e790 100644
--- a/TAO/tao/decode.cpp
+++ b/TAO/tao/decode.cpp
@@ -11,10 +11,10 @@
// = DESCRIPTION
// Code for decoding different data types
//
-// The original code had a single static decoder function defined on the CDR
-// class that called traverse to interpret the data types. This version
-// defines a virtual method "decode" on each class and avoids
-// calling traverse.
+// The original code had a single static decoder function defined on
+// the CDR class that called traverse to interpret the data
+// types. This version defines a virtual method "decode" on each
+// class and avoids calling traverse.
//
// = AUTHOR
// Copyright 1994-1995 by Sun Microsystems Inc.
@@ -152,24 +152,35 @@ TAO_Marshal_Any::decode (CORBA::TypeCode_ptr,
CORBA::Environment &env)
{
CORBA::Any *any = (CORBA::Any *) data;
- CORBA::TypeCode_ptr elem_tc; // typecode of the element that makes the Any
- void *value = 0; // value maintained by the Any
+
+ // Typecode of the element that makes the Any.
+ CORBA::TypeCode_ptr elem_tc;
+
+ // Value maintained by the Any.
+ void *value = 0;
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;
+
+ // Status of encode operation.
CORBA::TypeCode::traverse_status retval =
- CORBA::TypeCode::TRAVERSE_CONTINUE; // status of encode operation
+ CORBA::TypeCode::TRAVERSE_CONTINUE;
- // decode the typecode description for the element
+ // Decode the typecode description for the element.
if (stream->decode (CORBA::_tc_TypeCode,
&elem_tc,
this,
env) == CORBA::TypeCode::TRAVERSE_CONTINUE)
{
- value = new CORBA::Octet[elem_tc->size (env)];
+ ACE_NEW_RETURN (value,
+ CORBA::Octet[elem_tc->size (env)],
+ CORBA::TypeCode::TRAVERSE_STOP);
+
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 (elem_tc->kind_)
{
case CORBA::tk_null:
@@ -177,31 +188,38 @@ TAO_Marshal_Any::decode (CORBA::TypeCode_ptr,
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_any:
case CORBA::tk_TypeCode:
@@ -218,7 +236,7 @@ TAO_Marshal_Any::decode (CORBA::TypeCode_ptr,
retval = stream->decode (elem_tc, value, 0, env);
break;
default:
- // anything else is an error
+ // Anything else is an error.
retval = CORBA::TypeCode::TRAVERSE_STOP;
}
}
@@ -228,14 +246,14 @@ TAO_Marshal_Any::decode (CORBA::TypeCode_ptr,
if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE
&& continue_decoding == CORBA::B_TRUE)
{
- // allocate an Any and populate it with the value and typecode. This
- // eventually appears as "data"
+ // Allocate an Any and populate it with the value and
+ // typecode. This eventually appears as "data"
(void) new (any) CORBA::Any (elem_tc, value, CORBA::B_TRUE);
return CORBA::TypeCode::TRAVERSE_CONTINUE;
}
else
{
- // free the allocated storage and release the typecode
+ // Free the allocated storage and release the typecode.
delete [] value;
CORBA::release (elem_tc);
env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE));
@@ -252,19 +270,26 @@ TAO_Marshal_TypeCode::decode (CORBA::TypeCode_ptr,
CORBA::Environment &env)
{
CORBA::Boolean continue_decoding = CORBA::B_TRUE;
- CDR *stream = (CDR *) context; // context is the CDR stream
- CORBA::TypeCode_ptr *tcp; // typecode to be decoded
- CORBA::ULong kind; // typecode kind
- CORBA::TypeCode_ptr parent = (CORBA::TypeCode_ptr) parent_typecode; // TypeCode
- // for the
- // parent
- // decode the "kind" field of the typecode from the stream
+ // Context is the CDR stream.
+ CDR *stream = (CDR *) context;
+
+ // Typecode to be decoded.
+ CORBA::TypeCode_ptr *tcp;
+
+ // Typecode kind.
+ CORBA::ULong kind;
+
+ // TypeCode for the parent.
+ CORBA::TypeCode_ptr parent = (CORBA::TypeCode_ptr) parent_typecode;
+
+ // Decode the "kind" field of the typecode from the stream
continue_decoding = stream->get_ulong (kind);
if (continue_decoding == CORBA::B_TRUE)
{
- tcp = (CORBA::TypeCode_ptr *) data; // the data has to be a TypeCode_ptr*
+ // The data has to be a TypeCode_ptr *.
+ tcp = (CORBA::TypeCode_ptr *) data;
// Typecodes with empty parameter lists all have preallocated
// constants. We use those to reduce memory consumption and
@@ -272,181 +297,182 @@ TAO_Marshal_TypeCode::decode (CORBA::TypeCode_ptr,
if (kind < CORBA::TC_KIND_COUNT
&& (*tcp = __tc_consts [(u_int) kind]) != 0)
*tcp = __tc_consts [(u_int) kind];
- else
+ else if (kind == ~(CORBA::ULong)0 || kind < CORBA::TC_KIND_COUNT)
{
- if (kind == ~(CORBA::ULong)0 || kind < CORBA::TC_KIND_COUNT)
+ // Either a non-constant typecode or an indirected typecode.
+ switch (kind)
{
- // either a non-constant typecode or an indirected typecode
- switch (kind)
- {
- // Need special handling for all kinds of typecodes
- // that have nonempty parameter lists ...
- default: // error: missed a case!
- env.exception (new CORBA::INTERNAL (CORBA::COMPLETED_MAYBE));
- return CORBA::TypeCode::TRAVERSE_STOP;
+ // Need special handling for all kinds of typecodes that
+ // have nonempty parameter lists ...
+ default:
+ // Error: missed a case!
+ env.exception (new CORBA::INTERNAL (CORBA::COMPLETED_MAYBE));
+ return CORBA::TypeCode::TRAVERSE_STOP;
- // Some have "simple" parameter lists ... some of these also
- // have preallocated constants that could be used.
- case CORBA::tk_string:
- case CORBA::tk_wstring:
- {
- CORBA::ULong bound;
+ // Some have "simple" parameter lists ... some of these
+ // also have preallocated constants that could be used.
+ case CORBA::tk_string:
+ case CORBA::tk_wstring:
+ {
+ CORBA::ULong bound;
- continue_decoding = stream->get_ulong (bound);
- if (continue_decoding)
- {
- if (bound == 0)
- {
- if (kind == CORBA::tk_string)
- *tcp = CORBA::_tc_string;
- else
- *tcp = CORBA::_tc_wstring;
- }
- else
- {
- // bounded string. Save the bounds
- *tcp = new CORBA::TypeCode ((CORBA::TCKind) kind,
- bound, 0, CORBA::B_FALSE,
- parent);
- // (*tcp)->parent_ = parent;
- }
- }
- }
- 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.
- case ~0:
+ continue_decoding = stream->get_ulong (bound);
+ if (continue_decoding)
{
- if (parent_typecode == 0)
+ if (bound == 0)
{
- env.exception (new CORBA::INTERNAL (CORBA::COMPLETED_MAYBE));
- return CORBA::TypeCode::TRAVERSE_STOP;
- }
-
- // Get the long indicating the encapsulation offset,
- // then set up indirection stream that's like "stream"
- // but has space enough only for the typecode and the
- // length for the encapsulated parameters.
- CDR indir_stream;
- CORBA::Long offset;
-
- continue_decoding = stream->get_long (offset);
- if (continue_decoding)
- {
- // Since indirected typecodes cannot occur at the
- // topmost level, they can occur starting only at the
- // second and subsequent levels. This means that a
- // normal encoding of that typecode occurred somewhere
- // before in the stream. As a result the offset field
- // must always be negative. See the CORBA spec for details.
- continue_decoding = (offset < 0);
+ if (kind == CORBA::tk_string)
+ *tcp = CORBA::_tc_string;
+ else
+ *tcp = CORBA::_tc_wstring;
}
- if (continue_decoding)
+ else
{
- // the offset must be such that the indir_stream.next
- // should point to the TypeCode kind value of the
- // TypeCode to which we are referring to.
- indir_stream.setup_encapsulation
- (stream->buffer () + offset, 8);
-
- // Reject indirections outside parent's scope.
- if (indir_stream.buffer () < ACE_reinterpret_cast(char*,parent->buffer_))
- continue_decoding = CORBA::B_FALSE;
+ // Bounded string. Save the bounds
+ *tcp = new CORBA::TypeCode ((CORBA::TCKind) kind,
+ bound, 0, CORBA::B_FALSE,
+ parent);
+ // @@ Andy, is the following still necessary?
+ // If not, can we please remove it?
+ // (*tcp)->parent_ = parent;
}
+ }
+ }
+ 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.
+ case ~0:
+ {
+ if (parent_typecode == 0)
+ {
+ env.exception (new CORBA::INTERNAL (CORBA::COMPLETED_MAYBE));
+ return CORBA::TypeCode::TRAVERSE_STOP;
+ }
- // Get "kind" and length of target typecode
- //
- // XXX this currently assumes the TCKind to which we
- // indirect is the same byte order as the "parent"
- // typecode -- not the right assumption; see how the
- // TypeCode interpreter does it.
-
- CORBA::ULong indir_kind;
- CORBA::ULong indir_len;
-
- // retrieve the typecode kind
- if (continue_decoding)
- continue_decoding = indir_stream.get_ulong (indir_kind);
+ // Get the long indicating the encapsulation offset,
+ // then set up indirection stream that's like "stream"
+ // but has space enough only for the typecode and the
+ // length for the encapsulated parameters.
+ CDR indir_stream;
+ CORBA::Long offset;
- if (continue_decoding
- && indir_kind >= CORBA::TC_KIND_COUNT)
+ continue_decoding = stream->get_long (offset);
+ if (continue_decoding)
+ {
+ // Since indirected typecodes cannot occur at the
+ // topmost level, they can occur starting only at the
+ // second and subsequent levels. This means that a
+ // normal encoding of that typecode occurred somewhere
+ // before in the stream. As a result the offset field
+ // must always be negative. See the CORBA spec for details.
+ continue_decoding = (offset < 0);
+ }
+ if (continue_decoding)
+ {
+ // the offset must be such that the indir_stream.next
+ // should point to the TypeCode kind value of the
+ // TypeCode to which we are referring to.
+ indir_stream.setup_encapsulation
+ (stream->buffer () + offset, 8);
+
+ // Reject indirections outside parent's scope.
+ if (indir_stream.buffer () < ACE_reinterpret_cast(char*,parent->buffer_))
continue_decoding = CORBA::B_FALSE;
+ }
- // now retrieve the encapsulation length
- if (continue_decoding)
- continue_decoding = indir_stream.get_ulong (indir_len);
-
- // Now construct indirected typecode. This shares the
- // typecode octets with the "parent" typecode,
- // increasing the amount of memory sharing and
- // reducing the cost of getting typecodes.
- if (continue_decoding)
- {
- *tcp = new CORBA::TypeCode ((CORBA::TCKind) indir_kind,
- indir_len,
- indir_stream.buffer(),
- CORBA::B_FALSE,
- parent);
+ // Get "kind" and length of target typecode
+ //
+ // XXX this currently assumes the TCKind to which we
+ // indirect is the same byte order as the "parent"
+ // typecode -- not the right assumption; see how the
+ // TypeCode interpreter does it.
+
+ CORBA::ULong indir_kind;
+ CORBA::ULong indir_len;
+
+ // retrieve the typecode kind
+ if (continue_decoding)
+ continue_decoding = indir_stream.get_ulong (indir_kind);
+
+ if (continue_decoding
+ && indir_kind >= CORBA::TC_KIND_COUNT)
+ continue_decoding = CORBA::B_FALSE;
+
+ // now retrieve the encapsulation length
+ if (continue_decoding)
+ continue_decoding = indir_stream.get_ulong (indir_len);
+
+ // Now construct indirected typecode. This shares the
+ // typecode octets with the "parent" typecode,
+ // increasing the amount of memory sharing and
+ // reducing the cost of getting typecodes.
+ if (continue_decoding)
+ {
+ *tcp = new CORBA::TypeCode ((CORBA::TCKind) indir_kind,
+ indir_len,
+ indir_stream.buffer(),
+ CORBA::B_FALSE,
+ parent);
#if 0
- (*tcp)->parent_ = parent;
- parent->AddRef ();
+ (*tcp)->parent_ = parent;
+ parent->AddRef ();
#endif /* 0 */
- }
}
- break;
+ }
+ break;
- // The rest have "complex" parameter lists that are
- // encoded as bulk octets ...
- case CORBA::tk_objref:
- case CORBA::tk_struct:
- case CORBA::tk_union:
- case CORBA::tk_enum:
- case CORBA::tk_sequence:
- case CORBA::tk_array:
- case CORBA::tk_alias:
- case CORBA::tk_except:
- {
- CORBA::ULong length;
+ // The rest have "complex" parameter lists that are
+ // encoded as bulk octets ...
+ case CORBA::tk_objref:
+ case CORBA::tk_struct:
+ case CORBA::tk_union:
+ case CORBA::tk_enum:
+ case CORBA::tk_sequence:
+ case CORBA::tk_array:
+ case CORBA::tk_alias:
+ case CORBA::tk_except:
+ {
+ CORBA::ULong length;
#if defined(TAO_NEEDS_UNUSED_VARIABLES)
- CORBA::Octet *buffer;
+ CORBA::Octet *buffer;
#endif
- continue_decoding = stream->get_ulong (length);
- if (!continue_decoding)
- break;
+ continue_decoding = stream->get_ulong (length);
+ if (!continue_decoding)
+ break;
- // if length > MAXUNSIGNED, error ...
- u_int len = (u_int) length;
+ // if length > MAXUNSIGNED, error ...
+ u_int len = (u_int) length;
#if 0
- buffer = new CORBA::Octet[len];
+ buffer = new CORBA::Octet[len];
- for (u_int i = 0; i < len && continue_decoding; i++)
- continue_decoding = stream->get_octet (buffer [i]);
+ for (u_int i = 0; i < len && continue_decoding; i++)
+ continue_decoding = stream->get_octet (buffer [i]);
#endif
- if (!continue_decoding)
- {
- // delete [] buffer;
- break;
- }
- *tcp = new CORBA::TypeCode ((CORBA::TCKind) kind,
- len,
- stream->buffer (),
- CORBA::B_FALSE,
- parent);
- // skip length number of bytes in the stream, else we may
- // leave the stream in an undefined state
- (void) stream->rd_ptr (length);
- // (*tcp)->parent_ = parent;
+ if (!continue_decoding)
+ {
+ // delete [] buffer;
+ break;
}
- } // end of switch
- }
+ *tcp = new CORBA::TypeCode ((CORBA::TCKind) kind,
+ len,
+ stream->buffer (),
+ CORBA::B_FALSE,
+ parent);
+ // skip length number of bytes in the stream, else we may
+ // leave the stream in an undefined state
+ (void) stream->rd_ptr (length);
+ // (*tcp)->parent_ = parent;
+ }
+ } // end of switch
+ }
else // bad kind_ value to be decoded
{
env.exception (new CORBA::BAD_TYPECODE (CORBA::COMPLETED_NO));