From ee25f2b440963178beea4a9eee69b6403d1f42cf Mon Sep 17 00:00:00 2001 From: Ossama Othman Date: Fri, 2 Mar 2007 17:51:47 +0000 Subject: ChangeLogTag:Fri Mar 2 09:48:09 Pacific Standard Time 2007 --- ACE/ChangeLog | 7 +++++++ ACE/ace/Truncate.h | 15 ++++++++++----- 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 + + * 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 * 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 struct Truncator { TO operator() (ACE_U_LongLong const & val) { - // ACE_U_LongLong returns a ACE_UINT32. + // If val less than or equal to ACE_Numeric_Limits::max(), + // val.lo() must be less than or equal to + // ACE_Numeric_Limits::max (), as well. return - Truncator ( - val) > ACE_Numeric_Limits::max () - ? val.lo ()); + (val > ACE_Numeric_Limits::max () + ? ACE_Numeric_Limits::max () + : static_cast (val.lo ())); } }; #endif /* ACE_LACKS_LONGLONG_T || ACE_LACKS_UNSIGNEDLONGLONG_T */ -- cgit v1.2.1