[Libreoffice-commits] .: cppu/source

2012-03-14 Thread Stephan Bergmann
 cppu/source/threadpool/current.cxx |   12 
 1 file changed, 12 deletions(-)

New commits:
commit ba6714d34f9896195bca3680da89febcf259e421
Author: Stephan Bergmann 
Date:   Wed Mar 14 15:20:04 2012 +0100

Dead code

diff --git a/cppu/source/threadpool/current.cxx 
b/cppu/source/threadpool/current.cxx
index 87b8c41..ce92209 100644
--- a/cppu/source/threadpool/current.cxx
+++ b/cppu/source/threadpool/current.cxx
@@ -47,18 +47,6 @@ using namespace ::com::sun::star::uno;
 namespace cppu
 {
 
-//--
-class SAL_NO_VTABLE XInterface
-{
-public:
-virtual void SAL_CALL slot_queryInterface() = 0;
-virtual void SAL_CALL acquire() throw () = 0;
-virtual void SAL_CALL release() throw () = 0;
-protected:
-~XInterface() {}
-// avoid warnings about virtual members and non-virtual dtor
-};
-//--
 static typelib_InterfaceTypeDescription * get_type_XCurrentContext()
 {
 static typelib_InterfaceTypeDescription * s_type_XCurrentContext = 0;
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: cppu/source

2012-02-10 Thread Stephan Bergmann
 cppu/source/threadpool/jobqueue.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit cba3ac1eab7acaf8e6efd7a00eee7c5e969fc49b
Author: Stephan Bergmann 
Date:   Fri Feb 10 16:25:11 2012 +0100

Avoid deadlocks when disposing recursive JobQueue::enter

...where the outer JobQueue::enter blocks on m_cndWait after it has been 
reset
again due to m_lstJob.empty().

diff --git a/cppu/source/threadpool/jobqueue.cxx 
b/cppu/source/threadpool/jobqueue.cxx
index 47418af..0864057 100644
--- a/cppu/source/threadpool/jobqueue.cxx
+++ b/cppu/source/threadpool/jobqueue.cxx
@@ -97,7 +97,9 @@ namespace cppu_threadpool {
 if( 0 == m_lstCallstack.front() )
 {
 // disposed !
-if( m_lstJob.empty() )
+if( m_lstJob.empty()
+&& (m_lstCallstack.empty()
+|| m_lstCallstack.front() != 0) )
 {
 osl_resetCondition( m_cndWait );
 }
@@ -110,7 +112,8 @@ namespace cppu_threadpool {
 job = m_lstJob.front();
 m_lstJob.pop_front();
 }
-if( m_lstJob.empty() )
+if( m_lstJob.empty()
+&& (m_lstCallstack.empty() || m_lstCallstack.front() != 0) 
)
 {
 osl_resetCondition( m_cndWait );
 }
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: cppu/source

2011-12-23 Thread Stephan Bergmann
 cppu/source/typelib/static_types.cxx |   39 +--
 1 file changed, 20 insertions(+), 19 deletions(-)

New commits:
commit c84a5ec4cb81eddb8bb382a6494c28df5131cb85
Author: Stephan Bergmann 
Date:   Fri Dec 23 18:56:18 2011 +0100

OSL_ASSERT -> assert

diff --git a/cppu/source/typelib/static_types.cxx 
b/cppu/source/typelib/static_types.cxx
index 5a5e415..f415c88 100644
--- a/cppu/source/typelib/static_types.cxx
+++ b/cppu/source/typelib/static_types.cxx
@@ -26,9 +26,11 @@
  *
  /
 
+#include "sal/config.h"
 
-#include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -226,7 +228,7 @@ CPPU_DLLPUBLIC typelib_TypeDescriptionReference ** SAL_CALL 
typelib_static_type_
 ::typelib_typedescriptionreference_release( pMembers[1] );
 ::typelib_typedescriptionreference_release( pMembers[2] );
 // Exception
-OSL_ASSERT( ! s_aTypes[typelib_TypeClass_EXCEPTION] );
+assert( ! s_aTypes[typelib_TypeClass_EXCEPTION] );
 {
 typelib_TypeDescription * pTD1 = 0;
 OUString sTypeName1( 
RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.Exception") );
@@ -341,7 +343,7 @@ CPPU_DLLPUBLIC void SAL_CALL 
typelib_static_sequence_type_init(
 aBuf.append( pElementType->pTypeName );
 OUString aTypeName( aBuf.makeStringAndClear() );
 
-OSL_ASSERT( ! 
TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(typelib_TypeClass_SEQUENCE) );
+assert( ! 
TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(typelib_TypeClass_SEQUENCE) );
 *ppRef = igetTypeByName( aTypeName.pData );
 if (!*ppRef)
 {
@@ -352,7 +354,7 @@ CPPU_DLLPUBLIC void SAL_CALL 
typelib_static_sequence_type_init(
 
 ::typelib_typedescription_register( &pReg );
 *ppRef = (typelib_TypeDescriptionReference *)pReg;
-OSL_ASSERT( *ppRef == pReg->pWeakRef );
+assert( *ppRef == pReg->pWeakRef );
 }
 // another static ref:
 ++((*ppRef)->nStaticRefCount);
@@ -370,15 +372,14 @@ void init(
 sal_Int32 nMembers, typelib_TypeDescriptionReference ** ppMembers,
 sal_Bool const * pParameterizedTypes)
 {
-OSL_ENSURE( typelib_TypeClass_STRUCT == eTypeClass ||
- typelib_TypeClass_EXCEPTION == eTypeClass, "### unexpected 
type class!" );
+assert( eTypeClass == typelib_TypeClass_STRUCT || eTypeClass == 
typelib_TypeClass_EXCEPTION );
 
 if (! *ppRef)
 {
 MutexGuard aGuard( typelib_StaticInitMutex::get() );
 if (! *ppRef)
 {
-OSL_ASSERT( ! 
TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(eTypeClass) );
+assert( ! 
TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(eTypeClass) );
 OUString aTypeName( OUString::createFromAscii( pTypeName ) );
 *ppRef = igetTypeByName( aTypeName.pData );
 if (!*ppRef)
@@ -392,9 +393,9 @@ void init(
 {
 ::typelib_typedescriptionreference_getDescription(
 (typelib_TypeDescription 
**)&pComp->pBaseTypeDescription, pBaseType );
-OSL_ASSERT( pComp->pBaseTypeDescription );
+assert( pComp->pBaseTypeDescription );
 nOffset = ((typelib_TypeDescription 
*)pComp->pBaseTypeDescription)->nSize;
-OSL_ENSURE( newAlignedSize( 0, ((typelib_TypeDescription 
*)pComp->pBaseTypeDescription)->nSize, ((typelib_TypeDescription 
*)pComp->pBaseTypeDescription)->nAlignment ) == ((typelib_TypeDescription 
*)pComp->pBaseTypeDescription)->nSize, "### unexpected offset!" );
+assert( newAlignedSize( 0, ((typelib_TypeDescription 
*)pComp->pBaseTypeDescription)->nSize, ((typelib_TypeDescription 
*)pComp->pBaseTypeDescription)->nAlignment ) == ((typelib_TypeDescription 
*)pComp->pBaseTypeDescription)->nSize ); // unexpected offset
 }
 
 if (nMembers)
@@ -414,7 +415,7 @@ void init(
 // write offset
 typelib_TypeDescription * pTD = 0;
 TYPELIB_DANGER_GET( &pTD, pComp->ppTypeRefs[i] );
-OSL_ENSURE( pTD->nSize, "### void member?" );
+assert( pTD->nSize ); // void member?
 nOffset = newAlignedSize( nOffset, pTD->nSize, 
pTD->nAlignment );
 pComp->pMemberOffsets[i] = nOffset - pTD->nSize;
 TYPELIB_DANGER_RELEASE( pTD );
@@ -436,7 +437,7 @@ void init(
 
 ::typelib_typedescription_register( &pReg );
 *ppRef = (typelib_TypeDescriptionReference *)pReg;
-OSL_ASSERT( *ppRef == pReg->pWeakRef );
+assert( *ppRef == pReg->pWeakRef );
 

[Libreoffice-commits] .: cppu/source

2011-12-19 Thread Caolán McNamara
 cppu/source/uno/sequence.cxx |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

New commits:
commit bc4c7b52a8cdeeb5db38cdf27950aff53bb8d07a
Author: Caolán McNamara 
Date:   Mon Dec 19 15:10:41 2011 +

get this to build under msvc 2008

diff --git a/cppu/source/uno/sequence.cxx b/cppu/source/uno/sequence.cxx
index 0c63598..5affbef 100644
--- a/cppu/source/uno/sequence.cxx
+++ b/cppu/source/uno/sequence.cxx
@@ -766,7 +766,7 @@ extern "C"
 {
 
 
//##
-CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_type_sequence_construct(
+sal_Bool SAL_CALL uno_type_sequence_construct(
 uno_Sequence ** ppSequence, typelib_TypeDescriptionReference * pType,
 void * pElements, sal_Int32 len,
 uno_AcquireFunc acquire )
@@ -810,7 +810,7 @@ CPPU_DLLPUBLIC sal_Bool SAL_CALL 
uno_type_sequence_construct(
 }
 
 
//##
-CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_sequence_construct(
+sal_Bool SAL_CALL uno_sequence_construct(
 uno_Sequence ** ppSequence, typelib_TypeDescription * pTypeDescr,
 void * pElements, sal_Int32 len,
 uno_AcquireFunc acquire )
@@ -849,7 +849,7 @@ CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_sequence_construct(
 }
 
 
//##
-CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_type_sequence_realloc(
+sal_Bool SAL_CALL uno_type_sequence_realloc(
 uno_Sequence ** ppSequence, typelib_TypeDescriptionReference * pType,
 sal_Int32 nSize, uno_AcquireFunc acquire, uno_ReleaseFunc release )
 SAL_THROW_EXTERN_C()
@@ -871,7 +871,7 @@ CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_type_sequence_realloc(
 }
 
 
//##
-CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_sequence_realloc(
+sal_Bool SAL_CALL uno_sequence_realloc(
 uno_Sequence ** ppSequence, typelib_TypeDescription * pTypeDescr,
 sal_Int32 nSize, uno_AcquireFunc acquire, uno_ReleaseFunc release )
 SAL_THROW_EXTERN_C()
@@ -890,7 +890,7 @@ CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_sequence_realloc(
 }
 
 
//##
-CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_type_sequence_reference2One(
+sal_Bool SAL_CALL uno_type_sequence_reference2One(
 uno_Sequence ** ppSequence,
 typelib_TypeDescriptionReference * pType,
 uno_AcquireFunc acquire, uno_ReleaseFunc release )
@@ -937,7 +937,7 @@ CPPU_DLLPUBLIC sal_Bool SAL_CALL 
uno_type_sequence_reference2One(
 }
 
 
//##
-CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_sequence_reference2One(
+sal_Bool SAL_CALL uno_sequence_reference2One(
 uno_Sequence ** ppSequence,
 typelib_TypeDescription * pTypeDescr,
 uno_AcquireFunc acquire, uno_ReleaseFunc release )
@@ -981,7 +981,7 @@ CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_sequence_reference2One(
 }
 
 
//##
-CPPU_DLLPUBLIC void SAL_CALL uno_sequence_assign(
+void SAL_CALL uno_sequence_assign(
 uno_Sequence ** ppDest,
 uno_Sequence * pSource,
 typelib_TypeDescription * pTypeDescr,
@@ -997,7 +997,7 @@ CPPU_DLLPUBLIC void SAL_CALL uno_sequence_assign(
 }
 
 
//##
-CPPU_DLLPUBLIC void SAL_CALL uno_type_sequence_assign(
+void SAL_CALL uno_type_sequence_assign(
 uno_Sequence ** ppDest,
 uno_Sequence * pSource,
 typelib_TypeDescriptionReference * pType,
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: cppu/source

2011-12-19 Thread Stephan Bergmann
 cppu/source/threadpool/thread.cxx |   25 +
 cppu/source/threadpool/thread.hxx |2 ++
 2 files changed, 27 insertions(+)

New commits:
commit b68640c44ecdb1df59d704cc6c2bae8bb412d7d0
Author: Stephan Bergmann 
Date:   Mon Dec 19 15:15:28 2011 +0100

Prevent creation of new ORequestThreads during shutdown.

diff --git a/cppu/source/threadpool/thread.cxx 
b/cppu/source/threadpool/thread.cxx
index 58aec56..cc22a45 100644
--- a/cppu/source/threadpool/thread.cxx
+++ b/cppu/source/threadpool/thread.cxx
@@ -30,12 +30,22 @@
 #include 
 #include 
 
+#include 
+#include 
+#include 
 #include 
+#include 
+#include 
 
 #include "thread.hxx"
 #include "jobqueue.hxx"
 #include "threadpool.hxx"
 
+namespace {
+
+namespace css = com::sun::star;
+
+}
 
 using namespace osl;
 extern "C" {
@@ -53,6 +63,8 @@ void SAL_CALL cppu_requestThreadWorker( void *pVoid )
 namespace cppu_threadpool {
 
 // 
--
+ThreadAdmin::ThreadAdmin(): m_disposed(false) {}
+
 ThreadAdmin::~ThreadAdmin()
 {
 #if OSL_DEBUG_LEVEL > 1
@@ -66,6 +78,15 @@ namespace cppu_threadpool {
 void ThreadAdmin::add( ORequestThread *p )
 {
 MutexGuard aGuard( m_mutex );
+if( m_disposed )
+{
+throw css::lang::DisposedException(
+rtl::OUString(
+RTL_CONSTASCII_USTRINGPARAM(
+"cppu_threadpool::ORequestThread created after"
+" cppu_threadpool::ThreadAdmin has been disposed")),
+css::uno::Reference< css::uno::XInterface >());
+}
 m_lst.push_back( p );
 }
 
@@ -79,6 +100,10 @@ namespace cppu_threadpool {
 
 void ThreadAdmin::join()
 {
+{
+MutexGuard aGuard( m_mutex );
+m_disposed = true;
+}
 ORequestThread *pCurrent;
 do
 {
diff --git a/cppu/source/threadpool/thread.hxx 
b/cppu/source/threadpool/thread.hxx
index bbef51e..a3ea45a 100644
--- a/cppu/source/threadpool/thread.hxx
+++ b/cppu/source/threadpool/thread.hxx
@@ -74,6 +74,7 @@ namespace cppu_threadpool {
 class ThreadAdmin
 {
 public:
+ThreadAdmin();
 ~ThreadAdmin ();
 static ThreadAdminHolder &getInstance();
 void add( ORequestThread * );
@@ -83,6 +84,7 @@ namespace cppu_threadpool {
 private:
 ::osl::Mutex m_mutex;
 ::std::list< ORequestThread * > m_lst;
+bool m_disposed;
 };
 
 } // end cppu_threadpool
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: cppu/source

2011-10-03 Thread Caolán McNamara
 cppu/source/uno/copy.hxx |   84 +++
 1 file changed, 27 insertions(+), 57 deletions(-)

New commits:
commit 424dcd6813acd267a2d686aaef185f9a6398fccb
Author: Caolán McNamara 
Date:   Mon Oct 3 16:41:16 2011 +0100

targeting gcc 4.6.1 gentoo strict-aliasing warnings

diff --git a/cppu/source/uno/copy.hxx b/cppu/source/uno/copy.hxx
index eee6363..6416c22 100644
--- a/cppu/source/uno/copy.hxx
+++ b/cppu/source/uno/copy.hxx
@@ -184,72 +184,57 @@ inline void _copyConstructAnyFromData(
 {
 case typelib_TypeClass_CHAR:
 pDestAny->pData = &pDestAny->pReserved;
-*(sal_Unicode *)&pDestAny->pReserved = *(sal_Unicode *)pSource;
+*(sal_Unicode *)pDestAny->pData = *(sal_Unicode *)pSource;
 break;
 case typelib_TypeClass_BOOLEAN:
 pDestAny->pData = &pDestAny->pReserved;
-*(sal_Bool *)&pDestAny->pReserved = (*(sal_Bool *)pSource != 
sal_False);
+*(sal_Bool *)pDestAny->pData = (*(sal_Bool *)pSource != sal_False);
 break;
 case typelib_TypeClass_BYTE:
 pDestAny->pData = &pDestAny->pReserved;
-*(sal_Int8 *)&pDestAny->pReserved = *(sal_Int8 *)pSource;
+*(sal_Int8 *)pDestAny->pData = *(sal_Int8 *)pSource;
 break;
 case typelib_TypeClass_SHORT:
 case typelib_TypeClass_UNSIGNED_SHORT:
 pDestAny->pData = &pDestAny->pReserved;
-*(sal_Int16 *)&pDestAny->pReserved = *(sal_Int16 *)pSource;
+*(sal_Int16 *)pDestAny->pData = *(sal_Int16 *)pSource;
 break;
 case typelib_TypeClass_LONG:
 case typelib_TypeClass_UNSIGNED_LONG:
 pDestAny->pData = &pDestAny->pReserved;
-*(sal_Int32 *)&pDestAny->pReserved = *(sal_Int32 *)pSource;
+*(sal_Int32 *)pDestAny->pData = *(sal_Int32 *)pSource;
 break;
 case typelib_TypeClass_HYPER:
 case typelib_TypeClass_UNSIGNED_HYPER:
 if (sizeof(void *) >= sizeof(sal_Int64))
-{
 pDestAny->pData = &pDestAny->pReserved;
-*(sal_Int64 *)&pDestAny->pReserved = *(sal_Int64 *)pSource;
-}
 else
-{
 pDestAny->pData = ::rtl_allocateMemory( sizeof(sal_Int64) );
-*(sal_Int64 *)pDestAny->pData = *(sal_Int64 *)pSource;
-}
+*(sal_Int64 *)pDestAny->pData = *(sal_Int64 *)pSource;
 break;
 case typelib_TypeClass_FLOAT:
 if (sizeof(void *) >= sizeof(float))
-{
 pDestAny->pData = &pDestAny->pReserved;
-*(float *)&pDestAny->pReserved = *(float *)pSource;
-}
 else
-{
 pDestAny->pData = ::rtl_allocateMemory( sizeof(float) );
-*(float *)pDestAny->pData = *(float *)pSource;
-}
+*(float *)pDestAny->pData = *(float *)pSource;
 break;
 case typelib_TypeClass_DOUBLE:
 if (sizeof(void *) >= sizeof(double))
-{
 pDestAny->pData = &pDestAny->pReserved;
-*(double *)&pDestAny->pReserved = *(double *)pSource;
-}
 else
-{
 pDestAny->pData = ::rtl_allocateMemory( sizeof(double) );
-*(double *)pDestAny->pData = *(double *)pSource;
-}
+*(double *)pDestAny->pData = *(double *)pSource;
 break;
 case typelib_TypeClass_STRING:
 ::rtl_uString_acquire( *(rtl_uString **)pSource );
 pDestAny->pData = &pDestAny->pReserved;
-*(rtl_uString **)&pDestAny->pReserved = *(rtl_uString **)pSource;
+*(rtl_uString **)pDestAny->pData = *(rtl_uString **)pSource;
 break;
 case typelib_TypeClass_TYPE:
 TYPE_ACQUIRE( *(typelib_TypeDescriptionReference **)pSource );
 pDestAny->pData = &pDestAny->pReserved;
-*(typelib_TypeDescriptionReference **)&pDestAny->pReserved = 
*(typelib_TypeDescriptionReference **)pSource;
+*(typelib_TypeDescriptionReference **)pDestAny->pData = 
*(typelib_TypeDescriptionReference **)pSource;
 break;
 case typelib_TypeClass_ANY:
 OSL_FAIL( "### unexpected nested any!" );
@@ -257,7 +242,7 @@ inline void _copyConstructAnyFromData(
 case typelib_TypeClass_ENUM:
 pDestAny->pData = &pDestAny->pReserved;
 // enum is forced to 32bit long
-*(sal_Int32 *)&pDestAny->pReserved = *(sal_Int32 *)pSource;
+*(sal_Int32 *)pDestAny->pData = *(sal_Int32 *)pSource;
 break;
 case typelib_TypeClass_STRUCT:
 case typelib_TypeClass_EXCEPTION:
@@ -318,7 +303,7 @@ inline void _copyConstructAnyFromData(
 pDestAny->pData = &pDestAny->pReserved;
 if (pTypeDescr)
 {
-*(uno_Sequence **)&pDestAny->pReserved = copyConstructSequence(
+*(uno_Sequence **)pDestAny->pData = copyConstructSequence(
 *(uno_Sequence **)pSource,
 ((typelib_IndirectTypeDescription *)pTypeDescr)->pType,
 acquire, mapping );
@@ -326,7 +311,7 @@ inline void _copyConstructAnyFromData(