- First mac patch from GeoVah (thanks)

This commit is contained in:
Mark Vejvoda 2010-09-11 05:14:42 +00:00
parent ab88a2971a
commit 0c99a516c5
3 changed files with 42 additions and 6 deletions

View File

@ -12,8 +12,13 @@
#include "platform_util.h"
#include "platform_common.h"
#include <SDL.h>
#include <AL/alc.h>
#ifdef __APPLE__
#include <OpenAL/alc.h>
#include <OpenAL/al.h>
#else
#include <AL/alc.h>
#include <AL/al.h>
#endif
#include <vector>
#include "leak_dumper.h"

View File

@ -419,7 +419,11 @@ int32 getFolderTreeContentsCheckSumRecursively(const string &path, const string
globfree(&globbuf);
// Look recursively for sub-folders
#ifdef __APPLE__ //APPLE does'nt have the GLOB_ONLYDIR definition..
res = glob(mypath.c_str(), 0, 0, &globbuf);
#else
res = glob(mypath.c_str(), GLOB_ONLYDIR, 0, &globbuf);
#endif
if(res < 0) {
std::stringstream msg;
msg << "Couldn't scan directory '" << mypath << "': " << strerror(errno);
@ -427,6 +431,13 @@ int32 getFolderTreeContentsCheckSumRecursively(const string &path, const string
}
for(int i = 0; i < globbuf.gl_pathc; ++i) {
#ifdef __APPLE__
struct stat statStruct;
// only process if dir..
int actStat = lstat( globbuf.gl_pathv[i], &statStruct);
if( S_ISDIR(statStruct.st_mode) == 0)
continue;
#endif
const char* p = globbuf.gl_pathv[i];
getFolderTreeContentsCheckSumRecursively(string(p) + "/*", filterFileExt, &checksum);
}
@ -556,7 +567,11 @@ vector<std::pair<string,int32> > getFolderTreeContentsCheckSumListRecursively(co
globfree(&globbuf);
// Look recursively for sub-folders
#ifdef __APPLE__
res = glob(mypath.c_str(), 0, 0, &globbuf);
#else //APPLE doesn't have the GLOB_ONLYDIR definition..
res = glob(mypath.c_str(), GLOB_ONLYDIR, 0, &globbuf);
#endif
if(res < 0) {
std::stringstream msg;
msg << "Couldn't scan directory '" << mypath << "': " << strerror(errno);
@ -564,6 +579,13 @@ vector<std::pair<string,int32> > getFolderTreeContentsCheckSumListRecursively(co
}
for(int i = 0; i < globbuf.gl_pathc; ++i) {
#ifdef __APPLE__
struct stat statStruct;
// only get if dir..
int actStat = lstat( globbuf.gl_pathv[ i], &statStruct);
if( S_ISDIR(statStruct.st_mode) == 0)
continue;
#endif
const char* p = globbuf.gl_pathv[i];
checksumFiles = getFolderTreeContentsCheckSumListRecursively(string(p) + "/*", filterFileExt, &checksumFiles);
}

View File

@ -988,8 +988,11 @@ int Socket::send(const void *data, int dataSize) {
MutexSafeWrapper safeMutex(&dataSynchAccessor);
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
#ifdef __APPLE__
bytesSent = ::send(sock, (const char *)data, dataSize, SO_NOSIGPIPE);
#else
bytesSent = ::send(sock, (const char *)data, dataSize, MSG_NOSIGNAL);
#endif
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
}
@ -1016,9 +1019,12 @@ int Socket::send(const void *data, int dataSize) {
//if(Socket::isWritable(true) == true) {
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] attemptCount = %d, sock = %d, dataSize = %d, data = %p\n",__FILE__,__FUNCTION__,__LINE__,attemptCount,sock,dataSize,data);
#ifdef __APPLE__
bytesSent = ::send(sock, (const char *)data, dataSize, SO_NOSIGPIPE);
#else
bytesSent = ::send(sock, (const char *)data, dataSize, MSG_NOSIGNAL);
#endif
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] #2 EAGAIN during send, trying again returned: %d\n",__FILE__,__FUNCTION__,bytesSent);
//}
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] attemptCount = %d\n",__FILE__,__FUNCTION__,__LINE__,attemptCount);
@ -1042,8 +1048,11 @@ int Socket::send(const void *data, int dataSize) {
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] attemptCount = %d, sock = %d, dataSize = %d, data = %p\n",__FILE__,__FUNCTION__,__LINE__,attemptCount,sock,dataSize,data);
const char *sendBuf = (const char *)data;
bytesSent = ::send(sock, &sendBuf[totalBytesSent], dataSize - totalBytesSent, MSG_NOSIGNAL);
#ifdef __APPLE__
bytesSent = ::send(sock, &sendBuf[totalBytesSent], dataSize - totalBytesSent, SO_NOSIGPIPE);
#else
bytesSent = ::send(sock, &sendBuf[totalBytesSent], dataSize - totalBytesSent, MSG_NOSIGNAL);
#endif
if(bytesSent > 0) {
totalBytesSent += bytesSent;
}