diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-06-12 15:58:17 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-06-13 17:08:36 +0200 |
commit | 3af0114a295d2a6c600117adb5bcd6689c0c787e (patch) | |
tree | 262f32143b99a8754e517be454681267cadaa85f /configmgr | |
parent | 4edbfa892bfe6ca81c88363b2249e0b7d5eef31f (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 'configmgr')
-rw-r--r-- | configmgr/source/valueparser.cxx | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/configmgr/source/valueparser.cxx b/configmgr/source/valueparser.cxx index a8dad1922df9..9f93cd85dcf1 100644 --- a/configmgr/source/valueparser.cxx +++ b/configmgr/source/valueparser.cxx @@ -85,9 +85,10 @@ bool parseValue(xmlreader::Span const & text, sal_Int16 * value) { rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( text.begin, text.length, RTL_CONSTASCII_STRINGPARAM("0X"), RTL_CONSTASCII_LENGTH("0X")) == 0 ? - OString( - text.begin + RTL_CONSTASCII_LENGTH("0X"), - text.length - RTL_CONSTASCII_LENGTH("0X")).toInt32(16) : + static_cast< sal_Int32 >( + OString( + text.begin + RTL_CONSTASCII_LENGTH("0X"), + text.length - RTL_CONSTASCII_LENGTH("0X")).toUInt32(16)) : OString(text.begin, text.length).toInt32(); //TODO: check valid lexical representation if (n >= SAL_MIN_INT16 && n <= SAL_MAX_INT16) { @@ -104,9 +105,10 @@ bool parseValue(xmlreader::Span const & text, sal_Int32 * value) { rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( text.begin, text.length, RTL_CONSTASCII_STRINGPARAM("0X"), RTL_CONSTASCII_LENGTH("0X")) == 0 ? - OString( - text.begin + RTL_CONSTASCII_LENGTH("0X"), - text.length - RTL_CONSTASCII_LENGTH("0X")).toInt32(16) : + static_cast< sal_Int32 >( + OString( + text.begin + RTL_CONSTASCII_LENGTH("0X"), + text.length - RTL_CONSTASCII_LENGTH("0X")).toUInt32(16)) : OString(text.begin, text.length).toInt32(); //TODO: check valid lexical representation return true; @@ -119,9 +121,10 @@ bool parseValue(xmlreader::Span const & text, sal_Int64 * value) { rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( text.begin, text.length, RTL_CONSTASCII_STRINGPARAM("0X"), RTL_CONSTASCII_LENGTH("0X")) == 0 ? - OString( - text.begin + RTL_CONSTASCII_LENGTH("0X"), - text.length - RTL_CONSTASCII_LENGTH("0X")).toInt64(16) : + static_cast< sal_Int64 >( + OString( + text.begin + RTL_CONSTASCII_LENGTH("0X"), + text.length - RTL_CONSTASCII_LENGTH("0X")).toUInt64(16)) : OString(text.begin, text.length).toInt64(); //TODO: check valid lexical representation return true; |