aboutsummaryrefslogtreecommitdiff
path: root/dep/acelite/ace/Log_Msg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dep/acelite/ace/Log_Msg.cpp')
-rw-r--r--dep/acelite/ace/Log_Msg.cpp106
1 files changed, 36 insertions, 70 deletions
diff --git a/dep/acelite/ace/Log_Msg.cpp b/dep/acelite/ace/Log_Msg.cpp
index 3df89332aea..676236b72ca 100644
--- a/dep/acelite/ace/Log_Msg.cpp
+++ b/dep/acelite/ace/Log_Msg.cpp
@@ -1,4 +1,4 @@
-// $Id: Log_Msg.cpp 92052 2010-09-27 14:20:22Z vzykov $
+// $Id: Log_Msg.cpp 95761 2012-05-15 18:23:04Z johnnyw $
// We need this to get the status of ACE_NTRACE...
#include "ace/config-all.h"
@@ -57,16 +57,7 @@ ACE_ALLOC_HOOK_DEFINE(ACE_Log_Msg)
# if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || \
defined (ACE_HAS_TSS_EMULATION)
-#if defined (ACE_MVS)
- static ACE_thread_key_t the_log_msg_tss_key =
- #if !defined(_LP64)
- { '\0','\0','\0','\0' };
- #else
- { '\0','\0','\0','\0','\0','\0','\0','\0' };
- #endif
-#else
- static ACE_thread_key_t the_log_msg_tss_key = 0;
-#endif /* defined (ACE_MVS) */
+static ACE_thread_key_t the_log_msg_tss_key = 0;
ACE_thread_key_t *log_msg_tss_key (void)
{
@@ -1051,27 +1042,30 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
}
if (timestamp_ > 0)
- {
- ACE_TCHAR day_and_time[35];
- const ACE_TCHAR *s = 0;
- if (timestamp_ == 1)
- {
- // Print just the time
- s = ACE::timestamp (day_and_time, sizeof day_and_time / sizeof (ACE_TCHAR), 1);
- }
- else
- {
- // Print time and date
- ACE::timestamp (day_and_time, sizeof day_and_time / sizeof (ACE_TCHAR));
- s = day_and_time;
- }
-
- for (; bspace > 1 && (*bp = *s) != '\0'; ++s, --bspace)
- ++bp;
-
- *bp++ = '|';
- --bspace;
- }
+ {
+ ACE_TCHAR day_and_time[27];
+ const ACE_TCHAR *s = 0;
+ if (timestamp_ == 1)
+ {
+ // Print just the time
+ s = ACE::timestamp (day_and_time,
+ sizeof (day_and_time) / sizeof (ACE_TCHAR),
+ true);
+ }
+ else
+ {
+ // Print time and date
+ ACE::timestamp (day_and_time,
+ sizeof (day_and_time) / sizeof (ACE_TCHAR));
+ s = day_and_time;
+ }
+
+ for (; bspace > 1 && (*bp = *s) != '\0'; ++s, --bspace)
+ ++bp;
+
+ *bp++ = '|';
+ --bspace;
+ }
while (*format_str != '\0' && bspace > 0)
{
@@ -1106,7 +1100,8 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
const ACE_TCHAR *abort_str = ACE_TEXT ("Aborting...");
const ACE_TCHAR *start_format = format_str;
ACE_TCHAR format[128]; // Converted format string
- ACE_TCHAR *fp; // Current format pointer
+ ACE_OS::memset (format, '\0', 128); // Set this string to known values.
+ ACE_TCHAR *fp = 0; // Current format pointer
int wp = 0; // Width/precision extracted from args
bool done = false;
bool skip_nul_locate = false;
@@ -1647,21 +1642,23 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
}
case 'D': // Format the timestamp in format:
- // Weekday Month day year hour:minute:sec.usec
+ // yyyy-mm-dd hour:minute:sec.usec
+ // This is a maximum of 27 characters
+ // including terminator.
{
- ACE_TCHAR day_and_time[35];
+ ACE_TCHAR day_and_time[27];
// Did we find the flag indicating a time value argument
if (format[1] == ACE_TEXT('#'))
{
ACE_Time_Value* time_value = va_arg (argp, ACE_Time_Value*);
ACE::timestamp (*time_value,
day_and_time,
- sizeof day_and_time / sizeof (ACE_TCHAR));
+ sizeof (day_and_time) / sizeof (ACE_TCHAR));
}
else
{
ACE::timestamp (day_and_time,
- sizeof day_and_time / sizeof (ACE_TCHAR));
+ sizeof (day_and_time) / sizeof (ACE_TCHAR));
}
#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR)
ACE_OS::strcpy (fp, ACE_TEXT ("ls"));
@@ -1678,9 +1675,9 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
}
case 'T': // Format the timestamp in
- // hour:minute:sec:usec format.
+ // hour:minute:sec.usec format.
{
- ACE_TCHAR day_and_time[35];
+ ACE_TCHAR day_and_time[27];
#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR)
ACE_OS::strcpy (fp, ACE_TEXT ("ls"));
#else
@@ -1733,15 +1730,6 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
ACE_hthread_t t_id;
ACE_OS::thr_self (t_id);
-# if defined (ACE_MVS) || defined (ACE_TANDEM_T1248_PTHREADS)
- // MVS's pthread_t is a struct... yuck. So use the ACE 5.0
- // code for it.
- ACE_OS::strcpy (fp, ACE_TEXT ("u"));
- if (can_check)
- this_len = ACE_OS::snprintf (bp, bspace, format, t_id);
- else
- this_len = ACE_OS::sprintf (bp, format, t_id);
-# else
// Yes, this is an ugly C-style cast, but the correct
// C++ cast is different depending on whether the t_id
// is an integral type or a pointer type. FreeBSD uses
@@ -1754,7 +1742,6 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
else
this_len = ACE_OS::sprintf
(bp, format, (unsigned long)t_id);
-# endif /* ACE_MWS || ACE_TANDEM_T1248_PTHREADS */
#endif /* ACE_WIN32 */
ACE_UPDATE_COUNT (bspace, this_len);
@@ -1981,21 +1968,6 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
break;
case 'Q':
-#if defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
- {
- // This relies on the ACE_U_LongLong storage layout.
- ACE_UINT32 hi = va_arg (argp, ACE_UINT32);
- ACE_UINT32 lo = va_arg (argp, ACE_UINT32);
- if (hi > 0)
- this_len = ACE_OS::sprintf (bp,
- "0x%lx%0*lx",
- hi,
- 2 * sizeof lo,
- lo);
- else
- this_len = ACE_OS::sprintf (bp, "0x%lx", lo);
- }
-#else /* ! ACE_LACKS_LONGLONG_T */
{
const ACE_TCHAR *fmt = ACE_UINT64_FORMAT_SPECIFIER;
ACE_OS::strcpy (fp, &fmt[1]); // Skip leading %
@@ -2008,15 +1980,10 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
format,
va_arg (argp, ACE_UINT64));
}
-#endif /* ! ACE_LACKS_LONGLONG_T || ACE_LACKS_UNSIGNEDLONGLONG_T */
ACE_UPDATE_COUNT (bspace, this_len);
break;
case 'q':
- #if defined (ACE_LACKS_LONGLONG_T)
- // No implementation available yet, no ACE_INT64 emulation
- // available yet
- #else /* ! ACE_LACKS_LONGLONG_T */
{
const ACE_TCHAR *fmt = ACE_INT64_FORMAT_SPECIFIER;
ACE_OS::strcpy (fp, &fmt[1]); // Skip leading %
@@ -2029,7 +1996,6 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
format,
va_arg (argp, ACE_INT64));
}
- #endif /* ! ACE_LACKS_LONGLONG_T */
ACE_UPDATE_COUNT (bspace, this_len);
break;