diff options
Diffstat (limited to 'basic/source')
-rw-r--r-- | basic/source/inc/rtlproto.hxx | 1 | ||||
-rw-r--r-- | basic/source/runtime/methods1.cxx | 10 | ||||
-rw-r--r-- | basic/source/sbx/sbxbool.cxx | 3 | ||||
-rw-r--r-- | basic/source/sbx/sbxbyte.cxx | 3 | ||||
-rw-r--r-- | basic/source/sbx/sbxchar.cxx | 3 | ||||
-rw-r--r-- | basic/source/sbx/sbxdbl.cxx | 3 | ||||
-rw-r--r-- | basic/source/sbx/sbxint.cxx | 7 | ||||
-rw-r--r-- | basic/source/sbx/sbxlng.cxx | 3 | ||||
-rw-r--r-- | basic/source/sbx/sbxscan.cxx | 3 | ||||
-rw-r--r-- | basic/source/sbx/sbxsng.cxx | 3 | ||||
-rw-r--r-- | basic/source/sbx/sbxuint.cxx | 3 | ||||
-rw-r--r-- | basic/source/sbx/sbxulng.cxx | 3 | ||||
-rw-r--r-- | basic/source/sbx/sbxvalue.cxx | 5 | ||||
-rw-r--r-- | basic/source/sbx/sbxvar.cxx | 5 |
14 files changed, 39 insertions, 16 deletions
diff --git a/basic/source/inc/rtlproto.hxx b/basic/source/inc/rtlproto.hxx index b20fa9afab45..06f0bd8b0c30 100644 --- a/basic/source/inc/rtlproto.hxx +++ b/basic/source/inc/rtlproto.hxx @@ -354,6 +354,7 @@ extern void SbRtl_CDec(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); extern void SbRtl_Partition(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); +extern bool LibreOffice6FloatingPointMode(); extern double Now_Impl(); extern void Wait_Impl( bool bDurationBased, SbxArray& rPar ); diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx index 117e84d73000..8e78776bc7f8 100644 --- a/basic/source/runtime/methods1.cxx +++ b/basic/source/runtime/methods1.cxx @@ -61,6 +61,9 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/i18n/LocaleCalendar2.hpp> #include <com/sun/star/sheet/XFunctionAccess.hpp> + +#include <officecfg/Office/Scripting.hxx> + #include <memory> using namespace comphelper; @@ -2970,6 +2973,13 @@ void SbRtl_CompatibilityMode(StarBASIC *, SbxArray & rPar, bool) rPar.Get(0)->PutBool(bEnabled); } +bool LibreOffice6FloatingPointMode() +{ + static bool bMode = std::getenv("LIBREOFFICE6FLOATINGPOINTMODE") != nullptr; + + return bMode || officecfg::Office::Scripting::Basic::Compatibility::UseLibreOffice6FloatingPointConversion::get(); +} + void SbRtl_Input(StarBASIC *, SbxArray & rPar, bool) { // 2 parameters needed diff --git a/basic/source/sbx/sbxbool.cxx b/basic/source/sbx/sbxbool.cxx index 723939fb0c4a..0b5f2111eca8 100644 --- a/basic/source/sbx/sbxbool.cxx +++ b/basic/source/sbx/sbxbool.cxx @@ -21,6 +21,7 @@ #include <basic/sberrors.hxx> #include "sbxconv.hxx" #include "sbxres.hxx" +#include <rtlproto.hxx> enum SbxBOOL ImpGetBool( const SbxValues* p ) { @@ -80,7 +81,7 @@ enum SbxBOOL ImpGetBool( const SbxValues* p ) double n; SbxDataType t; sal_uInt16 nLen = 0; - if( ImpScan( *p->pOUString, n, t, &nLen, true ) == ERRCODE_NONE ) + if( ImpScan( *p->pOUString, n, t, &nLen, !LibreOffice6FloatingPointMode() ) == ERRCODE_NONE ) { if( nLen == p->pOUString->getLength() ) { diff --git a/basic/source/sbx/sbxbyte.cxx b/basic/source/sbx/sbxbyte.cxx index 4974213dc7a1..1892167121c2 100644 --- a/basic/source/sbx/sbxbyte.cxx +++ b/basic/source/sbx/sbxbyte.cxx @@ -24,6 +24,7 @@ //#include <basic/sbx.hxx> #include <basic/sberrors.hxx> #include "sbxconv.hxx" +#include <rtlproto.hxx> #include <rtl/math.hxx> @@ -165,7 +166,7 @@ start: { double d; SbxDataType t; - if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE ) + if( ImpScan( *p->pOUString, d, t, nullptr, !LibreOffice6FloatingPointMode() ) != ERRCODE_NONE ) nRes = 0; else if( d > SbxMAXBYTE ) { diff --git a/basic/source/sbx/sbxchar.cxx b/basic/source/sbx/sbxchar.cxx index d25ccc083d7c..36bd8d60d482 100644 --- a/basic/source/sbx/sbxchar.cxx +++ b/basic/source/sbx/sbxchar.cxx @@ -20,6 +20,7 @@ #include <vcl/errcode.hxx> #include <basic/sberrors.hxx> #include "sbxconv.hxx" +#include <rtlproto.hxx> #include <rtl/math.hxx> @@ -147,7 +148,7 @@ start: { double d; SbxDataType t; - if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE ) + if( ImpScan( *p->pOUString, d, t, nullptr, !LibreOffice6FloatingPointMode() ) != ERRCODE_NONE ) nRes = 0; else if( d > SbxMAXCHAR ) { diff --git a/basic/source/sbx/sbxdbl.cxx b/basic/source/sbx/sbxdbl.cxx index 9718c1dfd7b7..84b5403c3f10 100644 --- a/basic/source/sbx/sbxdbl.cxx +++ b/basic/source/sbx/sbxdbl.cxx @@ -22,6 +22,7 @@ #include <o3tl/float_int_conversion.hxx> #include <vcl/errcode.hxx> #include "sbxconv.hxx" +#include <rtlproto.hxx> #include <runtime.hxx> double ImpGetDouble( const SbxValues* p ) @@ -81,7 +82,7 @@ double ImpGetDouble( const SbxValues* p ) { double d; SbxDataType t; - if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE ) + if( ImpScan( *p->pOUString, d, t, nullptr, !LibreOffice6FloatingPointMode() ) != ERRCODE_NONE ) { nRes = 0; #if HAVE_FEATURE_SCRIPTING diff --git a/basic/source/sbx/sbxint.cxx b/basic/source/sbx/sbxint.cxx index 85febcd802c2..f702c6b1fb3a 100644 --- a/basic/source/sbx/sbxint.cxx +++ b/basic/source/sbx/sbxint.cxx @@ -24,6 +24,7 @@ #include <vcl/errcode.hxx> #include <basic/sberrors.hxx> #include "sbxconv.hxx" +#include <rtlproto.hxx> #include <rtl/math.hxx> @@ -140,7 +141,7 @@ start: { double d; SbxDataType t; - if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE ) + if( ImpScan( *p->pOUString, d, t, nullptr, !LibreOffice6FloatingPointMode() ) != ERRCODE_NONE ) nRes = 0; else nRes = ImpDoubleToInteger(d); @@ -383,7 +384,7 @@ start: // Check if really 0 or invalid conversion double d; SbxDataType t; - if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE ) + if( ImpScan( *p->pOUString, d, t, nullptr, !LibreOffice6FloatingPointMode() ) != ERRCODE_NONE ) nRes = 0; else nRes = ImpDoubleToSalInt64(d); @@ -639,7 +640,7 @@ start: // Check if really 0 or invalid conversion double d; SbxDataType t; - if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE ) + if( ImpScan( *p->pOUString, d, t, nullptr, !LibreOffice6FloatingPointMode() ) != ERRCODE_NONE ) nRes = 0; else nRes = ImpDoubleToSalUInt64(d); diff --git a/basic/source/sbx/sbxlng.cxx b/basic/source/sbx/sbxlng.cxx index 915cf861025f..1bc4e4e6669c 100644 --- a/basic/source/sbx/sbxlng.cxx +++ b/basic/source/sbx/sbxlng.cxx @@ -23,6 +23,7 @@ #include <vcl/errcode.hxx> #include <basic/sberrors.hxx> #include "sbxconv.hxx" +#include <rtlproto.hxx> #include <rtl/math.hxx> @@ -103,7 +104,7 @@ start: { double d; SbxDataType t; - if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE ) + if( ImpScan( *p->pOUString, d, t, nullptr, !LibreOffice6FloatingPointMode() ) != ERRCODE_NONE ) nRes = 0; else nRes = ImpDoubleToLong(d); diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx index e6037d05cbcd..d8c1582af52d 100644 --- a/basic/source/sbx/sbxscan.cxx +++ b/basic/source/sbx/sbxscan.cxx @@ -26,6 +26,7 @@ #include <vcl/errcode.hxx> #include <unotools/resmgr.hxx> #include "sbxconv.hxx" +#include <rtlproto.hxx> #include <unotools/syslocale.hxx> #include <unotools/charclass.hxx> @@ -400,7 +401,7 @@ bool SbxValue::Scan( const OUString& rSrc, sal_uInt16* pLen ) { double n; SbxDataType t; - eRes = ImpScan( rSrc, n, t, pLen, true ); + eRes = ImpScan( rSrc, n, t, pLen, !LibreOffice6FloatingPointMode() ); if( eRes == ERRCODE_NONE ) { if( !IsFixed() ) diff --git a/basic/source/sbx/sbxsng.cxx b/basic/source/sbx/sbxsng.cxx index f97c6815d18a..bdcc4b139f36 100644 --- a/basic/source/sbx/sbxsng.cxx +++ b/basic/source/sbx/sbxsng.cxx @@ -23,6 +23,7 @@ #include <vcl/errcode.hxx> #include <basic/sberrors.hxx> #include "sbxconv.hxx" +#include <rtlproto.hxx> float ImpGetSingle( const SbxValues* p ) { @@ -109,7 +110,7 @@ start: { double d; SbxDataType t; - if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE ) + if( ImpScan( *p->pOUString, d, t, nullptr, !LibreOffice6FloatingPointMode() ) != ERRCODE_NONE ) nRes = 0; else if( d > SbxMAXSNG ) { diff --git a/basic/source/sbx/sbxuint.cxx b/basic/source/sbx/sbxuint.cxx index d8eeec4bc94d..6299612b500f 100644 --- a/basic/source/sbx/sbxuint.cxx +++ b/basic/source/sbx/sbxuint.cxx @@ -23,6 +23,7 @@ #include <vcl/errcode.hxx> #include <basic/sberrors.hxx> #include "sbxconv.hxx" +#include <rtlproto.hxx> sal_uInt16 ImpGetUShort( const SbxValues* p ) { @@ -136,7 +137,7 @@ start: { double d; SbxDataType t; - if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE ) + if( ImpScan( *p->pOUString, d, t, nullptr, !LibreOffice6FloatingPointMode() ) != ERRCODE_NONE ) nRes = 0; else nRes = ImpDoubleToUShort(d); diff --git a/basic/source/sbx/sbxulng.cxx b/basic/source/sbx/sbxulng.cxx index fa872b8b0bb5..a0db33f80abd 100644 --- a/basic/source/sbx/sbxulng.cxx +++ b/basic/source/sbx/sbxulng.cxx @@ -23,6 +23,7 @@ #include <vcl/errcode.hxx> #include <basic/sberrors.hxx> #include "sbxconv.hxx" +#include <rtlproto.hxx> sal_uInt32 ImpGetULong( const SbxValues* p ) { @@ -103,7 +104,7 @@ start: { double d; SbxDataType t; - if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE ) + if( ImpScan( *p->pOUString, d, t, nullptr, !LibreOffice6FloatingPointMode() ) != ERRCODE_NONE ) nRes = 0; else nRes = ImpDoubleToULong(d); diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index 7530f88dc6c6..fe7245a6da76 100644 --- a/basic/source/sbx/sbxvalue.cxx +++ b/basic/source/sbx/sbxvalue.cxx @@ -30,6 +30,7 @@ #include <basic/sbx.hxx> #include <sbunoobj.hxx> #include "sbxconv.hxx" +#include <rtlproto.hxx> #include <runtime.hxx> @@ -1324,7 +1325,7 @@ bool SbxValue::LoadData( SvStream& r, sal_uInt16 ) RTL_TEXTENCODING_ASCII_US); double d; SbxDataType t; - if( ImpScan( aVal, d, t, nullptr, true ) != ERRCODE_NONE || t == SbxDOUBLE ) + if( ImpScan( aVal, d, t, nullptr, !LibreOffice6FloatingPointMode() ) != ERRCODE_NONE || t == SbxDOUBLE ) { aData.nSingle = 0.0F; return false; @@ -1339,7 +1340,7 @@ bool SbxValue::LoadData( SvStream& r, sal_uInt16 ) OUString aVal = read_uInt16_lenPrefixed_uInt8s_ToOUString(r, RTL_TEXTENCODING_ASCII_US); SbxDataType t; - if( ImpScan( aVal, aData.nDouble, t, nullptr, true ) != ERRCODE_NONE ) + if( ImpScan( aVal, aData.nDouble, t, nullptr, !LibreOffice6FloatingPointMode() ) != ERRCODE_NONE ) { aData.nDouble = 0.0; return false; diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx index b8be36ec2735..8c5d6571feef 100644 --- a/basic/source/sbx/sbxvar.cxx +++ b/basic/source/sbx/sbxvar.cxx @@ -26,6 +26,7 @@ #include <runtime.hxx> #include "sbxres.hxx" #include "sbxconv.hxx" +#include <rtlproto.hxx> #include <sbunoobj.hxx> #include <rtl/character.hxx> #include <rtl/ustrbuf.hxx> @@ -437,7 +438,7 @@ bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer ) rStrm, RTL_TEXTENCODING_ASCII_US); double d; SbxDataType t; - if( ImpScan( aTmpString, d, t, nullptr, true ) != ERRCODE_NONE || t == SbxDOUBLE ) + if( ImpScan( aTmpString, d, t, nullptr, !LibreOffice6FloatingPointMode() ) != ERRCODE_NONE || t == SbxDOUBLE ) { aTmp.nSingle = 0; return false; @@ -452,7 +453,7 @@ bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer ) aTmpString = read_uInt16_lenPrefixed_uInt8s_ToOUString(rStrm, RTL_TEXTENCODING_ASCII_US); SbxDataType t; - if( ImpScan( aTmpString, aTmp.nDouble, t, nullptr, true ) != ERRCODE_NONE ) + if( ImpScan( aTmpString, aTmp.nDouble, t, nullptr, !LibreOffice6FloatingPointMode() ) != ERRCODE_NONE ) { aTmp.nDouble = 0; return false; |