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>
This commit is contained in:
Muhammet Kara 2016-05-30 17:20:50 +03:00 committed by Caolán McNamara
parent 4ed2a7305f
commit b6b34d5383
14 changed files with 37 additions and 37 deletions

View File

@ -373,7 +373,7 @@ static void cpp_vtable_call()
// fprintf(stderr,"cpp_mediate nFunctionIndex=%x\n",nFunctionIndex);
// fflush(stderr);
sal_Bool bComplex = nFunctionIndex & 0x80000000 ? sal_True : sal_False;
sal_Bool bComplex = (nFunctionIndex & 0x80000000) ? sal_True : sal_False;
typelib_TypeClass aType =
cpp_mediate( nFunctionIndex, vTableOffset, pCallStack+17, (sal_Int64*)&nRegReturn );

View File

@ -1832,7 +1832,7 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt
}
// "ProjectionMode"
const OUString sExtrusionProjectionMode( "ProjectionMode" );
ProjectionMode eProjectionMode = GetPropertyValue( DFF_Prop_fc3DFillHarsh, 0 ) & 4 ? ProjectionMode_PARALLEL : ProjectionMode_PERSPECTIVE;
ProjectionMode eProjectionMode = (GetPropertyValue( DFF_Prop_fc3DFillHarsh, 0 ) & 4) ? ProjectionMode_PARALLEL : ProjectionMode_PERSPECTIVE;
aProp.Name = sExtrusionProjectionMode;
aProp.Value <<= eProjectionMode;
aExtrusionPropVec.push_back( aProp );
@ -2577,17 +2577,17 @@ void DffPropertyReader::ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, DffObj
rSet.Put( SvxFontHeightItem( rManager.ScalePt( GetPropertyValue( DFF_Prop_gtextSize, 0 ) ), 100, EE_CHAR_FONTHEIGHT ) );
sal_uInt32 nFontAttributes = GetPropertyValue( DFF_Prop_gtextFStrikethrough, 0 );
if ( nFontAttributes & 0x20 )
rSet.Put( SvxWeightItem( nFontAttributes & 0x20 ? WEIGHT_BOLD : WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
rSet.Put( SvxWeightItem( (nFontAttributes & 0x20) ? WEIGHT_BOLD : WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
if ( nFontAttributes & 0x10 )
rSet.Put( SvxPostureItem( nFontAttributes & 0x10 ? ITALIC_NORMAL : ITALIC_NONE, EE_CHAR_ITALIC ) );
rSet.Put( SvxPostureItem( (nFontAttributes & 0x10) ? ITALIC_NORMAL : ITALIC_NONE, EE_CHAR_ITALIC ) );
if ( nFontAttributes & 0x08 )
rSet.Put( SvxUnderlineItem( nFontAttributes & 0x08 ? LINESTYLE_SINGLE : LINESTYLE_NONE, EE_CHAR_UNDERLINE ) );
rSet.Put( SvxUnderlineItem( (nFontAttributes & 0x08) ? LINESTYLE_SINGLE : LINESTYLE_NONE, EE_CHAR_UNDERLINE ) );
if ( nFontAttributes & 0x40 )
rSet.Put( SvxShadowedItem( (nFontAttributes & 0x40) != 0, EE_CHAR_SHADOW ) );
// if ( nFontAttributes & 0x02 )
// rSet.Put( SvxCaseMapItem( nFontAttributes & 0x02 ? SVX_CASEMAP_KAPITAELCHEN : SVX_CASEMAP_NOT_MAPPED ) );
if ( nFontAttributes & 0x01 )
rSet.Put( SvxCrossedOutItem( nFontAttributes & 0x01 ? STRIKEOUT_SINGLE : STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ) );
rSet.Put( SvxCrossedOutItem( (nFontAttributes & 0x01) ? STRIKEOUT_SINGLE : STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ) );
if ( IsProperty( DFF_Prop_fillColor ) )
rSet.Put( XFillColorItem( OUString(), rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillColor, 0 ), DFF_Prop_fillColor ) ) );
if ( IsProperty( DFF_Prop_shadowColor ) )

View File

@ -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;

View File

@ -2186,7 +2186,7 @@ std::shared_ptr<OGLTransitionImpl> makeHoneycomb()
Primitive aHexagon;
for (int y = 0; y < NY+2; y+=2)
for (int x = 0; x < NX+2; x+=2)
aHexagon.pushTriangle(glm::vec2(y % 4 ? fdiv(x, NX) : fdiv(x + 1, NX), fdiv(y, NY)), glm::vec2(1, 0), glm::vec2(0, 0));
aHexagon.pushTriangle(glm::vec2((y % 4) ? fdiv(x, NX) : fdiv(x + 1, NX), fdiv(y, NY)), glm::vec2(1, 0), glm::vec2(0, 0));
aSlide.push_back(aHexagon);
return makeHoneycombTransition(aSlide, aSlide, aSettings);

View File

@ -1992,7 +1992,7 @@ SwNumRule* DocumentStylePoolManager::GetNumRuleFromPool( sal_uInt16 nId )
for (sal_uInt16 n = 0; n < MAXLEVEL; ++n)
{
aFormat.SetBulletChar( ( n & 1 ? 0x25a1 : 0x2611 ) );
aFormat.SetBulletChar( ( (n & 1) ? 0x25a1 : 0x2611 ) );
if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
{

View File

@ -2545,7 +2545,7 @@ void AttributeOutputBase::TextField( const SwFormatField& rField )
case RES_AUTHORFLD:
{
ww::eField eField =
(AF_SHORTCUT & pField->GetFormat() ? ww::eUSERINITIALS : ww::eUSERNAME);
((AF_SHORTCUT & pField->GetFormat()) ? ww::eUSERINITIALS : ww::eUSERNAME);
GetExport().OutputField(pField, eField, FieldString(eField));
}
break;

View File

@ -715,7 +715,7 @@ IMPL_LINK_TYPED( SwInsertDBColAutoPilot, TableFormatHdl, Button*, pButton, void
}
else
nWidth = rSh.GetAnyCurRect(
FrameTypeFlags::FLY_ANY & rSh.GetFrameType( nullptr, true )
(FrameTypeFlags::FLY_ANY & rSh.GetFrameType( nullptr, true ))
? RECT_FLY_PRT_EMBEDDED
: RECT_PAGE_PRT ).Width();

View File

@ -1949,7 +1949,7 @@ bool SwDocStyleSheet::FillStyleSheet(
}
else if( !bCreate )
nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC );
SetMask( USER_FMT & nPoolId ? SFXSTYLEBIT_USERDEF : 0 );
SetMask( (USER_FMT & nPoolId) ? SFXSTYLEBIT_USERDEF : 0 );
bRet = nullptr != pDesc || USHRT_MAX != nPoolId;
if( bDeleteInfo )
@ -1978,7 +1978,7 @@ bool SwDocStyleSheet::FillStyleSheet(
}
else if( !bCreate )
nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE );
SetMask( USER_FMT & nPoolId ? SFXSTYLEBIT_USERDEF : 0 );
SetMask( (USER_FMT & nPoolId) ? SFXSTYLEBIT_USERDEF : 0 );
bRet = nullptr != pNumRule || USHRT_MAX != nPoolId;

View File

@ -2242,7 +2242,7 @@ KEYINPUT_CHECKTABLE_INSDEL:
nsSelectionType::SEL_DRW_FORM))
{
eKeyState = rKeyCode.GetModifier() & KEY_SHIFT ?
eKeyState = (rKeyCode.GetModifier() & KEY_SHIFT) ?
KS_PrevObject : KS_NextObject;
}
else if ( !rSh.IsMultiSelection() && rSh.CursorInsideInputField() )

