summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOssama Othman <ossama-othman@users.noreply.github.com>2007-03-02 17:51:47 +0000
committerOssama Othman <ossama-othman@users.noreply.github.com>2007-03-02 17:51:47 +0000
commitee25f2b440963178beea4a9eee69b6403d1f42cf (patch)
tree2e843ad96b12e1b5fe8d09682cf5829fe8ef10e0
parent20ea5a7ce5fd0ec80a879e70cfc2b47eeb62f530 (diff)
downloadATCD-ee25f2b440963178beea4a9eee69b6403d1f42cf.tar.gz
ChangeLogTag:Fri Mar 2 09:48:09 Pacific Standard Time 2007 <ossama_othman at symantec dot com>
-rw-r--r--ACE/ChangeLog7
-rw-r--r--ACE/ace/Truncate.h15
2 files changed, 17 insertions, 5 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog
index 2a9d0096b4a..a6176c2dbe7 100644
--- a/ACE/ChangeLog
+++ b/ACE/ChangeLog
@@ -1,3 +1,10 @@
+Fri Mar 2 09:48:09 Pacific Standard Time 2007 <ossama_othman at symantec dot com>
+
+ * ace/Truncate.h (Truncator):
+
+ Fixed one more typo in the ACE_U_LongLong partial specialization
+ of this functor. Also corrected truncation logic.
+
Thu Mar 1 13:15:12 UTC 2007 Johnny Willemsen <jwillemsen@remedy.nl>
* ace/config-hpux-11.00.h:
diff --git a/ACE/ace/Truncate.h b/ACE/ace/Truncate.h
index 755ed1ecb9e..28bc27dabf6 100644
--- a/ACE/ace/Truncate.h
+++ b/ACE/ace/Truncate.h
@@ -445,17 +445,22 @@ namespace ACE_Utils
#if defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
// Partial specialization for the case where we're casting from
- // ACE_U_LongLong to a smaller integer.
+ // ACE_U_LongLong to a smaller integer. We assume that we're always
+ // truncating from ACE_U_LongLong to a smaller type. The partial
+ // specialization above handles the case where both the FROM and TO
+ // types are ACE_U_LongLong.
template<typename TO>
struct Truncator<ACE_U_LongLong, TO>
{
TO operator() (ACE_U_LongLong const & val)
{
- // ACE_U_LongLong returns a ACE_UINT32.
+ // If val less than or equal to ACE_Numeric_Limits<TO>::max(),
+ // val.lo() must be less than or equal to
+ // ACE_Numeric_Limits<TO>::max (), as well.
return
- Truncator<ACE_UINT32, TO> (
- val) > ACE_Numeric_Limits<ACE_UINT32>::max ()
- ? val.lo ());
+ (val > ACE_Numeric_Limits<TO>::max ()
+ ? ACE_Numeric_Limits<TO>::max ()
+ : static_cast<TO> (val.lo ()));
}
};
#endif /* ACE_LACKS_LONGLONG_T || ACE_LACKS_UNSIGNEDLONGLONG_T */