diff options
author | Noel Grandin <noel@peralex.com> | 2016-04-05 08:03:35 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-04-05 11:29:54 +0000 |
commit | 9866efe3e5a670bab54d931be31e1989aeb382a7 (patch) | |
tree | 64b1365a7f1e38b8babdfccee8db100af922ab73 /desktop | |
parent | 4b4c9184279c2cb5998348b09e084b295de1c8aa (diff) |
loplugin:constantparam
Change-Id: I821ed77a6c6014c9a82d31a4b117ed6f1b4abf18
Reviewed-on: https://gerrit.libreoffice.org/23832
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'desktop')
4 files changed, 6 insertions, 16 deletions
diff --git a/desktop/source/deployment/dp_persmap.cxx b/desktop/source/deployment/dp_persmap.cxx index f77aff0d01ad..78f5b42d0824 100644 --- a/desktop/source/deployment/dp_persmap.cxx +++ b/desktop/source/deployment/dp_persmap.cxx @@ -35,11 +35,10 @@ namespace dp_misc static const char PmapMagic[4] = {'P','m','p','1'}; -PersistentMap::PersistentMap( OUString const & url_, bool readOnly ) +PersistentMap::PersistentMap( OUString const & url_ ) : m_MapFile( expandUnoRcUrl(url_) ) -, m_bReadOnly( readOnly ) , m_bIsOpen( false ) -, m_bToBeCreated( !readOnly ) +, m_bToBeCreated( true ) , m_bIsDirty( false ) { open(); @@ -47,7 +46,6 @@ PersistentMap::PersistentMap( OUString const & url_, bool readOnly ) PersistentMap::PersistentMap() : m_MapFile( OUString() ) -, m_bReadOnly( false ) , m_bIsOpen( false ) , m_bToBeCreated( false ) , m_bIsDirty( false ) @@ -141,9 +139,7 @@ static OString decodeString( const sal_Char* pEncChars, int nLen) void PersistentMap::open() { // open the existing file - sal_uInt32 nOpenFlags = osl_File_OpenFlag_Read; - if( !m_bReadOnly) - nOpenFlags |= osl_File_OpenFlag_Write; + sal_uInt32 nOpenFlags = osl_File_OpenFlag_Read | osl_File_OpenFlag_Write; const osl::File::RC rcOpen = m_MapFile.open( nOpenFlags); m_bIsOpen = (rcOpen == osl::File::E_None); @@ -210,7 +206,6 @@ void PersistentMap::flush() { if( !m_bIsDirty) return; - OSL_ASSERT( !m_bReadOnly); if( m_bToBeCreated && !m_entries.empty()) { const sal_uInt32 nOpenFlags = osl_File_OpenFlag_Read | osl_File_OpenFlag_Write | osl_File_OpenFlag_Create; @@ -273,8 +268,6 @@ bool PersistentMap::get( OString * value, OString const & key ) const void PersistentMap::add( OString const & key, OString const & value ) { - if( m_bReadOnly) - return; typedef std::pair<t_string2string_map::iterator,bool> InsertRC; InsertRC r = m_entries.insert( t_string2string_map::value_type(key,value)); m_bIsDirty = r.second; @@ -292,8 +285,6 @@ void PersistentMap::put( OString const & key, OString const & value ) bool PersistentMap::erase( OString const & key ) { - if( m_bReadOnly) - return false; size_t nCount = m_entries.erase( key); if( !nCount) return false; diff --git a/desktop/source/deployment/inc/dp_persmap.h b/desktop/source/deployment/inc/dp_persmap.h index 892339590f8a..3b172ff713a3 100644 --- a/desktop/source/deployment/inc/dp_persmap.h +++ b/desktop/source/deployment/inc/dp_persmap.h @@ -36,14 +36,13 @@ class PersistentMap { ::osl::File m_MapFile; t_string2string_map m_entries; - bool m_bReadOnly; bool m_bIsOpen; bool m_bToBeCreated; bool m_bIsDirty; public: ~PersistentMap(); - PersistentMap( OUString const & url, bool readOnly ); + PersistentMap( OUString const & url ); /** in mem db */ PersistentMap(); diff --git a/desktop/source/deployment/manager/dp_activepackages.cxx b/desktop/source/deployment/manager/dp_activepackages.cxx index 83bb3474c0d1..99cc5f897bac 100644 --- a/desktop/source/deployment/manager/dp_activepackages.cxx +++ b/desktop/source/deployment/manager/dp_activepackages.cxx @@ -118,7 +118,7 @@ ActivePackages::ActivePackages() {} ActivePackages::ActivePackages(OUString const & url) #if HAVE_FEATURE_EXTENSIONS - : m_map(url, false/*readOnly*/) + : m_map(url) #endif { (void) url; diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx index 27e229a4da87..6ffbc2569ea6 100644 --- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx +++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx @@ -227,7 +227,7 @@ BackendImpl::BackendImpl( { try { - pMap.reset( new PersistentMap( aCompatURL, false ) ); + pMap.reset( new PersistentMap( aCompatURL ) ); } catch (const Exception &e) { |