[PATCH] fod#57950: Removed some chained appends from sw

Marcos Souza (via Code Review) gerrit at gerrit.libreoffice.org
Sun Mar 10 07:25:48 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2643

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/43/2643/1

fod#57950: Removed some chained appends from sw

Change-Id: I5b78b4a8f2fc0fb0c4a67042ac4924e375c2d63a
---
M sw/source/core/attr/format.cxx
M sw/source/core/bastyp/swcache.cxx
M sw/source/core/frmedt/fetab.cxx
M sw/source/filter/html/css1atr.cxx
M sw/source/ui/envelp/envlop1.cxx
M sw/source/ui/envelp/label1.cxx
M sw/source/ui/fldui/changedb.cxx
M sw/source/ui/uiview/pview.cxx
M sw/source/ui/uiview/viewsrch.cxx
M sw/source/ui/utlui/content.cxx
M sw/source/ui/wrtsh/wrtundo.cxx
11 files changed, 81 insertions(+), 188 deletions(-)



diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index 4524937..1530b5f 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -224,9 +224,8 @@
         SwFmt* pParentFmt = DerivedFrom();
         if( !pParentFmt )
         {
-            OSL_FAIL(rtl::OStringBuffer(
-                    RTL_CONSTASCII_STRINGPARAM("~SwFmt: parent format missing from: ")).
-                append(rtl::OUStringToOString(GetName(), osl_getThreadTextEncoding())).getStr());
+            OSL_FAIL("~SwFmt: parent format missing from: " +
+                     OUStringToOString(GetName(), osl_getThreadTextEncoding()));
         }
         else
         {
diff --git a/sw/source/core/bastyp/swcache.cxx b/sw/source/core/bastyp/swcache.cxx
index 588d2ce..7fc8909 100644
--- a/sw/source/core/bastyp/swcache.cxx
+++ b/sw/source/core/bastyp/swcache.cxx
@@ -100,61 +100,20 @@
 {
 #ifdef DBG_UTIL
     {
-        rtl::OStringBuffer sOut(m_aName);
-
-        sOut.append('\n').
-            append(RTL_CONSTASCII_STRINGPARAM(
-                "Number of new entries:                 ")).
-            append(static_cast<sal_Int32>(m_nAppend)).
-            append('\n').
-            append(RTL_CONSTASCII_STRINGPARAM(
-                "Number of insert on free places:       ")).
-            append(static_cast<sal_Int32>(m_nInsertFree)).
-            append('\n').
-            append(RTL_CONSTASCII_STRINGPARAM(
-                "Number of replacements:                ")).
-            append(static_cast<sal_Int32>(m_nReplace)).
-            append('\n').
-            append(RTL_CONSTASCII_STRINGPARAM(
-                "Number of successful Get's:            ")).
-            append(static_cast<sal_Int32>(m_nGetSuccess)).
-            append('\n').
-            append(RTL_CONSTASCII_STRINGPARAM(
-                "Number of failed Get's:                ")).
-            append(static_cast<sal_Int32>(m_nGetFail)).
-            append('\n').
-            append(RTL_CONSTASCII_STRINGPARAM(
-                "Number or reordering (LRU):            ")).
-            append(static_cast<sal_Int32>(m_nToTop)).
-            append('\n').
-            append(RTL_CONSTASCII_STRINGPARAM(
-                "Number of suppressions:                ")).
-            append(static_cast<sal_Int32>(m_nDelete)).
-            append('\n').
-            append(RTL_CONSTASCII_STRINGPARAM(
-                "Number of Get's without Index:         ")).
-            append(static_cast<sal_Int32>(m_nGetSeek)).
-            append('\n').
-            append(RTL_CONSTASCII_STRINGPARAM(
-                "Number of Seek for Get without Index:  ")).
-            append(static_cast<sal_Int32>(m_nAverageSeekCnt)).
-            append('\n').
-            append(RTL_CONSTASCII_STRINGPARAM(
-                "Number of Flush calls:                 " )).
-            append(static_cast<sal_Int32>(m_nFlushCnt)).
-            append('\n').
-            append(RTL_CONSTASCII_STRINGPARAM(
-                "Number of flushed objects:             ")).
-            append(static_cast<sal_Int32>(m_nFlushedObjects)).
-            append('\n').
-            append(RTL_CONSTASCII_STRINGPARAM(
-                "Number of Cache expansions:            ")).
-            append(static_cast<sal_Int32>(m_nIncreaseMax)).
-            append('\n').
-            append(RTL_CONSTASCII_STRINGPARAM(
-                "Number of Cache reductions:            ")).
-            append(static_cast<sal_Int32>(m_nDecreaseMax)).
-            append('\n');
+        OString sOut(m_aName + "\n" +
+                    "Number of new entries:                 " + OString::number(m_nAppend) + "\n" +
+                    "Number of insert on free places:       " + OString::number(m_nInsertFree) + "\n" +
+                    "Number of replacements:                " + OString::number(m_nReplace) + "\n" +
+                    "Number of successful Get's:            " + OString::number(m_nGetSuccess) + "\n" +
+                    "Number of failed Get's:                " + OString::number(m_nGetFail) + "\n" +
+                    "Number or reordering (LRU):            " + OString::number(m_nToTop) + "\n" +
+                    "Number of suppressions:                " + OString::number(m_nDelete) + "\n" +
+                    "Number of Get's without Index:         " + OString::number(m_nGetSeek) + "\n" +
+                    "Number of Seek for Get without Index:  " + OString::number(m_nAverageSeekCnt) + "\n" +
+                    "Number of Flush calls:                 " + OString::number(m_nFlushCnt) + "\n" +
+                    "Number of flushed objects:             " + OString::number(m_nFlushedObjects) + "\n" +
+                    "Number of Cache expansions:            " + OString::number(m_nIncreaseMax) + "\n" +
+                    "Number of Cache reductions:            " + OString::number(m_nDecreaseMax) + "\n");
 
         OSL_TRACE(sOut.getStr());
     }
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 23956db..0c0ce94 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -2439,11 +2439,7 @@
                 // possibly allow texts??
                 break;
 
-            rtl::OUStringBuffer sTmp;
-            sTmp.append('<');
-            sTmp.append(pCFrm->GetTabBox()->GetName());
-            sTmp.append('>');
-            rFml.Insert( sTmp.makeStringAndClear(), nInsPos );
+            rFml.Insert( "<" + OUString(pCFrm->GetTabBox()->GetName()) + ">", nInsPos );
         }
         if( nW )
         {
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index d7f0d74..8dca8b7 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -172,16 +172,9 @@
     return rtl::OString(aNToABuf, 2);
 }
 
-static rtl::OString GetCSS1Color(const Color& rColor)
+static OString GetCSS1Color(const Color& rColor)
 {
-    rtl::OStringBuffer aStr;
-    aStr.append('#');
-
-    aStr.append(ConvToHex(rColor.GetRed()));
-    aStr.append(ConvToHex(rColor.GetGreen()));
-    aStr.append(ConvToHex(rColor.GetBlue()));
-
-    return aStr.makeStringAndClear();
+    return "#" + ConvToHex(rColor.GetRed()) + ConvToHex(rColor.GetGreen()) + ConvToHex(rColor.GetBlue());
 }
 
 class SwCSS1OutMode
@@ -215,14 +208,14 @@
                                      const sal_Char *pVal,
                                      const String *pSVal )
 {
-    rtl::OStringBuffer sOut;
+    OStringBuffer sOut;
 
     if( bFirstCSS1Rule && (nCSS1OutMode & CSS1_OUTMODE_RULE_ON)!=0 )
     {
         bFirstCSS1Rule = sal_False;
         OutNewLine();
-        sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_style).append(' ')
-            .append(OOO_STRING_SVTOOLS_HTML_O_type).append("=\"text/css\">");
+        sOut.append("<" + OString(OOO_STRING_SVTOOLS_HTML_style) + " " +
+                    OString(OOO_STRING_SVTOOLS_HTML_O_type) + "=\"text/css\">");
         Strm() << sOut.makeStringAndClear().getStr();
         OutNewLine();
         Strm() << '<' << OOO_STRING_SVTOOLS_HTML_comment;
@@ -238,9 +231,8 @@
         case CSS1_OUTMODE_SPAN_TAG1_ON:
             if( bTagOn )
             {
-                sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_span)
-                    .append(' ').append(OOO_STRING_SVTOOLS_HTML_O_style)
-                    .append("=\"");
+                sOut.append("<" + OString(OOO_STRING_SVTOOLS_HTML_span) +
+                            " " + OString(OOO_STRING_SVTOOLS_HTML_O_style) + "=\"");
             }
             else
             {
@@ -252,13 +244,12 @@
         case CSS1_OUTMODE_RULE_ON:
             {
                 OutNewLine();
-                sOut.append(rtl::OUStringToOString(aCSS1Selector, eDestEnc)).append(" { ");
+                sOut.append(OUStringToOString(aCSS1Selector, eDestEnc) + " { ");
             }
             break;
 
         case CSS1_OUTMODE_STYLE_OPT_ON:
-            sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_style)
-                .append("=\"");
+            sOut.append(" " + OString(OOO_STRING_SVTOOLS_HTML_O_style) + "=\"");
             break;
         }
         bFirstCSS1Property = sal_False;
