Hi,
I have submitted a patch for review:
    https://gerrit.libreoffice.org/1515
To pull it, you can do:
    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/15/1515/1
fdo#57950: Fix some chained appends in basic
Change-Id: Icac8ec992d993748a063aa95cc6f58c24fa87444
Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
---
M basic/source/basmgr/basicmanagerrepository.cxx
M basic/source/classes/sb.cxx
M basic/source/uno/namecont.cxx
M basic/source/uno/scriptcont.cxx
4 files changed, 18 insertions(+), 25 deletions(-)
diff --git a/basic/source/basmgr/basicmanagerrepository.cxx 
b/basic/source/basmgr/basicmanagerrepository.cxx
index 2d281dc..8b86596 100644
--- a/basic/source/basmgr/basicmanagerrepository.cxx
+++ b/basic/source/basmgr/basicmanagerrepository.cxx
@@ -308,11 +308,9 @@
         OUString aFileName( aAppBasic.getName() );
         aAppBasic = INetURLObject( aAppBasicDir.getToken(1, ';') );
         DBG_ASSERT(aAppBasic.GetProtocol() != INET_PROT_NOT_VALID,
-            OStringBuffer("Invalid URL: \"").
-            append(OUStringToOString(aAppBasicDir,
-                osl_getThreadTextEncoding())).
-            append('"').getStr()
-        );
+            OString("Invalid URL: \"" +
+                    OUStringToOString(aAppBasicDir, osl_getThreadTextEncoding()) +
+                    "\""));
         aAppBasic.insertName( aFileName );
         pBasicManager->SetStorageName( aAppBasic.PathToFileName() );
 
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 48a2c66..12cb5da 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -1663,9 +1663,9 @@
     }
     else if( nOldID != 0 )
     {
-        OUStringBuffer aStdMsg;
-        aStdMsg.append("Fehler ").append(static_cast<sal_Int32>(nOldID)).append(": Kein Fehlertext 
verfuegbar!");
-        GetSbData()->aErrMsg = aStdMsg.makeStringAndClear();
+        OUString aStdMsg = "Fehler " + OUString::valueOf(static_cast<sal_Int32>(nOldID)) +
+                           ": Kein Fehlertext verfuegbar!";
+        GetSbData()->aErrMsg = aStdMsg;
     }
     else
     {
@@ -1741,10 +1741,9 @@
         // like vba ( adds an error number etc )
         if ( SbiRuntime::isVBAEnabled() && ( code == SbERR_BASIC_COMPAT ) )
         {
-            OUStringBuffer aTmp;
-            aTmp.append('\'').append(SbxErrObject::getUnoErrObject()->getNumber())
-                .append("\'\n").append(!GetSbData()->aErrMsg.isEmpty() ? GetSbData()->aErrMsg : 
rMsg);
-            code = (sal_uIntPtr)*new StringErrorInfo( code, aTmp.makeStringAndClear() );
+            OUString aTmp = "\'" + OUString::valueOf(SbxErrObject::getUnoErrObject()->getNumber()) 
+
+                            "\'\n" + OUString(!GetSbData()->aErrMsg.isEmpty() ? 
GetSbData()->aErrMsg : rMsg);
+            code = (sal_uIntPtr)*new StringErrorInfo( code, aTmp );
         }
         else
         {
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 92b38c6..2a61123 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -237,9 +237,7 @@
     NameContainerNameMap::iterator aIt = mHashMap.find( aName );
     if( aIt == mHashMap.end() )
     {
-        OUString sMessage = OUStringBuffer().append('"')
-            .append(aName).append("\" not found")
-            .makeStringAndClear();
+        OUString sMessage = "\"" + aName + "\" not found";
         throw NoSuchElementException(sMessage, uno::Reference< uno::XInterface >());
     }
 
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index ad58499..a7f870c 100644
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -678,11 +678,10 @@
                 if( !isLibraryElementValid( pLib->getByName( aElementName ) ) )
                 {
                     #if OSL_DEBUG_LEVEL > 0
-                    OStringBuffer aMessage;
-                    aMessage.append( "invalid library element '" );
-                    aMessage.append( OUStringToOString( aElementName, osl_getThreadTextEncoding() 
) );
-                    aMessage.append( "'." );
-                    OSL_FAIL( aMessage.makeStringAndClear().getStr() );
+                    OString aMessage = "invalid library element '" +
+                                        OUStringToOString( aElementName, 
osl_getThreadTextEncoding() ) +
+                                        "'.";
+                    OSL_FAIL( aMessage );
                     #endif
                     continue;
                 }
@@ -767,11 +766,10 @@
                 if( !isLibraryElementValid( pLib->getByName( aElementName ) ) )
                 {
                     #if OSL_DEBUG_LEVEL > 0
-                    OStringBuffer aMessage;
-                    aMessage.append( "invalid library element '" );
-                    aMessage.append( OUStringToOString( aElementName, osl_getThreadTextEncoding() 
) );
-                    aMessage.append( "'." );
-                    OSL_FAIL( aMessage.makeStringAndClear().getStr() );
+                    OString aMessage = "invalid library element '" +
+                                       OUStringToOString( aElementName, 
osl_getThreadTextEncoding() ) +
+                                       "'.";
+                    OSL_FAIL( aMessage );
                     #endif
                     continue;
                 }
-- 
To view, visit https://gerrit.libreoffice.org/1515
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icac8ec992d993748a063aa95cc6f58c24fa87444
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Marcos Souza <marcos.souza.org@gmail.com>
Context
- [PATCH]  fdo#57950: Fix some chained appends in basic · Marcos Souza (via Code Review)
 
   
 
  Privacy Policy |
  
Impressum (Legal Info) |
  
Copyright information: Unless otherwise specified, all text and images
  on this website are licensed under the
  
Creative Commons Attribution-Share Alike 3.0 License.
  This does not include the source code of LibreOffice, which is
  licensed under the Mozilla Public License (
MPLv2).
  "LibreOffice" and "The Document Foundation" are
  registered trademarks of their corresponding registered owners or are
  in actual use as trademarks in one or more countries. Their respective
  logos and icons are also subject to international copyright laws. Use
  thereof is explained in our 
trademark policy.