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

Stephan Bergmann sbergman at redhat.com
Thu Apr 21 08:00:57 UTC 2016


 dbaccess/source/ui/querydesign/QueryDesignView.cxx |   15 +++++----------
 dbaccess/source/ui/tabledesign/TableController.cxx |   19 +++++++++++--------
 sal/qa/rtl/strings/test_strings_valuex.cxx         |    2 --
 3 files changed, 16 insertions(+), 20 deletions(-)

New commits:
commit bc492623ad094197db13cb55c7e6cce35962f860
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Apr 21 09:48:00 2016 +0200

    Remove redundant checks
    
    (that started to cause loplugin:salbool after
    13758a3d154e8e450fdfe8bcdeb6b3a03996c53a "SourceManager::isMacroArgExpansion has
    only one param in older Clang")
    
    Change-Id: Ibbdf4552d81385cf952e2d47d1fe23daf78824b5

diff --git a/sal/qa/rtl/strings/test_strings_valuex.cxx b/sal/qa/rtl/strings/test_strings_valuex.cxx
index 83948ce..95ebb8f 100644
--- a/sal/qa/rtl/strings/test_strings_valuex.cxx
+++ b/sal/qa/rtl/strings/test_strings_valuex.cxx
@@ -43,9 +43,7 @@ namespace {
 template< typename T >
 void testBoolean() {
     CPPUNIT_ASSERT_EQUAL( T( "false" ), T::boolean( false ) );
-    CPPUNIT_ASSERT_EQUAL( T( "false" ), T::boolean( sal_False ) );
     CPPUNIT_ASSERT_EQUAL( T( "true" ), T::boolean( true ) );
-    CPPUNIT_ASSERT_EQUAL( T( "true" ), T::boolean( sal_True ) );
 }
 
 }
commit 2ee765872f07f1cb0e2c99f22b48808476089cf5
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Apr 21 09:42:57 2016 +0200

    aColumns is only used as a set
    
    (cf. 40d6b81b9ee0a878d0dadb40941c50aa394a7501 "Replace map to sal_Bool with map
    to bool")
    
    Change-Id: I04bdd6c33793e277182fa80d187f212ab23c252e

diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx
index 1f0f3d1..a56e787 100644
--- a/dbaccess/source/ui/tabledesign/TableController.cxx
+++ b/dbaccess/source/ui/tabledesign/TableController.cxx
@@ -989,7 +989,10 @@ void OTableController::alterColumns()
     // contains all columns names which are already handled those which are not in the list will be deleted
     Reference< XDatabaseMetaData> xMetaData = getMetaData( );
 
-    ::std::map< OUString,bool,::comphelper::UStringMixLess> aColumns(!xMetaData.is() || xMetaData->supportsMixedCaseQuotedIdentifiers());
+    std::set<OUString, comphelper::UStringMixLess> aColumns(
+        comphelper::UStringMixLess(
+            !xMetaData.is()
+            || xMetaData->supportsMixedCaseQuotedIdentifiers()));
     ::std::vector< std::shared_ptr<OTableRow> >::const_iterator aIter = m_vRowList.begin();
     ::std::vector< std::shared_ptr<OTableRow> >::const_iterator aEnd = m_vRowList.end();
     // first look for columns where something other than the name changed
@@ -1002,14 +1005,14 @@ void OTableController::alterColumns()
             continue;
         if ( (*aIter)->IsReadOnly() )
         {
-            aColumns[pField->GetName()] = true;
+            aColumns.insert(pField->GetName());
             continue;
         }
 
         Reference<XPropertySet> xColumn;
         if ( xColumns->hasByName(pField->GetName()) )
         {
-            aColumns[pField->GetName()] = true;
+            aColumns.insert(pField->GetName());
             xColumns->getByName(pField->GetName()) >>= xColumn;
             OSL_ENSURE(xColumn.is(),"Column is null!");
 
@@ -1102,7 +1105,7 @@ void OTableController::alterColumns()
                 xAlter->alterColumnByIndex(nPos,xNewColumn);
                 if(xColumns->hasByName(pField->GetName()))
                 {   // ask for the append by name
-                    aColumns[pField->GetName()] = true;
+                    aColumns.insert(pField->GetName());
                     xColumns->getByName(pField->GetName()) >>= xColumn;
                     if(xColumn.is())
                         pField->copyColumnSettingsTo(xColumn);
@@ -1125,8 +1128,8 @@ void OTableController::alterColumns()
                         Reference<XPropertySet> xNewColumn(xIdxColumns->getByIndex(nPos),UNO_QUERY_THROW);
                         OUString sName;
                         xNewColumn->getPropertyValue(PROPERTY_NAME) >>= sName;
-                        aColumns[sName] = true;
-                        aColumns[pField->GetName()] = true;
+                        aColumns.insert(sName);
+                        aColumns.insert(pField->GetName());
                         continue;
                     }
                 }
@@ -1149,7 +1152,7 @@ void OTableController::alterColumns()
             continue;
         if ( (*aIter)->IsReadOnly() )
         {
-            aColumns[pField->GetName()] = true;
+            aColumns.insert(pField->GetName());
             continue;
         }
 
@@ -1238,7 +1241,7 @@ void OTableController::alterColumns()
                 xAppend->appendByDescriptor(xColumn);
                 if(xColumns->hasByName(pField->GetName()))
                 {   // ask for the append by name
-                    aColumns[pField->GetName()] = true;
+                    aColumns.insert(pField->GetName());
                     xColumns->getByName(pField->GetName()) >>= xColumn;
                     if(xColumn.is())
                         pField->copyColumnSettingsTo(xColumn);
commit 9b8feec33d95f10642ee013ae1310320feb62067
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Apr 21 09:36:47 2016 +0200

    tableNames_t is only used as a set
    
    (cf. fde48126df56ede640499f24ac67f6754b84efbf "Replace map to sal_Bool with map
    to bool")
    
    Change-Id: I0bb24a78d15eb876565e64ce7ca0f4bb04dce2e2

diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index 29cfd71..4be4c88 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -56,6 +56,7 @@
 #include "sqlmessage.hxx"
 #include <unotools/syslocale.hxx>
 #include <memory>
+#include <set>
 
 using namespace ::dbaui;
 using namespace ::utl;
@@ -461,7 +462,7 @@ namespace
         }
         return BuildJoin(_xConnection, rRh, BuildTable(_xConnection,pLh), &data);
     }
-    typedef ::std::map< OUString,bool> tableNames_t;
+    typedef std::set<OUString> tableNames_t;
     void addConnectionTableNames( const Reference< XConnection>& _xConnection,
                                   const OQueryTableConnection* const pEntryConn,
                                   tableNames_t &_rTableNames )
@@ -469,13 +470,8 @@ namespace
             // insert tables into table list to avoid double entries
             const OQueryTableWindow* const pEntryTabFrom = static_cast<OQueryTableWindow*>(pEntryConn->GetSourceWin());
             const OQueryTableWindow* const pEntryTabTo = static_cast<OQueryTableWindow*>(pEntryConn->GetDestWin());
-
-            OUString sTabName(BuildTable(_xConnection,pEntryTabFrom));
-            if(_rTableNames.find(sTabName) == _rTableNames.end())
-                _rTableNames[sTabName] = true;
-            sTabName = BuildTable(_xConnection,pEntryTabTo);
-            if(_rTableNames.find(sTabName) == _rTableNames.end())
-                _rTableNames[sTabName] = true;
+            _rTableNames.insert(BuildTable(_xConnection,pEntryTabFrom));
+            _rTableNames.insert(BuildTable(_xConnection,pEntryTabTo));
     }
     void GetNextJoin(   const Reference< XConnection>& _xConnection,
                         OQueryTableConnection* pEntryConn,
@@ -1004,9 +1000,8 @@ namespace
     {
         OUString sTabName(BuildTable(_xConnection,_pTableWindow));
 
-        if(_rTableNames.find(sTabName) == _rTableNames.end())
+        if(_rTableNames.insert(sTabName).second)
         {
-            _rTableNames[sTabName] = true;
             _rsTableListStr += sTabName;
             _rsTableListStr += ",";
         }
commit a4d7976c99b9ec49202dcac7e4dcb416755415bf
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Apr 21 09:28:42 2016 +0200

    comphelper::UStringMixLess defaults to bCaseSensitive = true
    
    ...which then behaves the same as the default std::less<OUString>
    
    Change-Id: If18ef434a752bc77012e665d3621bc319f2897e8

diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index c86de1d..29cfd71 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -461,7 +461,7 @@ namespace
         }
         return BuildJoin(_xConnection, rRh, BuildTable(_xConnection,pLh), &data);
     }
-    typedef ::std::map< OUString,bool,::comphelper::UStringMixLess> tableNames_t;
+    typedef ::std::map< OUString,bool> tableNames_t;
     void addConnectionTableNames( const Reference< XConnection>& _xConnection,
                                   const OQueryTableConnection* const pEntryConn,
                                   tableNames_t &_rTableNames )


More information about the Libreoffice-commits mailing list