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.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
134
compilerplugins/clang/comparisonwithconstant.cxx
Normal file
134
compilerplugins/clang/comparisonwithconstant.cxx
Normal file
@@ -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: */
|
@@ -193,7 +193,7 @@ FileHandle_Impl::Allocator::Allocator()
|
|||||||
m_bufsiz (0)
|
m_bufsiz (0)
|
||||||
{
|
{
|
||||||
size_t const pagesize = FileHandle_Impl::getpagesize();
|
size_t const pagesize = FileHandle_Impl::getpagesize();
|
||||||
if (size_t(-1) != pagesize)
|
if (pagesize != size_t(-1))
|
||||||
{
|
{
|
||||||
m_cache = rtl_cache_create (
|
m_cache = rtl_cache_create (
|
||||||
"osl_file_buffer_cache", pagesize, 0, nullptr, nullptr, nullptr, nullptr, nullptr, 0);
|
"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)
|
oslFileError FileHandle_Impl::setSize (sal_uInt64 uSize)
|
||||||
{
|
{
|
||||||
off_t const nSize = sal::static_int_cast< off_t >(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 */
|
/* Failure. Save original result. Try fallback algorithm */
|
||||||
oslFileError result = oslTranslateFileError (OSL_FET_ERROR, errno);
|
oslFileError result = oslTranslateFileError (OSL_FET_ERROR, errno);
|
||||||
@@ -324,10 +324,10 @@ oslFileError FileHandle_Impl::setSize (sal_uInt64 uSize)
|
|||||||
return result;
|
return result;
|
||||||
|
|
||||||
/* Try 'expand' via 'lseek()' and 'write()' */
|
/* 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;
|
return result;
|
||||||
|
|
||||||
if (-1 == write (m_fd, "", (size_t)1))
|
if (write (m_fd, "", (size_t)1) == -1)
|
||||||
{
|
{
|
||||||
/* Failure. Restore saved position */
|
/* Failure. Restore saved position */
|
||||||
(void) lseek (m_fd, (off_t)(nCurPos), SEEK_SET);
|
(void) lseek (m_fd, (off_t)(nCurPos), SEEK_SET);
|
||||||
@@ -335,7 +335,7 @@ oslFileError FileHandle_Impl::setSize (sal_uInt64 uSize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Success. Restore saved position */
|
/* 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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,7 +377,7 @@ oslFileError FileHandle_Impl::readAt (
|
|||||||
}
|
}
|
||||||
|
|
||||||
ssize_t nBytes = ::pread (m_fd, pBuffer, nBytesRequested, nOffset);
|
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)
|
/* Some 'pread()'s fail with EOVERFLOW when reading at (or past)
|
||||||
* end-of-file, different from 'lseek() + read()' behaviour.
|
* end-of-file, different from 'lseek() + read()' behaviour.
|
||||||
@@ -385,7 +385,7 @@ oslFileError FileHandle_Impl::readAt (
|
|||||||
*/
|
*/
|
||||||
nBytes = 0;
|
nBytes = 0;
|
||||||
}
|
}
|
||||||
if (-1 == nBytes)
|
if (nBytes == -1)
|
||||||
return oslTranslateFileError (OSL_FET_ERROR, errno);
|
return oslTranslateFileError (OSL_FET_ERROR, errno);
|
||||||
|
|
||||||
*pBytesRead = nBytes;
|
*pBytesRead = nBytes;
|
||||||
@@ -407,7 +407,7 @@ oslFileError FileHandle_Impl::writeAt (
|
|||||||
return osl_File_E_BADF;
|
return osl_File_E_BADF;
|
||||||
|
|
||||||
ssize_t nBytes = ::pwrite (m_fd, pBuffer, nBytesToWrite, nOffset);
|
ssize_t nBytes = ::pwrite (m_fd, pBuffer, nBytesToWrite, nOffset);
|
||||||
if (-1 == nBytes)
|
if (nBytes == -1)
|
||||||
return oslTranslateFileError (OSL_FET_ERROR, errno);
|
return oslTranslateFileError (OSL_FET_ERROR, errno);
|
||||||
|
|
||||||
m_size = std::max (m_size, sal::static_int_cast< sal_uInt64 >(nOffset + nBytes));
|
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,
|
size_t nBytesRequested,
|
||||||
sal_uInt64 * pBytesRead)
|
sal_uInt64 * pBytesRead)
|
||||||
{
|
{
|
||||||
if (0 == (m_state & STATE_SEEKABLE))
|
if ((m_state & STATE_SEEKABLE) == 0)
|
||||||
{
|
{
|
||||||
// not seekable (pipe)
|
// not seekable (pipe)
|
||||||
ssize_t nBytes = ::read (m_fd, pBuffer, nBytesRequested);
|
ssize_t nBytes = ::read (m_fd, pBuffer, nBytesRequested);
|
||||||
if (-1 == nBytes)
|
if (nBytes == -1)
|
||||||
return oslTranslateFileError (OSL_FET_ERROR, errno);
|
return oslTranslateFileError (OSL_FET_ERROR, errno);
|
||||||
*pBytesRead = nBytes;
|
*pBytesRead = nBytes;
|
||||||
return osl_File_E_None;
|
return osl_File_E_None;
|
||||||
@@ -497,11 +497,11 @@ oslFileError FileHandle_Impl::writeFileAt (
|
|||||||
size_t nBytesToWrite,
|
size_t nBytesToWrite,
|
||||||
sal_uInt64 * pBytesWritten)
|
sal_uInt64 * pBytesWritten)
|
||||||
{
|
{
|
||||||
if (0 == (m_state & STATE_SEEKABLE))
|
if ((m_state & STATE_SEEKABLE) == 0)
|
||||||
{
|
{
|
||||||
// not seekable (pipe)
|
// not seekable (pipe)
|
||||||
ssize_t nBytes = ::write (m_fd, pBuffer, nBytesToWrite);
|
ssize_t nBytes = ::write (m_fd, pBuffer, nBytesToWrite);
|
||||||
if (-1 == nBytes)
|
if (nBytes == -1)
|
||||||
return oslTranslateFileError (OSL_FET_ERROR, errno);
|
return oslTranslateFileError (OSL_FET_ERROR, errno);
|
||||||
*pBytesWritten = nBytes;
|
*pBytesWritten = nBytes;
|
||||||
return osl_File_E_None;
|
return osl_File_E_None;
|
||||||
@@ -730,11 +730,11 @@ oslFileError FileHandle_Impl::syncFile()
|
|||||||
|
|
||||||
oslFileHandle osl::detail::createFileHandleFromFD( int fd )
|
oslFileHandle osl::detail::createFileHandleFromFD( int fd )
|
||||||
{
|
{
|
||||||
if (-1 == fd)
|
if (fd == -1)
|
||||||
return nullptr; // EINVAL
|
return nullptr; // EINVAL
|
||||||
|
|
||||||
struct stat aFileStat;
|
struct stat aFileStat;
|
||||||
if (-1 == fstat (fd, &aFileStat))
|
if (fstat (fd, &aFileStat) == -1)
|
||||||
return nullptr; // EBADF
|
return nullptr; // EBADF
|
||||||
|
|
||||||
FileHandle_Impl * pImpl = new FileHandle_Impl (fd);
|
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 );
|
fd = open_c( cpFilePath, rdonly_flags, mode );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (-1 == fd)
|
if (fd == -1)
|
||||||
{
|
{
|
||||||
int saved_errno = errno;
|
int saved_errno = errno;
|
||||||
SAL_INFO("sal.file", "osl_openFile(" << cpFilePath << ", " << ((flags & O_RDWR) ? "writeable":"readonly") << ") failed: " << strerror(saved_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)
|
if (flags & O_NONBLOCK)
|
||||||
{
|
{
|
||||||
int f = fcntl (fd, F_GETFL, 0);
|
int f = fcntl (fd, F_GETFL, 0);
|
||||||
if (-1 == f)
|
if (f == -1)
|
||||||
{
|
{
|
||||||
int saved_errno = errno;
|
int saved_errno = errno;
|
||||||
SAL_INFO("sal.file", "osl_openFile(" << cpFilePath << ", " << ((flags & O_RDWR) ? "writeable":"readonly") << "): fcntl(" << fd << ", F_GETFL) failed: " << strerror(saved_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);
|
(void) close(fd);
|
||||||
return eRet;
|
return eRet;
|
||||||
}
|
}
|
||||||
if (-1 == fcntl (fd, F_SETFL, (f & ~O_NONBLOCK)))
|
if (fcntl (fd, F_SETFL, (f & ~O_NONBLOCK)) == -1)
|
||||||
{
|
{
|
||||||
int saved_errno = errno;
|
int saved_errno = errno;
|
||||||
SAL_INFO("sal.file", "osl_openFile(" << cpFilePath << ", " << ((flags & O_RDWR) ? "writeable":"readonly") << "): fcntl(" << fd << ", F_SETFL) failed: " << strerror(saved_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
|
#endif
|
||||||
/* get file status (mode, size) */
|
/* get file status (mode, size) */
|
||||||
struct stat aFileStat;
|
struct stat aFileStat;
|
||||||
if (-1 == fstat (fd, &aFileStat))
|
if (fstat (fd, &aFileStat) == -1)
|
||||||
{
|
{
|
||||||
int saved_errno = errno;
|
int saved_errno = errno;
|
||||||
SAL_INFO("sal.file", "osl_openFile(" << cpFilePath << ", " << ((flags & O_RDWR) ? "writeable":"readonly") << "): fstat(" << fd << ") failed: " << strerror(saved_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_start = 0;
|
||||||
aflock.l_len = 0;
|
aflock.l_len = 0;
|
||||||
|
|
||||||
if (-1 == fcntl (fd, F_SETLK, &aflock))
|
if (fcntl (fd, F_SETLK, &aflock) == -1)
|
||||||
{
|
{
|
||||||
int saved_errno = errno;
|
int saved_errno = errno;
|
||||||
SAL_INFO("sal.file", "osl_openFile(" << cpFilePath << ", " << ((flags & O_RDWR) ? "writeable":"readonly") << "): fcntl(" << fd << ", F_SETLK) failed: " << strerror(saved_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 */
|
/* close, ignoring double failure */
|
||||||
(void) close (pImpl->m_fd);
|
(void) close (pImpl->m_fd);
|
||||||
}
|
}
|
||||||
else if (-1 == close (pImpl->m_fd))
|
else if (close (pImpl->m_fd) == -1)
|
||||||
{
|
{
|
||||||
/* translate error code */
|
/* translate error code */
|
||||||
result = oslTranslateFileError (OSL_FET_ERROR, errno);
|
result = oslTranslateFileError (OSL_FET_ERROR, errno);
|
||||||
@@ -1111,7 +1111,7 @@ SAL_CALL osl_syncFile(oslFileHandle Handle)
|
|||||||
{
|
{
|
||||||
FileHandle_Impl* pImpl = static_cast<FileHandle_Impl*>(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;
|
return osl_File_E_INVAL;
|
||||||
|
|
||||||
if (pImpl->m_kind == FileHandle_Impl::KIND_MEM)
|
if (pImpl->m_kind == FileHandle_Impl::KIND_MEM)
|
||||||
@@ -1123,7 +1123,7 @@ SAL_CALL osl_syncFile(oslFileHandle Handle)
|
|||||||
oslFileError result = pImpl->syncFile();
|
oslFileError result = pImpl->syncFile();
|
||||||
if (result != osl_File_E_None)
|
if (result != osl_File_E_None)
|
||||||
return result;
|
return result;
|
||||||
if (-1 == fsync (pImpl->m_fd))
|
if (fsync (pImpl->m_fd) == -1)
|
||||||
return oslTranslateFileError (OSL_FET_ERROR, errno);
|
return oslTranslateFileError (OSL_FET_ERROR, errno);
|
||||||
|
|
||||||
return osl_File_E_None;
|
return osl_File_E_None;
|
||||||
@@ -1142,7 +1142,7 @@ SAL_CALL osl_mapFile (
|
|||||||
{
|
{
|
||||||
FileHandle_Impl* pImpl = static_cast<FileHandle_Impl*>(Handle);
|
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;
|
return osl_File_E_INVAL;
|
||||||
*ppAddr = nullptr;
|
*ppAddr = nullptr;
|
||||||
|
|
||||||
@@ -1171,7 +1171,7 @@ SAL_CALL osl_mapFile (
|
|||||||
{
|
{
|
||||||
// Determine memory pagesize.
|
// Determine memory pagesize.
|
||||||
size_t const nPageSize = FileHandle_Impl::getpagesize();
|
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.
|
* Pagein, touching first byte of every memory page.
|
||||||
@@ -1229,7 +1229,7 @@ unmapFile (void* pAddr, sal_uInt64 uLength)
|
|||||||
return osl_File_E_OVERFLOW;
|
return osl_File_E_OVERFLOW;
|
||||||
size_t const nLength = sal::static_int_cast< size_t >(uLength);
|
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 oslTranslateFileError(OSL_FET_ERROR, errno);
|
||||||
|
|
||||||
return osl_File_E_None;
|
return osl_File_E_None;
|
||||||
@@ -1273,7 +1273,7 @@ SAL_CALL osl_readLine (
|
|||||||
{
|
{
|
||||||
FileHandle_Impl * pImpl = static_cast<FileHandle_Impl*>(Handle);
|
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;
|
return osl_File_E_INVAL;
|
||||||
sal_uInt64 uBytesRead = 0;
|
sal_uInt64 uBytesRead = 0;
|
||||||
|
|
||||||
@@ -1295,7 +1295,7 @@ SAL_CALL osl_readFile (
|
|||||||
{
|
{
|
||||||
FileHandle_Impl* pImpl = static_cast<FileHandle_Impl*>(Handle);
|
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;
|
return osl_File_E_INVAL;
|
||||||
|
|
||||||
static sal_uInt64 const g_limit_ssize_t = std::numeric_limits< ssize_t >::max();
|
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);
|
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;
|
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;
|
return osl_File_E_BADF;
|
||||||
|
|
||||||
static sal_uInt64 const g_limit_ssize_t = std::numeric_limits< ssize_t >::max();
|
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);
|
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;
|
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;
|
return osl_File_E_SPIPE;
|
||||||
|
|
||||||
sal_uInt64 const limit_off_t = MAX_OFF_T;
|
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);
|
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;
|
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;
|
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;
|
return osl_File_E_BADF;
|
||||||
|
|
||||||
sal_uInt64 const limit_off_t = MAX_OFF_T;
|
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);
|
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;
|
return osl_File_E_INVAL;
|
||||||
|
|
||||||
FileHandle_Impl::Guard lock (&(pImpl->m_mutex));
|
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);
|
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;
|
return osl_File_E_INVAL;
|
||||||
|
|
||||||
FileHandle_Impl::Guard lock (&(pImpl->m_mutex));
|
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);
|
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;
|
return osl_File_E_INVAL;
|
||||||
|
|
||||||
sal_Int64 const limit_off_t = MAX_OFF_T;
|
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);
|
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;
|
return osl_File_E_INVAL;
|
||||||
|
|
||||||
FileHandle_Impl::Guard lock (&(pImpl->m_mutex));
|
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);
|
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;
|
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;
|
return osl_File_E_BADF;
|
||||||
|
|
||||||
sal_uInt64 const limit_off_t = MAX_OFF_T;
|
sal_uInt64 const limit_off_t = MAX_OFF_T;
|
||||||
|
@@ -29,7 +29,7 @@ oslFileError oslTranslateFileError(bool bIsError, int Errno)
|
|||||||
|
|
||||||
/* Have a look at file_error_transl.hxx for
|
/* Have a look at file_error_transl.hxx for
|
||||||
the reason that we do this here */
|
the reason that we do this here */
|
||||||
if (bIsError && (0 == Errno))
|
if (bIsError && (Errno == 0))
|
||||||
return osl_error;
|
return osl_error;
|
||||||
|
|
||||||
switch(Errno)
|
switch(Errno)
|
||||||
|
@@ -103,7 +103,7 @@ void DirectoryItem_Impl::acquire()
|
|||||||
}
|
}
|
||||||
void DirectoryItem_Impl::release()
|
void DirectoryItem_Impl::release()
|
||||||
{
|
{
|
||||||
if (0 == --m_RefCount)
|
if (--m_RefCount == 0)
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,13 +143,13 @@ oslFileError SAL_CALL osl_openDirectory(rtl_uString* ustrDirectoryURL, oslDirect
|
|||||||
|
|
||||||
char path[PATH_MAX];
|
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;
|
return osl_File_E_INVAL;
|
||||||
|
|
||||||
/* convert file URL to system path */
|
/* convert file URL to system path */
|
||||||
eRet = osl_getSystemPathFromFileURL_Ex(ustrDirectoryURL, &ustrSystemPath);
|
eRet = osl_getSystemPathFromFileURL_Ex(ustrDirectoryURL, &ustrSystemPath);
|
||||||
|
|
||||||
if( osl_File_E_None != eRet )
|
if( eRet != osl_File_E_None )
|
||||||
return eRet;
|
return eRet;
|
||||||
|
|
||||||
osl_systemPathRemoveSeparator(ustrSystemPath);
|
osl_systemPathRemoveSeparator(ustrSystemPath);
|
||||||
@@ -272,7 +272,7 @@ static struct dirent* osl_readdir_impl_(DIR* pdir, bool bFilterLocalAndParentDir
|
|||||||
while ((pdirent = readdir(pdir)) != nullptr)
|
while ((pdirent = readdir(pdir)) != nullptr)
|
||||||
{
|
{
|
||||||
if (bFilterLocalAndParentDir &&
|
if (bFilterLocalAndParentDir &&
|
||||||
((0 == strcmp(pdirent->d_name, ".")) || (0 == strcmp(pdirent->d_name, ".."))))
|
((strcmp(pdirent->d_name, ".") == 0) || (strcmp(pdirent->d_name, "..") == 0)))
|
||||||
continue;
|
continue;
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
@@ -354,16 +354,16 @@ oslFileError SAL_CALL osl_getDirectoryItem( rtl_uString* ustrFileURL, oslDirecto
|
|||||||
oslFileError osl_error = osl_File_E_INVAL;
|
oslFileError osl_error = osl_File_E_INVAL;
|
||||||
|
|
||||||
OSL_ASSERT((nullptr != ustrFileURL) && (nullptr != pItem));
|
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;
|
return osl_File_E_INVAL;
|
||||||
|
|
||||||
osl_error = osl_getSystemPathFromFileURL_Ex(ustrFileURL, &ustrSystemPath);
|
osl_error = osl_getSystemPathFromFileURL_Ex(ustrFileURL, &ustrSystemPath);
|
||||||
if (osl_File_E_None != osl_error)
|
if (osl_error != osl_File_E_None)
|
||||||
return osl_error;
|
return osl_error;
|
||||||
|
|
||||||
osl_systemPathRemoveSeparator(ustrSystemPath);
|
osl_systemPathRemoveSeparator(ustrSystemPath);
|
||||||
|
|
||||||
if (-1 == access_u(ustrSystemPath, F_OK))
|
if (access_u(ustrSystemPath, F_OK) == -1)
|
||||||
{
|
{
|
||||||
osl_error = oslTranslateFileError(OSL_FET_ERROR, errno);
|
osl_error = oslTranslateFileError(OSL_FET_ERROR, errno);
|
||||||
}
|
}
|
||||||
@@ -543,7 +543,7 @@ static oslFileError create_dir_recursively_(
|
|||||||
oslFileError osl_error = create_dir_recursively_(
|
oslFileError osl_error = create_dir_recursively_(
|
||||||
dir_path, aDirectoryCreationCallbackFunc, pData);
|
dir_path, aDirectoryCreationCallbackFunc, pData);
|
||||||
|
|
||||||
if (osl_File_E_None != osl_error)
|
if (osl_error != osl_File_E_None)
|
||||||
return osl_error;
|
return osl_error;
|
||||||
|
|
||||||
dir_path[pos] = '/';
|
dir_path[pos] = '/';
|
||||||
|
@@ -44,7 +44,7 @@ void SAL_CALL osl_systemPathRemoveSeparator(rtl_uString* pustrPath)
|
|||||||
{
|
{
|
||||||
// maybe there are more than one separator at end
|
// maybe there are more than one separator at end
|
||||||
// so we run in a loop
|
// 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->length--;
|
||||||
pustrPath->buffer[pustrPath->length] = (sal_Unicode)'\0';
|
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)
|
bool SAL_CALL osl_systemPathIsRelativePath(const rtl_uString* pustrPath)
|
||||||
{
|
{
|
||||||
OSL_PRECOND(nullptr != pustrPath, "osl_systemPathIsRelativePath: Invalid parameter");
|
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(
|
void SAL_CALL osl_systemPathMakeAbsolutePath(
|
||||||
@@ -114,7 +114,7 @@ void SAL_CALL osl_systemPathGetFileNameOrLastDirectoryPart(
|
|||||||
|
|
||||||
rtl::OUString last_part;
|
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);
|
sal_Int32 idx_ps = path.lastIndexOf(FPH_CHAR_PATH_SEPARATOR);
|
||||||
idx_ps++; // always right to increment by one even if idx_ps == -1!
|
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)
|
const rtl_uString* pustrPath)
|
||||||
{
|
{
|
||||||
OSL_PRECOND(nullptr != pustrPath, "osl_systemPathIsHiddenFileOrDirectoryEntry: Invalid parameter");
|
OSL_PRECOND(nullptr != pustrPath, "osl_systemPathIsHiddenFileOrDirectoryEntry: Invalid parameter");
|
||||||
if ((nullptr == pustrPath) || (0 == pustrPath->length))
|
if ((nullptr == pustrPath) || (pustrPath->length == 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
rtl::OUString fdp;
|
rtl::OUString fdp;
|
||||||
|
@@ -205,13 +205,13 @@ oslFileError SAL_CALL osl_getFileStatus(oslDirectoryItem Item, oslFileStatus* pS
|
|||||||
|
|
||||||
rtl::OUString file_path;
|
rtl::OUString file_path;
|
||||||
oslFileError osl_error = setup_osl_getFileStatus(pImpl, pStat, 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;
|
return osl_error;
|
||||||
|
|
||||||
struct stat file_stat;
|
struct stat file_stat;
|
||||||
|
|
||||||
bool bStatNeeded = is_stat_call_necessary(uFieldMask, pImpl->getFileType());
|
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);
|
return oslTranslateFileError(OSL_FET_ERROR, errno);
|
||||||
|
|
||||||
if (bStatNeeded)
|
if (bStatNeeded)
|
||||||
|
@@ -236,12 +236,12 @@ oslFileError SAL_CALL osl_getFileURLFromSystemPath( rtl_uString *ustrSystemPath,
|
|||||||
rtl_uString *pTmp = nullptr;
|
rtl_uString *pTmp = nullptr;
|
||||||
sal_Int32 nIndex;
|
sal_Int32 nIndex;
|
||||||
|
|
||||||
if( 0 == ustrSystemPath->length )
|
if( ustrSystemPath->length == 0 )
|
||||||
return osl_File_E_INVAL;
|
return osl_File_E_INVAL;
|
||||||
|
|
||||||
/* temporary hack: if already file url, return ustrSystemPath */
|
/* 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 ) )
|
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 */
|
/* 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 */
|
/* check if another user is specified */
|
||||||
if( ( 1 == ustrSystemPath->length ) ||
|
if( ( ustrSystemPath->length == 1 ) ||
|
||||||
( '/' == ustrSystemPath->buffer[1] ) )
|
( ustrSystemPath->buffer[1] == '/' ) )
|
||||||
{
|
{
|
||||||
/* osl_getHomeDir returns file URL */
|
/* osl_getHomeDir returns file URL */
|
||||||
oslSecurity pSecurity = osl_getCurrentSecurity();
|
oslSecurity pSecurity = osl_getCurrentSecurity();
|
||||||
@@ -294,7 +294,7 @@ oslFileError SAL_CALL osl_getFileURLFromSystemPath( rtl_uString *ustrSystemPath,
|
|||||||
|
|
||||||
/* check if initial string contains double instances of '/' */
|
/* check if initial string contains double instances of '/' */
|
||||||
nIndex = rtl_ustr_indexOfStr_WithLength( ustrSystemPath->buffer, ustrSystemPath->length, pDoubleSlash, 2 );
|
nIndex = rtl_ustr_indexOfStr_WithLength( ustrSystemPath->buffer, ustrSystemPath->length, pDoubleSlash, 2 );
|
||||||
if( -1 != nIndex )
|
if( nIndex != -1 )
|
||||||
{
|
{
|
||||||
sal_Int32 nSrcIndex;
|
sal_Int32 nSrcIndex;
|
||||||
sal_Int32 nDeleted = 0;
|
sal_Int32 nDeleted = 0;
|
||||||
@@ -309,7 +309,7 @@ oslFileError SAL_CALL osl_getFileURLFromSystemPath( rtl_uString *ustrSystemPath,
|
|||||||
/* remove all occurrences of '//' */
|
/* remove all occurrences of '//' */
|
||||||
for( nSrcIndex = nIndex + 1; nSrcIndex < pTmp->length; nSrcIndex++ )
|
for( nSrcIndex = nIndex + 1; nSrcIndex < pTmp->length; nSrcIndex++ )
|
||||||
{
|
{
|
||||||
if( ('/' == pTmp->buffer[nSrcIndex]) && ('/' == pTmp->buffer[nIndex]) )
|
if( (pTmp->buffer[nSrcIndex] == '/') && (pTmp->buffer[nIndex] == '/') )
|
||||||
nDeleted++;
|
nDeleted++;
|
||||||
else
|
else
|
||||||
pTmp->buffer[++nIndex] = pTmp->buffer[nSrcIndex];
|
pTmp->buffer[++nIndex] = pTmp->buffer[nSrcIndex];
|
||||||
@@ -328,7 +328,7 @@ oslFileError SAL_CALL osl_getFileURLFromSystemPath( rtl_uString *ustrSystemPath,
|
|||||||
rtl_uString_release( pTmp );
|
rtl_uString_release( pTmp );
|
||||||
|
|
||||||
/* absolute urls should start with 'file://' */
|
/* absolute urls should start with 'file://' */
|
||||||
if( '/' == (*pustrFileURL)->buffer[0] )
|
if( (*pustrFileURL)->buffer[0] == '/' )
|
||||||
{
|
{
|
||||||
rtl_uString *pProtocol = nullptr;
|
rtl_uString *pProtocol = nullptr;
|
||||||
|
|
||||||
@@ -349,9 +349,9 @@ oslFileError osl_getSystemPathFromFileURL_Ex(
|
|||||||
rtl_uString* temp = nullptr;
|
rtl_uString* temp = nullptr;
|
||||||
oslFileError osl_error = osl_getSystemPathFromFileURL(ustrFileURL, &temp);
|
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;
|
*pustrSystemPath = temp;
|
||||||
}
|
}
|
||||||
@@ -417,7 +417,7 @@ namespace
|
|||||||
|
|
||||||
if (p >= aPath)
|
if (p >= aPath)
|
||||||
{
|
{
|
||||||
if ('/' == *p)
|
if (*p == '/')
|
||||||
{
|
{
|
||||||
p++;
|
p++;
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
@@ -494,25 +494,25 @@ namespace
|
|||||||
{
|
{
|
||||||
// ignore '/.' , skip one part back when '/..'
|
// ignore '/.' , skip one part back when '/..'
|
||||||
|
|
||||||
if (('.' == *punresolved) && ('/' == *presolvedsf))
|
if ((*punresolved == '.') && (*presolvedsf == '/'))
|
||||||
{
|
{
|
||||||
if ('\0' == *(punresolved + 1))
|
if (*(punresolved + 1) == '\0')
|
||||||
{
|
{
|
||||||
punresolved++;
|
punresolved++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if ('/' == *(punresolved + 1))
|
else if (*(punresolved + 1) == '/')
|
||||||
{
|
{
|
||||||
punresolved += 2;
|
punresolved += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (('.' == *(punresolved + 1)) && ('\0' == *(punresolved + 2) || ('/' == *(punresolved + 2))))
|
else if ((*(punresolved + 1) == '.') && (*(punresolved + 2) == '\0' || (*(punresolved + 2) == '/')))
|
||||||
{
|
{
|
||||||
_rmlastpathtoken(path_resolved_so_far);
|
_rmlastpathtoken(path_resolved_so_far);
|
||||||
|
|
||||||
presolvedsf = ustrtoend(path_resolved_so_far) - 1;
|
presolvedsf = ustrtoend(path_resolved_so_far) - 1;
|
||||||
|
|
||||||
if ('/' == *(punresolved + 2))
|
if (*(punresolved + 2) == '/')
|
||||||
punresolved += 3;
|
punresolved += 3;
|
||||||
else
|
else
|
||||||
punresolved += 2;
|
punresolved += 2;
|
||||||
@@ -526,18 +526,18 @@ namespace
|
|||||||
|
|
||||||
ustrchrcat(*punresolved++, path_resolved_so_far);
|
ustrchrcat(*punresolved++, path_resolved_so_far);
|
||||||
|
|
||||||
if ('\0' == *punresolved && !realpath_failed)
|
if (*punresolved == '\0' && !realpath_failed)
|
||||||
{
|
{
|
||||||
ferr = _osl_resolvepath(
|
ferr = _osl_resolvepath(
|
||||||
path_resolved_so_far,
|
path_resolved_so_far,
|
||||||
&realpath_failed);
|
&realpath_failed);
|
||||||
|
|
||||||
if (osl_File_E_None != ferr)
|
if (ferr != osl_File_E_None)
|
||||||
return ferr;
|
return ferr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ('/' == *punresolved)
|
else if (*punresolved == '/')
|
||||||
{
|
{
|
||||||
if ((presolvedsf = ustrtoend(path_resolved_so_far)) > sentinel)
|
if ((presolvedsf = ustrtoend(path_resolved_so_far)) > sentinel)
|
||||||
return oslTranslateFileError(OSL_FET_ERROR, ENAMETOOLONG);
|
return oslTranslateFileError(OSL_FET_ERROR, ENAMETOOLONG);
|
||||||
@@ -550,7 +550,7 @@ namespace
|
|||||||
path_resolved_so_far,
|
path_resolved_so_far,
|
||||||
&realpath_failed);
|
&realpath_failed);
|
||||||
|
|
||||||
if (osl_File_E_None != ferr)
|
if (ferr != osl_File_E_None)
|
||||||
return ferr;
|
return ferr;
|
||||||
|
|
||||||
if (!_islastchr(path_resolved_so_far, '/'))
|
if (!_islastchr(path_resolved_so_far, '/'))
|
||||||
@@ -569,13 +569,13 @@ namespace
|
|||||||
|
|
||||||
ustrchrcat(*punresolved++, path_resolved_so_far);
|
ustrchrcat(*punresolved++, path_resolved_so_far);
|
||||||
|
|
||||||
if ('\0' == *punresolved && !realpath_failed)
|
if (*punresolved == '\0' && !realpath_failed)
|
||||||
{
|
{
|
||||||
ferr = _osl_resolvepath(
|
ferr = _osl_resolvepath(
|
||||||
path_resolved_so_far,
|
path_resolved_so_far,
|
||||||
&realpath_failed);
|
&realpath_failed);
|
||||||
|
|
||||||
if (osl_File_E_None != ferr)
|
if (ferr != osl_File_E_None)
|
||||||
return ferr;
|
return ferr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -609,7 +609,7 @@ oslFileError osl_getAbsoluteFileURL(rtl_uString* ustrBaseDirURL, rtl_uString* u
|
|||||||
|
|
||||||
rc = FileBase::getSystemPathFromFileURL(relUrl, unresolved_path);
|
rc = FileBase::getSystemPathFromFileURL(relUrl, unresolved_path);
|
||||||
|
|
||||||
if(FileBase::E_None != rc)
|
if(rc != FileBase::E_None)
|
||||||
return oslFileError(rc);
|
return oslFileError(rc);
|
||||||
|
|
||||||
if (systemPathIsRelativePath(unresolved_path))
|
if (systemPathIsRelativePath(unresolved_path))
|
||||||
@@ -617,7 +617,7 @@ oslFileError osl_getAbsoluteFileURL(rtl_uString* ustrBaseDirURL, rtl_uString* u
|
|||||||
rtl::OUString base_path;
|
rtl::OUString base_path;
|
||||||
rc = (FileBase::RC) osl_getSystemPathFromFileURL_Ex(ustrBaseDirURL, &base_path.pData);
|
rc = (FileBase::RC) osl_getSystemPathFromFileURL_Ex(ustrBaseDirURL, &base_path.pData);
|
||||||
|
|
||||||
if (FileBase::E_None != rc)
|
if (rc != FileBase::E_None)
|
||||||
return oslFileError(rc);
|
return oslFileError(rc);
|
||||||
|
|
||||||
rtl::OUString abs_path;
|
rtl::OUString abs_path;
|
||||||
@@ -628,7 +628,7 @@ oslFileError osl_getAbsoluteFileURL(rtl_uString* ustrBaseDirURL, rtl_uString* u
|
|||||||
|
|
||||||
rtl::OUString resolved_path;
|
rtl::OUString resolved_path;
|
||||||
rc = (FileBase::RC) osl_getAbsoluteFileURL_impl_(unresolved_path, 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);
|
rc = (FileBase::RC) osl_getFileURLFromSystemPath(resolved_path.pData, pustrAbsoluteURL);
|
||||||
OSL_ASSERT(FileBase::E_None == rc);
|
OSL_ASSERT(FileBase::E_None == rc);
|
||||||
@@ -651,7 +651,7 @@ namespace osl { namespace detail {
|
|||||||
rtl::OUString path("PATH");
|
rtl::OUString path("PATH");
|
||||||
rtl::OUString env_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);
|
bfound = osl::searchPath(file_path, env_path, result);
|
||||||
|
|
||||||
return bfound;
|
return bfound;
|
||||||
@@ -672,7 +672,7 @@ namespace
|
|||||||
bool bfound = false;
|
bool bfound = false;
|
||||||
rtl::OUString cwd_url;
|
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;
|
rtl::OUString cwd;
|
||||||
FileBase::getSystemPathFromFileURL(cwd_url, 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
|
// try to interpret search path as file url else assume it's a system path list
|
||||||
rc = FileBase::getSystemPathFromFileURL(ustrFilePath, file_path);
|
rc = FileBase::getSystemPathFromFileURL(ustrFilePath, file_path);
|
||||||
if (FileBase::E_INVAL == rc)
|
if (rc == FileBase::E_INVAL)
|
||||||
file_path = ustrFilePath;
|
file_path = ustrFilePath;
|
||||||
else if (FileBase::E_None != rc)
|
else if (rc != FileBase::E_None)
|
||||||
return oslFileError(rc);
|
return oslFileError(rc);
|
||||||
|
|
||||||
bool bfound = false;
|
bool bfound = false;
|
||||||
@@ -726,7 +726,7 @@ oslFileError FileURLToPath(char * buffer, size_t bufLen, rtl_uString* ustrFileUR
|
|||||||
rtl_uString* ustrSystemPath = nullptr;
|
rtl_uString* ustrSystemPath = nullptr;
|
||||||
oslFileError osl_error = osl_getSystemPathFromFileURL(ustrFileURL, &ustrSystemPath);
|
oslFileError osl_error = osl_getSystemPathFromFileURL(ustrFileURL, &ustrSystemPath);
|
||||||
|
|
||||||
if(osl_File_E_None != osl_error)
|
if(osl_error != osl_File_E_None)
|
||||||
return osl_error;
|
return osl_error;
|
||||||
|
|
||||||
osl_systemPathRemoveSeparator(ustrSystemPath);
|
osl_systemPathRemoveSeparator(ustrSystemPath);
|
||||||
|
@@ -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");
|
SAL_WARN_IF(ustrModuleName == nullptr, "sal.osl", "string is not valid");
|
||||||
|
|
||||||
/* ensure ustrTmp hold valid string */
|
/* 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);
|
rtl_uString_assign(&ustrTmp, ustrModuleName);
|
||||||
|
|
||||||
if (ustrTmp)
|
if (ustrTmp)
|
||||||
|
@@ -190,7 +190,7 @@ static rtl_Locale * parse_locale( const char * locale )
|
|||||||
rtl_Locale * ret;
|
rtl_Locale * ret;
|
||||||
|
|
||||||
/* language is a two or three letter code */
|
/* 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;
|
offset = 3;
|
||||||
|
|
||||||
/* convert language code to unicode */
|
/* convert language code to unicode */
|
||||||
@@ -198,7 +198,7 @@ static rtl_Locale * parse_locale( const char * locale )
|
|||||||
OSL_ASSERT(pLanguage != nullptr);
|
OSL_ASSERT(pLanguage != nullptr);
|
||||||
|
|
||||||
/* convert country code to unicode */
|
/* 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 );
|
rtl_string2UString( &pCountry, locale + offset + 1, 2, RTL_TEXTENCODING_ASCII_US, OSTRING_TO_OUSTRING_CVTFLAGS );
|
||||||
OSL_ASSERT(pCountry != nullptr);
|
OSL_ASSERT(pCountry != nullptr);
|
||||||
|
@@ -1136,7 +1136,7 @@ static bool is_timeout(const struct timeval* tend)
|
|||||||
|
|
||||||
static bool is_process_dead(pid_t pid)
|
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);
|
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;
|
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;
|
osl_error = osl_Process_E_Unknown;
|
||||||
}
|
}
|
||||||
else /* alien process; StatusThread will not be able
|
else /* alien process; StatusThread will not be able
|
||||||
|
@@ -163,11 +163,11 @@ static bool getFromCommandLineArgs(
|
|||||||
{
|
{
|
||||||
rtl_uString *pArg = nullptr;
|
rtl_uString *pArg = nullptr;
|
||||||
osl_getCommandArg( i, &pArg );
|
osl_getCommandArg( i, &pArg );
|
||||||
if( ('-' == pArg->buffer[0] || '/' == pArg->buffer[0] ) &&
|
if( (pArg->buffer[0] == '-' || pArg->buffer[0] == '/' ) &&
|
||||||
'e' == pArg->buffer[1] &&
|
pArg->buffer[1] == 'e' &&
|
||||||
'n' == pArg->buffer[2] &&
|
pArg->buffer[2] == 'n' &&
|
||||||
'v' == pArg->buffer[3] &&
|
pArg->buffer[3] == 'v' &&
|
||||||
':' == pArg->buffer[4] )
|
pArg->buffer[4] == ':' )
|
||||||
{
|
{
|
||||||
sal_Int32 nIndex = rtl_ustr_indexOfChar( pArg->buffer, '=' );
|
sal_Int32 nIndex = rtl_ustr_indexOfChar( pArg->buffer, '=' );
|
||||||
if( nIndex >= 0 )
|
if( nIndex >= 0 )
|
||||||
@@ -338,8 +338,8 @@ Bootstrap_Impl::Bootstrap_Impl( OUString const & rIniName )
|
|||||||
// normalize path
|
// normalize path
|
||||||
FileStatus status( osl_FileStatus_Mask_FileURL );
|
FileStatus status( osl_FileStatus_Mask_FileURL );
|
||||||
DirectoryItem dirItem;
|
DirectoryItem dirItem;
|
||||||
if (DirectoryItem::E_None == DirectoryItem::get( base_ini, dirItem ) &&
|
if (DirectoryItem::get( base_ini, dirItem ) == DirectoryItem::E_None &&
|
||||||
DirectoryItem::E_None == dirItem.getFileStatus( status ))
|
dirItem.getFileStatus( status ) == DirectoryItem::E_None)
|
||||||
{
|
{
|
||||||
base_ini = status.getFileURL();
|
base_ini = status.getFileURL();
|
||||||
if (! rIniName.equals( base_ini ))
|
if (! rIniName.equals( base_ini ))
|
||||||
@@ -351,11 +351,11 @@ Bootstrap_Impl::Bootstrap_Impl( OUString const & rIniName )
|
|||||||
SAL_INFO("sal.rtl", "Bootstrap_Impl(): sFile=" << _iniName);
|
SAL_INFO("sal.rtl", "Bootstrap_Impl(): sFile=" << _iniName);
|
||||||
oslFileHandle handle;
|
oslFileHandle handle;
|
||||||
if (!_iniName.isEmpty() &&
|
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;
|
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() );
|
OString line( reinterpret_cast<const char *>(seq.getConstArray()), seq.getLength() );
|
||||||
sal_Int32 nIndex = line.indexOf('=');
|
sal_Int32 nIndex = line.indexOf('=');
|
||||||
@@ -622,8 +622,8 @@ rtlBootstrapHandle SAL_CALL rtl_bootstrap_args_open (
|
|||||||
// normalize path
|
// normalize path
|
||||||
FileStatus status( osl_FileStatus_Mask_FileURL );
|
FileStatus status( osl_FileStatus_Mask_FileURL );
|
||||||
DirectoryItem dirItem;
|
DirectoryItem dirItem;
|
||||||
if (DirectoryItem::E_None != DirectoryItem::get( iniName, dirItem ) ||
|
if (DirectoryItem::get( iniName, dirItem ) != DirectoryItem::E_None ||
|
||||||
DirectoryItem::E_None != dirItem.getFileStatus( status ))
|
dirItem.getFileStatus( status ) != DirectoryItem::E_None)
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@@ -57,11 +57,11 @@ void init()
|
|||||||
{
|
{
|
||||||
rtl_uString * pArg = nullptr;
|
rtl_uString * pArg = nullptr;
|
||||||
osl_getCommandArg (i, &pArg);
|
osl_getCommandArg (i, &pArg);
|
||||||
if (('-' == pArg->buffer[0] || '/' == pArg->buffer[0]) &&
|
if ((pArg->buffer[0] == '-' || pArg->buffer[0] == '/') &&
|
||||||
'e' == pArg->buffer[1] &&
|
pArg->buffer[1] == 'e' &&
|
||||||
'n' == pArg->buffer[2] &&
|
pArg->buffer[2] == 'n' &&
|
||||||
'v' == pArg->buffer[3] &&
|
pArg->buffer[3] == 'v' &&
|
||||||
':' == pArg->buffer[4] &&
|
pArg->buffer[4] == ':' &&
|
||||||
rtl_ustr_indexOfChar (&(pArg->buffer[5]), '=') >= 0 )
|
rtl_ustr_indexOfChar (&(pArg->buffer[5]), '=') >= 0 )
|
||||||
{
|
{
|
||||||
// ignore.
|
// ignore.
|
||||||
|
Reference in New Issue
Block a user