diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-01-17 19:00:58 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-01-20 09:06:50 +0100 |
commit | 2e160b1e0e5b28b8a6ddfa07fc6ffff1c6e590bc (patch) | |
tree | 3f7ea1ffcd1102612fc281c3a8aefebb7a52ab1b /rsc | |
parent | 3dade5461b1644899dac694bb348d1bd5b4bea5c (diff) |
Some more loplugin:cstylecast: rsc
Change-Id: If62d142481cb3520042a040325bdd9167ae178e7
Diffstat (limited to 'rsc')
-rw-r--r-- | rsc/inc/rscconst.hxx | 4 | ||||
-rw-r--r-- | rsc/inc/rscrange.hxx | 12 | ||||
-rw-r--r-- | rsc/inc/rscstr.hxx | 4 | ||||
-rw-r--r-- | rsc/inc/rsctools.hxx | 6 | ||||
-rw-r--r-- | rsc/source/parser/rsckey.cxx | 10 | ||||
-rw-r--r-- | rsc/source/res/rscarray.cxx | 22 | ||||
-rw-r--r-- | rsc/source/res/rscclass.cxx | 24 | ||||
-rw-r--r-- | rsc/source/res/rscconst.cxx | 18 | ||||
-rw-r--r-- | rsc/source/res/rsccont.cxx | 48 | ||||
-rw-r--r-- | rsc/source/res/rscflag.cxx | 46 | ||||
-rw-r--r-- | rsc/source/res/rscmgr.cxx | 26 | ||||
-rw-r--r-- | rsc/source/res/rscrange.cxx | 72 | ||||
-rw-r--r-- | rsc/source/res/rscstr.cxx | 56 | ||||
-rw-r--r-- | rsc/source/tools/rsctools.cxx | 13 |
14 files changed, 178 insertions, 183 deletions
diff --git a/rsc/inc/rscconst.hxx b/rsc/inc/rscconst.hxx index a574f951ee72..c6778f24f1ed 100644 --- a/rsc/inc/rscconst.hxx +++ b/rsc/inc/rscconst.hxx @@ -62,11 +62,11 @@ public: virtual void SetToDefault( const RSCINST & rInst ) SAL_OVERRIDE { - ((RscEnumInst*)rInst.pData)->bDflt = true; + reinterpret_cast<RscEnumInst*>(rInst.pData)->bDflt = true; } bool IsDefault( const RSCINST & rInst ) SAL_OVERRIDE { - return( ((RscEnumInst*)rInst.pData)->bDflt ); + return reinterpret_cast<RscEnumInst*>(rInst.pData)->bDflt; }; // Als Default setzen bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) SAL_OVERRIDE; diff --git a/rsc/inc/rscrange.hxx b/rsc/inc/rscrange.hxx index daea501c57dc..738b0f80f9a8 100644 --- a/rsc/inc/rscrange.hxx +++ b/rsc/inc/rscrange.hxx @@ -46,11 +46,11 @@ public: // Eine Zuweisung an eine Variable virtual void SetToDefault( const RSCINST & rInst ) SAL_OVERRIDE { - ((RscRangeInst*)rInst.pData)->bDflt = true; + reinterpret_cast<RscRangeInst*>(rInst.pData)->bDflt = true; } bool IsDefault( const RSCINST & rInst) SAL_OVERRIDE { - return( ((RscRangeInst*)rInst.pData)->bDflt ); + return reinterpret_cast<RscRangeInst*>(rInst.pData)->bDflt; }; // Als Default setzen bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) SAL_OVERRIDE; @@ -84,11 +84,11 @@ public: // Eine Zuweisung an eine Variable virtual void SetToDefault( const RSCINST & rInst ) SAL_OVERRIDE { - ((RscLongRangeInst*)rInst.pData)->bDflt = true; + reinterpret_cast<RscLongRangeInst*>(rInst.pData)->bDflt = true; } bool IsDefault( const RSCINST & rInst) SAL_OVERRIDE { - return( ((RscLongRangeInst*)rInst.pData)->bDflt ); + return reinterpret_cast<RscLongRangeInst*>(rInst.pData)->bDflt; }; // Als Default setzen bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) SAL_OVERRIDE; @@ -131,12 +131,12 @@ public: sal_uInt32 Size() SAL_OVERRIDE { return nSize; } virtual void SetToDefault( const RSCINST & rInst ) SAL_OVERRIDE { - ((RscId*)rInst.pData)->aExp.cUnused = true; + reinterpret_cast<RscId*>(rInst.pData)->aExp.cUnused = true; } bool IsDefault( const RSCINST & rInst) SAL_OVERRIDE { //cUnused wird fuer Defaultkennung verwendet - return ((RscId*)rInst.pData)->aExp.cUnused; + return reinterpret_cast<RscId*>(rInst.pData)->aExp.cUnused; } // Als Default setzen bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) SAL_OVERRIDE; diff --git a/rsc/inc/rscstr.hxx b/rsc/inc/rscstr.hxx index 2b8ba770783d..e359d8ee0167 100644 --- a/rsc/inc/rscstr.hxx +++ b/rsc/inc/rscstr.hxx @@ -45,11 +45,11 @@ public: sal_uInt32 Size() SAL_OVERRIDE { return nSize; } void SetToDefault( const RSCINST & rInst ) SAL_OVERRIDE { - ((RscStringInst*)rInst.pData)->bDflt = true; + reinterpret_cast<RscStringInst*>(rInst.pData)->bDflt = true; } bool IsDefault( const RSCINST & rInst) SAL_OVERRIDE { - return ((RscStringInst*)rInst.pData)->bDflt; + return reinterpret_cast<RscStringInst*>(rInst.pData)->bDflt; } // Als Default setzen bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) SAL_OVERRIDE; diff --git a/rsc/inc/rsctools.hxx b/rsc/inc/rsctools.hxx index e8d71fd541dd..e7cde4a8aa84 100644 --- a/rsc/inc/rsctools.hxx +++ b/rsc/inc/rsctools.hxx @@ -101,7 +101,7 @@ public: { sal_uInt16 nVal = 0; char* pFrom = GetPointer(nPos); - char* pTo = (char*)&nVal; + char* pTo = reinterpret_cast<char*>(&nVal); *pTo++ = *pFrom++; *pTo++ = *pFrom++; return bSwap ? OSL_SWAPWORD( nVal ) : nVal; @@ -110,7 +110,7 @@ public: { sal_uInt32 nVal = 0; char* pFrom = GetPointer(nPos); - char* pTo = (char*)&nVal; + char* pTo = reinterpret_cast<char*>(&nVal); *pTo++ = *pFrom++; *pTo++ = *pFrom++; *pTo++ = *pFrom++; @@ -204,7 +204,7 @@ public: if( bSwap ) nVal = OSL_SWAPWORD( nVal ); char* pTo = GetPointer( nPos ); - char* pFrom = (char*)&nVal; + char* pFrom = reinterpret_cast<char*>(&nVal); *pTo++ = *pFrom++; *pTo++ = *pFrom++; } diff --git a/rsc/source/parser/rsckey.cxx b/rsc/source/parser/rsckey.cxx index 94b14e014f80..ef3488e4fb98 100644 --- a/rsc/source/parser/rsckey.cxx +++ b/rsc/source/parser/rsckey.cxx @@ -118,13 +118,9 @@ bool RscNameTable::Get( Atom nName, KEY_STRUCT * pEle ) { // Suche nach dem Schluesselwort aSearchName.nName = nName; - pKey = (KEY_STRUCT *)bsearch( -#ifdef UNX - (const char *) &aSearchName, (char *)pTable, -#else - (const void *) &aSearchName, (const void *)pTable, -#endif - nEntries, sizeof( KEY_STRUCT ), KeyCompare ); + pKey = reinterpret_cast<KEY_STRUCT *>(bsearch( + &aSearchName, pTable, + nEntries, sizeof( KEY_STRUCT ), KeyCompare )); } else { diff --git a/rsc/source/res/rscarray.cxx b/rsc/source/res/rscarray.cxx index 75ab08bff8f8..3e7c70a9b63c 100644 --- a/rsc/source/res/rscarray.cxx +++ b/rsc/source/res/rscarray.cxx @@ -104,13 +104,13 @@ RSCINST RscArray::Create( RSCINST * pInst, const RSCINST & rDflt, RscTop::Create( &aInst, rDflt, bOwnClass ); - pClassData = (RscArrayInst *)(aInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscArrayInst *>(aInst.pData + nOffInstData); pClassData->pNode = NULL; if( bOwnClass ) { RscArrayInst * pDfltClassData; - pDfltClassData = (RscArrayInst *)(rDflt.pData + nOffInstData); + pDfltClassData = reinterpret_cast<RscArrayInst *>(rDflt.pData + nOffInstData); pClassData->pNode = ::Create( pDfltClassData->pNode ); } @@ -133,7 +133,7 @@ void RscArray::Destroy( const RSCINST & rInst ) RscTop::Destroy( rInst ); - pClassData = (RscArrayInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscArrayInst *>(rInst.pData + nOffInstData); //Baum rekursiv loeschen ::Destroy( pClassData->pNode ); @@ -147,7 +147,7 @@ ERRTYPE RscArray::GetValueEle( const RSCINST & rInst, RscArrayInst * pClassData; RscInstNode * pNode; - pClassData = (RscArrayInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscArrayInst *>(rInst.pData + nOffInstData); ERRTYPE aError; @@ -217,7 +217,7 @@ bool RscArray::IsConsistent( const RSCINST & rInst ) bRet = RscTop::IsConsistent( rInst ); - pClassData = (RscArrayInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscArrayInst *>(rInst.pData + nOffInstData); if( !::IsConsistent( pClassData->pNode ) ) bRet = false; @@ -238,7 +238,7 @@ void RscArray::SetToDefault( const RSCINST & rInst ) { RscArrayInst * pClassData; - pClassData = (RscArrayInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscArrayInst *>(rInst.pData + nOffInstData); ::SetToDefault( pClassData->pNode ); @@ -264,7 +264,7 @@ bool RscArray::IsDefault( const RSCINST & rInst ) { RscArrayInst * pClassData; - pClassData = (RscArrayInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscArrayInst *>(rInst.pData + nOffInstData); bool bRet = ::IsDefault( pClassData->pNode ); @@ -294,7 +294,7 @@ bool RscArray::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) if( bRet ) { - RscArrayInst * pClassData = (RscArrayInst *)(rInst.pData + nOffInstData); + RscArrayInst * pClassData = reinterpret_cast<RscArrayInst *>(rInst.pData + nOffInstData); bRet = ::IsValueDefault( pClassData->pNode, pDef ); } @@ -307,7 +307,7 @@ void RscArray::WriteSrcHeader( const RSCINST & rInst, FILE * fOutput, { RscArrayInst * pClassData; - pClassData = (RscArrayInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscArrayInst *>(rInst.pData + nOffInstData); if( pTC->IsSrsDefault() ) { // nur einen Wert schreiben @@ -374,7 +374,7 @@ void RscArray::WriteSrcArray( const RSCINST & rInst, FILE * fOutput, { RscArrayInst * pClassData; - pClassData = (RscArrayInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscArrayInst *>(rInst.pData + nOffInstData); ::WriteSrc( pClassData->pNode, fOutput, pTC, nTab, pVarName, rInst.pData, pTypeClass ); @@ -394,7 +394,7 @@ ERRTYPE RscArray::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, RscArrayInst * pClassData; RscInstNode * pNode = NULL; - pClassData = (RscArrayInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscArrayInst *>(rInst.pData + nOffInstData); if( pClassData->pNode ) { diff --git a/rsc/source/res/rscclass.cxx b/rsc/source/res/rscclass.cxx index be6fd38aea5f..4c50c2eb6657 100644 --- a/rsc/source/res/rscclass.cxx +++ b/rsc/source/res/rscclass.cxx @@ -100,9 +100,9 @@ RSCINST RscClass::GetInstData else if( VAR_POINTER & pVarTypeList[ nEle ].nVarType ) { if( VAR_EXTENDABLE & pVarTypeList[ nEle ].nVarType ) - aInst = *(RSCINST *) (pData + pVarTypeList[ nEle ].nOffset); + aInst = *reinterpret_cast<RSCINST *>(pData + pVarTypeList[ nEle ].nOffset); else - aInst.pData = *(CLASS_DATA *) (pData + pVarTypeList[ nEle ].nOffset); + aInst.pData = *reinterpret_cast<CLASS_DATA *>(pData + pVarTypeList[ nEle ].nOffset); } else aInst.pData = pData + pVarTypeList[ nEle ].nOffset; @@ -122,7 +122,7 @@ void RscClass::SetVarDflt( CLASS_DATA pData, sal_uInt32 nEle, bool bSet ) { RscClassInst * pClass; - pClass = (RscClassInst *)(pData + nSuperSize ); + pClass = reinterpret_cast<RscClassInst *>(pData + nSuperSize ); if( bSet ) pClass->nVarDflt |= ((sal_uLong)1 << nEle); else @@ -133,7 +133,7 @@ bool RscClass::IsDflt( CLASS_DATA pData, sal_uInt32 nEle ) { RscClassInst * pClass; - pClass = (RscClassInst *)(pData + nSuperSize ); + pClass = reinterpret_cast<RscClassInst *>(pData + nSuperSize ); return pClass->nVarDflt & ((sal_uLong)1 << nEle); } @@ -159,10 +159,10 @@ RSCINST RscClass::Create( RSCINST * pInst, RscTop::Create( &aInst, rDflt, bOwnClass ); if( bOwnClass ) - ((RscClassInst *)(aInst.pData + nSuperSize))->nVarDflt = - ((RscClassInst *)(rDflt.pData + nSuperSize))->nVarDflt; + reinterpret_cast<RscClassInst *>(aInst.pData + nSuperSize)->nVarDflt = + reinterpret_cast<RscClassInst *>(rDflt.pData + nSuperSize)->nVarDflt; else - ((RscClassInst *)(aInst.pData + nSuperSize))->nVarDflt = ~((sal_uLong)0); + reinterpret_cast<RscClassInst *>(aInst.pData + nSuperSize)->nVarDflt = ~((sal_uLong)0); for( i = 0; i < nEntries; i++ ) { @@ -174,12 +174,12 @@ RSCINST RscClass::Create( RSCINST * pInst, CLASS_DATA * ppData; if( VAR_EXTENDABLE & pVarTypeList[ i ].nVarType ) { - RSCINST * pInstance = (RSCINST *) (aInst.pData + pVarTypeList[ i ].nOffset ); + RSCINST * pInstance = reinterpret_cast<RSCINST *>(aInst.pData + pVarTypeList[ i ].nOffset ); pInstance->pClass = pVarTypeList[ i ].pClass; ppData = &pInstance->pData; } else - ppData = (CLASS_DATA* ) (aInst.pData + pVarTypeList[ i ].nOffset ); + ppData = reinterpret_cast<CLASS_DATA*>(aInst.pData + pVarTypeList[ i ].nOffset ); *ppData = NULL; if( aDfltI.IsInst() ) @@ -335,7 +335,7 @@ RSCINST RscClass::GetVariable( const RSCINST & rInst, { // Wird ueber Zeiger angegeben if( VAR_EXTENDABLE & pVarTypeList[ i ].nVarType ) { - RSCINST * pInst = (RSCINST *) + RSCINST * pInst = reinterpret_cast<RSCINST *> (rInst.pData + pVarTypeList[ i ].nOffset ); if( pCreateClass && pCreateClass->InHierarchy( aTmpI.pClass ) ) *pInst = pCreateClass->Create( NULL, aDefInst ); @@ -346,7 +346,7 @@ RSCINST RscClass::GetVariable( const RSCINST & rInst, else { CLASS_DATA * ppData - = (CLASS_DATA *)(rInst.pData + pVarTypeList[ i ].nOffset); + = reinterpret_cast<CLASS_DATA *>(rInst.pData + pVarTypeList[ i ].nOffset); aTmpI = aTmpI.pClass->Create( NULL, aDefInst ); *ppData = aTmpI.pData; } @@ -423,7 +423,7 @@ void RscClass::SetToDefault( const RSCINST & rInst ) RSCINST aTmpI; RscClassInst * pClass; - pClass = (RscClassInst *)(rInst.pData + nSuperSize ); + pClass = reinterpret_cast<RscClassInst *>(rInst.pData + nSuperSize ); for( i = 0; i < nEntries; i++ ) { diff --git a/rsc/source/res/rscconst.cxx b/rsc/source/res/rscconst.cxx index 562a2ba64aaa..d8273dd89c44 100644 --- a/rsc/source/res/rscconst.cxx +++ b/rsc/source/res/rscconst.cxx @@ -120,8 +120,8 @@ ERRTYPE RscEnum::SetConst( const RSCINST & rInst, Atom nConst, sal_Int32 /*nVal* if( nEntries != (i = GetConstPos( nConst )) ) { - ((RscEnumInst *)rInst.pData)->nValue = i; - ((RscEnumInst *)rInst.pData)->bDflt = false; + reinterpret_cast<RscEnumInst *>(rInst.pData)->nValue = i; + reinterpret_cast<RscEnumInst *>(rInst.pData)->bDflt = false; return ERR_OK; } @@ -143,12 +143,12 @@ ERRTYPE RscEnum::SetNumber( const RSCINST & rInst, sal_Int32 lValue ) ERRTYPE RscEnum::GetConst( const RSCINST & rInst, Atom * pH ) { - *pH = pVarArray[ ((RscEnumInst *)rInst.pData)->nValue ].nId; + *pH = pVarArray[ reinterpret_cast<RscEnumInst *>(rInst.pData)->nValue ].nId; return ERR_OK; } ERRTYPE RscEnum::GetNumber( const RSCINST & rInst, sal_Int32 * pNumber ){ - *pNumber = pVarArray[ ((RscEnumInst *)rInst.pData)->nValue ].lValue; + *pNumber = pVarArray[ reinterpret_cast<RscEnumInst *>(rInst.pData)->nValue ].lValue; return ERR_OK; } @@ -172,8 +172,8 @@ RSCINST RscEnum::Create( RSCINST * pInst, const RSCINST & rDflt, bool bOwnClass memmove( aInst.pData, rDflt.pData, Size() ); else { - ((RscEnumInst *)aInst.pData)->nValue = 0; - ((RscEnumInst *)aInst.pData)->bDflt = true; + reinterpret_cast<RscEnumInst *>(aInst.pData)->nValue = 0; + reinterpret_cast<RscEnumInst *>(aInst.pData)->bDflt = true; } return aInst; @@ -181,20 +181,20 @@ RSCINST RscEnum::Create( RSCINST * pInst, const RSCINST & rDflt, bool bOwnClass bool RscEnum::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) { - return pDef && (((RscEnumInst*)rInst.pData)->nValue == ((RscEnumInst*)pDef)->nValue ); + return pDef && (reinterpret_cast<RscEnumInst*>(rInst.pData)->nValue == reinterpret_cast<RscEnumInst*>(pDef)->nValue ); } void RscEnum::WriteSrc( const RSCINST & rInst, FILE * fOutput, RscTypCont *, sal_uInt32, const char * ) { fprintf( fOutput, "%s", - pHS->getString( pVarArray[ ((RscEnumInst *)rInst.pData)->nValue ].nId ).getStr() ); + pHS->getString( pVarArray[ reinterpret_cast<RscEnumInst *>(rInst.pData)->nValue ].nId ).getStr() ); } ERRTYPE RscEnum::WriteRc( const RSCINST & rInst, RscWriteRc & aMem, RscTypCont *, sal_uInt32, bool ) { - aMem.Put( (sal_Int32)pVarArray[ ((RscEnumInst *)rInst.pData)->nValue ].lValue ); + aMem.Put( (sal_Int32)pVarArray[ reinterpret_cast<RscEnumInst *>(rInst.pData)->nValue ].lValue ); return ERR_OK; } diff --git a/rsc/source/res/rsccont.cxx b/rsc/source/res/rsccont.cxx index 926aa969f3b6..03730eeaa07f 100644 --- a/rsc/source/res/rsccont.cxx +++ b/rsc/source/res/rsccont.cxx @@ -89,7 +89,7 @@ RSCINST RscBaseCont::Create( RSCINST * pInst, const RSCINST & rDflt, RscTop::Create( &aInst, rDflt, bOwnClass ); - pClassData = (RscBaseContInst *)(aInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscBaseContInst *>(aInst.pData + nOffInstData); pClassData->nEntries = 0; pClassData->pEntries = NULL; pClassData->bDflt = true; @@ -99,7 +99,7 @@ RSCINST RscBaseCont::Create( RSCINST * pInst, const RSCINST & rDflt, RscBaseContInst * pDfltClassData; RSCINST aDfltI; - pDfltClassData = (RscBaseContInst *)(rDflt.pData + nOffInstData); + pDfltClassData = reinterpret_cast<RscBaseContInst *>(rDflt.pData + nOffInstData); if( 0 != pDfltClassData->nEntries ) { @@ -128,7 +128,7 @@ void RscBaseCont::Destroy( const RSCINST & rInst ) RscTop::Destroy( rInst); - pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData); DestroyElements( pClassData ); } @@ -137,7 +137,7 @@ RSCINST RscBaseCont::SearchElePos( const RSCINST & rInst, const RscId & rEleName { RscBaseContInst * pClassData; - pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData); if( !pClass ) pClass = pTypeClass; @@ -172,7 +172,7 @@ ERRTYPE RscBaseCont::GetElement( const RSCINST & rInst, const RscId & rEleName, if( !bNoId && !rEleName.IsId() ) aError = WRN_CONT_NOID; - pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData); if( pCreateClass ) { @@ -250,7 +250,7 @@ sal_uInt32 RscBaseCont::GetCount( const RSCINST & rInst ) { RscBaseContInst * pClassData; - pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData); return pClassData->nEntries; } @@ -258,7 +258,7 @@ RSCINST RscBaseCont::GetPosEle( const RSCINST & rInst, sal_uInt32 nPos ) { RscBaseContInst * pClassData; - pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData); if( nPos < pClassData->nEntries ) return( pClassData->pEntries[ nPos ].aInst ); @@ -271,7 +271,7 @@ ERRTYPE RscBaseCont::MovePosEle( const RSCINST & rInst, sal_uInt32 nDestPos, ERRTYPE aError; RscBaseContInst * pClassData; - pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData); if( (nDestPos < pClassData->nEntries) && (nSourcePos < pClassData->nEntries) ) { @@ -304,7 +304,7 @@ ERRTYPE RscBaseCont::SetPosRscId( const RSCINST & rInst, sal_uInt32 nPos, RSCINST aTmpI; ERRTYPE aError; - pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData); if( nPos < pClassData->nEntries ) { @@ -327,7 +327,7 @@ SUBINFO_STRUCT RscBaseCont::GetInfoEle( const RSCINST & rInst, sal_uInt32 nPos ) RscBaseContInst * pClassData; SUBINFO_STRUCT aInfo; - pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData); if( nPos < pClassData->nEntries ) { @@ -345,7 +345,7 @@ ERRTYPE RscBaseCont::SetString( const RSCINST & rInst, const char * pStr ) ERRTYPE aError; char *pTmpStr; - pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData); // otherwise infinite recursion is possible if( RSC_NOTYPE == pTypeClass->GetTypId() ) @@ -381,7 +381,7 @@ ERRTYPE RscBaseCont::SetNumber( const RSCINST & rInst, sal_Int32 lValue ) ERRTYPE aError; sal_Int32 lNumber; - pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData); // otherwise infinite recursion is possible if( RSC_NOTYPE == pTypeClass->GetTypId() ) @@ -417,7 +417,7 @@ ERRTYPE RscBaseCont::SetBool( const RSCINST & rInst, ERRTYPE aError; bool bBool; - pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData); // otherwise infinite recursion is possible if( RSC_NOTYPE == pTypeClass->GetTypId() ) @@ -455,7 +455,7 @@ ERRTYPE RscBaseCont::SetConst( const RSCINST & rInst, ERRTYPE aError; Atom nConst; - pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData); // otherwise infinite recursion is possible if( RSC_NOTYPE == pTypeClass->GetTypId() ) @@ -491,7 +491,7 @@ ERRTYPE RscBaseCont::SetRef( const RSCINST & rInst, const RscId & rRefId ) ERRTYPE aError; RscId aId; - pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData); // otherwise infinite recursion is possible if( RSC_NOTYPE == pTypeClass->GetTypId() ) @@ -528,7 +528,7 @@ bool RscBaseCont::IsConsistent( const RSCINST & rInst ) bRet = RscTop::IsConsistent( rInst ); - pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData); // auf doppelten Id Testen und Reihenfolge beibehalten // Komplexitaet = n^2 / 2 @@ -562,7 +562,7 @@ void RscBaseCont::SetToDefault( const RSCINST & rInst ) sal_uInt32 i = 0; RscBaseContInst * pClassData; - pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData); for( i = 0; i < pClassData->nEntries; i++ ) { @@ -578,7 +578,7 @@ bool RscBaseCont::IsDefault( const RSCINST & rInst ) sal_uInt32 i = 0; RscBaseContInst * pClassData; - pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData); if( !pClassData->bDflt ) return false; @@ -602,7 +602,7 @@ bool RscBaseCont::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) if( !RscTop::IsValueDefault( rInst, pDef ) ) return false; - pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData); if( pClassData->nEntries ) return false; @@ -616,7 +616,7 @@ void RscBaseCont::Delete( const RSCINST & rInst, RscTop * pClass, sal_uInt32 i = 0; RscBaseContInst * pClassData; - pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData); if( !pClass ) pClass = pTypeClass; @@ -638,7 +638,7 @@ void RscBaseCont::DeletePos( const RSCINST & rInst, sal_uInt32 nPos ) { RscBaseContInst * pClassData; - pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData); if( nPos < pClassData->nEntries ) { @@ -663,7 +663,7 @@ void RscBaseCont::ContWriteSrc( const RSCINST & rInst, FILE * fOutput, sal_uInt32 i = 0, t = 0; RscBaseContInst * pClassData; - pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData); for( i = 0; i < pClassData->nEntries; i++ ) { @@ -686,7 +686,7 @@ ERRTYPE RscBaseCont::ContWriteRc( const RSCINST & rInst, RscWriteRc & rMem, if( bExtra || bNoId ) { // Nur Subresourcen schreiben, wenn bExtra == true - pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData); for (sal_uInt32 i = 0; i < pClassData->nEntries && aError.IsOk(); i++ ) { @@ -762,7 +762,7 @@ ERRTYPE RscCont::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, aError = RscTop::WriteRc( rInst, rMem, pTC, nDeep, bExtra ); - pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + pClassData = reinterpret_cast<RscBaseContInst *>(rInst.pData + nOffInstData); rMem.Put( pClassData->nEntries ); diff --git a/rsc/source/res/rscflag.cxx b/rsc/source/res/rscflag.cxx index fa65c6ebc8f2..d78a6df8bcd6 100644 --- a/rsc/source/res/rscflag.cxx +++ b/rsc/source/res/rscflag.cxx @@ -44,8 +44,8 @@ ERRTYPE RscFlag::SetNotConst( const RSCINST & rInst, Atom nConst ) sal_uInt32 nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) ); i = i / (sizeof( sal_uInt32 ) * 8); - ((RscFlagInst *)rInst.pData)[ i ].nFlags &= ~nFlag; - ((RscFlagInst *)rInst.pData)[ i ].nDfltFlags &= ~nFlag; + reinterpret_cast<RscFlagInst *>(rInst.pData)[ i ].nFlags &= ~nFlag; + reinterpret_cast<RscFlagInst *>(rInst.pData)[ i ].nDfltFlags &= ~nFlag; return ERR_OK; } @@ -61,8 +61,8 @@ ERRTYPE RscFlag::SetConst( const RSCINST & rInst, Atom nConst, sal_Int32 /*nVal* sal_uInt32 nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) ); i = i / (sizeof( sal_uInt32 ) * 8); - ((RscFlagInst *)rInst.pData)[ i ].nFlags |= nFlag; - ((RscFlagInst *)rInst.pData)[ i ].nDfltFlags &= ~nFlag; + reinterpret_cast<RscFlagInst *>(rInst.pData)[ i ].nFlags |= nFlag; + reinterpret_cast<RscFlagInst *>(rInst.pData)[ i ].nDfltFlags &= ~nFlag; return ERR_OK; } @@ -97,8 +97,8 @@ RSCINST RscFlag::Create( RSCINST * pInst, const RSCINST & rDflt, bool bOwnClass { for( sal_uInt32 i = 0; i < Size() / sizeof( RscFlagInst ); i++ ) { - ((RscFlagInst *)aInst.pData)[ i ].nFlags = 0; - ((RscFlagInst *)aInst.pData)[ i ].nDfltFlags = 0xFFFFFFFF; + reinterpret_cast<RscFlagInst *>(aInst.pData)[ i ].nFlags = 0; + reinterpret_cast<RscFlagInst *>(aInst.pData)[ i ].nDfltFlags = 0xFFFFFFFF; } } @@ -120,15 +120,15 @@ RSCINST RscFlag::CreateClient( RSCINST * pInst, const RSCINST & rDfltI, i = i / (sizeof( sal_uInt32 ) * 8); if( bOwnClass ) { - ((RscFlagInst *)aInst.pData)[ i ].nFlags &= - ~nFlag | ((RscFlagInst *)rDfltI.pData)[ i ].nFlags; - ((RscFlagInst *)aInst.pData)[ i ].nDfltFlags &= - ~nFlag | ((RscFlagInst *)rDfltI.pData)[ i ].nDfltFlags; + reinterpret_cast<RscFlagInst *>(aInst.pData)[ i ].nFlags &= + ~nFlag | reinterpret_cast<RscFlagInst *>(rDfltI.pData)[ i ].nFlags; + reinterpret_cast<RscFlagInst *>(aInst.pData)[ i ].nDfltFlags &= + ~nFlag | reinterpret_cast<RscFlagInst *>(rDfltI.pData)[ i ].nDfltFlags; } else { - ((RscFlagInst *)aInst.pData)[ i ].nFlags &= ~nFlag; - ((RscFlagInst *)aInst.pData)[ i ].nDfltFlags |= nFlag; + reinterpret_cast<RscFlagInst *>(aInst.pData)[ i ].nFlags &= ~nFlag; + reinterpret_cast<RscFlagInst *>(aInst.pData)[ i ].nDfltFlags |= nFlag; } } @@ -140,7 +140,7 @@ void RscFlag::SetToDefault( const RSCINST & rInst ) sal_uInt32 i = 0; for( i = 0; i < Size() / sizeof( RscFlagInst ); i++ ) - ((RscFlagInst *)rInst.pData)[ i ].nDfltFlags = 0xFFFFFFFF; + reinterpret_cast<RscFlagInst *>(rInst.pData)[ i ].nDfltFlags = 0xFFFFFFFF; } bool RscFlag::IsDefault( const RSCINST & rInst ) @@ -149,7 +149,7 @@ bool RscFlag::IsDefault( const RSCINST & rInst ) for( i = 0; i < Size() / sizeof( RscFlagInst ); i++ ) { - if( ((RscFlagInst *)rInst.pData)[ i ].nDfltFlags != 0xFFFFFFFF ) + if( reinterpret_cast<RscFlagInst *>(rInst.pData)[ i ].nDfltFlags != 0xFFFFFFFF ) return false; } return true; @@ -164,7 +164,7 @@ bool RscFlag::IsDefault( const RSCINST & rInst, Atom nConstId ) nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) ); i = i / (sizeof( sal_uInt32 ) * 8); - if( ((RscFlagInst *)rInst.pData)[ i ].nDfltFlags & nFlag ) + if( reinterpret_cast<RscFlagInst *>(rInst.pData)[ i ].nDfltFlags & nFlag ) return true ; else return false; @@ -184,8 +184,8 @@ bool RscFlag::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef, if( pDef ) { - if( (((RscFlagInst *)rInst.pData)[ i ].nFlags & nFlag) == - (((RscFlagInst *)pDef)[ i ].nFlags & nFlag) ) + if( (reinterpret_cast<RscFlagInst *>(rInst.pData)[ i ].nFlags & nFlag) == + (reinterpret_cast<RscFlagInst *>(pDef)[ i ].nFlags & nFlag) ) { return true; } @@ -206,8 +206,8 @@ bool RscFlag::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) { nIndex = i / (sizeof( sal_uInt32 ) * 8); - if( (((RscFlagInst *)rInst.pData)[ nIndex ].nFlags & Flag) != - (((RscFlagInst *)pDef)[ nIndex ].nFlags & Flag) ) + if( (reinterpret_cast<RscFlagInst *>(rInst.pData)[ nIndex ].nFlags & Flag) != + (reinterpret_cast<RscFlagInst *>(pDef)[ nIndex ].nFlags & Flag) ) { return false; } @@ -231,7 +231,7 @@ bool RscFlag::IsSet( const RSCINST & rInst, Atom nConstId ) nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) ); i = i / (sizeof( sal_uInt32 ) * 8); - if( ((RscFlagInst *)rInst.pData)[ i ].nFlags & nFlag ) + if( reinterpret_cast<RscFlagInst *>(rInst.pData)[ i ].nFlags & nFlag ) return true; else return false; @@ -249,12 +249,12 @@ void RscFlag::WriteSrc( const RSCINST & rInst, FILE * fOutput, for( i = 0; i < nEntries; i++ ) { nIndex = i / (sizeof( sal_uInt32 ) * 8); - if( !( ((RscFlagInst *)rInst.pData)[ nIndex ].nDfltFlags & Flag) ) + if( !( reinterpret_cast<RscFlagInst *>(rInst.pData)[ nIndex ].nDfltFlags & Flag) ) { if( bComma ) fprintf( fOutput, ", " ); - if( ((RscFlagInst *)rInst.pData)[ nIndex ].nFlags & Flag ) + if( reinterpret_cast<RscFlagInst *>(rInst.pData)[ nIndex ].nFlags & Flag ) fprintf( fOutput, "%s", pHS->getString( pVarArray[ i ].nId ).getStr() ); else { @@ -280,7 +280,7 @@ ERRTYPE RscFlag::WriteRc( const RSCINST & rInst, RscWriteRc & aMem, { nIndex = i / (sizeof( sal_uInt32 ) * 8); - if( ((RscFlagInst *)rInst.pData)[ nIndex ].nFlags & Flag ) + if( reinterpret_cast<RscFlagInst *>(rInst.pData)[ nIndex ].nFlags & Flag ) lVal |= pVarArray[ i ].lValue; Flag <<= 1; diff --git a/rsc/source/res/rscmgr.cxx b/rsc/source/res/rscmgr.cxx index 99b849102c07..086eb7f1ebdd 100644 --- a/rsc/source/res/rscmgr.cxx +++ b/rsc/source/res/rscmgr.cxx @@ -54,12 +54,12 @@ RSCINST RscMgr::Create( RSCINST * pInst, const RSCINST & rDflt, bool bOwnClass ) RscClass::Create( &aInst, rDflt, bOwnClass ); - pClassData = (RscMgrInst *)(aInst.pData + RscClass::Size() ); + pClassData = reinterpret_cast<RscMgrInst *>(aInst.pData + RscClass::Size() ); pClassData->Create(); if( bOwnClass ) { - RscMgrInst * pDfltData = (RscMgrInst *)(rDflt.pData + RscClass::Size()); + RscMgrInst * pDfltData = reinterpret_cast<RscMgrInst *>(rDflt.pData + RscClass::Size()); *pClassData = *pDfltData; } @@ -72,7 +72,7 @@ void RscMgr::Destroy( const RSCINST & rInst ) RscClass::Destroy( rInst ); - pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size()); + pClassData = reinterpret_cast<RscMgrInst *>(rInst.pData + RscClass::Size()); pClassData->Destroy(); } @@ -80,7 +80,7 @@ void RscMgr::SetToDefault( const RSCINST & rInst ) { RscMgrInst * pClassData; - pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size()); + pClassData = reinterpret_cast<RscMgrInst *>(rInst.pData + RscClass::Size()); pClassData->bDflt = true; RscClass::SetToDefault( rInst ); @@ -90,7 +90,7 @@ bool RscMgr::IsDefault( const RSCINST & rInst ) { RscMgrInst * pClassData; - pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size()); + pClassData = reinterpret_cast<RscMgrInst *>(rInst.pData + RscClass::Size()); if( !pClassData->bDflt ) return false; @@ -104,8 +104,8 @@ bool RscMgr::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) if( pDef ) { - RscMgrInst * pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size()); - RscMgrInst * pDfltData = (RscMgrInst *)(pDef + RscClass::Size()); + RscMgrInst * pClassData = reinterpret_cast<RscMgrInst *>(rInst.pData + RscClass::Size()); + RscMgrInst * pDfltData = reinterpret_cast<RscMgrInst *>(pDef + RscClass::Size()); if( !pClassData->aRefId.IsId() && !pDfltData->aRefId.IsId() ) { @@ -124,7 +124,7 @@ void RscMgr::WriteSrcHeader( const RSCINST & rInst, FILE * fOutput, RscMgrInst * pClassData; sal_uInt32 i; - pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size()); + pClassData = reinterpret_cast<RscMgrInst *>(rInst.pData + RscClass::Size()); fprintf( fOutput, "%s %s", pHS->getString( rInst.pClass->GetId() ).getStr(), @@ -164,7 +164,7 @@ ERRTYPE RscMgr::WriteRcHeader( const RSCINST & rInst, RscWriteRc & rMem, ERRTYPE aError; ObjNode * pObjNode = NULL; - pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size()); + pClassData = reinterpret_cast<RscMgrInst *>(rInst.pData + RscClass::Size()); if( pClassData->aRefId.IsId() ) { @@ -258,7 +258,7 @@ bool RscMgr::IsConsistent( const RSCINST & rInst ) bRet = RscClass::IsConsistent( rInst ); - pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size()); + pClassData = reinterpret_cast<RscMgrInst *>(rInst.pData + RscClass::Size()); if( pClassData->aRefId.IsId() && ((pClassData->aRefId.GetNumber() < 1) || (pClassData->aRefId.GetNumber() > 0x7FFF) || @@ -274,7 +274,7 @@ ERRTYPE RscMgr::GetRef( const RSCINST & rInst, RscId * pRscId ) { RscMgrInst * pClassData; - pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size()); + pClassData = reinterpret_cast<RscMgrInst *>(rInst.pData + RscClass::Size()); *pRscId = pClassData->aRefId; return ERR_OK; } @@ -287,7 +287,7 @@ ERRTYPE RscMgr::IsToDeep( const RSCINST & rInst, sal_uInt32 nDeep ) RSCINST aTmpI = rInst; ObjNode * pObjNode; - pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size()); + pClassData = reinterpret_cast<RscMgrInst *>(rInst.pData + RscClass::Size()); while( aTmpI.IsInst() && (nDeep < nRefDeep) && aError.IsOk() ) { @@ -328,7 +328,7 @@ ERRTYPE RscMgr::SetRef( const RSCINST & rInst, const RscId & rRefId ) } else { - pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size()); + pClassData = reinterpret_cast<RscMgrInst *>(rInst.pData + RscClass::Size()); aOldId = pClassData->aRefId;// Alten Wert merken pClassData->aRefId = rRefId;// vorher eintragen, // sonst Fehler bei rekursion diff --git a/rsc/source/res/rscrange.cxx b/rsc/source/res/rscrange.cxx index b8d9efc5d607..40af08f8265e 100644 --- a/rsc/source/res/rscrange.cxx +++ b/rsc/source/res/rscrange.cxx @@ -56,8 +56,8 @@ bool RscRange::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) { if( pDef ) { - if( ((RscRangeInst*)rInst.pData)->nValue == - ((RscRangeInst*)pDef)->nValue ) + if( reinterpret_cast<RscRangeInst*>(rInst.pData)->nValue == + reinterpret_cast<RscRangeInst*>(pDef)->nValue ) { return true; } @@ -71,14 +71,14 @@ ERRTYPE RscRange::SetNumber( const RSCINST & rInst, sal_Int32 nValue ) if( nMax < nValue || nMin > nValue ) return ERR_RSCRANGE_OUTDEFSET; - ((RscRangeInst *)rInst.pData)->nValue = (sal_uInt16)( nValue - nMin ); - ((RscRangeInst *)rInst.pData)->bDflt = false; + reinterpret_cast<RscRangeInst *>(rInst.pData)->nValue = (sal_uInt16)( nValue - nMin ); + reinterpret_cast<RscRangeInst *>(rInst.pData)->bDflt = false; return ERR_OK; } ERRTYPE RscRange::GetNumber( const RSCINST & rInst, sal_Int32 * pN ) { - *pN = ((RscRangeInst *)rInst.pData)->nValue + nMin; + *pN = reinterpret_cast<RscRangeInst *>(rInst.pData)->nValue + nMin; return ERR_OK; } @@ -103,11 +103,11 @@ RSCINST RscRange::Create( RSCINST * pInst, const RSCINST & rDflt, else { if( 0L >= nMin && 0L <= nMax ) - ((RscRangeInst *)aInst.pData)->nValue = (sal_uInt16)(0L - nMin); + reinterpret_cast<RscRangeInst *>(aInst.pData)->nValue = (sal_uInt16)(0L - nMin); else - ((RscRangeInst *)aInst.pData)->nValue = 0; + reinterpret_cast<RscRangeInst *>(aInst.pData)->nValue = 0; - ((RscRangeInst *)aInst.pData)->bDflt = true; + reinterpret_cast<RscRangeInst *>(aInst.pData)->bDflt = true; } return aInst; @@ -116,7 +116,7 @@ RSCINST RscRange::Create( RSCINST * pInst, const RSCINST & rDflt, void RscRange::WriteSrc( const RSCINST & rInst, FILE * fOutput, RscTypCont *, sal_uInt32, const char * ) { - fprintf( fOutput, "%ld", long( ((RscRangeInst *)rInst.pData)->nValue + nMin ) ); + fprintf( fOutput, "%ld", long( reinterpret_cast<RscRangeInst *>(rInst.pData)->nValue + nMin ) ); } ERRTYPE RscRange::WriteRc( const RSCINST & rInst, RscWriteRc & aMem, @@ -125,13 +125,13 @@ ERRTYPE RscRange::WriteRc( const RSCINST & rInst, RscWriteRc & aMem, if( nMin >= 0 ) { sal_uInt16 n; - n = (sal_uInt16)(((RscRangeInst *)rInst.pData)->nValue + nMin); + n = (sal_uInt16)(reinterpret_cast<RscRangeInst *>(rInst.pData)->nValue + nMin); aMem.Put( n ); } else { sal_Int16 n; - n = (sal_Int16)(((RscRangeInst *)rInst.pData)->nValue + nMin); + n = (sal_Int16)(reinterpret_cast<RscRangeInst *>(rInst.pData)->nValue + nMin); aMem.Put( n ); } @@ -169,8 +169,8 @@ ERRTYPE RscLongRange::SetRange( sal_Int32 nMinimum, sal_Int32 nMaximum ) bool RscLongRange::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) { if( pDef ) - return 0 == memcmp( &((RscLongRangeInst*)rInst.pData)->nValue, - &((RscLongRangeInst*)pDef)->nValue, + return 0 == memcmp( &reinterpret_cast<RscLongRangeInst*>(rInst.pData)->nValue, + &reinterpret_cast<RscLongRangeInst*>(pDef)->nValue, sizeof( sal_Int32 ) ); return false; @@ -181,15 +181,15 @@ ERRTYPE RscLongRange::SetNumber( const RSCINST & rInst, sal_Int32 nValue ) if( nMax < nValue || nMin > nValue ) return( ERR_RSCRANGE_OUTDEFSET ); - void * pData = &((RscLongRangeInst*)rInst.pData)->nValue; + void * pData = &reinterpret_cast<RscLongRangeInst*>(rInst.pData)->nValue; memcpy( pData, &nValue, sizeof( sal_Int32 ) ); - ((RscLongRangeInst *)rInst.pData)->bDflt = false; + reinterpret_cast<RscLongRangeInst *>(rInst.pData)->bDflt = false; return ERR_OK; } ERRTYPE RscLongRange::GetNumber( const RSCINST & rInst, sal_Int32 * pN ) { - memmove( pN, &((RscLongRangeInst*)rInst.pData)->nValue, + memmove( pN, &reinterpret_cast<RscLongRangeInst*>(rInst.pData)->nValue, sizeof( sal_Int32 ) ); return ERR_OK; } @@ -220,9 +220,9 @@ RSCINST RscLongRange::Create( RSCINST * pInst, const RSCINST & rDflt, else lDflt = nMin; - void * pData = &((RscLongRangeInst*)aInst.pData)->nValue; + void * pData = &reinterpret_cast<RscLongRangeInst*>(aInst.pData)->nValue; memcpy( pData, &lDflt, sizeof( sal_Int32 ) ); - ((RscLongRangeInst *)aInst.pData)->bDflt = true; + reinterpret_cast<RscLongRangeInst *>(aInst.pData)->bDflt = true; } return aInst; @@ -287,12 +287,12 @@ RSCINST RscIdRange::Create( RSCINST * pInst, const RSCINST & rDflt, bool bOwnCla if( !bOwnClass && rDflt.IsInst() ) bOwnClass = rDflt.pClass->InHierarchy( this ); - pClassData = (RscId *)aInst.pData; + pClassData = reinterpret_cast<RscId *>(aInst.pData); pClassData->Create(); if( bOwnClass ) - *pClassData = *(RscId *)rDflt.pData; + *pClassData = *reinterpret_cast<RscId *>(rDflt.pData); else { *pClassData = RscId(); @@ -302,7 +302,7 @@ RSCINST RscIdRange::Create( RSCINST * pInst, const RSCINST & rDflt, bool bOwnCla *pClassData = RscId( nMin ); //cUnused wird fuer Defaultkennung verwendet - ((RscId *)aInst.pData)->aExp.cUnused = true; + reinterpret_cast<RscId *>(aInst.pData)->aExp.cUnused = true; } return aInst; @@ -310,18 +310,18 @@ RSCINST RscIdRange::Create( RSCINST * pInst, const RSCINST & rDflt, bool bOwnCla void RscIdRange :: Destroy( const RSCINST & rInst ) { - ((RscId *)rInst.pData)->Destroy(); + reinterpret_cast<RscId *>(rInst.pData)->Destroy(); } bool RscIdRange::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) { if( pDef ) { - if( ((RscId*)rInst.pData)->aExp.IsNumber() && - ((RscId*)pDef)->aExp.IsNumber() ) + if( reinterpret_cast<RscId*>(rInst.pData)->aExp.IsNumber() && + reinterpret_cast<RscId*>(pDef)->aExp.IsNumber() ) { - if( ((RscId*)rInst.pData)->GetNumber() == - ((RscId*)pDef)->GetNumber() ) + if( reinterpret_cast<RscId*>(rInst.pData)->GetNumber() == + reinterpret_cast<RscId*>(pDef)->GetNumber() ) { return true; } @@ -336,14 +336,14 @@ ERRTYPE RscIdRange::SetNumber( const RSCINST & rInst, sal_Int32 nValue ) if( nMax < nValue || nMin > nValue ) return ERR_RSCRANGE_OUTDEFSET; - *(RscId *)rInst.pData = RscId( nValue ); - ((RscId *)rInst.pData)->aExp.cUnused = false; + *reinterpret_cast<RscId *>(rInst.pData) = RscId( nValue ); + reinterpret_cast<RscId *>(rInst.pData)->aExp.cUnused = false; return ERR_OK; } ERRTYPE RscIdRange::GetNumber( const RSCINST & rInst, sal_Int32 * plValue ) { - *plValue = ((RscId *)rInst.pData)->GetNumber(); + *plValue = reinterpret_cast<RscId *>(rInst.pData)->GetNumber(); return ERR_OK; } @@ -355,8 +355,8 @@ ERRTYPE RscIdRange::SetRef( const RSCINST & rInst, const RscId & rRscId ) aError = SetNumber( rInst, rRscId ); if( aError.IsOk() ) { - *(RscId *)rInst.pData = rRscId; - ((RscId *)rInst.pData)->aExp.cUnused = false; + *reinterpret_cast<RscId *>(rInst.pData) = rRscId; + reinterpret_cast<RscId *>(rInst.pData)->aExp.cUnused = false; } } else @@ -367,7 +367,7 @@ ERRTYPE RscIdRange::SetRef( const RSCINST & rInst, const RscId & rRscId ) ERRTYPE RscIdRange::GetRef( const RSCINST & rInst, RscId * pRscId ) { - *pRscId = *(RscId *)rInst.pData; + *pRscId = *reinterpret_cast<RscId *>(rInst.pData); return ERR_OK; } @@ -375,13 +375,13 @@ ERRTYPE RscIdRange::GetRef( const RSCINST & rInst, RscId * pRscId ) void RscIdRange::WriteSrc( const RSCINST & rInst, FILE * fOutput, RscTypCont *, sal_uInt32, const char * ) { - fprintf( fOutput, "%s", ((RscId *)rInst.pData)->GetName().getStr() ); + fprintf( fOutput, "%s", reinterpret_cast<RscId *>(rInst.pData)->GetName().getStr() ); } ERRTYPE RscIdRange::WriteRc( const RSCINST & rInst, RscWriteRc & aMem, RscTypCont *, sal_uInt32, bool ) { - sal_Int32 lVal = ((RscId*)rInst.pData)->GetNumber(); + sal_Int32 lVal = reinterpret_cast<RscId*>(rInst.pData)->GetNumber(); aMem.Put( (sal_Int32)lVal ); @@ -390,7 +390,7 @@ ERRTYPE RscIdRange::WriteRc( const RSCINST & rInst, RscWriteRc & aMem, bool RscIdRange::IsConsistent( const RSCINST & rInst ) { - long nValue = ((RscId *)rInst.pData)->GetNumber(); + long nValue = reinterpret_cast<RscId *>(rInst.pData)->GetNumber(); return (nMax >= nValue) && (nMin <= nValue); @@ -443,7 +443,7 @@ RSCINST RscBreakRange::Create( RSCINST * pInst, const RSCINST & rDflt, GetNumber( aInst, &l ); if( l == nOutRange ) - ((RscRangeInst *)aInst.pData)->nValue++; + reinterpret_cast<RscRangeInst *>(aInst.pData)->nValue++; return aInst; } diff --git a/rsc/source/res/rscstr.cxx b/rsc/source/res/rscstr.cxx index 8319c33a3b62..8fe77e8c3850 100644 --- a/rsc/source/res/rscstr.cxx +++ b/rsc/source/res/rscstr.cxx @@ -47,9 +47,9 @@ ERRTYPE RscString::SetString( const RSCINST & rInst, const char * pStr ) if( aError.IsOk() ) { - ((RscStringInst *)rInst.pData)->bDflt = false; + reinterpret_cast<RscStringInst *>(rInst.pData)->bDflt = false; - pTmp = ((RscStringInst *)rInst.pData)->pStr; + pTmp = reinterpret_cast<RscStringInst *>(rInst.pData)->pStr; if( pTmp ) { rtl_freeMemory( pTmp ); @@ -63,7 +63,7 @@ ERRTYPE RscString::SetString( const RSCINST & rInst, const char * pStr ) memcpy( pTmp, pStr, nLen ); } - ((RscStringInst *)rInst.pData)->pStr = pTmp; + reinterpret_cast<RscStringInst *>(rInst.pData)->pStr = pTmp; } return aError; @@ -71,13 +71,13 @@ ERRTYPE RscString::SetString( const RSCINST & rInst, const char * pStr ) ERRTYPE RscString::GetString( const RSCINST & rInst, char ** ppStr ) { - *ppStr = ((RscStringInst *)rInst.pData)->pStr; + *ppStr = reinterpret_cast<RscStringInst *>(rInst.pData)->pStr; return ERR_OK; } ERRTYPE RscString::GetRef( const RSCINST & rInst, RscId * pRscId ) { - *pRscId = ((RscStringInst *)rInst.pData)->aRefId; + *pRscId = reinterpret_cast<RscStringInst *>(rInst.pData)->aRefId; return ERR_OK; } @@ -85,8 +85,8 @@ ERRTYPE RscString::SetRef( const RSCINST & rInst, const RscId & rRefId ) { if( pRefClass ) { - ((RscStringInst *)rInst.pData)->aRefId = rRefId; - ((RscStringInst *)rInst.pData)->bDflt = false; + reinterpret_cast<RscStringInst *>(rInst.pData)->aRefId = rRefId; + reinterpret_cast<RscStringInst *>(rInst.pData)->bDflt = false; } else return( ERR_REFNOTALLOWED ); @@ -111,17 +111,17 @@ RSCINST RscString::Create( RSCINST * pInst, const RSCINST & rDflt, if( !bOwnClass && rDflt.IsInst() ) bOwnClass = rDflt.pClass->InHierarchy( this ); - ((RscStringInst *)aInst.pData)->aRefId.Create(); - ((RscStringInst *)aInst.pData)->pStr = NULL; - ((RscStringInst *)aInst.pData)->bDflt = true; + reinterpret_cast<RscStringInst *>(aInst.pData)->aRefId.Create(); + reinterpret_cast<RscStringInst *>(aInst.pData)->pStr = NULL; + reinterpret_cast<RscStringInst *>(aInst.pData)->bDflt = true; if( bOwnClass ) { - ((RscStringInst *)aInst.pData)->aRefId = - ((RscStringInst *)rDflt.pData)->aRefId; - SetString( aInst, ((RscStringInst *)rDflt.pData)->pStr ); - ((RscStringInst *)aInst.pData)->bDflt = - ((RscStringInst *)rDflt.pData)->bDflt ; + reinterpret_cast<RscStringInst *>(aInst.pData)->aRefId = + reinterpret_cast<RscStringInst *>(rDflt.pData)->aRefId; + SetString( aInst, reinterpret_cast<RscStringInst *>(rDflt.pData)->pStr ); + reinterpret_cast<RscStringInst *>(aInst.pData)->bDflt = + reinterpret_cast<RscStringInst *>(rDflt.pData)->bDflt; } return aInst; @@ -129,15 +129,15 @@ RSCINST RscString::Create( RSCINST * pInst, const RSCINST & rDflt, void RscString::Destroy( const RSCINST & rInst ) { - if( ((RscStringInst *)rInst.pData)->pStr ) - rtl_freeMemory( ((RscStringInst *)rInst.pData)->pStr ); - ((RscStringInst *)rInst.pData)->aRefId.Destroy(); + if( reinterpret_cast<RscStringInst *>(rInst.pData)->pStr ) + rtl_freeMemory( reinterpret_cast<RscStringInst *>(rInst.pData)->pStr ); + reinterpret_cast<RscStringInst *>(rInst.pData)->aRefId.Destroy(); } bool RscString::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) { - RscStringInst * pData = (RscStringInst*)rInst.pData; - RscStringInst * pDefData = (RscStringInst*)pDef; + RscStringInst * pData = reinterpret_cast<RscStringInst*>(rInst.pData); + RscStringInst * pDefData = reinterpret_cast<RscStringInst*>(pDef); if( pDef ) { @@ -186,14 +186,14 @@ bool RscString::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) void RscString::WriteSrc( const RSCINST & rInst, FILE * fOutput, RscTypCont *, sal_uInt32, const char * ) { - if ( ((RscStringInst *)rInst.pData)->aRefId.IsId() ) + if ( reinterpret_cast<RscStringInst *>(rInst.pData)->aRefId.IsId() ) { fprintf( fOutput, "%s", - ((RscStringInst *)rInst.pData)->aRefId.GetName().getStr() ); + reinterpret_cast<RscStringInst *>(rInst.pData)->aRefId.GetName().getStr() ); } else { - RscStringInst * pStrI = ((RscStringInst *)rInst.pData); + RscStringInst * pStrI = reinterpret_cast<RscStringInst *>(rInst.pData); if( pStrI->pStr ){ //char * pChangeTab = RscChar::GetChangeTab(); sal_uInt32 n = 0; @@ -233,9 +233,9 @@ ERRTYPE RscString::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, ObjNode * pObjNode = NULL; - if( ((RscStringInst *)rInst.pData)->aRefId.IsId() ) + if( reinterpret_cast<RscStringInst *>(rInst.pData)->aRefId.IsId() ) { - RscId aId( ((RscStringInst *)rInst.pData)->aRefId ); + RscId aId( reinterpret_cast<RscStringInst *>(rInst.pData)->aRefId ); RSCINST aTmpI; aTmpI.pClass = pRefClass; @@ -282,15 +282,15 @@ ERRTYPE RscString::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, } else { - if( ((RscStringInst *)rInst.pData)->pStr && pTC ) + if( reinterpret_cast<RscStringInst *>(rInst.pData)->pStr && pTC ) { - char * pStr = RscChar::MakeUTF8( ((RscStringInst *)rInst.pData)->pStr, + char * pStr = RscChar::MakeUTF8( reinterpret_cast<RscStringInst *>(rInst.pData)->pStr, pTC->GetSourceCharSet() ); rMem.PutUTF8( pStr ); rtl_freeMemory( pStr ); } else - rMem.PutUTF8( ((RscStringInst *)rInst.pData)->pStr ); + rMem.PutUTF8( reinterpret_cast<RscStringInst *>(rInst.pData)->pStr ); } } return aError; diff --git a/rsc/source/tools/rsctools.cxx b/rsc/source/tools/rsctools.cxx index 01c6f79665fa..3fa4bdda9f8b 100644 --- a/rsc/source/tools/rsctools.cxx +++ b/rsc/source/tools/rsctools.cxx @@ -240,16 +240,15 @@ void * RscPtrPtr :: GetEntry( sal_uInt32 nEntry ) RscWriteRc::RscWriteRc( RSCBYTEORDER_TYPE nOrder ) { - short nSwapTest = 1; - RSCBYTEORDER_TYPE nMachineOrder; - bSwap = false; if( nOrder != RSC_SYSTEMENDIAN ) { - if( (sal_uInt8)*(sal_uInt8 *)&nSwapTest ) - nMachineOrder = RSC_LITTLEENDIAN; - else - nMachineOrder = RSC_BIGENDIAN; + RSCBYTEORDER_TYPE nMachineOrder; +#if defined OSL_LITENDIAN + nMachineOrder = RSC_LITTLEENDIAN; +#else + nMachineOrder = RSC_BIGENDIAN; +#endif bSwap = nOrder != nMachineOrder; } nByteOrder = nOrder; |