From f0208db49d59f78c96a30b05e31a226dbde9b084 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Sat, 5 Sep 2015 13:15:15 +0200 Subject: [PATCH] cppcheck: fix some redundantCondition warnings Change-Id: If53d33fb4d9ca9dc1babb9043bd07c5d29fe74c2 Reviewed-on: https://gerrit.libreoffice.org/18353 Reviewed-by: Julien Nabet Tested-by: Julien Nabet --- basic/source/sbx/sbxvalue.cxx | 4 ++-- embedserv/source/inprocserv/dllentry.cxx | 2 +- rsc/source/rscpp/cpp1.c | 3 +-- sc/source/filter/xml/xmlexprt.cxx | 2 +- sw/source/filter/ww8/docxattributeoutput.cxx | 4 ++-- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index 476e4c224345..2103856169b3 100644 --- a/basic/source/sbx/sbxvalue.cxx +++ b/basic/source/sbx/sbxvalue.cxx @@ -956,7 +956,7 @@ bool SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp ) { if( rOp.GetType() == SbxEMPTY ) { - if ( !bVBAInterop || ( bVBAInterop && ( eOp != SbxNOT ) ) ) + if ( !bVBAInterop || ( eOp != SbxNOT ) ) goto Lbl_OpIsEmpty; } if( Get( aL ) ) switch( eOp ) @@ -1185,7 +1185,7 @@ Lbl_OpIsDouble: { if( rOp.GetType() == SbxEMPTY ) { - if ( !bVBAInterop || ( bVBAInterop && ( eOp != SbxNEG ) ) ) + if ( !bVBAInterop || ( eOp != SbxNEG ) ) goto Lbl_OpIsEmpty; } if( Get( aL ) ) diff --git a/embedserv/source/inprocserv/dllentry.cxx b/embedserv/source/inprocserv/dllentry.cxx index e8b955d61aa7..ea5fb5329aba 100644 --- a/embedserv/source/inprocserv/dllentry.cxx +++ b/embedserv/source/inprocserv/dllentry.cxx @@ -105,7 +105,7 @@ namespace { int nGuidLen = GetStringFromClassID( *guidList[nInd], &pSubKey[23], 38 ); BOOL bLocalSuccess = FALSE; - if ( nGuidLen && nGuidLen == 38 ) + if ( nGuidLen == 38 ) { if ( ERROR_SUCCESS == RegOpenKey( HKEY_LOCAL_MACHINE, pSubKey, &hKey ) ) { diff --git a/rsc/source/rscpp/cpp1.c b/rsc/source/rscpp/cpp1.c index d8e20f46d96a..7f4e0799b803 100644 --- a/rsc/source/rscpp/cpp1.c +++ b/rsc/source/rscpp/cpp1.c @@ -557,8 +557,7 @@ void sharp() if (infile->fp != NULL) { name = (infile->progname != NULL) ? infile->progname : infile->filename; - if (sharpfilename == NULL || - (sharpfilename != NULL && !streq(name, sharpfilename))) + if (sharpfilename == NULL || (!streq(name, sharpfilename))) { if (sharpfilename != NULL) free(sharpfilename); diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index f0ad9e026b8d..04a273c8964a 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -3684,7 +3684,7 @@ bool ScXMLExport::IsCellEqual (ScMyCell& aCell1, ScMyCell& aCell2) aCell1.aAreaLink.Compare( aCell2.aAreaLink ) ) || !aCell1.bHasAreaLink ) { - if (!aCell1.bHasAnnotation || (aCell1.bHasAnnotation && false/*IsAnnotationEqual(aCell1.xCell, aCell2.xCell)*/)) // no longer compareable + if (!aCell1.bHasAnnotation) { if ((((aCell1.nStyleIndex == aCell2.nStyleIndex) && (aCell1.bIsAutoStyle == aCell2.bIsAutoStyle)) || ((aCell1.nStyleIndex == aCell2.nStyleIndex) && (aCell1.nStyleIndex == -1))) && diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 48d2cc2e8934..6f9251ef2ca9 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -7270,11 +7270,11 @@ void DocxAttributeOutput::FormatLRSpace( const SvxLRSpaceItem& rLRSpace ) else { FastAttributeList *pLRSpaceAttrList = FastSerializerHelper::createAttrList(); - if((0 != rLRSpace.GetTextLeft()) || ((0 == rLRSpace.GetTextLeft()) && rLRSpace.IsExplicitZeroMarginValLeft())) + if((0 != rLRSpace.GetTextLeft()) || (rLRSpace.IsExplicitZeroMarginValLeft())) { pLRSpaceAttrList->add( FSNS( XML_w, ( bEcma ? XML_left : XML_start ) ), OString::number( rLRSpace.GetTextLeft() ) ); } - if((0 != rLRSpace.GetRight()) || ((0 == rLRSpace.GetRight()) && rLRSpace.IsExplicitZeroMarginValRight())) + if((0 != rLRSpace.GetRight()) || (rLRSpace.IsExplicitZeroMarginValRight())) { pLRSpaceAttrList->add( FSNS( XML_w, ( bEcma ? XML_right : XML_end ) ), OString::number( rLRSpace.GetRight() ) ); }