Skip to content

Commit

Permalink
x64: Save work
Browse files Browse the repository at this point in the history
  • Loading branch information
dimhotepus committed Jun 5, 2024
1 parent 9378de9 commit ac30a49
Show file tree
Hide file tree
Showing 225 changed files with 2,618 additions and 2,288 deletions.
2 changes: 1 addition & 1 deletion common/GameUI/IGameConsole.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ abstract_class IGameConsole : public IBaseInterface
// return true if the console has focus
virtual bool IsConsoleVisible() = 0;

virtual void SetParent( int parent ) = 0;
virtual void SetParent( uintp parent ) = 0;
};

#define GAMECONSOLE_INTERFACE_VERSION "GameConsole004"
Expand Down
8 changes: 4 additions & 4 deletions common/ServerBrowser/blacklisted_server_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ blacklisted_server_t *CBlacklistedServerManager::AddServer( const char *serverNa
//-----------------------------------------------------------------------------
// Purpose: Remove server with matching 'server id' from list
//-----------------------------------------------------------------------------
void CBlacklistedServerManager::RemoveServer( int iServerID )
void CBlacklistedServerManager::RemoveServer( intp iServerID )
{
for ( int i = 0; i < m_Blacklist.Count(); i++ )
for ( intp i = 0; i < m_Blacklist.Count(); i++ )
{
if ( m_Blacklist[i].m_nServerID == iServerID )
{
Expand All @@ -195,9 +195,9 @@ void CBlacklistedServerManager::RemoveServer( int iServerID )
//-----------------------------------------------------------------------------
// Purpose: Given a serverID, return its blacklist entry
//-----------------------------------------------------------------------------
blacklisted_server_t *CBlacklistedServerManager::GetServer( int iServerID )
blacklisted_server_t *CBlacklistedServerManager::GetServer( intp iServerID )
{
for ( int i = 0; i < m_Blacklist.Count(); i++ )
for ( intp i = 0; i < m_Blacklist.Count(); i++ )
{
if ( m_Blacklist[i].m_nServerID == iServerID )
return &m_Blacklist[i];
Expand Down
4 changes: 2 additions & 2 deletions common/ServerBrowser/blacklisted_server_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ class CBlacklistedServerManager
blacklisted_server_t *AddServer( const char *serverName, uint32 serverIP, int serverPort );
blacklisted_server_t *AddServer( const char *serverName, const char *netAddressString, uint32 timestamp );

void RemoveServer( int iServerID ); // remove server with matching 'server id' from list
void RemoveServer( intp iServerID ); // remove server with matching 'server id' from list

void SaveToFile( const char *filename );
int LoadServersFromFile( const char *pszFilename, bool bResetTimes ); // returns count of appended servers, zero for failure

blacklisted_server_t *GetServer( int iServerID ); // return server with matching 'server id'
blacklisted_server_t *GetServer( intp iServerID ); // return server with matching 'server id'
int GetServerCount( void ) const;

const CUtlVector< blacklisted_server_t > &GetServerVector( void ) const;
Expand Down
26 changes: 13 additions & 13 deletions common/crypto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1583,7 +1583,7 @@ bool CCrypto::GenerateSaltedSHA1Digest( const char *pchInput, const Salt_t *pSal
Assert( pSalt );
Assert( pOutDigest );

int iInputLen = Q_strlen( pchInput );
ptrdiff_t iInputLen = Q_strlen( pchInput );
uint8 *pubSaltedInput = new uint8[ iInputLen + sizeof( Salt_t ) ];

// Insert half the salt before the input string and half at the end.
Expand Down Expand Up @@ -1770,7 +1770,7 @@ CCustomHexEncoder::CCustomHexEncoder( const char *pchEncodingTable )
// pchEncodedData - Pointer to string buffer to store output in
// cchEncodedData - Size of pchEncodedData buffer
//-----------------------------------------------------------------------------
bool CCustomHexEncoder::Encode( const uint8 *pubData, const uint32 cubData, char *pchEncodedData, uint32 cchEncodedData )
bool CCustomHexEncoder::Encode( const uint8 *pubData, const size_t cubData, char *pchEncodedData, size_t cchEncodedData )
{
VPROF_BUDGET( "CCrypto::CustomHexEncode", VPROF_BUDGETGROUP_ENCRYPTION );
Assert( pubData );
Expand All @@ -1788,7 +1788,7 @@ bool CCustomHexEncoder::Encode( const uint8 *pubData, const uint32 cubData, char
hexEncoder.Put( pubData, cubData );
hexEncoder.MessageEnd();

uint32 len = pArraySinkOutput->TotalPutLength();
size_t len = pArraySinkOutput->TotalPutLength();
pchEncodedData[len] = 0; // NULL-terminate
if ( len >= cchEncodedData )
{
Expand All @@ -1810,7 +1810,7 @@ bool CCustomHexEncoder::Encode( const uint8 *pubData, const uint32 cubData, char
// output buffer. At exit, is filled in with actual size
// of decoded data.
//-----------------------------------------------------------------------------
bool CCustomHexEncoder::Decode( const char *pchData, uint8 *pubDecodedData, uint32 *pcubDecodedData )
bool CCustomHexEncoder::Decode( const char *pchData, uint8 *pubDecodedData, size_t *pcubDecodedData )
{
VPROF_BUDGET( "CCrypto::CustomHexDecode", VPROF_BUDGETGROUP_ENCRYPTION );
Assert( pchData );
Expand All @@ -1827,7 +1827,7 @@ bool CCustomHexEncoder::Decode( const char *pchData, uint8 *pubDecodedData, uint
hexDecoder.Put( (byte *) pchData, Q_strlen( pchData ) );
hexDecoder.MessageEnd();

uint32 len = pArraySinkOutput->TotalPutLength();
size_t len = pArraySinkOutput->TotalPutLength();
if ( len > *pcubDecodedData )
{
AssertMsg2( false, "CCrypto::CustomHexDecode: insufficient output buffer for decoding, needed %d got %d\n",
Expand Down Expand Up @@ -1872,7 +1872,7 @@ CCustomBase32Encoder::CCustomBase32Encoder( const char *pchEncodingTable )
// pchEncodedData - Pointer to string buffer to store output in
// cchEncodedData - Size of pchEncodedData buffer
//-----------------------------------------------------------------------------
bool CCustomBase32Encoder::Encode( const uint8 *pubData, const uint32 cubData, char *pchEncodedData, uint32 cchEncodedData )
bool CCustomBase32Encoder::Encode( const uint8 *pubData, const size_t cubData, char *pchEncodedData, size_t cchEncodedData )
{
VPROF_BUDGET( "CCrypto::CustomBase32Encode", VPROF_BUDGETGROUP_ENCRYPTION );
Assert( pubData );
Expand All @@ -1890,7 +1890,7 @@ bool CCustomBase32Encoder::Encode( const uint8 *pubData, const uint32 cubData, c
base32Encoder.Put( pubData, cubData );
base32Encoder.MessageEnd();

uint32 len = pArraySinkOutput->TotalPutLength();
size_t len = pArraySinkOutput->TotalPutLength();
pchEncodedData[len] = 0; // NULL-terminate
if ( len >= cchEncodedData )
{
Expand All @@ -1912,7 +1912,7 @@ bool CCustomBase32Encoder::Encode( const uint8 *pubData, const uint32 cubData, c
// output buffer. At exit, is filled in with actual size
// of decoded data.
//-----------------------------------------------------------------------------
bool CCustomBase32Encoder::Decode( const char *pchData, uint8 *pubDecodedData, uint32 *pcubDecodedData )
bool CCustomBase32Encoder::Decode( const char *pchData, uint8 *pubDecodedData, size_t *pcubDecodedData )
{
VPROF_BUDGET( "CCrypto::CustomBase32Decode", VPROF_BUDGETGROUP_ENCRYPTION );
Assert( pchData );
Expand All @@ -1929,7 +1929,7 @@ bool CCustomBase32Encoder::Decode( const char *pchData, uint8 *pubDecodedData, u
base32Decoder.Put( (byte *) pchData, Q_strlen( pchData ) );
base32Decoder.MessageEnd();

uint32 len = pArraySinkOutput->TotalPutLength();
size_t len = pArraySinkOutput->TotalPutLength();
if ( len > *pcubDecodedData )
{
AssertMsg2( false, "CCrypto::CustomBase32Decode: insufficient output buffer for decoding, needed %d got %d\n",
Expand All @@ -1951,7 +1951,7 @@ bool CCustomBase32Encoder::Decode( const char *pchData, uint8 *pubDecodedData, u
// pchEncodedData - Pointer to string buffer to store output in
// cchEncodedData - Size of pchEncodedData buffer
//-----------------------------------------------------------------------------
bool CCustomBase32Encoder::Encode( CSimpleBitString *pBitStringData, char *pchEncodedData, uint32 cchEncodedData )
bool CCustomBase32Encoder::Encode( CSimpleBitString *pBitStringData, char *pchEncodedData, size_t cchEncodedData )
{
// This is useful if you have, say, 125 bits of information and
// want to encode them into 25 base32-encoded characters.
Expand Down Expand Up @@ -2104,7 +2104,7 @@ bool CCrypto::BGeneratePBKDF2Hash( const char* pchInput, const Salt_t &Salt, uns
{
PKCS5_PBKDF2_HMAC<SHA256> pbkdf;

unsigned int iterations = pbkdf.DeriveKey( (byte *)&OutPasswordHash.pbkdf2, sizeof(OutPasswordHash.pbkdf2), 0, (const byte *)pchInput, Q_strlen(pchInput), (const byte *)&Salt, sizeof(Salt), rounds );
size_t iterations = pbkdf.DeriveKey( (byte *)&OutPasswordHash.pbkdf2, sizeof(OutPasswordHash.pbkdf2), 0, (const byte *)pchInput, Q_strlen(pchInput), (const byte *)&Salt, sizeof(Salt), rounds );

return ( iterations == rounds );
}
Expand All @@ -2122,7 +2122,7 @@ bool CCrypto::BGenerateWrappedSHA1PasswordHash( const char *pchInput, const Salt
if ( bResult )
{
PKCS5_PBKDF2_HMAC<SHA256> pbkdf;
unsigned int iterations = pbkdf.DeriveKey( (byte *)&OutPasswordHash.pbkdf2, sizeof(OutPasswordHash.pbkdf2), 0, (const byte *)&OutPasswordHash.sha, sizeof(OutPasswordHash.sha), (const byte *)&Salt, sizeof(Salt), rounds );
size_t iterations = pbkdf.DeriveKey( (byte *)&OutPasswordHash.pbkdf2, sizeof(OutPasswordHash.pbkdf2), 0, (const byte *)&OutPasswordHash.sha, sizeof(OutPasswordHash.sha), (const byte *)&Salt, sizeof(Salt), rounds );

bResult = ( iterations == rounds );
}
Expand Down Expand Up @@ -2171,7 +2171,7 @@ bool CCrypto::BUpgradeOrWrapPasswordHash( PasswordHash_t &InPasswordHash, EPassw

PKCS5_PBKDF2_HMAC<SHA256> pbkdf;
PasswordHash_t passOut;
unsigned int iterations = pbkdf.DeriveKey( (byte *)passOut.pbkdf2, sizeof(passOut.pbkdf2), 0, pbHash, k_HashLengths[k_EHashSHA1], (const byte *)&Salt, sizeof(Salt), 10000 );
size_t iterations = pbkdf.DeriveKey( (byte *)passOut.pbkdf2, sizeof(passOut.pbkdf2), 0, pbHash, k_HashLengths[k_EHashSHA1], (const byte *)&Salt, sizeof(Salt), 10000 );

bResult = ( iterations == 10000 );
if ( bResult )
Expand Down
10 changes: 5 additions & 5 deletions common/crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ class CCustomHexEncoder
CCustomHexEncoder( const char *pchEncodingTable );
~CCustomHexEncoder() = default;

bool Encode( const uint8 *pubData, const uint32 cubData, char *pchEncodedData, uint32 cchEncodedData );
bool Decode( const char *pchData, uint8 *pubDecodedData, uint32 *pcubDecodedData );
bool Encode( const uint8 *pubData, const size_t cubData, char *pchEncodedData, size_t cchEncodedData );
bool Decode( const char *pchData, uint8 *pubDecodedData, size_t *pcubDecodedData );

private:
bool m_bValidEncoding;
Expand All @@ -263,10 +263,10 @@ class CCustomBase32Encoder
CCustomBase32Encoder( const char *pchEncodingTable );
~CCustomBase32Encoder() = default;

bool Encode( const uint8 *pubData, const uint32 cubData, char *pchEncodedData, uint32 cchEncodedData );
bool Decode( const char *pchData, uint8 *pubDecodedData, uint32 *pcubDecodedData );
bool Encode( const uint8 *pubData, const size_t cubData, char *pchEncodedData, size_t cchEncodedData );
bool Decode( const char *pchData, uint8 *pubDecodedData, size_t *pcubDecodedData );

bool Encode( CSimpleBitString *pBitStringData, char *pchEncodedData, uint32 cchEncodedData );
bool Encode( CSimpleBitString *pBitStringData, char *pchEncodedData, size_t cchEncodedData );
bool Decode( const char *pchData, CSimpleBitString *pBitStringDecodedData );

private:
Expand Down
2 changes: 1 addition & 1 deletion common/imageutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1463,7 +1463,7 @@ ConversionErrorType ImgUtl_ConvertTGAToVTF(const char *tgaPath, int nMaxWidth/*=

int imageMemoryFootprint = header.width * header.height * header.bits / 8;

CUtlBuffer inbuf(0, imageMemoryFootprint);
CUtlBuffer inbuf((intp)0, imageMemoryFootprint);

// read in the image
int nBytesRead = fread(inbuf.Base(), imageMemoryFootprint, 1, infile);
Expand Down
2 changes: 1 addition & 1 deletion common/netmessages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1752,7 +1752,7 @@ bool SVC_Menu::ReadFromBuffer( bf_read &buffer )
m_Type = (DIALOG_TYPE)buffer.ReadShort();
m_iLength = buffer.ReadWord();

CUtlBuffer buf( 0, m_iLength );
CUtlBuffer buf( (intp)0, m_iLength );
buffer.ReadBytes( buf.Base(), m_iLength );
buf.SeekPut( CUtlBuffer::SEEK_HEAD, m_iLength );

Expand Down
36 changes: 18 additions & 18 deletions datacache/datacache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@ void CDataCacheSection::GetStatus( DataCacheStatus_t *pStatus, DataCacheLimits_t
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
void CDataCacheSection::EnsureCapacity( unsigned nBytes, unsigned nItems )
void CDataCacheSection::EnsureCapacity( size_t nBytes, size_t nItems )
{
VPROF( "CDataCacheSection::EnsureCapacity" );

if ( m_limits.nMaxItems != (unsigned)-1 || m_limits.nMaxBytes != (unsigned)-1 )
if ( m_limits.nMaxItems != (size_t)-1 || m_limits.nMaxBytes != (size_t)-1 )
{
unsigned nNewSectionBytes = GetNumBytes() + nBytes;
size_t nNewSectionBytes = GetNumBytes() + nBytes;

if ( nNewSectionBytes > m_limits.nMaxBytes )
{
Expand All @@ -171,15 +171,15 @@ void CDataCacheSection::EnsureCapacity( unsigned nBytes, unsigned nItems )
//-----------------------------------------------------------------------------
// Purpose: Add an item to the cache. Purges old items if over budget, returns false if item was already in cache.
//-----------------------------------------------------------------------------
bool CDataCacheSection::Add( DataCacheClientID_t clientId, const void *pItemData, unsigned size, DataCacheHandle_t *pHandle )
bool CDataCacheSection::Add( DataCacheClientID_t clientId, const void *pItemData, size_t size, DataCacheHandle_t *pHandle )
{
return AddEx( clientId, pItemData, size, DCAF_DEFAULT, pHandle );
}

//-----------------------------------------------------------------------------
// Purpose: Add an item to the cache. Purges old items if over budget, returns false if item was already in cache.
//-----------------------------------------------------------------------------
bool CDataCacheSection::AddEx( DataCacheClientID_t clientId, const void *pItemData, unsigned size, unsigned flags, DataCacheHandle_t *pHandle )
bool CDataCacheSection::AddEx( DataCacheClientID_t clientId, const void *pItemData, size_t size, unsigned flags, DataCacheHandle_t *pHandle )
{
VPROF( "CDataCacheSection::Add" );

Expand Down Expand Up @@ -292,13 +292,13 @@ DataCacheHandle_t CDataCacheSection::DoFind( DataCacheClientID_t clientId )
//-----------------------------------------------------------------------------
// Purpose: Get an item out of the cache and remove it. No callbacks are executed.
//-----------------------------------------------------------------------------
DataCacheRemoveResult_t CDataCacheSection::Remove( DataCacheHandle_t handle, const void **ppItemData, unsigned *pItemSize, bool bNotify )
DataCacheRemoveResult_t CDataCacheSection::Remove( DataCacheHandle_t handle, const void **ppItemData, size_t *pItemSize, bool bNotify )
{
VPROF( "CDataCacheSection::Remove" );

if ( handle != DC_INVALID_HANDLE )
{
memhandle_t lruHandle = (memhandle_t)handle;
memhandle_t lruHandle = handle;
if ( m_LRU.LockCount( lruHandle ) > 0 )
{
return DC_LOCKED;
Expand Down Expand Up @@ -376,7 +376,7 @@ int CDataCacheSection::Unlock( DataCacheHandle_t handle )
if ( handle != DC_INVALID_HANDLE )
{
AssertMsg( AccessItem( (memhandle_t)handle ) != NULL, "Attempted to unlock nonexistent cache entry" );
unsigned nBytesUnlocked = 0;
size_t nBytesUnlocked = 0;
m_mutex.Lock();
iNewLockCount = m_LRU.UnlockResource( (memhandle_t)handle );
if ( iNewLockCount == 0 )
Expand Down Expand Up @@ -619,7 +619,7 @@ bool CDataCacheSection::Age( DataCacheHandle_t handle )
//-----------------------------------------------------------------------------
// Purpose: Empty the cache. Returns bytes released, will remove locked items if force specified
//-----------------------------------------------------------------------------
unsigned CDataCacheSection::Flush( bool bUnlockedOnly, bool bNotify )
size_t CDataCacheSection::Flush( bool bUnlockedOnly, bool bNotify )
{
VPROF( "CDataCacheSection::Flush" );

Expand All @@ -630,8 +630,8 @@ unsigned CDataCacheSection::Flush( bool bUnlockedOnly, bool bNotify )
memhandle_t hCurrent;
memhandle_t hNext;

unsigned nBytesFlushed = 0;
unsigned nBytesCurrent = 0;
size_t nBytesFlushed = 0;
size_t nBytesCurrent = 0;

hCurrent = GetFirstUnlockedItem();

Expand Down Expand Up @@ -671,14 +671,14 @@ unsigned CDataCacheSection::Flush( bool bUnlockedOnly, bool bNotify )
//-----------------------------------------------------------------------------
// Purpose: Dump the oldest items to free the specified amount of memory. Returns amount actually freed
//-----------------------------------------------------------------------------
unsigned CDataCacheSection::Purge( unsigned nBytes )
size_t CDataCacheSection::Purge( size_t nBytes )
{
VPROF( "CDataCacheSection::Purge" );

AUTO_LOCK( m_mutex );

unsigned nBytesPurged = 0;
unsigned nBytesCurrent = 0;
size_t nBytesPurged = 0;
size_t nBytesCurrent = 0;

memhandle_t hCurrent = GetFirstUnlockedItem();
memhandle_t hNext;
Expand All @@ -702,7 +702,7 @@ unsigned CDataCacheSection::Purge( unsigned nBytes )
//-----------------------------------------------------------------------------
// Purpose: Dump the oldest items to free the specified number of items. Returns number actually freed
//-----------------------------------------------------------------------------
unsigned CDataCacheSection::PurgeItems( unsigned nItems )
size_t CDataCacheSection::PurgeItems( size_t nItems )
{
AUTO_LOCK( m_mutex );

Expand Down Expand Up @@ -740,7 +740,7 @@ void CDataCacheSection::OutputReport( DataCacheReportType_t reportType )
// Input : handle -
// newSize -
//-----------------------------------------------------------------------------
void CDataCacheSection::UpdateSize( DataCacheHandle_t handle, unsigned int nNewSize )
void CDataCacheSection::UpdateSize( DataCacheHandle_t handle, size_t nNewSize )
{
DataCacheItem_t *pItem = m_LRU.LockResource( (memhandle_t)handle );
if ( !pItem )
Expand All @@ -749,14 +749,14 @@ void CDataCacheSection::UpdateSize( DataCacheHandle_t handle, unsigned int nNewS
return;
}

unsigned oldSize = pItem->size;
size_t oldSize = pItem->size;

if ( oldSize != nNewSize )
{
// Update the size
pItem->size = nNewSize;

int bytesAdded = nNewSize - oldSize;
ptrdiff_t bytesAdded = (ptrdiff_t)nNewSize - (ptrdiff_t)oldSize;
// If change would grow cache size, then purge items until we have room
if ( bytesAdded > 0 )
{
Expand Down
Loading

0 comments on commit ac30a49

Please sign in to comment.