diff options
author | Steve Huston <shuston@riverace.com> | 2006-01-12 16:52:21 +0000 |
---|---|---|
committer | Steve Huston <shuston@riverace.com> | 2006-01-12 16:52:21 +0000 |
commit | d1984f23b5f426d65d29f455489f614457eddaa1 (patch) | |
tree | fe2fa97e07e0a4c8c619c6b59ee183f8ac2da062 | |
parent | 0d30130d5ccaeca8702a24c45792f27eb9cb52d0 (diff) | |
download | ATCD-d1984f23b5f426d65d29f455489f614457eddaa1.tar.gz |
ChangeLogTag:Thu Jan 12 16:44:40 UTC 2006 Steve Huston <shuston@riverace.com>
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | ace/Functor.h | 26 | ||||
-rw-r--r-- | ace/Functor.inl | 15 | ||||
-rw-r--r-- | ace/INET_Addr.cpp | 4 |
4 files changed, 40 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog index 5d89ed2f0f3..384088278c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +Thu Jan 12 16:44:40 UTC 2006 Steve Huston <shuston@riverace.com> + + * ace/Functor.{h inl}: Using ACE_LACKS_LONGLONG_T wasn't good enough + for deciding when to do an ACE_Hash<[unsigned] long long>. MSVC6 + can't hack it. So, do the specialization for the 64-bit types if + ACE_SIZEOF_LONG < 8, avoiding a duplication of ACE_Hash<long>. + Also, since the way "unsigned long long" is declared varies across + compilers, use ACE_[U]INT64 rather than the native C++ type. + + * ace/INET_Addr.cpp (string_to_addr): u_short always compares >= 0, + so rely on the indicated end of successful scan from ACE_OS::strtol() + to say whether it scanned all digits or stopped short of the end of + the string. + Thu Jan 12 12:59:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl> * include/makeinclude/platform_vxworks6.2.GNU: diff --git a/ace/Functor.h b/ace/Functor.h index 56d3b0255aa..01967e5f977 100644 --- a/ace/Functor.h +++ b/ace/Functor.h @@ -276,35 +276,37 @@ public: unsigned long operator () (unsigned long t) const; }; -#if !defined (ACE_LACKS_LONGLONG_T) +#if !defined (ACE_LACKS_LONGLONG_T) && (ACE_SIZEOF_LONG < 8) /** - * @class ACE_Hash<long long> + * @class ACE_Hash<ACE_INT64> * - * @brief Function object for hashing a long long number + * @brief Function object for hashing a signed 64-bit number */ template<> -class ACE_Export ACE_Hash<long long> +class ACE_Export ACE_Hash<ACE_INT64> { public: /// Simply returns t - unsigned long operator () (long long t) const; + unsigned long operator () (ACE_INT64 t) const; }; -#endif /* !ACE_LACKS_LONGLONG_T */ +#endif /* !ACE_LACKS_LONGLONG_T && ACE_SIZEOF_LONG < 8 */ -#if !defined (ACE_LACKS_UNSIGNEDLONGLONG_T) +// We can do this even if ACE_LACKS_UNSIGNEDLONGLONG_T because there's an +// emulation for it in ACE_U_LongLong. +#if (ACE_SIZEOF_LONG < 8) /** - * @class ACE_Hash<unsigned long long> + * @class ACE_Hash<ACE_UINT64> * - * @brief Function object for hashing an unsigned long long number + * @brief Function object for hashing an unsigned 64-bit number */ template<> -class ACE_Export ACE_Hash<unsigned long long> +class ACE_Export ACE_Hash<ACE_UINT64> { public: /// Simply returns t - unsigned long operator () (unsigned long long t) const; + unsigned long operator () (const ACE_UINT64 &t) const; }; -#endif /* !ACE_LACKS_UNSIGNEDLONGLONG_T */ +#endif /* ACE_SIZEOF_LONG < 8 */ /** * @class ACE_Hash<const char *> diff --git a/ace/Functor.inl b/ace/Functor.inl index 31ff79f99ad..84e38313b02 100644 --- a/ace/Functor.inl +++ b/ace/Functor.inl @@ -148,19 +148,24 @@ ACE_Hash<unsigned long>::operator () (unsigned long t) const return t; } -#if !defined (ACE_LACKS_LONGLONG_T) +// This #if needs to match the one in Functor.h +#if !defined (ACE_LACKS_LONGLONG_T) && (ACE_SIZEOF_LONG < 8) ACE_INLINE unsigned long -ACE_Hash<long long>::operator () (long long t) const +ACE_Hash<ACE_INT64>::operator () (ACE_INT64 t) const { return static_cast<unsigned long> (t); } -#endif /* !ACE_LACKS_LONGLONG_T */ +#endif /* !ACE_LACKS_LONGLONG_T && ACE_SIZEOF_LONG < 8 */ -#if !defined (ACE_LACKS_UNSIGNEDLONGLONG_T) +#if (ACE_SIZEOF_LONG < 8) ACE_INLINE unsigned long -ACE_Hash<unsigned long long>::operator () (unsigned long long t) const +ACE_Hash<ACE_UINT64>::operator () (const ACE_UINT64 &t) const { +#if (ACE_SIZEOF_LONG == 4) + return ACE_U64_TO_U32 (t); +#else return static_cast<unsigned long> (t); +#endif /* ACE_SIZEOF_LONG */ } #endif /* !ACE_LACKS_UNSIGNEDLONGLONG_T */ diff --git a/ace/INET_Addr.cpp b/ace/INET_Addr.cpp index b0cfccea61f..0d109f3e907 100644 --- a/ace/INET_Addr.cpp +++ b/ace/INET_Addr.cpp @@ -184,7 +184,7 @@ ACE_INET_Addr::string_to_addr (const char s[]) char *endp = 0; u_short port = static_cast<u_short> (ACE_OS::strtol (ip_addr, &endp, 10)); - if (port >= 0 && *endp == '\0') + if (*endp == '\0') // strtol scanned the entire string - all digits result = this->set (port, ACE_UINT32 (INADDR_ANY)); else // port name result = this->set (ip_addr, ACE_UINT32 (INADDR_ANY)); @@ -195,7 +195,7 @@ ACE_INET_Addr::string_to_addr (const char s[]) char *endp = 0; u_short port = static_cast<u_short> (ACE_OS::strtol (port_p, &endp, 10)); - if (port >= 0 && *endp == '\0') + if (*endp == '\0') // strtol scanned the entire string - all digits result = this->set (port, ip_addr); else result = this->set (port_p, ip_addr); |