summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-06-12 15:58:17 +0200
committerStephan Bergmann <sbergman@redhat.com>2013-06-13 17:08:36 +0200
commit3af0114a295d2a6c600117adb5bcd6689c0c787e (patch)
tree262f32143b99a8754e517be454681267cadaa85f /svl
parent4edbfa892bfe6ca81c88363b2249e0b7d5eef31f (diff)
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
Diffstat (limited to 'svl')
-rw-r--r--svl/source/numbers/zforlist.cxx3
-rw-r--r--svl/source/passwordcontainer/passwordcontainer.cxx6
2 files changed, 6 insertions, 3 deletions
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index ae0a1635f5a5..1a3438008369 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -3527,6 +3527,9 @@ const NfCurrencyEntry* SvNumberFormatter::GetCurrencyEntry( bool & bFoundBank,
LanguageType eExtLang;
if ( nExtLen )
{
+ // rExtension should be a 16-bit hex value max FFFF which may contain a
+ // leading "-" separator (that is not a minus sign, but toInt32 can be
+ // used to parse it, with post-processing as necessary):
sal_Int32 nExtLang = rExtension.toInt32( 16 );
if ( !nExtLang )
{
diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx
index 8cf17ee186a8..3e9c3b0b9275 100644
--- a/svl/source/passwordcontainer/passwordcontainer.cxx
+++ b/svl/source/passwordcontainer/passwordcontainer.cxx
@@ -118,7 +118,7 @@ static vector< OUString > getInfoFromInd( OUString aInd )
aNum += OUString::valueOf( (sal_Unicode) pLine[i] );
}
- newItem += OUString::valueOf( (sal_Unicode) aNum.toInt32( 16 ) );
+ newItem += OUString::valueOf( (sal_Unicode) aNum.toUInt32( 16 ) );
pLine += 3;
}
@@ -482,7 +482,7 @@ vector< OUString > PasswordContainer::DecodePasswords( const OUString& aLine, co
unsigned char code[RTL_DIGEST_LENGTH_MD5];
for( int ind = 0; ind < RTL_DIGEST_LENGTH_MD5; ind++ )
- code[ ind ] = (char)(aMasterPasswd.copy( ind*2, 2 ).toInt32(16));
+ code[ ind ] = (char)(aMasterPasswd.copy( ind*2, 2 ).toUInt32(16));
rtlCipherError result = rtl_cipher_init (
aDecoder, rtl_Cipher_DirectionDecode,
@@ -536,7 +536,7 @@ OUString PasswordContainer::EncodePasswords( vector< OUString > lines, const OUS
unsigned char code[RTL_DIGEST_LENGTH_MD5];
for( int ind = 0; ind < RTL_DIGEST_LENGTH_MD5; ind++ )
- code[ ind ] = (char)(aMasterPasswd.copy( ind*2, 2 ).toInt32(16));
+ code[ ind ] = (char)(aMasterPasswd.copy( ind*2, 2 ).toUInt32(16));
rtlCipherError result = rtl_cipher_init (
aEncoder, rtl_Cipher_DirectionEncode,