Kaydet (Commit) 6eba86ae authored tarafından Noel Grandin's avatar Noel Grandin

clang-tidy misc-redundant-expression

Change-Id: I708b0b486a233071f95592ccdb97f27fc35a23c4
Reviewed-on: https://gerrit.libreoffice.org/61783
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst afed3d17
......@@ -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 );
}
......
......@@ -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 ||
......
......@@ -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 );
......
......@@ -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);
......
......@@ -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.",
......
......@@ -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;
......
......@@ -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);
......
......@@ -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 )
......
......@@ -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;
}
......
......@@ -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 );
......
......@@ -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)
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment