[Libreoffice-commits] core.git: dbaccess/qa dbaccess/source

Jelle van der Waa jelle at vdwaa.nl
Sun Aug 18 23:05:03 PDT 2013


 dbaccess/qa/extras/macros-test.cxx                     |    6 -----
 dbaccess/source/core/recovery/subcomponentrecovery.cxx |    5 ----
 dbaccess/source/ext/macromigration/migrationengine.cxx |   19 ++---------------
 dbaccess/source/ext/macromigration/migrationlog.cxx    |   14 +++---------
 dbaccess/source/sdbtools/connection/objectnames.cxx    |    6 -----
 dbaccess/source/ui/misc/WCopyTable.cxx                 |    3 --
 6 files changed, 11 insertions(+), 42 deletions(-)

New commits:
commit 9a1aca007fd06f3f8223ee02a79e44099d778b51
Author: Jelle van der Waa <jelle at vdwaa.nl>
Date:   Sat Aug 17 22:14:22 2013 +0200

    fdo#57950: Remove some chained appends in dbaccess
    
    Change-Id: If93b4a11ac15ede2b08ef42bb2fa4670f0d4cd24
    Reviewed-on: https://gerrit.libreoffice.org/5481
    Reviewed-by: Andrzej J.R. Hunt <andrzej at ahunt.org>
    Tested-by: Andrzej J.R. Hunt <andrzej at ahunt.org>

diff --git a/dbaccess/qa/extras/macros-test.cxx b/dbaccess/qa/extras/macros-test.cxx
index cc0a437..bcff534 100644
--- a/dbaccess/qa/extras/macros-test.cxx
+++ b/dbaccess/qa/extras/macros-test.cxx
@@ -51,11 +51,7 @@ private:
 
 void DBAccessTest::createFileURL(const OUString& aFileBase, const OUString& aFileExtension, OUString& rFilePath)
 {
-    OUString aSep("/");
-    OUStringBuffer aBuffer( getSrcRootURL() );
-    aBuffer.append(m_aBaseString);
-    aBuffer.append(aSep).append(aFileBase).append(aFileExtension);
-    rFilePath = aBuffer.makeStringAndClear();
+    rFilePath = getSrcRootURL() + m_aBaseString + "/" + aFileBase + aFileExtension;
 }
 
 DBAccessTest::DBAccessTest()
diff --git a/dbaccess/source/core/recovery/subcomponentrecovery.cxx b/dbaccess/source/core/recovery/subcomponentrecovery.cxx
index af11780..0981787 100644
--- a/dbaccess/source/core/recovery/subcomponentrecovery.cxx
+++ b/dbaccess/source/core/recovery/subcomponentrecovery.cxx
@@ -218,10 +218,7 @@ namespace dbaccess
     private:
         OUString impl_prefix( const ::xmloff::token::XMLTokenEnum i_eToken )
         {
-            OUStringBuffer aQualifiedName( m_aNamespace );
-            aQualifiedName.append( sal_Unicode( ':' ) );
-            aQualifiedName.append( ::xmloff::token::GetXMLToken( i_eToken ) );
-            return aQualifiedName.makeStringAndClear();
+            return m_aNamespace + ":" + ::xmloff::token::GetXMLToken( i_eToken );
         }
 
     private:
diff --git a/dbaccess/source/ext/macromigration/migrationengine.cxx b/dbaccess/source/ext/macromigration/migrationengine.cxx
index c0ec435..8d0b5f1 100644
--- a/dbaccess/source/ext/macromigration/migrationengine.cxx
+++ b/dbaccess/source/ext/macromigration/migrationengine.cxx
@@ -1253,12 +1253,7 @@ namespace dbmm
                 }
                 sBaseName = aReplacement.makeStringAndClear();
 
-                OUStringBuffer aNewLibNameAttempt;
-                aNewLibNameAttempt.append( sPrefix );
-                aNewLibNameAttempt.append( sBaseName );
-                aNewLibNameAttempt.appendAscii( "_" );
-                aNewLibNameAttempt.append( _rSourceLibName );
-                OUString sTargetName( aNewLibNameAttempt.makeStringAndClear() );
+                OUString sTargetName( sPrefix + sBaseName + "_" + _rSourceLibName );
                 if ( !_rxTargetContainer->hasByName( sTargetName ) )
                     return sTargetName;
             }
@@ -1267,12 +1262,7 @@ namespace dbmm
             // (The latter is valid, since there can be multiple sub documents with the same base name,
             // in different levels in the hierarchy.)
             // In this case, just use the umambiguous sub document number.
