1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2025-09-19 20:16:10 +08:00

More fixes for GCC and Clang builds.

This commit is contained in:
Scott Ehlert
2014-03-02 00:56:59 -06:00
parent 74a371eef4
commit 84ff4858a8
4 changed files with 15 additions and 6 deletions

View File

@ -175,7 +175,7 @@ inline ICvar::Iterator::Iterator(ICvar *icvar)
inline ICvar::Iterator::~Iterator( void ) inline ICvar::Iterator::~Iterator( void )
{ {
free(m_pIter); MemAlloc_Free(m_pIter);
} }
inline void ICvar::Iterator::SetFirst( void ) inline void ICvar::Iterator::SetFirst( void )

View File

@ -18,8 +18,9 @@
#include "basehandle.h" #include "basehandle.h"
#endif #endif
#if defined( COMPILER_MSVC )
#pragma warning( disable : 4284 ) // warning C4284: return type for 'CNetworkVarT<int>::operator ->' is 'int *' (ie; not a UDT or reference to a UDT. Will produce errors if applied using infix notation) #pragma warning( disable : 4284 ) // warning C4284: return type for 'CNetworkVarT<int>::operator ->' is 'int *' (ie; not a UDT or reference to a UDT. Will produce errors if applied using infix notation)
#endif
#define MyOffsetOf( type, var ) ( (int)&((type*)0)->var ) #define MyOffsetOf( type, var ) ( (int)&((type*)0)->var )
@ -57,7 +58,7 @@ public:
{ {
if ( pData ) if ( pData )
{ {
g_pMemAlloc->Free(pData); MemAlloc_Free(pData);
} }
} }
@ -65,7 +66,7 @@ public:
{ {
if ( pData ) if ( pData )
{ {
g_pMemAlloc->Free(pData, pFileName, nLine ); MemAlloc_Free(pData, pFileName, nLine);
} }
} }
}; };

View File

@ -37,7 +37,7 @@
#define MEM_DEBUG_CLASSNAME 1 #define MEM_DEBUG_CLASSNAME 1
#include <stddef.h> #include <stddef.h>
#if defined(OSX) #if defined( OSX )
#include <malloc/malloc.h> #include <malloc/malloc.h>
#endif #endif
@ -178,6 +178,14 @@ inline void *MemAlloc_Alloc( size_t nSize, const char *pFileName, int nLine )
return g_pMemAlloc->IndirectAlloc( nSize, pFileName, nLine ); return g_pMemAlloc->IndirectAlloc( nSize, pFileName, nLine );
} }
#endif #endif
inline void MemAlloc_Free( void *ptr )
{
g_pMemAlloc->Free( ptr );
}
inline void MemAlloc_Free( void *ptr, const char *pFileName, int nLine )
{
g_pMemAlloc->Free( ptr, pFileName, nLine );
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -104,7 +104,7 @@ protected:
// constructor, destructor // constructor, destructor
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template <typename T, bool bCaseInsensitive, bool bDupeStrings> template <typename T, bool bCaseInsensitive, bool bDupeStrings>
CUtlHashDict<T, bCaseInsensitive, bDupeStrings>::CUtlHashDict( int bucketCount = 16, int growCount = 0, int initCount = 0 ) : CUtlHashDict<T, bCaseInsensitive, bDupeStrings>::CUtlHashDict( int bucketCount, int growCount, int initCount ) :
m_Elements( SmallestPowerOfTwoGreaterOrEqual(bucketCount), growCount, initCount ) m_Elements( SmallestPowerOfTwoGreaterOrEqual(bucketCount), growCount, initCount )
{ {
Assert( SmallestPowerOfTwoGreaterOrEqual(bucketCount) <= 0xffff ); Assert( SmallestPowerOfTwoGreaterOrEqual(bucketCount) <= 0xffff );