diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-05-16 16:49:03 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-05-16 16:49:03 +0200 |
commit | e85fcef1af0c96b0e8334bd7b6256e0b02810e43 (patch) | |
tree | 71685f34d0d18d4ec1c3a29d289aba9e6c43666b /sal/osl/unx | |
parent | ea3ef1a2a06b7ac0fa9f618498f9caf48ebc40bd (diff) |
Try to fix loplugin:comparisonwithconstant's rewrite-with-macros issue
...that had plagued 2e293a731c1559c9869dfcb32491bc600fc18e4e "new
loplugin/rewriter comparisonwithconstant" (in sal/osl/unx/pipe.cxx), and
auto-rewrite the remaining occurrences in sal (that the mentioned commit had
failed to address, for whatever reason)
Change-Id: I3dc3bae8dd92ba8bf576f6e06e7c9ee21f883661
Diffstat (limited to 'sal/osl/unx')
-rw-r--r-- | sal/osl/unx/pipe.cxx | 2 | ||||
-rw-r--r-- | sal/osl/unx/socket.cxx | 2 | ||||
-rw-r--r-- | sal/osl/unx/tempfile.cxx | 20 | ||||
-rw-r--r-- | sal/osl/unx/thread.cxx | 2 |
4 files changed, 13 insertions, 13 deletions
diff --git a/sal/osl/unx/pipe.cxx b/sal/osl/unx/pipe.cxx index 18a3dac02174..576b38448add 100644 --- a/sal/osl/unx/pipe.cxx +++ b/sal/osl/unx/pipe.cxx @@ -327,7 +327,7 @@ void SAL_CALL osl_releasePipe( oslPipe pPipe ) if( nullptr == pPipe ) return; - if( 0 == osl_atomic_decrement( &(pPipe->m_nRefCount) ) ) + if( osl_atomic_decrement( &(pPipe->m_nRefCount) ) == 0 ) { if( ! pPipe->m_bClosed ) osl_closePipe( pPipe ); diff --git a/sal/osl/unx/socket.cxx b/sal/osl/unx/socket.cxx index dd4055bab54d..15ce591bade9 100644 --- a/sal/osl/unx/socket.cxx +++ b/sal/osl/unx/socket.cxx @@ -1340,7 +1340,7 @@ void SAL_CALL osl_acquireSocket(oslSocket pSocket) void SAL_CALL osl_releaseSocket( oslSocket pSocket ) { - if( pSocket && 0 == osl_atomic_decrement( &(pSocket->m_nRefCount) ) ) + if( pSocket && osl_atomic_decrement( &(pSocket->m_nRefCount) ) == 0 ) { #if defined(CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT) if ( pSocket->m_bIsAccepting ) diff --git a/sal/osl/unx/tempfile.cxx b/sal/osl/unx/tempfile.cxx index f02cd3dcb6a5..fdf85e6014f9 100644 --- a/sal/osl/unx/tempfile.cxx +++ b/sal/osl/unx/tempfile.cxx @@ -119,13 +119,13 @@ static oslFileError osl_setup_base_directory_impl_( else error = osl_getTempDirURL(&dir_url); - if (osl_File_E_None == error) + if (error == osl_File_E_None) { error = osl_getSystemPathFromFileURL_Ex(dir_url, &dir); rtl_uString_release(dir_url); } - if (osl_File_E_None == error) + if (error == osl_File_E_None) { rtl_uString_assign(ppustr_base_dir, dir); rtl_uString_release(dir); @@ -206,7 +206,7 @@ static oslFileError osl_create_temp_file_impl_( /* ensure that the last character is a '/' */ - if ('/' != puchr[len_base_dir - 1]) + if (puchr[len_base_dir - 1] != '/') { rtl_uStringbuffer_insert_ascii( &tmp_file_path, @@ -232,7 +232,7 @@ static oslFileError osl_create_temp_file_impl_( osl_error = osl_getFileURLFromSystemPath( tmp_file_path, &tmp_file_url); - if (osl_File_E_None == osl_error) + if (osl_error == osl_File_E_None) { osl_error = openFile( tmp_file_url, @@ -245,7 +245,7 @@ static oslFileError osl_create_temp_file_impl_( /* in case of error osl_File_E_EXIST we simply try again else we give up */ - if ((osl_File_E_None == osl_error) || (osl_error != osl_File_E_EXIST)) + if ((osl_error == osl_File_E_None) || (osl_error != osl_File_E_EXIST)) { rtl_uString_release(rand_name); @@ -256,7 +256,7 @@ static oslFileError osl_create_temp_file_impl_( } } /* while(1) */ - if (osl_File_E_None == osl_error) + if (osl_error == osl_File_E_None) rtl_uString_assign(ppustr_temp_file_name, tmp_file_path); rtl_uString_release(tmp_file_path); @@ -281,7 +281,7 @@ oslFileError SAL_CALL osl_createTempFile( &base_directory, &b_delete_on_close); - if (osl_File_E_None != osl_error) + if (osl_error != osl_File_E_None) return osl_error; rtl_uString* temp_file_name = nullptr; @@ -289,19 +289,19 @@ oslFileError SAL_CALL osl_createTempFile( base_directory, &temp_file_handle, &temp_file_name); rtl_uString* temp_file_url = nullptr; - if (osl_File_E_None == osl_error) + if (osl_error == osl_File_E_None) { osl_error = osl_getFileURLFromSystemPath(temp_file_name, &temp_file_url); rtl_uString_release(temp_file_name); } - if (osl_File_E_None == osl_error) + if (osl_error == osl_File_E_None) { if (b_delete_on_close) { osl_error = osl_removeFile(temp_file_url); - if (osl_File_E_None == osl_error) + if (osl_error == osl_File_E_None) *pHandle = temp_file_handle; else osl_closeFile(temp_file_handle); diff --git a/sal/osl/unx/thread.cxx b/sal/osl/unx/thread.cxx index a4a666ff2b31..2fb488a48b57 100644 --- a/sal/osl/unx/thread.cxx +++ b/sal/osl/unx/thread.cxx @@ -1019,7 +1019,7 @@ rtl_TextEncoding SAL_CALL osl_getThreadTextEncoding() /* check for thread specific encoding, use default if not set */ threadEncoding = static_cast<rtl_TextEncoding>( reinterpret_cast<sal_uIntPtr>(pthread_getspecific(g_thread.m_textencoding.m_key))); - if (0 == threadEncoding) + if (threadEncoding == 0) threadEncoding = g_thread.m_textencoding.m_default; return threadEncoding; |