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>
This commit is contained in:
parent
41c7ee5f0a
commit
b24a9f8b35
@ -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; }
|
||||
|
@ -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;
|
||||
|
@ -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) ); }
|
||||
|
@ -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 );
|
||||
|
@ -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 );
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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>(
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user