diff options
author | Steve Huston <shuston@riverace.com> | 2013-09-26 22:20:20 +0000 |
---|---|---|
committer | Steve Huston <shuston@riverace.com> | 2013-09-26 22:20:20 +0000 |
commit | e89a45aa149cfa10b553831eadec1690b7933844 (patch) | |
tree | 31fb9b07bc2bc8a0cca8070e4d997e2d7b7992ca | |
parent | 7f6165a3ac38c65dbb4081693992a635b1579346 (diff) | |
download | ATCD-e89a45aa149cfa10b553831eadec1690b7933844.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 0e9268d738c..fb224496e04 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. + Tue Nov 20 23:55:57 UTC 2012 Steve Huston <shuston@riverace.com> * ace/config-hpux-11.00.h: diff --git a/ace/ACE.cpp b/ace/ACE.cpp index 19060e5e619..983c7747167 100644 --- a/ace/ACE.cpp +++ b/ace/ACE.cpp @@ -1037,7 +1037,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 ac103088ed2..4bd4a6d7aae 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 da3f1f1688c..b5a569384ec 100644 --- a/ace/README +++ b/ace/README @@ -344,6 +344,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 fde0ad9d025..d7abb8164cb 100644 --- a/ace/config-win32-common.h +++ b/ace/config-win32-common.h @@ -608,8 +608,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 // If we are using winsock2 then the SO_REUSEADDR feature is broken // SO_REUSEADDR=1 behaves like SO_REUSEPORT=1. (SO_REUSEPORT is an diff --git a/tests/OS_Test.cpp b/tests/OS_Test.cpp index 227ed1faaf4..0b0e3f28648 100644 --- a/tests/OS_Test.cpp +++ b/tests/OS_Test.cpp @@ -1326,6 +1326,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")); @@ -1389,6 +1412,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; } |