Fixing compilation on Drawin 9 / MacOS X
git-svn-id: http://mc-server.googlecode.com/svn/trunk@402 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
cb2de47247
commit
b789d5ebf6
@ -46,6 +46,10 @@
|
||||
#define MSG_NOSIGNAL (0)
|
||||
#endif
|
||||
|
||||
#ifndef MSG_NOSIGNAL
|
||||
#define MSG_NOSIGNAL 0
|
||||
#endif // MSG_NOSIGNAL
|
||||
|
||||
using namespace std;
|
||||
|
||||
int Socket::nofSockets_= 0;
|
||||
|
@ -26,11 +26,7 @@ cEvent::cEvent(void)
|
||||
m_Event = new sem_t;
|
||||
if (sem_init(m_Event, 0, 0))
|
||||
{
|
||||
LOGWARN("WARNING cEvent: Could not create unnamed semaphore, fallback to named.");
|
||||
|
||||
// _X: I'm unconvinced about using sem_unlink() just after a successful sem_open(), it seems wrong - why destroy the object just after creating?
|
||||
ASSERT(!"This codepath is really weird, if it is ever used, please check that everything works.");
|
||||
|
||||
// This path is used by MacOS, because it doesn't support unnamed semaphores.
|
||||
delete m_Event;
|
||||
m_bIsNamed = true;
|
||||
|
||||
@ -42,13 +38,6 @@ cEvent::cEvent(void)
|
||||
LOGERROR("cEvent: Cannot create event, errno = %i. Aborting server.", errno);
|
||||
abort();
|
||||
}
|
||||
else
|
||||
{
|
||||
if( sem_unlink(EventName.c_str()) != 0 )
|
||||
{
|
||||
LOGWARN("ERROR: Could not unlink cEvent. (%i)", errno);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // *nix
|
||||
}
|
||||
@ -64,6 +53,10 @@ cEvent::~cEvent()
|
||||
#else
|
||||
if (m_bIsNamed)
|
||||
{
|
||||
if (sem_unlink(EventName.c_str()) != 0)
|
||||
{
|
||||
LOGWARN("ERROR: Could not unlink cEvent. (%i)", errno);
|
||||
}
|
||||
if (sem_close(m_Event) != 0)
|
||||
{
|
||||
LOGERROR("ERROR: Could not close cEvent. (%i)", errno);
|
||||
|
@ -84,7 +84,7 @@ cPacket * cMonster::GetSpawnPacket(void) const
|
||||
cPacket_SpawnMob * Spawn = new cPacket_SpawnMob;
|
||||
Spawn->m_UniqueID = GetUniqueID();
|
||||
Spawn->m_Type = m_MobType;
|
||||
*Spawn->m_Pos = Vector3i((m_Pos) * 32);
|
||||
*Spawn->m_Pos = ((Vector3i)(m_Pos)) * 32;
|
||||
Spawn->m_Yaw = 0;
|
||||
Spawn->m_Pitch = 0;
|
||||
Spawn->m_MetaDataSize = 1;
|
||||
|
@ -111,7 +111,7 @@ AString cSocket::GetErrorString( int a_ErrNo )
|
||||
|
||||
// According to http://linux.die.net/man/3/strerror_r there are two versions of strerror_r():
|
||||
|
||||
#if ((((_POSIX_C_SOURCE >= 200112L) || (_XOPEN_SOURCE >= 600)) && ! _GNU_SOURCE) || __CYGWIN32__ ) // XSI version of strerror_r():
|
||||
#if ((((_POSIX_C_SOURCE >= 200112L) || (_XOPEN_SOURCE >= 600)) && ! _GNU_SOURCE && !__APPLE__) || __CYGWIN32__ ) // XSI version of strerror_r():
|
||||
|
||||
int res = strerror_r( errno, buffer, ARRAYCOUNT(buffer) );
|
||||
if( res == 0 )
|
||||
|
Loading…
Reference in New Issue
Block a user