summaryrefslogtreecommitdiff
path: root/forms
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2023-04-21 10:13:26 +0200
committerJulien Nabet <serval2412@yahoo.fr>2023-04-21 13:46:11 +0200
commit50837fdd60d3d20b5025d94e243b09d92a166fb4 (patch)
tree383070e965876c82dfad4c28fcd64f5ecfe66336 /forms
parent89cbbbe7f11b941be27b81eb50cfac614d195c2e (diff)
tdf#116451: XML Form: adding 2 values of decimal-fields gives wrong result
Since, depending of the localization decimal separator may be ",", replace "," by "." before calling ::rtl::math::stringToDouble Change-Id: I461f3bdf83019d066735e10b3b6b6784e006bc7f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150750 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
Diffstat (limited to 'forms')
-rw-r--r--forms/source/xforms/convert.cxx2
-rw-r--r--forms/source/xforms/datatypes.cxx2
2 files changed, 2 insertions, 2 deletions
diff --git a/forms/source/xforms/convert.cxx b/forms/source/xforms/convert.cxx
index 8ffd4cab4906..0f7193422fa5 100644
--- a/forms/source/xforms/convert.cxx
+++ b/forms/source/xforms/convert.cxx
@@ -78,7 +78,7 @@ namespace
{
rtl_math_ConversionStatus eStatus;
double f = rtl::math::stringToDouble(
- rString, '.', ',', &eStatus );
+ rString.replace(',','.'), '.', ',', &eStatus );
return ( eStatus == rtl_math_ConversionStatus_Ok ) ? Any( f ) : Any();
}
diff --git a/forms/source/xforms/datatypes.cxx b/forms/source/xforms/datatypes.cxx
index 8e5e0b5268b3..510e75cfd3d7 100644
--- a/forms/source/xforms/datatypes.cxx
+++ b/forms/source/xforms/datatypes.cxx
@@ -404,7 +404,7 @@ namespace xforms
rtl_math_ConversionStatus eStatus;
sal_Int32 nEnd;
double f = ::rtl::math::stringToDouble(
- rValue, '.', u'\0', &eStatus, &nEnd );
+ rValue.replace(',','.'), '.', u'\0', &eStatus, &nEnd );
// error checking...
bool bReturn = false;