[Libreoffice-commits] core.git: stoc/source
Caolán McNamara
caolanm at redhat.com
Mon Mar 7 14:44:16 UTC 2016
stoc/source/inspect/introspection.cxx | 21 +++++++--------------
1 file changed, 7 insertions(+), 14 deletions(-)
New commits:
commit 5d58e77317c80d1e2002a9f81b7eab419df11bce
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Mar 7 13:55:10 2016 +0000
coverity#1353440 try and refactor to avoid Argument cannot be negative
Change-Id: I3a75e27ba1b721a99e0547b418df883e2c1753b4
diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx
index 0148540..1fff94f 100644
--- a/stoc/source/inspect/introspection.cxx
+++ b/stoc/source/inspect/introspection.cxx
@@ -308,7 +308,6 @@ sal_Int32 IntrospectionAccessStatic_Impl::getMethodIndex( const OUString& aMetho
}
// #95159 Check if full qualified name matches
- sal_Int32 iHashResult = -1;
sal_Int32 nSearchFrom = aMethodName.getLength();
while( true )
{
@@ -332,19 +331,17 @@ sal_Int32 IntrospectionAccessStatic_Impl::getMethodIndex( const OUString& aMetho
// 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;
+ const sal_Int32 iHashResult = aIt->second;
- const Reference<XIdlMethod> xMethod = maAllMethodSeq.at(iHashResult);
+ const Reference<XIdlMethod> xMethod = maAllMethodSeq[iHashResult];
Reference< XIdlClass > xMethClass = xMethod->getDeclaringClass();
if( xClass->equals( xMethClass ) )
{
- break;
+ return iHashResult;
}
else
{
- iHashResult = -1;
-
// Could also be another method with the same name
// Iterate over all methods
size_t nLen = maAllMethodSeq.size();
@@ -357,14 +354,10 @@ sal_Int32 IntrospectionAccessStatic_Impl::getMethodIndex( const OUString& aMetho
if( xClass->equals( xMethClass2 ) )
{
- iHashResult = i;
- break;
+ return i;
}
}
}
-
- if( iHashResult != -1 )
- break;
}
}
}
@@ -373,7 +366,7 @@ sal_Int32 IntrospectionAccessStatic_Impl::getMethodIndex( const OUString& aMetho
if( nSearchFrom < 0 )
break;
}
- return iHashResult;
+ return -1;
}
void IntrospectionAccessStatic_Impl::setPropertyValue( const Any& obj, const OUString& aPropertyName, const Any& aValue ) const
@@ -2378,7 +2371,7 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
{
sal_Int32 iHashResult = aIt->second;
- Reference<XIdlMethod> xExistingMethod = pAccess->maAllMethodSeq.at(iHashResult);
+ Reference<XIdlMethod> xExistingMethod = pAccess->maAllMethodSeq[iHashResult];
Reference< XIdlClass > xExistingMethClass =
xExistingMethod->getDeclaringClass();
@@ -2387,7 +2380,7 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
continue;
}
- pAccess->maAllMethodSeq.at(iAllExportedMethod) = rxMethod;
+ pAccess->maAllMethodSeq[iAllExportedMethod] = rxMethod;
// If a concept has been set, is the method "normal"?
sal_Int32& rMethodConcept_i = pLocalMethodConcepts[ i ];
More information about the Libreoffice-commits
mailing list