summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorMuhammet Kara <muhammet.kara@pardus.org.tr>2016-05-30 17:20:50 +0300
committerCaolán McNamara <caolanm@redhat.com>2016-07-05 09:35:40 +0000
commitb6b34d538398f8214daa5b160f764dc8b82ff9c5 (patch)
tree9ffb350c9cbd293618fab09efcff6c8ad06151b3 /sal
parent4ed2a7305f80192bdbe2eace48c4ee65e9938f7d (diff)
Clarify calculation precedence tdf#39440
Use parentheses to clarify the code. Change-Id: I864dc6dacadb5b9ba9dca8e0abd9fa4e6db1eddc Reviewed-on: https://gerrit.libreoffice.org/25677 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: jan iversen <jani@documentfoundation.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/file.cxx18
1 files changed, 9 insertions, 9 deletions
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index 2938e0e1da37..b9b7e6fd5581 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -883,18 +883,18 @@ openFilePath( const char *cpFilePath, oslFileHandle* pHandle, sal_uInt32 uFlags,
#endif
/* set mode and flags */
- int defmode = uFlags & osl_File_OpenFlag_Private
+ int defmode = (uFlags & osl_File_OpenFlag_Private)
? S_IRUSR : S_IRUSR | S_IRGRP | S_IROTH;
int flags = O_RDONLY;
if (uFlags & osl_File_OpenFlag_Write)
{
- defmode |= uFlags & osl_File_OpenFlag_Private
+ defmode |= (uFlags & osl_File_OpenFlag_Private)
? S_IWUSR : S_IWUSR | S_IWGRP | S_IWOTH;
flags = OPEN_WRITE_FLAGS;
}
if (uFlags & osl_File_OpenFlag_Create)
{
- defmode |= uFlags & osl_File_OpenFlag_Private
+ defmode |= (uFlags & osl_File_OpenFlag_Private)
? S_IWUSR : S_IWUSR | S_IWGRP | S_IWOTH;
flags = OPEN_CREATE_FLAGS;
}
@@ -938,7 +938,7 @@ openFilePath( const char *cpFilePath, oslFileHandle* pHandle, sal_uInt32 uFlags,
if (-1 == fd)
{
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));
return oslTranslateFileError (OSL_FET_ERROR, saved_errno);
}
@@ -950,7 +950,7 @@ openFilePath( const char *cpFilePath, oslFileHandle* pHandle, sal_uInt32 uFlags,
if (-1 == f)
{
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));
eRet = oslTranslateFileError (OSL_FET_ERROR, saved_errno);
(void) close(fd);
return eRet;
@@ -958,7 +958,7 @@ openFilePath( const char *cpFilePath, oslFileHandle* pHandle, sal_uInt32 uFlags,
if (-1 == fcntl (fd, F_SETFL, (f & ~O_NONBLOCK)))
{
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));
eRet = oslTranslateFileError (OSL_FET_ERROR, saved_errno);
(void) close(fd);
return eRet;
@@ -970,7 +970,7 @@ openFilePath( const char *cpFilePath, oslFileHandle* pHandle, sal_uInt32 uFlags,
if (-1 == fstat (fd, &aFileStat))
{
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));
eRet = oslTranslateFileError (OSL_FET_ERROR, saved_errno);
(void) close(fd);
return eRet;
@@ -1008,7 +1008,7 @@ openFilePath( const char *cpFilePath, oslFileHandle* pHandle, sal_uInt32 uFlags,
if (-1 == fcntl (fd, F_SETLK, &aflock))
{
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));
eRet = oslTranslateFileError (OSL_FET_ERROR, saved_errno);
(void) close(fd);
return eRet;
@@ -1029,7 +1029,7 @@ openFilePath( const char *cpFilePath, oslFileHandle* pHandle, sal_uInt32 uFlags,
pImpl->m_state |= FileHandle_Impl::STATE_WRITEABLE;
pImpl->m_size = sal::static_int_cast< sal_uInt64 >(aFileStat.st_size);
- SAL_INFO("sal.file", "osl_openFile(" << cpFilePath << ", " << (flags & O_RDWR ? "writeable":"readonly") << ") => " << pImpl->m_fd);
+ SAL_INFO("sal.file", "osl_openFile(" << cpFilePath << ", " << ((flags & O_RDWR) ? "writeable":"readonly") << ") => " << pImpl->m_fd);
*pHandle = static_cast<oslFileHandle>(pImpl);
return osl_File_E_None;