summaryrefslogtreecommitdiff
path: root/idl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-03-23 07:29:17 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-03-23 07:29:17 +0100
commit0a92c29e4747f2289514cdb1030900b7c1cbb6ba (patch)
tree3aa3661c368d8df8ab51880e23dda0c604024af5 /idl
parenta2201cba9f22c8aff57fb59cb57aa4e09ec5e555 (diff)
This code trades in 'char' entities disguised as 'int'
(with EOF represented as 0), so better actually use 'char'. Change-Id: Id9c684c833b0d46f8a51a34aa2c4b78a75e2d3a5
Diffstat (limited to 'idl')
-rw-r--r--idl/inc/lex.hxx6
-rw-r--r--idl/source/cmptools/lex.cxx18
2 files changed, 13 insertions, 11 deletions
diff --git a/idl/inc/lex.hxx b/idl/inc/lex.hxx
index 20c7b4337bde..8a71349971c5 100644
--- a/idl/inc/lex.hxx
+++ b/idl/inc/lex.hxx
@@ -100,7 +100,7 @@ class SvTokenStream
{
sal_uLong nLine, nColumn;
sal_Int32 nBufPos;
- int c; // next character
+ char c; // next character
static const sal_uInt16 nTabSize = 4; // length of tabulator
OString aStrTrue;
OString aStrFalse;
@@ -115,8 +115,8 @@ class SvTokenStream
void InitCtor();
- int GetNextChar();
- int GetFastNextChar()
+ char GetNextChar();
+ char GetFastNextChar()
{
return (nBufPos < aBufStr.getLength())
? aBufStr[nBufPos++]
diff --git a/idl/source/cmptools/lex.cxx b/idl/source/cmptools/lex.cxx
index 58ccf2b3c497..482eaf6293c5 100644
--- a/idl/source/cmptools/lex.cxx
+++ b/idl/source/cmptools/lex.cxx
@@ -125,9 +125,9 @@ void SvTokenStream::FillTokenList()
pCurToken = aTokList.begin();
}
-int SvTokenStream::GetNextChar()
+char SvTokenStream::GetNextChar()
{
- int nChar;
+ char nChar;
while (aBufStr.getLength() <= nBufPos)
{
if (pInStream->ReadLine(aBufStr))
@@ -171,7 +171,9 @@ sal_uLong SvTokenStream::GetNumber()
if( isdigit( c ) )
l = l * nLog + (c - '0');
else
- l = l * nLog + (rtl::toAsciiUpperCase( c ) - 'A' + 10 );
+ l = l * nLog
+ + (rtl::toAsciiUpperCase( static_cast<unsigned char>(c) )
+ - 'A' + 10 );
c = GetFastNextChar();
}
}
@@ -208,7 +210,7 @@ bool SvTokenStream::MakeToken( SvToken & rToken )
if( '/' == c )
{
// time optimization, no comments
- int c1 = c;
+ char c1 = c;
c = GetFastNextChar();
if( '/' == c )
{
@@ -247,7 +249,7 @@ bool SvTokenStream::MakeToken( SvToken & rToken )
else
{
rToken.nType = SVTOKENTYPE::Char;
- rToken.cChar = (char)c1;
+ rToken.cChar = c1;
}
}
else if( c == '"' )
@@ -271,7 +273,7 @@ bool SvTokenStream::MakeToken( SvToken & rToken )
bDone = true;
}
else
- aStr.append(static_cast<char>(c));
+ aStr.append(c);
}
if( IsEof() || ( SVSTREAM_OK != pInStream->GetError() ) )
return false;
@@ -289,7 +291,7 @@ bool SvTokenStream::MakeToken( SvToken & rToken )
OStringBuffer aBuf;
while( isalnum( c ) || c == '_' )
{
- aBuf.append(static_cast<char>(c));
+ aBuf.append(c);
c = GetFastNextChar();
}
OString aStr = aBuf.makeStringAndClear();
@@ -322,7 +324,7 @@ bool SvTokenStream::MakeToken( SvToken & rToken )
else
{
rToken.nType = SVTOKENTYPE::Char;
- rToken.cChar = (char)c;
+ rToken.cChar = c;
c = GetFastNextChar();
}
rToken.SetLine( nLastLine );