diff options
author | Steve Huston <shuston@riverace.com> | 2013-09-26 22:18:12 +0000 |
---|---|---|
committer | Steve Huston <shuston@riverace.com> | 2013-09-26 22:18:12 +0000 |
commit | a50e44a4c14872ae1b48d4c111cbd3089ea0ca28 (patch) | |
tree | a0c4feaea968b3fe4d9d543a1b189f1615ef296a | |
parent | 33a398f5ff9289f0926c932ac412b5430e30d54c (diff) | |
download | ATCD-a50e44a4c14872ae1b48d4c111cbd3089ea0ca28.tar.gz |
ChangeLogTag:Thu Sep 26 20:22:53 UTC 2013 Steve Huston <shuston@riverace.com> and Thu Aug 29 22:06:55 UTC 2013 Steve Huston <shuston@riverace.com>
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | ace/ACE.cpp | 3 | ||||
-rw-r--r-- | ace/OS_NS_unistd.inl | 5 | ||||
-rw-r--r-- | ace/README | 2 | ||||
-rw-r--r-- | ace/config-win32-common.h | 4 | ||||
-rw-r--r-- | tests/OS_Test.cpp | 26 |
6 files changed, 54 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog index 31db8b0da7b..1edebb37222 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +Thu Sep 26 20:22:53 UTC 2013 Steve Huston <shuston@riverace.com> + + * ace/ACE.cpp (recvv_n_i): Resolve 64-bit compile warning on Windows. + +Thu Aug 29 22:06:55 UTC 2013 Steve Huston <shuston@riverace.com> + + * 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 Apr 9 21:57:39 UTC 2012 Steve Huston <shuston@riverace.com> * ace/Timer_Queue_T.cpp (calculate_timeout): Lock the mutex before diff --git a/ace/ACE.cpp b/ace/ACE.cpp index 210412db220..75384682cdd 100644 --- a/ace/ACE.cpp +++ b/ace/ACE.cpp @@ -1013,7 +1013,8 @@ ACE::recvv_n_i (ACE_HANDLE handle, { char *base = static_cast<char *> (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<u_long> (n); } } diff --git a/ace/OS_NS_unistd.inl b/ace/OS_NS_unistd.inl index 4e1fb55df4c..c90ef33179f 100644 --- a/ace/OS_NS_unistd.inl +++ b/ace/OS_NS_unistd.inl @@ -1013,7 +1013,12 @@ ACE_OS::swab (const void *src, const char *tmp = static_cast<const char*> (src); char *from = const_cast<char *> (tmp); char *to = static_cast<char *> (dest); +# if defined (ACE_HAS_INT_SWAB) + int ilength = ACE_Utils::truncate_cast<int> (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<const char*> (src); char *to = static_cast<char *> (dest); diff --git a/ace/README b/ace/README index 520e218e443..4a5b989f807 100644 --- a/ace/README +++ b/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/config-win32-common.h b/ace/config-win32-common.h index e65dccf1368..0e9c20fd0c8 100644 --- a/ace/config-win32-common.h +++ b/ace/config-win32-common.h @@ -599,8 +599,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/tests/OS_Test.cpp b/tests/OS_Test.cpp index 1e664fac7ff..4c66a294e23 100644 --- a/tests/OS_Test.cpp +++ b/tests/OS_Test.cpp @@ -1360,6 +1360,29 @@ log2_test (void) } 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 *[]) { ACE_START_TEST (ACE_TEXT ("OS_Test")); @@ -1426,6 +1449,9 @@ run_main (int, ACE_TCHAR *[]) if ((result = ace_ctype_test ()) != 0) status = result; + if ((result = swab_test ()) != 0) + status = result; + ACE_END_TEST; return status; } |