diff options
Diffstat (limited to 'svl/source/passwordcontainer/passwordcontainer.cxx')
-rw-r--r-- | svl/source/passwordcontainer/passwordcontainer.cxx | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx index 4e04fd1071e5..6becfd9be78d 100644 --- a/svl/source/passwordcontainer/passwordcontainer.cxx +++ b/svl/source/passwordcontainer/passwordcontainer.cxx @@ -867,38 +867,38 @@ void SAL_CALL PasswordContainer::remove( const OUString& aURL, const OUString& a ::osl::MutexGuard aGuard( mMutex ); OUString aUrl( aURL ); - if( !m_aContainer.empty() ) + if( m_aContainer.empty() ) + return; + + PassMap::iterator aIter = m_aContainer.find( aUrl ); + + if( aIter == m_aContainer.end() ) { - PassMap::iterator aIter = m_aContainer.find( aUrl ); + if( aUrl.endsWith("/") ) + aUrl = aUrl.copy( 0, aUrl.getLength() - 1 ); + else + aUrl += "/"; - if( aIter == m_aContainer.end() ) - { - if( aUrl.endsWith("/") ) - aUrl = aUrl.copy( 0, aUrl.getLength() - 1 ); - else - aUrl += "/"; + aIter = m_aContainer.find( aUrl ); + } - aIter = m_aContainer.find( aUrl ); - } + if( aIter == m_aContainer.end() ) + return; - if( aIter != m_aContainer.end() ) + for( std::vector< NamePassRecord >::iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); ++aNPIter ) + if( aNPIter->GetUserName() == aName ) { - for( std::vector< NamePassRecord >::iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); ++aNPIter ) - if( aNPIter->GetUserName() == aName ) - { - if( aNPIter->HasPasswords( PERSISTENT_RECORD ) && m_pStorageFile ) - m_pStorageFile->remove( aURL, aName ); // remove record ( aURL, aName ) + if( aNPIter->HasPasswords( PERSISTENT_RECORD ) && m_pStorageFile ) + m_pStorageFile->remove( aURL, aName ); // remove record ( aURL, aName ) - // the iterator will not be used any more so it can be removed directly - aIter->second.erase( aNPIter ); + // the iterator will not be used any more so it can be removed directly + aIter->second.erase( aNPIter ); - if( aIter->second.empty() ) - m_aContainer.erase( aIter ); + if( aIter->second.empty() ) + m_aContainer.erase( aIter ); - return; - } + return; } - } } @@ -907,44 +907,44 @@ void SAL_CALL PasswordContainer::removePersistent( const OUString& aURL, const O ::osl::MutexGuard aGuard( mMutex ); OUString aUrl( aURL ); - if( !m_aContainer.empty() ) + if( m_aContainer.empty() ) + return; + + PassMap::iterator aIter = m_aContainer.find( aUrl ); + + if( aIter == m_aContainer.end() ) { - PassMap::iterator aIter = m_aContainer.find( aUrl ); + if( aUrl.endsWith("/") ) + aUrl = aUrl.copy( 0, aUrl.getLength() - 1 ); + else + aUrl += "/"; - if( aIter == m_aContainer.end() ) - { - if( aUrl.endsWith("/") ) - aUrl = aUrl.copy( 0, aUrl.getLength() - 1 ); - else - aUrl += "/"; + aIter = m_aContainer.find( aUrl ); + } - aIter = m_aContainer.find( aUrl ); - } + if( aIter == m_aContainer.end() ) + return; - if( aIter != m_aContainer.end() ) + for( std::vector< NamePassRecord >::iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); ++aNPIter ) + if( aNPIter->GetUserName() == aName ) { - for( std::vector< NamePassRecord >::iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); ++aNPIter ) - if( aNPIter->GetUserName() == aName ) - { - if( aNPIter->HasPasswords( PERSISTENT_RECORD ) ) - { - // TODO/LATER: should the password be converted to MemoryPassword? - aNPIter->RemovePasswords( PERSISTENT_RECORD ); + if( aNPIter->HasPasswords( PERSISTENT_RECORD ) ) + { + // TODO/LATER: should the password be converted to MemoryPassword? + aNPIter->RemovePasswords( PERSISTENT_RECORD ); - if ( m_pStorageFile ) - m_pStorageFile->remove( aURL, aName ); // remove record ( aURL, aName ) - } + if ( m_pStorageFile ) + m_pStorageFile->remove( aURL, aName ); // remove record ( aURL, aName ) + } - if( !aNPIter->HasPasswords( MEMORY_RECORD ) ) - aIter->second.erase( aNPIter ); + if( !aNPIter->HasPasswords( MEMORY_RECORD ) ) + aIter->second.erase( aNPIter ); - if( aIter->second.empty() ) - m_aContainer.erase( aIter ); + if( aIter->second.empty() ) + m_aContainer.erase( aIter ); - return; - } + return; } - } } void SAL_CALL PasswordContainer::removeAllPersistent() |