[Libreoffice-commits] core.git: sal/cppunittester sal/IwyuFilter_sal.yaml sal/osl sal/rtl sal/textenc

2023-09-19 Thread Gabor Kelemen (via logerrit)
 sal/IwyuFilter_sal.yaml   |   31 ++
 sal/cppunittester/cppunittester.cxx   |7 -
 sal/osl/all/loadmodulerelative.cxx|1 
 sal/rtl/alloc_arena.cxx   |1 
 sal/rtl/alloc_global.cxx  |8 --
 sal/rtl/bootstrap.cxx |5 
 sal/rtl/cipher.cxx|4 ---
 sal/rtl/hash.cxx  |1 
 sal/rtl/locale.cxx|3 --
 sal/rtl/math.cxx  |3 --
 sal/rtl/strbuf.cxx|7 +
 sal/rtl/string.cxx|1 
 sal/rtl/ustrbuf.cxx   |5 
 sal/rtl/ustring.cxx   |5 
 sal/textenc/convertbig5hkscs.cxx  |1 
 sal/textenc/converteuctw.cxx  |2 -
 sal/textenc/convertgb18030.cxx|2 -
 sal/textenc/convertisciidevangari.cxx |1 
 sal/textenc/convertiso2022cn.cxx  |1 
 sal/textenc/convertiso2022jp.cxx  |1 
 sal/textenc/convertiso2022kr.cxx  |1 
 sal/textenc/convertsinglebytetobmpunicode.cxx |1 
 sal/textenc/tcvtutf8.cxx  |2 -
 sal/textenc/tencinfo.cxx  |1 
 sal/textenc/textenc.cxx   |5 
 25 files changed, 36 insertions(+), 64 deletions(-)

New commits:
commit 2e71c439057c8d31b6af191ef38607600cb996f0
Author: Gabor Kelemen 
AuthorDate: Tue Sep 12 15:32:43 2023 +0200
Commit: Miklos Vajna 
CommitDate: Tue Sep 19 08:35:12 2023 +0200

tdf#146619 Remove unused includes from sal/ [cpp files]

Change-Id: I11a54c1ddf73c16ce46a0d1c375bf43157870db7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155856
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sal/IwyuFilter_sal.yaml b/sal/IwyuFilter_sal.yaml
index 0871e1c82d46..b12f857e012a 100644
--- a/sal/IwyuFilter_sal.yaml
+++ b/sal/IwyuFilter_sal.yaml
@@ -18,6 +18,12 @@ excludelist:
 sal/android/uthash.h:
 # needed for defines to work / somehow on Linux there is a warning about 
android-related file
 - string.h
+sal/cppunittester/cppunittester.cxx:
+# Actually used
+- boost/algorithm/string.hpp
+sal/emscripten/lo-bootstrap.c:
+# Actually needed for lo_get_app_data_dir
+- osl/detail/emscripten-bootstrap.h
 sal/qa/osl/security/osl_Security.cxx:
 # Needed on _WIN32
 - o3tl/char16_t2wchar_t.hxx
@@ -66,3 +72,28 @@ excludelist:
 sal/osl/unx/uunxapi.cxx:
 # Needed for macxp_resolveAlias on MACOSX
 - system.hxx
+sal/rtl/bootstrap.cxx:
+# Needed on MACOSX
+- config_folders.h
+sal/textenc/tables.cxx:
+# Needed for the .tab files to work
+- cstddef
+- iterator
+- rtl/tencinfo.h
+# Needed for other .tab files to work
+- tcvtjp1.tab
+- tcvtjp2.tab
+- tcvtjp3.tab
+- tcvtjp4.tab
+- tcvtjp5.tab
+- tcvtkr1.tab
+- tcvtkr2.tab
+- tcvtkr4.tab
+- tcvtkr5.tab
+- tcvtscn1.tab
+- tcvtscn2.tab
+- tcvtscn3.tab
+- tcvtscn4.tab
+- tcvtscn5.tab
+- tcvttcn1.tab
+- tcvttcn2.tab
diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 4a1d033e97ba..854c0999c911 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -30,11 +30,9 @@
 #endif
 
 #ifdef UNX
-#include 
 #include 
 #endif
 
-#include 
 #include 
 #include 
 #include 
@@ -43,13 +41,11 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
@@ -64,7 +60,6 @@
 #include 
 #include 
 
-#include 
 #include 
 
 #include 
diff --git a/sal/osl/all/loadmodulerelative.cxx 
b/sal/osl/all/loadmodulerelative.cxx
index f7a6938ed130..d2af7d010057 100644
--- a/sal/osl/all/loadmodulerelative.cxx
+++ b/sal/osl/all/loadmodulerelative.cxx
@@ -18,6 +18,7 @@
  */
 
 #include 
+
 #include 
 #include 
 #include 
diff --git a/sal/rtl/alloc_arena.cxx b/sal/rtl/alloc_arena.cxx
index 47cb3eeab6cb..05e1b7ab212e 100644
--- a/sal/rtl/alloc_arena.cxx
+++ b/sal/rtl/alloc_arena.cxx
@@ -23,7 +23,6 @@
 
 #include "alloc_impl.hxx"
 #include 
-#include 
 
 #include 
 #include 
diff --git a/sal/rtl/alloc_global.cxx b/sal/rtl/alloc_global.cxx
index 4b7ec6037dc1..29eb0e8f2a84 100644
--- a/sal/rtl/alloc_global.cxx
+++ b/sal/rtl/alloc_global.cxx
@@ -17,17 +17,9 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include "alloc_impl.hxx"
 #include 
 #include 
-#include 
 
-#include 
-#include 
-#include 
-#include 
-
-#include 
 #include 
 
 void* SAL_CALL rtl_allocateMemory(sal_Size n) SAL_THROW_EXTERN_C()
diff --git a/sal/rtl/bootstrap.cxx b/sal/rtl/bootstrap.cxx
index 04e0a4d0ed14..a3ada36a4439 100644
--- a/sal/rtl/bootstrap.cxx
+++ b/sal/rtl/bootstrap.cxx

[Libreoffice-commits] core.git: sal/cppunittester

2023-07-10 Thread Andrea Gelmini (via logerrit)
 sal/cppunittester/cppunittester.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit d5deff0553417edcd40731258512c1b49d167037
Author: Andrea Gelmini 
AuthorDate: Sun Jul 9 19:01:52 2023 +0200
Commit: Julien Nabet 
CommitDate: Mon Jul 10 10:56:41 2023 +0200

Fix typo

Change-Id: Ic70380a7a3d8cefca5214ea70b87e92772535c6c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154232
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index fe723d6ab229..4a1d033e97ba 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -404,7 +404,7 @@ static bool main2()
 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG|_CRTDBG_MODE_FILE);
 _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
 #endif
-// Create a desktop, to avoid popups interferring with active user session,
+// Create a desktop, to avoid popups interfering with active user session,
 // because on Windows, we don't use svp vcl plugin for unit testing
 if (getenv("CPPUNIT_DEFAULT_DESKTOP") == nullptr)
 {


[Libreoffice-commits] core.git: sal/cppunittester

2023-07-09 Thread Mike Kaganski (via logerrit)
 sal/cppunittester/cppunittester.cxx |   15 ++-
 1 file changed, 2 insertions(+), 13 deletions(-)

New commits:
commit 81726f5af5fda25f0d92ffc8458d7f24eb16f408
Author: Mike Kaganski 
AuthorDate: Sun Jul 9 12:01:20 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sun Jul 9 15:02:44 2023 +0200

No need to clean up the desktop, when the process is finishing

It will be cleaned up anyway.

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

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 50910fecfdd7..fe723d6ab229 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -40,7 +40,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -407,20 +406,10 @@ static bool main2()
 #endif
 // Create a desktop, to avoid popups interferring with active user session,
 // because on Windows, we don't use svp vcl plugin for unit testing
-HDESK hDesktop = nullptr;
-comphelper::ScopeGuard desktopRestore(
-[, hPrevDesktop = GetThreadDesktop(GetCurrentThreadId())]()
-{
-if (hDesktop)
-{
-SetThreadDesktop(hPrevDesktop);
-CloseDesktop(hDesktop);
-}
-});
 if (getenv("CPPUNIT_DEFAULT_DESKTOP") == nullptr)
 {
-hDesktop = CreateDesktopW(L"LO_CPPUNIT_DESKTOP", nullptr, nullptr, 0, 
GENERIC_ALL, nullptr);
-if (hDesktop)
+if (HDESK hDesktop
+= CreateDesktopW(L"LO_CPPUNIT_DESKTOP", nullptr, nullptr, 0, 
GENERIC_ALL, nullptr))
 SetThreadDesktop(hDesktop);
 }
 #endif


[Libreoffice-commits] core.git: sal/cppunittester

2023-07-09 Thread Mike Kaganski (via logerrit)
 sal/cppunittester/cppunittester.cxx |   19 +++
 1 file changed, 19 insertions(+)

New commits:
commit 1f24d35033c2f02335ce254bbcf6ba89e1b7565e
Author: Mike Kaganski 
AuthorDate: Fri Jul 7 16:02:08 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sun Jul 9 10:40:33 2023 +0200

cppunittester: use a dedicated desktop on Windows

Since introduction of accessibility tests infrastructure in commit
0185ddd6d5f0324ba57b3fa36229103a6b27138e (Add infrastructure and
basic tests including slight UI interaction, 2022-08-01) and the
respective tests, running 'make check' on Windows produces pop-up
dialogs, while these tests run. These dialogs distract, steal focus,
swallow text that I type elsewhere, and may fail the tests if
accidental user input interferes with what the tests check.

This commit creates a dedicated system desktop for cppunittests,
which would be isolated from the active desktop, yet allow creation
of windows, thus not preventing accessibility testing. This way,
it workarounds unavailability of svp vcl plugin on Windows.

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

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 6729903edd5d..50910fecfdd7 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -40,6 +40,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -404,6 +405,24 @@ static bool main2()
 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG|_CRTDBG_MODE_FILE);
 _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
 #endif
+// Create a desktop, to avoid popups interferring with active user session,
+// because on Windows, we don't use svp vcl plugin for unit testing
+HDESK hDesktop = nullptr;
+comphelper::ScopeGuard desktopRestore(
+[, hPrevDesktop = GetThreadDesktop(GetCurrentThreadId())]()
+{
+if (hDesktop)
+{
+SetThreadDesktop(hPrevDesktop);
+CloseDesktop(hDesktop);
+}
+});
+if (getenv("CPPUNIT_DEFAULT_DESKTOP") == nullptr)
+{
+hDesktop = CreateDesktopW(L"LO_CPPUNIT_DESKTOP", nullptr, nullptr, 0, 
GENERIC_ALL, nullptr);
+if (hDesktop)
+SetThreadDesktop(hDesktop);
+}
 #endif
 
 std::vector protectors;


[Libreoffice-commits] core.git: sal/cppunittester

2023-04-11 Thread Christian Lohmaier (via logerrit)
 sal/cppunittester/cppunittester.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 93f9a747e0603ff3c38f44c43153f88e89d178c8
Author: Christian Lohmaier 
AuthorDate: Thu Apr 6 13:44:25 2023 +0200
Commit: Christian Lohmaier 
CommitDate: Tue Apr 11 12:06:42 2023 +0200

fix dbgutil build on win/aarch64 (print stack from cppunittester)

Change-Id: I632607599060e625bda3dabee627ae1ddd6bd709
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150102
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier 

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 8a9e184c431d..c859ee5e102f 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -503,6 +503,10 @@ static void printStack( PCONTEXT ctx )
 stack.AddrPC.Offset= ctx->Rip;
 stack.AddrStack.Offset = ctx->Rsp;
 stack.AddrFrame.Offset = ctx->Rsp;
+#elif defined _M_ARM64
+stack.AddrPC.Offset= ctx->Pc;
+stack.AddrStack.Offset = ctx->Sp;
+stack.AddrFrame.Offset = ctx->Fp;
 #else
 stack.AddrPC.Offset= ctx->Eip;
 stack.AddrStack.Offset = ctx->Esp;
