summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-03-22 21:38:23 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-03-22 21:38:23 +0100
commiteedb6435f863b9377197a65ffd75ebec98007ebe (patch)
treef2f6d1eab2d936a8e242232c9ee315a140310718
parentfd70d8ee8925f7c7931f3db772516927c05b0fcb (diff)
Use rtl::isAscii* instead of ctype.h is* (and fix passing plain char)
Change-Id: Ibb854c389683656f2570ff330ce44c27aef0e70f
-rw-r--r--rsc/source/parser/rsclex.cxx13
-rw-r--r--rsc/source/tools/rscchar.cxx4
-rw-r--r--rsc/source/tools/rsctools.cxx9
3 files changed, 16 insertions, 10 deletions
diff --git a/rsc/source/parser/rsclex.cxx b/rsc/source/parser/rsclex.cxx
index b7446db38a26..cbe2f0eded4d 100644
--- a/rsc/source/parser/rsclex.cxx
+++ b/rsc/source/parser/rsclex.cxx
@@ -34,6 +34,7 @@
#include <rsclex.hxx>
#include <rscyacc.hxx>
+#include <rtl/character.hxx>
#include <rtl/textcvt.h>
#include <rtl/textenc.h>
@@ -82,9 +83,9 @@ sal_uInt32 GetNumber()
if( nLog == 16 )
{
- while( isxdigit( c ) )
+ while( rtl::isAsciiHexDigit( static_cast<unsigned char>(c) ) )
{
- if( isdigit( c ) )
+ if( rtl::isAsciiDigit( static_cast<unsigned char>(c) ) )
l = l * nLog + (c - '0');
else
l = l * nLog + (toupper( c ) - 'A' + 10 );
@@ -94,7 +95,7 @@ sal_uInt32 GetNumber()
}
else
{
- while( isdigit( c ) || 'x' == c )
+ while( rtl::isAsciiDigit( static_cast<unsigned char>(c) ) || 'x' == c )
{
l = l * nLog + (c - '0');
c = pFI->GetFastChar();
@@ -116,7 +117,7 @@ int MakeToken( YYSTYPE * pTokenVal )
while( true ) // ignore comments and space characters
{
- while( isspace( c ) )
+ while( rtl::isAsciiWhiteSpace( static_cast<unsigned char>(c) ) )
c = pFI->GetFastChar();
if( '/' == c )
@@ -211,13 +212,13 @@ int MakeToken( YYSTYPE * pTokenVal )
pTokenVal->string = const_cast<char*>(pStringContainer->putString( aBuf.getStr() ));
return STRING;
}
- if (isdigit (c))
+ if (rtl::isAsciiDigit (static_cast<unsigned char>(c)))
{
pTokenVal->value = GetNumber();
return NUMBER;
}
- if( isalpha (c) || (c == '_') )
+ if( rtl::isAsciiAlpha (static_cast<unsigned char>(c)) || (c == '_') )
{
Atom nHashId;
OStringBuffer aBuf( 256 );
diff --git a/rsc/source/tools/rscchar.cxx b/rsc/source/tools/rscchar.cxx
index 463622671766..fb5411407b54 100644
--- a/rsc/source/tools/rscchar.cxx
+++ b/rsc/source/tools/rscchar.cxx
@@ -106,9 +106,9 @@ char * RscChar::MakeUTF8( char * pStr, sal_uInt16 nTextEncoding )
sal_uInt16 nChar = 0;
int i = 0;
++pStr;
- while( isxdigit( *pStr ) && i != 2 )
+ while( rtl::isAsciiHexDigit( static_cast<unsigned char>(*pStr) ) && i != 2 )
{
- if( isdigit( *pStr ) )
+ if( rtl::isAsciiDigit( static_cast<unsigned char>(*pStr) ) )
nChar = nChar * 16 + (sal_uInt8)*pStr - (sal_uInt8)'0';
else if( rtl::isAsciiUpperCase( static_cast<unsigned char>(*pStr) ) )
nChar = nChar * 16 + (sal_uInt8)*pStr - (sal_uInt8)'A' +10;
diff --git a/rsc/source/tools/rsctools.cxx b/rsc/source/tools/rsctools.cxx
index e043f451c3c1..c5780c9b0548 100644
--- a/rsc/source/tools/rsctools.cxx
+++ b/rsc/source/tools/rsctools.cxx
@@ -31,6 +31,7 @@
#include <osl/file.h>
#include <rtl/alloc.h>
+#include <rtl/character.hxx>
#include <sal/log.hxx>
/* case insensitive compare of two strings up to a given length */
@@ -93,7 +94,8 @@ char * ResponseFile( RscPtrPtr * ppCmd, char ** ppArgv, sal_uInt32 nArgc )
nItems = fread( &szBuffer[ 0 ], 1, sizeof( char ), fFile );
while( nItems )
{
- if( !isspace( szBuffer[ 0 ] ) )
+ if( !rtl::isAsciiWhiteSpace(
+ static_cast<unsigned char>(szBuffer[ 0 ]) ) )
{
/*
* #i27914# double ticks '"' now have a duplicate function:
@@ -102,7 +104,10 @@ char * ResponseFile( RscPtrPtr * ppCmd, char ** ppArgv, sal_uInt32 nArgc )
* argument no two !
*/
unsigned int n = 0;
- while( nItems && (!isspace( szBuffer[ n ] ) || bInQuotes) &&
+ while( nItems &&
+ (!rtl::isAsciiWhiteSpace(
+ static_cast<unsigned char>(szBuffer[ n ]) ) ||
+ bInQuotes) &&
n +1 < sizeof( szBuffer ) )
{
n++;