summaryrefslogtreecommitdiff
path: root/sax
diff options
context:
space:
mode:
Diffstat (limited to 'sax')
-rw-r--r--sax/source/tools/converter.cxx16
1 files changed, 5 insertions, 11 deletions
diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index 1cb8cf190f04..d2a84cd8ea7d 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -543,9 +543,6 @@ bool Converter::convertNumber64( sal_Int64& rValue,
const OUString& rString,
sal_Int64 nMin, sal_Int64 nMax )
{
- bool bNeg = false;
- rValue = 0;
-
sal_Int32 nPos = 0;
sal_Int32 const nLen = rString.getLength();
@@ -553,10 +550,11 @@ bool Converter::convertNumber64( sal_Int64& rValue,
while( (nPos < nLen) && (rString[nPos] <= ' ') )
nPos++;
+ OUStringBuffer sNumber;
+
if( nPos < nLen && '-' == rString[nPos] )
{
- bNeg = true;
- nPos++;
+ sNumber.append(rString[nPos++]);
}
// get number
@@ -564,14 +562,10 @@ bool Converter::convertNumber64( sal_Int64& rValue,
'0' <= rString[nPos] &&
'9' >= rString[nPos] )
{
- // TODO: check overflow!
- rValue *= 10;
- rValue += (rString[nPos] - u'0');
- nPos++;
+ sNumber.append(rString[nPos++]);
}
- if( bNeg )
- rValue *= -1;
+ rValue = sNumber.toString().toInt64();
if( rValue < nMin )
rValue = nMin;