1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2025-09-20 04:26:03 +08:00

More portions of the SDK compile (and link!) on Mac OS X (bug 4392, r=dvander).

SourceMod compiles and links now. Hurray! Most plugins may also but there may be more work to do.
This commit is contained in:
Scott Ehlert
2010-05-13 04:08:37 -05:00
parent 7daeca53eb
commit b06949c4cc
29 changed files with 92 additions and 85 deletions

View File

@ -46,7 +46,7 @@
#include <stdio.h>
#include <stdarg.h>
#ifdef _LINUX
#if defined _LINUX || defined __APPLE__
#include <ctype.h>
#include <unistd.h>
#include <stdlib.h>
@ -650,7 +650,7 @@ int V_snwprintf( wchar_t *pDest, int maxLen, const wchar_t *pFormat, ... )
va_start( marker, pFormat );
#ifdef _WIN32
int len = _snwprintf( pDest, maxLen, pFormat, marker );
#elif _LINUX
#elif defined _LINUX || defined __APPLE__
int len = swprintf( pDest, maxLen, pFormat, marker );
#else
#error "define vsnwprintf type."
@ -679,7 +679,7 @@ int V_snprintf( char *pDest, int maxLen, char const *pFormat, ... )
va_start( marker, pFormat );
#ifdef _WIN32
int len = _vsnprintf( pDest, maxLen, pFormat, marker );
#elif _LINUX
#elif defined _LINUX || defined __APPLE__
int len = vsnprintf( pDest, maxLen, pFormat, marker );
#else
#error "define vsnprintf type."
@ -947,7 +947,7 @@ int V_UTF8ToUnicode( const char *pUTF8, wchar_t *pwchDest, int cubDestSizeInByte
pwchDest[0] = 0;
#ifdef _WIN32
int cchResult = MultiByteToWideChar( CP_UTF8, 0, pUTF8, -1, pwchDest, cubDestSizeInBytes / sizeof(wchar_t) );
#elif _LINUX
#elif defined _LINUX || defined __APPLE__
int cchResult = mbstowcs( pwchDest, pUTF8, cubDestSizeInBytes / sizeof(wchar_t) );
#endif
pwchDest[(cubDestSizeInBytes / sizeof(wchar_t)) - 1] = 0;
@ -965,7 +965,7 @@ int V_UnicodeToUTF8( const wchar_t *pUnicode, char *pUTF8, int cubDestSizeInByte
pUTF8[0] = 0;
#ifdef _WIN32
int cchResult = WideCharToMultiByte( CP_UTF8, 0, pUnicode, -1, pUTF8, cubDestSizeInBytes, NULL, NULL );
#elif _LINUX
#elif defined _LINUX || defined __APPLE__
int cchResult = wcstombs( pUTF8, pUnicode, cubDestSizeInBytes );
#endif
pUTF8[cubDestSizeInBytes - 1] = 0;
@ -1249,7 +1249,7 @@ void V_StripFilename (char *path)
#ifdef _WIN32
#define CORRECT_PATH_SEPARATOR '\\'
#define INCORRECT_PATH_SEPARATOR '/'
#elif _LINUX
#elif defined _LINUX || defined __APPLE__
#define CORRECT_PATH_SEPARATOR '/'
#define INCORRECT_PATH_SEPARATOR '\\'
#endif
@ -1839,7 +1839,7 @@ void V_SplitString( const char *pString, const char *pSeparator, CUtlVector<char
bool V_GetCurrentDirectory( char *pOut, int maxLen )
{
#ifdef LINUX
#if defined _LINUX || defined __APPLE__
return getcwd( pOut, maxLen ) == pOut;
#else
return _getcwd( pOut, maxLen ) == pOut;
@ -1849,7 +1849,7 @@ bool V_GetCurrentDirectory( char *pOut, int maxLen )
bool V_SetCurrentDirectory( const char *pDirName )
{
#ifdef LINUX
#if defined _LINUX || defined __APPLE__
return chdir( pDirName ) == 0;
#else
return _chdir( pDirName ) == 0;
@ -1945,7 +1945,7 @@ void V_strtowcs( const char *pString, int nInSize, wchar_t *pWString, int nOutSi
{
*pWString = L'\0';
}
#elif _LINUX
#elif defined _LINUX || defined __APPLE__
if ( mbstowcs( pWString, pString, nOutSize / sizeof(wchar_t) ) <= 0 )
{
*pWString = 0;
@ -1960,7 +1960,7 @@ void V_wcstostr( const wchar_t *pWString, int nInSize, char *pString, int nOutSi
{
*pString = '\0';
}
#elif _LINUX
#elif defined _LINUX || defined __APPLE__
if ( wcstombs( pString, pWString, nOutSize ) <= 0 )
{
*pString = '\0';