summaryrefslogtreecommitdiff
path: root/ace
diff options
context:
space:
mode:
authorOssama Othman <ossama-othman@users.noreply.github.com>2003-04-16 07:16:40 +0000
committerOssama Othman <ossama-othman@users.noreply.github.com>2003-04-16 07:16:40 +0000
commit63602c137ac844339dcf34f258711de9930c4014 (patch)
tree4d88056968b93664a5e53a2342873c0d330fba5c /ace
parentd90f756b2f3f515fed3ec9990723cd10dbce8ece (diff)
downloadATCD-63602c137ac844339dcf34f258711de9930c4014.tar.gz
ChangeLogTag:Wed Apr 16 00:10:37 2003 Ossama Othman <ossama@uci.edu>
Diffstat (limited to 'ace')
-rw-r--r--ace/CDR_Base.cpp1
-rw-r--r--ace/CDR_Base.h241
-rw-r--r--ace/CDR_Stream.h15
-rw-r--r--ace/CDR_Stream.i19
-rw-r--r--ace/Global_Macros.h17
-rw-r--r--ace/INET_Addr.cpp3
-rw-r--r--ace/Message_Block.h72
-rw-r--r--ace/Message_Block_T.h3
-rw-r--r--ace/OS.h70
-rw-r--r--ace/OS_Memory.h48
-rw-r--r--ace/SSL/SSL_Asynch_Stream.cpp12
-rw-r--r--ace/SSL/SSL_SOCK_Stream.cpp81
-rw-r--r--ace/SSL/SSL_SOCK_Stream.i10
-rw-r--r--ace/SString.h9
-rw-r--r--ace/SStringfwd.h39
-rw-r--r--ace/String_Base.cpp23
-rw-r--r--ace/String_Base.h38
-rw-r--r--ace/String_Base.i31
18 files changed, 417 insertions, 315 deletions
diff --git a/ace/CDR_Base.cpp b/ace/CDR_Base.cpp
index 51e63f821a0..402d3b2d139 100644
--- a/ace/CDR_Base.cpp
+++ b/ace/CDR_Base.cpp
@@ -1,5 +1,6 @@
#include "ace/CDR_Base.h"
#include "ace/Message_Block.h"
+#include "ace/OS.h"
#if !defined (__ACE_INLINE__)
# include "ace/CDR_Base.inl"
diff --git a/ace/CDR_Base.h b/ace/CDR_Base.h
index aa9ad50644c..a20defb4a00 100644
--- a/ace/CDR_Base.h
+++ b/ace/CDR_Base.h
@@ -6,27 +6,27 @@
*
* $Id$
*
- * ACE Common Data Representation (CDR) basic types.
+ * ACE Common Data Representation (CDR) basic types.
*
- * The current implementation assumes that the host has 1-byte,
+ * The current implementation assumes that the host has 1-byte,
* 2-byte and 4-byte integral types, and that it has single
- * precision and double precision IEEE floats.
- * Those assumptions are pretty good these days, with Crays being
+ * precision and double precision IEEE floats.
+ * Those assumptions are pretty good these days, with Crays being
* the only known exception.
*
*
- * @author TAO version by
+ * @author TAO version by
* @author Aniruddha Gokhale <gokhale@cs.wustl.edu>
* @author Carlos O'Ryan<coryan@cs.wustl.edu>
- * @author ACE version by
+ * @author ACE version by
* @author Jeff Parsons <parsons@cs.wustl.edu>
- * @author Istvan Buki <istvan.buki@euronet.be>
+ * @author Istvan Buki <istvan.buki@euronet.be>
*/
//=============================================================================
-#ifndef ACE_CDR_BASE_H
-#define ACE_CDR_BASE_H
+#ifndef ACE_CDR_BASE_H
+#define ACE_CDR_BASE_H
#include "ace/pre.h"
@@ -34,10 +34,10 @@
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
+#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Basic_Types.h"
-#include "ace/OS.h"
+#include "ace/Default_Constants.h"
class ACE_Message_Block;
@@ -51,159 +51,172 @@ class ACE_Message_Block;
class ACE_Export ACE_CDR
{
public:
- // = Constants defined by the CDR protocol.
- // By defining as many of these constants as possible as enums we
- // ensure they get inlined and avoid pointless static memory
+ // = Constants defined by the CDR protocol.
+ // By defining as many of these constants as possible as enums we
+ // ensure they get inlined and avoid pointless static memory
// allocations.
enum
{
// Note that some of these get reused as part of the standard
- // binary format: unsigned is the same size as its signed cousin,
- // float is LONG_SIZE, and double is LONGLONG_SIZE.
+ // binary format: unsigned is the same size as its signed cousin,
+ // float is LONG_SIZE, and double is LONGLONG_SIZE.
OCTET_SIZE = 1,
SHORT_SIZE = 2,
- LONG_SIZE = 4,
+ LONG_SIZE = 4,
LONGLONG_SIZE = 8,
LONGDOUBLE_SIZE = 16,
- OCTET_ALIGN = 1,
- SHORT_ALIGN = 2,
+ OCTET_ALIGN = 1,
+ SHORT_ALIGN = 2,
LONG_ALIGN = 4,
LONGLONG_ALIGN = 8,
- /// @note the CORBA LongDouble alignment requirements do not
- /// match its size...
+ /// @note the CORBA LongDouble alignment requirements do not
+ /// match its size...
LONGDOUBLE_ALIGN = 8,
- /// Maximal CDR 1.1 alignment: "quad precision" FP (i.e. "CDR::Long
- /// double", size as above).
+ /// Maximal CDR 1.1 alignment: "quad precision" FP (i.e. "CDR::Long
+ /// double", size as above).
MAX_ALIGNMENT = 8,
- /// The default buffer size.
+ /// The default buffer size.
/**
- * @todo We want to add options to control this
- * default value, so this constant should be read as the default
- * default value ;-)
+ * @todo We want to add options to control this
+ * default value, so this constant should be read as the default
+ * default value ;-)
*/
DEFAULT_BUFSIZE = ACE_DEFAULT_CDR_BUFSIZE,
- /// The buffer size grows exponentially until it reaches this size;
- /// afterwards it grows linearly using the next constant
+ /// The buffer size grows exponentially until it reaches this size;
+ /// afterwards it grows linearly using the next constant
EXP_GROWTH_MAX = ACE_DEFAULT_CDR_EXP_GROWTH_MAX,
- /// Once exponential growth is ruled out the buffer size increases
- /// in chunks of this size, note that this constants have the same
- /// value right now, but it does not need to be so.
- LINEAR_GROWTH_CHUNK = ACE_DEFAULT_CDR_LINEAR_GROWTH_CHUNK
+ /// Once exponential growth is ruled out the buffer size increases
+ /// in chunks of this size, note that this constants have the same
+ /// value right now, but it does not need to be so.
+ LINEAR_GROWTH_CHUNK = ACE_DEFAULT_CDR_LINEAR_GROWTH_CHUNK
};
/**
- * Do byte swapping for each basic IDL type size. There exist only
+ * Do byte swapping for each basic IDL type size. There exist only
* routines to put byte, halfword (2 bytes), word (4 bytes),
- * doubleword (8 bytes) and quadword (16 byte); because those are
- * the IDL basic type sizes.
+ * doubleword (8 bytes) and quadword (16 byte); because those are
+ * the IDL basic type sizes.
*/
- static void swap_2 (const char *orig, char *target);
- static void swap_4 (const char *orig, char *target);
- static void swap_8 (const char *orig, char *target);
+ static void swap_2 (const char *orig, char *target);
+ static void swap_4 (const char *orig, char *target);
+ static void swap_8 (const char *orig, char *target);
static void swap_16 (const char *orig, char *target);
static void swap_2_array (const char *orig,
- char *target,
- size_t length);
+ char *target,
+ size_t length);
static void swap_4_array (const char *orig,
- char *target,
- size_t length);
+ char *target,
+ size_t length);
static void swap_8_array (const char *orig,
- char *target,
- size_t length);
- static void swap_16_array (const char *orig,
- char *target,
- size_t length);
+ char *target,
+ size_t length);
+ static void swap_16_array (const char *orig,
+ char *target,
+ size_t length);
- /// Align the message block to ACE_CDR::MAX_ALIGNMENT,
+ /// Align the message block to ACE_CDR::MAX_ALIGNMENT,
/// set by the CORBA spec at 8 bytes.
static void mb_align (ACE_Message_Block *mb);
/**
* Compute the size of the smallest buffer that can contain at least
* <minsize> bytes.
- * To understand how a "best fit" is computed look at the
+ * To understand how a "best fit" is computed look at the
* algorithm in the code.
- * Basically the buffers grow exponentially, up to a certain point,
- * then the buffer size grows linearly.
- * The advantage of this algorithm is that is rapidly grows to a
+ * Basically the buffers grow exponentially, up to a certain point,
+ * then the buffer size grows linearly.
+ * The advantage of this algorithm is that is rapidly grows to a
* large value, but does not explode at the end.
*/
- static size_t first_size (size_t minsize);
+ static size_t first_size (size_t minsize);
- /// Compute not the smallest, but the second smallest buffer that
+ /// Compute not the smallest, but the second smallest buffer that
/// will fir <minsize> bytes.
- static size_t next_size (size_t minsize);
+ static size_t next_size (size_t minsize);
/**
* Increase the capacity of mb to contain at least <minsize> bytes.
- * If <minsize> is zero the size is increased by an amount at least
- * large enough to contain any of the basic IDL types. Return -1 on
- * failure, 0 on success.
+ * If <minsize> is zero the size is increased by an amount at least
+ * large enough to contain any of the basic IDL types. Return -1 on
+ * failure, 0 on success.
*/
static int grow (ACE_Message_Block *mb, size_t minsize);
- /// Copy a message block chain into a single message block,
- /// preserving the alignment of the first message block of the
+ /// Copy a message block chain into a single message block,
+ /// preserving the alignment of the first message block of the
/// original stream, not the following message blocks.
static void consolidate (ACE_Message_Block *dst,
- const ACE_Message_Block *src);
+ const ACE_Message_Block *src);
- static size_t total_length (const ACE_Message_Block *begin,
- const ACE_Message_Block *end);
+ static size_t total_length (const ACE_Message_Block *begin,
+ const ACE_Message_Block *end);
- // Definitions of the IDL basic types, for use in the CDR
- // classes. The cleanest way to avoid complaints from all compilers
- // is to define them all.
-# if defined (CHORUS) && defined (ghs) && !defined (__STANDARD_CXX)
+ // Definitions of the IDL basic types, for use in the CDR
+ // classes. The cleanest way to avoid complaints from all compilers
+ // is to define them all.
+# if defined (CHORUS) && defined (ghs) && !defined (__STANDARD_CXX)
// This is non-compliant, but a nasty bout with
// Green Hills C++68000 1.8.8 forces us into it.
typedef unsigned long Boolean;
-# else /* ! (CHORUS && ghs 1.8.8) */
+# else /* ! (CHORUS && ghs 1.8.8) */
typedef unsigned char Boolean;
# endif /* ! (CHORUS && ghs 1.8.8) */
typedef unsigned char Octet;
typedef char Char;
- typedef ACE_OS::WChar WChar;
+ //@{ @name Wide-character strings
+ // @@ UNICODE: (brunsch) Can this be handled better?
+ // The following WChar typedef and functions are used by TAO. TAO
+ // does not use wchar_t because the size of wchar_t is
+ // platform-dependent. These are to be used for all
+ // manipulate\ions of CORBA::WString.
+ // @@ (othman) IMHO, it is the lesser of two evils to use the
+ // correct type for the platform rather than (forcibly) assume
+ // that all wide characters are 16 bits.
+#ifdef ACE_HAS_WCHAR
+ typedef wchar_t WChar;
+#else
+ typedef ACE_UINT16 WChar;
+#endif
typedef ACE_INT16 Short;
typedef ACE_UINT16 UShort;
typedef ACE_INT32 Long;
typedef ACE_UINT32 ULong;
typedef ACE_UINT64 ULongLong;
-# if (defined (_MSC_VER) && (_MSC_VER >= 900)) \
- || (defined (__BORLANDC__) && (__BORLANDC__ >= 0x530))
+# if (defined (_MSC_VER) && (_MSC_VER >= 900)) \
+ || (defined (__BORLANDC__) && (__BORLANDC__ >= 0x530))
typedef __int64 LongLong;
# elif ACE_SIZEOF_LONG == 8 && !defined(_CRAYMPP)
typedef long LongLong;
# elif ACE_SIZEOF_LONG_LONG == 8 && !defined (ACE_LACKS_LONGLONG_T)
-# if defined (sun) && !defined (ACE_LACKS_U_LONGLONG_T) && !defined (__KCC)
- // sun #defines u_longlong_t, maybe other platforms do also.
- // Use it, at least with g++, so that its -pedantic doesn't
- // complain about no ANSI C++ long long.
- typedef longlong_t LongLong;
+# if defined (sun) && !defined (ACE_LACKS_U_LONGLONG_T) && !defined (__KCC)
+ // sun #defines u_longlong_t, maybe other platforms do also.
+ // Use it, at least with g++, so that its -pedantic doesn't
+ // complain about no ANSI C++ long long.
+ typedef longlong_t LongLong;
# else
- // LynxOS 2.5.0 and Linux don't have u_longlong_t.
- typedef long long LongLong;
+ // LynxOS 2.5.0 and Linux don't have u_longlong_t.
+ typedef long long LongLong;
# endif /* sun */
-# else /* no native 64 bit integer type */
+# else /* no native 64 bit integer type */
# define NONNATIVE_LONGLONG
- struct ACE_Export LongLong
+ struct ACE_Export LongLong
{
# if defined (ACE_BIG_ENDIAN)
- ACE_CDR::Long h;
+ ACE_CDR::Long h;
ACE_CDR::Long l;
# else
- ACE_CDR::Long l;
+ ACE_CDR::Long l;
ACE_CDR::Long h;
-# endif /* ! ACE_BIG_ENDIAN */
+# endif /* ! ACE_BIG_ENDIAN */
/**
* @name Overloaded Relation Operators.
@@ -215,7 +228,7 @@ public:
int operator!= (const LongLong &rhs) const;
//@}
};
-# endif /* no native 64 bit integer type */
+# endif /* no native 64 bit integer type */
# if defined (NONNATIVE_LONGLONG)
# define ACE_CDR_LONGLONG_INITIALIZER {0,0}
@@ -223,24 +236,24 @@ public:
# define ACE_CDR_LONGLONG_INITIALIZER 0
# endif /* NONNATIVE_LONGLONG */
-# if ACE_SIZEOF_FLOAT == 4
+# if ACE_SIZEOF_FLOAT == 4
typedef float Float;
# else /* ACE_SIZEOF_FLOAT != 4 */
struct Float
{
-# if ACE_SIZEOF_INT == 4
- // Use unsigned int to get word alignment.
- unsigned int f;
-# else /* ACE_SIZEOF_INT != 4 */
- // Applications will probably have trouble with this.
- char f[4];
-# if defined(_UNICOS) && !defined(_CRAYMPP)
- Float (void);
- Float (const float &init);
- Float & operator= (const float &rhs);
- int operator!= (const Float &rhs) const;
-# endif /* _UNICOS */
-# endif /* ACE_SIZEOF_INT != 4 */
+# if ACE_SIZEOF_INT == 4
+ // Use unsigned int to get word alignment.
+ unsigned int f;
+# else /* ACE_SIZEOF_INT != 4 */
+ // Applications will probably have trouble with this.
+ char f[4];
+# if defined(_UNICOS) && !defined(_CRAYMPP)
+ Float (void);
+ Float (const float &init);
+ Float & operator= (const float &rhs);
+ int operator!= (const Float &rhs) const;
+# endif /* _UNICOS */
+# endif /* ACE_SIZEOF_INT != 4 */
};
# endif /* ACE_SIZEOF_FLOAT != 4 */
@@ -249,27 +262,27 @@ public:
# else /* ACE_SIZEOF_DOUBLE != 8 */
struct Double
{
-# if ACE_SIZEOF_LONG == 8
- // Use u long to get word alignment.
- unsigned long f;
-# else /* ACE_SIZEOF_INT != 8 */
- // Applications will probably have trouble with this.
- char f[8];
-# endif /* ACE_SIZEOF_INT != 8 */
+# if ACE_SIZEOF_LONG == 8
+ // Use u long to get word alignment.
+ unsigned long f;
+# else /* ACE_SIZEOF_INT != 8 */
+ // Applications will probably have trouble with this.
+ char f[8];
+# endif /* ACE_SIZEOF_INT != 8 */
};
# endif /* ACE_SIZEOF_DOUBLE != 8 */
- // 94-9-32 Appendix A defines a 128 bit floating point "long
- // double" data type, with greatly extended precision and four
+ // 94-9-32 Appendix A defines a 128 bit floating point "long
+ // double" data type, with greatly extended precision and four
// more bits of exponent (compared to "double"). This is an IDL
// extension, not yet standard.
-# if ACE_SIZEOF_LONG_DOUBLE == 16
- typedef long double LongDouble;
-# define ACE_CDR_LONG_DOUBLE_INITIALIZER 0
+# if ACE_SIZEOF_LONG_DOUBLE == 16
+ typedef long double LongDouble;
+# define ACE_CDR_LONG_DOUBLE_INITIALIZER 0
# else
# define NONNATIVE_LONGDOUBLE
-# define ACE_CDR_LONG_DOUBLE_INITIALIZER {{0}}
+# define ACE_CDR_LONG_DOUBLE_INITIALIZER {{0}}
struct ACE_Export LongDouble
{
char ld[16];
@@ -277,7 +290,7 @@ public:
int operator!= (const LongDouble &rhs) const;
// @@ also need other comparison operators.
};
-# endif /* ACE_SIZEOF_LONG_DOUBLE != 16 */
+# endif /* ACE_SIZEOF_LONG_DOUBLE != 16 */
#if !defined (ACE_CDR_GIOP_MAJOR_VERSION)
# define ACE_CDR_GIOP_MAJOR_VERSION 1
@@ -290,7 +303,7 @@ public:
#if defined (__ACE_INLINE__)
# include "ace/CDR_Base.inl"
-#endif /* __ACE_INLINE__ */
+#endif /* __ACE_INLINE__ */
#include "ace/post.h"
diff --git a/ace/CDR_Stream.h b/ace/CDR_Stream.h
index dd4983c99a6..dad0d9f6ea5 100644
--- a/ace/CDR_Stream.h
+++ b/ace/CDR_Stream.h
@@ -19,14 +19,11 @@
* Those assumptions are pretty good these days, with Crays beign
* the only known exception.
*
- * @author TAO version by
- * @author Aniruddha Gokhale <gokhale@cs.wustl.edu>
- * @author Carlos O'Ryan<coryan@cs.wustl.edu>
- * @author ACE version by
- * @author Jeff Parsons <parsons@cs.wustl.edu>
+ * @author TAO version by Aniruddha Gokhale <gokhale@cs.wustl.edu>
+ * @author Carlos O'Ryan <coryan@cs.wustl.edu>
+ * @author ACE version by Jeff Parsons <parsons@cs.wustl.edu>
* @author Istvan Buki <istvan.buki@euronet.be>
- * @author Codeset translation by
- * @author Jim Rogers <jrogers@viasoft.com>
+ * @author Codeset translation by Jim Rogers <jrogers@viasoft.com>
*/
//=============================================================================
@@ -41,7 +38,9 @@
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
-#include "ace/SString.h"
+#include "ace/SStringfwd.h"
+#include "ace/OS_Memory.h"
+#include "ace/OS_String.h"
#include "ace/Message_Block.h"
diff --git a/ace/CDR_Stream.i b/ace/CDR_Stream.i
index 61b97320915..fc018de19c7 100644
--- a/ace/CDR_Stream.i
+++ b/ace/CDR_Stream.i
@@ -1,4 +1,5 @@
// -*- C++ -*-
+//
// $Id$
// ****************************************************************
@@ -258,7 +259,7 @@ ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_wstring (const ACE_CDR::WChar *x)
{
if (x != 0)
- return this->write_wstring (ACE_OS::wslen (x), x);
+ return this->write_wstring (ACE_OS_String::strlen (x), x);
return this->write_wstring (0, 0);
}
@@ -670,11 +671,11 @@ ACE_InputCDR::read_wchar_array (ACE_CDR::WChar* x,
if (ACE_OutputCDR::wchar_maxbytes_ != sizeof (ACE_CDR::WChar))
return this->read_wchar_array_i (x, length);
return this->read_array (x,
- sizeof (ACE_CDR::WChar),
- sizeof (ACE_CDR::WChar) == 2
- ? ACE_CDR::SHORT_ALIGN
- : ACE_CDR::LONG_ALIGN,
- length);
+ sizeof (ACE_CDR::WChar),
+ sizeof (ACE_CDR::WChar) == 2
+ ? ACE_CDR::SHORT_ALIGN
+ : ACE_CDR::LONG_ALIGN,
+ length);
}
ACE_INLINE ACE_CDR::Boolean
@@ -1134,7 +1135,7 @@ operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_wstring x)
{
ACE_CDR::ULong len = 0;;
if (x.val_ != 0)
- len = ACE_OS::wslen (x.val_);
+ len = ACE_OS_String::strlen (x.val_);
os.write_wstring (len, x.val_);
return os.good_bit () && (len <= x.bound_);
}
@@ -1260,7 +1261,7 @@ operator>> (ACE_InputCDR &is, ACE_InputCDR::to_string x)
is.read_string (ACE_const_cast (char *&, x.val_));
// check if the bounds are satisfied
return (is.good_bit () &&
- (ACE_OS::strlen (x.val_) <= x.bound_));
+ (ACE_OS_String::strlen (x.val_) <= x.bound_));
}
ACE_INLINE ACE_CDR::Boolean
@@ -1269,7 +1270,7 @@ operator>> (ACE_InputCDR &is, ACE_InputCDR::to_wstring x)
is.read_wstring (ACE_const_cast (ACE_CDR::WChar *&, x.val_));
// check if the bounds are satisfied
return (is.good_bit () &&
- (ACE_OS::wslen (x.val_) <= x.bound_));
+ (ACE_OS_String::strlen (x.val_) <= x.bound_));
}
// ***************************************************************************
diff --git a/ace/Global_Macros.h b/ace/Global_Macros.h
index 15a1b697295..7c0f3403307 100644
--- a/ace/Global_Macros.h
+++ b/ace/Global_Macros.h
@@ -103,6 +103,23 @@ friend class ace_dewarn_gplusplus
// ----------------------------------------------------------------
+#if defined (ACE_HAS_NO_THROW_SPEC)
+# define ACE_THROW_SPEC(X)
+#else
+# if defined (ACE_HAS_EXCEPTIONS)
+# define ACE_THROW_SPEC(X) throw X
+# if defined (ACE_WIN32) && defined(_MSC_VER) && !defined (ghs)
+// @@ MSVC "supports" the keyword but doesn't implement it (Huh?).
+// Therefore, we simply supress the warning for now.
+# pragma warning( disable : 4290 )
+# endif /* ACE_WIN32 */
+# else /* ! ACE_HAS_EXCEPTIONS */
+# define ACE_THROW_SPEC(X)
+# endif /* ! ACE_HAS_EXCEPTIONS */
+#endif /*ACE_HAS_NO_THROW_SPEC*/
+
+// ----------------------------------------------------------------
+
// Deal with MSVC++ 6 (or less) insanity for CORBA...
# if defined (ACE_HAS_BROKEN_NAMESPACES)
# define ACE_CORBA_1(NAME) CORBA_##NAME
diff --git a/ace/INET_Addr.cpp b/ace/INET_Addr.cpp
index ac5d28f2c2f..a95818359d7 100644
--- a/ace/INET_Addr.cpp
+++ b/ace/INET_Addr.cpp
@@ -883,6 +883,9 @@ ACE_INET_Addr::get_host_addr (char *dst, int size) const
#endif /* ACE_HAS_IPV6 */
#if defined (VXWORKS)
+ ACE_UNUSED_ARG (dst);
+ ACE_UNUSED_ARG (size);
+
// It would be nice to be able to encapsulate this into
// ACE_OS::inet_ntoa(), but that would lead to either inefficiencies
// on vxworks or lack of thread safety.
diff --git a/ace/Message_Block.h b/ace/Message_Block.h
index a6a7aa424ff..fd0997a69e5 100644
--- a/ace/Message_Block.h
+++ b/ace/Message_Block.h
@@ -21,8 +21,11 @@
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
-#include "ace/OS.h"
+#include "ace/Default_Constants.h"
+#include "ace/Global_Macros.h"
+#include "ace/Time_Value.h"
+#include <stdlib.h>
// Forward declaration.
class ACE_Allocator;
@@ -112,7 +115,7 @@ public:
};
typedef int ACE_Message_Type;
- typedef u_long Message_Flags;
+ typedef unsigned long Message_Flags;
enum
{
@@ -145,7 +148,7 @@ public:
*/
ACE_Message_Block (const char *data,
size_t size = 0,
- u_long priority = ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY);
+ unsigned long priority = ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY);
/**
* Create an initialized message of type <type> containing <size>
@@ -176,7 +179,7 @@ public:
const char *data = 0,
ACE_Allocator *allocator_strategy = 0,
ACE_Lock *locking_strategy = 0,
- u_long priority = ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY,
+ unsigned long priority = ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY,
const ACE_Time_Value &execution_time = ACE_Time_Value::zero,
const ACE_Time_Value &deadline_time = ACE_Time_Value::max_time,
ACE_Allocator *data_block_allocator = 0,
@@ -226,7 +229,7 @@ public:
const char *data = 0,
ACE_Allocator *allocator_strategy = 0,
ACE_Lock *locking_strategy = 0,
- u_long priority = ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY,
+ unsigned long priority = ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY,
const ACE_Time_Value &execution_time = ACE_Time_Value::zero,
const ACE_Time_Value &deadline_time = ACE_Time_Value::max_time,
ACE_Allocator *data_block_allocator = 0,
@@ -285,10 +288,10 @@ public:
Message_Flags self_flags (void) const;
/// Get priority of the message.
- u_long msg_priority (void) const;
+ unsigned long msg_priority (void) const;
/// Set priority of the message.
- void msg_priority (u_long priority);
+ void msg_priority (unsigned long priority);
/// Get execution time associated with the message.
const ACE_Time_Value &msg_execution_time (void) const;
@@ -585,7 +588,7 @@ protected:
ACE_Allocator *allocator_strategy,
ACE_Lock *locking_strategy,
Message_Flags flags,
- u_long priority,
+ unsigned long priority,
const ACE_Time_Value &execution_time,
const ACE_Time_Value &deadline_time,
ACE_Data_Block *db,
@@ -604,7 +607,7 @@ protected:
ACE_Allocator *allocator_strategy,
ACE_Lock *locking_strategy,
Message_Flags flags,
- u_long priority,
+ unsigned long priority,
const ACE_Time_Value &execution_time,
const ACE_Time_Value &deadline_time,
ACE_Data_Block *db,
@@ -618,7 +621,7 @@ protected:
size_t wr_ptr_;
/// Priority of message.
- u_long priority_;
+ unsigned long priority_;
#if defined (ACE_HAS_TIMED_MESSAGE_BLOCKS)
/// Execution time associated with the message.
@@ -886,10 +889,10 @@ public:
};
/// Constructor.
- ACE_Dynamic_Message_Strategy (u_long static_bit_field_mask,
- u_long static_bit_field_shift,
- u_long dynamic_priority_max,
- u_long dynamic_priority_offset);
+ ACE_Dynamic_Message_Strategy (unsigned long static_bit_field_mask,
+ unsigned long static_bit_field_shift,
+ unsigned long dynamic_priority_max,
+ unsigned long dynamic_priority_offset);
/// Virtual destructor.
virtual ~ACE_Dynamic_Message_Strategy (void);
@@ -899,28 +902,28 @@ public:
const ACE_Time_Value &tv);
/// Get static bit field mask.
- u_long static_bit_field_mask (void) const;
+ unsigned long static_bit_field_mask (void) const;
/// Set static bit field mask.
- void static_bit_field_mask (u_long);
+ void static_bit_field_mask (unsigned long);
/// Get left shift value to make room for static bit field.
- u_long static_bit_field_shift (void) const;
+ unsigned long static_bit_field_shift (void) const;
/// Set left shift value to make room for static bit field.
- void static_bit_field_shift (u_long);
+ void static_bit_field_shift (unsigned long);
/// Get maximum supported priority value.
- u_long dynamic_priority_max (void) const;
+ unsigned long dynamic_priority_max (void) const;
/// Set maximum supported priority value.
- void dynamic_priority_max (u_long);
+ void dynamic_priority_max (unsigned long);
/// Get offset to boundary between signed range and unsigned range.
- u_long dynamic_priority_offset (void) const;
+ unsigned long dynamic_priority_offset (void) const;
/// Set offset to boundary between signed range and unsigned range.
- void dynamic_priority_offset (u_long);
+ void dynamic_priority_offset (unsigned long);
/// Dump the state of the strategy.
virtual void dump (void) const;
@@ -931,20 +934,20 @@ protected:
const ACE_Message_Block &mb) = 0;
/// This is a bit mask with all ones in the static bit field.
- u_long static_bit_field_mask_;
+ unsigned long static_bit_field_mask_;
/**
* This is a left shift value to make room for static bit field:
* this value should be the logarithm base 2 of
* (static_bit_field_mask_ + 1).
*/
- u_long static_bit_field_shift_;
+ unsigned long static_bit_field_shift_;
/// Maximum supported priority value.
- u_long dynamic_priority_max_;
+ unsigned long dynamic_priority_max_;
/// Offset to boundary between signed range and unsigned range.
- u_long dynamic_priority_offset_;
+ unsigned long dynamic_priority_offset_;
/// Maximum late time value that can be represented.
ACE_Time_Value max_late_;
@@ -974,10 +977,10 @@ class ACE_Export ACE_Deadline_Message_Strategy : public ACE_Dynamic_Message_Stra
{
public:
/// Ctor, with all arguments defaulted.
- ACE_Deadline_Message_Strategy (u_long static_bit_field_mask = 0x3FFUL, // 2^(10) - 1
- u_long static_bit_field_shift = 10, // 10 low order bits
- u_long dynamic_priority_max = 0x3FFFFFUL, // 2^(22)-1
- u_long dynamic_priority_offset = 0x200000UL); // 2^(22-1)
+ ACE_Deadline_Message_Strategy (unsigned long static_bit_field_mask = 0x3FFUL, // 2^(10) - 1
+ unsigned long static_bit_field_shift = 10, // 10 low order bits
+ unsigned long dynamic_priority_max = 0x3FFFFFUL, // 2^(22)-1
+ unsigned long dynamic_priority_offset = 0x200000UL); // 2^(22-1)
/// Virtual dtor.
virtual ~ACE_Deadline_Message_Strategy (void);
@@ -1009,10 +1012,10 @@ class ACE_Export ACE_Laxity_Message_Strategy : public ACE_Dynamic_Message_Strate
{
public:
/// Ctor, with all arguments defaulted.
- ACE_Laxity_Message_Strategy (u_long static_bit_field_mask = 0x3FFUL, // 2^(10) - 1
- u_long static_bit_field_shift = 10, // 10 low order bits
- u_long dynamic_priority_max = 0x3FFFFFUL, // 2^(22)-1
- u_long dynamic_priority_offset = 0x200000UL); // 2^(22-1)
+ ACE_Laxity_Message_Strategy (unsigned long static_bit_field_mask = 0x3FFUL, // 2^(10) - 1
+ unsigned long static_bit_field_shift = 10, // 10 low order bits
+ unsigned long dynamic_priority_max = 0x3FFFFFUL, // 2^(22)-1
+ unsigned long dynamic_priority_offset = 0x200000UL); // 2^(22-1)
/// virtual dtor.
virtual ~ACE_Laxity_Message_Strategy (void);
@@ -1030,6 +1033,7 @@ public:
#endif /* __ACE_INLINE__ */
#include "ace/Message_Block_T.h"
+
#include "ace/post.h"
#endif /* ACE_MESSAGE_BLOCK_H */
diff --git a/ace/Message_Block_T.h b/ace/Message_Block_T.h
index f3007e364b9..cfcf22eeccf 100644
--- a/ace/Message_Block_T.h
+++ b/ace/Message_Block_T.h
@@ -6,7 +6,8 @@
*
* $Id$
*
- * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> and Carlos O'Ryan <coryan@uci.edu>
+ * @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
+ * @author Carlos O'Ryan <coryan@atdesk.com>
*/
//=============================================================================
diff --git a/ace/OS.h b/ace/OS.h
index 583c9d1626a..7b81d92347c 100644
--- a/ace/OS.h
+++ b/ace/OS.h
@@ -1338,22 +1338,6 @@ struct stat
# endif
# endif /* ACE_HAS_WINCE */
-
-#if defined (ACE_HAS_NO_THROW_SPEC)
-# define ACE_THROW_SPEC(X)
-#else
-# if defined (ACE_HAS_EXCEPTIONS)
-# define ACE_THROW_SPEC(X) throw X
-# if defined (ACE_WIN32) && defined(_MSC_VER) && !defined (ghs)
-// @@ MSVC "supports" the keyword but doesn't implement it (Huh?).
-// Therefore, we simply supress the warning for now.
-# pragma warning( disable : 4290 )
-# endif /* ACE_WIN32 */
-# else /* ! ACE_HAS_EXCEPTIONS */
-# define ACE_THROW_SPEC(X)
-# endif /* ! ACE_HAS_EXCEPTIONS */
-#endif /*ACE_HAS_NO_THROW_SPEC*/
-
#if !defined (ACE_LACKS_UNISTD_H)
# include /**/ <unistd.h>
#endif /* ACE_LACKS_UNISTD_H */
@@ -5787,6 +5771,11 @@ public:
// @@ (othman) IMHO, it is the lesser of two evils to use the
// correct type for the platform rather than (forcibly) assume
// that all wide characters are 16 bits.
+ /**
+ * @todo Move this typedef to a separate file so as not to have the
+ * same typedefs duplicated in multiple headers
+ * (e.g. CDR_Base.h).
+ */
#if defined (ACE_HAS_WCHAR) || defined (ACE_HAS_XPG4_MULTIBYTE_CHAR)
typedef wchar_t WChar;
#else
@@ -7082,55 +7071,6 @@ typedef ACE_TRANSMIT_FILE_BUFFERS* ACE_LPTRANSMIT_FILE_BUFFERS;
*/
// #define ACE_DISABLE_SWAP_ON_READ
-
-//@{
-/**
- * @name Efficiently compute aligned pointers to powers of 2 boundaries.
- */
-
-/**
- * Efficiently align "value" up to "alignment", knowing that all such
- * boundaries are binary powers and that we're using two's complement
- * arithmetic.
- *
- * Since the alignment is a power of two its binary representation is:
- *
- * alignment = 0...010...0
- *
- * hence
- *
- * alignment - 1 = 0...001...1 = T1
- *
- * so the complement is:
- *
- * ~(alignment - 1) = 1...110...0 = T2
- *
- * Notice that there is a multiple of <alignment> in the range
- * [<value>,<value> + T1], also notice that if
- *
- * X = ( <value> + T1 ) & T2
- *
- * then
- *
- * <value> <= X <= <value> + T1
- *
- * because the & operator only changes the last bits, and since X is a
- * multiple of <alignment> (its last bits are zero) we have found the
- * multiple we wanted.
- */
-/// Return the next integer aligned to a required boundary
-/**
- * @param ptr the base pointer
- * @param alignment the required alignment
- */
-#define ACE_align_binary(ptr, alignment) \
- ((ptr + ((ptr_arith_t)((alignment)-1))) & (~((ptrdiff_t)((alignment)-1))))
-
-/// Return the next address aligned to a required boundary
-#define ACE_ptr_align_binary(ptr, alignment) \
- ((char *) ACE_align_binary (((ptrdiff_t) (ptr)), (alignment)))
-//@}
-
// Defining POSIX4 real-time signal range.
#if defined(ACE_HAS_POSIX_REALTIME_SIGNALS)
#define ACE_SIGRTMIN SIGRTMIN
diff --git a/ace/OS_Memory.h b/ace/OS_Memory.h
index 4fda98c1867..aad6cc2657b 100644
--- a/ace/OS_Memory.h
+++ b/ace/OS_Memory.h
@@ -187,6 +187,54 @@ typedef void *ACE_MALLOC_T;
#endif /* ACE_NEW_THROWS_EXCEPTIONS */
+//@{
+/**
+ * @name Efficiently compute aligned pointers to powers of 2 boundaries.
+ */
+
+/**
+ * Efficiently align "value" up to "alignment", knowing that all such
+ * boundaries are binary powers and that we're using two's complement
+ * arithmetic.
+ *
+ * Since the alignment is a power of two its binary representation is:
+ *
+ * alignment = 0...010...0
+ *
+ * hence
+ *
+ * alignment - 1 = 0...001...1 = T1
+ *
+ * so the complement is:
+ *
+ * ~(alignment - 1) = 1...110...0 = T2
+ *
+ * Notice that there is a multiple of <alignment> in the range
+ * [<value>,<value> + T1], also notice that if
+ *
+ * X = ( <value> + T1 ) & T2
+ *
+ * then
+ *
+ * <value> <= X <= <value> + T1
+ *
+ * because the & operator only changes the last bits, and since X is a
+ * multiple of <alignment> (its last bits are zero) we have found the
+ * multiple we wanted.
+ */
+/// Return the next integer aligned to a required boundary
+/**
+ * @param ptr the base pointer
+ * @param alignment the required alignment
+ */
+#define ACE_align_binary(ptr, alignment) \
+ ((ptr + ((ptr_arith_t)((alignment)-1))) & (~((ptrdiff_t)((alignment)-1))))
+
+/// Return the next address aligned to a required boundary
+#define ACE_ptr_align_binary(ptr, alignment) \
+ ((char *) ACE_align_binary (((ptrdiff_t) (ptr)), (alignment)))
+//@}
+
/**
* @class ACE_OS_Memory
*
diff --git a/ace/SSL/SSL_Asynch_Stream.cpp b/ace/SSL/SSL_Asynch_Stream.cpp
index 160b86a466b..8978452dc7c 100644
--- a/ace/SSL/SSL_Asynch_Stream.cpp
+++ b/ace/SSL/SSL_Asynch_Stream.cpp
@@ -638,9 +638,9 @@ ACE_SSL_Asynch_Stream::do_SSL_read (void)
ACE_Message_Block & mb = this->ext_read_result_->message_block ();
size_t bytes_req = this->ext_read_result_->bytes_to_read ();
- int bytes_trn = ::SSL_read (this->ssl_,
- mb.rd_ptr (),
- bytes_req);
+ const int bytes_trn = ::SSL_read (this->ssl_,
+ mb.wr_ptr (),
+ bytes_req);
int status = ::SSL_get_error (this->ssl_, bytes_trn);
@@ -695,9 +695,9 @@ ACE_SSL_Asynch_Stream::do_SSL_write (void)
ACE_Message_Block & mb = this->ext_write_result_->message_block ();
size_t bytes_req = this->ext_write_result_->bytes_to_write ();
- int bytes_trn = ::SSL_write (this->ssl_,
- mb.rd_ptr (),
- bytes_req);
+ const int bytes_trn = ::SSL_write (this->ssl_,
+ mb.rd_ptr (),
+ bytes_req);
int status = ::SSL_get_error (this->ssl_, bytes_trn);
diff --git a/ace/SSL/SSL_SOCK_Stream.cpp b/ace/SSL/SSL_SOCK_Stream.cpp
index 578051416d9..f7189463360 100644
--- a/ace/SSL/SSL_SOCK_Stream.cpp
+++ b/ace/SSL/SSL_SOCK_Stream.cpp
@@ -89,9 +89,9 @@ ACE_SSL_SOCK_Stream::sendv (const iovec iov[],
for (size_t i = 0; i < n; ++i)
{
- ssize_t result = this->send (iov[i].iov_base,
- iov[i].iov_len,
- timeout);
+ const ssize_t result = this->send (iov[i].iov_base,
+ iov[i].iov_len,
+ timeout);
if (result == -1)
{
@@ -99,7 +99,6 @@ ACE_SSL_SOCK_Stream::sendv (const iovec iov[],
// whether or not any data was sent. If no data was sent,
// then always return -1. Otherwise return bytes_sent.
// This gives the caller an opportunity to keep track of
- // which data was actually sent.
if (bytes_sent > 0)
break;
else
@@ -224,7 +223,7 @@ ACE_SSL_SOCK_Stream::send (size_t n, ...) const
{
ACE_TRACE ("ACE_SSL_SOCK_Stream::send");
- size_t total_tuples = n / 2;
+ const size_t total_tuples = n / 2;
va_list argp;
va_start (argp, n);
@@ -238,8 +237,9 @@ ACE_SSL_SOCK_Stream::send (size_t n, ...) const
// scatter writes over SSL.
for (size_t i = 0; i < total_tuples; ++i)
{
- ssize_t result = this->send (va_arg (argp, char *),
- va_arg (argp, ssize_t));
+ const ssize_t data_len = va_arg (argp, ssize_t);
+ const ssize_t result = this->send (va_arg (argp, char *),
+ data_len);
if (result == -1)
{
@@ -257,7 +257,18 @@ ACE_SSL_SOCK_Stream::send (size_t n, ...) const
}
}
else
- bytes_sent += result;
+ {
+ bytes_sent += result;
+
+ // Do not continue on to the next loop iteration if the
+ // amount of data sent was less than the amount of data
+ // given. This avoids a subtle problem where "holes" in the
+ // data stream would occur if partial sends of a given
+ // buffer in the varargs occured.
+ if (result < data_len)
+ break;
+
+ }
}
va_end (argp);
@@ -270,7 +281,7 @@ ACE_SSL_SOCK_Stream::recv (size_t n, ...) const
{
ACE_TRACE ("ACE_SSL_SOCK_Stream::recv");
- size_t total_tuples = n / 2;
+ const size_t total_tuples = n / 2;
va_list argp;
va_start (argp, n);
@@ -279,8 +290,9 @@ ACE_SSL_SOCK_Stream::recv (size_t n, ...) const
for (size_t i = 0; i < total_tuples; ++i)
{
- ssize_t result = this->recv (va_arg (argp, char *),
- va_arg (argp, ssize_t));
+ const ssize_t data_len = va_arg (argp, ssize_t);
+ const ssize_t result = this->recv (va_arg (argp, char *),
+ data_len);
if (result == -1)
{
@@ -298,7 +310,18 @@ ACE_SSL_SOCK_Stream::recv (size_t n, ...) const
}
}
else
- bytes_recv += result;
+ {
+ bytes_recv += result;
+
+ // Do not continue on to the next loop iteration if the
+ // amount of data received was less than the amount of data
+ // desired. This avoids a subtle problem where "holes" in
+ // the data stream would occur if partial receives of a
+ // given buffer in the varargs occured.
+ if (result < data_len)
+ break;
+
+ }
}
va_end (argp);
@@ -337,16 +360,16 @@ ACE_SSL_SOCK_Stream::send_n (const void *buf,
timeout);
if (n < 0)
- {
+ {
if (errno == EWOULDBLOCK)
{
// If blocked, try again.
- n = 0;
- continue;
+ n = 0;
+ continue;
}
else
return -1;
- }
+ }
else if (n == 0)
break;
}
@@ -384,16 +407,16 @@ ACE_SSL_SOCK_Stream::recv_n (void *buf,
timeout);
if (n < 0)
- {
+ {
if (errno == EWOULDBLOCK)
{
// If blocked, try again.
- n = 0;
- continue;
+ n = 0;
+ continue;
}
else
return -1;
- }
+ }
else if (n == 0)
break;
}
@@ -424,18 +447,18 @@ ACE_SSL_SOCK_Stream::recv_n (void *buf, int len, int flags) const
flags);
if (n < 0)
- {
+ {
if (errno == EWOULDBLOCK)
{
// If blocked, try again.
- n = 0;
- continue;
+ n = 0;
+ continue;
}
else
return -1;
- }
+ }
else if (n == 0)
- break;
+ break;
}
return bytes_transferred;
@@ -463,16 +486,16 @@ ACE_SSL_SOCK_Stream::send_n (const void *buf, int len, int flags) const
flags);
if (n < 0)
- {
+ {
if (errno == EWOULDBLOCK)
{
// If blocked, try again.
- n = 0;
- continue;
+ n = 0;
+ continue;
}
else
return -1;
- }
+ }
else if (n == 0)
break;
}
diff --git a/ace/SSL/SSL_SOCK_Stream.i b/ace/SSL/SSL_SOCK_Stream.i
index 4cbd184837a..ea345cbe921 100644
--- a/ace/SSL/SSL_SOCK_Stream.i
+++ b/ace/SSL/SSL_SOCK_Stream.i
@@ -31,9 +31,9 @@ ACE_SSL_SOCK_Stream::send_i (const void *buf,
if (flags != 0)
ACE_NOTSUP_RETURN (-1);
- int bytes_sent = ::SSL_write (this->ssl_,
- ACE_static_cast (const char *, buf),
- n);
+ const int bytes_sent = ::SSL_write (this->ssl_,
+ ACE_static_cast (const char *, buf),
+ n);
switch (::SSL_get_error (this->ssl_, bytes_sent))
{
@@ -137,7 +137,7 @@ ACE_SSL_SOCK_Stream::recv_i (void *buf,
n);
}
- int status = ::SSL_get_error (this->ssl_, bytes_read);
+ const int status = ::SSL_get_error (this->ssl_, bytes_read);
switch (status)
{
case SSL_ERROR_NONE:
@@ -271,7 +271,7 @@ ACE_SSL_SOCK_Stream::close (void)
// SSL_shutdown() returns 1 on successful shutdown of the SSL
// connection, not 0.
- int status = ::SSL_shutdown (this->ssl_);
+ const int status = ::SSL_shutdown (this->ssl_);
switch (::SSL_get_error (this->ssl_, status))
{
diff --git a/ace/SString.h b/ace/SString.h
index 0454c2ceef8..b0b5005613c 100644
--- a/ace/SString.h
+++ b/ace/SString.h
@@ -14,22 +14,19 @@
#define ACE_SSTRING_H
#include "ace/pre.h"
-#include "ace/String_Base.h"
+#include "ace/SStringfwd.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
-typedef ACE_WCHAR_T ACE_WSTRING_TYPE;
+#include "ace/String_Base.h"
+
#if !defined (ACE_DEFAULT_GROWSIZE)
#define ACE_DEFAULT_GROWSIZE 32
#endif /* ACE_DEFAULT_GROWSIZE */
-typedef ACE_String_Base<char> ACE_CString;
-
-typedef ACE_String_Base<ACE_WSTRING_TYPE> ACE_WString;
-
#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
ACE_Export ACE_OSTREAM_TYPE &operator << (ACE_OSTREAM_TYPE &, const ACE_CString &);
ACE_Export ACE_OSTREAM_TYPE &operator << (ACE_OSTREAM_TYPE &, const ACE_WString &);
diff --git a/ace/SStringfwd.h b/ace/SStringfwd.h
new file mode 100644
index 00000000000..08f4a08d1df
--- /dev/null
+++ b/ace/SStringfwd.h
@@ -0,0 +1,39 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file SStringfwd.h
+ *
+ * $Id$
+ *
+ * Forward declarations and typedefs of ACE string types.
+ *
+ * @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
+ * @author Nanbor Wang <nanbor@cs.wustl.edu>
+ * @author Ossama Othman <ossama@uci.edu>
+ */
+//=============================================================================
+
+#ifndef ACE_SSTRINGFWD_H
+#define ACE_SSTRINGFWD_H
+
+#include "ace/pre.h"
+
+#include "ace/Basic_Types.h" /* ACE_WCHAR_T definition */
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+
+template <class T> class ACE_String_Base; // Forward declaration.
+
+typedef ACE_WCHAR_T ACE_WSTRING_TYPE;
+
+typedef ACE_String_Base<char> ACE_CString;
+typedef ACE_String_Base<ACE_WSTRING_TYPE> ACE_WString;
+
+
+#include "ace/post.h"
+
+#endif /* ACE_SSTRINGFWD_H */
diff --git a/ace/String_Base.cpp b/ace/String_Base.cpp
index e5e8bec0e67..43e457d24fc 100644
--- a/ace/String_Base.cpp
+++ b/ace/String_Base.cpp
@@ -1,5 +1,7 @@
-// $Id$
+#ifndef ACE_STRING_BASE_CPP
+#define ACE_STRING_BASE_CPP
+#include "ace/ACE.h"
#include "ace/Malloc.h"
#include "ace/String_Base.h"
#include "ace/Auto_Ptr.h"
@@ -12,7 +14,11 @@
#include "ace/String_Base.i"
#endif /* __ACE_INLINE__ */
-ACE_RCSID(ace, String_Base, "String_Base.cpp,v 4.61 2001/03/04 00:55:30 brunsch Exp")
+
+ACE_RCSID (ace,
+ String_Base,
+ "$Id$")
+
ACE_ALLOC_HOOK_DEFINE(ACE_String_Base)
@@ -93,7 +99,7 @@ ACE_String_Base<CHAR>::substring (size_t offset,
// case 1. empty string
if (this->len_ == 0)
return nill;
-
+
// case 2. start pos past our end
if (offset >= this->len_)
return nill;
@@ -160,6 +166,15 @@ ACE_String_Base<CHAR>::operator+= (const ACE_String_Base<CHAR> &s)
return *this;
}
+template <class CHAR> u_long
+ACE_String_Base<CHAR>::hash (void) const
+{
+ return ACE::hash_pjw ((ACE_reinterpret_cast (char *,
+ ACE_const_cast (CHAR *,
+ this->rep_))),
+ this->len_ * sizeof (CHAR));
+}
+
template <class CHAR> void
ACE_String_Base<CHAR>::resize (size_t len, CHAR c)
{
@@ -181,3 +196,5 @@ ACE_String_Base<CHAR>::resize (size_t len, CHAR c)
c,
this->buf_len_ * sizeof (CHAR));
}
+
+#endif /* ACE_STRING_BASE_CPP */
diff --git a/ace/String_Base.h b/ace/String_Base.h
index ff86f26a44c..8856be1dba0 100644
--- a/ace/String_Base.h
+++ b/ace/String_Base.h
@@ -1,4 +1,4 @@
-/* -*- C++ -*- */
+// -*- C++ -*-
//=============================================================================
/**
@@ -13,15 +13,20 @@
#ifndef ACE_STRING_BASE_H
#define ACE_STRING_BASE_H
+
#include "ace/pre.h"
-#include "ace/ACE.h"
#include "ace/String_Base_Const.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+#include "ace/Global_Macros.h"
+#include "ace/OS_String.h"
+#include "ace/OS_Memory.h"
+
+
// Forward decl.
class ACE_Allocator;
@@ -63,7 +68,7 @@ public:
* @param s Zero terminated input string
* @param alloc ACE_Allocator associated with string
* @param release Allocator responsible(1)/not reponsible(0) for
- * freeing memory.
+ * freeing memory.
* @return ACE_String_Base containing const CHAR *s
*/
ACE_String_Base (const CHAR * s,
@@ -80,7 +85,7 @@ public:
* @param len Length of non-zero terminated input string
* @param alloc ACE_Allocator associated with string
* @param release Allocator responsible(1)/not reponsible(0) for
- * freeing memory.
+ * freeing memory.
* @return ACE_String_Base containing const CHAR *s
*/
ACE_String_Base (const CHAR * s,
@@ -164,7 +169,7 @@ public:
*
* @param s Null terminated input string
* @param release Allocator responsible(1)/not reponsible(0) for
- * freeing memory.
+ * freeing memory.
*/
void set (const CHAR * s, int release = 1);
@@ -175,7 +180,7 @@ public:
* @param s Non-zero terminated input string
* @param len Length of input string 's'
* @param release Allocator responsible(1)/not reponsible(0) for
- * freeing memory.
+ * freeing memory.
*/
void set (const CHAR * s, size_t len, int release);
@@ -212,7 +217,7 @@ public:
*
* @param s Input ACE_String_Base string to concatenate to another string.
* @return The combined string (input append to the end of the old). New
- * string is zero terminated.
+ * string is zero terminated.
*/
ACE_String_Base < CHAR > &operator += (const ACE_String_Base < CHAR > &s);
@@ -238,7 +243,7 @@ public:
* the memory when finished; use delete []
*
* @return Pointer reference to the string data. Returned string is
- * zero terminated.
+ * zero terminated.
*/
CHAR *rep (void) const;
@@ -248,7 +253,7 @@ public:
* if it has length 0!
*
* @return Pointer reference to the stored string data. No guarantee is
- * that the string is zero terminated.
+ * that the string is zero terminated.
*
*/
const CHAR *fast_rep (void) const;
@@ -264,7 +269,7 @@ public:
*
* @param s Input ACE_String_Base string
* @return Integer index value of the first location of string @a s or
- * -1 (not found).
+ * -1 (not found).
*/
ssize_t strstr (const ACE_String_Base<CHAR> &s) const;
@@ -347,7 +352,7 @@ public:
*
* @param s Input ACE_String_Base string to compare against stored string.
* @return Integer value of result (less than 0, 0, greater than 0)
- * depending on how input string @a s is to the stored string.
+ * depending on how input string @a s is to the stored string.
*/
int compare (const ACE_String_Base<CHAR> &s) const;
@@ -407,21 +412,21 @@ protected:
template < class CHAR > ACE_INLINE
ACE_String_Base < CHAR > operator + (const ACE_String_Base < CHAR > &,
- const ACE_String_Base < CHAR > &);
+ const ACE_String_Base < CHAR > &);
template < class CHAR > ACE_INLINE
ACE_String_Base < CHAR > operator + (const ACE_String_Base < CHAR > &,
- const CHAR *);
+ const CHAR *);
template < class CHAR > ACE_INLINE
ACE_String_Base < CHAR > operator + (const CHAR *,
- const ACE_String_Base < CHAR > &);
+ const ACE_String_Base < CHAR > &);
template < class CHAR > ACE_INLINE
ACE_String_Base < CHAR > operator + (const ACE_String_Base < CHAR > &t,
- const CHAR c);
+ const CHAR c);
template < class CHAR > ACE_INLINE
ACE_String_Base < CHAR > operator + (const CHAR c,
- const ACE_String_Base < CHAR > &t);
+ const ACE_String_Base < CHAR > &t);
#if defined (__ACE_INLINE__)
#include "ace/String_Base.i"
@@ -436,4 +441,5 @@ template < class CHAR > ACE_INLINE
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
#include "ace/post.h"
+
#endif /* ACE_STRING_BASE_H */
diff --git a/ace/String_Base.i b/ace/String_Base.i
index a78112d93b4..f4cb1a547da 100644
--- a/ace/String_Base.i
+++ b/ace/String_Base.i
@@ -1,6 +1,8 @@
-/* -*- C++ -*- */
+// -*- C++ -*-
+//
// $Id$
+
#include "ace/Malloc_Base.h"
// Default constructor.
@@ -32,10 +34,10 @@ ACE_String_Base<CHAR>::ACE_String_Base (const CHAR *s,
size_t length;
if (s != 0)
- length = ACE_OS::strlen (s);
+ length = ACE_OS_String::strlen (s);
else
length = 0;
-
+
this->set (s, length, release);
}
@@ -141,7 +143,7 @@ ACE_String_Base<CHAR>::set (const CHAR *s, int release)
{
size_t length;
if (s != 0)
- length = ACE_OS::strlen (s);
+ length = ACE_OS_String::strlen (s);
else
length = 0;
@@ -195,7 +197,7 @@ ACE_String_Base<CHAR>::rep (void) const
CHAR *new_string;
ACE_NEW_RETURN (new_string, CHAR[this->len_ + 1], 0);
- ACE_OS::strsncpy (new_string, this->rep_, this->len_+1);
+ ACE_OS_String::strsncpy (new_string, this->rep_, this->len_+1);
return new_string;
}
@@ -220,7 +222,7 @@ ACE_String_Base<CHAR>::compare (const ACE_String_Base<CHAR> &s) const
// Pick smaller of the two lengths and perform the comparison.
size_t smaller_length = ace_min (this->len_, s.len_);
- int result = ACE_OS::memcmp (this->rep_,
+ int result = ACE_OS_String::memcmp (this->rep_,
s.rep_,
smaller_length * sizeof (CHAR));
@@ -242,7 +244,7 @@ ACE_String_Base<CHAR>::operator== (const ACE_String_Base<CHAR> &s) const
// Less than comparison operator.
-template <class CHAR> ACE_INLINE int
+template <class CHAR> ACE_INLINE int
ACE_String_Base<CHAR>::operator < (const ACE_String_Base<CHAR> &s) const
{
ACE_TRACE ("ACE_String_Base<CHAR>::operator <");
@@ -272,8 +274,8 @@ template <class CHAR> ACE_INLINE ssize_t
ACE_String_Base<CHAR>::find (const CHAR *s, size_t pos) const
{
CHAR *substr = this->rep_ + pos;
- size_t len = ACE_OS::strlen (s);
- CHAR *pointer = ACE_OS::strnstr (substr, s, len);
+ size_t len = ACE_OS_String::strlen (s);
+ CHAR *pointer = ACE_OS_String::strnstr (substr, s, len);
if (pointer == 0)
return ACE_String_Base<CHAR>::npos;
else
@@ -284,7 +286,7 @@ template <class CHAR> ACE_INLINE ssize_t
ACE_String_Base<CHAR>::find (CHAR c, size_t pos) const
{
CHAR *substr = this->rep_ + pos;
- CHAR *pointer = ACE_OS::strnchr (substr, c, this->len_ - pos);
+ CHAR *pointer = ACE_OS_String::strnchr (substr, c, this->len_ - pos);
if (pointer == 0)
return ACE_String_Base<CHAR>::npos;
else
@@ -318,15 +320,6 @@ ACE_String_Base<CHAR>::rfind (CHAR c, ssize_t pos) const
return ACE_String_Base<CHAR>::npos;
}
-template <class CHAR> ACE_INLINE u_long
-ACE_String_Base<CHAR>::hash (void) const
-{
- return ACE::hash_pjw ((ACE_reinterpret_cast (char *,
- ACE_const_cast (CHAR *,
- this->rep_))),
- this->len_ * sizeof (CHAR));
-}
-
template <class CHAR> ACE_INLINE ACE_String_Base<CHAR>
operator+ (const ACE_String_Base<CHAR> &s, const ACE_String_Base<CHAR> &t)
{