-            OUStringBuffer aNewLibName;
-            aNewLibName.append( sPrefix );
-            aNewLibName.append( OUString::valueOf( sal_Int64( _rDocument.nNumber ) ) );
-            aNewLibName.appendAscii( "_" );
-            aNewLibName.append( _rSourceLibName );
-            return aNewLibName.makeStringAndClear();
+            return sPrefix + OUString::valueOf( sal_Int64( _rDocument.nNumber ) ) + "_" + _rSourceLibName;
         }
     }
 
@@ -1680,10 +1670,7 @@ namespace dbmm
             OSL_ENSURE( sLibrary != sNewLibName,
                 "MigrationEngine_Impl::impl_adjustScriptLibrary_nothrow: a library which has not been migrated?" );
 
-            OUStringBuffer aNewLocation;
-            aNewLocation.append( sNewLibName );
-            aNewLocation.append( sScriptName.copy( nLibModuleSeparator ) );
-            xUri->setName( aNewLocation.makeStringAndClear() );
+            xUri->setName( sNewLibName + sScriptName.copy( nLibModuleSeparator ) );
 
             // update the new script URL
             _inout_rScriptCode = xUri->getUriReference();
diff --git a/dbaccess/source/ext/macromigration/migrationlog.cxx b/dbaccess/source/ext/macromigration/migrationlog.cxx
index cee6065..f4c1ac9 100644
--- a/dbaccess/source/ext/macromigration/migrationlog.cxx
+++ b/dbaccess/source/ext/macromigration/migrationlog.cxx
@@ -430,11 +430,8 @@ namespace dbmm
             OUString sBackedUp( MacroMigrationResId( STR_SAVED_COPY_TO ) );
             sBackedUp = sBackedUp.replaceAll( "$location$", m_pData->sBackupLocation );
 
-            aBuffer.appendAscii( "=== " );
-            aBuffer.append     ( OUString( MacroMigrationResId( STR_DATABASE_DOCUMENT ) ) );
-            aBuffer.appendAscii( " ===\n" );
-            aBuffer.append     ( sBackedUp );
-            aBuffer.appendAscii( "\n\n" );
+            aBuffer.append( "=== " + OUString( MacroMigrationResId( STR_DATABASE_DOCUMENT ) )
+                    + " ===\n" + sBackedUp + "\n\n");
         }
 
         if ( !m_pData->aFailures.empty() )
@@ -459,9 +456,7 @@ namespace dbmm
                 OUString sDocTitle( MacroMigrationResId( rDoc.eType == eForm ? STR_FORM : STR_REPORT ) );
                 sDocTitle = sDocTitle.replaceAll( "$name$", rDoc.sName );
 
-                aBuffer.appendAscii( "=== " );
-                aBuffer.append     ( sDocTitle );
-                aBuffer.appendAscii( " ===\n" );
+                aBuffer.append( "=== " + sDocTitle + " ===\n" );
 
                 for (   ::std::vector< LibraryEntry >::const_iterator lib = rDoc.aMovedLibraries.begin();
                         lib != rDoc.aMovedLibraries.end();
@@ -473,8 +468,7 @@ namespace dbmm
                     sMovedLib = sMovedLib.replaceAll( "$old$", lib->sOldName );
                     sMovedLib = sMovedLib.replaceAll( "$new$", lib->sNewName );
 
-                    aBuffer.append( sMovedLib );
-                    aBuffer.append( sal_Unicode( '\n' ) );
+                    aBuffer.append( sMovedLib + "\n" );
                 }
 
                 aBuffer.append( sal_Unicode( '\n' ) );
diff --git a/dbaccess/source/sdbtools/connection/objectnames.cxx b/dbaccess/source/sdbtools/connection/objectnames.cxx
index add3509..2f3318c 100644
--- a/dbaccess/source/sdbtools/connection/objectnames.cxx
+++ b/dbaccess/source/sdbtools/connection/objectnames.cxx
@@ -428,11 +428,7 @@ namespace sdbtools
         sal_Int32 i = 1;
         while ( !pNameCheck->validateName( sName ) )
         {
-            OUStringBuffer aNameBuffer;
-            aNameBuffer.append( sBaseName );
-            aNameBuffer.appendAscii( " " );
-            aNameBuffer.append( (sal_Int32)++i );
-            sName = aNameBuffer.makeStringAndClear();
+            sName = sBaseName + " " + OUString::number(++i);
         }
 
         return sName;
diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx
index c00dc88..f278445 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -261,8 +261,7 @@ OUString ObjectCopySource::getSelectStatement() const
                 aSQL.appendAscii( ", " );
         }
 
-        aSQL.appendAscii( "FROM " );
-        aSQL.append( ::dbtools::composeTableNameForSelect( m_xConnection, m_xObject ) );
+        aSQL.append( "FROM " + ::dbtools::composeTableNameForSelect( m_xConnection, m_xObject ) );
 
         sSelectStatement = aSQL.makeStringAndClear();
     }


More information about the Libreoffice-commits mailing list