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

2020-07-01 Thread Stephan Bergmann (via logerrit)
 sal/osl/unx/nlsupport.cxx   |2 
 sal/osl/unx/pipe.cxx|2 
 sal/osl/unx/process.cxx |4 
 sal/osl/unx/socket.cxx  |   16 
 sal/osl/unx/tempfile.cxx|4 
 sal/osl/unx/thread.cxx  |2 
 sal/qa/OStringBuffer/rtl_String_Const.h |  598 
 sal/rtl/bootstrap.cxx   |2 
 sal/rtl/cipher.cxx  |2 
 sal/rtl/crc.cxx |2 
 sal/rtl/digest.cxx  |   14 
 sal/rtl/math.cxx|4 
 sal/rtl/string.cxx  |2 
 sal/rtl/ustring.cxx |2 
 sal/textenc/convertbig5hkscs.tab|4 
 sal/textenc/converteuctw.tab|4 
 sal/textenc/convertgb18030.tab  |4 
 sal/textenc/convertisciidevangari.cxx   |2 
 sal/textenc/convertisciidevangari.tab   |2 
 sal/textenc/convertiso2022cn.tab|4 
 sal/textenc/convertiso2022jp.tab|4 
 sal/textenc/convertiso2022kr.tab|4 
 sal/textenc/convertsimple.cxx   |4 
 sal/textenc/generate/big5hkscs2001.tab  |   10 
 sal/textenc/generate/cns116431992.tab   |   12 
 sal/textenc/generate/gb180302000.tab|8 
 sal/textenc/tables.cxx  |6 
 sal/textenc/tcvtarb1.tab|   60 +--
 sal/textenc/tcvteas1.tab|   24 -
 sal/textenc/tcvtest1.tab|  284 +++
 sal/textenc/tcvtjp1.tab |  100 ++---
 sal/textenc/tcvtjp2.tab |  216 +--
 sal/textenc/tcvtjp3.tab |  292 +++
 sal/textenc/tcvtjp4.tab |  192 +-
 sal/textenc/tcvtjp5.tab |  176 -
 sal/textenc/tcvtjp6.tab |   52 +-
 sal/textenc/tcvtkr1.tab |  248 ++---
 sal/textenc/tcvtkr2.tab |  290 +++
 sal/textenc/tcvtkr4.tab |  224 +--
 sal/textenc/tcvtkr5.tab |  290 +++
 sal/textenc/tcvtkr6.tab |   26 -
 sal/textenc/tcvtlat1.tab|  100 ++---
 sal/textenc/tcvtscn1.tab|  252 ++---
 sal/textenc/tcvtscn2.tab|  264 +++---
 sal/textenc/tcvtscn3.tab|  148 +++
 sal/textenc/tcvtscn4.tab|  162 
 sal/textenc/tcvtscn5.tab|  164 
 sal/textenc/tcvtscn6.tab|   44 +-
 sal/textenc/tcvtsym1.tab|2 
 sal/textenc/tcvttcn1.tab|  178 -
 sal/textenc/tcvttcn2.tab|  204 +-
 sal/textenc/tcvttcn6.tab|   26 -
 sal/textenc/tcvtuni1.tab|2 
 sal/textenc/tcvtutf7.cxx|6 
 sal/textenc/textenc.cxx |   28 -
 55 files changed, 2389 insertions(+), 2389 deletions(-)

New commits:
commit d563b9a5960e9bfe7077ee5aca44966d0bb3e2f1
Author: Stephan Bergmann 
AuthorDate: Wed Jul 1 19:53:00 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Jul 2 07:09:56 2020 +0200

Upcoming improved loplugin:staticanonymous -> redundantstatic: sal

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

