Skip to content

Port to musl libc #241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions appframework/sdlmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ class CSDLMgr : public ILauncherMgr

// Get the next N events. The function returns the number of events that were filled into your array.
virtual int GetEvents( CCocoaEvent *pEvents, int nMaxEventsToReturn, bool debugEvents = false );
#if defined(LINUX) || defined(PLATFORM_BSD)
#if defined(POSIX) && !defined(OSX)
virtual int PeekAndRemoveKeyboardEvents( bool *pbEsc, bool *pbReturn, bool *pbSpace, bool debugEvent = false );
#endif

Expand Down Expand Up @@ -1004,7 +1004,7 @@ int CSDLMgr::GetEvents( CCocoaEvent *pEvents, int nMaxEventsToReturn, bool debug
return nToWrite;
}

#if defined(LINUX) || defined(PLATFORM_BSD)
#if defined(POSIX) && !defined(OSX)

int CSDLMgr::PeekAndRemoveKeyboardEvents( bool *pbEsc, bool *pbReturn, bool *pbSpace, bool debugEvent )
{
Expand Down
1 change: 1 addition & 0 deletions appframework/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def build(bld):

includes = [
'.',
'../common',
'../public',
'../public/tier0',
'../public/tier1'
Expand Down
2 changes: 0 additions & 2 deletions common/freetype/config/ftconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

#ifdef ANDROID
#include <sys/cdefs.h>
#elif defined(OSX) || defined(PLATFORM_BSD)
#include <stdint.h>
#else
#include <bits/wordsize.h>
#endif
Expand Down
2 changes: 1 addition & 1 deletion common/vgui_surfacelib/FontManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#endif

#include <vgui/VGUI.h>
#include "vgui_surfacelib/FontAmalgam.h"
#include "common/vgui_surfacelib/FontAmalgam.h"
#include "materialsystem/imaterialsystem.h"
#include "filesystem.h"
#include "vguifont.h"
Expand Down
2 changes: 1 addition & 1 deletion engine/audio/snd_mix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1999,7 +1999,7 @@ void CChannelCullList::Initialize( CChannelList &list )
else
{
m_channelInfo[i].m_vol = -1;
m_channelInfo[i].m_nameHash = NULL; // doesn't matter
m_channelInfo[i].m_nameHash = 0; // doesn't matter
}
}

Expand Down
4 changes: 2 additions & 2 deletions engine/bugreporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
#define BUG_REPOSITORY_URL "\\\\fileserver\\bugs"
#elif defined(OSX)
#define BUG_REPOSITORY_URL "/Volumes/bugs"
#elif defined(LINUX) || defined(PLATFORM_BSD)
#elif defined(POSIX)
#define BUG_REPOSITORY_URL "\\\\fileserver\\bugs"
#else
//#error
Expand Down Expand Up @@ -2257,7 +2257,7 @@ void NonFileSystem_CreatePath (const char *path)
}
}

#if defined(LINUX) || defined(PLATFORM_BSD)
#if defined(POSIX) && !defined(OSX)
#define COPYFILE_ALL 0
#define BSIZE 65535
int copyfile( const char *local, const char *remote, void *ignored, int ignoredFlags )
Expand Down
2 changes: 1 addition & 1 deletion engine/disp_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1298,7 +1298,7 @@ int DispInfo_ComputeIndex( HDISPINFOARRAY hArray, IDispInfo* pInfo )
{
CDispArray *pArray = static_cast<CDispArray*>( hArray );
if( !pArray )
return NULL;
return 0;

intp iElement = ((intp)pInfo - (intp)(pArray->m_pDispInfos)) / sizeof(CDispInfo);

Expand Down
2 changes: 1 addition & 1 deletion engine/disp_mapload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ CDispInfo::CDispInfo()

m_pMesh = NULL;

m_Tag = NULL;
m_Tag = 0;
m_pDispArray = NULL;

m_FirstDecal = DISP_DECAL_HANDLE_INVALID;
Expand Down
4 changes: 2 additions & 2 deletions engine/downloadthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,12 +587,12 @@ static size_t curlHeaderFn( void *ptr, size_t size, size_t nmemb, void *stream)
char *pszValue = NULL;
RequestContext_t *pRC = (RequestContext_t *) stream;

pszHeader[ ( size * nmemb - 1 ) ] = NULL;
pszHeader[ ( size * nmemb - 1 ) ] = '\0';
pszValue = Q_strstr( pszHeader, ":" );
if ( pszValue )
{
// null terminate the header name, and point pszValue at it's value
*pszValue = NULL;
*pszValue = '\0';
pszValue++;
Q_StrTrim( pszValue );
}
Expand Down
2 changes: 1 addition & 1 deletion engine/saverestore_filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class CSaveDirectory
pBuffer = NULL;
pCompressedBuffer = NULL;
nSize = 0;
nCompressedSize = NULL;
nCompressedSize = 0;
}


