1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2025-07-19 01:58:14 +08:00

Sync with latest source-sdk-2013.

This commit is contained in:
Nicholas Hastings
2014-10-30 12:30:57 -04:00
parent 6abc7fddca
commit aa5841f220
407 changed files with 6784 additions and 10498 deletions

View File

@ -729,7 +729,7 @@ void KeyValues::WriteConvertedString( IBaseFileSystem *filesystem, FileHandle_t
j++;
}
INTERNALWRITE(convertedString, strlen(convertedString));
INTERNALWRITE(convertedString, Q_strlen(convertedString));
}
@ -1352,8 +1352,11 @@ const char *KeyValues::GetString( const char *keyName, const char *defaultValue
Q_snprintf( buf, sizeof( buf ), "%f", dat->m_flValue );
SetString( keyName, buf );
break;
case TYPE_INT:
case TYPE_PTR:
Q_snprintf( buf, sizeof( buf ), "%lld", (int64)(size_t)dat->m_pValue );
SetString( keyName, buf );
break;
case TYPE_INT:
Q_snprintf( buf, sizeof( buf ), "%d", dat->m_iValue );
SetString( keyName, buf );
break;
@ -1402,8 +1405,11 @@ const wchar_t *KeyValues::GetWString( const char *keyName, const wchar_t *defaul
swprintf(wbuf, Q_ARRAYSIZE(wbuf), L"%f", dat->m_flValue);
SetWString( keyName, wbuf);
break;
case TYPE_INT:
case TYPE_PTR:
swprintf( wbuf, Q_ARRAYSIZE(wbuf), L"%lld", (int64)(size_t)dat->m_pValue );
SetWString( keyName, wbuf );
break;
case TYPE_INT:
swprintf( wbuf, Q_ARRAYSIZE(wbuf), L"%d", dat->m_iValue );
SetWString( keyName, wbuf );
break;
@ -1445,10 +1451,17 @@ const wchar_t *KeyValues::GetWString( const char *keyName, const wchar_t *defaul
//-----------------------------------------------------------------------------
// Purpose: Get a bool interpretation of the key.
//-----------------------------------------------------------------------------
bool KeyValues::GetBool( const char *keyName, bool defaultValue )
bool KeyValues::GetBool( const char *keyName, bool defaultValue, bool* optGotDefault )
{
if ( FindKey( keyName ) )
{
if ( optGotDefault )
(*optGotDefault) = false;
return 0 != GetInt( keyName, 0 );
}
if ( optGotDefault )
(*optGotDefault) = true;
return defaultValue;
}
@ -1586,7 +1599,7 @@ void KeyValues::SetWString( const char *keyName, const wchar_t *value )
}
// allocate memory for the new value and copy it in
int len = wcslen( value );
int len = Q_wcslen( value );
dat->m_wsValue = new wchar_t[len + 1];
Q_memcpy( dat->m_wsValue, value, (len+1) * sizeof(wchar_t) );
@ -1832,7 +1845,7 @@ KeyValues *KeyValues::MakeCopy( void ) const
{
if ( m_wsValue )
{
int len = wcslen( m_wsValue );
int len = Q_wcslen( m_wsValue );
newKeyValue->m_wsValue = new wchar_t[len+1];
Q_memcpy( newKeyValue->m_wsValue, m_wsValue, (len+1)*sizeof(wchar_t));
}
@ -1956,9 +1969,8 @@ void KeyValues::ParseIncludedKeys( char const *resourceName, const char *filetoi
Q_strncpy( fullpath, resourceName, sizeof( fullpath ) );
// Strip off characters back to start or first /
bool done = false;
int len = Q_strlen( fullpath );
while ( !done )
for (;;)
{
if ( len <= 0 )
{
@ -2652,13 +2664,13 @@ bool KeyValues::ReadAsBinary( CUtlBuffer &buffer, int nStackDepth )
void *KeyValues::operator new( size_t iAllocSize )
{
MEM_ALLOC_CREDIT();
return KeyValuesSystem()->AllocKeyValuesMemory(iAllocSize);
return KeyValuesSystem()->AllocKeyValuesMemory( (int)iAllocSize );
}
void *KeyValues::operator new( size_t iAllocSize, int nBlockUse, const char *pFileName, int nLine )
{
MemAlloc_PushAllocDbgInfo( pFileName, nLine );
void *p = KeyValuesSystem()->AllocKeyValuesMemory(iAllocSize);
void *p = KeyValuesSystem()->AllocKeyValuesMemory( (int)iAllocSize );
MemAlloc_PopAllocDbgInfo();
return p;
}