[Libreoffice-commits] core.git: ucb/source

Noel Grandin noel at peralex.com
Tue Apr 5 06:27:47 UTC 2016


 ucb/source/core/ucb.cxx                       |    2 +-
 ucb/source/inc/regexpmap.hxx                  |   17 ++++-------------
 ucb/source/sorter/sortdynres.cxx              |    4 ++--
 ucb/source/sorter/sortresult.cxx              |   15 +++++++--------
 ucb/source/sorter/sortresult.hxx              |    2 +-
 ucb/source/ucp/ftp/ftpdirp.hxx                |   20 +++-----------------
 ucb/source/ucp/hierarchy/hierarchycontent.cxx |    2 +-
 ucb/source/ucp/hierarchy/hierarchydata.cxx    |    6 +-----
 ucb/source/ucp/hierarchy/hierarchydata.hxx    |    2 +-
 9 files changed, 21 insertions(+), 49 deletions(-)

New commits:
commit 8375affb39ac72f5a20d8a1377ccea59fe94aa73
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Apr 4 15:18:26 2016 +0200

    loplugin:constantparam in ucb
    
    Change-Id: Ifa36b58a36232e6333a1c85d85d0372fb0de219b
    Reviewed-on: https://gerrit.libreoffice.org/23829
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/ucb/source/core/ucb.cxx b/ucb/source/core/ucb.cxx
index 4375056..09437c2 100644
--- a/ucb/source/core/ucb.cxx
+++ b/ucb/source/core/ucb.cxx
@@ -413,7 +413,7 @@ UniversalContentBroker::registerContentProvider(
         aList.push_front( ProviderListEntry_Impl(Provider) );
         try
         {
-            m_aProviders.add(Scheme, aList, false);
+            m_aProviders.add(Scheme, aList);
         }
         catch (const IllegalArgumentException&)
         {
diff --git a/ucb/source/inc/regexpmap.hxx b/ucb/source/inc/regexpmap.hxx
index 45a64fd..09244e6 100644
--- a/ucb/source/inc/regexpmap.hxx
+++ b/ucb/source/inc/regexpmap.hxx
@@ -378,7 +378,7 @@ public:
 
     RegexpMap & operator =(RegexpMap const & rOther);
 
-    void add(OUString const & rKey, Val const & rValue, bool bOverwrite);
+    void add(OUString const & rKey, Val const & rValue);
 
     iterator find(OUString const & rKey);
 
@@ -424,8 +424,7 @@ RegexpMap< Val > & RegexpMap< Val >::operator =(RegexpMap const & rOther)
 }
 
 template< typename Val >
-void RegexpMap< Val >::add(rtl::OUString const & rKey, Val const & rValue,
-                           bool bOverwrite)
+void RegexpMap< Val >::add(rtl::OUString const & rKey, Val const & rValue)
 {
     Regexp aRegexp(Regexp::parse(rKey));
 
@@ -433,9 +432,7 @@ void RegexpMap< Val >::add(rtl::OUString const & rKey, Val const & rValue,
     {
         if (m_pImpl->m_pDefault)
         {
-            if (!bOverwrite)
-                return;
-            delete m_pImpl->m_pDefault;
+            return;
         }
         m_pImpl->m_pDefault = new Entry< Val >(aRegexp, rValue);
     }
@@ -448,13 +445,7 @@ void RegexpMap< Val >::add(rtl::OUString const & rKey, Val const & rValue,
         {
             if (aIt->m_aRegexp == aRegexp)
             {
-                if (bOverwrite)
-                {
-                    rTheList.erase(aIt);
-                    break;
-                }
-                else
-                    return;
+               return;
             }
         }
 
diff --git a/ucb/source/sorter/sortdynres.cxx b/ucb/source/sorter/sortdynres.cxx
index b9aae2f..e4552ec 100644
--- a/ucb/source/sorter/sortdynres.cxx
+++ b/ucb/source/sorter/sortdynres.cxx
@@ -544,11 +544,11 @@ void EventList::Clear()
     maData.clear();
 }
 
-void EventList::AddEvent( sal_IntPtr nType, sal_IntPtr nPos, sal_IntPtr nCount )
+void EventList::AddEvent( sal_IntPtr nType, sal_IntPtr nPos )
 {
     ListAction *pAction = new ListAction;
     pAction->Position = nPos;
-    pAction->Count = nCount;
+    pAction->Count = 1;
     pAction->ListActionType = nType;
 
     Insert( pAction );
diff --git a/ucb/source/sorter/sortresult.cxx b/ucb/source/sorter/sortresult.cxx
index 627dcdf..47ad05a 100644
--- a/ucb/source/sorter/sortresult.cxx
+++ b/ucb/source/sorter/sortresult.cxx
@@ -77,11 +77,11 @@ struct SortInfo
 
 struct SortListData
 {
-    bool    mbModified;
+    bool        mbModified;
     sal_IntPtr  mnCurPos;
     sal_IntPtr  mnOldPos;
 
-    SortListData( sal_IntPtr nPos, bool bModified = false );
+    SortListData( sal_IntPtr nPos );
 };
 
 
@@ -1525,7 +1525,7 @@ void SortedResultSet::Remove( sal_IntPtr nPos, sal_IntPtr nCount, EventList *pEv
 
         // generate remove Event, but not for new entries
         if ( nSortPos <= nOldLastSort )
-            pEvents->AddEvent( ListActionType::REMOVED, nSortPos, 1 );
+            pEvents->AddEvent( ListActionType::REMOVED, nSortPos );
     }
 
     // correct the positions in the sorted list
@@ -1742,8 +1742,7 @@ void SortedResultSet::ResortModified( EventList* pList )
                     pAction->ActionInfo <<= nNewPos-nCurPos;
                     pList->Insert( pAction );
                 }
-                pList->AddEvent( ListActionType::PROPERTIES_CHANGED,
-                                 nNewPos, 1 );
+                pList->AddEvent( ListActionType::PROPERTIES_CHANGED, nNewPos );
             }
         }
     }
