From 3af0114a295d2a6c600117adb5bcd6689c0c787e Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 12 Jun 2013 15:58:17 +0200 Subject: Introduce O[U]String::toUInt32 ...which has become necessary since bd60d41176da540b01d7583cfe00637431967f39 "Handle oveflow in O(U)String::toInt() functions" reduces values in the range (SAL_MAX_INT32 .. SAL_MAX_UINT32] to zero, but some calls of toInt32(16) relied on getting a correct (unsigned) value for the whole input range ["0" .. "FFFFFFFF"] (see libreoffice-4-1 commit 9bf6c83367cedb7be81bf67f30d2147d26c7a8c3 "Revert overflow checks in O[U]String::toInt{32,64} again"). Audited all uses of toInt32/64 with non-decimal radix. (There is still a TODO comment in oox/source/helper/attributelist.cxx, and stoc/source/typeconv/convert.cxx will still need some love and test code.) Change-Id: Iadaca1c0e41dab553687d0ce41c20c10cd657a95 --- stoc/source/typeconv/convert.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'stoc') diff --git a/stoc/source/typeconv/convert.cxx b/stoc/source/typeconv/convert.cxx index 799bae3f8a7e..ec83601e5764 100644 --- a/stoc/source/typeconv/convert.cxx +++ b/stoc/source/typeconv/convert.cxx @@ -143,7 +143,7 @@ static sal_Bool getNumericValue( double & rfVal, const OUString & rStr ) } OUString aHexRest( trim.copy( nX+1 ) ); - sal_Int64 nRet = aHexRest.toInt64( 16 ); + sal_uInt64 nRet = aHexRest.toUInt64( 16 ); if (nRet == 0) { @@ -223,7 +223,7 @@ static sal_Bool getHyperValue( sal_Int64 & rnVal, const OUString & rStr ) } OUString aHexRest( trim.copy( nX+1 ) ); - sal_Int64 nRet = aHexRest.toInt64( 16 ); + sal_uInt64 nRet = aHexRest.toUInt64( 16 ); if (nRet == 0) { @@ -234,7 +234,7 @@ static sal_Bool getHyperValue( sal_Int64 & rnVal, const OUString & rStr ) } } - rnVal = (bNeg ? -nRet : nRet); + rnVal = (bNeg ? -static_cast(nRet) : nRet); return sal_True; } return sal_False; -- cgit