Some missing from merge.

Signed-off-by: Salja <salja2012@hotmail.de>
This commit is contained in:
Salja 2012-08-05 14:54:07 +02:00 committed by Antz
parent ec939a5bce
commit f4be15a7af
1895 changed files with 160408 additions and 53601 deletions

View file

@ -1,3 +1,5 @@
// $Id: ACE.cpp 97355 2013-09-27 22:16:09Z shuston $
#include "ace/ACE.h"
#include "ace/Basic_Types.h"
@ -108,12 +110,6 @@ ACE::beta_version (void)
return ACE_BETA_VERSION;
}
u_int
ACE::micro_version (void)
{
return ACE_MICRO_VERSION;
}
const ACE_TCHAR *
ACE::compiler_name (void)
{
@ -164,9 +160,7 @@ ACE::nibble2hex (u_int n)
bool
ACE::debug (void)
{
//FUZZ: disable check_for_ace_log_categories
static const char *debug = ACE_OS::getenv ("ACE_DEBUG");
//FUZZ: enable check_for_ace_log_categories
static const char* debug = ACE_OS::getenv ("ACELIB_DEBUG");
return (ACE::debug_ != 0) ? ACE::debug_ : (debug != 0 ? (*debug != '0') : false);
}
@ -917,7 +911,7 @@ ACE::recv_n_i (ACE_HANDLE handle,
// number of (char *ptr, int len) tuples. However, the count N is the
// *total* number of trailing arguments, *not* a couple of the number
// of tuple pairs!
#if !defined (ACE_LACKS_VA_FUNCTIONS)
ssize_t
ACE::recv (ACE_HANDLE handle, size_t n, ...)
{
@ -927,16 +921,9 @@ ACE::recv (ACE_HANDLE handle, size_t n, ...)
#if defined (ACE_HAS_ALLOCA)
iovp = (iovec *) alloca (total_tuples * sizeof (iovec));
#else
# ifdef ACE_HAS_ALLOC_HOOKS
ACE_ALLOCATOR_RETURN (iovp, (iovec *)
ACE_Allocator::instance ()->malloc (total_tuples *
sizeof (iovec)),
-1);
# else
ACE_NEW_RETURN (iovp,
iovec[total_tuples],
-1);
# endif /* ACE_HAS_ALLOC_HOOKS */
#endif /* !defined (ACE_HAS_ALLOCA) */
va_start (argp, n);
@ -949,17 +936,11 @@ ACE::recv (ACE_HANDLE handle, size_t n, ...)
ssize_t const result = ACE_OS::recvv (handle, iovp, total_tuples);
#if !defined (ACE_HAS_ALLOCA)
# ifdef ACE_HAS_ALLOC_HOOKS
ACE_Allocator::instance ()->free (iovp);
# else
delete [] iovp;
# endif /* ACE_HAS_ALLOC_HOOKS */
#endif /* !defined (ACE_HAS_ALLOCA) */
va_end (argp);
return result;
}
#endif /* ACE_LACKS_VA_FUNCTIONS */
ssize_t
ACE::recvv (ACE_HANDLE handle,
@ -1550,7 +1531,7 @@ ACE::t_snd_n_i (ACE_HANDLE handle,
{
// Check for possible blocking.
if (n == -1 &&
(errno == EWOULDBLOCK || errno == ENOBUFS))
errno == EWOULDBLOCK || errno == ENOBUFS)
{
// Wait upto <timeout> for the blocking to subside.
int const rtn = ACE::handle_write_ready (handle, timeout);
@ -1705,7 +1686,7 @@ ACE::send_n_i (ACE_HANDLE handle,
// the ints (basically, an varargs version of writev). The count N is
// the *total* number of trailing arguments, *not* a couple of the
// number of tuple pairs!
#if !defined (ACE_LACKS_VA_FUNCTIONS)
ssize_t
ACE::send (ACE_HANDLE handle, size_t n, ...)
{
@ -1715,16 +1696,9 @@ ACE::send (ACE_HANDLE handle, size_t n, ...)
#if defined (ACE_HAS_ALLOCA)
iovp = (iovec *) alloca (total_tuples * sizeof (iovec));
#else
# ifdef ACE_HAS_ALLOC_HOOKS
ACE_ALLOCATOR_RETURN (iovp, (iovec *)
ACE_Allocator::instance ()->malloc (total_tuples *
sizeof (iovec)),
-1);
# else
ACE_NEW_RETURN (iovp,
iovec[total_tuples],
-1);
# endif /* ACE_HAS_ALLOC_HOOKS */
#endif /* !defined (ACE_HAS_ALLOCA) */
va_start (argp, n);
@ -1737,16 +1711,11 @@ ACE::send (ACE_HANDLE handle, size_t n, ...)
ssize_t result = ACE_OS::sendv (handle, iovp, total_tuples);
#if !defined (ACE_HAS_ALLOCA)
# ifdef ACE_HAS_ALLOC_HOOKS
ACE_Allocator::instance ()->free (iovp);
# else
delete [] iovp;
# endif /* ACE_HAS_ALLOC_HOOKS */
#endif /* !defined (ACE_HAS_ALLOCA) */
va_end (argp);
return result;
}
#endif /* ACE_LACKS_VA_FUNCTIONS */
ssize_t
ACE::sendv (ACE_HANDLE handle,
@ -2318,7 +2287,6 @@ ACE::format_hexdump (const char *buffer,
// We can fit 16 bytes output in text mode per line, 4 chars per byte.
size_t maxlen = (obuf_sz / 68) * 16;
const ACE_TCHAR *const obuf_start = obuf;
if (size > maxlen)
size = maxlen;
@ -2333,20 +2301,22 @@ ACE::format_hexdump (const char *buffer,
for (j = 0 ; j < 16; j++)
{
c = (u_char) buffer[(i << 4) + j]; // or, buffer[i*16+j]
ACE_OS::snprintf (obuf, obuf_sz - (obuf - obuf_start),
ACE_OS::sprintf (obuf,
ACE_TEXT ("%02x "),
c);
obuf += 3;
if (j == 7)
{
*obuf++ = ACE_TEXT (' ');
ACE_OS::sprintf (obuf,
ACE_TEXT (" "));
++obuf;
}
textver[j] = ACE_OS::ace_isprint (c) ? c : u_char ('.');
}
textver[j] = 0;
ACE_OS::snprintf (obuf, obuf_sz - (obuf - obuf_start),
ACE_OS::sprintf (obuf,
#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR)
ACE_TEXT (" %ls\n"),
#else
@ -2363,31 +2333,35 @@ ACE::format_hexdump (const char *buffer,
for (i = 0 ; i < size % 16; i++)
{
c = (u_char) buffer[size - size % 16 + i];
ACE_OS::snprintf (obuf, obuf_sz - (obuf - obuf_start),
ACE_OS::sprintf (obuf,
ACE_TEXT ("%02x "),
c);
obuf += 3;
if (i == 7)
{
*obuf++ = ACE_TEXT (' ');
ACE_OS::sprintf (obuf,
ACE_TEXT (" "));
++obuf;
}
textver[i] = ACE_OS::ace_isprint (c) ? c : u_char ('.');
}
for (i = size % 16; i < 16; i++)
{
ACE_OS::snprintf (obuf, obuf_sz - (obuf - obuf_start),
ACE_OS::sprintf (obuf,
ACE_TEXT (" "));
obuf += 3;
if (i == 7)
{
*obuf++ = ACE_TEXT (' ');
ACE_OS::sprintf (obuf,
ACE_TEXT (" "));
++obuf;
}
textver[i] = ' ';
}
textver[i] = 0;
ACE_OS::snprintf (obuf, obuf_sz - (obuf - obuf_start),
ACE_OS::sprintf (obuf,
#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR)
ACE_TEXT (" %ls\n"),
#else
@ -2398,10 +2372,11 @@ ACE::format_hexdump (const char *buffer,
return size;
}
/// Returns the current timestamp in the form
/// "hour:minute:second:microsecond." The month, day, and year are
/// also stored in the beginning of the date_and_time array
/// using ISO-8601 format.
// Returns the current timestamp in the form
// "hour:minute:second:microsecond." The month, day, and year are
// also stored in the beginning of the date_and_time array
// using ISO-8601 format.
ACE_TCHAR *
ACE::timestamp (ACE_TCHAR date_and_time[],
size_t date_and_timelen,
@ -2413,12 +2388,13 @@ ACE::timestamp (ACE_TCHAR date_and_time[],
return_pointer_to_first_digit);
}
/// Returns the given timestamp in the form
/// "hour:minute:second:microsecond." The month, day, and year are
/// also stored in the beginning of the date_and_time array
/// using ISO-8601 format.
/// 012345678901234567890123456
/// 2010-12-02 12:56:00.123456<nul>
// Returns the given timestamp in the form
// "hour:minute:second:microsecond." The month, day, and year are
// also stored in the beginning of the date_and_time array
// using ISO-8601 format.
// 012345678901234567890123456
// 2010-12-02 12:56:00.123456<nul>
ACE_TCHAR *
ACE::timestamp (const ACE_Time_Value& time_value,
ACE_TCHAR date_and_time[],
@ -2455,7 +2431,8 @@ ACE::timestamp (const ACE_Time_Value& time_value,
return &date_and_time[10 + (return_pointer_to_first_digit != 0)];
}
/// This function rounds the request to a multiple of the page size.
// This function rounds the request to a multiple of the page size.
size_t
ACE::round_to_pagesize (size_t len)
{
@ -2637,7 +2614,8 @@ ACE::handle_timed_complete (ACE_HANDLE h,
return h;
}
/// Wait up to @a timeout amount of time to accept a connection.
// Wait up to <timeout> amount of time to accept a connection.
int
ACE::handle_timed_accept (ACE_HANDLE listener,
ACE_Time_Value *timeout,
@ -2706,8 +2684,9 @@ ACE::handle_timed_accept (ACE_HANDLE listener,
}
}
/// Make the current process a UNIX daemon. This is based on Stevens
/// code from APUE.
// Make the current process a UNIX daemon. This is based on Stevens
// code from APUE.
int
ACE::daemonize (const ACE_TCHAR pathname[],
bool close_all_handles,
@ -2839,7 +2818,7 @@ ACE::max_handles (void)
# endif /* RLIM_INFINITY */
#endif /* RLIMIT_NOFILE && !ACE_LACKS_RLIMIT */
#if defined (_SC_OPEN_MAX) && !defined (ACE_LACKS_SYSCONF)
#if defined (_SC_OPEN_MAX)
return static_cast<int> (ACE_OS::sysconf (_SC_OPEN_MAX));
#elif defined (FD_SETSIZE)
return FD_SETSIZE;
@ -2911,7 +2890,7 @@ ACE::set_handle_limit (int new_limit,
return 0;
}
/// Euclid's greatest common divisor algorithm.
// Euclid's greatest common divisor algorithm.
u_long
ACE::gcd (u_long x, u_long y)
{
@ -2926,7 +2905,7 @@ ACE::gcd (u_long x, u_long y)
}
/// Calculates the minimum enclosing frame size for the given values.
// Calculates the minimum enclosing frame size for the given values.
u_long
ACE::minimum_frame_size (u_long period1, u_long period2)
{
@ -3127,9 +3106,7 @@ ACE::sock_error (int error)
return ACE_TEXT ("destination address required");
/* NOTREACHED */
default:
ACE_OS::snprintf (unknown_msg,
sizeof unknown_msg / sizeof unknown_msg[0],
ACE_TEXT ("unknown error: %d"), error);
ACE_OS::sprintf (unknown_msg, ACE_TEXT ("unknown error: %d"), error);
return unknown_msg;
/* NOTREACHED */
}
@ -3213,15 +3190,9 @@ ACE::strndup (const char *str, size_t n)
continue;
char *s;
#if defined (ACE_HAS_ALLOC_HOOKS)
ACE_ALLOCATOR_RETURN (s,
(char *) ACE_Allocator::instance()->malloc (len + 1),
0);
#else
ACE_ALLOCATOR_RETURN (s,
(char *) ACE_OS::malloc (len + 1),
0);
#endif /* ACE_HAS_ALLOC_HOOKS */
return ACE_OS::strsncpy (s, str, len + 1);
}
@ -3240,18 +3211,11 @@ ACE::strndup (const wchar_t *str, size_t n)
len++)
continue;
size_t const size = (len + 1) * sizeof (wchar_t);
wchar_t *s = 0;
#if defined (ACE_HAS_ALLOC_HOOKS)
wchar_t *s;
ACE_ALLOCATOR_RETURN (s,
static_cast<wchar_t*> (
ACE_Allocator::instance ()->malloc (size)),
static_cast<wchar_t *> (
ACE_OS::malloc ((len + 1) * sizeof (wchar_t))),
0);
#else
ACE_ALLOCATOR_RETURN (s,
static_cast<wchar_t*> (ACE_OS::malloc (size)),
0);
#endif /* ACE_HAS_ALLOC_HOOKS */
return ACE_OS::strsncpy (s, str, len + 1);
}
#endif /* ACE_HAS_WCHAR */
@ -3271,17 +3235,9 @@ ACE::strnnew (const char *str, size_t n)
continue;
char *s;
#if defined (ACE_HAS_ALLOC_HOOKS)
ACE_ALLOCATOR_RETURN (s,
static_cast<char*> (ACE_Allocator::instance ()->malloc (sizeof (char) * (len + 1))),
0);
#else
ACE_NEW_RETURN (s,
char[len + 1],
0);
#endif /* ACE_HAS_ALLOC_HOOKS */
return ACE_OS::strsncpy (s, str, len + 1);
}
@ -3334,16 +3290,9 @@ ACE::strnew (const char *s)
if (s == 0)
return 0;
char *t = 0;
#if defined (ACE_HAS_ALLOC_HOOKS)
ACE_ALLOCATOR_RETURN (t,
static_cast<char*> (ACE_Allocator::instance ()->malloc (sizeof (char) * (ACE_OS::strlen (s) + 1))),
0);
#else
ACE_NEW_RETURN (t,
char [ACE_OS::strlen (s) + 1],
0);
#endif /* ACE_HAS_ALLOC_HOOKS */
return ACE_OS::strcpy (t, s);
}
@ -3353,19 +3302,10 @@ ACE::strnew (const wchar_t *s)
{
if (s == 0)
return 0;
size_t const n = ACE_OS::strlen (s) + 1;
wchar_t *t = 0;
#if defined (ACE_HAS_ALLOC_HOOKS)
ACE_ALLOCATOR_RETURN (t,
static_cast<wchar_t*> (
ACE_Allocator::instance ()->malloc (
sizeof (wchar_t) * (n))),
0);
#else
ACE_NEW_RETURN (t, wchar_t[n], 0);
#endif /* ACE_HAS_ALLOC_HOOKS */
ACE_NEW_RETURN (t,
wchar_t[ACE_OS::strlen (s) + 1],
0);
return ACE_OS::strcpy (t, s);
}
#endif /* ACE_HAS_WCHAR */