[Libreoffice-commits] core.git: sw/source

Andrew Branch andyb1.lod at gmail.com
Thu Feb 21 04:34:16 PST 2013


 sw/source/core/access/accmap.cxx      |    4 +---
 sw/source/core/access/accportions.cxx |   20 +++++++-------------
 sw/source/core/access/acctable.cxx    |   26 +++++---------------------
 3 files changed, 13 insertions(+), 37 deletions(-)

New commits:
commit 868cb16417f7a4c9bdbb55b6262eddad3db6dc14
Author: Andrew Branch <andyb1.lod at gmail.com>
Date:   Wed Feb 20 20:43:58 2013 +0000

    fdo#57950: Remove some chained appends in filter in sw/access
    
    Change-Id: I9f3b44d6ea154d628dd59e31d9403097809a2853
    Reviewed-on: https://gerrit.libreoffice.org/2300
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 4f737a8..513c195 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -175,9 +175,7 @@ void SwDrawModellListener_Impl::Notify( SfxBroadcaster& /*rBC*/,
         {
             (void)r;
 #if OSL_DEBUG_LEVEL > 0
-            rtl::OStringBuffer aError(RTL_CONSTASCII_STRINGPARAM("Runtime exception caught while notifying shape.:\n"));
-            aError.append(rtl::OUStringToOString(r.Message, RTL_TEXTENCODING_ASCII_US));
-            OSL_FAIL( aError.getStr() );
+              OSL_FAIL( "Runtime exception caught while notifying shape.:\n" + OUStringToOString(r.Message, RTL_TEXTENCODING_ASCII_US) );
 #endif
         }
     }
diff --git a/sw/source/core/access/accportions.cxx b/sw/source/core/access/accportions.cxx
index 8e1e2ff..5b2e0ac 100644
--- a/sw/source/core/access/accportions.cxx
+++ b/sw/source/core/access/accportions.cxx
@@ -141,40 +141,34 @@ void SwAccessiblePortionData::Special(
 
     // construct string with representation; either directly from
     // rText, or use resources for special case portions
-    String sDisplay;
+    OUString sDisplay;
     switch( nType )
     {
         case POR_POSTITS:
         case POR_FLYCNT:
         case POR_GRFNUM:
-            sDisplay = rtl::OUString(sal_Unicode(0xfffc));
+            sDisplay = OUString(sal_Unicode(0xfffc));
 
             break;
         case POR_NUMBER:
         {
-            OUStringBuffer aTmpBuffer( rText.Len() + 1 );
-            aTmpBuffer.append( rText );
-            aTmpBuffer.append( sal_Unicode(' ') );
-            sDisplay = aTmpBuffer.makeStringAndClear();
+            sDisplay = OUString( rText ) + " ";
             break;
         }
         // #i111768# - apply patch from kstribley:
         // Include the control characters.
         case POR_CONTROLCHAR:
         {
-            OUStringBuffer aTmpBuffer( rText.Len() + 1 );
-            aTmpBuffer.append( rText );
-            aTmpBuffer.append( pTxtNode->GetTxt()[nModelPosition] );
-            sDisplay = aTmpBuffer.makeStringAndClear();
+            sDisplay = OUString( rText ) + OUString( pTxtNode->GetTxt()[nModelPosition] );
             break;
         }
         default:
-            sDisplay = rText;
+            sDisplay = OUString( rText );
             break;
     }
 
     // ignore zero/zero portions (except for terminators)
-    if( (nLength == 0) && (sDisplay.Len() == 0) && (nType != POR_TERMINATE) )
+    if( (nLength == 0) && (sDisplay.getLength() == 0) && (nType != POR_TERMINATE) )
         return;
 
     // special treatment for zero length portion at the beginning:
@@ -194,7 +188,7 @@ void SwAccessiblePortionData::Special(
     aPortionAttrs.push_back( nAttr );
 
     // update buffer + nModelPosition
-    aBuffer.append( OUString(sDisplay) );
+    aBuffer.append( sDisplay );
     nModelPosition += nLength;
 
     // remember 'last' special portion (unless it's our own 'closing'
diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx
index 1db6a38..d50c806 100644
--- a/sw/source/core/access/acctable.cxx
+++ b/sw/source/core/access/acctable.cxx
@@ -692,12 +692,7 @@ SwAccessibleTable::SwAccessibleTable(
     const_cast< SwFrmFmt * >( pFrmFmt )->Add( this );
     const String& rName = pFrmFmt->GetName();
 
-    OUStringBuffer aBuffer( rName.Len() + 4 );
-    aBuffer.append( OUString(rName) );
-    aBuffer.append( static_cast<sal_Unicode>( '-' ) );
-    aBuffer.append( static_cast<sal_Int32>( pTabFrm->GetPhyPageNum() ) );
-
-    SetName( aBuffer.makeStringAndClear() );
+    SetName( OUString( rName ) + "-" + OUString::number( pTabFrm->GetPhyPageNum() ) );
 
     OUString sArg1( static_cast< const SwTabFrm * >( GetFrm() )
                                         ->GetFmt()->GetName() );
@@ -728,12 +723,9 @@ void SwAccessibleTable::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew
             OUString sOldName( GetName() );
 
             const String& rNewTabName = pFrmFmt->GetName();
-            OUStringBuffer aBuffer( rNewTabName.Len() + 4 );
-            aBuffer.append( OUString(rNewTabName) );
-            aBuffer.append( static_cast<sal_Unicode>( '-' ) );
-            aBuffer.append( static_cast<sal_Int32>( pTabFrm->GetPhyPageNum() ) );
 
-            SetName( aBuffer.makeStringAndClear() );
+            SetName( OUString(rNewTabName) + "-" + OUString::number( pTabFrm->GetPhyPageNum() ) );
+
             if( sOldName != GetName() )
             {
                 AccessibleEventObject aEvent;
@@ -1611,17 +1603,9 @@ SwAccessibleTableColHeaders::SwAccessibleTableColHeaders( SwAccessibleMap *pMap2
     const_cast< SwFrmFmt * >( pFrmFmt )->Add( this );
     const String& rName = pFrmFmt->GetName();
 
-    OUStringBuffer aBuffer( rName.Len() + 15 + 6 );
-    aBuffer.append( OUString(rName) );
-    aBuffer.append( rtl::OUString("-ColumnHeaders-") );
-    aBuffer.append( static_cast<sal_Int32>( pTabFrm->GetPhyPageNum() ) );
-
-    SetName( aBuffer.makeStringAndClear() );
+    SetName( OUString(rName) + "-ColumnHeaders-" +  OUString::number( pTabFrm->GetPhyPageNum() ) );
 
-    OUStringBuffer aBuffer2( rName.Len() + 14 );
-    aBuffer2.append( OUString(rName) );
-    aBuffer2.append( rtl::OUString("-ColumnHeaders") );
-    OUString sArg1( aBuffer2.makeStringAndClear() );
+    OUString sArg1( OUString(rName) + "-ColumnHeaders" );
     OUString sArg2( GetFormattedPageNumber() );
 
     OUString sDesc2 = GetResource( STR_ACCESS_TABLE_DESC, &sArg1, &sArg2 );


More information about the Libreoffice-commits mailing list