@@ -269,7 +260,7 @@
     }
 
 
-    sOut.append(pProp).append(": ");
+    sOut.append(OString(pProp) + ": ");
     if( nCSS1OutMode & CSS1_OUTMODE_ENCODE )
     {
         // In STYLE-Optionen den String codieren
@@ -286,7 +277,7 @@
         if( pVal )
             sOut.append(pVal);
         else if( pSVal )
-            sOut.append(rtl::OUStringToOString(*pSVal, eDestEnc));
+            sOut.append(OUStringToOString(*pSVal, eDestEnc));
     }
 
     if (sOut.getLength())
@@ -394,7 +385,7 @@
                 {
                     nFac /= 10;
                     nBigFac = nFac;
-                    rOut.append(static_cast<sal_Int32>((nBigVal / nBigFac) % nBig10));
+                    rOut.append(OString::number((nBigVal / nBigFac) % nBig10));
                 }
             }
             bOutLongVal = false;
@@ -437,14 +428,14 @@
 
     if( bOutLongVal )
     {
-        rOut.append(static_cast<sal_Int32>(nLongVal/nFac));
+        rOut.append(OString::number(nLongVal/nFac));
         if( (nLongVal % nFac) != 0 )
         {
             rOut.append('.');
             while( nFac > 1 && (nLongVal % nFac) != 0 )
             {
                 nFac /= 10;
-                rOut.append(static_cast<sal_Int32>((nLongVal / nFac) % 10));
+                rOut.append(OString::number((nLongVal / nFac) % 10));
             }
         }
     }
