diff options
author | Noel Grandin <noel@peralex.com> | 2016-10-11 08:15:05 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-10-11 08:43:33 +0000 |
commit | d0304a8f57b3fe0065193a2a3f7089f414b1ffd9 (patch) | |
tree | 6ac18f078dc91b56ae7db204028c15089113339c /rsc | |
parent | 52dfb06b194bf890510352a98540c64bc3d44b70 (diff) |
remove some conversion operator methods
which, in these cases, only serve to make the code harder to read
Change-Id: Ic9bcf42545b4fcfd60a535fb63956092d392f469
Reviewed-on: https://gerrit.libreoffice.org/29685
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'rsc')
-rw-r--r-- | rsc/inc/rscclobj.hxx | 2 | ||||
-rw-r--r-- | rsc/inc/rscdef.hxx | 1 | ||||
-rw-r--r-- | rsc/inc/rscerror.h | 4 | ||||
-rw-r--r-- | rsc/source/parser/erscerr.cxx | 8 | ||||
-rw-r--r-- | rsc/source/parser/rsclex.cxx | 2 | ||||
-rw-r--r-- | rsc/source/parser/rscyacc.y | 6 | ||||
-rw-r--r-- | rsc/source/res/rscclobj.cxx | 4 | ||||
-rw-r--r-- | rsc/source/res/rsccont.cxx | 6 | ||||
-rw-r--r-- | rsc/source/res/rscmgr.cxx | 2 | ||||
-rw-r--r-- | rsc/source/res/rscrange.cxx | 2 | ||||
-rw-r--r-- | rsc/source/tools/rscdef.cxx | 5 |
11 files changed, 18 insertions, 24 deletions
diff --git a/rsc/inc/rscclobj.hxx b/rsc/inc/rscclobj.hxx index eeb694f25cb7..7bbc5f1c1f46 100644 --- a/rsc/inc/rscclobj.hxx +++ b/rsc/inc/rscclobj.hxx @@ -42,7 +42,7 @@ public: sal_uLong GetFileKey() const { return lFileKey; }; ObjNode* Search( const RscId &rName ) const //< search the index in the b-tree { - return static_cast<ObjNode *>(IdNode::Search( rName )); + return static_cast<ObjNode *>(IdNode::Search( rName.GetNumber() )); } bool Insert( ObjNode* pTN ) //< insert a new node in the b-tree diff --git a/rsc/inc/rscdef.hxx b/rsc/inc/rscdef.hxx index 279be92cbcf1..c9a2f9e6af45 100644 --- a/rsc/inc/rscdef.hxx +++ b/rsc/inc/rscdef.hxx @@ -103,7 +103,6 @@ public: RscId& operator = ( const RscId& rRscId ); static void SetNames( bool bSet = true ); - operator sal_Int32() const; // returns the number OString GetName() const; // returns the define bool operator < ( const RscId& rRscId ) const; bool operator > ( const RscId& rRscId ) const; diff --git a/rsc/inc/rscerror.h b/rsc/inc/rscerror.h index 758cf967a171..f0f984589d44 100644 --- a/rsc/inc/rscerror.h +++ b/rsc/inc/rscerror.h @@ -93,11 +93,11 @@ public: ERRTYPE( sal_uInt32 nErr ) { nError = nErr; } ERRTYPE( const ERRTYPE & ) = default; ERRTYPE& operator = ( const ERRTYPE & rError ); - operator sal_uInt32() const { return nError; } + sal_uInt32 GetError() const { return nError; } bool IsError() const { return nError <= ERR_ERROREND; } bool IsOk() const { return !IsError(); } bool IsWarning() const { return nError >= ERR_WARNINGSTART && nError <= ERR_WARNINGEND;} - void Clear(){ nError = ERR_OK; } + void Clear() { nError = ERR_OK; } }; // Rsc Error diff --git a/rsc/source/parser/erscerr.cxx b/rsc/source/parser/erscerr.cxx index 30c911965e0d..ce67dfd9c60b 100644 --- a/rsc/source/parser/erscerr.cxx +++ b/rsc/source/parser/erscerr.cxx @@ -72,7 +72,7 @@ void RscError::StdLstErr( const char * pStr ){ void RscError::WriteError( const ERRTYPE& rError, const char * pMessage ) { - switch( rError ) + switch( rError.GetError() ) { case ERR_ERROR: { StdLstErr( "!! " ); @@ -338,7 +338,7 @@ void RscError::ErrorFormat( const ERRTYPE& rError, RscTop * pClass, StdLstErr( "\n" ); } StdLstErr( "f" ); - sprintf( buf, "%u", (unsigned int)rError ); + sprintf( buf, "%u", (unsigned int)rError.GetError() ); StdLstErr( buf ); if( pFI && pTC ){ @@ -375,7 +375,7 @@ void RscError::ErrorFormat( const ERRTYPE& rError, RscTop * pClass, void RscError::Error( const ERRTYPE& rError, RscTop * pClass, const RscId & aId, const char * pMessage ) { - if( WRN_LOCALID == rError ) // ignore warnings + if( WRN_LOCALID == rError.GetError() ) // ignore warnings return; if( rError.IsError() ) nErrors++; @@ -389,7 +389,7 @@ void RscError::Error( const ERRTYPE& rError, RscTop * pClass, void RscError::FatalError( const ERRTYPE& rError, const RscId &aId, const char * pMessage ) { - if( ERR_USAGE != rError ){ + if( ERR_USAGE != rError.GetError() ){ nErrors++; ErrorFormat( rError, nullptr, aId ); WriteError( rError, pMessage ); diff --git a/rsc/source/parser/rsclex.cxx b/rsc/source/parser/rsclex.cxx index a1a32320f77b..5d6040edd235 100644 --- a/rsc/source/parser/rsclex.cxx +++ b/rsc/source/parser/rsclex.cxx @@ -413,7 +413,7 @@ ERRTYPE parser( RscFileInst * pFileInst ) EndParser(); // yyparser returns 0 on success - if( 0 == aError ) + if( 0 == aError.GetError() ) aError.Clear(); if( pFileInst->pTypCont->pEH->nErrors ) aError = ERR_ERROR; diff --git a/rsc/source/parser/rscyacc.y b/rsc/source/parser/rscyacc.y index bf020892ed76..8898f21eb452 100644 --- a/rsc/source/parser/rscyacc.y +++ b/rsc/source/parser/rscyacc.y @@ -172,7 +172,7 @@ bool DoClassHeader( RSCHEADER * pHeader, bool bMember ) { if( S.IsEmpty() ) { - if( (sal_Int32)aName1 < 256 ) + if( aName1.GetNumber() < 256 ) pTC->pEH->Error( WRN_GLOBALID, pHeader->pClass, aName1 ); if( aCopyInst.IsInst() ) @@ -197,7 +197,7 @@ bool DoClassHeader( RSCHEADER * pHeader, bool bMember ) RSCINST aTmpI; ERRTYPE aError; - if( (sal_Int32)aName1 >= 256 && aName1.IsId() ) + if( aName1.GetNumber() >= 256 && aName1.IsId() ) pTC->pEH->Error( WRN_LOCALID, pHeader->pClass, aName1 ); aError = S.Top().pClass->GetElement( S.Top(), aName1, @@ -209,7 +209,7 @@ bool DoClassHeader( RSCHEADER * pHeader, bool bMember ) } else if( aError.IsError() ) { - if( ERR_CONT_INVALIDTYPE == aError ) + if( ERR_CONT_INVALIDTYPE == aError.GetError() ) pTC->pEH->Error( aError, S.Top().pClass, aName1, pHS->getString( pHeader->pClass->GetId() ).getStr() ); else diff --git a/rsc/source/res/rscclobj.cxx b/rsc/source/res/rscclobj.cxx index 993be7fbd285..80969f704553 100644 --- a/rsc/source/res/rscclobj.cxx +++ b/rsc/source/res/rscclobj.cxx @@ -95,14 +95,14 @@ ObjNode * ObjNode::DelObjNode( RscTop * pClass, sal_uLong nFileKey ) sal_uInt32 ObjNode::GetId() const { - return (sal_uInt32)(long)aRscId; + return aRscId.GetNumber(); } bool ObjNode::IsConsistent() { bool bRet = true; - if( (long)aRscId > 0x7FFF || (long)aRscId < 1 ) + if( aRscId.GetNumber() > 0x7FFF || aRscId.GetNumber() < 1 ) { bRet = false; } diff --git a/rsc/source/res/rsccont.cxx b/rsc/source/res/rsccont.cxx index a48767089f0e..1f4ce70df5d0 100644 --- a/rsc/source/res/rsccont.cxx +++ b/rsc/source/res/rsccont.cxx @@ -506,7 +506,7 @@ ERRTYPE RscBaseCont::SetRef( const RSCINST & rInst, const RscId & rRefId ) aError = GetElement( rInst, RscId(), pTypeClass1, RSCINST(), &aTmpI ); aError = aTmpI.pClass->GetRef( aTmpI, &aId ); if( aError.IsOk() ) - aError = aTmpI.pClass->SetNumber( aTmpI, rRefId ); + aError = aTmpI.pClass->SetNumber( aTmpI, rRefId.GetNumber() ); } if( aError.IsError() ) @@ -534,8 +534,8 @@ bool RscBaseCont::IsConsistent( const RSCINST & rInst ) { if( !bNoId ) { - if( (sal_Int32)pClassData->pEntries[ i ].aName > 0x7FFF || - (sal_Int32)pClassData->pEntries[ i ].aName < 1 ) + if( (sal_Int32)pClassData->pEntries[ i ].aName.GetNumber() > 0x7FFF || + (sal_Int32)pClassData->pEntries[ i ].aName.GetNumber() < 1 ) { bRet = false; } diff --git a/rsc/source/res/rscmgr.cxx b/rsc/source/res/rscmgr.cxx index 2de220dca5f1..33f805830718 100644 --- a/rsc/source/res/rscmgr.cxx +++ b/rsc/source/res/rscmgr.cxx @@ -233,7 +233,7 @@ ERRTYPE RscMgr::WriteRcHeader( const RSCINST & rInst, RscWriteRc & rMem, sal_uInt32 nLocalOff; // local offset }; */ - sal_uInt32 nID = rId; + sal_uInt32 nID = rId.GetNumber(); rMem.PutAt( nOldSize, nID ); rMem.PutAt( nOldSize +4, (sal_uInt32)rInst.pClass->GetTypId() ); rMem.PutAt( nOldSize +8, (sal_uInt32)(rMem.Size() - nOldSize) ); diff --git a/rsc/source/res/rscrange.cxx b/rsc/source/res/rscrange.cxx index d243ca8a4be7..1f99bed6b786 100644 --- a/rsc/source/res/rscrange.cxx +++ b/rsc/source/res/rscrange.cxx @@ -345,7 +345,7 @@ ERRTYPE RscIdRange::SetRef( const RSCINST & rInst, const RscId & rRscId ) ERRTYPE aError; if( rRscId.IsId() ) { - aError = SetNumber( rInst, rRscId ); + aError = SetNumber( rInst, rRscId.GetNumber() ); if( aError.IsOk() ) { *reinterpret_cast<RscId *>(rInst.pData) = rRscId; diff --git a/rsc/source/tools/rscdef.cxx b/rsc/source/tools/rscdef.cxx index 0d2595bee4ac..5bf4eae70644 100644 --- a/rsc/source/tools/rscdef.cxx +++ b/rsc/source/tools/rscdef.cxx @@ -99,11 +99,6 @@ bool RscId::operator > ( const RscId& rRscId ) const return GetNumber() > rRscId.GetNumber(); } -RscId::operator sal_Int32() const -{ - return GetNumber(); -} - OString RscId::GetName() const { OStringBuffer aStr; |