[Libreoffice-commits] core.git: cppu/source

2022-06-01 Thread Stephan Bergmann (via logerrit)
 cppu/source/AffineBridge/AffineBridge.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 754eb1541a6ca709f78afbc7fb2b75f626562dcc
Author: Stephan Bergmann 
AuthorDate: Wed Jun 1 14:14:09 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Jun 1 16:43:29 2022 +0200

No need to call resume() on all already running thread

(This was there ever since the beginning in
85c2477a9479b08e49e651a8f6bede5b8b51613c "INTEGRATION: CWS bunoexttm", 
while for
the similar OuterThread it was always absent.)

Change-Id: I3c43f0e35435b6035f6a1f2a1ca9f104bd639689
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135240
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/cppu/source/AffineBridge/AffineBridge.cxx 
b/cppu/source/AffineBridge/AffineBridge.cxx
index 156d6eb9c7a0..3e2b01df1cca 100644
--- a/cppu/source/AffineBridge/AffineBridge.cxx
+++ b/cppu/source/AffineBridge/AffineBridge.cxx
@@ -245,7 +245,6 @@ void AffineBridge::v_callInto_v(uno_EnvCallee * pCallee, 
va_list * pParam)
 if (m_innerThreadId == 0) // no inner thread yet
 {
 m_pInnerThread.reset(new InnerThread(this));
-m_pInnerThread->resume();
 }
 
 bool bResetId = false;


[Libreoffice-commits] core.git: cppu/source include/o3tl

2022-05-29 Thread Stephan Bergmann (via logerrit)
 cppu/source/uno/eq.hxx   |  170 +--
 include/o3tl/intcmp.hxx  |  131 +
 include/o3tl/string_view.hxx |3 
 3 files changed, 232 insertions(+), 72 deletions(-)

New commits:
commit db3f072dd61cd06ac67f52324f9ca0d21609f508
Author: Stephan Bergmann 
AuthorDate: Sun May 29 17:01:28 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Sun May 29 19:38:46 2022 +0200

New o3tl::intcmp.hxx

...introducing o3tl::cmp_equal etc. implementing C++23 std::cmp_equal etc., 
plus
an o3tl::IntCmp wrapper around it for convenient operator syntax

Change-Id: I1d2e0d1aef99c531039fb83de31ed8e6036fde03
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135095
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/cppu/source/uno/eq.hxx b/cppu/source/uno/eq.hxx
index e81f0972e801..60a372886776 100644
--- a/cppu/source/uno/eq.hxx
+++ b/cppu/source/uno/eq.hxx
@@ -20,8 +20,8 @@
 
 #include 
 #include 
-#include 
 
+#include 
 #include 
 #include 
 
@@ -260,27 +260,6 @@ inline bool _equalSequence(
 }
 }
 
-template
-std::enable_if_t && std::is_signed_v, bool> equal(T1 
value1, T2 value2) {
-return value1 == value2;
-}
-
-template
-std::enable_if_t && std::is_unsigned_v, bool> 
equal(T1 value1, T2 value2) {
-return value1 >= 0 && static_cast>(value1) == 
value2;
-}
-
-template
-std::enable_if_t && std::is_signed_v, bool> 
equal(T1 value1, T2 value2) {
-return value2 >= 0 && value1 == 
static_cast>(value2);
-}
-
-template
-std::enable_if_t && std::is_unsigned_v, bool> 
equal(T1 value1, T2 value2)
-{
-return value1 == value2;
-}
-
 inline bool _equalData(
 void * pDest,
 typelib_TypeDescriptionReference * pDestType, typelib_TypeDescription * 
pDestTypeDescr,
@@ -316,19 +295,26 @@ inline bool _equalData(
 switch (eSourceTypeClass)
 {
 case typelib_TypeClass_BYTE:
-return equal(*static_cast(pDest), 
*static_cast(pSource));
+return o3tl::cmp_equal(
+*static_cast(pDest), *static_cast(pSource));
 case typelib_TypeClass_SHORT:
-return equal(*static_cast(pDest), 
*static_cast(pSource));
+return o3tl::cmp_equal(
+*static_cast(pDest), *static_cast(pSource));
 case typelib_TypeClass_UNSIGNED_SHORT:
-return equal(*static_cast(pDest), 
*static_cast(pSource));
+return o3tl::cmp_equal(
+*static_cast(pDest), *static_cast(pSource));
 case typelib_TypeClass_LONG:
-return equal(*static_cast(pDest), 
*static_cast(pSource));
+return o3tl::cmp_equal(
+*static_cast(pDest), *static_cast(pSource));
 case typelib_TypeClass_UNSIGNED_LONG:
-return equal(*static_cast(pDest), 
*static_cast(pSource));
+return o3tl::cmp_equal(
+*static_cast(pDest), *static_cast(pSource));
 case typelib_TypeClass_HYPER:
-return equal(*static_cast(pDest), 
*static_cast(pSource));
+return o3tl::cmp_equal(
+*static_cast(pDest), *static_cast(pSource));
 case typelib_TypeClass_UNSIGNED_HYPER:
-return equal(*static_cast(pDest), 
*static_cast(pSource));
+return o3tl::cmp_equal(
+*static_cast(pDest), *static_cast(pSource));
 case typelib_TypeClass_FLOAT:
 return (static_cast(*static_cast(pDest)) == 
*static_cast(pSource));
 case typelib_TypeClass_DOUBLE:
@@ -340,19 +326,26 @@ inline bool _equalData(
 switch (eSourceTypeClass)
 {
 case typelib_TypeClass_BYTE:
-return equal(*static_cast(pDest), 
*static_cast(pSource));
+return o3tl::cmp_equal(
+*static_cast(pDest), *static_cast(pSource));
 case typelib_TypeClass_SHORT:
-return equal(*static_cast(pDest), 
*static_cast(pSource));
+return o3tl::cmp_equal(
+*static_cast(pDest), *static_cast(pSource));
 case typelib_TypeClass_UNSIGNED_SHORT:
-return equal(*static_cast(pDest), 
*static_cast(pSource));
+return o3tl::cmp_equal(
+*static_cast(pDest), *static_cast(pSource));
 case typelib_TypeClass_LONG:
-return equal(*static_cast(pDest), 
*static_cast(pSource));
+return o3tl::cmp_equal(
+*static_cast(pDest), *static_cast(pSource));
 case typelib_TypeClass_UNSIGNED_LONG:
-return equal(*static_cast(pDest), 
*static_cast(pSource));
+return o3tl::cmp_equal(
+*static_cast(pDest), *static_cast(pSource));
 case typelib_TypeClass_HYPER:
-return equal(*static_cast(pDest), 
*static_cast(pSource));
+return o3tl::cmp_equal(
+*static_cast(pDest), *static_cast(pSource));
 case typelib_TypeClass_UNSIGNED_HYPER:
-

[Libreoffice-commits] core.git: cppu/source include/typelib

2022-05-29 Thread Stephan Bergmann (via logerrit)
 cppu/source/typelib/typelib.cxx   |   25 +
 include/typelib/typedescription.h |2 ++
 2 files changed, 7 insertions(+), 20 deletions(-)

New commits:
commit c3e9eb997f409f7fcf42659adedff43a8ade913d
Author: Stephan Bergmann 
AuthorDate: Tue May 24 16:54:24 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Sun May 29 16:42:33 2022 +0200

[API CHANGE] Deprecate unused typelib_setCacheSize and make it a no-op

...and simplify the remaining code using the (now const) nCacheSize

Change-Id: I4468cf223c158a318ba56ba63f5f60121c94f42d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134879
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index fddaa16baa3a..293b4e3248c4 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -161,7 +161,7 @@ typedef std::list< CallbackEntry > CallbackSet_Impl;
 typedef std::list< typelib_TypeDescription * > TypeDescriptionList_Impl;
 
 // # of cached elements
-static sal_Int32 nCacheSize = 256;
+constexpr auto nCacheSize = 256;
 
 namespace {
 
@@ -447,7 +447,7 @@ bool complete(typelib_TypeDescription ** ppTypeDescr, bool 
initTables) {
 
 // insert into the cache
 MutexGuard aGuard( rInit.maMutex );
-if( static_cast(rInit.maCache.size()) >= nCacheSize )
+if( rInit.maCache.size() >= nCacheSize )
 {
 typelib_typedescription_release( rInit.maCache.front() );
 rInit.maCache.pop_front();
@@ -2031,7 +2031,7 @@ extern "C" void SAL_CALL 
typelib_typedescription_getByName(
 
 // insert into the cache
 MutexGuard aGuard( rInit.maMutex );
-if( static_cast(rInit.maCache.size()) >= nCacheSize )
+if( rInit.maCache.size() >= nCacheSize )
 {
 typelib_typedescription_release( rInit.maCache.front() );
 rInit.maCache.pop_front();
@@ -2085,7 +2085,7 @@ extern "C" void SAL_CALL 
typelib_typedescriptionreference_new(
 
 // insert into the cache
 MutexGuard aGuard( rInit.maMutex );
-if( static_cast(rInit.maCache.size()) >= nCacheSize 
)
+if( rInit.maCache.size() >= nCacheSize )
 {
 typelib_typedescription_release( rInit.maCache.front() );
 rInit.maCache.pop_front();
@@ -2288,24 +2288,9 @@ extern "C" void SAL_CALL 
typelib_typedescriptionreference_assign(
 }
 
 
-extern "C" void SAL_CALL typelib_setCacheSize( sal_Int32 nNewSize )
+extern "C" void SAL_CALL typelib_setCacheSize( sal_Int32 )
 SAL_THROW_EXTERN_C()
 {
-OSL_ENSURE( nNewSize >= 0, "### illegal cache size given!" );
-if (nNewSize < 0)
-return;
-
-TypeDescriptor_Init_Impl  = Init();
-MutexGuard aGuard( rInit.maMutex );
-if (nNewSize < nCacheSize)
-{
-while (static_cast(rInit.maCache.size()) != nNewSize)
-{
-typelib_typedescription_release( rInit.maCache.front() );
-rInit.maCache.pop_front();
-}
-}
-nCacheSize = nNewSize;
 }
 
 
diff --git a/include/typelib/typedescription.h 
b/include/typelib/typedescription.h
index 59423bfd481b..a3e200d43738 100644
--- a/include/typelib/typedescription.h
+++ b/include/typelib/typedescription.h
@@ -720,6 +720,8 @@ CPPU_DLLPUBLIC void SAL_CALL 
typelib_typedescription_getByName(
 /** Sets size of type description cache.
 
 @param nNewSize new size of cache
+
+@deprecated  Do not use, it does not have any effect.
 */
 CPPU_DLLPUBLIC void SAL_CALL typelib_setCacheSize(
 sal_Int32 nNewSize )


[Libreoffice-commits] core.git: cppu/source

2022-05-23 Thread Michael Weghorn (via logerrit)
 cppu/source/uno/check.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 123bb44f4a23acad6acb0bdaf43705680d8739c9
Author: Michael Weghorn 
AuthorDate: Fri May 20 08:15:26 2022 +0200
Commit: Michael Weghorn 
CommitDate: Mon May 23 08:46:50 2022 +0200

Extend '-Werror=attributes' workaround to GCC versions < 12.1

Adapt the GCC version check from the workaround introduced
in

commit 2c6cea672a852b85cfb6d2e313d806f257481417
Date:   Wed May 18 10:46:55 2022 +0200

Work around bogus -Werror=attributes with old GCC

...after 9c3c6a6b661ea8f84c1285b07a502de5c98a1495 "Replace 
OFFSET_OF macro with
a function template", as seen at
,

> 
/home/tdf/lode/jenkins/workspace/lo_tb_master_linux_dbg/cppu/source/uno/check.cxx:263:28:
 error: ‘maybe_unused’ attribute ignored [-Werror=attributes]
>  [[maybe_unused]] Char3 chars;
> ^

(Not sure which versions of GCC are affected exactly; lets restrict 
this to

to all versions before 12.1.

My GCC 11.3.0 build on Debian testing failed just the
same way otherwise.

A `git log --grep=maybe_unused` in the GCC git repo suggests
that this is no longer necessary from the following
GCC 12.1 commit [1] on:

commit c0f769fa3114ea852a26d93f0ee3f9595463de0b
Author: Jason Merrill 
Date:   Fri Jun 11 16:10:50 2021 -0400

c-family: don't warn for [[maybe_unused]] on data member

The C++17 standard (and C2x) says that [[maybe_unused]] may be 
applied to a
non-static data member, so we shouldn't warn about it.  And I don't 
see a
reason not to handle a FIELD_DECL the same as any other decl, by 
setting
TREE_USED on it.  It doesn't look like anything yet cares about 
that flag on
a FIELD_DECL, but setting it shouldn't hurt.

gcc/c-family/ChangeLog:

* c-attribs.c (handle_unused_attribute): Handle FIELD_DECL.

gcc/testsuite/ChangeLog:

* g++.dg/ext/attrib62.C: No longer warn.
* g++.dg/diagnostic/maybe_unused1.C: New test.

gcc/ChangeLog:

* doc/extend.texi (unused variable attribute): Applies to
structure fields as well.

[1] 
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=c0f769fa3114ea852a26d93f0ee3f9595463de0b

Change-Id: I815e4a24da13e0ae66b1dff2941e636c7ebdfd9c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134653
Reviewed-by: Stephan Bergmann 
Tested-by: Jenkins

diff --git a/cppu/source/uno/check.cxx b/cppu/source/uno/check.cxx
index e08b0065c4ed..561434aa55f3 100644
--- a/cppu/source/uno/check.cxx
+++ b/cppu/source/uno/check.cxx
@@ -260,12 +260,12 @@ static_assert(sizeof(second) == sizeof(int), 
"sizeof(second) != sizeof(int)");
 
 struct Char4
 {
-#if defined __GNUC__ && __GNUC__ == 7 && !defined __clang__
+#if defined __GNUC__ && (__GNUC__ < 12 || (__GNUC__ == 12 && __GNUC_MINOR__ < 
1)) && !defined __clang__
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wattributes"
 #endif
 [[maybe_unused]] Char3 chars;
-#if defined __GNUC__ && __GNUC__ == 7 && !defined __clang__
+#if defined __GNUC__ && (__GNUC__ < 12 || (__GNUC__ == 12 && __GNUC_MINOR__ < 
1)) && !defined __clang__
 #pragma GCC diagnostic pop
 #endif
 char c;


[Libreoffice-commits] core.git: cppu/source

2022-05-18 Thread Stephan Bergmann (via logerrit)
 cppu/source/uno/check.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit 2c6cea672a852b85cfb6d2e313d806f257481417
Author: Stephan Bergmann 
AuthorDate: Wed May 18 10:46:55 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Wed May 18 11:42:14 2022 +0200

Work around bogus -Werror=attributes with old GCC

...after 9c3c6a6b661ea8f84c1285b07a502de5c98a1495 "Replace OFFSET_OF macro 
with
a function template", as seen at
,

> 
/home/tdf/lode/jenkins/workspace/lo_tb_master_linux_dbg/cppu/source/uno/check.cxx:263:28:
 error: ‘maybe_unused’ attribute ignored [-Werror=attributes]
>  [[maybe_unused]] Char3 chars;
> ^

(Not sure which versions of GCC are affected exactly; lets restrict this to
GCC 7 for now.)

Change-Id: I28ec8914b60c98dce769ad40ef4141aec4960aa3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134509
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/cppu/source/uno/check.cxx b/cppu/source/uno/check.cxx
index 60ab3dba4e30..e08b0065c4ed 100644
--- a/cppu/source/uno/check.cxx
+++ b/cppu/source/uno/check.cxx
@@ -260,7 +260,14 @@ static_assert(sizeof(second) == sizeof(int), 
"sizeof(second) != sizeof(int)");
 
 struct Char4
 {
+#if defined __GNUC__ && __GNUC__ == 7 && !defined __clang__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wattributes"
+#endif
 [[maybe_unused]] Char3 chars;
+#if defined __GNUC__ && __GNUC__ == 7 && !defined __clang__
+#pragma GCC diagnostic pop
+#endif
 char c;
 };
 


[Libreoffice-commits] core.git: cppu/source

2022-05-17 Thread Noel Grandin (via logerrit)
 cppu/source/helper/purpenv/Proxy.hxx|2 -
 cppu/source/helper/purpenv/helper_purpenv_Proxy.cxx |5 ++-
 cppu/source/threadpool/thread.cxx   |9 +++---
 cppu/source/threadpool/thread.hxx   |4 +-
 cppu/source/threadpool/threadpool.cxx   |3 +-
 cppu/source/threadpool/threadpool.hxx   |2 -
 cppu/source/uno/IdentityMapping.cxx |7 ++---
 cppu/source/uno/lbenv.cxx   |7 ++---
 cppu/source/uno/lbmap.cxx   |   27 ++--
 9 files changed, 36 insertions(+), 30 deletions(-)

New commits:
commit e0559fb4c97208f39fedebdf7e4fcd084a165318
Author: Noel Grandin 
AuthorDate: Tue May 17 13:57:08 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue May 17 17:36:36 2022 +0200

clang-tidy modernize-pass-by-value in cppu

Change-Id: I7f6432b9609d175ff7e21ff2e73991275eea60b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134473
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/cppu/source/helper/purpenv/Proxy.hxx 
b/cppu/source/helper/purpenv/Proxy.hxx
index 953abbf3b449..02c65a23a198 100644
--- a/cppu/source/helper/purpenv/Proxy.hxx
+++ b/cppu/source/helper/purpenv/Proxy.hxx
@@ -47,7 +47,7 @@ class Proxy : public uno_Interface
 void  * m_pProbeContext;
 
 public:
-explicit Proxy(css::uno::Mappingconst & to_from,
+explicit Proxy(css::uno::Mappingto_from,
uno_Environment* pTo,
uno_Environment* pFrom,
uno_Interface  * pUnoI,
diff --git a/cppu/source/helper/purpenv/helper_purpenv_Proxy.cxx 
b/cppu/source/helper/purpenv/helper_purpenv_Proxy.cxx
index f62241fe13d6..db4820fc9a45 100644
--- a/cppu/source/helper/purpenv/helper_purpenv_Proxy.cxx
+++ b/cppu/source/helper/purpenv/helper_purpenv_Proxy.cxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace com::sun::star;
 
@@ -188,7 +189,7 @@ static void s_acquireAndRegister_v(va_list * pParam)
 }
 }
 
-Proxy::Proxy(uno::Mapping  const & to_from,
+Proxy::Proxy(uno::Mapping  to_from,
  uno_Environment * pTo,
  uno_Environment * pFrom,
  uno_Interface   * pUnoI,
@@ -201,7 +202,7 @@ Proxy::Proxy(uno::Mapping  const & to_from,
   m_from (pFrom),
   m_to   (pTo),
   m_from_to  (pFrom, pTo),
-  m_to_from  (to_from),
+  m_to_from  (std::move(to_from)),
   m_pUnoI(pUnoI),
   m_pTypeDescr   (pTypeDescr),
   m_aOId (rOId),
diff --git a/cppu/source/threadpool/thread.cxx 
b/cppu/source/threadpool/thread.cxx
index c0c3bc9ae61d..56e52838be85 100644
--- a/cppu/source/threadpool/thread.cxx
+++ b/cppu/source/threadpool/thread.cxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "thread.hxx"
 #include "jobqueue.hxx"
@@ -90,13 +91,13 @@ namespace cppu_threadpool {
 }
 
 
-ORequestThread::ORequestThread( ThreadPoolHolder const ,
+ORequestThread::ORequestThread( ThreadPoolHolder aThreadPool,
 JobQueue *pQueue,
-const ByteSequence ,
+ByteSequence aThreadId,
 bool bAsynchron )
-: m_aThreadPool( aThreadPool )
+: m_aThreadPool(std::move( aThreadPool ))
 , m_pQueue( pQueue )
-, m_aThreadId( aThreadId )
+, m_aThreadId(std::move( aThreadId ))
 , m_bAsynchron( bAsynchron )
 {}
 
diff --git a/cppu/source/threadpool/thread.hxx 
b/cppu/source/threadpool/thread.hxx
index 9873c214737e..5d03de88e103 100644
--- a/cppu/source/threadpool/thread.hxx
+++ b/cppu/source/threadpool/thread.hxx
@@ -35,9 +35,9 @@ namespace cppu_threadpool {
 public salhelper::SimpleReferenceObject, public osl::Thread
 {
 public:
-ORequestThread( ThreadPoolHolder const ,
+ORequestThread( ThreadPoolHolder aThreadPool,
 JobQueue * ,
-const ::rtl::ByteSequence ,
+::rtl::ByteSequence aThreadId,
 bool bAsynchron );
 virtual ~ORequestThread() override;
 
diff --git a/cppu/source/threadpool/threadpool.cxx 
b/cppu/source/threadpool/threadpool.cxx
index 512ddb095cd2..897bebed9ac4 100644
--- a/cppu/source/threadpool/threadpool.cxx
+++ b/cppu/source/threadpool/threadpool.cxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -39,7 +40,7 @@ using namespace ::rtl;
 namespace cppu_threadpool
 {
 WaitingThread::WaitingThread(
-rtl::Reference 

[Libreoffice-commits] core.git: cppu/source

2022-05-09 Thread Noel Grandin (via logerrit)
 cppu/source/uno/lbmap.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit f0ed5d46373f34a78a260617cf22606f7fd3c399
Author: Noel Grandin 
AuthorDate: Sun May 8 19:40:03 2022 +0200
Commit: Noel Grandin 
CommitDate: Mon May 9 10:15:24 2022 +0200

osl::Mutex->std::mutex in cppu::MappingsData

Change-Id: I34292537e9724d7667ba099285c87a32ae13ffad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134028
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx
index 43818eb85025..102ef135ef1a 100644
--- a/cppu/source/uno/lbmap.cxx
+++ b/cppu/source/uno/lbmap.cxx
@@ -154,7 +154,7 @@ struct MappingsData
 t_OUString2EntryaName2Entry;
 t_Mapping2Entry aMapping2Entry;
 
-Mutex   aCallbacksMutex;
+std::mutex  aCallbacksMutex;
 std::set< uno_getMappingFunc >
 aCallbacks;
 
@@ -621,7 +621,7 @@ void SAL_CALL uno_getMapping(
 
 // try callback chain
 {
-MutexGuard aGuard(rData.aCallbacksMutex);
+std::unique_lock aGuard(rData.aCallbacksMutex);
 for (const auto& rCallback : rData.aCallbacks)
 {
 (*rCallback)(ppMapping, pFrom, pTo, aAddPurpose.pData);
@@ -735,7 +735,7 @@ void SAL_CALL uno_registerMappingCallback(
 {
 OSL_ENSURE( pCallback, "### null ptr!" );
 MappingsData & rData = getMappingsData();
-MutexGuard aGuard( rData.aCallbacksMutex );
+std::unique_lock aGuard( rData.aCallbacksMutex );
 rData.aCallbacks.insert( pCallback );
 }
 
@@ -745,7 +745,7 @@ void SAL_CALL uno_revokeMappingCallback(
 {
 OSL_ENSURE( pCallback, "### null ptr!" );
 MappingsData & rData = getMappingsData();
-MutexGuard aGuard( rData.aCallbacksMutex );
+std::unique_lock aGuard( rData.aCallbacksMutex );
 rData.aCallbacks.erase( pCallback );
 }
 } // extern "C"


[Libreoffice-commits] core.git: cppu/source

2022-04-21 Thread Noel Grandin (via logerrit)
 cppu/source/uno/EnvStack.cxx |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit cdfd4d6c9a8cebe55a85624aaaff2664f270b247
Author: Noel Grandin 
AuthorDate: Thu Apr 21 13:56:39 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu Apr 21 15:29:33 2022 +0200

use more string_view in cppu

Change-Id: Id6b33eb39917ce7b805ea4a5d713d5d78aaa93ff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133257
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/cppu/source/uno/EnvStack.cxx b/cppu/source/uno/EnvStack.cxx
index 2daf56a21a79..34fea77f46bd 100644
--- a/cppu/source/uno/EnvStack.cxx
+++ b/cppu/source/uno/EnvStack.cxx
@@ -172,7 +172,7 @@ static int s_getNextEnv(uno_Environment ** ppEnv, 
uno_Environment * pCurrEnv, un
 {
 int res = 0;
 
-OUString nextPurpose;
+std::u16string_view nextPurpose;
 
 OUString currPurpose;
 if (pCurrEnv)
@@ -186,7 +186,7 @@ static int s_getNextEnv(uno_Environment ** ppEnv, 
uno_Environment * pCurrEnv, un
 if (currPurpose.getLength() > intermPurpose.getLength())
 {
 sal_Int32 idx = currPurpose.lastIndexOf(':');
-nextPurpose = currPurpose.copy(0, idx);
+nextPurpose = currPurpose.subView(0, idx);
 
 res = -1;
 }
@@ -197,14 +197,14 @@ static int s_getNextEnv(uno_Environment ** ppEnv, 
uno_Environment * pCurrEnv, un
 nextPurpose = targetPurpose;
 
 else
-nextPurpose = targetPurpose.copy(0, idx);
+nextPurpose = targetPurpose.subView(0, idx);
 
 res = 1;
 }
 
-if (!nextPurpose.isEmpty())
+if (!nextPurpose.empty())
 {
-OUString next_envDcp = UNO_LB_UNO + nextPurpose;
+OUString next_envDcp = OUString::Concat(UNO_LB_UNO) + nextPurpose;
 uno_getEnvironment(ppEnv, next_envDcp.pData, nullptr);
 }
 else


[Libreoffice-commits] core.git: cppu/source

2022-04-14 Thread Stephan Bergmann (via logerrit)
 cppu/source/uno/eq.hxx |  128 +++--
 1 file changed, 71 insertions(+), 57 deletions(-)

New commits:
commit 9a42c99d7b3e8a8429f14d7d851f3d186fa04594
Author: Stephan Bergmann 
AuthorDate: Wed Apr 13 17:45:52 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Apr 14 10:21:42 2022 +0200

Simplify equality comparison among the various UNOIDL integer types

Change-Id: I67b11049938de470a2a5096cac376fdb0529ab5c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132992
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/cppu/source/uno/eq.hxx b/cppu/source/uno/eq.hxx
index 6287cdcc3506..e81f0972e801 100644
--- a/cppu/source/uno/eq.hxx
+++ b/cppu/source/uno/eq.hxx
@@ -20,6 +20,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -259,6 +260,27 @@ inline bool _equalSequence(
 }
 }
 
+template
+std::enable_if_t && std::is_signed_v, bool> equal(T1 
value1, T2 value2) {
+return value1 == value2;
+}
+
+template
+std::enable_if_t && std::is_unsigned_v, bool> 
equal(T1 value1, T2 value2) {
+return value1 >= 0 && static_cast>(value1) == 
value2;
+}
+
+template
+std::enable_if_t && std::is_signed_v, bool> 
equal(T1 value1, T2 value2) {
+return value2 >= 0 && value1 == 
static_cast>(value2);
+}
+
+template
+std::enable_if_t && std::is_unsigned_v, bool> 
equal(T1 value1, T2 value2)
+{
+return value1 == value2;
+}
+
 inline bool _equalData(
 void * pDest,
 typelib_TypeDescriptionReference * pDestType, typelib_TypeDescription * 
pDestTypeDescr,
@@ -294,20 +316,19 @@ inline bool _equalData(
 switch (eSourceTypeClass)
 {
 case typelib_TypeClass_BYTE:
-return (*static_cast(pDest) == *static_cast(pSource));
+return equal(*static_cast(pDest), 
*static_cast(pSource));
 case typelib_TypeClass_SHORT:
-return (static_cast(*static_cast(pDest)) == 
*static_cast(pSource));
+return equal(*static_cast(pDest), 
*static_cast(pSource));
 case typelib_TypeClass_UNSIGNED_SHORT:
-return (static_cast(*static_cast(pDest)) == 
static_cast(*static_cast(pSource)));
+return equal(*static_cast(pDest), 
*static_cast(pSource));
 case typelib_TypeClass_LONG:
-return (static_cast(*static_cast(pDest)) == 
*static_cast(pSource));
+return equal(*static_cast(pDest), 
*static_cast(pSource));
 case typelib_TypeClass_UNSIGNED_LONG:
-return (static_cast(*static_cast(pDest)) == 
static_cast(*static_cast(pSource)));
+return equal(*static_cast(pDest), 
*static_cast(pSource));
 case typelib_TypeClass_HYPER:
-return (static_cast(*static_cast(pDest)) == 
*static_cast(pSource));
+return equal(*static_cast(pDest), 
*static_cast(pSource));
 case typelib_TypeClass_UNSIGNED_HYPER:
-return (*static_cast(pDest) >= 0 &&
-static_cast(*static_cast(pDest)) == 
*static_cast(pSource)); // same size
+return equal(*static_cast(pDest), 
*static_cast(pSource));
 case typelib_TypeClass_FLOAT:
 return (static_cast(*static_cast(pDest)) == 
*static_cast(pSource));
 case typelib_TypeClass_DOUBLE:
@@ -319,20 +340,19 @@ inline bool _equalData(
 switch (eSourceTypeClass)
 {
 case typelib_TypeClass_BYTE:
-return (*static_cast(pDest) == 
static_cast(*static_cast(pSource)));
+return equal(*static_cast(pDest), 
*static_cast(pSource));
 case typelib_TypeClass_SHORT:
-return (*static_cast(pDest) == *static_cast(pSource));
+return equal(*static_cast(pDest), 
*static_cast(pSource));
 case typelib_TypeClass_UNSIGNED_SHORT:
-return (static_cast(*static_cast(pDest)) 
== static_cast(*static_cast(pSource)));
+return equal(*static_cast(pDest), 
*static_cast(pSource));
 case typelib_TypeClass_LONG:
-return (static_cast(*static_cast(pDest)) 
== *static_cast(pSource));
+return equal(*static_cast(pDest), 
*static_cast(pSource));
 case typelib_TypeClass_UNSIGNED_LONG:
-return (static_cast(*static_cast(pDest)) 
== static_cast(*static_cast(pSource)));
+return equal(*static_cast(pDest), 
*static_cast(pSource));
 case typelib_TypeClass_HYPER:
-return (static_cast(*static_cast(pDest)) 
== *static_cast(pSource));
+return equal(*static_cast(pDest), 
*static_cast(pSource));
 case typelib_TypeClass_UNSIGNED_HYPER:
-return (*static_cast(pDest) >= 0 &&
-static_cast(*static_cast(pDest)) 
== *static_cast(pSource)); // same size
+return equal(*static_cast(pDest), 
*static_cast(pSource));
 case typelib_TypeClass_FLOAT:
 return (static_cast(*static_cast(pDest)) == 
*static_cast(pSource));
 case typelib_TypeClass_DOUBLE:
@@ -344,19 

[Libreoffice-commits] core.git: cppu/source stoc/source

2022-04-09 Thread Noel Grandin (via logerrit)
 cppu/source/typelib/typelib.cxx  |5 +++--
 stoc/source/security/permissions.cxx |   11 ++-
 2 files changed, 9 insertions(+), 7 deletions(-)

New commits:
commit 035c9fc7ecaf0fce032748f47450fb31cc62d65a
Author: Noel Grandin 
AuthorDate: Sat Apr 9 09:42:26 2022 +0200
Commit: Noel Grandin 
CommitDate: Sat Apr 9 13:26:39 2022 +0200

use more subView when converting to Int32

Change-Id: Ia1be48050cca386a6e765aa2229de1bc9e64
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132749
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index d659171f1722..fddaa16baa3a 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "typelib.hxx"
 
 using namespace osl;
@@ -1984,8 +1985,8 @@ extern "C" void SAL_CALL 
typelib_typedescription_getByName(
 , name.copy(i4 + 1).pData);
 if (!createDerivedInterfaceMemberDescription(
 ppRet, name, pBaseRef, pBase, pInterface,
-name.copy(i2, i3 - i2).toInt32(),
-name.copy(i3 + 1, i4 - i3 - 1).toInt32()))
+o3tl::toInt32(name.subView(i2, i3 - i2)),
+o3tl::toInt32(name.subView(i3 + 1, i4 - i3 - 1
 {
 if (pInterface != nullptr) {
 typelib_typedescription_release(pInterface);
diff --git a/stoc/source/security/permissions.cxx 
b/stoc/source/security/permissions.cxx
index 1d7aca177344..8fa8bdd831cd 100644
--- a/stoc/source/security/permissions.cxx
+++ b/stoc/source/security/permissions.cxx
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -148,20 +149,20 @@ SocketPermission::SocketPermission(
 sal_Int32 minus = m_host.indexOf( '-', colon +1 );
 if (minus < 0)
 {
-m_lowerPort = m_upperPort = m_host.copy( colon +1 ).toInt32();
+m_lowerPort = m_upperPort = o3tl::toInt32(m_host.subView( colon +1 ));
 }
 else if (minus == (colon +1)) // -N
 {
-m_upperPort = m_host.copy( minus +1 ).toInt32();
+m_upperPort = o3tl::toInt32(m_host.subView( minus +1 ));
 }
 else if (minus == (m_host.getLength() -1)) // N-
 {
-m_lowerPort = m_host.copy( colon +1, m_host.getLength() -1 -colon -1 
).toInt32();
+m_lowerPort = o3tl::toInt32(m_host.subView( colon +1, 
m_host.getLength() -1 -colon -1 ));
 }
 else // A-B
 {
-m_lowerPort = m_host.copy( colon +1, minus - colon -1 ).toInt32();
-m_upperPort = m_host.copy( minus +1 ).toInt32();
+m_lowerPort = o3tl::toInt32(m_host.subView( colon +1, minus - colon -1 
));
+m_upperPort = o3tl::toInt32(m_host.subView( minus +1 ));
 }
 m_host = m_host.copy( 0, colon );
 }


[Libreoffice-commits] core.git: cppu/source

2021-11-09 Thread Noel Grandin (via logerrit)
 cppu/source/typelib/typelib.cxx |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit f381c353b4b24f185c6517593e78671b33d64baa
Author: Noel Grandin 
AuthorDate: Mon Nov 8 21:08:09 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Nov 9 09:17:34 2021 +0100

BaseList doesn't need set member after the constructor is done

Change-Id: Idc174a0cd53c45beba3100b1f8258e6839291be8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124885
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index 650ac27c3ad9..8ae7ca64865e 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -867,11 +867,11 @@ private:
 typedef std::set< OUString > Set;
 
 void calculate(
+Set& allSet,
 sal_Int32 directBaseIndex, Set & directBaseSet,
 sal_Int32 * directBaseMembers,
 typelib_InterfaceTypeDescription const * desc);
 
-Set set;
 List list;
 sal_Int32 members;
 };
@@ -879,24 +879,26 @@ private:
 BaseList::BaseList(typelib_InterfaceTypeDescription const * desc)
: members(0)
 {
+Set allSet;
 for (sal_Int32 i = 0; i < desc->nBaseTypes; ++i) {
 Set directBaseSet;
 sal_Int32 directBaseMembers = 0;
-calculate(i, directBaseSet, , desc->ppBaseTypes[i]);
+calculate(allSet, i, directBaseSet, , 
desc->ppBaseTypes[i]);
 }
 }
 
 void BaseList::calculate(
+Set& allSet,
 sal_Int32 directBaseIndex, Set & directBaseSet,
 sal_Int32 * directBaseMembers,
 typelib_InterfaceTypeDescription const * desc)
 {
 for (sal_Int32 i = 0; i < desc->nBaseTypes; ++i) {
-calculate(
+calculate(allSet,
 directBaseIndex, directBaseSet, directBaseMembers,
 desc->ppBaseTypes[i]);
 }
-if (set.insert(desc->aBase.pTypeName).second) {
+if (allSet.insert(desc->aBase.pTypeName).second) {
 Entry e;
 e.memberOffset = members;
 e.directBaseIndex = directBaseIndex;


[Libreoffice-commits] core.git: cppu/source

2021-10-26 Thread Mike Kaganski (via logerrit)
 cppu/source/uno/assign.hxx |   11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

New commits:
commit 58edf898989c8cba7e05bdac90db812a52ea03f2
Author: Mike Kaganski 
AuthorDate: Tue Oct 26 10:53:02 2021 +0300
Commit: Mike Kaganski 
CommitDate: Tue Oct 26 23:09:34 2021 +0200

d46f659c7524625474f0bb907805e285ee27d5ec follow-up: simplify checks

Change-Id: Ib95e7c562741f76a742cd31aa033956a0f0a3c45
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124169
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/cppu/source/uno/assign.hxx b/cppu/source/uno/assign.hxx
index c6a2cf58b457..3e2893fde824 100644
--- a/cppu/source/uno/assign.hxx
+++ b/cppu/source/uno/assign.hxx
@@ -384,20 +384,17 @@ inline bool _assignData(
 }
 return false;
 case typelib_TypeClass_SEQUENCE:
-if (typelib_TypeClass_SEQUENCE != pSourceType->eTypeClass)
+if (!_type_equals( pDestType, pSourceType ))
 return false;
-// self assignment:
-if (*static_cast(pSource) == 
*static_cast(pDest))
-return _type_equals(pDestType, pSourceType); // E.g. static empty 
sequence may be shared
-if (_type_equals( pDestType, pSourceType ))
+// check self assignment (only after _type_equals, to account for 
shared static empty):
+if (*static_cast(pSource) != 
*static_cast(pDest))
 {
 osl_atomic_increment( &(*static_cast(pSource))->nRefCount );
 idestructSequence(
 *static_cast(pDest), pDestType, 
pDestTypeDescr, release );
 *static_cast(pDest) = *static_cast(pSource);
-return true;
 }
-return false;
+return true;
 case typelib_TypeClass_INTERFACE:
 if (typelib_TypeClass_INTERFACE != pSourceType->eTypeClass)
 return false;


[Libreoffice-commits] core.git: cppu/source sd/qa

2021-10-25 Thread Mike Kaganski (via logerrit)
 cppu/source/uno/assign.hxx |2 
 sd/qa/unit/data/xml/n593612_0.xml  |4 
 sd/qa/unit/data/xml/n762695_0.xml  |4 
 sd/qa/unit/data/xml/n762695_1.xml  |8 
 sd/qa/unit/data/xml/n819614_0.xml  |  668 +
 sd/qa/unit/data/xml/n820786_0.xml  |  204 ++-
 sd/qa/unit/data/xml/tdf90338_0.xml |4 
 sd/qa/unit/data/xml/tdf92001_0.xml |8 
 8 files changed, 226 insertions(+), 676 deletions(-)

New commits:
commit d46f659c7524625474f0bb907805e285ee27d5ec
Author: Mike Kaganski 
AuthorDate: Tue Oct 26 00:24:49 2021 +0300
Commit: Mike Kaganski 
CommitDate: Tue Oct 26 07:19:40 2021 +0200

Make sure that self-assign test checks types

This may be important with static empty sequence cppu::g_emptySeq, that is
common for sequences of different types.

The changes in sd/qa/unit/data/xml/*.xml fix places where anys with empty
Sequence used to wrongly take 'if(aAny >>= aPropSeq)' branch in
dumpPropertyValueAsElement (drawinglayer/source/dumper/XShapeDumper.cxx).

Change-Id: I5b0544ca94b30437c01dd46f376408f91510bcb7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124167
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/cppu/source/uno/assign.hxx b/cppu/source/uno/assign.hxx
index 4e3d70f311b2..c6a2cf58b457 100644
--- a/cppu/source/uno/assign.hxx
+++ b/cppu/source/uno/assign.hxx
@@ -388,7 +388,7 @@ inline bool _assignData(
 return false;
 // self assignment:
 if (*static_cast(pSource) == 
*static_cast(pDest))
-return true;
+return _type_equals(pDestType, pSourceType); // E.g. static empty 
sequence may be shared
 if (_type_equals( pDestType, pSourceType ))
 {
 osl_atomic_increment( &(*static_cast(pSource))->nRefCount );
diff --git a/sd/qa/unit/data/xml/n593612_0.xml 
b/sd/qa/unit/data/xml/n593612_0.xml
index 7c93f494e3ca..3f5f88e445f1 100644
--- a/sd/qa/unit/data/xml/n593612_0.xml
+++ b/sd/qa/unit/data/xml/n593612_0.xml
@@ -18,9 +18,7 @@
 


-   
-
-   
+   



diff --git a/sd/qa/unit/data/xml/n762695_0.xml 
b/sd/qa/unit/data/xml/n762695_0.xml
index 710a5039ab69..02b3074e92f1 100644
--- a/sd/qa/unit/data/xml/n762695_0.xml
+++ b/sd/qa/unit/data/xml/n762695_0.xml
@@ -18,9 +18,7 @@
 


-   
-
-   
+   



diff --git a/sd/qa/unit/data/xml/n762695_1.xml 
b/sd/qa/unit/data/xml/n762695_1.xml
index 54b383db40a8..f0798923fed9 100644
--- a/sd/qa/unit/data/xml/n762695_1.xml
+++ b/sd/qa/unit/data/xml/n762695_1.xml
@@ -18,9 +18,7 @@
 


-   
-
-   
+   



@@ -104,9 +102,7 @@
 


-   
-
-   
+   



diff --git a/sd/qa/unit/data/xml/n819614_0.xml 
b/sd/qa/unit/data/xml/n819614_0.xml
index e28d86fb510c..a12f04d7e6fa 100644
--- a/sd/qa/unit/data/xml/n819614_0.xml
+++ b/sd/qa/unit/data/xml/n819614_0.xml
@@ -34,9 +34,7 @@
   
  
  
- 
-  
- 
+ 
  
  
  
@@ -97,12 +95,8 @@
  
   
  
- 
-  
- 
- 
-  
- 
+ 
+ 
  
  
  
@@ -156,12 +150,8 @@
  
   
  
- 
-  
- 
- 
-  
- 
+ 
+ 
  
  
  
@@ -215,12 +205,8 @@
  
   
  
- 
-  
- 
- 
-  
- 
+ 
+ 
  
  
  
@@ -274,12 +260,8 @@
  
   
  
- 
-  
- 
- 
-  
- 
+ 
+ 
  
  
  
@@ -337,12 +319,8 @@
  
   
  
- 
-  
- 
- 
-  
- 
+ 
+ 
  
  
  
@@ -396,12 +374,8 @@
  
   
  
- 
-  
- 
- 
-  
- 
+ 
+ 
  
  
  
@@ -455,12 +429,8 @@
  
   
  
- 
-  
- 
- 
-  
- 
+ 
+ 
  
  
  
@@ -514,12 +484,8 @@
  
   
  
- 
-  
- 
- 
-  
- 
+ 
+ 
  
  
  
@@ -573,12 +539,8 @@
  
   
  
- 
-  
- 
- 
-  
- 
+ 
+ 
  
  
  
@@ -632,12 +594,8 @@
  
   
  
- 
-  
- 
- 
-  
- 
+ 
+ 
  
  
  
@@ -691,12 +649,8 @@
  
   
  
- 
-  
- 
- 
-  
- 
+ 
+ 
  
  
  
@@ -754,12 +708,8 @@
  
   
  
- 
-  
- 
- 
-  
- 
+ 
+ 
  
  
  
@@ -813,12 +763,8 @@
  
   
  
- 
-  
- 
- 
-  
- 
+ 
+ 
  
  
  
@@ -872,12 +818,8 @@
  
   
  
- 
-  
- 
- 
-  
- 
+ 
+ 
  
  
  
@@ -931,12 +873,8 @@
  
   
  
- 
-  
- 
- 
-  
- 
+ 
+ 
  
  
  
@@ -994,12 +932,8 @@
  
   
  
- 
-  
- 
- 
-  
- 
+ 
+ 
  
  
  
@@ -1053,12 

[Libreoffice-commits] core.git: cppu/source

2021-09-10 Thread Noel Grandin (via logerrit)
 cppu/source/threadpool/current.cxx |4 ++--
 cppu/source/threadpool/current.hxx |4 ++--
 cppu/source/uno/lbenv.cxx  |2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 9f46bcac09c7f1f8ef6f22ed9f366d1fd596f9d7
Author: Noel Grandin 
AuthorDate: Fri Sep 10 19:31:37 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Sep 10 21:19:48 2021 +0200

clang:optin.performance.Padding in cppu

Excessive padding in 'struct cppu::IdContainer' (11 padding bytes, where
3 is optimal).
Excessive padding in 'struct (anonymous namespace)::ObjectEntry' (11
padding bytes, where 3 is optimal).

Change-Id: I39216b9927abeb8ec61ab590dc25bc203a112028
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121921
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/cppu/source/threadpool/current.cxx 
b/cppu/source/threadpool/current.cxx
index 6a992c6af541..d085cb4a5092 100644
--- a/cppu/source/threadpool/current.cxx
+++ b/cppu/source/threadpool/current.cxx
@@ -83,10 +83,10 @@ static typelib_InterfaceTypeDescription * 
get_type_XCurrentContext()
 IdContainer::IdContainer()
 : pCurrentContext(nullptr)
 , pCurrentContextEnv(nullptr)
-, bInit(false)
 , pLocalThreadId(nullptr)
-, nRefCountOfCurrentId(0)
 , pCurrentId(nullptr)
+, nRefCountOfCurrentId(0)
+, bInit(false)
 {
 }
 
diff --git a/cppu/source/threadpool/current.hxx 
b/cppu/source/threadpool/current.hxx
index cb0094413d66..1f6ce6642738 100644
--- a/cppu/source/threadpool/current.hxx
+++ b/cppu/source/threadpool/current.hxx
@@ -32,10 +32,10 @@ struct IdContainer
 void *   pCurrentContext;
 _uno_ExtEnvironment * pCurrentContextEnv;
 
-boolbInit;
 sal_Sequence *  pLocalThreadId;
-sal_Int32   nRefCountOfCurrentId;
 sal_Sequence *  pCurrentId;
+sal_Int32   nRefCountOfCurrentId;
+boolbInit;
 
 IdContainer();
 ~IdContainer();
diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index f018cde00cfd..c9a2d89933d5 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -75,8 +75,8 @@ struct InterfaceEntry
 struct ObjectEntry
 {
 OUString oid;
-sal_Int32 nRef;
 std::vector< InterfaceEntry > aInterfaces;
+sal_Int32 nRef;
 bool mixedObject;
 
 explicit ObjectEntry( const OUString & rOId_ );


[Libreoffice-commits] core.git: cppu/source

2021-08-31 Thread Stephan Bergmann (via logerrit)
 cppu/source/uno/lbenv.cxx |   23 +++
 1 file changed, 7 insertions(+), 16 deletions(-)

New commits:
commit a36d1308f946d890fcdf7887169f284704e4a5bf
Author: Stephan Bergmann 
AuthorDate: Tue Aug 31 08:22:30 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Tue Aug 31 09:16:54 2021 +0200

Elide class makeOIdPart

...which is no longer needed since 00f257a7ef4f1ec52887bc379c14757e057e94c8
"rtl::Static -> thread-safe static local"

Change-Id: Ie78154c5d8b6ad8278405d1ce56c76997e0478d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121347
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index ad61cee0cf67..f018cde00cfd 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -786,13 +786,10 @@ extern "C" void SAL_CALL uno_dumpEnvironmentByName(
 
 namespace
 {
-class makeOIdPart
-{
-private:
-OUString m_sOidPart;
-public:
-makeOIdPart()
-{
+
+const OUString & unoenv_getStaticOIdPart()
+{
+static auto const theStaticOIdPart = [] {
 OUStringBuffer aRet( 64 );
 aRet.append( "];" );
 // pid
@@ -814,15 +811,9 @@ namespace
 for (unsigned char i : ar)
 aRet.append( static_cast(i), 16 );
 
-m_sOidPart = aRet.makeStringAndClear();
-}
-const OUString& getOIdPart() const { return m_sOidPart; }
-};
-
-const OUString & unoenv_getStaticOIdPart()
-{
-static makeOIdPart theStaticOIdPart;
-return theStaticOIdPart.getOIdPart();
+return aRet.makeStringAndClear();
+}();
+return theStaticOIdPart;
 }
 
 }


[Libreoffice-commits] core.git: cppu/source

2021-08-06 Thread Caolán McNamara (via logerrit)
 cppu/source/threadpool/current.cxx |   39 +
 cppu/source/threadpool/current.hxx |2 -
 cppu/source/threadpool/threadident.cxx |   61 +++--
 3 files changed, 47 insertions(+), 55 deletions(-)

New commits:
commit 413b80ed1a9d29f394d0746106f5698e65fe23dc
Author: Caolán McNamara 
AuthorDate: Fri Aug 6 09:59:52 2021 +0100
Commit: Caolán McNamara 
CommitDate: Fri Aug 6 12:14:58 2021 +0200

return a reference instead of a pointer

and remove redundant nullptr OSL_ENSURE check

Change-Id: I19e202c3786386ed6f094504a0e1eb6928aa423a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120105
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/cppu/source/threadpool/current.cxx 
b/cppu/source/threadpool/current.cxx
index e163a20be2ec..6a992c6af541 100644
--- a/cppu/source/threadpool/current.cxx
+++ b/cppu/source/threadpool/current.cxx
@@ -106,33 +106,31 @@ IdContainer::~IdContainer()
 }
 }
 
-IdContainer * getIdContainer()
+IdContainer& getIdContainer()
 {
 static thread_local IdContainer aId;
-return 
+return aId;
 }
 
 }
 
-
 extern "C" sal_Bool SAL_CALL uno_setCurrentContext(
 void * pCurrentContext,
 rtl_uString * pEnvTypeName, void * pEnvContext )
 SAL_THROW_EXTERN_C()
 {
-IdContainer * pId = getIdContainer();
-OSL_ASSERT( pId );
+IdContainer& id = getIdContainer();
 
 // free old one
-if (pId->pCurrentContext)
+if (id.pCurrentContext)
 {
-(*pId->pCurrentContextEnv->releaseInterface)(
-pId->pCurrentContextEnv, pId->pCurrentContext );
-(*pId->pCurrentContextEnv->aBase.release)(
->pCurrentContextEnv->aBase );
-pId->pCurrentContextEnv = nullptr;
+(*id.pCurrentContextEnv->releaseInterface)(
+id.pCurrentContextEnv, id.pCurrentContext );
+(*id.pCurrentContextEnv->aBase.release)(
+>aBase );
+id.pCurrentContextEnv = nullptr;
 
-pId->pCurrentContext = nullptr;
+id.pCurrentContext = nullptr;
 }
 
 if (pCurrentContext)
@@ -144,10 +142,10 @@ extern "C" sal_Bool SAL_CALL uno_setCurrentContext(
 {
 if (pEnv->pExtEnv)
 {
-pId->pCurrentContextEnv = pEnv->pExtEnv;
-(*pId->pCurrentContextEnv->acquireInterface)(
-pId->pCurrentContextEnv, pCurrentContext );
-pId->pCurrentContext = pCurrentContext;
+id.pCurrentContextEnv = pEnv->pExtEnv;
+(*id.pCurrentContextEnv->acquireInterface)(
+id.pCurrentContextEnv, pCurrentContext );
+id.pCurrentContext = pCurrentContext;
 }
 else
 {
@@ -167,8 +165,7 @@ extern "C" sal_Bool SAL_CALL uno_getCurrentContext(
 void ** ppCurrentContext, rtl_uString * pEnvTypeName, void * pEnvContext )
 SAL_THROW_EXTERN_C()
 {
-IdContainer * pId = getIdContainer();
-OSL_ASSERT( pId );
+IdContainer& id = getIdContainer();
 
 Environment target_env;
 
@@ -189,7 +186,7 @@ extern "C" sal_Bool SAL_CALL uno_getCurrentContext(
 }
 
 // case: null-ref
-if (nullptr == pId->pCurrentContext)
+if (nullptr == id.pCurrentContext)
 return true;
 
 if (! target_env.is())
@@ -200,12 +197,12 @@ extern "C" sal_Bool SAL_CALL uno_getCurrentContext(
 return false;
 }
 
-Mapping mapping(>pCurrentContextEnv->aBase, target_env.get());
+Mapping mapping(>aBase, target_env.get());
 OSL_ASSERT( mapping.is() );
 if (! mapping.is())
 return false;
 
-mapping.mapInterface(ppCurrentContext, pId->pCurrentContext, 
::cppu::get_type_XCurrentContext() );
+mapping.mapInterface(ppCurrentContext, id.pCurrentContext, 
::cppu::get_type_XCurrentContext());
 
 return true;
 }
diff --git a/cppu/source/threadpool/current.hxx 
b/cppu/source/threadpool/current.hxx
index 8ab4e3acf43a..cb0094413d66 100644
--- a/cppu/source/threadpool/current.hxx
+++ b/cppu/source/threadpool/current.hxx
@@ -41,7 +41,7 @@ struct IdContainer
 ~IdContainer();
 };
 
-IdContainer * getIdContainer();
+IdContainer& getIdContainer();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppu/source/threadpool/threadident.cxx 
b/cppu/source/threadpool/threadident.cxx
index 544acc7af520..16b7c0b2700a 100644
--- a/cppu/source/threadpool/threadident.cxx
+++ b/cppu/source/threadpool/threadident.cxx
@@ -27,12 +27,10 @@
 
 #include "current.hxx"
 
-
 using namespace ::std;
 using namespace ::osl;
 using namespace ::cppu;
 
-
 static void createLocalId( sal_Sequence **ppThreadId )
 {
 rtl_byte_sequence_constructNoDefault( ppThreadId , 4 + 16 );
@@ -44,74 +42,71 @@ static void createLocalId( sal_Sequence **ppThreadId )
 rtl_getGlobalProcessId( reinterpret_cast(&(*ppThreadId)->elements[4]) );
 }
 
-
 extern "C" void SAL_CALL
 uno_getIdOfCurrentThread( sal_Sequence **ppThreadId )
 

[Libreoffice-commits] core.git: cppu/source

2021-08-06 Thread Caolán McNamara (via logerrit)
 cppu/source/threadpool/current.cxx |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 373da7a00986ea95ce959242c0876a5eaf18a1b6
Author: Caolán McNamara 
AuthorDate: Fri Aug 6 08:56:52 2021 +0100
Commit: Caolán McNamara 
CommitDate: Fri Aug 6 10:54:46 2021 +0200

cid#1489779 Uninitialized pointer field

Change-Id: I3a9405ff1ed161a02b590d2ac996d88b5fb1978d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120099
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/cppu/source/threadpool/current.cxx 
b/cppu/source/threadpool/current.cxx
index 64b9923286c2..e163a20be2ec 100644
--- a/cppu/source/threadpool/current.cxx
+++ b/cppu/source/threadpool/current.cxx
@@ -81,10 +81,13 @@ static typelib_InterfaceTypeDescription * 
get_type_XCurrentContext()
 }
 
 IdContainer::IdContainer()
+: pCurrentContext(nullptr)
+, pCurrentContextEnv(nullptr)
+, bInit(false)
+, pLocalThreadId(nullptr)
+, nRefCountOfCurrentId(0)
+, pCurrentId(nullptr)
 {
-pCurrentContext = nullptr;
-pCurrentContextEnv = nullptr;
-bInit = false;
 }
 
 IdContainer::~IdContainer()


[Libreoffice-commits] core.git: cppu/source

2021-08-04 Thread Noel Grandin (via logerrit)
 cppu/source/threadpool/current.cxx |   52 -
 cppu/source/threadpool/current.hxx |5 ++-
 2 files changed, 21 insertions(+), 36 deletions(-)

New commits:
commit 5b6f8991d88e75f11811de502b4285aa23cd0d4e
Author: Noel Grandin 
AuthorDate: Wed Aug 4 14:29:12 2021 +0200
Commit: Noel Grandin 
CommitDate: Wed Aug 4 16:06:07 2021 +0200

osl_createThreadKey->thread_local in IdContainer

Change-Id: I5989610bd49597259d387b81dd7e8c63738255a6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/12
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/cppu/source/threadpool/current.cxx 
b/cppu/source/threadpool/current.cxx
index 6acad514cac7..64b9923286c2 100644
--- a/cppu/source/threadpool/current.cxx
+++ b/cppu/source/threadpool/current.cxx
@@ -20,7 +20,6 @@
 #include 
 
 #include 
-#include 
 #include 
 
 #include 
@@ -81,50 +80,33 @@ static typelib_InterfaceTypeDescription * 
get_type_XCurrentContext()
 return s_type_XCurrentContext;
 }
 
-extern "C" {
-
-static void delete_IdContainer( void * p )
+IdContainer::IdContainer()
 {
-if (!p)
-return;
+pCurrentContext = nullptr;
+pCurrentContextEnv = nullptr;
+bInit = false;
+}
 
-IdContainer * pId = static_cast< IdContainer * >( p );
-if (pId->pCurrentContext)
+IdContainer::~IdContainer()
+{
+if (pCurrentContext)
 {
-(*pId->pCurrentContextEnv->releaseInterface)(
-pId->pCurrentContextEnv, pId->pCurrentContext );
-(*pId->pCurrentContextEnv->aBase.release)(
->pCurrentContextEnv->aBase );
+(*pCurrentContextEnv->releaseInterface)(
+pCurrentContextEnv, pCurrentContext );
+(*pCurrentContextEnv->aBase.release)(
+>aBase );
 }
-if (pId->bInit)
+if (bInit)
 {
-::rtl_byte_sequence_release( pId->pLocalThreadId );
-::rtl_byte_sequence_release( pId->pCurrentId );
+::rtl_byte_sequence_release( pLocalThreadId );
+::rtl_byte_sequence_release( pCurrentId );
 }
-delete pId;
-}
-
 }
 
 IdContainer * getIdContainer()
 {
-struct ThreadKey
-{
-oslThreadKey _hThreadKey;
-~ThreadKey() { osl_destroyThreadKey(_hThreadKey); }
-} static const s_key{ osl_createThreadKey(delete_IdContainer) };
-oslThreadKey aKey = s_key._hThreadKey;
-
-IdContainer * pId = static_cast< IdContainer * >( ::osl_getThreadKeyData( 
aKey ) );
-if (! pId)
-{
-pId = new IdContainer;
-pId->pCurrentContext = nullptr;
-pId->pCurrentContextEnv = nullptr;
-pId->bInit = false;
-::osl_setThreadKeyData( aKey, pId );
-}
-return pId;
+static thread_local IdContainer aId;
+return 
 }
 
 }
diff --git a/cppu/source/threadpool/current.hxx 
b/cppu/source/threadpool/current.hxx
index 43eb809f9bff..8ab4e3acf43a 100644
--- a/cppu/source/threadpool/current.hxx
+++ b/cppu/source/threadpool/current.hxx
@@ -32,10 +32,13 @@ struct IdContainer
 void *   pCurrentContext;
 _uno_ExtEnvironment * pCurrentContextEnv;
 
-boolbInit;
+boolbInit;
 sal_Sequence *  pLocalThreadId;
 sal_Int32   nRefCountOfCurrentId;
 sal_Sequence *  pCurrentId;
+
+IdContainer();
+~IdContainer();
 };
 
 IdContainer * getIdContainer();


[Libreoffice-commits] core.git: cppu/source

2021-07-19 Thread Noel Grandin (via logerrit)
 cppu/source/uno/lbmap.cxx |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 4408001f5c0a76107d8fe01053a0e6348100a878
Author: Noel Grandin 
AuthorDate: Sun Jul 18 14:18:30 2021 +0200
Commit: Noel Grandin 
CommitDate: Mon Jul 19 08:54:19 2021 +0200

osl::Mutex->std::mutex in MappingsData

Change-Id: I12f46a5468e7d7dde9bfde977adf4ea13eb89ae3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119138
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx
index 685bf6d4a2a8..a39eb409a765 100644
--- a/cppu/source/uno/lbmap.cxx
+++ b/cppu/source/uno/lbmap.cxx
@@ -24,6 +24,7 @@
 #include "IdentityMapping.hxx"
 
 #include 
+#include 
 #include 
 #include 
 
@@ -158,7 +159,7 @@ struct MappingsData
 set< uno_getMappingFunc >
 aCallbacks;
 
-Mutex   aNegativeLibsMutex;
+std::mutex  aNegativeLibsMutex;
 set   aNegativeLibs;
 };
 
@@ -318,7 +319,7 @@ static OUString getBridgeName(
 static void setNegativeBridge( const OUString & rBridgeName )
 {
 MappingsData & rData = getMappingsData();
-MutexGuard aGuard( rData.aNegativeLibsMutex );
+std::lock_guard aGuard( rData.aNegativeLibsMutex );
 rData.aNegativeLibs.insert( rBridgeName );
 }
 
@@ -355,7 +356,7 @@ static bool loadModule(osl::Module & rModule, const 
OUString & rBridgeName)
 bool bNeg;
 {
 MappingsData & rData = getMappingsData();
-MutexGuard aGuard( rData.aNegativeLibsMutex );
+std::lock_guard aGuard( rData.aNegativeLibsMutex );
 const auto iFind( rData.aNegativeLibs.find( rBridgeName ) );
 bNeg = (iFind != rData.aNegativeLibs.end());
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2021-07-19 Thread Noel Grandin (via logerrit)
 cppu/source/uno/EnvStack.cxx |   18 +++---
 1 file changed, 7 insertions(+), 11 deletions(-)

New commits:
commit d67cf46ba862ecdd8bdce451a996e64e2a86cd43
Author: Noel Grandin 
AuthorDate: Sun Jul 18 14:14:53 2021 +0200
Commit: Noel Grandin 
CommitDate: Mon Jul 19 08:53:46 2021 +0200

remove unnecessary rtl::Static

no need to delay-init something we always need, and laying
out a std::unordered_map is something we can normally do at
link time anyway.

Change-Id: Ide791d20394580bca615aa3ad564c154037e0816
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119137
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/cppu/source/uno/EnvStack.cxx b/cppu/source/uno/EnvStack.cxx
index 0b037687cdd9..033f9d94ce3f 100644
--- a/cppu/source/uno/EnvStack.cxx
+++ b/cppu/source/uno/EnvStack.cxx
@@ -23,8 +23,6 @@
 #include 
 #include 
 
-#include 
-
 #include 
 #include 
 
@@ -71,7 +69,7 @@ typedef std::unordered_map {};
+ThreadMap s_threadMap;
 }
 
 static void s_setCurrent(uno_Environment * pEnv)
@@ -79,16 +77,15 @@ static void s_setCurrent(uno_Environment * pEnv)
 oslThreadIdentifier threadId = osl::Thread::getCurrentIdentifier();
 
 std::lock_guard guard(s_threadMap_mutex);
-ThreadMap  = s_threadMap::get();
 if (pEnv)
 {
-rThreadMap[threadId] = pEnv;
+s_threadMap[threadId] = pEnv;
 }
 else
 {
-ThreadMap::iterator iEnv = rThreadMap.find(threadId);
-if( iEnv != rThreadMap.end())
-rThreadMap.erase(iEnv);
+ThreadMap::iterator iEnv = s_threadMap.find(threadId);
+if( iEnv != s_threadMap.end())
+s_threadMap.erase(iEnv);
 }
 }
 
@@ -99,9 +96,8 @@ static uno_Environment * s_getCurrent()
 oslThreadIdentifier threadId = osl::Thread::getCurrentIdentifier();
 
 std::lock_guard guard(s_threadMap_mutex);
-ThreadMap  = s_threadMap::get();
-ThreadMap::iterator iEnv = rThreadMap.find(threadId);
-if(iEnv != rThreadMap.end())
+ThreadMap::iterator iEnv = s_threadMap.find(threadId);
+if(iEnv != s_threadMap.end())
 pEnv = iEnv->second;
 
 return pEnv;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2021-07-18 Thread Noel Grandin (via logerrit)
 cppu/source/uno/EnvStack.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 6db41dd2649a9ddaf32fc779bed07dc7d61c1154
Author: Noel Grandin 
AuthorDate: Sun Jul 18 14:13:59 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Jul 18 20:46:27 2021 +0200

osl::Mutex->std::mutex in EnvStack

Change-Id: I1339a362046c96d9056f70cd687d023a055b4cf8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119136
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/cppu/source/uno/EnvStack.cxx b/cppu/source/uno/EnvStack.cxx
index f6b11352cf14..0b037687cdd9 100644
--- a/cppu/source/uno/EnvStack.cxx
+++ b/cppu/source/uno/EnvStack.cxx
@@ -27,8 +27,8 @@
 
 #include 
 #include 
-#include 
 
+#include 
 #include 
 
 using namespace com::sun::star;
@@ -70,7 +70,7 @@ typedef std::unordered_map {};
+std::mutex s_threadMap_mutex;
 struct s_threadMap : public rtl::Static< ThreadMap, s_threadMap > {};
 }
 
@@ -78,7 +78,7 @@ static void s_setCurrent(uno_Environment * pEnv)
 {
 oslThreadIdentifier threadId = osl::Thread::getCurrentIdentifier();
 
-osl::MutexGuard guard(s_threadMap_mutex::get());
+std::lock_guard guard(s_threadMap_mutex);
 ThreadMap  = s_threadMap::get();
 if (pEnv)
 {
@@ -98,7 +98,7 @@ static uno_Environment * s_getCurrent()
 
 oslThreadIdentifier threadId = osl::Thread::getCurrentIdentifier();
 
-osl::MutexGuard guard(s_threadMap_mutex::get());
+std::lock_guard guard(s_threadMap_mutex);
 ThreadMap  = s_threadMap::get();
 ThreadMap::iterator iEnv = rThreadMap.find(threadId);
 if(iEnv != rThreadMap.end())
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2021-07-17 Thread Arnaud Versini (via logerrit)
 cppu/source/threadpool/threadpool.cxx |7 +++
 cppu/source/threadpool/threadpool.hxx |2 +-
 2 files changed, 4 insertions(+), 5 deletions(-)

New commits:
commit bd4ee5ea9b0b79cfb8c03aa1f1d6008565b71bff
Author: Arnaud Versini 
AuthorDate: Sun Jun 27 17:05:35 2021 +0200
Commit: Arnaud Versini 
CommitDate: Sat Jul 17 19:02:18 2021 +0200

cppu : use std::mutex in DisposedCallerAdmin

Change-Id: I3db567a9aed42167ea24eebcf673f19106595f83
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117948
Tested-by: Jenkins
Reviewed-by: Arnaud Versini 

diff --git a/cppu/source/threadpool/threadpool.cxx 
b/cppu/source/threadpool/threadpool.cxx
index 257155027955..86c280b4b352 100644
--- a/cppu/source/threadpool/threadpool.cxx
+++ b/cppu/source/threadpool/threadpool.cxx
@@ -25,7 +25,6 @@
 #include 
 
 #include 
-#include 
 #include 
 #include 
 
@@ -68,19 +67,19 @@ namespace cppu_threadpool
 
 void DisposedCallerAdmin::dispose( void const * nDisposeId )
 {
-MutexGuard guard( m_mutex );
+std::scoped_lock guard( m_mutex );
 m_vector.push_back( nDisposeId );
 }
 
 void DisposedCallerAdmin::destroy( void const * nDisposeId )
 {
-MutexGuard guard( m_mutex );
+std::scoped_lock guard( m_mutex );
 m_vector.erase(std::remove(m_vector.begin(), m_vector.end(), 
nDisposeId), m_vector.end());
 }
 
 bool DisposedCallerAdmin::isDisposed( void const * nDisposeId )
 {
-MutexGuard guard( m_mutex );
+std::scoped_lock guard( m_mutex );
 return (std::find(m_vector.begin(), m_vector.end(), nDisposeId) != 
m_vector.end());
 }
 
diff --git a/cppu/source/threadpool/threadpool.hxx 
b/cppu/source/threadpool/threadpool.hxx
index 5b758703579a..15d092a21062 100644
--- a/cppu/source/threadpool/threadpool.hxx
+++ b/cppu/source/threadpool/threadpool.hxx
@@ -89,7 +89,7 @@ namespace cppu_threadpool {
 bool isDisposed( void const * nDisposeId );
 
 private:
-::osl::Mutex m_mutex;
+std::mutex m_mutex;
 std::vector< void const * > m_vector;
 };
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2021-06-18 Thread Christophe JAILLET (via logerrit)
 cppu/source/typelib/typelib.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 6317f8cc83ec92b8700785ab67c4c66ed1aa8fb2
Author: Christophe JAILLET 
AuthorDate: Fri Jun 18 00:00:40 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Jun 18 11:03:47 2021 +0200

Re-add a removed mutex

In commit b33fbd55d630, many getMutex() have been replaced by an equivalent
maMutex.
Only in place, the use of a mutex have been simply removed.

Restore it as done in all the other places

Signed-off-by: Christophe JAILLET 
Change-Id: Id85e74e166ec57dd37f8913f8ecf19e2b6465f8f
---
This patch is completely speculative. The removal of this mutex was maybe
done on purpose.
This only looks spurious to me.
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117402
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index 7c392e147c89..26875778c22b 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -2289,6 +2289,7 @@ extern "C" void SAL_CALL typelib_setCacheSize( sal_Int32 
nNewSize )
 return;
 
 TypeDescriptor_Init_Impl  = Init::get();
+MutexGuard aGuard( rInit.maMutex );
 if (nNewSize < nCacheSize)
 {
 while (static_cast(rInit.maCache.size()) != nNewSize)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2021-06-14 Thread Stephan Bergmann (via logerrit)
 cppu/source/typelib/typelib.cxx |   34 +-
 1 file changed, 13 insertions(+), 21 deletions(-)

New commits:
commit b33fbd55d63042725ff9a014642f7c6bb02231f7
Author: Stephan Bergmann 
AuthorDate: Mon Jun 14 15:43:27 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Jun 14 17:08:54 2021 +0200

Elide trivial TypeDescriptor_Init_Impl::getMutex

...after 859978445daeb848d033f64736709503ec44a7bb "flatten
TypeDescriptor_Init_Impl data-structure"

Change-Id: I6a7484dbbb93e7097edfb01db4f41d37fc4dc4b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117165
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index a64ff8065553..7c392e147c89 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -178,8 +178,6 @@ struct TypeDescriptor_Init_Impl
 // The mutex to guard all type library accesses
 Mutex  maMutex;
 
-inline Mutex & getMutex();
-
 inline void callChain( typelib_TypeDescription ** ppRet, rtl_uString * 
pName );
 
 #if OSL_DEBUG_LEVEL > 0
@@ -201,11 +199,6 @@ struct TypeDescriptor_Init_Impl
 
 }
 
-inline Mutex & TypeDescriptor_Init_Impl::getMutex()
-{
-return maMutex;
-}
-
 inline void TypeDescriptor_Init_Impl::callChain(
 typelib_TypeDescription ** ppRet, rtl_uString * pName )
 {
@@ -334,7 +327,7 @@ static void typelib_typedescription_initTables(
 }
 }
 
-MutexGuard aGuard( Init::get().getMutex() );
+MutexGuard aGuard( Init::get().maMutex );
 if( pTD->bComplete )
 return;
 
@@ -448,7 +441,7 @@ bool complete(typelib_TypeDescription ** ppTypeDescr, bool 
initTables) {
 OSL_ASSERT( pTD == *ppTypeDescr ); // has to merge into existing 
one
 
 // insert into the cache
-MutexGuard aGuard( rInit.getMutex() );
+MutexGuard aGuard( rInit.maMutex );
 if( static_cast(rInit.maCache.size()) >= nCacheSize )
 {
 typelib_typedescription_release( rInit.maCache.front() );
@@ -1345,7 +1338,7 @@ extern "C" void SAL_CALL typelib_typedescription_release(
 if( pTD->pWeakRef )
 {
 {
-MutexGuard aGuard( rInit.getMutex() );
+MutexGuard aGuard( rInit.maMutex );
 // remove this description from the weak reference
 pTD->pWeakRef->pType = nullptr;
 }
@@ -1355,7 +1348,7 @@ extern "C" void SAL_CALL typelib_typedescription_release(
 else
 {
 // this description is a reference too, so remove it from the hash 
table
-MutexGuard aGuard( rInit.getMutex() );
+MutexGuard aGuard( rInit.maMutex );
 WeakMap_Impl::iterator aIt = rInit.maWeakMap.find( 
pTD->pTypeName->buffer );
 if( aIt != rInit.maWeakMap.end() && static_cast((*aIt).second) 
== static_cast(pTD) )
 {
@@ -1404,7 +1397,7 @@ extern "C" void SAL_CALL typelib_typedescription_register(
 {
 // connect the description with the weak reference
 TypeDescriptor_Init_Impl  = Init::get();
-ClearableMutexGuard aGuard( rInit.getMutex() );
+ClearableMutexGuard aGuard( rInit.maMutex );
 
 typelib_TypeDescriptionReference * pTDR = nullptr;
 typelib_typedescriptionreference_getByName( , 
(*ppNewDescription)->pTypeName );
@@ -1886,7 +1879,7 @@ extern "C" void SAL_CALL 
typelib_typedescription_getByName(
 if( !bInited )
 {
 // guard against multi thread access
-MutexGuard aGuard( rInit.getMutex() );
+MutexGuard aGuard( rInit.maMutex );
 if( !bInited )
 {
 // avoid recursion during the next ...new calls
@@ -1933,7 +1926,7 @@ extern "C" void SAL_CALL 
typelib_typedescription_getByName(
 {
 {
 // guard against multi thread access
-MutexGuard aGuard( rInit.getMutex() );
+MutexGuard aGuard( rInit.maMutex );
 // pTDR->pType->pWeakRef == 0 means that the description is empty
 if( pTDR->pType && pTDR->pType->pWeakRef )
 {
@@ -2030,7 +2023,7 @@ extern "C" void SAL_CALL 
typelib_typedescription_getByName(
 typelib_typedescription_register( ppRet );
 
 // insert into the cache
-MutexGuard aGuard( rInit.getMutex() );
+MutexGuard aGuard( rInit.maMutex );
 if( static_cast(rInit.maCache.size()) >= nCacheSize )
 {
 typelib_typedescription_release( rInit.maCache.front() );
@@ -2084,7 +2077,7 @@ extern "C" void SAL_CALL 
typelib_typedescriptionreference_new(
 typelib_typedescription_register(  );
 
 // insert into the cache
-MutexGuard aGuard( rInit.getMutex() );
+MutexGuard aGuard( rInit.maMutex );
 if( static_cast(rInit.maCache.size()) >= nCacheSize 
)
 {
 typelib_typedescription_release( rInit.maCache.front() );
@@ 

[Libreoffice-commits] core.git: cppu/source

2021-06-14 Thread Noel Grandin (via logerrit)
 cppu/source/typelib/typelib.cxx |  144 +---
 1 file changed, 77 insertions(+), 67 deletions(-)

New commits:
commit 0e81b8ecbb61572ae50321801c26c2df1eb95ee4
Author: Noel Grandin 
AuthorDate: Mon Jun 14 12:39:55 2021 +0200
Commit: Noel Grandin 
CommitDate: Mon Jun 14 15:33:05 2021 +0200

Revert "no need to init this on-demand"

This reverts commit c71520d7e7d8e9c669411d6a1beb788e1cba43a1.

Reason for revert: to fix AddressSanitizer: initialization-order-fiasco

Change-Id: I637dfdca4fc51415000f31e658d79a4ec8c17677
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117117
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index a96df9534c81..a64ff8065553 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -281,17 +281,16 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl()
 SAL_INFO_IF( !maCallbacks.empty(), "cppu.typelib", "pCallbacks is not NULL 
or empty" );
 };
 
-namespace {
-TypeDescriptor_Init_Impl gInit;
-}
+namespace { struct Init : public rtl::Static< TypeDescriptor_Init_Impl, Init > 
{}; }
 
 extern "C" void SAL_CALL typelib_typedescription_registerCallback(
 void * pContext, typelib_typedescription_Callback pCallback )
 SAL_THROW_EXTERN_C()
 {
 // todo mt safe: guard is no solution, can not acquire while calling 
callback!
+TypeDescriptor_Init_Impl  = Init::get();
 //  OslGuard aGuard( rInit.getMutex() );
-gInit.maCallbacks.push_back( CallbackEntry( pContext, pCallback ) );
+rInit.maCallbacks.push_back( CallbackEntry( pContext, pCallback ) );
 }
 
 
@@ -299,11 +298,14 @@ extern "C" void SAL_CALL 
typelib_typedescription_revokeCallback(
 void * pContext, typelib_typedescription_Callback pCallback )
 SAL_THROW_EXTERN_C()
 {
-// todo mt safe: guard is no solution, can not acquire while calling 
callback!
+TypeDescriptor_Init_Impl  = Init::get();
+{
+// todo mt safe: guard is no solution, can not acquire while calling 
callback!
 //  OslGuard aGuard( rInit.getMutex() );
-CallbackEntry aEntry( pContext, pCallback );
-gInit.maCallbacks.erase(std::remove(gInit.maCallbacks.begin(), 
gInit.maCallbacks.end(), aEntry),
-gInit.maCallbacks.end());
+CallbackEntry aEntry( pContext, pCallback );
+rInit.maCallbacks.erase(std::remove(rInit.maCallbacks.begin(), 
rInit.maCallbacks.end(), aEntry),
+rInit.maCallbacks.end());
+}
 }
 
 static void typelib_typedescription_initTables(
@@ -332,7 +334,7 @@ static void typelib_typedescription_initTables(
 }
 }
 
-MutexGuard aGuard( gInit.getMutex() );
+MutexGuard aGuard( Init::get().getMutex() );
 if( pTD->bComplete )
 return;
 
@@ -412,7 +414,8 @@ bool complete(typelib_TypeDescription ** ppTypeDescr, bool 
initTables) {
 
 typelib_TypeDescription * pTD = nullptr;
 // on demand access of complete td
-gInit.callChain( , (*ppTypeDescr)->pTypeName );
+TypeDescriptor_Init_Impl  = Init::get();
+rInit.callChain( , (*ppTypeDescr)->pTypeName );
 if (pTD)
 {
 if (typelib_TypeClass_TYPEDEF == pTD->eTypeClass)
@@ -445,15 +448,15 @@ bool complete(typelib_TypeDescription ** ppTypeDescr, 
bool initTables) {
 OSL_ASSERT( pTD == *ppTypeDescr ); // has to merge into existing 
one
 
 // insert into the cache
-MutexGuard aGuard( gInit.getMutex() );
-if( static_cast(gInit.maCache.size()) >= nCacheSize )
+MutexGuard aGuard( rInit.getMutex() );
+if( static_cast(rInit.maCache.size()) >= nCacheSize )
 {
-typelib_typedescription_release( gInit.maCache.front() );
-gInit.maCache.pop_front();
+typelib_typedescription_release( rInit.maCache.front() );
+rInit.maCache.pop_front();
 }
 // descriptions in the cache must be acquired!
 typelib_typedescription_acquire( pTD );
-gInit.maCache.push_back( pTD );
+rInit.maCache.push_back( pTD );
 
 OSL_ASSERT(
 pTD->bComplete
@@ -498,7 +501,7 @@ extern "C" void typelib_typedescription_newEmpty(
 auto pTmp = 
allocTypeDescription();
 pRet = >aBase;
 #if OSL_DEBUG_LEVEL > 0
-osl_atomic_increment(  );
+osl_atomic_increment( ::get().nIndirectTypeDescriptionCount );
 #endif
 pTmp->pType = nullptr;
 // coverity[leaked_storage] - this is on purpose
@@ -511,7 +514,7 @@ extern "C" void typelib_typedescription_newEmpty(
 auto pTmp = allocTypeDescription();
 pRet = >aBase.aBase;
 #if OSL_DEBUG_LEVEL > 0
-osl_atomic_increment(  );
+osl_atomic_increment( 

[Libreoffice-commits] core.git: cppu/source

2021-06-14 Thread Noel Grandin (via logerrit)
 cppu/source/typelib/typelib.cxx |  144 ++--
 1 file changed, 67 insertions(+), 77 deletions(-)

New commits:
commit c71520d7e7d8e9c669411d6a1beb788e1cba43a1
Author: Noel Grandin 
AuthorDate: Mon Jun 14 10:13:09 2021 +0200
Commit: Noel Grandin 
CommitDate: Mon Jun 14 11:54:23 2021 +0200

no need to init this on-demand

we ~always need it

Change-Id: I94ea47ed75478ecc7c78e89c0209a22d21be2b1b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117133
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index a64ff8065553..a96df9534c81 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -281,16 +281,17 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl()
 SAL_INFO_IF( !maCallbacks.empty(), "cppu.typelib", "pCallbacks is not NULL 
or empty" );
 };
 
-namespace { struct Init : public rtl::Static< TypeDescriptor_Init_Impl, Init > 
{}; }
+namespace {
+TypeDescriptor_Init_Impl gInit;
+}
 
 extern "C" void SAL_CALL typelib_typedescription_registerCallback(
 void * pContext, typelib_typedescription_Callback pCallback )
 SAL_THROW_EXTERN_C()
 {
 // todo mt safe: guard is no solution, can not acquire while calling 
callback!
-TypeDescriptor_Init_Impl  = Init::get();
 //  OslGuard aGuard( rInit.getMutex() );
-rInit.maCallbacks.push_back( CallbackEntry( pContext, pCallback ) );
+gInit.maCallbacks.push_back( CallbackEntry( pContext, pCallback ) );
 }
 
 
@@ -298,14 +299,11 @@ extern "C" void SAL_CALL 
typelib_typedescription_revokeCallback(
 void * pContext, typelib_typedescription_Callback pCallback )
 SAL_THROW_EXTERN_C()
 {
-TypeDescriptor_Init_Impl  = Init::get();
-{
-// todo mt safe: guard is no solution, can not acquire while calling 
callback!
+// todo mt safe: guard is no solution, can not acquire while calling 
callback!
 //  OslGuard aGuard( rInit.getMutex() );
-CallbackEntry aEntry( pContext, pCallback );
-rInit.maCallbacks.erase(std::remove(rInit.maCallbacks.begin(), 
rInit.maCallbacks.end(), aEntry),
-rInit.maCallbacks.end());
-}
+CallbackEntry aEntry( pContext, pCallback );
+gInit.maCallbacks.erase(std::remove(gInit.maCallbacks.begin(), 
gInit.maCallbacks.end(), aEntry),
+gInit.maCallbacks.end());
 }
 
 static void typelib_typedescription_initTables(
@@ -334,7 +332,7 @@ static void typelib_typedescription_initTables(
 }
 }
 
-MutexGuard aGuard( Init::get().getMutex() );
+MutexGuard aGuard( gInit.getMutex() );
 if( pTD->bComplete )
 return;
 
@@ -414,8 +412,7 @@ bool complete(typelib_TypeDescription ** ppTypeDescr, bool 
initTables) {
 
 typelib_TypeDescription * pTD = nullptr;
 // on demand access of complete td
-TypeDescriptor_Init_Impl  = Init::get();
-rInit.callChain( , (*ppTypeDescr)->pTypeName );
+gInit.callChain( , (*ppTypeDescr)->pTypeName );
 if (pTD)
 {
 if (typelib_TypeClass_TYPEDEF == pTD->eTypeClass)
@@ -448,15 +445,15 @@ bool complete(typelib_TypeDescription ** ppTypeDescr, 
bool initTables) {
 OSL_ASSERT( pTD == *ppTypeDescr ); // has to merge into existing 
one
 
 // insert into the cache
-MutexGuard aGuard( rInit.getMutex() );
-if( static_cast(rInit.maCache.size()) >= nCacheSize )
+MutexGuard aGuard( gInit.getMutex() );
+if( static_cast(gInit.maCache.size()) >= nCacheSize )
 {
-typelib_typedescription_release( rInit.maCache.front() );
-rInit.maCache.pop_front();
+typelib_typedescription_release( gInit.maCache.front() );
+gInit.maCache.pop_front();
 }
 // descriptions in the cache must be acquired!
 typelib_typedescription_acquire( pTD );
-rInit.maCache.push_back( pTD );
+gInit.maCache.push_back( pTD );
 
 OSL_ASSERT(
 pTD->bComplete
@@ -501,7 +498,7 @@ extern "C" void typelib_typedescription_newEmpty(
 auto pTmp = 
allocTypeDescription();
 pRet = >aBase;
 #if OSL_DEBUG_LEVEL > 0
-osl_atomic_increment( ::get().nIndirectTypeDescriptionCount );
+osl_atomic_increment(  );
 #endif
 pTmp->pType = nullptr;
 // coverity[leaked_storage] - this is on purpose
@@ -514,7 +511,7 @@ extern "C" void typelib_typedescription_newEmpty(
 auto pTmp = allocTypeDescription();
 pRet = >aBase.aBase;
 #if OSL_DEBUG_LEVEL > 0
-osl_atomic_increment( ::get().nCompoundTypeDescriptionCount );
+osl_atomic_increment(  );
 #endif
 pTmp->aBase.pBaseTypeDescription = nullptr;
 pTmp->aBase.nMembers = 0;
@@ -532,7 

[Libreoffice-commits] core.git: cppu/source

2021-06-14 Thread Noel Grandin (via logerrit)
 cppu/source/typelib/typelib.cxx |  131 ++--
 1 file changed, 48 insertions(+), 83 deletions(-)

New commits:
commit 859978445daeb848d033f64736709503ec44a7bb
Author: Noel Grandin 
AuthorDate: Mon Jun 14 10:00:26 2021 +0200
Commit: Noel Grandin 
CommitDate: Mon Jun 14 10:53:42 2021 +0200

flatten TypeDescriptor_Init_Impl data-structure

avoid unnecessary pointer-chasing for something we are going
to use ~always

Change-Id: I9e1ae0c5b1754fca2e7e1c26441c598dd0eea5dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117111
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index 85a393534f07..a64ff8065553 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -170,13 +170,13 @@ namespace {
 struct TypeDescriptor_Init_Impl
 {
 // all type description references
-std::unique_ptr pWeakMap;
+WeakMap_Impl maWeakMap;
 // all type description callbacks
-std::unique_ptr pCallbacks;
+CallbackSet_Impl maCallbacks;
 // A cache to hold descriptions
-std::unique_ptr pCache;
+TypeDescriptionList_Impl maCache;
 // The mutex to guard all type library accesses
-std::unique_ptr  pMutex;
+Mutex  maMutex;
 
 inline Mutex & getMutex();
 
@@ -203,13 +203,7 @@ struct TypeDescriptor_Init_Impl
 
 inline Mutex & TypeDescriptor_Init_Impl::getMutex()
 {
-if( !pMutex )
-{
-MutexGuard aGuard( Mutex::getGlobalMutex() );
-if( !pMutex )
-pMutex.reset(new Mutex());
-}
-return * pMutex;
+return maMutex;
 }
 
 inline void TypeDescriptor_Init_Impl::callChain(
@@ -217,35 +211,28 @@ inline void TypeDescriptor_Init_Impl::callChain(
 {
 assert(ppRet != nullptr);
 assert(*ppRet == nullptr);
-if (pCallbacks)
+for( const CallbackEntry & rEntry : maCallbacks )
 {
-for( const CallbackEntry & rEntry : *pCallbacks )
-{
-(*rEntry.second)( rEntry.first, ppRet, pName );
-if( *ppRet )
-return;
-}
+(*rEntry.second)( rEntry.first, ppRet, pName );
+if( *ppRet )
+return;
 }
 }
 
 
 TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl()
 {
-if( pCache )
+for( typelib_TypeDescription* pItem : maCache )
 {
-for( typelib_TypeDescription* pItem : *pCache )
-{
-typelib_typedescription_release( pItem );
-}
+typelib_typedescription_release( pItem );
 }
 
-if( pWeakMap )
 {
 std::vector< typelib_TypeDescriptionReference * > ppTDR;
-ppTDR.reserve( pWeakMap->size() );
+ppTDR.reserve( maWeakMap.size() );
 
 // save all weak references
-for( const auto& rEntry : *pWeakMap )
+for( const auto& rEntry : maWeakMap )
 {
 ppTDR.push_back( rEntry.second );
 typelib_typedescriptionreference_acquire( ppTDR.back() );
@@ -265,7 +252,7 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl()
 }
 
 #if defined SAL_LOG_INFO
-for( const auto& rEntry : *pWeakMap )
+for( const auto& rEntry : maWeakMap )
 {
 typelib_TypeDescriptionReference * pTDR = rEntry.second;
 if (pTDR)
@@ -291,8 +278,7 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl()
 SAL_INFO_IF( nTypeDescriptionReferenceCount, "cppu.typelib", 
"nTypeDescriptionReferenceCount is not zero" );
 #endif
 
-SAL_INFO_IF( pCallbacks && !pCallbacks->empty(), "cppu.typelib", 
"pCallbacks is not NULL or empty" );
-pCallbacks.reset();
+SAL_INFO_IF( !maCallbacks.empty(), "cppu.typelib", "pCallbacks is not NULL 
or empty" );
 };
 
 namespace { struct Init : public rtl::Static< TypeDescriptor_Init_Impl, Init > 
{}; }
@@ -304,9 +290,7 @@ extern "C" void SAL_CALL 
typelib_typedescription_registerCallback(
 // todo mt safe: guard is no solution, can not acquire while calling 
callback!
 TypeDescriptor_Init_Impl  = Init::get();
 //  OslGuard aGuard( rInit.getMutex() );
-if( !rInit.pCallbacks )
-rInit.pCallbacks.reset(new CallbackSet_Impl);
-rInit.pCallbacks->push_back( CallbackEntry( pContext, pCallback ) );
+rInit.maCallbacks.push_back( CallbackEntry( pContext, pCallback ) );
 }
 
 
@@ -315,13 +299,12 @@ extern "C" void SAL_CALL 
typelib_typedescription_revokeCallback(
 SAL_THROW_EXTERN_C()
 {
 TypeDescriptor_Init_Impl  = Init::get();
-if( rInit.pCallbacks )
 {
 // todo mt safe: guard is no solution, can not acquire while calling 
callback!
 //  OslGuard aGuard( rInit.getMutex() );
 CallbackEntry aEntry( pContext, pCallback );
-rInit.pCallbacks->erase(std::remove(rInit.pCallbacks->begin(), 
rInit.pCallbacks->end(), aEntry),
-rInit.pCallbacks->end());
+

[Libreoffice-commits] core.git: cppu/source

2021-04-06 Thread Arnaud Versini (via logerrit)
 cppu/source/threadpool/thread.cxx |   15 +++
 cppu/source/threadpool/threadpool.cxx |   18 +-
 cppu/source/threadpool/threadpool.hxx |9 +
 3 files changed, 21 insertions(+), 21 deletions(-)

New commits:
commit 550a47f117cc35dbffbb6caef6db52acdd0c1453
Author: Arnaud Versini 
AuthorDate: Sat Mar 13 18:10:46 2021 +0100
Commit: Stephan Bergmann 
CommitDate: Tue Apr 6 10:22:34 2021 +0200

cppu : use std::mutex in threadpool

Change-Id: I559a2c533accfe95740c29d726833d0bbab210fa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112460
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/cppu/source/threadpool/thread.cxx 
b/cppu/source/threadpool/thread.cxx
index 794d8f35e7ec..c0c3bc9ae61d 100644
--- a/cppu/source/threadpool/thread.cxx
+++ b/cppu/source/threadpool/thread.cxx
@@ -42,9 +42,8 @@ namespace cppu_threadpool {
 SAL_WARN_IF(m_deque.size(), "cppu.threadpool", m_deque.size() << 
"Threads left");
 }
 
-bool ThreadAdmin::add( rtl::Reference< ORequestThread > const & p )
+bool ThreadAdmin::add_locked( rtl::Reference< ORequestThread > const & p )
 {
-MutexGuard aGuard( m_mutex );
 if( m_disposed )
 {
 return false;
@@ -60,21 +59,21 @@ namespace cppu_threadpool {
 
 void ThreadAdmin::remove( rtl::Reference< ORequestThread > const & p )
 {
-MutexGuard aGuard( m_mutex );
+std::scoped_lock aGuard( m_mutex );
 remove_locked( p );
 }
 
 void ThreadAdmin::join()
 {
 {
-MutexGuard aGuard( m_mutex );
+std::scoped_lock aGuard( m_mutex );
 m_disposed = true;
 }
 for (;;)
 {
 rtl::Reference< ORequestThread > pCurrent;
 {
-MutexGuard aGuard( m_mutex );
+std::scoped_lock aGuard( m_mutex );
 if( m_deque.empty() )
 {
 break;
@@ -118,8 +117,8 @@ namespace cppu_threadpool {
 // return value iff it causes osl::Thread::run to start executing:
 acquire();
 ThreadAdmin & rThreadAdmin = m_aThreadPool->getThreadAdmin();
-osl::ClearableMutexGuard g(rThreadAdmin.m_mutex);
-if (!rThreadAdmin.add( this )) {
+std::unique_lock g(rThreadAdmin.m_mutex);
+if (!rThreadAdmin.add_locked( this )) {
 return false;
 }
 try {
@@ -128,7 +127,7 @@ namespace cppu_threadpool {
 }
 } catch (...) {
 rThreadAdmin.remove_locked( this );
-g.clear();
+g.release();
 release();
 throw;
 }
diff --git a/cppu/source/threadpool/threadpool.cxx 
b/cppu/source/threadpool/threadpool.cxx
index c5783dc19989..257155027955 100644
--- a/cppu/source/threadpool/threadpool.cxx
+++ b/cppu/source/threadpool/threadpool.cxx
@@ -99,7 +99,7 @@ namespace cppu_threadpool
 {
 m_DisposedCallerAdmin->dispose( nDisposeId );
 
-MutexGuard guard( m_mutex );
+std::scoped_lock guard( m_mutex );
 for (auto const& item :  m_mapQueue)
 {
 if( item.second.first )
@@ -127,7 +127,7 @@ namespace cppu_threadpool
 {
 WaitingThread waitingThread(pThread);
 {
-MutexGuard guard( m_mutexWaitingThreadList );
+std::scoped_lock guard( m_mutexWaitingThreadList );
 m_dequeThreads.push_front(  );
 }
 
@@ -135,7 +135,7 @@ namespace cppu_threadpool
 waitingThread.condition.wait( std::chrono::seconds(2) );
 
 {
-MutexGuard guard ( m_mutexWaitingThreadList );
+std::scoped_lock guard ( m_mutexWaitingThreadList );
 if( waitingThread.thread.is() )
 {
 // thread wasn't reused, remove it from the list
@@ -150,7 +150,7 @@ namespace cppu_threadpool
 void ThreadPool::joinWorkers()
 {
 {
-MutexGuard guard( m_mutexWaitingThreadList );
+std::scoped_lock guard( m_mutexWaitingThreadList );
 for (auto const& thread : m_dequeThreads)
 {
 // wake the threads up
@@ -166,7 +166,7 @@ namespace cppu_threadpool
 {
 {
 // Can a thread be reused ?
-MutexGuard guard( m_mutexWaitingThreadList );
+std::scoped_lock guard( m_mutexWaitingThreadList );
 if( ! m_dequeThreads.empty() )
 {
 // inform the thread and let it go
@@ -190,7 +190,7 @@ namespace cppu_threadpool
 
 bool ThreadPool::revokeQueue( const ByteSequence , bool 
bAsynchron )
 {
-MutexGuard guard( m_mutex );
+std::scoped_lock guard( m_mutex );
 
 ThreadIdHashMap::iterator ii = m_mapQueue.find( aThreadId );
 OSL_ASSERT( ii != m_mapQueue.end() );
@@ -240,7 +240,7 @@ namespace cppu_threadpool
 bool bCreateThread = false;
 JobQueue 

[Libreoffice-commits] core.git: cppu/source

2021-02-01 Thread Stephan Bergmann (via logerrit)
 cppu/source/typelib/typelib.cxx |   55 +++-
 1 file changed, 32 insertions(+), 23 deletions(-)

New commits:
commit 56cada403f84d879ad137e00a97d9282c063cdd9
Author: Stephan Bergmann 
AuthorDate: Mon Feb 1 18:29:02 2021 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Feb 1 22:09:30 2021 +0100

Revert "Don't use global mutex here for local mutex initialization"

This reverts commit 0752de6850e4396a0138428d7ced2287a4902874, as it causes
initialization-order-fiasco, e.g. when building Gallery_backgrounds:

> ==913067==ERROR: AddressSanitizer: initialization-order-fiasco on address 
0x7fee04a01ba0 at pc 0x7fee0467257e bp 0x7ffd678aaa30 sp 0x7ffd678aaa28
> READ of size 8 at 0x7fee04a01ba0 thread T0
>  #0 in osl::Mutex::acquire() at include/osl/mutex.hxx:57:37 
(instdir/program/libuno_cppu.so.3 +0x32957d)
>  #1 in osl::Guard::Guard(osl::Mutex&) at 
include/osl/mutex.hxx:138:17 (instdir/program/libuno_cppu.so.3 +0x316a4e)
>  #2 in typelib_typedescriptionreference_new at 
cppu/source/typelib/typelib.cxx:2130:16 (instdir/program/libuno_cppu.so.3 
+0x3e2d9a)
>  #3 in typelib_static_type_getByTypeClass at 
cppu/source/typelib/static_types.cxx:266:17 (instdir/program/libuno_cppu.so.3 
+0x3c04af)
>  #4 in cppu::detail::getTypeFromTypeClass(_typelib_TypeClass) at 
include/cppu/unotype.hxx:110:9 (instdir/program/libxolo.so +0x2e87e61)
>  #5 in cppu::detail::cppu_detail_getUnoType(signed char const*) at 
include/cppu/unotype.hxx:136:12 (instdir/program/libxolo.so +0x2e902dd)
>  #6 in cppu::UnoType::get() at 
include/cppu/unotype.hxx:296:16 (instdir/program/libxolo.so +0x2e90278)
>  #7 in com::sun::star::uno::Type const& 
cppu::getTypeFavourUnsigned(signed char const*) at 
include/cppu/unotype.hxx:321:12 (instdir/program/libxolo.so +0x2e90218)
>  #8 in com::sun::star::uno::Type const& 
cppu::getTypeFavourUnsigned(com::sun::star::uno::Sequence const*) at include/com/sun/star/uno/Sequence.hxx:292:14 
(instdir/program/libxolo.so +0x2e9001a)
>  #9 in com::sun::star::uno::Sequence::Sequence() at 
include/com/sun/star/uno/Sequence.hxx:59:26 (instdir/program/libxolo.so 
+0x2e8ff58)
>  #10 in __cxx_global_var_init at 
xmloff/source/core/fasttokenhandler.cxx:35:48 (instdir/program/libxolo.so 
+0x3455d3f)
>  #11 in _GLOBAL__sub_I_fasttokenhandler.cxx at 
xmloff/source/core/fasttokenhandler.cxx (instdir/program/libxolo.so +0x3455da4)
>  #12 in call_init.part.0 at  (/lib64/ld-linux-x86-64.so.2 +0x108dd)
>  #13 in _dl_init at  (/lib64/ld-linux-x86-64.so.2 +0x109c7)
>  #14  at  (/lib64/ld-linux-x86-64.so.2 +0x10c9)
>
> 0x7fee04a01ba0 is located 0 bytes inside of global variable '(anonymous 
namespace)::s_Mutex' defined in 'cppu/source/typelib/typelib.cxx:286:12' 
(0x7fee04a01ba0) of size 8
>   registered at:
>  #0 in __asan_register_globals at 
~/github.com/llvm/llvm-project/compiler-rt/lib/asan/asan_globals.cpp:360:3 
(instdir/program/gengal.bin +0x28698d)
>  #1 in asan.module_ctor at  (instdir/program/libuno_cppu.so.3 
+0x42649b)

Change-Id: Iab673f048bfb76165de2c47c2db63e339069fd17
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110228
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index b5f960aa345a..85a393534f07 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -175,6 +175,10 @@ struct TypeDescriptor_Init_Impl
 std::unique_ptr pCallbacks;
 // A cache to hold descriptions
 std::unique_ptr pCache;
+// The mutex to guard all type library accesses
+std::unique_ptr  pMutex;
+
+inline Mutex & getMutex();
 
 inline void callChain( typelib_TypeDescription ** ppRet, rtl_uString * 
pName );
 
@@ -197,6 +201,17 @@ struct TypeDescriptor_Init_Impl
 
 }
 
+inline Mutex & TypeDescriptor_Init_Impl::getMutex()
+{
+if( !pMutex )
+{
+MutexGuard aGuard( Mutex::getGlobalMutex() );
+if( !pMutex )
+pMutex.reset(new Mutex());
+}
+return * pMutex;
+}
+
 inline void TypeDescriptor_Init_Impl::callChain(
 typelib_TypeDescription ** ppRet, rtl_uString * pName )
 {
@@ -280,13 +295,7 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl()
 pCallbacks.reset();
 };
 
-namespace
-{
-// The mutex to guard all type library accesses, goes before Init to be 
available in its dtor
-osl::Mutex s_Mutex;
-
-struct Init : public rtl::Static< TypeDescriptor_Init_Impl, Init > {};
-}
+namespace { struct Init : public rtl::Static< TypeDescriptor_Init_Impl, Init > 
{}; }
 
 extern "C" void SAL_CALL typelib_typedescription_registerCallback(
 void * pContext, typelib_typedescription_Callback pCallback )
@@ -294,7 +303,7 @@ extern "C" void SAL_CALL 
typelib_typedescription_registerCallback(
 {
 // todo mt safe: guard is no solution, can not acquire while calling 
callback!
 

[Libreoffice-commits] core.git: cppu/source

2021-01-30 Thread Mike Kaganski (via logerrit)
 cppu/source/typelib/typelib.cxx |   55 
 1 file changed, 23 insertions(+), 32 deletions(-)

New commits:
commit 0752de6850e4396a0138428d7ced2287a4902874
Author: Mike Kaganski 
AuthorDate: Sat Jan 30 19:20:32 2021 +0100
Commit: Mike Kaganski 
CommitDate: Sun Jan 31 08:43:21 2021 +0100

Don't use global mutex here for local mutex initialization

Change-Id: I06b0856ac5559aca472daf241771a2ef57b44912
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110147
Tested-by: Mike Kaganski 
Reviewed-by: Mike Kaganski 

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index 85a393534f07..b5f960aa345a 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -175,10 +175,6 @@ struct TypeDescriptor_Init_Impl
 std::unique_ptr pCallbacks;
 // A cache to hold descriptions
 std::unique_ptr pCache;
-// The mutex to guard all type library accesses
-std::unique_ptr  pMutex;
-
-inline Mutex & getMutex();
 
 inline void callChain( typelib_TypeDescription ** ppRet, rtl_uString * 
pName );
 
@@ -201,17 +197,6 @@ struct TypeDescriptor_Init_Impl
 
 }
 
-inline Mutex & TypeDescriptor_Init_Impl::getMutex()
-{
-if( !pMutex )
-{
-MutexGuard aGuard( Mutex::getGlobalMutex() );
-if( !pMutex )
-pMutex.reset(new Mutex());
-}
-return * pMutex;
-}
-
 inline void TypeDescriptor_Init_Impl::callChain(
 typelib_TypeDescription ** ppRet, rtl_uString * pName )
 {
@@ -295,7 +280,13 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl()
 pCallbacks.reset();
 };
 
-namespace { struct Init : public rtl::Static< TypeDescriptor_Init_Impl, Init > 
{}; }
+namespace
+{
+// The mutex to guard all type library accesses, goes before Init to be 
available in its dtor
+osl::Mutex s_Mutex;
+
+struct Init : public rtl::Static< TypeDescriptor_Init_Impl, Init > {};
+}
 
 extern "C" void SAL_CALL typelib_typedescription_registerCallback(
 void * pContext, typelib_typedescription_Callback pCallback )
@@ -303,7 +294,7 @@ extern "C" void SAL_CALL 
typelib_typedescription_registerCallback(
 {
 // todo mt safe: guard is no solution, can not acquire while calling 
callback!
 TypeDescriptor_Init_Impl  = Init::get();
-//  OslGuard aGuard( rInit.getMutex() );
+//  OslGuard aGuard( s_Mutex );
 if( !rInit.pCallbacks )
 rInit.pCallbacks.reset(new CallbackSet_Impl);
 rInit.pCallbacks->push_back( CallbackEntry( pContext, pCallback ) );
@@ -318,7 +309,7 @@ extern "C" void SAL_CALL 
typelib_typedescription_revokeCallback(
 if( rInit.pCallbacks )
 {
 // todo mt safe: guard is no solution, can not acquire while calling 
callback!
-//  OslGuard aGuard( rInit.getMutex() );
+//  OslGuard aGuard( s_Mutex );
 CallbackEntry aEntry( pContext, pCallback );
 rInit.pCallbacks->erase(std::remove(rInit.pCallbacks->begin(), 
rInit.pCallbacks->end(), aEntry),
 rInit.pCallbacks->end());
@@ -351,7 +342,7 @@ static void typelib_typedescription_initTables(
 }
 }
 
-MutexGuard aGuard( Init::get().getMutex() );
+MutexGuard aGuard(s_Mutex);
 if( pTD->bComplete )
 return;
 
@@ -465,7 +456,7 @@ bool complete(typelib_TypeDescription ** ppTypeDescr, bool 
initTables) {
 OSL_ASSERT( pTD == *ppTypeDescr ); // has to merge into existing 
one
 
 // insert into the cache
-MutexGuard aGuard( rInit.getMutex() );
+MutexGuard aGuard(s_Mutex);
 if( !rInit.pCache )
 rInit.pCache.reset( new TypeDescriptionList_Impl );
 if( static_cast(rInit.pCache->size()) >= nCacheSize )
@@ -1364,7 +1355,7 @@ extern "C" void SAL_CALL typelib_typedescription_release(
 if( pTD->pWeakRef )
 {
 {
-MutexGuard aGuard( rInit.getMutex() );
+MutexGuard aGuard(s_Mutex);
 // remove this description from the weak reference
 pTD->pWeakRef->pType = nullptr;
 }
@@ -1376,7 +1367,7 @@ extern "C" void SAL_CALL typelib_typedescription_release(
 // this description is a reference too, so remove it from the hash 
table
 if( rInit.pWeakMap )
 {
-MutexGuard aGuard( rInit.getMutex() );
+MutexGuard aGuard(s_Mutex);
 WeakMap_Impl::iterator aIt = rInit.pWeakMap->find( 
pTD->pTypeName->buffer );
 if( aIt != rInit.pWeakMap->end() && static_cast((*aIt).second) == static_cast(pTD) )
 {
@@ -1426,7 +1417,7 @@ extern "C" void SAL_CALL typelib_typedescription_register(
 {
 // connect the description with the weak reference
 TypeDescriptor_Init_Impl  = Init::get();
-ClearableMutexGuard aGuard( rInit.getMutex() );
+ClearableMutexGuard aGuard(s_Mutex);
 
 typelib_TypeDescriptionReference * pTDR = nullptr;
 

[Libreoffice-commits] core.git: cppu/source

2021-01-30 Thread Mike Kaganski (via logerrit)
 cppu/source/threadpool/current.cxx |   49 -
 1 file changed, 6 insertions(+), 43 deletions(-)

New commits:
commit ef6a57ed4e8984bed06e2911b07436498710d80d
Author: Mike Kaganski 
AuthorDate: Fri Jan 29 14:58:02 2021 +0100
Commit: Mike Kaganski 
CommitDate: Sat Jan 30 22:14:36 2021 +0100

Don't use global mutex here for static initialization

Change-Id: I3fa0cd7e31a8c89b5fb1eba7b36636e02a785df8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110140
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/cppu/source/threadpool/current.cxx 
b/cppu/source/threadpool/current.cxx
index 7dbfc9050488..6acad514cac7 100644
--- a/cppu/source/threadpool/current.cxx
+++ b/cppu/source/threadpool/current.cxx
@@ -81,47 +81,6 @@ static typelib_InterfaceTypeDescription * 
get_type_XCurrentContext()
 return s_type_XCurrentContext;
 }
 
-namespace {
-
-class ThreadKey
-{
-bool _bInit;
-oslThreadKey _hThreadKey;
-oslThreadKeyCallbackFunction _pCallback;
-
-public:
-oslThreadKey getThreadKey()
-{
-if (! _bInit)
-{
-MutexGuard aGuard( Mutex::getGlobalMutex() );
-if (! _bInit)
-{
-_hThreadKey = ::osl_createThreadKey( _pCallback );
-_bInit = true;
-}
-}
-return _hThreadKey;
-}
-
-explicit ThreadKey( oslThreadKeyCallbackFunction pCallback )
-: _bInit(false)
-, _hThreadKey(nullptr)
-, _pCallback(pCallback)
-{
-}
-
-~ThreadKey()
-{
-if (_bInit)
-{
-::osl_destroyThreadKey( _hThreadKey );
-}
-}
-};
-
-}
-
 extern "C" {
 
 static void delete_IdContainer( void * p )
@@ -149,8 +108,12 @@ static void delete_IdContainer( void * p )
 
 IdContainer * getIdContainer()
 {
-static ThreadKey s_key( delete_IdContainer );
-oslThreadKey aKey = s_key.getThreadKey();
+struct ThreadKey
+{
+oslThreadKey _hThreadKey;
+~ThreadKey() { osl_destroyThreadKey(_hThreadKey); }
+} static const s_key{ osl_createThreadKey(delete_IdContainer) };
+oslThreadKey aKey = s_key._hThreadKey;
 
 IdContainer * pId = static_cast< IdContainer * >( ::osl_getThreadKeyData( 
aKey ) );
 if (! pId)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2021-01-29 Thread Mike Kaganski (via logerrit)
 cppu/source/typelib/typelib.cxx |   27 +--
 1 file changed, 9 insertions(+), 18 deletions(-)

New commits:
commit ff1e65afdc54a9f142202687c9c2949fdd7e8b69
Author: Mike Kaganski 
AuthorDate: Fri Jan 29 12:41:24 2021 +0100
Commit: Mike Kaganski 
CommitDate: Fri Jan 29 21:44:14 2021 +0100

Simplify the ctor

Change-Id: Iad9b007f8a67353343813a44f46a8a0b88b555fd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110136
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index 21f84241f578..85a393534f07 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -184,26 +184,17 @@ struct TypeDescriptor_Init_Impl
 
 #if OSL_DEBUG_LEVEL > 0
 // only for debugging
-sal_Int32   nTypeDescriptionCount;
-sal_Int32   nCompoundTypeDescriptionCount;
-sal_Int32   nIndirectTypeDescriptionCount;
-sal_Int32   nEnumTypeDescriptionCount;
-sal_Int32   nInterfaceMethodTypeDescriptionCount;
-sal_Int32   nInterfaceAttributeTypeDescriptionCount;
-sal_Int32   nInterfaceTypeDescriptionCount;
-sal_Int32   nTypeDescriptionReferenceCount;
+sal_Int32 nTypeDescriptionCount = 0;
+sal_Int32 nCompoundTypeDescriptionCount = 0;
+sal_Int32 nIndirectTypeDescriptionCount = 0;
+sal_Int32 nEnumTypeDescriptionCount = 0;
+sal_Int32 nInterfaceMethodTypeDescriptionCount = 0;
+sal_Int32 nInterfaceAttributeTypeDescriptionCount = 0;
+sal_Int32 nInterfaceTypeDescriptionCount = 0;
+sal_Int32 nTypeDescriptionReferenceCount = 0;
 #endif
 
-TypeDescriptor_Init_Impl()
-#if OSL_DEBUG_LEVEL > 0
-: nTypeDescriptionCount(0), nCompoundTypeDescriptionCount(0),
-nIndirectTypeDescriptionCount(0),
-nEnumTypeDescriptionCount(0),
-nInterfaceMethodTypeDescriptionCount(0),
-nInterfaceAttributeTypeDescriptionCount(0),
-nInterfaceTypeDescriptionCount(0), nTypeDescriptionReferenceCount(0)
-#endif
-{}
+TypeDescriptor_Init_Impl() = default;
 
 ~TypeDescriptor_Init_Impl();
 };
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source include/com

2020-09-25 Thread Caolán McNamara (via logerrit)
 cppu/source/uno/sequence.cxx  |3 +--
 include/com/sun/star/uno/Sequence.hxx |9 -
 2 files changed, 1 insertion(+), 11 deletions(-)

New commits:
commit 92906c11610f3f4c07ed730f6538d92c78533cd4
Author: Caolán McNamara 
AuthorDate: Fri Sep 25 12:19:51 2020 +0100
Commit: Caolán McNamara 
CommitDate: Fri Sep 25 15:16:06 2020 +0200

cid#1448292 coverity has difficulty with css::uno::Sequence

current attempt isn't working, try a different approach to
silence these warnings

Change-Id: I0cc97df0897abc665dfbb683d7aa0df55f8affb2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103387
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/cppu/source/uno/sequence.cxx b/cppu/source/uno/sequence.cxx
index 72d3e3ead42b..c467f2c38704 100644
--- a/cppu/source/uno/sequence.cxx
+++ b/cppu/source/uno/sequence.cxx
@@ -307,7 +307,7 @@ static bool idefaultConstructElements(
 return true;
 }
 
-
+// coverity[ -tainted_data_sink : arg-1 ]
 static bool icopyConstructFromElements(
 uno_Sequence ** ppSeq, void * pSourceElements,
 typelib_TypeDescriptionReference * pElementType,
@@ -652,7 +652,6 @@ static bool ireallocSequence(
 extern "C"
 {
 
-
 sal_Bool SAL_CALL uno_type_sequence_construct(
 uno_Sequence ** ppSequence, typelib_TypeDescriptionReference * pType,
 void * pElements, sal_Int32 len,
diff --git a/include/com/sun/star/uno/Sequence.hxx 
b/include/com/sun/star/uno/Sequence.hxx
index 3d0c024a1da3..af82925d5f1b 100644
--- a/include/com/sun/star/uno/Sequence.hxx
+++ b/include/com/sun/star/uno/Sequence.hxx
@@ -73,20 +73,11 @@ inline Sequence< E >::Sequence(
 {
 }
 
-#if defined(__COVERITY__)
-extern "C" void __coverity_tainted_data_sanitize__(void *);
-#endif
-
 template< class E >
 inline Sequence< E >::Sequence( const E * pElements, sal_Int32 len )
 {
 const Type & rType = ::cppu::getTypeFavourUnsigned( this );
 
-#if defined(__COVERITY__)
-// cid#1448292 coverity has difficulty with css::uno::Sequence
-__coverity_tainted_data_sanitize__(const_cast(pElements));
-#endif
-
 bool success =
 ::uno_type_sequence_construct(
 &_pSequence, rType.getTypeLibType(),
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2020-08-17 Thread Stephan Bergmann (via logerrit)
 cppu/source/typelib/typelib.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 3d0aca29e307af9f35e6c0e955c48ed9066e7fb8
Author: Stephan Bergmann 
AuthorDate: Mon Aug 17 11:17:32 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Aug 17 13:36:08 2020 +0200

Remove dead comment

...which had been dead ever since b525a3115f54576017a576ff842dede5e2e3545d
"initial import" and whose removal has already been suggested in
04bb20f5ad182fd1aa8a4e2e7f569043be8405c1 "Fix typo"

Change-Id: I57d1e284e9c38836dca620fd3d0058fc5c6f098e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100854
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index 587f3c6e6405..0a84ee4cb708 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -170,7 +170,6 @@ namespace {
 
 struct TypeDescriptor_Init_Impl
 {
-//sal_Bool  bDestructorCalled;
 // all type description references
 std::unique_ptr pWeakMap;
 // all type description callbacks
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2020-08-15 Thread Andrea Gelmini (via logerrit)
 cppu/source/typelib/typelib.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 04bb20f5ad182fd1aa8a4e2e7f569043be8405c1
Author: Andrea Gelmini 
AuthorDate: Sat Aug 15 17:35:40 2020 +0200
Commit: Julien Nabet 
CommitDate: Sat Aug 15 19:08:27 2020 +0200

Fix typo

bDesctructorCalled doesn't exist in the code anymore.
I guess we can delete the comment.

Change-Id: I551efe2298422e5139f1dd07a6b3bf4728763026
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100774
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index 8b8f7d1b32f1..587f3c6e6405 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -170,7 +170,7 @@ namespace {
 
 struct TypeDescriptor_Init_Impl
 {
-//sal_Bool  bDesctructorCalled;
+//sal_Bool  bDestructorCalled;
 // all type description references
 std::unique_ptr pWeakMap;
 // all type description callbacks
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2020-08-05 Thread Stephan Bergmann (via logerrit)
 cppu/source/uno/check.cxx |   11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 41723365f680421f12869d5af2e895f94a25d9d5
Author: Stephan Bergmann 
AuthorDate: Tue Aug 4 17:16:59 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Aug 5 08:07:41 2020 +0200

Avoid warnings about unused Char4

Change-Id: Ibcb256552ee03b14a76463be3d9b7ce53213fa7a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100124
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/cppu/source/uno/check.cxx b/cppu/source/uno/check.cxx
index d1ce9bbc0c6f..8e99ff0a35c3 100644
--- a/cppu/source/uno/check.cxx
+++ b/cppu/source/uno/check.cxx
@@ -133,11 +133,6 @@ struct Char3 : public Char2
 {
 char c3 CPPU_GCC3_ALIGN( Char2 );
 };
-struct Char4
-{
-Char3 chars;
-char c;
-};
 enum Enum
 {
 v = SAL_MAX_ENUM
@@ -258,6 +253,12 @@ static_assert(sizeof(second) == sizeof(int), 
"sizeof(second) != sizeof(int)");
 
 #if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
 
+struct Char4
+{
+Char3 chars;
+char c;
+};
+
 #define OFFSET_OF( s, m ) reinterpret_cast< size_t >(reinterpret_cast(_cast(16)->m) -16)
 
 class BinaryCompatible_Impl
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2020-07-01 Thread Stephan Bergmann (via logerrit)
 cppu/source/typelib/static_types.cxx |2 +-
 cppu/source/typelib/typelib.cxx  |4 ++--
 cppu/source/uno/check.cxx|2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit cf1d55096a06ff4293046578d83735134a3014d6
Author: Stephan Bergmann 
AuthorDate: Tue Jun 30 19:07:19 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Jul 1 08:11:32 2020 +0200

Upcoming improved loplugin:staticanonymous -> redundantstatic: cppu

Change-Id: Iac1bd5cb1ff1a1786471b2d8b8a3c500a2e15c5c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97546
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/cppu/source/typelib/static_types.cxx 
b/cppu/source/typelib/static_types.cxx
index 6ff99b1f4ae0..d94f8485f801 100644
--- a/cppu/source/typelib/static_types.cxx
+++ b/cppu/source/typelib/static_types.cxx
@@ -68,7 +68,7 @@ struct AlignSize_Impl
 #endif
 
 // the value of the maximal alignment
-static const sal_Int32 nMaxAlignment = static_cast( 
reinterpret_cast(_cast(16)->dDouble) - 
16);
+const sal_Int32 nMaxAlignment = static_cast( 
reinterpret_cast(_cast(16)->dDouble) - 
16);
 
 static sal_Int32 adjustAlignment( sal_Int32 nRequestedAlignment )
 {
diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index e16c2eb90319..d9f445272510 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -75,7 +75,7 @@ struct AlignSize_Impl
 #endif
 
 // the value of the maximal alignment
-static const sal_Int32 nMaxAlignment = static_cast( 
reinterpret_cast(_cast(16)->dDouble) - 
16);
+const sal_Int32 nMaxAlignment = static_cast( 
reinterpret_cast(_cast(16)->dDouble) - 
16);
 
 static sal_Int32 adjustAlignment( sal_Int32 nRequestedAlignment )
 {
@@ -2355,7 +2355,7 @@ extern "C" void SAL_CALL typelib_setCacheSize( sal_Int32 
nNewSize )
 }
 
 
-static const bool s_aAssignableFromTab[11][11] =
+const bool s_aAssignableFromTab[11][11] =
 {
   /* from CH,BO,BY,SH,US,LO,
UL,HY,UH,FL,DO */
 /* TypeClass_CHAR */{ true,  false, false, false, false, false, 
false, false, false, false, false },
diff --git a/cppu/source/uno/check.cxx b/cppu/source/uno/check.cxx
index 3dc0fc5aca0c..d1ce9bbc0c6f 100644
--- a/cppu/source/uno/check.cxx
+++ b/cppu/source/uno/check.cxx
@@ -311,7 +311,7 @@ BinaryCompatible_Impl::BinaryCompatible_Impl()
 assert(OFFSET_OF(Char4, c) == 3);
 }
 
-static BinaryCompatible_Impl aTest;
+BinaryCompatible_Impl aTest;
 
 #endif
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2020-06-26 Thread Stephan Bergmann (via logerrit)
 cppu/source/threadpool/threadpool.cxx |8 ++--
 cppu/source/threadpool/threadpool.hxx |3 ++-
 2 files changed, 8 insertions(+), 3 deletions(-)

New commits:
commit ad0779ed5ed14ab71cbf4247351827983f6393f7
Author: Stephan Bergmann 
AuthorDate: Fri Jun 26 07:58:40 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Jun 26 10:43:40 2020 +0200

Handle uno_threadpool_dispose in parallel with uno_threadpool_putJob

While tracking down the issue discussed in the commit message of
78dc7d982b65c1843a288b80da83f8766e85d0cf "Remove a potentially already 
enqueued
response when a bridge is disposed", it occurred to me that there should be 
a
race in those

  uno_threadpool_putJob(
bridge_->getThreadPool(), ...);

calls in binaryurp/source/reader.cxx, when the bridge gets disposed (through
some other thread) between the time the bridge_->getThreadPool() call 
checks for
the bridge being disposed (in which case it would throw a 
DisposedException) and
the actual uno_threadpool_putJob call.

I tried to catch that with a previous incarnation of this change
( "Jenkins Slides Through 
the
Tiny Window"), but couldn't---presumably because this race would be very 
rare
after all, and the issue I was chasing turned out to be caused by something
different anyway.  Nevertheless, I wanted to address this potential race 
now.

We can only reliably check for disposed'ness after having locked 
ThreadPool's
m_mutex in uno_threadpool_putJob -> ThreadPool::addJob, but at which time 
we can
no longer indicate this condition to the caller---uno_threapool_putJob is 
part
of the stable URE interface, has a void return type, and should not throw 
any
exceptions as it is a C function.  However, if the bridge gets disposed, any
threads that would wait for this job (in cppu_threadpool::JobQueue::enter,
either from cppu_threadpool::ORequestThread::run waiting to process new 
incoming
calls, or from a bridge's call to uno_threadpool_enter waiting for a 
respose to
an outgoing call) should already learn about the bridge being disposed by
falling out of cppu_threadpool::JobQueue::enter with a null return value.  
So it
should be OK if uno_threadpool_putJob silently discards the job in that 
case.

Change-Id: I36fe996436f55a93d84d66cc0b164e2e45a37e81
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96120
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/cppu/source/threadpool/threadpool.cxx 
b/cppu/source/threadpool/threadpool.cxx
index a9608fef3e1b..c5783dc19989 100644
--- a/cppu/source/threadpool/threadpool.cxx
+++ b/cppu/source/threadpool/threadpool.cxx
@@ -234,12 +234,16 @@ namespace cppu_threadpool
 const ByteSequence  ,
 bool bAsynchron,
 void *pThreadSpecificData,
-RequestFun * doRequest )
+RequestFun * doRequest,
+void const * disposeId )
 {
 bool bCreateThread = false;
 JobQueue *pQueue = nullptr;
 {
 MutexGuard guard( m_mutex );
+if (m_DisposedCallerAdmin->isDisposed(disposeId)) {
+return true;
+}
 
 ThreadIdHashMap::iterator ii = m_mapQueue.find( aThreadId );
 
@@ -434,7 +438,7 @@ uno_threadpool_putJob(
 void ( SAL_CALL * doRequest ) ( void *pThreadSpecificData ),
 sal_Bool bIsOneway ) SAL_THROW_EXTERN_C()
 {
-if (!getThreadPool(hPool)->addJob( pThreadId, bIsOneway, pJob ,doRequest ))
+if (!getThreadPool(hPool)->addJob( pThreadId, bIsOneway, pJob ,doRequest, 
hPool ))
 {
 SAL_WARN(
 "cppu.threadpool",
diff --git a/cppu/source/threadpool/threadpool.hxx 
b/cppu/source/threadpool/threadpool.hxx
index c86e6575bb66..f473e2519348 100644
--- a/cppu/source/threadpool/threadpool.hxx
+++ b/cppu/source/threadpool/threadpool.hxx
@@ -126,7 +126,8 @@ namespace cppu_threadpool {
 bool addJob( const ::rtl::ByteSequence ,
  bool bAsynchron,
  void *pThreadSpecificData,
- RequestFun * doRequest );
+ RequestFun * doRequest,
+ void const * disposeId );
 
 void prepare( const ::rtl::ByteSequence  );
 void * enter( const ::rtl::ByteSequence , void const * 
nDisposeId );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2020-06-16 Thread Stephan Bergmann (via logerrit)
 cppu/source/threadpool/jobqueue.cxx   |   76 +-
 cppu/source/threadpool/jobqueue.hxx   |   12 +++--
 cppu/source/threadpool/threadpool.hxx |2 
 3 files changed, 39 insertions(+), 51 deletions(-)

New commits:
commit a0bc388b38859ab67067340f836f26fa8f850cbf
Author: Stephan Bergmann 
AuthorDate: Tue Jun 16 08:25:36 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Tue Jun 16 10:02:24 2020 +0200

Use the saner std::condition_variable semantics for JobQueue::m_cndWait

This avoids the need for the tricky osl::Condition::reset calls.  For 
example,
the first one (in the "disposed !" case) had been added with
2a3ed89284890615ad4bce57be55ba558351cde1 "sb132: #i112448# proper clean up 
in
JobQueue::enter (patch by olistraub)" as

>  if( 0 == m_lstCallstack.front() )
>  {
>  // disposed !
> +if( m_lstJob.empty() )
> +{
> +osl_resetCondition( m_cndWait );
> +}
>  break;
>  }
>

and then change to

>  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 );
>  }

with cba3ac1eab7acaf8e6efd7a00eee7c5e969fc49b "Avoid deadlocks when 
disposing
recursive JobQueue::enter", which prevented the reset from ever hapening
(because m_lstCallstack.front() cannot both be zero and non-zero here at the
same time).  The std::condition_variable semantics nicely avoid any 
reasoning
whether or not a reset would be necessary here.

Change-Id: Ic9b57b836bb6679829f4aa3b68679256726acf60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96406
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/cppu/source/threadpool/jobqueue.cxx 
b/cppu/source/threadpool/jobqueue.cxx
index 748bc06a422e..1be424024d4b 100644
--- a/cppu/source/threadpool/jobqueue.cxx
+++ b/cppu/source/threadpool/jobqueue.cxx
@@ -17,12 +17,12 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include "jobqueue.hxx"
-#include "threadpool.hxx"
+#include 
 
-#include 
+#include 
 
-using namespace ::osl;
+#include "jobqueue.hxx"
+#include "threadpool.hxx"
 
 namespace cppu_threadpool {
 
@@ -35,12 +35,12 @@ namespace cppu_threadpool {
 
 void JobQueue::add( void *pThreadSpecificData, RequestFun * doRequest )
 {
-MutexGuard guard( m_mutex );
+std::scoped_lock guard( m_mutex );
 Job job = { pThreadSpecificData , doRequest };
 m_lstJob.push_back( job );
 if( ! m_bSuspended )
 {
-m_cndWait.set();
+m_cndWait.notify_all();
 }
 m_nToDo ++;
 }
@@ -50,7 +50,7 @@ namespace cppu_threadpool {
 void *pReturn = nullptr;
 {
 // synchronize with the dispose calls
-MutexGuard guard( m_mutex );
+std::scoped_lock guard( m_mutex );
 if( m_DisposedCallerAdmin->isDisposed( nDisposeId ) )
 {
 return nullptr;
@@ -61,21 +61,16 @@ namespace cppu_threadpool {
 
 while( true )
 {
-if( bReturnWhenNoJob )
+struct Job job={nullptr,nullptr};
 {
-MutexGuard guard( m_mutex );
-if( m_lstJob.empty() )
+std::unique_lock guard( m_mutex );
+
+while (m_bSuspended
+   || (m_lstCallstack.front() != nullptr && 
!bReturnWhenNoJob
+   && m_lstJob.empty()))
 {
-break;
+m_cndWait.wait(guard);
 }
-}
-
-m_cndWait.wait();
-
-struct Job job={nullptr,nullptr};
-{
-// synchronize with add and dispose calls
-MutexGuard guard( m_mutex );
 
 if( nullptr == m_lstCallstack.front() )
 {
@@ -87,38 +82,29 @@ namespace cppu_threadpool {
 // response here:
 m_lstJob.pop_front();
 }
-if( m_lstJob.empty()
-&& (m_lstCallstack.empty()
-|| m_lstCallstack.front() != nullptr) )
-{
-m_cndWait.reset();
-}
 break;
 }
 
-OSL_ASSERT( ! m_lstJob.empty() );
-if( ! m_lstJob.empty() )
-   

[Libreoffice-commits] core.git: cppu/source

2020-06-15 Thread Stephan Bergmann (via logerrit)
 cppu/source/threadpool/jobqueue.cxx   |   12 ++--
 cppu/source/threadpool/jobqueue.hxx   |6 +++---
 cppu/source/threadpool/thread.cxx |3 +--
 cppu/source/threadpool/threadpool.cxx |   21 +
 cppu/source/threadpool/threadpool.hxx |   14 +++---
 5 files changed, 26 insertions(+), 30 deletions(-)

New commits:
commit d8feb7738d30a97936ee8d57cd6be03944c8d0d5
Author: Stephan Bergmann 
AuthorDate: Mon Jun 15 19:41:37 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Jun 15 22:24:29 2020 +0200

Model the dispose tokens as `void const *` instead of `sal_Int64`

...which avoids the sal_IntPtr casts

Change-Id: I518fcefc66d297b56c9bd94f7826a44715acb5f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96392
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/cppu/source/threadpool/jobqueue.cxx 
b/cppu/source/threadpool/jobqueue.cxx
index b4974fdc1724..748bc06a422e 100644
--- a/cppu/source/threadpool/jobqueue.cxx
+++ b/cppu/source/threadpool/jobqueue.cxx
@@ -45,7 +45,7 @@ namespace cppu_threadpool {
 m_nToDo ++;
 }
 
-void *JobQueue::enter( sal_Int64 nDisposeId , bool bReturnWhenNoJob )
+void *JobQueue::enter( void const * nDisposeId , bool bReturnWhenNoJob )
 {
 void *pReturn = nullptr;
 {
@@ -77,7 +77,7 @@ namespace cppu_threadpool {
 // synchronize with add and dispose calls
 MutexGuard guard( m_mutex );
 
-if( 0 == m_lstCallstack.front() )
+if( nullptr == m_lstCallstack.front() )
 {
 // disposed !
 if (!m_lstJob.empty() && m_lstJob.front().doRequest == 
nullptr) {
@@ -89,7 +89,7 @@ namespace cppu_threadpool {
 }
 if( m_lstJob.empty()
 && (m_lstCallstack.empty()
-|| m_lstCallstack.front() != 0) )
+|| m_lstCallstack.front() != nullptr) )
 {
 m_cndWait.reset();
 }
@@ -103,7 +103,7 @@ namespace cppu_threadpool {
 m_lstJob.pop_front();
 }
 if( m_lstJob.empty()
-&& (m_lstCallstack.empty() || m_lstCallstack.front() != 0) 
)
+&& (m_lstCallstack.empty() || m_lstCallstack.front() != 
nullptr) )
 {
 m_cndWait.reset();
 }
@@ -133,14 +133,14 @@ namespace cppu_threadpool {
 return pReturn;
 }
 
-void JobQueue::dispose( sal_Int64 nDisposeId )
+void JobQueue::dispose( void const * nDisposeId )
 {
 MutexGuard guard( m_mutex );
 for( auto& rId : m_lstCallstack )
 {
 if( rId == nDisposeId )
 {
-rId = 0;
+rId = nullptr;
 }
 }
 
diff --git a/cppu/source/threadpool/jobqueue.hxx 
b/cppu/source/threadpool/jobqueue.hxx
index abfdfa19d661..a0ccf5430385 100644
--- a/cppu/source/threadpool/jobqueue.hxx
+++ b/cppu/source/threadpool/jobqueue.hxx
@@ -47,8 +47,8 @@ namespace cppu_threadpool
 
 void add( void *pThreadSpecificData, RequestFun * doRequest );
 
-void *enter( sal_Int64 nDisposeId , bool bReturnWhenNoJob = false );
-void dispose( sal_Int64 nDisposeId );
+void *enter( void const * nDisposeId , bool bReturnWhenNoJob = false );
+void dispose( void const * nDisposeId );
 
 void suspend();
 void resume();
@@ -60,7 +60,7 @@ namespace cppu_threadpool
 private:
 mutable ::osl::Mutex m_mutex;
 std::deque < struct Job > m_lstJob;
-std::deque  m_lstCallstack;
+std::deque  m_lstCallstack;
 sal_Int32 m_nToDo;
 bool m_bSuspended;
 osl::Condition m_cndWait;
diff --git a/cppu/source/threadpool/thread.cxx 
b/cppu/source/threadpool/thread.cxx
index 2af33eff7c34..794d8f35e7ec 100644
--- a/cppu/source/threadpool/thread.cxx
+++ b/cppu/source/threadpool/thread.cxx
@@ -163,8 +163,7 @@ namespace cppu_threadpool {
 //It does not make sense to dispose a call in this 
state.
 //That's way we put it a disposeid, that can't be 
used otherwise.
 m_pQueue->enter(
-sal::static_int_cast< sal_Int64 >(
-reinterpret_cast< sal_IntPtr >(this)),
+this,
 true );
 
 if( m_pQueue->isEmpty() )
diff --git a/cppu/source/threadpool/threadpool.cxx 
b/cppu/source/threadpool/threadpool.cxx
index d11268b85784..a9608fef3e1b 100644
--- a/cppu/source/threadpool/threadpool.cxx
+++ b/cppu/source/threadpool/threadpool.cxx
@@ -66,19 +66,19 @@ namespace cppu_threadpool
 SAL_WARN_IF( !m_vector.empty(), "cppu.threadpool", "DisposedCallerList 
:  " << m_vector.size() << " 

[Libreoffice-commits] core.git: cppu/source

2020-06-15 Thread Stephan Bergmann (via logerrit)
 cppu/source/threadpool/jobqueue.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit 78dc7d982b65c1843a288b80da83f8766e85d0cf
Author: Stephan Bergmann 
AuthorDate: Mon Jun 15 13:22:58 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Jun 15 16:07:26 2020 +0200

Remove a potentially already enqueued response when a bridge is disposed

...while a remote call is in progress.  Otherwise, if the same thread later
makes another remote call (through another bridge), it would erroneously 
pair
the repsonse for the disposed call with the second call.

UITest_calc_demo started to fail that way occasionally, presumably after
77445e201c45e5593761e8399c32f80eea2178a4 "Make Chart Creation Wizard 
async", but
for reasons rather unrelated to the contents of that commit.  What 
apparently
happened is that in one test's tearDown, the bridge between the Python and 
the
soffice process happened to be disposed during the XDesktop::terminate call 
from
Python's main thread, so that the response (of type BOOLEAN) remained in the
JobQueue.  Then during the next test's setUp, XUnoUrlResolver::resolve from
Python's main thread would internally make a remote queryInterface call for 
the
initial StarOffice.ComponentContext object, which returns an ANY of either 
VOID
or XInterface type.  But that call was then mis-matched with the leftover
BOOLEAN response, causing failure.

I was able to reproduce that reliably on Linux with a local hack of

> diff --git a/cppu/source/threadpool/jobqueue.cxx 
b/cppu/source/threadpool/jobqueue.cxx
> index 6c9324521f40..a87770bf8935 100644
> --- a/cppu/source/threadpool/jobqueue.cxx
> +++ b/cppu/source/threadpool/jobqueue.cxx
> @@ -71,6 +71,7 @@ namespace cppu_threadpool {
>  }
>
>  m_cndWait.wait();
> +timespec ms{0, 100}; nanosleep(, nullptr);
>
>  struct Job job={nullptr,nullptr};
>  {

introducing a sleep, so that other threads have a higher chance to dispose 
the
bridge (when the call being processed here is that XDesktop::dispose) after 
the
successful wait() but before the response is processed.  UITest_calc_demo 
then
failed with

[...]
> Execution time for create_chart.CalcChartUIDemo.test_activate_chart: 6.520
> tearDown: calling terminate()...
> caught while TearDown:
>  Traceback (most recent call last):
>   File "uitest/libreoffice/connection.py", line 127, in tearDown
> xDesktop.terminate()
> libreoffice.connection.com.sun.star.lang.DisposedException: Binary URP 
bridge disposed during call binaryurp/source/bridge.cxx:611
>
> ok
> test_cancel_immediately (create_chart.CalcChartUIDemo) ...
[...]
> warn:sal.osl.pipe:423851:425076:sal/osl/unx/pipe.cxx:442: recv() failed: 
ECONNRESET
> warn:binaryurp:423851:425076:binaryurp/source/bridge.cxx:843: undisposed 
bridge "" in state 2, potential deadlock ahead
[...]
> ==
> ERROR: test_cancel_immediately (create_chart.CalcChartUIDemo)
> --
> Traceback (most recent call last):
>   File "uitest/uitest/framework.py", line 25, in setUp
> self.connection.setUp()
>   File "uitest/libreoffice/connection.py", line 176, in setUp
> conn.setUp()
>   File "uitest/libreoffice/connection.py", line 57, in setUp
> self.xContext = self.connect(socket)
>   File "uitest/libreoffice/connection.py", line 107, in connect
> xContext = xUnoResolver.resolve(url)
> uno.com.sun.star.uno.RuntimeException: initial object queryInterface for 
OID "StarOffice.ComponentContext" returned ANY of type boolean 
binaryurp/source/bridge.cxx:883
[...]

Change-Id: Icf9aadbb38e7aaf844fe8e9ae99e165c1f33
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96326
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/cppu/source/threadpool/jobqueue.cxx 
b/cppu/source/threadpool/jobqueue.cxx
index 6c9324521f40..b4974fdc1724 100644
--- a/cppu/source/threadpool/jobqueue.cxx
+++ b/cppu/source/threadpool/jobqueue.cxx
@@ -80,6 +80,13 @@ namespace cppu_threadpool {
 if( 0 == m_lstCallstack.front() )
 {
 // disposed !
+if (!m_lstJob.empty() && m_lstJob.front().doRequest == 
nullptr) {
+// If this thread was waiting for a remote response, 
that response may or
+// may not have been enqueued; if it has not been 
enqueued, there cannot be
+// another enqueued response, so it is always correct 
to remove any enqueued
+// response here:
+m_lstJob.pop_front();
+  

[Libreoffice-commits] core.git: cppu/source

2020-04-28 Thread Stephan Bergmann (via logerrit)
 cppu/source/typelib/typelib.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 7cfc983f8f3f4d094cd01128043d5e2021cb80c6
Author: Stephan Bergmann 
AuthorDate: Mon Apr 27 21:46:38 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Tue Apr 28 08:07:16 2020 +0200

Fix printing rtl_uString*

...broken with ef513fd4b049b214a03fbe6e62a5ea43680a7a9b "remove unnecessary 
use
of OString::getStr"

Change-Id: I85f5ccb6c5114ea5e3eab43a3c1821292cf4e994
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92993
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index bbcd87b25638..d1a503e4265b 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -497,7 +497,9 @@ bool complete(typelib_TypeDescription ** ppTypeDescr, bool 
initTables) {
 }
 else
 {
-SAL_INFO( "cppu.typelib", "type cannot be completed: " <<  
(*ppTypeDescr)->pTypeName );
+SAL_INFO(
+"cppu.typelib",
+"type cannot be completed: " << 
OUString::unacquired(&(*ppTypeDescr)->pTypeName));
 return false;
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2020-04-23 Thread Caolán McNamara (via logerrit)
 cppu/source/typelib/typelib.cxx |   96 
 1 file changed, 48 insertions(+), 48 deletions(-)

New commits:
commit 256238ec6f84f94eaad5e667b9d507a7d9eaa136
Author: Caolán McNamara 
AuthorDate: Mon Apr 20 09:46:56 2020 +0100
Commit: Caolán McNamara 
CommitDate: Thu Apr 23 22:29:25 2020 +0200

cid#1462311 silence Use after free

etc.

revert this hunk of

commit 11785217594d863efb518aa8b8f2910cdcb9c59d
Date:   Tue Apr 14 14:55:22 2020 +0200

loplugin:buriedassign in c*

just to silence coverity

Change-Id: I6d8819a0ab073a56ab46944b170ef4ae3a28e4d0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92552
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index acd205ad07b2..bbcd87b25638 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -1363,68 +1363,68 @@ extern "C" void SAL_CALL 
typelib_typedescription_release(
 {
 sal_Int32 ref = osl_atomic_decrement( >nRefCount );
 OSL_ASSERT(ref >= 0);
-if (0 != ref)
-return;
-
-TypeDescriptor_Init_Impl  = Init::get();
-if( TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( pTD->eTypeClass ) )
+if (0 == ref)
 {
-if( pTD->pWeakRef )
+TypeDescriptor_Init_Impl  = Init::get();
+if( TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( pTD->eTypeClass ) )
 {
+if( pTD->pWeakRef )
 {
-MutexGuard aGuard( rInit.getMutex() );
-// remove this description from the weak reference
-pTD->pWeakRef->pType = nullptr;
+{
+MutexGuard aGuard( rInit.getMutex() );
+// remove this description from the weak reference
+pTD->pWeakRef->pType = nullptr;
+}
+typelib_typedescriptionreference_release( pTD->pWeakRef );
 }
-typelib_typedescriptionreference_release( pTD->pWeakRef );
 }
-}
-else
-{
-// this description is a reference too, so remove it from the hash 
table
-if( rInit.pWeakMap )
+else
 {
-MutexGuard aGuard( rInit.getMutex() );
-WeakMap_Impl::iterator aIt = rInit.pWeakMap->find( 
pTD->pTypeName->buffer );
-if( aIt != rInit.pWeakMap->end() && static_cast((*aIt).second) == static_cast(pTD) )
+// this description is a reference too, so remove it from the hash 
table
+if( rInit.pWeakMap )
 {
-// remove only if it contains the same object
-rInit.pWeakMap->erase( aIt );
+MutexGuard aGuard( rInit.getMutex() );
+WeakMap_Impl::iterator aIt = rInit.pWeakMap->find( 
pTD->pTypeName->buffer );
+if( aIt != rInit.pWeakMap->end() && static_cast((*aIt).second) == static_cast(pTD) )
+{
+// remove only if it contains the same object
+rInit.pWeakMap->erase( aIt );
+}
 }
 }
-}
 
-typelib_typedescription_destructExtendedMembers( pTD );
-rtl_uString_release( pTD->pTypeName );
+typelib_typedescription_destructExtendedMembers( pTD );
+rtl_uString_release( pTD->pTypeName );
 
 #if OSL_DEBUG_LEVEL > 0
-switch( pTD->eTypeClass )
-{
-case typelib_TypeClass_SEQUENCE:
-osl_atomic_decrement(  );
-break;
-case typelib_TypeClass_STRUCT:
-case typelib_TypeClass_EXCEPTION:
-osl_atomic_decrement(  );
-break;
-case typelib_TypeClass_INTERFACE:
-osl_atomic_decrement(  );
-break;
-case typelib_TypeClass_INTERFACE_METHOD:
-osl_atomic_decrement(  );
-break;
-case typelib_TypeClass_INTERFACE_ATTRIBUTE:
-osl_atomic_decrement(  );
-break;
-case typelib_TypeClass_ENUM:
-osl_atomic_decrement(  );
-break;
-default:
-osl_atomic_decrement(  );
-}
+switch( pTD->eTypeClass )
+{
+case typelib_TypeClass_SEQUENCE:
+osl_atomic_decrement(  );
+break;
+case typelib_TypeClass_STRUCT:
+case typelib_TypeClass_EXCEPTION:
+osl_atomic_decrement(  );
+break;
+case typelib_TypeClass_INTERFACE:
+osl_atomic_decrement(  );
+break;
+case typelib_TypeClass_INTERFACE_METHOD:
+osl_atomic_decrement(  
);
+break;
+case typelib_TypeClass_INTERFACE_ATTRIBUTE:
+osl_atomic_decrement( 
 );
+break;
+case typelib_TypeClass_ENUM:
+osl_atomic_decrement(  );
+break;
+default:
+osl_atomic_decrement(  );
+}
 #endif
 
-freeTypeDescription(pTD);
+freeTypeDescription(pTD);
+}
 }
 
 

[Libreoffice-commits] core.git: cppu/source

2020-04-23 Thread Stephan Bergmann (via logerrit)
 cppu/source/typelib/typelib.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 500c4a1442919715a504e90db592dcce0f31e1a5
Author: Stephan Bergmann 
AuthorDate: Thu Apr 23 20:51:37 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Apr 23 21:50:51 2020 +0200

Related tdf#115399: Reorder code slightly

...in preparation of a forthcoming fix for the issue

Change-Id: I6611778dfbc090eb869bf653cf7f61574a81b4f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92823
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index 339f470077af..acd205ad07b2 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -1497,15 +1497,15 @@ extern "C" void SAL_CALL 
typelib_typedescription_register(
 *ppNewDescription +1,
 nSize - sizeof(typelib_TypeDescription) );
 
-pTDR->pType->bComplete = (*ppNewDescription)->bComplete;
-pTDR->pType->nSize = (*ppNewDescription)->nSize;
-pTDR->pType->nAlignment = (*ppNewDescription)->nAlignment;
-
 memset(
 *ppNewDescription +1,
 0,
 nSize - sizeof( typelib_TypeDescription ) );
 
+pTDR->pType->bComplete = (*ppNewDescription)->bComplete;
+pTDR->pType->nSize = (*ppNewDescription)->nSize;
+pTDR->pType->nAlignment = (*ppNewDescription)->nAlignment;
+
 if( pTDR->pType->bOnDemand && !(*ppNewDescription)->bOnDemand )
 {
 // switch from OnDemand to !OnDemand, so the description 
must be acquired
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2020-04-18 Thread Noel Grandin (via logerrit)
 cppu/source/threadpool/current.cxx   |   30 +-
 cppu/source/typelib/static_types.cxx |  324 ++---
 cppu/source/typelib/typelib.cxx  |  382 +--
 cppu/source/uno/lbenv.cxx|   38 +--
 cppu/source/uno/lbmap.cxx|   44 ++--
 5 files changed, 409 insertions(+), 409 deletions(-)

New commits:
commit c12a5e83802699615d4226c83c2e6f135a3485b4
Author: Noel Grandin 
AuthorDate: Fri Apr 17 15:42:46 2020 +0200
Commit: Noel Grandin 
CommitDate: Sat Apr 18 09:56:28 2020 +0200

loplugin:flatten in cppu

Change-Id: I202698a0310bd26b98c1f744c8f21288f87643f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92450
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/cppu/source/threadpool/current.cxx 
b/cppu/source/threadpool/current.cxx
index 665f1b7c636e..7dbfc9050488 100644
--- a/cppu/source/threadpool/current.cxx
+++ b/cppu/source/threadpool/current.cxx
@@ -126,23 +126,23 @@ extern "C" {
 
 static void delete_IdContainer( void * p )
 {
-if (p)
+if (!p)
+return;
+
+IdContainer * pId = static_cast< IdContainer * >( p );
+if (pId->pCurrentContext)
 {
-IdContainer * pId = static_cast< IdContainer * >( p );
-if (pId->pCurrentContext)
-{
-(*pId->pCurrentContextEnv->releaseInterface)(
-pId->pCurrentContextEnv, pId->pCurrentContext );
-(*pId->pCurrentContextEnv->aBase.release)(
->pCurrentContextEnv->aBase );
-}
-if (pId->bInit)
-{
-::rtl_byte_sequence_release( pId->pLocalThreadId );
-::rtl_byte_sequence_release( pId->pCurrentId );
-}
-delete pId;
+(*pId->pCurrentContextEnv->releaseInterface)(
+pId->pCurrentContextEnv, pId->pCurrentContext );
+(*pId->pCurrentContextEnv->aBase.release)(
+>pCurrentContextEnv->aBase );
+}
+if (pId->bInit)
+{
+::rtl_byte_sequence_release( pId->pLocalThreadId );
+::rtl_byte_sequence_release( pId->pCurrentId );
 }
+delete pId;
 }
 
 }
diff --git a/cppu/source/typelib/static_types.cxx 
b/cppu/source/typelib/static_types.cxx
index 77f443a6a637..6ff99b1f4ae0 100644
--- a/cppu/source/typelib/static_types.cxx
+++ b/cppu/source/typelib/static_types.cxx
@@ -297,30 +297,30 @@ void SAL_CALL typelib_static_sequence_type_init(
 typelib_TypeDescriptionReference * pElementType )
 SAL_THROW_EXTERN_C()
 {
-if (! *ppRef)
-{
-MutexGuard aGuard( typelib_StaticInitMutex::get() );
-if (! *ppRef)
-{
-OUString aTypeName = "[]" + 
OUString::unacquired(>pTypeName);
+if ( *ppRef)
+return;
 
-static_assert( ! 
TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(typelib_TypeClass_SEQUENCE) );
-*ppRef = igetTypeByName( aTypeName.pData );
-if (!*ppRef)
-{
-typelib_TypeDescription * pReg = nullptr;
-::typelib_typedescription_new(
-, typelib_TypeClass_SEQUENCE,
-aTypeName.pData, pElementType, 0, nullptr );
-
-::typelib_typedescription_register(  );
-*ppRef = reinterpret_cast(pReg);
-assert( *ppRef == pReg->pWeakRef );
-}
-// another static ref:
-++((*ppRef)->nStaticRefCount);
-}
+MutexGuard aGuard( typelib_StaticInitMutex::get() );
+if ( *ppRef)
+return;
+
+OUString aTypeName = "[]" + OUString::unacquired(>pTypeName);
+
+static_assert( ! 
TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(typelib_TypeClass_SEQUENCE) );
+*ppRef = igetTypeByName( aTypeName.pData );
+if (!*ppRef)
+{
+typelib_TypeDescription * pReg = nullptr;
+::typelib_typedescription_new(
+, typelib_TypeClass_SEQUENCE,
+aTypeName.pData, pElementType, 0, nullptr );
+
+::typelib_typedescription_register(  );
+*ppRef = reinterpret_cast(pReg);
+assert( *ppRef == pReg->pWeakRef );
 }
+// another static ref:
+++((*ppRef)->nStaticRefCount);
 }
 
 
@@ -335,76 +335,76 @@ void init(
 {
 assert( eTypeClass == typelib_TypeClass_STRUCT || eTypeClass == 
typelib_TypeClass_EXCEPTION );
 
-if (! *ppRef)
-{
-MutexGuard aGuard( typelib_StaticInitMutex::get() );
-if (! *ppRef)
-{
-assert( ! 
TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(eTypeClass) );
-OUString aTypeName( OUString::createFromAscii( pTypeName ) );
-*ppRef = igetTypeByName( aTypeName.pData );
-if (!*ppRef)
-{
-typelib_CompoundTypeDescription * pComp = nullptr;
-::typelib_typedescription_newEmpty(
-reinterpret_cast(), 
eTypeClass, aTypeName.pData );
+if ( *ppRef)
+return;
 
-sal_Int32 nOffset = 0;
-

[Libreoffice-commits] core.git: cppu/source

2020-03-04 Thread Stephan Bergmann (via logerrit)
 cppu/source/typelib/typelib.cxx |   29 -
 1 file changed, 12 insertions(+), 17 deletions(-)

New commits:
commit 84d361425c23b5010e276ddfde5079693081ff28
Author: Stephan Bergmann 
AuthorDate: Wed Mar 4 15:05:33 2020 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Mar 4 17:36:48 2020 +0100

Remove redundant local reallyWeak function

Change-Id: Ica26c0b5a839ebb2ca8ed1e2fa61b70cd08a9278
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89974
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index cd2ad047c721..d4a65a6f7b5e 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -93,11 +93,6 @@ static sal_Int32 newAlignedSize(
 return (OldSize + NeededAlignment -1) / NeededAlignment * NeededAlignment 
+ ElementSize;
 }
 
-static bool reallyWeak( typelib_TypeClass eTypeClass )
-{
-return TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( eTypeClass );
-}
-
 static sal_Int32 getDescriptionSize( typelib_TypeClass eTypeClass )
 {
 OSL_ASSERT( typelib_TypeClass_TYPEDEF != eTypeClass );
@@ -433,7 +428,7 @@ bool complete(typelib_TypeDescription ** ppTypeDescr, bool 
initTables) {
  typelib_TypeClass_EXCEPTION == (*ppTypeDescr)->eTypeClass 
||
  typelib_TypeClass_ENUM == (*ppTypeDescr)->eTypeClass ||
  typelib_TypeClass_INTERFACE == 
(*ppTypeDescr)->eTypeClass) &&
-!reallyWeak( (*ppTypeDescr)->eTypeClass ) );
+!TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( 
(*ppTypeDescr)->eTypeClass ) );
 
 if (typelib_TypeClass_INTERFACE == (*ppTypeDescr)->eTypeClass &&
 reinterpret_cast(*ppTypeDescr)->ppAllMembers)
@@ -792,7 +787,7 @@ void newTypeDescription(
 break;
 }
 
-if( !reallyWeak( eTypeClass ) )
+if( !TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( eTypeClass ) )
 (*ppRet)->pWeakRef = reinterpret_cast(*ppRet);
 if( eTypeClass != typelib_TypeClass_VOID )
 {
@@ -1046,7 +1041,7 @@ extern "C" void SAL_CALL 
typelib_typedescription_newMIInterface(
 }
 
 typelib_TypeDescription * pTmp = >aBase;
-if( !reallyWeak( typelib_TypeClass_INTERFACE ) )
+if( !TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( 
typelib_TypeClass_INTERFACE ) )
 pTmp->pWeakRef = reinterpret_cast(pTmp);
 pTmp->nSize = typelib_typedescription_getAlignedUnoSize( pTmp, 0, 
pTmp->nAlignment );
 pTmp->nAlignment = adjustAlignment( pTmp->nAlignment );
@@ -1151,7 +1146,7 @@ extern "C" void SAL_CALL 
typelib_typedescription_newInterfaceMethod(
 && nAbsolutePosition < pInterface->nAllMembers);
 (*ppRet)->nIndex = nAbsolutePosition
 - (pInterface->nAllMembers - pInterface->nMembers);
-if( !reallyWeak( typelib_TypeClass_INTERFACE_METHOD ) )
+if( !TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( 
typelib_TypeClass_INTERFACE_METHOD ) )
 pTmp->pWeakRef = reinterpret_cast(pTmp);
 }
 
@@ -1229,7 +1224,7 @@ extern "C" void SAL_CALL 
typelib_typedescription_newExtendedInterfaceAttribute(
 (*ppRet)->nSetExceptions = nSetExceptions;
 (*ppRet)->ppSetExceptions = copyExceptions(
 nSetExceptions, ppSetExceptionNames);
-if( !reallyWeak( typelib_TypeClass_INTERFACE_ATTRIBUTE ) )
+if( !TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( 
typelib_TypeClass_INTERFACE_ATTRIBUTE ) )
 pTmp->pWeakRef = reinterpret_cast(pTmp);
 }
 
@@ -1371,7 +1366,7 @@ extern "C" void SAL_CALL typelib_typedescription_release(
 if (0 == ref)
 {
 TypeDescriptor_Init_Impl  = Init::get();
-if( reallyWeak( pTD->eTypeClass ) )
+if( TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( pTD->eTypeClass ) )
 {
 if( pTD->pWeakRef )
 {
@@ -1444,13 +1439,13 @@ extern "C" void SAL_CALL 
typelib_typedescription_register(
 typelib_TypeDescriptionReference * pTDR = nullptr;
 typelib_typedescriptionreference_getByName( , 
(*ppNewDescription)->pTypeName );
 
-OSL_ASSERT( (*ppNewDescription)->pWeakRef || reallyWeak( 
(*ppNewDescription)->eTypeClass ) );
+OSL_ASSERT( (*ppNewDescription)->pWeakRef || 
TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( (*ppNewDescription)->eTypeClass 
) );
 if( pTDR )
 {
 OSL_ASSERT( (*ppNewDescription)->eTypeClass == pTDR->eTypeClass );
 if( pTDR->pType )
 {
-if (reallyWeak( pTDR->eTypeClass ))
+if (TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( 
pTDR->eTypeClass ))
 {
 // pRef->pType->pWeakRef == 0 means that the description is 
empty
 if (pTDR->pType->pWeakRef)
@@ -1535,7 +1530,7 @@ extern "C" void SAL_CALL typelib_typedescription_register(
 return;
 }
 }
-else if( reallyWeak( (*ppNewDescription)->eTypeClass) )
+else if( TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( 

[Libreoffice-commits] core.git: cppu/source

2019-11-08 Thread Stephan Bergmann (via logerrit)
 cppu/source/uno/loadmodule.cxx |   29 +++--
 1 file changed, 27 insertions(+), 2 deletions(-)

New commits:
commit ecf708e90d96d5a72491e40fa679c47e66eebd49
Author: Stephan Bergmann 
AuthorDate: Fri Nov 8 12:45:26 2019 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Nov 8 14:19:10 2019 +0100

Avoid repeated calls cppu::detail::loadModule -> osl_getModuleURLFromAddress

...where the latter are reportedly expensive.  Both
 "tdf#121740 related, cache 
external
mapping in cppu::loadExternal" and 

"tdf#121740 add cache to win osl_getModuleURLFromAddress" attempted to 
reduce
the costs observed when loading one specific document by introducing caches
below cppu::detail::loadModule's call to osl::Module::loadRelative.

On the other hand, this change reduces the number of calls to
osl_getModuleURLFromAddress by computing the base URI in
cppu::detail::loadModule only once.  For my local Linux --enable-dbgutil 
build,
for `instdir/program/soffice '109340 class14.ppt'` and then exiting LO again
(with the document attached at
), this 
reduces
the number of calls to osl_getModuleURLFromAddress from 3775 to 22.

(Many of those calls originated from cppu::getCaughtException or
cppu::throwException, as in

  osl_getModuleURLFromAddress
  osl_getModuleURLFromFunctionAddress
  osl::Module::getUrlFromAddress
  osl_loadModuleRelative
  osl::Module::loadRelative
  cppu::detail::loadModule
  cppu::loadModule
  cppu::loadExternalMapping
  uno_getMapping
  com::sun::star::uno::Mapping::Mapping
  cppu::throwException

.)

Unfortunately, this needs to duplicate functionality from 
osl_loadModuleRelative
(sal/osl/all/loadmodulerelative.cxx) somewhat, as the stable SAL interface 
only
offers functionality to load relative to a given function, not relative to a
given base URI.  (And extending the stable SAL interface for this one use 
is not
worth the maintenance costs.)

Change-Id: Ib58814136d11c67d1419b0224d12e30bb710e613
Reviewed-on: https://gerrit.libreoffice.org/82290
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/cppu/source/uno/loadmodule.cxx b/cppu/source/uno/loadmodule.cxx
index 9e970b754536..359227b24206 100644
--- a/cppu/source/uno/loadmodule.cxx
+++ b/cppu/source/uno/loadmodule.cxx
@@ -20,10 +20,15 @@
 
 #include 
 
+#include 
+
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
+#include 
 
 #include "loadmodule.hxx"
 
@@ -32,14 +37,34 @@ namespace cppu { namespace detail {
 #ifndef DISABLE_DYNLOADING
 
 bool loadModule(osl::Module& rModule, OUString const & name) {
+static OUString base = [] {
+OUString url;
+if (!osl::Module::getUrlFromAddress(
+reinterpret_cast(), url))
+{
+SAL_WARN("cppu", "osl::Module::getUrlFromAddress failed");
+return OUString();
+}
+assert(!url.isEmpty());
+return url;
+}();
+if (base.isEmpty()) {
+SAL_INFO("cppu", "osl::Module::getUrlFromAddress had failed");
+return false;
+}
 OUString b =
 #if defined SAL_DLLPREFIX
 SAL_DLLPREFIX +
 #endif
 name +
 SAL_DLLEXTENSION;
-return rModule.loadRelative(
-reinterpret_cast< oslGenericFunction >(),
+try {
+b = rtl::Uri::convertRelToAbs(base, b);
+} catch (rtl::MalformedUriException & e) {
+SAL_INFO("cppu", "rtl::MalformedUriException <" << e.getMessage() << 
">");
+return false;
+}
+return rModule.load(
 b,
 SAL_LOADMODULE_GLOBAL | SAL_LOADMODULE_LAZY);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: cppu/source external/gpgmepp

2019-09-03 Thread Stephan Bergmann (via logerrit)
 cppu/source/uno/copy.hxx|   26 --
 external/gpgmepp/UnpackedTarball_gpgmepp.mk |1 
 external/gpgmepp/ubsan.patch|   52 
 3 files changed, 76 insertions(+), 3 deletions(-)

New commits:
commit cf2696efa0d0ea55c950d7b2898e7b7aab74812e
Author: Stephan Bergmann 
AuthorDate: Tue Sep 3 11:26:44 2019 +0200
Commit: Stephan Bergmann 
CommitDate: Tue Sep 3 15:54:08 2019 +0200

Silence -fsanitize=object-size in --enable-optimized builds



(as of recent LLVM trunk towards LLVM 10) states:

"-fsanitize=object-size: An attempt to potentially use bytes which the 
optimizer
can determine are not part of the object being accessed. This will also 
detect
some types of undefined behavior that may not directly access memory, but 
are
provably incorrect given the size of the objects involved, such as invalid
downcasts and calling methods on invalid pointers. These checks are made in
terms of __builtin_object_size, and consequently may be able to detect more
problems at higher optimization levels."

A `make check screenshot` with --enabled-optimized runs into two such issues
that were not diagnosed with --disable-optimized, in both cases because a 
struct
with an "idiomatic trailing dynamic array member" (statically declared to 
be an
array of size 1) is allocated without any space for that array member, as 
the
dynamic array size is 0 in the specific case:

* For

> [CUT] sc_ucalc
> cppu/source/uno/copy.hxx:46:19: runtime error: member access within 
address 0x6020001aaa70 with insufficient space for an object of type 
'uno_Sequence' (aka '_sal_Sequence')
> 0x6020001aaa70: note: pointer points here
>  2b 00 80 6a  be be be be be be be be  00 00 00 00 00 00 00 00  00 00 00 
00 00 00 00 00  00 00 00 00
>   ^
>  #0 in cppu::allocSeq(int, int) at cppu/source/uno/copy.hxx:46:19 
(instdir/program/libuno_cppu.so.3 +0x41f03f)
>  #1 in uno_type_sequence_reference2One at 
cppu/source/uno/sequence.cxx:813:20 (instdir/program/libuno_cppu.so.3 +0x41f03f)
[...]

the call to

pNew = allocSeq( 0, 0 );

in uno_type_sequence_reference2One is inlined, so

sal_uInt32 nSize = calcSeqMemSize( nElementSize, nElements );

in allocSeq is known to be too small.

* For

> testSignatureLineODF::TestBody finished in: 2044ms
> engine-gpg.c:302:6: runtime error: member access within address 
0x604001f24f10 with insufficient space for an object of type 'struct 
arg_and_data_s'
> 0x604001f24f10: note: pointer points here
>  6e 01 00 26  be be be be be be be be  be be be be be be be be  be be be 
be be be be be  be be be be
>   ^
>  #0 in add_data at workdir/UnpackedTarball/gpgmepp/src/engine-gpg.c:302:6 
(instdir/program/libgpgme.so.11 +0x120c2b)
[...]
> make[1]: *** [solenv/gbuild/CppunitTest.mk:114: 
workdir/CppunitTest/xmlsecurity_signing.test] Error 1

the

   a = malloc (sizeof *a - 1);

is apparently detected to be too small only with optimization enabled.

In both cases, the solution is to operate on the too-small dynamically 
allocated
object via a reinterpret_cast'ed pointer to some newly introduced "struct
prefix" type.

Change-Id: Ie814db1d00a439bb9189474b91d729e538e81984
Reviewed-on: https://gerrit.libreoffice.org/78548
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/cppu/source/uno/copy.hxx b/cppu/source/uno/copy.hxx
index b0811b5fab10..b24e0e337bf5 100644
--- a/cppu/source/uno/copy.hxx
+++ b/cppu/source/uno/copy.hxx
@@ -22,7 +22,9 @@
 #include "prim.hxx"
 #include "constr.hxx"
 #include 
+#include 
 #include 
+#include 
 
 namespace cppu
 {
@@ -30,6 +32,22 @@ namespace cppu
 
 // copy construction 
###
 
+namespace {
+
+// The non-dynamic prefix of sal_Sequence (aka uno_Sequence):
+struct SequencePrefix {
+sal_Int32 nRefCount;
+sal_Int32 nElements;
+};
+static_assert(sizeof (SequencePrefix) < sizeof (uno_Sequence));
+static_assert(offsetof(SequencePrefix, nRefCount) == offsetof(uno_Sequence, 
nRefCount));
+static_assert(
+std::is_same_v);
+static_assert(offsetof(SequencePrefix, nElements) == offsetof(uno_Sequence, 
nElements));
+static_assert(
+std::is_same_v);
+
+}
 
 inline uno_Sequence * allocSeq(
 sal_Int32 nElementSize, sal_Int32 nElements )
@@ -42,9 +60,11 @@ inline uno_Sequence * allocSeq(
 pSeq = static_cast(std::malloc( nSize ));
 if (pSeq != nullptr)
 {
-// header init
-pSeq->nRefCount = 1;
-pSeq->nElements = nElements;
+// header init, going via SequencePrefix to avoid UBSan 

[Libreoffice-commits] core.git: cppu/source

2019-07-26 Thread Caolán McNamara (via logerrit)
 cppu/source/uno/lbenv.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 0b14eaf0546591e2c7be614051bd30b6387805a6
Author: Caolán McNamara 
AuthorDate: Fri Jul 26 08:51:21 2019 +0100
Commit: Caolán McNamara 
CommitDate: Fri Jul 26 13:38:03 2019 +0200

cid#1448407 silence Resource leak

Change-Id: Ida523859077abe5904212db44108fa580bb6c60d
Reviewed-on: https://gerrit.libreoffice.org/76355
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index 8d0ae9c44f5c..55b513a9d5de 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -1059,6 +1059,7 @@ extern "C"
 static uno_Environment * initDefaultEnvironment(
 const OUString & rEnvDcp, void * pContext )
 {
+// coverity[leaked_storage : FALSE] - lifetime is controlled by 
acquire()/release() calls
 uno_Environment * pEnv = &(new uno_DefaultEnvironment( rEnvDcp, pContext 
))->aBase;
 (*pEnv->acquire)( pEnv );
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: cppu/source cui/source reportdesign/source sd/source

2019-04-27 Thread Mike Kaganski (via logerrit)
 cppu/source/uno/lbmap.cxx   |   19 +++-
 cui/source/tabpages/paragrph.cxx|7 +--
 reportdesign/source/ui/report/ReportSection.cxx |5 --
 sd/source/core/sdpage.cxx   |3 -
 sd/source/ui/remotecontrol/Receiver.cxx |   51 +++-
 sd/source/ui/view/presvish.cxx  |4 -
 6 files changed, 40 insertions(+), 49 deletions(-)

New commits:
commit ba57c3e041bb05ef49a3ea7940a4183f09775a18
Author: Mike Kaganski 
AuthorDate: Sat Apr 27 19:57:17 2019 +0300
Commit: Mike Kaganski 
CommitDate: Sat Apr 27 20:59:34 2019 +0200

tdf#120703 PVS: V581 ifs with identical conditions

V581 The conditional expressions of the 'if' statements situated
 alongside each other are identical.

Change-Id: I79c655a072faff0bdb2af031ed1328e684b83aac
Reviewed-on: https://gerrit.libreoffice.org/71430
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx
index fc093907c591..6979c74042f9 100644
--- a/cppu/source/uno/lbmap.cxx
+++ b/cppu/source/uno/lbmap.cxx
@@ -603,21 +603,18 @@ void SAL_CALL uno_getMapping(
 
 if (*ppMapping)
 return;
-}
 
-if (! aRet.is()) // try callback chain
-{
-MutexGuard aGuard( rData.aCallbacksMutex );
-for ( const auto& rCallback : rData.aCallbacks )
+// try callback chain
 {
-(*rCallback)( ppMapping, pFrom, pTo, aAddPurpose.pData );
-if (*ppMapping)
-return;
+MutexGuard aGuard(rData.aCallbacksMutex);
+for (const auto& rCallback : rData.aCallbacks)
+{
+(*rCallback)(ppMapping, pFrom, pTo, aAddPurpose.pData);
+if (*ppMapping)
+return;
+}
 }
-}
 
-if (! aRet.is())
-{
 aRet = loadExternalMapping( aFrom, aTo, aAddPurpose ); // direct try
 if (! aRet.is())
 aRet = getMediateMapping( aFrom, aTo, aAddPurpose ); // try via uno
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index 12372d0127bf..caa7a97b33c3 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -954,27 +954,28 @@ void SvxStdParagraphTabPage::PageCreated(const 
SfxAllItemSet& aSet)
 nWidth = pPageWidthItem->GetValue();
 
 if (pFlagSetItem )
+{
 if (( 0x0001 & pFlagSetItem->GetValue())== 0x0001 )
 EnableRelativeMode();
 
-if (pFlagSetItem)
 if (( 0x0002 & pFlagSetItem->GetValue())== 0x0002 )
 EnableRegisterMode();
 
-if (pFlagSetItem)
 if ( ( 0x0004 & pFlagSetItem->GetValue())== 0x0004 )
 EnableAutoFirstLine();
+}
 
 if(pLineDistItem)
 EnableAbsLineDist(pLineDistItem->GetValue());
 
 if (pFlagSetItem)
+{
 if  (( 0x0008 & pFlagSetItem->GetValue()) == 0x0008 )
 EnableNegativeMode();
 
-if (pFlagSetItem)
 if  (( 0x0010 & pFlagSetItem->GetValue()) == 0x0010 )
 EnableContextualMode();
+}
 }
 
 #define LASTLINEPOS_DEFAULT 0
diff --git a/reportdesign/source/ui/report/ReportSection.cxx 
b/reportdesign/source/ui/report/ReportSection.cxx
index 43814411a25f..909376cd21be 100644
--- a/reportdesign/source/ui/report/ReportSection.cxx
+++ b/reportdesign/source/ui/report/ReportSection.cxx
@@ -154,11 +154,8 @@ void OReportSection::Paint( vcl::RenderContext& 
rRenderContext, const tools::Rec
 // draw background self using wallpaper
 OutputDevice& rTargetOutDev = 
pTargetPaintWindow->GetTargetOutputDevice();
 rTargetOutDev.DrawWallpaper(rRect, 
Wallpaper(pPgView->GetApplicationDocumentColor()));
-}
 
-// do paint (unbuffered) and mark repaint end
-if(pPgView)
-{
+// do paint (unbuffered) and mark repaint end
 pPgView->DrawLayer(RPT_LAYER_FRONT, );
 pPgView->GetView().EndDrawLayers(*pTargetPaintWindow, true);
 }
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index a5903269364f..e37602afcf9e 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -564,10 +564,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, 
bool bVertical, const ::t
 if( bUndo )
 {
 
pUndoManager->AddUndoAction(getSdrModelFromSdrPage().GetSdrUndoFactory().CreateUndoNewObject(*pSdrObj));
-}
 
-if( bUndo )
-{
 pUndoManager->AddUndoAction( 
std::make_unique( *pSdrObj ) );
 pUndoManager->AddUndoAction( 
std::make_unique(*pSdrObj) );
 }
diff --git a/sd/source/ui/remotecontrol/Receiver.cxx 
b/sd/source/ui/remotecontrol/Receiver.cxx
index 04b50f9a3936..6a987a67e877 100644
--- a/sd/source/ui/remotecontrol/Receiver.cxx
+++ b/sd/source/ui/remotecontrol/Receiver.cxx
@@ -136,33 +136,32 @@ 

[Libreoffice-commits] core.git: cppu/source

2019-03-01 Thread Libreoffice Gerrit user
 cppu/source/threadpool/threadpool.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e7ebca6dbeb8c41a442ea28ffc6296562be005a6
Author: Andrea Gelmini 
AuthorDate: Fri Mar 1 18:25:37 2019 +
Commit: Julien Nabet 
CommitDate: Sat Mar 2 08:24:59 2019 +0100

Fix typo

Change-Id: Ib5409a3c9b22bf0caf950905a75559bdef8b057f
Reviewed-on: https://gerrit.libreoffice.org/68612
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/cppu/source/threadpool/threadpool.cxx 
b/cppu/source/threadpool/threadpool.cxx
index 81c6a91643a2..40b031c85732 100644
--- a/cppu/source/threadpool/threadpool.cxx
+++ b/cppu/source/threadpool/threadpool.cxx
@@ -417,7 +417,7 @@ uno_threadpool_enter( uno_ThreadPool hPool , void **ppJob )
 extern "C" void SAL_CALL
 uno_threadpool_detach(SAL_UNUSED_PARAMETER uno_ThreadPool) SAL_THROW_EXTERN_C()
 {
-// we might do here some tiding up in case a thread called attach but 
never detach
+// we might do here some tidying up in case a thread called attach but 
never detach
 }
 
 extern "C" void SAL_CALL
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: cppu/source xmloff/source

2019-02-20 Thread Libreoffice Gerrit user
 cppu/source/typelib/typelib.cxx   |2 +-
 xmloff/source/transform/ChartOASISTContext.cxx|2 +-
 xmloff/source/transform/ChartOOoTContext.cxx  |2 +-
 xmloff/source/transform/ControlOASISTContext.cxx  |2 +-
 xmloff/source/transform/CreateElemTContext.cxx|2 +-
 xmloff/source/transform/DeepTContext.cxx  |2 +-
 xmloff/source/transform/DlgOASISTContext.cxx  |2 +-
 xmloff/source/transform/EventOASISTContext.cxx|4 ++--
 xmloff/source/transform/EventOOoTContext.cxx  |2 +-
 xmloff/source/transform/FormPropOASISTContext.cxx |2 +-
 xmloff/source/transform/FormPropOOoTContext.cxx   |2 +-
 xmloff/source/transform/FrameOASISTContext.cxx|2 +-
 xmloff/source/transform/FrameOOoTContext.cxx  |4 ++--
 xmloff/source/transform/MergeElemTContext.cxx |4 ++--
 xmloff/source/transform/NotesTContext.cxx |2 +-
 xmloff/source/transform/OOo2Oasis.cxx |2 +-
 xmloff/source/transform/Oasis2OOo.cxx |2 +-
 xmloff/source/transform/StyleOASISTContext.cxx|4 ++--
 xmloff/source/transform/StyleOOoTContext.cxx  |4 ++--
 xmloff/source/transform/TransformerBase.cxx   |4 ++--
 20 files changed, 26 insertions(+), 26 deletions(-)

New commits:
commit 16a614c77ace3f44684efd9c964c52ddbd5f5cf9
Author: Stephan Bergmann 
AuthorDate: Wed Feb 20 13:52:51 2019 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Feb 20 17:18:31 2019 +0100

More loplugin:simplifybool

...found with (trunk) libc++ on macOS, where the standard library iterator
implementations are apparently sufficiently different to libstdc++ to find 
more
cases of !(... == ...) vs. ... != ...

Change-Id: Ia3861406aa584c7b1d33f47448190b5cf2e770f7
Reviewed-on: https://gerrit.libreoffice.org/68089
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index ce4757594036..309543b4078d 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -2219,7 +2219,7 @@ extern "C" void 
typelib_typedescriptionreference_getByName(
 {
 MutexGuard aGuard( rInit.getMutex() );
 WeakMap_Impl::const_iterator aIt = rInit.pWeakMap->find( pName->buffer 
);
-if( !(aIt == rInit.pWeakMap->end()) ) // != failed on msc4.2
+if( aIt != rInit.pWeakMap->end() )
 {
 sal_Int32 n = osl_atomic_increment( &(*aIt).second->nRefCount );
 if( n > 1 )
diff --git a/xmloff/source/transform/ChartOASISTContext.cxx 
b/xmloff/source/transform/ChartOASISTContext.cxx
index a0c233d87c2a..ad6e003e0f17 100644
--- a/xmloff/source/transform/ChartOASISTContext.cxx
+++ b/xmloff/source/transform/ChartOASISTContext.cxx
@@ -62,7 +62,7 @@ void XMLChartOASISTransformerContext::StartElement(
 XMLTransformerActions::key_type aKey( nPrefix, aLocalName );
 XMLTransformerActions::const_iterator aIter =
 pActions->find( aKey );
-if( !(aIter == pActions->end() ) )
+if( aIter != pActions->end() )
 {
 if( !pMutableAttrList )
 {
diff --git a/xmloff/source/transform/ChartOOoTContext.cxx 
b/xmloff/source/transform/ChartOOoTContext.cxx
index b6de37a48d46..5759bfd556ed 100644
--- a/xmloff/source/transform/ChartOOoTContext.cxx
+++ b/xmloff/source/transform/ChartOOoTContext.cxx
@@ -63,7 +63,7 @@ void XMLChartOOoTransformerContext::StartElement(
 XMLTransformerActions::key_type aKey( nPrefix, aLocalName );
 XMLTransformerActions::const_iterator aIter =
 pActions->find( aKey );
-if( !(aIter == pActions->end() ) )
+if( aIter != pActions->end() )
 {
 if( !pMutableAttrList )
 {
diff --git a/xmloff/source/transform/ControlOASISTContext.cxx 
b/xmloff/source/transform/ControlOASISTContext.cxx
index 3b5ece6da769..a34f10de7ca0 100644
--- a/xmloff/source/transform/ControlOASISTContext.cxx
+++ b/xmloff/source/transform/ControlOASISTContext.cxx
@@ -70,7 +70,7 @@ void XMLControlOASISTransformerContext::StartElement(
 XMLTransformerActions::key_type aKey( nPrefix, aLocalName );
 XMLTransformerActions::const_iterator aIter =
 pActions->find( aKey );
-if( !(aIter == pActions->end() ) )
+if( aIter != pActions->end() )
 {
 if( !pMutableAttrList )
 {
diff --git a/xmloff/source/transform/CreateElemTContext.cxx 
b/xmloff/source/transform/CreateElemTContext.cxx
index d4943f62840e..2e65ef82cd08 100644
--- a/xmloff/source/transform/CreateElemTContext.cxx
+++ b/xmloff/source/transform/CreateElemTContext.cxx
@@ -69,7 +69,7 @@ void XMLCreateElemTransformerContext::StartElement(
 XMLTransformerActions::key_type aKey( nPrefix, aLocalName );
 XMLTransformerActions::const_iterator aIter =
 pActions->find( aKey );
-if( !(aIter == 

[Libreoffice-commits] core.git: cppu/source filter/source scripting/source

2019-02-19 Thread Libreoffice Gerrit user
 cppu/source/typelib/typelib.cxx|2 +-
 filter/source/svg/svgexport.cxx|2 +-
 scripting/source/stringresource/stringresource.cxx |6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit e51cc9ebf39598c1204d9b89af4e4145433adbd4
Author: Stephan Bergmann 
AuthorDate: Tue Feb 19 11:58:27 2019 +0100
Commit: Stephan Bergmann 
CommitDate: Tue Feb 19 14:25:15 2019 +0100

More loplugin:simplifybool

...found with GCC 9, where the standard library iterator implementations are
apparently sufficiently different to older versions of GCC to find more 
cases
of !(... == ...) vs. ... != ...

Change-Id: Ibe7c5140049a69d2c5318b4b2371f2e66bd05028
Reviewed-on: https://gerrit.libreoffice.org/68012
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index 817601e03d42..ce4757594036 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -2137,7 +2137,7 @@ extern "C" void SAL_CALL 
typelib_typedescriptionreference_release(
 {
 MutexGuard aGuard( rInit.getMutex() );
 WeakMap_Impl::iterator aIt = rInit.pWeakMap->find( 
pRef->pTypeName->buffer );
-if( !(aIt == rInit.pWeakMap->end()) && (*aIt).second == pRef )
+if( aIt != rInit.pWeakMap->end() && (*aIt).second == pRef )
 {
 // remove only if it contains the same object
 rInit.pWeakMap->erase( aIt );
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index fa04227f18ce..b872b842b36e 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -2289,7 +2289,7 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, 
pInfo, void )
 OSL_FAIL( "error: !mCreateOjectsCurrentMasterPage.is()" );
 return;
 }
-bool bHasCharSetMap = !( mTextFieldCharSets.find( 
mCreateOjectsCurrentMasterPage ) == mTextFieldCharSets.end() );
+bool bHasCharSetMap = mTextFieldCharSets.find( 
mCreateOjectsCurrentMasterPage ) != mTextFieldCharSets.end();
 
 static const OUString aHeaderId( NSPREFIX "header-field" );
 static const OUString aFooterId( aOOOAttrFooterField );
diff --git a/scripting/source/stringresource/stringresource.cxx 
b/scripting/source/stringresource/stringresource.cxx
index 1215ab8ceba3..4814f7ef57a7 100644
--- a/scripting/source/stringresource/stringresource.cxx
+++ b/scripting/source/stringresource/stringresource.cxx
@@ -157,7 +157,7 @@ OUString StringResourceImpl::implResolveString
 if( pLocaleItem != nullptr && loadLocale( pLocaleItem ) )
 {
 IdToStringMap::iterator it = pLocaleItem->m_aIdToStringMap.find( 
ResourceID );
-if( !( it == pLocaleItem->m_aIdToStringMap.end() ) )
+if( it != pLocaleItem->m_aIdToStringMap.end() )
 {
 aRetStr = (*it).second;
 bSuccess = true;
@@ -189,7 +189,7 @@ bool StringResourceImpl::implHasEntryForId( const OUString& 
ResourceID, LocaleIt
 if( pLocaleItem != nullptr && loadLocale( pLocaleItem ) )
 {
 IdToStringMap::iterator it = pLocaleItem->m_aIdToStringMap.find( 
ResourceID );
-if( !( it == pLocaleItem->m_aIdToStringMap.end() ) )
+if( it != pLocaleItem->m_aIdToStringMap.end() )
 bSuccess = true;
 }
 return bSuccess;
@@ -2039,7 +2039,7 @@ bool 
StringResourcePersistenceImpl::implWritePropertiesFile( LocaleItem const *
 {
 OUString aResourceID = *pStr;
 IdToStringMap::const_iterator it = rHashMap.find( aResourceID 
);
-if( !( it == rHashMap.end() ) )
+if( it != rHashMap.end() )
 {
 implWriteStringWithEncoding( aResourceID, 
xTextOutputStream, true );
 xTextOutputStream->writeString( "=" );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: cppu/source

2019-01-29 Thread Libreoffice Gerrit user
 cppu/source/uno/lbenv.cxx |4 
 cppu/source/uno/lbmap.cxx |4 
 2 files changed, 8 insertions(+)

New commits:
commit adca0b98c63a4365eb83664b3254eaa828a1ca14
Author: Miklos Vajna 
AuthorDate: Tue Jan 29 15:59:14 2019 +0100
Commit: Miklos Vajna 
CommitDate: Tue Jan 29 15:59:56 2019 +0100

cppu: fix Android build

By restoring includes which are still needed, conditionally.

Change-Id: Icc331c7d6a084af7d93b941ea879f0c60b9ca9f3

diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index 7ad96d5a9110..9e9de7655041 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -17,6 +17,10 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#ifdef DISABLE_DYNLOADING
+#include 
+#endif
+
 #include 
 
 #include 
diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx
index bba5756c0bd5..54852a63082f 100644
--- a/cppu/source/uno/lbmap.cxx
+++ b/cppu/source/uno/lbmap.cxx
@@ -17,6 +17,10 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#ifdef DISABLE_DYNLOADING
+#include 
+#endif
+
 #include "IdentityMapping.hxx"
 
 #include 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2018-12-28 Thread Libreoffice Gerrit user
 cppu/source/typelib/typelib.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 5bdffc57b15be047dc19ff300957498465d004c5
Author: John Paul Adrian Glaubitz 
AuthorDate: Fri Dec 28 12:13:24 2018 +0100
Commit: Noel Grandin 
CommitDate: Sat Dec 29 07:14:35 2018 +0100

typelib: Fix incorrect parameter type to std::min() on m68k

Change-Id: Id674d19d38ebe634707f5a480e596efe8c83cc6a
Reviewed-on: https://gerrit.libreoffice.org/65684
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index 53dd020c97c6..9b288fabfd22 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -1663,7 +1663,7 @@ extern "C" sal_Int32 
typelib_typedescription_getAlignedUnoSize(
 #ifdef __m68k__
 // Anything that is at least 16 bits wide is aligned on a 
16-bit
 // boundary on the m68k default abi
-sal_Int32 nMaxAlign = std::min(rMaxIntegralTypeSize, 2);
+sal_Int32 nMaxAlign = std::min(rMaxIntegralTypeSize, 
sal_Int32( 2 ));
 nStructSize = (nStructSize + nMaxAlign -1) / nMaxAlign * 
nMaxAlign;
 #else
 // Example: A { double; int; } structure has a size of 16 
instead of 10. The
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2018-11-07 Thread Libreoffice Gerrit user
 cppu/source/uno/data.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 5f91153233b7f88470e2ccdc496c236b170b24f4
Author: Caolán McNamara 
AuthorDate: Wed Nov 7 13:05:41 2018 +
Commit: Caolán McNamara 
CommitDate: Wed Nov 7 18:18:51 2018 +0100

coverity#1441100 silence Out-of-bounds access

Change-Id: I8d8f93262481c35968cdfff49eddd7a20cf84c1f
Reviewed-on: https://gerrit.libreoffice.org/63022
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/cppu/source/uno/data.cxx b/cppu/source/uno/data.cxx
index 6c93fced581d..dcd2b19ec62e 100644
--- a/cppu/source/uno/data.cxx
+++ b/cppu/source/uno/data.cxx
@@ -54,6 +54,7 @@ void * binuno_queryInterface( void * pUnoI, 
typelib_TypeDescriptionReference * p
 typelib_TypeDescription* pQITD = nullptr;
 typelib_typedescriptionreference_getDescription(,
 
pTXInterfaceDescr->ppAllMembers[0]);
+// coverity[callee_ptr_arith] - not a bug
 TYPELIB_DANGER_RELEASE(>aBase);
 return pQITD;
 }();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2018-09-22 Thread Libreoffice Gerrit user
 cppu/source/uno/sequence.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 2e145afcfe9bcda3dbf916bb7a91bcf45442f12e
Author: Caolán McNamara 
AuthorDate: Sat Sep 22 14:41:05 2018 +0100
Commit: Caolán McNamara 
CommitDate: Sat Sep 22 16:44:09 2018 +0200

tweak markup

Change-Id: I5d7171045a9c271e2ef5f456411fa4d3eb5f1571
Reviewed-on: https://gerrit.libreoffice.org/60895
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/cppu/source/uno/sequence.cxx b/cppu/source/uno/sequence.cxx
index 1a15b1c8a8d6..848aaa39f428 100644
--- a/cppu/source/uno/sequence.cxx
+++ b/cppu/source/uno/sequence.cxx
@@ -269,7 +269,7 @@ static inline bool idefaultConstructElements(
 {
 if (nAlloc >= 0)
 {
-// coverity[suspicious_sizeof] - sizeof(uno_Sequence*) is correct 
here
+// coverity[suspicious_sizeof : FALSE] - sizeof(uno_Sequence*) is 
correct here
 pSeq = reallocSeq(pSeq, sizeof(uno_Sequence*), nAlloc);
 }
 if (pSeq != nullptr)
@@ -518,7 +518,7 @@ static inline bool icopyConstructFromElements(
 }
 case typelib_TypeClass_SEQUENCE: // sequence of sequence
 {
-// coverity[suspicious_sizeof] - sizeof(uno_Sequence*) is correct here
+// coverity[suspicious_sizeof : FALSE] - sizeof(uno_Sequence*) is 
correct here
 pSeq = reallocSeq(pSeq, sizeof(uno_Sequence*), nAlloc);
 if (pSeq != nullptr)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2018-09-10 Thread Libreoffice Gerrit user
 cppu/source/uno/check.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 653218c76a1b2c0da1963f9e09cadcbea56fecc3
Author: Stephan Bergmann 
AuthorDate: Mon Sep 10 09:58:28 2018 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Sep 10 12:58:24 2018 +0200

Fix for --enable-debug --disable-assert-always-abort

...found by 

Change-Id: Ia38fe5cac9fa187535599d313a3422c34458bcd9
Reviewed-on: https://gerrit.libreoffice.org/60242
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/cppu/source/uno/check.cxx b/cppu/source/uno/check.cxx
index e92d7616fa33..3dc0fc5aca0c 100644
--- a/cppu/source/uno/check.cxx
+++ b/cppu/source/uno/check.cxx
@@ -256,7 +256,7 @@ static_assert(sizeof(second) == sizeof(int), 
"sizeof(second) != sizeof(int)");
 # error unexpected alignment of 8 byte types
 #endif
 
-#if OSL_DEBUG_LEVEL > 0
+#if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
 
 #define OFFSET_OF( s, m ) reinterpret_cast< size_t >(reinterpret_cast(_cast(16)->m) -16)
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source pyuno/source vcl/unx

2018-07-26 Thread Libreoffice Gerrit user
 cppu/source/typelib/typelib.cxx   |7 +++
 pyuno/source/module/pyuno_dlopenwrapper.c |1 +
 vcl/unx/generic/plugadapt/salplug.cxx |3 ++-
 3 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 1d457f960b3bb8efe8132b87babba7db4b58813e
Author: Caolán McNamara 
AuthorDate: Thu Jul 26 11:23:13 2018 +0100
Commit: Caolán McNamara 
CommitDate: Thu Jul 26 22:04:32 2018 +0200

Related: rhbz#1602589 silence coverity leaked_storage

Change-Id: Iae694be40b32cc3821d326bb362e6091dba19a35
Reviewed-on: https://gerrit.libreoffice.org/58079
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index c586ae2220ea..46238d5481b0 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -555,6 +555,7 @@ extern "C" void typelib_typedescription_newEmpty(
 osl_atomic_increment( ::get().nIndirectTypeDescriptionCount );
 #endif
 pTmp->pType = nullptr;
+// coverity[leaked_storage] - this is on purpose
 }
 break;
 
@@ -572,6 +573,7 @@ extern "C" void typelib_typedescription_newEmpty(
 pTmp->aBase.ppTypeRefs = nullptr;
 pTmp->aBase.ppMemberNames = nullptr;
 pTmp->pParameterizedTypes = nullptr;
+// coverity[leaked_storage] - this is on purpose
 }
 break;
 
@@ -588,6 +590,7 @@ extern "C" void typelib_typedescription_newEmpty(
 pTmp->pMemberOffsets = nullptr;
 pTmp->ppTypeRefs = nullptr;
 pTmp->ppMemberNames = nullptr;
+// coverity[leaked_storage] - this is on purpose
 }
 break;
 
@@ -602,6 +605,7 @@ extern "C" void typelib_typedescription_newEmpty(
 pTmp->nEnumValues   = 0;
 pTmp->ppEnumNames   = nullptr;
 pTmp->pEnumValues   = nullptr;
+// coverity[leaked_storage] - this is on purpose
 }
 break;
 
@@ -623,6 +627,7 @@ extern "C" void typelib_typedescription_newEmpty(
 pTmp->pMapMemberIndexToFunctionIndex= nullptr;
 pTmp->nBaseTypes = 0;
 pTmp->ppBaseTypes = nullptr;
+// coverity[leaked_storage] - this is on purpose
 }
 break;
 
@@ -643,6 +648,7 @@ extern "C" void typelib_typedescription_newEmpty(
 pTmp->pInterface = nullptr;
 pTmp->pBaseRef = nullptr;
 pTmp->nIndex = 0;
+// coverity[leaked_storage] - this is on purpose
 }
 break;
 
@@ -663,6 +669,7 @@ extern "C" void typelib_typedescription_newEmpty(
 pTmp->ppGetExceptions = nullptr;
 pTmp->nSetExceptions = 0;
 pTmp->ppSetExceptions = nullptr;
+// coverity[leaked_storage] - this is on purpose
 }
 break;
 
diff --git a/pyuno/source/module/pyuno_dlopenwrapper.c 
b/pyuno/source/module/pyuno_dlopenwrapper.c
index 5654cb0f8f0a..44e711653e35 100644
--- a/pyuno/source/module/pyuno_dlopenwrapper.c
+++ b/pyuno/source/module/pyuno_dlopenwrapper.c
@@ -72,6 +72,7 @@ static void * load(void const * address, char const * symbol) 
{
 dlclose(h);
 abort();
 }
+// coverity[leaked_storage] - this is on purpose
 return func;
 }
 
diff --git a/vcl/unx/generic/plugadapt/salplug.cxx 
b/vcl/unx/generic/plugadapt/salplug.cxx
index 41039c0584f8..d3939b986b41 100644
--- a/vcl/unx/generic/plugadapt/salplug.cxx
+++ b/vcl/unx/generic/plugadapt/salplug.cxx
@@ -123,6 +123,7 @@ static SalInstance* tryInstance( const OUString& 
rModuleBase, bool bForce = fals
 SAL_INFO("vcl.plugadapt", "could not load shared object " << aModule);
 }
 
+// coverity[leaked_storage] - this is on purpose
 return pInst;
 }
 
@@ -317,4 +318,4 @@ SalData::~SalData() COVERITY_NOEXCEPT_FALSE
 psp::PrinterInfoManager::release();
 }
 
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source framework/source include/osl sd/source sd/uiconfig vcl/quartz

2018-05-22 Thread Andrea Gelmini
 cppu/source/typelib/typelib.cxx|6 +++---
 framework/source/fwe/classes/addonsoptions.cxx |2 +-
 include/osl/file.h |2 +-
 include/osl/file.hxx   |2 +-
 sd/source/ui/slidesorter/cache/SlsGenericPageCache.hxx |2 +-
 sd/source/ui/slidesorter/inc/cache/SlsPageCache.hxx|2 +-
 sd/uiconfig/simpress/ui/notebookbar.ui |2 +-
 vcl/quartz/salgdicommon.cxx|2 +-
 8 files changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 6924586821805b7a338c8e746141f51e3ba29560
Author: Andrea Gelmini 
Date:   Tue May 22 15:35:19 2018 +0200

Fix typos

Change-Id: Idbe136fbfd222e8baad588dc36a2f9b7ce6996ec
Reviewed-on: https://gerrit.libreoffice.org/54590
Reviewed-by: Julien Nabet 
Tested-by: Jenkins 

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index 8d842cc40a4f..ac3b23567897 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -497,7 +497,7 @@ bool complete(typelib_TypeDescription ** ppTypeDescr, bool 
initTables) {
 ::typelib_typedescription_register(  ); // replaces incomplete 
one
 OSL_ASSERT( pTD == *ppTypeDescr ); // has to merge into existing 
one
 
-// insert into the chache
+// insert into the cache
 MutexGuard aGuard( rInit.getMutex() );
 if( !rInit.pCache )
 rInit.pCache.reset( new TypeDescriptionList_Impl );
@@ -1994,7 +1994,7 @@ extern "C" void SAL_CALL 
typelib_typedescription_getByName(
 // on demand is activated.
 typelib_typedescription_register( ppRet );
 
-// insert into the chache
+// insert into the cache
 MutexGuard aGuard( rInit.getMutex() );
 if( !rInit.pCache )
 rInit.pCache.reset( new TypeDescriptionList_Impl );
@@ -2052,7 +2052,7 @@ extern "C" void SAL_CALL 
typelib_typedescriptionreference_new(
 // on demand is activated.
 typelib_typedescription_register(  );
 
-// insert into the chache
+// insert into the cache
 MutexGuard aGuard( rInit.getMutex() );
 if( !rInit.pCache )
 rInit.pCache.reset( new TypeDescriptionList_Impl );
diff --git a/framework/source/fwe/classes/addonsoptions.cxx 
b/framework/source/fwe/classes/addonsoptions.cxx
index 9faacbc73d6c..0ed4c5b45833 100644
--- a/framework/source/fwe/classes/addonsoptions.cxx
+++ b/framework/source/fwe/classes/addonsoptions.cxx
@@ -487,7 +487,7 @@ Image AddonsOptions_Impl::GetImageFromURL( const OUString& 
aURL, bool bBig, bool
 Image aImage;
 
 SAL_INFO("fwk", "Expensive: Addons GetImageFromURL " << aURL <<
- " big " << (bBig?"big":"litte") <<
+ " big " << (bBig?"big":"little") <<
  " scale " << (bNoScale ? "noscale" : "scale"));
 
 ImageManager::iterator pIter = m_aImageManager.find(aURL);
diff --git a/include/osl/file.h b/include/osl/file.h
index 7d6d22173420..038631a86618 100644
--- a/include/osl/file.h
+++ b/include/osl/file.h
@@ -635,7 +635,7 @@ typedef void *oslFileHandle;
 
 /** Open a regular file.
 
-Open a file. Only regular files can be openend.
+Open a file. Only regular files can be opened.
 
 @param[in] pustrFileURL
 The full qualified URL of the file to open.
diff --git a/include/osl/file.hxx b/include/osl/file.hxx
index 76b2a1bb110f..6d1a755ac422 100644
--- a/include/osl/file.hxx
+++ b/include/osl/file.hxx
@@ -930,7 +930,7 @@ public:
 
 /** Open a regular file.
 
-Open a file. Only regular files can be openend.
+Open a file. Only regular files can be opened.
 
 @param[in] uFlags
 Specifies the open mode.
diff --git a/sd/source/ui/slidesorter/cache/SlsGenericPageCache.hxx 
b/sd/source/ui/slidesorter/cache/SlsGenericPageCache.hxx
index b0794a0496d0..7ebabdf79bc1 100644
--- a/sd/source/ui/slidesorter/cache/SlsGenericPageCache.hxx
+++ b/sd/source/ui/slidesorter/cache/SlsGenericPageCache.hxx
@@ -34,7 +34,7 @@ class QueueProcessor;
 class GenericPageCache
 {
 public:
-/** The page chache is created with a reference to the SlideSorter and
+/** The page cache is created with a reference to the SlideSorter and
 thus has access to both view and model.  This allows the cache to
 fill itself with requests for all pages or just the visible ones.
 @param rPreviewSize
diff --git a/sd/source/ui/slidesorter/inc/cache/SlsPageCache.hxx 
b/sd/source/ui/slidesorter/inc/cache/SlsPageCache.hxx
index ecf4c0da8491..fffcefb2a4f2 100644
--- a/sd/source/ui/slidesorter/inc/cache/SlsPageCache.hxx
+++ b/sd/source/ui/slidesorter/inc/cache/SlsPageCache.hxx
@@ -65,7 +65,7 @@ class 

[Libreoffice-commits] core.git: cppu/source

2018-01-19 Thread Caolán McNamara
 cppu/source/uno/sequence.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 2ee4a46be759489328eb29feeb02880aab1e1331
Author: Caolán McNamara 
Date:   Thu Jan 18 20:50:12 2018 +

convert these to true asserts

Change-Id: Ifd602f47dd57cdecff3c175d892993072fb82891
Reviewed-on: https://gerrit.libreoffice.org/48154
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/cppu/source/uno/sequence.cxx b/cppu/source/uno/sequence.cxx
index 7d54c4244bdb..3420e5c8ec27 100644
--- a/cppu/source/uno/sequence.cxx
+++ b/cppu/source/uno/sequence.cxx
@@ -744,8 +744,8 @@ sal_Bool SAL_CALL uno_type_sequence_realloc(
 sal_Int32 nSize, uno_AcquireFunc acquire, uno_ReleaseFunc release )
 SAL_THROW_EXTERN_C()
 {
-OSL_ENSURE( ppSequence, "### null ptr!" );
-OSL_ENSURE( nSize >= 0, "### new size must be at least 0!" );
+assert(ppSequence && "### null ptr!");
+assert(nSize >= 0 && "### new size must be at least 0!");
 
 bool ret = true;
 if (nSize != (*ppSequence)->nElements)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source idlc/inc idlc/source io/source ucbhelper/source

2018-01-10 Thread Noel Grandin
 cppu/source/AffineBridge/AffineBridge.cxx |   13 +--
 cppu/source/helper/purpenv/helper_purpenv_Environment.cxx |5 -
 cppu/source/typelib/typelib.cxx   |   18 +
 idlc/inc/astexpression.hxx|6 +
 idlc/source/astexpression.cxx |2 
 idlc/source/idlc.cxx  |2 
 io/source/acceptor/acceptor.cxx   |   20 ++
 ucbhelper/source/provider/contenthelper.cxx   |   46 --
 ucbhelper/source/provider/resultset.cxx   |   20 +-
 9 files changed, 49 insertions(+), 83 deletions(-)

New commits:
commit b27fee9e0ebb445ce82baeade3b249807dca392b
Author: Noel Grandin 
Date:   Wed Jan 10 11:44:28 2018 +0200

loplugin:useuniqueptr cppu,idlc,io,ucbhelper

Change-Id: I6d8c24fabd52b39c66ce0b88b547df7ec85dad76
Reviewed-on: https://gerrit.libreoffice.org/47725
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/cppu/source/AffineBridge/AffineBridge.cxx 
b/cppu/source/AffineBridge/AffineBridge.cxx
index b63b8777a0dd..9926d56ca0ab 100644
--- a/cppu/source/AffineBridge/AffineBridge.cxx
+++ b/cppu/source/AffineBridge/AffineBridge.cxx
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 
 
 class InnerThread;
@@ -46,14 +47,14 @@ public:
 
 osl::Mutexm_innerMutex;
 oslThreadIdentifier   m_innerThreadId;
-InnerThread * m_pInnerThread;
+std::unique_ptr m_pInnerThread;
 osl::Conditionm_innerCondition;
 sal_Int32 m_enterCount;
 
 osl::Mutexm_outerMutex;
 oslThreadIdentifier   m_outerThreadId;
 osl::Conditionm_outerCondition;
-OuterThread * m_pOuterThread;
+std::unique_ptr m_pOuterThread;
 
 explicit  AffineBridge();
 virtual  ~AffineBridge() override;
@@ -149,12 +150,11 @@ AffineBridge::~AffineBridge()
 m_pInnerThread->join();
 }
 
-delete m_pInnerThread;
+m_pInnerThread.reset();
 
 if (m_pOuterThread)
 {
 m_pOuterThread->join();
-delete m_pOuterThread;
 }
 }
 
@@ -238,7 +238,7 @@ void AffineBridge::v_callInto_v(uno_EnvCallee * pCallee, 
va_list * pParam)
 
 if (m_innerThreadId == 0) // no inner thread yet
 {
-m_pInnerThread  = new InnerThread(this);
+m_pInnerThread.reset(new InnerThread(this));
 m_pInnerThread->resume();
 }
 
@@ -275,10 +275,9 @@ void AffineBridge::v_callOut_v(uno_EnvCallee * pCallee, 
va_list * pParam)
 if (m_pOuterThread)
 {
 m_pOuterThread->join();
-delete m_pOuterThread;
 }
 
-m_pOuterThread = new OuterThread(this);
+m_pOuterThread.reset(new OuterThread(this));
 }
 }
 
diff --git a/cppu/source/helper/purpenv/helper_purpenv_Environment.cxx 
b/cppu/source/helper/purpenv/helper_purpenv_Environment.cxx
index 8d24442faa11..d1de047f4679 100644
--- a/cppu/source/helper/purpenv/helper_purpenv_Environment.cxx
+++ b/cppu/source/helper/purpenv/helper_purpenv_Environment.cxx
@@ -26,6 +26,7 @@
 
 #include 
 #include 
+#include 
 
 extern "C" {
 typedef void EnvFun_P   (uno_Environment *);
@@ -95,7 +96,7 @@ public:
 protected:
 oslInterlockedCountm_nRef;
 uno_Environment  * m_pEnv;
-cppu::Enterable  * m_pEnterable;
+std::unique_ptr m_pEnterable;
 
 EnvFun_P* m_env_acquire;
 EnvFun_P* m_env_release;
@@ -263,7 +264,7 @@ Base::~Base()
 
 m_pEnv->pReserved = nullptr;
 
-delete m_pEnterable;
+m_pEnterable.reset();
 m_pEnv->release(m_pEnv);
 }
 
diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index a99746ef0600..1077761710d7 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -174,11 +175,11 @@ struct TypeDescriptor_Init_Impl
 // all type description references
 WeakMap_Impl *  pWeakMap;
 // all type description callbacks
-CallbackSet_Impl *  pCallbacks;
+std::unique_ptr pCallbacks;
 // A cache to hold descriptions
 TypeDescriptionList_Impl *  pCache;
 // The mutex to guard all type library accesses
-Mutex * pMutex;
+std::unique_ptr  pMutex;
 
 inline Mutex & getMutex();
 
@@ -217,7 +218,7 @@ inline Mutex & TypeDescriptor_Init_Impl::getMutex()
 {
 MutexGuard aGuard( Mutex::getGlobalMutex() );
 if( !pMutex )
-pMutex = new Mutex();
+pMutex.reset(new Mutex());
 }
 return * pMutex;
 }
@@ -318,14 +319,7 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl()
 #endif
 
 SAL_INFO_IF( pCallbacks && !pCallbacks->empty(), "cppu.typelib", 
"pCallbacks is not 

[Libreoffice-commits] core.git: cppu/source

2017-11-17 Thread Julien Nabet
 cppu/source/threadpool/jobqueue.hxx   |5 --
 cppu/source/threadpool/thread.cxx |   16 +++--
 cppu/source/threadpool/threadpool.cxx |   60 ++
 cppu/source/threadpool/threadpool.hxx |8 ++--
 4 files changed, 30 insertions(+), 59 deletions(-)

New commits:
commit 7db6878a9d3e534583f9c22709f0eee96eff849f
Author: Julien Nabet 
Date:   Fri Nov 17 20:19:56 2017 +0100

Replace lists by vector or deque (cppu)

+ use for range loops

Change-Id: If0fcba6e06538913031c50ec878b18db3547e06c
Reviewed-on: https://gerrit.libreoffice.org/44894
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/cppu/source/threadpool/jobqueue.hxx 
b/cppu/source/threadpool/jobqueue.hxx
index d4a26c7709cc..9dc20f3cd75e 100644
--- a/cppu/source/threadpool/jobqueue.hxx
+++ b/cppu/source/threadpool/jobqueue.hxx
@@ -20,7 +20,6 @@
 #ifndef INCLUDED_CPPU_SOURCE_THREADPOOL_JOBQUEUE_HXX
 #define INCLUDED_CPPU_SOURCE_THREADPOOL_JOBQUEUE_HXX
 
-#include 
 #include 
 #include 
 #include 
@@ -38,8 +37,6 @@ namespace cppu_threadpool
 RequestFun * doRequest;
 };
 
-typedef std::list < struct Job > JobList;
-
 class DisposedCallerAdmin;
 typedef std::shared_ptr DisposedCallerAdminHolder;
 
@@ -62,7 +59,7 @@ namespace cppu_threadpool
 
 private:
 mutable ::osl::Mutex m_mutex;
-JobList  m_lstJob;
+std::deque < struct Job > m_lstJob;
 std::deque  m_lstCallstack;
 sal_Int32 m_nToDo;
 bool m_bSuspended;
diff --git a/cppu/source/threadpool/thread.cxx 
b/cppu/source/threadpool/thread.cxx
index 8dfa93bd443f..ad37fa3072a8 100644
--- a/cppu/source/threadpool/thread.cxx
+++ b/cppu/source/threadpool/thread.cxx
@@ -39,7 +39,7 @@ namespace cppu_threadpool {
 
 ThreadAdmin::~ThreadAdmin()
 {
-SAL_WARN_IF(m_lst.size(), "cppu.threadpool", m_lst.size() << "Threads 
left");
+SAL_WARN_IF(m_deque.size(), "cppu.threadpool", m_deque.size() << 
"Threads left");
 }
 
 bool ThreadAdmin::add( rtl::Reference< ORequestThread > const & p )
@@ -49,17 +49,13 @@ namespace cppu_threadpool {
 {
 return false;
 }
-m_lst.push_back( p );
+m_deque.push_back( p );
 return true;
 }
 
 void ThreadAdmin::remove_locked( rtl::Reference< ORequestThread > const & 
p )
 {
-std::list< rtl::Reference< ORequestThread > >::iterator ii = 
std::find( m_lst.begin(), m_lst.end(), p );
-if( ii != m_lst.end() )
-{
-m_lst.erase( ii );
-}
+m_deque.erase(std::find( m_deque.begin(), m_deque.end(), p ), 
m_deque.end());
 }
 
 void ThreadAdmin::remove( rtl::Reference< ORequestThread > const & p )
@@ -79,12 +75,12 @@ namespace cppu_threadpool {
 rtl::Reference< ORequestThread > pCurrent;
 {
 MutexGuard aGuard( m_mutex );
-if( m_lst.empty() )
+if( m_deque.empty() )
 {
 break;
 }
-pCurrent = m_lst.front();
-m_lst.pop_front();
+pCurrent = m_deque.front();
+m_deque.pop_front();
 }
 if (pCurrent->getIdentifier()
 != osl::Thread::getCurrentIdentifier())
diff --git a/cppu/source/threadpool/threadpool.cxx 
b/cppu/source/threadpool/threadpool.cxx
index b54036d2cfd2..a3a3eab51d01 100644
--- a/cppu/source/threadpool/threadpool.cxx
+++ b/cppu/source/threadpool/threadpool.cxx
@@ -60,43 +60,25 @@ namespace cppu_threadpool
 
 DisposedCallerAdmin::~DisposedCallerAdmin()
 {
-SAL_WARN_IF( !m_lst.empty(), "cppu.threadpool", "DisposedCallerList :  
" << m_lst.size() << " left");
+SAL_WARN_IF( !m_vector.empty(), "cppu.threadpool", "DisposedCallerList 
:  " << m_vector.size() << " left");
 }
 
 void DisposedCallerAdmin::dispose( sal_Int64 nDisposeId )
 {
 MutexGuard guard( m_mutex );
-m_lst.push_back( nDisposeId );
+m_vector.push_back( nDisposeId );
 }
 
 void DisposedCallerAdmin::destroy( sal_Int64 nDisposeId )
 {
 MutexGuard guard( m_mutex );
-for( auto it = m_lst.begin() ;
- it != m_lst.end() ;
- ++ it )
-{
-if( (*it) == nDisposeId )
-{
-m_lst.erase( it );
-break;
-}
-}
+m_vector.erase(std::remove(m_vector.begin(), m_vector.end(), 
nDisposeId), m_vector.end());
 }
 
 bool DisposedCallerAdmin::isDisposed( sal_Int64 nDisposeId )
 {
 MutexGuard guard( m_mutex );
-for( auto it = m_lst.begin() ;
- it != m_lst.end() ;
- ++ it )
-{
-if( (*it) == nDisposeId )
-{
-return true;
-}
-}
-return false;
+

[Libreoffice-commits] core.git: cppu/source include/sal

2017-08-10 Thread Stephan Bergmann
 cppu/source/uno/cascade_mapping.cxx |   12 
 include/sal/log-areas.dox   |1 -
 2 files changed, 13 deletions(-)

New commits:
commit bfcad6e2b5b4eefaf517c0a690af26b1c16856c6
Author: Stephan Bergmann 
Date:   Thu Aug 10 11:40:35 2017 +0200

Remove excess SAL_INFOs

Change-Id: I21aa7c7878c4ec1371cec4738d2482cc101020a1

diff --git a/cppu/source/uno/cascade_mapping.cxx 
b/cppu/source/uno/cascade_mapping.cxx
index 2cd5e43c04b0..e5dc561badd3 100644
--- a/cppu/source/uno/cascade_mapping.cxx
+++ b/cppu/source/uno/cascade_mapping.cxx
@@ -51,7 +51,6 @@ public:
 MediatorMapping(uno_Environment * pFrom,
 uno_Environment * pInterm,
 uno_Environment * pTo);
-~MediatorMapping();
 };
 
 extern "C" {
@@ -88,8 +87,6 @@ MediatorMapping::MediatorMapping(uno_Environment * pFrom,
   m_interm  (pInterm),
   m_to  (pTo)
 {
-SAL_INFO("cppu.mapping", __FUNCTION__);
-
 if (!m_from2uno.get() || !m_uno2to.get())
 abort();
 
@@ -98,22 +95,13 @@ MediatorMapping::MediatorMapping(uno_Environment * pFrom,
 uno_Mapping::mapInterface = s_mapInterface;
 }
 
-MediatorMapping::~MediatorMapping()
-{
-SAL_INFO("cppu.mapping", __FUNCTION__);
-}
-
 void MediatorMapping::acquire()
 {
-SAL_INFO("cppu.mapping", __FUNCTION__);
-
 osl_atomic_increment(_refCount);
 }
 
 void MediatorMapping::release()
 {
-SAL_INFO("cppu.mapping", __FUNCTION__);
-
 if (osl_atomic_decrement(_refCount) == 0)
 {
 ::uno_revokeMapping(this);
diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index dfc02f597a47..3902e9a60117 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -102,7 +102,6 @@ certain functionality.
 @li @c cppu.threadpool
 @li @c cppu.typelib
 @li @c cppu.purpenv
-@li @c cppu.mapping
 @li @c cppu.unsafebridge
 @li @c cppu.affinebridge
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2017-07-19 Thread Noel Grandin
 cppu/source/typelib/static_types.cxx |2 +-
 cppu/source/typelib/typelib.cxx  |2 +-
 cppu/source/typelib/typelib.hxx  |2 +-
 cppu/source/uno/lbenv.cxx|8 
 cppu/source/uno/prim.hxx |2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit fbf1e4a5d3b6f35b7d6510755ebf58c87f566da0
Author: Noel Grandin 
Date:   Tue Jul 18 13:56:36 2017 +0200

loplugin:constparams in cppu

Change-Id: I0e772b8cf4ee281b5f3e26131df985607a569c48
Reviewed-on: https://gerrit.libreoffice.org/40156
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/cppu/source/typelib/static_types.cxx 
b/cppu/source/typelib/static_types.cxx
index 0a7c1ac1a9e8..1f95dfd93fad 100644
--- a/cppu/source/typelib/static_types.cxx
+++ b/cppu/source/typelib/static_types.cxx
@@ -96,7 +96,7 @@ namespace
 }
 
 // !for NOT REALLY WEAK TYPES only!
-static inline typelib_TypeDescriptionReference * igetTypeByName( rtl_uString * 
pTypeName )
+static inline typelib_TypeDescriptionReference * igetTypeByName( rtl_uString 
const * pTypeName )
 {
 typelib_TypeDescriptionReference * pRef = nullptr;
 ::typelib_typedescriptionreference_getByName( , pTypeName );
diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index 063e0ba8ddb1..ac4e517aaac5 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -2216,7 +2216,7 @@ extern "C" void SAL_CALL 
typelib_typedescriptionreference_getDescription(
 
 
 extern "C" void SAL_CALL typelib_typedescriptionreference_getByName(
-typelib_TypeDescriptionReference ** ppRet, rtl_uString * pName )
+typelib_TypeDescriptionReference ** ppRet, rtl_uString const * pName )
 SAL_THROW_EXTERN_C()
 {
 if( *ppRet )
diff --git a/cppu/source/typelib/typelib.hxx b/cppu/source/typelib/typelib.hxx
index 18c8daa04b53..30f0f22c986c 100644
--- a/cppu/source/typelib/typelib.hxx
+++ b/cppu/source/typelib/typelib.hxx
@@ -35,7 +35,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty(
 
 extern "C" void SAL_CALL typelib_typedescriptionreference_getByName(
 typelib_TypeDescriptionReference ** ppRet,
-rtl_uString * pName )
+rtl_uString const * pName )
 SAL_THROW_EXTERN_C();
 
 #endif // INCLUDED_CPPU_SOURCE_TYPELIB_HXX
diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index f8c225de7bd1..116c02e8ab77 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -52,8 +52,8 @@ namespace
 {
 
 
-inline bool td_equals( typelib_InterfaceTypeDescription * pTD1,
-  typelib_InterfaceTypeDescription * pTD2 )
+inline bool td_equals( typelib_InterfaceTypeDescription const * pTD1,
+   typelib_InterfaceTypeDescription const * pTD2 )
 {
 return (pTD1 == pTD2 ||
 (pTD1->aBase.pTypeName->length == pTD2->aBase.pTypeName->length &&
@@ -89,7 +89,7 @@ struct ObjectEntry
 uno_freeProxyFunc fpFreeProxy );
 inline InterfaceEntry * find(
 typelib_InterfaceTypeDescription * pTypeDescr );
-inline sal_Int32 find( void * iface_ptr, std::size_t pos );
+inline sal_Int32 find( void const * iface_ptr, std::size_t pos );
 };
 
 
@@ -213,7 +213,7 @@ inline InterfaceEntry * ObjectEntry::find(
 
 
 inline sal_Int32 ObjectEntry::find(
-void * iface_ptr, std::size_t pos )
+void const * iface_ptr, std::size_t pos )
 {
 std::size_t size = aInterfaces.size();
 for ( ; pos < size; ++pos )
diff --git a/cppu/source/uno/prim.hxx b/cppu/source/uno/prim.hxx
index 619dba3a1255..f497f6f6cf5d 100644
--- a/cppu/source/uno/prim.hxx
+++ b/cppu/source/uno/prim.hxx
@@ -142,7 +142,7 @@ extern "C" void * binuno_queryInterface(
 
 
 inline bool _type_equals(
-typelib_TypeDescriptionReference * pType1, 
typelib_TypeDescriptionReference * pType2 )
+typelib_TypeDescriptionReference const * pType1, 
typelib_TypeDescriptionReference const * pType2 )
 
 {
 return (pType1 == pType2 ||
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source include/sal

2017-07-17 Thread Chris Sherlock
 cppu/source/AffineBridge/AffineBridge.cxx |   17 +--
 cppu/source/UnsafeBridge/UnsafeBridge.cxx |   20 +-
 cppu/source/helper/purpenv/helper_purpenv_Environment.cxx |   18 +---
 cppu/source/helper/purpenv/helper_purpenv_Mapping.cxx |   20 +-
 cppu/source/helper/purpenv/helper_purpenv_Proxy.cxx   |   17 +--
 cppu/source/uno/cascade_mapping.cxx   |   18 ++--
 include/sal/log-areas.dox |3 ++
 7 files changed, 17 insertions(+), 96 deletions(-)

New commits:
commit 2cbd4121685b5c2f2cfddea6775171aaee72a4c1
Author: Chris Sherlock 
Date:   Sat Jul 15 10:34:15 2017 +1000

cppu: remove unnecessary LOG_LIFECYCLE_* macros

Change-Id: I0f19cf7045e6ff2906404a73ce710e42800c0a72
Reviewed-on: https://gerrit.libreoffice.org/39994
Reviewed-by: Chris Sherlock 
Tested-by: Chris Sherlock 

diff --git a/cppu/source/AffineBridge/AffineBridge.cxx 
b/cppu/source/AffineBridge/AffineBridge.cxx
index 6d194517bf56..db5fa824b9f5 100644
--- a/cppu/source/AffineBridge/AffineBridge.cxx
+++ b/cppu/source/AffineBridge/AffineBridge.cxx
@@ -28,19 +28,6 @@
 #include "cppu/helper/purpenv/Mapping.hxx"
 
 
-#ifdef debug
-# define LOG_LIFECYCLE_AffineBridge
-#endif
-
-#ifdef LOG_LIFECYCLE_AffineBridge
-#  include 
-#  define LOG_LIFECYCLE_AffineBridge_emit(x) x
-
-#else
-#  define LOG_LIFECYCLE_AffineBridge_emit(x)
-
-#endif
-
 class InnerThread;
 class OuterThread;
 
@@ -147,12 +134,12 @@ AffineBridge::AffineBridge()
   m_outerThreadId(0),
   m_pOuterThread (nullptr)
 {
-LOG_LIFECYCLE_AffineBridge_emit(fprintf(stderr, "LIFE: %s -> %p\n", 
"AffineBridge::AffineBridge(uno_Environment * pEnv)", this));
+SAL_INFO("cppu.affinebridge", "LIFE: 
AffineBridge::AffineBridge(uno_Environment * pEnv) -> " << this);
 }
 
 AffineBridge::~AffineBridge()
 {
-LOG_LIFECYCLE_AffineBridge_emit(fprintf(stderr, "LIFE: %s -> %p\n", 
"AffineBridge::~AffineBridge()", this));
+SAL_INFO("cppu.affinebridge", "LIFE: AffineBridge::~AffineBridge() -> " << 
this);
 
 if (m_pInnerThread && osl::Thread::getCurrentIdentifier() != 
m_innerThreadId)
 {
diff --git a/cppu/source/UnsafeBridge/UnsafeBridge.cxx 
b/cppu/source/UnsafeBridge/UnsafeBridge.cxx
index 1187f54dbe58..17a375a319dd 100644
--- a/cppu/source/UnsafeBridge/UnsafeBridge.cxx
+++ b/cppu/source/UnsafeBridge/UnsafeBridge.cxx
@@ -17,7 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-
 #include "osl/mutex.hxx"
 #include "osl/thread.h"
 #include "osl/thread.hxx"
@@ -27,21 +26,6 @@
 #include "cppu/helper/purpenv/Environment.hxx"
 #include "cppu/helper/purpenv/Mapping.hxx"
 
-
-#ifdef debug
-# define LOG_LIFECYCLE_UnsafeBridge
-#endif
-
-#ifdef LOG_LIFECYCLE_UnsafeBridge
-#  include 
-#  define LOG_LIFECYCLE_UnsafeBridge_emit(x) x
-
-#else
-#  define LOG_LIFECYCLE_UnsafeBridge_emit(x)
-
-#endif
-
-
 class UnsafeBridge : public cppu::Enterable
 {
 osl::Mutex  m_mutex;
@@ -66,12 +50,12 @@ UnsafeBridge::UnsafeBridge()
 : m_count   (0),
   m_threadId(0)
 {
-LOG_LIFECYCLE_UnsafeBridge_emit(fprintf(stderr, "LIFE: %s -> %p\n", 
"UnsafeBridge::UnsafeBridge(uno_Environment * pEnv)", this));
+SAL_INFO("cppu.unsafebridge", "LIFE: 
UnsafeBridge::UnsafeBridge(uno_Environment * pEnv) -> " << this);
 }
 
 UnsafeBridge::~UnsafeBridge()
 {
-LOG_LIFECYCLE_UnsafeBridge_emit(fprintf(stderr, "LIFE: %s -> %p\n", 
"UnsafeBridge::~UnsafeBridge()", this));
+SAL_INFO("cppu.unsafebridge", "LIFE: UnsafeBridge::~UnsafeBridge() -> " << 
this);
 
 SAL_WARN_IF(m_count < 0, "cppu.unsafebridge", "m_count is less than 0");
 }
diff --git a/cppu/source/helper/purpenv/helper_purpenv_Environment.cxx 
b/cppu/source/helper/purpenv/helper_purpenv_Environment.cxx
index 449429ffc0b0..9e4925335306 100644
--- a/cppu/source/helper/purpenv/helper_purpenv_Environment.cxx
+++ b/cppu/source/helper/purpenv/helper_purpenv_Environment.cxx
@@ -27,20 +27,6 @@
 #include "typelib/typedescription.h"
 #include "osl/interlck.h"
 
-#ifdef debug
-# define LOG_LIFECYCLE_cppu_helper_purpenv_Base
-#endif
-
-#ifdef LOG_LIFECYCLE_cppu_helper_purpenv_Base
-#  include 
-#  define LOG_LIFECYCLE_cppu_helper_purpenv_Base_emit(x) x
-
-#else
-#  define LOG_LIFECYCLE_cppu_helper_purpenv_Base_emit(x)
-
-#endif
-
-
 extern "C" {
 typedef void SAL_CALL EnvFun_P   (uno_Environment *);
 typedef void SAL_CALL EnvFun_PP_P(uno_Environment ** ppHardEnv, 
uno_Environment *);
@@ -241,7 +227,7 @@ Base::Base(uno_Environment * pEnv, cppu::Enterable * 
pEnterable)
  m_env_acquireInterface   (pEnv->pExtEnv->acquireInterface),
  m_env_releaseInterface   (pEnv->pExtEnv->releaseInterface)
 {
-LOG_LIFECYCLE_cppu_helper_purpenv_Base_emit(fprintf(stderr, "LIFE: %s -> 
%p\n", "cppu::helper::purpenv::Base::Base(uno_Environment * pEnv)", this));
+   

[Libreoffice-commits] core.git: cppu/source

2017-07-04 Thread Rene Engelhard
 cppu/source/uno/check.cxx |   26 --
 1 file changed, 20 insertions(+), 6 deletions(-)

New commits:
commit 4b7a1b424eab9a48017fbe224c6be6fac4748007
Author: Rene Engelhard 
Date:   Mon Jun 26 22:18:41 2017 +0200

fix m68k build (again)

This reverts commit d5d6ee3b3e7cf3d93f892a452244051e4294fe6d and applies
the patch cleanly again. somehow it got mis-applied.

Change-Id: Id199d9086fb8e2e52bb810c8ddcbdd7fa7060676
Reviewed-on: https://gerrit.libreoffice.org/39279
Reviewed-by: Rene Engelhard 
Tested-by: Rene Engelhard 

diff --git a/cppu/source/uno/check.cxx b/cppu/source/uno/check.cxx
index 9a734a78e8cf..353e2c977493 100644
--- a/cppu/source/uno/check.cxx
+++ b/cppu/source/uno/check.cxx
@@ -153,7 +153,7 @@ static_assert( static_cast(false) == sal_False,
"must be binary compatible" );
 #if SAL_TYPES_ALIGNMENT8 == 2
 static_assert(offsetof(AlignSize_Impl, dDouble) == 2, 
"offsetof(AlignSize_Impl, dDouble) != 2");
-static_assert(sizeof(AlignSize_Impl) == 12, "sizeof(AlignSize_Impl) != 12");
+static_assert(sizeof(AlignSize_Impl) == 10, "sizeof(AlignSize_Impl) != 10");
 #elif SAL_TYPES_ALIGNMENT8 == 4
 static_assert(offsetof(AlignSize_Impl, dDouble) == 4, 
"offsetof(AlignSize_Impl, dDouble) != 4");
 static_assert(sizeof(AlignSize_Impl) == 12, "sizeof(AlignSize_Impl) != 12");
@@ -177,13 +177,19 @@ static_assert(offsetof(uno_Any, pReserved) == 2 * 
sizeof(void *), "offsetof(uno_
 // string
 static_assert(sizeof(OUString) == sizeof(rtl_uString *), "binary compatibility 
test failed: sizeof(OUString) != sizeof(rtl_uString *)");
 // struct
+#if SAL_TYPES_ALIGNMENT8 == 2
+static_assert(sizeof(M) == 6, "sizeof(M) != 6");
+static_assert(sizeof(N) == 8, "sizeof(N) != 8");
+static_assert(sizeof(N2) == 8, "sizeof(N2) != 8");
+static_assert(offsetof(N2, p) == 6, "offsetof(N2, p) != 6");
+#else
 static_assert(sizeof(M) == 8, "sizeof(M) != 8");
-static_assert(offsetof(M, o) == 4, "offsetof(M, o) != 4");
 static_assert(sizeof(N) == 12, "sizeof(N) != 12");
-
 static_assert(sizeof(N2) == 12, "sizeof(N2) != 12");
-
 static_assert(offsetof(N2, p) == 8, "offsetof(N2, p) != 8");
+#endif
+static_assert(offsetof(M, o) == 4, "offsetof(M, o) != 4");
+
 #if SAL_TYPES_ALIGNMENT8 == 2
 static_assert(sizeof(O) == 16, "sizeof(O) != 16");
 #elif SAL_TYPES_ALIGNMENT8 == 4
@@ -193,13 +199,21 @@ static_assert(sizeof(O) == 24, "sizeof(O) != 24");
 #else
 # error unexpected alignment of 8 byte types
 #endif
+
+#if SAL_TYPES_ALIGNMENT8 == 2
+static_assert(sizeof(C2) == 6, "sizeof(C2) != 6");
+static_assert(sizeof(D) == 6, "sizeof(D) != 6");
+static_assert(offsetof(D, e) == 2, "offsetof(D, e) != 2");
+static_assert(offsetof(E, e) == 6, "offsetof(E, e) != 6");
+#else
+static_assert(sizeof(C2) == 8, "sizeof(C2) != 8");
 static_assert(sizeof(D) == 8, "sizeof(D) != 8");
 static_assert(offsetof(D, e) == 4, "offsetof(D, e) != 4");
-static_assert(offsetof(E, d) == 4, "offsetof(E, d) != 4");
 static_assert(offsetof(E, e) == 8, "offsetof(E, e) != 8");
+#endif
 
 static_assert(sizeof(C1) == 2, "sizeof(C1) != 2");
-static_assert(sizeof(C2) == 8, "sizeof(C2) != 8");
+static_assert(offsetof(E, d) == 4, "offsetof(E, d) != 4");
 
 #if SAL_TYPES_ALIGNMENT8 == 2
 static_assert(sizeof(C3) == 18, "sizeof(C3) != 18");
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2016-12-12 Thread John Paul Adrian Glaubitz
 cppu/source/uno/check.cxx |   36 +++-
 1 file changed, 31 insertions(+), 5 deletions(-)

New commits:
commit d5d6ee3b3e7cf3d93f892a452244051e4294fe6d
Author: John Paul Adrian Glaubitz 
Date:   Mon Dec 12 00:45:24 2016 +0100

uno: Add support for targets with 16-bit alignment

Despite being a 32-bit architecture, m68k has a basic
alignment of 16-bit for historic reasons. On m68k,
SAL_TYPES_ALIGNMENT8 is therefore equal to 2 and we
need to cover this case in the static asserts as well.

Change-Id: I4c756af25d57e5d49209697f6e678ef71a5845aa
Reviewed-on: https://gerrit.libreoffice.org/31878
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/cppu/source/uno/check.cxx b/cppu/source/uno/check.cxx
index 620a970..9a734a7 100644
--- a/cppu/source/uno/check.cxx
+++ b/cppu/source/uno/check.cxx
@@ -151,7 +151,10 @@ static_assert( static_cast(true) == sal_True,
"must be binary compatible" );
 static_assert( static_cast(false) == sal_False,
"must be binary compatible" );
-#if SAL_TYPES_ALIGNMENT8 == 4
+#if SAL_TYPES_ALIGNMENT8 == 2
+static_assert(offsetof(AlignSize_Impl, dDouble) == 2, 
"offsetof(AlignSize_Impl, dDouble) != 2");
+static_assert(sizeof(AlignSize_Impl) == 12, "sizeof(AlignSize_Impl) != 12");
+#elif SAL_TYPES_ALIGNMENT8 == 4
 static_assert(offsetof(AlignSize_Impl, dDouble) == 4, 
"offsetof(AlignSize_Impl, dDouble) != 4");
 static_assert(sizeof(AlignSize_Impl) == 12, "sizeof(AlignSize_Impl) != 12");
 #elif SAL_TYPES_ALIGNMENT8 == 8
@@ -181,7 +184,9 @@ static_assert(sizeof(N) == 12, "sizeof(N) != 12");
 static_assert(sizeof(N2) == 12, "sizeof(N2) != 12");
 
 static_assert(offsetof(N2, p) == 8, "offsetof(N2, p) != 8");
-#if SAL_TYPES_ALIGNMENT8 == 4
+#if SAL_TYPES_ALIGNMENT8 == 2
+static_assert(sizeof(O) == 16, "sizeof(O) != 16");
+#elif SAL_TYPES_ALIGNMENT8 == 4
 static_assert(sizeof(O) == 20, "sizeof(O) != 20");
 #elif SAL_TYPES_ALIGNMENT8 == 8
 static_assert(sizeof(O) == 24, "sizeof(O) != 24");
@@ -196,7 +201,14 @@ static_assert(offsetof(E, e) == 8, "offsetof(E, e) != 8");
 static_assert(sizeof(C1) == 2, "sizeof(C1) != 2");
 static_assert(sizeof(C2) == 8, "sizeof(C2) != 8");
 
-#if SAL_TYPES_ALIGNMENT8 == 4
+#if SAL_TYPES_ALIGNMENT8 == 2
+static_assert(sizeof(C3) == 18, "sizeof(C3) != 18");
+static_assert(sizeof(C4) == 30, "sizeof(C4) != 30");
+static_assert(sizeof(C5) == 40, "sizeof(C5) != 40");
+static_assert(sizeof(C6) == 44, "sizeof(C6) != 44");
+
+static_assert(sizeof(O2) == 18, "sizeof(O2) != 18");
+#elif SAL_TYPES_ALIGNMENT8 == 4
 static_assert(sizeof(C3) == 20, "sizeof(C3) != 20");
 static_assert(sizeof(C4) == 32, "sizeof(C4) != 32");
 static_assert(sizeof(C5) == 44, "sizeof(C5) != 44");
@@ -216,7 +228,10 @@ static_assert(sizeof(O2) == 32, "sizeof(O2) != 32");
 
 static_assert(sizeof(Char3) == 3, "sizeof(Char3) != 3");
 
-#if SAL_TYPES_ALIGNMENT8 == 4
+#if SAL_TYPES_ALIGNMENT8 == 2
+// max alignment is 2
+static_assert(sizeof(P) == 16, "sizeof(P) != 16");
+#elif SAL_TYPES_ALIGNMENT8 == 4
 // max alignment is 4
 static_assert(sizeof(P) == 20, "sizeof(P) != 20");
 #elif SAL_TYPES_ALIGNMENT8 == 8
@@ -242,7 +257,18 @@ BinaryCompatible_Impl::BinaryCompatible_Impl()
 
 assert(OFFSET_OF(C2, n2) == 4);
 
-#if SAL_TYPES_ALIGNMENT8 == 4
+#if SAL_TYPES_ALIGNMENT8 == 2
+assert(OFFSET_OF(C3, d3) == 6);
+assert(OFFSET_OF(C3, n3) == 14);
+assert(OFFSET_OF(C4, n4) == 18);
+assert(OFFSET_OF(C4, d4) == 22);
+assert(OFFSET_OF(C5, n5) == 30);
+assert(OFFSET_OF(C5, b5) == 38);
+assert(OFFSET_OF(C6, c6) == 2);
+assert(OFFSET_OF(C6, b6) == 42);
+
+assert(OFFSET_OF(O2, p2) == 16);
+#elif SAL_TYPES_ALIGNMENT8 == 4
 assert(OFFSET_OF(C3, d3) == 8);
 assert(OFFSET_OF(C3, n3) == 16);
 assert(OFFSET_OF(C4, n4) == 20);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2016-12-07 Thread Stephan Bergmann
 cppu/source/threadpool/thread.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit de5a8470ca79d549258bf9da1dea7d4a0c183946
Author: Stephan Bergmann 
Date:   Wed Dec 7 12:33:17 2016 +0100

Prevent self-join in ThreadAdmin::join

Depending on timing, it can apparently happen at least during
JunitTest_unordf_complex that a cppu_threadpool::ORequestThread having 
executed
a binaryurp::IncomingRequest holds the last binaryurp::Bridge reference:

> #2  0x7fac4ad6bf97 in __assert_fail_base (fmt=, 
assertion=assertion@entry=0x7fac4b4e8c22 "false", 
file=file@entry=0x7fac4b4eaec7 "sal/osl/unx/thread.cxx", line=line@entry=443, 
function=function@entry=0x7fac4b4eaefd "void osl_joinWithThread(oslThread)") at 
assert.c:92
> #3  0x7fac4ad6c042 in __GI___assert_fail (assertion=0x7fac4b4e8c22 
"false", file=0x7fac4b4eaec7 "sal/osl/unx/thread.cxx", line=443, 
function=0x7fac4b4eaefd "void osl_joinWithThread(oslThread)") at assert.c:101
> #4  0x7fac4b4d5258 in osl_joinWithThread(oslThread) 
(Thread=0x7fabfc0011d0) at sal/osl/unx/thread.cxx:443
> #5  0x7fac47fbdde5 in cppu_threadpool::ThreadAdmin::join() 
(this=0x7fac1c0069e0) at cppu/source/threadpool/thread.cxx:89
> #6  0x7fac47fc23af in cppu_threadpool::ThreadPool::joinWorkers() 
(this=) at cppu/source/threadpool/threadpool.cxx:179
> #7  0x7fac47fc35b7 in uno_threadpool_destroy(uno_ThreadPool) 
(hPool=) at cppu/source/threadpool/threadpool.cxx:499
> #8  0x7fac25b03b5c in binaryurp::Bridge::terminate(bool) 
(this=0x7fac24117078, final=true) at binaryurp/source/bridge.cxx:277
> #9  0x7fac25b0794e in binaryurp::Bridge::dispose() 
(this=0x7fac24117078) at binaryurp/source/bridge.cxx:904
> #10 0x7fac25b07215 in binaryurp::Bridge::~Bridge() 
(this=0x7fac24117078) at binaryurp/source/bridge.cxx:847
> #11 0x7fac25b07409 in binaryurp::Bridge::~Bridge() 
(this=0x7fac24117078) at binaryurp/source/bridge.cxx:838
> #12 0x7fac25b39ee1 in 
std::default_delete::operator()(binaryurp::IncomingRequest*)
 const (this=, __ptr=0x7fabfc00ba50) at 
/usr/lib/gcc/x86_64-redhat-linux/6.2.1/../../../../include/c++/6.2.1/bits/unique_ptr.h:76
> #13 0x7fac25b38fa8 in std::unique_ptr::~unique_ptr() 
(this=0x7fac0bb74ac0) at 
/usr/lib/gcc/x86_64-redhat-linux/6.2.1/../../../../include/c++/6.2.1/bits/unique_ptr.h:236
> #14 0x7fac25b36d71 in request(void*) (pThreadSpecificData=) at binaryurp/source/reader.cxx:83
> #15 0x7fac47fbaa95 in cppu_threadpool::JobQueue::enter(long, bool) 
(this=, nDisposeId=, bReturnWhenNoJob=) at cppu/source/threadpool/jobqueue.cxx:107
> #16 0x7fac47fbe1f9 in cppu_threadpool::ORequestThread::run() 
(this=0x7fabfc001160) at cppu/source/threadpool/thread.cxx:165
> #17 0x7fac47fbf9ca in threadFunc(void*) (param=0x7fabfc001170) at 
include/osl/thread.hxx:185
> #18 0x7fac4b4d5a3c in osl_thread_start_Impl(void*) 
(pData=0x7fabfc0011d0) at sal/osl/unx/thread.cxx:240
> #19 0x7fac4ab2a5ca in start_thread (arg=0x7fac0bb75700) at 
pthread_create.c:333
> #20 0x7fac4ae420ed in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:109

while the main thread is already shutting down:

> #19 0x7fac4b14100f in desktop::Desktop::doShutdown() 
(this=0x7fff8a6149d0) at desktop/source/app/app.cxx:1783
> #20 0x7fac4b13f505 in desktop::Desktop::Main() (this=0x7fff8a6149d0) 
at desktop/source/app/app.cxx:1716
> #21 0x7fac419a0f79 in ImplSVMain() () at vcl/source/app/svmain.cxx:185
> #22 0x7fac419a1c14 in SVMain() () at vcl/source/app/svmain.cxx:223
> #23 0x7fac4b17c773 in soffice_main() () at 
desktop/source/app/sofficemain.cxx:166
> #24 0x00400916 in sal_main () at desktop/source/app/main.c:48
> #25 0x004008fb in main (argc=, argv=) at desktop/source/app/main.c:47

Change-Id: I34beac40e89f6d522af49f9dcdb3ed2fc1259c4b

diff --git a/cppu/source/threadpool/thread.cxx 
b/cppu/source/threadpool/thread.cxx
index 06fd30d..0e8b809 100644
--- a/cppu/source/threadpool/thread.cxx
+++ b/cppu/source/threadpool/thread.cxx
@@ -86,7 +86,11 @@ namespace cppu_threadpool {
 pCurrent = m_lst.front();
 m_lst.pop_front();
 }
-pCurrent->join();
+if (pCurrent->getIdentifier()
+!= osl::Thread::getCurrentIdentifier())
+{
+pCurrent->join();
+}
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2016-09-20 Thread Stephan Bergmann
 cppu/source/uno/lbmap.cxx |   10 ++
 1 file changed, 10 insertions(+)

New commits:
commit 11aa8ac4e3ae212cd06ffe9f24c5d99af5dfb9a3
Author: Stephan Bergmann 
Date:   Tue Sep 20 18:22:32 2016 +0200

cid#1371314: Add move semantics

Change-Id: I995cbdb2b6adc707abe5f1a179e94251641120bc

diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx
index e5c3568..7cfba7a 100644
--- a/cppu/source/uno/lbmap.cxx
+++ b/cppu/source/uno/lbmap.cxx
@@ -62,10 +62,20 @@ class Mapping
 public:
 inline explicit Mapping( uno_Mapping * pMapping = nullptr );
 inline Mapping( const Mapping & rMapping );
+Mapping(Mapping && other): _pMapping(other._pMapping)
+{ other._pMapping = nullptr; }
 inline ~Mapping();
 inline Mapping & SAL_CALL operator = ( uno_Mapping * pMapping );
 inline Mapping & SAL_CALL operator = ( const Mapping & rMapping )
 { return operator = ( rMapping._pMapping ); }
+Mapping & operator =(Mapping && other) {
+if (_pMapping != nullptr) {
+(*_pMapping->release)(_pMapping);
+}
+_pMapping = other._pMapping;
+other._pMapping = nullptr;
+return *this;
+}
 inline uno_Mapping * SAL_CALL get() const
 { return _pMapping; }
 inline bool SAL_CALL is() const
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2016-08-23 Thread Stephan Bergmann
 cppu/source/uno/sequence.cxx |   58 ++-
 1 file changed, 19 insertions(+), 39 deletions(-)

New commits:
commit 8b1752eb78c74736a7efaf32a362c9b672703f69
Author: Stephan Bergmann 
Date:   Tue Aug 23 17:34:55 2016 +0200

icopyConstructFromElements's nAlloc is never negative

follow-up to 7fa183cb1a04120b37069c63166182065c3d975c
"loplugin:countusersofdefaultparams in chart2..desktop"

Change-Id: I099229ac4a3670e26570b083e3b0a4a92984f663

diff --git a/cppu/source/uno/sequence.cxx b/cppu/source/uno/sequence.cxx
index 18629a1..28828b1 100644
--- a/cppu/source/uno/sequence.cxx
+++ b/cppu/source/uno/sequence.cxx
@@ -318,14 +318,13 @@ static inline bool icopyConstructFromElements(
 typelib_TypeDescriptionReference * pElementType,
 sal_Int32 nStartIndex, sal_Int32 nStopIndex,
 uno_AcquireFunc acquire,
-sal_Int32 nAlloc ) // >= 0 means (re)alloc memory for nAlloc elements
+sal_Int32 nAlloc )
 {
 uno_Sequence * pSeq = *ppSeq;
 switch (pElementType->eTypeClass)
 {
 case typelib_TypeClass_CHAR:
-if (nAlloc >= 0)
-pSeq = reallocSeq( pSeq, sizeof(sal_Unicode), nAlloc );
+pSeq = reallocSeq( pSeq, sizeof(sal_Unicode), nAlloc );
 if (pSeq != nullptr)
 {
 memcpy(
@@ -335,8 +334,7 @@ static inline bool icopyConstructFromElements(
 }
 break;
 case typelib_TypeClass_BOOLEAN:
-if (nAlloc >= 0)
-pSeq = reallocSeq( pSeq, sizeof(sal_Bool), nAlloc );
+pSeq = reallocSeq( pSeq, sizeof(sal_Bool), nAlloc );
 if (pSeq != nullptr)
 {
 memcpy(
@@ -346,8 +344,7 @@ static inline bool icopyConstructFromElements(
 }
 break;
 case typelib_TypeClass_BYTE:
-if (nAlloc >= 0)
-pSeq = reallocSeq( pSeq, sizeof(sal_Int8), nAlloc );
+pSeq = reallocSeq( pSeq, sizeof(sal_Int8), nAlloc );
 if (pSeq != nullptr)
 {
 memcpy(
@@ -358,8 +355,7 @@ static inline bool icopyConstructFromElements(
 break;
 case typelib_TypeClass_SHORT:
 case typelib_TypeClass_UNSIGNED_SHORT:
-if (nAlloc >= 0)
-pSeq = reallocSeq( pSeq, sizeof(sal_Int16), nAlloc );
+pSeq = reallocSeq( pSeq, sizeof(sal_Int16), nAlloc );
 if (pSeq != nullptr)
 {
 memcpy(
@@ -370,8 +366,7 @@ static inline bool icopyConstructFromElements(
 break;
 case typelib_TypeClass_LONG:
 case typelib_TypeClass_UNSIGNED_LONG:
-if (nAlloc >= 0)
-pSeq = reallocSeq( pSeq, sizeof(sal_Int32), nAlloc );
+pSeq = reallocSeq( pSeq, sizeof(sal_Int32), nAlloc );
 if (pSeq != nullptr)
 {
 memcpy(
@@ -382,8 +377,7 @@ static inline bool icopyConstructFromElements(
 break;
 case typelib_TypeClass_HYPER:
 case typelib_TypeClass_UNSIGNED_HYPER:
-if (nAlloc >= 0)
-pSeq = reallocSeq( pSeq, sizeof(sal_Int64), nAlloc );
+pSeq = reallocSeq( pSeq, sizeof(sal_Int64), nAlloc );
 if (pSeq != nullptr)
 {
 memcpy(
@@ -393,8 +387,7 @@ static inline bool icopyConstructFromElements(
 }
 break;
 case typelib_TypeClass_FLOAT:
-if (nAlloc >= 0)
-pSeq = reallocSeq( pSeq, sizeof(float), nAlloc );
+pSeq = reallocSeq( pSeq, sizeof(float), nAlloc );
 if (pSeq != nullptr)
 {
 memcpy(
@@ -404,8 +397,7 @@ static inline bool icopyConstructFromElements(
 }
 break;
 case typelib_TypeClass_DOUBLE:
-if (nAlloc >= 0)
-pSeq = reallocSeq( pSeq, sizeof(double), nAlloc );
+pSeq = reallocSeq( pSeq, sizeof(double), nAlloc );
 if (pSeq != nullptr)
 {
 memcpy(
@@ -415,8 +407,7 @@ static inline bool icopyConstructFromElements(
 }
 break;
 case typelib_TypeClass_ENUM:
-if (nAlloc >= 0)
-pSeq = reallocSeq( pSeq, sizeof(sal_Int32), nAlloc );
+pSeq = reallocSeq( pSeq, sizeof(sal_Int32), nAlloc );
 if (pSeq != nullptr)
 {
 memcpy(
@@ -427,8 +418,7 @@ static inline bool icopyConstructFromElements(
 break;
 case typelib_TypeClass_STRING:
 {
-if (nAlloc >= 0)
-pSeq = reallocSeq( pSeq, sizeof(rtl_uString *), nAlloc );
+pSeq = reallocSeq( pSeq, sizeof(rtl_uString *), nAlloc );
 if (pSeq != nullptr)
 {
 rtl_uString ** pDestElements = reinterpret_cast(pSeq->elements);
@@ -445,11 +435,8 @@ static inline bool icopyConstructFromElements(
 }
 case typelib_TypeClass_TYPE:
 {
-if (nAlloc >= 0)
-{
-pSeq = reallocSeq(
-pSeq, sizeof(typelib_TypeDescriptionReference *), nAlloc );
-}
+pSeq = reallocSeq(
+pSeq, sizeof(typelib_TypeDescriptionReference *), nAlloc );
 if (pSeq 

[Libreoffice-commits] core.git: cppu/source

2016-07-11 Thread Stephan Bergmann
 cppu/source/AffineBridge/AffineBridge.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit a88cfade0878754f98ffe1ed0dbfc7ea17528166
Author: Stephan Bergmann 
Date:   Mon Jul 11 17:25:42 2016 +0200

int -> bool

Change-Id: I8e8bedcc510a895cda90c9979bf75afca0ea9071

diff --git a/cppu/source/AffineBridge/AffineBridge.cxx 
b/cppu/source/AffineBridge/AffineBridge.cxx
index 2fa8065..75d406f 100644
--- a/cppu/source/AffineBridge/AffineBridge.cxx
+++ b/cppu/source/AffineBridge/AffineBridge.cxx
@@ -80,7 +80,7 @@ public:
 virtual bool v_isValid(rtl::OUString * pReason) override;
 
 void innerDispatch();
-void outerDispatch(int loop);
+void outerDispatch(bool loop);
 };
 
 class InnerThread : public osl::Thread
@@ -129,7 +129,7 @@ void OuterThread::run()
 osl::MutexGuard guard(m_pAffineBridge->m_outerMutex);
 
 m_pAffineBridge->m_outerThreadId = getIdentifier();
-m_pAffineBridge->outerDispatch(0);
+m_pAffineBridge->outerDispatch(false);
 m_pAffineBridge->m_outerThreadId = 0;
 
 m_pAffineBridge->m_pOuterThread = nullptr;
@@ -172,7 +172,7 @@ AffineBridge::~AffineBridge()
 }
 
 
-void AffineBridge::outerDispatch(int loop)
+void AffineBridge::outerDispatch(bool loop)
 {
 OSL_ASSERT(m_outerThreadId == osl::Thread::getCurrentIdentifier());
 OSL_ASSERT(m_innerThreadId != m_outerThreadId);
@@ -267,7 +267,7 @@ void AffineBridge::v_callInto_v(uno_EnvCallee * pCallee, 
va_list * pParam)
 m_pParam  = pParam;
 m_innerCondition.set();
 
-outerDispatch(1);
+outerDispatch(true);
 
 if (bResetId)
 m_outerThreadId = 0;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source framework/inc

2016-05-01 Thread tymyjan
 cppu/source/uno/lbmap.cxx |2 +-
 framework/inc/uifactory/configurationaccessfactorymanager.hxx |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 3acbc64869877868d30f7e1b8e5254282aed27f7
Author: tymyjan 
Date:   Fri Apr 29 21:51:16 2016 +0200

tdf#97499 Fixed containers parameters clearing #8

Change-Id: I82ca89ac483e9742be0d38a3c6882a240c7c38d8
Reviewed-on: https://gerrit.libreoffice.org/24499
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx
index 8a87c7f..e5c3568 100644
--- a/cppu/source/uno/lbmap.cxx
+++ b/cppu/source/uno/lbmap.cxx
@@ -129,7 +129,7 @@ struct FctPtrHash : public std::unary_function< uno_Mapping 
*, size_t >
 typedef std::unordered_map<
 OUString, MappingEntry *, OUStringHash > t_OUString2Entry;
 typedef std::unordered_map<
-uno_Mapping *, MappingEntry *, FctPtrHash, equal_to< uno_Mapping * > > 
t_Mapping2Entry;
+uno_Mapping *, MappingEntry *, FctPtrHash > t_Mapping2Entry;
 
 typedef set< uno_getMappingFunc > t_CallbackSet;
 typedef set< OUString > t_OUStringSet;
diff --git a/framework/inc/uifactory/configurationaccessfactorymanager.hxx 
b/framework/inc/uifactory/configurationaccessfactorymanager.hxx
index 24e6127..917d3d4 100644
--- a/framework/inc/uifactory/configurationaccessfactorymanager.hxx
+++ b/framework/inc/uifactory/configurationaccessfactorymanager.hxx
@@ -59,8 +59,8 @@ namespace framework {
 private:
 class FactoryManagerMap : public std::unordered_map >
+OUStringHash
+>
 {
 };
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2016-04-01 Thread Stephan Bergmann
 cppu/source/uno/lbenv.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 0de40868b49b9fc387391e2cbca1c8e910ef3bd3
Author: Stephan Bergmann 
Date:   Fri Apr 1 08:43:14 2016 +0200

loplugin:staticanonymous

Change-Id: I1a96ef6bff7a99ab46f7c88722426cba48b46c81

diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index b0eb821..2281bc1 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -52,7 +52,7 @@ namespace
 {
 
 
-inline static bool td_equals( typelib_InterfaceTypeDescription * pTD1,
+inline bool td_equals( typelib_InterfaceTypeDescription * pTD1,
   typelib_InterfaceTypeDescription * pTD2 )
 {
 return (pTD1 == pTD2 ||
@@ -830,7 +830,7 @@ namespace
 
 class theStaticOIdPart : public rtl::Static 
{};
 
-inline static const OUString & unoenv_getStaticOIdPart()
+inline const OUString & unoenv_getStaticOIdPart()
 {
 return theStaticOIdPart::get().getOIdPart();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2016-03-29 Thread Douglas Mencken
 cppu/source/uno/check.cxx |   43 ---
 1 file changed, 20 insertions(+), 23 deletions(-)

New commits:
commit 3e48e0ed7114d4a9c26c3ae5087c4f1c352a8a65
Author: Douglas Mencken 
Date:   Tue Mar 15 13:52:08 2016 -0400

uno/check.cxx: use alignment calculated at runtime instead of hardcode

Change-Id: I0f9a48ef01bee4153cd9231bdef4b5a763b6bda2
Reviewed-on: https://gerrit.libreoffice.org/23283
Tested-by: Jenkins 
Reviewed-by: Stephan Bergmann 

diff --git a/cppu/source/uno/check.cxx b/cppu/source/uno/check.cxx
index f6f47e3..620a970 100644
--- a/cppu/source/uno/check.cxx
+++ b/cppu/source/uno/check.cxx
@@ -26,17 +26,6 @@
 #include 
 #include 
 
-// Why hardcode like this instead of using the (generated)
-//  ?
-#if (defined(INTEL) \
-&& (defined(__GNUC__) && (defined(LINUX) || defined(FREEBSD) ||   \
-  defined(NETBSD) || defined(OPENBSD) ||  \
-  defined(DRAGONFLY) || defined(SOLARIS) || \
-  defined(ANDROID)) \
-|| defined(MACOSX) )) \
-|| defined(IOS)
-#define MAX_ALIGNMENT_4
-#endif
 
 namespace {
 
@@ -162,14 +151,14 @@ static_assert( static_cast(true) == sal_True,
"must be binary compatible" );
 static_assert( static_cast(false) == sal_False,
"must be binary compatible" );
-#ifdef MAX_ALIGNMENT_4
-// max alignment is 4
+#if SAL_TYPES_ALIGNMENT8 == 4
 static_assert(offsetof(AlignSize_Impl, dDouble) == 4, 
"offsetof(AlignSize_Impl, dDouble) != 4");
 static_assert(sizeof(AlignSize_Impl) == 12, "sizeof(AlignSize_Impl) != 12");
-#else
-// max alignment is 8
+#elif SAL_TYPES_ALIGNMENT8 == 8
 static_assert(offsetof(AlignSize_Impl, dDouble) == 8, 
"offsetof(AlignSize_Impl, dDouble) != 8");
 static_assert(sizeof(AlignSize_Impl) == 16, "sizeof(AlignSize_Impl) != 16");
+#else
+# error unexpected alignment of 8 byte types
 #endif
 
 // sequence
@@ -192,10 +181,12 @@ static_assert(sizeof(N) == 12, "sizeof(N) != 12");
 static_assert(sizeof(N2) == 12, "sizeof(N2) != 12");
 
 static_assert(offsetof(N2, p) == 8, "offsetof(N2, p) != 8");
-#ifdef MAX_ALIGNMENT_4
+#if SAL_TYPES_ALIGNMENT8 == 4
 static_assert(sizeof(O) == 20, "sizeof(O) != 20");
-#else
+#elif SAL_TYPES_ALIGNMENT8 == 8
 static_assert(sizeof(O) == 24, "sizeof(O) != 24");
+#else
+# error unexpected alignment of 8 byte types
 #endif
 static_assert(sizeof(D) == 8, "sizeof(D) != 8");
 static_assert(offsetof(D, e) == 4, "offsetof(D, e) != 4");
@@ -205,31 +196,35 @@ static_assert(offsetof(E, e) == 8, "offsetof(E, e) != 8");
 static_assert(sizeof(C1) == 2, "sizeof(C1) != 2");
 static_assert(sizeof(C2) == 8, "sizeof(C2) != 8");
 
-#ifdef MAX_ALIGNMENT_4
+#if SAL_TYPES_ALIGNMENT8 == 4
 static_assert(sizeof(C3) == 20, "sizeof(C3) != 20");
 static_assert(sizeof(C4) == 32, "sizeof(C4) != 32");
 static_assert(sizeof(C5) == 44, "sizeof(C5) != 44");
 static_assert(sizeof(C6) == 52, "sizeof(C6) != 52");
 
 static_assert(sizeof(O2) == 24, "sizeof(O2) != 24");
-#else
+#elif SAL_TYPES_ALIGNMENT8 == 8
 static_assert(sizeof(C3) == 24, "sizeof(C3) != 24");
 static_assert(sizeof(C4) == 40, "sizeof(C4) != 40");
 static_assert(sizeof(C5) == 56, "sizeof(C5) != 56");
 static_assert(sizeof(C6) == 72, "sizeof(C6) != 72");
 
 static_assert(sizeof(O2) == 32, "sizeof(O2) != 32");
+#else
+# error unexpected alignment of 8 byte types
 #endif
 
 static_assert(sizeof(Char3) == 3, "sizeof(Char3) != 3");
 
-#ifdef MAX_ALIGNMENT_4
+#if SAL_TYPES_ALIGNMENT8 == 4
 // max alignment is 4
 static_assert(sizeof(P) == 20, "sizeof(P) != 20");
-#else
+#elif SAL_TYPES_ALIGNMENT8 == 8
 // alignment of P is 8, because of P[] ...
 static_assert(sizeof(P) == 24, "sizeof(P) != 24");
 static_assert(sizeof(second) == sizeof(int), "sizeof(second) != sizeof(int)");
+#else
+# error unexpected alignment of 8 byte types
 #endif
 
 #if OSL_DEBUG_LEVEL > 0
@@ -247,7 +242,7 @@ BinaryCompatible_Impl::BinaryCompatible_Impl()
 
 assert(OFFSET_OF(C2, n2) == 4);
 
-#ifdef MAX_ALIGNMENT_4
+#if SAL_TYPES_ALIGNMENT8 == 4
 assert(OFFSET_OF(C3, d3) == 8);
 assert(OFFSET_OF(C3, n3) == 16);
 assert(OFFSET_OF(C4, n4) == 20);
@@ -258,7 +253,7 @@ BinaryCompatible_Impl::BinaryCompatible_Impl()
 assert(OFFSET_OF(C6, b6) == 48);
 
 assert(OFFSET_OF(O2, p2) == 20);
-#else
+#elif SAL_TYPES_ALIGNMENT8 == 8
 assert(OFFSET_OF(C3, d3) == 8);
 assert(OFFSET_OF(C3, n3) == 16);
 assert(OFFSET_OF(C4, n4) == 24);
@@ -269,6 +264,8 @@ BinaryCompatible_Impl::BinaryCompatible_Impl()
 assert(OFFSET_OF(C6, b6) == 64);
 
 assert(OFFSET_OF(O2, p2) == 24);
+#else
+# error unexpected alignment of 8 byte types
 #endif
 
 assert(OFFSET_OF(Char4, c) == 3);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2016-03-22 Thread Christian Lohmaier
 cppu/source/uno/check.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 449cededd7f20b52e6bc417cd9351bfe3230cb05
Author: Christian Lohmaier 
Date:   Tue Mar 22 14:42:34 2016 +0100

android version can also be compiled for x86

and x86 has smaller alignment than arm or a x86_64 host,
so needs the MAX_ALIGNMENT_4 to not trigger the static_asserts

Change-Id: I5643a33e4975e7bad20693f99fb8bbd5248c7c1c

diff --git a/cppu/source/uno/check.cxx b/cppu/source/uno/check.cxx
index 7fb8b36..f6f47e3 100644
--- a/cppu/source/uno/check.cxx
+++ b/cppu/source/uno/check.cxx
@@ -31,7 +31,8 @@
 #if (defined(INTEL) \
 && (defined(__GNUC__) && (defined(LINUX) || defined(FREEBSD) ||   \
   defined(NETBSD) || defined(OPENBSD) ||  \
-  defined(DRAGONFLY) || defined(SOLARIS)) \
+  defined(DRAGONFLY) || defined(SOLARIS) || \
+  defined(ANDROID)) \
 || defined(MACOSX) )) \
 || defined(IOS)
 #define MAX_ALIGNMENT_4
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source smoketest/smoketest.cxx

2016-03-22 Thread Gurkaran
 cppu/source/threadpool/threadpool.cxx |4 ++--
 smoketest/smoketest.cxx   |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit d27e3eca2cca1249a0bdd9e6385ca693d471ef9b
Author: Gurkaran 
Date:   Tue Mar 22 03:25:36 2016 +0530

tdf#84323: Make osl::Condition::wait more readable

It is to improve the readability of calls to osl::Condition::wait.

Change-Id: I5945343c5a7e4729ab599380414d18280bd176fe
Signed-off-by: Gurkaran 
Reviewed-on: https://gerrit.libreoffice.org/23417
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/cppu/source/threadpool/threadpool.cxx 
b/cppu/source/threadpool/threadpool.cxx
index 9861d97..457ff94 100644
--- a/cppu/source/threadpool/threadpool.cxx
+++ b/cppu/source/threadpool/threadpool.cxx
@@ -20,6 +20,7 @@
 #include "sal/config.h"
 
 #include 
+#include 
 #include 
 #include 
 
@@ -148,8 +149,7 @@ namespace cppu_threadpool
 }
 
 // let the thread wait 2 seconds
-TimeValue time = { 2 , 0 };
-waitingThread.condition.wait(  );
+waitingThread.condition.wait( std::chrono::seconds(2) );
 
 {
 MutexGuard guard ( m_mutexWaitingThreadList );
diff --git a/smoketest/smoketest.cxx b/smoketest/smoketest.cxx
index c4c2178..6bc2a9c 100644
--- a/smoketest/smoketest.cxx
+++ b/smoketest/smoketest.cxx
@@ -18,6 +18,7 @@
  */
 
 #include 
+#include 
 #include "boost/noncopyable.hpp"
 #include "com/sun/star/awt/AsyncCallback.hpp"
 #include "com/sun/star/awt/XCallback.hpp"
@@ -177,8 +178,7 @@ void Test::test() {
 css::uno::Any());
 // Wait for result.condition or connection_ going stale:
 for (;;) {
-TimeValue delay = { 1, 0 }; // 1 sec
-osl::Condition::Result res = result.condition.wait();
+osl::Condition::Result res = 
result.condition.wait(std::chrono::seconds(1)); // 1 sec delay
 if (res == osl::Condition::result_ok) {
 break;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2016-03-11 Thread Miklos Vajna
 cppu/source/typelib/typelib.cxx |   18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 6d42dc0e7ce90c0996a28d8ee084baa183c90457
Author: Miklos Vajna 
Date:   Fri Mar 11 11:27:10 2016 +0100

cppu: SAL_WARN_IF() -> SAL_INFO_IF() where it was dbglevel=2-specific before

As these fire already during the build.

Change-Id: I750ea04be317fffb8bc321a2b7b4da0447789c8f

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index 55ee766..e84e5ce 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -307,17 +307,17 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl()
 pWeakMap = nullptr;
 }
 #if OSL_DEBUG_LEVEL > 0
-SAL_WARN_IF( nTypeDescriptionCount, "cppu.typelib", "nTypeDescriptionCount 
is not zero" );
-SAL_WARN_IF( nCompoundTypeDescriptionCount, "cppu.typelib", 
"nCompoundTypeDescriptionCount is not zero" );
-SAL_WARN_IF( nIndirectTypeDescriptionCount, "cppu.typelib", 
"nIndirectTypeDescriptionCount is not zero" );
-SAL_WARN_IF( nEnumTypeDescriptionCount, "cppu.typelib", 
"nEnumTypeDescriptionCount is not zero" );
-SAL_WARN_IF( nInterfaceMethodTypeDescriptionCount, "cppu.typelib", 
"nInterfaceMethodTypeDescriptionCount is not zero" );
-SAL_WARN_IF( nInterfaceAttributeTypeDescriptionCount, "cppu.typelib", 
"nInterfaceAttributeTypeDescriptionCount is not zero" );
-SAL_WARN_IF( nInterfaceTypeDescriptionCount, "cppu.typelib", 
"nInterfaceTypeDescriptionCount is not zero" );
-SAL_WARN_IF( nTypeDescriptionReferenceCount, "cppu.typelib", 
"nTypeDescriptionReferenceCount is not zero" );
+SAL_INFO_IF( nTypeDescriptionCount, "cppu.typelib", "nTypeDescriptionCount 
is not zero" );
+SAL_INFO_IF( nCompoundTypeDescriptionCount, "cppu.typelib", 
"nCompoundTypeDescriptionCount is not zero" );
+SAL_INFO_IF( nIndirectTypeDescriptionCount, "cppu.typelib", 
"nIndirectTypeDescriptionCount is not zero" );
+SAL_INFO_IF( nEnumTypeDescriptionCount, "cppu.typelib", 
"nEnumTypeDescriptionCount is not zero" );
+SAL_INFO_IF( nInterfaceMethodTypeDescriptionCount, "cppu.typelib", 
"nInterfaceMethodTypeDescriptionCount is not zero" );
+SAL_INFO_IF( nInterfaceAttributeTypeDescriptionCount, "cppu.typelib", 
"nInterfaceAttributeTypeDescriptionCount is not zero" );
+SAL_INFO_IF( nInterfaceTypeDescriptionCount, "cppu.typelib", 
"nInterfaceTypeDescriptionCount is not zero" );
+SAL_INFO_IF( nTypeDescriptionReferenceCount, "cppu.typelib", 
"nTypeDescriptionReferenceCount is not zero" );
 #endif
 
-SAL_WARN_IF( pCallbacks && !pCallbacks->empty(), "cppu.typelib", 
"pCallbacks is not NULL or empty" );
+SAL_INFO_IF( pCallbacks && !pCallbacks->empty(), "cppu.typelib", 
"pCallbacks is not NULL or empty" );
 delete pCallbacks;
 pCallbacks = nullptr;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2016-03-10 Thread Julien Nabet
 cppu/source/typelib/typelib.cxx |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 05ff3d112b79202f393f9067fec4fe72f2d8ac3c
Author: Julien Nabet 
Date:   Thu Mar 10 22:05:57 2016 +0100

Let's use the iterator return by erase method of iterator list

and avoid to retrieve list->begin and loop from the first element

Change-Id: I536b7a03c4033b02a7226d25f64764c10c28bdd0
Reviewed-on: https://gerrit.libreoffice.org/23126
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index 254abd76..55ee766 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -354,12 +354,11 @@ extern "C" void SAL_CALL 
typelib_typedescription_revokeCallback(
 //  OslGuard aGuard( rInit.getMutex() );
 CallbackEntry aEntry( pContext, pCallback );
 CallbackSet_Impl::iterator iPos( rInit.pCallbacks->begin() );
-while (!(iPos == rInit.pCallbacks->end()))
+while (iPos != rInit.pCallbacks->end())
 {
 if (*iPos == aEntry)
 {
-rInit.pCallbacks->erase( iPos );
-iPos = rInit.pCallbacks->begin();
+iPos = rInit.pCallbacks->erase(iPos);
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2016-03-10 Thread Stephan Bergmann
 cppu/source/typelib/typelib.cxx |   18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 0cc4e711d3d4dd9cf512ef490fabf8395eb46d3f
Author: Stephan Bergmann 
Date:   Thu Mar 10 11:16:10 2016 +0100

Remove unnecessary parentheses

Change-Id: I6815a02ae8f47c40c3b8cf5692126142de867480

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index ed6b79f..254abd76 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -307,17 +307,17 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl()
 pWeakMap = nullptr;
 }
 #if OSL_DEBUG_LEVEL > 0
-SAL_WARN_IF( (nTypeDescriptionCount), "cppu.typelib", 
"nTypeDescriptionCount is not zero" );
-SAL_WARN_IF( (nCompoundTypeDescriptionCount), "cppu.typelib", 
"nCompoundTypeDescriptionCount is not zero" );
-SAL_WARN_IF( (nIndirectTypeDescriptionCount), "cppu.typelib", 
"nIndirectTypeDescriptionCount is not zero" );
-SAL_WARN_IF( (nEnumTypeDescriptionCount), "cppu.typelib", 
"nEnumTypeDescriptionCount is not zero" );
-SAL_WARN_IF( (nInterfaceMethodTypeDescriptionCount), "cppu.typelib", 
"nInterfaceMethodTypeDescriptionCount is not zero" );
-SAL_WARN_IF( (nInterfaceAttributeTypeDescriptionCount), "cppu.typelib", 
"nInterfaceAttributeTypeDescriptionCount is not zero" );
-SAL_WARN_IF( (nInterfaceTypeDescriptionCount), "cppu.typelib", 
"nInterfaceTypeDescriptionCount is not zero" );
-SAL_WARN_IF( (nTypeDescriptionReferenceCount), "cppu.typelib", 
"nTypeDescriptionReferenceCount is not zero" );
+SAL_WARN_IF( nTypeDescriptionCount, "cppu.typelib", "nTypeDescriptionCount 
is not zero" );
+SAL_WARN_IF( nCompoundTypeDescriptionCount, "cppu.typelib", 
"nCompoundTypeDescriptionCount is not zero" );
+SAL_WARN_IF( nIndirectTypeDescriptionCount, "cppu.typelib", 
"nIndirectTypeDescriptionCount is not zero" );
+SAL_WARN_IF( nEnumTypeDescriptionCount, "cppu.typelib", 
"nEnumTypeDescriptionCount is not zero" );
+SAL_WARN_IF( nInterfaceMethodTypeDescriptionCount, "cppu.typelib", 
"nInterfaceMethodTypeDescriptionCount is not zero" );
+SAL_WARN_IF( nInterfaceAttributeTypeDescriptionCount, "cppu.typelib", 
"nInterfaceAttributeTypeDescriptionCount is not zero" );
+SAL_WARN_IF( nInterfaceTypeDescriptionCount, "cppu.typelib", 
"nInterfaceTypeDescriptionCount is not zero" );
+SAL_WARN_IF( nTypeDescriptionReferenceCount, "cppu.typelib", 
"nTypeDescriptionReferenceCount is not zero" );
 #endif
 
-SAL_WARN_IF( (pCallbacks && !pCallbacks->empty()), "cppu.typelib", 
"pCallbacks is not NULL or empty" );
+SAL_WARN_IF( pCallbacks && !pCallbacks->empty(), "cppu.typelib", 
"pCallbacks is not NULL or empty" );
 delete pCallbacks;
 pCallbacks = nullptr;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2016-03-10 Thread rohan
 cppu/source/typelib/typelib.cxx |   18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 5c4717416b7eeaf99765725785278a7437fdaf8a
Author: rohan 
Date:   Thu Mar 10 15:38:09 2016 +0530

Fixed minor negation bug in SAL_WARN_IF

I corrected the mistake that i did while converting OSL_ENSURE to
SAL_WARN_IF while submitting a patch regarding removing OSL_DEBUG_LEVEL > 1
conditionals. Thanks to Julien Nabet :)

Change-Id: I374373bf151a43b1ababf4c28b509da71068f755
Reviewed-on: https://gerrit.libreoffice.org/23112
Reviewed-by: Stephan Bergmann 
Tested-by: Stephan Bergmann 

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index 12fe995..ed6b79f 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -307,17 +307,17 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl()
 pWeakMap = nullptr;
 }
 #if OSL_DEBUG_LEVEL > 0
-SAL_WARN_IF( (!nTypeDescriptionCount), "cppu.typelib", 
"nTypeDescriptionCount is not zero" );
-SAL_WARN_IF( (!nCompoundTypeDescriptionCount), "cppu.typelib", 
"nCompoundTypeDescriptionCount is not zero" );
-SAL_WARN_IF( (!nIndirectTypeDescriptionCount), "cppu.typelib", 
"nIndirectTypeDescriptionCount is not zero" );
-SAL_WARN_IF( (!nEnumTypeDescriptionCount), "cppu.typelib", 
"nEnumTypeDescriptionCount is not zero" );
-SAL_WARN_IF( (!nInterfaceMethodTypeDescriptionCount), "cppu.typelib", 
"nInterfaceMethodTypeDescriptionCount is not zero" );
-SAL_WARN_IF( (!nInterfaceAttributeTypeDescriptionCount), "cppu.typelib", 
"nInterfaceAttributeTypeDescriptionCount is not zero" );
-SAL_WARN_IF( (!nInterfaceTypeDescriptionCount), "cppu.typelib", 
"nInterfaceTypeDescriptionCount is not zero" );
-SAL_WARN_IF( (!nTypeDescriptionReferenceCount), "cppu.typelib", 
"nTypeDescriptionReferenceCount is not zero" );
+SAL_WARN_IF( (nTypeDescriptionCount), "cppu.typelib", 
"nTypeDescriptionCount is not zero" );
+SAL_WARN_IF( (nCompoundTypeDescriptionCount), "cppu.typelib", 
"nCompoundTypeDescriptionCount is not zero" );
+SAL_WARN_IF( (nIndirectTypeDescriptionCount), "cppu.typelib", 
"nIndirectTypeDescriptionCount is not zero" );
+SAL_WARN_IF( (nEnumTypeDescriptionCount), "cppu.typelib", 
"nEnumTypeDescriptionCount is not zero" );
+SAL_WARN_IF( (nInterfaceMethodTypeDescriptionCount), "cppu.typelib", 
"nInterfaceMethodTypeDescriptionCount is not zero" );
+SAL_WARN_IF( (nInterfaceAttributeTypeDescriptionCount), "cppu.typelib", 
"nInterfaceAttributeTypeDescriptionCount is not zero" );
+SAL_WARN_IF( (nInterfaceTypeDescriptionCount), "cppu.typelib", 
"nInterfaceTypeDescriptionCount is not zero" );
+SAL_WARN_IF( (nTypeDescriptionReferenceCount), "cppu.typelib", 
"nTypeDescriptionReferenceCount is not zero" );
 #endif
 
-SAL_WARN_IF( (!pCallbacks || pCallbacks->empty()), "cppu.typelib", 
"pCallbacks is not NULL or empty" );
+SAL_WARN_IF( (pCallbacks && !pCallbacks->empty()), "cppu.typelib", 
"pCallbacks is not NULL or empty" );
 delete pCallbacks;
 pCallbacks = nullptr;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2016-03-09 Thread Stephan Bergmann
 cppu/source/uno/check.cxx |   46 +++---
 1 file changed, 23 insertions(+), 23 deletions(-)

New commits:
commit 50bf3061e6645125ef4355f214dd35656012048b
Author: Stephan Bergmann 
Date:   Wed Mar 9 09:26:37 2016 +0100

typo

Change-Id: Id990e76769c3b5e2e048f3faf754efbae2b41c3f

diff --git a/cppu/source/uno/check.cxx b/cppu/source/uno/check.cxx
index 7b1a6dc..7fb8b36 100644
--- a/cppu/source/uno/check.cxx
+++ b/cppu/source/uno/check.cxx
@@ -242,35 +242,35 @@ public:
 };
 BinaryCompatible_Impl::BinaryCompatible_Impl()
 {
-assert(OFFSET_OF(N, p) != 8);
+assert(OFFSET_OF(N, p) == 8);
 
-assert(OFFSET_OF(C2, n2) != 4);
+assert(OFFSET_OF(C2, n2) == 4);
 
 #ifdef MAX_ALIGNMENT_4
-assert(OFFSET_OF(C3, d3) != 8);
-assert(OFFSET_OF(C3, n3) != 16);
-assert(OFFSET_OF(C4, n4) != 20);
-assert(OFFSET_OF(C4, d4) != 24);
-assert(OFFSET_OF(C5, n5) != 32);
-assert(OFFSET_OF(C5, b5) != 40);
-assert(OFFSET_OF(C6, c6) != 4);
-assert(OFFSET_OF(C6, b6) != 48);
-
-assert(OFFSET_OF(O2, p2) != 20);
+assert(OFFSET_OF(C3, d3) == 8);
+assert(OFFSET_OF(C3, n3) == 16);
+assert(OFFSET_OF(C4, n4) == 20);
+assert(OFFSET_OF(C4, d4) == 24);
+assert(OFFSET_OF(C5, n5) == 32);
+assert(OFFSET_OF(C5, b5) == 40);
+assert(OFFSET_OF(C6, c6) == 4);
+assert(OFFSET_OF(C6, b6) == 48);
+
+assert(OFFSET_OF(O2, p2) == 20);
 #else
-assert(OFFSET_OF(C3, d3) != 8);
-assert(OFFSET_OF(C3, n3) != 16);
-assert(OFFSET_OF(C4, n4) != 24);
-assert(OFFSET_OF(C4, d4) != 32);
-assert(OFFSET_OF(C5, n5) != 40);
-assert(OFFSET_OF(C5, b5) != 48);
-assert(OFFSET_OF(C6, c6) != 8);
-assert(OFFSET_OF(C6, b6) != 64);
-
-assert(OFFSET_OF(O2, p2) != 24);
+assert(OFFSET_OF(C3, d3) == 8);
+assert(OFFSET_OF(C3, n3) == 16);
+assert(OFFSET_OF(C4, n4) == 24);
+assert(OFFSET_OF(C4, d4) == 32);
+assert(OFFSET_OF(C5, n5) == 40);
+assert(OFFSET_OF(C5, b5) == 48);
+assert(OFFSET_OF(C6, c6) == 8);
+assert(OFFSET_OF(C6, b6) == 64);
+
+assert(OFFSET_OF(O2, p2) == 24);
 #endif
 
-assert(OFFSET_OF(Char4, c) != 3);
+assert(OFFSET_OF(Char4, c) == 3);
 }
 
 static BinaryCompatible_Impl aTest;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2016-03-09 Thread Stephan Bergmann
 cppu/source/uno/check.cxx |   56 +++---
 1 file changed, 24 insertions(+), 32 deletions(-)

New commits:
commit 524ae3589c35e4e153d9644da97180668bfbed36
Author: Stephan Bergmann 
Date:   Wed Mar 9 09:17:23 2016 +0100

Use plain assert (to complement use of static_assert above)

Change-Id: Id4ac9e86a6af3fa84f7a9680051dfe2564f8c5c5

diff --git a/cppu/source/uno/check.cxx b/cppu/source/uno/check.cxx
index 9dd892b..7b1a6dc 100644
--- a/cppu/source/uno/check.cxx
+++ b/cppu/source/uno/check.cxx
@@ -19,7 +19,7 @@
 
 #include 
 
-#include 
+#include 
 
 #include 
 #include 
@@ -235,14 +235,6 @@ static_assert(sizeof(second) == sizeof(int), 
"sizeof(second) != sizeof(int)");
 
 #define OFFSET_OF( s, m ) reinterpret_cast< size_t >(reinterpret_cast(_cast(16)->m) -16)
 
-#define BINTEST_VERIFYOFFSET( s, m, n ) \
-if (OFFSET_OF(s, m) != static_cast(n))  \
-{   \
-fprintf(stderr, "### OFFSET_OF(" #s ", "  #m ") = %" SAL_PRI_SIZET "u 
instead of expected %" SAL_PRI_SIZET "u!!!\n", \
-OFFSET_OF(s, m), static_cast(n));\
-abort();\
-}
-
 class BinaryCompatible_Impl
 {
 public:
@@ -250,35 +242,35 @@ public:
 };
 BinaryCompatible_Impl::BinaryCompatible_Impl()
 {
-BINTEST_VERIFYOFFSET(N, p, 8);
+assert(OFFSET_OF(N, p) != 8);
 
-BINTEST_VERIFYOFFSET(C2, n2, 4);
+assert(OFFSET_OF(C2, n2) != 4);
 
 #ifdef MAX_ALIGNMENT_4
-BINTEST_VERIFYOFFSET(C3, d3, 8);
-BINTEST_VERIFYOFFSET(C3, n3, 16);
-BINTEST_VERIFYOFFSET(C4, n4, 20);
-BINTEST_VERIFYOFFSET(C4, d4, 24);
-BINTEST_VERIFYOFFSET(C5, n5, 32);
-BINTEST_VERIFYOFFSET(C5, b5, 40);
-BINTEST_VERIFYOFFSET(C6, c6, 4);
-BINTEST_VERIFYOFFSET(C6, b6, 48);
-
-BINTEST_VERIFYOFFSET(O2, p2, 20);
+assert(OFFSET_OF(C3, d3) != 8);
+assert(OFFSET_OF(C3, n3) != 16);
+assert(OFFSET_OF(C4, n4) != 20);
+assert(OFFSET_OF(C4, d4) != 24);
+assert(OFFSET_OF(C5, n5) != 32);
+assert(OFFSET_OF(C5, b5) != 40);
+assert(OFFSET_OF(C6, c6) != 4);
+assert(OFFSET_OF(C6, b6) != 48);
+
+assert(OFFSET_OF(O2, p2) != 20);
 #else
-BINTEST_VERIFYOFFSET(C3, d3, 8);
-BINTEST_VERIFYOFFSET(C3, n3, 16);
-BINTEST_VERIFYOFFSET(C4, n4, 24);
-BINTEST_VERIFYOFFSET(C4, d4, 32);
-BINTEST_VERIFYOFFSET(C5, n5, 40);
-BINTEST_VERIFYOFFSET(C5, b5, 48);
-BINTEST_VERIFYOFFSET(C6, c6, 8);
-BINTEST_VERIFYOFFSET(C6, b6, 64);
-
-BINTEST_VERIFYOFFSET(O2, p2, 24);
+assert(OFFSET_OF(C3, d3) != 8);
+assert(OFFSET_OF(C3, n3) != 16);
+assert(OFFSET_OF(C4, n4) != 24);
+assert(OFFSET_OF(C4, d4) != 32);
+assert(OFFSET_OF(C5, n5) != 40);
+assert(OFFSET_OF(C5, b5) != 48);
+assert(OFFSET_OF(C6, c6) != 8);
+assert(OFFSET_OF(C6, b6) != 64);
+
+assert(OFFSET_OF(O2, p2) != 24);
 #endif
 
-BINTEST_VERIFYOFFSET( Char4, c, 3 );
+assert(OFFSET_OF(Char4, c) != 3);
 }
 
 static BinaryCompatible_Impl aTest;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2016-03-08 Thread Stephan Bergmann
 cppu/source/uno/data.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c94f5b026010de00504b19015d0454ca19966da2
Author: Stephan Bergmann 
Date:   Tue Mar 8 18:16:18 2016 +0100

loplugin:cstylecast

Change-Id: I3771f84ec94c62988c075dd26ee1de17200af705

diff --git a/cppu/source/uno/data.cxx b/cppu/source/uno/data.cxx
index 9a33a2a..d0d22f6 100644
--- a/cppu/source/uno/data.cxx
+++ b/cppu/source/uno/data.cxx
@@ -340,7 +340,7 @@ namespace cppu {
 #define MAX_ALIGNMENT_4
 #endif
 
-#define OFFSET_OF( s, m ) reinterpret_cast< size_t >((char *)&((s *)16)->m -16)
+#define OFFSET_OF( s, m ) reinterpret_cast< size_t >(reinterpret_cast(_cast(16)->m) -16)
 
 #define BINTEST_VERIFYOFFSET( s, m, n ) \
 if (OFFSET_OF(s, m) != static_cast(n))  \
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2016-03-08 Thread Stephan Bergmann
 cppu/source/uno/data.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit c2fe73d6a976e5a9131ff4aa04e7b5cea674ef19
Author: Stephan Bergmann 
Date:   Tue Mar 8 18:15:52 2016 +0100

Remove redundant checks (that trigger loplugin:implicitboolconversion])

Change-Id: I86c0b56b7d330e3e3450a5806a89ca8fb7a1bfae

diff --git a/cppu/source/uno/data.cxx b/cppu/source/uno/data.cxx
index 088f176..9a33a2a 100644
--- a/cppu/source/uno/data.cxx
+++ b/cppu/source/uno/data.cxx
@@ -468,10 +468,10 @@ public:
 };
 BinaryCompatible_Impl::BinaryCompatible_Impl()
 {
-static_assert( ((sal_Bool) true) == sal_True &&
- (1 != 0) == sal_True, "must be binary compatible" );
-static_assert( ((sal_Bool) false) == sal_False &&
- (1 == 0) == sal_False, "must be binary compatible" );
+static_assert( static_cast(true) == sal_True,
+   "must be binary compatible" );
+static_assert( static_cast(false) == sal_False,
+   "must be binary compatible" );
 #ifdef MAX_ALIGNMENT_4
 // max alignment is 4
 static_assert(offsetof(AlignSize_Impl, dDouble) == 4, 
"offsetof(AlignSize_Impl, dDouble) != 4");
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source include/sal

2016-03-08 Thread Rohan Kumar
 cppu/source/threadpool/thread.cxx |8 --
 cppu/source/typelib/typelib.cxx   |   73 +++---
 cppu/source/uno/data.cxx  |  147 --
 cppu/source/uno/lbenv.cxx |7 -
 cppu/source/uno/prim.hxx  |6 -
 include/sal/log-areas.dox |1 
 6 files changed, 96 insertions(+), 146 deletions(-)

New commits:
commit 05bca569232d0ece0c6700513b7b1351238c85ec
Author: Rohan Kumar 
Date:   Tue Mar 8 22:22:16 2016 +0530

tdf#91794: Remove OSL_DEBUG_LEVEL > 1 conditionals

Updates pointed by sberg

Change-Id: Ie12548dfa9ad3a6836efbfe64153bc075f138fc6
Reviewed-on: https://gerrit.libreoffice.org/22622
Reviewed-by: Stephan Bergmann 
Tested-by: Stephan Bergmann 

diff --git a/cppu/source/threadpool/thread.cxx 
b/cppu/source/threadpool/thread.cxx
index 3b95c8d..06fd30d 100644
--- a/cppu/source/threadpool/thread.cxx
+++ b/cppu/source/threadpool/thread.cxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "thread.hxx"
 #include "jobqueue.hxx"
@@ -38,12 +39,7 @@ namespace cppu_threadpool {
 
 ThreadAdmin::~ThreadAdmin()
 {
-#if OSL_DEBUG_LEVEL > 1
-if( m_lst.size() )
-{
-fprintf( stderr, "%lu Threads left\n" , static_cast(m_lst.size()) );
-}
-#endif
+SAL_WARN_IF(m_lst.size(), "cppu.threadpool", m_lst.size() << "Threads 
left");
 }
 
 bool ThreadAdmin::add( rtl::Reference< ORequestThread > const & p )
diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index f873b75..12fe995 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -18,10 +18,6 @@
  */
 
 
-#if OSL_DEBUG_LEVEL > 1
-#include 
-#endif
-
 #include 
 #include 
 #include 
@@ -188,7 +184,7 @@ struct TypeDescriptor_Init_Impl
 
 inline void callChain( typelib_TypeDescription ** ppRet, rtl_uString * 
pName );
 
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
 // only for debugging
 sal_Int32   nTypeDescriptionCount;
 sal_Int32   nCompoundTypeDescriptionCount;
@@ -202,7 +198,7 @@ struct TypeDescriptor_Init_Impl
 
 TypeDescriptor_Init_Impl():
 pWeakMap(nullptr), pCallbacks(nullptr), pCache(nullptr), 
pMutex(nullptr)
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
 , nTypeDescriptionCount(0), nCompoundTypeDescriptionCount(0),
 nIndirectTypeDescriptionCount(0),
 nEnumTypeDescriptionCount(0),
@@ -290,41 +286,38 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl()
 typelib_typedescriptionreference_release( pTDR );
 }
 
-#if OSL_DEBUG_LEVEL > 1
 aIt = pWeakMap->begin();
+#if defined SAL_LOG_INFO
 while( aIt != pWeakMap->end() )
 {
 typelib_TypeDescriptionReference * pTDR = (*aIt).second;
 if (pTDR)
 {
 OString aTypeName( rtl::OUStringToOString( pTDR->pTypeName, 
RTL_TEXTENCODING_ASCII_US ) );
-OSL_TRACE(
-"### remaining type: %s; ref count = %d", 
aTypeName.getStr(), pTDR->nRefCount );
+SAL_INFO("cppu.typelib", "remaining type: " << aTypeName << "; 
ref count = " << pTDR->nRefCount);
 }
 else
 {
-OSL_TRACE( "### remaining null type entry!?" );
+SAL_INFO("cppu.typelib", "remaining null type entry!?");
 }
 ++aIt;
 }
 #endif
-
 delete pWeakMap;
 pWeakMap = nullptr;
 }
-#if OSL_DEBUG_LEVEL > 1
-OSL_ENSURE( !nTypeDescriptionCount, "### nTypeDescriptionCount is not 
zero" );
-OSL_ENSURE( !nCompoundTypeDescriptionCount, "### 
nCompoundTypeDescriptionCount is not zero" );
-OSL_ENSURE( !nIndirectTypeDescriptionCount, "### 
nIndirectTypeDescriptionCount is not zero" );
-OSL_ENSURE( !nEnumTypeDescriptionCount, "### nEnumTypeDescriptionCount is 
not zero" );
-OSL_ENSURE( !nInterfaceMethodTypeDescriptionCount, "### 
nInterfaceMethodTypeDescriptionCount is not zero" );
-OSL_ENSURE( !nInterfaceAttributeTypeDescriptionCount, "### 
nInterfaceAttributeTypeDescriptionCount is not zero" );
-OSL_ENSURE( !nInterfaceTypeDescriptionCount, "### 
nInterfaceTypeDescriptionCount is not zero" );
-OSL_ENSURE( !nTypeDescriptionReferenceCount, "### 
nTypeDescriptionReferenceCount is not zero" );
-
-OSL_ENSURE( !pCallbacks || pCallbacks->empty(), "### pCallbacks is not 
NULL or empty" );
+#if OSL_DEBUG_LEVEL > 0
+SAL_WARN_IF( (!nTypeDescriptionCount), "cppu.typelib", 
"nTypeDescriptionCount is not zero" );
+SAL_WARN_IF( (!nCompoundTypeDescriptionCount), "cppu.typelib", 
"nCompoundTypeDescriptionCount is not zero" );
+SAL_WARN_IF( (!nIndirectTypeDescriptionCount), "cppu.typelib", 
"nIndirectTypeDescriptionCount is not zero" );
+SAL_WARN_IF( (!nEnumTypeDescriptionCount), "cppu.typelib", 

[Libreoffice-commits] core.git: cppu/source

2016-02-21 Thread Norbert Thiebaud
 cppu/source/uno/destr.hxx |2 +-
 cppu/source/uno/prim.hxx  |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 369b33903ac1870275af07451e7377ef057e1276
Author: Norbert Thiebaud 
Date:   Sun Feb 21 08:24:49 2016 -0800

WaE 0xdeadbeaf 32 bits litteral casting to 64 bits pointer

Change-Id: I9769a1d9707cc958329f1c05ccbed780983faf14
Reviewed-on: https://gerrit.libreoffice.org/22600
Tested-by: Jenkins 
Reviewed-by: Norbert Thiebaud 

diff --git a/cppu/source/uno/destr.hxx b/cppu/source/uno/destr.hxx
index 299cca3..5806208 100644
--- a/cppu/source/uno/destr.hxx
+++ b/cppu/source/uno/destr.hxx
@@ -132,7 +132,7 @@ inline void _destructAny(
 break;
 }
 #if OSL_DEBUG_LEVEL > 0
-pAny->pData = reinterpret_cast(0xdeadbeef);
+pAny->pData = reinterpret_cast((uintptr_t)0xdeadbeef);
 #endif
 
 ::typelib_typedescriptionreference_release( pType );
diff --git a/cppu/source/uno/prim.hxx b/cppu/source/uno/prim.hxx
index cf66016..03bae2a 100644
--- a/cppu/source/uno/prim.hxx
+++ b/cppu/source/uno/prim.hxx
@@ -133,7 +133,7 @@ inline typelib_TypeDescriptionReference * _getVoidType()
 inline void CONSTRUCT_EMPTY_ANY(uno_Any * pAny) {
 pAny->pType = _getVoidType();
 #if OSL_DEBUG_LEVEL > 0
-pAny->pData = reinterpret_cast(0xdeadbeef);
+pAny->pData = reinterpret_cast((uintptr_t)0xdeadbeef);
 #else
 pAny->pData = pAny;
 #endif
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source cui/source dbaccess/source

2016-02-14 Thread Arnold Dumas
 cppu/source/uno/lbenv.cxx  |5 +
 cui/source/options/optjava.cxx |   11 +--
 dbaccess/source/ext/macromigration/migrationengine.cxx |2 +-
 3 files changed, 7 insertions(+), 11 deletions(-)

New commits:
commit 53bf3ea58e0f4f9f4399a44bfc9ddecc71cb54c7
Author: Arnold Dumas 
Date:   Sun Feb 14 00:59:35 2016 +0100

tdf#57950: Replace chained O(U)StringBuffer::append() with operator+

Change-Id: Ic76cf0130ebec4cf723b83d82f59ae45bfcb3ea1
Reviewed-on: https://gerrit.libreoffice.org/22350
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index b9e964da..c5cdaa5 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -1108,10 +1108,7 @@ static uno_Environment * initDefaultEnvironment(
 else
 {
 // late init with some code from matching uno language binding
-::rtl::OUStringBuffer aLibName( 16 );
-aLibName.append( envTypeName );
-aLibName.append( "_uno" );
-OUString aStr( aLibName.makeStringAndClear() );
+OUString aStr( envTypeName + "_uno" );
 
 if (!loadEnv(aStr, pEnv))
 {
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index 4bcdeab..3f178ac 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -167,12 +167,11 @@ SvxJavaOptionsPage::SvxJavaOptionsPage( vcl::Window* 
pParent, const SfxItemSet&
 
 m_pJavaList->SvSimpleTable::SetTabs( aStaticTabs );
 
-OUStringBuffer sHeader;
-sHeader.append("\t").append(get("vendor")->GetText())
-.append("\t").append(get("version")->GetText())
-.append("\t").append(get("features")->GetText())
-.append("\t");
-m_pJavaList->InsertHeaderEntry(sHeader.makeStringAndClear(), 
HEADERBAR_APPEND, HeaderBarItemBits::LEFT);
+OUString sHeader ( "\t" + get("vendor")->GetText() +
+"\t" + get("version")->GetText() +
+"\t" + get("features")->GetText() +
+"\t" );
+m_pJavaList->InsertHeaderEntry(sHeader, HEADERBAR_APPEND, 
HeaderBarItemBits::LEFT);
 m_pJavaList->setColSizes();
 
 m_pJavaEnableCB->SetClickHdl( LINK( this, SvxJavaOptionsPage, 
EnableHdl_Impl ) );
diff --git a/dbaccess/source/ext/macromigration/migrationengine.cxx 
b/dbaccess/source/ext/macromigration/migrationengine.cxx
index 2aa941c..94dd12c 100644
--- a/dbaccess/source/ext/macromigration/migrationengine.cxx
+++ b/dbaccess/source/ext/macromigration/migrationengine.cxx
@@ -991,7 +991,7 @@ namespace dbmm
 {
 const OUString sHierarhicalBase(
 _rContainerLoc.isEmpty() ? OUString() :
-   OUStringBuffer( _rContainerLoc 
).append( "/" ).makeStringAndClear());
+   OUString( _rContainerLoc +  "/" ) );
 
 Sequence< OUString > aElementNames( 
_rxContainer->getElementNames() );
 for (   const OUString* elementName = 
aElementNames.getConstArray();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2016-01-03 Thread Andrzej Hunt
 cppu/source/typelib/typelib.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 4a8c0d313540bd78c9c381edd548b976c580ca9a
Author: Andrzej Hunt 
Date:   Sun Jan 3 17:37:35 2016 -0800

loplugin:implicitboolconversion

Change-Id: I2ef26c34a424e653d85597c85baa736c19004313

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index e105bfe..760f996 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -383,10 +383,10 @@ static inline void typelib_typedescription_initTables(
 {
 typelib_InterfaceTypeDescription * pITD = 
reinterpret_cast(pTD);
 
-std::vector aReadWriteAttributes(pITD->nAllMembers);
+std::vector aReadWriteAttributes(pITD->nAllMembers);
 for ( sal_Int32 i = pITD->nAllMembers; i--; )
 {
-aReadWriteAttributes[i] = sal_False;
+aReadWriteAttributes[i] = false;
 if( typelib_TypeClass_INTERFACE_ATTRIBUTE == 
pITD->ppAllMembers[i]->eTypeClass )
 {
 typelib_TypeDescription * pM = nullptr;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2015-11-09 Thread jan iversen
 cppu/source/uno/lbenv.cxx |   12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 5ff684477d7cb67a52223d555ae5f1341c6f8517
Author: jan iversen 
Date:   Mon Nov 9 19:13:57 2015 +0100

cid#1338242 cid#1338241 removed throw from extern "C" function

Encapsulated throw from C++ to a return false in the "C" function

Change-Id: I2fc89b0dcf434395859300b3d3890247d1288295
Reviewed-on: https://gerrit.libreoffice.org/19872
Tested-by: Jenkins 
Reviewed-by: Norbert Thiebaud 

diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index d036212..e1d294f 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -1050,10 +1050,16 @@ static bool loadEnv(OUString const  & cLibStem,
 // late init with some code from matching uno language binding
 // will be unloaded by environment
 osl::Module aMod;
-bool bMod = cppu::detail::loadModule(aMod, cLibStem);
-
-if (!bMod)
+try {
+bool bMod = cppu::detail::loadModule(aMod, cLibStem);
+if (!bMod)
+return false;
+}
+catch(...) {
+// Catch everything and convert to return false
 return false;
+}
+
 
 uno_initEnvironmentFunc fpInit = 
reinterpret_cast(aMod.getSymbol(UNO_INIT_ENVIRONMENT));
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2015-11-09 Thread jan iversen
 cppu/source/uno/lbmap.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 6a2440ea91bb86cba74ecbb8afd520c8afa41ded
Author: jan iversen 
Date:   Mon Nov 9 19:30:30 2015 +0100

cid#1338241 removed throw from C function.

Lower level C++ make a throw, this cannot be passed
back in a C function.

Change-Id: I54ace0284d0291d54f53b8947e9f4ffc2e0a56ab
Reviewed-on: https://gerrit.libreoffice.org/19873
Tested-by: Jenkins 
Reviewed-by: Norbert Thiebaud 

diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx
index 51e1c26..82060fd 100644
--- a/cppu/source/uno/lbmap.cxx
+++ b/cppu/source/uno/lbmap.cxx
@@ -350,7 +350,14 @@ static inline bool loadModule(osl::Module & rModule, const 
OUString & rBridgeNam
 
 if (!bNeg)
 {
-bool bModule = cppu::detail::loadModule(rModule, rBridgeName);
+bool bModule;
+try {
+bModule = cppu::detail::loadModule(rModule, rBridgeName);
+}
+catch(...) {
+// convert throw to return false
+bModule = false;
+}
 
 if (bModule)
 return true;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2015-11-02 Thread Stephan Bergmann
 cppu/source/typelib/typelib.cxx |   31 ---
 1 file changed, 20 insertions(+), 11 deletions(-)

New commits:
commit f570f837d65c9ee79a10be823c3dc28febdebfc8
Author: Stephan Bergmann 
Date:   Mon Nov 2 10:50:24 2015 +0100

Avoid ASan new-delete-type-mismatch with -fsized-deallocation

...where "subclasses" of typelib_TypeDescription are deleted non-
polymorphically

Change-Id: I708d245e12d2e2159e9df60b61d1b37801083651

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index 238b4da..2c274bd 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -449,6 +449,14 @@ static inline void typelib_typedescription_initTables(
 
 namespace {
 
+template T * allocTypeDescription() {
+return reinterpret_cast(new char[sizeof (T)]);
+}
+
+void freeTypeDescription(typelib_TypeDescription const * desc) {
+delete[] reinterpret_cast(desc);
+}
+
 // In some situations (notably typelib_typedescription_newInterfaceMethod and
 // typelib_typedescription_newInterfaceAttribute), only the members nMembers,
 // ppMembers, nAllMembers, and ppAllMembers of an incomplete interface type
@@ -568,7 +576,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty(
 {
 case typelib_TypeClass_SEQUENCE:
 {
-typelib_IndirectTypeDescription * pTmp = new 
typelib_IndirectTypeDescription();
+auto pTmp = 
allocTypeDescription();
 pRet = >aBase;
 #if OSL_DEBUG_LEVEL > 1
 osl_atomic_increment( ::get().nIndirectTypeDescriptionCount );
@@ -580,8 +588,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty(
 case typelib_TypeClass_STRUCT:
 {
 // FEATURE_EMPTYCLASS
-typelib_StructTypeDescription * pTmp;
-pTmp = new typelib_StructTypeDescription();
+auto pTmp = allocTypeDescription();
 pRet = >aBase.aBase;
 #if OSL_DEBUG_LEVEL > 1
 osl_atomic_increment( ::get().nCompoundTypeDescriptionCount );
@@ -598,8 +605,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty(
 case typelib_TypeClass_EXCEPTION:
 {
 // FEATURE_EMPTYCLASS
-typelib_CompoundTypeDescription * pTmp;
-pTmp = new typelib_CompoundTypeDescription();
+auto pTmp = 
allocTypeDescription();
 pRet = >aBase;
 #if OSL_DEBUG_LEVEL > 1
 osl_atomic_increment( ::get().nCompoundTypeDescriptionCount );
@@ -614,7 +620,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty(
 
 case typelib_TypeClass_ENUM:
 {
-typelib_EnumTypeDescription * pTmp = new 
typelib_EnumTypeDescription();
+auto pTmp = allocTypeDescription();
 pRet = >aBase;
 #if OSL_DEBUG_LEVEL > 1
 osl_atomic_increment( ::get().nEnumTypeDescriptionCount );
@@ -628,7 +634,8 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty(
 
 case typelib_TypeClass_INTERFACE:
 {
-typelib_InterfaceTypeDescription * pTmp = new 
typelib_InterfaceTypeDescription();
+auto pTmp = allocTypeDescription<
+typelib_InterfaceTypeDescription>();
 pRet = >aBase;
 #if OSL_DEBUG_LEVEL > 1
 osl_atomic_increment( ::get().nInterfaceTypeDescriptionCount 
);
@@ -648,7 +655,8 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty(
 
 case typelib_TypeClass_INTERFACE_METHOD:
 {
-typelib_InterfaceMethodTypeDescription * pTmp = new 
typelib_InterfaceMethodTypeDescription();
+auto pTmp = allocTypeDescription<
+typelib_InterfaceMethodTypeDescription>();
 pRet = >aBase.aBase;
 #if OSL_DEBUG_LEVEL > 1
 osl_atomic_increment( 
::get().nInterfaceMethodTypeDescriptionCount );
@@ -667,7 +675,8 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty(
 
 case typelib_TypeClass_INTERFACE_ATTRIBUTE:
 {
-typelib_InterfaceAttributeTypeDescription * pTmp = new 
typelib_InterfaceAttributeTypeDescription();
+auto * pTmp = allocTypeDescription<
+typelib_InterfaceAttributeTypeDescription>();
 pRet = >aBase.aBase;
 #if OSL_DEBUG_LEVEL > 1
 osl_atomic_increment( 
::get().nInterfaceAttributeTypeDescriptionCount );
@@ -686,7 +695,7 @@ extern "C" void SAL_CALL typelib_typedescription_newEmpty(
 
 default:
 {
-pRet = new typelib_TypeDescription();
+pRet = allocTypeDescription();
 #if OSL_DEBUG_LEVEL > 1
 osl_atomic_increment( ::get().nTypeDescriptionCount );
 #endif
@@ -1462,7 +1471,7 @@ extern "C" void SAL_CALL typelib_typedescription_release(
 }
 #endif
 
-delete pTD;
+freeTypeDescription(pTD);
 }
 }
 
___
Libreoffice-commits mailing list

[Libreoffice-commits] core.git: cppu/source

2015-07-08 Thread Stephan Bergmann
 cppu/source/uno/prim.hxx |   13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

New commits:
commit 81275d4725236b0c7fe9e724299dd67eeb203c99
Author: Stephan Bergmann sberg...@redhat.com
Date:   Wed Jul 8 20:56:19 2015 +0200

Avoid loplugin:redundantcast in non-debug build

Change-Id: Ib5f57ba5154c56b89ab550aef5a87ee27539ddd9

diff --git a/cppu/source/uno/prim.hxx b/cppu/source/uno/prim.hxx
index d168fe8..3fcdb13 100644
--- a/cppu/source/uno/prim.hxx
+++ b/cppu/source/uno/prim.hxx
@@ -130,17 +130,14 @@ inline typelib_TypeDescriptionReference * _getVoidType()
 return g_pVoidType;
 }
 
-
+inline void CONSTRUCT_EMPTY_ANY(uno_Any * pAny) {
+pAny-pType = _getVoidType();
 #if OSL_DEBUG_LEVEL  0
-#define CONSTRUCT_EMPTY_ANY( pAny ) \
-(pAny)-pType = _getVoidType(); \
-(pAny)-pData = reinterpret_castvoid *(0xdeadbeef);
+pAny-pData = reinterpret_castvoid *(0xdeadbeef);
 #else
-#define CONSTRUCT_EMPTY_ANY( pAny ) \
-(pAny)-pType = _getVoidType(); \
-(pAny)-pData = (pAny);
+pAny-pData = pAny;
 #endif
-
+}
 
 #define TYPE_ACQUIRE( pType ) \
 osl_atomic_increment( (pType)-nRefCount );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2015-01-08 Thread Caolán McNamara
 cppu/source/uno/lbenv.cxx  |   13 ++---
 cppu/source/uno/lbmap.cxx  |   33 +
 cppu/source/uno/loadmodule.cxx |6 +++---
 cppu/source/uno/loadmodule.hxx |7 +++
 4 files changed, 29 insertions(+), 30 deletions(-)

New commits:
commit 900a2996c47a6fd32abf324db17bf1526894da36
Author: Caolán McNamara caol...@redhat.com
Date:   Wed Jan 7 21:04:04 2015 +

coverity#1261762 Resource leak

still leaks the handle of course, but c++izes the code and hides
the leak from coverity as a side-effect

Change-Id: Ieaab1545a98da1d699df93d020f0cb452ddf2516

diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index e8fa57d..721005d 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -1055,20 +1055,19 @@ static bool loadEnv(OUString const   cLibStem,
 #else
 // late init with some code from matching uno language binding
 // will be unloaded by environment
-oslModule hMod = cppu::detail::loadModule( cLibStem );
+osl::Module aMod;
+bool bMod = cppu::detail::loadModule(aMod, cLibStem);
 
-if (!hMod)
+if (!bMod)
 return false;
 
 OUString aSymbolName(UNO_INIT_ENVIRONMENT);
-uno_initEnvironmentFunc fpInit = (uno_initEnvironmentFunc)
-::osl_getFunctionSymbol( hMod, aSymbolName.pData );
+uno_initEnvironmentFunc fpInit = 
(uno_initEnvironmentFunc)aMod.getSymbol(aSymbolName);
 
 if (!fpInit)
-{
-::osl_unloadModule( hMod );
 return false;
-}
+
+aMod.release();
 #endif
 
 (*fpInit)( pEnv ); // init of environment
diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx
index a887f89..0313022 100644
--- a/cppu/source/uno/lbmap.cxx
+++ b/cppu/source/uno/lbmap.cxx
@@ -337,7 +337,7 @@ static uno_ext_getMappingFunc selectMapFunc( const OUString 
 rBridgeName )
 
 #else
 
-static inline oslModule loadModule( const OUString  rBridgeName )
+static inline bool loadModule(osl::Module  rModule, const OUString  
rBridgeName)
 {
 bool bNeg;
 {
@@ -347,16 +347,16 @@ static inline oslModule loadModule( const OUString  
rBridgeName )
 bNeg = (iFind != rData.aNegativeLibs.end());
 }
 
-if (! bNeg)
+if (!bNeg)
 {
-oslModule hModule = cppu::detail::loadModule( rBridgeName );
+bool bModule = cppu::detail::loadModule(rModule, rBridgeName);
 
-if (hModule)
-return hModule;
+if (bModule)
+return true;
 
 setNegativeBridge( rBridgeName ); // no load again
 }
-return 0;
+return false;
 }
 
 #endif
@@ -406,22 +406,22 @@ static Mapping loadExternalMapping(
 }
 #else
 // find proper lib
-oslModule hModule = 0;
+osl::Module aModule;
+bool bModule;
 OUString aName;
 
 if ( EnvDcp::getTypeName(rFrom.getTypeName()) == UNO_LB_UNO )
-hModule = loadModule( aName = getBridgeName( rTo, rFrom, 
rAddPurpose ) );
-if (! hModule)
-hModule = loadModule( aName = getBridgeName( rFrom, rTo, 
rAddPurpose ) );
-if (! hModule)
-hModule = loadModule( aName = getBridgeName( rTo, rFrom, 
rAddPurpose ) );
+bModule = loadModule( aModule, aName = getBridgeName( rTo, rFrom, 
rAddPurpose ) );
+if (!bModule)
+bModule = loadModule( aModule, aName = getBridgeName( rFrom, rTo, 
rAddPurpose ) );
+if (!bModule)
+bModule = loadModule( aModule, aName = getBridgeName( rTo, rFrom, 
rAddPurpose ) );
 
-if (hModule)
+if (bModule)
 {
 OUString aSymbolName( UNO_EXT_GETMAPPING );
 uno_ext_getMappingFunc fpGetMapFunc =
-(uno_ext_getMappingFunc)::osl_getFunctionSymbol(
-hModule, aSymbolName.pData );
+(uno_ext_getMappingFunc)aModule.getSymbol( aSymbolName );
 
 if (fpGetMapFunc)
 {
@@ -430,10 +430,11 @@ static Mapping loadExternalMapping(
 OSL_ASSERT( aExt.is() );
 if (aExt.is())
 {
+aModule.release();
 return aExt;
 }
 }
-::osl_unloadModule( hModule );
+aModule.unload();
 setNegativeBridge( aName );
 }
 #endif
diff --git a/cppu/source/uno/loadmodule.cxx b/cppu/source/uno/loadmodule.cxx
index f00936d..1d8ab75 100644
--- a/cppu/source/uno/loadmodule.cxx
+++ b/cppu/source/uno/loadmodule.cxx
@@ -31,16 +31,16 @@ namespace cppu { namespace detail {
 
 #ifndef DISABLE_DYNLOADING
 
-::oslModule loadModule(rtl::OUString const  name) {
+bool loadModule(osl::Module rModule, rtl::OUString const  name) {
 rtl::OUStringBuffer b;
 #if defined SAL_DLLPREFIX
 b.append(SAL_DLLPREFIX);
 #endif
 b.append(name);
 b.append(SAL_DLLEXTENSION);
-return ::osl_loadModuleRelative(
+return rModule.loadRelative(
 reinterpret_cast 

[Libreoffice-commits] core.git: cppu/source

2015-01-08 Thread Caolán McNamara
 cppu/source/uno/lbmap.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit d5c3a25aaec6136dda35e7d9904d9aaa2c015ed9
Author: Caolán McNamara caol...@redhat.com
Date:   Thu Jan 8 09:23:12 2015 +

valgrind: uninitialized variable

Change-Id: I1e166c7e3b58ed565aaf478fa0b6505d1f68b604

diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx
index 0313022..454653b 100644
--- a/cppu/source/uno/lbmap.cxx
+++ b/cppu/source/uno/lbmap.cxx
@@ -407,7 +407,7 @@ static Mapping loadExternalMapping(
 #else
 // find proper lib
 osl::Module aModule;
-bool bModule;
+bool bModule(false);
 OUString aName;
 
 if ( EnvDcp::getTypeName(rFrom.getTypeName()) == UNO_LB_UNO )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2015-01-05 Thread Stephan Bergmann
 cppu/source/uno/lbenv.cxx |   12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

New commits:
commit f76f40560ef49c3da864073285ebe6b9a0cfad5f
Author: Stephan Bergmann sberg...@redhat.com
Date:   Mon Jan 5 14:02:27 2015 +0100

More unnamed namespace clean-up

Change-Id: Iaba8b9b3415c357990b795b6f23b98929ac5e00a

diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index f9f1107..e8fa57d 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -133,11 +133,7 @@ struct EnvironmentsData
 bool isDisposing;
 };
 
-namespace
-{
-struct theEnvironmentsData : public rtl::Static EnvironmentsData, 
theEnvironmentsData  {};
-}
-
+struct theEnvironmentsData : public rtl::Static EnvironmentsData, 
theEnvironmentsData  {};
 
 struct uno_DefaultEnvironment : public uno_ExtEnvironment
 {
@@ -696,6 +692,7 @@ static void writeLine(
 writeLine( stream, aLine.getStr(), pFilter );
 }
 
+}
 
 extern C void SAL_CALL uno_dumpEnvironment(
 void * stream, uno_Environment * pEnv, const sal_Char * pFilter )
@@ -839,14 +836,14 @@ namespace
 };
 
 class theStaticOIdPart : public rtl::StaticmakeOIdPart, theStaticOIdPart 
{};
-}
-
 
 inline static const OUString  unoenv_getStaticOIdPart()
 {
 return theStaticOIdPart::get().getOIdPart();
 }
 
+}
+
 extern C
 {
 
@@ -902,6 +899,7 @@ static void SAL_CALL unoenv_releaseInterface(
 }
 }
 
+namespace {
 
 EnvironmentsData::~EnvironmentsData()
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2015-01-05 Thread Stephan Bergmann
 cppu/source/cppu/cppu_opt.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9a6e2dd9e743157e00490d825502efaa21a75c25
Author: Stephan Bergmann sberg...@redhat.com
Date:   Mon Jan 5 14:48:29 2015 +0100

Missing const

Change-Id: I8a1c520023b493c0494ac2ac650542d8ecc11c5d

diff --git a/cppu/source/cppu/cppu_opt.cxx b/cppu/source/cppu/cppu_opt.cxx
index 2d53721..3344143 100644
--- a/cppu/source/cppu/cppu_opt.cxx
+++ b/cppu/source/cppu/cppu_opt.cxx
@@ -55,7 +55,7 @@ extern C CPPU_DLLPUBLIC rtl_uString * SAL_CALL 
cppu_unsatisfied_iset_msg(
 
 
 extern C CPPU_DLLPUBLIC rtl_uString * SAL_CALL 
cppu_Any_extraction_failure_msg(
-uno_Any * pAny, typelib_TypeDescriptionReference * pType )
+uno_Any const * pAny, typelib_TypeDescriptionReference * pType )
 SAL_THROW_EXTERN_C()
 {
 OUStringBuffer buf;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2015-01-05 Thread Stephan Bergmann
 cppu/source/uno/data.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit da2d66ce567460806c09ed2d936a98092ee059ff
Author: Stephan Bergmann sberg...@redhat.com
Date:   Mon Jan 5 13:32:42 2015 +0100

include

Change-Id: I77d06a70f9c000f800b9b31d3b04aafe77754446

diff --git a/cppu/source/uno/data.cxx b/cppu/source/uno/data.cxx
index 68c6d87..f90a41c 100644
--- a/cppu/source/uno/data.cxx
+++ b/cppu/source/uno/data.cxx
@@ -22,8 +22,8 @@
 #include stdio.h
 
 #include cppu/macros.hxx
-
 #include osl/mutex.hxx
+#include uno/data.h
 
 #include constr.hxx
 #include destr.hxx
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2015-01-05 Thread Stephan Bergmann
 cppu/source/uno/data.cxx |   15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

New commits:
commit debced0f2916f7cb412e6bfcb514e3017adc7202
Author: Stephan Bergmann sberg...@redhat.com
Date:   Mon Jan 5 13:47:38 2015 +0100

These extern C functions are not in namespace cppu

Change-Id: Ia98b32bd8451051750fbf810958bdcfe584ea7be

diff --git a/cppu/source/uno/data.cxx b/cppu/source/uno/data.cxx
index f90a41c..d69bfb6 100644
--- a/cppu/source/uno/data.cxx
+++ b/cppu/source/uno/data.cxx
@@ -173,6 +173,8 @@ bool equalSequence(
 return _equalSequence( pDest, pSource, pElementType, queryInterface, 
release );
 }
 
+}
+
 extern C
 {
 
@@ -318,16 +320,13 @@ sal_Bool SAL_CALL uno_type_isAssignableFromData(
 _release( p, release );
 return (0 != p);
 }
-}
-
-
-
-
-
 
+}
 
 #if OSL_DEBUG_LEVEL  1
 
+namespace cppu {
+
 #if defined( SAL_W32)
 #pragma pack(push, 8)
 #endif
@@ -591,8 +590,8 @@ BinaryCompatible_Impl::BinaryCompatible_Impl()
 
 static BinaryCompatible_Impl aTest;
 
-#endif
-
 }
 
+#endif
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppu/source

2015-01-05 Thread Stephan Bergmann
 cppu/source/uno/lbenv.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 406629e9a00ca51c65645c8cc230c0f8a7e9263f
Author: Stephan Bergmann sberg...@redhat.com
Date:   Mon Jan 5 13:53:26 2015 +0100

These extern C functions are not in an unnamed namespace

Change-Id: I185b29c185094176e0992fc84c9cc82ff93de9c2

diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index ebbe602..f9f1107 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -1077,6 +1077,7 @@ static bool loadEnv(OUString const   cLibStem,
 return true;
 }
 
+}
 
 extern C
 {
@@ -1179,6 +1180,4 @@ void SAL_CALL uno_getRegisteredEnvironments(
 
 } // extern C
 
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


  1   2   >