clang-tidy readability-simplify-boolean-expr in hwpfilter..lotuswordpro

Change-Id: I945d3fe6af5f88937b341dfc3696bf1d36344862
Reviewed-on: https://gerrit.libreoffice.org/36874
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2017-04-24 10:05:54 +02:00
parent 78a3a30487
commit a975225678
22 changed files with 33 additions and 114 deletions
+1 -3
View File
@@ -133,9 +133,7 @@ void HStreamIODev::init()
bool HStreamIODev::open()
{
if (!(_stream->available()))
return false;
return true;
return _stream->available() != 0;
}
+1 -3
View File
@@ -70,9 +70,7 @@ bool EmPicture::Read(HWPFile & hwpf)
name[0] = 'H';
name[1] = 'W';
name[2] = 'P';
if (hwpf.ReadBlock(data, size) == 0)
return false;
return true;
return hwpf.ReadBlock(data, size) != 0;
}
@@ -2638,9 +2638,7 @@ static bool lcl_isSystem( LanguageType nLangID )
// There are some special values that simplify to SYSTEM,
// getRealLanguage() catches and resolves them.
LanguageType nNewLangID = MsLangId::getRealLanguage( nLangID);
if (nNewLangID != nLangID)
return true;
return false;
return nNewLangID != nLangID;
}
+1 -4
View File
@@ -283,10 +283,7 @@ bool GnuInfo::initialize(vector<pair<OUString, OUString> > props)
break;
}
}
if (!bLdPath)
return false;
return true;
return bLdPath;
}
int GnuInfo::compareVersions(const OUString&) const
@@ -175,10 +175,7 @@ bool VendorBase::initialize(vector<pair<OUString, OUString> > props)
break;
}
}
if (!bLdPath)
return false;
return true;
return bLdPath;
}
const OUString & VendorBase::getVendor() const
@@ -228,9 +225,7 @@ bool VendorBase::supportsAccessibility() const
bool VendorBase::needsRestart() const
{
if (!getLibraryPath().isEmpty())
return true;
return false;
return !getLibraryPath().isEmpty();
}
}
+1 -3
View File
@@ -532,9 +532,7 @@ void setJavaSelected()
bool wasJavaSelectedInSameProcess()
{
//g_setJavaProcId not set means no Java selected
if (g_bJavaSet)
return true;
return false;
return g_bJavaSet;
}
+1 -4
View File
@@ -130,10 +130,7 @@ sal_Int16 ReadDicVersion( SvStreamPtr &rpStream, sal_uInt16 &nLng, bool &bNeg )
// type: negative / positive
if (getTag(aLine, "type: ", aTagValue))
{
if (aTagValue == "negative")
bNeg = true;
else
bNeg = false;
bNeg = aTagValue == "negative";
}
if (aLine.indexOf("---") != -1) // end of header
+1 -4
View File
@@ -834,10 +834,7 @@ static bool IsVers2OrNewer( const OUString& rFileURL, sal_uInt16& nLng, bool& bN
SvStreamPtr pStream = SvStreamPtr( utl::UcbStreamHelper::CreateStream( xStream ) );
int nDicVersion = ReadDicVersion(pStream, nLng, bNeg);
if (2 == nDicVersion || nDicVersion >= 5)
return true;
return false;
return 2 == nDicVersion || nDicVersion >= 5;
}
+1 -3
View File
@@ -110,9 +110,7 @@ bool LinguIsUnspecified( const OUString & rBcp47 )
{
if (rBcp47.getLength() != 3)
return false;
if (rBcp47 == "zxx" || rBcp47 == "und" || rBcp47 == "mul")
return true;
return false;
return rBcp47 == "zxx" || rBcp47 == "und" || rBcp47 == "mul";
}
static inline sal_Int32 Minimum( sal_Int32 n1, sal_Int32 n2, sal_Int32 n3 )
@@ -95,10 +95,7 @@ bool LwpBookmarkMgr::FindBookmark(const OUString& sName)
{
std::map<OUString,XFBookmarkStart*>::iterator iter;
iter = m_MapStart.find(sName);
if (iter != m_MapStart.end())
return true;
else
return false;
return iter != m_MapStart.end();
}
LwpBookmarkMgr::LwpBookmarkMgr()
@@ -901,9 +901,7 @@ OUString LwpFrameLayout::GetNextLinkName()
bool LwpFrameLayout::HasPreviousLinkLayout()
{
LwpObjectID& rObjectID = m_Link.GetPreviousLayout();
if(rObjectID.IsNull())
return false;
return true;
return !rObjectID.IsNull();
}
/**
* @descr whether current frame is for water mark. Problem maybe exists by this method, must be tracking
+1 -3
View File
@@ -385,9 +385,7 @@ void LwpFrib::ReadModifiers(LwpObjectStream* pObjStrm,ModifierInfo* pModInfo)
*/
bool LwpFrib::HasNextFrib()
{
if (!GetNext() || GetNext()->GetType()==FRIB_TAG_EOP)
return false;
return true;
return GetNext() && GetNext()->GetType() != FRIB_TAG_EOP;
}
void LwpFrib::ConvertChars(XFContentContainer* pXFPara,const OUString& text)
@@ -455,13 +455,9 @@ void LwpMasterPage::RegisterFillerPageStyle()
bool LwpMasterPage::IsNextPageType()
{
LwpLayout::UseWhenType eUserType = m_pLayout->GetUseWhenType();
if(eUserType == LwpLayout::StartOnNextPage
return eUserType == LwpLayout::StartOnNextPage
|| eUserType == LwpLayout::StartOnOddPage
|| eUserType == LwpLayout::StartOnEvenPage )
{
return true;
}
return false;
|| eUserType == LwpLayout::StartOnEvenPage;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+2 -9
View File
@@ -256,20 +256,13 @@ void LwpGraphicObject::XFConvert (XFContentContainer* pCont)
*/
bool LwpGraphicObject::IsGrafFormatValid()
{
if ((m_sServerContextFormat[1]=='b'&& m_sServerContextFormat[2]=='m' && m_sServerContextFormat[3]=='p')
return (m_sServerContextFormat[1]=='b'&& m_sServerContextFormat[2]=='m' && m_sServerContextFormat[3]=='p')
|| (m_sServerContextFormat[1]=='j' && m_sServerContextFormat[2]=='p' && m_sServerContextFormat[3]=='g')
|| (m_sServerContextFormat[1]=='w' && m_sServerContextFormat[2]=='m' && m_sServerContextFormat[3]=='f')
|| (m_sServerContextFormat[1]=='g' && m_sServerContextFormat[2]=='i' && m_sServerContextFormat[3]=='f')
|| (m_sServerContextFormat[1]=='t' && m_sServerContextFormat[2]=='g' && m_sServerContextFormat[3]=='f')
|| (m_sServerContextFormat[1]=='p' && m_sServerContextFormat[2]=='n' && m_sServerContextFormat[3]=='g')
|| (m_sServerContextFormat[1]=='e' && m_sServerContextFormat[2]=='p' && m_sServerContextFormat[3]=='s'))
{
return true;
}
else
{
return false;
}
|| (m_sServerContextFormat[1]=='e' && m_sServerContextFormat[2]=='p' && m_sServerContextFormat[3]=='s');
}
/**
+6 -24
View File
@@ -974,12 +974,8 @@ bool LwpMiddleLayout::CanSizeRight()
{
sal_uInt8 RelType = GetRelativeType();
if (RelType == LwpLayoutRelativityGuts::LAY_INLINE || RelType == LwpLayoutRelativityGuts::LAY_PARA_RELATIVE
|| RelType == LwpLayoutRelativityGuts::LAY_INLINE_VERTICAL)
{
return false;
}
return true;
return !(RelType == LwpLayoutRelativityGuts::LAY_INLINE || RelType == LwpLayoutRelativityGuts::LAY_PARA_RELATIVE
|| RelType == LwpLayoutRelativityGuts::LAY_INLINE_VERTICAL);
}
sal_Int32 LwpMiddleLayout::GetMinimumWidth()
{
@@ -1453,9 +1449,7 @@ bool LwpMiddleLayout::GetUsePrinterSettings()
bool LwpMiddleLayout::HasContent()
{
rtl::Reference<LwpObject> content = m_Content.obj();
if(content.is())
return true;
return false;
return content.is();
}
LwpLayout::LwpLayout( LwpObjectHeader &objHdr, LwpSvStream* pStrm ) :
@@ -2084,11 +2078,7 @@ bool LwpPlacableLayout::IsAnchorPage()
return false;
rtl::Reference<LwpVirtualLayout> xLayout = GetParentLayout();
if (xLayout.is() && (xLayout->IsPage() || xLayout->IsHeader() || xLayout->IsFooter()))
{
return true;
}
return false;
return xLayout.is() && (xLayout->IsPage() || xLayout->IsHeader() || xLayout->IsFooter());
}
/**
* @descr: whether the parent layout is frame layout
@@ -2100,11 +2090,7 @@ bool LwpPlacableLayout::IsAnchorFrame()
return false;
rtl::Reference<LwpVirtualLayout> xLayout = GetParentLayout();
if (xLayout.is() && (xLayout->IsFrame() || xLayout->IsGroupHead()))
{
return true;
}
return false;
return xLayout.is() && (xLayout->IsFrame() || xLayout->IsGroupHead());
}
/**
* @descr: whether the parent layout is cell layout
@@ -2116,11 +2102,7 @@ bool LwpPlacableLayout::IsAnchorCell()
return false;
rtl::Reference<LwpVirtualLayout> xLayout = GetParentLayout();
if (xLayout.is() && xLayout->IsCell())
{
return true;
}
return false;
return xLayout.is() && xLayout->IsCell();
}
/**
+3 -9
View File
@@ -290,9 +290,7 @@ void LwpCHBlkMarker::ProcessKeylist(XFContentContainer* pXFPara,sal_uInt8 nType)
bool LwpCHBlkMarker::IsHasFilled()
{
if (CHB_PROMPT & m_nFlag)
return false;
return true;
return (CHB_PROMPT & m_nFlag) == 0;
}
bool LwpCHBlkMarker::IsBubbleHelp()
@@ -341,9 +339,7 @@ void LwpBookMark::Read()
bool LwpBookMark::IsRightMarker(LwpObjectID objMarker)
{
if (objMarker == m_objMarker)
return true;
return false;
return objMarker == m_objMarker;
}
OUString LwpBookMark::GetName()
@@ -419,9 +415,7 @@ void LwpFieldMark::ParseTOC(OUString& sLevel,OUString& sText)
bool LwpFieldMark::IsFormulaInsert()
{
if (m_nFlag & FF_FORMULAINSERTED)
return true;
return false;
return (m_nFlag & FF_FORMULAINSERTED) != 0;
}
bool LwpFieldMark::IsDateTimeField(sal_uInt8& type,OUString& formula)
+1 -4
View File
@@ -688,10 +688,7 @@ bool LwpPageLayout::operator<(LwpPageLayout& Other)
}
}
if(!pThisPara)
return true;
return false;
return pThisPara == nullptr;
}
/**
+1 -3
View File
@@ -617,9 +617,7 @@ bool LwpPara::IsInCell()
if (!pStory)
return false;
rtl::Reference<LwpVirtualLayout> xLayout(pStory->GetLayout(nullptr));
if (xLayout.is() && xLayout->IsCell())
return true;
return false;
return xLayout.is() && xLayout->IsCell();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+1 -4
View File
@@ -459,10 +459,7 @@ void LwpRowLayout::SetCellSplit(sal_uInt16 nEffectRows)
*/
bool LwpRowLayout::GetMergeCellFlag()
{
if (m_ConnCellList.empty())
return false;
else
return true;
return !m_ConnCellList.empty();
}
LwpRowHeadingLayout::LwpRowHeadingLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
+1 -3
View File
@@ -125,9 +125,7 @@ void LwpTable::Read()
bool LwpTable::IsNumberDown()
{
if (m_nAttributes & NUMBER_DOWN)
return true;
return false;
return (m_nAttributes & NUMBER_DOWN) != 0;
}
void LwpTable::Parse(IXFStream* /*pOutputStream*/)
+1 -3
View File
@@ -197,9 +197,7 @@ bool LwpTools::IsUnicodePacked(LwpObjectStream* pObjStrm, sal_uInt16 len)
bool LwpTools::isFileUrl(const OString &fileName)
{
if (fileName.startsWith("file://") )
return true;
return false;
return fileName.startsWith("file://");
}
OUString LwpTools::convertToFileUrl(const OString &fileName)
@@ -103,12 +103,9 @@ void XFShadow::ToXml(IXFStream *pStrm)
bool operator==(XFShadow& s1, XFShadow& s2)
{
if( (s1.m_ePosition == s2.m_ePosition) &&
return (s1.m_ePosition == s2.m_ePosition) &&
(s1.m_fOffset == s2.m_fOffset) &&
(s1.m_aColor == s2.m_aColor)
)
return true;
return false;
(s1.m_aColor == s2.m_aColor);
}
bool operator!=(XFShadow& s1, XFShadow& s2)