From 4828debf7b4fa19bc26e2a02e5606d2c07b4c5d2 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 16 Jan 2019 10:45:54 +0100 Subject: New loplugin:empty Change-Id: I8729db064573ac21dfe6b203c5ae244d79ecc4fe Reviewed-on: https://gerrit.libreoffice.org/66430 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- sal/osl/unx/pipe.cxx | 4 ++-- sal/osl/unx/security.cxx | 4 ++-- sal/osl/unx/socket.cxx | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'sal') diff --git a/sal/osl/unx/pipe.cxx b/sal/osl/unx/pipe.cxx index c38ab152dada..10cb87770128 100644 --- a/sal/osl/unx/pipe.cxx +++ b/sal/osl/unx/pipe.cxx @@ -392,7 +392,7 @@ void SAL_CALL osl_closePipe(oslPipe pPipe) SAL_WARN("sal.osl.pipe", "close() failed: " << UnixErrnoString(errno)); /* remove filesystem entry */ - if (strlen(pPipe->m_Name) > 0) + if (pPipe->m_Name[0] != '\0') unlink(pPipe->m_Name); pPipe->m_bClosed = true; @@ -407,7 +407,7 @@ oslPipe SAL_CALL osl_acceptPipe(oslPipe pPipe) if (!pPipe) return nullptr; - assert(strlen(pPipe->m_Name) > 0); // you cannot have an empty pipe name + assert(pPipe->m_Name[0] != '\0'); // you cannot have an empty pipe name #if defined(CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT) pPipe->m_bIsAccepting = true; diff --git a/sal/osl/unx/security.cxx b/sal/osl/unx/security.cxx index 29897d8e75de..982b7c940c2f 100644 --- a/sal/osl/unx/security.cxx +++ b/sal/osl/unx/security.cxx @@ -320,7 +320,7 @@ static bool osl_psz_getHomeDir(oslSecurity Security, OString* pszDirectory) pStr = getenv("HOME"); #endif - if (pStr != nullptr && strlen(pStr) > 0 && access(pStr, 0) == 0) + if (pStr != nullptr && pStr[0] != '\0' && access(pStr, 0) == 0) { auto const len = std::strlen(pStr); if (len > sal_uInt32(std::numeric_limits::max())) { @@ -389,7 +389,7 @@ static bool osl_psz_getConfigDir(oslSecurity Security, OString* pszDirectory) sal_Char *pStr = getenv("XDG_CONFIG_HOME"); - if (pStr == nullptr || strlen(pStr) == 0 || access(pStr, 0) != 0) + if (pStr == nullptr || pStr[0] == '\0' || access(pStr, 0) != 0) { // a default equal to $HOME/.config should be used. OString home; diff --git a/sal/osl/unx/socket.cxx b/sal/osl/unx/socket.cxx index dd84afc0ccc4..0765daaef2e7 100644 --- a/sal/osl/unx/socket.cxx +++ b/sal/osl/unx/socket.cxx @@ -903,7 +903,7 @@ oslSocketResult osl_psz_getLocalHostname ( { static sal_Char LocalHostname[256] = ""; - if (strlen(LocalHostname) == 0) + if (LocalHostname[0] == '\0') { #ifdef SYSV @@ -940,7 +940,7 @@ oslSocketResult osl_psz_getLocalHostname ( } } - if (strlen(LocalHostname) > 0) + if (LocalHostname[0] != '\0') { strncpy(pBuffer, LocalHostname, nBufLen); pBuffer[nBufLen - 1] = '\0'; -- cgit