[Libreoffice-commits] core.git: hwpfilter/source i18npool/source i18nutil/source include/basegfx linguistic/source lotuswordpro/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri May 29 11:46:59 UTC 2020


 hwpfilter/source/hfont.cxx                              |    6 ++--
 hwpfilter/source/hstyle.cxx                             |    8 +++---
 hwpfilter/source/hwpread.cxx                            |   20 ++++++++--------
 hwpfilter/source/hwpreader.cxx                          |    2 -
 i18npool/source/localedata/LocaleNode.cxx               |    2 -
 i18nutil/source/utility/casefolding.cxx                 |    2 -
 include/basegfx/range/basicrange.hxx                    |    2 -
 linguistic/source/hyphdsp.cxx                           |    2 -
 linguistic/source/misc.cxx                              |    2 -
 lotuswordpro/source/filter/LotusWordProImportFilter.cxx |    4 +--
 lotuswordpro/source/filter/lwpsdwfileloader.cxx         |    2 -
 11 files changed, 26 insertions(+), 26 deletions(-)

New commits:
commit 6f6f1680ec35b1616c2fc54e5ee8c3b85edf333b
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri May 29 11:34:54 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri May 29 13:46:26 2020 +0200

    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 at collabora.co.uk>

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");
diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx
index dd23465bea19..ddc8cf46dfd1 100644
--- a/i18npool/source/localedata/LocaleNode.cxx
+++ b/i18npool/source/localedata/LocaleNode.cxx
@@ -235,7 +235,7 @@ void LCInfoNode::generateCode (const OFileWriter &of) const
     if (languageNode)
     {
         aLanguage = languageNode->getChildAt(0)->getValue();
-        if (!(aLanguage.getLength() == 2 || aLanguage.getLength() == 3))
+        if (aLanguage.getLength() != 2 && aLanguage.getLength() != 3)
             incErrorStr( "Error: langID '%s' not 2-3 characters\n", aLanguage);
         of.writeParameter("langID", aLanguage);
         of.writeParameter("langDefaultName", languageNode->getChildAt(1)->getValue());
diff --git a/i18nutil/source/utility/casefolding.cxx b/i18nutil/source/utility/casefolding.cxx
index 57a6a23bc561..94cd9fab1ffc 100644
--- a/i18nutil/source/utility/casefolding.cxx
+++ b/i18nutil/source/utility/casefolding.cxx
@@ -135,7 +135,7 @@ Mapping casefolding::getValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 l
 static bool
 is_ja_voice_sound_mark(sal_Unicode& current, sal_Unicode next)
 {
-        if (!(next == 0x3099 || next == 0x309a))
+        if (next != 0x3099 && next != 0x309a)
             return false;
         sal_Unicode c = widthfolding::getCompositionChar(current, next);
         if (c != 0)
diff --git a/include/basegfx/range/basicrange.hxx b/include/basegfx/range/basicrange.hxx
index 429f31957bcc..99d7b02c0bef 100644
--- a/include/basegfx/range/basicrange.hxx
+++ b/include/basegfx/range/basicrange.hxx
@@ -119,7 +119,7 @@ namespace basegfx
                 }
                 else
                 {
-                    return !((rRange.mnMaximum < mnMinimum) || (rRange.mnMinimum > mnMaximum));
+                    return (rRange.mnMaximum >= mnMinimum) && (rRange.mnMinimum <= mnMaximum);
                 }
             }
         }
diff --git a/linguistic/source/hyphdsp.cxx b/linguistic/source/hyphdsp.cxx
index 6ede806a526e..4ce8d4aa099d 100644
--- a/linguistic/source/hyphdsp.cxx
+++ b/linguistic/source/hyphdsp.cxx
@@ -425,7 +425,7 @@ Reference< XHyphenatedWord > SAL_CALL
     LangSvcEntries_Hyph     *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : nullptr;
 
     bool bWordModified = false;
-    if (!pEntry || !(0 <= nIndex && nIndex <= nWordLen - 2))
+    if (!pEntry || 0 > nIndex || nIndex > nWordLen - 2)
     {
         return nullptr;
     }
diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx
index 87cdb02721c7..8024a3b34437 100644
--- a/linguistic/source/misc.cxx
+++ b/linguistic/source/misc.cxx
@@ -691,7 +691,7 @@ bool IsNumeric( const OUString &rText )
         for(sal_Int32 i = 0; i < nLen; ++i)
         {
             sal_Unicode cChar = rText[ i ];
-            if ( !('0' <= cChar  &&  cChar <= '9') )
+            if ( '0' > cChar  ||  cChar > '9' )
             {
                 bRes = false;
                 break;
diff --git a/lotuswordpro/source/filter/LotusWordProImportFilter.cxx b/lotuswordpro/source/filter/LotusWordProImportFilter.cxx
index 16650de3369a..2c4f92c3e706 100644
--- a/lotuswordpro/source/filter/LotusWordProImportFilter.cxx
+++ b/lotuswordpro/source/filter/LotusWordProImportFilter.cxx
@@ -127,8 +127,8 @@ OUString SAL_CALL LotusWordProImportFilter::detect( css::uno::Sequence< Property
 
     Sequence< ::sal_Int8 > aData;
     sal_Int32 nLen = SAL_N_ELEMENTS( header );
-    if ( !( ( nLen == xInputStream->readBytes( aData, nLen ) )
-                && ( memcmp( static_cast<void const *>(header), static_cast<void const *>(aData.getConstArray()), nLen ) == 0 ) ) )
+    if ( ( nLen != xInputStream->readBytes( aData, nLen ) )
+            || ( memcmp( static_cast<void const *>(header), static_cast<void const *>(aData.getConstArray()), nLen ) != 0 ) )
         sTypeName.clear();
 
     return sTypeName;
diff --git a/lotuswordpro/source/filter/lwpsdwfileloader.cxx b/lotuswordpro/source/filter/lwpsdwfileloader.cxx
index 0c19b3569a5d..68dc4d39a3c6 100644
--- a/lotuswordpro/source/filter/lwpsdwfileloader.cxx
+++ b/lotuswordpro/source/filter/lwpsdwfileloader.cxx
@@ -81,7 +81,7 @@ void LwpSdwFileLoader::CreateDrawObjects(std::vector< rtl::Reference<XFFrame> >*
     unsigned char BinSignature[2];
     m_pStream->ReadBytes(BinSignature, 2);
 
-    if (!(BinSignature[0] == 'S' && BinSignature[1] == 'M'))
+    if (BinSignature[0] != 'S' || BinSignature[1] != 'M')
         return;
 
     unsigned short nVersion;


More information about the Libreoffice-commits mailing list