summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-05-17 11:28:56 +0200
committerStephan Bergmann <sbergman@redhat.com>2018-05-17 21:03:12 +0200
commit649313625b94e6b879848fc19b607b74375100bf (patch)
treedaa8993fe967cbfdad18aabac1635f7ded1977c2 /basic
parent3a667101987ccbc75024942d779c8c62a4d0a296 (diff)
New o3tl::temporary to simplify calls of std::modf
...that ignore the out-parameter integral part Change-Id: I05f07c1a8909023232f8aecf75ea5541d4eb81ca Reviewed-on: https://gerrit.libreoffice.org/54474 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'basic')
-rw-r--r--basic/source/comp/exprnode.cxx10
-rw-r--r--basic/source/runtime/methods1.cxx4
2 files changed, 6 insertions, 8 deletions
diff --git a/basic/source/comp/exprnode.cxx b/basic/source/comp/exprnode.cxx
index 8d6db9bd88d8..aa8f69828c37 100644
--- a/basic/source/comp/exprnode.cxx
+++ b/basic/source/comp/exprnode.cxx
@@ -21,6 +21,7 @@
#include <math.h>
#include <algorithm>
+#include <o3tl/temporary.hxx>
#include <rtl/math.hxx>
#include <codegen.hxx>
#include <parser.hxx>
@@ -152,8 +153,7 @@ void SbiExprNode::ConvertToIntConstIfPossible()
{
if( eType >= SbxINTEGER && eType <= SbxDOUBLE )
{
- double n;
- if( nVal >= SbxMININT && nVal <= SbxMAXINT && modf( nVal, &n ) == 0 )
+ if( nVal >= SbxMININT && nVal <= SbxMAXINT && modf( nVal, &o3tl::temporary(double()) ) == 0 )
{
eType = SbxINTEGER;
}
@@ -220,9 +220,8 @@ void SbiExprNode::FoldConstants(SbiParser* pParser)
// Potentially convolve in INTEGER (because of better opcode)?
if( eType == SbxSINGLE || eType == SbxDOUBLE )
{
- double x;
if( nVal >= SbxMINLNG && nVal <= SbxMAXLNG
- && !modf( nVal, &x ) )
+ && !modf( nVal, &o3tl::temporary(double()) ) )
eType = SbxLONG;
}
if( eType == SbxLONG && nVal >= SbxMININT && nVal <= SbxMAXINT )
@@ -463,9 +462,8 @@ void SbiExprNode::FoldConstantsUnaryNode(SbiParser* pParser)
// Potentially convolve in INTEGER (because of better opcode)?
if( eType == SbxSINGLE || eType == SbxDOUBLE )
{
- double x;
if( nVal >= SbxMINLNG && nVal <= SbxMAXLNG
- && !modf( nVal, &x ) )
+ && !modf( nVal, &o3tl::temporary(double()) ) )
eType = SbxLONG;
}
if( eType == SbxLONG && nVal >= SbxMININT && nVal <= SbxMAXINT )
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index 3a1964783ff5..8c8c3dcbcd7d 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -35,6 +35,7 @@
#include <svl/zforlist.hxx>
#include <tools/urlobj.hxx>
#include <tools/fract.hxx>
+#include <o3tl/temporary.hxx>
#include <osl/file.hxx>
#include <vcl/jobset.hxx>
#include <sbobjmod.hxx>
@@ -2354,8 +2355,7 @@ void SbRtl_FormatDateTime(StarBASIC *, SbxArray & rPar, bool)
// ShortTime: Display a time using the 24-hour format (hh:mm).
// 11:24
case 4:
- double n;
- double dTime = modf( dDate, &n );
+ double dTime = modf( dDate, &o3tl::temporary(double()) );
pSbxVar->PutDate( dTime );
if( nNamedFormat == 3 )
{