diff options
Diffstat (limited to 'tools/source/memtools/table.cxx')
-rwxr-xr-x[-rw-r--r--] | tools/source/memtools/table.cxx | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/tools/source/memtools/table.cxx b/tools/source/memtools/table.cxx index 50ac46e99758..80b2c9747966 100644..100755 --- a/tools/source/memtools/table.cxx +++ b/tools/source/memtools/table.cxx @@ -37,16 +37,16 @@ // ======================================================================= -ULONG Table::ImplGetIndex( ULONG nKey, ULONG* pIndex ) const +sal_uIntPtr Table::ImplGetIndex( sal_uIntPtr nKey, sal_uIntPtr* pIndex ) const { // Abpruefen, ob der erste Key groesser als der Vergleichskey ist - if ( !nCount || (nKey < (ULONG)Container::ImpGetObject(0)) ) + if ( !nCount || (nKey < (sal_uIntPtr)Container::ImpGetObject(0)) ) return TABLE_ENTRY_NOTFOUND; - ULONG nLow; - ULONG nHigh; - ULONG nMid; - ULONG nCompareKey; + sal_uIntPtr nLow; + sal_uIntPtr nHigh; + sal_uIntPtr nMid; + sal_uIntPtr nCompareKey; void** pNodes = Container::ImpGetOnlyNodes(); // Binaeres Suchen @@ -57,7 +57,7 @@ ULONG Table::ImplGetIndex( ULONG nKey, ULONG* pIndex ) const do { nMid = (nLow + nHigh) / 2; - nCompareKey = (ULONG)pNodes[nMid*2]; + nCompareKey = (sal_uIntPtr)pNodes[nMid*2]; if ( nKey < nCompareKey ) nHigh = nMid-1; else @@ -75,7 +75,7 @@ ULONG Table::ImplGetIndex( ULONG nKey, ULONG* pIndex ) const do { nMid = (nLow + nHigh) / 2; - nCompareKey = (ULONG)Container::ImpGetObject( nMid*2 ); + nCompareKey = (sal_uIntPtr)Container::ImpGetObject( nMid*2 ); if ( nKey < nCompareKey ) nHigh = nMid-1; else @@ -102,7 +102,7 @@ ULONG Table::ImplGetIndex( ULONG nKey, ULONG* pIndex ) const // ======================================================================= -Table::Table( USHORT _nInitSize, USHORT _nReSize ) : +Table::Table( sal_uInt16 _nInitSize, sal_uInt16 _nReSize ) : Container( CONTAINER_MAXBLOCKSIZE, _nInitSize*2, _nReSize*2 ) { DBG_ASSERT( _nInitSize <= 32767, "Table::Table(): InitSize > 32767" ); @@ -112,27 +112,27 @@ Table::Table( USHORT _nInitSize, USHORT _nReSize ) : // ----------------------------------------------------------------------- -BOOL Table::Insert( ULONG nKey, void* p ) +sal_Bool Table::Insert( sal_uIntPtr nKey, void* p ) { // Tabellenelement einsortieren - ULONG i; + sal_uIntPtr i; if ( nCount ) { if ( nCount <= 24 ) { - USHORT n = 0; - USHORT nTempCount = (USHORT)nCount * 2; + sal_uInt16 n = 0; + sal_uInt16 nTempCount = (sal_uInt16)nCount * 2; //<!--Modified by PengYunQuan for resolving a NULL pointer access if( void** pNodes = Container::ImpGetOnlyNodes() ) { - ULONG nCompareKey = (ULONG)(*pNodes); + sal_uIntPtr nCompareKey = (sal_uIntPtr)(*pNodes); while ( nKey > nCompareKey ) { n += 2; pNodes += 2; if ( n < nTempCount ) - nCompareKey = (ULONG)(*pNodes); + nCompareKey = (sal_uIntPtr)(*pNodes); else { nCompareKey = 0; @@ -142,7 +142,7 @@ BOOL Table::Insert( ULONG nKey, void* p ) // Testen, ob sich der Key schon in der Tabelle befindet if ( nKey == nCompareKey ) - return FALSE; + return sal_False; i = n; } @@ -150,7 +150,7 @@ BOOL Table::Insert( ULONG nKey, void* p ) { i = 0; if ( ImplGetIndex( nKey, &i ) != TABLE_ENTRY_NOTFOUND ) - return FALSE; + return sal_False; } //-->Modified by PengYunQuan for resolving a NULL pointer access } @@ -158,7 +158,7 @@ BOOL Table::Insert( ULONG nKey, void* p ) { i = 0; if ( ImplGetIndex( nKey, &i ) != TABLE_ENTRY_NOTFOUND ) - return FALSE; + return sal_False; } } else @@ -171,15 +171,15 @@ BOOL Table::Insert( ULONG nKey, void* p ) // Ein neuer Eintrag nCount++; - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- -void* Table::Remove( ULONG nKey ) +void* Table::Remove( sal_uIntPtr nKey ) { // Index besorgen - ULONG nIndex = ImplGetIndex( nKey ); + sal_uIntPtr nIndex = ImplGetIndex( nKey ); // Testen, ob sich der Key in der Tabelle befindet if ( nIndex == TABLE_ENTRY_NOTFOUND ) @@ -197,10 +197,10 @@ void* Table::Remove( ULONG nKey ) // ----------------------------------------------------------------------- -void* Table::Replace( ULONG nKey, void* p ) +void* Table::Replace( sal_uIntPtr nKey, void* p ) { // Index abfragen - ULONG nIndex = ImplGetIndex( nKey ); + sal_uIntPtr nIndex = ImplGetIndex( nKey ); // Existiert kein Eintrag mit dem Schluessel if ( nIndex == TABLE_ENTRY_NOTFOUND ) @@ -211,10 +211,10 @@ void* Table::Replace( ULONG nKey, void* p ) // ----------------------------------------------------------------------- -void* Table::Get( ULONG nKey ) const +void* Table::Get( sal_uIntPtr nKey ) const { // Index besorgen - ULONG nIndex = ImplGetIndex( nKey ); + sal_uIntPtr nIndex = ImplGetIndex( nKey ); // Testen, ob sich der Key in der Tabelle befindet if ( nIndex == TABLE_ENTRY_NOTFOUND ) @@ -232,16 +232,16 @@ void* Table::GetCurObject() const // ----------------------------------------------------------------------- -ULONG Table::GetKey( const void* p ) const +sal_uIntPtr Table::GetKey( const void* p ) const { - ULONG nIndex = 0; + sal_uIntPtr nIndex = 0; // Solange noch Eintraege Vorhanden sind while ( nIndex < nCount ) { // Stimmt der Pointer ueberein, wird der Key zurueckgegeben if ( p == Container::ImpGetObject( (nIndex*2)+1 ) ) - return (ULONG)Container::ImpGetObject( nIndex*2 ); + return (sal_uIntPtr)Container::ImpGetObject( nIndex*2 ); nIndex++; } @@ -251,14 +251,14 @@ ULONG Table::GetKey( const void* p ) const // ----------------------------------------------------------------------- -BOOL Table::IsKeyValid( ULONG nKey ) const +sal_Bool Table::IsKeyValid( sal_uIntPtr nKey ) const { - return (ImplGetIndex( nKey ) != TABLE_ENTRY_NOTFOUND) ? TRUE : FALSE; + return (ImplGetIndex( nKey ) != TABLE_ENTRY_NOTFOUND) ? sal_True : sal_False; } // ----------------------------------------------------------------------- -ULONG Table::GetUniqueKey( ULONG nStartKey ) const +sal_uIntPtr Table::GetUniqueKey( sal_uIntPtr nStartKey ) const { DBG_ASSERT( (nStartKey > 1) && (nStartKey < 0xFFFFFFFF), "Table::GetUniqueKey() - nStartKey == 0 or nStartKey >= 0xFFFFFFFF" ); @@ -266,7 +266,7 @@ ULONG Table::GetUniqueKey( ULONG nStartKey ) const if ( !nCount ) return nStartKey; - ULONG nLastKey = (ULONG)Container::GetObject( (nCount*2)-2 ); + sal_uIntPtr nLastKey = (sal_uIntPtr)Container::GetObject( (nCount*2)-2 ); if ( nLastKey < nStartKey ) return nStartKey; else @@ -275,18 +275,18 @@ ULONG Table::GetUniqueKey( ULONG nStartKey ) const return nLastKey+1; else { - ULONG nPos; - ULONG nTempPos = ImplGetIndex( nStartKey, &nPos ); + sal_uIntPtr nPos; + sal_uIntPtr nTempPos = ImplGetIndex( nStartKey, &nPos ); if ( nTempPos != TABLE_ENTRY_NOTFOUND ) nPos = nTempPos; - nLastKey = (ULONG)Container::GetObject( nPos ); + nLastKey = (sal_uIntPtr)Container::GetObject( nPos ); if ( nStartKey < nLastKey ) return nStartKey; while ( nLastKey < 0xFFFFFFFE ) { nPos += 2; nLastKey++; - if ( nLastKey != (ULONG)Container::GetObject( nPos ) ) + if ( nLastKey != (sal_uIntPtr)Container::GetObject( nPos ) ) return nLastKey; } } @@ -297,10 +297,10 @@ ULONG Table::GetUniqueKey( ULONG nStartKey ) const // ----------------------------------------------------------------------- -ULONG Table::SearchKey( ULONG nKey, ULONG* pPos ) const +sal_uIntPtr Table::SearchKey( sal_uIntPtr nKey, sal_uIntPtr* pPos ) const { *pPos = 0; - ULONG nPos = ImplGetIndex( nKey, pPos ); + sal_uIntPtr nPos = ImplGetIndex( nKey, pPos ); if ( nPos != TABLE_ENTRY_NOTFOUND ) { nPos /= 2; @@ -313,12 +313,12 @@ ULONG Table::SearchKey( ULONG nKey, ULONG* pPos ) const // ----------------------------------------------------------------------- -void* Table::Seek( ULONG nKey ) +void* Table::Seek( sal_uIntPtr nKey ) { // Testen, ob ein Eintrag vorhanden ist if ( nCount ) { - ULONG nIndex = ImplGetIndex( nKey ); + sal_uIntPtr nIndex = ImplGetIndex( nKey ); // Ist Key nicht enthalten if ( nIndex == TABLE_ENTRY_NOTFOUND ) @@ -340,7 +340,7 @@ void* Table::Seek( ULONG nKey ) void* Table::Seek( void* p ) { - ULONG nKey = GetKey( p ); + sal_uIntPtr nKey = GetKey( p ); // Ist Key vorhanden, dann als aktuellen Eintrag setzen if ( nKey != TABLE_ENTRY_NOTFOUND ) |