diff options
author | Kohei Yoshida <kohei.yoshida@suse.com> | 2011-08-11 11:54:13 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2011-08-16 21:22:41 -0400 |
commit | 23e922056586ee96b54d1e0540a54bce845b091b (patch) | |
tree | 6a74319b18835e4097ff9b3e60a52bd764757804 /eventattacher | |
parent | 5b55512e9ed418f8d22c800e58da0101ef243a12 (diff) |
Some micro-optimization with the string objects.
Diffstat (limited to 'eventattacher')
-rw-r--r-- | eventattacher/source/eventattacher.cxx | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/eventattacher/source/eventattacher.cxx b/eventattacher/source/eventattacher.cxx index 8aaaacea1727..06d48346604e 100644 --- a/eventattacher/source/eventattacher.cxx +++ b/eventattacher/source/eventattacher.cxx @@ -633,26 +633,21 @@ Reference<XEventListener> EventAttacherImpl::attachListenerForTarget( Reference< XEventListener > xRet = NULL; // Construct the name of the addListener-Method. - OUString aAddListenerName; - OUString aListenerName( aListenerType ); - sal_Int32 nIndex = aListenerName.lastIndexOf( '.' ); + sal_Int32 nIndex = aListenerType.lastIndexOf('.'); // set index to the interface name without package name if( nIndex == -1 ) // not found nIndex = 0; else nIndex++; - if( aListenerName[nIndex] == 'X' ) - // erase X from the interface name - aListenerName = aListenerName.copy( nIndex +1 ); - aAddListenerName = OUString( RTL_CONSTASCII_USTRINGPARAM( "add" ) ) + aListenerName; + + OUString aListenerName = (aListenerType[nIndex] == 'X') ? aListenerType.copy(nIndex+1) : aListenerType; + OUString aAddListenerName = OUString(RTL_CONSTASCII_USTRINGPARAM("add")) + aListenerName; // Send Methods to the correct addListener-Method Sequence< Reference< XIdlMethod > > aMethodSeq = xAccess->getMethods( MethodConcept::LISTENER ); - sal_uInt32 i, nLen = aMethodSeq.getLength(); const Reference< XIdlMethod >* pMethods = aMethodSeq.getConstArray(); - - for( i = 0 ; i < nLen ; i++ ) + for (sal_Int32 i = 0, n = aMethodSeq.getLength(); i < n ; ++i) { const Reference< XIdlMethod >& rxMethod = pMethods[i]; @@ -678,7 +673,6 @@ Reference<XEventListener> EventAttacherImpl::attachListenerForTarget( throw CannotCreateAdapterException(); xRet = Reference< XEventListener >( xAdapter, UNO_QUERY ); - // Just the Listener as parameter? if( nParamCount == 1 ) { |