- try to fix mac build

This commit is contained in:
SoftCoder 2016-01-18 15:29:16 -08:00
parent b50fe04e0a
commit 0d8377d6b4
15 changed files with 42 additions and 45 deletions

View File

@ -450,7 +450,7 @@ MainWindow::MainWindow( std::pair<string,vector<string> > unitToLoad,
DWORD dwDisposition;
RegCreateKeyEx(HKEY_CURRENT_USER,subKey.c_str(),0, NULL, 0, KEY_ALL_ACCESS, NULL, &keyHandle, &dwDisposition);
//Set the value.
unique_ptr<wchar_t> wstr(Ansi2WideString(appPath.c_str()));
auto_ptr<wchar_t> wstr(Ansi2WideString(appPath.c_str()));
wstring launchApp = wstring(wstr.get()) + L" \"%1\"";
DWORD len = (DWORD)launchApp.length() + 1;
@ -849,7 +849,7 @@ void MainWindow::onMenuFileLoad(wxCommandEvent &event){
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
file = tmp_buf;
unique_ptr<wchar_t> wstr(Ansi2WideString(file.c_str()));
auto_ptr<wchar_t> wstr(Ansi2WideString(file.c_str()));
file = utf8_encode(wstr.get());
#else
file = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
@ -884,7 +884,7 @@ void MainWindow::onMenuFileLoadParticleXML(wxCommandEvent &event){
#ifdef WIN32
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
file = tmp_buf;
unique_ptr<wchar_t> wstr(Ansi2WideString(file.c_str()));
auto_ptr<wchar_t> wstr(Ansi2WideString(file.c_str()));
file = utf8_encode(wstr.get());
#else
file = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
@ -918,7 +918,7 @@ void MainWindow::onMenuFileLoadProjectileParticleXML(wxCommandEvent &event){
#ifdef WIN32
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
file = tmp_buf;
unique_ptr<wchar_t> wstr(Ansi2WideString(file.c_str()));
auto_ptr<wchar_t> wstr(Ansi2WideString(file.c_str()));
file = utf8_encode(wstr.get());
#else
file = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
@ -953,7 +953,7 @@ void MainWindow::onMenuFileLoadSplashParticleXML(wxCommandEvent &event){
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
file = tmp_buf;
unique_ptr<wchar_t> wstr(Ansi2WideString(file.c_str()));
auto_ptr<wchar_t> wstr(Ansi2WideString(file.c_str()));
file = utf8_encode(wstr.get());
#else
file = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
@ -2158,7 +2158,7 @@ bool App::OnInit() {
for(unsigned int i = 0; i < autoScreenShotParams.size(); ++i) {
#ifdef WIN32
unique_ptr<wchar_t> wstr(Ansi2WideString(autoScreenShotParams[i].c_str()));
auto_ptr<wchar_t> wstr(Ansi2WideString(autoScreenShotParams[i].c_str()));
autoScreenShotParams[i] = utf8_encode(wstr.get());
#endif
@ -2203,14 +2203,14 @@ bool App::OnInit() {
if(delimitedList.size() >= 2) {
unitToLoad.first = delimitedList[0];
#ifdef WIN32
unique_ptr<wchar_t> wstr(Ansi2WideString(unitToLoad.first.c_str()));
auto_ptr<wchar_t> wstr(Ansi2WideString(unitToLoad.first.c_str()));
unitToLoad.first = utf8_encode(wstr.get());
#endif
for(unsigned int i = 1; i < delimitedList.size(); ++i) {
string value = delimitedList[i];
#ifdef WIN32
unique_ptr<wchar_t> wstr(Ansi2WideString(value.c_str()));
auto_ptr<wchar_t> wstr(Ansi2WideString(value.c_str()));
value = utf8_encode(wstr.get());
#endif
@ -2249,7 +2249,7 @@ bool App::OnInit() {
string customPathValue = paramPartTokens[1];
modelPath = customPathValue;
#ifdef WIN32
unique_ptr<wchar_t> wstr(Ansi2WideString(modelPath.c_str()));
auto_ptr<wchar_t> wstr(Ansi2WideString(modelPath.c_str()));
modelPath = utf8_encode(wstr.get());
#endif
@ -2279,7 +2279,7 @@ bool App::OnInit() {
string customPathValue = paramPartTokens[1];
particlePath = customPathValue;
#ifdef WIN32
unique_ptr<wchar_t> wstr(Ansi2WideString(particlePath.c_str()));
auto_ptr<wchar_t> wstr(Ansi2WideString(particlePath.c_str()));
particlePath = utf8_encode(wstr.get());
#endif
}
@ -2307,7 +2307,7 @@ bool App::OnInit() {
string customPathValue = paramPartTokens[1];
projectileParticlePath = customPathValue;
#ifdef WIN32
unique_ptr<wchar_t> wstr(Ansi2WideString(projectileParticlePath.c_str()));
auto_ptr<wchar_t> wstr(Ansi2WideString(projectileParticlePath.c_str()));
projectileParticlePath = utf8_encode(wstr.get());
#endif
}
@ -2335,7 +2335,7 @@ bool App::OnInit() {
string customPathValue = paramPartTokens[1];
splashParticlePath = customPathValue;
#ifdef WIN32
unique_ptr<wchar_t> wstr(Ansi2WideString(splashParticlePath.c_str()));
auto_ptr<wchar_t> wstr(Ansi2WideString(splashParticlePath.c_str()));
splashParticlePath = utf8_encode(wstr.get());
#endif
}
@ -2494,7 +2494,7 @@ bool App::OnInit() {
#ifdef WIN32
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(argv[1]));
modelPath = tmp_buf;
unique_ptr<wchar_t> wstr(Ansi2WideString(modelPath.c_str()));
auto_ptr<wchar_t> wstr(Ansi2WideString(modelPath.c_str()));
modelPath = utf8_encode(wstr.get());
#else
modelPath = wxFNCONV(argv[1]);
@ -2524,7 +2524,7 @@ bool App::OnInit() {
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(exe_path));
string appPath = tmp_buf;
unique_ptr<wchar_t> wstr(Ansi2WideString(appPath.c_str()));
auto_ptr<wchar_t> wstr(Ansi2WideString(appPath.c_str()));
appPath = utf8_encode(wstr.get());
#else
string appPath(wxFNCONV(exe_path));

View File

@ -129,7 +129,7 @@ static string runtimeErrorMsg = "";
#endif
#ifdef HAVE_GOOGLE_BREAKPAD
unique_ptr<google_breakpad::ExceptionHandler> errorHandlerPtr;
auto_ptr<google_breakpad::ExceptionHandler> errorHandlerPtr;
#endif
class NavtiveLanguageNameListCacheGenerator : public SimpleTaskCallbackInterface {
@ -5555,8 +5555,8 @@ int glestMain(int argc, char** argv) {
preCacheThread->start();
}
unique_ptr<NavtiveLanguageNameListCacheGenerator> lngCacheGen;
unique_ptr<SimpleTaskThread> languageCacheGen;
auto_ptr<NavtiveLanguageNameListCacheGenerator> lngCacheGen;
auto_ptr<SimpleTaskThread> languageCacheGen;
bool startNativeLanguageNamesPrecacheThread = config.getBool("PreCacheNativeLanguageNamesThread","true");
if(startNativeLanguageNamesPrecacheThread == true &&

View File

@ -243,7 +243,7 @@ private:
bool launchingNewGame;
bool isfirstSwitchingMapMessage;
unique_ptr<TechTree> techTree;
auto_ptr<TechTree> techTree;
GameSettings originalGamesettings;
bool validOriginalGameSettings;

View File

@ -219,7 +219,7 @@ private:
bool masterserverModeMinimalResources;
int lastMasterServerSettingsUpdateCount;
unique_ptr<TechTree> techTree;
auto_ptr<TechTree> techTree;
string gameUUID;

View File

@ -35,7 +35,7 @@ namespace Glest{ namespace Game{
bool NetworkMessage::useOldProtocol = true;
unique_ptr<Mutex> NetworkMessage::mutexMessageStats(new Mutex(CODE_AT_LINE));
auto_ptr<Mutex> NetworkMessage::mutexMessageStats(new Mutex(CODE_AT_LINE));
Chrono NetworkMessage::statsTimer;
Chrono NetworkMessage::lastSend;
Chrono NetworkMessage::lastRecv;

View File

@ -98,7 +98,7 @@ enum NetworkMessageStatisticType {
class NetworkMessage {
private:
static unique_ptr<Mutex> mutexMessageStats;
static auto_ptr<Mutex> mutexMessageStats;
static Chrono statsTimer;
static Chrono lastSend;
static Chrono lastRecv;

View File

@ -177,7 +177,7 @@ Checksum TechTree::loadTech(const string &techName,
bool TechTree::exists(const string &techName, const vector<string> &pathTechList) {
bool techFound = false;
unique_ptr<TechTree> techTree(new TechTree(pathTechList));
auto_ptr<TechTree> techTree(new TechTree(pathTechList));
string path = techTree->findPath(techName);
if(path != "") {
techFound = true;

View File

@ -37,7 +37,7 @@ using namespace Shared::Util;
namespace Glest{ namespace Game{
unique_ptr<CommandType> UnitType::ctHarvestEmergencyReturnCommandType(new HarvestEmergencyReturnCommandType());
auto_ptr<CommandType> UnitType::ctHarvestEmergencyReturnCommandType(new HarvestEmergencyReturnCommandType());
// ===============================
// class Level
// ===============================

View File

@ -234,7 +234,7 @@ private:
UnitCountsInVictoryConditions countInVictoryConditions;
static unique_ptr<CommandType> ctHarvestEmergencyReturnCommandType;
static auto_ptr<CommandType> ctHarvestEmergencyReturnCommandType;
public:
//creation and loading

View File

@ -690,7 +690,7 @@ void MainWindow::onMenuFileLoad(wxCommandEvent &event) {
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(fileDialog->GetPath()));
currentFile = tmp_buf;
unique_ptr<wchar_t> wstr(Ansi2WideString(currentFile.c_str()));
auto_ptr<wchar_t> wstr(Ansi2WideString(currentFile.c_str()));
currentFile = utf8_encode(wstr.get());
#else
//currentFile = fileDialog->GetPath().ToAscii();
@ -766,7 +766,7 @@ void MainWindow::onMenuFileSaveAs(wxCommandEvent &event) {
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(fd.GetPath()));
currentFile = tmp_buf;
unique_ptr<wchar_t> wstr(Ansi2WideString(currentFile.c_str()));
auto_ptr<wchar_t> wstr(Ansi2WideString(currentFile.c_str()));
currentFile = utf8_encode(wstr.get());
#else
//currentFile = fd.GetPath().ToAscii();
@ -1639,7 +1639,7 @@ bool App::OnInit() {
fileparam = tmp_buf;
#ifdef WIN32
unique_ptr<wchar_t> wstr(Ansi2WideString(fileparam.c_str()));
auto_ptr<wchar_t> wstr(Ansi2WideString(fileparam.c_str()));
fileparam = utf8_encode(wstr.get());
#endif
@ -1664,7 +1664,7 @@ bool App::OnInit() {
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(exe_path));
appPath = tmp_buf;
unique_ptr<wchar_t> wstr(Ansi2WideString(appPath.c_str()));
auto_ptr<wchar_t> wstr(Ansi2WideString(appPath.c_str()));
appPath = utf8_encode(wstr.get());
#else
appPath = wxFNCONV(exe_path);

View File

@ -315,7 +315,7 @@ private:
static vector<vector<unsigned char> > nextColorIDReuseList;
static unique_ptr<PixelBufferWrapper> pbo;
static auto_ptr<PixelBufferWrapper> pbo;
void assign_color();

View File

@ -17,16 +17,13 @@
// =====================================================
// Hack for compilers that dont support cxx11's unique_ptr which replaces auto_ptr
// =====================================================
using namespace std;
//using namespace std;
// C++11
#if !defined(HAVE_CXX11) && !defined(__GXX_EXPERIMENTAL_CXX0X__) && (__cplusplus < 201103L) && (_MSC_VER < 1900)
#ifdef __APPLE__
template<typename T>
using unique_ptr = auto_ptr<T>;
#else
#define unique_ptr auto_ptr
#endif
#if defined(HAVE_CXX11) || (__cplusplus >= 201103L) || (_MSC_VER >= 1900)
#define auto_ptr std::unique_ptr
#endif
#endif

View File

@ -70,7 +70,7 @@ public:
private:
SDL_Thread* thread;
//std::unique_ptr<Mutex> mutexthreadAccessor;
//std::auto_ptr<Mutex> mutexthreadAccessor;
Mutex *mutexthreadAccessor;
ThreadState currentState;
bool threadObjectValid();
@ -129,7 +129,7 @@ private:
Shared::PlatformCommon::Chrono *chronoPerf;
bool isStaticMutexListMutex;
static unique_ptr<Mutex> mutexMutexList;
static auto_ptr<Mutex> mutexMutexList;
static vector<Mutex *> mutexList;
public:

View File

@ -1896,7 +1896,7 @@ const unsigned int BaseColorPickEntity::k = 43067;
unsigned int BaseColorPickEntity::nextColorRGB = BaseColorPickEntity::k;
unsigned char BaseColorPickEntity::nextColorID[COLOR_COMPONENTS] = { 1, 1, 1, 0 };
unique_ptr<PixelBufferWrapper> BaseColorPickEntity::pbo;
auto_ptr<PixelBufferWrapper> BaseColorPickEntity::pbo;
map<string,bool> BaseColorPickEntity::usedColorIDList;
bool BaseColorPickEntity::trackColorUse = true;
@ -2128,7 +2128,7 @@ vector<int> BaseColorPickEntity::getPickedList(int x,int y,int w,int h,
pickedModels.reserve(rendererModels.size());
//printf("In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
static unique_ptr<Pixmap2D> cachedPixels;
static auto_ptr<Pixmap2D> cachedPixels;
if(rendererModels.empty() == false) {
if(PixelBufferWrapper::getIsPBOEnable() == true) {

View File

@ -27,15 +27,15 @@ bool Thread::enableVerboseMode = false;
Mutex Thread::mutexthreadList;
vector<Thread *> Thread::threadList;
unique_ptr<Mutex> Mutex::mutexMutexList(new Mutex(CODE_AT_LINE));
auto_ptr<Mutex> Mutex::mutexMutexList(new Mutex(CODE_AT_LINE));
vector<Mutex *> Mutex::mutexList;
class ThreadGarbageCollector;
class Mutex;
class MutexSafeWrapper;
static unique_ptr<ThreadGarbageCollector> cleanupThread;
static unique_ptr<Mutex> cleanupThreadMutex(new Mutex(CODE_AT_LINE));
static auto_ptr<ThreadGarbageCollector> cleanupThread;
static auto_ptr<Mutex> cleanupThreadMutex(new Mutex(CODE_AT_LINE));
class ThreadGarbageCollector : public BaseThread
{
@ -546,7 +546,7 @@ inline void Mutex::p() {
// snprintf(szBuf,8095,"In [%s::%s Line: %d] mutex == NULL refCount = %d owner [%s] deleteownerId [%s] stack: %s",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,refCount,ownerId.c_str(),deleteownerId.c_str(),stack.c_str());
// throw megaglest_runtime_error(szBuf);
// }
// std::unique_ptr<Chrono> chronoLockPerf;
// std::auto_ptr<Chrono> chronoLockPerf;
// if(debugMutexLock == true) {
// chronoLockPerf.reset(new Chrono());
// chronoLockPerf->start();