[Libreoffice-commits] core.git: 3 commits - basic/source compilerplugins/clang editeng/source extensions/source filter/source include/rtl oox/source sc/source svtools/source

Noel Grandin noel at peralex.com
Tue Mar 18 23:58:16 PDT 2014


 basic/source/classes/sbunoobj.cxx                      |    2 +-
 compilerplugins/clang/passstringbyref.cxx              |    4 ++--
 editeng/source/misc/svxacorr.cxx                       |    3 +--
 extensions/source/propctrlr/genericpropertyhandler.cxx |    2 +-
 filter/source/msfilter/msvbahelper.cxx                 |    4 +---
 include/rtl/ustring.hxx                                |    2 +-
 oox/source/vml/vmlinputstream.cxx                      |    2 +-
 sc/source/filter/excel/xltools.cxx                     |    4 ++--
 svtools/source/config/colorcfg.cxx                     |    4 ++--
 9 files changed, 12 insertions(+), 15 deletions(-)

New commits:
commit be878d7cc54cbe3dc1de410e9ff760fe353ce56a
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Mar 19 08:57:07 2014 +0200

    improve warning message in passstringbyref compiler plugin
    
    Change-Id: Ia8470bbd04c841e6c44c182493fede3dc312f635

diff --git a/compilerplugins/clang/passstringbyref.cxx b/compilerplugins/clang/passstringbyref.cxx
index 6107969..50e1a85 100644
--- a/compilerplugins/clang/passstringbyref.cxx
+++ b/compilerplugins/clang/passstringbyref.cxx
@@ -49,14 +49,14 @@ bool PassStringByRef::VisitFunctionDecl(const FunctionDecl * functionDecl) {
         if (typeName == "class rtl::OUString") {
             report(
                 DiagnosticsEngine::Warning,
-                "passing OUString by value, rather pass by reference",
+                "passing OUString by value, rather pass by reference .e.g. 'const OUString&'",
                 pvDecl->getSourceRange().getBegin())
               << pvDecl->getSourceRange();
         }
         else if (typeName == "class rtl::OString") {
             report(
                 DiagnosticsEngine::Warning,
-                "passing OString by value, rather pass by reference",
+                "passing OString by value, rather pass by reference .e.g. 'const OString&'",
                 pvDecl->getSourceRange().getBegin())
               << pvDecl->getSourceRange();
         }
commit 96710f8e466d44047ea4ac9cb8c70dc7664f5c73
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Mar 18 16:12:40 2014 +0200

    convert OUString::match to OUString::endsWith
    
    Convert code like:
        rTxt.match( "---", rTxt.getLength()-3 )
    to:
       rTxt.endsWith( "---" )
    
    Change-Id: Iada74c5e714f7234f25b326526843a36255d5599

diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 34a9c9b..1602fb0 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -1767,7 +1767,7 @@ bool checkUnoObjectType( SbUnoObject* pUnoObj, const OUString& rClass )
             // match interface name with passed class name
             OSL_TRACE("Checking if object implements %s", OUStringToOString( aClassName, RTL_TEXTENCODING_UTF8 ).getStr() );
             if ( (aClassName.getLength() <= aInterfaceName.getLength()) &&
-                    aInterfaceName.matchIgnoreAsciiCase( aClassName, aInterfaceName.getLength() - aClassName.getLength() ) )
+                    aInterfaceName.endsWithIgnoreAsciiCase( aClassName ) )
             {
                 result = true;
                 break;
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 320a999..f6c935e 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -1322,8 +1322,7 @@ SvxAutoCorrect::DoAutoCorrect( SvxAutoCorrDoc& rDoc, const OUString& rTxt,
 
             // since LibO 4.1, '-' is a word separator
             // fdo#67742 avoid "--" to be replaced by "–" if next is "-"
-            if( rTxt.getLength() >= 3 &&
-                rTxt.match( OUString("---"), rTxt.getLength()-3 ) )
+            if( rTxt.endsWith( "---" ) )
                     break;
             bool bChgWord = rDoc.ChgAutoCorrWord( nCapLttrPos, nInsPos,
                                                     *this, pPara );
diff --git a/extensions/source/propctrlr/genericpropertyhandler.cxx b/extensions/source/propctrlr/genericpropertyhandler.cxx
index 66d20ce..c519440 100644
--- a/extensions/source/propctrlr/genericpropertyhandler.cxx
+++ b/extensions/source/propctrlr/genericpropertyhandler.cxx
@@ -598,7 +598,7 @@ namespace pcr
         case TypeClass_STRING:
         {
             // some special handling for URL properties
-            bool bIsURLProperty = ( _rPropertyName.getLength() >= 3 ) && _rPropertyName.matchAsciiL( "URL", 3, _rPropertyName.getLength() - 3 );
+            bool bIsURLProperty = _rPropertyName.endsWithAsciiL( "URL", 3 );
             if ( bIsURLProperty )
             {
                 aDescriptor.Control = _rxControlFactory->createPropertyControl(
diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx
index 6c48eed..fbde4d6 100644
--- a/filter/source/msfilter/msvbahelper.cxx
+++ b/filter/source/msfilter/msvbahelper.cxx
@@ -54,9 +54,7 @@ OUString makeMacroURL( const OUString& sMacroName )
 
 OUString extractMacroName( const OUString& rMacroUrl )
 {
-    if( (rMacroUrl.getLength() > sUrlPart0.getLength() + sUrlPart1.getLength()) &&
-        rMacroUrl.match( sUrlPart0 ) &&
-        rMacroUrl.match( sUrlPart1, rMacroUrl.getLength() - sUrlPart1.getLength() ) )
+    if( rMacroUrl.startsWith( sUrlPart0 ) && rMacroUrl.endsWith( sUrlPart1 ) )
     {
         return rMacroUrl.copy( sUrlPart0.getLength(),
             rMacroUrl.getLength() - sUrlPart0.getLength() - sUrlPart1.getLength() );
diff --git a/oox/source/vml/vmlinputstream.cxx b/oox/source/vml/vmlinputstream.cxx
index f534ecf..70896e1 100644
--- a/oox/source/vml/vmlinputstream.cxx
+++ b/oox/source/vml/vmlinputstream.cxx
@@ -355,7 +355,7 @@ void InputStream::updateBuffer() throw (IOException, RuntimeException)
             if( aElement.match( maOpeningCData ) )
             {
                 // search the end tag ']]>'
-                while( ((aElement.getLength() < maClosingCData.getLength()) || !aElement.match( maClosingCData, aElement.getLength() - maClosingCData.getLength() )) && !mxTextStrm->isEOF() )
+                while( ((aElement.getLength() < maClosingCData.getLength()) || !aElement.endsWith( maClosingCData )) && !mxTextStrm->isEOF() )
                     aElement += readToElementEnd();
                 // copy the entire CDATA part
                 aBuffer.append( aElement );
diff --git a/sc/source/filter/excel/xltools.cxx b/sc/source/filter/excel/xltools.cxx
index a044442..ce6e646 100644
--- a/sc/source/filter/excel/xltools.cxx
+++ b/sc/source/filter/excel/xltools.cxx
@@ -704,8 +704,8 @@ OUString XclTools::GetXclMacroName( const OUString& rSbMacroUrl )
 {
     sal_Int32 nSbMacroUrlLen = rSbMacroUrl.getLength();
     sal_Int32 nMacroNameLen = nSbMacroUrlLen - maSbMacroPrefix.getLength() - maSbMacroSuffix.getLength();
-    if( (nMacroNameLen > 0) && rSbMacroUrl.matchIgnoreAsciiCase( maSbMacroPrefix, 0 ) &&
-            rSbMacroUrl.matchIgnoreAsciiCase( maSbMacroSuffix, nSbMacroUrlLen - maSbMacroSuffix.getLength() ) )
+    if( (nMacroNameLen > 0) && rSbMacroUrl.startsWithIgnoreAsciiCase( maSbMacroPrefix ) &&
+            rSbMacroUrl.endsWithIgnoreAsciiCase( maSbMacroSuffix ) )
     {
         sal_Int32 nPrjDot = rSbMacroUrl.indexOf( '.', maSbMacroPrefix.getLength() ) + 1;
         return rSbMacroUrl.copy( nPrjDot, nSbMacroUrlLen - nPrjDot - maSbMacroSuffix.getLength() );
diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx
index 5b49745..662733d 100644
--- a/svtools/source/config/colorcfg.cxx
+++ b/svtools/source/config/colorcfg.cxx
@@ -240,7 +240,7 @@ void ColorConfig_Impl::Load(const OUString& rScheme)
         if(nIndex >= aColors.getLength())
             break;
         //test for visibility property
-        if(pColorNames[nIndex].match(m_sIsVisible, pColorNames[nIndex].getLength() - m_sIsVisible.getLength()))
+        if(pColorNames[nIndex].endsWith(m_sIsVisible))
              m_aConfigValues[i / 2].bIsVisible = Any2Bool(pColors[nIndex++]);
     }
     // fdo#71511: check if we are running in a11y autodetect
@@ -280,7 +280,7 @@ void ColorConfig_Impl::Commit()
         if(nIndex >= aColorNames.getLength())
             break;
         //test for visibility property
-        if(pColorNames[nIndex].match(m_sIsVisible, pColorNames[nIndex].getLength() - m_sIsVisible.getLength()))
+        if(pColorNames[nIndex].endsWith(m_sIsVisible))
         {
              pPropValues[nIndex].Name = pColorNames[nIndex];
              pPropValues[nIndex].Value.setValue(&m_aConfigValues[i/2].bIsVisible, rBoolType);
commit e80b9f344aeb88bdbb42d846c0a094d86ee327dc
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Mar 18 13:42:37 2014 +0200

    make "rest" param in endsWithIgnoreAsciiCase default to zero
    
    so it matches all of the other endsWith* methods
    
    Change-Id: If6a37056b1225675848434bfb3520e6c496f22e5

diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
index f1a5f4a..6864e91 100644
--- a/include/rtl/ustring.hxx
+++ b/include/rtl/ustring.hxx
@@ -1095,7 +1095,7 @@ public:
 
       @since LibreOffice 3.6
     */
-    bool endsWithIgnoreAsciiCase(OUString const & str, OUString * rest) const
+    bool endsWithIgnoreAsciiCase(OUString const & str, OUString * rest = 0) const
     {
         bool b =  str.getLength() <= getLength()
             && matchIgnoreAsciiCase(str, getLength() - str.getLength());


More information about the Libreoffice-commits mailing list