Fix missing return of UtlSymTableLargeHashFunctor in utlsymbollarge.h (#169)

This commit is contained in:
Noah Kim 2023-10-22 19:42:36 -04:00 committed by GitHub
parent b645c0772b
commit 3600b56ccf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,4 @@
//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// //===== Copyright ? 1996-2005, Valve Corporation, All rights reserved. ======//
// //
// Purpose: Defines a large symbol table (intp sized handles, can store more than 64k strings) // Purpose: Defines a large symbol table (intp sized handles, can store more than 64k strings)
// //
@ -88,39 +88,39 @@ private:
const char* m_pString; const char* m_pString;
}; };
inline uint32 CUtlSymbolLarge_Hash( bool CASEINSENSITIVE, const char *pString, int len ) inline uint32 CUtlSymbolLarge_Hash( bool CASEINSENSITIVE, const char *pString, int len )
{ {
return ( CASEINSENSITIVE ? MurmurHash2LowerCase( pString, len, 0x31415926 ) : MurmurHash2( pString, len, 0x31415926 ) ); return ( CASEINSENSITIVE ? MurmurHash2LowerCase( pString, len, 0x31415926 ) : MurmurHash2( pString, len, 0x31415926 ) );
} }
typedef uint32 LargeSymbolTableHashDecoration_t; typedef uint32 LargeSymbolTableHashDecoration_t;
// The structure consists of the hash immediately followed by the string data // The structure consists of the hash immediately followed by the string data
struct CUtlSymbolTableLargeBaseTreeEntry_t struct CUtlSymbolTableLargeBaseTreeEntry_t
{ {
LargeSymbolTableHashDecoration_t m_Hash; LargeSymbolTableHashDecoration_t m_Hash;
// Variable length string data // Variable length string data
char m_String[1]; char m_String[1];
bool IsEmpty() const bool IsEmpty() const
{ {
return ( ( m_Hash == 0 ) && ( 0 == m_String[0] ) ); return ( ( m_Hash == 0 ) && ( 0 == m_String[0] ) );
} }
char const *String() const char const *String() const
{ {
return (const char *)&m_String[ 0 ]; return (const char *)&m_String[ 0 ];
} }
CUtlSymbolLarge ToSymbol() const CUtlSymbolLarge ToSymbol() const
{ {
return CUtlSymbolLarge( String() ); return CUtlSymbolLarge( String() );
} }
LargeSymbolTableHashDecoration_t HashValue() const LargeSymbolTableHashDecoration_t HashValue() const
{ {
return m_Hash; return m_Hash;
} }
}; };
// Base Class for threaded and non-threaded types // Base Class for threaded and non-threaded types
@ -183,7 +183,7 @@ private:
{ {
CUtlSymbolTableLargeBase* pTable = (CUtlSymbolTableLargeBase*)((uintptr_t)this + m_tableOffset); CUtlSymbolTableLargeBase* pTable = (CUtlSymbolTableLargeBase*)((uintptr_t)this + m_tableOffset);
pTable->HashValue( k ); return pTable->HashValue( k );
} }
}; };
@ -375,13 +375,13 @@ inline void CUtlSymbolTableLargeBase< MutexType, CASEINSENSITIVE >::Purge()
m_Mutex.Unlock( __FILE__, __LINE__ ); m_Mutex.Unlock( __FILE__, __LINE__ );
} }
// Case-sensitive // Case-sensitive
typedef CUtlSymbolTableLargeBase< CThreadEmptyMutex, false > CUtlSymbolTableLarge; typedef CUtlSymbolTableLargeBase< CThreadEmptyMutex, false > CUtlSymbolTableLarge;
// Case-insensitive // Case-insensitive
typedef CUtlSymbolTableLargeBase< CThreadEmptyMutex, true > CUtlSymbolTableLarge_CI; typedef CUtlSymbolTableLargeBase< CThreadEmptyMutex, true > CUtlSymbolTableLarge_CI;
// Multi-threaded case-sensitive // Multi-threaded case-sensitive
typedef CUtlSymbolTableLargeBase< CThreadMutex, false > CUtlSymbolTableLargeMT; typedef CUtlSymbolTableLargeBase< CThreadMutex, false > CUtlSymbolTableLargeMT;
// Multi-threaded case-insensitive // Multi-threaded case-insensitive
typedef CUtlSymbolTableLargeBase< CThreadMutex, true > CUtlSymbolTableLargeMT_CI; typedef CUtlSymbolTableLargeBase< CThreadMutex, true > CUtlSymbolTableLargeMT_CI;
#endif // UTLSYMBOLLARGE_H #endif // UTLSYMBOLLARGE_H