diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-03-29 15:11:17 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-03-29 18:12:06 +0000 |
commit | e57401aeb0b3eccb1178b941515c398675a1a43f (patch) | |
tree | 11d556c4e8c2af4e1a1b51f4efff9fd4578f5453 /scripting | |
parent | 44aa2dc9765f7c76997fb0a66877c3a4f97818d4 (diff) |
coverity#704287 Logically dead code
Change-Id: Iab22d2d12319bc01f9aebc1dcf40f47881d40446
Diffstat (limited to 'scripting')
-rw-r--r-- | scripting/source/stringresource/stringresource.cxx | 83 |
1 files changed, 40 insertions, 43 deletions
diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx index 39a42a7cf0d2..feac457a444f 100644 --- a/scripting/source/stringresource/stringresource.cxx +++ b/scripting/source/stringresource/stringresource.cxx @@ -481,57 +481,54 @@ void StringResourceImpl::newLocale( const Locale& locale ) } // TODO?: Check if locale is valid? How? - bool bValid = true; - if( bValid ) - { - LocaleItem* pLocaleItem = new LocaleItem( locale ); - m_aLocaleItemVector.push_back( pLocaleItem ); - pLocaleItem->m_bModified = true; - - // Copy strings from default locale - LocaleItem* pCopyFromItem = m_pDefaultLocaleItem; - if( pCopyFromItem == NULL ) - pCopyFromItem = m_pCurrentLocaleItem; - if( pCopyFromItem != NULL && loadLocale( pCopyFromItem ) ) + //if (!bValid) + //{ + // OUString errorMsg("StringResourceImpl: Invalid locale"); + // throw IllegalArgumentException( errorMsg, Reference< XInterface >(), 0 ); + //} + + LocaleItem* pLocaleItem = new LocaleItem( locale ); + m_aLocaleItemVector.push_back( pLocaleItem ); + pLocaleItem->m_bModified = true; + + // Copy strings from default locale + LocaleItem* pCopyFromItem = m_pDefaultLocaleItem; + if( pCopyFromItem == NULL ) + pCopyFromItem = m_pCurrentLocaleItem; + if( pCopyFromItem != NULL && loadLocale( pCopyFromItem ) ) + { + const IdToStringMap& rSourceMap = pCopyFromItem->m_aIdToStringMap; + IdToStringMap& rTargetMap = pLocaleItem->m_aIdToStringMap; + IdToStringMap::const_iterator it; + for( it = rSourceMap.begin(); it != rSourceMap.end(); ++it ) { - const IdToStringMap& rSourceMap = pCopyFromItem->m_aIdToStringMap; - IdToStringMap& rTargetMap = pLocaleItem->m_aIdToStringMap; - IdToStringMap::const_iterator it; - for( it = rSourceMap.begin(); it != rSourceMap.end(); ++it ) - { - OUString aId = (*it).first; - OUString aStr = (*it).second; - rTargetMap[ aId ] = aStr; - } - - const IdToIndexMap& rSourceIndexMap = pCopyFromItem->m_aIdToIndexMap; - IdToIndexMap& rTargetIndexMap = pLocaleItem->m_aIdToIndexMap; - IdToIndexMap::const_iterator it_index; - for( it_index = rSourceIndexMap.begin(); it_index != rSourceIndexMap.end(); ++it_index ) - { - OUString aId = (*it_index).first; - sal_Int32 nIndex = (*it_index).second; - rTargetIndexMap[ aId ] = nIndex; - } - pLocaleItem->m_nNextIndex = pCopyFromItem->m_nNextIndex; + OUString aId = (*it).first; + OUString aStr = (*it).second; + rTargetMap[ aId ] = aStr; } - if( m_pCurrentLocaleItem == NULL ) - m_pCurrentLocaleItem = pLocaleItem; - - if( m_pDefaultLocaleItem == NULL ) + const IdToIndexMap& rSourceIndexMap = pCopyFromItem->m_aIdToIndexMap; + IdToIndexMap& rTargetIndexMap = pLocaleItem->m_aIdToIndexMap; + IdToIndexMap::const_iterator it_index; + for( it_index = rSourceIndexMap.begin(); it_index != rSourceIndexMap.end(); ++it_index ) { - m_pDefaultLocaleItem = pLocaleItem; - m_bDefaultModified = true; + OUString aId = (*it_index).first; + sal_Int32 nIndex = (*it_index).second; + rTargetIndexMap[ aId ] = nIndex; } - - implModified(); + pLocaleItem->m_nNextIndex = pCopyFromItem->m_nNextIndex; } - else + + if( m_pCurrentLocaleItem == NULL ) + m_pCurrentLocaleItem = pLocaleItem; + + if( m_pDefaultLocaleItem == NULL ) { - OUString errorMsg("StringResourceImpl: Invalid locale"); - throw IllegalArgumentException( errorMsg, Reference< XInterface >(), 0 ); + m_pDefaultLocaleItem = pLocaleItem; + m_bDefaultModified = true; } + + implModified(); } void StringResourceImpl::removeLocale( const Locale& locale ) |