summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorAndreas Heinisch <andreas.heinisch@yahoo.de>2019-11-25 15:14:53 +0100
committerMike Kaganski <mike.kaganski@collabora.com>2019-11-28 10:21:25 +0100
commit4fdc90c51e6a1bbb83c1f1826ad5b90dc1ff0ad6 (patch)
tree17737dea4d38b97e6247d7d0c5daac270c04e55c /basic
parentfc34df00c47e97fa1a9633c1e14e8b9df52f77f5 (diff)
tdf#97983 - Added localization for numeric types
For numeric types, take into consideration different locales Change-Id: I815c195e7ef53a7b958f85932415a16c9a8a1e35 Reviewed-on: https://gerrit.libreoffice.org/83683 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'basic')
-rw-r--r--basic/qa/basic_coverage/test_types_conversion.vb11
-rw-r--r--basic/source/sbx/sbxbool.cxx2
-rw-r--r--basic/source/sbx/sbxbyte.cxx2
-rw-r--r--basic/source/sbx/sbxchar.cxx2
-rw-r--r--basic/source/sbx/sbxdbl.cxx2
-rw-r--r--basic/source/sbx/sbxint.cxx6
-rw-r--r--basic/source/sbx/sbxlng.cxx2
-rw-r--r--basic/source/sbx/sbxscan.cxx2
-rw-r--r--basic/source/sbx/sbxsng.cxx2
-rw-r--r--basic/source/sbx/sbxuint.cxx2
-rw-r--r--basic/source/sbx/sbxulng.cxx2
-rw-r--r--basic/source/sbx/sbxvalue.cxx4
-rw-r--r--basic/source/sbx/sbxvar.cxx4
13 files changed, 22 insertions, 21 deletions
diff --git a/basic/qa/basic_coverage/test_types_conversion.vb b/basic/qa/basic_coverage/test_types_conversion.vb
index 0de109bc984f..0868f4d3e50a 100644
--- a/basic/qa/basic_coverage/test_types_conversion.vb
+++ b/basic/qa/basic_coverage/test_types_conversion.vb
@@ -11,6 +11,7 @@ Dim nTotalCount As Integer
Dim nPassCount As Integer
Dim nFailCount As Integer
+' For the following tests the en-US (English - United States) locale is required
Function doUnitTest() As Integer
nTotalCount = 0
nPassCount = 0
@@ -35,13 +36,13 @@ Function doUnitTest() As Integer
' Negative floating-point with leading and trailing spaces
StartTest()
- nVal = " -123.45 "
- AssertTest(nVal = -123.45)
+ nVal = " -123.456 "
+ AssertTest(nVal = -123.456)
- ' Wrong decimal separator
+ ' Wrong decimal separator (interpreted as group separator)
StartTest()
- nVal = " -123,45 "
- AssertTest(nVal = -123)
+ nVal = " -123,456 "
+ AssertTest(nVal = -123456)
If ((nFailCount > 0) Or (nPassCount <> nTotalCount)) Then
doUnitTest = 0
diff --git a/basic/source/sbx/sbxbool.cxx b/basic/source/sbx/sbxbool.cxx
index 950fb168d01c..723939fb0c4a 100644
--- a/basic/source/sbx/sbxbool.cxx
+++ b/basic/source/sbx/sbxbool.cxx
@@ -80,7 +80,7 @@ enum SbxBOOL ImpGetBool( const SbxValues* p )
double n;
SbxDataType t;
sal_uInt16 nLen = 0;
- if( ImpScan( *p->pOUString, n, t, &nLen, false ) == ERRCODE_NONE )
+ if( ImpScan( *p->pOUString, n, t, &nLen, true ) == ERRCODE_NONE )
{
if( nLen == p->pOUString->getLength() )
{
diff --git a/basic/source/sbx/sbxbyte.cxx b/basic/source/sbx/sbxbyte.cxx
index ab078157b60b..6557aa3fff4b 100644
--- a/basic/source/sbx/sbxbyte.cxx
+++ b/basic/source/sbx/sbxbyte.cxx
@@ -162,7 +162,7 @@ start:
{
double d;
SbxDataType t;
- if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE )
+ if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE )
nRes = 0;
else if( d > SbxMAXBYTE )
{
diff --git a/basic/source/sbx/sbxchar.cxx b/basic/source/sbx/sbxchar.cxx
index ef2b13423ee2..d25ccc083d7c 100644
--- a/basic/source/sbx/sbxchar.cxx
+++ b/basic/source/sbx/sbxchar.cxx
@@ -147,7 +147,7 @@ start:
{
double d;
SbxDataType t;
- if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE )
+ if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE )
nRes = 0;
else if( d > SbxMAXCHAR )
{
diff --git a/basic/source/sbx/sbxdbl.cxx b/basic/source/sbx/sbxdbl.cxx
index c68d2909304b..9010dfaa3e74 100644
--- a/basic/source/sbx/sbxdbl.cxx
+++ b/basic/source/sbx/sbxdbl.cxx
@@ -81,7 +81,7 @@ double ImpGetDouble( const SbxValues* p )
{
double d;
SbxDataType t;
- if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE )
+ if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE )
{
nRes = 0;
#if HAVE_FEATURE_SCRIPTING
diff --git a/basic/source/sbx/sbxint.cxx b/basic/source/sbx/sbxint.cxx
index 90f68bfaefb5..2ba76c89e352 100644
--- a/basic/source/sbx/sbxint.cxx
+++ b/basic/source/sbx/sbxint.cxx
@@ -157,7 +157,7 @@ start:
{
double d;
SbxDataType t;
- if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE )
+ if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE )
nRes = 0;
else if( !o3tl::convertsToAtMost(o3tl::roundAway(d), SbxMAXINT) )
{
@@ -442,7 +442,7 @@ start:
// Check if really 0 or invalid conversion
double d;
SbxDataType t;
- if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE )
+ if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE )
nRes = 0;
else
nRes = static_cast<sal_Int64>(d);
@@ -703,7 +703,7 @@ start:
// Check if really 0 or invalid conversion
double d;
SbxDataType t;
- if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE )
+ if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE )
nRes = 0;
else if( !o3tl::convertsToAtMost(o3tl::roundAway(d), SAL_MAX_UINT64) )
{
diff --git a/basic/source/sbx/sbxlng.cxx b/basic/source/sbx/sbxlng.cxx
index 2b08a27017dc..bda401b981db 100644
--- a/basic/source/sbx/sbxlng.cxx
+++ b/basic/source/sbx/sbxlng.cxx
@@ -121,7 +121,7 @@ start:
{
double d;
SbxDataType t;
- if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE )
+ if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE )
nRes = 0;
else if( !o3tl::convertsToAtMost(o3tl::roundAway(d), SbxMAXLNG) )
{
diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx
index 0c5c9a77222a..f555908b6b84 100644
--- a/basic/source/sbx/sbxscan.cxx
+++ b/basic/source/sbx/sbxscan.cxx
@@ -564,7 +564,7 @@ bool SbxValue::Scan( const OUString& rSrc, sal_uInt16* pLen )
{
double n;
SbxDataType t;
- eRes = ImpScan( rSrc, n, t, pLen, false );
+ eRes = ImpScan( rSrc, n, t, pLen, true );
if( eRes == ERRCODE_NONE )
{
if( !IsFixed() )
diff --git a/basic/source/sbx/sbxsng.cxx b/basic/source/sbx/sbxsng.cxx
index 357b9cd10f5d..ad4301f9ca89 100644
--- a/basic/source/sbx/sbxsng.cxx
+++ b/basic/source/sbx/sbxsng.cxx
@@ -109,7 +109,7 @@ start:
{
double d;
SbxDataType t;
- if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE )
+ if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE )
nRes = 0;
else if( d > SbxMAXSNG )
{
diff --git a/basic/source/sbx/sbxuint.cxx b/basic/source/sbx/sbxuint.cxx
index f1c916bb1a58..a3751e2661a4 100644
--- a/basic/source/sbx/sbxuint.cxx
+++ b/basic/source/sbx/sbxuint.cxx
@@ -154,7 +154,7 @@ start:
{
double d;
SbxDataType t;
- if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE )
+ if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE )
nRes = 0;
else if( !o3tl::convertsToAtMost(o3tl::roundAway(d), SbxMAXUINT) )
{
diff --git a/basic/source/sbx/sbxulng.cxx b/basic/source/sbx/sbxulng.cxx
index 14b37958bba2..bcb1ce0f2778 100644
--- a/basic/source/sbx/sbxulng.cxx
+++ b/basic/source/sbx/sbxulng.cxx
@@ -121,7 +121,7 @@ start:
{
double d;
SbxDataType t;
- if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE )
+ if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE )
nRes = 0;
else if( !o3tl::convertsToAtMost(o3tl::roundAway(d), SbxMAXULNG) )
{
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index c32d51f31b42..a36abf52256a 100644
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -1352,7 +1352,7 @@ bool SbxValue::LoadData( SvStream& r, sal_uInt16 )
RTL_TEXTENCODING_ASCII_US);
double d;
SbxDataType t;
- if( ImpScan( aVal, d, t, nullptr, false ) != ERRCODE_NONE || t == SbxDOUBLE )
+ if( ImpScan( aVal, d, t, nullptr, true ) != ERRCODE_NONE || t == SbxDOUBLE )
{
aData.nSingle = 0.0F;
return false;
@@ -1367,7 +1367,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, false ) != ERRCODE_NONE )
+ if( ImpScan( aVal, aData.nDouble, t, nullptr, true ) != ERRCODE_NONE )
{
aData.nDouble = 0.0;
return false;
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index d18ada85791d..01d394b14d83 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -503,7 +503,7 @@ bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer )
rStrm, RTL_TEXTENCODING_ASCII_US);
double d;
SbxDataType t;
- if( ImpScan( aTmpString, d, t, nullptr, false ) != ERRCODE_NONE || t == SbxDOUBLE )
+ if( ImpScan( aTmpString, d, t, nullptr, true ) != ERRCODE_NONE || t == SbxDOUBLE )
{
aTmp.nSingle = 0;
return false;
@@ -518,7 +518,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, false ) != ERRCODE_NONE )
+ if( ImpScan( aTmpString, aTmp.nDouble, t, nullptr, true ) != ERRCODE_NONE )
{
aTmp.nDouble = 0;
return false;