[PATCH] String::AppendAscii cleanup

Ricardo Montania (via Code Review) gerrit at gerrit.libreoffice.org
Wed Mar 13 06:43:31 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2703

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/03/2703/1

String::AppendAscii cleanup

Change-Id: If9e57c77d39597db78739a7886d76ee0197f6461
---
M cui/source/dialogs/SpellDialog.cxx
M cui/source/tabpages/numpages.cxx
M cui/source/tabpages/tparea.cxx
3 files changed, 24 insertions(+), 24 deletions(-)



diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index f098a28..dcae0d6 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -1897,10 +1897,10 @@
         sal_uLong nPara = pTextEngine->GetParagraphCount();
         if (nPara > 1)
         {
-            String aLeftOverText;
+            OUString aLeftOverText;
             for (sal_uLong i = 1;  i < nPara;  ++i)
             {
-                aLeftOverText.AppendAscii( "\x0a" );    // the manual line break...
+                aLeftOverText += "\x0a";    // the manual line break...
                 aLeftOverText += pTextEngine->GetText(i);
             }
             if (pError)
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 252e57e..07aac6f 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -2708,22 +2708,22 @@
 {
 #define TWIP_TO_MM100(TWIP)     ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
 
-    sal_Char const sHash[] = " # ";
+    OUString const sHash( " # " );
     if ( rNumFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
     {
-        String sDebugText( OUString::valueOf( TWIP_TO_MM100(rNumFmt.GetAbsLSpace() ) ) );
-        sDebugText.AppendAscii( sHash );
+        OUString sDebugText( OUString::valueOf( TWIP_TO_MM100(rNumFmt.GetAbsLSpace() ) ) );
+        sDebugText += sHash;
         sDebugText += OUString::valueOf( TWIP_TO_MM100(rNumFmt.GetCharTextDistance() ) );
-        sDebugText.AppendAscii( sHash );
+        sDebugText += sHash;
         sDebugText += OUString::valueOf( TWIP_TO_MM100(rNumFmt.GetFirstLineOffset() ) );
         rFixed.SetText(sDebugText);
     }
     else if ( rNumFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
     {
         String sDebugText( OUString::valueOf( TWIP_TO_MM100(rNumFmt.GetListtabPos() ) ) );
-        sDebugText.AppendAscii( sHash );
+        sDebugText += sHash;
         sDebugText += OUString::valueOf( TWIP_TO_MM100(rNumFmt.GetFirstLineIndent() ) );
-        sDebugText.AppendAscii( sHash );
+        sDebugText += sHash;
         sDebugText += OUString::valueOf( TWIP_TO_MM100(rNumFmt.GetIndentAt() ) );
         rFixed.SetText(sDebugText);
     }
diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx
index bd7b09b..952d612 100644
--- a/cui/source/tabpages/tparea.cxx
+++ b/cui/source/tabpages/tparea.cxx
@@ -1859,7 +1859,7 @@
     aLbHatchBckgrdColor.Hide();
 
     // set table text
-    String          aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+    OUString        aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString += ": ";
     INetURLObject   aURL( pColorList->GetPath() );
 
     aURL.Append( pColorList->GetName() );
@@ -1867,11 +1867,11 @@
 
     if( aURL.getBase().getLength() > 18 )
     {
-        aString += String(aURL.getBase()).Copy( 0, 15 );
-        aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
+        aString += aURL.getBase().copy( 0, 15 );
+        aString += "...";
     }
     else
-        aString += String(aURL.getBase());
+        aString += aURL.getBase();
 
     ModifyColorHdl_Impl( this );
 }
@@ -1948,7 +1948,7 @@
     aLbHatchBckgrdColor.Hide();
 
     // set table text
-    String          aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+    OUString        aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString += ": ";
     INetURLObject   aURL( pGradientList->GetPath() );
 
     aURL.Append( pGradientList->GetName() );
@@ -1956,11 +1956,11 @@
 
     if( aURL.getBase().getLength() > 18 )
     {
-        aString += String(aURL.getBase()).Copy( 0, 15 );
-        aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
+        aString += aURL.getBase().copy( 0, 15 );
+        aString += "...";
     }
     else
-        aString += String(aURL.getBase());
+        aString += aURL.getBase();
 
     ModifyGradientHdl_Impl( this );
     ModifyStepCountHdl_Impl( &aTsbStepCount );
@@ -2039,7 +2039,7 @@
     aLbHatchBckgrdColor.Enable();
 
     // set table text
-    String          aString( CUI_RES( RID_SVXSTR_TABLE ) );     aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+    OUString        aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString += ": ";
     INetURLObject   aURL( pHatchingList->GetPath() );
 
     aURL.Append( pHatchingList->GetName() );
@@ -2047,11 +2047,11 @@
 
     if( aURL.getBase().getLength() > 18 )
     {
-        aString += String(String(aURL.getBase()).Copy( 0, 15 ));
-        aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
+        aString += aURL.getBase().copy( 0, 15 );
+        aString += "...";
     }
     else
-        aString += String(aURL.getBase());
+        aString += aURL.getBase();
 
     ModifyHatchingHdl_Impl( this );
     ModifyHatchBckgrdColorHdl_Impl( this );
@@ -2198,7 +2198,7 @@
     aFlOffset.Show();
 
     // set table text
-    String          aString( CUI_RES( RID_SVXSTR_TABLE ) );     aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+    OUString        aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString += ": ";
     INetURLObject   aURL( pBitmapList->GetPath() );
 
     aURL.Append( pBitmapList->GetName() );
@@ -2206,11 +2206,11 @@
 
     if( aURL.getBase().getLength() > 18 )
     {
-        aString += String(aURL.getBase()).Copy( 0, 15 );
-        aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
+        aString += aURL.getBase().copy( 0, 15 );
+        aString += "...";
     }
     else
-        aString += String(aURL.getBase());
+        aString += aURL.getBase();
 
     ModifyBitmapHdl_Impl( this );
     ModifyTileHdl_Impl( &aTsbOriginal );

-- 
To view, visit https://gerrit.libreoffice.org/2703
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If9e57c77d39597db78739a7886d76ee0197f6461
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Ricardo Montania <ricardo at linuxafundo.com.br>



More information about the LibreOffice mailing list