Kaydet (Commit) e0d16475 authored tarafından Matteo Casalin's avatar Matteo Casalin

Reduce scope and simplify by early return

Change-Id: I12f8c6cb002cb0af63a096c7b66dd1e7d2db92a5
üst ee82052a
...@@ -1136,37 +1136,29 @@ bool SfxDocumentTemplates::GetLogicNames ...@@ -1136,37 +1136,29 @@ bool SfxDocumentTemplates::GetLogicNames
aFullPath.SetURL( rPath ); aFullPath.SetURL( rPath );
const OUString aPath( aFullPath.GetMainURL( INetURLObject::DecodeMechanism::NONE ) ); const OUString aPath( aFullPath.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
RegionData_Impl *pData = nullptr;
DocTempl_EntryData_Impl *pEntry = nullptr;
bool bFound = false;
const sal_uInt16 nCount = GetRegionCount(); const sal_uInt16 nCount = GetRegionCount();
for ( sal_uInt16 i=0; !bFound && (i<nCount); i++ ) for ( sal_uInt16 i=0; i<nCount; ++i )
{ {
pData = pImp->GetRegion( i ); RegionData_Impl *pData = pImp->GetRegion( i );
if ( pData ) if ( pData )
{ {
sal_uInt16 nChildCount = pData->GetCount(); const sal_uInt16 nChildCount = pData->GetCount();
for ( sal_uInt16 j=0; !bFound && (j<nChildCount); j++ ) for ( sal_uInt16 j=0; j<nChildCount; ++j )
{ {
pEntry = pData->GetEntry( j ); DocTempl_EntryData_Impl *pEntry = pData->GetEntry( j );
if ( pEntry && pEntry->GetTargetURL() == aPath ) if ( pEntry && pEntry->GetTargetURL() == aPath )
{ {
bFound = true; rRegion = pData->GetTitle();
rName = pEntry->GetTitle();
return true;
} }
} }
} }
} }
if ( bFound ) return false;
{
rRegion = pData->GetTitle();
rName = pEntry->GetTitle();
}
return bFound;
} }
......
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