@@ -1779,7 +1778,7 @@ void SortedResultSet::ResortNew( EventList* pList )
                 maO2S.Replace( reinterpret_cast<void*>(nNewPos), (sal_uInt32) pData->mnCurPos );
             }
             mnLastSort++;
-            pList->AddEvent( ListActionType::INSERTED, nNewPos, 1 );
+            pList->AddEvent( ListActionType::INSERTED, nNewPos );
         }
     }
     catch (const SQLException&)
@@ -1792,9 +1791,9 @@ void SortedResultSet::ResortNew( EventList* pList )
 // SortListData
 
 
-SortListData::SortListData( sal_IntPtr nPos, bool bModified )
+SortListData::SortListData( sal_IntPtr nPos )
 {
-    mbModified = bModified;
+    mbModified = false;
     mnCurPos = nPos;
     mnOldPos = nPos;
 };
diff --git a/ucb/source/sorter/sortresult.hxx b/ucb/source/sorter/sortresult.hxx
index 9681ce3..ab16c45 100644
--- a/ucb/source/sorter/sortresult.hxx
+++ b/ucb/source/sorter/sortresult.hxx
@@ -77,7 +77,7 @@ public:
 
     sal_uInt32      Count() { return (sal_uInt32) maData.size(); }
 
-    void            AddEvent( sal_IntPtr nType, sal_IntPtr nPos, sal_IntPtr nCount );
+    void            AddEvent( sal_IntPtr nType, sal_IntPtr nPos );
     void            Insert( css::ucb::ListAction *pAction ) { maData.push_back( pAction ); }
     void            Clear();
     css::ucb::ListAction*     GetAction( sal_IntPtr nIndex ) { return maData[ nIndex ]; }
