summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-12-05 09:55:56 +0100
committerStephan Bergmann <sbergman@redhat.com>2019-12-05 13:31:39 +0100
commit55e596956e56b175ab17b682e7c8ac7daeb9289a (patch)
tree3691e2f43d50019b5e0f0e0145714afb13bcc685 /sal
parent6a10149c5fef13721e3f83727a828556f8e1ec9a (diff)
loplugin:external (clang-cl)
...plus loplugin:consttobool and loplugin:fakebool fallout Change-Id: Ie3d8121815c080b13bea6d9deca1eb138ca56138 Reviewed-on: https://gerrit.libreoffice.org/84515 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/w32/file.cxx4
-rw-r--r--sal/osl/w32/file_dirvol.cxx18
-rw-r--r--sal/osl/w32/file_error.cxx4
-rw-r--r--sal/osl/w32/nlsupport.cxx4
-rw-r--r--sal/osl/w32/pipe.cxx4
-rw-r--r--sal/osl/w32/process.cxx4
-rw-r--r--sal/osl/w32/profile.cxx4
-rw-r--r--sal/osl/w32/socket.cxx6
-rw-r--r--sal/osl/w32/thread.cxx8
-rw-r--r--sal/qa/systools/test_comtools.cxx4
-rw-r--r--sal/rtl/uri.cxx1
11 files changed, 54 insertions, 7 deletions
diff --git a/sal/osl/w32/file.cxx b/sal/osl/w32/file.cxx
index c39c2f16c860..3492ce874550 100644
--- a/sal/osl/w32/file.cxx
+++ b/sal/osl/w32/file.cxx
@@ -41,6 +41,8 @@
#undef min
#endif
+namespace {
+
/** File handle implementation.
*/
struct FileHandle_Impl
@@ -132,6 +134,8 @@ struct FileHandle_Impl
};
};
+}
+
FileHandle_Impl::Guard::Guard(LPCRITICAL_SECTION pMutex)
: m_mutex (pMutex)
{
diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx
index 773b18679f01..d581e1536595 100644
--- a/sal/osl/w32/file_dirvol.cxx
+++ b/sal/osl/w32/file_dirvol.cxx
@@ -221,6 +221,8 @@ oslFileError SAL_CALL osl_getVolumeDeviceMountPath( oslVolumeDeviceHandle Handle
#define DIRECTORYITEM_FILE 1
#define DIRECTORYITEM_SERVER 2
+namespace {
+
struct DirectoryItem_Impl
{
UINT uType;
@@ -229,14 +231,18 @@ struct DirectoryItem_Impl
WCHAR cDriveString[MAX_PATH];
};
rtl_uString* m_pFullPath;
- BOOL bFullPathNormalized;
+ bool bFullPathNormalized;
int nRefCount;
};
+}
+
#define DIRECTORYTYPE_LOCALROOT 0
#define DIRECTORYTYPE_NETROOT 1
#define DIRECTORYTYPE_FILESYSTEM 3
+namespace {
+
struct Directory_Impl
{
UINT uType;
@@ -254,6 +260,8 @@ typedef struct tagDRIVEENUM
LPCWSTR lpCurrent;
} DRIVEENUM, * PDRIVEENUM, FAR * LPDRIVEENUM;
+}
+
static HANDLE WINAPI OpenLogicalDrivesEnum()
{
LPDRIVEENUM pEnum = static_cast<LPDRIVEENUM>(HeapAlloc( GetProcessHeap(), 0, sizeof(DRIVEENUM) ));
@@ -315,12 +323,16 @@ static bool WINAPI CloseLogicalDrivesEnum(HANDLE hEnum)
return fSuccess;
}
+namespace {
+
typedef struct tagDIRECTORY
{
HANDLE hFind;
WIN32_FIND_DATAW aFirstData;
} DIRECTORY, *PDIRECTORY, FAR *LPDIRECTORY;
+}
+
static HANDLE WINAPI OpenDirectory( rtl_uString* pPath)
{
LPDIRECTORY pDirectory = nullptr;
@@ -878,7 +890,7 @@ static oslFileError osl_getNextFileItem(
rtl_uString_newConcat( &pItemImpl->m_pFullPath, pDirImpl->m_pDirectoryPath, pTmpFileName );
rtl_uString_release( pTmpFileName );
- pItemImpl->bFullPathNormalized = FALSE;
+ pItemImpl->bFullPathNormalized = false;
*pItem = static_cast<oslDirectoryItem>(pItemImpl);
return osl_File_E_None;
}
@@ -1677,7 +1689,7 @@ oslFileError SAL_CALL osl_getFileStatus(
{
rtl_uString_newFromStr( &pItemImpl->m_pFullPath, aBuffer );
sFullPath = OUString( pItemImpl->m_pFullPath );
- pItemImpl->bFullPathNormalized = TRUE;
+ pItemImpl->bFullPathNormalized = true;
}
}
diff --git a/sal/osl/w32/file_error.cxx b/sal/osl/w32/file_error.cxx
index 27b0f90cbd2d..c9f8b8a3cc3e 100644
--- a/sal/osl/w32/file_error.cxx
+++ b/sal/osl/w32/file_error.cxx
@@ -20,6 +20,8 @@
#include "file_error.hxx"
#include <winerror.h>
+namespace {
+
/* OS error to oslFileError values mapping table */
struct osl_file_error_entry
{
@@ -27,6 +29,8 @@ struct osl_file_error_entry
int errnocode; /* oslFileError code */
};
+}
+
static const struct osl_file_error_entry errtable[] = {
{ ERROR_SUCCESS, osl_File_E_None }, /* 0 */
{ ERROR_INVALID_FUNCTION, osl_File_E_INVAL }, /* 1 */
diff --git a/sal/osl/w32/nlsupport.cxx b/sal/osl/w32/nlsupport.cxx
index 10888b9d6915..e253cc0cb7e8 100644
--- a/sal/osl/w32/nlsupport.cxx
+++ b/sal/osl/w32/nlsupport.cxx
@@ -41,6 +41,8 @@
#define ELP_LANGUAGE_FIELD_LENGTH 4
#define ELP_COUNTRY_FIELD_LENGTH 3
+namespace {
+
/** Struct used in EnumLocalesProcW() called via EnumSystemLocalesW() to obtain
available locales.
*/
@@ -51,6 +53,8 @@ struct EnumLocalesParams
LCID Locale;
};
+}
+
static DWORD g_dwTLSLocaleEncId = DWORD(-1);
/*****************************************************************************
diff --git a/sal/osl/w32/pipe.cxx b/sal/osl/w32/pipe.cxx
index 89463b899d72..7eef4a99d021 100644
--- a/sal/osl/w32/pipe.cxx
+++ b/sal/osl/w32/pipe.cxx
@@ -36,6 +36,8 @@
#define PIPESYSTEM "\\\\.\\pipe\\"
#define PIPEPREFIX "OSL_PIPE_"
+namespace {
+
typedef struct
{
sal_uInt32 m_Size;
@@ -45,6 +47,8 @@ typedef struct
} oslPipeBuffer;
+}
+
struct oslPipeImpl
{
oslInterlockedCount m_Reference;
diff --git a/sal/osl/w32/process.cxx b/sal/osl/w32/process.cxx
index f235fc5a572c..d052aa15e72e 100644
--- a/sal/osl/w32/process.cxx
+++ b/sal/osl/w32/process.cxx
@@ -302,14 +302,14 @@ oslProcessError bootstrap_getExecutableFile(rtl_uString ** ppFileURL)
return result;
}
-}
-
struct CommandArgs_Impl
{
sal_uInt32 m_nCount;
rtl_uString ** m_ppArgs;
};
+}
+
static struct CommandArgs_Impl g_command_args =
{
0,
diff --git a/sal/osl/w32/profile.cxx b/sal/osl/w32/profile.cxx
index e35f48c2dfee..e095da62ccad 100644
--- a/sal/osl/w32/profile.cxx
+++ b/sal/osl/w32/profile.cxx
@@ -81,8 +81,6 @@ enum osl_TLockMode
un_lock, read_lock, write_lock
};
-}
-
struct osl_TFile
{
HANDLE m_Handle;
@@ -127,6 +125,8 @@ struct osl_TProfileImpl
osl_TProfileSection* m_Sections;
};
+}
+
static osl_TFile* openFileImpl(rtl_uString * strFileName, oslProfileOption ProfileFlags );
static osl_TStamp closeFileImpl(osl_TFile* pFile);
static bool lockFile(const osl_TFile* pFile, osl_TLockMode eMode);
diff --git a/sal/osl/w32/socket.cxx b/sal/osl/w32/socket.cxx
index 3bee3ecde178..e37910f5fd14 100644
--- a/sal/osl/w32/socket.cxx
+++ b/sal/osl/w32/socket.cxx
@@ -219,6 +219,9 @@ static oslSocketError osl_SocketErrorFromNative(int nativeType)
#if OSL_DEBUG_LEVEL > 0
static sal_uInt32 g_nSocketAddr = 0;
+
+namespace {
+
struct LeakWarning
{
~LeakWarning()
@@ -226,6 +229,9 @@ struct LeakWarning
SAL_WARN_IF( g_nSocketAddr, "sal.osl", "sal_socket: " << g_nSocketAddr << " socket address instances leak" );
}
};
+
+}
+
static LeakWarning socketWarning;
#endif
diff --git a/sal/osl/w32/thread.cxx b/sal/osl/w32/thread.cxx
index b9eccf3b8bab..19479de033cd 100644
--- a/sal/osl/w32/thread.cxx
+++ b/sal/osl/w32/thread.cxx
@@ -28,6 +28,8 @@
#include <rtl/tencinfo.h>
#include <errno.h>
+namespace {
+
/**
Thread-data structure hidden behind oslThread:
*/
@@ -41,6 +43,8 @@ typedef struct
} osl_TThreadImpl;
+}
+
static unsigned __stdcall oslWorkerWrapperFunction(void* pData);
static oslThread oslCreateThread(oslWorkerFunction pWorker, void* pThreadData, sal_uInt32 nFlags);
@@ -378,6 +382,8 @@ void SAL_CALL osl_setThreadName(char const * name) {
#endif
}
+namespace {
+
typedef struct TLS_
{
DWORD dwIndex;
@@ -385,6 +391,8 @@ typedef struct TLS_
struct TLS_ *pNext, *pPrev;
} TLS, *PTLS;
+}
+
static PTLS g_pThreadKeyList = nullptr;
CRITICAL_SECTION g_ThreadKeyListCS;
diff --git a/sal/qa/systools/test_comtools.cxx b/sal/qa/systools/test_comtools.cxx
index 096851c9e989..694a4a665b09 100644
--- a/sal/qa/systools/test_comtools.cxx
+++ b/sal/qa/systools/test_comtools.cxx
@@ -21,6 +21,8 @@
#include <cppunit/plugin/TestPlugIn.h>
#include <systools/win32/comtools.hxx>
+namespace {
+
class COMObject : public IUnknown
{
public:
@@ -66,6 +68,8 @@ private:
ULONG ref_count_;
};
+}
+
static sal::systools::COMReference<IUnknown> comObjectSource()
{
return sal::systools::COMReference<IUnknown>(new COMObject);
diff --git a/sal/rtl/uri.cxx b/sal/rtl/uri.cxx
index 592b92c88525..d7da7d48d43d 100644
--- a/sal/rtl/uri.cxx
+++ b/sal/rtl/uri.cxx
@@ -1,3 +1,4 @@
+#include<optional>
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.