compilerplugins/clang/comparisonwithconstant.cxx |  134 +++++++++++++++++++++++
 sal/osl/unx/file.cxx                             |   80 ++++++-------
 sal/osl/unx/file_error_transl.cxx                |    2 
 sal/osl/unx/file_misc.cxx                        |   16 +-
 sal/osl/unx/file_path_helper.cxx                 |    8 -
 sal/osl/unx/file_stat.cxx                        |    4 
 sal/osl/unx/file_url.cxx                         |   60 +++++-----
 sal/osl/unx/module.cxx                           |    2 
 sal/osl/unx/nlsupport.cxx                        |    4 
 sal/osl/unx/process.cxx                          |    6 -
 sal/rtl/bootstrap.cxx                            |   22 +--
 sal/rtl/cmdargs.cxx                              |   10 -
 12 files changed, 241 insertions(+), 107 deletions(-)

New commits:
commit 2e293a731c1559c9869dfcb32491bc600fc18e4e
Author: Noel Grandin <noel.gran...@collabora.co.uk>
Date:   Thu Dec 1 13:02:55 2016 +0200

    new loplugin/rewriter comparisonwithconstant
    
    As per sberg' suggestion
    
    Limit it to == and !=, because some people like the flow of inequalities
    like: "0 < a && a < 42"
    
    The changes to sal/ were made using the rewriter.
    
    The rewriter still has one bug, in pipe.cxx, it managed to pick up
    some random piece of macro. No idea why.
    
    Change-Id: I01305f9c5396a4b6c7421d6e92f1b4b529388e82
    Reviewed-on: https://gerrit.libreoffice.org/30962
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/compilerplugins/clang/comparisonwithconstant.cxx 
b/compilerplugins/clang/comparisonwithconstant.cxx
new file mode 100644
index 0000000..5f8deff
--- /dev/null
+++ b/compilerplugins/clang/comparisonwithconstant.cxx
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <cassert>
+#include <string>
+#include <iostream>
+#include <fstream>
+#include <set>
+
+#include "compat.hxx"
+#include "plugin.hxx"
+
+/**
+  Look for comparisons where the constant is on the left, it should be on the 
right.
+ */
+
+namespace {
+
+class ComparisonWithConstant :
+    public RecursiveASTVisitor<ComparisonWithConstant>, public 
loplugin::RewritePlugin
+{
+public:
+    explicit ComparisonWithConstant(InstantiationData const & data): 
RewritePlugin(data) {}
+
+    virtual void run() override
+    {
+        /*
+        StringRef fn( compiler.getSourceManager().getFileEntryForID(
+                          
compiler.getSourceManager().getMainFileID())->getName() );
+        if (fn == SRCDIR 
"/sd/source/ui/framework/factories/ChildWindowPane.cxx")
+             return;
+        if (fn == SRCDIR "/forms/source/component/Date.cxx")
+             return;
+        if (fn == SRCDIR "/forms/source/component/Time.cxx")
+            return;
+*/
+        TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+    }
+
+    bool VisitBinaryOperator(const BinaryOperator *);
+private:
+    bool rewrite(const BinaryOperator *);
+    std::string getExprAsString(const Expr* expr);
+};
+
+bool ComparisonWithConstant::VisitBinaryOperator(const BinaryOperator* 
binaryOp)
+{
+    if (ignoreLocation(binaryOp)) {
+        return true;
+    }
+    if (!(binaryOp->getOpcode() == BO_EQ || binaryOp->getOpcode() == BO_NE)) {
+        return true;
+    }
+    // ignore logging macros
+    if 
(compiler.getSourceManager().isMacroBodyExpansion(binaryOp->getSourceRange().getBegin())
+        || 
compiler.getSourceManager().isMacroArgExpansion(binaryOp->getSourceRange().getBegin()))
 {
+        return true;
+    }
+    // protect against clang assert
+    if (binaryOp->getLHS()->isValueDependent() || 
binaryOp->getRHS()->isValueDependent()) {
+        return true;
+    }
+    APValue result;
+    if (!binaryOp->getLHS()->isIntegerConstantExpr(compiler.getASTContext())) {
+        return true;
+    }
+    if (binaryOp->getRHS()->isIntegerConstantExpr(compiler.getASTContext())) {
+        return true;
+    }
+    if (!rewrite(binaryOp))
+    {
+        report(
+            DiagnosticsEngine::Warning, "Rather put constant on right when 
comparing",
+            binaryOp->getSourceRange().getBegin())
+            << binaryOp->getSourceRange();
+    }
+    return true;
+}
+
+
+bool ComparisonWithConstant::rewrite(const BinaryOperator * binaryOp) {
+    if (rewriter == nullptr) {
+        return false;
+    }
+    const Expr* LHS = binaryOp->getLHS();
+    const Expr* RHS = binaryOp->getRHS();
+
+    const std::string lhsString = getExprAsString(LHS);
+    const std::string rhsString = getExprAsString(RHS);
+
+    /* we can't safely move around stuff containing comments, we mess up the 
resulting code */
+    if ( lhsString.find("/*") != std::string::npos || lhsString.find("//") != 
std::string::npos ) {
+        return false;
+    }
+    if ( rhsString.find("/*") != std::string::npos || rhsString.find("//") != 
std::string::npos ) {
+        return false;
+    }
+
+    // switch LHS and RHS
+    RewriteOptions opts;
+    if (!replaceText(SourceRange(LHS->getLocStart(), LHS->getLocEnd()), 
rhsString)) {
+        return false;
+    }
+    if (!replaceText(SourceRange(RHS->getLocStart(), RHS->getLocEnd()), 
lhsString)) {
+        return false;
+    }
+
+    return true;
+}
+
+// get the expression contents
+std::string ComparisonWithConstant::getExprAsString(const Expr* expr)
+{
+    SourceManager& SM = compiler.getSourceManager();
+    SourceLocation startLoc = expr->getLocStart();
+    SourceLocation endLoc = expr->getLocEnd();
+    const char *p1 = SM.getCharacterData( startLoc );
+    const char *p2 = SM.getCharacterData( endLoc );
+    unsigned n = Lexer::MeasureTokenLength( endLoc, SM, 
compiler.getLangOpts());
+    return std::string( p1, p2 - p1 + n);
+}
+
+
+loplugin::Plugin::Registration< ComparisonWithConstant > 
X("comparisonwithconstant", false);
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index b9b7e6f..4751dc2 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -193,7 +193,7 @@ FileHandle_Impl::Allocator::Allocator()
       m_bufsiz (0)
 {
     size_t const pagesize = FileHandle_Impl::getpagesize();
-    if (size_t(-1) != pagesize)
+    if (pagesize != size_t(-1))
     {
         m_cache  = rtl_cache_create (
             "osl_file_buffer_cache", pagesize, 0, nullptr, nullptr, nullptr, 
nullptr, nullptr, 0);
@@ -306,7 +306,7 @@ sal_uInt64 FileHandle_Impl::getSize() const
 oslFileError FileHandle_Impl::setSize (sal_uInt64 uSize)
 {
     off_t const nSize = sal::static_int_cast< off_t >(uSize);
-    if (-1 == ftruncate_with_name (m_fd, nSize, m_strFilePath))
+    if (ftruncate_with_name (m_fd, nSize, m_strFilePath) == -1)
     {
         /* Failure. Save original result. Try fallback algorithm */
         oslFileError result = oslTranslateFileError (OSL_FET_ERROR, errno);
@@ -324,10 +324,10 @@ oslFileError FileHandle_Impl::setSize (sal_uInt64 uSize)
             return result;
 
         /* Try 'expand' via 'lseek()' and 'write()' */
-        if (-1 == lseek (m_fd, (off_t)(nSize - 1), SEEK_SET))
+        if (lseek (m_fd, (off_t)(nSize - 1), SEEK_SET) == -1)
             return result;
 
-        if (-1 == write (m_fd, "", (size_t)1))
+        if (write (m_fd, "", (size_t)1) == -1)
         {
             /* Failure. Restore saved position */
             (void) lseek (m_fd, (off_t)(nCurPos), SEEK_SET);
@@ -335,7 +335,7 @@ oslFileError FileHandle_Impl::setSize (sal_uInt64 uSize)
         }
 
         /* Success. Restore saved position */
-        if (-1 == lseek (m_fd, (off_t)nCurPos, SEEK_SET))
+        if (lseek (m_fd, (off_t)nCurPos, SEEK_SET) == -1)
             return result;
     }
 
@@ -377,7 +377,7 @@ oslFileError FileHandle_Impl::readAt (
     }
 
     ssize_t nBytes = ::pread (m_fd, pBuffer, nBytesRequested, nOffset);
-    if ((-1 == nBytes) && (EOVERFLOW == errno))
+    if ((nBytes == -1) && (EOVERFLOW == errno))
     {
         /* Some 'pread()'s fail with EOVERFLOW when reading at (or past)
          * end-of-file, different from 'lseek() + read()' behaviour.
@@ -385,7 +385,7 @@ oslFileError FileHandle_Impl::readAt (
          */
         nBytes = 0;
     }
-    if (-1 == nBytes)
+    if (nBytes == -1)
         return oslTranslateFileError (OSL_FET_ERROR, errno);
 
     *pBytesRead = nBytes;
@@ -407,7 +407,7 @@ oslFileError FileHandle_Impl::writeAt (
         return osl_File_E_BADF;
 
     ssize_t nBytes = ::pwrite (m_fd, pBuffer, nBytesToWrite, nOffset);
-    if (-1 == nBytes)
+    if (nBytes == -1)
         return oslTranslateFileError (OSL_FET_ERROR, errno);
 
     m_size = std::max (m_size, sal::static_int_cast< sal_uInt64 >(nOffset + 
nBytes));
@@ -422,11 +422,11 @@ oslFileError FileHandle_Impl::readFileAt (
     size_t       nBytesRequested,
     sal_uInt64 * pBytesRead)
 {
-    if (0 == (m_state & STATE_SEEKABLE))
+    if ((m_state & STATE_SEEKABLE) == 0)
     {
         // not seekable (pipe)
         ssize_t nBytes = ::read (m_fd, pBuffer, nBytesRequested);
-        if (-1 == nBytes)
+        if (nBytes == -1)
             return oslTranslateFileError (OSL_FET_ERROR, errno);
         *pBytesRead = nBytes;
         return osl_File_E_None;
@@ -497,11 +497,11 @@ oslFileError FileHandle_Impl::writeFileAt (
     size_t       nBytesToWrite,
     sal_uInt64 * pBytesWritten)
 {
-    if (0 == (m_state & STATE_SEEKABLE))
+    if ((m_state & STATE_SEEKABLE) == 0)
     {
         // not seekable (pipe)
         ssize_t nBytes = ::write (m_fd, pBuffer, nBytesToWrite);
-        if (-1 == nBytes)
+        if (nBytes == -1)
             return oslTranslateFileError (OSL_FET_ERROR, errno);
         *pBytesWritten = nBytes;
         return osl_File_E_None;
@@ -730,11 +730,11 @@ oslFileError FileHandle_Impl::syncFile()
 
 oslFileHandle osl::detail::createFileHandleFromFD( int fd )
 {
-    if (-1 == fd)
+    if (fd == -1)
         return nullptr; // EINVAL
 
     struct stat aFileStat;
-    if (-1 == fstat (fd, &aFileStat))
+    if (fstat (fd, &aFileStat) == -1)
         return nullptr; // EBADF
 
     FileHandle_Impl * pImpl = new FileHandle_Impl (fd);
@@ -935,7 +935,7 @@ openFilePath( const char *cpFilePath, oslFileHandle* 
pHandle, sal_uInt32 uFlags,
         fd = open_c( cpFilePath, rdonly_flags, mode );
     }
 #endif
-    if (-1 == fd)
+    if (fd == -1)
     {
         int saved_errno = errno;
         SAL_INFO("sal.file", "osl_openFile(" << cpFilePath << ", " << ((flags 
& O_RDWR) ? "writeable":"readonly") << ") failed: " << strerror(saved_errno));
@@ -947,7 +947,7 @@ openFilePath( const char *cpFilePath, oslFileHandle* 
pHandle, sal_uInt32 uFlags,
     if (flags & O_NONBLOCK)
     {
         int f = fcntl (fd, F_GETFL, 0);
-        if (-1 == f)
+        if (f == -1)
         {
             int saved_errno = errno;
             SAL_INFO("sal.file", "osl_openFile(" << cpFilePath << ", " << 
((flags & O_RDWR) ? "writeable":"readonly") << "): fcntl(" << fd << ", F_GETFL) 
failed: " << strerror(saved_errno));
@@ -955,7 +955,7 @@ openFilePath( const char *cpFilePath, oslFileHandle* 
pHandle, sal_uInt32 uFlags,
             (void) close(fd);
             return eRet;
         }
-        if (-1 == fcntl (fd, F_SETFL, (f & ~O_NONBLOCK)))
+        if (fcntl (fd, F_SETFL, (f & ~O_NONBLOCK)) == -1)
         {
             int saved_errno = errno;
              SAL_INFO("sal.file", "osl_openFile(" << cpFilePath << ", " << 
((flags & O_RDWR) ? "writeable":"readonly") << "): fcntl(" << fd << ", F_SETFL) 
failed: " << strerror(saved_errno));
@@ -967,7 +967,7 @@ openFilePath( const char *cpFilePath, oslFileHandle* 
pHandle, sal_uInt32 uFlags,
 #endif
     /* get file status (mode, size) */
     struct stat aFileStat;
-    if (-1 == fstat (fd, &aFileStat))
+    if (fstat (fd, &aFileStat) == -1)
     {
         int saved_errno = errno;
         SAL_INFO("sal.file", "osl_openFile(" << cpFilePath << ", " << ((flags 
& O_RDWR) ? "writeable":"readonly") << "): fstat(" << fd << ") failed: " << 
strerror(saved_errno));
@@ -1005,7 +1005,7 @@ openFilePath( const char *cpFilePath, oslFileHandle* 
pHandle, sal_uInt32 uFlags,
             aflock.l_start = 0;
             aflock.l_len = 0;
 
-            if (-1 == fcntl (fd, F_SETLK, &aflock))
+            if (fcntl (fd, F_SETLK, &aflock) == -1)
             {
                 int saved_errno = errno;
                 SAL_INFO("sal.file", "osl_openFile(" << cpFilePath << ", " << 
((flags & O_RDWR) ? "writeable":"readonly") << "): fcntl(" << fd << ", F_SETLK) 
failed: " << strerror(saved_errno));
@@ -1095,7 +1095,7 @@ SAL_CALL osl_closeFile( oslFileHandle Handle )
         /* close, ignoring double failure */
         (void) close (pImpl->m_fd);
     }
-    else if (-1 == close (pImpl->m_fd))
+    else if (close (pImpl->m_fd) == -1)
     {
         /* translate error code */
         result = oslTranslateFileError (OSL_FET_ERROR, errno);
@@ -1111,7 +1111,7 @@ SAL_CALL osl_syncFile(oslFileHandle Handle)
 {
     FileHandle_Impl* pImpl = static_cast<FileHandle_Impl*>(Handle);
 
-    if ((nullptr == pImpl) || ((pImpl->m_kind == FileHandle_Impl::KIND_FD) && 
(-1 == pImpl->m_fd)))
+    if ((nullptr == pImpl) || ((pImpl->m_kind == FileHandle_Impl::KIND_FD) && 
(pImpl->m_fd == -1)))
         return osl_File_E_INVAL;
 
     if (pImpl->m_kind == FileHandle_Impl::KIND_MEM)
@@ -1123,7 +1123,7 @@ SAL_CALL osl_syncFile(oslFileHandle Handle)
     oslFileError result = pImpl->syncFile();
     if (result != osl_File_E_None)
         return result;
-    if (-1 == fsync (pImpl->m_fd))
+    if (fsync (pImpl->m_fd) == -1)
         return oslTranslateFileError (OSL_FET_ERROR, errno);
 
     return osl_File_E_None;
@@ -1142,7 +1142,7 @@ SAL_CALL osl_mapFile (
 {
     FileHandle_Impl* pImpl = static_cast<FileHandle_Impl*>(Handle);
 
-    if ((nullptr == pImpl) || ((pImpl->m_kind == FileHandle_Impl::KIND_FD) && 
(-1 == pImpl->m_fd)) || (nullptr == ppAddr))
+    if ((nullptr == pImpl) || ((pImpl->m_kind == FileHandle_Impl::KIND_FD) && 
(pImpl->m_fd == -1)) || (nullptr == ppAddr))
         return osl_File_E_INVAL;
     *ppAddr = nullptr;
 
@@ -1171,7 +1171,7 @@ SAL_CALL osl_mapFile (
     {
         // Determine memory pagesize.
         size_t const nPageSize = FileHandle_Impl::getpagesize();
-        if (size_t(-1) != nPageSize)
+        if (nPageSize != size_t(-1))
         {
             /*
              * Pagein, touching first byte of every memory page.
@@ -1229,7 +1229,7 @@ unmapFile (void* pAddr, sal_uInt64 uLength)
         return osl_File_E_OVERFLOW;
     size_t const nLength = sal::static_int_cast< size_t >(uLength);
 
-    if (-1 == munmap(pAddr, nLength))
+    if (munmap(pAddr, nLength) == -1)
         return oslTranslateFileError(OSL_FET_ERROR, errno);
 
     return osl_File_E_None;
@@ -1273,7 +1273,7 @@ SAL_CALL osl_readLine (
 {
     FileHandle_Impl * pImpl = static_cast<FileHandle_Impl*>(Handle);
 
-    if ((nullptr == pImpl) || ((pImpl->m_kind == FileHandle_Impl::KIND_FD) && 
(-1 == pImpl->m_fd)) || (nullptr == ppSequence))
+    if ((nullptr == pImpl) || ((pImpl->m_kind == FileHandle_Impl::KIND_FD) && 
(pImpl->m_fd == -1)) || (nullptr == ppSequence))
         return osl_File_E_INVAL;
     sal_uInt64 uBytesRead = 0;
 
@@ -1295,7 +1295,7 @@ SAL_CALL osl_readFile (
 {
     FileHandle_Impl* pImpl = static_cast<FileHandle_Impl*>(Handle);
 
-    if ((nullptr == pImpl) || ((pImpl->m_kind == FileHandle_Impl::KIND_FD) && 
(-1 == pImpl->m_fd)) || (nullptr == pBuffer) || (nullptr == pBytesRead))
+    if ((nullptr == pImpl) || ((pImpl->m_kind == FileHandle_Impl::KIND_FD) && 
(pImpl->m_fd == -1)) || (nullptr == pBuffer) || (nullptr == pBytesRead))
         return osl_File_E_INVAL;
 
     static sal_uInt64 const g_limit_ssize_t = std::numeric_limits< ssize_t 
>::max();
@@ -1321,9 +1321,9 @@ SAL_CALL osl_writeFile (
 {
     FileHandle_Impl* pImpl = static_cast<FileHandle_Impl*>(Handle);
 
-    if ((nullptr == pImpl) || (-1 == pImpl->m_fd) || (nullptr == pBuffer) || 
(nullptr == pBytesWritten))
+    if ((nullptr == pImpl) || (pImpl->m_fd == -1) || (nullptr == pBuffer) || 
(nullptr == pBytesWritten))
         return osl_File_E_INVAL;
-    if (0 == (pImpl->m_state & FileHandle_Impl::STATE_WRITEABLE))
+    if ((pImpl->m_state & FileHandle_Impl::STATE_WRITEABLE) == 0)
         return osl_File_E_BADF;
 
     static sal_uInt64 const g_limit_ssize_t = std::numeric_limits< ssize_t 
>::max();
@@ -1350,9 +1350,9 @@ SAL_CALL osl_readFileAt (
 {
     FileHandle_Impl* pImpl = static_cast<FileHandle_Impl*>(Handle);
 
-    if ((nullptr == pImpl) || ((pImpl->m_kind == FileHandle_Impl::KIND_FD) && 
(-1 == pImpl->m_fd)) || (nullptr == pBuffer) || (nullptr == pBytesRead))
+    if ((nullptr == pImpl) || ((pImpl->m_kind == FileHandle_Impl::KIND_FD) && 
(pImpl->m_fd == -1)) || (nullptr == pBuffer) || (nullptr == pBytesRead))
         return osl_File_E_INVAL;
-    if (0 == (pImpl->m_state & FileHandle_Impl::STATE_SEEKABLE))
+    if ((pImpl->m_state & FileHandle_Impl::STATE_SEEKABLE) == 0)
         return osl_File_E_SPIPE;
 
     sal_uInt64 const limit_off_t = MAX_OFF_T;
@@ -1380,11 +1380,11 @@ SAL_CALL osl_writeFileAt (
 {
     FileHandle_Impl* pImpl = static_cast<FileHandle_Impl*>(Handle);
 
-    if ((nullptr == pImpl) || (-1 == pImpl->m_fd) || (nullptr == pBuffer) || 
(nullptr == pBytesWritten))
+    if ((nullptr == pImpl) || (pImpl->m_fd == -1) || (nullptr == pBuffer) || 
(nullptr == pBytesWritten))
         return osl_File_E_INVAL;
-    if (0 == (pImpl->m_state & FileHandle_Impl::STATE_SEEKABLE))
+    if ((pImpl->m_state & FileHandle_Impl::STATE_SEEKABLE) == 0)
         return osl_File_E_SPIPE;
-    if (0 == (pImpl->m_state & FileHandle_Impl::STATE_WRITEABLE))
+    if ((pImpl->m_state & FileHandle_Impl::STATE_WRITEABLE) == 0)
         return osl_File_E_BADF;
 
     sal_uInt64 const limit_off_t = MAX_OFF_T;
@@ -1407,7 +1407,7 @@ SAL_CALL osl_isEndOfFile( oslFileHandle Handle, sal_Bool 
*pIsEOF )
 {
     FileHandle_Impl* pImpl = static_cast<FileHandle_Impl*>(Handle);
 
-    if ((nullptr == pImpl) || ((pImpl->m_kind == FileHandle_Impl::KIND_FD) && 
(-1 == pImpl->m_fd)) || (nullptr == pIsEOF))
+    if ((nullptr == pImpl) || ((pImpl->m_kind == FileHandle_Impl::KIND_FD) && 
(pImpl->m_fd == -1)) || (nullptr == pIsEOF))
         return osl_File_E_INVAL;
 
     FileHandle_Impl::Guard lock (&(pImpl->m_mutex));
@@ -1420,7 +1420,7 @@ SAL_CALL osl_getFilePos( oslFileHandle Handle, 
sal_uInt64* pPos )
 {
     FileHandle_Impl* pImpl = static_cast<FileHandle_Impl*>(Handle);
 
-    if ((nullptr == pImpl) || ((pImpl->m_kind == FileHandle_Impl::KIND_FD) && 
(-1 == pImpl->m_fd)) || (nullptr == pPos))
+    if ((nullptr == pImpl) || ((pImpl->m_kind == FileHandle_Impl::KIND_FD) && 
(pImpl->m_fd == -1)) || (nullptr == pPos))
         return osl_File_E_INVAL;
 
     FileHandle_Impl::Guard lock (&(pImpl->m_mutex));
@@ -1433,7 +1433,7 @@ SAL_CALL osl_setFilePos (oslFileHandle Handle, sal_uInt32 
uHow, sal_Int64 uOffse
 {
     FileHandle_Impl* pImpl = static_cast<FileHandle_Impl*>(Handle);
 
-    if ((nullptr == pImpl) || ((pImpl->m_kind == FileHandle_Impl::KIND_FD) && 
(-1 == pImpl->m_fd)))
+    if ((nullptr == pImpl) || ((pImpl->m_kind == FileHandle_Impl::KIND_FD) && 
(pImpl->m_fd == -1)))
         return osl_File_E_INVAL;
 
     sal_Int64 const limit_off_t = MAX_OFF_T;
@@ -1477,7 +1477,7 @@ SAL_CALL osl_getFileSize( oslFileHandle Handle, 
sal_uInt64* pSize )
 {
     FileHandle_Impl* pImpl = static_cast<FileHandle_Impl*>(Handle);
 
-    if ((nullptr == pImpl) || ((pImpl->m_kind == FileHandle_Impl::KIND_FD) && 
(-1 == pImpl->m_fd)) || (nullptr == pSize))
+    if ((nullptr == pImpl) || ((pImpl->m_kind == FileHandle_Impl::KIND_FD) && 
(pImpl->m_fd == -1)) || (nullptr == pSize))
         return osl_File_E_INVAL;
 
     FileHandle_Impl::Guard lock (&(pImpl->m_mutex));
@@ -1490,9 +1490,9 @@ SAL_CALL osl_setFileSize( oslFileHandle Handle, 
sal_uInt64 uSize )
 {
     FileHandle_Impl* pImpl = static_cast<FileHandle_Impl*>(Handle);
 
-    if ((nullptr == pImpl) || (-1 == pImpl->m_fd))
+    if ((nullptr == pImpl) || (pImpl->m_fd == -1))
         return osl_File_E_INVAL;
-    if (0 == (pImpl->m_state & FileHandle_Impl::STATE_WRITEABLE))
+    if ((pImpl->m_state & FileHandle_Impl::STATE_WRITEABLE) == 0)
         return osl_File_E_BADF;
 
     sal_uInt64 const limit_off_t = MAX_OFF_T;
diff --git a/sal/osl/unx/file_error_transl.cxx 
b/sal/osl/unx/file_error_transl.cxx
index bdeed9b..c012e25 100644
--- a/sal/osl/unx/file_error_transl.cxx
+++ b/sal/osl/unx/file_error_transl.cxx
@@ -29,7 +29,7 @@ oslFileError oslTranslateFileError(bool bIsError, int Errno)
 
     /* Have a look at file_error_transl.hxx for
        the reason that we do this here */
-    if (bIsError && (0 == Errno))
+    if (bIsError && (Errno == 0))
         return osl_error;
 
     switch(Errno)
diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx
index 3c0ea77..ce1ec16 100644
--- a/sal/osl/unx/file_misc.cxx
+++ b/sal/osl/unx/file_misc.cxx
@@ -103,7 +103,7 @@ void DirectoryItem_Impl::acquire()
 }
 void DirectoryItem_Impl::release()
 {
-    if (0 == --m_RefCount)
+    if (--m_RefCount == 0)
         delete this;
 }
 
@@ -143,13 +143,13 @@ oslFileError SAL_CALL osl_openDirectory(rtl_uString* 
ustrDirectoryURL, oslDirect
 
     char path[PATH_MAX];
 
-    if ((nullptr == ustrDirectoryURL) || (0 == ustrDirectoryURL->length) || 
(nullptr == pDirectory))
+    if ((nullptr == ustrDirectoryURL) || (ustrDirectoryURL->length == 0) || 
(nullptr == pDirectory))
         return osl_File_E_INVAL;
 
     /* convert file URL to system path */
     eRet = osl_getSystemPathFromFileURL_Ex(ustrDirectoryURL, &ustrSystemPath);
 
-    if( osl_File_E_None != eRet )
+    if( eRet != osl_File_E_None )
         return eRet;
 
     osl_systemPathRemoveSeparator(ustrSystemPath);
@@ -272,7 +272,7 @@ static struct dirent* osl_readdir_impl_(DIR* pdir, bool 
bFilterLocalAndParentDir
     while ((pdirent = readdir(pdir)) != nullptr)
     {
         if (bFilterLocalAndParentDir &&
-            ((0 == strcmp(pdirent->d_name, ".")) || (0 == 
strcmp(pdirent->d_name, ".."))))
+            ((strcmp(pdirent->d_name, ".") == 0) || (strcmp(pdirent->d_name, 
"..") == 0)))
             continue;
         else
             break;
@@ -354,16 +354,16 @@ oslFileError SAL_CALL osl_getDirectoryItem( rtl_uString* 
ustrFileURL, oslDirecto
     oslFileError osl_error      = osl_File_E_INVAL;
 
     OSL_ASSERT((nullptr != ustrFileURL) && (nullptr != pItem));
-    if ((nullptr == ustrFileURL) || (0 == ustrFileURL->length) || (nullptr == 
pItem))
+    if ((nullptr == ustrFileURL) || (ustrFileURL->length == 0) || (nullptr == 
pItem))
         return osl_File_E_INVAL;
 
     osl_error = osl_getSystemPathFromFileURL_Ex(ustrFileURL, &ustrSystemPath);
-    if (osl_File_E_None != osl_error)
+    if (osl_error != osl_File_E_None)
         return osl_error;
 
     osl_systemPathRemoveSeparator(ustrSystemPath);
 
-    if (-1 == access_u(ustrSystemPath, F_OK))
+    if (access_u(ustrSystemPath, F_OK) == -1)
     {
         osl_error = oslTranslateFileError(OSL_FET_ERROR, errno);
     }
@@ -543,7 +543,7 @@ static oslFileError create_dir_recursively_(
     oslFileError osl_error = create_dir_recursively_(
         dir_path, aDirectoryCreationCallbackFunc, pData);
 
-    if (osl_File_E_None != osl_error)
+    if (osl_error != osl_File_E_None)
         return osl_error;
 
        dir_path[pos] = '/';
diff --git a/sal/osl/unx/file_path_helper.cxx b/sal/osl/unx/file_path_helper.cxx
index 23486c5..8a4a464 100644
--- a/sal/osl/unx/file_path_helper.cxx
+++ b/sal/osl/unx/file_path_helper.cxx
@@ -44,7 +44,7 @@ void SAL_CALL osl_systemPathRemoveSeparator(rtl_uString* 
pustrPath)
     {
         // maybe there are more than one separator at end
         // so we run in a loop
-        while ((pustrPath->length > 1) && (FPH_CHAR_PATH_SEPARATOR == 
pustrPath->buffer[pustrPath->length - 1]))
+        while ((pustrPath->length > 1) && (pustrPath->buffer[pustrPath->length 
- 1] == FPH_CHAR_PATH_SEPARATOR))
         {
             pustrPath->length--;
             pustrPath->buffer[pustrPath->length] = (sal_Unicode)'\0';
@@ -81,7 +81,7 @@ void SAL_CALL osl_systemPathEnsureSeparator(rtl_uString** 
ppustrPath)
 bool SAL_CALL osl_systemPathIsRelativePath(const rtl_uString* pustrPath)
 {
     OSL_PRECOND(nullptr != pustrPath, "osl_systemPathIsRelativePath: Invalid 
parameter");
-    return ((nullptr == pustrPath) || (0 == pustrPath->length) || 
(pustrPath->buffer[0] != FPH_CHAR_PATH_SEPARATOR));
+    return ((nullptr == pustrPath) || (pustrPath->length == 0) || 
(pustrPath->buffer[0] != FPH_CHAR_PATH_SEPARATOR));
 }
 
 void SAL_CALL osl_systemPathMakeAbsolutePath(
@@ -114,7 +114,7 @@ void SAL_CALL osl_systemPathGetFileNameOrLastDirectoryPart(
 
     rtl::OUString last_part;
 
-    if (path.getLength() > 1 || (1 == path.getLength() && *path.getStr() != 
FPH_CHAR_PATH_SEPARATOR))
+    if (path.getLength() > 1 || (path.getLength() == 1 && *path.getStr() != 
FPH_CHAR_PATH_SEPARATOR))
     {
         sal_Int32 idx_ps = path.lastIndexOf(FPH_CHAR_PATH_SEPARATOR);
         idx_ps++; // always right to increment by one even if idx_ps == -1!
@@ -127,7 +127,7 @@ bool SAL_CALL osl_systemPathIsHiddenFileOrDirectoryEntry(
     const rtl_uString* pustrPath)
 {
     OSL_PRECOND(nullptr != pustrPath, 
"osl_systemPathIsHiddenFileOrDirectoryEntry: Invalid parameter");
-    if ((nullptr == pustrPath) || (0 == pustrPath->length))
+    if ((nullptr == pustrPath) || (pustrPath->length == 0))
         return false;
 
     rtl::OUString fdp;
diff --git a/sal/osl/unx/file_stat.cxx b/sal/osl/unx/file_stat.cxx
index fd6cd48..87a56e5 100644
--- a/sal/osl/unx/file_stat.cxx
+++ b/sal/osl/unx/file_stat.cxx
@@ -205,13 +205,13 @@ oslFileError SAL_CALL osl_getFileStatus(oslDirectoryItem 
Item, oslFileStatus* pS
 
     rtl::OUString file_path;
     oslFileError  osl_error = setup_osl_getFileStatus(pImpl, pStat, file_path);
-    if (osl_File_E_None != osl_error)
+    if (osl_error != osl_File_E_None)
         return osl_error;
 
     struct stat file_stat;
 
     bool bStatNeeded = is_stat_call_necessary(uFieldMask, 
pImpl->getFileType());
-    if (bStatNeeded && (0 != osl::lstat(file_path, file_stat)))
+    if (bStatNeeded && (osl::lstat(file_path, file_stat) != 0))
         return oslTranslateFileError(OSL_FET_ERROR, errno);
 
     if (bStatNeeded)
diff --git a/sal/osl/unx/file_url.cxx b/sal/osl/unx/file_url.cxx
index 6eb3f25..50528ef 100644
--- a/sal/osl/unx/file_url.cxx
+++ b/sal/osl/unx/file_url.cxx
@@ -236,12 +236,12 @@ oslFileError SAL_CALL osl_getFileURLFromSystemPath( 
rtl_uString *ustrSystemPath,
     rtl_uString *pTmp = nullptr;
     sal_Int32 nIndex;
 
-    if( 0 == ustrSystemPath->length )
+    if( ustrSystemPath->length == 0 )
         return osl_File_E_INVAL;
 
     /* temporary hack: if already file url, return ustrSystemPath */
 
-    if( 0 == rtl_ustr_ascii_shortenedCompare_WithLength( 
ustrSystemPath->buffer, ustrSystemPath->length,"file:", 5 ) )
+    if( rtl_ustr_ascii_shortenedCompare_WithLength( ustrSystemPath->buffer, 
ustrSystemPath->length,"file:", 5 ) == 0 )
     {
     /*
         if( 0 == rtl_ustr_ascii_shortenedCompare_WithLength( 
ustrSystemPath->buffer, ustrSystemPath->length,"file://", 7 ) )
@@ -265,11 +265,11 @@ oslFileError SAL_CALL osl_getFileURLFromSystemPath( 
rtl_uString *ustrSystemPath,
     }
 
     /* check if system path starts with ~ or ~user and replace it with the 
appropriate home dir */
-    if( '~' == ustrSystemPath->buffer[0] )
+    if( ustrSystemPath->buffer[0] == '~' )
     {
         /* check if another user is specified */
-        if( ( 1 == ustrSystemPath->length ) ||
-            ( '/' == ustrSystemPath->buffer[1] ) )
+        if( ( ustrSystemPath->length == 1 ) ||
+            ( ustrSystemPath->buffer[1] == '/' ) )
         {
             /* osl_getHomeDir returns file URL */
             oslSecurity pSecurity = osl_getCurrentSecurity();
@@ -294,7 +294,7 @@ oslFileError SAL_CALL osl_getFileURLFromSystemPath( 
rtl_uString *ustrSystemPath,
 
     /* check if initial string contains double instances of '/' */
     nIndex = rtl_ustr_indexOfStr_WithLength( ustrSystemPath->buffer, 
ustrSystemPath->length, pDoubleSlash, 2 );
-    if( -1 != nIndex )
+    if( nIndex != -1 )
     {
         sal_Int32 nSrcIndex;
         sal_Int32 nDeleted = 0;
@@ -309,7 +309,7 @@ oslFileError SAL_CALL osl_getFileURLFromSystemPath( 
rtl_uString *ustrSystemPath,
         /* remove all occurrences of '//' */
         for( nSrcIndex = nIndex + 1; nSrcIndex < pTmp->length; nSrcIndex++ )
         {
-            if( ('/' == pTmp->buffer[nSrcIndex]) && ('/' == 
pTmp->buffer[nIndex]) )
+            if( (pTmp->buffer[nSrcIndex] == '/') && (pTmp->buffer[nIndex] == 
'/') )
                 nDeleted++;
             else
                 pTmp->buffer[++nIndex] = pTmp->buffer[nSrcIndex];
@@ -328,7 +328,7 @@ oslFileError SAL_CALL osl_getFileURLFromSystemPath( 
rtl_uString *ustrSystemPath,
     rtl_uString_release( pTmp );
 
     /* absolute urls should start with 'file://' */
-    if( '/' == (*pustrFileURL)->buffer[0] )
+    if( (*pustrFileURL)->buffer[0] == '/' )
     {
         rtl_uString *pProtocol = nullptr;
 
@@ -349,9 +349,9 @@ oslFileError osl_getSystemPathFromFileURL_Ex(
     rtl_uString* temp = nullptr;
     oslFileError osl_error = osl_getSystemPathFromFileURL(ustrFileURL, &temp);
 
-    if (osl_File_E_None == osl_error)
+    if (osl_error == osl_File_E_None)
     {
-        if ('/' == temp->buffer[0])
+        if (temp->buffer[0] == '/')
         {
             *pustrSystemPath = temp;
         }
@@ -417,7 +417,7 @@ namespace
 
         if (p >= aPath)
         {
-            if ('/' == *p)
+            if (*p == '/')
             {
                 p++;
                *p = '\0';
@@ -494,25 +494,25 @@ namespace
         {
             // ignore '/.' , skip one part back when '/..'
 
-            if (('.' == *punresolved) && ('/' == *presolvedsf))
+            if ((*punresolved == '.') && (*presolvedsf == '/'))
             {
-                if ('\0' == *(punresolved + 1))
+                if (*(punresolved + 1) == '\0')
                 {
                     punresolved++;
                     continue;
                 }
-                else if ('/' == *(punresolved + 1))
+                else if (*(punresolved + 1) == '/')
                 {
                     punresolved += 2;
                     continue;
                 }
-                else if (('.' == *(punresolved + 1)) && ('\0' == *(punresolved 
+ 2) || ('/' == *(punresolved + 2))))
+                else if ((*(punresolved + 1) == '.') && (*(punresolved + 2) == 
'\0' || (*(punresolved + 2) == '/')))
                 {
                     _rmlastpathtoken(path_resolved_so_far);
 
                     presolvedsf = ustrtoend(path_resolved_so_far) - 1;
 
-                    if ('/' == *(punresolved + 2))
+                    if (*(punresolved + 2) == '/')
                         punresolved += 3;
                     else
                         punresolved += 2;
@@ -526,18 +526,18 @@ namespace
 
                     ustrchrcat(*punresolved++, path_resolved_so_far);
 
-                    if ('\0' == *punresolved && !realpath_failed)
+                    if (*punresolved == '\0' && !realpath_failed)
                     {
                         ferr = _osl_resolvepath(
                             path_resolved_so_far,
                             &realpath_failed);
 
-                        if (osl_File_E_None != ferr)
+                        if (ferr != osl_File_E_None)
                             return ferr;
                     }
                 }
             }
-            else if ('/' == *punresolved)
+            else if (*punresolved == '/')
             {
                 if ((presolvedsf = ustrtoend(path_resolved_so_far)) > sentinel)
                     return oslTranslateFileError(OSL_FET_ERROR, ENAMETOOLONG);
@@ -550,7 +550,7 @@ namespace
                         path_resolved_so_far,
                         &realpath_failed);
 
-                    if (osl_File_E_None != ferr)
+                    if (ferr != osl_File_E_None)
                         return ferr;
 
                     if (!_islastchr(path_resolved_so_far, '/'))
@@ -569,13 +569,13 @@ namespace
 
                 ustrchrcat(*punresolved++, path_resolved_so_far);
 
-                if ('\0' == *punresolved && !realpath_failed)
+                if (*punresolved == '\0' && !realpath_failed)
                 {
                     ferr = _osl_resolvepath(
                         path_resolved_so_far,
                         &realpath_failed);
 
-                    if (osl_File_E_None != ferr)
+                    if (ferr != osl_File_E_None)
                         return ferr;
                 }
             }
@@ -609,7 +609,7 @@ oslFileError osl_getAbsoluteFileURL(rtl_uString*  
ustrBaseDirURL, rtl_uString* u
 
     rc = FileBase::getSystemPathFromFileURL(relUrl, unresolved_path);
 
-    if(FileBase::E_None != rc)
+    if(rc != FileBase::E_None)
         return oslFileError(rc);
 
     if (systemPathIsRelativePath(unresolved_path))
@@ -617,7 +617,7 @@ oslFileError osl_getAbsoluteFileURL(rtl_uString*  
ustrBaseDirURL, rtl_uString* u
         rtl::OUString base_path;
         rc = (FileBase::RC) osl_getSystemPathFromFileURL_Ex(ustrBaseDirURL, 
&base_path.pData);
 
-        if (FileBase::E_None != rc)
+        if (rc != FileBase::E_None)
             return oslFileError(rc);
 
         rtl::OUString abs_path;
@@ -628,7 +628,7 @@ oslFileError osl_getAbsoluteFileURL(rtl_uString*  
ustrBaseDirURL, rtl_uString* u
 
     rtl::OUString resolved_path;
     rc = (FileBase::RC) osl_getAbsoluteFileURL_impl_(unresolved_path, 
resolved_path);
-    if (FileBase::E_None == rc)
+    if (rc == FileBase::E_None)
     {
         rc = (FileBase::RC) osl_getFileURLFromSystemPath(resolved_path.pData, 
pustrAbsoluteURL);
         OSL_ASSERT(FileBase::E_None == rc);
@@ -651,7 +651,7 @@ namespace osl { namespace detail {
         rtl::OUString path("PATH");
         rtl::OUString env_path;
 
-        if (osl_Process_E_None == osl_getEnvironment(path.pData, 
&env_path.pData))
+        if (osl_getEnvironment(path.pData, &env_path.pData) == 
osl_Process_E_None)
             bfound = osl::searchPath(file_path, env_path, result);
 
         return bfound;
@@ -672,7 +672,7 @@ namespace
         bool bfound = false;
         rtl::OUString cwd_url;
 
-        if (osl_Process_E_None == osl_getProcessWorkingDir(&cwd_url.pData))
+        if (osl_getProcessWorkingDir(&cwd_url.pData) == osl_Process_E_None)
         {
             rtl::OUString cwd;
             FileBase::getSystemPathFromFileURL(cwd_url, cwd);
@@ -697,9 +697,9 @@ oslFileError osl_searchFileURL(rtl_uString* ustrFilePath, 
rtl_uString* ustrSearc
 
     // try to interpret search path as file url else assume it's a system path 
list
     rc = FileBase::getSystemPathFromFileURL(ustrFilePath, file_path);
-    if (FileBase::E_INVAL == rc)
+    if (rc == FileBase::E_INVAL)
         file_path = ustrFilePath;
-    else if (FileBase::E_None != rc)
+    else if (rc != FileBase::E_None)
         return oslFileError(rc);
 
     bool          bfound = false;
@@ -726,7 +726,7 @@ oslFileError FileURLToPath(char * buffer, size_t bufLen, 
rtl_uString* ustrFileUR
     rtl_uString* ustrSystemPath = nullptr;
     oslFileError osl_error      = osl_getSystemPathFromFileURL(ustrFileURL, 
&ustrSystemPath);
 
-    if(osl_File_E_None != osl_error)
+    if(osl_error != osl_File_E_None)
         return osl_error;
 
     osl_systemPathRemoveSeparator(ustrSystemPath);
diff --git a/sal/osl/unx/module.cxx b/sal/osl/unx/module.cxx
index f181929..d99abc3 100644
--- a/sal/osl/unx/module.cxx
+++ b/sal/osl/unx/module.cxx
@@ -120,7 +120,7 @@ oslModule SAL_CALL osl_loadModule(rtl_uString 
*ustrModuleName, sal_Int32 nRtldMo
     SAL_WARN_IF(ustrModuleName == nullptr, "sal.osl", "string is not valid");
 
     /* ensure ustrTmp hold valid string */
-    if (osl_File_E_None != osl_getSystemPathFromFileURL(ustrModuleName, 
&ustrTmp))
+    if (osl_getSystemPathFromFileURL(ustrModuleName, &ustrTmp) != 
osl_File_E_None)
         rtl_uString_assign(&ustrTmp, ustrModuleName);
 
     if (ustrTmp)
diff --git a/sal/osl/unx/nlsupport.cxx b/sal/osl/unx/nlsupport.cxx
index 3df4f9c..5d27f38 100644
--- a/sal/osl/unx/nlsupport.cxx
+++ b/sal/osl/unx/nlsupport.cxx
@@ -190,7 +190,7 @@ static rtl_Locale * parse_locale( const char * locale )
             rtl_Locale * ret;
 
             /* language is a two or three letter code */
-            if( (len > 3 && '_' == locale[3]) || (len == 3 && '_' != 
locale[2]) )
+            if( (len > 3 && locale[3] == '_') || (len == 3 && locale[2] != 
'_') )
                 offset = 3;
 
             /* convert language code to unicode */
@@ -198,7 +198,7 @@ static rtl_Locale * parse_locale( const char * locale )
             OSL_ASSERT(pLanguage != nullptr);
 
             /* convert country code to unicode */
-            if( len >= offset+3 && '_' == locale[offset] )
+            if( len >= offset+3 && locale[offset] == '_' )
             {
                 rtl_string2UString( &pCountry, locale + offset + 1, 2, 
RTL_TEXTENCODING_ASCII_US, OSTRING_TO_OUSTRING_CVTFLAGS );
                 OSL_ASSERT(pCountry != nullptr);
diff --git a/sal/osl/unx/process.cxx b/sal/osl/unx/process.cxx
index 9a9ba28..5f4182d 100644
--- a/sal/osl/unx/process.cxx
+++ b/sal/osl/unx/process.cxx
@@ -1136,7 +1136,7 @@ static bool is_timeout(const struct timeval* tend)
 
 static bool is_process_dead(pid_t pid)
 {
-    return ((-1 == kill(pid, 0)) && (ESRCH == errno));
+    return ((kill(pid, 0) == -1) && (ESRCH == errno));
 }
 
 /**********************************************
@@ -1171,9 +1171,9 @@ oslProcessError SAL_CALL 
osl_joinProcessWithTimeout(oslProcess Process, const Ti
     {
         oslConditionResult cond_res = osl_waitCondition(pChild->m_terminated, 
pTimeout);
 
-        if (osl_cond_result_timeout == cond_res)
+        if (cond_res == osl_cond_result_timeout)
             osl_error = osl_Process_E_TimedOut;
-        else if (osl_cond_result_ok != cond_res)
+        else if (cond_res != osl_cond_result_ok)
             osl_error = osl_Process_E_Unknown;
     }
     else /* alien process; StatusThread will not be able
diff --git a/sal/rtl/bootstrap.cxx b/sal/rtl/bootstrap.cxx
index 7977f32..324ca23 100644
--- a/sal/rtl/bootstrap.cxx
+++ b/sal/rtl/bootstrap.cxx
@@ -163,11 +163,11 @@ static bool getFromCommandLineArgs(
         {
             rtl_uString *pArg = nullptr;
             osl_getCommandArg( i, &pArg );
-            if( ('-' == pArg->buffer[0] || '/' == pArg->buffer[0] ) &&
-                'e' == pArg->buffer[1] &&
-                'n' == pArg->buffer[2] &&
-                'v' == pArg->buffer[3] &&
-                ':' == pArg->buffer[4] )
+            if( (pArg->buffer[0] == '-' || pArg->buffer[0] == '/' ) &&
+                pArg->buffer[1] == 'e' &&
+                pArg->buffer[2] == 'n' &&
+                pArg->buffer[3] == 'v' &&
+                pArg->buffer[4] == ':' )
             {
                 sal_Int32 nIndex = rtl_ustr_indexOfChar( pArg->buffer, '=' );
                 if( nIndex >= 0 )
@@ -338,8 +338,8 @@ Bootstrap_Impl::Bootstrap_Impl( OUString const & rIniName )
     // normalize path
     FileStatus status( osl_FileStatus_Mask_FileURL );
     DirectoryItem dirItem;
-    if (DirectoryItem::E_None == DirectoryItem::get( base_ini, dirItem ) &&
-        DirectoryItem::E_None == dirItem.getFileStatus( status ))
+    if (DirectoryItem::get( base_ini, dirItem ) == DirectoryItem::E_None &&
+        dirItem.getFileStatus( status ) == DirectoryItem::E_None)
     {
         base_ini = status.getFileURL();
         if (! rIniName.equals( base_ini ))
@@ -351,11 +351,11 @@ Bootstrap_Impl::Bootstrap_Impl( OUString const & rIniName 
)
     SAL_INFO("sal.rtl", "Bootstrap_Impl(): sFile=" << _iniName);
     oslFileHandle handle;
     if (!_iniName.isEmpty() &&
-        osl_File_E_None == osl_openFile(_iniName.pData, &handle, 
osl_File_OpenFlag_Read))
+        osl_openFile(_iniName.pData, &handle, osl_File_OpenFlag_Read) == 
osl_File_E_None)
     {
         rtl::ByteSequence seq;
 
-        while (osl_File_E_None == osl_readLine(handle , 
reinterpret_cast<sal_Sequence **>(&seq)))
+        while (osl_readLine(handle , reinterpret_cast<sal_Sequence **>(&seq)) 
== osl_File_E_None)
         {
             OString line( reinterpret_cast<const char *>(seq.getConstArray()), 
seq.getLength() );
             sal_Int32 nIndex = line.indexOf('=');
@@ -622,8 +622,8 @@ rtlBootstrapHandle SAL_CALL rtl_bootstrap_args_open (
     // normalize path
     FileStatus status( osl_FileStatus_Mask_FileURL );
     DirectoryItem dirItem;
-    if (DirectoryItem::E_None != DirectoryItem::get( iniName, dirItem ) ||
-        DirectoryItem::E_None != dirItem.getFileStatus( status ))
+    if (DirectoryItem::get( iniName, dirItem ) != DirectoryItem::E_None ||
+        dirItem.getFileStatus( status ) != DirectoryItem::E_None)
     {
         return nullptr;
     }
diff --git a/sal/rtl/cmdargs.cxx b/sal/rtl/cmdargs.cxx
index ee4bead..bb70e4a 100644
--- a/sal/rtl/cmdargs.cxx
+++ b/sal/rtl/cmdargs.cxx
@@ -57,11 +57,11 @@ void init()
         {
             rtl_uString * pArg = nullptr;
             osl_getCommandArg (i, &pArg);
-            if (('-' == pArg->buffer[0] || '/' == pArg->buffer[0]) &&
-                 'e' == pArg->buffer[1] &&
-                 'n' == pArg->buffer[2] &&
-                 'v' == pArg->buffer[3] &&
-                 ':' == pArg->buffer[4] &&
+            if ((pArg->buffer[0] == '-' || pArg->buffer[0] == '/') &&
+                 pArg->buffer[1] == 'e' &&
+                 pArg->buffer[2] == 'n' &&
+                 pArg->buffer[3] == 'v' &&
+                 pArg->buffer[4] == ':' &&
                 rtl_ustr_indexOfChar (&(pArg->buffer[5]), '=') >= 0 )
             {
                 // ignore.
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to