summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-10-12 08:57:55 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-10-15 12:53:38 +0200
commit6eba86ae9d6c8550e069ef933889610aee309381 (patch)
treea9b278f2d124c1db1261bc5128516fff3ea89919
parentafed3d177b8bfbc98d631867f200486bc2963e03 (diff)
clang-tidy misc-redundant-expression
Change-Id: I708b0b486a233071f95592ccdb97f27fc35a23c4 Reviewed-on: https://gerrit.libreoffice.org/61783 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--cui/source/tabpages/chardlg.cxx2
-rw-r--r--i18npool/source/breakiterator/breakiterator_unicode.cxx2
-rw-r--r--package/source/zipapi/ZipFile.cxx4
-rw-r--r--sal/osl/unx/tempfile.cxx2
-rw-r--r--sal/qa/osl/pipe/osl_Pipe.cxx2
-rw-r--r--sc/source/core/tool/address.cxx4
-rw-r--r--sd/source/ui/view/drviews2.cxx2
-rw-r--r--sot/source/sdstor/stgstrms.cxx2
-rw-r--r--starmath/source/utility.cxx2
-rw-r--r--sw/source/core/doc/htmltbl.cxx2
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx2
-rw-r--r--sw/source/ui/fldui/fldvar.cxx2
-rw-r--r--unotools/source/config/searchopt.cxx2
-rw-r--r--vcl/unx/gtk/salnativewidgets-gtk.cxx2
-rw-r--r--vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx2
15 files changed, 17 insertions, 17 deletions
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index eb80b4187fdf..bb12ccb57341 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -1616,7 +1616,7 @@ void SvxCharEffectsPage::SelectHdl_Impl(weld::ComboBox* pBox)
if (m_xEmphasisLB.get() == pBox)
{
auto nEPos = m_xEmphasisLB->get_active();
- bool bEnable = nEPos > 0 && nEPos != -1;
+ bool bEnable = nEPos > 0;
m_xPositionFT->set_sensitive( bEnable );
m_xPositionLB->set_sensitive( bEnable );
}
diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx
index 6c8148fe048a..63178f3a05da 100644
--- a/i18npool/source/breakiterator/breakiterator_unicode.cxx
+++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx
@@ -394,7 +394,7 @@ Boundary SAL_CALL BreakIterator_Unicode::previousWord(const OUString& Text, sal_
Boundary rv;
rv.startPos = icuBI->mpValue->mpBreakIterator->preceding(nStartPos);
- if( rv.startPos < 0 || rv.startPos == icu::BreakIterator::DONE)
+ if( rv.startPos < 0)
rv.endPos = rv.startPos;
else {
if ( (rWordType == WordType::ANYWORD_IGNOREWHITESPACES ||
diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx
index 270a2961b7c1..2e2a6216cb4f 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -824,7 +824,7 @@ sal_Int32 ZipFile::findEND()
try
{
nLength = static_cast <sal_Int32 > (aGrabber.getLength());
- if (nLength == 0 || nLength < ENDHDR)
+ if (nLength < ENDHDR)
return -1;
nPos = nLength - ENDHDR - ZIP_MAXNAMELEN;
nEnd = nPos >= 0 ? nPos : 0 ;
@@ -989,7 +989,7 @@ void ZipFile::recover()
try
{
nLength = aGrabber.getLength();
- if (nLength == 0 || nLength < ENDHDR)
+ if (nLength < ENDHDR)
return;
aGrabber.seek( 0 );
diff --git a/sal/osl/unx/tempfile.cxx b/sal/osl/unx/tempfile.cxx
index 1070dbe0eaa1..b7630cb32f4c 100644
--- a/sal/osl/unx/tempfile.cxx
+++ b/sal/osl/unx/tempfile.cxx
@@ -248,7 +248,7 @@ static oslFileError osl_create_temp_file_impl_(
/* in case of error osl_File_E_EXIST we simply try again else we give up */
- if ((osl_error == osl_File_E_None) || (osl_error != osl_File_E_EXIST))
+ if (osl_error != osl_File_E_EXIST)
{
rtl_uString_release(rand_name);
diff --git a/sal/qa/osl/pipe/osl_Pipe.cxx b/sal/qa/osl/pipe/osl_Pipe.cxx
index 683cbf83f2ce..d50921d4ff8c 100644
--- a/sal/qa/osl/pipe/osl_Pipe.cxx
+++ b/sal/qa/osl/pipe/osl_Pipe.cxx
@@ -441,7 +441,7 @@ namespace osl_Pipe
{
::osl::Pipe aPipe;
aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
- bRes = aPipe == aPipe;
+ bRes = aPipe == aPipe; // NOLINT(misc-redundant-expression)
aPipe.close( );
CPPUNIT_ASSERT_MESSAGE( "#test comment#: test isEqual(), compare itself.",
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index 2e5af33a2eef..650d3553612c 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -491,7 +491,7 @@ const sal_Unicode* ScRange::Parse_XL_Header(
if (*p == '\'')
{
p = parseQuotedName(p, rExternDocName);
- if (!*p || *p != ']' || rExternDocName.isEmpty())
+ if (*p != ']' || rExternDocName.isEmpty())
{
rExternDocName.clear();
return start;
@@ -523,7 +523,7 @@ const sal_Unicode* ScRange::Parse_XL_Header(
// But, more sickness comes with MOOXML as there may be
// '[1]Sheet 4'!$A$1 where [1] is the external doc's index.
p = parseQuotedName(p, rExternDocName);
- if (!*p || *p != '!')
+ if (*p != '!')
{
rExternDocName.clear();
return start;
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index a18a6049059d..ebc67bcd8a81 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -2214,7 +2214,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
{
sal_uInt16 nDepth = pOL->GetDepth(aSel.nEndPara);
//there exists a previous numbering level
- if (nDepth != sal_uInt16(-1) && nDepth < 8)
+ if (nDepth < 8)
{
sal_uInt16 nNewDepth = nDepth+1;
pOL->Insert(SdResId(STR_PRESOBJ_MPOUTLINE_ARY[nNewDepth]), EE_PARA_APPEND, nNewDepth);
diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index 35d99f27751f..9efd318be758 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -1327,7 +1327,7 @@ sal_uInt64 StgTmpStrm::SeekPos(sal_uInt64 n)
assert(n != SAL_MAX_UINT32);
if( n == STREAM_SEEK_TO_END )
n = GetSize();
- if( n && n > THRESHOLD && !m_pStrm )
+ if( n > THRESHOLD && !m_pStrm )
{
SetSize( n );
if( GetError() != ERRCODE_NONE )
diff --git a/starmath/source/utility.cxx b/starmath/source/utility.cxx
index c82b5ec6b7aa..e9cc71eda79f 100644
--- a/starmath/source/utility.cxx
+++ b/starmath/source/utility.cxx
@@ -178,7 +178,7 @@ bool IsItalic( const vcl::Font &rFont )
bool IsBold( const vcl::Font &rFont )
{
FontWeight eWeight = rFont.GetWeight();
- return eWeight != WEIGHT_DONTKNOW && eWeight > WEIGHT_NORMAL;
+ return eWeight > WEIGHT_NORMAL;
}
diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx
index 0fe3775b2b4a..f82d8bb706d3 100644
--- a/sw/source/core/doc/htmltbl.cxx
+++ b/sw/source/core/doc/htmltbl.cxx
@@ -1026,7 +1026,7 @@ void SwHTMLTableLayout::AutoLayoutPass1()
pColumn->SetMax( pColumn->GetMin() );
}
// and divide by the quotient
- SAL_WARN_IF(nQuotMax != ULONG_MAX && !nQuotMax, "sw.core", "Where did the relative columns go?");
+ SAL_WARN_IF(!nQuotMax, "sw.core", "Where did the relative columns go?");
for (i = 0; i < m_nCols; ++i)
{
SwHTMLTableLayoutColumn *pColumn = GetColumn( i );
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 02f90c9123fb..29343e0d092f 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -753,7 +753,7 @@ void SwWW8ImplReader::Read_ANLevelNo( sal_uInt16, const sal_uInt8* pData, short
{
// Range WW:1..9 -> SW:0..8 no bullets / numbering
- if (*pData <= MAXLEVEL && *pData <= 9)
+ if (*pData <= 9)
{
m_nSwNumLevel = *pData - 1;
if (!m_bNoAttrImport)
diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx
index 3886a510694a..4f38ce446a76 100644
--- a/sw/source/ui/fldui/fldvar.cxx
+++ b/sw/source/ui/fldui/fldvar.cxx
@@ -797,7 +797,7 @@ void SwFieldVarPage::FillFormatLB(sal_uInt16 nTypeId)
{
if (!nOldNumFormat && (nNumFormatSel = m_pNumFormatLB->GetEntryPos(sOldNumSel)) != LISTBOX_ENTRY_NOTFOUND)
m_pNumFormatLB->SelectEntryPos(nNumFormatSel);
- else if (nOldNumFormat && nOldNumFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
+ else if (nOldNumFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
m_pNumFormatLB->SelectEntry(sOldSel);
}
diff --git a/unotools/source/config/searchopt.cxx b/unotools/source/config/searchopt.cxx
index 0fc7c168a569..23a2ae93358f 100644
--- a/unotools/source/config/searchopt.cxx
+++ b/unotools/source/config/searchopt.cxx
@@ -240,7 +240,7 @@ bool SvtSearchOptions_Impl::Save()
DBG_ASSERT( nProps == MAX_FLAGS_OFFSET + 1,
"unexpected size of index" );
- if (nProps && nProps == MAX_FLAGS_OFFSET + 1)
+ if (nProps == MAX_FLAGS_OFFSET + 1)
{
for (sal_Int32 i = 0; i < nProps; ++i)
pValue[i] <<= GetFlag(i);
diff --git a/vcl/unx/gtk/salnativewidgets-gtk.cxx b/vcl/unx/gtk/salnativewidgets-gtk.cxx
index 2889535dba05..c95016c712d1 100644
--- a/vcl/unx/gtk/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/salnativewidgets-gtk.cxx
@@ -3997,7 +3997,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
g_object_get( pSettings, "gtk-cursor-blink-time", &blink_time, nullptr );
// set the blink_time if there is a setting and it is reasonable
// else leave the default value
- if( blink_time > 100 && blink_time != gint(STYLE_CURSOR_NOBLINKTIME) )
+ if( blink_time > 100 )
aStyleSet.SetCursorBlinkTime( blink_time/2 );
}
else
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 98aa46f51efc..9f2cf0ea08ba 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -3086,7 +3086,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
g_object_get( pSettings, "gtk-cursor-blink-time", &blink_time, nullptr );
// set the blink_time if there is a setting and it is reasonable
// else leave the default value
- if( blink_time > 100 && blink_time != gint(STYLE_CURSOR_NOBLINKTIME) )
+ if( blink_time > 100 )
aStyleSet.SetCursorBlinkTime( blink_time/2 );
}
else