Expand Down
8 changes: 4 additions & 4 deletions engine/sys_dll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1578,22 +1578,22 @@ CON_COMMAND( star_memory, "Dump memory stats" )
{
// get a current stat of available memory
// 32 MB is reserved and fixed by OS, so not reporting to allow memory loggers sync
#ifdef LINUX
#ifdef PLATFORM_GLIBC
struct mallinfo memstats = mallinfo( );
Msg( "sbrk size: %.2f MB, Used: %.2f MB, #mallocs = %d\n",
memstats.arena / ( 1024.0 * 1024.0), memstats.uordblks / ( 1024.0 * 1024.0 ), memstats.hblks );
#elif OSX
struct mstats memstats = mstats( );
Msg( "Available %.2f MB, Used: %.2f MB, #mallocs = %lu\n",
memstats.bytes_free / ( 1024.0 * 1024.0), memstats.bytes_used / ( 1024.0 * 1024.0 ), memstats.chunks_used );
#elif PLATFORM_BSD
# warning TODO: Implement memory stats (peace of sheet of course)
#else // Win32
#elif _WIN32
MEMORYSTATUS stat;
GlobalMemoryStatus( &stat );
Msg( "Available: %.2f MB, Used: %.2f MB, Free: %.2f MB\n",
stat.dwTotalPhys/( 1024.0f*1024.0f ) - 32.0f,
( stat.dwTotalPhys - stat.dwAvailPhys )/( 1024.0f*1024.0f ) - 32.0f,
stat.dwAvailPhys/( 1024.0f*1024.0f ) );
#else
# warning TODO: Implement memory stats (peace of sheet of course)
#endif
}
2 changes: 1 addition & 1 deletion engine/sys_dll2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ static void posix_signal_handler( int i )
#define DO_TRY if ( sigsetjmp( g_mark, 1 ) == 0 )
#define DO_CATCH else

#if defined( OSX ) || defined(PLATFORM_BSD)
#if !defined(PLATFORM_GLIBC)
#define __sighandler_t sig_t
#endif

Expand Down
6 changes: 2 additions & 4 deletions engine/sys_mainwind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
#elif defined(_X360)
// nothing to include for 360
#elif defined(OSX)
#elif defined(LINUX) || defined(PLATFORM_BSD)
#include "tier0/dynfunction.h"
#elif defined(_WIN32)
#elif defined(POSIX) || defined(_WIN32)
#include "tier0/dynfunction.h"
#else
#error
Expand Down Expand Up @@ -833,7 +831,7 @@ LRESULT CGame::WindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
// return 0 if handled message, 1 if not
return lRet;
}
#elif defined(OSX) || defined(LINUX) || defined(_WIN32) || defined(PLATFORM_BSD)
#elif defined(POSIX) || defined(_WIN32)

#else
#error
Expand Down
1 change: 1 addition & 0 deletions game/client/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def build(bld):
includes += game["includes"]
defines = game["defines"]

defines.append('_FORTIFY_SOURCE=0')
defines.remove('PROTECTED_THINGS_ENABLE')