@@ -471,10 +462,8 @@
             nVal = 1;
     }
 
-    rtl::OStringBuffer sOut;
-    sOut.append(static_cast<sal_Int32>(nVal));
-    sOut.append(sCSS1_UNIT_px);
-    OutCSS1_PropertyAscii(pProp, sOut.makeStringAndClear());
+    OString sOut(OString::number(nVal) + sCSS1_UNIT_px);
+    OutCSS1_PropertyAscii(pProp, sOut);
 }
 
 void SwHTMLWriter::OutCSS1_SfxItemSet( const SfxItemSet& rItemSet,
@@ -880,23 +869,17 @@
             case RES_POOLCOLL_TABLE:
                 if( pPseudo )
                 {
-                    rToken = rtl::OStringBuffer(
-                        RTL_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_tabledata))
-                        .append(' ')
-                        .append(RTL_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_parabreak))
-                        .makeStringAndClear();
+                    rToken = OString(OOO_STRING_SVTOOLS_HTML_tabledata) + " " +
+                             OString(OOO_STRING_SVTOOLS_HTML_parabreak);
                 }
                 else
-                    rToken = rtl::OString(OOO_STRING_SVTOOLS_HTML_parabreak);
+                    rToken = OOO_STRING_SVTOOLS_HTML_parabreak;
                 break;
             case RES_POOLCOLL_TABLE_HDLN:
                 if( pPseudo )
                 {
-                    rToken = rtl::OStringBuffer(
-                        RTL_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_tableheader))
-                        .append(' ')
-                        .append(RTL_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_parabreak))
-                        .makeStringAndClear();
+                    rToken = OString(OOO_STRING_SVTOOLS_HTML_tableheader) + " " +
+                             OString(OOO_STRING_SVTOOLS_HTML_parabreak);
                 }
                 else
                     rToken = rtl::OString(OOO_STRING_SVTOOLS_HTML_parabreak);
