summaryrefslogtreecommitdiff
path: root/stoc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-03-07 13:12:49 +0000
committerCaolán McNamara <caolanm@redhat.com>2016-03-07 13:23:49 +0000
commita998217202106f65e52f743db0cad8209d6ee972 (patch)
tree56da7576e614de01bee45a1192c43ba389b58634 /stoc
parent5f33f600f962c2cfaa1ed4994dbc3209a7b09813 (diff)
return early and drop else
Change-Id: I4887f01c94e6d7d716d2a074d503fca505a4aff8
Diffstat (limited to 'stoc')
-rw-r--r--stoc/source/inspect/introspection.cxx110
1 files changed, 54 insertions, 56 deletions
diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx
index 2393dd7e0510..0148540fea64 100644
--- a/stoc/source/inspect/introspection.cxx
+++ b/stoc/source/inspect/introspection.cxx
@@ -290,90 +290,88 @@ IntrospectionAccessStatic_Impl::IntrospectionAccessStatic_Impl( Reference< XIdlR
sal_Int32 IntrospectionAccessStatic_Impl::getPropertyIndex( const OUString& aPropertyName ) const
{
- sal_Int32 iHashResult = -1;
IntrospectionAccessStatic_Impl* pThis = const_cast<IntrospectionAccessStatic_Impl*>(this);
IntrospectionNameMap::iterator aIt = pThis->maPropertyNameMap.find( aPropertyName );
if (aIt != pThis->maPropertyNameMap.end())
- iHashResult = (*aIt).second;
- return iHashResult;
+ return aIt->second;
+
+ return -1;
}
sal_Int32 IntrospectionAccessStatic_Impl::getMethodIndex( const OUString& aMethodName ) const
{
- sal_Int32 iHashResult = -1;
IntrospectionAccessStatic_Impl* pThis = const_cast<IntrospectionAccessStatic_Impl*>(this);
IntrospectionNameMap::iterator aIt = pThis->maMethodNameMap.find( aMethodName );
if (aIt != pThis->maMethodNameMap.end())
{
- iHashResult = (*aIt).second;
+ return aIt->second;
}
+
// #95159 Check if full qualified name matches
- else
+ sal_Int32 iHashResult = -1;
+ sal_Int32 nSearchFrom = aMethodName.getLength();
+ while( true )
{
- sal_Int32 nSearchFrom = aMethodName.getLength();
- while( true )
- {
- // Strategy: Search back until the first '_' is found
- sal_Int32 nFound = aMethodName.lastIndexOf( '_', nSearchFrom );
- if( nFound == -1 )
- break;
+ // Strategy: Search back until the first '_' is found
+ sal_Int32 nFound = aMethodName.lastIndexOf( '_', nSearchFrom );
+ if( nFound == -1 )
+ break;
- OUString aPureMethodName = aMethodName.copy( nFound + 1 );
+ OUString aPureMethodName = aMethodName.copy( nFound + 1 );
- aIt = pThis->maMethodNameMap.find( aPureMethodName );
- if (aIt != pThis->maMethodNameMap.end())
+ aIt = pThis->maMethodNameMap.find( aPureMethodName );
+ if (aIt != pThis->maMethodNameMap.end())
+ {
+ // Check if it can be a type?
+ // Problem: Does not work if package names contain _ ?!
+ OUString aStr = aMethodName.copy( 0, nFound );
+ OUString aTypeName = aStr.replace( '_', '.' );
+ Reference< XIdlClass > xClass = mxCoreReflection->forName( aTypeName );
+ if( xClass.is() )
{
- // Check if it can be a type?
- // Problem: Does not work if package names contain _ ?!
- OUString aStr = aMethodName.copy( 0, nFound );
- OUString aTypeName = aStr.replace( '_', '.' );
- Reference< XIdlClass > xClass = mxCoreReflection->forName( aTypeName );
- if( xClass.is() )
- {
- // If this is a valid class it could be the right method
+ // If this is a valid class it could be the right method
- // Could be the right method, type has to be checked
- iHashResult = (*aIt).second;
+ // Could be the right method, type has to be checked
+ iHashResult = aIt->second;
- const Reference<XIdlMethod> xMethod = maAllMethodSeq.at(iHashResult);
+ const Reference<XIdlMethod> xMethod = maAllMethodSeq.at(iHashResult);
- Reference< XIdlClass > xMethClass = xMethod->getDeclaringClass();
- if( xClass->equals( xMethClass ) )
- {
- break;
- }
- else
- {
- iHashResult = -1;
+ Reference< XIdlClass > xMethClass = xMethod->getDeclaringClass();
+ if( xClass->equals( xMethClass ) )
+ {
+ break;
+ }
+ else
+ {
+ iHashResult = -1;
- // Could also be another method with the same name
- // Iterate over all methods
- size_t nLen = maAllMethodSeq.size();
- for (size_t i = 0; i < nLen; ++i)
+ // Could also be another method with the same name
+ // Iterate over all methods
+ size_t nLen = maAllMethodSeq.size();
+ for (size_t i = 0; i < nLen; ++i)
+ {
+ const Reference<XIdlMethod> xMethod2 = maAllMethodSeq[ i ];
+ if( xMethod2->getName() == aPureMethodName )
{
- const Reference<XIdlMethod> xMethod2 = maAllMethodSeq[ i ];
- if( xMethod2->getName() == aPureMethodName )
- {
- Reference< XIdlClass > xMethClass2 = xMethod2->getDeclaringClass();
+ Reference< XIdlClass > xMethClass2 = xMethod2->getDeclaringClass();
- if( xClass->equals( xMethClass2 ) )
- {
- iHashResult = i;
- break;
- }
+ if( xClass->equals( xMethClass2 ) )
+ {
+ iHashResult = i;
+ break;
}
}
-
- if( iHashResult != -1 )
- break;
}
+
+ if( iHashResult != -1 )
+ break;
}
}
-
- nSearchFrom = nFound - 1;
- if( nSearchFrom < 0 )
- break;
}
+
+ nSearchFrom = nFound - 1;
+ if( nSearchFrom < 0 )
+ break;
}
return iHashResult;
}
@@ -2378,7 +2376,7 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
}
else
{
- sal_Int32 iHashResult = (*aIt).second;
+ sal_Int32 iHashResult = aIt->second;
Reference<XIdlMethod> xExistingMethod = pAccess->maAllMethodSeq.at(iHashResult);