[PATCH] String::AppendAscii cleanup

Ricardo Montania (via Code Review) gerrit at gerrit.libreoffice.org
Fri Mar 15 09:41:22 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2755

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/55/2755/1

String::AppendAscii cleanup

Change-Id: I33d7a6b704cbb9a5a410b99237643c05a9c1cb9c
---
M cui/source/tabpages/tpbitmap.cxx
M cui/source/tabpages/tpcolor.cxx
M cui/source/tabpages/tpgradnt.cxx
M cui/source/tabpages/tphatch.cxx
M cui/source/tabpages/tplnedef.cxx
5 files changed, 46 insertions(+), 48 deletions(-)



diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx
index 6a4b74b..74034ed 100644
--- a/cui/source/tabpages/tpbitmap.cxx
+++ b/cui/source/tabpages/tpbitmap.cxx
@@ -191,7 +191,7 @@
 
             // determining (possibly cutting) the name and
             // displaying it in the GroupBox
-            String          aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( ": " );
+            OUString        aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString += ": ";
             INetURLObject   aURL( pBitmapList->GetPath() );
 
             aURL.Append( pBitmapList->GetName() );
@@ -199,11 +199,11 @@
 
             if( aURL.getBase().getLength() > 18 )
             {
-                aString += String(aURL.getBase()).Copy( 0, 15 );
-                aString.AppendAscii( "..." );
+                aString += aURL.getBase().copy( 0, 15 );
+                aString += "...";
             }
             else