@@ -2663,11 +2646,8 @@
             return rWrt;
     }
 
-    rtl::OStringBuffer sHeight;
-    sHeight.append(static_cast<sal_Int32>(nHeight/20));
-    sHeight.append(sCSS1_UNIT_pt);
-    rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_font_size,
-        sHeight.makeStringAndClear());
+    OString sHeight(OString::number(nHeight/20) + OString(sCSS1_UNIT_pt));
+    rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_font_size, sHeight);
 
     return rWrt;
 }
@@ -2730,10 +2710,8 @@
 
         // Breite als n.n pt
         nValue = (nValue + 1) / 2;  // 1/10pt
-        sOut.append(static_cast<sal_Int32>(nValue  / 10));
-        sOut.append('.');
-        sOut.append(static_cast<sal_Int32>(nValue % 10));
-        sOut.append(sCSS1_UNIT_pt);
+        sOut.append(OString::number(nValue  / 10) + "." + OString::number(nValue % 10) +
+                    OString(sCSS1_UNIT_pt));
 
         rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_letter_spacing,
             sOut.makeStringAndClear());
@@ -2914,11 +2892,8 @@
         rHTMLWrt.OutCSS1_UnitProperty( sCSS1_P_line_height, (long)nHeight );
     else if( nPrcHeight )
     {
-        rtl::OStringBuffer sHeight;
-        sHeight.append(static_cast<sal_Int32>(nPrcHeight));
-        sHeight.append('%');
-        rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_line_height,
-            sHeight.makeStringAndClear());
+        OString sHeight(OString(nPrcHeight) + "%");
+        rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_line_height, sHeight);
     }
 
     return rWrt;
@@ -3005,10 +2980,8 @@
     rHWrt.OutCSS1_PropertyAscii( sCSS1_P_float, sCSS1_PV_left );
 
     // Anzahl der Zeilen -> %-Angabe fuer Font-Hoehe!
-    rtl::OStringBuffer sOut;
-    sOut.append(static_cast<sal_Int32>(rDrop.GetLines()*100));
-    sOut.append('%');
-    rHWrt.OutCSS1_PropertyAscii(sCSS1_P_font_size, sOut.makeStringAndClear());
+    OString sOut(OString::number(rDrop.GetLines()*100) + "%");
+    rHWrt.OutCSS1_PropertyAscii(sCSS1_P_font_size, sOut);
 
     // Abstand zum Text = rechter Rand
     sal_uInt16 nDistance = rDrop.GetDistance();
