diff options
author | Noel Grandin <noel@peralex.com> | 2015-09-30 10:29:19 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-10-01 10:43:24 +0000 |
commit | 58aea3f36c14414f95668e229a7350598f6c53a8 (patch) | |
tree | 70c115dffd44576313cefd49e4164d293895e4bd /framework | |
parent | 3fcbfe10857631212d8b8db9a079bb9692ed78bc (diff) |
loplugin:unusedmethods
- improvements to the plugin to find more method calls
- improvements to python script to remove more false+
- fix the FORCE_COMPILE_ALL build flag to include code in
the $WORKDIR
Change-Id: I4d6015dcb9b9d60c26f0bcee8abad807177a7836
Reviewed-on: https://gerrit.libreoffice.org/19064
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'framework')
-rw-r--r-- | framework/inc/classes/checkediterator.hxx | 81 | ||||
-rw-r--r-- | framework/inc/classes/filtercachedata.hxx | 21 | ||||
-rw-r--r-- | framework/inc/stdtypes.h | 13 | ||||
-rw-r--r-- | framework/source/inc/pattern/frame.hxx | 11 | ||||
-rw-r--r-- | framework/source/jobs/jobexecutor.cxx | 12 | ||||
-rw-r--r-- | framework/source/services/pathsettings.cxx | 16 |
6 files changed, 14 insertions, 140 deletions
diff --git a/framework/inc/classes/checkediterator.hxx b/framework/inc/classes/checkediterator.hxx index ff5f07e1a467..978dc4d255b8 100644 --- a/framework/inc/classes/checkediterator.hxx +++ b/framework/inc/classes/checkediterator.hxx @@ -69,71 +69,6 @@ class CheckedIterator // interface methods /*-**************************************************************************************************** - @short initialize instance with valid container - @descr Set new container at an instance of this class. The other member will set automatically! - m_pPosition = first element in container - m_eEndState = BEFOREEND - @param "rContainer", must be a valid reference to an existing container. - @onerror An assertion is thrown. - *//*-*****************************************************************************************************/ - - inline void initialize( const TContainer& rContainer ) - { - // Check incoming parameter. We don't accept all! - SAL_WARN_IF( &rContainer==NULL, "fwk", "CheckedIterator::initialize(): Invalid parameter detected!" ); - SAL_WARN_IF( m_eEndState!=E_UNKNOWN, "fwk", "CheckedIterator::initialize(): Instance already initialized! Don't do it again." ); - - if( m_eEndState == E_UNKNOWN ) - { - // Set new container and update other member. - m_pContainer = &rContainer; - m_eEndState = E_BEFOREEND; - m_pPosition = m_pContainer->begin(); - } - } - - /*-**************************************************************************************************** - @short set internal states to E_END - @descr Sometimes we need a "walking" check-iterator which is initialized with the END-state! - We need it to return one default value if no other ones exist ... - - @seealso using in class FilterCache! - *//*-*****************************************************************************************************/ - - inline void setEnd() - { - m_pContainer = NULL; - m_eEndState = E_END; - } - - /*-**************************************************************************************************** - @short set internal states to E_AFTEREND - @descr Sometimes we need a "walking" check-iterator which is initialized with AFTEREND-state! - We need it if we don't have a container but must prevent us against further searching! - - @seealso using in class FilterCache! - *//*-*****************************************************************************************************/ - - inline void setAfterEnd() - { - m_pContainer = NULL; - m_eEndState = E_AFTEREND; - } - - /*-**************************************************************************************************** - @short reset this iterator - @descr It must be called on an already initialized iterator. - Means the member m_pContainer must be valid. Otherwise the reaction - isn't defined. - *//*-*****************************************************************************************************/ - - inline void reset() - { - m_eEndState = E_UNKNOWN; - m_pContainer = NULL; - } - - /*-**************************************************************************************************** @short step to next element in container. @descr If end of container is reached we change our internal "m_eEndState". If end reached for first time; we set it to E_END; @@ -168,22 +103,6 @@ class CheckedIterator return *this; } - /*-**************************************************************************************************** - @short support readonly access to container entry - @descr Use it to get the value of current container item. - @return A reference to value of container entry. - *//*-*****************************************************************************************************/ - - inline typename TContainer::const_iterator getEntry() - { - // Warn programmer if he forget to initialize these object ... - SAL_WARN_IF( m_pContainer==NULL, "fwk", "CheckedIterator::getEntry(): Object not initialized!" ); - // or try to read a non existing element! - SAL_WARN_IF( m_eEndState!=E_BEFOREEND, "fwk", "CheckedIterator::getEntry(): Wrong using of class detected!" ); - - return m_pPosition; - } - // private member private: diff --git a/framework/inc/classes/filtercachedata.hxx b/framework/inc/classes/filtercachedata.hxx index 813940752247..e20b1a313deb 100644 --- a/framework/inc/classes/filtercachedata.hxx +++ b/framework/inc/classes/filtercachedata.hxx @@ -315,27 +315,6 @@ class SetNodeHash : public std::unordered_map< OUString , OUStringHash , std::equal_to< OUString > > { - - // interface - - public: - - // The only way to free ALL memory really! - - inline void free() - { - SetNodeHash().swap( *this ); // get rid of reserved capacity - framework::free(lAddedItems); - framework::free(lChangedItems); - framework::free(lRemovedItems); - } - - // Append changed, added or removed items to special lists - // Necessary for saving changes - - void appendChange( const OUString& sName , - EModifyState eState ); - // member public: diff --git a/framework/inc/stdtypes.h b/framework/inc/stdtypes.h index 6760033cf451..b748cedf2b8c 100644 --- a/framework/inc/stdtypes.h +++ b/framework/inc/stdtypes.h @@ -81,19 +81,6 @@ struct KeyEventEqualsFunc typedef ::std::vector< OUString > OUStringList; -// search for given element -template <class T> -typename std::vector<T>::iterator find( std::vector<T>& vec, const T& sElement ) -{ - return ::std::find(vec.begin(), vec.end(), sElement); -} - -template <class T> -typename std::vector<T>::const_iterator find( const std::vector<T>& vec, const T& sElement ) -{ - return ::std::find(vec.begin(), vec.end(), sElement); -} - template <class T> void free(std::vector<T>& vec) { diff --git a/framework/source/inc/pattern/frame.hxx b/framework/source/inc/pattern/frame.hxx index 1faa79df9a0c..7b389579a6d3 100644 --- a/framework/source/inc/pattern/frame.hxx +++ b/framework/source/inc/pattern/frame.hxx @@ -35,17 +35,6 @@ namespace framework{ namespace pattern{ namespace frame{ -inline css::uno::Reference< css::frame::XModel > extractFrameModel(const css::uno::Reference< css::frame::XFrame >& xFrame) -{ - css::uno::Reference< css::frame::XModel > xModel; - css::uno::Reference< css::frame::XController > xController; - if (xFrame.is()) - xController = xFrame->getController(); - if (xController.is()) - xModel = xController->getModel(); - return xModel; -} - /** @short close (or dispose) the given resource. @descr It try to close the given resource first. diff --git a/framework/source/jobs/jobexecutor.cxx b/framework/source/jobs/jobexecutor.cxx index 6f7f78ca371f..4227c62d70d7 100644 --- a/framework/source/jobs/jobexecutor.cxx +++ b/framework/source/jobs/jobexecutor.cxx @@ -214,7 +214,7 @@ void SAL_CALL JobExecutor::trigger( const OUString& sEvent ) throw(css::uno::Run // Optimization! // Check if the given event name exist inside configuration and reject wrong requests. // This optimization suppress using of the cfg api for getting event and job descriptions ... - if (framework::find(m_lEvents, sEvent) == m_lEvents.end()) + if (std::find(m_lEvents.begin(), m_lEvents.end(), sEvent) == m_lEvents.end()) return; // get list of all enabled jobs @@ -283,7 +283,7 @@ void SAL_CALL JobExecutor::notifyEvent( const css::document::EventObject& aEvent (aEvent.EventName == EVENT_ON_LOAD) ) { - if (find(m_lEvents, EVENT_ON_DOCUMENT_OPENED) != m_lEvents.end()) + if (std::find(m_lEvents.begin(), m_lEvents.end(), EVENT_ON_DOCUMENT_OPENED) != m_lEvents.end()) JobData::appendEnabledJobsForEvent(m_xContext, EVENT_ON_DOCUMENT_OPENED, lJobs); } @@ -293,12 +293,12 @@ void SAL_CALL JobExecutor::notifyEvent( const css::document::EventObject& aEvent (aEvent.EventName == EVENT_ON_LOAD_FINISHED) ) { - if (find(m_lEvents, EVENT_ON_DOCUMENT_ADDED) != m_lEvents.end()) + if (std::find(m_lEvents.begin(), m_lEvents.end(), EVENT_ON_DOCUMENT_ADDED) != m_lEvents.end()) JobData::appendEnabledJobsForEvent(m_xContext, EVENT_ON_DOCUMENT_ADDED, lJobs); } // Add all jobs for "real" notified event too .-) - if (find(m_lEvents, aEvent.EventName) != m_lEvents.end()) + if (std::find(m_lEvents.begin(), m_lEvents.end(), aEvent.EventName) != m_lEvents.end()) JobData::appendEnabledJobsForEvent(m_xContext, aEvent.EventName, lJobs); } /* SAFE */ @@ -344,7 +344,7 @@ void SAL_CALL JobExecutor::elementInserted( const css::container::ContainerEvent OUString sEvent = ::utl::extractFirstFromConfigurationPath(sValue); if (!sEvent.isEmpty()) { - OUStringList::iterator pEvent = find(m_lEvents, sEvent); + OUStringList::iterator pEvent = std::find(m_lEvents.begin(), m_lEvents.end(), sEvent); if (pEvent == m_lEvents.end()) m_lEvents.push_back(sEvent); } @@ -359,7 +359,7 @@ void SAL_CALL JobExecutor::elementRemoved ( const css::container::ContainerEvent OUString sEvent = ::utl::extractFirstFromConfigurationPath(sValue); if (!sEvent.isEmpty()) { - OUStringList::iterator pEvent = find(m_lEvents, sEvent); + OUStringList::iterator pEvent = std::find(m_lEvents.begin(), m_lEvents.end(), sEvent); if (pEvent != m_lEvents.end()) m_lEvents.erase(pEvent); } diff --git a/framework/source/services/pathsettings.cxx b/framework/source/services/pathsettings.cxx index 3f63fd3bc971..893594c1e7ff 100644 --- a/framework/source/services/pathsettings.cxx +++ b/framework/source/services/pathsettings.cxx @@ -636,7 +636,7 @@ PathSettings::PathInfo PathSettings::impl_readNewFormat(const OUString& sPath) // avoid duplicates, by removing the writeable path from // the user defined path list if it happens to be there too - OUStringList::iterator aI = find(aPathVal.lUserPaths, aPathVal.sWritePath); + OUStringList::iterator aI = std::find(aPathVal.lUserPaths.begin(), aPathVal.lUserPaths.end(), aPathVal.sWritePath); if (aI != aPathVal.lUserPaths.end()) aPathVal.lUserPaths.erase(aI); @@ -724,8 +724,8 @@ void PathSettings::impl_mergeOldUserPaths( PathSettings::PathInfo& rPath, else { if ( - ( find(rPath.lInternalPaths, sOld) == rPath.lInternalPaths.end()) && - ( find(rPath.lUserPaths, sOld) == rPath.lUserPaths.end() ) && + ( std::find(rPath.lInternalPaths.begin(), rPath.lInternalPaths.end(), sOld) == rPath.lInternalPaths.end()) && + ( std::find(rPath.lUserPaths.begin(), rPath.lUserPaths.end(), sOld) == rPath.lUserPaths.end() ) && (! rPath.sWritePath.equals(sOld) ) ) rPath.lUserPaths.push_back(sOld); @@ -1056,10 +1056,10 @@ void PathSettings::impl_purgeKnownPaths(PathSettings::PathInfo& rPath, ++pIt ) { const OUString& rItem = *pIt; - OUStringList::iterator pItem = find(lList, rItem); + OUStringList::iterator pItem = std::find(lList.begin(), lList.end(), rItem); if (pItem != lList.end()) lList.erase(pItem); - pItem = find(rPath.lUserPaths, rItem); + pItem = std::find(rPath.lUserPaths.begin(), rPath.lUserPaths.end(), rItem); if (pItem != rPath.lUserPaths.end()) rPath.lUserPaths.erase(pItem); } @@ -1069,7 +1069,7 @@ void PathSettings::impl_purgeKnownPaths(PathSettings::PathInfo& rPath, while ( pIt != rPath.lUserPaths.end() ) { const OUString& rItem = *pIt; - OUStringList::iterator pItem = find(lList, rItem); + OUStringList::iterator pItem = std::find(lList.begin(), lList.end(), rItem); if ( pItem == lList.end() ) { rPath.lUserPaths.erase(pIt); @@ -1087,13 +1087,13 @@ void PathSettings::impl_purgeKnownPaths(PathSettings::PathInfo& rPath, ++pIt ) { const OUString& rItem = *pIt; - OUStringList::iterator pItem = find(lList, rItem); + OUStringList::iterator pItem = std::find(lList.begin(), lList.end(), rItem); if (pItem != lList.end()) lList.erase(pItem); } // Erase the write path from lList - OUStringList::iterator pItem = find(lList, rPath.sWritePath); + OUStringList::iterator pItem = std::find(lList.begin(), lList.end(), rPath.sWritePath); if (pItem != lList.end()) lList.erase(pItem); } |