diff options
author | Luke Mewburn <Luke@Mewburn.net> | 2022-09-10 16:30:54 +1000 |
---|---|---|
committer | Luke Mewburn <Luke@Mewburn.net> | 2022-09-10 16:30:54 +1000 |
commit | 2be659384defe6b235e020f03a7d683c80a16c7e (patch) | |
tree | c617213074082f7665abbcbb990123755c3d8ed1 /ACE/ace | |
parent | f5e5d7759a9314053509d294a4c10827d3946034 (diff) | |
download | ATCD-2be659384defe6b235e020f03a7d683c80a16c7e.tar.gz |
Adapt to ACE_TEXT_PRIs
Use ACE_TEXT_PRIs instead of conditional compilation
checking !defined(ACE_WIN32) && defined(ACE_USES_WCHAR).
Diffstat (limited to 'ACE/ace')
-rw-r--r-- | ACE/ace/ACE.cpp | 12 | ||||
-rw-r--r-- | ACE/ace/INET_Addr.cpp | 12 | ||||
-rw-r--r-- | ACE/ace/Log_Msg.cpp | 45 | ||||
-rw-r--r-- | ACE/ace/Log_Record.cpp | 27 | ||||
-rw-r--r-- | ACE/ace/Process.cpp | 9 |
5 files changed, 22 insertions, 83 deletions
diff --git a/ACE/ace/ACE.cpp b/ACE/ace/ACE.cpp index 565b36876f0..bb4a7ff016c 100644 --- a/ACE/ace/ACE.cpp +++ b/ACE/ace/ACE.cpp @@ -2342,11 +2342,7 @@ ACE::format_hexdump (const char *buffer, textver[j] = 0; ACE_OS::snprintf (obuf, obuf_sz - (obuf - obuf_start), -#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - ACE_TEXT (" %ls\n"), -#else - ACE_TEXT (" %s\n"), -#endif + ACE_TEXT (" %") ACE_TEXT_PRIs ACE_TEXT ("\n"), textver); while (*obuf != '\0') @@ -2383,11 +2379,7 @@ ACE::format_hexdump (const char *buffer, textver[i] = 0; ACE_OS::snprintf (obuf, obuf_sz - (obuf - obuf_start), -#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - ACE_TEXT (" %ls\n"), -#else - ACE_TEXT (" %s\n"), -#endif + ACE_TEXT (" %") ACE_TEXT_PRIs ACE_TEXT ("\n"), textver); } return size; diff --git a/ACE/ace/INET_Addr.cpp b/ACE/ace/INET_Addr.cpp index de9abf60c77..728b4465a43 100644 --- a/ACE/ace/INET_Addr.cpp +++ b/ACE/ace/INET_Addr.cpp @@ -49,20 +49,12 @@ ACE_INET_Addr::addr_to_string (ACE_TCHAR s[], + 5 // ACE_OS::strlen ("65535"), Assuming the max port number. + 1 // sizeof (':'), addr/port sep + 1; // sizeof ('\0'), terminating NUL -#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - ACE_TCHAR const *format = ACE_TEXT("%ls:%d"); -#else - ACE_TCHAR const *format = ACE_TEXT("%s:%d"); -#endif /* !ACE_WIN32 && ACE_USES_WCHAR */ + ACE_TCHAR const *format = ACE_TEXT("%") ACE_TEXT_PRIs ACE_TEXT(":%d"); #if defined (ACE_HAS_IPV6) if (ACE_OS::strchr (hoststr, ACE_TEXT (':')) != 0) { total_len += 2; // ACE_OS::strlen ("[]") IPv6 addr frames -# if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - format = ACE_TEXT("[%ls]:%d"); -# else - format = ACE_TEXT("[%s]:%d"); -# endif /* !ACE_WIN32 && ACE_USES_WCHAR */ + format = ACE_TEXT("[%") ACE_TEXT_PRIs ACE_TEXT("]:%d"); } #endif // ACE_HAS_IPV6 diff --git a/ACE/ace/Log_Msg.cpp b/ACE/ace/Log_Msg.cpp index c12d07f7c18..25864192104 100644 --- a/ACE/ace/Log_Msg.cpp +++ b/ACE/ace/Log_Msg.cpp @@ -1232,11 +1232,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str, break; case 'N': // Source file name -#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - ACE_OS::strcpy (fp, ACE_TEXT ("ls")); -#else - ACE_OS::strcpy (fp, ACE_TEXT ("s")); -#endif + ACE_OS::strcpy (fp, ACE_TEXT_PRIs); if (can_check) this_len = ACE_OS::snprintf (bp, bspace, format, this->file () ? @@ -1251,11 +1247,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str, break; case 'n': // Program name -#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - ACE_OS::strcpy (fp, ACE_TEXT ("ls")); -#else /* ACE_WIN32 && ACE_USES_WCHAR */ - ACE_OS::strcpy (fp, ACE_TEXT ("s")); -#endif + ACE_OS::strcpy (fp, ACE_TEXT_PRIs); if (can_check) this_len = ACE_OS::snprintf (bp, bspace, format, ACE_Log_Msg::program_name_ ? @@ -1495,11 +1487,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str, { // Nope, print out standard priority_name() string -#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - ACE_OS::strcpy (fp, ACE_TEXT ("ls")); -#else - ACE_OS::strcpy (fp, ACE_TEXT ("s")); -#endif + ACE_OS::strcpy (fp, ACE_TEXT_PRIs); if (can_check) this_len = ACE_OS::snprintf (bp, bspace, format, @@ -1529,11 +1517,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str, { #endif -#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - ACE_OS::strcpy (fp, ACE_TEXT ("ls")); -#else /* ACE_WIN32 && ACE_USES_WCHAR */ - ACE_OS::strcpy (fp, ACE_TEXT ("s")); -#endif + ACE_OS::strcpy (fp, ACE_TEXT_PRIs); if (can_check) this_len = ACE_OS::snprintf (bp, bspace, format, ACE_TEXT_CHAR_TO_TCHAR (msg)); @@ -1713,11 +1697,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str, sizeof (day_and_time) / sizeof (ACE_TCHAR), true); } -#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - ACE_OS::strcpy (fp, ACE_TEXT ("ls")); -#else - ACE_OS::strcpy (fp, ACE_TEXT ("s")); -#endif + ACE_OS::strcpy (fp, ACE_TEXT_PRIs); if (can_check) this_len = ACE_OS::snprintf (bp, bspace, format, day_and_time); @@ -1731,11 +1711,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str, // hour:minute:sec.usec format. { ACE_TCHAR day_and_time[27]; -#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - ACE_OS::strcpy (fp, ACE_TEXT ("ls")); -#else - ACE_OS::strcpy (fp, ACE_TEXT ("s")); -#endif + ACE_OS::strcpy (fp, ACE_TEXT_PRIs); // Did we find the flag indicating a time value argument if (format[1] == ACE_TEXT('#')) { @@ -1810,11 +1786,10 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str, { #if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) wchar_t *str = va_arg (argp, wchar_t *); - ACE_OS::strcpy (fp, ACE_TEXT ("ls")); #else /* ACE_WIN32 && ACE_USES_WCHAR */ ACE_TCHAR *str = va_arg (argp, ACE_TCHAR *); - ACE_OS::strcpy (fp, ACE_TEXT ("s")); #endif /* ACE_WIN32 && ACE_USES_WCHAR */ + ACE_OS::strcpy (fp, ACE_TEXT_PRIs); if (can_check) this_len = ACE_OS::snprintf (bp, bspace, format, str ? str : ACE_TEXT ("(null)")); @@ -2968,11 +2943,7 @@ ACE_Log_Msg::log_hexdump (ACE_Log_Priority log_priority, if (text) wr_ptr += ACE_OS::snprintf (wr_ptr, end_ptr - wr_ptr, -#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - ACE_TEXT ("%ls - "), -#else - ACE_TEXT ("%s - "), -#endif + ACE_TEXT ("%") ACE_TEXT_PRIs ACE_TEXT (" - "), text); wr_ptr += ACE_OS::snprintf (wr_ptr, diff --git a/ACE/ace/Log_Record.cpp b/ACE/ace/Log_Record.cpp index a97d63e023c..ea4a782ffd6 100644 --- a/ACE/ace/Log_Record.cpp +++ b/ACE/ace/Log_Record.cpp @@ -235,16 +235,6 @@ ACE_Log_Record::format_msg (const ACE_TCHAR host_name[], /* yyyy-mm-dd hh:mm:ss.mmmmmm<nul> */ ACE_TCHAR timestamp[27]; // Only used by VERBOSE and VERBOSE_LITE. - // The sprintf format needs to be different for Windows and POSIX - // in the wide-char case. -#if defined (ACE_WIN32) || !defined (ACE_USES_WCHAR) - const ACE_TCHAR *verbose_fmt = ACE_TEXT ("%s@%s@%u@%s@%s"); - const ACE_TCHAR *verbose_lite_fmt = ACE_TEXT ("%s@%s@%s"); -#else - const ACE_TCHAR *verbose_fmt = ACE_TEXT ("%ls@%ls@%u@%ls@%ls"); - const ACE_TCHAR *verbose_lite_fmt = ACE_TEXT ("%ls@%ls@%ls"); -#endif - if (ACE_BIT_ENABLED (verbose_flag, ACE_Log_Msg::VERBOSE) || ACE_BIT_ENABLED (verbose_flag, @@ -269,7 +259,10 @@ ACE_Log_Record::format_msg (const ACE_TCHAR host_name[], ? ACE_TEXT ("<local_host>") : host_name); ACE_OS::snprintf (verbose_msg, verbose_msg_size, - verbose_fmt, + ACE_TEXT ("%") ACE_TEXT_PRIs + ACE_TEXT ("@%") ACE_TEXT_PRIs + ACE_TEXT ("@%u@%") ACE_TEXT_PRIs + ACE_TEXT ("@%") ACE_TEXT_PRIs, timestamp, lhost_name, this->pid_, @@ -278,7 +271,9 @@ ACE_Log_Record::format_msg (const ACE_TCHAR host_name[], } else if (ACE_BIT_ENABLED (verbose_flag, ACE_Log_Msg::VERBOSE_LITE)) ACE_OS::snprintf (verbose_msg, verbose_msg_size, - verbose_lite_fmt, + ACE_TEXT ("%") ACE_TEXT_PRIs + ACE_TEXT ("@%") ACE_TEXT_PRIs + ACE_TEXT ("@%") ACE_TEXT_PRIs, timestamp, ACE_Log_Record::priority_name (ACE_Log_Priority (this->type_)), this->msg_data_); @@ -318,15 +313,9 @@ ACE_Log_Record::print (const ACE_TCHAR host_name[], { int const verbose_msg_len = static_cast<int> (ACE_OS::strlen (verbose_msg)); -#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - int const fwrite_result = ACE_OS::fprintf (fp, - ACE_TEXT ("%ls"), - verbose_msg); -#else int const fwrite_result = ACE_OS::fprintf (fp, - ACE_TEXT ("%s"), + ACE_TEXT ("%") ACE_TEXT_PRIs, verbose_msg); -#endif // We should have written everything if (fwrite_result != verbose_msg_len) result = -1; diff --git a/ACE/ace/Process.cpp b/ACE/ace/Process.cpp index 73547b9976b..184c062db8c 100644 --- a/ACE/ace/Process.cpp +++ b/ACE/ace/Process.cpp @@ -1041,14 +1041,9 @@ ACE_Process_Options::setenv (const ACE_TCHAR *variable_name, ACE_NEW_RETURN (newformat, ACE_TCHAR[buflen], -1); std::unique_ptr<ACE_TCHAR[]> safe_newformat (newformat); -# if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - const ACE_TCHAR *fmt = ACE_TEXT ("%ls=%ls"); -# else - const ACE_TCHAR *fmt = ACE_TEXT ("%s=%s"); -# endif - // Add in the variable name. - ACE_OS::snprintf (safe_newformat.get (), buflen, fmt, + ACE_OS::snprintf (safe_newformat.get (), buflen, + ACE_TEXT ("%") ACE_TEXT_PRIs ACE_TEXT ("=%") ACE_TEXT_PRIs, variable_name, format); // Add the rest of the varargs. |