basic/qa/basic_coverage/test_types_conversion.vb |   11 ++++++-----
 basic/source/sbx/sbxbool.cxx                     |    2 +-
 basic/source/sbx/sbxbyte.cxx                     |    2 +-
 basic/source/sbx/sbxchar.cxx                     |    2 +-
 basic/source/sbx/sbxdbl.cxx                      |    2 +-
 basic/source/sbx/sbxint.cxx                      |    6 +++---
 basic/source/sbx/sbxlng.cxx                      |    2 +-
 basic/source/sbx/sbxscan.cxx                     |    2 +-
 basic/source/sbx/sbxsng.cxx                      |    2 +-
 basic/source/sbx/sbxuint.cxx                     |    2 +-
 basic/source/sbx/sbxulng.cxx                     |    2 +-
 basic/source/sbx/sbxvalue.cxx                    |    4 ++--
 basic/source/sbx/sbxvar.cxx                      |    4 ++--
 13 files changed, 22 insertions(+), 21 deletions(-)

New commits:
commit 4fdc90c51e6a1bbb83c1f1826ad5b90dc1ff0ad6
Author:     Andreas Heinisch <andreas.heini...@yahoo.de>
AuthorDate: Mon Nov 25 15:14:53 2019 +0100
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Thu Nov 28 10:21:25 2019 +0100

    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.kagan...@collabora.com>

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;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to