@@ -3062,11 +3035,8 @@
         sal_uInt8 nPrcWidth = rFSItem.GetWidthPercent();
         if( nPrcWidth )
         {
-            rtl::OStringBuffer sOut;
-            sOut.append(static_cast<sal_Int32>(nPrcWidth));
-            sOut.append('%');
-            rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_width,
-                sOut.makeStringAndClear());
+            OString sOut(OString::number(nPrcWidth) + "%");
+            rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_width, sOut);
         }
         else if( nMode & CSS1_FRMSIZE_PIXEL )
         {
@@ -3104,11 +3074,8 @@
             sal_uInt8 nPrcHeight = rFSItem.GetHeightPercent();
             if( nPrcHeight )
             {
-                rtl::OStringBuffer sOut;
-                sOut.append(static_cast<sal_Int32>(nPrcHeight));
-                sOut.append('%');
-                rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_height,
-                    sOut.makeStringAndClear());
+                OString sOut(OString::number(nPrcHeight) + "%");
+                rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_height, sOut);
             }
             else if( nMode & CSS1_FRMSIZE_PIXEL )
             {
@@ -3546,23 +3513,22 @@
 
     sal_Int32 nWidth = pLine->GetWidth();
 
-    rtl::OStringBuffer sOut;
+    OStringBuffer sOut;
     if( Application::GetDefaultDevice() &&
         nWidth <= Application::GetDefaultDevice()->PixelToLogic(
                     Size( 1, 1 ), MapMode( MAP_TWIP) ).Width() )
     {
         // Wenn die Breite kleiner ist als ein Pixel, dann als 1px
         // ausgeben, damit Netscape und IE die Linie auch darstellen.
-        sOut.append(RTL_CONSTASCII_STRINGPARAM("1px"));
+        sOut.append("1px");
     }
     else
     {
         nWidth *= 5;    // 1/100pt
 
         // Breite als n.nn pt
-        sOut.append(static_cast<sal_Int32>(nWidth / 100));
-        sOut.append('.').append(static_cast<sal_Int32>((nWidth/10) % 10)).
-            append(static_cast<sal_Int32>(nWidth % 10)).append(sCSS1_UNIT_pt);
+        sOut.append(OString::number(nWidth / 100) + "." + OString::number((nWidth/10) % 10) +
+                    OString::number(nWidth % 10) + OString(sCSS1_UNIT_pt));
     }
 
     // Linien-Stil: solid oder double
diff --git a/sw/source/ui/envelp/envlop1.cxx b/sw/source/ui/envelp/envlop1.cxx
index ca5f652..6a9a0b6 100644
--- a/sw/source/ui/envelp/envlop1.cxx
+++ b/sw/source/ui/envelp/envlop1.cxx
@@ -250,17 +250,11 @@
 
 IMPL_LINK_NOARG(SwEnvPage, FieldHdl)
 {
-    rtl::OUStringBuffer aStr;
-    aStr.append('<');
-    aStr.append(aDatabaseLB.GetSelectEntry());
-    aStr.append('.');
-    aStr.append(aTableLB.GetSelectEntry());
-    aStr.append('.');
-    aStr.append(aTableLB.GetEntryData(aTableLB.GetSelectEntryPos()) == 0 ? '0' : '1');
-    aStr.append('.');
-    aStr.append(aDBFieldLB.GetSelectEntry());
-    aStr.append('>');
-    aAddrEdit.ReplaceSelected(aStr.makeStringAndClear());
+    OUString aStr("<" + aDatabaseLB.GetSelectEntry() + "." +
+                  aTableLB.GetSelectEntry() + "." +
+                  OUString(aTableLB.GetEntryData(aTableLB.GetSelectEntryPos()) == 0 ? '0' : '1') + "." +
+                  aDBFieldLB.GetSelectEntry() + ">");
+    aAddrEdit.ReplaceSelected(aStr);
     Selection aSel = aAddrEdit.GetSelection();
     aAddrEdit.GrabFocus();
     aAddrEdit.SetSelection(aSel);
diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx
index 726472b..e892988 100644
--- a/sw/source/ui/envelp/label1.cxx
+++ b/sw/source/ui/envelp/label1.cxx
@@ -366,17 +366,11 @@
 
 IMPL_LINK_NOARG(SwLabPage, FieldHdl)
 {
-    rtl::OUStringBuffer aStr;
-    aStr.append('<');
-    aStr.append(aDatabaseLB.GetSelectEntry());
-    aStr.append('.');
-    aStr.append(aTableLB.GetSelectEntry());
-    aStr.append('.');
-    aStr.append(aTableLB.GetEntryData(aTableLB.GetSelectEntryPos()) == 0 ? '0' : '1');
-    aStr.append('.');
-    aStr.append(aDBFieldLB.GetSelectEntry());
-    aStr.append('>');
-    aWritingEdit.ReplaceSelected(aStr.makeStringAndClear());
+    OUString aStr("<" + OUString(aDatabaseLB.GetSelectEntry()) + "." +
+                  OUString(aTableLB.GetSelectEntry()) + "." +
+                  OUString(aTableLB.GetEntryData(aTableLB.GetSelectEntryPos()) == 0 ? "0" : "1") + "." +
+                  aDBFieldLB.GetSelectEntry() + ">");
+    aWritingEdit.ReplaceSelected(aStr);
     Selection aSel = aWritingEdit.GetSelection();
     aWritingEdit.GrabFocus();
     aWritingEdit.SetSelection(aSel);
diff --git a/sw/source/ui/fldui/changedb.cxx b/sw/source/ui/fldui/changedb.cxx
index e4dc8e9..b5bd607 100644
--- a/sw/source/ui/fldui/changedb.cxx
+++ b/sw/source/ui/fldui/changedb.cxx
@@ -196,14 +196,10 @@
     {
         if( m_pUsedDBTLB->GetParent( pEntry ))
         {
-            OUStringBuffer sTmp;
-
-            sTmp.append(m_pUsedDBTLB->GetEntryText( m_pUsedDBTLB->GetParent( pEntry )));
-            sTmp.append(DB_DELIM);
-            sTmp.append(m_pUsedDBTLB->GetEntryText( pEntry ));
-            sTmp.append(DB_DELIM);
-            sTmp.append(OUString::number((int)(sal_uLong)pEntry->GetUserData()));
-            aDBNames.push_back(sTmp.makeStringAndClear());
+            OUString sTmp(m_pUsedDBTLB->GetEntryText( m_pUsedDBTLB->GetParent( pEntry )) +
+                          OUString(DB_DELIM) + m_pUsedDBTLB->GetEntryText( pEntry ) + OUString(DB_DELIM) +
+                          OUString::number((int)(sal_uLong)pEntry->GetUserData()));
+            aDBNames.push_back(sTmp);
         }
         pEntry = m_pUsedDBTLB->NextSelected(pEntry);
     }
diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx
index 9bb6018..6506dfd 100644
--- a/sw/source/ui/uiview/pview.cxx
+++ b/sw/source/ui/uiview/pview.cxx
@@ -423,11 +423,9 @@
     sal_uInt16 nVirtPageNum = mpPgPrevwLayout->GetVirtPageNumByPageNum( nPageNum );
     if( nVirtPageNum && nVirtPageNum != nPageNum )
     {
-        aStatusStr.append( static_cast<sal_Int32>(nVirtPageNum) ).append( ' ' );
+        aStatusStr.append( OUString::number(nVirtPageNum) + " " );
     }
-    aStatusStr.append( static_cast<sal_Int32>(nPageNum) );
-    aStatusStr.append( " / " );
-    aStatusStr.append( static_cast<sal_Int32>(nPageCnt) );
+    aStatusStr.append( OUString::number(nPageNum) + " / " + OUString::number(nPageCnt) );
     return aStatusStr.makeStringAndClear();
 }
 
diff --git a/sw/source/ui/uiview/viewsrch.cxx b/sw/source/ui/uiview/viewsrch.cxx
index 181a148..b6a6d68 100644
--- a/sw/source/ui/uiview/viewsrch.cxx
+++ b/sw/source/ui/uiview/viewsrch.cxx
@@ -426,10 +426,7 @@
 #if OSL_DEBUG_LEVEL > 1
             if(nSlot)
             {
-                rtl::OStringBuffer sStr(RTL_CONSTASCII_STRINGPARAM("nSlot: "));
-                sStr.append(static_cast<sal_Int32>(nSlot));
-                sStr.append(RTL_CONSTASCII_STRINGPARAM(
-                    " wrong Dispatcher (viewsrch.cxx)"));
+                OString sStr("nSlot: " + OString::number(nSlot) + " wrong Dispatcher (viewsrch.cxx)");
                 OSL_FAIL(sStr.getStr());
             }
 #endif
diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx
index 65c0138..9389982 100644
--- a/sw/source/ui/utlui/content.cxx
+++ b/sw/source/ui/utlui/content.cxx
@@ -3091,14 +3091,11 @@
 {
     rtl_TextEncoding eSysCSet = osl_getThreadTextEncoding();
 
-    rtl::OStringBuffer sStrBuf(rtl::OUStringToOString(aUrl, eSysCSet));
-    sStrBuf.append(static_cast<char>(NAVI_BOOKMARK_DELIM));
-    sStrBuf.append(rtl::OUStringToOString(aDescr, eSysCSet));
-    sStrBuf.append(static_cast<char>(NAVI_BOOKMARK_DELIM));
-    sStrBuf.append(static_cast<sal_Int32>(nDefDrag));
-    sStrBuf.append(static_cast<char>(NAVI_BOOKMARK_DELIM));
-    sStrBuf.append(static_cast<sal_Int32>(nDocSh));
-    rData.CopyByteString(SOT_FORMATSTR_ID_SONLK, sStrBuf.makeStringAndClear());
+    OString sStrBuf(OUStringToOString(aUrl, eSysCSet) + OString(NAVI_BOOKMARK_DELIM) +
+                    OUStringToOString(aDescr, eSysCSet) + OString(NAVI_BOOKMARK_DELIM) +
+                    OString::number(nDefDrag) + OString(NAVI_BOOKMARK_DELIM) +
+                    OString(nDocSh));
+    rData.CopyByteString(SOT_FORMATSTR_ID_SONLK, sStrBuf);
 }
 
 sal_Bool NaviContentBookmark::Paste( TransferableDataHelper& rData )
diff --git a/sw/source/ui/wrtsh/wrtundo.cxx b/sw/source/ui/wrtsh/wrtundo.cxx
index 7760525..88da0d6 100644
--- a/sw/source/ui/wrtsh/wrtundo.cxx
+++ b/sw/source/ui/wrtsh/wrtundo.cxx
@@ -114,10 +114,9 @@
     default:;//prevent warning
     }
 
-    ::rtl::OUStringBuffer buf = ::rtl::OUStringBuffer( String( SvtResId( nResStr ) ) );
-    buf.append(aUndoStr);
+    OUStringBuffer buf = ::rtl::OUStringBuffer( String( SvtResId( nResStr ) ) );
 
-    return buf.makeStringAndClear();
+    return buf.makeStringAndClear() + aUndoStr;
 }
 
 sal_uInt16 SwWrtShell::GetDoStrings( DoType eDoType, SfxStringListItem& rStrs ) const
@@ -134,12 +133,11 @@
     default:;//prevent warning
     }
 
-    ::rtl::OUStringBuffer buf;
+    OUStringBuffer buf;
     for (size_t i = 0; i < comments.size(); ++i)
     {
         OSL_ENSURE(!comments[i].isEmpty(), "no Undo/Redo Text set");
-        buf.append(comments[i]);
-        buf.append(sal_Unicode('\n'));
+        buf.append(comments[i] + "\n");
     }
     rStrs.SetString(buf.makeStringAndClear());
     return static_cast<sal_uInt16>(comments.size());
@@ -156,8 +154,7 @@
         return str;
     }
 
-    ::rtl::OUStringBuffer buf( String(SvtResId(STR_REPEAT)) );
-    buf.append(str);
+    ::rtl::OUStringBuffer buf( String(SvtResId(STR_REPEAT)) + str);
     return buf.makeStringAndClear();
 }
 

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

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