bld.shlib(
Expand Down
2 changes: 1 addition & 1 deletion game/server/ai_basenpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8803,7 +8803,7 @@ void CAI_BaseNPC::DrawDebugGeometryOverlays(void)
{
float r,g,b;
char debugText[255];
debugText[0] = NULL;
debugText[0] = '\0';

if (npcEnemy == GetEnemy())
{
Expand Down
2 changes: 1 addition & 1 deletion game/server/ai_hint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ int CAI_HintManager::FindAllHints( CAI_BaseNPC *pNPC, const Vector &position, co
// If we have no hints, bail
int c = CAI_HintManager::gm_AllHints.Count();
if ( !c )
return NULL;
return 0;

// Remove the nearest flag. It makes now sense with random.
bool hadNearest = hintCriteria.HasFlag( bits_HINT_NODE_NEAREST );
Expand Down
4 changes: 2 additions & 2 deletions game/server/ai_pathfinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1514,7 +1514,7 @@ AI_Waypoint_t *CAI_Pathfinder::BuildRadialRoute( const Vector &vStartPos, const
vNextPos.y += flRadius * sin( flCurAngle );

// Build a route from the last position to the current one
pNextRoute = BuildLocalRoute( vLastPos, vNextPos, NULL, NULL, NO_NODE, fRouteBits, goalTolerance);
pNextRoute = BuildLocalRoute( vLastPos, vNextPos, 0, 0, NO_NODE, fRouteBits, goalTolerance);

// If we can't find a route, we failed
if ( pNextRoute == NULL )
Expand Down Expand Up @@ -1547,7 +1547,7 @@ AI_Waypoint_t *CAI_Pathfinder::BuildRadialRoute( const Vector &vStartPos, const
return NULL;

// Append a path to the final position
pLastRoute = BuildLocalRoute( vLastPos, vGoalPos, NULL, NULL, NO_NODE, bAirRoute ? bits_BUILD_FLY : bits_BUILD_GROUND, goalTolerance );
pLastRoute = BuildLocalRoute( vLastPos, vGoalPos, 0, 0, NO_NODE, bAirRoute ? bits_BUILD_FLY : bits_BUILD_GROUND, goalTolerance );
if ( pLastRoute == NULL )
return NULL;

Expand Down
2 changes: 1 addition & 1 deletion game/server/genericactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void CGenericActor::HandleAnimEvent( animevent_t *pEvent )
//=========================================================
int CGenericActor::GetSoundInterests ( void )
{
return NULL;
return 0;
}

//=========================================================
Expand Down
2 changes: 1 addition & 1 deletion game/server/genericmonster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void CGenericNPC::HandleAnimEvent( animevent_t *pEvent )
//=========================================================
int CGenericNPC::GetSoundInterests ( void )
{
return NULL;
return 0;
}

//=========================================================
Expand Down
2 changes: 1 addition & 1 deletion game/server/hl2/npc_breen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void CNPC_Breen::HandleAnimEvent( animevent_t *pEvent )
//-----------------------------------------------------------------------------
int CNPC_Breen::GetSoundInterests ( void )
{
return NULL;
return 0;
}

//-----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion game/server/hl2/npc_eli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void CNPC_Eli::HandleAnimEvent( animevent_t *pEvent )
//-----------------------------------------------------------------------------
int CNPC_Eli::GetSoundInterests ( void )
{
return NULL;
return 0;
}

//-----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion game/server/hl2/npc_gman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void CNPC_GMan::HandleAnimEvent( animevent_t *pEvent )
//-----------------------------------------------------------------------------
int CNPC_GMan::GetSoundInterests ( void )
{
return NULL;
return 0;
}


Expand Down
2 changes: 1 addition & 1 deletion game/server/hl2/npc_kleiner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void CNPC_Kleiner::HandleAnimEvent( animevent_t *pEvent )
//-----------------------------------------------------------------------------
int CNPC_Kleiner::GetSoundInterests ( void )
{
return NULL;
return 0;
}

//-----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion game/server/hl2/npc_mossman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void CNPC_Mossman::HandleAnimEvent( animevent_t *pEvent )
//-----------------------------------------------------------------------------
int CNPC_Mossman::GetSoundInterests ( void )
{
return NULL;
return 0;
}

//-----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion game/server/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1459,7 +1459,7 @@ void CBasePlayer::PackDeadPlayerItems( void )
int iPW = 0;// index into packweapons array
int iPA = 0;// index into packammo array

memset(rgpPackWeapons, NULL, sizeof(rgpPackWeapons) );
memset(rgpPackWeapons, 0, sizeof(rgpPackWeapons) );
memset(iPackAmmo, -1, sizeof(iPackAmmo) );

// get the game rules
Expand Down
2 changes: 1 addition & 1 deletion game/server/sceneentity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class CSceneManager : public CBaseEntity
CRestoreSceneSound()
{
actor = NULL;
soundname[ 0 ] = NULL;
soundname[ 0 ] = '\0';
soundlevel = SNDLVL_NORM;
time_in_past = 0.0f;
}
Expand Down
1 change: 1 addition & 0 deletions game/server/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def build(bld):
includes += game["includes"]
defines = game["defines"]

defines.append('_FORTIFY_SOURCE=0')
defines.remove('PROTECTED_THINGS_ENABLE')

bld.shlib(
Expand Down
2 changes: 1 addition & 1 deletion game/shared/particle_parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ void ParseParticleEffectsMap( const char *pMapName, bool bLoadSheets, IFileList
CUtlVector<CUtlString> files;
char szMapManifestFilename[MAX_PATH];

szMapManifestFilename[0] = NULL;
szMapManifestFilename[0] = '\0';

if ( pMapName && *pMapName )
{
Expand Down
8 changes: 4 additions & 4 deletions game/shared/soundenvelope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ CSoundPatch *CSoundControllerImp::SoundCreate( IRecipientFilter& filter, int nEn
CSoundPatch *pSound = new CSoundPatch;

// FIXME: This is done so we don't have to futz with the public interface
EHANDLE hEnt = (nEntIndex != -1) ? g_pEntityList->GetNetworkableHandle( nEntIndex ) : NULL;
EHANDLE hEnt = (nEntIndex != -1) ? g_pEntityList->GetNetworkableHandle( nEntIndex ) : 0;
pSound->Init( &filter, hEnt.Get(), CHAN_AUTO, pSoundName, SNDLVL_NORM );

return pSound;
Expand All @@ -1073,7 +1073,7 @@ CSoundPatch *CSoundControllerImp::SoundCreate( IRecipientFilter& filter, int nEn
#endif

CSoundPatch *pSound = new CSoundPatch;
EHANDLE hEnt = (nEntIndex != -1) ? g_pEntityList->GetNetworkableHandle( nEntIndex ) : NULL;
EHANDLE hEnt = (nEntIndex != -1) ? g_pEntityList->GetNetworkableHandle( nEntIndex ) : 0;
pSound->Init( &filter, hEnt.Get(), channel, pSoundName, ATTN_TO_SNDLVL( attenuation ) );

return pSound;
Expand All @@ -1090,7 +1090,7 @@ CSoundPatch *CSoundControllerImp::SoundCreate( IRecipientFilter& filter, int nEn
#endif

CSoundPatch *pSound = new CSoundPatch;
EHANDLE hEnt = (nEntIndex != -1) ? g_pEntityList->GetNetworkableHandle( nEntIndex ) : NULL;
EHANDLE hEnt = (nEntIndex != -1) ? g_pEntityList->GetNetworkableHandle( nEntIndex ) : 0;
pSound->Init( &filter, hEnt.Get(), channel, pSoundName, soundlevel );

return pSound;
Expand All @@ -1101,7 +1101,7 @@ CSoundPatch *CSoundControllerImp::SoundCreate( IRecipientFilter& filter, int nEn
CSoundPatch *pSound = new CSoundPatch;

// FIXME: This is done so we don't have to futz with the public interface
EHANDLE hEnt = (nEntIndex != -1) ? g_pEntityList->GetNetworkableHandle( nEntIndex ) : NULL;
EHANDLE hEnt = (nEntIndex != -1) ? g_pEntityList->GetNetworkableHandle( nEntIndex ) : 0;
pSound->Init( &filter, hEnt.Get(), es.m_nChannel, es.m_pSoundName, es.m_SoundLevel );
pSound->ChangeVolume( es.m_flVolume, 0 );
pSound->ChangePitch( es.m_nPitch, 0 );
Expand Down
Loading