diff --git a/public/filesystem_passthru.h b/public/filesystem_passthru.h index 94735f1f..b5c9b19d 100644 --- a/public/filesystem_passthru.h +++ b/public/filesystem_passthru.h @@ -115,12 +115,13 @@ public: virtual char *ReadLine( char *pOutput, int maxChars, FileHandle_t file ) { return m_pFileSystemPassThru->ReadLine( pOutput, maxChars, file ); } virtual int FPrintf( FileHandle_t file, char *pFormat, ... ) { + char _fmt[] = "%s"; char str[8192]; va_list marker; va_start( marker, pFormat ); _vsnprintf( str, sizeof( str ), pFormat, marker ); va_end( marker ); - return m_pFileSystemPassThru->FPrintf( file, "%s", str ); + return m_pFileSystemPassThru->FPrintf( file, _fmt, str ); } virtual CSysModule *LoadModule( const char *pFileName, const char *pPathID, bool bValidatedDllOnly ) { return m_pFileSystemPassThru->LoadModule( pFileName, pPathID, bValidatedDllOnly ); } virtual void UnloadModule( CSysModule *pModule ) { m_pFileSystemPassThru->UnloadModule( pModule ); } diff --git a/public/tier0/basetypes.h b/public/tier0/basetypes.h index a30fc515..ef36ebdb 100644 --- a/public/tier0/basetypes.h +++ b/public/tier0/basetypes.h @@ -64,6 +64,9 @@ inline T AlignValue( T val, unsigned alignment ) ( ((number) + ((boundary)-1)) / (boundary) ) * (boundary) // In case this ever changes +#if defined M_PI +#undef M_PI +#endif #define M_PI 3.14159265358979323846 #ifndef min diff --git a/public/tier0/platform.h b/public/tier0/platform.h index cc3b6f29..df39adaa 100644 --- a/public/tier0/platform.h +++ b/public/tier0/platform.h @@ -21,7 +21,11 @@ #define NEW_SOFTWARE_LIGHTING // need this for _alloca +#if defined __APPLE__ +#include +#else #include +#endif #ifdef _MSC_VER #include #elif defined __GNUC__ diff --git a/public/tier0/threadtools.h b/public/tier0/threadtools.h index a6e806ab..196f8188 100644 --- a/public/tier0/threadtools.h +++ b/public/tier0/threadtools.h @@ -1052,6 +1052,9 @@ inline CThreadMutex::CThreadMutex() { // enable recursive locks as we need them pthread_mutexattr_init( &m_Attr ); +#if defined __APPLE__ +#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE +#endif pthread_mutexattr_settype( &m_Attr, PTHREAD_MUTEX_RECURSIVE_NP ); pthread_mutex_init( &m_Mutex, &m_Attr ); } diff --git a/public/tier1/KeyValues.h b/public/tier1/KeyValues.h index 69636da5..4f3d04b9 100644 --- a/public/tier1/KeyValues.h +++ b/public/tier1/KeyValues.h @@ -147,8 +147,8 @@ public: void SetColor( const char *keyName, Color value); // Memory allocation (optimized) - void *operator new( unsigned int iAllocSize ); - void *operator new( unsigned int iAllocSize, int nBlockUse, const char *pFileName, int nLine ); + void *operator new( size_t iAllocSize ); + void *operator new( size_t iAllocSize, int nBlockUse, const char *pFileName, int nLine ); void operator delete( void *pMem ); void operator delete( void *pMem, int nBlockUse, const char *pFileName, int nLine ); diff --git a/tier1/KeyValues.cpp b/tier1/KeyValues.cpp index fea17654..89d22f0b 100644 --- a/tier1/KeyValues.cpp +++ b/tier1/KeyValues.cpp @@ -2131,13 +2131,13 @@ bool KeyValues::ReadAsBinary( CUtlBuffer &buffer ) //----------------------------------------------------------------------------- // Purpose: memory allocator //----------------------------------------------------------------------------- -void *KeyValues::operator new( unsigned int iAllocSize ) +void *KeyValues::operator new( size_t iAllocSize ) { MEM_ALLOC_CREDIT(); return KeyValuesSystem()->AllocKeyValuesMemory(iAllocSize); } -void *KeyValues::operator new( unsigned int iAllocSize, int nBlockUse, const char *pFileName, int nLine ) +void *KeyValues::operator new( size_t iAllocSize, int nBlockUse, const char *pFileName, int nLine ) { MemAlloc_PushAllocDbgInfo( pFileName, nLine ); void *p = KeyValuesSystem()->AllocKeyValuesMemory(iAllocSize);