diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-05-18 18:09:04 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-05-18 18:09:04 +0200 |
commit | 700e262a4943a6d279cc4800bb9bd173aff0c3e1 (patch) | |
tree | bb19edb2e38a2571bf1a7cf8434ddbc243e97441 | |
parent | c345299186841ccb1fe846f6f277039c188941d6 (diff) |
Some manual loplugin:comparisonwithconstant fixes in macros...
...and other code where the plugin wouldn't rewrite automatically
Change-Id: I84cac6398cd100e9830ef7e1944f32a8af048534
-rw-r--r-- | include/comphelper/servicehelper.hxx | 8 | ||||
-rw-r--r-- | include/toolkit/helper/macros.hxx | 2 | ||||
-rw-r--r-- | rsc/source/parser/rscyacc.y | 22 |
3 files changed, 16 insertions, 16 deletions
diff --git a/include/comphelper/servicehelper.hxx b/include/comphelper/servicehelper.hxx index d1519ed14026..38641e10d7db 100644 --- a/include/comphelper/servicehelper.hxx +++ b/include/comphelper/servicehelper.hxx @@ -78,8 +78,8 @@ classname* classname::getImplementation( const uno::Reference< uno::XInterface > UNO3_GETIMPLEMENTATION_BASE_IMPL(classname)\ sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \ { \ - if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), \ - rId.getConstArray(), 16 ) ) \ + if( rId.getLength() == 16 && memcmp( getUnoTunnelId().getConstArray(), \ + rId.getConstArray(), 16 ) == 0 ) \ { \ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); \ } \ @@ -90,8 +90,8 @@ sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 > UNO3_GETIMPLEMENTATION_BASE_IMPL(classname)\ sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \ { \ - if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), \ - rId.getConstArray(), 16 ) ) \ + if( rId.getLength() == 16 && memcmp( getUnoTunnelId().getConstArray(), \ + rId.getConstArray(), 16 ) == 0 ) \ { \ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); \ } \ diff --git a/include/toolkit/helper/macros.hxx b/include/toolkit/helper/macros.hxx index 0bb97433cbfe..8df7340912b2 100644 --- a/include/toolkit/helper/macros.hxx +++ b/include/toolkit/helper/macros.hxx @@ -27,7 +27,7 @@ #define IMPL_XUNOTUNNEL_MINIMAL( ClassName ) \ sal_Int64 ClassName::getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier ) \ { \ - if( ( rIdentifier.getLength() == 16 ) && ( 0 == memcmp( ClassName::GetUnoTunnelId().getConstArray(), rIdentifier.getConstArray(), 16 ) ) ) \ + if( ( rIdentifier.getLength() == 16 ) && ( memcmp( ClassName::GetUnoTunnelId().getConstArray(), rIdentifier.getConstArray(), 16 ) == 0 ) ) \ { \ return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_IntPtr >(this)); \ } \ diff --git a/rsc/source/parser/rscyacc.y b/rsc/source/parser/rscyacc.y index 6fd4eda414ef..45efad4891d7 100644 --- a/rsc/source/parser/rscyacc.y +++ b/rsc/source/parser/rscyacc.y @@ -98,7 +98,7 @@ bool DoClassHeader( RSCHEADER * pHeader, bool bMember ) else aCopyInst.pClass = pHeader->pClass; - if( TYPE_COPY == pHeader->nTyp ) + if( pHeader->nTyp == TYPE_COPY ) { ObjNode * pCopyObj = aCopyInst.pClass->GetObjNode( aName2 ); @@ -172,7 +172,7 @@ bool DoClassHeader( RSCHEADER * pHeader, bool bMember ) } else if( aError.IsError() ) { - if( ERR_CONT_INVALIDTYPE == aError.GetError() ) + if( aError.GetError() == ERR_CONT_INVALIDTYPE ) pTC->pEH->Error( aError, S.Top().pClass, aName1, pHS->getString( pHeader->pClass->GetId() ).getStr() ); else @@ -187,7 +187,7 @@ bool DoClassHeader( RSCHEADER * pHeader, bool bMember ) S.Push( aTmpI ); } } - if( TYPE_REF == pHeader->nTyp ) + if( pHeader->nTyp == TYPE_REF ) { ERRTYPE aError; @@ -391,7 +391,7 @@ resource_definition class_definition : class_header class_body { - if( TYPE_REF == $1.nTyp ) + if( $1.nTyp == TYPE_REF ) { pTC->pEH->Error( ERR_REFNOTALLOWED, S.Top().pClass, RscId( $1.nName1 ) ); @@ -403,9 +403,9 @@ class_definition ERRTYPE aError; RscId aRscId( $1.nName1 ); - if( TYPE_NOTHING == $1.nTyp && aRscId.IsId() ) + if( $1.nTyp == TYPE_NOTHING && aRscId.IsId() ) aError = S.Top().pClass->SetRef( S.Top(), aRscId ); - else if( TYPE_COPY == $1.nTyp ) + else if( $1.nTyp == TYPE_COPY ) aError = ERR_COPYNOTALLOWED; if( aError.IsError() || aError.IsWarning() ) pTC->pEH->Error( aError, S.Top().pClass, aRscId ); @@ -506,7 +506,7 @@ var_definition | class_definition ';' | var_header_class class_body ';' { - if( TYPE_REF == $1.nTyp ) + if( $1.nTyp == TYPE_REF ) pTC->pEH->Error( ERR_REFNOTALLOWED, S.Top().pClass, RscId( $1.nName1 ) ); @@ -521,9 +521,9 @@ var_definition ERRTYPE aError; RscId aRscId( $1.nName1 ); - if( TYPE_NOTHING == $1.nTyp && aRscId.IsId() ) + if( $1.nTyp == TYPE_NOTHING && aRscId.IsId() ) aError = S.Top().pClass->SetRef( S.Top(), aRscId ); - else if( TYPE_COPY == $1.nTyp ) + else if( $1.nTyp == TYPE_COPY ) aError = ERR_COPYNOTALLOWED; if( S.Top().pClass->GetCount( S.Top() ) ) aError = WRN_SUBINMEMBER; @@ -1011,7 +1011,7 @@ macro_expression { if( $1.IsNumber() && $3.IsNumber() ) { - if( 0 == $3.GetLong() ) + if( $3.GetLong() == 0 ) { $$.cType = RSCEXP_EXP; $$.aExp.pExp = new RscExpression( $1, '/', $3 ); @@ -1090,7 +1090,7 @@ id_expression : id_expression line_number | macro_expression { // evaluate pExpession and delete it - if( RSCEXP_EXP == $1.cType ) + if( $1.cType == RSCEXP_EXP ) { sal_Int32 lValue; |