From 6e0b4ffd25ca6b2cb4f02a66ef9bfe55da33cd0f Mon Sep 17 00:00:00 2001 From: Arnaud Versini Date: Mon, 31 Oct 2016 16:13:08 +0100 Subject: BASIC : use rtl/character.hxx in sbxform.cxx Change-Id: I88c9d26b27ff80e02a88349198813d2771522343 Reviewed-on: https://gerrit.libreoffice.org/30445 Tested-by: Jenkins Reviewed-by: Noel Grandin --- basic/source/sbx/sbxform.cxx | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'basic') 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 #include +#include + /* 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 -- cgit