mirror of
https://github.com/glest/glest-source.git
synced 2025-08-21 23:45:14 +02:00
- First mac patch from GeoVah (thanks)
This commit is contained in:
@@ -12,8 +12,13 @@
|
|||||||
#include "platform_util.h"
|
#include "platform_util.h"
|
||||||
#include "platform_common.h"
|
#include "platform_common.h"
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#include <OpenAL/alc.h>
|
||||||
|
#include <OpenAL/al.h>
|
||||||
|
#else
|
||||||
#include <AL/alc.h>
|
#include <AL/alc.h>
|
||||||
#include <AL/al.h>
|
#include <AL/al.h>
|
||||||
|
#endif
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
@@ -419,7 +419,11 @@ int32 getFolderTreeContentsCheckSumRecursively(const string &path, const string
|
|||||||
globfree(&globbuf);
|
globfree(&globbuf);
|
||||||
|
|
||||||
// Look recursively for sub-folders
|
// 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);
|
res = glob(mypath.c_str(), GLOB_ONLYDIR, 0, &globbuf);
|
||||||
|
#endif
|
||||||
if(res < 0) {
|
if(res < 0) {
|
||||||
std::stringstream msg;
|
std::stringstream msg;
|
||||||
msg << "Couldn't scan directory '" << mypath << "': " << strerror(errno);
|
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) {
|
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];
|
const char* p = globbuf.gl_pathv[i];
|
||||||
getFolderTreeContentsCheckSumRecursively(string(p) + "/*", filterFileExt, &checksum);
|
getFolderTreeContentsCheckSumRecursively(string(p) + "/*", filterFileExt, &checksum);
|
||||||
}
|
}
|
||||||
@@ -556,7 +567,11 @@ vector<std::pair<string,int32> > getFolderTreeContentsCheckSumListRecursively(co
|
|||||||
globfree(&globbuf);
|
globfree(&globbuf);
|
||||||
|
|
||||||
// Look recursively for sub-folders
|
// 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);
|
res = glob(mypath.c_str(), GLOB_ONLYDIR, 0, &globbuf);
|
||||||
|
#endif
|
||||||
if(res < 0) {
|
if(res < 0) {
|
||||||
std::stringstream msg;
|
std::stringstream msg;
|
||||||
msg << "Couldn't scan directory '" << mypath << "': " << strerror(errno);
|
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) {
|
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];
|
const char* p = globbuf.gl_pathv[i];
|
||||||
checksumFiles = getFolderTreeContentsCheckSumListRecursively(string(p) + "/*", filterFileExt, &checksumFiles);
|
checksumFiles = getFolderTreeContentsCheckSumListRecursively(string(p) + "/*", filterFileExt, &checksumFiles);
|
||||||
}
|
}
|
||||||
|
@@ -988,8 +988,11 @@ int Socket::send(const void *data, int dataSize) {
|
|||||||
MutexSafeWrapper safeMutex(&dataSynchAccessor);
|
MutexSafeWrapper safeMutex(&dataSynchAccessor);
|
||||||
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//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);
|
bytesSent = ::send(sock, (const char *)data, dataSize, MSG_NOSIGNAL);
|
||||||
|
#endif
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1016,8 +1019,11 @@ int Socket::send(const void *data, int dataSize) {
|
|||||||
|
|
||||||
//if(Socket::isWritable(true) == true) {
|
//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);
|
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);
|
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] #2 EAGAIN during send, trying again returned: %d\n",__FILE__,__FUNCTION__,bytesSent);
|
||||||
//}
|
//}
|
||||||
@@ -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);
|
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;
|
const char *sendBuf = (const char *)data;
|
||||||
|
#ifdef __APPLE__
|
||||||
|
bytesSent = ::send(sock, &sendBuf[totalBytesSent], dataSize - totalBytesSent, SO_NOSIGPIPE);
|
||||||
|
#else
|
||||||
bytesSent = ::send(sock, &sendBuf[totalBytesSent], dataSize - totalBytesSent, MSG_NOSIGNAL);
|
bytesSent = ::send(sock, &sendBuf[totalBytesSent], dataSize - totalBytesSent, MSG_NOSIGNAL);
|
||||||
|
#endif
|
||||||
if(bytesSent > 0) {
|
if(bytesSent > 0) {
|
||||||
totalBytesSent += bytesSent;
|
totalBytesSent += bytesSent;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user