-                aString += String(aURL.getBase());
+                aString += aURL.getBase();
 
             if( *pPageType == PT_BITMAP && *pPos != LISTBOX_ENTRY_NOTFOUND )
             {
@@ -933,16 +933,15 @@
 
                 // determining (possibly cutting) the name
                 // displaying it in the GroupBox
-                String aString( ResId( RID_SVXSTR_TABLE, rMgr ) );
-                aString.AppendAscii( ": " );
+                OUString aString( ResId( RID_SVXSTR_TABLE, rMgr ) ); aString += ": ";
 
                 if ( aURL.getBase().getLength() > 18 )
                 {
-                    aString += String(aURL.getBase()).Copy( 0, 15 );
-                    aString.AppendAscii( "..." );
+                    aString += aURL.getBase().copy( 0, 15 );
+                    aString += "...";
                 }
                 else
-                    aString += String(aURL.getBase());
+                    aString += aURL.getBase();
 
                 *pnBitmapListState |= CT_CHANGED;
                 *pnBitmapListState &= ~CT_MODIFIED;
@@ -1009,16 +1008,15 @@
         {
             // determining (possibly cutting) the name
             // displaying it in the GroupBox
-            String aString( CUI_RES( RID_SVXSTR_TABLE ) );
-            aString.AppendAscii( ": " );
+            OUString aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString += ": ";
 
             if ( aURL.getBase().getLength() > 18 )
             {
-                aString += String(aURL.getBase()).Copy( 0, 15 );
-                aString.AppendAscii( "..." );
+                aString += aURL.getBase().copy( 0, 15 );
+                aString += "...";
             }
             else
-                aString += String(aURL.getBase());
+                aString += aURL.getBase();
 
             *pnBitmapListState |= CT_SAVED;
             *pnBitmapListState &= ~CT_MODIFIED;
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index ac0c085..f8f6f82 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -109,8 +109,8 @@
 void SvxColorTabPage::UpdateTableName()
 {
     // Truncate the name if necessary ...
-    String aString( CUI_RES( RID_SVXSTR_TABLE ) );
-    aString.AppendAscii( ": " );
+    OUString aString( CUI_RES( RID_SVXSTR_TABLE ) );
+    aString += ": ";
 
     XPropertyListRef pList = GetList();
     if( !pList.is() )
@@ -121,11 +121,11 @@
 
     if ( aURL.getBase().getLength() > 18 )
     {
-        aString += String(aURL.getBase()).Copy( 0, 15 );
-        aString.AppendAscii( "..." );
+        aString += aURL.getBase().copy( 0, 15 );
+        aString += "...";
     }
     else
-        aString += String (aURL.getBase());
+        aString += aURL.getBase();
 
     m_pTableName->SetText( aString );
 }
diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx
index 6dc0902..6bb404d 100644
--- a/cui/source/tabpages/tpgradnt.cxx
+++ b/cui/source/tabpages/tpgradnt.cxx
@@ -200,7 +200,7 @@
 
             // determining (and possibly cutting) the name and
             // displaying it in the GroupBox
-            String          aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( ": " );
+            OUString        aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString += ": ";
             INetURLObject   aURL( pGradientList->GetPath() );
 
             aURL.Append( pGradientList->GetName() );
@@ -208,11 +208,11 @@
 
             if ( aURL.getBase().getLength() > 18 )
             {
-                aString += String(aURL.getBase()).Copy( 0, 15 );
-                aString.AppendAscii( "..." );
+                aString += aURL.getBase().copy( 0, 15 );
+                aString += "...";
             }
             else
-                aString += String(aURL.getBase());
+                aString += aURL.getBase();
 
             if ( *pPageType == PT_GRADIENT && *pPos != LISTBOX_ENTRY_NOTFOUND )
             {
@@ -669,16 +669,16 @@
 
                 // determining (possibly cutting) the name
                 // and displaying it in the GroupBox
-                String aString( ResId( RID_SVXSTR_TABLE, rMgr ) );
-                aString.AppendAscii( ": " );
+                OUString aString( ResId( RID_SVXSTR_TABLE, rMgr ) );
+                aString += ": ";
 
                 if ( aURL.getBase().getLength() > 18 )
                 {
-                    aString += String(aURL.getBase()).Copy( 0, 15 );
-                    aString.AppendAscii( "..." );
+                    aString += aURL.getBase().copy( 0, 15 );
+                    aString += "...";
                 }
                 else
-                    aString += String(aURL.getBase());
+                    aString += aURL.getBase();
 
                 *pnGradientListState |= CT_CHANGED;
                 *pnGradientListState &= ~CT_MODIFIED;
@@ -745,16 +745,16 @@
         {
             // determining (possibly cutting) the name
             // and displaying it in the GroupBox
-            String aString( CUI_RES( RID_SVXSTR_TABLE ) );
-            aString.AppendAscii( ": " );
+            OUString aString( CUI_RES( RID_SVXSTR_TABLE ) );
+            aString += ": ";
 
             if ( aURL.getBase().getLength() > 18 )
             {
-                aString += String(aURL.getBase()).Copy( 0, 15 );
-                aString.AppendAscii( "..." );
+                aString += aURL.getBase().copy( 0, 15 );
+                aString += "...";
             }
             else
-                aString += String(aURL.getBase());
+                aString += aURL.getBase();
 
             *pnGradientListState |= CT_SAVED;
             *pnGradientListState &= ~CT_MODIFIED;
diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx
index cb88027..00a55a8 100644
--- a/cui/source/tabpages/tphatch.cxx
+++ b/cui/source/tabpages/tphatch.cxx
@@ -189,7 +189,7 @@
 
             // determining (possibly cutting) the name
             // and displaying it in the GroupBox
-            String          aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( ": " );
+            OUString        aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString += ": ";
             INetURLObject   aURL( pHatchingList->GetPath() );
 
             aURL.Append( pHatchingList->GetName() );
@@ -197,11 +197,11 @@
 
             if ( aURL.getBase().getLength() > 18 )
             {
-                aString += String(aURL.getBase()).Copy( 0, 15 );
-                aString.AppendAscii( "..." );
+                aString += aURL.getBase().copy( 0, 15 );
+                aString += "...";
             }
             else
-                aString += String(aURL.getBase());
+                aString += aURL.getBase();
 
             if( *pPageType == PT_HATCH && *pPos != LISTBOX_ENTRY_NOTFOUND )
             {
@@ -713,16 +713,16 @@
 
                 // determining (and possibly cutting) the name
                 // and displaying it in the GroupBox
-                String aString( ResId( RID_SVXSTR_TABLE, rMgr ) );
-                aString.AppendAscii( ": " );
+                OUString aString( ResId( RID_SVXSTR_TABLE, rMgr ) );
+                aString += ": ";
 
                 if ( aURL.getBase().getLength() > 18 )
                 {
-                    aString += String(aURL.getBase()).Copy( 0, 15 );
-                    aString.AppendAscii( "..." );
+                    aString += aURL.getBase().copy( 0, 15 );
+                    aString += "...";
                 }
                 else
-                    aString += String(aURL.getBase());
+                    aString += aURL.getBase();
 
                 *pnHatchingListState |= CT_CHANGED;
                 *pnHatchingListState &= ~CT_MODIFIED;
@@ -785,16 +785,16 @@
         {
             // determining (and possibly cutting) the name
             // and displaying it in the GroupBox
-            String aString( CUI_RES( RID_SVXSTR_TABLE ) );
-            aString.AppendAscii( ": " );
+            OUString aString( CUI_RES( RID_SVXSTR_TABLE ) );
+            aString += ": ";
 
             if ( aURL.getBase().getLength() > 18 )
             {
-                aString += String(aURL.getBase()).Copy( 0, 15 );
-                aString.AppendAscii( "..." );
+                aString += aURL.getBase().copy( 0, 15 );
+                aString += "...";
             }
             else
-                aString += String(aURL.getBase());
+                aString += aURL.getBase();
 
             *pnHatchingListState |= CT_SAVED;
             *pnHatchingListState &= ~CT_MODIFIED;
diff --git a/cui/source/tabpages/tplnedef.cxx b/cui/source/tabpages/tplnedef.cxx
index dd88083..d7b5052 100644
--- a/cui/source/tabpages/tplnedef.cxx
+++ b/cui/source/tabpages/tplnedef.cxx
@@ -192,7 +192,7 @@
 
             // determining (and possibly cutting) the name
             // and displaying it in the GroupBox
-            String          aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( ": " );
+            OUString        aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString += ": ";
             INetURLObject   aURL( pDashList->GetPath() );
 
             aURL.Append( pDashList->GetName() );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I33d7a6b704cbb9a5a410b99237643c05a9c1cb9c
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