From 83330bfd1fefd26347c2c1c2773953ad9f3c7f70 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Tue, 17 May 2016 12:23:09 +0200 Subject: gai_strerror is defined as gai_strerrorA or gai_strerrorW on Windows dependent on Unicode settings. Adapt ACE_OS::gai_strerror for this and invoke this operation as part of a test to make sure we compile this inline code * ACE/ace/OS_NS_netdb.inl: * ACE/ace/ace_wchar.h: * ACE/tests/OS_Test.cpp: --- ACE/ace/OS_NS_netdb.inl | 6 +++--- ACE/ace/ace_wchar.h | 2 ++ ACE/tests/OS_Test.cpp | 15 ++++++++++++++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/ACE/ace/OS_NS_netdb.inl b/ACE/ace/OS_NS_netdb.inl index 433f8cfec3f..5f4e4c258e9 100644 --- a/ACE/ace/OS_NS_netdb.inl +++ b/ACE/ace/OS_NS_netdb.inl @@ -785,10 +785,10 @@ ACE_OS::gai_strerror (int errcode) default: return ACE_TEXT ("Unknown error"); } -#elif !defined ACE_WIN32 - return ACE_TEXT_CHAR_TO_TCHAR (::gai_strerror (errcode)); +#elif defined ACE_WIN32 + return ACE_TEXT_gai_strerror (errcode); #else - return ::gai_strerror (errcode); + return ACE_TEXT_CHAR_TO_TCHAR (::gai_strerror (errcode)); #endif } diff --git a/ACE/ace/ace_wchar.h b/ACE/ace/ace_wchar.h index 299c52980dd..dcc8f36fe8f 100644 --- a/ACE/ace/ace_wchar.h +++ b/ACE/ace/ace_wchar.h @@ -273,6 +273,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL #define ACE_TEXT_PdhExpandCounterPath ::PdhExpandCounterPathW #define ACE_TEXT_PdhOpenQuery ::PdhOpenQueryW #define ACE_TEXT_PdhAddCounter ::PdhAddCounterW +#define ACE_TEXT_gai_strerror ::gai_strerrorW #else /* ACE_USES_WCHAR */ #define ACE_LPSTR LPSTR @@ -332,6 +333,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL #define ACE_TEXT_PdhExpandCounterPath ::PdhExpandCounterPathA #define ACE_TEXT_PdhOpenQuery ::PdhOpenQueryA #define ACE_TEXT_PdhAddCounter ::PdhAddCounterA +#define ACE_TEXT_gai_strerror ::gai_strerrorA #endif /* ACE_USES_WCHAR */ #endif /* ACE_WIN32 */ diff --git a/ACE/tests/OS_Test.cpp b/ACE/tests/OS_Test.cpp index ebe9b47eaae..a77b58669ce 100644 --- a/ACE/tests/OS_Test.cpp +++ b/ACE/tests/OS_Test.cpp @@ -1606,12 +1606,25 @@ swab_test (void) return error_count; } +int +gai_strerror_test (void) +{ + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Testing gai_strerror method\n"))); + + const ACE_TCHAR* error_text = ACE_OS::gai_strerror (EAI_FAMILY); + + ACE_UNUSED_ARG (error_text); + + return 0; +} + int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("OS_Test")); - // Enable a locale that has digit gropuing so that snprintf's %'d is + // Enable a locale that has digit grouping so that snprintf's %'d is // different than %d. If the locale is not available the test won't // fail (log file needs to be examined to check formatting). #ifdef ACE_WIN32 -- cgit v1.2.1 From e8814092903b46280c792835e1497aa6cf5acaec Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Tue, 17 May 2016 12:23:40 +0200 Subject: Invoke new operation * ACE/tests/OS_Test.cpp: --- ACE/tests/OS_Test.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ACE/tests/OS_Test.cpp b/ACE/tests/OS_Test.cpp index a77b58669ce..a0485b34bc9 100644 --- a/ACE/tests/OS_Test.cpp +++ b/ACE/tests/OS_Test.cpp @@ -1710,6 +1710,9 @@ run_main (int, ACE_TCHAR *[]) if ((result = version_test ()) != 0) status = result; + if ((result = gai_strerror_test ()) != 0) + status = result; + ACE_END_TEST; return status; } -- cgit v1.2.1