View File

@ -118,10 +118,10 @@ void SwView::InsertCaption(const InsCaptionOpt *pOpt)
if (eType & nsSelectionType::SEL_OLE)
eType = nsSelectionType::SEL_GRF;
const SwLabelType eT = eType & nsSelectionType::SEL_TBL ? LTYPE_TABLE :
eType & nsSelectionType::SEL_FRM ? LTYPE_FLY :
eType == nsSelectionType::SEL_TXT ? LTYPE_FLY :
eType & nsSelectionType::SEL_DRW ? LTYPE_DRAW :
const SwLabelType eT = (eType & nsSelectionType::SEL_TBL) ? LTYPE_TABLE :
(eType & nsSelectionType::SEL_FRM) ? LTYPE_FLY :
(eType == nsSelectionType::SEL_TXT) ? LTYPE_FLY :
(eType & nsSelectionType::SEL_DRW) ? LTYPE_DRAW :
LTYPE_OBJECT;
SwFieldMgr aMgr(&rSh);

View File

@ -1271,7 +1271,7 @@ void SwView::StateTabWin(SfxItemSet& rSet)
if ( ( nFrameType & FrameTypeFlags::HEADER || nFrameType & FrameTypeFlags::FOOTER ) &&
!(nFrameType & FrameTypeFlags::COLSECT) )
{
SwFrameFormat *pFormat = const_cast<SwFrameFormat*>(nFrameType & FrameTypeFlags::HEADER ?
SwFrameFormat *pFormat = const_cast<SwFrameFormat*>((nFrameType & FrameTypeFlags::HEADER) ?
rDesc.GetMaster().GetHeader().GetHeaderFormat() :
rDesc.GetMaster().GetFooter().GetFooterFormat());
if( pFormat )// #i80890# if rDesc is not the one belonging to the current page is might crash

View File

@ -626,10 +626,10 @@ INetURLObject::FSysStyle guessFSysStyleByCounting(sal_Unicode const * pBegin,
&& pEnd - pBegin <= std::numeric_limits< sal_Int32 >::max(),
"guessFSysStyleByCounting(): Too big");
sal_Int32 nSlashCount
= eStyle & INetURLObject::FSYS_UNX ?
= (eStyle & INetURLObject::FSYS_UNX) ?
0 : std::numeric_limits< sal_Int32 >::min();
sal_Int32 nBackslashCount
= eStyle & INetURLObject::FSYS_DOS ?
= (eStyle & INetURLObject::FSYS_DOS) ?
0 : std::numeric_limits< sal_Int32 >::min();
while (pBegin != pEnd)
switch (*pBegin++)
@ -4262,9 +4262,9 @@ bool INetURLObject::setFSysPath(OUString const & rFSysPath,
sal_Unicode const * pFSysBegin = rFSysPath.getStr();
sal_Unicode const * pFSysEnd = pFSysBegin + rFSysPath.getLength();
switch ((eStyle & FSYS_VOS ? 1 : 0)
+ (eStyle & FSYS_UNX ? 1 : 0)
+ (eStyle & FSYS_DOS ? 1 : 0))
switch (((eStyle & FSYS_VOS) ? 1 : 0)
+ ((eStyle & FSYS_UNX) ? 1 : 0)
+ ((eStyle & FSYS_DOS) ? 1 : 0))
{
case 0:
return false;
@ -4433,9 +4433,9 @@ OUString INetURLObject::getFSysPath(FSysStyle eStyle,
if (m_eScheme != INetProtocol::File)
return OUString();
if ((eStyle & FSYS_VOS ? 1 : 0)
+ (eStyle & FSYS_UNX ? 1 : 0)
+ (eStyle & FSYS_DOS ? 1 : 0)
if (((eStyle & FSYS_VOS) ? 1 : 0)
+ ((eStyle & FSYS_UNX) ? 1 : 0)
+ ((eStyle & FSYS_DOS) ? 1 : 0)
> 1)
{
eStyle = eStyle & FSYS_VOS

View File

@ -801,7 +801,7 @@ Reference< XRow > FTPContent::getPropertyValues(
else if(aDirEntry.m_nMode != INETCOREFTP_FILEMODE_UNKNOWN) {
if(Name == "ContentType")
xRow->appendString(seqProp[i],
aDirEntry.m_nMode&INETCOREFTP_FILEMODE_ISDIR
(aDirEntry.m_nMode & INETCOREFTP_FILEMODE_ISDIR)
? OUString(FTP_FOLDER)
: OUString(FTP_FILE) );
else if(Name == "IsReadOnly")

View File

@ -217,7 +217,7 @@ void OutputDevice::DrawCheckered(const Point& rPos, const Size& rSize, sal_uInt3
{
const sal_uInt32 nBottom(std::min(nMaxY, nY + nLen));
SetFillColor((x & 0x0001) ^ (y & 0x0001) ? aStart : aEnd);
SetFillColor(((x & 0x0001) ^ (y & 0x0001)) ? aStart : aEnd);
DrawRect(Rectangle(nX, nY, nRight, nBottom));
}
}