diff --git a/sal/osl/unx/nlsupport.cxx b/sal/osl/unx/nlsupport.cxx
index a4c7c807c201..3a0b1021e726 100644
--- a/sal/osl/unx/nlsupport.cxx
+++ b/sal/osl/unx/nlsupport.cxx
@@ -294,7 +294,7 @@ static const Pair nl_language_list[] = {
 
 #elif defined(LINUX)
 
-static const Pair nl_language_list[] = {
+const Pair nl_language_list[] = {
 { "ANSI_X3.110-1983",   RTL_TEXTENCODING_DONTKNOW   },  /* 
ISO-IR-99 NAPLPS */
 { "ANSI_X3.4-1968", RTL_TEXTENCODING_ISO_8859_1 },  /* fake: 
ASCII_US */
 { "ASMO_449",   RTL_TEXTENCODING_DONTKNOW },/* 
ISO_9036 ARABIC7 */
diff --git a/sal/osl/unx/pipe.cxx b/sal/osl/unx/pipe.cxx
index ec9fe4b9d5ca..034979ba0e4e 100644
--- a/sal/osl/unx/pipe.cxx
+++ b/sal/osl/unx/pipe.cxx
@@ -41,7 +41,7 @@
 
 static oslPipe osl_psz_createPipe(const char *pszPipeName, oslPipeOptions 
Options, oslSecurity Security);
 
-static struct
+struct
 {
 interrcode;
 oslPipeError   error;
diff --git a/sal/osl/unx/process.cxx b/sal/osl/unx/process.cxx
index 39db4936fa3f..861324963dec 100644
--- a/sal/osl/unx/process.cxx
+++ b/sal/osl/unx/process.cxx
@@ -92,8 +92,8 @@ struct ProcessData
 oslFileHandle*m_pErrorRead;
 };
 
-static oslProcessImpl* ChildList;
-static oslMutexChildListMutex;
+oslProcessImpl* ChildList;
+oslMutexChildListMutex;
 
 } //Anonymous namespace
 
diff --git a/sal/osl/unx/socket.cxx b/sal/osl/unx/socket.cxx
index 4f67795a60ee..56a8f6cd63ac 100644
--- a/sal/osl/unx/socket.cxx
+++ b/sal/osl/unx/socket.cxx
@@ -94,

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

2018-11-22 Thread Libreoffice Gerrit user
 sal/osl/unx/profile.cxx  |   14 +-
 sal/osl/w32/module.cxx   |5 +
 sal/osl/w32/time.cxx |   12 
 sal/qa/osl/file/osl_File.cxx |   11 ++-
 sal/rtl/bootstrap.cxx|   17 -
 sal/rtl/hash.cxx |7 +--
 6 files changed, 21 insertions(+), 45 deletions(-)

New commits:
commit 85acc270fc670443cd700c471d9b495e12d4e6dc
Author: Noel Grandin 
AuthorDate: Thu Nov 22 08:52:59 2018 +0200
Commit: Noel Grandin 
CommitDate: Thu Nov 22 12:07:54 2018 +0100

improve function-local statics in sal

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

diff --git a/sal/osl/unx/profile.cxx b/sal/osl/unx/profile.cxx
index a986dfd0d41f..589662b9b62a 100644
--- a/sal/osl/unx/profile.cxx
+++ b/sal/osl/unx/profile.cxx
@@ -879,19 +879,7 @@ static osl_TStamp OslProfile_getFileStamp(osl_TFile* pFile)
 static bool OslProfile_lockFile(const osl_TFile* pFile, osl_TLockMode eMode)
 {
 struct flock lock;
-/* boring hack, but initializers for static vars must be constant */
-static bool bIsInitialized = false;
-static bool bLockingDisabled;
-
-if ( !bIsInitialized )
-{
-sal_Char* pEnvValue;
-pEnvValue = getenv( "STAR_PROFILE_LOCKING_DISABLED" );
-
-bLockingDisabled = pEnvValue != nullptr;
-
-bIsInitialized = true;
-}
+static bool const bLockingDisabled = getenv( 
"STAR_PROFILE_LOCKING_DISABLED" ) != nullptr;
 
 if (pFile->m_Handle < 0)
 {
diff --git a/sal/osl/w32/module.cxx b/sal/osl/w32/module.cxx
index de9ce4db421b..8de791a7a8e1 100644
--- a/sal/osl/w32/module.cxx
+++ b/sal/osl/w32/module.cxx
@@ -327,10 +327,7 @@ typedef BOOL (WINAPI *GetModuleInformation_PROC)(
 static bool osl_addressGetModuleURL_NT_( void *pv, rtl_uString **pustrURL )
 {
 boolbSuccess= false;/* Assume failure */
-static HMODULE  hModPsapi = nullptr;
-
-if ( !hModPsapi )
-hModPsapi = LoadLibraryW( L"PSAPI.DLL" );
+static HMODULE hModPsapi = LoadLibraryW( L"PSAPI.DLL" );
 
 if ( hModPsapi )
 {
diff --git a/sal/osl/w32/time.cxx b/sal/osl/w32/time.cxx
index d1284b663fae..135aab368fc8 100644
--- a/sal/osl/w32/time.cxx
+++ b/sal/osl/w32/time.cxx
@@ -35,18 +35,14 @@ sal_Bool SAL_CALL osl_getSystemTime(TimeValue* pTimeVal)
 
 typedef VOID (WINAPI *GetSystemTimePreciseAsFileTime_PROC)(LPFILETIME);
 
-static HMODULE hModule = nullptr;
-static GetSystemTimePreciseAsFileTime_PROC pGetSystemTimePreciseAsFileTime 
= nullptr;
-
 OSL_ASSERT(pTimeVal != nullptr);
 
-if ( !hModule )
+static GetSystemTimePreciseAsFileTime_PROC pGetSystemTimePreciseAsFileTime 
= [&]()
 {
-hModule = GetModuleHandleW( L"Kernel32.dll" );
-if ( hModule )
-pGetSystemTimePreciseAsFileTime = 
reinterpret_cast(
+HMODULE hModule = GetModuleHandleW( L"Kernel32.dll" );
+return reinterpret_cast(
 GetProcAddress(hModule, "GetSystemTimePreciseAsFileTime"));
-}
+}();
 
 // use ~1 microsecond resolution if available
 if (pGetSystemTimePreciseAsFileTime)
diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx
index fcc8c41cf4ab..ecb65ae8cd3f 100644
--- a/sal/qa/osl/file/osl_File.cxx
+++ b/sal/qa/osl/file/osl_File.cxx
@@ -4922,8 +4922,7 @@ namespace osl_Directory
 
 static OUString const & get_test_path()
 {
-static OUString test_path;
-if (test_path.isEmpty())
+static OUString test_path = [&]()
 {
 OUString tmp;
 osl::FileBase::RC rc = osl::FileBase::getTempDirURL(tmp);
@@ -4962,14 +4961,16 @@ namespace osl_Directory
 #endif
 tmp_x += OString(TEST_PATH_POSTFIX);
 
-rc = 
osl::FileBase::getFileURLFromSystemPath(OStringToOUString(tmp_x, 
RTL_TEXTENCODING_UTF8), test_path);
+OUString tmpTestPath;
+rc = 
osl::FileBase::getFileURLFromSystemPath(OStringToOUString(tmp_x, 
RTL_TEXTENCODING_UTF8), tmpTestPath);
 
 CPPUNIT_ASSERT_EQUAL_MESSAGE
 (
  "Cannot convert the system path back to an URL",
  osl::FileBase::E_None, rc
-  );
-}
+);
+return tmpTestPath;
+}();
 return test_path;
 }
 
diff --git a/sal/rtl/bootstrap.cxx b/sal/rtl/bootstrap.cxx
index 897de890d890..9c6675586ef9 100644
--- a/sal/rtl/bootstrap.cxx
+++ b/sal/rtl/bootstrap.cxx
@@ -155,10 +155,9 @@ static bool getFromCommandLineArgs(
 {
 OSL_ASSERT(value);
 
-static NameValueVector *pNameValueVector = nullptr;
-if (!pNameValueVector)
+static NameValueVector nameValueVector = [&]()
 {
-static NameValueVector nameValueVector;
+NameValueVector tmp;
 
 sal_Int32 nArgCount = osl_getCommandArgCount();
 for(sal_Int32 i = 0; i < nArgCount; ++ i)
@@ -189,18 +1

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

2017-09-26 Thread Mike Kaganski
 sal/osl/w32/conditn.cxx  |   10 +-
 sal/osl/w32/dllentry.cxx |   12 +--
 sal/osl/w32/file_dirvol.cxx  |4 -
 sal/osl/w32/file_url.cxx |8 +-
 sal/osl/w32/module.cxx   |   47 ++---
 sal/osl/w32/nlsupport.cxx|2 
 sal/osl/w32/pipe.cxx |6 -
 sal/osl/w32/process.cxx  |   18 ++---
 sal/osl/w32/procimpl.cxx |4 -
 sal/osl/w32/profile.cxx  |  119 +++
 sal/osl/w32/socket.cxx   |5 -
 sal/osl/w32/tempfile.cxx |8 +-
 sal/qa/osl/security/osl_Security.cxx |   54 ---
 sal/rtl/alloc_cache.cxx  |2 
 14 files changed, 183 insertions(+), 116 deletions(-)

New commits:
commit 48db718042d32bffe95ec058d636ed935d98ec4d
Author: Mike Kaganski 
Date:   Tue Sep 26 22:05:15 2017 +0300

SAL: use more Unicode on Windows

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

diff --git a/sal/osl/w32/conditn.cxx b/sal/osl/w32/conditn.cxx
index 9807eaa95863..6bc6d9d3ed3a 100644
--- a/sal/osl/w32/conditn.cxx
+++ b/sal/osl/w32/conditn.cxx
@@ -32,10 +32,10 @@ oslCondition SAL_CALL osl_createCondition(void)
 {
 oslCondition Condition;
 
-Condition= reinterpret_cast(CreateEvent(nullptr,  /* 
no security */
- true,  /* manual reset */
- false, /* initial state not 
signaled */
- nullptr)); /* automatic name 
*/
+Condition= reinterpret_cast(CreateEventW(nullptr,   /* no 
security */
+   true,  /* 
manual reset */
+   false, /* 
initial state not signaled */
+   nullptr)); /* 
automatic name */
 
 return Condition;
 
@@ -88,7 +88,7 @@ oslConditionResult SAL_CALL osl_waitCondition(oslCondition 
Condition,
 /* We Must not dispatch the message. PM_NOREMOVE leaves the 
message queue untouched
  but dispatches SendMessage calls automatically */
 
-PeekMessage( &msg, nullptr, 0, 0, PM_NOREMOVE );
+PeekMessageW( &msg, nullptr, 0, 0, PM_NOREMOVE );
 }
 break;
 
diff --git a/sal/osl/w32/dllentry.cxx b/sal/osl/w32/dllentry.cxx
index bc575ac5b7d8..52159853eb3e 100644
--- a/sal/osl/w32/dllentry.cxx
+++ b/sal/osl/w32/dllentry.cxx
@@ -66,8 +66,8 @@ static BOOL WINAPI RawDllMain( HINSTANCE, DWORD fdwReason, 
LPVOID )
 {
 #ifdef _DEBUG
 WCHAR buf[64];
-DWORD const res = 
GetEnvironmentVariableW(L"SAL_NO_ASSERT_DIALOGS", buf, sizeof(buf));
-if (res && res < sizeof(buf))
+DWORD const res = 
GetEnvironmentVariableW(L"SAL_NO_ASSERT_DIALOGS", buf, SAL_N_ELEMENTS(buf));
+if (res && res < SAL_N_ELEMENTS(buf))
 {
 // disable the dialog on abort()
 _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
@@ -203,20 +203,20 @@ BOOL WINAPI DllMain( HINSTANCE, DWORD fdwReason, LPVOID )
 {
 case DLL_PROCESS_ATTACH:
 {
-TCHAR   szBuffer[64];
+WCHAR szBuffer[64];
 
 // This code will attach the process to its parent process
 // if the parent process had set the environment variable.
 // The corresponding code (setting the environment variable)
 // is desktop/win32/source/officeloader.cxx
 
-DWORD   dwResult = GetEnvironmentVariable( 
"ATTACHED_PARENT_PROCESSID", szBuffer, sizeof(szBuffer) );
+DWORD dwResult = GetEnvironmentVariableW( 
L"ATTACHED_PARENT_PROCESSID", szBuffer, SAL_N_ELEMENTS(szBuffer) );
 
-if ( dwResult && dwResult < sizeof(szBuffer) )
+if ( dwResult && dwResult < SAL_N_ELEMENTS(szBuffer) )
 {
 DWORD   dwThreadId = 0;
 
-DWORD_PTR   dwParentProcessId = (DWORD_PTR)atol( szBuffer );
+DWORD_PTR dwParentProcessId = (DWORD_PTR)_wtol( szBuffer );
 
 if ( dwParentProcessId && GetParentProcessId() == 
dwParentProcessId )
 {
diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx
index 46f185d0554e..446654f98759 100644
--- a/sal/osl/w32/file_dirvol.cxx
+++ b/sal/osl/w32/file_dirvol.cxx
@@ -257,9 +257,9 @@ static HANDLE WINAPI OpenLogicalDrivesEnum()
 LPDRIVEENUM pEnum = static_cast(HeapAlloc( GetProcessHeap(), 
0, sizeof(DRIVEENUM) ));
 if ( pEnum )
 {
-DWORD dwNumCopied = GetLogicalDriveStringsW( (sizeof(pEnum->cBuffer) - 
1) / sizeof(WCHAR), pEnum->cBuffer );
+DWORD dwNumCopied = Ge

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

2013-02-22 Thread Tor Lillqvist
 sal/osl/unx/file_url.cxx  |2 +-
 sal/osl/unx/process.cxx   |2 +-
 sal/osl/unx/salinit.cxx   |2 +-
 sal/osl/w32/file_dirvol.cxx   |4 ++--
 sal/osl/w32/file_url.cxx  |2 +-
 sal/osl/w32/module.cxx|2 +-
 sal/osl/w32/process.cxx   |2 +-
 sal/osl/w32/profile.cxx   |2 +-
 sal/qa/osl/file/osl_File.cxx  |   14 +++---
 sal/qa/osl/mutex/osl_Mutex.cxx|   14 +++---
 sal/qa/osl/pipe/osl_Pipe.cxx  |6 +++---
 sal/qa/osl/socket/osl_ConnectorSocket.cxx |2 +-
 sal/qa/osl/socket/osl_Socket.cxx  |8 
 sal/qa/osl/socket/osl_SocketAddr.cxx  |4 ++--
 sal/qa/osl/socket/osl_StreamSocket.cxx|8 
 sal/qa/rtl/bootstrap/rtl_Bootstrap.cxx|2 +-
 sal/qa/rtl_strings/rtl_OUString.cxx   |2 +-
 sal/rtl/source/unload.cxx |2 +-
 sal/textenc/tcvtmb.cxx|2 +-
 sal/textenc/tcvtutf8.cxx  |2 +-
 20 files changed, 42 insertions(+), 42 deletions(-)

New commits:
commit fc090acf829d0053c0a611acd73f08b51128031d
Author: Tor Lillqvist 
Date:   Fri Feb 22 11:13:56 2013 +0200

Fix misspellings detected by https://github.com/lyda/misspell-check

Just as a test to check the usefulness of that tool. It needs some 
improvement
before really usable.

Change-Id: I875e79c1992ed5f3b695736b0d49938ad0ba2d55

diff --git a/sal/osl/unx/file_url.cxx b/sal/osl/unx/file_url.cxx
index 7c28b8c..203d17f 100644
--- a/sal/osl/unx/file_url.cxx
+++ b/sal/osl/unx/file_url.cxx
@@ -182,7 +182,7 @@ oslFileError SAL_CALL osl_getSystemPathFromFileURL( 
rtl_uString *ustrFileURL, rt
 {
 nOffset += nIndex;
 
-/* break url down in '/' devided tokens tokens */
+/* break url down in '/' divided tokens tokens */
 nIndex = rtl_ustr_indexOfChar_WithLength( ustrFileURL->buffer + 
nOffset, ustrFileURL->length - nOffset, (sal_Unicode) '/' );
 
 /* copy token to new string */
diff --git a/sal/osl/unx/process.cxx b/sal/osl/unx/process.cxx
index cf246c5..aa71c36 100644
--- a/sal/osl/unx/process.cxx
+++ b/sal/osl/unx/process.cxx
@@ -1158,7 +1158,7 @@ static int is_timeout(const struct timeval* tend)
 }
 
 /**
- kill(pid, 0) is usefull for checking if a
+ kill(pid, 0) is useful for checking if a
  process is still alive, but remember that
  kill even returns 0 if the process is already
  a zombie.
diff --git a/sal/osl/unx/salinit.cxx b/sal/osl/unx/salinit.cxx
index 4211d08..49fddea 100644
--- a/sal/osl/unx/salinit.cxx
+++ b/sal/osl/unx/salinit.cxx
@@ -46,7 +46,7 @@ void sal_detail_initialize(int argc, char ** argv) {
 //  "Unable to update
 // LibreOffice without resetting user profile").  But closing fds in
 // restartOnMac before calling exec does not work, as additional threads
-// might still be running then, wich can still use those fds and cause
+// might still be running then, which can still use those fds and cause
 // crashes.  Therefore, the simples solution is to close fds at process
 // start (as early as possible, so that no other threads have been created
 // yet that might already have opened some fds); this is done for all kinds
diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx
index 89d286b..5d8c3a5 100644
--- a/sal/osl/w32/file_dirvol.cxx
+++ b/sal/osl/w32/file_dirvol.cxx
@@ -491,7 +491,7 @@ static oslFileError osl_openLocalRoot(
 ZeroMemory( pDirImpl, sizeof(Directory_Impl) );
 rtl_uString_newFromString( &pDirImpl->m_pDirectoryPath, strSysPath );
 
-/* Append backslash if neccessary */
+/* Append backslash if necessary */
 
 /* @@@ToDo
use function ensure backslash
@@ -556,7 +556,7 @@ static oslFileError SAL_CALL osl_openFileDirectory(
 ZeroMemory( pDirImpl, sizeof(Directory_Impl) );
 rtl_uString_newFromString( &pDirImpl->m_pDirectoryPath, strDirectoryPath );
 
-/* Append backslash if neccessary */
+/* Append backslash if necessary */
 
 /* @@@ToDo
use function ensure backslash
diff --git a/sal/osl/w32/file_url.cxx b/sal/osl/w32/file_url.cxx
index 2527cbd..324eca1 100644
--- a/sal/osl/w32/file_url.cxx
+++ b/sal/osl/w32/file_url.cxx
@@ -998,7 +998,7 @@ oslFileError SAL_CALL osl_searchFileURL(
 LPCTSTR lpszSearchFile = 
reinterpret_cast(ustrSysPath->buffer);
 
 /* Allocate space for buffer according to previous returned count 
of required chars */
-/* +1 is not neccessary if we follow MSDN documentation but for 
robustness we do so */
+/* +1 is not necessary if we follow MSDN documentation but for 
robustness we do so */
 nBufferLength = dwResult + 1;
 lpBuffer = l