[Libreoffice-commits] .: basic/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Jan 3 09:08:00 PST 2013


 basic/source/basmgr/basicmanagerrepository.cxx |    8 +++-----
 basic/source/classes/sb.cxx                    |   13 ++++++-------
 basic/source/uno/namecont.cxx                  |    4 +---
 basic/source/uno/scriptcont.cxx                |   18 ++++++++----------
 4 files changed, 18 insertions(+), 25 deletions(-)

New commits:
commit 695f4a18e6e538f8d6080f486695e4f58f8bd574
Author: Marcos Paulo de Souza <marcos.souza.org at gmail.com>
Date:   Sun Dec 30 13:47:18 2012 -0200

    fdo#57950: Fix some chained appends in basic
    
    Change-Id: Icac8ec992d993748a063aa95cc6f58c24fa87444
    Signed-off-by: Marcos Paulo de Souza <marcos.souza.org at gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/1515
    Reviewed-by: Luboš Luňák <l.lunak at suse.cz>
    Tested-by: Luboš Luňák <l.lunak at suse.cz>

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 @@ namespace basic
         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 @@ void StarBASIC::MakeErrorText( SbError nId, const OUString& aMsg )
     }
     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 @@ sal_Bool StarBASIC::RTError( SbError code, const OUString& rMsg, sal_Int32 l, sa
         // 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 @@ void NameContainer::removeByName( const OUString& aName )
     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 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib,
                 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 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib,
                 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;
                 }


More information about the Libreoffice-commits mailing list