Kaydet (Commit) e57401ae authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#704287 Logically dead code

Change-Id: Iab22d2d12319bc01f9aebc1dcf40f47881d40446
üst 44aa2dc9
...@@ -481,57 +481,54 @@ void StringResourceImpl::newLocale( const Locale& locale ) ...@@ -481,57 +481,54 @@ void StringResourceImpl::newLocale( const Locale& locale )
} }
// TODO?: Check if locale is valid? How? // TODO?: Check if locale is valid? How?
bool bValid = true; //if (!bValid)
if( bValid ) //{
{ // OUString errorMsg("StringResourceImpl: Invalid locale");
LocaleItem* pLocaleItem = new LocaleItem( locale ); // throw IllegalArgumentException( errorMsg, Reference< XInterface >(), 0 );
m_aLocaleItemVector.push_back( pLocaleItem ); //}
pLocaleItem->m_bModified = true;
LocaleItem* pLocaleItem = new LocaleItem( locale );
// Copy strings from default locale m_aLocaleItemVector.push_back( pLocaleItem );
LocaleItem* pCopyFromItem = m_pDefaultLocaleItem; pLocaleItem->m_bModified = true;
if( pCopyFromItem == NULL )
pCopyFromItem = m_pCurrentLocaleItem; // Copy strings from default locale
if( pCopyFromItem != NULL && loadLocale( pCopyFromItem ) ) 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; OUString aId = (*it).first;
IdToStringMap& rTargetMap = pLocaleItem->m_aIdToStringMap; OUString aStr = (*it).second;
IdToStringMap::const_iterator it; rTargetMap[ aId ] = aStr;
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;
} }
if( m_pCurrentLocaleItem == NULL ) const IdToIndexMap& rSourceIndexMap = pCopyFromItem->m_aIdToIndexMap;
m_pCurrentLocaleItem = pLocaleItem; IdToIndexMap& rTargetIndexMap = pLocaleItem->m_aIdToIndexMap;
IdToIndexMap::const_iterator it_index;
if( m_pDefaultLocaleItem == NULL ) for( it_index = rSourceIndexMap.begin(); it_index != rSourceIndexMap.end(); ++it_index )
{ {
m_pDefaultLocaleItem = pLocaleItem; OUString aId = (*it_index).first;
m_bDefaultModified = true; sal_Int32 nIndex = (*it_index).second;
rTargetIndexMap[ aId ] = nIndex;
} }
pLocaleItem->m_nNextIndex = pCopyFromItem->m_nNextIndex;
implModified();
} }
else
if( m_pCurrentLocaleItem == NULL )
m_pCurrentLocaleItem = pLocaleItem;
if( m_pDefaultLocaleItem == NULL )
{ {
OUString errorMsg("StringResourceImpl: Invalid locale"); m_pDefaultLocaleItem = pLocaleItem;
throw IllegalArgumentException( errorMsg, Reference< XInterface >(), 0 ); m_bDefaultModified = true;
} }
implModified();
} }
void StringResourceImpl::removeLocale( const Locale& locale ) void StringResourceImpl::removeLocale( const Locale& locale )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment