diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2017-03-12 20:29:25 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-03-14 06:08:20 +0000 |
commit | b24a9f8b3537ee5c200c1d52fc51157f1ac55e9d (patch) | |
tree | ce5a92947fdc7c93732652b5c69c9d932b1270f6 | |
parent | 41c7ee5f0a3d0e128134665d709fd46e663fd373 (diff) |
make o3tl::strong_int constructor explicit
Could have sworn I did this originally, somehow it got lost.
Also fix a thinko in tools::ResId I introduced in commit
2b70fb58be039fbd05ea833a40b1b3e9f922e45c
"Use o3tl::strong_int on RESOURCE_TYPE"
Change-Id: Id3b39962255297010cd1feaaca6d822168311081
Reviewed-on: https://gerrit.libreoffice.org/35108
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/o3tl/strong_int.hxx | 2 | ||||
-rw-r--r-- | include/tools/resid.hxx | 10 | ||||
-rw-r--r-- | include/tools/unqidx.hxx | 4 | ||||
-rw-r--r-- | rsc/inc/rscdb.hxx | 10 | ||||
-rw-r--r-- | rsc/inc/rsctop.hxx | 4 | ||||
-rw-r--r-- | rsc/source/parser/rscdb.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view2.cxx | 2 | ||||
-rw-r--r-- | tools/source/rc/resmgr.cxx | 4 | ||||
-rw-r--r-- | tools/source/ref/pstm.cxx | 16 |
9 files changed, 27 insertions, 27 deletions
diff --git a/include/o3tl/strong_int.hxx b/include/o3tl/strong_int.hxx index 7f24714411dc..92706a870b85 100644 --- a/include/o3tl/strong_int.hxx +++ b/include/o3tl/strong_int.hxx @@ -40,7 +40,7 @@ template <typename UNDERLYING_TYPE, typename PHANTOM_TYPE> struct strong_int { public: - strong_int(UNDERLYING_TYPE value) : m_value(value) {} + explicit strong_int(UNDERLYING_TYPE value) : m_value(value) {} strong_int() : m_value(0) {} explicit operator UNDERLYING_TYPE() const { return m_value; } diff --git a/include/tools/resid.hxx b/include/tools/resid.hxx index 53a229b70562..f9f0b68ff252 100644 --- a/include/tools/resid.hxx +++ b/include/tools/resid.hxx @@ -47,11 +47,11 @@ class SAL_WARN_UNUSED ResId release the Resource context after loading this id. */ RSHEADER_TYPE* m_pResource; - mutable RESOURCE_TYPE m_nResId; // Resource Identifier + mutable sal_uInt32 m_nResId; // Resource Identifier mutable RESOURCE_TYPE m_nRT; // type for loading (mutable to be set later) mutable ResMgr * m_pResMgr; // load from this ResMgr (mutable for setting on demand) - void ImplInit( RESOURCE_TYPE nId, ResMgr& rMgr, RSHEADER_TYPE* pRes ) + void ImplInit( sal_uInt32 nId, ResMgr& rMgr, RSHEADER_TYPE* pRes ) { m_pResource = pRes; m_nResId = nId; m_nRT = RSC_NOTYPE; m_pResMgr = &rMgr; OSL_ENSURE( m_pResMgr != nullptr, "ResId without ResMgr created" ); @@ -62,7 +62,7 @@ public: { ImplInit( 0, rMgr, pRc ); } - ResId( RESOURCE_TYPE nId, ResMgr& rMgr ) + ResId( sal_uInt32 nId, ResMgr& rMgr ) { ImplInit( nId, rMgr, nullptr ); } @@ -89,9 +89,9 @@ public: ResMgr * GetResMgr() const { return m_pResMgr; } void ClearResMgr() const { m_pResMgr = nullptr; } - bool IsAutoRelease() const { return !(sal_uInt32(m_nResId) & RSC_DONTRELEASE); } + bool IsAutoRelease() const { return !(m_nResId & RSC_DONTRELEASE); } - sal_uInt32 GetId() const { return sal_uInt32(m_nResId) & ~RSC_DONTRELEASE; } + sal_uInt32 GetId() const { return m_nResId & ~RSC_DONTRELEASE; } RSHEADER_TYPE* GetpResource() const { return m_pResource; } TOOLS_DLLPUBLIC OUString toString() const; diff --git a/include/tools/unqidx.hxx b/include/tools/unqidx.hxx index 1ea7d471638f..7b059adccbb7 100644 --- a/include/tools/unqidx.hxx +++ b/include/tools/unqidx.hxx @@ -36,7 +36,7 @@ private: Index nUniqIndex; public: - UniqueIndexImpl( Index nStartIndex = 0 ) + UniqueIndexImpl( Index nStartIndex = Index(0) ) : maMap(), nUniqIndex(nStartIndex) {} Index Insert( void* p ); @@ -57,7 +57,7 @@ public: using UniqueIndexImpl::Index; using UniqueIndexImpl::IndexNotFound; - UniqueIndex<T>( Index _nStartIndex = 0 ) : UniqueIndexImpl(_nStartIndex) {} + UniqueIndex<T>( Index _nStartIndex = Index(0) ) : UniqueIndexImpl(_nStartIndex) {} Index Insert(T* p) { return UniqueIndexImpl::Insert(p); } T* Get(Index idx) const { return static_cast<T*>( UniqueIndexImpl::Get(idx) ); } diff --git a/rsc/inc/rscdb.hxx b/rsc/inc/rscdb.hxx index d39da67650a9..b8d3be9d2958 100644 --- a/rsc/inc/rscdb.hxx +++ b/rsc/inc/rscdb.hxx @@ -41,18 +41,18 @@ enum class MapUnit; struct WriteRcContext { - FILE * fOutput; + FILE * fOutput; OString aOutputRc; OString aOutputSysList; - RscCmdLine* pCmdLine; + RscCmdLine* pCmdLine; }; // table for system dependent resources struct RscSysEntry { sal_uInt32 nKey; - sal_uInt32 nRscTyp; - OString aFileName; + RESOURCE_TYPE nRscTyp; + OString aFileName; sal_uInt32 nTyp; sal_uInt32 nRefId; }; @@ -129,7 +129,7 @@ public: void SetSysSearchPath( const OString& rStr ) { aSysSearchPath = rStr; } // deletes all resource objects of this file void Delete( RscFileTab::Index lFileKey ); - sal_uInt32 PutSysName( sal_uInt32 nRscTyp, char * pName ); + sal_uInt32 PutSysName( RESOURCE_TYPE nRscTyp, char * pName ); void ClearSysNames(); ERRTYPE WriteRc( WriteRcContext& rContext ); void WriteSrc( FILE * fOutput, RscFileTab::Index nFileIndex ); diff --git a/rsc/inc/rsctop.hxx b/rsc/inc/rsctop.hxx index 1a5afad988bf..43f118ed98d5 100644 --- a/rsc/inc/rsctop.hxx +++ b/rsc/inc/rsctop.hxx @@ -44,7 +44,7 @@ class RscTop : public RefNode { RscTop * pSuperClass; RSCINST aDfltInst; - sal_uInt32 nTypId; + RESOURCE_TYPE nTypId; RscTop * pRefClass; protected: @@ -59,7 +59,7 @@ public: RscTop* GetSuperClass() const { return pSuperClass; } // returns the type identifier - sal_uInt32 GetTypId() const + RESOURCE_TYPE GetTypId() const { return nTypId; }; // returns the super class bool InHierarchy( RscTop * pClass ); diff --git a/rsc/source/parser/rscdb.cxx b/rsc/source/parser/rscdb.cxx index 36fd2de97c79..9232c8fa0d2e 100644 --- a/rsc/source/parser/rscdb.cxx +++ b/rsc/source/parser/rscdb.cxx @@ -200,7 +200,7 @@ void RscTypCont::ClearSysNames() aSysLst.clear(); } -sal_uInt32 RscTypCont::PutSysName( sal_uInt32 nRscTyp, char * pFileName ) +sal_uInt32 RscTypCont::PutSysName( RESOURCE_TYPE nRscTyp, char * pFileName ) { RscSysEntry *pFoundEntry = nullptr; diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index e14f7a7f7b26..50928019c4f9 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -467,7 +467,7 @@ bool SwView::InsertGraphicDlg( SfxRequest& rReq ) rSh.SetFrameFormat( pFormat ); } - RESOURCE_TYPE nResId = 0; + sal_uInt32 nResId(0); switch( nError ) { case GRFILTER_OPENERROR: diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx index 29e3751f6e42..55f50ece4c69 100644 --- a/tools/source/rc/resmgr.cxx +++ b/tools/source/rc/resmgr.cxx @@ -671,7 +671,7 @@ void ResMgr::RscError_Impl( const sal_Char* pMessage, ResMgr* pResMgr, aStr.append('\n'); aStr.append(" Class: "); - aStr.append(OUStringToOString(GetTypeRes_Impl(ResId(nRT, *pNewResMgr)), + aStr.append(OUStringToOString(GetTypeRes_Impl(ResId((sal_uInt32)nRT, *pNewResMgr)), RTL_TEXTENCODING_UTF8)); aStr.append(", Id: "); aStr.append(static_cast<sal_Int32>(nId)); @@ -682,7 +682,7 @@ void ResMgr::RscError_Impl( const sal_Char* pMessage, ResMgr* pResMgr, { aStr.append(" [ Class: "); aStr.append(OUStringToOString(GetTypeRes_Impl( - ResId(rResStack[nDepth].pResource->GetRT(), *pNewResMgr)), + ResId((sal_uInt32)rResStack[nDepth].pResource->GetRT(), *pNewResMgr)), RTL_TEXTENCODING_UTF8)); aStr.append(", Id: "); aStr.append(static_cast<sal_Int32>( diff --git a/tools/source/ref/pstm.cxx b/tools/source/ref/pstm.cxx index 3a7435de81bf..c025ed96e132 100644 --- a/tools/source/ref/pstm.cxx +++ b/tools/source/ref/pstm.cxx @@ -54,10 +54,10 @@ SvCreateInstancePersist SvClassManager::Get( sal_Int32 nClassId ) SvPersistStream::SvPersistStream( SvClassManager & rMgr, SvStream * pStream ) : rClassMgr( rMgr ) , pStm( pStream ) - , aPUIdx( 1 ) + , aPUIdx( UniqueIndex<SvPersistBase>::Index(1) ) , nStartIdx( 1 ) { - DBG_ASSERT( nStartIdx != 0, "zero index not allowed" ); + DBG_ASSERT( nStartIdx != Index(0), "zero index not allowed" ); m_isWritable = true; if( pStm ) { @@ -117,7 +117,7 @@ SvPersistStream::Index SvPersistStream::GetIndex( SvPersistBase * pObj ) const PersistBaseMap::const_iterator it = aPTable.find( pObj ); if( it == aPTable.end() ) { - return 0; + return Index(0); } return it->second; } @@ -357,18 +357,18 @@ static void ReadId nClassId = 0; rStm.ReadUChar( nHdr ); if( nHdr & P_ID_0 ) - nId = 0; + nId = SvPersistStream::Index(0); else { if( (nHdr & P_VER_MASK) == 0 ) { if( (nHdr & P_DBGUTIL) || !(nHdr & P_OBJ) ) - nId = SvPersistStream::ReadCompressed( rStm ); + nId = SvPersistStream::Index(SvPersistStream::ReadCompressed( rStm )); else - nId = 0; + nId = SvPersistStream::Index(0); } else if( nHdr & P_ID ) - nId = SvPersistStream::ReadCompressed( rStm ); + nId = SvPersistStream::Index(SvPersistStream::ReadCompressed( rStm )); if( (nHdr & P_DBGUTIL) || (nHdr & P_OBJ) ) nClassId = (sal_uInt16)SvPersistStream::ReadCompressed( rStm ); @@ -429,7 +429,7 @@ void SvPersistStream::ReadObj ) { sal_uInt8 nHdr; - Index nId = 0; + Index nId(0); sal_uInt16 nClassId; rpObj = nullptr; // specification: 0 in case of error |