@@ -529,6 +533,8 @@ static void printStack( PCONTEXT ctx )
 (
 #ifdef _M_AMD64
 IMAGE_FILE_MACHINE_AMD64,
+#elif defined _M_ARM64
+IMAGE_FILE_MACHINE_ARM64,
 #else
 IMAGE_FILE_MACHINE_I386,
 #endif


[Libreoffice-commits] core.git: sal/cppunittester sal/osl sal/rtl

2022-05-17 Thread Noel Grandin (via logerrit)
 sal/cppunittester/cppunittester.cxx |5 +++--
 sal/osl/unx/file_path_helper.cxx|5 +++--
 sal/rtl/bootstrap.cxx   |7 ---
 3 files changed, 10 insertions(+), 7 deletions(-)

New commits:
commit 4e2f5e85c9c22e57e01d6fa6f585f91287efc7ef
Author: Noel Grandin 
AuthorDate: Tue May 17 13:52:14 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue May 17 17:36:16 2022 +0200

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

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

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index e726ac3f8273..81ddec1568ed 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -69,6 +69,7 @@
 
 #include 
 #include 
+#include 
 
 namespace {
 
@@ -188,8 +189,8 @@ private:
 
 struct test_name_compare
 {
-explicit test_name_compare(const std::string& rName):
-maName(rName)
+explicit test_name_compare(std::string aName):
+maName(std::move(aName))
 {
 }
 
diff --git a/sal/osl/unx/file_path_helper.cxx b/sal/osl/unx/file_path_helper.cxx
index 080a99c09928..a8ee5238f95a 100644
--- a/sal/osl/unx/file_path_helper.cxx
+++ b/sal/osl/unx/file_path_helper.cxx
@@ -20,6 +20,7 @@
 #include 
 
 #include 
+#include 
 
 #include "file_path_helper.hxx"
 #include "uunxapi.hxx"
@@ -170,8 +171,8 @@ public:
returns the first path in list, no need
to call reset first
  */
-path_list_iterator(const OUString& path_list, sal_Unicode list_separator = 
FPH_CHAR_COLON) :
-m_path_list(path_list),
+path_list_iterator(OUString path_list, sal_Unicode list_separator = 
FPH_CHAR_COLON) :
+m_path_list(std::move(path_list)),
 m_end(m_path_list.getStr() + m_path_list.getLength() + 1),
 m_separator(list_separator)
 {
diff --git a/sal/rtl/bootstrap.cxx b/sal/rtl/bootstrap.cxx
index 68e219406cc4..12558d319e44 100644
--- a/sal/rtl/bootstrap.cxx
+++ b/sal/rtl/bootstrap.cxx
@@ -39,6 +39,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -121,9 +122,9 @@ struct rtl_bootstrap_NameValue
 
 rtl_bootstrap_NameValue()
 {}
-rtl_bootstrap_NameValue(OUString const & name, OUString const & value )
-: sName( name ),
-  sValue( value )
+rtl_bootstrap_NameValue(OUString name, OUString value )
+: sName(std::move( name )),
+  sValue(std::move( value ))
 {}
 };
 


[Libreoffice-commits] core.git: sal/cppunittester

2022-05-12 Thread Stephan Bergmann (via logerrit)
 sal/cppunittester/cppunittester.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 32714f966186d301435d3eb9f7f6950bc9a6bb1e
Author: Stephan Bergmann 
AuthorDate: Thu May 12 08:14:21 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Thu May 12 09:57:28 2022 +0200

-Werror,-Wformat

> sal/cppunittester/cppunittester.cxx(553,65): error: format specifies type 
'unsigned int' but the argument has type 'DWORD' (aka 'unsigned long') 
[-Werror,-Wformat]
> printf("\tat unknown (Error in SymFromAddr=%#08x)", 
GetLastError());
>~
^~
>%#08lx

and DWORD should presumably always be a typedef for unsigned long according 
to


"2.2.9 DWORD"

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

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index b1fefecf94aa..e726ac3f8273 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -549,7 +549,7 @@ static void printStack( PCONTEXT ctx )
 if (SymFromAddr(process, stack.AddrPC.Offset, nullptr, pSymbol))
 printf("\tat %s", pSymbol->Name);
 else
-printf("\tat unknown (Error in SymFromAddr=%#08x)", 
GetLastError());
+printf("\tat unknown (Error in SymFromAddr=%#08lx)", 
GetLastError());
 
 DWORD disp;
 //try to get line


[Libreoffice-commits] core.git: sal/cppunittester

2022-05-12 Thread Stephan Bergmann (via logerrit)
 sal/cppunittester/cppunittester.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit dd2010e79fb2ccb46e602bf0546487b7d1b095f1
Author: Stephan Bergmann 
AuthorDate: Thu May 12 08:12:28 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Thu May 12 09:14:31 2022 +0200

-Werror,-Wunused-variable

...since 92f93f300371d2011b53d48d3491870b24cff0b4 "output error code when
SymFromAddr fails"

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

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 4a1c050a4662..b1fefecf94aa 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -490,7 +490,6 @@ static bool main2()
 //Prints stack trace based on exception context record
 static void printStack( PCONTEXT ctx )
 {
-constexpr int MaxNameLen = 256;
 HANDLE process = GetCurrentProcess();
 HANDLE thread = GetCurrentThread();
 


[Libreoffice-commits] core.git: sal/cppunittester

2022-05-06 Thread Noel Grandin (via logerrit)
 sal/cppunittester/cppunittester.cxx |  112 +---
 1 file changed, 43 insertions(+), 69 deletions(-)

New commits:
commit 92f93f300371d2011b53d48d3491870b24cff0b4
Author: Noel Grandin 
AuthorDate: Thu Mar 24 12:46:44 2022 +0200
Commit: Noel Grandin 
CommitDate: Fri May 6 11:04:33 2022 +0200

output error code when SymFromAddr fails

instead of random data

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

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index fec62c261260..4a1c050a4662 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -488,116 +488,90 @@ static bool main2()
 #if defined(_WIN32) && defined(_DEBUG)
 
 //Prints stack trace based on exception context record
-static void printStack( CONTEXT* ctx )
+static void printStack( PCONTEXT ctx )
 {
 constexpr int MaxNameLen = 256;
-boolresult;
-HANDLE  process;
-HANDLE  thread;
-HMODULE hModule;
-#ifdef _M_AMD64
-STACKFRAME64stack;
-#else
-STACKFRAME  stack;
-#endif
-DWORD64 displacement;
-DWORD disp;
-char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(TCHAR)];
-char module[MaxNameLen];
-PSYMBOL_INFO pSymbol = reinterpret_cast(buffer);
+HANDLE process = GetCurrentProcess();
+HANDLE thread = GetCurrentThread();
 
-#ifdef _M_AMD64
-memset( , 0, sizeof( STACKFRAME64 ) );
-#else
-memset( , 0, sizeof( STACKFRAME ) );
-#endif
-
-process= GetCurrentProcess();
-thread = GetCurrentThread();
-displacement   = 0;
-#if !defined(_M_AMD64)
-stack.AddrPC.Offset= (*ctx).Eip;
+STACKFRAME64stack {};
 stack.AddrPC.Mode  = AddrModeFlat;
-stack.AddrStack.Offset = (*ctx).Esp;
 stack.AddrStack.Mode   = AddrModeFlat;
-stack.AddrFrame.Offset = (*ctx).Ebp;
 stack.AddrFrame.Mode   = AddrModeFlat;
+#ifdef _M_AMD64
+stack.AddrPC.Offset= ctx->Rip;
+stack.AddrStack.Offset = ctx->Rsp;
+stack.AddrFrame.Offset = ctx->Rsp;
+#else
+stack.AddrPC.Offset= ctx->Eip;
+stack.AddrStack.Offset = ctx->Esp;
+stack.AddrFrame.Offset = ctx->Ebp;
 #endif
 
+DWORD symOptions = SymGetOptions();
+symOptions |= SYMOPT_LOAD_LINES;
+symOptions |= SYMOPT_FAIL_CRITICAL_ERRORS;
+symOptions = SymSetOptions(symOptions);
+
 SymInitialize( process, nullptr, TRUE ); //load symbols
 
-#ifdef _M_AMD64
-std::unique_ptr line(new IMAGEHLP_LINE64);
-line->SizeOfStruct = sizeof(IMAGEHLP_LINE64);
-#else
-std::unique_ptr line(new IMAGEHLP_LINE);
-line->SizeOfStruct = sizeof(IMAGEHLP_LINE);
-#endif
+IMAGEHLP_LINE64 line{};
+line.SizeOfStruct = sizeof(line);
+
+char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(TCHAR)];
+PSYMBOL_INFO pSymbol = reinterpret_cast(buffer);
 
-for( ; ; )
+for (;;)
 {
 //get next call from stack
-#ifdef _M_AMD64
-result = StackWalk64
+bool result = StackWalk64
 (
+#ifdef _M_AMD64
 IMAGE_FILE_MACHINE_AMD64,
-process,
-thread,
-,
-ctx,
-nullptr,
-SymFunctionTableAccess64,
-SymGetModuleBase64,
-nullptr
-);
 #else
-result = StackWalk
-(
 IMAGE_FILE_MACHINE_I386,
+#endif
 process,
 thread,
 ,
 ctx,
 nullptr,
-SymFunctionTableAccess,
-SymGetModuleBase,
+SymFunctionTableAccess64,
+SymGetModuleBase64,
 nullptr
 );
-#endif
 
 if( !result )
 break;
 
 //get symbol name for address
 pSymbol->SizeOfStruct = sizeof(SYMBOL_INFO);
-pSymbol->MaxNameLen = MAX_SYM_NAME;
-#ifdef _M_AMD64
-SymFromAddr(process, static_cast< ULONG64 >(stack.AddrPC.Offset), 
, pSymbol);
-#else
-SymFromAddr(process, static_cast< ULONG >(stack.AddrPC.Offset), 
, pSymbol);
-#endif
+pSymbol->MaxNameLen = MAX_SYM_NAME + 1;
+if (SymFromAddr(process, stack.AddrPC.Offset, nullptr, pSymbol))
+printf("\tat %s", pSymbol->Name);
+else
+printf("\tat unknown (Error in SymFromAddr=%#08x)", 
GetLastError());
+
+DWORD disp;
 //try to get line
-#ifdef _M_AMD64
-if (SymGetLineFromAddr64(process, stack.AddrPC.Offset, , 
line.get()))
-#else
-if (SymGetLineFromAddr(process, stack.AddrPC.Offset, , 
line.get()))
-#endif
+if (SymGetLineFromAddr64(process, stack.AddrPC.Offset, , ))
 {
-printf("\tat %s in %s: line: %lu: address: 0x%0I64X\n", 
pSymbol->Name, line->FileName, line->LineNumber, pSymbol->Address);
+printf(" in %s: line: 

[Libreoffice-commits] core.git: sal/cppunittester

2022-03-31 Thread Stephan Bergmann (via logerrit)
 sal/cppunittester/cppunittester.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit bccbdce07cfa74f5cabf97c5fb11405991fffdfe
Author: Stephan Bergmann 
AuthorDate: Thu Mar 31 09:17:10 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Mar 31 14:33:19 2022 +0200

-Werror,-Wunused-but-set-variable

...ever since 24b06b9c6bdb777dff385b0fbfc81d55d3d013a1 "log access 
violation on
windows tinderboxen"

Change-Id: I8a26135131774d0c9fd160b805a3ab798a216cf9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132349
Reviewed-by: Noel Grandin 
Reviewed-by: Stephan Bergmann 
Tested-by: Jenkins

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 7d5ce39edf12..ae77bb3e3961 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -500,7 +500,6 @@ static void printStack( CONTEXT* ctx )
 #else
 STACKFRAME  stack;
 #endif
-ULONG   frame;
 DWORD64 displacement;
 DWORD disp;
 char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(TCHAR)];
@@ -535,7 +534,7 @@ static void printStack( CONTEXT* ctx )
 line->SizeOfStruct = sizeof(IMAGEHLP_LINE);
 #endif
 
-for( frame = 0; ; frame++ )
+for( ; ; )
 {
 //get next call from stack
 #ifdef _M_AMD64


[Libreoffice-commits] core.git: sal/cppunittester

2022-03-23 Thread Noel Grandin (via logerrit)
 sal/cppunittester/cppunittester.cxx |   41 +++-
 1 file changed, 36 insertions(+), 5 deletions(-)

New commits:
commit 4f900a536940fce989cd9e3d688a8391e6edf62f
Author: Noel Grandin 
AuthorDate: Wed Mar 23 11:45:34 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Mar 23 13:18:48 2022 +0100

try to improve stack dumping on windows

noting that this commit is completely blind. But we're not getting
good stacks on jenkins, and it doesn't look right to me that we're
using 64-bit functions on 32-bit stacks, so make the 32-bit paths
consistently use 32-bit functions and structures.

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

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index f75caccbc143..7d5ce39edf12 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -495,7 +495,11 @@ static void printStack( CONTEXT* ctx )
 HANDLE  process;
 HANDLE  thread;
 HMODULE hModule;
+#ifdef _M_AMD64
 STACKFRAME64stack;
+#else
+STACKFRAME  stack;
+#endif
 ULONG   frame;
 DWORD64 displacement;
 DWORD disp;
@@ -503,7 +507,11 @@ static void printStack( CONTEXT* ctx )
 char module[MaxNameLen];
 PSYMBOL_INFO pSymbol = reinterpret_cast(buffer);
 
+#ifdef _M_AMD64
 memset( , 0, sizeof( STACKFRAME64 ) );
+#else
+memset( , 0, sizeof( STACKFRAME ) );
+#endif
 
 process= GetCurrentProcess();
 thread = GetCurrentThread();
@@ -519,19 +527,21 @@ static void printStack( CONTEXT* ctx )
 
 SymInitialize( process, nullptr, TRUE ); //load symbols
 
+#ifdef _M_AMD64
 std::unique_ptr line(new IMAGEHLP_LINE64);
 line->SizeOfStruct = sizeof(IMAGEHLP_LINE64);
+#else
+std::unique_ptr line(new IMAGEHLP_LINE);
+line->SizeOfStruct = sizeof(IMAGEHLP_LINE);
+#endif
 
 for( frame = 0; ; frame++ )
 {
 //get next call from stack
+#ifdef _M_AMD64
 result = StackWalk64
 (
-#if defined(_M_AMD64)
 IMAGE_FILE_MACHINE_AMD64,
-#else
-IMAGE_FILE_MACHINE_I386,
-#endif
 process,
 thread,
 ,
@@ -541,6 +551,20 @@ static void printStack( CONTEXT* ctx )
 SymGetModuleBase64,
 nullptr
 );
+#else
+result = StackWalk
+(
+IMAGE_FILE_MACHINE_I386,
+process,
+thread,
+,
+ctx,
+nullptr,
+SymFunctionTableAccess,
+SymGetModuleBase,
+nullptr
+);
+#endif
 
 if( !result )
 break;
@@ -548,10 +572,17 @@ static void printStack( CONTEXT* ctx )
 //get symbol name for address
 pSymbol->SizeOfStruct = sizeof(SYMBOL_INFO);
 pSymbol->MaxNameLen = MAX_SYM_NAME;
+#ifdef _M_AMD64
 SymFromAddr(process, static_cast< ULONG64 >(stack.AddrPC.Offset), 
, pSymbol);
-
+#else
+SymFromAddr(process, static_cast< ULONG >(stack.AddrPC.Offset), 
, pSymbol);
+#endif
 //try to get line
+#ifdef _M_AMD64
 if (SymGetLineFromAddr64(process, stack.AddrPC.Offset, , 
line.get()))
+#else
+if (SymGetLineFromAddr(process, stack.AddrPC.Offset, , 
line.get()))
+#endif
 {
 printf("\tat %s in %s: line: %lu: address: 0x%0I64X\n", 
pSymbol->Name, line->FileName, line->LineNumber, pSymbol->Address);
 }


[Libreoffice-commits] core.git: sal/cppunittester

2022-03-15 Thread Luboš Luňák (via logerrit)
 sal/cppunittester/cppunittester.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit c0361119dfb5a1accfae9f777844e22846af8ecc
Author: Luboš Luňák 
AuthorDate: Mon Feb 28 04:02:14 2022 +0100
Commit: Luboš Luňák 
CommitDate: Tue Mar 15 21:12:47 2022 +0100

set LO_TESTNAME on startup on all platforms

c0b1d1bf5701d5f94b618f70da8e863d32d97ab4 did this only for UNX
for no apparent reason. Solves CppunitTest_sc_tablecolumnsobj
asserting on it not being set.

Change-Id: Ia9484e5c90bef18450addcf9429f9a27d575c3b4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131631
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 5b886ea2189d..f75caccbc143 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -301,9 +301,12 @@ public:
 
 EyecatcherListener eye;
 result.addListener();
-#ifdef UNX
+
 // set this to track down files created before first test method
 std::string lib = testlib.substr(testlib.rfind('/')+1);
+#ifdef WIN32
+_putenv_s("LO_TESTNAME", lib.c_str());
+#else
 setenv("LO_TESTNAME", lib.c_str(), true);
 #endif
 const char* pVal = getenv("CPPUNIT_TEST_NAME");


[Libreoffice-commits] core.git: sal/cppunittester winaccessibility/inc

2021-10-01 Thread Stephan Bergmann (via logerrit)
 sal/cppunittester/cppunittester.cxx|   10 +-
 winaccessibility/inc/AccObjectManagerAgent.hxx |4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 955ccb669c60cc29918c784d9c801ab1ac54fc22
Author: Stephan Bergmann 
AuthorDate: Thu Sep 30 09:50:53 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Oct 1 08:32:40 2021 +0200

loplugin:nullptr (clang-cl)

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

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 3ec11a3ffc3a..5b886ea2189d 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -514,7 +514,7 @@ static void printStack( CONTEXT* ctx )
 stack.AddrFrame.Mode   = AddrModeFlat;
 #endif
 
-SymInitialize( process, NULL, TRUE ); //load symbols
+SymInitialize( process, nullptr, TRUE ); //load symbols
 
 std::unique_ptr line(new IMAGEHLP_LINE64);
 line->SizeOfStruct = sizeof(IMAGEHLP_LINE64);
@@ -533,10 +533,10 @@ static void printStack( CONTEXT* ctx )
 thread,
 ,
 ctx,
-NULL,
+nullptr,
 SymFunctionTableAccess64,
 SymGetModuleBase64,
-NULL
+nullptr
 );
 
 if( !result )
@@ -556,13 +556,13 @@ static void printStack( CONTEXT* ctx )
 {
 //failed to get line
 printf("\tat %s, address 0x%0I64X.\n", pSymbol->Name, 
pSymbol->Address);
-hModule = NULL;
+hModule = nullptr;
 lstrcpyA(module,"");
 GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | 
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
 reinterpret_cast(stack.AddrPC.Offset), );
 
 //at least print module name
-if(hModule != NULL)GetModuleFileNameA(hModule,module,MaxNameLen);
+if(hModule != 
nullptr)GetModuleFileNameA(hModule,module,MaxNameLen);
 
 printf ("in %s\n",module);
 }
diff --git a/winaccessibility/inc/AccObjectManagerAgent.hxx 
b/winaccessibility/inc/AccObjectManagerAgent.hxx
index e4e87be3dc3c..579a785b41bb 100644
--- a/winaccessibility/inc/AccObjectManagerAgent.hxx
+++ b/winaccessibility/inc/AccObjectManagerAgent.hxx
@@ -49,7 +49,7 @@ public:
 
 virtual bool InsertAccObj(css::accessibility::XAccessible* pXAcc,
   css::accessibility::XAccessible* pParentXAcc,
-  HWND hWnd = 0);
+  HWND hWnd = nullptr);
 virtual void GetIAccessibleFromResID(long childID,IMAccessible**);
 virtual bool 
GetIAccessibleFromXAccessible(css::accessibility::XAccessible* pXAcc, 
IAccessible** ppIA);
 
@@ -59,7 +59,7 @@ public:
 bool NotifyAccEvent(short pEvent = 0, css::accessibility::XAccessible* 
pXAcc = nullptr);
 
 bool InsertChildrenAccObj(css::accessibility::XAccessible* pXAcc,
-  HWND  hWnd = 0);
+  HWND  hWnd = nullptr);
 void DeleteChildrenAccObj( css::accessibility::XAccessible* pXAcc );
 
 void  DecreaseState( css::accessibility::XAccessible* pXAcc,unsigned short 
pState );


[Libreoffice-commits] core.git: sal/cppunittester

2021-09-30 Thread Stephan Bergmann (via logerrit)
 sal/cppunittester/cppunittester.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 631b3887ab417678cc993ef68c0fd7f86ac56c86
Author: Stephan Bergmann 
AuthorDate: Thu Sep 30 10:09:07 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Sep 30 14:50:31 2021 +0200

-Werror,-Wformat (clang-cl)

> sal/cppunittester/cppunittester.cxx(553,115): error: format specifies 
type 'unsigned int' but the argument has type 'ULONG64' (aka 'unsigned long 
long') [-Werror,-Wformat]
> printf("\tat %s in %s: line: %lu: address: 0x%0X\n", 
pSymbol->Name, line->FileName, line->LineNumber, pSymbol->Address);
>  ~~~  
^~~~
>  %0llX
> sal/cppunittester/cppunittester.cxx(558,64): error: format specifies type 
'unsigned int' but the argument has type 'ULONG64' (aka 'unsigned long long') 
[-Werror,-Wformat]
> printf("\tat %s, address 0x%0X.\n", pSymbol->Name, 
pSymbol->Address);
>~~~ 
^~~~
>%0llX
> sal/cppunittester/cppunittester.cxx(576,50): error: format specifies type 
'unsigned int' but the argument has type 'DWORD' (aka 'unsigned long') 
[-Werror,-Wformat]
> printf("*** Exception 0x%x occurred 
***\n\n",ex->ExceptionRecord->ExceptionCode);
> ~~   
^~
> %lx

...but where SYMBOL_INFO::Address is documented to be of type ULONG64, 
which in
turn is documented to be a typedef for unsigned __int64, for which there
is the MSVC-extension I64 format specifier

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

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 1e1d5e65f59e..3ec11a3ffc3a 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -550,12 +550,12 @@ static void printStack( CONTEXT* ctx )
 //try to get line
 if (SymGetLineFromAddr64(process, stack.AddrPC.Offset, , 
line.get()))
 {
-printf("\tat %s in %s: line: %lu: address: 0x%0X\n", 
pSymbol->Name, line->FileName, line->LineNumber, pSymbol->Address);
+printf("\tat %s in %s: line: %lu: address: 0x%0I64X\n", 
pSymbol->Name, line->FileName, line->LineNumber, pSymbol->Address);
 }
 else
 {
 //failed to get line
-printf("\tat %s, address 0x%0X.\n", pSymbol->Name, 
pSymbol->Address);
+printf("\tat %s, address 0x%0I64X.\n", pSymbol->Name, 
pSymbol->Address);
 hModule = NULL;
 lstrcpyA(module,"");
 GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | 
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
@@ -573,7 +573,7 @@ static void printStack( CONTEXT* ctx )
 static LONG WINAPI ExpFilter(EXCEPTION_POINTERS* ex)
 {
 // we only want this active on the Jenkins tinderboxes
-printf("*** Exception 0x%x occurred 
***\n\n",ex->ExceptionRecord->ExceptionCode);
+printf("*** Exception 0x%lx occurred 
***\n\n",ex->ExceptionRecord->ExceptionCode);
 printStack(ex->ContextRecord);
 return EXCEPTION_EXECUTE_HANDLER;
 }


[Libreoffice-commits] core.git: sal/cppunittester

2021-09-30 Thread Stephan Bergmann (via logerrit)
 sal/cppunittester/cppunittester.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 471a0e328cf66f8a288ef0306decf557362c13af
Author: Stephan Bergmann 
AuthorDate: Thu Sep 30 10:03:06 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Sep 30 12:20:03 2021 +0200

loplugin:external (clang-cl)

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

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 7982982c5305..63567d681cfd 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -485,7 +485,7 @@ static bool main2()
 #if defined(_WIN32) && defined(_DEBUG)
 
 //Prints stack trace based on exception context record
-void printStack( CONTEXT* ctx )
+static void printStack( CONTEXT* ctx )
 {
 constexpr int MaxNameLen = 256;
 boolresult;
@@ -570,7 +570,7 @@ void printStack( CONTEXT* ctx )
 }
 
 // The exception filter function:
-LONG WINAPI ExpFilter(EXCEPTION_POINTERS* ex)
+static LONG WINAPI ExpFilter(EXCEPTION_POINTERS* ex)
 {
 // we only want this active on the Jenkins tinderboxes
 printf("*** Exception 0x%x occurred 
***\n\n",ex->ExceptionRecord->ExceptionCode);
@@ -578,7 +578,7 @@ LONG WINAPI ExpFilter(EXCEPTION_POINTERS* ex)
 return EXCEPTION_EXECUTE_HANDLER;
 }
 
-void AbortSignalHandler(int signal)
+static void AbortSignalHandler(int signal)
 {
 if (signal == SIGABRT) {
 std::unique_ptr bs = sal::backtrace_get(50);


[Libreoffice-commits] core.git: sal/cppunittester

2021-09-30 Thread Stephan Bergmann (via logerrit)
 sal/cppunittester/cppunittester.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 486e694ba3b029e32eb6647f70dd03298de50f50
Author: Stephan Bergmann 
AuthorDate: Thu Sep 30 09:58:12 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Sep 30 12:17:38 2021 +0200

loplugin:cstylecast (clang-cl)

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

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 4c24815c3b7b..7982982c5305 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -498,7 +498,7 @@ void printStack( CONTEXT* ctx )
 DWORD disp;
 char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(TCHAR)];
 char module[MaxNameLen];
-PSYMBOL_INFO pSymbol = (PSYMBOL_INFO)buffer;
+PSYMBOL_INFO pSymbol = reinterpret_cast(buffer);
 
 memset( , 0, sizeof( STACKFRAME64 ) );
 
@@ -545,7 +545,7 @@ void printStack( CONTEXT* ctx )
 //get symbol name for address
 pSymbol->SizeOfStruct = sizeof(SYMBOL_INFO);
 pSymbol->MaxNameLen = MAX_SYM_NAME;
-SymFromAddr(process, ( ULONG64 )stack.AddrPC.Offset, , 
pSymbol);
+SymFromAddr(process, static_cast< ULONG64 >(stack.AddrPC.Offset), 
, pSymbol);
 
 //try to get line
 if (SymGetLineFromAddr64(process, stack.AddrPC.Offset, , 
line.get()))
@@ -559,7 +559,7 @@ void printStack( CONTEXT* ctx )
 hModule = NULL;
 lstrcpyA(module,"");
 GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | 
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
-(LPCTSTR)(stack.AddrPC.Offset), );
+reinterpret_cast(stack.AddrPC.Offset), );
 
 //at least print module name
 if(hModule != NULL)GetModuleFileNameA(hModule,module,MaxNameLen);


[Libreoffice-commits] core.git: sal/cppunittester winaccessibility/source

2021-09-30 Thread Stephan Bergmann (via logerrit)
 sal/cppunittester/cppunittester.cxx |2 +-
 winaccessibility/source/service/AccObjectWinManager.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit d242a19dbdd53b7ae0b6a6ceacca6aa1b6ac54a9
Author: Stephan Bergmann 
AuthorDate: Thu Sep 30 09:54:49 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Sep 30 11:08:53 2021 +0200

loplugin:includeform (clang-cl)

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

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 33be3007ba13..4c24815c3b7b 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -24,7 +24,7 @@
 #include 
 #endif
 #if defined(_WIN32) && defined(_DEBUG)
-#include "dbghelp.h"
+#include 
 #include 
 #include 
 #endif
diff --git a/winaccessibility/source/service/AccObjectWinManager.cxx 
b/winaccessibility/source/service/AccObjectWinManager.cxx
index 89d3e7db5d5e..cbf50ac343b4 100644
--- a/winaccessibility/source/service/AccObjectWinManager.cxx
+++ b/winaccessibility/source/service/AccObjectWinManager.cxx
@@ -19,7 +19,7 @@
 
 #include 
 
-#include "com/sun/star/accessibility/XAccessible.hpp"
+#include 
 #include 
 #include 
 #include 


[Libreoffice-commits] core.git: sal/cppunittester

2021-09-30 Thread Stephan Bergmann (via logerrit)
 sal/cppunittester/cppunittester.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8ab6e84bf610608ccaca1546ef279179dc68477b
Author: Stephan Bergmann 
AuthorDate: Thu Sep 30 09:53:47 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Sep 30 10:59:28 2021 +0200

loplugin:fakebool (clang-cl)

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

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 2002eb0efb2d..33be3007ba13 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -488,7 +488,7 @@ static bool main2()
 void printStack( CONTEXT* ctx )
 {
 constexpr int MaxNameLen = 256;
-BOOLresult;
+boolresult;
 HANDLE  process;
 HANDLE  thread;
 HMODULE hModule;


[Libreoffice-commits] core.git: sal/cppunittester

2021-09-03 Thread Caolán McNamara (via logerrit)
 sal/cppunittester/cppunittester.cxx |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 74260098ffcc14b4991ff424f5326a62bc003399
Author: Caolán McNamara 
AuthorDate: Fri Sep 3 11:40:20 2021 +0100
Commit: Caolán McNamara 
CommitDate: Fri Sep 3 20:59:48 2021 +0200

log PATH length and content when complaining about it

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

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 9e4c6e2c048b..2002eb0efb2d 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -271,15 +271,16 @@ public:
 manager->load(testlib, args);
 } catch (const CppUnit::DynamicLibraryManagerException ) {
 std::cerr << "DynamicLibraryManagerException: \"" << e.what() << 
"\"\n";
-#ifdef _WIN32
 const char *pPath = getenv ("PATH");
-if (pPath && strlen (pPath) > 256)
+const size_t nPathLen = pPath ? strlen(pPath) : 0;
+#ifdef _WIN32
+if (nPathLen > 256)
 {
 std::cerr << "Windows has significant build problems with long 
PATH variables ";
 std::cerr << "please check your PATH variable and 
re-autogen.\n";
 }
 #endif
-std::cerr << "Path is '" << getenv("PATH") << "'\n";
+std::cerr << "Path (length: " << nPathLen << ") is '" << pPath << 
"'\n";
 return false;
 }
 #endif


[Libreoffice-commits] core.git: sal/cppunittester

2021-08-02 Thread Noel Grandin (via logerrit)
 sal/cppunittester/cppunittester.cxx |   13 +
 1 file changed, 13 insertions(+)

New commits:
commit 0e883d6dbee8d72257f77605ae0c8a1d5bfbf044
Author: Noel Grandin 
AuthorDate: Mon Aug 2 12:29:57 2021 +0200
Commit: Noel Grandin 
CommitDate: Mon Aug 2 13:52:15 2021 +0200

display stack trace on assert for windows jenkins builds

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

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index d2727f1cd98e..f5f34c802c83 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -25,6 +25,8 @@
 #endif
 #if defined(_WIN32) && defined(_DEBUG)
 #include "dbghelp.h"
+#include 
+#include 
 #endif
 
 #ifdef UNX
@@ -576,8 +578,19 @@ LONG WINAPI ExpFilter(EXCEPTION_POINTERS* ex)
 return EXCEPTION_EXECUTE_HANDLER;
 }
 
+void AbortSignalHandler(int signal)
+{
+if (signal == SIGABRT) {
+std::unique_ptr bs = sal::backtrace_get(50);
+SAL_WARN("sal", "CAUGHT SIGABRT:\n" << 
sal::backtrace_to_string(bs.get()));
+}
+}
+
 SAL_IMPLEMENT_MAIN()
 {
+// catch the kind of signal that is thrown when an assert fails, and log a 
stacktrace
+signal(SIGABRT, AbortSignalHandler);
+
 bool ok = false;
 // This magic kind of Windows-specific exception handling has to be in its 
own function
 // because it cannot be in a function that has objects with destructors.


[Libreoffice-commits] core.git: sal/cppunittester

2021-07-29 Thread Andrea Gelmini (via logerrit)
 sal/cppunittester/cppunittester.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 6f8f757c7338dd890273235bae6917b3175e2f86
Author: Andrea Gelmini 
AuthorDate: Wed Jul 28 21:13:15 2021 +0200
Commit: Julien Nabet 
CommitDate: Thu Jul 29 09:52:20 2021 +0200

Fix typos

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

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index c899f320ad0c..d2727f1cd98e 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -570,8 +570,8 @@ void printStack( CONTEXT* ctx )
 // The exception filter function:
 LONG WINAPI ExpFilter(EXCEPTION_POINTERS* ex)
 {
-// we only want this active on the Jenkins tinderboxen
-printf("*** Exception 0x%x occured 
***\n\n",ex->ExceptionRecord->ExceptionCode);
+// we only want this active on the Jenkins tinderboxes
+printf("*** Exception 0x%x occurred 
***\n\n",ex->ExceptionRecord->ExceptionCode);
 printStack(ex->ContextRecord);
 return EXCEPTION_EXECUTE_HANDLER;
 }
@@ -579,7 +579,7 @@ LONG WINAPI ExpFilter(EXCEPTION_POINTERS* ex)
 SAL_IMPLEMENT_MAIN()
 {
 bool ok = false;
-// This magic kind of Windows-specific exception handling has to be in 
it's own function
+// This magic kind of Windows-specific exception handling has to be in its 
own function
 // because it cannot be in a function that has objects with destructors.
 __try
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/cppunittester sal/Executable_cppunittester.mk

2021-07-28 Thread Noel Grandin (via logerrit)
 sal/Executable_cppunittester.mk |6 
 sal/cppunittester/cppunittester.cxx |  284 +---
 2 files changed, 211 insertions(+), 79 deletions(-)

New commits:
commit 24b06b9c6bdb777dff385b0fbfc81d55d3d013a1
Author: Noel Grandin 
AuthorDate: Tue Jul 27 15:15:21 2021 +0200
Commit: Noel Grandin 
CommitDate: Wed Jul 28 18:34:08 2021 +0200

log access violation on windows tinderboxen

where we currently have no good feedback when something
goes wrong.

Credit: Exception printing code written by
  msdn-whiteknight
as seen at
  
https://stackoverflow.com/questions/22467604/how-can-you-use-capturestackbacktrace-to-capture-the-exception-stack-not-the-ca

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

diff --git a/sal/Executable_cppunittester.mk b/sal/Executable_cppunittester.mk
index 3b9016783b80..959b3cd8be47 100644
--- a/sal/Executable_cppunittester.mk
+++ b/sal/Executable_cppunittester.mk
@@ -28,6 +28,12 @@ $(eval $(call 
gb_Executable_add_exception_objects,cppunittester,\
sal/cppunittester/cppunittester \
 ))
 
+ifneq ($(strip $(debug)$(DEBUG)),)
+$(eval $(call gb_Executable_use_system_win32_libs,cppunittester,\
+   dbghelp \
+))
+endif
+
 ifeq ($(COM),MSC)
 
 $(eval $(call gb_Executable_add_ldflags,cppunittester,\
diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 7ab54da02106..c899f320ad0c 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -23,6 +23,9 @@
 #endif
 #include 
 #endif
+#if defined(_WIN32) && defined(_DEBUG)
+#include "dbghelp.h"
+#endif
 
 #ifdef UNX
 #include 
@@ -378,109 +381,232 @@ void reportResourceUsage([[maybe_unused]] const 
OUString& /*rPath*/)
 
 }
 
-SAL_IMPLEMENT_MAIN()
+static bool main2()
 {
 bool ok = false;
 OUString path;
-try
-{
+
 #ifdef _WIN32
-//Disable Dr-Watson in order to crash simply without popup dialogs 
under
-//windows
-DWORD dwMode = SetErrorMode(SEM_NOGPFAULTERRORBOX);
-SetErrorMode(SEM_NOGPFAULTERRORBOX|dwMode);
+//Disable Dr-Watson in order to crash simply without popup dialogs under
+//windows
+DWORD dwMode = SetErrorMode(SEM_NOGPFAULTERRORBOX);
+SetErrorMode(SEM_NOGPFAULTERRORBOX|dwMode);
 #ifdef _DEBUG // These functions are present only in the debugging runtime
-_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG|_CRTDBG_MODE_FILE);
-_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
-_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG|_CRTDBG_MODE_FILE);
-_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
-_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG|_CRTDBG_MODE_FILE);
-_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
+_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG|_CRTDBG_MODE_FILE);
+_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
+_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG|_CRTDBG_MODE_FILE);
+_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
+_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG|_CRTDBG_MODE_FILE);
+_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
 #endif
 #endif
 
-std::vector protectors;
-CppUnit::TestResult result;
-std::string args;
-std::string testlib;
-sal_uInt32 index = 0;
-while (index < osl_getCommandArgCount())
+std::vector protectors;
+CppUnit::TestResult result;
+std::string args;
+std::string testlib;
+sal_uInt32 index = 0;
+while (index < osl_getCommandArgCount())
+{
+OUString arg = getArgument(index);
+if (arg.startsWith("-env:CPPUNITTESTTARGET=", ))
 {
-OUString arg = getArgument(index);
-if (arg.startsWith("-env:CPPUNITTESTTARGET=", ))
-{
-++index;
-continue;
-}
-if (arg.startsWith("-env:"))
+++index;
+continue;
+}
+if (arg.startsWith("-env:"))
+{
+++index;
+continue; // ignore it here - will be read later
+}
+if ( arg != "--protector" )
+{
+if (testlib.empty())
 {
-++index;
-continue; // ignore it here - will be read later
+testlib = OUStringToOString(arg, 
osl_getThreadTextEncoding()).getStr();
+args += testlib;
 }
-if ( arg != "--protector" )
+else
 {
-if (testlib.empty())
-{
-testlib = OUStringToOString(arg, 
osl_getThreadTextEncoding()).getStr();
-args += testlib;
-}
-else
-{
-args += ' ';
-

[Libreoffice-commits] core.git: sal/cppunittester

2020-11-25 Thread Stephan Bergmann (via logerrit)
 sal/cppunittester/cppunittester.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 39c9596eb7746c16e68e71d76777be58fc94b7c9
Author: Stephan Bergmann 
AuthorDate: Wed Nov 25 10:14:57 2020 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Nov 25 14:04:32 2020 +0100

Silence false loplugin:stringviewparam in conditional code (clang-cl)

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

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 468b54ca9ecc..c6fd3b9a269e 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -370,7 +370,7 @@ void reportResourceUsage(const OUString& rPath)
 resource_file << "KernelSpace = " << nKernelSpace << std::endl;
 }
 #else
-void reportResourceUsage(const OUString& /*rPath*/)
+void reportResourceUsage([[maybe_unused]] const OUString& /*rPath*/)
 {
 }
 #endif
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/cppunittester sw/qa

2020-09-25 Thread Justin Luth (via logerrit)
 sal/cppunittester/cppunittester.cxx |3 ++-
 sw/qa/inc/swmodeltestbase.hxx   |5 +
 sw/qa/unit/swmodeltestbase.cxx  |2 ++
 3 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 34894211362ade76580eddf7e4f3a23da3872a98
Author: Justin Luth 
AuthorDate: Wed Sep 23 15:32:33 2020 +0300
Commit: Miklos Vajna 
CommitDate: Fri Sep 25 11:17:01 2020 +0200

cppunittester: [_RUN_] indicates unit test start

-visual: so that the human eye can easily find it
-at start: to identify the last test if it ends abruptly
-no spaces: easy scripting | grep RUN | awk '{print $2}'

A visually unique, eye-catching start banner
will be helpful when browsing through logs,
or when adding asserts and running a make sw.check.

[I frequently look for existing unit tests that match
a certain condition in the 15 ooxmlexport tests.]

Previously, the tests ran in the order that they existed
in the file. So if one asserted/crashed in the middle of
the run, you could easily guess which test it was
by finding the name of the test that just finished OK.

However, since
   2f2246d22e2a8ccbc1dc3e6f5243734a61edf270
   Author: Stephan Bergmann on Sat Aug 8 12:00:23 2020
  external/cppunit: Run tests in deterministic order
the tests are sorted by name and run in
alphabetical order - which is not at all obvious or
intuitive. It certainly makes it harder to guess
what the next alphabetical name will be.

P.S. For consistency, I considered adding [DONE_]
as well, but existing tooling might search for
"finished in:" and grab the first string (the test name)
so I don't want to break anything doing that.

Change-Id: I5521e681cd9f8304842290680f0389256fe3fe43
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103268
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index d325808198b7..468b54ca9ecc 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -98,8 +98,9 @@ public:
 TimingListener(const TimingListener&) = delete;
 TimingListener& operator=(const TimingListener&) = delete;
 
-void startTest( CppUnit::Test *) override
+void startTest( CppUnit::Test *test) override
 {
+std::cout << "[_RUN_] " << test->getName() << std::endl;
 m_nStartTime = osl_getGlobalTimer();
 }
 
diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx
index 20fdbd608099..cff9a4ca14c1 100644
--- a/sw/qa/inc/swmodeltestbase.hxx
+++ b/sw/qa/inc/swmodeltestbase.hxx
@@ -338,10 +338,7 @@ protected:
 /// Get TextFrame by name
 css::uno::Reference getTextFrameByName(const 
OUString& aName);
 
-void header()
-{
-std::cout << "File tested,Execution Time (ms)" << std::endl;
-}
+void header();
 
 void load(const OUString& pDir, const char* pName, const char* pPassword = 
nullptr)
 {
diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx
index 709d47321617..306e03476cef 100644
--- a/sw/qa/unit/swmodeltestbase.cxx
+++ b/sw/qa/unit/swmodeltestbase.cxx
@@ -479,6 +479,8 @@ void SwModelTestBase::setTestInteractionHandler(const char* 
pPassword,
 rFilterOptions[0].Value <<= xInteraction;
 }
 
+void SwModelTestBase::header() {}
+
 void SwModelTestBase::loadURL(OUString const& rURL, const char* pName, const 
char* pPassword)
 {
 if (mxComponent.is())
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/cppunittester

2020-09-23 Thread Stephan Bergmann (via logerrit)
 sal/cppunittester/cppunittester.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 415a91745011e09381859a4fb34577ceccbaaa67
Author: Stephan Bergmann 
AuthorDate: Wed Sep 23 16:33:39 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Sep 23 18:02:46 2020 +0200

Silence cid#1467434

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

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 0a833de5fba2..d325808198b7 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -311,6 +311,7 @@ public:
 if (!added)
 {
 std::cerr << "\nFatal error: CPPUNIT_TEST_NAME contains no 
valid tests\n";
+// coverity[leaked_storage] - `manager` leaked on purpose
 return false;
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/cppunittester

2020-09-21 Thread Stephan Bergmann (via logerrit)
 sal/cppunittester/cppunittester.cxx |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 43d08f386117cb1de1fe2ba8248554c1aef1
Author: Stephan Bergmann 
AuthorDate: Mon Sep 21 14:03:14 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Sep 21 15:26:05 2020 +0200

cppunittester: Do not unload test libraries

At least on Windows, e6dfaf9f44f9939abc338c83b3024108431d0f69 "Turn
OUStringLiteral into a consteval'ed, static-refcound rtl_uString" caused
CppunitTest_sc_tablesheetsobj to fail at exit, when the

  static OUString aCacheName

in ScDocument::GetTable (sc/source/core/data/document.cxx) is destroyed but
references

  constexpr OUStringLiteral gaSrcSheetName(u"SheetToCopy")

from test/source/sheet/xspreadsheets2.cxx in Library_subsequenttest, 
referenced
(only) by the CppunitTest_sc_tablesheetsobj library, and both those 
libraries
had already been unloaded from memory.

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

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index a760ecf8ff41..0a833de5fba2 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -254,9 +254,14 @@ public:
 // call the initialize methods of the CppUnitTestPlugIns that
 // we statically link to the app executable.
 #else
-CppUnit::PlugInManager manager;
+// The PlugInManager instance is deliberately leaked, so that the 
dynamic libraries it loads
+// are never unloaded (which could make e.g. pointers from other 
libraries' static data
+// structures to const data in those libraries, like some static 
OUString cache pointing at
+// a const OUStringLiteral, become dangling by the time those static 
data structures are
+// destroyed during exit):
+auto manager = new CppUnit::PlugInManager;
 try {
-manager.load(testlib, args);
+manager->load(testlib, args);
 } catch (const CppUnit::DynamicLibraryManagerException ) {
 std::cerr << "DynamicLibraryManagerException: \"" << e.what() << 
"\"\n";
 #ifdef _WIN32
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/cppunittester sal/Executable_cppunittester.mk

2020-05-24 Thread Mike Kaganski (via logerrit)
 sal/Executable_cppunittester.mk |4 
 sal/cppunittester/cppunittester.cxx |   10 --
 2 files changed, 4 insertions(+), 10 deletions(-)

New commits:
commit b3c8859cd20bd02adea5d2b026001f67feacc754
Author: Mike Kaganski 
AuthorDate: Sun May 24 11:42:02 2020 +0200
Commit: Mike Kaganski 
CommitDate: Sun May 24 12:30:32 2020 +0200

Revert "Try to blind-solve cppunittester hangs on Windows"

This reverts commit 1126515226b60630b3a0fd72c45258b230dfe8fd.

Reason for revert: it only took one run after merging the patch to see it
still hangs...

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

diff --git a/sal/Executable_cppunittester.mk b/sal/Executable_cppunittester.mk
index 65426e722240..3b9016783b80 100644
--- a/sal/Executable_cppunittester.mk
+++ b/sal/Executable_cppunittester.mk
@@ -28,10 +28,6 @@ $(eval $(call 
gb_Executable_add_exception_objects,cppunittester,\
sal/cppunittester/cppunittester \
 ))
 
-$(eval $(call gb_Executable_use_system_win32_libs,cppunittester,\
-   ole32 \
-))
-
 ifeq ($(COM),MSC)
 
 $(eval $(call gb_Executable_add_ldflags,cppunittester,\
diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 1b3c518c4b21..a760ecf8ff41 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -18,9 +18,10 @@
  */
 
 #ifdef _WIN32
-#include 
-#include 
-#include 
+#if !defined WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+#endif
+#include 
 #endif
 
 #ifdef UNX
@@ -388,9 +389,6 @@ SAL_IMPLEMENT_MAIN()
 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG|_CRTDBG_MODE_FILE);
 _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
 #endif
-
-// Tests may use e.g. OLE or clipboard; initialize COM and appropriate 
concurrency early
-OleInitialize(nullptr);
 #endif
 
 std::vector protectors;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/cppunittester sal/Executable_cppunittester.mk

2020-05-24 Thread Mike Kaganski (via logerrit)
 sal/Executable_cppunittester.mk |4 
 sal/cppunittester/cppunittester.cxx |   10 ++
 2 files changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 1126515226b60630b3a0fd72c45258b230dfe8fd
Author: Mike Kaganski 
AuthorDate: Sun May 24 09:18:10 2020 +0200
Commit: Mike Kaganski 
CommitDate: Sun May 24 10:28:59 2020 +0200

Try to blind-solve cppunittester hangs on Windows

... calling OleInitialize early in sal_main to initialize COM and 
concurrency.

Seeing intermittent hangs in main thread in CAPNDataObject::GetData calling
m_rIDataObjectOrg->GetData, and the inner stack waiting objects in the code
doing apartment switching (I forgot to save a stack to paste unfortunately),
I suspect that being related to incorrect concurrency model. OleInitialize
docs [1] mention:

  Applications that use the following functionality must call OleInitialize
  before calling any other function in the COM library:

  * Clipboard
  * Drag and Drop
  * Object linking and embedding (OLE)
  * In-place activation

  ...

  Because OLE operations are not thread-safe, OleInitialize specifies the
  concurrency model as single-thread apartment.

CoInitializeEx sets COINIT_MULTITHREADED by default, so possibly that might
get called somewhere before clipboard/OLE code is called. I hope that this
change would fix those hangs.

[1] 
https://docs.microsoft.com/en-us/windows/win32/api/ole2/nf-ole2-oleinitialize

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

diff --git a/sal/Executable_cppunittester.mk b/sal/Executable_cppunittester.mk
index 3b9016783b80..65426e722240 100644
--- a/sal/Executable_cppunittester.mk
+++ b/sal/Executable_cppunittester.mk
@@ -28,6 +28,10 @@ $(eval $(call 
gb_Executable_add_exception_objects,cppunittester,\
sal/cppunittester/cppunittester \
 ))
 
+$(eval $(call gb_Executable_use_system_win32_libs,cppunittester,\
+   ole32 \
+))
+
 ifeq ($(COM),MSC)
 
 $(eval $(call gb_Executable_add_ldflags,cppunittester,\
diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index a760ecf8ff41..1b3c518c4b21 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -18,10 +18,9 @@
  */
 
 #ifdef _WIN32
-#if !defined WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
-#endif
-#include 
+#include 
+#include 
+#include 
 #endif
 
 #ifdef UNX
@@ -389,6 +388,9 @@ SAL_IMPLEMENT_MAIN()
 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG|_CRTDBG_MODE_FILE);
 _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
 #endif
+
+// Tests may use e.g. OLE or clipboard; initialize COM and appropriate 
concurrency early
+OleInitialize(nullptr);
 #endif
 
 std::vector protectors;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/cppunittester

2017-04-27 Thread Michael Stahl
 sal/cppunittester/cppunittester.cxx |   16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

New commits:
commit 86931aded4e603d244c9aef17c872f0b3807bee9
Author: Michael Stahl 
Date:   Thu Apr 27 16:39:44 2017 +0200

sal: cppunittester: verify that CPPUNIT_TEST_NAME contains a test

Fail the test if CPPUNIT_TEST_NAME does not contain at least one
existing test, which is much better than silently reporting OK(0).

Change-Id: If2137764b24aa52dc35fe2368ee8fe38cb7dbece

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 11078c7cf74b..7b321643a37a 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -197,15 +197,20 @@ struct test_name_compare
 std::string maName;
 };
 
-void addRecursiveTests(const std::vector& test_names, 
CppUnit::Test* pTest, CppUnit::TestRunner& rRunner)
+bool addRecursiveTests(const std::vector& test_names, 
CppUnit::Test* pTest, CppUnit::TestRunner& rRunner)
 {
+bool ret(false);
 for (int i = 0; i < pTest->getChildTestCount(); ++i)
 {
 CppUnit::Test* pNewTest = pTest->getChildTestAt(i);
-addRecursiveTests(test_names, pNewTest, rRunner);
+ret |= addRecursiveTests(test_names, pNewTest, rRunner);
 if (std::find_if(test_names.begin(), test_names.end(), 
test_name_compare(pNewTest->getName())) != test_names.end())
+{
 rRunner.addTest(pNewTest);
+ret = true;
+}
 }
+return ret;
 }
 
 }
@@ -297,7 +302,12 @@ public:
 std::vector test_names;
 boost::split(test_names, pVal, boost::is_any_of("\t "));
 CppUnit::Test* pTest = 
CppUnit::TestFactoryRegistry::getRegistry().makeTest();
-addRecursiveTests(test_names, pTest, runner);
+bool const added(addRecursiveTests(test_names, pTest, runner));
+if (!added)
+{
+std::cerr << "\nFatal error: CPPUNIT_TEST_NAME contains no 
valid tests\n";
+return false;
+}
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/cppunittester

2017-03-22 Thread Stephan Bergmann
 sal/cppunittester/cppunittester.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit fd70d8ee8925f7c7931f3db772516927c05b0fcb
Author: Stephan Bergmann 
Date:   Wed Mar 22 21:37:00 2017 +0100

Use rtl::isAscii* instead of ctype.h is* (and fix passing plain char)

Change-Id: I93eeb586310cb1896b067b7c665e1fdee92d47b4

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index d08d5c0b1f26..11078c7cf74b 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -34,6 +34,7 @@
 #include "osl/module.h"
 #include "osl/module.hxx"
 #include "osl/thread.h"
+#include "rtl/character.hxx"
 #include "rtl/process.h"
 #include "rtl/string.h"
 #include "rtl/string.hxx"
@@ -127,7 +128,7 @@ public:
 int len = strlen(tn.get());
 for(int i = 0; i < len; i++)
 {
-if(!isalnum(tn[i]))
+if(!rtl::isAsciiAlphanumeric(static_cast(tn[i])))
 {
 tn[i] = '_';
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/cppunittester sd/source sw/source vcl/headless xmlsecurity/source

2016-02-08 Thread Caolán McNamara
 sal/cppunittester/cppunittester.cxx  |2 +-
 sd/source/ui/animations/CategoryListBox.hxx  |2 +-
 sw/source/core/unocore/unotbl.cxx|2 +-
 vcl/headless/svpgdi.cxx  |4 ++--
 xmlsecurity/source/helper/ooxmlsecparser.hxx |2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 16b93ae648f3e9675eeb6980925957e2ccbcfdf2
Author: Caolán McNamara 
Date:   Mon Feb 8 10:33:02 2016 +

cppcheck: noExplicitConstructor

Change-Id: I74585aa5a50cd335f4fd0a3ba4fed230b98993c3

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 22af500..fa0c5793 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -173,7 +173,7 @@ namespace {
 
 struct test_name_compare
 {
-test_name_compare(const std::string& rName):
+explicit test_name_compare(const std::string& rName):
 maName(rName)
 {
 }
diff --git a/sd/source/ui/animations/CategoryListBox.hxx 
b/sd/source/ui/animations/CategoryListBox.hxx
index 4b9debb..f044ac4 100644
--- a/sd/source/ui/animations/CategoryListBox.hxx
+++ b/sd/source/ui/animations/CategoryListBox.hxx
@@ -9,7 +9,7 @@ namespace sd {
 class CategoryListBox : public ListBox
 {
 public:
-CategoryListBox( vcl::Window* pParent );
+explicit CategoryListBox( vcl::Window* pParent );
 virtual ~CategoryListBox();
 
 virtual voidMouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
diff --git a/sw/source/core/unocore/unotbl.cxx 
b/sw/source/core/unocore/unotbl.cxx
index 31372e1..6f88f48 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -1974,7 +1974,7 @@ public:
 unsigned short m_nRows;
 unsigned short m_nColumns;
 
-Impl(SwFrameFormat *const pFrameFormat)
+explicit Impl(SwFrameFormat *const pFrameFormat)
 : SwClient(pFrameFormat)
 , m_Listeners(m_Mutex)
 , m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE))
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 5baa761..b99ea09 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -103,7 +103,7 @@ namespace
 class SourceHelper
 {
 public:
-SourceHelper(const SalBitmap& rSourceBitmap)
+explicit SourceHelper(const SalBitmap& rSourceBitmap)
 {
 const SvpSalBitmap& rSrcBmp = static_cast(rSourceBitmap);
 
@@ -142,7 +142,7 @@ namespace
 class MaskHelper
 {
 public:
-MaskHelper(const SalBitmap& rAlphaBitmap)
+explicit MaskHelper(const SalBitmap& rAlphaBitmap)
 {
 const SvpSalBitmap& rMask = static_cast(rAlphaBitmap);
 const BitmapBuffer* pMaskBuf = rMask.GetBuffer();
diff --git a/xmlsecurity/source/helper/ooxmlsecparser.hxx 
b/xmlsecurity/source/helper/ooxmlsecparser.hxx
index 73ac0b2..dbb0151 100644
--- a/xmlsecurity/source/helper/ooxmlsecparser.hxx
+++ b/xmlsecurity/source/helper/ooxmlsecparser.hxx
@@ -45,7 +45,7 @@ class OOXMLSecParser: public cppu::WeakImplHelper
 bool m_bReferenceUnresolved;
 
 public:
-OOXMLSecParser(XSecController* pXSecController);
+explicit OOXMLSecParser(XSecController* pXSecController);
 virtual ~OOXMLSecParser();
 
 // XDocumentHandler
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/cppunittester

2016-01-26 Thread Markus Mohrhard
 sal/cppunittester/cppunittester.cxx |   18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

New commits:
commit 2a3a9dec50068321125e4a76de7042bf2d741bc7
Author: Markus Mohrhard 
Date:   Tue Jan 26 10:30:47 2016 +0100

support unnamed namespaces with CPPUNIT_TEST_NAME

Change-Id: I1ce50ce0ce8a4a461d1b2a34de132cbf57dd7d25
Reviewed-on: https://gerrit.libreoffice.org/21802
Reviewed-by: Markus Mohrhard 
Tested-by: Markus Mohrhard 

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 34911e2..fb9f85f 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -171,13 +171,29 @@ private:
 
 namespace {
 
+struct test_name_compare
+{
+test_name_compare(const std::string& rName):
+maName(rName)
+{
+}
+
+bool operator()(const std::string& rCmp)
+{
+size_t nEndPos = maName.find(rCmp) + rCmp.size();
+return nEndPos == maName.size();
+}
+
+std::string maName;
+};
+
 void addRecursiveTests(const std::vector& test_names, 
CppUnit::Test* pTest, CppUnit::TestRunner& rRunner)
 {
 for (int i = 0; i < pTest->getChildTestCount(); ++i)
 {
 CppUnit::Test* pNewTest = pTest->getChildTestAt(i);
 addRecursiveTests(test_names, pNewTest, rRunner);
-if (std::find(test_names.begin(), test_names.end(), 
pNewTest->getName()) != test_names.end())
+if (std::find_if(test_names.begin(), test_names.end(), 
test_name_compare(pNewTest->getName())) != test_names.end())
 rRunner.addTest(pNewTest);
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/cppunittester

2016-01-26 Thread Markus Mohrhard
 sal/cppunittester/cppunittester.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 0c018784020653a864d373162287272c82161170
Author: Markus Mohrhard 
Date:   Tue Jan 26 17:25:41 2016 +0100

fix the new CPPUNIT_TEST_NAME code

Change-Id: I45260555778a733a8c8ba9e39e9ffcce0c9ab78d
Reviewed-on: https://gerrit.libreoffice.org/21818
Reviewed-by: Markus Mohrhard 
Tested-by: Markus Mohrhard 

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index fb9f85f..22af500 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -180,7 +180,11 @@ struct test_name_compare
 
 bool operator()(const std::string& rCmp)
 {
-size_t nEndPos = maName.find(rCmp) + rCmp.size();
+size_t nPos = maName.find(rCmp);
+if (nPos == std::string::npos)
+return false;
+
+size_t nEndPos = nPos + rCmp.size();
 return nEndPos == maName.size();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/cppunittester sal/osl sal/qa sal/textenc sal/workben scaddins/source sc/inc

2015-09-30 Thread Andrea Gelmini
 sal/cppunittester/cppunittester.cxx |2 -
 sal/osl/all/log.cxx |2 -
 sal/osl/w32/file_url.cxx|2 -
 sal/osl/w32/security.c  |2 -
 sal/qa/osl/file/osl_File_Const.h|2 -
 sal/qa/osl/pipe/osl_Pipe.cxx|2 -
 sal/textenc/tcvtjp6.tab |   30 
 sal/textenc/tcvtutf7.cxx|4 +--
 sal/workben/clipboardwben/testpaste/cbptest.cxx |2 -
 sc/inc/addincol.hxx |2 -
 sc/inc/chgtrack.hxx |2 -
 sc/inc/document.hxx |2 -
 sc/inc/externalrefmgr.hxx   |4 +--
 sc/inc/scmatrix.hxx |2 -
 scaddins/source/datefunc/datefunc.cxx   |2 -
 15 files changed, 31 insertions(+), 31 deletions(-)

New commits:
commit c15d93f252df25b1d0e406abb08e3a3e5df71f5e
Author: Andrea Gelmini 
Date:   Tue Sep 29 17:56:52 2015 +0200

Fix typos

Change-Id: Ia41f4f0ca30ae3346d0720271478ec5bcdab797b
Reviewed-on: https://gerrit.libreoffice.org/18967
Reviewed-by: Samuel Mehrbrodt 
Tested-by: Samuel Mehrbrodt 

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 5b7d412..f505b6d 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -346,7 +346,7 @@ SAL_IMPLEMENT_MAIN()
 //windows
 DWORD dwMode = SetErrorMode(SEM_NOGPFAULTERRORBOX);
 SetErrorMode(SEM_NOGPFAULTERRORBOX|dwMode);
-#ifdef _DEBUG // These functions are present only in the debgging runtime
+#ifdef _DEBUG // These functions are present only in the debugging runtime
 _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG|_CRTDBG_MODE_FILE);
 _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
 _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG|_CRTDBG_MODE_FILE);
diff --git a/sal/osl/all/log.cxx b/sal/osl/all/log.cxx
index 67e384c..58e24a2 100644
--- a/sal/osl/all/log.cxx
+++ b/sal/osl/all/log.cxx
@@ -125,7 +125,7 @@ bool report(sal_detail_LogLevel level, char const * area) {
 switch (*p++) {
 case '\0':
 return senseLen[POSITIVE] >= senseLen[NEGATIVE];
-// if a specific item is both postiive and negative
+// if a specific item is both positive and negative
 // (senseLen[POSITIVE] == senseLen[NEGATIVE]), default to
 // positive
 case '+':
diff --git a/sal/osl/w32/file_url.cxx b/sal/osl/w32/file_url.cxx
index 1581544..edb9b9a 100644
--- a/sal/osl/w32/file_url.cxx
+++ b/sal/osl/w32/file_url.cxx
@@ -959,7 +959,7 @@ oslFileError SAL_CALL osl_searchFileURL(
 
 /* Repeat calling SearchPath ...
Start with MAX_PATH for the buffer. In most cases this
-   will be enough and does not force the loop to runtwice */
+   will be enough and does not force the loop to run twice */
 dwResult = MAX_PATH;
 
 do
diff --git a/sal/osl/w32/security.c b/sal/osl/w32/security.c
index a9058fe..da13ce6 100644
--- a/sal/osl/w32/security.c
+++ b/sal/osl/w32/security.c
@@ -246,7 +246,7 @@ sal_Bool SAL_CALL osl_isAdministrator(oslSecurity Security)
 /* CheckTokenMembership() can be used on W2K and higher (NT4 no longer 
supported by OOo)
and also works on Vista to retrieve the effective user rights. Just 
checking for
membership of Administrators group is not enough on Vista this 
would require additional
-   complicated checks as described in KB arcticle Q118626: 
http://support.microsoft.com/kb/118626/en-us
+   complicated checks as described in KB article Q118626: 
http://support.microsoft.com/kb/118626/en-us
 */
 
 if (AllocateAndInitializeSid(,
diff --git a/sal/qa/osl/file/osl_File_Const.h b/sal/qa/osl/file/osl_File_Const.h
index ae04a07..ccf0e33 100644
--- a/sal/qa/osl/file/osl_File_Const.h
+++ b/sal/qa/osl/file/osl_File_Const.h
@@ -37,7 +37,7 @@ extern "C"
 // common used string resource
 // these common used string will be used as assist resource in test
 // they are mostly OS independent, some of the resource can be reused
-// so, acommon test data repository will be better since it can be
+// so, a common test data repository will be better since it can be
 // shared among all test code
 
 const sal_Char pBuffer_Char[]   = 
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
diff --git a/sal/qa/osl/pipe/osl_Pipe.cxx b/sal/qa/osl/pipe/osl_Pipe.cxx
index a91ea18..169ed3e 100644
--- a/sal/qa/osl/pipe/osl_Pipe.cxx
+++ b/sal/qa/osl/pipe/osl_Pipe.cxx
@@ -888,7 +888,7 @@ namespace osl_StreamPipe
 thread_sleep( 1 );
 myDataSourceThread.aListenPipe.close();
 

[Libreoffice-commits] core.git: sal/cppunittester solenv/gbuild

2015-08-31 Thread Michael Stahl
 sal/cppunittester/cppunittester.cxx |   12 
 solenv/gbuild/CppunitTest.mk|2 +-
 2 files changed, 9 insertions(+), 5 deletions(-)

New commits:
commit d0ebb6e438dc8f7dcb5467ae6f72068cf40dcb7a
Author: Michael Stahl 
Date:   Mon Aug 31 23:09:16 2015 +0200

sal: don't use --target as parameter to cppunittester

CppunitTest_libreofficekit_tiledrendering hangs because the soffice_main
exits due to the unrecognized command line arg --target.

Use a -env:VARIABLE argument instead, which is filtered out by
rtl_getAppCommandArg() so does not reach the soffice_main code.

(regression from 87514b0907dfbb479e2646b5ff951c68babf3417)

Change-Id: I2c801305398dccfb447e4e5c44726f42bf2a72ef

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index a57ea55..e67c476 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -361,15 +361,19 @@ SAL_IMPLEMENT_MAIN()
 std::string args;
 std::string testlib;
 sal_uInt32 index = 0;
-while (index < rtl_getAppCommandArgCount())
+while (index < osl_getCommandArgCount())
 {
 rtl::OUString arg = getArgument(index);
-if (arg == "--target")
+if (arg.startsWith("-env:CPPUNITTESTTARGET=", ))
 {
-path = getArgument(++index);
 ++index;
 continue;
 }
+if (arg.startsWith("-env:"))
+{
+++index;
+continue; // ignore it here - will be read later
+}
 if ( arg != "--protector" )
 {
 if (testlib.empty())
@@ -385,7 +389,7 @@ SAL_IMPLEMENT_MAIN()
 ++index;
 continue;
 }
-if (rtl_getAppCommandArgCount() - index < 3) {
+if (osl_getCommandArgCount() - index < 3) {
 usageFailure();
 }
 rtl::OUString lib(getArgument(index + 1));
diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk
index bea33eb..f5cc1df 100644
--- a/solenv/gbuild/CppunitTest.mk
+++ b/solenv/gbuild/CppunitTest.mk
@@ -102,7 +102,7 @@ $(call gb_CppunitTest_get_target,%) :| 
$(gb_CppunitTest_RUNTIMEDEPS)
PYTHONDONTWRITEBYTECODE=1) \
$(ICECREAM_RUN) $(gb_CppunitTest_GDBTRACE) 
$(gb_CppunitTest_VALGRINDTOOL) $(gb_CppunitTest_CPPTESTCOMMAND) \
$(call gb_LinkTarget_get_target,$(call 
gb_CppunitTest_get_linktarget,$*)) \
-   $(call gb_CppunitTest__make_args) --target $@ \
+   $(call gb_CppunitTest__make_args) "-env:CPPUNITTESTTARGET=$@" \
$(if $(gb_CppunitTest__interactive),, \
> $@.log 2>&1 \
|| ($(if $(value gb_CppunitTest_postprocess), \
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/cppunittester

2015-08-31 Thread Michael Stahl
 sal/cppunittester/cppunittester.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 75a8f6173e6b5d601c3a7d154406f5ae8331eb41
Author: Michael Stahl 
Date:   Mon Aug 31 23:20:10 2015 +0200

sal: oops, forgot to commit that bit

Change-Id: Iee85958a6589624bc9a61242fca41214bdd1df85

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index e67c476..5b7d412 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -70,7 +70,7 @@ void usageFailure() {
 
 rtl::OUString getArgument(sal_Int32 index) {
 rtl::OUString arg;
-rtl_getAppCommandArg(index, );
+osl_getCommandArg(index, );
 return arg;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/cppunittester

2015-08-31 Thread Miklos Vajna
 sal/cppunittester/cppunittester.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e051cceec1ccbf56f613d50f7ce2a857b7a52897
Author: Miklos Vajna 
Date:   Mon Aug 31 10:39:21 2015 +0200

sal: loplugin:stringconstant

Change-Id: Ib4e7f4f71494abd654a70cf8ba8b0ca0afcd7df1

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 79ba18d..a57ea55 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -315,7 +315,7 @@ OString generateTestName(const OUString& rPath)
 
 void reportResourceUsage(const OUString& rPath)
 {
-OUString aFullPath = rPath + OUString(".resource.log");
+OUString aFullPath = rPath + ".resource.log";
 rusage resource_usage;
 getrusage(RUSAGE_SELF, _usage);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/cppunittester solenv/gbuild

2015-08-30 Thread Markus Mohrhard
 sal/cppunittester/cppunittester.cxx |   50 
 solenv/gbuild/CppunitTest.mk|2 -
 2 files changed, 51 insertions(+), 1 deletion(-)

New commits:
commit 87514b0907dfbb479e2646b5ff951c68babf3417
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Mon Aug 31 01:36:02 2015 +0200

log resource usage of unit tests on UNX platforms

Change-Id: I3788eae60f73bc42488bf2e4961922962f7e505b
Reviewed-on: https://gerrit.libreoffice.org/18155
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 07c9a2b..79ba18d 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -21,6 +21,11 @@
 #include windows.h
 #endif
 
+#ifdef UNX
+#include sys/time.h
+#include sys/resource.h
+#endif
+
 #include cstdlib
 #include iostream
 #include string
@@ -292,11 +297,48 @@ public:
 }
 };
 
+#ifdef UNX
+
+double get_time(timeval* time)
+{
+double nTime = (double)time-tv_sec;
+nTime += ((double)time-tv_usec)/100.0;
+return nTime;
+}
+
+OString generateTestName(const OUString rPath)
+{
+sal_Int32 nPathSep = rPath.lastIndexOf(/);
+OUString aTestName = rPath.copy(nPathSep+1);
+return OUStringToOString(aTestName, RTL_TEXTENCODING_UTF8);
+}
+
+void reportResourceUsage(const OUString rPath)
+{
+OUString aFullPath = rPath + OUString(.resource.log);
+rusage resource_usage;
+getrusage(RUSAGE_SELF, resource_usage);
+
+OString aPath = OUStringToOString(aFullPath, RTL_TEXTENCODING_UTF8);
+std::ofstream resource_file(aPath.getStr());
+resource_file  Name =   generateTestName(rPath)  std::endl;
+double nUserSpace = get_time(resource_usage.ru_utime);
+double nKernelSpace = get_time(resource_usage.ru_stime);
+resource_file  UserSpace =   nUserSpace  std::endl;
+resource_file  KernelSpace =   nKernelSpace  std::endl;
+}
+#else
+void reportResourceUsage(const OUString /*rPath*/)
+{
+}
+#endif
+
 }
 
 SAL_IMPLEMENT_MAIN()
 {
 bool ok = false;
+OUString path;
 try
 {
 #ifdef WNT
@@ -322,6 +364,12 @@ SAL_IMPLEMENT_MAIN()
 while (index  rtl_getAppCommandArgCount())
 {
 rtl::OUString arg = getArgument(index);
+if (arg == --target)
+{
+path = getArgument(++index);
+++index;
+continue;
+}
 if ( arg != --protector )
 {
 if (testlib.empty())
@@ -383,6 +431,8 @@ SAL_IMPLEMENT_MAIN()
 SAL_WARN(vcl.app, Fatal exception:   e.what());
 }
 
+reportResourceUsage(path);
+
 return ok ? EXIT_SUCCESS : EXIT_FAILURE;
 }
 
diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk
index 61f17dd..bea33eb 100644
--- a/solenv/gbuild/CppunitTest.mk
+++ b/solenv/gbuild/CppunitTest.mk
@@ -102,7 +102,7 @@ $(call gb_CppunitTest_get_target,%) :| 
$(gb_CppunitTest_RUNTIMEDEPS)
PYTHONDONTWRITEBYTECODE=1) \
$(ICECREAM_RUN) $(gb_CppunitTest_GDBTRACE) 
$(gb_CppunitTest_VALGRINDTOOL) $(gb_CppunitTest_CPPTESTCOMMAND) \
$(call gb_LinkTarget_get_target,$(call 
gb_CppunitTest_get_linktarget,$*)) \
-   $(call gb_CppunitTest__make_args) \
+   $(call gb_CppunitTest__make_args) --target $@ \
$(if $(gb_CppunitTest__interactive),, \
 $@.log 21 \
|| ($(if $(value gb_CppunitTest_postprocess), \
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/cppunittester

2015-04-30 Thread Markus Mohrhard
 sal/cppunittester/cppunittester.cxx |   33 +++--
 1 file changed, 31 insertions(+), 2 deletions(-)

New commits:
commit 9ce371fa1626bb845e702ceef66a730547b313a8
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Thu Apr 30 20:51:29 2015 +0200

provide a way to execute single test case from test suite

CPPUNIT_TEST_NAME is the environment variable that needs to be set and
contain the name of the tests. The test names need to be fully qualified
to be recognized.

Examples:

CPPUNIT_TEST_NAME=ScFiltersTest::testOutlineODS 
ScFiltersTest::testRangeNameXLS make CppunitTest_sc_subsequent_filters_test

CPPUNIT_TEST_NAME=ScFiltersTest make 
CppunitTest_sc_subsequent_filters_test

Change-Id: I78a8a076638e19c918ca1c411086bb353f5100a2
Reviewed-on: https://gerrit.libreoffice.org/15579
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index ffad4d4..6c15417 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -49,6 +49,9 @@
 
 #include boost/noncopyable.hpp
 #include boost/scoped_array.hpp
+#include boost/algorithm/string.hpp
+
+#include algorithm
 
 namespace {
 
@@ -161,6 +164,21 @@ private:
 }
 };
 
+namespace {
+
+void addRecursiveTests(const std::vectorstd::string test_names, 
CppUnit::Test* pTest, CppUnit::TestRunner rRunner)
+{
+for (int i = 0; i  pTest-getChildTestCount(); ++i)
+{
+CppUnit::Test* pNewTest = pTest-getChildTestAt(i);
+addRecursiveTests(test_names, pNewTest, rRunner);
+if (std::find(test_names.begin(), test_names.end(), 
pNewTest-getName()) != test_names.end())
+rRunner.addTest(pNewTest);
+}
+}
+
+}
+
 //Allow the whole uniting testing framework to be run inside a Protector
 //which knows about uno exceptions, so it can print the content of the
 //exception before falling over and dying
@@ -241,9 +259,20 @@ public:
 setenv(LO_TESTNAME, lib.c_str(), true);
 #endif
 
+const char* pVal = getenv(CPPUNIT_TEST_NAME);
+
 CppUnit::TestRunner runner;
-runner.addTest(
-CppUnit::TestFactoryRegistry::getRegistry().makeTest());
+if (pVal)
+{
+std::vectorstd::string test_names;
+boost::split(test_names, pVal, boost::is_any_of(\t ));
+CppUnit::Test* pTest = 
CppUnit::TestFactoryRegistry::getRegistry().makeTest();
+addRecursiveTests(test_names, pTest, runner);
+}
+else
+{
+
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
+}
 runner.run(result);
 
 CppUnit::CompilerOutputter outputter(collector, 
CppUnit::stdCErr());
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/cppunittester

2014-06-04 Thread Stephan Bergmann
 sal/cppunittester/cppunittester.cxx |   34 +++---
 1 file changed, 19 insertions(+), 15 deletions(-)

New commits:
commit b2725b7d1bd53211a7c432f79a8ab5ab4b6d448f
Author: Stephan Bergmann sberg...@redhat.com
Date:   Wed Jun 4 11:05:58 2014 +0200

Keep TestFixture alive until outputter is done with it

Change-Id: Ifd921efa971f7a9a5c47f42c5d56a3deb1c3a0b3

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 9c58b27..51bc5c6 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -218,38 +218,42 @@ public:
 }
 #endif
 
-CppUnit::TestResultCollector collector;
-result.addListener(collector);
+for (size_t i = 0; i  protectors.size(); ++i)
+result.pushProtector(protectors[i]);
+
+bool success;
+{
+CppUnit::TestResultCollector collector;
+result.addListener(collector);
 
-LogFailuresAsTheyHappen logger;
-result.addListener(logger);
+LogFailuresAsTheyHappen logger;
+result.addListener(logger);
 
 #ifdef TIMETESTS
-TimingListener timer;
-result.addListener(timer);
+TimingListener timer;
+result.addListener(timer);
 #endif
 
 #ifdef UNX
-EyecatcherListener eye;
-result.addListener(eye);
+EyecatcherListener eye;
+result.addListener(eye);
 #endif
-for (size_t i = 0; i  protectors.size(); ++i)
-result.pushProtector(protectors[i]);
 
-{
 CppUnit::TestRunner runner;
 runner.addTest(
 CppUnit::TestFactoryRegistry::getRegistry().makeTest());
 runner.run(result);
+
+CppUnit::CompilerOutputter outputter(collector, 
CppUnit::stdCErr());
+outputter.setNoWrap();
+outputter.write();
+success = collector.wasSuccessful();
 }
 
 for (size_t i = 0; i  protectors.size(); ++i)
 result.popProtector();
 
-CppUnit::CompilerOutputter outputter(collector, CppUnit::stdCErr());
-outputter.setNoWrap();
-outputter.write();
-return collector.wasSuccessful();
+return success;
 }
 virtual bool operator()() const SAL_OVERRIDE
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/cppunittester

2014-05-20 Thread Michael Meeks
 sal/cppunittester/cppunittester.cxx |8 
 1 file changed, 8 insertions(+)

New commits:
commit ef02ced3ec5e66d5c25de52fc37355ae0f44235e
Author: Michael Meeks michael.me...@collabora.com
Date:   Tue May 20 13:38:49 2014 +0100

Win32 - warn of extraordinary behaviour with LoadLibrary and long PATHs

Change-Id: I0a8ee157aa548a5b04df67a2355e3f4fd15e84cd

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 6e5258b..7ac8ab5 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -206,6 +206,14 @@ public:
 manager.load(testlib, args);
 } catch (const CppUnit::DynamicLibraryManagerException e) {
 std::cerr  DynamicLibraryManagerException: \  e.what()  
\\n;
+#ifdef WIN32
+const char *pPath = getenv (PATH);
+if (pPath  strlen (pPath)  256)
+{
+std::cerr  Windows has significant build problems with long 
PATH variables ;
+std::cerr  please check your PATH variable and 
re-autogen.\n;
+}
+#endif
 return false;
 }
 #endif
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/cppunittester

2014-05-06 Thread Tor Lillqvist
 sal/cppunittester/cppunittester.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit f9980adc43e41c599372556e8e6ec616b1681558
Author: Tor Lillqvist t...@collabora.com
Date:   Tue May 6 17:51:27 2014 +0300

Avoid the annoying line wrapping

Change-Id: I3ac2f0bf676491231bcd60eb91e8a36bc6c00620
Signed-off-by: Stephan Bergmann sberg...@redhat.com

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 484ca4e..6e5258b 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -235,7 +235,9 @@ public:
 for (size_t i = 0; i  protectors.size(); ++i)
 result.popProtector();
 
-CppUnit::CompilerOutputter(collector, CppUnit::stdCErr()).write();
+CppUnit::CompilerOutputter outputter(collector, CppUnit::stdCErr());
+outputter.setNoWrap();
+outputter.write();
 return collector.wasSuccessful();
 }
 virtual bool operator()() const SAL_OVERRIDE
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/cppunittester

2014-04-24 Thread Tor Lillqvist
 sal/cppunittester/cppunittester.cxx |8 
 1 file changed, 8 insertions(+)

New commits:
commit 5723599896a9fe0f57704c4f35d43d690b2ddbf9
Author: Tor Lillqvist t...@collabora.com
Date:   Thu Apr 24 09:25:28 2014 +0300

Add informative comment about cross-compiling to iOS in particular

Change-Id: I7c38efdafea13bb5ae5e8a5e1cb07e77853b5c4b

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index f8b9d64..68858fe 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -153,6 +153,14 @@ public:
 bool run() const
 {
 #ifdef DISABLE_DYNLOADING
+
+// NOTE: Running cppunit unit tests on iOS was something I did
+// only very early (several years ago) when starting porting
+// this stuff to iOS. The complicated mechanisms to do build
+// such unit test single executables have surely largely
+// bit-rotted or been semi-intentionally broken since. This
+// stuff here left for information only. --tml 2014.
+
 // For iOS cppunit plugins aren't really plugins (shared
 // libraries), but just static archives. In the real main
 // program of a cppunit app, which calls the lo_main() that
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/cppunittester sal/textenc sax/source

2014-04-23 Thread Takeshi Abe
 sal/cppunittester/cppunittester.cxx |   10 +-
 sal/textenc/tencinfo.cxx|   23 +--
 sax/source/expatwrap/saxwriter.cxx  |7 ---
 sax/source/expatwrap/xml2utf.cxx|   26 +-
 4 files changed, 27 insertions(+), 39 deletions(-)

New commits:
commit 1ec836760853e9e220d471cf39f2533f0828f00e
Author: Takeshi Abe t...@fixedpoint.jp
Date:   Thu Apr 24 00:09:19 2014 +0900

Avoid possible memory leaks in case of exceptions

Change-Id: I047fd88a89900153089a55b6af123f11fb8bde55

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index f4c2fc6..f8b9d64 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -47,6 +47,7 @@
 
 #include boost/noncopyable.hpp
 #include boost/ptr_container/ptr_vector.hpp
+#include boost/scoped_array.hpp
 #include boost/static_assert.hpp
 
 namespace {
@@ -108,9 +109,9 @@ class EyecatcherListener
 public:
 void startTest( CppUnit::Test* test) SAL_OVERRIDE
 {
-char* tn = new char [ test-getName().length() + 2 ];
-strcpy(tn, test-getName().c_str());
-int len = strlen(tn);
+boost::scoped_arraychar tn(new char [ test-getName().length() + 2 
]);
+strcpy(tn.get(), test-getName().c_str());
+int len = strlen(tn.get());
 for(int i = 0; i  len; i++)
 {
 if(!isalnum(tn[i]))
@@ -120,8 +121,7 @@ public:
 }
 tn[len] = '_';
 tn[len + 1] = 0;
-setenv(LO_TESTNAME, tn, true);
-delete[] tn;
+setenv(LO_TESTNAME, tn.get(), true);
 }
 
 void endTest( CppUnit::Test* /* test */ ) SAL_OVERRIDE
diff --git a/sal/textenc/tencinfo.cxx b/sal/textenc/tencinfo.cxx
index ccbfe40..0aaa2ff 100644
--- a/sal/textenc/tencinfo.cxx
+++ b/sal/textenc/tencinfo.cxx
@@ -26,6 +26,7 @@
 
 #include gettextencodingdata.hxx
 #include tenchelp.hxx
+#include boost/scoped_array.hpp
 
 sal_Bool SAL_CALL rtl_isOctetTextEncoding(rtl_TextEncoding nEncoding)
 {
@@ -407,20 +408,19 @@ rtl_TextEncoding SAL_CALL 
rtl_getTextEncodingFromUnixCharset( const char* pUnixC
 };
 
 rtl_TextEncodingeEncoding = RTL_TEXTENCODING_DONTKNOW;
-char*   pBuf;
 char*   pTempBuf;
 sal_uInt32  nBufLen = strlen( pUnixCharset )+1;
 const char* pFirstPart;
 const char* pSecondPart;
 
 /* Alloc Buffer and map to lower case */
-pBuf = new char[nBufLen];
-Impl_toAsciiLower( pUnixCharset, pBuf );
+boost::scoped_arraychar pBuf(new char[nBufLen]);
+Impl_toAsciiLower( pUnixCharset, pBuf.get() );
 
 /* Search FirstPart */
-pFirstPart = pBuf;
+pFirstPart = pBuf.get();
 pSecondPart = NULL;
-pTempBuf = pBuf;
+pTempBuf = pBuf.get();
 while ( *pTempBuf )
 {
 if ( *pTempBuf == '-' )
@@ -463,8 +463,6 @@ rtl_TextEncoding SAL_CALL 
rtl_getTextEncodingFromUnixCharset( const char* pUnixC
 }
 }
 
-delete[] pBuf;
-
 return eEncoding;
 }
 
@@ -740,18 +738,17 @@ rtl_TextEncoding SAL_CALL 
rtl_getTextEncodingFromMimeCharset( const char* pMimeC
 };
 
 rtl_TextEncodingeEncoding = RTL_TEXTENCODING_DONTKNOW;
-char*   pBuf;
 const ImplStrCharsetDef*pData = aVIPMimeCharsetTab;
 sal_uInt32  nBufLen = strlen( pMimeCharset )+1;
 
 /* Alloc Buffer and map to lower case and remove non alphanumeric chars */
-pBuf = new char[nBufLen];
-Impl_toAsciiLowerAndRemoveNonAlphanumeric( pMimeCharset, pBuf );
+boost::scoped_arraychar pBuf(new char[nBufLen]);
+Impl_toAsciiLowerAndRemoveNonAlphanumeric( pMimeCharset, pBuf.get() );
 
 /* Search for equal in the VIP table */
 while ( pData-mpCharsetStr )
 {
-if ( strcmp( pBuf, pData-mpCharsetStr ) == 0 )
+if ( strcmp( pBuf.get(), pData-mpCharsetStr ) == 0 )
 {
 eEncoding = pData-meTextEncoding;
 break;
@@ -766,7 +763,7 @@ rtl_TextEncoding SAL_CALL 
rtl_getTextEncodingFromMimeCharset( const char* pMimeC
 pData = aMimeCharsetTab;
 while ( pData-mpCharsetStr )
 {
-if ( Impl_matchString( pBuf, pData-mpCharsetStr ) )
+if ( Impl_matchString( pBuf.get(), pData-mpCharsetStr ) )
 {
 eEncoding = pData-meTextEncoding;
 break;
@@ -776,8 +773,6 @@ rtl_TextEncoding SAL_CALL 
rtl_getTextEncodingFromMimeCharset( const char* pMimeC
 }
 }
 
-delete[] pBuf;
-
 return eEncoding;
 }
 
diff --git a/sax/source/expatwrap/saxwriter.cxx 
b/sax/source/expatwrap/saxwriter.cxx
index 140bcfb..4dee83d 100644
--- a/sax/source/expatwrap/saxwriter.cxx
+++ b/sax/source/expatwrap/saxwriter.cxx
@@ -49,6 +49,7 @@ using namespace ::com::sun::star::util;
 using namespace ::com::sun::star::io;
 
 #include xml2utf.hxx
+#include boost/scoped_array.hpp
 
 namespace com { namespace sun { namespace star { namespace uno {
 

[Libreoffice-commits] core.git: sal/cppunittester

2014-03-31 Thread Stephan Bergmann
 sal/cppunittester/cppunittester.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit dc9feb69f86b7c8e4f7b52ea6b4a18abd64b036b
Author: Stephan Bergmann sberg...@redhat.com
Date:   Mon Mar 31 13:35:02 2014 +0200

Move invariant writes outside loop

Change-Id: Ia254fe382a00be13a631fcc1b23f940352d8d3ba

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 0f4d58a..c2bdb13 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -115,9 +115,9 @@ public:
 {
 tn[i] = '_';
 }
-tn[len] = '_';
-tn[len + 1] = 0;
 }
+tn[len] = '_';
+tn[len + 1] = 0;
 setenv(LO_TESTNAME, tn, true);
 delete[] tn;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/cppunittester unotools/source

2014-03-30 Thread Norbert Thiebaud
 sal/cppunittester/cppunittester.cxx|   37 +
 unotools/source/ucbhelper/tempfile.cxx |   14 ++--
 2 files changed, 49 insertions(+), 2 deletions(-)

New commits:
commit c176cb8907530a795cb0e38de8193df931f891fb
Author: Norbert Thiebaud nthieb...@gmail.com
Date:   Sun Mar 30 20:20:23 2014 -0500

decorate tempfile name's to help identify leaks' author

unottols TempFile class check in debug bod for
and env variable LO_TESTNAME.. if present it use that as the root
for the tempfile filename.

cppunitteset framework is augmented so that it export such
LO_TESNAME using the cppunit testName(), after replacement of
non-alphnum characters by _

Change-Id: Iebb9545d3bd789083afbeaf4c64eab086b56049a

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 1faae71..0f4d58a 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -95,6 +95,39 @@ private:
 sal_uInt32 m_nStartTime;
 };
 
+#ifdef UNX
+#include stdlib.h
+// Setup an env variable so that temp file (or other) can
+// have a usefull value to identify the source
+class EyecatcherListener
+: public CppUnit::TestListener
+, private boost::noncopyable
+{
+public:
+void startTest( CppUnit::Test* test) SAL_OVERRIDE
+{
+char* tn = new char [ test-getName().length() + 2 ];
+strcpy(tn, test-getName().c_str());
+int len = strlen(tn);
+for(int i = 0; i  len; i++)
+{
+if(!isalnum(tn[i]))
+{
+tn[i] = '_';
+}
+tn[len] = '_';
+tn[len + 1] = 0;
+}
+setenv(LO_TESTNAME, tn, true);
+delete[] tn;
+}
+
+void endTest( CppUnit::Test* /* test */ ) SAL_OVERRIDE
+{
+}
+};
+#endif
+
 //Allow the whole uniting testing framework to be run inside a Protector
 //which knows about uno exceptions, so it can print the content of the
 //exception before falling over and dying
@@ -144,6 +177,10 @@ public:
 result.addListener(timer);
 #endif
 
+#ifdef UNX
+EyecatcherListener eye;
+result.addListener(eye);
+#endif
 for (size_t i = 0; i  protectors.size(); ++i)
 result.pushProtector(protectors[i]);
 
diff --git a/unotools/source/ucbhelper/tempfile.cxx 
b/unotools/source/ucbhelper/tempfile.cxx
index 17dafaa..9585639 100644
--- a/unotools/source/ucbhelper/tempfile.cxx
+++ b/unotools/source/ucbhelper/tempfile.cxx
@@ -184,8 +184,18 @@ void CreateTempName_Impl( OUString rName, bool bKeep, 
bool bDir = true )
 // 36 ** 6 == 2176782336
 unsigned const nRadix = 36;
 unsigned long const nMax = (nRadix*nRadix*nRadix*nRadix*nRadix*nRadix);
-OUString aName = rName + lu;
-
+OUString aName;
+OUString aEyeCatcher = lu;
+#ifdef DBG_UTIL
+#ifdef UNX
+const char* eye = getenv(LO_TESTNAME);
+if(eye)
+{
+aEyeCatcher = OUString(eye, strlen(eye), RTL_TEXTENCODING_ASCII_US);
+}
+#endif
+#endif
+aName = rName + aEyeCatcher;
 rName = ;
 static unsigned long u = Time::GetSystemTicks() % nMax;
 for ( unsigned long nSeed = u; ++u != nSeed; )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/cppunittester sal/osl sal/qa sal/rtl sdext/source sd/source sfx2/source svtools/source svx/source

2013-12-01 Thread Takeshi Abe
 sal/cppunittester/cppunittester.cxx |1 -
 sal/osl/w32/dllentry.c  |2 --
 sal/qa/ByteSequence/ByteSequence.cxx|1 -
 sal/qa/osl/file/osl_File.cxx|1 -
 sal/qa/osl/thread/test_thread.cxx   |1 -
 sal/qa/rtl/math/test-rtl-math.cxx   |1 -
 sal/qa/rtl/strings/test_oustring_endswith.cxx   |1 -
 sal/rtl/string.cxx  |1 -
 sal/rtl/ustring.cxx |1 -
 sd/source/ui/docshell/docshel4.cxx  |2 --
 sd/source/ui/sidebar/LayoutMenu.hxx |1 -
 sd/source/ui/view/drtxtob.cxx   |2 --
 sd/source/ui/view/drtxtob1.cxx  |1 -
 sdext/source/minimizer/impoptimizer.cxx |1 -
 sfx2/source/sidebar/SidebarDockingWindow.hxx|1 -
 svtools/source/control/valueacc.cxx |1 -
 svx/source/dialog/fntctrl.cxx   |2 --
 svx/source/form/fmexpl.cxx  |1 -
 svx/source/sidebar/graphic/GraphicPropertyPanel.cxx |1 -
 svx/source/stbctrls/pszctrl.cxx |1 -
 svx/source/svdraw/svdedxv.cxx   |1 -
 svx/source/svdraw/svdfmtf.cxx   |1 -
 svx/source/svdraw/svdmodel.cxx  |1 -
 svx/source/svdraw/svdomeas.cxx  |1 -
 svx/source/table/accessibletableshape.cxx   |1 -
 25 files changed, 29 deletions(-)

New commits:
commit 3b2f956ba64f8f9dff1da3028436f3834c899d1d
Author: Takeshi Abe t...@fixedpoint.jp
Date:   Mon Dec 2 01:00:35 2013 +0900

Drop duplicate #include

Change-Id: Ife8ebbb5e46704c5d2ff46cc345b4ed926e7dc12

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 83623b5..1634a67 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -35,7 +35,6 @@
 #include rtl/textcvt.h
 #include rtl/ustring.hxx
 #include sal/main.h
-#include sal/types.h
 
 #include cppunit/CompilerOutputter.h
 #include cppunit/TestResult.h
diff --git a/sal/osl/w32/dllentry.c b/sal/osl/w32/dllentry.c
index 39c6c61..96d7525 100644
--- a/sal/osl/w32/dllentry.c
+++ b/sal/osl/w32/dllentry.c
@@ -31,9 +31,7 @@
 #include sal/types.h
 #include float.h
 
-#include osl/diagnose.h
 #include osl/mutex.h
-#include sal/types.h
 
 #include internal/rtllifecycle.h
 
diff --git a/sal/qa/ByteSequence/ByteSequence.cxx 
b/sal/qa/ByteSequence/ByteSequence.cxx
index 91febc9..7ce6e46 100644
--- a/sal/qa/ByteSequence/ByteSequence.cxx
+++ b/sal/qa/ByteSequence/ByteSequence.cxx
@@ -23,7 +23,6 @@
 #include cppunit/extensions/HelperMacros.h
 #include cppunit/plugin/TestPlugIn.h
 #include rtl/byteseq.hxx
-#include sal/types.h
 
 namespace {
 
diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx
index 43f255c..d7341e4 100644
--- a/sal/qa/osl/file/osl_File.cxx
+++ b/sal/qa/osl/file/osl_File.cxx
@@ -26,7 +26,6 @@
 
 #include osl/thread.h
 
-#include rtl/ustrbuf.hxx
 #include osl/file.hxx
 #include osl/detail/file.h
 #include osl_File_Const.h
diff --git a/sal/qa/osl/thread/test_thread.cxx 
b/sal/qa/osl/thread/test_thread.cxx
index 9c49866..5030af1 100644
--- a/sal/qa/osl/thread/test_thread.cxx
+++ b/sal/qa/osl/thread/test_thread.cxx
@@ -24,7 +24,6 @@
 #include osl/conditn.hxx
 #include osl/thread.hxx
 #include osl/time.h
-#include sal/types.h
 
 namespace {
 
diff --git a/sal/qa/rtl/math/test-rtl-math.cxx 
b/sal/qa/rtl/math/test-rtl-math.cxx
index 13b936e..e6422c4 100644
--- a/sal/qa/rtl/math/test-rtl-math.cxx
+++ b/sal/qa/rtl/math/test-rtl-math.cxx
@@ -25,7 +25,6 @@
 #include rtl/math.hxx
 #include rtl/ustring.h
 #include rtl/ustring.hxx
-#include sal/types.h
 
 CPPUNIT_NS_BEGIN
 
diff --git a/sal/qa/rtl/strings/test_oustring_endswith.cxx 
b/sal/qa/rtl/strings/test_oustring_endswith.cxx
index 1c4b820..2b4978d 100644
--- a/sal/qa/rtl/strings/test_oustring_endswith.cxx
+++ b/sal/qa/rtl/strings/test_oustring_endswith.cxx
@@ -25,7 +25,6 @@
 #include rtl/string.hxx
 #include rtl/textenc.h
 #include rtl/ustring.hxx
-#include sal/types.h
 #include sal/macros.h
 
 namespace test { namespace oustring {
diff --git a/sal/rtl/string.cxx b/sal/rtl/string.cxx
index ce7fa31..32ef077 100644
--- a/sal/rtl/string.cxx
+++ b/sal/rtl/string.cxx
@@ -36,7 +36,6 @@
 #include rtl/string.h
 
 #include rtl/math.h
-#include rtl/tencinfo.h
 
 /* === */
 
diff --git a/sal/rtl/ustring.cxx b/sal/rtl/ustring.cxx
index edbfc9d..3599a92 100644
--- a/sal/rtl/ustring.cxx
+++ b/sal/rtl/ustring.cxx
@@ -43,7 +43,6 @@
 #include rtl/ustring.h
 
 #include rtl/math.h
-#include rtl/tencinfo.h
 
 /* === */
 
diff --git a/sd/source/ui/docshell/docshel4.cxx 
b/sd/source/ui/docshell/docshel4.cxx
index