diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-24 09:23:15 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-24 10:05:54 +0200 |
commit | a975225678c00272fc6e2ee2c85e6fe00a2204f1 (patch) | |
tree | 47aa7fdcd49221fd3084b9d77418b6690b7bc0e0 | |
parent | 78a3a304871eb3eb861a49ed00345b54fba01114 (diff) |
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>
22 files changed, 33 insertions, 114 deletions
diff --git a/hwpfilter/source/hiodev.cxx b/hwpfilter/source/hiodev.cxx index 45ccb987bcd5..25822a856827 100644 --- a/hwpfilter/source/hiodev.cxx +++ b/hwpfilter/source/hiodev.cxx @@ -133,9 +133,7 @@ void HStreamIODev::init() bool HStreamIODev::open() { - if (!(_stream->available())) - return false; - return true; + return _stream->available() != 0; } diff --git a/hwpfilter/source/htags.cxx b/hwpfilter/source/htags.cxx index 7a9ebabe82be..52e6a78b85f1 100644 --- a/hwpfilter/source/htags.cxx +++ b/hwpfilter/source/htags.cxx @@ -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; } diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx index 446f06b3f0ac..0601d03b3e88 100644 --- a/i18nlangtag/source/languagetag/languagetag.cxx +++ b/i18nlangtag/source/languagetag/languagetag.cxx @@ -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; } diff --git a/jvmfwk/plugins/sunmajor/pluginlib/gnujre.cxx b/jvmfwk/plugins/sunmajor/pluginlib/gnujre.cxx index 9c431146c777..1750696ab018 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/gnujre.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/gnujre.cxx @@ -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 diff --git a/jvmfwk/plugins/sunmajor/pluginlib/vendorbase.cxx b/jvmfwk/plugins/sunmajor/pluginlib/vendorbase.cxx index 948c99dfe876..1f7423045bc1 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/vendorbase.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/vendorbase.cxx @@ -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(); } } diff --git a/jvmfwk/source/fwkbase.cxx b/jvmfwk/source/fwkbase.cxx index 27950eb11630..dbab7d4a9e7a 100644 --- a/jvmfwk/source/fwkbase.cxx +++ b/jvmfwk/source/fwkbase.cxx @@ -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; } diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx index 4eac9e2a958f..266ab5a9f7a8 100644 --- a/linguistic/source/dicimp.cxx +++ b/linguistic/source/dicimp.cxx @@ -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 diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx index 05b6c81ee741..64bd279a95aa 100644 --- a/linguistic/source/dlistimp.cxx +++ b/linguistic/source/dlistimp.cxx @@ -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; } diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx index 86dfb831ab2d..f2c9e901e3aa 100644 --- a/linguistic/source/misc.cxx +++ b/linguistic/source/misc.cxx @@ -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 ) diff --git a/lotuswordpro/source/filter/lwpbookmarkmgr.cxx b/lotuswordpro/source/filter/lwpbookmarkmgr.cxx index b3b01f916916..bfec019fbfd4 100644 --- a/lotuswordpro/source/filter/lwpbookmarkmgr.cxx +++ b/lotuswordpro/source/filter/lwpbookmarkmgr.cxx @@ -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() diff --git a/lotuswordpro/source/filter/lwpframelayout.cxx b/lotuswordpro/source/filter/lwpframelayout.cxx index c26d61f75378..cb35bd911213 100644 --- a/lotuswordpro/source/filter/lwpframelayout.cxx +++ b/lotuswordpro/source/filter/lwpframelayout.cxx @@ -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 diff --git a/lotuswordpro/source/filter/lwpfrib.cxx b/lotuswordpro/source/filter/lwpfrib.cxx index 68ddcc544da5..ae4e48e76cc1 100644 --- a/lotuswordpro/source/filter/lwpfrib.cxx +++ b/lotuswordpro/source/filter/lwpfrib.cxx @@ -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) diff --git a/lotuswordpro/source/filter/lwpfribsection.cxx b/lotuswordpro/source/filter/lwpfribsection.cxx index 6e1b41729be9..d6518db53026 100644 --- a/lotuswordpro/source/filter/lwpfribsection.cxx +++ b/lotuswordpro/source/filter/lwpfribsection.cxx @@ -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: */ diff --git a/lotuswordpro/source/filter/lwpgrfobj.cxx b/lotuswordpro/source/filter/lwpgrfobj.cxx index ddb79592c566..64f855ce9ce0 100644 --- a/lotuswordpro/source/filter/lwpgrfobj.cxx +++ b/lotuswordpro/source/filter/lwpgrfobj.cxx @@ -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'); } /** diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx index b5f5056ebf50..ca90224f7e69 100644 --- a/lotuswordpro/source/filter/lwplayout.cxx +++ b/lotuswordpro/source/filter/lwplayout.cxx @@ -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(); } /** diff --git a/lotuswordpro/source/filter/lwpmarker.cxx b/lotuswordpro/source/filter/lwpmarker.cxx index bfe0b267466c..5cf0e9f59060 100644 --- a/lotuswordpro/source/filter/lwpmarker.cxx +++ b/lotuswordpro/source/filter/lwpmarker.cxx @@ -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) diff --git a/lotuswordpro/source/filter/lwppagelayout.cxx b/lotuswordpro/source/filter/lwppagelayout.cxx index 5ee886b8284a..a8eb63d0f880 100644 --- a/lotuswordpro/source/filter/lwppagelayout.cxx +++ b/lotuswordpro/source/filter/lwppagelayout.cxx @@ -688,10 +688,7 @@ bool LwpPageLayout::operator<(LwpPageLayout& Other) } } - if(!pThisPara) - return true; - - return false; + return pThisPara == nullptr; } /** diff --git a/lotuswordpro/source/filter/lwppara1.cxx b/lotuswordpro/source/filter/lwppara1.cxx index e029356668ee..ef1a6cdc2c7a 100644 --- a/lotuswordpro/source/filter/lwppara1.cxx +++ b/lotuswordpro/source/filter/lwppara1.cxx @@ -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: */ diff --git a/lotuswordpro/source/filter/lwprowlayout.cxx b/lotuswordpro/source/filter/lwprowlayout.cxx index 3ca645d88473..8ddff0a5c7b0 100644 --- a/lotuswordpro/source/filter/lwprowlayout.cxx +++ b/lotuswordpro/source/filter/lwprowlayout.cxx @@ -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) diff --git a/lotuswordpro/source/filter/lwptable.cxx b/lotuswordpro/source/filter/lwptable.cxx index 416c3f2e6ba9..a7e0d3d63802 100644 --- a/lotuswordpro/source/filter/lwptable.cxx +++ b/lotuswordpro/source/filter/lwptable.cxx @@ -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*/) diff --git a/lotuswordpro/source/filter/lwptools.cxx b/lotuswordpro/source/filter/lwptools.cxx index 045768b5dc7f..240789ca12d3 100644 --- a/lotuswordpro/source/filter/lwptools.cxx +++ b/lotuswordpro/source/filter/lwptools.cxx @@ -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) diff --git a/lotuswordpro/source/filter/xfilter/xfshadow.cxx b/lotuswordpro/source/filter/xfilter/xfshadow.cxx index 287e2f48b2fe..b7b278a7f354 100644 --- a/lotuswordpro/source/filter/xfilter/xfshadow.cxx +++ b/lotuswordpro/source/filter/xfilter/xfshadow.cxx @@ -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) |