[PATCH] fdo#57950: Remove some chained appends in chart2 and more

Marcos Souza (via Code Review) gerrit at gerrit.libreoffice.org
Sat Jan 5 06:27:35 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1549

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/49/1549/1

fdo#57950: Remove some chained appends in chart2 and more

Removed a not needed variable;
Removed some rt:: prefixes

Change-Id: I24a7a0c5adcee17eab4c9d6442b472a5992f261e
Signed-off-by: Marcos Paulo de Souza <marcos.souza.org at gmail.com>
---
M chart2/source/controller/accessibility/AccessibleBase.cxx
M chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
M chart2/source/tools/DataSeriesHelper.cxx
M chart2/source/tools/MeanValueRegressionCurveCalculator.cxx
4 files changed, 17 insertions(+), 22 deletions(-)



diff --git a/chart2/source/controller/accessibility/AccessibleBase.cxx b/chart2/source/controller/accessibility/AccessibleBase.cxx
index 183945b..85907b0 100644
--- a/chart2/source/controller/accessibility/AccessibleBase.cxx
+++ b/chart2/source/controller/accessibility/AccessibleBase.cxx
@@ -583,13 +583,10 @@
         i < 0 ||
         static_cast< ChildListVectorType::size_type >( i ) >= m_aChildList.size() )
     {
-        OUStringBuffer aBuf;
-        aBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "Index " ));
-        aBuf.append( i );
-        aBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " is invalid for range [ 0, " ));
-        aBuf.append( static_cast< sal_Int32 >( m_aChildList.size() - 1 ) );
-        aBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " ]" ) );
-        lang::IndexOutOfBoundsException aEx( aBuf.makeStringAndClear(),
+        OUString aBuf = "Index " + OUString::valueOf( i ) + " is invalid for range [ 0, " +
+                        OUString::valueOf( static_cast< sal_Int32 >( m_aChildList.size() - 1 ) ) +
+                        " ]";
+        lang::IndexOutOfBoundsException aEx( aBuf,
                                              const_cast< ::cppu::OWeakObject * >(
                                                  static_cast< const ::cppu::OWeakObject * >( this )));
         throw aEx;
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
index a567530..6096442 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
@@ -149,17 +149,17 @@
 
 namespace
 {
-    rtl::OUString lcl_makeColorName( Color rColor )
+    OUString lcl_makeColorName( Color rColor )
     {
-        rtl::OUStringBuffer aStr(SVX_RESSTR(RID_SVXFLOAT3D_FIX_R));
-        aStr.append((sal_Int32)rColor.GetRed());
-        aStr.append(' ');
-        aStr.append(SVX_RESSTR(RID_SVXFLOAT3D_FIX_G));
-        aStr.append((sal_Int32)rColor.GetGreen());
-        aStr.append(' ');
-        aStr.append(SVX_RESSTR(RID_SVXFLOAT3D_FIX_B));
-        aStr.append((sal_Int32)rColor.GetBlue());
-        return aStr.makeStringAndClear();
+        OUString aStr = SVX_RESSTR(RID_SVXFLOAT3D_FIX_R) +
+                        OUString::valueOf((sal_Int32)rColor.GetRed()) +
+                        " " +
+                        SVX_RESSTR(RID_SVXFLOAT3D_FIX_G) +
+                        OUString::valueOf((sal_Int32)rColor.GetGreen()) +
+                        " " +
+                        SVX_RESSTR(RID_SVXFLOAT3D_FIX_B) +
+                        OUString::valueOf((sal_Int32)rColor.GetBlue());
+        return aStr;
     }
     void lcl_selectColor( ColorListBox& rListBox, const Color& rColor )
     {
diff --git a/chart2/source/tools/DataSeriesHelper.cxx b/chart2/source/tools/DataSeriesHelper.cxx
index b5fa305..15ea915 100644
--- a/chart2/source/tools/DataSeriesHelper.cxx
+++ b/chart2/source/tools/DataSeriesHelper.cxx
@@ -273,7 +273,6 @@
         Sequence< OUString > aSeq( xTextSeq->getTextualData());
 
         const sal_Int32 nMax = aSeq.getLength() - 1;
-        OUString aVal;
         OUStringBuffer aBuf;
 
         for( sal_Int32 i = 0; i <= nMax; ++i )
diff --git a/chart2/source/tools/MeanValueRegressionCurveCalculator.cxx b/chart2/source/tools/MeanValueRegressionCurveCalculator.cxx
index 3caef43..0551cbd 100644
--- a/chart2/source/tools/MeanValueRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/MeanValueRegressionCurveCalculator.cxx
@@ -123,11 +123,10 @@
     const uno::Reference< util::XNumberFormatter >& xNumFormatter,
     ::sal_Int32 nNumberFormatKey ) const
 {
-    OUStringBuffer aBuf( C2U( "f(x) = " ));
+    OUString aBuf = "f(x) = " +
+                    getFormattedString( xNumFormatter, nNumberFormatKey, m_fMeanValue );
 
-    aBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, m_fMeanValue ));
-
-    return aBuf.makeStringAndClear();
+    return aBuf;
 }
 
 } //  namespace chart

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I24a7a0c5adcee17eab4c9d6442b472a5992f261e
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Marcos Souza <marcos.souza.org at gmail.com>



More information about the LibreOffice mailing list