[Libreoffice-commits] core.git: avmedia/source basic/source bridges/source connectivity/source cppu/source cui/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Nov 16 13:03:55 UTC 2018


 avmedia/source/viewer/mediawindow.cxx                           |   16 +--
 basic/source/sbx/sbxform.cxx                                    |    8 -
 basic/source/sbx/sbxscan.cxx                                    |    8 +
 bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx            |    3 
 bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx            |   12 +-
 connectivity/source/drivers/calc/CTable.cxx                     |    2 
 connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx |   44 +++++++---
 connectivity/source/drivers/odbc/OResultSet.cxx                 |    6 -
 connectivity/source/drivers/writer/WTable.cxx                   |    2 
 connectivity/source/parse/PColumn.cxx                           |    2 
 connectivity/source/parse/sqliterator.cxx                       |    2 
 cppu/source/uno/lbmap.cxx                                       |   15 ++-
 cui/source/dialogs/cuigaldlg.cxx                                |    6 -
 13 files changed, 81 insertions(+), 45 deletions(-)

New commits:
commit 12e460d99988a66179381fe40185978450ea0ea0
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Nov 16 14:04:02 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Nov 16 14:03:25 2018 +0100

    loplugin:buriedassign in avmedia..cui
    
    Change-Id: Id44f1e98a3aac2c417f8030de603175bf68f0dfe
    Reviewed-on: https://gerrit.libreoffice.org/63467
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/avmedia/source/viewer/mediawindow.cxx b/avmedia/source/viewer/mediawindow.cxx
index 861c7d377c93..d778c72e7c31 100644
--- a/avmedia/source/viewer/mediawindow.cxx
+++ b/avmedia/source/viewer/mediawindow.cxx
@@ -219,7 +219,7 @@ bool MediaWindow::executeMediaURLDialog(weld::Window* pParent, OUString& rURL, b
     static const char               aWildcard[] = "*.";
     FilterNameVector                aFilters;
     static const char               aSeparator[] = ";";
-    OUString                        aAllTypes;
+    OUStringBuffer                  aAllTypes;
 
     aDlg.SetTitle( AvmResId( o_pbLink != nullptr
                 ? AVMEDIA_STR_INSERTMEDIA_DLG : AVMEDIA_STR_OPENMEDIA_DLG ) );
@@ -231,29 +231,29 @@ bool MediaWindow::executeMediaURLDialog(weld::Window* pParent, OUString& rURL, b
         for( sal_Int32 nIndex = 0; nIndex >= 0; )
         {
             if( !aAllTypes.isEmpty() )
-                aAllTypes += aSeparator;
+                aAllTypes.append(aSeparator);
 
-            ( aAllTypes += aWildcard ) += aFilters[ i ].second.getToken( 0, ';', nIndex );
+            aAllTypes.append(aWildcard).append(aFilters[ i ].second.getToken( 0, ';', nIndex ));
         }
     }
 
     // add filter for all media types
-    aDlg.AddFilter( AvmResId( AVMEDIA_STR_ALL_MEDIAFILES ), aAllTypes );
+    aDlg.AddFilter( AvmResId( AVMEDIA_STR_ALL_MEDIAFILES ), aAllTypes.makeStringAndClear() );
 
     for( FilterNameVector::size_type i = 0; i < aFilters.size(); ++i )
     {
-        OUString aTypes;
+        OUStringBuffer aTypes;
 
         for( sal_Int32 nIndex = 0; nIndex >= 0; )
         {
             if( !aTypes.isEmpty() )
-                aTypes += aSeparator;
+                aTypes.append(aSeparator);
 
-            ( aTypes += aWildcard ) += aFilters[ i ].second.getToken( 0, ';', nIndex );
+            aTypes.append(aWildcard).append(aFilters[ i ].second.getToken( 0, ';', nIndex ));
         }
 
         // add single filters
-        aDlg.AddFilter( aFilters[ i ].first, aTypes );
+        aDlg.AddFilter( aFilters[ i ].first, aTypes.makeStringAndClear() );
     }
 
     // add filter for all types
diff --git a/basic/source/sbx/sbxform.cxx b/basic/source/sbx/sbxform.cxx
index aa1bbb0a276f..45a88b556546 100644
--- a/basic/source/sbx/sbxform.cxx
+++ b/basic/source/sbx/sbxform.cxx
@@ -625,8 +625,8 @@ void SbxBasicFormater::ScanFormatString( double dNumber,
                     {
                         for( short j = nMaxDigit; j > nDigitPos; j-- )
                         {
-                            short nTempDigit;
-                            AppendDigit( sReturnStrg, nTempDigit = GetDigitAtPosScan( j, bFoundFirstDigit ) );
+                            short nTempDigit = GetDigitAtPosScan( j, bFoundFirstDigit );
+                            AppendDigit( sReturnStrg, nTempDigit );
                             if( nTempDigit != NO_DIGIT_ )
                             {
                                 bFirstDigit = false;
@@ -654,8 +654,8 @@ void SbxBasicFormater::ScanFormatString( double dNumber,
                 }
                 else
                 {
-                    short nTempDigit;
-                    AppendDigit( sReturnStrg, nTempDigit = GetDigitAtPosScan( nDigitPos, bFoundFirstDigit ) );
+                    short nTempDigit = GetDigitAtPosScan( nDigitPos, bFoundFirstDigit ) ;
+                    AppendDigit( sReturnStrg, nTempDigit );
 
                     if( nTempDigit != NO_DIGIT_ )
                     {
diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx
index 9b1e47827b03..d0d7cd52326e 100644
--- a/basic/source/sbx/sbxscan.cxx
+++ b/basic/source/sbx/sbxscan.cxx
@@ -408,7 +408,13 @@ static void myftoa( double nNum, char * pBuf, short nPrec, short nExpWidth,
         if( nExpWidth < 3 ) nExpWidth = 3;
         nExpWidth -= 2;
         *pBuf++ = 'E';
-        *pBuf++ =( nExp < 0 ) ?( (nExp = -nExp ), '-' ) : '+';
+        if ( nExp < 0 )
+        {
+            nExp = -nExp;
+            *pBuf++ = '-';
+        }
+        else
+            *pBuf++ = '+';
         while( nExpWidth > 3 )
         {
             *pBuf++ = '0';
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx
index 6e860ea257ac..1f47f4c9b2dc 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx
@@ -160,7 +160,8 @@ static typelib_TypeClass cpp2uno_call(
             }
             else if ( bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr ) ) // is in/inout
             {
-                uno_copyAndConvertData( pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize ),
+                pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize );
+                uno_copyAndConvertData( pUnoArgs[nPos],
                                         pCppStack, pParamTypeDescr,
                                         pThis->getBridge()->getCpp2Uno() );
                 pTempIndices[nTempIndices] = nPos; // has to be reconverted
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
index 68f868238e92..a56f9f255d26 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
@@ -160,7 +160,8 @@ static void cpp_call(
 
         if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ))
         {
-            uno_copyAndConvertData( pCppArgs[nPos] = alloca( 8 ), pUnoArgs[nPos], pParamTypeDescr,
+            pCppArgs[nPos] = alloca( 8 );
+            uno_copyAndConvertData( pCppArgs[nPos], pUnoArgs[nPos], pParamTypeDescr,
                                     pThis->getBridge()->getUno2Cpp() );
 
             switch (pParamTypeDescr->eTypeClass)
@@ -199,9 +200,8 @@ static void cpp_call(
             if (! rParam.bIn) // is pure out
             {
                 // cpp out is constructed mem, uno out is not!
-                uno_constructData(
-                    pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ),
-                    pParamTypeDescr );
+                pCppArgs[nPos] = alloca( pParamTypeDescr->nSize );
+                uno_constructData( pCppArgs[nPos], pParamTypeDescr );
                 pTempIndices[nTempIndices] = nPos; // default constructed for cpp call
                 // will be released at reconversion
                 ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
@@ -209,9 +209,9 @@ static void cpp_call(
             // is in/inout
             else if (bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr ))
             {
+                pCppArgs[nPos] = alloca( pParamTypeDescr->nSize );
                 uno_copyAndConvertData(
-                    pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ),
-                    pUnoArgs[nPos], pParamTypeDescr, pThis->getBridge()->getUno2Cpp() );
+                    pCppArgs[nPos], pUnoArgs[nPos], pParamTypeDescr, pThis->getBridge()->getUno2Cpp() );
 
                 pTempIndices[nTempIndices] = nPos; // has to be reconverted
                 // will be released at reconversion
diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx
index 37920acc88ba..9aea3b9fa549 100644
--- a/connectivity/source/drivers/calc/CTable.cxx
+++ b/connectivity/source/drivers/calc/CTable.cxx
@@ -487,7 +487,7 @@ void OCalcTable::fillColumns()
         sal_Int32 nExprCnt = 0;
         while(aFind != m_aColumns->get().end())
         {
-            (aAlias = aColumnName) += OUString::number(++nExprCnt);
+            aAlias = aColumnName + OUString::number(++nExprCnt);
             aFind = connectivity::find(m_aColumns->get().begin(),m_aColumns->get().end(),aAlias,aCase);
         }
 
diff --git a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx
index 215b75577c25..e68a0290e893 100644
--- a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx
+++ b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx
@@ -1151,13 +1151,32 @@ void ODatabaseMetaDataResultSet::openForeignKeys( const Any& catalog, const OUSt
     if ( catalog2.hasValue() )
         aFKQ = OUStringToOString(comphelper::getString(catalog2),m_nTextEncoding);
 
-    const char  *pPKQ = catalog.hasValue() && !aPKQ.isEmpty() ? aPKQ.getStr()  : nullptr,
-                *pPKO = schema && !schema->isEmpty() ? (aPKO = OUStringToOString(*schema,m_nTextEncoding)).getStr() : nullptr,
-                *pPKN = table   ? (aPKN = OUStringToOString(*table,m_nTextEncoding)).getStr(): nullptr,
-                *pFKQ = catalog2.hasValue() && !aFKQ.isEmpty() ? aFKQ.getStr() : nullptr,
-                *pFKO = schema2 && !schema2->isEmpty() ? (aFKO = OUStringToOString(*schema2,m_nTextEncoding)).getStr() : nullptr,
-                *pFKN = table2  ? (aFKN = OUStringToOString(*table2,m_nTextEncoding)).getStr() : nullptr;
-
+    const char *pPKQ = catalog.hasValue() && !aPKQ.isEmpty() ? aPKQ.getStr()  : nullptr;
+    const char *pPKO = nullptr;
+    if (schema && !schema->isEmpty())
+    {
+        aPKO = OUStringToOString(*schema,m_nTextEncoding);
+        pPKO = aPKO.getStr();
+    }
+    const char *pPKN = nullptr;
+    if (table)
+    {
+        aPKN = OUStringToOString(*table,m_nTextEncoding);
+        pPKN = aPKN.getStr();
+    }
+    const char *pFKQ = catalog2.hasValue() && !aFKQ.isEmpty() ? aFKQ.getStr() : nullptr;
+    const char *pFKO = nullptr;
+    if (schema2 && !schema2->isEmpty())
+    {
+        aFKO = OUStringToOString(*schema2,m_nTextEncoding);
+        pFKO = aFKO.getStr();
+    }
+    const char *pFKN = nullptr;
+    if (table2)
+    {
+        aFKN = OUStringToOString(*table2,m_nTextEncoding);
+        pFKN = aFKN.getStr();
+    }
 
     SQLRETURN nRetcode = N3SQLForeignKeys(m_aStatementHandle,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
@@ -1199,10 +1218,11 @@ void ODatabaseMetaDataResultSet::openPrimaryKeys(const Any& catalog, const OUStr
     if ( catalog.hasValue() )
         aPKQ = OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
     aPKO = OUStringToOString(schema,m_nTextEncoding);
+    aPKN = OUStringToOString(table,m_nTextEncoding);
 
     const char  *pPKQ = catalog.hasValue() && !aPKQ.isEmpty() ? aPKQ.getStr()  : nullptr,
                 *pPKO = pSchemaPat && !pSchemaPat->isEmpty() && !aPKO.isEmpty() ? aPKO.getStr() : nullptr,
-                *pPKN = (aPKN = OUStringToOString(table,m_nTextEncoding)).getStr();
+                *pPKN = aPKN.getStr();
 
 
     SQLRETURN nRetcode = N3SQLPrimaryKeys(m_aStatementHandle,
@@ -1228,11 +1248,11 @@ void ODatabaseMetaDataResultSet::openTablePrivileges(const Any& catalog, const O
     if ( catalog.hasValue() )
         aPKQ = OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
     aPKO = OUStringToOString(schemaPattern,m_nTextEncoding);
+    aPKN = OUStringToOString(tableNamePattern,m_nTextEncoding);
 
     const char  *pPKQ = catalog.hasValue() && !aPKQ.isEmpty() ? aPKQ.getStr()  : nullptr,
                 *pPKO = pSchemaPat && !pSchemaPat->isEmpty() && !aPKO.isEmpty() ? aPKO.getStr() : nullptr,
-                *pPKN = (aPKN = OUStringToOString(tableNamePattern,m_nTextEncoding)).getStr();
-
+                *pPKN = aPKN.getStr();
 
     SQLRETURN nRetcode = N3SQLTablePrivileges(m_aStatementHandle,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
@@ -1257,11 +1277,11 @@ void ODatabaseMetaDataResultSet::openIndexInfo( const Any& catalog, const OUStri
     if ( catalog.hasValue() )
         aPKQ = OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
     aPKO = OUStringToOString(schema,m_nTextEncoding);
+    aPKN = OUStringToOString(table,m_nTextEncoding);
 
     const char  *pPKQ = catalog.hasValue() && !aPKQ.isEmpty() ? aPKQ.getStr()  : nullptr,
                 *pPKO = pSchemaPat && !pSchemaPat->isEmpty() && !aPKO.isEmpty() ? aPKO.getStr() : nullptr,
-                *pPKN = (aPKN = OUStringToOString(table,m_nTextEncoding)).getStr();
-
+                *pPKN = aPKN.getStr();
 
     SQLRETURN nRetcode = N3SQLStatistics(m_aStatementHandle,
                             reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
diff --git a/connectivity/source/drivers/odbc/OResultSet.cxx b/connectivity/source/drivers/odbc/OResultSet.cxx
index 0f77f92c3a00..4c5de705124b 100644
--- a/connectivity/source/drivers/odbc/OResultSet.cxx
+++ b/connectivity/source/drivers/odbc/OResultSet.cxx
@@ -915,14 +915,16 @@ void SAL_CALL OResultSet::updateRow(  )
                                 &nRealLen
                                 );
             OTools::ThrowException(m_pStatement->getOwnConnection(),nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
-            fillNeededData(nRet = N3SQLBulkOperations(m_aStatementHandle, SQL_UPDATE_BY_BOOKMARK));
+            nRet = N3SQLBulkOperations(m_aStatementHandle, SQL_UPDATE_BY_BOOKMARK);
+            fillNeededData(nRet);
             // the driver should not have touched this
             // (neither the contents of aBookmark FWIW)
             assert(nRealLen == aBookmark.getLength());
         }
         else
         {
-            fillNeededData(nRet = N3SQLSetPos(m_aStatementHandle,1,SQL_UPDATE,SQL_LOCK_NO_CHANGE));
+            nRet = N3SQLSetPos(m_aStatementHandle,1,SQL_UPDATE,SQL_LOCK_NO_CHANGE);
+            fillNeededData(nRet);
         }
         OTools::ThrowException(m_pStatement->getOwnConnection(),nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
         // unbind all columns so we can fetch all columns again with SQLGetData
diff --git a/connectivity/source/drivers/writer/WTable.cxx b/connectivity/source/drivers/writer/WTable.cxx
index cad61b502730..91842be9e88d 100644
--- a/connectivity/source/drivers/writer/WTable.cxx
+++ b/connectivity/source/drivers/writer/WTable.cxx
@@ -164,7 +164,7 @@ void OWriterTable::fillColumns()
         sal_Int32 nExprCnt = 0;
         while (aFind != m_aColumns->get().end())
         {
-            (aAlias = aColumnName) += OUString::number(++nExprCnt);
+            aAlias = aColumnName + OUString::number(++nExprCnt);
             aFind = connectivity::find(m_aColumns->get().begin(), m_aColumns->get().end(), aAlias,
                                        aCase);
         }
diff --git a/connectivity/source/parse/PColumn.cxx b/connectivity/source/parse/PColumn.cxx
index db3f12d11eec..0e08f785ab26 100644
--- a/connectivity/source/parse/PColumn.cxx
+++ b/connectivity/source/parse/PColumn.cxx
@@ -136,7 +136,7 @@ OParseColumn* OParseColumn::createColumnForResultSet( const Reference< XResultSe
         sal_Int32 searchIndex=1;
         while(_rColumns.find(sAlias) != _rColumns.end())
         {
-            (sAlias = sLabel) += OUString::number(searchIndex++);
+            sAlias = sLabel + OUString::number(searchIndex++);
         }
         sLabel = sAlias;
     }
diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx
index 0f7170143cad..872750c3cc80 100644
--- a/connectivity/source/parse/sqliterator.cxx
+++ b/connectivity/source/parse/sqliterator.cxx
@@ -1737,7 +1737,7 @@ OUString OSQLParseTreeIterator::getUniqueColumnName(const OUString & rColumnName
     sal_Int32 i=1;
     while(aIter != m_aSelectColumns->get().end())
     {
-        (aAlias = rColumnName) += OUString::number(i++);
+        aAlias = rColumnName + OUString::number(i++);
         aIter = find(
             m_aSelectColumns->get().begin(),
             m_aSelectColumns->get().end(),
diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx
index b5fdf82ac0f6..f9e2a7825834 100644
--- a/cppu/source/uno/lbmap.cxx
+++ b/cppu/source/uno/lbmap.cxx
@@ -414,11 +414,20 @@ static Mapping loadExternalMapping(
         OUString aName;
 
         if ( EnvDcp::getTypeName(rFrom.getTypeName()) == UNO_LB_UNO )
-            bModule = loadModule( aModule, aName = getBridgeName( rTo, rFrom, rAddPurpose ) );
+        {
+            aName = getBridgeName( rTo, rFrom, rAddPurpose );
+            bModule = loadModule( aModule, aName );
+        }
         if (!bModule)
-            bModule = loadModule( aModule, aName = getBridgeName( rFrom, rTo, rAddPurpose ) );
+        {
+            aName = getBridgeName( rFrom, rTo, rAddPurpose );
+            bModule = loadModule( aModule, aName );
+        }
         if (!bModule)
-            bModule = loadModule( aModule, aName = getBridgeName( rTo, rFrom, rAddPurpose ) );
+        {
+            aName = getBridgeName( rTo, rFrom, rAddPurpose );
+            bModule = loadModule( aModule, aName );
+        }
 
         if (bModule)
         {
diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx
index 79ef64c25f75..aacb1f37ff89 100644
--- a/cui/source/dialogs/cuigaldlg.cxx
+++ b/cui/source/dialogs/cuigaldlg.cxx
@@ -826,11 +826,9 @@ void TPGalleryThemeProperties::FillFilterList()
 
             std::unique_ptr<FilterEntry> pFilterEntry(new FilterEntry);
             pFilterEntry->aFilterName = aFilter.second.getToken( 0, ';', nIndex );
+            aFilterWildcard += pFilterEntry->aFilterName;
             nFirstExtFilterPos = m_pCbbFileType->InsertEntry(
-                addExtension(
-                    aFilter.first,
-                    aFilterWildcard += pFilterEntry->aFilterName
-                )
+                addExtension( aFilter.first, aFilterWildcard )
             );
             if ( nFirstExtFilterPos < aFilterEntryList.size() ) {
                 aFilterEntryList.insert(


More information about the Libreoffice-commits mailing list