diff options
author | arpit1912 <arpitbandejiya@gmail.com> | 2021-03-19 16:10:16 +0530 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-03-22 16:15:37 +0100 |
commit | cff19470e883bef7b89eff7955a88857105c0935 (patch) | |
tree | 57bc3d583a389ee9f461fc16087641a33b84196b /basic | |
parent | 8932c8906ff31f0f50f7478d41821506b0941cdf (diff) |
tdf#141050 Accept CCur with negative strings
the ImpStringToCurrency now increment the pointer on finding a '+' or '-' in sbxcurr.cxx file
Change-Id: I4a1093ae0b4e52b6a61dc412bd5e7b95b1309e7a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112734
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
(cherry picked from commit 54b3ada2e5ef9dcbc452509a7bbe39f0920572e2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112798
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'basic')
-rw-r--r-- | basic/qa/basic_coverage/test_ccur_method.vb | 16 | ||||
-rw-r--r-- | basic/source/sbx/sbxcurr.cxx | 2 |
2 files changed, 12 insertions, 6 deletions
diff --git a/basic/qa/basic_coverage/test_ccur_method.vb b/basic/qa/basic_coverage/test_ccur_method.vb index b84ddafd5713..e4eef652441f 100644 --- a/basic/qa/basic_coverage/test_ccur_method.vb +++ b/basic/qa/basic_coverage/test_ccur_method.vb @@ -7,10 +7,16 @@ ' Function doUnitTest as Integer + + doUnitTest = 0 + ' CCUR - If (CCur("100") <> 100) Then - doUnitTest = 0 - Else - doUnitTest = 1 - End If + if (CCur("100") <> 100) Then Exit Function + ' tdf#141050 - passing a number with + sign + if (CCur("+100") <> 100) Then Exit Function + ' tdf#141050 - passing a number with - sign + if (CCur("-100") <> -100) Then Exit Function + + doUnitTest = 1 + End Function diff --git a/basic/source/sbx/sbxcurr.cxx b/basic/source/sbx/sbxcurr.cxx index 50b530cda193..416229afbc95 100644 --- a/basic/source/sbx/sbxcurr.cxx +++ b/basic/source/sbx/sbxcurr.cxx @@ -106,7 +106,7 @@ static sal_Int64 ImpStringToCurrency( const OUString &rStr ) OUStringBuffer sNormalisedNumString( sTmp.getLength() + nFractDigit ); if ( *p == '-' || *p == '+' ) - sNormalisedNumString.append( *p ); + sNormalisedNumString.append( *p++ ); while ( *p >= '0' && *p <= '9' ) { |