summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2017-06-25 08:03:48 +1000
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-25 12:00:45 +0200
commit609c0d268ff52c0566ad77dc54de2eeb4d5ef4f8 (patch)
treeaf2530ba41eb85aa57e61e59b9ee2cfa4b624c0c /sal
parentdff3a597dad3b76990311ee356e0bd603753d8d3 (diff)
osl: socket.cxx nullptr comparison cleanups
Change-Id: Ie0339482bf3a9b108e26008526bc5e73b761d27b Reviewed-on: https://gerrit.libreoffice.org/39223 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/pipe.cxx20
-rw-r--r--sal/osl/w32/pipe.cxx20
2 files changed, 19 insertions, 21 deletions
diff --git a/sal/osl/unx/pipe.cxx b/sal/osl/unx/pipe.cxx
index d7896df3c093..ead32377303f 100644
--- a/sal/osl/unx/pipe.cxx
+++ b/sal/osl/unx/pipe.cxx
@@ -80,7 +80,7 @@ static oslPipe createPipeImpl()
oslPipe pPipeImpl;
pPipeImpl = static_cast< oslPipe >(calloc(1, sizeof(struct oslPipeImpl)));
- if (pPipeImpl == nullptr)
+ if (!pPipeImpl)
return nullptr;
pPipeImpl->m_nRefCount = 1;
@@ -95,7 +95,7 @@ static oslPipe createPipeImpl()
static void destroyPipeImpl(oslPipe pImpl)
{
- if (pImpl != nullptr)
+ if (pImpl)
free(pImpl);
}
@@ -104,7 +104,7 @@ oslPipe SAL_CALL osl_createPipe(rtl_uString *ustrPipeName, oslPipeOptions Option
oslPipe pPipe = nullptr;
rtl_String* strPipeName = nullptr;
- if (ustrPipeName != nullptr)
+ if (ustrPipeName)
{
rtl_uString2String(&strPipeName,
rtl_uString_getStr(ustrPipeName),
@@ -114,7 +114,7 @@ oslPipe SAL_CALL osl_createPipe(rtl_uString *ustrPipeName, oslPipeOptions Option
sal_Char* pszPipeName = rtl_string_getStr(strPipeName);
pPipe = osl_psz_createPipe(pszPipeName, Options, Security);
- if (strPipeName != nullptr)
+ if (strPipeName)
rtl_string_release(strPipeName);
}
@@ -213,7 +213,7 @@ oslPipe SAL_CALL osl_psz_createPipe(const sal_Char *pszPipeName, oslPipeOptions
/* alloc memory */
pPipe = createPipeImpl();
- if (pPipe == nullptr)
+ if (!pPipe)
return nullptr;
/* create socket */
@@ -319,7 +319,7 @@ void SAL_CALL osl_acquirePipe(oslPipe pPipe)
void SAL_CALL osl_releasePipe(oslPipe pPipe)
{
- if(pPipe == nullptr)
+ if (!pPipe)
return;
if (osl_atomic_decrement(&(pPipe->m_nRefCount)) == 0)
@@ -399,7 +399,7 @@ oslPipe SAL_CALL osl_acceptPipe(oslPipe pPipe)
oslPipe pAcceptedPipe;
OSL_ASSERT(pPipe);
- if (pPipe == nullptr)
+ if (!pPipe)
return nullptr;
OSL_ASSERT(strlen(pPipe->m_Name) > 0);
@@ -432,7 +432,7 @@ oslPipe SAL_CALL osl_acceptPipe(oslPipe pPipe)
pAcceptedPipe = createPipeImpl();
OSL_ASSERT(pAcceptedPipe);
- if(pAcceptedPipe==nullptr)
+ if (!pAcceptedPipe)
{
close(s);
return nullptr;
@@ -460,7 +460,7 @@ sal_Int32 SAL_CALL osl_receivePipe(oslPipe pPipe,
OSL_ASSERT(pPipe);
- if (pPipe == nullptr)
+ if (!pPipe)
{
SAL_WARN("sal.osl.pipe", "osl_receivePipe: Invalid socket");
errno=EINVAL;
@@ -483,7 +483,7 @@ sal_Int32 SAL_CALL osl_sendPipe(oslPipe pPipe,
OSL_ASSERT(pPipe);
- if (pPipe == nullptr)
+ if (!pPipe)
{
SAL_WARN("sal.osl.pipe", "osl_sendPipe: Invalid socket");
errno=EINVAL;
diff --git a/sal/osl/w32/pipe.cxx b/sal/osl/w32/pipe.cxx
index ac75fc0236c7..217b18d918f8 100644
--- a/sal/osl/w32/pipe.cxx
+++ b/sal/osl/w32/pipe.cxx
@@ -78,12 +78,12 @@ oslPipe osl_createPipeImpl(void)
void osl_destroyPipeImpl(oslPipe pPipe)
{
- if (pPipe != nullptr)
+ if (pPipe)
{
- if ( pPipe->m_NamedObject != INVALID_HANDLE_VALUE && pPipe->m_NamedObject != nullptr )
- CloseHandle( pPipe->m_NamedObject );
+ if (pPipe->m_NamedObject != INVALID_HANDLE_VALUE && pPipe->m_NamedObject)
+ CloseHandle(pPipe->m_NamedObject);
- if (pPipe->m_Security != nullptr)
+ if (pPipe->m_Security)
{
rtl_freeMemory(pPipe->m_Security->lpSecurityDescriptor);
rtl_freeMemory(pPipe->m_Security);
@@ -165,7 +165,7 @@ oslPipe SAL_CALL osl_createPipe(rtl_uString *strPipeName, oslPipeOptions Options
pPipe->m_NamedObject = CreateMutexW(nullptr, FALSE, SAL_W(name->buffer));
- if (pPipe->m_NamedObject != INVALID_HANDLE_VALUE && pPipe->m_NamedObject != nullptr)
+ if (pPipe->m_NamedObject != INVALID_HANDLE_VALUE && pPipe->m_NamedObject)
{
if (GetLastError() != ERROR_ALREADY_EXISTS)
{
@@ -247,12 +247,10 @@ void SAL_CALL osl_acquirePipe(oslPipe pPipe)
void SAL_CALL osl_releasePipe(oslPipe pPipe)
{
-// OSL_ASSERT( pPipe );
-
- if (nullptr == pPipe)
+ if (!pPipe)
return;
- if (0 == osl_atomic_decrement(&(pPipe->m_Reference)))
+ if (osl_atomic_decrement(&(pPipe->m_Reference)) == 0)
{
if (!pPipe->m_bClosed)
osl_closePipe(pPipe);
@@ -263,7 +261,7 @@ void SAL_CALL osl_releasePipe(oslPipe pPipe)
void SAL_CALL osl_closePipe(oslPipe pPipe)
{
- if(pPipe && !pPipe->m_bClosed)
+ if (pPipe && !pPipe->m_bClosed)
{
pPipe->m_bClosed = true;
/* if we have a system pipe close it */
@@ -467,7 +465,7 @@ oslPipeError SAL_CALL osl_getLastPipeError(oslPipe pPipe)
{
oslPipeError Error;
- if (pPipe != nullptr)
+ if (pPipe)
{
Error = pPipe->m_Error;
pPipe->m_Error = osl_Pipe_E_None;