[Libreoffice-commits] .: stoc/source udkapi/com

2013-01-30 Thread Libreoffice Gerrit user
 stoc/source/corereflection/crefl.cxx   |   42 +++--
 stoc/source/registry_tdprovider/tdprovider.cxx |   17 -
 udkapi/com/sun/star/reflection/TypeDescriptionManager.idl  |   16 +++-
 udkapi/com/sun/star/reflection/TypeDescriptionProvider.idl |   13 ++--
 4 files changed, 59 insertions(+), 29 deletions(-)

New commits:
commit 2356a480fea6cac8cccaae85c9a2b6a312a9048c
Author: Stephan Bergmann sberg...@redhat.com
Date:   Wed Jan 30 17:46:38 2013 +0100

API CHANGE:  Make TypeDescriptionManager/Provider more consistent

...by letting their getByHierarchicalName methods return information about
UNO constants as X(Constant)TypeDescription values, just as for (alomst -- 
see
the odd enum member case) all other entities.  This will make future 
changes in
this area easier.

The only affected client I could find so far is the core reflection 
service, but
there might be more that I overlooked.

Change-Id: I6731f2914773d49e33eeaec6e256ff2e5409ad2d

diff --git a/stoc/source/corereflection/crefl.cxx 
b/stoc/source/corereflection/crefl.cxx
index 3357a54..a51f58a 100644
--- a/stoc/source/corereflection/crefl.cxx
+++ b/stoc/source/corereflection/crefl.cxx
@@ -21,6 +21,7 @@
 #include cppuhelper/implementationentry.hxx
 
 #include com/sun/star/lang/XComponent.hpp
+#include com/sun/star/reflection/XConstantTypeDescription.hpp
 #include com/sun/star/reflection/XTypeDescription.hpp
 #include com/sun/star/uno/RuntimeException.hpp
 
