[Libreoffice-commits] core.git: 2 commits - comphelper/source i18npool/source

Michael Stahl mstahl at redhat.com
Fri Feb 27 02:31:44 PST 2015


 comphelper/source/misc/string.cxx                               |   13 ++------
 i18npool/source/transliteration/transliteration_commonclass.cxx |   15 +++-------
 2 files changed, 9 insertions(+), 19 deletions(-)

New commits:
commit 543b432f132ef928216526854aa0df4d94b76dca
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Feb 26 22:40:16 2015 +0100

    18npool: these variables should be signed
    
    Change-Id: I6519a4c9da2a95efcc54288b3ef9d0a19ccfef3c

diff --git a/i18npool/source/transliteration/transliteration_commonclass.cxx b/i18npool/source/transliteration/transliteration_commonclass.cxx
index 8981641..1bdddcc 100644
--- a/i18npool/source/transliteration/transliteration_commonclass.cxx
+++ b/i18npool/source/transliteration/transliteration_commonclass.cxx
@@ -80,24 +80,19 @@ transliteration_commonclass::compareSubstring(
         const OUString& str2, sal_Int32 off2, sal_Int32 len2)
 throw(RuntimeException, std::exception)
 {
-    const sal_Unicode* unistr1 = NULL;
-    const sal_Unicode* unistr2 = NULL;
-    sal_uInt32 strlen1;
-    sal_uInt32 strlen2;
-
     Sequence <sal_Int32> offset1(2*len1);
     Sequence <sal_Int32> offset2(2*len2);
 
     OUString in_str1 = this->transliterate(str1, off1, len1, offset1);
     OUString in_str2 = this->transliterate(str2, off2, len2, offset2);
-    strlen1 = in_str1.getLength();
-    strlen2 = in_str2.getLength();
-    unistr1 = in_str1.getStr();
-    unistr2 = in_str2.getStr();
+    sal_Int32 strlen1 = in_str1.getLength();
+    sal_Int32 strlen2 = in_str2.getLength();
+    const sal_Unicode* unistr1 = in_str1.getStr();
+    const sal_Unicode* unistr2 = in_str2.getStr();
 
     while (strlen1 && strlen2)
     {
-        sal_uInt32 ret = *unistr1 - *unistr2;
+        sal_Int32 ret = *unistr1 - *unistr2;
         if (ret)
             return ret;
 
commit 802fe48751e3baaecd9d279ef496c8a2c3cb0a2c
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Feb 26 22:28:31 2015 +0100

    comphelper: compare implemented as subtraction
    
    Change-Id: Ic7abd7dd588339e06b6764659829f35b4ea87adb

diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx
index b58c67e..9839174 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;
 }
 


More information about the Libreoffice-commits mailing list