[Libreoffice-commits] .: tools/inc tools/source unusedcode.easy

Caolán McNamara caolan at kemper.freedesktop.org
Thu Feb 23 07:59:27 PST 2012


 tools/inc/tools/string.hxx       |    7 ---
 tools/source/string/strimp.cxx   |   86 ---------------------------------------
 tools/source/string/tstring.cxx  |   13 -----
 tools/source/string/tustring.cxx |   86 +++++++++++++++++++++++++++++++++++++++
 unusedcode.easy                  |    4 -
 5 files changed, 87 insertions(+), 109 deletions(-)

New commits:
commit 67f67509ff20c0d5b6e9f3557fb1e427655601ee
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Feb 23 15:57:11 2012 +0000

    lock in ByteString gains

diff --git a/tools/inc/tools/string.hxx b/tools/inc/tools/string.hxx
index c232c07..7fe2c10 100644
--- a/tools/inc/tools/string.hxx
+++ b/tools/inc/tools/string.hxx
@@ -156,6 +156,7 @@ private:
     void                Assign(int); // not implemented; to detect misuses of
                                      // Assign(sal_Char)
     ByteString&         Assign( const sal_Char* pCharStr, xub_StrLen nLen );  //not implemented, to detect use of removed methods without compiler making something to fit
+    ByteString&         Assign( const sal_Char* pCharStr ); //not implemented, to detect use of removed methods without compiler making something to fit
     ByteString&         operator =(const sal_Char); //not implemented, to detect use of removed methods without compiler making something to fit
 
     ByteString&         Assign(sal_Char); //not implemented, to detect use of removed methods without compiler making something to fit
@@ -187,7 +188,6 @@ public:
 
     ByteString&         Assign( const ByteString& rStr );
     ByteString&         Assign( const rtl::OString& rStr );
-    ByteString&         Assign( const sal_Char* pCharStr );
     ByteString&         operator =( const ByteString& rStr )
                             { return Assign( rStr ); }
     ByteString&         operator =( const rtl::OString& rStr )
@@ -220,16 +220,11 @@ public:
     StringCompare       CompareIgnoreCaseToAscii( const sal_Char* pCharStr,
                                                   xub_StrLen nLen = STRING_LEN ) const;
     sal_Bool                Equals( const sal_Char* pCharStr ) const;
-    sal_Bool                EqualsIgnoreCaseAscii( const sal_Char* pCharStr ) const;
 
     xub_StrLen          Search( sal_Char c, xub_StrLen nIndex = 0 ) const;
     xub_StrLen          Search( const ByteString& rStr, xub_StrLen nIndex = 0 ) const;
     xub_StrLen          Search( const sal_Char* pCharStr, xub_StrLen nIndex = 0 ) const;
 
-    xub_StrLen          SearchAndReplace( const ByteString& rStr, const ByteString& rRepStr,
-                                          xub_StrLen nIndex = 0 );
-    xub_StrLen          SearchAndReplace( const sal_Char* pCharStr, const ByteString& rRepStr,
-                                          xub_StrLen nIndex = 0 );
     void                SearchAndReplaceAll( sal_Char c, sal_Char cRep );
 
     ByteString          GetToken( xub_StrLen nToken, sal_Char cTok = ';' ) const;
diff --git a/tools/source/string/strimp.cxx b/tools/source/string/strimp.cxx
index 1eef75d..dd00878 100644
--- a/tools/source/string/strimp.cxx
+++ b/tools/source/string/strimp.cxx
@@ -60,34 +60,6 @@ static sal_Int32 ImplStringCompareWithoutZero( const STRCODE* pStr1, const STRCO
     return nRet;
 }
 
-// -----------------------------------------------------------------------
-
-static sal_Int32 ImplStringICompare( const STRCODE* pStr1, const STRCODE* pStr2 )
-{
-    sal_Int32   nRet;
-    STRCODE     c1;
-    STRCODE     c2;
-    do
-    {
-        // Ist das Zeichen zwischen 'A' und 'Z' dann umwandeln
-        c1 = *pStr1;
-        c2 = *pStr2;
-        if ( (c1 >= 65) && (c1 <= 90) )
-            c1 += 32;
-        if ( (c2 >= 65) && (c2 <= 90) )
-            c2 += 32;
-        nRet = ((sal_Int32)((STRCODEU)c1))-((sal_Int32)((STRCODEU)c2));
-        if ( nRet != 0 )
-            break;
-
-        ++pStr1,
-        ++pStr2;
-    }
-    while ( c2 );
-
-    return nRet;
-}
-
 // =======================================================================
 
 #ifdef DBG_UTIL