@@ -283,35 +284,42 @@ Any IdlReflectionServiceImpl::getByHierarchicalName( 
const OUString  rName )
 Any aRet( _aElements.getValue( rName ) );
 if (! aRet.hasValue())
 {
-// first look for constants exclusivly!
 aRet = _xTDMgr-getByHierarchicalName( rName );
-if (aRet.getValueTypeClass() == TypeClass_INTERFACE) // if no constant,
- // i.e. 
XTypeDescription for a type
+if (aRet.getValueTypeClass() == TypeClass_INTERFACE)
 {
 // type retrieved from tdmgr
 OSL_ASSERT( (*(Reference XInterface  
*)aRet.getValue())-queryInterface(
 ::getCppuType( (const Reference XTypeDescription  *)0 ) 
).hasValue() );
 
-// if you are interested in a type then CALL forName()!!!
-// this way is NOT recommended for types, because this method 
looks for constants first
+css::uno::Reference css::reflection::XConstantTypeDescription 
+ctd;
+if (aRet = ctd)
+{
+aRet = ctd-getConstantValue();
+}
+else
+{
+// if you are interested in a type then CALL forName()!!!
+// this way is NOT recommended for types, because this method 
looks for constants first
 
-// if td manager found some type, it will be in the cache 
(hopefully.. we just got it)
-// so the second retrieving via c typelib callback chain should 
succeed...
+// if td manager found some type, it will be in the cache 
(hopefully.. we just got it)
+// so the second retrieving via c typelib callback chain 
should succeed...
 
-// try to get _type_ by name
-typelib_TypeDescription * pTD = 0;
-typelib_typedescription_getByName( pTD, rName.pData );
+// try to get _type_ by name
+typelib_TypeDescription * pTD = 0;
+typelib_typedescription_getByName( pTD, rName.pData );
 
-aRet.clear(); // kick XTypeDescription interface
+aRet.clear(); // kick XTypeDescription interface
 
-if (pTD)
-{
-Reference XIdlClass  xIdlClass( constructClass( pTD ) );
-aRet.setValue( xIdlClass, ::getCppuType( (const Reference 
XIdlClass  *)0 ) );
-typelib_typedescription_release( pTD );
+if (pTD)
+{
+Reference XIdlClass  xIdlClass( constructClass( pTD ) );
+aRet.setValue( xIdlClass, ::getCppuType( (const 
Reference XIdlClass  *)0 ) );
+typelib_typedescription_release( pTD );
+}
 }
 }
-// else is constant
+// else is enum member(?)
 
 // update
 if (aRet.hasValue())
diff --git a/stoc/source/registry_tdprovider/tdprovider.cxx 
b/stoc/source/registry_tdprovider/tdprovider.cxx
index 87089a9..92dbc92 100644
--- a/stoc/source/registry_tdprovider/tdprovider.cxx
+++ b/stoc/source/registry_tdprovider/tdprovider.cxx
@@ -365,9 +365,10 @@ Any ProviderImpl::getByHierarchicalNameImpl( const 
OUString  rName )
 aBytes.getConstArray(), aBytes.getLength(),
 false, TYPEREG_VERSION_1);
 
-if (aReader.getTypeClass() == RT_TYPE_MODULE ||

[Libreoffice-commits] .: stoc/source svtools/source

2013-01-20 Thread Libreoffice Gerrit user
 stoc/source/inspect/introspection.cxx|1 -
 svtools/source/dialogs/ServerDetailsControls.cxx |4 +---
 2 files changed, 1 insertion(+), 4 deletions(-)

New commits:
commit 6172a95bb077fd43595e02084b5394516738844b
Author: Julien Nabet serval2...@yahoo.fr
Date:   Sun Jan 20 21:51:16 2013 +0100

Some cppcheck cleaning

Change-Id: Ie975903daa84ddafb2ba7d58e18b8ef20b331596

diff --git a/stoc/source/inspect/introspection.cxx 
b/stoc/source/inspect/introspection.cxx
index 5956088..ea62d4d 100644
--- a/stoc/source/inspect/introspection.cxx
+++ b/stoc/source/inspect/introspection.cxx
@@ -313,7 +313,6 @@ sal_Int32 IntrospectionAccessStatic_Impl::getMethodIndex( 
const ::rtl::OUString
 else
 {
 sal_Int32 nSearchFrom = aMethodName.getLength();
-nSearchFrom = aMethodName.getLength();
 while( true )
 {
 // Strategy: Search back until the first '_' is found
diff --git a/svtools/source/dialogs/ServerDetailsControls.cxx 
b/svtools/source/dialogs/ServerDetailsControls.cxx
index 8b10c10..3bdae1b 100644
--- a/svtools/source/dialogs/ServerDetailsControls.cxx
+++ b/svtools/source/dialogs/ServerDetailsControls.cxx
@@ -134,9 +134,7 @@ INetURLObject HostDetailsContainer::getUrl( )
 
 bool HostDetailsContainer::setUrl( const INetURLObject rUrl )
 {
-bool bSuccess = false;
-
-bSuccess = verifyScheme( INetURLObject::GetScheme( rUrl.GetProtocol( ) ) );
+bool bSuccess = verifyScheme( INetURLObject::GetScheme( rUrl.GetProtocol( 
) ) );
 
 if ( bSuccess )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: stoc/source

2012-05-25 Thread Stephan Bergmann
 stoc/source/invocation_adapterfactory/iafactory.cxx |   16 ++--
 1 file changed, 2 insertions(+), 14 deletions(-)

New commits:
commit 3f250092747263fb14a3f13c4509ebd02ec2fb2a
Author: Stephan Bergmann sberg...@redhat.com
Date:   Fri May 25 16:22:11 2012 +0200

Use simple createOneInstanceComponentFactory

...instead of static WeakReference and getGlobalMutex.  The latter allowed 
for
deadlock, when one thread is in __getTypeEntries
(cppuhelper/source/implbase_ex.cxx), having locked 
getImplHelperInitMutex(), and
from there calls some cppu_detail_getUnoType (from a cppumaker-generated 
header)
that tries to lock getGloblaMutex, while another thread is in this
FactoryImpl_create, having locked getGlobalMutex, and from there calls into
__getTypeEntries.

Change-Id: Iac68d28c1a5971049447cc79384b6e186f2a6d82

diff --git a/stoc/source/invocation_adapterfactory/iafactory.cxx 
b/stoc/source/invocation_adapterfactory/iafactory.cxx
index 337bdb1..361e798 100644
--- a/stoc/source/invocation_adapterfactory/iafactory.cxx
+++ b/stoc/source/invocation_adapterfactory/iafactory.cxx
@@ -943,19 +943,7 @@ static Reference XInterface  SAL_CALL FactoryImpl_create(
 const Reference XComponentContext   xContext )
 throw (Exception)
 {
-Reference XInterface  rRet;
-{
-MutexGuard guard( Mutex::getGlobalMutex() );
-static WeakReference  XInterface  rwInstance;
-rRet = rwInstance;
-
-if( ! rRet.is() )
-{
-rRet = (::cppu::OWeakObject *)new FactoryImpl( xContext );
-rwInstance = rRet;
-}
-}
-return rRet;
+return (::cppu::OWeakObject *)new FactoryImpl( xContext );
 }
 
 }
@@ -971,7 +959,7 @@ static struct ::cppu::ImplementationEntry g_entries[] =
 ::stoc_invadp::FactoryImpl_create,
 ::stoc_invadp::invadp_getImplementationName,
 ::stoc_invadp::invadp_getSupportedServiceNames,
-::cppu::createSingleComponentFactory,
+::cppu::createOneInstanceComponentFactory,
 ::stoc_invadp::g_moduleCount.modCnt , 0
 },
 { 0, 0, 0, 0, 0, 0 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: stoc/source

2012-01-15 Thread Stephan Bergmann
 stoc/source/security/lru_cache.h |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 2ca0ab44b4c0f028aa246c28da8fbff0c79a87b4
Author: Stephan Bergmann sberg...@redhat.com
Date:   Sun Jan 15 22:55:08 2012 +0100

Clang -Wunused-variable.

diff --git a/stoc/source/security/lru_cache.h b/stoc/source/security/lru_cache.h
index d4b5a8e..6853a37 100644
--- a/stoc/source/security/lru_cache.h
+++ b/stoc/source/security/lru_cache.h
@@ -242,6 +242,7 @@ inline void lru_cache t_key, t_val, t_hashKey, t_equalKey 
::set(
 #ifdef __CACHE_DIAGNOSE
 OSL_ENSURE( insertion.second, ### inserting new cache entry 
failed?! );
 #endif
+(void) insertion; // avoid warnings
 }
 else
 {
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: stoc/source

2012-01-12 Thread Olivier Hallot
 stoc/source/defaultregistry/defaultregistry.cxx   |   18 +++---
 stoc/source/implementationregistration/implreg.cxx|   16 +++---
 stoc/source/invocation/invocation.cxx |4 -
 stoc/source/javavm/javavm.cxx |   20 
+++
 stoc/source/loader/dllcomponentloader.cxx |2 
 stoc/source/proxy_factory/proxyfac.cxx|2 
 stoc/source/registry_tdprovider/rdbtdp_tdenumeration.cxx  |2 
 stoc/source/registry_tdprovider/tdcomp.cxx|2 
 stoc/source/registry_tdprovider/tdef.cxx  |2 
 stoc/source/registry_tdprovider/tdiface.cxx   |4 -
 stoc/source/registry_tdprovider/tdservice.cxx |4 -
 stoc/source/security/access_controller.cxx|   10 +--
 stoc/source/security/file_policy.cxx  |   10 +--
 stoc/source/security/permissions.cxx  |4 -
 stoc/source/servicemanager/servicemanager.cxx |4 -
 stoc/source/simpleregistry/simpleregistry.cxx |2 
 stoc/source/simpleregistry/textualservices.cxx|   26 
+-
 stoc/source/tdmanager/tdmgr.cxx   |2 
 stoc/source/tdmanager/tdmgr_check.cxx |2 
 stoc/source/uriproc/ExternalUriReferenceTranslator.cxx|4 -
 stoc/source/uriproc/UriReference.cxx  |   16 +++---
 stoc/source/uriproc/UriReferenceFactory.cxx   |   23 

 stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx |7 --
 stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx |8 +--
 24 files changed, 95 insertions(+), 99 deletions(-)

New commits:
commit 71dc235aba9597c3485a791a319a34e4258138db
Author: Olivier Hallot olivier.hal...@alta.org.br
Date:   Thu Jan 12 17:01:19 2012 -0200

Fix for fdo43460 Part XXXV getLength() to isEmpty()

Part XXXV
Modules
stoc

diff --git a/stoc/source/defaultregistry/defaultregistry.cxx 
b/stoc/source/defaultregistry/defaultregistry.cxx
index b80167a..da291d2 100644
--- a/stoc/source/defaultregistry/defaultregistry.cxx
+++ b/stoc/source/defaultregistry/defaultregistry.cxx
@@ -276,7 +276,7 @@ OUString NestedKeyImpl::computeName(const OUString name)
 return m_defaultKey-getResolvedName(name);
 }
 
-if ( resLocalName.getLength()  0  
m_pRegistry-m_defaultReg-isValid() )
+if ( !resLocalName.isEmpty()  m_pRegistry-m_defaultReg-isValid() )
 {
 ReferenceXRegistryKey 
localRoot(m_pRegistry-m_localReg-getRootKey());
 ReferenceXRegistryKey 
defaultRoot(m_pRegistry-m_defaultReg-getRootKey());
@@ -289,7 +289,7 @@ OUString NestedKeyImpl::computeName(const OUString name)
 {
 count--;
 
-if (resLocalName.getLength() == 0 || 
resDefaultName.getLength() == 0)
+if (resLocalName.isEmpty() || resDefaultName.isEmpty())
 throw InvalidRegistryException();
 
 resLocalName = localRoot-getResolvedName(resDefaultName);
@@ -683,7 +683,7 @@ Reference XRegistryKey  SAL_CALL NestedKeyImpl::openKey( 
const OUString aKeyN
 
 OUString resolvedName = computeName(aKeyName);
 
-if ( resolvedName.getLength() == 0 )
+if ( resolvedName.isEmpty() )
 throw InvalidRegistryException();
 
 ReferenceXRegistryKey localKey, defaultKey;
@@ -719,7 +719,7 @@ Reference XRegistryKey  SAL_CALL 
NestedKeyImpl::createKey( const OUString aKe
 
 OUString resolvedName = computeName(aKeyName);
 
-if ( resolvedName.getLength() == 0 )
+if ( resolvedName.isEmpty() )
 throw InvalidRegistryException();
 
 if ( m_localKey.is()  m_localKey-isValid() )
@@ -788,7 +788,7 @@ void SAL_CALL NestedKeyImpl::deleteKey( const OUString 
rKeyName )
 {
 OUString resolvedName = computeName(rKeyName);
 
-if ( resolvedName.getLength() == 0 )
+if ( resolvedName.isEmpty() )
 {
 throw InvalidRegistryException();
 }
@@ -969,7 +969,7 @@ sal_Bool SAL_CALL NestedKeyImpl::createLink( const 
OUString aLinkName, const OU
 
 resolvedName = computeName(linkName);
 
-if ( resolvedName.getLength() == 0 )
+if ( resolvedName.isEmpty() )
 {
 throw InvalidRegistryException();
 }
@@ -1023,7 +1023,7 @@ void SAL_CALL NestedKeyImpl::deleteLink( const OUString 
rLinkName )
 
 resolvedName = computeName(linkName);
 
-if ( resolvedName.getLength() == 0 )
+if ( resolvedName.isEmpty() )
 {
 throw InvalidRegistryException();
 }
@@ -1067,7 +1067,7 @@ OUString SAL_CALL NestedKeyImpl::getLinkTarget( const 
OUString rLinkName )
 
 

[Libreoffice-commits] .: stoc/source

2012-01-12 Thread Olivier Hallot
 stoc/source/simpleregistry/textualservices.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ba713b5add1dfbcd17f8e6c14561dd3589a3db72
Author: Olivier Hallot olivier.hal...@alta.org.br
Date:   Thu Jan 12 19:33:28 2012 -0200

Fix mistake in type OUStringBuffer

Fix mistake in method for type OUStringBuffer

diff --git a/stoc/source/simpleregistry/textualservices.cxx 
b/stoc/source/simpleregistry/textualservices.cxx
index 611d0ea..37540c8 100644
--- a/stoc/source/simpleregistry/textualservices.cxx
+++ b/stoc/source/simpleregistry/textualservices.cxx
@@ -422,7 +422,7 @@ rtl::OUString pathToString(std::vector rtl::OUString  
const  path) {
 buf.append(sal_Unicode('/'));
 buf.append(*i);
 }
-if (buf.isEmpty()) {
+if (buf.getLength() == 0) {
 buf.append(sal_Unicode('/'));
 }
 return buf.makeStringAndClear();
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: stoc/source stoc/test

2011-12-26 Thread Takeshi Abe
 stoc/source/implementationregistration/implreg.cxx  |6 +++---
 stoc/source/invocation/invocation.cxx   |2 +-
 stoc/source/javaloader/javaloader.cxx   |2 +-
 stoc/source/javavm/javavm.cxx   |8 
 stoc/source/loader/dllcomponentloader.cxx   |2 +-
 stoc/source/registry_tdprovider/functiondescription.cxx |2 +-
 stoc/source/registry_tdprovider/methoddescription.cxx   |2 +-
 stoc/source/registry_tdprovider/tdiface.cxx |4 ++--
 stoc/source/security/access_controller.cxx  |2 +-
 stoc/source/servicemanager/servicemanager.cxx   |6 +++---
 stoc/source/simpleregistry/textualservices.cxx  |2 +-
 stoc/source/tdmanager/tdmgr.cxx |8 
 stoc/source/uriproc/UriReferenceFactory.cxx |2 +-
 stoc/test/excomp/excomp.cxx |2 +-
 stoc/test/javavm/jvm_interaction/interactionhandler.cxx |   10 +-
 stoc/test/javavm/testjavavm.cxx |2 +-
 stoc/test/security/test_security.cxx|4 ++--
 stoc/test/testconv.cxx  |6 +++---
 stoc/test/testcorefl.cxx|2 +-
 stoc/test/testiadapter.cxx  |8 
 stoc/test/testintrosp.cxx   |8 
 stoc/test/testproxyfac.cxx  |4 ++--
 stoc/test/testregistry.cxx  |2 +-
 stoc/test/testsmgr2.cxx |2 +-
 stoc/test/testsmgr_cpnt.cxx |2 +-
 25 files changed, 50 insertions(+), 50 deletions(-)

New commits:
commit c936e5062770ba100c2eddd7889b51d271c6c73c
Author: Takeshi Abe t...@fixedpoint.jp
Date:   Tue Dec 27 00:12:38 2011 +0900

catch exception by constant reference

diff --git a/stoc/source/implementationregistration/implreg.cxx 
b/stoc/source/implementationregistration/implreg.cxx
index 69435a7..9fb148c 100644
--- a/stoc/source/implementationregistration/implreg.cxx
+++ b/stoc/source/implementationregistration/implreg.cxx
@@ -1025,7 +1025,7 @@ static void insert_singletons(
 buf.makeStringAndClear(), Reference 
XInterface () );
 }
 }
-catch (container::NoSuchElementException  exc)
+catch (const container::NoSuchElementException  exc)
 {
 throw RuntimeException(
 OUSTR(cannot get service type description: ) 
+ exc.Message,
@@ -1564,7 +1564,7 @@ void ImplementationRegistration::prepareRegister(
 {
 throw;
 }
-catch( InvalidRegistryException  e )
+catch( const InvalidRegistryException  e )
 {
 OUStringBuffer buf;
 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(
@@ -1575,7 +1575,7 @@ void ImplementationRegistration::prepareRegister(
 throw CannotRegisterImplementationException(
 buf.makeStringAndClear(), Reference XInterface  () );
 }
-catch( MergeConflictException  e )
+catch( const MergeConflictException  e )
 {
 OUStringBuffer buf;
 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(
diff --git a/stoc/source/invocation/invocation.cxx 
b/stoc/source/invocation/invocation.cxx
index 33496c6..fa034e6 100644
--- a/stoc/source/invocation/invocation.cxx
+++ b/stoc/source/invocation/invocation.cxx
@@ -614,7 +614,7 @@ void Invocation_Impl::setValue( const OUString 
PropertyName, const Any Value )
 {
 throw;
 }
-catch (Exception  exc)
+catch (const Exception  exc)
 {
 throw InvocationTargetException(
 OUString( RTL_CONSTASCII_USTRINGPARAM(exception occurred in 
setValue(): ) ) +
diff --git a/stoc/source/javaloader/javaloader.cxx 
b/stoc/source/javaloader/javaloader.cxx
index b30df67..62e4a1c 100644
--- a/stoc/source/javaloader/javaloader.cxx
+++ b/stoc/source/javaloader/javaloader.cxx
@@ -417,7 +417,7 @@ css::uno::ReferenceXInterface SAL_CALL 
JavaComponentLoader_CreateInstance(cons
 pStaticRef = new css::uno::Reference XInterface  ( xRet );
 }
 }
-catch(RuntimeException  runtimeException) {
+catch(const RuntimeException  runtimeException) {
 OString message = OUStringToOString(runtimeException.Message, 
RTL_TEXTENCODING_ASCII_US);
 osl_trace(javaloader - could not init javaloader cause of %s, 
message.getStr());
 throw;
diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx
index 33d8280..502031d 100644
--- a/stoc/source/javavm/javavm.cxx
+++ b/stoc/source/javavm/javavm.cxx
@@ -549,7 +549,7 @@ void initVMConfiguration(
 try {
   

Re: [Libreoffice] [Libreoffice-commits] .: stoc/source

2011-10-04 Thread Stephan Bergmann

On 10/04/2011 07:11 PM, Kevin Hunter wrote:

At 9:33am -0400 Mon, 03 Oct 2011, Tor Lillqvist wrote:

stoc/source/inspect/introspection.cxx | 9 -
1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 9e6d06a871b366cc72f9a23ab45080b66a47f144


Making my way through a backlog of commits ... it seems to me that it
doesn't matter why the for-loop was used in the first place, because now
it's not clean code, and the function could be made that much better.

I don't know much about the Reference or XIdlClass data types, but this
patch at least compiles on my machine, and I claim removes ambiguity
while remaining true to the came-before logic. It also removes the
overhead of recursion, as I don't think this algorithm needs it.


Hi Kevin,

Thanks a lot for the patch.  I think the real intent always was to 
actually look through all the returned getSuperclasses(), and the error 
that superclasses past the first one are effectively ignored has never 
been noticed.  (getSuperclasses() returning a sequence of length greater 
than one only happens for multiple-inheritance interface types, which 
are relatively rare.  And the isDerivedFrom in question is probably also 
not called that much.)


I will look into this tomorrow.  (I had this oddity on my list for a 
while now, anyway.)


-Stephan
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [Libreoffice-commits] .: stoc/source

2011-10-04 Thread Kevin Hunter

At 4:15pm -0400 Tue, 04 Oct 2011, Stephan Bergmann wrote:

Thanks a lot for the patch. I think the real intent always was to
actually look through all the returned getSuperclasses(), and the
error that superclasses past the first one are effectively ignored
has never been noticed.


Excellent.  Was wondering, but don't yet know LO well enough to make 
such declarations.  Well, modulo any errors on my part, the logic I sent 
in patch 1 should be the same as what was originally there, but I hope 
easier to read/see for comparison/fixing.


Here is a second patch that compiles, /should/ respond to what you just 
confirmed was the original intent, but is untested.  (It was a random 
drive by patching.)  Specifically, I suppose it's obvious that this now 
changes the semantics of it actually used to do.  If you know how to 
test it ...


Cheers,

Kevin
From 0543ea7fad724856ee1ed837129808815eb44480 Mon Sep 17 00:00:00 2001
From: Kevin Hunter hunt...@earlham.edu
Date: Tue, 4 Oct 2011 12:58:10 -0400
Subject: [PATCH] Fix logic of isDerivedFrom function

From an email conversation with Stephen Bergmann

I think the real intent always was to actually look through all the
returned getSuperclasses(), and the error that superclasses past the
first one are effectively ignored has never been noticed.
---
 stoc/source/inspect/introspection.cxx |   25 +++--
 1 files changed, 7 insertions(+), 18 deletions(-)

diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx
index 36f1acc..7d62578 100644
--- a/stoc/source/inspect/introspection.cxx
+++ b/stoc/source/inspect/introspection.cxx
@@ -110,29 +110,18 @@ sal_Bool isDerivedFrom( ReferenceXIdlClass xToTestClass, ReferenceXIdlClass
 {
 Sequence ReferenceXIdlClass  aClassesSeq = xToTestClass-getSuperclasses();
 const ReferenceXIdlClass* pClassesArray = aClassesSeq.getConstArray();
+
 sal_Int32 nSuperClassCount = aClassesSeq.getLength();
-sal_Int32 i;
-for( i = 0 ;
- i  nSuperClassCount ;
- /* No increment expression needed as the body always
-  * returns, and in fact MSVC warns about unreachable code if
-  * we include one. On the other hand, what's the point in
-  * using a for loop here then if all we ever will look at is
-  * pClassesArray[0] ?
-  */ )
+for ( sal_Int32 i = 0; i  nSuperClassCount; ++i )
 {
 const ReferenceXIdlClass rxClass = pClassesArray[i];
-if( xDerivedFromClass-equals( rxClass ) )
-{
-// Treffer
+
+if ( xDerivedFromClass-equals( rxClass ) ||
+ isDerivedFrom( rxClass, xDerivedFromClass )
+   )
 return sal_True;
-}
-else
-{
-// Rekursiv weitersuchen
-return isDerivedFrom( rxClass, xDerivedFromClass );
-}
 }
+
 return sal_False;
 }
 
-- 
1.7.1

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice