From 55e596956e56b175ab17b682e7c8ac7daeb9289a Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 5 Dec 2019 09:55:56 +0100 Subject: 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 --- sal/osl/w32/file.cxx | 4 ++++ sal/osl/w32/file_dirvol.cxx | 18 +++++++++++++++--- sal/osl/w32/file_error.cxx | 4 ++++ sal/osl/w32/nlsupport.cxx | 4 ++++ sal/osl/w32/pipe.cxx | 4 ++++ sal/osl/w32/process.cxx | 4 ++-- sal/osl/w32/profile.cxx | 4 ++-- sal/osl/w32/socket.cxx | 6 ++++++ sal/osl/w32/thread.cxx | 8 ++++++++ 9 files changed, 49 insertions(+), 7 deletions(-) (limited to 'sal/osl') 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(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(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 +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 #include +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; -- cgit