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 > ...@@ -78,8 +78,8 @@ classname* classname::getImplementation( const uno::Reference< uno::XInterface >
UNO3_GETIMPLEMENTATION_BASE_IMPL(classname)\ UNO3_GETIMPLEMENTATION_BASE_IMPL(classname)\
sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \ sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \
{ \ { \
if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), \ if( rId.getLength() == 16 && memcmp( getUnoTunnelId().getConstArray(), \
rId.getConstArray(), 16 ) ) \ rId.getConstArray(), 16 ) == 0 ) \
{ \ { \
return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); \ 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 > ...@@ -90,8 +90,8 @@ sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >
UNO3_GETIMPLEMENTATION_BASE_IMPL(classname)\ UNO3_GETIMPLEMENTATION_BASE_IMPL(classname)\
sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \ sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \
{ \ { \
if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), \ if( rId.getLength() == 16 && memcmp( getUnoTunnelId().getConstArray(), \
rId.getConstArray(), 16 ) ) \ rId.getConstArray(), 16 ) == 0 ) \
{ \ { \
return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); \ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); \
} \ } \
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#define IMPL_XUNOTUNNEL_MINIMAL( ClassName ) \ #define IMPL_XUNOTUNNEL_MINIMAL( ClassName ) \
sal_Int64 ClassName::getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier ) \ 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)); \ return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_IntPtr >(this)); \
} \ } \
......
...@@ -98,7 +98,7 @@ bool DoClassHeader( RSCHEADER * pHeader, bool bMember ) ...@@ -98,7 +98,7 @@ bool DoClassHeader( RSCHEADER * pHeader, bool bMember )
else else
aCopyInst.pClass = pHeader->pClass; aCopyInst.pClass = pHeader->pClass;
if( TYPE_COPY == pHeader->nTyp ) if( pHeader->nTyp == TYPE_COPY )
{ {
ObjNode * pCopyObj = aCopyInst.pClass->GetObjNode( aName2 ); ObjNode * pCopyObj = aCopyInst.pClass->GetObjNode( aName2 );
...@@ -172,7 +172,7 @@ bool DoClassHeader( RSCHEADER * pHeader, bool bMember ) ...@@ -172,7 +172,7 @@ bool DoClassHeader( RSCHEADER * pHeader, bool bMember )
} }
else if( aError.IsError() ) else if( aError.IsError() )
{ {
if( ERR_CONT_INVALIDTYPE == aError.GetError() ) if( aError.GetError() == ERR_CONT_INVALIDTYPE )
pTC->pEH->Error( aError, S.Top().pClass, aName1, pTC->pEH->Error( aError, S.Top().pClass, aName1,
pHS->getString( pHeader->pClass->GetId() ).getStr() ); pHS->getString( pHeader->pClass->GetId() ).getStr() );
else else
...@@ -187,7 +187,7 @@ bool DoClassHeader( RSCHEADER * pHeader, bool bMember ) ...@@ -187,7 +187,7 @@ bool DoClassHeader( RSCHEADER * pHeader, bool bMember )
S.Push( aTmpI ); S.Push( aTmpI );
} }
} }
if( TYPE_REF == pHeader->nTyp ) if( pHeader->nTyp == TYPE_REF )
{ {
ERRTYPE aError; ERRTYPE aError;
...@@ -391,7 +391,7 @@ resource_definition ...@@ -391,7 +391,7 @@ resource_definition
class_definition class_definition
: class_header class_body : class_header class_body
{ {
if( TYPE_REF == $1.nTyp ) if( $1.nTyp == TYPE_REF )
{ {
pTC->pEH->Error( ERR_REFNOTALLOWED, S.Top().pClass, pTC->pEH->Error( ERR_REFNOTALLOWED, S.Top().pClass,
RscId( $1.nName1 ) ); RscId( $1.nName1 ) );
...@@ -403,9 +403,9 @@ class_definition ...@@ -403,9 +403,9 @@ class_definition
ERRTYPE aError; ERRTYPE aError;
RscId aRscId( $1.nName1 ); 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 ); aError = S.Top().pClass->SetRef( S.Top(), aRscId );
else if( TYPE_COPY == $1.nTyp ) else if( $1.nTyp == TYPE_COPY )
aError = ERR_COPYNOTALLOWED; aError = ERR_COPYNOTALLOWED;
if( aError.IsError() || aError.IsWarning() ) if( aError.IsError() || aError.IsWarning() )
pTC->pEH->Error( aError, S.Top().pClass, aRscId ); pTC->pEH->Error( aError, S.Top().pClass, aRscId );
...@@ -506,7 +506,7 @@ var_definition ...@@ -506,7 +506,7 @@ var_definition
| class_definition ';' | class_definition ';'
| var_header_class class_body ';' | var_header_class class_body ';'
{ {
if( TYPE_REF == $1.nTyp ) if( $1.nTyp == TYPE_REF )
pTC->pEH->Error( ERR_REFNOTALLOWED, S.Top().pClass, pTC->pEH->Error( ERR_REFNOTALLOWED, S.Top().pClass,
RscId( $1.nName1 ) ); RscId( $1.nName1 ) );
...@@ -521,9 +521,9 @@ var_definition ...@@ -521,9 +521,9 @@ var_definition
ERRTYPE aError; ERRTYPE aError;
RscId aRscId( $1.nName1 ); 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 ); aError = S.Top().pClass->SetRef( S.Top(), aRscId );
else if( TYPE_COPY == $1.nTyp ) else if( $1.nTyp == TYPE_COPY )
aError = ERR_COPYNOTALLOWED; aError = ERR_COPYNOTALLOWED;
if( S.Top().pClass->GetCount( S.Top() ) ) if( S.Top().pClass->GetCount( S.Top() ) )
aError = WRN_SUBINMEMBER; aError = WRN_SUBINMEMBER;
...@@ -1011,7 +1011,7 @@ macro_expression ...@@ -1011,7 +1011,7 @@ macro_expression
{ {
if( $1.IsNumber() && $3.IsNumber() ) if( $1.IsNumber() && $3.IsNumber() )
{ {
if( 0 == $3.GetLong() ) if( $3.GetLong() == 0 )
{ {
$$.cType = RSCEXP_EXP; $$.cType = RSCEXP_EXP;
$$.aExp.pExp = new RscExpression( $1, '/', $3 ); $$.aExp.pExp = new RscExpression( $1, '/', $3 );
...@@ -1090,7 +1090,7 @@ id_expression ...@@ -1090,7 +1090,7 @@ id_expression
: id_expression line_number : id_expression line_number
| macro_expression | macro_expression
{ // evaluate pExpession and delete it { // evaluate pExpession and delete it
if( RSCEXP_EXP == $1.cType ) if( $1.cType == RSCEXP_EXP )
{ {
sal_Int32 lValue; 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