diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2016-03-01 23:21:02 +0100 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2016-03-01 23:51:05 +0100 |
commit | f00967cf38ed0c2c197284391fc521825bb3c2ac (patch) | |
tree | d1505cfff1707c51a74ece3091dcc25afbc5d778 /tools | |
parent | 4845155e0126571e4176819c5f27b76160146ce0 (diff) |
sal_uIntPtr/sal_uLong to Index (aka sal_uInt32) in UniqueIndex
Change-Id: I212cb3bb9d920741629fc4564bbd28b393e8fe00
Diffstat (limited to 'tools')
-rw-r--r-- | tools/source/memtools/unqidx.cxx | 32 | ||||
-rw-r--r-- | tools/source/ref/pstm.cxx | 14 |
2 files changed, 23 insertions, 23 deletions
diff --git a/tools/source/memtools/unqidx.cxx b/tools/source/memtools/unqidx.cxx index 8d7ed1ce399c..4bd05bb61d40 100644 --- a/tools/source/memtools/unqidx.cxx +++ b/tools/source/memtools/unqidx.cxx @@ -19,14 +19,14 @@ #include <tools/unqidx.hxx> -sal_uIntPtr UniqueIndexImpl::Insert( void* p ) +UniqueIndexImpl::Index UniqueIndexImpl::Insert( void* p ) { // NULL-Pointer not allowed if ( !p ) - return UNIQUEINDEX_ENTRY_NOTFOUND; + return IndexNotFound; // Expend array if full - sal_uIntPtr nTmp = maMap.size(); + Index nTmp = static_cast<Index>(maMap.size()); if( nTmp == nCount ) nTmp++; @@ -45,7 +45,7 @@ sal_uIntPtr UniqueIndexImpl::Insert( void* p ) return ( nUniqIndex + nStartIndex - 1 ); } -void* UniqueIndexImpl::Remove( sal_uIntPtr nIndex ) +void* UniqueIndexImpl::Remove( Index nIndex ) { // Check for valid index if ( (nIndex >= nStartIndex) && @@ -53,7 +53,7 @@ void* UniqueIndexImpl::Remove( sal_uIntPtr nIndex ) { // insert index as empty entry, and reduce indexcount, // if this entry was used - std::map<sal_uInt32, void*>::iterator it = maMap.find( nIndex - nStartIndex ); + std::map<Index, void*>::iterator it = maMap.find( nIndex - nStartIndex ); if( it != maMap.end() ) { void* p = it->second; @@ -65,52 +65,52 @@ void* UniqueIndexImpl::Remove( sal_uIntPtr nIndex ) return nullptr; } -void* UniqueIndexImpl::Get( sal_uIntPtr nIndex ) const +void* UniqueIndexImpl::Get( Index nIndex ) const { // check for valid index if ( (nIndex >= nStartIndex) && (nIndex < (maMap.size() + nStartIndex)) ) { - std::map<sal_uInt32, void*>::const_iterator it = maMap.find( nIndex - nStartIndex ); + std::map<Index, void*>::const_iterator it = maMap.find( nIndex - nStartIndex ); if( it != maMap.end() ) return it->second; } return nullptr; } -sal_uIntPtr UniqueIndexImpl::FirstIndex() const +UniqueIndexImpl::Index UniqueIndexImpl::FirstIndex() const { if ( maMap.empty() ) - return UNIQUEINDEX_ENTRY_NOTFOUND; + return IndexNotFound; return maMap.begin()->first; } -sal_uIntPtr UniqueIndexImpl::LastIndex() const +UniqueIndexImpl::Index UniqueIndexImpl::LastIndex() const { if ( maMap.empty() ) - return UNIQUEINDEX_ENTRY_NOTFOUND; + return IndexNotFound; return maMap.rbegin()->first; } -sal_uIntPtr UniqueIndexImpl::NextIndex(sal_uIntPtr aIndex) const +UniqueIndexImpl::Index UniqueIndexImpl::NextIndex(Index aIndex) const { std::map<sal_uInt32, void*>::const_iterator it = maMap.find( aIndex ); if ( it == maMap.end() ) - return UNIQUEINDEX_ENTRY_NOTFOUND; + return IndexNotFound; ++it; if ( it == maMap.end() ) - return UNIQUEINDEX_ENTRY_NOTFOUND; + return IndexNotFound; return it->first; } -sal_uIntPtr UniqueIndexImpl::GetIndexOf(void* p) const +UniqueIndexImpl::Index UniqueIndexImpl::GetIndexOf(void* p) const { for( std::map<sal_uInt32, void*>::const_iterator it = maMap.begin(); it != maMap.end(); ++it ) if( it->second == p ) return it->first; - return UNIQUEINDEX_ENTRY_NOTFOUND; + return IndexNotFound; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/ref/pstm.cxx b/tools/source/ref/pstm.cxx index 4e44784f7fba..47dc22e40949 100644 --- a/tools/source/ref/pstm.cxx +++ b/tools/source/ref/pstm.cxx @@ -51,7 +51,7 @@ SvCreateInstancePersist SvClassManager::Get( sal_Int32 nClassId ) (cf. <SvPersistStream::SetStream>). @see SvPersistStream::SetStream */ -SvPersistStream::SvPersistStream( SvClassManager & rMgr, SvStream * pStream, sal_uInt32 nStartIdxP ) +SvPersistStream::SvPersistStream( SvClassManager & rMgr, SvStream * pStream, Index nStartIdxP ) : rClassMgr( rMgr ) , pStm( pStream ) , aPUIdx( nStartIdxP ) @@ -135,7 +135,7 @@ void SvPersistStream::FlushData() { } -sal_uIntPtr SvPersistStream::GetIndex( SvPersistBase * pObj ) const +SvPersistStream::Index SvPersistStream::GetIndex( SvPersistBase * pObj ) const { PersistBaseMap::const_iterator it = aPTable.find( pObj ); if( it == aPTable.end() ) @@ -148,7 +148,7 @@ sal_uIntPtr SvPersistStream::GetIndex( SvPersistBase * pObj ) const return it->second; } -SvPersistBase * SvPersistStream::GetObject( sal_uIntPtr nIdx ) const +SvPersistBase * SvPersistStream::GetObject( Index nIdx ) const { if( nIdx >= nStartIdx ) return aPUIdx.Get( nIdx ); @@ -388,7 +388,7 @@ static void ReadId ( SvStream & rStm, sal_uInt8 & nHdr, - sal_uInt32 & nId, + SvPersistStream::Index & nId, sal_uInt16 & nClassId ) { @@ -441,7 +441,7 @@ SvPersistStream& SvPersistStream::WritePointer if( pObj ) { - sal_uIntPtr nId = GetIndex( pObj ); + Index nId = GetIndex( pObj ); if( nId ) nP |= P_ID; else @@ -468,7 +468,7 @@ void SvPersistStream::ReadObj ) { sal_uInt8 nHdr; - sal_uInt32 nId = 0; + Index nId = 0; sal_uInt16 nClassId; rpObj = nullptr; // specification: 0 in case of error @@ -512,7 +512,7 @@ void SvPersistStream::ReadObj if( bRegister ) { // insert into table - sal_uIntPtr nNewId = aPUIdx.Insert( rpObj ); + const Index nNewId = aPUIdx.Insert( rpObj ); // in order to restore state after saving aPTable[ rpObj ] = nNewId; DBG_ASSERT( !(nHdr & P_DBGUTIL) || nId == nNewId, |