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/source/deployment/dp_persmap.cxx | |
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/source/deployment/dp_persmap.cxx')
-rw-r--r-- | desktop/source/deployment/dp_persmap.cxx | 15 |
1 files changed, 3 insertions, 12 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; |