Skip to content

Commit 9c67f08

Browse files
committed
Port to musl libc
Closes nillerusr#72 and uses some patches from nillerusr#193 for better portability between UNIXes. Also this patch replaces so many NULLs with 0 or '\0' because musl headers redefines it and anyway it is better practice. Moreover, due to very "cool" code from Valve, some modules comes with disabled fortify which distributes with build-base in Alpine (fortify is something like compile-time checking for memory bounds)
1 parent b38bccd commit 9c67f08

File tree

113 files changed

+295
-315
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+295
-315
lines changed

appframework/sdlmgr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ class CSDLMgr : public ILauncherMgr
270270

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

@@ -1004,7 +1004,7 @@ int CSDLMgr::GetEvents( CCocoaEvent *pEvents, int nMaxEventsToReturn, bool debug
10041004
return nToWrite;
10051005
}
10061006

1007-
#if defined(LINUX) || defined(PLATFORM_BSD)
1007+
#if defined(POSIX) && !defined(OSX)
10081008

10091009
int CSDLMgr::PeekAndRemoveKeyboardEvents( bool *pbEsc, bool *pbReturn, bool *pbSpace, bool debugEvent )
10101010
{

appframework/wscript

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def build(bld):
4141

4242
includes = [
4343
'.',
44+
'../common',
4445
'../public',
4546
'../public/tier0',
4647
'../public/tier1'

common/freetype/config/ftconfig.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
#ifdef ANDROID
55
#include <sys/cdefs.h>
6-
#elif defined(OSX) || defined(PLATFORM_BSD)
7-
#include <stdint.h>
86
#else
97
#include <bits/wordsize.h>
108
#endif

common/vgui_surfacelib/FontManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#endif
1313

1414
#include <vgui/VGUI.h>
15-
#include "vgui_surfacelib/FontAmalgam.h"
15+
#include "common/vgui_surfacelib/FontAmalgam.h"
1616
#include "materialsystem/imaterialsystem.h"
1717
#include "filesystem.h"
1818
#include "vguifont.h"

engine/audio/snd_mix.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1999,7 +1999,7 @@ void CChannelCullList::Initialize( CChannelList &list )
19991999
else
20002000
{
20012001
m_channelInfo[i].m_vol = -1;
2002-
m_channelInfo[i].m_nameHash = NULL; // doesn't matter
2002+
m_channelInfo[i].m_nameHash = 0; // doesn't matter
20032003
}
20042004
}
20052005

engine/bugreporter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
#define BUG_REPOSITORY_URL "\\\\fileserver\\bugs"
111111
#elif defined(OSX)
112112
#define BUG_REPOSITORY_URL "/Volumes/bugs"
113-
#elif defined(LINUX) || defined(PLATFORM_BSD)
113+
#elif defined(POSIX)
114114
#define BUG_REPOSITORY_URL "\\\\fileserver\\bugs"
115115
#else
116116
//#error
@@ -2257,7 +2257,7 @@ void NonFileSystem_CreatePath (const char *path)
22572257
}
22582258
}
22592259

2260-
#if defined(LINUX) || defined(PLATFORM_BSD)
2260+
#if defined(POSIX) && !defined(OSX)
22612261
#define COPYFILE_ALL 0
22622262
#define BSIZE 65535
22632263
int copyfile( const char *local, const char *remote, void *ignored, int ignoredFlags )

engine/disp_interface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1298,7 +1298,7 @@ int DispInfo_ComputeIndex( HDISPINFOARRAY hArray, IDispInfo* pInfo )
12981298
{
12991299
CDispArray *pArray = static_cast<CDispArray*>( hArray );
13001300
if( !pArray )
1301-
return NULL;
1301+
return 0;
13021302

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

engine/disp_mapload.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ CDispInfo::CDispInfo()
801801

802802
m_pMesh = NULL;
803803

804-
m_Tag = NULL;
804+
m_Tag = 0;
805805
m_pDispArray = NULL;
806806

807807
m_FirstDecal = DISP_DECAL_HANDLE_INVALID;

engine/downloadthread.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,12 +587,12 @@ static size_t curlHeaderFn( void *ptr, size_t size, size_t nmemb, void *stream)
587587
char *pszValue = NULL;
588588
RequestContext_t *pRC = (RequestContext_t *) stream;
589589

590-
pszHeader[ ( size * nmemb - 1 ) ] = NULL;
590+
pszHeader[ ( size * nmemb - 1 ) ] = '\0';
591591
pszValue = Q_strstr( pszHeader, ":" );
592592
if ( pszValue )
593593
{
594594
// null terminate the header name, and point pszValue at it's value
595-
*pszValue = NULL;
595+
*pszValue = '\0';
596596
pszValue++;
597597
Q_StrTrim( pszValue );
598598
}

engine/saverestore_filesystem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class CSaveDirectory
7979
pBuffer = NULL;
8080
pCompressedBuffer = NULL;
8181
nSize = 0;
82-
nCompressedSize = NULL;
82+
nCompressedSize = 0;
8383
}
8484

8585

0 commit comments

Comments
 (0)