summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2013-06-27 08:51:02 +0200
committerFridrich Strba <fridrich@documentfoundation.org>2013-06-28 12:27:33 +0000
commit82593374493c967bbb1ba15d005470d7f108ae87 (patch)
tree3bc43b8040ca3c54d15a44da0d1162146fb8ca96
parentfe89aa916601e53637259c757a4da433fbc4feda (diff)
fdo#66216 fix DBTypeConversion::toTime overflow
Change-Id: I0aba2344afde94226cfbac5b3221e827e6774b3a Reviewed-on: https://gerrit.libreoffice.org/4565 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
-rw-r--r--connectivity/source/commontools/dbconversion.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/connectivity/source/commontools/dbconversion.cxx b/connectivity/source/commontools/dbconversion.cxx
index 513a8b05d26e..f777420e3626 100644
--- a/connectivity/source/commontools/dbconversion.cxx
+++ b/connectivity/source/commontools/dbconversion.cxx
@@ -355,7 +355,7 @@ namespace dbtools
Time DBTypeConversion::toTime(double dVal)
{
sal_Int32 nDays = (sal_Int32)dVal;
- sal_Int32 nNS = sal_Int32((dVal - (double)nDays) * fNanoSecondsPerDay + 0.5);
+ sal_Int64 nNS = static_cast<sal_Int64>((dVal - (double)nDays) * fNanoSecondsPerDay + 0.5);
sal_Int16 nSign;
if ( nNS < 0 )
@@ -369,7 +369,7 @@ namespace dbtools
Time xRet;
// normalize time
// we have to sal_Int32 here because otherwise we get an overflow
- sal_Int32 nNanoSeconds = nNS;
+ sal_Int64 nNanoSeconds = nNS;
sal_Int32 nSeconds = nNanoSeconds / nanoSecInSec;
sal_Int32 nMinutes = nSeconds / secInMin;