diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-05-29 11:34:54 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-05-29 13:46:26 +0200 |
commit | 6f6f1680ec35b1616c2fc54e5ee8c3b85edf333b (patch) | |
tree | 5ec6cfdde2c0c848416155d1d8cab72a3254525e /hwpfilter | |
parent | 8581d880f8aa8c2be15c875db291cebbb42841c7 (diff) |
loplugin:simplifybool in hwpfilter..lotuswordpro
Change-Id: Iedfd492c963eb89fe75fdd73cae630e7e1dae119
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95100
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'hwpfilter')
-rw-r--r-- | hwpfilter/source/hfont.cxx | 6 | ||||
-rw-r--r-- | hwpfilter/source/hstyle.cxx | 8 | ||||
-rw-r--r-- | hwpfilter/source/hwpread.cxx | 20 | ||||
-rw-r--r-- | hwpfilter/source/hwpreader.cxx | 2 |
4 files changed, 18 insertions, 18 deletions
diff --git a/hwpfilter/source/hfont.cxx b/hwpfilter/source/hfont.cxx index 1a96b1797463..71ca23451bd8 100644 --- a/hwpfilter/source/hfont.cxx +++ b/hwpfilter/source/hfont.cxx @@ -42,7 +42,7 @@ void HWPFont::AddFont(int lang, const char *font) { int nfonts; - if (!(lang >= 0 && lang < NLanguage)) + if (lang < 0 || lang >= NLanguage) return; nfonts = nFonts[lang]; if (MAXFONTS <= nfonts) @@ -56,7 +56,7 @@ void HWPFont::AddFont(int lang, const char *font) const char *HWPFont::GetFontName(int lang, int id) { - if (!(lang >= 0 && lang < NLanguage)) + if (lang < 0 || lang >= NLanguage) return nullptr; if (id < 0 || nFonts[lang] <= id) return nullptr; @@ -75,7 +75,7 @@ void HWPFont::Read(HWPFile & hwpf) for(lang = 0; lang < NLanguage; lang++) { hwpf.Read2b(&nfonts, 1); - if (!(nfonts > 0 && nfonts < MAXFONTS)) + if (nfonts <= 0 || nfonts >= MAXFONTS) { (void)hwpf.SetState(HWP_InvalidFileFormat); return; diff --git a/hwpfilter/source/hstyle.cxx b/hwpfilter/source/hstyle.cxx index 95f3570d25fd..88aa73b77ab0 100644 --- a/hwpfilter/source/hstyle.cxx +++ b/hwpfilter/source/hstyle.cxx @@ -59,7 +59,7 @@ HWPStyle::~HWPStyle() char *HWPStyle::GetName(int n) const { - if (!(n >= 0 && n < nstyles)) + if (n < 0 || n >= nstyles) return nullptr; return DATA[n].name; } @@ -67,7 +67,7 @@ char *HWPStyle::GetName(int n) const void HWPStyle::SetName(int n, char const *name) { - if (!(n >= 0 && n < nstyles)) + if (n < 0 || n >= nstyles) return; if (name) @@ -90,7 +90,7 @@ void HWPStyle::SetName(int n, char const *name) CharShape *HWPStyle::GetCharShape(int n) const { - if (!(n >= 0 && n < nstyles)) + if (n < 0 || n >= nstyles) return nullptr; return &DATA[n].cshape; } @@ -110,7 +110,7 @@ void HWPStyle::SetCharShape(int n, CharShape const * cshapep) ParaShape *HWPStyle::GetParaShape(int n) const { - if (!(n >= 0 && n < nstyles)) + if (n < 0 || n >= nstyles) return nullptr; return &DATA[n].pshape; } diff --git a/hwpfilter/source/hwpread.cxx b/hwpfilter/source/hwpread.cxx index 12f29a38925e..cbe316787dc0 100644 --- a/hwpfilter/source/hwpread.cxx +++ b/hwpfilter/source/hwpread.cxx @@ -128,7 +128,7 @@ bool Bookmark::Read(HWPFile & hwpf) { return hwpf.SetState(HWP_InvalidFileFormat); } - if (!(hh == dummy && dummy == CH_BOOKMARK)){ + if (hh != dummy || dummy != CH_BOOKMARK) { return hwpf.SetState(HWP_InvalidFileFormat); } @@ -143,7 +143,7 @@ bool DateFormat::Read(HWPFile & hwpf) hwpf.Read2b(format, DATE_SIZE); if (!hwpf.Read2b(dummy)) return false; - if (!(hh == dummy && CH_DATE_FORM == dummy)){ + if (hh != dummy || CH_DATE_FORM != dummy) { return hwpf.SetState(HWP_InvalidFileFormat); } return true; @@ -156,7 +156,7 @@ bool DateCode::Read(HWPFile & hwpf) hwpf.Read2b(date, 6); if (!hwpf.Read2b(dummy)) return false; - if (!(hh == dummy && CH_DATE_CODE == dummy)){ + if (hh != dummy || CH_DATE_CODE != dummy) { return hwpf.SetState(HWP_InvalidFileFormat); } hwpf.AddDateFormat(this); @@ -174,7 +174,7 @@ bool Tab::Read(HWPFile & hwpf) return false; if (!hwpf.Read2b(dummy)) return false; - if (!(hh == dummy && CH_TAB == dummy)){ + if (hh != dummy || CH_TAB != dummy) { return hwpf.SetState(HWP_InvalidFileFormat); } return true; @@ -215,7 +215,7 @@ bool TxtBox::Read(HWPFile & hwpf) hwpf.Read2b(reserved, 2); hwpf.Read2b(&dummy, 1); - if (!(hh == dummy && CH_TEXT_BOX == dummy)){ + if (hh != dummy || CH_TEXT_BOX != dummy) { return hwpf.SetState(HWP_InvalidFileFormat); } hwpf.AddBox(this); @@ -393,7 +393,7 @@ bool Picture::Read(HWPFile & hwpf) hwpf.Read2b(reserved, 2); hwpf.Read2b(&dummy, 1); - if (!(hh == dummy && CH_PICTURE == dummy)) { + if (hh != dummy || CH_PICTURE != dummy) { return hwpf.SetState(HWP_InvalidFileFormat); } hwpf.AddBox(this); @@ -536,7 +536,7 @@ bool Line::Read(HWPFile & hwpf) hwpf.Read2b(reserved, 2); hwpf.Read2b(&dummy, 1); - if (!(hh == dummy && CH_LINE == dummy)){ + if (hh != dummy || CH_LINE != dummy) { return hwpf.SetState(HWP_InvalidFileFormat); } hwpf.AddBox(this); @@ -595,7 +595,7 @@ bool Hidden::Read(HWPFile & hwpf) { hwpf.Read2b(reserved, 2); hwpf.Read2b(&dummy, 1); - if (!(hh == dummy && CH_HIDDEN == dummy)){ + if (hh != dummy || CH_HIDDEN != dummy) { return hwpf.SetState(HWP_InvalidFileFormat); } @@ -620,7 +620,7 @@ bool HeaderFooter::Read(HWPFile & hwpf) { hwpf.Read2b(reserved, 2); hwpf.Read2b(&dummy, 1); - if (!(hh == dummy && CH_HEADER_FOOTER == dummy)){ + if (hh != dummy || CH_HEADER_FOOTER != dummy) { return hwpf.SetState(HWP_InvalidFileFormat); } @@ -652,7 +652,7 @@ bool Footnote::Read(HWPFile & hwpf) { hwpf.Read2b(reserved, 2); hwpf.Read2b(&dummy, 1); - if (!(hh == dummy && CH_FOOTNOTE == dummy)){ + if (hh != dummy || CH_FOOTNOTE != dummy) { return hwpf.SetState(HWP_InvalidFileFormat); } diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx index 916017854364..d0ba9b0abf82 100644 --- a/hwpfilter/source/hwpreader.cxx +++ b/hwpfilter/source/hwpreader.cxx @@ -2467,7 +2467,7 @@ void HwpReader::makeFStyle(FBoxStyle * fstyle) padd("fo:padding", sXML_CDATA, "0cm"); } - if( !(fstyle->boxtype == 'G' && fstyle->cap_len > 0 )) + if( fstyle->boxtype != 'G' || fstyle->cap_len <= 0 ) { padd("fo:margin-left", sXML_CDATA, Double2Str(WTMM(fstyle->margin[0][0]) ) + "mm"); |