diff --git a/ucb/source/ucp/ftp/ftpdirp.hxx b/ucb/source/ucp/ftp/ftpdirp.hxx
index 69567b3..441d6a4 100644
--- a/ucb/source/ucp/ftp/ftpdirp.hxx
+++ b/ucb/source/ucp/ftp/ftpdirp.hxx
@@ -41,21 +41,7 @@ namespace ftp {
     struct DateTime
         : public css::util::DateTime
     {
-        DateTime(const sal_uInt32& nanoSeconds,
-                 const sal_uInt16& seconds,
-                 const sal_uInt16& minutes,
-                 const sal_uInt16& hours,
-                 const sal_uInt16& day,
-                 const sal_uInt16& month,
-                 const sal_uInt16& year)
-                     : css::util::DateTime(nanoSeconds,
-                                                      seconds,
-                                                      minutes,
-                                                      hours,
-                                                      day,
-                                                      month,
-                                                      year,
-                                                      false) { }
+        DateTime() : css::util::DateTime(0, 0, 0, 0, 0, 0, 0, false) { }
 
         void SetYear(sal_uInt16 year) { Year = year; }
         void SetMonth(sal_uInt16 month) { Month = month; }
@@ -92,14 +78,14 @@ namespace ftp {
         sal_uInt32                          m_nSize;
 
         FTPDirentry()
-            : m_aDate(0,0,0,0,0,0,0),
+            : m_aDate(),
               m_nMode(INETCOREFTP_FILEMODE_UNKNOWN),
               m_nSize((sal_uInt32)(-1)) { }
 
         void clear() {
             m_aURL.clear();
             m_aName.clear();
-            m_aDate = DateTime(0,0,0,0,0,0,0);
+            m_aDate = DateTime();
             m_nMode = INETCOREFTP_FILEMODE_UNKNOWN;
             m_nSize = sal_uInt32(-1);
         }
diff --git a/ucb/source/ucp/hierarchy/hierarchycontent.cxx b/ucb/source/ucp/hierarchy/hierarchycontent.cxx
index e73cdcf..99dc529 100644
--- a/ucb/source/ucp/hierarchy/hierarchycontent.cxx
+++ b/ucb/source/ucp/hierarchy/hierarchycontent.cxx
@@ -674,7 +674,7 @@ bool HierarchyContent::storeData()
 {
     HierarchyEntry aEntry(
             m_xContext, m_pProvider, m_xIdentifier->getContentIdentifier() );
-    return aEntry.setData( m_aProps.getHierarchyEntryData(), true );
+    return aEntry.setData( m_aProps.getHierarchyEntryData() );
 }
 
 
diff --git a/ucb/source/ucp/hierarchy/hierarchydata.cxx b/ucb/source/ucp/hierarchy/hierarchydata.cxx
index c027ec4..7730248 100644
--- a/ucb/source/ucp/hierarchy/hierarchydata.cxx
+++ b/ucb/source/ucp/hierarchy/hierarchydata.cxx
@@ -253,8 +253,7 @@ bool HierarchyEntry::getData( HierarchyEntryData& rData )
 }
 
 
-bool HierarchyEntry::setData(
-                    const HierarchyEntryData& rData, bool bCreate )
+bool HierarchyEntry::setData( const HierarchyEntryData& rData )
 {
     try
     {
@@ -351,9 +350,6 @@ bool HierarchyEntry::setData(
                 }
                 else
                 {
-                    if ( !bCreate )
-                        return true;
-
                     // Key does not exist. Create / fill / insert it.
 
                     uno::Reference< lang::XSingleServiceFactory > xFac;
diff --git a/ucb/source/ucp/hierarchy/hierarchydata.hxx b/ucb/source/ucp/hierarchy/hierarchydata.hxx
index badca56..08639f3 100644
--- a/ucb/source/ucp/hierarchy/hierarchydata.hxx
+++ b/ucb/source/ucp/hierarchy/hierarchydata.hxx
@@ -102,7 +102,7 @@ public:
 
     bool getData( HierarchyEntryData& rData );
 
-    bool setData( const HierarchyEntryData& rData, bool bCreate );
+    bool setData( const HierarchyEntryData& rData );
 
     bool move( const OUString& rNewURL,
                    const HierarchyEntryData& rData );


More information about the Libreoffice-commits mailing list