summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorArnaud Versini <arnaud.versini@gmail.com>2016-10-31 16:13:08 +0100
committerNoel Grandin <noel.grandin@collabora.co.uk>2016-11-01 06:54:11 +0000
commit6e0b4ffd25ca6b2cb4f02a66ef9bfe55da33cd0f (patch)
treef9d56c7618d3321cc00e28bfc5ce608bd31cb2c5 /basic
parentcb90f0976d20d0e9c61138f4572d14750ea3de07 (diff)
BASIC : use rtl/character.hxx in sbxform.cxx
Change-Id: I88c9d26b27ff80e02a88349198813d2771522343 Reviewed-on: https://gerrit.libreoffice.org/30445 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic')
-rw-r--r--basic/source/sbx/sbxform.cxx18
1 files changed, 8 insertions, 10 deletions
diff --git a/basic/source/sbx/sbxform.cxx b/basic/source/sbx/sbxform.cxx
index 59325bd7f3f5..c46896222b80 100644
--- a/basic/source/sbx/sbxform.cxx
+++ b/basic/source/sbx/sbxform.cxx
@@ -23,6 +23,8 @@
#include <basic/sbxform.hxx>
#include <rtl/ustrbuf.hxx>
+#include <rtl/character.hxx>
+
/*
TODO: are there any Star-Basic characteristics unconsidered?
@@ -51,10 +53,6 @@ COMMENT: Visual-Basic treats the following (invalid) format-strings
// +3 for the exponent's value
// +1 for closing 0
-// Defines for the digits:
-#define ASCII_0 '0' // 48
-#define ASCII_9 '9' // 57
-
#define CREATE_1000SEP_CHAR '@'
#define FORMAT_SEPARATOR ';'
@@ -131,7 +129,7 @@ void SbxBasicFormater::AppendDigit( OUStringBuffer& sStrg, short nDigit )
{
if( nDigit>=0 && nDigit<=9 )
{
- sStrg.append((sal_Unicode)(nDigit+ASCII_0));
+ sStrg.append((sal_Unicode)(nDigit+'0'));
}
}
@@ -175,7 +173,7 @@ void SbxBasicFormater::StrRoundDigit( OUStringBuffer& sStrg, short nPos, bool& b
// in one piece, i. e. special characters should ONLY be in
// front OR behind the number and not right in the middle of
// the format information for the number
- while( nPos >= 0 && ( sStrg[nPos] < ASCII_0 || sStrg[nPos] > ASCII_9 ))
+ while( nPos >= 0 && ! rtl::isAsciiDigit(sStrg[nPos]))
{
nPos--;
}
@@ -188,9 +186,9 @@ void SbxBasicFormater::StrRoundDigit( OUStringBuffer& sStrg, short nPos, bool& b
else
{
sal_Unicode c2 = sStrg[nPos];
- if( c2 >= ASCII_0 && c2 <= ASCII_9 )
+ if( rtl::isAsciiDigit(c2) )
{
- if( c2 == ASCII_9 )
+ if( c2 == '9' )
{
sStrg[nPos] = (sal_Unicode)'0';
StrRoundDigit( sStrg, nPos - 1, bOverflow );
@@ -272,7 +270,7 @@ short SbxBasicFormater::GetDigitAtPosScan( short nPos, bool& bFoundFirstDigit )
// query of the number's first valid digit --> set flag
if( nPos==nNumExp )
bFoundFirstDigit = true;
- return (short)(sSciNumStrg[ no ] - ASCII_0);
+ return (short)(sSciNumStrg[ no ] - '0');
}
short SbxBasicFormater::GetDigitAtPosExpScan( short nPos, bool& bFoundFirstDigit )
@@ -285,7 +283,7 @@ short SbxBasicFormater::GetDigitAtPosExpScan( short nPos, bool& bFoundFirstDigit
if( nPos==nExpExp )
bFoundFirstDigit = true;
- return (short)(sNumExpStrg[ no ] - ASCII_0);
+ return (short)(sNumExpStrg[ no ] - '0');
}
// a value for the exponent can be given because the number maybe shall