diff options
Diffstat (limited to 'comphelper/source/misc/string.cxx')
-rw-r--r-- | comphelper/source/misc/string.cxx | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx index b58c67e49152..98391741a13d 100644 --- a/comphelper/source/misc/string.cxx +++ b/comphelper/source/misc/string.cxx @@ -323,18 +323,13 @@ sal_Int32 compareNatural( const OUString & rLHS, const OUString & rRHS, sal_uInt32 nLHS = comphelper::string::decimalStringToNumber(rLHS.copy(nLHSFirstDigitPos, nLHSChunkLen)); sal_uInt32 nRHS = comphelper::string::decimalStringToNumber(rRHS.copy(nRHSFirstDigitPos, nRHSChunkLen)); - nRet = nLHS-nRHS; - if (nRet != 0) + if (nLHS != nRHS) + { + nRet = (nLHS < nRHS) ? -1 : 1; break; + } } - //Squeeze these down to -1, 0, 1 in case there is an assumption those are - //the only valid returns - if (nRet > 0) - nRet = 1; - else if (nRet < 0) - nRet = -1; - return nRet; } |