From 9d29781b87c948a46cfa9be0f12ce978cb06846b Mon Sep 17 00:00:00 2001 From: Steve Huston Date: Thu, 26 Sep 2013 22:18:54 +0000 Subject: ChangeLogTag:Thu Sep 26 20:22:53 UTC 2013 Steve Huston and Thu Aug 29 22:06:55 UTC 2013 Steve Huston --- ACE/ChangeLog | 16 ++++++++++++++++ ACE/ace/ACE.cpp | 3 ++- ACE/ace/OS_NS_unistd.inl | 5 +++++ ACE/ace/README | 2 ++ ACE/ace/config-win32-common.h | 4 +++- ACE/tests/OS_Test.cpp | 26 ++++++++++++++++++++++++++ 6 files changed, 54 insertions(+), 2 deletions(-) diff --git a/ACE/ChangeLog b/ACE/ChangeLog index ff740f76495..f80fced2d1f 100644 --- a/ACE/ChangeLog +++ b/ACE/ChangeLog @@ -1,3 +1,19 @@ +Thu Sep 26 20:22:53 UTC 2013 Steve Huston + + * ace/ACE.cpp (recvv_n_i): Resolve 64-bit compile warning on Windows. + +Thu Aug 29 22:06:55 UTC 2013 Steve Huston + + * ace/OS_NS_unistd.inl (swab): Added support for ACE_HAS_INT_SWAB for + platforms where the 'length' arg to swab() is an int instead of + the standard ssize_t. + + * ace/config-win32-common.h: Added ACE_HAS_INT_SWAB + + * tests/OS_Test.cpp: Added a ACE_OS::swab() test. + + * ace/README: Added ACE_HAS_INT_SWAB description. + Mon May 27 10:09:24 CEST 2013 Johnny Willemsen * ACE version 6.2.0 released. diff --git a/ACE/ace/ACE.cpp b/ACE/ace/ACE.cpp index 8d635d8f399..6328905e882 100644 --- a/ACE/ace/ACE.cpp +++ b/ACE/ace/ACE.cpp @@ -1013,7 +1013,8 @@ ACE::recvv_n_i (ACE_HANDLE handle, { char *base = static_cast (iov[s].iov_base); iov[s].iov_base = base + n; - iov[s].iov_len = iov[s].iov_len - n; + // This blind cast is safe because n < iov_len, after above loop. + iov[s].iov_len = iov[s].iov_len - static_cast (n); } } diff --git a/ACE/ace/OS_NS_unistd.inl b/ACE/ace/OS_NS_unistd.inl index af393eb36be..bdc05b320df 100644 --- a/ACE/ace/OS_NS_unistd.inl +++ b/ACE/ace/OS_NS_unistd.inl @@ -1009,7 +1009,12 @@ ACE_OS::swab (const void *src, const char *tmp = static_cast (src); char *from = const_cast (tmp); char *to = static_cast (dest); +# if defined (ACE_HAS_INT_SWAB) + int ilength = ACE_Utils::truncate_cast (length); + ::swab (from, to, ilength); +# else ::swab (from, to, length); +# endif /* ACE_HAS_INT_SWAB */ #elif defined (ACE_HAS_CONST_CHAR_SWAB) const char *from = static_cast (src); char *to = static_cast (dest); diff --git a/ACE/ace/README b/ACE/ace/README index 520e218e443..4a5b989f807 100644 --- a/ACE/ace/README +++ b/ACE/ace/README @@ -332,6 +332,8 @@ ACE_HAS_IDTYPE_T Compiler/platform supports ACE_HAS_INLINED_OSCALLS Inline all the static class OS methods to remove call overhead +ACE_HAS_INT_SWAB Platform's swab function has length + argument of type int, not ssize_t. ACE_HAS_IP_MULTICAST Platform supports IP multicast ACE_HAS_IPV6 Platform supports IPv6. ACE_HAS_BROKEN_GETHOSTBYADDR_V4MAPPED gethostbyaddr does not handle diff --git a/ACE/ace/config-win32-common.h b/ACE/ace/config-win32-common.h index 5846e3e9730..f0b53719116 100644 --- a/ACE/ace/config-win32-common.h +++ b/ACE/ace/config-win32-common.h @@ -603,8 +603,10 @@ #define ACE_LACKS_ALPHASORT #define ACE_LACKS_MKSTEMP #define ACE_LACKS_LSTAT -// Looks like Win32 has a non-const swab function +// Looks like Win32 has a non-const swab function, and it takes the +// non-standard int len (rather than ssize_t). #define ACE_HAS_NONCONST_SWAB +#define ACE_HAS_INT_SWAB // gethostbyaddr does not handle IPv6-mapped-IPv4 addresses #define ACE_HAS_BROKEN_GETHOSTBYADDR_V4MAPPED diff --git a/ACE/tests/OS_Test.cpp b/ACE/tests/OS_Test.cpp index f89fba70922..ee0e4e3a1e9 100644 --- a/ACE/tests/OS_Test.cpp +++ b/ACE/tests/OS_Test.cpp @@ -1373,6 +1373,29 @@ log2_test (void) return error_count; } +int +swab_test (void) +{ + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Testing swab method\n"))); + + int error_count = 0; + char from[] = "BADCFEHGJILKNMPORQTSVUXWZY"; + char to[] = ".........................."; + char expect[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + + ACE_OS::swab (from, to, sizeof (from)); + if (ACE_OS::strcmp (to, expect) != 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("swab error: %C, expected %C\n"), + to, expect)); + ++error_count; + } + + return error_count; +} + int run_main (int, ACE_TCHAR *[]) { @@ -1440,6 +1463,9 @@ run_main (int, ACE_TCHAR *[]) if ((result = ace_ctype_test ()) != 0) status = result; + if ((result = swab_test ()) != 0) + status = result; + if ((result = compiler_test ()) != 0) status = result; -- cgit v1.2.1