Kaydet (Commit) 700e262a authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Some manual loplugin:comparisonwithconstant fixes in macros...

...and other code where the plugin wouldn't rewrite automatically

Change-Id: I84cac6398cd100e9830ef7e1944f32a8af048534
üst c3452991
......@@ -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)); \
} \
......
......@@ -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)); \
} \
......
......@@ -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;
......
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