[Libreoffice-commits] core.git: cui/source editeng/source include/comphelper vcl/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Wed Jan 6 18:22:44 UTC 2021


 cui/source/tabpages/autocdlg.cxx |   10 ++++++----
 editeng/source/misc/svxacorr.cxx |    2 +-
 include/comphelper/string.hxx    |   10 ----------
 vcl/source/control/field.cxx     |    6 +++---
 vcl/source/control/field2.cxx    |    6 +++---
 5 files changed, 13 insertions(+), 21 deletions(-)

New commits:
commit 40e98c878b6f6f205943da94d4b5e039231a482f
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Wed Jan 6 14:34:21 2021 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Wed Jan 6 19:21:56 2021 +0100

    Drop comphelper::string::equals; compare OUString to OUStringChar
    
    In cui/source/tabpages/autocdlg.cxx, use code point-based methods
    for comparison with sal_UCS4 values in SvxSwAutoFormatFlags.
    
    Change-Id: If34c981393774d1b8db649f0c29870e1ca6bdfe8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108847
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index 380d61123330..e954372e7e84 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -462,13 +462,15 @@ bool OfaSwAutoFmtOptionsPage::FillItemSet( SfxItemSet*  )
     pOpt->bChgEnumNum = bCheck;
     bModified |= aBulletFont != pOpt->aBulletFont;
     pOpt->aBulletFont = aBulletFont;
-    bModified |= !comphelper::string::equals(sBulletChar, pOpt->cBullet);
-    pOpt->cBullet = sBulletChar[0];
+    bModified |= sBulletChar != OUString(&pOpt->cBullet, 1);
+    sal_Int32 index = 0;
+    pOpt->cBullet = sBulletChar.iterateCodePoints(&index);
 
     bModified |= aByInputBulletFont != pOpt->aByInputBulletFont;
-    bModified |= !comphelper::string::equals(sByInputBulletChar, pOpt->cByInputBullet);
+    bModified |= sByInputBulletChar != OUString(&pOpt->cByInputBullet, 1);
     pOpt->aByInputBulletFont = aByInputBulletFont;
-    pOpt->cByInputBullet = sByInputBulletChar[0];
+    index = 0;
+    pOpt->cByInputBullet = sByInputBulletChar.iterateCodePoints(&index);
 
     bCheck = m_xCheckLB->get_toggle(MERGE_SINGLE_LINE_PARA, CBCOL_FIRST) == TRISTATE_TRUE;
     bModified |= pOpt->bRightMargin != bCheck;
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index d04247c397f2..e1a28403e40e 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -944,7 +944,7 @@ void SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc,
             // valid separator -> replace
             OUString sChar( *pWordStt );
             sChar = rCC.titlecase(sChar); //see fdo#56740
-            if (!comphelper::string::equals(sChar, *pWordStt))
+            if (sChar != OUStringChar(*pWordStt))
                rDoc.ReplaceRange( pWordStt - pStart, 1, sChar );
             return;
         }
diff --git a/include/comphelper/string.hxx b/include/comphelper/string.hxx
index 1db92036949b..3567ce364cac 100644
--- a/include/comphelper/string.hxx
+++ b/include/comphelper/string.hxx
@@ -40,16 +40,6 @@ namespace com::sun::star::uno { class XComponentContext; }
 // go into the stable URE API:
 namespace comphelper::string {
 
-/** Compare an OUString to a single char
-
-    @param rIn      The input OUString
-    @param c        The character to compare against
-
-    @return         true if rIn has one char and its equal to c
- */
-inline bool equals(const OUString& rIn, sal_Unicode c)
-{ return rIn.getLength() == 1 && rIn[0] == c; }
-
 /** Removes all occurrences of a character from within the source string
 
     @param rIn      The input OUStringBuffer
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index 84844174e0af..65bd69bb528e 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -145,9 +145,9 @@ bool ImplNumericProcessKeyInput( const KeyEvent& rKEvt,
                  (nGroup == KEYGROUP_CURSOR) ||
                  (nGroup == KEYGROUP_MISC) ||
                  ((cChar >= '0') && (cChar <= '9')) ||
-                 string::equals(rLocaleDataWrapper.getNumDecimalSep(), cChar) ||
-                 (bThousandSep && string::equals(rLocaleDataWrapper.getNumThousandSep(), cChar)) ||
-                 string::equals(rLocaleDataWrapper.getNumDecimalSepAlt(), cChar) ||
+                 rLocaleDataWrapper.getNumDecimalSep() == OUStringChar(cChar) ||
+                 (bThousandSep && rLocaleDataWrapper.getNumThousandSep() == OUStringChar(cChar)) ||
+                 rLocaleDataWrapper.getNumDecimalSepAlt() == OUStringChar(cChar) ||
                  (cChar == '-'));
     }
 }
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index fc39b48de12d..7bf0afd853e8 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -2240,12 +2240,12 @@ static bool ImplTimeProcessKeyInput( const KeyEvent& rKEvt,
         if ( (nGroup == KEYGROUP_FKEYS) || (nGroup == KEYGROUP_CURSOR) ||
              (nGroup == KEYGROUP_MISC)   ||
              ((cChar >= '0') && (cChar <= '9')) ||
-             string::equals(rLocaleDataWrapper.getTimeSep(), cChar) ||
+             rLocaleDataWrapper.getTimeSep() == OUStringChar(cChar) ||
              (rLocaleDataWrapper.getTimeAM().indexOf(cChar) != -1) ||
              (rLocaleDataWrapper.getTimePM().indexOf(cChar) != -1) ||
              // Accept AM/PM:
              (cChar == 'a') || (cChar == 'A') || (cChar == 'm') || (cChar == 'M') || (cChar == 'p') || (cChar == 'P') ||
-             ((eFormat == TimeFieldFormat::F_SEC_CS) && string::equals(rLocaleDataWrapper.getTime100SecSep(), cChar)) ||
+             ((eFormat == TimeFieldFormat::F_SEC_CS) && rLocaleDataWrapper.getTime100SecSep() == OUStringChar(cChar)) ||
              (bDuration && (cChar == '-')) )
             return false;
         else
@@ -2312,7 +2312,7 @@ bool TimeFormatter::TextToTime(const OUString& rStr, tools::Time& rTime, TimeFie
         // Replace characters above by the separator character
         for (sal_Int32 i = 0; i < aSepStr.getLength(); ++i)
         {
-            if (string::equals(rLocaleDataWrapper.getTimeSep(), aSepStr[i]))
+            if (rLocaleDataWrapper.getTimeSep() == OUStringChar(aSepStr[i]))
                 continue;
             for ( sal_Int32 j = 0; j < aStr.getLength(); j++ )
             {


More information about the Libreoffice-commits mailing list