@@ -280,39 +252,6 @@ STRING& STRING::Assign( const STRING& rStr )
 
 // -----------------------------------------------------------------------
 
-STRING& STRING::Assign( const STRCODE* pCharStr )
-{
-    DBG_CHKTHIS( STRING, DBGCHECKSTRING );
-    DBG_ASSERT( pCharStr, "String::Assign() - pCharStr is NULL" );
-
-    // Stringlaenge ermitteln
-    xub_StrLen nLen = ImplStringLen( pCharStr );
-
-    if ( !nLen )
-    {
-        STRING_NEW((STRING_TYPE **)&mpData);
-    }
-    else
-    {
-        // Wenn String genauso lang ist, wie der String, dann direkt kopieren
-        if ( (nLen == mpData->mnLen) && (mpData->mnRefCount == 1) )
-            memcpy( mpData->maStr, pCharStr, nLen*sizeof( STRCODE ) );
-        else
-        {
-            // Alte Daten loeschen
-            STRING_RELEASE((STRING_TYPE *)mpData);
-
-            // Daten initialisieren und String kopieren
-            mpData = ImplAllocData( nLen );
-            memcpy( mpData->maStr, pCharStr, nLen*sizeof( STRCODE ) );
-        }
-    }
-
-    return *this;
-}
-
-// -----------------------------------------------------------------------
-
 STRING& STRING::Append( const STRING& rStr )
 {
     DBG_CHKTHIS( STRING, DBGCHECKSTRING );
@@ -554,15 +493,6 @@ STRING& STRING::ToLowerAscii()
 
 // -----------------------------------------------------------------------
 
-sal_Bool STRING::EqualsIgnoreCaseAscii( const STRCODE* pCharStr ) const
-{
-    DBG_CHKTHIS( STRING, DBGCHECKSTRING );
-
-    return (ImplStringICompare( mpData->maStr, pCharStr ) == 0);
-}
-
-// -----------------------------------------------------------------------
-
 xub_StrLen STRING::Search( STRCODE c, xub_StrLen nIndex ) const
 {
     DBG_CHKTHIS( STRING, DBGCHECKSTRING );
@@ -674,22 +604,6 @@ xub_StrLen STRING::Search( const STRCODE* pCharStr, xub_StrLen nIndex ) const
 
 // -----------------------------------------------------------------------
 
-xub_StrLen STRING::SearchAndReplace( const STRING& rStr, const STRING& rRepStr,
-                                     xub_StrLen nIndex )
-{
-    DBG_CHKTHIS( STRING, DBGCHECKSTRING );
-    DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
-    DBG_CHKOBJ( &rRepStr, STRING, DBGCHECKSTRING );
-
-    xub_StrLen nSPos = Search( rStr, nIndex );
-    if ( nSPos != STRING_NOTFOUND )
-        Replace( nSPos, rStr.Len(), rRepStr );
-
-    return nSPos;
-}
-
-// -----------------------------------------------------------------------
-
 void STRING::SearchAndReplaceAll( STRCODE c, STRCODE cRep )
 {
     DBG_CHKTHIS( STRING, DBGCHECKSTRING );
diff --git a/tools/source/string/tstring.cxx b/tools/source/string/tstring.cxx
index e87316b..97bad85 100644
--- a/tools/source/string/tstring.cxx
+++ b/tools/source/string/tstring.cxx
@@ -83,19 +83,6 @@ xub_StrLen ImplStringLen( const sal_Unicode* pStr )
 #include <strimp.cxx>
 #include <strcvt.cxx>
 
-xub_StrLen STRING::SearchAndReplace( const STRCODE* pCharStr, const STRING& rRepStr,
-                                     xub_StrLen nIndex )
-{
-    DBG_CHKTHIS( STRING, DBGCHECKSTRING );
-    DBG_CHKOBJ( &rRepStr, STRING, DBGCHECKSTRING );
-
-    xub_StrLen nSPos = Search( pCharStr, nIndex );
-    if ( nSPos != STRING_NOTFOUND )
-        Replace( nSPos, ImplStringLen( pCharStr ), rRepStr );
-
-    return nSPos;
-}
-
 static sal_Int32 ImplStringICompare( const STRCODE* pStr1, const STRCODE* pStr2,
                                      xub_StrLen nCount )
 {
diff --git a/tools/source/string/tustring.cxx b/tools/source/string/tustring.cxx
index 26a4ccf..033498d 100644
--- a/tools/source/string/tustring.cxx
+++ b/tools/source/string/tustring.cxx
@@ -1119,4 +1119,90 @@ STRING& STRING::Assign( STRCODE c )
     return *this;
 }
 
+// -----------------------------------------------------------------------
+
+xub_StrLen STRING::SearchAndReplace( const STRING& rStr, const STRING& rRepStr,
+                                     xub_StrLen nIndex )
+{
+    DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+    DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
+    DBG_CHKOBJ( &rRepStr, STRING, DBGCHECKSTRING );
+
+    xub_StrLen nSPos = Search( rStr, nIndex );
+    if ( nSPos != STRING_NOTFOUND )
+        Replace( nSPos, rStr.Len(), rRepStr );
+
+    return nSPos;
+}
+
+// -----------------------------------------------------------------------
+
+static sal_Int32 ImplStringICompare( const STRCODE* pStr1, const STRCODE* pStr2 )
+{
+    sal_Int32   nRet;
+    STRCODE     c1;
+    STRCODE     c2;
+    do
+    {
+        // Ist das Zeichen zwischen 'A' und 'Z' dann umwandeln
+        c1 = *pStr1;
+        c2 = *pStr2;
+        if ( (c1 >= 65) && (c1 <= 90) )
+            c1 += 32;
+        if ( (c2 >= 65) && (c2 <= 90) )
+            c2 += 32;
+        nRet = ((sal_Int32)((STRCODEU)c1))-((sal_Int32)((STRCODEU)c2));
+        if ( nRet != 0 )
+            break;
+
+        ++pStr1,
+        ++pStr2;
+    }
+    while ( c2 );
+
+    return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool STRING::EqualsIgnoreCaseAscii( const STRCODE* pCharStr ) const
+{
+    DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+    return (ImplStringICompare( mpData->maStr, pCharStr ) == 0);
+}
+
+// -----------------------------------------------------------------------
+
+STRING& STRING::Assign( const STRCODE* pCharStr )
+{
+    DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+    DBG_ASSERT( pCharStr, "String::Assign() - pCharStr is NULL" );
+
+    // Stringlaenge ermitteln
+    xub_StrLen nLen = ImplStringLen( pCharStr );
+
+    if ( !nLen )
+    {
+        STRING_NEW((STRING_TYPE **)&mpData);
+    }
+    else
+    {
+        // Wenn String genauso lang ist, wie der String, dann direkt kopieren
+        if ( (nLen == mpData->mnLen) && (mpData->mnRefCount == 1) )
+            memcpy( mpData->maStr, pCharStr, nLen*sizeof( STRCODE ) );
+        else
+        {
+            // Alte Daten loeschen
+            STRING_RELEASE((STRING_TYPE *)mpData);
+
+            // Daten initialisieren und String kopieren
+            mpData = ImplAllocData( nLen );
+            memcpy( mpData->maStr, pCharStr, nLen*sizeof( STRCODE ) );
+        }
+    }
+
+    return *this;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unusedcode.easy b/unusedcode.easy
index 80d6eb1..b21f1ee 100755
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -1,8 +1,4 @@
 Button::ImplGetSymbolAlign() const
-ByteString::Assign(char const*)
-ByteString::EqualsIgnoreCaseAscii(char const*) const
-ByteString::SearchAndReplace(ByteString const&, ByteString const&, unsigned short)
-ByteString::SearchAndReplace(char const*, ByteString const&, unsigned short)
 CertificateExtension_XmlSecImpl::setCertExtn(com::sun::star::uno::Sequence<signed char>, com::sun::star::uno::Sequence<signed char>, unsigned char)
 CharPosArray::Insert(CharPosArray const*, unsigned short, unsigned short, unsigned short)
 CharPosArray::Replace(int const&, unsigned short)


More information about the Libreoffice-commits mailing list